From 1b8adde7ba7d5e04395c141c5400dc2cffd7d809 Mon Sep 17 00:00:00 2001 From: William Kucharski Date: Fri, 7 Nov 2008 21:36:41 -0700 Subject: 6731552 GRUB should have the ability to overlay a logo on the graphical splash screen 6762035 GRUB needs to understand new ext3 256 Byte inodes 6762243 GRUB should be updated to version 0.97 --HG-- rename : usr/src/grub/grub-0.95/AUTHORS => usr/src/grub/grub-0.97/AUTHORS rename : usr/src/grub/grub-0.95/BUGS => usr/src/grub/grub-0.97/BUGS rename : usr/src/grub/grub-0.95/COPYING => usr/src/grub/grub-0.97/COPYING rename : usr/src/grub/grub-0.95/COPYING.descrip => usr/src/grub/grub-0.97/COPYING.descrip rename : usr/src/grub/grub-0.95/ChangeLog => usr/src/grub/grub-0.97/ChangeLog rename : usr/src/grub/grub-0.95/INSTALL => usr/src/grub/grub-0.97/INSTALL rename : usr/src/grub/grub-0.95/MAINTENANCE => usr/src/grub/grub-0.97/MAINTENANCE rename : usr/src/grub/grub-0.95/Makefile.am => usr/src/grub/grub-0.97/Makefile.am rename : usr/src/grub/grub-0.95/Makefile.in => usr/src/grub/grub-0.97/Makefile.in rename : usr/src/grub/grub-0.95/Makefile.solaris => usr/src/grub/grub-0.97/Makefile.solaris rename : usr/src/grub/grub-0.95/Makefile.solaris.defs => usr/src/grub/grub-0.97/Makefile.solaris.defs rename : usr/src/grub/grub-0.95/NEWS => usr/src/grub/grub-0.97/NEWS rename : usr/src/grub/grub-0.95/README => usr/src/grub/grub-0.97/README rename : usr/src/grub/grub-0.95/THANKS => usr/src/grub/grub-0.97/THANKS rename : usr/src/grub/grub-0.95/TODO => usr/src/grub/grub-0.97/TODO rename : usr/src/grub/grub-0.95/acinclude.m4 => usr/src/grub/grub-0.97/acinclude.m4 rename : usr/src/grub/grub-0.95/aclocal.m4 => usr/src/grub/grub-0.97/aclocal.m4 rename : usr/src/grub/grub-0.95/compile => usr/src/grub/grub-0.97/compile rename : usr/src/grub/grub-0.95/config.guess => usr/src/grub/grub-0.97/config.guess rename : usr/src/grub/grub-0.95/config.h => usr/src/grub/grub-0.97/config.h rename : usr/src/grub/grub-0.95/config.h.in => usr/src/grub/grub-0.97/config.h.in rename : usr/src/grub/grub-0.95/config.status.solaris => usr/src/grub/grub-0.97/config.status.solaris rename : usr/src/grub/grub-0.95/config.sub => usr/src/grub/grub-0.97/config.sub rename : usr/src/grub/grub-0.95/configure => usr/src/grub/grub-0.97/configure rename : usr/src/grub/grub-0.95/configure.ac => usr/src/grub/grub-0.97/configure.ac rename : usr/src/grub/grub-0.95/depcomp => usr/src/grub/grub-0.97/depcomp rename : usr/src/grub/grub-0.95/docs/Makefile.am => usr/src/grub/grub-0.97/docs/Makefile.am rename : usr/src/grub/grub-0.95/docs/Makefile.in => usr/src/grub/grub-0.97/docs/Makefile.in rename : usr/src/grub/grub-0.95/docs/Makefile.solaris => usr/src/grub/grub-0.97/docs/Makefile.solaris rename : usr/src/grub/grub-0.95/docs/boot.S => usr/src/grub/grub-0.97/docs/boot.S rename : usr/src/grub/grub-0.95/docs/boot.S.texi => usr/src/grub/grub-0.97/docs/boot.S.texi rename : usr/src/grub/grub-0.95/docs/grub-install.8 => usr/src/grub/grub-0.97/docs/grub-install.8 rename : usr/src/grub/grub-0.95/docs/grub-md5-crypt.8 => usr/src/grub/grub-0.97/docs/grub-md5-crypt.8 rename : usr/src/grub/grub-0.95/docs/grub-terminfo.8 => usr/src/grub/grub-0.97/docs/grub-terminfo.8 rename : usr/src/grub/grub-0.95/docs/grub.8 => usr/src/grub/grub-0.97/docs/grub.8 rename : usr/src/grub/grub-0.95/docs/grub.info => usr/src/grub/grub-0.97/docs/grub.info rename : usr/src/grub/grub-0.95/docs/grub.info-1 => usr/src/grub/grub-0.97/docs/grub.info-1 rename : usr/src/grub/grub-0.95/docs/grub.info-2 => usr/src/grub/grub-0.97/docs/grub.info-2 rename : usr/src/grub/grub-0.95/docs/grub.info-3 => usr/src/grub/grub-0.97/docs/grub.info-3 rename : usr/src/grub/grub-0.95/docs/grub.info-4 => usr/src/grub/grub-0.97/docs/grub.info-4 rename : usr/src/grub/grub-0.95/docs/grub.texi => usr/src/grub/grub-0.97/docs/grub.texi rename : usr/src/grub/grub-0.95/docs/help2man => usr/src/grub/grub-0.97/docs/help2man rename : usr/src/grub/grub-0.95/docs/internals.texi => usr/src/grub/grub-0.97/docs/internals.texi rename : usr/src/grub/grub-0.95/docs/kernel.c => usr/src/grub/grub-0.97/docs/kernel.c rename : usr/src/grub/grub-0.95/docs/kernel.c.texi => usr/src/grub/grub-0.97/docs/kernel.c.texi rename : usr/src/grub/grub-0.95/docs/mbchk.1 => usr/src/grub/grub-0.97/docs/mbchk.1 rename : usr/src/grub/grub-0.95/docs/mdate-sh => usr/src/grub/grub-0.97/docs/mdate-sh rename : usr/src/grub/grub-0.95/docs/menu.lst => usr/src/grub/grub-0.97/docs/menu.lst rename : usr/src/grub/grub-0.95/docs/multiboot.h => usr/src/grub/grub-0.97/docs/multiboot.h rename : usr/src/grub/grub-0.95/docs/multiboot.h.texi => usr/src/grub/grub-0.97/docs/multiboot.h.texi rename : usr/src/grub/grub-0.95/docs/multiboot.info => usr/src/grub/grub-0.97/docs/multiboot.info rename : usr/src/grub/grub-0.95/docs/multiboot.texi => usr/src/grub/grub-0.97/docs/multiboot.texi rename : usr/src/grub/grub-0.95/docs/src2texi => usr/src/grub/grub-0.97/docs/src2texi rename : usr/src/grub/grub-0.95/docs/stamp-vti => usr/src/grub/grub-0.97/docs/stamp-vti rename : usr/src/grub/grub-0.95/docs/texinfo.tex => usr/src/grub/grub-0.97/docs/texinfo.tex rename : usr/src/grub/grub-0.95/docs/version.texi => usr/src/grub/grub-0.97/docs/version.texi rename : usr/src/grub/grub-0.95/grub/Makefile.am => usr/src/grub/grub-0.97/grub/Makefile.am rename : usr/src/grub/grub-0.95/grub/Makefile.in => usr/src/grub/grub-0.97/grub/Makefile.in rename : usr/src/grub/grub-0.95/grub/Makefile.solaris => usr/src/grub/grub-0.97/grub/Makefile.solaris rename : usr/src/grub/grub-0.95/grub/asmstub.c => usr/src/grub/grub-0.97/grub/asmstub.c rename : usr/src/grub/grub-0.95/grub/main.c => usr/src/grub/grub-0.97/grub/main.c rename : usr/src/grub/grub-0.95/grub/mapfile-intf => usr/src/grub/grub-0.97/grub/mapfile-intf rename : usr/src/grub/grub-0.95/install-sh => usr/src/grub/grub-0.97/install-sh rename : usr/src/grub/grub-0.95/lib/Makefile.am => usr/src/grub/grub-0.97/lib/Makefile.am rename : usr/src/grub/grub-0.95/lib/Makefile.in => usr/src/grub/grub-0.97/lib/Makefile.in rename : usr/src/grub/grub-0.95/lib/Makefile.solaris => usr/src/grub/grub-0.97/lib/Makefile.solaris rename : usr/src/grub/grub-0.95/lib/device.c => usr/src/grub/grub-0.97/lib/device.c rename : usr/src/grub/grub-0.95/lib/device.h => usr/src/grub/grub-0.97/lib/device.h rename : usr/src/grub/grub-0.95/lib/getopt.c => usr/src/grub/grub-0.97/lib/getopt.c rename : usr/src/grub/grub-0.95/lib/getopt.h => usr/src/grub/grub-0.97/lib/getopt.h rename : usr/src/grub/grub-0.95/lib/getopt1.c => usr/src/grub/grub-0.97/lib/getopt1.c rename : usr/src/grub/grub-0.95/missing => usr/src/grub/grub-0.97/missing rename : usr/src/grub/grub-0.95/mkinstalldirs => usr/src/grub/grub-0.97/mkinstalldirs rename : usr/src/grub/grub-0.95/netboot/3c595.c => usr/src/grub/grub-0.97/netboot/3c595.c rename : usr/src/grub/grub-0.95/netboot/3c595.h => usr/src/grub/grub-0.97/netboot/3c595.h rename : usr/src/grub/grub-0.95/netboot/3c90x.c => usr/src/grub/grub-0.97/netboot/3c90x.c rename : usr/src/grub/grub-0.95/netboot/Makefile.am => usr/src/grub/grub-0.97/netboot/Makefile.am rename : usr/src/grub/grub-0.95/netboot/Makefile.in => usr/src/grub/grub-0.97/netboot/Makefile.in rename : usr/src/grub/grub-0.95/netboot/Makefile.solaris => usr/src/grub/grub-0.97/netboot/Makefile.solaris rename : usr/src/grub/grub-0.95/netboot/README.netboot => usr/src/grub/grub-0.97/netboot/README.netboot rename : usr/src/grub/grub-0.95/netboot/basemem.c => usr/src/grub/grub-0.97/netboot/basemem.c rename : usr/src/grub/grub-0.95/netboot/big_bswap.h => usr/src/grub/grub-0.97/netboot/big_bswap.h rename : usr/src/grub/grub-0.95/netboot/bootp.h => usr/src/grub/grub-0.97/netboot/bootp.h rename : usr/src/grub/grub-0.95/netboot/byteswap.h => usr/src/grub/grub-0.97/netboot/byteswap.h rename : usr/src/grub/grub-0.95/netboot/config.c => usr/src/grub/grub-0.97/netboot/config.c rename : usr/src/grub/grub-0.95/netboot/cpu.h => usr/src/grub/grub-0.97/netboot/cpu.h rename : usr/src/grub/grub-0.95/netboot/davicom.c => usr/src/grub/grub-0.97/netboot/davicom.c rename : usr/src/grub/grub-0.95/netboot/dev.h => usr/src/grub/grub-0.97/netboot/dev.h rename : usr/src/grub/grub-0.95/netboot/e1000.c => usr/src/grub/grub-0.97/netboot/e1000.c rename : usr/src/grub/grub-0.95/netboot/e1000_hw.h => usr/src/grub/grub-0.97/netboot/e1000_hw.h rename : usr/src/grub/grub-0.95/netboot/eepro100.c => usr/src/grub/grub-0.97/netboot/eepro100.c rename : usr/src/grub/grub-0.95/netboot/elf.h => usr/src/grub/grub-0.97/netboot/elf.h rename : usr/src/grub/grub-0.95/netboot/endian.h => usr/src/grub/grub-0.97/netboot/endian.h rename : usr/src/grub/grub-0.95/netboot/epic100.c => usr/src/grub/grub-0.97/netboot/epic100.c rename : usr/src/grub/grub-0.95/netboot/epic100.h => usr/src/grub/grub-0.97/netboot/epic100.h rename : usr/src/grub/grub-0.95/netboot/etherboot.h => usr/src/grub/grub-0.97/netboot/etherboot.h rename : usr/src/grub/grub-0.95/netboot/forcedeth.c => usr/src/grub/grub-0.97/netboot/forcedeth.c rename : usr/src/grub/grub-0.95/netboot/fsys_tftp.c => usr/src/grub/grub-0.97/netboot/fsys_tftp.c rename : usr/src/grub/grub-0.95/netboot/grub.h => usr/src/grub/grub-0.97/netboot/grub.h rename : usr/src/grub/grub-0.95/netboot/i386_byteswap.h => usr/src/grub/grub-0.97/netboot/i386_byteswap.h rename : usr/src/grub/grub-0.95/netboot/i386_elf.h => usr/src/grub/grub-0.97/netboot/i386_elf.h rename : usr/src/grub/grub-0.95/netboot/i386_endian.h => usr/src/grub/grub-0.97/netboot/i386_endian.h rename : usr/src/grub/grub-0.95/netboot/i386_timer.c => usr/src/grub/grub-0.97/netboot/i386_timer.c rename : usr/src/grub/grub-0.95/netboot/if_arp.h => usr/src/grub/grub-0.97/netboot/if_arp.h rename : usr/src/grub/grub-0.95/netboot/if_ether.h => usr/src/grub/grub-0.97/netboot/if_ether.h rename : usr/src/grub/grub-0.95/netboot/igmp.h => usr/src/grub/grub-0.97/netboot/igmp.h rename : usr/src/grub/grub-0.95/netboot/in.h => usr/src/grub/grub-0.97/netboot/in.h rename : usr/src/grub/grub-0.95/netboot/io.h => usr/src/grub/grub-0.97/netboot/io.h rename : usr/src/grub/grub-0.95/netboot/ip.h => usr/src/grub/grub-0.97/netboot/ip.h rename : usr/src/grub/grub-0.95/netboot/isa.h => usr/src/grub/grub-0.97/netboot/isa.h rename : usr/src/grub/grub-0.95/netboot/latch.h => usr/src/grub/grub-0.97/netboot/latch.h rename : usr/src/grub/grub-0.95/netboot/little_bswap.h => usr/src/grub/grub-0.97/netboot/little_bswap.h rename : usr/src/grub/grub-0.95/netboot/mii.h => usr/src/grub/grub-0.97/netboot/mii.h rename : usr/src/grub/grub-0.95/netboot/misc.c => usr/src/grub/grub-0.97/netboot/misc.c rename : usr/src/grub/grub-0.95/netboot/natsemi.c => usr/src/grub/grub-0.97/netboot/natsemi.c rename : usr/src/grub/grub-0.95/netboot/nfs.h => usr/src/grub/grub-0.97/netboot/nfs.h rename : usr/src/grub/grub-0.95/netboot/nic.c => usr/src/grub/grub-0.97/netboot/nic.c rename : usr/src/grub/grub-0.95/netboot/nic.h => usr/src/grub/grub-0.97/netboot/nic.h rename : usr/src/grub/grub-0.95/netboot/ns83820.c => usr/src/grub/grub-0.97/netboot/ns83820.c rename : usr/src/grub/grub-0.95/netboot/ns8390.c => usr/src/grub/grub-0.97/netboot/ns8390.c rename : usr/src/grub/grub-0.95/netboot/ns8390.h => usr/src/grub/grub-0.97/netboot/ns8390.h rename : usr/src/grub/grub-0.95/netboot/osdep.h => usr/src/grub/grub-0.97/netboot/osdep.h rename : usr/src/grub/grub-0.95/netboot/pci.c => usr/src/grub/grub-0.97/netboot/pci.c rename : usr/src/grub/grub-0.95/netboot/pci.h => usr/src/grub/grub-0.97/netboot/pci.h rename : usr/src/grub/grub-0.95/netboot/pci_ids.h => usr/src/grub/grub-0.97/netboot/pci_ids.h rename : usr/src/grub/grub-0.95/netboot/pci_io.c => usr/src/grub/grub-0.97/netboot/pci_io.c rename : usr/src/grub/grub-0.95/netboot/pcnet32.c => usr/src/grub/grub-0.97/netboot/pcnet32.c rename : usr/src/grub/grub-0.95/netboot/pic8259.c => usr/src/grub/grub-0.97/netboot/pic8259.c rename : usr/src/grub/grub-0.95/netboot/pic8259.h => usr/src/grub/grub-0.97/netboot/pic8259.h rename : usr/src/grub/grub-0.95/netboot/pnic.c => usr/src/grub/grub-0.97/netboot/pnic.c rename : usr/src/grub/grub-0.95/netboot/pnic_api.h => usr/src/grub/grub-0.97/netboot/pnic_api.h rename : usr/src/grub/grub-0.95/netboot/pxe.h => usr/src/grub/grub-0.97/netboot/pxe.h rename : usr/src/grub/grub-0.95/netboot/r8169.c => usr/src/grub/grub-0.97/netboot/r8169.c rename : usr/src/grub/grub-0.95/netboot/rtl8139.c => usr/src/grub/grub-0.97/netboot/rtl8139.c rename : usr/src/grub/grub-0.95/netboot/segoff.h => usr/src/grub/grub-0.97/netboot/segoff.h rename : usr/src/grub/grub-0.95/netboot/sis900.c => usr/src/grub/grub-0.97/netboot/sis900.c rename : usr/src/grub/grub-0.95/netboot/sis900.h => usr/src/grub/grub-0.97/netboot/sis900.h rename : usr/src/grub/grub-0.95/netboot/stdint.h => usr/src/grub/grub-0.97/netboot/stdint.h rename : usr/src/grub/grub-0.95/netboot/sundance.c => usr/src/grub/grub-0.97/netboot/sundance.c rename : usr/src/grub/grub-0.95/netboot/tftp.h => usr/src/grub/grub-0.97/netboot/tftp.h rename : usr/src/grub/grub-0.95/netboot/tg3.c => usr/src/grub/grub-0.97/netboot/tg3.c rename : usr/src/grub/grub-0.95/netboot/tg3.h => usr/src/grub/grub-0.97/netboot/tg3.h rename : usr/src/grub/grub-0.95/netboot/timer.c => usr/src/grub/grub-0.97/netboot/timer.c rename : usr/src/grub/grub-0.95/netboot/timer.h => usr/src/grub/grub-0.97/netboot/timer.h rename : usr/src/grub/grub-0.95/netboot/tlan.c => usr/src/grub/grub-0.97/netboot/tlan.c rename : usr/src/grub/grub-0.95/netboot/tlan.h => usr/src/grub/grub-0.97/netboot/tlan.h rename : usr/src/grub/grub-0.95/netboot/tulip.c => usr/src/grub/grub-0.97/netboot/tulip.c rename : usr/src/grub/grub-0.95/netboot/types.h => usr/src/grub/grub-0.97/netboot/types.h rename : usr/src/grub/grub-0.95/netboot/udp.h => usr/src/grub/grub-0.97/netboot/udp.h rename : usr/src/grub/grub-0.95/netboot/undi.c => usr/src/grub/grub-0.97/netboot/undi.c rename : usr/src/grub/grub-0.95/netboot/undi.h => usr/src/grub/grub-0.97/netboot/undi.h rename : usr/src/grub/grub-0.95/netboot/via-rhine.c => usr/src/grub/grub-0.97/netboot/via-rhine.c rename : usr/src/grub/grub-0.95/netboot/w89c840.c => usr/src/grub/grub-0.97/netboot/w89c840.c rename : usr/src/grub/grub-0.95/stage1/Makefile.am => usr/src/grub/grub-0.97/stage1/Makefile.am rename : usr/src/grub/grub-0.95/stage1/Makefile.in => usr/src/grub/grub-0.97/stage1/Makefile.in rename : usr/src/grub/grub-0.95/stage1/Makefile.solaris => usr/src/grub/grub-0.97/stage1/Makefile.solaris rename : usr/src/grub/grub-0.95/stage1/stage1.S => usr/src/grub/grub-0.97/stage1/stage1.S rename : usr/src/grub/grub-0.95/stage1/stage1.h => usr/src/grub/grub-0.97/stage1/stage1.h rename : usr/src/grub/grub-0.95/stage2/Makefile.am => usr/src/grub/grub-0.97/stage2/Makefile.am rename : usr/src/grub/grub-0.95/stage2/Makefile.in => usr/src/grub/grub-0.97/stage2/Makefile.in rename : usr/src/grub/grub-0.95/stage2/Makefile.solaris => usr/src/grub/grub-0.97/stage2/Makefile.solaris rename : usr/src/grub/grub-0.95/stage2/apic.h => usr/src/grub/grub-0.97/stage2/apic.h rename : usr/src/grub/grub-0.95/stage2/apm.S => usr/src/grub/grub-0.97/stage2/apm.S rename : usr/src/grub/grub-0.95/stage2/asm.S => usr/src/grub/grub-0.97/stage2/asm.S rename : usr/src/grub/grub-0.95/stage2/bios.c => usr/src/grub/grub-0.97/stage2/bios.c rename : usr/src/grub/grub-0.95/stage2/boot.c => usr/src/grub/grub-0.97/stage2/boot.c rename : usr/src/grub/grub-0.95/stage2/builtins.c => usr/src/grub/grub-0.97/stage2/builtins.c rename : usr/src/grub/grub-0.95/stage2/char_io.c => usr/src/grub/grub-0.97/stage2/char_io.c rename : usr/src/grub/grub-0.95/stage2/cmdline.c => usr/src/grub/grub-0.97/stage2/cmdline.c rename : usr/src/grub/grub-0.95/stage2/common.c => usr/src/grub/grub-0.97/stage2/common.c rename : usr/src/grub/grub-0.95/stage2/console.c => usr/src/grub/grub-0.97/stage2/console.c rename : usr/src/grub/grub-0.95/stage2/controlregs.h => usr/src/grub/grub-0.97/stage2/controlregs.h rename : usr/src/grub/grub-0.95/stage2/cpu.h => usr/src/grub/grub-0.97/stage2/cpu.h rename : usr/src/grub/grub-0.95/stage2/defs.h => usr/src/grub/grub-0.97/stage2/defs.h rename : usr/src/grub/grub-0.95/stage2/dir.h => usr/src/grub/grub-0.97/stage2/dir.h rename : usr/src/grub/grub-0.95/stage2/disk_inode.h => usr/src/grub/grub-0.97/stage2/disk_inode.h rename : usr/src/grub/grub-0.95/stage2/disk_inode_ffs.h => usr/src/grub/grub-0.97/stage2/disk_inode_ffs.h rename : usr/src/grub/grub-0.95/stage2/disk_io.c => usr/src/grub/grub-0.97/stage2/disk_io.c rename : usr/src/grub/grub-0.95/stage2/fat.h => usr/src/grub/grub-0.97/stage2/fat.h rename : usr/src/grub/grub-0.95/stage2/filesys.h => usr/src/grub/grub-0.97/stage2/filesys.h rename : usr/src/grub/grub-0.95/stage2/freebsd.h => usr/src/grub/grub-0.97/stage2/freebsd.h rename : usr/src/grub/grub-0.95/stage2/fs.h => usr/src/grub/grub-0.97/stage2/fs.h rename : usr/src/grub/grub-0.95/stage2/fsys_ext2fs.c => usr/src/grub/grub-0.97/stage2/fsys_ext2fs.c rename : usr/src/grub/grub-0.95/stage2/fsys_fat.c => usr/src/grub/grub-0.97/stage2/fsys_fat.c rename : usr/src/grub/grub-0.95/stage2/fsys_ffs.c => usr/src/grub/grub-0.97/stage2/fsys_ffs.c rename : usr/src/grub/grub-0.95/stage2/fsys_iso9660.c => usr/src/grub/grub-0.97/stage2/fsys_iso9660.c rename : usr/src/grub/grub-0.95/stage2/fsys_jfs.c => usr/src/grub/grub-0.97/stage2/fsys_jfs.c rename : usr/src/grub/grub-0.95/stage2/fsys_minix.c => usr/src/grub/grub-0.97/stage2/fsys_minix.c rename : usr/src/grub/grub-0.95/stage2/fsys_reiserfs.c => usr/src/grub/grub-0.97/stage2/fsys_reiserfs.c rename : usr/src/grub/grub-0.95/stage2/fsys_ufs.c => usr/src/grub/grub-0.97/stage2/fsys_ufs.c rename : usr/src/grub/grub-0.95/stage2/fsys_ufs2.c => usr/src/grub/grub-0.97/stage2/fsys_ufs2.c rename : usr/src/grub/grub-0.95/stage2/fsys_vstafs.c => usr/src/grub/grub-0.97/stage2/fsys_vstafs.c rename : usr/src/grub/grub-0.95/stage2/fsys_xfs.c => usr/src/grub/grub-0.97/stage2/fsys_xfs.c rename : usr/src/grub/grub-0.95/stage2/fsys_zfs.c => usr/src/grub/grub-0.97/stage2/fsys_zfs.c rename : usr/src/grub/grub-0.95/stage2/fsys_zfs.h => usr/src/grub/grub-0.97/stage2/fsys_zfs.h rename : usr/src/grub/grub-0.95/stage2/graphics.c => usr/src/grub/grub-0.97/stage2/graphics.c rename : usr/src/grub/grub-0.95/stage2/graphics.h => usr/src/grub/grub-0.97/stage2/graphics.h rename : usr/src/grub/grub-0.95/stage2/gunzip.c => usr/src/grub/grub-0.97/stage2/gunzip.c rename : usr/src/grub/grub-0.95/stage2/hercules.c => usr/src/grub/grub-0.97/stage2/hercules.c rename : usr/src/grub/grub-0.95/stage2/hercules.h => usr/src/grub/grub-0.97/stage2/hercules.h rename : usr/src/grub/grub-0.95/stage2/i386-elf.h => usr/src/grub/grub-0.97/stage2/i386-elf.h rename : usr/src/grub/grub-0.95/stage2/imgact_aout.h => usr/src/grub/grub-0.97/stage2/imgact_aout.h rename : usr/src/grub/grub-0.95/stage2/iso9660.h => usr/src/grub/grub-0.97/stage2/iso9660.h rename : usr/src/grub/grub-0.95/stage2/jfs.h => usr/src/grub/grub-0.97/stage2/jfs.h rename : usr/src/grub/grub-0.95/stage2/mb_header.h => usr/src/grub/grub-0.97/stage2/mb_header.h rename : usr/src/grub/grub-0.95/stage2/mb_info.h => usr/src/grub/grub-0.97/stage2/mb_info.h rename : usr/src/grub/grub-0.95/stage2/md5.c => usr/src/grub/grub-0.97/stage2/md5.c rename : usr/src/grub/grub-0.95/stage2/md5.h => usr/src/grub/grub-0.97/stage2/md5.h rename : usr/src/grub/grub-0.95/stage2/nbi.h => usr/src/grub/grub-0.97/stage2/nbi.h rename : usr/src/grub/grub-0.95/stage2/nbloader.S => usr/src/grub/grub-0.97/stage2/nbloader.S rename : usr/src/grub/grub-0.95/stage2/pc_slice.h => usr/src/grub/grub-0.97/stage2/pc_slice.h rename : usr/src/grub/grub-0.95/stage2/pxeloader.S => usr/src/grub/grub-0.97/stage2/pxeloader.S rename : usr/src/grub/grub-0.95/stage2/serial.c => usr/src/grub/grub-0.97/stage2/serial.c rename : usr/src/grub/grub-0.95/stage2/serial.h => usr/src/grub/grub-0.97/stage2/serial.h rename : usr/src/grub/grub-0.95/stage2/setjmp.S => usr/src/grub/grub-0.97/stage2/setjmp.S rename : usr/src/grub/grub-0.95/stage2/shared.h => usr/src/grub/grub-0.97/stage2/shared.h rename : usr/src/grub/grub-0.95/stage2/size_test => usr/src/grub/grub-0.97/stage2/size_test rename : usr/src/grub/grub-0.95/stage2/smp-imps.c => usr/src/grub/grub-0.97/stage2/smp-imps.c rename : usr/src/grub/grub-0.95/stage2/smp-imps.h => usr/src/grub/grub-0.97/stage2/smp-imps.h rename : usr/src/grub/grub-0.95/stage2/stage1_5.c => usr/src/grub/grub-0.97/stage2/stage1_5.c rename : usr/src/grub/grub-0.95/stage2/stage2.c => usr/src/grub/grub-0.97/stage2/stage2.c rename : usr/src/grub/grub-0.95/stage2/start.S => usr/src/grub/grub-0.97/stage2/start.S rename : usr/src/grub/grub-0.95/stage2/start_eltorito.S => usr/src/grub/grub-0.97/stage2/start_eltorito.S rename : usr/src/grub/grub-0.95/stage2/term.h => usr/src/grub/grub-0.97/stage2/term.h rename : usr/src/grub/grub-0.95/stage2/terminfo.c => usr/src/grub/grub-0.97/stage2/terminfo.c rename : usr/src/grub/grub-0.95/stage2/terminfo.h => usr/src/grub/grub-0.97/stage2/terminfo.h rename : usr/src/grub/grub-0.95/stage2/tparm.c => usr/src/grub/grub-0.97/stage2/tparm.c rename : usr/src/grub/grub-0.95/stage2/tparm.h => usr/src/grub/grub-0.97/stage2/tparm.h rename : usr/src/grub/grub-0.95/stage2/ufs.h => usr/src/grub/grub-0.97/stage2/ufs.h rename : usr/src/grub/grub-0.95/stage2/ufs2.h => usr/src/grub/grub-0.97/stage2/ufs2.h rename : usr/src/grub/grub-0.95/stage2/vstafs.h => usr/src/grub/grub-0.97/stage2/vstafs.h rename : usr/src/grub/grub-0.95/stage2/xfs.h => usr/src/grub/grub-0.97/stage2/xfs.h rename : usr/src/grub/grub-0.95/stage2/zfs-include/dmu.h => usr/src/grub/grub-0.97/stage2/zfs-include/dmu.h rename : usr/src/grub/grub-0.95/stage2/zfs-include/dmu_objset.h => usr/src/grub/grub-0.97/stage2/zfs-include/dmu_objset.h rename : usr/src/grub/grub-0.95/stage2/zfs-include/dnode.h => usr/src/grub/grub-0.97/stage2/zfs-include/dnode.h rename : usr/src/grub/grub-0.95/stage2/zfs-include/dsl_dataset.h => usr/src/grub/grub-0.97/stage2/zfs-include/dsl_dataset.h rename : usr/src/grub/grub-0.95/stage2/zfs-include/dsl_dir.h => usr/src/grub/grub-0.97/stage2/zfs-include/dsl_dir.h rename : usr/src/grub/grub-0.95/stage2/zfs-include/spa.h => usr/src/grub/grub-0.97/stage2/zfs-include/spa.h rename : usr/src/grub/grub-0.95/stage2/zfs-include/uberblock_impl.h => usr/src/grub/grub-0.97/stage2/zfs-include/uberblock_impl.h rename : usr/src/grub/grub-0.95/stage2/zfs-include/vdev_impl.h => usr/src/grub/grub-0.97/stage2/zfs-include/vdev_impl.h rename : usr/src/grub/grub-0.95/stage2/zfs-include/zap_impl.h => usr/src/grub/grub-0.97/stage2/zfs-include/zap_impl.h rename : usr/src/grub/grub-0.95/stage2/zfs-include/zap_leaf.h => usr/src/grub/grub-0.97/stage2/zfs-include/zap_leaf.h rename : usr/src/grub/grub-0.95/stage2/zfs-include/zfs.h => usr/src/grub/grub-0.97/stage2/zfs-include/zfs.h rename : usr/src/grub/grub-0.95/stage2/zfs-include/zfs_acl.h => usr/src/grub/grub-0.97/stage2/zfs-include/zfs_acl.h rename : usr/src/grub/grub-0.95/stage2/zfs-include/zfs_znode.h => usr/src/grub/grub-0.97/stage2/zfs-include/zfs_znode.h rename : usr/src/grub/grub-0.95/stage2/zfs-include/zil.h => usr/src/grub/grub-0.97/stage2/zfs-include/zil.h rename : usr/src/grub/grub-0.95/stage2/zfs-include/zio.h => usr/src/grub/grub-0.97/stage2/zfs-include/zio.h rename : usr/src/grub/grub-0.95/stage2/zfs-include/zio_checksum.h => usr/src/grub/grub-0.97/stage2/zfs-include/zio_checksum.h rename : usr/src/grub/grub-0.95/stage2/zfs_fletcher.c => usr/src/grub/grub-0.97/stage2/zfs_fletcher.c rename : usr/src/grub/grub-0.95/stage2/zfs_lzjb.c => usr/src/grub/grub-0.97/stage2/zfs_lzjb.c rename : usr/src/grub/grub-0.95/stage2/zfs_sha256.c => usr/src/grub/grub-0.97/stage2/zfs_sha256.c rename : usr/src/grub/grub-0.95/stamp-h.in => usr/src/grub/grub-0.97/stamp-h.in rename : usr/src/grub/grub-0.95/util/Makefile.am => usr/src/grub/grub-0.97/util/Makefile.am rename : usr/src/grub/grub-0.95/util/Makefile.in => usr/src/grub/grub-0.97/util/Makefile.in rename : usr/src/grub/grub-0.95/util/Makefile.solaris => usr/src/grub/grub-0.97/util/Makefile.solaris rename : usr/src/grub/grub-0.95/util/grub-image.in => usr/src/grub/grub-0.97/util/grub-image.in rename : usr/src/grub/grub-0.95/util/grub-install.in => usr/src/grub/grub-0.97/util/grub-install.in rename : usr/src/grub/grub-0.95/util/grub-md5-crypt.in => usr/src/grub/grub-0.97/util/grub-md5-crypt.in rename : usr/src/grub/grub-0.95/util/grub-set-default.in => usr/src/grub/grub-0.97/util/grub-set-default.in rename : usr/src/grub/grub-0.95/util/grub-terminfo.in => usr/src/grub/grub-0.97/util/grub-terminfo.in rename : usr/src/grub/grub-0.95/util/mbchk.c => usr/src/grub/grub-0.97/util/mbchk.c rename : usr/src/grub/grub-0.95/util/mkbimage => usr/src/grub/grub-0.97/util/mkbimage --- usr/src/grub/Makefile | 2 +- usr/src/grub/README.grub | 2 +- usr/src/grub/grub-0.95/AUTHORS | 63 - usr/src/grub/grub-0.95/BUGS | 7 - usr/src/grub/grub-0.95/COPYING | 340 - usr/src/grub/grub-0.95/COPYING.descrip | 1 - usr/src/grub/grub-0.95/ChangeLog | 8978 ------------------- usr/src/grub/grub-0.95/INSTALL | 266 - usr/src/grub/grub-0.95/MAINTENANCE | 60 - usr/src/grub/grub-0.95/Makefile.am | 4 - usr/src/grub/grub-0.95/Makefile.in | 600 -- usr/src/grub/grub-0.95/Makefile.solaris | 55 - usr/src/grub/grub-0.95/Makefile.solaris.defs | 88 - usr/src/grub/grub-0.95/NEWS | 552 -- usr/src/grub/grub-0.95/README | 23 - usr/src/grub/grub-0.95/THANKS | 121 - usr/src/grub/grub-0.95/TODO | 102 - usr/src/grub/grub-0.95/acinclude.m4 | 366 - usr/src/grub/grub-0.95/aclocal.m4 | 934 -- usr/src/grub/grub-0.95/compile | 136 - usr/src/grub/grub-0.95/config.guess | 1432 --- usr/src/grub/grub-0.95/config.h | 107 - usr/src/grub/grub-0.95/config.h.in | 106 - usr/src/grub/grub-0.95/config.status.solaris | 1252 --- usr/src/grub/grub-0.95/config.sub | 1537 ---- usr/src/grub/grub-0.95/configure | 7531 ---------------- usr/src/grub/grub-0.95/configure.ac | 605 -- usr/src/grub/grub-0.95/depcomp | 520 -- usr/src/grub/grub-0.95/docs/Makefile.am | 65 - usr/src/grub/grub-0.95/docs/Makefile.in | 768 -- usr/src/grub/grub-0.95/docs/Makefile.solaris | 68 - usr/src/grub/grub-0.95/docs/boot.S | 80 - usr/src/grub/grub-0.95/docs/boot.S.texi | 80 - usr/src/grub/grub-0.95/docs/grub-install.8 | 52 - usr/src/grub/grub-0.95/docs/grub-md5-crypt.8 | 32 - usr/src/grub/grub-0.95/docs/grub-terminfo.8 | 29 - usr/src/grub/grub-0.95/docs/grub.8 | 71 - usr/src/grub/grub-0.95/docs/grub.info | 200 - usr/src/grub/grub-0.95/docs/grub.info-1 | 1338 --- usr/src/grub/grub-0.95/docs/grub.info-2 | 1436 --- usr/src/grub/grub-0.95/docs/grub.info-3 | 1366 --- usr/src/grub/grub-0.95/docs/grub.info-4 | 249 - usr/src/grub/grub-0.95/docs/grub.texi | 3987 --------- usr/src/grub/grub-0.95/docs/help2man | 517 -- usr/src/grub/grub-0.95/docs/internals.texi | 427 - usr/src/grub/grub-0.95/docs/kernel.c | 284 - usr/src/grub/grub-0.95/docs/kernel.c.texi | 284 - usr/src/grub/grub-0.95/docs/mbchk.1 | 27 - usr/src/grub/grub-0.95/docs/mdate-sh | 170 - usr/src/grub/grub-0.95/docs/menu.lst | 82 - usr/src/grub/grub-0.95/docs/multiboot.h | 119 - usr/src/grub/grub-0.95/docs/multiboot.h.texi | 119 - usr/src/grub/grub-0.95/docs/multiboot.info | 1661 ---- usr/src/grub/grub-0.95/docs/multiboot.texi | 1234 --- usr/src/grub/grub-0.95/docs/src2texi | 16 - usr/src/grub/grub-0.95/docs/stamp-vti | 4 - usr/src/grub/grub-0.95/docs/texinfo.tex | 6735 -------------- usr/src/grub/grub-0.95/docs/version.texi | 4 - usr/src/grub/grub-0.95/grub/Makefile.am | 19 - usr/src/grub/grub-0.95/grub/Makefile.in | 445 - usr/src/grub/grub-0.95/grub/Makefile.solaris | 77 - usr/src/grub/grub-0.95/grub/asmstub.c | 1310 --- usr/src/grub/grub-0.95/grub/main.c | 265 - usr/src/grub/grub-0.95/grub/mapfile-intf | 43 - usr/src/grub/grub-0.95/install-sh | 310 - usr/src/grub/grub-0.95/lib/Makefile.am | 6 - usr/src/grub/grub-0.95/lib/Makefile.in | 417 - usr/src/grub/grub-0.95/lib/Makefile.solaris | 56 - usr/src/grub/grub-0.95/lib/device.c | 938 -- usr/src/grub/grub-0.95/lib/device.h | 48 - usr/src/grub/grub-0.95/lib/getopt.c | 1053 --- usr/src/grub/grub-0.95/lib/getopt.h | 133 - usr/src/grub/grub-0.95/lib/getopt1.c | 190 - usr/src/grub/grub-0.95/missing | 360 - usr/src/grub/grub-0.95/mkinstalldirs | 143 - usr/src/grub/grub-0.95/netboot/3c595.c | 550 -- usr/src/grub/grub-0.95/netboot/3c595.h | 435 - usr/src/grub/grub-0.95/netboot/3c90x.c | 995 --- usr/src/grub/grub-0.95/netboot/Makefile.am | 287 - usr/src/grub/grub-0.95/netboot/Makefile.in | 1288 --- usr/src/grub/grub-0.95/netboot/Makefile.solaris | 168 - usr/src/grub/grub-0.95/netboot/README.netboot | 168 - usr/src/grub/grub-0.95/netboot/basemem.c | 178 - usr/src/grub/grub-0.95/netboot/big_bswap.h | 17 - usr/src/grub/grub-0.95/netboot/bootp.h | 182 - usr/src/grub/grub-0.95/netboot/byteswap.h | 20 - usr/src/grub/grub-0.95/netboot/config.c | 165 - usr/src/grub/grub-0.95/netboot/cpu.h | 243 - usr/src/grub/grub-0.95/netboot/davicom.c | 718 -- usr/src/grub/grub-0.95/netboot/dev.h | 83 - usr/src/grub/grub-0.95/netboot/e1000.c | 3682 -------- usr/src/grub/grub-0.95/netboot/e1000_hw.h | 2058 ----- usr/src/grub/grub-0.95/netboot/eepro100.c | 809 -- usr/src/grub/grub-0.95/netboot/elf.h | 234 - usr/src/grub/grub-0.95/netboot/endian.h | 19 - usr/src/grub/grub-0.95/netboot/epic100.c | 520 -- usr/src/grub/grub-0.95/netboot/epic100.h | 188 - usr/src/grub/grub-0.95/netboot/etherboot.h | 62 - usr/src/grub/grub-0.95/netboot/forcedeth.c | 1039 --- usr/src/grub/grub-0.95/netboot/fsys_tftp.c | 877 -- usr/src/grub/grub-0.95/netboot/grub.h | 171 - usr/src/grub/grub-0.95/netboot/i386_byteswap.h | 46 - usr/src/grub/grub-0.95/netboot/i386_elf.h | 91 - usr/src/grub/grub-0.95/netboot/i386_endian.h | 6 - usr/src/grub/grub-0.95/netboot/i386_timer.c | 192 - usr/src/grub/grub-0.95/netboot/if_arp.h | 29 - usr/src/grub/grub-0.95/netboot/if_ether.h | 21 - usr/src/grub/grub-0.95/netboot/igmp.h | 27 - usr/src/grub/grub-0.95/netboot/in.h | 21 - usr/src/grub/grub-0.95/netboot/io.h | 239 - usr/src/grub/grub-0.95/netboot/ip.h | 36 - usr/src/grub/grub-0.95/netboot/isa.h | 27 - usr/src/grub/grub-0.95/netboot/latch.h | 10 - usr/src/grub/grub-0.95/netboot/little_bswap.h | 17 - usr/src/grub/grub-0.95/netboot/mii.h | 105 - usr/src/grub/grub-0.95/netboot/misc.c | 321 - usr/src/grub/grub-0.95/netboot/natsemi.c | 780 -- usr/src/grub/grub-0.95/netboot/nfs.h | 63 - usr/src/grub/grub-0.95/netboot/nic.c | 1312 --- usr/src/grub/grub-0.95/netboot/nic.h | 45 - usr/src/grub/grub-0.95/netboot/ns83820.c | 1020 --- usr/src/grub/grub-0.95/netboot/ns8390.c | 1016 --- usr/src/grub/grub-0.95/netboot/ns8390.h | 238 - usr/src/grub/grub-0.95/netboot/osdep.h | 22 - usr/src/grub/grub-0.95/netboot/pci.c | 530 -- usr/src/grub/grub-0.95/netboot/pci.h | 357 - usr/src/grub/grub-0.95/netboot/pci_ids.h | 1809 ---- usr/src/grub/grub-0.95/netboot/pci_io.c | 431 - usr/src/grub/grub-0.95/netboot/pcnet32.c | 1004 --- usr/src/grub/grub-0.95/netboot/pic8259.c | 205 - usr/src/grub/grub-0.95/netboot/pic8259.h | 98 - usr/src/grub/grub-0.95/netboot/pnic.c | 267 - usr/src/grub/grub-0.95/netboot/pnic_api.h | 59 - usr/src/grub/grub-0.95/netboot/pxe.h | 521 -- usr/src/grub/grub-0.95/netboot/r8169.c | 854 -- usr/src/grub/grub-0.95/netboot/rtl8139.c | 551 -- usr/src/grub/grub-0.95/netboot/segoff.h | 43 - usr/src/grub/grub-0.95/netboot/sis900.c | 1251 --- usr/src/grub/grub-0.95/netboot/sis900.h | 380 - usr/src/grub/grub-0.95/netboot/stdint.h | 18 - usr/src/grub/grub-0.95/netboot/sundance.c | 896 -- usr/src/grub/grub-0.95/netboot/tftp.h | 82 - usr/src/grub/grub-0.95/netboot/tg3.c | 3322 ------- usr/src/grub/grub-0.95/netboot/tg3.h | 2203 ----- usr/src/grub/grub-0.95/netboot/timer.c | 29 - usr/src/grub/grub-0.95/netboot/timer.h | 68 - usr/src/grub/grub-0.95/netboot/tlan.c | 1814 ---- usr/src/grub/grub-0.95/netboot/tlan.h | 536 -- usr/src/grub/grub-0.95/netboot/tulip.c | 2069 ----- usr/src/grub/grub-0.95/netboot/types.h | 44 - usr/src/grub/grub-0.95/netboot/udp.h | 30 - usr/src/grub/grub-0.95/netboot/undi.c | 1321 --- usr/src/grub/grub-0.95/netboot/undi.h | 239 - usr/src/grub/grub-0.95/netboot/via-rhine.c | 1318 --- usr/src/grub/grub-0.95/netboot/w89c840.c | 955 -- usr/src/grub/grub-0.95/stage1/Makefile.am | 15 - usr/src/grub/grub-0.95/stage1/Makefile.in | 424 - usr/src/grub/grub-0.95/stage1/Makefile.solaris | 74 - usr/src/grub/grub-0.95/stage1/stage1.S | 493 -- usr/src/grub/grub-0.95/stage1/stage1.h | 86 - usr/src/grub/grub-0.95/stage2/Makefile.am | 304 - usr/src/grub/grub-0.95/stage2/Makefile.in | 4349 --------- usr/src/grub/grub-0.95/stage2/Makefile.solaris | 941 -- usr/src/grub/grub-0.95/stage2/apic.h | 72 - usr/src/grub/grub-0.95/stage2/apm.S | 125 - usr/src/grub/grub-0.95/stage2/asm.S | 2755 ------ usr/src/grub/grub-0.95/stage2/bios.c | 341 - usr/src/grub/grub-0.95/stage2/boot.c | 1030 --- usr/src/grub/grub-0.95/stage2/builtins.c | 5860 ------------- usr/src/grub/grub-0.95/stage2/char_io.c | 1413 --- usr/src/grub/grub-0.95/stage2/cmdline.c | 273 - usr/src/grub/grub-0.95/stage2/common.c | 354 - usr/src/grub/grub-0.95/stage2/console.c | 62 - usr/src/grub/grub-0.95/stage2/controlregs.h | 161 - usr/src/grub/grub-0.95/stage2/cpu.h | 73 - usr/src/grub/grub-0.95/stage2/defs.h | 98 - usr/src/grub/grub-0.95/stage2/dir.h | 147 - usr/src/grub/grub-0.95/stage2/disk_inode.h | 110 - usr/src/grub/grub-0.95/stage2/disk_inode_ffs.h | 101 - usr/src/grub/grub-0.95/stage2/disk_io.c | 1876 ---- usr/src/grub/grub-0.95/stage2/fat.h | 100 - usr/src/grub/grub-0.95/stage2/filesys.h | 186 - usr/src/grub/grub-0.95/stage2/freebsd.h | 95 - usr/src/grub/grub-0.95/stage2/fs.h | 457 - usr/src/grub/grub-0.95/stage2/fsys_ext2fs.c | 789 -- usr/src/grub/grub-0.95/stage2/fsys_fat.c | 486 -- usr/src/grub/grub-0.95/stage2/fsys_ffs.c | 310 - usr/src/grub/grub-0.95/stage2/fsys_iso9660.c | 449 - usr/src/grub/grub-0.95/stage2/fsys_jfs.c | 403 - usr/src/grub/grub-0.95/stage2/fsys_minix.c | 534 -- usr/src/grub/grub-0.95/stage2/fsys_reiserfs.c | 1239 --- usr/src/grub/grub-0.95/stage2/fsys_ufs.c | 266 - usr/src/grub/grub-0.95/stage2/fsys_ufs2.c | 331 - usr/src/grub/grub-0.95/stage2/fsys_vstafs.c | 252 - usr/src/grub/grub-0.95/stage2/fsys_xfs.c | 624 -- usr/src/grub/grub-0.95/stage2/fsys_zfs.c | 1423 --- usr/src/grub/grub-0.95/stage2/fsys_zfs.h | 194 - usr/src/grub/grub-0.95/stage2/graphics.c | 552 -- usr/src/grub/grub-0.95/stage2/graphics.h | 42 - usr/src/grub/grub-0.95/stage2/gunzip.c | 1362 --- usr/src/grub/grub-0.95/stage2/hercules.c | 186 - usr/src/grub/grub-0.95/stage2/hercules.h | 31 - usr/src/grub/grub-0.95/stage2/i386-elf.h | 237 - usr/src/grub/grub-0.95/stage2/imgact_aout.h | 158 - usr/src/grub/grub-0.95/stage2/iso9660.h | 219 - usr/src/grub/grub-0.95/stage2/jfs.h | 601 -- usr/src/grub/grub-0.95/stage2/mb_header.h | 90 - usr/src/grub/grub-0.95/stage2/mb_info.h | 217 - usr/src/grub/grub-0.95/stage2/md5.c | 383 - usr/src/grub/grub-0.95/stage2/md5.h | 30 - usr/src/grub/grub-0.95/stage2/nbi.h | 33 - usr/src/grub/grub-0.95/stage2/nbloader.S | 121 - usr/src/grub/grub-0.95/stage2/pc_slice.h | 283 - usr/src/grub/grub-0.95/stage2/pxeloader.S | 54 - usr/src/grub/grub-0.95/stage2/serial.c | 434 - usr/src/grub/grub-0.95/stage2/serial.h | 93 - usr/src/grub/grub-0.95/stage2/setjmp.S | 81 - usr/src/grub/grub-0.95/stage2/shared.h | 1068 --- usr/src/grub/grub-0.95/stage2/size_test | 54 - usr/src/grub/grub-0.95/stage2/smp-imps.c | 738 -- usr/src/grub/grub-0.95/stage2/smp-imps.h | 238 - usr/src/grub/grub-0.95/stage2/stage1_5.c | 69 - usr/src/grub/grub-0.95/stage2/stage2.c | 1104 --- usr/src/grub/grub-0.95/stage2/start.S | 409 - usr/src/grub/grub-0.95/stage2/start_eltorito.S | 326 - usr/src/grub/grub-0.95/stage2/term.h | 153 - usr/src/grub/grub-0.95/stage2/terminfo.c | 258 - usr/src/grub/grub-0.95/stage2/terminfo.h | 51 - usr/src/grub/grub-0.95/stage2/tparm.c | 727 -- usr/src/grub/grub-0.95/stage2/tparm.h | 28 - usr/src/grub/grub-0.95/stage2/ufs.h | 231 - usr/src/grub/grub-0.95/stage2/ufs2.h | 439 - usr/src/grub/grub-0.95/stage2/vstafs.h | 88 - usr/src/grub/grub-0.95/stage2/xfs.h | 544 -- usr/src/grub/grub-0.95/stage2/zfs-include/dmu.h | 107 - .../grub/grub-0.95/stage2/zfs-include/dmu_objset.h | 37 - usr/src/grub/grub-0.95/stage2/zfs-include/dnode.h | 78 - .../grub-0.95/stage2/zfs-include/dsl_dataset.h | 55 - .../grub/grub-0.95/stage2/zfs-include/dsl_dir.h | 51 - usr/src/grub/grub-0.95/stage2/zfs-include/spa.h | 285 - .../grub-0.95/stage2/zfs-include/uberblock_impl.h | 51 - .../grub/grub-0.95/stage2/zfs-include/vdev_impl.h | 72 - .../grub/grub-0.95/stage2/zfs-include/zap_impl.h | 112 - .../grub/grub-0.95/stage2/zfs-include/zap_leaf.h | 102 - usr/src/grub/grub-0.95/stage2/zfs-include/zfs.h | 101 - .../grub/grub-0.95/stage2/zfs-include/zfs_acl.h | 62 - .../grub/grub-0.95/stage2/zfs-include/zfs_znode.h | 70 - usr/src/grub/grub-0.95/stage2/zfs-include/zil.h | 53 - usr/src/grub/grub-0.95/stage2/zfs-include/zio.h | 83 - .../grub-0.95/stage2/zfs-include/zio_checksum.h | 44 - usr/src/grub/grub-0.95/stage2/zfs_fletcher.c | 95 - usr/src/grub/grub-0.95/stage2/zfs_lzjb.c | 61 - usr/src/grub/grub-0.95/stage2/zfs_sha256.c | 126 - usr/src/grub/grub-0.95/stamp-h.in | 1 - usr/src/grub/grub-0.95/util/Makefile.am | 12 - usr/src/grub/grub-0.95/util/Makefile.in | 478 - usr/src/grub/grub-0.95/util/Makefile.solaris | 81 - usr/src/grub/grub-0.95/util/grub-image.in | 138 - usr/src/grub/grub-0.95/util/grub-install.in | 477 - usr/src/grub/grub-0.95/util/grub-md5-crypt.in | 99 - usr/src/grub/grub-0.95/util/grub-set-default.in | 114 - usr/src/grub/grub-0.95/util/grub-terminfo.in | 95 - usr/src/grub/grub-0.95/util/mbchk.c | 244 - usr/src/grub/grub-0.95/util/mkbimage | 417 - usr/src/grub/grub-0.97/AUTHORS | 63 + usr/src/grub/grub-0.97/BUGS | 7 + usr/src/grub/grub-0.97/COPYING | 340 + usr/src/grub/grub-0.97/COPYING.descrip | 1 + usr/src/grub/grub-0.97/ChangeLog | 9234 ++++++++++++++++++++ usr/src/grub/grub-0.97/INSTALL | 266 + usr/src/grub/grub-0.97/MAINTENANCE | 60 + usr/src/grub/grub-0.97/Makefile.am | 4 + usr/src/grub/grub-0.97/Makefile.in | 605 ++ usr/src/grub/grub-0.97/Makefile.solaris | 55 + usr/src/grub/grub-0.97/Makefile.solaris.defs | 88 + usr/src/grub/grub-0.97/NEWS | 565 ++ usr/src/grub/grub-0.97/README | 23 + usr/src/grub/grub-0.97/THANKS | 123 + usr/src/grub/grub-0.97/TODO | 102 + usr/src/grub/grub-0.97/acinclude.m4 | 366 + usr/src/grub/grub-0.97/aclocal.m4 | 1061 +++ usr/src/grub/grub-0.97/compile | 142 + usr/src/grub/grub-0.97/config.guess | 1453 +++ usr/src/grub/grub-0.97/config.h | 107 + usr/src/grub/grub-0.97/config.h.in | 106 + usr/src/grub/grub-0.97/config.status.solaris | 1252 +++ usr/src/grub/grub-0.97/config.sub | 1566 ++++ usr/src/grub/grub-0.97/configure | 7553 ++++++++++++++++ usr/src/grub/grub-0.97/configure.ac | 605 ++ usr/src/grub/grub-0.97/depcomp | 522 ++ usr/src/grub/grub-0.97/docs/Makefile.am | 65 + usr/src/grub/grub-0.97/docs/Makefile.in | 769 ++ usr/src/grub/grub-0.97/docs/Makefile.solaris | 68 + usr/src/grub/grub-0.97/docs/boot.S | 80 + usr/src/grub/grub-0.97/docs/boot.S.texi | 80 + usr/src/grub/grub-0.97/docs/grub-install.8 | 52 + usr/src/grub/grub-0.97/docs/grub-md5-crypt.8 | 32 + usr/src/grub/grub-0.97/docs/grub-terminfo.8 | 29 + usr/src/grub/grub-0.97/docs/grub.8 | 71 + usr/src/grub/grub-0.97/docs/grub.info | 4455 ++++++++++ usr/src/grub/grub-0.97/docs/grub.info-1 | 1338 +++ usr/src/grub/grub-0.97/docs/grub.info-2 | 1436 +++ usr/src/grub/grub-0.97/docs/grub.info-3 | 1366 +++ usr/src/grub/grub-0.97/docs/grub.info-4 | 249 + usr/src/grub/grub-0.97/docs/grub.texi | 3987 +++++++++ usr/src/grub/grub-0.97/docs/help2man | 517 ++ usr/src/grub/grub-0.97/docs/internals.texi | 427 + usr/src/grub/grub-0.97/docs/kernel.c | 284 + usr/src/grub/grub-0.97/docs/kernel.c.texi | 284 + usr/src/grub/grub-0.97/docs/mbchk.1 | 27 + usr/src/grub/grub-0.97/docs/mdate-sh | 170 + usr/src/grub/grub-0.97/docs/menu.lst | 82 + usr/src/grub/grub-0.97/docs/multiboot.h | 119 + usr/src/grub/grub-0.97/docs/multiboot.h.texi | 119 + usr/src/grub/grub-0.97/docs/multiboot.info | 1662 ++++ usr/src/grub/grub-0.97/docs/multiboot.texi | 1234 +++ usr/src/grub/grub-0.97/docs/src2texi | 16 + usr/src/grub/grub-0.97/docs/stamp-vti | 4 + usr/src/grub/grub-0.97/docs/texinfo.tex | 7086 +++++++++++++++ usr/src/grub/grub-0.97/docs/version.texi | 4 + usr/src/grub/grub-0.97/grub/Makefile.am | 19 + usr/src/grub/grub-0.97/grub/Makefile.in | 445 + usr/src/grub/grub-0.97/grub/Makefile.solaris | 77 + usr/src/grub/grub-0.97/grub/asmstub.c | 1312 +++ usr/src/grub/grub-0.97/grub/main.c | 265 + usr/src/grub/grub-0.97/grub/mapfile-intf | 43 + usr/src/grub/grub-0.97/install-sh | 323 + usr/src/grub/grub-0.97/lib/Makefile.am | 6 + usr/src/grub/grub-0.97/lib/Makefile.in | 416 + usr/src/grub/grub-0.97/lib/Makefile.solaris | 56 + usr/src/grub/grub-0.97/lib/device.c | 941 ++ usr/src/grub/grub-0.97/lib/device.h | 48 + usr/src/grub/grub-0.97/lib/getopt.c | 1053 +++ usr/src/grub/grub-0.97/lib/getopt.h | 133 + usr/src/grub/grub-0.97/lib/getopt1.c | 190 + usr/src/grub/grub-0.97/missing | 353 + usr/src/grub/grub-0.97/mkinstalldirs | 150 + usr/src/grub/grub-0.97/netboot/3c595.c | 550 ++ usr/src/grub/grub-0.97/netboot/3c595.h | 435 + usr/src/grub/grub-0.97/netboot/3c90x.c | 995 +++ usr/src/grub/grub-0.97/netboot/Makefile.am | 287 + usr/src/grub/grub-0.97/netboot/Makefile.in | 1091 +++ usr/src/grub/grub-0.97/netboot/Makefile.solaris | 168 + usr/src/grub/grub-0.97/netboot/README.netboot | 168 + usr/src/grub/grub-0.97/netboot/basemem.c | 178 + usr/src/grub/grub-0.97/netboot/big_bswap.h | 17 + usr/src/grub/grub-0.97/netboot/bootp.h | 182 + usr/src/grub/grub-0.97/netboot/byteswap.h | 20 + usr/src/grub/grub-0.97/netboot/config.c | 165 + usr/src/grub/grub-0.97/netboot/cpu.h | 243 + usr/src/grub/grub-0.97/netboot/davicom.c | 718 ++ usr/src/grub/grub-0.97/netboot/dev.h | 83 + usr/src/grub/grub-0.97/netboot/e1000.c | 3682 ++++++++ usr/src/grub/grub-0.97/netboot/e1000_hw.h | 2058 +++++ usr/src/grub/grub-0.97/netboot/eepro100.c | 809 ++ usr/src/grub/grub-0.97/netboot/elf.h | 234 + usr/src/grub/grub-0.97/netboot/endian.h | 19 + usr/src/grub/grub-0.97/netboot/epic100.c | 520 ++ usr/src/grub/grub-0.97/netboot/epic100.h | 188 + usr/src/grub/grub-0.97/netboot/etherboot.h | 62 + usr/src/grub/grub-0.97/netboot/forcedeth.c | 1039 +++ usr/src/grub/grub-0.97/netboot/fsys_tftp.c | 877 ++ usr/src/grub/grub-0.97/netboot/grub.h | 171 + usr/src/grub/grub-0.97/netboot/i386_byteswap.h | 46 + usr/src/grub/grub-0.97/netboot/i386_elf.h | 91 + usr/src/grub/grub-0.97/netboot/i386_endian.h | 6 + usr/src/grub/grub-0.97/netboot/i386_timer.c | 192 + usr/src/grub/grub-0.97/netboot/if_arp.h | 29 + usr/src/grub/grub-0.97/netboot/if_ether.h | 21 + usr/src/grub/grub-0.97/netboot/igmp.h | 27 + usr/src/grub/grub-0.97/netboot/in.h | 21 + usr/src/grub/grub-0.97/netboot/io.h | 239 + usr/src/grub/grub-0.97/netboot/ip.h | 36 + usr/src/grub/grub-0.97/netboot/isa.h | 27 + usr/src/grub/grub-0.97/netboot/latch.h | 10 + usr/src/grub/grub-0.97/netboot/little_bswap.h | 17 + usr/src/grub/grub-0.97/netboot/mii.h | 105 + usr/src/grub/grub-0.97/netboot/misc.c | 321 + usr/src/grub/grub-0.97/netboot/natsemi.c | 780 ++ usr/src/grub/grub-0.97/netboot/nfs.h | 63 + usr/src/grub/grub-0.97/netboot/nic.c | 1312 +++ usr/src/grub/grub-0.97/netboot/nic.h | 45 + usr/src/grub/grub-0.97/netboot/ns83820.c | 1020 +++ usr/src/grub/grub-0.97/netboot/ns8390.c | 1016 +++ usr/src/grub/grub-0.97/netboot/ns8390.h | 238 + usr/src/grub/grub-0.97/netboot/osdep.h | 22 + usr/src/grub/grub-0.97/netboot/pci.c | 530 ++ usr/src/grub/grub-0.97/netboot/pci.h | 357 + usr/src/grub/grub-0.97/netboot/pci_ids.h | 1809 ++++ usr/src/grub/grub-0.97/netboot/pci_io.c | 431 + usr/src/grub/grub-0.97/netboot/pcnet32.c | 1004 +++ usr/src/grub/grub-0.97/netboot/pic8259.c | 205 + usr/src/grub/grub-0.97/netboot/pic8259.h | 98 + usr/src/grub/grub-0.97/netboot/pnic.c | 267 + usr/src/grub/grub-0.97/netboot/pnic_api.h | 59 + usr/src/grub/grub-0.97/netboot/pxe.h | 521 ++ usr/src/grub/grub-0.97/netboot/r8169.c | 854 ++ usr/src/grub/grub-0.97/netboot/rtl8139.c | 551 ++ usr/src/grub/grub-0.97/netboot/segoff.h | 43 + usr/src/grub/grub-0.97/netboot/sis900.c | 1251 +++ usr/src/grub/grub-0.97/netboot/sis900.h | 380 + usr/src/grub/grub-0.97/netboot/stdint.h | 18 + usr/src/grub/grub-0.97/netboot/sundance.c | 896 ++ usr/src/grub/grub-0.97/netboot/tftp.h | 82 + usr/src/grub/grub-0.97/netboot/tg3.c | 3322 +++++++ usr/src/grub/grub-0.97/netboot/tg3.h | 2203 +++++ usr/src/grub/grub-0.97/netboot/timer.c | 29 + usr/src/grub/grub-0.97/netboot/timer.h | 68 + usr/src/grub/grub-0.97/netboot/tlan.c | 1814 ++++ usr/src/grub/grub-0.97/netboot/tlan.h | 536 ++ usr/src/grub/grub-0.97/netboot/tulip.c | 2069 +++++ usr/src/grub/grub-0.97/netboot/types.h | 44 + usr/src/grub/grub-0.97/netboot/udp.h | 30 + usr/src/grub/grub-0.97/netboot/undi.c | 1321 +++ usr/src/grub/grub-0.97/netboot/undi.h | 239 + usr/src/grub/grub-0.97/netboot/via-rhine.c | 1318 +++ usr/src/grub/grub-0.97/netboot/w89c840.c | 955 ++ usr/src/grub/grub-0.97/stage1/Makefile.am | 15 + usr/src/grub/grub-0.97/stage1/Makefile.in | 433 + usr/src/grub/grub-0.97/stage1/Makefile.solaris | 74 + usr/src/grub/grub-0.97/stage1/stage1.S | 499 ++ usr/src/grub/grub-0.97/stage1/stage1.h | 86 + usr/src/grub/grub-0.97/stage2/Makefile.am | 303 + usr/src/grub/grub-0.97/stage2/Makefile.in | 3855 ++++++++ usr/src/grub/grub-0.97/stage2/Makefile.solaris | 941 ++ usr/src/grub/grub-0.97/stage2/apic.h | 72 + usr/src/grub/grub-0.97/stage2/apm.S | 125 + usr/src/grub/grub-0.97/stage2/asm.S | 2755 ++++++ usr/src/grub/grub-0.97/stage2/bios.c | 341 + usr/src/grub/grub-0.97/stage2/boot.c | 1030 +++ usr/src/grub/grub-0.97/stage2/builtins.c | 5875 +++++++++++++ usr/src/grub/grub-0.97/stage2/char_io.c | 1416 +++ usr/src/grub/grub-0.97/stage2/cmdline.c | 273 + usr/src/grub/grub-0.97/stage2/common.c | 354 + usr/src/grub/grub-0.97/stage2/console.c | 62 + usr/src/grub/grub-0.97/stage2/controlregs.h | 161 + usr/src/grub/grub-0.97/stage2/cpu.h | 73 + usr/src/grub/grub-0.97/stage2/defs.h | 98 + usr/src/grub/grub-0.97/stage2/dir.h | 147 + usr/src/grub/grub-0.97/stage2/disk_inode.h | 110 + usr/src/grub/grub-0.97/stage2/disk_inode_ffs.h | 101 + usr/src/grub/grub-0.97/stage2/disk_io.c | 1876 ++++ usr/src/grub/grub-0.97/stage2/fat.h | 100 + usr/src/grub/grub-0.97/stage2/filesys.h | 186 + usr/src/grub/grub-0.97/stage2/freebsd.h | 95 + usr/src/grub/grub-0.97/stage2/fs.h | 457 + usr/src/grub/grub-0.97/stage2/fsys_ext2fs.c | 837 ++ usr/src/grub/grub-0.97/stage2/fsys_fat.c | 489 ++ usr/src/grub/grub-0.97/stage2/fsys_ffs.c | 310 + usr/src/grub/grub-0.97/stage2/fsys_iso9660.c | 449 + usr/src/grub/grub-0.97/stage2/fsys_jfs.c | 403 + usr/src/grub/grub-0.97/stage2/fsys_minix.c | 534 ++ usr/src/grub/grub-0.97/stage2/fsys_reiserfs.c | 1239 +++ usr/src/grub/grub-0.97/stage2/fsys_ufs.c | 266 + usr/src/grub/grub-0.97/stage2/fsys_ufs2.c | 331 + usr/src/grub/grub-0.97/stage2/fsys_vstafs.c | 252 + usr/src/grub/grub-0.97/stage2/fsys_xfs.c | 624 ++ usr/src/grub/grub-0.97/stage2/fsys_zfs.c | 1423 +++ usr/src/grub/grub-0.97/stage2/fsys_zfs.h | 194 + usr/src/grub/grub-0.97/stage2/graphics.c | 654 ++ usr/src/grub/grub-0.97/stage2/graphics.h | 42 + usr/src/grub/grub-0.97/stage2/gunzip.c | 1362 +++ usr/src/grub/grub-0.97/stage2/hercules.c | 186 + usr/src/grub/grub-0.97/stage2/hercules.h | 31 + usr/src/grub/grub-0.97/stage2/i386-elf.h | 237 + usr/src/grub/grub-0.97/stage2/imgact_aout.h | 158 + usr/src/grub/grub-0.97/stage2/iso9660.h | 219 + usr/src/grub/grub-0.97/stage2/jfs.h | 601 ++ usr/src/grub/grub-0.97/stage2/logo.xbm | 191 + usr/src/grub/grub-0.97/stage2/mb_header.h | 90 + usr/src/grub/grub-0.97/stage2/mb_info.h | 217 + usr/src/grub/grub-0.97/stage2/md5.c | 383 + usr/src/grub/grub-0.97/stage2/md5.h | 30 + usr/src/grub/grub-0.97/stage2/nbi.h | 33 + usr/src/grub/grub-0.97/stage2/nbloader.S | 121 + usr/src/grub/grub-0.97/stage2/pc_slice.h | 283 + usr/src/grub/grub-0.97/stage2/pxeloader.S | 54 + usr/src/grub/grub-0.97/stage2/serial.c | 434 + usr/src/grub/grub-0.97/stage2/serial.h | 93 + usr/src/grub/grub-0.97/stage2/setjmp.S | 81 + usr/src/grub/grub-0.97/stage2/shared.h | 1068 +++ usr/src/grub/grub-0.97/stage2/size_test | 54 + usr/src/grub/grub-0.97/stage2/smp-imps.c | 756 ++ usr/src/grub/grub-0.97/stage2/smp-imps.h | 208 + usr/src/grub/grub-0.97/stage2/stage1_5.c | 69 + usr/src/grub/grub-0.97/stage2/stage2.c | 1104 +++ usr/src/grub/grub-0.97/stage2/start.S | 409 + usr/src/grub/grub-0.97/stage2/start_eltorito.S | 326 + usr/src/grub/grub-0.97/stage2/term.h | 153 + usr/src/grub/grub-0.97/stage2/terminfo.c | 258 + usr/src/grub/grub-0.97/stage2/terminfo.h | 51 + usr/src/grub/grub-0.97/stage2/tparm.c | 727 ++ usr/src/grub/grub-0.97/stage2/tparm.h | 28 + usr/src/grub/grub-0.97/stage2/ufs.h | 231 + usr/src/grub/grub-0.97/stage2/ufs2.h | 439 + usr/src/grub/grub-0.97/stage2/vstafs.h | 88 + usr/src/grub/grub-0.97/stage2/xfs.h | 544 ++ usr/src/grub/grub-0.97/stage2/zfs-include/dmu.h | 107 + .../grub/grub-0.97/stage2/zfs-include/dmu_objset.h | 37 + usr/src/grub/grub-0.97/stage2/zfs-include/dnode.h | 78 + .../grub-0.97/stage2/zfs-include/dsl_dataset.h | 55 + .../grub/grub-0.97/stage2/zfs-include/dsl_dir.h | 51 + usr/src/grub/grub-0.97/stage2/zfs-include/spa.h | 285 + .../grub-0.97/stage2/zfs-include/uberblock_impl.h | 51 + .../grub/grub-0.97/stage2/zfs-include/vdev_impl.h | 72 + .../grub/grub-0.97/stage2/zfs-include/zap_impl.h | 112 + .../grub/grub-0.97/stage2/zfs-include/zap_leaf.h | 102 + usr/src/grub/grub-0.97/stage2/zfs-include/zfs.h | 101 + .../grub/grub-0.97/stage2/zfs-include/zfs_acl.h | 62 + .../grub/grub-0.97/stage2/zfs-include/zfs_znode.h | 70 + usr/src/grub/grub-0.97/stage2/zfs-include/zil.h | 53 + usr/src/grub/grub-0.97/stage2/zfs-include/zio.h | 83 + .../grub-0.97/stage2/zfs-include/zio_checksum.h | 44 + usr/src/grub/grub-0.97/stage2/zfs_fletcher.c | 95 + usr/src/grub/grub-0.97/stage2/zfs_lzjb.c | 61 + usr/src/grub/grub-0.97/stage2/zfs_sha256.c | 126 + usr/src/grub/grub-0.97/stamp-h.in | 1 + usr/src/grub/grub-0.97/util/Makefile.am | 12 + usr/src/grub/grub-0.97/util/Makefile.in | 478 + usr/src/grub/grub-0.97/util/Makefile.solaris | 81 + usr/src/grub/grub-0.97/util/grub-image.in | 138 + usr/src/grub/grub-0.97/util/grub-install.in | 477 + usr/src/grub/grub-0.97/util/grub-md5-crypt.in | 99 + usr/src/grub/grub-0.97/util/grub-set-default.in | 114 + usr/src/grub/grub-0.97/util/grub-terminfo.in | 95 + usr/src/grub/grub-0.97/util/mbchk.c | 244 + usr/src/grub/grub-0.97/util/mkbimage | 417 + usr/src/grub/splash.xpm.gz | Bin 8772 -> 3128 bytes 528 files changed, 147238 insertions(+), 142457 deletions(-) delete mode 100644 usr/src/grub/grub-0.95/AUTHORS delete mode 100644 usr/src/grub/grub-0.95/BUGS delete mode 100644 usr/src/grub/grub-0.95/COPYING delete mode 100644 usr/src/grub/grub-0.95/COPYING.descrip delete mode 100644 usr/src/grub/grub-0.95/ChangeLog delete mode 100644 usr/src/grub/grub-0.95/INSTALL delete mode 100644 usr/src/grub/grub-0.95/MAINTENANCE delete mode 100644 usr/src/grub/grub-0.95/Makefile.am delete mode 100644 usr/src/grub/grub-0.95/Makefile.in delete mode 100644 usr/src/grub/grub-0.95/Makefile.solaris delete mode 100644 usr/src/grub/grub-0.95/Makefile.solaris.defs delete mode 100644 usr/src/grub/grub-0.95/NEWS delete mode 100644 usr/src/grub/grub-0.95/README delete mode 100644 usr/src/grub/grub-0.95/THANKS delete mode 100644 usr/src/grub/grub-0.95/TODO delete mode 100644 usr/src/grub/grub-0.95/acinclude.m4 delete mode 100644 usr/src/grub/grub-0.95/aclocal.m4 delete mode 100755 usr/src/grub/grub-0.95/compile delete mode 100755 usr/src/grub/grub-0.95/config.guess delete mode 100644 usr/src/grub/grub-0.95/config.h delete mode 100644 usr/src/grub/grub-0.95/config.h.in delete mode 100755 usr/src/grub/grub-0.95/config.status.solaris delete mode 100755 usr/src/grub/grub-0.95/config.sub delete mode 100755 usr/src/grub/grub-0.95/configure delete mode 100644 usr/src/grub/grub-0.95/configure.ac delete mode 100755 usr/src/grub/grub-0.95/depcomp delete mode 100644 usr/src/grub/grub-0.95/docs/Makefile.am delete mode 100644 usr/src/grub/grub-0.95/docs/Makefile.in delete mode 100644 usr/src/grub/grub-0.95/docs/Makefile.solaris delete mode 100644 usr/src/grub/grub-0.95/docs/boot.S delete mode 100644 usr/src/grub/grub-0.95/docs/boot.S.texi delete mode 100644 usr/src/grub/grub-0.95/docs/grub-install.8 delete mode 100644 usr/src/grub/grub-0.95/docs/grub-md5-crypt.8 delete mode 100644 usr/src/grub/grub-0.95/docs/grub-terminfo.8 delete mode 100644 usr/src/grub/grub-0.95/docs/grub.8 delete mode 100644 usr/src/grub/grub-0.95/docs/grub.info delete mode 100644 usr/src/grub/grub-0.95/docs/grub.info-1 delete mode 100644 usr/src/grub/grub-0.95/docs/grub.info-2 delete mode 100644 usr/src/grub/grub-0.95/docs/grub.info-3 delete mode 100644 usr/src/grub/grub-0.95/docs/grub.info-4 delete mode 100644 usr/src/grub/grub-0.95/docs/grub.texi delete mode 100644 usr/src/grub/grub-0.95/docs/help2man delete mode 100644 usr/src/grub/grub-0.95/docs/internals.texi delete mode 100644 usr/src/grub/grub-0.95/docs/kernel.c delete mode 100644 usr/src/grub/grub-0.95/docs/kernel.c.texi delete mode 100644 usr/src/grub/grub-0.95/docs/mbchk.1 delete mode 100644 usr/src/grub/grub-0.95/docs/mdate-sh delete mode 100644 usr/src/grub/grub-0.95/docs/menu.lst delete mode 100644 usr/src/grub/grub-0.95/docs/multiboot.h delete mode 100644 usr/src/grub/grub-0.95/docs/multiboot.h.texi delete mode 100644 usr/src/grub/grub-0.95/docs/multiboot.info delete mode 100644 usr/src/grub/grub-0.95/docs/multiboot.texi delete mode 100644 usr/src/grub/grub-0.95/docs/src2texi delete mode 100644 usr/src/grub/grub-0.95/docs/stamp-vti delete mode 100644 usr/src/grub/grub-0.95/docs/texinfo.tex delete mode 100644 usr/src/grub/grub-0.95/docs/version.texi delete mode 100644 usr/src/grub/grub-0.95/grub/Makefile.am delete mode 100644 usr/src/grub/grub-0.95/grub/Makefile.in delete mode 100644 usr/src/grub/grub-0.95/grub/Makefile.solaris delete mode 100644 usr/src/grub/grub-0.95/grub/asmstub.c delete mode 100644 usr/src/grub/grub-0.95/grub/main.c delete mode 100644 usr/src/grub/grub-0.95/grub/mapfile-intf delete mode 100755 usr/src/grub/grub-0.95/install-sh delete mode 100644 usr/src/grub/grub-0.95/lib/Makefile.am delete mode 100644 usr/src/grub/grub-0.95/lib/Makefile.in delete mode 100644 usr/src/grub/grub-0.95/lib/Makefile.solaris delete mode 100644 usr/src/grub/grub-0.95/lib/device.c delete mode 100644 usr/src/grub/grub-0.95/lib/device.h delete mode 100644 usr/src/grub/grub-0.95/lib/getopt.c delete mode 100644 usr/src/grub/grub-0.95/lib/getopt.h delete mode 100644 usr/src/grub/grub-0.95/lib/getopt1.c delete mode 100755 usr/src/grub/grub-0.95/missing delete mode 100755 usr/src/grub/grub-0.95/mkinstalldirs delete mode 100644 usr/src/grub/grub-0.95/netboot/3c595.c delete mode 100644 usr/src/grub/grub-0.95/netboot/3c595.h delete mode 100644 usr/src/grub/grub-0.95/netboot/3c90x.c delete mode 100644 usr/src/grub/grub-0.95/netboot/Makefile.am delete mode 100644 usr/src/grub/grub-0.95/netboot/Makefile.in delete mode 100644 usr/src/grub/grub-0.95/netboot/Makefile.solaris delete mode 100644 usr/src/grub/grub-0.95/netboot/README.netboot delete mode 100644 usr/src/grub/grub-0.95/netboot/basemem.c delete mode 100644 usr/src/grub/grub-0.95/netboot/big_bswap.h delete mode 100644 usr/src/grub/grub-0.95/netboot/bootp.h delete mode 100644 usr/src/grub/grub-0.95/netboot/byteswap.h delete mode 100644 usr/src/grub/grub-0.95/netboot/config.c delete mode 100644 usr/src/grub/grub-0.95/netboot/cpu.h delete mode 100644 usr/src/grub/grub-0.95/netboot/davicom.c delete mode 100644 usr/src/grub/grub-0.95/netboot/dev.h delete mode 100644 usr/src/grub/grub-0.95/netboot/e1000.c delete mode 100644 usr/src/grub/grub-0.95/netboot/e1000_hw.h delete mode 100644 usr/src/grub/grub-0.95/netboot/eepro100.c delete mode 100644 usr/src/grub/grub-0.95/netboot/elf.h delete mode 100644 usr/src/grub/grub-0.95/netboot/endian.h delete mode 100644 usr/src/grub/grub-0.95/netboot/epic100.c delete mode 100644 usr/src/grub/grub-0.95/netboot/epic100.h delete mode 100644 usr/src/grub/grub-0.95/netboot/etherboot.h delete mode 100644 usr/src/grub/grub-0.95/netboot/forcedeth.c delete mode 100644 usr/src/grub/grub-0.95/netboot/fsys_tftp.c delete mode 100644 usr/src/grub/grub-0.95/netboot/grub.h delete mode 100644 usr/src/grub/grub-0.95/netboot/i386_byteswap.h delete mode 100644 usr/src/grub/grub-0.95/netboot/i386_elf.h delete mode 100644 usr/src/grub/grub-0.95/netboot/i386_endian.h delete mode 100644 usr/src/grub/grub-0.95/netboot/i386_timer.c delete mode 100644 usr/src/grub/grub-0.95/netboot/if_arp.h delete mode 100644 usr/src/grub/grub-0.95/netboot/if_ether.h delete mode 100644 usr/src/grub/grub-0.95/netboot/igmp.h delete mode 100644 usr/src/grub/grub-0.95/netboot/in.h delete mode 100644 usr/src/grub/grub-0.95/netboot/io.h delete mode 100644 usr/src/grub/grub-0.95/netboot/ip.h delete mode 100644 usr/src/grub/grub-0.95/netboot/isa.h delete mode 100644 usr/src/grub/grub-0.95/netboot/latch.h delete mode 100644 usr/src/grub/grub-0.95/netboot/little_bswap.h delete mode 100644 usr/src/grub/grub-0.95/netboot/mii.h delete mode 100644 usr/src/grub/grub-0.95/netboot/misc.c delete mode 100644 usr/src/grub/grub-0.95/netboot/natsemi.c delete mode 100644 usr/src/grub/grub-0.95/netboot/nfs.h delete mode 100644 usr/src/grub/grub-0.95/netboot/nic.c delete mode 100644 usr/src/grub/grub-0.95/netboot/nic.h delete mode 100644 usr/src/grub/grub-0.95/netboot/ns83820.c delete mode 100644 usr/src/grub/grub-0.95/netboot/ns8390.c delete mode 100644 usr/src/grub/grub-0.95/netboot/ns8390.h delete mode 100644 usr/src/grub/grub-0.95/netboot/osdep.h delete mode 100644 usr/src/grub/grub-0.95/netboot/pci.c delete mode 100644 usr/src/grub/grub-0.95/netboot/pci.h delete mode 100644 usr/src/grub/grub-0.95/netboot/pci_ids.h delete mode 100644 usr/src/grub/grub-0.95/netboot/pci_io.c delete mode 100644 usr/src/grub/grub-0.95/netboot/pcnet32.c delete mode 100644 usr/src/grub/grub-0.95/netboot/pic8259.c delete mode 100644 usr/src/grub/grub-0.95/netboot/pic8259.h delete mode 100644 usr/src/grub/grub-0.95/netboot/pnic.c delete mode 100644 usr/src/grub/grub-0.95/netboot/pnic_api.h delete mode 100644 usr/src/grub/grub-0.95/netboot/pxe.h delete mode 100644 usr/src/grub/grub-0.95/netboot/r8169.c delete mode 100644 usr/src/grub/grub-0.95/netboot/rtl8139.c delete mode 100644 usr/src/grub/grub-0.95/netboot/segoff.h delete mode 100644 usr/src/grub/grub-0.95/netboot/sis900.c delete mode 100644 usr/src/grub/grub-0.95/netboot/sis900.h delete mode 100644 usr/src/grub/grub-0.95/netboot/stdint.h delete mode 100644 usr/src/grub/grub-0.95/netboot/sundance.c delete mode 100644 usr/src/grub/grub-0.95/netboot/tftp.h delete mode 100644 usr/src/grub/grub-0.95/netboot/tg3.c delete mode 100644 usr/src/grub/grub-0.95/netboot/tg3.h delete mode 100644 usr/src/grub/grub-0.95/netboot/timer.c delete mode 100644 usr/src/grub/grub-0.95/netboot/timer.h delete mode 100644 usr/src/grub/grub-0.95/netboot/tlan.c delete mode 100644 usr/src/grub/grub-0.95/netboot/tlan.h delete mode 100644 usr/src/grub/grub-0.95/netboot/tulip.c delete mode 100644 usr/src/grub/grub-0.95/netboot/types.h delete mode 100644 usr/src/grub/grub-0.95/netboot/udp.h delete mode 100644 usr/src/grub/grub-0.95/netboot/undi.c delete mode 100644 usr/src/grub/grub-0.95/netboot/undi.h delete mode 100644 usr/src/grub/grub-0.95/netboot/via-rhine.c delete mode 100644 usr/src/grub/grub-0.95/netboot/w89c840.c delete mode 100644 usr/src/grub/grub-0.95/stage1/Makefile.am delete mode 100644 usr/src/grub/grub-0.95/stage1/Makefile.in delete mode 100644 usr/src/grub/grub-0.95/stage1/Makefile.solaris delete mode 100644 usr/src/grub/grub-0.95/stage1/stage1.S delete mode 100644 usr/src/grub/grub-0.95/stage1/stage1.h delete mode 100644 usr/src/grub/grub-0.95/stage2/Makefile.am delete mode 100644 usr/src/grub/grub-0.95/stage2/Makefile.in delete mode 100644 usr/src/grub/grub-0.95/stage2/Makefile.solaris delete mode 100644 usr/src/grub/grub-0.95/stage2/apic.h delete mode 100644 usr/src/grub/grub-0.95/stage2/apm.S delete mode 100644 usr/src/grub/grub-0.95/stage2/asm.S delete mode 100644 usr/src/grub/grub-0.95/stage2/bios.c delete mode 100644 usr/src/grub/grub-0.95/stage2/boot.c delete mode 100644 usr/src/grub/grub-0.95/stage2/builtins.c delete mode 100644 usr/src/grub/grub-0.95/stage2/char_io.c delete mode 100644 usr/src/grub/grub-0.95/stage2/cmdline.c delete mode 100644 usr/src/grub/grub-0.95/stage2/common.c delete mode 100644 usr/src/grub/grub-0.95/stage2/console.c delete mode 100644 usr/src/grub/grub-0.95/stage2/controlregs.h delete mode 100644 usr/src/grub/grub-0.95/stage2/cpu.h delete mode 100644 usr/src/grub/grub-0.95/stage2/defs.h delete mode 100644 usr/src/grub/grub-0.95/stage2/dir.h delete mode 100644 usr/src/grub/grub-0.95/stage2/disk_inode.h delete mode 100644 usr/src/grub/grub-0.95/stage2/disk_inode_ffs.h delete mode 100644 usr/src/grub/grub-0.95/stage2/disk_io.c delete mode 100644 usr/src/grub/grub-0.95/stage2/fat.h delete mode 100644 usr/src/grub/grub-0.95/stage2/filesys.h delete mode 100644 usr/src/grub/grub-0.95/stage2/freebsd.h delete mode 100644 usr/src/grub/grub-0.95/stage2/fs.h delete mode 100644 usr/src/grub/grub-0.95/stage2/fsys_ext2fs.c delete mode 100644 usr/src/grub/grub-0.95/stage2/fsys_fat.c delete mode 100644 usr/src/grub/grub-0.95/stage2/fsys_ffs.c delete mode 100644 usr/src/grub/grub-0.95/stage2/fsys_iso9660.c delete mode 100644 usr/src/grub/grub-0.95/stage2/fsys_jfs.c delete mode 100644 usr/src/grub/grub-0.95/stage2/fsys_minix.c delete mode 100644 usr/src/grub/grub-0.95/stage2/fsys_reiserfs.c delete mode 100644 usr/src/grub/grub-0.95/stage2/fsys_ufs.c delete mode 100644 usr/src/grub/grub-0.95/stage2/fsys_ufs2.c delete mode 100644 usr/src/grub/grub-0.95/stage2/fsys_vstafs.c delete mode 100644 usr/src/grub/grub-0.95/stage2/fsys_xfs.c delete mode 100644 usr/src/grub/grub-0.95/stage2/fsys_zfs.c delete mode 100644 usr/src/grub/grub-0.95/stage2/fsys_zfs.h delete mode 100644 usr/src/grub/grub-0.95/stage2/graphics.c delete mode 100644 usr/src/grub/grub-0.95/stage2/graphics.h delete mode 100644 usr/src/grub/grub-0.95/stage2/gunzip.c delete mode 100644 usr/src/grub/grub-0.95/stage2/hercules.c delete mode 100644 usr/src/grub/grub-0.95/stage2/hercules.h delete mode 100644 usr/src/grub/grub-0.95/stage2/i386-elf.h delete mode 100644 usr/src/grub/grub-0.95/stage2/imgact_aout.h delete mode 100644 usr/src/grub/grub-0.95/stage2/iso9660.h delete mode 100644 usr/src/grub/grub-0.95/stage2/jfs.h delete mode 100644 usr/src/grub/grub-0.95/stage2/mb_header.h delete mode 100644 usr/src/grub/grub-0.95/stage2/mb_info.h delete mode 100644 usr/src/grub/grub-0.95/stage2/md5.c delete mode 100644 usr/src/grub/grub-0.95/stage2/md5.h delete mode 100644 usr/src/grub/grub-0.95/stage2/nbi.h delete mode 100644 usr/src/grub/grub-0.95/stage2/nbloader.S delete mode 100644 usr/src/grub/grub-0.95/stage2/pc_slice.h delete mode 100644 usr/src/grub/grub-0.95/stage2/pxeloader.S delete mode 100644 usr/src/grub/grub-0.95/stage2/serial.c delete mode 100644 usr/src/grub/grub-0.95/stage2/serial.h delete mode 100644 usr/src/grub/grub-0.95/stage2/setjmp.S delete mode 100644 usr/src/grub/grub-0.95/stage2/shared.h delete mode 100644 usr/src/grub/grub-0.95/stage2/size_test delete mode 100644 usr/src/grub/grub-0.95/stage2/smp-imps.c delete mode 100644 usr/src/grub/grub-0.95/stage2/smp-imps.h delete mode 100644 usr/src/grub/grub-0.95/stage2/stage1_5.c delete mode 100644 usr/src/grub/grub-0.95/stage2/stage2.c delete mode 100644 usr/src/grub/grub-0.95/stage2/start.S delete mode 100644 usr/src/grub/grub-0.95/stage2/start_eltorito.S delete mode 100644 usr/src/grub/grub-0.95/stage2/term.h delete mode 100644 usr/src/grub/grub-0.95/stage2/terminfo.c delete mode 100644 usr/src/grub/grub-0.95/stage2/terminfo.h delete mode 100644 usr/src/grub/grub-0.95/stage2/tparm.c delete mode 100644 usr/src/grub/grub-0.95/stage2/tparm.h delete mode 100644 usr/src/grub/grub-0.95/stage2/ufs.h delete mode 100644 usr/src/grub/grub-0.95/stage2/ufs2.h delete mode 100644 usr/src/grub/grub-0.95/stage2/vstafs.h delete mode 100644 usr/src/grub/grub-0.95/stage2/xfs.h delete mode 100644 usr/src/grub/grub-0.95/stage2/zfs-include/dmu.h delete mode 100644 usr/src/grub/grub-0.95/stage2/zfs-include/dmu_objset.h delete mode 100644 usr/src/grub/grub-0.95/stage2/zfs-include/dnode.h delete mode 100644 usr/src/grub/grub-0.95/stage2/zfs-include/dsl_dataset.h delete mode 100644 usr/src/grub/grub-0.95/stage2/zfs-include/dsl_dir.h delete mode 100644 usr/src/grub/grub-0.95/stage2/zfs-include/spa.h delete mode 100644 usr/src/grub/grub-0.95/stage2/zfs-include/uberblock_impl.h delete mode 100644 usr/src/grub/grub-0.95/stage2/zfs-include/vdev_impl.h delete mode 100644 usr/src/grub/grub-0.95/stage2/zfs-include/zap_impl.h delete mode 100644 usr/src/grub/grub-0.95/stage2/zfs-include/zap_leaf.h delete mode 100644 usr/src/grub/grub-0.95/stage2/zfs-include/zfs.h delete mode 100644 usr/src/grub/grub-0.95/stage2/zfs-include/zfs_acl.h delete mode 100644 usr/src/grub/grub-0.95/stage2/zfs-include/zfs_znode.h delete mode 100644 usr/src/grub/grub-0.95/stage2/zfs-include/zil.h delete mode 100644 usr/src/grub/grub-0.95/stage2/zfs-include/zio.h delete mode 100644 usr/src/grub/grub-0.95/stage2/zfs-include/zio_checksum.h delete mode 100644 usr/src/grub/grub-0.95/stage2/zfs_fletcher.c delete mode 100644 usr/src/grub/grub-0.95/stage2/zfs_lzjb.c delete mode 100644 usr/src/grub/grub-0.95/stage2/zfs_sha256.c delete mode 100644 usr/src/grub/grub-0.95/stamp-h.in delete mode 100644 usr/src/grub/grub-0.95/util/Makefile.am delete mode 100644 usr/src/grub/grub-0.95/util/Makefile.in delete mode 100644 usr/src/grub/grub-0.95/util/Makefile.solaris delete mode 100644 usr/src/grub/grub-0.95/util/grub-image.in delete mode 100644 usr/src/grub/grub-0.95/util/grub-install.in delete mode 100644 usr/src/grub/grub-0.95/util/grub-md5-crypt.in delete mode 100644 usr/src/grub/grub-0.95/util/grub-set-default.in delete mode 100644 usr/src/grub/grub-0.95/util/grub-terminfo.in delete mode 100644 usr/src/grub/grub-0.95/util/mbchk.c delete mode 100644 usr/src/grub/grub-0.95/util/mkbimage create mode 100644 usr/src/grub/grub-0.97/AUTHORS create mode 100644 usr/src/grub/grub-0.97/BUGS create mode 100644 usr/src/grub/grub-0.97/COPYING create mode 100644 usr/src/grub/grub-0.97/COPYING.descrip create mode 100644 usr/src/grub/grub-0.97/ChangeLog create mode 100644 usr/src/grub/grub-0.97/INSTALL create mode 100644 usr/src/grub/grub-0.97/MAINTENANCE create mode 100644 usr/src/grub/grub-0.97/Makefile.am create mode 100644 usr/src/grub/grub-0.97/Makefile.in create mode 100644 usr/src/grub/grub-0.97/Makefile.solaris create mode 100644 usr/src/grub/grub-0.97/Makefile.solaris.defs create mode 100644 usr/src/grub/grub-0.97/NEWS create mode 100644 usr/src/grub/grub-0.97/README create mode 100644 usr/src/grub/grub-0.97/THANKS create mode 100644 usr/src/grub/grub-0.97/TODO create mode 100644 usr/src/grub/grub-0.97/acinclude.m4 create mode 100644 usr/src/grub/grub-0.97/aclocal.m4 create mode 100755 usr/src/grub/grub-0.97/compile create mode 100755 usr/src/grub/grub-0.97/config.guess create mode 100644 usr/src/grub/grub-0.97/config.h create mode 100644 usr/src/grub/grub-0.97/config.h.in create mode 100755 usr/src/grub/grub-0.97/config.status.solaris create mode 100755 usr/src/grub/grub-0.97/config.sub create mode 100755 usr/src/grub/grub-0.97/configure create mode 100644 usr/src/grub/grub-0.97/configure.ac create mode 100755 usr/src/grub/grub-0.97/depcomp create mode 100644 usr/src/grub/grub-0.97/docs/Makefile.am create mode 100644 usr/src/grub/grub-0.97/docs/Makefile.in create mode 100644 usr/src/grub/grub-0.97/docs/Makefile.solaris create mode 100644 usr/src/grub/grub-0.97/docs/boot.S create mode 100644 usr/src/grub/grub-0.97/docs/boot.S.texi create mode 100644 usr/src/grub/grub-0.97/docs/grub-install.8 create mode 100644 usr/src/grub/grub-0.97/docs/grub-md5-crypt.8 create mode 100644 usr/src/grub/grub-0.97/docs/grub-terminfo.8 create mode 100644 usr/src/grub/grub-0.97/docs/grub.8 create mode 100644 usr/src/grub/grub-0.97/docs/grub.info create mode 100644 usr/src/grub/grub-0.97/docs/grub.info-1 create mode 100644 usr/src/grub/grub-0.97/docs/grub.info-2 create mode 100644 usr/src/grub/grub-0.97/docs/grub.info-3 create mode 100644 usr/src/grub/grub-0.97/docs/grub.info-4 create mode 100644 usr/src/grub/grub-0.97/docs/grub.texi create mode 100644 usr/src/grub/grub-0.97/docs/help2man create mode 100644 usr/src/grub/grub-0.97/docs/internals.texi create mode 100644 usr/src/grub/grub-0.97/docs/kernel.c create mode 100644 usr/src/grub/grub-0.97/docs/kernel.c.texi create mode 100644 usr/src/grub/grub-0.97/docs/mbchk.1 create mode 100644 usr/src/grub/grub-0.97/docs/mdate-sh create mode 100644 usr/src/grub/grub-0.97/docs/menu.lst create mode 100644 usr/src/grub/grub-0.97/docs/multiboot.h create mode 100644 usr/src/grub/grub-0.97/docs/multiboot.h.texi create mode 100644 usr/src/grub/grub-0.97/docs/multiboot.info create mode 100644 usr/src/grub/grub-0.97/docs/multiboot.texi create mode 100644 usr/src/grub/grub-0.97/docs/src2texi create mode 100644 usr/src/grub/grub-0.97/docs/stamp-vti create mode 100644 usr/src/grub/grub-0.97/docs/texinfo.tex create mode 100644 usr/src/grub/grub-0.97/docs/version.texi create mode 100644 usr/src/grub/grub-0.97/grub/Makefile.am create mode 100644 usr/src/grub/grub-0.97/grub/Makefile.in create mode 100644 usr/src/grub/grub-0.97/grub/Makefile.solaris create mode 100644 usr/src/grub/grub-0.97/grub/asmstub.c create mode 100644 usr/src/grub/grub-0.97/grub/main.c create mode 100644 usr/src/grub/grub-0.97/grub/mapfile-intf create mode 100755 usr/src/grub/grub-0.97/install-sh create mode 100644 usr/src/grub/grub-0.97/lib/Makefile.am create mode 100644 usr/src/grub/grub-0.97/lib/Makefile.in create mode 100644 usr/src/grub/grub-0.97/lib/Makefile.solaris create mode 100644 usr/src/grub/grub-0.97/lib/device.c create mode 100644 usr/src/grub/grub-0.97/lib/device.h create mode 100644 usr/src/grub/grub-0.97/lib/getopt.c create mode 100644 usr/src/grub/grub-0.97/lib/getopt.h create mode 100644 usr/src/grub/grub-0.97/lib/getopt1.c create mode 100755 usr/src/grub/grub-0.97/missing create mode 100755 usr/src/grub/grub-0.97/mkinstalldirs create mode 100644 usr/src/grub/grub-0.97/netboot/3c595.c create mode 100644 usr/src/grub/grub-0.97/netboot/3c595.h create mode 100644 usr/src/grub/grub-0.97/netboot/3c90x.c create mode 100644 usr/src/grub/grub-0.97/netboot/Makefile.am create mode 100644 usr/src/grub/grub-0.97/netboot/Makefile.in create mode 100644 usr/src/grub/grub-0.97/netboot/Makefile.solaris create mode 100644 usr/src/grub/grub-0.97/netboot/README.netboot create mode 100644 usr/src/grub/grub-0.97/netboot/basemem.c create mode 100644 usr/src/grub/grub-0.97/netboot/big_bswap.h create mode 100644 usr/src/grub/grub-0.97/netboot/bootp.h create mode 100644 usr/src/grub/grub-0.97/netboot/byteswap.h create mode 100644 usr/src/grub/grub-0.97/netboot/config.c create mode 100644 usr/src/grub/grub-0.97/netboot/cpu.h create mode 100644 usr/src/grub/grub-0.97/netboot/davicom.c create mode 100644 usr/src/grub/grub-0.97/netboot/dev.h create mode 100644 usr/src/grub/grub-0.97/netboot/e1000.c create mode 100644 usr/src/grub/grub-0.97/netboot/e1000_hw.h create mode 100644 usr/src/grub/grub-0.97/netboot/eepro100.c create mode 100644 usr/src/grub/grub-0.97/netboot/elf.h create mode 100644 usr/src/grub/grub-0.97/netboot/endian.h create mode 100644 usr/src/grub/grub-0.97/netboot/epic100.c create mode 100644 usr/src/grub/grub-0.97/netboot/epic100.h create mode 100644 usr/src/grub/grub-0.97/netboot/etherboot.h create mode 100644 usr/src/grub/grub-0.97/netboot/forcedeth.c create mode 100644 usr/src/grub/grub-0.97/netboot/fsys_tftp.c create mode 100644 usr/src/grub/grub-0.97/netboot/grub.h create mode 100644 usr/src/grub/grub-0.97/netboot/i386_byteswap.h create mode 100644 usr/src/grub/grub-0.97/netboot/i386_elf.h create mode 100644 usr/src/grub/grub-0.97/netboot/i386_endian.h create mode 100644 usr/src/grub/grub-0.97/netboot/i386_timer.c create mode 100644 usr/src/grub/grub-0.97/netboot/if_arp.h create mode 100644 usr/src/grub/grub-0.97/netboot/if_ether.h create mode 100644 usr/src/grub/grub-0.97/netboot/igmp.h create mode 100644 usr/src/grub/grub-0.97/netboot/in.h create mode 100644 usr/src/grub/grub-0.97/netboot/io.h create mode 100644 usr/src/grub/grub-0.97/netboot/ip.h create mode 100644 usr/src/grub/grub-0.97/netboot/isa.h create mode 100644 usr/src/grub/grub-0.97/netboot/latch.h create mode 100644 usr/src/grub/grub-0.97/netboot/little_bswap.h create mode 100644 usr/src/grub/grub-0.97/netboot/mii.h create mode 100644 usr/src/grub/grub-0.97/netboot/misc.c create mode 100644 usr/src/grub/grub-0.97/netboot/natsemi.c create mode 100644 usr/src/grub/grub-0.97/netboot/nfs.h create mode 100644 usr/src/grub/grub-0.97/netboot/nic.c create mode 100644 usr/src/grub/grub-0.97/netboot/nic.h create mode 100644 usr/src/grub/grub-0.97/netboot/ns83820.c create mode 100644 usr/src/grub/grub-0.97/netboot/ns8390.c create mode 100644 usr/src/grub/grub-0.97/netboot/ns8390.h create mode 100644 usr/src/grub/grub-0.97/netboot/osdep.h create mode 100644 usr/src/grub/grub-0.97/netboot/pci.c create mode 100644 usr/src/grub/grub-0.97/netboot/pci.h create mode 100644 usr/src/grub/grub-0.97/netboot/pci_ids.h create mode 100644 usr/src/grub/grub-0.97/netboot/pci_io.c create mode 100644 usr/src/grub/grub-0.97/netboot/pcnet32.c create mode 100644 usr/src/grub/grub-0.97/netboot/pic8259.c create mode 100644 usr/src/grub/grub-0.97/netboot/pic8259.h create mode 100644 usr/src/grub/grub-0.97/netboot/pnic.c create mode 100644 usr/src/grub/grub-0.97/netboot/pnic_api.h create mode 100644 usr/src/grub/grub-0.97/netboot/pxe.h create mode 100644 usr/src/grub/grub-0.97/netboot/r8169.c create mode 100644 usr/src/grub/grub-0.97/netboot/rtl8139.c create mode 100644 usr/src/grub/grub-0.97/netboot/segoff.h create mode 100644 usr/src/grub/grub-0.97/netboot/sis900.c create mode 100644 usr/src/grub/grub-0.97/netboot/sis900.h create mode 100644 usr/src/grub/grub-0.97/netboot/stdint.h create mode 100644 usr/src/grub/grub-0.97/netboot/sundance.c create mode 100644 usr/src/grub/grub-0.97/netboot/tftp.h create mode 100644 usr/src/grub/grub-0.97/netboot/tg3.c create mode 100644 usr/src/grub/grub-0.97/netboot/tg3.h create mode 100644 usr/src/grub/grub-0.97/netboot/timer.c create mode 100644 usr/src/grub/grub-0.97/netboot/timer.h create mode 100644 usr/src/grub/grub-0.97/netboot/tlan.c create mode 100644 usr/src/grub/grub-0.97/netboot/tlan.h create mode 100644 usr/src/grub/grub-0.97/netboot/tulip.c create mode 100644 usr/src/grub/grub-0.97/netboot/types.h create mode 100644 usr/src/grub/grub-0.97/netboot/udp.h create mode 100644 usr/src/grub/grub-0.97/netboot/undi.c create mode 100644 usr/src/grub/grub-0.97/netboot/undi.h create mode 100644 usr/src/grub/grub-0.97/netboot/via-rhine.c create mode 100644 usr/src/grub/grub-0.97/netboot/w89c840.c create mode 100644 usr/src/grub/grub-0.97/stage1/Makefile.am create mode 100644 usr/src/grub/grub-0.97/stage1/Makefile.in create mode 100644 usr/src/grub/grub-0.97/stage1/Makefile.solaris create mode 100644 usr/src/grub/grub-0.97/stage1/stage1.S create mode 100644 usr/src/grub/grub-0.97/stage1/stage1.h create mode 100644 usr/src/grub/grub-0.97/stage2/Makefile.am create mode 100644 usr/src/grub/grub-0.97/stage2/Makefile.in create mode 100644 usr/src/grub/grub-0.97/stage2/Makefile.solaris create mode 100644 usr/src/grub/grub-0.97/stage2/apic.h create mode 100644 usr/src/grub/grub-0.97/stage2/apm.S create mode 100644 usr/src/grub/grub-0.97/stage2/asm.S create mode 100644 usr/src/grub/grub-0.97/stage2/bios.c create mode 100644 usr/src/grub/grub-0.97/stage2/boot.c create mode 100644 usr/src/grub/grub-0.97/stage2/builtins.c create mode 100644 usr/src/grub/grub-0.97/stage2/char_io.c create mode 100644 usr/src/grub/grub-0.97/stage2/cmdline.c create mode 100644 usr/src/grub/grub-0.97/stage2/common.c create mode 100644 usr/src/grub/grub-0.97/stage2/console.c create mode 100644 usr/src/grub/grub-0.97/stage2/controlregs.h create mode 100644 usr/src/grub/grub-0.97/stage2/cpu.h create mode 100644 usr/src/grub/grub-0.97/stage2/defs.h create mode 100644 usr/src/grub/grub-0.97/stage2/dir.h create mode 100644 usr/src/grub/grub-0.97/stage2/disk_inode.h create mode 100644 usr/src/grub/grub-0.97/stage2/disk_inode_ffs.h create mode 100644 usr/src/grub/grub-0.97/stage2/disk_io.c create mode 100644 usr/src/grub/grub-0.97/stage2/fat.h create mode 100644 usr/src/grub/grub-0.97/stage2/filesys.h create mode 100644 usr/src/grub/grub-0.97/stage2/freebsd.h create mode 100644 usr/src/grub/grub-0.97/stage2/fs.h create mode 100644 usr/src/grub/grub-0.97/stage2/fsys_ext2fs.c create mode 100644 usr/src/grub/grub-0.97/stage2/fsys_fat.c create mode 100644 usr/src/grub/grub-0.97/stage2/fsys_ffs.c create mode 100644 usr/src/grub/grub-0.97/stage2/fsys_iso9660.c create mode 100644 usr/src/grub/grub-0.97/stage2/fsys_jfs.c create mode 100644 usr/src/grub/grub-0.97/stage2/fsys_minix.c create mode 100644 usr/src/grub/grub-0.97/stage2/fsys_reiserfs.c create mode 100644 usr/src/grub/grub-0.97/stage2/fsys_ufs.c create mode 100644 usr/src/grub/grub-0.97/stage2/fsys_ufs2.c create mode 100644 usr/src/grub/grub-0.97/stage2/fsys_vstafs.c create mode 100644 usr/src/grub/grub-0.97/stage2/fsys_xfs.c create mode 100644 usr/src/grub/grub-0.97/stage2/fsys_zfs.c create mode 100644 usr/src/grub/grub-0.97/stage2/fsys_zfs.h create mode 100644 usr/src/grub/grub-0.97/stage2/graphics.c create mode 100644 usr/src/grub/grub-0.97/stage2/graphics.h create mode 100644 usr/src/grub/grub-0.97/stage2/gunzip.c create mode 100644 usr/src/grub/grub-0.97/stage2/hercules.c create mode 100644 usr/src/grub/grub-0.97/stage2/hercules.h create mode 100644 usr/src/grub/grub-0.97/stage2/i386-elf.h create mode 100644 usr/src/grub/grub-0.97/stage2/imgact_aout.h create mode 100644 usr/src/grub/grub-0.97/stage2/iso9660.h create mode 100644 usr/src/grub/grub-0.97/stage2/jfs.h create mode 100644 usr/src/grub/grub-0.97/stage2/logo.xbm create mode 100644 usr/src/grub/grub-0.97/stage2/mb_header.h create mode 100644 usr/src/grub/grub-0.97/stage2/mb_info.h create mode 100644 usr/src/grub/grub-0.97/stage2/md5.c create mode 100644 usr/src/grub/grub-0.97/stage2/md5.h create mode 100644 usr/src/grub/grub-0.97/stage2/nbi.h create mode 100644 usr/src/grub/grub-0.97/stage2/nbloader.S create mode 100644 usr/src/grub/grub-0.97/stage2/pc_slice.h create mode 100644 usr/src/grub/grub-0.97/stage2/pxeloader.S create mode 100644 usr/src/grub/grub-0.97/stage2/serial.c create mode 100644 usr/src/grub/grub-0.97/stage2/serial.h create mode 100644 usr/src/grub/grub-0.97/stage2/setjmp.S create mode 100644 usr/src/grub/grub-0.97/stage2/shared.h create mode 100644 usr/src/grub/grub-0.97/stage2/size_test create mode 100644 usr/src/grub/grub-0.97/stage2/smp-imps.c create mode 100644 usr/src/grub/grub-0.97/stage2/smp-imps.h create mode 100644 usr/src/grub/grub-0.97/stage2/stage1_5.c create mode 100644 usr/src/grub/grub-0.97/stage2/stage2.c create mode 100644 usr/src/grub/grub-0.97/stage2/start.S create mode 100644 usr/src/grub/grub-0.97/stage2/start_eltorito.S create mode 100644 usr/src/grub/grub-0.97/stage2/term.h create mode 100644 usr/src/grub/grub-0.97/stage2/terminfo.c create mode 100644 usr/src/grub/grub-0.97/stage2/terminfo.h create mode 100644 usr/src/grub/grub-0.97/stage2/tparm.c create mode 100644 usr/src/grub/grub-0.97/stage2/tparm.h create mode 100644 usr/src/grub/grub-0.97/stage2/ufs.h create mode 100644 usr/src/grub/grub-0.97/stage2/ufs2.h create mode 100644 usr/src/grub/grub-0.97/stage2/vstafs.h create mode 100644 usr/src/grub/grub-0.97/stage2/xfs.h create mode 100644 usr/src/grub/grub-0.97/stage2/zfs-include/dmu.h create mode 100644 usr/src/grub/grub-0.97/stage2/zfs-include/dmu_objset.h create mode 100644 usr/src/grub/grub-0.97/stage2/zfs-include/dnode.h create mode 100644 usr/src/grub/grub-0.97/stage2/zfs-include/dsl_dataset.h create mode 100644 usr/src/grub/grub-0.97/stage2/zfs-include/dsl_dir.h create mode 100644 usr/src/grub/grub-0.97/stage2/zfs-include/spa.h create mode 100644 usr/src/grub/grub-0.97/stage2/zfs-include/uberblock_impl.h create mode 100644 usr/src/grub/grub-0.97/stage2/zfs-include/vdev_impl.h create mode 100644 usr/src/grub/grub-0.97/stage2/zfs-include/zap_impl.h create mode 100644 usr/src/grub/grub-0.97/stage2/zfs-include/zap_leaf.h create mode 100644 usr/src/grub/grub-0.97/stage2/zfs-include/zfs.h create mode 100644 usr/src/grub/grub-0.97/stage2/zfs-include/zfs_acl.h create mode 100644 usr/src/grub/grub-0.97/stage2/zfs-include/zfs_znode.h create mode 100644 usr/src/grub/grub-0.97/stage2/zfs-include/zil.h create mode 100644 usr/src/grub/grub-0.97/stage2/zfs-include/zio.h create mode 100644 usr/src/grub/grub-0.97/stage2/zfs-include/zio_checksum.h create mode 100644 usr/src/grub/grub-0.97/stage2/zfs_fletcher.c create mode 100644 usr/src/grub/grub-0.97/stage2/zfs_lzjb.c create mode 100644 usr/src/grub/grub-0.97/stage2/zfs_sha256.c create mode 100644 usr/src/grub/grub-0.97/stamp-h.in create mode 100644 usr/src/grub/grub-0.97/util/Makefile.am create mode 100644 usr/src/grub/grub-0.97/util/Makefile.in create mode 100644 usr/src/grub/grub-0.97/util/Makefile.solaris create mode 100644 usr/src/grub/grub-0.97/util/grub-image.in create mode 100644 usr/src/grub/grub-0.97/util/grub-install.in create mode 100644 usr/src/grub/grub-0.97/util/grub-md5-crypt.in create mode 100644 usr/src/grub/grub-0.97/util/grub-set-default.in create mode 100644 usr/src/grub/grub-0.97/util/grub-terminfo.in create mode 100644 usr/src/grub/grub-0.97/util/mbchk.c create mode 100644 usr/src/grub/grub-0.97/util/mkbimage diff --git a/usr/src/grub/Makefile b/usr/src/grub/Makefile index bb2d1c7c7c..28c2eca2ff 100644 --- a/usr/src/grub/Makefile +++ b/usr/src/grub/Makefile @@ -14,7 +14,7 @@ install := TARGET = install clean := TARGET = clean clobber := TARGET = clobber -GRUB = grub-0.95 +GRUB = grub-0.97 SUBDIRS = $(GRUB) diff --git a/usr/src/grub/README.grub b/usr/src/grub/README.grub index f674f2bded..67df140dd6 100644 --- a/usr/src/grub/README.grub +++ b/usr/src/grub/README.grub @@ -1,7 +1,7 @@ #ident "%Z%%M% %I% %E% SMI" The current version of GRUB is based on - grub-0.95 from ftp://alpha.gnu.org/gnu/grub/ + grub-0.97 from ftp://alpha.gnu.org/gnu/grub/ Graphics patch from Red Hat: http://ruslug.rutgers.edu/~mcgrof/grub-images/patches/historic/redhat/ diff --git a/usr/src/grub/grub-0.95/AUTHORS b/usr/src/grub/grub-0.95/AUTHORS deleted file mode 100644 index e319d15ef6..0000000000 --- a/usr/src/grub/grub-0.95/AUTHORS +++ /dev/null @@ -1,63 +0,0 @@ - -ZFS support added by Sun Microsystems. -Copyright 2007 Sun Microsystems, Inc. All rights reserved. -Use is subject to license terms. - -VaX#n8 (real name unknown) wrote shared_src/fsys_ext2fs.c. - -Heiko Schroeder rewrote shared_src/stage1.S to be more readable. - -Solaris VTOC and UFS support added by Sun Microsystems. -Copyright 2005 Sun Microsystems, Inc. All rights reserved. -Use is subject to license terms. - -The following authors assigned copyright on their work to the Free -Software Foundation: - -Erich Stefan Boleyn originally designed and implemented GRUB. - -Gordon Matzigkeit adopted GRUB into the GNU Project. He fixed several -bugs, added symbolic link support to shared_src/fsys_ext2fs.c, and -began the implementation of /sbin/grub. He was an official maintainer. - -Yoshinori K. Okuji contributed many bugfixes and new features, such as -working LBA support, /sbin/grub support for configuration files, the -script /sbin/grub-install, the utility /bin/mbchk, the new engine for -builtin commands, disk swapping support, keyboard configuration support, -network support, online help support, command-line history support, -hidden menu support, the new Linux loader, serial terminal support, -single-line editing support, the utility /sbin/grub-md5-crypt, the new -GRUB manual, and several new commands. He is the current official -maintainer. - -Peter Astrand added support for a color menu. - -Pavel Roskin contributed many bugfixes and new features, such as FreeBSD -support for the grub shell, and configure process cleanups. - -Klaus Reichl wrote stage2/fsys_minix.c. - -Per Lundberg added graphics support to the Multiboot Specification. - -Jochen Hoenicke rewrote stage2/fsys_fat.c and wrote -stage2/fsys_reiserfs.c and stage2/md5.c. - -Christoph Plattner added support for Net Boot Image Proposal. - -Frank Mehnert added support for hercules console. - -Kristoffer Branemyr added VSTa filesystem support. - -Serguei Tzukanov added JFS and XFS support. - -Jason Thomas added Linux DAC960 support and support for hiding/unhiding -logical partitions, and did a significant bugfix for the terminal stuff. - -Tilmann Bubeck added support for vt100-incompatible terminals. - -KB Sriram added a better detection of FAT filesystem and fixed a -network device completion. - -Eric Kvaalen fixed a lot of problems in the GRUB manual. - -Leonid Lisovskiy added El Torito support. diff --git a/usr/src/grub/grub-0.95/BUGS b/usr/src/grub/grub-0.95/BUGS deleted file mode 100644 index 14c1f72eae..0000000000 --- a/usr/src/grub/grub-0.95/BUGS +++ /dev/null @@ -1,7 +0,0 @@ -See the Bug Tracking System for GNU GRUB on Savannah. The URL is: - -http://savannah.gnu.org/bugs/?group_id=68 (without SSL) - -or - -https://savannah.gnu.org/bugs/?group_id=68 (with SSL) diff --git a/usr/src/grub/grub-0.95/COPYING b/usr/src/grub/grub-0.95/COPYING deleted file mode 100644 index eeb586b392..0000000000 --- a/usr/src/grub/grub-0.95/COPYING +++ /dev/null @@ -1,340 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program 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. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public 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. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) 19yy - - 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 - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) 19yy name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/usr/src/grub/grub-0.95/COPYING.descrip b/usr/src/grub/grub-0.95/COPYING.descrip deleted file mode 100644 index f54810961d..0000000000 --- a/usr/src/grub/grub-0.95/COPYING.descrip +++ /dev/null @@ -1 +0,0 @@ -GRUB SOFTWARE diff --git a/usr/src/grub/grub-0.95/ChangeLog b/usr/src/grub/grub-0.95/ChangeLog deleted file mode 100644 index 882d871bb2..0000000000 --- a/usr/src/grub/grub-0.95/ChangeLog +++ /dev/null @@ -1,8978 +0,0 @@ -2004-10-11 Jason Thomas - Patch from Stefanus Du Toit - * docs/kernel.c.texi (cmain): Incremement mod by one, instead of - sizeof(module_t), since it's already a pointer of type module_t. - * docs/kernel.c (cmain): Do the same. - -2004-09-20 Yoshinori K. Okuji - - * docs/internals.texi (Internals): Changed to an appendix. - - * docs/grub.texi (@setchapternewpage): Changed to odd from off. - (@contents): Moved to the beginning. - (Future): Changed to an appendix. - -2004-08-17 Yoshinori K. Okuji - - * stage2/cmdline.c (run_script): Fix a reversed conditional. - Reported by Alban Crequy . - -2004-08-07 Jason Thomas - - From Michael Hohnbaum : - * stage2/fsys_ext2fs.c (ext2fs_read): Handle sparse files. - -2004-07-24 Yoshinori K. Okuji - - * stage2/stage2.c (cmain): Terminate DEFAULT_FILE with NUL - correctly. Reported by Alban Crequy . - -2004-07-21 Robert Millan - - Patch from David Weinehall - * util/mkbimage: Fix XSI-isms (for supporting POSIX-only shells). - -2004-07-20 Robert Millan - - * util/grub-install.in: Detect GNU/k*BSD systems as well. - -2004-07-16 Yoshinori K. Okuji - - * util/grub-install.in (convert): Fix the sed statement for - Linux. The expression was ambigious in some cases. - -2004-06-29 Robert Millan - - * util/grub-set-default.in: Fix minor syntax error (non-escaped - characters). - -2004-06-24 Robert Millan - - Fixes for FHS compliance. (/usr/share is for arch-independant data) - * stage1/Makefile.am: Move stage files to pkglibdir. - * stage2/Makefile.am: Likewise. - * docs/grub.texi: s,/usr/share,/usr/lib,g. - * util/grub-image.in: Look for stage files in pkglibdir. - * util/grub-install.in: Likewise. - - * util/grub-install.in: Improve usage message. - -2004-06-20 Yoshinori K. Okuji - - This is a big change on saving a default entry. This change - makes it possible to set up a quite robust system using GRUB. - Now we do not use the second sector of Stage 2 to store an - entry number but use the file /boot/grub/default. This file - must be generated by grub-set-default, although this file is - plain-text. - - * util/grub-set-default.in: New file. - - * util/grub-install.in (grub_set_default): New variable. - Use /grub instead of /boot/grub on OpenBSD as well as NetBSD. - Run grub-set-default to make a default file. - - * util/Makefile.am (sbin_SCRIPTS): Added grub-set-default. - - * stage2/stage2.c (run_menu): Change the fallback handling to - support multiple fallback entries. - (cmain): Likewise. Also, get a saved entry from a default file - if possible, before reading a config file. - - * stage2/shared.h (DEFAULT_FILE_BUF): New macro. - (DEFAULT_FILE_BUFLEN): Likewise. - (CMDLINE_BUF): Set to DEFAULT_FILE_BUF + DEFAULT_FILE_BUFLEN. - (MENU_BUFLEN): Set to 0x8000 + PASSWORD_BUF - MENU_BUF. - (fallback_entry): Removed. - (fallback_entries): Declared. - (fallback_entryno): Likewise. - (MAX_FALLBACK_ENTRIES): New macro. - - * stage2/cmdline.c (run_script): Use FALLBACK_ENTRYNO instead of - FALLBACK_ENTRY. - - * stage2/builtins.c (fallback_entry): Removed. - (fallback_entryno): New variable. - (fallback_entries): Likewise. - (init_config): Initialize FALLBACK_ENTRYNO and FALLBACK_ENTRIES. - (fallback_func): Rewritten completely. - (savedefault_func): Likewise. - - * docs/grub.texi (grub-set-default): New direntry. - (Installation): Describe grub-set-default for manual - installations. - (Making your system robust): New section. - (Booting once-only): New subsection. - (Booting fallback systems): Likewise. - (fallback): Describe multiple fallback entries. - (savedefault): Describe an optional argument. - (Invoking grub-set-default): New chapter. - (Future): Replaced with a description about GRUB 2. - - * configure.ac (AC_CONFIG_FILES): Added util/grub-set-default. - -2004-06-19 Yoshinori K. Okuji - - * stage2/ufs2.h (int8_t): Renamed to ... - (grub_uint8_t): ... this. - (int16_t): Renamed to ... - (grub_int16_t): ... this. - (int32_t): Renamed to ... - (grub_int32_t): ... this. - (int64_t): Renamed to ... - (grub_int64_t): ... this. - (uint8_t): Renamed to ... - (grub_uint8_t): ... this. - (uint16_t): Renamed to ... - (grub_uint16_t): ... this. - (uint32_t): Renamed to ... - (grub_uint32_t): ... this. - (uint64_t): Renamed to ... - (grub_uint64_t): ... this. - (u_char): Renamed to ... - (grub_u_char): ... this. - (u_int): Renamed to ... - (grub_u_int): ... this. - (u_int8_t): Renamed to ... - (grub_u_int8_t): ... this. - (u_int16_t): Renamed to ... - (grub_u_int16_t): ... this. - (u_int32_t): Renamed to ... - (grub_u_int32_t): ... this. - (u_int64_t): Renamed to ... - (grub_u_int64_t): ... this. - (ino_t): Renamed to ... - (grub_ino_t): ... this. - All callers are changed. - -2004-06-14 Jeroen Dekkers - - * stage2/ufs2.h (__uint8_t): Remove. - (__uint16_t): Likewise. - (__uint32_t): Likewise. - (__uint64_t): Likewise. - (ino_t): Typedef to uint32_t. - -2004-06-13 Yoshinori K. Okuji - - * stage2/Makefile.am (noinst_HEADERS): Added ufs2.h. - -2004-06-13 Yoshinori K. Okuji - - * configure.ac (AC_INIT): Upgraded to 0.95. - -2004-05-23 Yoshinori K. Okuji - - * stage2/char_io.c (grub_isspace): Use a switch sentense instead - of an if sentense, because that reduces the size. - - * lib/device.c (read_device_map): Change the max number of DRIVE - to 127 from 8. This was too strict. - - * stage2/asm.S (stop_floppy): Call pusha and popa outside the - block of real mode code. Reported by Guillem Jover - . - -2004-05-20 Damian Ivereigh - - * netboot/main.c: Fixed bootp only code so that options - work properly. This fix is obvious when compared with the - DHCP code. - -2004-05-17 Pavel Roskin - - * stage2/char_io.c (safe_parse_maxint): Disable for stage 1.5. - (grub_tolower): Disable for stage 1.5 except fat_stage1_5. - (grub_memcmp): Disable for stage 1.5 except iso9660_stage1_5. - -2004-05-14 Yoshinori K. Okuji - - From Sergey Matveychuk : - * stage2/size_test: Added a check for ufs2_stage1_5. - - * stage2/shared.h (STAGE2_ID_UFS2_STAGE1_5): New macro. - [FSYS_UFS2] (STAGE2_ID): Set to STAGE2_ID_UFS2_STAGE1_5. - - * stage2/filesys.h (FSYS_UFS2_NUM): New macro. - [FSYS_UFS2] (ufs2_mount): New prototype. - [FSYS_UFS2] (ufs2_read): Likewise. - [FSYS_UFS2] (ufs2_dir): Likewise. - [FSYS_UFS2] (ufs2_embed): Likewise. - (NUM_FSYS): Added FSYS_UFS2_NUM. - - * stage2/disk_io.c (fsys_table): Added an ufs2 entry. - - * stage2/builtins.c (setup_func): Added ufs2 into the - STAGE1_5_MAP. - - * stage2/Makefile.am (libgrub_a_SOURCES): Added fsys_ufs2.c. - (libgrub_a_CFLAGS): Added -DFSYS_UFS2=1. - (pkgdata_DATA): Added ufs2_stage1_5. - (noinst_PROGRAMS): Added ufs2_stage1_5.exec. - (ufs2_stage1_5_exec_SOURCES): New variable. - (ufs2_stage1_5_exec_CFLAGS): Likewise. - (ufs2_stage1_5_exec_CCASFLAGS): Likewise. - (ufs2_stage1_5_exec_LDFLAGS): Likewise. - - * grub/Makefile.am (AM_CPPFLAGS): Added -DFSYS_ISO9660=1, - -DFSYS_JFS=1, -DFSYS_REISERFS=1, -DFSYS_UFS2=1, -DFSYS_VSTAFS=1, - -DFSYS_XFS=1, and -DUSE_MD5_PASSWORDS=1. - - * configure.ac (--disable-ufs2): New option. - - * stage2/fsys_ufs2.c: New file. - * stage2/ufs2.h: Likewise. - -2004-05-10 Robert Millan - - * lib/device.c: Mangle __FreeBSD_* macro usage to support - kFreeBSD-based non-FreeBSD systems (i.e. GNU/kFreeBSD). - - Implement runtime detection of version of kFreeBSD. Now if - we build against kFreeBSD 5.x headers the GRUB shell will work on - both 4.x and 5.x. - - Replace `u_int_t' types with portable `unsigned int' and old - reference to `geometry' structure to new `geom' one. - - * docs/menu.lst: Split GNU/kFreeBSD and GNU/kNetBSD as separate - options than FreeBSD and NetBSD, respectively. There are minor - differences now (different paths). - -2004-05-03 Pavel Roskin - - * stage2/char_io.c (convert_to_ascii): Remove "%b" support. - It's non-standard and is not used anymore. - (grub_printf): Likewise. - -2004-04-29 Robert Millan - - From Yann Dirson : - * util/mkbimage: Misc syntax fixes. - -2004-04-29 Jeroen Dekkers - - * stage2/char_io.c (grub_memcmp): Define for stage1.5 too. - - * stage2/fsys_iso9660.c (iso9660_mount): Use memcmp() instead of - __builtin_memcmp(). - (iso9660_dir): Likewise. - -2004-04-26 Christian Jones - - * docs/grub.texi (Making a GRUB bootable CD-ROM): minor edits, - including a few compatibility notes and a change to - -boot-load-size 4 for the mkisofs command. - -2004-04-22 Jeroen Dekkers - - * Makefile.am (AUTOMAKE_OPTIONS): Add "gnu". - * configure.ac: Update to work with automake 1.8, quote all - AC_DEFUN's correctly and provide descriptions for AC_DEFINE's. - * acinclude.m4: Likewise. - * acconfig.h: Removed. - - * stage1/Makefile.am (.exec): Use suffix rules instead of pattern - rules. - * stage2/Makefile.am (.exec): Likewise. - -2004-04-18 Yoshinori K. Okuji - - * docs/grub.texi (Making a GRUB bootable CD-ROM): New section. - - * stage2/disk_io.c (set_device): Use CH instead of *DEVICE to - test the first character of DEVICE, because DEVICE is - incremented. - Reported by Bernhard Treutwein. - -2004-04-15 Yoshinori K. Okuji - - * netboot/fsys_tftp.c (buf_fill): Cast 1 to unsigned short - explicitly so that the constant doesn't extend unsigned short - to int automatically. - Reported by Eduard Guzovsky . - - * docs/grub.texi (Invoking grub-md5-crypt): Fixed the chapter - name. - Reported by Martin Pool . - -2004-04-04 Yoshinori K. Okuji - - * configure.ac (STAGE2_CFLAGS): Check if -fno-stack-protector is - supported by GCC. If yes, added the option. This is necessary - for OpenBSD, because the stack protector defines additional - symbols. Reported by uc.sheda . - -2004-03-28 Pavel Roskin - - * stage2/boot.c: Imply --no-mem-option for Linux kernels with - protocol version 2.03 and above (Linux 2.4.18 and newer). - -2004-03-27 Yoshinori K. Okuji - - * stage2/char_io.c [!GRUB_UTIL] (memcpy): New function. It is - defined as an alias of grub_memmove. This is copied from GRUB 2. - - * stage2/disk_io.c (print_completions): Simplified conditionals - to make it easier to edit the file with Emacs. - Added support for (cd). - (set_device): Likewise. - - * stage2/common.c (init_bios_info): Check if BOOT_DRIVE is a - CDROM drive. If it is true, set CDROM_DRIVE to BOOT_DRIVE. - (cdrom_drive): New variable. - - From Leonid Lisovskiy : - * stage2/start_eltorito.S: New file. - - * stage2/stage2.c (run_menu): Use GRUB_INVALID_DRIVE instead of - 0xFF. - - * stage2/shared.h (STAGE2_ID_ISO9660_STAGE1_5): New macro. - [FSYS_ISO9660] (STAGE2_ID): Set to STAGE2_ID_ISO9660_STAGE1_5. - (struct geometry): Added a new member ``sector_size''. - (BIOSDISK_FLAG_CDROM): New macro. - (cdrom_drive): Declared. - - * stage2/fsys_iso9660.c: New file. - * stage2/iso9660.h: Likewise. - - * stage2/filesys.h (FSYS_ISO9660_NUM): New macro. - [FSYS_ISO9660] (iso9660_mount): Declared. - [FSYS_ISO9660] (iso9660_read): Likewise. - [FSYS_ISO9660] (iso9660_dir): Likewise. - (NUM_FSYS): Added FSYS_ISO9660_NUM. - - * stage2/disk_io.c (fsys_table) [FSYS_ISO9660]: Added iso9660. - (current_drive): Use GRUB_INVALID_DRIVE. - (log2): New function. - (rawread): Use BUF_GEOM.SECTOR_SIZE instead of SECTOR_SIZE. - Change the type of BUFADDR from int to char *. - Use a virtual track to make sure that one track fits in the - buffer. - (sane_partition): Allow CURRENT_DRIVE to be CDROM_DRIVE, because - a bios drive for a CD-ROM is often assigned to greater than - 0x88. - (set_device): Use GRUB_INVALID_DRIVE instead of 0xFF. - (setup_part): Likewise. - - * stage2/cmdline.c (init_cmdline): Use GRUB_INVALID_DRIVE. - - * stage2/builtins.c (install_func): Use GRUB_INVALID_DRIVE. - (setup_func): Added iso9660_stage1_5. - - * stage2/bios.c (biosdisk): Don't fall back to the CHS mode - if the drive is a CDROM. - (get_cdinfo): New function. - (get_diskinfo): Call get_cdinfo if the drive is greater than or - equal to 0x88 or the drive supports LBA. - Set the sector size to SECTOR_SIZE if it is not a CD-ROM. - - * stage2/asm.S (biosdisk_int13_extensions): Take a word - argument AX instead of a byte argument AH. - (get_diskinfo_int13_extensions): Removed. - - * stage2/Makefile.am (noinst_HEADERS): Added iso9660.h. - (libgrub_a_SOURCES): Added fsys_iso9660.c. - (libgrub_a_CFLAGS): Added -DFSYS_ISO9660=1. - (pkgdata_DATA): Added iso9660_stage1_5 and stage2_eltorito. - (noinst_PROGRAMS): Added iso9660_stage1_5.exec and - start_eltorito.exec. - (noinst_DATA): Added start_eltorito. - (pre_stage2_exec_SOURCES): Added fsys_iso9660.c. - (START_ELTORITO_LINK): New variable. - (start_eltorito_exec_SOURCES): Likewise. - (start_eltorito_exec_CCASFLAGS): Likewise. - (start_eltorito_exec_LDFLAGS): Likewise. - (start_eltorito_exec-start.$(OBJEXT)): New dependency. - (stage2_eltorito): New target. - (iso9660_stage1_5_exec_SOURCES): New variable. - (iso9660_stage1_5_exec_CFLAGS): Likewise. - (iso9660_stage1_5_exec_CCASFLAGS): Likewise. - (iso9660_stage1_5_exec_LDFLAGS): Likewise. - - * stage1/stage1.h (GRUB_INVALID_DRIVE): New macro. - - * stage1/stage1.S (boot_drive): Use the macro GRUB_INVALID_DRIVE. - (real_start): Likewise. - - * lib/device.c (get_drive_geometry): Set GEOM->SECTOR_SIZE to - SECTOR_SIZE by default. - - * configure.ac (--disable-iso9660): New option. - -2004-03-13 Yoshinori K. Okuji - - From Daniele Zelante : - * stage2/asm.S (stop_floppy): Use INT 13, AH=00h to stop the - floppy controller instead of a direct I/O. - -2004-03-12 Yoshinori K. Okuji - - * stage2/serial.c (serial_putchar): Handle the character code - 127 as a backspace. Reported by Florian Engelhardt - . - -2004-03-12 Yoshinori K. Okuji - - From Boji Tony Kannanthanam : - * util/grub-install.in (convert): Add support for ATARAID - device names. - * lib/device.c (get_ataraid_disk_name) [__linux__]: New - function. - (init_device_map) [__linux__]: Probe ATARAID disks. - - * stage2/size_test (check): Don't use the local statement any - longer. It was unneeded actually. Reported by Paul Jarc. - -2004-03-12 Yoshinori K. Okuji - - From Sergey Matveychuk : - * lib/device.c (get_drive_geometry): Do not open the same device - more than once unnecessarily. - (get_drive_geometry) [__FreeBSD_version >= 500040]: Use new - ioctl methods. - (get_floppy_disk_name) [__FreeBSD__ >= 4]: Use /dev/fd%d rather - than /dev/rfd%d. - (get_ide_disk_name) [__FreeBSD__ >= 4]: Use /dev/ad%d rather - than /dev/rad%d. - (get_scsi_disk_name) [__FreeBSD__ >= 4]: Use /dev/da%d rather - than /dev/rda%d. - * grub/asmstub.c (get_diskinfo): Check if ERRNO is EPERM as - well. - -2004-02-28 Jeroen Dekkers - - * docs/grub.texi (partnew): Change @var{to} to @var{len}. - -2004-02-18 Yoshinori K. Okuji - - From Yury V. Umanets : - * stage2/fsys_reiserfs.c (REISER3FS_SUPER_MAGIC_STRING): New - macro. - (reiserfs_mount): Added checks for ReiserFS 3. - (reiserfs_embed): Likewise. - -2004-01-25 Yoshinori K. Okuji - - * docs/grub.texi (Obtaining and Building GRUB): Instead of - describing how to use the anoncvs method, specify the URL of - the description page on Savannah. - Reported by Bernhard Treutwein. - -2004-01-18 Yoshinori K. Okuji - - From Thomas Schwinge : - * grub/Makefile.am (AM_CPPFLAGS): New variable. - (AM_CFLAGS): Removed all cpp flags. - - * stage2/xfs.h (__int8_t): Renamed to ... - (xfs_int8_t): ... this. - (__uint8_t): Renamed to ... - (xfs_uint8_t): ... this. - (__int16_t): Renamed to ... - (xfs_int16_t): ... this. - (__uint16_t): Renamed to ... - (xfs_uint16_t): ... this. - (__int32_t): Renamed to ... - (xfs_int32_t): ... this. - (__uint32_t): Renamed to ... - (xfs_uint32_t): ... this. - (__int64_t): Renamed to ... - (xfs_int64_t): ... this. - (__uint64_t): Renamed to ... - (xfs_uint64_t): ... this. - All callers are changed.x - - From Egmont Koblinger : - * util/grub-install.in: Support an install devices in GRUB's - notation without parentheses. - - * docs/grub.texi (Installing GRUB using grub-install): Added an - example of using grub-install without parentheses. - -2004-01-18 Yoshinori K. Okuji - - * util/grub-install.in: Use the first word of GRUB_SHELL when - checking if the grub shell is present. This is necessary to - support options to the grub shell (e.g. grub --read-only). - - From Eric Kvaalen : - * docs/grub.texi: Many bug fixes. - -2004-01-17 Yoshinori K. Okuji - - * lib/device.c [__linux__] (MAJOR): Support 32 bit and 64 bit - dev_t. This code is stolen from glibc. - Suggested by Shen Feng . - -2004-01-11 Yoshinori K. Okuji - - * stage2/terminfo.c (ti_set_term): Use a pointer to struct - terminfo instead to avoid GCC's bug, which inserts a reference - to memcpy implicitly. - (ti_get_term): Likewise. - All callers are fixed. - - * stage2/terminfo.h (ti_set_term): Updated. - (ti_get_term): Likewise. - - * stage2/shared.h (struct linux_kernel_header): New member, - initrd_max_address. Defined in the boot protocol 2.03 or higher. - - * stage2/boot.c (load_initrd): If the boot protocol is greater - than or equal to 2.03, use the field ``initrd_max_address'' - instead of LINUX_INITRD_MAX_ADDRESS. - -2003-12-30 Yoshinori K. Okuji - - * stage2/fsys_ext2fs.c (ext2_is_fast_symlink): New function. - (ext2fs_dir): Use ext2_is_fast_symlink to check if the current - inode is a fast or slow symlink. This change was required - because Linux now uses acl seriously (i.e. incompatibility). - Reported by Chris PeBenito and Seemant - Kulleen - -2003-11-30 Yoshinori K. Okuji - - * lib/device.c (read_device_map) (sho_warning): New internal - function. - (read_device_map): If DRIVE is greater than 8, emit a warning - and ignore the drive, rather than exiting abnormally. - Reported by Greg Newby . - -2003-10-19 Yoshinori K. Okuji - - Migrated to newer autotools. Also, don't install mkbimage - because its name is too general and it does not conform to the - GNU Coding Standards in some points. - - * util/Makefile.am (EXTRA_DIST): New variable. - (sbin_SCRIPTS): Removed mkbimage. - (noinst_SCRIPTS): Added mkbimage. - - * stage1/Makefile.am (AM_ASFLAGS): Renamed to ... - (AM_CCASFLAGS): ... this. - - * stage2/Makefile.am (pre_stage2_exec_ASFLAGS): Renamed to ... - (pre_stage2_exec_CCASFLAGS): ... this. - (start_exec_ASFLAGS): Renamed to ... - (start_exec_CCASFLAGS): ... this. - (e2fs_stage1_5_exec_ASFLAGS): Renamed to ... - (e2fs_stage1_5_exec_CCASFLAGS): ... this. - (fat_stage1_5_exec_ASFLAGS): Renamed to ... - (fat_stage1_5_exec_CCASFLAGS): ... this. - (ffs_stage1_5_exec_ASFLAGS): Renamed to ... - (ffs_stage1_5_exec_CCASFLAGS): ... this. - (minix_stage1_5_exec_ASFLAGS): Renamed to ... - (minix_stage1_5_exec_CCASFLAGS): ... this. - (reiserfs_stage1_5_exec_ASFLAGS): Renamed to ... - (reiserfs_stage1_5_exec_CCASFLAGS): ... this. - (vstafs_stage1_5_exec_ASFLAGS): Renamed to ... - (vstafs_stage1_5_exec_CCASFLAGS): ... this. - (jfs_stage1_5_exec_ASFLAGS): Renamed to ... - (jfs_stage1_5_exec_CCASFLAGS): ... this. - (xfs_stage1_5_exec_ASFLAGS): Renamed to ... - (xfs_stage1_5_exec_CCASFLAGS): ... this. - (diskless_exec_ASFLAGS): Renamed to ... - (diskless_exec_CCASFLAGS): ... this. - (nbloader_exec_ASFLAGS): Renamed to ... - (nbloader_exec_CCASFLAGS): ... this. - (pxeloader_exec_ASFLAGS): Renamed to ... - (pxeloader_exec_CCASFLAGS): ... this. - - * configure.in: Removed. - * configure.ac: New file. Mostly derived from configure.in. - -2003-10-19 Yoshinori OKUJI - - From KB Sriram : - * stage2/disk_io.c (set_device) [SUPPORT_NETBOOT]: Added support - for a completion of a network device. - (print_completions): Likewise. - -2003-10-10 Robert Millan - - * config.guess: Update from official source (CVS). - * config.sub: Likewise. - -2003-09-18 Robert Millan - - * docs/texinfo.tex: Update from ftp.gnu.org. - -2003-09-05 KB Sriram - - * stage2/fsys_fat.c: Fix missdetection of ext2fs as fatfs. - -2003-09-05 Robert Millan - - * docs/menu.lst (GNU/Linux): Add commented initrd command, which - is consistent with documentation. - -2003-09-01 Robert Millan - - * docs/menu.lst: Add NetBSD, OpenBSD, GNU/KFreeBSD and - GNU/KNetBSD. - -2003-08-13 Jason Thomas - - * util/grub-install.in (resolve_symlink): New function to - resolve symlinks. - (find_device): Moved symlink code to new function. - Before we convert the install_device we attempt to resolve it if - its a symlink using the new function. - * util/mbchk.c (check_multiboot): The sense of an error message - was inverted. - Reported by Timothy Baldwin . - -2003-08-12 Jochen Hoenicke - - * stage2/fsys_reiserfs.c (read_tree_node): Fixed a typo; only - matters for very large fs when tree doesn't fit in cache. - (IH_KEY_OFFSET): Don't check for INFO->version. There are - actually old version file systems that use new version items. - (IH_KEY_ISTYPE): Likewise. - (reiserfs_dir): Likewise. - -2003-08-09 Thierry Laronde - - * util/mkbimage: New File. `mkbimage' depends on GRUB and - existed elsewhere. It is now part of GRUB so that people can - fix/contribute. - * util/Makefile.am (sbin_SCRIPTS): Added script `mkbimage' - -2003-08-01 Jason Thomas - - * util/grub-install.in: support --no-floppy - This allow users to specify the --no-floppy option which - is passed onto the grub shell, so it does not probe the floppy - drive. - Patch from kesha@diedas.soften.ktu.lt - -2003-06-17 Jochen Hoenicke - - * stage2/fsys_reiserfs.c (reiserfs_mount): Clear the node cache. - This fixes a problem where files from other partitions appear at - the wrong partition. Problem reported by Johan Regin. - -2003-05-04 Yoshinori K. Okuji - - * docs/grub.texi (partnew): Fixed the inconsistency between the - implementation and the documentation. The last argument is the - length instead of the ending address. - Reported by Daniel Farrell . - -2003-03-19 Yoshinori K. Okuji - - From Adam Lackorzynski : - * stage2/shared.h (KEY_NPAGE): Changed to 0x5100. - (KEY_PPAGE): Changed to 0x4900. - -2003-03-19 Yoshinori K. Okuji - - * stage2/boot.c (load_image): Check if DATA_LEN plus SECTOR_SIZE - is less than or equal to MULTIBOOT_SEARCH, instead of if - DATA_LEN is less than or equal to MULTIBOOT_SEARCH. - Reported by Neelkanth Natu . - -2003-03-10 Yoshinori K. Okuji - - From Andrew Walrond : - * stage2/fsys_reiserfs.c (struct reiserfs_journal_header): - Remove an unnecessary ``long''. - -2003-03-10 Yoshinori K. Okuji - - From Tilmann Bubeck: - * stage2/builtins.c [SUPPORT_SERIAL] (terminfo_func): Unescape - arguments before copying them, and escape sequences before - printing them. - * stage2/terminfo.h (TERMINFO_LEN): Changed to 40. - -2003-02-20 Yoshinori K. Okuji - - * util/grub-install.in (find_device): Fix the sed script. - -2003-02-17 Yoshinori K. Okuji - - * lib/device.c (check_device): If DEVICE is empty, just return - 1. - (get_scsi_disk_name) [__QNXNTO__]: Make NAME empty, because SCSI - disks are detected as IDE disks on QNX RTP. - - From Taketo Kabe : - * lib/device.c (get_ide_disk_name) [__QNXNTO__]: Set NAME to - "/dev/hdX". - (get_floppy_disk_name) [__QNXNTO__]: Set NAME to "/dev/fdX". - * stage2/mb_info.h (struct AddrRangeDesc): Specified with the - attribute packed. - * stage2/shared.h (struct mmar_desc): Likewise. - -2003-01-29 Yoshinori K. Okuji - - From Ilguiz Latypov: - * configure.in: Fix a syntax error in a sed script. - * stage2/bios.c (get_diskinfo): PhoenixBIOS 4.0 Revision 6.0 - for ZF Micro might understand the greater buffer size for the - "get drive parameters" int 0x13 call in its own way. - Supposedly the BIOS assumes even bigger space is available and - thus corrupts the stack. This is why we specify the exactly - necessary size of 0x42 bytes. - -2003-01-25 Yoshinori K. Okuji - - From Steven Dick : - * stage2/pc_slice.h (PC_SLICE_TYPE_DELL_UTIL): New macro. - (IS_PC_SLICE_TYPE_FAT): Recognize PC_SLIDE_TYPE_DELL_UTIL as - well. - -2003-01-25 Yoshinori K. Okuji - - From Karsten Scheibler : - * stage2/terminfo.c (term): Don't use a C99-style initializer. - -2003-01-16 Yoshinori K. Okuji - - From H.J. Lu : - * stage2/disk_io.c (part_start): Use unsigned long to support - large disks. - (part_length): Likewise. - * stage2/shared.h (part_start): Likewise. - (part_length): Likewise. - -2003-01-05 Yoshinori K. Okuji - - * configure.in (CFLAGS): When the default CFLAGS is used, - eliminate -O2 and -g from CFLAGS, because Autoconf may - automatically set CFLAGS to them. - -2003-01-02 Yoshinori K. Okuji - - From Jeremy Katz: - * configure.in: Support building on x86_64 with gcc -m32. - -2003-01-02 Yoshinori K. Okuji - - From Jeremy Katz: - * stage2/fsys_ext2fs.c (ext2fs_dir): Initialize STR_CHK to shut - up GCC. - * stage2/fsys_minix.c (minix_dir): Likewise. - -2002-12-21 Yoshinori K. Okuji - - * stage2/asm.S (gateA20): First, try a BIOS call (INT 15H, - AX=2400/2401). Use the keyboard controller, only if that failed. - -2002-12-11 Yoshinori K. Okuji - - Add a workaround for buggy BIOSes which don't pass boot drive - correctly. The idea is that GRUB forces the fixed disk flag - when booted from a hard disk. When BIOS loads GRUB directly, - the boot drive must be either of 0x00 and 0x80, so this should - work, if those BIOSes always pass zero to %dl. AFAIK, this - assumption is always correct. - - * stage2/builtins.c (install_func): Store the fixed disk flag of - the destination drive in BOOT_DRIVE_MASK in Stage 1. - - * stage1/stage1.h (STAGE1_BOOT_DRIVE_MASK): New macro. - - * stage1/stage1.S (boot_drive_mask): New variable. It is or'ed - to %dl. - -2002-12-09 Yoshinori K. Okuji - - * stage2/char_io.c (init_page): Change the software name from - "GRUB" to "GNU GRUB". This was inaccurate. Reported by Ciaran - O'Riordan . - -2002-12-04 Yoshinori K. Okuji - - * stage2/builtins.c (embed_func): When checking if the disk can - store Stage 1.5, check every partition, if it isn't empty. - -2002-12-04 Yoshinori K. Okuji - - * stage2/stage2.c (print_entry): Put a right arrow, if the entry - is longer than 71 characters. Reported by Pavel Roskin. - -2002-12-04 Yoshinori K. Okuji - - * stage2/disk_io.c (set_device): If '(n' is given, add 'd' into - DEVICE. Reported by Pavel Roskin. - -2002-12-03 Yoshinori K. Okuji - - Change the terminal structure a bit, to turn the cursor state - explicitly. Suggested by Pavel Roskin. - - * stage2/term.h (struct term_entry): Remove the member - `nocursor' and add `setcursor'. - [!STAGE1_5] (console_setcursor): New prototype. - [SUPPORT_HERCULES] (hercules_setcursor): Likewise. - [!STAGE1_5] (console_nocursor): Removed. - [SUPPORT_HERCULES] (hercules_nocursor): Likewise. - - * stage2/stage2.c (run_menu): Call setcursor instead of - nocursor. - Call setcursor with 1 before starting a boot entry. - - * stage2/shared.h (nocursor): Removed. - (setcursor): New prototype. - - * stage2/hercules.c (herc_cursor_state): New variable. - (herc_turn_cursor): Removed. - (hercules_nocursor): Likewise. - (hercules_setcursor): New function. - - * stage2/char_io.c (get_cmdline): Turn on the cursor at the - beginning, and restore it before returning. - (nocursor): Removed. - (setcursor): New function. - - * stage2/asm.S (console_cursor_state): New variable. - (console_cursor_shape): Likewise. - (console_setcursor): New function. - (console_nocursor): Removed. - - * grub/asmstub.c (console_setcursor): New function. - (hercules_setcursor): Likewise. - (console_nocursor): Removed. - (hercules_nocursor): Likewise. - -2002-12-03 Yoshinori K. Okuji - - * docs/grub.texi (terminfo): Fix a misleading English sentence. - Reported by Pavel Roskin. - * stage2/builtins.c (builtin_terminfo): Likewise. - -2002-12-01 Yoshinori K. Okuji - - From Alexander Langer : - * stage2/freebsd.h (RB_GDB): New macro. - (RB_MUTE): Likewise. - (RB_MULTIPLE): Likewise. - - * stage2/boot.c (bsd_boot): Set the bits of RB_MULTIPLE, RB_GDB - and RB_MUTE when "-D", "-g" and "-m" are specified, - respectively. - -2002-12-01 Yoshinori K. Okuji - - * docs/grub.texi (Reporting bugs): Specify the project page of - the BTS instead of the BTS itself. - -2002-11-30 Yoshinori K. Okuji - - * docs/Makefile.am (man_MANS): Added grub-terminfo.8. - ($(srcdir)/grub_terminfo.8): New target. - * utils/grub-terminfo.in: New file. - * util/Makefile.am (sbin_SCRIPTS): Added grub-terminfo. - * configure.in (AC_OUTPUT): Added util/grub-terminfo. - - * docs/grub.texi (terminfo): New subsection. - (Invoking grub-terminfo): New chapter. - - From Tilmann Bubeck : - * stage2/Makefile.am (noinst_HEADERS): Added terminfo.h and - tparm.h. - (libgrub_a_SOURCES): Added terminfo.c and tparm.c. - (pre_stage2_exe_SOURCES): Likewise. - * stage2/terminfo.c: New file. - * stage2/terminfo.h: Likewise. - * stage2/tparm.c: Likewise. - * stage2/tparm.h: Likewise. - * stage2/stage2.c (get_line_from_config): Fix handling of - backslashes. - * stage2/char_io.c (grub_putstr): New function. - (grub_printf): Use grub_putstr. - (substring): Add const into both arguments. - * stage2/builtins.c [SUPPORT_SERIAL]: Include terminfo.h. - [SUPPORT_SERIAL] (terminfo_func): New function. - [SUPPORT_SERIAL] (builtin_terminfo): New variable. - (builtin_table) [SUPPORT_SERIAL]: Added a pointer to - BUILTIN_TERMINFO. - * stage2/serial.c (serial_gotoxy): Use ti_cursor_address. - (serial_cls): Use ti_clear_screen. - (serial_highlight): use ti_enter_standout_mode and - ti_exit_standout_mode. - -2002-11-30 Yoshinori K. Okuji - - * stage2/disk_io.c (rawread): Make sure that SECTOR is valid. - If not, set ERRNUM to ERR_GEOM and return zero. This check is - critical when a partition table is corrupted. - -2002-11-28 Yoshinori K. Okuji - - * stage2/asm.S (console_cls): Write spaces to the entire screen - instead of getting/setting the video mode, because this flickers - the screen and is quite annoying, if using a LCD. - -2002-11-15 Yoshinori K. Okuji - - * docs/grub.texi (QNX): New subsection. Reported by - Marian-Nicolae V. ION . - -2002-10-28 Yoshinori K. Okuji - - * grub/asmstub.c (console_translate_key): Deal with KEY_PPAGE - and KEY_NPAGE. - * stage2/serial.c (serial_translate_key_sequence): Added two new - codes for Page Up and Page Down. - * stage2/asm.S (translation_table): Added entries for KEY_PPAGE - and KEY_NPAGE. - * stage2/stage2.c (run_menu): Deal with Page Up and Page Down. - Also recognize the right key for the selection of a boot entry. - Suggested by Adam Lackorzynski . - -2002-10-10 Jason Thomas - - * stage2/builtins.c (setup_func): Added missing space to --force-lba - option. Reported by Kenneth Crudup - -2002-10-06 Yoshinori K. Okuji - - * stage2/asm.S (gateA20): Output a dummy command (0xff), as a - workaround for USB keyboard hanging problem. Suggested by - Hidetoshi Nishimaki . - -2002-10-06 Yoshinori K. Okuji - - * configure.in (falign_loop_flag): New variable. Set to if GCC - supports `-falign-*'. If true, use `-falign-jumps', - `-falign-loops' and `-falign-functions' instead of - `-malign-jumps', `-malign-loops' and `-malign-functions', - because `-malign-*' are obsolete in GCC 3.x. Reported by Jeremy - Katz. - -2002-09-13 Yoshinori K. Okuji - - * stage2/serial.c (fill_input_buf): Take a new argument NOWAIT. - If NOWAIT is true, don't loop. - All callers are changed. - -2002-09-08 Yoshinori K. Okuji - - * configure.in (--disable-serial): Fix a typo in the - description. - -2002-08-20 Jason Thomas - - Changed highlight state code for hercules, console and serial. - The state was 0 - normal or 1 - highlight. - The state is now defined using an enum called color_state. - - * stage2/term.h (color_state): New enum. - (COLOR_STATE_STANDARD): Standard color to use when not using - user defined. - (COLOR_STATE_NORMAL): User defined normal color. - (COLOR_STATE_HIGHLIGHT): User defined highlight color. - (console_highlight): Renamed to console_setcolorstate. - (serial_highlight): Renamed to serial_setcolorstate. - (hercules_highlight): Renamed to hercules_setcolorstate. - * stage2/hercules.c (herc_highlight_state): Removed. - (herc_standard_color): New variable. - (herc_color_state): Likewise. - (herc_highlight): Renamed to herc_setcolorstate. - (herc_setcolorstate): Added switch to handle new states. - * stage2/console.c (console_highlight_state): Removed. - (console_standard_color): New variable. - (console_color_state): Likewise. - (console_highlight): Renamed to console_setcolorstate. - (console_setcolorstate): Added switch to handle new states. - * stage2/serial.c (serial_highlight): Renamed to - serial_setcolorstate. - (serial_setcolorstate): Adjusted 'if' to suit new states. - * grub/asmstub.c (console_highlight): Renamed to - console_setcolorstate. - (console_setcolorstate): Adjusted 'if' to suit new states. - * stage2/stage2.c (print_entry): Set color states using new - states. - (print_border): Likewise. - * stage2/stage2.c (run_menu): Reverse if (!) to if () for - uniformitty. - -2002-07-12 Yoshinori K. Okuji - - * stage2/boot.c (load_image): Rewrite the Linux booting support - radically. Now it should work even on a machine having, say, - only 128KB, theoretically. Of course, GRUB itself doesn't work - on such a system, though. - (load_initrd): Initialize LH based on CUR_ADDR, because the - location becomes dynamic. - * stage2/shared.h (LINUX_MAX_SETUP_SECTS): Set to 64. - (LINUX_HEAP_END_OFFSET): Set to (0x9000 - 0x200). - (LINUX_STAGING_AREA): Removed. - (LINUX_SETUP): Likewise. - (LINUX_KERNEL): Likewise. - (LINUX_KERNEL_MAXLEN): Likewise. - (LINUX_SETUP_SEG): Likewise. - (LINUX_INIT_SEG): Likewise. - (LINUX_SETUP_STACK): Set to 0x9000. - (LINUX_BZIMAGE_ADDR): New macro. - (LINUX_ZIMAGE_ADDR): Likewise. - (LINUX_OLD_REAL_MODE_ADDR): Likewise. - (CL_MY_LOCATION): Removed. - (CL_MY_END_ADDR): Likewise. - (CL_BASE_ADDR): Likewise. - (CL_MAGIC): Renamed to ... - (LINUX_CL_MAGIC): ... this. - (LINUX_CL_OFFSET): New macro. - (LINUX_CL_END_OFFSET): Likewise. - (LINUX_SETUP_MOVE_SIZE): Likewise. - (struct linux_kernel_header): Change the type of the member - "cmd_line_ptr" to char *. - (linux_data_tmp_addr): Declared. - (linux_data_real_addr): Likewise. - * stage2/asm.S [!STAGE1_5] (linux_data_tmp_addr): New variable. - [!STAGE1_5] (linux_data_real_addr): Likewise. - [!STAGE1_5] (big_linux_boot): Copy the real mode part from - LINUX_DATA_TMP_ADDR to LINUX_DATA_REAL_ADDR. - * grub/asmstub.c (linux_data_tmp_addr): New variable. - (linux_data_real_addr): Likewise. - -2002-07-09 Yoshinori K. Okuji - - From Mark Kettenis : - * stage2/boot.c (load_image): Recognize newer FreeBSD kernels. - * stage2/i386-elf.h (EI_OSABI): New macro. - (EI_ABIVERSION): Likewise. - (ELFOSABI_FREEBSD): Likewise. - (EI_PAD): Set to 9. - -2002-07-06 Yoshinori K. Okuji - - * stage2/shared.h (boot_part_offset): Removed. - - * stage2/disk_io.c (set_bootdev): Copy the partition information - here. Now this function can call rawread, so it can fail. - (boot_part_offset): Removed. - - * stage2/builtins.c (boot_func): Don't copy the partition - information here. - (real_root_func): Check ERRNUM after calling set_bootdev. - -2002-07-04 Yoshinori K. Okuji - - * docs/grub.texi (Reporting bugs): Use the group name (i.e. - grub) instead of the group id (i.e. 68) for the URL of the BTS. - -2002-07-03 Yoshinori K. Okuji - - * stage2/serial.c [!GRUB_UTIL] (inb): Added a delay into this - function itself. - [!GRUB_UTIL] (outb): Likewise. - [!GRUB_UTIL] (serial_hw_put): Increase the timeout value, and - don't call serial_hw_delay explicitly any longer. - (fill_input_buf): Increase the maximum number of retries, reset - the counter to zero after getting a valid character, and don't - call serial_hw_delay explicitly any longer. - -2002-07-03 Yoshinori K. Okuji - - * stage2/serial.c [!GRUB_UTIL] (serial_hw_fetch): Fixed a typo. - Reported by Ilguiz Latypov. - -2002-07-01 Yoshinori K. Okuji - - * Makefile.am (AUTOMAKE_OPTIONS): New variable. Specify the - required Automake version explicitly. - -2002-06-30 Yoshinori K. Okuji - - * stage2/builtins.c [SUPPORT_SERIAL || SUPPORT_HERCULES] - (terminal_func): Set CURRENT_TERM to each of selected terminals - before calling grub_printf, and restore CURRENT_TERM after it. - Reported by Ilguiz Latypov. - Prepend a carriage return to the prompting message, because it - is ugly that the same messages fulfill the whole screen. - -2002-06-30 Yoshinori K. Okuji - - * stage2/serial.c [!GRUB_UTIL] (serial_hw_fetch): Fixed the - conditional statement. Reported by Ilguiz Latypov. - -2002-06-24 Yoshinori K. Okuji - - * MAINTENANCE: New file. - -2002-06-15 Yoshinori K. Okuji - - * stage2/disk_io.c [SUPPORT_NETBOOT] (GRUB): Defined. - [SUPPORT_NETBOOT]: Include etherboot.h. - [!STAGE1_5] (print_completions) [SUPPORT_NETBOOT]: When - completing a disk name, if NETWORK_READY is true, add "nd" as a - completion. - -2002-06-15 Yoshinori K. Okuji - - * stage2/fsys_xfs.c (le32): Don't use bswap, but use xchgb and - roll, because 386 doesn't have bswap. Reported by Frode Vatvedt - Fjeld . - -2002-06-12 Yoshinori K. Okuji - - * netboot/main.c (ifconfig): If GW is specified, clear out the - ARP entry for the gateway. If SVR is specified, clear out the - ARP entry for the server. Reported by Uwe Dannowski - . - -2002-06-12 Yoshinori K. Okuji - - * util/grub-md5-crypt.in: Prompt to retype a password, and check - if the passwords matches. Suggested by Matt Perry - . - Also, don't use Perl any longer, because *BSD's sh and GNU - support ``read -r'', and GRUB doesn't support any other - operating system anyway. - -2002-06-12 Yoshinori K. Okuji - - The terminal handling code is rewritten radically. - - * stage2/console.c: New file. - * stage2/term.h: Likewise. - - * stage2/Makefile.am (noinst_HEADERS): Added term.h. - (libgrub_a_SOURCES): Added serial.c. - (pre_stage2_exec_SOURCES): Added console.c. - - * stage2/asm.S (console_putchar): Rewritten from scratch. - [!STAGE1_5] (translation_table): New variable. - [!STAGE1_5] (translate_keycode): New function. - [!STAGE1_5] (console_getkey): Call translate_keycode. - [!STAGE1_5] (console_checkkey): Likewise. - [!STAGE1_5] (nocursor): Renamed to ... - [!STAGE1_5] (console_nocursor): ... this. - [!STAGE1_5] (console_set_attrib): Removed. - - * stage2/builtins.c: Include term.h. - (terminal): Removed. - (normal_color): Likewise. - (highlight_color): Likewise. - (cat_func): Display a question mark when a non-printable - character was read. - (terminal_func): Rewritten almost from scratch. - - * stage2/char_io.c: Include term.h. - [!STAGE1_5] (auto_fill): Removed. - [!STAGE1_5] (term_table): New variable. - [!STAGE1_5] (current_term): Likewise. - [!STAGE1_5] (real_get_cmdline): New function. The code was - stolen from the previous version of get_cmdline. - [!STAGE1_5] (get_cmdline): Rewritten from scratch. - [!STAGE1_5] (translate_keycode): Removed. - [!STAGE1_5] (getkey): Rewritten from scratch. - [!STAGE1_5] (checkkey): Likewise. - (grub_putchar): Likewise. - [!STAGE1_5] (gotoxy): Likewise. - [!STAGE1_5] (getxy): Likewise. - [!STAGE1_5] (cls): Likewise. - [!STAGE1_5] (nocursor): New function. - [SUPPORT_SERIAL] (serial_getxy): Removed. - [SUPPORT_SERIAL] (serial_gotoxy): Likewise. - [SUPPORT_SERIAL] (serial_cls): Likewise. - [SUPPORT_SERIAL] (serial_getxy): Likewise. - [!STAGE1_5] (set_attrib): Likewise. - - * stage2/cmdline.c (init_cmdline): Set COUNT_LINES to -1. - - * stage2/common.c [!STAGE1_5] (err_list): Removed - ERR_NEED_SERIAL and added ERR_DEV_NEED_INIT. - - * stage2/hercules.c: Rewritten almost from scratch. - * stage2/hercules.h (herc_putchar): Removed. - (herc_cls): Likewise. - (herc_getxy): Likewise. - (herc_gotoxy): Likewise. - (herc_set_attrib): Likewise. - - * stage2/serial.c: Rewritten almost from scratch. - * stage2/serial.h: Likewise. - - * stage2/shared.h [GRUB_UTIL] (DISP_UL): Set to the same value - as VGA's. - [GRUB_UTIL] (DISP_UR): Likewise. - [GRUB_UTIL] (DISP_LL): Likewise. - [GRUB_UTIL] (DISP_LR): Likewise. - [GRUB_UTIL] (DISP_HORIZ): Likewise. - [GRUB_UTIL] (DISP_VERT): Likewise. - [GRUB_UTIL] (DISP_LEFT): Likewise. - [GRUB_UTIL] (DISP_RIGHT): Likewise. - [GRUB_UTIL] (DISP_UP): Likewise. - [GRUB_UTIL] (DISP_DOWN): Likewise. - (grub_error_t): Removed ERR_NEED_SERIAL. - Added ERR_DEV_NEED_INIT. - (normal_color): Removed. - (highlight_color): Likewise. - (console_cls): Removed, because this is declared in term.h. - (console_getxy): Likewise. - (console_gotoxy): Likewise. - (console_putchar): Likewise. - (console_getkey): Likewise. - (console_checkkey): Likewise. - (console_set_attrib): Removed. - (set_attrib): Likewise. - [GRUB_UTIL] (nocursor): Declared. - (auto_fill): Removed. - (terminal): Likewise. - (TERMINAL_CONSOLE): Likewise. - (TERMINAL_SERIAL): Likewise. - (TERMINAL_HERCULES): Likewise. - (TERMINAL_DUMB): Likewise. - (translate_keycode): Likewise. - - * stage2/stage2.c: Include term.h. - (print_entry): Rewritten from scratch. - (print_entries): Likewise. - (print_border): Likewise. - (set_line): Removed. - (set_line_normal): Likewise. - (set_line_highlight): Likewise. - - * grub/Makefile.am (AM_CFLAGS): Added -DSUPPORT_HERCULES=1. - - * grub/asmstub.c: Don't include hercules.h. Include term.h. - (console_current_color): New variable. - (console_translate_key): New function. - (console_checkkey): Rewritten from scratch. - (console_getkey): Likewise. - (console_putchar): Likewise. - (console_set_attrib): Removed. - (console_highlight): New function. - (console_setcolor): Likewise. - (console_nocursor): Likewise. - (serial_getkey): Removed. - (serial_checkkey): Likewise. - (serial_putchar): Likewise. - (serial_exists): Likewise. - (serial_get_port): Likewise. - (serial_init): Likewise. - (serial_hw_fetch): New function. - (serial_hw_put): Likewise. - (serial_hw_delay): Likewise. - (serial_hw_get_port): Likewise. - (serial_hw_init): Likewise. - (set_serial_device): Renamed to ... - (serial_set_device): ... this. - (herc_putchar): Renamed to ... - (hercules_putchar): ... this. - (herc_cls): Renamed to ... - (hercules_cls): ... this. - (herc_getxy): Renamed to ... - (hercules_getxy): ... this. - (herc_gotoxy): Renamed to ... - (hercules_gotoxy): ... this. - (hercules_highlight): New function. - (hercules_setcolor): Likewise. - (hercules_nocursor): Likewise. - (herc_set_attrib): Removed. - - * grub/main.c: Include term.h. - (main): If USE_CURSES is false, set CURRENT_TERM->FLAGS to - TERM_NO_EDIT | TERM_DUMB. TERMINAL is not used any longer. - -2002-06-01 Yoshinori K. Okuji - - * docs/grub.texi (FAQ): Removed. See the GNU GRUB FAQ on the web - instead. - -2002-05-31 Yoshinori K. Okuji - - * docs/grub.texi (Reporting bugs): Recommend using the BTS on - Savannah rather than the list bug-grub. - -2002-05-25 Yoshinori K. Okuji - - * stage2/builtins.c (boot_func): Load the boot partition - information, only if the address of the boot partition entry is - set appropriately. - (real_root_func): If ATTEMPT_MOUNT is false, call open_partition - and if successful, call set_bootdev, to set the offset of the - boot partition and the address of the boot paetition entry. - IF ATTEMPT_MOUNT is false, don't set BOOTDEV. The BSD evil hack - is useless with the command "rootnoverify" anyway. - * stage2/disk_io.c (boot_part_addr): Initialized with zero - explicitly, to emphasize that it is invalid. - -2002-05-24 Yoshinori K. Okuji - - * stage2/builtins.c (real_root_func): New function. - (root_func): Just call real_root_func. - (rootnoverify_func): Likewise. - -2002-05-23 Yoshinori K. Okuji - - * configure.in (AM_INIT_AUTOMAKE): Changed the version number to - 0.93. - -2002-05-23 Yoshinori K. Okuji - - Define the behavior of the boot loader when the load end address - and the bss end address are zero in the Multiboot Specification, - and add the support into GRUB. I've modified a patch from Yuri - Zaporogets . - - * stage2/boot.c (load_image): In the case of Multiboot a.out - kludge, set the load end address to the load address plus the - size of the OS image file, if it is zero. Similarly, set the bss - end address to the load end address, if it is zero. - - * util/mbchk.c (check_multiboot): Don't check if the load - address is greater than or equal to the load end address, if the - load end address is zero. Don't check if the load end address is - greater than the bss end address, if the bss end address is - zero. And, don't check if the load end address is less than or - equal to the entry address, if the load end address is zero. - - * docs/multiboot.texi (The address fields of Multiboot header): - Added descriptions about the behavior of the boot loader when - LOAD_END_ADDR is zero and BSS_END_ADDR is zero. - -2002-05-22 Yoshinori K. Okuji - - * stage2/builtins.c (boot_func): If DEBUG is true, print - BOOT_DRIVE and BOOT_PART_OFFSET. - Don't set ERRNUM after rawread failed, because rawread should - set ERRNUM itself. - -2002-05-20 Yoshinori K. Okuji - - * lib/device.c (read_device_map): Show an error message and exit - abnormally, if MAP[DRIVE] has already been filled. - * util/grub-install.in: If there is any dulicated entry, print - an error message and exit abnormally. - -2002-05-20 Yoshinori K. Okuji - - * lib/device.c: Don't include linux/hdreg.h, linux/major.h, - or linux/kdev_t.h. - [__linux__] (HDIO_GETGEO): Defined. - [__linux__] (hd_geometry): Likewise. - [__linux__] (FLOPPY_MAJOR): Likewise. - [__linux__] (MINORBITS): Likewise. - [__linux__] (MAJOR): Likewise. - -2002-05-08 Yoshinori K. Okuji - - * netboot/fsys_tftp.c (tftp_read): Don't call buf_fill unless - SIZE is positive. - -2002-05-08 Yoshinori K. Okuji - - * netboot/etherboot.h (ETH_MAX_MTU): Because some DHCP/BOOTP - servers don't treat the maximum length the same as Etherboot, - subtract the size of an IP header and that of an UDP header. - -2002-04-30 Yoshinori K. Okuji - - From Jean-Jacques Michel : - * stage2/boot.c (load_image): For Linux, check if DATA_LEN is - greater than MULTIBOOT_SEARCH. If that's true, read the rest - after copying data already read in BUFFER. - -2002-04-30 Yoshinori K. Okuji - - * stage2/boot.c (load_image): For Linux, don't check if the - length of protected mode code is greater than or equal to the - expected length minus 16. Instead, just check if no error - occurred. That was problematic, because memdisk has no protected - mode code. Also, I don't see what the magic number 16 was for. - -2002-04-29 Yoshinori K. Okuji - - * stage2/builtins.c [SUPPORT_SERIAL] (terminal_func): Added a - new option ``--silent''. This suppresses messages, if specified. - -2002-04-29 Yoshinori K. Okuji - - * config.guess: New upstream version. - * config.sub: Likewise. - -2002-04-20 Yoshinori K. Okuji - - * netboot/config.c (PCI_NIC) [INCLUDE_DAVICOM]: Fix typos. - Reported by Julien Perrot . - -2002-04-17 Yoshinori K. Okuji - - * stage2/builtins.c [SUPPORT_SERIAL] (terminal_func): Set - COUNT_LINES to -1, to disable the pager. - -2002-04-16 Yoshinori K. Okuji - - * docs/grub.texi (Obtaining and Building GRUB): Update the link - to the binutils site. - -2002-04-06 Pavel Roskin - - * util/grub-install.in: Fix hardcoded /dev/hda1. - -2002-04-06 Yoshinori K. Okuji - - * stage2/builtins.c [GRUB_UTIL] (dump_func): New function. - [GRUB_UTIL] (builtin_dump): New variable. - (builtin_table) [GRUB_UTIL]: Added a pointer to BUILTIN_DUMP. - * util/grub-install.in: Make sure that GRUB reads the same - images as the host operating system by comparing the result of - running the command "dump" with the contents of the OS file. - -2002-04-04 Yoshinori K. Okuji - - * stage2/builtins.c (setup_func): Don't embed a drive number, if - unnecessary. - -2002-03-29 Yoshinori K. Okuji - - * docs/grub.texi (General commands): Added ``pager'' into the - menu. - (pager): New subsection. - (terminal): Added a description about the option - ``--lines=LINES''. - - * configure.in (AC_INIT_AUTOMAKE): Set the version number to - 0.92. - -2002-03-26 Yoshinori K. Okuji - - * netboot/eepro100.c (eepro100_probe): Increase the delay at the - initialization. - -2002-03-26 Yoshinori K. Okuji - - * stage2/boot.c (linux_mem_size): New variable. - (load_image): Check a mem= option and set LINUX_MEM_SIZE to the - specified memory size, if any. Otherwise, to zero. When an - overflow is detected, use LINUX_INITRD_MAX_ADDRESS instead. - (load_initrd): If LINUX_MEM_SIZE is non-zero, use it instead of - the actual memory size. - * stage2/char_io.c (safe_parse_maxint): Use ERR_NUMBER_OVERFLOW - instead of ERR_NUMBER_PARSING, when an overflow occurs. - * stage2/common.c [!STAGE1_5] (err_list): Added - ERR_NUMBER_OVERFLOW. - * stage2/shared.h (ERR_NUMBER_OVERFLOW): New constant. - -2002-03-24 Yoshinori K. Okuji - - * stage2/stage2.c (run_menu): Call cls outside the loop to run - scripts. - * stage2/cmdline.c (run_script): Prompt a user's intervention, - only when FALLBACK_ENTRY is negative. - -2002-02-11 Pavel Roskin - - * util/grub-install.in (find_device): New function - find block - device for given file or directory. Resolve symlinks to fix - problem on Linux with devfs and old device names in /etc/fstab. - Use find_device() for root_device, bootdir_device and - grubdir_device. - -2002-02-08 Yoshinori K. Okuji - - * grub/main.c (OPT_NO_PAGER): New macro. - (longopts): Added an entry for "--no-pager". - (usage): Added a description about "--no-pager". - (main): In case of OPT_NO_PAGER, set USE_PAGER to zero. The same - thing is done with OPT_BATCH, because the pager is just harmful - in batch mode. - -2002-02-08 Yoshinori K. Okuji - - * stage2/builtins.c (help_func): Show all the commands runnable - with the command-line interface, if "--all" is specified. - -2002-02-08 Yoshinori K. Okuji - - An internal pager is implemented. - - * stage2/builtins.c (pager_func): New function. - (builtin_pager): New variable. - (terminal_func): New option, "--lines=LINES" is added. If this - option is specified, set MAX_LINES to the value. Otherwise, set - MAX_LINES to 24. - (vbeprobe_func): Remove the pager code specific to this - function. - (builtin_table): Added a pointer to BUILTIN_PAGER. - * stage2/char_io.c (max_lines) [!STAGE1_5]: New variable. - (count_lines) [!STAGE1_5]: Likewise. - (use_pager) [!STAGE1_5]: Likewise. - (grub_putchar) [!STAGE1_5]: if C is a newline and COUNT_LINES is - not -1, count up the number of lines. If it exceeds the maximum - number of lines minus 2, show a message and wait for input of - return key. "minus 2" is to reserve space for the message - printed by this internal pager. - * stage2/cmdline.c (enter_cmdline): If USE_PAGER is true, set - COUNT_LINES to zero, before running a command, and reset - COUNT_LINES to -1 after that. - * stage2/shared.h (max_lines) [!STAGE1_5]: Declared. - (count_lines) [!STAGE1_5]: Likewise. - (use_pager) [!STAGE1_5]: Likewise. - -2002-02-08 Yoshinori K. Okuji - - * stage2/fsys_jfs.c (jfs_read) [STAGE1_5]: Set and reset - DISK_READ_FUNC even in Stage 1.5. - * stage2/fsys_xfs.c (xfs_read) [STAGE1_5]: Likewise. - - * stage2/stage1_5.c (saved_sector): Initialized with -1. - (cmain): Check if SAVED_SECTOR was set appropriately after - reading the second sector of Stage 2. If SAVED_SECTOR is not - set (i.e. it is equal to -1), print an error and stop. - -2002-02-05 Yoshinori K. Okuji - - * stage2/builtins.c (setup_func): Add a VSTa fs entry into - STAGE1_5_MAP. - -2002-02-05 Yoshinori K. Okuji - - * stage2/shared.h (BUILTIN_HELP_LIST): New macro. Used for - commands whose help messages are listed when no argument is - specified to the command "help". - * stage2/builtins.c (builtin_blocklist): Added the attribute - BUILTIN_HELP_LIST. - (builtin_boot): Likewise. - (builtin_bootp): Likewise. - (builtin_cat): Likewise. - (builtin_chainloader): Likewise. - (builtin_color): Likewise. - (builtin_configfile): Likewise. - (builtin_device): Likewise. - (builtin_dhcp): Likewise. - (builtin_displayapm): Likewise. - (builtin_displaymem): Likewise. - (builtin_find): Likewise. - (builtin_geometry): Likewise. - (builtin_halt): Likewise. - (builtin_help): Likewise. - (builtin_hide): Likewise. - (builtin_ifconfig): Likewise. - (builtin_initrd): Likewise. - (builtin_kernel): Likewise. - (builtin_makeactive): Likewise. - (builtin_map): Likewise. - (builtin_md5crypt): Likewise. - (builtin_module): Likewise. - (builtin_modulenounzip): Likewise. - (builtin_partnew): Likewise. - (builtin_parttype): Likewise. - (builtin_quit): Likewise. - (builtin_rarp): Likewise. - (builtin_reboot): Likewise. - (builtin_root): Likewise. - (builtin_rootnoverify): Likewise. - (builtin_serial): Likewise. - (builtin_setkey): Likewise. - (builtin_setup): Likewise. - (builtin_terminal): Likewise. - (builtin_testvbe): Likewise. - (builtin_tftpserver): Likewise. - (builtin_unhide): Likewise. - (builtin_uppermem): Likewise. - (builtin_vbeprobe): Likewise. - - (help_func): When no argument is specified, if the last entry - was at the left column, print an extra newline. - -2002-02-05 Yoshinori K. Okuji - - * stage2/shared.h (BUILTIN_HIDDEN): Renamed to ... - (BUILTIN_NO_ECHO): ... this. The old name was too difficult to - see _what_ was hidden. - -2002-02-05 Yoshinori K. Okuji - - * netboot/misc.c (twiddle): Go back to the bar progress, copied - from etherboot-5.0.5/src/misc.c. Execute the code only if DEBUG - is true. - -2002-02-05 Yoshinori K. Okuji - - * stage2/builtins.c (displaymem_func): Use hex digits to display - for consistency. - -2002-02-04 Jason Thomas - - From Denis Kitzman : - * stage2/Makefile.am (libgrub_a_CFLAGS): Fixed a typo. - FSYS_XFS, USE_MD5_PASSWORDS, SUPPORT_SERIAL, and - SUPPORT_HERCULES did not get defined. - -2002-01-20 Yoshinori K. Okuji - - * util/grub-image.in: Check stage2 instead of stage2.c to - determine where the script is invoked, because srcdir may not - be used for the compilation. - -2002-01-20 Yoshinori K. Okuji - - * grub/asmstub.c (console_putchar): When not using curses, - ignore a carriage return, because a newline in Unix is only a - line feed. - -2002-01-18 Klaus Reichl - - * stage2/fsys_minix.c (minix_dir): Fixed bug getting filenames - with MAXNAMELEN right. - - * stage2/char_io.c (get_cmdline, cl_refresh): If TERMINAL_DUMB - section is always 0. - Line is only cleared if !TERMINAL_DUMB. - - * grub/main.c (use_curses): Initialize to 0 if !HAVE_LIBCURSES - (main): Check for curses use and set terminal to dumb if we - don't use it (helps for --batch and variants of non-curses - setup). - -2002-01-15 Yoshinori K. Okuji - - * configure.in (AM_INIT_AUTOMAKE): The version number is - upgraded to 0.91. - -2002-01-15 Yoshinori K. Okuji - - * docs/grub.texi (Preset Menu): New chapter. - -2002-01-15 Yoshinori K. Okuji - - * docs/grub.texi: Added some text about JFS and XFS. - -2002-01-08 Yoshinori K. Okuji - - * grub/main.c (use_preset_menu): New variable. - (OPT_PRESET_MENU): New macro. - (longopts): Added an entry for "--preset-menu". - (usage): Added a description for "--preset-menu". Also, change - the first character of the description for "--device-map" to - lower case for consistency. - (main): Set USE_PRESET_MENU to 1 in the case of OPT_PRESET_MENU. - * stage2/shared.h (use_preset_menu): Declared. - * stage2/stage2.c [PRESET_MENU_STRING || SUPPORT_DISKLESS] - (open_preset_menu) [GRUB_UTIL]: If USE_PRESET_MENU is false, - return zero immediately. - -2002-01-08 Yoshinori K. Okuji - - * stage2/common.c [SUPPORT_DISKLESS] - (setup_diskless_environment): Removed. The feature is moved to - the preset menu. - * stage2/stage2.c [SUPPORT_DISKLESS] (preset_menu): Set to the - string "bootp\n". - [SUPPORT_DISKLESS] (preset_menu_offset): Defined, as if - PRESET_MENU_STRING is defined. - [SUPPORT_DISKLESS] (open_preset_menu): Likewise. - [SUPPORT_DISKLESS] (read_from_preset_menu): Likewise. - [SUPPORT_DISKLESS] (close_preset_menu): Likewise. - -2002-01-06 Yoshinori K. Okuji - - The preset menu has a priority over the configuration file. - Suggested by Christoph Plattner. - - * stage2/stage2.c [PRESET_MENU_STRING] (open_preset_menu): - Check if PRESET_MENU is not NULL. - [PRESET_MENU_STRING] (close_preset_menu): Set PRESET_MENU to - NULL. - (cmain): New internal function, reset. This function resets - AUTO_FILL, CONFIG_LEN, MENU_LEN, NUM_ENTRIES, CONFIG_ENTRIES, - MENU_ENTRIES and call init_config. - Try to open the preset menu first, and try to open the - configuration file, only if that failed. - Even if the preset menu was read, try to open the configuration - file. This time, opening the preset menu never succeed, because - close_preset_menu ensures that the preset menu is available at - most once. - -2002-01-06 Yoshinori K. Okuji - - * netboot/misc.c (inet_aton): Don't check if *P is an asterisk, - if I is 3. Reported by Rick (his real name and address are - unknown). - -2002-01-03 Yoshinori K. Okuji - - Update the netboot stuff to Etherboot-5.0.5. - - * configure.in (--enable-3c590): Removed. This was a mistake. - (--enable-davicom): New option. - (--enable-eepro): Likewise. - (--enable-natsemi): Likewise. - (--enable-ni5010): Likewise. - (--enable-sis900): Likewise. - (--enable-w89c840): Likewise. - (--enable-3c509-hack): Removed. - (--enable-ns8390-force-16bit): Likewise. - - * netboot/Makefile.am (libdrivers_a_SOURCES): Added timer.c and - timer.h. - (EXTRA_libdrivers_a_SOURCES): Added davicom.c, eepro.c, fa311.c, - natsemi.c, ni5010.c, sis900.c, sis900.h, tlan.c and w89c840.c. - (EXTRA_DIST): Added sis900.txt. - (3c595_drivers): Remove 3c590.o from this. - (davicom_drivers): New variable. - (eepro_drivers): Likewise. - (natsemi_drivers): Likewise. - (ni5010_drivers): Likewise. - (sis900_drivers): Likewise. - (w89c840_drivers): Likewise. - (3c590_o_CFLAGS): Removed. - (davicom_o_CFLAGS): New variable. - (eepro_o_CFLAGS): Likewise. - (natsemi_o_CFLAGS): Likewise. - (ni5010_o_CFLAGS): Likewise. - (sis900_o_CFLAGS): Likewise. - (w89c840_o_CFLAGS): Likewise. - - * netboot/davicom.c: New file, from Etherboot-5.0.5. - * netboot/eepro.c: Likewise. - * netboot/natsemi.c: Likewise. - * netboot/ni5010.c: Likewise. - * netboot/sis900.c: Likewise. - * netboot/sis900.h: Likewise. - * netboot/sis900.txt: Likewise. - * netboot/timer.c: Likewise. - * netboot/timer.h: Likewise. - * netboot/w89c840.c: Likewise. - * netboot/fa311.c: Likewise. - * netboot/tlan.c: Likewise. - - * netboot/3c509.c: Copied from Etherboot-5.0.5. - * netboot/3c509.h: Likewise. - * netboot/3c595.c: Likewise. - * netboot/3c90x.c: Likewise. - * netboot/3c90x.txt: Likewise. - * netboot/cards.h: Likewise. - * netboot/cs89x0.c: Likewise. - * netboot/depca.c: Likewise. - * netboot/eepro100.c: Likewise. - * netboot/epic100.c: Likewise. - * netboot/i82586.c: Likewise. - * netboot/lance.c: Likewise. - * netboot/linux-asm-string.h: Likewise. - * netboot/nic.h: Likewise. - * netboot/ns8390.c: Likewise. - * netboot/ns8390.h: Likewise. - * netboot/otulip.c: Likewise. - * netboot/pci.h: Likewise. - * netboot/rtl8139.c: Likewise. - * netboot/sk_g16.c: Likewise. - * netboot/smc9000.c: Likewise. - * netboot/tiara.c: Likewise. - * netboot/tulip.c: Likewise. - * netboot/via-rhine.c: Likewise. - - * netboot/config.c: Applied a diff between Etherboot-4.6.4 and - Etherboot-5.0.5 manually. - * netboot/main.c: Likewise. - * netboot/pci.c: Likewise. - * netboot/etherboot.h: Rewritten mostly from scratch, based on - the same file in Etherboot-5.0.5. - * netboot/misc.c: Likewise. - * netboot/osdep.h: Likewise. - * netboot/fsys_tftp.c (GRUB): Defined. - (buf_fill): Use rfc2131_sleep_interval instead of rfc951_sleep. - - * stage2/builtins.c [SUPPORT_NETBOOT] (GRUB): Defined. - (boot_func) [SUPPORT_NETBOOT]: Call cleanup_net. - * stage2/cmdline.c [SUPPORT_DISKLESS] (GRUB): Defined. - * stage2/common.c [SUPPORT_DISKLESS] (GRUB): Likewise. - -2002-01-02 Jeremy Katz - - * util/grub-install.in: Support using mktemp as well as tempfile - for secure temporary file creation. - -2002-01-02 Jeremy Katz - - * stage2/md5.c (md5_password): Ensure the password exists before - trying to check against the md5 crypted version. - -2001-12-30 Yoshinori K. Okuji - - * stage1/stage1.S: Don't call INT 13, AH=48H, because it is - difficult to call this function with the workaround implemented - in the previous change due to the size limit of Stage 1. - - (lba_mode) [NO_BUGGY_BIOS_IN_THE_WORLD]: Don't check the - geometry explicitly. This shouldn't be harmful, as INT 13, - AH=42H should take care of it, and if you cannot read Stage 2 - even with LBA because of a geometry problem, you can never read - it. - - * stage2/start.S (lba_mode) [NO_BUGGY_BIOS_IN_THE_WORLD]: - Likewise. - -2001-12-30 Yoshinori K. Okuji - - * stage2/bios.c (get_diskinfo): Clear out the structure DRP - before calling get_diskinfo_int13_extensions, because the Ralf - Brown's Interrupt List says that Dell machines using PhoenixBIOS - 4.0 Release 6.0 fail, if DRP.FLAGS is not zero. Setting the - entire structure to zero may be overkill, but it should be safe. - - * stage2/char_io.c [STAGE1_5] (grub_memset): Defined. - -2001-12-30 Yoshinori K. Okuji - - From John Goerzen : - * util/grub-install.in (convert): Added NetBSD support. - -2001-12-30 Yoshinori K. Okuji - - * util/grub-install.in: Set GRUB_PREFIX and BOOTDIR to "/grub" - and "${rootdir}" respectively in NetBSD. - -2001-12-30 Yoshinori K. Okuji - - * stage2/builtins.c (builtin_geometry): Add extra space - characters into the long description. - (builtin_kernel): Likewise. - (builtin_vbeprobe): Likewise. - -2001-12-19 Yoshinori K. Okuji - - From Michael Sullivan : - * stage1/stage1.S (real_start): Added a workaround for AST BIOS, - because it clobbers %dl with INT 13, AH=41H. - -2001-12-19 Yoshinori K. Okuji - - * stage2/fsys_fat.c (fat_read): Fix the contradictory comment. - Reported by Filip Van Raemdonck . - -2001-12-11 Yoshinori K. Okuji - - * stage2/builtins.c (displayapm_func): Don't use multi-line - string literals but string concatenation instead, to suppress - warnings from gcc-3.0.x. - * stage2/cmdline.c (print_cmdline_message): Likewise. - * util/mbchk.c (usage): Likewise. - - * stage2/smp-imps.c (imps_read_config_table): Add a break - statement after the label ``default''. - - * util/mbchk.c: Include for the prototype of exit. - - * stage2/serial.c (serial_port): Initialize with 0 instead of - -1, as an invalid value, because SERIAL_PORT is unsigned. This - change shouldn't affect anything. - (serial_exists): For the above change, check SERIAL_PORT with 0 - instead of -1. - -2001-12-10 Yoshinori K. Okuji - - * stage2/shared.h (ERR_NO_DISK_SPACE): New constant. - * stage2/common.c (err_list): Added an entry for - ERR_NO_DISK_SPACE. - * docs/grub.texi (Stage2 errors): Added the description. - * stage2/builtins.c (embed_func): Use ERR_NO_DISK_SPACE instead - of ERR_DEV_VALUES when the spare space is too small. Suggested - by Eric Mumpower . - -2001-12-10 Yoshinori K. Okuji - - * grub/asmstub.c: Include . - (grub_stage2) [HAVE_LIBCURSES]: If USE_CURSES is true, ignore - the signal SIGWINCH. Reported by Christian Hudon - . - -2001-11-29 Yoshinori K. Okuji - - From Jason Thomas: - * stage2/disk_io.c (set_partition_hidden_flag): Complete rewrite - of this function which now supports logical partitions. - -2001-11-12 Yoshinori K. Okuji - - * docs/grub.texi: The copyright of this file is only held by - Free Software Foundation, Inc., as Erich Boleyn has assigned his - copyright to the FSF. - * stage1/stage1.S: Likewise. - * stage2/asm.S: Likewise. - * stage2/boot.c: Likewise. - * stage2/builtins.c: Likewise. - * stage2/char_io.c: Likewise. - * stage2/cmdline.c: Likewise. - * stage2/common.c: Likewise. - * stage2/disk_io.c: Likewise. - * stage2/fat.h: Likewise. - * stage2/filesys.h: Likewise. - * stage2/freebsd.h: Likewise. - * stage2/fsys_ext2fs.c: Likewise. - * stage2/fsys_fat.c: Likewise. - * stage2/fsys_ffs.c: Likewise. - * stage2/gunzip.c: Likewise. - * stage2/i386-elf.h: Likewise. - * stage2/mb_header.h: Likewise. - * stage2/mb_info.h: Likewise. - * stage2/pc_slice.h: Likewise. - * stage2/shared.h: Likewise. - * stage2/stage1_5.c: Likewise. - * stage2/stage2.c: Likewise. - * stage2/start.S: Likewise. - -2001-11-07 Yoshinori K. Okuji - - * stage2/builtins.c (terminal_func) [!SUPPORT_SERIAL]: Disable - the wait code, as it is usable only when serial support is on. - Reported by Karl Hammar . - -2001-10-27 Yoshinori K. Okuji - - JFS and XFS support is added. - - From Serguei Tzukanov : - * configure.in (--disable-jfs): New option. - (--disable-xfs): Likewise. - * stage2/Makefile.am (noinst_HEADERS): Added jfs.h and xfs.h. - (libgrub_a_SOURCES): Added fsys_jfs.c and fsys_xfs.c. - (libgrub_a_CFLAGS): Added -DFSYS_JFS=1 and -DFSYS_XFS=1. - (pkgdata_DATA): Added jfs_stage1_5 and xfs_stage1_5. - (noinst_PROGRAMS): Added jfs_stage1_5.exec and - xfs_stage1_5.exec. - (pre_stage2_exec_SOURCES): Added fsys_jfs.c and fsys_xfs.c. - (jfs_stage1_5_exec_SOURCES): New variable. - (jfs_stage1_5_exec_CFLAGS): Likewise. - (jfs_stage1_5_exec_ASFLAGS): Likewise. - (jfs_stage1_5_exec_LDFLAGS): Likewise. - (xfs_stage1_5_exec_SOURCES): Likewise. - (xfs_stage1_5_exec_CFLAGS): Likewise. - (xfs_stage1_5_exec_ASFLAGS): Likewise. - (xfs_stage1_5_exec_LDFLAGS): Likewise. - * stage2/builtins.c (setup_func): Add items for JFS and XFS into - STAGE1_5_MAP. - * stage2/disk_io.c (fsys_table): Added entries for JFS and XFS. - * stage2/filesys.h [FSYS_JFS] (FSYS_JFS_NUM): Set to 1. - [FSYS_JFS] (jfs_mount): Declared. - [FSYS_JFS] (jfs_read): Likewise. - [FSYS_JFS] (jfs_dir): Likewise. - [FSYS_JFS] (jfs_embed): Likewise. - [!FSYS_JFS] (FSYS_JFS_NUM): Set to 0. - [FSYS_XFS] (FSYS_XFS_NUM): Set to 1. - [FSYS_XFS] (xfs_mount): Declared. - [FSYS_XFS] (xfs_read): Likewise. - [FSYS_XFS] (xfs_dir): Likewise. - (NUM_FSYS): Added FSYS_JFS_NUM and FSYS_XFS_NUM. - * stage2/shared.h (STAGE2_ID_JFS_STAGE1_5): New macro. - (STAGE2_ID_XFS_STAGE1_5): Likewise. - [FSYS_JFS] (STAGE2_ID): Set to STAGE2_ID_JFS_STAGE1_5. - [FSYS_XFS] (STAGE2_ID): Set to STAGE2_ID_XFS_STAGE1_5. - * stage2/fsys_jfs.c: New file. - * stage2/fsys_xfs.c: Likewise. - * stage2/jfs.h: Likewise. - * stage2/xfs.h: Likewise. - -2001-10-27 Yoshinori K. Okuji - - * stage2/apm.S: Always disconnect from APM. Written by Erich - Stefan Boleyn. - - * util/Makefile.am (noinst_DATA): Removed. - (EXTRA_DIST): Likewise. - -2001-10-14 Gordon Matzigkeit - - * configure.in: Explicitly call _AM_DEPENDENCIES(CC) for the - benefit of older Autoconfs. - -2001-10-13 Yoshinori K. Okuji - - * netboot/fsys_tftp.c (tftp_read): Move the unused data - forwards, only if AMT is more than zero. If AMT is not positive, - subtract BUF_READ from SAVED_FILEPOS and set BUF_READ to zero, - to skip the whole buffer. Reported by Frank Mehnert. - -2001-10-13 Yoshinori K. Okuji - - Don't use get_diskinfo_floppy. Reported by Ben Liblit - . - - * stage2/asm.S (get_diskinfo_floppy): Removed (by cpp). - * stage2/bios.c (get_diskinfo_floppy): Removed. - (get_diskinfo): Don't call get_diskinfo_floppy any longer. - -2001-10-13 Yoshinori K. Okuji - - Based on a patch from Jeremy Katz : - * docs/grub.texi (Stage2 errors): Added documentation on the - error number 33 (Serial device not configured). - * grub/asmstub.c (serial_exists): New function. - * stage2/serial.c (serial_exists): Likewise. - * stage2/serial.h (serial_exists): New prototype. - * stage2/shared.h (grub_error_t): ERR_NEED_SERIAL is added. - * stage2/builtins.c (terminal_func) [SUPPORT_SERIAL]: If a - serial device is not configured yet, restore the terminal and - set ERRNUM to ERR_NEED_SERIAL. - * stage2/common.c (err_list): Added an item for ERR_NEED_SERIAL. - -2001-10-13 Yoshinori K. Okuji - - From Jason Thomas : - * util/grub-install.in (convert): Add support for DAC960. - - From Adrian Phillips : - * lib/device.c (get_dac960_disk_name): New function. - (init_device_map) [__linux__]: Add support for DAC960. - -2001-10-11 Jochen Hoenicke - - * stage2/fsys_reiserfs.c (reiserfs_super_block): Updated - to better match recent reiserfs versions. - (reiserfs_mount): Handle cases where journal can't be found, - e.g. journal on another disk or unexpected journal parameters. - In that case the journal isn't used. - -2001-10-10 Jochen Hoenicke - - * stage2/fsys_reiserfs.c (reiserfs_mount): Don't look at - the superblock field s_journal_block_count anymore. It used - to contain 0, it never contained a valid value, and now I - have a report that it can contain an invalid value. - Bug reported by Jim Caley . - -2001-09-24 Jochen Hoenicke - - * stage2/fsys_reiserfs.c (reiserfs_dir): Set errnum to - ERR_FSYS_CORRUPT if a symlink can't be read for some reason, - but no error is set by read. - -2001-08-08 OKUJI Yoshinori - - From Derrik Pates : - * stage2/asm.S [!STAGE1_5] (grub_halt): Set the level of APM - support to 1.1, before turning off the power state. - -2001-08-08 OKUJI Yoshinori - - * util/grub-md5-crypt.in: Prefix backquotes with backslashes in - strings. From Fernando Silveira. - -2001-08-02 Gordon Matzigkeit - - * stage2/common.c (init_bios_info): Ignore zero-length memory - ranges. From Derrik Pates . - -2001-07-26 Jochen Hoenicke - - * stage2/Makefile.am (libgrub_a_CFLAGS): Enable USE_MD5_PASSWORDS - for libgrub. Previously that was implicitly done by configure.in - until the patch from 2001-07-04, which moved that flag from CFLAGS - to FSYS_CFLAGS. Reported by YAMAGUCHI Shingo - - -2001-07-13 OKUJI Yoshinori - - * util/grub-install.in (convert): Recognize the naming scheme - for Linux devfs floppy devices. Reported by Jason Thomas - . - -2001-07-07 OKUJI Yoshinori - - * netboot/compile: New file. This was also missing... How many - ``compile''s does automake want? - -2001-07-07 OKUJI Yoshinori - - From Jan Zerebecki : - * acinclude.m4 (grub_DEFINE_FILE): Escape double-quotations as - well. - -2001-07-05 OKUJI Yoshinori - - * configure.in (AM_INIT_AUTOMAKE): Set the version number to - 0.90. - -2001-07-05 OKUJI Yoshinori - - Ughh! I forgot to add this file to the CVS. - - * docs/compile: New file. - -2001-07-05 OKUJI Yoshinori - - * docs/grub.texi: Updated. - -2001-07-05 OKUJI Yoshinori - - * stage2/boot.c (load_initrd) [!NO_DECOMPRESSION]: Set - NO_DECOMPRESSION to one before opening INITRD, so that GRUB - doesn't decompress an initrd automatically. Reported by - Thierry Laronde. - -2001-07-04 OKUJI Yoshinori - - * stage2/compile: New file. - * docs/mdate-sh: Likewise. - * docs/texinfo.tex: Likewise. - * compile: Removed. - * mdate-sh: Likewise. - * texinfo.tex: Likewise. - * config.guess: Updated from automake-1.4h. - * config.sub: Likewise. - * depcomp: Likewise. - * install-sh: Likewise. - * missing: Likewise. - * mkinstalldirs: Likewise. - * configure.in (AS): New variable. - (ASFLAGS): Likewise. - (--disable-md5-password): Use FSYS_CFLAGS instead of CFLAGS. - * stage1/Makefile.am (AM_CFLAGS): Renamed to ... - (AM_ASFLAGS): ... this. - * stage2/Makefile.am (pre_stage2_exec_ASFLAGS): New variable. - (start_exec_CFLAGS): Renamed to ... - (start_exec_ASFLAGS): ... this. - (start_exec-start.o): Renamed to ... - (start_exec-start.$(OBJEXT)): ... this. - (e2fs_stage1_5_exec_ASFLAGS): New variable. - (fat_stage1_5_exec_ASFLAGS): Likewise. - (ffs_stage1_5_exec_ASFLAGS): Likewise. - (minix_stage1_5_exec_ASFLAGS): Likewise. - (reiserfs_stage1_5_exec_ASFLAGS): Likewise. - (vstafs_stage1_5_exec_ASFLAGS): Likewise. - (diskless_exec_ASFLAGS): Likewise. - (nbloader_exec_CFLAGS): Renamed to ... - (nbloader_exec_ASFLAGS): ... this. - (nbloader_exec-nbloader.o): Renamed to ... - (nbloader_exec-nbloader.$(OBJEXT)): ... this. - (pxeloader_exec_CFLAGS): Renamed to ... - (pxeloader_exec_ASFLAGS): ... this. - (pxeloader_exec-pxeloader.$(OBJEXT)): New target. - -2001-07-03 OKUJI Yoshinori - - From Julien Bordet : - * stage2/i386-elf.h (Elf32_Shdr): New type. - * stage2/boot.c (load_image): Added ELF symbol loading support. - -2001-06-22 OKUJI Yoshinori - - * stage2/char_io.c [STAGE1_5] (grub_strcmp): Defined, even - for Stage 1.5. See thecomment, for a possible future strategy. - * stage2/fsys_vstafs.c [!FSYS_VSTAFS]: Don't define anything. - [STAGE1_5] (grub_strcmp): Removed. - (get_file_info): Made static. - (vstafs_readdir): Likewise. - (vstafs_nextdir): Likewise. - (curr_ext): Likewise. - (current_direntry): Likewise. - (current_blockpos): Likewise. - (a): Likewise. - -2001-06-22 OKUJI Yoshinori - - VSTa filesystem support is added. - - From Kristoffer Brånemyr : - * stage2/configure.in (--disable-vstafs): New option. - * stage2/Makefile.am (noinst_HEADERS): Added vstafs.h. - (libgrub_a_SOURCES): Added fsys_vstafs.c. - (libgrub_a_CFLAGS): Added -DFSYS_VSTAFS=1. - (pkgdata_DATA): Added vstafs_stage1_5. - (noinst_PROGRAMS): Added vstafs_stage1_5.exec. - (pre_stage2_exec_SOURCES): Added fsys_vstafs.c. - (vstafs_stage1_5_exec_SOURCES): New variable. - (vstafs_stage1_5_exec_CFLAGS): Likewise. - (vstafs_stage1_5_exec_LDFLAGS): Likewise. - * stage2/disk_io.c (fsys_table): Added an entry for vstafs. - * stage2/filesys.h [FSYS_VSTAFS] (FSYS_VSTAFS_NUM): Defined as - 1. - [FSYS_VSTAFS] (vstafs_mount): New prototype. - [FSYS_VSTAFS] (vstafs_read): Likewise. - [FSYS_VSTAFS] (vstafs_dir): Likewise. - [!FSYS_VSTAFS] (FSYS_VSTAFS_NUM): Defined as 0. - (NUM_FSYS): Added FSYS_VSTAFS_NUM. - * stage2/pc_slice.h (PC_SLICE_TYPE_VSTAFS): New macro. - * stage2/shared.h (STAGE2_ID_VSTAFS_STAGE1_5): Likewise. - [STAGE1_5 && FSYS_VSTAFS] (STAGE2_ID): Defined as - STAGE2_ID_VSTAFS_STAGE1_5. - * stage2/vstafs.h: New file. - * stage2/fsys_vstafs.c: Likewise. - -2001-06-22 OKUJI Yoshinori - - From Thierry Laronde : - * stage2/builtins.c (configfile_func): Added a prototype. - (bootp_func): If `--with-configfile' is given, set - WITH_CONFIGFILE to one, and call configfile_func with - CONFIG_FILE. - -2001-06-21 OKUJI Yoshinori - - * docs/grub.texi: Update the location of the CVS repository - [/home/cvs -> /cvsroot/grub]. - * README: Likewise. - -2001-06-19 OKUJI Yoshinori - - * stage2/boot.c (load_image): If the image is a Multiboot ELF OS - image, get the physical entry address, when a loaded memory - segment contains it. And, set ENTRY_ADDR to it, after printing - out the virtual one. Suggested by Rogelio M. Serrano Jr. - . - -2001-05-30 OKUJI Yoshinori - - * docs/grub.texi: Fix some typos. Reported by Florian Hatat - . - -2001-05-29 Pavel Roskin - - * configure.in (AC_OUTPUT): Remove debian/Makefile. - -2001-05-28 Gordon Matzigkeit - - * Makefile.am (SUBDIRS): Remove reference to debian directory. - Packaging is no longer done by the GRUB team. - -2001-05-03 Gordon Matzigkeit - - * stage1/stage1.S (nt_magic): Explicitly reserve space for the NT - magic number. - -2001-05-25 Klaus Reichl - - * stage2/stage2.c (print_entries_raw): New function. - (run_menu): Use it to implement menu & command-list if on dumb - terminals. - Changes are: - Adjust FIRST_ENTRY only on non-dumb terminals. - Setting of SHOW_MENU is honoured also on dumb - terminals. - Likely if SHOW_MENU is false, ESC brings her to the - menu - not to the command-line as before. - PRINT_BORDER, GOTOXY, SET_LINE_xxx are only called if - not on dumb terminals. - Show entry number when timeout is running if terminal is dumb. - Prompt with entry number when waiting for keys. - -2001-05-14 Pavel Roskin - - * stage2/shared.h (ENTRY): Remove unnecessary `##'. - -2001-05-03 Jochen Hoenicke - - * grub/asmstub.c (biosdisk): Work around a bug in linux's ez - remapping. Problem reported by Ben Byer . - -2001-03-28 Gordon Matzigkeit - - * stage2/boot.c (load_image): Don't cast entry_addr to an int, or - the top bit will be interpreted as the sign. - -2001-03-16 OKUJI Yoshinori - - From Bodo Rueskamp : - * stage2/boot.c (load_initrd): Avoid the last 64kb for - Linux 2.2.x bug. - -2001-03-03 OKUJI Yoshinori - - * docs/multiboot.texi (History): Written. - -2001-02-28 OKUJI Yoshinori - - From HASEGAWA Tomoki : - * lib/device.c (get_ide_disk_name) [__FreeBSD__]: Add support - for FreeBSD-4.0 or later. Use "/dev/rad0". - * util/grub-install.in (convert): Add code for FreeBSD - disklabels. - -2001-02-28 OKUJI Yoshinori - - From Thierry Laronde : - * stage2/stage2.c (cmain): If the default entry is wrong, set it - to FALLBACK_ENTRY if FALLBACK_ENTRY is valid, otherwise set it - to zero. Suggested by Nicolas Boos . - -2001-02-28 OKUJI Yoshinori - - * acconfig.h (AUTO_LINUX_MEM_OPT): New entry. - * configure.in (--disable-auto-linux-mem-opt): New option. - * stage2/builtins.c (kernel_func) [!AUTO_LINUX_MEM_OPT]: Add - KERNEL_LOAD_NO_MEM_OPTION into LOAD_FLAGS, whether the user - specifies --no-mem-option or not. - -2001-02-27 OKUJI Yoshinori - - * stage2/builtins.c (chainloader_func): Don't check if the - current partition is FAT, but check if it has a FAT partition - type and the BPB has a system id starting with "MSWIN". - -2001-02-27 OKUJI Yoshinori - - Added hercules support based on a patch by Frank Mehnert - . I translated his assembly code into - C, and separated hercules from the normal console. - - * configure.in (--disable-hercules): New option. - - * grub/asmstub.c: Include . - (set_attrib): Renamed to ... - (console_set_attrib): ... this. - (herc_cls): New function. - (herc_getxy): Likewise. - (herc_gotoxy): Likewise. - (herc_putchar): Likewise. - (herc_set_attrib): Likewise. - - * stage2/Makefile.am (noinst_HEADERS): Added hercules.h. - (libgrub_a_CFLAGS): Added -DSUPPORT_HERCULES=1. - (HERCULES_FLAGS): New variable. - (STAGE2_COMPILE): Added $(HERCULES_FLAGS). - (pre_stage2_exec_SOURCES): Added hercules.c. - * stage2/asm.S [!STAGE1_5] (set_attrib) Renamed to ... - [!STAGE1_5] (console_set_attrib): ... this. - * stage2/builtins.c [SUPPORT_HERCULES] (terminal_func): Added - hercules support. - (builtin_table) [SUPPORT_HERCULES]: Added a pointer to - BUILTIN_TERMINAL. - * stage2/char_io.c [SUPPORT_HERCULES]: Include . - [!STAGE1_5] (get_cmdline) [SUPPORT_HERCULES]: Added hercules - support. - [!STAGE1_5] (getkey) [SUPPORT_HERCULES]: Likewise. - [!STAGE1_5] (checkkey) [SUPPORT_HERCULES]: Likewise. - (grub_putchar) [SUPPORT_HERCULES]: Likewise. - [!STAGE1_5] (gotoxy) [SUPPORT_HERCULES]: Likewise. - [!STAGE1_5] (getxy) [SUPPORT_HERCULES]: Likewise. - [!STAGE1_5] (cls) [SUPPORT_HERCULES]: Likewise. - (set_attrib): New function. - * stage2/shared.h (console_set_attrib): Declared. - (TERMINAL_HERCULES): New macro. - * stage2/stage2.c (run_menu) [SUPPORT_HERCULES]: Added hercules - support. - * stage2/hercules.h: New file. - * stage2/hercules.c: Likewise. - -2001-02-17 OKUJI Yoshinori - - From "Treutwein; Bernhard" - : - * docs/grub.texi (DOS/Windows): Improved the readability. - -2001-02-11 OKUJI Yoshinori - - * docs/grub.texi (Command-line and menu commands): Renamed to ... - (General commands): ... this. - -2001-02-08 OKUJI Yoshinori - - * stage2/asm.S [STAGE1_5] (chain_stage2): Save the second sector - of stage2 in %ecx temporarily, and set %ebp to %ecx after - switching to protected mode. I forgot that %ebp is broken by - rot_to_real. Reported by Torvald Riegel - . - -2001-02-08 OKUJI Yoshinori - - * docs/grub-new.texi: Moved to ... - * docs/grub.texi: ... here. And, include internals.texi. - * docs/internals.texi: New file. - * docs/prog-ref.texi: Removed. - * docs/user-ref.texi: Likewise. - * docs/tutorial.texi: Likewise. - * docs/appendices.texi: Likewise. - * docs/Makefile.am (grub_TEXINFOS): Removed prog-ref.texi, - user-ref.texi, tutorial.texi, and appendices.texi. Added - internals.texi. - -2001-02-03 OKUJI Yoshinori - - From Erik Schoenfelder : - * stage2/shared.h (LINUX_INITRD_MAX_ADDRESS): Changed from - 0x3C000000 to 0x38000000. - -2001-02-03 OKUJI Yoshinori - - * stage2/builtins.c (savedefault_func) - [!SUPPORT_DISKLESS && !GRUB_UTIL]: Check if the version - contained in the buffer matches to current one as well. - -2001-02-02 OKUJI Yoshinori - - * stage2/builtins.c (savedefault_func) - [!SUPPORT_DISKLESS && !GRUB_UTIL]: Check if the stage2 id is - STAGE2_ID_STAGE2. Suggested by Jochen Hoenicke. - - * stage2/stage2.c (cmain): If DEFAULT_ENTRY is out of entries, - reset DEFAULT_ENTRY to zero. - -2001-02-02 OKUJI Yoshinori - - Make savedefault workable even with Stage 1.5. Reported by - Thierry Laronde . - - * grub/asmstub.c (chain_stage2): Added an additional argument, - SECOND_SECTOR. - * stage2/asm.S [STAGE1_5] (chain_stage2): Set %ebp to - SECOND_SECTOR. - * stage2/disk_io.c [STAGE1_5] (disk_read_hook): Defined. - [STAGE1_5] (disk_read_func): Likewise. - (rawread) [STAGE1_5]: Handle DISK_READ_FUNC. - (grub_read) [STAGE1_5]: Likewise. - * stage2/fsys_ext2fs.c (ext2fs_read) [STAGE1_5]: Likewise. - * stage2/fsys_fat.c (fat_read) [STAGE1_5]: Likewise. - * stage2/fsys_ffs.c (ffs_read) [STAGE1_5]: Likewise. - * stage2/fsys_minix.c (minix_read) [STAGE1_5]: Likewise. - * stage2/fsys_reiserfs.c (reiserfs_read) [STAGE1_5]: Likewise. - -2001-02-02 OKUJI Yoshinori - - * netboot/config.c [GRUB && INCLUDE_PCI] (pci_dispatch_table): - New structure. - [GRUB && INCLUDE_PCI] (PCI_NIC): New variable. - (eth_probe) [GRUB && INCLUDE_PCI]: If a PCI NIC candidate is - present, probe it first. - -2001-01-27 OKUJI Yoshinori - - From Danilo Godec : - * stage2/pc_slice.h (PC_SLICE_TYPE_LINUX_RAID): New macro. - * stage2/fsys_ext2fs.c (ext2fs_mount): Add a check for - PC_SLICE_LINUX_RAID. - -2001-01-27 OKUJI Yoshinori - - From Bernhard Treutwein - : - * docs/grub-new.texi (DOS/Windows): Made more readable. - -2001-01-27 OKUJI Yoshinori - - * docs/multiboot.texi: Start reorganizing Multiboot - Specification. - -2001-01-15 OKUJI Yoshinori - - From Thierry Laronde : - * docs/user-ref.texi (Command-line and menu commands): Update - the description about setkey. - * stage2/builtins.c (setkey_func): When checking if TO_KEY and - FROM_KEY are specified, see *TO_KEY and *FROM_KEY instead of - TO_KEY and FROM_KEY, respectively. - -2001-01-13 OKUJI Yoshinori - - From Thierry Laronde : - * util/grub-md5-crypt.in (prefix): New variable. - (exec_prefix): Likewise. - (sbindir): Likewise. - -2001-01-12 OKUJI Yoshinori - - * docs/multiboot.h [__ELF__] (MULTIBOOT_HEADER_FLAGS): Defined - as 0x00000003 instead of 0x00010003. - * docs/boot.S (multiboot_header) [__ELF__]: Don't define a.out - kludge information. - - * docs/Makefile.am (EXTRA_PROGRAMS): New variable. - [BUILD_EXAMPLE_KERNEL] (noinst_DATA): Removed. - [BUILD_EXAMPLE_KERNEL] (noinst_PROGRAMS): Changed to kernel. - [BUILD_EXAMPLE_KERNEL] (kernel_exec_SOURCES): Renamed to ... - [BUILD_EXAMPLE_KERNEL] (kernel_SOURCES): ... this. - [BUILD_EXAMPLE_KERNEL] (kernel_exec_CFLAGS): Renamed to ... - [BUILD_EXAMPLE_KERNEL] (kernel_CFLAGS): ... this. - [BUILD_EXAMPLE_KERNEL] (kernel_exec_LDFLAGS): Renamed to ... - [BUILD_EXAMPLE_KERNEL] (kernel_LDFLAGS): ... this. - [BUILD_EXAMPLE_KERNEL] (kernel): Removed. - [BUILD_EXAMPLE_KERNEL] (boot.o): New dependency. - (CLEANFILES): New variable. - -2001-01-11 OKUJI Yoshinori - - * stage2/builtins.c [SUPPORT_NETBOOT] (ifconfig_func): Always - print current network configuration. - [SUPPORT_NETBOOT] (tftpserver_func): Use ifconfig instead of - arp_server_override. - * netboot/main.c (arp_server_override): Removed. - * netboot/etherboot.h (arp_server_override): Likewise. - -2001-01-11 Eugene Doudine - - * stage2/builtins.c [SUPPORT_NETBOOT] (ifconfig_func): New - function to configure network interface from command line. - [SUPPORT_NETBOOT] (builtin_ifconfig): New variable. - [SUPPORT_NETBOOT] (builtin_table): Added a pointer to - BUILTIN_IFCONFIG. - * netboot/main.c (ifconfig): New function. - * netboot/etherboot.h (ifconfig): Added the prototype. - -2001-01-11 OKUJI Yoshinori - - * docs/Makefile.am [BUILD_EXAMPLE_KERNEL] (noinst_DATA): New - variable. - [BUILD_EXAMPLE_KERNEL] (noinst_PROGRAMS): Likewise. - [BUILD_EXAMPLE_KERNEL] (kernel_exec_SOURCES): Likewise. - [BUILD_EXAMPLE_KERNEL] (kernel_exec_CFLAGS): Likewise. - [BUILD_EXAMPLE_KERNEL] (kernel_exec_LDFLAGS): Likewise. - [BUILD_EXAMPLE_KERNEL] (kernel): New target. - * configure.in (--enable-example-kernel): New option. - - * docs/kernel.c (cmain): Cast unsigned long variables to - unsigned explicitly, to suppress GCC warnings. - -2001-01-08 OKUJI Yoshinori - - * stage2/shared.h (BOOTSEC_BPB_HIDDEN_SECTORS): New macro. - - * stage2/builtins.c (chainloader_func): If CURRENT_PARTITION is - FAT, set the hidden sectors field of the BPB to PART_START, to - avoid a Windows bug which affects only when Windows is booted - from a logical partition. And, clear ERRNUM after testing if a - partition is FAT, because open_partition or fat_mount may set - ERRNUM. Reported by Ingo Korb . - -2001-01-07 OKUJI Yoshinori - - * stage2/builtins.c (boot_func): In the chain-loading mode, - clear the active flag of each of the loaded partition entries, - and then set the active flag of the booted partition image. - -2001-01-04 Jochen Hoenicke - - * stage2/builtins.c (embed_func): Call open_partition() even for - MBR, so that part_start is correct. This fixes a bug reported by - Matthias Granberry . - -2000-12-22 OKUJI Yoshinori - - * stage2/disk_io.c (make_saved_active): Change the variable name - ``MBR'' to lower case. - (set_partition_hidden_flag): Likewise. - -2000-12-20 Jochen Hoenicke - - From Cedric Ware : - * stage2/fsys_ext2.c (ext2fs_mount): Detect ext2 partitions in - a OpenBSD/NetBSD FS_EXT2FS slice. - * stage2/pc_slice.h (FS_ADOS): New Macro from OpenBSD/NetBSD. - (FS_HFS): Likewise. - (FS_FILECORE): Likewise. - (FS_EXT2FS): Likewise. - -2000-12-17 Jochen Hoenicke - - * stage2/disk_io.c (rawread): Check if there is a EZD partition - and remap sector 0 to sector 1 like EZ-BIOS does. - (rawwrite): New function to write to disk. Also does EZD - remapping. - (devwrite): New function. Does the special remapping to - partitions needed for linux. This contains the code that was - previously duplicated in embed_func and install_func at several - places. - (make_saved_active): Use rawwrite. Don't use SCRATCHSEG, as it is - needed by devwrite. - (set_partition_hidden_flag): Likewise. - * stage2/disk_io.h (rawwrite): New function. - (devwrite): Likewise. - * stage2/pc_slice.h (PC_SLICE_TYPE_EZD): New macro. - * stage2/builtins.c (embed_info): New variable to store the - position of the embedded stage1_5 for setup_func. - (embed_func): Don't embed after the MBR if an EZ-BIOS is detected - there. Use the new devwrite method. If embedding is successful - store position in embed_info. - (install_func): Use devwrite. Don't use SCRATCHSEG. - (partnew_func): Use rawwrite. Don't use SCRATCHSEG. - (parttype_func): Likewise. - (savedefault_func): Likewise. - (setup_func): New nested function embed_stage1_5. Stage1_5 is now - also be embedded into filesystems which supports that. - -2000-12-17 OKUJI Yoshinori - - * stage2/builtins.c (chainloader_func): Set ERRNUM to - ERR_EXEC_FORMAT, when ERRNUM is ERR_NONE, even if grub_read - fails in reading one sector. - -2000-12-14 OKUJI Yoshinori - - * docs/prog-ref.texi (Partition types): Rewrite the footnotes. - Suggested by Ralf.Medow@t-online.de (Ralf Medow). - -2000-12-14 OKUJI Yoshinori - - From Erik Schoenfelder : - * util/grub-install.in (convert): Revised the fix for floppy - device handling. - -2000-12-14 OKUJI Yoshinori - - From HORIKAWA Kazunori : - * stage2/bios.c (get_diskinfo): Append 16 bytes dummy data to - DRP, because the BIOS of Thinkpad X20 write a garbage beyond the - size of the structure. - -2000-12-09 Jochen Hoenicke - - * stage2/disk_io.c (next_partition): Mask out bsd partition sub - type when checking if last partition was a bsd partition. - Reported by Heikki Vatiainen . - -2000-12-09 OKUJI Yoshinori - - From Leendert Meyer : - * util/grub-install.in (convert): If a floppy device is - specified, remove everything from $tmp_part. - -2000-12-09 OKUJI Yoshinori - - * lib/device.c [__linux__] (write_to_partition): Use strcpy - instead of strcat, to overwrite "/disc". Reported by Thiago - Macieira . - -2000-12-05 Jochen Hoenicke - - * stage2/fsys_minix.c (minix_mount): Corrected the check for - IS_PC_SLICE_TYPE_MINIX; minix was only working if slice type was - wrong! Reported by Ralf Medow . - -2000-11-27 Jochen Hoenicke - - * stage2/fsys_reiserfs.c: Handle items with old version key on - new version reiserfs partition. - (K_OFFSET): Removed. - (IH_KEY_OFFSET): New Macro, which checks item head version. - (IH_KEY_ISOFFSET): Likewise. - (reiserfs_read): Use new macros. - (reiserfs_dir): Fixed version check for >4GB stat entries. - -2000-11-27 OKUJI Yoshinori - - * stage2/common.c (init_bios_info) [!STAGE1_5]: Don't call - track_int13, because the current implementation hangs up in some - environments. - -2000-11-27 OKUJI Yoshinori - - * grub/asmstub.c (serial_init) [!O_SYNC]: Don't specify O_SYNC - to open SERIAL_DEVICE. - (serial_init) [O_FSYNC]: Specify O_FSYNC to open SERIAL_DEVICE. - Reported by Farid Hajji . - -2000-11-22 OKUJI Yoshinori - - From Vesa Jaaskelainen : - * stage2/builtins.c (testvbe_func): Don't set the bit 14 of a - VBE mode number explicitly when calling get_vbe_mode_info. - (vbeprobe_func): Likewise. - -2000-11-22 OKUJI Yoshinori - - The code for the "INT 13H tracking technique" is somewhat - simplified. - - * stage2/asm.S [!STAGE1_5] (track_int13): Don't replace an int13 - handler with set_tf_int13_handler. Instead, track_int13 itself - emulates an int13 interrupt. - [!STAGE1_5] (set_tf_int13_handler): Removed. - [!STAGE1_5] (int1_handler): Use movzbw instead of xorb and movb. - -2000-11-15 OKUJI Yoshinori - - * acconfig.h (PRESET_MENU_STRING): New entry. - * acinclude.m4 (grub_DEFINE_FILE): New M4 macro. - * configure.in (--enable-preset-menu): New option. - * stage2/stage2.c [PRESET_MENU_STRING] (preset_menu): New - variable. - [PRESET_MENU_STRING] (preset_menu_offset): Likewise. - [PRESET_MENU_STRING] (open_preset_menu): New function. - [PRESET_MENU_STRING] (read_from_preset_menu): Likewise. - [PRESET_MENU_STRING] (close_preset_menu): Likewise. - [!PRESET_MENU_STRING] (open_preset_menu): New macro. - [!PRESET_MENU_STRING] (read_from_preset_menu): Likewise. - [!PRESET_MENU_STRING] (close_preset_menu): Likewise. - (get_line_from_config): Accept a new argument READ_FROM_FILE. - If it is false, read data from the preset menu instead. - (cmain): If grub_open fails in opening the configuration file, - then try to open the preset menu. - -2000-11-11 OKUJI Yoshinori - - From Jan Fricke : - * stage2/asm.S [!STAGE1_5] (set_vbe_mode): Add a missing `$' - prefix. - -2000-11-11 OKUJI Yoshinori - - * stage2/bios.c (get_diskinfo): If BIOS supports LBA but doesn't - return the correct total number of sectors, compute this by - C/H/S returned by get_diskinfo_int13_extensions instead of - get_diskinfo_standard. - -2000-11-09 OKUJI Yoshinori - - * stage2/disk_io.c (make_saved_active): Set ERRNUM to - ERR_DEV_VALUES instead of ERR_NO_PART, when the save partition - is not a primary partition. - -2000-11-05 OKUJI Yoshinori - - * docs/user-ref.texi (Features): Update the URL of grub/98. - -2000-11-03 OKUJI Yoshinori - - VBE support is _partially_ implemented. - - * stage2/mb_header.h (multiboot_header): Added new fields, - mode_type, width, height, and depth. - (MULTIBOOT_FOUND): Check if MULTIBOOT_VIDEO_MODE is set, and - check if LEN is greater than or equal to 48, if set. - (MULTIBOOT_UNSUPPORTED): Set to 0x0000FFF8. - (MULTIBOOT_VIDEO_MODE): New macro. - * stage2/mb_info.h (multiboot_info): Added new fields, - vbe_control_info, vbe_mode_info, vbe_mode, vbe_interface_seg, - vbe_interface_off, and vbe_interface_len. - (MB_INFO_VIDEO_INFO): New macro. - - * stage2/shared.h (vbe_controller): New structure. - (vbe_mode): Likewise. - (get_vbe_controller_info): Declared. - (get_vbe_mode_info): Likewise. - (set_vbe_mode): Likewise. - * stage2/asm.S [!STAGE1_5] (get_vbe_controller_info): New - function. - [!STAGE1_5] (get_vbe_mode_info): Likewise. - [!STAGE1_5] (set_vbe_mode): Likewise. - * grub/asmstub.c (get_vbe_controller_info): Likewise. - (get_vbe_mode_info): Likewise. - (set_vbe_mode): Likewise. - - * stage2/builtins.c (testvbe_func): New function. - (builtin_testvbe): New variable. - (vbeprobe_func): New function. - (builtin_vbeprobe): New variable. - (builtin_table): Added pointers to BUILTIN_TESTVBE and - BUILTIN_VBEPROBE. - -2000-11-01 OKUJI Yoshinori - - * docs/help2man: Copied from help2man-1.23. - -2000-10-29 OKUJI Yoshinori - - * stage2/asm.S [STAGE1_5]: Don't include setjmp.S or apm.S. - -2000-10-27 OKUJI Yoshinori - - * lib/device.c (read_device_map): Don't parse a line, if it is - empty. Reported by Holger Bauer . - -2000-10-25 Jochen Hoenicke - - * stage2/builtins.c (md5crypt_func): Use all bits of currticks () - to generate the salt. The old code would often produce the same - one character salt. - -2000-10-25 OKUJI Yoshinori - - * stage2/apm.S (get_apm_info): Fix a serious typo: prot_to_real - -> real_to_prot. Umm, I can't understand why it worked for me! - -2000-10-24 Jochen Hoenicke - - * stage2/builtins.c (setup_func): When invoking install with an - embedded stage1_5 give the path to menu.lst as real_config_file. - -2000-10-23 OKUJI Yoshinori - - * docs/multiboot.texi: Upgraded to 0.6.92. - (Boot information format): Re-designed the graphics table. - -2000-10-22 OKUJI Yoshinori - - * docs/tutorial.texi: Miscellaneous updates. - * docs/user-ref.texi: Likewise. - * docs/appendices.texi: Likewise. - -2000-10-22 OKUJI Yoshinori - - * util/grub-install.in (usage): Removed unnecessary commas. - - * util/grub-md5-crypt.in: New file. - * util/Makefile.am (sbin_SCRIPTS): Added grub-md5-crypt. - * configure.in (AC_OUTPUT): Added util/grub-md5-crypt. - * docs/Makefile.am (man_MANS): Added grub-md5-crypt.8. - [MAINTAINER_MODE] ($(srcdir)/grub-md5-crypt.8): New target. - * docs/grub-md5-crypt.8: New file. Generated by help2man. - - * docs/grub.texi (grub-md5-crypt): New direntry. - (Invoking grub-md5-crypt): New entry. - * docs/user-ref.texi (Invoking grub-md5-crypt): New chapter. - -2000-10-22 OKUJI Yoshinori - - From Matthias Granberry : - * util/grub-install.in (convert): Added backslashes into - continuous lines. - -2000-10-21 OKUJI Yoshinori - - * stage2/md5.c (check_md5_password): Removed. - (md5_password): New function. Mostly copied from - check_md5_password. - (md5_init): Made static. - (md5_update): Likewise. - (md5_final): Likewise. - * stage2/md5.h (check_md5_password): Changed to just a macro. - (md5_password): Declared. - (make_md5_password): New macro. - * stage2/char_io.c [!STAGE1_5] (grub_strstr): Rewriten, because - it was too buggy. - * stage2/builtins.c [USE_MD5_PASSWORDS] (md5crypt_func): New - function. - [USE_MD5_PASSWORDS] (builtin_md5crypt): New variable. - (builtin_table) [USE_MD5_PASSWORDS]: Added a pointer to - BUILTIN_MD5CRYPT. - * docs/tutorial.texi (Security): Added a paragraph about - md5crypt. - -2000-10-21 OKUJI Yoshinori - - * docs/user-ref.texi: Fixed several typos and some inappropriate - texinfo commands, and update the descriptions about some - commands. - -2000-10-20 OKUJI Yoshinori - - * stage2/builtins.c (displayapm_func): New function. - (builtin_displayapm): New variable. - (builtin_table): Added a pointer to BUILTIN_DISPLAYAPM. - -2000-10-20 OKUJI Yoshinori - - APM BIOS table support is added, based on a patch by Matt Yourst - . - - * docs/multiboot.texi (Boot information format): Added the - definition of APM table format. - - * stage2/mb_info.h (apm_info): New structure. - (multiboot_info): Added a new element, apm_table. - (MB_INFO_APM_TABLE): New macro. - * stage2/asm.S (apm_bios_info): New variable. - Include "apm.S". - * stage2/apm.S: New file. - * stage2/common.c (init_bios_info) [!STAGE1_5]: Added APM BIOS - table support. - * stage2/shared.h (apm_bios_info): Declared. - (get_apm_info): Likewise. - * stage2/Makefile.am (EXTRA_DIST): Added apm.S. - * grub/asmstub.c (apm_bios_info): New variable. - (get_apm_info): New function. - -2000-10-19 OKUJI Yoshinori - - Segregate functions which are copyrighted differently. - - * stage2/setjmp.S: New file. - * stage2/Makefile.am (EXTRA_DIST): Added setjmp.S. - * stage2/asm.S: Include "setjmp.S". - (grub_setjmp): Moved to ... - * stage2/setjmp.S (grub_setjmp): ... here. - * stage2/asm.S (grub_longjmp): Moved to ... - * stage2/setjmp.S (grub_longjmp): ... here. - -2000-10-18 OKUJI Yoshinori - - * stage2/Makefile.am (noinst_HEADERS): Added md5.h. Reported by - Volker Augustin . - -2000-10-17 OKUJI Yoshinori - - * configure.in (--disable-md5password): Renamed to ... - (--disable-md5-password): ... this. Just for my preference. - -2000-10-17 Jochen Hoenicke - - Added MD5 passwords and extended password command: - - * configure.in (--disable-md5password): New option. - * stage2/Makefile.am (libgrub_a_SOURCES): Added md5.c. - (pre_stage2_exec_SOURCES): Likewise. - * stage2/md5.c: New file. - * stage2/shared.h (password_t): New type. - (password_type): New variable. - (BUILTIN_HIDDEN): New flag, describing that a command should not - be printed when booting the entry. - (check_password): New function. - * stage2/cmdline.c (run_script): Don't show commands that have - the hidden attribute. - * stage2/builtins.c (password_type): New variable. - (check_password): New function. - (password_func): Handle the --md5 option and set password_type. - Check if in CMDLINE or SCRIPT mode and ask password immediately. - (builtin_password): Also allow passwords in CMDLINE mode, make - it hidden, so the user wont see the password he should enter. - Changed command description. - (builtin_pause): Make the command hidden. - (pause_func): Print argument, since the command is now hidden. - * stage2/stage2.c (run_menu): Call check_password to check password. - * docs/tutorial.texi (Security): Describe the new features of the - password commands. - * docs/user-ref.texi (Menu-specific commands): password command - moved ... - (Command-line and menu commands): ... to here. New features - doumented. - -2000-10-17 OKUJI Yoshinori - - * stage2/builtins.c (setkey_func): Clear the all elements of - BIOS_KEY_MAP and ASCII_KEY_MAP instead of only the first - elements, when TO_KEY is NULL. - -2000-10-16 OKUJI Yoshinori - - * stage2/boot.c (load_image): When handling Linux cmdline, don't - copy a null character from SRC to DEST, because this inserted an - extra null character into the cmdline. Reported by Robert - Bihlmeyer . - -2000-10-16 OKUJI Yoshinori - - Some of the new Multiboot features are supported. APM support - and VESA support are not strictly defined or implemented yet. - - * docs/multiboot.texi (Top): Increase the version number. - (Boot information format): Changed the drive information format, - because it was not straightforward. - - * grub/asmstub.c (io_map): New variable. - (track_int13): New function. - (get_rom_config_table): Likewise. - * stage2/stage2.c (cmain): Set CONFIG_ENTRIES to MBI.DRIVES_ADDR - + MBI.DRIVES.LENGTH instead of MBI.MMAP_ADDR + MBI.MMAP_LENGTH. - * stage2/common.c (init_bios_info) [!STAGE1_5]: Added support - for drive info, ROM config table, and boot loader name features - of the Multiboot Specification. - * stage2/mb_info.h (drive_info): New structure. - (MB_DI_CHS_MODE): New macro. - (MB_DI_LBA_MODE): Likewise. - (multiboot_info): Added drives_length, drives_addr, - config_table, and boot_loader_name. - (MB_INFO_DRIVE_INFO): New macro. - (MB_INFO_CONFIG_TABLE): Likewise. - (MB_INFO_BOOT_LOADER_NAME): Likewise. - * stage2/asm.S (get_rom_config_table): New function. - * stage2/shared.h (get_rom_config_table): Declared. - -2000-10-16 OKUJI Yoshinori - - * util/grub-install.in (convert): Check only if the file exists, - instead of checking if the file is a block device as well. - Because, in a sane operating system, it should be a char device - but not a block device (unlike Linux), and it may be a symbolic - link (this can happen if you use Linux's devfs without devfsd). - (recheck): New variable. Set to "no" by default, and set to - "yes", if you specify the new option ``--recheck''. If $recheck - is "yes", remove the device map file, if present. - -2000-10-16 OKUJI Yoshinori - - From Roderich Schupp: - * lib/device.c: Include . - [__linux__] (have_devfs): New function. - (get_floppy_disk_name) [__linux__]: If devfs is supported, use - the name "/dev/floppy/N" instead. - (init_device_map) [__linux__]: If devfs is supported, use - "/dev/discs/discN" instead. - [__linux__] (write_to_partition): Change the size of DEV to - PATH_MAX instead of 64. - If devfs is supported, replace "/disc" in the device name with - "/part". - -2000-10-15 OKUJI Yoshinori - - From Roderich Schupp : - * util/grub-install.in (convert): Added support for "native" - devfs device names. - -2000-10-14 OKUJI Yoshinori - - * docs/tutorial.texi (Serial terminal): Fixed a typo. - * docs/user-ref.texi (GRUB images): New chapter. - * docs/grub.texi: Added an entry for the chapter "GRUB images". - -2000-10-14 OKUJI Yoshinori - - * stage2/builtins.c (setkey_func): If TO_KEY is NULL (i.e. the - user specifies no argument), clear BIOS_KEY_MAP and - ASCII_KEY_MAP. - If TO_KEY is non-NULL but FROM_KEY is NULL, set ERRNUM to - ERR_BAD_ARGUMENT and return one. - -2000-10-13 OKUJI Yoshinori - - * docs/grub.texi: Added an entry for the new chapter "Security", - and the order of the chapters in the Tutorial Manual was - changed. - * docs/tutorial.texi (Configuration): Moved to right after the - chapter "Booting". - (Security): New chapter. - -2000-10-10 OKUJI Yoshinori - - From Alessandro Rubini: - * util/grub-install.in (root_device): Use the regular expression - 's%.*\(/dev/[^ ]*\).*%\1%' instead of - 's%.*\(/dev/[a-z0-9]*\).*%\1%'. - (bootdir_device): Likewise. - (grubdir_device): Likewise. - -2000-10-10 OKUJI Yoshinori - - * stage2/start.S (copy_buffer): Use pusha and popa instead of - pushing and poping %di and %si individually, to reduce the code - size and save %cx as well. Reported by Herbert Nachtnebel - . - -2000-10-10 OKUJI Yoshinori - - From Daniel Pittman : - * stage2/builtins.c (setkey_func): Check if - KEYSYM_TABLE[I].UNSHIFTED_NAME and KEYSYM_TABLE[I].SHIFTED_NAME - are not NULLs, before calling grub_strcmp. - -2000-10-08 OKUJI Yoshinori - - * util/grub-install.in (grub_prefix): New variable. The default - is "/boot/grub". - If the user has a separate boot partition, set grub_prefix - instead of grubdir to "/grub". - When running the command "setup", specify $grub_prefix instead - of $grubdir to the option "--prefix". - Report by Thierry Laronde. - -2000-10-08 OKUJI Yoshinori - - * stage2/builtins.c (find_func): Clear ERRNUM after the last - call of next_partition, because it always sets ERRNUM. Reported - by Thierry Laronde . - -2000-10-07 OKUJI Yoshinori - - * lib/device.c [__linux__] (write_to_partition): Open DEV with - O_RDWR instead of O_ORONLY. - -2000-10-06 Alessandro Rubini - - * docs/user-ref.texi (Commands): Added missing commands and - reworded part of the text. - - * stage2/builtins.c (serial_func): Unswap the setting of "speed" - and "port". - -2000-10-06 OKUJI Yoshinori - - * stage2/builtins.c (setup_func): Append "... " to the - messages when calling embed_func and install_func, and print - the result. - Don't jump to the label "fail", even when embed_func failed. - -2000-10-05 Gordon Matzigkeit - - * stage2/disk_io.c (real_open_partition): Make sure that buf_geom - corresponds to the current drive before using it. - - * lib/device.c (get_drive_geometry): Use fstat if the native - geometry methods fail, such as when the drive is mapped to a - regular file. - - * docs/tutorial.texi: Add `@kbd{...}' to examples in order to - differentiate between command output and characters the user - should type. - * docs/user-ref.texi: Likewise. - -2000-10-05 OKUJI Yoshinori - - * docs/grub.texi: Added an entry for the chapter "Serial - terminal". - * docs/tutorial.texi (Serial terminal): New chapter. - -2000-10-04 Gordon Matzigkeit - - * util/grub-image (VERSION): Fix version calculation to tolerate - `(GNU GRUB 0.5.96)'-style versions. - - * docs/grub.texi: Remove braces from `@unnumbered' sections so - that texi2html doesn't complain. - - * debian/rules: Build HTML documentation to appease the Debian - masses. - -2000-10-04 OKUJI Yoshinori - - * stage2/fsys_reiserfs.c (reiserfs_mount): Compare PART_LENGTH - with SUPERBLOCK + (sizeof(super) >> SECTOR_BITS) instead of - sizeof(struct reiserfs_super_block). Reported by Jochen - Hoenicke. - -2000-10-05 OKUJI Yoshinori - - * configure.in (AM_INIT_AUTOMAKE): The version number is set to - 0.5.97. This version number is a dummy, as we will never release - 0.5.97 actually. - -2000-10-01 OKUJI Yoshinori - - * lib/device.c [__linux__]: Don't include . - [__linux__ && !CDROM_GET_CAPABILITY] (CDROM_GET_CAPABILITY): - Defined as 0x5331. - -2000-10-01 OKUJI Yoshinori - - * lib/device.c (get_drive_geometry) [__GNU__]: Get the number of - total sectors by fstat. The rest are filled with arbitrary - values. - -2000-09-30 OKUJI Yoshinori - - * util/grub-install.in (convert): The code for gnu* (i.e. - GNU/Hurd) was rewritten, since it didn't work for BSD - partitions. - Use "$tmp_disk *$" instead of "$tmp_disk" to get the drive name. - -2000-09-30 OKUJI Yoshinori - - * stage2/fsys_reiserfs.c (reiserfs_mount): Check if the length - of the partition is less than the size of a super block, before - attempting to read the super block. - - * grub/asmstub.c (console_putchar) - [HAVE_LIBCURSES_H && REFRESH_IMMEDIATELY]: Call refresh, to ease - debugging. - -2000-09-30 OKUJI Yoshinori - - Added two new commands, "partnew" and "parttype", based on the - patch by Stefan Ondrejicka : - * stage2/builtins.c (partnew_func): New function. - (builtin_partnew): New variable. - (parttype_func): New function. - (builtin_parttype): New variable. - (builtin_table): Added pointers to BUILTIN_PARTNEW and to - BUILTIN_PARTTYPE. - -2000-09-29 OKUJI Yoshinori - - * stage2/builtins.c (find_func): New variable GOT_FILE is set to - one if FILENAME is found. Otherwise, it is set to zero. - Clear ERRNUM at the end in the loop for floppies, to ensure that - ERRNUM is cleared before examining hard disks. - Rewrite the loop for hard disks using next_partitions, so this - function now checks all partitions you have certainly. - If GOT_FILE is non-zero, set ERRNUM to ERR_FILE_NOT_FOUND and - return one. - -2000-09-29 OKUJI Yoshinori - - * stage2/disk_io.c (check_BSD_parts): Removed. - (next_partition): New function. - (real_open_partition): Rewritten using next_partition. - (set_device) [!STAGE1_5]: Skip a comma in DEVICE, even when the - BSD partition is not specified. - [!STAGE1_5] (print_completions): Don't append ')' if the - partition is a PC slice which may have BSD partitions. Instead, - try to complete the command-line with possible partitions. - * stage2/shared.h (next_partition): Declared. - -2000-09-27 OKUJI Yoshinori - - * configure.in (--enable-serial): Changed to ... - (--disable-serial): ... this. Now the serial support is enabled - by default. - -2000-09-27 OKUJI Yoshinori - - * stage2/char_io.c [!STAGE1_5] (get_cmdline) [!SUPPORT_SERIAL]: - Don't check if the terminal is dumb. If the terminal is console, - always use console functions. - * stage2/builtins.c [!SUPPORT_NETBOOT] (bootp_func): Undefined. - [!SUPPORT_NETBOOT] (builtin_bootp): Likewise. - [!GRUB_UTIL] (device_func): Likewise. - [!GRUB_UTIL] (builtin_device): Likewise. - [!SUPPORT_NETBOOT] (dhcp_func): Likewise. - [!SUPPORT_NETBOOT] (builtin_dhcp): Likewise. - [!GRUB_UTIL] (quit_func): Likewise. - [!GRUB_UTIL] (builtin_quit): Likewise. - [!SUPPORT_NETBOOT] (rarp_func): Likewise. - [!SUPPORT_NETBOOT] (builtin_rarp): Likewise. - [!SUPPORT_SERIAL] (serial_func): Likewise. - [!SUPPORT_SERIAL] (builtin_serial): Likewise. - [!SUPPORT_SERIAL] (terminal_func): Likewise. - [!SUPPORT_SERIAL] (builtin_terminal): Likewise. - [!SUPPORT_NETBOOT] (tftpserver_func): Likewise. - [!SUPPORT_NETBOOT] (builtin_tftpserver): Likewise. - (builtin_table) [!SUPPORT_NETBOOT]: Removed the pointers to - BUILTIN_BOOTP, BUILTIN_DHCP, BUILTIN_RARP, and - BUILTIN_TFTPSERVER. - (builtin_table) [!SUPPORT_SERIAL]: Removed the pointers to - BUILTIN_SERIAL and BUILTIN_TERMINAL. - (builtin_table) [!GRUB_UTIL]: Removed the pointers to - BUILTIN_DEVICE and BUILTIN_QUIT. - -2000-09-26 OKUJI Yoshinori - - * util/grub-install.in (bootdir_device): New variable. If - $bootdir_device is not the same as $root_device, set root_device - and grubdir to $bootdir_device and "/grub", respectively. - Add --prefix=$grubdir into the command "setup". - -2000-09-26 OKUJI Yoshinori - - Add --prefix=DIR to the command "setup". - - * stage2/builtins.c (setup_func): New nested function, - check_file checks if the file FILE exists. - Remove the prefix "/boot/grub" in STAGE1_5_MAP. - Don't hardcode "/boot/grub/stage1", "/boot/grub/stage2", or - "/boot/grub/menu.lst". Instead, check if ARG contains - "--prefix=", and if specified, set PREFIX to the value. - If not specified, check "/boot/grub/stage1" and, if not found, - check "/grub/stage1". If a stage1 was found, set PREFIX to the - directory which contains the stage1. - -2000-09-12 OKUJI Yoshinori - - Add additional magic to avoid a bug in Linux. *sigh* - - * stage2/boot.c (load_image): Copy SRC to DEST first, and append - a "mem=" option to DEST instead of prepending. - -2000-09-11 OKUJI Yoshinori - - Reported by Alessandro Rubini: - * stage2/fsys_minix.c (minix_mount): Check if CURRENT_SLICE is a - partition type for minix fs, using the macro - IS_PC_SLICE_TYPE_MINIX. - * stage2/pc_slice.h (PC_SLICE_TYPE_LINUX_MINIX): New macro. - (IS_PC_SLICE_TYPE_MINIX): Likewise. - -2000-09-09 Alessandro Rubini - - * stage1/stage1.S (notification_string): Print "GRUB " instead - of "stage1 ". - * stage2/start.S [STAGE1_5] (notification_string): Print - "Loading stage1.5" instead of "stage1.5 ". - [!STAGE1_5] (notification_string): Print "Loading stage2" - instead of "stage2 ". - (notification_step): New label, followed by a string ".". - (notification_done): New label, followed by a string "\r\n". - (copy_buffer): Print NOTIFICATION_STEP after copying the buffer. - (bootit): Print NOTIFICATION_DONE before restoring %dx. - -2000-09-09 OKUJI Yoshinori - - From Alessandro Rubini: - * configure.in (CPPFLAGS): Added -malign-jumps=1, - -malign-loops=1 and -malign-functions=1. - -2000-09-07 OKUJI Yoshinori - - From Hal Snyder : - * lib/device.c (get_drive_geometry) [__FreeBSD__ || __NetBSD__ - || __OpenBSD__]: Call ioctl for FD instead of - DISKS[DRIVE].FLAGS. This was a mistake when I segregated this - function from asmstub.c. - -2000-09-07 Alessandro Rubini - - * docs/tutorial.texi: Fixed a few typos and minor imprecisions. - * docs/prog-ref.texi: Likewise. - * docs/user-ref.texi: Likewise. - -2000-09-07 OKUJI Yoshinori - - From Alessandro Rubini: - * stage2/builtins.c (terminal_func): Rename TIMEOUT to TO, to - suppress GCC warnings. - * grub/asmstub.c (serial_checkkey): Likewise. - -2000-09-06 OKUJI Yoshinori - - * stage2/char_io.c [!STAGE1_5] (auto_fill): New variable. - [!STAGE1_5] (get_cmdline): Save AUTO_FILL in SAVED_AUTO_FILL in - the beginning and restore AUTO_FILL before return. - Set AUTO_FILL to one and zero before and after calling - print_completions, respectively. - (grub_putchar) [!STAGE1_5]: Use a static variable COL to track - the position of the cursor. If C is a carriage return, clear - COL. If C is a backspace and COL is positive, decrease COL. If C - is a printable character, increase COL. In this case, if - AUTO_FILL is non-zero and COL is greater than or equal to 79, - put a newline automatically. - * stage2/shared.h (auto_fill): Declared. - * stage2/stage2.c (run_menu): In the menu interface, disable the - auto fill mode (i.e. set AUTO_FILL to zero), and enable it again - when booting an entry. - (cmain): Initialize AUTO_FILL (i.e. set it to one) in the - beginning of the loop. - -2000-09-06 OKUJI Yoshinori - - Add support for "boot previously booted entry by default", based - on the patch by Mike Meyer , but I've modified - his patch thoroughly. - - * grub/asmstub.c (saved_entryno): New variable. This is a dummy. - * stage1/stage1.h (COMPAT_VERSION_MINOR): Incremented. - * stage2/asm.S (saved_entryno): New variable. - (codestart) [!SUPPORT_DISKLESS]: Set INSTALL_SECOND_SECTOR to - %ebp. %ebp is set in start.S. - (install_second_sector): New variable. - * stage2/builtins.c (current_entryno): New variable. - (default_func) [!SUPPORT_DISKLESS]: If ARG is "saved", set - DEFAULT_ENTRY to SAVED_ENTRYNO. - (savedefault_func): New function. - (builtin_savedefault): New variable. - (builtin_table): Added a pointer to BUILTIN_SAVEDEFAULT. - * stage2/shared.h (STAGE2_SAVED_ENTRYNO): New macro. - (STAGE2_STAGE2_ID): Changed to 0x10. - (STAGE2_FORCE_LBA): Chaged to 0x11. - (STAGE2_VER_STR_OFFS): Changed to 0x12. - (install_second_sector): Declared. - (saved_entryno): Likewise. - (current_entryno): Likewise. - * stage2/stage2.c (run_menu): Set CURRENT_ENTRYNO to FIRST_ENTRY - + ENTRYNO, right before calling run_script. - * stage2/start.S (start): Save the sector number of the second - sector in %ebp. - -2000-09-05 OKUJI Yoshinori - - * stage1/stage1.S (lba_mode) [!NO_BUGGY_BIOS_IN_THE_WORLD]: - Don't check for the geometry, since some BIOSes don't return the - number of total sectors correctly, even if they have working LBA - support. - * stage2/start.S (lba_mode) [!NO_BUGGY_BIOS_IN_THE_WORLD]: - Likewise. - * stage2/bios.c (biosdisk) [!NO_BUGGY_BIOS_IN_THE_WORLD]: - Likewise. - Reported by Jan Fricke and Pixel - . - -2000-09-05 OKUJI Yoshinori - - From Alessandro Rubini : - * stage2/char_io.c (print_error) [!STAGE1_5]: Print ERRNUM like - "Error 9: Unknown boot failure". - (print_error) [STAGE1_5]: Don't print a colon. - * util/grub-install.in: When checking if an error occurred, use - the expression "Error [0-9]*: " instead of "Error: ". - * docs/user-ref.texi (Stage1.5 errors): Updated, since the error - form changed. - -2000-09-04 OKUJI Yoshinori - - * stage2/stage2.c (run_menu) [GRUB_UTIL]: Set DISP_UP and - DISP_DOWN to ACS_UARROW and ACS_DARROW, respectively. Don't call - grub_printf here. - (run_menu) [!GRUB_UTIL]: Don't call grub_printf here. Instead, - call it... - (run_menu): ... here. - * stage2/shared.h (ACS_ULCORNER): Always define this ourselves, - whether your curses library has the definition. - (ACS_URCORNER): Likewise. - (ACS_LLCORNER): Likewise. - (ACS_LRCORNER): Likewise. - (ACS_HLINE): Likewise. - (ACS_VLINE): Likewise. - (ACS_LARROW): Likewise. - (ACS_RARROW): Likewise. - (ACS_UARROW): Likewise. - (ACS_DARROW): Likewise. - - * stage2/char_io.c [SUPPORT_SERIAL] (serial_cls): If the - terminal is dumb, just put a newline. - * stage2/builtins.c (terminal_func) [SUPPORT_SERIAL]: When - choosing a terminal, don't set TERMINAL to the type of the - terminal. Instead, apply a logical AND operation with - TERMINAL_DUMB, since previous code brushed off the dumb - attribute. - -2000-09-04 OKUJI Yoshinori - - * stage2/stage2.c (run_menu): If SHOW_MENU is zero, print a - message with the timeout per second. - If GRUB_TIMEOUT is negative, set SHOW_MENU to one, since the - condition "no timeout and no interface" is nonsense. - If GRUB_TIMEOUT is equal to or greater than zero and the - terminal is dumb, set SHOW_MENU to zero. - If SHOW_MENU is non-zero and the terminal is dumb, enter the - command-line interface instead. If AUTH is false and PASSWORD is - non-NULL, prompt the user to enter a password until the entered - password is identical to PASSWORD. - -2000-09-03 OKUJI Yoshinori - - * util/grub-install.in: Fix a typo: grub_dir -> grubdir. - * stage2/builtins.c (install_func) [GRUB_UTIL]: Open a Stage 2 - with "r+" instead of "r", as GRUB needs to overwrite it. - -2000-09-02 OKUJI Yoshinori - - * stage2/stage2.c (run_menu): Don't use either `p' or `n' to - move the cursor, because `p' is already used for another - purpose (password). - (run_menu) [SUPPORT_SERIAL]: Don't set the variables DISP_UP and - DISP_DOWN at the start time. Instead, set them just before using - them actually, because TERMINAL may change when running a menu. - -2000-09-01 Klaus Reichl - - * stage2/stage2.c (run_menu): Setup and use disp_up, disp_down - depending on the terminal mode. - (run_menu): Allow '^' (resp. 'p') and 'v' (resp 'n') keys we - described in our help above (resp. authors preferences). - -2000-08-31 Klaus Reichl - - * stage2/stage2.c (set_line): Go back one char, which is - consistent with the original situation, when a timeout was - running. - (run_menu): If GRUB_TIMEOUT is stopped don't loop busy over - CHECKKEY, just relax in GETKEY. - - * stage2/builtins.c (serial_func): --speed handling: corrected - typo: set SPEED instead of PORT. - -2000-08-31 OKUJI Yoshinori - - * stage2/builtins.c (terminal_func): Added two new options, - --dumb and --timeout=SECS. - * stage2/char_io.c [!STAGE1_5] (getkey): Use logical AND - operations, when checking if the terminal is a console or a - serial terminal. - [!STAGE1_5] (getkey) [SUPPORT_SERIAL]: Don't check if both - TERMINAL_CONSOLE and TERMINAL_SERIAL are set in TERMINAL. - -2000-08-31 OKUJI Yoshinori - - * stage1/stage1.S (MOV_MEM_TO_AL): New macro. - (real_start): Use the macro MOV_MEM_TO_AL instead of using movb - directly, because binutils-2.9.1.0.x doesn't produce a short - opcode for it automatically. Reported by Alessandro Rubini - . - -2000-08-30 OKUJI Yoshinori - - * configure.in (CPPFLAGS): Remove -Wundef by default. Add the - option only if the C compiler supports it, because GCC 2.7.x - doesn't support it. - * grub/main.c (longopts): The type of the argument for "hold" is - changed to OPTIONAL_ARGUMENT. - (main): If --hold is specified, check if OPTARG is zero. If so, - set HOLD to -1, otherwise, set it to the digit OPTARG. - If HOLD is greater than zero, decrease it once per loop. - -2000-08-30 OKUJI Yoshinori - - The command-line interface is switched to single-line editing - mode. - - * stage2/char_io.c [!STAGE1_5] (get_cmdline): Extensively - rewritten. The nested functions cl_print and cl_kill_to_end are - removed, cl_refresh, cl_backward, cl_forward and cl_delete are - added, and, cl_init and cl_insert are rewritten from scratch. - See the source code, for more information. I don't think this - kind of changes can be represented in ChangeLog. - [!STAGE1_5] (CMDLINE_WIDTH): New macro. - [!STAGE1_5] (CMDLINE_MARGIN): Likewise. - * stage2/shared.h (TERMINAL_DUMB): Likewise. - -2000-08-28 OKUJI Yoshinori - - * grub/asmstub.c (console_putchar) [HAVE_LIBCURSES]: If - USE_CURSES is true, emulate a new line like a ordinary terminal, - because ncurses treats it badly. If current position on y-axis - is the bottom of the screen, call scroll. Otherwise, call move - with the arguments, Y + 1 and X, where X and Y are current - position of the cursor. - -2000-08-28 OKUJI Yoshinori - - * stage2/asm.S (console_putchar): Don't print a carriage return - when C is a newline. - * stage2/char_io.c (grub_putchar): Call grub_putchar with the - arugment set to a carriage return, if C is a newline. - [!STAGE1_5 && SUPPORT_SERIAL]: Don't print a carriage return - when C is a newline. - -2000-08-27 OKUJI Yoshinori - - * lib/device.c [__linux__]: Don't include linux/fs.h. - [!BLKGETSIZE] (BLKGETSIZE): Defined as _IO(0x12,96). - * grub/asmstub.c [__linux__]: Don't include linux/fs.h. - -2000-08-27 OKUJI Yoshinori - - Preserve a magic number used by Windows NT in a MBR. Shit! - Reported by Khimenko Victor. - - * stage1/stage1.h (STAGE1_WINDOWS_NT_MAGIC): New macro. - * stage1/stage1.S (copy_buffer): Use pusha and popa, instead of - pushing/poping %cx and %si separately, to reduce the code size. - (nt_magic): New label. Set the offset to _start plus - STAGE1_WINDOWS_NT_MAGIC - (part_start): New label. - * stage2/builtins.c (install_func): If DEST_DRIVE is a hard - disk, copy the possible partition table and Windows NT magic to - STAGE1_BUFFER from OLD_SECT. - -2000-08-26 OKUJI Yoshinori - - * stage2/char_io.c (translate_keycode) [SUPPORT_SERIAL]: Don't - drain the input buffer, since that was irritating. - -2000-08-26 OKUJI Yoshinori - - Don't save/restore fragile registers unnecessarily. - - * stage2/asm.S [!STAGE1_5] (track_int13): Don't save/restore - %ecx, %edx, or %eax. - [!STAGE1_5] (set_int13_handler): Likewise. - (biosdisk_int13_extensions): Likewise. - (biosdisk_standard): Likewise. - (check_int13_extensions): Likewise. - (get_diskinfo_int13_extensions): Likewise. - (get_diskinfo_standard): Likewise. - (get_diskinfo_floppy): Likewise. - [!STAGE1_5] (get_eisamemsize): Likewise. - [!STAGE1_5] (get_mmap_entry): Likewise. - [!STAGE1_5] (console_cls): Likewise. - [!STAGE1_5] (nocursor): Likewise. - [!STAGE1_5] (console_getxy): Likewise. - [!STAGE1_5] (console_gotoxy): Likewise. - [!STAGE1_5] (set_attrib): Likewise. - [!STAGE1_5] (getrtsecs): Likewise. - [!STAGE1_5] (currticks): Likewise, and don't zero %eax - explicitly, since prot_to_real does that. - -2000-08-25 OKUJI Yoshinori - - * stage2/char_io.c [!STAGE1_5] (translate_keycode): New - function. The serial part is stolen from the patch by Christoph - Plattner. - [!STAGE1_5] (get_cmdline): Call translate_keycode instead of - translating special key codes into ASCII characters by itself. - * stage2/stage2.c (run_menu): Wrap getkey with the macro - ASCII_CHAR, when checking if ESC is pressed. - Call translate_keycode as well as getkey, unless checkkey - returns -1. So don't check if C is KEY_DOWN or KEY_UP. And don't - use the macro ASCII_CHAR for C explicitly. - * stage2/shared.h (translate_keycode): Declared. - -2000-08-24 OKUJI Yoshinori - - * stage2/builtins.c [GRUB_UTIL]: Include stdio.h before - shared.h. Reported by Mathieu Chouquet-Stringer - . - -2000-08-21 OKUJI Yoshinori - - * configure.in (--enable-serial-speed-emulation): New option. - (SERIAL_SPEED_SIMULATION): New conditional. - * grub/Makefile.am (SERIAL_FLAGS): New variable. Set - -DSUPPORT_SERIAL=1 and -DSIMULATE_SLOWNESS_OF_SERIAL=1, if - SERIAL_SPEED_SIMULATION is defined, otherwise, set it to - only -DSUPPORT_SERIAL=1. - (AM_CFLAGS): Removed -DSUPPORT_SERIAL=1 and added - $(SERIAL_FLAGS). - * grub/asmstub.c [SIMULATE_SLOWNESS_OF_SERIAL] (serial_speed): - New variable. - (grub_setjmp): Removed. - (grub_longjmp): Likewise. - (serial_getkey) [SIMULATE_SLOWNESS_OF_SERIAL]: Wait for - 1000000 / (SERIAL_SPEED >> 3) microseconds using gettimeofday. - (serial_putchar) [SIMULATE_SLOWNESS_OF_SERIAL]: Likewise. - (serial_init) [SIMULATE_SLOWNESS_OF_SERIAL]: Set SERIAL_SPEED to - SPEED. - * stage2/builtins.c (serial_func) [SUPPORT_SERIAL]: Added - a new option, `--speed'. - (builtin_serial): Added a description about --speed. - (terminal_func): When get a key from a serial device, if GRUB is - in the command-line interface, call grub_longjmp with - RESTART_CMDLINE_ENV, instead of init_page. - * stage2/cmdline.c (restart_cmdline_env): New variable. - (enter_cmdline): Call grub_setjmp with RESTART_CMDLINE_ENV after - calling init_cmdline. - (run_script): Run BUILTIN->FUNC with BUILTIN_SCRIPT instead of - BUILTIN_CMDLINE. - * stage2/shared.h (BUILTIN_SCRIPT): New macro. - [GRUB_UTIL] (grub_setjmp): Defined as setjmp. - [GRUB_UTIL] (grub_longjmp): Defined as longjmp. - (restart_cmdline_env): Declared. - -2000-08-20 OKUJI Yoshinori - - * configure.in (--enable-serial): New option. Serial terminal - support will be enabled by default, once it is stabilized. - (SERIAL_SUPPORT): New conditional. - * grub/Makefile.am (AM_CFLAGS): Added -DSUPPORT_SERIAL=1. - * grub/asmstub.c (cls): Renamed to ... - (console_cls): ... this. - (getxy): Renamed to ... - (console_getxy): ... this. - (gotoxy): Renamed to ... - (console_gotoxy): ... this. - * stage2/Makefile.am (libgrub_a_CFLAGS): Added - -DSUPPORT_SERIAL=1. - (NETBOOT_FLAGS): New variable. - (SERIAL_FLAGS): Likewise. - (STAGE2_COMPILE): Added $(NETBOOT_FLAGS) and $(SERIAL_FLAGS). - * stage2/asm.S [!STAGE1_5] (cls): Renamed to ... - [!STAGE1_5] (console_cls): ... this. - [!STAGE1_5] (getxy): Renamed to ... - [!STAGE1_5] (console_getxy): ... this. - [!STAGE1_5] (gotoxy): Renamed to ... - [!STAGE1_5] (console_gotoxy): ... this. - * stage2/builtins.c (terminal_func): If the bit flag - BUILTIN_CMDLINE in FLAGS is set, call init_page. But this should - be fixed so that it restarts enter_cmdline instead. - * stage2/char_io.c [!STAGE1_5] (gotoxy): New function. - [!STAGE1_5] (serial_gotoxy): Likewise. - [!STAGE1_5] (getxy): Likewise. - [!STAGE1_5] (serial_getxy): Likewise. - [!STAGE1_5] (cls): Likewise. - [!STAGE1_5] (serial_cls): Likewise. - * stage2/serial.h (serial_cls): Declared. - (serial_getxy): Likewise. - (serial_gotoxy): Likewise. - * stage2/shared.h (console_cls): Likewise. - (console_getxy): Likewise. - (console_gotoxy): Likewise. - * stage2/stage2.c (print_entries): If serial terminal is - enabled, print ACS_UARROW and ACS_DARROW instead of DISP_UP and - DISP_DOWN, respectively. - (print_border): If serial terminal is enabled, print - ACS_ULCORNER, ACS_URCORNER, ACS_LLCORNER, ACS_LRCORNER, - ACS_HLINE and ACS_VLINE instead of DISP_UL, DISP_UR, DISP_LL, - DISP_LR, DISP_HORIZ and DISP_VERT, respectively. - (print_border) [SUPPORT_SERIAL]: Color the menu only if console - is used. - (set_line): Take two more arguments, ENTRYNO and MENU_ENTRIES. - (set_line_normal): Likewise. - (set_line_highlight): Likewise. - (set_line) [SUPPORT_SERIAL]: If serial terminal is enabled, get - the menu entry whose attributes are being changed and redraw the - line. - (set_line_highlight) [SUPPORT_SERIAL]: If serial terminal is - enabled, print `ESC [ 7 m' and `ESC [ 0 m' before and after - calling set_line, respectively. - (run_menu) [SUPPORT_SERIAL]: Call nocursor only if console is - used. - -2000-08-20 OKUJI Yoshinori - - Now the serial console support is partially working. - - * grub/asmstub.c (serial_checkkey): Specify a pointer to TIMEOUT - as the fifth argument to select. - (serial_get_port): New function. Just a dummy. - (serial_init): If a serial device is opened, close SERIAL_FD - before opeing a new serial device. - Don't specify O_NDELAY to open. - * stage2/builtins.c [SUPPORT_SERIAL]: Include serial.h. - (serial_func): New function. - (builtin_serial): New variable. - (terminal_func): New function. - (builtin_terminal): New variable. - (builtin_table): Add pointers to BUILTIN_SERIAL and - BUILTIN_TERMINAL. - * stage2/char_io.c [SUPPORT_SERIAL]: Include serial.h. - (getkey) [SUPPORT_SERIAL]: If both TERMINAL_CONSOLE and - TERMINAL_SERIAL are set in TERMINAL simultaneously, print a - warning and force the console terminal. - (checkkey) [SUPPORT_SERIAL]: If TERMINAL_SERIAL is set in - TERMINAL, call serial_checkkey. - (grub_putchar) [SUPPORT_SERIAL]: If TERMINAL_SERIAL is set in - TERMINAL, call serial_putchar. If C is a newline, print a - carriage return, before printing a newline. - -2000-08-15 OKUJI Yoshinori - - The image `nbgrub' now relocates itself from 0x10000 to 0x8000, - since the Network Boot Image Proposal doesn't permit a second - loader to be loaded below 0x10000. Reported by Matthias - Kretschmer . - - * Makefile.am (NBLOADER_LINK): New variable. - (nbloader_exec_LDFLAGS): Set to $(NBLOADER_LINK) instead of - $(START_LINK). - * stage2/nbi.h (NBI_DEST_ADDR): Changed to 0x10000. - (NBI_DEST_SEG): New macro. - (NBI_DEST_OFF): Likewise. - (RELOCATED_ADDR): Likewise. - (RELOCATED_SEG): Likewise. - (RELOCATED_OFF): Likewise. - (STAGE2_START_ADDR): Likewise. - * stage2/nbloader.S: Added .code16 directive at the start of the - code. - Set the segment and the offset of the load address to - NBI_DEST_SEG and NBI_DEST_OFF, respectively. - Set the segment and the offset of the start address to - NBI_DEST_SEG and NBI_DEST_OFF + relocate - _start, respectively. - Added a routine for relocating itself. - (relocate): New label. - (copy_rest): Likewise. - (copy_loop): Likewise. - (copy): Likewise. - (boot_stage2): Likewise. - -2000-08-13 OKUJI Yoshinori - - * grub/main.c (main): Move the version number inside the - parentheses, since the grub shell is merely one of the programs - included in GNU GRUB. - -2000-08-13 OKUJI Yoshinori - - Add a serial device emulation into the grub shell. - - * grub/asmstub.c: Include sys/time.h and termios.h. - (serial_fd): New variable. - (serial_device): Likewise. - (serial_getkey): New function. - (serial_checkkey): Likewise. - (serial_putchar): Likewise. - (get_termios_speed): Likewise. - (serial_init): Likewise. - (set_serial_device): Likewise. - (grub_stage2): Restore SERIAL_DEVICE and SERIAL_FD, if they were - allocated. - * stage2/serial.h [GRUB_UTIL] (set_serial_device): Declared. - -2000-08-13 OKUJI Yoshinori - - * stage2/asm.S (codestart) [SUPPORT_DISKLESS]: Don't reset a - disk system. That is not only uncessary but also harmful. - -2000-08-12 OKUJI Yoshinori - - Add a serial device driver (but only the driver). - - * stage2/serial.c: New file. - * stage2/serial.h: Likewise. - * stage2/shared.h (serial_getkey): Moved to stage2/serial.h. - (serial_checkkey): Likewise. - (serial_putchar): Likewise. - * stage2/Makefile.am (noinst_HEADERS): Added serial.h. - (pre_stage2_exec_SOURCES): Added serial.c. - -2000-08-10 Pavel Roskin - - * docs/tutorial.texi: Minor fixes. - -2000-08-10 OKUJI Yoshinori - - * docs/tutorial.texi (Installation): Divided into three sections - instead of two sections. Don't describe the usage of the the - grub shell any longer. Instead, how to use grub-install is - documented. - -2000-08-09 OKUJI Yoshinori - - * stage2/builtins.c [GRUB_UTIL]: Include stdio.h. - (embed_func) [GRUB_UTIL && __linux__]: When embedding a Stage - 1.5 into a partition, call write_to_partition instead of - biosdisk. - (install_func): Set DEST_PARTITION to the partition where Stage - 1 resides. - Set SRC_PART_START to the starting address of the partition - where Stage 2 resides. - (install_func) [GRUB_UTIL]: Set STAGE2_OS_FILE to the file name - of Stage 2 under an OS, if the new option "--stage2" is - specified. Otherwise, set it to null. - If STAGE2_OS_FILE is not null, modify the Stage 2 via the - filesystem serviced by the OS. - (install_func) [GRUB_UTIL && __linux__]: If STAGE2_OS_FILE is - null but the Stage2 resides in a partition, use - write_to_partition. - If DEST_PARTITION is not 0xFFFFFF, use write_to_partition, to - embed Stage 1. - (setup_func) [GRUB_UTIL]: If --stage2 is specified, set - STAGE2_ARG to the string pointing to the option. Otherwise, set - it to null. - (setup_func) [!GRUB_UTIL]: Set STAGE2_ARG to null. - (setup_func): If STAGE2_ARG is not null, add STAGE2_ARG and a - space character into CMD_ARG. - * lib/device.c (_LARGEFILE_SOURCE): Defined. - (_FILE_OFFSET_BITS): Likewise. - [__linux__] (write_to_partition): New function. - * lib/device.h [__linux__] (write_to_partition): Declared. - * util/grub-install.in: Specify the option "--stage2" for the - command "setup". - -2000-08-04 Jochen Hoenicke - - * stage2/fsys_fat.c (fat_superblock): clust_eof_marker added. - (fat_mount): Initialize clust_eof_marker to 0xff8, 0xfff8, or - 0xffffff8, depending on fat size. Support for single active FAT - added (FAT32 extension). Changed the boundary between FAT12 and - FAT16, again. The Microsoft KB article Q65541 seems to be wrong - here, I go with mtools and the previous behaviour of grub: FAT12 - iff number of clusters (without counting the two nonexisting - clusters) is less or equal 4095. - (fat_read): Report error if cluster number is too big, but not - greater or equal clust_eof_marker. - * stage2/fsys_reiserfs.c (journal_init): Fixed calculation of - journal_transaction. - -2000-08-01 Jochen Hoenicke - - * stage2/fsys_reiserfs.c: Symlink support added. - (S_ISLNK): New macro. - (PATH_MAX): Likewise. - (MAX_LINK_COUNT): Likewise. - (reiserfs_dir): Check for symlink and handle them. - (read_tree_node): Take a block number and check if tree node was - already read in. If not update the INFO->blocks field. - (next_key): Changed call of read_tree_node. - (search_stat): Likewise. - (journal_init): Fixed a small bug. Some debugging messages added. - -2000-07-31 Pavel Roskin - - * grub/asmstub.c (biosdisk) [__linux__]: The first argument for - _llseek renamed from "seeked_fd" to "filedes". - -2000-07-30 OKUJI Yoshinori - - * docs/appendices.texi (FAQ): Added the answer for the separate - boot partition problem. - -2000-07-30 OKUJI Yoshinori - - Update the network support to Etherboot-4.6.4. - - From Daniel Wagner : - * netboot/3c509.c: Copied from Etherboot-4.6.4. - * netboot/3c509.h: Likewise. - * netboot/cards.h: Likewise. - * netboot/ns8390.c: Likewise. - * netboot/sk_g16.c: Likewise. - * netboot/sk_g16.h: Likewise. - * netboot/tulip.c: Likewise. - * netboot/pci.h: Likewise. - * netboot/main.c (dhcpdiscover): Updated. - (dhcprequest): Likewise. - (bootp): Likewise. - * netboot/README.netboot: Added the information about the new - option --enable-ns8390-force-16bit. - * configure.in (--enable-ns8390-force-16bit): New option. - - * netboot/config.c: Updated. - -2000-07-29 OKUJI Yoshinori - - The Linux zImage support is working now. - - * stage2/asm.S (linux_boot): Add 3 into %ecx and shift %ecx to - the right by 2 bits, instead of shift %ecx to the left by 2 - bits. - -2000-07-29 Jochen Hoenicke - - * stage2/fsys_reiserfs.c (block_read): Changed the variable "len" - to "j_len" (it shadowed a parameter). - -2000-07-29 OKUJI Yoshinori - - * configure.in (CPPFLAGS): Added -Wshadow, -Wpointer-arith and - -Wundef, as GCC sometimes more clever than me. :) - * stage2/shared.h [!ASM_FILE] (multi_boot): Change the name of - the second argument from "mbi" to "mb_info". - [!ASM_FILE] (biosdisk): Rename the first argument "read" to - "subfunc". - * lib/device.h (init_device_map): Change the name of the third - argument from "floppy_disks" to "no_floppies". - * lib/device.c (read_device_map): Rename the internal function - "print_error" to "show_error". - * stage2/builtins.c (install_func): Rename CONFIG_FILE to - REAL_CONFIG. - (setup_func): Rename INSTALL_DRIVE, INSTALL_PARTITION and - CONFIG_FILE to INSTALLED_DRIVE, INSTALLED_PARTITION and - CONFIG_FILENAME, respectively. - * stage2/char_io.c (convert_to_ascii): Rename the internal - variable C to TMP. - (get_cmdline): Rename KILL to KILL_BUF. - Rename the second argument for cl_print to REAL_ECHO_CHAR from - ECHO_CHAR. - * stage2/stage2.c (run_menu): Rename the internal variable - NUM_ENTRIES to NEW_NUM_ENTRIES. - (cmain): Rename KILL to KILL_BUF. - * stage2/disk_inode_ffs.h: Check if BYTE_MSF is defined before - checking the value. - * stage2/fsys_ext2fs.c (ext2fs_dir): Check if E2DEBUG is - defined, instead of if the value is non-zero. - * grub/asmstub.c: Check if __GLIBC__ is defined before checking - the value. - (biosdisk) [__linux__]: Likewise. - Rename the first argument for _llseek to "seeked_fd" from "fd". - (multi_boot): Rename the second argument to "mb_info" from - "mbi". - -2000-07-27 Gordon Matzigkeit - - * util/grub-image.in: Initial cut at a script for creating GRUB - boot images. - * util/Makefile.am (noinst_SCRIPTS): Added grub-image. - * configure.in (AC_OUTPUT): Added util/grub-image. - -2000-07-27 Jochen Hoenicke - - * stage2/asm.S (check_int13_extensions): Fixed the effect of - the --force-lba switch in stage2/stage1_5. - -2000-07-25 Jochen Hoenicke - - * stage2/fsys_fat.c (fat_mount): Fixed calculation of num_clust. - It was off by two, since the two non existing clusters 0 and 1 - were not taken into account. Also fixed the boundary between - FAT12 and FAT16. - -2000-07-25 OKUJI Yoshinori - - * stage2/asm.S [!STAGE1_5] (linux_text_len): New variable. - [!STAGE1_5] (linux_boot): Don't set %eax to LINUX_SETUP - meaninglessly. - Set %ecx to LINUX_TEXT_LEN instead of LINUX_KERNEL_MAXLEN. - [!STAGE1_5] (big_linux_boot): Disable interrupts before changing - the stack pointer. - Change %ss right before %sp. - Reverse the arguments for ljmp. A segment must be after an - offset. *sigh* - * stage2/boot.c (load_image): Set LINUX_TEXT_LEN to TEXT_LEN, - if a Linux kernel is loaded successfully. - * stage2/shared.h (LINUX_VID_MODE_OFFSET): Removed. - [!ASM_FILE] (linux_kernel_header): Change the type of the member - `heap_end_ptr' to unsigned short. - [!ASM_FILE] (linux_text_len): Declared. - -2000-07-24 OKUJI Yoshinori - - Comply with the Linux/i386 boot protocol version 2.02. - - * stage2/asm.S [!STAGE1_5] (linux_boot): Set the length of moved - bytes to LINUX_KERNEL_MAXLEN instead of - LINUX_KERNEL_LEN_OFFSET(%eax), since the field is obsolete. - [!STAGE1_5] (big_linux_boot): Don't use SEGMENT or OFFSET. - Instead, embed the segment and the offset in the code itself. - Set %ds, %es, %fs and %gs to %ax (LINUX_INIT_SEG). - * stage2/boot.c (load_image): Rewrite the Linux support code - heavily. Use a structure instead of a batch of macros, to access - a Linux kernel header. - (load_initrd): If MOVETO plus LEN is greater than or equal to - LINUX_INITRD_MAX_ADDRESS, set MOVETO to LINUX_INITRD_MAX_ADDRESS - minus LEN with page aligned. - * stage2/shared.h (LINUX_MAGIC_SIGNATURE): New macro. - (LINUX_DEFAULT_SETUP_SECTS): Likewise. - (LINUX_FLAG_CAN_USE_HEAP): Likewise. - (LINUX_INITRD_MAX_ADDRESS): Likewise. - (LINUX_MAX_SETUP_SECTS): Likewise. - (LINUX_BOOT_LOADER_TYPE): Likewise. - (LINUX_HEAP_END_OFFSET): Likewise. - (LINUX_SETUP_MAXLEN): Removed. - (LINUX_KERNEL_LEN_OFFSET): Likewise. - (LINUX_SETUP_LEN_OFFSET): Likewise. - (LINUX_SETUP_STACK): Set to 0x7F00 instead of 0x3FF4 (why was it - this value?). - (LINUX_SETUP_LOADER): Removed. - (LINUX_SETUP_LOAD_FLAGS): Likewise. - (LINUX_SETUP_CODE_START): Likewise. - (LINUX_SETUP_INITRD): Likewise. - (CL_MY_LOCATION): Set to RAW_ADDR(0x97F00) instead of - RAW_ADDR(0x92000). - (CL_MY_END_ADDR): Set to RAW_addr(0x97FFF) instead of - RAW_ADDR(0x920FF). - (CL_MAGIC_ADDR): Removed. - (CL_OFFSET): Likewise. - [!ASM_FILE] (struct linux_kernel_header): New structure tag. - -2000-07-23 OKUJI Yoshinori - - * docs/tutorial.texi: Fix some syntax errors and ambiguous - sentences. Suggested by M. Meiarashi . - -2000-07-14 Khimenko Victor - - * stage2/boot.c (load_image): When getting the text length of a - Linux kernel, use unsigned long instead of unsigned short. - -2000-07-13 OKUJI Yoshinori - - * lib/device.c: Include errno.h. Reported by Thierry DELHAISE - . - -2000-07-12 OKUJI Yoshinori - - Just to start implementing serial console support... - - * stage2/asm.S (grub_putchar): Renamed to ... - (console_putchar): ... this. - [!STAGE1_5] (getkey): Renamed to ... - [!STAGE1_5] (console_getkey): ... this. - [!STAGE1_5] (checkkey): Renamed to ... - [!STAGE1_5] (console_checkkey): ... this. - * stage2/char_io.c [!STAGE1_5] (getkey): New function. - [!STAGE1_5] (checkkey): Likewise. - (grub_putchar): Likewise. - * stage2/shared.h [!STAGE1_5] (terminal): Declared. - [!STAGE1_5] (TERMINAL_CONSOLE): New macro. - [!STAGE1_5] (TERMINAL_SERIAL): Likewise. - (console_putchar): Declared. - (serial_putchar): Likewise. - (console_getkey): Likewise. - (serial_getkey): Likewise. - (console_checkkey): Likewise. - (serial_checkkey): Likewise. - * stage2/builtins.c (terminal): New global variable. The default - is TERMINAL_CONSOLE. - * grub/asmstub.c (grub_putchar): Renamed to ... - (console_putchar): ... this. - (getkey): Renamed to ... - (console_getkey): ... this. - (checkkey): Renamed to ... - (console_checkkey): ... this. - -2000-07-12 OKUJI Yoshinori - - * stage2/Makefile.am (libgrub_a_CFLAGS): Added - -I$(top_srcdir)/lib. - * stage2/builtins.c [GRUB_UTIL]: Include device.h. - -2000-07-12 OKUJI Yoshinori - - Segreate OS-specific helper functions from asmstub.c. - - * grub/asmstub.c [__linux__]: Don't include linux/hdreg.h, - linux/major.h, linux/kdev_t.h, or linux/cdrom.h. - [__FreeBSD__ || __NetBSD__ || __OpenBSD__]: Don't include - sys/ioctl.h, sys/disklabel.h, or sys/ioctl.h. - [HAVE_OPENDISK]: Don't include util.h. - Include device.h. - (DEFAULT_FD_CYLINDERS): Removed. - (DEFAULT_FD_HEADS): Likewise. - (DEFAULT_FD_SECTORS): Likewise. - (DEFAULT_HD_CYLINDERS): Likewise. - (DEFAULT_HD_HEADS): Likewise. - (DEFAULT_HD_SECTORS): Likewise. - (NUM_DISKS): Likewise. - (init_device_map): Likewise. - (get_floppy_disk_name): Likewise. - (get_ide_disk_name): Likewise. - (get_scsi_disk_name): Likewise. - (check_device): Likewise. - (get_drive_geometry): Likewise. - * grub/main.c (no_floppy): Removed. - (probe_second_floppy): Likewise. - (floppy_disks): New global variable. - (main): Set FLOPPY_DISKS to zero, if OPT_NO_FLOPPY. Set - FLOPPY_DISKS to two, if OPT_PROBE_SECOND_FLOPPY. - * lib/Makefile.am (AM_CFLAGS): New variable. - * lib/device.h: New file. - * lib/device.c: Likewise. - * stage2/shared.h (no_floppy): Removed. - (probe_second_floppy): Likewise. - (check_device): Likewise. - (floppy_disks): Declared. - -2000-07-02 OKUJI Yoshinori - - * grub/main.c (usage): Enclose the mail address with parentheses - and add a period into the end of the line. That's just a - cosmetic change. - -2000-07-02 OKUJI Yoshinori - - * docs/appendices.texi (Obtaining and Building GRUB): Indicate - the Cygnus's binutils webpage instead of the hjl's site, since - you can now use a public release (i.e. 2.10). - -2000-06-23 OKUJI Yoshinori - - * stage2/boot.c (load_image): Take an additional argument - LOAD_FLAGS. - If the kernel type is Linux and the bit - KERNEL_LOAD_NO_MEM_OPTION in LOAD_FLAGS is set, don't pass a - Linux's mem option automatically. - * stage2/shared.h (load_image): Added the new argument. - * stage2/builtins.c (kernel_func): If `--no-mem-option' is - specified, set the bit KERNEL_LOAD_NO_MEM_OPTION in LOAD_FLAGS, - otherwise, LOAD_FLAGS is zero. - -2000-06-22 OKUJI Yoshinori - - * docs/tutorial.texi: Fixed some typos and syntax errors. - * docs/user-ref.texi: Likewise. - -2000-06-21 OKUJI Yoshinori - - * stage2/stage2.c (run_menu): Initialize CUR_ENTRY at the - definition. - If SHOW_MENU is zero, don't display the menu interface. Instead, - wait until the timeout is expired and then boot the default - entry. If the user presses `ESC' during the timeout, set - SHOW_MENU to one and break the loop. - Display the menu if SHOW_MENU is true, instead of if - GRUB_TIMEOUT is non-zero. - Set SHOW_MENU to one before go to the label `restart'. - * stage2/builtins.c (show_menu): New global variable. - (hiddenmenu_func): New function. - (builtin_hiddenmenu): New variable. - (builtin_table): Added a pointer to BUILTIN_HIDDENMENU. - * stage2/shared.h (show_menu): Declared. - -2000-06-19 OKUJI Yoshinori - - * docs/mdate-sh: Moved to ... - * mdate-sh: ... here. - * docs/texinfo.tex: Moved to ... - * texinfo.tex: ... here. - -2000-06-09 OKUJI Yoshinori - - * stage2/mb_info.h (AddrRangeDesc): Use one 64bits field instead - of two 32bits fields for BaseAddr and Length, respectively. - BaseAddrLow + BaseAddrHigh -> BaseAddr, LengthLow + LengthHigh - -> Length. - * stage2/builtins.c (displaymem_func): Print BaseAddr >> 32, - BaseAddr & 0xFFFFFFFF, Length >> 32 and Length & 0xFFFFFFFF, - instead of BaseAddrLow, BaseAddrHigh, LengthLow and LengthHigh, - for MAP. - * stage2/common.c (fakemap): Adjusted to the new definition of - AddrRangeDesc. - (mmap_avail_at): Change the type of TOP to unsigned long long. - If TOP is greater than 0xFFFFFFFF, set it to 0xFFFFFFFF, since - GRUB itself cannot deal with 64bits addresses at the moment. - (init_bios_info): When getting a maximum available address from - the memory map, use a new unsigned long long variable MAX_ADDR - as the temporary variable instead of MEMTMP. This should allow - GRUB to detect at most 4TB. - -2000-06-18 OKUJI Yoshinori - - * docs/appendices.texi (FAQ): Added an question about Linux's - `mem=' option and the answer. - -2000-06-17 OKUJI Yoshinori - - * stage2/boot.c (load_image): Pass a mem option to Linux, only - if SRC has no substring "mem=". - -2000-06-17 OKUJI Yoshinori - - * stage2/compile: Removed. - * netboot/compile: Likewise. - * compile: New file. Copied from Automake. - -2000-06-16 OKUJI Yoshinori - - * stage2/boot.c (load_image): Don't remove the vga option after - parsing it. Suggested by Tim Riker. - -2000-06-15 OKUJI Yoshinori - - * stage2/asm.S (grub_halt): Use jmp instead of jc, if INT 15 - AX=5307h fails. - -2000-06-15 OKUJI Yoshinori - - * configure.in (AM_INIT_AUTOMAKE): Increase the version number. - I wish that 0.5.96 will not be released actually... - - * stage2/builtins.c (halt_func): New function. - (builtin_halt): New variable. - (reboot_func): New function. - (builtin_reboot): New variable. - (builtin_table): Added pointers to BUILTIN_HALT and - BUILTIN_REBOOT. - * stage2/asm.S (grub_halt): New function. - (grub_reboot): Likewise. - * stage2/shared.h (grub_halt): Declared. - (grub_reboot): Likewise. - * grub/asmstub.c (grub_reboot): New function. - (grub_halt): Likewise. - -2000-06-12 Gordon Matzigkeit - - * stage2/stage2.c (run_menu): Don't display the menu if the - timeout is zero. This makes for cleaner use as a noninteractive - bootloader. - -2000-06-11 OKUJI Yoshinori - - * docs/tutorial.texi (GNU/Linux): Added a caution about the - "mem=" option. - -2000-06-11 OKUJI Yoshinori - - * util/grub-install.in (convert): When $host_os is linux*, use - the expression 's%\([sh]d[a-z]\)[0-9]*$%\1%' instead of - 's%[0-9]*$%%', to get rid of the partition part. This fixes the - bug "/dev/fd0" -> "/dev/fd". (But don't you think the naming is - quite inconsistent with hard disks? Why not /dev/fd[a-z]?) - Report by Pavel Roskin. - -2000-06-08 OKUJI Yoshinori - - * docs/tutorial.texi (Network): The body is moved to ... - (General usage of network support): ... this new section. - (Diskless): New section. - * docs/user-ref.texi (General commands): Added a description - about the command "tftpserver". - -2000-06-08 OKUJI Yoshinori - - * netboot/main.c (decode_rfc1533) [GRUB]: Eliminate trailing - NULs in the NVT string for a configuration file name, if any. - (decode_rfc1533): Likewise, if Extensions Path is present, - eliminate the trailing NULs, if any. - Also, check the length carefully to ensure that EXTPATH can fit - in FNAME. - -2000-06-06 Jochen Hoenicke - - * stage2/fsys_reiserfs.c: Added journaling to reiser. - (reiserfs_journal_desc): new structure. - (reiserfs_journal_commit): likewise. - (reiserfs_journal_header): likewise. - (fsys_reiser_info): Added fields for journaling. - (journal_read): new function. - (journal_init) likewise. - (block_read): New function to read reiserfs blocks, which reads - from the journal if it contains newer versions. All relevant - devread calls are replaced with calls to this method. - (reiserfs_mount): Check for journaling super block and call - journal_init. - -2000-06-06 OKUJI Yoshinori - - * netboot/main.c (dhcprequest) [GRUB]: Set the length of the - Parameter Request List to (4 + 2). - Set the list to RFC1533_VENDOR_MAGIC and - RFC1533_VENDOR_CONFIGFILE in addition to the standard - parameters. - (decode_rfc1533) [GRUB]: If C is equal to - RFC1533_VENDOR_CONFIGFILE, copy the contents of the tag to - CONFIG_FILE. - If C is equal to RFC1533_VENDOR_MAGIC, increment - VENDOREXT_ISVALID. - * netboot/etherboot.h [GRUB] (RFC1533_VENDOR_CONFIGFILE): New - macro. Defined as 150. - -2000-06-03 OKUJI Yoshinori - - * stage2/asm.S (check_int13_extensions): Check the bitmap only - if FORCE_LBA is zero. - * stage2/bios.c (get_diskinfo): Get rid of the wrong check for - the bit 0 of DRP.FLAGS. Now the bitmap check is correctly - performed in the function check_int13_extensions. - -2000-06-02 OKUJI Yoshinori - - * docs/user-ref.texi (Invoking the grub shell): Added a caution. - Why don't so many people still understand that BIOS drive - numbering are different from OS device naming? How many cautions - and warnings should we write in the documentation? Sigh. - -2000-06-01 OKUJI Yoshinori - - From Chip Salzenberg: - * stage2/cmdline.c (enter_cmdline) [SUPPORT_DISKLESS]: Redisplay - network configuration after clearing screen, before first prompt. - - * stage2/cmdline.c: Include instead of "shared.h". - [SUPPORT_DISKLESS]: Include . - -2000-06-01 OKUJI Yoshinori - - * stage2/builtins.c (setup_func): Check if INSTALL_DRIVE is a - hard disk as well as IMAGE_DRIVE, before trying to install a - Stage 1.5. Reported by Pavel Roskin. - -2000-05-31 OKUJI Yoshinori - - * acinclude.m4 (grub_ASM_ABSOLUTE_WITHOUT_ASTERISK): New - function. Check if GAS requires absolute indirect calls/jumps - with NO asterisk. - * configure.in: Call grub_ASM_ABSOLUTE_WITHOUT_ASTERISK. - * acconfig.h (ABSOLUTE_WITHOUT_ASTERISK): New macro entry. - * netboot/pci.c (bios32_service) [!ABSOLUTE_WITHOUT_ASTERISK]: - Prefix the operand to "lcall" with `*'. - (pcibios_read_config_byte) [!ABSOLUTE_WITHOUT_ASTERISK]: - Likewise. - (pcibios_read_config_word) [!ABSOLUTE_WITHOUT_ASTERISK]: - Likewise. - (pcibios_read_config_dword) [!ABSOLUTE_WITHOUT_ASTERISK]: - Likewise. - (pcibios_write_config_byte) [!ABSOLUTE_WITHOUT_ASTERISK]: - Likewise. - (pcibios_write_config_word) [!ABSOLUTE_WITHOUT_ASTERISK]: - Likewise. - (pcibios_write_config_dword) [!ABSOLUTE_WITHOUT_ASTERISK]: - Likewise. - (check_pcibios) [!ABSOLUTE_WITHOUT_ASTERISK]: Likewise. - * stage2/asm.S (chain_stage1) [!ABSOLUTE_WITHOUT_ASTERISK]: - Prefix the operand to "ljmp" with `*'. - (chain_stage2) [!ABSOLUTE_WITHOUT_ASTERISK]: Likewise. - (big_linux_boot) [!ABSOLUTE_WITHOUT_ASTERISK]: Likewise. - -2000-05-29 Chip Salzenberg - - * stage2/shared.h (grub_memmove): Prototype to use void *. - * stage2/char_io.c (grub_memmove): Define likewise. - -2000-05-30 Gordon Matzigkeit - - * docs/user-ref.texi (Stage2 errors): Update error messages. - -2000-05-29 Pavel Roskin - - * util/grub-install.in: Fix a typo that prevented error messages - from appearing. - Copy and remove files individually and exit with an error as - soon as it fails. - Show $log_file if --debug was given on the command line. - -2000-04-19 Gordon Matzigkeit - - * stage2/cmdline.c (enter_cmdline): Don't give errors on empty - command lines. - - * stage2/common.c (err_list): Clean up wordings slightly. - -2000-05-29 OKUJI Yoshinori - - Based on a patch by Neal H Walfield : - * netboot/misc.c [GRUB] (inet_aton): Defined. - * netboot/main.c (arp_server_override): New function. - * netboot/etherboot.h [GRUB] (arp_server_override): Declared. - (inet_aton): Likewise. - * stage2/builtins.c (tftpserver_func): New function. - (builtin_tftpserver): New variable. - (builtin_table): Added a pointer to BUILTIN_TFTPSERVER. - -2000-05-28 OKUJI Yoshinori - - * stage2/asm.S (codestart): Fix a typo: DISKLESS_SUPPORT -> - SUPPORT_DISKLESS. - * stage2/nbloader.S: Fix the image length and the memory length - fields. They shouldn't contain the first sector for a tag. - Mmh..., that is unclear as far as I see the Net Boot Image - Proposal... - * stage2/shared.h (STACKOFF): Enclosed with parentheses. - (PROTSTACKINIT): Likewise. - -2000-05-27 OKUJI Yoshinori - - Add diskless support, mostly based on patches by Christoph - Plattner , but also based on a patch - by Chip Salzenberg for PXE. Of course, I've - modified both the patches thoroughly to adapt them to my - preference. - - * configure.in (--enable-diskless): New option. Set a - conditional DISKLESS_SUPPORT. - * stage2/Makefile.am (noinst_HEADERS): Added nbi.h. - (EXTRA_PROGRAMS): New variable. - (pkgdata_DATA) [DISKLESS_SUPPORT]: Added - nbgrub and pxegrub. - (noinst_DATA) [DISKLESS_SUPPORT]: Added nbloader, pxeloader and - diskless. - (noinst_PROGRAMS) [DISKLESS_SUPPORT]: Added nbloader.exec, - pxeloader.exec and diskless.exec. - (PXELOADER_LINK): New variable. - (BUILT_SOURCES) [DISKLESS_SUPPORT]: Added diskless_size.h. - (diskless_exec_SOURCES): New variable. - (diskless_exec_CFLAGS): Likewise. - (diskless_exec_LDFLAGS): Likewise. - (diskless_exec_LDADD): Likewise. - (diskless_size.h): New target. - (nbloader_exec_SOURCES): New variable. - (nbloader_exec_CFLAGS): Likewise. - (nbloader_exec_LDFLAGS): Likewise. - (nbloader_exec-nbloader.o): New dependency. - (nbgrub): New target. - (pxeloader_exec_SOURCES): new variable. - (pxeloader_exec_CFLAGS): Likewise. - (pxeloader_exec_LDFLAGS): Likewise. - (pxegrub): New target. - * stage2/asm.S (install_partition): Set to 0xFFFFFF instead of - 0x020000. What was the benefit from the previous setting? - (codestart) [SUPPORT_DISKLESS]: Don't move %dl to BOOT_DRIVE. - (boot_drive) [SUPPORT_DISKLESS]: Set to NETWORK_DRIVE instead of - zero. - * stage2/common.c: Include instead of "shared.h", - just for a cosmetic reason. - [SUPPORT_DISKLESS]: Include etherboot.h. - [SUPPORT_DISKLESS] (setup_diskless_environment): New internal - function. - (init_bios_info) [SUPPORT_DISKLESS]: Call - setup_diskless_environment after the memory initialization is - finished. Return if fails. - * stage2/nbloader.S: New file. - * stage2/pxeloader.S: Likewise. - * stage2/nbi.h: Likewise. - -2000-05-25 OKUJI Yoshinori - - * netboot/fsys_tftp.c (buf_fill): Warn when amazing things - happen. - (tftp_dir): Revert previous change. Don't use TFTP_MIN_PACKET - but calculate the appropriate length. - -2000-05-23 OKUJI Yoshinori - - * netboot/fsys_tftp.c (tftp_dir): Append "0\0" to the request - string, because the "tsize" option must be followed by zero, - according to RFC 2349. - -2000-05-22 OKUJI Yoshinori - - Synchronize the documentation with the code. - - * docs/user-ref.texi: Added ReiserFS as a supported filesystem. - Updated the descriptions about `password', `install', `kernel', - and `setup'. - Added a description about `lock'. - Added descriptions about ERR_UNALIGNED and ERR_PRIVILEGED. - Added a description about the option `--force-lba' of - the program `grub-install'. - * docs/tutorial.texi: Updated the subsection for NetBSD. - -2000-05-21 OKUJI Yoshinori - - * stage2/asm.S (set_int13_handler): Don't use MBI to get the - lower memory size. Instead, decrease it in the BIOS memory - directly and set %eax to it, since MBI.MEM_LOWER may not be the - same as [0x413] any longer due to the previous change. - - * grub/asmstub.c (CONVENTIONAL_MEMSIZE): Changed to 640 * 1024 - from 640. You didn't like the inconsistency between - EXTENDED_MEMSIZE and CONVENTIONAL_MEMSIZE, did you? - (get_memsize): Return CONVENTIONAL_MEMSIZE >> 10 instead of - CONVENTIONAL_MEMSIZE, if TYPE is zero. - (get_eisamemsize): Return EXTENDED_MEMSIZE >> 10 instead of - EXTENDED_MEMSIZE / 1024. Just a cosmetic change. - (MMAR_DESC_LENGTH): New macro. Defined as 20. - (get_mmap_entry): Define a new variable DESC_TABLE statically, - and copy the CONTth entry to *DESC if CONT is a correct index. - -2000-05-21 Chip Salzenberg - - * stage2/common.c (mmap_avail_at): New function, abstracted out - of init_bios_info, to scan E820 memory map. - (init_bios_info): Use mmap_avail_at for _both_ MBI.MEM_UPPER and - MBI.MEM_LOWER. - -2000-05-17 OKUJI Yoshinori - - Update the network support to Etherboot-4.6.1. - - * netboot/config.c (pci_nic_list) [INCLUDE_TULIP]: Added an - entry for Davicom 9102. - * netboot/epic100.c: Just copied. - * netboot/pci.h: Likewise. - * netboot/tulip.c: Likewise. - * netboot/etherboot.h (tftp): Change the type of the first - argument to const char * from char *. - * netboot/main.c (tftp): Likewise. - -2000-05-13 OKUJI Yoshinori - - * util/grub-install.in: If the program `cp' fails, exit with the - status code 1. Suggested by Pavel Roskin. - -2000-05-13 OKUJI Yoshinori - - From Pixel : - * stage2/pc_slice.h (PC_SLICE_TYPE_LINUX_EXTENDED): New macro. - (IS_PC_SLICE_TYPE_EXTENDED): Added a check for - PC_SLICE_TYPE_LINUX_EXTENDED. - -2000-05-05 OKUJI Yoshinori - - * stage2/common.c (init_bios_info) [!STAGE1_5]: When the memory - map is present, search the maximum for MEMTMP in bytes instead - of kilobytes and set EXTENDED_MEMORY to MEMTMP minus 1MB in - kilobytes. - -2000-05-05 OKUJI Yoshinori - - Ignore any memory holes when passing the maximum memory address - to non-Multiboot kernels (i.e. Linux and *BSD). - - * stage2/common.c [!STAGE1_5] (extended_memory): New global - variable. - (init_bios_info) [!STAGE1_5]: Change the type of CONT, MEMTMP - and ADDR to unsigned long from int. - Set EXTENDED_MEMORY to MBI.MEM_UPPER by default. - If MBI.MMAP_LENGTH is not zero, set EXTENDED_MEMORY to the - maximum available address, ignoring any memory holes. - If MBI.MMAP_LENGTH is zero but get_eisamemsize returns other - than -1, set EXTENDED_MEMORY to (CONT >> 10) + 0x3c00 if CONT is - non-zero, otherwise, set it to MEMTMP. - * stage2/shared.h [!STAGE1_5] (extended_memory): Declared. - * stage2/boot.c (load_image): Always pass the "mem=" option to a - Linux kernel, using EXTENDED_MEMORY instead of MBI.MEM_UPPER. - (bsd_boot): Use EXTENDED_MEMORY instead of MBI.MEM_UPPER. - -2000-04-30 OKUJI Yoshinori - - * stage1/stage1.S (message): Use lodsb instead of incw and movb. - From Andrew Clausen . - - * stage1/stage1.S (copy_buffer): Set %cx to 0x100 and use movsw - instead of movsb, since it is guaranteed that the region is - properly aligned. - -2000-04-29 OKUJI Yoshinori - - * stage2/builtins.c (setup_func): Use SECTOR_BITS instead of - SECTOR_SIZE to compute BLOCKSIZE. - -2000-04-26 OKUJI Yoshinori - - * netboot/depca.c: Copied from Etherboot-4.6.0. - -2000-04-23 OKUJI Yoshinori - - More security-related features. - - * stage2/builtins.c (auth): New global variable. - (configfile_func): Clear AUTH before jumping to cmain. - (lock_func): New function. - (builtin_lock): New variable. - (password_func): Make sure that LEN + 2 is less than or equal to - PASSWORD_BUFLEN, because now the password must be terminated - with double NULs, in order to permit an empty configuration file - name. - Copy LEN bytes from ARG to PASSWORD, instead of LEN + 1 bytes. - Clear the rest of the buffer PASSWORD. - (builtin_table): Added a pointer to BUILTIN_LOCK. - * stage2/common.c (err_list): Added an entry for ERR_PRIVILEGED. - * stage2/stage2.c (run_menu): If AUTH is true, show the messages - for a non-password configuration, even if PASSWORD is not NULL. - Likewise, if AUTH is true, allow the user to use privileged - instructions (such as `c'). - If a correct password is entered, check if *PPTR is NUL or not. - If it is NUL, set AUTH to 1 and go to the label restart, - otherwise, copy PPTR to NEW_FILE, clear AUTH, and return. - * stage2/shared.h (grub_error_t): Added a new constant - ERR_PRIVILEGED. - (auth): Declared. - -2000-04-23 OKUJI Yoshinori - - * docs/user-ref.texi (Command-line-specific commands): Don't use - the command @var for the argument "file" to the command - "configfile" on the definition. - -2000-04-22 OKUJI Yoshinori - - Update the network support to Etherboot 4.5.8. - - * configure.in (--enable-3c590): New option. - (--enable-3c595): Likewise. - (--enable-depca): Likewise. - (--enable-lance): Likewise. - (--enable-ns8390): Likewise. - (--enable-ntulip): Likewise. - (--enable-lancepci): Removed. - (--enable-nepci): Likewise. - (--enable-otulip): Likewise. - (--enable-smc9000): The duplicated one is named to ... - (--enable-smc9000-scan): ... this. This was a typo, perhaps. - - * netboot/Makefile.am (libdrivers_a_SOURCES): Removed - byteorder.h, if.h, netboot_config.h and netdevice.h, and added - cards.h. - (EXTRA_libdrivers_a_SOURCES): Removed ntulip.c and tulip.h, and - added 3c595.c, 3c595.h, depca.c, otulip.c and otulip.h. - (libdrivers_a_CFLAGS): Define FSYS_TFTP as 1 instead of empty. - (EXTRA_DIST): Removed ntulip.txt, and added cs89x0.txt and - tulip.txt. - (3c595_drivers): New variable. - (depca_drivers): Likewise. - (lance_drivers): Removed lancepci.o and added lance.o. - (ns8390_drivers): Removed nepci.o and added ns8390.o. - (ntulip_drivers): Deleted. - (otulip_drivers): New variable. - ($(3c595_drivers)): New target. - ($(depca_drivers)): Likewise. - ($(ntulip_drivers)): Deleted. - ($(otulip_drivers)): New target. - (3c590_o_CFLAGS): New variable. - (3c595_o_CFLAGS): Likewise. - (depca_o_CFLAGS): Likewise. - (lancepci_o_CFLAGS): Deleted. - (lance_o_CFLAGS): New variable. - (nepci_o_CFLAGS): Deleted. - (ns8390_o_CFLAGS): New variable. - (ntulip_o_CFLAGS): Deleted. - (otulip_o_CFLAGS): New variable. - - * netboot/3c90x.c: Updated to Etherboot-4.5.8. - * netboot/3c90x.txt: Likewise. - * netboot/cs89x0.c: Likewise. - * netboot/cs89x0.h: Likewise. - * netboot/eepro100.c: Likewise. - * netboot/epic100.c: Likewise. - * netboot/epic100.h: Likewise. - * netboot/i82586.c: Likewise. - * netboot/lance.c: Likewise. - * netboot/linux-asm-io.h: Likewise. - * netboot/linux-asm-string.h: Likewise. - * netboot/nic.h: Likewise. - * netboot/ns8390.c: Likewise. - * netboot/ns8390.h: Likewise. - * netboot/pci.c: Likewise. - * netboot/pci.h: Likewise. - * netboot/rtl8139.c: Likewise. - * netboot/sk_g16.c: Likewise. - * netboot/sk_g16.h: Likewise. - * netboot/smc9000.c: Likewise. - * netboot/smc9000.h: Likewise. - * netboot/tiara.c: Likewise. - * netboot/tulip.c: Likewise. - * netboot/via-rhine.c: Likewise. - - * netboot/config.c: Updated to Etherboot-4.5.8 and modified (see - below). - [GRUB] (print_config): Undefined. - (eth_probe) [GRUB]: If PROBED is true, do nothing. Otherwise, - clear NETWORK_READY and ARPTABLE, set ROM to ROM_INFO_LOCATION, - and set PROBED to 1 if succeeds. - * netboot/etherboot.h: Likewise, - (GRUB): New macro. - [GRUB]: Include . - [GRUB] (NO_DHCP_SUPPORT): Undefined. - [GRUB] (RELOC): Defined as zero. - [GRUB] (INTERNAL_BOOTP_DATA): Defined as one. - [GRUB] (USE_INTERNAL_BUFFER): Likewise. - [GRUB] (BACKOFF_LIMIT): Defined as 7. - [GRUB] (CTRL_C): New macro. - [GRUB] (print_network_configuration): Declared. - [GRUB] (ip_abort): Likewise. - [GRUB] (network_ready): Likewise. - * netboot/fsys_tftp.c: Don't include . - (isocket): Renamed to ... - (iport): ... this. - (osocket): Renamed to ... - (oport): ... this. - (bcounter): New variable. - (buf_fill): When checking the block order, see BCOUNTER as well - as BLOCK. - Don't process a packet, if BLOCK minus PREVBLOCK is not 1, - instead of if BLOCK is less than or equal to PREVBLOCK. - Increment BCOUNTER after reseting RETRY. - (send_rrq): Clear BCOUNTER. - Call await_reply with AWAIT_QDRAIN. - * netboot/main.c: Don't include . - (dhcpdiscover): Made const. - (dhcprequest): Likewise. Updated the contents. - (broadcast): Made const. - (udp_transmit): Copied. - (tftp): Likewise. - (bootp): Likewise. - (rarp): Likewise. - (await_reply): Likewise. - (decode_rfc1533): Likewise. - (rfc951_sleep): Likewise. - (cleanup_net): Likewise. - * netboot/misc.c (sleep): Copied. - (twiddle): Likewise. - (getdec): Likewise. - * netboot/osdep.h: Copied and modified (see below). - [GRUB] (ETHERBOOT32): Used the same definition as Linux and - FreeBSD. - [GRUB] (ntohl): Likewise. - [GRUB] (htonl): Likewise. - [GRUB] (ntohs): Likewise. - [GRUB] (htons): Likewise. - [GRUB] (swap32): Likewise. - [GRUB] (swap16): Likewise. - [GRUB]: Include "linux-asm-io.h". - - * netboot/byteorder.h: Removed. - * netboot/if.h: Likewise. - * netboot/netboot_config.h: Likewise. - * netboot/netdevice.h: Likewise. - * netboot/ntulip.c: Likewise. - * netboot/ntulip.txt: Likewise. - * netboot/tulip.h: Likewise. - - * netboot/3c595.c: New file. Copied from Etherboot-4.5.8. - * netboot/3c595.h: Likewise. - * netboot/cards.h: Likewise. - * netboot/cs89x0.txt: Likewise. - * netboot/depca.c: Likewise. - * netboot/otulip.c: Likewise. - * netboot/otulip.h: Likewise. - * netboot/tulip.txt: Likewise. - -2000-02-29 Jochen Hoenicke - - * stage2/common.c (err_list): Added message for ERR_UNALIGNED. - * stage2/shared.h [!STAGE1_5] (disk_read_hook,disk_read_func): New - parameters offset and length. - (ERR_UNALIGNED): New error code. - * stage2/disk_io.c (rawread) [!STAGE1_5]: Call disk_read_func with - offset and length. - * stage2/builtin.c (disk_read_print_func): Print offset and length. - (blocklist_func): Print detailed byte ranges for partial sectors. - (install_func): Detect partial sectors and print error message. - -2000-04-18 Pavel Roskin - - * util/grub-install.in: Don't use `!' in `test' for more - portability. - Don't use `for' without `in' for compatability with ash. - Check install_device before running grub if possible. Added - error messages if install_device is not set or not unique. - Exit if mkdir fails. - Add a message about successful installation. - Remove unneeded backslash in the final message. - (convert): use `test -b' instead of `test -e' because ash - doesn't understand the later. Correct error message accordingly. - -2000-04-17 OKUJI Yoshinori - - The user doesn't have to recompile GRUB for his/her buggy BIOS - any longer. It is configurable to ignore the LBA support bitmap - at the installation time. - - * stage1/stage1.S (force_lba): New variable. - (stage2_address): Moved forwards, to align some variables in - natural boundaries. - (real_start): Check if FORCE_LBA is non-zero, if so, jump to - skip_lba_bitmap_check, otherwise, check if bit 0 of the support - bitmap is non-zero. - Don't use #ifdef for CHECK_LBA_SUPPORT_BITMAP. - (skip_lba_bitmap_check): New label. - * stage1/stage1.h (COMPAT_VERSION_MINOR): Set to 1. - (STAGE1_FORCE_LBA): New macro. - (STAGE1_STAGE2_ADDRESS): Set to 0x42. - (STAGE1_STAGE2_SECTOR): Set to 0x44. - (STAGE1_STAGE2_SEGMENT): Set to 0x48. - * stage2/asm.S (force_lba): New variable. - * stage2/bios.c (get_diskinfo): Don't use #ifdef for - CHECK_LBA_SUPPORT_BITMAP. Instead, check if FORCE_LBA is - non-zero. If so, don't check the bit 0 of DRP.FLAG. - * stage2/builtins.c (install_func): Check if a new option - `--force-lba' is specified. If specified, set IS_FORCE_LBA to 1 - and set ARG to a value returned by skip_to. Otherwise, - IS_FORCE_LBA is zero. - Set the "force LBA" flag in STAGE1_BUFFER (the offset is - STAGE1_FORCE_LBA) to IS_FORCE_LBA. - Likewise, set the "force LBA" flag in STAGE2_SECOND_BUFFER - (the offset is STAGE2_FORCE_LBA) to IS_FORCE_LBA. - If IS_STAGE1_5 is true, then modify the Stage2, regardless of - the presence of the option REAL_CONFIG_FILE. Set the "force LBA" - flag in SCRATCHADDR (the offset is STAGE2_FORCE_LBA) to - IS_FORCE_LBA. - (builtin_install): Added description about `--force-lba' into - the docs. - (setup_func): Check if `--force-lba' is specified in ARG. If - specified, set IS_FORCE_LBA to 1 and set ARG to a value returned - by skip_to. Otherwise, IS_FORCE_LBA is zero. - If IS_FORCE_LBA is true, prepend "--force-lba " to CMD_ARG. - (builtin_setup): Added descriptions about `--force-lba' into the - docs. - * stage2/shared.h (STAGE2_FORCE_LBA): New macro. - (STAGE2_VER_STR_OFFS): Set to 0xe. - (force_lba): Declared. - * util/grub-install.in (force_lba): New variable. Set to an - empty sting by default. - (usage): Added a description about `--force-lba'. - (--force-lba): Checked in the option handling code. If - specified, set FORCE_LBA to "--force-lba". - Run the command "setup" with $force_lba added before - $install_drive. - * configure.in (--disable-lba-support-bitmap): Removed. - -2000-04-15 OKUJI Yoshinori - - * util/grub-install.in (root_device): Append `/' to ${rootdir}, - since ROOTDIR may be empty. Reported by Satoshi Nagayasu - . - -2000-04-15 Jochen Hoenicke - - * configure.in: Added --disable-reiserfs option. - * stage2/Makefile.am (libgrub_a_SOURCES): Added fsys_reiserfs.c. - (libgrub_a_CFLAGS): Added -DFSYS_REISERFS=1. - (pkgdata_DATA): Added reiserfs_stage1_5. - (noinst_PROGRAMS): Added reiserfs_stage1_5.exec. - (pre_stage2_exec_SOURCES): Added fsys_reiserfs.c. - (reiserfs_stage1_5_exec_SOURCES): New variable. - (reiserfs_stage1_5_exec_CFLAGS): Likewise. - (reiserfs_stage1_5_exec_LDFLAGS): Likewise. - * stage2/disk_io.c (fsys_table): Added reiserfs entry. - * stage2/filesys.h (FSYS_REISERFS_NUM): New macro. - [FSYS_REISERFS] (reiserfs_mount, reiserfs_read, reiserfs_dir, - reiserfs_embed): Declare external function from fsys_reiserfs.c. - [!NUM_FSYS] (NUM_FSYS): Added FSYS_REISERFS_NUM. - * stage2/builtins.c (setup_func): Added reiserfs to - STAGE1_5_MAP. - * stage2/shared.h (STAGE2_ID_REISERFS_STAGE1_5): New macro. - [STAGE1_5] [FSYS_REISERFS] (STAGE2_ID): Defined to - STAGE2_ID_REISERFS_STAGE1_5. - * stage2/fsys_reiserfs.c: New file. - - * stage2/builtins.c (embed_func): Call open_device instead of - open_partition. - Don't check if the filesystem is FFS. Instead, check if - FSYS_TABLE[FSYS_TYPE].EMBED_FUNC is NULL and, if not, call it. - (find_func): When CURRENT_SLICE is not a BSD slice, check if the - file can be opened, only if open_device succeeds. - * stage2/filesys.h (fsys_table): New entry embed_func. - (ffs_embed): Declared. - * stage2/disk_io.c (fsys_table): Fill embed_func entries. The - entry for FFS is ffs_embed and the others are NULLs. - * stage2/fsys_ffs.c (ffs_embed): New function. - - * stage2/shared.h (SECTOR_SHIFT): New constant with - (1 << SECTOR_SHIFT) == SECTOR_SIZE. - * stage2/shared.h [!NO_BLOCK_FILES] (block_files): No longer - extern. - * stage2/disk_io.c [!NO_BLOCK_FILES] (block_files): Likewise. - (rawread, devread): Use SECTOR_BITS. - (rawread): Fixed calculation of BUFADDR if an error occured. Set - it to BUFFERADDR + BYTE_OFFSET instead of BUFFERSEG + - BYTE_OFFSET. - (grub_close) [!NO_BLOCK_FILES]: If BLOCK_FILE is non-zero, - return immediately. - (grub_close): Don't check if FSYS_TYPE is NUM_FSYS. - * stage2/fsys_fat.c (log2): New inline function. - (fat_mount): Use log2 instead of calculating the size/bit by a - loop. - -2000-04-12 OKUJI Yoshinori - - * configure.in: Use AC_PATH_PROG instead of AC_PATH_TOOL, - because I don't want to use the CVS version. Now you can use - autoconf 2.13. - -2000-04-10 OKUJI Yoshinori - - * stage2/stage2.c (run_menu): In the case where C is `o', check - if ENTRYNO is less than 11. If not, increase FIRST_ENTRY instead - of ENTRYNO. Reported by Pixel . - -2000-04-09 OKUJI Yoshinori - - * stage1/depcomp: Removed, because it makes `make dist' - unworkable. - - For developers: Don't run automake with --add-missing. Instead, - you should specify --force-missing. If you really want to add a - script from automake, copy it at hand. *sigh* - -2000-04-05 OKUJI Yoshinori - - * stage2/builtins.c (kernel_func): Added missing ``size'' - arguments into `grub_memcmp's. Reported by Christoph Plattner - . - - From Torsten Duwe : - * stage2/boot.c (load_initrd): Mask the address with 0x3FFFFFFF - instead of 0xFFFFFFFF to place the initrd below 1GB. - (load_image): In Linux boot, add the option "mem=" only if more - than 64MB are present. - * grub/asmstub.c [__linux__]: Include for - CDROM_GET_CAPABILITY. - [__FreeBSD__ || __NetBSD__ || __OpenBSD__]: Include - for CDIOCCLRDEBUG. - (check_device) [__linux__] [CDROM_GET_CAPABILITY]: If ioctl for - CDROM_GET_CAPAIBILITY succeeds, return zero. - [__FreeBSD__ || __NetBSD__ || __OpenBSD__] [CDIOCCLRDEBUG]: If - ioctl for CDIOCCLRDEBUG succeeds, return zero. - - * stage2/boot.c (load_initrd): Subtract 0x1000 (one page size) - from MOVETO, to avoid a Linux 2.3.xx's bug. - -2000-04-03 OKUJI Yoshinori - - Add a dirty hack into the kernel loader so that the user can - force GRUB to load NetBSD ELF kernels. The support code is - mostly stolen from a patch by Pavel Roskin. - - * stage2/boot.c (load_image): Added an optional argument - SUGGESTED_TYPE. - If BUFFER is a bootable ELF image and SUGGESTED_TYPE is - KERNEL_TYPE_NETBSD, then load it as an ELF image and set STR2 to - "NetBSD" and TYPE to SUGGESTED_TYPE. - If the image is a Linux kernel and SUGGESTED_TYPE is not - KERNEL_TYPE_NONE, make sure that SUGGESTED_TYPE matches up to - the Linux kernel type. - If TYPE is KERNEL_TYPE_NETBSD, set MEMADDR to - RAW_ADDR (phdr->paddr & 0xFFFFFF) like FreeBSD. - If SUGGESTED_TYPE is not KERNEL_TYPE_NONE, make sure that - SUGGESTED_TYPE is equal to TYPE. - (bsd_boot): If TYPE is not KERNEL_TYPE_FREEBSD (i.e. NetBSD or - OpenBSD) and the bit MB_INFO_AOUT_SYMS is set, set END_MARK to - MBI.SYMS.A.ADDR + 4 + MBI.SYMS.A.TABSIZE + MBI.SYMS.A.STRSIZE. - If the bit is clear, set END_MARK to 0. - Pass END_MARK to *ENTRY_ADDR instead of directly calculating the - end of symbols. - * stage2/shared.h (load_image): Added the argument - SUGGESTED_TYPE to the prototype. - * stage2/builtins.c (kernel_func): Added a new option, - `--type=TYPE'. Check if ARG is started with "--type=". - If so, set SUGGESTED_TYPE to KERNEL_TYPE_NETBSD, - KERNEL_TYPE_FREEBSD, KERNEL_TYPE_NETBSD, KERNEL_TYPE_LINUX, - KERNEL_TYPE_BIG_LINUX, KERNEL_TYPE_MULTIBOOT if ARG is "netbsd", - "freebsd", "openbsd", "linux", "biglinux", "multiboot", - respectively. Otherwise, set ERRNUM to ERR_BAD_ARGUMENT and - return 1. Set KERNEL_ARG to a string after the option. - (builtin_kernel): Added a description about the new option. - -2000-04-03 OKUJI Yoshinori - - * stage2/stage2.c (run_menu) [GRUB_UTIL]: Removed a nested - "#ifdef GRUB_UTIL" ... "#endif". - * stage2/builtins.c (unhide_func): Don't modify SAVED_DRIVE or - SAVED_PARTITION. - (hide_func): Likewise. - * stage2/disk_io.c (set_partition_hidden_flag): Use - CURRENT_DRIVE and CURRENT_PARTITION instead of SAVED_DRIVE and - SAVED_PARTITION. Check if bit 7 in CURRENT_DRIVE is non-zero - instead of if CURRENT_DRIVE is non-zero. - - * grub/asmstub.c (init_device_map): Change the message - "Probe devices..." to "Probing devices...". Suggested by Neal H - Walfield. - - * stage2/pc_slice.h (PC_SLICE_TYPE_HIDDEN_FLAG): Move the - definition before the PC partition type definitions. - (IS_PC_SLICE_TYPE_FAT): Clear the hidden flag in TYPE before - checking if TYPE is either of the FAT partition types. Reported - by Thomas Schweikle . - -2000-04-02 OKUJI Yoshinori - - * stage2/builtins.c (setup_func): Don't read a stage 1.5 to get - the size. Use FILEMAX instead. - If embed_func fails (i.e. ERRNUM is non-zero), goto fail. - -2000-04-02 OKUJI Yoshinori - - Suggested by Neal H Walfield : - * stage2/common.c (init_bios_info): Removed a nested - "#ifndef STAGE1_5" ... "#endif". - * util/grub-install.in: Quote most of the references to - shell variables by double quotation marks. - (usage): Added a description about the argument. - * stage2/builtins.c (setup_func): Change each of the messages - when running embed_func and install_func. "Run" -> "Running". - If install_func succeeds, print a message ("Done."). - - From Frank Mehnert : - * stage2/char_io.c (convert_to_ascii) [!STAGE1_5]: Accept 'X' - and 'b' as well. If C is 'X' or 'b', then set MULT to 16. - (grub_printf): Set a new variable MASK to 0xFFFFFFFF by default. - Mask *DATAPTR with MASK when calling convert_to_ascii. - (grub_printf) [!STAGE1_5]: Added 'b' and 'X'. If C is 'b', set - MASK to 0xFF and fall through to the case 'u'. 'X' is the same - as 'x'. - - From Josip Rodin : - * grub.texi: Several awkward English sentences are fixed. - * tutorial.texi: Likewise. - * user-ref.texi: Likewise. - * appendices.texi: Likewise. - -2000-03-27 OKUJI Yoshinori - - * stage1/depcomp: New file. Automake forces to install it. This - is a known bug, so I will remove this when Tom fixes it. - * configure.in (AM_INIT_AUTOMAKE): Don't get the package name - and the version from debian/changelog. This is a workaround. - -2000-03-20 OKUJI Yoshinori - - * stage2/Makefile.am (nodist_pkgdata_DATA): Renamed to ... - (pkgdata_DATA): ... this. DATA is not distributed by default. - (CLEANFILES): Delete the first one. I don't know why this - variable was duplicated. - Set to $(pkgdata_DATA) instead of $(nodist_pkgdata_DATA). - (start_exec_DEPENDENCIES): Removed. This doesn't make sense. - (start_exec-start.o): New rule. - * depcomp: New file. Copied from automake. - * missing: Updated from automake. - -2000-03-15 OKUJI Yoshinori - - * netboot/Makefile.am (EXTRA_libdrivers_a_SOURCES): 3c89x0.h -> - cs89x0.h. Just a typo. - -2000-03-10 Gordon Matzigkeit - - * debian/rules: Strip mbchk. - - * debian/postinst: Fix up /usr/doc symlink creation. - -2000-03-01 OKUJI Yoshinori - - * netboot/fsys_tftp.c (tftp_dir): Add BUF_READ into FILEMAX - after BUF_EOF becomes non-zero. Reported by Per Lundberg. - -2000-03-01 OKUJI Yoshinori - - * stage2/builtins.c (color_func): Return 1 if safe_parse_maxint - returns zero instead of non-zero. Reported by Magnus Holmberg - . - -2000-02-29 OKUJI Yoshinori - - * grub/asmstub.c [__linux__]: Include for the - macro MAJOR. From Kalle Olavi Niemitalo . - -2000-02-27 OKUJI Yoshinori - - * docs/tutorial.texi (Network): New chapter. - -2000-02-26 OKUJI Yoshinori - - * docs/help2man: Upgraded to 1.020. - * docs/grub.8: Regenerated. - * docs/grub-install.8: Likewise. - * docs/mbchk.1: Likewise. - - * docs/tutorial.texi (Boot): Rewritten heavily. Added the notes - on FreeBSD, NetBSD, OpenBSD, DOS/Windows and SCO UnixWare. - * docs/menu.lst: Load "/boot/loader" instead of "/kernel" in the - FreeBSD entry. This is consistent with the documentation. - -2000-02-25 OKUJI Yoshinori - - * netboot/fsys_tftp.c (tftp_read): Set BUF_READ to zero if - FILEPOS is less than SAVED_FILEPOS, before calling buf_fill. - Don't discard all of the copied data so that we can move FILEPOS - backwards cheaply. Now SAVED_FILEPOS indicates the file position - corresponding to the first byte of BUF. If (FILEPOS - - SAVED_FILEPOS) is greater than (FSYS_BUFLEN / 2), move the data - forwards and add (FSYS_BUFLEN / 2) into SAVED_FILEPOS and - subtract the same value from BUF_READ. - -2000-02-24 OKUJI Yoshinori - - * stage2/disk_io.c [!STAGE1_5] (print_fsys_type): Mask - CURRENT_SLICE with 0xFF when printing the partition type. - - * grub/asmstub.c [__linux__]: Include for the - definition FLOPPY_MAJOR. - (check_device) [__linux__]: Skip the HDIO_GETGEO ioctl if the - major number of ST.ST_RDEV is FLOPPY_MAJOR. - -2000-02-21 OKUJI Yoshinori - - * stage2/disk_io.c (check_BSD_parts) [!STAGE1_5]: Use the term - "BSD sub-partition" instead of "BSD slice" for consistency. - - * stage2/builtins.c (boot_func): Copy the partition table to - BOOT_PART_TABLE instead of (BOOTSEC_LOCATION + - BOOTSEC_PART_OFFSET). Don't use grub_memmove, but copy it - directly, since memcheck is too strict. - * stage2/disk_io.c (real_open_partition) [!STAGE1_5]: Set - CUR_PART_ADDR to (BOOT_PART_TABLE + (i << 4)). - * stage2/shared.h (BOOT_PART_TABLE): New macro. - (chain_stage1): Change the types of all the arguments to - unsigned long. - (chain_stage2): Likewise. - * grub/asmstub.c (chain_stage1): Adjusted to the prototype. - (chain_stage2): Likewise. - -2000-02-21 OKUJI Yoshinori - - * stage2/disk_io.c (check_BSD_parts) [!STAGE1_5]: If the BSD - label is invalid, print a message with the partition type in the - case where FLAGS is non-zero and DO_COMPLETION is zero. - -2000-02-20 OKUJI Yoshinori - - * docs/user-ref.texi (Command-line-specific commands): Added a - description about "cmp". - * docs/appendices.texi (Reporting bugs): Rewritten. - -2000-02-20 OKUJI Yoshinori - - Update the netboot code to Etherboot 4.4.3. - - * netboot/netboot_config.h: Copied from etherboot-4.4.3. - * netboot/cs89x0.h: Likewise. - * netboot/cs89x0.c: Likewise. - * netboot/i82586.c: Likewise. - * netboot/lance.c: Likewise. - * netboot/linux-asm-string.h: Likewise. - * netboot/nic.h: Likewise. - * netboot/ntulip.c: Likewise. - * netboot/osdep.h: Likewise. - * netboot/pci.h: Likewise. - * netboot/pci.c: Likewise. - * netboot/rtl8139.c: Likewise. - * netboot/tiara.c: Likewise. - -2000-02-19 OKUJI Yoshinori - - * stage2/builtins.c (cmp_func): New function. - (builtin_cmp): New variable. - (builtin_table): Added a pointer to BUILTIN_CMP. - - * stage2/fsys_fat.c (fat_mount): Check if BPB.SECTS_PER_CLUST is - zero after reading the BPB to avoid zero division. - -2000-02-18 OKUJI Yoshinori - - * stage2/disk_io.c [!STAGE1_5] (make_saved_active): Make sure - that SAVED_PARTITION is not an extended partition. - If SAVED_DRIVE is not a hard disk drive, set ERRNUM to - ERR_DEV_VALUES and return zero. - - * netboot/3c59x.c: Removed. - * netboot/Makefile.am (EXTRA_libdrivers_a_SOURCES): Deleted - 3c59x.c. - (3c59x_drivers): Deleted. - (3c59x_o_CFLAGS): Likewise. - * configure.in (--enable-3c59x): Likewise. - -2000-02-17 OKUJI Yoshinori - - * configure.in (--enable-3c90x): Add -DINCLUDE_3C90X=1 instead - of -DINCLUDE_3C90x=1. This was just a typo. Reported by Per - Lundberg. - -2000-02-17 Jochen Hoenicke - - * stage2/fsys_fat.c (fat_read): Forgot to increase BUF. - (fat_dir): Use fat_read instead of grub_read; this makes - setting the FSMAX unnecessary. - (fat_mount): FSMAX is no longer set. - -2000-02-16 Jochen Hoenicke - - * stage2/char_io.c (grub_isspace): Make carriage return a white - space. - - * stage2/fsys_fat.c (fat_dir): Long filename support. - (NAME_BUF): New macro. - * stage2/fat.h (FAT_LONGDIR_ID, FAT_LONGDIR_ALIASCHECKSUM, - FAT_ATTRIB_LONGNAME): New Macros. - - * stage2/fsys_fat.c (fat_create_blocklist): Deleted, instead - fat_read is implemented. - (fat_read): new function. - * stage2/disk_io.c (fsys_table): Use fat_read. - * stage2/filesys.h: Declare fat_read, remove NO_BLOCK_FILES - hack. - * stage2/Makefile.am: Compile fat_stage1_5 with - -DNO_BLOCK_FILES=1. - - * stage2/fat.h (fat_bpb): New structure describing bpb. - (FAT_CVT_U16): New macro. - (FAT_BPB_CHECK_SIG, FAT_BPB_NUM_SECTORS, - FAT_BPB_BYTES_PER_SECTOR, FAT_BPB_SECT_PER_CLUS, FAT_BPB_NUMFAT, - FAT_BPB_RESERVED_SECTORS, FAT_BPB_FAT_SECTORS_16, - FAT_BPB_FAT_SECTORS_32, FAT_BPB_IS_FAT32, FAT_BPB_FAT_SECTORS, - FAT_BPB_FAT_START, FAT_BPB_ROOT_DIR_CLUSTER, - FAT_BPB_HIDDEN_SECTORS, FAT_BPB_ROOT_DIR_START, - FAT_BPB_ROOT_DIR_LENGTH, FAT_BPB_DATA_OFFSET, - FAT_BPB_NUM_CLUST): Macros removed. - * stage2/fsys_fat.c (fat_superblock): New structure containing - all info about currently mounted filesystem. - (FAT_SUPER): New Macro. - (BPB): Macro removod. - (fat_mount): Use fat_bpb structure, fill FAT_SUPER. - (fat_read, fat_dir): Use FAT_SUPER info. - -2000-02-16 OKUJI Yoshinori - - Pass the boot partition information to a chain-loader, in the - partition table area of the loader, instead of right before the - loaded address. Reported by takehiro@coral.ocn.ne.jp (Takehiro - Suzuki). - - * stage2/builtins.c (chainloader_func): Embed the partition - table of the boot drive in the partition table area of the - chain-loader, if the boot drive is a hard disk drive. - Pass BOOT_PART_ADDR instead of (BOOTSEC_LOCATION - 16) as the - third argument for the function chain_stage1. - * stage2/disk_io.c [!STAGE1_5] (boot_part_addr): New variable. - [!STAGE1_5] (boot_part_offset): Likewise. - [!STAGE1_5] (cur_part_offset): Likewise. - [!STAGE1_5] (cur_part_addr): Likewise. - [!STAGE1_5] (cur_part_desc): Removed. - (real_open_partition) [!STAGE1_5]: Set CUR_PART_OFFSET and - CUR_PART_ADDR to PART_OFFSET and (BOOTSEC_LOCATION + - PC_SLICE_OFFSET + (i << 4)), respectively. - [!STAGE1_5] (set_bootdev): Set BOOT_PART_OFFSET and - BOOT_PART_ADDR to CUR_PART_OFFSET and CUR_PART_ADDR, - respectively. - * stage2/shared.h (boot_part_addr): Declared. - (boot_part_offset): Likewise. - -2000-02-12 OKUJI Yoshinori - - * stage2/builtins.c (geometry_func): Attempt to read the first - sector to examine if LBA mode is really supported. - - * netboot/fsys_tftp.c (buf_fill) [TFTP_DEBUG]: Added some debug - messages. - (send_rrq) [TFTP_DEBUG]: Likewise. - (tftp_read) [TFTP_DEBUG]: Likewise. - (tftp_dir) [TFTP_DEBUG]: Likewise. - (tftp_close) [TFTP_DEBUG]: Likewise. - (tftp_read): Call buf_fill with the argument 1 first, if FILEPOS - has been moved backwards, and use grub_memmove for copying - SAVED_TP to TP instead of a direct assignment. - If send_rrq fails, set ERRNUM to ERR_WRITE instead of ERR_READ. - Check if BUF_READ is zero instead of if BUF_EOF is non-zero at - the end of the loop. - (tftp_dir): Set ERRNUM to ERR_WRITE instead of ERR_READ, if - send_rrq fails. - Save TP and LEN in SAVED_TP and SAVED_LEN respectively before - buf_fill instead of after it, because it destroys the contents - of TP. - * netboot/main.c (print_network_configuration): The order of the - arguments for grub_sprintf in the local function sprint_ip_addr - is reversed. - - * configure.in (--enable-packet_retransmission): Renamed to ... - (--disable-packet-retransmission): ... this. Assume that a - network is congested by default. - -2000-02-11 OKUJI Yoshinori - - From Pavel Roskin: - * stage2/shared.h [!GRUB_SHARED_HEADER] (GRUB_SHARED_HEADER): - Defined. - [GRUB_SHARED_HEADER]: Don't declare or define anything. - - * netboot/main.c (print_network_configuration): New function. - (await_reply): Check for Control-C instead of ESC, because GRUB - already uses ESC for another purpose. - (rfc951_sleep): Check for the key input in the loop. If - Control-C is pushed, return immediately. - * netboot/etherboot (print_network_configuration): Declared. - (CTRL_C): New macro. - (ESC): Undefined. - * netboot/config.c (eth_probe): Clear ARPTABLE after clearing - NETWORK_READY. - * stage2/builtins.c (bootp_func): Call - print_network_configuration if bootp succeeds. - (rarp_func): Call print_network_configuration if rarp succeeds. - -2000-02-11 OKUJI Yoshinori - - From Per Lundberg : - * docs/multiboot.texi: Added graphics support. - -2000-02-10 OKUJI Yoshinori - - * docs/multiboot.texi (Top): Downgrade the version to 0.6.90, - since we need more work to release it as 0.7. - -2000-02-10 OKUJI Yoshinori - - * stage2/Makefile.am [NETBOOT_SUPPORT] (STAGE2_COMPILE): Added - -I$(top_srcdir)/netboot and -DSUPPORT_NETBOOT=1. - * stage2/builtins.c (bootp_func): New function. - (dhcp_func): Likewise. - (rarp_func): Likewise. - (builtin_bootp): New variable. - (builtin_dhcp): Likewise. - (builtin_rarp): Likewise. - (builtin_table): Added pointers to BUILTIN_BOOTP, BUILTIN_DHCP - and BUILTIN_RARP. - * docs/user-ref.texi (General Commands): Added descriptions - about "bootp", "dhcp" and "rarp". - - * netboot/main.c (bootp) [!NO_DHCP_SUPPORT]: Added casts to - suppress gcc warnings. - (decode_rfc1533) [!NO_DHCP_SUPPORT]: Likewise. - * netboot/3c90x.c: Include the local "pci.h" instead of - even if __FreeBSD__ is undefined. - -2000-02-09 OKUJI Yoshinori - - From Jochen Hoenicke: - * stage2/fsys_fat.c (fat_create_blocklist): The previous change - is reversed. Set FIRST_FAT_ENTRY to a unsigned long value in - FAT_BUF + (NEW_MAPBLOCK - MAPBLOCK) instead of a unsigned short - value. Mask FIRST_FAT_ENTRY with 0xFFF if FAT_SIZE is equal to - 3, whether the bit 0 of LAST_FAT_ENTRY is set or not. - - * netboot/config.c (eth_probe): If PROBED is set to non-zero, - return 1 without probing ethernet cards. Clear NETWORK_READY. If - *T->ETH_PROBE return sucessfully, set PROBED to 1. - * netboot/main.c (rarp): Call eth_probe and return zero if - fails. Clear NETWORK_READY at first, and set NETWORK_READY to 1 - if RETRY is less than MAX_ARP_RETRIES. If IP_ABORT is non-zero, - return zero instead of one. - (bootp): Call eth_probe and return zero if fails. Clear - NETWORK_READY at first, and set NETWORK_READY to 1 if - await_reply returns successfully. - (bootp) [T509HACK]: If FLAG is non-zero, skip calling - await_reply. Don't call await_reply here any more. - (bootp) [!NO_DHCP_SUPPORT]: If any ack packet is not reached - within MAX_BOOTP_RETRIES times, return zero. If DHCP_REPLY isn't - DHCPOFFER, set NETWORK_READY to one and return one. - * netboot/etherboot.h (NO_DHCP_SUPPORT): Undefined. - - * stage2/builtins.c (print_root_device): Use the macro - NETWORK_DRIVE instead of 0x20. - * stage2/disk_io.c [!STAGE1_5] (sane_partition): Likewise. - (real_open_partition) [!STAGE1_5]: Likewise. - (set_device) [!STAGE1_5]: Likewise. - -2000-02-08 OKUJI Yoshinori - - * grub/asmstub.c (biosdisk) [__linux__]: Use _llseek when - __GLIBC_MINOR__ is less than 1 even if __GLIBC__ is 2. Reported - by Goran Koruga . - - * configure.in (--disable-lba-support-bitmap-check): New option. - Don't define CHECK_LBA_SUPPORT_BITMAP if specified. - * stage1/stage1.S (real_start): Check if AH=0x42 is supported if - CHECK_LBA_SUPPORT_BITMAP instead of NO_BUGGY_BIOS_IN_THE_WORLD - is defined. - * stage2/bios.c (get_diskinfo): Check if LBA read/write - functions are supported iff CHECK_LBA_SUPPORT_BITMAP is defined, - instead of NO_BUGGY_BIOS_IN_THE_WORLD. - -2000-02-07 OKUJI Yoshinori - - The netboot support is heavily rewritten, based on - Etherboot-4.4.2. The current one doesn't work yet, so check out - GRUB with the tag "dresden_netboot_code" if you need working - one. - - * configure.in (--enable-tftp): Deleted. - (FSYS_CFLAGS): `AC_SUBST'ed right before AC_OUTPUT. - (NETBOOT_DRIVERS): New variable. AC_SUBST this after examining - the driver options. - (--enable-packet-retransmission): New option. - (--enable-pci-direct): Likewise. - (--enable-3c509): Likewise. - (--enable-3c529): Likewise. - (--enable-3c90x): Likewise. - (--enable-cs89x0): Likewise. - (--enable-epic100): Likewise. - (--enable-3c507): Likewise. - (--enable-exos205): Likewise. - (--enable-ni5210): Likewise. - (--enable-lancepci): Likewise. - (--enable-ne2100): Likewise. - (--enable-ni6510): Likewise. - (--enable-3c503): Likewise. - (--enable-ntulip): Likewise. - (--enable-rtl8139): Likewise. - (--enable-sk-g16): Likewise. - (--enable-smc9000): Likewise. - (--enable-tiara): Likewise. - (--enable-tulip): Likewise. - (--enable-via-rhine): Likewise. - (--enable-3c503-shmem): Likewise. - (--enable-3c503-aui): Likewise. - (--enable-3c509-hack): Likewise. - (--enable-compex-rl2000-fix): Likewise. - (--enable-smc9000-scan): Likewise. - (--enable-t503): Deleted. - (--enable-lance): Likewise. - (--enable-cs): Likewise. - - * netboot/main.c: New file. Copied and modified. - * netboot/linux-asm-io.h: Likewise. - * netboot/etherboot.h: Likewise. - * netboot/misc.c: Likewise. - * netboot/via-rhine.c: Likewise. - * netboot/3c90x.c: Likewise. - * netboot/3c90x.txt: Likewise. - * netboot/epic100.c: Likewise. - * netboot/epic100.h: Likewise. - * netboot/i82586.c: Likewise. - * netboot/linux-asm-string.h: Likewise. - * netboot/ntulip.c: Likewise. - * netboot/ntulip.txt: Likewise. - * netboot/osdep.h: Likewise. - * netboot/rtl8139.c: Likewise. - * netboot/sk_g16.c: Likewise. - * netboot/sk_g16.h: Likewise. - * netboot/smc9000.c: Likewise. - * netboot/smc9000.h: Likewise. - * netboot/tiara.c: Likewise. - * netboot/tulip.c: Likewise. - * netboot/tulip.h: Likewise. - * netboot/README.netboot: New file. Most information is stolen - from Makefile and Config.32 in Etherboot. - * netboot/3c509.c: Copied from Etherboot. The original is - removed. - * netboot/3c509.h: Likewise. - * netboot/cs89x0.c: Likewise. - * netboot/eepro100.c: Likewise. - * netboot/lance.c: Likewise. - * netboot/ns8390.c: Likewise. - * netboot/ns8390.h: Likewise. - * netboot/pci.c: Likewise. - - * netboot/3c59x.c: Include etherboot.h instead netboot.h. - * netboot/config.c: Copied from Etherboot and added the 3c59x - entries. - * netboot/pci.h: Likewise. - * netboot/fsys_tftp.c: Entirely rewritten based on main.c in - Etherboot. - - * netboot/io.h: Removed. - * netboot/ip.h: Likewise. - * netboot/ip.c: Likewise. - * netboot/netboot.h: Likewise. - - * netboot/Makefile.am (INCLUDES): Added -I$(top_srcdir)/stage2. - (DRIVERS): Removed. - (libdrivers_a_SOURCES): Added etherboot.h, linux-asm-io.h, - linux-asm-string.h, main.c, misc.c and osdep.h. Deleted io.h, - ip.h, ip.c, netboot.h and $(DRIVERS). - (EXTRA_libdrivers_a_SOURCES): New variable. - (libdrivers_a_LIBADD): Set to @NETBOOT_DRIVERS@. - (libdrivers_a_DEPENDENCIES): New variable. - (EXTRA_DIST): Likewise. - (3c509_drivers): New variable. Define a new rule for the value. - (3c59x_drivers): Likewise. - (3c90x_drivers): Likewise. - (cs89x0_drivers): Likewise. - (eepro100_drivers): Likewise. - (epic100_drivers): Likewise. - (i82586_drivers): Likewise. - (lance_drivers): Likewise. - (ns8390_drivers): Likewise. - (ntulip_drivers): Likewise. - (rtl8139_drivers): Likewise. - (sk_g16_drivers): Likewise. - (smc9000_drivers): Likewise. - (tiara_drivers): Likewise. - (tulip_drivers): Likewise. - (via_rhine_drivers): Likewise. - (t503_o_CFLAGS): Removed. - (nepci_o_CFLAGS): Set to -DINCLUDE_NEPCI=1. - (ne_o_CFLAGS): Set to -DINCLUDE_NE=1. - (wd_o_CFLAGS): Set to -DINCLUDE_WD=1. - (3c509_o_CFLAGS): Likewise. - (3c529_o_CFLAGS): Likewise. - (3c59x_o_CFLAGS): Likewise. - (3c90x_o_CFLAGS): Likewise. - (cs89x0_o_CFLAGS): Likewise. - (eepro100_o_CFLAGS): Likewise. - (epic100_o_CFLAGS): Likewise. - (3c507_o_CFLAGS): Likewise. - (exos205_o_CFLAGS): Likewise. - (ni5210_o_CFLAGS): Likewise. - (lancepci_o_CFLAGS): Likewise. - (ne2100_o_CFLAGS): Likewise. - (ni6510_o_CFLAGS): Likewise. - (3c503_o_CFLAGS): Likewise. - (ntulip_o_CFLAGS): Likewise. - (rtl8139_o_CFLAGS): Likewise. - (sk_g16_o_CFLAGS): Likewise. - (smc9000_o_CFLAGS): Likewise. - (tiara_o_CFLAGS): Likewise. - (tulip_o_CFLAGS): Likewise. - (via_rhine_o_CFLAGS): Likewise. - - * stage2/char_io.c (nul_terminate): Changed the type of the - return value to int. Return the original character changed to - NUL. - * stage2/shared.h (NETWORK_DRIVE): New macro. - (nul_terminate): Adjusted to the definition. - * stage2/gunzip.c (gunzip_test_header): Removed the TFTP check - entirely. It is no longer necessary because we now can obtain - the correct size of a file even for TFTP. - -2000-02-07 OKUJI Yoshinori - - * stage2/asm.S: Undo the previous changes. Is - binutils-2.9.5.0.25 too strict to retain the compatibility? - Reported by Kalle Olavi Niemitalo . - -2000-02-03 OKUJI Yoshinori - - * stage2/cmdline.c (enter_cmdline): Set BUF_DRIVE to -1 before - running a command to invalidate the cache. - (run_script): Likewise. - * stage2/char_io.c (get_cmdline): Set BUF_DRIVE to -1 before the - completion to invalidate the cache. - Reported by Jeff Sheinberg . - - * configure.in: Use AC_PATH_TOOL instead of AC_PATH_PROG. - * stage2/asm.S (chain_stage1): Prepend `*' to the argument for - ljmp. - (chain_stage2): Likewise. - (big_linux_boot): Likewise. - -2000-01-19 OKUJI Yoshinori - - * util/grub-install.in (--root): Renamed to ... - (--root-directory): ... this, since "root" is vague. - * docs/user-ref.texi (Invoking grub-install): Adjusted to the - change above, and added an example how to use --root-directory. - * docs/grub-install.8: Regenerated. - - * docs/appendices.texi (FAQ): Added an item about the sucked - SCSI problem. - -2000-01-15 OKUJI Yoshinori - - * stage2/builtins.c (chainloader_func): If --force is specified - in ARG, don't check for the signature. - * docs/tutorial.texi (Chain-loading): Added a caution about some - defective boot loaders and --force. - * docs/user-ref.texi (Command-line-specific commands): Added a - description about --force. - -2000-01-11 OKUJI Yoshinori - - * docs/prog-ref.texi (LBA mode disk I/O): Added a footnote about - a buggy BIOS. - -2000-01-11 OKUJI Yoshinori - - * stage1/stage1.S [!NO_BUGGY_BIOS_IN_THE_WORLD]: Don't check if - LBA read is supported. Anyway, fallback to the CHS mode if - fails. - -2000-01-10 OKUJI Yoshinori - - * stage2/bios.c (NO_INT13_FALLBACK): Undefined. - (get_diskinfo) [!NO_BUGGY_BIOS_IN_THE_WORLD]: Do not check if - bit 0 in DRP.FLAGS is set, because at least one BIOS does not - set it correctly. Reported by "Forever shall I be." - . - - * util/grub-install.in: Handle the new options `--root' and - `--grub-shell'. - (rootdir): New variable. - (usage): Print the help messages about the options --root and - --grub-shell. - (bootdir): Initialized after the option analysis. - (grubdir): Likewise. - (device_map): Likewise. - (root_device): Set to the result for the directory ROOTDIR - instead of "/". - * docs/user-ref.texi (Invoking grub-install): Added the - descriptions about --root and --grub-shell. - * docs/grub-install.8: Regenerated. - -2000-01-08 OKUJI Yoshinori - - * util/grub-install.in (grubdir_device): New variable. - If GRUBDIR_DEVICE is not equal to ROOT_DEVICE, print an error - message and exit. - * README: Added a caution about Automake. - * TODO: Updated. Only the things that should be done until 0.6 - have one or more exclamations. Things with zero exclamation - will be done after 0.6 unless someone sends a patch for it. - -2000-01-05 OKUJI Yoshinori - - * grub/asmstub.c: Include the header shared.h after including - all the system headers, but not before. - (EXTENDED_MEMSIZE): Reduced to 3MB. - (grub_setjmp): New function. - (grub_longjmp): Likewise. - * grub/main.c: Include setjmp.h. - * stage2/asm.S (grub_setjmp): New function. Stolen from the - OSKit (which stole it from Mach). - (grub_longjmp): Likewise. - * stage2/shared.h [GRUB_UTIL] (grub_jmp_buf): New type. - [!GRUB_UTIL] (grub_jmp_buf): New macro. Defined as jmp_buf. - (grub_setjmp): Declared. - (grub_longjmp): Likewise. - (restart_env): Likewise. - * stage2/builtins.c (configfile_func): Use grub_longjmp instead - of invoking cmain again. - * stage2/stage2.c (restart_env): New variable. - (cmain): Call grub_setjmp first to initialize RESTART_ENV. - -2000-01-03 OKUJI Yoshinori - - * docs/multiboot.texi (Boot information format): Added the - descriptions about the fields "config_table" and - "boot_loader_name". - -1999-12-31 OKUJI Yoshinori - - * stage2/builtins.c (setup_func) [!NO_BUGGY_BIOS_IN_THE_WORLD]: - Specify the option `d', whether INSTALL_DRIVE is identical with - IMAGE_DRIVE or not. - * docs/user-ref.texi (Command-line-specific commands): Added a - caution about buggy BIOSes which don't pass a booting drive - properly. - - * docs/src2texi: Added an extra space into the first line, for - the portability issue. - - * docs/appendices.texi (Obtaining and Building GRUB): Update the - information on the ftp site and the CVS repository. - -1999-12-30 OKUJI Yoshinori - - * stage2/builtins.c (blocklist_func): New function. - (builtin_blocklist): New variable. - (builtin_table): Added a pointer to BUILTIN_BLOCKLIST. - * docs/user-ref.texi (Command-line-specific commands): Added a - description about the command "blocklist". - -1999-12-30 OKUJI Yoshinori - - * stage2/disk_io.c (grub_seek): New function. - * stage2/shared.h (grub_seek): Declared. - * stage2/boot.c (load_image): Use grub_seek instead of setting - FILEPOS to a new value directly. - * stage2/builtins.c (install_func): Likewise. - (testload_func): Likewise. - - * docs/grub.texi: Use a single direntry command for all the - entries instead of one per entry. - -1999-12-29 OKUJI Yoshinori - - * grub/asmstub.c (check_device) [__linux__]: Check if DEVICE is - a CD-ROM drive by the HDIO_GETGEO ioctl. If so, then return - zero. Reported by Pavel Roskin. - - * stage2/Makefile.am (nodist_noinst_DATA): Renamed to ... - (noinst_DATA): ... this. The primary DATA is `nodist' by - default, at least theoretically. Reported by Klaus Reichl. - - * stage2/bios.c (get_diskinfo): Set the LBA flag in GEOMETRY - only if bit 0 in DRP.FLAGS is set. Reported by Zack Weinberg - . - - From Pavel Roskin: - * grub/asmstub.c (init_device_map): Increase the number of - devices to be probed to 8 for IDE disks and 16 for SCSI - disks. Reported by Anton Anisimov . - -1999-12-06 Gordon Matzigkeit - - * README (DEVELOPERS): Change CVS location to subversions. - -1999-11-30 OKUJI Yoshinori - - * stage2/disk_io.c (real_open_partition): If SLICE_NO is greater - than or equal to PC_SLICE_MAX, skip any extended partition, when - searching for the right partition. Reported by Weil, Stefan 3732 - EPE-24 . - -1999-11-19 Gordon Matzigkeit - - * grub/asmstub.c (getkey): Stop immediately if we get an EOF. - - * stage2/stage2.c (cmain): Tell enter_cmdline to run forever. - (run_menu): Tell print_cmdline_message and enter_cmdline that we - won't run forever. - * stage2/cmdline.c (enter_cmdline): New argument, FOREVER, for - when ESC shouldn't allow an exit. Pass it to - print_cmdline_message. - (print_cmdline_message): Use new argument, FOREVER, to decide - whether to tell the user that ESC exits. - -1999-11-18 Gordon Matzigkeit - - * debian/rules (binary-arch): Don't strip or generate shared - library dependencies for /usr/sbin/grub-install, since it's a - script. - - * util/grub-install.in: Create safe temporary log files using - /bin/tempfile if it is executable. - -1999-11-17 Gordon Matzigkeit - - * stage1/Makefile.am (LDFLAGS): Consolidate multiple -Wl flags. - * stage2/Makefile.am (PRE_STAGE2_LINK): Likewise. - (START_LINK): Likewise. - (STAGE1_5_LINK): Likewise. - -1999-11-19 OKUJI Yoshinori - - * util/grub-install.in (debug): New variable. - (convert): If the device file does not exist, then emit an - error. Get the GRUB drive instead of the OS device. - If --debug is specified, then set $debug to yes. - If $debug is yes, run "set -x". - Make sure that stage1 and stage2 exist. - When checking for INSTALL_DEVICE, use "case" instead of "elif"s. - Make sure that $install_drive is not empty. - Likewise, make sure that $root_drive is not empty. - Any error message is redirected to the standard error. - -1999-11-19 Pavel Roskin - - * stage2/Makefile.am (noinst_DATA): Renamed to ... - (nodist_noinst_DATA): ... this. - * util/Makefile.am: sbin_SCRIPS -> sbin_SCRIPTS. - * util/grub-install.in: grub_dir -> grubdir. - Check if $grub_shell exists before running it. - (convert): Added a missing "test" after "if". - -1999-11-18 OKUJI Yoshinori - - * configure.in: Output grub-install. - * util/Makefile.am (sbin_SCRIPTS): New variable. - * util/grub-install.in: New file. - * docs/Makefile.am (man_MANS): Added grub-install.8. - [MAINTAINER_MODE] ($(srcdir)/grub-install.8): New target. - * docs/grub-install.8: New file. Generated by help2man. - * docs/user-ref.texi (Invoking grub-install): New chapter. - -1999-11-16 OKUJI Yoshinori - - From Pavel Roskin: - * stage1/stage1.S: Check for the API subset support bitmap - returned by INT 13 AH=48h, and jump to chs_mode if AH=42h is not - supported. - -1999-11-13 OKUJI Yoshinori - - * stage2/builtins.c (install_func): When using a Stage 1.5, set - CURRENT_DRIVE to SAVED_DRIVE and CURRENT_PARTITION to - SAVED_PARTITION if set_device fails. If CURRENT_DRIVE is equal - to SRC_DRIVE, then set CURRENT_DRIVE to 0xFF. We don't want to - embed any drive number whenever possible. - * stage2/disk_io.c (set_device) [STAGE1_5]: Always set - CURRENT_PARTITION to PARTITION. - -1999-11-13 OKUJI Yoshinori - - From Pavel Roskin: - * stage1/stage1.S (lba_mode): Jump to chs_mode if INT 13 AH=42h - fails. - -1999-11-12 OKUJI Yoshinori - - Do not use the device map file unless --device-map is specified. - - * grub/main.c (device_map_file): Set to 0. - (default_device_map_file): Removed. - (usage): Do not print DEFAULT_DEVICE_MAP_FILE. - * grub/asmstub.c (init_device_map): If DEVICE_MAP_FILE is NULL, - do not try to open the device map file. - Set FP to NULL by default. - * docs/grub.8: Regenerated. - -1999-11-11 Michael Hohmuth - - * stage2/boot.c (load_image): grub_close was called after - return, so exchange the order. - * stage2/stage1_5.c (cmain): Call grub_close after grub_read. - Set RET to the value returned by grub_read, and if RET is - non-zero, call chain_stage2. - * stage1/Makefile.am (BUILT_SOURCES): Removed. - (CLEANFILES): Set to $(nodist_pkgdata_DATA). - -1999-11-11 OKUJI Yoshinori - - Suggested by Klaus Reichl: - * stage2/builtins.c (print_root_device): New function. - (root_func): If no argument is specified, call the function - print_root_device and return. - (rootnoverify_func): Likewise. - * stage2/disk_io.c [!STAGE1_5] (print_completions): Call - print_error even if IS_FILENAME is zero. - If ERRNUM is non-zero, then return -1. - * stage2/char_io.c [!STAGE1_5] (get_cmdline): Clear ERRNUM after - calling print_completions to print the list as well. - - * stage2/asm.S [!STAGE1_5] (currticks): Set %eax to %cx:%dx - correctly. Reported by Michael Hohmuth. - -1999-11-06 Klaus Reichl - - * grub/asmstub.c (get_diskinfo) [__linux__]: After opening the - drive, flush the cache, other progs may have left over something - in the cache. - -1999-11-03 Gordon Matzigkeit - - * debian/rules: Add variables for cross-compilation. - - * debian/control (Standards-Version): Update to version 3.1.0. - * debian/rules (build): Install manpages into /usr/share/man, and - info into /usr/share/info in accordance with FHS. - (binary-arch): Likewise, and put docs into /usr/share/doc. - * debian/postinst: Use /usr/share/info, and manage compatibility - /usr/doc/grub -> /usr/share/doc/grub symlink. - * debian/prerm: Likewise. - - * stage2/Makefile.am (CLEANFILES): Change to - $(nodist_pkgdata_DATA) so that the raw binary files are deleted. - * stage1/Makefile.am (CLEANFILES): Likewise. - -1999-11-06 OKUJI Yoshinori - - * grub/asmstub.c (grub_putchar) [HAVE_LIBCURSES]: Do not call - wrefresh. This was just an accident. Sorry. - - Reported by Alan McLean : - * stage2/builtins.c (embed_func): The sector argument for the - function biosdisk is changed from SECTOR + I * SECTOR_SIZE to - SECTOR + I. - (find_func): Clear ERRNUM before each of the attempts. - -1999-11-05 OKUJI Yoshinori - - * docs/multiboot.texi (Boot information format): Add the members - `drives_addr' and `drives_count' into the Multiboot information - structure, and added the descriptions. - -1999-11-03 Gordon Matzigkeit - - * util/mbchk.c (main): Move the version number inside the - parentheses since it is the GRUB package version, not just an - mbchk-specific version. - -1999-10-30 Gordon Matzigkeit - - * debian/rules (binary-arch): Compress man pages. - Strip the grub shell. - Install examples. - -1999-11-03 OKUJI Yoshinori - - * docs/tutorial.texi: Fix typos by ispell. - * docs/user-ref.texi: Likewise. - * docs/prog-ref.texi: Likewise. - * docs/appendices.texi: Likewise. - -1999-11-03 OKUJI Yoshinori - - * stage2/fsys_ext2fs.c (struct ext2_dir_entry): Changed the type - of `name_len' to __u8 and added the new member `file_type' after - it. This is stolen from linux/ext2_fs.h in Linux 2.2.13. - Reported by Ben Harris . - - * stage2/builtins.c (device_func) [GRUB_UTIL]: Call - nul_terminate before calling check_device. - -1999-11-02 OKUJI Yoshinori - - * stage2/disk_io.c (real_open_partition): Check for the right - partition for any extended partition as well. Set EXT to I after - the check is done. Reported by Jeff Scheinberg - . - - * stage2/builtins.c (color_func): Use the function - nul_terminate. - (device_func) [GRUB_UTIL]: Likewise. - (help_func): Likewise. - (install_func): Save CURRENT_DRIVE, CURRENT_PARTITION and - BUG_GEOM in SRC_DRIVE, SRC_PARTITION and SRC_GEOM respectively, - and use them when patching the Stage 2. - NUL-terminate the configuration filename CONFIG_FILENAME. - If IS_STAGE1_5 is true, then check if the "real config file" - option is present, and, if so, patch the Stage 2 CONFIG_FILENAME - with the configuration filename REAL_CONFIG_FILENAME. - (setkey_func): Use nul_terminate instead of the local function - null_terminate. - * stage2/char_io.c [!STAGE1_5] (nul_terminate): New function. - * stage2/shared.h (nul_terminate): Declared. - -1999-11-01 OKUJI Yoshinori - - * docs/grub.texi: Add "I/O ports detection" into the menu. - * docs/user-ref.texi: Added a description about the command - "ioprobe". - * docs/prog-ref.texi (I/O ports detection): New chapter. - -1999-11-01 OKUJI Yoshinori - - From Pavel Roskin: - * stage2/asm.S (int1_handler): Use EXT_C(io_map) instead of - io_map. - (int1_handler): Use EXT_C(bios_key_map) instead of bios_key_map. - * grub/asmstub.c [__OpenBSD__]: Include and - . - [__OpenBSD__] (get_floppy_disk_name): Added support for OpenBSD. - [__OpenBSD__] (get_ide_disk_name): Likewise. - [__OpenBSD__] (get_scsi_disk_name): Likewise. - (get_drive_geometry) [__OpenBSD__]: Use for OpenBSD the same - ioctl as for NetBSD and FreeBSD. - -1999-10-31 OKUJI Yoshinori - - * grub/asmstub.c (init_device_map): Add a floppy device name - into the device map file even if check_device fails. - * stage2/char_io.c [!STAGE1_5] (get_cmdline): Clear ERRNUM after - calling print_completions. - -1999-10-29 OKUJI Yoshinori - - * stage2/asm.S (track_int13): Defined unconditionally. Do not - use int3 any more, but replace the int13 handler with - set_tf_int13_handler. - (int1_handler): Defined unconditionally. Do not check for 0x0F. - Add missing `$'s. If the code is 0xEC-0xEF, use %dx instead of - immediate. If the code is 0xE4-0xE7, use immediate instead of - %dx. Set %ds to zero before scanning IO_MAP. Check for the - buffer overrun of IO_MAP before adding a port. - [!DEFINE_TRACK_INT13] (int13_first_instruction): Removed. - [!DEFINE_TRACK_INT13] (int3_handler): Likewise. - (set_tf_int13_handler): New interrupt handler. - (set_tf_int13_offset): New variable. - (set_tf_int13_segment): Likewise. - * stage2/builtins.c (ioprobe_func): New function. - (builtin_ioprobe): New variable. - (builtin_table): Added a pointer to BUILTIN_IOPROBE. - * stage2/shared.h (IO_MAP_SIZE): New macro. - (track_int13): Declared. - (io_map): Likewise. - -1999-10-29 OKUJI Yoshinori - - * stage2/char_io.c (print_error) [!STAGE1_5]: Print "Error:" - before print the error message. - (print_error): Do not clear ERRNUM. - * stage2/cmdline.c (run_script): If ERRNUM is non-zero, set - ERRNUM to ERR_NONE. - (enter_cmdline): Clear ERRNUM after print_error. - -1999-10-28 OKUJI Yoshinori - - From Pavel Roskin: - * stage2/stage2.c (run_menu) [GRUB_UTIL]: Do not use IBM special - characters in the message, but use ascii names instead. - (run_menu) [!GRUB_UTIL]: Use DISP_UP and DISP_DOWN instead of - the ascii codes. - * stage2/shared.h [!ACS_ULCORNER] (ACS_ULCORNER): New macro. - [!ACS_ULCORNER] (ACS_URCORNER): Likewise. - [!ACS_ULCORNER] (ACS_LLCORNER): Likewise. - [!ACS_ULCORNER] (ACS_LRCORNER): Likewise. - [!ACS_ULCORNER] (ACS_HLINE): Likewise. - [!ACS_ULCORNER] (ACS_VLINE): Likewise. - [!ACS_ULCORNER] (ACS_LARROW): Likewise. - [!ACS_ULCORNER] (ACS_RARROW): Likewise. - [!ACS_ULCORNER] (ACS_UARROW): Likewise. - [!ACS_ULCORNER] (ACS_DARROW): Likewise. - [GRUB_UTIL] (DISP_UL): Set to ACS_ULCORNER. - [GRUB_UTIL] (DISP_UR): Set to ACS_URCORNER. - [GRUB_UTIL] (DISP_LL): Set to ACS_LLCORNER. - [GRUB_UTIL] (DISP_LR): Set to ACS_LRCORNER. - [GRUB_UTIL] (DISP_HORIZ): Set to ACS_HLINE. - [GRUB_UTIL] (DISP_VERT): Set to ACS_VLINE. - [GRUB_UTIL] (DISP_LEFT): Set to ACS_LARROW. - [GRUB_UTIL] (DISP_RIGHT): Set to ACS_RARROW. - [GRUB_UTIL] (DISP_UP): Set to ACS_UARROW. - [GRUB_UTIL] (DISP_DOWN): Set to ACS_DARROW. - -1999-10-28 OKUJI Yoshinori - - * stage2/builtins.c (keycode_func): Removed. - (builtin_keycode): Likewise. - (struct keysym): New structure. - (keysym_table): New variable. - (setkey_func): New function. - (builtin_setkey): New variable. - (builtin_table): Removed the pointer to BUILTIN_KEYCODE, and - added a pointer to BUILTIN_SETKEY. - * stage2/common.c [!STAGE1_5] (err_list): Added - ERR_BAD_ARGUMENT. - * stage2/shared.h (grub_error_t): Added ERR_BAD_ARGUMENT. - (KEY_MAP_SIZE): Set to 128. - (ascii_key_map): Declared. - * stage2/asm.S [!STAGE1_5] (remap_ascii_char): New function. - [!STAGE1_5] (ascii_key_map): New variable. - [!STAGE1_5] (getkey): Call remap_ascii_char after int16. - [!STAGE1_5] (checkkey): Likewise. - * grub/asmstub.c (ascii_key_map): New variable. - * docs/user-ref.texi (General commands): Added a description - about the command "setkey". - (Stage2 errors): Added a description about ERR_BAD_ARGUMENT. - -1999-10-27 OKUJI Yoshinori - - * stage2/disk_io.c (set_device) [!STAGE1_5]: Remove the - preliminary Mach-style device name support. I've decided that - the support is not necessary. - (setup_part) [!STAGE1_5]: Do not strip the leading "/dev/". - * docs/help2man: Upgraded to 1.016. - * docs/mbchk.1: Regenerated. - * docs/grub.8: Likewise. - * grub/asmstub.c: Rename KEY_MAP to BIOS_KEY_MAP. - - * stage2/asm.S [!STAGE1_5] (set_int15_handler): Use 0 instead of - the maximum number for the segment. - [!STAGE1_5] (unset_int15_handler): Likewise. - [!STAGE1_5] (int15_handler): Almost rewritten. If non-carrier, - ignore the scancode. If the scancode is E1 or E0, then set - INT15_SKIP_FLAG to 0x74, and if the previous scancode is E1 or - E0, set INT15_SKIP_FLAG to 0xea. Clear bit 7 in %dl. Save bit 7 - of %al in %bl. Do not lcall. Use ljmp instead. - [!STAGE1_5] (key_map): Renamed to ... - [!STAGE1_5] (bios_key_map): ... this. - * stage2/builtins.c (keycode_func): Check if FROM is greater - than 0xff instead of double-checking for TO. Use BIOS_KEY_MAP - instead of KEY_MAP. - * stage2/shared.h (KEY_MAP_SIZE): Set to 32. - (key_map): Removed. - (bios_key_map): Declared. - -1999-10-26 OKUJI Yoshinori - - Now the BIOS drive remapping is functional. - - * stage2/asm.S [DEFINE_TRACK_INT13] (track_int13): Use %edi - instead of direct addresses. - Prefix DATA32 to the calls for real_to_prot and prot_to_real. - Fix the address of DRIVE: 4(%ebp) -> 8(%ebp). - (set_int15_handler): Use %edi instead of direct addresses. - (unset_int15_handler): Likewise. - (set_int13_handler): Copy DRIVE_MAP_SIZE * 2 bytes instead of - DRIVE_MAP_SIZE bytes of MAP. - Fix the address of MAP: 4(%ebp) -> 8(%ebp). - Use %edi instead of direct addresses. - (int13_handler): Do not set %ds to %cs. Use the segment override - prefix of %cs instead. - Push the flags pushed by the callee instead of the current. - Set the flags in the stack to the flags returned by the original - int13 call. - (drive_map): 4bytes-aligned. - * stage2/disk_io.c (grub_close): Do not set ERRNUM even if - FSYS_TYPE is NUM_FSYS. - -1999-10-25 OKUJI Yoshinori - - * stage1/stage1.S: Long jump to real_start, because some bogus - BIOSes jump to 07C0:0000 instead of 0000:7C00. - (real_start): New label. - * docs/Makefile.am (grub.info): Removed. Use the default rule - instead. - -1999-10-25 OKUJI Yoshinori - - * stage2/asm.S [DEFINE_TRACK_INT13] (int3_handler): Save the - modified FLAGS in 6(%bp) instead of 4(%bp). - Decrease %bx before restoring the first instruction. - [DEFINE_TRACK_INT13] (track_int13): Go to the real mode before - setting up the registers for the int13 call. - -1999-10-24 OKUJI Yoshinori - - Add the prototype of a function to probe I/O ports used for a - BIOS drive. - - * stage2/asm.S [DEFINE_TRACK_INT13] (track_int13): New function. - [DEFINE_TRACK_INT13] (int1_handler): New interrupt handler for - the real mode. - [DEFINE_TRACK_INT13] (int3_handler): Likewise. - [DEFINE_TRACK_INT13] (io_map): New variable. - - * stage2/builtins.c (quit_func) [!GRUB_UTIL]: Fix a typo. - -1999-10-24 OKUJI Yoshinori - - The new GRUB manual becomes official. - - * docs/grub.texi: Replaced with new-grub.texi. - * docs/new-grub.texi: Removed. - * docs/Makefile.am (grub_TEXINFOS): New variable. - (UNFINISHED_MANUALS): Removed. - (EXTRA_DIST): Deleted $(UNFINISHED_MANUALS). - -1999-10-24 OKUJI Yoshinori - - * stage2/builtins.c (device_func) [!GRUB_UTIL]: Set ERRNUM to - ERR_UNRECOGINIZED and return 1. - (impsprobe_func) [GRUB_UTIL]: Likewise. - (quit_func) [!GRUB_UTIL]: Likewise. - * docs/tutorial.texi: Rename "Device Syntax" to "Filename". - Added many cross-references. - * docs/new-grub.texi: "Device Syntax" -> "Filename". - * docs/user-ref.texi: Fix typos and added some cross-references. - * docs/prog-ref.texi: Likewise. - * docs/appendices.texi: Likewise. - -1999-10-23 OKUJI Yoshinori - - * stage2/builtins.c (map_func): If BIOS_DRIVE_MAP already - contains FROM, override the existsing entry. - If TO is equal to FROM, delete the existing entry if any. - (keycode_func): Likewise. - * docs/user-ref.texi (Command): Use the list of `@deffn's - instead of @table. - (Basic usage): Use @option instead of @code. - (Invoking mbchk): Likewise. - -1999-10-23 OKUJI Yoshinori - - * stage2/asm.S [!STAGE1_5] (set_int15_handler): New function. - [!STAGE1_5] (unset_int15_handler): Likewise. - [!STAGE1_5] (int15_handler): New interrupt handler for the real - mode. - [!STAGE1_5] (int15_offset): New variable. - [!STAGE1_5] (int15_segment): Likewise. - [!STAGE1_5] (key_map): Likewise. - [!STAGE1_5] (set_int13_handler): Use the macro ABS for - INT13_OFFSET and INT13_SEGMENT. - * stage2/shared.h (KEY_MAP_SIZE): New macro. - (set_int15_handler): Declared. - (unset_int15_handler): Likewise. - * stage2/builtins.c (boot_func): Do not allow I to be equal to - DRIVE_MAP_SIZE. - Call unset_int15_handler unless KERNEL_TYPE is KERNEL_TYPE_NONE. - (map_func): Search for an empty slot till I is less than - DRIVE_MAP_SIZE. - Check if I is equal to DRIVE_MAP_SIZE instead of if I is greater - than DRIVE_MAP_SIZE. - (keycode_func): New function. - (builtin_keycode): New variable. - (builtin_table): Added a pointer to BUILTIN_KEYCODE. - * grub/asmstub.c (set_int15_handler): New function. - (unset_int15_handler): Likewise. - (key_map): New variable. - -1999-10-23 OKUJI Yoshinori - - From Michael Hohmuth : - * acconfig.h (HAVE_USCORE_USCORE_BSS_START_SYMBOL): Added the - `undef' entry. - (HAVE_EDATA_SYMBOL): Likewise. - (HAVE_USCORE_EDATA_SYMBOL): Likewise. - * acinclude.m4 (grub_CHECK_USCORE_USCORE_BSS_START_SYMBOL): New - function. - (grub_CHECK_EDATA_SYMBOL): Likewise. - (grub_CHECK_USCORE_EDATA_SYMBOL): Likewise. - * configure.in: Check for __bss, edata and _edata. - * netboot/Makefile.am (DRIVERS): Deleted ns8390.c and ns8390.h. - (libdrivers_a_LIBADD): New variable. - ($(libdrivers_a_LIBADD)): New target. - (nepci_o_CFLAGS): New variable. - (ne_o_CFLAGS): Likewise. - (wd_o_CFLAGS): Likewise. - (t503_o_CFLAGS): Likewise. - * netboot/fsys_tftp.c (tftp_close): New function. - * stage2/boot.c (load_image): Call grub_close before return. - (load_initrd): Likewise. - (load_module): Likewise. - * stage2/builtins.c (cat_func): Likewise. - (chainloader_func): Likewise. - (configfile_func): Likewise. - (embed_func): Likewise. - (find_func): Likewise. - (install_func): Set IS_OPEN to the value returned by grub_open. - If IS_OPEN is non-zero, call grub_close before return. - (setup_func): Call grub_close after grub_open. - (testload): Call grub_close before return. - * stage2/disk_io.c (fsys_table): Add the `close' member into - each of the entries. For TFTP, tftp_close is added, and for the - rest, NULL is added. - (grub_read): "|" -> "||". - (grub_close): New function. - * stage2/filesys.h [FSYS_TFTP] (tftp_close): Declared. - (struct fsys_entry): Added close_func. - * stage2/shared.h (grub_close): Declared. - * stage2/stage1_5.c (cmain): Call grub_close after grub_open. - * stage2/stage2.c (cmain): Clear ERRNUM after calling - find_command to just ignore the error code. - Call grub_close after loading the configuration file. - - * stage2/asm.S (main): Clean out the bss. - -1999-10-23 OKUJI Yoshinori - - * docs/new-grub.texi: Updated. - * docs/user-ref.texi: Likewise. - * docs/tutorial.texi: Likewise. - * docs/prog-ref.texi: Likewise. - * docs/appendices.texi: Likewise. - -1999-10-22 OKUJI Yoshinori - - * docs/prog-ref.texi: New file. - * docs/appendices.texi: Likewise. - * docs/Makefile.am (UNFINISHED_MANUALS): Added prog-ref.texi and - appendices.texi. - -1999-10-22 OKUJI Yoshinori - - * docs/user-ref.texi: New file. - * docs/Makefile.am (UNFINISHED_MANUALS): Added user-red.texi. - -1999-10-21 OKUJI Yoshinori - - Add BIOS drive remapping support for chain-loading some foolish - operating systems. - - * stage2/builtins.c (bios_drive_map): New variable. - (boot_func): If KERNEL_TYPE is KERNEL_TYPE_CHAINLOADER, check - if BIOS_DRIVE_MAP contains meaningful values. If so, search for - SAVED_DRIVE in BIOS_DRIVE_MAP and exchange SAVED_DRIVE with the - mapped drive if found. And then call set_int13_handler. - (map_func): New function. - (builtin_map): New variable. - (builtin_table): Added a pointer to BUILTIN_MAP. - * stage2/asm.S (ABS): New macro. - [!STAGE1_5] (set_int13_handler): New function. - [!STAGE1_5] (int13_handler): New interrupt handler for the real - mode. - [!STAGE1_5] (drive_map): New variable. - [!STAGE1_5] (int13_handler_end): New label used for just - computing the end address of int13_handler. - * stage2/shared.h (DRIVE_MAP_SIZE): New macro. - (set_int13_handler): Declared. - * grub/asmstub.c (set_int13_handler): New function. Do nothing. - -1999-10-20 OKUJI Yoshinori - - * stage2/builtins.c (find_func): Print only the device names. - * docs/tutorial.texi: New file. - * docs/Makefile.am (UNFINISHED_MANUALS): Added tutorial.texi. - (%.c.texi): Use $(SHELL) instead of /bin/sh. - (%.h.texi): Likewise. - (%.S.texi): Likewise. - -1999-10-20 OKUJI Yoshinori - - * stage2/char_io.c (memcheck): Fix the checks: "<=" -> "<". - Reported by Mike Hicks . - -1999-10-19 OKUJI Yoshinori - - * stage2/builtins.c (find_func): New function. - (builtin_find): New variable. - (hide_func): Save SAVED_DRIVE and SAVED_PARTITION to TMP_DRIVE - and TMP_PARTITION, respectively, and resotre them before return. - (unhide_func): Likewise. - (setup_func): Likewise. And set SAVED_DRIVE and SAVED_PARTITION - instead of CURRENT_DRIVE and CURRENT_PARTITION to IMAGE_DRIVE - and IMAGE_PARTITION before running install_func. - (builtin_table): Added a pointer to BUILTIN_FIND. - -1999-10-19 OKUJI Yoshinori - - * docs/Makefile.am (UNFINISHED_MANUALS): New variable. - (EXTRA_DIST): Added $(UNFINISHED_MANUALS). - * docs/new-grub.texi: New file. - -1999-10-19 OKUJI Yoshinori - - * docs/Makefile.am (man_MANS): Added mbchk.1. - [MAINTAINER_MODE] (mbchk.1): New target. - * docs/mbchk.1: New file. Generated by help2man. - -1999-10-18 OKUJI Yoshinori - - * Makefile.am (SUBDIRS): Added util. - * configure.in: Output util/Makefile. - * util/Makefile.am: New file. - * util/mbchk.c: Likewise. - * util/Makefile.in: Likewise. Generated by automake. - -1999-10-17 OKUJI Yoshinori - - * docs/Makefile.am (.texi): Canceled because the dependecies can - be circulated. - * stage2/builtins.c (embed_func): Set BUF_TRACK to -1 before - writing the Stage 1.5 to the disk to clear the cache. - -1999-10-17 OKUJI Yoshinori - - * stage2/boot.c (load_initrd): Change types of *RAMDISK and - MOVETO to unsigned long. - Apply the macro RAW_ADDR to MOVETO. - -1999-10-16 OKUJI Yoshinori - - * docs/multiboot.texi: Include the example source files of a - Multiboot kernel. - * docs/src2texi: New file. - * docs/boot.S: Likewise. - * docs/multiboot.h: Likewise. - * docs/kernel.c: Likewise. - * docs/boot.S.texi: Likewise. - * docs/multiboot.h.texi: Likewise. - * docs/kernel.c.texi: Likewise. - * docs/Makefile.am (EXAMPLES): New varilable. - (multiboot_TEXINFOS): Likewise. - (SRC2TEXI): Likewise. - (noinst_SCRIPTS): Added $(SRC2TEXI). - (EXTRA_DIST): Added $(EXAMPLES) and $(multiboot_TEXINFOS). - (%.c.texi): New target. - (%.h.texi): Likewise. - (%.S.texi): Likewise. - -1999-09-22 OKUJI Yoshinori - - * multiboot.texi (BIOS device mapping techniques): New section. - Stolen from bios_mapping.txt in grub-0.5. - (Data comparison technique): New subsection. - (I/O restriction technique): Likewise. - (Example OS code): Rewrited from scratch. - -1999-09-21 OKUJI Yoshinori - - * multiboot.texi: Rename Multiboot Standard to Multiboot - Specification and upgrade the version to 0.7. Many cleanups - are done. - -1999-10-15 OKUJI Yoshinori - - * stage2/builtins.c (setup_func): Save CURRENT_DRIVE and - CURRENT_PARTITION into IMAGE_DRIVE and IMAGE_PARTITION - respectively, and restore them before running install_func. - Use DEVICE instead of BUFFER to store the device name. - Change each type of STAGE1, STAGE2 and CONFIG_FILE to an array - of char. - If installing the Stage 1 into a MBR, embed the Stage 1.5 in the - sectors right after it. - Return the result of install_func instead of zero. - -1999-10-14 Pavel Roskin - - * configure.in: Check for opendisk in libutil. - * grub/asmstub.c [__FreeBSD__ || __NetBSD__]: Include - . - [HAVE_OPENDISK]: Include . - [__NetBSD__] (get_floppy_disk_name): Added support for NetBSD. - [__NetBSD__ && HAVE_OPENDISK] (get_ide_disk_name): Likewise. - [__NetBSD__ && HAVE_OPENDISK] (get_scsi_disk_name): Likewise. - (get_drive_geometry) [__NetBSD__]: Use for NetBSD the same ioctl - as for FreeBSD. - -1999-10-13 OKUJI Yoshinori - - * grub/asmstub.c (assign_device_name): If DEVICE is NULL, set - DEVICE_MAP[DRIVE] to NULL. - (get_diskinfo): If open or read fails, call assign_device_name - to disable accessing the drive DRIVE. - (grub_stage2): The device mapping routine is moved to ... - (init_device_map): ... here. This new function also reads/writes - a device map file. If DEVICE_MAP_FILE already exists, then use - the data in it instead of probing devices. Otherwise, guess the - map between BIOS drives and OS devices, and write it to the file - DEVICE_MAP_FILE if it can be opened. - * grub/main.c (device_map_file): New variable. - (default_device_map_file): Likewise. - (OPT_DEVICE_MAP): New macro. - (longopts): Added an entry for "device-map". - (usage): Print the usage about --device-map as well. - (main): Set DEFAULT_DEVICE_MAP_FILE to DEVICE_MAP_FILE. If - OPT_DEVICE_MAP is found, set DEVICE_MAP_FILE to a duplicated - string of OPTARG. - * stage2/shared.h [GRUB_UTIL] (device_map_file): Declared. - * docs/grub.8: Regenerated. - -1999-10-13 OKUJI Yoshinori - - * stage2/builtins.c (color_func): Do not set NORMAL_COLOR or - HIGHLIGHT_COLOR directly, but use NEW_NORMAL_COLOR and - NEW_HIGHLIGHT_COLOR as temporary storages instead. - New internal function `color_number' is used to convert a - symbolic color representation into a color number. - Try color_number at first, and if fails, then try - safe_parse_maxint for each of NORMAL and HIGHLIGHT. - (builtin_color): The long doc does not describe the raw number - syntax but the symbolic color name syntax. - * docs/grub.texi (Commands): Adjusted to the long doc of - BUILTIN_COLOR. - * docs/menu.lst: Add examples of "fallback" and "color". - -1999-10-13 OKUJI Yoshinori - - * stage2/char_io.c [!STAGE1_5] (get_cmdline): If C is a newline - or a return, then set LPOS to LLEN and call the function - cl_setcpos. - [!STAGE1_5] (grub_strncat): New function. - * stage2/builtins.c (embed_func): New function. - (builtin_embed): New varilable. - (setup_func): New function. - (builtin_setup): New varilable. - (builtin_table): Added a pointer to BUILTIN_EMBED and a pointer - to BUILTIN_SETUP. - * stage2/shared.h (grub_strncat): Declared. - - * stage2/Makefile.am (stage2_size.h): ../stage2/stage2 -> - pre_stage2. Reported by Pavel Roskin. - -1999-10-12 OKUJI Yoshinori - - From Pavel Roskin: - * acinclude.m4 (grub_PROG_OBJCOPY_ABSOLUTE): main -> cmain. - * stage2/boot.c (load_image): Only CUR_ADDR, not ENTRY_ADDR - should be 1M-aligned for NetBSD. Don't align symbol table on 4k - boundaries if the kernel doesn't require it. - -1999-10-10 OKUJI Yoshinori - - * stage2/asm.S [!STAGE1_5] (start): New label to force ld quiet. - [!STAGE1_5] (_start): Likewise. - * stage2/builtins.c (install_func): Rewritten heavily almost - from scratch. As the blocklist was moved to the first sector of - Stage 2, always write sectors of Stage 2 to the disk. - * stage1/stage1.h (STAGE1_STAGE2_SECTOR): 0x40 -> 0x41. - (STAGE1_STAGE2_ADDRESS): 0x44 -> 0x45. - (STAGE1_STAGE2_SEGMENT): 0x46 -> 0x47. - (STAGE1_BOOT_DRIVE): 0x3f -> 0x40. - -1999-10-09 OKUJI Yoshinori - - Stage1 supports both the CHS mode and the LBA mode. - - * stage1/Makefile.am (nodist_pkgdata_DATA): Removed stage1_lba. - (BUILT_SOURCES): Deleted. - (CLEANFILES): Likewise. - (noinst_PROGRAMS): Removed stage1_lba.exec. - (stage1_exec_SOURCES): Removed stage2_size.h. - (stage2_size.h): Deleted. - (stage1_lba_exec_SOURCES): Likewise. - * stage1/stage1.S: Rewritten from scratch. - * stage1/stage1_lba.S: Deleted. - * stage1/stage1.h (COMPAT_VERSION_MAJOR): Set to 3. - (COMPAT_VERSION_MINOR): Set to 0. - (STAGE1_VER_MAJ_OFFS): Set to 0x3e. - (STAGE1_FIRSTLIST): Deleted. - (STAGE1_INSTALLSEG): Likewise. - (STAGE1_INSTALLADDR): Likewise. - (STAGE1_MINPARAMSIZE): Likewise. - (STAGE1_LISTSIZE): Likewise. - (STAGE1_ID_OFFSET): Likewise. - (STAGE1_ID_CHS): Likewise. - (STAGE1_ID_LBA): Likewise. - (STAGE1_STAGE2_SECTOR): New macro. - (STAGE1_STAGE2_ADDRESS): Likewise. - (STAGE1_STAGE2_SEGMENT): Likewise. - (STAGE1_BOOT_DRIVE): Likewise. - * stage2/start.S: New file. - * stage2/Makefile.am (noinst_DATA): New variable. - (CLEANFILES): Set to "$(nodist_pkgdata_DATA) $(noinst_DATA) - $(BUILT_SOURCES)". - (noinst_PROGRAMS): Removed stage2.exec, and added start.exec and - pre_stage2.exec. - (STAGE2_LINK): Deleted. - (PRE_STAGE2_LINK): New variable. - (START_LINK): Likewise. - (stage2_exec_SOURCES): Deleted. - (stage2_exec_CFLAGS): Likewise. - (stage2_exec_LDFLAGS): Likewise. - [NETBOOT_SUPPORT] (stage2_exec_LDADD): Likewise. - (pre_stage2_exec_SOURCES): New variable. - (pre_stage2_exec_CFLAGS): Likewise. - (pre_stage2_exec_LDFLAGS): Likewise. - [NETBOOT_SUPPORT] (pre_stage2_exec_LDADD): Likewise. - (BUILT_SOURCES): Likewise. - (start_exec_SOURCES): Likewise. - (start_exec_CFLAGS): Likewise. - (start_exec_LDFLAGS): Likewise. - (start_exec_DEPENDENCIES): Likewise. - (stage2_size.h): New rule. - (stage2): Likewise. - (e2fs_stage1_5_exec_SOURCES): Added start.S. - (fat_stage1_5_exec_SOURCES): Likewise. - (ffs_stage1_5_exec_SOURCES): Likewise. - (minix_stage1_5_exec_SOURCES): Likewise. - * stage2/asm.S (start): Renamed to ... - (main): ... this. - [STAGE1_5] (main): Jump to (codestart - EXT_C(main) + 0x2200) - instead of (codestart - EXT_C(start) + 0x2000). - [!STAGE1_5] (main): Jump to (codestart - EXT_C(main) + 0x8200) - instead of (codestart - EXT_C(start) + 0x8000). - [STAGE1_5] (chain_stage2): Use main instead of start. - * stage2/shared.h (BOOTSEC_LISTSIZE): New macro. - * stage2/stage1_5.c: Change the second argument for chain_stage2 - to 0x8200. - -1999-10-08 OKUJI Yoshinori - - * configure.in (--with-binutils): New option to specify a - directory to find binutils. - (CFLAGS): If WITH_BINUTILS is not empty, added the option `-B'. - (LD): Do not check for this. We don't use ld directly anyway. - (RANLIB): If WITH_BINUTILS is not empty, search the directory - WITH_BINUTILS first. - (OBJCOPY): Likewise. - * acinclude.m4 (grub_ASM_USCORE): Add CFLAGS into - AC_TRY_COMMAND. - (grub_ASM_ADDR32): Likewise. - (grub_ASM_PREFIX_REQUIREMENT): Likewise. - (grub_PROG_OBJCOPY_ABSOLUTE): Use CC instead of LD. - -1999-10-04 Pavel Roskin - - * stage2/freebsd.h (struct bootinfo): New member, bi_bios_dev. - * stage2/boot.c (bsd_boot): Set BI.BI_BIOS_DEV to SAVED_DRIVE. - -1999-10-04 OKUJI Yoshinori - - From Pavel Roskin: - * docs/grub.texi: Fix typos. - * stage2/builtins.c (install_func): Reformat the warning message - about the option `d'. - -1999-10-03 Gordon Matzigkeit - - * stage2/builtins.c (install_func): Fix check for the Stage 2 id. - From Pavel Roskin. - - * debian/Makefile.am (EXTRA_DIST): Add postinst and prerm. - -1999-10-03 OKUJI Yoshinori - - * stage2/builtins.c (boot_func): Pass MBI.CMDLINE instead of ARG - to bsd_boot. - -1999-10-03 OKUJI Yoshinori - - * stage2/gunzip.c (gunzip_test_header): Check if CURRENT_DRIVE - is 0x20 instead of if the fs type is TFTP, because GRUB does not - mount CURRENT_DRIVE when using a block file. Reported by Pavel - Roskin. - -1999-10-02 OKUJI Yoshinori - - * stage2/builtins.c (cat_func): Do not read the whole of a file - at one time. Instead, repeat reading one byte and print it on - the screen. - * docs/grub.texi (Command line): List the available key - bindings. - (Commands): Added descriptions about "geometry", "device" and - "cat". - -1999-10-02 OKUJI Yoshinori - - Now it is possible to build the grub shell with old BSD curses. - - * stage2/shared.h [!A_NORMAL] (A_NORMAL): Set to zero. - [!A_REVERSE && A_STANDOUT] (A_REVERSE): Set to A_STANDOUT. - [!A_REVERSE && !A_STANDOUT] (A_REVERSE): Set to zero. - -1999-09-30 Pavel Roskin - - * stage2/disk_io.c (set_bootdev): Mask 0x7F instead of 0x79 of - the device number. - -1999-10-01 OKUJI Yoshinori - - * configure.in (--without-curses): New option. If WITH_CURSES is - no, do not check for curses. - - * stage2/disk_io.c (set_device) [STAGE1_5]: Change the type of - DEV to unsigned long. - * stage2/builtins.c (install_func): Always check for the Stage 2 - id in FILE. - Reported by Pavel Roskin. - -1999-09-30 Gordon Matzigkeit - - * debian/postinst: New file to call install-info. - * debian/prerm: Likewise. - * debian/rules (binary-arch): Add postinst and prerm, compress the - info files, and call dpkg-shlibdeps. - - * stage2/cmdline.c (skip_to): Restructure, and count tabs as - whitespace. - (find_command): Likewise. - -1999-09-30 OKUJI Yoshinori - - * grub/getopt.c: Moved to ... - * lib/getopt.c: ... here. - * grub/getopt1.c: Moved to ... - * lib/getopt1.c: ... here. - * grub/getopt.h: Moved to ... - * lib/getopt.h: ... here. - * grub/Makefile.am (AM_CFLAGS): Added -I$(top_srcdir)/lib. - (grub_LDADD): Added ../lib/libcommon.a. - * lib/Makefile.am: New file. - * Makefile.am (SUBDIRS): Added lib. - * configure.in: lib/Makefile is added into the arguments for - AC_OUTPUT. - -1999-09-30 OKUJI Yoshinori - - From Pavel Roskin: - * stage2/defs.h (time_t): Renamed to ... - (mach_time_t): ... this. - (daddr_t): Renamed to ... - (mach_daddr_t): ... this. - (uid_t): Renamed to ... - (mach_uid_t): ... this. - (gid_t): Renamed to ... - (mach_gid_t): ... this. - (ino_t): Renamed to ... - (mach_ino_t): ... this. - * stage2/disk_inode.h (FFS_MAX_FASTLINK_SIZE): Use mach_daddr_t - instead of daddr_t. - (struct icommon): Use mach_uid_t, mach_gid_t, mach_time_t and - mach_daddr_t, instead of uid_t, gid_t, time_t and daddr_t. - * stage2/fs.h (BBLOCK): Use mach_daddr_t instead of addr_t. - (SBLOCK): Likewise. - (ROOTINO): Use mach_ino_t instead of ino_t. - (struct fs): Use mach_daddr_t and mach_time_t instead of daddr_t - and time_t. - (struct cg): Use mach_time_t instead of time_t. - (struct ocg): Likewise. - (cgbase): Use mach_daddr_t instead of daddr_t. - (itod): Likewise. - -1999-09-30 OKUJI Yoshinori - - * acinclude.m4 (grub_CHECK_START_SYMBOL): Use AC_TRY_LINK - instead of AC_TRY_COMMAND. - (grub_CHECK_USCORE_START_SYMBOL): Likewise. - (grub_CHECK_END_SYMBOL): Likewise. - (grub_CHECK_USCORE_END_SYMBOL): Likewise. - - * stage2/disk_io.c (set_device) [!STAGE1_5]: Use RESULT instead - of RETVAL to check if the analysis succeeds. - -1999-09-29 OKUJI Yoshinori - - * stage2/builtins.c (install_func): If the Stage 2 id in FILE is - not STAGE2_ID_STAGE2, set IS_STAGE1_5 to 1, otherwise to 0. - Use CONFIG_FILE_LOCATION to point to the location of the name of - a configuration file in Stage 2. - If the option `p' is present and IS_STAGE1_5 is non-zero, reset - the device information in CONFIG_FILE_LOCATION. - (cat_func): New function. - (builtin_cat): New variable. - (builtin_table): Added a pointer to BUILTIN_CAT. - (geometry_func): Call real_open_partition with the argument 1 - after printing out the drive information. - * stage2/disk_io.c (real_open_partition): Made global. - [!STAGE1_5] (print_completions): In the command completion and - the filename completion, print a newline at the last if - IS_COMPLETION is zero. - * stage2/shared.h (real_open_partition): Declared. - * stage2/fsys_ext2fs.c (ext2fs_dir): Do not print a newline even - if PRINT_POSSIBILITIES is less than zero. - * stage2/fsys_ffs.c (ffs_dir): Likewise. - * stage2/fsys_fat.c (fat_dir): Likewise. - * stage2/fsys_minix.c (minix_dir): Likewise. - -1999-09-29 OKUJI Yoshinori - - * stage1/stage1.S [!FFS_STAGE1_5] (blocklist_default_len): Do - not divide the size by 512, but shift the size to the right by - 9 instead, because of a binutils-2.9.1.0.x bug. - * stage1/stage1_lba.S [!FFS_STAGE1_5] (blocklist_default_len): - Likewise. - * stage2/builtins.c (install_func): When installing Stage 1.5, - if set_device returns NULL, then set CURRENT_DRIVE to 0xFF and - CONFIG_FILE to PTR. - -1999-09-26 OKUJI Yoshinori - - * stage2/char_io.c [!STAGE1_5] (get_cmdline): In cl_insert, call - cl_setcpos before printing BUF, even if LPOS is equal to LLEN. - In the completion, if RET is zero, do not call cl_init. - * stage2/disk_io.c [!STAGE1_5] (print_completions): In the - filename completion, if UNIQUE is 1, check if UNIQUE_STRING is a - directory or not. If so, append '/' to BUF. - In the partition completion, if IS_COMPLETION is non-zero and - *UNIQUE_STRING is not NUL, copy UNIQUE_STRING to PTR. Do not - append '/'. - (real_open_partition) [!STAGE1_5]: If DO_COMPRESSION is non-zero, - call print_a_completion. - (check_BSD_parts) [!STAGE1_5]: Likewise. - [!STAGE1_5] (print_a_completion): Ignore NAME if it is "." or - "..". - -1999-09-25 OKUJI Yoshinori - - * acinclude.m4 (grub_CHECK_USCORE_END_SYMBOL): Do not call - AC_DEFINE within AC_CACHE_VAL. Call it after AC_CACHE_VAL. - * stage2/Makefile.am (STAGE1_5_COMPILE): Do not define - CONFIG_FILE_ASM. - * stage2/asm.S (config_file) [STAGE1_5]: Set the first 4 bytes - to 0xffffffff and the following to "/boot/grub/stage2". - (config_file) [!STAGE1_5]: Set to "/boot/grub/menu.lst". - * stage2/builtins.c (install_func): Read a Stage 2 before - handling the `p' option. - If the `configfile' option is present and FILE is a Stage 2, - translate the device name to the internal device representation - and copy the result to STR. - * stage2/disk_io.c [STAGE1_5] (sane_partition): Eliminated. - [STAGE1_5] (incomplete): Likewise. - [STAGE1_5] (disk_choice): Likewise. - [STAGE1_5] (part_choice): Likewise. - (set_device) [STAGE1_5]: Assume that the first 4 bytes of DEVICE - is a device number. Set DRIVE to the forth byte of DEV and - PARTITION to the first 3 bytes of DEV. If DRIVE is 0xFF, set - CURRENT_DRIVE and CURRENT_PARTITION to SAVED_DRIVE and - SAVED_PARTITION, respectively. Otherwise set to DRIVE and - PARTITION, respectively. - (setup_part) [STAGE1_5]: Always call set_device. - -1999-09-24 OKUJI Yoshinori - - * acinclude.m4 (grub_CHECK_END_SYMBOL): Add a missing - double-quote. Reported by Johannes Kroeger - . - -1999-09-14 Gordon Matzigkeit - - * stage1/stage1.S (blocklist_default_start): New label for default - blocklist start sector. - (blocklist_default_len): New label for default blocklist length. - (blocklist_default_seg): New label for default blocklist segment. - * stage1/stage1_lba.S (blocklist_default_start): Likewise. - (blocklist_default_len): Likewise. - (blocklist_default_seg): Likewise. - -1999-09-23 OKUJI Yoshinori - - * acinclude.m4 (grub_ASM_ADDR32): First, create a template - source file "conftest.s.in", and then, replace @ADDR32@ with - "addr32" if GRUB_CV_ASM_PREFIX_REQUIREMENT is yes, otherwise, - replace it with "addr32;". Reported by John Tobey - . - -1999-09-23 OKUJI Yoshinori - - * stage2/builtins.c (debug_fs_print_func): Renamed to ... - (disk_read_print_func): ... this. - (fstest_func): Use DISK_READ_HOOK instead of DEBUG_FS. - (install_func): Rename debug_fs_savesect_func to - disk_read_savesect_func. - Rename debug_fs_blocklist_func to disk_read_blocklist_func. - Use DISK_READ_HOOK instead of DEBUG_FS. - (testload_func): Use DISK_READ_HOOK instead of DEBUG_FS. - * stage2/disk_io.c [!STAGE1_5] (debug_fs): Renamed to ... - [!STAGE1_5] (disk_read_hook): ... this. - [!STAGE1_5] (debug_fs_func): Renamed to ... - [!STAGE1_5] (disk_read_func): ... this. - (rawread) [!STAGE1_5]: Use DISK_READ_HOOK and DISK_READ_FUNC - instead of DEBUG_FS and DEBUG_FS_FUNC. - (grub_read) [!STAGE1_5]: Likewise. - (devread) [!STAGE1_5]: Use DISK_READ_HOOK instead of DEBUG_FS. - * stage2/fsys_ext2fs.c (ext2fs_read) [!STAGE1_5]: Use - DISK_READ_HOOK and DISK_READ_FUNC instead of DEBUG_FS and - DEBUG_FS_FUNC. - * stage2/fsys_ffs.c (ffs_read) [!STAGE1_5]: Likewise. - * stage2/fsys_minix.c (minix_read) [!STAGE1_5]: Likewise. - * stage2/shared.h [!STAGE1_5] (debug_fs): Renamed to ... - [!STAGE1_5] (disk_read_hook): ... this. - [!STAGE1_5] (debug_fs_func): Renamed to ... - [!STAGE1_5] (disk_read_func): ... this. - * docs/grub.texi: Likewise, replace debug_fs and debug_fs_func - with disk_read_hook and disk_read_func, respectively. - -1999-09-23 Pavel Roskin - - * stage2/builtins.c (install_func): New local function, - debug_fs_savesect_func. Use debug_fs_savesect_func to determine - the first sector of Stage2. Write Stage 1 after patching Stage - 2. - -1999-09-22 OKUJI Yoshinori - - * acinclude.m4 (grub_ASM_USCORE): Do not define HAVE_ASM_USCORE - within AC_CACHE_VAL. Define it after AC_CACHE_VAL if - GRUB_CV_ASM_USCORE is yes. - -1999-09-20 Edmund GRIMLEY EVANS - - * netboot/3c59x.c: INCLUDE_3c59x is replaced by INCLUDE_3C59X - throughout. - * netboot/config.c: Likewise. - * netboot/io.h (__INS): New macro. - (__OUTS): Likewise. - (outl): Likewise. - (inl): Likewise. - (outl_p): Likewise. - (inl_p): Likewise. - Call __INS with the argument `b', with `w' and with `l' to - define insb, insw and insl, respectively. Likewise, Call __OUTS - with `b', with `w' and with `l' to define outsb, outw and outl, - respectively. - * netboot/pci.h (PCI_VENDOR_ID_VORTEX): New macro. - (PCI_DEVICE_ID_VORTEX_3c595): Likewise. Defined as a random - value. - -1999-09-20 Edward Killips - - * stage2/disk_io.c (set_partition_hidden_flag): Set/clear the - hidden flag, whether the hidden flag is set or not. - -1999-09-21 OKUJI Yoshinori - - * stage2/builtins.c (install_func): Do not set DEBUG_FS at the - first read. Set it to DEBUG_FS_BLOCKLIST_FUNC when reading the - whole of Stage 2. Set FILEPOS to zero at the same time to read - from the beginning of Stage 2. Reported by Pavel Roskin. - -1999-09-20 OKUJI Yoshinori - - The argument ADDR for the command install is now optional. - - * stage2/builtins.c (install_func): If parsing ADDR fails, set - INSTALLADDR to zero and set PTR to ADDR. - If INSTALLADDR is zero after parsing the command-line, check if - the Stage 2 id is STAGE2_ID_STAGE2. If so, set INSTALLADDR to - 0x8000, otherwise set it to 0x2000. - Set the install address in the Stage 1 after the automatic - determination is completed. - (builtin_install): Say that ADDR is optional in the help - message. - * docs/grub.texi: Synchronize the description about install to - builtins.c. Remove explicit address arguments from all the - examples. Add a description about help. - * docs/menu.lst: Do not specify the address argument for - install. - -1999-09-19 OKUJI Yoshinori - - The completion code is heavily modified. - - * stage2/char_io.c [!STAGE1_5] (get_cmdline): In the completion - code, use COMPLETION_BUFFER to get the completion instead of - writing to BUF directly. - Save the position of a possible equal character after a command - in EQUAL_POS and replace the equal character with a space - temporarily for the code simplicity. - At first, just get completions, and, if there is more than one - completions, then print the list of the completions. - * stage2/disk_io.c [!STAGE1_5] (do_completion): New variable. - [!STAGE1_5] (unique): Moved the definition near the beginning. - [!STAGE1_5] (unique_string): Likewise. And changed the type to - char *. - (check_BSD_parts) [!STAGE1_5]: If DO_COMPLETION is non-zero, do - not print anything. - (real_open_partition) [!STAGE1_5]: Likewise. - [!STAGE1_5] (print_fsys_type): Likewise. - [!STAGE1_5] (print_a_completion): The argument FILENAME is - renamed to NAME. - If DO_COMPLETION is non-zero, get the unique part from NAME and - set UNIQUE_STRING to it. - If DO_COMPLETION is zero, just print NAME. - Do not call printf unconditionally. - [!STAGE1_5] (print_completions): Accept two arguements - IS_FILENAME and IS_COMPLETION instead of FILENAME. - Set UNIQUE_STRING to UNIQUE_BUF. - Set DO_COMPLETION to IS_COMPLETION and set it to zero before - returning. - If IS_FILENAME is zero, then complete builtin commands and - return UNIQUE - 1. - Use BUF instead of FILENAME. - If IS_COMPLETION is non-zero, do not print anything. - Copy UNIQUE_STRING to PTR only if IS_COMPLETION and - *UNIQUE_STRING are non-zero. - * stage2/shared.h (COMPLETION_BUF): New macro. - (COMPLETION_BUFLEN): Likewise. - (UNIQUE_BUF): Likewise. - (UNIQUE_BUFLEN): Likewise. - (MENU_BUF): Set to UNIQUE_BUF + UNIQUE_BUFLEN. - (MENU_BUFLEN): Set to 0x8000 + PASSWORD_BUF - UNIQUE_BUF. - (print_completions): Adjusted to the definition. - -1999-09-19 OKUJI Yoshinori - - * acinclude.m4 (grub_ASM_PREFIX_REQUIREMENT): Do not call - AC_DEFINE_UNQUOTEs within AC_CACHE_VAL. Define ADDR32 and DATA32 - after it. - (grub_CHECK_START_SYMBOL): Do not call AC_DEFINE within - AC_CACHE_VAL. Define HAVE_START_SYMBOL after it. - (grub_CHECK_USCORE_START_SYMBOL): Do not call AC_DEFINE within - AC_CACHE_VAL. Define HAVE_USCORE_START_SYMBOL after it. - (grub_CHECK_END_SYMBOL): Do not call AC_DEFINE within - AC_CACHE_VAL. Define HAVE_END_SYMBOL after it. - (grub_CHECK_USCORE_END_SYMBOL): Do not call AC_DEFINE within - AC_CACHE_VAL. Define HAVE_USCORE_END_SYMBOL after it. - -1999-09-17 Pavel Roskin - - * acconfig.h (ADDR32): Removed. This entry is automatically - created by autoheader. - (DATA32): Likewise. - * acinclude.m4 (grub_ASM_ADD32): Use ADDR32 instead of addr32. - Require grub_ASM_PREFIX_REQUIREMENT. - (grub_ASM_PREFIX_REQUIREMENT): Define ADDR32 and DATA32. - * configure.in: Call grub_ASM_PREFIX_REQUIREMENT before - grub_ASM_ADDR32. Do not define ADDR32 and DATA32. - * stage1/stage1.S (after_BPB): Use ABS(firstlist) instead of - firstlist. - (MSG): Use ABS(x) instead of x. - (probe_loop): Use the macro MSG for fd_probe_error_string. - * stage1/stage1_lba.S (after_BPB): Use ABS(firstlist) instead of - firstlist. - (MSG): Use ABS(x) instead of x. - * stage2/asm.S (putchar): Renamed to ... - (grub_putchar): ... this. - -1999-09-18 OKUJI Yoshinori - - * stage2/gunzip.c (reset_linalloc): Use the macro RAW_ADDR - before setting LINALLOC_TOPADDR. - * stage2/shared.h [!GRUB_UTIL] (RAW_ADDR): Added parenthesises - to avoid a gcc warning. - [!GRUB_UTIL] (RAW_SEG): Likewise. - -1999-09-18 OKUJI Yoshinori - - * acinclude.m4 (grub_CHECK_START_SYMBOL): New function. - (grub_CHECK_USCORE_START_SYMBOL): Likewise. - (grub_CHECK_END_SYMBOL): Likewise. - (grub_CHECK_USCORE_SYMBOL): Likewise. - * configure.in: Call grub_CHECK_START_SYMBOL and - grub_CHECK_USCORE_START_SYMBOL, and if neither start nor _start - is defined, print an error message and exit. - Likewise, call grub_CHECK_END_SYMBOL and - grub_CHECK_USCORE_END_SYMBOL, and if neither end nor _end is - defined, print an error message and exit. - * acconfig.h (HAVE_START_SYMBOL): Added the "undef" entry. - (HAVE_USCORE_START_SYMBOL): Likewise. - (HAVE_END_SYMBOL): Likewise. - (HAVE_USCORE_END_SYMBOL): Likewise. - * stage2/char_io.c (memcheck): Rename the argument START to - ADDR. Added two missing equal characters. - [GRUB_UTIL]: Define new local functions start_addr and end_addr. - [GRUB_UTIL && HAVE_START_SYMBOL]: The function start_addr - returns START. - [GRUB_UTIL && HAVE_USCORE_START_SYMBOL]: The function start_addr - returns _START. - [GRUB_UTIL && HAVE_END_SYMBOL]: The function end_addr returns - END. - [GRUB_UTIL && HAVE_USCORE_END_SYMBOL]: The function end_addr - returns _END. - [GRUB_UTIL]: If ADDR is equal to or greater than the address - returned by start_addr, and ADDR plus LEN is less than the - address returned by end_addr, return ! ERRNUM. - * stage2/asm.S (get_code_end) [HAVE_END_SYMBOL]: Use $end as the - end of the bss. - [HAVE_USCORE_END_SYMBOL]: Use $_end as the end of the bss. - * stage2/disk_io.c [!STAGE1_5] (cur_part_desc): Made static. - Need not to be global any longer. - -1999-09-17 OKUJI Yoshinori - - * stage2/char_io.c [!STAGE1_5] (get_cmdline): The argument - COMPLETION is renamed to READLINE. - Do not initialize KILL here. - TAB, C-a, C-e, C-f, C-b, C-u, C-k, C-y, C-p and C-n are handled - only if READLINE is non-zero. - If ECHO_CHAR is not NUL, do not remove the leading spaces in BUF. - Add CMDLINE into the history list only if READLINE is non-zero. - * stage2/stage2.c (cmain): Initialize the kill buffer. - -1999-09-17 OKUJI Yoshinori - - Killing, yanking and manipulating the history are supported. - - * stage2/shared.h (cur_cmdline): Removed. - (MAX_CMDLINE): Moved near the beginning of the file. - (NEW_HEAPSIZE): Likewise. - (CMDLINE_BUFLEN): Set to MAX_CMDLINE. - (KILL_BUF): New macro. - (KILL_BUFLEN): Likewise. - (HISTORY_BUF): Likewise. - (HISTORY_SIZE): Likewise. - (HISTORY_BUFLEN): Likewise. - (MENU_BUF): Set to HISTORY_BUF + HISTORY_BUFLEN. - (MENU_BUFLEN): Set to 0x8000 + PASSWORD_BUF - HISTORY_BUF. - (strcpy): New macro. - (grub_strcpy): Delared. - * stage2/boot.c (cur_cmdline): Removed. - * stage2/char_io.c [!STAGE1_5] (grub_strcpy): New function. - [!STAGE1_5] (get_history): Likewise. - [!STAGE1_5] (add_history): Likewise. - [!STAGE1_5] (get_cmdline): Use BUF instead of CMDLINE for the - working buffer for the command-line. - A new function cl_insert is used to insert a string to the - command-line. - In the case where C-u or C-k is pressed, copy the string being - deleted to KILL. - If C-y is pressed, insert KILL to the command-line. - If C-p is pressed, fetch the previous command from the history - list HISTORY, and if C-n is pressed, fetch the next command from - it. - If LPOS is less than LLEN, add CMDLINE into the history list. - If C is equal to KEY_UP, set C to 16, and if C is equal to - KEY_DOWN, set C to 14. - [!STAGE1_5] (num_history): New variable. - -1999-09-15 OKUJI Yoshinori - - * stage2/size_test: Do not check for the size of Stage 2. - * stage1/Makefile.am (stage2_size.h): Use `set' and `echo' - instead of awk, since we cannot expect awk is present. Remove - stage2_size.h before creating it. - -1999-09-15 Pavel Roskin - - * Makefile.am (SUBDIRS): Put stage1 after stage2 so that stage2 - is built before stage1. - * stage1/Makefile.am (BUILT_SOURCES): New varilable. - (CLEANFILES): Added BUILT_SOURCES. - (stage1_exec_SOURCES): Added stage2_size.h. - (stage1_lba_exec_SOURCES): Likewise. - (stage2_size.h): New rule. - * stage1/stage1.S: Include and use STAGE2_SIZE - to determine how much number of sectors to be read when loading - Stage 2. - * stage1/stage1_lba.S: Likewise. - -1999-09-15 OKUJI Yoshinori - - * netboot/config.h: Moved to ... - * netboot/netboot_config.h: ... here. - * netboot/config.c: Include netboot_config.h instead of config.h. - * netboot/fsys_tftp.c: Likewise. - * netboot/ip.c: Likewise. - * netboot/Makefile.am (libdrivers_a_SOURCES): Removed config.h - and added netboot_config.h. - -1999-09-14 Pavel Roskin - - * grub/asmstub.c [__linux__]: On GLibc 2.0 and newer use lseek, - don't include and define BLKFLSBUF if needed. - -1999-09-14 OKUJI Yoshinori - - Now the grub shell works fine on FreeBSD. A patch by Pavel - Roskin is modified and applied. - - * grub/asmstub.c (get_drive_geometry): New function. - (get_diskinfo): Use get_drive_geometry to set the geometry of - DRIVE. - -1999-09-14 OKUJI Yoshinori - - * configure.in (--enable-ne): Made the description more clear. - (--enable-nepci): Likewise. - (--enable-wd): Likewise. - (--enable-t503): Likewise. - (--enable-t509): Likewise. - (--enable-3c59x): Likewise. - (--enable-lance): Likewise. - (--enable-cs): Likewise. - (--enable-eepro100): Likewise. - (--enable-wd-default_mem): Renamed to ... - (--enable-wd-default-mem): ... this. - (--enable-cs-scan): Corrected the description. - (NETBOOT_SUPPORT): Defined if NET_CFLAGS is not empty. - * stage2/Makefile.am (stage2_exec_LDADD): Defined only if - NETBOOT_SUPPORT is true. - * netboot/Makefile.am (LIBDRIVERS): New variable. If - NETBOOT_SUPPORT is true, set to libdriver.a, otherwise set to an - empty string. - (noinst_LIBRARIES): Set to LIBDRIVERS. - (DRIVERS): Added 3c509.h, cs89x0.h and ns8390.h. - (libdrivers_a_SOURCES): Added byteorder.h, config.h, if.h, io.h, - ip.h, netboot.h, netdevice.h, nic.h and pic.h. - (libdrivers_a_CFLAGS): Added -fno-builtin and -nostdinc and - removed -O2. - * stage2/char_io.c (grub_sprintf): Added parenthesises to avoid - gcc warnings. - * stage2/gunzip.c (gunzip_test_header): Check if FSYS_TYPE is - TFTP. If so, set IS_TFTP to non-zero, otherwise to zero. And, - use IS_TFTP to check if we have GZIP_CRC instead of the equation - "FILEMAX == 16 * 1024 * 1024". - -1999-09-13 Edmund GRIMLEY EVANS - - The netboot support in the Dresden version of GRUB is integrated. - - * Makefile.am (SUBDIRS): Added netboot. - * configure.in (--enable-tftp): New option. - (--enable-ne): Likewise. - (--enable-nepci): Likewise. - (--enable-wd): Likewise. - (--enable-t503): Likewise. - (--enable-t509): Likewise. - (--enable-3c59x): Likewise. - (--enable-lance): Likewise. - (--enable-cs): Likewise. - (--enable-eepro100): Likewise. - (--enable-ne-scan): Likewise. - (--enable-wd-default_mem): Likewise. - (--enable-cs-scan): Likewise. - (NET_CFLAGS): New variable. - (NET_EXTRAFLAGS): Likewise. - Do AC_OUTPUT for netboot/Makefile as well. - * stage1/stage1.S: Set the number of sectors for Stage 2 to 130. - * stage1/stage1_lba.S: Likewise. - * stage2/Makefile.am (stage2_exec_LDADD): Added - ../netboot/libdrivers.a. - * stage2/asm.S [!STAGE1_5] (currticks): New function. - * stage2/char_io.c [!STAGE1_5] (grub_sprintf): Likewise. - [!STAGE1_5] (grub_memcmp): Likewise. - * stage2/disk_io.c (fsys_table) [FSYS_TFTP]: Added an entry for - tftp. - (sane_partition) [!STAGE1_5]: If CURRENT_DRIVE is a network - drive, return 1. - (real_open_partition) [!STAGE1_5]: Likewise. - (set_device): If DEVICE contains a network drive, set - CURRENT_DRIVE to 0x20. - * stage2/filesys.h [FSYS_TFTP] (FSYS_TFTP_NUM): Defined as 1. - [!FSYS_TFTP] (FSYS_TFTP_NUM): Defined as 0. - (NUM_FSYS): Added FSYS_TFTP_NUM. - * stage2/gunzip.c (gunzip_test_header): If FILEMAX >= 16MB, do - not try to examine the last 8 bytes of the file. This is - required for compressed files by TFTP. - * stage2/shared.h (sprintf): New macro. - (memcmp): Likewise. - (currticks): Declared. - (grub_sprintf): Likewise. - (grub_memcmp): Likewise. - * stage2/size_test: Set the maximum size of Stage 2 to 66560. - * netboot/3c509.c: New file. - * netboot/3c509.h: Likewise. - * netboot/3c59x.c: Likewise. - * netboot/Makefile.am: Likewise. - * netboot/Makefile.in: Likewise. - * netboot/byteorder.h: Likewise. - * netboot/compile: Likewise. - * netboot/config.c: Likewise. - * netboot/config.h: Likewise. - * netboot/cs89x0.c: Likewise. - * netboot/cs89x0.h: Likewise. - * netboot/eepro100.c: Likewise. - * netboot/fsys_tftp.c: Likewise. - * netboot/if.h: Likewise. - * netboot/io.h: Likewise. - * netboot/ip.c: Likewise. - * netboot/ip.h: Likewise. - * netboot/lance.c: Likewise. - * netboot/netboot.h: Likewise. - * netboot/netdevice.h: Likewise. - * netboot/nic.h: Likewise. - * netboot/ns8390.c: Likewise. - * netboot/ns8390.h: Likewise. - * netboot/pci.c: Likewise. - * netboot/pci.h: Likewise. - -1999-09-13 OKUJI Yoshinori - - * configure.in (--enable-maintainer-mode): Do not use our own - rule, but use AM_MAINTAINER_MODE instead. If the maintainer mode - is enabled, then check for perl, and if it is not found, print - an error message and abort. - * docs/Makefile.am (grub.8): Regenerated if MAINTAINER_MODE is - defined, instead of GRUB_MAINT. Use the variable PERL rather - than running help2man directly. - -1999-09-13 Pavel Roskin - - * stage2/pc_slice.h (IS_PC_SLICE_TYPE_EXTENDED): New macro. - * stage2/disk_io.c (real_open_partition): Use - IS_PC_SLICE_TYPE_EXTENDED instead of comparing CURRENT_SLICE - with the extended partition types. - -1999-09-11 Pavel Roskin - - * acconfig.h: New file for autoheader support. - * acinclude.m4 (grub_ASM_EXT_C) Renamed to ... - (grub_ASM_USCORE): ... this. Define HAVE_ASM_USCORE if a C - symbol gets an underscore after compiling to assembler. - * configure.in: Added AM_CONFIG_HEADER. Autoconf 2.13 is now - required. Test for wgetch(), not getch() in -l[n]curses. - * stage2/shared.h (EXT_C): Defined. - Include the best existing header for [n]curses. - -1999-09-12 OKUJI Yoshinori - - * stage2/boot.c (load_image): Use CURRENT_DRIVE and - CURRENT_PARTITION instead of SAVED_DRIVE and SAVED_PARTITION for - the boot device in the Multiboot information. Reported by - Stephen Early . - -1999-09-12 OKUJI Yoshinori - - * stage2/disk_io.c (sane_partition) [STAGE1_5]: Defined. - (set_device): Use sane_partition to make sure that CURRENT_DRIVE - has a valid value. Reported by Pavel Roskin. - -1999-09-11 OKUJI Yoshinori - - From Pavel Roskin: - * stage2/builtins.c (device_func) [GRUB_UTIL]: Use check_device - in order to make sure that DEVICE exists. - * grub/asmstub.c (check_device): New function. - (grub_stage2): Use check_device to probe a device. - - * stage2/builtins.c (geometry_func) [GRUB_UTIL]: Copy the - modified geometry to GEOM and reset BUF_DRIVE. Reported by Pavel - Roskin. - - * grub/main.c (no_floppy): New variable. - (probe_second_floppy): Likewise. - (OPT_NO_FLOPPY): New macro. - (OPT_PROBE_SECOND_FLOPPY): Likewise. - (longopts): Added no-floppy and probe-second-floppy. - (usage): Added the descriptions about --no-floppy and - --probe-second-floppy. - (main): Handle OPT_PROBE_SECOND_FLOPPY and OPT_NO_FLOPPY. - * grub/asmstub.c (grub_stage2): Print a message before the probe - routine. If NO_FLOPPY is non-zero, do not probe any floppy drive. - If PROBE_SECOND_FLOPPY is zero, skip the probe of the second - floppy drive. - (get_floppy_disk_name): New function. - (get_ide_disk_name): Likewise. - (get_scsi_disk_name): Likewise. - -1999-09-10 OKUJI Yoshinori - - * stage2/builtins.c (device_func): New function. - (builtin_device): New variable. - (builtin_table): Added the pointer to BUILTIN_DEVICE. - (builtin_geometry) [GRUB_UTIL]: Accept extra arguments, - CYLINDER, HEAD, SECTOR and TOTAL_SECTOR, and, if they are found, - set the geometry of a drive specified to them. - * grub/asmstub.c (disks): Made global. - (assign_device_name): New function. - -1999-09-09 Gordon Matzigkeit - - * docs/grub.texi (Commands): Synchronize descriptions with - builtins.c. - - * stage2/builtins.c (hide_func): Use set_partition_hidden_flag. - (unhide_func): Likewise. - Many help message cleanups. From Pavel Roskin. - - * stage2/shared.h (set_partition_hidden_flag): Declare. - - * stage2/disk_io.c (set_partition_hidden_flag): New function - merged from hide_partition and unhide_partition. Make sure we OR - with the inverse of the flag bit rather than XORing to unhide the - partition. - -1999-09-10 OKUJI Yoshinori - - * grub/asmstub.c (_FILE_OFFSET_BITS): Defined. - (biosdisk) [!__linux__]: Pass the offset argument as off_t - instead of int to lseek, and compare the return value with - OFFSET. Reported by Pavel Roskin. - (grub_stage2) [!__linux__ && !__GNU__]: Print a warning message. - -1999-09-08 OKUJI Yoshinori - - * stage2/stage2.c (run_menu): If run_script is successfully - finished, break the loop. Reported by Pavel Roskin. - Do not wait an input character when FALLBACK_ENTRY is less than - zero. - * stage2/cmdline.c (run_script): If ERRNUM is non-zero, wait an - input character, whether FALLBACK is less than zero or not. - -1999-09-06 OKUJI Yoshinori - - * stage2/builtins.c (configfile_func): New function. - (builtin_configfile): New variable. - (builtin_table): Added the pointer to BUILTIN_CONFIGFILE. - -1999-09-06 OKUJI Yoshinori - - From Pavel Roskin: - * stage2/asm.S [!STAGE1_5] (chain_stage2): Deleted. - [STAGE1_5] (get_code_end): Likewise. - * stage2/char_io.c (grub_strncat): Likewise. - * stage2/common.c [STAGE1_5] (saved_mem_upper): Likewise. - * stage2/smp-imps.c (imps_release_cpus): Likewise. - (imps_any_new_apics): Made static. - (imps_enabled): Likewise. - (imps_num_cpus): Likewise. - (imps_lapic_addr): Likewise. - (imps_cpu_apic_map): Likewise. - (imps_apic_cpu_map): Likewise. - -1999-09-06 OKUJI Yoshinori - - * stage2/builtins.c (testload_func): Fix the typos: 0x2000000 -> - 0x200000 and 0x3000000 -> 0x300000. - -1999-09-06 OKUJI Yoshinori - - From Hisazumi Kenji : - * stage2/fsys_ffs.c (mapblock_offset): New variable. - (mapblock_bsize): Likewise. - (MAPBUF): New macro. - (MAPBUF_LEN): Likewise. - (ffs_mount): Set MAPBLOCK_OFFSET to -1. - (block_map): Added partial read support. - -1999-09-06 OKUJI Yoshinori - - * stage2/cmdline.c (find_command): If COMMAND is less than - (*BUILTIN)->NAME in dictionary order, break the loop. - * stage2/builtins.c (builtin_chainloader): Capitalize the - variable name in the short doc. - (builtin_color): Likewise. - (builtin_geometry): Likewise. - (builtin_help): Likewise. - (builtin_hide): Likewise. - (builtin_initrd): Likewise. - (builtin_install): Likewise. - (builtin_kernel): Likewise. - (builtin_module): Likewise. - (builtin_modulenounzip): Likewise. - (builtin_pause): Likewise. - (builtin_read): Likewise. - (builtin_root): Likewise. - (builtin_testload): Likewise. - (builtin_unhide): Likewise. - (builtin_uppermem): Likewise. - -1999-09-05 OKUJI Yoshinori - - The internal of the command handling is heavily modified, and - a new command "help" is added. - - * stage1/stage1.S: Set the number of sectors for Stage 2 to 110. - * stage1/stage1_lba.S: Likewise. - * stage2/builtins.c: New file. - * stage2/Makefile.am (libgrub_a_SOURCES): Added builtins.c. - (stage2_exec_SOURCES): Likewise. - * stage2/boot.c (load_image): Return kernel_t instead int. - (bsd_boot): Change the type of the first argument to kernel_t. - * stage2/char_io.c (get_cmdline): Do not accept the argument - COMMANDS and accept the argument COMPLETION. - Print completions only if COMPLETION is non-zero. - Print the list of short docs when the command is completed. - * stage2/cmdline.c [GRUB_UTIL]: Do not include apic.h and - smp-imps.h. - (fallback): Deleted. - (password): Likewise. - (debug): Likewise. - (normal_color): Likewise. - (highlight_color): Likewise. - (print_cmdline_message): New function. - (commands): Deleted. - (debug_fs_print_func): Likewise. - (installaddr): Likewise. - (installlist): Likewise. - (installsect): Likewise. - (debug_fs_blocklist_func): Likewise. - (find_command): New function. - (init_cmdline): Initialize the data for the command-line - interface. The function to print the message is moved to - print_cmdline_message. - (enter_cmdline): Rewritten from scratch. Now deal with only the - pure command-line and the function to deal with a menu entry is - moved to run_script. - (run_script): New function. - * stage2/shared.h (PASSWORD_BUF): New macro. - (PASSWORD_BUFLEN): Likewise. - (CMDLINE_BUF): Likewise. - (CMDLINE_BUFLEN): Likewise. - (MENU_BUF): Likewise. - (MENU_BUFLEN): Likewise. - (fallback): Deleted. - (fallback_entry): Declared. - (default_entry): Likewise. - (BUILTIN_CMDLINE): New macro. - (BUILTIN_MENU): Likewise. - (BUILTIN_TITLE): Likewise. - (struct builtin): New tag. - (builtin_table): Declared. - (cmdline_t): Deleted. - (kernel_t): New type. - (kernel_type): Declared. - (grub_timeout): Likewise. - (init_builtins): Likewise. - (init_config): Likewise. - (find_command): Likewise. - (print_cmdline_message): Likewise. - (run_script): Likewise. - [!STAGE1_5] (bsd_boot): Deleted. - [!STAGE1_5] (load_image): Likewise. - [!STAGE1_5] (load_module): Likewise. - [!STAGE1_5] (load_initrd): Likewise. - * stage2/size_test: Set the maximum size of Stage 2 to 56320. - * stage2/stage2.c (grub_timeout): Deleted. - (menu_t): Likewise. - (run_menu): Changed the return type to void. - Use FALLBACK_ENTRY instead of FALLBACK. - Do not check the return value of enter_cmdline. - (run_menu) [GRUB_UTIL]: Call stop instead of returning - MENU_ABORT. - (cmain): Set MENU_ENTRIES to MENU_BUF. - Call init_config instead of clearing the variables directly. - Use CMDLINE_BUF for the command-line buffer instead of the - stack. - Adapted the analysis routine for the configuration file to the - new builtin commands interface. - Run enter_cmdline forever. - If run_menu returns, restart the loop. - -1999-09-04 Pavel Roskin - - * docs/menu.lst: More meaningful examples. Not using (0x80,0) - notation anymore. - * stage2/stage2.c (run_menu): Erase the entered password before - get_cmdline(). Help on TAB disabled when entering the password. - * stage2/char_io.c (get_cmdline): Restore command-line even if - there is no help string. - * configure.in: --disable-gunzip disables decompression in - stage2. - * stage2/gunzip.c [NO_DECOMPRESSION]: Disable all code if - decompression is disabled. - -1999-09-03 OKUJI Yoshinori - - * stage2/boot.c (load_image): Use PHDR->P_PADDR instead of - PHDR->P_VADDR. Reported by Ramon van Handel . - -1999-09-03 OKUJI Yoshinori - - * docs/help2man: Upgraded to 1.013. - * docs/grub.8: Regenerated. - -1999-09-02 Pavel Roskin - - * stage2/cmdline.c (enter_cmdline) [GRUB_UTIL]: Add a space in - the LBA warning message. - -1999-09-02 OKUJI Yoshinori - - The character `=' after a command is now optional. - - * stage2/char_io.c (get_cmdline): Search for a space or a equal - character after the first word in CMDLINE when TAB lists - completions, instead of just searching for a eqaul character. - * stage2/cmdline.c (skip_to): Treat the character `=' as a space - if AFTER_EQUAL is non-zero. - (commands): Delete all the equal characters. - * docs/menu.lst: Likewise. - * docs/grub.texi: Likewise. - -1999-09-01 OKUJI Yoshinori - - * grub/asmstub.c (env_for_exit): New variable. - (grub_stage2): Do a setjmp in doit, and when it returns - non-zero, set STATUS to 1 if ERRNUM is non-zero. - (stop): Call longjmp instead of exit. - -1999-08-31 Pavel Roskin - - * stage2/boot.c [GRUB_UTIL] (bsd_boot_entry): New function. - (bsd_boot) [GRUB_UTIL]: Set ENTRY_ADDR to BSD_BOOT_ENTRY to fake - the *BSD boot. - -1999-08-31 OKUJI Yoshinori - - * stage2/fsys_fat.c (fat_create_blocklist): Cast FAT_BUF to - unsigned short * instead of unsigned long *. Suggested by Pavel - Roskin. - -1999-08-30 OKUJI Yoshinori - - From Edward Killips : - * stage2/cmdline.c (commands): Added hide and unhide. - (enter_cmdline): Likewise. - * stage2/disk_io.c (unhide_partition): New function. - (hide_partition): Likewise. - * stage2/pc_slice.h (PC_SLICE_TYPE_HIDDEN_FLAG): New macro. - -1999-08-29 OKUJI Yoshinori - - From Pavel Roskin : - * stage2/fsys_minix.c (namelen): New variable. - (MINIX_NAME_LEN): Deleted. - (minix_mount): Set NAMELEN to 14 if SUPRTBLOCK->S_MAGIC is - MINIX_SUPER_MAGIC, and set NAMELEN to 30 if it is - MINIX_SUPER_MAGIC2. - (minix_dir): Use NAMELEN instead of MINIX_NAME_LEN. - -1999-08-29 Pavel Roskin - - * grub/Makefile.am, stage1/Makefile.am, stage2/Makefile.am: - Avoid using variables inclosed in '@' because they cannot be - overridden at the make time. - -1999-08-29 Pavel Roskin - - * stage2/fsys_fat.c (fat_create_blocklist): Return 1 for the - root directory on FAT12 and FAT16. - -1999-08-27 OKUJI Yoshinori - - * stage2/boot.c (load_image): Accept two arguments, KERNEL and - ARG. And use them instead of CUR_CMDLINE. - (load_module): Accept two arguments, MODULE and ARG. And use - them instead of CUR_CMDLINE. - (load_initrd): Accept one argument, INITRD. And use it instead - of CUR_CMDLINE. - (bsd_boot): Accept one additional argument, ARG. And use it - instead of CUR_CMDLINE. - * stage2/cmdline.c (enter_cmdline): Use MB_CMDLINE instead of - HEAP for the Multiboot command-line buffer. - * stage2/shared.h (MB_CMDLINE_BUF): New macro. - (MB_CMDLINE_BUFLEN): Likewise. - -1999-08-26 OKUJI Yoshinori - - * docs/Makefile.am [GRUB_MAINT] (grub.8): The argument for the - option --name is changed to "the grub shell". - * docs/grub.8: Regenerated. - * docs/grub.texi: Do not use the name "the Stage 2 emulator" any - more. Use the name "the grub shell" instead. - -1999-08-26 OKUJI Yoshinori - - From Klaus Reichl : - * stage2/fsys_minix.c: New file. - * stage2/size_test: Added a check for the size of minix_stage1_5. - * stage2/Makefile.am (libgrub_a_SOURCES): Added fsys_minix.c. - (libgrub_a_CFLAGS): Added -DFSYS_MINIX=1. - (nodist_pkgdata_DATA): Added minix_stage1_5. - (noinst_PROGRAMS): Added minix_stage1_5.exec. - (stage2_exec_SOURCES): Added fsys_minix.c. - (minix_stage1_5_exec_SOURCES): New variable. - (minix_stage1_5_exec_CFLAGS): Likewise. - (minix_stage1_5_exec_LDFLAGS): Likewise. - * stage2/pc_slice.h (PC_SLICE_TYPE_MINIX): New macro. - * stage2/disk_io.c (fsys_table) [FSYS_MINIX]: Added minix entry. - * stage2/filesys.h [FSYS_MINIX] (FSYS_MINIX_NUM): Set to 1. - [!FSYS_MINIX] (FSYS_MINIX_NUM): Set to 0. - [!NUM_FSYS] (NUM_FSYS): Added FSYS_MINIX_NUM. - * stage2/shared.h (STAGE2_ID_MINIX_STAGE1_5): New macro. - [STAGE1_5 && FSYS_MINIX] (STAGE2_ID): Set to - STAGE2_ID_MINIX_STAGE1_5. - * grub/Makefile.am (AM_CFLAGS): Added -DFSYS_MINIX=1. - * configure.in (--disable-minix): New option. - -1999-08-25 OKUJI Yoshinori - - From Jochen Hoenicke : - * stage2/fat.h (FAT_BPB_FAT_SECTORS_16): New macro. - (FAT_BPB_FAT_SECTORS_32): Likewise. - (FAT_BPB_IS_FAT32): Likewise. - (FAT_BPB_ROOT_DIR_CLUSTER): Likewise. - (FAT_BPB_FAT_SECTORS): If FAT_BPB_FAT_SECTORS_16 returns - a non-zero value, return it. Otherwise return - FAT_BPB_FAT_SECTORS_32. - (FAT_DIRENTRY_FIRST_CLUSTER): Corrected. - * stage2/fsys_fat.c (root_dir): New variable. - (fat_mount): Use the macro IS_PC_SLICE_TYPE_FAT instead of - checking for each fs types directly. - Omit the >64 sectors check. - If the current fs type is FAT32, then set FAT_SIZE to 8 and - get the root from BPB. - (fat_create_blocklist): Use the macro SECTOR_SIZE instead of a - magic number. - (fat_dir): Set MAP to ROOT_DIR instead of -1. - * stage2/pc_slice.h (PC_SLICE_TYPE_FAT32): New macro. - (PC_SLICE_TYPE_FAT32_LBA): Likewise. - (PC_SLICE_TYPE_FAT16_LBA): Likewise. - (IS_PC_SLICE_TYPE_FAT): Likewise. - -1999-08-25 OKUJI Yoshinori - - * stage2/fsys_ffs.c (ffs_mount): Do not shift the fs type - FS_BSDFFS. Reported by Takehiro Suzuki - . - * stage2/fsys_fat.c (fat_mount): Do not shift the fs type - FS_MSDOS. - -1999-08-13 OKUJI Yoshinori - - Pavel Roskin's patch that adds new options to disable arbitrary - filesystems is heavily modified and applied. - - * configure.in (--disable-ext2fs): New option. - (--disable-fat): Likewise. - (--disable-ffs): Likewise. - (FSYS_CFLAGS): New variable. Set to filesystems the user choose. - * grub/Makefile.am (AM_CFLAGS): Added -DFSYS_EXT2FS=1, - -DFSYS_FAT=1 and -DFSYS_FFS=1. - * stage2/Makefile.am (libgrub_a_CFLAGS): Likewise. - (stage2_exec_CFLAGS): Added @FSYS_CFLAGS@. - * stage2/filesys.h - [!(FSYS_FFS || FSYS_FAT || FSYS_EXT2FS)] (FSYS_FFS): Deleted. - [!(FSYS_FFS || FSYS_FAT || FSYS_EXT2FS)] (FSYS_FAT): Likewise. - [!(FSYS_FFS || FSYS_FAT || FSYS_EXT2FS)] (FSYS_EXT2FS): Likewise. - * stage2/fsys_ext2fs.c [!FSYS_EXT2FS]: Do not define anything. - * stage2/fsys_fat.c [!FSYS_FAT]: Likewise. - * stage2/fsys_ffs.c [!FSYS_FFS]: Likewise. - -1999-08-12 OKUJI Yoshinori - - * stage1/stage1_lba.S: Use STAGE1_DRP_ADDR for the address of - drive parameters instead of DRIVE_PARAMETER. - (drive_parameter): Deleted. - * stage1/stage1.h (STAGE1_DRP_ADDR): New macro. - (STAGE1_DRP_SIZE): Likewise. - -1999-08-11 OKUJI Yoshinori - - * stage2/bios.c (get_diskinfo): In LBA mode, set TOTAL_SECTORS - to the low 32bits of DRP.TOTAL_SECTORS instead of the multiple - of CHS. - * stage2/cmdline.c (enter_cmdline) [GRUB_UTIL]: In the command - "geometry", print the device file name instead of CHS/LBA - information. - * stage2/shared.h (device_map): Declared. - * grub/asmstub.c (device_map): Defined as a global variable - instead of a local variable. - -1999-08-10 OKUJI Yoshinori - - Support the NetBSD and OpenBSD partition slices. - - * stage2/pc_slice.h (PC_SLICE_TYPE_BSD): Deleted. - (PC_SLICE_TYPE_FREEBSD): New macro. - (PC_SLICE_TYPE_OPENBSD): Likewise. - (PC_SLICE_TYPE_NETBSD): Likewise. - (IS_PC_SLICE_TYPE_BSD_WITH_FS): Likewise. - (IS_PC_SLICE_TYPE_BSD): Likewise. - * stage2/fsys_ffs.c (ffs_mount): Use the macro - IS_PC_SLICE_TYPE_BSD_WITH_FS instead of checking if - CURRECT_SLICE is equal to the BSD partition type directly. - * stage2/fsys_ext2fs.c (ext2fs_mount): Likewise. - * stage2/fsys_fat.c (fat_mount): Likewise. - * stage2/disk_io.c (check_BSD_parts): Set the low bits of - CURRENT_SLICE to PC_SLICE_TYPE_FREEBSD instead of - PC_SLICE_TYPE_BSD. - (real_open_partition): Use the macro IS_PC_SLICE_TYPE_BSD instead - of checking if CURRENT_SLICE is equal to the BSD partition type - directly. - -1999-08-09 OKUJI Yoshinori - - * stage2/cmdline.c (commands): Added geometry. - (enter_cmdline): If CUR_HEAP has the string "geometry", print - out the information about a drive that the argument represents. - -1999-08-09 OKUJI Yoshinori - - * stage2/stage2.c (run_menu): Terminate the string PASSWORD - before checking if ENTERED is identical to PASSWORD. Reported - by Mark Lundeberg . - -1999-08-08 OKUJI Yoshinori - - * stage2/stage2.c (set_line_normal): New function. - (set_line_highlight): Likewise. - (run_menu): Do not call the function set_line directly any - longer, call set_line_normal and set_line_highlight instead. - - From Pavel Roskin: - * stage2/stage2.c (run_menu) [GRUB_UTIL]: Quit when pushing the - key `q'. - -1999-08-05 OKUJI Yoshinori - - * acinclude.m4 (grub_ASM_PREFIX_REQUIREMENT): New function. - * configure.in: Call grub_ASM_PREFIX_REQUIREMENT, and define - ADDR32 and DATA32 based on the result. - * stage2/asm.S: Replace addr32 and data32 prefixes with ADDR32 - and DATA32 respectively. - -1999-08-05 Pavel Roskin - - * stage2/boot.c (load_image): Use RAW_ADDR macro when loading - an a.out kernel. - -1999-08-04 OKUJI Yoshinori - - * stage2/asm.S: Make each of the addr32 and data32 prefixes - appear in the same line as it modifies, as the gas manual in - binutils-2.9.5.0.4 says "it must be in the same line". - -1999-08-04 OKUJI Yoshinori - - * boot.c (load_image): Fix a strcmp test. Reported by Pavel - Roskin . - -1999-08-03 OKUJI Yoshinori - - From "Dan J. Walters" : - * stage2/i386-elf.h (EI_BRAND): New macro. - * stage2/boot.c (load_image): If the kernel is ELF, check if it - is a FreeBSD kernel as well as a Multiboot kernel, and if it is - a FreeBSD kernel, then mask ENTRY_ADDR since FreeBSD requires - that. Likewise, mask MEMADDR. - (bsd_boot): Set the bi_symtab and the bi_esymtab members of BI - only if MBI.FLAGS has the flag MB_INFO_AOUT_SYMS. Otherwise, - clear them. - -1999-07-30 OKUJI Yoshinori - - From Pavel Roskin : - * grub/getopt.c: New file. Copied from texinfo-3.12n. - * grub/getopt1.c: Likewise. - * grub/getopt.h: Likewise. - * grub/Makefile.am (grub_SOURCES): Added getopt.c, getopt1.c and - getopt.h. - * configure.in: Check for string.h and strings.h. - * grub/asmstub.c (grub_stage2): Fix a misordering in the output - format of the inline assembly. - -1999-07-30 OKUJI Yoshinori - - From Pavel Roskin : - * stage2/asm.S (get_diskinfo_standard): If the number of sectors - returned is zero, then return an error code, even if non-carrier. - -1999-07-15 Gordon Matzigkeit - - * docs/Makefile.am (grub.info): Use an ugly hack to downgrade - grub.texi so that it works with Debian's version of texinfo. - -1999-07-26 OKUJI Yoshinori - - * stage2/bios.c (get_diskinfo): When DRIVE is a floppy drive, - try standard probe routine at first. Reported by Peter Astrand - . - - * grub/main.c (main): Call printf instead of grub_printf. - Reported by Klaus Reichl . - -1999-07-15 OKUJI Yoshinori - - * stage2/cmdline.c (skip_to): Don't increase CMDLINE if the - character to which CMDLINE points is NUL. - - * stage2/Makefile.am (EXTRA_DIST): Removed smp-imps.c. - (stage2_exec_SOURCES): Added smp-imps.c. - * stage2/cmdline.c [!GRUB_UTIL] (IMPS_DEBUG) (KERNEL_PRINT) - (CMOS_WRITE_BYTE) (CMOS_READ_BYTE) (PHYS_TO_VIRTUAL) - (VIRTUAL_TO_PHYS) (inb) (outb) (cmos_write_byte) - (cmos_read_byte): These are now defined in ... - * stage2/smp-imps.c (IMPS_DEBUG) (KERNEL_PRINT) - (CMOS_WRITE_BYTE) (CMOS_READ_BYTE) (PHYS_TO_VIRTUAL) - (VIRTUAL_TO_PHYS) (inb) (outb) (cmos_write_byte) - (cmos_read_byte): ... here. - * stage2/cmdline.c [!GRUB_UTIL]: Include apic.h and smp-imps.h. - -1999-07-14 OKUJI Yoshinori - - The function ungetch is simulated so that the user can use a - buggy curses. - - * grub/asmstub.c [HAVE_LIBCURSES] (save_char): New variable. - (getkey) [HAVE_LIBCURSES]: If SAVE_CHAR is not ERR, return - SAVE_CHAR and clear it. - (checkkey) [HAVE_LIBCURSES]: If SAVE_CHAR is not ERR, return - SAVE_CHAR. If C is not ERR, set SAVE_CHAR to C. - -1999-07-14 Pavel Roskin - - * stage2/char_io.c (get_cmdline) [GRUB_UTIL]: Recognize - backspace when ncurses fails to do this. - - * grub/asmstub.c (grub_stage2) [HAVE_LIBCURSES]: Call wtimeout - instead of nodelay. - (getkey) [HAVE_LIBCURSES]: Likewise. - -1999-07-14 OKUJI Yoshinori - - * stage1/stage1_lba.S (probe_values): New variable. This is not - used actually, but prevents `install' command from failing - bogusly. - -1999-07-14 OKUJI Yoshinori - - All constants in stage1s are moved to stage1.h and renamed - appropriately, and include stage1.h instead. - - * grub/Makefile.am (AM_CFLAGS): Added the include path to stage1. - * stage2/Makefile.am (INCLUDES): New variable. - * stage1/Makefile.am (stage1_exec_SOURCES): Added stage1.h - (stage1_lba_exec_SOURCES): Likewise. - * stage1/stage1.h: New file. - * stage1/stage1.S (SIGNATURE): Renamed to ... - * stage1/stage1.h (STAGE1_SIGNATURE): ... this. - * stage1/stage1.S (BPBEND): Renamed to ... - * stage1/stage1.h (STAGE1_BPBEND): ... this. - * stage1/stage1.S (PARTSTART): Renamed to ... - * stage1/stage1.h (STAGE1_PARTSTART): ... this. - * stage1/stage1.S (MINPARMSIZ): Renamed to ... - * stage1/stage1.h (STAGE1_MINPARMSIZE): ... this. - * stage1/stage1.S (LISTSIZ): Renamed to ... - * stage1/stage1.h (STAGE1_LISTSIZE): ... this. - * stage1/stage1.S (REALSTACK): Renamed to ... - * stage1/stage1.h (STAGE1_STACKSEG): ... this. - * stage1/stage1.S (BUFFERSEG): Renamed to ... - * stage1/stage1.h (STAGE1_BUFFERSEG): ... this. - * stage1/stage1.S (BIOS_HD_FLAG): Renamed to ... - * stage1/stage1.h (STAGE1_BIOS_HD_FLAG): ... this. - * stage1/stage1_lba.S (SIGNATURE): Removed. - * stage1/stage1_lba.S (BPBEND): Likewise. - * stage1/stage1_lba.S (PARTSTART): Likewise. - * stage1/stage1_lba.S (MINPARMSIZ): Likewise. - * stage1/stage1_lba.S (LISTSIZ): Likewise. - * stage1/stage1_lba.S (REALSTACK): Likewise. - * stage1/stage1_lba.S (BUFFERSEG): Likewise. - * stage1/stage1_lba.S (BIOS_HD_FLAG): Likewise. - - * stage1/stage1.S (stage1_id): New variable. - * stage1/stage1_lba.S (stage1_id): Likewise. - * stage1/stage1.h (COMPAT_VERSION_MINOR): Set to 2. - (STAGE1_ID_OFFSET): New macro. - (STAGE1_ID_CHS): Likewise. - (STAGE1_ID_LBA): Likewise. - * stage2/cmdline.c (enter_cmdline) [!GRUB_UTIL]: When running - the command `install' and STAGE1_FILE is stage1_lba, check if - LBA is supported. - (enter_cmdline) [GRUB_UTIL]: In the same case above, check only - if CURRENT_DRIVE is a hard disk and, if so, print a warning - message, because /sbin/grub cannot detect if LBA is supported or - not. - - * stage1/stage1_lba.S: Fix a bug that incorrectly assigns the - segment of buffer address. - -1999-07-13 OKUJI Yoshinori - - * stage2/boot.c (load_image): When removing "vga=...", memmove - the length of VGA_END plus one. - -1999-07-12 OKUJI Yoshinori - - * stage2/bios.c (get_diskinfo): In LBA mode, compute - TOTAL_SECTORS from DRP instead of GEOMETRY. - Clear GEOMETRY->FLAGS first. - - * stage2/boot.c (load_image): Fix inverted lines. - -1999-07-12 OKUJI Yoshinori - - Support Linux video mode selection. - - * stage2/shared.h (LINUX_VID_MODE_OFFSET): New macro. - (LINUX_VID_MODE_NORMAL): Likewise. - (LINUX_VID_MODE_EXTENDED): Likewise. - (LINUX_VID_MODE_ASK): Likewise. - [!WITHOUT_LIBC_STUBS] (strlen): Likewise. - (grub_strlen): Declared. - * stage2/boot.c (load_image): Added Linux video mode selection. - * stage2/char_io.c [!STAGE1_5] (grub_strlen): New function. - -1999-07-12 OKUJI Yoshinori - - * stage2/char_io.c (print_error): Print ERRNUM in the format of - %u instead of %d. - (convert_to_ascii) [STAGE1_5]: Eliminate the `x' and `d' - handling code. - (grub_printf): Declare FORMAT as `const char *'. - (grub_printf) [STAGE1_5]: Eliminate the `x' and `d' handling - code. - (get_based_digit): Removed. - (safe_parse_maxint): Remove unnecessary `register' prefixes, - because GCC does better optimization. - Declare DIGIT as `unsigned int' and calculate the value by more - compact instructions. - [!STAGE1_5] (grub_strncat): Declare S2 as `const char *'. - [!STAGE1_5] (grub_strcmp): Declare S1 and S2 as `const char *'. - [!STAGE1_5] (grub_strstr): Likewise. - (grub_memmove): Declare FROM as `const char *'. - The copy code is replaced with inline assembly code stolen from - Linux-2.2.2. - - * stage2/shared.h (grub_printf) : Corrected. - (grub_strncat): Likewise. - (grub_memmove): Likewise. - (grub_strstr): Likewise. - (grub_strcmp): Likewise. - -1999-07-11 OKUJI Yoshinori - - * stage1/stage1.S (sectors): Change the size to long. - (heads): Likewise. - (sector_start): New variable. - (head_start): Likewise. - (cylinder_start): Likewise. - (final_init): Set %si to SECTORS first, and use %si for memory - references. - Zero %eax so that the high 16 bits are always zero. - Set %di to FIRSTLIST - LISTSIZ instead of FIRSTLIST. - (bootloop): Omit the complex CHS recomputation, and always - compute them from LBA address instead. - Call 32bits div instructions instead of 16bits div instructions. - Update the position where to load data from at the end of this - loop, instead of the beginning. - - * stage1/stage1_lba.S: New file. - * stage1/Makefile.am (nodist_pkgdata_DATA): Added stage1_lba. - (LDFLAGS): New variable. - (noinst_PROGRAMS): Added stage1_lba.exec. - (stage1_lba_exec_SOURCES): New variable. - (%: %.exec): New rule. - -1999-06-28 OKUJI Yoshinori - - * grub/main.c (main): The third argument for strtoul is changed - to 0 in the case where an option is OPT_INSTALL_PARTIION. - Reported by Pavel Roskin . - -1999-06-27 OKUJI Yoshinori - - * stage2/shared.h (STAGE2_STAGE2_ID): New macro. - (STAGE2_VER_STR_OFFS): Set to 0xd. - (STAGE2_ID_STAGE2): New macro. - (STAGE2_ID_FFS_STAGE1_5): Likewise. - (STAGE2_ID_E2FS_STAGE1_5): Likewise. - (STAGE2_ID_FAT_STAGE1_5): Likewise. - (STAGE2_ID) [!STAGE1_5]: Defined as STAGE2_ID_STAGE2. - (STAGE2_ID) [STAGE1_5] [FSYS_FFS]: Defined as - STAGE2_ID_FFS_STAGE1_5. - (STAGE2_ID) [STAGE1_5] [FSYS_EXT2FS]: Defined as - STAGE2_ID_STAGE1_5. - (STAGE2_ID) [STAGE1_5] [FSYS_FAT]: Defined as - STAGE2_ID_FAT_STAGE1_5. - (COMPAT_VERSION_MINOR): Set to 1. - * stage2/asm.S (stage2_id): New variable. - * stage1/stage1.S: Change the minor version to 1. - -1999-06-27 OKUJI Yoshinori - - * configure.in (CFLAGS): Set to "-g", since only this flag is - always sharable. - (STAGE1_CFLAGS): Set to "-O2", and AC_SUBST this. - (GRUB_CFLAGS): Likewise. - (saved_CFLAGS): New variable for temporarily saving CFLAGS. - (STAGE2_CFLAGS): Set to "-Os" if this option is available, - otherwise set to "-fno-strength-reduce -fno-unroll-loops", - and then AC_SUBST this. - * grub/Makefile.am (AM_CFLAGS): Prepended @GRUB_CFLAGS@. - * stage1/Makefile.am (AM_CFLAGS): Prepended @STAGE1_CFLAGS@. - * stage2/Makefile.am (libgrub_a_CFLAGS): Prepened @GRUB_CFLAGS@. - (STAGE2_COMPILE): Prepended @STAGE2_CFLAGS@. - - * stage2/asm.S (chain_stage2): Pass CURRENT_PARTITION and - CURRENT_DRIVE, instead of INSTALL_PARTITION and BOOT_DRIVE. - -1999-06-27 Pavel Roskin - - * configure.in: set CFLAGS to "-Os -g" for compilers which - understand "-Os" if CFLAGS is not already set. Use - "-O2 -fno-strength-reduce -fno-unroll-loops -g" for older gcc - versions. - -1999-06-25 OKUJI Yoshinori - - * stage2/disk_io.c (attempt_mount) [STAGE1_5]: Set FSYS_TYPE to - 0, and set it to NUM_FSYS if mount fails. - (real_open_partition): Call rawread in Stage 1.5 as well. - -1999-06-24 OKUJI Yoshinori - - * Makefile.am (SUBDIRS): Change the order of the directories so - that a directory will be made after the dependent directories - are made. `grub' depends on `stage2', and `docs' depends on - `grub'. Do not make in parallel. - * docs/help2man: Copied from help2man-1.012, which contains my - previous change. - * docs/grub.8: Regenerated. - -1999-06-24 OKUJI Yoshinori - - Build process is cleaned up. Stage 2 and Stage 1.5's are all - built in the directory stage2. - - From Pavel Roskin : - * Makefile.am (SUBDIRS): e2fs_stage1_5, ffs_stage1_5, - fat_stage1_5 and shared_src are removed. - (DISTCLEANFILES): Deleted. - * configure.in: Call AC_PROG_RANLIB. - (AC_INIT): Change the argument to stage2/stage2.c. - (LIBS): Renamed to ... - (GRUB_LIBS): ... this, and call AC_SUBST for this. - Our own rules are removed. - (AC_OUTPUT): e2fs_stage1_5/Makefile, ffs_stage1_5/Makefile, - fat_stage1_5/Makefile and shared_src/Makefile are removed. - * docs/Makefile.am (HELP2MAN): The prefix $(srcdir) is removed. - [GRUB_MAINT]: Prepend $(srcdir) to $(HELP2MAN). - * e2fs_stage1_5/Makefile.am: Deleted. - * e2fs_stage1_5/Makefile.in: Likewise. - * fat_stage1_5/Makefile.am: Likewise. - * fat_stage1_5/Makefile.in: Likewise. - * ffs_stage1_5/Makefile.am: Likewise. - * ffs_stage1_5/Makefile.in: Likewise. - * grub/Makefile.am (CLEANFILES): Likewise. - (COMPILE): Likewise. - (INCLUDES): Likewise. - (DEP_FILES): Likewise. - (@SHARED_SRC_RULES@): Likewise. - (AM_CFLAGS): New variable. - (grub_LDADD): Set to the library libgrub.a and @GRUB_LIBS@. - * shared_src/Makefile.am: Deleted. - * shared_src/Makefile.in: Likewise. - * shared_src/apic.h: Moved to ... - * stage2/apic.h: ... here. - * shared_src/asm.S: Moved to ... - * stage2/asm.S: ... here. - * shared_src/bios.c: Moved to ... - * stage2/bios.c: ... here. - * shared_src/boot.c: Moved to ... - * stage2/boot.c: ... here. - * shared_src/char_io.c: Moved to ... - * stage2/char_io.c: ... here. - * shared_src/cmdline.c: Moved to ... - * stage2/cmdline.c: ... here. - * shared_src/common.c: Moved to ... - * stage2/common.c: ... here. - * shared_src/defs.h: Moved to ... - * stage2/defs.h: ... here. - * shared_src/dir.h: Moved to ... - * stage2/dir.h: ... here. - * shared_src/disk_inode.h: Moved to ... - * stage2/disk_inode.h: ... here. - * shared_src/disk_inode_ffs.h: Moved to ... - * stage2/disk_inode_ffs.h: ... here. - * shared_src/disk_io.c: Moved to ... - * stage2/disk_io.c: ... here. - * shared_src/fat.h: Moved to ... - * stage2/fat.h: ... here. - * shared_src/filesys.h: Moved to ... - * stage2/filesys.h: ... here. - * shared_src/freebsd.h: Moved to ... - * stage2/freebsd.h: ... here. - * shared_src/fs.h: Moved to ... - * stage2/fs.h: ... here. - * shared_src/fsys_ext2fs.c: Moved to ... - * stage2/fsys_ext2fs.c: ... here. - * shared_src/fsys_fat.c: Moved to ... - * stage2/fsys_fat.c: ... here. - * shared_src/fsys_ffs.c: Moved to ... - * stage2/fsys_ffs.c: ... here. - * shared_src/gunzip.c: Moved to ... - * stage2/gunzip.c: ... here. - * shared_src/i386-elf.h: Moved to ... - * stage2/i386-elf.h: ... here. - * shared_src/imgact_aout.h: Moved to ... - * stage2/imgact_aout.h: ... here. - * shared_src/mb_header.h: Moved to ... - * stage2/mb_header.h: ... here. - * shared_src/mb_info.h: Moved to ... - * stage2/mb_info.h: ... here. - * shared_src/pc_slice.h: Moved to ... - * stage2/pc_slice.h: ... here. - * shared_src/shared.h: Moved to ... - * stage2/shared.h: ... here. - * shared_src/smp-imps.c: Moved to ... - * stage2/smp-imps.c: ... here. - * shared_src/smp-imps.h: Moved to ... - * stage2/smp-imps.h: ... here. - * shared_src/stage1_5.c: Moved to ... - * stage2/stage1_5.c: ... here. - * shared_src/stage2.c: Moved to ... - * stage2/stage2.c: ... here. - * stage1/Makefile.am (pkgdata_DATA): Renamed to ... - (nodist_pkgdata_DATA): ... this. - (COMPILE): Deleted. - (AM_CFLAGS): New variable. - * stage2/Makefile.am: Completely rewritten from scratch. - (TESTS): New variable. - (noinst_SCRIPTS): Likewise. - (noinst_HEADERS): Likewise. - (EXTRA_DIST): Set to smp-imps.c and $(noinst_SCRIPTS). - (noinst_LIBRARIES): New variable. - (libgrub_a_SOURCES): Likewise. - (libgrub_a_CFLAGS): Likewise. - (pkgdata_DATA): Deleted. - (nodist_pkgdata_DATA): New variable. - (MOSTLYCLEANFILES): Set to $(noinst_PROGRAMS). - (COMPILE): Deleted. - (INCLUDES): Likewise. - (stage2_exec_LDADD): Likewise. - (DEP_FILES): Likewise. - (stage2_exec_SOURCES): Set to the actual source files instead of - dummy. - (DISTFILES): Deleted. - (stage2.exec): Likewise. - (stage2): Likewise. - (@SHARED_SRC_RULES@): Likewise. - (noinst_PROGRAMS): Set to executable formats of Stage 2 and - Stage 1.5's. - (STAGE2_LINK): New variable. - (STAGE2_COMPILE): Likewise. - (STAGE1_5_LINK): Likewise. - (STAGE1_5_COMPILE): Likewise. - (stage2_exec_CFLAGS): Likewise. - (stage2_exec_LDFLAGS): Likewise. - (e2fs_stage1_5_exec_SOURCES): Likewise. - (e2fs_stage1_5_exec_CFLAGS): Likewise. - (e2fs_stage1_5_exec_LDFLAGS): Likewise. - (fat_stage1_5_exec_SOURCES): Likewise. - (fat_stage1_5_exec_CFLAGS): Likewise. - (fat_stage1_5_exec_LDFLAGS): Likewise. - (ffs_stage1_5_exec_SOURCES): Likewise. - (ffs_stage1_5_exec_CFLAGS): Likewise. - (ffs_stage1_5_exec_LDFLAGS): Likewise. - (% : %.exec): New rule. - - * stage2/size_test: New file, for checking for the sizes of - Stage 2 and Stage 1.5's. - -1999-06-24 OKUJI Yoshinori - - * stage1/stage1.S: Call testb instead of andb when checking if - the drive is a floppy. - -1999-06-23 OKUJI Yoshinori - - * grub/asmstub.c [__linux__]: Include linux/fs.h for BLKFLSBUF. - (grub_stage2): Call sync before and after calling doit. - (gurb_stage2) [__linux__]: Invalidate buffer caches by BLKFLSBUF - ioctl. - * grub/main.c (main): Call sync first. Suggested by Pavel Roskin - . - - * configure.in: Curses libraries are always checked. - (--enable-sbin-grub): Deleted. Now /sbin/grub is always built. - (--enable-maintainer-mode): New option. - * grub/Makefile.am (EXTRA_PROGRAMS): Deleted. - (sbin_PROGRAMS): Just set to grub. - * docs/Makefile.am (man_MANS): New variable. - (HELP2MAN): Likewise. - (noinst_SCRIPTS): Likewise. - (EXTRA_DIST): Add $(man_MANS) and $(noinst_SCRIPTS). - [GRUB_MAINT]: Define the rule for the /sbin/grub manual. - * docs/help2man: Copied from texinfo-3.12i. - (--section): New option to specify which section a manual - belongs to. - (opt_section): New variable. - (section): Likewise. - * docs/grub.8: Produced by help2man automatically. - -1999-06-22 OKUJI Yoshinori - - * shared_src/char_io.c (get_cmdline): Add two missing `break's. - - * shared_src/cmdline.c (commands): Add quit. - (enter_cmdline): Change the return type to cmdline_t, and return - CMDLINE_OK if successful, otherwise CMDLINE_ERROR if fail. - (enter_cmdline) [GRUB_UTIL]: Return CMDLINE_ABORT if CUR_HEAP - contains "quit". - [!GRUB_UTIL]: Just print an annotation message. - * shared_src/shared.h (cmdline_t): New enum type. - (enter_cmdline): Change the return type to cmdline_t. - (cmain): Remove ``noreturn'' attribute. - * shared_src/stage2.c (menu_t): New enum type. - (run_menu): Change the return type to menu_t. - If enter_cmdline returns CMDLINE_ABORT, then return MENU_ABORT, - otherwise return MENU_OK. - (cmain): If enter_cmdline aborts, then break the command-line - loop and return. If run_menu aborts, then return. - -1999-06-22 OKUJI Yoshinori - - * shared_src/Makefile.am (EXTRA_DIST): Add bios.c. Reported by - Pavel Roskin . - -1999-06-21 OKUJI Yoshinori - - * docs/Makefile.am (html): Deleted. - (txt): Likewise. - (EXTRA_DIST): $(txt) and $(html) are removed. - * docs/boot-proposal.html: Removed. - * docs/errors.html: Likewise. - * docs/faq.html: Likewise. - * docs/grub.html: Likewise. - * docs/install.html: Likewise. - * docs/mem64mb.html: Likewise. - * docs/technical.html: Likewise. - * docs/using.html: Likewise. - * docs/PC_partitioning.txt: Likewise. - * docs/bios_mapping.txt: Likewise. - * docs/commands.txt: Likewise. - * docs/embedded_data.txt: Likewise. - * docs/filesystem.txt: Likewise. - -1999-06-21 OKUJI Yoshinori - - From Alexander K. Hudek : - * shared_src/disk_io.c (real_open_partition): Check if - CURRENT_SLICE is equal to PC_SLICE_TYPE_WIN95_EXTENDED as well. - * shared_src/pc_slice.c (PC_SLICE_TYPE_WIN95_EXTENDED): New - macro. - * shared_src/bios.c (biosdisk): Clear the reserved member of DAP. - -1999-06-08 OKUJI Yoshinori - - Color-menu support based on Peter Astrand - 's patch. - - * shared_src/asm.S (nocursor): New function. - * shared_src/cmdline.c (normal_color): New variable. - (highlight_color): Likewise. - (commands): Added "color" command. - (enter_cmdline): Handle the color command. - * shared_src/shared.h (normal_color): Declared. - (highlight_color): Likewise. - [!GRUB_UTIL] (nocursor): Likewise. - * shared_src/stage2.c (print_border) [!GRUB_UTIL]: Color the - menu. - (run_menu) [!GRUB_UTIL]: Call nocursor, and call set_line with - the second argument HIGHLIGHT_COLOR when highlighting a line, - and NORMAL_COLOR when drawing a normal line. - (cmain): Initialize normal_color and highlight_color. Handle - the color command in the same way as the command-line - interface. - -1999-06-07 OKUJI Yoshinori - - * e2fs_stage1_5/Makefile.am (IMPORTANT_SIZE_LIMIT): Set to 31744. - * fat_stage1_5/Makefile.am (IMPORTANT_SIZE_LIMIT): Likewise. - -1999-06-06 OKUJI Yoshinori - - The debug version of Stage 2 is removed. - - * shared_src/cmdline.c: The imps code is now defined if GRUB_UTIL - is not defined, but not if DEBUG. - (debug): New global variable. - (commands): All commands are always enabled, and added "debug". - (debug_fs_print_func): Defined unconditionally. - (debug_fs_blocklist_func): If DEBUG is true, then call printf. - (enter_cmdline): Handle "testload", "read", "fstest", - "impsprobe" and "displaymem" unconditionally, and added "debug" - handling. - [GRUB_UTIL]: If a command is impsprobe, just fails. - * shared_src/disk_io.c (devread) [!STAGE1_5]: If DEBUG_FS and - DEBUG are true, then call printf. - * shared_src/asm.S (patch_code): Defined unconditionally. - (patch_code_end): Likewise. - * stage1/stage1.S (firstlist) [!FFS_STAGE1_5]: Increase the - number of sectors to 90, because Stage 2 is larger than 80 - sectors. - * configure.in: The option --enable-debug is removed, and do - not output "stage2_debug/Makefile". - * Makefile.am (SUBDIRS): stage2_debug is removed. - * stage2_debug/Makefile.am: Deleted. - * stage2_debug/Makefile.in: Likewise. - -1999-06-02 OKUJI Yoshinori - - * grub/main.c (verbose): New variable. - (read_only): Likewise. - (OPT_VERBOSE): New macro. - (OPT_READ_ONLY): Likewise. - (longopts): Add --read-only and --verbose options. - (usage): Add the descriptions about --read-only and --verbose. - (main): Handle OPT_VERBOSE and OPT_READ_ONLY. - If HOLD and VERBOSE are non-zero, then display the message - about how to restart /sbin/grub. - - * shared_src/shared.h (verbose) [GRUB_UTIL]: Declared. - (read_only) [GRUB_UTIL]: Likewise. - - * grub/asmstub.c (hex_dump): New function. - (biosdisk): In the case where SUBFUNC is - BIOSDISK_WRITE, check for READ_ONLY and call nwrite if - READ_ONLY is zero. If VERBOSE is non-zero, display what GRUB - will try to do. - (get_diskinfo): Open DEVNAME with the mode O_RDWR if READ_ONLY - is zero, and attempt to open DEVNAME with the mode O_RDONLY - regardless of ERRNO if READ_ONLY is non-zero. If VERBOSE is - non-zero, then display the drive DRIVE and the file DEVNAME. - - * shared_src/disk_io.c (set_device) [STAGE1_5]: Eliminate - completion code. - -1999-06-01 OKUJI Yoshinori - - * grub/asmstub.c: Do not use I_AM_VERY_BRAVE any more. - (grub_stage2): Delete first_scsi_disk and add a variable - num_hd, which is used for counting how many drives are - detected. - Initialize the flags member of each element of disks to -1 - instead of 0, and check if it is equal to -1 instead of 0 when - close it. - (get_diskinfo): Treat -1 as non-caching state instead of 0. - -1999-06-01 OKUJI Yoshinori - - Reported from Klaus Reichl : - * docs/.cvsignore: New file. - * shared_src/disk_io.c (print_a_completion): New function - which saves what has been printed to UNIQUE_STRING and printf - it. - (unique) [!STAGE1_5]: New variable. - (unique_string): Likewise. - (print_completions): Use print_a_completion, and improve the - completion facility. - * shared_src/fsys_ext2fs.c (ext2fs_dir) [!STAGE1_5]: Use - print_a_completion instead of just printf. - * shared_src/fsys_ffs.c (ffs_dir) [!STAGE1_5]: Likewise. - * shared_src/fsys_fat.c (fat_dir) [!STAGE1_5]: Likewise. - * shared_src/shared.h (print_a_completion): Declared. - * shared_src/cmdline.c (enter_cmdline): Explicitly cast - int to pointer to char for grub_read. - * grub/asmstub.c (grub_stage2) [__linux__]: Don't use /dev/fd1. - Probe 4 IDE drives instead of 2. - (biosdisk) [__linux__]: Add a prototype for _llseek. - * shared_src/char_io.c (get_cmdline): Update LPOS and LLEN_OLD - when the functon print_completion modifies CMDLINE. - * shared_src/stage2.c (get_line_from_config): Fix LITERAL - handling. - -1999-05-25 OKUJI Yoshinori - - * grub/asmstub.c (grub_stage2): Fix a memory leak that FP is - not closed. - -1999-05-25 OKUJI Yoshinori - - * grub/main.c: Replace OPT_DISABLE_CONFIG_FILE and - OPT_DISABLE_CURSES with OPT_NO_CONFIG_FILE and OPT_NO_CURSES - respectively. - (longopts): Rename from "disable-config-file" to - "no-config-file", and from "disable-curses" to "no-curses". - (usage): Use "grub" instead of ARGV[0], read the standards. - Change the help message according to the changes above. - (main): Handle OPT_NO_CONFIG_FILE and OPT_NO_CURSES, instead - of OPT_DISABLE_CONFIG_FILE and OPT_DISABLE_CURSES. - -1999-05-21 OKUJI Yoshinori - - * docs/TODO: Moved to ... - * TODO: ... here. - * docs/BUGS: Moved to ... - * BUGS: ... here. - * docs/COPYING: Removed. - * docs/Makefile.am (EXTRA_DIST): Get rid of BUGS. - * Makefile.am (EXTRA_DIST): Set to BUGS. - -1999-05-17 OKUJI Yoshinori - - * acinclude.m4 (grub_ASM_EXT_C): Do not overrun the command - shift. Reported by Pavel Roskin . - -1999-05-14 OKUJI Yoshinori - - * docs/Makefile.am (info_TEXINFOS): Added multiboot.texi. - * docs/multiboot.texi: New file. From Kunihiro Ishiguro. - -1999-05-12 OKUJI Yoshinori - - * grub/asmstub.c: Include . Reported by Kunihiro - Ishiguro . - -1999-05-11 OKUJI Yoshinori - - Reported by Brian Brunswick : - * shared_src/asm.S (start) [STAGE1_5]: Jump to 0x0:0x2000. - * shared_src/cmdline.c (enter_cmdline): Doesn't check for the jump - address in stage2. We are not paranoid. - Add a missing RAW_ADDR macro. - * shared_src/diskio.c (grub_open): Call setup_part even in stage1.5. - And, include necessary functions that were eliminated incorrectly. - * shared_src/char_io.c [STAGE1_5]: Eliminate unnecessary functions - for stage1.5. - - * grub/asmstub.c (nread): New function. Handle EINTR. - (nwrite): Likewise. - (biosdisk) [I_AM_VERY_BRAVE]: When SUBFUNC is BIOSDISK_WRITE, call - nwrite. - - Reported by Pavel Roskin : - * shared_src/fsys_ext2fs.c (off_t): Renamed to ... - (linux_off_t): ... this. - * shared_src/defs.h (off_t): Renamed to ... - (mach_off_t): ... this. - * shared_src/fs.h (BBOFF): Use mach_off_t instead of off_t. - (SBOFF): Likewise. - - * e2fs_stage1_5/Makefile.am (IMPORTANT_SIZE_LIMIT): Set to 81920. - * fat_stage1_5/Makefile.am (IMPORTANT_SIZE_LIMIT): Likewise. - * ffs_stage1_5/Makefile.am (IMPORTANT_SIZE_LIMIT): Set to 7168. - -1999-05-03 Gordon Matzigkeit - - From Pavel Roskin: - * shared_src/shared.h: Redeclare. - - * grub/main.c (main): Use strncpy rather than pointer assignment - to set the config file name. - - * grub/asmstub.c: Make config_file a static array, not a pointer. - Correct the value of VERSION_STRING. - -1999-04-10 Gordon Matzigkeit - - * debian/rules (build): Install into /lib instead of /share. - -1999-05-03 OKUJI Yoshinori - - Preliminary non-interactive use support. - - * grub/main.c (use_config_file): New variable. - (use_curses): Likewise. - (OPT_DISABLE_CONFIG_FILE): New constant. - (OPT_DISABLE_CURSES): Likewise. - (OPT_BATCH): Likewise. - (longopts): Add new options, --disable-config-file, --disable-curses, - and --batch. - (usage): Print the help messages about these new options. - (main): Handle them. - - * grub/asmstub.c (grub_stage2) [HAVE_LIBCURSES]: If ! USE_CURSES, - fallback non-curses code. - (stop) [HAVE_LIBCURSES]: Likewise. - (cls) [HAVE_LIBCURSES]: Likewise. - (getxy) [HAVE_LIBCURSES]: Likewise. - (gotoxy) [HAVE_LIBCURSES]: Likewise. - (grub_putchar) [HAVE_LIBCURSES]: Likewise. - (getkey) [HAVE_LIBCURSES]: Likewise. - (checkkey) [HAVE_LIBCURSES]: Likewise. - (set_attrib) [HAVE_LIBCURSES]: Likewise. - - * shared_src/cmdline.c (enter_cmdline): Do not use getc, but use - getkey. - - * shared_src/stage2.c (cmain) [GRUB_UTIL]: Check if USE_CONFIG_FILE - is non-zero or not. - - * shared_src/shared.h (getc): Removed. - (use_config_file) [GRUB_UTIL]: Add the declaration. - (use_curses) [GRUB_UTIL]: Likewise. - -1999-05-02 OKUJI Yoshinori - - * shared_src/asm.S (biosdisk_standard): Pop %ebp correctly, reported - by Pavel Roskin . - -1999-04-25 OKUJI Yoshinori - - * docs/menu.lst: Rewritten, so that it contains up-to-date - information and FAQish configuration examples. - -1999-04-09 OKUJI Yoshinori - - * shared_src/asm.S (get_diskinfo_floppy): Correct the number of heads - and the one of cylinders. - -1999-04-06 OKUJI Yoshinori - - * grub/asmstub.c (get_diskinfo): Compute the total number of sectors - for DRIVE. - - * shared_src/asm.S (get_diskinfo_standard): Clear the data segment - after calling int 0x13. Restore the base pointer after returning - to protected mode. - (get_diskinfo_floppy): Likewise. - - * shared_src/bios.c (get_diskinfo): Always set the size of DRP to - the max size of DRP, regardless of the major version of extensions. - -1999-04-03 OKUJI Yoshinori - - * shared_src/shared.h (struct geometry): Declare total_sectors as - unsigned long instead of unsigned long long, because GRUB represents - a sector number by 4bytes integer, so it doesn't make sense. - - * shared_src/bios.c (biosdisk) [!NO_INT13_FALLBACK]: Recompute - TOTAL_SECTORS according to CHS information. - (get_diskinfo) [DEBUG]: Print the geometry of DRIVE. - - * shared_src/disk_io.c (real_open_partition): Set PART_LENGTH to - BUF_GEOM.TOTAL_SECTORS. - -1999-04-01 OKUJI Yoshinori - - * docs/texinfo.tex: Copied from automake-1.4a. - - * configure.in (SHARED_SRC_RULES): Add bios into shared sources. - - * e2fs_stage1_5/Makefile.am (e2fs_stage1_5_exec_LDADD): Added bios.o. - * fat_stage1_5/Makefile.am (fat_stage1_5_exec_LDADD): Likewise. - * ffs_stage1_5/Makefile.am (ffs_stage1_5_exec_LDADD): Likewise. - * stage2/Makefile.am (stage2_exec_LDADD): Likewise. - * stage2_debug/Makefile.am (stage2_debug_exec_LDADD): Likewise. - - * shared_src/Makefile.am (EXTRA_DIST): Added bios.c. - - * shared_src/asm.S (biosdisk): Deleted. Now defined in bios.c. - (get_diskinfo): Likewise. - (biosdisk_int13_extensions): New function. - (biosdisk_standard): Likewise. - (check_int13_extensions): Likewise. - (get_diskinfo_int13_extensions): Likewise. - (get_diskinfo_standard): Likewise. - (get_diskinfo_floppy): Likewise. - - * shared_src/bios.c: New file. - - * shared_src/shared.h (struct geometry): Added new member, - total_sectors. - -1999-03-28 OKUJI Yoshinori - - * shared_src/stage2.c (print_entries): Correctly assign MENU_ENTRIES - the entries starting from FIRST. - -1999-03-27 Gordon Matzigkeit - - * Change everything to use memset and memmove instead of bzero and - bcopy. GNB's Not BSD. - - * shared_src/shared.h (grub_memset): Adapted from grub_bzero. - (grub_memmove): Adapted from grub_bcopy. - - * grub/asmstub.c (checkkey): Fix unterminated comment. - - * shared_src/char_io.c (grub_printf): Renamed from printf. - (grub_tolower): Renamed from tolower. - (grub_isspace): Renamed from isspace. - (grub_strncat): Renamed from strncat. - (grub_strstr): Renamed from strstr. - (grub_bcopy): Renamed from bcopy. - (grub_bzero): Renamed from bzero. - - From Bradford Hovinen: - * shared_src/char_io.c (get_cmdline): Add new argument to hide - password entry. - (grub_strcmp): New function. - * shared_src/shared.h (get_cmdline): Fix declaration. - (grub_strcmp): Declare. - * shared_src/stage2.c (run_menu): Use get_cmdline with an - ECHO_CHAR of `*'. This protects against both brute-force and - sidelong-glance password cracking attempts. - - * grub/main.c (usage): Display defaults for stage2 options. - - * grub/asmstub.c [WITHOUT_LIBC_STUBS]: Renamed from - NO_REMAPPING_LIBC_FUNCTIONS. - * grub/main.c: Likewise. - * shared_src/shared.h: Likewise. - -1999-03-27 OKUJI Yoshinori - - * grub/asmstub.c (set_attrib): Use inch and addch, instead of - chgat, because chgat doesn't work as expected. - -1999-03-26 OKUJI Yoshinori - - * grub/asmstub.c (grub_stage2) [HAVE_LIBCURSES]: Call nodelay. - (checkkey) [HAVE_LIBCURSES]: If getting an input character, then - ungetch it, because checkkey shouldn't modify the input queue. - - Use file descriptors instead of file pointers to support - >4GB disks in Linux. - - * grub/asmstub.c (grub_stage2): Call close instead of fclose. - (get_diskinfo): Call open instead of fopen. - (biosdisk) [__linux__]: Use _llseek instead of lseek. - (biosdisk): Call read instead of fread. - - Add options so that the user can specify the config file. - - * grub/Makefile.am (CPPFLAGS): Use -fwritable-strings, because - grub assumes that all strings resides at the data section. - - * grub/main.c: Define NO_REMAPPING_LIBC_FUNCTIONS before including - shared.h. - (OPT_CONFIG_FILE): New macro. - (OPT_INSTALL_PARTITION): Likewise. - (OPT_BOOT_DRIVE): Likewise. - (longopts): Add new options, config-file, install-partition and - boot-drive. - (usage): Add the documentation for them. - (main): Add handling code for OPT_CONFIG_FILE, OPT_INSTALL_PARTITION - and OPT_BOOT_DRIVE. - - * grub/asmstub.c: Define NO_REMAPPING_LIBC_FUNCTIONS before including - shared.h. - (config_file): Make it char * instead of char []. - (getrtsecs): Return current time instead of 0xff. - - * shared_src/shared.h [NO_REMAPPING_LIBC_FUNCTIONS]: Don't define - libc-API-compatible function names. - (config_file): Change the prototype from char [] to char *. - (grub_putchar): Renamed from putchar. - -1999-03-25 OKUJI Yoshinori - - * char_io.c (get_cmdline): Call cl_setcpos even if lpos == llen, - because ncurses won't update the cursor position. - - * grub/main.c (OPT_HOLD): New macro. - (longopts): New option --hold. - (usage): Add the documentation about --hold. - (main): Set hold if --hold is specified. Wait until cleared. - -1999-03-22 Gordon Matzigkeit - - * shared_src/cmdline.c (enter_cmdline): Check the return value of - set_device in the `root' command. - - * shared_src/char_io.c (memcheck): Special-case cur_part_desc and - reenable memory checking. - -1999-03-21 Gordon Matzigkeit - - * shared_src/boot.c (load_image): Make sure we use the mapped - address before actually writing data to memaddr. - - * shared_src/char_io.c (get_cmdline): Only zero-terminate if there - were leading blanks. This prevents accidental truncation of - commands. - - * grub/asmstub.c (get_diskinfo): Cache device geometries as well - as file handles. - Use the Linux HDIO_GETGEO ioctl to make a better guess at hard - disk geometries. - -1999-03-16 Gordon Matzigkeit - - * shared_src/shared.h (geometry_t): Delete typedef, until we - actually use it. - -1999-03-16 OKUJI Yoshinori - - * shared_src/asm.S (biosdisk): Use a structure for geometry - instead of a integer. - (get_diskinfo): Take a pointer to a geometry structure as the - second argument, and fill a geometry in it. Return 1 if an error - occurs, otherwise return 0. - * shared_src/boot.c (bsd_boot): Compute BIOS geometries for BSD. - * shared_src/cmdline.c (enter_cmdline): Declare dest_geom as - struct geometry. - * shared_src/disk_io.c (buf_geom): Declare as struct geometry. - * shared_src/filesys.h (SECTORS): Deleted. - (HEADS): Likewise. - (CYLINDERS): Likewise. - * shared_src/shared.h (BIOSDISK_FLAG_LBA_EXTENSION): New macro. - (struct geometry): New structure. - (buf_geom): Correct the prototype. - (get_diskinfo): Likewise. - (biosdisk): Likewise. - -1999-03-15 Gordon Matzigkeit - - * grub/asmstub.c (doit): Nested function to get a clean stack - frame while in grub_stage2. - Use different assembler magic. From OKUJI Yoshinori. - -1999-03-14 Gordon Matzigkeit - - * shared_src/stage2.c (run_menu): Use A_REVERSE and A_NORMAL - constants instead of magic numbers. - - * shared_src/shared.h (A_REVERSE): Renamed from ATTR_INVERSE for - compatibility with curses. - (A_NORMAL): Renamed from ATTR_NORMAL. - - * shared_src/cmdline.c (enter_cmdline): Change prompt to "grub> ". - (enter_cmdline): Only abort the boot if we are in a script. - - * shared_src/stage2.c (run_menu): Change prompts to "grub edit> ". - - * shared_src/char_io.c (memcheck): Use RAW_ADDR to compute memory - locations. - (get_cmdline): Change the `goto next line' code to account for - newlines deleting to end of line under curses. - - * Innumerable cleanups to fix warnings. There are still too many - typecasts in the wrong places (int variables used to hold - pointers, then casted to a pointer type), but things look better. - - * configure.in (CPPFLAGS): Bump up GCC warnings to -Wall - -Wmissing-prototypes -Wunused. - - * shared_src/shared.h: Delete stupid declarations, and totally - rearrange for clarity. - (inb, outb): Move to cmdline.c, since it's only used there. - (print_possibilities, fsmax, fsys_table): Move definitions to - disk_io.c. - - * grub/asmstub.c: Fill in more stubs. - -1999-03-13 Gordon Matzigkeit - - * shared_src/gunzip.c (border): Rename to bitorder, to resolve - clash with curses. - * shared_src/stage2.c (timeout): Rename to grub_timeout. - - * configure.in: Check for curses libraries for use with - /sbin/grub. - - * shared_src/shared.h (KEY_DELETE): Rename to KEY_DC, for - compatibility with curses. - (KEY_INSERT): Rename to KEY_IC. - (KEY_PGDN): Rename to KEY_NPAGE. - (KEY_PGUP): Rename to KEY_PPAGE. - - * shared_src/asm.S (asm_getkey): Renamed to getkey. - - * shared_src/char_io.c (getkey): Delete, because it's useless. - - * shared_src/shared.h: Resolve name clashes with libc by renaming - overlapping functions to have grub_ prefixes, then defining - macros. - - * grub/asmstub.c (start_stage2): Make some assertions about our - scratch memory area. - - * shared_src/shared.h (end): Delete declaration. - (RAW_ADDR, RAW_SEG): Macros to redirect /sbin/grub memory requests - through grub_scratch_mem. - - * grub/asmstub.c (get_mem_map): Implement, simulating 4MB - contiguous memory. - (get_code_end): Implement, simulating with a malloced area. - grub/asmstub.c (start_stage2): Initialize grub_scratch_mem. - - * shared_src/asm.S (get_mem_map): Some BIOSes expect the high word - of %eax to be zero. - (get_code_end): Move this from common.c so that we can stub it out - in the simulator. - - * debian/rules: Make sure info files end up in /usr/info, not - /info. - -1999-03-10 Gordon Matzigkeit - - * shared_src/asm.S (biosdisk): Make LBA mode work correctly. From - OKUJI Yoshinori. - Unconditionally define NO_INT13_FALLBACK until we release GRUB - 0.6. This will help debug any problems with the LBA support until - then. - -1999-03-09 Gordon Matzigkeit - - * shared_src/asm.S (biosdisk): Compute location of - disk_address_packet correctly. From OKUJI Yoshinori. - -1999-03-08 Gordon Matzigkeit - - * docs/grub.texi: New Texinfo documentation. - - * shared_src/disk_io.c (set_device): First stab at interpreting - Mach-style partition naming. - - * shared_src/stage2.c (run_menu): Don't say it was a failure if - enter_cmdline returns nonzero... just wait for a key. - - * shared_src/cmdline.c (enter_cmdline): Return nonzero, and avoid - the fallback command if we did an install. - - * shared_src/asm.S (_start): New explicit symbol to supress - warnings. - - * e2fs_stage1_5/Makefile.am (NO_FANCY_STUFF): Renamed to STAGE1_5, - since that describes this conditional more accurately. - * fat_stage1_5/Makefile.am: Likewise. - * ffs_stage1_5/Makefile.am: Likewise. - * shared_src/asm.S: Likewise. - * shared_src/char_io.c: Likewise. - * shared_src/common.c: Likewise. - * shared_src/disk_io.c: Likewise. - * shared_src/fsys_ext2fs.c: Likewise. - * shared_src/fsys_ffs.c: Likewise. - * shared_src/shared.h: Likewise. - -1999-03-07 Gordon Matzigkeit - - * configure.in (SHARED_SRC_RULES): Automatically generate - Makefile dependencies for files in shared_src. - e2fs_stage1_5/Makefile.am: Use them. - fat_stage1_5/Makefile.am: Likewise. - ffs_stage1_5/Makefile.am: Likewise. - grub/Makefile.am: Likewise. - stage2/Makefile.am: Likewise. - stage2_debug/Makefile.am: Likewise. - - * shared_src/disk_inode.h: Fix typo: i_ic shouldn't be defined. - - * shared_src/fsys_ffs.c (block_map): Make static, since this - function isn't used outside of its defining file. - - * shared_src/disk_io.c [NO_FANCY_STUFF]: Eliminate a whole bunch - more functions from the stage1.5. From OKUJI Yoshinori. - * shared_src/fsys_ffs.c: Likewise. - * shared_src/char_io.c: Likewise. - -1999-03-05 Gordon Matzigkeit - - * shared_src/char_io.c (getkey): Don't set BUF_DRIVE to -1. - BUF_DRIVE has nothing at all to do with getkey. - - * shared_src/common.c (err_list): Change description of ERR_GEOM - to be more informative. - - * Makefile.am (configure): Depend on debian/changelog. - - * configure.in (host_cpu): Make all fully i386-compatible CPUs be - identified as i386. - (AM_INIT_AUTOMAKE): Fetch values for PACKAGE and VERSION from - debian/changelog, so that we only have one file to update. - - * shared_src/asm.S (get_diskinfo): Fix a few bit-twiddling bugs in - the BIOS extension detection code. - (biosdisk) [AWARD_INT13_EXTENSIONS]: Preliminary implementation - of Award's encoding of cylinder bits 10 and 11. - (biosdisk) [NO_INT13_FALLBACK]: If defined, don't use the standard - disk interface if the extended interface fails. - - * configure.in: Make sure $(host_cpu) and $(host_vendor) are - substituted into the Makefile. - - * e2fs_stage1_5/Makefile.am (pkgdatadir): Install files in - $(datadir)/grub/$(host_cpu)-$(host_vendor). - * fat_stage1_5/Makefile.am: Likewise. - * ffs_stage1_5/Makefile.am: Likewise. - * stage1/Makefile.am: Likewise. - * stage2/Makefile.am: Likewise. - * stage2_debug/Makefile.am: Likewise. - -1999-03-03 Gordon Matzigkeit - - * shared_src/asm.S (biosdisk): Use LBA mode if high nibble of - GEOMETRY is nonzero. - (get_diskinfo): Set high nibble of GEOMETRY (0xf0000000) to 1 if - LBA mode is detected. - -1999-03-02 Gordon Matzigkeit - - * shared_src/disk_io.c (make_saved_active): Use BIOSDISK_READ and - BIOSDISK_WRITE. - - * shared_src/cmdline.c (enter_cmdline): Use BIOSDISK_WRITE. - - * shared_src/shared.h (BIOSDISK_SUBFUNC_READ, - BIOSDISK_SUBFUNC_WRITE): Delete constants. - - * shared_src/asm.S (biosdisk): Change subfunc argument to be - read=0, write=1. - - * configure.in: Drop redundant AC_PROG_INSTALL. From OKUJI - Yoshinori. - -1999-03-01 Gordon Matzigkeit - - * debian/rules (binary-arch): Properly install README.debian. - - * acinclude.m4 (grub_OBJCOPY_ABSOLUTE): Don't forget to move the - old binary out of the way before reentering the loop. - (grub_ASM_ADDR32): Delete conftest files after running the test. - - * debian/rules (binary-arch): Remove empty /sbin directory until - /sbin/grub is installed. Use $(DESTDIR) instead of $(prefix) to - install files. - - * shared_src/asm.S (version_string): Set the version string from - the VERSION specified in configure.in. - - * Change all Makefiles into Makefile.ams. Many major build - environment changes to get Automake/Autoconf working nicely. - -1999-02-28 Gordon Matzigkeit - - * NEWS: Moved from docs/NEWS. - - * configure.in, acinclude.m4: New files for Autoconf. From OKUJI - Yoshinori. - - * AUTHORS, INSTALL: New files. - -1999-02-24 Gordon Matzigkeit - - * stage1/stage1.S (after_BPB): Do a hard disk probe first, so that - we can work with IDE floppies (like the LS-120). - - * Run GNU Indent on */*.[ch]. - -1999-02-21 Gordon Matzigkeit - - * debian: Add to the distribution, since we maintain the GRUB - Debian package ourselves. - - * grub/asmstub.c: New file to implement stubbed assembly functions - under Unix. - - * stage1/Makefile: Delete spurious dependencies on Makefile. - * stage2/Makefile: Likewise. - * stage2_debug/Makefile: Likewise. - * grub/Makefile: Likewise. - - * shared_src/fsys_ext2fs.c (ext2fs_dir): Follow symbolic links - rather than giving an error. - - * shared_src/common.c (err_list): Use labeled elements to - associate messages with error codes. - * shared_src/shared.h: Make error codes into an enumerated type. - - * shared_src/common.c (err_list): Add ERR_SYMLINK_LOOP. - * shared_src/shared.h: Likewise. - - * shared_src/char_io.c (bcopy): Don't make any assumptions about - the length of an unsigned long. - - * grub/Makefile: Treat CFLAGS, CPPFLAGS, LDFLAGS according to - GNU standards. - * stage2/Makefile: Likewise. - * e2fs_stage1_5/Makefile: Likewise. - * fat_stage1_5/Makefile: Likewise. - * ffs_stage1_5/Makefile: Likewise. - -1999-02-20 Gordon Matzigkeit - - * docs/index.html: Rename to grub.html, so that we don't hide - files in this directory from a web browser. - -1999-02-15 Gordon Matzigkeit - - * Makefile.end (PROGS): Add grub. - - * grub/main.c: New file. - - * grub/Makefile: New directory to contain the stage2 Unix program. - - * shared_src/cmdline.c: Use substring. - * shared_src/fsys_ext2fs.c: Likewise. - * shared_src/fsys_fat.c: Likewise. - * shared_src/fsys_ffs.c: Likewise. - * shared_src/stage2.c: Likewise. - - * shared_src/shared.h: Delete strcmp, declare substring. - - * shared_src/char_io.c (strcmp): Rename to `substring', because - this function doesn't behave the same as libc's strcmp. - -1999-02-14 Gordon Matzigkeit - - * shared_src/shared.h: (addr32, data32): Delete definitions. - - * stage1/stage1.S: Modify to use GAS's new .code16 semantics. - shared_src/asm.S: Likewise. - - * configure: Test to see if the `addr32' instruction is supported. - Ian Lance Taylor says that GAS's interpretation of `.code16' has - changed. Older versions always generated 32-bit code, but - implicitly inserted addr32 and data32 when .code16 was given. - Newer versions generate 16-bit code, and require manual addr32 and - data32 overrides. - - * shared_src/shared.h: Add some assertions to check that buffer - addresses are properly defined. - -1999-02-12 Gordon Matzigkeit - - * shared_src/stage2.c (run_menu): Pause if we failed to boot both - the default and fallback entries. - - * configure: Check to make sure that GAS actually honors .code16 - directives. - -1999-02-02 Gordon Matzigkeit - - * shared_src/asm.S: Fix typo that called interrupt 0xd (decimal - 13) instead of 0x13. - -1999-01-31 Gordon Matzigkeit - - * e2fs_stage1_5/Makefile: Avoid gratuitous dependencies on - Makefile. - * fat_stage1_5/Makefile: Likewise. - * ffs_stage1_5/Makefile: Likewise. - - * Makefile.end (PROGS): Add e2fs_stage1_5, fat_stage1_5, and - grubinst. - (distclean): New GNU standard rule. - -1998-10-23 Gordon Matzigkeit - - * configure: Accept `--host' as a synonym for `--target', and - accept a non-optional argument as the target name. Join the - prefix to the tool name with a hyphen. - - * shared_src/disk_io.c (print_fsys_type): Always print the - partition type. - - * shared_src/stage2.c (run_menu): Check to make sure that the - fallback entry is nonnegative. - (run_menu): For consistency, use `e' rather than enter to edit the - command entry. diff --git a/usr/src/grub/grub-0.95/INSTALL b/usr/src/grub/grub-0.95/INSTALL deleted file mode 100644 index 1ba68a6905..0000000000 --- a/usr/src/grub/grub-0.95/INSTALL +++ /dev/null @@ -1,266 +0,0 @@ --*- Text -*- - -This is the GRUB. Welcome. - -This file contains instructions for compiling and installing the GRUB. - -The Requirements -================ - -GRUB depends on some software packages installed into your system. If -you don't have any of them, please obtain and install them before -configuring the GRUB. - -* GCC - - Probably every recent GCC should work, but we recommend GCC 2.95 and - later, since you can create smaller binary images. See the web page - . - -* GNU Make - - For now, the Makefiles produced by Automake depends on GNU Make. See - the web page . - -* GNU binutils 2.9.1.0.23 or later - - Binutils has changed the behavior of 16bit assembler between 2.9.1 - and 2.9.1.0.x, and we support only 2.9.1.0.x and higher. In - particular, we recommend using binutils 2.10, since it is the only - public release that supports real 16bit mode. Please take a look at - the web page , for more - information. Note that you don't have to install it into any system - directory. See the section "Operation Controls", if you want to - install binutils into your own directory. - -If you'd like to develop GRUB, these below are also required. Don't -forget to specify the option `--enable-maintainer-mode' when running the -configure script. - -* Texinfo 4.0 or later - - We use some new macros in the documents, so you need a recent - Texinfo release. See the web page - . - -* Developers: GNU Autoconf 2.5x and GNU Automake 1.7 or later - - You should not need Automake just to compile GRUB, but you will need - it if you edit any of the build files (Makefile.am, configure.in, - etc). We use the new "per-executable flags" feature found in the - latest release of automake. See the web page - . - - -Configuring the GRUB -==================== - -The `configure' shell script attempts to guess correct values for -various system-dependent variables used during compilation. It uses -those values to create a `Makefile' in each directory of the package. -It may also create one or more `.h' files containing system-dependent -definitions. Finally, it creates a shell script `config.status' that -you can run in the future to recreate the current configuration, a -file `config.cache' that saves the results of its tests to speed up -reconfiguring, and a file `config.log' containing compiler output -(useful mainly for debugging `configure'). - -If you need to do unusual things to compile the package, please try to -figure out how `configure' could check whether to do them, and mail -diffs or instructions to the address given in the `README' so they can -be considered for the next release. If at some point `config.cache' -contains results you don't want to keep, you may remove or edit it. - -The file `configure.in' is used to create `configure' by a program -called `autoconf'. You only need `configure.in' if you want to change -it or regenerate `configure' using a newer version of `autoconf'. - - -Building the GRUB -================= - -The simplest way to compile this package is: - - 1. `cd' to the directory containing the package's source code and - type `./configure' to configure the package for your system. If - you're using `csh' on an old version of System V, you might need - to type `sh ./configure' instead to prevent `csh' from trying to - execute `configure' itself. - - Running `configure' takes awhile. While running, it prints some - messages telling which features it is checking for. - - 2. Type `make' to compile the package. - - 3. Optionally, type `make check' to run any self-tests that come with - the package. - - 4. Type `make install' to install the programs and any data files and - documentation. - - 5. You can remove the program binaries and object files from the - source code directory by typing `make clean'. To also remove the - files that `configure' created (so you can compile the package for - a different kind of computer), type `make distclean'. There is - also a `make maintainer-clean' target, but that is intended mainly - for the package's developers. If you use it, you may have to get - all sorts of other programs in order to regenerate files that came - with the distribution. - - -Compiling For Multiple Architectures -==================================== - -You can compile the package for more than one kind of computer at the -same time, by placing the object files for each architecture in their -own directory. `cd' to the directory where you want the object files -and executables to go and run the `configure' script. `configure' -automatically checks for the source code in the directory that -`configure' is in and in `..'. - - -Installation Names -================== - -By default, `make install' will install the package's files in -`/usr/local/bin', `/usr/local/man', etc. You can specify an -installation prefix by giving `configure' the option `--prefix=PATH'. - -You can specify separate installation prefixes for -architecture-specific files and architecture-independent files. If -you give `configure' the option `--exec-prefix=PATH', the package will -use PATH as the prefix for installing programs and libraries. -Documentation and other data files will still use the regular prefix. - -In addition, if you use an unusual directory layout you can give -options like `--bindir=PATH' to specify different values for -particular kinds of files. Run `configure --help' for a list of the -directories you can set and what kinds of files go in them. - -If the package supports it, you can cause programs to be installed -with an extra prefix or suffix on their names by giving `configure' -the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. - -Please note, however, that the GRUB knows where it is located in the -filesystem. If you have installed it in an unusual location, the -system might not work properly, or at all. The chief utility of these -options for the GRUB is to allow you to "install" in some alternate -location, and then copy these to the actual root filesystem later. - - -Sharing Defaults -================ - -If you want to set default values for `configure' scripts to share, -you can create a site shell script called `config.site' that gives -default values for variables like `CC', `cache_file', and `prefix'. -`configure' looks for `PREFIX/share/config.site' if it exists, then -`PREFIX/etc/config.site' if it exists. Or, you can set the -`CONFIG_SITE' environment variable to the location of the site script. -A warning: not all `configure' scripts look for a site script. - - -Operation Controls -================== - - `configure' recognizes the following options to control how it -operates. - -`--cache-file=FILE' - Use and save the results of the tests in FILE instead of - `./config.cache'. Set FILE to `/dev/null' to disable caching, for - debugging `configure'. - -`--help' - Print a summary of the options to `configure', and exit. - -`--quiet' -`--silent' -`-q' - Do not print messages saying which checks are being made. - -`--srcdir=DIR' - Look for the package's source code in directory DIR. Usually - `configure' can determine that directory automatically. - -`--version' - Print the version of Autoconf used to generate the `configure' - script, and exit. - -`--enable-maintainer-mode' - Enable make rules and dependencies not useful (and sometimes - confusing) to the casual installer. If you are a GRUB developer, - it is a good idea to specify this option. - -`--disable-ext2fs' - Omit the ext2fs support in Stage 2. - -`--disable-fat' - Omit the FAT support in Stage 2. - -`--disable-ffs' - Omit the FFS support in Stage 2. - -`--disable-minix' - Omit the Minix fs support in Stage 2. - -`--disable-reiserfs' - Omit the ReiserFS support in Stage 2. - -`--disable-vstafs' - Omit the VSTa filesystem support in Stage 2. - -`--disable-jfs' - Omit the JFS support in Stage 2. - -`--disable-xfs' - Omit the XFS support in Stage 2. - -`--disable-ufs2' - Omit the UFS2 support in Stage 2. - -`--disable-iso9660' - Omit the ISO9660 support in Stage 2. - -`--disable-gunzip' - Omit the decompression support in Stage 2. - -`--disable-md5-password' - Omit the MD5 password support in Stage2. - -`--with-binutils=PATH' - Search the path PATH to find binutils. If you have installed your - binutils executables into an unusual location where GCC doesn't - search by default, use this option. - -`--without-curses' - Don't use the curses library. - -`--disable-hercules' - Omit the hercules console support in Stage 2. - -`--disable-serial' - Omit the serial terminal support in Stage 2. - -`--enable-serial-speed-simulation' - Simulate the slowness of a serial device in the grub shell. This - option is useful for GRUB developers, as you can test the - performance of a terminal emulation even on pseudo terminals. - -`--enable-preset-menu=FILE' - Preset a menu file FILE in Stage 2. This is useful, if you cannot - put a configuration file on a filesystem for some reason (e.g. when - you need to set the default terminal to a serial terminal in an - embedded system). - -`--enable-example-kernel' - Build the example Multiboot kernel in the directory "docs". You - will be able to boot the image "kernel" with GRUB. - -`--disable-auto-linux-mem-opt' - Don't pass the "mem=" option automatically, when booting Linux. - You can also disable the feature at run time. - - -`configure' also accepts several options for the network support. See -the file `netboot/README.netboot', for more information. diff --git a/usr/src/grub/grub-0.95/MAINTENANCE b/usr/src/grub/grub-0.95/MAINTENANCE deleted file mode 100644 index 3ce7b3fcf2..0000000000 --- a/usr/src/grub/grub-0.95/MAINTENANCE +++ /dev/null @@ -1,60 +0,0 @@ --*- text -*- - -This is a list of random notes for GRUB maintainers. If you are not a -maintainer, you need to ask maintainers to do these instead of doing -these yourself. - -How to update the online manual: (FIXME: this is obsoelete) -1. Copy docs/*.texi (excluding "multiboot.texi") to fencepost.gnu.org. -2. Make a symbolic link from ~mohit/gnudoc/gnudoc_template to the - directory under which *.texi were copied, if the link isn't present. -3. Run ``~mohit/gnudoc/gendocs.sh grub "GNU GRUB Manual"''. -4. Copy the contents of the directory ``manual'' to - gnudist.gnu.org:~ftp/gnu/Manuals/grub-VERSION (VERSION is, for - example, 1.0). -5. Run ``ln -sf grub-VERSION grub'' in gnudist.gnu.org:~ftp/gnu/Manuals. -6. Run ``cd grub; ln -s grub.html index.html''. -7. Verify the new online manual with a WWW browser. -8. Update manual.html by hand. - -How to release a version: -1. Check out the source tree from the CVS from scratch. -2. Check if ``make distcheck'' succeeds. -3. Run ``util/grub-image''. -4. Check the resulted images, for example, using bochs. -5. Copy grub-VERSION.tar.gz, grub-VERSION-i386-pc.tar.gz and - grub-VERSION-i386-pc.ext2fs to fencepost.gnu.org:~ftp/gnu/grub. -6. Move older files in that directory above to the directory ``old'', - if you think they are eyesores. -7. Post an announcement to bug-grub@gnu.org. It would be a good idea to - send a carbon copy to bug-hurd@gnu.org and - debian-hurd@lists.debian.org. If the announcement is for a stable - version, you can inform info-gnu@gnu.org as well. -8. Optionally, post an announcement to Freshmeat.net. - -Legal issues: -1. If a patch is not significant (in size), you don't have to care about - the copyright. -2. If a patch is significant, you shouldn't apply the patch to the CVS. - Before doing that, you must ask the contributor to assign or disclaim - the copyright. Send ``/gd/gnuorg/request-assign.changes'' or - ``/gd/gnuorg/request-assign.future'' to the contributor, and wait - until the FSF finishes the legal work. -3. You can check if a contributor has already assigned his/her copyright - to the FSF by looking at ``/gd/gnuorg/copyright.list''. - -What you should have in your mind: -1. Don't add features unnecessarily! You may think it is a Good Thing to - have more features, but you must be prepared for more burdens. - DO THAT ONLY IF YOU BELIEVE THAT THE FEATURE IS ESSENTIAL. -2. Don't break backward-compatibility! Don't apply any patch which could - break existing features. Otherwise you would receive a lot of - complaints. DO THAT ONLY IF YOU BELIEVE THAT THE INCOMPATIBILITY IS - INEVITABLE. -3. Write good code. Be not satisfied with ad hoc workarounds or quick - hacks. NEVER WRITE BAD CODE. - -Resources: -* http://www.gnu.org/prep/maintain_toc.html -* http://www.gnu.org/prep/standards_toc.html -* http://www.gnu.org/server/fsf-html-style-sheet.html diff --git a/usr/src/grub/grub-0.95/Makefile.am b/usr/src/grub/grub-0.95/Makefile.am deleted file mode 100644 index 63a9a4f602..0000000000 --- a/usr/src/grub/grub-0.95/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -# Do not change this order if you don't know what you are doing. -AUTOMAKE_OPTIONS = 1.7 gnu -SUBDIRS = netboot stage2 stage1 lib grub util docs -EXTRA_DIST = BUGS MAINTENANCE diff --git a/usr/src/grub/grub-0.95/Makefile.in b/usr/src/grub/grub-0.95/Makefile.in deleted file mode 100644 index 2c0b4aaf82..0000000000 --- a/usr/src/grub/grub-0.95/Makefile.in +++ /dev/null @@ -1,600 +0,0 @@ -# Makefile.in generated by automake 1.8.5 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = . -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -host_triplet = @host@ -DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ - $(srcdir)/Makefile.in $(srcdir)/config.h.in \ - $(top_srcdir)/configure AUTHORS COPYING ChangeLog INSTALL NEWS \ - THANKS TODO compile config.guess config.sub depcomp install-sh \ - missing mkinstalldirs -subdir = . -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ - configure.lineno configure.status.lineno -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = config.h -CONFIG_CLEAN_FILES = -SOURCES = -DIST_SOURCES = -RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ - html-recursive info-recursive install-data-recursive \ - install-exec-recursive install-info-recursive \ - install-recursive installcheck-recursive installdirs-recursive \ - pdf-recursive ps-recursive uninstall-info-recursive \ - uninstall-recursive -ETAGS = etags -CTAGS = ctags -DIST_SUBDIRS = $(SUBDIRS) -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -distdir = $(PACKAGE)-$(VERSION) -top_distdir = $(distdir) -am__remove_distdir = \ - { test ! -d $(distdir) \ - || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ - && rm -fr $(distdir); }; } -DIST_ARCHIVES = $(distdir).tar.gz -GZIP_ENV = --best -distuninstallcheck_listfiles = find . -type f -print -distcleancheck_listfiles = find . -type f -print -ACLOCAL = @ACLOCAL@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BUILD_EXAMPLE_KERNEL_FALSE = @BUILD_EXAMPLE_KERNEL_FALSE@ -BUILD_EXAMPLE_KERNEL_TRUE = @BUILD_EXAMPLE_KERNEL_TRUE@ -CC = @CC@ -CCAS = @CCAS@ -CCASFLAGS = @CCASFLAGS@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DISKLESS_SUPPORT_FALSE = @DISKLESS_SUPPORT_FALSE@ -DISKLESS_SUPPORT_TRUE = @DISKLESS_SUPPORT_TRUE@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FSYS_CFLAGS = @FSYS_CFLAGS@ -GRUB_CFLAGS = @GRUB_CFLAGS@ -GRUB_LIBS = @GRUB_LIBS@ -HERCULES_SUPPORT_FALSE = @HERCULES_SUPPORT_FALSE@ -HERCULES_SUPPORT_TRUE = @HERCULES_SUPPORT_TRUE@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LTLIBOBJS = @LTLIBOBJS@ -MAINT = @MAINT@ -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ -MAKEINFO = @MAKEINFO@ -NETBOOT_DRIVERS = @NETBOOT_DRIVERS@ -NETBOOT_SUPPORT_FALSE = @NETBOOT_SUPPORT_FALSE@ -NETBOOT_SUPPORT_TRUE = @NETBOOT_SUPPORT_TRUE@ -NET_CFLAGS = @NET_CFLAGS@ -NET_EXTRAFLAGS = @NET_EXTRAFLAGS@ -OBJCOPY = @OBJCOPY@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -RANLIB = @RANLIB@ -SERIAL_SPEED_SIMULATION_FALSE = @SERIAL_SPEED_SIMULATION_FALSE@ -SERIAL_SPEED_SIMULATION_TRUE = @SERIAL_SPEED_SIMULATION_TRUE@ -SERIAL_SUPPORT_FALSE = @SERIAL_SUPPORT_FALSE@ -SERIAL_SUPPORT_TRUE = @SERIAL_SUPPORT_TRUE@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STAGE1_CFLAGS = @STAGE1_CFLAGS@ -STAGE2_CFLAGS = @STAGE2_CFLAGS@ -STRIP = @STRIP@ -VERSION = @VERSION@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_OBJCOPY = @ac_ct_OBJCOPY@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ - -# Do not change this order if you don't know what you are doing. -AUTOMAKE_OPTIONS = 1.7 gnu -SUBDIRS = netboot stage2 stage1 lib grub util docs -EXTRA_DIST = BUGS MAINTENANCE -all: config.h - $(MAKE) $(AM_MAKEFLAGS) all-recursive - -.SUFFIXES: -am--refresh: - @: -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \ - cd $(srcdir) && $(AUTOMAKE) --gnu \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - echo ' $(SHELL) ./config.status'; \ - $(SHELL) ./config.status;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - $(SHELL) ./config.status --recheck - -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - cd $(srcdir) && $(AUTOCONF) -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) - cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) - -config.h: stamp-h1 - @if test ! -f $@; then \ - rm -f stamp-h1; \ - $(MAKE) stamp-h1; \ - else :; fi - -stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status - @rm -f stamp-h1 - cd $(top_builddir) && $(SHELL) ./config.status config.h -$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - cd $(top_srcdir) && $(AUTOHEADER) - rm -f stamp-h1 - touch $@ - -distclean-hdr: - -rm -f config.h stamp-h1 -uninstall-info-am: - -# This directory's subdirectories are mostly independent; you can cd -# into them and run `make' without going through this Makefile. -# To change the values of `make' variables: instead of editing Makefiles, -# (1) if the variable is set in `config.status', edit `config.status' -# (which will cause the Makefiles to be regenerated when you run `make'); -# (2) otherwise, pass the desired values on the `make' command line. -$(RECURSIVE_TARGETS): - @set fnord $$MAKEFLAGS; amf=$$2; \ - dot_seen=no; \ - target=`echo $@ | sed s/-recursive//`; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - dot_seen=yes; \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ - done; \ - if test "$$dot_seen" = "no"; then \ - $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ - fi; test -z "$$fail" - -mostlyclean-recursive clean-recursive distclean-recursive \ -maintainer-clean-recursive: - @set fnord $$MAKEFLAGS; amf=$$2; \ - dot_seen=no; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - rev=''; for subdir in $$list; do \ - if test "$$subdir" = "."; then :; else \ - rev="$$subdir $$rev"; \ - fi; \ - done; \ - rev="$$rev ."; \ - target=`echo $@ | sed s/-recursive//`; \ - for subdir in $$rev; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ - done && test -z "$$fail" -tags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ - done -ctags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ - done - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ - include_option=--etags-include; \ - empty_fix=.; \ - else \ - include_option=--include; \ - empty_fix=; \ - fi; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test ! -f $$subdir/TAGS || \ - tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ - fi; \ - done; \ - list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - $(am__remove_distdir) - mkdir $(distdir) - $(mkdir_p) $(distdir)/util - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done - list='$(SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test -d "$(distdir)/$$subdir" \ - || mkdir "$(distdir)/$$subdir" \ - || exit 1; \ - (cd $$subdir && \ - $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="../$(top_distdir)" \ - distdir="../$(distdir)/$$subdir" \ - distdir) \ - || exit 1; \ - fi; \ - done - -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ - ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ - ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ - ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ - || chmod -R a+r $(distdir) -dist-gzip: distdir - $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz - $(am__remove_distdir) - -dist-bzip2: distdir - $(AMTAR) chof - $(distdir) | bzip2 -9 -c >$(distdir).tar.bz2 - $(am__remove_distdir) - -dist-tarZ: distdir - $(AMTAR) chof - $(distdir) | compress -c >$(distdir).tar.Z - $(am__remove_distdir) - -dist-shar: distdir - shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz - $(am__remove_distdir) - -dist-zip: distdir - -rm -f $(distdir).zip - zip -rq $(distdir).zip $(distdir) - $(am__remove_distdir) - -dist dist-all: distdir - $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz - $(am__remove_distdir) - -# This target untars the dist file and tries a VPATH configuration. Then -# it guarantees that the distribution is self-contained by making another -# tarfile. -distcheck: dist - case '$(DIST_ARCHIVES)' in \ - *.tar.gz*) \ - GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf - ;;\ - *.tar.bz2*) \ - bunzip2 -c $(distdir).tar.bz2 | $(AMTAR) xf - ;;\ - *.tar.Z*) \ - uncompress -c $(distdir).tar.Z | $(AMTAR) xf - ;;\ - *.shar.gz*) \ - GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ - *.zip*) \ - unzip $(distdir).zip ;;\ - esac - chmod -R a-w $(distdir); chmod a+w $(distdir) - mkdir $(distdir)/_build - mkdir $(distdir)/_inst - chmod a-w $(distdir) - dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ - && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ - && cd $(distdir)/_build \ - && ../configure --srcdir=.. --prefix="$$dc_install_base" \ - $(DISTCHECK_CONFIGURE_FLAGS) \ - && $(MAKE) $(AM_MAKEFLAGS) \ - && $(MAKE) $(AM_MAKEFLAGS) dvi \ - && $(MAKE) $(AM_MAKEFLAGS) check \ - && $(MAKE) $(AM_MAKEFLAGS) install \ - && $(MAKE) $(AM_MAKEFLAGS) installcheck \ - && $(MAKE) $(AM_MAKEFLAGS) uninstall \ - && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ - distuninstallcheck \ - && chmod -R a-w "$$dc_install_base" \ - && ({ \ - (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ - distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ - } || { rm -rf "$$dc_destdir"; exit 1; }) \ - && rm -rf "$$dc_destdir" \ - && $(MAKE) $(AM_MAKEFLAGS) dist \ - && rm -rf $(DIST_ARCHIVES) \ - && $(MAKE) $(AM_MAKEFLAGS) distcleancheck - $(am__remove_distdir) - @(echo "$(distdir) archives ready for distribution: "; \ - list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ - sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}' -distuninstallcheck: - @cd $(distuninstallcheck_dir) \ - && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ - || { echo "ERROR: files left after uninstall:" ; \ - if test -n "$(DESTDIR)"; then \ - echo " (check DESTDIR support)"; \ - fi ; \ - $(distuninstallcheck_listfiles) ; \ - exit 1; } >&2 -distcleancheck: distclean - @if test '$(srcdir)' = . ; then \ - echo "ERROR: distcleancheck can only run from a VPATH build" ; \ - exit 1 ; \ - fi - @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ - || { echo "ERROR: files left in build directory after distclean:" ; \ - $(distcleancheck_listfiles) ; \ - exit 1; } >&2 -check-am: all-am -check: check-recursive -all-am: Makefile config.h -installdirs: installdirs-recursive -installdirs-am: -install: install-recursive -install-exec: install-exec-recursive -install-data: install-data-recursive -uninstall: uninstall-recursive - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-recursive -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-recursive - -clean-am: clean-generic mostlyclean-am - -distclean: distclean-recursive - -rm -f $(am__CONFIG_DISTCLEAN_FILES) - -rm -f Makefile -distclean-am: clean-am distclean-generic distclean-hdr distclean-tags - -dvi: dvi-recursive - -dvi-am: - -html: html-recursive - -info: info-recursive - -info-am: - -install-data-am: - -install-exec-am: - -install-info: install-info-recursive - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-recursive - -rm -f $(am__CONFIG_DISTCLEAN_FILES) - -rm -rf $(top_srcdir)/autom4te.cache - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-recursive - -mostlyclean-am: mostlyclean-generic - -pdf: pdf-recursive - -pdf-am: - -ps: ps-recursive - -ps-am: - -uninstall-am: uninstall-info-am - -uninstall-info: uninstall-info-recursive - -.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \ - check-am clean clean-generic clean-recursive ctags \ - ctags-recursive dist dist-all dist-bzip2 dist-gzip dist-shar \ - dist-tarZ dist-zip distcheck distclean distclean-generic \ - distclean-hdr distclean-recursive distclean-tags \ - distcleancheck distdir distuninstallcheck dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-exec install-exec-am install-info \ - install-info-am install-man install-strip installcheck \ - installcheck-am installdirs installdirs-am maintainer-clean \ - maintainer-clean-generic maintainer-clean-recursive \ - mostlyclean mostlyclean-generic mostlyclean-recursive pdf \ - pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \ - uninstall-info-am - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/usr/src/grub/grub-0.95/Makefile.solaris b/usr/src/grub/grub-0.95/Makefile.solaris deleted file mode 100644 index ddf5cc9503..0000000000 --- a/usr/src/grub/grub-0.95/Makefile.solaris +++ /dev/null @@ -1,55 +0,0 @@ -# -# Copyright 2005 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# ident "%Z%%M% %I% %E% SMI" -# -include ../Makefile.grub -include Makefile.solaris.defs - -.KEEP_STATE: - -SUBDIRS = netboot stage2 stage1 lib grub util docs - -# -# Source files to be installed in $(SRC_DIR). -# NOTE: although it's under SCCS, config.h is not included here because -# it's automatically generated when configure is run. -# -SRC_DIR = $(ROOT_SRC) - -SRC_FILES = AUTHORS BUGS COPYING ChangeLog INSTALL MAINTENANCE \ - Makefile.am Makefile.in NEWS README THANKS TODO \ - acinclude.m4 aclocal.m4 config.h.in configure.ac stamp-h.in -INST_FILES = $(SRC_FILES:%=$(SRC_DIR)/%) - -SRC_EXECS = compile config.guess config.sub configure depcomp \ - install-sh missing mkinstalldirs -INST_EXECS = $(SRC_EXECS:%=$(SRC_DIR)/%) -$(INST_EXECS) := FILEMODE = 755 - - -INSTALL_TARGETS = $(INST_FILES) $(INST_EXECS) - -all := TARGET = all -install := TARGET = install -clean := TARGET = clean -clobber := TARGET = clobber - - -all install clean clobber: $(SUBDIRS) - -$(SUBDIRS): _FORCE - @cd $@; pwd; $(MAKE) -f Makefile.solaris $(TARGET) - - -install: $(INSTALL_TARGETS) - -$(SRC_DIR)/%: $(SRC_DIR) % - $(INS.file) - -$(SRC_DIR): - $(INS.dir) - - -_FORCE: diff --git a/usr/src/grub/grub-0.95/Makefile.solaris.defs b/usr/src/grub/grub-0.95/Makefile.solaris.defs deleted file mode 100644 index ddca919245..0000000000 --- a/usr/src/grub/grub-0.95/Makefile.solaris.defs +++ /dev/null @@ -1,88 +0,0 @@ -# -# Copyright 2005 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# ident "%Z%%M% %I% %E% SMI" -# -include $(SRC)/Makefile.master - -.KEEP_STATE: - -VERSION = 0.95 - -# $(POUND_SIGN) is just a #. Used to turn a feature off. -# The $(POUND_SIGN)POUND_SIGN:sh construct is just so make doesn't have to -# spawn a shell and redefine POUND_SIGN if it is already defined (e.g. -# $(SRC)/Makefile.master was already included). -$(POUND_SIGN)POUND_SIGN:sh = echo '\043' - - -# -# Optional features (set to $(POUND_SIGN) to turn off): -# -# OPTION_UTILS: -# Build the userland utilities. -# NOTE: these utilities will be installed in -# /platform/$(PLATFORM)/boot/grub, not /boot/grub. -# -# OPTION_DOCS: -# Build and install some GRUB documentations, e.g. man and info files. -# NOTE: these docs will be installed in -# /platform/$(PLATFORM)/boot/grub, not /boot/grub. -# -# OPTION_FS: -# Build additional filesystem support into GRUB. This will increase -# the sizes of stage2 and pxegrub and may cause malfunction. -# -# STAGE2_NETBOOT: -# Include netboot support in stage2 (on by default). -# This only affects stage2, not pxegrub (diskless support). -# -# STAGE2_NETBOOT = $(POUND_SIGN) -OPTION_UTILS = $(POUND_SIGN) -OPTION_DOCS = $(POUND_SIGN) -OPTION_FS = $(POUND_SIGN) - - -BASE_CFLAGS = -B$(GNU_ROOT)/bin/ -g $(CPPFLAGS) $(OPTFLAGS) -BASE_CCASFLAGS = -B$(GNU_ROOT)/bin/ -g $(CPPFLAGS) $(OPTFLAGS) -BASE_LDFLAGS = - -CC = $(GNU_ROOT)/bin/gcc -CFLAGS = $(BASE_CFLAGS) -CCDEPMODE = depmode=none - -CCAS = $(CC) -CCASFLAGS = $(BASE_CCASFLAGS) - -CPP = $(CC) -E - -# $(ENVCPPFLAGS4), if defined, should be something like "-Y I,somepath". -# We want to get rid of the "-Y I," part but make's pattern replacement -# macro reference doesn't allow spaces in it, e.g. $(ENVCPPFLAGS4:-Y I,%=%). -# So we'll get rid of the "-Y" now and then the "I," later. By the way, this -# should also work in case $(ENVCPPFLAGS4) is "-YI,somepath" (no space). -t.ENVCPPFLAGS4 = $(ENVCPPFLAGS4:-Y%=%) - -CPPFLAGS = $(DEFS) $(INCLUDES) $(WARNFLAGS) \ - $(ENVCPPFLAGS1:-I%=-isystem %) \ - $(ENVCPPFLAGS2:-I%=-isystem %) \ - $(ENVCPPFLAGS3:-I%=-isystem %) \ - $(t.ENVCPPFLAGS4:I,%=-nostdinc -isystem %) - -CCLD = $(GNU_ROOT)/bin/gld -LDFLAGS = $(BASE_LDFLAGS) -LINKFLAGS = -g -LINK = $(CCLD) $(LINKFLAGS) $(LDFLAGS) - -DEFS = -DHAVE_CONFIG_H -DSOLARIS_NETBOOT -OPTFLAGS = -falign-jumps=1 -falign-loops=1 -falign-functions=1 -#WARNFLAGS = -Wall -Wmissing-prototypes -Wunused -Wshadow \ -# -Wpointer-arith -Wundef - -OBJCOPY = $(GNU_ROOT)/bin/gobjcopy - -AR = /usr/ccs/bin/ar -RANLIB = : - -MKDIR = mkdir -p diff --git a/usr/src/grub/grub-0.95/NEWS b/usr/src/grub/grub-0.95/NEWS deleted file mode 100644 index d0660c9e5c..0000000000 --- a/usr/src/grub/grub-0.95/NEWS +++ /dev/null @@ -1,552 +0,0 @@ -NEWS - list of user-visible changes between releases of GRUB - -New: -* The command "fallback" supports mutiple fallback entries. -* The command "savedefault" supports an optional argument which - is the number of next boot entry or the special keyword `fallback'. -* New utility "grub-set-default". -* New section "Making your system robust" in the manual. - -New in 0.95 - 2004-06-13: -* Add support for ReiserFS 3. -* Fix support for FreeBSD 5. -* Support ATARAID for Linux in the grub shell and grub-install. -* Add CDROM support for El Torito with no emulation mode. You can use - (cd) as a CDROM drive in the config file. -* Option --no-mem-option is implied for Linux 2.4.18 and newer. -* Add support for UFS2. - -New in 0.94 - 2004-01-25: -* Support building on x86-64 with gcc -m32. -* Use a BIOS call to turn on/off Gate A20. This should solve various - problems related to Gate A20 in modern BIOSes. -* Add a workaround for buggy BIOSes (notably HP Vectra series) which - don't pass the boot drive correctly. -* Display "GNU GRUB" instead of "GRUB" in the menu. -* Add support for QNX RTP into the grub shell. -* Add support for the initrd max address of a kernel header in Linux. -* Support 32 bit and 64 bit dev_t. -* Add support for an install device in GRUB's notation with no - parenthesis (e.g. grub-install hd0). -* Improve the manual a lot. - -New in 0.93 - 2002-12-08: -* Define the behavior of the boot loader when the load end address is - zero and the bss end address is zero in the Multiboot Specification. - Also, add the support into GRUB. -* Finally, we have a Bug Tracking System! Now the preferable way to - report bugs is to use the BTS rather than sending e-mail to bug-grub. - See , for more - details. -* The appendix "FAQ" in the manual is removed. See the GNU GRUB FAQ on - the web instead. -* The terminal handling code is rewritten radically, and many bugfixes - are made at the same time. -* The command "color" is effective even in the command-line. -* The command "terminal" takes two new options, ``--no-echo'' and - ``--no-edit''. If you specify ``--no-echo'', GRUB won't echo back - input characters. If you specify ``--no-edit'', GRUB will disable the - BASH-like editing feature. These options are useful when using an - intelligent terminal (such as the comint mode in GNU Emacs). -* The utility ``grub-md5-crypt'' prompts to retype a password and checks - if the passwords match. -* Support for booting Linux is rewritten, so GRUB now supports - large-EBDA systems. -* The menu interfaces supports Page Up, Page Down, and Right Key. -* New command "terminfo", for vt100-incompatible terminals. -* New options, ``-D'', ``-g'' and ``-m'' are supported for FreeBSD. - -New in 0.92 - 2002-04-30: -* The command "displaymem" uses only hex digits for consistency. -* The netboot code goes back to the progress bars instead of dots, for - the notation of data transfers. And, that is displayed only in debug - mode, that is to say, nothing is displayed by default. Remember that - you can turn on debug mode via the command "debug". -* The command "help" doesn't show all the available commands by default, - when no argument is specified. Rarely used commands (such as - "testload") and useless commands in interactive use (such as - "savedefault") are hidden. If you want to see help messages for those - commands, specify the new option "--all". -* A built-in, `more'-like pager is added. When a command prints too many - lines to fit the screen, GRUB waits until you hit return key. This - feature can be turned off by the new command "pager". -* The command "terminal" accepts a new option, "--lines=LINES". You can - set the maximum number of lines arbitrarily with this option. If you - don't specify it, the maximum number will be 24. -* The command "terminal" accepts another new option, "--silent". You can - suppress the "Press any key to continue" message with this option. -* The mem= option for Linux is recognized and used to limit the maximum - address of initrd. -* A fallback entry is executed immediately after a default entry, - without prompting a user's intervention, as the manual has ever been - saying. -* The utility ``grub-install'' makes sure that GRUB images have been - written to a physical disk completely. To assist this feature, a new - command "dump" is added. - -New in 0.91 - 2002-01-21: -* Support for Linux DAC960 is added. -* JFS and XFS support is added. -* The commands "hide" and "unhide" support logical partitions. -* The utility ``grub-install'' supports NetBSD. -* The network support is updated to Etherboot-5.0.5. -* The manner of handling the preset menu changes. In the previous - implementation, the preset menu is used only when opening the - configuration file failed. Now try to use the preset menu first. And, - if the configuration file is available, it is read after readoing the - preset menu. In this case, menu entries in the preset menu (if any) - are overrided by the configuration file. -* Diskless support is a bit changed. In the previous, GRUB set up a - network automatically via a special function. In the current, the - function is gone and the preset menu feature is used (i.e. just - execute the command "bootp" as if you specified it in the preset - menu). This has no impact against most users, but you should take care - if using the preset menu for your own purpose, because GRUB doesn't - call "bootp" implicitly when the preset menu is used explicitly. In - this case, you would probably need to insert commands to initialize a - network into your preset menu. -* Important bugfixes are made for ReiserFS, APM, TFTP, LBA, etc. - -New in 0.90 - 2001-07-11: -* The command "setkey" resets key mappings, when no argument is - specified. -* Linux devfs support is added. -* The utility ``grub-install'' accepts a new option, `--recheck'. If - this option is specified, probe a device map, even if it already - exists. You should use this option whenever you add/remove a disk. -* The command "password" supports a md5 password if the option `--md5' - is given. This command can now also be used to protect specific menu - items with their own passwords. -* New command, "displayapm". -* New command, "md5crypt". -* The new utility ``grub-md5-crypt'' is a frontend of the grub shell. It - encrypts a password in MD5 format. -* New commands, "testvbe" and "vbeprobe". -* The configure script accepts a new option, `--enable-preset-menu'. You - can embed an arbitrary configuration which will be used when Stage 2 - cannot open a real configuration file, with this option. The argument - must be an existing file. -* EZ-BIOS support is added. -* Booting Windows from a logical partition is supported. -* The example Multiboot kernel in the directory "docs" is built, if you - specify the option `--enable-example-kernel' to the configure script. -* New command, "ifconfig". -* Linux software RAID support is added (only for RAID-1). -* Hercules support is added. -* The configure script now accepts `--disable-auto-linux-mem-opt', which - has the same meaning as you specify the option `--no-mem-option' to the - command "kernel". -* Jump to the physical entry address of a Multiboot kernel when booting - it up. The old behavior was to use the virtual one, regardless of the - setting of the physical address. -* The commands "bootp" and "dhcp" accepts a new option - `--with-configfile', so that you can load a remotely specified - configuration file automatically, like the network boot images. -* VSTa filesystem support is added. -* ELF symbol loading support is added. - -New in 0.5.96 - 2000-10-04: -* New commands, "reboot" and "halt". -* New command, "hiddenmenu". You can hide the menu interface by default - with this command. -* You can specify `--no-mem-option' to the command "kernel", if you want - GRUB not to pass a Linux's mem option automatically. -* Now GRUB is compliant with the Linux/i386 boot protocol version 2.02. -* The network support is updated to Etherboot-4.6.4. -* Symlinks in ReiserFS are supported. -* Add a workaround into the grub shell, so that it works fine even under - Linux 2.4. -* Add a new option `--stage2' into the commands "install" and "setup", - to let the grub shell know what the file name of Stage 2 is under your - operating system. You must specify the option correctly, if you cannot - unmount the partition where GRUB images reside. We'd recommend _not_ - using those commands directly, but using the utility "grub-install" - instead, because this is safer. -* One violation against the Network Boot Image Proposal was found and - fixed. So now the image `nbgrub' can work fine even with a card such - as rtl8139. -* Serial terminal support is added. The configure script accepts - a new option `--disable-serial'. Unless it is specified, you can use - two new commands, "serial" and "terminal" in the command-line and the - menu. See the manual, for more details. -* Preserve the possible magic number used by Windows NT in a MBR. -* The command-line interface is switched to single-line editing mode. -* Only for developers: the configure script accepts - `--enable-serial-speed-simulation', which is useful when you want to - simulate the speed of a serial device on a psuedo terminal. -* Also only for developers: you can specify an optional argument to the - option `--hold' for the grub shell. The argument means how many - seconds the grub shell should wait until diving into the main routine. -* New command, "savedefault". Now you can save current entry number to - your disk with this command and then you can set the default boot - entry to it by the command "default saved". -* Add a new option `--prefix' into the command "setup", so that you can - specify the name of a directory which contains GRUB images. And, the - behavior of this command changed slightly, that is, this command now - searchs stage1 automatically under "/boot/grub" and "/grub", unless - you specify the option `--prefix'. -* The utility `grub-install' recognizes a separate boot partition - automatically. -* New commands, "partnew" and "parttype". You can modify partition - tables with these commands. - -New in 0.5.95 - 2000-06-27: -* NetBSD ELF kernel support is added. You have to specify the new option - to the command "kernel". See below. -* Added a new option `--type=TYPE' into the command "kernel". This - option suggests what type of kernel you want to load. TYPE must be - either of "netbsd", "freebsd", "openbsd", "linux", "biglinux" and - "multiboot". Actually, this option will be necessary only if you want - to load a NetBSD ELF kernel, because GRUB can automatically determine - a kernel type in the other cases. -* ReiserFS support is added. -* Added a new option `--force-lba' into the command "install". This - option disables some sanity checks for LBA mode (but not all). If you - are sure that your machine supports LBA mode but GRUB doesn't work in - LBA mode, you should specify it. It is necessary if your BIOS is too - buggy. In the previous version, it was a compile-time option, but you - don't have to recompile GRUB any longer. -* Likewise, now the command "setup" and the script "grub-install" also - accept `--force-lba' option. Specifying this option to "setup" or - "grub-install" has the same effect as to the command "install". -* The configure script doesn't accept the option - `--disable-lba-support-bitmap-check' any longer. Use the option above. -* The network support is updated to Etherboot-4.6.1. So now we have - 3Com59x and DEPCA drivers. -* Now you can omit the configuration file argument to the command - "password". If you omit it, then GRUB will just unlock privileged - instructions (such as `c') when you enter a correct password. -* The new command "lock" can be used to prevent end-users from executing - arbitrary menu entries. This command will emit an error until the user - enters a correct password. -* Recognize the Linux extended partition type. -* Pass a correct memory size to Linux and *BSD. -* Diskless support is added. Now configure accepts --enable-diskless, - and "make" will produce two additional images, ``nbgrub'' for Net Boot - Image Proposal and ``pxegrub'' for Preboot Execution Environment. See - the documentation, for more details. -* The command "tftpserver" overrides a TFTP server address returned by a - BOOTP server, a DHCP server or a RARP server. -* Fix a serious bug about LBA support. It is possible that you don't - disable the LBA support bitmap check any longer. Please send a report, - if you must still disable it. We need to know if we should get rid of - the option. - -New in 0.5.94 - 2000-03-06: -* Stage 1 supports both the LBA mode and the CHS mode. -* The NetBSD and OpenBSD boot bug is fixed. -* The more automatic installation command "setup" is added. -* The command "embed" embeds a Stage 1.5 in the sectors after a MBR. -* Support symbolic color name syntax in the command "color". -* The grub shell loads the BIOS drive mapping information from a device - map file if it is specified and can be opened. If not found, try to - create it based on the guessed information. -* NetBSD support in the grub shell is improved. -* A simple checker for the format of a Multiboot kernel, ``mbchk'', is - added. -* The command "find" searches for a filename in all devices and print - the list of the devices which contain the file. -* The command "map" maps a drive to another drive so that we can - chain-load some foolish operating systems (such as DOS) even if such - an operating system resides at a non-first drive. -* The command "setkey" maps a key to another. -* The GRUB manual is rewritten, and now consists of three parts and - appendices. -* The command "ioprobe" detects what I/O ports are used for a BIOS - drive. -* OpenBSD support in the grub shell is improved. -* The command "install" can now patch a Stage 2 with a different - filename from "/boot/grub/menu.lst" even if a Stage 1.5 is used. -* New program, ``grub-install''. -* The command "blocklist" prints the blocklist notation of a file. -* The command "chainloader" now accepts an option "--force", which is - required if you want to chain-load a boot loader defective in the - signature, such as SCO Unixware 7.1. -* The netboot support is heavily rewritten, based on Etherboot-4.4.3. - Most of the device drivers are stolen from it, so we now have many - network drivers. See netboot/README.netboot for more details. -* Now configure accepts the option `--disable-lba-support-bitmap-check' - to ignore an incorrect LBA support bitmap returned by a buggy BIOS. If - you are sure that your BIOS does support LBA mode but GRUB doesn't - work in LBA mode, recompile GRUB with this option specified. You can - check if GRUB accesses a drive in LBA mode by the command "geometry". -* New commands "bootp", "dhcp" and "rarp" can be used to initialize a - network device and get IP addresses from a network. -* Long filename support in the FAT filesystem is added. -* The command "cmp" compares each bytes in two files. - -New in 0.5.93 - 1999-10-30: -* ELF format of FreeBSD kernel is supported. -* Support the partition ids for NetBSD and OpenBSD. -* Exit from the grub shell just by pushing the key `q' in the menu. -* New options for configure can disable some functions in Stage 2. See - the output from `configure --help' for more information. -* FAT32 support is added. -* Minix fs support is added. -* New commands "hide" and "unhide". -* The character `=' after a command is not necessary any longer, but it - is supported for backward compatibility. -* The command "help" displays helpful information about builtin - commands. -* The command "geometry" displays the information of a drive specified - and set the geometry to arbitrary C/H/S values if the optional - arguments are used. -* The command "configfile" loads a configuration file interactively. -* The command "device" assigns a BIOS drive to an arbitrary filename in - the grub shell. -* The option `--no-floppy' force the grub shell to assume that there is - no floppy, and the option `--probe-second-floppy' enables the probe of - the second floppy drive. -* Integrated the netboot support in the Dresden version of GRUB. -* FreeBSD support in the grub shell is improved. -* Killing (C-u and C-k), yanking (C-y) and manipulating the history - (C-p and C-n) are supported. -* The address argument for the command "install" is now optional. -* Better completion support. -* The command "cat" displays the contents of a file. - -New in 0.5.92 - 1999-07-26: -* Bug fixes (i.e. Stage 1.5 can work fine again). -* The /sbin/grub stage2 simulator now works at least on GNU/Linux, and - uses the Linux HDIO_GETGEO ioctl to determine hard disk geometry. -* TAB not only lists filenames, but also completes a filename when the - filename is unique. -* Password is not echoed back, put an asterisk for each of input - characters. -* stage2_debug is removed, and the debugging features are added into - stage2. -* Color menu support. -* New command "quit". -* The man page for /sbin/grub. -* All documents become Texinfo. -* Linux video mode selection is supported. -* The new Stage 1 `stage1_lba' supports LBA addressing mode. - -New in 0.5.91 - 1999-03-14, Gordon Matzigkeit: -* LBA and preliminary AWARD BIOS disk extension support. -* Started docs/grub.texi. -* /sbin/grub GUI now works (but it doesn't yet access disks properly). - Run `configure --enable-sbin-grub' to build this program in the grub - subdirectory. - -New in 0.5.90 - 1999-03-01, Gordon Matzigkeit: -* Bug fixes. -* GRUB understands symlinks on ext2fs (but still not ffs). -* Many source code and build cleanups to comply with GNU standards. - -New in 0.5 - 1998-08-20, Erich Boleyn: - -* Improved error messages in the stage1 to be strings (easier to read - than the previous case of single characters), and removed any - display in the case of no error (less confusing). - -* New document describing error conditions and messages. - -* Improved configure/build process. - -* Made the early bootup interrupt-safe. Wasn't doing cli/sti when - necessary sometimes. - -* GRUB now shuts off the floppy before transferring control to any - other programs/modules/loaders. (chain-loading doesn't matter here, - just loading 32-bit modules/kernels) - -* Fixed a few stupid bugs, including a several in the ext2fs code. - -* Linux boot format support extended from just "zImage" to include - "bzImage" and initial ramdisk (also called "initrd") support for - both. "initrd" support is untested, but the critical parts were - taken from a supplied patch and seem OK. - -* Several new command features. See the command-listing for details. - -New in 0.4 - 1998-03-19, Erich Boleyn: - -* GRUB now correctly points ES:SI at a partition descriptor when - chain-loading. - -* Many minor bugs fixed (some in the build scripts). - -* Intel MPS 1.4 config/check code is totally new, and the "syscmd=" - command is completely removed. Check command-listing for details. - -Version 0.4-pre, Erich Boleyn: - -* Reorganized docs, moved most "NOTE" items to a FAQ (with new entries - as well). - -* Now supports automatic decompression of any files loaded via the - GRUB stage2 filesystem code. Simply compress the file using GNU - gzip normally, then when loading, the GRUB internals will see the - contents in the decompressed state... i.e. all GRUB functions - operate normally as if it is the uncompressed file. An extra - version of the "module" loading function has been added which - disables this functionality if desired (in all the other cases, not - decompressing doesn't make sense). - -* Changed device strings used in filesystem code to more logical - format. Added "relative" disk and partition capability, see - command-listing and filesystem syntax description for details. - -* "install=" command vastly improved. Also moved to non-debug area. - Check command-listing and install documentation for details. - -* Added several new commands: "rootnoverify=", "uppermem=", and a new - debug command "displaymem". Check command-listing for details. - -* Added versioning numbers (and subsequently broke compatibility with - some of the previous code, so GRUB should be re-installed!). - -* Added unattended booting support via new "fallback=" command. - -* During debug probe of SMP configuration table compatible with Intel - MPS 1.4 standard, GRUB now checks for a pointer in the EBDA. - -* Using a "default=" entry greater than 11 caused the UI to do funny - things (it didn't pre-scroll the list to the appropriate place). - -* Reading files on FAT floppies had yet more problems related by many - users of version 0.3 6/17/96. Again, all known problems fixed. - -* "Extended" partitions now work (still cannot make an extended - partition active with "makeactive" command). - -* The build environment is greatly simplified, now using an - autoconf-like "configure" script. - -New in 0.3-19960617 - 1996-06-17, Erich Boleyn: - -* Yet more documentation improvements. - -* Known bugs in floppy operation fixed (12-bit FAT didn't work for - most cases, and inserting other floppies didn't flush the filesystem - cache). - -* NASTY uninitialized pointer bug causing "raw" floppy operation to - crash on several PCs is now fixed. This seems to have been the root - cause of all of the compatibility problems that have currently been - observed. - -* debug-mode command added to automate most difficult step of - installation for common cases (new install method #4). - -* Testing "mini-debugger" now merged with command-line when "DEBUG" - defined in compile (no SYSDEBUG option anymore). See description of - commands in the command-line for details. - -New in 0.3-19960602 - 1996-06-02, Erich Boleyn: - -* Completed initial licenses. - -* Initial filesystem documentation written. - -* Block-list and FAT filesystems now work as documented (in - particular, for the blocklist filesystem, shortcuts like "+1" for - "0+1,512" now work correctly). - -* Fixed several problems (old and new) in the various filesystems (for - example, the ext2fs filesystem code is now much faster, as it caches - some mapping blocks where it didn't at all before). Filesystem - semantics are much more uniform as well (symbolic links and reading - a directory as a file now return errors where it would silently fail - before). - -* "makeactive" now works for standard PC partitions on hard disks (not - extended partitions... so any PC partition number above 3 will give - a "no such partition" error). If a BSD sub-partition is is used, it - will ignore it, and only use the primary PC partition number. - -New in 0.3-19960520 - 1996-05-20, Erich Boleyn: - -* Updated instructions (though still very sparse). - -* New floppy probe (works much like the Linux floppy boot probe) - attempts to find the size of a floppy in a drive. Might still need - work! Please try on various floppy drives with various media! - -* New floppy handler will claim a non-existent drive if the floppy - disk isn't present in the drive. (for example, it won't be on the - list of installed drives unless a floppy is present) - -* Stage1 now compatible with both a hard disk MBR and the DOS BIOS - parameter block (see "install/README" for more details on how this - can be used). - -* Block-list filesystem partially works, as described in the file - "NOTES". Loading an a.out or elf kernel won't work with it, but all - other filetypes pretty much should. (certainly chain-loading works - OK) - - NOTE: you must use the full format "0+1,512" for just he first - block... no parameters can be implicit in this version.. THis is - being fixed too. - -* Linux ext2 filesystem works. (it's very slow for big files, but - this is being fixed) - -* Linux boot type now supported. Use a standard piggybacked image as - with LILO. Put in hack to support >64MB via GRUB placing the RAM - size as the first item on the command-line automatically. Must pass - root partition on command-line using normal Linux syntax... if not, - it uses it's builtin root partition. - -* Supports chain-loading. For details, see "COMMANDS" and the - examples directory. (was able to boot DOS and Windows NT on my test - box). NOTE that the "root partition" must be set to work right. - "makeactive" is currently a no-op. - -* Several weird bugs fixed. One important note: If you recompile, it - will warn about a clash with builtin "strcmp". This is normal... - do NOT remove the strcmp definition, as then GCC will possibly put - inline code from it's own builtin function in some places. (my - strcmp has slightly different functionality, hence the problem) - -* Mini-debugger is currently broken. - -New in 0.2 - 1996-04-12, Erich Boleyn: - -* Completely new menu-based UI. See "COMMANDS" and the examples - directory for details. NOTE that the argument to a command must be - preceded by a space between it and the '=', in both the config file - and the command-line. This will be fixed. - -New in 0.1 - 1996-03-31, Erich Boleyn: - -* Newer version of Multiboot Standard (version 0.6) supported. - -* Autodetects kernel types. Supports Multiboot, FreeBSD, NetBSD - (Linux isn't finished). - -* Stage 1.5 works now. Default setup is now for working with a BSD - FFS floppy loading "/grub/stage2" as the main bootloader. - -* Filesystem support improved. It didn't work on many floppies before - (problem with the partition-detection code). - -* Memory probe now supports arbitrary amounts of RAM (some technical - limitations exist, see Multiboot standard version 0.6 for details). - -* A mini-debugger is included by default, activated by hitting '~' on - the command-line (it might interfere with things, but it seems OK - for my alpha-testing). The commands are in the function - "enter_sysdebug" defined in "common.c". If you have an Intel MPS- - compatible machine, there are extra commands enabled for SMP cpu - testing. 'q' exits and goes back to what you were doing before. - -New in 0.0-19960206 - 1996-02-06, Erich Boleyn: - -* Newer version of Multiboot Standard (version 0.4) supported. - -New in 0.0-19951210 - 1995-12-10, Erich Boleyn: - -* You can now perform TAB-based completion listing of any valid - partially completed disk/partition/file-name combination. Try it - out to see what you like, examples are in the NOTES file under - "Device completion". - -* Fixed a bug causing the memory size routine to sometimes report - ridiculous values. - -* Fixed some documentation (what little there is :-/ and a few - assembly bugs in the BIOS access routines that nobody reported yet, - so I won't detail it here. diff --git a/usr/src/grub/grub-0.95/README b/usr/src/grub/grub-0.95/README deleted file mode 100644 index 10233f729e..0000000000 --- a/usr/src/grub/grub-0.95/README +++ /dev/null @@ -1,23 +0,0 @@ -This is GNU GRUB, the GRand Unified Bootloader. GRUB is intended to -provide important bootloader features that are missing from typical -personal computer BIOSes: - - - provides fully-featured command line and graphical interfaces - - recognizes fdisk partitions and BSD disklabels - - can dynamically read Linux ext2fs, ReiserFS, JFS and XFS, BSD ufs, - MS-DOS FAT16 and FAT32, Minix fs, and VSTa fs filesystems, plus - hardcoded blocklists - - can boot Multiboot-compliant kernels (such as GNU Mach), as well - as standard Linux and *BSD kernels - -See the file NEWS for a description of recent changes to GRUB. - -If you are interested in the network support, see the file -README.netboot under the directory netboot. - -See the file INSTALL for instructions on how to build and install the -GRUB data and program files. See the GRUB manual for details about -using GRUB as your boot loader. Type "info grub" in the shell prompt. - -Please visit the official web page of GNU GRUB, for more information. -The URL is . diff --git a/usr/src/grub/grub-0.95/THANKS b/usr/src/grub/grub-0.95/THANKS deleted file mode 100644 index 908cb91216..0000000000 --- a/usr/src/grub/grub-0.95/THANKS +++ /dev/null @@ -1,121 +0,0 @@ -GRUB would not be what it is today without the invaluable help of -everybody who was kind enough to spend time testing it and reporting -bugs. - -The following people made especially gracious contributions of their -time and energy in helping to track down bugs, add new features, and -generally assist in the GRUB maintainership process: - -Adam Lackorzynski -Adrian Phillips -Alban Crequy -Alessandro Rubini -Alexander K. Hudek -Alexander Langer -Alfred M. Szmidt -Andrew Clausen -Andrew Walrond -Ben Liblit -Bernhard Treutwein -Bodo Rueskamp . -Boji Tony Kannanthanam -Bradford Hovinen -Brian Brunswick -Bryan Ford -Cedric Ware -Chip Salzenberg -Christian Jones -Christoph Plattner -Damian Ivereigh -David Weinehall -Dan J. Walters -Daniel Farrell -Daniel Pittman -Daniel Wagner -Danilo Godec -Dennis Kitzman -Derrik Pates -Edmund GRIMLEY EVANS -Eduard Guzovsky -Edward Killips -Egmont Koblinger -Eric Hanchrow -Erik Schoenfelder -Eugene Doudine -Florian Hatat -Frank Mehnert -Gary Poppitz -Goran Koruga -Hal Snyder -HASEGAWA Tomoki -Heikki Vatiainen -Heiko Schroeder -Henrik Nordstrom -Herbert Nachtnebel -Hidetoshi Nishimaki -Hisazumi Kenji -HORIKAWA Kazunori -Ilguiz Latypov -Jan Fricke -Jan Zerebecki -Jason Thomas -Jean-Jacques Michel -Jeremy Katz -Jochen Hoenicke -Johannes Kroeger -John Goerzen -John Tobey -Josip Rodin -Julien Bordet -Julien Perrot -Kalle Olavi Niemitalo -Karsten Scheibler -KB Sriram -Khimenko Victor -Klaus Reichl -Kristoffer Branemyr -Kunihiro Ishiguro -Leendert Meyer -Leonid Lisovskiy -M. Meiarashi -Mark Kettenis -Mark Lundeberg -Matt Perry -Matt Yourst -Matthias Granberry -Matthias Kretschmer -Michael Hohmuth -Michael Sullivan -Mike Meyer -Miles Bader -Neal H Walfield -Neelkanth Natu -OKUJI Yoshinori -Pavel Roskin -Per Lundberg -Peter Astrand -Ralf Medow -Ramon van Handel -Robert Millan -Roderich Schupp -Rogelio M. Serrano Jr. -Sergey Matveychuk -Serguei Tzukanov -Stefan Ondrejicka -Stephen Early -Steven Dick -Takehiro Suzuki -Taketo Kabe -Thierry DELHAISE -Thierry Laronde -Thomas Schweikle -Thomas Schwinge -Tilmann Bubeck -Timothy Baldwin -Torsten Duwe -Uwe Dannowski -VaX#n8 -Vesa Jaaskelainen -Yedidyah Bar-David -Yury V. Umanets -Yuri Zaporogets diff --git a/usr/src/grub/grub-0.95/TODO b/usr/src/grub/grub-0.95/TODO deleted file mode 100644 index adbc8d0937..0000000000 --- a/usr/src/grub/grub-0.95/TODO +++ /dev/null @@ -1,102 +0,0 @@ --*- Mode: Outline -*- - -Before working on anything in this file, it's very important that you -make contact with the core GRUB developers. Things herein might be -slightly out of date or otherwise not easy to understand at first -glance. So write to first. - -Priorities: - Reported bugs generally have top priority. - Non-reported and non-encountered bugs (things we know don't work, - but don't really impede things) have lower priority. - Things in this file are ranked with one to three !; the more, the - higher priority. - - -Things that should be done before 1.0: - -* Finish the Multiboot Speicification 0.7. !!! - -* Add more --disable-FOO options to configure, so that you can create a - minimum GRUB image. This is useful for boot floppies because of the size - restriction. ! - -* Implement a new version of track_int13, using Virtual 8086 Mode. !!! - -* Add missing features of graphics support. !! - -Things that should _not_ be done before 1.0: - -* Add configuration inclusion support by adding a command "include". ! - -* Add automatic configuration support. - -* Add bunzip2 support. - -* Define the module system. - -* Add BSD syntax support, using results of ioprobe to map drives. ! - (0x1f0-0x1f7 = primary IDE, 0x170-0x176 = secondary, - 0x1e8-0x1ef = tertiary, 0x168-0x16f = quaternary). - -* Add a real scripting language, possibly retaining backward - compatibility so that old config files can be used. - -* Add internationalization support, emulating gettext as much as is - feasible. - -* Support other architectures than i386-pc. - -* Add real memory management. - - -Things that may be done anytime: - -* Port the script ``grub-install'' to OpenBSD. At least you will have to - modify the function `convert' so that it can translate a native device - name into the corresponding GRUB drive representation. ! - -* Add a command to run a GRUB script file. !! - -* Add commands to manipulate the menu from the command-line interface. ! - -* Make symbolic links work for BSD FFS. - -* Add indirect block support to the BSD FFS filesystem code, so files - larger than 16MB can be read. - -* Fix-up FreeBSD, NetBSD (and OpenBSD ?) command-line boot - parameters. - -* Support embedding a Stage 1.5 in the "bootloader" area of a FFS - partition. (We already have the code, but need an approval by an - expert before turning on the support. Any volunteers?) - -* Support embedding a Stage 1.5 in the EXT2_BOOT_LOADER_INO of an ext2fs - partition, so that it won't be accidentally erased or modified by - the kernel. - -* Add ISA PnP support. - -* Add more filesystems support (NTFS, etc.) - -* Add more remote console support (parallel and net). - -* Add (real) RAID support. - -? Add a partition naming syntax that means ``the first partition of - this type''. We need this for clean Hurd install floppies. - Nope. Improving the `find' command would solve this problem. - -* Add CDROM-chainloading support. It would be enough to support only - BIOSes which have bootable-CDROM support (so you may use the "Bootable - CDROM" BIOS calls). It is not trivial to support BIOSes without the - capability to boot CDROM. - -? Divide pxegrub into two parts, so the initial image doesn't exceed - the 32KB limit. I'm not sure if this is really necessary, because the - PXE standard just says that it is _recommended_ to improve the - modularity of a boot image. Obviously, this reason doesn't apply to - GRUB, as pxegrub is merely a secondary boot loader. So whether this - task should be done depends on if existing PXE ROMs support >32KB - images or not, after all. diff --git a/usr/src/grub/grub-0.95/acinclude.m4 b/usr/src/grub/grub-0.95/acinclude.m4 deleted file mode 100644 index 368839cdf9..0000000000 --- a/usr/src/grub/grub-0.95/acinclude.m4 +++ /dev/null @@ -1,366 +0,0 @@ -dnl grub_ASM_USCORE checks if C symbols get an underscore after -dnl compiling to assembler. -dnl Written by Pavel Roskin. Based on grub_ASM_EXT_C written by -dnl Erich Boleyn and modified by OKUJI Yoshinori -AC_DEFUN([grub_ASM_USCORE], -[AC_REQUIRE([AC_PROG_CC]) -AC_MSG_CHECKING([if C symbols get an underscore after compilation]) -AC_CACHE_VAL(grub_cv_asm_uscore, -[cat > conftest.c <<\EOF -int -func (int *list) -{ - *list = 0; - return *list; -} -EOF - -if AC_TRY_COMMAND([${CC-cc} ${CFLAGS} -S conftest.c]) && test -s conftest.s; then - true -else - AC_MSG_ERROR([${CC-cc} failed to produce assembly code]) -fi - -if grep _func conftest.s >/dev/null 2>&1; then - grub_cv_asm_uscore=yes -else - grub_cv_asm_uscore=no -fi - -rm -f conftest*]) - -if test "x$grub_cv_asm_uscore" = xyes; then - AC_DEFINE_UNQUOTED([HAVE_ASM_USCORE], $grub_cv_asm_uscore, - [Define if C symbols get an underscore after compilation]) -fi - -AC_MSG_RESULT([$grub_cv_asm_uscore]) -]) - - -dnl Some versions of `objcopy -O binary' vary their output depending -dnl on the link address. -AC_DEFUN([grub_PROG_OBJCOPY_ABSOLUTE], -[AC_MSG_CHECKING([whether ${OBJCOPY} works for absolute addresses]) -AC_CACHE_VAL(grub_cv_prog_objcopy_absolute, -[cat > conftest.c <<\EOF -void -cmain (void) -{ - *((int *) 0x1000) = 2; -} -EOF - -if AC_TRY_EVAL(ac_compile) && test -s conftest.o; then : -else - AC_MSG_ERROR([${CC-cc} cannot compile C source code]) -fi -grub_cv_prog_objcopy_absolute=yes -for link_addr in 2000 8000 7C00; do - if AC_TRY_COMMAND([${CC-cc} ${CFLAGS} -nostdlib -Wl,-N -Wl,-Ttext -Wl,$link_addr conftest.o -o conftest.exec]); then : - else - AC_MSG_ERROR([${CC-cc} cannot link at address $link_addr]) - fi - if AC_TRY_COMMAND([${OBJCOPY-objcopy} -O binary conftest.exec conftest]); then : - else - AC_MSG_ERROR([${OBJCOPY-objcopy} cannot create binary files]) - fi - if test ! -f conftest.old || AC_TRY_COMMAND([cmp -s conftest.old conftest]); then - mv -f conftest conftest.old - else - grub_cv_prog_objcopy_absolute=no - break - fi -done -rm -f conftest*]) -AC_MSG_RESULT([$grub_cv_prog_objcopy_absolute])]) - -dnl Mass confusion! -dnl Older versions of GAS interpret `.code16' to mean ``generate 32-bit -dnl instructions, but implicitly insert addr32 and data32 bytes so -dnl that the code works in real mode''. -dnl -dnl Newer versions of GAS interpret `.code16' to mean ``generate 16-bit -dnl instructions,'' which seems right. This requires the programmer -dnl to explicitly insert addr32 and data32 instructions when they want -dnl them. -dnl -dnl We only support the newer versions, because the old versions cause -dnl major pain, by requiring manual assembly to get 16-bit instructions into -dnl stage1/stage1.S. -AC_DEFUN([grub_ASM_ADDR32], -[AC_REQUIRE([AC_PROG_CC]) -AC_REQUIRE([grub_ASM_PREFIX_REQUIREMENT]) -AC_MSG_CHECKING([for .code16 addr32 assembler support]) -AC_CACHE_VAL(grub_cv_asm_addr32, -[cat > conftest.s.in <<\EOF - .code16 -l1: @ADDR32@ movb %al, l1 -EOF - -if test "x$grub_cv_asm_prefix_requirement" = xyes; then - sed -e s/@ADDR32@/addr32/ < conftest.s.in > conftest.s -else - sed -e s/@ADDR32@/addr32\;/ < conftest.s.in > conftest.s -fi - -if AC_TRY_COMMAND([${CC-cc} ${CFLAGS} -c conftest.s]) && test -s conftest.o; then - grub_cv_asm_addr32=yes -else - grub_cv_asm_addr32=no -fi - -rm -f conftest*]) - -AC_MSG_RESULT([$grub_cv_asm_addr32])]) - -dnl -dnl Later versions of GAS requires that addr32 and data32 prefixes -dnl appear in the same lines as the instructions they modify, while -dnl earlier versions requires that they appear in separate lines. -AC_DEFUN([grub_ASM_PREFIX_REQUIREMENT], -[AC_REQUIRE([AC_PROG_CC]) -AC_MSG_CHECKING(dnl -[whether addr32 must be in the same line as the instruction]) -AC_CACHE_VAL(grub_cv_asm_prefix_requirement, -[cat > conftest.s <<\EOF - .code16 -l1: addr32 movb %al, l1 -EOF - -if AC_TRY_COMMAND([${CC-cc} ${CFLAGS} -c conftest.s]) && test -s conftest.o; then - grub_cv_asm_prefix_requirement=yes -else - grub_cv_asm_prefix_requirement=no -fi - -rm -f conftest*]) - -if test "x$grub_cv_asm_prefix_requirement" = xyes; then - grub_tmp_addr32="addr32" - grub_tmp_data32="data32" -else - grub_tmp_addr32="addr32;" - grub_tmp_data32="data32;" -fi - -AC_DEFINE_UNQUOTED([ADDR32], $grub_tmp_addr32, - [Define it to \"addr32\" or \"addr32;\" to make GAS happy]) -AC_DEFINE_UNQUOTED([DATA32], $grub_tmp_data32, - [Define it to \"data32\" or \"data32;\" to make GAS happy]) - -AC_MSG_RESULT([$grub_cv_asm_prefix_requirement])]) - -dnl -dnl Older versions of GAS require that absolute indirect calls/jumps are -dnl not prefixed with `*', while later versions warn if not prefixed. -AC_DEFUN([grub_ASM_ABSOLUTE_WITHOUT_ASTERISK], -[AC_REQUIRE([AC_PROG_CC]) -AC_MSG_CHECKING(dnl -[whether an absolute indirect call/jump must not be prefixed with an asterisk]) -AC_CACHE_VAL(grub_cv_asm_absolute_without_asterisk, -[cat > conftest.s <<\EOF - lcall *(offset) -offset: - .long 0 - .word 0 -EOF - -if AC_TRY_COMMAND([${CC-cc} ${CFLAGS} -c conftest.s]) && test -s conftest.o; then - grub_cv_asm_absolute_without_asterisk=no -else - grub_cv_asm_absolute_without_asterisk=yes -fi - -rm -f conftest*]) - -if test "x$grub_cv_asm_absolute_without_asterisk" = xyes; then - AC_DEFINE(ABSOLUTE_WITHOUT_ASTERISK, 1, [Define if an absolute indirect call/jump must NOT be prefixed with `*']) -fi - -AC_MSG_RESULT([$grub_cv_asm_absolute_without_asterisk])]) - -dnl -dnl grub_CHECK_START_SYMBOL checks if start is automatically defined by -dnl the compiler. -dnl Written by OKUJI Yoshinori -AC_DEFUN([grub_CHECK_START_SYMBOL], -[AC_REQUIRE([AC_PROG_CC]) -AC_MSG_CHECKING([if start is defined by the compiler]) -AC_CACHE_VAL(grub_cv_check_start_symbol, -[AC_TRY_LINK([], [asm ("incl start")], - grub_cv_check_start_symbol=yes, - grub_cv_check_start_symbol=no)]) - -if test "x$grub_cv_check_start_symbol" = xyes; then - AC_DEFINE(HAVE_START_SYMBOL, 1, [Define if start is defined]) -fi - -AC_MSG_RESULT([$grub_cv_check_start_symbol]) -]) - -dnl -dnl grub_CHECK_USCORE_START_SYMBOL checks if _start is automatically -dnl defined by the compiler. -dnl Written by OKUJI Yoshinori -AC_DEFUN([grub_CHECK_USCORE_START_SYMBOL], -[AC_REQUIRE([AC_PROG_CC]) -AC_MSG_CHECKING([if _start is defined by the compiler]) -AC_CACHE_VAL(grub_cv_check_uscore_start_symbol, -[AC_TRY_LINK([], [asm ("incl _start")], - grub_cv_check_uscore_start_symbol=yes, - grub_cv_check_uscore_start_symbol=no)]) - -if test "x$grub_cv_check_uscore_start_symbol" = xyes; then - AC_DEFINE(HAVE_USCORE_START_SYMBOL, 1, [Define if _start is defined]) -fi - -AC_MSG_RESULT([$grub_cv_check_uscore_start_symbol]) -]) - -dnl -dnl grub_CHECK_USCORE_USCORE_BSS_START_SYMBOL checks if __bss_start is -dnl automatically defined by the compiler. -dnl Written by Michael Hohmoth. -AC_DEFUN([grub_CHECK_USCORE_USCORE_BSS_START_SYMBOL], -[AC_REQUIRE([AC_PROG_CC]) -AC_MSG_CHECKING([if __bss_start is defined by the compiler]) -AC_CACHE_VAL(grub_cv_check_uscore_uscore_bss_start_symbol, -[AC_TRY_LINK([], [asm ("incl __bss_start")], - grub_cv_check_uscore_uscore_bss_start_symbol=yes, - grub_cv_check_uscore_uscore_bss_start_symbol=no)]) - -if test "x$grub_cv_check_uscore_uscore_bss_start_symbol" = xyes; then - AC_DEFINE(HAVE_USCORE_USCORE_BSS_START_SYMBOL, 1, [Define if __bss_start is defined]) -fi - -AC_MSG_RESULT([$grub_cv_check_uscore_uscore_bss_start_symbol]) -]) - -dnl -dnl grub_CHECK_EDATA_SYMBOL checks if edata is automatically defined by the -dnl compiler. -dnl Written by Michael Hohmuth. -AC_DEFUN([grub_CHECK_EDATA_SYMBOL], -[AC_REQUIRE([AC_PROG_CC]) -AC_MSG_CHECKING([if edata is defined by the compiler]) -AC_CACHE_VAL(grub_cv_check_edata_symbol, -[AC_TRY_LINK([], [asm ("incl edata")], - grub_cv_check_edata_symbol=yes, - grub_cv_check_edata_symbol=no)]) - -if test "x$grub_cv_check_edata_symbol" = xyes; then - AC_DEFINE(HAVE_EDATA_SYMBOL, 1, [Define if edata is defined]) -fi - -AC_MSG_RESULT([$grub_cv_check_edata_symbol]) -]) - -dnl -dnl grub_CHECK_USCORE_EDATA_SYMBOL checks if _edata is automatically -dnl defined by the compiler. -dnl Written by Michael Hohmuth. -AC_DEFUN([grub_CHECK_USCORE_EDATA_SYMBOL], -[AC_REQUIRE([AC_PROG_CC]) -AC_MSG_CHECKING([if _edata is defined by the compiler]) -AC_CACHE_VAL(grub_cv_check_uscore_edata_symbol, -[AC_TRY_LINK([], [asm ("incl _edata")], - grub_cv_check_uscore_edata_symbol=yes, - grub_cv_check_uscore_edata_symbol=no)]) - -if test "x$grub_cv_check_uscore_edata_symbol" = xyes; then - AC_DEFINE(HAVE_USCORE_EDATA_SYMBOL, 1, [Define if _edata is defined]) -fi - -AC_MSG_RESULT([$grub_cv_check_uscore_edata_symbol]) -]) - -dnl -dnl grub_CHECK_END_SYMBOL checks if end is automatically defined by the -dnl compiler. -dnl Written by OKUJI Yoshinori -AC_DEFUN([grub_CHECK_END_SYMBOL], -[AC_REQUIRE([AC_PROG_CC]) -AC_MSG_CHECKING([if end is defined by the compiler]) -AC_CACHE_VAL(grub_cv_check_end_symbol, -[AC_TRY_LINK([], [asm ("incl end")], - grub_cv_check_end_symbol=yes, - grub_cv_check_end_symbol=no)]) - -if test "x$grub_cv_check_end_symbol" = xyes; then - AC_DEFINE(HAVE_END_SYMBOL, 1, [Define if end is defined]) -fi - -AC_MSG_RESULT([$grub_cv_check_end_symbol]) -]) - -dnl -dnl grub_CHECK_USCORE_END_SYMBOL checks if _end is automatically defined -dnl by the compiler. -dnl Written by OKUJI Yoshinori -AC_DEFUN([grub_CHECK_USCORE_END_SYMBOL], -[AC_REQUIRE([AC_PROG_CC]) -AC_MSG_CHECKING([if _end is defined by the compiler]) -AC_CACHE_VAL(grub_cv_check_uscore_end_symbol, -[AC_TRY_LINK([], [asm ("incl _end")], - grub_cv_check_uscore_end_symbol=yes, - grub_cv_check_uscore_end_symbol=no)]) - -if test "x$grub_cv_check_uscore_end_symbol" = xyes; then - AC_DEFINE(HAVE_USCORE_END_SYMBOL, 1, [Define if end is defined]) -fi - -AC_MSG_RESULT([$grub_cv_check_uscore_end_symbol]) -]) - -dnl grub_DEFINE_FILE(MACRO_NAME, FILE_NAME, DESCRIPTION) -dnl grub_DEFINE_FILE defines a macro as the contents of a file safely. -dnl Replace some escape sequences, because autoconf doesn't handle them -dnl gracefully. -dnl Written by OKUJI Yoshinori. -AC_DEFUN([grub_DEFINE_FILE], -[AC_REQUIRE([AC_PROG_CC]) -# Because early versions of GNU sed 3.x are too buggy, use a C program -# instead of shell commands. *sigh* -cat >conftest.c <<\EOF -#include - -int -main (void) -{ - int c; - - while ((c = getchar ()) != EOF) - { - switch (c) - { - case '\n': - fputs ("\\n", stdout); - break; - case '\r': - fputs ("\\r", stdout); - break; - case '\\': - fputs ("\\\\", stdout); - break; - case '"': - fputs ("\\\"", stdout); - break; - default: - putchar (c); - } - } - - return 0; -} -EOF - -if AC_TRY_COMMAND([${CC-cc} ${CFLAGS} conftest.c -o conftest]) && test -s conftest; then - grub_tmp_value=`./conftest < "[$2]"` -else - AC_MSG_ERROR([${CC-cc} failed to produce an executable file]) -fi - -AC_DEFINE_UNQUOTED([$1], "$grub_tmp_value", [$3]) -rm -f conftest* -]) diff --git a/usr/src/grub/grub-0.95/aclocal.m4 b/usr/src/grub/grub-0.95/aclocal.m4 deleted file mode 100644 index c2245d86da..0000000000 --- a/usr/src/grub/grub-0.95/aclocal.m4 +++ /dev/null @@ -1,934 +0,0 @@ -# generated automatically by aclocal 1.8.2 -*- Autoconf -*- - -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 -# Free Software Foundation, Inc. -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -# -*- Autoconf -*- -# Copyright (C) 2002, 2003 Free Software Foundation, Inc. -# Generated from amversion.in; do not edit by hand. - -# 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. - -# 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 - -# AM_AUTOMAKE_VERSION(VERSION) -# ---------------------------- -# Automake X.Y traces this macro to ensure aclocal.m4 has been -# generated from the m4 files accompanying Automake X.Y. -AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.8"]) - -# AM_SET_CURRENT_AUTOMAKE_VERSION -# ------------------------------- -# Call AM_AUTOMAKE_VERSION so it can be traced. -# This function is AC_REQUIREd by AC_INIT_AUTOMAKE. -AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], - [AM_AUTOMAKE_VERSION([1.8.2])]) - -# AM_AUX_DIR_EXPAND - -# Copyright (C) 2001, 2003 Free Software Foundation, 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, 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. - -# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets -# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to -# `$srcdir', `$srcdir/..', or `$srcdir/../..'. -# -# Of course, Automake must honor this variable whenever it calls a -# tool from the auxiliary directory. The problem is that $srcdir (and -# therefore $ac_aux_dir as well) can be either absolute or relative, -# depending on how configure is run. This is pretty annoying, since -# it makes $ac_aux_dir quite unusable in subdirectories: in the top -# source directory, any form will work fine, but in subdirectories a -# relative path needs to be adjusted first. -# -# $ac_aux_dir/missing -# fails when called from a subdirectory if $ac_aux_dir is relative -# $top_srcdir/$ac_aux_dir/missing -# fails if $ac_aux_dir is absolute, -# fails when called from a subdirectory in a VPATH build with -# a relative $ac_aux_dir -# -# The reason of the latter failure is that $top_srcdir and $ac_aux_dir -# are both prefixed by $srcdir. In an in-source build this is usually -# harmless because $srcdir is `.', but things will broke when you -# start a VPATH build or use an absolute $srcdir. -# -# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, -# iff we strip the leading $srcdir from $ac_aux_dir. That would be: -# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` -# and then we would define $MISSING as -# MISSING="\${SHELL} $am_aux_dir/missing" -# This will work as long as MISSING is not called from configure, because -# unfortunately $(top_srcdir) has no meaning in configure. -# However there are other variables, like CC, which are often used in -# configure, and could therefore not use this "fixed" $ac_aux_dir. -# -# Another solution, used here, is to always expand $ac_aux_dir to an -# absolute PATH. The drawback is that using absolute paths prevent a -# configured tree to be moved without reconfiguration. - -AC_DEFUN([AM_AUX_DIR_EXPAND], -[dnl Rely on autoconf to set up CDPATH properly. -AC_PREREQ([2.50])dnl -# expand $ac_aux_dir to an absolute path -am_aux_dir=`cd $ac_aux_dir && pwd` -]) - -# AM_CONDITIONAL -*- Autoconf -*- - -# Copyright (C) 1997, 2000, 2001, 2003 Free Software Foundation, 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, 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. - -# serial 6 - -# AM_CONDITIONAL(NAME, SHELL-CONDITION) -# ------------------------------------- -# Define a conditional. -AC_DEFUN([AM_CONDITIONAL], -[AC_PREREQ(2.52)dnl - ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], - [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl -AC_SUBST([$1_TRUE]) -AC_SUBST([$1_FALSE]) -if $2; then - $1_TRUE= - $1_FALSE='#' -else - $1_TRUE='#' - $1_FALSE= -fi -AC_CONFIG_COMMANDS_PRE( -[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then - AC_MSG_ERROR([conditional "$1" was never defined. -Usually this means the macro was only invoked conditionally.]) -fi])]) - -# serial 6 -*- Autoconf -*- - -# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 -# Free Software Foundation, 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, 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. - - -# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be -# written in clear, in which case automake, when reading aclocal.m4, -# will think it sees a *use*, and therefore will trigger all it's -# C support machinery. Also note that it means that autoscan, seeing -# CC etc. in the Makefile, will ask for an AC_PROG_CC use... - - - -# _AM_DEPENDENCIES(NAME) -# ---------------------- -# See how the compiler implements dependency checking. -# NAME is "CC", "CXX", "GCJ", or "OBJC". -# We try a few techniques and use that to set a single cache variable. -# -# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was -# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular -# dependency, and given that the user is not expected to run this macro, -# just rely on AC_PROG_CC. -AC_DEFUN([_AM_DEPENDENCIES], -[AC_REQUIRE([AM_SET_DEPDIR])dnl -AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl -AC_REQUIRE([AM_MAKE_INCLUDE])dnl -AC_REQUIRE([AM_DEP_TRACK])dnl - -ifelse([$1], CC, [depcc="$CC" am_compiler_list=], - [$1], CXX, [depcc="$CXX" am_compiler_list=], - [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], - [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], - [depcc="$$1" am_compiler_list=]) - -AC_CACHE_CHECK([dependency style of $depcc], - [am_cv_$1_dependencies_compiler_type], -[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then - # We make a subdir and do the tests there. Otherwise we can end up - # making bogus files that we don't know about and never remove. For - # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named `D' -- because `-MD' means `put the output - # in D'. - mkdir conftest.dir - # Copy depcomp to subdir because otherwise we won't find it if we're - # using a relative directory. - cp "$am_depcomp" conftest.dir - cd conftest.dir - # We will build objects and dependencies in a subdirectory because - # it helps to detect inapplicable dependency modes. For instance - # both Tru64's cc and ICC support -MD to output dependencies as a - # side effect of compilation, but ICC will put the dependencies in - # the current directory while Tru64 will put them in the object - # directory. - mkdir sub - - am_cv_$1_dependencies_compiler_type=none - if test "$am_compiler_list" = ""; then - am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` - fi - for depmode in $am_compiler_list; do - # Setup a source with many dependencies, because some compilers - # like to wrap large dependency lists on column 80 (with \), and - # we should not choose a depcomp mode which is confused by this. - # - # We need to recreate these files for each test, as the compiler may - # overwrite some of them when testing with obscure command lines. - # This happens at least with the AIX C compiler. - : > sub/conftest.c - for i in 1 2 3 4 5 6; do - echo '#include "conftst'$i'.h"' >> sub/conftest.c - : > sub/conftst$i.h - done - echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - - case $depmode in - nosideeffect) - # after this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested - if test "x$enable_dependency_tracking" = xyes; then - continue - else - break - fi - ;; - none) break ;; - esac - # We check with `-c' and `-o' for the sake of the "dashmstdout" - # mode. It turns out that the SunPro C++ compiler does not properly - # handle `-M -o', and we need to detect this. - if depmode=$depmode \ - source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ - depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ - $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ - >/dev/null 2>conftest.err && - grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && - ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - # icc doesn't choke on unknown options, it will just issue warnings - # (even with -Werror). So we grep stderr for any message - # that says an option was ignored. - if grep 'ignoring option' conftest.err >/dev/null 2>&1; then :; else - am_cv_$1_dependencies_compiler_type=$depmode - break - fi - fi - done - - cd .. - rm -rf conftest.dir -else - am_cv_$1_dependencies_compiler_type=none -fi -]) -AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) -AM_CONDITIONAL([am__fastdep$1], [ - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) -]) - - -# AM_SET_DEPDIR -# ------------- -# Choose a directory name for dependency files. -# This macro is AC_REQUIREd in _AM_DEPENDENCIES -AC_DEFUN([AM_SET_DEPDIR], -[AC_REQUIRE([AM_SET_LEADING_DOT])dnl -AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl -]) - - -# AM_DEP_TRACK -# ------------ -AC_DEFUN([AM_DEP_TRACK], -[AC_ARG_ENABLE(dependency-tracking, -[ --disable-dependency-tracking speeds up one-time build - --enable-dependency-tracking do not reject slow dependency extractors]) -if test "x$enable_dependency_tracking" != xno; then - am_depcomp="$ac_aux_dir/depcomp" - AMDEPBACKSLASH='\' -fi -AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) -AC_SUBST([AMDEPBACKSLASH]) -]) - -# Generate code to set up dependency tracking. -*- Autoconf -*- - -# Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, 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, 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. - -#serial 2 - -# _AM_OUTPUT_DEPENDENCY_COMMANDS -# ------------------------------ -AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], -[for mf in $CONFIG_FILES; do - # Strip MF so we end up with the name of the file. - mf=`echo "$mf" | sed -e 's/:.*$//'` - # Check whether this is an Automake generated Makefile or not. - # We used to match only the files named `Makefile.in', but - # some people rename them; so instead we look at the file content. - # Grep'ing the first line is not enough: some people post-process - # each Makefile.in and add a new line on top of each file to say so. - # So let's grep whole file. - if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then - dirpart=`AS_DIRNAME("$mf")` - else - continue - fi - grep '^DEP_FILES *= *[[^ @%:@]]' < "$mf" > /dev/null || continue - # Extract the definition of DEP_FILES from the Makefile without - # running `make'. - DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"` - test -z "$DEPDIR" && continue - # When using ansi2knr, U may be empty or an underscore; expand it - U=`sed -n -e '/^U = / s///p' < "$mf"` - test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR" - # We invoke sed twice because it is the simplest approach to - # changing $(DEPDIR) to its actual value in the expansion. - for file in `sed -n -e ' - /^DEP_FILES = .*\\\\$/ { - s/^DEP_FILES = // - :loop - s/\\\\$// - p - n - /\\\\$/ b loop - p - } - /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do - # Make sure the directory exists. - test -f "$dirpart/$file" && continue - fdir=`AS_DIRNAME(["$file"])` - AS_MKDIR_P([$dirpart/$fdir]) - # echo "creating $dirpart/$file" - echo '# dummy' > "$dirpart/$file" - done -done -])# _AM_OUTPUT_DEPENDENCY_COMMANDS - - -# AM_OUTPUT_DEPENDENCY_COMMANDS -# ----------------------------- -# This macro should only be invoked once -- use via AC_REQUIRE. -# -# This code is only required when automatic dependency tracking -# is enabled. FIXME. This creates each `.P' file that we will -# need in order to bootstrap the dependency handling code. -AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], -[AC_CONFIG_COMMANDS([depfiles], - [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], - [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) -]) - -# Do all the work for Automake. -*- Autoconf -*- - -# This macro actually does too much some checks are only needed if -# your package does certain things. But this isn't really a big deal. - -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 -# Free Software Foundation, 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, 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. - -# serial 11 - -# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) -# AM_INIT_AUTOMAKE([OPTIONS]) -# ----------------------------------------------- -# The call with PACKAGE and VERSION arguments is the old style -# call (pre autoconf-2.50), which is being phased out. PACKAGE -# and VERSION should now be passed to AC_INIT and removed from -# the call to AM_INIT_AUTOMAKE. -# We support both call styles for the transition. After -# the next Automake release, Autoconf can make the AC_INIT -# arguments mandatory, and then we can depend on a new Autoconf -# release and drop the old call support. -AC_DEFUN([AM_INIT_AUTOMAKE], -[AC_PREREQ([2.58])dnl -dnl Autoconf wants to disallow AM_ names. We explicitly allow -dnl the ones we care about. -m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl -AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl -AC_REQUIRE([AC_PROG_INSTALL])dnl -# test to see if srcdir already configured -if test "`cd $srcdir && pwd`" != "`pwd`" && - test -f $srcdir/config.status; then - AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) -fi - -# test whether we have cygpath -if test -z "$CYGPATH_W"; then - if (cygpath --version) >/dev/null 2>/dev/null; then - CYGPATH_W='cygpath -w' - else - CYGPATH_W=echo - fi -fi -AC_SUBST([CYGPATH_W]) - -# Define the identity of the package. -dnl Distinguish between old-style and new-style calls. -m4_ifval([$2], -[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl - AC_SUBST([PACKAGE], [$1])dnl - AC_SUBST([VERSION], [$2])], -[_AM_SET_OPTIONS([$1])dnl - AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl - AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl - -_AM_IF_OPTION([no-define],, -[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) - AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl - -# Some tools Automake needs. -AC_REQUIRE([AM_SANITY_CHECK])dnl -AC_REQUIRE([AC_ARG_PROGRAM])dnl -AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) -AM_MISSING_PROG(AUTOCONF, autoconf) -AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) -AM_MISSING_PROG(AUTOHEADER, autoheader) -AM_MISSING_PROG(MAKEINFO, makeinfo) -AM_MISSING_PROG(AMTAR, tar) -AM_PROG_INSTALL_SH -AM_PROG_INSTALL_STRIP -AC_REQUIRE([AM_PROG_MKDIR_P])dnl -# We need awk for the "check" target. The system "awk" is bad on -# some platforms. -AC_REQUIRE([AC_PROG_AWK])dnl -AC_REQUIRE([AC_PROG_MAKE_SET])dnl -AC_REQUIRE([AM_SET_LEADING_DOT])dnl - -_AM_IF_OPTION([no-dependencies],, -[AC_PROVIDE_IFELSE([AC_PROG_CC], - [_AM_DEPENDENCIES(CC)], - [define([AC_PROG_CC], - defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl -AC_PROVIDE_IFELSE([AC_PROG_CXX], - [_AM_DEPENDENCIES(CXX)], - [define([AC_PROG_CXX], - defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl -]) -]) - - -# When config.status generates a header, we must update the stamp-h file. -# This file resides in the same directory as the config header -# that is generated. The stamp files are numbered to have different names. - -# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the -# loop where config.status creates the headers, so we can generate -# our stamp files there. -AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], -[# Compute $1's index in $config_headers. -_am_stamp_count=1 -for _am_header in $config_headers :; do - case $_am_header in - $1 | $1:* ) - break ;; - * ) - _am_stamp_count=`expr $_am_stamp_count + 1` ;; - esac -done -echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count]) - -# AM_PROG_INSTALL_SH -# ------------------ -# Define $install_sh. - -# Copyright (C) 2001, 2003 Free Software Foundation, 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, 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. - -AC_DEFUN([AM_PROG_INSTALL_SH], -[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl -install_sh=${install_sh-"$am_aux_dir/install-sh"} -AC_SUBST(install_sh)]) - -# -*- Autoconf -*- -# Copyright (C) 2003 Free Software Foundation, 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, 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. - -# serial 1 - -# Check whether the underlying file-system supports filenames -# with a leading dot. For instance MS-DOS doesn't. -AC_DEFUN([AM_SET_LEADING_DOT], -[rm -rf .tst 2>/dev/null -mkdir .tst 2>/dev/null -if test -d .tst; then - am__leading_dot=. -else - am__leading_dot=_ -fi -rmdir .tst 2>/dev/null -AC_SUBST([am__leading_dot])]) - -# Add --enable-maintainer-mode option to configure. -# From Jim Meyering - -# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004 -# Free Software Foundation, 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, 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. - -# serial 3 - -AC_DEFUN([AM_MAINTAINER_MODE], -[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) - dnl maintainer-mode is disabled by default - AC_ARG_ENABLE(maintainer-mode, -[ --enable-maintainer-mode enable make rules and dependencies not useful - (and sometimes confusing) to the casual installer], - USE_MAINTAINER_MODE=$enableval, - USE_MAINTAINER_MODE=no) - AC_MSG_RESULT([$USE_MAINTAINER_MODE]) - AM_CONDITIONAL(MAINTAINER_MODE, [test $USE_MAINTAINER_MODE = yes]) - MAINT=$MAINTAINER_MODE_TRUE - AC_SUBST(MAINT)dnl -] -) - -AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE]) - -# Check to see how 'make' treats includes. -*- Autoconf -*- - -# Copyright (C) 2001, 2002, 2003 Free Software Foundation, 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, 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. - -# serial 2 - -# AM_MAKE_INCLUDE() -# ----------------- -# Check to see how make treats includes. -AC_DEFUN([AM_MAKE_INCLUDE], -[am_make=${MAKE-make} -cat > confinc << 'END' -am__doit: - @echo done -.PHONY: am__doit -END -# If we don't find an include directive, just comment out the code. -AC_MSG_CHECKING([for style of include used by $am_make]) -am__include="#" -am__quote= -_am_result=none -# First try GNU make style include. -echo "include confinc" > confmf -# We grep out `Entering directory' and `Leaving directory' -# messages which can occur if `w' ends up in MAKEFLAGS. -# In particular we don't look at `^make:' because GNU make might -# be invoked under some other name (usually "gmake"), in which -# case it prints its new name instead of `make'. -if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then - am__include=include - am__quote= - _am_result=GNU -fi -# Now try BSD make style include. -if test "$am__include" = "#"; then - echo '.include "confinc"' > confmf - if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then - am__include=.include - am__quote="\"" - _am_result=BSD - fi -fi -AC_SUBST([am__include]) -AC_SUBST([am__quote]) -AC_MSG_RESULT([$_am_result]) -rm -f confinc confmf -]) - -# -*- Autoconf -*- - - -# Copyright (C) 1997, 1999, 2000, 2001, 2003 Free Software Foundation, 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, 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. - -# serial 3 - -# AM_MISSING_PROG(NAME, PROGRAM) -# ------------------------------ -AC_DEFUN([AM_MISSING_PROG], -[AC_REQUIRE([AM_MISSING_HAS_RUN]) -$1=${$1-"${am_missing_run}$2"} -AC_SUBST($1)]) - - -# AM_MISSING_HAS_RUN -# ------------------ -# Define MISSING if not defined so far and test if it supports --run. -# If it does, set am_missing_run to use it, otherwise, to nothing. -AC_DEFUN([AM_MISSING_HAS_RUN], -[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl -test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" -# Use eval to expand $SHELL -if eval "$MISSING --run true"; then - am_missing_run="$MISSING --run " -else - am_missing_run= - AC_MSG_WARN([`missing' script is too old or missing]) -fi -]) - -# AM_PROG_MKDIR_P -# --------------- -# Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise. - -# Copyright (C) 2003, 2004 Free Software Foundation, 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, 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. - -# Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories -# created by `make install' are always world readable, even if the -# installer happens to have an overly restrictive umask (e.g. 077). -# This was a mistake. There are at least two reasons why we must not -# use `-m 0755': -# - it causes special bits like SGID to be ignored, -# - it may be too restrictive (some setups expect 775 directories). -# -# Do not use -m 0755 and let people choose whatever they expect by -# setting umask. -AC_DEFUN([AM_PROG_MKDIR_P], -[if mkdir -p -- . 2>/dev/null; then - # Keeping the `.' argument allows $(mkdir_p) to be used without - # argument. Indeed, we sometimes output rules like - # $(mkdir_p) $(somedir) - # where $(somedir) is conditionally defined. - # (`test -n '$(somedir)' && $(mkdir_p) $(somedir)' is a more - # expensive solution, as it forces Make to start a sub-shell.) - mkdir_p='mkdir -p -- .' -else - # On NextStep and OpenStep, the `mkdir' command does not - # recognize any option. It will interpret all options as - # directories to create, and then abort because `.' already - # exists. - for d in ./-p ./--; - do - test -d $d && rmdir $d - done - # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. - if test -f "$ac_aux_dir/mkinstalldirs"; then - mkdir_p='$(mkinstalldirs)' - else - mkdir_p='$(install_sh) -d' - fi -fi -AC_SUBST([mkdir_p])]) - -# Helper functions for option handling. -*- Autoconf -*- - -# Copyright (C) 2001, 2002, 2003 Free Software Foundation, 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, 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. - -# serial 2 - -# _AM_MANGLE_OPTION(NAME) -# ----------------------- -AC_DEFUN([_AM_MANGLE_OPTION], -[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) - -# _AM_SET_OPTION(NAME) -# ------------------------------ -# Set option NAME. Presently that only means defining a flag for this option. -AC_DEFUN([_AM_SET_OPTION], -[m4_define(_AM_MANGLE_OPTION([$1]), 1)]) - -# _AM_SET_OPTIONS(OPTIONS) -# ---------------------------------- -# OPTIONS is a space-separated list of Automake options. -AC_DEFUN([_AM_SET_OPTIONS], -[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) - -# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) -# ------------------------------------------- -# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. -AC_DEFUN([_AM_IF_OPTION], -[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) - -# -# Check to make sure that the build environment is sane. -# - -# Copyright (C) 1996, 1997, 2000, 2001, 2003 Free Software Foundation, 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, 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. - -# serial 3 - -# AM_SANITY_CHECK -# --------------- -AC_DEFUN([AM_SANITY_CHECK], -[AC_MSG_CHECKING([whether build environment is sane]) -# Just in case -sleep 1 -echo timestamp > conftest.file -# Do `set' in a subshell so we don't clobber the current shell's -# arguments. Must try -L first in case configure is actually a -# symlink; some systems play weird games with the mod time of symlinks -# (eg FreeBSD returns the mod time of the symlink's containing -# directory). -if ( - set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` - if test "$[*]" = "X"; then - # -L didn't work. - set X `ls -t $srcdir/configure conftest.file` - fi - rm -f conftest.file - if test "$[*]" != "X $srcdir/configure conftest.file" \ - && test "$[*]" != "X conftest.file $srcdir/configure"; then - - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken -alias in your environment]) - fi - - test "$[2]" = conftest.file - ) -then - # Ok. - : -else - AC_MSG_ERROR([newly created file is older than distributed files! -Check your system clock]) -fi -AC_MSG_RESULT(yes)]) - -# AM_PROG_INSTALL_STRIP - -# Copyright (C) 2001, 2003 Free Software Foundation, 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, 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. - -# One issue with vendor `install' (even GNU) is that you can't -# specify the program used to strip binaries. This is especially -# annoying in cross-compiling environments, where the build's strip -# is unlikely to handle the host's binaries. -# Fortunately install-sh will honor a STRIPPROG variable, so we -# always use install-sh in `make install-strip', and initialize -# STRIPPROG with the value of the STRIP variable (set by the user). -AC_DEFUN([AM_PROG_INSTALL_STRIP], -[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl -# Installed binaries are usually stripped using `strip' when the user -# run `make install-strip'. However `strip' might not be the right -# tool to use in cross-compilation environments, therefore Automake -# will honor the `STRIP' environment variable to overrule this program. -dnl Don't test for $cross_compiling = yes, because it might be `maybe'. -if test "$cross_compiling" != no; then - AC_CHECK_TOOL([STRIP], [strip], :) -fi -INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" -AC_SUBST([INSTALL_STRIP_PROGRAM])]) - -m4_include([acinclude.m4]) diff --git a/usr/src/grub/grub-0.95/compile b/usr/src/grub/grub-0.95/compile deleted file mode 100755 index a81e000ae1..0000000000 --- a/usr/src/grub/grub-0.95/compile +++ /dev/null @@ -1,136 +0,0 @@ -#! /bin/sh -# Wrapper for compilers which do not understand `-c -o'. - -scriptversion=2003-11-09.00 - -# Copyright (C) 1999, 2000, 2003 Free Software Foundation, Inc. -# Written by Tom Tromey . -# -# 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. -# -# 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. - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# This file is maintained in Automake, please report -# bugs to or send patches to -# . - -case $1 in - '') - echo "$0: No command. Try \`$0 --help' for more information." 1>&2 - exit 1; - ;; - -h | --h*) - cat <<\EOF -Usage: compile [--help] [--version] PROGRAM [ARGS] - -Wrapper for compilers which do not understand `-c -o'. -Remove `-o dest.o' from ARGS, run PROGRAM with the remaining -arguments, and rename the output as expected. - -If you are trying to build a whole package this is not the -right script to run: please start by reading the file `INSTALL'. - -Report bugs to . -EOF - exit 0 - ;; - -v | --v*) - echo "compile $scriptversion" - exit 0 - ;; -esac - - -prog=$1 -shift - -ofile= -cfile= -args= -while test $# -gt 0; do - case "$1" in - -o) - # configure might choose to run compile as `compile cc -o foo foo.c'. - # So we do something ugly here. - ofile=$2 - shift - case "$ofile" in - *.o | *.obj) - ;; - *) - args="$args -o $ofile" - ofile= - ;; - esac - ;; - *.c) - cfile=$1 - args="$args $1" - ;; - *) - args="$args $1" - ;; - esac - shift -done - -if test -z "$ofile" || test -z "$cfile"; then - # If no `-o' option was seen then we might have been invoked from a - # pattern rule where we don't need one. That is ok -- this is a - # normal compilation that the losing compiler can handle. If no - # `.c' file was seen then we are probably linking. That is also - # ok. - exec "$prog" $args -fi - -# Name of file we expect compiler to create. -cofile=`echo $cfile | sed -e 's|^.*/||' -e 's/\.c$/.o/'` - -# Create the lock directory. -# Note: use `[/.-]' here to ensure that we don't use the same name -# that we are using for the .o file. Also, base the name on the expected -# object file name, since that is what matters with a parallel build. -lockdir=`echo $cofile | sed -e 's|[/.-]|_|g'`.d -while true; do - if mkdir $lockdir > /dev/null 2>&1; then - break - fi - sleep 1 -done -# FIXME: race condition here if user kills between mkdir and trap. -trap "rmdir $lockdir; exit 1" 1 2 15 - -# Run the compile. -"$prog" $args -status=$? - -if test -f "$cofile"; then - mv "$cofile" "$ofile" -fi - -rmdir $lockdir -exit $status - -# Local Variables: -# mode: shell-script -# sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-end: "$" -# End: diff --git a/usr/src/grub/grub-0.95/config.guess b/usr/src/grub/grub-0.95/config.guess deleted file mode 100755 index e8c6fc0c33..0000000000 --- a/usr/src/grub/grub-0.95/config.guess +++ /dev/null @@ -1,1432 +0,0 @@ -#! /bin/sh -# Attempt to guess a canonical system name. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003 Free Software Foundation, Inc. - -timestamp='2004-01-05' - -# This file 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. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# Originally written by Per Bothner . -# Please send patches to . Submit a context -# diff and a properly formatted ChangeLog entry. -# -# This script attempts to guess a canonical system name similar to -# config.sub. If it succeeds, it prints the system name on stdout, and -# exits with 0. Otherwise, it exits with 1. -# -# The plan is that this can be called by configure scripts if you -# don't specify an explicit build system type. - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] - -Output the configuration name of the system \`$me' is run on. - -Operation modes: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to ." - -version="\ -GNU config.guess ($timestamp) - -Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 -Free Software Foundation, Inc. - -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try \`$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit 0 ;; - --version | -v ) - echo "$version" ; exit 0 ;; - --help | --h* | -h ) - echo "$usage"; exit 0 ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" >&2 - exit 1 ;; - * ) - break ;; - esac -done - -if test $# != 0; then - echo "$me: too many arguments$help" >&2 - exit 1 -fi - -trap 'exit 1' 1 2 15 - -# CC_FOR_BUILD -- compiler used by this script. Note that the use of a -# compiler to aid in system detection is discouraged as it requires -# temporary files to be created and, as you can see below, it is a -# headache to deal with in a portable fashion. - -# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still -# use `HOST_CC' if defined, but it is deprecated. - -# Portable tmp directory creation inspired by the Autoconf team. - -set_cc_for_build=' -trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; -trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; -: ${TMPDIR=/tmp} ; - { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || - { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || - { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || - { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; -dummy=$tmp/dummy ; -tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; -case $CC_FOR_BUILD,$HOST_CC,$CC in - ,,) echo "int x;" > $dummy.c ; - for c in cc gcc c89 c99 ; do - if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then - CC_FOR_BUILD="$c"; break ; - fi ; - done ; - if test x"$CC_FOR_BUILD" = x ; then - CC_FOR_BUILD=no_compiler_found ; - fi - ;; - ,,*) CC_FOR_BUILD=$CC ;; - ,*,*) CC_FOR_BUILD=$HOST_CC ;; -esac ;' - -# This is needed to find uname on a Pyramid OSx when run in the BSD universe. -# (ghazi@noc.rutgers.edu 1994-08-24) -if (test -f /.attbin/uname) >/dev/null 2>&1 ; then - PATH=$PATH:/.attbin ; export PATH -fi - -UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown -UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown -UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown -UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown - -# Note: order is significant - the case branches are not exclusive. - -case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in - *:NetBSD:*:*) - # NetBSD (nbsd) targets should (where applicable) match one or - # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, - # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently - # switched to ELF, *-*-netbsd* would select the old - # object file format. This provides both forward - # compatibility and a consistent mechanism for selecting the - # object file format. - # - # Note: NetBSD doesn't particularly care about the vendor - # portion of the name. We always set it to "unknown". - sysctl="sysctl -n hw.machine_arch" - UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ - /usr/sbin/$sysctl 2>/dev/null || echo unknown)` - case "${UNAME_MACHINE_ARCH}" in - armeb) machine=armeb-unknown ;; - arm*) machine=arm-unknown ;; - sh3el) machine=shl-unknown ;; - sh3eb) machine=sh-unknown ;; - *) machine=${UNAME_MACHINE_ARCH}-unknown ;; - esac - # The Operating System including object format, if it has switched - # to ELF recently, or will in the future. - case "${UNAME_MACHINE_ARCH}" in - arm*|i386|m68k|ns32k|sh3*|sparc|vax) - eval $set_cc_for_build - if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep __ELF__ >/dev/null - then - # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). - # Return netbsd for either. FIX? - os=netbsd - else - os=netbsdelf - fi - ;; - *) - os=netbsd - ;; - esac - # The OS release - # Debian GNU/NetBSD machines have a different userland, and - # thus, need a distinct triplet. However, they do not need - # kernel version information, so it can be replaced with a - # suitable tag, in the style of linux-gnu. - case "${UNAME_VERSION}" in - Debian*) - release='-gnu' - ;; - *) - release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` - ;; - esac - # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: - # contains redundant information, the shorter form: - # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "${machine}-${os}${release}" - exit 0 ;; - amiga:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - arc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - hp300:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mac68k:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - macppc:OpenBSD:*:*) - echo powerpc-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvme68k:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvme88k:OpenBSD:*:*) - echo m88k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvmeppc:OpenBSD:*:*) - echo powerpc-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - pegasos:OpenBSD:*:*) - echo powerpc-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - pmax:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - sgi:OpenBSD:*:*) - echo mipseb-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - sun3:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - wgrisc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - *:OpenBSD:*:*) - echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - alpha:OSF1:*:*) - if test $UNAME_RELEASE = "V4.0"; then - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` - fi - # According to Compaq, /usr/sbin/psrinfo has been available on - # OSF/1 and Tru64 systems produced since 1995. I hope that - # covers most systems running today. This code pipes the CPU - # types through head -n 1, so we only detect the type of CPU 0. - ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` - case "$ALPHA_CPU_TYPE" in - "EV4 (21064)") - UNAME_MACHINE="alpha" ;; - "EV4.5 (21064)") - UNAME_MACHINE="alpha" ;; - "LCA4 (21066/21068)") - UNAME_MACHINE="alpha" ;; - "EV5 (21164)") - UNAME_MACHINE="alphaev5" ;; - "EV5.6 (21164A)") - UNAME_MACHINE="alphaev56" ;; - "EV5.6 (21164PC)") - UNAME_MACHINE="alphapca56" ;; - "EV5.7 (21164PC)") - UNAME_MACHINE="alphapca57" ;; - "EV6 (21264)") - UNAME_MACHINE="alphaev6" ;; - "EV6.7 (21264A)") - UNAME_MACHINE="alphaev67" ;; - "EV6.8CB (21264C)") - UNAME_MACHINE="alphaev68" ;; - "EV6.8AL (21264B)") - UNAME_MACHINE="alphaev68" ;; - "EV6.8CX (21264D)") - UNAME_MACHINE="alphaev68" ;; - "EV6.9A (21264/EV69A)") - UNAME_MACHINE="alphaev69" ;; - "EV7 (21364)") - UNAME_MACHINE="alphaev7" ;; - "EV7.9 (21364A)") - UNAME_MACHINE="alphaev79" ;; - esac - # A Vn.n version is a released version. - # A Tn.n version is a released field test version. - # A Xn.n version is an unreleased experimental baselevel. - # 1.2 uses "1.2" for uname -r. - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - exit 0 ;; - Alpha*:OpenVMS:*:*) - echo alpha-hp-vms - exit 0 ;; - Alpha\ *:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # Should we change UNAME_MACHINE based on the output of uname instead - # of the specific Alpha model? - echo alpha-pc-interix - exit 0 ;; - 21064:Windows_NT:50:3) - echo alpha-dec-winnt3.5 - exit 0 ;; - Amiga*:UNIX_System_V:4.0:*) - echo m68k-unknown-sysv4 - exit 0;; - *:[Aa]miga[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-amigaos - exit 0 ;; - *:[Mm]orph[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-morphos - exit 0 ;; - *:OS/390:*:*) - echo i370-ibm-openedition - exit 0 ;; - *:OS400:*:*) - echo powerpc-ibm-os400 - exit 0 ;; - arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) - echo arm-acorn-riscix${UNAME_RELEASE} - exit 0;; - SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) - echo hppa1.1-hitachi-hiuxmpp - exit 0;; - Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) - # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. - if test "`(/bin/universe) 2>/dev/null`" = att ; then - echo pyramid-pyramid-sysv3 - else - echo pyramid-pyramid-bsd - fi - exit 0 ;; - NILE*:*:*:dcosx) - echo pyramid-pyramid-svr4 - exit 0 ;; - DRS?6000:unix:4.0:6*) - echo sparc-icl-nx6 - exit 0 ;; - DRS?6000:UNIX_SV:4.2*:7*) - case `/usr/bin/uname -p` in - sparc) echo sparc-icl-nx7 && exit 0 ;; - esac ;; - sun4H:SunOS:5.*:*) - echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) - echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - i86pc:SunOS:5.*:*) - echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - sun4*:SunOS:6*:*) - # According to config.sub, this is the proper way to canonicalize - # SunOS6. Hard to guess exactly what SunOS6 will be like, but - # it's likely to be more like Solaris than SunOS4. - echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - sun4*:SunOS:*:*) - case "`/usr/bin/arch -k`" in - Series*|S4*) - UNAME_RELEASE=`uname -v` - ;; - esac - # Japanese Language versions have a version number like `4.1.3-JL'. - echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` - exit 0 ;; - sun3*:SunOS:*:*) - echo m68k-sun-sunos${UNAME_RELEASE} - exit 0 ;; - sun*:*:4.2BSD:*) - UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` - test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 - case "`/bin/arch`" in - sun3) - echo m68k-sun-sunos${UNAME_RELEASE} - ;; - sun4) - echo sparc-sun-sunos${UNAME_RELEASE} - ;; - esac - exit 0 ;; - aushp:SunOS:*:*) - echo sparc-auspex-sunos${UNAME_RELEASE} - exit 0 ;; - # The situation for MiNT is a little confusing. The machine name - # can be virtually everything (everything which is not - # "atarist" or "atariste" at least should have a processor - # > m68000). The system name ranges from "MiNT" over "FreeMiNT" - # to the lowercase version "mint" (or "freemint"). Finally - # the system name "TOS" denotes a system which is actually not - # MiNT. But MiNT is downward compatible to TOS, so this should - # be no problem. - atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; - atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; - *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; - milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) - echo m68k-milan-mint${UNAME_RELEASE} - exit 0 ;; - hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) - echo m68k-hades-mint${UNAME_RELEASE} - exit 0 ;; - *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) - echo m68k-unknown-mint${UNAME_RELEASE} - exit 0 ;; - powerpc:machten:*:*) - echo powerpc-apple-machten${UNAME_RELEASE} - exit 0 ;; - RISC*:Mach:*:*) - echo mips-dec-mach_bsd4.3 - exit 0 ;; - RISC*:ULTRIX:*:*) - echo mips-dec-ultrix${UNAME_RELEASE} - exit 0 ;; - VAX*:ULTRIX*:*:*) - echo vax-dec-ultrix${UNAME_RELEASE} - exit 0 ;; - 2020:CLIX:*:* | 2430:CLIX:*:*) - echo clipper-intergraph-clix${UNAME_RELEASE} - exit 0 ;; - mips:*:*:UMIPS | mips:*:*:RISCos) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c -#ifdef __cplusplus -#include /* for printf() prototype */ - int main (int argc, char *argv[]) { -#else - int main (argc, argv) int argc; char *argv[]; { -#endif - #if defined (host_mips) && defined (MIPSEB) - #if defined (SYSTYPE_SYSV) - printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_SVR4) - printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) - printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); - #endif - #endif - exit (-1); - } -EOF - $CC_FOR_BUILD -o $dummy $dummy.c \ - && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ - && exit 0 - echo mips-mips-riscos${UNAME_RELEASE} - exit 0 ;; - Motorola:PowerMAX_OS:*:*) - echo powerpc-motorola-powermax - exit 0 ;; - Motorola:*:4.3:PL8-*) - echo powerpc-harris-powermax - exit 0 ;; - Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) - echo powerpc-harris-powermax - exit 0 ;; - Night_Hawk:Power_UNIX:*:*) - echo powerpc-harris-powerunix - exit 0 ;; - m88k:CX/UX:7*:*) - echo m88k-harris-cxux7 - exit 0 ;; - m88k:*:4*:R4*) - echo m88k-motorola-sysv4 - exit 0 ;; - m88k:*:3*:R3*) - echo m88k-motorola-sysv3 - exit 0 ;; - AViiON:dgux:*:*) - # DG/UX returns AViiON for all architectures - UNAME_PROCESSOR=`/usr/bin/uname -p` - if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] - then - if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ - [ ${TARGET_BINARY_INTERFACE}x = x ] - then - echo m88k-dg-dgux${UNAME_RELEASE} - else - echo m88k-dg-dguxbcs${UNAME_RELEASE} - fi - else - echo i586-dg-dgux${UNAME_RELEASE} - fi - exit 0 ;; - M88*:DolphinOS:*:*) # DolphinOS (SVR3) - echo m88k-dolphin-sysv3 - exit 0 ;; - M88*:*:R3*:*) - # Delta 88k system running SVR3 - echo m88k-motorola-sysv3 - exit 0 ;; - XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) - echo m88k-tektronix-sysv3 - exit 0 ;; - Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) - echo m68k-tektronix-bsd - exit 0 ;; - *:IRIX*:*:*) - echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` - exit 0 ;; - ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. - echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id - exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' - i*86:AIX:*:*) - echo i386-ibm-aix - exit 0 ;; - ia64:AIX:*:*) - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} - exit 0 ;; - *:AIX:2:3) - if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - - main() - { - if (!__power_pc()) - exit(1); - puts("powerpc-ibm-aix3.2.5"); - exit(0); - } -EOF - $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 - echo rs6000-ibm-aix3.2.5 - elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then - echo rs6000-ibm-aix3.2.4 - else - echo rs6000-ibm-aix3.2 - fi - exit 0 ;; - *:AIX:*:[45]) - IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` - if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then - IBM_ARCH=rs6000 - else - IBM_ARCH=powerpc - fi - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${IBM_ARCH}-ibm-aix${IBM_REV} - exit 0 ;; - *:AIX:*:*) - echo rs6000-ibm-aix - exit 0 ;; - ibmrt:4.4BSD:*|romp-ibm:BSD:*) - echo romp-ibm-bsd4.4 - exit 0 ;; - ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and - echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to - exit 0 ;; # report: romp-ibm BSD 4.3 - *:BOSX:*:*) - echo rs6000-bull-bosx - exit 0 ;; - DPX/2?00:B.O.S.:*:*) - echo m68k-bull-sysv3 - exit 0 ;; - 9000/[34]??:4.3bsd:1.*:*) - echo m68k-hp-bsd - exit 0 ;; - hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) - echo m68k-hp-bsd4.4 - exit 0 ;; - 9000/[34678]??:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - case "${UNAME_MACHINE}" in - 9000/31? ) HP_ARCH=m68000 ;; - 9000/[34]?? ) HP_ARCH=m68k ;; - 9000/[678][0-9][0-9]) - if [ -x /usr/bin/getconf ]; then - sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` - sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` - case "${sc_cpu_version}" in - 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 - 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 - 532) # CPU_PA_RISC2_0 - case "${sc_kernel_bits}" in - 32) HP_ARCH="hppa2.0n" ;; - 64) HP_ARCH="hppa2.0w" ;; - '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 - esac ;; - esac - fi - if [ "${HP_ARCH}" = "" ]; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - - #define _HPUX_SOURCE - #include - #include - - int main () - { - #if defined(_SC_KERNEL_BITS) - long bits = sysconf(_SC_KERNEL_BITS); - #endif - long cpu = sysconf (_SC_CPU_VERSION); - - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1"); break; - case CPU_PA_RISC2_0: - #if defined(_SC_KERNEL_BITS) - switch (bits) - { - case 64: puts ("hppa2.0w"); break; - case 32: puts ("hppa2.0n"); break; - default: puts ("hppa2.0"); break; - } break; - #else /* !defined(_SC_KERNEL_BITS) */ - puts ("hppa2.0"); break; - #endif - default: puts ("hppa1.0"); break; - } - exit (0); - } -EOF - (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` - test -z "$HP_ARCH" && HP_ARCH=hppa - fi ;; - esac - if [ ${HP_ARCH} = "hppa2.0w" ] - then - # avoid double evaluation of $set_cc_for_build - test -n "$CC_FOR_BUILD" || eval $set_cc_for_build - if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null - then - HP_ARCH="hppa2.0w" - else - HP_ARCH="hppa64" - fi - fi - echo ${HP_ARCH}-hp-hpux${HPUX_REV} - exit 0 ;; - ia64:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - echo ia64-hp-hpux${HPUX_REV} - exit 0 ;; - 3050*:HI-UX:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - int - main () - { - long cpu = sysconf (_SC_CPU_VERSION); - /* The order matters, because CPU_IS_HP_MC68K erroneously returns - true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct - results, however. */ - if (CPU_IS_PA_RISC (cpu)) - { - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; - case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; - default: puts ("hppa-hitachi-hiuxwe2"); break; - } - } - else if (CPU_IS_HP_MC68K (cpu)) - puts ("m68k-hitachi-hiuxwe2"); - else puts ("unknown-hitachi-hiuxwe2"); - exit (0); - } -EOF - $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 - echo unknown-hitachi-hiuxwe2 - exit 0 ;; - 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) - echo hppa1.1-hp-bsd - exit 0 ;; - 9000/8??:4.3bsd:*:*) - echo hppa1.0-hp-bsd - exit 0 ;; - *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) - echo hppa1.0-hp-mpeix - exit 0 ;; - hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) - echo hppa1.1-hp-osf - exit 0 ;; - hp8??:OSF1:*:*) - echo hppa1.0-hp-osf - exit 0 ;; - i*86:OSF1:*:*) - if [ -x /usr/sbin/sysversion ] ; then - echo ${UNAME_MACHINE}-unknown-osf1mk - else - echo ${UNAME_MACHINE}-unknown-osf1 - fi - exit 0 ;; - parisc*:Lites*:*:*) - echo hppa1.1-hp-lites - exit 0 ;; - C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) - echo c1-convex-bsd - exit 0 ;; - C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit 0 ;; - C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) - echo c34-convex-bsd - exit 0 ;; - C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) - echo c38-convex-bsd - exit 0 ;; - C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) - echo c4-convex-bsd - exit 0 ;; - CRAY*Y-MP:*:*:*) - echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; - CRAY*[A-Z]90:*:*:*) - echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ - | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ - -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ - -e 's/\.[^.]*$/.X/' - exit 0 ;; - CRAY*TS:*:*:*) - echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; - CRAY*T3E:*:*:*) - echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; - CRAY*SV1:*:*:*) - echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; - *:UNICOS/mp:*:*) - echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; - F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) - FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` - echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit 0 ;; - 5000:UNIX_System_V:4.*:*) - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` - echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit 0 ;; - i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) - echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} - exit 0 ;; - sparc*:BSD/OS:*:*) - echo sparc-unknown-bsdi${UNAME_RELEASE} - exit 0 ;; - *:BSD/OS:*:*) - echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} - exit 0 ;; - *:FreeBSD:*:*) - # Determine whether the default compiler uses glibc. - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - #if __GLIBC__ >= 2 - LIBC=gnu - #else - LIBC= - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` - # GNU/KFreeBSD systems have a "k" prefix to indicate we are using - # FreeBSD's kernel, but not the complete OS. - case ${LIBC} in gnu) kernel_only='k' ;; esac - echo ${UNAME_MACHINE}-unknown-${kernel_only}freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC} - exit 0 ;; - i*:CYGWIN*:*) - echo ${UNAME_MACHINE}-pc-cygwin - exit 0 ;; - i*:MINGW*:*) - echo ${UNAME_MACHINE}-pc-mingw32 - exit 0 ;; - i*:PW*:*) - echo ${UNAME_MACHINE}-pc-pw32 - exit 0 ;; - x86:Interix*:[34]*) - echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//' - exit 0 ;; - [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) - echo i${UNAME_MACHINE}-pc-mks - exit 0 ;; - i*:Windows_NT*:* | Pentium*:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we - # UNAME_MACHINE based on the output of uname instead of i386? - echo i586-pc-interix - exit 0 ;; - i*:UWIN*:*) - echo ${UNAME_MACHINE}-pc-uwin - exit 0 ;; - p*:CYGWIN*:*) - echo powerpcle-unknown-cygwin - exit 0 ;; - prep*:SunOS:5.*:*) - echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - *:GNU:*:*) - # the GNU system - echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` - exit 0 ;; - *:GNU/*:*:*) - # other systems with GNU libc and userland - echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu - exit 0 ;; - i*86:Minix:*:*) - echo ${UNAME_MACHINE}-pc-minix - exit 0 ;; - arm*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; - cris:Linux:*:*) - echo cris-axis-linux-gnu - exit 0 ;; - ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; - m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; - mips:Linux:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #undef CPU - #undef mips - #undef mipsel - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=mipsel - #else - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=mips - #else - CPU= - #endif - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 - ;; - mips64:Linux:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #undef CPU - #undef mips64 - #undef mips64el - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=mips64el - #else - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=mips64 - #else - CPU= - #endif - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 - ;; - ppc:Linux:*:*) - echo powerpc-unknown-linux-gnu - exit 0 ;; - ppc64:Linux:*:*) - echo powerpc64-unknown-linux-gnu - exit 0 ;; - alpha:Linux:*:*) - case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in - EV5) UNAME_MACHINE=alphaev5 ;; - EV56) UNAME_MACHINE=alphaev56 ;; - PCA56) UNAME_MACHINE=alphapca56 ;; - PCA57) UNAME_MACHINE=alphapca56 ;; - EV6) UNAME_MACHINE=alphaev6 ;; - EV67) UNAME_MACHINE=alphaev67 ;; - EV68*) UNAME_MACHINE=alphaev68 ;; - esac - objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null - if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} - exit 0 ;; - parisc:Linux:*:* | hppa:Linux:*:*) - # Look for CPU level - case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-gnu ;; - PA8*) echo hppa2.0-unknown-linux-gnu ;; - *) echo hppa-unknown-linux-gnu ;; - esac - exit 0 ;; - parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-gnu - exit 0 ;; - s390:Linux:*:* | s390x:Linux:*:*) - echo ${UNAME_MACHINE}-ibm-linux - exit 0 ;; - sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; - sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; - sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; - x86_64:Linux:*:*) - echo x86_64-unknown-linux-gnu - exit 0 ;; - i*86:Linux:*:*) - # The BFD linker knows what the default object file format is, so - # first see if it will tell us. cd to the root directory to prevent - # problems with other programs or directories called `ld' in the path. - # Set LC_ALL=C to ensure ld outputs messages in English. - ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ - | sed -ne '/supported targets:/!d - s/[ ][ ]*/ /g - s/.*supported targets: *// - s/ .*// - p'` - case "$ld_supported_targets" in - elf32-i386) - TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" - ;; - a.out-i386-linux) - echo "${UNAME_MACHINE}-pc-linux-gnuaout" - exit 0 ;; - coff-i386) - echo "${UNAME_MACHINE}-pc-linux-gnucoff" - exit 0 ;; - "") - # Either a pre-BFD a.out linker (linux-gnuoldld) or - # one that does not give us useful --help. - echo "${UNAME_MACHINE}-pc-linux-gnuoldld" - exit 0 ;; - esac - # Determine whether the default compiler is a.out or elf - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - #ifdef __ELF__ - # ifdef __GLIBC__ - # if __GLIBC__ >= 2 - LIBC=gnu - # else - LIBC=gnulibc1 - # endif - # else - LIBC=gnulibc1 - # endif - #else - #ifdef __INTEL_COMPILER - LIBC=gnu - #else - LIBC=gnuaout - #endif - #endif - #ifdef __dietlibc__ - LIBC=dietlibc - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` - test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 - test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 - ;; - i*86:DYNIX/ptx:4*:*) - # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. - # earlier versions are messed up and put the nodename in both - # sysname and nodename. - echo i386-sequent-sysv4 - exit 0 ;; - i*86:UNIX_SV:4.2MP:2.*) - # Unixware is an offshoot of SVR4, but it has its own version - # number series starting with 2... - # I am not positive that other SVR4 systems won't match this, - # I just have to hope. -- rms. - # Use sysv4.2uw... so that sysv4* matches it. - echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} - exit 0 ;; - i*86:OS/2:*:*) - # If we were able to find `uname', then EMX Unix compatibility - # is probably installed. - echo ${UNAME_MACHINE}-pc-os2-emx - exit 0 ;; - i*86:XTS-300:*:STOP) - echo ${UNAME_MACHINE}-unknown-stop - exit 0 ;; - i*86:atheos:*:*) - echo ${UNAME_MACHINE}-unknown-atheos - exit 0 ;; - i*86:syllable:*:*) - echo ${UNAME_MACHINE}-pc-syllable - exit 0 ;; - i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) - echo i386-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - i*86:*DOS:*:*) - echo ${UNAME_MACHINE}-pc-msdosdjgpp - exit 0 ;; - i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) - UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` - if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then - echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} - else - echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} - fi - exit 0 ;; - i*86:*:5:[78]*) - case `/bin/uname -X | grep "^Machine"` in - *486*) UNAME_MACHINE=i486 ;; - *Pentium) UNAME_MACHINE=i586 ;; - *Pent*|*Celeron) UNAME_MACHINE=i686 ;; - esac - echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} - exit 0 ;; - i*86:*:3.2:*) - if test -f /usr/options/cb.name; then - UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then - UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` - (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 - (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ - && UNAME_MACHINE=i586 - (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ - && UNAME_MACHINE=i686 - (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ - && UNAME_MACHINE=i686 - echo ${UNAME_MACHINE}-pc-sco$UNAME_REL - else - echo ${UNAME_MACHINE}-pc-sysv32 - fi - exit 0 ;; - pc:*:*:*) - # Left here for compatibility: - # uname -m prints for DJGPP always 'pc', but it prints nothing about - # the processor, so we play safe by assuming i386. - echo i386-pc-msdosdjgpp - exit 0 ;; - Intel:Mach:3*:*) - echo i386-pc-mach3 - exit 0 ;; - paragon:*:*:*) - echo i860-intel-osf1 - exit 0 ;; - i860:*:4.*:*) # i860-SVR4 - if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then - echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 - else # Add other i860-SVR4 vendors below as they are discovered. - echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 - fi - exit 0 ;; - mini*:CTIX:SYS*5:*) - # "miniframe" - echo m68010-convergent-sysv - exit 0 ;; - mc68k:UNIX:SYSTEM5:3.51m) - echo m68k-convergent-sysv - exit 0 ;; - M680?0:D-NIX:5.3:*) - echo m68k-diab-dnix - exit 0 ;; - M68*:*:R3V[567]*:*) - test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; - 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0) - OS_REL='' - test -r /etc/.relid \ - && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && echo i486-ncr-sysv4.3${OS_REL} && exit 0 - /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; - 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && echo i486-ncr-sysv4 && exit 0 ;; - m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) - echo m68k-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - mc68030:UNIX_System_V:4.*:*) - echo m68k-atari-sysv4 - exit 0 ;; - TSUNAMI:LynxOS:2.*:*) - echo sparc-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - rs6000:LynxOS:2.*:*) - echo rs6000-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) - echo powerpc-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - SM[BE]S:UNIX_SV:*:*) - echo mips-dde-sysv${UNAME_RELEASE} - exit 0 ;; - RM*:ReliantUNIX-*:*:*) - echo mips-sni-sysv4 - exit 0 ;; - RM*:SINIX-*:*:*) - echo mips-sni-sysv4 - exit 0 ;; - *:SINIX-*:*:*) - if uname -p 2>/dev/null >/dev/null ; then - UNAME_MACHINE=`(uname -p) 2>/dev/null` - echo ${UNAME_MACHINE}-sni-sysv4 - else - echo ns32k-sni-sysv - fi - exit 0 ;; - PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort - # says - echo i586-unisys-sysv4 - exit 0 ;; - *:UNIX_System_V:4*:FTX*) - # From Gerald Hewes . - # How about differentiating between stratus architectures? -djm - echo hppa1.1-stratus-sysv4 - exit 0 ;; - *:*:*:FTX*) - # From seanf@swdc.stratus.com. - echo i860-stratus-sysv4 - exit 0 ;; - *:VOS:*:*) - # From Paul.Green@stratus.com. - echo hppa1.1-stratus-vos - exit 0 ;; - mc68*:A/UX:*:*) - echo m68k-apple-aux${UNAME_RELEASE} - exit 0 ;; - news*:NEWS-OS:6*:*) - echo mips-sony-newsos6 - exit 0 ;; - R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) - if [ -d /usr/nec ]; then - echo mips-nec-sysv${UNAME_RELEASE} - else - echo mips-unknown-sysv${UNAME_RELEASE} - fi - exit 0 ;; - BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. - echo powerpc-be-beos - exit 0 ;; - BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. - echo powerpc-apple-beos - exit 0 ;; - BePC:BeOS:*:*) # BeOS running on Intel PC compatible. - echo i586-pc-beos - exit 0 ;; - SX-4:SUPER-UX:*:*) - echo sx4-nec-superux${UNAME_RELEASE} - exit 0 ;; - SX-5:SUPER-UX:*:*) - echo sx5-nec-superux${UNAME_RELEASE} - exit 0 ;; - SX-6:SUPER-UX:*:*) - echo sx6-nec-superux${UNAME_RELEASE} - exit 0 ;; - Power*:Rhapsody:*:*) - echo powerpc-apple-rhapsody${UNAME_RELEASE} - exit 0 ;; - *:Rhapsody:*:*) - echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} - exit 0 ;; - *:Darwin:*:*) - case `uname -p` in - *86) UNAME_PROCESSOR=i686 ;; - powerpc) UNAME_PROCESSOR=powerpc ;; - esac - echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} - exit 0 ;; - *:procnto*:*:* | *:QNX:[0123456789]*:*) - UNAME_PROCESSOR=`uname -p` - if test "$UNAME_PROCESSOR" = "x86"; then - UNAME_PROCESSOR=i386 - UNAME_MACHINE=pc - fi - echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} - exit 0 ;; - *:QNX:*:4*) - echo i386-pc-qnx - exit 0 ;; - NSR-?:NONSTOP_KERNEL:*:*) - echo nsr-tandem-nsk${UNAME_RELEASE} - exit 0 ;; - *:NonStop-UX:*:*) - echo mips-compaq-nonstopux - exit 0 ;; - BS2000:POSIX*:*:*) - echo bs2000-siemens-sysv - exit 0 ;; - DS/*:UNIX_System_V:*:*) - echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} - exit 0 ;; - *:Plan9:*:*) - # "uname -m" is not consistent, so use $cputype instead. 386 - # is converted to i386 for consistency with other x86 - # operating systems. - if test "$cputype" = "386"; then - UNAME_MACHINE=i386 - else - UNAME_MACHINE="$cputype" - fi - echo ${UNAME_MACHINE}-unknown-plan9 - exit 0 ;; - *:TOPS-10:*:*) - echo pdp10-unknown-tops10 - exit 0 ;; - *:TENEX:*:*) - echo pdp10-unknown-tenex - exit 0 ;; - KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) - echo pdp10-dec-tops20 - exit 0 ;; - XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) - echo pdp10-xkl-tops20 - exit 0 ;; - *:TOPS-20:*:*) - echo pdp10-unknown-tops20 - exit 0 ;; - *:ITS:*:*) - echo pdp10-unknown-its - exit 0 ;; - SEI:*:*:SEIUX) - echo mips-sei-seiux${UNAME_RELEASE} - exit 0 ;; - *:DRAGONFLY:*:*) - echo ${UNAME_MACHINE}-unknown-dragonfly${UNAME_RELEASE} - exit 0 ;; -esac - -#echo '(No uname command or uname output not recognized.)' 1>&2 -#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 - -eval $set_cc_for_build -cat >$dummy.c < -# include -#endif -main () -{ -#if defined (sony) -#if defined (MIPSEB) - /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, - I don't know.... */ - printf ("mips-sony-bsd\n"); exit (0); -#else -#include - printf ("m68k-sony-newsos%s\n", -#ifdef NEWSOS4 - "4" -#else - "" -#endif - ); exit (0); -#endif -#endif - -#if defined (__arm) && defined (__acorn) && defined (__unix) - printf ("arm-acorn-riscix"); exit (0); -#endif - -#if defined (hp300) && !defined (hpux) - printf ("m68k-hp-bsd\n"); exit (0); -#endif - -#if defined (NeXT) -#if !defined (__ARCHITECTURE__) -#define __ARCHITECTURE__ "m68k" -#endif - int version; - version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; - if (version < 4) - printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); - else - printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); - exit (0); -#endif - -#if defined (MULTIMAX) || defined (n16) -#if defined (UMAXV) - printf ("ns32k-encore-sysv\n"); exit (0); -#else -#if defined (CMU) - printf ("ns32k-encore-mach\n"); exit (0); -#else - printf ("ns32k-encore-bsd\n"); exit (0); -#endif -#endif -#endif - -#if defined (__386BSD__) - printf ("i386-pc-bsd\n"); exit (0); -#endif - -#if defined (sequent) -#if defined (i386) - printf ("i386-sequent-dynix\n"); exit (0); -#endif -#if defined (ns32000) - printf ("ns32k-sequent-dynix\n"); exit (0); -#endif -#endif - -#if defined (_SEQUENT_) - struct utsname un; - - uname(&un); - - if (strncmp(un.version, "V2", 2) == 0) { - printf ("i386-sequent-ptx2\n"); exit (0); - } - if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ - printf ("i386-sequent-ptx1\n"); exit (0); - } - printf ("i386-sequent-ptx\n"); exit (0); - -#endif - -#if defined (vax) -# if !defined (ultrix) -# include -# if defined (BSD) -# if BSD == 43 - printf ("vax-dec-bsd4.3\n"); exit (0); -# else -# if BSD == 199006 - printf ("vax-dec-bsd4.3reno\n"); exit (0); -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# endif -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# else - printf ("vax-dec-ultrix\n"); exit (0); -# endif -#endif - -#if defined (alliant) && defined (i860) - printf ("i860-alliant-bsd\n"); exit (0); -#endif - - exit (1); -} -EOF - -$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0 - -# Apollos put the system type in the environment. - -test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } - -# Convex versions that predate uname can use getsysinfo(1) - -if [ -x /usr/convex/getsysinfo ] -then - case `getsysinfo -f cpu_type` in - c1*) - echo c1-convex-bsd - exit 0 ;; - c2*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit 0 ;; - c34*) - echo c34-convex-bsd - exit 0 ;; - c38*) - echo c38-convex-bsd - exit 0 ;; - c4*) - echo c4-convex-bsd - exit 0 ;; - esac -fi - -cat >&2 < in order to provide the needed -information to handle your system. - -config.guess timestamp = $timestamp - -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null` - -hostinfo = `(hostinfo) 2>/dev/null` -/bin/universe = `(/bin/universe) 2>/dev/null` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` -/bin/arch = `(/bin/arch) 2>/dev/null` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` - -UNAME_MACHINE = ${UNAME_MACHINE} -UNAME_RELEASE = ${UNAME_RELEASE} -UNAME_SYSTEM = ${UNAME_SYSTEM} -UNAME_VERSION = ${UNAME_VERSION} -EOF - -exit 1 - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff --git a/usr/src/grub/grub-0.95/config.h b/usr/src/grub/grub-0.95/config.h deleted file mode 100644 index 019d22ffd1..0000000000 --- a/usr/src/grub/grub-0.95/config.h +++ /dev/null @@ -1,107 +0,0 @@ -/* config.h. Generated by configure. */ -/* config.h.in. Generated from configure.ac by autoheader. */ - -/* Define if an absolute indirect call/jump must NOT be prefixed with `*' */ -/* #undef ABSOLUTE_WITHOUT_ASTERISK */ - -/* Define it to \"addr32\" or \"addr32;\" to make GAS happy */ -#define ADDR32 addr32 - -/* Define if you don't want to pass the mem= option to Linux */ -#define AUTO_LINUX_MEM_OPT 1 - -/* Define it to \"data32\" or \"data32;\" to make GAS happy */ -#define DATA32 data32 - -/* Define if C symbols get an underscore after compilation */ -/* #undef HAVE_ASM_USCORE */ - -/* Define to 1 if you have the header file. */ -#define HAVE_CURSES_H 1 - -/* Define if edata is defined */ -#define HAVE_EDATA_SYMBOL 1 - -/* Define if end is defined */ -#define HAVE_END_SYMBOL 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_INTTYPES_H 1 - -/* Define if you have a curses library */ -#define HAVE_LIBCURSES 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_MEMORY_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_NCURSES_CURSES_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_NCURSES_H */ - -/* Define if opendisk() in -lutil can be used */ -/* #undef HAVE_OPENDISK */ - -/* Define if start is defined */ -/* #undef HAVE_START_SYMBOL */ - -/* Define to 1 if you have the header file. */ -#define HAVE_STDINT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDLIB_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRINGS_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRING_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_UNISTD_H 1 - -/* Define if _edata is defined */ -#define HAVE_USCORE_EDATA_SYMBOL 1 - -/* Define if end is defined */ -#define HAVE_USCORE_END_SYMBOL 1 - -/* Define if _start is defined */ -#define HAVE_USCORE_START_SYMBOL 1 - -/* Define if __bss_start is defined */ -#define HAVE_USCORE_USCORE_BSS_START_SYMBOL 1 - -/* Name of package */ -#define PACKAGE "grub" - -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "bug-grub@gnu.org" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "GRUB" - -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "GRUB 0.95" - -/* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "grub" - -/* Define to the version of this package. */ -#define PACKAGE_VERSION "0.95" - -/* Define if there is user specified preset menu string */ -/* #undef PRESET_MENU_STRING */ - -/* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Version number of package */ -#define VERSION "0.95" diff --git a/usr/src/grub/grub-0.95/config.h.in b/usr/src/grub/grub-0.95/config.h.in deleted file mode 100644 index 68d7c8ce19..0000000000 --- a/usr/src/grub/grub-0.95/config.h.in +++ /dev/null @@ -1,106 +0,0 @@ -/* config.h.in. Generated from configure.ac by autoheader. */ - -/* Define if an absolute indirect call/jump must NOT be prefixed with `*' */ -#undef ABSOLUTE_WITHOUT_ASTERISK - -/* Define it to \"addr32\" or \"addr32;\" to make GAS happy */ -#undef ADDR32 - -/* Define if you don't want to pass the mem= option to Linux */ -#undef AUTO_LINUX_MEM_OPT - -/* Define it to \"data32\" or \"data32;\" to make GAS happy */ -#undef DATA32 - -/* Define if C symbols get an underscore after compilation */ -#undef HAVE_ASM_USCORE - -/* Define to 1 if you have the header file. */ -#undef HAVE_CURSES_H - -/* Define if edata is defined */ -#undef HAVE_EDATA_SYMBOL - -/* Define if end is defined */ -#undef HAVE_END_SYMBOL - -/* Define to 1 if you have the header file. */ -#undef HAVE_INTTYPES_H - -/* Define if you have a curses library */ -#undef HAVE_LIBCURSES - -/* Define to 1 if you have the header file. */ -#undef HAVE_MEMORY_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_NCURSES_CURSES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_NCURSES_H - -/* Define if opendisk() in -lutil can be used */ -#undef HAVE_OPENDISK - -/* Define if start is defined */ -#undef HAVE_START_SYMBOL - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDINT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDLIB_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRINGS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRING_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_STAT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TYPES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_UNISTD_H - -/* Define if _edata is defined */ -#undef HAVE_USCORE_EDATA_SYMBOL - -/* Define if end is defined */ -#undef HAVE_USCORE_END_SYMBOL - -/* Define if _start is defined */ -#undef HAVE_USCORE_START_SYMBOL - -/* Define if __bss_start is defined */ -#undef HAVE_USCORE_USCORE_BSS_START_SYMBOL - -/* Name of package */ -#undef PACKAGE - -/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#undef PACKAGE_NAME - -/* Define to the full name and version of this package. */ -#undef PACKAGE_STRING - -/* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME - -/* Define to the version of this package. */ -#undef PACKAGE_VERSION - -/* Define if there is user specified preset menu string */ -#undef PRESET_MENU_STRING - -/* Define to 1 if you have the ANSI C header files. */ -#undef STDC_HEADERS - -/* Version number of package */ -#undef VERSION diff --git a/usr/src/grub/grub-0.95/config.status.solaris b/usr/src/grub/grub-0.95/config.status.solaris deleted file mode 100755 index f18f22778c..0000000000 --- a/usr/src/grub/grub-0.95/config.status.solaris +++ /dev/null @@ -1,1252 +0,0 @@ -#! /bin/bash -# Generated by configure. -# Run this file to recreate the current configuration. -# Compiler output produced by configure, useful for debugging -# configure, is in config.log if it exists. - -debug=false -ac_cs_recheck=false -ac_cs_silent=false -SHELL=${CONFIG_SHELL-/bin/bash} -## --------------------- ## -## M4sh Initialization. ## -## --------------------- ## - -# Be Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' -elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then - set -o posix -fi -DUALCASE=1; export DUALCASE # for MKS sh - -# Support unset when possible. -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false -fi - - -# Work around bugs in pre-3.0 UWIN ksh. -$as_unset ENV MAIL MAILPATH -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -for as_var in \ - LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ - LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ - LC_TELEPHONE LC_TIME -do - if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then - eval $as_var=C; export $as_var - else - $as_unset $as_var - fi -done - -# Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - -if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - - -# Name of the executable. -as_me=`$as_basename "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)$' \| \ - . : '\(.\)' 2>/dev/null || -echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } - /^X\/\(\/\/\)$/{ s//\1/; q; } - /^X\/\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - - -# PATH needs CR, and LINENO needs CR and PATH. -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' - else - PATH_SEPARATOR=: - fi - rm -f conf$$.sh -fi - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" || { - # Find who we are. Look in the path if we contain no path at all - # relative or not. - case $0 in - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break -done - - ;; - esac - # We did not find ourselves, most probably we were run as `sh COMMAND' - # in which case we are not to be found in the path. - if test "x$as_myself" = x; then - as_myself=$0 - fi - if test ! -f "$as_myself"; then - { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 -echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} - { (exit 1); exit 1; }; } - fi - case $CONFIG_SHELL in - '') - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for as_base in sh bash ksh sh5; do - case $as_dir in - /*) - if ("$as_dir/$as_base" -c ' - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then - $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } - $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } - CONFIG_SHELL=$as_dir/$as_base - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$0" ${1+"$@"} - fi;; - esac - done -done -;; - esac - - # Create $as_me.lineno as a copy of $as_myself, but with $LINENO - # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line before each line; the second 'sed' does the real - # work. The second script uses 'N' to pair each line-number line - # with the numbered line, and appends trailing '-' during - # substitution so that $LINENO is not a special case at line end. - # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) - sed '=' <$as_myself | - sed ' - N - s,$,-, - : loop - s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, - t loop - s,-$,, - s,^['$as_cr_digits']*\n,, - ' >$as_me.lineno && - chmod +x $as_me.lineno || - { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 -echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} - { (exit 1); exit 1; }; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensible to this). - . ./$as_me.lineno - # Exit status is that of the last command. - exit -} - - -case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in - *c*,-n*) ECHO_N= ECHO_C=' -' ECHO_T=' ' ;; - *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; - *) ECHO_N= ECHO_C='\c' ECHO_T= ;; -esac - -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - -rm -f conf$$ conf$$.exe conf$$.file -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - # We could just check for DJGPP; but this test a) works b) is more generic - # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). - if test -f conf$$.exe; then - # Don't use ln at all; we don't have any links - as_ln_s='cp -p' - else - as_ln_s='ln -s' - fi -elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.file - -if mkdir -p . 2>/dev/null; then - as_mkdir_p=: -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -as_executable_p="test -f" - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - -# IFS -# We need space, tab and new line, in precisely that order. -as_nl=' -' -IFS=" $as_nl" - -# CDPATH. -$as_unset CDPATH - -exec 6>&1 - -# Open the log real soon, to keep \$[0] and so on meaningful, and to -# report actual input values of CONFIG_FILES etc. instead of their -# values after options handling. Logging --version etc. is OK. -exec 5>>config.log -{ - echo - sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX -## Running $as_me. ## -_ASBOX -} >&5 -cat >&5 <<_CSEOF - -This file was extended by GRUB $as_me 0.95, which was -generated by GNU Autoconf 2.59. Invocation command line was - - CONFIG_FILES = $CONFIG_FILES - CONFIG_HEADERS = $CONFIG_HEADERS - CONFIG_LINKS = $CONFIG_LINKS - CONFIG_COMMANDS = $CONFIG_COMMANDS - $ $0 $@ - -_CSEOF -echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 -echo >&5 -config_files=" Makefile stage1/Makefile stage2/Makefile docs/Makefile lib/Makefile util/Makefile grub/Makefile netboot/Makefile util/grub-image util/grub-install util/grub-md5-crypt util/grub-terminfo util/grub-set-default" -config_headers=" config.h" -config_commands=" depfiles" - -ac_cs_usage="\ -\`$as_me' instantiates files from templates according to the -current configuration. - -Usage: $0 [OPTIONS] [FILE]... - - -h, --help print this help, then exit - -V, --version print version number, then exit - -q, --quiet do not print progress messages - -d, --debug don't remove temporary files - --recheck update $as_me by reconfiguring in the same conditions - --file=FILE[:TEMPLATE] - instantiate the configuration file FILE - --header=FILE[:TEMPLATE] - instantiate the configuration header FILE - -Configuration files: -$config_files - -Configuration headers: -$config_headers - -Configuration commands: -$config_commands - -Report bugs to ." -ac_cs_version="\ -GRUB config.status 0.95 -configured by ./configure, generated by GNU Autoconf 2.59, - with options \"'--prefix=/platform/i86pc/boot/grub' '--with-binutils=/opt/grubbld/bin' '--disable-dependency-tracking' 'CC=/opt/grubbld/bin/gcc'\" - -Copyright (C) 2003 Free Software Foundation, Inc. -This config.status script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it." -srcdir=. -INSTALL="/usr/ucb/install" -# If no file are specified by the user, then we need to provide default -# value. By we need to know if files were specified by the user. -ac_need_defaults=: -while test $# != 0 -do - case $1 in - --*=*) - ac_option=`expr "x$1" : 'x\([^=]*\)='` - ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` - ac_shift=: - ;; - -*) - ac_option=$1 - ac_optarg=$2 - ac_shift=shift - ;; - *) # This is not an option, so the user has probably given explicit - # arguments. - ac_option=$1 - ac_need_defaults=false;; - esac - - case $ac_option in - # Handling of the options. - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - ac_cs_recheck=: ;; - --version | --vers* | -V ) - echo "$ac_cs_version"; exit 0 ;; - --he | --h) - # Conflict between --help and --header - { { echo "$as_me:$LINENO: error: ambiguous option: $1 -Try \`$0 --help' for more information." >&5 -echo "$as_me: error: ambiguous option: $1 -Try \`$0 --help' for more information." >&2;} - { (exit 1); exit 1; }; };; - --help | --hel | -h ) - echo "$ac_cs_usage"; exit 0 ;; - --debug | --d* | -d ) - debug=: ;; - --file | --fil | --fi | --f ) - $ac_shift - CONFIG_FILES="$CONFIG_FILES $ac_optarg" - ac_need_defaults=false;; - --header | --heade | --head | --hea ) - $ac_shift - CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" - ac_need_defaults=false;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil | --si | --s) - ac_cs_silent=: ;; - - # This is an error. - -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 -Try \`$0 --help' for more information." >&5 -echo "$as_me: error: unrecognized option: $1 -Try \`$0 --help' for more information." >&2;} - { (exit 1); exit 1; }; } ;; - - *) ac_config_targets="$ac_config_targets $1" ;; - - esac - shift -done - -ac_configure_extra_args= - -if $ac_cs_silent; then - exec 6>/dev/null - ac_configure_extra_args="$ac_configure_extra_args --silent" -fi - -if $ac_cs_recheck; then - echo "running /bin/bash ./configure " '--prefix=/platform/i86pc/boot/grub' '--with-binutils=/opt/grubbld/bin' '--disable-dependency-tracking' 'CC=/opt/grubbld/bin/gcc' $ac_configure_extra_args " --no-create --no-recursion" >&6 - exec /bin/bash ./configure '--prefix=/platform/i86pc/boot/grub' '--with-binutils=/opt/grubbld/bin' '--disable-dependency-tracking' 'CC=/opt/grubbld/bin/gcc' $ac_configure_extra_args --no-create --no-recursion -fi - -# -# INIT-COMMANDS section. -# - -AMDEP_TRUE="#" ac_aux_dir="." - -for ac_config_target in $ac_config_targets -do - case "$ac_config_target" in - # Handling of arguments. - "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; - "stage1/Makefile" ) CONFIG_FILES="$CONFIG_FILES stage1/Makefile" ;; - "stage2/Makefile" ) CONFIG_FILES="$CONFIG_FILES stage2/Makefile" ;; - "docs/Makefile" ) CONFIG_FILES="$CONFIG_FILES docs/Makefile" ;; - "lib/Makefile" ) CONFIG_FILES="$CONFIG_FILES lib/Makefile" ;; - "util/Makefile" ) CONFIG_FILES="$CONFIG_FILES util/Makefile" ;; - "grub/Makefile" ) CONFIG_FILES="$CONFIG_FILES grub/Makefile" ;; - "netboot/Makefile" ) CONFIG_FILES="$CONFIG_FILES netboot/Makefile" ;; - "util/grub-image" ) CONFIG_FILES="$CONFIG_FILES util/grub-image" ;; - "util/grub-install" ) CONFIG_FILES="$CONFIG_FILES util/grub-install" ;; - "util/grub-md5-crypt" ) CONFIG_FILES="$CONFIG_FILES util/grub-md5-crypt" ;; - "util/grub-terminfo" ) CONFIG_FILES="$CONFIG_FILES util/grub-terminfo" ;; - "util/grub-set-default" ) CONFIG_FILES="$CONFIG_FILES util/grub-set-default" ;; - "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; - "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; - *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 -echo "$as_me: error: invalid argument: $ac_config_target" >&2;} - { (exit 1); exit 1; }; };; - esac -done - -# If the user did not use the arguments to specify the items to instantiate, -# then the envvar interface is used. Set only those that are not. -# We use the long form for the default assignment because of an extremely -# bizarre bug on SunOS 4.1.3. -if $ac_need_defaults; then - test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files - test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers - test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands -fi - -# Have a temporary directory for convenience. Make it in the build tree -# simply because there is no reason to put it here, and in addition, -# creating and moving files from /tmp can sometimes cause problems. -# Create a temporary directory, and hook for its removal unless debugging. -$debug || -{ - trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 - trap '{ (exit 1); exit 1; }' 1 2 13 15 -} - -# Create a (secure) tmp directory for tmp files. - -{ - tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" -} || -{ - tmp=./confstat$$-$RANDOM - (umask 077 && mkdir $tmp) -} || -{ - echo "$me: cannot create a temporary directory in ." >&2 - { (exit 1); exit 1; } -} - - -# -# CONFIG_FILES section. -# - -# No need to generate the scripts if there are no CONFIG_FILES. -# This happens for instance when ./config.status config.h -if test -n "$CONFIG_FILES"; then - # Protect against being on the right side of a sed subst in config.status. - sed 's/,@/@@/; s/@,/@@/; s/,;t t$/@;t t/; /@;t t$/s/[\\&,]/\\&/g; - s/@@/,@/; s/@@/@,/; s/@;t t$/,;t t/' >$tmp/subs.sed <<\CEOF -s,@SHELL@,/bin/bash,;t t -s,@PATH_SEPARATOR@,:,;t t -s,@PACKAGE_NAME@,GRUB,;t t -s,@PACKAGE_TARNAME@,grub,;t t -s,@PACKAGE_VERSION@,0.95,;t t -s,@PACKAGE_STRING@,GRUB 0.95,;t t -s,@PACKAGE_BUGREPORT@,bug-grub@gnu.org,;t t -s,@exec_prefix@,${prefix},;t t -s,@prefix@,/platform/i86pc/boot/grub,;t t -s,@program_transform_name@,s,x,x,,;t t -s,@bindir@,${exec_prefix}/bin,;t t -s,@sbindir@,${exec_prefix}/sbin,;t t -s,@libexecdir@,${exec_prefix}/libexec,;t t -s,@datadir@,${prefix}/share,;t t -s,@sysconfdir@,${prefix}/etc,;t t -s,@sharedstatedir@,${prefix}/com,;t t -s,@localstatedir@,${prefix}/var,;t t -s,@libdir@,${exec_prefix}/lib,;t t -s,@includedir@,${prefix}/include,;t t -s,@oldincludedir@,/usr/include,;t t -s,@infodir@,${prefix}/info,;t t -s,@mandir@,${prefix}/man,;t t -s,@build_alias@,,;t t -s,@host_alias@,,;t t -s,@target_alias@,,;t t -s,@DEFS@,-DHAVE_CONFIG_H,;t t -s,@ECHO_C@,,;t t -s,@ECHO_N@,-n,;t t -s,@ECHO_T@,,;t t -s,@LIBS@,,;t t -s,@INSTALL_PROGRAM@,${INSTALL},;t t -s,@INSTALL_SCRIPT@,${INSTALL},;t t -s,@INSTALL_DATA@,${INSTALL} -m 644,;t t -s,@CYGPATH_W@,echo,;t t -s,@PACKAGE@,grub,;t t -s,@VERSION@,0.95,;t t -s,@ACLOCAL@,${SHELL} /net/zwicky/export5/jongkis/w/boot/usr/src/grub/grub-0.95/missing --run aclocal-1.8,;t t -s,@AUTOCONF@,${SHELL} /net/zwicky/export5/jongkis/w/boot/usr/src/grub/grub-0.95/missing --run autoconf,;t t -s,@AUTOMAKE@,${SHELL} /net/zwicky/export5/jongkis/w/boot/usr/src/grub/grub-0.95/missing --run automake-1.8,;t t -s,@AUTOHEADER@,${SHELL} /net/zwicky/export5/jongkis/w/boot/usr/src/grub/grub-0.95/missing --run autoheader,;t t -s,@MAKEINFO@,${SHELL} /net/zwicky/export5/jongkis/w/boot/usr/src/grub/grub-0.95/missing --run makeinfo,;t t -s,@AMTAR@,${SHELL} /net/zwicky/export5/jongkis/w/boot/usr/src/grub/grub-0.95/missing --run tar,;t t -s,@install_sh@,/net/zwicky/export5/jongkis/w/boot/usr/src/grub/grub-0.95/install-sh,;t t -s,@STRIP@,,;t t -s,@ac_ct_STRIP@,,;t t -s,@INSTALL_STRIP_PROGRAM@,${SHELL} $(install_sh) -c -s,;t t -s,@mkdir_p@,mkdir -p -- .,;t t -s,@AWK@,gawk,;t t -s,@SET_MAKE@,,;t t -s,@am__leading_dot@,.,;t t -s,@build@,i386-pc-solaris2.10,;t t -s,@build_cpu@,i386,;t t -s,@build_vendor@,pc,;t t -s,@build_os@,solaris2.10,;t t -s,@host@,i386-pc-solaris2.10,;t t -s,@host_cpu@,i386,;t t -s,@host_vendor@,pc,;t t -s,@host_os@,solaris2.10,;t t -s,@MAINTAINER_MODE_TRUE@,#,;t t -s,@MAINTAINER_MODE_FALSE@,,;t t -s,@MAINT@,#,;t t -s,@PERL@,,;t t -s,@CC@,/opt/grubbld/bin/gcc,;t t -s,@ac_ct_CC@,/opt/grubbld/bin/gcc,;t t -s,@CFLAGS@,-B/opt/grubbld/bin/ -g,;t t -s,@LDFLAGS@,,;t t -s,@CPPFLAGS@, -Wall -Wmissing-prototypes -Wunused -Wshadow -Wpointer-arith -falign-jumps=1 -falign-loops=1 -falign-functions=1 -Wundef,;t t -s,@EXEEXT@,,;t t -s,@OBJEXT@,o,;t t -s,@DEPDIR@,.deps,;t t -s,@am__include@,include,;t t -s,@am__quote@,,;t t -s,@AMDEP_TRUE@,#,;t t -s,@AMDEP_FALSE@,,;t t -s,@AMDEPBACKSLASH@,,;t t -s,@CCDEPMODE@,depmode=none,;t t -s,@am__fastdepCC_TRUE@,#,;t t -s,@am__fastdepCC_FALSE@,,;t t -s,@CCAS@,/opt/grubbld/bin/gcc,;t t -s,@RANLIB@,/opt/grubbld/bin/ranlib,;t t -s,@ac_ct_RANLIB@,,;t t -s,@STAGE1_CFLAGS@,-O2,;t t -s,@STAGE2_CFLAGS@,-Os,;t t -s,@GRUB_CFLAGS@,-O2,;t t -s,@OBJCOPY@,/opt/grubbld/bin/objcopy,;t t -s,@ac_ct_OBJCOPY@,,;t t -s,@GRUB_LIBS@, -lcurses,;t t -s,@CPP@,/opt/grubbld/bin/gcc -E,;t t -s,@EGREP@,egrep,;t t -s,@NETBOOT_SUPPORT_TRUE@,#,;t t -s,@NETBOOT_SUPPORT_FALSE@,,;t t -s,@DISKLESS_SUPPORT_TRUE@,#,;t t -s,@DISKLESS_SUPPORT_FALSE@,,;t t -s,@GRAPHICS_SUPPORT_TRUE@,,;t t -s,@GRAPHICS_SUPPORT_FALSE@,#,;t t -s,@HERCULES_SUPPORT_TRUE@,,;t t -s,@HERCULES_SUPPORT_FALSE@,#,;t t -s,@SERIAL_SUPPORT_TRUE@,,;t t -s,@SERIAL_SUPPORT_FALSE@,#,;t t -s,@SERIAL_SPEED_SIMULATION_TRUE@,#,;t t -s,@SERIAL_SPEED_SIMULATION_FALSE@,,;t t -s,@BUILD_EXAMPLE_KERNEL_TRUE@,#,;t t -s,@BUILD_EXAMPLE_KERNEL_FALSE@,,;t t -s,@FSYS_CFLAGS@, -DFSYS_EXT2FS=1 -DFSYS_FAT=1 -DFSYS_FFS=1 -DFSYS_UFS=1 -DFSYS_UFS2=1 -DFSYS_MINIX=1 -DFSYS_REISERFS=1 -DFSYS_VSTAFS=1 -DFSYS_JFS=1 -DFSYS_XFS=1 -DFSYS_ISO9660=1 -DUSE_MD5_PASSWORDS=1,;t t -s,@NET_CFLAGS@,,;t t -s,@NET_EXTRAFLAGS@, -DCONGESTED=1 -DNE_SCAN=0x280,0x300,0x320,0x340 -DWD_DEFAULT_MEM=0xCC000,;t t -s,@NETBOOT_DRIVERS@,,;t t -s,@CCASFLAGS@,$(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(CPPFLAGS) $(CFLAGS),;t t -s,@LIBOBJS@,,;t t -s,@LTLIBOBJS@,,;t t -CEOF - - # Split the substitutions into bite-sized pieces for seds with - # small command number limits, like on Digital OSF/1 and HP-UX. - ac_max_sed_lines=48 - ac_sed_frag=1 # Number of current file. - ac_beg=1 # First line for current file. - ac_end=$ac_max_sed_lines # Line after last line for current file. - ac_more_lines=: - ac_sed_cmds= - while $ac_more_lines; do - if test $ac_beg -gt 1; then - sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag - else - sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag - fi - if test ! -s $tmp/subs.frag; then - ac_more_lines=false - else - # The purpose of the label and of the branching condition is to - # speed up the sed processing (if there are no `@' at all, there - # is no need to browse any of the substitutions). - # These are the two extra sed commands mentioned above. - (echo ':t - /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed - if test -z "$ac_sed_cmds"; then - ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" - else - ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" - fi - ac_sed_frag=`expr $ac_sed_frag + 1` - ac_beg=$ac_end - ac_end=`expr $ac_end + $ac_max_sed_lines` - fi - done - if test -z "$ac_sed_cmds"; then - ac_sed_cmds=cat - fi -fi # test -n "$CONFIG_FILES" - -for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case $ac_file in - - | *:- | *:-:* ) # input from stdin - cat >$tmp/stdin - ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - * ) ac_file_in=$ac_file.in ;; - esac - - # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. - ac_dir=`(dirname "$ac_file") 2>/dev/null || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - { if $as_mkdir_p; then - mkdir -p "$ac_dir" - else - as_dir="$ac_dir" - as_dirs= - while test ! -d "$as_dir"; do - as_dirs="$as_dir $as_dirs" - as_dir=`(dirname "$as_dir") 2>/dev/null || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - done - test ! -n "$as_dirs" || mkdir $as_dirs - fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 -echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} - { (exit 1); exit 1; }; }; } - - ac_builddir=. - -if test "$ac_dir" != .; then - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A "../" for each directory in $ac_dir_suffix. - ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` -else - ac_dir_suffix= ac_top_builddir= -fi - -case $srcdir in - .) # No --srcdir option. We are building in place. - ac_srcdir=. - if test -z "$ac_top_builddir"; then - ac_top_srcdir=. - else - ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` - fi ;; - [\\/]* | ?:[\\/]* ) # Absolute path. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir ;; - *) # Relative path. - ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_builddir$srcdir ;; -esac - -# Do not use `cd foo && pwd` to compute absolute paths, because -# the directories may not exist. -case `pwd` in -.) ac_abs_builddir="$ac_dir";; -*) - case "$ac_dir" in - .) ac_abs_builddir=`pwd`;; - [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; - *) ac_abs_builddir=`pwd`/"$ac_dir";; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_builddir=${ac_top_builddir}.;; -*) - case ${ac_top_builddir}. in - .) ac_abs_top_builddir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; - *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_srcdir=$ac_srcdir;; -*) - case $ac_srcdir in - .) ac_abs_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; - *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_srcdir=$ac_top_srcdir;; -*) - case $ac_top_srcdir in - .) ac_abs_top_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; - *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; - esac;; -esac - - - case $INSTALL in - [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; - *) ac_INSTALL=$ac_top_builddir$INSTALL ;; - esac - - if test x"$ac_file" != x-; then - { echo "$as_me:$LINENO: creating $ac_file" >&5 -echo "$as_me: creating $ac_file" >&6;} - rm -f "$ac_file" - fi - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - if test x"$ac_file" = x-; then - configure_input= - else - configure_input="$ac_file. " - fi - configure_input=$configure_input"Generated from `echo $ac_file_in | - sed 's,.*/,,'` by configure." - - # First look for the input files in the build tree, otherwise in the - # src tree. - ac_file_inputs=`IFS=: - for f in $ac_file_in; do - case $f in - -) echo $tmp/stdin ;; - [\\/$]*) - # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - echo "$f";; - *) # Relative - if test -f "$f"; then - # Build tree - echo "$f" - elif test -f "$srcdir/$f"; then - # Source tree - echo "$srcdir/$f" - else - # /dev/null tree - { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - fi;; - esac - done` || { (exit 1); exit 1; } - sed "/^[ ]*VPATH[ ]*=/{ -s/:*\$(srcdir):*/:/; -s/:*\${srcdir}:*/:/; -s/:*@srcdir@:*/:/; -s/^\([^=]*=[ ]*\):*/\1/; -s/:*$//; -s/^[^=]*=[ ]*$//; -} - -:t -/@[a-zA-Z_][a-zA-Z_0-9]*@/!b -s,@configure_input@,$configure_input,;t t -s,@srcdir@,$ac_srcdir,;t t -s,@abs_srcdir@,$ac_abs_srcdir,;t t -s,@top_srcdir@,$ac_top_srcdir,;t t -s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t -s,@builddir@,$ac_builddir,;t t -s,@abs_builddir@,$ac_abs_builddir,;t t -s,@top_builddir@,$ac_top_builddir,;t t -s,@abs_top_builddir@,$ac_abs_top_builddir,;t t -s,@INSTALL@,$ac_INSTALL,;t t -" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out - rm -f $tmp/stdin - if test x"$ac_file" != x-; then - mv $tmp/out $ac_file - else - cat $tmp/out - rm -f $tmp/out - fi - -done - -# -# CONFIG_HEADER section. -# - -# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where -# NAME is the cpp macro being defined and VALUE is the value it is being given. -# -# ac_d sets the value in "#define NAME VALUE" lines. -ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' -ac_dB='[ ].*$,\1#\2' -ac_dC=' ' -ac_dD=',;t' -# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". -ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' -ac_uB='$,\1#\2define\3' -ac_uC=' ' -ac_uD=',;t' - -for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case $ac_file in - - | *:- | *:-:* ) # input from stdin - cat >$tmp/stdin - ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - * ) ac_file_in=$ac_file.in ;; - esac - - test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 -echo "$as_me: creating $ac_file" >&6;} - - # First look for the input files in the build tree, otherwise in the - # src tree. - ac_file_inputs=`IFS=: - for f in $ac_file_in; do - case $f in - -) echo $tmp/stdin ;; - [\\/$]*) - # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - # Do quote $f, to prevent DOS paths from being IFS'd. - echo "$f";; - *) # Relative - if test -f "$f"; then - # Build tree - echo "$f" - elif test -f "$srcdir/$f"; then - # Source tree - echo "$srcdir/$f" - else - # /dev/null tree - { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - fi;; - esac - done` || { (exit 1); exit 1; } - # Remove the trailing spaces. - sed 's/[ ]*$//' $ac_file_inputs >$tmp/in - - # Handle all the #define templates only if necessary. - if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then - # If there are no defines, we may have an empty if/fi - : - cat >$tmp/defines.sed <$tmp/out - rm -f $tmp/in - mv $tmp/out $tmp/in - - fi # grep - - # Handle all the #undef templates - cat >$tmp/undefs.sed <$tmp/out - rm -f $tmp/in - mv $tmp/out $tmp/in - - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - if test x"$ac_file" = x-; then - echo "/* Generated by configure. */" >$tmp/config.h - else - echo "/* $ac_file. Generated by configure. */" >$tmp/config.h - fi - cat $tmp/in >>$tmp/config.h - rm -f $tmp/in - if test x"$ac_file" != x-; then - if diff $ac_file $tmp/config.h >/dev/null 2>&1; then - { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 -echo "$as_me: $ac_file is unchanged" >&6;} - else - ac_dir=`(dirname "$ac_file") 2>/dev/null || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - { if $as_mkdir_p; then - mkdir -p "$ac_dir" - else - as_dir="$ac_dir" - as_dirs= - while test ! -d "$as_dir"; do - as_dirs="$as_dir $as_dirs" - as_dir=`(dirname "$as_dir") 2>/dev/null || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - done - test ! -n "$as_dirs" || mkdir $as_dirs - fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 -echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} - { (exit 1); exit 1; }; }; } - - rm -f $ac_file - mv $tmp/config.h $ac_file - fi - else - cat $tmp/config.h - rm -f $tmp/config.h - fi -# Compute $ac_file's index in $config_headers. -_am_stamp_count=1 -for _am_header in $config_headers :; do - case $_am_header in - $ac_file | $ac_file:* ) - break ;; - * ) - _am_stamp_count=`expr $_am_stamp_count + 1` ;; - esac -done -echo "timestamp for $ac_file" >`(dirname $ac_file) 2>/dev/null || -$as_expr X$ac_file : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X$ac_file : 'X\(//\)[^/]' \| \ - X$ac_file : 'X\(//\)$' \| \ - X$ac_file : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X$ac_file | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'`/stamp-h$_am_stamp_count -done - -# -# CONFIG_COMMANDS section. -# -for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue - ac_dest=`echo "$ac_file" | sed 's,:.*,,'` - ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_dir=`(dirname "$ac_dest") 2>/dev/null || -$as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_dest" : 'X\(//\)[^/]' \| \ - X"$ac_dest" : 'X\(//\)$' \| \ - X"$ac_dest" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$ac_dest" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - { if $as_mkdir_p; then - mkdir -p "$ac_dir" - else - as_dir="$ac_dir" - as_dirs= - while test ! -d "$as_dir"; do - as_dirs="$as_dir $as_dirs" - as_dir=`(dirname "$as_dir") 2>/dev/null || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - done - test ! -n "$as_dirs" || mkdir $as_dirs - fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 -echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} - { (exit 1); exit 1; }; }; } - - ac_builddir=. - -if test "$ac_dir" != .; then - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A "../" for each directory in $ac_dir_suffix. - ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` -else - ac_dir_suffix= ac_top_builddir= -fi - -case $srcdir in - .) # No --srcdir option. We are building in place. - ac_srcdir=. - if test -z "$ac_top_builddir"; then - ac_top_srcdir=. - else - ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` - fi ;; - [\\/]* | ?:[\\/]* ) # Absolute path. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir ;; - *) # Relative path. - ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_builddir$srcdir ;; -esac - -# Do not use `cd foo && pwd` to compute absolute paths, because -# the directories may not exist. -case `pwd` in -.) ac_abs_builddir="$ac_dir";; -*) - case "$ac_dir" in - .) ac_abs_builddir=`pwd`;; - [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; - *) ac_abs_builddir=`pwd`/"$ac_dir";; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_builddir=${ac_top_builddir}.;; -*) - case ${ac_top_builddir}. in - .) ac_abs_top_builddir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; - *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_srcdir=$ac_srcdir;; -*) - case $ac_srcdir in - .) ac_abs_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; - *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_srcdir=$ac_top_srcdir;; -*) - case $ac_top_srcdir in - .) ac_abs_top_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; - *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; - esac;; -esac - - - { echo "$as_me:$LINENO: executing $ac_dest commands" >&5 -echo "$as_me: executing $ac_dest commands" >&6;} - case $ac_dest in - depfiles ) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do - # Strip MF so we end up with the name of the file. - mf=`echo "$mf" | sed -e 's/:.*$//'` - # Check whether this is an Automake generated Makefile or not. - # We used to match only the files named `Makefile.in', but - # some people rename them; so instead we look at the file content. - # Grep'ing the first line is not enough: some people post-process - # each Makefile.in and add a new line on top of each file to say so. - # So let's grep whole file. - if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then - dirpart=`(dirname "$mf") 2>/dev/null || -$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$mf" : 'X\(//\)[^/]' \| \ - X"$mf" : 'X\(//\)$' \| \ - X"$mf" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$mf" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - else - continue - fi - grep '^DEP_FILES *= *[^ #]' < "$mf" > /dev/null || continue - # Extract the definition of DEP_FILES from the Makefile without - # running `make'. - DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"` - test -z "$DEPDIR" && continue - # When using ansi2knr, U may be empty or an underscore; expand it - U=`sed -n -e '/^U = / s///p' < "$mf"` - test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR" - # We invoke sed twice because it is the simplest approach to - # changing $(DEPDIR) to its actual value in the expansion. - for file in `sed -n -e ' - /^DEP_FILES = .*\\\\$/ { - s/^DEP_FILES = // - :loop - s/\\\\$// - p - n - /\\\\$/ b loop - p - } - /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do - # Make sure the directory exists. - test -f "$dirpart/$file" && continue - fdir=`(dirname "$file") 2>/dev/null || -$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$file" : 'X\(//\)[^/]' \| \ - X"$file" : 'X\(//\)$' \| \ - X"$file" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - { if $as_mkdir_p; then - mkdir -p $dirpart/$fdir - else - as_dir=$dirpart/$fdir - as_dirs= - while test ! -d "$as_dir"; do - as_dirs="$as_dir $as_dirs" - as_dir=`(dirname "$as_dir") 2>/dev/null || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - done - test ! -n "$as_dirs" || mkdir $as_dirs - fi || { { echo "$as_me:$LINENO: error: cannot create directory $dirpart/$fdir" >&5 -echo "$as_me: error: cannot create directory $dirpart/$fdir" >&2;} - { (exit 1); exit 1; }; }; } - - # echo "creating $dirpart/$file" - echo '# dummy' > "$dirpart/$file" - done -done - ;; - esac -done - -{ (exit 0); exit 0; } diff --git a/usr/src/grub/grub-0.95/config.sub b/usr/src/grub/grub-0.95/config.sub deleted file mode 100755 index 463186dbfd..0000000000 --- a/usr/src/grub/grub-0.95/config.sub +++ /dev/null @@ -1,1537 +0,0 @@ -#! /bin/sh -# Configuration validation subroutine script. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003 Free Software Foundation, Inc. - -timestamp='2004-01-05' - -# This file is (in principle) common to ALL GNU software. -# The presence of a machine in this file suggests that SOME GNU software -# can handle that machine. It does not imply ALL GNU software can. -# -# This file 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. - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# Please send patches to . Submit a context -# diff and a properly formatted ChangeLog entry. -# -# Configuration subroutine to validate and canonicalize a configuration type. -# Supply the specified configuration type as an argument. -# If it is invalid, we print an error message on stderr and exit with code 1. -# Otherwise, we print the canonical config type on stdout and succeed. - -# This file is supposed to be the same for all GNU packages -# and recognize all the CPU types, system types and aliases -# that are meaningful with *any* GNU software. -# Each package is responsible for reporting which valid configurations -# it does not support. The user should be able to distinguish -# a failure to support a valid configuration from a meaningless -# configuration. - -# The goal of this file is to map all the various variations of a given -# machine specification into a single specification in the form: -# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM -# or in some cases, the newer four-part form: -# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM -# It is wrong to echo any other type of specification. - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] CPU-MFR-OPSYS - $0 [OPTION] ALIAS - -Canonicalize a configuration name. - -Operation modes: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to ." - -version="\ -GNU config.sub ($timestamp) - -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 -Free Software Foundation, Inc. - -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try \`$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit 0 ;; - --version | -v ) - echo "$version" ; exit 0 ;; - --help | --h* | -h ) - echo "$usage"; exit 0 ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" - exit 1 ;; - - *local*) - # First pass through any local machine types. - echo $1 - exit 0;; - - * ) - break ;; - esac -done - -case $# in - 0) echo "$me: missing argument$help" >&2 - exit 1;; - 1) ;; - *) echo "$me: too many arguments$help" >&2 - exit 1;; -esac - -# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). -# Here we must recognize all the valid KERNEL-OS combinations. -maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` -case $maybe_os in - nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \ - kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*) - os=-$maybe_os - basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` - ;; - *) - basic_machine=`echo $1 | sed 's/-[^-]*$//'` - if [ $basic_machine != $1 ] - then os=`echo $1 | sed 's/.*-/-/'` - else os=; fi - ;; -esac - -### Let's recognize common machines as not being operating systems so -### that things like config.sub decstation-3100 work. We also -### recognize some manufacturers as not being operating systems, so we -### can provide default operating systems below. -case $os in - -sun*os*) - # Prevent following clause from handling this invalid input. - ;; - -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ - -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ - -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ - -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ - -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ - -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis) - os= - basic_machine=$1 - ;; - -sim | -cisco | -oki | -wec | -winbond) - os= - basic_machine=$1 - ;; - -scout) - ;; - -wrs) - os=-vxworks - basic_machine=$1 - ;; - -chorusos*) - os=-chorusos - basic_machine=$1 - ;; - -chorusrdb) - os=-chorusrdb - basic_machine=$1 - ;; - -hiux*) - os=-hiuxwe2 - ;; - -sco5) - os=-sco3.2v5 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco4) - os=-sco3.2v4 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2.[4-9]*) - os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2v[4-9]*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco*) - os=-sco3.2v2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -udk*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -isc) - os=-isc2.2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -clix*) - basic_machine=clipper-intergraph - ;; - -isc*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -lynx*) - os=-lynxos - ;; - -ptx*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` - ;; - -windowsnt*) - os=`echo $os | sed -e 's/windowsnt/winnt/'` - ;; - -psos*) - os=-psos - ;; - -mint | -mint[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; -esac - -# Decode aliases for certain CPU-COMPANY combinations. -case $basic_machine in - # Recognize the basic CPU types without company name. - # Some are omitted here because they have special meanings below. - 1750a | 580 \ - | a29k \ - | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ - | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ - | am33_2.0 \ - | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ - | c4x | clipper \ - | d10v | d30v | dlx | dsp16xx \ - | fr30 | frv \ - | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ - | i370 | i860 | i960 | ia64 \ - | ip2k | iq2000 \ - | m32r | m68000 | m68k | m88k | mcore \ - | mips | mipsbe | mipseb | mipsel | mipsle \ - | mips16 \ - | mips64 | mips64el \ - | mips64vr | mips64vrel \ - | mips64orion | mips64orionel \ - | mips64vr4100 | mips64vr4100el \ - | mips64vr4300 | mips64vr4300el \ - | mips64vr5000 | mips64vr5000el \ - | mipsisa32 | mipsisa32el \ - | mipsisa32r2 | mipsisa32r2el \ - | mipsisa64 | mipsisa64el \ - | mipsisa64r2 | mipsisa64r2el \ - | mipsisa64sb1 | mipsisa64sb1el \ - | mipsisa64sr71k | mipsisa64sr71kel \ - | mipstx39 | mipstx39el \ - | mn10200 | mn10300 \ - | msp430 \ - | ns16k | ns32k \ - | openrisc | or32 \ - | pdp10 | pdp11 | pj | pjl \ - | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ - | pyramid \ - | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ - | sh64 | sh64le \ - | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \ - | strongarm \ - | tahoe | thumb | tic4x | tic80 | tron \ - | v850 | v850e \ - | we32k \ - | x86 | xscale | xstormy16 | xtensa \ - | z8k) - basic_machine=$basic_machine-unknown - ;; - m6811 | m68hc11 | m6812 | m68hc12) - # Motorola 68HC11/12. - basic_machine=$basic_machine-unknown - os=-none - ;; - m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) - ;; - - # We use `pc' rather than `unknown' - # because (1) that's what they normally are, and - # (2) the word "unknown" tends to confuse beginning users. - i*86 | x86_64) - basic_machine=$basic_machine-pc - ;; - # Object if more than one company name word. - *-*-*) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; - # Recognize the basic CPU types with company name. - 580-* \ - | a29k-* \ - | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ - | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ - | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ - | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ - | avr-* \ - | bs2000-* \ - | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ - | clipper-* | cydra-* \ - | d10v-* | d30v-* | dlx-* \ - | elxsi-* \ - | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ - | h8300-* | h8500-* \ - | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ - | i*86-* | i860-* | i960-* | ia64-* \ - | ip2k-* | iq2000-* \ - | m32r-* \ - | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | mcore-* \ - | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ - | mips16-* \ - | mips64-* | mips64el-* \ - | mips64vr-* | mips64vrel-* \ - | mips64orion-* | mips64orionel-* \ - | mips64vr4100-* | mips64vr4100el-* \ - | mips64vr4300-* | mips64vr4300el-* \ - | mips64vr5000-* | mips64vr5000el-* \ - | mipsisa32-* | mipsisa32el-* \ - | mipsisa32r2-* | mipsisa32r2el-* \ - | mipsisa64-* | mipsisa64el-* \ - | mipsisa64r2-* | mipsisa64r2el-* \ - | mipsisa64sb1-* | mipsisa64sb1el-* \ - | mipsisa64sr71k-* | mipsisa64sr71kel-* \ - | mipstx39-* | mipstx39el-* \ - | msp430-* \ - | none-* | np1-* | nv1-* | ns16k-* | ns32k-* \ - | orion-* \ - | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ - | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ - | pyramid-* \ - | romp-* | rs6000-* \ - | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \ - | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ - | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ - | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ - | tahoe-* | thumb-* \ - | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ - | tron-* \ - | v850-* | v850e-* | vax-* \ - | we32k-* \ - | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \ - | xtensa-* \ - | ymp-* \ - | z8k-*) - ;; - # Recognize the various machine names and aliases which stand - # for a CPU type and a company and sometimes even an OS. - 386bsd) - basic_machine=i386-unknown - os=-bsd - ;; - 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) - basic_machine=m68000-att - ;; - 3b*) - basic_machine=we32k-att - ;; - a29khif) - basic_machine=a29k-amd - os=-udi - ;; - adobe68k) - basic_machine=m68010-adobe - os=-scout - ;; - alliant | fx80) - basic_machine=fx80-alliant - ;; - altos | altos3068) - basic_machine=m68k-altos - ;; - am29k) - basic_machine=a29k-none - os=-bsd - ;; - amd64) - basic_machine=x86_64-pc - ;; - amd64-*) - basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - amdahl) - basic_machine=580-amdahl - os=-sysv - ;; - amiga | amiga-*) - basic_machine=m68k-unknown - ;; - amigaos | amigados) - basic_machine=m68k-unknown - os=-amigaos - ;; - amigaunix | amix) - basic_machine=m68k-unknown - os=-sysv4 - ;; - apollo68) - basic_machine=m68k-apollo - os=-sysv - ;; - apollo68bsd) - basic_machine=m68k-apollo - os=-bsd - ;; - aux) - basic_machine=m68k-apple - os=-aux - ;; - balance) - basic_machine=ns32k-sequent - os=-dynix - ;; - c90) - basic_machine=c90-cray - os=-unicos - ;; - convex-c1) - basic_machine=c1-convex - os=-bsd - ;; - convex-c2) - basic_machine=c2-convex - os=-bsd - ;; - convex-c32) - basic_machine=c32-convex - os=-bsd - ;; - convex-c34) - basic_machine=c34-convex - os=-bsd - ;; - convex-c38) - basic_machine=c38-convex - os=-bsd - ;; - cray | j90) - basic_machine=j90-cray - os=-unicos - ;; - crds | unos) - basic_machine=m68k-crds - ;; - cris | cris-* | etrax*) - basic_machine=cris-axis - ;; - da30 | da30-*) - basic_machine=m68k-da30 - ;; - decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) - basic_machine=mips-dec - ;; - decsystem10* | dec10*) - basic_machine=pdp10-dec - os=-tops10 - ;; - decsystem20* | dec20*) - basic_machine=pdp10-dec - os=-tops20 - ;; - delta | 3300 | motorola-3300 | motorola-delta \ - | 3300-motorola | delta-motorola) - basic_machine=m68k-motorola - ;; - delta88) - basic_machine=m88k-motorola - os=-sysv3 - ;; - dpx20 | dpx20-*) - basic_machine=rs6000-bull - os=-bosx - ;; - dpx2* | dpx2*-bull) - basic_machine=m68k-bull - os=-sysv3 - ;; - ebmon29k) - basic_machine=a29k-amd - os=-ebmon - ;; - elxsi) - basic_machine=elxsi-elxsi - os=-bsd - ;; - encore | umax | mmax) - basic_machine=ns32k-encore - ;; - es1800 | OSE68k | ose68k | ose | OSE) - basic_machine=m68k-ericsson - os=-ose - ;; - fx2800) - basic_machine=i860-alliant - ;; - genix) - basic_machine=ns32k-ns - ;; - gmicro) - basic_machine=tron-gmicro - os=-sysv - ;; - go32) - basic_machine=i386-pc - os=-go32 - ;; - h3050r* | hiux*) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - h8300hms) - basic_machine=h8300-hitachi - os=-hms - ;; - h8300xray) - basic_machine=h8300-hitachi - os=-xray - ;; - h8500hms) - basic_machine=h8500-hitachi - os=-hms - ;; - harris) - basic_machine=m88k-harris - os=-sysv3 - ;; - hp300-*) - basic_machine=m68k-hp - ;; - hp300bsd) - basic_machine=m68k-hp - os=-bsd - ;; - hp300hpux) - basic_machine=m68k-hp - os=-hpux - ;; - hp3k9[0-9][0-9] | hp9[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k2[0-9][0-9] | hp9k31[0-9]) - basic_machine=m68000-hp - ;; - hp9k3[2-9][0-9]) - basic_machine=m68k-hp - ;; - hp9k6[0-9][0-9] | hp6[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k7[0-79][0-9] | hp7[0-79][0-9]) - basic_machine=hppa1.1-hp - ;; - hp9k78[0-9] | hp78[0-9]) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][13679] | hp8[0-9][13679]) - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][0-9] | hp8[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hppa-next) - os=-nextstep3 - ;; - hppaosf) - basic_machine=hppa1.1-hp - os=-osf - ;; - hppro) - basic_machine=hppa1.1-hp - os=-proelf - ;; - i370-ibm* | ibm*) - basic_machine=i370-ibm - ;; -# I'm not sure what "Sysv32" means. Should this be sysv3.2? - i*86v32) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv32 - ;; - i*86v4*) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv4 - ;; - i*86v) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv - ;; - i*86sol2) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-solaris2 - ;; - i386mach) - basic_machine=i386-mach - os=-mach - ;; - i386-vsta | vsta) - basic_machine=i386-unknown - os=-vsta - ;; - iris | iris4d) - basic_machine=mips-sgi - case $os in - -irix*) - ;; - *) - os=-irix4 - ;; - esac - ;; - isi68 | isi) - basic_machine=m68k-isi - os=-sysv - ;; - m88k-omron*) - basic_machine=m88k-omron - ;; - magnum | m3230) - basic_machine=mips-mips - os=-sysv - ;; - merlin) - basic_machine=ns32k-utek - os=-sysv - ;; - mingw32) - basic_machine=i386-pc - os=-mingw32 - ;; - miniframe) - basic_machine=m68000-convergent - ;; - *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; - mips3*-*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` - ;; - mips3*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown - ;; - mmix*) - basic_machine=mmix-knuth - os=-mmixware - ;; - monitor) - basic_machine=m68k-rom68k - os=-coff - ;; - morphos) - basic_machine=powerpc-unknown - os=-morphos - ;; - msdos) - basic_machine=i386-pc - os=-msdos - ;; - mvs) - basic_machine=i370-ibm - os=-mvs - ;; - ncr3000) - basic_machine=i486-ncr - os=-sysv4 - ;; - netbsd386) - basic_machine=i386-unknown - os=-netbsd - ;; - netwinder) - basic_machine=armv4l-rebel - os=-linux - ;; - news | news700 | news800 | news900) - basic_machine=m68k-sony - os=-newsos - ;; - news1000) - basic_machine=m68030-sony - os=-newsos - ;; - news-3600 | risc-news) - basic_machine=mips-sony - os=-newsos - ;; - necv70) - basic_machine=v70-nec - os=-sysv - ;; - next | m*-next ) - basic_machine=m68k-next - case $os in - -nextstep* ) - ;; - -ns2*) - os=-nextstep2 - ;; - *) - os=-nextstep3 - ;; - esac - ;; - nh3000) - basic_machine=m68k-harris - os=-cxux - ;; - nh[45]000) - basic_machine=m88k-harris - os=-cxux - ;; - nindy960) - basic_machine=i960-intel - os=-nindy - ;; - mon960) - basic_machine=i960-intel - os=-mon960 - ;; - nonstopux) - basic_machine=mips-compaq - os=-nonstopux - ;; - np1) - basic_machine=np1-gould - ;; - nv1) - basic_machine=nv1-cray - os=-unicosmp - ;; - nsr-tandem) - basic_machine=nsr-tandem - ;; - op50n-* | op60c-*) - basic_machine=hppa1.1-oki - os=-proelf - ;; - or32 | or32-*) - basic_machine=or32-unknown - os=-coff - ;; - os400) - basic_machine=powerpc-ibm - os=-os400 - ;; - OSE68000 | ose68000) - basic_machine=m68000-ericsson - os=-ose - ;; - os68k) - basic_machine=m68k-none - os=-os68k - ;; - pa-hitachi) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - paragon) - basic_machine=i860-intel - os=-osf - ;; - pbd) - basic_machine=sparc-tti - ;; - pbb) - basic_machine=m68k-tti - ;; - pc532 | pc532-*) - basic_machine=ns32k-pc532 - ;; - pentium | p5 | k5 | k6 | nexgen | viac3) - basic_machine=i586-pc - ;; - pentiumpro | p6 | 6x86 | athlon | athlon_*) - basic_machine=i686-pc - ;; - pentiumii | pentium2 | pentiumiii | pentium3) - basic_machine=i686-pc - ;; - pentium4) - basic_machine=i786-pc - ;; - pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) - basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumpro-* | p6-* | 6x86-* | athlon-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentium4-*) - basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pn) - basic_machine=pn-gould - ;; - power) basic_machine=power-ibm - ;; - ppc) basic_machine=powerpc-unknown - ;; - ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppcle | powerpclittle | ppc-le | powerpc-little) - basic_machine=powerpcle-unknown - ;; - ppcle-* | powerpclittle-*) - basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppc64) basic_machine=powerpc64-unknown - ;; - ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppc64le | powerpc64little | ppc64-le | powerpc64-little) - basic_machine=powerpc64le-unknown - ;; - ppc64le-* | powerpc64little-*) - basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ps2) - basic_machine=i386-ibm - ;; - pw32) - basic_machine=i586-unknown - os=-pw32 - ;; - rom68k) - basic_machine=m68k-rom68k - os=-coff - ;; - rm[46]00) - basic_machine=mips-siemens - ;; - rtpc | rtpc-*) - basic_machine=romp-ibm - ;; - s390 | s390-*) - basic_machine=s390-ibm - ;; - s390x | s390x-*) - basic_machine=s390x-ibm - ;; - sa29200) - basic_machine=a29k-amd - os=-udi - ;; - sb1) - basic_machine=mipsisa64sb1-unknown - ;; - sb1el) - basic_machine=mipsisa64sb1el-unknown - ;; - sei) - basic_machine=mips-sei - os=-seiux - ;; - sequent) - basic_machine=i386-sequent - ;; - sh) - basic_machine=sh-hitachi - os=-hms - ;; - sh64) - basic_machine=sh64-unknown - ;; - sparclite-wrs | simso-wrs) - basic_machine=sparclite-wrs - os=-vxworks - ;; - sps7) - basic_machine=m68k-bull - os=-sysv2 - ;; - spur) - basic_machine=spur-unknown - ;; - st2000) - basic_machine=m68k-tandem - ;; - stratus) - basic_machine=i860-stratus - os=-sysv4 - ;; - sun2) - basic_machine=m68000-sun - ;; - sun2os3) - basic_machine=m68000-sun - os=-sunos3 - ;; - sun2os4) - basic_machine=m68000-sun - os=-sunos4 - ;; - sun3os3) - basic_machine=m68k-sun - os=-sunos3 - ;; - sun3os4) - basic_machine=m68k-sun - os=-sunos4 - ;; - sun4os3) - basic_machine=sparc-sun - os=-sunos3 - ;; - sun4os4) - basic_machine=sparc-sun - os=-sunos4 - ;; - sun4sol2) - basic_machine=sparc-sun - os=-solaris2 - ;; - sun3 | sun3-*) - basic_machine=m68k-sun - ;; - sun4) - basic_machine=sparc-sun - ;; - sun386 | sun386i | roadrunner) - basic_machine=i386-sun - ;; - sv1) - basic_machine=sv1-cray - os=-unicos - ;; - symmetry) - basic_machine=i386-sequent - os=-dynix - ;; - t3e) - basic_machine=alphaev5-cray - os=-unicos - ;; - t90) - basic_machine=t90-cray - os=-unicos - ;; - tic54x | c54x*) - basic_machine=tic54x-unknown - os=-coff - ;; - tic55x | c55x*) - basic_machine=tic55x-unknown - os=-coff - ;; - tic6x | c6x*) - basic_machine=tic6x-unknown - os=-coff - ;; - tx39) - basic_machine=mipstx39-unknown - ;; - tx39el) - basic_machine=mipstx39el-unknown - ;; - toad1) - basic_machine=pdp10-xkl - os=-tops20 - ;; - tower | tower-32) - basic_machine=m68k-ncr - ;; - tpf) - basic_machine=s390x-ibm - os=-tpf - ;; - udi29k) - basic_machine=a29k-amd - os=-udi - ;; - ultra3) - basic_machine=a29k-nyu - os=-sym1 - ;; - v810 | necv810) - basic_machine=v810-nec - os=-none - ;; - vaxv) - basic_machine=vax-dec - os=-sysv - ;; - vms) - basic_machine=vax-dec - os=-vms - ;; - vpp*|vx|vx-*) - basic_machine=f301-fujitsu - ;; - vxworks960) - basic_machine=i960-wrs - os=-vxworks - ;; - vxworks68) - basic_machine=m68k-wrs - os=-vxworks - ;; - vxworks29k) - basic_machine=a29k-wrs - os=-vxworks - ;; - w65*) - basic_machine=w65-wdc - os=-none - ;; - w89k-*) - basic_machine=hppa1.1-winbond - os=-proelf - ;; - xps | xps100) - basic_machine=xps100-honeywell - ;; - ymp) - basic_machine=ymp-cray - os=-unicos - ;; - z8k-*-coff) - basic_machine=z8k-unknown - os=-sim - ;; - none) - basic_machine=none-none - os=-none - ;; - -# Here we handle the default manufacturer of certain CPU types. It is in -# some cases the only manufacturer, in others, it is the most popular. - w89k) - basic_machine=hppa1.1-winbond - ;; - op50n) - basic_machine=hppa1.1-oki - ;; - op60c) - basic_machine=hppa1.1-oki - ;; - romp) - basic_machine=romp-ibm - ;; - rs6000) - basic_machine=rs6000-ibm - ;; - vax) - basic_machine=vax-dec - ;; - pdp10) - # there are many clones, so DEC is not a safe bet - basic_machine=pdp10-unknown - ;; - pdp11) - basic_machine=pdp11-dec - ;; - we32k) - basic_machine=we32k-att - ;; - sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele) - basic_machine=sh-unknown - ;; - sh64) - basic_machine=sh64-unknown - ;; - sparc | sparcv9 | sparcv9b) - basic_machine=sparc-sun - ;; - cydra) - basic_machine=cydra-cydrome - ;; - orion) - basic_machine=orion-highlevel - ;; - orion105) - basic_machine=clipper-highlevel - ;; - mac | mpw | mac-mpw) - basic_machine=m68k-apple - ;; - pmac | pmac-mpw) - basic_machine=powerpc-apple - ;; - *-unknown) - # Make sure to match an already-canonicalized machine name. - ;; - *) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; -esac - -# Here we canonicalize certain aliases for manufacturers. -case $basic_machine in - *-digital*) - basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` - ;; - *-commodore*) - basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` - ;; - *) - ;; -esac - -# Decode manufacturer-specific aliases for certain operating systems. - -if [ x"$os" != x"" ] -then -case $os in - # First match some system type aliases - # that might get confused with valid system types. - # -solaris* is a basic system type, with this one exception. - -solaris1 | -solaris1.*) - os=`echo $os | sed -e 's|solaris1|sunos4|'` - ;; - -solaris) - os=-solaris2 - ;; - -svr4*) - os=-sysv4 - ;; - -unixware*) - os=-sysv4.2uw - ;; - -gnu/linux*) - os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` - ;; - # First accept the basic system types. - # The portable systems comes first. - # Each alternative MUST END IN A *, to match a version number. - # -sysv* is not here because it comes later, after sysvr4. - -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ - | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ - | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ - | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* \ - | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ - | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ - | -hiux* | -386bsd* | -knetbsd* | -netbsd* | -openbsd* | -kfreebsd* | -freebsd* | -riscix* \ - | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ - | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ - | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -chorusos* | -chorusrdb* \ - | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \ - | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ - | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ - | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ - | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ - | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ - | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly*) - # Remember, each alternative MUST END IN *, to match a version number. - ;; - -qnx*) - case $basic_machine in - x86-* | i*86-*) - ;; - *) - os=-nto$os - ;; - esac - ;; - -nto-qnx*) - ;; - -nto*) - os=`echo $os | sed -e 's|nto|nto-qnx|'` - ;; - -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ - | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ - | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) - ;; - -mac*) - os=`echo $os | sed -e 's|mac|macos|'` - ;; - -linux-dietlibc) - os=-linux-dietlibc - ;; - -linux*) - os=`echo $os | sed -e 's|linux|linux-gnu|'` - ;; - -sunos5*) - os=`echo $os | sed -e 's|sunos5|solaris2|'` - ;; - -sunos6*) - os=`echo $os | sed -e 's|sunos6|solaris3|'` - ;; - -opened*) - os=-openedition - ;; - -os400*) - os=-os400 - ;; - -wince*) - os=-wince - ;; - -osfrose*) - os=-osfrose - ;; - -osf*) - os=-osf - ;; - -utek*) - os=-bsd - ;; - -dynix*) - os=-bsd - ;; - -acis*) - os=-aos - ;; - -atheos*) - os=-atheos - ;; - -syllable*) - os=-syllable - ;; - -386bsd) - os=-bsd - ;; - -ctix* | -uts*) - os=-sysv - ;; - -nova*) - os=-rtmk-nova - ;; - -ns2 ) - os=-nextstep2 - ;; - -nsk*) - os=-nsk - ;; - # Preserve the version number of sinix5. - -sinix5.*) - os=`echo $os | sed -e 's|sinix|sysv|'` - ;; - -sinix*) - os=-sysv4 - ;; - -tpf*) - os=-tpf - ;; - -triton*) - os=-sysv3 - ;; - -oss*) - os=-sysv3 - ;; - -svr4) - os=-sysv4 - ;; - -svr3) - os=-sysv3 - ;; - -sysvr4) - os=-sysv4 - ;; - # This must come after -sysvr4. - -sysv*) - ;; - -ose*) - os=-ose - ;; - -es1800*) - os=-ose - ;; - -xenix) - os=-xenix - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - os=-mint - ;; - -aros*) - os=-aros - ;; - -kaos*) - os=-kaos - ;; - -none) - ;; - *) - # Get rid of the `-' at the beginning of $os. - os=`echo $os | sed 's/[^-]*-//'` - echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 - exit 1 - ;; -esac -else - -# Here we handle the default operating systems that come with various machines. -# The value should be what the vendor currently ships out the door with their -# machine or put another way, the most popular os provided with the machine. - -# Note that if you're going to try to match "-MANUFACTURER" here (say, -# "-sun"), then you have to tell the case statement up towards the top -# that MANUFACTURER isn't an operating system. Otherwise, code above -# will signal an error saying that MANUFACTURER isn't an operating -# system, and we'll never get to this point. - -case $basic_machine in - *-acorn) - os=-riscix1.2 - ;; - arm*-rebel) - os=-linux - ;; - arm*-semi) - os=-aout - ;; - c4x-* | tic4x-*) - os=-coff - ;; - # This must come before the *-dec entry. - pdp10-*) - os=-tops20 - ;; - pdp11-*) - os=-none - ;; - *-dec | vax-*) - os=-ultrix4.2 - ;; - m68*-apollo) - os=-domain - ;; - i386-sun) - os=-sunos4.0.2 - ;; - m68000-sun) - os=-sunos3 - # This also exists in the configure program, but was not the - # default. - # os=-sunos4 - ;; - m68*-cisco) - os=-aout - ;; - mips*-cisco) - os=-elf - ;; - mips*-*) - os=-elf - ;; - or32-*) - os=-coff - ;; - *-tti) # must be before sparc entry or we get the wrong os. - os=-sysv3 - ;; - sparc-* | *-sun) - os=-sunos4.1.1 - ;; - *-be) - os=-beos - ;; - *-ibm) - os=-aix - ;; - *-wec) - os=-proelf - ;; - *-winbond) - os=-proelf - ;; - *-oki) - os=-proelf - ;; - *-hp) - os=-hpux - ;; - *-hitachi) - os=-hiux - ;; - i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) - os=-sysv - ;; - *-cbm) - os=-amigaos - ;; - *-dg) - os=-dgux - ;; - *-dolphin) - os=-sysv3 - ;; - m68k-ccur) - os=-rtu - ;; - m88k-omron*) - os=-luna - ;; - *-next ) - os=-nextstep - ;; - *-sequent) - os=-ptx - ;; - *-crds) - os=-unos - ;; - *-ns) - os=-genix - ;; - i370-*) - os=-mvs - ;; - *-next) - os=-nextstep3 - ;; - *-gould) - os=-sysv - ;; - *-highlevel) - os=-bsd - ;; - *-encore) - os=-bsd - ;; - *-sgi) - os=-irix - ;; - *-siemens) - os=-sysv4 - ;; - *-masscomp) - os=-rtu - ;; - f30[01]-fujitsu | f700-fujitsu) - os=-uxpv - ;; - *-rom68k) - os=-coff - ;; - *-*bug) - os=-coff - ;; - *-apple) - os=-macos - ;; - *-atari*) - os=-mint - ;; - *) - os=-none - ;; -esac -fi - -# Here we handle the case where we know the os, and the CPU type, but not the -# manufacturer. We pick the logical manufacturer. -vendor=unknown -case $basic_machine in - *-unknown) - case $os in - -riscix*) - vendor=acorn - ;; - -sunos*) - vendor=sun - ;; - -aix*) - vendor=ibm - ;; - -beos*) - vendor=be - ;; - -hpux*) - vendor=hp - ;; - -mpeix*) - vendor=hp - ;; - -hiux*) - vendor=hitachi - ;; - -unos*) - vendor=crds - ;; - -dgux*) - vendor=dg - ;; - -luna*) - vendor=omron - ;; - -genix*) - vendor=ns - ;; - -mvs* | -opened*) - vendor=ibm - ;; - -os400*) - vendor=ibm - ;; - -ptx*) - vendor=sequent - ;; - -tpf*) - vendor=ibm - ;; - -vxsim* | -vxworks* | -windiss*) - vendor=wrs - ;; - -aux*) - vendor=apple - ;; - -hms*) - vendor=hitachi - ;; - -mpw* | -macos*) - vendor=apple - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - vendor=atari - ;; - -vos*) - vendor=stratus - ;; - esac - basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` - ;; -esac - -echo $basic_machine$os -exit 0 - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff --git a/usr/src/grub/grub-0.95/configure b/usr/src/grub/grub-0.95/configure deleted file mode 100755 index 9aa2aa97ec..0000000000 --- a/usr/src/grub/grub-0.95/configure +++ /dev/null @@ -1,7531 +0,0 @@ -#! /bin/sh -# Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.59 for GRUB 0.95. -# -# Report bugs to . -# -# Copyright (C) 2003 Free Software Foundation, Inc. -# This configure script is free software; the Free Software Foundation -# gives unlimited permission to copy, distribute and modify it. -## --------------------- ## -## M4sh Initialization. ## -## --------------------- ## - -# Be Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' -elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then - set -o posix -fi -DUALCASE=1; export DUALCASE # for MKS sh - -# Support unset when possible. -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false -fi - - -# Work around bugs in pre-3.0 UWIN ksh. -$as_unset ENV MAIL MAILPATH -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -for as_var in \ - LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ - LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ - LC_TELEPHONE LC_TIME -do - if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then - eval $as_var=C; export $as_var - else - $as_unset $as_var - fi -done - -# Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - -if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - - -# Name of the executable. -as_me=`$as_basename "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)$' \| \ - . : '\(.\)' 2>/dev/null || -echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } - /^X\/\(\/\/\)$/{ s//\1/; q; } - /^X\/\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - - -# PATH needs CR, and LINENO needs CR and PATH. -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' - else - PATH_SEPARATOR=: - fi - rm -f conf$$.sh -fi - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" || { - # Find who we are. Look in the path if we contain no path at all - # relative or not. - case $0 in - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break -done - - ;; - esac - # We did not find ourselves, most probably we were run as `sh COMMAND' - # in which case we are not to be found in the path. - if test "x$as_myself" = x; then - as_myself=$0 - fi - if test ! -f "$as_myself"; then - { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 - { (exit 1); exit 1; }; } - fi - case $CONFIG_SHELL in - '') - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for as_base in sh bash ksh sh5; do - case $as_dir in - /*) - if ("$as_dir/$as_base" -c ' - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then - $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } - $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } - CONFIG_SHELL=$as_dir/$as_base - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$0" ${1+"$@"} - fi;; - esac - done -done -;; - esac - - # Create $as_me.lineno as a copy of $as_myself, but with $LINENO - # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line before each line; the second 'sed' does the real - # work. The second script uses 'N' to pair each line-number line - # with the numbered line, and appends trailing '-' during - # substitution so that $LINENO is not a special case at line end. - # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) - sed '=' <$as_myself | - sed ' - N - s,$,-, - : loop - s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, - t loop - s,-$,, - s,^['$as_cr_digits']*\n,, - ' >$as_me.lineno && - chmod +x $as_me.lineno || - { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 - { (exit 1); exit 1; }; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensible to this). - . ./$as_me.lineno - # Exit status is that of the last command. - exit -} - - -case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in - *c*,-n*) ECHO_N= ECHO_C=' -' ECHO_T=' ' ;; - *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; - *) ECHO_N= ECHO_C='\c' ECHO_T= ;; -esac - -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - -rm -f conf$$ conf$$.exe conf$$.file -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - # We could just check for DJGPP; but this test a) works b) is more generic - # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). - if test -f conf$$.exe; then - # Don't use ln at all; we don't have any links - as_ln_s='cp -p' - else - as_ln_s='ln -s' - fi -elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.file - -if mkdir -p . 2>/dev/null; then - as_mkdir_p=: -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -as_executable_p="test -f" - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - -# IFS -# We need space, tab and new line, in precisely that order. -as_nl=' -' -IFS=" $as_nl" - -# CDPATH. -$as_unset CDPATH - - -# Name of the host. -# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, -# so uname gets run too. -ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` - -exec 6>&1 - -# -# Initializations. -# -ac_default_prefix=/usr/local -ac_config_libobj_dir=. -cross_compiling=no -subdirs= -MFLAGS= -MAKEFLAGS= -SHELL=${CONFIG_SHELL-/bin/sh} - -# Maximum number of lines to put in a shell here document. -# This variable seems obsolete. It should probably be removed, and -# only ac_max_sed_lines should be used. -: ${ac_max_here_lines=38} - -# Identity of this package. -PACKAGE_NAME='GRUB' -PACKAGE_TARNAME='grub' -PACKAGE_VERSION='0.95' -PACKAGE_STRING='GRUB 0.95' -PACKAGE_BUGREPORT='bug-grub@gnu.org' - -ac_unique_file="stage2/stage2.c" -# Factoring default headers for most tests. -ac_includes_default="\ -#include -#if HAVE_SYS_TYPES_H -# include -#endif -#if HAVE_SYS_STAT_H -# include -#endif -#if STDC_HEADERS -# include -# include -#else -# if HAVE_STDLIB_H -# include -# endif -#endif -#if HAVE_STRING_H -# if !STDC_HEADERS && HAVE_MEMORY_H -# include -# endif -# include -#endif -#if HAVE_STRINGS_H -# include -#endif -#if HAVE_INTTYPES_H -# include -#else -# if HAVE_STDINT_H -# include -# endif -#endif -#if HAVE_UNISTD_H -# include -#endif" - -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot build build_cpu build_vendor build_os host host_cpu host_vendor host_os MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT PERL CC ac_ct_CC CFLAGS LDFLAGS CPPFLAGS EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CCAS RANLIB ac_ct_RANLIB STAGE1_CFLAGS STAGE2_CFLAGS GRUB_CFLAGS OBJCOPY ac_ct_OBJCOPY GRUB_LIBS CPP EGREP NETBOOT_SUPPORT_TRUE NETBOOT_SUPPORT_FALSE DISKLESS_SUPPORT_TRUE DISKLESS_SUPPORT_FALSE GRAPHICS_SUPPORT_TRUE GRAPHICS_SUPPORT_FALSE HERCULES_SUPPORT_TRUE HERCULES_SUPPORT_FALSE SERIAL_SUPPORT_TRUE SERIAL_SUPPORT_FALSE SERIAL_SPEED_SIMULATION_TRUE SERIAL_SPEED_SIMULATION_FALSE BUILD_EXAMPLE_KERNEL_TRUE BUILD_EXAMPLE_KERNEL_FALSE FSYS_CFLAGS NET_CFLAGS NET_EXTRAFLAGS NETBOOT_DRIVERS CCASFLAGS LIBOBJS LTLIBOBJS' -ac_subst_files='' - -# Initialize some variables set by options. -ac_init_help= -ac_init_version=false -# The variables have the same names as the options, with -# dashes changed to underlines. -cache_file=/dev/null -exec_prefix=NONE -no_create= -no_recursion= -prefix=NONE -program_prefix=NONE -program_suffix=NONE -program_transform_name=s,x,x, -silent= -site= -srcdir= -verbose= -x_includes=NONE -x_libraries=NONE - -# Installation directory options. -# These are left unexpanded so users can "make install exec_prefix=/foo" -# and all the variables that are supposed to be based on exec_prefix -# by default will actually change. -# Use braces instead of parens because sh, perl, etc. also accept them. -bindir='${exec_prefix}/bin' -sbindir='${exec_prefix}/sbin' -libexecdir='${exec_prefix}/libexec' -datadir='${prefix}/share' -sysconfdir='${prefix}/etc' -sharedstatedir='${prefix}/com' -localstatedir='${prefix}/var' -libdir='${exec_prefix}/lib' -includedir='${prefix}/include' -oldincludedir='/usr/include' -infodir='${prefix}/info' -mandir='${prefix}/man' - -ac_prev= -for ac_option -do - # If the previous option needs an argument, assign it. - if test -n "$ac_prev"; then - eval "$ac_prev=\$ac_option" - ac_prev= - continue - fi - - ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` - - # Accept the important Cygnus configure options, so we can diagnose typos. - - case $ac_option in - - -bindir | --bindir | --bindi | --bind | --bin | --bi) - ac_prev=bindir ;; - -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir=$ac_optarg ;; - - -build | --build | --buil | --bui | --bu) - ac_prev=build_alias ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build_alias=$ac_optarg ;; - - -cache-file | --cache-file | --cache-fil | --cache-fi \ - | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) - ac_prev=cache_file ;; - -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ - | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - cache_file=$ac_optarg ;; - - --config-cache | -C) - cache_file=config.cache ;; - - -datadir | --datadir | --datadi | --datad | --data | --dat | --da) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ - | --da=*) - datadir=$ac_optarg ;; - - -disable-* | --disable-*) - ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid feature name: $ac_feature" >&2 - { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/-/_/g'` - eval "enable_$ac_feature=no" ;; - - -enable-* | --enable-*) - ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid feature name: $ac_feature" >&2 - { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/-/_/g'` - case $ac_option in - *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; - *) ac_optarg=yes ;; - esac - eval "enable_$ac_feature='$ac_optarg'" ;; - - -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ - | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ - | --exec | --exe | --ex) - ac_prev=exec_prefix ;; - -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ - | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ - | --exec=* | --exe=* | --ex=*) - exec_prefix=$ac_optarg ;; - - -gas | --gas | --ga | --g) - # Obsolete; use --with-gas. - with_gas=yes ;; - - -help | --help | --hel | --he | -h) - ac_init_help=long ;; - -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) - ac_init_help=recursive ;; - -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) - ac_init_help=short ;; - - -host | --host | --hos | --ho) - ac_prev=host_alias ;; - -host=* | --host=* | --hos=* | --ho=*) - host_alias=$ac_optarg ;; - - -includedir | --includedir | --includedi | --included | --include \ - | --includ | --inclu | --incl | --inc) - ac_prev=includedir ;; - -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ - | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir=$ac_optarg ;; - - -infodir | --infodir | --infodi | --infod | --info | --inf) - ac_prev=infodir ;; - -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir=$ac_optarg ;; - - -libdir | --libdir | --libdi | --libd) - ac_prev=libdir ;; - -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir=$ac_optarg ;; - - -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ - | --libexe | --libex | --libe) - ac_prev=libexecdir ;; - -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ - | --libexe=* | --libex=* | --libe=*) - libexecdir=$ac_optarg ;; - - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst \ - | --locals | --local | --loca | --loc | --lo) - ac_prev=localstatedir ;; - -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* \ - | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) - localstatedir=$ac_optarg ;; - - -mandir | --mandir | --mandi | --mand | --man | --ma | --m) - ac_prev=mandir ;; - -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir=$ac_optarg ;; - - -nfp | --nfp | --nf) - # Obsolete; use --without-fp. - with_fp=no ;; - - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c | -n) - no_create=yes ;; - - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) - no_recursion=yes ;; - - -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ - | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ - | --oldin | --oldi | --old | --ol | --o) - ac_prev=oldincludedir ;; - -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ - | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ - | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir=$ac_optarg ;; - - -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) - ac_prev=prefix ;; - -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix=$ac_optarg ;; - - -program-prefix | --program-prefix | --program-prefi | --program-pref \ - | --program-pre | --program-pr | --program-p) - ac_prev=program_prefix ;; - -program-prefix=* | --program-prefix=* | --program-prefi=* \ - | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix=$ac_optarg ;; - - -program-suffix | --program-suffix | --program-suffi | --program-suff \ - | --program-suf | --program-su | --program-s) - ac_prev=program_suffix ;; - -program-suffix=* | --program-suffix=* | --program-suffi=* \ - | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix=$ac_optarg ;; - - -program-transform-name | --program-transform-name \ - | --program-transform-nam | --program-transform-na \ - | --program-transform-n | --program-transform- \ - | --program-transform | --program-transfor \ - | --program-transfo | --program-transf \ - | --program-trans | --program-tran \ - | --progr-tra | --program-tr | --program-t) - ac_prev=program_transform_name ;; - -program-transform-name=* | --program-transform-name=* \ - | --program-transform-nam=* | --program-transform-na=* \ - | --program-transform-n=* | --program-transform-=* \ - | --program-transform=* | --program-transfor=* \ - | --program-transfo=* | --program-transf=* \ - | --program-trans=* | --program-tran=* \ - | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name=$ac_optarg ;; - - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - silent=yes ;; - - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) - ac_prev=sbindir ;; - -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ - | --sbi=* | --sb=*) - sbindir=$ac_optarg ;; - - -sharedstatedir | --sharedstatedir | --sharedstatedi \ - | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ - | --sharedst | --shareds | --shared | --share | --shar \ - | --sha | --sh) - ac_prev=sharedstatedir ;; - -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ - | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ - | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ - | --sha=* | --sh=*) - sharedstatedir=$ac_optarg ;; - - -site | --site | --sit) - ac_prev=site ;; - -site=* | --site=* | --sit=*) - site=$ac_optarg ;; - - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir=$ac_optarg ;; - - -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ - | --syscon | --sysco | --sysc | --sys | --sy) - ac_prev=sysconfdir ;; - -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ - | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir=$ac_optarg ;; - - -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target_alias ;; - -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target_alias=$ac_optarg ;; - - -v | -verbose | --verbose | --verbos | --verbo | --verb) - verbose=yes ;; - - -version | --version | --versio | --versi | --vers | -V) - ac_init_version=: ;; - - -with-* | --with-*) - ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid package name: $ac_package" >&2 - { (exit 1); exit 1; }; } - ac_package=`echo $ac_package| sed 's/-/_/g'` - case $ac_option in - *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; - *) ac_optarg=yes ;; - esac - eval "with_$ac_package='$ac_optarg'" ;; - - -without-* | --without-*) - ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid package name: $ac_package" >&2 - { (exit 1); exit 1; }; } - ac_package=`echo $ac_package | sed 's/-/_/g'` - eval "with_$ac_package=no" ;; - - --x) - # Obsolete; use --with-x. - with_x=yes ;; - - -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ - | --x-incl | --x-inc | --x-in | --x-i) - ac_prev=x_includes ;; - -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ - | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) - x_includes=$ac_optarg ;; - - -x-libraries | --x-libraries | --x-librarie | --x-librari \ - | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) - ac_prev=x_libraries ;; - -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ - | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) - x_libraries=$ac_optarg ;; - - -*) { echo "$as_me: error: unrecognized option: $ac_option -Try \`$0 --help' for more information." >&2 - { (exit 1); exit 1; }; } - ;; - - *=*) - ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` - # Reject names that are not valid shell variable names. - expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 - { (exit 1); exit 1; }; } - ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` - eval "$ac_envvar='$ac_optarg'" - export $ac_envvar ;; - - *) - # FIXME: should be removed in autoconf 3.0. - echo "$as_me: WARNING: you should use --build, --host, --target" >&2 - expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} - ;; - - esac -done - -if test -n "$ac_prev"; then - ac_option=--`echo $ac_prev | sed 's/_/-/g'` - { echo "$as_me: error: missing argument to $ac_option" >&2 - { (exit 1); exit 1; }; } -fi - -# Be sure to have absolute paths. -for ac_var in exec_prefix prefix -do - eval ac_val=$`echo $ac_var` - case $ac_val in - [\\/$]* | ?:[\\/]* | NONE | '' ) ;; - *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 - { (exit 1); exit 1; }; };; - esac -done - -# Be sure to have absolute paths. -for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ - localstatedir libdir includedir oldincludedir infodir mandir -do - eval ac_val=$`echo $ac_var` - case $ac_val in - [\\/$]* | ?:[\\/]* ) ;; - *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 - { (exit 1); exit 1; }; };; - esac -done - -# There might be people who depend on the old broken behavior: `$host' -# used to hold the argument of --host etc. -# FIXME: To remove some day. -build=$build_alias -host=$host_alias -target=$target_alias - -# FIXME: To remove some day. -if test "x$host_alias" != x; then - if test "x$build_alias" = x; then - cross_compiling=maybe - echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. - If a cross compiler is detected then cross compile mode will be used." >&2 - elif test "x$build_alias" != "x$host_alias"; then - cross_compiling=yes - fi -fi - -ac_tool_prefix= -test -n "$host_alias" && ac_tool_prefix=$host_alias- - -test "$silent" = yes && exec 6>/dev/null - - -# Find the source files, if location was not specified. -if test -z "$srcdir"; then - ac_srcdir_defaulted=yes - # Try the directory containing this script, then its parent. - ac_confdir=`(dirname "$0") 2>/dev/null || -$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$0" : 'X\(//\)[^/]' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$0" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - srcdir=$ac_confdir - if test ! -r $srcdir/$ac_unique_file; then - srcdir=.. - fi -else - ac_srcdir_defaulted=no -fi -if test ! -r $srcdir/$ac_unique_file; then - if test "$ac_srcdir_defaulted" = yes; then - { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 - { (exit 1); exit 1; }; } - else - { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 - { (exit 1); exit 1; }; } - fi -fi -(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || - { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 - { (exit 1); exit 1; }; } -srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` -ac_env_build_alias_set=${build_alias+set} -ac_env_build_alias_value=$build_alias -ac_cv_env_build_alias_set=${build_alias+set} -ac_cv_env_build_alias_value=$build_alias -ac_env_host_alias_set=${host_alias+set} -ac_env_host_alias_value=$host_alias -ac_cv_env_host_alias_set=${host_alias+set} -ac_cv_env_host_alias_value=$host_alias -ac_env_target_alias_set=${target_alias+set} -ac_env_target_alias_value=$target_alias -ac_cv_env_target_alias_set=${target_alias+set} -ac_cv_env_target_alias_value=$target_alias -ac_env_CC_set=${CC+set} -ac_env_CC_value=$CC -ac_cv_env_CC_set=${CC+set} -ac_cv_env_CC_value=$CC -ac_env_CFLAGS_set=${CFLAGS+set} -ac_env_CFLAGS_value=$CFLAGS -ac_cv_env_CFLAGS_set=${CFLAGS+set} -ac_cv_env_CFLAGS_value=$CFLAGS -ac_env_LDFLAGS_set=${LDFLAGS+set} -ac_env_LDFLAGS_value=$LDFLAGS -ac_cv_env_LDFLAGS_set=${LDFLAGS+set} -ac_cv_env_LDFLAGS_value=$LDFLAGS -ac_env_CPPFLAGS_set=${CPPFLAGS+set} -ac_env_CPPFLAGS_value=$CPPFLAGS -ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} -ac_cv_env_CPPFLAGS_value=$CPPFLAGS -ac_env_CPP_set=${CPP+set} -ac_env_CPP_value=$CPP -ac_cv_env_CPP_set=${CPP+set} -ac_cv_env_CPP_value=$CPP - -# -# Report the --help message. -# -if test "$ac_init_help" = "long"; then - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat <<_ACEOF -\`configure' configures GRUB 0.95 to adapt to many kinds of systems. - -Usage: $0 [OPTION]... [VAR=VALUE]... - -To assign environment variables (e.g., CC, CFLAGS...), specify them as -VAR=VALUE. See below for descriptions of some of the useful variables. - -Defaults for the options are specified in brackets. - -Configuration: - -h, --help display this help and exit - --help=short display options specific to this package - --help=recursive display the short help of all the included packages - -V, --version display version information and exit - -q, --quiet, --silent do not print \`checking...' messages - --cache-file=FILE cache test results in FILE [disabled] - -C, --config-cache alias for \`--cache-file=config.cache' - -n, --no-create do not create output files - --srcdir=DIR find the sources in DIR [configure dir or \`..'] - -_ACEOF - - cat <<_ACEOF -Installation directories: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [PREFIX] - -By default, \`make install' will install all the files in -\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify -an installation prefix other than \`$ac_default_prefix' using \`--prefix', -for instance \`--prefix=\$HOME'. - -For better control, use the options below. - -Fine tuning of the installation directories: - --bindir=DIR user executables [EPREFIX/bin] - --sbindir=DIR system admin executables [EPREFIX/sbin] - --libexecdir=DIR program executables [EPREFIX/libexec] - --datadir=DIR read-only architecture-independent data [PREFIX/share] - --sysconfdir=DIR read-only single-machine data [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] - --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --libdir=DIR object code libraries [EPREFIX/lib] - --includedir=DIR C header files [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc [/usr/include] - --infodir=DIR info documentation [PREFIX/info] - --mandir=DIR man documentation [PREFIX/man] -_ACEOF - - cat <<\_ACEOF - -Program names: - --program-prefix=PREFIX prepend PREFIX to installed program names - --program-suffix=SUFFIX append SUFFIX to installed program names - --program-transform-name=PROGRAM run sed PROGRAM on installed program names - -System types: - --build=BUILD configure for building on BUILD [guessed] - --host=HOST cross-compile to build programs to run on HOST [BUILD] -_ACEOF -fi - -if test -n "$ac_init_help"; then - case $ac_init_help in - short | recursive ) echo "Configuration of GRUB 0.95:";; - esac - cat <<\_ACEOF - -Optional Features: - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --enable-maintainer-mode enable make rules and dependencies not useful - (and sometimes confusing) to the casual installer - --disable-dependency-tracking speeds up one-time build - --enable-dependency-tracking do not reject slow dependency extractors - --disable-ext2fs disable ext2fs support in Stage 2 - --disable-fat disable FAT support in Stage 2 - --disable-ffs disable FFS support in Stage 2 - --disable-ufs disable UFS support in Stage 2 - --disable-ufs2 disable UFS2 support in Stage 2 - --disable-minix disable Minix fs support in Stage 2 - --disable-reiserfs disable ReiserFS support in Stage 2 - --disable-vstafs disable VSTa FS support in Stage 2 - --disable-jfs disable IBM JFS support in Stage 2 - --disable-xfs disable SGI XFS support in Stage 2 - --disable-zfs disable ZFS support in Stage 2 - --disable-iso9660 disable ISO9660 support in Stage 2 - --disable-gunzip disable decompression in Stage 2 - --disable-md5-password disable MD5 password support in Stage 2 - --disable-packet-retransmission - turn off packet retransmission - --enable-pci-direct access PCI directly instead of using BIOS - --enable-3c595 enable 3Com595 driver - --enable-3c90x enable 3Com90x driver - --enable-davicom enable Davicom driver - --enable-e1000 enable Etherexpress Pro/1000 driver - --enable-eepro100 enable Etherexpress Pro/100 driver - --enable-epic100 enable SMC 83c170 EPIC/100 driver - --enable-forcedeth enable Nvidia Geforce driver - --enable-natsemi enable NatSemi DP8381x driver - --enable-ns83820 enable NS83820 driver - --enable-ns8390 enable NE2000 PCI driver - --enable-pcnet32 enable AMD Lance/PCI PCNet/32 driver - --enable-pnic enable Bochs Pseudo Nic driver - --enable-rtl8139 enable Realtek 8139 driver - --enable-r8169 enable Realtek 8169 driver - --enable-sis900 enable SIS 900 and SIS 7016 driver - --enable-sundance enable Sundance ST201 driver - --enable-tg3 enable Broadcom Tigon3 driver - --enable-tulip enable Tulip driver - --enable-tlan enable TI ThunderLAN driver - --enable-undi enable PXE UNDI driver - --enable-via-rhine enable Rhine-I/II driver - --enable-w89c840 enable Winbond W89c840 driver - --enable-compex-rl2000-fix - specify this if you have a Compex RL2000 PCI - --enable-ne-scan=LIST probe for NE base address using LIST - --enable-wd-default-mem=MEM - set the default memory location for WD/SMC - --enable-diskless enable diskless support - --disable-graphics disable graphics terminal support - --disable-hercules disable hercules terminal support - --disable-serial disable serial terminal support - --enable-serial-speed-simulation - simulate the slowness of a serial device - --enable-preset-menu=FILE - preset a menu file FILE in Stage 2 - --enable-example-kernel - build the example Multiboot kernel - --disable-auto-linux-mem-opt - don't pass Linux mem= option automatically - -Optional Packages: - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --with-binutils=DIR search the directory DIR to find binutils - --without-curses do not use curses - -Some influential environment variables: - CC C compiler command - CFLAGS C compiler flags - LDFLAGS linker flags, e.g. -L if you have libraries in a - nonstandard directory - CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have - headers in a nonstandard directory - CPP C preprocessor - -Use these variables to override the choices made by `configure' or to help -it to find libraries and programs with nonstandard names/locations. - -Report bugs to . -_ACEOF -fi - -if test "$ac_init_help" = "recursive"; then - # If there are subdirs, report their specific --help. - ac_popdir=`pwd` - for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue - test -d $ac_dir || continue - ac_builddir=. - -if test "$ac_dir" != .; then - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A "../" for each directory in $ac_dir_suffix. - ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` -else - ac_dir_suffix= ac_top_builddir= -fi - -case $srcdir in - .) # No --srcdir option. We are building in place. - ac_srcdir=. - if test -z "$ac_top_builddir"; then - ac_top_srcdir=. - else - ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` - fi ;; - [\\/]* | ?:[\\/]* ) # Absolute path. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir ;; - *) # Relative path. - ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_builddir$srcdir ;; -esac - -# Do not use `cd foo && pwd` to compute absolute paths, because -# the directories may not exist. -case `pwd` in -.) ac_abs_builddir="$ac_dir";; -*) - case "$ac_dir" in - .) ac_abs_builddir=`pwd`;; - [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; - *) ac_abs_builddir=`pwd`/"$ac_dir";; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_builddir=${ac_top_builddir}.;; -*) - case ${ac_top_builddir}. in - .) ac_abs_top_builddir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; - *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_srcdir=$ac_srcdir;; -*) - case $ac_srcdir in - .) ac_abs_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; - *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_srcdir=$ac_top_srcdir;; -*) - case $ac_top_srcdir in - .) ac_abs_top_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; - *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; - esac;; -esac - - cd $ac_dir - # Check for guested configure; otherwise get Cygnus style configure. - if test -f $ac_srcdir/configure.gnu; then - echo - $SHELL $ac_srcdir/configure.gnu --help=recursive - elif test -f $ac_srcdir/configure; then - echo - $SHELL $ac_srcdir/configure --help=recursive - elif test -f $ac_srcdir/configure.ac || - test -f $ac_srcdir/configure.in; then - echo - $ac_configure --help - else - echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 - fi - cd $ac_popdir - done -fi - -test -n "$ac_init_help" && exit 0 -if $ac_init_version; then - cat <<\_ACEOF -GRUB configure 0.95 -generated by GNU Autoconf 2.59 - -Copyright (C) 2003 Free Software Foundation, Inc. -This configure script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it. -_ACEOF - exit 0 -fi -exec 5>config.log -cat >&5 <<_ACEOF -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. - -It was created by GRUB $as_me 0.95, which was -generated by GNU Autoconf 2.59. Invocation command line was - - $ $0 $@ - -_ACEOF -{ -cat <<_ASUNAME -## --------- ## -## Platform. ## -## --------- ## - -hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` - -/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` -hostinfo = `(hostinfo) 2>/dev/null || echo unknown` -/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` -/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` - -_ASUNAME - -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - echo "PATH: $as_dir" -done - -} >&5 - -cat >&5 <<_ACEOF - - -## ----------- ## -## Core tests. ## -## ----------- ## - -_ACEOF - - -# Keep a trace of the command line. -# Strip out --no-create and --no-recursion so they do not pile up. -# Strip out --silent because we don't want to record it for future runs. -# Also quote any args containing shell meta-characters. -# Make two passes to allow for proper duplicate-argument suppression. -ac_configure_args= -ac_configure_args0= -ac_configure_args1= -ac_sep= -ac_must_keep_next=false -for ac_pass in 1 2 -do - for ac_arg - do - case $ac_arg in - -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - continue ;; - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) - ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - case $ac_pass in - 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; - 2) - ac_configure_args1="$ac_configure_args1 '$ac_arg'" - if test $ac_must_keep_next = true; then - ac_must_keep_next=false # Got value, back to normal. - else - case $ac_arg in - *=* | --config-cache | -C | -disable-* | --disable-* \ - | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ - | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ - | -with-* | --with-* | -without-* | --without-* | --x) - case "$ac_configure_args0 " in - "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; - esac - ;; - -* ) ac_must_keep_next=true ;; - esac - fi - ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" - # Get rid of the leading space. - ac_sep=" " - ;; - esac - done -done -$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } -$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } - -# When interrupted or exit'd, cleanup temporary files, and complete -# config.log. We remove comments because anyway the quotes in there -# would cause problems or look ugly. -# WARNING: Be sure not to use single quotes in there, as some shells, -# such as our DU 5.0 friend, will then `close' the trap. -trap 'exit_status=$? - # Save into config.log some information that might help in debugging. - { - echo - - cat <<\_ASBOX -## ---------------- ## -## Cache variables. ## -## ---------------- ## -_ASBOX - echo - # The following way of writing the cache mishandles newlines in values, -{ - (set) 2>&1 | - case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in - *ac_space=\ *) - sed -n \ - "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" - ;; - *) - sed -n \ - "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" - ;; - esac; -} - echo - - cat <<\_ASBOX -## ----------------- ## -## Output variables. ## -## ----------------- ## -_ASBOX - echo - for ac_var in $ac_subst_vars - do - eval ac_val=$`echo $ac_var` - echo "$ac_var='"'"'$ac_val'"'"'" - done | sort - echo - - if test -n "$ac_subst_files"; then - cat <<\_ASBOX -## ------------- ## -## Output files. ## -## ------------- ## -_ASBOX - echo - for ac_var in $ac_subst_files - do - eval ac_val=$`echo $ac_var` - echo "$ac_var='"'"'$ac_val'"'"'" - done | sort - echo - fi - - if test -s confdefs.h; then - cat <<\_ASBOX -## ----------- ## -## confdefs.h. ## -## ----------- ## -_ASBOX - echo - sed "/^$/d" confdefs.h | sort - echo - fi - test "$ac_signal" != 0 && - echo "$as_me: caught signal $ac_signal" - echo "$as_me: exit $exit_status" - } >&5 - rm -f core *.core && - rm -rf conftest* confdefs* conf$$* $ac_clean_files && - exit $exit_status - ' 0 -for ac_signal in 1 2 13 15; do - trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal -done -ac_signal=0 - -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -rf conftest* confdefs.h -# AIX cpp loses on an empty file, so make sure it contains at least a newline. -echo >confdefs.h - -# Predefined preprocessor variables. - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_NAME "$PACKAGE_NAME" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_TARNAME "$PACKAGE_TARNAME" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_VERSION "$PACKAGE_VERSION" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_STRING "$PACKAGE_STRING" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" -_ACEOF - - -# Let the site file select an alternate cache file if it wants to. -# Prefer explicitly selected file to automatically selected ones. -if test -z "$CONFIG_SITE"; then - if test "x$prefix" != xNONE; then - CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" - else - CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" - fi -fi -for ac_site_file in $CONFIG_SITE; do - if test -r "$ac_site_file"; then - { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 -echo "$as_me: loading site script $ac_site_file" >&6;} - sed 's/^/| /' "$ac_site_file" >&5 - . "$ac_site_file" - fi -done - -if test -r "$cache_file"; then - # Some versions of bash will fail to source /dev/null (special - # files actually), so we avoid doing that. - if test -f "$cache_file"; then - { echo "$as_me:$LINENO: loading cache $cache_file" >&5 -echo "$as_me: loading cache $cache_file" >&6;} - case $cache_file in - [\\/]* | ?:[\\/]* ) . $cache_file;; - *) . ./$cache_file;; - esac - fi -else - { echo "$as_me:$LINENO: creating cache $cache_file" >&5 -echo "$as_me: creating cache $cache_file" >&6;} - >$cache_file -fi - -# Check that the precious variables saved in the cache have kept the same -# value. -ac_cache_corrupted=false -for ac_var in `(set) 2>&1 | - sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do - eval ac_old_set=\$ac_cv_env_${ac_var}_set - eval ac_new_set=\$ac_env_${ac_var}_set - eval ac_old_val="\$ac_cv_env_${ac_var}_value" - eval ac_new_val="\$ac_env_${ac_var}_value" - case $ac_old_set,$ac_new_set in - set,) - { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,set) - { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 -echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,);; - *) - if test "x$ac_old_val" != "x$ac_new_val"; then - { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 -echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 -echo "$as_me: former value: $ac_old_val" >&2;} - { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 -echo "$as_me: current value: $ac_new_val" >&2;} - ac_cache_corrupted=: - fi;; - esac - # Pass precious variables to config.status. - if test "$ac_new_set" = set; then - case $ac_new_val in - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) - ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; - *) ac_arg=$ac_var=$ac_new_val ;; - esac - case " $ac_configure_args " in - *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. - *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; - esac - fi -done -if $ac_cache_corrupted; then - { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 -echo "$as_me: error: changes in the environment can compromise the build" >&2;} - { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 -echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} - { (exit 1); exit 1; }; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ac_config_headers="$ac_config_headers config.h" - -am__api_version="1.8" -ac_aux_dir= -for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do - if test -f $ac_dir/install-sh; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f $ac_dir/install.sh; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - elif test -f $ac_dir/shtool; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/shtool install -c" - break - fi -done -if test -z "$ac_aux_dir"; then - { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 -echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} - { (exit 1); exit 1; }; } -fi -ac_config_guess="$SHELL $ac_aux_dir/config.guess" -ac_config_sub="$SHELL $ac_aux_dir/config.sub" -ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. - -# Find a good install program. We prefer a C program (faster), -# so one script is as good as another. But avoid the broken or -# incompatible versions: -# SysV /etc/install, /usr/sbin/install -# SunOS /usr/etc/install -# IRIX /sbin/install -# AIX /bin/install -# AmigaOS /C/install, which installs bootblocks on floppy discs -# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag -# AFS /usr/afsws/bin/install, which mishandles nonexistent args -# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" -# OS/2's system install, which has a completely different semantic -# ./install, which can be erroneously created by make from ./install.sh. -echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 -echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 -if test -z "$INSTALL"; then -if test "${ac_cv_path_install+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - # Account for people who put trailing slashes in PATH elements. -case $as_dir/ in - ./ | .// | /cC/* | \ - /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ - ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ - /usr/ucb/* ) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - # Don't use installbsd from OSF since it installs stuff as root - # by default. - for ac_prog in ginstall scoinst install; do - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then - if test $ac_prog = install && - grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. - : - elif test $ac_prog = install && - grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # program-specific install script used by HP pwplus--don't use. - : - else - ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" - break 3 - fi - fi - done - done - ;; -esac -done - - -fi - if test "${ac_cv_path_install+set}" = set; then - INSTALL=$ac_cv_path_install - else - # As a last resort, use the slow shell script. We don't cache a - # path for INSTALL within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the path is relative. - INSTALL=$ac_install_sh - fi -fi -echo "$as_me:$LINENO: result: $INSTALL" >&5 -echo "${ECHO_T}$INSTALL" >&6 - -# Use test -z because SunOS4 sh mishandles braces in ${var-val}. -# It thinks the first close brace ends the variable substitution. -test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' - -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' - -test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' - -echo "$as_me:$LINENO: checking whether build environment is sane" >&5 -echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6 -# Just in case -sleep 1 -echo timestamp > conftest.file -# Do `set' in a subshell so we don't clobber the current shell's -# arguments. Must try -L first in case configure is actually a -# symlink; some systems play weird games with the mod time of symlinks -# (eg FreeBSD returns the mod time of the symlink's containing -# directory). -if ( - set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` - if test "$*" = "X"; then - # -L didn't work. - set X `ls -t $srcdir/configure conftest.file` - fi - rm -f conftest.file - if test "$*" != "X $srcdir/configure conftest.file" \ - && test "$*" != "X conftest.file $srcdir/configure"; then - - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken -alias in your environment" >&5 -echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken -alias in your environment" >&2;} - { (exit 1); exit 1; }; } - fi - - test "$2" = conftest.file - ) -then - # Ok. - : -else - { { echo "$as_me:$LINENO: error: newly created file is older than distributed files! -Check your system clock" >&5 -echo "$as_me: error: newly created file is older than distributed files! -Check your system clock" >&2;} - { (exit 1); exit 1; }; } -fi -echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -test "$program_prefix" != NONE && - program_transform_name="s,^,$program_prefix,;$program_transform_name" -# Use a double $ so make ignores it. -test "$program_suffix" != NONE && - program_transform_name="s,\$,$program_suffix,;$program_transform_name" -# Double any \ or $. echo might interpret backslashes. -# By default was `s,x,x', remove it if useless. -cat <<\_ACEOF >conftest.sed -s/[\\$]/&&/g;s/;s,x,x,$// -_ACEOF -program_transform_name=`echo $program_transform_name | sed -f conftest.sed` -rm conftest.sed - -# expand $ac_aux_dir to an absolute path -am_aux_dir=`cd $ac_aux_dir && pwd` - -test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" -# Use eval to expand $SHELL -if eval "$MISSING --run true"; then - am_missing_run="$MISSING --run " -else - am_missing_run= - { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 -echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} -fi - -if mkdir -p -- . 2>/dev/null; then - # Keeping the `.' argument allows $(mkdir_p) to be used without - # argument. Indeed, we sometimes output rules like - # $(mkdir_p) $(somedir) - # where $(somedir) is conditionally defined. - # (`test -n '$(somedir)' && $(mkdir_p) $(somedir)' is a more - # expensive solution, as it forces Make to start a sub-shell.) - mkdir_p='mkdir -p -- .' -else - # On NextStep and OpenStep, the `mkdir' command does not - # recognize any option. It will interpret all options as - # directories to create, and then abort because `.' already - # exists. - for d in ./-p ./--; - do - test -d $d && rmdir $d - done - # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. - if test -f "$ac_aux_dir/mkinstalldirs"; then - mkdir_p='$(mkinstalldirs)' - else - mkdir_p='$(install_sh) -d' - fi -fi - -for ac_prog in gawk mawk nawk awk -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_AWK+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$AWK"; then - ac_cv_prog_AWK="$AWK" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_AWK="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -AWK=$ac_cv_prog_AWK -if test -n "$AWK"; then - echo "$as_me:$LINENO: result: $AWK" >&5 -echo "${ECHO_T}$AWK" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$AWK" && break -done - -echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 -echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6 -set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'` -if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.make <<\_ACEOF -all: - @echo 'ac_maketemp="$(MAKE)"' -_ACEOF -# GNU make sometimes prints "make[1]: Entering...", which would confuse us. -eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` -if test -n "$ac_maketemp"; then - eval ac_cv_prog_make_${ac_make}_set=yes -else - eval ac_cv_prog_make_${ac_make}_set=no -fi -rm -f conftest.make -fi -if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - SET_MAKE= -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 - SET_MAKE="MAKE=${MAKE-make}" -fi - -rm -rf .tst 2>/dev/null -mkdir .tst 2>/dev/null -if test -d .tst; then - am__leading_dot=. -else - am__leading_dot=_ -fi -rmdir .tst 2>/dev/null - -# test to see if srcdir already configured -if test "`cd $srcdir && pwd`" != "`pwd`" && - test -f $srcdir/config.status; then - { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 -echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} - { (exit 1); exit 1; }; } -fi - -# test whether we have cygpath -if test -z "$CYGPATH_W"; then - if (cygpath --version) >/dev/null 2>/dev/null; then - CYGPATH_W='cygpath -w' - else - CYGPATH_W=echo - fi -fi - - -# Define the identity of the package. - PACKAGE='grub' - VERSION='0.95' - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE "$PACKAGE" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define VERSION "$VERSION" -_ACEOF - -# Some tools Automake needs. - -ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} - - -AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} - - -AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} - - -AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} - - -MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} - - -AMTAR=${AMTAR-"${am_missing_run}tar"} - -install_sh=${install_sh-"$am_aux_dir/install-sh"} - -# Installed binaries are usually stripped using `strip' when the user -# run `make install-strip'. However `strip' might not be the right -# tool to use in cross-compilation environments, therefore Automake -# will honor the `STRIP' environment variable to overrule this program. -if test "$cross_compiling" != no; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. -set dummy ${ac_tool_prefix}strip; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_STRIP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$STRIP"; then - ac_cv_prog_STRIP="$STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_STRIP="${ac_tool_prefix}strip" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -STRIP=$ac_cv_prog_STRIP -if test -n "$STRIP"; then - echo "$as_me:$LINENO: result: $STRIP" >&5 -echo "${ECHO_T}$STRIP" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -fi -if test -z "$ac_cv_prog_STRIP"; then - ac_ct_STRIP=$STRIP - # Extract the first word of "strip", so it can be a program name with args. -set dummy strip; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_STRIP"; then - ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_STRIP="strip" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - - test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":" -fi -fi -ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP -if test -n "$ac_ct_STRIP"; then - echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 -echo "${ECHO_T}$ac_ct_STRIP" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - STRIP=$ac_ct_STRIP -else - STRIP="$ac_cv_prog_STRIP" -fi - -fi -INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" - -# We need awk for the "check" target. The system "awk" is bad on -# some platforms. - - - - -# Make sure we can run config.sub. -$ac_config_sub sun4 >/dev/null 2>&1 || - { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5 -echo "$as_me: error: cannot run $ac_config_sub" >&2;} - { (exit 1); exit 1; }; } - -echo "$as_me:$LINENO: checking build system type" >&5 -echo $ECHO_N "checking build system type... $ECHO_C" >&6 -if test "${ac_cv_build+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_build_alias=$build_alias -test -z "$ac_cv_build_alias" && - ac_cv_build_alias=`$ac_config_guess` -test -z "$ac_cv_build_alias" && - { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 -echo "$as_me: error: cannot guess build type; you must specify one" >&2;} - { (exit 1); exit 1; }; } -ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || - { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5 -echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;} - { (exit 1); exit 1; }; } - -fi -echo "$as_me:$LINENO: result: $ac_cv_build" >&5 -echo "${ECHO_T}$ac_cv_build" >&6 -build=$ac_cv_build -build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` - - -echo "$as_me:$LINENO: checking host system type" >&5 -echo $ECHO_N "checking host system type... $ECHO_C" >&6 -if test "${ac_cv_host+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_host_alias=$host_alias -test -z "$ac_cv_host_alias" && - ac_cv_host_alias=$ac_cv_build_alias -ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || - { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5 -echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} - { (exit 1); exit 1; }; } - -fi -echo "$as_me:$LINENO: result: $ac_cv_host" >&5 -echo "${ECHO_T}$ac_cv_host" >&6 -host=$ac_cv_host -host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` - - - -case "$host_cpu" in -i[3456]86) host_cpu=i386 ;; -x86_64) host_cpu=x86_64 ;; -*) { { echo "$as_me:$LINENO: error: unsupported CPU type" >&5 -echo "$as_me: error: unsupported CPU type" >&2;} - { (exit 1); exit 1; }; } ;; -esac - - - - -# -# Options -# - -echo "$as_me:$LINENO: checking whether to enable maintainer-specific portions of Makefiles" >&5 -echo $ECHO_N "checking whether to enable maintainer-specific portions of Makefiles... $ECHO_C" >&6 - # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. -if test "${enable_maintainer_mode+set}" = set; then - enableval="$enable_maintainer_mode" - USE_MAINTAINER_MODE=$enableval -else - USE_MAINTAINER_MODE=no -fi; - echo "$as_me:$LINENO: result: $USE_MAINTAINER_MODE" >&5 -echo "${ECHO_T}$USE_MAINTAINER_MODE" >&6 - - -if test $USE_MAINTAINER_MODE = yes; then - MAINTAINER_MODE_TRUE= - MAINTAINER_MODE_FALSE='#' -else - MAINTAINER_MODE_TRUE='#' - MAINTAINER_MODE_FALSE= -fi - - MAINT=$MAINTAINER_MODE_TRUE - - -if test "x$enable_maintainer_mode" = xyes; then - # Extract the first word of "perl", so it can be a program name with args. -set dummy perl; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_path_PERL+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case $PERL in - [\\/]* | ?:[\\/]*) - ac_cv_path_PERL="$PERL" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_PERL="$as_dir/$ac_word$ac_exec_ext" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - - ;; -esac -fi -PERL=$ac_cv_path_PERL - -if test -n "$PERL"; then - echo "$as_me:$LINENO: result: $PERL" >&5 -echo "${ECHO_T}$PERL" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - if test -z "$PERL"; then - { { echo "$as_me:$LINENO: error: perl not found" >&5 -echo "$as_me: error: perl not found" >&2;} - { (exit 1); exit 1; }; } - fi -fi - -# This should be checked before AC_PROG_CC -if test "x$CFLAGS" = x; then - default_CFLAGS=yes -fi - -if test "x$host_cpu" = xx86_64; then - CFLAGS="-m32 $CFLAGS" -fi - -# -# Programs -# - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. -set dummy ${ac_tool_prefix}gcc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}gcc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="gcc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - CC=$ac_ct_CC -else - CC="$ac_cv_prog_CC" -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. -set dummy ${ac_tool_prefix}gcc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}gcc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="gcc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - CC=$ac_ct_CC -else - CC="$ac_cv_prog_CC" -fi - -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. -set dummy ${ac_tool_prefix}cc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - CC=$ac_ct_CC -else - CC="$ac_cv_prog_CC" -fi - -fi -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - ac_prog_rejected=no -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# != 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" - fi -fi -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - for ac_prog in cl - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$CC" && break - done -fi -if test -z "$CC"; then - ac_ct_CC=$CC - for ac_prog in cl -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$ac_ct_CC" && break -done - - CC=$ac_ct_CC -fi - -fi - - -test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&5 -echo "$as_me: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } - -# Provide some information about the compiler. -echo "$as_me:$LINENO:" \ - "checking for C compiler version" >&5 -ac_compiler=`set X $ac_compile; echo $2` -{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 - (eval $ac_compiler --version &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 - (eval $ac_compiler -v &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 - (eval $ac_compiler -V &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.exe b.out" -# Try to create an executable without -o first, disregard a.out. -# It will help us diagnose broken compilers, and finding out an intuition -# of exeext. -echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 -echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6 -ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` -if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 - (eval $ac_link_default) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # Find the output, starting from the most likely. This scheme is -# not robust to junk in `.', hence go to wildcards (a.*) only as a last -# resort. - -# Be careful to initialize this variable, since it used to be cached. -# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. -ac_cv_exeext= -# b.out is created by i960 compilers. -for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out -do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) - ;; - conftest.$ac_ext ) - # This is the source file. - ;; - [ab].out ) - # We found the default executable, but exeext='' is most - # certainly right. - break;; - *.* ) - ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - # FIXME: I believe we export ac_cv_exeext for Libtool, - # but it would be cool to find out if it's true. Does anybody - # maintain Libtool? --akim. - export ac_cv_exeext - break;; - * ) - break;; - esac -done -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { echo "$as_me:$LINENO: error: C compiler cannot create executables -See \`config.log' for more details." >&5 -echo "$as_me: error: C compiler cannot create executables -See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; } -fi - -ac_exeext=$ac_cv_exeext -echo "$as_me:$LINENO: result: $ac_file" >&5 -echo "${ECHO_T}$ac_file" >&6 - -# Check the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -echo "$as_me:$LINENO: checking whether the C compiler works" >&5 -echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 -# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 -# If not cross compiling, check that we can run a simple program. -if test "$cross_compiling" != yes; then - if { ac_try='./$ac_file' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { echo "$as_me:$LINENO: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } - fi - fi -fi -echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - -rm -f a.out a.exe conftest$ac_cv_exeext b.out -ac_clean_files=$ac_clean_files_save -# Check the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 -echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 -echo "$as_me:$LINENO: result: $cross_compiling" >&5 -echo "${ECHO_T}$cross_compiling" >&6 - -echo "$as_me:$LINENO: checking for suffix of executables" >&5 -echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # If both `conftest.exe' and `conftest' are `present' (well, observable) -# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will -# work properly (i.e., refer to `conftest.exe'), while it won't with -# `rm'. -for ac_file in conftest.exe conftest conftest.*; do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; - *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - export ac_cv_exeext - break;; - * ) break;; - esac -done -else - { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi - -rm -f conftest$ac_cv_exeext -echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 -echo "${ECHO_T}$ac_cv_exeext" >&6 - -rm -f conftest.$ac_ext -EXEEXT=$ac_cv_exeext -ac_exeext=$EXEEXT -echo "$as_me:$LINENO: checking for suffix of object files" >&5 -echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 -if test "${ac_cv_objext+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.o conftest.obj -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; - *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` - break;; - esac -done -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute suffix of object files: cannot compile -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi - -rm -f conftest.$ac_cv_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 -echo "${ECHO_T}$ac_cv_objext" >&6 -OBJEXT=$ac_cv_objext -ac_objext=$OBJEXT -echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 -echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 -if test "${ac_cv_c_compiler_gnu+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_compiler_gnu=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_compiler_gnu=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu - -fi -echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 -echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 -GCC=`test $ac_compiler_gnu = yes && echo yes` -ac_test_CFLAGS=${CFLAGS+set} -ac_save_CFLAGS=$CFLAGS -CFLAGS="-g" -echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 -echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 -if test "${ac_cv_prog_cc_g+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_prog_cc_g=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_prog_cc_g=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 -if test "$ac_test_CFLAGS" = set; then - CFLAGS=$ac_save_CFLAGS -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi -echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 -echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 -if test "${ac_cv_prog_cc_stdc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_prog_cc_stdc=no -ac_save_CC=$CC -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -#include -#include -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std1 is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std1. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; - -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} -_ACEOF -# Don't try gcc -ansi; that turns off useful extensions and -# breaks some systems' header files. -# AIX -qlanglvl=ansi -# Ultrix and OSF/1 -std1 -# HP-UX 10.20 and later -Ae -# HP-UX older versions -Aa -D_HPUX_SOURCE -# SVR4 -Xc -D__EXTENSIONS__ -for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_prog_cc_stdc=$ac_arg -break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext -done -rm -f conftest.$ac_ext conftest.$ac_objext -CC=$ac_save_CC - -fi - -case "x$ac_cv_prog_cc_stdc" in - x|xno) - echo "$as_me:$LINENO: result: none needed" >&5 -echo "${ECHO_T}none needed" >&6 ;; - *) - echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 - CC="$CC $ac_cv_prog_cc_stdc" ;; -esac - -# Some people use a C++ compiler to compile C. Since we use `exit', -# in C++ we need to declare it. In case someone uses the same compiler -# for both compiling C and C++ we need to have the C++ compiler decide -# the declaration of exit, since it's the most demanding environment. -cat >conftest.$ac_ext <<_ACEOF -#ifndef __cplusplus - choke me -#endif -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - for ac_declaration in \ - '' \ - 'extern "C" void std::exit (int) throw (); using std::exit;' \ - 'extern "C" void std::exit (int); using std::exit;' \ - 'extern "C" void exit (int) throw ();' \ - 'extern "C" void exit (int);' \ - 'void exit (int);' -do - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_declaration -#include -int -main () -{ -exit (42); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -continue -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_declaration -int -main () -{ -exit (42); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -done -rm -f conftest* -if test -n "$ac_declaration"; then - echo '#ifdef __cplusplus' >>confdefs.h - echo $ac_declaration >>confdefs.h - echo '#endif' >>confdefs.h -fi - -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -DEPDIR="${am__leading_dot}deps" - - ac_config_commands="$ac_config_commands depfiles" - - -am_make=${MAKE-make} -cat > confinc << 'END' -am__doit: - @echo done -.PHONY: am__doit -END -# If we don't find an include directive, just comment out the code. -echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5 -echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6 -am__include="#" -am__quote= -_am_result=none -# First try GNU make style include. -echo "include confinc" > confmf -# We grep out `Entering directory' and `Leaving directory' -# messages which can occur if `w' ends up in MAKEFLAGS. -# In particular we don't look at `^make:' because GNU make might -# be invoked under some other name (usually "gmake"), in which -# case it prints its new name instead of `make'. -if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then - am__include=include - am__quote= - _am_result=GNU -fi -# Now try BSD make style include. -if test "$am__include" = "#"; then - echo '.include "confinc"' > confmf - if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then - am__include=.include - am__quote="\"" - _am_result=BSD - fi -fi - - -echo "$as_me:$LINENO: result: $_am_result" >&5 -echo "${ECHO_T}$_am_result" >&6 -rm -f confinc confmf - -# Check whether --enable-dependency-tracking or --disable-dependency-tracking was given. -if test "${enable_dependency_tracking+set}" = set; then - enableval="$enable_dependency_tracking" - -fi; -if test "x$enable_dependency_tracking" != xno; then - am_depcomp="$ac_aux_dir/depcomp" - AMDEPBACKSLASH='\' -fi - - -if test "x$enable_dependency_tracking" != xno; then - AMDEP_TRUE= - AMDEP_FALSE='#' -else - AMDEP_TRUE='#' - AMDEP_FALSE= -fi - - - - -depcc="$CC" am_compiler_list= - -echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 -echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6 -if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then - # We make a subdir and do the tests there. Otherwise we can end up - # making bogus files that we don't know about and never remove. For - # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named `D' -- because `-MD' means `put the output - # in D'. - mkdir conftest.dir - # Copy depcomp to subdir because otherwise we won't find it if we're - # using a relative directory. - cp "$am_depcomp" conftest.dir - cd conftest.dir - # We will build objects and dependencies in a subdirectory because - # it helps to detect inapplicable dependency modes. For instance - # both Tru64's cc and ICC support -MD to output dependencies as a - # side effect of compilation, but ICC will put the dependencies in - # the current directory while Tru64 will put them in the object - # directory. - mkdir sub - - am_cv_CC_dependencies_compiler_type=none - if test "$am_compiler_list" = ""; then - am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` - fi - for depmode in $am_compiler_list; do - # Setup a source with many dependencies, because some compilers - # like to wrap large dependency lists on column 80 (with \), and - # we should not choose a depcomp mode which is confused by this. - # - # We need to recreate these files for each test, as the compiler may - # overwrite some of them when testing with obscure command lines. - # This happens at least with the AIX C compiler. - : > sub/conftest.c - for i in 1 2 3 4 5 6; do - echo '#include "conftst'$i'.h"' >> sub/conftest.c - : > sub/conftst$i.h - done - echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - - case $depmode in - nosideeffect) - # after this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested - if test "x$enable_dependency_tracking" = xyes; then - continue - else - break - fi - ;; - none) break ;; - esac - # We check with `-c' and `-o' for the sake of the "dashmstdout" - # mode. It turns out that the SunPro C++ compiler does not properly - # handle `-M -o', and we need to detect this. - if depmode=$depmode \ - source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ - depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ - $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ - >/dev/null 2>conftest.err && - grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && - ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - # icc doesn't choke on unknown options, it will just issue warnings - # (even with -Werror). So we grep stderr for any message - # that says an option was ignored. - if grep 'ignoring option' conftest.err >/dev/null 2>&1; then :; else - am_cv_CC_dependencies_compiler_type=$depmode - break - fi - fi - done - - cd .. - rm -rf conftest.dir -else - am_cv_CC_dependencies_compiler_type=none -fi - -fi -echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 -echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6 -CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type - - - -if - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then - am__fastdepCC_TRUE= - am__fastdepCC_FALSE='#' -else - am__fastdepCC_TRUE='#' - am__fastdepCC_FALSE= -fi - - -# We need this for older versions of Autoconf. - -depcc="$CC" am_compiler_list= - -echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 -echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6 -if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then - # We make a subdir and do the tests there. Otherwise we can end up - # making bogus files that we don't know about and never remove. For - # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named `D' -- because `-MD' means `put the output - # in D'. - mkdir conftest.dir - # Copy depcomp to subdir because otherwise we won't find it if we're - # using a relative directory. - cp "$am_depcomp" conftest.dir - cd conftest.dir - # We will build objects and dependencies in a subdirectory because - # it helps to detect inapplicable dependency modes. For instance - # both Tru64's cc and ICC support -MD to output dependencies as a - # side effect of compilation, but ICC will put the dependencies in - # the current directory while Tru64 will put them in the object - # directory. - mkdir sub - - am_cv_CC_dependencies_compiler_type=none - if test "$am_compiler_list" = ""; then - am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` - fi - for depmode in $am_compiler_list; do - # Setup a source with many dependencies, because some compilers - # like to wrap large dependency lists on column 80 (with \), and - # we should not choose a depcomp mode which is confused by this. - # - # We need to recreate these files for each test, as the compiler may - # overwrite some of them when testing with obscure command lines. - # This happens at least with the AIX C compiler. - : > sub/conftest.c - for i in 1 2 3 4 5 6; do - echo '#include "conftst'$i'.h"' >> sub/conftest.c - : > sub/conftst$i.h - done - echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - - case $depmode in - nosideeffect) - # after this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested - if test "x$enable_dependency_tracking" = xyes; then - continue - else - break - fi - ;; - none) break ;; - esac - # We check with `-c' and `-o' for the sake of the "dashmstdout" - # mode. It turns out that the SunPro C++ compiler does not properly - # handle `-M -o', and we need to detect this. - if depmode=$depmode \ - source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ - depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ - $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ - >/dev/null 2>conftest.err && - grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && - ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - # icc doesn't choke on unknown options, it will just issue warnings - # (even with -Werror). So we grep stderr for any message - # that says an option was ignored. - if grep 'ignoring option' conftest.err >/dev/null 2>&1; then :; else - am_cv_CC_dependencies_compiler_type=$depmode - break - fi - fi - done - - cd .. - rm -rf conftest.dir -else - am_cv_CC_dependencies_compiler_type=none -fi - -fi -echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 -echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6 -CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type - - - -if - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then - am__fastdepCC_TRUE= - am__fastdepCC_FALSE='#' -else - am__fastdepCC_TRUE='#' - am__fastdepCC_FALSE= -fi - - - -CCAS="$CC" - - - -# Check whether --with-binutils or --without-binutils was given. -if test "${with_binutils+set}" = set; then - withval="$with_binutils" - -fi; - -if test "x$with_binutils" != x; then - # Extract the first word of "ranlib", so it can be a program name with args. -set dummy ranlib; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_path_RANLIB+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case $RANLIB in - [\\/]* | ?:[\\/]*) - ac_cv_path_RANLIB="$RANLIB" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_dummy=""$with_binutils:$PATH"" -for as_dir in $as_dummy -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_RANLIB="$as_dir/$ac_word$ac_exec_ext" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - - test -z "$ac_cv_path_RANLIB" && ac_cv_path_RANLIB=":" - ;; -esac -fi -RANLIB=$ac_cv_path_RANLIB - -if test -n "$RANLIB"; then - echo "$as_me:$LINENO: result: $RANLIB" >&5 -echo "${ECHO_T}$RANLIB" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -else - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. -set dummy ${ac_tool_prefix}ranlib; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_RANLIB+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$RANLIB"; then - ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -RANLIB=$ac_cv_prog_RANLIB -if test -n "$RANLIB"; then - echo "$as_me:$LINENO: result: $RANLIB" >&5 -echo "${ECHO_T}$RANLIB" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -fi -if test -z "$ac_cv_prog_RANLIB"; then - ac_ct_RANLIB=$RANLIB - # Extract the first word of "ranlib", so it can be a program name with args. -set dummy ranlib; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_RANLIB"; then - ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_RANLIB="ranlib" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - - test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" -fi -fi -ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB -if test -n "$ac_ct_RANLIB"; then - echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 -echo "${ECHO_T}$ac_ct_RANLIB" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - RANLIB=$ac_ct_RANLIB -else - RANLIB="$ac_cv_prog_RANLIB" -fi - -fi - -# optimization flags -if test "x$ac_cv_c_compiler_gnu" = xyes; then - if test "x$default_CFLAGS" = xyes; then - # Autoconf may set CFLAGS to -O2 and/or -g. So eliminate them. - CFLAGS="`echo $CFLAGS | sed -e 's/-g//g' -e 's/-O[0-9]//g'` -g" - # If the user specify the directory for binutils, add the option `-B'. - if test "x$with_binutils" != x; then - CFLAGS="-B$with_binutils/ $CFLAGS" - fi - STAGE1_CFLAGS="-O2" - GRUB_CFLAGS="-O2" - -echo "$as_me:$LINENO: checking whether optimization for size works" >&5 -echo $ECHO_N "checking whether optimization for size works... $ECHO_C" >&6 -if test "${size_flag+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - saved_CFLAGS=$CFLAGS - CFLAGS="-Os -g" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - size_flag=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -size_flag=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - CFLAGS=$saved_CFLAGS - -fi -echo "$as_me:$LINENO: result: $size_flag" >&5 -echo "${ECHO_T}$size_flag" >&6 - if test "x$size_flag" = xyes; then - STAGE2_CFLAGS="-Os" - else - STAGE2_CFLAGS="-O2 -fno-strength-reduce -fno-unroll-loops" - fi - # OpenBSD has a GCC extension for protecting applications from - # stack smashing attacks, but GRUB doesn't want this feature. - echo "$as_me:$LINENO: checking whether gcc has -fno-stack-protector" >&5 -echo $ECHO_N "checking whether gcc has -fno-stack-protector... $ECHO_C" >&6 -if test "${no_stack_protector_flag+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - saved_CFLAGS=$CFLAGS - CFLAGS="-fno-stack-protector" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - no_stack_protector_flag=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -no_stack_protector_flag=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - CFLAGS=$saved_CFLAGS - -fi -echo "$as_me:$LINENO: result: $no_stack_protector_flag" >&5 -echo "${ECHO_T}$no_stack_protector_flag" >&6 - if test "x$no_stack_protector_flag" = xyes; then - STAGE2_CFLAGS="$STAGE2_CFLAGS -fno-stack-protector" - fi - fi -fi - - - - - -# Enforce coding standards. -CPPFLAGS="$CPPFLAGS -Wall -Wmissing-prototypes -Wunused -Wshadow" -CPPFLAGS="$CPPFLAGS -Wpointer-arith" - -echo "$as_me:$LINENO: checking whether -Wundef works" >&5 -echo $ECHO_N "checking whether -Wundef works... $ECHO_C" >&6 -if test "${undef_flag+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - saved_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="-Wundef" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - undef_flag=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -undef_flag=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - CPPFLAGS="$saved_CPPFLAGS" - -fi -echo "$as_me:$LINENO: result: $undef_flag" >&5 -echo "${ECHO_T}$undef_flag" >&6 - -# The options `-falign-*' are supported by gcc 3.0 or later. -# Probably it is sufficient to only check for -falign-loops. -echo "$as_me:$LINENO: checking whether -falign-loops works" >&5 -echo $ECHO_N "checking whether -falign-loops works... $ECHO_C" >&6 -if test "${falign_loop_flag+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - saved_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="-falign-loops=1" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - falign_loop_flag=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -falign_loop_flag=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - CPPFLAGS="$saved_CPPFLAGS" - -fi -echo "$as_me:$LINENO: result: $falign_loop_flag" >&5 -echo "${ECHO_T}$falign_loop_flag" >&6 - -# Force no alignment to save space. -if test "x$falign_loop_flag" = xyes; then - CPPFLAGS="$CPPFLAGS -falign-jumps=1 -falign-loops=1 -falign-functions=1" -else - CPPFLAGS="$CPPFLAGS -malign-jumps=1 -malign-loops=1 -malign-functions=1" -fi - -if test "x$undef_flag" = xyes; then - CPPFLAGS="$CPPFLAGS -Wundef" -fi - -if test "x$with_binutils" != x; then - # Extract the first word of "objcopy", so it can be a program name with args. -set dummy objcopy; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_path_OBJCOPY+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case $OBJCOPY in - [\\/]* | ?:[\\/]*) - ac_cv_path_OBJCOPY="$OBJCOPY" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_dummy=""$with_binutils:$PATH"" -for as_dir in $as_dummy -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_OBJCOPY="$as_dir/$ac_word$ac_exec_ext" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - - ;; -esac -fi -OBJCOPY=$ac_cv_path_OBJCOPY - -if test -n "$OBJCOPY"; then - echo "$as_me:$LINENO: result: $OBJCOPY" >&5 -echo "${ECHO_T}$OBJCOPY" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -else - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}objcopy", so it can be a program name with args. -set dummy ${ac_tool_prefix}objcopy; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_OBJCOPY+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$OBJCOPY"; then - ac_cv_prog_OBJCOPY="$OBJCOPY" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_OBJCOPY="${ac_tool_prefix}objcopy" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -OBJCOPY=$ac_cv_prog_OBJCOPY -if test -n "$OBJCOPY"; then - echo "$as_me:$LINENO: result: $OBJCOPY" >&5 -echo "${ECHO_T}$OBJCOPY" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -fi -if test -z "$ac_cv_prog_OBJCOPY"; then - ac_ct_OBJCOPY=$OBJCOPY - # Extract the first word of "objcopy", so it can be a program name with args. -set dummy objcopy; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_OBJCOPY+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_OBJCOPY"; then - ac_cv_prog_ac_ct_OBJCOPY="$ac_ct_OBJCOPY" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_OBJCOPY="objcopy" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ac_ct_OBJCOPY=$ac_cv_prog_ac_ct_OBJCOPY -if test -n "$ac_ct_OBJCOPY"; then - echo "$as_me:$LINENO: result: $ac_ct_OBJCOPY" >&5 -echo "${ECHO_T}$ac_ct_OBJCOPY" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - OBJCOPY=$ac_ct_OBJCOPY -else - OBJCOPY="$ac_cv_prog_OBJCOPY" -fi - -fi - -# Defined in acinclude.m4. - -echo "$as_me:$LINENO: checking if C symbols get an underscore after compilation" >&5 -echo $ECHO_N "checking if C symbols get an underscore after compilation... $ECHO_C" >&6 -if test "${grub_cv_asm_uscore+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat > conftest.c <<\EOF -int -func (int *list) -{ - *list = 0; - return *list; -} -EOF - -if { ac_try='${CC-cc} ${CFLAGS} -S conftest.c' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && test -s conftest.s; then - true -else - { { echo "$as_me:$LINENO: error: ${CC-cc} failed to produce assembly code" >&5 -echo "$as_me: error: ${CC-cc} failed to produce assembly code" >&2;} - { (exit 1); exit 1; }; } -fi - -if grep _func conftest.s >/dev/null 2>&1; then - grub_cv_asm_uscore=yes -else - grub_cv_asm_uscore=no -fi - -rm -f conftest* -fi - - -if test "x$grub_cv_asm_uscore" = xyes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_ASM_USCORE $grub_cv_asm_uscore -_ACEOF - -fi - -echo "$as_me:$LINENO: result: $grub_cv_asm_uscore" >&5 -echo "${ECHO_T}$grub_cv_asm_uscore" >&6 - -echo "$as_me:$LINENO: checking whether ${OBJCOPY} works for absolute addresses" >&5 -echo $ECHO_N "checking whether ${OBJCOPY} works for absolute addresses... $ECHO_C" >&6 -if test "${grub_cv_prog_objcopy_absolute+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat > conftest.c <<\EOF -void -cmain (void) -{ - *((int *) 0x1000) = 2; -} -EOF - -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && test -s conftest.o; then : -else - { { echo "$as_me:$LINENO: error: ${CC-cc} cannot compile C source code" >&5 -echo "$as_me: error: ${CC-cc} cannot compile C source code" >&2;} - { (exit 1); exit 1; }; } -fi -grub_cv_prog_objcopy_absolute=yes -for link_addr in 2000 8000 7C00; do - if { ac_try='${CC-cc} ${CFLAGS} -nostdlib -Wl,-N -Wl,-Ttext -Wl,$link_addr conftest.o -o conftest.exec' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then : - else - { { echo "$as_me:$LINENO: error: ${CC-cc} cannot link at address $link_addr" >&5 -echo "$as_me: error: ${CC-cc} cannot link at address $link_addr" >&2;} - { (exit 1); exit 1; }; } - fi - if { ac_try='${OBJCOPY-objcopy} -O binary conftest.exec conftest' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then : - else - { { echo "$as_me:$LINENO: error: ${OBJCOPY-objcopy} cannot create binary files" >&5 -echo "$as_me: error: ${OBJCOPY-objcopy} cannot create binary files" >&2;} - { (exit 1); exit 1; }; } - fi - if test ! -f conftest.old || { ac_try='cmp -s conftest.old conftest' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - mv -f conftest conftest.old - else - grub_cv_prog_objcopy_absolute=no - break - fi -done -rm -f conftest* -fi - -echo "$as_me:$LINENO: result: $grub_cv_prog_objcopy_absolute" >&5 -echo "${ECHO_T}$grub_cv_prog_objcopy_absolute" >&6 -if test "x$grub_cv_prog_objcopy_absolute" != xyes; then - { { echo "$as_me:$LINENO: error: GRUB requires a working absolute objcopy; upgrade your binutils" >&5 -echo "$as_me: error: GRUB requires a working absolute objcopy; upgrade your binutils" >&2;} - { (exit 1); exit 1; }; } -fi - - -echo "$as_me:$LINENO: checking whether addr32 must be in the same line as the instruction" >&5 -echo $ECHO_N "checking whether addr32 must be in the same line as the instruction... $ECHO_C" >&6 -if test "${grub_cv_asm_prefix_requirement+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat > conftest.s <<\EOF - .code16 -l1: addr32 movb %al, l1 -EOF - -if { ac_try='${CC-cc} ${CFLAGS} -c conftest.s' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && test -s conftest.o; then - grub_cv_asm_prefix_requirement=yes -else - grub_cv_asm_prefix_requirement=no -fi - -rm -f conftest* -fi - - -if test "x$grub_cv_asm_prefix_requirement" = xyes; then - grub_tmp_addr32="addr32" - grub_tmp_data32="data32" -else - grub_tmp_addr32="addr32;" - grub_tmp_data32="data32;" -fi - - -cat >>confdefs.h <<_ACEOF -#define ADDR32 $grub_tmp_addr32 -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define DATA32 $grub_tmp_data32 -_ACEOF - - -echo "$as_me:$LINENO: result: $grub_cv_asm_prefix_requirement" >&5 -echo "${ECHO_T}$grub_cv_asm_prefix_requirement" >&6 - - - -echo "$as_me:$LINENO: checking for .code16 addr32 assembler support" >&5 -echo $ECHO_N "checking for .code16 addr32 assembler support... $ECHO_C" >&6 -if test "${grub_cv_asm_addr32+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat > conftest.s.in <<\EOF - .code16 -l1: @ADDR32@ movb %al, l1 -EOF - -if test "x$grub_cv_asm_prefix_requirement" = xyes; then - sed -e s/@ADDR32@/addr32/ < conftest.s.in > conftest.s -else - sed -e s/@ADDR32@/addr32\;/ < conftest.s.in > conftest.s -fi - -if { ac_try='${CC-cc} ${CFLAGS} -c conftest.s' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && test -s conftest.o; then - grub_cv_asm_addr32=yes -else - grub_cv_asm_addr32=no -fi - -rm -f conftest* -fi - - -echo "$as_me:$LINENO: result: $grub_cv_asm_addr32" >&5 -echo "${ECHO_T}$grub_cv_asm_addr32" >&6 -if test "x$grub_cv_asm_addr32" != xyes; then - { { echo "$as_me:$LINENO: error: GRUB requires GAS .code16 addr32 support; upgrade your binutils" >&5 -echo "$as_me: error: GRUB requires GAS .code16 addr32 support; upgrade your binutils" >&2;} - { (exit 1); exit 1; }; } -fi - - -echo "$as_me:$LINENO: checking whether an absolute indirect call/jump must not be prefixed with an asterisk" >&5 -echo $ECHO_N "checking whether an absolute indirect call/jump must not be prefixed with an asterisk... $ECHO_C" >&6 -if test "${grub_cv_asm_absolute_without_asterisk+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat > conftest.s <<\EOF - lcall *(offset) -offset: - .long 0 - .word 0 -EOF - -if { ac_try='${CC-cc} ${CFLAGS} -c conftest.s' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && test -s conftest.o; then - grub_cv_asm_absolute_without_asterisk=no -else - grub_cv_asm_absolute_without_asterisk=yes -fi - -rm -f conftest* -fi - - -if test "x$grub_cv_asm_absolute_without_asterisk" = xyes; then - -cat >>confdefs.h <<\_ACEOF -#define ABSOLUTE_WITHOUT_ASTERISK 1 -_ACEOF - -fi - -echo "$as_me:$LINENO: result: $grub_cv_asm_absolute_without_asterisk" >&5 -echo "${ECHO_T}$grub_cv_asm_absolute_without_asterisk" >&6 - - -echo "$as_me:$LINENO: checking if start is defined by the compiler" >&5 -echo $ECHO_N "checking if start is defined by the compiler... $ECHO_C" >&6 -if test "${grub_cv_check_start_symbol+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -asm ("incl start") - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - grub_cv_check_start_symbol=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -grub_cv_check_start_symbol=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi - - -if test "x$grub_cv_check_start_symbol" = xyes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_START_SYMBOL 1 -_ACEOF - -fi - -echo "$as_me:$LINENO: result: $grub_cv_check_start_symbol" >&5 -echo "${ECHO_T}$grub_cv_check_start_symbol" >&6 - - -echo "$as_me:$LINENO: checking if _start is defined by the compiler" >&5 -echo $ECHO_N "checking if _start is defined by the compiler... $ECHO_C" >&6 -if test "${grub_cv_check_uscore_start_symbol+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -asm ("incl _start") - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - grub_cv_check_uscore_start_symbol=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -grub_cv_check_uscore_start_symbol=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi - - -if test "x$grub_cv_check_uscore_start_symbol" = xyes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_USCORE_START_SYMBOL 1 -_ACEOF - -fi - -echo "$as_me:$LINENO: result: $grub_cv_check_uscore_start_symbol" >&5 -echo "${ECHO_T}$grub_cv_check_uscore_start_symbol" >&6 - -if test "x$grub_cv_check_start_symbol" != "xyes" \ - -a "x$grub_cv_check_uscore_start_symbol" != "xyes"; then - { { echo "$as_me:$LINENO: error: Neither start nor _start is defined" >&5 -echo "$as_me: error: Neither start nor _start is defined" >&2;} - { (exit 1); exit 1; }; } -fi - - -echo "$as_me:$LINENO: checking if __bss_start is defined by the compiler" >&5 -echo $ECHO_N "checking if __bss_start is defined by the compiler... $ECHO_C" >&6 -if test "${grub_cv_check_uscore_uscore_bss_start_symbol+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -asm ("incl __bss_start") - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - grub_cv_check_uscore_uscore_bss_start_symbol=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -grub_cv_check_uscore_uscore_bss_start_symbol=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi - - -if test "x$grub_cv_check_uscore_uscore_bss_start_symbol" = xyes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_USCORE_USCORE_BSS_START_SYMBOL 1 -_ACEOF - -fi - -echo "$as_me:$LINENO: result: $grub_cv_check_uscore_uscore_bss_start_symbol" >&5 -echo "${ECHO_T}$grub_cv_check_uscore_uscore_bss_start_symbol" >&6 - - -echo "$as_me:$LINENO: checking if _edata is defined by the compiler" >&5 -echo $ECHO_N "checking if _edata is defined by the compiler... $ECHO_C" >&6 -if test "${grub_cv_check_uscore_edata_symbol+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -asm ("incl _edata") - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - grub_cv_check_uscore_edata_symbol=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -grub_cv_check_uscore_edata_symbol=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi - - -if test "x$grub_cv_check_uscore_edata_symbol" = xyes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_USCORE_EDATA_SYMBOL 1 -_ACEOF - -fi - -echo "$as_me:$LINENO: result: $grub_cv_check_uscore_edata_symbol" >&5 -echo "${ECHO_T}$grub_cv_check_uscore_edata_symbol" >&6 - - -echo "$as_me:$LINENO: checking if edata is defined by the compiler" >&5 -echo $ECHO_N "checking if edata is defined by the compiler... $ECHO_C" >&6 -if test "${grub_cv_check_edata_symbol+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -asm ("incl edata") - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - grub_cv_check_edata_symbol=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -grub_cv_check_edata_symbol=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi - - -if test "x$grub_cv_check_edata_symbol" = xyes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_EDATA_SYMBOL 1 -_ACEOF - -fi - -echo "$as_me:$LINENO: result: $grub_cv_check_edata_symbol" >&5 -echo "${ECHO_T}$grub_cv_check_edata_symbol" >&6 - -if test "x$grub_cv_check_uscore_uscore_bss_start_symbol" != "xyes" \ - -a "x$grub_cv_check_uscore_edata_symbol" != "xyes" \ - -a "x$grub_cv_check_edata_symbol" != "xyes"; then - { { echo "$as_me:$LINENO: error: None of __bss_start, _edata, edata defined" >&5 -echo "$as_me: error: None of __bss_start, _edata, edata defined" >&2;} - { (exit 1); exit 1; }; } -fi - - -echo "$as_me:$LINENO: checking if end is defined by the compiler" >&5 -echo $ECHO_N "checking if end is defined by the compiler... $ECHO_C" >&6 -if test "${grub_cv_check_end_symbol+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -asm ("incl end") - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - grub_cv_check_end_symbol=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -grub_cv_check_end_symbol=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi - - -if test "x$grub_cv_check_end_symbol" = xyes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_END_SYMBOL 1 -_ACEOF - -fi - -echo "$as_me:$LINENO: result: $grub_cv_check_end_symbol" >&5 -echo "${ECHO_T}$grub_cv_check_end_symbol" >&6 - - -echo "$as_me:$LINENO: checking if _end is defined by the compiler" >&5 -echo $ECHO_N "checking if _end is defined by the compiler... $ECHO_C" >&6 -if test "${grub_cv_check_uscore_end_symbol+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -asm ("incl _end") - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - grub_cv_check_uscore_end_symbol=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -grub_cv_check_uscore_end_symbol=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi - - -if test "x$grub_cv_check_uscore_end_symbol" = xyes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_USCORE_END_SYMBOL 1 -_ACEOF - -fi - -echo "$as_me:$LINENO: result: $grub_cv_check_uscore_end_symbol" >&5 -echo "${ECHO_T}$grub_cv_check_uscore_end_symbol" >&6 - -if test "x$grub_cv_check_end_symbol" != "xyes" \ - -a "x$grub_cv_check_uscore_end_symbol" != "xyes"; then - { { echo "$as_me:$LINENO: error: Neither end nor _end is defined" >&5 -echo "$as_me: error: Neither end nor _end is defined" >&2;} - { (exit 1); exit 1; }; } -fi - -# Check for curses libraries. - -# Check whether --with-curses or --without-curses was given. -if test "${with_curses+set}" = set; then - withval="$with_curses" - -fi; - -# Get the filename or the whole disk and open it. -# Known to work on NetBSD. -echo "$as_me:$LINENO: checking for opendisk in -lutil" >&5 -echo $ECHO_N "checking for opendisk in -lutil... $ECHO_C" >&6 -if test "${ac_cv_lib_util_opendisk+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lutil $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char opendisk (); -int -main () -{ -opendisk (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_util_opendisk=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_util_opendisk=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_util_opendisk" >&5 -echo "${ECHO_T}$ac_cv_lib_util_opendisk" >&6 -if test $ac_cv_lib_util_opendisk = yes; then - GRUB_LIBS="$GRUB_LIBS -lutil" - -cat >>confdefs.h <<\_ACEOF -#define HAVE_OPENDISK 1 -_ACEOF - -fi - - -# Unless the user specify --without-curses, check for curses. -if test "x$with_curses" != "xno"; then - echo "$as_me:$LINENO: checking for wgetch in -lncurses" >&5 -echo $ECHO_N "checking for wgetch in -lncurses... $ECHO_C" >&6 -if test "${ac_cv_lib_ncurses_wgetch+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lncurses $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char wgetch (); -int -main () -{ -wgetch (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_ncurses_wgetch=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_ncurses_wgetch=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_ncurses_wgetch" >&5 -echo "${ECHO_T}$ac_cv_lib_ncurses_wgetch" >&6 -if test $ac_cv_lib_ncurses_wgetch = yes; then - GRUB_LIBS="$GRUB_LIBS -lncurses" - -cat >>confdefs.h <<\_ACEOF -#define HAVE_LIBCURSES 1 -_ACEOF - -else - echo "$as_me:$LINENO: checking for wgetch in -lcurses" >&5 -echo $ECHO_N "checking for wgetch in -lcurses... $ECHO_C" >&6 -if test "${ac_cv_lib_curses_wgetch+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lcurses $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char wgetch (); -int -main () -{ -wgetch (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_curses_wgetch=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_curses_wgetch=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_curses_wgetch" >&5 -echo "${ECHO_T}$ac_cv_lib_curses_wgetch" >&6 -if test $ac_cv_lib_curses_wgetch = yes; then - GRUB_LIBS="$GRUB_LIBS -lcurses" - -cat >>confdefs.h <<\_ACEOF -#define HAVE_LIBCURSES 1 -_ACEOF - -fi - -fi - -fi - - - -# Check for headers. -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 -echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then - if test "${ac_cv_prog_CPP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # Double quotes because CPP needs to be expanded - for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" - do - ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.$ac_ext - - # OK, works on sane cases. Now check whether non-existent headers - # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - # Broken: success on invalid input. -continue -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then - break -fi - - done - ac_cv_prog_CPP=$CPP - -fi - CPP=$ac_cv_prog_CPP -else - ac_cv_prog_CPP=$CPP -fi -echo "$as_me:$LINENO: result: $CPP" >&5 -echo "${ECHO_T}$CPP" >&6 -ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.$ac_ext - - # OK, works on sane cases. Now check whether non-existent headers - # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - # Broken: success on invalid input. -continue -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then - : -else - { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." >&5 -echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -echo "$as_me:$LINENO: checking for egrep" >&5 -echo $ECHO_N "checking for egrep... $ECHO_C" >&6 -if test "${ac_cv_prog_egrep+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if echo a | (grep -E '(a|b)') >/dev/null 2>&1 - then ac_cv_prog_egrep='grep -E' - else ac_cv_prog_egrep='egrep' - fi -fi -echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 -echo "${ECHO_T}$ac_cv_prog_egrep" >&6 - EGREP=$ac_cv_prog_egrep - - -echo "$as_me:$LINENO: checking for ANSI C header files" >&5 -echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 -if test "${ac_cv_header_stdc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -#include -#include - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_header_stdc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_header_stdc=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then - : -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then - : -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then - : -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#if ((' ' & 0x0FF) == 0x020) -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#else -# define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -#endif - -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int -main () -{ - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - exit(2); - exit (0); -} -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -ac_cv_header_stdc=no -fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi -fi -fi -echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 -echo "${ECHO_T}$ac_cv_header_stdc" >&6 -if test $ac_cv_header_stdc = yes; then - -cat >>confdefs.h <<\_ACEOF -#define STDC_HEADERS 1 -_ACEOF - -fi - -# On IRIX 5.3, sys/types and inttypes.h are conflicting. - - - - - - - - - -for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default - -#include <$ac_header> -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_Header=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_Header=no" -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - - - - - - -for ac_header in string.h strings.h ncurses/curses.h ncurses.h curses.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -else - # Is the header compilable? -echo "$as_me:$LINENO: checking $ac_header usability" >&5 -echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include <$ac_header> -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_header_compiler=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6 - -# Is the header present? -echo "$as_me:$LINENO: checking $ac_header presence" >&5 -echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <$ac_header> -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi -rm -f conftest.err conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6 - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} - ( - cat <<\_ASBOX -## ------------------------------- ## -## Report this to bug-grub@gnu.org ## -## ------------------------------- ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - eval "$as_ac_Header=\$ac_header_preproc" -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 - -fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - -# Check for user options. - -# filesystems support. -# Check whether --enable-ext2fs or --disable-ext2fs was given. -if test "${enable_ext2fs+set}" = set; then - enableval="$enable_ext2fs" - -fi; - -if test x"$enable_ext2fs" != xno; then - FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_EXT2FS=1" -fi - -# Check whether --enable-fat or --disable-fat was given. -if test "${enable_fat+set}" = set; then - enableval="$enable_fat" - -fi; - -if test x"$enable_fat" != xno; then - FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_FAT=1" -fi - -# Check whether --enable-ffs or --disable-ffs was given. -if test "${enable_ffs+set}" = set; then - enableval="$enable_ffs" - -fi; - -if test x"$enable_ffs" != xno; then - FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_FFS=1" -fi - -# Check whether --enable-ufs or --disable-ufs was given. -if test "${enable_ufs+set}" = set; then - enableval="$enable_ufs" - -fi; - -if test x"$enable_ufs" != xno; then - FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_UFS=1" -fi - -# Check whether --enable-ufs2 or --disable-ufs2 was given. -if test "${enable_ufs2+set}" = set; then - enableval="$enable_ufs2" - -fi; - -if test x"$enable_ufs2" != xno; then - FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_UFS2=1" -fi - -# Check whether --enable-minix or --disable-minix was given. -if test "${enable_minix+set}" = set; then - enableval="$enable_minix" - -fi; - -if test x"$enable_minix" != xno; then - FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_MINIX=1" -fi - -# Check whether --enable-reiserfs or --disable-reiserfs was given. -if test "${enable_reiserfs+set}" = set; then - enableval="$enable_reiserfs" - -fi; - -if test x"$enable_reiserfs" != xno; then - FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_REISERFS=1" -fi - -# Check whether --enable-vstafs or --disable-vstafs was given. -if test "${enable_vstafs+set}" = set; then - enableval="$enable_vstafs" - -fi; - -if test x"$enable_vstafs" != xno; then - FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_VSTAFS=1" -fi - -# Check whether --enable-jfs or --disable-jfs was given. -if test "${enable_jfs+set}" = set; then - enableval="$enable_jfs" - -fi; - -if test x"$enable_jfs" != xno; then - FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_JFS=1" -fi - -# Check whether --enable-xfs or --disable-xfs was given. -if test "${enable_xfs+set}" = set; then - enableval="$enable_xfs" - -fi; - -if test x"$enable_xfs" != xno; then - FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_XFS=1" -fi - -# Check whether --enable-zfs or --disable-zfs was given. -if test "${enable_zfs+set}" = set; then - enableval="$enable_zfs" - -fi; - -if test x"$enable_zfs" != xno; then - FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_ZFS=1" -fi - -# Check whether --enable-iso9660 or --disable-iso9660 was given. -if test "${enable_iso9660+set}" = set; then - enableval="$enable_iso9660" - -fi; - -if test x"$enable_iso9660" != xno; then - FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_ISO9660=1" -fi - - -# Check whether --enable-gunzip or --disable-gunzip was given. -if test "${enable_gunzip+set}" = set; then - enableval="$enable_gunzip" - -fi; - -if test x"$enable_gunzip" = xno; then - FSYS_CFLAGS="$FSYS_CFLAGS -DNO_DECOMPRESSION=1" -fi - -# Check whether --enable-md5-password or --disable-md5-password was given. -if test "${enable_md5_password+set}" = set; then - enableval="$enable_md5_password" - -fi; -if test "x$enable_md5_password" != xno; then - FSYS_CFLAGS="$FSYS_CFLAGS -DUSE_MD5_PASSWORDS=1" -fi - -# Check whether --enable-packet-retransmission or --disable-packet-retransmission was given. -if test "${enable_packet_retransmission+set}" = set; then - enableval="$enable_packet_retransmission" - -fi; -if test "x$enable_packet_retransmission" != xno; then - NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DCONGESTED=1 -DCONFIG_PCI" -fi - -# Check whether --enable-pci-direct or --disable-pci-direct was given. -if test "${enable_pci_direct+set}" = set; then - enableval="$enable_pci_direct" - -fi; -if test "x$enable_pci_direct" = xyes; then - NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DCONFIG_PCI_DIRECT=1" -fi - -# Check whether --enable-3c595 or --disable-3c595 was given. -if test "${enable_3c595+set}" = set; then - enableval="$enable_3c595" - -fi; -if test "x$enable_3c595" = xyes; then - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_3C595=1" - NETBOOT_DRIVERS="$NETBOOT_DRIVERS 3c595.o" -fi - -# Check whether --enable-3c90x or --disable-3c90x was given. -if test "${enable_3c90x+set}" = set; then - enableval="$enable_3c90x" - -fi; -if test "x$enable_3c90x" = xyes; then - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_3C90X=1" - NETBOOT_DRIVERS="$NETBOOT_DRIVERS 3c90x.o" -fi - -# Check whether --enable-davicom or --disable-davicom was given. -if test "${enable_davicom+set}" = set; then - enableval="$enable_davicom" - -fi; -if test "x$enable_davicom" = xyes; then - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_DAVICOM=1" - NETBOOT_DRIVERS="$NETBOOT_DRIVERS davicom.o" -fi - -# Check whether --enable-e1000 or --disable-e1000 was given. -if test "${enable_e1000+set}" = set; then - enableval="$enable_e1000" - -fi; -if test "x$enable_e1000" = xyes; then - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_E1000=1" - NETBOOT_DRIVERS="$NETBOOT_DRIVERS e1000.o" -fi - -# Check whether --enable-eepro100 or --disable-eepro100 was given. -if test "${enable_eepro100+set}" = set; then - enableval="$enable_eepro100" - -fi; -if test "x$enable_eepro100" = xyes; then - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_EEPRO100=1" - NETBOOT_DRIVERS="$NETBOOT_DRIVERS eepro100.o" -fi - -# Check whether --enable-epic100 or --disable-epic100 was given. -if test "${enable_epic100+set}" = set; then - enableval="$enable_epic100" - -fi; -if test "x$enable_epic100" = xyes; then - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_EPIC100=1" - NETBOOT_DRIVERS="$NETBOOT_DRIVERS epic100.o" -fi - -# Check whether --enable-forcedeth or --disable-forcedeth was given. -if test "${enable_forcedeth+set}" = set; then - enableval="$enable_forcedeth" - -fi; -if test "x$enable_forcedeth" = xyes; then - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_FORCEDETH=1" - NETBOOT_DRIVERS="$NETBOOT_DRIVERS forcedeth.o" -fi - -# Check whether --enable-natsemi or --disable-natsemi was given. -if test "${enable_natsemi+set}" = set; then - enableval="$enable_natsemi" - -fi; -if test "x$enable_natsemi" = xyes; then - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_NATSEMI=1" - NETBOOT_DRIVERS="$NETBOOT_DRIVERS natsemi.o" -fi - -# Check whether --enable-ns83820 or --disable-ns83820 was given. -if test "${enable_ns83820+set}" = set; then - enableval="$enable_ns83820" - -fi; -if test "x$enable_ns83820" = xyes; then - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_NS83820=1" - NETBOOT_DRIVERS="$NETBOOT_DRIVERS ns83820.o" -fi - -# Check whether --enable-ns8390 or --disable-ns8390 was given. -if test "${enable_ns8390+set}" = set; then - enableval="$enable_ns8390" - -fi; -if test "x$enable_ns8390" = xyes; then - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_NS8390=1" - NETBOOT_DRIVERS="$NETBOOT_DRIVERS ns8390.o" -fi - -# Check whether --enable-pcnet32 or --disable-pcnet32 was given. -if test "${enable_pcnet32+set}" = set; then - enableval="$enable_pcnet32" - -fi; -if test "x$enable_pcnet32" = xyes; then - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_PCNET32=1" - NETBOOT_DRIVERS="$NETBOOT_DRIVERS pcnet32.o" -fi - -# Check whether --enable-pnic or --disable-pnic was given. -if test "${enable_pnic+set}" = set; then - enableval="$enable_pnic" - -fi; -if test "x$enable_pnic" = xyes; then - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_PNIC=1" - NETBOOT_DRIVERS="$NETBOOT_DRIVERS pnic.o" -fi - -# Check whether --enable-rtl8139 or --disable-rtl8139 was given. -if test "${enable_rtl8139+set}" = set; then - enableval="$enable_rtl8139" - -fi; -if test "x$enable_rtl8139" = xyes; then - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_RTL8139=1" - NETBOOT_DRIVERS="$NETBOOT_DRIVERS rtl8139.o" -fi - -# Check whether --enable-r8169 or --disable-r8169 was given. -if test "${enable_r8169+set}" = set; then - enableval="$enable_r8169" - -fi; -if test "x$enable_r8169" = xyes; then - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_R8169=1" - NETBOOT_DRIVERS="$NETBOOT_DRIVERS r8169.o" -fi - -# Check whether --enable-sis900 or --disable-sis900 was given. -if test "${enable_sis900+set}" = set; then - enableval="$enable_sis900" - -fi; -if test "x$enable_sis900" = xyes; then - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_SIS900=1" - NETBOOT_DRIVERS="$NETBOOT_DRIVERS sis900.o" -fi - -# Check whether --enable-sundance or --disable-sundance was given. -if test "${enable_sundance+set}" = set; then - enableval="$enable_sundance" - -fi; -if test "x$enable_sundance" = xyes; then - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_SUNDANCE=1" - NETBOOT_DRIVERS="$NETBOOT_DRIVERS sundance.o" -fi - -# Check whether --enable-tg3 or --disable-tg3 was given. -if test "${enable_tg3+set}" = set; then - enableval="$enable_tg3" - -fi; -if test "x$enable_tg3" = xyes; then - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_TG3=1" - NETBOOT_DRIVERS="$NETBOOT_DRIVERS tg3.o" -fi - -# Check whether --enable-tulip or --disable-tulip was given. -if test "${enable_tulip+set}" = set; then - enableval="$enable_tulip" - -fi; -if test "x$enable_tulip" = xyes; then - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_TULIP=1" - NETBOOT_DRIVERS="$NETBOOT_DRIVERS tulip.o" -fi - -# Check whether --enable-tlan or --disable-tlan was given. -if test "${enable_tlan+set}" = set; then - enableval="$enable_tlan" - -fi; -if test "x$enable_tlan" = xyes; then - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_TLAN=1" - NETBOOT_DRIVERS="$NETBOOT_DRIVERS tlan.o" -fi - -# Check whether --enable-undi or --disable-undi was given. -if test "${enable_undi+set}" = set; then - enableval="$enable_undi" - -fi; -if test "x$enable_undi" = xyes; then - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_UNDI=1" - NETBOOT_DRIVERS="$NETBOOT_DRIVERS undi.o" -fi - -# Check whether --enable-via-rhine or --disable-via-rhine was given. -if test "${enable_via_rhine+set}" = set; then - enableval="$enable_via_rhine" - -fi; -if test "x$enable_via_rhine" = xyes; then - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_VIA_RHINE=1" - NETBOOT_DRIVERS="$NETBOOT_DRIVERS via_rhine.o" -fi - -# Check whether --enable-w89c840 or --disable-w89c840 was given. -if test "${enable_w89c840+set}" = set; then - enableval="$enable_w89c840" - -fi; -if test "x$enable_w89c840" = xyes; then - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_W89C840=1" - NETBOOT_DRIVERS="$NETBOOT_DRIVERS w89c840.o" -fi - - - -if test "x$NET_CFLAGS" != x; then - NETBOOT_SUPPORT_TRUE= - NETBOOT_SUPPORT_FALSE='#' -else - NETBOOT_SUPPORT_TRUE='#' - NETBOOT_SUPPORT_FALSE= -fi - -if test "x$NET_CFLAGS" != x; then - FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_TFTP=1" -fi - -# Check whether --enable-compex-rl2000-fix or --disable-compex-rl2000-fix was given. -if test "${enable_compex_rl2000_fix+set}" = set; then - enableval="$enable_compex_rl2000_fix" - -fi; -if test "x$enable_compex_rl2000_fix" = xyes; then - NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DCOMPEX_RL2000_FIX=1" -fi - -# Check whether --enable-ne-scan or --disable-ne-scan was given. -if test "${enable_ne_scan+set}" = set; then - enableval="$enable_ne_scan" - NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DNE_SCAN=$enable_ne_scan" -else - NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DNE_SCAN=0x280,0x300,0x320,0x340" -fi; - -# Check whether --enable-wd-default-mem or --disable-wd-default-mem was given. -if test "${enable_wd_default_mem+set}" = set; then - enableval="$enable_wd_default_mem" - NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DWD_DEFAULT_MEM=$enable_wd_default_mem" -else - NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DWD_DEFAULT_MEM=0xCC000" -fi; - -# Check whether --enable-diskless or --disable-diskless was given. -if test "${enable_diskless+set}" = set; then - enableval="$enable_diskless" - -fi; - - -if test "x$enable_diskless" = xyes; then - DISKLESS_SUPPORT_TRUE= - DISKLESS_SUPPORT_FALSE='#' -else - DISKLESS_SUPPORT_TRUE='#' - DISKLESS_SUPPORT_FALSE= -fi - - -# Check whether --enable-graphics or --disable-graphics was given. -if test "${enable_graphics+set}" = set; then - enableval="$enable_graphics" - -fi; - - -if test "x$enable_graphics" != xno; then - GRAPHICS_SUPPORT_TRUE= - GRAPHICS_SUPPORT_FALSE='#' -else - GRAPHICS_SUPPORT_TRUE='#' - GRAPHICS_SUPPORT_FALSE= -fi - - -# Check whether --enable-hercules or --disable-hercules was given. -if test "${enable_hercules+set}" = set; then - enableval="$enable_hercules" - -fi; - - -if test "x$enable_hercules" != xno; then - HERCULES_SUPPORT_TRUE= - HERCULES_SUPPORT_FALSE='#' -else - HERCULES_SUPPORT_TRUE='#' - HERCULES_SUPPORT_FALSE= -fi - - -# Check whether --enable-serial or --disable-serial was given. -if test "${enable_serial+set}" = set; then - enableval="$enable_serial" - -fi; - - -if test "x$enable_serial" != xno; then - SERIAL_SUPPORT_TRUE= - SERIAL_SUPPORT_FALSE='#' -else - SERIAL_SUPPORT_TRUE='#' - SERIAL_SUPPORT_FALSE= -fi - - -# Check whether --enable-serial-speed-simulation or --disable-serial-speed-simulation was given. -if test "${enable_serial_speed_simulation+set}" = set; then - enableval="$enable_serial_speed_simulation" - -fi; - - -if test "x$enable_serial_speed_simulation" = xyes; then - SERIAL_SPEED_SIMULATION_TRUE= - SERIAL_SPEED_SIMULATION_FALSE='#' -else - SERIAL_SPEED_SIMULATION_TRUE='#' - SERIAL_SPEED_SIMULATION_FALSE= -fi - - -# Sanity check. -if test "x$enable_diskless" = xyes; then - if test "x$NET_CFLAGS" = x; then - { { echo "$as_me:$LINENO: error: You must enable at least one network driver" >&5 -echo "$as_me: error: You must enable at least one network driver" >&2;} - { (exit 1); exit 1; }; } - fi -fi - -# Check whether --enable-preset-menu or --disable-preset-menu was given. -if test "${enable_preset_menu+set}" = set; then - enableval="$enable_preset_menu" - -fi; -if test "x$enable_preset_menu" = x; then - : -else - if test -r $enable_preset_menu; then - -# Because early versions of GNU sed 3.x are too buggy, use a C program -# instead of shell commands. *sigh* -cat >conftest.c <<\EOF -#include - -int -main (void) -{ - int c; - - while ((c = getchar ()) != EOF) - { - switch (c) - { - case '\n': - fputs ("\\n", stdout); - break; - case '\r': - fputs ("\\r", stdout); - break; - case '\\': - fputs ("\\\\", stdout); - break; - case '"': - fputs ("\\\"", stdout); - break; - default: - putchar (c); - } - } - - return 0; -} -EOF - -if { ac_try='${CC-cc} ${CFLAGS} conftest.c -o conftest' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && test -s conftest; then - grub_tmp_value=`./conftest < "$enable_preset_menu"` -else - { { echo "$as_me:$LINENO: error: ${CC-cc} failed to produce an executable file" >&5 -echo "$as_me: error: ${CC-cc} failed to produce an executable file" >&2;} - { (exit 1); exit 1; }; } -fi - - -cat >>confdefs.h <<_ACEOF -#define PRESET_MENU_STRING "$grub_tmp_value" -_ACEOF - -rm -f conftest* - - else - { { echo "$as_me:$LINENO: error: Cannot read the preset menu file $enable_preset_menu" >&5 -echo "$as_me: error: Cannot read the preset menu file $enable_preset_menu" >&2;} - { (exit 1); exit 1; }; } - fi -fi - -# Check whether --enable-example-kernel or --disable-example-kernel was given. -if test "${enable_example_kernel+set}" = set; then - enableval="$enable_example_kernel" - -fi; - - -if test "x$enable_example_kernel" = xyes; then - BUILD_EXAMPLE_KERNEL_TRUE= - BUILD_EXAMPLE_KERNEL_FALSE='#' -else - BUILD_EXAMPLE_KERNEL_TRUE='#' - BUILD_EXAMPLE_KERNEL_FALSE= -fi - - -# Check whether --enable-auto-linux-mem-opt or --disable-auto-linux-mem-opt was given. -if test "${enable_auto_linux_mem_opt+set}" = set; then - enableval="$enable_auto_linux_mem_opt" - -fi; -if test "x$enable_auto_linux_mem_opt" = xno; then - : -else - -cat >>confdefs.h <<\_ACEOF -#define AUTO_LINUX_MEM_OPT 1 -_ACEOF - -fi - - - - - - -CCASFLAGS='$(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)' - - - - ac_config_files="$ac_config_files Makefile stage1/Makefile stage2/Makefile docs/Makefile lib/Makefile util/Makefile grub/Makefile netboot/Makefile util/grub-image util/grub-install util/grub-md5-crypt util/grub-terminfo util/grub-set-default" - -cat >confcache <<\_ACEOF -# This file is a shell script that caches the results of configure -# tests run on this system so they can be shared between configure -# scripts and configure runs, see configure's option --config-cache. -# It is not useful on other systems. If it contains results you don't -# want to keep, you may remove or edit it. -# -# config.status only pays attention to the cache file if you give it -# the --recheck option to rerun configure. -# -# `ac_cv_env_foo' variables (set or unset) will be overridden when -# loading this file, other *unset* `ac_cv_foo' will be assigned the -# following values. - -_ACEOF - -# The following way of writing the cache mishandles newlines in values, -# but we know of no workaround that is simple, portable, and efficient. -# So, don't put newlines in cache variables' values. -# Ultrix sh set writes to stderr and can't be redirected directly, -# and sets the high bit in the cache file unless we assign to the vars. -{ - (set) 2>&1 | - case `(ac_space=' '; set | grep ac_space) 2>&1` in - *ac_space=\ *) - # `set' does not quote correctly, so add quotes (double-quote - # substitution turns \\\\ into \\, and sed turns \\ into \). - sed -n \ - "s/'/'\\\\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" - ;; - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n \ - "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" - ;; - esac; -} | - sed ' - t clear - : clear - s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ - t end - /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ - : end' >>confcache -if diff $cache_file confcache >/dev/null 2>&1; then :; else - if test -w $cache_file; then - test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" - cat confcache >$cache_file - else - echo "not updating unwritable cache $cache_file" - fi -fi -rm -f confcache - -test "x$prefix" = xNONE && prefix=$ac_default_prefix -# Let make expand exec_prefix. -test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - -# VPATH may cause trouble with some makes, so we remove $(srcdir), -# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and -# trailing colons and then remove the whole line if VPATH becomes empty -# (actually we leave an empty line to preserve line numbers). -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=/{ -s/:*\$(srcdir):*/:/; -s/:*\${srcdir}:*/:/; -s/:*@srcdir@:*/:/; -s/^\([^=]*=[ ]*\):*/\1/; -s/:*$//; -s/^[^=]*=[ ]*$//; -}' -fi - -DEFS=-DHAVE_CONFIG_H - -ac_libobjs= -ac_ltlibobjs= -for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue - # 1. Remove the extension, and $U if already installed. - ac_i=`echo "$ac_i" | - sed 's/\$U\././;s/\.o$//;s/\.obj$//'` - # 2. Add them. - ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" - ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' -done -LIBOBJS=$ac_libobjs - -LTLIBOBJS=$ac_ltlibobjs - - -if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then - { { echo "$as_me:$LINENO: error: conditional \"MAINTAINER_MODE\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -echo "$as_me: error: conditional \"MAINTAINER_MODE\" was never defined. -Usually this means the macro was only invoked conditionally." >&2;} - { (exit 1); exit 1; }; } -fi -if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then - { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -echo "$as_me: error: conditional \"AMDEP\" was never defined. -Usually this means the macro was only invoked conditionally." >&2;} - { (exit 1); exit 1; }; } -fi -if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then - { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. -Usually this means the macro was only invoked conditionally." >&2;} - { (exit 1); exit 1; }; } -fi -if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then - { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. -Usually this means the macro was only invoked conditionally." >&2;} - { (exit 1); exit 1; }; } -fi -if test -z "${NETBOOT_SUPPORT_TRUE}" && test -z "${NETBOOT_SUPPORT_FALSE}"; then - { { echo "$as_me:$LINENO: error: conditional \"NETBOOT_SUPPORT\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -echo "$as_me: error: conditional \"NETBOOT_SUPPORT\" was never defined. -Usually this means the macro was only invoked conditionally." >&2;} - { (exit 1); exit 1; }; } -fi -if test -z "${DISKLESS_SUPPORT_TRUE}" && test -z "${DISKLESS_SUPPORT_FALSE}"; then - { { echo "$as_me:$LINENO: error: conditional \"DISKLESS_SUPPORT\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -echo "$as_me: error: conditional \"DISKLESS_SUPPORT\" was never defined. -Usually this means the macro was only invoked conditionally." >&2;} - { (exit 1); exit 1; }; } -fi -if test -z "${GRAPHICS_SUPPORT_TRUE}" && test -z "${GRAPHICS_SUPPORT_FALSE}"; then - { { echo "$as_me:$LINENO: error: conditional \"GRAPHICS_SUPPORT\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -echo "$as_me: error: conditional \"GRAPHICS_SUPPORT\" was never defined. -Usually this means the macro was only invoked conditionally." >&2;} - { (exit 1); exit 1; }; } -fi -if test -z "${HERCULES_SUPPORT_TRUE}" && test -z "${HERCULES_SUPPORT_FALSE}"; then - { { echo "$as_me:$LINENO: error: conditional \"HERCULES_SUPPORT\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -echo "$as_me: error: conditional \"HERCULES_SUPPORT\" was never defined. -Usually this means the macro was only invoked conditionally." >&2;} - { (exit 1); exit 1; }; } -fi -if test -z "${SERIAL_SUPPORT_TRUE}" && test -z "${SERIAL_SUPPORT_FALSE}"; then - { { echo "$as_me:$LINENO: error: conditional \"SERIAL_SUPPORT\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -echo "$as_me: error: conditional \"SERIAL_SUPPORT\" was never defined. -Usually this means the macro was only invoked conditionally." >&2;} - { (exit 1); exit 1; }; } -fi -if test -z "${SERIAL_SPEED_SIMULATION_TRUE}" && test -z "${SERIAL_SPEED_SIMULATION_FALSE}"; then - { { echo "$as_me:$LINENO: error: conditional \"SERIAL_SPEED_SIMULATION\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -echo "$as_me: error: conditional \"SERIAL_SPEED_SIMULATION\" was never defined. -Usually this means the macro was only invoked conditionally." >&2;} - { (exit 1); exit 1; }; } -fi -if test -z "${BUILD_EXAMPLE_KERNEL_TRUE}" && test -z "${BUILD_EXAMPLE_KERNEL_FALSE}"; then - { { echo "$as_me:$LINENO: error: conditional \"BUILD_EXAMPLE_KERNEL\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -echo "$as_me: error: conditional \"BUILD_EXAMPLE_KERNEL\" was never defined. -Usually this means the macro was only invoked conditionally." >&2;} - { (exit 1); exit 1; }; } -fi - -: ${CONFIG_STATUS=./config.status} -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 -echo "$as_me: creating $CONFIG_STATUS" >&6;} -cat >$CONFIG_STATUS <<_ACEOF -#! $SHELL -# Generated by $as_me. -# Run this file to recreate the current configuration. -# Compiler output produced by configure, useful for debugging -# configure, is in config.log if it exists. - -debug=false -ac_cs_recheck=false -ac_cs_silent=false -SHELL=\${CONFIG_SHELL-$SHELL} -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF -## --------------------- ## -## M4sh Initialization. ## -## --------------------- ## - -# Be Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' -elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then - set -o posix -fi -DUALCASE=1; export DUALCASE # for MKS sh - -# Support unset when possible. -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false -fi - - -# Work around bugs in pre-3.0 UWIN ksh. -$as_unset ENV MAIL MAILPATH -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -for as_var in \ - LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ - LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ - LC_TELEPHONE LC_TIME -do - if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then - eval $as_var=C; export $as_var - else - $as_unset $as_var - fi -done - -# Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - -if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - - -# Name of the executable. -as_me=`$as_basename "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)$' \| \ - . : '\(.\)' 2>/dev/null || -echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } - /^X\/\(\/\/\)$/{ s//\1/; q; } - /^X\/\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - - -# PATH needs CR, and LINENO needs CR and PATH. -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' - else - PATH_SEPARATOR=: - fi - rm -f conf$$.sh -fi - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" || { - # Find who we are. Look in the path if we contain no path at all - # relative or not. - case $0 in - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break -done - - ;; - esac - # We did not find ourselves, most probably we were run as `sh COMMAND' - # in which case we are not to be found in the path. - if test "x$as_myself" = x; then - as_myself=$0 - fi - if test ! -f "$as_myself"; then - { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 -echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} - { (exit 1); exit 1; }; } - fi - case $CONFIG_SHELL in - '') - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for as_base in sh bash ksh sh5; do - case $as_dir in - /*) - if ("$as_dir/$as_base" -c ' - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then - $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } - $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } - CONFIG_SHELL=$as_dir/$as_base - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$0" ${1+"$@"} - fi;; - esac - done -done -;; - esac - - # Create $as_me.lineno as a copy of $as_myself, but with $LINENO - # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line before each line; the second 'sed' does the real - # work. The second script uses 'N' to pair each line-number line - # with the numbered line, and appends trailing '-' during - # substitution so that $LINENO is not a special case at line end. - # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) - sed '=' <$as_myself | - sed ' - N - s,$,-, - : loop - s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, - t loop - s,-$,, - s,^['$as_cr_digits']*\n,, - ' >$as_me.lineno && - chmod +x $as_me.lineno || - { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 -echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} - { (exit 1); exit 1; }; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensible to this). - . ./$as_me.lineno - # Exit status is that of the last command. - exit -} - - -case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in - *c*,-n*) ECHO_N= ECHO_C=' -' ECHO_T=' ' ;; - *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; - *) ECHO_N= ECHO_C='\c' ECHO_T= ;; -esac - -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - -rm -f conf$$ conf$$.exe conf$$.file -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - # We could just check for DJGPP; but this test a) works b) is more generic - # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). - if test -f conf$$.exe; then - # Don't use ln at all; we don't have any links - as_ln_s='cp -p' - else - as_ln_s='ln -s' - fi -elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.file - -if mkdir -p . 2>/dev/null; then - as_mkdir_p=: -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -as_executable_p="test -f" - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - -# IFS -# We need space, tab and new line, in precisely that order. -as_nl=' -' -IFS=" $as_nl" - -# CDPATH. -$as_unset CDPATH - -exec 6>&1 - -# Open the log real soon, to keep \$[0] and so on meaningful, and to -# report actual input values of CONFIG_FILES etc. instead of their -# values after options handling. Logging --version etc. is OK. -exec 5>>config.log -{ - echo - sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX -## Running $as_me. ## -_ASBOX -} >&5 -cat >&5 <<_CSEOF - -This file was extended by GRUB $as_me 0.95, which was -generated by GNU Autoconf 2.59. Invocation command line was - - CONFIG_FILES = $CONFIG_FILES - CONFIG_HEADERS = $CONFIG_HEADERS - CONFIG_LINKS = $CONFIG_LINKS - CONFIG_COMMANDS = $CONFIG_COMMANDS - $ $0 $@ - -_CSEOF -echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 -echo >&5 -_ACEOF - -# Files that config.status was made for. -if test -n "$ac_config_files"; then - echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS -fi - -if test -n "$ac_config_headers"; then - echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS -fi - -if test -n "$ac_config_links"; then - echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS -fi - -if test -n "$ac_config_commands"; then - echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS -fi - -cat >>$CONFIG_STATUS <<\_ACEOF - -ac_cs_usage="\ -\`$as_me' instantiates files from templates according to the -current configuration. - -Usage: $0 [OPTIONS] [FILE]... - - -h, --help print this help, then exit - -V, --version print version number, then exit - -q, --quiet do not print progress messages - -d, --debug don't remove temporary files - --recheck update $as_me by reconfiguring in the same conditions - --file=FILE[:TEMPLATE] - instantiate the configuration file FILE - --header=FILE[:TEMPLATE] - instantiate the configuration header FILE - -Configuration files: -$config_files - -Configuration headers: -$config_headers - -Configuration commands: -$config_commands - -Report bugs to ." -_ACEOF - -cat >>$CONFIG_STATUS <<_ACEOF -ac_cs_version="\\ -GRUB config.status 0.95 -configured by $0, generated by GNU Autoconf 2.59, - with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" - -Copyright (C) 2003 Free Software Foundation, Inc. -This config.status script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it." -srcdir=$srcdir -INSTALL="$INSTALL" -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF -# If no file are specified by the user, then we need to provide default -# value. By we need to know if files were specified by the user. -ac_need_defaults=: -while test $# != 0 -do - case $1 in - --*=*) - ac_option=`expr "x$1" : 'x\([^=]*\)='` - ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` - ac_shift=: - ;; - -*) - ac_option=$1 - ac_optarg=$2 - ac_shift=shift - ;; - *) # This is not an option, so the user has probably given explicit - # arguments. - ac_option=$1 - ac_need_defaults=false;; - esac - - case $ac_option in - # Handling of the options. -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - ac_cs_recheck=: ;; - --version | --vers* | -V ) - echo "$ac_cs_version"; exit 0 ;; - --he | --h) - # Conflict between --help and --header - { { echo "$as_me:$LINENO: error: ambiguous option: $1 -Try \`$0 --help' for more information." >&5 -echo "$as_me: error: ambiguous option: $1 -Try \`$0 --help' for more information." >&2;} - { (exit 1); exit 1; }; };; - --help | --hel | -h ) - echo "$ac_cs_usage"; exit 0 ;; - --debug | --d* | -d ) - debug=: ;; - --file | --fil | --fi | --f ) - $ac_shift - CONFIG_FILES="$CONFIG_FILES $ac_optarg" - ac_need_defaults=false;; - --header | --heade | --head | --hea ) - $ac_shift - CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" - ac_need_defaults=false;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil | --si | --s) - ac_cs_silent=: ;; - - # This is an error. - -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 -Try \`$0 --help' for more information." >&5 -echo "$as_me: error: unrecognized option: $1 -Try \`$0 --help' for more information." >&2;} - { (exit 1); exit 1; }; } ;; - - *) ac_config_targets="$ac_config_targets $1" ;; - - esac - shift -done - -ac_configure_extra_args= - -if $ac_cs_silent; then - exec 6>/dev/null - ac_configure_extra_args="$ac_configure_extra_args --silent" -fi - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF -if \$ac_cs_recheck; then - echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 - exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion -fi - -_ACEOF - -cat >>$CONFIG_STATUS <<_ACEOF -# -# INIT-COMMANDS section. -# - -AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" - -_ACEOF - - - -cat >>$CONFIG_STATUS <<\_ACEOF -for ac_config_target in $ac_config_targets -do - case "$ac_config_target" in - # Handling of arguments. - "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; - "stage1/Makefile" ) CONFIG_FILES="$CONFIG_FILES stage1/Makefile" ;; - "stage2/Makefile" ) CONFIG_FILES="$CONFIG_FILES stage2/Makefile" ;; - "docs/Makefile" ) CONFIG_FILES="$CONFIG_FILES docs/Makefile" ;; - "lib/Makefile" ) CONFIG_FILES="$CONFIG_FILES lib/Makefile" ;; - "util/Makefile" ) CONFIG_FILES="$CONFIG_FILES util/Makefile" ;; - "grub/Makefile" ) CONFIG_FILES="$CONFIG_FILES grub/Makefile" ;; - "netboot/Makefile" ) CONFIG_FILES="$CONFIG_FILES netboot/Makefile" ;; - "util/grub-image" ) CONFIG_FILES="$CONFIG_FILES util/grub-image" ;; - "util/grub-install" ) CONFIG_FILES="$CONFIG_FILES util/grub-install" ;; - "util/grub-md5-crypt" ) CONFIG_FILES="$CONFIG_FILES util/grub-md5-crypt" ;; - "util/grub-terminfo" ) CONFIG_FILES="$CONFIG_FILES util/grub-terminfo" ;; - "util/grub-set-default" ) CONFIG_FILES="$CONFIG_FILES util/grub-set-default" ;; - "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; - "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; - *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 -echo "$as_me: error: invalid argument: $ac_config_target" >&2;} - { (exit 1); exit 1; }; };; - esac -done - -# If the user did not use the arguments to specify the items to instantiate, -# then the envvar interface is used. Set only those that are not. -# We use the long form for the default assignment because of an extremely -# bizarre bug on SunOS 4.1.3. -if $ac_need_defaults; then - test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files - test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers - test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands -fi - -# Have a temporary directory for convenience. Make it in the build tree -# simply because there is no reason to put it here, and in addition, -# creating and moving files from /tmp can sometimes cause problems. -# Create a temporary directory, and hook for its removal unless debugging. -$debug || -{ - trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 - trap '{ (exit 1); exit 1; }' 1 2 13 15 -} - -# Create a (secure) tmp directory for tmp files. - -{ - tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" -} || -{ - tmp=./confstat$$-$RANDOM - (umask 077 && mkdir $tmp) -} || -{ - echo "$me: cannot create a temporary directory in ." >&2 - { (exit 1); exit 1; } -} - -_ACEOF - -cat >>$CONFIG_STATUS <<_ACEOF - -# -# CONFIG_FILES section. -# - -# No need to generate the scripts if there are no CONFIG_FILES. -# This happens for instance when ./config.status config.h -if test -n "\$CONFIG_FILES"; then - # Protect against being on the right side of a sed subst in config.status. - sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; - s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF -s,@SHELL@,$SHELL,;t t -s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t -s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t -s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t -s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t -s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t -s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t -s,@exec_prefix@,$exec_prefix,;t t -s,@prefix@,$prefix,;t t -s,@program_transform_name@,$program_transform_name,;t t -s,@bindir@,$bindir,;t t -s,@sbindir@,$sbindir,;t t -s,@libexecdir@,$libexecdir,;t t -s,@datadir@,$datadir,;t t -s,@sysconfdir@,$sysconfdir,;t t -s,@sharedstatedir@,$sharedstatedir,;t t -s,@localstatedir@,$localstatedir,;t t -s,@libdir@,$libdir,;t t -s,@includedir@,$includedir,;t t -s,@oldincludedir@,$oldincludedir,;t t -s,@infodir@,$infodir,;t t -s,@mandir@,$mandir,;t t -s,@build_alias@,$build_alias,;t t -s,@host_alias@,$host_alias,;t t -s,@target_alias@,$target_alias,;t t -s,@DEFS@,$DEFS,;t t -s,@ECHO_C@,$ECHO_C,;t t -s,@ECHO_N@,$ECHO_N,;t t -s,@ECHO_T@,$ECHO_T,;t t -s,@LIBS@,$LIBS,;t t -s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t -s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t -s,@INSTALL_DATA@,$INSTALL_DATA,;t t -s,@CYGPATH_W@,$CYGPATH_W,;t t -s,@PACKAGE@,$PACKAGE,;t t -s,@VERSION@,$VERSION,;t t -s,@ACLOCAL@,$ACLOCAL,;t t -s,@AUTOCONF@,$AUTOCONF,;t t -s,@AUTOMAKE@,$AUTOMAKE,;t t -s,@AUTOHEADER@,$AUTOHEADER,;t t -s,@MAKEINFO@,$MAKEINFO,;t t -s,@AMTAR@,$AMTAR,;t t -s,@install_sh@,$install_sh,;t t -s,@STRIP@,$STRIP,;t t -s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t -s,@INSTALL_STRIP_PROGRAM@,$INSTALL_STRIP_PROGRAM,;t t -s,@mkdir_p@,$mkdir_p,;t t -s,@AWK@,$AWK,;t t -s,@SET_MAKE@,$SET_MAKE,;t t -s,@am__leading_dot@,$am__leading_dot,;t t -s,@build@,$build,;t t -s,@build_cpu@,$build_cpu,;t t -s,@build_vendor@,$build_vendor,;t t -s,@build_os@,$build_os,;t t -s,@host@,$host,;t t -s,@host_cpu@,$host_cpu,;t t -s,@host_vendor@,$host_vendor,;t t -s,@host_os@,$host_os,;t t -s,@MAINTAINER_MODE_TRUE@,$MAINTAINER_MODE_TRUE,;t t -s,@MAINTAINER_MODE_FALSE@,$MAINTAINER_MODE_FALSE,;t t -s,@MAINT@,$MAINT,;t t -s,@PERL@,$PERL,;t t -s,@CC@,$CC,;t t -s,@ac_ct_CC@,$ac_ct_CC,;t t -s,@CFLAGS@,$CFLAGS,;t t -s,@LDFLAGS@,$LDFLAGS,;t t -s,@CPPFLAGS@,$CPPFLAGS,;t t -s,@EXEEXT@,$EXEEXT,;t t -s,@OBJEXT@,$OBJEXT,;t t -s,@DEPDIR@,$DEPDIR,;t t -s,@am__include@,$am__include,;t t -s,@am__quote@,$am__quote,;t t -s,@AMDEP_TRUE@,$AMDEP_TRUE,;t t -s,@AMDEP_FALSE@,$AMDEP_FALSE,;t t -s,@AMDEPBACKSLASH@,$AMDEPBACKSLASH,;t t -s,@CCDEPMODE@,$CCDEPMODE,;t t -s,@am__fastdepCC_TRUE@,$am__fastdepCC_TRUE,;t t -s,@am__fastdepCC_FALSE@,$am__fastdepCC_FALSE,;t t -s,@CCAS@,$CCAS,;t t -s,@RANLIB@,$RANLIB,;t t -s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t -s,@STAGE1_CFLAGS@,$STAGE1_CFLAGS,;t t -s,@STAGE2_CFLAGS@,$STAGE2_CFLAGS,;t t -s,@GRUB_CFLAGS@,$GRUB_CFLAGS,;t t -s,@OBJCOPY@,$OBJCOPY,;t t -s,@ac_ct_OBJCOPY@,$ac_ct_OBJCOPY,;t t -s,@GRUB_LIBS@,$GRUB_LIBS,;t t -s,@CPP@,$CPP,;t t -s,@EGREP@,$EGREP,;t t -s,@NETBOOT_SUPPORT_TRUE@,$NETBOOT_SUPPORT_TRUE,;t t -s,@NETBOOT_SUPPORT_FALSE@,$NETBOOT_SUPPORT_FALSE,;t t -s,@DISKLESS_SUPPORT_TRUE@,$DISKLESS_SUPPORT_TRUE,;t t -s,@DISKLESS_SUPPORT_FALSE@,$DISKLESS_SUPPORT_FALSE,;t t -s,@GRAPHICS_SUPPORT_TRUE@,$GRAPHICS_SUPPORT_TRUE,;t t -s,@GRAPHICS_SUPPORT_FALSE@,$GRAPHICS_SUPPORT_FALSE,;t t -s,@HERCULES_SUPPORT_TRUE@,$HERCULES_SUPPORT_TRUE,;t t -s,@HERCULES_SUPPORT_FALSE@,$HERCULES_SUPPORT_FALSE,;t t -s,@SERIAL_SUPPORT_TRUE@,$SERIAL_SUPPORT_TRUE,;t t -s,@SERIAL_SUPPORT_FALSE@,$SERIAL_SUPPORT_FALSE,;t t -s,@SERIAL_SPEED_SIMULATION_TRUE@,$SERIAL_SPEED_SIMULATION_TRUE,;t t -s,@SERIAL_SPEED_SIMULATION_FALSE@,$SERIAL_SPEED_SIMULATION_FALSE,;t t -s,@BUILD_EXAMPLE_KERNEL_TRUE@,$BUILD_EXAMPLE_KERNEL_TRUE,;t t -s,@BUILD_EXAMPLE_KERNEL_FALSE@,$BUILD_EXAMPLE_KERNEL_FALSE,;t t -s,@FSYS_CFLAGS@,$FSYS_CFLAGS,;t t -s,@NET_CFLAGS@,$NET_CFLAGS,;t t -s,@NET_EXTRAFLAGS@,$NET_EXTRAFLAGS,;t t -s,@NETBOOT_DRIVERS@,$NETBOOT_DRIVERS,;t t -s,@CCASFLAGS@,$CCASFLAGS,;t t -s,@LIBOBJS@,$LIBOBJS,;t t -s,@LTLIBOBJS@,$LTLIBOBJS,;t t -CEOF - -_ACEOF - - cat >>$CONFIG_STATUS <<\_ACEOF - # Split the substitutions into bite-sized pieces for seds with - # small command number limits, like on Digital OSF/1 and HP-UX. - ac_max_sed_lines=48 - ac_sed_frag=1 # Number of current file. - ac_beg=1 # First line for current file. - ac_end=$ac_max_sed_lines # Line after last line for current file. - ac_more_lines=: - ac_sed_cmds= - while $ac_more_lines; do - if test $ac_beg -gt 1; then - sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag - else - sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag - fi - if test ! -s $tmp/subs.frag; then - ac_more_lines=false - else - # The purpose of the label and of the branching condition is to - # speed up the sed processing (if there are no `@' at all, there - # is no need to browse any of the substitutions). - # These are the two extra sed commands mentioned above. - (echo ':t - /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed - if test -z "$ac_sed_cmds"; then - ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" - else - ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" - fi - ac_sed_frag=`expr $ac_sed_frag + 1` - ac_beg=$ac_end - ac_end=`expr $ac_end + $ac_max_sed_lines` - fi - done - if test -z "$ac_sed_cmds"; then - ac_sed_cmds=cat - fi -fi # test -n "$CONFIG_FILES" - -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case $ac_file in - - | *:- | *:-:* ) # input from stdin - cat >$tmp/stdin - ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - * ) ac_file_in=$ac_file.in ;; - esac - - # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. - ac_dir=`(dirname "$ac_file") 2>/dev/null || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - { if $as_mkdir_p; then - mkdir -p "$ac_dir" - else - as_dir="$ac_dir" - as_dirs= - while test ! -d "$as_dir"; do - as_dirs="$as_dir $as_dirs" - as_dir=`(dirname "$as_dir") 2>/dev/null || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - done - test ! -n "$as_dirs" || mkdir $as_dirs - fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 -echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} - { (exit 1); exit 1; }; }; } - - ac_builddir=. - -if test "$ac_dir" != .; then - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A "../" for each directory in $ac_dir_suffix. - ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` -else - ac_dir_suffix= ac_top_builddir= -fi - -case $srcdir in - .) # No --srcdir option. We are building in place. - ac_srcdir=. - if test -z "$ac_top_builddir"; then - ac_top_srcdir=. - else - ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` - fi ;; - [\\/]* | ?:[\\/]* ) # Absolute path. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir ;; - *) # Relative path. - ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_builddir$srcdir ;; -esac - -# Do not use `cd foo && pwd` to compute absolute paths, because -# the directories may not exist. -case `pwd` in -.) ac_abs_builddir="$ac_dir";; -*) - case "$ac_dir" in - .) ac_abs_builddir=`pwd`;; - [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; - *) ac_abs_builddir=`pwd`/"$ac_dir";; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_builddir=${ac_top_builddir}.;; -*) - case ${ac_top_builddir}. in - .) ac_abs_top_builddir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; - *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_srcdir=$ac_srcdir;; -*) - case $ac_srcdir in - .) ac_abs_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; - *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_srcdir=$ac_top_srcdir;; -*) - case $ac_top_srcdir in - .) ac_abs_top_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; - *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; - esac;; -esac - - - case $INSTALL in - [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; - *) ac_INSTALL=$ac_top_builddir$INSTALL ;; - esac - - if test x"$ac_file" != x-; then - { echo "$as_me:$LINENO: creating $ac_file" >&5 -echo "$as_me: creating $ac_file" >&6;} - rm -f "$ac_file" - fi - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - if test x"$ac_file" = x-; then - configure_input= - else - configure_input="$ac_file. " - fi - configure_input=$configure_input"Generated from `echo $ac_file_in | - sed 's,.*/,,'` by configure." - - # First look for the input files in the build tree, otherwise in the - # src tree. - ac_file_inputs=`IFS=: - for f in $ac_file_in; do - case $f in - -) echo $tmp/stdin ;; - [\\/$]*) - # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - echo "$f";; - *) # Relative - if test -f "$f"; then - # Build tree - echo "$f" - elif test -f "$srcdir/$f"; then - # Source tree - echo "$srcdir/$f" - else - # /dev/null tree - { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - fi;; - esac - done` || { (exit 1); exit 1; } -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF - sed "$ac_vpsub -$extrasub -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -:t -/@[a-zA-Z_][a-zA-Z_0-9]*@/!b -s,@configure_input@,$configure_input,;t t -s,@srcdir@,$ac_srcdir,;t t -s,@abs_srcdir@,$ac_abs_srcdir,;t t -s,@top_srcdir@,$ac_top_srcdir,;t t -s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t -s,@builddir@,$ac_builddir,;t t -s,@abs_builddir@,$ac_abs_builddir,;t t -s,@top_builddir@,$ac_top_builddir,;t t -s,@abs_top_builddir@,$ac_abs_top_builddir,;t t -s,@INSTALL@,$ac_INSTALL,;t t -" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out - rm -f $tmp/stdin - if test x"$ac_file" != x-; then - mv $tmp/out $ac_file - else - cat $tmp/out - rm -f $tmp/out - fi - -done -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF - -# -# CONFIG_HEADER section. -# - -# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where -# NAME is the cpp macro being defined and VALUE is the value it is being given. -# -# ac_d sets the value in "#define NAME VALUE" lines. -ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' -ac_dB='[ ].*$,\1#\2' -ac_dC=' ' -ac_dD=',;t' -# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". -ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' -ac_uB='$,\1#\2define\3' -ac_uC=' ' -ac_uD=',;t' - -for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case $ac_file in - - | *:- | *:-:* ) # input from stdin - cat >$tmp/stdin - ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - * ) ac_file_in=$ac_file.in ;; - esac - - test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 -echo "$as_me: creating $ac_file" >&6;} - - # First look for the input files in the build tree, otherwise in the - # src tree. - ac_file_inputs=`IFS=: - for f in $ac_file_in; do - case $f in - -) echo $tmp/stdin ;; - [\\/$]*) - # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - # Do quote $f, to prevent DOS paths from being IFS'd. - echo "$f";; - *) # Relative - if test -f "$f"; then - # Build tree - echo "$f" - elif test -f "$srcdir/$f"; then - # Source tree - echo "$srcdir/$f" - else - # /dev/null tree - { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - fi;; - esac - done` || { (exit 1); exit 1; } - # Remove the trailing spaces. - sed 's/[ ]*$//' $ac_file_inputs >$tmp/in - -_ACEOF - -# Transform confdefs.h into two sed scripts, `conftest.defines' and -# `conftest.undefs', that substitutes the proper values into -# config.h.in to produce config.h. The first handles `#define' -# templates, and the second `#undef' templates. -# And first: Protect against being on the right side of a sed subst in -# config.status. Protect against being in an unquoted here document -# in config.status. -rm -f conftest.defines conftest.undefs -# Using a here document instead of a string reduces the quoting nightmare. -# Putting comments in sed scripts is not portable. -# -# `end' is used to avoid that the second main sed command (meant for -# 0-ary CPP macros) applies to n-ary macro definitions. -# See the Autoconf documentation for `clear'. -cat >confdef2sed.sed <<\_ACEOF -s/[\\&,]/\\&/g -s,[\\$`],\\&,g -t clear -: clear -s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp -t end -s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp -: end -_ACEOF -# If some macros were called several times there might be several times -# the same #defines, which is useless. Nevertheless, we may not want to -# sort them, since we want the *last* AC-DEFINE to be honored. -uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines -sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs -rm -f confdef2sed.sed - -# This sed command replaces #undef with comments. This is necessary, for -# example, in the case of _POSIX_SOURCE, which is predefined and required -# on some systems where configure will not decide to define it. -cat >>conftest.undefs <<\_ACEOF -s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, -_ACEOF - -# Break up conftest.defines because some shells have a limit on the size -# of here documents, and old seds have small limits too (100 cmds). -echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS -echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS -echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS -echo ' :' >>$CONFIG_STATUS -rm -f conftest.tail -while grep . conftest.defines >/dev/null -do - # Write a limited-size here document to $tmp/defines.sed. - echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS - # Speed up: don't consider the non `#define' lines. - echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS - # Work around the forget-to-reset-the-flag bug. - echo 't clr' >>$CONFIG_STATUS - echo ': clr' >>$CONFIG_STATUS - sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS - echo 'CEOF - sed -f $tmp/defines.sed $tmp/in >$tmp/out - rm -f $tmp/in - mv $tmp/out $tmp/in -' >>$CONFIG_STATUS - sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail - rm -f conftest.defines - mv conftest.tail conftest.defines -done -rm -f conftest.defines -echo ' fi # grep' >>$CONFIG_STATUS -echo >>$CONFIG_STATUS - -# Break up conftest.undefs because some shells have a limit on the size -# of here documents, and old seds have small limits too (100 cmds). -echo ' # Handle all the #undef templates' >>$CONFIG_STATUS -rm -f conftest.tail -while grep . conftest.undefs >/dev/null -do - # Write a limited-size here document to $tmp/undefs.sed. - echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS - # Speed up: don't consider the non `#undef' - echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS - # Work around the forget-to-reset-the-flag bug. - echo 't clr' >>$CONFIG_STATUS - echo ': clr' >>$CONFIG_STATUS - sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS - echo 'CEOF - sed -f $tmp/undefs.sed $tmp/in >$tmp/out - rm -f $tmp/in - mv $tmp/out $tmp/in -' >>$CONFIG_STATUS - sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail - rm -f conftest.undefs - mv conftest.tail conftest.undefs -done -rm -f conftest.undefs - -cat >>$CONFIG_STATUS <<\_ACEOF - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - if test x"$ac_file" = x-; then - echo "/* Generated by configure. */" >$tmp/config.h - else - echo "/* $ac_file. Generated by configure. */" >$tmp/config.h - fi - cat $tmp/in >>$tmp/config.h - rm -f $tmp/in - if test x"$ac_file" != x-; then - if diff $ac_file $tmp/config.h >/dev/null 2>&1; then - { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 -echo "$as_me: $ac_file is unchanged" >&6;} - else - ac_dir=`(dirname "$ac_file") 2>/dev/null || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - { if $as_mkdir_p; then - mkdir -p "$ac_dir" - else - as_dir="$ac_dir" - as_dirs= - while test ! -d "$as_dir"; do - as_dirs="$as_dir $as_dirs" - as_dir=`(dirname "$as_dir") 2>/dev/null || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - done - test ! -n "$as_dirs" || mkdir $as_dirs - fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 -echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} - { (exit 1); exit 1; }; }; } - - rm -f $ac_file - mv $tmp/config.h $ac_file - fi - else - cat $tmp/config.h - rm -f $tmp/config.h - fi -# Compute $ac_file's index in $config_headers. -_am_stamp_count=1 -for _am_header in $config_headers :; do - case $_am_header in - $ac_file | $ac_file:* ) - break ;; - * ) - _am_stamp_count=`expr $_am_stamp_count + 1` ;; - esac -done -echo "timestamp for $ac_file" >`(dirname $ac_file) 2>/dev/null || -$as_expr X$ac_file : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X$ac_file : 'X\(//\)[^/]' \| \ - X$ac_file : 'X\(//\)$' \| \ - X$ac_file : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X$ac_file | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'`/stamp-h$_am_stamp_count -done -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF - -# -# CONFIG_COMMANDS section. -# -for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue - ac_dest=`echo "$ac_file" | sed 's,:.*,,'` - ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_dir=`(dirname "$ac_dest") 2>/dev/null || -$as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_dest" : 'X\(//\)[^/]' \| \ - X"$ac_dest" : 'X\(//\)$' \| \ - X"$ac_dest" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$ac_dest" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - { if $as_mkdir_p; then - mkdir -p "$ac_dir" - else - as_dir="$ac_dir" - as_dirs= - while test ! -d "$as_dir"; do - as_dirs="$as_dir $as_dirs" - as_dir=`(dirname "$as_dir") 2>/dev/null || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - done - test ! -n "$as_dirs" || mkdir $as_dirs - fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 -echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} - { (exit 1); exit 1; }; }; } - - ac_builddir=. - -if test "$ac_dir" != .; then - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A "../" for each directory in $ac_dir_suffix. - ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` -else - ac_dir_suffix= ac_top_builddir= -fi - -case $srcdir in - .) # No --srcdir option. We are building in place. - ac_srcdir=. - if test -z "$ac_top_builddir"; then - ac_top_srcdir=. - else - ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` - fi ;; - [\\/]* | ?:[\\/]* ) # Absolute path. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir ;; - *) # Relative path. - ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_builddir$srcdir ;; -esac - -# Do not use `cd foo && pwd` to compute absolute paths, because -# the directories may not exist. -case `pwd` in -.) ac_abs_builddir="$ac_dir";; -*) - case "$ac_dir" in - .) ac_abs_builddir=`pwd`;; - [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; - *) ac_abs_builddir=`pwd`/"$ac_dir";; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_builddir=${ac_top_builddir}.;; -*) - case ${ac_top_builddir}. in - .) ac_abs_top_builddir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; - *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_srcdir=$ac_srcdir;; -*) - case $ac_srcdir in - .) ac_abs_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; - *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_srcdir=$ac_top_srcdir;; -*) - case $ac_top_srcdir in - .) ac_abs_top_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; - *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; - esac;; -esac - - - { echo "$as_me:$LINENO: executing $ac_dest commands" >&5 -echo "$as_me: executing $ac_dest commands" >&6;} - case $ac_dest in - depfiles ) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do - # Strip MF so we end up with the name of the file. - mf=`echo "$mf" | sed -e 's/:.*$//'` - # Check whether this is an Automake generated Makefile or not. - # We used to match only the files named `Makefile.in', but - # some people rename them; so instead we look at the file content. - # Grep'ing the first line is not enough: some people post-process - # each Makefile.in and add a new line on top of each file to say so. - # So let's grep whole file. - if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then - dirpart=`(dirname "$mf") 2>/dev/null || -$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$mf" : 'X\(//\)[^/]' \| \ - X"$mf" : 'X\(//\)$' \| \ - X"$mf" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$mf" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - else - continue - fi - grep '^DEP_FILES *= *[^ #]' < "$mf" > /dev/null || continue - # Extract the definition of DEP_FILES from the Makefile without - # running `make'. - DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"` - test -z "$DEPDIR" && continue - # When using ansi2knr, U may be empty or an underscore; expand it - U=`sed -n -e '/^U = / s///p' < "$mf"` - test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR" - # We invoke sed twice because it is the simplest approach to - # changing $(DEPDIR) to its actual value in the expansion. - for file in `sed -n -e ' - /^DEP_FILES = .*\\\\$/ { - s/^DEP_FILES = // - :loop - s/\\\\$// - p - n - /\\\\$/ b loop - p - } - /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do - # Make sure the directory exists. - test -f "$dirpart/$file" && continue - fdir=`(dirname "$file") 2>/dev/null || -$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$file" : 'X\(//\)[^/]' \| \ - X"$file" : 'X\(//\)$' \| \ - X"$file" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - { if $as_mkdir_p; then - mkdir -p $dirpart/$fdir - else - as_dir=$dirpart/$fdir - as_dirs= - while test ! -d "$as_dir"; do - as_dirs="$as_dir $as_dirs" - as_dir=`(dirname "$as_dir") 2>/dev/null || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - done - test ! -n "$as_dirs" || mkdir $as_dirs - fi || { { echo "$as_me:$LINENO: error: cannot create directory $dirpart/$fdir" >&5 -echo "$as_me: error: cannot create directory $dirpart/$fdir" >&2;} - { (exit 1); exit 1; }; }; } - - # echo "creating $dirpart/$file" - echo '# dummy' > "$dirpart/$file" - done -done - ;; - esac -done -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF - -{ (exit 0); exit 0; } -_ACEOF -chmod +x $CONFIG_STATUS -ac_clean_files=$ac_clean_files_save - - -# configure is writing to config.log, and then calls config.status. -# config.status does its own redirection, appending to config.log. -# Unfortunately, on DOS this fails, as config.log is still kept open -# by configure, so config.status won't be able to write to it; its -# output is simply discarded. So we exec the FD to /dev/null, -# effectively closing config.log, so it can be properly (re)opened and -# appended to by config.status. When coming back to configure, we -# need to make the FD available again. -if test "$no_create" != yes; then - ac_cs_success=: - ac_config_status_args= - test "$silent" = yes && - ac_config_status_args="$ac_config_status_args --quiet" - exec 5>/dev/null - $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false - exec 5>>config.log - # Use ||, not &&, to avoid exiting from the if with $? = 1, which - # would make configure fail if this is the last instruction. - $ac_cs_success || { (exit 1); exit 1; } -fi - diff --git a/usr/src/grub/grub-0.95/configure.ac b/usr/src/grub/grub-0.95/configure.ac deleted file mode 100644 index 2a5e69faa8..0000000000 --- a/usr/src/grub/grub-0.95/configure.ac +++ /dev/null @@ -1,605 +0,0 @@ -dnl Configure script for GRUB. -dnl Copyright 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc. - -dnl Permission to use, copy, modify and distribute this software and its -dnl documentation is hereby granted, provided that both the copyright -dnl notice and this permission notice appear in all copies of the -dnl software, derivative works or modified versions, and any portions -dnl thereof, and that both notices appear in supporting documentation. -dnl -dnl THE FREE SOFTWARE FOUNDATION ALLOWS FREE USE OF THIS SOFTWARE IN ITS -dnl "AS IS" CONDITION. THE FREE SOFTWARE FOUNDATION DISCLAIMS ANY -dnl LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE -dnl USE OF THIS SOFTWARE. - -AC_PREREQ(2.57) -AC_INIT([GRUB], [0.95], [bug-grub@gnu.org]) -AC_CONFIG_SRCDIR([stage2/stage2.c]) -AC_CONFIG_HEADER([config.h]) -AM_INIT_AUTOMAKE - -AC_CANONICAL_HOST - -case "$host_cpu" in -i[[3456]]86) host_cpu=i386 ;; -x86_64) host_cpu=x86_64 ;; -*) AC_MSG_ERROR([unsupported CPU type]) ;; -esac - -AC_SUBST(host_cpu) -AC_SUBST(host_vendor) - -# -# Options -# - -AM_MAINTAINER_MODE -if test "x$enable_maintainer_mode" = xyes; then - AC_PATH_PROG(PERL,perl) - if test -z "$PERL"; then - AC_MSG_ERROR([perl not found]) - fi -fi - -# This should be checked before AC_PROG_CC -if test "x$CFLAGS" = x; then - default_CFLAGS=yes -fi - -if test "x$host_cpu" = xx86_64; then - CFLAGS="-m32 $CFLAGS" -fi - -# -# Programs -# - -AC_CHECK_TOOL(CC, gcc) -AC_PROG_CC -# We need this for older versions of Autoconf. -_AM_DEPENDENCIES(CC) - -dnl Because recent automake complains about AS, set it here. -CCAS="$CC" -AC_SUBST(CCAS) - -AC_ARG_WITH(binutils, - [ --with-binutils=DIR search the directory DIR to find binutils]) - -if test "x$with_binutils" != x; then -dnl AC_PATH_TOOL is not seen in autoconf 2.13, so use AC_PATH_PROG -dnl instead for now. It is preferable when you cross-compile GRUB. -dnl AC_PATH_TOOL(RANLIB, ranlib, :, "$with_binutils:$PATH") - AC_PATH_PROG(RANLIB, ranlib, :, "$with_binutils:$PATH") -else - AC_PROG_RANLIB -fi - -# optimization flags -if test "x$ac_cv_prog_gcc" = xyes; then - if test "x$default_CFLAGS" = xyes; then - # Autoconf may set CFLAGS to -O2 and/or -g. So eliminate them. - CFLAGS="`echo $CFLAGS | sed -e 's/-g//g' -e 's/-O[[0-9]]//g'` -g" - # If the user specify the directory for binutils, add the option `-B'. - if test "x$with_binutils" != x; then - CFLAGS="-B$with_binutils/ $CFLAGS" - fi - STAGE1_CFLAGS="-O2" - GRUB_CFLAGS="-O2" - AC_CACHE_CHECK([whether optimization for size works], size_flag, [ - saved_CFLAGS=$CFLAGS - CFLAGS="-Os -g" - AC_TRY_COMPILE(, , size_flag=yes, size_flag=no) - CFLAGS=$saved_CFLAGS - ]) - if test "x$size_flag" = xyes; then - STAGE2_CFLAGS="-Os" - else - STAGE2_CFLAGS="-O2 -fno-strength-reduce -fno-unroll-loops" - fi - # OpenBSD has a GCC extension for protecting applications from - # stack smashing attacks, but GRUB doesn't want this feature. - AC_CACHE_CHECK([whether gcc has -fno-stack-protector], - no_stack_protector_flag, [ - saved_CFLAGS=$CFLAGS - CFLAGS="-fno-stack-protector" - AC_TRY_COMPILE(, - , - no_stack_protector_flag=yes, - no_stack_protector_flag=no) - CFLAGS=$saved_CFLAGS - ]) - if test "x$no_stack_protector_flag" = xyes; then - STAGE2_CFLAGS="$STAGE2_CFLAGS -fno-stack-protector" - fi - fi -fi - -AC_SUBST(STAGE1_CFLAGS) -AC_SUBST(STAGE2_CFLAGS) -AC_SUBST(GRUB_CFLAGS) - -# Enforce coding standards. -CPPFLAGS="$CPPFLAGS -Wall -Wmissing-prototypes -Wunused -Wshadow" -CPPFLAGS="$CPPFLAGS -Wpointer-arith" - -AC_CACHE_CHECK([whether -Wundef works], undef_flag, [ - saved_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="-Wundef" - AC_TRY_COMPILE(, , undef_flag=yes, undef_flag=no) - CPPFLAGS="$saved_CPPFLAGS" -]) - -# The options `-falign-*' are supported by gcc 3.0 or later. -# Probably it is sufficient to only check for -falign-loops. -AC_CACHE_CHECK([whether -falign-loops works], [falign_loop_flag], [ - saved_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="-falign-loops=1" - AC_TRY_COMPILE(, , [falign_loop_flag=yes], [falign_loop_flag=no]) - CPPFLAGS="$saved_CPPFLAGS" -]) - -# Force no alignment to save space. -if test "x$falign_loop_flag" = xyes; then - CPPFLAGS="$CPPFLAGS -falign-jumps=1 -falign-loops=1 -falign-functions=1" -else - CPPFLAGS="$CPPFLAGS -malign-jumps=1 -malign-loops=1 -malign-functions=1" -fi - -if test "x$undef_flag" = xyes; then - CPPFLAGS="$CPPFLAGS -Wundef" -fi - -if test "x$with_binutils" != x; then -dnl AC_PATH_TOOL(OBJCOPY, objcopy, , "$with_binutils:$PATH") - AC_PATH_PROG(OBJCOPY, objcopy, , "$with_binutils:$PATH") -else - AC_CHECK_TOOL(OBJCOPY, objcopy) -fi - -# Defined in acinclude.m4. -grub_ASM_USCORE -grub_PROG_OBJCOPY_ABSOLUTE -if test "x$grub_cv_prog_objcopy_absolute" != xyes; then - AC_MSG_ERROR([GRUB requires a working absolute objcopy; upgrade your binutils]) -fi - -grub_ASM_PREFIX_REQUIREMENT - -grub_ASM_ADDR32 -if test "x$grub_cv_asm_addr32" != xyes; then - AC_MSG_ERROR([GRUB requires GAS .code16 addr32 support; upgrade your binutils]) -fi - -grub_ASM_ABSOLUTE_WITHOUT_ASTERISK - -grub_CHECK_START_SYMBOL -grub_CHECK_USCORE_START_SYMBOL -if test "x$grub_cv_check_start_symbol" != "xyes" \ - -a "x$grub_cv_check_uscore_start_symbol" != "xyes"; then - AC_MSG_ERROR([Neither start nor _start is defined]) -fi - -grub_CHECK_USCORE_USCORE_BSS_START_SYMBOL -grub_CHECK_USCORE_EDATA_SYMBOL -grub_CHECK_EDATA_SYMBOL -if test "x$grub_cv_check_uscore_uscore_bss_start_symbol" != "xyes" \ - -a "x$grub_cv_check_uscore_edata_symbol" != "xyes" \ - -a "x$grub_cv_check_edata_symbol" != "xyes"; then - AC_MSG_ERROR([None of __bss_start, _edata, edata defined]) -fi - -grub_CHECK_END_SYMBOL -grub_CHECK_USCORE_END_SYMBOL -if test "x$grub_cv_check_end_symbol" != "xyes" \ - -a "x$grub_cv_check_uscore_end_symbol" != "xyes"; then - AC_MSG_ERROR([Neither end nor _end is defined]) -fi - -# Check for curses libraries. -AC_ARG_WITH(curses, - [ --without-curses do not use curses]) - -# Get the filename or the whole disk and open it. -# Known to work on NetBSD. -AC_CHECK_LIB(util, opendisk, [GRUB_LIBS="$GRUB_LIBS -lutil" - AC_DEFINE(HAVE_OPENDISK, 1, [Define if opendisk() in -lutil can be used])]) - -# Unless the user specify --without-curses, check for curses. -if test "x$with_curses" != "xno"; then - AC_CHECK_LIB(ncurses, wgetch, [GRUB_LIBS="$GRUB_LIBS -lncurses" - AC_DEFINE(HAVE_LIBCURSES, 1, [Define if you have a curses library])], - [AC_CHECK_LIB(curses, wgetch, [GRUB_LIBS="$GRUB_LIBS -lcurses" - AC_DEFINE(HAVE_LIBCURSES, 1, [Define if you have a curses library])])]) -fi - -AC_SUBST(GRUB_LIBS) - -# Check for headers. -AC_CHECK_HEADERS(string.h strings.h ncurses/curses.h ncurses.h curses.h) - -# Check for user options. - -# filesystems support. -AC_ARG_ENABLE(ext2fs, - [ --disable-ext2fs disable ext2fs support in Stage 2]) - -if test x"$enable_ext2fs" != xno; then - FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_EXT2FS=1" -fi - -AC_ARG_ENABLE(fat, - [ --disable-fat disable FAT support in Stage 2]) - -if test x"$enable_fat" != xno; then - FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_FAT=1" -fi - -AC_ARG_ENABLE(ffs, - [ --disable-ffs disable FFS support in Stage 2]) - -if test x"$enable_ffs" != xno; then - FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_FFS=1" -fi - -AC_ARG_ENABLE(ufs, - [ --disable-ufs disable UFS support in Stage 2]) - -if test x"$enable_ufs" != xno; then - FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_UFS=1" -fi - -AC_ARG_ENABLE(ufs2, - [ --disable-ufs2 disable UFS2 support in Stage 2]) - -if test x"$enable_ufs2" != xno; then - FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_UFS2=1" -fi - -AC_ARG_ENABLE(minix, - [ --disable-minix disable Minix fs support in Stage 2]) - -if test x"$enable_minix" != xno; then - FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_MINIX=1" -fi - -AC_ARG_ENABLE(reiserfs, - [ --disable-reiserfs disable ReiserFS support in Stage 2]) - -if test x"$enable_reiserfs" != xno; then - FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_REISERFS=1" -fi - -AC_ARG_ENABLE(vstafs, - [ --disable-vstafs disable VSTa FS support in Stage 2]) - -if test x"$enable_vstafs" != xno; then - FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_VSTAFS=1" -fi - -AC_ARG_ENABLE(jfs, - [ --disable-jfs disable IBM JFS support in Stage 2]) - -if test x"$enable_jfs" != xno; then - FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_JFS=1" -fi - -AC_ARG_ENABLE(xfs, - [ --disable-xfs disable SGI XFS support in Stage 2]) - -if test x"$enable_xfs" != xno; then - FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_XFS=1" -fi - -AC_ARG_ENABLE(zfs, - [ --disable-zfs disable ZFS support in Stage 2]) - -if test x"$enable_zfs" != xno; then - FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_ZFS=1" -fi - -AC_ARG_ENABLE(iso9660, - [ --disable-iso9660 disable ISO9660 support in Stage 2]) - -if test x"$enable_iso9660" != xno; then - FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_ISO9660=1" -fi - -dnl AC_ARG_ENABLE(tftp, -dnl [ --enable-tftp enable TFTP support in Stage 2]) -dnl -dnl #if test x"$enable_tftp" = xyes; then -dnl FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_TFTP=1" -dnl fi - -AC_ARG_ENABLE(gunzip, - [ --disable-gunzip disable decompression in Stage 2]) - -if test x"$enable_gunzip" = xno; then - FSYS_CFLAGS="$FSYS_CFLAGS -DNO_DECOMPRESSION=1" -fi - -AC_ARG_ENABLE(md5-password, - [ --disable-md5-password disable MD5 password support in Stage 2]) -if test "x$enable_md5_password" != xno; then - FSYS_CFLAGS="$FSYS_CFLAGS -DUSE_MD5_PASSWORDS=1" -fi - -dnl The netboot support. -dnl General options. -AC_ARG_ENABLE(packet-retransmission, - [ --disable-packet-retransmission - turn off packet retransmission]) -if test "x$enable_packet_retransmission" != xno; then - NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DCONGESTED=1 -DCONFIG_PCI" -fi - -AC_ARG_ENABLE(pci-direct, - [ --enable-pci-direct access PCI directly instead of using BIOS]) -if test "x$enable_pci_direct" = xyes; then - NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DCONFIG_PCI_DIRECT=1" -fi - -dnl Device drivers. -AC_ARG_ENABLE(3c595, - [ --enable-3c595 enable 3Com595 driver]) -if test "x$enable_3c595" = xyes; then - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_3C595=1" - NETBOOT_DRIVERS="$NETBOOT_DRIVERS 3c595.o" -fi - -AC_ARG_ENABLE(3c90x, - [ --enable-3c90x enable 3Com90x driver]) -if test "x$enable_3c90x" = xyes; then - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_3C90X=1" - NETBOOT_DRIVERS="$NETBOOT_DRIVERS 3c90x.o" -fi - -AC_ARG_ENABLE(davicom, - [ --enable-davicom enable Davicom driver]) -if test "x$enable_davicom" = xyes; then - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_DAVICOM=1" - NETBOOT_DRIVERS="$NETBOOT_DRIVERS davicom.o" -fi - -AC_ARG_ENABLE(e1000, - [ --enable-e1000 enable Etherexpress Pro/1000 driver]) -if test "x$enable_e1000" = xyes; then - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_E1000=1" - NETBOOT_DRIVERS="$NETBOOT_DRIVERS e1000.o" -fi - -AC_ARG_ENABLE(eepro100, - [ --enable-eepro100 enable Etherexpress Pro/100 driver]) -if test "x$enable_eepro100" = xyes; then - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_EEPRO100=1" - NETBOOT_DRIVERS="$NETBOOT_DRIVERS eepro100.o" -fi - -AC_ARG_ENABLE(epic100, - [ --enable-epic100 enable SMC 83c170 EPIC/100 driver]) -if test "x$enable_epic100" = xyes; then - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_EPIC100=1" - NETBOOT_DRIVERS="$NETBOOT_DRIVERS epic100.o" -fi - -AC_ARG_ENABLE(forcedeth, - [ --enable-forcedeth enable Nvidia Geforce driver]) -if test "x$enable_forcedeth" = xyes; then - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_FORCEDETH=1" - NETBOOT_DRIVERS="$NETBOOT_DRIVERS forcedeth.o" -fi - -AC_ARG_ENABLE(natsemi, - [ --enable-natsemi enable NatSemi DP8381x driver]) -if test "x$enable_natsemi" = xyes; then - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_NATSEMI=1" - NETBOOT_DRIVERS="$NETBOOT_DRIVERS natsemi.o" -fi - -AC_ARG_ENABLE(ns83820, - [ --enable-ns83820 enable NS83820 driver]) -if test "x$enable_ns83820" = xyes; then - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_NS83820=1" - NETBOOT_DRIVERS="$NETBOOT_DRIVERS ns83820.o" -fi - -AC_ARG_ENABLE(ns8390, - [ --enable-ns8390 enable NE2000 PCI driver]) -if test "x$enable_ns8390" = xyes; then - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_NS8390=1" - NETBOOT_DRIVERS="$NETBOOT_DRIVERS ns8390.o" -fi - -AC_ARG_ENABLE(pcnet32, - [ --enable-pcnet32 enable AMD Lance/PCI PCNet/32 driver]) -if test "x$enable_pcnet32" = xyes; then - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_PCNET32=1" - NETBOOT_DRIVERS="$NETBOOT_DRIVERS pcnet32.o" -fi - -AC_ARG_ENABLE(pnic, - [ --enable-pnic enable Bochs Pseudo Nic driver]) -if test "x$enable_pnic" = xyes; then - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_PNIC=1" - NETBOOT_DRIVERS="$NETBOOT_DRIVERS pnic.o" -fi - -AC_ARG_ENABLE(rtl8139, - [ --enable-rtl8139 enable Realtek 8139 driver]) -if test "x$enable_rtl8139" = xyes; then - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_RTL8139=1" - NETBOOT_DRIVERS="$NETBOOT_DRIVERS rtl8139.o" -fi - -AC_ARG_ENABLE(r8169, - [ --enable-r8169 enable Realtek 8169 driver]) -if test "x$enable_r8169" = xyes; then - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_R8169=1" - NETBOOT_DRIVERS="$NETBOOT_DRIVERS r8169.o" -fi - -AC_ARG_ENABLE(sis900, - [ --enable-sis900 enable SIS 900 and SIS 7016 driver]) -if test "x$enable_sis900" = xyes; then - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_SIS900=1" - NETBOOT_DRIVERS="$NETBOOT_DRIVERS sis900.o" -fi - -AC_ARG_ENABLE(sundance, - [ --enable-sundance enable Sundance ST201 driver]) -if test "x$enable_sundance" = xyes; then - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_SUNDANCE=1" - NETBOOT_DRIVERS="$NETBOOT_DRIVERS sundance.o" -fi - -AC_ARG_ENABLE(tg3, - [ --enable-tg3 enable Broadcom Tigon3 driver]) -if test "x$enable_tg3" = xyes; then - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_TG3=1" - NETBOOT_DRIVERS="$NETBOOT_DRIVERS tg3.o" -fi - -AC_ARG_ENABLE(tulip, - [ --enable-tulip enable Tulip driver]) -if test "x$enable_tulip" = xyes; then - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_TULIP=1" - NETBOOT_DRIVERS="$NETBOOT_DRIVERS tulip.o" -fi - -AC_ARG_ENABLE(tlan, - [ --enable-tlan enable TI ThunderLAN driver]) -if test "x$enable_tlan" = xyes; then - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_TLAN=1" - NETBOOT_DRIVERS="$NETBOOT_DRIVERS tlan.o" -fi - -AC_ARG_ENABLE(undi, - [ --enable-undi enable PXE UNDI driver]) -if test "x$enable_undi" = xyes; then - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_UNDI=1" - NETBOOT_DRIVERS="$NETBOOT_DRIVERS undi.o" -fi - -AC_ARG_ENABLE(via-rhine, - [ --enable-via-rhine enable Rhine-I/II driver]) -if test "x$enable_via_rhine" = xyes; then - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_VIA_RHINE=1" - NETBOOT_DRIVERS="$NETBOOT_DRIVERS via_rhine.o" -fi - -AC_ARG_ENABLE(w89c840, - [ --enable-w89c840 enable Winbond W89c840 driver]) -if test "x$enable_w89c840" = xyes; then - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_W89C840=1" - NETBOOT_DRIVERS="$NETBOOT_DRIVERS w89c840.o" -fi - -dnl Check if the netboot support is turned on. -AM_CONDITIONAL(NETBOOT_SUPPORT, test "x$NET_CFLAGS" != x) -if test "x$NET_CFLAGS" != x; then - FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_TFTP=1" -fi - -dnl extra flag for ns8390.c -AC_ARG_ENABLE(compex-rl2000-fix, - [ --enable-compex-rl2000-fix - specify this if you have a Compex RL2000 PCI]) -if test "x$enable_compex_rl2000_fix" = xyes; then - NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DCOMPEX_RL2000_FIX=1" -fi - -AC_ARG_ENABLE(ne-scan, - [ --enable-ne-scan=LIST probe for NE base address using LIST], - [NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DNE_SCAN=$enable_ne_scan"], - [NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DNE_SCAN=0x280,0x300,0x320,0x340"]) - -AC_ARG_ENABLE(wd-default-mem, - [ --enable-wd-default-mem=MEM - set the default memory location for WD/SMC], - [NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DWD_DEFAULT_MEM=$enable_wd_default_mem"], - [NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DWD_DEFAULT_MEM=0xCC000"]) - -dnl Diskless -AC_ARG_ENABLE(diskless, - [ --enable-diskless enable diskless support]) -AM_CONDITIONAL(DISKLESS_SUPPORT, test "x$enable_diskless" = xyes) - -dnl Graphical splashscreen support -AC_ARG_ENABLE(graphics, - [ --disable-graphics disable graphics terminal support]) -AM_CONDITIONAL(GRAPHICS_SUPPORT, test "x$enable_graphics" != xno) - -dnl Hercules terminal -AC_ARG_ENABLE(hercules, - [ --disable-hercules disable hercules terminal support]) -AM_CONDITIONAL(HERCULES_SUPPORT, test "x$enable_hercules" != xno) - -dnl Serial terminal -AC_ARG_ENABLE(serial, - [ --disable-serial disable serial terminal support]) -AM_CONDITIONAL(SERIAL_SUPPORT, test "x$enable_serial" != xno) - -dnl Simulation of the slowness of a serial device. -AC_ARG_ENABLE(serial-speed-simulation, - [ --enable-serial-speed-simulation - simulate the slowness of a serial device]) -AM_CONDITIONAL(SERIAL_SPEED_SIMULATION, - test "x$enable_serial_speed_simulation" = xyes) - -# Sanity check. -if test "x$enable_diskless" = xyes; then - if test "x$NET_CFLAGS" = x; then - AC_MSG_ERROR([You must enable at least one network driver]) - fi -fi - -dnl Embed a menu string in GRUB itself. -AC_ARG_ENABLE(preset-menu, - [ --enable-preset-menu=FILE - preset a menu file FILE in Stage 2]) -if test "x$enable_preset_menu" = x; then - : -else - if test -r $enable_preset_menu; then - grub_DEFINE_FILE(PRESET_MENU_STRING, [$enable_preset_menu], - [Define if there is user specified preset menu string]) - else - AC_MSG_ERROR([Cannot read the preset menu file $enable_preset_menu]) - fi -fi - -dnl Build the example Multiboot kernel. -AC_ARG_ENABLE(example-kernel, - [ --enable-example-kernel - build the example Multiboot kernel]) -AM_CONDITIONAL(BUILD_EXAMPLE_KERNEL, test "x$enable_example_kernel" = xyes) - -dnl Automatic Linux mem= option. -AC_ARG_ENABLE(auto-linux-mem-opt, - [ --disable-auto-linux-mem-opt - don't pass Linux mem= option automatically]) -if test "x$enable_auto_linux_mem_opt" = xno; then - : -else - AC_DEFINE(AUTO_LINUX_MEM_OPT, 1, [Define if you don't want to pass the mem= option to Linux]) -fi - -dnl Now substitute the variables. -AC_SUBST(FSYS_CFLAGS) -AC_SUBST(NET_CFLAGS) -AC_SUBST(NET_EXTRAFLAGS) -AC_SUBST(NETBOOT_DRIVERS) - -dnl Because recent automake complains about CCASFLAGS, set it here. -CCASFLAGS='$(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)' -AC_SUBST(CCASFLAGS) - - -dnl Output. -AC_CONFIG_FILES([Makefile stage1/Makefile stage2/Makefile \ - docs/Makefile lib/Makefile util/Makefile \ - grub/Makefile netboot/Makefile util/grub-image \ - util/grub-install util/grub-md5-crypt \ - util/grub-terminfo util/grub-set-default]) -AC_OUTPUT diff --git a/usr/src/grub/grub-0.95/depcomp b/usr/src/grub/grub-0.95/depcomp deleted file mode 100755 index 9e5522d045..0000000000 --- a/usr/src/grub/grub-0.95/depcomp +++ /dev/null @@ -1,520 +0,0 @@ -#! /bin/sh -# depcomp - compile a program generating dependencies as side-effects - -scriptversion=2003-11-08.23 - -# Copyright (C) 1999, 2000, 2003 Free Software Foundation, 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, 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. - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# Originally written by Alexandre Oliva . - -case $1 in - '') - echo "$0: No command. Try \`$0 --help' for more information." 1>&2 - exit 1; - ;; - -h | --h*) - cat <<\EOF -Usage: depcomp [--help] [--version] PROGRAM [ARGS] - -Run PROGRAMS ARGS to compile a file, generating dependencies -as side-effects. - -Environment variables: - depmode Dependency tracking mode. - source Source file read by `PROGRAMS ARGS'. - object Object file output by `PROGRAMS ARGS'. - depfile Dependency file to output. - tmpdepfile Temporary file to use when outputing dependencies. - libtool Whether libtool is used (yes/no). - -Report bugs to . -EOF - exit 0 - ;; - -v | --v*) - echo "depcomp $scriptversion" - exit 0 - ;; -esac - -if test -z "$depmode" || test -z "$source" || test -z "$object"; then - echo "depcomp: Variables source, object and depmode must be set" 1>&2 - exit 1 -fi -# `libtool' can also be set to `yes' or `no'. - -if test -z "$depfile"; then - base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'` - dir=`echo "$object" | sed 's,/.*$,/,'` - if test "$dir" = "$object"; then - dir= - fi - # FIXME: should be _deps on DOS. - depfile="$dir.deps/$base" -fi - -tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} - -rm -f "$tmpdepfile" - -# Some modes work just like other modes, but use different flags. We -# parameterize here, but still list the modes in the big case below, -# to make depend.m4 easier to write. Note that we *cannot* use a case -# here, because this file can only contain one case statement. -if test "$depmode" = hp; then - # HP compiler uses -M and no extra arg. - gccflag=-M - depmode=gcc -fi - -if test "$depmode" = dashXmstdout; then - # This is just like dashmstdout with a different argument. - dashmflag=-xM - depmode=dashmstdout -fi - -case "$depmode" in -gcc3) -## gcc 3 implements dependency tracking that does exactly what -## we want. Yay! Note: for some reason libtool 1.4 doesn't like -## it if -MD -MP comes after the -MF stuff. Hmm. - "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - mv "$tmpdepfile" "$depfile" - ;; - -gcc) -## There are various ways to get dependency output from gcc. Here's -## why we pick this rather obscure method: -## - Don't want to use -MD because we'd like the dependencies to end -## up in a subdir. Having to rename by hand is ugly. -## (We might end up doing this anyway to support other compilers.) -## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like -## -MM, not -M (despite what the docs say). -## - Using -M directly means running the compiler twice (even worse -## than renaming). - if test -z "$gccflag"; then - gccflag=-MD, - fi - "$@" -Wp,"$gccflag$tmpdepfile" - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - echo "$object : \\" > "$depfile" - alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz -## The second -e expression handles DOS-style file names with drive letters. - sed -e 's/^[^:]*: / /' \ - -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" -## This next piece of magic avoids the `deleted header file' problem. -## The problem is that when a header file which appears in a .P file -## is deleted, the dependency causes make to die (because there is -## typically no way to rebuild the header). We avoid this by adding -## dummy dependencies for each header file. Too bad gcc doesn't do -## this for us directly. - tr ' ' ' -' < "$tmpdepfile" | -## Some versions of gcc put a space before the `:'. On the theory -## that the space means something, we add a space to the output as -## well. -## Some versions of the HPUX 10.20 sed can't process this invocation -## correctly. Breaking it into two sed invocations is a workaround. - sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -hp) - # This case exists only to let depend.m4 do its work. It works by - # looking at the text of this script. This case will never be run, - # since it is checked for above. - exit 1 - ;; - -sgi) - if test "$libtool" = yes; then - "$@" "-Wp,-MDupdate,$tmpdepfile" - else - "$@" -MDupdate "$tmpdepfile" - fi - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - - if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files - echo "$object : \\" > "$depfile" - - # Clip off the initial element (the dependent). Don't try to be - # clever and replace this with sed code, as IRIX sed won't handle - # lines with more than a fixed number of characters (4096 in - # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; - # the IRIX cc adds comments like `#:fec' to the end of the - # dependency line. - tr ' ' ' -' < "$tmpdepfile" \ - | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ - tr ' -' ' ' >> $depfile - echo >> $depfile - - # The second pass generates a dummy entry for each header file. - tr ' ' ' -' < "$tmpdepfile" \ - | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ - >> $depfile - else - # The sourcefile does not contain any dependencies, so just - # store a dummy comment line, to avoid errors with the Makefile - # "include basename.Plo" scheme. - echo "#dummy" > "$depfile" - fi - rm -f "$tmpdepfile" - ;; - -aix) - # The C for AIX Compiler uses -M and outputs the dependencies - # in a .u file. In older versions, this file always lives in the - # current directory. Also, the AIX compiler puts `$object:' at the - # start of each line; $object doesn't have directory information. - # Version 6 uses the directory in both cases. - stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'` - tmpdepfile="$stripped.u" - if test "$libtool" = yes; then - "$@" -Wc,-M - else - "$@" -M - fi - stat=$? - - if test -f "$tmpdepfile"; then : - else - stripped=`echo "$stripped" | sed 's,^.*/,,'` - tmpdepfile="$stripped.u" - fi - - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - - if test -f "$tmpdepfile"; then - outname="$stripped.o" - # Each line is of the form `foo.o: dependent.h'. - # Do two passes, one to just change these to - # `$object: dependent.h' and one to simply `dependent.h:'. - sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" - sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" - else - # The sourcefile does not contain any dependencies, so just - # store a dummy comment line, to avoid errors with the Makefile - # "include basename.Plo" scheme. - echo "#dummy" > "$depfile" - fi - rm -f "$tmpdepfile" - ;; - -icc) - # Intel's C compiler understands `-MD -MF file'. However on - # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c - # ICC 7.0 will fill foo.d with something like - # foo.o: sub/foo.c - # foo.o: sub/foo.h - # which is wrong. We want: - # sub/foo.o: sub/foo.c - # sub/foo.o: sub/foo.h - # sub/foo.c: - # sub/foo.h: - # ICC 7.1 will output - # foo.o: sub/foo.c sub/foo.h - # and will wrap long lines using \ : - # foo.o: sub/foo.c ... \ - # sub/foo.h ... \ - # ... - - "$@" -MD -MF "$tmpdepfile" - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - # Each line is of the form `foo.o: dependent.h', - # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. - # Do two passes, one to just change these to - # `$object: dependent.h' and one to simply `dependent.h:'. - sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" - # Some versions of the HPUX 10.20 sed can't process this invocation - # correctly. Breaking it into two sed invocations is a workaround. - sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | - sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -tru64) - # The Tru64 compiler uses -MD to generate dependencies as a side - # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. - # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put - # dependencies in `foo.d' instead, so we check for that too. - # Subdirectories are respected. - dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` - test "x$dir" = "x$object" && dir= - base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` - - if test "$libtool" = yes; then - tmpdepfile1="$dir.libs/$base.lo.d" - tmpdepfile2="$dir.libs/$base.d" - "$@" -Wc,-MD - else - tmpdepfile1="$dir$base.o.d" - tmpdepfile2="$dir$base.d" - "$@" -MD - fi - - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile1" "$tmpdepfile2" - exit $stat - fi - - if test -f "$tmpdepfile1"; then - tmpdepfile="$tmpdepfile1" - else - tmpdepfile="$tmpdepfile2" - fi - if test -f "$tmpdepfile"; then - sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" - # That's a tab and a space in the []. - sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" - else - echo "#dummy" > "$depfile" - fi - rm -f "$tmpdepfile" - ;; - -#nosideeffect) - # This comment above is used by automake to tell side-effect - # dependency tracking mechanisms from slower ones. - -dashmstdout) - # Important note: in order to support this mode, a compiler *must* - # always write the preprocessed file to stdout, regardless of -o. - "$@" || exit $? - - # Remove the call to Libtool. - if test "$libtool" = yes; then - while test $1 != '--mode=compile'; do - shift - done - shift - fi - - # Remove `-o $object'. - IFS=" " - for arg - do - case $arg in - -o) - shift - ;; - $object) - shift - ;; - *) - set fnord "$@" "$arg" - shift # fnord - shift # $arg - ;; - esac - done - - test -z "$dashmflag" && dashmflag=-M - # Require at least two characters before searching for `:' - # in the target name. This is to cope with DOS-style filenames: - # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. - "$@" $dashmflag | - sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" - rm -f "$depfile" - cat < "$tmpdepfile" > "$depfile" - tr ' ' ' -' < "$tmpdepfile" | \ -## Some versions of the HPUX 10.20 sed can't process this invocation -## correctly. Breaking it into two sed invocations is a workaround. - sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -dashXmstdout) - # This case only exists to satisfy depend.m4. It is never actually - # run, as this mode is specially recognized in the preamble. - exit 1 - ;; - -makedepend) - "$@" || exit $? - # Remove any Libtool call - if test "$libtool" = yes; then - while test $1 != '--mode=compile'; do - shift - done - shift - fi - # X makedepend - shift - cleared=no - for arg in "$@"; do - case $cleared in - no) - set ""; shift - cleared=yes ;; - esac - case "$arg" in - -D*|-I*) - set fnord "$@" "$arg"; shift ;; - # Strip any option that makedepend may not understand. Remove - # the object too, otherwise makedepend will parse it as a source file. - -*|$object) - ;; - *) - set fnord "$@" "$arg"; shift ;; - esac - done - obj_suffix="`echo $object | sed 's/^.*\././'`" - touch "$tmpdepfile" - ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" - rm -f "$depfile" - cat < "$tmpdepfile" > "$depfile" - sed '1,2d' "$tmpdepfile" | tr ' ' ' -' | \ -## Some versions of the HPUX 10.20 sed can't process this invocation -## correctly. Breaking it into two sed invocations is a workaround. - sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" "$tmpdepfile".bak - ;; - -cpp) - # Important note: in order to support this mode, a compiler *must* - # always write the preprocessed file to stdout. - "$@" || exit $? - - # Remove the call to Libtool. - if test "$libtool" = yes; then - while test $1 != '--mode=compile'; do - shift - done - shift - fi - - # Remove `-o $object'. - IFS=" " - for arg - do - case $arg in - -o) - shift - ;; - $object) - shift - ;; - *) - set fnord "$@" "$arg" - shift # fnord - shift # $arg - ;; - esac - done - - "$@" -E | - sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | - sed '$ s: \\$::' > "$tmpdepfile" - rm -f "$depfile" - echo "$object : \\" > "$depfile" - cat < "$tmpdepfile" >> "$depfile" - sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -msvisualcpp) - # Important note: in order to support this mode, a compiler *must* - # always write the preprocessed file to stdout, regardless of -o, - # because we must use -o when running libtool. - "$@" || exit $? - IFS=" " - for arg - do - case "$arg" in - "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") - set fnord "$@" - shift - shift - ;; - *) - set fnord "$@" "$arg" - shift - shift - ;; - esac - done - "$@" -E | - sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" - rm -f "$depfile" - echo "$object : \\" > "$depfile" - . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" - echo " " >> "$depfile" - . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -none) - exec "$@" - ;; - -*) - echo "Unknown depmode $depmode" 1>&2 - exit 1 - ;; -esac - -exit 0 - -# Local Variables: -# mode: shell-script -# sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-end: "$" -# End: diff --git a/usr/src/grub/grub-0.95/docs/Makefile.am b/usr/src/grub/grub-0.95/docs/Makefile.am deleted file mode 100644 index db99e2d87c..0000000000 --- a/usr/src/grub/grub-0.95/docs/Makefile.am +++ /dev/null @@ -1,65 +0,0 @@ -info_TEXINFOS = grub.texi multiboot.texi -grub_TEXINFOS = internals.texi -EXAMPLES = boot.S kernel.c multiboot.h -multiboot_TEXINFOS = boot.S.texi kernel.c.texi multiboot.h.texi -man_MANS = grub.8 mbchk.1 grub-install.8 grub-md5-crypt.8 grub-terminfo.8 -HELP2MAN = help2man -SRC2TEXI = src2texi -noinst_SCRIPTS = $(HELP2MAN) $(SRC2TEXI) -EXTRA_PROGRAMS = kernel - -# The example kernel is built if you specify --enable-example-kernel. -if BUILD_EXAMPLE_KERNEL -noinst_PROGRAMS = kernel -kernel_SOURCES = $(EXAMPLES) -kernel_CFLAGS = -fno-builtin -nostdinc -O -g -Wall \ - -imacros $(top_builddir)/config.h -kernel_LDFLAGS = -nostdlib -Wl,-N -Wl,-Ttext -Wl,100000 - -boot.o: multiboot.h -endif - -EXTRA_DIST = menu.lst $(man_MANS) $(noinst_SCRIPTS) \ - $(EXAMPLES) $(multiboot_TEXINFOS) -CLEANFILES = $(noinst_PROGRAMS) - -# Cancel the rule %.texi -> %. This rule may confuse make to determine -# the dependecies. -.texi: - -%.c.texi: %.c $(srcdir)/$(SRC2TEXI) - $(SHELL) $(srcdir)/$(SRC2TEXI) $(srcdir) $< $@ - -%.h.texi: %.h $(srcdir)/$(SRC2TEXI) - $(SHELL) $(srcdir)/$(SRC2TEXI) $(srcdir) $< $@ - -%.S.texi: %.S $(srcdir)/$(SRC2TEXI) - $(SHELL) $(srcdir)/$(SRC2TEXI) $(srcdir) $< $@ - -if MAINTAINER_MODE -$(srcdir)/grub.8: ../grub/grub $(srcdir)/$(HELP2MAN) - $(PERL) $(srcdir)/$(HELP2MAN) --name="the grub shell" \ - --section=8 --output=$@ $< - -$(srcdir)/grub-install.8: ../util/grub-install $(srcdir)/$(HELP2MAN) - chmod 755 $< - $(PERL) $(srcdir)/$(HELP2MAN) --name="install GRUB on your drive" \ - --section=8 --output=$@ $< - -$(srcdir)/mbchk.1: ../util/mbchk $(srcdir)/$(HELP2MAN) - $(PERL) $(srcdir)/$(HELP2MAN) \ - --name="check the format of a Multiboot kernel" \ - --section=1 --output=$@ $< - -$(srcdir)/grub-md5-crypt.8: ../util/grub-md5-crypt $(srcdir)/$(HELP2MAN) - chmod 755 $< - $(PERL) $(srcdir)/$(HELP2MAN) \ - --name="Encrypt a password in MD5 format" \ - --section=8 --output=$@ $< - -$(srcdir)/grub-terminfo.8: ../util/grub-terminfo $(srcdir)/$(HELP2MAN) - chmod 755 $< - $(PERL) $(srcdir)/$(HELP2MAN) \ - --name="Generate a terminfo command from a terminfo name" \ - --section=8 --output=$@ $< -endif diff --git a/usr/src/grub/grub-0.95/docs/Makefile.in b/usr/src/grub/grub-0.95/docs/Makefile.in deleted file mode 100644 index ee70b371b9..0000000000 --- a/usr/src/grub/grub-0.95/docs/Makefile.in +++ /dev/null @@ -1,768 +0,0 @@ -# Makefile.in generated by automake 1.8.5 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - - -SOURCES = $(kernel_SOURCES) - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = .. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -host_triplet = @host@ -EXTRA_PROGRAMS = kernel$(EXEEXT) -@BUILD_EXAMPLE_KERNEL_TRUE@noinst_PROGRAMS = kernel$(EXEEXT) -subdir = docs -DIST_COMMON = $(grub_TEXINFOS) $(multiboot_TEXINFOS) \ - $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ - $(srcdir)/stamp-vti $(srcdir)/version.texi mdate-sh \ - texinfo.tex -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -PROGRAMS = $(noinst_PROGRAMS) -am__kernel_SOURCES_DIST = boot.S kernel.c multiboot.h -am__objects_1 = boot.$(OBJEXT) kernel-kernel.$(OBJEXT) -@BUILD_EXAMPLE_KERNEL_TRUE@am_kernel_OBJECTS = $(am__objects_1) -kernel_OBJECTS = $(am_kernel_OBJECTS) -kernel_LDADD = $(LDADD) -SCRIPTS = $(noinst_SCRIPTS) -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/kernel-kernel.Po -CCASCOMPILE = $(CCAS) $(AM_CCASFLAGS) $(CCASFLAGS) -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(kernel_SOURCES) -DIST_SOURCES = $(am__kernel_SOURCES_DIST) -INFO_DEPS = $(srcdir)/grub.info $(srcdir)/multiboot.info -am__TEXINFO_TEX_DIR = $(srcdir) -DVIS = grub.dvi multiboot.dvi -PDFS = grub.pdf multiboot.pdf -PSS = grub.ps multiboot.ps -HTMLS = grub.html multiboot.html -TEXINFOS = grub.texi multiboot.texi -TEXI2DVI = texi2dvi -TEXI2PDF = $(TEXI2DVI) --pdf --batch -MAKEINFOHTML = $(MAKEINFO) --html -AM_MAKEINFOHTMLFLAGS = $(AM_MAKEINFOFLAGS) -DVIPS = dvips -am__installdirs = "$(DESTDIR)$(infodir)" "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man8dir)" -man1dir = $(mandir)/man1 -man8dir = $(mandir)/man8 -NROFF = nroff -MANS = $(man_MANS) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BUILD_EXAMPLE_KERNEL_FALSE = @BUILD_EXAMPLE_KERNEL_FALSE@ -BUILD_EXAMPLE_KERNEL_TRUE = @BUILD_EXAMPLE_KERNEL_TRUE@ -CC = @CC@ -CCAS = @CCAS@ -CCASFLAGS = @CCASFLAGS@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DISKLESS_SUPPORT_FALSE = @DISKLESS_SUPPORT_FALSE@ -DISKLESS_SUPPORT_TRUE = @DISKLESS_SUPPORT_TRUE@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FSYS_CFLAGS = @FSYS_CFLAGS@ -GRUB_CFLAGS = @GRUB_CFLAGS@ -GRUB_LIBS = @GRUB_LIBS@ -HERCULES_SUPPORT_FALSE = @HERCULES_SUPPORT_FALSE@ -HERCULES_SUPPORT_TRUE = @HERCULES_SUPPORT_TRUE@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LTLIBOBJS = @LTLIBOBJS@ -MAINT = @MAINT@ -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ -MAKEINFO = @MAKEINFO@ -NETBOOT_DRIVERS = @NETBOOT_DRIVERS@ -NETBOOT_SUPPORT_FALSE = @NETBOOT_SUPPORT_FALSE@ -NETBOOT_SUPPORT_TRUE = @NETBOOT_SUPPORT_TRUE@ -NET_CFLAGS = @NET_CFLAGS@ -NET_EXTRAFLAGS = @NET_EXTRAFLAGS@ -OBJCOPY = @OBJCOPY@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -RANLIB = @RANLIB@ -SERIAL_SPEED_SIMULATION_FALSE = @SERIAL_SPEED_SIMULATION_FALSE@ -SERIAL_SPEED_SIMULATION_TRUE = @SERIAL_SPEED_SIMULATION_TRUE@ -SERIAL_SUPPORT_FALSE = @SERIAL_SUPPORT_FALSE@ -SERIAL_SUPPORT_TRUE = @SERIAL_SUPPORT_TRUE@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STAGE1_CFLAGS = @STAGE1_CFLAGS@ -STAGE2_CFLAGS = @STAGE2_CFLAGS@ -STRIP = @STRIP@ -VERSION = @VERSION@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_OBJCOPY = @ac_ct_OBJCOPY@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -info_TEXINFOS = grub.texi multiboot.texi -grub_TEXINFOS = internals.texi -EXAMPLES = boot.S kernel.c multiboot.h -multiboot_TEXINFOS = boot.S.texi kernel.c.texi multiboot.h.texi -man_MANS = grub.8 mbchk.1 grub-install.8 grub-md5-crypt.8 grub-terminfo.8 -HELP2MAN = help2man -SRC2TEXI = src2texi -noinst_SCRIPTS = $(HELP2MAN) $(SRC2TEXI) -@BUILD_EXAMPLE_KERNEL_TRUE@kernel_SOURCES = $(EXAMPLES) -@BUILD_EXAMPLE_KERNEL_TRUE@kernel_CFLAGS = -fno-builtin -nostdinc -O -g -Wall \ -@BUILD_EXAMPLE_KERNEL_TRUE@ -imacros $(top_builddir)/config.h - -@BUILD_EXAMPLE_KERNEL_TRUE@kernel_LDFLAGS = -nostdlib -Wl,-N -Wl,-Ttext -Wl,100000 -EXTRA_DIST = menu.lst $(man_MANS) $(noinst_SCRIPTS) \ - $(EXAMPLES) $(multiboot_TEXINFOS) - -CLEANFILES = $(noinst_PROGRAMS) -all: all-am - -.SUFFIXES: -.SUFFIXES: .S .c .dvi .html .info .o .obj .pdf .ps .texi -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu docs/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu docs/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -clean-noinstPROGRAMS: - -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) -kernel$(EXEEXT): $(kernel_OBJECTS) $(kernel_DEPENDENCIES) - @rm -f kernel$(EXEEXT) - $(LINK) $(kernel_LDFLAGS) $(kernel_OBJECTS) $(kernel_LDADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kernel-kernel.Po@am__quote@ - -.S.o: - $(CCASCOMPILE) -c $< - -.S.obj: - $(CCASCOMPILE) -c `$(CYGPATH_W) '$<'` - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -kernel-kernel.o: kernel.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(kernel_CFLAGS) $(CFLAGS) -MT kernel-kernel.o -MD -MP -MF "$(DEPDIR)/kernel-kernel.Tpo" -c -o kernel-kernel.o `test -f 'kernel.c' || echo '$(srcdir)/'`kernel.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/kernel-kernel.Tpo" "$(DEPDIR)/kernel-kernel.Po"; else rm -f "$(DEPDIR)/kernel-kernel.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='kernel.c' object='kernel-kernel.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/kernel-kernel.Po' tmpdepfile='$(DEPDIR)/kernel-kernel.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(kernel_CFLAGS) $(CFLAGS) -c -o kernel-kernel.o `test -f 'kernel.c' || echo '$(srcdir)/'`kernel.c - -kernel-kernel.obj: kernel.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(kernel_CFLAGS) $(CFLAGS) -MT kernel-kernel.obj -MD -MP -MF "$(DEPDIR)/kernel-kernel.Tpo" -c -o kernel-kernel.obj `if test -f 'kernel.c'; then $(CYGPATH_W) 'kernel.c'; else $(CYGPATH_W) '$(srcdir)/kernel.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/kernel-kernel.Tpo" "$(DEPDIR)/kernel-kernel.Po"; else rm -f "$(DEPDIR)/kernel-kernel.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='kernel.c' object='kernel-kernel.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/kernel-kernel.Po' tmpdepfile='$(DEPDIR)/kernel-kernel.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(kernel_CFLAGS) $(CFLAGS) -c -o kernel-kernel.obj `if test -f 'kernel.c'; then $(CYGPATH_W) 'kernel.c'; else $(CYGPATH_W) '$(srcdir)/kernel.c'; fi` - -.texi.info: - restore=: && \ - backupdir="$(am__leading_dot)am$$$$" && \ - am__cwd=`pwd` && cd $(srcdir) && \ - rm -rf $$backupdir && mkdir $$backupdir && \ - for f in $@ $@-[0-9] $@-[0-9][0-9] $(@:.info=).i[0-9] $(@:.info=).i[0-9][0-9]; do \ - if test -f $$f; then \ - mv $$f $$backupdir; \ - restore=mv; \ - fi; \ - done; \ - cd "$$am__cwd"; \ - if $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \ - -o $@ $<; \ - then \ - rc=0; \ - cd $(srcdir); \ - else \ - rc=$$?; \ - cd $(srcdir) && \ - $$restore $$backupdir/* `echo "./$@" | sed 's|[^/]*$$||'`; \ - fi; \ - rm -rf $$backupdir; \ - exit $$rc - -.texi.dvi: - TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ - MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)' \ - $(TEXI2DVI) $< - -.texi.pdf: - TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ - MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)' \ - $(TEXI2PDF) $< - -.texi.html: - $(MAKEINFOHTML) $(AM_MAKEINFOHTMLFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \ - -o $@ $< - if test ! -d $@ && test -d $(@:.html=); then \ - mv $(@:.html=) $@; else :; fi -$(srcdir)/grub.info: grub.texi $(srcdir)/version.texi $(grub_TEXINFOS) -grub.dvi: grub.texi $(srcdir)/version.texi $(grub_TEXINFOS) -grub.pdf: grub.texi $(srcdir)/version.texi $(grub_TEXINFOS) -grub.html: grub.texi $(srcdir)/version.texi $(grub_TEXINFOS) -$(srcdir)/version.texi: @MAINTAINER_MODE_TRUE@ $(srcdir)/stamp-vti -$(srcdir)/stamp-vti: grub.texi $(top_srcdir)/configure - @(dir=.; test -f ./grub.texi || dir=$(srcdir); \ - set `$(SHELL) $(srcdir)/mdate-sh $$dir/grub.texi`; \ - echo "@set UPDATED $$1 $$2 $$3"; \ - echo "@set UPDATED-MONTH $$2 $$3"; \ - echo "@set EDITION $(VERSION)"; \ - echo "@set VERSION $(VERSION)") > vti.tmp - @cmp -s vti.tmp $(srcdir)/version.texi \ - || (echo "Updating $(srcdir)/version.texi"; \ - cp vti.tmp $(srcdir)/version.texi) - -@rm -f vti.tmp - @cp $(srcdir)/version.texi $@ - -mostlyclean-vti: - -rm -f vti.tmp - -maintainer-clean-vti: -@MAINTAINER_MODE_TRUE@ -rm -f $(srcdir)/stamp-vti $(srcdir)/version.texi -$(srcdir)/multiboot.info: multiboot.texi $(multiboot_TEXINFOS) -multiboot.dvi: multiboot.texi $(multiboot_TEXINFOS) -multiboot.pdf: multiboot.texi $(multiboot_TEXINFOS) -multiboot.html: multiboot.texi $(multiboot_TEXINFOS) -.dvi.ps: - $(DVIPS) -o $@ $< - -uninstall-info-am: - $(PRE_UNINSTALL) - @if (install-info --version && \ - install-info --version 2>&1 | sed 1q | grep -i -v debian) >/dev/null 2>&1; then \ - list='$(INFO_DEPS)'; \ - for file in $$list; do \ - relfile=`echo "$$file" | sed 's|^.*/||'`; \ - echo " install-info --info-dir='$(DESTDIR)$(infodir)' --remove '$(DESTDIR)$(infodir)/$$relfile'"; \ - install-info --info-dir="$(DESTDIR)$(infodir)" --remove "$(DESTDIR)$(infodir)/$$relfile"; \ - done; \ - else :; fi - @$(NORMAL_UNINSTALL) - @list='$(INFO_DEPS)'; \ - for file in $$list; do \ - relfile=`echo "$$file" | sed 's|^.*/||'`; \ - relfile_i=`echo "$$relfile" | sed 's|\.info$$||;s|$$|.i|'`; \ - (if cd "$(DESTDIR)$(infodir)"; then \ - echo " rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9])"; \ - rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]; \ - else :; fi); \ - done - -dist-info: $(INFO_DEPS) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - list='$(INFO_DEPS)'; \ - for base in $$list; do \ - case $$base in \ - $(srcdir)/*) base=`echo "$$base" | sed "s|^$$srcdirstrip/||"`;; \ - esac; \ - if test -f $$base; then d=.; else d=$(srcdir); fi; \ - for file in $$d/$$base*; do \ - relfile=`expr "$$file" : "$$d/\(.*\)"`; \ - test -f $(distdir)/$$relfile || \ - cp -p $$file $(distdir)/$$relfile; \ - done; \ - done - -mostlyclean-aminfo: - -rm -rf grub.aux grub.cp grub.cps grub.fn grub.ky grub.log grub.pg grub.tmp \ - grub.toc grub.tp grub.vr grub.dvi grub.pdf grub.ps grub.html \ - multiboot.aux multiboot.cp multiboot.cps multiboot.fn \ - multiboot.ky multiboot.log multiboot.pg multiboot.tmp \ - multiboot.toc multiboot.tp multiboot.vr multiboot.dvi \ - multiboot.pdf multiboot.ps multiboot.html - -maintainer-clean-aminfo: - @list='$(INFO_DEPS)'; for i in $$list; do \ - i_i=`echo "$$i" | sed 's|\.info$$||;s|$$|.i|'`; \ - echo " rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]"; \ - rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]; \ - done -install-man1: $(man1_MANS) $(man_MANS) - @$(NORMAL_INSTALL) - test -z "$(man1dir)" || $(mkdir_p) "$(DESTDIR)$(man1dir)" - @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \ - l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ - for i in $$l2; do \ - case "$$i" in \ - *.1*) list="$$list $$i" ;; \ - esac; \ - done; \ - for i in $$list; do \ - if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ - else file=$$i; fi; \ - ext=`echo $$i | sed -e 's/^.*\\.//'`; \ - case "$$ext" in \ - 1*) ;; \ - *) ext='1' ;; \ - esac; \ - inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ - inst=`echo $$inst | sed -e 's/^.*\///'`; \ - inst=`echo $$inst | sed '$(transform)'`.$$ext; \ - echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ - $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst"; \ - done -uninstall-man1: - @$(NORMAL_UNINSTALL) - @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \ - l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ - for i in $$l2; do \ - case "$$i" in \ - *.1*) list="$$list $$i" ;; \ - esac; \ - done; \ - for i in $$list; do \ - ext=`echo $$i | sed -e 's/^.*\\.//'`; \ - case "$$ext" in \ - 1*) ;; \ - *) ext='1' ;; \ - esac; \ - inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ - inst=`echo $$inst | sed -e 's/^.*\///'`; \ - inst=`echo $$inst | sed '$(transform)'`.$$ext; \ - echo " rm -f '$(DESTDIR)$(man1dir)/$$inst'"; \ - rm -f "$(DESTDIR)$(man1dir)/$$inst"; \ - done -install-man8: $(man8_MANS) $(man_MANS) - @$(NORMAL_INSTALL) - test -z "$(man8dir)" || $(mkdir_p) "$(DESTDIR)$(man8dir)" - @list='$(man8_MANS) $(dist_man8_MANS) $(nodist_man8_MANS)'; \ - l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ - for i in $$l2; do \ - case "$$i" in \ - *.8*) list="$$list $$i" ;; \ - esac; \ - done; \ - for i in $$list; do \ - if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ - else file=$$i; fi; \ - ext=`echo $$i | sed -e 's/^.*\\.//'`; \ - case "$$ext" in \ - 8*) ;; \ - *) ext='8' ;; \ - esac; \ - inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ - inst=`echo $$inst | sed -e 's/^.*\///'`; \ - inst=`echo $$inst | sed '$(transform)'`.$$ext; \ - echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man8dir)/$$inst'"; \ - $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man8dir)/$$inst"; \ - done -uninstall-man8: - @$(NORMAL_UNINSTALL) - @list='$(man8_MANS) $(dist_man8_MANS) $(nodist_man8_MANS)'; \ - l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ - for i in $$l2; do \ - case "$$i" in \ - *.8*) list="$$list $$i" ;; \ - esac; \ - done; \ - for i in $$list; do \ - ext=`echo $$i | sed -e 's/^.*\\.//'`; \ - case "$$ext" in \ - 8*) ;; \ - *) ext='8' ;; \ - esac; \ - inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ - inst=`echo $$inst | sed -e 's/^.*\///'`; \ - inst=`echo $$inst | sed '$(transform)'`.$$ext; \ - echo " rm -f '$(DESTDIR)$(man8dir)/$$inst'"; \ - rm -f "$(DESTDIR)$(man8dir)/$$inst"; \ - done - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done - $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$(top_distdir)" distdir="$(distdir)" \ - dist-info -check-am: all-am -check: check-am -all-am: Makefile $(INFO_DEPS) $(PROGRAMS) $(SCRIPTS) $(MANS) -installdirs: - for dir in "$(DESTDIR)$(infodir)" "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man8dir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) - -distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-noinstPROGRAMS mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-am - -dvi-am: $(DVIS) - -html: html-am - -html-am: $(HTMLS) - -info: info-am - -info-am: $(INFO_DEPS) - -install-data-am: install-info-am install-man - -install-exec-am: - -install-info: install-info-am - -install-info-am: $(INFO_DEPS) - @$(NORMAL_INSTALL) - test -z "$(infodir)" || $(mkdir_p) "$(DESTDIR)$(infodir)" - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - list='$(INFO_DEPS)'; \ - for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - esac; \ - if test -f $$file; then d=.; else d=$(srcdir); fi; \ - file_i=`echo "$$file" | sed 's|\.info$$||;s|$$|.i|'`; \ - for ifile in $$d/$$file $$d/$$file-[0-9] $$d/$$file-[0-9][0-9] \ - $$d/$$file_i[0-9] $$d/$$file_i[0-9][0-9] ; do \ - if test -f $$ifile; then \ - relfile=`echo "$$ifile" | sed 's|^.*/||'`; \ - echo " $(INSTALL_DATA) '$$ifile' '$(DESTDIR)$(infodir)/$$relfile'"; \ - $(INSTALL_DATA) "$$ifile" "$(DESTDIR)$(infodir)/$$relfile"; \ - else : ; fi; \ - done; \ - done - @$(POST_INSTALL) - @if (install-info --version && \ - install-info --version 2>&1 | sed 1q | grep -i -v debian) >/dev/null 2>&1; then \ - list='$(INFO_DEPS)'; \ - for file in $$list; do \ - relfile=`echo "$$file" | sed 's|^.*/||'`; \ - echo " install-info --info-dir='$(DESTDIR)$(infodir)' '$(DESTDIR)$(infodir)/$$relfile'";\ - install-info --info-dir="$(DESTDIR)$(infodir)" "$(DESTDIR)$(infodir)/$$relfile" || :;\ - done; \ - else : ; fi -install-man: install-man1 install-man8 - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-aminfo \ - maintainer-clean-generic maintainer-clean-vti - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-aminfo mostlyclean-compile \ - mostlyclean-generic mostlyclean-vti - -pdf: pdf-am - -pdf-am: $(PDFS) - -ps: ps-am - -ps-am: $(PSS) - -uninstall-am: uninstall-info-am uninstall-man - -uninstall-man: uninstall-man1 uninstall-man8 - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-noinstPROGRAMS ctags dist-info distclean \ - distclean-compile distclean-generic distclean-tags distdir dvi \ - dvi-am html html-am info info-am install install-am \ - install-data install-data-am install-exec install-exec-am \ - install-info install-info-am install-man install-man1 \ - install-man8 install-strip installcheck installcheck-am \ - installdirs maintainer-clean maintainer-clean-aminfo \ - maintainer-clean-generic maintainer-clean-vti mostlyclean \ - mostlyclean-aminfo mostlyclean-compile mostlyclean-generic \ - mostlyclean-vti pdf pdf-am ps ps-am tags uninstall \ - uninstall-am uninstall-info-am uninstall-man uninstall-man1 \ - uninstall-man8 - - -@BUILD_EXAMPLE_KERNEL_TRUE@boot.o: multiboot.h - -# Cancel the rule %.texi -> %. This rule may confuse make to determine -# the dependecies. -.texi: - -%.c.texi: %.c $(srcdir)/$(SRC2TEXI) - $(SHELL) $(srcdir)/$(SRC2TEXI) $(srcdir) $< $@ - -%.h.texi: %.h $(srcdir)/$(SRC2TEXI) - $(SHELL) $(srcdir)/$(SRC2TEXI) $(srcdir) $< $@ - -%.S.texi: %.S $(srcdir)/$(SRC2TEXI) - $(SHELL) $(srcdir)/$(SRC2TEXI) $(srcdir) $< $@ - -@MAINTAINER_MODE_TRUE@$(srcdir)/grub.8: ../grub/grub $(srcdir)/$(HELP2MAN) -@MAINTAINER_MODE_TRUE@ $(PERL) $(srcdir)/$(HELP2MAN) --name="the grub shell" \ -@MAINTAINER_MODE_TRUE@ --section=8 --output=$@ $< - -@MAINTAINER_MODE_TRUE@$(srcdir)/grub-install.8: ../util/grub-install $(srcdir)/$(HELP2MAN) -@MAINTAINER_MODE_TRUE@ chmod 755 $< -@MAINTAINER_MODE_TRUE@ $(PERL) $(srcdir)/$(HELP2MAN) --name="install GRUB on your drive" \ -@MAINTAINER_MODE_TRUE@ --section=8 --output=$@ $< - -@MAINTAINER_MODE_TRUE@$(srcdir)/mbchk.1: ../util/mbchk $(srcdir)/$(HELP2MAN) -@MAINTAINER_MODE_TRUE@ $(PERL) $(srcdir)/$(HELP2MAN) \ -@MAINTAINER_MODE_TRUE@ --name="check the format of a Multiboot kernel" \ -@MAINTAINER_MODE_TRUE@ --section=1 --output=$@ $< - -@MAINTAINER_MODE_TRUE@$(srcdir)/grub-md5-crypt.8: ../util/grub-md5-crypt $(srcdir)/$(HELP2MAN) -@MAINTAINER_MODE_TRUE@ chmod 755 $< -@MAINTAINER_MODE_TRUE@ $(PERL) $(srcdir)/$(HELP2MAN) \ -@MAINTAINER_MODE_TRUE@ --name="Encrypt a password in MD5 format" \ -@MAINTAINER_MODE_TRUE@ --section=8 --output=$@ $< - -@MAINTAINER_MODE_TRUE@$(srcdir)/grub-terminfo.8: ../util/grub-terminfo $(srcdir)/$(HELP2MAN) -@MAINTAINER_MODE_TRUE@ chmod 755 $< -@MAINTAINER_MODE_TRUE@ $(PERL) $(srcdir)/$(HELP2MAN) \ -@MAINTAINER_MODE_TRUE@ --name="Generate a terminfo command from a terminfo name" \ -@MAINTAINER_MODE_TRUE@ --section=8 --output=$@ $< -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/usr/src/grub/grub-0.95/docs/Makefile.solaris b/usr/src/grub/grub-0.95/docs/Makefile.solaris deleted file mode 100644 index 5914f863af..0000000000 --- a/usr/src/grub/grub-0.95/docs/Makefile.solaris +++ /dev/null @@ -1,68 +0,0 @@ -# -# Copyright 2005 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# ident "%Z%%M% %I% %E% SMI" -# -include ../../Makefile.grub -include ../Makefile.solaris.defs - - -# Install these only if the OPTION_DOCS option is on (blank). -$(OPTION_DOCS)MAN1_FILES = mbchk.1 - -$(OPTION_DOCS)MAN8_FILES = grub-install.8 \ - grub-md5-crypt.8 \ - grub-terminfo.8 \ - grub.8 - -$(OPTION_DOCS)INFO_FILES = grub.info \ - grub.info-1 \ - grub.info-2 \ - grub.info-3 \ - grub.info-4 \ - multiboot.info - - -INSTALL_MAN1_DIR = $(ROOT_PLAT_GRUB)/man/man1 -INSTALL_MAN8_DIR = $(ROOT_PLAT_GRUB)/man/man8 -INSTALL_INFO_DIR = $(ROOT_PLAT_GRUB)/info - -INSTALL_TARGETS = $(MAN1_FILES:%=$(INSTALL_MAN1_DIR)/%) \ - $(MAN8_FILES:%=$(INSTALL_MAN8_DIR)/%) \ - $(INFO_FILES:%=$(INSTALL_INFO_DIR)/%) - -# -# Source files to be installed in $(SRC_DIR). -# -SRC_DIR = $(ROOT_SRC)/docs -SRC_FILES = Makefile.am Makefile.in boot.S boot.S.texi \ - grub-install.8 grub-md5-crypt.8 grub-terminfo.8 grub.8 \ - grub.info grub.info-1 grub.info-2 grub.info-3 grub.info-4 \ - grub.texi help2man internals.texi kernel.c kernel.c.texi \ - mbchk.1 mdate-sh menu.lst multiboot.h multiboot.h.texi \ - multiboot.info multiboot.texi src2texi stamp-vti \ - texinfo.tex version.texi - -INSTALL_TARGETS += $(SRC_FILES:%=$(SRC_DIR)/%) - - -all clean clobber: - - -install: all $(INSTALL_TARGETS) - -$(INSTALL_MAN1_DIR)/%: $(INSTALL_MAN1_DIR) % - $(INS.file) - -$(INSTALL_MAN8_DIR)/%: $(INSTALL_MAN8_DIR) % - $(INS.file) - -$(INSTALL_INFO_DIR)/%: $(INSTALL_INFO_DIR) % - $(INS.file) - -$(SRC_DIR)/%: $(SRC_DIR) % - $(INS.file) - -$(INSTALL_MAN1_DIR) $(INSTALL_MAN8_DIR) $(INSTALL_INFO_DIR) $(SRC_DIR): - $(INS.dir) diff --git a/usr/src/grub/grub-0.95/docs/boot.S b/usr/src/grub/grub-0.95/docs/boot.S deleted file mode 100644 index b0e167f83c..0000000000 --- a/usr/src/grub/grub-0.95/docs/boot.S +++ /dev/null @@ -1,80 +0,0 @@ -/* boot.S - bootstrap the kernel */ -/* Copyright (C) 1999, 2001 Free Software Foundation, 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 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. */ - -#define ASM 1 -#include - - .text - - .globl start, _start -start: -_start: - jmp multiboot_entry - - /* Align 32 bits boundary. */ - .align 4 - - /* Multiboot header. */ -multiboot_header: - /* magic */ - .long MULTIBOOT_HEADER_MAGIC - /* flags */ - .long MULTIBOOT_HEADER_FLAGS - /* checksum */ - .long -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS) -#ifndef __ELF__ - /* header_addr */ - .long multiboot_header - /* load_addr */ - .long _start - /* load_end_addr */ - .long _edata - /* bss_end_addr */ - .long _end - /* entry_addr */ - .long multiboot_entry -#endif /* ! __ELF__ */ - -multiboot_entry: - /* Initialize the stack pointer. */ - movl $(stack + STACK_SIZE), %esp - - /* Reset EFLAGS. */ - pushl $0 - popf - - /* Push the pointer to the Multiboot information structure. */ - pushl %ebx - /* Push the magic value. */ - pushl %eax - - /* Now enter the C main function... */ - call EXT_C(cmain) - - /* Halt. */ - pushl $halt_message - call EXT_C(printf) - -loop: hlt - jmp loop - -halt_message: - .asciz "Halted." - - /* Our stack area. */ - .comm stack, STACK_SIZE - \ No newline at end of file diff --git a/usr/src/grub/grub-0.95/docs/boot.S.texi b/usr/src/grub/grub-0.95/docs/boot.S.texi deleted file mode 100644 index afca9f71cf..0000000000 --- a/usr/src/grub/grub-0.95/docs/boot.S.texi +++ /dev/null @@ -1,80 +0,0 @@ -/* @r{boot.S - bootstrap the kernel} */ -/* @r{Copyright (C) 1999, 2001 Free Software Foundation, 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 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.} */ - -#define ASM 1 -#include - - .text - - .globl start, _start -start: -_start: - jmp multiboot_entry - - /* @r{Align 32 bits boundary.} */ - .align 4 - - /* @r{Multiboot header.} */ -multiboot_header: - /* @r{magic} */ - .long MULTIBOOT_HEADER_MAGIC - /* @r{flags} */ - .long MULTIBOOT_HEADER_FLAGS - /* @r{checksum} */ - .long -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS) -#ifndef __ELF__ - /* @r{header_addr} */ - .long multiboot_header - /* @r{load_addr} */ - .long _start - /* @r{load_end_addr} */ - .long _edata - /* @r{bss_end_addr} */ - .long _end - /* @r{entry_addr} */ - .long multiboot_entry -#endif /* @r{! __ELF__} */ - -multiboot_entry: - /* @r{Initialize the stack pointer.} */ - movl $(stack + STACK_SIZE), %esp - - /* @r{Reset EFLAGS.} */ - pushl $0 - popf - - /* @r{Push the pointer to the Multiboot information structure.} */ - pushl %ebx - /* @r{Push the magic value.} */ - pushl %eax - - /* @r{Now enter the C main function...} */ - call EXT_C(cmain) - - /* @r{Halt.} */ - pushl $halt_message - call EXT_C(printf) - -loop: hlt - jmp loop - -halt_message: - .asciz "Halted." - - /* @r{Our stack area.} */ - .comm stack, STACK_SIZE - \ No newline at end of file diff --git a/usr/src/grub/grub-0.95/docs/grub-install.8 b/usr/src/grub/grub-0.95/docs/grub-install.8 deleted file mode 100644 index f23e516151..0000000000 --- a/usr/src/grub/grub-0.95/docs/grub-install.8 +++ /dev/null @@ -1,52 +0,0 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.23. -.TH GRUB-INSTALL "8" "August 2004" "grub-install (GNU GRUB 0.95)" FSF -.SH NAME -grub-install \- install GRUB on your drive -.SH SYNOPSIS -.B grub-install -[\fIOPTION\fR] \fIinstall_device\fR -.SH DESCRIPTION -Install GRUB on your drive. -.TP -\fB\-h\fR, \fB\-\-help\fR -print this message and exit -.TP -\fB\-v\fR, \fB\-\-version\fR -print the version information and exit -.TP -\fB\-\-root\-directory\fR=\fIDIR\fR -install GRUB images under the directory DIR -instead of the root directory -.TP -\fB\-\-grub\-shell\fR=\fIFILE\fR -use FILE as the grub shell -.TP -\fB\-\-no\-floppy\fR -do not probe any floppy drive -.TP -\fB\-\-force\-lba\fR -force GRUB to use LBA mode even for a buggy -BIOS -.TP -\fB\-\-recheck\fR -probe a device map even if it already exists -.PP -INSTALL_DEVICE can be a GRUB device name or a system device filename. -.PP -grub-install copies GRUB images into the DIR/boot directory specfied by -\fB\-\-root\-directory\fR, and uses the grub shell to install grub into the boot -sector. -.SH "REPORTING BUGS" -Report bugs to . -.SH "SEE ALSO" -The full documentation for -.B grub-install -is maintained as a Texinfo manual. If the -.B info -and -.B grub-install -programs are properly installed at your site, the command -.IP -.B info grub-install -.PP -should give you access to the complete manual. diff --git a/usr/src/grub/grub-0.95/docs/grub-md5-crypt.8 b/usr/src/grub/grub-0.95/docs/grub-md5-crypt.8 deleted file mode 100644 index 00a5dba307..0000000000 --- a/usr/src/grub/grub-0.95/docs/grub-md5-crypt.8 +++ /dev/null @@ -1,32 +0,0 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.23. -.TH GRUB-MD5-CRYPT "8" "June 2004" "grub-md5-crypt (GNU GRUB )" FSF -.SH NAME -grub-md5-crypt \- Encrypt a password in MD5 format -.SH SYNOPSIS -.B grub-md5-crypt -[\fIOPTION\fR] -.SH DESCRIPTION -Encrypt a password in MD5 format. -.TP -\fB\-h\fR, \fB\-\-help\fR -print this message and exit -.TP -\fB\-v\fR, \fB\-\-version\fR -print the version information and exit -.TP -\fB\-\-grub\-shell\fR=\fIFILE\fR -use FILE as the grub shell -.SH "REPORTING BUGS" -Report bugs to . -.SH "SEE ALSO" -The full documentation for -.B grub-md5-crypt -is maintained as a Texinfo manual. If the -.B info -and -.B grub-md5-crypt -programs are properly installed at your site, the command -.IP -.B info grub-md5-crypt -.PP -should give you access to the complete manual. diff --git a/usr/src/grub/grub-0.95/docs/grub-terminfo.8 b/usr/src/grub/grub-0.95/docs/grub-terminfo.8 deleted file mode 100644 index 244d6afe24..0000000000 --- a/usr/src/grub/grub-0.95/docs/grub-terminfo.8 +++ /dev/null @@ -1,29 +0,0 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.23. -.TH GRUB-TERMINFO "8" "June 2004" "grub-terminfo (GNU GRUB 0.95)" FSF -.SH NAME -grub-terminfo \- Generate a terminfo command from a terminfo name -.SH SYNOPSIS -.B grub-terminfo -\fITERMNAME\fR -.SH DESCRIPTION -Generate a terminfo command from a terminfo name. -.TP -\fB\-h\fR, \fB\-\-help\fR -print this message and exit -.TP -\fB\-v\fR, \fB\-\-version\fR -print the version information and exit -.SH "REPORTING BUGS" -Report bugs to . -.SH "SEE ALSO" -The full documentation for -.B grub-terminfo -is maintained as a Texinfo manual. If the -.B info -and -.B grub-terminfo -programs are properly installed at your site, the command -.IP -.B info grub-terminfo -.PP -should give you access to the complete manual. diff --git a/usr/src/grub/grub-0.95/docs/grub.8 b/usr/src/grub/grub-0.95/docs/grub.8 deleted file mode 100644 index 6a31e65644..0000000000 --- a/usr/src/grub/grub-0.95/docs/grub.8 +++ /dev/null @@ -1,71 +0,0 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.23. -.TH GRUB "8" "August 2004" "grub (GNU GRUB 0.95)" FSF -.SH NAME -grub \- the grub shell -.SH SYNOPSIS -.B grub -[\fIOPTION\fR]... -.SH DESCRIPTION -Enter the GRand Unified Bootloader command shell. -.TP -\fB\-\-batch\fR -turn on batch mode for non-interactive use -.TP -\fB\-\-boot\-drive\fR=\fIDRIVE\fR -specify stage2 boot_drive [default=0x0] -.TP -\fB\-\-config\-file\fR=\fIFILE\fR -specify stage2 config_file [default=/boot/grub/menu.lst] -.TP -\fB\-\-device\-map\fR=\fIFILE\fR -use the device map file FILE -.TP -\fB\-\-help\fR -display this message and exit -.TP -\fB\-\-hold\fR -wait until a debugger will attach -.TP -\fB\-\-install\-partition\fR=\fIPAR\fR -specify stage2 install_partition [default=0x20000] -.TP -\fB\-\-no\-config\-file\fR -do not use the config file -.TP -\fB\-\-no\-curses\fR -do not use curses -.TP -\fB\-\-no\-floppy\fR -do not probe any floppy drive -.TP -\fB\-\-no\-pager\fR -do not use internal pager -.TP -\fB\-\-preset\-menu\fR -use the preset menu -.TP -\fB\-\-probe\-second\-floppy\fR -probe the second floppy drive -.TP -\fB\-\-read\-only\fR -do not write anything to devices -.TP -\fB\-\-verbose\fR -print verbose messages -.TP -\fB\-\-version\fR -print version information and exit -.SH "REPORTING BUGS" -Report bugs to . -.SH "SEE ALSO" -The full documentation for -.B grub -is maintained as a Texinfo manual. If the -.B info -and -.B grub -programs are properly installed at your site, the command -.IP -.B info grub -.PP -should give you access to the complete manual. diff --git a/usr/src/grub/grub-0.95/docs/grub.info b/usr/src/grub/grub-0.95/docs/grub.info deleted file mode 100644 index 1494e61b15..0000000000 --- a/usr/src/grub/grub-0.95/docs/grub.info +++ /dev/null @@ -1,200 +0,0 @@ -This is grub.info, produced by makeinfo version 4.0 from grub.texi. - -INFO-DIR-SECTION Kernel -START-INFO-DIR-ENTRY -* GRUB: (grub). The GRand Unified Bootloader -* grub-install: (grub)Invoking grub-install. Install GRUB on your drive -* grub-md5-crypt: (grub)Invoking grub-md5-crypt. Encrypt a password - in MD5 format -* grub-terminfo: (grub)Invoking grub-terminfo. Generate a terminfo - command from a - terminfo name -* grub-set-default: (grub)Invoking grub-set-default. Set a default boot - entry -* mbchk: (grub)Invoking mbchk. Check for the format of a Multiboot kernel -END-INFO-DIR-ENTRY - - Copyright (C) 1999,2000,2001,2002,2004 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. - - -Indirect: -grub.info-1: 1465 -grub.info-2: 50861 -grub.info-3: 99718 -grub.info-4: 148054 - -Tag Table: -(Indirect) -Node: Top1465 -Node: Introduction3247 -Node: Overview3620 -Node: Overview-Footnotes5837 -Ref: Overview-Footnote-15898 -Node: History6059 -Node: Features7175 -Node: Features-Footnotes12938 -Ref: Features-Footnote-112999 -Node: Role of a boot loader13144 -Node: Role of a boot loader-Footnotes14477 -Ref: Role of a boot loader-Footnote-114564 -Node: Naming convention14643 -Node: Installation17577 -Node: Creating a GRUB boot floppy19318 -Node: Installing GRUB natively20131 -Node: Installing GRUB natively-Footnotes22406 -Ref: Installing GRUB natively-Footnote-122499 -Node: Installing GRUB using grub-install22684 -Node: Making a GRUB bootable CD-ROM25625 -Node: Making a GRUB bootable CD-ROM-Footnotes27665 -Ref: Making a GRUB bootable CD-ROM-Footnote-127768 -Node: Booting27843 -Node: General boot methods28297 -Node: Loading an operating system directly29033 -Node: Chain-loading30328 -Node: Chain-loading-Footnotes31629 -Ref: Chain-loading-Footnote-131700 -Node: OS-specific notes31772 -Node: GNU/Hurd32143 -Node: GNU/Linux32753 -Node: FreeBSD33992 -Node: NetBSD34496 -Node: OpenBSD35145 -Node: DOS/Windows35336 -Node: SCO UnixWare37153 -Node: QNX37562 -Node: Making your system robust37803 -Node: Booting once-only39123 -Node: Booting fallback systems41049 -Node: Configuration43902 -Node: Network48330 -Node: General usage of network support48823 -Node: General usage of network support-Footnotes50684 -Ref: General usage of network support-Footnote-150793 -Node: Diskless50861 -Node: Serial terminal53045 -Node: Preset Menu55277 -Node: Security57649 -Node: Images60456 -Node: Filesystem62964 -Node: Device syntax63644 -Node: File name syntax65131 -Node: Block list syntax65867 -Node: Interface66593 -Node: Command-line interface67467 -Node: Command-line interface-Footnotes69401 -Ref: Command-line interface-Footnote-169490 -Node: Menu interface69585 -Node: Menu entry editor70588 -Node: Hidden menu interface71660 -Node: Commands72230 -Node: Menu-specific commands72804 -Node: default73968 -Node: fallback74431 -Node: hiddenmenu74967 -Node: timeout75440 -Node: title75703 -Node: General commands75959 -Node: bootp77265 -Node: color77729 -Node: device79198 -Node: dhcp79755 -Node: hide80326 -Node: ifconfig80688 -Node: pager81249 -Node: partnew81568 -Node: parttype81989 -Node: password82341 -Node: rarp83143 -Node: serial83427 -Node: setkey84683 -Node: terminal86835 -Node: terminfo88355 -Node: tftpserver89025 -Node: unhide89554 -Node: Command-line and menu entry commands89912 -Node: blocklist92435 -Node: boot92662 -Node: cat92968 -Node: chainloader93257 -Node: cmp93858 -Node: configfile94394 -Node: debug94593 -Node: displayapm94962 -Node: displaymem95158 -Node: embed95845 -Node: embed-Footnotes96362 -Ref: embed-Footnote-196417 -Node: find96474 -Node: fstest96837 -Node: geometry97505 -Node: halt98100 -Node: help98410 -Node: impsprobe99014 -Node: initrd99396 -Node: install99718 -Node: install-Footnotes102545 -Ref: install-Footnote-1102604 -Node: ioprobe102701 -Node: kernel103009 -Node: lock104112 -Node: makeactive104670 -Node: map104965 -Node: md5crypt105515 -Node: module105845 -Node: modulenounzip106405 -Node: pause106681 -Node: quit107078 -Node: reboot107337 -Node: read107501 -Node: root107726 -Node: rootnoverify108586 -Node: savedefault109124 -Node: setup110103 -Node: testload111152 -Node: testvbe111745 -Node: uppermem112099 -Node: vbeprobe112664 -Node: Troubleshooting113030 -Node: Stage1 errors113565 -Node: Stage1.5 errors114935 -Node: Stage2 errors115366 -Node: Invoking the grub shell122819 -Node: Basic usage123569 -Node: Installation under UNIX125849 -Node: Device map127522 -Node: Invoking grub-install128663 -Node: Invoking grub-md5-crypt130248 -Node: Invoking grub-terminfo130893 -Node: Invoking grub-set-default131656 -Node: Invoking mbchk133464 -Node: Obtaining and Building GRUB133975 -Node: Reporting bugs135370 -Node: Future138155 -Node: Internals138627 -Node: Memory map139831 -Node: Embedded data141304 -Node: Filesystem interface143316 -Node: Command interface146744 -Node: Bootstrap tricks148054 -Node: I/O ports detection150198 -Node: Memory detection150465 -Node: Low-level disk I/O150752 -Node: MBR151016 -Node: Partition table151208 -Node: Submitting patches151474 -Node: Index152955 - -End Tag Table diff --git a/usr/src/grub/grub-0.95/docs/grub.info-1 b/usr/src/grub/grub-0.95/docs/grub.info-1 deleted file mode 100644 index 23811f395a..0000000000 --- a/usr/src/grub/grub-0.95/docs/grub.info-1 +++ /dev/null @@ -1,1338 +0,0 @@ -This is grub.info, produced by makeinfo version 4.0 from grub.texi. - -INFO-DIR-SECTION Kernel -START-INFO-DIR-ENTRY -* GRUB: (grub). The GRand Unified Bootloader -* grub-install: (grub)Invoking grub-install. Install GRUB on your drive -* grub-md5-crypt: (grub)Invoking grub-md5-crypt. Encrypt a password - in MD5 format -* grub-terminfo: (grub)Invoking grub-terminfo. Generate a terminfo - command from a - terminfo name -* grub-set-default: (grub)Invoking grub-set-default. Set a default boot - entry -* mbchk: (grub)Invoking mbchk. Check for the format of a Multiboot kernel -END-INFO-DIR-ENTRY - - Copyright (C) 1999,2000,2001,2002,2004 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: grub.info, Node: Top, Next: Introduction, Up: (dir) - -GRUB manual -*********** - - This is the documentation of GNU GRUB, the GRand Unified Bootloader, -a flexible and powerful boot loader program for PCs. - - This edition documents version 0.95. - -* Menu: - -* Introduction:: Capturing the spirit of GRUB -* Naming convention:: Names of your drives in GRUB -* Installation:: Installing GRUB on your drive -* Booting:: How to boot different operating systems -* Configuration:: Writing your own configuration file -* Network:: Downloading OS images from a network -* Serial terminal:: Using GRUB via a serial line -* Preset Menu:: Embedding a configuration file into GRUB -* Security:: Improving the security -* Images:: GRUB image files -* Filesystem:: Filesystem syntax and semantics -* Interface:: The menu and the command-line -* Commands:: The list of available builtin commands -* Troubleshooting:: Error messages produced by GRUB -* Invoking the grub shell:: How to use the grub shell -* Invoking grub-install:: How to use the GRUB installer -* Invoking grub-md5-crypt:: How to generate a cryptic password -* Invoking grub-terminfo:: How to generate a terminfo command -* Invoking grub-set-default:: How to set a default boot entry -* Invoking mbchk:: How to use the Multiboot checker -* Obtaining and Building GRUB:: How to obtain and build GRUB -* Reporting bugs:: Where you should send a bug report -* Future:: Some future plans on GRUB -* Internals:: Hacking GRUB -* Index:: - - -File: grub.info, Node: Introduction, Next: Naming convention, Prev: Top, Up: Top - -Introduction to GRUB -******************** - -* Menu: - -* Overview:: What exactly GRUB is and how to use it -* History:: From maggot to house fly -* Features:: GRUB features -* Role of a boot loader:: The role of a boot loader - - -File: grub.info, Node: Overview, Next: History, Up: Introduction - -Overview -======== - - Briefly, a "boot loader" is the first software program that runs when -a computer starts. It is responsible for loading and transferring -control to an operating system "kernel" software (such as Linux or GNU -Mach). The kernel, in turn, initializes the rest of the operating -system (e.g. a GNU system). - - GNU GRUB is a very powerful boot loader, which can load a wide -variety of free operating systems, as well as proprietary operating -systems with chain-loading(1) (*note Overview-Footnote-1::). GRUB is -designed to address the complexity of booting a personal computer; both -the program and this manual are tightly bound to that computer platform, -although porting to other platforms may be addressed in the future. - - One of the important features in GRUB is flexibility; GRUB -understands filesystems and kernel executable formats, so you can load -an arbitrary operating system the way you like, without recording the -physical position of your kernel on the disk. Thus you can load the -kernel just by specifying its file name and the drive and partition -where the kernel resides. - - When booting with GRUB, you can use either a command-line interface -(*note Command-line interface::), or a menu interface (*note Menu -interface::). Using the command-line interface, you type the drive -specification and file name of the kernel manually. In the menu -interface, you just select an OS using the arrow keys. The menu is -based on a configuration file which you prepare beforehand (*note -Configuration::). While in the menu, you can switch to the command-line -mode, and vice-versa. You can even edit menu entries before using them. - - In the following chapters, you will learn how to specify a drive, a -partition, and a file name (*note Naming convention::) to GRUB, how to -install GRUB on your drive (*note Installation::), and how to boot your -OSes (*note Booting::), step by step. - - Besides the GRUB boot loader itself, there is a "grub shell" `grub' -(*note Invoking the grub shell::) which can be run when you are in your -operating system. It emulates the boot loader and can be used for -installing the boot loader. - - -File: grub.info, Node: Overview-Footnotes, Up: Overview - - (1) "chain-load" is the mechanism for loading unsupported operating -systems by loading another boot loader. It is typically used for -loading DOS or Windows. - - -File: grub.info, Node: History, Next: Features, Prev: Overview, Up: Introduction - -History of GRUB -=============== - - GRUB originated in 1995 when Erich Boleyn was trying to boot the GNU -Hurd with the University of Utah's Mach 4 microkernel (now known as GNU -Mach). Erich and Brian Ford designed the Multiboot Specification -(*note Multiboot Specification: (multiboot)Top.), because they were -determined not to add to the large number of mutually-incompatible PC -boot methods. - - Erich then began modifying the FreeBSD boot loader so that it would -understand Multiboot. He soon realized that it would be a lot easier to -write his own boot loader from scratch than to keep working on the -FreeBSD boot loader, and so GRUB was born. - - Erich added many features to GRUB, but other priorities prevented him -from keeping up with the demands of its quickly-expanding user base. In -1999, Gordon Matzigkeit and Yoshinori K. Okuji adopted GRUB as an -official GNU package, and opened its development by making the latest -sources available via anonymous CVS. *Note Obtaining and Building -GRUB::, for more information. - - -File: grub.info, Node: Features, Next: Role of a boot loader, Prev: History, Up: Introduction - -GRUB features -============= - - The primary requirement for GRUB is that it be compliant with the -"Multiboot Specification", which is described in *Note Multiboot -Specification: (multiboot)Top. - - The other goals, listed in approximate order of importance, are: - - * Basic functions must be straightforward for end-users. - - * Rich functionality to support kernel experts and designers. - - * Backward compatibility for booting FreeBSD, NetBSD, OpenBSD, and - Linux. Proprietary kernels (such as DOS, Windows NT, and OS/2) are - supported via a chain-loading function. - - Except for specific compatibility modes (chain-loading and the Linux -"piggyback" format), all kernels will be started in much the same state -as in the Multiboot Specification. Only kernels loaded at 1 megabyte or -above are presently supported. Any attempt to load below that boundary -will simply result in immediate failure and an error message reporting -the problem. - - In addition to the requirements above, GRUB has the following -features (note that the Multiboot Specification doesn't require all the -features that GRUB supports): - -Recognize multiple executable formats - Support many of the "a.out" variants plus "ELF". Symbol tables are - also loaded. - -Support non-Multiboot kernels - Support many of the various free 32-bit kernels that lack Multiboot - compliance (primarily FreeBSD, NetBSD, OpenBSD, and Linux). - Chain-loading of other boot loaders is also supported. - -Load multiples modules - Fully support the Multiboot feature of loading multiple modules. - -Load a configuration file - Support a human-readable text configuration file with preset boot - commands. You can also load another configuration file dynamically - and embed a preset configuration file in a GRUB image file. The - list of commands (*note Commands::) are a superset of those - supported on the command-line. An example configuration file is - provided in *Note Configuration::. - -Provide a menu interface - A menu interface listing preset boot commands, with a programmable - timeout, is available. There is no fixed limit on the number of - boot entries, and the current implementation has space for several - hundred. - -Have a flexible command-line interface - A fairly flexible command-line interface, accessible from the menu, - is available to edit any preset commands, or write a new boot - command set from scratch. If no configuration file is present, - GRUB drops to the command-line. - - The list of commands (*note Commands::) are a subset of those - supported for configuration files. Editing commands closely - resembles the Bash command-line (*note Bash: (features)Command - Line Editing.), with -completion of commands, devices, - partitions, and files in a directory depending on context. - -Support multiple filesystem types - Support multiple filesystem types transparently, plus a useful - explicit blocklist notation. The currently supported filesystem - types are "BSD FFS", "DOS FAT16 and FAT32", "Minix fs", "Linux - ext2fs", "ReiserFS", "JFS", "XFS", and "VSTa fs". *Note - Filesystem::, for more information. - -Support automatic decompression - Can decompress files which were compressed by `gzip'. This - function is both automatic and transparent to the user (i.e. all - functions operate upon the uncompressed contents of the specified - files). This greatly reduces a file size and loading time, a - particularly great benefit for floppies.(1) (*note - Features-Footnote-1::) - - It is conceivable that some kernel modules should be loaded in a - compressed state, so a different module-loading command can be - specified to avoid uncompressing the modules. - -Access data on any installed device - Support reading data from any or all floppies or hard disk(s) - recognized by the BIOS, independent of the setting of the root - device. - -Be independent of drive geometry translations - Unlike many other boot loaders, GRUB makes the particular drive - translation irrelevant. A drive installed and running with one - translation may be converted to another translation without any - adverse effects or changes in GRUB's configuration. - -Detect all installed RAM - GRUB can generally find all the installed RAM on a PC-compatible - machine. It uses an advanced BIOS query technique for finding all - memory regions. As described on the Multiboot Specification (*note - Multiboot Specification: (multiboot)Top.), not all kernels make - use of this information, but GRUB provides it for those who do. - -Support Logical Block Address mode - In traditional disk calls (called "CHS mode"), there is a geometry - translation problem, that is, the BIOS cannot access over 1024 - cylinders, so the accessible space is limited to at least 508 MB - and to at most 8GB. GRUB can't universally solve this problem, as - there is no standard interface used in all machines. However, - several newer machines have the new interface, Logical Block - Address ("LBA") mode. GRUB automatically detects if LBA mode is - available and uses it if available. In LBA mode, GRUB can access - the entire disk. - -Support network booting - GRUB is basically a disk-based boot loader but also has network - support. You can load OS images from a network by using the "TFTP" - protocol. - -Support remote terminals - To support computers with no console, GRUB provides remote terminal - support, so that you can control GRUB from a remote host. Only - serial terminal support is implemented at the moment. - - -File: grub.info, Node: Features-Footnotes, Up: Features - - (1) There are a few pathological cases where loading a very badly -organized ELF kernel might take longer, but in practice this never -happen. - - -File: grub.info, Node: Role of a boot loader, Prev: Features, Up: Introduction - -The role of a boot loader -========================= - - The following is a quotation from Gordon Matzigkeit, a GRUB fanatic: - - Some people like to acknowledge both the operating system and - kernel when they talk about their computers, so they might say - they use "GNU/Linux" or "GNU/Hurd". Other people seem to think - that the kernel is the most important part of the system, so they - like to call their GNU operating systems "Linux systems." - - I, personally, believe that this is a grave injustice, because the - _boot loader_ is the most important software of all. I used to - refer to the above systems as either "LILO"(1) (*note Role of a - boot loader-Footnote-1::) or "GRUB" systems. - - Unfortunately, nobody ever understood what I was talking about; - now I just use the word "GNU" as a pseudonym for GRUB. - - So, if you ever hear people talking about their alleged "GNU" - systems, remember that they are actually paying homage to the best - boot loader around... GRUB! - - We, the GRUB maintainers, do not (usually) encourage Gordon's level -of fanaticism, but it helps to remember that boot loaders deserve -recognition. We hope that you enjoy using GNU GRUB as much as we did -writing it. - - -File: grub.info, Node: Role of a boot loader-Footnotes, Up: Role of a boot loader - - (1) The LInux LOader, a boot loader that everybody uses, but nobody -likes. - - -File: grub.info, Node: Naming convention, Next: Installation, Prev: Introduction, Up: Top - -Naming convention -***************** - - The device syntax used in GRUB is a wee bit different from what you -may have seen before in your operating system(s), and you need to know -it so that you can specify a drive/partition. - - Look at the following examples and explanations: - - (fd0) - - First of all, GRUB requires that the device name be enclosed with -`(' and `)'. The `fd' part means that it is a floppy disk. The number -`0' is the drive number, which is counted from _zero_. This expression -means that GRUB will use the whole floppy disk. - - (hd0,1) - - Here, `hd' means it is a hard disk drive. The first integer `0' -indicates the drive number, that is, the first hard disk, while the -second integer, `1', indicates the partition number (or the PC slice -number in the BSD terminology). Once again, please note that the -partition numbers are counted from _zero_, not from one. This -expression means the second partition of the first hard disk drive. In -this case, GRUB uses one partition of the disk, instead of the whole -disk. - - (hd0,4) - - This specifies the first "extended partition" of the first hard disk -drive. Note that the partition numbers for extended partitions are -counted from `4', regardless of the actual number of primary partitions -on your hard disk. - - (hd1,a) - - This means the BSD `a' partition of the second hard disk. If you -need to specify which PC slice number should be used, use something -like this: `(hd1,0,a)'. If the PC slice number is omitted, GRUB -searches for the first PC slice which has a BSD `a' partition. - - Of course, to actually access the disks or partitions with GRUB, you -need to use the device specification in a command, like `root (fd0)' or -`unhide (hd0,2)'. To help you find out which number specifies a -partition you want, the GRUB command-line (*note Command-line -interface::) options have argument completion. This means that, for -example, you only need to type - - root ( - - followed by a , and GRUB will display the list of drives, -partitions, or file names. So it should be quite easy to determine the -name of your target partition, even with minimal knowledge of the -syntax. - - Note that GRUB does _not_ distinguish IDE from SCSI - it simply -counts the drive numbers from zero, regardless of their type. Normally, -any IDE drive number is less than any SCSI drive number, although that -is not true if you change the boot sequence by swapping IDE and SCSI -drives in your BIOS. - - Now the question is, how to specify a file? Again, consider an -example: - - (hd0,0)/vmlinuz - - This specifies the file named `vmlinuz', found on the first -partition of the first hard disk drive. Note that the argument -completion works with file names, too. - - That was easy, admit it. Now read the next chapter, to find out how -to actually install GRUB on your drive. - - -File: grub.info, Node: Installation, Next: Booting, Prev: Naming convention, Up: Top - -Installation -************ - - In order to install GRUB as your boot loader, you need to first -install the GRUB system and utilities under your UNIX-like operating -system (*note Obtaining and Building GRUB::). You can do this either -from the source tarball, or as a package for your OS. - - After you have done that, you need to install the boot loader on a -drive (floppy or hard disk). There are two ways of doing that - either -using the utility `grub-install' (*note Invoking grub-install::) on a -UNIX-like OS, or by running GRUB itself from a floppy. These are quite -similar, however the utility might probe a wrong BIOS drive, so you -should be careful. - - Also, if you install GRUB on a UNIX-like OS, please make sure that -you have an emergency boot disk ready, so that you can rescue your -computer if, by any chance, your hard drive becomes unusable -(unbootable). - - GRUB comes with boot images, which are normally put in the directory -`/usr/lib/grub/i386-pc'. If you do not use grub-install, then you need -to copy the files `stage1', `stage2', and `*stage1_5' to the directory -`/boot/grub', and run the `grub-set-default' (*note Invoking -grub-set-default::) if you intend to use `default saved' (*note -default::) in your configuration file. Hereafter, the directory where -GRUB images are initially placed (normally `/usr/lib/grub/i386-pc') -will be called the "image directory", and the directory where the boot -loader needs to find them (usually `/boot/grub') will be called the -"boot directory". - -* Menu: - -* Creating a GRUB boot floppy:: -* Installing GRUB natively:: -* Installing GRUB using grub-install:: -* Making a GRUB bootable CD-ROM:: - - -File: grub.info, Node: Creating a GRUB boot floppy, Next: Installing GRUB natively, Up: Installation - -Creating a GRUB boot floppy -=========================== - - To create a GRUB boot floppy, you need to take the files `stage1' -and `stage2' from the image directory, and write them to the first and -the second block of the floppy disk, respectively. - - *Caution:* This procedure will destroy any data currently stored on -the floppy. - - On a UNIX-like operating system, that is done with the following -commands: - - # cd /usr/lib/grub/i386-pc - # dd if=stage1 of=/dev/fd0 bs=512 count=1 - 1+0 records in - 1+0 records out - # dd if=stage2 of=/dev/fd0 bs=512 seek=1 - 153+1 records in - 153+1 records out - # - - The device file name may be different. Consult the manual for your -OS. - - -File: grub.info, Node: Installing GRUB natively, Next: Installing GRUB using grub-install, Prev: Creating a GRUB boot floppy, Up: Installation - -Installing GRUB natively -======================== - - *Caution:* Installing GRUB's stage1 in this manner will erase the -normal boot-sector used by an OS. - - GRUB can currently boot GNU Mach, Linux, FreeBSD, NetBSD, and OpenBSD -directly, so using it on a boot sector (the first sector of a -partition) should be okay. But generally, it would be a good idea to -back up the first sector of the partition on which you are installing -GRUB's stage1. This isn't as important if you are installing GRUB on -the first sector of a hard disk, since it's easy to reinitialize it -(e.g. by running `FDISK /MBR' from DOS). - - If you decide to install GRUB in the native environment, which is -definitely desirable, you'll need to create a GRUB boot disk, and -reboot your computer with it. Otherwise, see *Note Installing GRUB -using grub-install::. - - Once started, GRUB will show the command-line interface (*note -Command-line interface::). First, set the GRUB's "root device"(1) -(*note Installing GRUB natively-Footnote-1::) to the partition -containing the boot directory, like this: - - grub> root (hd0,0) - - If you are not sure which partition actually holds this directory, -use the command `find' (*note find::), like this: - - grub> find /boot/grub/stage1 - - This will search for the file name `/boot/grub/stage1' and show the -devices which contain the file. - - Once you've set the root device correctly, run the command `setup' -(*note setup::): - - grub> setup (hd0) - - This command will install the GRUB boot loader on the Master Boot -Record (MBR) of the first drive. If you want to put GRUB into the boot -sector of a partition instead of putting it in the MBR, specify the -partition into which you want to install GRUB: - - grub> setup (hd0,0) - - If you install GRUB into a partition or a drive other than the first -one, you must chain-load GRUB from another boot loader. Refer to the -manual for the boot loader to know how to chain-load GRUB. - - After using the setup command, you will boot into GRUB without the -GRUB floppy. See the chapter *Note Booting:: to find out how to boot -your operating systems from GRUB. - - -File: grub.info, Node: Installing GRUB natively-Footnotes, Up: Installing GRUB natively - - (1) Note that GRUB's root device doesn't necessarily mean your OS's -root partition; if you need to specify a root partition for your OS, -add the argument into the command `kernel'. - - -File: grub.info, Node: Installing GRUB using grub-install, Next: Making a GRUB bootable CD-ROM, Prev: Installing GRUB natively, Up: Installation - -Installing GRUB using grub-install -================================== - - *Caution:* This procedure is definitely less safe, because there are -several ways in which your computer can become unbootable. For example, -most operating systems don't tell GRUB how to map BIOS drives to OS -devices correctly--GRUB merely "guesses" the mapping. This will succeed -in most cases, but not always. Therefore, GRUB provides you with a map -file called the "device map", which you must fix if it is wrong. *Note -Device map::, for more details. - - If you still do want to install GRUB under a UNIX-like OS (such as -GNU), invoke the program `grub-install' (*note Invoking grub-install::) -as the superuser ("root"). - - The usage is basically very simple. You only need to specify one -argument to the program, namely, where to install the boot loader. The -argument can be either a device file (like `/dev/hda') or a partition -specified in GRUB's notation. For example, under Linux the following -will install GRUB into the MBR of the first IDE disk: - - # grub-install /dev/hda - - Likewise, under GNU/Hurd, this has the same effect: - - # grub-install /dev/hd0 - - If it is the first BIOS drive, this is the same as well: - - # grub-install '(hd0)' - - Or you can omit the parentheses: - - # grub-install hd0 - - But all the above examples assume that GRUB should use images under -the root directory. If you want GRUB to use images under a directory -other than the root directory, you need to specify the option -`--root-directory'. The typical usage is that you create a GRUB boot -floppy with a filesystem. Here is an example: - - # mke2fs /dev/fd0 - # mount -t ext2 /dev/fd0 /mnt - # grub-install --root-directory=/mnt fd0 - # umount /mnt - - Another example is when you have a separate boot partition which is -mounted at `/boot'. Since GRUB is a boot loader, it doesn't know -anything about mountpoints at all. Thus, you need to run `grub-install' -like this: - - # grub-install --root-directory=/boot /dev/hda - - By the way, as noted above, it is quite difficult to guess BIOS -drives correctly under a UNIX-like OS. Thus, `grub-install' will prompt -you to check if it could really guess the correct mappings, after the -installation. The format is defined in *Note Device map::. Please be -quite careful. If the output is wrong, it is unlikely that your -computer will be able to boot with no problem. - - Note that `grub-install' is actually just a shell script and the -real task is done by the grub shell `grub' (*note Invoking the grub -shell::). Therefore, you may run `grub' directly to install GRUB, -without using `grub-install'. Don't do that, however, unless you are -very familiar with the internals of GRUB. Installing a boot loader on a -running OS may be extremely dangerous. - - -File: grub.info, Node: Making a GRUB bootable CD-ROM, Prev: Installing GRUB using grub-install, Up: Installation - -Making a GRUB bootable CD-ROM -============================= - - GRUB supports the "no emulation mode" in the El Torito -specification(1) (*note Making a GRUB bootable CD-ROM-Footnote-1::). -This means that you can use the whole CD-ROM from GRUB and you don't -have to make a floppy or hard disk image file, which can cause -compatibility problems. - - For booting from a CD-ROM, GRUB uses a special Stage 2 called -`stage2_eltorito'. The only GRUB files you need to have in your -bootable CD-ROM are this `stage2_eltorito' and optionally a config file -`menu.lst'. You don't need to use `stage1' or `stage2', because El -Torito is quite different from the standard boot process. - - Here is an example of procedures to make a bootable CD-ROM image. -First, make a top directory for the bootable image, say, `iso': - - $ mkdir iso - - Make a directory for GRUB: - - $ mkdir -p iso/boot/grub - - Copy the file `stage2_eltorito': - - $ cp /usr/lib/grub/i386-pc/stage2_eltorito iso/boot/grub - - If desired, make the config file `menu.lst' under `iso/boot/grub' -(*note Configuration::), and copy any files and directories for the -disc to the directory `iso/'. - - Finally, make a ISO9660 image file like this: - - $ mkisofs -R -b boot/grub/stage2_eltorito -no-emul-boot \ - -boot-load-size 4 -boot-info-table -o grub.iso iso - - This produces a file named `grub.iso', which then can be burned into -a CD (or a DVD). `mkisofs' has already set up the disc to boot from -the `boot/grub/stage2_eltorito' file, so there is no need to setup GRUB -on the disc. (Note that the `-boot-load-size 4' bit is required for -compatibility with the BIOS on many older machines.) - - You can use the device `(cd)' to access a CD-ROM in your config -file. This is not required; GRUB automatically sets the root device to -`(cd)' when booted from a CD-ROM. It is only necessary to refer to -`(cd)' if you want to access other drives as well. - - -File: grub.info, Node: Making a GRUB bootable CD-ROM-Footnotes, Up: Making a GRUB bootable CD-ROM - - (1) El Torito is a specification for bootable CD using BIOS -functions. - - -File: grub.info, Node: Booting, Next: Configuration, Prev: Installation, Up: Top - -Booting -******* - - GRUB can load Multiboot-compliant kernels in a consistent way, but -for some free operating systems you need to use some OS-specific magic. - -* Menu: - -* General boot methods:: How to boot OSes with GRUB generally -* OS-specific notes:: Notes on some operating systems -* Making your system robust:: How to make your system robust - - -File: grub.info, Node: General boot methods, Next: OS-specific notes, Up: Booting - -How to boot operating systems -============================= - - GRUB has two distinct boot methods. One of the two is to load an -operating system directly, and the other is to chain-load another boot -loader which then will load an operating system actually. Generally -speaking, the former is more desirable, because you don't need to -install or maintain other boot loaders and GRUB is flexible enough to -load an operating system from an arbitrary disk/partition. However, the -latter is sometimes required, since GRUB doesn't support all the -existing operating systems natively. - -* Menu: - -* Loading an operating system directly:: -* Chain-loading:: - - -File: grub.info, Node: Loading an operating system directly, Next: Chain-loading, Up: General boot methods - -How to boot an OS directly with GRUB ------------------------------------- - - Multiboot (*note Multiboot Specification: (multiboot)Top.) is the -native format supported by GRUB. For the sake of convenience, there is -also support for Linux, FreeBSD, NetBSD and OpenBSD. If you want to -boot other operating systems, you will have to chain-load them (*note -Chain-loading::). - - Generally, GRUB can boot any Multiboot-compliant OS in the following -steps: - - 1. Set GRUB's root device to the drive where the OS images are stored - with the command `root' (*note root::). - - 2. Load the kernel image with the command `kernel' (*note kernel::). - - 3. If you need modules, load them with the command `module' (*note - module::) or `modulenounzip' (*note modulenounzip::). - - 4. Run the command `boot' (*note boot::). - - Linux, FreeBSD, NetBSD and OpenBSD can be booted in a similar -manner. You load a kernel image with the command `kernel' and then run -the command `boot'. If the kernel requires some parameters, just append -the parameters to `kernel', after the file name of the kernel. Also, -please refer to *Note OS-specific notes::, for information on your -OS-specific issues. - - -File: grub.info, Node: Chain-loading, Prev: Loading an operating system directly, Up: General boot methods - -Load another boot loader to boot unsupported operating systems --------------------------------------------------------------- - - If you want to boot an unsupported operating system (e.g. Windows -95), chain-load a boot loader for the operating system. Normally, the -boot loader is embedded in the "boot sector" of the partition on which -the operating system is installed. - - 1. Set GRUB's root device to the partition by the command - `rootnoverify' (*note rootnoverify::): - - grub> rootnoverify (hd0,0) - - 2. Set the "active" flag in the partition using the command - `makeactive'(1) (*note Chain-loading-Footnote-1::) (*note - makeactive::): - - grub> makeactive - - 3. Load the boot loader with the command `chainloader' (*note - chainloader::): - - grub> chainloader +1 - - `+1' indicates that GRUB should read one sector from the start of - the partition. The complete description about this syntax can be - found in *Note Block list syntax::. - - 4. Run the command `boot' (*note boot::). - - However, DOS and Windows have some deficiencies, so you might have to -use more complicated instructions. *Note DOS/Windows::, for more -information. - - -File: grub.info, Node: Chain-loading-Footnotes, Up: Chain-loading - - (1) This is not necessary for most of the modern operating systems. - - -File: grub.info, Node: OS-specific notes, Next: Making your system robust, Prev: General boot methods, Up: Booting - -Some caveats on OS-specific issues -================================== - - Here, we describe some caveats on several operating systems. - -* Menu: - -* GNU/Hurd:: -* GNU/Linux:: -* FreeBSD:: -* NetBSD:: -* OpenBSD:: -* DOS/Windows:: -* SCO UnixWare:: -* QNX:: - - -File: grub.info, Node: GNU/Hurd, Next: GNU/Linux, Up: OS-specific notes - -GNU/Hurd --------- - - Since GNU/Hurd is Multiboot-compliant, it is easy to boot it; there -is nothing special about it. But do not forget that you have to specify -a root partition to the kernel. - - 1. Set GRUB's root device to the same drive as GNU/Hurd's. Probably - the command `find /boot/gnumach' or similar can help you (*note - find::). - - 2. Load the kernel and the module, like this: - - grub> kernel /boot/gnumach root=hd0s1 - grub> module /boot/serverboot - - 3. Run the command `boot' (*note boot::). - - -File: grub.info, Node: GNU/Linux, Next: FreeBSD, Prev: GNU/Hurd, Up: OS-specific notes - -GNU/Linux ---------- - - It is relatively easy to boot GNU/Linux from GRUB, because it -somewhat resembles to boot a Multiboot-compliant OS. - - 1. Set GRUB's root device to the same drive as GNU/Linux's. Probably - the command `find /vmlinuz' or similar can help you (*note find::). - - 2. Load the kernel: - - grub> kernel /vmlinuz root=/dev/hda1 - - If you need to specify some kernel parameters, just append them to - the command. For example, to set `vga' to `ext', do this: - - grub> kernel /vmlinuz root=/dev/hda1 vga=ext - - See the documentation in the Linux source tree for complete - information on the available options. - - 3. If you use an initrd, execute the command `initrd' (*note - initrd::) after `kernel': - - grub> initrd /initrd - - 4. Finally, run the command `boot' (*note boot::). - - *Caution:* If you use an initrd and specify the `mem=' option to the -kernel to let it use less than actual memory size, you will also have -to specify the same memory size to GRUB. To let GRUB know the size, run -the command `uppermem' _before_ loading the kernel. *Note uppermem::, -for more information. - - -File: grub.info, Node: FreeBSD, Next: NetBSD, Prev: GNU/Linux, Up: OS-specific notes - -FreeBSD -------- - - GRUB can load the kernel directly, either in ELF or a.out format. But -this is not recommended, since FreeBSD's bootstrap interface sometimes -changes heavily, so GRUB can't guarantee to pass kernel parameters -correctly. - - Thus, we'd recommend loading the very flexible loader `/boot/loader' -instead. See this example: - - grub> root (hd0,a) - grub> kernel /boot/loader - grub> boot - - -File: grub.info, Node: NetBSD, Next: OpenBSD, Prev: FreeBSD, Up: OS-specific notes - -NetBSD ------- - - GRUB can load NetBSD a.out and ELF directly, follow these steps: - - 1. Set GRUB's root device with `root' (*note root::). - - 2. Load the kernel with `kernel' (*note kernel::). You should append - the ugly option `--type=netbsd', if you want to load an ELF - kernel, like this: - - grub> kernel --type=netbsd /netbsd-elf - - 3. Run `boot' (*note boot::). - - For now, however, GRUB doesn't allow you to pass kernel parameters, -so it may be better to chain-load it instead. For more information, -please see *Note Chain-loading::. - - -File: grub.info, Node: OpenBSD, Next: DOS/Windows, Prev: NetBSD, Up: OS-specific notes - -OpenBSD -------- - - The booting instruction is exactly the same as for NetBSD (*note -NetBSD::). - - -File: grub.info, Node: DOS/Windows, Next: SCO UnixWare, Prev: OpenBSD, Up: OS-specific notes - -DOS/Windows ------------ - - GRUB cannot boot DOS or Windows directly, so you must chain-load them -(*note Chain-loading::). However, their boot loaders have some critical -deficiencies, so it may not work to just chain-load them. To overcome -the problems, GRUB provides you with two helper functions. - - If you have installed DOS (or Windows) on a non-first hard disk, you -have to use the disk swapping technique, because that OS cannot boot -from any disks but the first one. The workaround used in GRUB is the -command `map' (*note map::), like this: - - grub> map (hd0) (hd1) - grub> map (hd1) (hd0) - - This performs a "virtual" swap between your first and second hard -drive. - - *Caution:* This is effective only if DOS (or Windows) uses BIOS to -access the swapped disks. If that OS uses a special driver for the -disks, this probably won't work. - - Another problem arises if you installed more than one set of -DOS/Windows onto one disk, because they could be confused if there are -more than one primary partitions for DOS/Windows. Certainly you should -avoid doing this, but there is a solution if you do want to do so. Use -the partition hiding/unhiding technique. - - If GRUB "hide"s a DOS (or Windows) partition (*note hide::), DOS (or -Windows) will ignore the partition. If GRUB "unhide"s a DOS (or -Windows) partition (*note unhide::), DOS (or Windows) will detect the -partition. Thus, if you have installed DOS (or Windows) on the first -and the second partition of the first hard disk, and you want to boot -the copy on the first partition, do the following: - - grub> unhide (hd0,0) - grub> hide (hd0,1) - grub> rootnoverify (hd0,0) - grub> chainloader +1 - grub> makeactive - grub> boot - - -File: grub.info, Node: SCO UnixWare, Next: QNX, Prev: DOS/Windows, Up: OS-specific notes - -SCO UnixWare ------------- - - It is known that the signature in the boot loader for SCO UnixWare is -wrong, so you will have to specify the option `--force' to -`chainloader' (*note chainloader::), like this: - - grub> rootnoverify (hd1,0) - grub> chainloader --force +1 - grub> makeactive - grub> boot - - -File: grub.info, Node: QNX, Prev: SCO UnixWare, Up: OS-specific notes - -QNX ---- - - QNX seems to use a bigger boot loader, so you need to boot it up, -like this: - - grub> rootnoverify (hd1,1) - grub> chainloader +4 - grub> boot - - -File: grub.info, Node: Making your system robust, Prev: OS-specific notes, Up: Booting - -How to make your system robust -============================== - - When you test a new kernel or a new OS, it is important to make sure -that your computer can boot even if the new system is unbootable. This -is crucial especially if you maintain servers or remote systems. To -accomplish this goal, you need to set up two things: - - 1. You must maintain a system which is always bootable. For instance, - if you test a new kernel, you need to keep a working kernel in a - different place. And, it would sometimes be very nice to even have - a complete copy of a working system in a different partition or - disk. - - 2. You must direct GRUB to boot a working system when the new system - fails. This is possible with the "fallback" system in GRUB. - - The former requirement is very specific to each OS, so this -documentation does not cover that topic. It is better to consult some -backup tools. - - So let's see the GRUB part. There are two possibilities: one of them -is quite simple but not very robust, and the other is a bit complex to -set up but probably the best solution to make sure that your system can -start as long as GRUB itself is bootable. - -* Menu: - -* Booting once-only:: -* Booting fallback systems:: - - -File: grub.info, Node: Booting once-only, Next: Booting fallback systems, Up: Making your system robust - -Booting once-only ------------------ - - You can teach GRUB to boot an entry only at next boot time. Suppose -that your have an old kernel `old_kernel' and a new kernel -`new_kernel'. You know that `old_kernel' can boot your system -correctly, and you want to test `new_kernel'. - - To ensure that your system will go back to the old kernel even if the -new kernel fails (e.g. it panics), you can specify that GRUB should try -the new kernel only once and boot the old kernel after that. - - First, modify your configuration file. Here is an example: - - default saved # This is important!!! - timeout 10 - - title the old kernel - root (hd0,0) - kernel /old_kernel - savedefault - - title the new kernel - root (hd0,0) - kernel /new_kernel - savedefault 0 # This is important!!! - - Note that this configuration file uses `default saved' (*note -default::) at the head and `savedefault 0' (*note savedefault::) in the -entry for the new kernel. This means that GRUB boots a saved entry by -default, and booting the entry for the new kernel saves `0' as the -saved entry. - - With this configuration file, after all, GRUB always tries to boot -the old kernel after it booted the new one, because `0' is the entry of -`the old kernel'. - - The next step is to tell GRUB to boot the new kernel at next boot -time. For this, execute `grub-set-default' (*note Invoking -grub-set-default::): - - # grub-set-default 1 - - This command sets the saved entry to `1', that is, to the new kernel. - - This method is useful, but still not very robust, because GRUB stops -booting, if there is any error in the boot entry, such that the new -kernel has an invalid executable format. Thus, it it even better to use -the "fallback" mechanism of GRUB. Look at next subsection for this -feature. - - -File: grub.info, Node: Booting fallback systems, Prev: Booting once-only, Up: Making your system robust - -Booting fallback systems ------------------------- - - GRUB supports a fallback mechanism of booting one or more other -entries if a default boot entry fails. You can specify multiple -fallback entries if you wish. - - Suppose that you have three systems, `A', `B' and `C'. `A' is a -system which you want to boot by default. `B' is a backup system which -is supposed to boot safely. `C' is another backup system which is used -in case where `B' is broken. - - Then you may want GRUB to boot the first system which is bootable -among `A', `B' and `C'. A configuration file can be written in this way: - - default saved # This is important!!! - timeout 10 - fallback 1 2 # This is important!!! - - title A - root (hd0,0) - kernel /kernel - savedefault fallback # This is important!!! - - title B - root (hd1,0) - kernel /kernel - savedefault fallback # This is important!!! - - title C - root (hd2,0) - kernel /kernel - savedefault - - Note that `default saved' (*note default::), `fallback 1 2' and -`savedefault fallback' are used. GRUB will boot a saved entry by -default and save a fallback entry as next boot entry with this -configuration. - - When GRUB tries to boot `A', GRUB saves `1' as next boot entry, -because the command `fallback' specifies that `1' is the first fallback -entry. The entry `1' is `B', so GRUB will try to boot `B' at next boot -time. - - Likewise, when GRUB tries to boot `B', GRUB saves `2' as next boot -entry, because `fallback' specifies `2' as next fallback entry. This -makes sure that GRUB will boot `C' after booting `B'. - - It is noteworthy that GRUB uses fallback entries both when GRUB -itself fails in booting an entry and when `A' or `B' fails in starting -up your system. So this solution ensures that your system is started -even if GRUB cannot find your kernel or if your kernel panics. - - However, you need to run `grub-set-default' (*note Invoking -grub-set-default::) when `A' starts correctly or you fix `A' after it -crashes, since GRUB always sets next boot entry to a fallback entry. -You should run this command in a startup script such as `rc.local' to -boot `A' by default: - - # grub-set-default 0 - - where `0' is the number of the boot entry for the system `A'. - - If you want to see what is current default entry, you can look at the -file `/boot/grub/default' (or `/grub/default' in some systems). Because -this file is plain-text, you can just `cat' this file. But it is -strongly recommended *not to modify this file directly*, because GRUB -may fail in saving a default entry in this file, if you change this -file in an unintended manner. Therefore, you should use -`grub-set-default' when you need to change the default entry. - - -File: grub.info, Node: Configuration, Next: Network, Prev: Booting, Up: Top - -Configuration -************* - - You've probably noticed that you need to type several commands to -boot your OS. There's a solution to that - GRUB provides a menu -interface (*note Menu interface::) from which you can select an item -(using arrow keys) that will do everything to boot an OS. - - To enable the menu, you need a configuration file, `menu.lst' under -the boot directory. We'll analyze an example file. - - The file first contains some general settings, the menu interface -related options. You can put these commands (*note Menu-specific -commands::) before any of the items (starting with `title' (*note -title::)). - - # - # Sample boot menu configuration file - # - - As you may have guessed, these lines are comments. Lines starting -with a hash character (`#'), and blank lines, are ignored by GRUB. - - # By default, boot the first entry. - default 0 - - The first entry (here, counting starts with number zero, not one!) -will be the default choice. - - # Boot automatically after 30 secs. - timeout 30 - - As the comment says, GRUB will boot automatically in 30 seconds, -unless interrupted with a keypress. - - # Fallback to the second entry. - fallback 1 - - If, for any reason, the default entry doesn't work, fall back to the -second one (this is rarely used, for obvious reasons). - - Note that the complete descriptions of these commands, which are menu -interface specific, can be found in *Note Menu-specific commands::. -Other descriptions can be found in *Note Commands::. - - Now, on to the actual OS definitions. You will see that each entry -begins with a special command, `title' (*note title::), and the action -is described after it. Note that there is no command `boot' (*note -boot::) at the end of each item. That is because GRUB automatically -executes `boot' if it loads other commands successfully. - - The argument for the command `title' is used to display a short -title/description of the entry in the menu. Since `title' displays the -argument as is, you can write basically anything there. - - # For booting GNU/Hurd - title GNU/Hurd - root (hd0,0) - kernel /boot/gnumach.gz root=hd0s1 - module /boot/serverboot.gz - - This boots GNU/Hurd from the first hard disk. - - # For booting GNU/Linux - title GNU/Linux - kernel (hd1,0)/vmlinuz root=/dev/hdb1 - - This boots GNU/Linux, but from the second hard disk. - - # For booting Mach (getting kernel from floppy) - title Utah Mach4 multiboot - root (hd0,2) - pause Insert the diskette now^G!! - kernel (fd0)/boot/kernel root=hd0s3 - module (fd0)/boot/bootstrap - - This boots Mach with a kernel on a floppy, but the root filesystem at -hd0s3. It also contains a `pause' line (*note pause::), which will -cause GRUB to display a prompt and delay, before actually executing the -rest of the commands and booting. - - # For booting FreeBSD - title FreeBSD - root (hd0,2,a) - kernel /boot/loader - - This item will boot FreeBSD kernel loaded from the `a' partition of -the third PC slice of the first hard disk. - - # For booting OS/2 - title OS/2 - root (hd0,1) - makeactive - # chainload OS/2 bootloader from the first sector - chainloader +1 - # This is similar to "chainload", but loads a specific file - #chainloader /boot/chain.os2 - - This will boot OS/2, using a chain-loader (*note Chain-loading::). - - # For booting Windows NT or Windows95 - title Windows NT / Windows 95 boot menu - root (hd0,0) - makeactive - chainloader +1 - # For loading DOS if Windows NT is installed - # chainload /bootsect.dos - - The same as the above, but for Windows. - - # For installing GRUB into the hard disk - title Install GRUB into the hard disk - root (hd0,0) - setup (hd0) - - This will just (re)install GRUB onto the hard disk. - - # Change the colors. - title Change the colors - color light-green/brown blink-red/blue - - In the last entry, the command `color' is used (*note color::), to -change the menu colors (try it!). This command is somewhat special, -because it can be used both in the command-line and in the menu. GRUB -has several such commands, see *Note General commands::. - - We hope that you now understand how to use the basic features of -GRUB. To learn more about GRUB, see the following chapters. - - -File: grub.info, Node: Network, Next: Serial terminal, Prev: Configuration, Up: Top - -Downloading OS images from a network -************************************ - - Although GRUB is a disk-based boot loader, it does provide network -support. To use the network support, you need to enable at least one -network driver in the GRUB build process. For more information please -see `netboot/README.netboot' in the source distribution. - -* Menu: - -* General usage of network support:: -* Diskless:: - - -File: grub.info, Node: General usage of network support, Next: Diskless, Up: Network - -How to set up your network -========================== - - GRUB requires a file server and optionally a server that will assign -an IP address to the machine on which GRUB is running. For the former, -only TFTP is supported at the moment. The latter is either BOOTP, DHCP -or a RARP server(1) (*note General usage of network -support-Footnote-1::). It is not necessary to run both the servers on -one computer. How to configure these servers is beyond the scope of this -document, so please refer to the manuals specific to those -protocols/servers. - - If you decided to use a server to assign an IP address, set up the -server and run `bootp' (*note bootp::), `dhcp' (*note dhcp::) or `rarp' -(*note rarp::) for BOOTP, DHCP or RARP, respectively. Each command will -show an assigned IP address, a netmask, an IP address for your TFTP -server and a gateway. If any of the addresses is wrong or it causes an -error, probably the configuration of your servers isn't set up properly. - - Otherwise, run `ifconfig', like this: - - grub> ifconfig --address=192.168.110.23 --server=192.168.110.14 - - You can also use `ifconfig' in conjuction with `bootp', `dhcp' or -`rarp' (e.g. to reassign the server address manually). *Note -ifconfig::, for more details. - - Finally, download your OS images from your network. The network can -be accessed using the network drive `(nd)'. Everything else is very -similar to the normal instructions (*note Booting::). - - Here is an example: - - grub> bootp - Probing... [NE*000] - NE2000 base ... - Address: 192.168.110.23 Netmask: 255.255.255.0 - Server: 192.168.110.14 Gateway: 192.168.110.1 - - grub> root (nd) - grub> kernel /tftproot/gnumach.gz root=sd0s1 - grub> module /tftproot/serverboot.gz - grub> boot - - -File: grub.info, Node: General usage of network support-Footnotes, Up: General usage of network support - - (1) RARP is not advised, since it cannot serve much information - diff --git a/usr/src/grub/grub-0.95/docs/grub.info-2 b/usr/src/grub/grub-0.95/docs/grub.info-2 deleted file mode 100644 index d6262affb1..0000000000 --- a/usr/src/grub/grub-0.95/docs/grub.info-2 +++ /dev/null @@ -1,1436 +0,0 @@ -This is grub.info, produced by makeinfo version 4.0 from grub.texi. - -INFO-DIR-SECTION Kernel -START-INFO-DIR-ENTRY -* GRUB: (grub). The GRand Unified Bootloader -* grub-install: (grub)Invoking grub-install. Install GRUB on your drive -* grub-md5-crypt: (grub)Invoking grub-md5-crypt. Encrypt a password - in MD5 format -* grub-terminfo: (grub)Invoking grub-terminfo. Generate a terminfo - command from a - terminfo name -* grub-set-default: (grub)Invoking grub-set-default. Set a default boot - entry -* mbchk: (grub)Invoking mbchk. Check for the format of a Multiboot kernel -END-INFO-DIR-ENTRY - - Copyright (C) 1999,2000,2001,2002,2004 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: grub.info, Node: Diskless, Prev: General usage of network support, Up: Network - -Booting from a network -====================== - - It is sometimes very useful to boot from a network, especially when -you use a machine which has no local disk. In this case, you need to -obtain a kind of Net Boot ROM, such as a PXE ROM or a free software -package like Etherboot. Such a Boot ROM first boots the machine, sets -up the network card installed into the machine, and downloads a second -stage boot image from the network. Then, the second image will try to -boot an operating system actually from the network. - - GRUB provides two second stage images, `nbgrub' and `pxegrub' (*note -Images::). These images are the same as the normal Stage 2, except that -they set up a network automatically, and try to load a configuration -file from the network, if specified. The usage is very simple: If the -machine has a PXE ROM, use `pxegrub'. If the machine has an NBI loader -such as Etherboot, use `nbgrub'. There is no difference between them -except their formats. Since the way to load a second stage image you -want to use should be described in the manual on your Net Boot ROM, -please refer to the manual, for more information. - - However, there is one thing specific to GRUB. Namely, how to specify -a configuration file in a BOOTP/DHCP server. For now, GRUB uses the tag -`150', to get the name of a configuration file. The following is an -example with a BOOTP configuration: - - .allhost:hd=/tmp:bf=null:\ - :ds=145.71.35.1 145.71.32.1:\ - :sm=255.255.254.0:\ - :gw=145.71.35.1:\ - :sa=145.71.35.5: - - foo:ht=1:ha=63655d0334a7:ip=145.71.35.127:\ - :bf=/nbgrub:\ - :tc=.allhost:\ - :T150="(nd)/tftpboot/menu.lst.foo": - - Note that you should specify the drive name `(nd)' in the name of -the configuration file. This is because you might change the root drive -before downloading the configuration from the TFTP server when the -preset menu feature is used (*note Preset Menu::). - - See the manual of your BOOTP/DHCP server for more information. The -exact syntax should differ a little from the example. - - -File: grub.info, Node: Serial terminal, Next: Preset Menu, Prev: Network, Up: Top - -Using GRUB via a serial line -**************************** - - This chapter describes how to use the serial terminal support in -GRUB. - - If you have many computers or computers with no display/keyboard, it -could be very useful to control the computers through serial -communications. To connect one computer with another via a serial line, -you need to prepare a null-modem (cross) serial cable, and you may need -to have multiport serial boards, if your computer doesn't have extra -serial ports. In addition, a terminal emulator is also required, such as -minicom. Refer to a manual of your operating system, for more -information. - - As for GRUB, the instruction to set up a serial terminal is quite -simple. First of all, make sure that you haven't specified the option -`--disable-serial' to the configure script when you built your GRUB -images. If you get them in binary form, probably they have serial -terminal support already. - - Then, initialize your serial terminal after GRUB starts up. Here is -an example: - - grub> serial --unit=0 --speed=9600 - grub> terminal serial - - The command `serial' initializes the serial unit 0 with the speed -9600bps. The serial unit 0 is usually called `COM1', so, if you want to -use COM2, you must specify `--unit=1' instead. This command accepts -many other options, so please refer to *Note serial::, for more details. - - The command `terminal' (*note terminal::) chooses which type of -terminal you want to use. In the case above, the terminal will be a -serial terminal, but you can also pass `console' to the command, as -`terminal serial console'. In this case, a terminal in which you press -any key will be selected as a GRUB terminal. - - However, note that GRUB assumes that your terminal emulator is -compatible with VT100 by default. This is true for most terminal -emulators nowadays, but you should pass the option `--dumb' to the -command if your terminal emulator is not VT100-compatible or implements -few VT100 escape sequences. If you specify this option then GRUB -provides you with an alternative menu interface, because the normal -menu requires several fancy features of your terminal. - - -File: grub.info, Node: Preset Menu, Next: Security, Prev: Serial terminal, Up: Top - -Embedding a configuration file into GRUB -**************************************** - - GRUB supports a "preset menu" which is to be always loaded before -starting. The preset menu feature is useful, for example, when your -computer has no console but a serial cable. In this case, it is -critical to set up the serial terminal as soon as possible, since you -cannot see any message until the serial terminal begins to work. So it -is good to run the commands `serial' (*note serial::) and `terminal' -(*note terminal::) before anything else at the start-up time. - - How the preset menu works is slightly complicated: - - 1. GRUB checks if the preset menu feature is used, and loads the - preset menu, if available. This includes running commands and - reading boot entries, like an ordinary configuration file. - - 2. GRUB checks if the configuration file is available. Note that this - check is performed *regardless of the existence of the preset - menu*. The configuration file is loaded even if the preset menu was - loaded. - - 3. If the preset menu includes any boot entries, they are cleared when - the configuration file is loaded. It doesn't matter whether the - configuration file has any entries or no entry. The boot entries - in the preset menu are used only when GRUB fails in loading the - configuration file. - - To enable the preset menu feature, you must rebuild GRUB specifying a -file to the configure script with the option `--enable-preset-menu'. -The file has the same semantics as normal configuration files (*note -Configuration::). - - Another point you should take care is that the diskless support -(*note Diskless::) diverts the preset menu. Diskless images embed a -preset menu to execute the command `bootp' (*note bootp::) -automatically, unless you specify your own preset menu to the configure -script. This means that you must put commands to initialize a network in -the preset menu yourself, because diskless images don't set it up -implicitly, when you use the preset menu explicitly. - - Therefore, a typical preset menu used with diskless support would be -like this: - - # Set up the serial terminal, first of all. - serial --unit=0 --speed=19200 - terminal --timeout=0 serial - - # Initialize the network. - dhcp - - -File: grub.info, Node: Security, Next: Images, Prev: Preset Menu, Up: Top - -Protecting your computer from cracking -************************************** - - You may be interested in how to prevent ordinary users from doing -whatever they like, if you share your computer with other people. So -this chapter describes how to improve the security of GRUB. - - One thing which could be a security hole is that the user can do too -many things with GRUB, because GRUB allows one to modify its -configuration and run arbitrary commands at run-time. For example, the -user can even read `/etc/passwd' in the command-line interface by the -command `cat' (*note cat::). So it is necessary to disable all the -interactive operations. - - Thus, GRUB provides a "password" feature, so that only administrators -can start the interactive operations (i.e. editing menu entries and -entering the command-line interface). To use this feature, you need to -run the command `password' in your configuration file (*note -password::), like this: - - password --md5 PASSWORD - - If this is specified, GRUB disallows any interactive control, until -you press the key

and enter a correct password. The option `--md5' -tells GRUB that `PASSWORD' is in MD5 format. If it is omitted, GRUB -assumes the `PASSWORD' is in clear text. - - You can encrypt your password with the command `md5crypt' (*note -md5crypt::). For example, run the grub shell (*note Invoking the grub -shell::), and enter your password: - - grub> md5crypt - Password: ********** - Encrypted: $1$U$JK7xFegdxWH6VuppCUSIb. - - Then, cut and paste the encrypted password to your configuration -file. - - Also, you can specify an optional argument to `password'. See this -example: - - password PASSWORD /boot/grub/menu-admin.lst - - In this case, GRUB will load `/boot/grub/menu-admin.lst' as a -configuration file when you enter the valid password. - - Another thing which may be dangerous is that any user can choose any -menu entry. Usually, this wouldn't be problematic, but you might want to -permit only administrators to run some of your menu entries, such as an -entry for booting an insecure OS like DOS. - - GRUB provides the command `lock' (*note lock::). This command always -fails until you enter the valid password, so you can use it, like this: - - title Boot DOS - lock - rootnoverify (hd0,1) - makeactive - chainload +1 - - You should insert `lock' right after `title', because any user can -execute commands in an entry until GRUB encounters `lock'. - - You can also use the command `password' instead of `lock'. In this -case the boot process will ask for the password and stop if it was -entered incorrectly. Since the `password' takes its own PASSWORD -argument this is useful if you want different passwords for different -entries. - - -File: grub.info, Node: Images, Next: Filesystem, Prev: Security, Up: Top - -GRUB image files -**************** - - GRUB consists of several images: two essential stages, optional -stages called "Stage 1.5", one image for bootable CD-ROM, and two -network boot images. Here is a short overview of them. *Note -Internals::, for more details. - -`stage1' - This is an essential image used for booting up GRUB. Usually, this - is embedded in an MBR or the boot sector of a partition. Because a - PC boot sector is 512 bytes, the size of this image is exactly 512 - bytes. - - All `stage1' must do is to load Stage 2 or Stage 1.5 from a local - disk. Because of the size restriction, `stage1' encodes the - location of Stage 2 (or Stage 1.5) in a block list format, so it - never understand any filesystem structure. - -`stage2' - This is the core image of GRUB. It does everything but booting up - itself. Usually, this is put in a filesystem, but that is not - required. - -`e2fs_stage1_5' -`fat_stage1_5' -`ffs_stage1_5' -`jfs_stage1_5' -`minix_stage1_5' -`reiserfs_stage1_5' -`vstafs_stage1_5' -`xfs_stage1_5' - These are called "Stage 1.5", because they serve as a bridge - between `stage1' and `stage2', that is to say, Stage 1.5 is loaded - by Stage 1 and Stage 1.5 loads Stage 2. The difference between - `stage1' and `*_stage1_5' is that the former doesn't understand - any filesystem while the latter understands one filesystem (e.g. - `e2fs_stage1_5' understands ext2fs). So you can move the Stage 2 - image to another location safely, even after GRUB has been - installed. - - While Stage 2 cannot generally be embedded in a fixed area as the - size is so large, Stage 1.5 can be installed into the area right - after an MBR, or the boot loader area of a ReiserFS or a FFS. - -`stage2_eltorito' - This is a boot image for CD-ROMs using the "no emulation mode" in - El Torito specification. This is identical to Stage 2, except that - this boots up without Stage 1 and sets up a special drive `(cd)'. - -`nbgrub' - This is a network boot image for the Network Image Proposal used - by some network boot loaders, such as Etherboot. This is mostly - the same as Stage 2, but it also sets up a network and loads a - configuration file from the network. - -`pxegrub' - This is another network boot image for the Preboot Execution - Environment used by several Netboot ROMs. This is identical to - `nbgrub', except for the format. - - -File: grub.info, Node: Filesystem, Next: Interface, Prev: Images, Up: Top - -Filesystem syntax and semantics -******************************* - - GRUB uses a special syntax for specifying disk drives which can be -accessed by BIOS. Because of BIOS limitations, GRUB cannot distinguish -between IDE, ESDI, SCSI, or others. You must know yourself which BIOS -device is equivalent to which OS device. Normally, that will be clear if -you see the files in a device or use the command `find' (*note find::). - -* Menu: - -* Device syntax:: How to specify devices -* File name syntax:: How to specify files -* Block list syntax:: How to specify block lists - - -File: grub.info, Node: Device syntax, Next: File name syntax, Up: Filesystem - -How to specify devices -====================== - - The device syntax is like this: - - `(DEVICE[,PART-NUM][,BSD-SUBPART-LETTER])' - - `[]' means the parameter is optional. DEVICE should be either `fd' -or `hd' followed by a digit, like `fd0'. But you can also set DEVICE -to a hexadecimal or a decimal number which is a BIOS drive number, so -the following are equivalent: - - (hd0) - (0x80) - (128) - - PART-NUM represents the partition number of DEVICE, starting from -zero for primary partitions and from four for extended partitions, and -BSD-SUBPART-LETTER represents the BSD disklabel subpartition, such as -`a' or `e'. - - A shortcut for specifying BSD subpartitions is -`(DEVICE,BSD-SUBPART-LETTER)', in this case, GRUB searches for the -first PC partition containing a BSD disklabel, then finds the -subpartition BSD-SUBPART-LETTER. Here is an example: - - (hd0,a) - - The syntax `(hd0)' represents using the entire disk (or the MBR when -installing GRUB), while the syntax `(hd0,0)' represents using the first -partition of the disk (or the boot sector of the partition when -installing GRUB). - - If you enabled the network support, the special drive, `(nd)', is -also available. Before using the network drive, you must initialize the -network. *Note Network::, for more information. - - If you boot GRUB from a CD-ROM, `(cd)' is available. *Note Making a -GRUB bootable CD-ROM::, for details. - - -File: grub.info, Node: File name syntax, Next: Block list syntax, Prev: Device syntax, Up: Filesystem - -How to specify files -==================== - - There are two ways to specify files, by "absolute file name" and by -"block list". - - An absolute file name resembles a Unix absolute file name, using `/' -for the directory separator (not `\' as in DOS). One example is -`(hd0,0)/boot/grub/menu.lst'. This means the file `/boot/grub/menu.lst' -in the first partition of the first hard disk. If you omit the device -name in an absolute file name, GRUB uses GRUB's "root device" -implicitly. So if you set the root device to, say, `(hd1,0)' by the -command `root' (*note root::), then `/boot/kernel' is the same as -`(hd1,0)/boot/kernel'. - - -File: grub.info, Node: Block list syntax, Prev: File name syntax, Up: Filesystem - -How to specify block lists -========================== - - A block list is used for specifying a file that doesn't appear in the -filesystem, like a chainloader. The syntax is -`[OFFSET]+LENGTH[,[OFFSET]+LENGTH]...'. Here is an example: - - `0+100,200+1,300+300' - - This represents that GRUB should read blocks 0 through 99, block 200, -and blocks 300 through 599. If you omit an offset, then GRUB assumes -the offset is zero. - - Like the file name syntax (*note File name syntax::), if a blocklist -does not contain a device name, then GRUB uses GRUB's "root device". So -`(hd0,1)+1' is the same as `+1' when the root device is `(hd0,1)'. - - -File: grub.info, Node: Interface, Next: Commands, Prev: Filesystem, Up: Top - -GRUB's user interface -********************* - - GRUB has both a simple menu interface for choosing preset entries -from a configuration file, and a highly flexible command-line for -performing any desired combination of boot commands. - - GRUB looks for its configuration file as soon as it is loaded. If one -is found, then the full menu interface is activated using whatever -entries were found in the file. If you choose the "command-line" menu -option, or if the configuration file was not found, then GRUB drops to -the command-line interface. - -* Menu: - -* Command-line interface:: The flexible command-line interface -* Menu interface:: The simple menu interface -* Menu entry editor:: Editing a menu entry -* Hidden menu interface:: The hidden menu interface - - -File: grub.info, Node: Command-line interface, Next: Menu interface, Up: Interface - -The flexible command-line interface -=================================== - - The command-line interface provides a prompt and after it an editable -text area much like a command-line in Unix or DOS. Each command is -immediately executed after it is entered(1) (*note Command-line -interface-Footnote-1::). The commands (*note Command-line and menu -entry commands::) are a subset of those available in the configuration -file, used with exactly the same syntax. - - Cursor movement and editing of the text on the line can be done via a -subset of the functions available in the Bash shell: - - - - Move forward one character. - - - - Move back one character. - - - - Move to the start of the line. - - - - Move the the end of the line. - - - - Delete the character underneath the cursor. - - - - Delete the character to the left of the cursor. - - - Kill the text from the current cursor position to the end of the - line. - - - Kill backward from the cursor to the beginning of the line. - - - Yank the killed text back into the buffer at the cursor. - - - - Move up through the history list. - - - - Move down through the history list. - - When typing commands interactively, if the cursor is within or before -the first word in the command-line, pressing the key (or ) -will display a listing of the available commands, and if the cursor is -after the first word, the `' will provide a completion listing of -disks, partitions, and file names depending on the context. Note that -to obtain a list of drives, one must open a parenthesis, as `root ('. - - Note that you cannot use the completion functionality in the TFTP -filesystem. This is because TFTP doesn't support file name listing for -the security. - - -File: grub.info, Node: Command-line interface-Footnotes, Up: Command-line interface - - (1) However, this behavior will be changed in the future version, in -a user-invisible way. - - -File: grub.info, Node: Menu interface, Next: Menu entry editor, Prev: Command-line interface, Up: Interface - -The simple menu interface -========================= - - The menu interface is quite easy to use. Its commands are both -reasonably intuitive and described on screen. - - Basically, the menu interface provides a list of "boot entries" to -the user to choose from. Use the arrow keys to select the entry of -choice, then press to run it. An optional timeout is available -to boot the default entry (the first one if not set), which is aborted -by pressing any key. - - Commands are available to enter a bare command-line by pressing -(which operates exactly like the non-config-file version of GRUB, but -allows one to return to the menu if desired by pressing ) or to -edit any of the "boot entries" by pressing . - - If you protect the menu interface with a password (*note Security::), -all you can do is choose an entry by pressing , or press

to -enter the password. - - -File: grub.info, Node: Menu entry editor, Next: Hidden menu interface, Prev: Menu interface, Up: Interface - -Editing a menu entry -==================== - - The menu entry editor looks much like the main menu interface, but -the lines in the menu are individual commands in the selected entry -instead of entry names. - - If an is pressed in the editor, it aborts all the changes made -to the configuration entry and returns to the main menu interface. - - When a particular line is selected, the editor places the user in a -special version of the GRUB command-line to edit that line. When the -user hits , GRUB replaces the line in question in the boot entry -with the changes (unless it was aborted via , in which case the -changes are thrown away). - - If you want to add a new line to the menu entry, press if adding -a line after the current line or press if before the current line. - - To delete a line, hit the key . Although GRUB unfortunately does -not support "undo", you can do almost the same thing by just returning -to the main menu. - - -File: grub.info, Node: Hidden menu interface, Prev: Menu entry editor, Up: Interface - -The hidden menu interface -========================= - - When your terminal is dumb or you request GRUB to hide the menu -interface explicitly with the command `hiddenmenu' (*note -hiddenmenu::), GRUB doesn't show the menu interface (*note Menu -interface::) and automatically boots the default entry, unless -interrupted by pressing . - - When you interrupt the timeout and your terminal is dumb, GRUB falls -back to the command-line interface (*note Command-line interface::). - - -File: grub.info, Node: Commands, Next: Troubleshooting, Prev: Interface, Up: Top - -The list of available commands -****************************** - - In this chapter, we list all commands that are available in GRUB. - - Commands belong to different groups. A few can only be used in the -global section of the configuration file (or "menu"); most of them can -be entered on the command-line and can be used either anywhere in the -menu or specifically in the menu entries. - -* Menu: - -* Menu-specific commands:: -* General commands:: -* Command-line and menu entry commands:: - - -File: grub.info, Node: Menu-specific commands, Next: General commands, Up: Commands - -The list of commands for the menu only -====================================== - - The semantics used in parsing the configuration file are the -following: - - * The menu-specific commands have to be used before any others. - - * The files _must_ be in plain-text format. - - * `#' at the beginning of a line in a configuration file means it is - only a comment. - - * Options are separated by spaces. - - * All numbers can be either decimal or hexadecimal. A hexadecimal - number must be preceded by `0x', and is case-insensitive. - - * Extra options or text at the end of the line are ignored unless - otherwise specified. - - * Unrecognized commands are added to the current entry, except - before entries start, where they are ignored. - - These commands can only be used in the menu: - -* Menu: - -* default:: Set the default entry -* fallback:: Set the fallback entry -* hiddenmenu:: Hide the menu interface -* timeout:: Set the timeout -* title:: Start a menu entry - - -File: grub.info, Node: default, Next: fallback, Up: Menu-specific commands - -default -------- - - - Command: default num - Set the default entry to the entry number NUM. Numbering starts - from 0, and the entry number 0 is the default if the command is not - used. - - You can specify `saved' instead of a number. In this case, the - default entry is the entry saved with the command `savedefault'. - *Note savedefault::, for more information. - - -File: grub.info, Node: fallback, Next: hiddenmenu, Prev: default, Up: Menu-specific commands - -fallback --------- - - - Command: fallback num... - Go into unattended boot mode: if the default boot entry has any - errors, instead of waiting for the user to do something, - immediately start over using the NUM entry (same numbering as the - `default' command (*note default::)). This obviously won't help if - the machine was rebooted by a kernel that GRUB loaded. You can - specify multiple fallback entry numbers. - - -File: grub.info, Node: hiddenmenu, Next: timeout, Prev: fallback, Up: Menu-specific commands - -hiddenmenu ----------- - - - Command: hiddenmenu - Don't display the menu. If the command is used, no menu will be - displayed on the control terminal, and the default entry will be - booted after the timeout expired. The user can still request the - menu to be displayed by pressing before the timeout expires. - See also *Note Hidden menu interface::. - - -File: grub.info, Node: timeout, Next: title, Prev: hiddenmenu, Up: Menu-specific commands - -timeout -------- - - - Command: timeout sec - Set a timeout, in SEC seconds, before automatically booting the - default entry (normally the first entry defined). - - -File: grub.info, Node: title, Prev: timeout, Up: Menu-specific commands - -title ------ - - - Command: title name ... - Start a new boot entry, and set its name to the contents of the - rest of the line, starting with the first non-space character. - - -File: grub.info, Node: General commands, Next: Command-line and menu entry commands, Prev: Menu-specific commands, Up: Commands - -The list of general commands -============================ - - Commands usable anywhere in the menu and in the command-line. - -* Menu: - -* bootp:: Initialize a network device via BOOTP -* color:: Color the menu interface -* device:: Specify a file as a drive -* dhcp:: Initialize a network device via DHCP -* hide:: Hide a partition -* ifconfig:: Configure a network device manually -* pager:: Change the state of the internal pager -* partnew:: Make a primary partition -* parttype:: Change the type of a partition -* password:: Set a password for the menu interface -* rarp:: Initialize a network device via RARP -* serial:: Set up a serial device -* setkey:: Configure the key map -* terminal:: Choose a terminal -* terminfo:: Define escape sequences for a terminal -* tftpserver:: Specify a TFTP server -* unhide:: Unhide a partition - - -File: grub.info, Node: bootp, Next: color, Up: General commands - -bootp ------ - - - Command: bootp [`--with-configfile'] - Initialize a network device via the "BOOTP" protocol. This command - is only available if GRUB is compiled with netboot support. See - also *Note Network::. - - If you specify `--with-configfile' to this command, GRUB will - fetch and load a configuration file specified by your BOOTP server - with the vendor tag `150'. - - -File: grub.info, Node: color, Next: device, Prev: bootp, Up: General commands - -color ------ - - - Command: color normal [highlight] - Change the menu colors. The color NORMAL is used for most lines in - the menu (*note Menu interface::), and the color HIGHLIGHT is used - to highlight the line where the cursor points. If you omit - HIGHLIGHT, then the inverted color of NORMAL is used for the - highlighted line. The format of a color is - `FOREGROUND/BACKGROUND'. FOREGROUND and BACKGROUND are symbolic - color names. A symbolic color name must be one of these: - - * black - - * blue - - * green - - * cyan - - * red - - * magenta - - * brown - - * light-gray - - *These below can be specified only for the foreground.* - - * dark-gray - - * light-blue - - * light-green - - * light-cyan - - * light-red - - * light-magenta - - * yellow - - * white - - But only the first eight names can be used for BACKGROUND. You can - prefix `blink-' to FOREGROUND if you want a blinking foreground - color. - - This command can be used in the configuration file and on the - command line, so you may write something like this in your - configuration file: - - # Set default colors. - color light-gray/blue black/light-gray - - # Change the colors. - title OS-BS like - color magenta/blue black/magenta - - -File: grub.info, Node: device, Next: dhcp, Prev: color, Up: General commands - -device ------- - - - Command: device drive file - In the grub shell, specify the file FILE as the actual drive for a - BIOS drive DRIVE. You can use this command to create a disk image, - and/or to fix the drives guessed by GRUB when GRUB fails to - determine them correctly, like this: - - grub> device (fd0) /floppy-image - grub> device (hd0) /dev/sd0 - - This command can be used only in the grub shell (*note Invoking - the grub shell::). - - -File: grub.info, Node: dhcp, Next: hide, Prev: device, Up: General commands - -dhcp ----- - - - Command: dhcp [--with-configfile] - Initialize a network device via the "DHCP" protocol. Currently, - this command is just an alias for `bootp', since the two protocols - are very similar. This command is only available if GRUB is - compiled with netboot support. See also *Note Network::. - - If you specify `--with-configfile' to this command, GRUB will - fetch and load a configuration file specified by your DHCP server - with the vendor tag `150'. - - -File: grub.info, Node: hide, Next: ifconfig, Prev: dhcp, Up: General commands - -hide ----- - - - Command: hide partition - Hide the partition PARTITION by setting the "hidden" bit in its - partition type code. This is useful only when booting DOS or - Windows and multiple primary FAT partitions exist in one disk. See - also *Note DOS/Windows::. - - -File: grub.info, Node: ifconfig, Next: pager, Prev: hide, Up: General commands - -ifconfig --------- - - - Command: ifconfig [`--server=server'] [`--gateway=gateway'] - [`--mask=mask'] [`--address=address'] - Configure the IP address, the netmask, the gateway, and the server - address of a network device manually. The values must be in dotted - decimal format, like `192.168.11.178'. The order of the options is - not important. This command shows current network configuration, - if no option is specified. See also *Note Network::. - - -File: grub.info, Node: pager, Next: partnew, Prev: ifconfig, Up: General commands - -pager ------ - - - Command: pager [flag] - Toggle or set the state of the internal pager. If FLAG is `on', - the internal pager is enabled. If FLAG is `off', it is disabled. - If no argument is given, the state is toggled. - - -File: grub.info, Node: partnew, Next: parttype, Prev: pager, Up: General commands - -partnew -------- - - - Command: partnew part type from len - Create a new primary partition. PART is a partition specification - in GRUB syntax (*note Naming convention::); TYPE is the partition - type and must be a number in the range `0-0xff'; FROM is the - starting address and LEN is the length, both in sector units. - - -File: grub.info, Node: parttype, Next: password, Prev: partnew, Up: General commands - -parttype --------- - - - Command: parttype part type - Change the type of an existing partition. PART is a partition - specification in GRUB syntax (*note Naming convention::); TYPE is - the new partition type and must be a number in the range 0-0xff. - - -File: grub.info, Node: password, Next: rarp, Prev: parttype, Up: General commands - -password --------- - - - Command: password [`--md5'] passwd [new-config-file] - If used in the first section of a menu file, disable all - interactive editing control (menu entry editor and command-line) - and entries protected by the command `lock'. If the password - PASSWD is entered, it loads the NEW-CONFIG-FILE as a new config - file and restarts the GRUB Stage 2, if NEW-CONFIG-FILE is - specified. Otherwise, GRUB will just unlock the privileged - instructions. You can also use this command in the script - section, in which case it will ask for the password, before - continuing. The option `--md5' tells GRUB that PASSWD is - encrypted with `md5crypt' (*note md5crypt::). - - -File: grub.info, Node: rarp, Next: serial, Prev: password, Up: General commands - -rarp ----- - - - Command: rarp - Initialize a network device via the "RARP" protocol. This command - is only available if GRUB is compiled with netboot support. See - also *Note Network::. - - -File: grub.info, Node: serial, Next: setkey, Prev: rarp, Up: General commands - -serial ------- - - - Command: serial [`--unit=unit'] [`--port=port'] [`--speed=speed'] - [`--word=word'] [`--parity=parity'] [`--stop=stop'] - [`--device=dev'] - Initialize a serial device. UNIT is a number in the range 0-3 - specifying which serial port to use; default is 0, which - corresponds to the port often called COM1. PORT is the I/O port - where the UART is to be found; if specified it takes precedence - over UNIT. SPEED is the transmission speed; default is 9600. WORD - and STOP are the number of data bits and stop bits. Data bits must - be in the range 5-8 and stop bits must be 1 or 2. Default is 8 data - bits and one stop bit. PARITY is one of `no', `odd', `even' and - defaults to `no'. The option `--device' can only be used in the - grub shell and is used to specify the tty device to be used in the - host operating system (*note Invoking the grub shell::). - - The serial port is not used as a communication channel unless the - `terminal' command is used (*note terminal::). - - This command is only available if GRUB is compiled with serial - support. See also *Note Serial terminal::. - - -File: grub.info, Node: setkey, Next: terminal, Prev: serial, Up: General commands - -setkey ------- - - - Command: setkey [to_key from_key] - Change the keyboard map. The key FROM_KEY is mapped to the key - TO_KEY. If no argument is specified, reset key mappings. Note that - this command _does not_ exchange the keys. If you want to exchange - the keys, run this command again with the arguments exchanged, - like this: - - grub> setkey capslock control - grub> setkey control capslock - - A key must be an alphabet letter, a digit, or one of these symbols: - `escape', `exclam', `at', `numbersign', `dollar', `percent', - `caret', `ampersand', `asterisk', `parenleft', `parenright', - `minus', `underscore', `equal', `plus', `backspace', `tab', - `bracketleft', `braceleft', `bracketright', `braceright', `enter', - `control', `semicolon', `colon', `quote', `doublequote', - `backquote', `tilde', `shift', `backslash', `bar', `comma', - `less', `period', `greater', `slash', `question', `alt', `space', - `capslock', `FX' (`X' is a digit), and `delete'. This table - describes to which character each of the symbols corresponds: - - `exclam' - `!' - - `at' - `@' - - `numbersign' - `#' - - `dollar' - `$' - - `percent' - `%' - - `caret' - `^' - - `ampersand' - `&' - - `asterisk' - `*' - - `parenleft' - `(' - - `parenright' - `)' - - `minus' - `-' - - `underscore' - `_' - - `equal' - `=' - - `plus' - `+' - - `bracketleft' - `[' - - `braceleft' - `{' - - `bracketright' - `]' - - `braceright' - `}' - - `semicolon' - `;' - - `colon' - `:' - - `quote' - `'' - - `doublequote' - `"' - - `backquote' - ``' - - `tilde' - `~' - - `backslash' - `\' - - `bar' - `|' - - `comma' - `,' - - `less' - `<' - - `period' - `.' - - `greater' - `>' - - `slash' - `/' - - `question' - `?' - - `space' - ` ' - - -File: grub.info, Node: terminal, Next: terminfo, Prev: setkey, Up: General commands - -terminal --------- - - - Command: terminal [`--dumb'] [`--no-echo'] [`--no-edit'] - [`--timeout=secs'] [`--lines=lines'] [`--silent'] [`console'] - [`serial'] [`hercules'] - Select a terminal for user interaction. The terminal is assumed to - be VT100-compatible unless `--dumb' is specified. If both - `console' and `serial' are specified, then GRUB will use the one - where a key is entered first or the first when the timeout - expires. If neither are specified, the current setting is - reported. This command is only available if GRUB is compiled with - serial support. See also *Note Serial terminal::. - - This may not make sense for most users, but GRUB supports Hercules - console as well. Hercules console is usable like the ordinary - console, and the usage is quite similar to that for serial - terminals: specify `hercules' as the argument. - - The option `--lines' defines the number of lines in your terminal, - and it is used for the internal pager function. If you don't - specify this option, the number is assumed as 24. - - The option `--silent' suppresses the message to prompt you to hit - any key. This might be useful if your system has no terminal - device. - - The option `--no-echo' has GRUB not to echo back input characters. - This implies the option `--no-edit'. - - The option `--no-edit' disables the BASH-like editing feature. - - -File: grub.info, Node: terminfo, Next: tftpserver, Prev: terminal, Up: General commands - -terminfo --------- - - - Command: terminfo `--name=name' `--cursor-address=seq' - [`--clear-screen=seq'] [`--enter-standout-mode=seq'] - [`--exit-standout-mode=seq'] - Define the capabilities of your terminal. Use this command to - define escape sequences, if it is not vt100-compatible. You may - use `\e' for and `^X' for a control character. - - You can use the utility `grub-terminfo' to generate appropriate - arguments to this command. *Note Invoking grub-terminfo::. - - If no option is specified, the current settings are printed. - - -File: grub.info, Node: tftpserver, Next: unhide, Prev: terminfo, Up: General commands - -tftpserver ----------- - - - Command: tftpserver ipaddr - *Caution:* This command exists only for backward compatibility. - Use `ifconfig' (*note ifconfig::) instead. - - Override a TFTP server address returned by a BOOTP/DHCP/RARP - server. The argument IPADDR must be in dotted decimal format, like - `192.168.0.15'. This command is only available if GRUB is compiled - with netboot support. See also *Note Network::. - - -File: grub.info, Node: unhide, Prev: tftpserver, Up: General commands - -unhide ------- - - - Command: unhide partition - Unhide the partition PARTITION by clearing the "hidden" bit in its - partition type code. This is useful only when booting DOS or - Windows and multiple primary partitions exist on one disk. See also - *Note DOS/Windows::. - - -File: grub.info, Node: Command-line and menu entry commands, Prev: General commands, Up: Commands - -The list of command-line and menu entry commands -================================================ - - These commands are usable in the command-line and in menu entries. -If you forget a command, you can run the command `help' (*note help::). - -* Menu: - -* blocklist:: Get the block list notation of a file -* boot:: Start up your operating system -* cat:: Show the contents of a file -* chainloader:: Chain-load another boot loader -* cmp:: Compare two files -* configfile:: Load a configuration file -* debug:: Toggle the debug flag -* displayapm:: Display APM information -* displaymem:: Display memory configuration -* embed:: Embed Stage 1.5 -* find:: Find a file -* fstest:: Test a filesystem -* geometry:: Manipulate the geometry of a drive -* halt:: Shut down your computer -* help:: Show help messages -* impsprobe:: Probe SMP -* initrd:: Load an initrd -* install:: Install GRUB -* ioprobe:: Probe I/O ports used for a drive -* kernel:: Load a kernel -* lock:: Lock a menu entry -* makeactive:: Make a partition active -* map:: Map a drive to another -* md5crypt:: Encrypt a password in MD5 format -* module:: Load a module -* modulenounzip:: Load a module without decompression -* pause:: Wait for a key press -* quit:: Exit from the grub shell -* reboot:: Reboot your computer -* read:: Read data from memory -* root:: Set GRUB's root device -* rootnoverify:: Set GRUB's root device without mounting -* savedefault:: Save current entry as the default entry -* setup:: Set up GRUB's installation automatically -* testload:: Load a file for testing a filesystem -* testvbe:: Test VESA BIOS EXTENSION -* uppermem:: Set the upper memory size -* vbeprobe:: Probe VESA BIOS EXTENSION - - -File: grub.info, Node: blocklist, Next: boot, Up: Command-line and menu entry commands - -blocklist ---------- - - - Command: blocklist file - Print the block list notation of the file FILE. *Note Block list - syntax::. - - -File: grub.info, Node: boot, Next: cat, Prev: blocklist, Up: Command-line and menu entry commands - -boot ----- - - - Command: boot - Boot the OS or chain-loader which has been loaded. Only necessary - if running the fully interactive command-line (it is implicit at - the end of a menu entry). - - -File: grub.info, Node: cat, Next: chainloader, Prev: boot, Up: Command-line and menu entry commands - -cat ---- - - - Command: cat file - Display the contents of the file FILE. This command may be useful - to remind you of your OS's root partition: - - grub> cat /etc/fstab - - -File: grub.info, Node: chainloader, Next: cmp, Prev: cat, Up: Command-line and menu entry commands - -chainloader ------------ - - - Command: chainloader [`--force'] file - Load FILE as a chain-loader. Like any other file loaded by the - filesystem code, it can use the blocklist notation to grab the - first sector of the current partition with `+1'. If you specify the - option `--force', then load FILE forcibly, whether it has a - correct signature or not. This is required when you want to load a - defective boot loader, such as SCO UnixWare 7.1 (*note SCO - UnixWare::). - - -File: grub.info, Node: cmp, Next: configfile, Prev: chainloader, Up: Command-line and menu entry commands - -cmp ---- - - - Command: cmp file1 file2 - Compare the file FILE1 with the file FILE2. If they differ in - size, print the sizes like this: - - Differ in size: 0x1234 [foo], 0x4321 [bar] - - If the sizes are equal but the bytes at an offset differ, then - print the bytes like this: - - Differ at the offset 777: 0xbe [foo], 0xef [bar] - - If they are completely identical, nothing will be printed. - - -File: grub.info, Node: configfile, Next: debug, Prev: cmp, Up: Command-line and menu entry commands - -configfile ----------- - - - Command: configfile file - Load FILE as a configuration file. - - -File: grub.info, Node: debug, Next: displayapm, Prev: configfile, Up: Command-line and menu entry commands - -debug ------ - - - Command: debug - Toggle debug mode (by default it is off). When debug mode is on, - some extra messages are printed to show disk activity. This global - debug flag is mainly useful for GRUB developers when testing new - code. - - -File: grub.info, Node: displayapm, Next: displaymem, Prev: debug, Up: Command-line and menu entry commands - -displayapm ----------- - - - Command: displayapm - Display APM BIOS information. - - -File: grub.info, Node: displaymem, Next: embed, Prev: displayapm, Up: Command-line and menu entry commands - -displaymem ----------- - - - Command: displaymem - Display what GRUB thinks the system address space map of the - machine is, including all regions of physical RAM installed. GRUB's - "upper/lower memory" display uses the standard BIOS interface for - the available memory in the first megabyte, or "lower memory", and - a synthesized number from various BIOS interfaces of the memory - starting at 1MB and going up to the first chipset hole for "upper - memory" (the standard PC "upper memory" interface is limited to - reporting a maximum of 64MB). - - -File: grub.info, Node: embed, Next: find, Prev: displaymem, Up: Command-line and menu entry commands - -embed ------ - - - Command: embed stage1_5 device - Embed the Stage 1.5 STAGE1_5 in the sectors after the MBR if - DEVICE is a drive, or in the "boot loader" area if DEVICE is a FFS - partition or a ReiserFS partition.(1) (*note embed-Footnote-1::) - Print the number of sectors which STAGE1_5 occupies, if successful. - - Usually, you don't need to run this command directly. *Note - setup::. - - -File: grub.info, Node: embed-Footnotes, Up: embed - - (1) The latter feature has not been implemented yet. - - -File: grub.info, Node: find, Next: fstest, Prev: embed, Up: Command-line and menu entry commands - -find ----- - - - Command: find filename - Search for the file name FILENAME in all mountable partitions and - print the list of the devices which contain the file. The file - name FILENAME should be an absolute file name like - `/boot/grub/stage1'. - - -File: grub.info, Node: fstest, Next: geometry, Prev: find, Up: Command-line and menu entry commands - -fstest ------- - - - Command: fstest - Toggle filesystem test mode. Filesystem test mode, when turned - on, prints out data corresponding to all the device reads and what - values are being sent to the low-level routines. The format is - `' for - high-level reads inside a partition, and `[DISK-OFFSET-SECTOR]' - for low-level sector requests from the disk. Filesystem test mode - is turned off by any use of the `install' (*note install::) or - `testload' (*note testload::) commands. - - -File: grub.info, Node: geometry, Next: halt, Prev: fstest, Up: Command-line and menu entry commands - -geometry --------- - - - Command: geometry drive [cylinder head sector [total_sector]] - Print the information for the drive DRIVE. In the grub shell, you - can set the geometry of the drive arbitrarily. The number of - cylinders, the number of heads, the number of sectors and the - number of total sectors are set to CYLINDER, HEAD, SECTOR and - TOTAL_SECTOR, respectively. If you omit TOTAL_SECTOR, then it will - be calculated based on the C/H/S values automatically. - - -File: grub.info, Node: halt, Next: help, Prev: geometry, Up: Command-line and menu entry commands - -halt ----- - - - Command: halt `--no-apm' - The command halts the computer. If the `--no-apm' option is - specified, no APM BIOS call is performed. Otherwise, the computer - is shut down using APM. - - -File: grub.info, Node: help, Next: impsprobe, Prev: halt, Up: Command-line and menu entry commands - -help ----- - - - Command: help `--all' [pattern ...] - Display helpful information about builtin commands. If you do not - specify PATTERN, this command shows short descriptions of most of - available commands. If you specify the option `--all' to this - command, short descriptions of rarely used commands (such as *Note - testload::) are displayed as well. - - If you specify any PATTERNS, it displays longer information about - each of the commands which match those PATTERNS. - - -File: grub.info, Node: impsprobe, Next: initrd, Prev: help, Up: Command-line and menu entry commands - -impsprobe ---------- - - - Command: impsprobe - Probe the Intel Multiprocessor Specification 1.1 or 1.4 - configuration table and boot the various CPUs which are found into - a tight loop. This command can be used only in the Stage 2, but - not in the grub shell. - - -File: grub.info, Node: initrd, Next: install, Prev: impsprobe, Up: Command-line and menu entry commands - -initrd ------- - - - Command: initrd file ... - Load an initial ramdisk for a Linux format boot image and set the - appropriate parameters in the Linux setup area in memory. See also - *Note GNU/Linux::. - diff --git a/usr/src/grub/grub-0.95/docs/grub.info-3 b/usr/src/grub/grub-0.95/docs/grub.info-3 deleted file mode 100644 index 10e4cad2fe..0000000000 --- a/usr/src/grub/grub-0.95/docs/grub.info-3 +++ /dev/null @@ -1,1366 +0,0 @@ -This is grub.info, produced by makeinfo version 4.0 from grub.texi. - -INFO-DIR-SECTION Kernel -START-INFO-DIR-ENTRY -* GRUB: (grub). The GRand Unified Bootloader -* grub-install: (grub)Invoking grub-install. Install GRUB on your drive -* grub-md5-crypt: (grub)Invoking grub-md5-crypt. Encrypt a password - in MD5 format -* grub-terminfo: (grub)Invoking grub-terminfo. Generate a terminfo - command from a - terminfo name -* grub-set-default: (grub)Invoking grub-set-default. Set a default boot - entry -* mbchk: (grub)Invoking mbchk. Check for the format of a Multiboot kernel -END-INFO-DIR-ENTRY - - Copyright (C) 1999,2000,2001,2002,2004 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: grub.info, Node: install, Next: ioprobe, Prev: initrd, Up: Command-line and menu entry commands - -install -------- - - - Command: install [`--force-lba'] [`--stage2=os_stage2_file'] - stage1_file [`d'] dest_dev stage2_file [addr] [`p'] - [config_file] [real_config_file] - This command is fairly complex, and you should not use this command - unless you are familiar with GRUB. Use `setup' (*note setup::) - instead. - - In short, it will perform a full install presuming the Stage 2 or - Stage 1.5(1) (*note install-Footnote-1::) is in its final install - location. - - In slightly more detail, it will load STAGE1_FILE, validate that - it is a GRUB Stage 1 of the right version number, install in it a - blocklist for loading STAGE2_FILE as a Stage 2. If the option `d' - is present, the Stage 1 will always look for the actual disk - STAGE2_FILE was installed on, rather than using the booting drive. - The Stage 2 will be loaded at address ADDR, which must be `0x8000' - for a true Stage 2, and `0x2000' for a Stage 1.5. If ADDR is not - present, GRUB will determine the address automatically. It then - writes the completed Stage 1 to the first block of the device - DEST_DEV. If the options `p' or CONFIG_FILE are present, then it - reads the first block of stage2, modifies it with the values of - the partition STAGE2_FILE was found on (for `p') or places the - string CONFIG_FILE into the area telling the stage2 where to look - for a configuration file at boot time. Likewise, if - REAL_CONFIG_FILE is present and STAGE2_FILE is a Stage 1.5, then - the Stage 2 CONFIG_FILE is patched with the configuration file - name REAL_CONFIG_FILE. This command preserves the DOS BPB (and for - hard disks, the partition table) of the sector the Stage 1 is to - be installed into. - - *Caution:* Several buggy BIOSes don't pass a booting drive - properly when booting from a hard disk drive. Therefore, you will - unfortunately have to specify the option `d', whether your Stage2 - resides at the booting drive or not, if you have such a BIOS. We - know these are defective in this way: - - - Fujitsu LifeBook 400 BIOS version 31J0103A - - - HP Vectra XU 6/200 BIOS version GG.06.11 - - *Caution2:* A number of BIOSes don't return a correct LBA support - bitmap even if they do have the support. So GRUB provides a - solution to ignore the wrong bitmap, that is, the option - `--force-lba'. Don't use this option if you know that your BIOS - doesn't have LBA support. - - *Caution3:* You must specify the option `--stage2' in the grub - shell, if you cannot unmount the filesystem where your stage2 file - resides. The argument should be the file name in your operating - system. - - -File: grub.info, Node: install-Footnotes, Up: install - - (1) They're loaded the same way, so we will refer to the Stage 1.5 -as a Stage 2 from now on. - - -File: grub.info, Node: ioprobe, Next: kernel, Prev: install, Up: Command-line and menu entry commands - -ioprobe -------- - - - Command: ioprobe drive - Probe I/O ports used for the drive DRIVE. This command will list - the I/O ports on the screen. For technical information, *Note - Internals::. - - -File: grub.info, Node: kernel, Next: lock, Prev: ioprobe, Up: Command-line and menu entry commands - -kernel ------- - - - Command: kernel [`--type=type'] [`--no-mem-option'] file ... - Attempt to load the primary boot image (Multiboot a.out or ELF, - Linux zImage or bzImage, FreeBSD a.out, NetBSD a.out, etc.) from - FILE. The rest of the line is passed verbatim as the "kernel - command-line". Any modules must be reloaded after using this - command. - - This command also accepts the option `--type' so that you can - specify the kernel type of FILE explicitly. The argument TYPE must - be one of these: `netbsd', `freebsd', `openbsd', `linux', - `biglinux', and `multiboot'. However, you need to specify it only - if you want to load a NetBSD ELF kernel, because GRUB can - automatically determine a kernel type in the other cases, quite - safely. - - The option `--no-mem-option' is effective only for Linux. If the - option is specified, GRUB doesn't pass the option `mem=' to the - kernel. This option is implied for Linux kernels 2.4.18 and newer. - - -File: grub.info, Node: lock, Next: makeactive, Prev: kernel, Up: Command-line and menu entry commands - -lock ----- - - - Command: lock - Prevent normal users from executing arbitrary menu entries. You - must use the command `password' if you really want this command to - be useful (*note password::). - - This command is used in a menu, as shown in this example: - - title This entry is too dangerous to be executed by normal users - lock - root (hd0,a) - kernel /no-security-os - - See also *Note Security::. - - -File: grub.info, Node: makeactive, Next: map, Prev: lock, Up: Command-line and menu entry commands - -makeactive ----------- - - - Command: makeactive - Set the active partition on the root disk to GRUB's root device. - This command is limited to _primary_ PC partitions on a hard disk. - - -File: grub.info, Node: map, Next: md5crypt, Prev: makeactive, Up: Command-line and menu entry commands - -map ---- - - - Command: map to_drive from_drive - Map the drive FROM_DRIVE to the drive TO_DRIVE. This is necessary - when you chain-load some operating systems, such as DOS, if such - an OS resides at a non-first drive. Here is an example: - - grub> map (hd0) (hd1) - grub> map (hd1) (hd0) - - The example exchanges the order between the first hard disk and the - second hard disk. See also *Note DOS/Windows::. - - -File: grub.info, Node: md5crypt, Next: module, Prev: map, Up: Command-line and menu entry commands - -md5crypt --------- - - - Command: md5crypt - Prompt to enter a password, and encrypt it in MD5 format. The - encrypted password can be used with the command `password' (*note - password::). See also *Note Security::. - - -File: grub.info, Node: module, Next: modulenounzip, Prev: md5crypt, Up: Command-line and menu entry commands - -module ------- - - - Command: module file ... - Load a boot module FILE for a Multiboot format boot image (no - interpretation of the file contents are made, so the user of this - command must know what the kernel in question expects). The rest - of the line is passed as the "module command-line", like the - `kernel' command. You must load a Multiboot kernel image before - loading any module. See also *Note modulenounzip::. - - -File: grub.info, Node: modulenounzip, Next: pause, Prev: module, Up: Command-line and menu entry commands - -modulenounzip -------------- - - - Command: modulenounzip file ... - The same as `module' (*note module::), except that automatic - decompression is disabled. - - -File: grub.info, Node: pause, Next: quit, Prev: modulenounzip, Up: Command-line and menu entry commands - -pause ------ - - - Command: pause message ... - Print the MESSAGE, then wait until a key is pressed. Note that - placing <^G> (ASCII code 7) in the message will cause the speaker - to emit the standard beep sound, which is useful when prompting - the user to change floppies. - - -File: grub.info, Node: quit, Next: reboot, Prev: pause, Up: Command-line and menu entry commands - -quit ----- - - - Command: quit - Exit from the grub shell `grub' (*note Invoking the grub shell::). - This command can be used only in the grub shell. - - -File: grub.info, Node: reboot, Next: read, Prev: quit, Up: Command-line and menu entry commands - -reboot ------- - - - Command: reboot - Reboot the computer. - - -File: grub.info, Node: read, Next: root, Prev: reboot, Up: Command-line and menu entry commands - -read ----- - - - Command: read addr - Read a 32-bit value from memory at address ADDR and display it in - hex format. - - -File: grub.info, Node: root, Next: rootnoverify, Prev: read, Up: Command-line and menu entry commands - -root ----- - - - Command: root device [hdbias] - Set the current "root device" to the device DEVICE, then attempt - to mount it to get the partition size (for passing the partition - descriptor in `ES:ESI', used by some chain-loaded boot loaders), - the BSD drive-type (for booting BSD kernels using their native - boot format), and correctly determine the PC partition where a BSD - sub-partition is located. The optional HDBIAS parameter is a - number to tell a BSD kernel how many BIOS drive numbers are on - controllers before the current one. For example, if there is an - IDE disk and a SCSI disk, and your FreeBSD root partition is on - the SCSI disk, then use a `1' for HDBIAS. - - See also *Note rootnoverify::. - - -File: grub.info, Node: rootnoverify, Next: savedefault, Prev: root, Up: Command-line and menu entry commands - -rootnoverify ------------- - - - Command: rootnoverify device [hdbias] - Similar to `root' (*note root::), but don't attempt to mount the - partition. This is useful for when an OS is outside of the area of - the disk that GRUB can read, but setting the correct root device - is still desired. Note that the items mentioned in `root' above - which derived from attempting the mount will _not_ work correctly. - - -File: grub.info, Node: savedefault, Next: setup, Prev: rootnoverify, Up: Command-line and menu entry commands - -savedefault ------------ - - - Command: savedefault num - Save the current menu entry or NUM if specified as a default - entry. Here is an example: - - default saved - timeout 10 - - title GNU/Linux - root (hd0,0) - kernel /boot/vmlinuz root=/dev/sda1 vga=ext - initrd /boot/initrd - savedefault - - title FreeBSD - root (hd0,a) - kernel /boot/loader - savedefault - - With this configuration, GRUB will choose the entry booted - previously as the default entry. - - You can specify `fallback' instead of a number. Then, next - fallback entry is saved. Next fallback entry is chosen from - fallback entries. Normally, this will be the first entry in - fallback ones. - - See also *Note default:: and *Note Invoking grub-set-default::. - - -File: grub.info, Node: setup, Next: testload, Prev: savedefault, Up: Command-line and menu entry commands - -setup ------ - - - Command: setup [`--force-lba'] [`--stage2=os_stage2_file'] - [`--prefix=dir'] install_device [image_device] - Set up the installation of GRUB automatically. This command uses - the more flexible command `install' (*note install::) in the - backend and installs GRUB into the device INSTALL_DEVICE. If - IMAGE_DEVICE is specified, then find the GRUB images (*note - Images::) in the device IMAGE_DEVICE, otherwise use the current - "root device", which can be set by the command `root'. If - INSTALL_DEVICE is a hard disk, then embed a Stage 1.5 in the disk - if possible. - - The option `--prefix' specifies the directory under which GRUB - images are put. If it is not specified, GRUB automatically - searches them in `/boot/grub' and `/grub'. - - The options `--force-lba' and `--stage2' are just passed to - `install' if specified. *Note install::, for more information. - - -File: grub.info, Node: testload, Next: testvbe, Prev: setup, Up: Command-line and menu entry commands - -testload --------- - - - Command: testload file - Read the entire contents of FILE in several different ways and - compare them, to test the filesystem code. The output is somewhat - cryptic, but if no errors are reported and the final `i=X, - filepos=Y' reading has X and Y equal, then it is definitely - consistent, and very likely works correctly subject to a - consistent offset error. If this test succeeds, then a good next - step is to try loading a kernel. - - -File: grub.info, Node: testvbe, Next: uppermem, Prev: testload, Up: Command-line and menu entry commands - -testvbe -------- - - - Command: testvbe mode - Test the VESA BIOS EXTENSION mode MODE. This command will switch - your video card to the graphics mode, and show an endless - animation. Hit any key to return. See also *Note vbeprobe::. - - -File: grub.info, Node: uppermem, Next: vbeprobe, Prev: testvbe, Up: Command-line and menu entry commands - -uppermem --------- - - - Command: uppermem kbytes - Force GRUB to assume that only KBYTES kilobytes of upper memory - are installed. Any system address range maps are discarded. - - *Caution:* This should be used with great caution, and should only - be necessary on some old machines. GRUB's BIOS probe can pick up - all RAM on all new machines the author has ever heard of. It can - also be used for debugging purposes to lie to an OS. - - -File: grub.info, Node: vbeprobe, Prev: uppermem, Up: Command-line and menu entry commands - -vbeprobe --------- - - - Command: vbeprobe [mode] - Probe VESA BIOS EXTENSION information. If the mode MODE is - specified, show only the information about MODE. Otherwise, this - command lists up available VBE modes on the screen. See also *Note - testvbe::. - - -File: grub.info, Node: Troubleshooting, Next: Invoking the grub shell, Prev: Commands, Up: Top - -Error messages reported by GRUB -******************************* - - This chapter describes error messages reported by GRUB when you -encounter trouble. *Note Invoking the grub shell::, if your problem is -specific to the grub shell. - -* Menu: - -* Stage1 errors:: Errors reported by the Stage 1 -* Stage1.5 errors:: Errors reported by the Stage 1.5 -* Stage2 errors:: Errors reported by the Stage 2 - - -File: grub.info, Node: Stage1 errors, Next: Stage1.5 errors, Up: Troubleshooting - -Errors reported by the Stage 1 -============================== - - The general way that the Stage 1 handles errors is to print an error -string and then halt. Pressing `--' will reboot. - - The following is a comprehensive list of error messages for the -Stage 1: - -Hard Disk Error - The stage2 or stage1.5 is being read from a hard disk, and the - attempt to determine the size and geometry of the hard disk failed. - -Floppy Error - The stage2 or stage1.5 is being read from a floppy disk, and the - attempt to determine the size and geometry of the floppy disk - failed. It's listed as a separate error since the probe sequence - is different than for hard disks. - -Read Error - A disk read error happened while trying to read the stage2 or - stage1.5. - -Geom Error - The location of the stage2 or stage1.5 is not in the portion of - the disk supported directly by the BIOS read calls. This could - occur because the BIOS translated geometry has been changed by the - user or the disk is moved to another machine or controller after - installation, or GRUB was not installed using itself (if it was, - the Stage 2 version of this error would have been seen during that - process and it would not have completed the install). - - -File: grub.info, Node: Stage1.5 errors, Next: Stage2 errors, Prev: Stage1 errors, Up: Troubleshooting - -Errors reported by the Stage 1.5 -================================ - - The general way that the Stage 1.5 handles errors is to print an -error number in the form `Error NUM' and then halt. Pressing -`--' will reboot. - - The error numbers correspond to the errors reported by Stage 2. -*Note Stage2 errors::. - - -File: grub.info, Node: Stage2 errors, Prev: Stage1.5 errors, Up: Troubleshooting - -Errors reported by the Stage 2 -============================== - - The general way that the Stage 2 handles errors is to abort the -operation in question, print an error string, then (if possible) either -continue based on the fact that an error occurred or wait for the user -to deal with the error. - - The following is a comprehensive list of error messages for the -Stage 2 (error numbers for the Stage 1.5 are listed before the colon in -each description): - -1 : Filename must be either an absolute filename or blocklist - This error is returned if a file name is requested which doesn't - fit the syntax/rules listed in the *Note Filesystem::. - -2 : Bad file or directory type - This error is returned if a file requested is not a regular file, - but something like a symbolic link, directory, or FIFO. - -3 : Bad or corrupt data while decompressing file - This error is returned if the run-length decompression code gets an - internal error. This is usually from a corrupt file. - -4 : Bad or incompatible header in compressed file - This error is returned if the file header for a supposedly - compressed file is bad. - -5 : Partition table invalid or corrupt - This error is returned if the sanity checks on the integrity of the - partition table fail. This is a bad sign. - -6 : Mismatched or corrupt version of stage1/stage2 - This error is returned if the install command points to - incompatible or corrupt versions of the stage1 or stage2. It can't - detect corruption in general, but this is a sanity check on the - version numbers, which should be correct. - -7 : Loading below 1MB is not supported - This error is returned if the lowest address in a kernel is below - the 1MB boundary. The Linux zImage format is a special case and - can be handled since it has a fixed loading address and maximum - size. - -8 : Kernel must be loaded before booting - This error is returned if GRUB is told to execute the boot sequence - without having a kernel to start. - -9 : Unknown boot failure - This error is returned if the boot attempt did not succeed for - reasons which are unknown. - -10 : Unsupported Multiboot features requested - This error is returned when the Multiboot features word in the - Multiboot header requires a feature that is not recognized. The - point of this is that the kernel requires special handling which - GRUB is probably unable to provide. - -11 : Unrecognized device string - This error is returned if a device string was expected, and the - string encountered didn't fit the syntax/rules listed in the *Note - Filesystem::. - -12 : Invalid device requested - This error is returned if a device string is recognizable but does - not fall under the other device errors. - -13 : Invalid or unsupported executable format - This error is returned if the kernel image being loaded is not - recognized as Multiboot or one of the supported native formats - (Linux zImage or bzImage, FreeBSD, or NetBSD). - -14 : Filesystem compatibility error, cannot read whole file - Some of the filesystem reading code in GRUB has limits on the - length of the files it can read. This error is returned when the - user runs into such a limit. - -15 : File not found - This error is returned if the specified file name cannot be found, - but everything else (like the disk/partition info) is OK. - -16 : Inconsistent filesystem structure - This error is returned by the filesystem code to denote an internal - error caused by the sanity checks of the filesystem structure on - disk not matching what it expects. This is usually caused by a - corrupt filesystem or bugs in the code handling it in GRUB. - -17 : Cannot mount selected partition - This error is returned if the partition requested exists, but the - filesystem type cannot be recognized by GRUB. - -18 : Selected cylinder exceeds maximum supported by BIOS - This error is returned when a read is attempted at a linear block - address beyond the end of the BIOS translated area. This generally - happens if your disk is larger than the BIOS can handle (512MB for - (E)IDE disks on older machines or larger than 8GB in general). - -19 : Linux kernel must be loaded before initrd - This error is returned if the initrd command is used before - loading a Linux kernel. - -20 : Multiboot kernel must be loaded before modules - This error is returned if the module load command is used before - loading a Multiboot kernel. It only makes sense in this case - anyway, as GRUB has no idea how to communicate the presence of - such modules to a non-Multiboot-aware kernel. - -21 : Selected disk does not exist - This error is returned if the device part of a device- or full - file name refers to a disk or BIOS device that is not present or - not recognized by the BIOS in the system. - -22 : No such partition - This error is returned if a partition is requested in the device - part of a device- or full file name which isn't on the selected - disk. - -23 : Error while parsing number - This error is returned if GRUB was expecting to read a number and - encountered bad data. - -24 : Attempt to access block outside partition - This error is returned if a linear block address is outside of the - disk partition. This generally happens because of a corrupt - filesystem on the disk or a bug in the code handling it in GRUB - (it's a great debugging tool). - -25 : Disk read error - This error is returned if there is a disk read error when trying to - probe or read data from a particular disk. - -26 : Too many symbolic links - This error is returned if the link count is beyond the maximum - (currently 5), possibly the symbolic links are looped. - -27 : Unrecognized command - This error is returned if an unrecognized command is entered on the - command-line or in a boot sequence section of a configuration file - and that entry is selected. - -28 : Selected item cannot fit into memory - This error is returned if a kernel, module, or raw file load - command is either trying to load its data such that it won't fit - into memory or it is simply too big. - -29 : Disk write error - This error is returned if there is a disk write error when trying - to write to a particular disk. This would generally only occur - during an install of set active partition command. - -30 : Invalid argument - This error is returned if an argument specified to a command is - invalid. - -31 : File is not sector aligned - This error may occur only when you access a ReiserFS partition by - block-lists (e.g. the command `install'). In this case, you should - mount the partition with the `-o notail' option. - -32 : Must be authenticated - This error is returned if you try to run a locked entry. You should - enter a correct password before running such an entry. - -33 : Serial device not configured - This error is returned if you try to change your terminal to a - serial one before initializing any serial device. - -34 : No spare sectors on the disk - This error is returned if a disk doesn't have enough spare space. - This happens when you try to embed Stage 1.5 into the unused - sectors after the MBR, but the first partition starts right after - the MBR or they are used by EZ-BIOS. - - -File: grub.info, Node: Invoking the grub shell, Next: Invoking grub-install, Prev: Troubleshooting, Up: Top - -Invoking the grub shell -*********************** - - This chapter documents the grub shell `grub'. Note that the grub -shell is an emulator; it doesn't run under the native environment, so it -sometimes does something wrong. Therefore, you shouldn't trust it too -much. If there is anything wrong with it, don't hesitate to try the -native GRUB environment, especially when it guesses a wrong map between -BIOS drives and OS devices. - -* Menu: - -* Basic usage:: How to use the grub shell -* Installation under UNIX:: How to install GRUB via `grub' -* Device map:: The map between BIOS drives and OS devices - - -File: grub.info, Node: Basic usage, Next: Installation under UNIX, Up: Invoking the grub shell - -Introduction into the grub shell -================================ - - You can use the command `grub' for installing GRUB under your -operating systems and for a testbed when you add a new feature into GRUB -or when fixing a bug. `grub' is almost the same as the Stage 2, and, in -fact, it shares the source code with the Stage 2 and you can use the -same commands (*note Commands::) in `grub'. It is emulated by replacing -BIOS calls with UNIX system calls and libc functions. - - The command `grub' accepts the following options: - -`--help' - Print a summary of the command-line options and exit. - -`--version' - Print the version number of GRUB and exit. - -`--verbose' - Print some verbose messages for debugging purpose. - -`--device-map=FILE' - Use the device map file FILE. The format is described in *Note - Device map::. - -`--no-floppy' - Do not probe any floppy drive. This option has no effect if the - option `--device-map' is specified (*note Device map::). - -`--probe-second-floppy' - Probe the second floppy drive. If this option is not specified, - the grub shell does not probe it, as that sometimes takes a long - time. If you specify the device map file (*note Device map::), the - grub shell just ignores this option. - -`--config-file=FILE' - Read the configuration file FILE instead of `/boot/grub/menu.lst'. - The format is the same as the normal GRUB syntax. See *Note - Filesystem::, for more information. - -`--boot-drive=DRIVE' - Set the stage2 BOOT_DRIVE to DRIVE. This argument should be an - integer (decimal, octal or hexadecimal). - -`--install-partition=PAR' - Set the stage2 INSTALL_PARTITION to PAR. This argument should be - an integer (decimal, octal or hexadecimal). - -`--no-config-file' - Do not use the configuration file even if it can be read. - -`--no-curses' - Do not use the screen handling interface by the curses even if it - is available. - -`--batch' - This option has the same meaning as `--no-config-file --no-curses'. - -`--read-only' - Disable writing to any disk. - -`--hold' - Wait until a debugger will attach. This option is useful when you - want to debug the startup code. - - -File: grub.info, Node: Installation under UNIX, Next: Device map, Prev: Basic usage, Up: Invoking the grub shell - -How to install GRUB via `grub' -============================== - - The installation procedure is the same as under the "native" Stage -2. *Note Installation::, for more information. The command -`grub'-specific information is described here. - - What you should be careful about is "buffer cache". `grub' makes use -of raw devices instead of filesystems that your operating systems -serve, so there exists a potential problem that some cache -inconsistency may corrupt your filesystems. What we recommend is: - - * If you can unmount drives to which GRUB may write any amount of - data, unmount them before running `grub'. - - * If a drive cannot be unmounted but can be mounted with the - read-only flag, mount it in read-only mode. That should be secure. - - * If a drive must be mounted with the read-write flag, make sure - that no activity is being done on it while the command `grub' is - running. - - * Reboot your operating system as soon as possible. This is probably - not required if you follow the rules above, but reboot is the most - secure way. - - In addition, enter the command `quit' when you finish the -installation. That is _very important_ because `quit' makes the buffer -cache consistent. Do not push . - - If you want to install GRUB non-interactively, specify `--batch' -option in the command-line. This is a simple example: - - #!/bin/sh - - # Use /usr/sbin/grub if you are on an older system. - /sbin/grub --batch </dev/null 2>/dev/null - root (hd0,0) - setup (hd0) - quit - EOT - - -File: grub.info, Node: Device map, Prev: Installation under UNIX, Up: Invoking the grub shell - -The map between BIOS drives and OS devices -========================================== - - When you specify the option `--device-map' (*note Basic usage::), -the grub shell creates the "device map file" automatically unless it -already exists. The file name `/boot/grub/device.map' is preferred. - - If the device map file exists, the grub shell reads it to map BIOS -drives to OS devices. This file consists of lines like this: - - DEVICE FILE - - DEVICE is a drive specified in the GRUB syntax (*note Device -syntax::), and FILE is an OS file, which is normally a device file. - - The reason why the grub shell gives you the device map file is that -it cannot guess the map between BIOS drives and OS devices correctly in -some environments. For example, if you exchange the boot sequence -between IDE and SCSI in your BIOS, it gets the order wrong. - - Thus, edit the file if the grub shell makes a mistake. You can put -any comments in the file if needed, as the grub shell assumes that a -line is just a comment if the first character is `#'. - - -File: grub.info, Node: Invoking grub-install, Next: Invoking grub-md5-crypt, Prev: Invoking the grub shell, Up: Top - -Invoking grub-install -********************* - - The program `grub-install' installs GRUB on your drive using the -grub shell (*note Invoking the grub shell::). You must specify the -device name on which you want to install GRUB, like this: - - grub-install INSTALL_DEVICE - - The device name INSTALL_DEVICE is an OS device name or a GRUB device -name. - - `grub-install' accepts the following options: - -`--help' - Print a summary of the command-line options and exit. - -`--version' - Print the version number of GRUB and exit. - -`--force-lba' - Force GRUB to use LBA mode even for a buggy BIOS. Use this option - only if your BIOS doesn't work properly in LBA mode even though it - supports LBA mode. - -`--root-directory=DIR' - Install GRUB images under the directory DIR instead of the root - directory. This option is useful when you want to install GRUB - into a separate partition or a removable disk. Here is an example - in which you have a separate "boot" partition which is mounted on - `/boot': - - grub-install --root-directory=/boot hd0 - -`--grub-shell=FILE' - Use FILE as the grub shell. You can append arbitrary options to - FILE after the file name, like this: - - grub-install --grub-shell="grub --read-only" /dev/fd0 - -`--recheck' - Recheck the device map, even if `/boot/grub/device.map' already - exists. You should use this option whenever you add/remove a disk - into/from your computer. - - -File: grub.info, Node: Invoking grub-md5-crypt, Next: Invoking grub-terminfo, Prev: Invoking grub-install, Up: Top - -Invoking grub-md5-crypt -*********************** - - The program `grub-md5-crypt' encrypts a password in MD5 format. -This is just a frontend of the grub shell (*note Invoking the grub -shell::). Passwords encrypted by this program can be used with the -command `password' (*note password::). - - `grub-md5-crypt' accepts the following options: - -`--help' - Print a summary of the command-line options and exit. - -`--version' - Print the version information and exit. - -`--grub-shell=FILE' - Use FILE as the grub shell. - - -File: grub.info, Node: Invoking grub-terminfo, Next: Invoking grub-set-default, Prev: Invoking grub-md5-crypt, Up: Top - -Invoking grub-terminfo -********************** - - The program `grub-terminfo' generates a terminfo command from a -terminfo name (*note terminfo::). The result can be used in the -configuration file, to define escape sequences. Because GRUB assumes -that your terminal is vt100-compatible by default, this would be useful -only if your terminal is uncommon (such as vt52). - - `grub-terminfo' accepts the following options: - -`--help' - Print a summary of the command-line options and exit. - -`--version' - Print the version information and exit. - - You must specify one argument to this command. For example: - - grub-terminfo vt52 - - -File: grub.info, Node: Invoking grub-set-default, Next: Invoking mbchk, Prev: Invoking grub-terminfo, Up: Top - -Invoking grub-set-default -************************* - - The program `grub-set-default' sets the default boot entry for GRUB. -This automatically creates a file named `default' under your GRUB -directory (i.e. `/boot/grub'), if it is not present. This file is used -to determine the default boot entry when GRUB boots up your system when -you use `default saved' in your configuration file (*note default::), -and to save next default boot entry when you use `savedefault' in a -boot entry (*note savedefault::). - - `grub-set-default' accepts the following options: - -`--help' - Print a summary of the command-line options and exit. - -`--version' - Print the version information and exit. - -`--root-directory=DIR' - Use the directory DIR instead of the root directory (i.e. `/') to - define the location of the default file. This is useful when you - mount a disk which is used for another system. - - You must specify a single argument to `grub-set-default'. This -argument is normally the number of a default boot entry. For example, -if you have this configuration file: - - default saved - timeout 10 - - title GNU/Hurd - root (hd0,0) - ... - - title GNU/Linux - root (hd0,1) - ... - - and if you want to set the next default boot entry to GNU/Linux, you -may execute this command: - - grub-set-default 1 - - Because the entry for GNU/Linux is `1'. Note that entries are -counted from zero. So, if you want to specify GNU/Hurd here, then you -should specify `0'. - - This feature is very useful if you want to test a new kernel or to -make your system quite robust. *Note Making your system robust::, for -more hints about how to set up a robust system. - - -File: grub.info, Node: Invoking mbchk, Next: Obtaining and Building GRUB, Prev: Invoking grub-set-default, Up: Top - -Invoking mbchk -************** - - The program `mbchk' checks for the format of a Multiboot kernel. We -recommend using this program before booting your own kernel by GRUB. - - `mbchk' accepts the following options: - -`--help' - Print a summary of the command-line options and exit. - -`--version' - Print the version number of GRUB and exit. - -`--quiet' - Suppress all normal output. - - -File: grub.info, Node: Obtaining and Building GRUB, Next: Reporting bugs, Prev: Invoking mbchk, Up: Top - -How to obtain and build GRUB -**************************** - - *Caution:* GRUB requires binutils-2.9.1.0.23 or later because the - GNU assembler has been changed so that it can produce real 16bits - machine code between 2.9.1 and 2.9.1.0.x. See - `http://sources.redhat.com/binutils/', to obtain information on - how to get the latest version. - - GRUB is available from the GNU alpha archive site -`ftp://alpha.gnu.org/gnu/grub' or any of its mirrors. The file will be -named grub-version.tar.gz. The current version is 0.95, so the file you -should grab is: - - `ftp://alpha.gnu.org/gnu/grub/grub-0.95.tar.gz' - - To unbundle GRUB use the instruction: - - zcat grub-0.95.tar.gz | tar xvf - - - which will create a directory called `grub-0.95' with all the -sources. You can look at the file `INSTALL' for detailed instructions -on how to build and install GRUB, but you should be able to just do: - - cd grub-0.95 - ./configure - make install - - This will install the grub shell `grub' (*note Invoking the grub -shell::), the Multiboot checker `mbchk' (*note Invoking mbchk::), and -the GRUB images. This will also install the GRUB manual. - - Also, the latest version is available from the CVS. See -`http://savannah.gnu.org/cvs/?group=grub' for more information. - - -File: grub.info, Node: Reporting bugs, Next: Future, Prev: Obtaining and Building GRUB, Up: Top - -Reporting bugs -************** - - These are the guideline for how to report bugs. Take a look at this -list below before you submit bugs: - - 1. Before getting unsettled, read this manual through and through. - Also, see the GNU GRUB FAQ - (http://www.gnu.org/software/grub/grub-faq.html). - - 2. Always mention the information on your GRUB. The version number - and the configuration are quite important. If you build it - yourself, write the options specified to the configure script and - your operating system, including the versions of gcc and binutils. - - 3. If you have trouble with the installation, inform us of how you - installed GRUB. Don't omit error messages, if any. Just `GRUB hangs - up when it boots' is not enough. - - The information on your hardware is also essential. These are - especially important: the geometries and the partition tables of - your hard disk drives and your BIOS. - - 4. If GRUB cannot boot your operating system, write down _everything_ - you see on the screen. Don't paraphrase them, like `The foo OS - crashes with GRUB, even though it can boot with the bar boot - loader just fine'. Mention the commands you executed, the messages - printed by them, and information on your operating system - including the version number. - - 5. Explain what you wanted to do. It is very useful to know your - purpose and your wish, and how GRUB didn't satisfy you. - - 6. If you can investigate the problem yourself, please do. That will - give you and us much more information on the problem. Attaching a - patch is even better. - - When you attach a patch, make the patch in unified diff format, and - write ChangeLog entries. But, even when you make a patch, don't - forget to explain the problem, so that we can understand what your - patch is for. - - 7. Write down anything that you think might be related. Please - understand that we often need to reproduce the same problem you - encounterred in our environment. So your information should be - sufficient for us to do the same thing--Don't forget that we - cannot see your computer directly. If you are not sure whether to - state a fact or leave it out, state it! Reporting too many things - is much better than omitting something important. - - If you follow the guideline above, submit a report to the Bug -Tracking System (http://savannah.gnu.org/bugs/?group=grub). -Alternatively, you can submit a report via electronic mail to -, but we strongly recommend that you use the Bug -Tracking System, because e-mail can be passed over easily. - - Once we get your report, we will try to fix the bugs. - - -File: grub.info, Node: Future, Next: Internals, Prev: Reporting bugs, Up: Top - -Where GRUB will go -****************** - - We started the next generation of GRUB, GRUB 2. This will include -internationalization, dynamic module loading, real memory management, -multiple architecture support, a scripting language, and many other -nice feature. If you are interested in the development of GRUB 2, take -a look at the homepage (http://www.gnu.org/software/grub/grub.html). - - -File: grub.info, Node: Internals, Next: Index, Prev: Future, Up: Top - -Hacking GRUB -************ - - This chapter documents the user-invisible aspect of GRUB. - - As a general rule of software development, it is impossible to keep -the descriptions of the internals up-to-date, and it is quite hard to -document everything. So refer to the source code, whenever you are not -satisfied with this documentation. Please assume that this gives just -hints to you. - -* Menu: - -* Memory map:: The memory map of various components -* Embedded data:: Embedded variables in GRUB -* Filesystem interface:: The generic interface for filesystems -* Command interface:: The generic interface for built-ins -* Bootstrap tricks:: The bootstrap mechanism used in GRUB -* I/O ports detection:: How to probe I/O ports used by INT 13H -* Memory detection:: How to detect all installed RAM -* Low-level disk I/O:: INT 13H disk I/O interrupts -* MBR:: The structure of Master Boot Record -* Partition table:: The format of partition tables -* Submitting patches:: Where and how you should send patches - - -File: grub.info, Node: Memory map, Next: Embedded data, Up: Internals - -The memory map of various components -==================================== - - GRUB consists of two distinct components, called "stages", which are -loaded at different times in the boot process. Because they run -mutual-exclusively, sometimes a memory area overlaps with another -memory area. And, even in one stage, a single memory area can be used -for various purposes, because their usages are mutually exclusive. - - Here is the memory map of the various components: - -0 to 4K-1 - BIOS and real mode interrupts - -0x07BE to 0x07FF - Partition table passed to another boot loader - -down from 8K-1 - Real mode stack - -0x2000 to ? - The optional Stage 1.5 is loaded here - -0x2000 to 0x7FFF - Command-line buffer for Multiboot kernels and modules - -0x7C00 to 0x7DFF - Stage 1 is loaded here by BIOS or another boot loader - -0x7F00 to 0x7F42 - LBA drive parameters - -0x8000 to ? - Stage2 is loaded here - -The end of Stage 2 to 416K-1 - Heap, in particular used for the menu - -down from 416K-1 - Protected mode stack - -416K to 448K-1 - Filesystem buffer - -448K to 479.5K-1 - Raw device buffer - -479.5K to 480K-1 - 512-byte scratch area - -480K to 512K-1 - Buffers for various functions, such as password, command-line, cut - and paste, and completion. - -The last 1K of lower memory - Disk swapping code and data - - See the file `stage2/shared.h', for more information. - - -File: grub.info, Node: Embedded data, Next: Filesystem interface, Prev: Memory map, Up: Internals - -Embedded variables in GRUB -========================== - - Stage 1 and Stage 2 have embedded variables whose locations are -well-defined, so that the installation can patch the binary file -directly without recompilation of the stages. - - In Stage 1, these are defined: - -`0x3E' - The version number (not GRUB's, but the installation mechanism's). - -`0x40' - The boot drive. If it is 0xFF, use a drive passed by BIOS. - -`0x41' - The flag for if forcing LBA. - -`0x42' - The starting address of Stage 2. - -`0x44' - The first sector of Stage 2. - -`0x48' - The starting segment of Stage 2. - -`0x1FE' - The signature (`0xAA55'). - - See the file `stage1/stage1.S', for more information. - - In the first sector of Stage 1.5 and Stage 2, the block lists are -recorded between `firstlist' and `lastlist'. The address of `lastlist' -is determined when assembling the file `stage2/start.S'. - - The trick here is that it is actually read backward, and the first -8-byte block list is not read here, but after the pointer is decremented -8 bytes, then after reading it, it decrements again, reads, and so on, -until it is finished. The terminating condition is when the number of -sectors to be read in the next block list is zero. - - The format of a block list can be seen from the example in the code -just before the `firstlist' label. Note that it is always from the -beginning of the disk, but _not_ relative to the partition boundaries. - - In the second sector of Stage 1.5 and Stage 2, these are defined: - -`0x6' - The version number (likewise, the installation mechanism's). - -`0x8' - The installed partition. - -`0xC' - The saved entry number. - -`0x10' - The identifier. - -`0x11' - The flag for if forcing LBA. - -`0x12' - The version string (GRUB's). - -`0x12' + "the length of the version string" - The name of a configuration file. - - See the file `stage2/asm.S', for more information. - - -File: grub.info, Node: Filesystem interface, Next: Command interface, Prev: Embedded data, Up: Internals - -The generic interface for filesystems -===================================== - - For any particular partition, it is presumed that only one of the -"normal" filesystems such as FAT, FFS, or ext2fs can be used, so there -is a switch table managed by the functions in `disk_io.c'. The notation -is that you can only "mount" one at a time. - - The block list filesystem has a special place in the system. In -addition to the "normal" filesystem (or even without one mounted), you -can access disk blocks directly (in the indicated partition) via the -block list notation. Using the block list filesystem doesn't effect any -other filesystem mounts. - - The variables which can be read by the filesystem backend are: - -`current_drive' - The current BIOS drive number (numbered from 0, if a floppy, and - numbered from 0x80, if a hard disk). - -`current_partition' - The current partition number. - -`current_slice' - The current partition type. - -`saved_drive' - The "drive" part of the root device. - -`saved_partition' - The "partition" part of the root device. - -`part_start' - The current partition starting address, in sectors. - -`part_length' - The current partition length, in sectors. - -`print_possibilities' - True when the `dir' function should print the possible completions - of a file, and false when it should try to actually open a file of - that name. - -`FSYS_BUF' - Filesystem buffer which is 32K in size, to use in any way which the - filesystem backend desires. - - The variables which need to be written by a filesystem backend are: - -`filepos' - The current position in the file, in sectors. - - *Caution:* the value of FILEPOS can be changed out from under the - filesystem code in the current implementation. Don't depend on it - being the same for later calls into the backend code! - -`filemax' - The length of the file. - -`disk_read_func' - The value of DISK_READ_HOOK _only_ during reading of data for the - file, not any other fs data, inodes, FAT tables, whatever, then - set to `NULL' at all other times (it will be `NULL' by default). - If this isn't done correctly, then the `testload' and `install' - commands won't work correctly. - - The functions expected to be used by the filesystem backend are: - -`devread' - Only read sectors from within a partition. Sector 0 is the first - sector in the partition. - -`grub_read' - If the backend uses the block list code, then `grub_read' can be - used, after setting BLOCK_FILE to 1. - -`print_a_completion' - If PRINT_POSSIBILITIES is true, call `print_a_completion' for each - possible file name. Otherwise, the file name completion won't work. - - The functions expected to be defined by the filesystem backend are -described at least moderately in the file `filesys.h'. Their usage is -fairly evident from their use in the functions in `disk_io.c', look for -the use of the FSYS_TABLE array. - - *Caution:* The semantics are such that then `mount'ing the -filesystem, presume the filesystem buffer `FSYS_BUF' is corrupted, and -(re-)load all important contents. When opening and reading a file, -presume that the data from the `mount' is available, and doesn't get -corrupted by the open/read (i.e. multiple opens and/or reads will be -done with only one mount if in the same filesystem). - - -File: grub.info, Node: Command interface, Next: Bootstrap tricks, Prev: Filesystem interface, Up: Internals - -The generic interface for built-ins -=================================== - - GRUB built-in commands are defined in a uniformal interface, whether -they are menu-specific or can be used anywhere. The definition of a -builtin command consists of two parts: the code itself and the table of -the information. - - The code must be a function which takes two arguments, a command-line -string and flags, and returns an `int' value. The "flags" argument -specifies how the function is called, using a bit mask. The return -value must be zero if successful, otherwise non-zero. So it is normally -enough to return ERRNUM. - - The table of the information is represented by the structure `struct -builtin', which contains the name of the command, a pointer to the -function, flags, a short description of the command and a long -description of the command. Since the descriptions are used only for -help messages interactively, you don't have to define them, if the -command may not be called interactively (such as `title'). - - The table is finally registered in the table BUILTIN_TABLE, so that -`run_script' and `enter_cmdline' can find the command. See the files -`cmdline.c' and `builtins.c', for more details. - diff --git a/usr/src/grub/grub-0.95/docs/grub.info-4 b/usr/src/grub/grub-0.95/docs/grub.info-4 deleted file mode 100644 index c1e76ab144..0000000000 --- a/usr/src/grub/grub-0.95/docs/grub.info-4 +++ /dev/null @@ -1,249 +0,0 @@ -This is grub.info, produced by makeinfo version 4.0 from grub.texi. - -INFO-DIR-SECTION Kernel -START-INFO-DIR-ENTRY -* GRUB: (grub). The GRand Unified Bootloader -* grub-install: (grub)Invoking grub-install. Install GRUB on your drive -* grub-md5-crypt: (grub)Invoking grub-md5-crypt. Encrypt a password - in MD5 format -* grub-terminfo: (grub)Invoking grub-terminfo. Generate a terminfo - command from a - terminfo name -* grub-set-default: (grub)Invoking grub-set-default. Set a default boot - entry -* mbchk: (grub)Invoking mbchk. Check for the format of a Multiboot kernel -END-INFO-DIR-ENTRY - - Copyright (C) 1999,2000,2001,2002,2004 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: grub.info, Node: Bootstrap tricks, Next: I/O ports detection, Prev: Command interface, Up: Internals - -The bootstrap mechanism used in GRUB -==================================== - - The disk space can be used in a boot loader is very restricted -because a MBR (*note MBR::) is only 512 bytes but it also contains a -partition table (*note Partition table::) and a BPB. So the question is -how to make a boot loader code enough small to be fit in a MBR. - - However, GRUB is a very large program, so we break GRUB into 2 (or 3) -distinct components, "Stage 1" and "Stage 2" (and optionally "Stage -1.5"). *Note Memory map::, for more information. - - We embed Stage 1 in a MBR or in the boot sector of a partition, and -place Stage 2 in a filesystem. The optional Stage 1.5 can be installed -in a filesystem, in the "boot loader" area in a FFS or a ReiserFS, and -in the sectors right after a MBR, because Stage 1.5 is enough small and -the sectors right after a MBR is normally an unused region. The size of -this region is the number of sectors per head minus 1. - - Thus, all Stage1 must do is just load Stage2 or Stage1.5. But even if -Stage 1 needs not to support the user interface or the filesystem -interface, it is impossible to make Stage 1 less than 400 bytes, because -GRUB should support both the CHS mode and the LBA mode (*note Low-level -disk I/O::). - - The solution used by GRUB is that Stage 1 loads only the first -sector of Stage 2 (or Stage 1.5) and Stage 2 itself loads the rest. The -flow of Stage 1 is: - - 1. Initialize the system briefly. - - 2. Detect the geometry and the accessing mode of the "loading drive". - - 3. Load the first sector of Stage 2. - - 4. Jump to the starting address of the Stage 2. - - The flow of Stage 2 (and Stage 1.5) is: - - 1. Load the rest of itself to the real starting address, that is, the - starting address plus 512 bytes. The block lists are stored in the - last part of the first sector. - - 2. Long jump to the real starting address. - - Note that Stage 2 (or Stage 1.5) does not probe the geometry or the -accessing mode of the "loading drive", since Stage 1 has already probed -them. - - -File: grub.info, Node: I/O ports detection, Next: Memory detection, Prev: Bootstrap tricks, Up: Internals - -How to probe I/O ports used by INT 13H -====================================== - - FIXME: I will write this chapter after implementing the new -technique. - - -File: grub.info, Node: Memory detection, Next: Low-level disk I/O, Prev: I/O ports detection, Up: Internals - -How to detect all installed RAM -=============================== - - FIXME: I doubt if Erich didn't write this chapter only himself -wholly, so I will rewrite this chapter. - - -File: grub.info, Node: Low-level disk I/O, Next: MBR, Prev: Memory detection, Up: Internals - -INT 13H disk I/O interrupts -=========================== - - FIXME: I'm not sure where some part of the original chapter is -derived, so I will rewrite this chapter. - - -File: grub.info, Node: MBR, Next: Partition table, Prev: Low-level disk I/O, Up: Internals - -The structure of Master Boot Record -=================================== - - FIXME: Likewise. - - -File: grub.info, Node: Partition table, Next: Submitting patches, Prev: MBR, Up: Internals - -The format of partition tables -============================== - - FIXME: Probably the original chapter is derived from "How It Works", -so I will rewrite this chapter. - - -File: grub.info, Node: Submitting patches, Prev: Partition table, Up: Internals - -Where and how you should send patches -===================================== - - When you write patches for GRUB, please send them to the mailing list -. Here is the list of items of which you should take -care: - - * Please make your patch as small as possible. Generally, it is not - a good thing to make one big patch which changes many things. - Instead, segregate features and produce many patches. - - * Use as late code as possible, for the original code. The CVS - repository always has the current version (*note Obtaining and - Building GRUB::). - - * Write ChangeLog entries. *Note Change Logs: (standards)Change - Logs, if you don't know how to write ChangeLog. - - * Make patches in unified diff format. `diff -urN' is appropriate in - most cases. - - * Don't make patches reversely. Reverse patches are difficult to - read and use. - - * Be careful enough of the license term and the copyright. Because - GRUB is under GNU General Public License, you may not steal code - from software whose license is incompatible against GPL. And, if - you copy code written by others, you must not ignore their - copyrights. Feel free to ask GRUB maintainers, whenever you are - not sure what you should do. - - * If your patch is too large to send in e-mail, put it at somewhere - we can see. Usually, you shouldn't send e-mail over 20K. - - -File: grub.info, Node: Index, Prev: Internals, Up: Top - -Index -***** - -* Menu: - -* blocklist: blocklist. -* boot: boot. -* bootp: bootp. -* cat: cat. -* chainloader: chainloader. -* cmp: cmp. -* color: color. -* configfile: configfile. -* current_drive: Filesystem interface. -* current_partition: Filesystem interface. -* current_slice: Filesystem interface. -* debug: debug. -* default: default. -* device: device. -* devread: Filesystem interface. -* dhcp: dhcp. -* disk_read_func: Filesystem interface. -* displayapm: displayapm. -* displaymem: displaymem. -* embed: embed. -* fallback: fallback. -* filemax: Filesystem interface. -* filepos: Filesystem interface. -* find: find. -* fstest: fstest. -* FSYS_BUF: Filesystem interface. -* geometry: geometry. -* grub_read: Filesystem interface. -* halt: halt. -* help: help. -* hiddenmenu: hiddenmenu. -* hide: hide. -* ifconfig: ifconfig. -* impsprobe: impsprobe. -* initrd: initrd. -* install: install. -* ioprobe: ioprobe. -* kernel: kernel. -* lock: lock. -* makeactive: makeactive. -* map: map. -* md5crypt: md5crypt. -* module: module. -* modulenounzip: modulenounzip. -* pager: pager. -* part_length: Filesystem interface. -* part_start: Filesystem interface. -* partnew: partnew. -* parttype: parttype. -* password: password. -* pause: pause. -* print_a_completion: Filesystem interface. -* print_possibilities: Filesystem interface. -* quit: quit. -* rarp: rarp. -* read: read. -* reboot: reboot. -* root: root. -* rootnoverify: rootnoverify. -* saved_drive: Filesystem interface. -* saved_partition: Filesystem interface. -* savedefault: savedefault. -* serial: serial. -* setkey: setkey. -* setup: setup. -* terminal: terminal. -* terminfo: terminfo. -* testload: testload. -* testvbe: testvbe. -* tftpserver: tftpserver. -* timeout: timeout. -* title: title. -* unhide: unhide. -* uppermem: uppermem. -* vbeprobe: vbeprobe. - - diff --git a/usr/src/grub/grub-0.95/docs/grub.texi b/usr/src/grub/grub-0.95/docs/grub.texi deleted file mode 100644 index c5f694ffbf..0000000000 --- a/usr/src/grub/grub-0.95/docs/grub.texi +++ /dev/null @@ -1,3987 +0,0 @@ -\input texinfo -@c -*-texinfo-*- -@c %**start of header -@setfilename grub.info -@settitle GRUB Manual -@c %**end of header - -@include version.texi - -@c Unify all our little indices for now. -@syncodeindex fn cp -@syncodeindex vr cp -@syncodeindex ky cp -@syncodeindex pg cp -@syncodeindex tp cp - -@footnotestyle separate -@paragraphindent 3 -@finalout - -@dircategory Kernel -@direntry -* GRUB: (grub). The GRand Unified Bootloader -* grub-install: (grub)Invoking grub-install. Install GRUB on your drive -* grub-md5-crypt: (grub)Invoking grub-md5-crypt. Encrypt a password - in MD5 format -* grub-terminfo: (grub)Invoking grub-terminfo. Generate a terminfo - command from a - terminfo name -* grub-set-default: (grub)Invoking grub-set-default. Set a default boot - entry -* mbchk: (grub)Invoking mbchk. Check for the format of a Multiboot kernel -@end direntry - -@setchapternewpage odd - -@ifinfo -Copyright @copyright{} 1999,2000,2001,2002,2004 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. - -@ignore -Permission is granted to process this file through TeX and print the -results, provided the printed document carries a copying permission -notice identical to this one except for the removal of this paragraph -(this paragraph not being relevant to the printed manual). - -@end ignore - -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. -@end ifinfo - -@titlepage -@sp 10 -@title the GRUB manual -@subtitle The GRand Unified Bootloader, version @value{VERSION}, @value{UPDATED}. -@author Gordon Matzigkeit -@author Yoshinori K. Okuji -@c The following two commands start the copyright page. -@page -@vskip 0pt plus 1filll -Copyright @copyright{} 1999,2000,2001,2002,2004 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 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, -except that this permission notice may be stated in a translation approved -by Free Software Foundation. -@end titlepage - -@c Output the table of contents at the beginning. -@contents - -@finalout -@headings double - -@ifnottex -@node Top -@top GRUB manual - -This is the documentation of GNU GRUB, the GRand Unified Bootloader, -a flexible and powerful boot loader program for @sc{pc}s. - -This edition documents version @value{VERSION}. -@end ifnottex - -@menu -* Introduction:: Capturing the spirit of GRUB -* Naming convention:: Names of your drives in GRUB -* Installation:: Installing GRUB on your drive -* Booting:: How to boot different operating systems -* Configuration:: Writing your own configuration file -* Network:: Downloading OS images from a network -* Serial terminal:: Using GRUB via a serial line -* Preset Menu:: Embedding a configuration file into GRUB -* Security:: Improving the security -* Images:: GRUB image files -* Filesystem:: Filesystem syntax and semantics -* Interface:: The menu and the command-line -* Commands:: The list of available builtin commands -* Troubleshooting:: Error messages produced by GRUB -* Invoking the grub shell:: How to use the grub shell -* Invoking grub-install:: How to use the GRUB installer -* Invoking grub-md5-crypt:: How to generate a cryptic password -* Invoking grub-terminfo:: How to generate a terminfo command -* Invoking grub-set-default:: How to set a default boot entry -* Invoking mbchk:: How to use the Multiboot checker -* Obtaining and Building GRUB:: How to obtain and build GRUB -* Reporting bugs:: Where you should send a bug report -* Future:: Some future plans on GRUB -* Internals:: Hacking GRUB -* Index:: -@end menu - - -@node Introduction -@chapter Introduction to GRUB - -@menu -* Overview:: What exactly GRUB is and how to use it -* History:: From maggot to house fly -* Features:: GRUB features -* Role of a boot loader:: The role of a boot loader -@end menu - - -@node Overview -@section Overview - -Briefly, a @dfn{boot loader} is the first software program that runs when -a computer starts. It is responsible for loading and transferring -control to an operating system @dfn{kernel} software (such as Linux or -GNU Mach). The kernel, in turn, initializes the rest of the operating -system (e.g. a GNU system). - -GNU GRUB is a very powerful boot loader, which can load a wide variety -of free operating systems, as well as proprietary operating systems with -chain-loading@footnote{@dfn{chain-load} is the mechanism for loading -unsupported operating systems by loading another boot loader. It is -typically used for loading DOS or Windows.}. GRUB is designed to -address the complexity of booting a personal computer; both the -program and this manual are tightly bound to that computer platform, -although porting to other platforms may be addressed in the future. - -One of the important features in GRUB is flexibility; GRUB understands -filesystems and kernel executable formats, so you can load an arbitrary -operating system the way you like, without recording the physical -position of your kernel on the disk. Thus you can load the kernel -just by specifying its file name and the drive and partition where the -kernel resides. - -When booting with GRUB, you can use either a command-line interface -(@pxref{Command-line interface}), or a menu interface (@pxref{Menu -interface}). Using the command-line interface, you type the drive -specification and file name of the kernel manually. In the menu -interface, you just select an OS using the arrow keys. The menu is -based on a configuration file which you prepare beforehand -(@pxref{Configuration}). While in the menu, you can switch to the -command-line mode, and vice-versa. You can even edit menu entries -before using them. - -In the following chapters, you will learn how to specify a drive, a -partition, and a file name (@pxref{Naming convention}) to GRUB, how to -install GRUB on your drive (@pxref{Installation}), and how to boot your -OSes (@pxref{Booting}), step by step. - -Besides the GRUB boot loader itself, there is a @dfn{grub shell} -@command{grub} (@pxref{Invoking the grub shell}) which can be run when -you are in your operating system. It emulates the boot loader and can -be used for installing the boot loader. - - -@node History -@section History of GRUB - -GRUB originated in 1995 when Erich Boleyn was trying to boot the GNU -Hurd with the University of Utah's Mach 4 microkernel (now known as GNU -Mach). Erich and Brian Ford designed the Multiboot Specification -(@pxref{Top, Multiboot Specification, Motivation, multiboot, The Multiboot -Specification}), because they were determined not to add to the large -number of mutually-incompatible PC boot methods. - -Erich then began modifying the FreeBSD boot loader so that it would -understand Multiboot. He soon realized that it would be a lot easier -to write his own boot loader from scratch than to keep working on the -FreeBSD boot loader, and so GRUB was born. - -Erich added many features to GRUB, but other priorities prevented him -from keeping up with the demands of its quickly-expanding user base. In -1999, Gordon Matzigkeit and Yoshinori K. Okuji adopted GRUB as an -official GNU package, and opened its development by making the latest -sources available via anonymous CVS. @xref{Obtaining and Building -GRUB}, for more information. - - -@node Features -@section GRUB features - -The primary requirement for GRUB is that it be compliant with the -@dfn{Multiboot Specification}, which is described in @ref{Top, Multiboot -Specification, Motivation, multiboot, The Multiboot Specification}. - -The other goals, listed in approximate order of importance, are: - -@itemize @bullet{} -@item -Basic functions must be straightforward for end-users. - -@item -Rich functionality to support kernel experts and designers. - -@item -Backward compatibility for booting FreeBSD, NetBSD, OpenBSD, and -Linux. Proprietary kernels (such as DOS, Windows NT, and OS/2) are -supported via a chain-loading function. -@end itemize - -Except for specific compatibility modes (chain-loading and the Linux -@dfn{piggyback} format), all kernels will be started in much the same -state as in the Multiboot Specification. Only kernels loaded at 1 megabyte -or above are presently supported. Any attempt to load below that -boundary will simply result in immediate failure and an error message -reporting the problem. - -In addition to the requirements above, GRUB has the following features -(note that the Multiboot Specification doesn't require all the features -that GRUB supports): - -@table @asis -@item Recognize multiple executable formats -Support many of the @dfn{a.out} variants plus @dfn{ELF}. Symbol -tables are also loaded. - -@item Support non-Multiboot kernels -Support many of the various free 32-bit kernels that lack Multiboot -compliance (primarily FreeBSD, NetBSD, OpenBSD, and -Linux). Chain-loading of other boot loaders is also supported. - -@item Load multiples modules -Fully support the Multiboot feature of loading multiple modules. - -@item Load a configuration file -Support a human-readable text configuration file with preset boot -commands. You can also load another configuration file dynamically and -embed a preset configuration file in a GRUB image file. The list of -commands (@pxref{Commands}) are a superset of those supported on the -command-line. An example configuration file is provided in -@ref{Configuration}. - -@item Provide a menu interface -A menu interface listing preset boot commands, with a programmable -timeout, is available. There is no fixed limit on the number of boot -entries, and the current implementation has space for several hundred. - -@item Have a flexible command-line interface -A fairly flexible command-line interface, accessible from the menu, -is available to edit any preset commands, or write a new boot command -set from scratch. If no configuration file is present, GRUB drops to -the command-line. - -The list of commands (@pxref{Commands}) are a subset of those supported -for configuration files. Editing commands closely resembles the Bash -command-line (@pxref{Command Line Editing, Bash, Command Line Editing, -features, Bash Features}), with @key{TAB}-completion of commands, -devices, partitions, and files in a directory depending on context. - -@item Support multiple filesystem types -Support multiple filesystem types transparently, plus a useful explicit -blocklist notation. The currently supported filesystem types are -@dfn{BSD FFS}, @dfn{DOS FAT16 and FAT32}, @dfn{Minix fs}, @dfn{Linux -ext2fs}, @dfn{ReiserFS}, @dfn{JFS}, @dfn{XFS}, and @dfn{VSTa -fs}. @xref{Filesystem}, for more information. - -@item Support automatic decompression -Can decompress files which were compressed by @command{gzip}. This -function is both automatic and transparent to the user (i.e. all -functions operate upon the uncompressed contents of the specified -files). This greatly reduces a file size and loading time, a -particularly great benefit for floppies.@footnote{There are a few -pathological cases where loading a very badly organized ELF kernel might -take longer, but in practice this never happen.} - -It is conceivable that some kernel modules should be loaded in a -compressed state, so a different module-loading command can be specified -to avoid uncompressing the modules. - -@item Access data on any installed device -Support reading data from any or all floppies or hard disk(s) recognized -by the BIOS, independent of the setting of the root device. - -@item Be independent of drive geometry translations -Unlike many other boot loaders, GRUB makes the particular drive -translation irrelevant. A drive installed and running with one -translation may be converted to another translation without any adverse -effects or changes in GRUB's configuration. - -@item Detect all installed @sc{ram} -GRUB can generally find all the installed @sc{ram} on a PC-compatible -machine. It uses an advanced BIOS query technique for finding all -memory regions. As described on the Multiboot Specification (@pxref{Top, -Multiboot Specification, Motivation, multiboot, The Multiboot -Specification}), not all kernels make use of this information, but GRUB -provides it for those who do. - -@item Support Logical Block Address mode -In traditional disk calls (called @dfn{CHS mode}), there is a geometry -translation problem, that is, the BIOS cannot access over 1024 -cylinders, so the accessible space is limited to at least 508 MB and to -at most 8GB. GRUB can't universally solve this problem, as there is no -standard interface used in all machines. However, several newer machines -have the new interface, Logical Block Address (@dfn{LBA}) mode. GRUB -automatically detects if LBA mode is available and uses it if -available. In LBA mode, GRUB can access the entire disk. - -@item Support network booting -GRUB is basically a disk-based boot loader but also has network -support. You can load OS images from a network by using the @dfn{TFTP} -protocol. - -@item Support remote terminals -To support computers with no console, GRUB provides remote terminal -support, so that you can control GRUB from a remote host. Only serial -terminal support is implemented at the moment. -@end table - - -@node Role of a boot loader -@section The role of a boot loader - -The following is a quotation from Gordon Matzigkeit, a GRUB fanatic: - -@quotation -Some people like to acknowledge both the operating system and kernel when -they talk about their computers, so they might say they use -``GNU/Linux'' or ``GNU/Hurd''. Other people seem to think that the -kernel is the most important part of the system, so they like to call -their GNU operating systems ``Linux systems.'' - -I, personally, believe that this is a grave injustice, because the -@emph{boot loader} is the most important software of all. I used to -refer to the above systems as either ``LILO''@footnote{The LInux LOader, -a boot loader that everybody uses, but nobody likes.} or ``GRUB'' -systems. - -Unfortunately, nobody ever understood what I was talking about; now I -just use the word ``GNU'' as a pseudonym for GRUB. - -So, if you ever hear people talking about their alleged ``GNU'' systems, -remember that they are actually paying homage to the best boot loader -around@dots{} GRUB! -@end quotation - -We, the GRUB maintainers, do not (usually) encourage Gordon's level of -fanaticism, but it helps to remember that boot loaders deserve -recognition. We hope that you enjoy using GNU GRUB as much as we did -writing it. - - -@node Naming convention -@chapter Naming convention - -The device syntax used in GRUB is a wee bit different from what you may -have seen before in your operating system(s), and you need to know it so -that you can specify a drive/partition. - -Look at the following examples and explanations: - -@example -(fd0) -@end example - -First of all, GRUB requires that the device name be enclosed with -@samp{(} and @samp{)}. The @samp{fd} part means that it is a floppy -disk. The number @samp{0} is the drive number, which is counted from -@emph{zero}. This expression means that GRUB will use the whole floppy -disk. - -@example -(hd0,1) -@end example - -Here, @samp{hd} means it is a hard disk drive. The first integer -@samp{0} indicates the drive number, that is, the first hard disk, while -the second integer, @samp{1}, indicates the partition number (or the -@sc{pc} slice number in the BSD terminology). Once again, please note -that the partition numbers are counted from @emph{zero}, not from -one. This expression means the second partition of the first hard disk -drive. In this case, GRUB uses one partition of the disk, instead of the -whole disk. - -@example -(hd0,4) -@end example - -This specifies the first @dfn{extended partition} of the first hard disk -drive. Note that the partition numbers for extended partitions are -counted from @samp{4}, regardless of the actual number of primary -partitions on your hard disk. - -@example -(hd1,a) -@end example - -This means the BSD @samp{a} partition of the second hard disk. If you -need to specify which @sc{pc} slice number should be used, use something -like this: @samp{(hd1,0,a)}. If the @sc{pc} slice number is omitted, -GRUB searches for the first @sc{pc} slice which has a BSD @samp{a} -partition. - -Of course, to actually access the disks or partitions with GRUB, you -need to use the device specification in a command, like @samp{root -(fd0)} or @samp{unhide (hd0,2)}. To help you find out which number -specifies a partition you want, the GRUB command-line -(@pxref{Command-line interface}) options have argument -completion. This means that, for example, you only need to type - -@example -root ( -@end example - -followed by a @key{TAB}, and GRUB will display the list of drives, -partitions, or file names. So it should be quite easy to determine the -name of your target partition, even with minimal knowledge of the -syntax. - -Note that GRUB does @emph{not} distinguish IDE from SCSI - it simply -counts the drive numbers from zero, regardless of their type. Normally, -any IDE drive number is less than any SCSI drive number, although that -is not true if you change the boot sequence by swapping IDE and SCSI -drives in your BIOS. - -Now the question is, how to specify a file? Again, consider an -example: - -@example -(hd0,0)/vmlinuz -@end example - -This specifies the file named @samp{vmlinuz}, found on the first -partition of the first hard disk drive. Note that the argument -completion works with file names, too. - -That was easy, admit it. Now read the next chapter, to find out how to -actually install GRUB on your drive. - - -@node Installation -@chapter Installation - -In order to install GRUB as your boot loader, you need to first -install the GRUB system and utilities under your UNIX-like operating -system (@pxref{Obtaining and Building GRUB}). You can do this either -from the source tarball, or as a package for your OS. - -After you have done that, you need to install the boot loader on a -drive (floppy or hard disk). There are two ways of doing that - either -using the utility @command{grub-install} (@pxref{Invoking -grub-install}) on a UNIX-like OS, or by running GRUB itself from a -floppy. These are quite similar, however the utility might probe a -wrong BIOS drive, so you should be careful. - -Also, if you install GRUB on a UNIX-like OS, please make sure that you -have an emergency boot disk ready, so that you can rescue your computer -if, by any chance, your hard drive becomes unusable (unbootable). - -GRUB comes with boot images, which are normally put in the directory -@file{/usr/lib/grub/i386-pc}. If you do not use grub-install, then -you need to copy the files @file{stage1}, @file{stage2}, and -@file{*stage1_5} to the directory @file{/boot/grub}, and run the -@command{grub-set-default} (@pxref{Invoking grub-set-default}) if you -intend to use @samp{default saved} (@pxref{default}) in your -configuration file. Hereafter, the directory where GRUB images are -initially placed (normally @file{/usr/lib/grub/i386-pc}) will be -called the @dfn{image directory}, and the directory where the boot -loader needs to find them (usually @file{/boot/grub}) will be called -the @dfn{boot directory}. - -@menu -* Creating a GRUB boot floppy:: -* Installing GRUB natively:: -* Installing GRUB using grub-install:: -* Making a GRUB bootable CD-ROM:: -@end menu - - -@node Creating a GRUB boot floppy -@section Creating a GRUB boot floppy - -To create a GRUB boot floppy, you need to take the files @file{stage1} -and @file{stage2} from the image directory, and write them to the first -and the second block of the floppy disk, respectively. - -@strong{Caution:} This procedure will destroy any data currently stored -on the floppy. - -On a UNIX-like operating system, that is done with the following -commands: - -@example -@group -# @kbd{cd /usr/lib/grub/i386-pc} -# @kbd{dd if=stage1 of=/dev/fd0 bs=512 count=1} -1+0 records in -1+0 records out -# @kbd{dd if=stage2 of=/dev/fd0 bs=512 seek=1} -153+1 records in -153+1 records out -# -@end group -@end example - -The device file name may be different. Consult the manual for your OS. - - -@node Installing GRUB natively -@section Installing GRUB natively - -@strong{Caution:} Installing GRUB's stage1 in this manner will erase the -normal boot-sector used by an OS. - -GRUB can currently boot GNU Mach, Linux, FreeBSD, NetBSD, and OpenBSD -directly, so using it on a boot sector (the first sector of a -partition) should be okay. But generally, it would be a good idea to -back up the first sector of the partition on which you are installing -GRUB's stage1. This isn't as important if you are installing GRUB on -the first sector of a hard disk, since it's easy to reinitialize it -(e.g. by running @samp{FDISK /MBR} from DOS). - -If you decide to install GRUB in the native environment, which is -definitely desirable, you'll need to create a GRUB boot disk, and -reboot your computer with it. Otherwise, see @ref{Installing GRUB using -grub-install}. - -Once started, GRUB will show the command-line interface -(@pxref{Command-line interface}). First, set the GRUB's @dfn{root -device}@footnote{Note that GRUB's root device doesn't necessarily mean -your OS's root partition; if you need to specify a root partition for -your OS, add the argument into the command @command{kernel}.} to the -partition containing the boot directory, like this: - -@example -grub> @kbd{root (hd0,0)} -@end example - -If you are not sure which partition actually holds this directory, use the -command @command{find} (@pxref{find}), like this: - -@example -grub> @kbd{find /boot/grub/stage1} -@end example - -This will search for the file name @file{/boot/grub/stage1} and show the -devices which contain the file. - -Once you've set the root device correctly, run the command -@command{setup} (@pxref{setup}): - -@example -grub> @kbd{setup (hd0)} -@end example - -This command will install the GRUB boot loader on the Master Boot -Record (MBR) of the first drive. If you want to put GRUB into the boot -sector of a partition instead of putting it in the MBR, specify the -partition into which you want to install GRUB: - -@example -grub> @kbd{setup (hd0,0)} -@end example - -If you install GRUB into a partition or a drive other than the first -one, you must chain-load GRUB from another boot loader. Refer to the -manual for the boot loader to know how to chain-load GRUB. - -After using the setup command, you will boot into GRUB without the -GRUB floppy. See the chapter @ref{Booting} to find out how to boot -your operating systems from GRUB. - - -@node Installing GRUB using grub-install -@section Installing GRUB using grub-install - -@strong{Caution:} This procedure is definitely less safe, because -there are several ways in which your computer can become -unbootable. For example, most operating systems don't tell GRUB how to -map BIOS drives to OS devices correctly---GRUB merely @dfn{guesses} -the mapping. This will succeed in most cases, but not -always. Therefore, GRUB provides you with a map file called the -@dfn{device map}, which you must fix if it is wrong. @xref{Device -map}, for more details. - -If you still do want to install GRUB under a UNIX-like OS (such -as @sc{gnu}), invoke the program @command{grub-install} (@pxref{Invoking -grub-install}) as the superuser (@dfn{root}). - -The usage is basically very simple. You only need to specify one -argument to the program, namely, where to install the boot loader. The -argument can be either a device file (like @samp{/dev/hda}) or a -partition specified in GRUB's notation. For example, under Linux the -following will install GRUB into the MBR of the first IDE disk: - -@example -# @kbd{grub-install /dev/hda} -@end example - -Likewise, under GNU/Hurd, this has the same effect: - -@example -# @kbd{grub-install /dev/hd0} -@end example - -If it is the first BIOS drive, this is the same as well: - -@example -# @kbd{grub-install '(hd0)'} -@end example - -Or you can omit the parentheses: - -@example -# @kbd{grub-install hd0} -@end example - -But all the above examples assume that GRUB should use images under -the root directory. If you want GRUB to use images under a directory -other than the root directory, you need to specify the option -@option{--root-directory}. The typical usage is that you create a GRUB -boot floppy with a filesystem. Here is an example: - -@example -@group -# @kbd{mke2fs /dev/fd0} -# @kbd{mount -t ext2 /dev/fd0 /mnt} -# @kbd{grub-install --root-directory=/mnt fd0} -# @kbd{umount /mnt} -@end group -@end example - -Another example is when you have a separate boot partition -which is mounted at @file{/boot}. Since GRUB is a boot loader, it -doesn't know anything about mountpoints at all. Thus, you need to run -@command{grub-install} like this: - -@example -# @kbd{grub-install --root-directory=/boot /dev/hda} -@end example - -By the way, as noted above, it is quite difficult to guess BIOS drives -correctly under a UNIX-like OS. Thus, @command{grub-install} will prompt -you to check if it could really guess the correct mappings, after the -installation. The format is defined in @ref{Device map}. Please be -quite careful. If the output is wrong, it is unlikely that your -computer will be able to boot with no problem. - -Note that @command{grub-install} is actually just a shell script and the -real task is done by the grub shell @command{grub} (@pxref{Invoking the -grub shell}). Therefore, you may run @command{grub} directly to install -GRUB, without using @command{grub-install}. Don't do that, however, -unless you are very familiar with the internals of GRUB. Installing a -boot loader on a running OS may be extremely dangerous. - - -@node Making a GRUB bootable CD-ROM -@section Making a GRUB bootable CD-ROM - -GRUB supports the @dfn{no emulation mode} in the El Torito -specification@footnote{El Torito is a specification for bootable CD -using BIOS functions.}. This means that you can use the whole CD-ROM -from GRUB and you don't have to make a floppy or hard disk image file, -which can cause compatibility problems. - -For booting from a CD-ROM, GRUB uses a special Stage 2 called -@file{stage2_eltorito}. The only GRUB files you need to have in your -bootable CD-ROM are this @file{stage2_eltorito} and optionally a config file -@file{menu.lst}. You don't need to use @file{stage1} or @file{stage2}, -because El Torito is quite different from the standard boot process. - -Here is an example of procedures to make a bootable CD-ROM -image. First, make a top directory for the bootable image, say, -@samp{iso}: - -@example -$ @kbd{mkdir iso} -@end example - -Make a directory for GRUB: - -@example -$ @kbd{mkdir -p iso/boot/grub} -@end example - -Copy the file @file{stage2_eltorito}: - -@example -$ @kbd{cp /usr/lib/grub/i386-pc/stage2_eltorito iso/boot/grub} -@end example - -If desired, make the config file @file{menu.lst} under @file{iso/boot/grub} -(@pxref{Configuration}), and copy any files and directories for the disc to the -directory @file{iso/}. - -Finally, make a ISO9660 image file like this: - -@example -$ @kbd{mkisofs -R -b boot/grub/stage2_eltorito -no-emul-boot \ - -boot-load-size 4 -boot-info-table -o grub.iso iso} -@end example - -This produces a file named @file{grub.iso}, which then can be burned -into a CD (or a DVD). @kbd{mkisofs} has already set up the disc to boot -from the @kbd{boot/grub/stage2_eltorito} file, so there is no need to -setup GRUB on the disc. (Note that the @kbd{-boot-load-size 4} bit is -required for compatibility with the BIOS on many older machines.) - -You can use the device @samp{(cd)} to access a CD-ROM in your -config file. This is not required; GRUB automatically sets the root device -to @samp{(cd)} when booted from a CD-ROM. It is only necessary to refer to -@samp{(cd)} if you want to access other drives as well. - - -@node Booting -@chapter Booting - -GRUB can load Multiboot-compliant kernels in a consistent way, -but for some free operating systems you need to use some OS-specific -magic. - -@menu -* General boot methods:: How to boot OSes with GRUB generally -* OS-specific notes:: Notes on some operating systems -* Making your system robust:: How to make your system robust -@end menu - - -@node General boot methods -@section How to boot operating systems - -GRUB has two distinct boot methods. One of the two is to load an -operating system directly, and the other is to chain-load another boot -loader which then will load an operating system actually. Generally -speaking, the former is more desirable, because you don't need to -install or maintain other boot loaders and GRUB is flexible enough to -load an operating system from an arbitrary disk/partition. However, -the latter is sometimes required, since GRUB doesn't support all the -existing operating systems natively. - -@menu -* Loading an operating system directly:: -* Chain-loading:: -@end menu - - -@node Loading an operating system directly -@subsection How to boot an OS directly with GRUB - -Multiboot (@pxref{Top, Multiboot Specification, Motivation, multiboot, -The Multiboot Specification}) is the native format supported by GRUB. -For the sake of convenience, there is also support for Linux, FreeBSD, -NetBSD and OpenBSD. If you want to boot other operating systems, you -will have to chain-load them (@pxref{Chain-loading}). - -Generally, GRUB can boot any Multiboot-compliant OS in the following -steps: - -@enumerate -@item -Set GRUB's root device to the drive where the OS images are stored with -the command @command{root} (@pxref{root}). - -@item -Load the kernel image with the command @command{kernel} (@pxref{kernel}). - -@item -If you need modules, load them with the command @command{module} -(@pxref{module}) or @command{modulenounzip} (@pxref{modulenounzip}). - -@item -Run the command @command{boot} (@pxref{boot}). -@end enumerate - -Linux, FreeBSD, NetBSD and OpenBSD can be booted in a similar -manner. You load a kernel image with the command @command{kernel} and -then run the command @command{boot}. If the kernel requires some -parameters, just append the parameters to @command{kernel}, after the -file name of the kernel. Also, please refer to @ref{OS-specific notes}, -for information on your OS-specific issues. - - -@node Chain-loading -@subsection Load another boot loader to boot unsupported operating systems - -If you want to boot an unsupported operating system (e.g. Windows 95), -chain-load a boot loader for the operating system. Normally, the boot -loader is embedded in the @dfn{boot sector} of the partition on which -the operating system is installed. - -@enumerate -@item -Set GRUB's root device to the partition by the command -@command{rootnoverify} (@pxref{rootnoverify}): - -@example -grub> @kbd{rootnoverify (hd0,0)} -@end example - -@item -Set the @dfn{active} flag in the partition using the command -@command{makeactive}@footnote{This is not necessary for most of the -modern operating systems.} (@pxref{makeactive}): - -@example -grub> @kbd{makeactive} -@end example - -@item -Load the boot loader with the command @command{chainloader} -(@pxref{chainloader}): - -@example -grub> @kbd{chainloader +1} -@end example - -@samp{+1} indicates that GRUB should read one sector from the start of -the partition. The complete description about this syntax can be found -in @ref{Block list syntax}. - -@item -Run the command @command{boot} (@pxref{boot}). -@end enumerate - -However, DOS and Windows have some deficiencies, so you might have to -use more complicated instructions. @xref{DOS/Windows}, for more -information. - - -@node OS-specific notes -@section Some caveats on OS-specific issues - -Here, we describe some caveats on several operating systems. - -@menu -* GNU/Hurd:: -* GNU/Linux:: -* FreeBSD:: -* NetBSD:: -* OpenBSD:: -* DOS/Windows:: -* SCO UnixWare:: -* QNX:: -@end menu - - -@node GNU/Hurd -@subsection GNU/Hurd - -Since GNU/Hurd is Multiboot-compliant, it is easy to boot it; there is -nothing special about it. But do not forget that you have to specify a -root partition to the kernel. - -@enumerate -@item -Set GRUB's root device to the same drive as GNU/Hurd's. Probably the -command @code{find /boot/gnumach} or similar can help you -(@pxref{find}). - -@item -Load the kernel and the module, like this: - -@example -@group -grub> @kbd{kernel /boot/gnumach root=hd0s1} -grub> @kbd{module /boot/serverboot} -@end group -@end example - -@item -Run the command @command{boot} (@pxref{boot}). -@end enumerate - - -@node GNU/Linux -@subsection GNU/Linux - -It is relatively easy to boot GNU/Linux from GRUB, because it somewhat -resembles to boot a Multiboot-compliant OS. - -@enumerate -@item -Set GRUB's root device to the same drive as GNU/Linux's. Probably the -command @code{find /vmlinuz} or similar can help you (@pxref{find}). - -@item -Load the kernel: - -@example -grub> @kbd{kernel /vmlinuz root=/dev/hda1} -@end example - -If you need to specify some kernel parameters, just append them to the -command. For example, to set @option{vga} to @samp{ext}, do this: - -@example -grub> @kbd{kernel /vmlinuz root=/dev/hda1 vga=ext} -@end example - -See the documentation in the Linux source tree for complete -information on the available options. - -@item -If you use an initrd, execute the command @command{initrd} -(@pxref{initrd}) after @command{kernel}: - -@example -grub> @kbd{initrd /initrd} -@end example - -@item -Finally, run the command @command{boot} (@pxref{boot}). -@end enumerate - -@strong{Caution:} If you use an initrd and specify the @samp{mem=} -option to the kernel to let it use less than actual memory size, you -will also have to specify the same memory size to GRUB. To let GRUB know -the size, run the command @command{uppermem} @emph{before} loading the -kernel. @xref{uppermem}, for more information. - - -@node FreeBSD -@subsection FreeBSD - -GRUB can load the kernel directly, either in ELF or a.out format. But -this is not recommended, since FreeBSD's bootstrap interface sometimes -changes heavily, so GRUB can't guarantee to pass kernel parameters -correctly. - -Thus, we'd recommend loading the very flexible loader -@file{/boot/loader} instead. See this example: - -@example -@group -grub> @kbd{root (hd0,a)} -grub> @kbd{kernel /boot/loader} -grub> @kbd{boot} -@end group -@end example - - -@node NetBSD -@subsection NetBSD - -GRUB can load NetBSD a.out and ELF directly, follow these steps: - -@enumerate -@item -Set GRUB's root device with @command{root} (@pxref{root}). - -@item -Load the kernel with @command{kernel} (@pxref{kernel}). You should -append the ugly option @option{--type=netbsd}, if you want to load an -ELF kernel, like this: - -@example -grub> @kbd{kernel --type=netbsd /netbsd-elf} -@end example - -@item -Run @command{boot} (@pxref{boot}). -@end enumerate - -For now, however, GRUB doesn't allow you to pass kernel parameters, so -it may be better to chain-load it instead. For more information, please -see @ref{Chain-loading}. - - -@node OpenBSD -@subsection OpenBSD - -The booting instruction is exactly the same as for NetBSD -(@pxref{NetBSD}). - - -@node DOS/Windows -@subsection DOS/Windows - -GRUB cannot boot DOS or Windows directly, so you must chain-load them -(@pxref{Chain-loading}). However, their boot loaders have some critical -deficiencies, so it may not work to just chain-load them. To overcome -the problems, GRUB provides you with two helper functions. - -If you have installed DOS (or Windows) on a non-first hard disk, you -have to use the disk swapping technique, because that OS cannot boot -from any disks but the first one. The workaround used in GRUB is the -command @command{map} (@pxref{map}), like this: - -@example -@group -grub> @kbd{map (hd0) (hd1)} -grub> @kbd{map (hd1) (hd0)} -@end group -@end example - -This performs a @dfn{virtual} swap between your first and second hard -drive. - -@strong{Caution:} This is effective only if DOS (or Windows) uses BIOS -to access the swapped disks. If that OS uses a special driver for the -disks, this probably won't work. - -Another problem arises if you installed more than one set of DOS/Windows -onto one disk, because they could be confused if there are more than one -primary partitions for DOS/Windows. Certainly you should avoid doing -this, but there is a solution if you do want to do so. Use the partition -hiding/unhiding technique. - -If GRUB @dfn{hide}s a DOS (or Windows) partition (@pxref{hide}), DOS (or -Windows) will ignore the partition. If GRUB @dfn{unhide}s a DOS (or -Windows) partition (@pxref{unhide}), DOS (or Windows) will detect the -partition. Thus, if you have installed DOS (or Windows) on the first -and the second partition of the first hard disk, and you want to boot -the copy on the first partition, do the following: - -@example -@group -grub> @kbd{unhide (hd0,0)} -grub> @kbd{hide (hd0,1)} -grub> @kbd{rootnoverify (hd0,0)} -grub> @kbd{chainloader +1} -grub> @kbd{makeactive} -grub> @kbd{boot} -@end group -@end example - - -@node SCO UnixWare -@subsection SCO UnixWare - -It is known that the signature in the boot loader for SCO UnixWare is -wrong, so you will have to specify the option @option{--force} to -@command{chainloader} (@pxref{chainloader}), like this: - -@example -@group -grub> @kbd{rootnoverify (hd1,0)} -grub> @kbd{chainloader --force +1} -grub> @kbd{makeactive} -grub> @kbd{boot} -@end group -@end example - - -@node QNX -@subsection QNX - -QNX seems to use a bigger boot loader, so you need to boot it up, like -this: - -@example -@group -grub> @kbd{rootnoverify (hd1,1)} -grub> @kbd{chainloader +4} -grub> @kbd{boot} -@end group -@end example - - -@node Making your system robust -@section How to make your system robust - -When you test a new kernel or a new OS, it is important to make sure -that your computer can boot even if the new system is unbootable. This -is crucial especially if you maintain servers or remote systems. To -accomplish this goal, you need to set up two things: - -@enumerate -@item -You must maintain a system which is always bootable. For instance, if -you test a new kernel, you need to keep a working kernel in a -different place. And, it would sometimes be very nice to even have a -complete copy of a working system in a different partition or disk. - -@item -You must direct GRUB to boot a working system when the new system -fails. This is possible with the @dfn{fallback} system in GRUB. -@end enumerate - -The former requirement is very specific to each OS, so this -documentation does not cover that topic. It is better to consult some -backup tools. - -So let's see the GRUB part. There are two possibilities: one of them -is quite simple but not very robust, and the other is a bit complex to -set up but probably the best solution to make sure that your system -can start as long as GRUB itself is bootable. - -@menu -* Booting once-only:: -* Booting fallback systems:: -@end menu - - -@node Booting once-only -@subsection Booting once-only - -You can teach GRUB to boot an entry only at next boot time. Suppose -that your have an old kernel @file{old_kernel} and a new kernel -@file{new_kernel}. You know that @file{old_kernel} can boot -your system correctly, and you want to test @file{new_kernel}. - -To ensure that your system will go back to the old kernel even if the -new kernel fails (e.g. it panics), you can specify that GRUB should -try the new kernel only once and boot the old kernel after that. - -First, modify your configuration file. Here is an example: - -@example -@group -default saved # This is important!!! -timeout 10 - -title the old kernel -root (hd0,0) -kernel /old_kernel -savedefault - -title the new kernel -root (hd0,0) -kernel /new_kernel -savedefault 0 # This is important!!! -@end group -@end example - -Note that this configuration file uses @samp{default saved} -(@pxref{default}) at the head and @samp{savedefault 0} -(@pxref{savedefault}) in the entry for the new kernel. This means -that GRUB boots a saved entry by default, and booting the entry for the -new kernel saves @samp{0} as the saved entry. - -With this configuration file, after all, GRUB always tries to boot the -old kernel after it booted the new one, because @samp{0} is the entry -of @code{the old kernel}. - -The next step is to tell GRUB to boot the new kernel at next boot -time. For this, execute @command{grub-set-default} (@pxref{Invoking -grub-set-default}): - -@example -# @kbd{grub-set-default 1} -@end example - -This command sets the saved entry to @samp{1}, that is, to the new -kernel. - -This method is useful, but still not very robust, because GRUB stops -booting, if there is any error in the boot entry, such that the new -kernel has an invalid executable format. Thus, it it even better to -use the @dfn{fallback} mechanism of GRUB. Look at next subsection for -this feature. - - -@node Booting fallback systems -@subsection Booting fallback systems - -GRUB supports a fallback mechanism of booting one or more other -entries if a default boot entry fails. You can specify multiple -fallback entries if you wish. - -Suppose that you have three systems, @samp{A}, @samp{B} and -@samp{C}. @samp{A} is a system which you want to boot by -default. @samp{B} is a backup system which is supposed to boot -safely. @samp{C} is another backup system which is used in case where -@samp{B} is broken. - -Then you may want GRUB to boot the first system which is bootable -among @samp{A}, @samp{B} and @samp{C}. A configuration file can be -written in this way: - -@example -@group -default saved # This is important!!! -timeout 10 -fallback 1 2 # This is important!!! - -title A -root (hd0,0) -kernel /kernel -savedefault fallback # This is important!!! - -title B -root (hd1,0) -kernel /kernel -savedefault fallback # This is important!!! - -title C -root (hd2,0) -kernel /kernel -savedefault -@end group -@end example - -Note that @samp{default saved} (@pxref{default}), @samp{fallback 1 2} -and @samp{savedefault fallback} are used. GRUB will boot a saved entry -by default and save a fallback entry as next boot entry with this -configuration. - -When GRUB tries to boot @samp{A}, GRUB saves @samp{1} as next boot -entry, because the command @command{fallback} specifies that @samp{1} -is the first fallback entry. The entry @samp{1} is @samp{B}, so GRUB -will try to boot @samp{B} at next boot time. - -Likewise, when GRUB tries to boot @samp{B}, GRUB saves @samp{2} as -next boot entry, because @command{fallback} specifies @samp{2} as next -fallback entry. This makes sure that GRUB will boot @samp{C} after -booting @samp{B}. - -It is noteworthy that GRUB uses fallback entries both when GRUB -itself fails in booting an entry and when @samp{A} or @samp{B} fails -in starting up your system. So this solution ensures that your system -is started even if GRUB cannot find your kernel or if your kernel -panics. - -However, you need to run @command{grub-set-default} (@pxref{Invoking -grub-set-default}) when @samp{A} starts correctly or you fix @samp{A} -after it crashes, since GRUB always sets next boot entry to a fallback -entry. You should run this command in a startup script such as -@file{rc.local} to boot @samp{A} by default: - -@example -# @kbd{grub-set-default 0} -@end example - -where @samp{0} is the number of the boot entry for the system -@samp{A}. - -If you want to see what is current default entry, you can look at the -file @file{/boot/grub/default} (or @file{/grub/default} in -some systems). Because this file is plain-text, you can just -@command{cat} this file. But it is strongly recommended @strong{not to -modify this file directly}, because GRUB may fail in saving a default -entry in this file, if you change this file in an unintended -manner. Therefore, you should use @command{grub-set-default} when you -need to change the default entry. - - -@node Configuration -@chapter Configuration - -You've probably noticed that you need to type several commands to boot your -OS. There's a solution to that - GRUB provides a menu interface -(@pxref{Menu interface}) from which you can select an item (using arrow -keys) that will do everything to boot an OS. - -To enable the menu, you need a configuration file, -@file{menu.lst} under the boot directory. We'll analyze an example -file. - -The file first contains some general settings, the menu interface -related options. You can put these commands (@pxref{Menu-specific -commands}) before any of the items (starting with @command{title} -(@pxref{title})). - -@example -@group -# -# Sample boot menu configuration file -# -@end group -@end example - -As you may have guessed, these lines are comments. Lines starting with a -hash character (@samp{#}), and blank lines, are ignored by GRUB. - -@example -@group -# By default, boot the first entry. -default 0 -@end group -@end example - -The first entry (here, counting starts with number zero, not one!) will -be the default choice. - -@example -@group -# Boot automatically after 30 secs. -timeout 30 -@end group -@end example - -As the comment says, GRUB will boot automatically in 30 seconds, unless -interrupted with a keypress. - -@example -@group -# Fallback to the second entry. -fallback 1 -@end group -@end example - -If, for any reason, the default entry doesn't work, fall back to the -second one (this is rarely used, for obvious reasons). - -Note that the complete descriptions of these commands, which are menu -interface specific, can be found in @ref{Menu-specific -commands}. Other descriptions can be found in @ref{Commands}. - -Now, on to the actual OS definitions. You will see that each entry -begins with a special command, @command{title} (@pxref{title}), and the -action is described after it. Note that there is no command -@command{boot} (@pxref{boot}) at the end of each item. That is because -GRUB automatically executes @command{boot} if it loads other commands -successfully. - -The argument for the command @command{title} is used to display a short -title/description of the entry in the menu. Since @command{title} -displays the argument as is, you can write basically anything there. - -@example -@group -# For booting GNU/Hurd -title GNU/Hurd -root (hd0,0) -kernel /boot/gnumach.gz root=hd0s1 -module /boot/serverboot.gz -@end group -@end example - -This boots GNU/Hurd from the first hard disk. - -@example -@group -# For booting GNU/Linux -title GNU/Linux -kernel (hd1,0)/vmlinuz root=/dev/hdb1 -@end group -@end example - -This boots GNU/Linux, but from the second hard disk. - -@example -@group -# For booting Mach (getting kernel from floppy) -title Utah Mach4 multiboot -root (hd0,2) -pause Insert the diskette now^G!! -kernel (fd0)/boot/kernel root=hd0s3 -module (fd0)/boot/bootstrap -@end group -@end example - -This boots Mach with a kernel on a floppy, but the root filesystem at -hd0s3. It also contains a @command{pause} line (@pxref{pause}), which -will cause GRUB to display a prompt and delay, before actually executing -the rest of the commands and booting. - -@example -@group -# For booting FreeBSD -title FreeBSD -root (hd0,2,a) -kernel /boot/loader -@end group -@end example - -This item will boot FreeBSD kernel loaded from the @samp{a} partition of -the third @sc{pc} slice of the first hard disk. - -@example -@group -# For booting OS/2 -title OS/2 -root (hd0,1) -makeactive -# chainload OS/2 bootloader from the first sector -chainloader +1 -# This is similar to "chainload", but loads a specific file -#chainloader /boot/chain.os2 -@end group -@end example - -This will boot OS/2, using a chain-loader (@pxref{Chain-loading}). - -@example -@group -# For booting Windows NT or Windows95 -title Windows NT / Windows 95 boot menu -root (hd0,0) -makeactive -chainloader +1 -# For loading DOS if Windows NT is installed -# chainload /bootsect.dos -@end group -@end example - -The same as the above, but for Windows. - -@example -@group -# For installing GRUB into the hard disk -title Install GRUB into the hard disk -root (hd0,0) -setup (hd0) -@end group -@end example - -This will just (re)install GRUB onto the hard disk. - -@example -# Change the colors. -title Change the colors -color light-green/brown blink-red/blue -@end example - -In the last entry, the command @command{color} is used (@pxref{color}), -to change the menu colors (try it!). This command is somewhat special, -because it can be used both in the command-line and in the menu. GRUB -has several such commands, see @ref{General commands}. - -We hope that you now understand how to use the basic features of -GRUB. To learn more about GRUB, see the following chapters. - - -@node Network -@chapter Downloading OS images from a network - -Although GRUB is a disk-based boot loader, it does provide network -support. To use the network support, you need to enable at least one -network driver in the GRUB build process. For more information please -see @file{netboot/README.netboot} in the source distribution. - -@menu -* General usage of network support:: -* Diskless:: -@end menu - - -@node General usage of network support -@section How to set up your network - -GRUB requires a file server and optionally a server that will assign an -IP address to the machine on which GRUB is running. For the former, only -TFTP is supported at the moment. The latter is either BOOTP, DHCP or a -RARP server@footnote{RARP is not advised, since it cannot serve much -information}. It is not necessary to run both the servers on one -computer. How to configure these servers is beyond the scope of this -document, so please refer to the manuals specific to those -protocols/servers. - -If you decided to use a server to assign an IP address, set up the -server and run @command{bootp} (@pxref{bootp}), @command{dhcp} -(@pxref{dhcp}) or @command{rarp} (@pxref{rarp}) for BOOTP, DHCP or RARP, -respectively. Each command will show an assigned IP address, a netmask, -an IP address for your TFTP server and a gateway. If any of the -addresses is wrong or it causes an error, probably the configuration of -your servers isn't set up properly. - -Otherwise, run @command{ifconfig}, like this: - -@example -grub> @kbd{ifconfig --address=192.168.110.23 --server=192.168.110.14} -@end example - -You can also use @command{ifconfig} in conjuction with @command{bootp}, -@command{dhcp} or @command{rarp} (e.g. to reassign the server address -manually). @xref{ifconfig}, for more details. - -Finally, download your OS images from your network. The network can be -accessed using the network drive @samp{(nd)}. Everything else is very -similar to the normal instructions (@pxref{Booting}). - -Here is an example: - -@example -@group -grub> @kbd{bootp} -Probing... [NE*000] -NE2000 base ... -Address: 192.168.110.23 Netmask: 255.255.255.0 -Server: 192.168.110.14 Gateway: 192.168.110.1 - -grub> @kbd{root (nd)} -grub> @kbd{kernel /tftproot/gnumach.gz root=sd0s1} -grub> @kbd{module /tftproot/serverboot.gz} -grub> @kbd{boot} -@end group -@end example - - -@node Diskless -@section Booting from a network - -It is sometimes very useful to boot from a network, especially when you -use a machine which has no local disk. In this case, you need to obtain -a kind of Net Boot @sc{rom}, such as a PXE @sc{rom} or a free software -package like Etherboot. Such a Boot @sc{rom} first boots the machine, -sets up the network card installed into the machine, and downloads a -second stage boot image from the network. Then, the second image will -try to boot an operating system actually from the network. - -GRUB provides two second stage images, @file{nbgrub} and -@file{pxegrub} (@pxref{Images}). These images are the same as the -normal Stage 2, except that they set up a network automatically, and try -to load a configuration file from the network, if specified. The usage -is very simple: If the machine has a PXE @sc{rom}, use -@file{pxegrub}. If the machine has an NBI loader such as Etherboot, use -@file{nbgrub}. There is no difference between them except their -formats. Since the way to load a second stage image you want to use -should be described in the manual on your Net Boot @sc{rom}, please -refer to the manual, for more information. - -However, there is one thing specific to GRUB. Namely, how to specify a -configuration file in a BOOTP/DHCP server. For now, GRUB uses the tag -@samp{150}, to get the name of a configuration file. The following is an -example with a BOOTP configuration: - -@example -@group -.allhost:hd=/tmp:bf=null:\ - :ds=145.71.35.1 145.71.32.1:\ - :sm=255.255.254.0:\ - :gw=145.71.35.1:\ - :sa=145.71.35.5: - -foo:ht=1:ha=63655d0334a7:ip=145.71.35.127:\ - :bf=/nbgrub:\ - :tc=.allhost:\ - :T150="(nd)/tftpboot/menu.lst.foo": -@end group -@end example - -Note that you should specify the drive name @code{(nd)} in the name of -the configuration file. This is because you might change the root drive -before downloading the configuration from the TFTP server when the -preset menu feature is used (@pxref{Preset Menu}). - -GRUB sends the string "GRUBClient" as its vendor class identifier to -the BOOTP/DHCP server. This can be used to generate answers specific -to GRUB clients on your network. - -See the manual of your BOOTP/DHCP server for more information. The -exact syntax should differ a little from the example. - -@node Serial terminal -@chapter Using GRUB via a serial line - -This chapter describes how to use the serial terminal support in GRUB. - -If you have many computers or computers with no display/keyboard, it -could be very useful to control the computers through serial -communications. To connect one computer with another via a serial line, -you need to prepare a null-modem (cross) serial cable, and you may need -to have multiport serial boards, if your computer doesn't have extra -serial ports. In addition, a terminal emulator is also required, such as -minicom. Refer to a manual of your operating system, for more -information. - -As for GRUB, the instruction to set up a serial terminal is quite -simple. First of all, make sure that you haven't specified the option -@option{--disable-serial} to the configure script when you built your -GRUB images. If you get them in binary form, probably they have serial -terminal support already. - -Then, initialize your serial terminal after GRUB starts up. Here is an -example: - -@example -@group -grub> @kbd{serial --unit=0 --speed=9600} -grub> @kbd{terminal serial} -@end group -@end example - -The command @command{serial} initializes the serial unit 0 with the -speed 9600bps. The serial unit 0 is usually called @samp{COM1}, so, if -you want to use COM2, you must specify @samp{--unit=1} instead. This -command accepts many other options, so please refer to @ref{serial}, -for more details. - -The command @command{terminal} (@pxref{terminal}) chooses which type of -terminal you want to use. In the case above, the terminal will be a -serial terminal, but you can also pass @code{console} to the command, -as @samp{terminal serial console}. In this case, a terminal in which -you press any key will be selected as a GRUB terminal. - -However, note that GRUB assumes that your terminal emulator is -compatible with VT100 by default. This is true for most terminal -emulators nowadays, but you should pass the option @option{--dumb} to -the command if your terminal emulator is not VT100-compatible or -implements few VT100 escape sequences. If you specify this option then -GRUB provides you with an alternative menu interface, because the normal -menu requires several fancy features of your terminal. - - -@node Preset Menu -@chapter Embedding a configuration file into GRUB - -GRUB supports a @dfn{preset menu} which is to be always loaded before -starting. The preset menu feature is useful, for example, when your -computer has no console but a serial cable. In this case, it is -critical to set up the serial terminal as soon as possible, since you -cannot see any message until the serial terminal begins to work. So it -is good to run the commands @command{serial} (@pxref{serial}) and -@command{terminal} (@pxref{terminal}) before anything else at the -start-up time. - -How the preset menu works is slightly complicated: - -@enumerate -@item -GRUB checks if the preset menu feature is used, and loads the preset -menu, if available. This includes running commands and reading boot -entries, like an ordinary configuration file. - -@item -GRUB checks if the configuration file is available. Note that this check -is performed @strong{regardless of the existence of the preset -menu}. The configuration file is loaded even if the preset menu was -loaded. - -@item -If the preset menu includes any boot entries, they are cleared when -the configuration file is loaded. It doesn't matter whether the -configuration file has any entries or no entry. The boot entries in the -preset menu are used only when GRUB fails in loading the configuration -file. -@end enumerate - -To enable the preset menu feature, you must rebuild GRUB specifying a -file to the configure script with the option -@option{--enable-preset-menu}. The file has the same semantics as -normal configuration files (@pxref{Configuration}). - -Another point you should take care is that the diskless support -(@pxref{Diskless}) diverts the preset menu. Diskless images embed a -preset menu to execute the command @command{bootp} (@pxref{bootp}) -automatically, unless you specify your own preset menu to the configure -script. This means that you must put commands to initialize a network in -the preset menu yourself, because diskless images don't set it up -implicitly, when you use the preset menu explicitly. - -Therefore, a typical preset menu used with diskless support would be -like this: - -@example -@group -# Set up the serial terminal, first of all. -serial --unit=0 --speed=19200 -terminal --timeout=0 serial - -# Initialize the network. -dhcp -@end group -@end example - - -@node Security -@chapter Protecting your computer from cracking - -You may be interested in how to prevent ordinary users from doing -whatever they like, if you share your computer with other people. So -this chapter describes how to improve the security of GRUB. - -One thing which could be a security hole is that the user can do too -many things with GRUB, because GRUB allows one to modify its configuration -and run arbitrary commands at run-time. For example, the user can even -read @file{/etc/passwd} in the command-line interface by the command -@command{cat} (@pxref{cat}). So it is necessary to disable all the -interactive operations. - -Thus, GRUB provides a @dfn{password} feature, so that only administrators -can start the interactive operations (i.e. editing menu entries and -entering the command-line interface). To use this feature, you need to -run the command @command{password} in your configuration file -(@pxref{password}), like this: - -@example -password --md5 PASSWORD -@end example - -If this is specified, GRUB disallows any interactive control, until you -press the key @key{p} and enter a correct password. The option -@option{--md5} tells GRUB that @samp{PASSWORD} is in MD5 format. If it -is omitted, GRUB assumes the @samp{PASSWORD} is in clear text. - -You can encrypt your password with the command @command{md5crypt} -(@pxref{md5crypt}). For example, run the grub shell (@pxref{Invoking the -grub shell}), and enter your password: - -@example -@group -grub> md5crypt -Password: ********** -Encrypted: $1$U$JK7xFegdxWH6VuppCUSIb. -@end group -@end example - -Then, cut and paste the encrypted password to your configuration file. - -Also, you can specify an optional argument to @command{password}. See -this example: - -@example -password PASSWORD /boot/grub/menu-admin.lst -@end example - -In this case, GRUB will load @file{/boot/grub/menu-admin.lst} as a -configuration file when you enter the valid password. - -Another thing which may be dangerous is that any user can choose any -menu entry. Usually, this wouldn't be problematic, but you might want to -permit only administrators to run some of your menu entries, such as an -entry for booting an insecure OS like DOS. - -GRUB provides the command @command{lock} (@pxref{lock}). This command -always fails until you enter the valid password, so you can use it, like -this: - -@example -@group -title Boot DOS -lock -rootnoverify (hd0,1) -makeactive -chainload +1 -@end group -@end example - -You should insert @command{lock} right after @command{title}, because -any user can execute commands in an entry until GRUB encounters -@command{lock}. - -You can also use the command @command{password} instead of -@command{lock}. In this case the boot process will ask for the password -and stop if it was entered incorrectly. Since the @command{password} -takes its own @var{PASSWORD} argument this is useful if you want -different passwords for different entries. - - -@node Images -@chapter GRUB image files - -GRUB consists of several images: two essential stages, optional stages -called @dfn{Stage 1.5}, one image for bootable CD-ROM, and two network -boot images. Here is a short overview of them. @xref{Internals}, for -more details. - -@table @file -@item stage1 -This is an essential image used for booting up GRUB. Usually, this is -embedded in an MBR or the boot sector of a partition. Because a PC boot -sector is 512 bytes, the size of this image is exactly 512 bytes. - -All @file{stage1} must do is to load Stage 2 or Stage 1.5 from a local -disk. Because of the size restriction, @file{stage1} encodes the -location of Stage 2 (or Stage 1.5) in a block list format, so it never -understand any filesystem structure. - -@item stage2 -This is the core image of GRUB. It does everything but booting up -itself. Usually, this is put in a filesystem, but that is not required. - -@item e2fs_stage1_5 -@itemx fat_stage1_5 -@itemx ffs_stage1_5 -@itemx jfs_stage1_5 -@itemx minix_stage1_5 -@itemx reiserfs_stage1_5 -@itemx vstafs_stage1_5 -@itemx xfs_stage1_5 - -These are called @dfn{Stage 1.5}, because they serve as a bridge -between @file{stage1} and @file{stage2}, that is to say, Stage 1.5 is -loaded by Stage 1 and Stage 1.5 loads Stage 2. The difference between -@file{stage1} and @file{*_stage1_5} is that the former doesn't -understand any filesystem while the latter understands one filesystem -(e.g. @file{e2fs_stage1_5} understands ext2fs). So you can move the -Stage 2 image to another location safely, even after GRUB has been -installed. - -While Stage 2 cannot generally be embedded in a fixed area as the size -is so large, Stage 1.5 can be installed into the area right after an MBR, -or the boot loader area of a ReiserFS or a FFS. - -@item stage2_eltorito -This is a boot image for CD-ROMs using the @dfn{no emulation mode} in -El Torito specification. This is identical to Stage 2, except that -this boots up without Stage 1 and sets up a special drive @samp{(cd)}. - -@item nbgrub -This is a network boot image for the Network Image Proposal used by some -network boot loaders, such as Etherboot. This is mostly the same as -Stage 2, but it also sets up a network and loads a configuration file -from the network. - -@item pxegrub -This is another network boot image for the Preboot Execution Environment -used by several Netboot ROMs. This is identical to @file{nbgrub}, except -for the format. -@end table - - -@node Filesystem -@chapter Filesystem syntax and semantics - -GRUB uses a special syntax for specifying disk drives which can be -accessed by BIOS. Because of BIOS limitations, GRUB cannot distinguish -between IDE, ESDI, SCSI, or others. You must know yourself which BIOS -device is equivalent to which OS device. Normally, that will be clear if -you see the files in a device or use the command @command{find} -(@pxref{find}). - -@menu -* Device syntax:: How to specify devices -* File name syntax:: How to specify files -* Block list syntax:: How to specify block lists -@end menu - - -@node Device syntax -@section How to specify devices - -The device syntax is like this: - -@example -@code{(@var{device}[,@var{part-num}][,@var{bsd-subpart-letter}])} -@end example - -@samp{[]} means the parameter is optional. @var{device} should be -either @samp{fd} or @samp{hd} followed by a digit, like @samp{fd0}. -But you can also set @var{device} to a hexadecimal or a decimal number -which is a BIOS drive number, so the following are equivalent: - -@example -(hd0) -(0x80) -(128) -@end example - -@var{part-num} represents the partition number of @var{device}, starting -from zero for primary partitions and from four for extended partitions, -and @var{bsd-subpart-letter} represents the BSD disklabel subpartition, -such as @samp{a} or @samp{e}. - -A shortcut for specifying BSD subpartitions is -@code{(@var{device},@var{bsd-subpart-letter})}, in this case, GRUB -searches for the first PC partition containing a BSD disklabel, then -finds the subpartition @var{bsd-subpart-letter}. Here is an example: - -@example -(hd0,a) -@end example - -The syntax @samp{(hd0)} represents using the entire disk (or the -MBR when installing GRUB), while the syntax @samp{(hd0,0)} -represents using the first partition of the disk (or the boot sector -of the partition when installing GRUB). - -If you enabled the network support, the special drive, @samp{(nd)}, is -also available. Before using the network drive, you must initialize the -network. @xref{Network}, for more information. - -If you boot GRUB from a CD-ROM, @samp{(cd)} is available. @xref{Making -a GRUB bootable CD-ROM}, for details. - - -@node File name syntax -@section How to specify files - -There are two ways to specify files, by @dfn{absolute file name} and by -@dfn{block list}. - -An absolute file name resembles a Unix absolute file name, using -@samp{/} for the directory separator (not @samp{\} as in DOS). One -example is @samp{(hd0,0)/boot/grub/menu.lst}. This means the file -@file{/boot/grub/menu.lst} in the first partition of the first hard -disk. If you omit the device name in an absolute file name, GRUB uses -GRUB's @dfn{root device} implicitly. So if you set the root device to, -say, @samp{(hd1,0)} by the command @command{root} (@pxref{root}), then -@code{/boot/kernel} is the same as @code{(hd1,0)/boot/kernel}. - - -@node Block list syntax -@section How to specify block lists - -A block list is used for specifying a file that doesn't appear in the -filesystem, like a chainloader. The syntax is -@code{[@var{offset}]+@var{length}[,[@var{offset}]+@var{length}]@dots{}}. -Here is an example: - -@example -@code{0+100,200+1,300+300} -@end example - -This represents that GRUB should read blocks 0 through 99, block 200, -and blocks 300 through 599. If you omit an offset, then GRUB assumes -the offset is zero. - -Like the file name syntax (@pxref{File name syntax}), if a blocklist -does not contain a device name, then GRUB uses GRUB's @dfn{root -device}. So @code{(hd0,1)+1} is the same as @code{+1} when the root -device is @samp{(hd0,1)}. - - -@node Interface -@chapter GRUB's user interface - -GRUB has both a simple menu interface for choosing preset entries from a -configuration file, and a highly flexible command-line for performing -any desired combination of boot commands. - -GRUB looks for its configuration file as soon as it is loaded. If one -is found, then the full menu interface is activated using whatever -entries were found in the file. If you choose the @dfn{command-line} menu -option, or if the configuration file was not found, then GRUB drops to -the command-line interface. - -@menu -* Command-line interface:: The flexible command-line interface -* Menu interface:: The simple menu interface -* Menu entry editor:: Editing a menu entry -* Hidden menu interface:: The hidden menu interface -@end menu - - -@node Command-line interface -@section The flexible command-line interface - -The command-line interface provides a prompt and after it an editable -text area much like a command-line in Unix or DOS. Each command is -immediately executed after it is entered@footnote{However, this -behavior will be changed in the future version, in a user-invisible -way.}. The commands (@pxref{Command-line and menu entry commands}) are a -subset of those available in the configuration file, used with exactly -the same syntax. - -Cursor movement and editing of the text on the line can be done via a -subset of the functions available in the Bash shell: - -@table @key -@item C-f -@itemx PC right key -Move forward one character. - -@item C-b -@itemx PC left key -Move back one character. - -@item C-a -@itemx HOME -Move to the start of the line. - -@item C-e -@itemx END -Move the the end of the line. - -@item C-d -@itemx DEL -Delete the character underneath the cursor. - -@item C-h -@itemx BS -Delete the character to the left of the cursor. - -@item C-k -Kill the text from the current cursor position to the end of the line. - -@item C-u -Kill backward from the cursor to the beginning of the line. - -@item C-y -Yank the killed text back into the buffer at the cursor. - -@item C-p -@itemx PC up key -Move up through the history list. - -@item C-n -@itemx PC down key -Move down through the history list. -@end table - -When typing commands interactively, if the cursor is within or before -the first word in the command-line, pressing the @key{TAB} key (or -@key{C-i}) will display a listing of the available commands, and if the -cursor is after the first word, the @kbd{@key{TAB}} will provide a -completion listing of disks, partitions, and file names depending on the -context. Note that to obtain a list of drives, one must open a -parenthesis, as @command{root (}. - -Note that you cannot use the completion functionality in the TFTP -filesystem. This is because TFTP doesn't support file name listing for -the security. - - -@node Menu interface -@section The simple menu interface - -The menu interface is quite easy to use. Its commands are both -reasonably intuitive and described on screen. - -Basically, the menu interface provides a list of @dfn{boot entries} to -the user to choose from. Use the arrow keys to select the entry of -choice, then press @key{RET} to run it. An optional timeout is -available to boot the default entry (the first one if not set), which is -aborted by pressing any key. - -Commands are available to enter a bare command-line by pressing @key{c} -(which operates exactly like the non-config-file version of GRUB, but -allows one to return to the menu if desired by pressing @key{ESC}) or to -edit any of the @dfn{boot entries} by pressing @key{e}. - -If you protect the menu interface with a password (@pxref{Security}), -all you can do is choose an entry by pressing @key{RET}, or press -@key{p} to enter the password. - - -@node Menu entry editor -@section Editing a menu entry - -The menu entry editor looks much like the main menu interface, but the -lines in the menu are individual commands in the selected entry instead -of entry names. - -If an @key{ESC} is pressed in the editor, it aborts all the changes made -to the configuration entry and returns to the main menu interface. - -When a particular line is selected, the editor places the user in a -special version of the GRUB command-line to edit that line. When the -user hits @key{RET}, GRUB replaces the line in question in the boot -entry with the changes (unless it was aborted via @key{ESC}, -in which case the changes are thrown away). - -If you want to add a new line to the menu entry, press @key{o} if adding -a line after the current line or press @key{O} if before the current -line. - -To delete a line, hit the key @key{d}. Although GRUB unfortunately -does not support @dfn{undo}, you can do almost the same thing by just -returning to the main menu. - - -@node Hidden menu interface -@section The hidden menu interface - -When your terminal is dumb or you request GRUB to hide the menu -interface explicitly with the command @command{hiddenmenu} -(@pxref{hiddenmenu}), GRUB doesn't show the menu interface (@pxref{Menu -interface}) and automatically boots the default entry, unless -interrupted by pressing @key{ESC}. - -When you interrupt the timeout and your terminal is dumb, GRUB falls -back to the command-line interface (@pxref{Command-line interface}). - - -@node Commands -@chapter The list of available commands - -In this chapter, we list all commands that are available in GRUB. - -Commands belong to different groups. A few can only be used in -the global section of the configuration file (or ``menu''); most -of them can be entered on the command-line and can be used either -anywhere in the menu or specifically in the menu entries. - -@menu -* Menu-specific commands:: -* General commands:: -* Command-line and menu entry commands:: -@end menu - - -@node Menu-specific commands -@section The list of commands for the menu only - -The semantics used in parsing the configuration file are the following: - -@itemize @bullet -@item -The menu-specific commands have to be used before any others. - -@item -The files @emph{must} be in plain-text format. - -@item -@samp{#} at the beginning of a line in a configuration file means it is -only a comment. - -@item -Options are separated by spaces. - -@item -All numbers can be either decimal or hexadecimal. A hexadecimal number -must be preceded by @samp{0x}, and is case-insensitive. - -@item -Extra options or text at the end of the line are ignored unless otherwise -specified. - -@item -Unrecognized commands are added to the current entry, except before entries -start, where they are ignored. -@end itemize - -These commands can only be used in the menu: - -@menu -* default:: Set the default entry -* fallback:: Set the fallback entry -* hiddenmenu:: Hide the menu interface -* timeout:: Set the timeout -* title:: Start a menu entry -@end menu - - -@node default -@subsection default - -@deffn Command default num -Set the default entry to the entry number @var{num}. Numbering starts -from 0, and the entry number 0 is the default if the command is not -used. - -You can specify @samp{saved} instead of a number. In this case, the -default entry is the entry saved with the command -@command{savedefault}. @xref{savedefault}, for more information. -@end deffn - - -@node fallback -@subsection fallback - -@deffn Command fallback num... -Go into unattended boot mode: if the default boot entry has any errors, -instead of waiting for the user to do something, immediately start -over using the @var{num} entry (same numbering as the @code{default} -command (@pxref{default})). This obviously won't help if the machine was -rebooted by a kernel that GRUB loaded. You can specify multiple -fallback entry numbers. -@end deffn - - -@node hiddenmenu -@subsection hiddenmenu - -@deffn Command hiddenmenu -Don't display the menu. If the command is used, no menu will be -displayed on the control terminal, and the default entry will be -booted after the timeout expired. The user can still request the -menu to be displayed by pressing @key{ESC} before the timeout -expires. See also @ref{Hidden menu interface}. -@end deffn - - -@node timeout -@subsection timeout - -@deffn Command timeout sec -Set a timeout, in @var{sec} seconds, before automatically booting the -default entry (normally the first entry defined). -@end deffn - - -@node title -@subsection title - -@deffn Command title name @dots{} -Start a new boot entry, and set its name to the contents of the rest of -the line, starting with the first non-space character. -@end deffn - - -@node General commands -@section The list of general commands - -Commands usable anywhere in the menu and in the command-line. - -@menu -* bootp:: Initialize a network device via BOOTP -* color:: Color the menu interface -* device:: Specify a file as a drive -* dhcp:: Initialize a network device via DHCP -* hide:: Hide a partition -* ifconfig:: Configure a network device manually -* pager:: Change the state of the internal pager -* partnew:: Make a primary partition -* parttype:: Change the type of a partition -* password:: Set a password for the menu interface -* rarp:: Initialize a network device via RARP -* serial:: Set up a serial device -* setkey:: Configure the key map -* terminal:: Choose a terminal -* terminfo:: Define escape sequences for a terminal -* tftpserver:: Specify a TFTP server -* unhide:: Unhide a partition -@end menu - - -@node bootp -@subsection bootp - -@deffn Command bootp [@option{--with-configfile}] -Initialize a network device via the @dfn{BOOTP} protocol. This command -is only available if GRUB is compiled with netboot support. See also -@ref{Network}. - -If you specify @option{--with-configfile} to this command, GRUB will -fetch and load a configuration file specified by your BOOTP server -with the vendor tag @samp{150}. -@end deffn - - -@node color -@subsection color - -@deffn Command color normal [highlight] -Change the menu colors. The color @var{normal} is used for most -lines in the menu (@pxref{Menu interface}), and the color -@var{highlight} is used to highlight the line where the cursor -points. If you omit @var{highlight}, then the inverted color of -@var{normal} is used for the highlighted line. The format of a color is -@code{@var{foreground}/@var{background}}. @var{foreground} and -@var{background} are symbolic color names. A symbolic color name must be -one of these: - -@itemize @bullet -@item -black - -@item -blue - -@item -green - -@item -cyan - -@item -red - -@item -magenta - -@item -brown - -@item -light-gray - -@strong{These below can be specified only for the foreground.} - -@item -dark-gray - -@item -light-blue - -@item -light-green - -@item -light-cyan - -@item -light-red - -@item -light-magenta - -@item -yellow - -@item -white -@end itemize - -But only the first eight names can be used for @var{background}. You can -prefix @code{blink-} to @var{foreground} if you want a blinking -foreground color. - -This command can be used in the configuration file and on the command -line, so you may write something like this in your configuration file: - -@example -@group -# Set default colors. -color light-gray/blue black/light-gray - -# Change the colors. -title OS-BS like -color magenta/blue black/magenta -@end group -@end example -@end deffn - - -@node device -@subsection device - -@deffn Command device drive file -In the grub shell, specify the file @var{file} as the actual drive for a -@sc{bios} drive @var{drive}. You can use this command to create a disk -image, and/or to fix the drives guessed by GRUB when GRUB fails to -determine them correctly, like this: - -@example -@group -grub> @kbd{device (fd0) /floppy-image} -grub> @kbd{device (hd0) /dev/sd0} -@end group -@end example - -This command can be used only in the grub shell (@pxref{Invoking the -grub shell}). -@end deffn - - -@node dhcp -@subsection dhcp - -@deffn Command dhcp [--with-configfile] -Initialize a network device via the @dfn{DHCP} protocol. Currently, -this command is just an alias for @command{bootp}, since the two -protocols are very similar. This command is only available if GRUB is -compiled with netboot support. See also @ref{Network}. - -If you specify @option{--with-configfile} to this command, GRUB will -fetch and load a configuration file specified by your DHCP server -with the vendor tag @samp{150}. -@end deffn - - -@node hide -@subsection hide - -@deffn Command hide partition -Hide the partition @var{partition} by setting the @dfn{hidden} bit in -its partition type code. This is useful only when booting DOS or Windows -and multiple primary FAT partitions exist in one disk. See also -@ref{DOS/Windows}. -@end deffn - - -@node ifconfig -@subsection ifconfig - -@deffn Command ifconfig [@option{--server=server}] [@option{--gateway=gateway}] [@option{--mask=mask}] [@option{--address=address}] -Configure the IP address, the netmask, the gateway, and the server -address of a network device manually. The values must be in dotted -decimal format, like @samp{192.168.11.178}. The order of the options is -not important. This command shows current network configuration, if no -option is specified. See also @ref{Network}. -@end deffn - - -@node pager -@subsection pager - -@deffn Command pager [flag] -Toggle or set the state of the internal pager. If @var{flag} is -@samp{on}, the internal pager is enabled. If @var{flag} is @samp{off}, -it is disabled. If no argument is given, the state is toggled. -@end deffn - - -@node partnew -@subsection partnew - -@deffn Command partnew part type from len -Create a new primary partition. @var{part} is a partition specification -in GRUB syntax (@pxref{Naming convention}); @var{type} is the partition -type and must be a number in the range @code{0-0xff}; @var{from} is -the starting address and @var{len} is the length, both in sector units. -@end deffn - - -@node parttype -@subsection parttype - -@deffn Command parttype part type -Change the type of an existing partition. @var{part} is a partition -specification in GRUB syntax (@pxref{Naming convention}); @var{type} -is the new partition type and must be a number in the range 0-0xff. -@end deffn - - -@node password -@subsection password - -@deffn Command password [@option{--md5}] passwd [new-config-file] -If used in the first section of a menu file, disable all interactive -editing control (menu entry editor and command-line) and entries -protected by the command @command{lock}. If the password @var{passwd} is -entered, it loads the @var{new-config-file} as a new config file and -restarts the GRUB Stage 2, if @var{new-config-file} is -specified. Otherwise, GRUB will just unlock the privileged instructions. -You can also use this command in the script section, in which case it -will ask for the password, before continuing. The option -@option{--md5} tells GRUB that @var{passwd} is encrypted with -@command{md5crypt} (@pxref{md5crypt}). -@end deffn - - -@node rarp -@subsection rarp - -@deffn Command rarp -Initialize a network device via the @dfn{RARP} protocol. This command -is only available if GRUB is compiled with netboot support. See also -@ref{Network}. -@end deffn - - -@node serial -@subsection serial - -@deffn Command serial [@option{--unit=unit}] [@option{--port=port}] [@option{--speed=speed}] [@option{--word=word}] [@option{--parity=parity}] [@option{--stop=stop}] [@option{--device=dev}] -Initialize a serial device. @var{unit} is a number in the range 0-3 -specifying which serial port to use; default is 0, which corresponds to -the port often called COM1. @var{port} is the I/O port where the UART -is to be found; if specified it takes precedence over @var{unit}. -@var{speed} is the transmission speed; default is 9600. @var{word} and -@var{stop} are the number of data bits and stop bits. Data bits must -be in the range 5-8 and stop bits must be 1 or 2. Default is 8 data -bits and one stop bit. @var{parity} is one of @samp{no}, @samp{odd}, -@samp{even} and defaults to @samp{no}. The option @option{--device} -can only be used in the grub shell and is used to specify the -tty device to be used in the host operating system (@pxref{Invoking the -grub shell}). - -The serial port is not used as a communication channel unless the -@command{terminal} command is used (@pxref{terminal}). - -This command is only available if GRUB is compiled with serial -support. See also @ref{Serial terminal}. -@end deffn - - -@node setkey -@subsection setkey - -@deffn Command setkey [to_key from_key] -Change the keyboard map. The key @var{from_key} is mapped to the key -@var{to_key}. If no argument is specified, reset key mappings. Note that -this command @emph{does not} exchange the keys. If you want to exchange -the keys, run this command again with the arguments exchanged, like this: - -@example -grub> @kbd{setkey capslock control} -grub> @kbd{setkey control capslock} -@end example - -A key must be an alphabet letter, a digit, or one of these symbols: -@samp{escape}, @samp{exclam}, @samp{at}, @samp{numbersign}, -@samp{dollar}, @samp{percent}, @samp{caret}, @samp{ampersand}, -@samp{asterisk}, @samp{parenleft}, @samp{parenright}, @samp{minus}, -@samp{underscore}, @samp{equal}, @samp{plus}, @samp{backspace}, -@samp{tab}, @samp{bracketleft}, @samp{braceleft}, @samp{bracketright}, -@samp{braceright}, @samp{enter}, @samp{control}, @samp{semicolon}, -@samp{colon}, @samp{quote}, @samp{doublequote}, @samp{backquote}, -@samp{tilde}, @samp{shift}, @samp{backslash}, @samp{bar}, @samp{comma}, -@samp{less}, @samp{period}, @samp{greater}, @samp{slash}, -@samp{question}, @samp{alt}, @samp{space}, @samp{capslock}, @samp{FX} -(@samp{X} is a digit), and @samp{delete}. This table describes to which -character each of the symbols corresponds: - -@table @samp -@item exclam -@samp{!} - -@item at -@samp{@@} - -@item numbersign -@samp{#} - -@item dollar -@samp{$} - -@item percent -@samp{%} - -@item caret -@samp{^} - -@item ampersand -@samp{&} - -@item asterisk -@samp{*} - -@item parenleft -@samp{(} - -@item parenright -@samp{)} - -@item minus -@samp{-} - -@item underscore -@samp{_} - -@item equal -@samp{=} - -@item plus -@samp{+} - -@item bracketleft -@samp{[} - -@item braceleft -@samp{@{} - -@item bracketright -@samp{]} - -@item braceright -@samp{@}} - -@item semicolon -@samp{;} - -@item colon -@samp{:} - -@item quote -@samp{'} - -@item doublequote -@samp{"} - -@item backquote -@samp{`} - -@item tilde -@samp{~} - -@item backslash -@samp{\} - -@item bar -@samp{|} - -@item comma -@samp{,} - -@item less -@samp{<} - -@item period -@samp{.} - -@item greater -@samp{>} - -@item slash -@samp{/} - -@item question -@samp{?} - -@item space -@samp{ } -@end table -@end deffn - - -@node terminal -@subsection terminal - -@deffn Command terminal [@option{--dumb}] [@option{--no-echo}] [@option{--no-edit}] [@option{--timeout=secs}] [@option{--lines=lines}] [@option{--silent}] [@option{console}] [@option{serial}] [@option{hercules}] -Select a terminal for user interaction. The terminal is assumed to be -VT100-compatible unless @option{--dumb} is specified. If both -@option{console} and @option{serial} are specified, then GRUB will use -the one where a key is entered first or the first when the timeout -expires. If neither are specified, the current setting is -reported. This command is only available if GRUB is compiled with serial -support. See also @ref{Serial terminal}. - -This may not make sense for most users, but GRUB supports Hercules -console as well. Hercules console is usable like the ordinary console, -and the usage is quite similar to that for serial terminals: specify -@option{hercules} as the argument. - -The option @option{--lines} defines the number of lines in your -terminal, and it is used for the internal pager function. If you don't -specify this option, the number is assumed as 24. - -The option @option{--silent} suppresses the message to prompt you to -hit any key. This might be useful if your system has no terminal -device. - -The option @option{--no-echo} has GRUB not to echo back input -characters. This implies the option @option{--no-edit}. - -The option @option{--no-edit} disables the BASH-like editing feature. -@end deffn - - -@node terminfo -@subsection terminfo - -@deffn Command terminfo @option{--name=name} @option{--cursor-address=seq} [@option{--clear-screen=seq}] [@option{--enter-standout-mode=seq}] [@option{--exit-standout-mode=seq}] -Define the capabilities of your terminal. Use this command to define -escape sequences, if it is not vt100-compatible. You may use @samp{\e} -for @key{ESC} and @samp{^X} for a control character. - -You can use the utility @command{grub-terminfo} to generate -appropriate arguments to this command. @xref{Invoking grub-terminfo}. - -If no option is specified, the current settings are printed. -@end deffn - - -@node tftpserver -@subsection tftpserver - -@deffn Command tftpserver ipaddr -@strong{Caution:} This command exists only for backward -compatibility. Use @command{ifconfig} (@pxref{ifconfig}) instead. - -Override a TFTP server address returned by a BOOTP/DHCP/RARP server. The -argument @var{ipaddr} must be in dotted decimal format, like -@samp{192.168.0.15}. This command is only available if GRUB is compiled -with netboot support. See also @ref{Network}. -@end deffn - - -@node unhide -@subsection unhide - -@deffn Command unhide partition -Unhide the partition @var{partition} by clearing the @dfn{hidden} bit in -its partition type code. This is useful only when booting DOS or Windows -and multiple primary partitions exist on one disk. See also -@ref{DOS/Windows}. -@end deffn - - -@node Command-line and menu entry commands -@section The list of command-line and menu entry commands - -These commands are usable in the command-line and in menu entries. If -you forget a command, you can run the command @command{help} -(@pxref{help}). - -@menu -* blocklist:: Get the block list notation of a file -* boot:: Start up your operating system -* cat:: Show the contents of a file -* chainloader:: Chain-load another boot loader -* cmp:: Compare two files -* configfile:: Load a configuration file -* debug:: Toggle the debug flag -* displayapm:: Display APM information -* displaymem:: Display memory configuration -* embed:: Embed Stage 1.5 -* find:: Find a file -* fstest:: Test a filesystem -* geometry:: Manipulate the geometry of a drive -* halt:: Shut down your computer -* help:: Show help messages -* impsprobe:: Probe SMP -* initrd:: Load an initrd -* install:: Install GRUB -* ioprobe:: Probe I/O ports used for a drive -* kernel:: Load a kernel -* lock:: Lock a menu entry -* makeactive:: Make a partition active -* map:: Map a drive to another -* md5crypt:: Encrypt a password in MD5 format -* module:: Load a module -* modulenounzip:: Load a module without decompression -* pause:: Wait for a key press -* quit:: Exit from the grub shell -* reboot:: Reboot your computer -* read:: Read data from memory -* root:: Set GRUB's root device -* rootnoverify:: Set GRUB's root device without mounting -* savedefault:: Save current entry as the default entry -* setup:: Set up GRUB's installation automatically -* testload:: Load a file for testing a filesystem -* testvbe:: Test VESA BIOS EXTENSION -* uppermem:: Set the upper memory size -* vbeprobe:: Probe VESA BIOS EXTENSION -@end menu - - -@node blocklist -@subsection blocklist - -@deffn Command blocklist file -Print the block list notation of the file @var{file}. @xref{Block list -syntax}. -@end deffn - - -@node boot -@subsection boot - -@deffn Command boot -Boot the OS or chain-loader which has been loaded. Only necessary if -running the fully interactive command-line (it is implicit at the end of -a menu entry). -@end deffn - - -@node cat -@subsection cat - -@deffn Command cat file -Display the contents of the file @var{file}. This command may be useful -to remind you of your OS's root partition: - -@example -grub> @kbd{cat /etc/fstab} -@end example -@end deffn - - -@node chainloader -@subsection chainloader - -@deffn Command chainloader [@option{--force}] file -Load @var{file} as a chain-loader. Like any other file loaded by the -filesystem code, it can use the blocklist notation to grab the first -sector of the current partition with @samp{+1}. If you specify the -option @option{--force}, then load @var{file} forcibly, whether it has a -correct signature or not. This is required when you want to load a -defective boot loader, such as SCO UnixWare 7.1 (@pxref{SCO UnixWare}). -@end deffn - - -@node cmp -@subsection cmp - -@deffn Command cmp file1 file2 -Compare the file @var{file1} with the file @var{file2}. If they differ -in size, print the sizes like this: - -@example -Differ in size: 0x1234 [foo], 0x4321 [bar] -@end example - -If the sizes are equal but the bytes at an offset differ, then print the -bytes like this: - -@example -Differ at the offset 777: 0xbe [foo], 0xef [bar] -@end example - -If they are completely identical, nothing will be printed. -@end deffn - - -@node configfile -@subsection configfile - -@deffn Command configfile file -Load @var{file} as a configuration file. -@end deffn - - -@node debug -@subsection debug - -@deffn Command debug -Toggle debug mode (by default it is off). When debug mode is on, some -extra messages are printed to show disk activity. This global debug flag -is mainly useful for GRUB developers when testing new code. -@end deffn - - -@node displayapm -@subsection displayapm - -@deffn Command displayapm -Display APM BIOS information. -@end deffn - - -@node displaymem -@subsection displaymem - -@deffn Command displaymem -Display what GRUB thinks the system address space map of the machine is, -including all regions of physical @sc{ram} installed. GRUB's -@dfn{upper/lower memory} display uses the standard BIOS interface for -the available memory in the first megabyte, or @dfn{lower memory}, and a -synthesized number from various BIOS interfaces of the memory starting -at 1MB and going up to the first chipset hole for @dfn{upper memory} -(the standard PC @dfn{upper memory} interface is limited to reporting a -maximum of 64MB). -@end deffn - - -@node embed -@subsection embed - -@deffn Command embed stage1_5 device -Embed the Stage 1.5 @var{stage1_5} in the sectors after the MBR if -@var{device} is a drive, or in the @dfn{boot loader} area if @var{device} -is a FFS partition or a ReiserFS partition.@footnote{The latter feature -has not been implemented yet.} Print the number of sectors which -@var{stage1_5} occupies, if successful. - -Usually, you don't need to run this command directly. @xref{setup}. -@end deffn - - -@node find -@subsection find - -@deffn Command find filename -Search for the file name @var{filename} in all mountable partitions -and print the list of the devices which contain the file. The file -name @var{filename} should be an absolute file name like -@code{/boot/grub/stage1}. -@end deffn - - -@node fstest -@subsection fstest - -@deffn Command fstest -Toggle filesystem test mode. -Filesystem test mode, when turned on, prints out data corresponding to -all the device reads and what values are being sent to the low-level -routines. The format is @samp{<@var{partition-offset-sector}, -@var{byte-offset}, @var{byte-length}>} for high-level reads inside a -partition, and @samp{[@var{disk-offset-sector}]} for low-level sector -requests from the disk. -Filesystem test mode is turned off by any use of the @command{install} -(@pxref{install}) or @command{testload} (@pxref{testload}) commands. -@end deffn - - -@node geometry -@subsection geometry - -@deffn Command geometry drive [cylinder head sector [total_sector]] -Print the information for the drive @var{drive}. In the grub shell, you -can set the geometry of the drive arbitrarily. The number of -cylinders, the number of heads, the number of sectors and the number of -total sectors are set to CYLINDER, HEAD, SECTOR and TOTAL_SECTOR, -respectively. If you omit TOTAL_SECTOR, then it will be calculated -based on the C/H/S values automatically. -@end deffn - - -@node halt -@subsection halt - -@deffn Command halt @option{--no-apm} -The command halts the computer. If the @option{--no-apm} option -is specified, no APM BIOS call is performed. Otherwise, the computer -is shut down using APM. -@end deffn - - -@node help -@subsection help - -@deffn Command help @option{--all} [pattern @dots{}] -Display helpful information about builtin commands. If you do not -specify @var{pattern}, this command shows short descriptions of most of -available commands. If you specify the option @option{--all} to this -command, short descriptions of rarely used commands (such as -@ref{testload}) are displayed as well. - -If you specify any @var{patterns}, it displays longer information -about each of the commands which match those @var{patterns}. -@end deffn - - -@node impsprobe -@subsection impsprobe - -@deffn Command impsprobe -Probe the Intel Multiprocessor Specification 1.1 or 1.4 configuration -table and boot the various CPUs which are found into a tight loop. This -command can be used only in the Stage 2, but not in the grub shell. -@end deffn - - -@node initrd -@subsection initrd - -@deffn Command initrd file @dots{} -Load an initial ramdisk for a Linux format boot image and set the -appropriate parameters in the Linux setup area in memory. See also -@ref{GNU/Linux}. -@end deffn - - -@node install -@subsection install - -@deffn Command install [@option{--force-lba}] [@option{--stage2=os_stage2_file}] stage1_file [@option{d}] dest_dev stage2_file [addr] [@option{p}] [config_file] [real_config_file] -This command is fairly complex, and you should not use this command -unless you are familiar with GRUB. Use @command{setup} (@pxref{setup}) -instead. - -In short, it will perform a full install presuming the Stage 2 or Stage -1.5@footnote{They're loaded the same way, so we will refer to the Stage -1.5 as a Stage 2 from now on.} is in its final install location. - -In slightly more detail, it will load @var{stage1_file}, validate that -it is a GRUB Stage 1 of the right version number, install in it a -blocklist for loading @var{stage2_file} as a Stage 2. If the option -@option{d} is present, the Stage 1 will always look for the actual -disk @var{stage2_file} was installed on, rather than using the booting -drive. The Stage 2 will be loaded at address @var{addr}, which must be -@samp{0x8000} for a true Stage 2, and @samp{0x2000} for a Stage 1.5. If -@var{addr} is not present, GRUB will determine the address -automatically. It then writes the completed Stage 1 to the first block -of the device @var{dest_dev}. If the options @option{p} or -@var{config_file} are present, then it reads the first block of stage2, -modifies it with the values of the partition @var{stage2_file} was found -on (for @option{p}) or places the string @var{config_file} into the area -telling the stage2 where to look for a configuration file at boot -time. Likewise, if @var{real_config_file} is present and -@var{stage2_file} is a Stage 1.5, then the Stage 2 @var{config_file} is -patched with the configuration file name @var{real_config_file}. This -command preserves the DOS BPB (and for hard disks, the partition table) -of the sector the Stage 1 is to be installed into. - -@strong{Caution:} Several buggy BIOSes don't pass a booting drive -properly when booting from a hard disk drive. Therefore, you will -unfortunately have to specify the option @option{d}, whether your -Stage2 resides at the booting drive or not, if you have such a -BIOS. We know these are defective in this way: - -@table @asis -@item -Fujitsu LifeBook 400 BIOS version 31J0103A - -@item -HP Vectra XU 6/200 BIOS version GG.06.11 -@end table - -@strong{Caution2:} A number of BIOSes don't return a correct LBA support -bitmap even if they do have the support. So GRUB provides a solution to -ignore the wrong bitmap, that is, the option @option{--force-lba}. Don't -use this option if you know that your BIOS doesn't have LBA support. - -@strong{Caution3:} You must specify the option @option{--stage2} in the -grub shell, if you cannot unmount the filesystem where your stage2 file -resides. The argument should be the file name in your operating system. -@end deffn - - -@node ioprobe -@subsection ioprobe - -@deffn Command ioprobe drive -Probe I/O ports used for the drive @var{drive}. This command will list -the I/O ports on the screen. For technical information, -@xref{Internals}. -@end deffn - - -@node kernel -@subsection kernel - -@deffn Command kernel [@option{--type=type}] [@option{--no-mem-option}] file @dots{} -Attempt to load the primary boot image (Multiboot a.out or @sc{elf}, -Linux zImage or bzImage, FreeBSD a.out, NetBSD a.out, etc.) from -@var{file}. The rest of the line is passed verbatim as the @dfn{kernel -command-line}. Any modules must be reloaded after using this command. - -This command also accepts the option @option{--type} so that you can -specify the kernel type of @var{file} explicitly. The argument -@var{type} must be one of these: @samp{netbsd}, @samp{freebsd}, -@samp{openbsd}, @samp{linux}, @samp{biglinux}, and -@samp{multiboot}. However, you need to specify it only if you want to -load a NetBSD @sc{elf} kernel, because GRUB can automatically determine -a kernel type in the other cases, quite safely. - -The option @option{--no-mem-option} is effective only for Linux. If the -option is specified, GRUB doesn't pass the option @option{mem=} to the -kernel. This option is implied for Linux kernels 2.4.18 and newer. -@end deffn - - -@node lock -@subsection lock - -@deffn Command lock -Prevent normal users from executing arbitrary menu entries. You must use -the command @command{password} if you really want this command to be -useful (@pxref{password}). - -This command is used in a menu, as shown in this example: - -@example -@group -title This entry is too dangerous to be executed by normal users -lock -root (hd0,a) -kernel /no-security-os -@end group -@end example - -See also @ref{Security}. -@end deffn - - -@node makeactive -@subsection makeactive - -@deffn Command makeactive -Set the active partition on the root disk to GRUB's root device. -This command is limited to @emph{primary} PC partitions on a hard disk. -@end deffn - - -@node map -@subsection map - -@deffn Command map to_drive from_drive -Map the drive @var{from_drive} to the drive @var{to_drive}. This is -necessary when you chain-load some operating systems, such as DOS, if -such an OS resides at a non-first drive. Here is an example: - -@example -@group -grub> @kbd{map (hd0) (hd1)} -grub> @kbd{map (hd1) (hd0)} -@end group -@end example - -The example exchanges the order between the first hard disk and the -second hard disk. See also @ref{DOS/Windows}. -@end deffn - - -@node md5crypt -@subsection md5crypt - -@deffn Command md5crypt -Prompt to enter a password, and encrypt it in MD5 format. The encrypted -password can be used with the command @command{password} -(@pxref{password}). See also @ref{Security}. -@end deffn - - -@node module -@subsection module - -@deffn Command module file @dots{} -Load a boot module @var{file} for a Multiboot format boot image (no -interpretation of the file contents are made, so the user of this -command must know what the kernel in question expects). The rest of the -line is passed as the @dfn{module command-line}, like the -@command{kernel} command. You must load a Multiboot kernel image before -loading any module. See also @ref{modulenounzip}. -@end deffn - - -@node modulenounzip -@subsection modulenounzip - -@deffn Command modulenounzip file @dots{} -The same as @command{module} (@pxref{module}), except that automatic -decompression is disabled. -@end deffn - - -@node pause -@subsection pause - -@deffn Command pause message @dots{} -Print the @var{message}, then wait until a key is pressed. Note that -placing @key{^G} (ASCII code 7) in the message will cause the speaker to -emit the standard beep sound, which is useful when prompting the user to -change floppies. -@end deffn - - -@node quit -@subsection quit - -@deffn Command quit -Exit from the grub shell @command{grub} (@pxref{Invoking the grub -shell}). This command can be used only in the grub shell. -@end deffn - - -@node reboot -@subsection reboot - -@deffn Command reboot -Reboot the computer. -@end deffn - - -@node read -@subsection read - -@deffn Command read addr -Read a 32-bit value from memory at address @var{addr} and display it in -hex format. -@end deffn - - -@node root -@subsection root - -@deffn Command root device [hdbias] -Set the current @dfn{root device} to the device @var{device}, then -attempt to mount it to get the partition size (for passing the partition -descriptor in @code{ES:ESI}, used by some chain-loaded boot loaders), the -BSD drive-type (for booting BSD kernels using their native boot format), -and correctly determine the PC partition where a BSD sub-partition is -located. The optional @var{hdbias} parameter is a number to tell a BSD -kernel how many BIOS drive numbers are on controllers before the current -one. For example, if there is an IDE disk and a SCSI disk, and your -FreeBSD root partition is on the SCSI disk, then use a @samp{1} for -@var{hdbias}. - -See also @ref{rootnoverify}. -@end deffn - - -@node rootnoverify -@subsection rootnoverify - -@deffn Command rootnoverify device [hdbias] -Similar to @command{root} (@pxref{root}), but don't attempt to mount the -partition. This is useful for when an OS is outside of the area of the -disk that GRUB can read, but setting the correct root device is still -desired. Note that the items mentioned in @command{root} above which -derived from attempting the mount will @emph{not} work correctly. -@end deffn - - -@node savedefault -@subsection savedefault - -@deffn Command savedefault num -Save the current menu entry or @var{num} if specified as a default -entry. Here is an example: - -@example -@group -default saved -timeout 10 - -title GNU/Linux -root (hd0,0) -kernel /boot/vmlinuz root=/dev/sda1 vga=ext -initrd /boot/initrd -savedefault - -title FreeBSD -root (hd0,a) -kernel /boot/loader -savedefault -@end group -@end example - -With this configuration, GRUB will choose the entry booted previously as -the default entry. - -You can specify @samp{fallback} instead of a number. Then, next -fallback entry is saved. Next fallback entry is chosen from fallback -entries. Normally, this will be the first entry in fallback ones. - -See also @ref{default} and @ref{Invoking grub-set-default}. -@end deffn - - -@node setup -@subsection setup - -@deffn Command setup [@option{--force-lba}] [@option{--stage2=os_stage2_file}] [@option{--prefix=dir}] install_device [image_device] -Set up the installation of GRUB automatically. This command uses the -more flexible command @command{install} (@pxref{install}) in the backend -and installs GRUB into the device @var{install_device}. If -@var{image_device} is specified, then find the GRUB images -(@pxref{Images}) in the device @var{image_device}, otherwise use the -current @dfn{root device}, which can be set by the command -@command{root}. If @var{install_device} is a hard disk, then embed a -Stage 1.5 in the disk if possible. - -The option @option{--prefix} specifies the directory under which GRUB -images are put. If it is not specified, GRUB automatically searches them -in @file{/boot/grub} and @file{/grub}. - -The options @option{--force-lba} and @option{--stage2} are just passed -to @command{install} if specified. @xref{install}, for more -information. -@end deffn - - -@node testload -@subsection testload - -@deffn Command testload file -Read the entire contents of @var{file} in several different ways and -compare them, to test the filesystem code. The output is somewhat -cryptic, but if no errors are reported and the final @samp{i=@var{X}, -filepos=@var{Y}} reading has @var{X} and @var{Y} equal, then it is -definitely consistent, and very likely works correctly subject to a -consistent offset error. If this test succeeds, then a good next step is -to try loading a kernel. -@end deffn - - -@node testvbe -@subsection testvbe - -@deffn Command testvbe mode -Test the VESA BIOS EXTENSION mode @var{mode}. This command will switch -your video card to the graphics mode, and show an endless animation. Hit -any key to return. See also @ref{vbeprobe}. -@end deffn - - -@node uppermem -@subsection uppermem - -@deffn Command uppermem kbytes -Force GRUB to assume that only @var{kbytes} kilobytes of upper memory -are installed. Any system address range maps are discarded. - -@strong{Caution:} This should be used with great caution, and should -only be necessary on some old machines. GRUB's BIOS probe can pick up -all @sc{ram} on all new machines the author has ever heard of. It can -also be used for debugging purposes to lie to an OS. -@end deffn - - -@node vbeprobe -@subsection vbeprobe - -@deffn Command vbeprobe [mode] -Probe VESA BIOS EXTENSION information. If the mode @var{mode} is -specified, show only the information about @var{mode}. Otherwise, this -command lists up available VBE modes on the screen. See also -@ref{testvbe}. -@end deffn - - -@node Troubleshooting -@chapter Error messages reported by GRUB - -This chapter describes error messages reported by GRUB when you -encounter trouble. @xref{Invoking the grub shell}, if your problem is -specific to the grub shell. - -@menu -* Stage1 errors:: Errors reported by the Stage 1 -* Stage1.5 errors:: Errors reported by the Stage 1.5 -* Stage2 errors:: Errors reported by the Stage 2 -@end menu - - -@node Stage1 errors -@section Errors reported by the Stage 1 - -The general way that the Stage 1 handles errors is to print an error -string and then halt. Pressing @kbd{@key{CTRL}-@key{ALT}-@key{DEL}} will -reboot. - -The following is a comprehensive list of error messages for the Stage 1: - -@table @asis -@item Hard Disk Error -The stage2 or stage1.5 is being read from a hard disk, and the attempt -to determine the size and geometry of the hard disk failed. - -@item Floppy Error -The stage2 or stage1.5 is being read from a floppy disk, and the attempt -to determine the size and geometry of the floppy disk failed. It's listed -as a separate error since the probe sequence is different than for hard -disks. - -@item Read Error -A disk read error happened while trying to read the stage2 or stage1.5. - -@item Geom Error -The location of the stage2 or stage1.5 is not in the portion of the disk -supported directly by the BIOS read calls. This could occur because the -BIOS translated geometry has been changed by the user or the disk is -moved to another machine or controller after installation, or GRUB was -not installed using itself (if it was, the Stage 2 version of this error -would have been seen during that process and it would not have completed -the install). -@end table - - -@node Stage1.5 errors -@section Errors reported by the Stage 1.5 - -The general way that the Stage 1.5 handles errors is to print an error -number in the form @code{Error @var{num}} and then halt. Pressing -@kbd{@key{CTRL}-@key{ALT}-@key{DEL}} will reboot. - -The error numbers correspond to the errors reported by Stage -2. @xref{Stage2 errors}. - - -@node Stage2 errors -@section Errors reported by the Stage 2 - -The general way that the Stage 2 handles errors is to abort the -operation in question, print an error string, then (if possible) either -continue based on the fact that an error occurred or wait for the user to -deal with the error. - -The following is a comprehensive list of error messages for the Stage 2 -(error numbers for the Stage 1.5 are listed before the colon in each -description): - -@table @asis -@item 1 : Filename must be either an absolute filename or blocklist -This error is returned if a file name is requested which doesn't fit the -syntax/rules listed in the @ref{Filesystem}. - -@item 2 : Bad file or directory type -This error is returned if a file requested is not a regular file, but -something like a symbolic link, directory, or FIFO. - -@item 3 : Bad or corrupt data while decompressing file -This error is returned if the run-length decompression code gets an -internal error. This is usually from a corrupt file. - -@item 4 : Bad or incompatible header in compressed file -This error is returned if the file header for a supposedly compressed -file is bad. - -@item 5 : Partition table invalid or corrupt -This error is returned if the sanity checks on the integrity of the -partition table fail. This is a bad sign. - -@item 6 : Mismatched or corrupt version of stage1/stage2 -This error is returned if the install command points to incompatible -or corrupt versions of the stage1 or stage2. It can't detect corruption -in general, but this is a sanity check on the version numbers, which -should be correct. - -@item 7 : Loading below 1MB is not supported -This error is returned if the lowest address in a kernel is below the -1MB boundary. The Linux zImage format is a special case and can be -handled since it has a fixed loading address and maximum size. - -@item 8 : Kernel must be loaded before booting -This error is returned if GRUB is told to execute the boot sequence -without having a kernel to start. - -@item 9 : Unknown boot failure -This error is returned if the boot attempt did not succeed for reasons -which are unknown. - -@item 10 : Unsupported Multiboot features requested -This error is returned when the Multiboot features word in the Multiboot -header requires a feature that is not recognized. The point of this is -that the kernel requires special handling which GRUB is probably -unable to provide. - -@item 11 : Unrecognized device string -This error is returned if a device string was expected, and the string -encountered didn't fit the syntax/rules listed in the @ref{Filesystem}. - -@item 12 : Invalid device requested -This error is returned if a device string is recognizable but does not -fall under the other device errors. - -@item 13 : Invalid or unsupported executable format -This error is returned if the kernel image being loaded is not -recognized as Multiboot or one of the supported native formats (Linux -zImage or bzImage, FreeBSD, or NetBSD). - -@item 14 : Filesystem compatibility error, cannot read whole file -Some of the filesystem reading code in GRUB has limits on the length of -the files it can read. This error is returned when the user runs into -such a limit. - -@item 15 : File not found -This error is returned if the specified file name cannot be found, but -everything else (like the disk/partition info) is OK. - -@item 16 : Inconsistent filesystem structure -This error is returned by the filesystem code to denote an internal -error caused by the sanity checks of the filesystem structure on disk -not matching what it expects. This is usually caused by a corrupt -filesystem or bugs in the code handling it in GRUB. - -@item 17 : Cannot mount selected partition -This error is returned if the partition requested exists, but the -filesystem type cannot be recognized by GRUB. - -@item 18 : Selected cylinder exceeds maximum supported by BIOS -This error is returned when a read is attempted at a linear block -address beyond the end of the BIOS translated area. This generally -happens if your disk is larger than the BIOS can handle (512MB for -(E)IDE disks on older machines or larger than 8GB in general). - -@item 19 : Linux kernel must be loaded before initrd -This error is returned if the initrd command is used before loading a -Linux kernel. - -@item 20 : Multiboot kernel must be loaded before modules -This error is returned if the module load command is used before loading -a Multiboot kernel. It only makes sense in this case anyway, as GRUB has -no idea how to communicate the presence of such modules to a -non-Multiboot-aware kernel. - -@item 21 : Selected disk does not exist -This error is returned if the device part of a device- or full file name -refers to a disk or BIOS device that is not present or not recognized by -the BIOS in the system. - -@item 22 : No such partition -This error is returned if a partition is requested in the device part of -a device- or full file name which isn't on the selected disk. - -@item 23 : Error while parsing number -This error is returned if GRUB was expecting to read a number and -encountered bad data. - -@item 24 : Attempt to access block outside partition -This error is returned if a linear block address is outside of the disk -partition. This generally happens because of a corrupt filesystem on the -disk or a bug in the code handling it in GRUB (it's a great debugging -tool). - -@item 25 : Disk read error -This error is returned if there is a disk read error when trying to -probe or read data from a particular disk. - -@item 26 : Too many symbolic links -This error is returned if the link count is beyond the maximum -(currently 5), possibly the symbolic links are looped. - -@item 27 : Unrecognized command -This error is returned if an unrecognized command is entered on the -command-line or in a boot sequence section of a configuration file and -that entry is selected. - -@item 28 : Selected item cannot fit into memory -This error is returned if a kernel, module, or raw file load command is -either trying to load its data such that it won't fit into memory or it -is simply too big. - -@item 29 : Disk write error -This error is returned if there is a disk write error when trying to -write to a particular disk. This would generally only occur during an -install of set active partition command. - -@item 30 : Invalid argument -This error is returned if an argument specified to a command is invalid. - -@item 31 : File is not sector aligned -This error may occur only when you access a ReiserFS partition by -block-lists (e.g. the command @command{install}). In this case, you -should mount the partition with the @samp{-o notail} option. - -@item 32 : Must be authenticated -This error is returned if you try to run a locked entry. You should -enter a correct password before running such an entry. - -@item 33 : Serial device not configured -This error is returned if you try to change your terminal to a serial -one before initializing any serial device. - -@item 34 : No spare sectors on the disk -This error is returned if a disk doesn't have enough spare space. This -happens when you try to embed Stage 1.5 into the unused sectors after -the MBR, but the first partition starts right after the MBR or they are -used by EZ-BIOS. -@end table - - -@node Invoking the grub shell -@chapter Invoking the grub shell - -This chapter documents the grub shell @command{grub}. Note that the grub -shell is an emulator; it doesn't run under the native environment, so it -sometimes does something wrong. Therefore, you shouldn't trust it too -much. If there is anything wrong with it, don't hesitate to try the -native GRUB environment, especially when it guesses a wrong map between -BIOS drives and OS devices. - -@menu -* Basic usage:: How to use the grub shell -* Installation under UNIX:: How to install GRUB via @command{grub} -* Device map:: The map between BIOS drives and OS devices -@end menu - - -@node Basic usage -@section Introduction into the grub shell - -You can use the command @command{grub} for installing GRUB under your -operating systems and for a testbed when you add a new feature into GRUB -or when fixing a bug. @command{grub} is almost the same as the Stage 2, -and, in fact, it shares the source code with the Stage 2 and you can use -the same commands (@pxref{Commands}) in @command{grub}. It is emulated by -replacing BIOS calls with UNIX system calls and libc functions. - -The command @command{grub} accepts the following options: - -@table @option -@item --help -Print a summary of the command-line options and exit. - -@item --version -Print the version number of GRUB and exit. - -@item --verbose -Print some verbose messages for debugging purpose. - -@item --device-map=@var{file} -Use the device map file @var{file}. The format is described in -@ref{Device map}. - -@item --no-floppy -Do not probe any floppy drive. This option has no effect if the option -@option{--device-map} is specified (@pxref{Device map}). - -@item --probe-second-floppy -Probe the second floppy drive. If this option is not specified, the grub -shell does not probe it, as that sometimes takes a long time. If you -specify the device map file (@pxref{Device map}), the grub shell just -ignores this option. - -@item --config-file=@var{file} -Read the configuration file @var{file} instead of -@file{/boot/grub/menu.lst}. The format is the same as the normal GRUB -syntax. See @ref{Filesystem}, for more information. - -@item --boot-drive=@var{drive} -Set the stage2 @var{boot_drive} to @var{drive}. This argument should be -an integer (decimal, octal or hexadecimal). - -@item --install-partition=@var{par} -Set the stage2 @var{install_partition} to @var{par}. This argument -should be an integer (decimal, octal or hexadecimal). - -@item --no-config-file -Do not use the configuration file even if it can be read. - -@item --no-curses -Do not use the screen handling interface by the curses even if it is -available. - -@item --batch -This option has the same meaning as @samp{--no-config-file --no-curses}. - -@item --read-only -Disable writing to any disk. - -@item --hold -Wait until a debugger will attach. This option is useful when you want -to debug the startup code. -@end table - - -@node Installation under UNIX -@section How to install GRUB via @command{grub} - -The installation procedure is the same as under the @dfn{native} Stage -2. @xref{Installation}, for more information. The command -@command{grub}-specific information is described here. - -What you should be careful about is @dfn{buffer cache}. @command{grub} -makes use of raw devices instead of filesystems that your operating -systems serve, so there exists a potential problem that some cache -inconsistency may corrupt your filesystems. What we recommend is: - -@itemize @bullet -@item -If you can unmount drives to which GRUB may write any amount of data, -unmount them before running @command{grub}. - -@item -If a drive cannot be unmounted but can be mounted with the read-only -flag, mount it in read-only mode. That should be secure. - -@item -If a drive must be mounted with the read-write flag, make sure that no -activity is being done on it while the command @command{grub} is -running. - -@item -Reboot your operating system as soon as possible. This is probably not -required if you follow the rules above, but reboot is the most secure -way. -@end itemize - -In addition, enter the command @command{quit} when you finish the -installation. That is @emph{very important} because @command{quit} makes -the buffer cache consistent. Do not push @key{C-c}. - -If you want to install GRUB non-interactively, specify @samp{--batch} -option in the command-line. This is a simple example: - -@example -@group -#!/bin/sh - -# Use /usr/sbin/grub if you are on an older system. -/sbin/grub --batch </dev/null 2>/dev/null -root (hd0,0) -setup (hd0) -quit -EOT -@end group -@end example - - -@node Device map -@section The map between BIOS drives and OS devices - -When you specify the option @option{--device-map} (@pxref{Basic usage}), -the grub shell creates the @dfn{device map file} automatically unless it -already exists. The file name @file{/boot/grub/device.map} is preferred. - -If the device map file exists, the grub shell reads it to map BIOS -drives to OS devices. This file consists of lines like this: - -@example -@var{device} @var{file} -@end example - -@var{device} is a drive specified in the GRUB syntax (@pxref{Device -syntax}), and @var{file} is an OS file, which is normally a device -file. - -The reason why the grub shell gives you the device map file is that it -cannot guess the map between BIOS drives and OS devices correctly in -some environments. For example, if you exchange the boot sequence -between IDE and SCSI in your BIOS, it gets the order wrong. - -Thus, edit the file if the grub shell makes a mistake. You can put any -comments in the file if needed, as the grub shell assumes that a line is -just a comment if the first character is @samp{#}. - - -@node Invoking grub-install -@chapter Invoking grub-install - -The program @command{grub-install} installs GRUB on your drive using the -grub shell (@pxref{Invoking the grub shell}). You must specify the -device name on which you want to install GRUB, like this: - -@example -grub-install @var{install_device} -@end example - -The device name @var{install_device} is an OS device name or a GRUB -device name. - -@command{grub-install} accepts the following options: - -@table @option -@item --help -Print a summary of the command-line options and exit. - -@item --version -Print the version number of GRUB and exit. - -@item --force-lba -Force GRUB to use LBA mode even for a buggy BIOS. Use this option only -if your BIOS doesn't work properly in LBA mode even though it supports -LBA mode. - -@item --root-directory=@var{dir} -Install GRUB images under the directory @var{dir} instead of the root -directory. This option is useful when you want to install GRUB into a -separate partition or a removable disk. Here is an example in which -you have a separate @dfn{boot} partition which is mounted on -@file{/boot}: - -@example -@kbd{grub-install --root-directory=/boot hd0} -@end example - -@item --grub-shell=@var{file} -Use @var{file} as the grub shell. You can append arbitrary options to -@var{file} after the file name, like this: - -@example -@kbd{grub-install --grub-shell="grub --read-only" /dev/fd0} -@end example - -@item --recheck -Recheck the device map, even if @file{/boot/grub/device.map} already -exists. You should use this option whenever you add/remove a disk -into/from your computer. -@end table - - -@node Invoking grub-md5-crypt -@chapter Invoking grub-md5-crypt - -The program @command{grub-md5-crypt} encrypts a password in MD5 format. -This is just a frontend of the grub shell (@pxref{Invoking the grub -shell}). Passwords encrypted by this program can be used with the -command @command{password} (@pxref{password}). - -@command{grub-md5-crypt} accepts the following options: - -@table @option -@item --help -Print a summary of the command-line options and exit. - -@item --version -Print the version information and exit. - -@item --grub-shell=@var{file} -Use @var{file} as the grub shell. -@end table - - -@node Invoking grub-terminfo -@chapter Invoking grub-terminfo - -The program @command{grub-terminfo} generates a terminfo command from -a terminfo name (@pxref{terminfo}). The result can be used in the -configuration file, to define escape sequences. Because GRUB assumes -that your terminal is vt100-compatible by default, this would be -useful only if your terminal is uncommon (such as vt52). - -@command{grub-terminfo} accepts the following options: - -@table @option -@item --help -Print a summary of the command-line options and exit. - -@item --version -Print the version information and exit. -@end table - -You must specify one argument to this command. For example: - -@example -@kbd{grub-terminfo vt52} -@end example - - -@node Invoking grub-set-default -@chapter Invoking grub-set-default - -The program @command{grub-set-default} sets the default boot entry for -GRUB. This automatically creates a file named @file{default} under -your GRUB directory (i.e. @file{/boot/grub}), if it is not -present. This file is used to determine the default boot entry when -GRUB boots up your system when you use @samp{default saved} in your -configuration file (@pxref{default}), and to save next default boot -entry when you use @samp{savedefault} in a boot entry -(@pxref{savedefault}). - -@command{grub-set-default} accepts the following options: - -@table @option -@item --help -Print a summary of the command-line options and exit. - -@item --version -Print the version information and exit. - -@item --root-directory=@var{dir} -Use the directory @var{dir} instead of the root directory -(i.e. @file{/}) to define the location of the default file. This -is useful when you mount a disk which is used for another system. -@end table - -You must specify a single argument to @command{grub-set-default}. This -argument is normally the number of a default boot entry. For example, -if you have this configuration file: - -@example -@group -default saved -timeout 10 - -title GNU/Hurd -root (hd0,0) -... - -title GNU/Linux -root (hd0,1) -... -@end group -@end example - -and if you want to set the next default boot entry to GNU/Linux, you -may execute this command: - -@example -@kbd{grub-set-default 1} -@end example - -Because the entry for GNU/Linux is @samp{1}. Note that entries are -counted from zero. So, if you want to specify GNU/Hurd here, then you -should specify @samp{0}. - -This feature is very useful if you want to test a new kernel or to -make your system quite robust. @xref{Making your system robust}, for -more hints about how to set up a robust system. - - -@node Invoking mbchk -@chapter Invoking mbchk - -The program @command{mbchk} checks for the format of a Multiboot -kernel. We recommend using this program before booting your own kernel -by GRUB. - -@command{mbchk} accepts the following options: - -@table @option -@item --help -Print a summary of the command-line options and exit. - -@item --version -Print the version number of GRUB and exit. - -@item --quiet -Suppress all normal output. -@end table - - -@node Obtaining and Building GRUB -@appendix How to obtain and build GRUB - -@quotation -@strong{Caution:} GRUB requires binutils-2.9.1.0.23 or later because the -GNU assembler has been changed so that it can produce real 16bits -machine code between 2.9.1 and 2.9.1.0.x. See -@uref{http://sources.redhat.com/binutils/}, to obtain information on -how to get the latest version. -@end quotation - -GRUB is available from the GNU alpha archive site -@uref{ftp://alpha.gnu.org/gnu/grub} or any of its mirrors. The file -will be named grub-version.tar.gz. The current version is -@value{VERSION}, so the file you should grab is: - -@uref{ftp://alpha.gnu.org/gnu/grub/grub-@value{VERSION}.tar.gz} - -To unbundle GRUB use the instruction: - -@example -@kbd{zcat grub-@value{VERSION}.tar.gz | tar xvf -} -@end example - -which will create a directory called @file{grub-@value{VERSION}} with -all the sources. You can look at the file @file{INSTALL} for detailed -instructions on how to build and install GRUB, but you should be able to -just do: - -@example -@group -@kbd{cd grub-@value{VERSION}} -@kbd{./configure} -@kbd{make install} -@end group -@end example - -This will install the grub shell @file{grub} (@pxref{Invoking the grub -shell}), the Multiboot checker @file{mbchk} (@pxref{Invoking mbchk}), -and the GRUB images. This will also install the GRUB manual. - -Also, the latest version is available from the CVS. See -@uref{http://savannah.gnu.org/cvs/?group=grub} for more information. - - -@node Reporting bugs -@appendix Reporting bugs - -These are the guideline for how to report bugs. Take a look at this -list below before you submit bugs: - -@enumerate -@item -Before getting unsettled, read this manual through and through. Also, -see the @uref{http://www.gnu.org/software/grub/grub-faq.html, GNU GRUB FAQ}. - -@item -Always mention the information on your GRUB. The version number and the -configuration are quite important. If you build it yourself, write the -options specified to the configure script and your operating system, -including the versions of gcc and binutils. - -@item -If you have trouble with the installation, inform us of how you -installed GRUB. Don't omit error messages, if any. Just @samp{GRUB hangs -up when it boots} is not enough. - -The information on your hardware is also essential. These are especially -important: the geometries and the partition tables of your hard disk -drives and your BIOS. - -@item -If GRUB cannot boot your operating system, write down -@emph{everything} you see on the screen. Don't paraphrase them, like -@samp{The foo OS crashes with GRUB, even though it can boot with the -bar boot loader just fine}. Mention the commands you executed, the -messages printed by them, and information on your operating system -including the version number. - -@item -Explain what you wanted to do. It is very useful to know your purpose -and your wish, and how GRUB didn't satisfy you. - -@item -If you can investigate the problem yourself, please do. That will give -you and us much more information on the problem. Attaching a patch is -even better. - -When you attach a patch, make the patch in unified diff format, and -write ChangeLog entries. But, even when you make a patch, don't forget -to explain the problem, so that we can understand what your patch is -for. - -@item -Write down anything that you think might be related. Please understand -that we often need to reproduce the same problem you encounterred in our -environment. So your information should be sufficient for us to do the -same thing---Don't forget that we cannot see your computer directly. If -you are not sure whether to state a fact or leave it out, state it! -Reporting too many things is much better than omitting something -important. -@end enumerate - -If you follow the guideline above, submit a report to the -@uref{http://savannah.gnu.org/bugs/?group=grub, Bug Tracking System}. -Alternatively, you can submit a report via electronic mail to -@email{bug-grub@@gnu.org}, but we strongly recommend that you use the -Bug Tracking System, because e-mail can be passed over easily. - -Once we get your report, we will try to fix the bugs. - - -@node Future -@appendix Where GRUB will go - -We started the next generation of GRUB, GRUB 2. This will include -internationalization, dynamic module loading, real memory management, -multiple architecture support, a scripting language, and many other -nice feature. If you are interested in the development of GRUB 2, take -a look at @uref{http://www.gnu.org/software/grub/grub.html, the -homepage}. - - -@c Separate the programming guide. -@include internals.texi - - -@node Index -@unnumbered Index - -@c Currently, we use only the Concept Index. -@printindex cp - - -@bye - -Some notes: - - This is the second attempt to rewrite the manual. The status is -mostly complete, but I need to check the spelling by ispell, and add -more indices. Perhaps I also have to let some English native speakers -proofread this manual through. My English is syntactically almost -perfect, but sometimes (often?) awful in the nuance. Hehe, I can't be an -English poet for now. diff --git a/usr/src/grub/grub-0.95/docs/help2man b/usr/src/grub/grub-0.95/docs/help2man deleted file mode 100644 index 506fcb853d..0000000000 --- a/usr/src/grub/grub-0.95/docs/help2man +++ /dev/null @@ -1,517 +0,0 @@ -#!/usr/bin/perl -w - -# Generate a short man page from --help and --version output. -# Copyright © 1997, 1998, 1999, 2000 Free Software Foundation, 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, 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 Brendan O'Dea -# Available from ftp://ftp.gnu.org/gnu/help2man/ - -use 5.004; -use strict; -use Getopt::Long; -use Text::Tabs qw(expand); -use POSIX qw(strftime setlocale LC_TIME); - -my $this_program = 'help2man'; -my $this_version = '1.23'; -my $version_info = < -EOT - -my $help_info = <. -EOT - -my $section = 1; -my ($opt_name, @opt_include, $opt_output, $opt_no_info); - -# Parse options. -Getopt::Long::config('bundling'); -GetOptions ( - 'n|name=s' => \$opt_name, - 's|section=s' => \$section, - 'i|include=s' => sub { push @opt_include, [ pop, 1 ] }, - 'I|opt-include=s' => sub { push @opt_include, [ pop, 0 ] }, - 'o|output=s' => \$opt_output, - 'N|no-info' => \$opt_no_info, - help => sub { print $help_info; exit }, - version => sub { print $version_info; exit }, -) or die $help_info; - -die $help_info unless @ARGV == 1; - -my %include = (); -my %append = (); -my @include = (); # retain order given in include file - -# Provide replacement `quote-regex' operator for pre-5.005. -BEGIN { eval q(sub qr { '' =~ $_[0]; $_[0] }) if $] < 5.005 } - -# Process include file (if given). Format is: -# -# [section name] -# verbatim text -# -# or -# -# /pattern/ -# verbatim text -# - -for (@opt_include) -{ - my ($inc, $required) = @$_; - - next unless -f $inc or $required; - die "$this_program: can't open `$inc' ($!)\n" - unless open INC, $inc; - - my $key; - my $hash = \%include; - - while () - { - # [section] - if (/^\[([^]]+)\]/) - { - $key = uc $1; - $key =~ s/^\s+//; - $key =~ s/\s+$//; - $hash = \%include; - push @include, $key unless $include{$key}; - next; - } - - # /pattern/ - if (m!^/(.*)/([ims]*)!) - { - my $pat = $2 ? "(?$2)$1" : $1; - - # Check pattern. - eval { $key = qr($pat) }; - if ($@) - { - $@ =~ s/ at .*? line \d.*//; - die "$inc:$.:$@"; - } - - $hash = \%append; - next; - } - - # Silently ignore anything before the first - # section--allows for comments and revision info. - next unless $key; - - $hash->{$key} ||= ''; - $hash->{$key} .= $_; - } - - close INC; - - die "$this_program: no valid information found in `$inc'\n" - unless $key; -} - -# Compress trailing blank lines. -for my $hash (\(%include, %append)) -{ - for (keys %$hash) { $hash->{$_} =~ s/\n+$/\n/ } -} - -# Turn off localisation of executable's ouput. -@ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3; - -# Turn off localisation of date (for strftime). -setlocale LC_TIME, 'C'; - -# Grab help and version info from executable. -my ($help_text, $version_text) = map { - join '', map { s/ +$//; expand $_ } `$ARGV[0] --$_ 2>/dev/null` - or die "$this_program: can't get `--$_' info from $ARGV[0]\n" -} qw(help version); - -my $date = strftime "%B %Y", localtime; -(my $program = $ARGV[0]) =~ s!.*/!!; -my $package = $program; -my $version; - -if ($opt_output) -{ - unlink $opt_output - or die "$this_program: can't unlink $opt_output ($!)\n" - if -e $opt_output; - - open STDOUT, ">$opt_output" - or die "$this_program: can't create $opt_output ($!)\n"; -} - -# The first line of the --version information is assumed to be in one -# of the following formats: -# -# -# -# {GNU,Free} -# ({GNU,Free} ) -# - {GNU,Free} -# -# and seperated from any copyright/author details by a blank line. - -($_, $version_text) = split /\n+/, $version_text, 2; - -if (/^(\S+) +\(((?:GNU|Free) +[^)]+)\) +(.*)/ or - /^(\S+) +- *((?:GNU|Free) +\S+) +(.*)/) -{ - $program = $1; - $package = $2; - $version = $3; -} -elsif (/^((?:GNU|Free) +)?(\S+) +(.*)/) -{ - $program = $2; - $package = $1 ? "$1$2" : $2; - $version = $3; -} -else -{ - $version = $_; -} - -$program =~ s!.*/!!; - -# No info for `info' itself. -$opt_no_info = 1 if $program eq 'info'; - -# --name overrides --include contents. -$include{NAME} = "$program \\- $opt_name\n" if $opt_name; - -# Default (useless) NAME paragraph. -$include{NAME} ||= "$program \\- manual page for $program $version\n"; - -# Man pages traditionally have the page title in caps. -my $PROGRAM = uc $program; - -# Extract usage clause(s) [if any] for SYNOPSIS. -if ($help_text =~ s/^Usage:( +(\S+))(.*)((?:\n(?: {6}\1| *or: +\S).*)*)//m) -{ - my @syn = $2 . $3; - - if ($_ = $4) - { - s/^\n//; - for (split /\n/) { s/^ *(or: +)?//; push @syn, $_ } - } - - my $synopsis = ''; - for (@syn) - { - $synopsis .= ".br\n" if $synopsis; - s!^\S*/!!; - s/^(\S+) *//; - $synopsis .= ".B $1\n"; - s/\s+$//; - s/(([][]|\.\.+)+)/\\fR$1\\fI/g; - s/^/\\fI/ unless s/^\\fR//; - $_ .= '\fR'; - s/(\\fI)( *)/$2$1/g; - s/\\fI\\fR//g; - s/^\\fR//; - s/\\fI$//; - s/^\./\\&./; - - $synopsis .= "$_\n"; - } - - $include{SYNOPSIS} ||= $synopsis; -} - -# Process text, initial section is DESCRIPTION. -my $sect = 'DESCRIPTION'; -$_ = "$help_text\n\n$version_text"; - -# Normalise paragraph breaks. -s/^\n+//; -s/\n*$/\n/; -s/\n\n+/\n\n/g; - -# Temporarily exchange leading dots, apostrophes and backslashes for -# tokens. -s/^\./\x80/mg; -s/^'/\x81/mg; -s/\\/\x82/g; - -# Start a new paragraph (if required) for these. -s/([^\n])\n(Report +bugs|Email +bug +reports +to|Written +by)/$1\n\n$2/g; - -sub convert_option; - -while (length) -{ - # Convert some standard paragraph names. - if (s/^(Options|Examples): *\n//) - { - $sect = uc $1; - next; - } - - # Copyright section - if (/^Copyright +[(\xa9]/) - { - $sect = 'COPYRIGHT'; - $include{$sect} ||= ''; - $include{$sect} .= ".PP\n" if $include{$sect}; - - my $copy; - ($copy, $_) = split /\n\n/, $_, 2; - - for ($copy) - { - # Add back newline - s/\n*$/\n/; - - # Convert iso9959-1 copyright symbol or (c) to nroff - # character. - s/^Copyright +(?:\xa9|\([Cc]\))/Copyright \\(co/mg; - - # Insert line breaks before additional copyright messages - # and the disclaimer. - s/(.)\n(Copyright |This +is +free +software)/$1\n.br\n$2/g; - - # Join hyphenated lines. - s/([A-Za-z])-\n */$1/g; - } - - $include{$sect} .= $copy; - $_ ||= ''; - next; - } - - # Catch bug report text. - if (/^(Report +bugs|Email +bug +reports +to) /) - { - $sect = 'REPORTING BUGS'; - } - - # Author section. - elsif (/^Written +by/) - { - $sect = 'AUTHOR'; - } - - # Examples, indicated by an indented leading $, % or > are - # rendered in a constant width font. - if (/^( +)([\$\%>] )\S/) - { - my $indent = $1; - my $prefix = $2; - my $break = '.IP'; - $include{$sect} ||= ''; - while (s/^$indent\Q$prefix\E(\S.*)\n*//) - { - $include{$sect} .= "$break\n\\f(CW$prefix$1\\fR\n"; - $break = '.br'; - } - - next; - } - - my $matched = ''; - $include{$sect} ||= ''; - - # Sub-sections have a trailing colon and the second line indented. - if (s/^(\S.*:) *\n / /) - { - $matched .= $& if %append; - $include{$sect} .= qq(.SS "$1"\n); - } - - my $indent = 0; - my $content = ''; - - # Option with description. - if (s/^( {1,10}([+-]\S.*?))(?:( +)|\n( {20,}))(\S.*)\n//) - { - $matched .= $& if %append; - $indent = length ($4 || "$1$3"); - $content = ".TP\n\x83$2\n\x83$5\n"; - unless ($4) - { - # Indent may be different on second line. - $indent = length $& if /^ {20,}/; - } - } - - # Option without description. - elsif (s/^ {1,10}([+-]\S.*)\n//) - { - $matched .= $& if %append; - $content = ".HP\n\x83$1\n"; - $indent = 80; # not continued - } - - # Indented paragraph with tag. - elsif (s/^( +(\S.*?) +)(\S.*)\n//) - { - $matched .= $& if %append; - $indent = length $1; - $content = ".TP\n\x83$2\n\x83$3\n"; - } - - # Indented paragraph. - elsif (s/^( +)(\S.*)\n//) - { - $matched .= $& if %append; - $indent = length $1; - $content = ".IP\n\x83$2\n"; - } - - # Left justified paragraph. - else - { - s/(.*)\n//; - $matched .= $& if %append; - $content = ".PP\n" if $include{$sect}; - $content .= "$1\n"; - } - - # Append continuations. - while (s/^ {$indent}(\S.*)\n//) - { - $matched .= $& if %append; - $content .= "\x83$1\n" - } - - # Move to next paragraph. - s/^\n+//; - - for ($content) - { - # Leading dot and apostrophe protection. - s/\x83\./\x80/g; - s/\x83'/\x81/g; - s/\x83//g; - - # Convert options. - s/(^| )(-[][\w=-]+)/$1 . convert_option $2/mge; - } - - # Check if matched paragraph contains /pat/. - if (%append) - { - for my $pat (keys %append) - { - if ($matched =~ $pat) - { - $content .= ".PP\n" unless $append{$pat} =~ /^\./; - $content .= $append{$pat}; - } - } - } - - $include{$sect} .= $content; -} - -# Refer to the real documentation. -unless ($opt_no_info) -{ - $sect = 'SEE ALSO'; - $include{$sect} ||= ''; - $include{$sect} .= ".PP\n" if $include{$sect}; - $include{$sect} .= < - -/* Macros. */ - -/* Check if the bit BIT in FLAGS is set. */ -#define CHECK_FLAG(flags,bit) ((flags) & (1 << (bit))) - -/* Some screen stuff. */ -/* The number of columns. */ -#define COLUMNS 80 -/* The number of lines. */ -#define LINES 24 -/* The attribute of an character. */ -#define ATTRIBUTE 7 -/* The video memory address. */ -#define VIDEO 0xB8000 - -/* Variables. */ -/* Save the X position. */ -static int xpos; -/* Save the Y position. */ -static int ypos; -/* Point to the video memory. */ -static volatile unsigned char *video; - -/* Forward declarations. */ -void cmain (unsigned long magic, unsigned long addr); -static void cls (void); -static void itoa (char *buf, int base, int d); -static void putchar (int c); -void printf (const char *format, ...); - -/* Check if MAGIC is valid and print the Multiboot information structure - pointed by ADDR. */ -void -cmain (unsigned long magic, unsigned long addr) -{ - multiboot_info_t *mbi; - - /* Clear the screen. */ - cls (); - - /* Am I booted by a Multiboot-compliant boot loader? */ - if (magic != MULTIBOOT_BOOTLOADER_MAGIC) - { - printf ("Invalid magic number: 0x%x\n", (unsigned) magic); - return; - } - - /* Set MBI to the address of the Multiboot information structure. */ - mbi = (multiboot_info_t *) addr; - - /* Print out the flags. */ - printf ("flags = 0x%x\n", (unsigned) mbi->flags); - - /* Are mem_* valid? */ - if (CHECK_FLAG (mbi->flags, 0)) - printf ("mem_lower = %uKB, mem_upper = %uKB\n", - (unsigned) mbi->mem_lower, (unsigned) mbi->mem_upper); - - /* Is boot_device valid? */ - if (CHECK_FLAG (mbi->flags, 1)) - printf ("boot_device = 0x%x\n", (unsigned) mbi->boot_device); - - /* Is the command line passed? */ - if (CHECK_FLAG (mbi->flags, 2)) - printf ("cmdline = %s\n", (char *) mbi->cmdline); - - /* Are mods_* valid? */ - if (CHECK_FLAG (mbi->flags, 3)) - { - module_t *mod; - int i; - - printf ("mods_count = %d, mods_addr = 0x%x\n", - (int) mbi->mods_count, (int) mbi->mods_addr); - for (i = 0, mod = (module_t *) mbi->mods_addr; - i < mbi->mods_count; - i++, mod++) - printf (" mod_start = 0x%x, mod_end = 0x%x, string = %s\n", - (unsigned) mod->mod_start, - (unsigned) mod->mod_end, - (char *) mod->string); - } - - /* Bits 4 and 5 are mutually exclusive! */ - if (CHECK_FLAG (mbi->flags, 4) && CHECK_FLAG (mbi->flags, 5)) - { - printf ("Both bits 4 and 5 are set.\n"); - return; - } - - /* Is the symbol table of a.out valid? */ - if (CHECK_FLAG (mbi->flags, 4)) - { - aout_symbol_table_t *aout_sym = &(mbi->u.aout_sym); - - printf ("aout_symbol_table: tabsize = 0x%0x, " - "strsize = 0x%x, addr = 0x%x\n", - (unsigned) aout_sym->tabsize, - (unsigned) aout_sym->strsize, - (unsigned) aout_sym->addr); - } - - /* Is the section header table of ELF valid? */ - if (CHECK_FLAG (mbi->flags, 5)) - { - elf_section_header_table_t *elf_sec = &(mbi->u.elf_sec); - - printf ("elf_sec: num = %u, size = 0x%x," - " addr = 0x%x, shndx = 0x%x\n", - (unsigned) elf_sec->num, (unsigned) elf_sec->size, - (unsigned) elf_sec->addr, (unsigned) elf_sec->shndx); - } - - /* Are mmap_* valid? */ - if (CHECK_FLAG (mbi->flags, 6)) - { - memory_map_t *mmap; - - printf ("mmap_addr = 0x%x, mmap_length = 0x%x\n", - (unsigned) mbi->mmap_addr, (unsigned) mbi->mmap_length); - for (mmap = (memory_map_t *) mbi->mmap_addr; - (unsigned long) mmap < mbi->mmap_addr + mbi->mmap_length; - mmap = (memory_map_t *) ((unsigned long) mmap - + mmap->size + sizeof (mmap->size))) - printf (" size = 0x%x, base_addr = 0x%x%x," - " length = 0x%x%x, type = 0x%x\n", - (unsigned) mmap->size, - (unsigned) mmap->base_addr_high, - (unsigned) mmap->base_addr_low, - (unsigned) mmap->length_high, - (unsigned) mmap->length_low, - (unsigned) mmap->type); - } -} - -/* Clear the screen and initialize VIDEO, XPOS and YPOS. */ -static void -cls (void) -{ - int i; - - video = (unsigned char *) VIDEO; - - for (i = 0; i < COLUMNS * LINES * 2; i++) - *(video + i) = 0; - - xpos = 0; - ypos = 0; -} - -/* Convert the integer D to a string and save the string in BUF. If - BASE is equal to 'd', interpret that D is decimal, and if BASE is - equal to 'x', interpret that D is hexadecimal. */ -static void -itoa (char *buf, int base, int d) -{ - char *p = buf; - char *p1, *p2; - unsigned long ud = d; - int divisor = 10; - - /* If %d is specified and D is minus, put `-' in the head. */ - if (base == 'd' && d < 0) - { - *p++ = '-'; - buf++; - ud = -d; - } - else if (base == 'x') - divisor = 16; - - /* Divide UD by DIVISOR until UD == 0. */ - do - { - int remainder = ud % divisor; - - *p++ = (remainder < 10) ? remainder + '0' : remainder + 'a' - 10; - } - while (ud /= divisor); - - /* Terminate BUF. */ - *p = 0; - - /* Reverse BUF. */ - p1 = buf; - p2 = p - 1; - while (p1 < p2) - { - char tmp = *p1; - *p1 = *p2; - *p2 = tmp; - p1++; - p2--; - } -} - -/* Put the character C on the screen. */ -static void -putchar (int c) -{ - if (c == '\n' || c == '\r') - { - newline: - xpos = 0; - ypos++; - if (ypos >= LINES) - ypos = 0; - return; - } - - *(video + (xpos + ypos * COLUMNS) * 2) = c & 0xFF; - *(video + (xpos + ypos * COLUMNS) * 2 + 1) = ATTRIBUTE; - - xpos++; - if (xpos >= COLUMNS) - goto newline; -} - -/* Format a string and print it on the screen, just like the libc - function printf. */ -void -printf (const char *format, ...) -{ - char **arg = (char **) &format; - int c; - char buf[20]; - - arg++; - - while ((c = *format++) != 0) - { - if (c != '%') - putchar (c); - else - { - char *p; - - c = *format++; - switch (c) - { - case 'd': - case 'u': - case 'x': - itoa (buf, c, *((int *) arg++)); - p = buf; - goto string; - break; - - case 's': - p = *arg++; - if (! p) - p = "(null)"; - - string: - while (*p) - putchar (*p++); - break; - - default: - putchar (*((int *) arg++)); - break; - } - } - } -} diff --git a/usr/src/grub/grub-0.95/docs/kernel.c.texi b/usr/src/grub/grub-0.95/docs/kernel.c.texi deleted file mode 100644 index bd61bd58e0..0000000000 --- a/usr/src/grub/grub-0.95/docs/kernel.c.texi +++ /dev/null @@ -1,284 +0,0 @@ -/* @r{kernel.c - the C part of the kernel} */ -/* @r{Copyright (C) 1999 Free Software Foundation, 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 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 - -/* @r{Macros.} */ - -/* @r{Check if the bit BIT in FLAGS is set.} */ -#define CHECK_FLAG(flags,bit) ((flags) & (1 << (bit))) - -/* @r{Some screen stuff.} */ -/* @r{The number of columns.} */ -#define COLUMNS 80 -/* @r{The number of lines.} */ -#define LINES 24 -/* @r{The attribute of an character.} */ -#define ATTRIBUTE 7 -/* @r{The video memory address.} */ -#define VIDEO 0xB8000 - -/* @r{Variables.} */ -/* @r{Save the X position.} */ -static int xpos; -/* @r{Save the Y position.} */ -static int ypos; -/* @r{Point to the video memory.} */ -static volatile unsigned char *video; - -/* @r{Forward declarations.} */ -void cmain (unsigned long magic, unsigned long addr); -static void cls (void); -static void itoa (char *buf, int base, int d); -static void putchar (int c); -void printf (const char *format, ...); - -/* @r{Check if MAGIC is valid and print the Multiboot information structure - pointed by ADDR.} */ -void -cmain (unsigned long magic, unsigned long addr) -@{ - multiboot_info_t *mbi; - - /* @r{Clear the screen.} */ - cls (); - - /* @r{Am I booted by a Multiboot-compliant boot loader?} */ - if (magic != MULTIBOOT_BOOTLOADER_MAGIC) - @{ - printf ("Invalid magic number: 0x%x\n", (unsigned) magic); - return; - @} - - /* @r{Set MBI to the address of the Multiboot information structure.} */ - mbi = (multiboot_info_t *) addr; - - /* @r{Print out the flags.} */ - printf ("flags = 0x%x\n", (unsigned) mbi->flags); - - /* @r{Are mem_* valid?} */ - if (CHECK_FLAG (mbi->flags, 0)) - printf ("mem_lower = %uKB, mem_upper = %uKB\n", - (unsigned) mbi->mem_lower, (unsigned) mbi->mem_upper); - - /* @r{Is boot_device valid?} */ - if (CHECK_FLAG (mbi->flags, 1)) - printf ("boot_device = 0x%x\n", (unsigned) mbi->boot_device); - - /* @r{Is the command line passed?} */ - if (CHECK_FLAG (mbi->flags, 2)) - printf ("cmdline = %s\n", (char *) mbi->cmdline); - - /* @r{Are mods_* valid?} */ - if (CHECK_FLAG (mbi->flags, 3)) - @{ - module_t *mod; - int i; - - printf ("mods_count = %d, mods_addr = 0x%x\n", - (int) mbi->mods_count, (int) mbi->mods_addr); - for (i = 0, mod = (module_t *) mbi->mods_addr; - i < mbi->mods_count; - i++, mod++) - printf (" mod_start = 0x%x, mod_end = 0x%x, string = %s\n", - (unsigned) mod->mod_start, - (unsigned) mod->mod_end, - (char *) mod->string); - @} - - /* @r{Bits 4 and 5 are mutually exclusive!} */ - if (CHECK_FLAG (mbi->flags, 4) && CHECK_FLAG (mbi->flags, 5)) - @{ - printf ("Both bits 4 and 5 are set.\n"); - return; - @} - - /* @r{Is the symbol table of a.out valid?} */ - if (CHECK_FLAG (mbi->flags, 4)) - @{ - aout_symbol_table_t *aout_sym = &(mbi->u.aout_sym); - - printf ("aout_symbol_table: tabsize = 0x%0x, " - "strsize = 0x%x, addr = 0x%x\n", - (unsigned) aout_sym->tabsize, - (unsigned) aout_sym->strsize, - (unsigned) aout_sym->addr); - @} - - /* @r{Is the section header table of ELF valid?} */ - if (CHECK_FLAG (mbi->flags, 5)) - @{ - elf_section_header_table_t *elf_sec = &(mbi->u.elf_sec); - - printf ("elf_sec: num = %u, size = 0x%x," - " addr = 0x%x, shndx = 0x%x\n", - (unsigned) elf_sec->num, (unsigned) elf_sec->size, - (unsigned) elf_sec->addr, (unsigned) elf_sec->shndx); - @} - - /* @r{Are mmap_* valid?} */ - if (CHECK_FLAG (mbi->flags, 6)) - @{ - memory_map_t *mmap; - - printf ("mmap_addr = 0x%x, mmap_length = 0x%x\n", - (unsigned) mbi->mmap_addr, (unsigned) mbi->mmap_length); - for (mmap = (memory_map_t *) mbi->mmap_addr; - (unsigned long) mmap < mbi->mmap_addr + mbi->mmap_length; - mmap = (memory_map_t *) ((unsigned long) mmap - + mmap->size + sizeof (mmap->size))) - printf (" size = 0x%x, base_addr = 0x%x%x," - " length = 0x%x%x, type = 0x%x\n", - (unsigned) mmap->size, - (unsigned) mmap->base_addr_high, - (unsigned) mmap->base_addr_low, - (unsigned) mmap->length_high, - (unsigned) mmap->length_low, - (unsigned) mmap->type); - @} -@} - -/* @r{Clear the screen and initialize VIDEO, XPOS and YPOS.} */ -static void -cls (void) -@{ - int i; - - video = (unsigned char *) VIDEO; - - for (i = 0; i < COLUMNS * LINES * 2; i++) - *(video + i) = 0; - - xpos = 0; - ypos = 0; -@} - -/* @r{Convert the integer D to a string and save the string in BUF. If - BASE is equal to 'd', interpret that D is decimal, and if BASE is - equal to 'x', interpret that D is hexadecimal.} */ -static void -itoa (char *buf, int base, int d) -@{ - char *p = buf; - char *p1, *p2; - unsigned long ud = d; - int divisor = 10; - - /* @r{If %d is specified and D is minus, put `-' in the head.} */ - if (base == 'd' && d < 0) - @{ - *p++ = '-'; - buf++; - ud = -d; - @} - else if (base == 'x') - divisor = 16; - - /* @r{Divide UD by DIVISOR until UD == 0.} */ - do - @{ - int remainder = ud % divisor; - - *p++ = (remainder < 10) ? remainder + '0' : remainder + 'a' - 10; - @} - while (ud /= divisor); - - /* @r{Terminate BUF.} */ - *p = 0; - - /* @r{Reverse BUF.} */ - p1 = buf; - p2 = p - 1; - while (p1 < p2) - @{ - char tmp = *p1; - *p1 = *p2; - *p2 = tmp; - p1++; - p2--; - @} -@} - -/* @r{Put the character C on the screen.} */ -static void -putchar (int c) -@{ - if (c == '\n' || c == '\r') - @{ - newline: - xpos = 0; - ypos++; - if (ypos >= LINES) - ypos = 0; - return; - @} - - *(video + (xpos + ypos * COLUMNS) * 2) = c & 0xFF; - *(video + (xpos + ypos * COLUMNS) * 2 + 1) = ATTRIBUTE; - - xpos++; - if (xpos >= COLUMNS) - goto newline; -@} - -/* @r{Format a string and print it on the screen, just like the libc - function printf.} */ -void -printf (const char *format, ...) -@{ - char **arg = (char **) &format; - int c; - char buf[20]; - - arg++; - - while ((c = *format++) != 0) - @{ - if (c != '%') - putchar (c); - else - @{ - char *p; - - c = *format++; - switch (c) - @{ - case 'd': - case 'u': - case 'x': - itoa (buf, c, *((int *) arg++)); - p = buf; - goto string; - break; - - case 's': - p = *arg++; - if (! p) - p = "(null)"; - - string: - while (*p) - putchar (*p++); - break; - - default: - putchar (*((int *) arg++)); - break; - @} - @} - @} -@} diff --git a/usr/src/grub/grub-0.95/docs/mbchk.1 b/usr/src/grub/grub-0.95/docs/mbchk.1 deleted file mode 100644 index 3a5e318816..0000000000 --- a/usr/src/grub/grub-0.95/docs/mbchk.1 +++ /dev/null @@ -1,27 +0,0 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.23. -.TH MBCHK "1" "June 2004" "mbchk (GNU GRUB 0.95)" FSF -.SH NAME -mbchk \- check the format of a Multiboot kernel -.SH SYNOPSIS -.B mbchk -[\fIOPTION\fR]... [\fIFILE\fR]... -.SH DESCRIPTION -Check if the format of FILE complies with the Multiboot Specification. -.PP -\fB\-q\fR, \fB\-\-quiet\fR suppress all normal output -\fB\-h\fR, \fB\-\-help\fR display this help and exit -\fB\-v\fR, \fB\-\-version\fR output version information and exit. -.SH "REPORTING BUGS" -Report bugs to . -.SH "SEE ALSO" -The full documentation for -.B mbchk -is maintained as a Texinfo manual. If the -.B info -and -.B mbchk -programs are properly installed at your site, the command -.IP -.B info mbchk -.PP -should give you access to the complete manual. diff --git a/usr/src/grub/grub-0.95/docs/mdate-sh b/usr/src/grub/grub-0.95/docs/mdate-sh deleted file mode 100644 index 05e828b081..0000000000 --- a/usr/src/grub/grub-0.95/docs/mdate-sh +++ /dev/null @@ -1,170 +0,0 @@ -#!/bin/sh -# Get modification time of a file or directory and pretty-print it. - -scriptversion=2003-11-09.00 - -# Copyright (C) 1995, 1996, 1997, 2003 Free Software Foundation, Inc. -# written by Ulrich Drepper , June 1995 -# -# 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. -# -# 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. - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# This file is maintained in Automake, please report -# bugs to or send patches to -# . - -case $1 in - '') - echo "$0: No file. Try \`$0 --help' for more information." 1>&2 - exit 1; - ;; - -h | --h*) - cat <<\EOF -Usage: mdate-sh [--help] [--version] FILE - -Pretty-print the modification time of FILE. - -Report bugs to . -EOF - exit 0 - ;; - -v | --v*) - echo "mdate-sh $scriptversion" - exit 0 - ;; -esac - -# Prevent date giving response in another language. -LANG=C -export LANG -LC_ALL=C -export LC_ALL -LC_TIME=C -export LC_TIME - -save_arg1="$1" - -# Find out how to get the extended ls output of a file or directory. -if ls -L /dev/null 1>/dev/null 2>&1; then - ls_command='ls -L -l -d' -else - ls_command='ls -l -d' -fi - -# A `ls -l' line looks as follows on OS/2. -# drwxrwx--- 0 Aug 11 2001 foo -# This differs from Unix, which adds ownership information. -# drwxrwx--- 2 root root 4096 Aug 11 2001 foo -# -# To find the date, we split the line on spaces and iterate on words -# until we find a month. This cannot work with files whose owner is a -# user named `Jan', or `Feb', etc. However, it's unlikely that `/' -# will be owned by a user whose name is a month. So we first look at -# the extended ls output of the root directory to decide how many -# words should be skipped to get the date. - -# On HPUX /bin/sh, "set" interprets "-rw-r--r--" as options, so the "x" below. -set - x`$ls_command /` - -# Find which argument is the month. -month= -command= -until test $month -do - shift - # Add another shift to the command. - command="$command shift;" - case $1 in - Jan) month=January; nummonth=1;; - Feb) month=February; nummonth=2;; - Mar) month=March; nummonth=3;; - Apr) month=April; nummonth=4;; - May) month=May; nummonth=5;; - Jun) month=June; nummonth=6;; - Jul) month=July; nummonth=7;; - Aug) month=August; nummonth=8;; - Sep) month=September; nummonth=9;; - Oct) month=October; nummonth=10;; - Nov) month=November; nummonth=11;; - Dec) month=December; nummonth=12;; - esac -done - -# Get the extended ls output of the file or directory. -set - x`eval "$ls_command \"\$save_arg1\""` - -# Remove all preceding arguments -eval $command - -# Get the month. Next argument is day, followed by the year or time. -case $1 in - Jan) month=January; nummonth=1;; - Feb) month=February; nummonth=2;; - Mar) month=March; nummonth=3;; - Apr) month=April; nummonth=4;; - May) month=May; nummonth=5;; - Jun) month=June; nummonth=6;; - Jul) month=July; nummonth=7;; - Aug) month=August; nummonth=8;; - Sep) month=September; nummonth=9;; - Oct) month=October; nummonth=10;; - Nov) month=November; nummonth=11;; - Dec) month=December; nummonth=12;; -esac - -day=$2 - -# Here we have to deal with the problem that the ls output gives either -# the time of day or the year. -case $3 in - *:*) set `date`; eval year=\$$# - case $2 in - Jan) nummonthtod=1;; - Feb) nummonthtod=2;; - Mar) nummonthtod=3;; - Apr) nummonthtod=4;; - May) nummonthtod=5;; - Jun) nummonthtod=6;; - Jul) nummonthtod=7;; - Aug) nummonthtod=8;; - Sep) nummonthtod=9;; - Oct) nummonthtod=10;; - Nov) nummonthtod=11;; - Dec) nummonthtod=12;; - esac - # For the first six month of the year the time notation can also - # be used for files modified in the last year. - if (expr $nummonth \> $nummonthtod) > /dev/null; - then - year=`expr $year - 1` - fi;; - *) year=$3;; -esac - -# The result. -echo $day $month $year - -# Local Variables: -# mode: shell-script -# sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-end: "$" -# End: diff --git a/usr/src/grub/grub-0.95/docs/menu.lst b/usr/src/grub/grub-0.95/docs/menu.lst deleted file mode 100644 index ae58aee7ce..0000000000 --- a/usr/src/grub/grub-0.95/docs/menu.lst +++ /dev/null @@ -1,82 +0,0 @@ -# -# Sample boot menu configuration file -# - -# Boot automatically after 30 secs. -timeout 30 - -# By default, boot the first entry. -default 0 - -# Fallback to the second entry. -fallback 1 - -# For booting GNU/Hurd -title GNU/Hurd -root (hd0,0) -kernel /boot/gnumach.gz root=hd0s1 -module /boot/serverboot.gz - -# For booting GNU/Linux -title GNU/Linux -root (hd1,0) -kernel /vmlinuz root=/dev/hdb1 -#initrd /initrd.img - -# For booting GNU/kFreeBSD -title GNU/kFreeBSD -root (hd0,2,a) -kernel /boot/loader.gz - -# For booting GNU/kNetBSD -title GNU/kNetBSD -root (hd0,2,a) -kernel --type=netbsd /boot/knetbsd.gz - -# For booting Mach (getting kernel from floppy) -title Utah Mach4 multiboot -root (hd0,2) -pause Insert the diskette now!! -kernel (fd0)/boot/kernel root=hd0s3 -module (fd0)/boot/bootstrap - -# For booting FreeBSD -title FreeBSD -root (hd0,2,a) -kernel /boot/loader - -# For booting NetBSD -title NetBSD -root (hd0,2,a) -kernel --type=netbsd /netbsd - -# For booting OpenBSD -title OpenBSD -root (hd0,2,a) -kernel --type=netbsd /bsd - -# For booting OS/2 -title OS/2 -root (hd0,1) -makeactive -# chainload OS/2 bootloader from the first sector -chainloader +1 -# This is similar to "chainload", but loads a specific file -#chainloader /boot/chain.os2 - -# For booting Windows NT or Windows95 -title Windows NT / Windows 95 boot menu -rootnoverify (hd0,0) -makeactive -chainloader +1 -# For loading DOS if Windows NT is installed -# chainload /bootsect.dos - -# For installing GRUB into the hard disk -title Install GRUB into the hard disk -root (hd0,0) -setup (hd0) - -# Change the colors. -title Change the colors -color light-green/brown blink-red/blue diff --git a/usr/src/grub/grub-0.95/docs/multiboot.h b/usr/src/grub/grub-0.95/docs/multiboot.h deleted file mode 100644 index df79225aa9..0000000000 --- a/usr/src/grub/grub-0.95/docs/multiboot.h +++ /dev/null @@ -1,119 +0,0 @@ -/* multiboot.h - the header for Multiboot */ -/* Copyright (C) 1999, 2001 Free Software Foundation, 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 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. */ - -/* Macros. */ - -/* The magic number for the Multiboot header. */ -#define MULTIBOOT_HEADER_MAGIC 0x1BADB002 - -/* The flags for the Multiboot header. */ -#ifdef __ELF__ -# define MULTIBOOT_HEADER_FLAGS 0x00000003 -#else -# define MULTIBOOT_HEADER_FLAGS 0x00010003 -#endif - -/* The magic number passed by a Multiboot-compliant boot loader. */ -#define MULTIBOOT_BOOTLOADER_MAGIC 0x2BADB002 - -/* The size of our stack (16KB). */ -#define STACK_SIZE 0x4000 - -/* C symbol format. HAVE_ASM_USCORE is defined by configure. */ -#ifdef HAVE_ASM_USCORE -# define EXT_C(sym) _ ## sym -#else -# define EXT_C(sym) sym -#endif - -#ifndef ASM -/* Do not include here in boot.S. */ - -/* Types. */ - -/* The Multiboot header. */ -typedef struct multiboot_header -{ - unsigned long magic; - unsigned long flags; - unsigned long checksum; - unsigned long header_addr; - unsigned long load_addr; - unsigned long load_end_addr; - unsigned long bss_end_addr; - unsigned long entry_addr; -} multiboot_header_t; - -/* The symbol table for a.out. */ -typedef struct aout_symbol_table -{ - unsigned long tabsize; - unsigned long strsize; - unsigned long addr; - unsigned long reserved; -} aout_symbol_table_t; - -/* The section header table for ELF. */ -typedef struct elf_section_header_table -{ - unsigned long num; - unsigned long size; - unsigned long addr; - unsigned long shndx; -} elf_section_header_table_t; - -/* The Multiboot information. */ -typedef struct multiboot_info -{ - unsigned long flags; - unsigned long mem_lower; - unsigned long mem_upper; - unsigned long boot_device; - unsigned long cmdline; - unsigned long mods_count; - unsigned long mods_addr; - union - { - aout_symbol_table_t aout_sym; - elf_section_header_table_t elf_sec; - } u; - unsigned long mmap_length; - unsigned long mmap_addr; -} multiboot_info_t; - -/* The module structure. */ -typedef struct module -{ - unsigned long mod_start; - unsigned long mod_end; - unsigned long string; - unsigned long reserved; -} module_t; - -/* The memory map. Be careful that the offset 0 is base_addr_low - but no size. */ -typedef struct memory_map -{ - unsigned long size; - unsigned long base_addr_low; - unsigned long base_addr_high; - unsigned long length_low; - unsigned long length_high; - unsigned long type; -} memory_map_t; - -#endif /* ! ASM */ diff --git a/usr/src/grub/grub-0.95/docs/multiboot.h.texi b/usr/src/grub/grub-0.95/docs/multiboot.h.texi deleted file mode 100644 index 3fa8c0b7cd..0000000000 --- a/usr/src/grub/grub-0.95/docs/multiboot.h.texi +++ /dev/null @@ -1,119 +0,0 @@ -/* @r{multiboot.h - the header for Multiboot} */ -/* @r{Copyright (C) 1999, 2001 Free Software Foundation, 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 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.} */ - -/* @r{Macros.} */ - -/* @r{The magic number for the Multiboot header.} */ -#define MULTIBOOT_HEADER_MAGIC 0x1BADB002 - -/* @r{The flags for the Multiboot header.} */ -#ifdef __ELF__ -# define MULTIBOOT_HEADER_FLAGS 0x00000003 -#else -# define MULTIBOOT_HEADER_FLAGS 0x00010003 -#endif - -/* @r{The magic number passed by a Multiboot-compliant boot loader.} */ -#define MULTIBOOT_BOOTLOADER_MAGIC 0x2BADB002 - -/* @r{The size of our stack (16KB).} */ -#define STACK_SIZE 0x4000 - -/* @r{C symbol format. HAVE_ASM_USCORE is defined by configure.} */ -#ifdef HAVE_ASM_USCORE -# define EXT_C(sym) _ ## sym -#else -# define EXT_C(sym) sym -#endif - -#ifndef ASM -/* @r{Do not include here in boot.S.} */ - -/* @r{Types.} */ - -/* @r{The Multiboot header.} */ -typedef struct multiboot_header -@{ - unsigned long magic; - unsigned long flags; - unsigned long checksum; - unsigned long header_addr; - unsigned long load_addr; - unsigned long load_end_addr; - unsigned long bss_end_addr; - unsigned long entry_addr; -@} multiboot_header_t; - -/* @r{The symbol table for a.out.} */ -typedef struct aout_symbol_table -@{ - unsigned long tabsize; - unsigned long strsize; - unsigned long addr; - unsigned long reserved; -@} aout_symbol_table_t; - -/* @r{The section header table for ELF.} */ -typedef struct elf_section_header_table -@{ - unsigned long num; - unsigned long size; - unsigned long addr; - unsigned long shndx; -@} elf_section_header_table_t; - -/* @r{The Multiboot information.} */ -typedef struct multiboot_info -@{ - unsigned long flags; - unsigned long mem_lower; - unsigned long mem_upper; - unsigned long boot_device; - unsigned long cmdline; - unsigned long mods_count; - unsigned long mods_addr; - union - @{ - aout_symbol_table_t aout_sym; - elf_section_header_table_t elf_sec; - @} u; - unsigned long mmap_length; - unsigned long mmap_addr; -@} multiboot_info_t; - -/* @r{The module structure.} */ -typedef struct module -@{ - unsigned long mod_start; - unsigned long mod_end; - unsigned long string; - unsigned long reserved; -@} module_t; - -/* @r{The memory map. Be careful that the offset 0 is base_addr_low - but no size.} */ -typedef struct memory_map -@{ - unsigned long size; - unsigned long base_addr_low; - unsigned long base_addr_high; - unsigned long length_low; - unsigned long length_high; - unsigned long type; -@} memory_map_t; - -#endif /* @r{! ASM} */ diff --git a/usr/src/grub/grub-0.95/docs/multiboot.info b/usr/src/grub/grub-0.95/docs/multiboot.info deleted file mode 100644 index 88937a782c..0000000000 --- a/usr/src/grub/grub-0.95/docs/multiboot.info +++ /dev/null @@ -1,1661 +0,0 @@ -This is multiboot.info, produced by makeinfo version 4.0 from -multiboot.texi. - -INFO-DIR-SECTION Kernel -START-INFO-DIR-ENTRY -* Multiboot Specification: (multiboot). Multiboot Specification. -END-INFO-DIR-ENTRY - - Copyright (C) 1995, 96 Bryan Ford Copyright (C) -1995, 96 Erich Stefan Boleyn Copyright (C) 1999, 2000, -2001, 2002 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: multiboot.info, Node: Top, Next: Overview, Up: (dir) - -Multiboot Specification -*********************** - - This file documents Multiboot Specification, the proposal for the -boot sequence standard. This edition documents version 0.6.93. - -* Menu: - -* Overview:: -* Terminology:: -* Specification:: -* Examples:: -* History:: -* Index:: - - -File: multiboot.info, Node: Overview, Next: Terminology, Prev: Top, Up: Top - -Introduction to Multiboot Specification -*************************************** - - This chapter describes some rough information on the Multiboot -Specification. Note that this is not a part of the specification itself. - -* Menu: - -* Motivation:: -* Architecture:: -* Operating systems:: -* Boot sources:: -* Boot-time configuration:: -* Convenience to operating systems:: -* Boot modules:: - - -File: multiboot.info, Node: Motivation, Next: Architecture, Up: Overview - -The background of Multiboot Specification -========================================= - - Every operating system ever created tends to have its own boot -loader. Installing a new operating system on a machine generally -involves installing a whole new set of boot mechanisms, each with -completely different install-time and boot-time user interfaces. -Getting multiple operating systems to coexist reliably on one machine -through typical "chaining" mechanisms can be a nightmare. There is -little or no choice of boot loaders for a particular operating system --- if the one that comes with the operating system doesn't do exactly -what you want, or doesn't work on your machine, you're screwed. - - While we may not be able to fix this problem in existing commercial -operating systems, it shouldn't be too difficult for a few people in the -free operating system communities to put their heads together and solve -this problem for the popular free operating systems. That's what this -specification aims for. Basically, it specifies an interface between a -boot loader and a operating system, such that any complying boot loader -should be able to load any complying operating system. This -specification does _not_ specify how boot loaders should work -- only -how they must interface with the operating system being loaded. - - -File: multiboot.info, Node: Architecture, Next: Operating systems, Prev: Motivation, Up: Overview - -The target architecture -======================= - - This specification is primarily targeted at PC, since they are the -most common and have the largest variety of operating systems and boot -loaders. However, to the extent that certain other architectures may -need a boot specification and do not have one already, a variation of -this specification, stripped of the x86-specific details, could be -adopted for them as well. - - -File: multiboot.info, Node: Operating systems, Next: Boot sources, Prev: Architecture, Up: Overview - -The target operating systems -============================ - - This specification is targeted toward free 32-bit operating systems -that can be fairly easily modified to support the specification without -going through lots of bureaucratic rigmarole. The particular free -operating systems that this specification is being primarily designed -for are Linux, FreeBSD, NetBSD, Mach, and VSTa. It is hoped that other -emerging free operating systems will adopt it from the start, and thus -immediately be able to take advantage of existing boot loaders. It would -be nice if commercial operating system vendors eventually adopted this -specification as well, but that's probably a pipe dream. - - -File: multiboot.info, Node: Boot sources, Next: Boot-time configuration, Prev: Operating systems, Up: Overview - -Boot sources -============ - - It should be possible to write compliant boot loaders that load the -OS image from a variety of sources, including floppy disk, hard disk, -and across a network. - - Disk-based boot loaders may use a variety of techniques to find the -relevant OS image and boot module data on disk, such as by -interpretation of specific file systems (e.g. the BSD/Mach boot loader), -using precalculated "block lists" (e.g. LILO), loading from a special -"boot partition" (e.g. OS/2), or even loading from within another -operating system (e.g. the VSTa boot code, which loads from DOS). -Similarly, network-based boot loaders could use a variety of network -hardware and protocols. - - It is hoped that boot loaders will be created that support multiple -loading mechanisms, increasing their portability, robustness, and -user-friendliness. - - -File: multiboot.info, Node: Boot-time configuration, Next: Convenience to operating systems, Prev: Boot sources, Up: Overview - -Configure an operating system at boot-time -========================================== - - It is often necessary for one reason or another for the user to be -able to provide some configuration information to an operating system -dynamically at boot time. While this specification should not dictate -how this configuration information is obtained by the boot loader, it -should provide a standard means for the boot loader to pass such -information to the operating system. - - -File: multiboot.info, Node: Convenience to operating systems, Next: Boot modules, Prev: Boot-time configuration, Up: Overview - -How to make OS development easier -================================= - - OS images should be easy to generate. Ideally, an OS image should -simply be an ordinary 32-bit executable file in whatever file format the -operating system normally uses. It should be possible to `nm' or -disassemble OS images just like normal executables. Specialized tools -should not be required to create OS images in a _special_ file format. -If this means shifting some work from the operating system to a boot -loader, that is probably appropriate, because all the memory consumed -by the boot loader will typically be made available again after the -boot process is created, whereas every bit of code in the OS image -typically has to remain in memory forever. The operating system should -not have to worry about getting into 32-bit mode initially, because mode -switching code generally needs to be in the boot loader anyway in order -to load operating system data above the 1MB boundary, and forcing the -operating system to do this makes creation of OS images much more -difficult. - - Unfortunately, there is a horrendous variety of executable file -formats even among free Unix-like PC-based operating systems -- -generally a different format for each operating system. Most of the -relevant free operating systems use some variant of a.out format, but -some are moving to ELF. It is highly desirable for boot loaders not to -have to be able to interpret all the different types of executable file -formats in existence in order to load the OS image -- otherwise the -boot loader effectively becomes operating system specific again. - - This specification adopts a compromise solution to this problem. -Multiboot-compliant OS images always contain a magic "Multiboot header" -(*note OS image format::), which allows the boot loader to load the -image without having to understand numerous a.out variants or other -executable formats. This magic header does not need to be at the very -beginning of the executable file, so kernel images can still conform to -the local a.out format variant in addition to being Multiboot-compliant. - - -File: multiboot.info, Node: Boot modules, Prev: Convenience to operating systems, Up: Overview - -Boot modules -============ - - Many modern operating system kernels, such as those of VSTa and -Mach, do not by themselves contain enough mechanism to get the system -fully operational: they require the presence of additional software -modules at boot time in order to access devices, mount file systems, -etc. While these additional modules could be embedded in the main OS -image along with the kernel itself, and the resulting image be split -apart manually by the operating system when it receives control, it is -often more flexible, more space-efficient, and more convenient to the -operating system and user if the boot loader can load these additional -modules independently in the first place. - - Thus, this specification should provide a standard method for a boot -loader to indicate to the operating system what auxiliary boot modules -were loaded, and where they can be found. Boot loaders don't have to -support multiple boot modules, but they are strongly encouraged to, -because some operating systems will be unable to boot without them. - - -File: multiboot.info, Node: Terminology, Next: Specification, Prev: Overview, Up: Top - -The definitions of terms used through the specification -******************************************************* - -"must" - We use the term "must", when any boot loader or OS image needs to - follow a rule -- otherwise, the boot loader or OS image is _not_ - Multiboot-compliant. - -"should" - We use the term "should", when any boot loader or OS image is - recommended to follow a rule, but it doesn't need to follow the - rule. - -"may" - We use the term "may", when any boot loader or OS image is allowed - to follow a rule. - -"boot loader" - Whatever program or set of programs loads the image of the final - operating system to be run on the machine. The boot loader may - itself consist of several stages, but that is an implementation - detail not relevant to this specification. Only the _final_ stage - of the boot loader -- the stage that eventually transfers control - to an operating system -- must follow the rules specified in this - document in order to be "Multiboot-compliant"; earlier boot loader - stages may be designed in whatever way is most convenient. - -"OS image" - The initial binary image that a boot loader loads into memory and - transfers control to start an operating system. The OS image is - typically an executable containing the operating system kernel. - -"boot module" - Other auxiliary files that a boot loader loads into memory along - with an OS image, but does not interpret in any way other than - passing their locations to the operating system when it is invoked. - -"Multiboot-compliant" - A boot loader or an OS image which follows the rules defined as - "must" is Multiboot-compliant. When this specification specifies a - rule as "should" or "may", a Multiboot-complaint boot loader/OS - image doesn't need to follow the rule. - -"u8" - The type of unsigned 8-bit data. - -"u16" - The type of unsigned 16-bit data. Because the target architecture - is little-endian, u16 is coded in little-endian. - -"u32" - The type of unsigned 32-bit data. Because the target architecture - is little-endian, u32 is coded in little-endian. - -"u64" - The type of unsigned 64-bit data. Because the target architecture - is little-endian, u64 is coded in little-endian. - - -File: multiboot.info, Node: Specification, Next: Examples, Prev: Terminology, Up: Top - -The exact definitions of Multiboot Specification -************************************************ - - There are three main aspects of a boot loader/OS image interface: - - 1. The format of an OS image as seen by a boot loader. - - 2. The state of a machine when a boot loader starts an operating - system. - - 3. The format of information passed by a boot loader to an operating - system. - -* Menu: - -* OS image format:: -* Machine state:: -* Boot information format:: - - -File: multiboot.info, Node: OS image format, Next: Machine state, Up: Specification - -OS image format -=============== - - An OS image may be an ordinary 32-bit executable file in the standard -format for that particular operating system, except that it may be -linked at a non-default load address to avoid loading on top of the -PC's I/O region or other reserved areas, and of course it should not -use shared libraries or other fancy features. - - An OS image must contain an additional header called "Multiboot -header", besides the headers of the format used by the OS image. The -Multiboot header must be contained completely within the first 8192 -bytes of the OS image, and must be longword (32-bit) aligned. In -general, it should come _as early as possible_, and may be embedded in -the beginning of the text segment after the _real_ executable header. - -* Menu: - -* Header layout:: The layout of Multiboot header -* Header magic fields:: The magic fields of Multiboot header -* Header address fields:: -* Header graphics fields:: - - -File: multiboot.info, Node: Header layout, Next: Header magic fields, Up: OS image format - -The layout of Multiboot header ------------------------------- - - The layout of the Multiboot header must be as follows: - -Offset Type Field Name Note -0 u32 magic required -4 u32 flags required -8 u32 checksum required -12 u32 header_addr if flags[16] is set -16 u32 load_addr if flags[16] is set -20 u32 load_end_addr if flags[16] is set -24 u32 bss_end_addr if flags[16] is set -28 u32 entry_addr if flags[16] is set -32 u32 mode_type if flags[2] is set -36 u32 width if flags[2] is set -40 u32 height if flags[2] is set -44 u32 depth if flags[2] is set - - The fields `magic', `flags' and `checksum' are defined in *Note -Header magic fields::, the fields `header_addr', `load_addr', -`load_end_addr', `bss_end_addr' and `entry_addr' are defined in *Note -Header address fields::, and the fields `mode_type', `width', `height' -and `depth' are defind in *Note Header graphics fields::. - - -File: multiboot.info, Node: Header magic fields, Next: Header address fields, Prev: Header layout, Up: OS image format - -The magic fields of Multiboot header ------------------------------------- - -`magic' - The field `magic' is the magic number identifying the header, - which must be the hexadecimal value `0x1BADB002'. - -`flags' - The field `flags' specifies features that the OS image requests or - requires of an boot loader. Bits 0-15 indicate requirements; if the - boot loader sees any of these bits set but doesn't understand the - flag or can't fulfill the requirements it indicates for some - reason, it must notify the user and fail to load the OS image. - Bits 16-31 indicate optional features; if any bits in this range - are set but the boot loader doesn't understand them, it may simply - ignore them and proceed as usual. Naturally, all as-yet-undefined - bits in the `flags' word must be set to zero in OS images. This - way, the `flags' fields serves for version control as well as - simple feature selection. - - If bit 0 in the `flags' word is set, then all boot modules loaded - along with the operating system must be aligned on page (4KB) - boundaries. Some operating systems expect to be able to map the - pages containing boot modules directly into a paged address space - during startup, and thus need the boot modules to be page-aligned. - - If bit 1 in the `flags' word is set, then information on available - memory via at least the `mem_*' fields of the Multiboot information - structure (*note Boot information format::) must be included. If - the boot loader is capable of passing a memory map (the `mmap_*' - fields) and one exists, then it may be included as well. - - If bit 2 in the `flags' word is set, information about the video - mode table (*note Boot information format::) must be available to - the kernel. - - If bit 16 in the `flags' word is set, then the fields at offsets - 8-24 in the Multiboot header are valid, and the boot loader should - use them instead of the fields in the actual executable header to - calculate where to load the OS image. This information does not - need to be provided if the kernel image is in ELF format, but it - _must_ be provided if the images is in a.out format or in some - other format. Compliant boot loaders must be able to load images - that either are in ELF format or contain the load address - information embedded in the Multiboot header; they may also - directly support other executable formats, such as particular - a.out variants, but are not required to. - -`checksum' - The field `checksum' is a 32-bit unsigned value which, when added - to the other magic fields (i.e. `magic' and `flags'), must have a - 32-bit unsigned sum of zero. - - -File: multiboot.info, Node: Header address fields, Next: Header graphics fields, Prev: Header magic fields, Up: OS image format - -The address fields of Multiboot header --------------------------------------- - - All of the address fields enabled by flag bit 16 are physical -addresses. The meaning of each is as follows: - -`header_addr' - Contains the address corresponding to the beginning of the - Multiboot header -- the physical memory location at which the - magic value is supposed to be loaded. This field serves to - "synchronize" the mapping between OS image offsets and physical - memory addresses. - -`load_addr' - Contains the physical address of the beginning of the text - segment. The offset in the OS image file at which to start loading - is defined by the offset at which the header was found, minus - (header_addr - load_addr). load_addr must be less than or equal to - header_addr. - -`load_end_addr' - Contains the physical address of the end of the data segment. - (load_end_addr - load_addr) specifies how much data to load. This - implies that the text and data segments must be consecutive in the - OS image; this is true for existing a.out executable formats. If - this field is zero, the boot loader assumes that the text and data - segments occupy the whole OS image file. - -`bss_end_addr' - Contains the physical address of the end of the bss segment. The - boot loader initializes this area to zero, and reserves the memory - it occupies to avoid placing boot modules and other data relevant - to the operating system in that area. If this field is zero, the - boot loader assumes that no bss segment is present. - -`entry_addr' - The physical address to which the boot loader should jump in order - to start running the operating system. - - -File: multiboot.info, Node: Header graphics fields, Prev: Header address fields, Up: OS image format - -The graphics fields of Multiboot header ---------------------------------------- - - All of the graphics fields are enabled by flag bit 2. They specify -the preferred graphics mode. Note that that is only a _recommended_ -mode by the OS image. If the mode exists, the boot loader should set -it, when the user doesn't specify a mode explicitly. Otherwise, the -boot loader should fall back to a similar mode, if available. - - The meaning of each is as follows: - -`mode_type' - Contains `0' for linear graphics mode or `1' for EGA-standard text - mode. Everything else is reserved for future expansion. Note that - the boot loader may set a text mode, even if this field contains - `0'. - -`width' - Contains the number of the columns. This is specified in pixels in - a graphics mode, and in characters in a text mode. The value zero - indicates that the OS image has no preference. - -`height' - Contains the number of the lines. This is specified in pixels in a - graphics mode, and in characters in a text mode. The value zero - indicates that the OS image has no preference. - -`depth' - Contains the number of bits per pixel in a graphics mode, and zero - in a text mode. The value zero indicates that the OS image has no - preference. - - -File: multiboot.info, Node: Machine state, Next: Boot information format, Prev: OS image format, Up: Specification - -Machine state -============= - - When the boot loader invokes the 32-bit operating system, the machine -must have the following state: - -`EAX' - Must contain the magic value `0x2BADB002'; the presence of this - value indicates to the operating system that it was loaded by a - Multiboot-compliant boot loader (e.g. as opposed to another type of - boot loader that the operating system can also be loaded from). - -`EBX' - Must contain the 32-bit physical address of the Multiboot - information structure provided by the boot loader (*note Boot - information format::). - -`CS' - Must be a 32-bit read/execute code segment with an offset of `0' - and a limit of `0xFFFFFFFF'. The exact value is undefined. - -`DS' -`ES' -`FS' -`GS' -`SS' - Must be a 32-bit read/write data segment with an offset of `0' and - a limit of `0xFFFFFFFF'. The exact values are all undefined. - -`A20 gate' - Must be enabled. - -`CR0' - Bit 31 (PG) must be cleared. Bit 0 (PE) must be set. Other bits are - all undefined. - -`EFLAGS' - Bit 17 (VM) must be cleared. Bit 9 (IF) must be cleared. Other bits - are all undefined. - - All other processor registers and flag bits are undefined. This -includes, in particular: - -`ESP' - The OS image must create its own stack as soon as it needs one. - -`GDTR' - Even though the segment registers are set up as described above, - the `GDTR' may be invalid, so the OS image must not load any - segment registers (even just reloading the same values!) until it - sets up its own `GDT'. - -`IDTR' - The OS image must leave interrupts disabled until it sets up its - own `IDT'. - - However, other machine state should be left by the boot loader in -"normal working order", i.e. as initialized by the BIOS (or DOS, if -that's what the boot loader runs from). In other words, the operating -system should be able to make BIOS calls and such after being loaded, -as long as it does not overwrite the BIOS data structures before doing -so. Also, the boot loader must leave the PIC programmed with the normal -BIOS/DOS values, even if it changed them during the switch to 32-bit -mode. - - -File: multiboot.info, Node: Boot information format, Prev: Machine state, Up: Specification - -Boot information format -======================= - - FIXME: Split this chapter like the chapter "OS image format". - - Upon entry to the operating system, the `EBX' register contains the -physical address of a "Multiboot information" data structure, through -which the boot loader communicates vital information to the operating -system. The operating system can use or ignore any parts of the -structure as it chooses; all information passed by the boot loader is -advisory only. - - The Multiboot information structure and its related substructures -may be placed anywhere in memory by the boot loader (with the exception -of the memory reserved for the kernel and boot modules, of course). It -is the operating system's responsibility to avoid overwriting this -memory until it is done using it. - - The format of the Multiboot information structure (as defined so far) -follows: - - +-------------------+ - 0 | flags | (required) - +-------------------+ - 4 | mem_lower | (present if flags[0] is set) - 8 | mem_upper | (present if flags[0] is set) - +-------------------+ - 12 | boot_device | (present if flags[1] is set) - +-------------------+ - 16 | cmdline | (present if flags[2] is set) - +-------------------+ - 20 | mods_count | (present if flags[3] is set) - 24 | mods_addr | (present if flags[3] is set) - +-------------------+ - 28 - 40 | syms | (present if flags[4] or - | | flags[5] is set) - +-------------------+ - 44 | mmap_length | (present if flags[6] is set) - 48 | mmap_addr | (present if flags[6] is set) - +-------------------+ - 52 | drives_length | (present if flags[7] is set) - 56 | drives_addr | (present if flags[7] is set) - +-------------------+ - 60 | config_table | (present if flags[8] is set) - +-------------------+ - 64 | boot_loader_name | (present if flags[9] is set) - +-------------------+ - 68 | apm_table | (present if flags[10] is set) - +-------------------+ - 72 | vbe_control_info | (present if flags[11] is set) - 76 | vbe_mode_info | - 80 | vbe_mode | - 82 | vbe_interface_seg | - 84 | vbe_interface_off | - 86 | vbe_interface_len | - +-------------------+ - - The first longword indicates the presence and validity of other -fields in the Multiboot information structure. All as-yet-undefined -bits must be set to zero by the boot loader. Any set bits that the -operating system does not understand should be ignored. Thus, the -`flags' field also functions as a version indicator, allowing the -Multiboot information structure to be expanded in the future without -breaking anything. - - If bit 0 in the `flags' word is set, then the `mem_*' fields are -valid. `mem_lower' and `mem_upper' indicate the amount of lower and -upper memory, respectively, in kilobytes. Lower memory starts at -address 0, and upper memory starts at address 1 megabyte. The maximum -possible value for lower memory is 640 kilobytes. The value returned for -upper memory is maximally the address of the first upper memory hole -minus 1 megabyte. It is not guaranteed to be this value. - - If bit 1 in the `flags' word is set, then the `boot_device' field is -valid, and indicates which BIOS disk device the boot loader loaded the -OS image from. If the OS image was not loaded from a BIOS disk, then -this field must not be present (bit 3 must be clear). The operating -system may use this field as a hint for determining its own "root" -device, but is not required to. The `boot_device' field is laid out in -four one-byte subfields as follows: - - +-------+-------+-------+-------+ - | drive | part1 | part2 | part3 | - +-------+-------+-------+-------+ - - The first byte contains the BIOS drive number as understood by the -BIOS INT 0x13 low-level disk interface: e.g. 0x00 for the first floppy -disk or 0x80 for the first hard disk. - - The three remaining bytes specify the boot partition. `part1' -specifies the "top-level" partition number, `part2' specifies a -"sub-partition" in the top-level partition, etc. Partition numbers -always start from zero. Unused partition bytes must be set to 0xFF. For -example, if the disk is partitioned using a simple one-level DOS -partitioning scheme, then `part1' contains the DOS partition number, -and `part2' and `part3' are both 0xFF. As another example, if a disk is -partitioned first into DOS partitions, and then one of those DOS -partitions is subdivided into several BSD partitions using BSD's -"disklabel" strategy, then `part1' contains the DOS partition number, -`part2' contains the BSD sub-partition within that DOS partition, and -`part3' is 0xFF. - - DOS extended partitions are indicated as partition numbers starting -from 4 and increasing, rather than as nested sub-partitions, even -though the underlying disk layout of extended partitions is -hierarchical in nature. For example, if the boot loader boots from the -second extended partition on a disk partitioned in conventional DOS -style, then `part1' will be 5, and `part2' and `part3' will both be -0xFF. - - If bit 2 of the `flags' longword is set, the `cmdline' field is -valid, and contains the physical address of the command line to be -passed to the kernel. The command line is a normal C-style -zero-terminated string. - - If bit 3 of the `flags' is set, then the `mods' fields indicate to -the kernel what boot modules were loaded along with the kernel image, -and where they can be found. `mods_count' contains the number of -modules loaded; `mods_addr' contains the physical address of the first -module structure. `mods_count' may be zero, indicating no boot modules -were loaded, even if bit 1 of `flags' is set. Each module structure is -formatted as follows: - - +-------------------+ - 0 | mod_start | - 4 | mod_end | - +-------------------+ - 8 | string | - +-------------------+ - 12 | reserved (0) | - +-------------------+ - - The first two fields contain the start and end addresses of the boot -module itself. The `string' field provides an arbitrary string to be -associated with that particular boot module; it is a zero-terminated -ASCII string, just like the kernel command line. The `string' field may -be 0 if there is no string associated with the module. Typically the -string might be a command line (e.g. if the operating system treats boot -modules as executable programs), or a pathname (e.g. if the operating -system treats boot modules as files in a file system), but its exact use -is specific to the operating system. The `reserved' field must be set -to 0 by the boot loader and ignored by the operating system. - - *Caution:* Bits 4 & 5 are mutually exclusive. - - If bit 4 in the `flags' word is set, then the following fields in -the Multiboot information structure starting at byte 28 are valid: - - +-------------------+ - 28 | tabsize | - 32 | strsize | - 36 | addr | - 40 | reserved (0) | - +-------------------+ - - These indicate where the symbol table from an a.out kernel image can -be found. `addr' is the physical address of the size (4-byte unsigned -long) of an array of a.out format "nlist" structures, followed -immediately by the array itself, then the size (4-byte unsigned long) of -a set of zero-terminated ASCII strings (plus sizeof(unsigned long) in -this case), and finally the set of strings itself. `tabsize' is equal -to its size parameter (found at the beginning of the symbol section), -and `strsize' is equal to its size parameter (found at the beginning of -the string section) of the following string table to which the symbol -table refers. Note that `tabsize' may be 0, indicating no symbols, even -if bit 4 in the `flags' word is set. - - If bit 5 in the `flags' word is set, then the following fields in -the Multiboot information structure starting at byte 28 are valid: - - +-------------------+ - 28 | num | - 32 | size | - 36 | addr | - 40 | shndx | - +-------------------+ - - These indicate where the section header table from an ELF kernel is, -the size of each entry, number of entries, and the string table used as -the index of names. They correspond to the `shdr_*' entries -(`shdr_num', etc.) in the Executable and Linkable Format (ELF) -specification in the program header. All sections are loaded, and the -physical address fields of the ELF section header then refer to where -the sections are in memory (refer to the i386 ELF documentation for -details as to how to read the section header(s)). Note that `shdr_num' -may be 0, indicating no symbols, even if bit 5 in the `flags' word is -set. - - If bit 6 in the `flags' word is set, then the `mmap_*' fields are -valid, and indicate the address and length of a buffer containing a -memory map of the machine provided by the BIOS. `mmap_addr' is the -address, and `mmap_length' is the total size of the buffer. The buffer -consists of one or more of the following size/structure pairs (`size' -is really used for skipping to the next pair): - - +-------------------+ - -4 | size | - +-------------------+ - 0 | base_addr_low | - 4 | base_addr_high | - 8 | length_low | - 12 | length_high | - 16 | type | - +-------------------+ - - where `size' is the size of the associated structure in bytes, which -can be greater than the minimum of 20 bytes. `base_addr_low' is the -lower 32 bits of the starting address, and `base_addr_high' is the -upper 32 bits, for a total of a 64-bit starting address. `length_low' -is the lower 32 bits of the size of the memory region in bytes, and -`length_high' is the upper 32 bits, for a total of a 64-bit length. -`type' is the variety of address range represented, where a value of 1 -indicates available RAM, and all other values currently indicated a -reserved area. - - The map provided is guaranteed to list all standard RAM that should -be available for normal use. - - If bit 7 in the `flags' is set, then the `drives_*' fields are -valid, and indicate the address of the physical address of the first -drive structure and the size of drive structures. `drives_addr' is the -address, and `drives_length' is the total size of drive structures. -Note that `drives_length' may be zero. Each drive structure is -formatted as follows: - - +-------------------+ - 0 | size | - +-------------------+ - 4 | drive_number | - +-------------------+ - 5 | drive_mode | - +-------------------+ - 6 | drive_cylinders | - 8 | drive_heads | - 9 | drive_sectors | - +-------------------+ - 10 - xx | drive_ports | - +-------------------+ - - The `size' field specifies the size of this structure. The size -varies, depending on the number of ports. Note that the size may not be -equal to (10 + 2 * the number of ports), because of an alignment. - - The `drive_number' field contains the BIOS drive number. The -`drive_mode' field represents the access mode used by the boot loader. -Currently, the following modes are defined: - -`0' - CHS mode (traditional cylinder/head/sector addressing mode). - -`1' - LBA mode (Logical Block Addressing mode). - - The three fields, `drive_cylinders', `drive_heads' and -`drive_sectors', indicate the geometry of the drive detected by the -BIOS. `drive_cylinders' contains the number of the cylinders. -`drive_heads' contains the number of the heads. `drive_sectors' -contains the number of the sectors per track. - - The `drive_ports' field contains the array of the I/O ports used for -the drive in the BIOS code. The array consists of zero or more unsigned -two-bytes integers, and is terminated with zero. Note that the array -may contain any number of I/O ports that are not related to the drive -actually (such as DMA controller's ports). - - If bit 8 in the `flags' is set, then the `config_table' field is -valid, and indicates the address of the ROM configuration table -returned by the "GET CONFIGURATION" BIOS call. If the BIOS call fails, -then the size of the table must be _zero_. - - If bit 9 in the `flags' is set, the `boot_loader_name' field is -valid, and contains the physical address of the name of a boot loader -booting the kernel. The name is a normal C-style zero-terminated string. - - If bit 10 in the `flags' is set, the `apm_table' field is valid, and -contains the physical address of an APM table defined as below: - - +----------------------+ - 0 | version | - 2 | cseg | - 4 | offset | - 8 | cseg_16 | - 10 | dseg | - 12 | flags | - 14 | cseg_len | - 16 | cseg_16_len | - 18 | dseg_len | - +----------------------+ - - The fields `version', `cseg', `offset', `cseg_16', `dseg', `flags', -`cseg_len', `cseg_16_len', `dseg_len' indicate the version number, the -protected mode 32-bit code segment, the offset of the entry point, the -protected mode 16-bit code segment, the protected mode 16-bit data -segment, the flags, the length of the protected mode 32-bit code -segment, the length of the protected mode 16-bit code segment, and the -length of the protected mode 16-bit data segment, respectively. Only -the field `offset' is 4 bytes, and the others are 2 bytes. See Advanced -Power Management (APM) BIOS Interface Specification -(http://www.microsoft.com/hwdev/busbios/amp_12.htm), for more -information. - - If bit 11 in the `flags' is set, the graphics table is available. -This must only be done if the kernel has indicated in the `Multiboot -Header' that it accepts a graphics mode. - - The fields `vbe_control_info' and `vbe_mode_info' contain the -physical addresses of VBE control information returned by the VBE -Function 00h and VBE mode information returned by the VBE Function 01h, -respectively. - - The field `vbe_mode' indicates current video mode in the format -specified in VBE 3.0. - - The rest fields `vbe_interface_seg', `vbe_interface_off', and -`vbe_interface_len' contain the table of a protected mode interface -defined in VBE 2.0+. If this information is not available, those fields -contain zero. Note that VBE 3.0 defines another protected mode -interface which is incompatible with the old one. If you want to use -the new protected mode interface, you will have to find the table -yourself. - - The fields for the graphics table are designed for VBE, but -Multiboot boot loaders may simulate VBE on non-VBE modes, as if they -were VBE modes. - - -File: multiboot.info, Node: Examples, Next: History, Prev: Specification, Up: Top - -Examples -******** - - *Caution:* The following items are not part of the specification -document, but are included for prospective operating system and boot -loader writers. - -* Menu: - -* Notes on PC:: -* BIOS device mapping techniques:: -* Example OS code:: -* Example boot loader code:: - - -File: multiboot.info, Node: Notes on PC, Next: BIOS device mapping techniques, Up: Examples - -Notes on PC -=========== - - In reference to bit 0 of the `flags' parameter in the Multiboot -information structure, if the bootloader in question uses older BIOS -interfaces, or the newest ones are not available (see description about -bit 6), then a maximum of either 15 or 63 megabytes of memory may be -reported. It is _highly_ recommended that boot loaders perform a -thorough memory probe. - - In reference to bit 1 of the `flags' parameter in the Multiboot -information structure, it is recognized that determination of which -BIOS drive maps to which device driver in an operating system is -non-trivial, at best. Many kludges have been made to various operating -systems instead of solving this problem, most of them breaking under -many conditions. To encourage the use of general-purpose solutions to -this problem, there are 2 BIOS device mapping techniques (*note BIOS -device mapping techniques::). - - In reference to bit 6 of the `flags' parameter in the Multiboot -information structure, it is important to note that the data structure -used there (starting with `BaseAddrLow') is the data returned by the -INT 15h, AX=E820h -- Query System Address Map call. See *Note Query -System Address Map: (grub.info)Query System Address Map, for more -information. The interface here is meant to allow a boot loader to work -unmodified with any reasonable extensions of the BIOS interface, -passing along any extra data to be interpreted by the operating system -as desired. - - -File: multiboot.info, Node: BIOS device mapping techniques, Next: Example OS code, Prev: Notes on PC, Up: Examples - -BIOS device mapping techniques -============================== - - Both of these techniques should be usable from any PC operating -system, and neither require any special support in the drivers -themselves. This section will be flushed out into detailed -explanations, particularly for the I/O restriction technique. - - The general rule is that the data comparison technique is the quick -and dirty solution. It works most of the time, but doesn't cover all the -bases, and is relatively simple. - - The I/O restriction technique is much more complex, but it has -potential to solve the problem under all conditions, plus allow access -of the remaining BIOS devices when not all of them have operating system -drivers. - -* Menu: - -* Data comparison technique:: -* I/O restriction technique:: - - -File: multiboot.info, Node: Data comparison technique, Next: I/O restriction technique, Up: BIOS device mapping techniques - -Data comparison technique -------------------------- - - Before activating _any_ of the device drivers, gather enough data -from similar sectors on each of the disks such that each one can be -uniquely identified. - - After activating the device drivers, compare data from the drives -using the operating system drivers. This should hopefully be sufficient -to provide such a mapping. - - Problems: - - 1. The data on some BIOS devices might be identical (so the part - reading the drives from the BIOS should have some mechanism to give - up). - - 2. There might be extra drives not accessible from the BIOS which are - identical to some drive used by the BIOS (so it should be capable - of giving up there as well). - - -File: multiboot.info, Node: I/O restriction technique, Prev: Data comparison technique, Up: BIOS device mapping techniques - -I/O restriction technique -------------------------- - - This first step may be unnecessary, but first create copy-on-write -mappings for the device drivers writing into PC RAM. Keep the original -copies for the "clean BIOS virtual machine" to be created later. - - For each device driver brought online, determine which BIOS devices -become inaccessible by: - - 1. Create a "clean BIOS virtual machine". - - 2. Set the I/O permission map for the I/O area claimed by the device - driver to no permissions (neither read nor write). - - 3. Access each device. - - 4. Record which devices succeed, and those which try to access the - "restricted" I/O areas (hopefully, this will be an "xor" - situation). - - For each device driver, given how many of the BIOS devices were -subsumed by it (there should be no gaps in this list), it should be easy -to determine which devices on the controller these are. - - In general, you have at most 2 disks from each controller given BIOS -numbers, but they pretty much always count from the lowest logically -numbered devices on the controller. - - -File: multiboot.info, Node: Example OS code, Next: Example boot loader code, Prev: BIOS device mapping techniques, Up: Examples - -Example OS code -=============== - - In this distribution, the example Multiboot kernel `kernel' is -included. The kernel just prints out the Multiboot information structure -on the screen, so you can make use of the kernel to test a -Multiboot-compliant boot loader and for reference to how to implement a -Multiboot kernel. The source files can be found under the directory -`docs' in the GRUB distribution. - - The kernel `kernel' consists of only three files: `boot.S', -`kernel.c' and `multiboot.h'. The assembly source `boot.S' is written -in GAS (*note GNU assembler: (as.info)Top.), and contains the Multiboot -information structure to comply with the specification. When a -Multiboot-compliant boot loader loads and execute it, it initialize the -stack pointer and `EFLAGS', and then call the function `cmain' defined -in `kernel.c'. If `cmain' returns to the callee, then it shows a -message to inform the user of the halt state and stops forever until -you push the reset key. The file `kernel.c' contains the function -`cmain', which checks if the magic number passed by the boot loader is -valid and so on, and some functions to print messages on the screen. -The file `multiboot.h' defines some macros, such as the magic number -for the Multiboot header, the Multiboot header structure and the -Multiboot information structure. - -* Menu: - -* multiboot.h:: -* boot.S:: -* kernel.c:: -* Other Multiboot kernels:: - - -File: multiboot.info, Node: multiboot.h, Next: boot.S, Up: Example OS code - -multiboot.h ------------ - - This is the source code in the file `multiboot.h': - - /* multiboot.h - the header for Multiboot */ - /* Copyright (C) 1999, 2001 Free Software Foundation, 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 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. */ - - /* Macros. */ - - /* The magic number for the Multiboot header. */ - #define MULTIBOOT_HEADER_MAGIC 0x1BADB002 - - /* The flags for the Multiboot header. */ - #ifdef __ELF__ - # define MULTIBOOT_HEADER_FLAGS 0x00000003 - #else - # define MULTIBOOT_HEADER_FLAGS 0x00010003 - #endif - - /* The magic number passed by a Multiboot-compliant boot loader. */ - #define MULTIBOOT_BOOTLOADER_MAGIC 0x2BADB002 - - /* The size of our stack (16KB). */ - #define STACK_SIZE 0x4000 - - /* C symbol format. HAVE_ASM_USCORE is defined by configure. */ - #ifdef HAVE_ASM_USCORE - # define EXT_C(sym) _ ## sym - #else - # define EXT_C(sym) sym - #endif - - #ifndef ASM - /* Do not include here in boot.S. */ - - /* Types. */ - - /* The Multiboot header. */ - typedef struct multiboot_header - { - unsigned long magic; - unsigned long flags; - unsigned long checksum; - unsigned long header_addr; - unsigned long load_addr; - unsigned long load_end_addr; - unsigned long bss_end_addr; - unsigned long entry_addr; - } multiboot_header_t; - - /* The symbol table for a.out. */ - typedef struct aout_symbol_table - { - unsigned long tabsize; - unsigned long strsize; - unsigned long addr; - unsigned long reserved; - } aout_symbol_table_t; - - /* The section header table for ELF. */ - typedef struct elf_section_header_table - { - unsigned long num; - unsigned long size; - unsigned long addr; - unsigned long shndx; - } elf_section_header_table_t; - - /* The Multiboot information. */ - typedef struct multiboot_info - { - unsigned long flags; - unsigned long mem_lower; - unsigned long mem_upper; - unsigned long boot_device; - unsigned long cmdline; - unsigned long mods_count; - unsigned long mods_addr; - union - { - aout_symbol_table_t aout_sym; - elf_section_header_table_t elf_sec; - } u; - unsigned long mmap_length; - unsigned long mmap_addr; - } multiboot_info_t; - - /* The module structure. */ - typedef struct module - { - unsigned long mod_start; - unsigned long mod_end; - unsigned long string; - unsigned long reserved; - } module_t; - - /* The memory map. Be careful that the offset 0 is base_addr_low - but no size. */ - typedef struct memory_map - { - unsigned long size; - unsigned long base_addr_low; - unsigned long base_addr_high; - unsigned long length_low; - unsigned long length_high; - unsigned long type; - } memory_map_t; - - #endif /* ! ASM */ - - -File: multiboot.info, Node: boot.S, Next: kernel.c, Prev: multiboot.h, Up: Example OS code - -boot.S ------- - - In the file `boot.S': - - /* boot.S - bootstrap the kernel */ - /* Copyright (C) 1999, 2001 Free Software Foundation, 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 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. */ - - #define ASM 1 - #include - - .text - - .globl start, _start - start: - _start: - jmp multiboot_entry - - /* Align 32 bits boundary. */ - .align 4 - - /* Multiboot header. */ - multiboot_header: - /* magic */ - .long MULTIBOOT_HEADER_MAGIC - /* flags */ - .long MULTIBOOT_HEADER_FLAGS - /* checksum */ - .long -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS) - #ifndef __ELF__ - /* header_addr */ - .long multiboot_header - /* load_addr */ - .long _start - /* load_end_addr */ - .long _edata - /* bss_end_addr */ - .long _end - /* entry_addr */ - .long multiboot_entry - #endif /* ! __ELF__ */ - - multiboot_entry: - /* Initialize the stack pointer. */ - movl $(stack + STACK_SIZE), %esp - - /* Reset EFLAGS. */ - pushl $0 - popf - - /* Push the pointer to the Multiboot information structure. */ - pushl %ebx - /* Push the magic value. */ - pushl %eax - - /* Now enter the C main function... */ - call EXT_C(cmain) - - /* Halt. */ - pushl $halt_message - call EXT_C(printf) - - loop: hlt - jmp loop - - halt_message: - .asciz "Halted." - - /* Our stack area. */ - .comm stack, STACK_SIZE - - -File: multiboot.info, Node: kernel.c, Next: Other Multiboot kernels, Prev: boot.S, Up: Example OS code - -kernel.c --------- - - And, in the file `kernel.c': - - /* kernel.c - the C part of the kernel */ - /* Copyright (C) 1999 Free Software Foundation, 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 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 - - /* Macros. */ - - /* Check if the bit BIT in FLAGS is set. */ - #define CHECK_FLAG(flags,bit) ((flags) & (1 << (bit))) - - /* Some screen stuff. */ - /* The number of columns. */ - #define COLUMNS 80 - /* The number of lines. */ - #define LINES 24 - /* The attribute of an character. */ - #define ATTRIBUTE 7 - /* The video memory address. */ - #define VIDEO 0xB8000 - - /* Variables. */ - /* Save the X position. */ - static int xpos; - /* Save the Y position. */ - static int ypos; - /* Point to the video memory. */ - static volatile unsigned char *video; - - /* Forward declarations. */ - void cmain (unsigned long magic, unsigned long addr); - static void cls (void); - static void itoa (char *buf, int base, int d); - static void putchar (int c); - void printf (const char *format, ...); - - /* Check if MAGIC is valid and print the Multiboot information structure - pointed by ADDR. */ - void - cmain (unsigned long magic, unsigned long addr) - { - multiboot_info_t *mbi; - - /* Clear the screen. */ - cls (); - - /* Am I booted by a Multiboot-compliant boot loader? */ - if (magic != MULTIBOOT_BOOTLOADER_MAGIC) - { - printf ("Invalid magic number: 0x%x\n", (unsigned) magic); - return; - } - - /* Set MBI to the address of the Multiboot information structure. */ - mbi = (multiboot_info_t *) addr; - - /* Print out the flags. */ - printf ("flags = 0x%x\n", (unsigned) mbi->flags); - - /* Are mem_* valid? */ - if (CHECK_FLAG (mbi->flags, 0)) - printf ("mem_lower = %uKB, mem_upper = %uKB\n", - (unsigned) mbi->mem_lower, (unsigned) mbi->mem_upper); - - /* Is boot_device valid? */ - if (CHECK_FLAG (mbi->flags, 1)) - printf ("boot_device = 0x%x\n", (unsigned) mbi->boot_device); - - /* Is the command line passed? */ - if (CHECK_FLAG (mbi->flags, 2)) - printf ("cmdline = %s\n", (char *) mbi->cmdline); - - /* Are mods_* valid? */ - if (CHECK_FLAG (mbi->flags, 3)) - { - module_t *mod; - int i; - - printf ("mods_count = %d, mods_addr = 0x%x\n", - (int) mbi->mods_count, (int) mbi->mods_addr); - for (i = 0, mod = (module_t *) mbi->mods_addr; - i < mbi->mods_count; - i++, mod++) - printf (" mod_start = 0x%x, mod_end = 0x%x, string = %s\n", - (unsigned) mod->mod_start, - (unsigned) mod->mod_end, - (char *) mod->string); - } - - /* Bits 4 and 5 are mutually exclusive! */ - if (CHECK_FLAG (mbi->flags, 4) && CHECK_FLAG (mbi->flags, 5)) - { - printf ("Both bits 4 and 5 are set.\n"); - return; - } - - /* Is the symbol table of a.out valid? */ - if (CHECK_FLAG (mbi->flags, 4)) - { - aout_symbol_table_t *aout_sym = &(mbi->u.aout_sym); - - printf ("aout_symbol_table: tabsize = 0x%0x, " - "strsize = 0x%x, addr = 0x%x\n", - (unsigned) aout_sym->tabsize, - (unsigned) aout_sym->strsize, - (unsigned) aout_sym->addr); - } - - /* Is the section header table of ELF valid? */ - if (CHECK_FLAG (mbi->flags, 5)) - { - elf_section_header_table_t *elf_sec = &(mbi->u.elf_sec); - - printf ("elf_sec: num = %u, size = 0x%x," - " addr = 0x%x, shndx = 0x%x\n", - (unsigned) elf_sec->num, (unsigned) elf_sec->size, - (unsigned) elf_sec->addr, (unsigned) elf_sec->shndx); - } - - /* Are mmap_* valid? */ - if (CHECK_FLAG (mbi->flags, 6)) - { - memory_map_t *mmap; - - printf ("mmap_addr = 0x%x, mmap_length = 0x%x\n", - (unsigned) mbi->mmap_addr, (unsigned) mbi->mmap_length); - for (mmap = (memory_map_t *) mbi->mmap_addr; - (unsigned long) mmap < mbi->mmap_addr + mbi->mmap_length; - mmap = (memory_map_t *) ((unsigned long) mmap - + mmap->size + sizeof (mmap->size))) - printf (" size = 0x%x, base_addr = 0x%x%x," - " length = 0x%x%x, type = 0x%x\n", - (unsigned) mmap->size, - (unsigned) mmap->base_addr_high, - (unsigned) mmap->base_addr_low, - (unsigned) mmap->length_high, - (unsigned) mmap->length_low, - (unsigned) mmap->type); - } - } - - /* Clear the screen and initialize VIDEO, XPOS and YPOS. */ - static void - cls (void) - { - int i; - - video = (unsigned char *) VIDEO; - - for (i = 0; i < COLUMNS * LINES * 2; i++) - *(video + i) = 0; - - xpos = 0; - ypos = 0; - } - - /* Convert the integer D to a string and save the string in BUF. If - BASE is equal to 'd', interpret that D is decimal, and if BASE is - equal to 'x', interpret that D is hexadecimal. */ - static void - itoa (char *buf, int base, int d) - { - char *p = buf; - char *p1, *p2; - unsigned long ud = d; - int divisor = 10; - - /* If %d is specified and D is minus, put `-' in the head. */ - if (base == 'd' && d < 0) - { - *p++ = '-'; - buf++; - ud = -d; - } - else if (base == 'x') - divisor = 16; - - /* Divide UD by DIVISOR until UD == 0. */ - do - { - int remainder = ud % divisor; - - *p++ = (remainder < 10) ? remainder + '0' : remainder + 'a' - 10; - } - while (ud /= divisor); - - /* Terminate BUF. */ - *p = 0; - - /* Reverse BUF. */ - p1 = buf; - p2 = p - 1; - while (p1 < p2) - { - char tmp = *p1; - *p1 = *p2; - *p2 = tmp; - p1++; - p2--; - } - } - - /* Put the character C on the screen. */ - static void - putchar (int c) - { - if (c == '\n' || c == '\r') - { - newline: - xpos = 0; - ypos++; - if (ypos >= LINES) - ypos = 0; - return; - } - - *(video + (xpos + ypos * COLUMNS) * 2) = c & 0xFF; - *(video + (xpos + ypos * COLUMNS) * 2 + 1) = ATTRIBUTE; - - xpos++; - if (xpos >= COLUMNS) - goto newline; - } - - /* Format a string and print it on the screen, just like the libc - function printf. */ - void - printf (const char *format, ...) - { - char **arg = (char **) &format; - int c; - char buf[20]; - - arg++; - - while ((c = *format++) != 0) - { - if (c != '%') - putchar (c); - else - { - char *p; - - c = *format++; - switch (c) - { - case 'd': - case 'u': - case 'x': - itoa (buf, c, *((int *) arg++)); - p = buf; - goto string; - break; - - case 's': - p = *arg++; - if (! p) - p = "(null)"; - - string: - while (*p) - putchar (*p++); - break; - - default: - putchar (*((int *) arg++)); - break; - } - } - } - } - - -File: multiboot.info, Node: Other Multiboot kernels, Prev: kernel.c, Up: Example OS code - -Other Multiboot kernels ------------------------ - - Other useful information should be available in Multiboot kernels, -such as GNU Mach and Fiasco . And, -it is worth mentioning the OSKit -, which provides a library -supporting the specification. - - -File: multiboot.info, Node: Example boot loader code, Prev: Example OS code, Up: Examples - -Example boot loader code -======================== - - The GNU GRUB (*note GRUB: (grub.info)Top.) project is a full -Multiboot-compliant boot loader, supporting all required and optional -features present in this specification. A public release has not been -made, but the test release is available from: - - - - See the webpage , for -more information. - - -File: multiboot.info, Node: History, Next: Index, Prev: Examples, Up: Top - -The change log of this specification -************************************ - -0.7 - * "Multiboot Standard" is renamed to "Multiboot Specification". - - * Graphics fields are added to Multiboot header. - - * BIOS drive information, BIOS configuration table, the name of - a boot loader, APM information, and graphics information are - added to Multiboot information. - - * Rewritten in Texinfo format. - - * Rewritten, using more strict words. - - * The maintainer changes to the GNU GRUB maintainer team - , from Bryan Ford and Erich Stefan Boleyn. - -0.6 - * A few wording changes. - - * Header checksum. - - * Clasification of machine state passed to an operating system. - -0.5 - * Name change. - -0.4 - * Major changes plus HTMLification. - - -File: multiboot.info, Node: Index, Prev: History, Up: Top - -Index -***** - -* Menu: - - -Tag Table: -Node: Top968 -Node: Overview1307 -Node: Motivation1774 -Node: Architecture3167 -Node: Operating systems3695 -Node: Boot sources4484 -Node: Boot-time configuration5449 -Node: Convenience to operating systems6052 -Node: Boot modules8278 -Node: Terminology9422 -Node: Specification11797 -Node: OS image format12359 -Node: Header layout13412 -Node: Header magic fields14571 -Node: Header address fields17420 -Node: Header graphics fields19258 -Node: Machine state20635 -Node: Boot information format22890 -Node: Examples38256 -Node: Notes on PC38628 -Node: BIOS device mapping techniques40189 -Node: Data comparison technique41094 -Node: I/O restriction technique41947 -Node: Example OS code43155 -Node: multiboot.h44692 -Node: boot.S48597 -Node: kernel.c51292 -Node: Other Multiboot kernels60240 -Node: Example boot loader code60662 -Node: History61183 -Node: Index62100 - -End Tag Table diff --git a/usr/src/grub/grub-0.95/docs/multiboot.texi b/usr/src/grub/grub-0.95/docs/multiboot.texi deleted file mode 100644 index eded05c4c2..0000000000 --- a/usr/src/grub/grub-0.95/docs/multiboot.texi +++ /dev/null @@ -1,1234 +0,0 @@ -\input texinfo @c -*-texinfo-*- -@c -*-texinfo-*- -@c %**start of header -@setfilename multiboot.info -@settitle Multiboot Specification -@c %**end of header - -@c Unify all our little indices for now. -@syncodeindex fn cp -@syncodeindex vr cp -@syncodeindex ky cp -@syncodeindex pg cp -@syncodeindex tp cp - -@footnotestyle separate -@paragraphindent 3 -@finalout - - -@dircategory Kernel -@direntry -* Multiboot Specification: (multiboot). Multiboot Specification. -@end direntry - -@ifinfo -Copyright @copyright{} 1995, 96 Bryan Ford -Copyright @copyright{} 1995, 96 Erich Stefan Boleyn -Copyright @copyright{} 1999, 2000, 2001, 2002 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. - -@ignore -Permission is granted to process this file through TeX and print the -results, provided the printed document carries a copying permission -notice identical to this one except for the removal of this paragraph -(this paragraph not being relevant to the printed manual). - -@end ignore - -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. -@end ifinfo - -@titlepage -@sp 10 -@title The Multiboot Specification -@author Yoshinori K. Okuji, Bryan Ford, Erich Stefan Boleyn, Kunihiro Ishiguro -@page - -@vskip 0pt plus 1filll -Copyright @copyright{} 1995, 96 Bryan Ford -Copyright @copyright{} 1995, 96 Erich Stefan Boleyn -Copyright @copyright{} 1999, 2000, 2001, 2002 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. -@end titlepage - -@finalout -@headings double - -@ifnottex -@node Top -@top Multiboot Specification - -This file documents Multiboot Specification, the proposal for the boot -sequence standard. This edition documents version 0.6.93. -@end ifnottex - -@menu -* Overview:: -* Terminology:: -* Specification:: -* Examples:: -* History:: -* Index:: -@end menu - - -@node Overview -@chapter Introduction to Multiboot Specification - -This chapter describes some rough information on the Multiboot -Specification. Note that this is not a part of the specification itself. - -@menu -* Motivation:: -* Architecture:: -* Operating systems:: -* Boot sources:: -* Boot-time configuration:: -* Convenience to operating systems:: -* Boot modules:: -@end menu - - -@node Motivation -@section The background of Multiboot Specification - -Every operating system ever created tends to have its own boot loader. -Installing a new operating system on a machine generally involves -installing a whole new set of boot mechanisms, each with completely -different install-time and boot-time user interfaces. Getting multiple -operating systems to coexist reliably on one machine through typical -@dfn{chaining} mechanisms can be a nightmare. There is little or no -choice of boot loaders for a particular operating system --- if the one -that comes with the operating system doesn't do exactly what you want, -or doesn't work on your machine, you're screwed. - -While we may not be able to fix this problem in existing commercial -operating systems, it shouldn't be too difficult for a few people in the -free operating system communities to put their heads together and solve -this problem for the popular free operating systems. That's what this -specification aims for. Basically, it specifies an interface between a -boot loader and a operating system, such that any complying boot loader -should be able to load any complying operating system. This -specification does @emph{not} specify how boot loaders should work --- -only how they must interface with the operating system being loaded. - - -@node Architecture -@section The target architecture - -This specification is primarily targeted at @sc{pc}, since they are the -most common and have the largest variety of operating systems and boot -loaders. However, to the extent that certain other architectures may -need a boot specification and do not have one already, a variation of -this specification, stripped of the x86-specific details, could be -adopted for them as well. - - -@node Operating systems -@section The target operating systems - -This specification is targeted toward free 32-bit operating systems -that can be fairly easily modified to support the specification without -going through lots of bureaucratic rigmarole. The particular free -operating systems that this specification is being primarily designed -for are Linux, FreeBSD, NetBSD, Mach, and VSTa. It is hoped that other -emerging free operating systems will adopt it from the start, and thus -immediately be able to take advantage of existing boot loaders. It would -be nice if commercial operating system vendors eventually adopted this -specification as well, but that's probably a pipe dream. - - -@node Boot sources -@section Boot sources - -It should be possible to write compliant boot loaders that load the OS -image from a variety of sources, including floppy disk, hard disk, and -across a network. - -Disk-based boot loaders may use a variety of techniques to find the -relevant OS image and boot module data on disk, such as by -interpretation of specific file systems (e.g. the BSD/Mach boot loader), -using precalculated @dfn{block lists} (e.g. LILO), loading from a -special @dfn{boot partition} (e.g. OS/2), or even loading from within -another operating system (e.g. the VSTa boot code, which loads from -DOS). Similarly, network-based boot loaders could use a variety of -network hardware and protocols. - -It is hoped that boot loaders will be created that support multiple -loading mechanisms, increasing their portability, robustness, and -user-friendliness. - - -@node Boot-time configuration -@section Configure an operating system at boot-time - -It is often necessary for one reason or another for the user to be able -to provide some configuration information to an operating system -dynamically at boot time. While this specification should not dictate -how this configuration information is obtained by the boot loader, it -should provide a standard means for the boot loader to pass such -information to the operating system. - - -@node Convenience to operating systems -@section How to make OS development easier - -OS images should be easy to generate. Ideally, an OS image should simply -be an ordinary 32-bit executable file in whatever file format the -operating system normally uses. It should be possible to @code{nm} or -disassemble OS images just like normal executables. Specialized tools -should not be required to create OS images in a @emph{special} file -format. If this means shifting some work from the operating system to -a boot loader, that is probably appropriate, because all the memory -consumed by the boot loader will typically be made available again after -the boot process is created, whereas every bit of code in the OS image -typically has to remain in memory forever. The operating system should -not have to worry about getting into 32-bit mode initially, because mode -switching code generally needs to be in the boot loader anyway in order -to load operating system data above the 1MB boundary, and forcing the -operating system to do this makes creation of OS images much more -difficult. - -Unfortunately, there is a horrendous variety of executable file formats -even among free Unix-like @sc{pc}-based operating systems --- generally -a different format for each operating system. Most of the relevant free -operating systems use some variant of a.out format, but some are moving -to @sc{elf}. It is highly desirable for boot loaders not to have to be -able to interpret all the different types of executable file formats in -existence in order to load the OS image --- otherwise the boot loader -effectively becomes operating system specific again. - -This specification adopts a compromise solution to this -problem. Multiboot-compliant OS images always contain a magic -@dfn{Multiboot header} (@pxref{OS image format}), which allows the boot -loader to load the image without having to understand numerous a.out -variants or other executable formats. This magic header does not need to -be at the very beginning of the executable file, so kernel images can -still conform to the local a.out format variant in addition to being -Multiboot-compliant. - - -@node Boot modules -@section Boot modules - -Many modern operating system kernels, such as those of VSTa and Mach, do -not by themselves contain enough mechanism to get the system fully -operational: they require the presence of additional software modules at -boot time in order to access devices, mount file systems, etc. While -these additional modules could be embedded in the main OS image along -with the kernel itself, and the resulting image be split apart manually -by the operating system when it receives control, it is often more -flexible, more space-efficient, and more convenient to the operating -system and user if the boot loader can load these additional modules -independently in the first place. - -Thus, this specification should provide a standard method for a boot -loader to indicate to the operating system what auxiliary boot modules -were loaded, and where they can be found. Boot loaders don't have to -support multiple boot modules, but they are strongly encouraged to, -because some operating systems will be unable to boot without them. - - -@node Terminology -@chapter The definitions of terms used through the specification - -@table @dfn -@item must -We use the term @dfn{must}, when any boot loader or OS image needs to -follow a rule --- otherwise, the boot loader or OS image is @emph{not} -Multiboot-compliant. - -@item should -We use the term @dfn{should}, when any boot loader or OS image is -recommended to follow a rule, but it doesn't need to follow the rule. - -@item may -We use the term @dfn{may}, when any boot loader or OS image is allowed -to follow a rule. - -@item boot loader -Whatever program or set of programs loads the image of the final -operating system to be run on the machine. The boot loader may itself -consist of several stages, but that is an implementation detail not -relevant to this specification. Only the @emph{final} stage of the boot -loader --- the stage that eventually transfers control to an operating -system --- must follow the rules specified in this document in order -to be @dfn{Multiboot-compliant}; earlier boot loader stages may be -designed in whatever way is most convenient. - -@item OS image -The initial binary image that a boot loader loads into memory and -transfers control to start an operating system. The OS image is -typically an executable containing the operating system kernel. - -@item boot module -Other auxiliary files that a boot loader loads into memory along with -an OS image, but does not interpret in any way other than passing their -locations to the operating system when it is invoked. - -@item Multiboot-compliant -A boot loader or an OS image which follows the rules defined as -@dfn{must} is Multiboot-compliant. When this specification specifies a -rule as @dfn{should} or @dfn{may}, a Multiboot-complaint boot loader/OS -image doesn't need to follow the rule. - -@item u8 -The type of unsigned 8-bit data. - -@item u16 -The type of unsigned 16-bit data. Because the target architecture is -little-endian, u16 is coded in little-endian. - -@item u32 -The type of unsigned 32-bit data. Because the target architecture is -little-endian, u32 is coded in little-endian. - -@item u64 -The type of unsigned 64-bit data. Because the target architecture is -little-endian, u64 is coded in little-endian. -@end table - - -@node Specification -@chapter The exact definitions of Multiboot Specification - -There are three main aspects of a boot loader/OS image interface: - -@enumerate -@item -The format of an OS image as seen by a boot loader. - -@item -The state of a machine when a boot loader starts an operating -system. - -@item -The format of information passed by a boot loader to an operating -system. -@end enumerate - -@menu -* OS image format:: -* Machine state:: -* Boot information format:: -@end menu - - -@node OS image format -@section OS image format - -An OS image may be an ordinary 32-bit executable file in the standard -format for that particular operating system, except that it may be -linked at a non-default load address to avoid loading on top of the -@sc{pc}'s I/O region or other reserved areas, and of course it should -not use shared libraries or other fancy features. - -An OS image must contain an additional header called @dfn{Multiboot -header}, besides the headers of the format used by the OS image. The -Multiboot header must be contained completely within the first 8192 -bytes of the OS image, and must be longword (32-bit) aligned. In -general, it should come @emph{as early as possible}, and may be -embedded in the beginning of the text segment after the @emph{real} -executable header. - -@menu -* Header layout:: The layout of Multiboot header -* Header magic fields:: The magic fields of Multiboot header -* Header address fields:: -* Header graphics fields:: -@end menu - - -@node Header layout -@subsection The layout of Multiboot header - -The layout of the Multiboot header must be as follows: - -@multitable @columnfractions .1 .1 .2 .5 -@item Offset @tab Type @tab Field Name @tab Note -@item 0 @tab u32 @tab magic @tab required -@item 4 @tab u32 @tab flags @tab required -@item 8 @tab u32 @tab checksum @tab required -@item 12 @tab u32 @tab header_addr @tab if flags[16] is set -@item 16 @tab u32 @tab load_addr @tab if flags[16] is set -@item 20 @tab u32 @tab load_end_addr @tab if flags[16] is set -@item 24 @tab u32 @tab bss_end_addr @tab if flags[16] is set -@item 28 @tab u32 @tab entry_addr @tab if flags[16] is set -@item 32 @tab u32 @tab mode_type @tab if flags[2] is set -@item 36 @tab u32 @tab width @tab if flags[2] is set -@item 40 @tab u32 @tab height @tab if flags[2] is set -@item 44 @tab u32 @tab depth @tab if flags[2] is set -@end multitable - -The fields @samp{magic}, @samp{flags} and @samp{checksum} are defined in -@ref{Header magic fields}, the fields @samp{header_addr}, -@samp{load_addr}, @samp{load_end_addr}, @samp{bss_end_addr} and -@samp{entry_addr} are defined in @ref{Header address fields}, and the -fields @samp{mode_type}, @samp{width}, @samp{height} and @samp{depth} are -defind in @ref{Header graphics fields}. - - -@node Header magic fields -@subsection The magic fields of Multiboot header - -@table @samp -@item magic -The field @samp{magic} is the magic number identifying the header, -which must be the hexadecimal value @code{0x1BADB002}. - -@item flags -The field @samp{flags} specifies features that the OS image requests or -requires of an boot loader. Bits 0-15 indicate requirements; if the -boot loader sees any of these bits set but doesn't understand the flag -or can't fulfill the requirements it indicates for some reason, it must -notify the user and fail to load the OS image. Bits 16-31 indicate -optional features; if any bits in this range are set but the boot loader -doesn't understand them, it may simply ignore them and proceed as -usual. Naturally, all as-yet-undefined bits in the @samp{flags} word -must be set to zero in OS images. This way, the @samp{flags} fields -serves for version control as well as simple feature selection. - -If bit 0 in the @samp{flags} word is set, then all boot modules loaded -along with the operating system must be aligned on page (4KB) -boundaries. Some operating systems expect to be able to map the pages -containing boot modules directly into a paged address space during -startup, and thus need the boot modules to be page-aligned. - -If bit 1 in the @samp{flags} word is set, then information on available -memory via at least the @samp{mem_*} fields of the Multiboot information -structure (@pxref{Boot information format}) must be included. If the -boot loader is capable of passing a memory map (the @samp{mmap_*} fields) -and one exists, then it may be included as well. - -If bit 2 in the @samp{flags} word is set, information about the video -mode table (@pxref{Boot information format}) must be available to the -kernel. - -If bit 16 in the @samp{flags} word is set, then the fields at offsets -8-24 in the Multiboot header are valid, and the boot loader should use -them instead of the fields in the actual executable header to calculate -where to load the OS image. This information does not need to be -provided if the kernel image is in @sc{elf} format, but it @emph{must} -be provided if the images is in a.out format or in some other -format. Compliant boot loaders must be able to load images that either -are in @sc{elf} format or contain the load address information embedded -in the Multiboot header; they may also directly support other executable -formats, such as particular a.out variants, but are not required to. - -@item checksum -The field @samp{checksum} is a 32-bit unsigned value which, when added -to the other magic fields (i.e. @samp{magic} and @samp{flags}), must -have a 32-bit unsigned sum of zero. -@end table - - -@node Header address fields -@subsection The address fields of Multiboot header - -All of the address fields enabled by flag bit 16 are physical addresses. -The meaning of each is as follows: - -@table @code -@item header_addr -Contains the address corresponding to the beginning of the Multiboot -header --- the physical memory location at which the magic value is -supposed to be loaded. This field serves to @dfn{synchronize} the -mapping between OS image offsets and physical memory addresses. - -@item load_addr -Contains the physical address of the beginning of the text segment. The -offset in the OS image file at which to start loading is defined by the -offset at which the header was found, minus (header_addr - -load_addr). load_addr must be less than or equal to header_addr. - -@item load_end_addr -Contains the physical address of the end of the data -segment. (load_end_addr - load_addr) specifies how much data to load. -This implies that the text and data segments must be consecutive in the -OS image; this is true for existing a.out executable formats. -If this field is zero, the boot loader assumes that the text and data -segments occupy the whole OS image file. - -@item bss_end_addr -Contains the physical address of the end of the bss segment. The boot -loader initializes this area to zero, and reserves the memory it -occupies to avoid placing boot modules and other data relevant to the -operating system in that area. If this field is zero, the boot loader -assumes that no bss segment is present. - -@item entry_addr -The physical address to which the boot loader should jump in order to -start running the operating system. -@end table - - -@node Header graphics fields -@subsection The graphics fields of Multiboot header - -All of the graphics fields are enabled by flag bit 2. They specify the -preferred graphics mode. Note that that is only a @emph{recommended} -mode by the OS image. If the mode exists, the boot loader should set -it, when the user doesn't specify a mode explicitly. Otherwise, the -boot loader should fall back to a similar mode, if available. - -The meaning of each is as follows: - -@table @code -@item mode_type -Contains @samp{0} for linear graphics mode or @samp{1} for -EGA-standard text mode. Everything else is reserved for future -expansion. Note that the boot loader may set a text mode, even if this -field contains @samp{0}. - -@item width -Contains the number of the columns. This is specified in pixels in a -graphics mode, and in characters in a text mode. The value zero -indicates that the OS image has no preference. - -@item height -Contains the number of the lines. This is specified in pixels in a -graphics mode, and in characters in a text mode. The value zero -indicates that the OS image has no preference. - -@item depth -Contains the number of bits per pixel in a graphics mode, and zero in -a text mode. The value zero indicates that the OS image has no -preference. -@end table - - -@node Machine state -@section Machine state - -When the boot loader invokes the 32-bit operating system, the machine -must have the following state: - -@table @samp -@item EAX -Must contain the magic value @samp{0x2BADB002}; the presence of this -value indicates to the operating system that it was loaded by a -Multiboot-compliant boot loader (e.g. as opposed to another type of -boot loader that the operating system can also be loaded from). - -@item EBX -Must contain the 32-bit physical address of the Multiboot -information structure provided by the boot loader (@pxref{Boot -information format}). - -@item CS -Must be a 32-bit read/execute code segment with an offset of @samp{0} -and a limit of @samp{0xFFFFFFFF}. The exact value is undefined. - -@item DS -@itemx ES -@itemx FS -@itemx GS -@itemx SS -Must be a 32-bit read/write data segment with an offset of @samp{0} -and a limit of @samp{0xFFFFFFFF}. The exact values are all undefined. - -@item A20 gate -Must be enabled. - -@item CR0 -Bit 31 (PG) must be cleared. Bit 0 (PE) must be set. Other bits are -all undefined. - -@item EFLAGS -Bit 17 (VM) must be cleared. Bit 9 (IF) must be cleared. Other bits -are all undefined. -@end table - -All other processor registers and flag bits are undefined. This -includes, in particular: - -@table @samp -@item ESP -The OS image must create its own stack as soon as it needs one. - -@item GDTR -Even though the segment registers are set up as described above, the -@samp{GDTR} may be invalid, so the OS image must not load any segment -registers (even just reloading the same values!) until it sets up its -own @samp{GDT}. - -@item IDTR -The OS image must leave interrupts disabled until it sets up its own -@code{IDT}. -@end table - -However, other machine state should be left by the boot loader in -@dfn{normal working order}, i.e. as initialized by the @sc{bios} (or -DOS, if that's what the boot loader runs from). In other words, the -operating system should be able to make @sc{bios} calls and such after -being loaded, as long as it does not overwrite the @sc{bios} data -structures before doing so. Also, the boot loader must leave the -@sc{pic} programmed with the normal @sc{bios}/DOS values, even if it -changed them during the switch to 32-bit mode. - - -@node Boot information format -@section Boot information format - -FIXME: Split this chapter like the chapter ``OS image format''. - -Upon entry to the operating system, the @code{EBX} register contains the -physical address of a @dfn{Multiboot information} data structure, -through which the boot loader communicates vital information to the -operating system. The operating system can use or ignore any parts of -the structure as it chooses; all information passed by the boot loader -is advisory only. - -The Multiboot information structure and its related substructures may be -placed anywhere in memory by the boot loader (with the exception of the -memory reserved for the kernel and boot modules, of course). It is the -operating system's responsibility to avoid overwriting this memory until -it is done using it. - -The format of the Multiboot information structure (as defined so far) -follows: - -@example -@group - +-------------------+ -0 | flags | (required) - +-------------------+ -4 | mem_lower | (present if flags[0] is set) -8 | mem_upper | (present if flags[0] is set) - +-------------------+ -12 | boot_device | (present if flags[1] is set) - +-------------------+ -16 | cmdline | (present if flags[2] is set) - +-------------------+ -20 | mods_count | (present if flags[3] is set) -24 | mods_addr | (present if flags[3] is set) - +-------------------+ -28 - 40 | syms | (present if flags[4] or - | | flags[5] is set) - +-------------------+ -44 | mmap_length | (present if flags[6] is set) -48 | mmap_addr | (present if flags[6] is set) - +-------------------+ -52 | drives_length | (present if flags[7] is set) -56 | drives_addr | (present if flags[7] is set) - +-------------------+ -60 | config_table | (present if flags[8] is set) - +-------------------+ -64 | boot_loader_name | (present if flags[9] is set) - +-------------------+ -68 | apm_table | (present if flags[10] is set) - +-------------------+ -72 | vbe_control_info | (present if flags[11] is set) -76 | vbe_mode_info | -80 | vbe_mode | -82 | vbe_interface_seg | -84 | vbe_interface_off | -86 | vbe_interface_len | - +-------------------+ -@end group -@end example - -The first longword indicates the presence and validity of other fields -in the Multiboot information structure. All as-yet-undefined bits must -be set to zero by the boot loader. Any set bits that the operating -system does not understand should be ignored. Thus, the @samp{flags} -field also functions as a version indicator, allowing the Multiboot -information structure to be expanded in the future without breaking -anything. - -If bit 0 in the @samp{flags} word is set, then the @samp{mem_*} fields -are valid. @samp{mem_lower} and @samp{mem_upper} indicate the amount of -lower and upper memory, respectively, in kilobytes. Lower memory starts -at address 0, and upper memory starts at address 1 megabyte. The maximum -possible value for lower memory is 640 kilobytes. The value returned for -upper memory is maximally the address of the first upper memory hole -minus 1 megabyte. It is not guaranteed to be this value. - -If bit 1 in the @samp{flags} word is set, then the @samp{boot_device} -field is valid, and indicates which @sc{bios} disk device the boot -loader loaded the OS image from. If the OS image was not loaded from a -@sc{bios} disk, then this field must not be present (bit 3 must be -clear). The operating system may use this field as a hint for -determining its own @dfn{root} device, but is not required to. The -@samp{boot_device} field is laid out in four one-byte subfields as -follows: - -@example -@group -+-------+-------+-------+-------+ -| drive | part1 | part2 | part3 | -+-------+-------+-------+-------+ -@end group -@end example - -The first byte contains the @sc{bios} drive number as understood by the -@sc{bios} INT 0x13 low-level disk interface: e.g. 0x00 for the first -floppy disk or 0x80 for the first hard disk. - -The three remaining bytes specify the boot partition. @samp{part1} -specifies the @dfn{top-level} partition number, @samp{part2} specifies a -@dfn{sub-partition} in the top-level partition, etc. Partition numbers -always start from zero. Unused partition bytes must be set to 0xFF. For -example, if the disk is partitioned using a simple one-level DOS -partitioning scheme, then @samp{part1} contains the DOS partition -number, and @samp{part2} and @samp{part3} are both 0xFF. As another -example, if a disk is partitioned first into DOS partitions, and then -one of those DOS partitions is subdivided into several BSD partitions -using BSD's @dfn{disklabel} strategy, then @samp{part1} contains the DOS -partition number, @samp{part2} contains the BSD sub-partition within -that DOS partition, and @samp{part3} is 0xFF. - -DOS extended partitions are indicated as partition numbers starting from -4 and increasing, rather than as nested sub-partitions, even though the -underlying disk layout of extended partitions is hierarchical in -nature. For example, if the boot loader boots from the second extended -partition on a disk partitioned in conventional DOS style, then -@samp{part1} will be 5, and @samp{part2} and @samp{part3} will both be -0xFF. - -If bit 2 of the @samp{flags} longword is set, the @samp{cmdline} field -is valid, and contains the physical address of the command line to -be passed to the kernel. The command line is a normal C-style -zero-terminated string. - -If bit 3 of the @samp{flags} is set, then the @samp{mods} fields -indicate to the kernel what boot modules were loaded along with the -kernel image, and where they can be found. @samp{mods_count} contains -the number of modules loaded; @samp{mods_addr} contains the physical -address of the first module structure. @samp{mods_count} may be zero, -indicating no boot modules were loaded, even if bit 1 of @samp{flags} is -set. Each module structure is formatted as follows: - -@example -@group - +-------------------+ -0 | mod_start | -4 | mod_end | - +-------------------+ -8 | string | - +-------------------+ -12 | reserved (0) | - +-------------------+ -@end group -@end example - -The first two fields contain the start and end addresses of the boot -module itself. The @samp{string} field provides an arbitrary string to -be associated with that particular boot module; it is a zero-terminated -ASCII string, just like the kernel command line. The @samp{string} field -may be 0 if there is no string associated with the module. Typically the -string might be a command line (e.g. if the operating system treats boot -modules as executable programs), or a pathname (e.g. if the operating -system treats boot modules as files in a file system), but its exact use -is specific to the operating system. The @samp{reserved} field must be -set to 0 by the boot loader and ignored by the operating system. - -@strong{Caution:} Bits 4 & 5 are mutually exclusive. - -If bit 4 in the @samp{flags} word is set, then the following fields in -the Multiboot information structure starting at byte 28 are valid: - -@example -@group - +-------------------+ -28 | tabsize | -32 | strsize | -36 | addr | -40 | reserved (0) | - +-------------------+ -@end group -@end example - -These indicate where the symbol table from an a.out kernel image can be -found. @samp{addr} is the physical address of the size (4-byte unsigned -long) of an array of a.out format @dfn{nlist} structures, followed -immediately by the array itself, then the size (4-byte unsigned long) of -a set of zero-terminated @sc{ascii} strings (plus sizeof(unsigned long) in -this case), and finally the set of strings itself. @samp{tabsize} is -equal to its size parameter (found at the beginning of the symbol -section), and @samp{strsize} is equal to its size parameter (found at -the beginning of the string section) of the following string table to -which the symbol table refers. Note that @samp{tabsize} may be 0, -indicating no symbols, even if bit 4 in the @samp{flags} word is set. - -If bit 5 in the @samp{flags} word is set, then the following fields in -the Multiboot information structure starting at byte 28 are valid: - -@example -@group - +-------------------+ -28 | num | -32 | size | -36 | addr | -40 | shndx | - +-------------------+ -@end group -@end example - -These indicate where the section header table from an ELF kernel is, the -size of each entry, number of entries, and the string table used as the -index of names. They correspond to the @samp{shdr_*} entries -(@samp{shdr_num}, etc.) in the Executable and Linkable Format (@sc{elf}) -specification in the program header. All sections are loaded, and the -physical address fields of the @sc{elf} section header then refer to where -the sections are in memory (refer to the i386 @sc{elf} documentation for -details as to how to read the section header(s)). Note that -@samp{shdr_num} may be 0, indicating no symbols, even if bit 5 in the -@samp{flags} word is set. - -If bit 6 in the @samp{flags} word is set, then the @samp{mmap_*} fields -are valid, and indicate the address and length of a buffer containing a -memory map of the machine provided by the @sc{bios}. @samp{mmap_addr} is -the address, and @samp{mmap_length} is the total size of the buffer. The -buffer consists of one or more of the following size/structure pairs -(@samp{size} is really used for skipping to the next pair): - -@example -@group - +-------------------+ --4 | size | - +-------------------+ -0 | base_addr_low | -4 | base_addr_high | -8 | length_low | -12 | length_high | -16 | type | - +-------------------+ -@end group -@end example - -where @samp{size} is the size of the associated structure in bytes, which -can be greater than the minimum of 20 bytes. @samp{base_addr_low} is the -lower 32 bits of the starting address, and @samp{base_addr_high} is the -upper 32 bits, for a total of a 64-bit starting address. @samp{length_low} -is the lower 32 bits of the size of the memory region in bytes, and -@samp{length_high} is the upper 32 bits, for a total of a 64-bit -length. @samp{type} is the variety of address range represented, where a -value of 1 indicates available @sc{ram}, and all other values currently -indicated a reserved area. - -The map provided is guaranteed to list all standard @sc{ram} that should -be available for normal use. - -If bit 7 in the @samp{flags} is set, then the @samp{drives_*} fields -are valid, and indicate the address of the physical address of the first -drive structure and the size of drive structures. @samp{drives_addr} -is the address, and @samp{drives_length} is the total size of drive -structures. Note that @samp{drives_length} may be zero. Each drive -structure is formatted as follows: - -@example -@group - +-------------------+ -0 | size | - +-------------------+ -4 | drive_number | - +-------------------+ -5 | drive_mode | - +-------------------+ -6 | drive_cylinders | -8 | drive_heads | -9 | drive_sectors | - +-------------------+ -10 - xx | drive_ports | - +-------------------+ -@end group -@end example - -The @samp{size} field specifies the size of this structure. The size -varies, depending on the number of ports. Note that the size may not be -equal to (10 + 2 * the number of ports), because of an alignment. - -The @samp{drive_number} field contains the BIOS drive number. The -@samp{drive_mode} field represents the access mode used by the boot -loader. Currently, the following modes are defined: - -@table @samp -@item 0 -CHS mode (traditional cylinder/head/sector addressing mode). - -@item 1 -LBA mode (Logical Block Addressing mode). -@end table - -The three fields, @samp{drive_cylinders}, @samp{drive_heads} and -@samp{drive_sectors}, indicate the geometry of the drive detected by the -@sc{bios}. @samp{drive_cylinders} contains the number of the -cylinders. @samp{drive_heads} contains the number of the -heads. @samp{drive_sectors} contains the number of the sectors per -track. - -The @samp{drive_ports} field contains the array of the I/O ports used -for the drive in the @sc{bios} code. The array consists of zero or more -unsigned two-bytes integers, and is terminated with zero. Note that the -array may contain any number of I/O ports that are not related to the -drive actually (such as @sc{dma} controller's ports). - -If bit 8 in the @samp{flags} is set, then the @samp{config_table} field -is valid, and indicates the address of the @sc{rom} configuration table -returned by the @dfn{GET CONFIGURATION} @sc{bios} call. If the @sc{bios} -call fails, then the size of the table must be @emph{zero}. - -If bit 9 in the @samp{flags} is set, the @samp{boot_loader_name} field -is valid, and contains the physical address of the name of a boot -loader booting the kernel. The name is a normal C-style zero-terminated -string. - -If bit 10 in the @samp{flags} is set, the @samp{apm_table} field is -valid, and contains the physical address of an @sc{apm} table defined as -below: - -@example -@group - +----------------------+ -0 | version | -2 | cseg | -4 | offset | -8 | cseg_16 | -10 | dseg | -12 | flags | -14 | cseg_len | -16 | cseg_16_len | -18 | dseg_len | - +----------------------+ -@end group -@end example - -The fields @samp{version}, @samp{cseg}, @samp{offset}, @samp{cseg_16}, -@samp{dseg}, @samp{flags}, @samp{cseg_len}, @samp{cseg_16_len}, -@samp{dseg_len} indicate the version number, the protected mode 32-bit -code segment, the offset of the entry point, the protected mode 16-bit -code segment, the protected mode 16-bit data segment, the flags, the -length of the protected mode 32-bit code segment, the length of the -protected mode 16-bit code segment, and the length of the protected mode -16-bit data segment, respectively. Only the field @samp{offset} is 4 -bytes, and the others are 2 bytes. See -@uref{http://www.microsoft.com/hwdev/busbios/amp_12.htm, Advanced Power -Management (APM) BIOS Interface Specification}, for more information. - -If bit 11 in the @samp{flags} is set, the graphics table is available. -This must only be done if the kernel has indicated in the -@samp{Multiboot Header} that it accepts a graphics mode. - -The fields @samp{vbe_control_info} and @samp{vbe_mode_info} contain -the physical addresses of @sc{vbe} control information returned by the -@sc{vbe} Function 00h and @sc{vbe} mode information returned by the -@sc{vbe} Function 01h, respectively. - -The field @samp{vbe_mode} indicates current video mode in the format -specified in @sc{vbe} 3.0. - -The rest fields @samp{vbe_interface_seg}, @samp{vbe_interface_off}, and -@samp{vbe_interface_len} contain the table of a protected mode interface -defined in @sc{vbe} 2.0+. If this information is not available, those -fields contain zero. Note that @sc{vbe} 3.0 defines another protected -mode interface which is incompatible with the old one. If you want to -use the new protected mode interface, you will have to find the table -yourself. - -The fields for the graphics table are designed for @sc{vbe}, but -Multiboot boot loaders may simulate @sc{vbe} on non-@sc{vbe} modes, as -if they were @sc{vbe} modes. - - -@node Examples -@chapter Examples - -@strong{Caution:} The following items are not part of the specification -document, but are included for prospective operating system and boot -loader writers. - -@menu -* Notes on PC:: -* BIOS device mapping techniques:: -* Example OS code:: -* Example boot loader code:: -@end menu - - -@node Notes on PC -@section Notes on PC - -In reference to bit 0 of the @samp{flags} parameter in the Multiboot -information structure, if the bootloader in question uses older -@sc{bios} interfaces, or the newest ones are not available (see -description about bit 6), then a maximum of either 15 or 63 megabytes of -memory may be reported. It is @emph{highly} recommended that boot -loaders perform a thorough memory probe. - -In reference to bit 1 of the @samp{flags} parameter in the Multiboot -information structure, it is recognized that determination of which -@sc{bios} drive maps to which device driver in an operating system is -non-trivial, at best. Many kludges have been made to various operating -systems instead of solving this problem, most of them breaking under -many conditions. To encourage the use of general-purpose solutions to -this problem, there are 2 @sc{bios} device mapping techniques -(@pxref{BIOS device mapping techniques}). - -In reference to bit 6 of the @samp{flags} parameter in the Multiboot -information structure, it is important to note that the data structure -used there (starting with @samp{BaseAddrLow}) is the data returned by -the INT 15h, AX=E820h --- Query System Address Map call. See @xref{Query -System Address Map, , Query System Address Map, grub.info, The GRUB -Manual}, for more information. The interface here is meant to allow a -boot loader to work unmodified with any reasonable extensions of the -@sc{bios} interface, passing along any extra data to be interpreted by -the operating system as desired. - - -@node BIOS device mapping techniques -@section BIOS device mapping techniques - -Both of these techniques should be usable from any PC operating system, -and neither require any special support in the drivers themselves. This -section will be flushed out into detailed explanations, particularly for -the I/O restriction technique. - -The general rule is that the data comparison technique is the quick and -dirty solution. It works most of the time, but doesn't cover all the -bases, and is relatively simple. - -The I/O restriction technique is much more complex, but it has potential -to solve the problem under all conditions, plus allow access of the -remaining @sc{bios} devices when not all of them have operating system -drivers. - -@menu -* Data comparison technique:: -* I/O restriction technique:: -@end menu - - -@node Data comparison technique -@subsection Data comparison technique - -Before activating @emph{any} of the device drivers, gather enough data -from similar sectors on each of the disks such that each one can be -uniquely identified. - -After activating the device drivers, compare data from the drives using -the operating system drivers. This should hopefully be sufficient to -provide such a mapping. - -Problems: - -@enumerate -@item -The data on some @sc{bios} devices might be identical (so the part -reading the drives from the @sc{bios} should have some mechanism to give -up). - -@item -There might be extra drives not accessible from the @sc{bios} which are -identical to some drive used by the @sc{bios} (so it should be capable -of giving up there as well). -@end enumerate - - -@node I/O restriction technique -@subsection I/O restriction technique - -This first step may be unnecessary, but first create copy-on-write -mappings for the device drivers writing into @sc{pc} @sc{ram}. Keep the -original copies for the @dfn{clean @sc{bios} virtual machine} to be -created later. - -For each device driver brought online, determine which @sc{bios} devices -become inaccessible by: - -@enumerate -@item -Create a @dfn{clean @sc{bios} virtual machine}. - -@item -Set the I/O permission map for the I/O area claimed by the device driver -to no permissions (neither read nor write). - -@item -Access each device. - -@item -Record which devices succeed, and those which try to access the -@dfn{restricted} I/O areas (hopefully, this will be an @dfn{xor} -situation). -@end enumerate - -For each device driver, given how many of the @sc{bios} devices were -subsumed by it (there should be no gaps in this list), it should be easy -to determine which devices on the controller these are. - -In general, you have at most 2 disks from each controller given -@sc{bios} numbers, but they pretty much always count from the lowest -logically numbered devices on the controller. - - -@node Example OS code -@section Example OS code - -In this distribution, the example Multiboot kernel @file{kernel} is -included. The kernel just prints out the Multiboot information structure -on the screen, so you can make use of the kernel to test a -Multiboot-compliant boot loader and for reference to how to implement a -Multiboot kernel. The source files can be found under the directory -@file{docs} in the GRUB distribution. - -The kernel @file{kernel} consists of only three files: @file{boot.S}, -@file{kernel.c} and @file{multiboot.h}. The assembly source -@file{boot.S} is written in GAS (@pxref{Top, , GNU assembler, as.info, -The GNU assembler}), and contains the Multiboot information structure to -comply with the specification. When a Multiboot-compliant boot loader -loads and execute it, it initialize the stack pointer and @code{EFLAGS}, -and then call the function @code{cmain} defined in @file{kernel.c}. If -@code{cmain} returns to the callee, then it shows a message to inform -the user of the halt state and stops forever until you push the reset -key. The file @file{kernel.c} contains the function @code{cmain}, -which checks if the magic number passed by the boot loader is valid and -so on, and some functions to print messages on the screen. The file -@file{multiboot.h} defines some macros, such as the magic number for the -Multiboot header, the Multiboot header structure and the Multiboot -information structure. - -@menu -* multiboot.h:: -* boot.S:: -* kernel.c:: -* Other Multiboot kernels:: -@end menu - - -@node multiboot.h -@subsection multiboot.h - -This is the source code in the file @file{multiboot.h}: - -@example -@include multiboot.h.texi -@end example - - -@node boot.S -@subsection boot.S - -In the file @file{boot.S}: - -@example -@include boot.S.texi -@end example - - -@node kernel.c -@subsection kernel.c - -And, in the file @file{kernel.c}: - -@example -@include kernel.c.texi -@end example - - -@node Other Multiboot kernels -@subsection Other Multiboot kernels - -Other useful information should be available in Multiboot kernels, such -as GNU Mach and Fiasco @url{http://os.inf.tu-dresden.de/fiasco/}. And, -it is worth mentioning the OSKit -@url{http://www.cs.utah.edu/projects/flux/oskit/}, which provides a -library supporting the specification. - - -@node Example boot loader code -@section Example boot loader code - -The GNU GRUB (@pxref{Top, , GRUB, grub.info, The GRUB manual}) project -is a full Multiboot-compliant boot loader, supporting all required and -optional features present in this specification. A public release has -not been made, but the test release is available from: - -@url{ftp://alpha.gnu.org/gnu/grub} - -See the webpage @url{http://www.gnu.org/software/grub/grub.html}, for -more information. - - -@node History -@chapter The change log of this specification - -@table @asis -@item 0.7 -@itemize @bullet -@item -@dfn{Multiboot Standard} is renamed to @dfn{Multiboot Specification}. - -@item -Graphics fields are added to Multiboot header. - -@item -BIOS drive information, BIOS configuration table, the name of a boot -loader, APM information, and graphics information are added to Multiboot -information. - -@item -Rewritten in Texinfo format. - -@item -Rewritten, using more strict words. - -@item -The maintainer changes to the GNU GRUB maintainer team -@email{bug-grub@@gnu.org}, from Bryan Ford and Erich Stefan Boleyn. -@end itemize - -@item 0.6 -@itemize @bullet -@item -A few wording changes. - -@item -Header checksum. - -@item -Clasification of machine state passed to an operating system. -@end itemize - -@item 0.5 -@itemize @bullet -@item -Name change. -@end itemize - -@item 0.4 -@itemize @bullet -@item -Major changes plus HTMLification. -@end itemize -@end table - - -@node Index -@unnumbered Index - -@printindex cp - -@contents -@bye diff --git a/usr/src/grub/grub-0.95/docs/src2texi b/usr/src/grub/grub-0.95/docs/src2texi deleted file mode 100644 index 10786d9716..0000000000 --- a/usr/src/grub/grub-0.95/docs/src2texi +++ /dev/null @@ -1,16 +0,0 @@ -#! /bin/sh -# -# Convert a source file to a TeXinfo file. Stolen from glibc. -# -# Usage: src2texi SRCDIR SRC TEXI - -dir=$1 -src=`basename $2` -texi=`basename $3` - -sed -e 's,[{}],@&,g' \ - -e 's,/\*\(@.*\)\*/,\1,g' \ - -e 's,/\* *,/* @r{,g' -e 's, *\*/,} */,' \ - -e 's/\(@[a-z][a-z]*\)@{\([^}]*\)@}/\1{\2}/g' \ - ${dir}/${src} | expand > ${texi}.new -mv -f ${texi}.new ${dir}/${texi} diff --git a/usr/src/grub/grub-0.95/docs/stamp-vti b/usr/src/grub/grub-0.95/docs/stamp-vti deleted file mode 100644 index 6b078b2ef8..0000000000 --- a/usr/src/grub/grub-0.95/docs/stamp-vti +++ /dev/null @@ -1,4 +0,0 @@ -@set UPDATED 20 September 2004 -@set UPDATED-MONTH September 2004 -@set EDITION 0.95 -@set VERSION 0.95 diff --git a/usr/src/grub/grub-0.95/docs/texinfo.tex b/usr/src/grub/grub-0.95/docs/texinfo.tex deleted file mode 100644 index 77b391f245..0000000000 --- a/usr/src/grub/grub-0.95/docs/texinfo.tex +++ /dev/null @@ -1,6735 +0,0 @@ -% texinfo.tex -- TeX macros to handle Texinfo files. -% -% Load plain if necessary, i.e., if running under initex. -\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi -% -\def\texinfoversion{2004-01-05.16} -% -% Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, -% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software -% Foundation, Inc. -% -% This texinfo.tex file 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 texinfo.tex file is distributed in the hope that 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 texinfo.tex file; see the file COPYING. If not, write -% to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -% Boston, MA 02111-1307, USA. -% -% As a special exception, when this file is read by TeX when processing -% a Texinfo source document, you may use the result without -% restriction. (This has been our intent since Texinfo was invented.) -% -% Please try the latest version of texinfo.tex before submitting bug -% reports; you can get the latest version from: -% http://www.gnu.org/software/texinfo/ (the Texinfo home page), or -% ftp://tug.org/tex/texinfo.tex -% (and all CTAN mirrors, see http://www.ctan.org). -% The texinfo.tex in any given distribution could well be out -% of date, so if that's what you're using, please check. -% -% Send bug reports to bug-texinfo@gnu.org. Please include including a -% complete document in each bug report with which we can reproduce the -% problem. Patches are, of course, greatly appreciated. -% -% To process a Texinfo manual with TeX, it's most reliable to use the -% texi2dvi shell script that comes with the distribution. For a simple -% manual foo.texi, however, you can get away with this: -% tex foo.texi -% texindex foo.?? -% tex foo.texi -% tex foo.texi -% dvips foo.dvi -o # or whatever; this makes foo.ps. -% The extra TeX runs get the cross-reference information correct. -% Sometimes one run after texindex suffices, and sometimes you need more -% than two; texi2dvi does it as many times as necessary. -% -% It is possible to adapt texinfo.tex for other languages, to some -% extent. You can get the existing language-specific files from the -% full Texinfo distribution. -% -% The GNU Texinfo home page is http://www.gnu.org/software/texinfo. - - -\message{Loading texinfo [version \texinfoversion]:} - -% If in a .fmt file, print the version number -% and turn on active characters that we couldn't do earlier because -% they might have appeared in the input file name. -\everyjob{\message{[Texinfo version \texinfoversion]}% - \catcode`+=\active \catcode`\_=\active} - -\message{Basics,} -\chardef\other=12 - -% We never want plain's \outer definition of \+ in Texinfo. -% For @tex, we can use \tabalign. -\let\+ = \relax - -% Save some plain tex macros whose names we will redefine. -\let\ptexb=\b -\let\ptexbullet=\bullet -\let\ptexc=\c -\let\ptexcomma=\, -\let\ptexdot=\. -\let\ptexdots=\dots -\let\ptexend=\end -\let\ptexequiv=\equiv -\let\ptexexclam=\! -\let\ptexfootnote=\footnote -\let\ptexgtr=> -\let\ptexhat=^ -\let\ptexi=\i -\let\ptexindent=\indent -\let\ptexnoindent=\noindent -\let\ptexinsert=\insert -\let\ptexlbrace=\{ -\let\ptexless=< -\let\ptexplus=+ -\let\ptexrbrace=\} -\let\ptexslash=\/ -\let\ptexstar=\* -\let\ptext=\t - -% If this character appears in an error message or help string, it -% starts a new line in the output. -\newlinechar = `^^J - -% Use TeX 3.0's \inputlineno to get the line number, for better error -% messages, but if we're using an old version of TeX, don't do anything. -% -\ifx\inputlineno\thisisundefined - \let\linenumber = \empty % Pre-3.0. -\else - \def\linenumber{l.\the\inputlineno:\space} -\fi - -% Set up fixed words for English if not already set. -\ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi -\ifx\putwordChapter\undefined \gdef\putwordChapter{Chapter}\fi -\ifx\putwordfile\undefined \gdef\putwordfile{file}\fi -\ifx\putwordin\undefined \gdef\putwordin{in}\fi -\ifx\putwordIndexIsEmpty\undefined \gdef\putwordIndexIsEmpty{(Index is empty)}\fi -\ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi -\ifx\putwordInfo\undefined \gdef\putwordInfo{Info}\fi -\ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi -\ifx\putwordMethodon\undefined \gdef\putwordMethodon{Method on}\fi -\ifx\putwordNoTitle\undefined \gdef\putwordNoTitle{No Title}\fi -\ifx\putwordof\undefined \gdef\putwordof{of}\fi -\ifx\putwordon\undefined \gdef\putwordon{on}\fi -\ifx\putwordpage\undefined \gdef\putwordpage{page}\fi -\ifx\putwordsection\undefined \gdef\putwordsection{section}\fi -\ifx\putwordSection\undefined \gdef\putwordSection{Section}\fi -\ifx\putwordsee\undefined \gdef\putwordsee{see}\fi -\ifx\putwordSee\undefined \gdef\putwordSee{See}\fi -\ifx\putwordShortTOC\undefined \gdef\putwordShortTOC{Short Contents}\fi -\ifx\putwordTOC\undefined \gdef\putwordTOC{Table of Contents}\fi -% -\ifx\putwordMJan\undefined \gdef\putwordMJan{January}\fi -\ifx\putwordMFeb\undefined \gdef\putwordMFeb{February}\fi -\ifx\putwordMMar\undefined \gdef\putwordMMar{March}\fi -\ifx\putwordMApr\undefined \gdef\putwordMApr{April}\fi -\ifx\putwordMMay\undefined \gdef\putwordMMay{May}\fi -\ifx\putwordMJun\undefined \gdef\putwordMJun{June}\fi -\ifx\putwordMJul\undefined \gdef\putwordMJul{July}\fi -\ifx\putwordMAug\undefined \gdef\putwordMAug{August}\fi -\ifx\putwordMSep\undefined \gdef\putwordMSep{September}\fi -\ifx\putwordMOct\undefined \gdef\putwordMOct{October}\fi -\ifx\putwordMNov\undefined \gdef\putwordMNov{November}\fi -\ifx\putwordMDec\undefined \gdef\putwordMDec{December}\fi -% -\ifx\putwordDefmac\undefined \gdef\putwordDefmac{Macro}\fi -\ifx\putwordDefspec\undefined \gdef\putwordDefspec{Special Form}\fi -\ifx\putwordDefvar\undefined \gdef\putwordDefvar{Variable}\fi -\ifx\putwordDefopt\undefined \gdef\putwordDefopt{User Option}\fi -\ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi - -% In some macros, we cannot use the `\? notation---the left quote is -% in some cases the escape char. -\chardef\colonChar = `\: -\chardef\commaChar = `\, -\chardef\dotChar = `\. -\chardef\exclamChar= `\! -\chardef\questChar = `\? -\chardef\semiChar = `\; -\chardef\underChar = `\_ - -\chardef\spaceChar = `\ % -\chardef\spacecat = 10 -\def\spaceisspace{\catcode\spaceChar=\spacecat} - -% Ignore a token. -% -\def\gobble#1{} - -% The following is used inside several \edef's. -\def\makecsname#1{\expandafter\noexpand\csname#1\endcsname} - -% Hyphenation fixes. -\hyphenation{ap-pen-dix} -\hyphenation{eshell} -\hyphenation{mini-buf-fer mini-buf-fers} -\hyphenation{time-stamp} -\hyphenation{white-space} - -% Margin to add to right of even pages, to left of odd pages. -\newdimen\bindingoffset -\newdimen\normaloffset -\newdimen\pagewidth \newdimen\pageheight - -% For a final copy, take out the rectangles -% that mark overfull boxes (in case you have decided -% that the text looks ok even though it passes the margin). -% -\def\finalout{\overfullrule=0pt} - -% @| inserts a changebar to the left of the current line. It should -% surround any changed text. This approach does *not* work if the -% change spans more than two lines of output. To handle that, we would -% have adopt a much more difficult approach (putting marks into the main -% vertical list for the beginning and end of each change). -% -\def\|{% - % \vadjust can only be used in horizontal mode. - \leavevmode - % - % Append this vertical mode material after the current line in the output. - \vadjust{% - % We want to insert a rule with the height and depth of the current - % leading; that is exactly what \strutbox is supposed to record. - \vskip-\baselineskip - % - % \vadjust-items are inserted at the left edge of the type. So - % the \llap here moves out into the left-hand margin. - \llap{% - % - % For a thicker or thinner bar, change the `1pt'. - \vrule height\baselineskip width1pt - % - % This is the space between the bar and the text. - \hskip 12pt - }% - }% -} - -% Sometimes it is convenient to have everything in the transcript file -% and nothing on the terminal. We don't just call \tracingall here, -% since that produces some useless output on the terminal. We also make -% some effort to order the tracing commands to reduce output in the log -% file; cf. trace.sty in LaTeX. -% -\def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}% -\def\loggingall{% - \tracingstats2 - \tracingpages1 - \tracinglostchars2 % 2 gives us more in etex - \tracingparagraphs1 - \tracingoutput1 - \tracingmacros2 - \tracingrestores1 - \showboxbreadth\maxdimen \showboxdepth\maxdimen - \ifx\eTeXversion\undefined\else % etex gives us more logging - \tracingscantokens1 - \tracingifs1 - \tracinggroups1 - \tracingnesting2 - \tracingassigns1 - \fi - \tracingcommands3 % 3 gives us more in etex - \errorcontextlines16 -}% - -% add check for \lastpenalty to plain's definitions. If the last thing -% we did was a \nobreak, we don't want to insert more space. -% -\def\smallbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\smallskipamount - \removelastskip\penalty-50\smallskip\fi\fi} -\def\medbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\medskipamount - \removelastskip\penalty-100\medskip\fi\fi} -\def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount - \removelastskip\penalty-200\bigskip\fi\fi} - -% For @cropmarks command. -% Do @cropmarks to get crop marks. -% -\newif\ifcropmarks -\let\cropmarks = \cropmarkstrue -% -% Dimensions to add cropmarks at corners. -% Added by P. A. MacKay, 12 Nov. 1986 -% -\newdimen\outerhsize \newdimen\outervsize % set by the paper size routines -\newdimen\cornerlong \cornerlong=1pc -\newdimen\cornerthick \cornerthick=.3pt -\newdimen\topandbottommargin \topandbottommargin=.75in - -% Main output routine. -\chardef\PAGE = 255 -\output = {\onepageout{\pagecontents\PAGE}} - -\newbox\headlinebox -\newbox\footlinebox - -% \onepageout takes a vbox as an argument. Note that \pagecontents -% does insertions, but you have to call it yourself. -\def\onepageout#1{% - \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi - % - \ifodd\pageno \advance\hoffset by \bindingoffset - \else \advance\hoffset by -\bindingoffset\fi - % - % Do this outside of the \shipout so @code etc. will be expanded in - % the headline as they should be, not taken literally (outputting ''code). - \setbox\headlinebox = \vbox{\let\hsize=\pagewidth \makeheadline}% - \setbox\footlinebox = \vbox{\let\hsize=\pagewidth \makefootline}% - % - {% - % Have to do this stuff outside the \shipout because we want it to - % take effect in \write's, yet the group defined by the \vbox ends - % before the \shipout runs. - % - \escapechar = `\\ % use backslash in output files. - \indexdummies % don't expand commands in the output. - \normalturnoffactive % \ in index entries must not stay \, e.g., if - % the page break happens to be in the middle of an example. - \shipout\vbox{% - % Do this early so pdf references go to the beginning of the page. - \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi - % - \ifcropmarks \vbox to \outervsize\bgroup - \hsize = \outerhsize - \vskip-\topandbottommargin - \vtop to0pt{% - \line{\ewtop\hfil\ewtop}% - \nointerlineskip - \line{% - \vbox{\moveleft\cornerthick\nstop}% - \hfill - \vbox{\moveright\cornerthick\nstop}% - }% - \vss}% - \vskip\topandbottommargin - \line\bgroup - \hfil % center the page within the outer (page) hsize. - \ifodd\pageno\hskip\bindingoffset\fi - \vbox\bgroup - \fi - % - \unvbox\headlinebox - \pagebody{#1}% - \ifdim\ht\footlinebox > 0pt - % Only leave this space if the footline is nonempty. - % (We lessened \vsize for it in \oddfootingxxx.) - % The \baselineskip=24pt in plain's \makefootline has no effect. - \vskip 2\baselineskip - \unvbox\footlinebox - \fi - % - \ifcropmarks - \egroup % end of \vbox\bgroup - \hfil\egroup % end of (centering) \line\bgroup - \vskip\topandbottommargin plus1fill minus1fill - \boxmaxdepth = \cornerthick - \vbox to0pt{\vss - \line{% - \vbox{\moveleft\cornerthick\nsbot}% - \hfill - \vbox{\moveright\cornerthick\nsbot}% - }% - \nointerlineskip - \line{\ewbot\hfil\ewbot}% - }% - \egroup % \vbox from first cropmarks clause - \fi - }% end of \shipout\vbox - }% end of group with \normalturnoffactive - \advancepageno - \ifnum\outputpenalty>-20000 \else\dosupereject\fi -} - -\newinsert\margin \dimen\margin=\maxdimen - -\def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}} -{\catcode`\@ =11 -\gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi -% marginal hacks, juha@viisa.uucp (Juha Takala) -\ifvoid\margin\else % marginal info is present - \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi -\dimen@=\dp#1 \unvbox#1 -\ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi -\ifr@ggedbottom \kern-\dimen@ \vfil \fi} -} - -% Here are the rules for the cropmarks. Note that they are -% offset so that the space between them is truly \outerhsize or \outervsize -% (P. A. MacKay, 12 November, 1986) -% -\def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong} -\def\nstop{\vbox - {\hrule height\cornerthick depth\cornerlong width\cornerthick}} -\def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong} -\def\nsbot{\vbox - {\hrule height\cornerlong depth\cornerthick width\cornerthick}} - -% Parse an argument, then pass it to #1. The argument is the rest of -% the input line (except we remove a trailing comment). #1 should be a -% macro which expects an ordinary undelimited TeX argument. -% -\def\parsearg{\parseargusing{}} -\def\parseargusing#1#2{% - \def\next{#2}% - \begingroup - \obeylines - \spaceisspace - #1% - \parseargline\empty% Insert the \empty token, see \finishparsearg below. -} - -{\obeylines % - \gdef\parseargline#1^^M{% - \endgroup % End of the group started in \parsearg. - \argremovecomment #1\comment\ArgTerm% - }% -} - -% First remove any @comment, then any @c comment. -\def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm} -\def\argremovec#1\c#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm} - -% Each occurence of `\^^M' or `\^^M' is replaced by a single space. -% -% \argremovec might leave us with trailing space, e.g., -% @end itemize @c foo -% This space token undergoes the same procedure and is eventually removed -% by \finishparsearg. -% -\def\argcheckspaces#1\^^M{\argcheckspacesX#1\^^M \^^M} -\def\argcheckspacesX#1 \^^M{\argcheckspacesY#1\^^M} -\def\argcheckspacesY#1\^^M#2\^^M#3\ArgTerm{% - \def\temp{#3}% - \ifx\temp\empty - % We cannot use \next here, as it holds the macro to run; - % thus we reuse \temp. - \let\temp\finishparsearg - \else - \let\temp\argcheckspaces - \fi - % Put the space token in: - \temp#1 #3\ArgTerm -} - -% If a _delimited_ argument is enclosed in braces, they get stripped; so -% to get _exactly_ the rest of the line, we had to prevent such situation. -% We prepended an \empty token at the very beginning and we expand it now, -% just before passing the control to \next. -% (Similarily, we have to think about #3 of \argcheckspacesY above: it is -% either the null string, or it ends with \^^M---thus there is no danger -% that a pair of braces would be stripped. -% -% But first, we have to remove the trailing space token. -% -\def\finishparsearg#1 \ArgTerm{\expandafter\next\expandafter{#1}} - -% \parseargdef\foo{...} -% is roughly equivalent to -% \def\foo{\parsearg\Xfoo} -% \def\Xfoo#1{...} -% -% Actually, I use \csname\string\foo\endcsname, ie. \\foo, as it is my -% favourite TeX trick. --kasal, 16nov03 - -\def\parseargdef#1{% - \expandafter \doparseargdef \csname\string#1\endcsname #1% -} -\def\doparseargdef#1#2{% - \def#2{\parsearg#1}% - \def#1##1% -} - -% Several utility definitions with active space: -{ - \obeyspaces - \gdef\obeyedspace{ } - - % Make each space character in the input produce a normal interword - % space in the output. Don't allow a line break at this space, as this - % is used only in environments like @example, where each line of input - % should produce a line of output anyway. - % - \gdef\sepspaces{\obeyspaces\let =\tie} - - % If an index command is used in an @example environment, any spaces - % therein should become regular spaces in the raw index file, not the - % expansion of \tie (\leavevmode \penalty \@M \ ). - \gdef\unsepspaces{\let =\space} -} - - -\def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next} - -% Define the framework for environments in texinfo.tex. It's used like this: -% -% \envdef\foo{...} -% \def\Efoo{...} -% -% It's the responsibility of \envdef to insert \begingroup before the -% actual body; @end closes the group after calling \Efoo. \envdef also -% defines \thisenv, so the current environment is known; @end checks -% whether the environment name matches. The \checkenv macro can also be -% used to check whether the current environment is the one expected. -% -% Non-false conditionals (@iftex, @ifset) don't fit into this, so they -% are not treated as enviroments; they don't open a group. (The -% implementation of @end takes care not to call \endgroup in this -% special case.) - - -% At runtime, environments start with this: -\def\startenvironment#1{\begingroup\def\thisenv{#1}} -% initialize -\let\thisenv\empty - -% ... but they get defined via ``\envdef\foo{...}'': -\long\def\envdef#1#2{\def#1{\startenvironment#1#2}} -\def\envparseargdef#1#2{\parseargdef#1{\startenvironment#1#2}} - -% Check whether we're in the right environment: -\def\checkenv#1{% - \def\temp{#1}% - \ifx\thisenv\temp - \else - \badenverr - \fi -} - -% Evironment mismatch, #1 expected: -\def\badenverr{% - \errhelp = \EMsimple - \errmessage{This command can appear only \inenvironment\temp, - not \inenvironment\thisenv}% -} -\def\inenvironment#1{% - \ifx#1\empty - out of any environment% - \else - in environment \expandafter\string#1% - \fi -} - -% @end foo executes the definition of \Efoo. -% But first, it executes a specialized version of \checkenv -% -\parseargdef\end{% - \if 1\csname iscond.#1\endcsname - \else - % The general wording of \badenverr may not be ideal, but... --kasal, 06nov03 - \expandafter\checkenv\csname#1\endcsname - \csname E#1\endcsname - \endgroup - \fi -} - -\newhelp\EMsimple{Press RETURN to continue.} - - -%% Simple single-character @ commands - -% @@ prints an @ -% Kludge this until the fonts are right (grr). -\def\@{{\tt\char64}} - -% This is turned off because it was never documented -% and you can use @w{...} around a quote to suppress ligatures. -%% Define @` and @' to be the same as ` and ' -%% but suppressing ligatures. -%\def\`{{`}} -%\def\'{{'}} - -% Used to generate quoted braces. -\def\mylbrace {{\tt\char123}} -\def\myrbrace {{\tt\char125}} -\let\{=\mylbrace -\let\}=\myrbrace -\begingroup - % Definitions to produce \{ and \} commands for indices, - % and @{ and @} for the aux file. - \catcode`\{ = \other \catcode`\} = \other - \catcode`\[ = 1 \catcode`\] = 2 - \catcode`\! = 0 \catcode`\\ = \other - !gdef!lbracecmd[\{]% - !gdef!rbracecmd[\}]% - !gdef!lbraceatcmd[@{]% - !gdef!rbraceatcmd[@}]% -!endgroup - -% @comma{} to avoid , parsing problems. -\let\comma = , - -% Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent -% Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H. -\let\, = \c -\let\dotaccent = \. -\def\ringaccent#1{{\accent23 #1}} -\let\tieaccent = \t -\let\ubaraccent = \b -\let\udotaccent = \d - -% Other special characters: @questiondown @exclamdown @ordf @ordm -% Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss. -\def\questiondown{?`} -\def\exclamdown{!`} -\def\ordf{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{a}}} -\def\ordm{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{o}}} - -% Dotless i and dotless j, used for accents. -\def\imacro{i} -\def\jmacro{j} -\def\dotless#1{% - \def\temp{#1}% - \ifx\temp\imacro \ptexi - \else\ifx\temp\jmacro \j - \else \errmessage{@dotless can be used only with i or j}% - \fi\fi -} - -% The \TeX{} logo, as in plain, but resetting the spacing so that a -% period following counts as ending a sentence. (Idea found in latex.) -% -\def\TeX{T\kern-.1667em\lower.5ex\hbox{E}\kern-.125emX\spacefactor=3000 } - -% @LaTeX{} logo. Not quite the same results as the definition in -% latex.ltx, since we use a different font for the raised A; it's most -% convenient for us to use an explicitly smaller font, rather than using -% the \scriptstyle font (since we don't reset \scriptstyle and -% \scriptscriptstyle). -% -\def\LaTeX{% - L\kern-.36em - {\setbox0=\hbox{T}% - \vbox to \ht0{\hbox{\selectfonts\lllsize A}\vss}}% - \kern-.15em - \TeX -} - -% Be sure we're in horizontal mode when doing a tie, since we make space -% equivalent to this in @example-like environments. Otherwise, a space -% at the beginning of a line will start with \penalty -- and -% since \penalty is valid in vertical mode, we'd end up putting the -% penalty on the vertical list instead of in the new paragraph. -{\catcode`@ = 11 - % Avoid using \@M directly, because that causes trouble - % if the definition is written into an index file. - \global\let\tiepenalty = \@M - \gdef\tie{\leavevmode\penalty\tiepenalty\ } -} - -% @: forces normal size whitespace following. -\def\:{\spacefactor=1000 } - -% @* forces a line break. -\def\*{\hfil\break\hbox{}\ignorespaces} - -% @/ allows a line break. -\let\/=\allowbreak - -% @. is an end-of-sentence period. -\def\.{.\spacefactor=3000 } - -% @! is an end-of-sentence bang. -\def\!{!\spacefactor=3000 } - -% @? is an end-of-sentence query. -\def\?{?\spacefactor=3000 } - -% @w prevents a word break. Without the \leavevmode, @w at the -% beginning of a paragraph, when TeX is still in vertical mode, would -% produce a whole line of output instead of starting the paragraph. -\def\w#1{\leavevmode\hbox{#1}} - -% @group ... @end group forces ... to be all on one page, by enclosing -% it in a TeX vbox. We use \vtop instead of \vbox to construct the box -% to keep its height that of a normal line. According to the rules for -% \topskip (p.114 of the TeXbook), the glue inserted is -% max (\topskip - \ht (first item), 0). If that height is large, -% therefore, no glue is inserted, and the space between the headline and -% the text is small, which looks bad. -% -% Another complication is that the group might be very large. This can -% cause the glue on the previous page to be unduly stretched, because it -% does not have much material. In this case, it's better to add an -% explicit \vfill so that the extra space is at the bottom. The -% threshold for doing this is if the group is more than \vfilllimit -% percent of a page (\vfilllimit can be changed inside of @tex). -% -\newbox\groupbox -\def\vfilllimit{0.7} -% -\envdef\group{% - \ifnum\catcode`\^^M=\active \else - \errhelp = \groupinvalidhelp - \errmessage{@group invalid in context where filling is enabled}% - \fi - \startsavinginserts - % - \setbox\groupbox = \vtop\bgroup - % Do @comment since we are called inside an environment such as - % @example, where each end-of-line in the input causes an - % end-of-line in the output. We don't want the end-of-line after - % the `@group' to put extra space in the output. Since @group - % should appear on a line by itself (according to the Texinfo - % manual), we don't worry about eating any user text. - \comment -} -% -% The \vtop produces a box with normal height and large depth; thus, TeX puts -% \baselineskip glue before it, and (when the next line of text is done) -% \lineskip glue after it. Thus, space below is not quite equal to space -% above. But it's pretty close. -\def\Egroup{% - % To get correct interline space between the last line of the group - % and the first line afterwards, we have to propagate \prevdepth. - \endgraf % Not \par, as it may have been set to \lisppar. - \global\dimen1 = \prevdepth - \egroup % End the \vtop. - % \dimen0 is the vertical size of the group's box. - \dimen0 = \ht\groupbox \advance\dimen0 by \dp\groupbox - % \dimen2 is how much space is left on the page (more or less). - \dimen2 = \pageheight \advance\dimen2 by -\pagetotal - % if the group doesn't fit on the current page, and it's a big big - % group, force a page break. - \ifdim \dimen0 > \dimen2 - \ifdim \pagetotal < \vfilllimit\pageheight - \page - \fi - \fi - \box\groupbox - \prevdepth = \dimen1 - \checkinserts -} -% -% TeX puts in an \escapechar (i.e., `@') at the beginning of the help -% message, so this ends up printing `@group can only ...'. -% -\newhelp\groupinvalidhelp{% -group can only be used in environments such as @example,^^J% -where each line of input produces a line of output.} - -% @need space-in-mils -% forces a page break if there is not space-in-mils remaining. - -\newdimen\mil \mil=0.001in - -% Old definition--didn't work. -%\parseargdef\need{\par % -%% This method tries to make TeX break the page naturally -%% if the depth of the box does not fit. -%{\baselineskip=0pt% -%\vtop to #1\mil{\vfil}\kern -#1\mil\nobreak -%\prevdepth=-1000pt -%}} - -\parseargdef\need{% - % Ensure vertical mode, so we don't make a big box in the middle of a - % paragraph. - \par - % - % If the @need value is less than one line space, it's useless. - \dimen0 = #1\mil - \dimen2 = \ht\strutbox - \advance\dimen2 by \dp\strutbox - \ifdim\dimen0 > \dimen2 - % - % Do a \strut just to make the height of this box be normal, so the - % normal leading is inserted relative to the preceding line. - % And a page break here is fine. - \vtop to #1\mil{\strut\vfil}% - % - % TeX does not even consider page breaks if a penalty added to the - % main vertical list is 10000 or more. But in order to see if the - % empty box we just added fits on the page, we must make it consider - % page breaks. On the other hand, we don't want to actually break the - % page after the empty box. So we use a penalty of 9999. - % - % There is an extremely small chance that TeX will actually break the - % page at this \penalty, if there are no other feasible breakpoints in - % sight. (If the user is using lots of big @group commands, which - % almost-but-not-quite fill up a page, TeX will have a hard time doing - % good page breaking, for example.) However, I could not construct an - % example where a page broke at this \penalty; if it happens in a real - % document, then we can reconsider our strategy. - \penalty9999 - % - % Back up by the size of the box, whether we did a page break or not. - \kern -#1\mil - % - % Do not allow a page break right after this kern. - \nobreak - \fi -} - -% @br forces paragraph break (and is undocumented). - -\let\br = \par - -% @page forces the start of a new page. -% -\def\page{\par\vfill\supereject} - -% @exdent text.... -% outputs text on separate line in roman font, starting at standard page margin - -% This records the amount of indent in the innermost environment. -% That's how much \exdent should take out. -\newskip\exdentamount - -% This defn is used inside fill environments such as @defun. -\parseargdef\exdent{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break} - -% This defn is used inside nofill environments such as @example. -\parseargdef\nofillexdent{{\advance \leftskip by -\exdentamount - \leftline{\hskip\leftskip{\rm#1}}}} - -% @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current -% paragraph. For more general purposes, use the \margin insertion -% class. WHICH is `l' or `r'. -% -\newskip\inmarginspacing \inmarginspacing=1cm -\def\strutdepth{\dp\strutbox} -% -\def\doinmargin#1#2{\strut\vadjust{% - \nobreak - \kern-\strutdepth - \vtop to \strutdepth{% - \baselineskip=\strutdepth - \vss - % if you have multiple lines of stuff to put here, you'll need to - % make the vbox yourself of the appropriate size. - \ifx#1l% - \llap{\ignorespaces #2\hskip\inmarginspacing}% - \else - \rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}% - \fi - \null - }% -}} -\def\inleftmargin{\doinmargin l} -\def\inrightmargin{\doinmargin r} -% -% @inmargin{TEXT [, RIGHT-TEXT]} -% (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right; -% else use TEXT for both). -% -\def\inmargin#1{\parseinmargin #1,,\finish} -\def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing. - \setbox0 = \hbox{\ignorespaces #2}% - \ifdim\wd0 > 0pt - \def\lefttext{#1}% have both texts - \def\righttext{#2}% - \else - \def\lefttext{#1}% have only one text - \def\righttext{#1}% - \fi - % - \ifodd\pageno - \def\temp{\inrightmargin\righttext}% odd page -> outside is right margin - \else - \def\temp{\inleftmargin\lefttext}% - \fi - \temp -} - -% @include file insert text of that file as input. -% -\def\include{\parseargusing\filenamecatcodes\includezzz} -\def\includezzz#1{% - \pushthisfilestack - \def\thisfile{#1}% - {% - \makevalueexpandable - \def\temp{\input #1 }% - \expandafter - }\temp - \popthisfilestack -} -\def\filenamecatcodes{% - \catcode`\\=\other - \catcode`~=\other - \catcode`^=\other - \catcode`_=\other - \catcode`|=\other - \catcode`<=\other - \catcode`>=\other - \catcode`+=\other - \catcode`-=\other -} - -\def\pushthisfilestack{% - \expandafter\pushthisfilestackX\popthisfilestack\StackTerm -} -\def\pushthisfilestackX{% - \expandafter\pushthisfilestackY\thisfile\StackTerm -} -\def\pushthisfilestackY #1\StackTerm #2\StackTerm {% - \gdef\popthisfilestack{\gdef\thisfile{#1}\gdef\popthisfilestack{#2}}% -} - -\def\popthisfilestack{\errthisfilestackempty} -\def\errthisfilestackempty{\errmessage{Internal error: - the stack of filenames is empty.}} - -\def\thisfile{} - -% @center line -% outputs that line, centered. -% -\parseargdef\center{% - \ifhmode - \let\next\centerH - \else - \let\next\centerV - \fi - \next{\hfil \ignorespaces#1\unskip \hfil}% -} -\def\centerH#1{% - {% - \hfil\break - \advance\hsize by -\leftskip - \advance\hsize by -\rightskip - \line{#1}% - \break - }% -} -\def\centerV#1{\line{\kern\leftskip #1\kern\rightskip}} - -% @sp n outputs n lines of vertical space - -\parseargdef\sp{\vskip #1\baselineskip} - -% @comment ...line which is ignored... -% @c is the same as @comment -% @ignore ... @end ignore is another way to write a comment - -\def\comment{\begingroup \catcode`\^^M=\other% -\catcode`\@=\other \catcode`\{=\other \catcode`\}=\other% -\commentxxx} -{\catcode`\^^M=\other \gdef\commentxxx#1^^M{\endgroup}} - -\let\c=\comment - -% @paragraphindent NCHARS -% We'll use ems for NCHARS, close enough. -% NCHARS can also be the word `asis' or `none'. -% We cannot feasibly implement @paragraphindent asis, though. -% -\def\asisword{asis} % no translation, these are keywords -\def\noneword{none} -% -\parseargdef\paragraphindent{% - \def\temp{#1}% - \ifx\temp\asisword - \else - \ifx\temp\noneword - \defaultparindent = 0pt - \else - \defaultparindent = #1em - \fi - \fi - \parindent = \defaultparindent -} - -% @exampleindent NCHARS -% We'll use ems for NCHARS like @paragraphindent. -% It seems @exampleindent asis isn't necessary, but -% I preserve it to make it similar to @paragraphindent. -\parseargdef\exampleindent{% - \def\temp{#1}% - \ifx\temp\asisword - \else - \ifx\temp\noneword - \lispnarrowing = 0pt - \else - \lispnarrowing = #1em - \fi - \fi -} - -% @firstparagraphindent WORD -% If WORD is `none', then suppress indentation of the first paragraph -% after a section heading. If WORD is `insert', then do indent at such -% paragraphs. -% -% The paragraph indentation is suppressed or not by calling -% \suppressfirstparagraphindent, which the sectioning commands do. -% We switch the definition of this back and forth according to WORD. -% By default, we suppress indentation. -% -\def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent} -\newdimen\currentparindent -% -\def\insertword{insert} -% -\parseargdef\firstparagraphindent{% - \def\temp{#1}% - \ifx\temp\noneword - \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent - \else\ifx\temp\insertword - \let\suppressfirstparagraphindent = \relax - \else - \errhelp = \EMsimple - \errmessage{Unknown @firstparagraphindent option `\temp'}% - \fi\fi -} - -% Here is how we actually suppress indentation. Redefine \everypar to -% \kern backwards by \parindent, and then reset itself to empty. -% -% We also make \indent itself not actually do anything until the next -% paragraph. -% -\gdef\dosuppressfirstparagraphindent{% - \gdef\indent{% - \restorefirstparagraphindent - \indent - }% - \gdef\noindent{% - \restorefirstparagraphindent - \noindent - }% - \global\everypar = {% - \kern -\parindent - \restorefirstparagraphindent - }% -} - -\gdef\restorefirstparagraphindent{% - \global \let \indent = \ptexindent - \global \let \noindent = \ptexnoindent - \global \everypar = {}% -} - - -% @asis just yields its argument. Used with @table, for example. -% -\def\asis#1{#1} - -% @math outputs its argument in math mode. -% -% One complication: _ usually means subscripts, but it could also mean -% an actual _ character, as in @math{@var{some_variable} + 1}. So make -% _ active, and distinguish by seeing if the current family is \slfam, -% which is what @var uses. -{ - \catcode\underChar = \active - \gdef\mathunderscore{% - \catcode\underChar=\active - \def_{\ifnum\fam=\slfam \_\else\sb\fi}% - } -} -% Another complication: we want \\ (and @\) to output a \ character. -% FYI, plain.tex uses \\ as a temporary control sequence (why?), but -% this is not advertised and we don't care. Texinfo does not -% otherwise define @\. -% -% The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\. -\def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi} -% -\def\math{% - \tex - \mathunderscore - \let\\ = \mathbackslash - \mathactive - $\finishmath -} -\def\finishmath#1{#1$\endgroup} % Close the group opened by \tex. - -% Some active characters (such as <) are spaced differently in math. -% We have to reset their definitions in case the @math was an argument -% to a command which sets the catcodes (such as @item or @section). -% -{ - \catcode`^ = \active - \catcode`< = \active - \catcode`> = \active - \catcode`+ = \active - \gdef\mathactive{% - \let^ = \ptexhat - \let< = \ptexless - \let> = \ptexgtr - \let+ = \ptexplus - } -} - -% @bullet and @minus need the same treatment as @math, just above. -\def\bullet{$\ptexbullet$} -\def\minus{$-$} - -% @dots{} outputs an ellipsis using the current font. -% We do .5em per period so that it has the same spacing in a typewriter -% font as three actual period characters. -% -\def\dots{% - \leavevmode - \hbox to 1.5em{% - \hskip 0pt plus 0.25fil - .\hfil.\hfil.% - \hskip 0pt plus 0.5fil - }% -} - -% @enddots{} is an end-of-sentence ellipsis. -% -\def\enddots{% - \dots - \spacefactor=3000 -} - -% @comma{} is so commas can be inserted into text without messing up -% Texinfo's parsing. -% -\let\comma = , - -% @refill is a no-op. -\let\refill=\relax - -% If working on a large document in chapters, it is convenient to -% be able to disable indexing, cross-referencing, and contents, for test runs. -% This is done with @novalidate (before @setfilename). -% -\newif\iflinks \linkstrue % by default we want the aux files. -\let\novalidate = \linksfalse - -% @setfilename is done at the beginning of every texinfo file. -% So open here the files we need to have open while reading the input. -% This makes it possible to make a .fmt file for texinfo. -\def\setfilename{% - \iflinks - \tryauxfile - % Open the new aux file. TeX will close it automatically at exit. - \immediate\openout\auxfile=\jobname.aux - \fi % \openindices needs to do some work in any case. - \openindices - \fixbackslash % Turn off hack to swallow `\input texinfo'. - \global\let\setfilename=\comment % Ignore extra @setfilename cmds. - % - % If texinfo.cnf is present on the system, read it. - % Useful for site-wide @afourpaper, etc. - \openin 1 texinfo.cnf - \ifeof 1 \else \input texinfo.cnf \fi - \closein 1 - % - \comment % Ignore the actual filename. -} - -% Called from \setfilename. -% -\def\openindices{% - \newindex{cp}% - \newcodeindex{fn}% - \newcodeindex{vr}% - \newcodeindex{tp}% - \newcodeindex{ky}% - \newcodeindex{pg}% -} - -% @bye. -\outer\def\bye{\pagealignmacro\tracingstats=1\ptexend} - - -\message{pdf,} -% adobe `portable' document format -\newcount\tempnum -\newcount\lnkcount -\newtoks\filename -\newcount\filenamelength -\newcount\pgn -\newtoks\toksA -\newtoks\toksB -\newtoks\toksC -\newtoks\toksD -\newbox\boxA -\newcount\countA -\newif\ifpdf -\newif\ifpdfmakepagedest - -\ifx\pdfoutput\undefined - \pdffalse - \let\pdfmkdest = \gobble - \let\pdfurl = \gobble - \let\endlink = \relax - \let\linkcolor = \relax - \let\pdfmakeoutlines = \relax -\else - \pdftrue - \pdfoutput = 1 - \input pdfcolor - \pdfcatalog{/PageMode /UseOutlines}% - \def\dopdfimage#1#2#3{% - \def\imagewidth{#2}% - \def\imageheight{#3}% - % without \immediate, pdftex seg faults when the same image is - % included twice. (Version 3.14159-pre-1.0-unofficial-20010704.) - \ifnum\pdftexversion < 14 - \immediate\pdfimage - \else - \immediate\pdfximage - \fi - \ifx\empty\imagewidth\else width \imagewidth \fi - \ifx\empty\imageheight\else height \imageheight \fi - \ifnum\pdftexversion<13 - #1.pdf% - \else - {#1.pdf}% - \fi - \ifnum\pdftexversion < 14 \else - \pdfrefximage \pdflastximage - \fi} - \def\pdfmkdest#1{{% - % We have to set dummies so commands such as @code in a section title - % aren't expanded. - \atdummies - \normalturnoffactive - \pdfdest name{#1} xyz% - }} - \def\pdfmkpgn#1{#1} - \let\linkcolor = \Blue % was Cyan, but that seems light? - \def\endlink{\Black\pdfendlink} - % Adding outlines to PDF; macros for calculating structure of outlines - % come from Petr Olsak - \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0% - \else \csname#1\endcsname \fi} - \def\advancenumber#1{\tempnum=\expnumber{#1}\relax - \advance\tempnum by 1 - \expandafter\xdef\csname#1\endcsname{\the\tempnum}} - % - % #1 is the section text. #2 is the pdf expression for the number - % of subentries (or empty, for subsubsections). #3 is the node - % text, which might be empty if this toc entry had no - % corresponding node. #4 is the page number. - % - \def\dopdfoutline#1#2#3#4{% - % Generate a link to the node text if that exists; else, use the - % page number. We could generate a destination for the section - % text in the case where a section has no node, but it doesn't - % seem worthwhile, since most documents are normally structured. - \def\pdfoutlinedest{#3}% - \ifx\pdfoutlinedest\empty \def\pdfoutlinedest{#4}\fi - % - \pdfoutline goto name{\pdfmkpgn{\pdfoutlinedest}}#2{#1}% - } - % - \def\pdfmakeoutlines{% - \begingroup - % Thanh's hack / proper braces in bookmarks - \edef\mylbrace{\iftrue \string{\else}\fi}\let\{=\mylbrace - \edef\myrbrace{\iffalse{\else\string}\fi}\let\}=\myrbrace - % - % Read toc silently, to get counts of subentries for \pdfoutline. - \def\numchapentry##1##2##3##4{% - \def\thischapnum{##2}% - \let\thissecnum\empty - \let\thissubsecnum\empty - }% - \def\numsecentry##1##2##3##4{% - \advancenumber{chap\thischapnum}% - \def\thissecnum{##2}% - \let\thissubsecnum\empty - }% - \def\numsubsecentry##1##2##3##4{% - \advancenumber{sec\thissecnum}% - \def\thissubsecnum{##2}% - }% - \def\numsubsubsecentry##1##2##3##4{% - \advancenumber{subsec\thissubsecnum}% - }% - \let\thischapnum\empty - \let\thissecnum\empty - \let\thissubsecnum\empty - % - % use \def rather than \let here because we redefine \chapentry et - % al. a second time, below. - \def\appentry{\numchapentry}% - \def\appsecentry{\numsecentry}% - \def\appsubsecentry{\numsubsecentry}% - \def\appsubsubsecentry{\numsubsubsecentry}% - \def\unnchapentry{\numchapentry}% - \def\unnsecentry{\numsecentry}% - \def\unnsubsecentry{\numsubsecentry}% - \def\unnsubsubsecentry{\numsubsubsecentry}% - \input \jobname.toc - % - % Read toc second time, this time actually producing the outlines. - % The `-' means take the \expnumber as the absolute number of - % subentries, which we calculated on our first read of the .toc above. - % - % We use the node names as the destinations. - \def\numchapentry##1##2##3##4{% - \dopdfoutline{##1}{count-\expnumber{chap##2}}{##3}{##4}}% - \def\numsecentry##1##2##3##4{% - \dopdfoutline{##1}{count-\expnumber{sec##2}}{##3}{##4}}% - \def\numsubsecentry##1##2##3##4{% - \dopdfoutline{##1}{count-\expnumber{subsec##2}}{##3}{##4}}% - \def\numsubsubsecentry##1##2##3##4{% count is always zero - \dopdfoutline{##1}{}{##3}{##4}}% - % - % Make special characters normal for writing to the pdf file. - \indexnofonts - \turnoffactive - \input \jobname.toc - \endgroup - } - % - \def\makelinks #1,{% - \def\params{#1}\def\E{END}% - \ifx\params\E - \let\nextmakelinks=\relax - \else - \let\nextmakelinks=\makelinks - \ifnum\lnkcount>0,\fi - \picknum{#1}% - \startlink attr{/Border [0 0 0]} - goto name{\pdfmkpgn{\the\pgn}}% - \linkcolor #1% - \advance\lnkcount by 1% - \endlink - \fi - \nextmakelinks - } - \def\picknum#1{\expandafter\pn#1} - \def\pn#1{% - \def\p{#1}% - \ifx\p\lbrace - \let\nextpn=\ppn - \else - \let\nextpn=\ppnn - \def\first{#1} - \fi - \nextpn - } - \def\ppn#1{\pgn=#1\gobble} - \def\ppnn{\pgn=\first} - \def\pdfmklnk#1{\lnkcount=0\makelinks #1,END,} - \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks} - \def\skipspaces#1{\def\PP{#1}\def\D{|}% - \ifx\PP\D\let\nextsp\relax - \else\let\nextsp\skipspaces - \ifx\p\space\else\addtokens{\filename}{\PP}% - \advance\filenamelength by 1 - \fi - \fi - \nextsp} - \def\getfilename#1{\filenamelength=0\expandafter\skipspaces#1|\relax} - \ifnum\pdftexversion < 14 - \let \startlink \pdfannotlink - \else - \let \startlink \pdfstartlink - \fi - \def\pdfurl#1{% - \begingroup - \normalturnoffactive\def\@{@}% - \makevalueexpandable - \leavevmode\Red - \startlink attr{/Border [0 0 0]}% - user{/Subtype /Link /A << /S /URI /URI (#1) >>}% - % #1 - \endgroup} - \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}} - \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks} - \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks} - \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}} - \def\maketoks{% - \expandafter\poptoks\the\toksA|ENDTOKS| - \ifx\first0\adn0 - \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3 - \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6 - \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9 - \else - \ifnum0=\countA\else\makelink\fi - \ifx\first.\let\next=\done\else - \let\next=\maketoks - \addtokens{\toksB}{\the\toksD} - \ifx\first,\addtokens{\toksB}{\space}\fi - \fi - \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi - \next} - \def\makelink{\addtokens{\toksB}% - {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0} - \def\pdflink#1{% - \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}} - \linkcolor #1\endlink} - \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st} -\fi % \ifx\pdfoutput - - -\message{fonts,} - -% Change the current font style to #1, remembering it in \curfontstyle. -% For now, we do not accumulate font styles: @b{@i{foo}} prints foo in -% italics, not bold italics. -% -\def\setfontstyle#1{% - \def\curfontstyle{#1}% not as a control sequence, because we are \edef'd. - \csname ten#1\endcsname % change the current font -} - -% Select #1 fonts with the current style. -% -\def\selectfonts#1{\csname #1fonts\endcsname \csname\curfontstyle\endcsname} - -\def\rm{\fam=0 \setfontstyle{rm}} -\def\it{\fam=\itfam \setfontstyle{it}} -\def\sl{\fam=\slfam \setfontstyle{sl}} -\def\bf{\fam=\bffam \setfontstyle{bf}} -\def\tt{\fam=\ttfam \setfontstyle{tt}} - -% Texinfo sort of supports the sans serif font style, which plain TeX does not. -% So we set up a \sf. -\newfam\sffam -\def\sf{\fam=\sffam \setfontstyle{sf}} -\let\li = \sf % Sometimes we call it \li, not \sf. - -% We don't need math for this font style. -\def\ttsl{\setfontstyle{ttsl}} - -% Default leading. -\newdimen\textleading \textleading = 13.2pt - -% Set the baselineskip to #1, and the lineskip and strut size -% correspondingly. There is no deep meaning behind these magic numbers -% used as factors; they just match (closely enough) what Knuth defined. -% -\def\lineskipfactor{.08333} -\def\strutheightpercent{.70833} -\def\strutdepthpercent {.29167} -% -\def\setleading#1{% - \normalbaselineskip = #1\relax - \normallineskip = \lineskipfactor\normalbaselineskip - \normalbaselines - \setbox\strutbox =\hbox{% - \vrule width0pt height\strutheightpercent\baselineskip - depth \strutdepthpercent \baselineskip - }% -} - -% Set the font macro #1 to the font named #2, adding on the -% specified font prefix (normally `cm'). -% #3 is the font's design size, #4 is a scale factor -\def\setfont#1#2#3#4{\font#1=\fontprefix#2#3 scaled #4} - -% Use cm as the default font prefix. -% To specify the font prefix, you must define \fontprefix -% before you read in texinfo.tex. -\ifx\fontprefix\undefined -\def\fontprefix{cm} -\fi -% Support font families that don't use the same naming scheme as CM. -\def\rmshape{r} -\def\rmbshape{bx} %where the normal face is bold -\def\bfshape{b} -\def\bxshape{bx} -\def\ttshape{tt} -\def\ttbshape{tt} -\def\ttslshape{sltt} -\def\itshape{ti} -\def\itbshape{bxti} -\def\slshape{sl} -\def\slbshape{bxsl} -\def\sfshape{ss} -\def\sfbshape{ss} -\def\scshape{csc} -\def\scbshape{csc} - -% Text fonts (11.2pt, magstep1). -\newcount\mainmagstep -\ifx\bigger\relax - % not really supported. - \mainmagstep=\magstep1 - \setfont\textrm\rmshape{12}{1000} - \setfont\texttt\ttshape{12}{1000} -\else - \mainmagstep=\magstephalf - \setfont\textrm\rmshape{10}{\mainmagstep} - \setfont\texttt\ttshape{10}{\mainmagstep} -\fi -\setfont\textbf\bfshape{10}{\mainmagstep} -\setfont\textit\itshape{10}{\mainmagstep} -\setfont\textsl\slshape{10}{\mainmagstep} -\setfont\textsf\sfshape{10}{\mainmagstep} -\setfont\textsc\scshape{10}{\mainmagstep} -\setfont\textttsl\ttslshape{10}{\mainmagstep} -\font\texti=cmmi10 scaled \mainmagstep -\font\textsy=cmsy10 scaled \mainmagstep - -% A few fonts for @defun names and args. -\setfont\defbf\bfshape{10}{\magstep1} -\setfont\deftt\ttshape{10}{\magstep1} -\setfont\defttsl\ttslshape{10}{\magstep1} -\def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf} - -% Fonts for indices, footnotes, small examples (9pt). -\setfont\smallrm\rmshape{9}{1000} -\setfont\smalltt\ttshape{9}{1000} -\setfont\smallbf\bfshape{10}{900} -\setfont\smallit\itshape{9}{1000} -\setfont\smallsl\slshape{9}{1000} -\setfont\smallsf\sfshape{9}{1000} -\setfont\smallsc\scshape{10}{900} -\setfont\smallttsl\ttslshape{10}{900} -\font\smalli=cmmi9 -\font\smallsy=cmsy9 - -% Fonts for small examples (8pt). -\setfont\smallerrm\rmshape{8}{1000} -\setfont\smallertt\ttshape{8}{1000} -\setfont\smallerbf\bfshape{10}{800} -\setfont\smallerit\itshape{8}{1000} -\setfont\smallersl\slshape{8}{1000} -\setfont\smallersf\sfshape{8}{1000} -\setfont\smallersc\scshape{10}{800} -\setfont\smallerttsl\ttslshape{10}{800} -\font\smalleri=cmmi8 -\font\smallersy=cmsy8 - -% Fonts for title page (20.4pt): -\setfont\titlerm\rmbshape{12}{\magstep3} -\setfont\titleit\itbshape{10}{\magstep4} -\setfont\titlesl\slbshape{10}{\magstep4} -\setfont\titlett\ttbshape{12}{\magstep3} -\setfont\titlettsl\ttslshape{10}{\magstep4} -\setfont\titlesf\sfbshape{17}{\magstep1} -\let\titlebf=\titlerm -\setfont\titlesc\scbshape{10}{\magstep4} -\font\titlei=cmmi12 scaled \magstep3 -\font\titlesy=cmsy10 scaled \magstep4 -\def\authorrm{\secrm} -\def\authortt{\sectt} - -% Chapter (and unnumbered) fonts (17.28pt). -\setfont\chaprm\rmbshape{12}{\magstep2} -\setfont\chapit\itbshape{10}{\magstep3} -\setfont\chapsl\slbshape{10}{\magstep3} -\setfont\chaptt\ttbshape{12}{\magstep2} -\setfont\chapttsl\ttslshape{10}{\magstep3} -\setfont\chapsf\sfbshape{17}{1000} -\let\chapbf=\chaprm -\setfont\chapsc\scbshape{10}{\magstep3} -\font\chapi=cmmi12 scaled \magstep2 -\font\chapsy=cmsy10 scaled \magstep3 - -% Section fonts (14.4pt). -\setfont\secrm\rmbshape{12}{\magstep1} -\setfont\secit\itbshape{10}{\magstep2} -\setfont\secsl\slbshape{10}{\magstep2} -\setfont\sectt\ttbshape{12}{\magstep1} -\setfont\secttsl\ttslshape{10}{\magstep2} -\setfont\secsf\sfbshape{12}{\magstep1} -\let\secbf\secrm -\setfont\secsc\scbshape{10}{\magstep2} -\font\seci=cmmi12 scaled \magstep1 -\font\secsy=cmsy10 scaled \magstep2 - -% Subsection fonts (13.15pt). -\setfont\ssecrm\rmbshape{12}{\magstephalf} -\setfont\ssecit\itbshape{10}{1315} -\setfont\ssecsl\slbshape{10}{1315} -\setfont\ssectt\ttbshape{12}{\magstephalf} -\setfont\ssecttsl\ttslshape{10}{1315} -\setfont\ssecsf\sfbshape{12}{\magstephalf} -\let\ssecbf\ssecrm -\setfont\ssecsc\scbshape{10}{1315} -\font\sseci=cmmi12 scaled \magstephalf -\font\ssecsy=cmsy10 scaled 1315 - -% Reduced fonts for @acro in text (10pt). -\setfont\reducedrm\rmshape{10}{1000} -\setfont\reducedtt\ttshape{10}{1000} -\setfont\reducedbf\bfshape{10}{1000} -\setfont\reducedit\itshape{10}{1000} -\setfont\reducedsl\slshape{10}{1000} -\setfont\reducedsf\sfshape{10}{1000} -\setfont\reducedsc\scshape{10}{1000} -\setfont\reducedttsl\ttslshape{10}{1000} -\font\reducedi=cmmi10 -\font\reducedsy=cmsy10 - -% In order for the font changes to affect most math symbols and letters, -% we have to define the \textfont of the standard families. Since -% texinfo doesn't allow for producing subscripts and superscripts except -% in the main text, we don't bother to reset \scriptfont and -% \scriptscriptfont (which would also require loading a lot more fonts). -% -\def\resetmathfonts{% - \textfont0=\tenrm \textfont1=\teni \textfont2=\tensy - \textfont\itfam=\tenit \textfont\slfam=\tensl \textfont\bffam=\tenbf - \textfont\ttfam=\tentt \textfont\sffam=\tensf -} - -% The font-changing commands redefine the meanings of \tenSTYLE, instead -% of just \STYLE. We do this because \STYLE needs to also set the -% current \fam for math mode. Our \STYLE (e.g., \rm) commands hardwire -% \tenSTYLE to set the current font. -% -% Each font-changing command also sets the names \lsize (one size lower) -% and \lllsize (three sizes lower). These relative commands are used in -% the LaTeX logo and acronyms. -% -% This all needs generalizing, badly. -% -\def\textfonts{% - \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl - \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc - \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy - \let\tenttsl=\textttsl - \def\lsize{reduced}\def\lllsize{smaller}% - \resetmathfonts \setleading{\textleading}} -\def\titlefonts{% - \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl - \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc - \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy - \let\tenttsl=\titlettsl - \def\lsize{chap}\def\lllsize{subsec}% - \resetmathfonts \setleading{25pt}} -\def\titlefont#1{{\titlefonts\rm #1}} -\def\chapfonts{% - \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl - \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc - \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy \let\tenttsl=\chapttsl - \def\lsize{sec}\def\lllsize{text}% - \resetmathfonts \setleading{19pt}} -\def\secfonts{% - \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl - \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc - \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy - \let\tenttsl=\secttsl - \def\lsize{subsec}\def\lllsize{reduced}% - \resetmathfonts \setleading{16pt}} -\def\subsecfonts{% - \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl - \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc - \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy - \let\tenttsl=\ssecttsl - \def\lsize{text}\def\lllsize{small}% - \resetmathfonts \setleading{15pt}} -\let\subsubsecfonts = \subsecfonts -\def\reducedfonts{% - \let\tenrm=\reducedrm \let\tenit=\reducedit \let\tensl=\reducedsl - \let\tenbf=\reducedbf \let\tentt=\reducedtt \let\reducedcaps=\reducedsc - \let\tensf=\reducedsf \let\teni=\reducedi \let\tensy=\reducedsy - \let\tenttsl=\reducedttsl - \def\lsize{small}\def\lllsize{smaller}% - \resetmathfonts \setleading{10.5pt}} -\def\smallfonts{% - \let\tenrm=\smallrm \let\tenit=\smallit \let\tensl=\smallsl - \let\tenbf=\smallbf \let\tentt=\smalltt \let\smallcaps=\smallsc - \let\tensf=\smallsf \let\teni=\smalli \let\tensy=\smallsy - \let\tenttsl=\smallttsl - \def\lsize{smaller}\def\lllsize{smaller}% - \resetmathfonts \setleading{10.5pt}} -\def\smallerfonts{% - \let\tenrm=\smallerrm \let\tenit=\smallerit \let\tensl=\smallersl - \let\tenbf=\smallerbf \let\tentt=\smallertt \let\smallcaps=\smallersc - \let\tensf=\smallersf \let\teni=\smalleri \let\tensy=\smallersy - \let\tenttsl=\smallerttsl - \def\lsize{smaller}\def\lllsize{smaller}% - \resetmathfonts \setleading{9.5pt}} - -% Set the fonts to use with the @small... environments. -\let\smallexamplefonts = \smallfonts - -% About \smallexamplefonts. If we use \smallfonts (9pt), @smallexample -% can fit this many characters: -% 8.5x11=86 smallbook=72 a4=90 a5=69 -% If we use \scriptfonts (8pt), then we can fit this many characters: -% 8.5x11=90+ smallbook=80 a4=90+ a5=77 -% For me, subjectively, the few extra characters that fit aren't worth -% the additional smallness of 8pt. So I'm making the default 9pt. -% -% By the way, for comparison, here's what fits with @example (10pt): -% 8.5x11=71 smallbook=60 a4=75 a5=58 -% -% I wish the USA used A4 paper. -% --karl, 24jan03. - - -% Set up the default fonts, so we can use them for creating boxes. -% -\textfonts \rm - -% Define these so they can be easily changed for other fonts. -\def\angleleft{$\langle$} -\def\angleright{$\rangle$} - -% Count depth in font-changes, for error checks -\newcount\fontdepth \fontdepth=0 - -% Fonts for short table of contents. -\setfont\shortcontrm\rmshape{12}{1000} -\setfont\shortcontbf\bfshape{10}{\magstep1} % no cmb12 -\setfont\shortcontsl\slshape{12}{1000} -\setfont\shortconttt\ttshape{12}{1000} - -%% Add scribe-like font environments, plus @l for inline lisp (usually sans -%% serif) and @ii for TeX italic - -% \smartitalic{ARG} outputs arg in italics, followed by an italic correction -% unless the following character is such as not to need one. -\def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else - \ptexslash\fi\fi\fi} -\def\smartslanted#1{{\ifusingtt\ttsl\sl #1}\futurelet\next\smartitalicx} -\def\smartitalic#1{{\ifusingtt\ttsl\it #1}\futurelet\next\smartitalicx} - -% like \smartslanted except unconditionally uses \ttsl. -% @var is set to this for defun arguments. -\def\ttslanted#1{{\ttsl #1}\futurelet\next\smartitalicx} - -% like \smartslanted except unconditionally use \sl. We never want -% ttsl for book titles, do we? -\def\cite#1{{\sl #1}\futurelet\next\smartitalicx} - -\let\i=\smartitalic -\let\var=\smartslanted -\let\dfn=\smartslanted -\let\emph=\smartitalic - -\def\b#1{{\bf #1}} -\let\strong=\b - -% We can't just use \exhyphenpenalty, because that only has effect at -% the end of a paragraph. Restore normal hyphenation at the end of the -% group within which \nohyphenation is presumably called. -% -\def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation} -\def\restorehyphenation{\hyphenchar\font = `- } - -% Set sfcode to normal for the chars that usually have another value. -% Can't use plain's \frenchspacing because it uses the `\x notation, and -% sometimes \x has an active definition that messes things up. -% -\catcode`@=11 - \def\frenchspacing{% - \sfcode\dotChar =\@m \sfcode\questChar=\@m \sfcode\exclamChar=\@m - \sfcode\colonChar=\@m \sfcode\semiChar =\@m \sfcode\commaChar =\@m - } -\catcode`@=\other - -\def\t#1{% - {\tt \rawbackslash \frenchspacing #1}% - \null -} -\def\samp#1{`\tclose{#1}'\null} -\setfont\keyrm\rmshape{8}{1000} -\font\keysy=cmsy9 -\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{% - \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{% - \vbox{\hrule\kern-0.4pt - \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}% - \kern-0.4pt\hrule}% - \kern-.06em\raise0.4pt\hbox{\angleright}}}} -% The old definition, with no lozenge: -%\def\key #1{{\ttsl \nohyphenation \uppercase{#1}}\null} -\def\ctrl #1{{\tt \rawbackslash \hat}#1} - -% @file, @option are the same as @samp. -\let\file=\samp -\let\option=\samp - -% @code is a modification of @t, -% which makes spaces the same size as normal in the surrounding text. -\def\tclose#1{% - {% - % Change normal interword space to be same as for the current font. - \spaceskip = \fontdimen2\font - % - % Switch to typewriter. - \tt - % - % But `\ ' produces the large typewriter interword space. - \def\ {{\spaceskip = 0pt{} }}% - % - % Turn off hyphenation. - \nohyphenation - % - \rawbackslash - \frenchspacing - #1% - }% - \null -} - -% We *must* turn on hyphenation at `-' and `_' in @code. -% Otherwise, it is too hard to avoid overfull hboxes -% in the Emacs manual, the Library manual, etc. - -% Unfortunately, TeX uses one parameter (\hyphenchar) to control -% both hyphenation at - and hyphenation within words. -% We must therefore turn them both off (\tclose does that) -% and arrange explicitly to hyphenate at a dash. -% -- rms. -{ - \catcode`\-=\active - \catcode`\_=\active - % - \global\def\code{\begingroup - \catcode`\-=\active \let-\codedash - \catcode`\_=\active \let_\codeunder - \codex - } -} - -\def\realdash{-} -\def\codedash{-\discretionary{}{}{}} -\def\codeunder{% - % this is all so @math{@code{var_name}+1} can work. In math mode, _ - % is "active" (mathcode"8000) and \normalunderscore (or \char95, etc.) - % will therefore expand the active definition of _, which is us - % (inside @code that is), therefore an endless loop. - \ifusingtt{\ifmmode - \mathchar"075F % class 0=ordinary, family 7=ttfam, pos 0x5F=_. - \else\normalunderscore \fi - \discretionary{}{}{}}% - {\_}% -} -\def\codex #1{\tclose{#1}\endgroup} - -% @kbd is like @code, except that if the argument is just one @key command, -% then @kbd has no effect. - -% @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always), -% `example' (@kbd uses ttsl only inside of @example and friends), -% or `code' (@kbd uses normal tty font always). -\parseargdef\kbdinputstyle{% - \def\arg{#1}% - \ifx\arg\worddistinct - \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}% - \else\ifx\arg\wordexample - \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}% - \else\ifx\arg\wordcode - \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}% - \else - \errhelp = \EMsimple - \errmessage{Unknown @kbdinputstyle option `\arg'}% - \fi\fi\fi -} -\def\worddistinct{distinct} -\def\wordexample{example} -\def\wordcode{code} - -% Default is `distinct.' -\kbdinputstyle distinct - -\def\xkey{\key} -\def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}% -\ifx\one\xkey\ifx\threex\three \key{#2}% -\else{\tclose{\kbdfont\look}}\fi -\else{\tclose{\kbdfont\look}}\fi} - -% For @url, @env, @command quotes seem unnecessary, so use \code. -\let\url=\code -\let\env=\code -\let\command=\code - -% @uref (abbreviation for `urlref') takes an optional (comma-separated) -% second argument specifying the text to display and an optional third -% arg as text to display instead of (rather than in addition to) the url -% itself. First (mandatory) arg is the url. Perhaps eventually put in -% a hypertex \special here. -% -\def\uref#1{\douref #1,,,\finish} -\def\douref#1,#2,#3,#4\finish{\begingroup - \unsepspaces - \pdfurl{#1}% - \setbox0 = \hbox{\ignorespaces #3}% - \ifdim\wd0 > 0pt - \unhbox0 % third arg given, show only that - \else - \setbox0 = \hbox{\ignorespaces #2}% - \ifdim\wd0 > 0pt - \ifpdf - \unhbox0 % PDF: 2nd arg given, show only it - \else - \unhbox0\ (\code{#1})% DVI: 2nd arg given, show both it and url - \fi - \else - \code{#1}% only url given, so show it - \fi - \fi - \endlink -\endgroup} - -% rms does not like angle brackets --karl, 17may97. -% So now @email is just like @uref, unless we are pdf. -% -%\def\email#1{\angleleft{\tt #1}\angleright} -\ifpdf - \def\email#1{\doemail#1,,\finish} - \def\doemail#1,#2,#3\finish{\begingroup - \unsepspaces - \pdfurl{mailto:#1}% - \setbox0 = \hbox{\ignorespaces #2}% - \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi - \endlink - \endgroup} -\else - \let\email=\uref -\fi - -% Check if we are currently using a typewriter font. Since all the -% Computer Modern typewriter fonts have zero interword stretch (and -% shrink), and it is reasonable to expect all typewriter fonts to have -% this property, we can check that font parameter. -% -\def\ifmonospace{\ifdim\fontdimen3\font=0pt } - -% Typeset a dimension, e.g., `in' or `pt'. The only reason for the -% argument is to make the input look right: @dmn{pt} instead of @dmn{}pt. -% -\def\dmn#1{\thinspace #1} - -\def\kbd#1{\def\look{#1}\expandafter\kbdfoo\look??\par} - -% @l was never documented to mean ``switch to the Lisp font'', -% and it is not used as such in any manual I can find. We need it for -% Polish suppressed-l. --karl, 22sep96. -%\def\l#1{{\li #1}\null} - -% Explicit font changes: @r, @sc, undocumented @ii. -\def\r#1{{\rm #1}} % roman font -\def\sc#1{{\smallcaps#1}} % smallcaps font -\def\ii#1{{\it #1}} % italic font - -\def\acronym#1{\doacronym #1,,\finish} -\def\doacronym#1,#2,#3\finish{% - {\selectfonts\lsize #1}% - \def\temp{#2}% - \ifx\temp\empty \else - \space ({\unsepspaces \ignorespaces \temp \unskip})% - \fi -} - -% @pounds{} is a sterling sign, which is in the CM italic font. -% -\def\pounds{{\it\$}} - -% @registeredsymbol - R in a circle. The font for the R should really -% be smaller yet, but lllsize is the best we can do for now. -% Adapted from the plain.tex definition of \copyright. -% -\def\registeredsymbol{% - $^{{\ooalign{\hfil\raise.07ex\hbox{\selectfonts\lllsize R}% - \hfil\crcr\Orb}}% - }$% -} - - -\message{page headings,} - -\newskip\titlepagetopglue \titlepagetopglue = 1.5in -\newskip\titlepagebottomglue \titlepagebottomglue = 2pc - -% First the title page. Must do @settitle before @titlepage. -\newif\ifseenauthor -\newif\iffinishedtitlepage - -% Do an implicit @contents or @shortcontents after @end titlepage if the -% user says @setcontentsaftertitlepage or @setshortcontentsaftertitlepage. -% -\newif\ifsetcontentsaftertitlepage - \let\setcontentsaftertitlepage = \setcontentsaftertitlepagetrue -\newif\ifsetshortcontentsaftertitlepage - \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue - -\parseargdef\shorttitlepage{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}% - \endgroup\page\hbox{}\page} - -\envdef\titlepage{% - % Open one extra group, as we want to close it in the middle of \Etitlepage. - \begingroup - \parindent=0pt \textfonts - % Leave some space at the very top of the page. - \vglue\titlepagetopglue - % No rule at page bottom unless we print one at the top with @title. - \finishedtitlepagetrue - % - % Most title ``pages'' are actually two pages long, with space - % at the top of the second. We don't want the ragged left on the second. - \let\oldpage = \page - \def\page{% - \iffinishedtitlepage\else - \finishtitlepage - \fi - \let\page = \oldpage - \page - \null - }% -} - -\def\Etitlepage{% - \iffinishedtitlepage\else - \finishtitlepage - \fi - % It is important to do the page break before ending the group, - % because the headline and footline are only empty inside the group. - % If we use the new definition of \page, we always get a blank page - % after the title page, which we certainly don't want. - \oldpage - \endgroup - % - % Need this before the \...aftertitlepage checks so that if they are - % in effect the toc pages will come out with page numbers. - \HEADINGSon - % - % If they want short, they certainly want long too. - \ifsetshortcontentsaftertitlepage - \shortcontents - \contents - \global\let\shortcontents = \relax - \global\let\contents = \relax - \fi - % - \ifsetcontentsaftertitlepage - \contents - \global\let\contents = \relax - \global\let\shortcontents = \relax - \fi -} - -\def\finishtitlepage{% - \vskip4pt \hrule height 2pt width \hsize - \vskip\titlepagebottomglue - \finishedtitlepagetrue -} - -%%% Macros to be used within @titlepage: - -\let\subtitlerm=\tenrm -\def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines} - -\def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines - \let\tt=\authortt} - -\parseargdef\title{% - \checkenv\titlepage - \leftline{\titlefonts\rm #1} - % print a rule at the page bottom also. - \finishedtitlepagefalse - \vskip4pt \hrule height 4pt width \hsize \vskip4pt -} - -\parseargdef\subtitle{% - \checkenv\titlepage - {\subtitlefont \rightline{#1}}% -} - -% @author should come last, but may come many times. -\parseargdef\author{% - \def\temp{\quotation}% - \ifx\thisenv\temp - This edition of the manual is dedicated to Karl Berry who should - really make affiliations work. - \else - \checkenv\titlepage - \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi - {\authorfont \leftline{#1}}% - \fi -} - - -%%% Set up page headings and footings. - -\let\thispage=\folio - -\newtoks\evenheadline % headline on even pages -\newtoks\oddheadline % headline on odd pages -\newtoks\evenfootline % footline on even pages -\newtoks\oddfootline % footline on odd pages - -% Now make TeX use those variables -\headline={{\textfonts\rm \ifodd\pageno \the\oddheadline - \else \the\evenheadline \fi}} -\footline={{\textfonts\rm \ifodd\pageno \the\oddfootline - \else \the\evenfootline \fi}\HEADINGShook} -\let\HEADINGShook=\relax - -% Commands to set those variables. -% For example, this is what @headings on does -% @evenheading @thistitle|@thispage|@thischapter -% @oddheading @thischapter|@thispage|@thistitle -% @evenfooting @thisfile|| -% @oddfooting ||@thisfile - - -\def\evenheading{\parsearg\evenheadingxxx} -\def\evenheadingxxx #1{\evenheadingyyy #1\|\|\|\|\finish} -\def\evenheadingyyy #1\|#2\|#3\|#4\finish{% -\global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} - -\def\oddheading{\parsearg\oddheadingxxx} -\def\oddheadingxxx #1{\oddheadingyyy #1\|\|\|\|\finish} -\def\oddheadingyyy #1\|#2\|#3\|#4\finish{% -\global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} - -\parseargdef\everyheading{\oddheadingxxx{#1}\evenheadingxxx{#1}}% - -\def\evenfooting{\parsearg\evenfootingxxx} -\def\evenfootingxxx #1{\evenfootingyyy #1\|\|\|\|\finish} -\def\evenfootingyyy #1\|#2\|#3\|#4\finish{% -\global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} - -\def\oddfooting{\parsearg\oddfootingxxx} -\def\oddfootingxxx #1{\oddfootingyyy #1\|\|\|\|\finish} -\def\oddfootingyyy #1\|#2\|#3\|#4\finish{% - \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}% - % - % Leave some space for the footline. Hopefully ok to assume - % @evenfooting will not be used by itself. - \global\advance\pageheight by -\baselineskip - \global\advance\vsize by -\baselineskip -} - -\parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}} - - -% @headings double turns headings on for double-sided printing. -% @headings single turns headings on for single-sided printing. -% @headings off turns them off. -% @headings on same as @headings double, retained for compatibility. -% @headings after turns on double-sided headings after this page. -% @headings doubleafter turns on double-sided headings after this page. -% @headings singleafter turns on single-sided headings after this page. -% By default, they are off at the start of a document, -% and turned `on' after @end titlepage. - -\def\headings #1 {\csname HEADINGS#1\endcsname} - -\def\HEADINGSoff{% -\global\evenheadline={\hfil} \global\evenfootline={\hfil} -\global\oddheadline={\hfil} \global\oddfootline={\hfil}} -\HEADINGSoff -% When we turn headings on, set the page number to 1. -% For double-sided printing, put current file name in lower left corner, -% chapter name on inside top of right hand pages, document -% title on inside top of left hand pages, and page numbers on outside top -% edge of all pages. -\def\HEADINGSdouble{% -\global\pageno=1 -\global\evenfootline={\hfil} -\global\oddfootline={\hfil} -\global\evenheadline={\line{\folio\hfil\thistitle}} -\global\oddheadline={\line{\thischapter\hfil\folio}} -\global\let\contentsalignmacro = \chapoddpage -} -\let\contentsalignmacro = \chappager - -% For single-sided printing, chapter title goes across top left of page, -% page number on top right. -\def\HEADINGSsingle{% -\global\pageno=1 -\global\evenfootline={\hfil} -\global\oddfootline={\hfil} -\global\evenheadline={\line{\thischapter\hfil\folio}} -\global\oddheadline={\line{\thischapter\hfil\folio}} -\global\let\contentsalignmacro = \chappager -} -\def\HEADINGSon{\HEADINGSdouble} - -\def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex} -\let\HEADINGSdoubleafter=\HEADINGSafter -\def\HEADINGSdoublex{% -\global\evenfootline={\hfil} -\global\oddfootline={\hfil} -\global\evenheadline={\line{\folio\hfil\thistitle}} -\global\oddheadline={\line{\thischapter\hfil\folio}} -\global\let\contentsalignmacro = \chapoddpage -} - -\def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex} -\def\HEADINGSsinglex{% -\global\evenfootline={\hfil} -\global\oddfootline={\hfil} -\global\evenheadline={\line{\thischapter\hfil\folio}} -\global\oddheadline={\line{\thischapter\hfil\folio}} -\global\let\contentsalignmacro = \chappager -} - -% Subroutines used in generating headings -% This produces Day Month Year style of output. -% Only define if not already defined, in case a txi-??.tex file has set -% up a different format (e.g., txi-cs.tex does this). -\ifx\today\undefined -\def\today{% - \number\day\space - \ifcase\month - \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr - \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug - \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec - \fi - \space\number\year} -\fi - -% @settitle line... specifies the title of the document, for headings. -% It generates no output of its own. -\def\thistitle{\putwordNoTitle} -\def\settitle{\parsearg{\gdef\thistitle}} - - -\message{tables,} -% Tables -- @table, @ftable, @vtable, @item(x). - -% default indentation of table text -\newdimen\tableindent \tableindent=.8in -% default indentation of @itemize and @enumerate text -\newdimen\itemindent \itemindent=.3in -% margin between end of table item and start of table text. -\newdimen\itemmargin \itemmargin=.1in - -% used internally for \itemindent minus \itemmargin -\newdimen\itemmax - -% Note @table, @ftable, and @vtable define @item, @itemx, etc., with -% these defs. -% They also define \itemindex -% to index the item name in whatever manner is desired (perhaps none). - -\newif\ifitemxneedsnegativevskip - -\def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi} - -\def\internalBitem{\smallbreak \parsearg\itemzzz} -\def\internalBitemx{\itemxpar \parsearg\itemzzz} - -\def\itemzzz #1{\begingroup % - \advance\hsize by -\rightskip - \advance\hsize by -\tableindent - \setbox0=\hbox{\itemindicate{#1}}% - \itemindex{#1}% - \nobreak % This prevents a break before @itemx. - % - % If the item text does not fit in the space we have, put it on a line - % by itself, and do not allow a page break either before or after that - % line. We do not start a paragraph here because then if the next - % command is, e.g., @kindex, the whatsit would get put into the - % horizontal list on a line by itself, resulting in extra blank space. - \ifdim \wd0>\itemmax - % - % Make this a paragraph so we get the \parskip glue and wrapping, - % but leave it ragged-right. - \begingroup - \advance\leftskip by-\tableindent - \advance\hsize by\tableindent - \advance\rightskip by0pt plus1fil - \leavevmode\unhbox0\par - \endgroup - % - % We're going to be starting a paragraph, but we don't want the - % \parskip glue -- logically it's part of the @item we just started. - \nobreak \vskip-\parskip - % - % Stop a page break at the \parskip glue coming up. (Unfortunately - % we can't prevent a possible page break at the following - % \baselineskip glue.) However, if what follows is an environment - % such as @example, there will be no \parskip glue; then - % the negative vskip we just would cause the example and the item to - % crash together. So we use this bizarre value of 10001 as a signal - % to \aboveenvbreak to insert \parskip glue after all. - % (Possibly there are other commands that could be followed by - % @example which need the same treatment, but not section titles; or - % maybe section titles are the only special case and they should be - % penalty 10001...) - \penalty 10001 - \endgroup - \itemxneedsnegativevskipfalse - \else - % The item text fits into the space. Start a paragraph, so that the - % following text (if any) will end up on the same line. - \noindent - % Do this with kerns and \unhbox so that if there is a footnote in - % the item text, it can migrate to the main vertical list and - % eventually be printed. - \nobreak\kern-\tableindent - \dimen0 = \itemmax \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0 - \unhbox0 - \nobreak\kern\dimen0 - \endgroup - \itemxneedsnegativevskiptrue - \fi -} - -\def\item{\errmessage{@item while not in a list environment}} -\def\itemx{\errmessage{@itemx while not in a list environment}} - -% @table, @ftable, @vtable. -\envdef\table{% - \let\itemindex\gobble - \tablex -} -\envdef\ftable{% - \def\itemindex ##1{\doind {fn}{\code{##1}}}% - \tablex -} -\envdef\vtable{% - \def\itemindex ##1{\doind {vr}{\code{##1}}}% - \tablex -} -\def\tablex#1{% - \def\itemindicate{#1}% - \parsearg\tabley -} -\def\tabley#1{% - {% - \makevalueexpandable - \edef\temp{\noexpand\tablez #1\space\space\space}% - \expandafter - }\temp \endtablez -} -\def\tablez #1 #2 #3 #4\endtablez{% - \aboveenvbreak - \ifnum 0#1>0 \advance \leftskip by #1\mil \fi - \ifnum 0#2>0 \tableindent=#2\mil \fi - \ifnum 0#3>0 \advance \rightskip by #3\mil \fi - \itemmax=\tableindent - \advance \itemmax by -\itemmargin - \advance \leftskip by \tableindent - \exdentamount=\tableindent - \parindent = 0pt - \parskip = \smallskipamount - \ifdim \parskip=0pt \parskip=2pt \fi - \let\item = \internalBitem - \let\itemx = \internalBitemx -} -\def\Etable{\endgraf\afterenvbreak} -\let\Eftable\Etable -\let\Evtable\Etable -\let\Eitemize\Etable -\let\Eenumerate\Etable - -% This is the counter used by @enumerate, which is really @itemize - -\newcount \itemno - -\envdef\itemize{% - \parsearg\itemizey -} - -\def\itemizey#1{% - \aboveenvbreak - \itemmax=\itemindent - \advance\itemmax by -\itemmargin - \advance\leftskip by \itemindent - \exdentamount=\itemindent - \parindent=0pt - \parskip=\smallskipamount - \ifdim\parskip=0pt \parskip=2pt \fi - \def\itemcontents{#1}% - % @itemize with no arg is equivalent to @itemize @bullet. - \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi - \let\item=\itemizeitem -} - -% \splitoff TOKENS\endmark defines \first to be the first token in -% TOKENS, and \rest to be the remainder. -% -\def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}% - -% Allow an optional argument of an uppercase letter, lowercase letter, -% or number, to specify the first label in the enumerated list. No -% argument is the same as `1'. -% -\envparseargdef\enumerate{\enumeratey #1 \endenumeratey} -\def\enumeratey #1 #2\endenumeratey{% - % If we were given no argument, pretend we were given `1'. - \def\thearg{#1}% - \ifx\thearg\empty \def\thearg{1}\fi - % - % Detect if the argument is a single token. If so, it might be a - % letter. Otherwise, the only valid thing it can be is a number. - % (We will always have one token, because of the test we just made. - % This is a good thing, since \splitoff doesn't work given nothing at - % all -- the first parameter is undelimited.) - \expandafter\splitoff\thearg\endmark - \ifx\rest\empty - % Only one token in the argument. It could still be anything. - % A ``lowercase letter'' is one whose \lccode is nonzero. - % An ``uppercase letter'' is one whose \lccode is both nonzero, and - % not equal to itself. - % Otherwise, we assume it's a number. - % - % We need the \relax at the end of the \ifnum lines to stop TeX from - % continuing to look for a . - % - \ifnum\lccode\expandafter`\thearg=0\relax - \numericenumerate % a number (we hope) - \else - % It's a letter. - \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax - \lowercaseenumerate % lowercase letter - \else - \uppercaseenumerate % uppercase letter - \fi - \fi - \else - % Multiple tokens in the argument. We hope it's a number. - \numericenumerate - \fi -} - -% An @enumerate whose labels are integers. The starting integer is -% given in \thearg. -% -\def\numericenumerate{% - \itemno = \thearg - \startenumeration{\the\itemno}% -} - -% The starting (lowercase) letter is in \thearg. -\def\lowercaseenumerate{% - \itemno = \expandafter`\thearg - \startenumeration{% - % Be sure we're not beyond the end of the alphabet. - \ifnum\itemno=0 - \errmessage{No more lowercase letters in @enumerate; get a bigger - alphabet}% - \fi - \char\lccode\itemno - }% -} - -% The starting (uppercase) letter is in \thearg. -\def\uppercaseenumerate{% - \itemno = \expandafter`\thearg - \startenumeration{% - % Be sure we're not beyond the end of the alphabet. - \ifnum\itemno=0 - \errmessage{No more uppercase letters in @enumerate; get a bigger - alphabet} - \fi - \char\uccode\itemno - }% -} - -% Call itemizey, adding a period to the first argument and supplying the -% common last two arguments. Also subtract one from the initial value in -% \itemno, since @item increments \itemno. -% -\def\startenumeration#1{% - \advance\itemno by -1 - \itemizey{#1.}\flushcr -} - -% @alphaenumerate and @capsenumerate are abbreviations for giving an arg -% to @enumerate. -% -\def\alphaenumerate{\enumerate{a}} -\def\capsenumerate{\enumerate{A}} -\def\Ealphaenumerate{\Eenumerate} -\def\Ecapsenumerate{\Eenumerate} - -% Definition of @item while inside @itemize. - -\def\itemizeitem{% -\advance\itemno by 1 -{\let\par=\endgraf \smallbreak}% -\ifhmode \errmessage{In hmode at itemizeitem}\fi -{\parskip=0in \hskip 0pt -\hbox to 0pt{\hss \itemcontents\hskip \itemmargin}% -\vadjust{\penalty 1200}}% -\flushcr} - -% @multitable macros -% Amy Hendrickson, 8/18/94, 3/6/96 -% -% @multitable ... @end multitable will make as many columns as desired. -% Contents of each column will wrap at width given in preamble. Width -% can be specified either with sample text given in a template line, -% or in percent of \hsize, the current width of text on page. - -% Table can continue over pages but will only break between lines. - -% To make preamble: -% -% Either define widths of columns in terms of percent of \hsize: -% @multitable @columnfractions .25 .3 .45 -% @item ... -% -% Numbers following @columnfractions are the percent of the total -% current hsize to be used for each column. You may use as many -% columns as desired. - - -% Or use a template: -% @multitable {Column 1 template} {Column 2 template} {Column 3 template} -% @item ... -% using the widest term desired in each column. - -% Each new table line starts with @item, each subsequent new column -% starts with @tab. Empty columns may be produced by supplying @tab's -% with nothing between them for as many times as empty columns are needed, -% ie, @tab@tab@tab will produce two empty columns. - -% @item, @tab do not need to be on their own lines, but it will not hurt -% if they are. - -% Sample multitable: - -% @multitable {Column 1 template} {Column 2 template} {Column 3 template} -% @item first col stuff @tab second col stuff @tab third col -% @item -% first col stuff -% @tab -% second col stuff -% @tab -% third col -% @item first col stuff @tab second col stuff -% @tab Many paragraphs of text may be used in any column. -% -% They will wrap at the width determined by the template. -% @item@tab@tab This will be in third column. -% @end multitable - -% Default dimensions may be reset by user. -% @multitableparskip is vertical space between paragraphs in table. -% @multitableparindent is paragraph indent in table. -% @multitablecolmargin is horizontal space to be left between columns. -% @multitablelinespace is space to leave between table items, baseline -% to baseline. -% 0pt means it depends on current normal line spacing. -% -\newskip\multitableparskip -\newskip\multitableparindent -\newdimen\multitablecolspace -\newskip\multitablelinespace -\multitableparskip=0pt -\multitableparindent=6pt -\multitablecolspace=12pt -\multitablelinespace=0pt - -% Macros used to set up halign preamble: -% -\let\endsetuptable\relax -\def\xendsetuptable{\endsetuptable} -\let\columnfractions\relax -\def\xcolumnfractions{\columnfractions} -\newif\ifsetpercent - -% #1 is the part of the @columnfraction before the decimal point, which -% is presumably either 0 or the empty string (but we don't check, we -% just throw it away). #2 is the decimal part, which we use as the -% percent of \hsize for this column. -\def\pickupwholefraction#1.#2 {% - \global\advance\colcount by 1 - \expandafter\xdef\csname col\the\colcount\endcsname{.#2\hsize}% - \setuptable -} - -\newcount\colcount -\def\setuptable#1{% - \def\firstarg{#1}% - \ifx\firstarg\xendsetuptable - \let\go = \relax - \else - \ifx\firstarg\xcolumnfractions - \global\setpercenttrue - \else - \ifsetpercent - \let\go\pickupwholefraction - \else - \global\advance\colcount by 1 - \setbox0=\hbox{#1\unskip\space}% Add a normal word space as a - % separator; typically that is always in the input, anyway. - \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}% - \fi - \fi - \ifx\go\pickupwholefraction - % Put the argument back for the \pickupwholefraction call, so - % we'll always have a period there to be parsed. - \def\go{\pickupwholefraction#1}% - \else - \let\go = \setuptable - \fi% - \fi - \go -} - -% multitable-only commands. -% -% @headitem starts a heading row, which we typeset in bold. -% Assignments have to be global since we are inside the implicit group -% of an alignment entry. Note that \everycr resets \everytab. -\def\headitem{\checkenv\multitable \crcr \global\everytab={\bf}\the\everytab}% -% -% A \tab used to include \hskip1sp. But then the space in a template -% line is not enough. That is bad. So let's go back to just `&' until -% we encounter the problem it was intended to solve again. -% --karl, nathan@acm.org, 20apr99. -\def\tab{\checkenv\multitable &\the\everytab}% - -% @multitable ... @end multitable definitions: -% -\newtoks\everytab % insert after every tab. -% -\envdef\multitable{% - \vskip\parskip - \startsavinginserts - % - % @item within a multitable starts a normal row. - \let\item\crcr - % - \tolerance=9500 - \hbadness=9500 - \setmultitablespacing - \parskip=\multitableparskip - \parindent=\multitableparindent - \overfullrule=0pt - \global\colcount=0 - % - \everycr = {% - \noalign{% - \global\everytab={}% - \global\colcount=0 % Reset the column counter. - % Check for saved footnotes, etc. - \checkinserts - % Keeps underfull box messages off when table breaks over pages. - %\filbreak - % Maybe so, but it also creates really weird page breaks when the - % table breaks over pages. Wouldn't \vfil be better? Wait until the - % problem manifests itself, so it can be fixed for real --karl. - }% - }% - % - \parsearg\domultitable -} -\def\domultitable#1{% - % To parse everything between @multitable and @item: - \setuptable#1 \endsetuptable - % - % This preamble sets up a generic column definition, which will - % be used as many times as user calls for columns. - % \vtop will set a single line and will also let text wrap and - % continue for many paragraphs if desired. - \halign\bgroup &% - \global\advance\colcount by 1 - \multistrut - \vtop{% - % Use the current \colcount to find the correct column width: - \hsize=\expandafter\csname col\the\colcount\endcsname - % - % In order to keep entries from bumping into each other - % we will add a \leftskip of \multitablecolspace to all columns after - % the first one. - % - % If a template has been used, we will add \multitablecolspace - % to the width of each template entry. - % - % If the user has set preamble in terms of percent of \hsize we will - % use that dimension as the width of the column, and the \leftskip - % will keep entries from bumping into each other. Table will start at - % left margin and final column will justify at right margin. - % - % Make sure we don't inherit \rightskip from the outer environment. - \rightskip=0pt - \ifnum\colcount=1 - % The first column will be indented with the surrounding text. - \advance\hsize by\leftskip - \else - \ifsetpercent \else - % If user has not set preamble in terms of percent of \hsize - % we will advance \hsize by \multitablecolspace. - \advance\hsize by \multitablecolspace - \fi - % In either case we will make \leftskip=\multitablecolspace: - \leftskip=\multitablecolspace - \fi - % Ignoring space at the beginning and end avoids an occasional spurious - % blank line, when TeX decides to break the line at the space before the - % box from the multistrut, so the strut ends up on a line by itself. - % For example: - % @multitable @columnfractions .11 .89 - % @item @code{#} - % @tab Legal holiday which is valid in major parts of the whole country. - % Is automatically provided with highlighting sequences respectively - % marking characters. - \noindent\ignorespaces##\unskip\multistrut - }\cr -} -\def\Emultitable{% - \crcr - \egroup % end the \halign - \global\setpercentfalse -} - -\def\setmultitablespacing{% test to see if user has set \multitablelinespace. -% If so, do nothing. If not, give it an appropriate dimension based on -% current baselineskip. -\ifdim\multitablelinespace=0pt -\setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip -\global\advance\multitablelinespace by-\ht0 -%% strut to put in table in case some entry doesn't have descenders, -%% to keep lines equally spaced -\let\multistrut = \strut -\else -%% FIXME: what is \box0 supposed to be? -\gdef\multistrut{\vrule height\multitablelinespace depth\dp0 -width0pt\relax} \fi -%% Test to see if parskip is larger than space between lines of -%% table. If not, do nothing. -%% If so, set to same dimension as multitablelinespace. -\ifdim\multitableparskip>\multitablelinespace -\global\multitableparskip=\multitablelinespace -\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller - %% than skip between lines in the table. -\fi% -\ifdim\multitableparskip=0pt -\global\multitableparskip=\multitablelinespace -\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller - %% than skip between lines in the table. -\fi} - - -\message{conditionals,} - -% @iftex, @ifnotdocbook, @ifnothtml, @ifnotinfo, @ifnotplaintext, -% @ifnotxml always succeed. They currently do nothing; we don't -% attempt to check whether the conditionals are properly nested. But we -% have to remember that they are conditionals, so that @end doesn't -% attempt to close an environment group. -% -\def\makecond#1{% - \expandafter\let\csname #1\endcsname = \relax - \expandafter\let\csname iscond.#1\endcsname = 1 -} -\makecond{iftex} -\makecond{ifnotdocbook} -\makecond{ifnothtml} -\makecond{ifnotinfo} -\makecond{ifnotplaintext} -\makecond{ifnotxml} - -% Ignore @ignore, @ifhtml, @ifinfo, and the like. -% -\def\direntry{\doignore{direntry}} -\def\documentdescription{\doignore{documentdescription}} -\def\docbook{\doignore{docbook}} -\def\html{\doignore{html}} -\def\ifdocbook{\doignore{ifdocbook}} -\def\ifhtml{\doignore{ifhtml}} -\def\ifinfo{\doignore{ifinfo}} -\def\ifnottex{\doignore{ifnottex}} -\def\ifplaintext{\doignore{ifplaintext}} -\def\ifxml{\doignore{ifxml}} -\def\ignore{\doignore{ignore}} -\def\menu{\doignore{menu}} -\def\xml{\doignore{xml}} - -% Ignore text until a line `@end #1', keeping track of nested conditionals. -% -% A count to remember the depth of nesting. -\newcount\doignorecount - -\def\doignore#1{\begingroup - % Scan in ``verbatim'' mode: - \catcode`\@ = \other - \catcode`\{ = \other - \catcode`\} = \other - % - % Make sure that spaces turn into tokens that match what \doignoretext wants. - \spaceisspace - % - % Count number of #1's that we've seen. - \doignorecount = 0 - % - % Swallow text until we reach the matching `@end #1'. - \dodoignore {#1}% -} - -{ \catcode`_=11 % We want to use \_STOP_ which cannot appear in texinfo source. - \obeylines % - % - \gdef\dodoignore#1{% - % #1 contains the string `ifinfo'. - % - % Define a command to find the next `@end #1', which must be on a line - % by itself. - \long\def\doignoretext##1^^M@end #1{\doignoretextyyy##1^^M@#1\_STOP_}% - % And this command to find another #1 command, at the beginning of a - % line. (Otherwise, we would consider a line `@c @ifset', for - % example, to count as an @ifset for nesting.) - \long\def\doignoretextyyy##1^^M@#1##2\_STOP_{\doignoreyyy{##2}\_STOP_}% - % - % And now expand that command. - \obeylines % - \doignoretext ^^M% - }% -} - -\def\doignoreyyy#1{% - \def\temp{#1}% - \ifx\temp\empty % Nothing found. - \let\next\doignoretextzzz - \else % Found a nested condition, ... - \advance\doignorecount by 1 - \let\next\doignoretextyyy % ..., look for another. - % If we're here, #1 ends with ^^M\ifinfo (for example). - \fi - \next #1% the token \_STOP_ is present just after this macro. -} - -% We have to swallow the remaining "\_STOP_". -% -\def\doignoretextzzz#1{% - \ifnum\doignorecount = 0 % We have just found the outermost @end. - \let\next\enddoignore - \else % Still inside a nested condition. - \advance\doignorecount by -1 - \let\next\doignoretext % Look for the next @end. - \fi - \next -} - -% Finish off ignored text. -\def\enddoignore{\endgroup\ignorespaces} - - -% @set VAR sets the variable VAR to an empty value. -% @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE. -% -% Since we want to separate VAR from REST-OF-LINE (which might be -% empty), we can't just use \parsearg; we have to insert a space of our -% own to delimit the rest of the line, and then take it out again if we -% didn't need it. -% We rely on the fact that \parsearg sets \catcode`\ =10. -% -\parseargdef\set{\setyyy#1 \endsetyyy} -\def\setyyy#1 #2\endsetyyy{% - {% - \makevalueexpandable - \def\temp{#2}% - \edef\next{\gdef\makecsname{SET#1}}% - \ifx\temp\empty - \next{}% - \else - \setzzz#2\endsetzzz - \fi - }% -} -% Remove the trailing space \setxxx inserted. -\def\setzzz#1 \endsetzzz{\next{#1}} - -% @clear VAR clears (i.e., unsets) the variable VAR. -% -\parseargdef\clear{% - {% - \makevalueexpandable - \global\expandafter\let\csname SET#1\endcsname=\relax - }% -} - -% @value{foo} gets the text saved in variable foo. -\def\value{\begingroup\makevalueexpandable\valuexxx} -\def\valuexxx#1{\expandablevalue{#1}\endgroup} -{ - \catcode`\- = \active \catcode`\_ = \active - % - \gdef\makevalueexpandable{% - \let\value = \expandablevalue - % We don't want these characters active, ... - \catcode`\-=\other \catcode`\_=\other - % ..., but we might end up with active ones in the argument if - % we're called from @code, as @code{@value{foo-bar_}}, though. - % So \let them to their normal equivalents. - \let-\realdash \let_\normalunderscore - } -} - -% We have this subroutine so that we can handle at least some @value's -% properly in indexes (we call \makevalueexpandable in \indexdummies). -% The command has to be fully expandable (if the variable is set), since -% the result winds up in the index file. This means that if the -% variable's value contains other Texinfo commands, it's almost certain -% it will fail (although perhaps we could fix that with sufficient work -% to do a one-level expansion on the result, instead of complete). -% -\def\expandablevalue#1{% - \expandafter\ifx\csname SET#1\endcsname\relax - {[No value for ``#1'']}% - \message{Variable `#1', used in @value, is not set.}% - \else - \csname SET#1\endcsname - \fi -} - -% @ifset VAR ... @end ifset reads the `...' iff VAR has been defined -% with @set. -% -% To get special treatment of `@end ifset,' call \makeond and the redefine. -% -\makecond{ifset} -\def\ifset{\parsearg{\doifset{\let\next=\ifsetfail}}} -\def\doifset#1#2{% - {% - \makevalueexpandable - \let\next=\empty - \expandafter\ifx\csname SET#2\endcsname\relax - #1% If not set, redefine \next. - \fi - \expandafter - }\next -} -\def\ifsetfail{\doignore{ifset}} - -% @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been -% defined with @set, or has been undefined with @clear. -% -% The `\else' inside the `\doifset' parameter is a trick to reuse the -% above code: if the variable is not set, do nothing, if it is set, -% then redefine \next to \ifclearfail. -% -\makecond{ifclear} -\def\ifclear{\parsearg{\doifset{\else \let\next=\ifclearfail}}} -\def\ifclearfail{\doignore{ifclear}} - -% @dircategory CATEGORY -- specify a category of the dir file -% which this file should belong to. Ignore this in TeX. -\let\dircategory=\comment - -% @defininfoenclose. -\let\definfoenclose=\comment - - -\message{indexing,} -% Index generation facilities - -% Define \newwrite to be identical to plain tex's \newwrite -% except not \outer, so it can be used within \newindex. -{\catcode`\@=11 -\gdef\newwrite{\alloc@7\write\chardef\sixt@@n}} - -% \newindex {foo} defines an index named foo. -% It automatically defines \fooindex such that -% \fooindex ...rest of line... puts an entry in the index foo. -% It also defines \fooindfile to be the number of the output channel for -% the file that accumulates this index. The file's extension is foo. -% The name of an index should be no more than 2 characters long -% for the sake of vms. -% -\def\newindex#1{% - \iflinks - \expandafter\newwrite \csname#1indfile\endcsname - \openout \csname#1indfile\endcsname \jobname.#1 % Open the file - \fi - \expandafter\xdef\csname#1index\endcsname{% % Define @#1index - \noexpand\doindex{#1}} -} - -% @defindex foo == \newindex{foo} -% -\def\defindex{\parsearg\newindex} - -% Define @defcodeindex, like @defindex except put all entries in @code. -% -\def\defcodeindex{\parsearg\newcodeindex} -% -\def\newcodeindex#1{% - \iflinks - \expandafter\newwrite \csname#1indfile\endcsname - \openout \csname#1indfile\endcsname \jobname.#1 - \fi - \expandafter\xdef\csname#1index\endcsname{% - \noexpand\docodeindex{#1}}% -} - - -% @synindex foo bar makes index foo feed into index bar. -% Do this instead of @defindex foo if you don't want it as a separate index. -% -% @syncodeindex foo bar similar, but put all entries made for index foo -% inside @code. -% -\def\synindex#1 #2 {\dosynindex\doindex{#1}{#2}} -\def\syncodeindex#1 #2 {\dosynindex\docodeindex{#1}{#2}} - -% #1 is \doindex or \docodeindex, #2 the index getting redefined (foo), -% #3 the target index (bar). -\def\dosynindex#1#2#3{% - % Only do \closeout if we haven't already done it, else we'll end up - % closing the target index. - \expandafter \ifx\csname donesynindex#2\endcsname \undefined - % The \closeout helps reduce unnecessary open files; the limit on the - % Acorn RISC OS is a mere 16 files. - \expandafter\closeout\csname#2indfile\endcsname - \expandafter\let\csname\donesynindex#2\endcsname = 1 - \fi - % redefine \fooindfile: - \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname - \expandafter\let\csname#2indfile\endcsname=\temp - % redefine \fooindex: - \expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}% -} - -% Define \doindex, the driver for all \fooindex macros. -% Argument #1 is generated by the calling \fooindex macro, -% and it is "foo", the name of the index. - -% \doindex just uses \parsearg; it calls \doind for the actual work. -% This is because \doind is more useful to call from other macros. - -% There is also \dosubind {index}{topic}{subtopic} -% which makes an entry in a two-level index such as the operation index. - -\def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer} -\def\singleindexer #1{\doind{\indexname}{#1}} - -% like the previous two, but they put @code around the argument. -\def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer} -\def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}} - -% Take care of Texinfo commands that can appear in an index entry. -% Since there are some commands we want to expand, and others we don't, -% we have to laboriously prevent expansion for those that we don't. -% -\def\indexdummies{% - \def\@{@}% change to @@ when we switch to @ as escape char in index files. - \def\ {\realbackslash\space }% - % Need these in case \tex is in effect and \{ is a \delimiter again. - % But can't use \lbracecmd and \rbracecmd because texindex assumes - % braces and backslashes are used only as delimiters. - \let\{ = \mylbrace - \let\} = \myrbrace - % - % \definedummyword defines \#1 as \realbackslash #1\space, thus - % effectively preventing its expansion. This is used only for control - % words, not control letters, because the \space would be incorrect - % for control characters, but is needed to separate the control word - % from whatever follows. - % - % For control letters, we have \definedummyletter, which omits the - % space. - % - % These can be used both for control words that take an argument and - % those that do not. If it is followed by {arg} in the input, then - % that will dutifully get written to the index (or wherever). - % - \def\definedummyword##1{% - \expandafter\def\csname ##1\endcsname{\realbackslash ##1\space}% - }% - \def\definedummyletter##1{% - \expandafter\def\csname ##1\endcsname{\realbackslash ##1}% - }% - % - % Do the redefinitions. - \commondummies -} - -% For the aux file, @ is the escape character. So we want to redefine -% everything using @ instead of \realbackslash. When everything uses -% @, this will be simpler. -% -\def\atdummies{% - \def\@{@@}% - \def\ {@ }% - \let\{ = \lbraceatcmd - \let\} = \rbraceatcmd - % - % (See comments in \indexdummies.) - \def\definedummyword##1{% - \expandafter\def\csname ##1\endcsname{@##1\space}% - }% - \def\definedummyletter##1{% - \expandafter\def\csname ##1\endcsname{@##1}% - }% - % - % Do the redefinitions. - \commondummies -} - -% Called from \indexdummies and \atdummies. \definedummyword and -% \definedummyletter must be defined first. -% -\def\commondummies{% - % - \normalturnoffactive - % - \commondummiesnofonts - % - \definedummyletter{_}% - % - % Non-English letters. - \definedummyword{AA}% - \definedummyword{AE}% - \definedummyword{L}% - \definedummyword{OE}% - \definedummyword{O}% - \definedummyword{aa}% - \definedummyword{ae}% - \definedummyword{l}% - \definedummyword{oe}% - \definedummyword{o}% - \definedummyword{ss}% - \definedummyword{exclamdown}% - \definedummyword{questiondown}% - \definedummyword{ordm}% - \definedummyword{ordf}% - % - % Although these internal commands shouldn't show up, sometimes they do. - \definedummyword{bf}% - \definedummyword{gtr}% - \definedummyword{hat}% - \definedummyword{less}% - \definedummyword{sf}% - \definedummyword{sl}% - \definedummyword{tclose}% - \definedummyword{tt}% - % - \definedummyword{LaTeX}% - \definedummyword{TeX}% - \definedummyword{dots}% - % - % Assorted special characters. - \definedummyword{bullet}% - \definedummyword{copyright}% - \definedummyword{registeredsymbol}% - \definedummyword{dots}% - \definedummyword{enddots}% - \definedummyword{equiv}% - \definedummyword{error}% - \definedummyword{expansion}% - \definedummyword{minus}% - \definedummyword{pounds}% - \definedummyword{point}% - \definedummyword{print}% - \definedummyword{result}% - % - % Handle some cases of @value -- where it does not contain any - % (non-fully-expandable) commands. - \makevalueexpandable - % - % Normal spaces, not active ones. - \unsepspaces - % - % No macro expansion. - \turnoffmacros -} - -% \commondummiesnofonts: common to \commondummies and \indexnofonts. -% -% Better have this without active chars. -{ - \catcode`\~=\other - \gdef\commondummiesnofonts{% - % Control letters and accents. - \definedummyletter{,}% - \definedummyletter{"}% - \definedummyletter{`}% - \definedummyletter{'}% - \definedummyletter{^}% - \definedummyletter{~}% - \definedummyletter{=}% - \definedummyword{u}% - \definedummyword{v}% - \definedummyword{H}% - \definedummyword{dotaccent}% - \definedummyword{ringaccent}% - \definedummyword{tieaccent}% - \definedummyword{ubaraccent}% - \definedummyword{udotaccent}% - \definedummyword{dotless}% - % - % Texinfo font commands. - \definedummyword{b}% - \definedummyword{i}% - \definedummyword{r}% - \definedummyword{sc}% - \definedummyword{t}% - % - \definedummyword{acronym}% - \definedummyword{cite}% - \definedummyword{code}% - \definedummyword{command}% - \definedummyword{dfn}% - \definedummyword{emph}% - \definedummyword{env}% - \definedummyword{file}% - \definedummyword{kbd}% - \definedummyword{key}% - \definedummyword{math}% - \definedummyword{option}% - \definedummyword{samp}% - \definedummyword{strong}% - \definedummyword{uref}% - \definedummyword{url}% - \definedummyword{var}% - \definedummyword{verb}% - \definedummyword{w}% - } -} - -% \indexnofonts is used when outputting the strings to sort the index -% by, and when constructing control sequence names. It eliminates all -% control sequences and just writes whatever the best ASCII sort string -% would be for a given command (usually its argument). -% -\def\indexnofonts{% - \def\definedummyword##1{% - \expandafter\let\csname ##1\endcsname\asis - }% - \let\definedummyletter=\definedummyword - % - \commondummiesnofonts - % - % Don't no-op \tt, since it isn't a user-level command - % and is used in the definitions of the active chars like <, >, |, etc. - % Likewise with the other plain tex font commands. - %\let\tt=\asis - % - \def\ { }% - \def\@{@}% - % how to handle braces? - \def\_{\normalunderscore}% - % - % Non-English letters. - \def\AA{AA}% - \def\AE{AE}% - \def\L{L}% - \def\OE{OE}% - \def\O{O}% - \def\aa{aa}% - \def\ae{ae}% - \def\l{l}% - \def\oe{oe}% - \def\o{o}% - \def\ss{ss}% - \def\exclamdown{!}% - \def\questiondown{?}% - \def\ordf{a}% - \def\ordm{o}% - % - \def\LaTeX{LaTeX}% - \def\TeX{TeX}% - \def\dots{...}% -} - -\let\indexbackslash=0 %overridden during \printindex. -\let\SETmarginindex=\relax % put index entries in margin (undocumented)? - -% Most index entries go through here, but \dosubind is the general case. -% #1 is the index name, #2 is the entry text. -\def\doind#1#2{\dosubind{#1}{#2}{}} - -% Workhorse for all \fooindexes. -% #1 is name of index, #2 is stuff to put there, #3 is subentry -- -% empty if called from \doind, as we usually are (the main exception -% is with most defuns, which call us directly). -% -\def\dosubind#1#2#3{% - \iflinks - {% - % Store the main index entry text (including the third arg). - \toks0 = {#2}% - % If third arg is present, precede it with a space. - \def\thirdarg{#3}% - \ifx\thirdarg\empty \else - \toks0 = \expandafter{\the\toks0 \space #3}% - \fi - % - \edef\writeto{\csname#1indfile\endcsname}% - % - \ifvmode - \dosubindsanitize - \else - \dosubindwrite - \fi - }% - \fi -} - -% Write the entry in \toks0 to the index file: -% -\def\dosubindwrite{% - % Put the index entry in the margin if desired. - \ifx\SETmarginindex\relax\else - \insert\margin{\hbox{\vrule height8pt depth3pt width0pt \the\toks0}}% - \fi - % - % Remember, we are within a group. - \indexdummies % Must do this here, since \bf, etc expand at this stage - \escapechar=`\\ - \def\backslashcurfont{\indexbackslash}% \indexbackslash isn't defined now - % so it will be output as is; and it will print as backslash. - % - % Process the index entry with all font commands turned off, to - % get the string to sort by. - {\indexnofonts - \edef\temp{\the\toks0}% need full expansion - \xdef\indexsorttmp{\temp}% - }% - % - % Set up the complete index entry, with both the sort key and - % the original text, including any font commands. We write - % three arguments to \entry to the .?? file (four in the - % subentry case), texindex reduces to two when writing the .??s - % sorted result. - \edef\temp{% - \write\writeto{% - \string\entry{\indexsorttmp}{\noexpand\folio}{\the\toks0}}% - }% - \temp -} - -% Take care of unwanted page breaks: -% -% If a skip is the last thing on the list now, preserve it -% by backing up by \lastskip, doing the \write, then inserting -% the skip again. Otherwise, the whatsit generated by the -% \write will make \lastskip zero. The result is that sequences -% like this: -% @end defun -% @tindex whatever -% @defun ... -% will have extra space inserted, because the \medbreak in the -% start of the @defun won't see the skip inserted by the @end of -% the previous defun. -% -% But don't do any of this if we're not in vertical mode. We -% don't want to do a \vskip and prematurely end a paragraph. -% -% Avoid page breaks due to these extra skips, too. -% -% But wait, there is a catch there: -% We'll have to check whether \lastskip is zero skip. \ifdim is not -% sufficient for this purpose, as it ignores stretch and shrink parts -% of the skip. The only way seems to be to check the textual -% representation of the skip. -% -% The following is almost like \def\zeroskipmacro{0.0pt} except that -% the ``p'' and ``t'' characters have catcode \other, not 11 (letter). -% -\edef\zeroskipmacro{\expandafter\the\csname z@skip\endcsname} -% -% ..., ready, GO: -% -\def\dosubindsanitize{% - % \lastskip and \lastpenalty cannot both be nonzero simultaneously. - \skip0 = \lastskip - \edef\lastskipmacro{\the\lastskip}% - \count255 = \lastpenalty - % - % If \lastskip is nonzero, that means the last item was a - % skip. And since a skip is discardable, that means this - % -\skip0 glue we're inserting is preceded by a - % non-discardable item, therefore it is not a potential - % breakpoint, therefore no \nobreak needed. - \ifx\lastskipmacro\zeroskipmacro - \else - \vskip-\skip0 - \fi - % - \dosubindwrite - % - \ifx\lastskipmacro\zeroskipmacro - % if \lastskip was zero, perhaps the last item was a - % penalty, and perhaps it was >=10000, e.g., a \nobreak. - % In that case, we want to re-insert the penalty; since we - % just inserted a non-discardable item, any following glue - % (such as a \parskip) would be a breakpoint. For example: - % @deffn deffn-whatever - % @vindex index-whatever - % Description. - % would allow a break between the index-whatever whatsit - % and the "Description." paragraph. - \ifnum\count255>9999 \nobreak \fi - \else - % On the other hand, if we had a nonzero \lastskip, - % this make-up glue would be preceded by a non-discardable item - % (the whatsit from the \write), so we must insert a \nobreak. - \nobreak\vskip\skip0 - \fi -} - -% The index entry written in the file actually looks like -% \entry {sortstring}{page}{topic} -% or -% \entry {sortstring}{page}{topic}{subtopic} -% The texindex program reads in these files and writes files -% containing these kinds of lines: -% \initial {c} -% before the first topic whose initial is c -% \entry {topic}{pagelist} -% for a topic that is used without subtopics -% \primary {topic} -% for the beginning of a topic that is used with subtopics -% \secondary {subtopic}{pagelist} -% for each subtopic. - -% Define the user-accessible indexing commands -% @findex, @vindex, @kindex, @cindex. - -\def\findex {\fnindex} -\def\kindex {\kyindex} -\def\cindex {\cpindex} -\def\vindex {\vrindex} -\def\tindex {\tpindex} -\def\pindex {\pgindex} - -\def\cindexsub {\begingroup\obeylines\cindexsub} -{\obeylines % -\gdef\cindexsub "#1" #2^^M{\endgroup % -\dosubind{cp}{#2}{#1}}} - -% Define the macros used in formatting output of the sorted index material. - -% @printindex causes a particular index (the ??s file) to get printed. -% It does not print any chapter heading (usually an @unnumbered). -% -\parseargdef\printindex{\begingroup - \dobreak \chapheadingskip{10000}% - % - \smallfonts \rm - \tolerance = 9500 - \everypar = {}% don't want the \kern\-parindent from indentation suppression. - % - % See if the index file exists and is nonempty. - % Change catcode of @ here so that if the index file contains - % \initial {@} - % as its first line, TeX doesn't complain about mismatched braces - % (because it thinks @} is a control sequence). - \catcode`\@ = 11 - \openin 1 \jobname.#1s - \ifeof 1 - % \enddoublecolumns gets confused if there is no text in the index, - % and it loses the chapter title and the aux file entries for the - % index. The easiest way to prevent this problem is to make sure - % there is some text. - \putwordIndexNonexistent - \else - % - % If the index file exists but is empty, then \openin leaves \ifeof - % false. We have to make TeX try to read something from the file, so - % it can discover if there is anything in it. - \read 1 to \temp - \ifeof 1 - \putwordIndexIsEmpty - \else - % Index files are almost Texinfo source, but we use \ as the escape - % character. It would be better to use @, but that's too big a change - % to make right now. - \def\indexbackslash{\backslashcurfont}% - \catcode`\\ = 0 - \escapechar = `\\ - \begindoublecolumns - \input \jobname.#1s - \enddoublecolumns - \fi - \fi - \closein 1 -\endgroup} - -% These macros are used by the sorted index file itself. -% Change them to control the appearance of the index. - -\def\initial#1{{% - % Some minor font changes for the special characters. - \let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt - % - % Remove any glue we may have, we'll be inserting our own. - \removelastskip - % - % We like breaks before the index initials, so insert a bonus. - \penalty -300 - % - % Typeset the initial. Making this add up to a whole number of - % baselineskips increases the chance of the dots lining up from column - % to column. It still won't often be perfect, because of the stretch - % we need before each entry, but it's better. - % - % No shrink because it confuses \balancecolumns. - \vskip 1.67\baselineskip plus .5\baselineskip - \leftline{\secbf #1}% - \vskip .33\baselineskip plus .1\baselineskip - % - % Do our best not to break after the initial. - \nobreak -}} - -% \entry typesets a paragraph consisting of the text (#1), dot leaders, and -% then page number (#2) flushed to the right margin. It is used for index -% and table of contents entries. The paragraph is indented by \leftskip. -% -% A straigtforward implementation would start like this: -% \def\entry#1#2{... -% But this frozes the catcodes in the argument, and can cause problems to -% @code, which set's active ``-''. This problem was fixed by a kludge--- -% ``-'' was active throughout whole index, but this isn't what we really -% want. -% The right solution is to prevent \entry from swallowing the whole text. -% --kasal, 21nov03 -\def\entry{% - \begingroup - % - % Start a new paragraph if necessary, so our assignments below can't - % affect previous text. - \par - % - % Do not fill out the last line with white space. - \parfillskip = 0in - % - % No extra space above this paragraph. - \parskip = 0in - % - % Do not prefer a separate line ending with a hyphen to fewer lines. - \finalhyphendemerits = 0 - % - % \hangindent is only relevant when the entry text and page number - % don't both fit on one line. In that case, bob suggests starting the - % dots pretty far over on the line. Unfortunately, a large - % indentation looks wrong when the entry text itself is broken across - % lines. So we use a small indentation and put up with long leaders. - % - % \hangafter is reset to 1 (which is the value we want) at the start - % of each paragraph, so we need not do anything with that. - \hangindent = 2em - % - % When the entry text needs to be broken, just fill out the first line - % with blank space. - \rightskip = 0pt plus1fil - % - % A bit of stretch before each entry for the benefit of balancing - % columns. - \vskip 0pt plus1pt - % - % Swallow the left brace of the text (first parameter): - \afterassignment\doentry - \let\temp = -} -\def\doentry{% - \bgroup % Instead of the swallowed brace. - \noindent - \aftergroup\finishentry - % And now comes the text of the entry. -} -\def\finishentry#1{% - % #1 is the page number. - % - % The following is kludged to not output a line of dots in the index if - % there are no page numbers. The next person who breaks this will be - % cursed by a Unix daemon. - \def\tempa{{\rm }}% - \def\tempb{#1}% - \edef\tempc{\tempa}% - \edef\tempd{\tempb}% - \ifx\tempc\tempd - \ % - \else - % - % If we must, put the page number on a line of its own, and fill out - % this line with blank space. (The \hfil is overwhelmed with the - % fill leaders glue in \indexdotfill if the page number does fit.) - \hfil\penalty50 - \null\nobreak\indexdotfill % Have leaders before the page number. - % - % The `\ ' here is removed by the implicit \unskip that TeX does as - % part of (the primitive) \par. Without it, a spurious underfull - % \hbox ensues. - \ifpdf - \pdfgettoks#1.\ \the\toksA - \else - \ #1% - \fi - \fi - \par - \endgroup -} - -% Like \dotfill except takes at least 1 em. -\def\indexdotfill{\cleaders - \hbox{$\mathsurround=0pt \mkern1.5mu ${\it .}$ \mkern1.5mu$}\hskip 1em plus 1fill} - -\def\primary #1{\line{#1\hfil}} - -\newskip\secondaryindent \secondaryindent=0.5cm -\def\secondary#1#2{{% - \parfillskip=0in - \parskip=0in - \hangindent=1in - \hangafter=1 - \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill - \ifpdf - \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph. - \else - #2 - \fi - \par -}} - -% Define two-column mode, which we use to typeset indexes. -% Adapted from the TeXbook, page 416, which is to say, -% the manmac.tex format used to print the TeXbook itself. -\catcode`\@=11 - -\newbox\partialpage -\newdimen\doublecolumnhsize - -\def\begindoublecolumns{\begingroup % ended by \enddoublecolumns - % Grab any single-column material above us. - \output = {% - % - % Here is a possibility not foreseen in manmac: if we accumulate a - % whole lot of material, we might end up calling this \output - % routine twice in a row (see the doublecol-lose test, which is - % essentially a couple of indexes with @setchapternewpage off). In - % that case we just ship out what is in \partialpage with the normal - % output routine. Generally, \partialpage will be empty when this - % runs and this will be a no-op. See the indexspread.tex test case. - \ifvoid\partialpage \else - \onepageout{\pagecontents\partialpage}% - \fi - % - \global\setbox\partialpage = \vbox{% - % Unvbox the main output page. - \unvbox\PAGE - \kern-\topskip \kern\baselineskip - }% - }% - \eject % run that output routine to set \partialpage - % - % Use the double-column output routine for subsequent pages. - \output = {\doublecolumnout}% - % - % Change the page size parameters. We could do this once outside this - % routine, in each of @smallbook, @afourpaper, and the default 8.5x11 - % format, but then we repeat the same computation. Repeating a couple - % of assignments once per index is clearly meaningless for the - % execution time, so we may as well do it in one place. - % - % First we halve the line length, less a little for the gutter between - % the columns. We compute the gutter based on the line length, so it - % changes automatically with the paper format. The magic constant - % below is chosen so that the gutter has the same value (well, +-<1pt) - % as it did when we hard-coded it. - % - % We put the result in a separate register, \doublecolumhsize, so we - % can restore it in \pagesofar, after \hsize itself has (potentially) - % been clobbered. - % - \doublecolumnhsize = \hsize - \advance\doublecolumnhsize by -.04154\hsize - \divide\doublecolumnhsize by 2 - \hsize = \doublecolumnhsize - % - % Double the \vsize as well. (We don't need a separate register here, - % since nobody clobbers \vsize.) - \vsize = 2\vsize -} - -% The double-column output routine for all double-column pages except -% the last. -% -\def\doublecolumnout{% - \splittopskip=\topskip \splitmaxdepth=\maxdepth - % Get the available space for the double columns -- the normal - % (undoubled) page height minus any material left over from the - % previous page. - \dimen@ = \vsize - \divide\dimen@ by 2 - \advance\dimen@ by -\ht\partialpage - % - % box0 will be the left-hand column, box2 the right. - \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@ - \onepageout\pagesofar - \unvbox255 - \penalty\outputpenalty -} -% -% Re-output the contents of the output page -- any previous material, -% followed by the two boxes we just split, in box0 and box2. -\def\pagesofar{% - \unvbox\partialpage - % - \hsize = \doublecolumnhsize - \wd0=\hsize \wd2=\hsize - \hbox to\pagewidth{\box0\hfil\box2}% -} -% -% All done with double columns. -\def\enddoublecolumns{% - \output = {% - % Split the last of the double-column material. Leave it on the - % current page, no automatic page break. - \balancecolumns - % - % If we end up splitting too much material for the current page, - % though, there will be another page break right after this \output - % invocation ends. Having called \balancecolumns once, we do not - % want to call it again. Therefore, reset \output to its normal - % definition right away. (We hope \balancecolumns will never be - % called on to balance too much material, but if it is, this makes - % the output somewhat more palatable.) - \global\output = {\onepageout{\pagecontents\PAGE}}% - }% - \eject - \endgroup % started in \begindoublecolumns - % - % \pagegoal was set to the doubled \vsize above, since we restarted - % the current page. We're now back to normal single-column - % typesetting, so reset \pagegoal to the normal \vsize (after the - % \endgroup where \vsize got restored). - \pagegoal = \vsize -} -% -% Called at the end of the double column material. -\def\balancecolumns{% - \setbox0 = \vbox{\unvbox255}% like \box255 but more efficient, see p.120. - \dimen@ = \ht0 - \advance\dimen@ by \topskip - \advance\dimen@ by-\baselineskip - \divide\dimen@ by 2 % target to split to - %debug\message{final 2-column material height=\the\ht0, target=\the\dimen@.}% - \splittopskip = \topskip - % Loop until we get a decent breakpoint. - {% - \vbadness = 10000 - \loop - \global\setbox3 = \copy0 - \global\setbox1 = \vsplit3 to \dimen@ - \ifdim\ht3>\dimen@ - \global\advance\dimen@ by 1pt - \repeat - }% - %debug\message{split to \the\dimen@, column heights: \the\ht1, \the\ht3.}% - \setbox0=\vbox to\dimen@{\unvbox1}% - \setbox2=\vbox to\dimen@{\unvbox3}% - % - \pagesofar -} -\catcode`\@ = \other - - -\message{sectioning,} -% Chapters, sections, etc. - -% \unnumberedno is an oxymoron, of course. But we count the unnumbered -% sections so that we can refer to them unambiguously in the pdf -% outlines by their "section number". We avoid collisions with chapter -% numbers by starting them at 10000. (If a document ever has 10000 -% chapters, we're in trouble anyway, I'm sure.) -\newcount\unnumberedno \unnumberedno = 10000 -\newcount\chapno -\newcount\secno \secno=0 -\newcount\subsecno \subsecno=0 -\newcount\subsubsecno \subsubsecno=0 - -% This counter is funny since it counts through charcodes of letters A, B, ... -\newcount\appendixno \appendixno = `\@ -% -% \def\appendixletter{\char\the\appendixno} -% We do the following ugly conditional instead of the above simple -% construct for the sake of pdftex, which needs the actual -% letter in the expansion, not just typeset. -% -\def\appendixletter{% - \ifnum\appendixno=`A A% - \else\ifnum\appendixno=`B B% - \else\ifnum\appendixno=`C C% - \else\ifnum\appendixno=`D D% - \else\ifnum\appendixno=`E E% - \else\ifnum\appendixno=`F F% - \else\ifnum\appendixno=`G G% - \else\ifnum\appendixno=`H H% - \else\ifnum\appendixno=`I I% - \else\ifnum\appendixno=`J J% - \else\ifnum\appendixno=`K K% - \else\ifnum\appendixno=`L L% - \else\ifnum\appendixno=`M M% - \else\ifnum\appendixno=`N N% - \else\ifnum\appendixno=`O O% - \else\ifnum\appendixno=`P P% - \else\ifnum\appendixno=`Q Q% - \else\ifnum\appendixno=`R R% - \else\ifnum\appendixno=`S S% - \else\ifnum\appendixno=`T T% - \else\ifnum\appendixno=`U U% - \else\ifnum\appendixno=`V V% - \else\ifnum\appendixno=`W W% - \else\ifnum\appendixno=`X X% - \else\ifnum\appendixno=`Y Y% - \else\ifnum\appendixno=`Z Z% - % The \the is necessary, despite appearances, because \appendixletter is - % expanded while writing the .toc file. \char\appendixno is not - % expandable, thus it is written literally, thus all appendixes come out - % with the same letter (or @) in the toc without it. - \else\char\the\appendixno - \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi - \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi} - -% Each @chapter defines this as the name of the chapter. -% page headings and footings can use it. @section does likewise. -% However, they are not reliable, because we don't use marks. -\def\thischapter{} -\def\thissection{} - -\newcount\absseclevel % used to calculate proper heading level -\newcount\secbase\secbase=0 % @raisesections/@lowersections modify this count - -% @raisesections: treat @section as chapter, @subsection as section, etc. -\def\raisesections{\global\advance\secbase by -1} -\let\up=\raisesections % original BFox name - -% @lowersections: treat @chapter as section, @section as subsection, etc. -\def\lowersections{\global\advance\secbase by 1} -\let\down=\lowersections % original BFox name - -% Choose a numbered-heading macro -% #1 is heading level if unmodified by @raisesections or @lowersections -% #2 is text for heading -\def\numhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1 -\ifcase\absseclevel - \chapterzzz{#2}% - \or \seczzz{#2}% - \or \numberedsubseczzz{#2}% - \or \numberedsubsubseczzz{#2}% - \else - \ifnum \absseclevel<0 \chapterzzz{#2}% - \else \numberedsubsubseczzz{#2}% - \fi - \fi - \suppressfirstparagraphindent -} - -% like \numhead, but chooses appendix heading levels -\def\apphead#1#2{\absseclevel=\secbase\advance\absseclevel by #1 -\ifcase\absseclevel - \appendixzzz{#2}% - \or \appendixsectionzzz{#2}% - \or \appendixsubseczzz{#2}% - \or \appendixsubsubseczzz{#2}% - \else - \ifnum \absseclevel<0 \appendixzzz{#2}% - \else \appendixsubsubseczzz{#2}% - \fi - \fi - \suppressfirstparagraphindent -} - -% like \numhead, but chooses numberless heading levels -\def\unnmhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1 - \ifcase\absseclevel - \unnumberedzzz{#2}% - \or \unnumberedseczzz{#2}% - \or \unnumberedsubseczzz{#2}% - \or \unnumberedsubsubseczzz{#2}% - \else - \ifnum \absseclevel<0 \unnumberedzzz{#2}% - \else \unnumberedsubsubseczzz{#2}% - \fi - \fi - \suppressfirstparagraphindent -} - -% @chapter, @appendix, @unnumbered. Increment top-level counter, reset -% all lower-level sectioning counters to zero. -% -% Also set \chaplevelprefix, which we prepend to @float sequence numbers -% (e.g., figures), q.v. By default (before any chapter), that is empty. -\let\chaplevelprefix = \empty -% -\outer\parseargdef\chapter{\numhead0{#1}} % normally numhead0 calls chapterzzz -\def\chapterzzz#1{% - % section resetting is \global in case the chapter is in a group, such - % as an @include file. - \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 - \global\advance\chapno by 1 - % - % Used for \float. - \gdef\chaplevelprefix{\the\chapno.}% - \resetallfloatnos - % - \message{\putwordChapter\space \the\chapno}% - % - % Write the actual heading. - \chapmacro{#1}{Ynumbered}{\the\chapno}% - % - % So @section and the like are numbered underneath this chapter. - \global\let\section = \numberedsec - \global\let\subsection = \numberedsubsec - \global\let\subsubsection = \numberedsubsubsec -} - -\outer\parseargdef\appendix{\apphead0{#1}} % normally apphead0 calls appendixzzz -\def\appendixzzz#1{% - \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 - \global\advance\appendixno by 1 - \gdef\chaplevelprefix{\appendixletter.}% - \resetallfloatnos - % - \def\appendixnum{\putwordAppendix\space \appendixletter}% - \message{\appendixnum}% - % - \chapmacro{#1}{Yappendix}{\appendixletter}% - % - \global\let\section = \appendixsec - \global\let\subsection = \appendixsubsec - \global\let\subsubsection = \appendixsubsubsec -} - -% @centerchap is like @unnumbered, but the heading is centered. -\outer\parseargdef\centerchap{{\unnumberedyyy{#1}}} - -\outer\parseargdef\unnumbered{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz -\def\unnumberedzzz#1{% - \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 - \global\advance\unnumberedno by 1 - % - % Since an unnumbered has no number, no prefix for figures. - \global\let\chaplevelprefix = \empty - \resetallfloatnos - % - % This used to be simply \message{#1}, but TeX fully expands the - % argument to \message. Therefore, if #1 contained @-commands, TeX - % expanded them. For example, in `@unnumbered The @cite{Book}', TeX - % expanded @cite (which turns out to cause errors because \cite is meant - % to be executed, not expanded). - % - % Anyway, we don't want the fully-expanded definition of @cite to appear - % as a result of the \message, we just want `@cite' itself. We use - % \the to achieve this: TeX expands \the only once, - % simply yielding the contents of . (We also do this for - % the toc entries.) - \toks0 = {#1}% - \message{(\the\toks0)}% - % - \chapmacro{#1}{Ynothing}{\the\unnumberedno}% - % - \global\let\section = \unnumberedsec - \global\let\subsection = \unnumberedsubsec - \global\let\subsubsection = \unnumberedsubsubsec -} - -% @top is like @unnumbered. -\let\top\unnumbered - -% Sections. -\outer\parseargdef\numberedsec{\numhead1{#1}} % normally calls seczzz -\def\seczzz#1{% - \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 - \sectionheading{#1}{sec}{Ynumbered}{\the\chapno.\the\secno}% -} - -\outer\parseargdef\appendixsection{\apphead1{#1}} % normally calls appendixsectionzzz -\def\appendixsectionzzz#1{% - \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 - \sectionheading{#1}{sec}{Yappendix}{\appendixletter.\the\secno}% -} -\let\appendixsec\appendixsection - -\outer\parseargdef\unnumberedsec{\unnmhead1{#1}} % normally calls unnumberedseczzz -\def\unnumberedseczzz#1{% - \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 - \sectionheading{#1}{sec}{Ynothing}{\the\unnumberedno.\the\secno}% -} - -% Subsections. -\outer\parseargdef\numberedsubsec{\numhead2{#1}} % normally calls numberedsubseczzz -\def\numberedsubseczzz#1{% - \global\subsubsecno=0 \global\advance\subsecno by 1 - \sectionheading{#1}{subsec}{Ynumbered}{\the\chapno.\the\secno.\the\subsecno}% -} - -\outer\parseargdef\appendixsubsec{\apphead2{#1}} % normally calls appendixsubseczzz -\def\appendixsubseczzz#1{% - \global\subsubsecno=0 \global\advance\subsecno by 1 - \sectionheading{#1}{subsec}{Yappendix}% - {\appendixletter.\the\secno.\the\subsecno}% -} - -\outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}} %normally calls unnumberedsubseczzz -\def\unnumberedsubseczzz#1{% - \global\subsubsecno=0 \global\advance\subsecno by 1 - \sectionheading{#1}{subsec}{Ynothing}% - {\the\unnumberedno.\the\secno.\the\subsecno}% -} - -% Subsubsections. -\outer\parseargdef\numberedsubsubsec{\numhead3{#1}} % normally numberedsubsubseczzz -\def\numberedsubsubseczzz#1{% - \global\advance\subsubsecno by 1 - \sectionheading{#1}{subsubsec}{Ynumbered}% - {\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno}% -} - -\outer\parseargdef\appendixsubsubsec{\apphead3{#1}} % normally appendixsubsubseczzz -\def\appendixsubsubseczzz#1{% - \global\advance\subsubsecno by 1 - \sectionheading{#1}{subsubsec}{Yappendix}% - {\appendixletter.\the\secno.\the\subsecno.\the\subsubsecno}% -} - -\outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}} %normally unnumberedsubsubseczzz -\def\unnumberedsubsubseczzz#1{% - \global\advance\subsubsecno by 1 - \sectionheading{#1}{subsubsec}{Ynothing}% - {\the\unnumberedno.\the\secno.\the\subsecno.\the\subsubsecno}% -} - -% These are variants which are not "outer", so they can appear in @ifinfo. -% Actually, they are now be obsolete; ordinary section commands should work. -\def\infotop{\parsearg\unnumberedzzz} -\def\infounnumbered{\parsearg\unnumberedzzz} -\def\infounnumberedsec{\parsearg\unnumberedseczzz} -\def\infounnumberedsubsec{\parsearg\unnumberedsubseczzz} -\def\infounnumberedsubsubsec{\parsearg\unnumberedsubsubseczzz} - -\def\infoappendix{\parsearg\appendixzzz} -\def\infoappendixsec{\parsearg\appendixseczzz} -\def\infoappendixsubsec{\parsearg\appendixsubseczzz} -\def\infoappendixsubsubsec{\parsearg\appendixsubsubseczzz} - -\def\infochapter{\parsearg\chapterzzz} -\def\infosection{\parsearg\sectionzzz} -\def\infosubsection{\parsearg\subsectionzzz} -\def\infosubsubsection{\parsearg\subsubsectionzzz} - -% These macros control what the section commands do, according -% to what kind of chapter we are in (ordinary, appendix, or unnumbered). -% Define them by default for a numbered chapter. -\let\section = \numberedsec -\let\subsection = \numberedsubsec -\let\subsubsection = \numberedsubsubsec - -% Define @majorheading, @heading and @subheading - -% NOTE on use of \vbox for chapter headings, section headings, and such: -% 1) We use \vbox rather than the earlier \line to permit -% overlong headings to fold. -% 2) \hyphenpenalty is set to 10000 because hyphenation in a -% heading is obnoxious; this forbids it. -% 3) Likewise, headings look best if no \parindent is used, and -% if justification is not attempted. Hence \raggedright. - - -\def\majorheading{% - {\advance\chapheadingskip by 10pt \chapbreak }% - \parsearg\chapheadingzzz -} - -\def\chapheading{\chapbreak \parsearg\chapheadingzzz} -\def\chapheadingzzz#1{% - {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 - \parindent=0pt\raggedright - \rm #1\hfill}}% - \bigskip \par\penalty 200\relax - \suppressfirstparagraphindent -} - -% @heading, @subheading, @subsubheading. -\parseargdef\heading{\sectionheading{#1}{sec}{Yomitfromtoc}{} - \suppressfirstparagraphindent} -\parseargdef\subheading{\sectionheading{#1}{subsec}{Yomitfromtoc}{} - \suppressfirstparagraphindent} -\parseargdef\subsubheading{\sectionheading{#1}{subsubsec}{Yomitfromtoc}{} - \suppressfirstparagraphindent} - -% These macros generate a chapter, section, etc. heading only -% (including whitespace, linebreaking, etc. around it), -% given all the information in convenient, parsed form. - -%%% Args are the skip and penalty (usually negative) -\def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi} - -\def\setchapterstyle #1 {\csname CHAPF#1\endcsname} - -%%% Define plain chapter starts, and page on/off switching for it -% Parameter controlling skip before chapter headings (if needed) - -\newskip\chapheadingskip - -\def\chapbreak{\dobreak \chapheadingskip {-4000}} -\def\chappager{\par\vfill\supereject} -\def\chapoddpage{\chappager \ifodd\pageno \else \hbox to 0pt{} \chappager\fi} - -\def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname} - -\def\CHAPPAGoff{% -\global\let\contentsalignmacro = \chappager -\global\let\pchapsepmacro=\chapbreak -\global\let\pagealignmacro=\chappager} - -\def\CHAPPAGon{% -\global\let\contentsalignmacro = \chappager -\global\let\pchapsepmacro=\chappager -\global\let\pagealignmacro=\chappager -\global\def\HEADINGSon{\HEADINGSsingle}} - -\def\CHAPPAGodd{% -\global\let\contentsalignmacro = \chapoddpage -\global\let\pchapsepmacro=\chapoddpage -\global\let\pagealignmacro=\chapoddpage -\global\def\HEADINGSon{\HEADINGSdouble}} - -\CHAPPAGon - -\def\CHAPFplain{% -\global\let\chapmacro=\chfplain -\global\let\centerchapmacro=\centerchfplain} - -% Normal chapter opening. -% -% #1 is the text, #2 is the section type (Ynumbered, Ynothing, -% Yappendix, Yomitfromtoc), #3 the chapter number. -% -% To test against our argument. -\def\Ynothingkeyword{Ynothing} -\def\Yomitfromtockeyword{Yomitfromtoc} -\def\Yappendixkeyword{Yappendix} -% -\def\chfplain#1#2#3{% - \pchapsepmacro - {% - \chapfonts \rm - % - % Have to define \thissection before calling \donoderef, because the - % xref code eventually uses it. On the other hand, it has to be called - % after \pchapsepmacro, or the headline will change too soon. - \gdef\thissection{#1}% - \gdef\thischaptername{#1}% - % - % Only insert the separating space if we have a chapter/appendix - % number, and don't print the unnumbered ``number''. - \def\temptype{#2}% - \ifx\temptype\Ynothingkeyword - \setbox0 = \hbox{}% - \def\toctype{unnchap}% - \def\thischapter{#1}% - \else\ifx\temptype\Yomitfromtockeyword - \setbox0 = \hbox{}% contents like unnumbered, but no toc entry - \def\toctype{omit}% - \xdef\thischapter{}% - \else\ifx\temptype\Yappendixkeyword - \setbox0 = \hbox{\putwordAppendix{} #3\enspace}% - \def\toctype{app}% - % We don't substitute the actual chapter name into \thischapter - % because we don't want its macros evaluated now. And we don't - % use \thissection because that changes with each section. - % - \xdef\thischapter{\putwordAppendix{} \appendixletter: - \noexpand\thischaptername}% - \else - \setbox0 = \hbox{#3\enspace}% - \def\toctype{numchap}% - \xdef\thischapter{\putwordChapter{} \the\chapno: - \noexpand\thischaptername}% - \fi\fi\fi - % - % Write the toc entry for this chapter. Must come before the - % \donoderef, because we include the current node name in the toc - % entry, and \donoderef resets it to empty. - \writetocentry{\toctype}{#1}{#3}% - % - % For pdftex, we have to write out the node definition (aka, make - % the pdfdest) after any page break, but before the actual text has - % been typeset. If the destination for the pdf outline is after the - % text, then jumping from the outline may wind up with the text not - % being visible, for instance under high magnification. - \donoderef{#2}% - % - % Typeset the actual heading. - \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright - \hangindent=\wd0 \centerparametersmaybe - \unhbox0 #1\par}% - }% - \nobreak\bigskip % no page break after a chapter title - \nobreak -} - -% @centerchap -- centered and unnumbered. -\let\centerparametersmaybe = \relax -\def\centerchfplain#1{{% - \def\centerparametersmaybe{% - \advance\rightskip by 3\rightskip - \leftskip = \rightskip - \parfillskip = 0pt - }% - \chfplain{#1}{Ynothing}{}% -}} - -\CHAPFplain % The default - -% I don't think this chapter style is supported any more, so I'm not -% updating it with the new noderef stuff. We'll see. --karl, 11aug03. -% -\def\unnchfopen #1{% -\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 - \parindent=0pt\raggedright - \rm #1\hfill}}\bigskip \par\nobreak -} - -\def\chfopen #1#2{\chapoddpage {\chapfonts -\vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}% -\par\penalty 5000 % -} - -\def\centerchfopen #1{% -\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 - \parindent=0pt - \hfill {\rm #1}\hfill}}\bigskip \par\nobreak -} - -\def\CHAPFopen{% -\global\let\chapmacro=\chfopen -\global\let\centerchapmacro=\centerchfopen} - - -% Section titles. These macros combine the section number parts and -% call the generic \sectionheading to do the printing. -% -\newskip\secheadingskip -\def\secheadingbreak{\dobreak \secheadingskip{-1000}} - -% Subsection titles. -\newskip\subsecheadingskip -\def\subsecheadingbreak{\dobreak \subsecheadingskip{-500}} - -% Subsubsection titles. -\def\subsubsecheadingskip{\subsecheadingskip} -\def\subsubsecheadingbreak{\subsecheadingbreak} - - -% Print any size, any type, section title. -% -% #1 is the text, #2 is the section level (sec/subsec/subsubsec), #3 is -% the section type for xrefs (Ynumbered, Ynothing, Yappendix), #4 is the -% section number. -% -\def\sectionheading#1#2#3#4{% - {% - % Switch to the right set of fonts. - \csname #2fonts\endcsname \rm - % - % Insert space above the heading. - \csname #2headingbreak\endcsname - % - % Only insert the space after the number if we have a section number. - \def\sectionlevel{#2}% - \def\temptype{#3}% - % - \ifx\temptype\Ynothingkeyword - \setbox0 = \hbox{}% - \def\toctype{unn}% - \gdef\thissection{#1}% - \else\ifx\temptype\Yomitfromtockeyword - % for @headings -- no section number, don't include in toc, - % and don't redefine \thissection. - \setbox0 = \hbox{}% - \def\toctype{omit}% - \let\sectionlevel=\empty - \else\ifx\temptype\Yappendixkeyword - \setbox0 = \hbox{#4\enspace}% - \def\toctype{app}% - \gdef\thissection{#1}% - \else - \setbox0 = \hbox{#4\enspace}% - \def\toctype{num}% - \gdef\thissection{#1}% - \fi\fi\fi - % - % Write the toc entry (before \donoderef). See comments in \chfplain. - \writetocentry{\toctype\sectionlevel}{#1}{#4}% - % - % Write the node reference (= pdf destination for pdftex). - % Again, see comments in \chfplain. - \donoderef{#3}% - % - % Output the actual section heading. - \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright - \hangindent=\wd0 % zero if no section number - \unhbox0 #1}% - }% - % Add extra space after the heading -- half of whatever came above it. - % Don't allow stretch, though. - \kern .5 \csname #2headingskip\endcsname - % - % Do not let the kern be a potential breakpoint, as it would be if it - % was followed by glue. - \nobreak - % - % We'll almost certainly start a paragraph next, so don't let that - % glue accumulate. (Not a breakpoint because it's preceded by a - % discardable item.) - \vskip-\parskip - % - % This \nobreak is purely so the last item on the list is a \penalty - % of 10000. This is so other code, for instance \parsebodycommon, can - % check for and avoid allowing breakpoints. Otherwise, it would - % insert a valid breakpoint between: - % @section sec-whatever - % @deffn def-whatever - \nobreak -} - - -\message{toc,} -% Table of contents. -\newwrite\tocfile - -% Write an entry to the toc file, opening it if necessary. -% Called from @chapter, etc. -% -% Example usage: \writetocentry{sec}{Section Name}{\the\chapno.\the\secno} -% We append the current node name (if any) and page number as additional -% arguments for the \{chap,sec,...}entry macros which will eventually -% read this. The node name is used in the pdf outlines as the -% destination to jump to. -% -% We open the .toc file for writing here instead of at @setfilename (or -% any other fixed time) so that @contents can be anywhere in the document. -% But if #1 is `omit', then we don't do anything. This is used for the -% table of contents chapter openings themselves. -% -\newif\iftocfileopened -\def\omitkeyword{omit}% -% -\def\writetocentry#1#2#3{% - \edef\writetoctype{#1}% - \ifx\writetoctype\omitkeyword \else - \iftocfileopened\else - \immediate\openout\tocfile = \jobname.toc - \global\tocfileopenedtrue - \fi - % - \iflinks - \toks0 = {#2}% - \toks2 = \expandafter{\lastnode}% - \edef\temp{\write\tocfile{\realbackslash #1entry{\the\toks0}{#3}% - {\the\toks2}{\noexpand\folio}}}% - \temp - \fi - \fi - % - % Tell \shipout to create a pdf destination on each page, if we're - % writing pdf. These are used in the table of contents. We can't - % just write one on every page because the title pages are numbered - % 1 and 2 (the page numbers aren't printed), and so are the first - % two pages of the document. Thus, we'd have two destinations named - % `1', and two named `2'. - \ifpdf \global\pdfmakepagedesttrue \fi -} - -\newskip\contentsrightmargin \contentsrightmargin=1in -\newcount\savepageno -\newcount\lastnegativepageno \lastnegativepageno = -1 - -% Prepare to read what we've written to \tocfile. -% -\def\startcontents#1{% - % If @setchapternewpage on, and @headings double, the contents should - % start on an odd page, unlike chapters. Thus, we maintain - % \contentsalignmacro in parallel with \pagealignmacro. - % From: Torbjorn Granlund - \contentsalignmacro - \immediate\closeout\tocfile - % - % Don't need to put `Contents' or `Short Contents' in the headline. - % It is abundantly clear what they are. - \def\thischapter{}% - \chapmacro{#1}{Yomitfromtoc}{}% - % - \savepageno = \pageno - \begingroup % Set up to handle contents files properly. - \catcode`\\=0 \catcode`\{=1 \catcode`\}=2 \catcode`\@=11 - % We can't do this, because then an actual ^ in a section - % title fails, e.g., @chapter ^ -- exponentiation. --karl, 9jul97. - %\catcode`\^=7 % to see ^^e4 as \"a etc. juha@piuha.ydi.vtt.fi - \raggedbottom % Worry more about breakpoints than the bottom. - \advance\hsize by -\contentsrightmargin % Don't use the full line length. - % - % Roman numerals for page numbers. - \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi -} - - -% Normal (long) toc. -\def\contents{% - \startcontents{\putwordTOC}% - \openin 1 \jobname.toc - \ifeof 1 \else - \input \jobname.toc - \fi - \vfill \eject - \contentsalignmacro % in case @setchapternewpage odd is in effect - \ifeof 1 \else - \pdfmakeoutlines - \fi - \closein 1 - \endgroup - \lastnegativepageno = \pageno - \global\pageno = \savepageno -} - -% And just the chapters. -\def\summarycontents{% - \startcontents{\putwordShortTOC}% - % - \let\numchapentry = \shortchapentry - \let\appentry = \shortchapentry - \let\unnchapentry = \shortunnchapentry - % We want a true roman here for the page numbers. - \secfonts - \let\rm=\shortcontrm \let\bf=\shortcontbf - \let\sl=\shortcontsl \let\tt=\shortconttt - \rm - \hyphenpenalty = 10000 - \advance\baselineskip by 1pt % Open it up a little. - \def\numsecentry##1##2##3##4{} - \let\appsecentry = \numsecentry - \let\unnsecentry = \numsecentry - \let\numsubsecentry = \numsecentry - \let\appsubsecentry = \numsecentry - \let\unnsubsecentry = \numsecentry - \let\numsubsubsecentry = \numsecentry - \let\appsubsubsecentry = \numsecentry - \let\unnsubsubsecentry = \numsecentry - \openin 1 \jobname.toc - \ifeof 1 \else - \input \jobname.toc - \fi - \closein 1 - \vfill \eject - \contentsalignmacro % in case @setchapternewpage odd is in effect - \endgroup - \lastnegativepageno = \pageno - \global\pageno = \savepageno -} -\let\shortcontents = \summarycontents - -% Typeset the label for a chapter or appendix for the short contents. -% The arg is, e.g., `A' for an appendix, or `3' for a chapter. -% -\def\shortchaplabel#1{% - % This space should be enough, since a single number is .5em, and the - % widest letter (M) is 1em, at least in the Computer Modern fonts. - % But use \hss just in case. - % (This space doesn't include the extra space that gets added after - % the label; that gets put in by \shortchapentry above.) - % - % We'd like to right-justify chapter numbers, but that looks strange - % with appendix letters. And right-justifying numbers and - % left-justifying letters looks strange when there is less than 10 - % chapters. Have to read the whole toc once to know how many chapters - % there are before deciding ... - \hbox to 1em{#1\hss}% -} - -% These macros generate individual entries in the table of contents. -% The first argument is the chapter or section name. -% The last argument is the page number. -% The arguments in between are the chapter number, section number, ... - -% Chapters, in the main contents. -\def\numchapentry#1#2#3#4{\dochapentry{#2\labelspace#1}{#4}} -% -% Chapters, in the short toc. -% See comments in \dochapentry re vbox and related settings. -\def\shortchapentry#1#2#3#4{% - \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#4\egroup}% -} - -% Appendices, in the main contents. -% Need the word Appendix, and a fixed-size box. -% -\def\appendixbox#1{% - % We use M since it's probably the widest letter. - \setbox0 = \hbox{\putwordAppendix{} M}% - \hbox to \wd0{\putwordAppendix{} #1\hss}} -% -\def\appentry#1#2#3#4{\dochapentry{\appendixbox{#2}\labelspace#1}{#4}} - -% Unnumbered chapters. -\def\unnchapentry#1#2#3#4{\dochapentry{#1}{#4}} -\def\shortunnchapentry#1#2#3#4{\tocentry{#1}{\doshortpageno\bgroup#4\egroup}} - -% Sections. -\def\numsecentry#1#2#3#4{\dosecentry{#2\labelspace#1}{#4}} -\let\appsecentry=\numsecentry -\def\unnsecentry#1#2#3#4{\dosecentry{#1}{#4}} - -% Subsections. -\def\numsubsecentry#1#2#3#4{\dosubsecentry{#2\labelspace#1}{#4}} -\let\appsubsecentry=\numsubsecentry -\def\unnsubsecentry#1#2#3#4{\dosubsecentry{#1}{#4}} - -% And subsubsections. -\def\numsubsubsecentry#1#2#3#4{\dosubsubsecentry{#2\labelspace#1}{#4}} -\let\appsubsubsecentry=\numsubsubsecentry -\def\unnsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{#4}} - -% This parameter controls the indentation of the various levels. -\newdimen\tocindent \tocindent = 2pc - -% Now for the actual typesetting. In all these, #1 is the text and #2 is the -% page number. -% -% If the toc has to be broken over pages, we want it to be at chapters -% if at all possible; hence the \penalty. -\def\dochapentry#1#2{% - \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip - \begingroup - \chapentryfonts - \tocentry{#1}{\dopageno\bgroup#2\egroup}% - \endgroup - \nobreak\vskip .25\baselineskip plus.1\baselineskip -} - -\def\dosecentry#1#2{\begingroup - \secentryfonts \leftskip=\tocindent - \tocentry{#1}{\dopageno\bgroup#2\egroup}% -\endgroup} - -\def\dosubsecentry#1#2{\begingroup - \subsecentryfonts \leftskip=2\tocindent - \tocentry{#1}{\dopageno\bgroup#2\egroup}% -\endgroup} - -\def\dosubsubsecentry#1#2{\begingroup - \subsubsecentryfonts \leftskip=3\tocindent - \tocentry{#1}{\dopageno\bgroup#2\egroup}% -\endgroup} - -% We use the same \entry macro as for the index entries. -\let\tocentry = \entry - -% Space between chapter (or whatever) number and the title. -\def\labelspace{\hskip1em \relax} - -\def\dopageno#1{{\rm #1}} -\def\doshortpageno#1{{\rm #1}} - -\def\chapentryfonts{\secfonts \rm} -\def\secentryfonts{\textfonts} -\def\subsecentryfonts{\textfonts} -\def\subsubsecentryfonts{\textfonts} - - -\message{environments,} -% @foo ... @end foo. - -% @point{}, @result{}, @expansion{}, @print{}, @equiv{}. -% -% Since these characters are used in examples, it should be an even number of -% \tt widths. Each \tt character is 1en, so two makes it 1em. -% -\def\point{$\star$} -\def\result{\leavevmode\raise.15ex\hbox to 1em{\hfil$\Rightarrow$\hfil}} -\def\expansion{\leavevmode\raise.1ex\hbox to 1em{\hfil$\mapsto$\hfil}} -\def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}} -\def\equiv{\leavevmode\lower.1ex\hbox to 1em{\hfil$\ptexequiv$\hfil}} - -% The @error{} command. -% Adapted from the TeXbook's \boxit. -% -\newbox\errorbox -% -{\tentt \global\dimen0 = 3em}% Width of the box. -\dimen2 = .55pt % Thickness of rules -% The text. (`r' is open on the right, `e' somewhat less so on the left.) -\setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt} -% -\setbox\errorbox=\hbox to \dimen0{\hfil - \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right. - \advance\hsize by -2\dimen2 % Rules. - \vbox{% - \hrule height\dimen2 - \hbox{\vrule width\dimen2 \kern3pt % Space to left of text. - \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below. - \kern3pt\vrule width\dimen2}% Space to right. - \hrule height\dimen2} - \hfil} -% -\def\error{\leavevmode\lower.7ex\copy\errorbox} - -% @tex ... @end tex escapes into raw Tex temporarily. -% One exception: @ is still an escape character, so that @end tex works. -% But \@ or @@ will get a plain tex @ character. - -\envdef\tex{% - \catcode `\\=0 \catcode `\{=1 \catcode `\}=2 - \catcode `\$=3 \catcode `\&=4 \catcode `\#=6 - \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie - \catcode `\%=14 - \catcode `\+=\other - \catcode `\"=\other - \catcode `\|=\other - \catcode `\<=\other - \catcode `\>=\other - \escapechar=`\\ - % - \let\b=\ptexb - \let\bullet=\ptexbullet - \let\c=\ptexc - \let\,=\ptexcomma - \let\.=\ptexdot - \let\dots=\ptexdots - \let\equiv=\ptexequiv - \let\!=\ptexexclam - \let\i=\ptexi - \let\indent=\ptexindent - \let\noindent=\ptexnoindent - \let\{=\ptexlbrace - \let\+=\tabalign - \let\}=\ptexrbrace - \let\/=\ptexslash - \let\*=\ptexstar - \let\t=\ptext - % - \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}% - \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}% - \def\@{@}% -} -% There is no need to define \Etex. - -% Define @lisp ... @end lisp. -% @lisp environment forms a group so it can rebind things, -% including the definition of @end lisp (which normally is erroneous). - -% Amount to narrow the margins by for @lisp. -\newskip\lispnarrowing \lispnarrowing=0.4in - -% This is the definition that ^^M gets inside @lisp, @example, and other -% such environments. \null is better than a space, since it doesn't -% have any width. -\def\lisppar{\null\endgraf} - -% This space is always present above and below environments. -\newskip\envskipamount \envskipamount = 0pt - -% Make spacing and below environment symmetrical. We use \parskip here -% to help in doing that, since in @example-like environments \parskip -% is reset to zero; thus the \afterenvbreak inserts no space -- but the -% start of the next paragraph will insert \parskip. -% -\def\aboveenvbreak{{% - % =10000 instead of <10000 because of a special case in \itemzzz, q.v. - \ifnum \lastpenalty=10000 \else - \advance\envskipamount by \parskip - \endgraf - \ifdim\lastskip<\envskipamount - \removelastskip - % it's not a good place to break if the last penalty was \nobreak - % or better ... - \ifnum\lastpenalty>10000 \else \penalty-50 \fi - \vskip\envskipamount - \fi - \fi -}} - -\let\afterenvbreak = \aboveenvbreak - -% \nonarrowing is a flag. If "set", @lisp etc don't narrow margins. -\let\nonarrowing=\relax - -% @cartouche ... @end cartouche: draw rectangle w/rounded corners around -% environment contents. -\font\circle=lcircle10 -\newdimen\circthick -\newdimen\cartouter\newdimen\cartinner -\newskip\normbskip\newskip\normpskip\newskip\normlskip -\circthick=\fontdimen8\circle -% -\def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth -\def\ctr{{\hskip 6pt\circle\char'010}} -\def\cbl{{\circle\char'012\hskip -6pt}} -\def\cbr{{\hskip 6pt\circle\char'011}} -\def\carttop{\hbox to \cartouter{\hskip\lskip - \ctl\leaders\hrule height\circthick\hfil\ctr - \hskip\rskip}} -\def\cartbot{\hbox to \cartouter{\hskip\lskip - \cbl\leaders\hrule height\circthick\hfil\cbr - \hskip\rskip}} -% -\newskip\lskip\newskip\rskip - -\envdef\cartouche{% - \ifhmode\par\fi % can't be in the midst of a paragraph. - \startsavinginserts - \lskip=\leftskip \rskip=\rightskip - \leftskip=0pt\rightskip=0pt % we want these *outside*. - \cartinner=\hsize \advance\cartinner by-\lskip - \advance\cartinner by-\rskip - \cartouter=\hsize - \advance\cartouter by 18.4pt % allow for 3pt kerns on either - % side, and for 6pt waste from - % each corner char, and rule thickness - \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip - % Flag to tell @lisp, etc., not to narrow margin. - \let\nonarrowing=\comment - \vbox\bgroup - \baselineskip=0pt\parskip=0pt\lineskip=0pt - \carttop - \hbox\bgroup - \hskip\lskip - \vrule\kern3pt - \vbox\bgroup - \kern3pt - \hsize=\cartinner - \baselineskip=\normbskip - \lineskip=\normlskip - \parskip=\normpskip - \vskip -\parskip - \comment % For explanation, see the end of \def\group. -} -\def\Ecartouche{% - \ifhmode\par\fi - \kern3pt - \egroup - \kern3pt\vrule - \hskip\rskip - \egroup - \cartbot - \egroup - \checkinserts -} - - -% This macro is called at the beginning of all the @example variants, -% inside a group. -\def\nonfillstart{% - \aboveenvbreak - \hfuzz = 12pt % Don't be fussy - \sepspaces % Make spaces be word-separators rather than space tokens. - \let\par = \lisppar % don't ignore blank lines - \obeylines % each line of input is a line of output - \parskip = 0pt - \parindent = 0pt - \emergencystretch = 0pt % don't try to avoid overfull boxes - % @cartouche defines \nonarrowing to inhibit narrowing - % at next level down. - \ifx\nonarrowing\relax - \advance \leftskip by \lispnarrowing - \exdentamount=\lispnarrowing - \fi - \let\exdent=\nofillexdent -} - -% If you want all examples etc. small: @set dispenvsize small. -% If you want even small examples the full size: @set dispenvsize nosmall. -% This affects the following displayed environments: -% @example, @display, @format, @lisp -% -\def\smallword{small} -\def\nosmallword{nosmall} -\let\SETdispenvsize\relax -\def\setnormaldispenv{% - \ifx\SETdispenvsize\smallword - \smallexamplefonts \rm - \fi -} -\def\setsmalldispenv{% - \ifx\SETdispenvsize\nosmallword - \else - \smallexamplefonts \rm - \fi -} - -% We often define two environments, @foo and @smallfoo. -% Let's do it by one command: -\def\makedispenv #1#2{ - \expandafter\envdef\csname#1\endcsname {\setnormaldispenv #2} - \expandafter\envdef\csname small#1\endcsname {\setsmalldispenv #2} - \expandafter\let\csname E#1\endcsname \afterenvbreak - \expandafter\let\csname Esmall#1\endcsname \afterenvbreak -} - -% Define two synonyms: -\def\maketwodispenvs #1#2#3{ - \makedispenv{#1}{#3} - \makedispenv{#2}{#3} -} - -% @lisp: indented, narrowed, typewriter font; @example: same as @lisp. -% -% @smallexample and @smalllisp: use smaller fonts. -% Originally contributed by Pavel@xerox. -% -\maketwodispenvs {lisp}{example}{% - \nonfillstart - \tt - \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special. - \gobble % eat return -} - -% @display/@smalldisplay: same as @lisp except keep current font. -% -\makedispenv {display}{% - \nonfillstart - \gobble -} - -% @format/@smallformat: same as @display except don't narrow margins. -% -\makedispenv{format}{% - \let\nonarrowing = t% - \nonfillstart - \gobble -} - -% @flushleft: same as @format, but doesn't obey \SETdispenvsize. -\envdef\flushleft{% - \let\nonarrowing = t% - \nonfillstart - \gobble -} -\let\Eflushleft = \afterenvbreak - -% @flushright. -% -\envdef\flushright{% - \let\nonarrowing = t% - \nonfillstart - \advance\leftskip by 0pt plus 1fill - \gobble -} -\let\Eflushright = \afterenvbreak - - -% @quotation does normal linebreaking (hence we can't use \nonfillstart) -% and narrows the margins. -% -\envdef\quotation{% - {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip - \parindent=0pt - % - % @cartouche defines \nonarrowing to inhibit narrowing at next level down. - \ifx\nonarrowing\relax - \advance\leftskip by \lispnarrowing - \advance\rightskip by \lispnarrowing - \exdentamount = \lispnarrowing - \let\nonarrowing = \relax - \fi - \parsearg\quotationlabel -} - -% We have retained a nonzero parskip for the environment, since we're -% doing normal filling. So to avoid extra space below the environment... -\def\Equotation{\parskip = 0pt \afterenvbreak} - -% If we're given an argument, typeset it in bold with a colon after. -\def\quotationlabel#1{% - \def\temp{#1}% - \ifx\temp\empty \else - {\bf #1: }% - \fi -} - - -% LaTeX-like @verbatim...@end verbatim and @verb{...} -% If we want to allow any as delimiter, -% we need the curly braces so that makeinfo sees the @verb command, eg: -% `@verbx...x' would look like the '@verbx' command. --janneke@gnu.org -% -% [Knuth]: Donald Ervin Knuth, 1996. The TeXbook. -% -% [Knuth] p.344; only we need to do the other characters Texinfo sets -% active too. Otherwise, they get lost as the first character on a -% verbatim line. -\def\dospecials{% - \do\ \do\\\do\{\do\}\do\$\do\&% - \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~% - \do\<\do\>\do\|\do\@\do+\do\"% -} -% -% [Knuth] p. 380 -\def\uncatcodespecials{% - \def\do##1{\catcode`##1=\other}\dospecials} -% -% [Knuth] pp. 380,381,391 -% Disable Spanish ligatures ?` and !` of \tt font -\begingroup - \catcode`\`=\active\gdef`{\relax\lq} -\endgroup -% -% Setup for the @verb command. -% -% Eight spaces for a tab -\begingroup - \catcode`\^^I=\active - \gdef\tabeightspaces{\catcode`\^^I=\active\def^^I{\ \ \ \ \ \ \ \ }} -\endgroup -% -\def\setupverb{% - \tt % easiest (and conventionally used) font for verbatim - \def\par{\leavevmode\endgraf}% - \catcode`\`=\active - \tabeightspaces - % Respect line breaks, - % print special symbols as themselves, and - % make each space count - % must do in this order: - \obeylines \uncatcodespecials \sepspaces -} - -% Setup for the @verbatim environment -% -% Real tab expansion -\newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount -% -\def\starttabbox{\setbox0=\hbox\bgroup} -\begingroup - \catcode`\^^I=\active - \gdef\tabexpand{% - \catcode`\^^I=\active - \def^^I{\leavevmode\egroup - \dimen0=\wd0 % the width so far, or since the previous tab - \divide\dimen0 by\tabw - \multiply\dimen0 by\tabw % compute previous multiple of \tabw - \advance\dimen0 by\tabw % advance to next multiple of \tabw - \wd0=\dimen0 \box0 \starttabbox - }% - } -\endgroup -\def\setupverbatim{% - \nonfillstart - \advance\leftskip by -\defbodyindent - % Easiest (and conventionally used) font for verbatim - \tt - \def\par{\leavevmode\egroup\box0\endgraf}% - \catcode`\`=\active - \tabexpand - % Respect line breaks, - % print special symbols as themselves, and - % make each space count - % must do in this order: - \obeylines \uncatcodespecials \sepspaces - \everypar{\starttabbox}% -} - -% Do the @verb magic: verbatim text is quoted by unique -% delimiter characters. Before first delimiter expect a -% right brace, after last delimiter expect closing brace: -% -% \def\doverb'{'#1'}'{#1} -% -% [Knuth] p. 382; only eat outer {} -\begingroup - \catcode`[=1\catcode`]=2\catcode`\{=\other\catcode`\}=\other - \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next] -\endgroup -% -\def\verb{\begingroup\setupverb\doverb} -% -% -% Do the @verbatim magic: define the macro \doverbatim so that -% the (first) argument ends when '@end verbatim' is reached, ie: -% -% \def\doverbatim#1@end verbatim{#1} -% -% For Texinfo it's a lot easier than for LaTeX, -% because texinfo's \verbatim doesn't stop at '\end{verbatim}': -% we need not redefine '\', '{' and '}'. -% -% Inspired by LaTeX's verbatim command set [latex.ltx] -% -\begingroup - \catcode`\ =\active - \obeylines % - % ignore everything up to the first ^^M, that's the newline at the end - % of the @verbatim input line itself. Otherwise we get an extra blank - % line in the output. - \xdef\doverbatim#1^^M#2@end verbatim{#2\noexpand\end\gobble verbatim}% - % We really want {...\end verbatim} in the body of the macro, but - % without the active space; thus we have to use \xdef and \gobble. -\endgroup -% -\envdef\verbatim{% - \setupverbatim\doverbatim -} -\let\Everbatim = \afterenvbreak - - -% @verbatiminclude FILE - insert text of file in verbatim environment. -% -\def\verbatiminclude{\parseargusing\filenamecatcodes\doverbatiminclude} -% -\def\doverbatiminclude#1{% - {% - \makevalueexpandable - \setupverbatim - \input #1 - \afterenvbreak - }% -} - -% @copying ... @end copying. -% Save the text away for @insertcopying later. Many commands won't be -% allowed in this context, but that's ok. -% -% We save the uninterpreted tokens, rather than creating a box. -% Saving the text in a box would be much easier, but then all the -% typesetting commands (@smallbook, font changes, etc.) have to be done -% beforehand -- and a) we want @copying to be done first in the source -% file; b) letting users define the frontmatter in as flexible order as -% possible is very desirable. -% -\def\copying{\begingroup - % Define a command to swallow text until we reach `@end copying'. - % \ is the escape char in this texinfo.tex file, so it is the - % delimiter for the command; @ will be the escape char when we read - % it, but that doesn't matter. - \long\def\docopying##1\end copying{\gdef\copyingtext{##1}\enddocopying}% - % - % We must preserve ^^M's in the input file; see \insertcopying below. - \catcode`\^^M = \active - \docopying -} - -% What we do to finish off the copying text. -% -\def\enddocopying{\endgroup\ignorespaces} - -% @insertcopying. Here we must play games with ^^M's. On the one hand, -% we need them to delimit commands such as `@end quotation', so they -% must be active. On the other hand, we certainly don't want every -% end-of-line to be a \par, as would happen with the normal active -% definition of ^^M. On the third hand, two ^^M's in a row should still -% generate a \par. -% -% Our approach is to make ^^M insert a space and a penalty1 normally; -% then it can also check if \lastpenalty=1. If it does, then manually -% do \par. -% -% This messes up the normal definitions of @c[omment], so we redefine -% it. Similarly for @ignore. (These commands are used in the gcc -% manual for man page generation.) -% -% Seems pretty fragile, most line-oriented commands will presumably -% fail, but for the limited use of getting the copying text (which -% should be quite simple) inserted, we can hope it's ok. -% -{\catcode`\^^M=\active % -\gdef\insertcopying{\begingroup % - \parindent = 0pt % looks wrong on title page - \def^^M{% - \ifnum \lastpenalty=1 % - \par % - \else % - \space \penalty 1 % - \fi % - }% - % - % Fix @c[omment] for catcode 13 ^^M's. - \def\c##1^^M{\ignorespaces}% - \let\comment = \c % - % - % Don't bother jumping through all the hoops that \doignore does, it - % would be very hard since the catcodes are already set. - \long\def\ignore##1\end ignore{\ignorespaces}% - % - \copyingtext % -\endgroup}% -} - -\message{defuns,} -% @defun etc. - -\newskip\defbodyindent \defbodyindent=.4in -\newskip\defargsindent \defargsindent=50pt -\newskip\deflastargmargin \deflastargmargin=18pt - -% Start the processing of @deffn: -\def\startdefun{% - \ifnum\lastpenalty<10000 - \medbreak - \else - % If there are two @def commands in a row, we'll have a \nobreak, - % which is there to keep the function description together with its - % header. But if there's nothing but headers, we need to allow a - % break somewhere. Check for penalty 10002 (inserted by - % \defargscommonending) instead of 10000, since the sectioning - % commands insert a \penalty10000, and we don't want to allow a break - % between a section heading and a defun. - \ifnum\lastpenalty=10002 \penalty2000 \fi - % - % Similarly, after a section heading, do not allow a break. - % But do insert the glue. - \medskip % preceded by discardable penalty, so not a breakpoint - \fi - % - \parindent=0in - \advance\leftskip by \defbodyindent - \exdentamount=\defbodyindent -} - -\def\dodefunx#1{% - % First, check whether we are in the right environment: - \checkenv#1% - % - % As above, allow line break if we have multiple x headers in a row. - % It's not a great place, though. - \ifnum\lastpenalty=10002 \penalty3000 \fi - % - % And now, it's time to reuse the body of the original defun: - \expandafter\gobbledefun#1% -} -\def\gobbledefun#1\startdefun{} - -% \printdefunline \deffnheader{text} -% -\def\printdefunline#1#2{% - \begingroup - % call \deffnheader: - #1#2 \endheader - % common ending: - \interlinepenalty = 10000 - \advance\rightskip by 0pt plus 1fil - \endgraf - \nobreak\vskip -\parskip - \penalty 10002 % signal to \startdefun and \dodefunx - % Some of the @defun-type tags do not enable magic parentheses, - % rendering the following check redundant. But we don't optimize. - \checkparencounts - \endgroup -} - -\def\Edefun{\endgraf\medbreak} - -% \makedefun{deffn} creates \deffn, \deffnx and \Edeffn; -% the only thing remainnig is to define \deffnheader. -% -\def\makedefun#1{% - \expandafter\let\csname E#1\endcsname = \Edefun - \edef\temp{\noexpand\domakedefun - \makecsname{#1}\makecsname{#1x}\makecsname{#1header}}% - \temp -} - -% \domakedefun \deffn \deffnx \deffnheader -% -% Define \deffn and \deffnx, without parameters. -% \deffnheader has to be defined explicitly. -% -\def\domakedefun#1#2#3{% - \envdef#1{% - \startdefun - \parseargusing\activeparens{\printdefunline#3}% - }% - \def#2{\dodefunx#1}% - \def#3% -} - -%%% Untyped functions: - -% @deffn category name args -\makedefun{deffn}{\deffngeneral{}} - -% @deffn category class name args -\makedefun{defop}#1 {\defopon{#1\ \putwordon}} - -% \defopon {category on}class name args -\def\defopon#1#2 {\deffngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} } - -% \deffngeneral {subind}category name args -% -\def\deffngeneral#1#2 #3 #4\endheader{% - % Remember that \dosubin{fn}{xxx}{} is equivalent to \doind{fn}{xxx}. - \dosubind{fn}{\code{#3}}{#1}% - \defname{#2}{}{#3}\magicamp\defunargs{#4\unskip}% -} - -%%% Typed functions: - -% @deftypefn category type name args -\makedefun{deftypefn}{\deftypefngeneral{}} - -% @deftypeop category class type name args -\makedefun{deftypeop}#1 {\deftypeopon{#1\ \putwordon}} - -% \deftypeopon {category on}class type name args -\def\deftypeopon#1#2 {\deftypefngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} } - -% \deftypefngeneral {subind}category type name args -% -\def\deftypefngeneral#1#2 #3 #4 #5\endheader{% - \dosubind{fn}{\code{#4}}{#1}% - \defname{#2}{#3}{#4}\defunargs{#5\unskip}% -} - -%%% Typed variables: - -% @deftypevr category type var args -\makedefun{deftypevr}{\deftypecvgeneral{}} - -% @deftypecv category class type var args -\makedefun{deftypecv}#1 {\deftypecvof{#1\ \putwordof}} - -% \deftypecvof {category of}class type var args -\def\deftypecvof#1#2 {\deftypecvgeneral{\putwordof\ \code{#2}}{#1\ \code{#2}} } - -% \deftypecvgeneral {subind}category type var args -% -\def\deftypecvgeneral#1#2 #3 #4 #5\endheader{% - \dosubind{vr}{\code{#4}}{#1}% - \defname{#2}{#3}{#4}\defunargs{#5\unskip}% -} - -%%% Untyped variables: - -% @defvr category var args -\makedefun{defvr}#1 {\deftypevrheader{#1} {} } - -% @defcv category class var args -\makedefun{defcv}#1 {\defcvof{#1\ \putwordof}} - -% \defcvof {category of}class var args -\def\defcvof#1#2 {\deftypecvof{#1}#2 {} } - -%%% Type: -% @deftp category name args -\makedefun{deftp}#1 #2 #3\endheader{% - \doind{tp}{\code{#2}}% - \defname{#1}{}{#2}\defunargs{#3\unskip}% -} - -% Remaining @defun-like shortcuts: -\makedefun{defun}{\deffnheader{\putwordDeffunc} } -\makedefun{defmac}{\deffnheader{\putwordDefmac} } -\makedefun{defspec}{\deffnheader{\putwordDefspec} } -\makedefun{deftypefun}{\deftypefnheader{\putwordDeffunc} } -\makedefun{defvar}{\defvrheader{\putwordDefvar} } -\makedefun{defopt}{\defvrheader{\putwordDefopt} } -\makedefun{deftypevar}{\deftypevrheader{\putwordDefvar} } -\makedefun{defmethod}{\defopon\putwordMethodon} -\makedefun{deftypemethod}{\deftypeopon\putwordMethodon} -\makedefun{defivar}{\defcvof\putwordInstanceVariableof} -\makedefun{deftypeivar}{\deftypecvof\putwordInstanceVariableof} - -% \defname, which formats the name of the @def (not the args). -% #1 is the category, such as "Function". -% #2 is the return type, if any. -% #3 is the function name. -% -% We are followed by (but not passed) the arguments, if any. -% -\def\defname#1#2#3{% - % Get the values of \leftskip and \rightskip as they were outside the @def... - \advance\leftskip by -\defbodyindent - % - % How we'll format the type name. Putting it in brackets helps - % distinguish it from the body text that may end up on the next line - % just below it. - \def\temp{#1}% - \setbox0=\hbox{\kern\deflastargmargin \ifx\temp\empty\else [\rm\temp]\fi} - % - % Figure out line sizes for the paragraph shape. - % The first line needs space for \box0; but if \rightskip is nonzero, - % we need only space for the part of \box0 which exceeds it: - \dimen0=\hsize \advance\dimen0 by -\wd0 \advance\dimen0 by \rightskip - % The continuations: - \dimen2=\hsize \advance\dimen2 by -\defargsindent - % (plain.tex says that \dimen1 should be used only as global.) - \parshape 2 0in \dimen0 \defargsindent \dimen2 - % - % Put the type name to the right margin. - \noindent - \hbox to 0pt{% - \hfil\box0 \kern-\hsize - % \hsize has to be shortened this way: - \kern\leftskip - % Intentionally do not respect \rightskip, since we need the space. - }% - % - % Allow all lines to be underfull without complaint: - \tolerance=10000 \hbadness=10000 - \exdentamount=\defbodyindent - {% - % defun fonts. We use typewriter by default (used to be bold) because: - % . we're printing identifiers, they should be in tt in principle. - % . in languages with many accents, such as Czech or French, it's - % common to leave accents off identifiers. The result looks ok in - % tt, but exceedingly strange in rm. - % . we don't want -- and --- to be treated as ligatures. - % . this still does not fix the ?` and !` ligatures, but so far no - % one has made identifiers using them :). - \df \tt - \def\temp{#2}% return value type - \ifx\temp\empty\else \tclose{\temp} \fi - #3% output function name - }% - {\rm\enskip}% hskip 0.5 em of \tenrm - % - \boldbrax - % arguments will be output next, if any. -} - -% Print arguments in slanted typewriter, prevent hyphenation at `-' chars. -% -\def\defunargs#1{% - % use sl by default (not ttsl), inconsistently with using tt for the - % name. This is because literal text is sometimes needed in the - % argument list (groff manual), and ttsl and tt are not very - % distinguishable. - % tt for the names. - \df \sl \hyphenchar\font=0 - % On the other hand, if an argument has two dashes (for instance), we - % want a way to get ttsl. Let's try @var for that. - \let\var=\ttslanted - #1% - \sl\hyphenchar\font=45 -} - -% We want ()&[] to print specially on the defun line. -% -\def\activeparens{% - \catcode`\(=\active \catcode`\)=\active - \catcode`\[=\active \catcode`\]=\active - \catcode`\&=\active -} - -% Make control sequences which act like normal parenthesis chars. -\let\lparen = ( \let\rparen = ) - -% Be sure that we always have a definition for `(', etc. For example, -% if the fn name has parens in it, \boldbrax will not be in effect yet, -% so TeX would otherwise complain about undefined control sequence. -{ - \activeparens - \global\let(=\lparen \global\let)=\rparen - \global\let[=\lbrack \global\let]=\rbrack - \global\let& = \& - - \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb} - \gdef\magicamp{\let&=\amprm} -} - -\newcount\parencount - -% If we encounter &foo, then turn on ()-hacking afterwards -\newif\ifampseen -\def\amprm#1 {\ampseentrue{\bf\ }} - -\def\parenfont{% - \ifampseen - % At the first level, print parens in roman, - % otherwise use the default font. - \ifnum \parencount=1 \rm \fi - \else - % The \sf parens (in \boldbrax) actually are a little bolder than - % the contained text. This is especially needed for [ and ] . - \sf - \fi -} -\def\infirstlevel#1{% - \ifampseen - \ifnum\parencount=1 - #1% - \fi - \fi -} -\def\bfafterword#1 {#1 \bf} - -\def\opnr{% - \global\advance\parencount by 1 - {\parenfont(}% - \infirstlevel \bfafterword -} -\def\clnr{% - {\parenfont)}% - \infirstlevel \sl - \global\advance\parencount by -1 -} - -\newcount\brackcount -\def\lbrb{% - \global\advance\brackcount by 1 - {\bf[}% -} -\def\rbrb{% - {\bf]}% - \global\advance\brackcount by -1 -} - -\def\checkparencounts{% - \ifnum\parencount=0 \else \badparencount \fi - \ifnum\brackcount=0 \else \badbrackcount \fi -} -\def\badparencount{% - \errmessage{Unbalanced parentheses in @def}% - \global\parencount=0 -} -\def\badbrackcount{% - \errmessage{Unbalanced square braces in @def}% - \global\brackcount=0 -} - - -\message{macros,} -% @macro. - -% To do this right we need a feature of e-TeX, \scantokens, -% which we arrange to emulate with a temporary file in ordinary TeX. -\ifx\eTeXversion\undefined - \newwrite\macscribble - \def\scantokens#1{% - \toks0={#1\endinput}% - \immediate\openout\macscribble=\jobname.tmp - \immediate\write\macscribble{\the\toks0}% - \immediate\closeout\macscribble - \input \jobname.tmp - } -\fi - -\def\scanmacro#1{% - \begingroup - \newlinechar`\^^M - \let\xeatspaces\eatspaces - % Undo catcode changes of \startcontents and \doprintindex - \catcode`\@=0 \catcode`\\=\other \escapechar=`\@ - % ... and \example - \spaceisspace - % - % Append \endinput to make sure that TeX does not see the ending newline. - % - % I've verified that it is necessary both for e-TeX and for ordinary TeX - % --kasal, 29nov03 - \scantokens{#1\endinput}% - \endgroup -} - -\newcount\paramno % Count of parameters -\newtoks\macname % Macro name -\newif\ifrecursive % Is it recursive? -\def\macrolist{} % List of all defined macros in the form - % \do\macro1\do\macro2... - -% Utility routines. -% This does \let #1 = #2, except with \csnames. -\def\cslet#1#2{% -\expandafter\expandafter -\expandafter\let -\expandafter\expandafter -\csname#1\endcsname -\csname#2\endcsname} - -% Trim leading and trailing spaces off a string. -% Concepts from aro-bend problem 15 (see CTAN). -{\catcode`\@=11 -\gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }} -\gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@} -\gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @} -\def\unbrace#1{#1} -\unbrace{\gdef\trim@@@ #1 } #2@{#1} -} - -% Trim a single trailing ^^M off a string. -{\catcode`\^^M=\other \catcode`\Q=3% -\gdef\eatcr #1{\eatcra #1Q^^MQ}% -\gdef\eatcra#1^^MQ{\eatcrb#1Q}% -\gdef\eatcrb#1Q#2Q{#1}% -} - -% Macro bodies are absorbed as an argument in a context where -% all characters are catcode 10, 11 or 12, except \ which is active -% (as in normal texinfo). It is necessary to change the definition of \. - -% It's necessary to have hard CRs when the macro is executed. This is -% done by making ^^M (\endlinechar) catcode 12 when reading the macro -% body, and then making it the \newlinechar in \scanmacro. - -\def\macrobodyctxt{% - \catcode`\~=\other - \catcode`\^=\other - \catcode`\_=\other - \catcode`\|=\other - \catcode`\<=\other - \catcode`\>=\other - \catcode`\+=\other - \catcode`\{=\other - \catcode`\}=\other - \catcode`\@=\other - \catcode`\^^M=\other - \usembodybackslash} - -\def\macroargctxt{% - \catcode`\~=\other - \catcode`\^=\other - \catcode`\_=\other - \catcode`\|=\other - \catcode`\<=\other - \catcode`\>=\other - \catcode`\+=\other - \catcode`\@=\other - \catcode`\\=\other} - -% \mbodybackslash is the definition of \ in @macro bodies. -% It maps \foo\ => \csname macarg.foo\endcsname => #N -% where N is the macro parameter number. -% We define \csname macarg.\endcsname to be \realbackslash, so -% \\ in macro replacement text gets you a backslash. - -{\catcode`@=0 @catcode`@\=@active - @gdef@usembodybackslash{@let\=@mbodybackslash} - @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname} -} -\expandafter\def\csname macarg.\endcsname{\realbackslash} - -\def\macro{\recursivefalse\parsearg\macroxxx} -\def\rmacro{\recursivetrue\parsearg\macroxxx} - -\def\macroxxx#1{% - \getargs{#1}% now \macname is the macname and \argl the arglist - \ifx\argl\empty % no arguments - \paramno=0% - \else - \expandafter\parsemargdef \argl;% - \fi - \if1\csname ismacro.\the\macname\endcsname - \message{Warning: redefining \the\macname}% - \else - \expandafter\ifx\csname \the\macname\endcsname \relax - \else \errmessage{Macro name \the\macname\space already defined}\fi - \global\cslet{macsave.\the\macname}{\the\macname}% - \global\expandafter\let\csname ismacro.\the\macname\endcsname=1% - % Add the macroname to \macrolist - \toks0 = \expandafter{\macrolist\do}% - \xdef\macrolist{\the\toks0 - \expandafter\noexpand\csname\the\macname\endcsname}% - \fi - \begingroup \macrobodyctxt - \ifrecursive \expandafter\parsermacbody - \else \expandafter\parsemacbody - \fi} - -\parseargdef\unmacro{% - \if1\csname ismacro.#1\endcsname - \global\cslet{#1}{macsave.#1}% - \global\expandafter\let \csname ismacro.#1\endcsname=0% - % Remove the macro name from \macrolist: - \begingroup - \expandafter\let\csname#1\endcsname \relax - \let\do\unmacrodo - \xdef\macrolist{\macrolist}% - \endgroup - \else - \errmessage{Macro #1 not defined}% - \fi -} - -% Called by \do from \dounmacro on each macro. The idea is to omit any -% macro definitions that have been changed to \relax. -% -\def\unmacrodo#1{% - \ifx#1\relax - % remove this - \else - \noexpand\do \noexpand #1% - \fi -} - -% This makes use of the obscure feature that if the last token of a -% is #, then the preceding argument is delimited by -% an opening brace, and that opening brace is not consumed. -\def\getargs#1{\getargsxxx#1{}} -\def\getargsxxx#1#{\getmacname #1 \relax\getmacargs} -\def\getmacname #1 #2\relax{\macname={#1}} -\def\getmacargs#1{\def\argl{#1}} - -% Parse the optional {params} list. Set up \paramno and \paramlist -% so \defmacro knows what to do. Define \macarg.blah for each blah -% in the params list, to be ##N where N is the position in that list. -% That gets used by \mbodybackslash (above). - -% We need to get `macro parameter char #' into several definitions. -% The technique used is stolen from LaTeX: let \hash be something -% unexpandable, insert that wherever you need a #, and then redefine -% it to # just before using the token list produced. -% -% The same technique is used to protect \eatspaces till just before -% the macro is used. - -\def\parsemargdef#1;{\paramno=0\def\paramlist{}% - \let\hash\relax\let\xeatspaces\relax\parsemargdefxxx#1,;,} -\def\parsemargdefxxx#1,{% - \if#1;\let\next=\relax - \else \let\next=\parsemargdefxxx - \advance\paramno by 1% - \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname - {\xeatspaces{\hash\the\paramno}}% - \edef\paramlist{\paramlist\hash\the\paramno,}% - \fi\next} - -% These two commands read recursive and nonrecursive macro bodies. -% (They're different since rec and nonrec macros end differently.) - -\long\def\parsemacbody#1@end macro% -{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}% -\long\def\parsermacbody#1@end rmacro% -{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}% - -% This defines the macro itself. There are six cases: recursive and -% nonrecursive macros of zero, one, and many arguments. -% Much magic with \expandafter here. -% \xdef is used so that macro definitions will survive the file -% they're defined in; @include reads the file inside a group. -\def\defmacro{% - \let\hash=##% convert placeholders to macro parameter chars - \ifrecursive - \ifcase\paramno - % 0 - \expandafter\xdef\csname\the\macname\endcsname{% - \noexpand\scanmacro{\temp}}% - \or % 1 - \expandafter\xdef\csname\the\macname\endcsname{% - \bgroup\noexpand\macroargctxt - \noexpand\braceorline - \expandafter\noexpand\csname\the\macname xxx\endcsname}% - \expandafter\xdef\csname\the\macname xxx\endcsname##1{% - \egroup\noexpand\scanmacro{\temp}}% - \else % many - \expandafter\xdef\csname\the\macname\endcsname{% - \bgroup\noexpand\macroargctxt - \noexpand\csname\the\macname xx\endcsname}% - \expandafter\xdef\csname\the\macname xx\endcsname##1{% - \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% - \expandafter\expandafter - \expandafter\xdef - \expandafter\expandafter - \csname\the\macname xxx\endcsname - \paramlist{\egroup\noexpand\scanmacro{\temp}}% - \fi - \else - \ifcase\paramno - % 0 - \expandafter\xdef\csname\the\macname\endcsname{% - \noexpand\norecurse{\the\macname}% - \noexpand\scanmacro{\temp}\egroup}% - \or % 1 - \expandafter\xdef\csname\the\macname\endcsname{% - \bgroup\noexpand\macroargctxt - \noexpand\braceorline - \expandafter\noexpand\csname\the\macname xxx\endcsname}% - \expandafter\xdef\csname\the\macname xxx\endcsname##1{% - \egroup - \noexpand\norecurse{\the\macname}% - \noexpand\scanmacro{\temp}\egroup}% - \else % many - \expandafter\xdef\csname\the\macname\endcsname{% - \bgroup\noexpand\macroargctxt - \expandafter\noexpand\csname\the\macname xx\endcsname}% - \expandafter\xdef\csname\the\macname xx\endcsname##1{% - \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% - \expandafter\expandafter - \expandafter\xdef - \expandafter\expandafter - \csname\the\macname xxx\endcsname - \paramlist{% - \egroup - \noexpand\norecurse{\the\macname}% - \noexpand\scanmacro{\temp}\egroup}% - \fi - \fi} - -\def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}} - -% \braceorline decides whether the next nonwhitespace character is a -% {. If so it reads up to the closing }, if not, it reads the whole -% line. Whatever was read is then fed to the next control sequence -% as an argument (by \parsebrace or \parsearg) -\def\braceorline#1{\let\next=#1\futurelet\nchar\braceorlinexxx} -\def\braceorlinexxx{% - \ifx\nchar\bgroup\else - \expandafter\parsearg - \fi \next} - -% We mant to disable all macros during \shipout so that they are not -% expanded by \write. -\def\turnoffmacros{\begingroup \def\do##1{\let\noexpand##1=\relax}% - \edef\next{\macrolist}\expandafter\endgroup\next} - - -% @alias. -% We need some trickery to remove the optional spaces around the equal -% sign. Just make them active and then expand them all to nothing. -\def\alias{\parseargusing\obeyspaces\aliasxxx} -\def\aliasxxx #1{\aliasyyy#1\relax} -\def\aliasyyy #1=#2\relax{% - {% - \expandafter\let\obeyedspace=\empty - \xdef\next{\global\let\makecsname{#1}=\makecsname{#2}}% - }% - \next -} - - -\message{cross references,} - -\newwrite\auxfile - -\newif\ifhavexrefs % True if xref values are known. -\newif\ifwarnedxrefs % True if we warned once that they aren't known. - -% @inforef is relatively simple. -\def\inforef #1{\inforefzzz #1,,,,**} -\def\inforefzzz #1,#2,#3,#4**{\putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}}, - node \samp{\ignorespaces#1{}}} - -% @node's only job in TeX is to define \lastnode, which is used in -% cross-references. -\parseargdef\node{\checkenv{}\nodexxx #1,\finishnodeparse} -\def\nodexxx#1,#2\finishnodeparse{\gdef\lastnode{#1}} -\let\nwnode=\node -\let\lastnode=\empty - -% Write a cross-reference definition for the current node. #1 is the -% type (Ynumbered, Yappendix, Ynothing). -% -\def\donoderef#1{% - \ifx\lastnode\empty\else - \setref{\lastnode}{#1}% - \global\let\lastnode=\empty - \fi -} - -% @anchor{NAME} -- define xref target at arbitrary point. -% -\newcount\savesfregister -% -\def\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi} -\def\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi} -\def\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces} - -% \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an -% anchor), which consists of three parts: -% 1) NAME-title - the current sectioning name, taken from \thissection; -% 2) NAME-snt - section number and type, defined as the SNT arg; -% 3) NAME-pg - the page number. -% This is called from \donoderef, \anchor, and \dofloat. -% -% We take care not to fully expand the title, since it may contain -% arbitrary macros. -% -% Use \turnoffactive so that punctuation chars such as underscore -% and backslash work in node names. -% -\def\setref#1#2{% - \pdfmkdest{#1}% - \iflinks - {% - \atdummies % preserve commands, but don't expand them - \turnoffactive - \otherbackslash - \edef\writexrdef##1##2{% - \write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef - ##1}{##2}}% these are parameters of \writexrdef - }% - \toks0 = \expandafter{\thissection}% - \immediate \writexrdef{title}{\the\toks0 }% - \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc. - \writexrdef{pg}{\folio}% will be written later, during \shipout - }% - \fi -} - -% @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is -% the node name, #2 the name of the Info cross-reference, #3 the printed -% node name, #4 the name of the Info file, #5 the name of the printed -% manual. All but the node name can be omitted. -% -\def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]} -\def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]} -\def\ref#1{\xrefX[#1,,,,,,,]} -\def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup - \unsepspaces - \def\printedmanual{\ignorespaces #5}% - \def\printedrefname{\ignorespaces #3}% - \setbox1=\hbox{\printedmanual\unskip}% - \setbox0=\hbox{\printedrefname\unskip}% - \ifdim \wd0 = 0pt - % No printed node name was explicitly given. - \expandafter\ifx\csname SETxref-automatic-section-title\endcsname\relax - % Use the node name inside the square brackets. - \def\printedrefname{\ignorespaces #1}% - \else - % Use the actual chapter/section title appear inside - % the square brackets. Use the real section title if we have it. - \ifdim \wd1 > 0pt - % It is in another manual, so we don't have it. - \def\printedrefname{\ignorespaces #1}% - \else - \ifhavexrefs - % We know the real title if we have the xref values. - \def\printedrefname{\refx{#1-title}{}}% - \else - % Otherwise just copy the Info node name. - \def\printedrefname{\ignorespaces #1}% - \fi% - \fi - \fi - \fi - % - % Make link in pdf output. - \ifpdf - \leavevmode - \getfilename{#4}% - {\turnoffactive \otherbackslash - \ifnum\filenamelength>0 - \startlink attr{/Border [0 0 0]}% - goto file{\the\filename.pdf} name{#1}% - \else - \startlink attr{/Border [0 0 0]}% - goto name{\pdfmkpgn{#1}}% - \fi - }% - \linkcolor - \fi - % - % Float references are printed completely differently: "Figure 1.2" - % instead of "[somenode], p.3". We distinguish them by the - % LABEL-title being set to a magic string. - {% - % Have to otherify everything special to allow the \csname to - % include an _ in the xref name, etc. - \indexnofonts - \turnoffactive - \otherbackslash - \expandafter\global\expandafter\let\expandafter\Xthisreftitle - \csname X#1-title\endcsname - }% - \ifx \Xthisreftitle \floatmagic - % If the user specified the print name (third arg) to the ref, - % print it instead of our usual "Figure 1.2". - \ifdim\wd0 = 0pt - \refx{#1-snt}% - \else - \printedrefname - \fi - % - % if the user also gave the printed manual name (fifth arg), append - % "in MANUALNAME". - \ifdim \wd1 > 0pt - \space \putwordin{} \cite{\printedmanual}% - \fi - \else - % node/anchor (non-float) references. - % - % If we use \unhbox0 and \unhbox1 to print the node names, TeX does not - % insert empty discretionaries after hyphens, which means that it will - % not find a line break at a hyphen in a node names. Since some manuals - % are best written with fairly long node names, containing hyphens, this - % is a loss. Therefore, we give the text of the node name again, so it - % is as if TeX is seeing it for the first time. - \ifdim \wd1 > 0pt - \putwordsection{} ``\printedrefname'' \putwordin{} \cite{\printedmanual}% - \else - % _ (for example) has to be the character _ for the purposes of the - % control sequence corresponding to the node, but it has to expand - % into the usual \leavevmode...\vrule stuff for purposes of - % printing. So we \turnoffactive for the \refx-snt, back on for the - % printing, back off for the \refx-pg. - {\turnoffactive \otherbackslash - % Only output a following space if the -snt ref is nonempty; for - % @unnumbered and @anchor, it won't be. - \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}% - \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi - }% - % output the `[mynode]' via a macro so it can be overridden. - \xrefprintnodename\printedrefname - % - % But we always want a comma and a space: - ,\space - % - % output the `page 3'. - \turnoffactive \otherbackslash \putwordpage\tie\refx{#1-pg}{}% - \fi - \fi - \endlink -\endgroup} - -% This macro is called from \xrefX for the `[nodename]' part of xref -% output. It's a separate macro only so it can be changed more easily, -% since square brackets don't work well in some documents. Particularly -% one that Bob is working on :). -% -\def\xrefprintnodename#1{[#1]} - -% Things referred to by \setref. -% -\def\Ynothing{} -\def\Yomitfromtoc{} -\def\Ynumbered{% - \ifnum\secno=0 - \putwordChapter@tie \the\chapno - \else \ifnum\subsecno=0 - \putwordSection@tie \the\chapno.\the\secno - \else \ifnum\subsubsecno=0 - \putwordSection@tie \the\chapno.\the\secno.\the\subsecno - \else - \putwordSection@tie \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno - \fi\fi\fi -} -\def\Yappendix{% - \ifnum\secno=0 - \putwordAppendix@tie @char\the\appendixno{}% - \else \ifnum\subsecno=0 - \putwordSection@tie @char\the\appendixno.\the\secno - \else \ifnum\subsubsecno=0 - \putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno - \else - \putwordSection@tie - @char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno - \fi\fi\fi -} - -% Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME. -% If its value is nonempty, SUFFIX is output afterward. -% -\def\refx#1#2{% - {% - \indexnofonts - \otherbackslash - \expandafter\global\expandafter\let\expandafter\thisrefX - \csname X#1\endcsname - }% - \ifx\thisrefX\relax - % If not defined, say something at least. - \angleleft un\-de\-fined\angleright - \iflinks - \ifhavexrefs - \message{\linenumber Undefined cross reference `#1'.}% - \else - \ifwarnedxrefs\else - \global\warnedxrefstrue - \message{Cross reference values unknown; you must run TeX again.}% - \fi - \fi - \fi - \else - % It's defined, so just use it. - \thisrefX - \fi - #2% Output the suffix in any case. -} - -% This is the macro invoked by entries in the aux file. -% -\def\xrdef#1{\expandafter\gdef\csname X#1\endcsname} - -% Read the last existing aux file, if any. No error if none exists. -% -\def\tryauxfile{% - \openin 1 \jobname.aux - \ifeof 1 \else - \readauxfile - \global\havexrefstrue - \fi - \closein 1 -} - -\def\readauxfile{\begingroup - \catcode`\^^@=\other - \catcode`\^^A=\other - \catcode`\^^B=\other - \catcode`\^^C=\other - \catcode`\^^D=\other - \catcode`\^^E=\other - \catcode`\^^F=\other - \catcode`\^^G=\other - \catcode`\^^H=\other - \catcode`\^^K=\other - \catcode`\^^L=\other - \catcode`\^^N=\other - \catcode`\^^P=\other - \catcode`\^^Q=\other - \catcode`\^^R=\other - \catcode`\^^S=\other - \catcode`\^^T=\other - \catcode`\^^U=\other - \catcode`\^^V=\other - \catcode`\^^W=\other - \catcode`\^^X=\other - \catcode`\^^Z=\other - \catcode`\^^[=\other - \catcode`\^^\=\other - \catcode`\^^]=\other - \catcode`\^^^=\other - \catcode`\^^_=\other - % It was suggested to set the catcode of ^ to 7, which would allow ^^e4 etc. - % in xref tags, i.e., node names. But since ^^e4 notation isn't - % supported in the main text, it doesn't seem desirable. Furthermore, - % that is not enough: for node names that actually contain a ^ - % character, we would end up writing a line like this: 'xrdef {'hat - % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first - % argument, and \hat is not an expandable control sequence. It could - % all be worked out, but why? Either we support ^^ or we don't. - % - % The other change necessary for this was to define \auxhat: - % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter - % and then to call \auxhat in \setq. - % - \catcode`\^=\other - % - % Special characters. Should be turned off anyway, but... - \catcode`\~=\other - \catcode`\[=\other - \catcode`\]=\other - \catcode`\"=\other - \catcode`\_=\other - \catcode`\|=\other - \catcode`\<=\other - \catcode`\>=\other - \catcode`\$=\other - \catcode`\#=\other - \catcode`\&=\other - \catcode`\%=\other - \catcode`+=\other % avoid \+ for paranoia even though we've turned it off - % - % Make the characters 128-255 be printing characters - {% - \count 1=128 - \def\loop{% - \catcode\count 1=\other - \advance\count 1 by 1 - \ifnum \count 1<256 \loop \fi - }% - }% - % - % @ is our escape character in .aux files. - \catcode`\{=1 - \catcode`\}=2 - \catcode`\@=0 - % - \input \jobname.aux -\endgroup} - - -\message{insertions,} -% including footnotes. - -\newcount \footnoteno - -% The trailing space in the following definition for supereject is -% vital for proper filling; pages come out unaligned when you do a -% pagealignmacro call if that space before the closing brace is -% removed. (Generally, numeric constants should always be followed by a -% space to prevent strange expansion errors.) -\def\supereject{\par\penalty -20000\footnoteno =0 } - -% @footnotestyle is meaningful for info output only. -\let\footnotestyle=\comment - -{\catcode `\@=11 -% -% Auto-number footnotes. Otherwise like plain. -\gdef\footnote{% - \let\indent=\ptexindent - \let\noindent=\ptexnoindent - \global\advance\footnoteno by \@ne - \edef\thisfootno{$^{\the\footnoteno}$}% - % - % In case the footnote comes at the end of a sentence, preserve the - % extra spacing after we do the footnote number. - \let\@sf\empty - \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\ptexslash\fi - % - % Remove inadvertent blank space before typesetting the footnote number. - \unskip - \thisfootno\@sf - \dofootnote -}% - -% Don't bother with the trickery in plain.tex to not require the -% footnote text as a parameter. Our footnotes don't need to be so general. -% -% Oh yes, they do; otherwise, @ifset (and anything else that uses -% \parseargline) fails inside footnotes because the tokens are fixed when -% the footnote is read. --karl, 16nov96. -% -\gdef\dofootnote{% - \insert\footins\bgroup - % We want to typeset this text as a normal paragraph, even if the - % footnote reference occurs in (for example) a display environment. - % So reset some parameters. - \hsize=\pagewidth - \interlinepenalty\interfootnotelinepenalty - \splittopskip\ht\strutbox % top baseline for broken footnotes - \splitmaxdepth\dp\strutbox - \floatingpenalty\@MM - \leftskip\z@skip - \rightskip\z@skip - \spaceskip\z@skip - \xspaceskip\z@skip - \parindent\defaultparindent - % - \smallfonts \rm - % - % Because we use hanging indentation in footnotes, a @noindent appears - % to exdent this text, so make it be a no-op. makeinfo does not use - % hanging indentation so @noindent can still be needed within footnote - % text after an @example or the like (not that this is good style). - \let\noindent = \relax - % - % Hang the footnote text off the number. Use \everypar in case the - % footnote extends for more than one paragraph. - \everypar = {\hang}% - \textindent{\thisfootno}% - % - % Don't crash into the line above the footnote text. Since this - % expands into a box, it must come within the paragraph, lest it - % provide a place where TeX can split the footnote. - \footstrut - \futurelet\next\fo@t -} -}%end \catcode `\@=11 - -% In case a @footnote appears in a vbox, save the footnote text and create -% the real \insert just after the vbox finished. Otherwise, the insertion -% would be lost. -% Similarily, if a @footnote appears inside an alignment, save the footnote -% text to a box and make the \insert when a row of the table is finished. -% And the same can be done for other insert classes. --kasal, 16nov03. - -% Replace the \insert primitive by a cheating macro. -% Deeper inside, just make sure that the saved insertions are not spilled -% out prematurely. -% -\def\startsavinginserts{% - \ifx \insert\ptexinsert - \let\insert\saveinsert - \else - \let\checkinserts\relax - \fi -} - -% This \insert replacements works for both \insert\footins{foo} and -% \insert\footins\bgroup foo\egroup, but it doesn't work for \insert27{foo}. -% -\def\saveinsert#1{% - \edef\next{\noexpand\savetobox \makeSAVEname#1}% - \afterassignment\next - % swallow the left brace - \let\temp = -} -\def\makeSAVEname#1{\makecsname{SAVE\expandafter\gobble\string#1}} -\def\savetobox#1{\global\setbox#1 = \vbox\bgroup \unvbox#1} - -\def\checksaveins#1{\ifvoid#1\else \placesaveins#1\fi} - -\def\placesaveins#1{% - \ptexinsert \csname\expandafter\gobblesave\string#1\endcsname - {\box#1}% -} - -% eat @SAVE -- beware, all of them have catcode \other: -{ - \def\dospecials{\do S\do A\do V\do E} \uncatcodespecials % ;-) - \gdef\gobblesave @SAVE{} -} - -% initialization: -\def\newsaveins #1{% - \edef\next{\noexpand\newsaveinsX \makeSAVEname#1}% - \next -} -\def\newsaveinsX #1{% - \csname newbox\endcsname #1% - \expandafter\def\expandafter\checkinserts\expandafter{\checkinserts - \checksaveins #1}% -} - -% initialize: -\let\checkinserts\empty -\newsaveins\footins -\newsaveins\margin - - -% @image. We use the macros from epsf.tex to support this. -% If epsf.tex is not installed and @image is used, we complain. -% -% Check for and read epsf.tex up front. If we read it only at @image -% time, we might be inside a group, and then its definitions would get -% undone and the next image would fail. -\openin 1 = epsf.tex -\ifeof 1 \else - % Do not bother showing banner with epsf.tex v2.7k (available in - % doc/epsf.tex and on ctan). - \def\epsfannounce{\toks0 = }% - \input epsf.tex -\fi -\closein 1 -% -% We will only complain once about lack of epsf.tex. -\newif\ifwarnednoepsf -\newhelp\noepsfhelp{epsf.tex must be installed for images to - work. It is also included in the Texinfo distribution, or you can get - it from ftp://tug.org/tex/epsf.tex.} -% -\def\image#1{% - \ifx\epsfbox\undefined - \ifwarnednoepsf \else - \errhelp = \noepsfhelp - \errmessage{epsf.tex not found, images will be ignored}% - \global\warnednoepsftrue - \fi - \else - \imagexxx #1,,,,,\finish - \fi -} -% -% Arguments to @image: -% #1 is (mandatory) image filename; we tack on .eps extension. -% #2 is (optional) width, #3 is (optional) height. -% #4 is (ignored optional) html alt text. -% #5 is (ignored optional) extension. -% #6 is just the usual extra ignored arg for parsing this stuff. -\newif\ifimagevmode -\def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup - \catcode`\^^M = 5 % in case we're inside an example - \normalturnoffactive % allow _ et al. in names - % If the image is by itself, center it. - \ifvmode - \imagevmodetrue - \nobreak\bigskip - % Usually we'll have text after the image which will insert - % \parskip glue, so insert it here too to equalize the space - % above and below. - \nobreak\vskip\parskip - \nobreak - \line\bgroup\hss - \fi - % - % Output the image. - \ifpdf - \dopdfimage{#1}{#2}{#3}% - \else - % \epsfbox itself resets \epsf?size at each figure. - \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi - \setbox0 = \hbox{\ignorespaces #3}\ifdim\wd0 > 0pt \epsfysize=#3\relax \fi - \epsfbox{#1.eps}% - \fi - % - \ifimagevmode \hss \egroup \bigbreak \fi % space after the image -\endgroup} - - -% @float FLOATTYPE,LOC ... @end float for displayed figures, tables, etc. -% We don't actually implement floating yet, we just plop the float "here". -% But it seemed the best name for the future. -% -\envparseargdef\float{\dofloat #1,,,\finish} - -% #1 is the optional FLOATTYPE, the text label for this float, typically -% "Figure", "Table", "Example", etc. Can't contain commas. If omitted, -% this float will not be numbered and cannot be referred to. -% -% #2 is the optional xref label. Also must be present for the float to -% be referable. -% -% #3 is the optional positioning argument; for now, it is ignored. It -% will somehow specify the positions allowed to float to (here, top, bottom). -% -% We keep a separate counter for each FLOATTYPE, which we reset at each -% chapter-level command. -\let\resetallfloatnos=\empty -% -\def\dofloat#1,#2,#3,#4\finish{% - % don't lose footnotes inside @float. - \startsavinginserts - % - \vtop\bgroup - \def\floattype{#1}% - \def\floatlabel{#2}% - \def\floatloc{#3}% we do nothing with this yet. - % xx should we indent the whole thing? center it? - % - \ifx\floattype\empty \else - {% - % the floattype might have accents or other special characters, - % but we need to use it in a control sequence name. - \indexnofonts - \turnoffactive - \xdef\safefloattype{\floattype}% - }% - % We want each FLOATTYPE to be numbered separately (Figure 1, - % Table 1, Figure 2, ...). - % - \expandafter\getfloatno\csname\safefloattype floatno\endcsname - \global\advance\floatno by 1 - % - \ifx\floatlabel\empty \else - {% - % This magic value for \thissection is output by \setref as the - % XREFLABEL-title value. \xrefX uses it to distinguish float - % labels (which have a completely different output format) from - % node and anchor labels. - % - \let\thissection=\floatmagic - \setref{\floatlabel}{Yfloat}% - }% - \fi - \fi -} - -% we have four possibilities: -% @float Foo & @caption{Cap}: Foo 1.1: Cap -% @float Foo & no caption: Foo 1.1 -% @float & @caption{Cap}: Cap -% @float & no caption: -% -\def\Efloat{% - \let\printedsomething = \empty - % - \ifx\floattype\empty \else - \vskip.5\parskip % space above caption - % - % Print the float number preceded by the chapter-level number - % (empty in the case of unnumbered). Although there are other - % styles of float numbering, we hardwire this one. - \floattype\space\chaplevelprefix\the\floatno - \let\printedsomething = t% - \fi - % - \ifx\thiscaption\empty \else - \ifx\printedsomething\empty - \vskip.5\parskip % space above caption - \else - :\space % had a number, so print a colon before the caption. - \fi - % - % Print caption text. - \thiscaption - \let\printedsomething = t% - \fi - % - % Space below caption, if we printed anything. - \ifx\printedsomething\empty \else \vskip\parskip \fi - % - \egroup % end of \vtop - \checkinserts -} - -\def\caption#1{\checkenv\float \def\thiscaption{#1}} -\def\shortcaption#1{\checkenv\float \def\thisshortcaption{#1}} -\let\thiscaption=\empty -\let\thisshortcaption=\empty - -% The parameter is the control sequence identifying the counter we are -% going to use. Create it if it doesn't exist and assign it to \floatno. -\def\getfloatno#1{% - \ifx#1\relax - % Haven't seen this figure type before. - \csname newcount\endcsname #1% - % - % Remember to reset this floatno at the next chap. - \expandafter\gdef\expandafter\resetallfloatnos - \expandafter{\resetallfloatnos #1=0 }% - \fi - \let\floatno#1% -} - -% \setref calls this to get the XREFLABEL-snt value. We want an @xref -% to the FLOATLABEL to expand to "Figure 3.1". We call \setref when we -% first read the @float command. -% -\def\Yfloat{\floattype @tie{}\chaplevelprefix\the\floatno}% - -% Magic string used for the XREFLABEL-title value, so \xrefX can -% distinguish floats from other xref types. -\def\floatmagic{!!float!!} - -% @listoffloats FLOATTYPE - print a list of floats like a table of contents. -\parseargdef\listoffloats{%xx -} - - -\message{localization,} -% and i18n. - -% @documentlanguage is usually given very early, just after -% @setfilename. If done too late, it may not override everything -% properly. Single argument is the language abbreviation. -% It would be nice if we could set up a hyphenation file here. -% -\parseargdef\documentlanguage{% - \tex % read txi-??.tex file in plain TeX. - % Read the file if it exists. - \openin 1 txi-#1.tex - \ifeof 1 - \errhelp = \nolanghelp - \errmessage{Cannot read language file txi-#1.tex}% - \else - \input txi-#1.tex - \fi - \closein 1 - \endgroup -} -\newhelp\nolanghelp{The given language definition file cannot be found or -is empty. Maybe you need to install it? In the current directory -should work if nowhere else does.} - - -% @documentencoding should change something in TeX eventually, most -% likely, but for now just recognize it. -\let\documentencoding = \comment - - -% Page size parameters. -% -\newdimen\defaultparindent \defaultparindent = 15pt - -\chapheadingskip = 15pt plus 4pt minus 2pt -\secheadingskip = 12pt plus 3pt minus 2pt -\subsecheadingskip = 9pt plus 2pt minus 2pt - -% Prevent underfull vbox error messages. -\vbadness = 10000 - -% Don't be so finicky about underfull hboxes, either. -\hbadness = 2000 - -% Following George Bush, just get rid of widows and orphans. -\widowpenalty=10000 -\clubpenalty=10000 - -% Use TeX 3.0's \emergencystretch to help line breaking, but if we're -% using an old version of TeX, don't do anything. We want the amount of -% stretch added to depend on the line length, hence the dependence on -% \hsize. We call this whenever the paper size is set. -% -\def\setemergencystretch{% - \ifx\emergencystretch\thisisundefined - % Allow us to assign to \emergencystretch anyway. - \def\emergencystretch{\dimen0}% - \else - \emergencystretch = .15\hsize - \fi -} - -% Parameters in order: 1) textheight; 2) textwidth; 3) voffset; -% 4) hoffset; 5) binding offset; 6) topskip; 7) physical page height; 8) -% physical page width. -% -% We also call \setleading{\textleading}, so the caller should define -% \textleading. The caller should also set \parskip. -% -\def\internalpagesizes#1#2#3#4#5#6#7#8{% - \voffset = #3\relax - \topskip = #6\relax - \splittopskip = \topskip - % - \vsize = #1\relax - \advance\vsize by \topskip - \outervsize = \vsize - \advance\outervsize by 2\topandbottommargin - \pageheight = \vsize - % - \hsize = #2\relax - \outerhsize = \hsize - \advance\outerhsize by 0.5in - \pagewidth = \hsize - % - \normaloffset = #4\relax - \bindingoffset = #5\relax - % - \ifpdf - \pdfpageheight #7\relax - \pdfpagewidth #8\relax - \fi - % - \setleading{\textleading} - % - \parindent = \defaultparindent - \setemergencystretch -} - -% @letterpaper (the default). -\def\letterpaper{{\globaldefs = 1 - \parskip = 3pt plus 2pt minus 1pt - \textleading = 13.2pt - % - % If page is nothing but text, make it come out even. - \internalpagesizes{46\baselineskip}{6in}% - {\voffset}{.25in}% - {\bindingoffset}{36pt}% - {11in}{8.5in}% -}} - -% Use @smallbook to reset parameters for 7x9.5 (or so) format. -\def\smallbook{{\globaldefs = 1 - \parskip = 2pt plus 1pt - \textleading = 12pt - % - \internalpagesizes{7.5in}{5in}% - {\voffset}{.25in}% - {\bindingoffset}{16pt}% - {9.25in}{7in}% - % - \lispnarrowing = 0.3in - \tolerance = 700 - \hfuzz = 1pt - \contentsrightmargin = 0pt - \defbodyindent = .5cm -}} - -% Use @afourpaper to print on European A4 paper. -\def\afourpaper{{\globaldefs = 1 - \parskip = 3pt plus 2pt minus 1pt - \textleading = 13.2pt - % - % Double-side printing via postscript on Laserjet 4050 - % prints double-sided nicely when \bindingoffset=10mm and \hoffset=-6mm. - % To change the settings for a different printer or situation, adjust - % \normaloffset until the front-side and back-side texts align. Then - % do the same for \bindingoffset. You can set these for testing in - % your texinfo source file like this: - % @tex - % \global\normaloffset = -6mm - % \global\bindingoffset = 10mm - % @end tex - \internalpagesizes{51\baselineskip}{160mm} - {\voffset}{\hoffset}% - {\bindingoffset}{44pt}% - {297mm}{210mm}% - % - \tolerance = 700 - \hfuzz = 1pt - \contentsrightmargin = 0pt - \defbodyindent = 5mm -}} - -% Use @afivepaper to print on European A5 paper. -% From romildo@urano.iceb.ufop.br, 2 July 2000. -% He also recommends making @example and @lisp be small. -\def\afivepaper{{\globaldefs = 1 - \parskip = 2pt plus 1pt minus 0.1pt - \textleading = 12.5pt - % - \internalpagesizes{160mm}{120mm}% - {\voffset}{\hoffset}% - {\bindingoffset}{8pt}% - {210mm}{148mm}% - % - \lispnarrowing = 0.2in - \tolerance = 800 - \hfuzz = 1.2pt - \contentsrightmargin = 0pt - \defbodyindent = 2mm - \tableindent = 12mm -}} - -% A specific text layout, 24x15cm overall, intended for A4 paper. -\def\afourlatex{{\globaldefs = 1 - \afourpaper - \internalpagesizes{237mm}{150mm}% - {\voffset}{4.6mm}% - {\bindingoffset}{7mm}% - {297mm}{210mm}% - % - % Must explicitly reset to 0 because we call \afourpaper. - \globaldefs = 0 -}} - -% Use @afourwide to print on A4 paper in landscape format. -\def\afourwide{{\globaldefs = 1 - \afourpaper - \internalpagesizes{241mm}{165mm}% - {\voffset}{-2.95mm}% - {\bindingoffset}{7mm}% - {297mm}{210mm}% - \globaldefs = 0 -}} - -% @pagesizes TEXTHEIGHT[,TEXTWIDTH] -% Perhaps we should allow setting the margins, \topskip, \parskip, -% and/or leading, also. Or perhaps we should compute them somehow. -% -\parseargdef\pagesizes{\pagesizesyyy #1,,\finish} -\def\pagesizesyyy#1,#2,#3\finish{{% - \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi - \globaldefs = 1 - % - \parskip = 3pt plus 2pt minus 1pt - \setleading{\textleading}% - % - \dimen0 = #1 - \advance\dimen0 by \voffset - % - \dimen2 = \hsize - \advance\dimen2 by \normaloffset - % - \internalpagesizes{#1}{\hsize}% - {\voffset}{\normaloffset}% - {\bindingoffset}{44pt}% - {\dimen0}{\dimen2}% -}} - -% Set default to letter. -% -\letterpaper - - -\message{and turning on texinfo input format.} - -% Define macros to output various characters with catcode for normal text. -\catcode`\"=\other -\catcode`\~=\other -\catcode`\^=\other -\catcode`\_=\other -\catcode`\|=\other -\catcode`\<=\other -\catcode`\>=\other -\catcode`\+=\other -\catcode`\$=\other -\def\normaldoublequote{"} -\def\normaltilde{~} -\def\normalcaret{^} -\def\normalunderscore{_} -\def\normalverticalbar{|} -\def\normalless{<} -\def\normalgreater{>} -\def\normalplus{+} -\def\normaldollar{$}%$ font-lock fix - -% This macro is used to make a character print one way in \tt -% (where it can probably be output as-is), and another way in other fonts, -% where something hairier probably needs to be done. -% -% #1 is what to print if we are indeed using \tt; #2 is what to print -% otherwise. Since all the Computer Modern typewriter fonts have zero -% interword stretch (and shrink), and it is reasonable to expect all -% typewriter fonts to have this, we can check that font parameter. -% -\def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi} - -% Same as above, but check for italic font. Actually this also catches -% non-italic slanted fonts since it is impossible to distinguish them from -% italic fonts. But since this is only used by $ and it uses \sl anyway -% this is not a problem. -\def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi} - -% Turn off all special characters except @ -% (and those which the user can use as if they were ordinary). -% Most of these we simply print from the \tt font, but for some, we can -% use math or other variants that look better in normal text. - -\catcode`\"=\active -\def\activedoublequote{{\tt\char34}} -\let"=\activedoublequote -\catcode`\~=\active -\def~{{\tt\char126}} -\chardef\hat=`\^ -\catcode`\^=\active -\def^{{\tt \hat}} - -\catcode`\_=\active -\def_{\ifusingtt\normalunderscore\_} -% Subroutine for the previous macro. -\def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em } - -\catcode`\|=\active -\def|{{\tt\char124}} -\chardef \less=`\< -\catcode`\<=\active -\def<{{\tt \less}} -\chardef \gtr=`\> -\catcode`\>=\active -\def>{{\tt \gtr}} -\catcode`\+=\active -\def+{{\tt \char 43}} -\catcode`\$=\active -\def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix - -% If a .fmt file is being used, characters that might appear in a file -% name cannot be active until we have parsed the command line. -% So turn them off again, and have \everyjob (or @setfilename) turn them on. -% \otherifyactive is called near the end of this file. -\def\otherifyactive{\catcode`+=\other \catcode`\_=\other} - -\catcode`\@=0 - -% \backslashcurfont outputs one backslash character in current font, -% as in \char`\\. -\global\chardef\backslashcurfont=`\\ - -% \rawbackslash defines an active \ to do \backslashcurfont. -% \otherbackslash defines an active \ to be a literal `\' character with -% catcode other. -{\catcode`\\=\active - @gdef@rawbackslash{@let\=@backslashcurfont} - @gdef@otherbackslash{@let\=@realbackslash} -} - -% \realbackslash is an actual character `\' with catcode other. -{\catcode`\\=\other @gdef@realbackslash{\}} - -% \normalbackslash outputs one backslash in fixed width font. -\def\normalbackslash{{\tt\backslashcurfont}} - -\catcode`\\=\active - -% Used sometimes to turn off (effectively) the active characters -% even after parsing them. -@def@turnoffactive{% - @let"=@normaldoublequote - @let\=@realbackslash - @let~=@normaltilde - @let^=@normalcaret - @let_=@normalunderscore - @let|=@normalverticalbar - @let<=@normalless - @let>=@normalgreater - @let+=@normalplus - @let$=@normaldollar %$ font-lock fix - @unsepspaces -} - -% Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of -% the literal character `\'. (Thus, \ is not expandable when this is in -% effect.) -% -@def@normalturnoffactive{@turnoffactive @let\=@normalbackslash} - -% Make _ and + \other characters, temporarily. -% This is canceled by @fixbackslash. -@otherifyactive - -% If a .fmt file is being used, we don't want the `\input texinfo' to show up. -% That is what \eatinput is for; after that, the `\' should revert to printing -% a backslash. -% -@gdef@eatinput input texinfo{@fixbackslash} -@global@let\ = @eatinput - -% On the other hand, perhaps the file did not have a `\input texinfo'. Then -% the first `\{ in the file would cause an error. This macro tries to fix -% that, assuming it is called before the first `\' could plausibly occur. -% Also back turn on active characters that might appear in the input -% file name, in case not using a pre-dumped format. -% -@gdef@fixbackslash{% - @ifx\@eatinput @let\ = @normalbackslash @fi - @catcode`+=@active - @catcode`@_=@active -} - -% Say @foo, not \foo, in error messages. -@escapechar = `@@ - -% These look ok in all fonts, so just make them not special. -@catcode`@& = @other -@catcode`@# = @other -@catcode`@% = @other - - -@c Local variables: -@c eval: (add-hook 'write-file-hooks 'time-stamp) -@c page-delimiter: "^\\\\message" -@c time-stamp-start: "def\\\\texinfoversion{" -@c time-stamp-format: "%:y-%02m-%02d.%02H" -@c time-stamp-end: "}" -@c End: - -@c vim:sw=2: - -@ignore - arch-tag: e1b36e32-c96e-4135-a41a-0b2efa2ea115 -@end ignore diff --git a/usr/src/grub/grub-0.95/docs/version.texi b/usr/src/grub/grub-0.95/docs/version.texi deleted file mode 100644 index 6b078b2ef8..0000000000 --- a/usr/src/grub/grub-0.95/docs/version.texi +++ /dev/null @@ -1,4 +0,0 @@ -@set UPDATED 20 September 2004 -@set UPDATED-MONTH September 2004 -@set EDITION 0.95 -@set VERSION 0.95 diff --git a/usr/src/grub/grub-0.95/grub/Makefile.am b/usr/src/grub/grub-0.95/grub/Makefile.am deleted file mode 100644 index efd0746052..0000000000 --- a/usr/src/grub/grub-0.95/grub/Makefile.am +++ /dev/null @@ -1,19 +0,0 @@ -sbin_PROGRAMS = grub - -if SERIAL_SPEED_SIMULATION -SERIAL_FLAGS = -DSUPPORT_SERIAL=1 -DSIMULATE_SLOWNESS_OF_SERIAL=1 -else -SERIAL_FLAGS = -DSUPPORT_SERIAL=1 -endif - -AM_CPPFLAGS = -DGRUB_UTIL=1 -DFSYS_EXT2FS=1 -DFSYS_FAT=1 -DFSYS_FFS=1 \ - -DFSYS_ISO9660=1 -DFSYS_JFS=1 -DFSYS_MINIX=1 -DFSYS_REISERFS=1 \ - -DFSYS_ZFS=1 -DFSYS_UFS2=1 -DFSYS_VSTAFS=1 -DFSYS_XFS=1 \ - -DUSE_MD5_PASSWORDS=1 -DSUPPORT_HERCULES=1 \ - $(SERIAL_FLAGS) -I$(top_srcdir)/stage2 \ - -I$(top_srcdir)/stage1 -I$(top_srcdir)/lib - -AM_CFLAGS = $(GRUB_CFLAGS) -fwritable-strings - -grub_SOURCES = main.c asmstub.c -grub_LDADD = ../stage2/libgrub.a ../lib/libcommon.a $(GRUB_LIBS) diff --git a/usr/src/grub/grub-0.95/grub/Makefile.in b/usr/src/grub/grub-0.95/grub/Makefile.in deleted file mode 100644 index 6e0f02362e..0000000000 --- a/usr/src/grub/grub-0.95/grub/Makefile.in +++ /dev/null @@ -1,445 +0,0 @@ -# Makefile.in generated by automake 1.8.5 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -SOURCES = $(grub_SOURCES) - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = .. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -host_triplet = @host@ -sbin_PROGRAMS = grub$(EXEEXT) -subdir = grub -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -am__installdirs = "$(DESTDIR)$(sbindir)" -sbinPROGRAMS_INSTALL = $(INSTALL_PROGRAM) -PROGRAMS = $(sbin_PROGRAMS) -am_grub_OBJECTS = main.$(OBJEXT) asmstub.$(OBJEXT) -grub_OBJECTS = $(am_grub_OBJECTS) -am__DEPENDENCIES_1 = -grub_DEPENDENCIES = ../stage2/libgrub.a ../lib/libcommon.a \ - $(am__DEPENDENCIES_1) -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/asmstub.Po ./$(DEPDIR)/main.Po -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(grub_SOURCES) -DIST_SOURCES = $(grub_SOURCES) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BUILD_EXAMPLE_KERNEL_FALSE = @BUILD_EXAMPLE_KERNEL_FALSE@ -BUILD_EXAMPLE_KERNEL_TRUE = @BUILD_EXAMPLE_KERNEL_TRUE@ -CC = @CC@ -CCAS = @CCAS@ -CCASFLAGS = @CCASFLAGS@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DISKLESS_SUPPORT_FALSE = @DISKLESS_SUPPORT_FALSE@ -DISKLESS_SUPPORT_TRUE = @DISKLESS_SUPPORT_TRUE@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FSYS_CFLAGS = @FSYS_CFLAGS@ -GRUB_CFLAGS = @GRUB_CFLAGS@ -GRUB_LIBS = @GRUB_LIBS@ -HERCULES_SUPPORT_FALSE = @HERCULES_SUPPORT_FALSE@ -HERCULES_SUPPORT_TRUE = @HERCULES_SUPPORT_TRUE@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LTLIBOBJS = @LTLIBOBJS@ -MAINT = @MAINT@ -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ -MAKEINFO = @MAKEINFO@ -NETBOOT_DRIVERS = @NETBOOT_DRIVERS@ -NETBOOT_SUPPORT_FALSE = @NETBOOT_SUPPORT_FALSE@ -NETBOOT_SUPPORT_TRUE = @NETBOOT_SUPPORT_TRUE@ -NET_CFLAGS = @NET_CFLAGS@ -NET_EXTRAFLAGS = @NET_EXTRAFLAGS@ -OBJCOPY = @OBJCOPY@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -RANLIB = @RANLIB@ -SERIAL_SPEED_SIMULATION_FALSE = @SERIAL_SPEED_SIMULATION_FALSE@ -SERIAL_SPEED_SIMULATION_TRUE = @SERIAL_SPEED_SIMULATION_TRUE@ -SERIAL_SUPPORT_FALSE = @SERIAL_SUPPORT_FALSE@ -SERIAL_SUPPORT_TRUE = @SERIAL_SUPPORT_TRUE@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STAGE1_CFLAGS = @STAGE1_CFLAGS@ -STAGE2_CFLAGS = @STAGE2_CFLAGS@ -STRIP = @STRIP@ -VERSION = @VERSION@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_OBJCOPY = @ac_ct_OBJCOPY@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -@SERIAL_SPEED_SIMULATION_FALSE@SERIAL_FLAGS = -DSUPPORT_SERIAL=1 -@SERIAL_SPEED_SIMULATION_TRUE@SERIAL_FLAGS = -DSUPPORT_SERIAL=1 -DSIMULATE_SLOWNESS_OF_SERIAL=1 -AM_CPPFLAGS = -DGRUB_UTIL=1 -DFSYS_EXT2FS=1 -DFSYS_FAT=1 -DFSYS_FFS=1 \ - -DFSYS_ISO9660=1 -DFSYS_JFS=1 -DFSYS_MINIX=1 -DFSYS_REISERFS=1 \ - -DFSYS_ZFS=1 -DFSYS_UFS2=1 -DFSYS_VSTAFS=1 -DFSYS_XFS=1 \ - -DUSE_MD5_PASSWORDS=1 -DSUPPORT_HERCULES=1 \ - $(SERIAL_FLAGS) -I$(top_srcdir)/stage2 \ - -I$(top_srcdir)/stage1 -I$(top_srcdir)/lib - -AM_CFLAGS = $(GRUB_CFLAGS) -fwritable-strings -grub_SOURCES = main.c asmstub.c -grub_LDADD = ../stage2/libgrub.a ../lib/libcommon.a $(GRUB_LIBS) -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .o .obj -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu grub/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu grub/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -install-sbinPROGRAMS: $(sbin_PROGRAMS) - @$(NORMAL_INSTALL) - test -z "$(sbindir)" || $(mkdir_p) "$(DESTDIR)$(sbindir)" - @list='$(sbin_PROGRAMS)'; for p in $$list; do \ - p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ - if test -f $$p \ - ; then \ - f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ - echo " $(INSTALL_PROGRAM_ENV) $(sbinPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(sbindir)/$$f'"; \ - $(INSTALL_PROGRAM_ENV) $(sbinPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(sbindir)/$$f" || exit 1; \ - else :; fi; \ - done - -uninstall-sbinPROGRAMS: - @$(NORMAL_UNINSTALL) - @list='$(sbin_PROGRAMS)'; for p in $$list; do \ - f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ - echo " rm -f '$(DESTDIR)$(sbindir)/$$f'"; \ - rm -f "$(DESTDIR)$(sbindir)/$$f"; \ - done - -clean-sbinPROGRAMS: - -test -z "$(sbin_PROGRAMS)" || rm -f $(sbin_PROGRAMS) -grub$(EXEEXT): $(grub_OBJECTS) $(grub_DEPENDENCIES) - @rm -f grub$(EXEEXT) - $(LINK) $(grub_LDFLAGS) $(grub_OBJECTS) $(grub_LDADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asmstub.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` -uninstall-info-am: - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(PROGRAMS) -installdirs: - for dir in "$(DESTDIR)$(sbindir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-sbinPROGRAMS mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: - -install-exec-am: install-sbinPROGRAMS - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am uninstall-sbinPROGRAMS - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-sbinPROGRAMS ctags distclean distclean-compile \ - distclean-generic distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-exec install-exec-am install-info \ - install-info-am install-man install-sbinPROGRAMS install-strip \ - installcheck installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ - uninstall-am uninstall-info-am uninstall-sbinPROGRAMS - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/usr/src/grub/grub-0.95/grub/Makefile.solaris b/usr/src/grub/grub-0.95/grub/Makefile.solaris deleted file mode 100644 index 9d2b2e40ba..0000000000 --- a/usr/src/grub/grub-0.95/grub/Makefile.solaris +++ /dev/null @@ -1,77 +0,0 @@ -# -# Copyright 2007 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# ident "%Z%%M% %I% %E% SMI" -# -include ../../Makefile.grub -include ../Makefile.solaris.defs - - -GRUB = grub -GRUB_OBJS = asmstub.o main.o -$(GRUB) := LIBS = ../stage2/libgrub.a ../lib/libcommon.a -lcurses -$(GRUB) := LDFLAGS += $(LDLIBS.cmd) -$(GRUB) := CCLD = $(CC) - -# -# The grub shell interposes on the getopt() family. Should direct bindings be -# enabled, these interfaces should be explicitly defined as interposes. Use a -# mapfile to associate the necessary interposer definitions. -# -MAPFILES = $(MAPFILE.INT) - -INCLUDES = -I. -I.. -I../stage1 -I../stage2 -I../lib -CFLAGS += -O2 -LINKFLAGS += -O2 $(MAPFILES:%=-Wl,-M%) -CPPFLAGS += -DGRUB_UTIL=1 -DFSYS_EXT2FS=1 -DFSYS_FAT=1 -DFSYS_FFS=1 \ - -DFSYS_ISO9660=1 -DFSYS_JFS=1 -DFSYS_MINIX=1 \ - -DFSYS_REISERFS=1 -DFSYS_ZFS=1 -DFSYS_UFS2=1 -DFSYS_VSTAFS=1 \ - -DFSYS_XFS=1 -DUSE_MD5_PASSWORDS=1 -DSUPPORT_HERCULES=1 \ - -DSUPPORT_SERIAL=1 - -PROGRAMS = $(GRUB) - -INSTALL_DIR = $(ROOT_BOOT_GRUB)/bin -INSTALL_TARGETS = $(PROGRAMS:%=$(INSTALL_DIR)/%) - -$(INSTALL_DIR)/% := FILEMODE = 0555 - -# -# Source files to be installed in $(SRC_DIR). -# -SRC_DIR = $(ROOT_SRC)/grub -SRC_FILES = Makefile.am Makefile.in asmstub.c main.c - -INSTALL_TARGETS += $(SRC_FILES:%=$(SRC_DIR)/%) - - -all: $(PROGRAMS) - -$(GRUB): $(GRUB_OBJS) $(MAPFILES) - $(LINK) -o $@ $(GRUB_OBJS) $(LIBS) - $(POST_PROCESS) - -$(GRUB_OBJS): $$(@:.o=.c) - $(CC) $(CFLAGS) -c -o $@ $(@:.o=.c) - - -install: all $(INSTALL_TARGETS) - -$(INSTALL_DIR)/%: $(INSTALL_DIR) % - $(INS.file) - -$(SRC_DIR)/%: $(SRC_DIR) % - $(INS.file) - -$(INSTALL_DIR) $(SRC_DIR): - $(INS.dir) - - -clean: _FORCE - $(RM) *.o - -clobber: clean - $(RM) $(PROGRAMS) - -_FORCE: diff --git a/usr/src/grub/grub-0.95/grub/asmstub.c b/usr/src/grub/grub-0.95/grub/asmstub.c deleted file mode 100644 index f6a0ca9083..0000000000 --- a/usr/src/grub/grub-0.95/grub/asmstub.c +++ /dev/null @@ -1,1310 +0,0 @@ -/* asmstub.c - a version of shared_src/asm.S that works under Unix */ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 1999,2000,2001,2002,2004 Free Software Foundation, 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 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. - */ - -/* Try to use glibc's transparant LFS support. */ -#define _LARGEFILE_SOURCE 1 -/* lseek becomes synonymous with lseek64. */ -#define _FILE_OFFSET_BITS 64 - -/* Simulator entry point. */ -int grub_stage2 (void); - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef __linux__ -# include /* ioctl */ -# if !defined(__GLIBC__) || \ - ((__GLIBC__ < 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ < 1))) -/* Maybe libc doesn't have large file support. */ -# include /* _llseek */ -# endif /* (GLIBC < 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR < 1)) */ -# ifndef BLKFLSBUF -# define BLKFLSBUF _IO (0x12,97) /* flush buffer cache */ -# endif /* ! BLKFLSBUF */ -#endif /* __linux__ */ - -/* We want to prevent any circularararity in our stubs, as well as - libc name clashes. */ -#define WITHOUT_LIBC_STUBS 1 -#include -#include -#include -#include - -/* Simulated memory sizes. */ -#define EXTENDED_MEMSIZE (64 * 1024 * 1024) /* 64MB */ -#define CONVENTIONAL_MEMSIZE (640 * 1024) /* 640kB */ - -unsigned long install_partition = 0x20000; -unsigned long boot_drive = 0; -int saved_entryno = 0; -char version_string[] = VERSION; -char config_file[128] = "/boot/grub/menu.lst"; /* FIXME: arbitrary */ -unsigned long linux_text_len = 0; -char *linux_data_tmp_addr = 0; -char *linux_data_real_addr = 0; -unsigned short io_map[IO_MAP_SIZE]; -struct apm_info apm_bios_info; - -/* Emulation requirements. */ -char *grub_scratch_mem = 0; - -struct geometry *disks = 0; - -/* The map between BIOS drives and UNIX device file names. */ -char **device_map = 0; - -/* The jump buffer for exiting correctly. */ -static jmp_buf env_for_exit; - -/* The current color for console. */ -static int console_current_color = A_NORMAL; - -/* The file descriptor for a serial device. */ -static int serial_fd = -1; - -/* The file name of a serial device. */ -static char *serial_device = 0; - -#ifdef SIMULATE_SLOWNESS_OF_SERIAL -/* The speed of a serial device. */ -static unsigned int serial_speed; -#endif /* SIMULATE_SLOWNESS_OF_SERIAL */ - -/* The main entry point into this mess. */ -int -grub_stage2 (void) -{ - /* These need to be static, because they survive our stack transitions. */ - static int status = 0; - static char *realstack; - char *scratch, *simstack; - int i; - - /* We need a nested function so that we get a clean stack frame, - regardless of how the code is optimized. */ - static volatile void doit () - { - /* Make sure our stack lives in the simulated memory area. */ - asm volatile ("movl %%esp, %0\n\tmovl %1, %%esp\n" - : "=&r" (realstack) : "r" (simstack)); - - /* Do a setjmp here for the stop command. */ - if (! setjmp (env_for_exit)) - { - /* Actually enter the generic stage2 code. */ - status = 0; - init_bios_info (); - } - else - { - /* If ERRNUM is non-zero, then set STATUS to non-zero. */ - if (errnum) - status = 1; - } - - /* Replace our stack before we use any local variables. */ - asm volatile ("movl %0, %%esp\n" : : "r" (realstack)); - } - - assert (grub_scratch_mem == 0); - scratch = malloc (0x100000 + EXTENDED_MEMSIZE + 15); - assert (scratch); - grub_scratch_mem = (char *) ((((int) scratch) >> 4) << 4); - - /* FIXME: simulate the memory holes using mprot, if available. */ - - assert (disks == 0); - disks = malloc (NUM_DISKS * sizeof (*disks)); - assert (disks); - /* Initialize DISKS. */ - for (i = 0; i < NUM_DISKS; i++) - disks[i].flags = -1; - - if (! init_device_map (&device_map, device_map_file, floppy_disks)) - return 1; - - /* Check some invariants. */ - assert ((SCRATCHSEG << 4) == SCRATCHADDR); - assert ((BUFFERSEG << 4) == BUFFERADDR); - assert (BUFFERADDR + BUFFERLEN == SCRATCHADDR); - assert (FSYS_BUF % 16 == 0); - assert (FSYS_BUF + FSYS_BUFLEN == BUFFERADDR); - -#ifdef HAVE_LIBCURSES - /* Get into char-at-a-time mode. */ - if (use_curses) - { - initscr (); - cbreak (); - noecho (); - nonl (); - scrollok (stdscr, TRUE); - keypad (stdscr, TRUE); - wtimeout (stdscr, 100); - signal (SIGWINCH, SIG_IGN); - } -#endif - - /* Make sure that actual writing is done. */ - sync (); - - /* Set our stack, and go for it. */ - simstack = (char *) PROTSTACKINIT; - doit (); - - /* I don't know if this is necessary really. */ - sync (); - -#ifdef HAVE_LIBCURSES - if (use_curses) - endwin (); -#endif - - /* Close off the file descriptors we used. */ - for (i = 0; i < NUM_DISKS; i ++) - if (disks[i].flags != -1) - { -#ifdef __linux__ - /* In Linux, invalidate the buffer cache. In other OSes, reboot - is one of the solutions... */ - ioctl (disks[i].flags, BLKFLSBUF, 0); -#elif defined(__sun) - /* FIXME */ -#else -# warning "In your operating system, the buffer cache will not be flushed." -#endif - close (disks[i].flags); - } - - if (serial_fd >= 0) - close (serial_fd); - - /* Release memory. */ - restore_device_map (device_map); - device_map = 0; - free (disks); - disks = 0; - free (scratch); - grub_scratch_mem = 0; - - if (serial_device) - free (serial_device); - serial_device = 0; - - /* Ahh... at last we're ready to return to caller. */ - return status; -} - -/* Assign DRIVE to a device name DEVICE. */ -void -assign_device_name (int drive, const char *device) -{ - /* If DRIVE is already assigned, free it. */ - if (device_map[drive]) - free (device_map[drive]); - - /* If the old one is already opened, close it. */ - if (disks[drive].flags != -1) - { - close (disks[drive].flags); - disks[drive].flags = -1; - } - - /* Assign DRIVE to DEVICE. */ - if (! device) - device_map[drive] = 0; - else - device_map[drive] = strdup (device); -} - -void -stop (void) -{ -#ifdef HAVE_LIBCURSES - if (use_curses) - endwin (); -#endif - - /* Jump to doit. */ - longjmp (env_for_exit, 1); -} - -void -grub_reboot (void) -{ - stop (); -} - -void -grub_halt (int no_apm) -{ - stop (); -} - -/* calls for direct boot-loader chaining */ -void -chain_stage1 (unsigned long segment, unsigned long offset, - unsigned long part_table_addr) -{ - stop (); -} - - -void -chain_stage2 (unsigned long segment, unsigned long offset, int second_sector) -{ - stop (); -} - - -/* do some funky stuff, then boot linux */ -void -linux_boot (void) -{ - stop (); -} - - -/* For bzImage kernels. */ -void -big_linux_boot (void) -{ - stop (); -} - - -/* booting a multiboot executable */ -void -multi_boot (int start, int mb_info) -{ - stop (); -} - -/* sets it to linear or wired A20 operation */ -void -gateA20 (int linear) -{ - /* Nothing to do in the simulator. */ -} - -/* Set up the int15 handler. */ -void -set_int15_handler (void) -{ - /* Nothing to do in the simulator. */ -} - -/* Restore the original int15 handler. */ -void -unset_int15_handler (void) -{ - /* Nothing to do in the simulator. */ -} - -/* The key map. */ -unsigned short bios_key_map[KEY_MAP_SIZE + 1]; -unsigned short ascii_key_map[KEY_MAP_SIZE + 1]; - -/* Copy MAP to the drive map and set up the int13 handler. */ -void -set_int13_handler (unsigned short *map) -{ - /* Nothing to do in the simulator. */ -} - -int -get_code_end (void) -{ - /* Just return a little area for simulation. */ - return BOOTSEC_LOCATION + (60 * 1024); -} - - -/* memory probe routines */ -int -get_memsize (int type) -{ - if (! type) - return CONVENTIONAL_MEMSIZE >> 10; - else - return EXTENDED_MEMSIZE >> 10; -} - - -/* get_eisamemsize() : return packed EISA memory map, lower 16 bits is - * memory between 1M and 16M in 1K parts, upper 16 bits is - * memory above 16M in 64K parts. If error, return -1. - */ -int -get_eisamemsize (void) -{ - return (EXTENDED_MEMSIZE >> 10); -} - - -#define MMAR_DESC_TYPE_AVAILABLE 1 /* available to OS */ -#define MMAR_DESC_TYPE_RESERVED 2 /* not available */ -#define MMAR_DESC_TYPE_ACPI_RECLAIM 3 /* usable by OS after reading ACPI */ -#define MMAR_DESC_TYPE_ACPI_NVS 4 /* required to save between NVS sessions */ - -#define MMAR_DESC_LENGTH 20 - -/* Fetch the next entry in the memory map and return the continuation - value. DESC is a pointer to the descriptor buffer, and CONT is the - previous continuation value (0 to get the first entry in the - map). */ -int -get_mmap_entry (struct mmar_desc *desc, int cont) -{ - /* Record the memory map statically. */ - static struct mmar_desc desc_table[] = - { - /* The conventional memory. */ - { - MMAR_DESC_LENGTH, - 0, - CONVENTIONAL_MEMSIZE, - MMAR_DESC_TYPE_AVAILABLE - }, - /* BIOS RAM and ROM (such as video memory). */ - { - MMAR_DESC_LENGTH, - CONVENTIONAL_MEMSIZE, - 0x100000 - CONVENTIONAL_MEMSIZE, - MMAR_DESC_TYPE_RESERVED - }, - /* The extended memory. */ - { - MMAR_DESC_LENGTH, - 0x100000, - EXTENDED_MEMSIZE, - MMAR_DESC_TYPE_AVAILABLE - } - }; - - int num = sizeof (desc_table) / sizeof (*desc_table); - - if (cont < 0 || cont >= num) - { - /* Should not happen. */ - desc->desc_len = 0; - } - else - { - /* Copy the entry. */ - *desc = desc_table[cont++]; - - /* If the next entry exists, return the index. */ - if (cont < num) - return cont; - } - - return 0; -} - -/* Track the int13 handler. */ -void -track_int13 (int drive) -{ - /* Nothing to do in the simulator. */ -} - -/* Get the ROM configuration table. */ -unsigned long -get_rom_config_table (void) -{ - return 0; -} - -/* Get APM BIOS information. */ -void -get_apm_info (void) -{ - /* Nothing to do in the simulator. */ -} - -/* Get VBE controller information. */ -int -get_vbe_controller_info (struct vbe_controller *controller) -{ - /* Always fails. */ - return 0; -} - -/* Get VBE mode information. */ -int -get_vbe_mode_info (int mode_number, struct vbe_mode *mode) -{ - /* Always fails. */ - return 0; -} - -/* Set VBE mode. */ -int -set_vbe_mode (int mode_number) -{ - /* Always fails. */ - return 0; -} - -/* low-level timing info */ -int -getrtsecs (void) -{ - /* FIXME: exact value is not important, so just return time_t for now. */ - return time (0); -} - -int -currticks (void) -{ - struct timeval tv; - long csecs; - int ticks_per_csec, ticks_per_usec; - - /* Note: 18.2 ticks/sec. */ - - /* Get current time. */ - gettimeofday (&tv, 0); - - /* Compute centiseconds. */ - csecs = tv.tv_sec / 10; - - /* Ticks per centisecond. */ - ticks_per_csec = csecs * 182; - - /* Ticks per microsecond. */ - ticks_per_usec = (((tv.tv_sec - csecs * 10) * 1000000 + tv.tv_usec) - * 182 / 10000000); - - /* Sum them. */ - return ticks_per_csec + ticks_per_usec; -} - -/* displays an ASCII character. IBM displays will translate some - characters to special graphical ones */ -void -console_putchar (int c) -{ - /* Curses doesn't have VGA fonts. */ - switch (c) - { - case DISP_UL: - c = ACS_ULCORNER; - break; - case DISP_UR: - c = ACS_URCORNER; - break; - case DISP_LL: - c = ACS_LLCORNER; - break; - case DISP_LR: - c = ACS_LRCORNER; - break; - case DISP_HORIZ: - c = ACS_HLINE; - break; - case DISP_VERT: - c = ACS_VLINE; - break; - case DISP_LEFT: - c = ACS_LARROW; - break; - case DISP_RIGHT: - c = ACS_RARROW; - break; - case DISP_UP: - c = ACS_UARROW; - break; - case DISP_DOWN: - c = ACS_DARROW; - break; - default: - break; - } - -#ifdef HAVE_LIBCURSES - if (use_curses) - { - /* In ncurses, a newline is treated badly, so we emulate it in our - own way. */ - if (c == '\n') - { - int x, y; - - getyx (stdscr, y, x); - if (y + 1 == LINES) - scroll (stdscr); - else - move (y + 1, x); - } - else if (isprint (c)) - { - int x, y; - - getyx (stdscr, y, x); - if (x + 1 == COLS) - { - console_putchar ('\r'); - console_putchar ('\n'); - } - addch (c | console_current_color); - } - else - { - addch (c); - } - -#ifdef REFRESH_IMMEDIATELY - refresh (); -#endif - } - else -#endif - { - /* CR is not used in Unix. */ - if (c != '\r') - putchar (c); - } -} - -/* The store for ungetch simulation. This is necessary, because - ncurses-1.9.9g is still used in the world and its ungetch is - completely broken. */ -#ifdef HAVE_LIBCURSES -static int save_char = ERR; -#endif - -static int -console_translate_key (int c) -{ - switch (c) - { - case KEY_LEFT: - return 2; - case KEY_RIGHT: - return 6; - case KEY_UP: - return 16; - case KEY_DOWN: - return 14; - case KEY_DC: - return 4; - case KEY_BACKSPACE: - return 8; - case KEY_HOME: - return 1; - case KEY_END: - return 5; - case KEY_PPAGE: - return 7; - case KEY_NPAGE: - return 3; - default: - break; - } - - return c; -} - -/* like 'getkey', but doesn't wait, returns -1 if nothing available */ -int -console_checkkey (void) -{ -#ifdef HAVE_LIBCURSES - if (use_curses) - { - int c; - - /* Check for SAVE_CHAR. This should not be true, because this - means checkkey is called twice continuously. */ - if (save_char != ERR) - return save_char; - - c = getch (); - /* If C is not ERR, then put it back in the input queue. */ - if (c != ERR) - save_char = c; - return console_translate_key (c); - } -#endif - - /* Just pretend they hit the space bar, then read the real key when - they call getkey. */ - return ' '; -} - -/* returns packed BIOS/ASCII code */ -int -console_getkey (void) -{ - int c; - -#ifdef HAVE_LIBCURSES - if (use_curses) - { - /* If checkkey has already got a character, then return it. */ - if (save_char != ERR) - { - c = save_char; - save_char = ERR; - return console_translate_key (c); - } - - wtimeout (stdscr, -1); - c = getch (); - wtimeout (stdscr, 100); - } - else -#endif - c = getchar (); - - /* Quit if we get EOF. */ - if (c == -1) - stop (); - - return console_translate_key (c); -} - -/* returns packed values, LSB+1 is x, LSB is y */ -int -console_getxy (void) -{ - int y, x; -#ifdef HAVE_LIBCURSES - if (use_curses) - getyx (stdscr, y, x); - else -#endif - y = x = 0; - return (x << 8) | (y & 0xff); -} - -void -console_gotoxy (int x, int y) -{ -#ifdef HAVE_LIBCURSES - if (use_curses) - move (y, x); -#endif -} - -/* low-level character I/O */ -void -console_cls (void) -{ -#ifdef HAVE_LIBCURSES - if (use_curses) - clear (); -#endif -} - -void -console_setcolorstate (color_state state) -{ - console_current_color = - (state == COLOR_STATE_HIGHLIGHT) ? A_REVERSE : A_NORMAL; -} - -void -console_setcolor (int normal_color, int highlight_color) -{ - /* Nothing to do. */ -} - -int -console_setcursor (int on) -{ - return 1; -} - -/* Low-level disk I/O. Our stubbed version just returns a file - descriptor, not the actual geometry. */ -int -get_diskinfo (int drive, struct geometry *geometry) -{ - /* FIXME: this function is truly horrid. We try opening the device, - then severely abuse the GEOMETRY->flags field to pass a file - descriptor to biosdisk. Thank God nobody's looking at this comment, - or my reputation would be ruined. --Gord */ - - /* See if we have a cached device. */ - if (disks[drive].flags == -1) - { - /* The unpartitioned device name: /dev/XdX */ - char *devname = device_map[drive]; - char buf[512]; - - if (! devname) - return -1; - - if (verbose) - grub_printf ("Attempt to open drive 0x%x (%s)\n", - drive, devname); - - /* Open read/write, or read-only if that failed. */ - if (! read_only) - disks[drive].flags = open (devname, O_RDWR); - - if (disks[drive].flags == -1) - { - if (read_only || errno == EACCES || errno == EROFS || errno == EPERM) - { - disks[drive].flags = open (devname, O_RDONLY); - if (disks[drive].flags == -1) - { - assign_device_name (drive, 0); - return -1; - } - } - else - { - assign_device_name (drive, 0); - return -1; - } - } - - /* Attempt to read the first sector. */ - if (read (disks[drive].flags, buf, 512) != 512) - { - close (disks[drive].flags); - disks[drive].flags = -1; - assign_device_name (drive, 0); - return -1; - } - - if (disks[drive].flags != -1) - get_drive_geometry (&disks[drive], device_map, drive); - } - - if (disks[drive].flags == -1) - return -1; - -#ifdef __linux__ - /* In Linux, invalidate the buffer cache, so that left overs - from other program in the cache are flushed and seen by us */ - ioctl (disks[drive].flags, BLKFLSBUF, 0); -#endif - - *geometry = disks[drive]; - return 0; -} - -/* Read LEN bytes from FD in BUF. Return less than or equal to zero if an - error occurs, otherwise return LEN. */ -static int -nread (int fd, char *buf, size_t len) -{ - int size = len; - - while (len) - { - int ret = read (fd, buf, len); - - if (ret <= 0) - { - if (errno == EINTR) - continue; - else - return ret; - } - - len -= ret; - buf += ret; - } - - return size; -} - -/* Write LEN bytes from BUF to FD. Return less than or equal to zero if an - error occurs, otherwise return LEN. */ -static int -nwrite (int fd, char *buf, size_t len) -{ - int size = len; - - while (len) - { - int ret = write (fd, buf, len); - - if (ret <= 0) - { - if (errno == EINTR) - continue; - else - return ret; - } - - len -= ret; - buf += ret; - } - - return size; -} - -/* Dump BUF in the format of hexadecimal numbers. */ -static void -hex_dump (void *buf, size_t size) -{ - /* FIXME: How to determine which length is readable? */ -#define MAX_COLUMN 70 - - /* use unsigned char for numerical computations */ - unsigned char *ptr = buf; - /* count the width of the line */ - int column = 0; - /* how many bytes written */ - int count = 0; - - while (size > 0) - { - /* high 4 bits */ - int hi = *ptr >> 4; - /* low 4 bits */ - int low = *ptr & 0xf; - - /* grub_printf does not handle prefix number, such as %2x, so - format the number by hand... */ - grub_printf ("%x%x", hi, low); - column += 2; - count++; - ptr++; - size--; - - /* Insert space or newline with the interval 4 bytes. */ - if (size != 0 && (count % 4) == 0) - { - if (column < MAX_COLUMN) - { - grub_printf (" "); - column++; - } - else - { - grub_printf ("\n"); - column = 0; - } - } - } - - /* Add a newline at the end for readability. */ - grub_printf ("\n"); -} - -int -biosdisk (int subfunc, int drive, struct geometry *geometry, - unsigned int sector, int nsec, int segment) -{ - char *buf; - int fd = geometry->flags; - - /* Get the file pointer from the geometry, and make sure it matches. */ - if (fd == -1 || fd != disks[drive].flags) - return BIOSDISK_ERROR_GEOMETRY; - - /* Seek to the specified location. */ -#if defined(__linux__) && (!defined(__GLIBC__) || \ - ((__GLIBC__ < 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ < 1)))) - /* Maybe libc doesn't have large file support. */ - { - loff_t offset, result; - static int _llseek (uint filedes, ulong hi, ulong lo, - loff_t *res, uint wh); - _syscall5 (int, _llseek, uint, filedes, ulong, hi, ulong, lo, - loff_t *, res, uint, wh); - - offset = (loff_t) sector * (loff_t) SECTOR_SIZE; - if (_llseek (fd, offset >> 32, offset & 0xffffffff, &result, SEEK_SET)) - return -1; - } -#else - { - off_t offset = (off_t) sector * (off_t) SECTOR_SIZE; - - if (lseek (fd, offset, SEEK_SET) != offset) - return -1; - } -#endif - - buf = (char *) (segment << 4); - - switch (subfunc) - { - case BIOSDISK_READ: -#ifdef __linux__ - if (sector == 0 && nsec > 1) - { - /* Work around a bug in linux's ez remapping. Linux remaps all - sectors that are read together with the MBR in one read. It - should only remap the MBR, so we split the read in two - parts. -jochen */ - if (nread (fd, buf, SECTOR_SIZE) != SECTOR_SIZE) - return -1; - buf += SECTOR_SIZE; - nsec--; - } -#endif - if (nread (fd, buf, nsec * SECTOR_SIZE) != nsec * SECTOR_SIZE) - return -1; - break; - - case BIOSDISK_WRITE: - if (verbose) - { - grub_printf ("Write %d sectors starting from %u sector" - " to drive 0x%x (%s)\n", - nsec, sector, drive, device_map[drive]); - hex_dump (buf, nsec * SECTOR_SIZE); - } - if (! read_only) - if (nwrite (fd, buf, nsec * SECTOR_SIZE) != nsec * SECTOR_SIZE) - return -1; - break; - - default: - grub_printf ("unknown subfunc %d\n", subfunc); - break; - } - - return 0; -} - - -void -stop_floppy (void) -{ - /* NOTUSED */ -} - -/* Fetch a key from a serial device. */ -int -serial_hw_fetch (void) -{ - fd_set fds; - struct timeval to; - char c; - - /* Wait only for the serial device. */ - FD_ZERO (&fds); - FD_SET (serial_fd, &fds); - - to.tv_sec = 0; - to.tv_usec = 0; - - if (select (serial_fd + 1, &fds, 0, 0, &to) > 0) - { - if (nread (serial_fd, &c, 1) != 1) - stop (); - - return c; - } - - return -1; -} - -/* Put a character to a serial device. */ -void -serial_hw_put (int c) -{ - char ch = (char) c; - - if (nwrite (serial_fd, &ch, 1) != 1) - stop (); -} - -void -serial_hw_delay (void) -{ -#ifdef SIMULATE_SLOWNESS_OF_SERIAL - struct timeval otv, tv; - - gettimeofday (&otv, 0); - - while (1) - { - long delta; - - gettimeofday (&tv, 0); - delta = tv.tv_usec - otv.tv_usec; - if (delta < 0) - delta += 1000000; - - if (delta >= 1000000 / (serial_speed >> 3)) - break; - } -#endif /* SIMULATE_SLOWNESS_OF_SERIAL */ -} - -static speed_t -get_termios_speed (int speed) -{ - switch (speed) - { - case 2400: return B2400; - case 4800: return B4800; - case 9600: return B9600; - case 19200: return B19200; - case 38400: return B38400; -#ifdef B57600 - case 57600: return B57600; -#endif -#ifdef B115200 - case 115200: return B115200; -#endif - } - - return B0; -} - -/* Get the port number of the unit UNIT. In the grub shell, this doesn't - make sense. */ -unsigned short -serial_hw_get_port (int unit) -{ - return 0; -} - -/* Initialize a serial device. In the grub shell, PORT is unused. */ -int -serial_hw_init (unsigned short port, unsigned int speed, - int word_len, int parity, int stop_bit_len) -{ - struct termios termios; - speed_t termios_speed; - int i; - - /* Check if the file name is specified. */ - if (! serial_device) - return 0; - - /* If a serial device is already opened, close it first. */ - if (serial_fd >= 0) - close (serial_fd); - - /* Open the device file. */ - serial_fd = open (serial_device, - O_RDWR | O_NOCTTY -#if defined(O_SYNC) - /* O_SYNC is used in Linux (and some others?). */ - | O_SYNC -#elif defined(O_FSYNC) - /* O_FSYNC is used in FreeBSD. */ - | O_FSYNC -#endif - ); - if (serial_fd < 0) - return 0; - - /* Get the termios parameters. */ - if (tcgetattr (serial_fd, &termios)) - goto fail; - - /* Raw mode. */ -#if defined(__sun) - termios.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON); - termios.c_oflag &= ~OPOST; - termios.c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN); - termios.c_cflag &= ~(CSIZE|PARENB); - termios.c_cflag |= CS8; -#else - cfmakeraw (&termios); -#endif - - /* Set the speed. */ - termios_speed = get_termios_speed (speed); - if (termios_speed == B0) - goto fail; - - cfsetispeed (&termios, termios_speed); - cfsetospeed (&termios, termios_speed); - - /* Set the word length. */ - termios.c_cflag &= ~CSIZE; - switch (word_len) - { - case UART_5BITS_WORD: - termios.c_cflag |= CS5; - break; - case UART_6BITS_WORD: - termios.c_cflag |= CS6; - break; - case UART_7BITS_WORD: - termios.c_cflag |= CS7; - break; - case UART_8BITS_WORD: - termios.c_cflag |= CS8; - break; - default: - goto fail; - } - - /* Set the parity. */ - switch (parity) - { - case UART_NO_PARITY: - termios.c_cflag &= ~PARENB; - break; - case UART_ODD_PARITY: - termios.c_cflag |= PARENB; - termios.c_cflag |= PARODD; - break; - case UART_EVEN_PARITY: - termios.c_cflag |= PARENB; - termios.c_cflag &= ~PARODD; - break; - default: - goto fail; - } - - /* Set the length of stop bit. */ - switch (stop_bit_len) - { - case UART_1_STOP_BIT: - termios.c_cflag &= ~CSTOPB; - break; - case UART_2_STOP_BITS: - termios.c_cflag |= CSTOPB; - break; - default: - goto fail; - } - - /* Set the parameters. */ - if (tcsetattr (serial_fd, TCSANOW, &termios)) - goto fail; - -#ifdef SIMULATE_SLOWNESS_OF_SERIAL - serial_speed = speed; -#endif /* SIMUATE_SLOWNESS_OF_SERIAL */ - - /* Get rid of the flag TERM_NEED_INIT from the serial terminal. */ - for (i = 0; term_table[i].name; i++) - { - if (strcmp (term_table[i].name, "serial") == 0) - { - term_table[i].flags &= ~(TERM_NEED_INIT); - break; - } - } - - return 1; - - fail: - close (serial_fd); - serial_fd = -1; - return 0; -} - -/* Set the file name of a serial device (or a pty device). This is a - function specific to the grub shell. */ -void -serial_set_device (const char *device) -{ - if (serial_device) - free (serial_device); - - serial_device = strdup (device); -} - -/* There is no difference between console and hercules in the grub shell. */ -void -hercules_putchar (int c) -{ - console_putchar (c); -} - -int -hercules_getxy (void) -{ - return console_getxy (); -} - -void -hercules_gotoxy (int x, int y) -{ - console_gotoxy (x, y); -} - -void -hercules_cls (void) -{ - console_cls (); -} - -void -hercules_setcolorstate (color_state state) -{ - console_setcolorstate (state); -} - -void -hercules_setcolor (int normal_color, int highlight_color) -{ - console_setcolor (normal_color, highlight_color); -} - -int -hercules_setcursor (int on) -{ - return 1; -} - -uint32_t amd64_cpuid_supported(void) -{ - /* Nothing to do in the simulator. */ - return (1); -} - -void amd64_cpuid_insn(uint32_t i, void * r) -{ - /* Nothing to do in the simulator. */ -} - -void amd64_rdmsr(uint32_t i, uint64_t * p) -{ - /* Nothing to do in the simulator. */ -} - -void amd64_wrmsr(uint32_t i, const uint64_t * p) -{ - /* Nothing to do in the simulator. */ -} - -int get_target_operating_mode(void) -{ - /* Nothing to do in the simulator. */ - return (1); -} diff --git a/usr/src/grub/grub-0.95/grub/main.c b/usr/src/grub/grub-0.95/grub/main.c deleted file mode 100644 index dfe847e98a..0000000000 --- a/usr/src/grub/grub-0.95/grub/main.c +++ /dev/null @@ -1,265 +0,0 @@ -/* main.c - experimental GRUB stage2 that runs under Unix */ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 1999,2000,2001,2002 Free Software Foundation, 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 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. - */ - -/* Simulator entry point. */ -int grub_stage2 (void); - -#include -#include -#include -#include -#include -#include -#include - -#define WITHOUT_LIBC_STUBS 1 -#include -#include - -char *program_name = 0; -int use_config_file = 1; -int use_preset_menu = 0; -#ifdef HAVE_LIBCURSES -int use_curses = 1; -#else -int use_curses = 0; -#endif -int verbose = 0; -int read_only = 0; -int floppy_disks = 1; -char *device_map_file = 0; -static int default_boot_drive; -static int default_install_partition; -static char *default_config_file; - -#define OPT_HELP -2 -#define OPT_VERSION -3 -#define OPT_HOLD -4 -#define OPT_CONFIG_FILE -5 -#define OPT_INSTALL_PARTITION -6 -#define OPT_BOOT_DRIVE -7 -#define OPT_NO_CONFIG_FILE -8 -#define OPT_NO_CURSES -9 -#define OPT_BATCH -10 -#define OPT_VERBOSE -11 -#define OPT_READ_ONLY -12 -#define OPT_PROBE_SECOND_FLOPPY -13 -#define OPT_NO_FLOPPY -14 -#define OPT_DEVICE_MAP -15 -#define OPT_PRESET_MENU -16 -#define OPT_NO_PAGER -17 -#define OPTSTRING "" - -static struct option longopts[] = -{ - {"batch", no_argument, 0, OPT_BATCH}, - {"boot-drive", required_argument, 0, OPT_BOOT_DRIVE}, - {"config-file", required_argument, 0, OPT_CONFIG_FILE}, - {"device-map", required_argument, 0, OPT_DEVICE_MAP}, - {"help", no_argument, 0, OPT_HELP}, - {"hold", optional_argument, 0, OPT_HOLD}, - {"install-partition", required_argument, 0, OPT_INSTALL_PARTITION}, - {"no-config-file", no_argument, 0, OPT_NO_CONFIG_FILE}, - {"no-curses", no_argument, 0, OPT_NO_CURSES}, - {"no-floppy", no_argument, 0, OPT_NO_FLOPPY}, - {"no-pager", no_argument, 0, OPT_NO_PAGER}, - {"preset-menu", no_argument, 0, OPT_PRESET_MENU}, - {"probe-second-floppy", no_argument, 0, OPT_PROBE_SECOND_FLOPPY}, - {"read-only", no_argument, 0, OPT_READ_ONLY}, - {"verbose", no_argument, 0, OPT_VERBOSE}, - {"version", no_argument, 0, OPT_VERSION}, - {0}, -}; - - -static void -usage (int status) -{ - if (status) - fprintf (stderr, "Try ``grub --help'' for more information.\n"); - else - printf ("\ -Usage: grub [OPTION]...\n\ -\n\ -Enter the GRand Unified Bootloader command shell.\n\ -\n\ - --batch turn on batch mode for non-interactive use\n\ - --boot-drive=DRIVE specify stage2 boot_drive [default=0x%x]\n\ - --config-file=FILE specify stage2 config_file [default=%s]\n\ - --device-map=FILE use the device map file FILE\n\ - --help display this message and exit\n\ - --hold wait until a debugger will attach\n\ - --install-partition=PAR specify stage2 install_partition [default=0x%x]\n\ - --no-config-file do not use the config file\n\ - --no-curses do not use curses\n\ - --no-floppy do not probe any floppy drive\n\ - --no-pager do not use internal pager\n\ - --preset-menu use the preset menu\n\ - --probe-second-floppy probe the second floppy drive\n\ - --read-only do not write anything to devices\n\ - --verbose print verbose messages\n\ - --version print version information and exit\n\ -\n\ -Report bugs to .\n\ -", - default_boot_drive, default_config_file, - default_install_partition); - - exit (status); -} - - -int -main (int argc, char **argv) -{ - int c; - int hold = 0; - - /* First of all, call sync so that all in-core data is scheduled to be - actually written to disks. This is very important because GRUB does - not use ordinary stdio interface but raw devices. */ - sync (); - - program_name = argv[0]; - default_boot_drive = boot_drive; - default_install_partition = install_partition; - if (config_file) - default_config_file = config_file; - else - default_config_file = "NONE"; - - /* Parse command-line options. */ - do - { - c = getopt_long (argc, argv, OPTSTRING, longopts, 0); - switch (c) - { - case EOF: - /* Fall through the bottom of the loop. */ - break; - - case OPT_HELP: - usage (0); - break; - - case OPT_VERSION: - printf ("grub (GNU GRUB " VERSION ")\n"); - exit (0); - break; - - case OPT_HOLD: - if (! optarg) - hold = -1; - else - hold = atoi (optarg); - break; - - case OPT_CONFIG_FILE: - strncpy (config_file, optarg, 127); /* FIXME: arbitrary */ - config_file[127] = '\0'; - break; - - case OPT_INSTALL_PARTITION: - install_partition = strtoul (optarg, 0, 0); - if (install_partition == ULONG_MAX) - { - perror ("strtoul"); - exit (1); - } - break; - - case OPT_BOOT_DRIVE: - boot_drive = strtoul (optarg, 0, 0); - if (boot_drive == ULONG_MAX) - { - perror ("strtoul"); - exit (1); - } - break; - - case OPT_NO_CONFIG_FILE: - use_config_file = 0; - break; - - case OPT_NO_CURSES: - use_curses = 0; - break; - - case OPT_NO_PAGER: - use_pager = 0; - break; - - case OPT_BATCH: - /* This is the same as "--no-config-file --no-curses --no-pager". */ - use_config_file = 0; - use_curses = 0; - use_pager = 0; - break; - - case OPT_READ_ONLY: - read_only = 1; - break; - - case OPT_VERBOSE: - verbose = 1; - break; - - case OPT_NO_FLOPPY: - floppy_disks = 0; - break; - - case OPT_PROBE_SECOND_FLOPPY: - floppy_disks = 2; - break; - - case OPT_DEVICE_MAP: - device_map_file = strdup (optarg); - break; - - case OPT_PRESET_MENU: - use_preset_menu = 1; - break; - - default: - usage (1); - } - } - while (c != EOF); - - /* Wait until the HOLD variable is cleared by an attached debugger. */ - if (hold && verbose) - printf ("Run \"gdb %s %d\", and set HOLD to zero.\n", - program_name, (int) getpid ()); - while (hold) - { - if (hold > 0) - hold--; - - sleep (1); - } - - /* If we don't have curses (!HAVE_LIBCURSES or --no-curses or - --batch) put terminal to dumb for better handling of line i/o */ - if (! use_curses) - current_term->flags = TERM_NO_EDIT | TERM_DUMB; - - /* Transfer control to the stage2 simulator. */ - exit (grub_stage2 ()); -} diff --git a/usr/src/grub/grub-0.95/grub/mapfile-intf b/usr/src/grub/grub-0.95/grub/mapfile-intf deleted file mode 100644 index d265fe30d7..0000000000 --- a/usr/src/grub/grub-0.95/grub/mapfile-intf +++ /dev/null @@ -1,43 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License (the "License"). -# You may not use this file except in compliance with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# - -# -# Copyright 2007 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# ident "%Z%%M% %I% %E% SMI" -# - -# The grub shell interposes on the getopt() family - this reimplementation is -# required for the real grub loader which can't depend on libc. The grub shell -# is built from the same source as the grub loader. -{ - global: - getopt = INTERPOSE; - getopt_long = INTERPOSE; - getopt_long_only = INTERPOSE; - optarg = INTERPOSE; - opterr = INTERPOSE; - optind = INTERPOSE; - optopt = INTERPOSE; - local: - *; -}; diff --git a/usr/src/grub/grub-0.95/install-sh b/usr/src/grub/grub-0.95/install-sh deleted file mode 100755 index 040ebc8866..0000000000 --- a/usr/src/grub/grub-0.95/install-sh +++ /dev/null @@ -1,310 +0,0 @@ -#!/bin/sh -# install - install a program, script, or datafile - -scriptversion=2004-01-12.10 - -# This originates from X11R5 (mit/util/scripts/install.sh), which was -# later released in X11R6 (xc/config/util/install.sh) with the -# following copyright and license. -# -# Copyright (C) 1994 X Consortium -# -# 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 -# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- -# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# -# Except as contained in this notice, the name of the X Consortium shall not -# be used in advertising or otherwise to promote the sale, use or other deal- -# ings in this Software without prior written authorization from the X Consor- -# tium. -# -# -# FSF changes to this file are in the public domain. -# -# Calling this script install-sh is preferred over install.sh, to prevent -# `make' implicit rules from creating a file called install from it -# when there is no Makefile. -# -# This script is compatible with the BSD install script, but was written -# from scratch. It can only install one file at a time, a restriction -# shared with many OS's install programs. - -# set DOITPROG to echo to test this script - -# Don't use :- since 4.3BSD and earlier shells don't like it. -doit="${DOITPROG-}" - -# put in absolute paths if you don't have them in your path; or use env. vars. - -mvprog="${MVPROG-mv}" -cpprog="${CPPROG-cp}" -chmodprog="${CHMODPROG-chmod}" -chownprog="${CHOWNPROG-chown}" -chgrpprog="${CHGRPPROG-chgrp}" -stripprog="${STRIPPROG-strip}" -rmprog="${RMPROG-rm}" -mkdirprog="${MKDIRPROG-mkdir}" - -transformbasename= -transform_arg= -instcmd="$mvprog" -chmodcmd="$chmodprog 0755" -chowncmd= -chgrpcmd= -stripcmd= -rmcmd="$rmprog -f" -mvcmd="$mvprog" -src= -dst= -dir_arg= - -usage="Usage: $0 [OPTION]... SRCFILE DSTFILE - or: $0 [OPTION]... SRCFILES... DIRECTORY - or: $0 -d DIRECTORIES... - -In the first form, install SRCFILE to DSTFILE, removing SRCFILE by default. -In the second, create the directory path DIR. - -Options: --b=TRANSFORMBASENAME --c copy source (using $cpprog) instead of moving (using $mvprog). --d create directories instead of installing files. --g GROUP $chgrp installed files to GROUP. --m MODE $chmod installed files to MODE. --o USER $chown installed files to USER. --s strip installed files (using $stripprog). --t=TRANSFORM ---help display this help and exit. ---version display version info and exit. - -Environment variables override the default commands: - CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG -" - -while test -n "$1"; do - case $1 in - -b=*) transformbasename=`echo $1 | sed 's/-b=//'` - shift - continue;; - - -c) instcmd=$cpprog - shift - continue;; - - -d) dir_arg=true - shift - continue;; - - -g) chgrpcmd="$chgrpprog $2" - shift - shift - continue;; - - --help) echo "$usage"; exit 0;; - - -m) chmodcmd="$chmodprog $2" - shift - shift - continue;; - - -o) chowncmd="$chownprog $2" - shift - shift - continue;; - - -s) stripcmd=$stripprog - shift - continue;; - - -t=*) transformarg=`echo $1 | sed 's/-t=//'` - shift - continue;; - - --version) echo "$0 $scriptversion"; exit 0;; - - *) # When -d is used, all remaining arguments are directories to create. - test -n "$dir_arg" && break - # Otherwise, the last argument is the destination. Remove it from $@. - for arg - do - if test -n "$dstarg"; then - # $@ is not empty: it contains at least $arg. - set fnord "$@" "$dstarg" - shift # fnord - fi - shift # arg - dstarg=$arg - done - break;; - esac -done - -if test -z "$1"; then - if test -z "$dir_arg"; then - echo "$0: no input file specified." >&2 - exit 1 - fi - # It's OK to call `install-sh -d' without argument. - # This can happen when creating conditional directories. - exit 0 -fi - -for src -do - # Protect names starting with `-'. - case $src in - -*) src=./$src ;; - esac - - if test -n "$dir_arg"; then - dst=$src - src= - - if test -d "$dst"; then - instcmd=: - chmodcmd= - else - instcmd=$mkdirprog - fi - else - # Waiting for this to be detected by the "$instcmd $src $dsttmp" command - # might cause directories to be created, which would be especially bad - # if $src (and thus $dsttmp) contains '*'. - if test ! -f "$src" && test ! -d "$src"; then - echo "$0: $src does not exist." >&2 - exit 1 - fi - - if test -z "$dstarg"; then - echo "$0: no destination specified." >&2 - exit 1 - fi - - dst=$dstarg - # Protect names starting with `-'. - case $dst in - -*) dst=./$dst ;; - esac - - # If destination is a directory, append the input filename; won't work - # if double slashes aren't ignored. - if test -d "$dst"; then - dst=$dst/`basename "$src"` - fi - fi - - # This sed command emulates the dirname command. - dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` - - # Make sure that the destination directory exists. - - # Skip lots of stat calls in the usual case. - if test ! -d "$dstdir"; then - defaultIFS=' - ' - IFS="${IFS-$defaultIFS}" - - oIFS=$IFS - # Some sh's can't handle IFS=/ for some reason. - IFS='%' - set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` - IFS=$oIFS - - pathcomp= - - while test $# -ne 0 ; do - pathcomp=$pathcomp$1 - shift - test -d "$pathcomp" || $mkdirprog "$pathcomp" - pathcomp=$pathcomp/ - done - fi - - if test -n "$dir_arg"; then - $doit $instcmd "$dst" \ - && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \ - && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \ - && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \ - && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; } - - else - # If we're going to rename the final executable, determine the name now. - if test -z "$transformarg"; then - dstfile=`basename "$dst"` - else - dstfile=`basename "$dst" $transformbasename \ - | sed $transformarg`$transformbasename - fi - - # don't allow the sed command to completely eliminate the filename. - test -z "$dstfile" && dstfile=`basename "$dst"` - - # Make a couple of temp file names in the proper directory. - dsttmp=$dstdir/_inst.$$_ - rmtmp=$dstdir/_rm.$$_ - - # Trap to clean up those temp files at exit. - trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0 - trap '(exit $?); exit' 1 2 13 15 - - # Move or copy the file name to the temp name - $doit $instcmd "$src" "$dsttmp" && - - # and set any options; do chmod last to preserve setuid bits. - # - # If any of these fail, we abort the whole thing. If we want to - # ignore errors from any of these, just make sure not to ignore - # errors from the above "$doit $instcmd $src $dsttmp" command. - # - { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ - && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ - && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ - && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } && - - # Now remove or move aside any old file at destination location. We - # try this two ways since rm can't unlink itself on some systems and - # the destination file might be busy for other reasons. In this case, - # the final cleanup might fail but the new file should still install - # successfully. - { - if test -f "$dstdir/$dstfile"; then - $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \ - || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ - || { - echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 - (exit 1); exit - } - else - : - fi - } && - - # Now rename the file to the real destination. - $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" - fi || { (exit 1); exit; } -done - -# The final little trick to "correctly" pass the exit status to the exit trap. -{ - (exit 0); exit -} - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-end: "$" -# End: diff --git a/usr/src/grub/grub-0.95/lib/Makefile.am b/usr/src/grub/grub-0.95/lib/Makefile.am deleted file mode 100644 index 645a03f468..0000000000 --- a/usr/src/grub/grub-0.95/lib/Makefile.am +++ /dev/null @@ -1,6 +0,0 @@ -noinst_LIBRARIES = libcommon.a - -AM_CFLAGS = $(GRUB_CFLAGS) -I$(top_srcdir)/stage2 \ - -I$(top_srcdir)/stage1 - -libcommon_a_SOURCES = getopt.c getopt1.c getopt.h device.c device.h diff --git a/usr/src/grub/grub-0.95/lib/Makefile.in b/usr/src/grub/grub-0.95/lib/Makefile.in deleted file mode 100644 index 9cb63e5302..0000000000 --- a/usr/src/grub/grub-0.95/lib/Makefile.in +++ /dev/null @@ -1,417 +0,0 @@ -# Makefile.in generated by automake 1.8.5 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -SOURCES = $(libcommon_a_SOURCES) - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = .. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -host_triplet = @host@ -subdir = lib -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -LIBRARIES = $(noinst_LIBRARIES) -AR = ar -ARFLAGS = cru -libcommon_a_AR = $(AR) $(ARFLAGS) -libcommon_a_LIBADD = -am_libcommon_a_OBJECTS = getopt.$(OBJEXT) getopt1.$(OBJEXT) \ - device.$(OBJEXT) -libcommon_a_OBJECTS = $(am_libcommon_a_OBJECTS) -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/device.Po ./$(DEPDIR)/getopt.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/getopt1.Po -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(libcommon_a_SOURCES) -DIST_SOURCES = $(libcommon_a_SOURCES) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BUILD_EXAMPLE_KERNEL_FALSE = @BUILD_EXAMPLE_KERNEL_FALSE@ -BUILD_EXAMPLE_KERNEL_TRUE = @BUILD_EXAMPLE_KERNEL_TRUE@ -CC = @CC@ -CCAS = @CCAS@ -CCASFLAGS = @CCASFLAGS@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DISKLESS_SUPPORT_FALSE = @DISKLESS_SUPPORT_FALSE@ -DISKLESS_SUPPORT_TRUE = @DISKLESS_SUPPORT_TRUE@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FSYS_CFLAGS = @FSYS_CFLAGS@ -GRUB_CFLAGS = @GRUB_CFLAGS@ -GRUB_LIBS = @GRUB_LIBS@ -HERCULES_SUPPORT_FALSE = @HERCULES_SUPPORT_FALSE@ -HERCULES_SUPPORT_TRUE = @HERCULES_SUPPORT_TRUE@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LTLIBOBJS = @LTLIBOBJS@ -MAINT = @MAINT@ -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ -MAKEINFO = @MAKEINFO@ -NETBOOT_DRIVERS = @NETBOOT_DRIVERS@ -NETBOOT_SUPPORT_FALSE = @NETBOOT_SUPPORT_FALSE@ -NETBOOT_SUPPORT_TRUE = @NETBOOT_SUPPORT_TRUE@ -NET_CFLAGS = @NET_CFLAGS@ -NET_EXTRAFLAGS = @NET_EXTRAFLAGS@ -OBJCOPY = @OBJCOPY@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -RANLIB = @RANLIB@ -SERIAL_SPEED_SIMULATION_FALSE = @SERIAL_SPEED_SIMULATION_FALSE@ -SERIAL_SPEED_SIMULATION_TRUE = @SERIAL_SPEED_SIMULATION_TRUE@ -SERIAL_SUPPORT_FALSE = @SERIAL_SUPPORT_FALSE@ -SERIAL_SUPPORT_TRUE = @SERIAL_SUPPORT_TRUE@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STAGE1_CFLAGS = @STAGE1_CFLAGS@ -STAGE2_CFLAGS = @STAGE2_CFLAGS@ -STRIP = @STRIP@ -VERSION = @VERSION@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_OBJCOPY = @ac_ct_OBJCOPY@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -noinst_LIBRARIES = libcommon.a -AM_CFLAGS = $(GRUB_CFLAGS) -I$(top_srcdir)/stage2 \ - -I$(top_srcdir)/stage1 - -libcommon_a_SOURCES = getopt.c getopt1.c getopt.h device.c device.h -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .o .obj -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu lib/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu lib/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -clean-noinstLIBRARIES: - -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) -libcommon.a: $(libcommon_a_OBJECTS) $(libcommon_a_DEPENDENCIES) - -rm -f libcommon.a - $(libcommon_a_AR) libcommon.a $(libcommon_a_OBJECTS) $(libcommon_a_LIBADD) - $(RANLIB) libcommon.a - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/device.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt1.Po@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` -uninstall-info-am: - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LIBRARIES) -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-noinstLIBRARIES ctags distclean distclean-compile \ - distclean-generic distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-exec install-exec-am install-info \ - install-info-am install-man install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ - uninstall-am uninstall-info-am - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/usr/src/grub/grub-0.95/lib/Makefile.solaris b/usr/src/grub/grub-0.95/lib/Makefile.solaris deleted file mode 100644 index 189133d80d..0000000000 --- a/usr/src/grub/grub-0.95/lib/Makefile.solaris +++ /dev/null @@ -1,56 +0,0 @@ -# -# Copyright 2005 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# ident "%Z%%M% %I% %E% SMI" -# -include ../../Makefile.grub -include ../Makefile.solaris.defs - -INCLUDES = -I. -I.. -I../stage1 -I../stage2 -CFLAGS += -O2 - - -LIBCOMMON = libcommon.a -LIBCOMMON_OBJS = device.o \ - getopt.o \ - getopt1.o - -LIBRARIES = $(LIBCOMMON) - -# -# Source files to be installed in $(SRC_DIR). -# -SRC_DIR = $(ROOT_SRC)/lib -SRC_FILES = Makefile.am Makefile.in device.c device.h \ - getopt.c getopt.h getopt1.c - -INSTALL_TARGETS = $(SRC_FILES:%=$(SRC_DIR)/%) - - -all: $(LIBRARIES) - -$(LIBCOMMON): $(LIBCOMMON_OBJS) - $(RM) $@ - $(AR) cru $@ $(LIBCOMMON_OBJS) - $(RANLIB) $@ - -$(LIBCOMMON_OBJS): $$(@:.o=.c) - $(CC) $(CFLAGS) -c -o $@ $(@:.o=.c) - - -install: all $(INSTALL_TARGETS) - -$(SRC_DIR)/%: $(SRC_DIR) % - $(INS.file) - -$(SRC_DIR): - $(INS.dir) - - -clean: _FORCE - $(RM) *.o $(LIBRARIES) - -clobber: clean - -_FORCE: diff --git a/usr/src/grub/grub-0.95/lib/device.c b/usr/src/grub/grub-0.95/lib/device.c deleted file mode 100644 index 3fb3ebb0ca..0000000000 --- a/usr/src/grub/grub-0.95/lib/device.c +++ /dev/null @@ -1,938 +0,0 @@ -/* device.c - Some helper functions for OS devices and BIOS drives */ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, 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 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. - */ - -/* Try to use glibc's transparant LFS support. */ -#define _LARGEFILE_SOURCE 1 -/* lseek becomes synonymous with lseek64. */ -#define _FILE_OFFSET_BITS 64 - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef __linux__ -# if !defined(__GLIBC__) || \ - ((__GLIBC__ < 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ < 1))) -/* Maybe libc doesn't have large file support. */ -# include /* _llseek */ -# endif /* (GLIBC < 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR < 1)) */ -# include /* ioctl */ -# ifndef HDIO_GETGEO -# define HDIO_GETGEO 0x0301 /* get device geometry */ -/* If HDIO_GETGEO is not defined, it is unlikely that hd_geometry is - defined. */ -struct hd_geometry -{ - unsigned char heads; - unsigned char sectors; - unsigned short cylinders; - unsigned long start; -}; -# endif /* ! HDIO_GETGEO */ -# ifndef FLOPPY_MAJOR -# define FLOPPY_MAJOR 2 /* the major number for floppy */ -# endif /* ! FLOPPY_MAJOR */ -# ifndef MAJOR -# define MAJOR(dev) \ - ({ \ - unsigned long long __dev = (dev); \ - (unsigned) ((__dev >> 8) & 0xfff) \ - | ((unsigned int) (__dev >> 32) & ~0xfff); \ - }) -# endif /* ! MAJOR */ -# ifndef CDROM_GET_CAPABILITY -# define CDROM_GET_CAPABILITY 0x5331 /* get capabilities */ -# endif /* ! CDROM_GET_CAPABILITY */ -# ifndef BLKGETSIZE -# define BLKGETSIZE _IO(0x12,96) /* return device size */ -# endif /* ! BLKGETSIZE */ -#endif /* __linux__ */ - -/* Use __FreeBSD_kernel__ instead of __FreeBSD__ for compatibility with - kFreeBSD-based non-FreeBSD systems (e.g. GNU/kFreeBSD) */ -#if defined(__FreeBSD__) && ! defined(__FreeBSD_kernel__) -# define __FreeBSD_kernel__ -#endif -#ifdef __FreeBSD_kernel__ - /* Obtain version of kFreeBSD headers */ -# include -# ifndef __FreeBSD_kernel_version -# define __FreeBSD_kernel_version __FreeBSD_version -# endif - - /* Runtime detection of kernel */ -# include -int -get_kfreebsd_version () -{ - struct utsname uts; - int major; int minor, v[2]; - - uname (&uts); - sscanf (uts.release, "%d.%d", &major, &minor); - - if (major >= 9) - major = 9; - if (major >= 5) - { - v[0] = minor/10; v[1] = minor%10; - } - else - { - v[0] = minor%10; v[1] = minor/10; - } - return major*100000+v[0]*10000+v[1]*1000; -} -#endif /* __FreeBSD_kernel__ */ - -#if defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) -# include /* ioctl */ -# include -# include /* CDIOCCLRDEBUG */ -# if defined(__FreeBSD_kernel__) -# include -# if __FreeBSD_kernel_version >= 500040 -# include -# endif -# endif /* __FreeBSD_kernel__ */ -#endif /* __FreeBSD_kernel__ || __NetBSD__ || __OpenBSD__ */ - -#if defined(__sun) -# include -#endif /* __sun */ - -#ifdef HAVE_OPENDISK -# include -#endif /* HAVE_OPENDISK */ - -#define WITHOUT_LIBC_STUBS 1 -#include -#include - -/* Get the geometry of a drive DRIVE. */ -void -get_drive_geometry (struct geometry *geom, char **map, int drive) -{ - int fd; - - if (geom->flags == -1) - { - fd = open (map[drive], O_RDONLY); - assert (fd >= 0); - } - else - fd = geom->flags; - - /* XXX This is the default size. */ - geom->sector_size = SECTOR_SIZE; - -#if defined(__linux__) - /* Linux */ - { - struct hd_geometry hdg; - unsigned long nr; - - if (ioctl (fd, HDIO_GETGEO, &hdg)) - goto fail; - - if (ioctl (fd, BLKGETSIZE, &nr)) - goto fail; - - /* Got the geometry, so save it. */ - geom->cylinders = hdg.cylinders; - geom->heads = hdg.heads; - geom->sectors = hdg.sectors; - geom->total_sectors = nr; - - goto success; - } - -#elif defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) -# if defined(__FreeBSD_kernel__) && __FreeBSD_kernel_version >= 500040 - /* kFreeBSD version 5 or later */ - if (get_kfreebsd_version () >= 500040) - { - unsigned int sector_size; - off_t media_size; - unsigned int tmp; - - if(ioctl (fd, DIOCGSECTORSIZE, §or_size) != 0) - sector_size = 512; - - if (ioctl (fd, DIOCGMEDIASIZE, &media_size) != 0) - goto fail; - - geom->total_sectors = media_size / sector_size; - - if (ioctl (fd, DIOCGFWSECTORS, &tmp) == 0) - geom->sectors = tmp; - else - geom->sectors = 63; - if (ioctl (fd, DIOCGFWHEADS, &tmp) == 0) - geom->heads = tmp; - else if (geom->total_sectors <= 63 * 1 * 1024) - geom->heads = 1; - else if (geom->total_sectors <= 63 * 16 * 1024) - geom->heads = 16; - else - geom->heads = 255; - - geom->cylinders = (geom->total_sectors - / geom->heads - / geom->sectors); - - goto success; - } - else -#endif /* defined(__FreeBSD_kernel__) && __FreeBSD_kernel_version >= 500040 */ - - /* kFreeBSD < 5, NetBSD or OpenBSD */ - { - struct disklabel hdg; - if (ioctl (fd, DIOCGDINFO, &hdg)) - goto fail; - - geom->cylinders = hdg.d_ncylinders; - geom->heads = hdg.d_ntracks; - geom->sectors = hdg.d_nsectors; - geom->total_sectors = hdg.d_secperunit; - - goto success; - } - -#elif defined(__sun) - /* Solaris */ - { - struct dk_geom dkg; - - if (ioctl(fd, DKIOCG_PHYGEOM, &dkg)) - goto fail; - geom->cylinders = dkg.dkg_ncyl; - geom->heads = dkg.dkg_nhead; - geom->sectors = dkg.dkg_nsect; - geom->total_sectors = dkg.dkg_ncyl * dkg.dkg_nhead * dkg.dkg_nsect; - - goto success; - } - -#else - /* Notably, defined(__GNU__) */ -# warning "Automatic detection of geometries will be performed only \ -partially. This is not fatal." -#endif - - fail: - { - struct stat st; - - /* FIXME: It would be nice to somehow compute fake C/H/S settings, - given a proper st_blocks size. */ - if (drive & 0x80) - { - geom->cylinders = DEFAULT_HD_CYLINDERS; - geom->heads = DEFAULT_HD_HEADS; - geom->sectors = DEFAULT_HD_SECTORS; - } - else - { - geom->cylinders = DEFAULT_FD_CYLINDERS; - geom->heads = DEFAULT_FD_HEADS; - geom->sectors = DEFAULT_FD_SECTORS; - } - - /* Set the total sectors properly, if we can. */ - if (! fstat (fd, &st) && st.st_blocks) - geom->total_sectors = st.st_blocks; - else - geom->total_sectors = geom->cylinders * geom->heads * geom->sectors; - } - - success: - if (geom->flags == -1) - close (fd); -} - -#ifdef __linux__ -/* Check if we have devfs support. */ -static int -have_devfs (void) -{ - static int dev_devfsd_exists = -1; - - if (dev_devfsd_exists < 0) - { - struct stat st; - - dev_devfsd_exists = stat ("/dev/.devfsd", &st) == 0; - } - - return dev_devfsd_exists; -} -#endif /* __linux__ */ - -/* These three functions are quite different among OSes. */ -static void -get_floppy_disk_name (char *name, int unit) -{ -#if defined(__linux__) - /* GNU/Linux */ - if (have_devfs ()) - sprintf (name, "/dev/floppy/%d", unit); - else - sprintf (name, "/dev/fd%d", unit); -#elif defined(__GNU__) - /* GNU/Hurd */ - sprintf (name, "/dev/fd%d", unit); -#elif defined(__FreeBSD_kernel__) - /* kFreeBSD */ - if (get_kfreebsd_version () >= 400000) - sprintf (name, "/dev/fd%d", unit); - else - sprintf (name, "/dev/rfd%d", unit); -#elif defined(__NetBSD__) - /* NetBSD */ - /* opendisk() doesn't work for floppies. */ - sprintf (name, "/dev/rfd%da", unit); -#elif defined(__OpenBSD__) - /* OpenBSD */ - sprintf (name, "/dev/rfd%dc", unit); -#elif defined(__QNXNTO__) - /* QNX RTP */ - sprintf (name, "/dev/fd%d", unit); -#elif defined(__sun) - /* Solaris */ - sprintf (name, "/dev/rdiskette%d", unit); -#else -# warning "BIOS floppy drives cannot be guessed in your operating system." - /* Set NAME to a bogus string. */ - *name = 0; -#endif -} - -static void -get_ide_disk_name (char *name, int unit) -{ -#if defined(__linux__) - /* GNU/Linux */ - sprintf (name, "/dev/hd%c", unit + 'a'); -#elif defined(__GNU__) - /* GNU/Hurd */ - sprintf (name, "/dev/hd%d", unit); -#elif defined(__FreeBSD_kernel__) - /* kFreeBSD */ - if (get_kfreebsd_version () >= 400000) - sprintf (name, "/dev/ad%d", unit); - else - sprintf (name, "/dev/rwd%d", unit); -#elif defined(__NetBSD__) && defined(HAVE_OPENDISK) - /* NetBSD */ - char shortname[16]; - int fd; - - sprintf (shortname, "wd%d", unit); - fd = opendisk (shortname, O_RDONLY, name, - 16, /* length of NAME */ - 0 /* char device */ - ); - close (fd); -#elif defined(__OpenBSD__) - /* OpenBSD */ - sprintf (name, "/dev/rwd%dc", unit); -#elif defined(__QNXNTO__) - /* QNX RTP */ - /* Actually, QNX RTP doesn't distinguish IDE from SCSI, so this could - contain SCSI disks. */ - sprintf (name, "/dev/hd%d", unit); -#elif defined(__sun) - *name = 0; /* FIXME */ -#else -# warning "BIOS IDE drives cannot be guessed in your operating system." - /* Set NAME to a bogus string. */ - *name = 0; -#endif -} - -static void -get_scsi_disk_name (char *name, int unit) -{ -#if defined(__linux__) - /* GNU/Linux */ - sprintf (name, "/dev/sd%c", unit + 'a'); -#elif defined(__GNU__) - /* GNU/Hurd */ - sprintf (name, "/dev/sd%d", unit); -#elif defined(__FreeBSD_kernel__) - /* kFreeBSD */ - if (get_kfreebsd_version () >= 400000) - sprintf (name, "/dev/da%d", unit); - else - sprintf (name, "/dev/rda%d", unit); -#elif defined(__NetBSD__) && defined(HAVE_OPENDISK) - /* NetBSD */ - char shortname[16]; - int fd; - - sprintf (shortname, "sd%d", unit); - fd = opendisk (shortname, O_RDONLY, name, - 16, /* length of NAME */ - 0 /* char device */ - ); - close (fd); -#elif defined(__OpenBSD__) - /* OpenBSD */ - sprintf (name, "/dev/rsd%dc", unit); -#elif defined(__QNXNTO__) - /* QNX RTP */ - /* QNX RTP doesn't distinguish SCSI from IDE, so it is better to - disable the detection of SCSI disks here. */ - *name = 0; -#elif defined(__sun) - *name = 0; /* FIXME */ -#else -# warning "BIOS SCSI drives cannot be guessed in your operating system." - /* Set NAME to a bogus string. */ - *name = 0; -#endif -} - -#ifdef __linux__ -static void -get_dac960_disk_name (char *name, int controller, int drive) -{ - sprintf (name, "/dev/rd/c%dd%d", controller, drive); -} - -static void -get_ataraid_disk_name (char *name, int unit) -{ - sprintf (name, "/dev/ataraid/d%c", unit + '0'); -} -#endif - -/* Check if DEVICE can be read. If an error occurs, return zero, - otherwise return non-zero. */ -int -check_device (const char *device) -{ - char buf[512]; - FILE *fp; - - /* If DEVICE is empty, just return 1. */ - if (*device == 0) - return 1; - - fp = fopen (device, "r"); - if (! fp) - { - switch (errno) - { -#ifdef ENOMEDIUM - case ENOMEDIUM: -# if 0 - /* At the moment, this finds only CDROMs, which can't be - read anyway, so leave it out. Code should be - reactivated if `removable disks' and CDROMs are - supported. */ - /* Accept it, it may be inserted. */ - return 1; -# endif - break; -#endif /* ENOMEDIUM */ - default: - /* Break case and leave. */ - break; - } - /* Error opening the device. */ - return 0; - } - - /* Make sure CD-ROMs don't get assigned a BIOS disk number - before SCSI disks! */ -#ifdef __linux__ -# ifdef CDROM_GET_CAPABILITY - if (ioctl (fileno (fp), CDROM_GET_CAPABILITY, 0) >= 0) - return 0; -# else /* ! CDROM_GET_CAPABILITY */ - /* Check if DEVICE is a CD-ROM drive by the HDIO_GETGEO ioctl. */ - { - struct hd_geometry hdg; - struct stat st; - - if (fstat (fileno (fp), &st)) - return 0; - - /* If it is a block device and isn't a floppy, check if HDIO_GETGEO - succeeds. */ - if (S_ISBLK (st.st_mode) - && MAJOR (st.st_rdev) != FLOPPY_MAJOR - && ioctl (fileno (fp), HDIO_GETGEO, &hdg)) - return 0; - } -# endif /* ! CDROM_GET_CAPABILITY */ -#endif /* __linux__ */ - -#if defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) -# ifdef CDIOCCLRDEBUG - if (ioctl (fileno (fp), CDIOCCLRDEBUG, 0) >= 0) - return 0; -# endif /* CDIOCCLRDEBUG */ -#endif /* __FreeBSD_kernel__ || __NetBSD__ || __OpenBSD__ */ - - /* Attempt to read the first sector. */ - if (fread (buf, 1, 512, fp) != 512) - { - fclose (fp); - return 0; - } - - fclose (fp); - return 1; -} - -/* Read mapping information from FP, and write it to MAP. */ -static int -read_device_map (FILE *fp, char **map, const char *map_file) -{ - static void show_error (int no, const char *msg) - { - fprintf (stderr, "%s:%d: error: %s\n", map_file, no, msg); - } - - static void show_warning (int no, const char *msg, ...) - { - va_list ap; - - va_start (ap, msg); - fprintf (stderr, "%s:%d: warning: ", map_file, no); - vfprintf (stderr, msg, ap); - va_end (ap); - } - - /* If there is the device map file, use the data in it instead of - probing devices. */ - char buf[1024]; /* XXX */ - int line_number = 0; - - while (fgets (buf, sizeof (buf), fp)) - { - char *ptr, *eptr; - int drive; - int is_floppy = 0; - - /* Increase the number of lines. */ - line_number++; - - /* If the first character is '#', skip it. */ - if (buf[0] == '#') - continue; - - ptr = buf; - /* Skip leading spaces. */ - while (*ptr && isspace (*ptr)) - ptr++; - - /* Skip empty lines. */ - if (! *ptr) - continue; - - if (*ptr != '(') - { - show_error (line_number, "No open parenthesis found"); - return 0; - } - - ptr++; - if ((*ptr != 'f' && *ptr != 'h') || *(ptr + 1) != 'd') - { - show_error (line_number, "Bad drive name"); - return 0; - } - - if (*ptr == 'f') - is_floppy = 1; - - ptr += 2; - drive = strtoul (ptr, &ptr, 10); - if (drive < 0) - { - show_error (line_number, "Bad device number"); - return 0; - } - else if (drive > 127) - { - show_warning (line_number, - "Ignoring %cd%d due to a BIOS limitation", - is_floppy ? 'f' : 'h', drive); - continue; - } - - if (! is_floppy) - drive += 0x80; - - if (*ptr != ')') - { - show_error (line_number, "No close parenthesis found"); - return 0; - } - - ptr++; - /* Skip spaces. */ - while (*ptr && isspace (*ptr)) - ptr++; - - if (! *ptr) - { - show_error (line_number, "No filename found"); - return 0; - } - - /* Terminate the filename. */ - eptr = ptr; - while (*eptr && ! isspace (*eptr)) - eptr++; - *eptr = 0; - - /* Multiple entries for a given drive is not allowed. */ - if (map[drive]) - { - show_error (line_number, "Duplicated entry found"); - return 0; - } - - map[drive] = strdup (ptr); - assert (map[drive]); - } - - return 1; -} - -/* Initialize the device map MAP. *MAP will be allocated from the heap - space. If MAP_FILE is not NULL, then read mappings from the file - MAP_FILE if it exists, otherwise, write guessed mappings to the file. - FLOPPY_DISKS is the number of floppy disk drives which will be probed. - If it is zero, don't probe any floppy at all. If it is one, probe one - floppy. If it is two, probe two floppies. And so on. */ -int -init_device_map (char ***map, const char *map_file, int floppy_disks) -{ - int i; - int num_hd = 0; - FILE *fp = 0; - - assert (map); - assert (*map == 0); - *map = malloc (NUM_DISKS * sizeof (char *)); - assert (*map); - - /* Probe devices for creating the device map. */ - - /* Initialize DEVICE_MAP. */ - for (i = 0; i < NUM_DISKS; i++) - (*map)[i] = 0; - - if (map_file) - { - /* Open the device map file. */ - fp = fopen (map_file, "r"); - if (fp) - { - int ret; - - ret = read_device_map (fp, *map, map_file); - fclose (fp); - return ret; - } - } - - /* Print something so that the user does not think GRUB has been - crashed. */ - fprintf (stderr, - "Probing devices to guess BIOS drives. " - "This may take a long time.\n"); - - if (map_file) - /* Try to open the device map file to write the probed data. */ - fp = fopen (map_file, "w"); - - /* Floppies. */ - for (i = 0; i < floppy_disks; i++) - { - char name[16]; - - get_floppy_disk_name (name, i); - /* In floppies, write the map, whether check_device succeeds - or not, because the user just does not insert floppies. */ - if (fp) - fprintf (fp, "(fd%d)\t%s\n", i, name); - - if (check_device (name)) - { - (*map)[i] = strdup (name); - assert ((*map)[i]); - } - } - -#ifdef __linux__ - if (have_devfs ()) - { - while (1) - { - char discn[32]; - char name[PATH_MAX]; - struct stat st; - - /* Linux creates symlinks "/dev/discs/discN" for convenience. - The way to number disks is the same as GRUB's. */ - sprintf (discn, "/dev/discs/disc%d", num_hd); - if (stat (discn, &st) < 0) - break; - - if (realpath (discn, name)) - { - strcat (name, "/disc"); - (*map)[num_hd + 0x80] = strdup (name); - assert ((*map)[num_hd + 0x80]); - - /* If the device map file is opened, write the map. */ - if (fp) - fprintf (fp, "(hd%d)\t%s\n", num_hd, name); - } - - num_hd++; - } - - /* OK, close the device map file if opened. */ - if (fp) - fclose (fp); - - return 1; - } -#endif /* __linux__ */ - - /* IDE disks. */ - for (i = 0; i < 8; i++) - { - char name[16]; - - get_ide_disk_name (name, i); - if (check_device (name)) - { - (*map)[num_hd + 0x80] = strdup (name); - assert ((*map)[num_hd + 0x80]); - - /* If the device map file is opened, write the map. */ - if (fp) - fprintf (fp, "(hd%d)\t%s\n", num_hd, name); - - num_hd++; - } - } - -#ifdef __linux__ - /* ATARAID disks. */ - for (i = 0; i < 8; i++) - { - char name[20]; - - get_ataraid_disk_name (name, i); - if (check_device (name)) - { - (*map)[num_hd + 0x80] = strdup (name); - assert ((*map)[num_hd + 0x80]); - - /* If the device map file is opened, write the map. */ - if (fp) - fprintf (fp, "(hd%d)\t%s\n", num_hd, name); - - num_hd++; - } - } -#endif /* __linux__ */ - - /* The rest is SCSI disks. */ - for (i = 0; i < 16; i++) - { - char name[16]; - - get_scsi_disk_name (name, i); - if (check_device (name)) - { - (*map)[num_hd + 0x80] = strdup (name); - assert ((*map)[num_hd + 0x80]); - - /* If the device map file is opened, write the map. */ - if (fp) - fprintf (fp, "(hd%d)\t%s\n", num_hd, name); - - num_hd++; - } - } - -#ifdef __linux__ - /* This is for DAC960 - we have - /dev/rd/cdp. - - DAC960 driver currently supports up to 8 controllers, 32 logical - drives, and 7 partitions. */ - { - int controller, drive; - - for (controller = 0; controller < 8; controller++) - { - for (drive = 0; drive < 15; drive++) - { - char name[24]; - - get_dac960_disk_name (name, controller, drive); - if (check_device (name)) - { - (*map)[num_hd + 0x80] = strdup (name); - assert ((*map)[num_hd + 0x80]); - - /* If the device map file is opened, write the map. */ - if (fp) - fprintf (fp, "(hd%d)\t%s\n", num_hd, name); - - num_hd++; - } - } - } - } -#endif /* __linux__ */ - - /* OK, close the device map file if opened. */ - if (fp) - fclose (fp); - - return 1; -} - -/* Restore the memory consumed for MAP. */ -void -restore_device_map (char **map) -{ - int i; - - for (i = 0; i < NUM_DISKS; i++) - if (map[i]) - free (map[i]); - - free (map); -} - -#ifdef __linux__ -/* Linux-only functions, because Linux has a bug that the disk cache for - a whole disk is not consistent with the one for a partition of the - disk. */ -int -is_disk_device (char **map, int drive) -{ - struct stat st; - - assert (map[drive] != 0); - assert (stat (map[drive], &st) == 0); - /* For now, disk devices under Linux are all block devices. */ - return S_ISBLK (st.st_mode); -} - -int -write_to_partition (char **map, int drive, int partition, - int sector, int size, const char *buf) -{ - char dev[PATH_MAX]; /* XXX */ - int fd; - - if ((partition & 0x00FF00) != 0x00FF00) - { - /* If the partition is a BSD partition, it is difficult to - obtain the representation in Linux. So don't support that. */ - errnum = ERR_DEV_VALUES; - return 1; - } - - assert (map[drive] != 0); - - strcpy (dev, map[drive]); - if (have_devfs ()) - { - if (strcmp (dev + strlen(dev) - 5, "/disc") == 0) - strcpy (dev + strlen(dev) - 5, "/part"); - } - sprintf (dev + strlen(dev), "%d", ((partition >> 16) & 0xFF) + 1); - - /* Open the partition. */ - fd = open (dev, O_RDWR); - if (fd < 0) - { - errnum = ERR_NO_PART; - return 0; - } - -#if defined(__linux__) && (!defined(__GLIBC__) || \ - ((__GLIBC__ < 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ < 1)))) - /* Maybe libc doesn't have large file support. */ - { - loff_t offset, result; - static int _llseek (uint filedes, ulong hi, ulong lo, - loff_t *res, uint wh); - _syscall5 (int, _llseek, uint, filedes, ulong, hi, ulong, lo, - loff_t *, res, uint, wh); - - offset = (loff_t) sector * (loff_t) SECTOR_SIZE; - if (_llseek (fd, offset >> 32, offset & 0xffffffff, &result, SEEK_SET)) - { - errnum = ERR_DEV_VALUES; - return 0; - } - } -#else - { - off_t offset = (off_t) sector * (off_t) SECTOR_SIZE; - - if (lseek (fd, offset, SEEK_SET) != offset) - { - errnum = ERR_DEV_VALUES; - return 0; - } - } -#endif - - if (write (fd, buf, size * SECTOR_SIZE) != (size * SECTOR_SIZE)) - { - close (fd); - errnum = ERR_WRITE; - return 0; - } - - sync (); /* Paranoia. */ - close (fd); - - return 1; -} -#endif /* __linux__ */ diff --git a/usr/src/grub/grub-0.95/lib/device.h b/usr/src/grub/grub-0.95/lib/device.h deleted file mode 100644 index 02ffce8e8b..0000000000 --- a/usr/src/grub/grub-0.95/lib/device.h +++ /dev/null @@ -1,48 +0,0 @@ -/* device.h - Define macros and declare prototypes for device.c */ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 1999,2000,2004 Free Software Foundation, 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 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 DEVICE_MAP_HEADER -#define DEVICE_MAP_HEADER 1 - -/* The maximum number of BIOS disks. */ -#define NUM_DISKS 256 - -/* Simulated disk sizes. */ -#define DEFAULT_FD_CYLINDERS 80 -#define DEFAULT_FD_HEADS 2 -#define DEFAULT_FD_SECTORS 18 -#define DEFAULT_HD_CYLINDERS 620 -#define DEFAULT_HD_HEADS 128 -#define DEFAULT_HD_SECTORS 63 - -/* Function prototypes. */ -extern void get_drive_geometry (struct geometry *geom, char **map, int drive); -extern int check_device (const char *device); -extern int init_device_map (char ***map, const char *map_file, - int no_floppies); -extern void restore_device_map (char **map); - -#ifdef __linux__ -extern int is_disk_device (char **map, int drive); -extern int write_to_partition (char **map, int drive, int partition, - int offset, int size, const char *buf); -#endif /* __linux__ */ - -#endif /* DEVICE_MAP_HEADER */ diff --git a/usr/src/grub/grub-0.95/lib/getopt.c b/usr/src/grub/grub-0.95/lib/getopt.c deleted file mode 100644 index 04905fd356..0000000000 --- a/usr/src/grub/grub-0.95/lib/getopt.c +++ /dev/null @@ -1,1053 +0,0 @@ -/* Getopt for GNU. - NOTE: getopt is now part of the C library, so if you don't know what - "Keep this file name-space clean" means, talk to drepper@gnu.org - before changing it! - - Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98 - Free Software Foundation, Inc. - - NOTE: The canonical source of this file is maintained with the GNU C Library. - Bugs can be reported to bug-glibc@gnu.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, 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. */ - -/* This tells Alpha OSF/1 not to define a getopt prototype in . - Ditto for AIX 3.2 and . */ -#ifndef _NO_PROTO -# define _NO_PROTO -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#if !defined __STDC__ || !__STDC__ -/* This is a separate conditional since some stdc systems - reject `defined (const)'. */ -# ifndef const -# define const -# endif -#endif - -#include - -/* Comment out all this code if we are using the GNU C Library, and are not - actually compiling the library itself. This code is part of the GNU C - Library, but also included in many other GNU distributions. Compiling - and linking in this code is a waste when using the GNU C library - (especially if it is a shared library). Rather than having every GNU - program understand `configure --with-gnu-libc' and omit the object files, - it is simpler to just do this in the source for each such file. */ - -#define GETOPT_INTERFACE_VERSION 2 -#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2 -# include -# if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION -# define ELIDE_CODE -# endif -#endif - -#ifndef ELIDE_CODE - - -/* This needs to come after some library #include - to get __GNU_LIBRARY__ defined. */ -#ifdef __GNU_LIBRARY__ -/* Don't include stdlib.h for non-GNU C libraries because some of them - contain conflicting prototypes for getopt. */ -# include -# include -#endif /* GNU C library. */ - -#ifdef VMS -# include -# if HAVE_STRING_H - 0 -# include -# endif -#endif - -#ifndef _ -/* This is for other GNU distributions with internationalized messages. - When compiling libc, the _ macro is predefined. */ -# ifdef HAVE_LIBINTL_H -# include -# define _(msgid) gettext (msgid) -# else -# define _(msgid) (msgid) -# endif -#endif - -/* This version of `getopt' appears to the caller like standard Unix `getopt' - but it behaves differently for the user, since it allows the user - to intersperse the options with the other arguments. - - As `getopt' works, it permutes the elements of ARGV so that, - when it is done, all the options precede everything else. Thus - all application programs are extended to handle flexible argument order. - - Setting the environment variable POSIXLY_CORRECT disables permutation. - Then the behavior is completely standard. - - GNU application programs can use a third alternative mode in which - they can distinguish the relative order of options and other arguments. */ - -#include "getopt.h" - -/* 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. */ - -char *optarg = NULL; - -/* 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. */ - -/* 1003.2 says this must be 1 before any call. */ -int optind = 1; - -/* Formerly, initialization of getopt depended on optind==0, which - causes problems with re-calling getopt as programs generally don't - know that. */ - -int __getopt_initialized = 0; - -/* The next char to be scanned in the option-element - in which the last option character we returned was found. - This allows us to pick up the scan where we left off. - - If this is zero, or a null string, it means resume the scan - by advancing to the next ARGV-element. */ - -static char *nextchar; - -/* Callers store zero here to inhibit the error message - for unrecognized options. */ - -int opterr = 1; - -/* Set to an option character which was unrecognized. - This must be initialized on some systems to avoid linking in the - system's own getopt implementation. */ - -int optopt = '?'; - -/* Describe how to deal with options that follow non-option ARGV-elements. - - If the caller did not specify anything, - the default is REQUIRE_ORDER if the environment variable - POSIXLY_CORRECT is defined, PERMUTE otherwise. - - REQUIRE_ORDER means don't recognize them as options; - stop option processing when the first non-option is seen. - This is what Unix does. - This mode of operation is selected by either setting the environment - variable POSIXLY_CORRECT, or using `+' as the first character - of the list of option characters. - - PERMUTE is the default. We permute the contents of ARGV as we scan, - so that eventually all the non-options are at the end. This allows options - to be given in any order, even with programs that were not written to - expect this. - - RETURN_IN_ORDER is an option available to programs that were written - to expect options and other ARGV-elements in any order and that care about - the ordering of the two. We describe each non-option ARGV-element - as if it were the argument of an option with character code 1. - Using `-' as the first character of the list of option characters - selects this mode of operation. - - The special argument `--' forces an end of option-scanning regardless - of the value of `ordering'. In the case of RETURN_IN_ORDER, only - `--' can cause `getopt' to return -1 with `optind' != ARGC. */ - -static enum -{ - REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER -} ordering; - -/* Value of POSIXLY_CORRECT environment variable. */ -static char *posixly_correct; - -#ifdef __GNU_LIBRARY__ -/* We want to avoid inclusion of string.h with non-GNU libraries - because there are many ways it can cause trouble. - On some systems, it contains special magic macros that don't work - in GCC. */ -# include -# define my_index strchr -#else - -# if HAVE_STRING_H -# include -# else -# include -# endif - -/* Avoid depending on library functions or files - whose names are inconsistent. */ - -#ifndef getenv -extern char *getenv (); -#endif - -static char * -my_index (str, chr) - const char *str; - int chr; -{ - while (*str) - { - if (*str == chr) - return (char *) str; - str++; - } - return 0; -} - -/* If using GCC, we can safely declare strlen this way. - If not using GCC, it is ok not to declare it. */ -#ifdef __GNUC__ -/* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h. - That was relevant to code that was here before. */ -# if (!defined __STDC__ || !__STDC__) && !defined strlen -/* gcc with -traditional declares the built-in strlen to return int, - and has done so at least since version 2.4.5. -- rms. */ -extern int strlen (const char *); -# endif /* not __STDC__ */ -#endif /* __GNUC__ */ - -#endif /* not __GNU_LIBRARY__ */ - -/* Handle permutation of arguments. */ - -/* Describe the part of ARGV that contains non-options that have - been skipped. `first_nonopt' is the index in ARGV of the first of them; - `last_nonopt' is the index after the last of them. */ - -static int first_nonopt; -static int last_nonopt; - -#ifdef _LIBC -/* Bash 2.0 gives us an environment variable containing flags - indicating ARGV elements that should not be considered arguments. */ - -/* Defined in getopt_init.c */ -extern char *__getopt_nonoption_flags; - -static int nonoption_flags_max_len; -static int nonoption_flags_len; - -static int original_argc; -static char *const *original_argv; - -/* Make sure the environment variable bash 2.0 puts in the environment - is valid for the getopt call we must make sure that the ARGV passed - to getopt is that one passed to the process. */ -static void -__attribute__ ((unused)) -store_args_and_env (int argc, char *const *argv) -{ - /* XXX This is no good solution. We should rather copy the args so - that we can compare them later. But we must not use malloc(3). */ - original_argc = argc; - original_argv = argv; -} -# ifdef text_set_element -text_set_element (__libc_subinit, store_args_and_env); -# endif /* text_set_element */ - -# define SWAP_FLAGS(ch1, ch2) \ - if (nonoption_flags_len > 0) \ - { \ - char __tmp = __getopt_nonoption_flags[ch1]; \ - __getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2]; \ - __getopt_nonoption_flags[ch2] = __tmp; \ - } -#else /* !_LIBC */ -# define SWAP_FLAGS(ch1, ch2) -#endif /* _LIBC */ - -/* Exchange two adjacent subsequences of ARGV. - One subsequence is elements [first_nonopt,last_nonopt) - which contains all the non-options that have been skipped so far. - The other is elements [last_nonopt,optind), which contains all - the options processed since those non-options were skipped. - - `first_nonopt' and `last_nonopt' are relocated so that they describe - the new indices of the non-options in ARGV after they are moved. */ - -#if defined __STDC__ && __STDC__ -static void exchange (char **); -#endif - -static void -exchange (argv) - char **argv; -{ - int bottom = first_nonopt; - int middle = last_nonopt; - int top = optind; - char *tem; - - /* Exchange the shorter segment with the far end of the longer segment. - That puts the shorter segment into the right place. - It leaves the longer segment in the right place overall, - but it consists of two parts that need to be swapped next. */ - -#ifdef _LIBC - /* First make sure the handling of the `__getopt_nonoption_flags' - string can work normally. Our top argument must be in the range - of the string. */ - if (nonoption_flags_len > 0 && top >= nonoption_flags_max_len) - { - /* We must extend the array. The user plays games with us and - presents new arguments. */ - char *new_str = malloc (top + 1); - if (new_str == NULL) - nonoption_flags_len = nonoption_flags_max_len = 0; - else - { - memset (__mempcpy (new_str, __getopt_nonoption_flags, - nonoption_flags_max_len), - '\0', top + 1 - nonoption_flags_max_len); - nonoption_flags_max_len = top + 1; - __getopt_nonoption_flags = new_str; - } - } -#endif - - while (top > middle && middle > bottom) - { - if (top - middle > middle - bottom) - { - /* Bottom segment is the short one. */ - int len = middle - bottom; - register int i; - - /* Swap it with the top part of the top segment. */ - for (i = 0; i < len; i++) - { - tem = argv[bottom + i]; - argv[bottom + i] = argv[top - (middle - bottom) + i]; - argv[top - (middle - bottom) + i] = tem; - SWAP_FLAGS (bottom + i, top - (middle - bottom) + i); - } - /* Exclude the moved bottom segment from further swapping. */ - top -= len; - } - else - { - /* Top segment is the short one. */ - int len = top - middle; - register int i; - - /* Swap it with the bottom part of the bottom segment. */ - for (i = 0; i < len; i++) - { - tem = argv[bottom + i]; - argv[bottom + i] = argv[middle + i]; - argv[middle + i] = tem; - SWAP_FLAGS (bottom + i, middle + i); - } - /* Exclude the moved top segment from further swapping. */ - bottom += len; - } - } - - /* Update records for the slots the non-options now occupy. */ - - first_nonopt += (optind - last_nonopt); - last_nonopt = optind; -} - -/* Initialize the internal data when the first call is made. */ - -#if defined __STDC__ && __STDC__ -static const char *_getopt_initialize (int, char *const *, const char *); -#endif -static const char * -_getopt_initialize (argc, argv, optstring) - int argc; - char *const *argv; - const char *optstring; -{ - /* Start processing options with ARGV-element 1 (since ARGV-element 0 - is the program name); the sequence of previously skipped - non-option ARGV-elements is empty. */ - - first_nonopt = last_nonopt = optind; - - nextchar = NULL; - - posixly_correct = getenv ("POSIXLY_CORRECT"); - - /* Determine how to handle the ordering of options and nonoptions. */ - - if (optstring[0] == '-') - { - ordering = RETURN_IN_ORDER; - ++optstring; - } - else if (optstring[0] == '+') - { - ordering = REQUIRE_ORDER; - ++optstring; - } - else if (posixly_correct != NULL) - ordering = REQUIRE_ORDER; - else - ordering = PERMUTE; - -#ifdef _LIBC - if (posixly_correct == NULL - && argc == original_argc && argv == original_argv) - { - if (nonoption_flags_max_len == 0) - { - if (__getopt_nonoption_flags == NULL - || __getopt_nonoption_flags[0] == '\0') - nonoption_flags_max_len = -1; - else - { - const char *orig_str = __getopt_nonoption_flags; - int len = nonoption_flags_max_len = strlen (orig_str); - if (nonoption_flags_max_len < argc) - nonoption_flags_max_len = argc; - __getopt_nonoption_flags = - (char *) malloc (nonoption_flags_max_len); - if (__getopt_nonoption_flags == NULL) - nonoption_flags_max_len = -1; - else - memset (__mempcpy (__getopt_nonoption_flags, orig_str, len), - '\0', nonoption_flags_max_len - len); - } - } - nonoption_flags_len = nonoption_flags_max_len; - } - else - nonoption_flags_len = 0; -#endif - - return optstring; -} - -/* Scan elements of ARGV (whose length is ARGC) for option characters - given in OPTSTRING. - - If an element of ARGV starts with '-', and is not exactly "-" or "--", - then it is an option element. The characters of this element - (aside from the initial '-') are option characters. If `getopt' - is called repeatedly, it returns successively each of the option characters - from each of the option elements. - - If `getopt' finds another option character, it returns that character, - updating `optind' and `nextchar' so that the next call to `getopt' can - resume the scan with the following option character or ARGV-element. - - If there are no more option characters, `getopt' returns -1. - Then `optind' is the index in ARGV of the first ARGV-element - that is not an option. (The ARGV-elements have been permuted - so that those that are not options now come last.) - - OPTSTRING is a string containing the legitimate option characters. - If an option character is seen that is not listed in OPTSTRING, - return '?' after printing an error message. If you set `opterr' to - zero, the error message is suppressed but we still return '?'. - - If a char in OPTSTRING is followed by a colon, that means it wants an arg, - so the following text in the same ARGV-element, or the text of the following - ARGV-element, is returned in `optarg'. Two colons mean an option that - wants an optional arg; if there is text in the current ARGV-element, - it is returned in `optarg', otherwise `optarg' is set to zero. - - If OPTSTRING starts with `-' or `+', it requests different methods of - handling the non-option ARGV-elements. - See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above. - - Long-named options begin with `--' instead of `-'. - Their names may be abbreviated as long as the abbreviation is unique - or is an exact match for some defined option. If they have an - argument, it follows the option name in the same ARGV-element, separated - from the option name by a `=', or else the in next ARGV-element. - When `getopt' finds a long-named option, it returns 0 if that option's - `flag' field is nonzero, the value of the option's `val' field - if the `flag' field is zero. - - The elements of ARGV aren't really const, because we permute them. - But we pretend they're const in the prototype to be compatible - with other systems. - - LONGOPTS is a vector of `struct option' terminated by an - element containing a name which is zero. - - LONGIND returns the index in LONGOPT of the long-named option found. - It is only valid when a long-named option has been found by the most - recent call. - - If LONG_ONLY is nonzero, '-' as well as '--' can introduce - long-named options. */ - -int -_getopt_internal (argc, argv, optstring, longopts, longind, long_only) - int argc; - char *const *argv; - const char *optstring; - const struct option *longopts; - int *longind; - int long_only; -{ - optarg = NULL; - - if (optind == 0 || !__getopt_initialized) - { - if (optind == 0) - optind = 1; /* Don't scan ARGV[0], the program name. */ - optstring = _getopt_initialize (argc, argv, optstring); - __getopt_initialized = 1; - } - - /* Test whether ARGV[optind] points to a non-option argument. - Either it does not have option syntax, or there is an environment flag - from the shell indicating it is not an option. The later information - is only used when the used in the GNU libc. */ -#ifdef _LIBC -# define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0' \ - || (optind < nonoption_flags_len \ - && __getopt_nonoption_flags[optind] == '1')) -#else -# define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0') -#endif - - if (nextchar == NULL || *nextchar == '\0') - { - /* Advance to the next ARGV-element. */ - - /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been - moved back by the user (who may also have changed the arguments). */ - if (last_nonopt > optind) - last_nonopt = optind; - if (first_nonopt > optind) - first_nonopt = optind; - - if (ordering == PERMUTE) - { - /* If we have just processed some options following some non-options, - exchange them so that the options come first. */ - - if (first_nonopt != last_nonopt && last_nonopt != optind) - exchange ((char **) argv); - else if (last_nonopt != optind) - first_nonopt = optind; - - /* Skip any additional non-options - and extend the range of non-options previously skipped. */ - - while (optind < argc && NONOPTION_P) - optind++; - last_nonopt = optind; - } - - /* The special ARGV-element `--' means premature end of options. - Skip it like a null option, - then exchange with previous non-options as if it were an option, - then skip everything else like a non-option. */ - - if (optind != argc && !strcmp (argv[optind], "--")) - { - optind++; - - if (first_nonopt != last_nonopt && last_nonopt != optind) - exchange ((char **) argv); - else if (first_nonopt == last_nonopt) - first_nonopt = optind; - last_nonopt = argc; - - optind = argc; - } - - /* If we have done all the ARGV-elements, stop the scan - and back over any non-options that we skipped and permuted. */ - - if (optind == argc) - { - /* Set the next-arg-index to point at the non-options - that we previously skipped, so the caller will digest them. */ - if (first_nonopt != last_nonopt) - optind = first_nonopt; - return -1; - } - - /* If we have come to a non-option and did not permute it, - either stop the scan or describe it to the caller and pass it by. */ - - if (NONOPTION_P) - { - if (ordering == REQUIRE_ORDER) - return -1; - optarg = argv[optind++]; - return 1; - } - - /* We have found another option-ARGV-element. - Skip the initial punctuation. */ - - nextchar = (argv[optind] + 1 - + (longopts != NULL && argv[optind][1] == '-')); - } - - /* Decode the current option-ARGV-element. */ - - /* Check whether the ARGV-element is a long option. - - If long_only and the ARGV-element has the form "-f", where f is - a valid short option, don't consider it an abbreviated form of - a long option that starts with f. Otherwise there would be no - way to give the -f short option. - - On the other hand, if there's a long option "fubar" and - the ARGV-element is "-fu", do consider that an abbreviation of - the long option, just like "--fu", and not "-f" with arg "u". - - This distinction seems to be the most useful approach. */ - - if (longopts != NULL - && (argv[optind][1] == '-' - || (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1]))))) - { - char *nameend; - const struct option *p; - const struct option *pfound = NULL; - int exact = 0; - int ambig = 0; - int indfound = -1; - int option_index; - - for (nameend = nextchar; *nameend && *nameend != '='; nameend++) - /* Do nothing. */ ; - - /* Test all long options for either exact match - or abbreviated matches. */ - for (p = longopts, option_index = 0; p->name; p++, option_index++) - if (!strncmp (p->name, nextchar, nameend - nextchar)) - { - if ((unsigned int) (nameend - nextchar) - == (unsigned int) strlen (p->name)) - { - /* Exact match found. */ - pfound = p; - indfound = option_index; - exact = 1; - break; - } - else if (pfound == NULL) - { - /* First nonexact match found. */ - pfound = p; - indfound = option_index; - } - else - /* Second or later nonexact match found. */ - ambig = 1; - } - - if (ambig && !exact) - { - if (opterr) - fprintf (stderr, _("%s: option `%s' is ambiguous\n"), - argv[0], argv[optind]); - nextchar += strlen (nextchar); - optind++; - optopt = 0; - return '?'; - } - - if (pfound != NULL) - { - option_index = indfound; - optind++; - if (*nameend) - { - /* Don't test has_arg with >, because some C compilers don't - allow it to be used on enums. */ - if (pfound->has_arg) - optarg = nameend + 1; - else - { - if (opterr) - { - if (argv[optind - 1][1] == '-') - /* --option */ - fprintf (stderr, - _("%s: option `--%s' doesn't allow an argument\n"), - argv[0], pfound->name); - else - /* +option or -option */ - fprintf (stderr, - _("%s: option `%c%s' doesn't allow an argument\n"), - argv[0], argv[optind - 1][0], pfound->name); - } - nextchar += strlen (nextchar); - - optopt = pfound->val; - return '?'; - } - } - else if (pfound->has_arg == 1) - { - if (optind < argc) - optarg = argv[optind++]; - else - { - if (opterr) - fprintf (stderr, - _("%s: option `%s' requires an argument\n"), - argv[0], argv[optind - 1]); - nextchar += strlen (nextchar); - optopt = pfound->val; - return optstring[0] == ':' ? ':' : '?'; - } - } - nextchar += strlen (nextchar); - if (longind != NULL) - *longind = option_index; - if (pfound->flag) - { - *(pfound->flag) = pfound->val; - return 0; - } - return pfound->val; - } - - /* Can't find it as a long option. If this is not getopt_long_only, - or the option starts with '--' or is not a valid short - option, then it's an error. - Otherwise interpret it as a short option. */ - if (!long_only || argv[optind][1] == '-' - || my_index (optstring, *nextchar) == NULL) - { - if (opterr) - { - if (argv[optind][1] == '-') - /* --option */ - fprintf (stderr, _("%s: unrecognized option `--%s'\n"), - argv[0], nextchar); - else - /* +option or -option */ - fprintf (stderr, _("%s: unrecognized option `%c%s'\n"), - argv[0], argv[optind][0], nextchar); - } - nextchar = (char *) ""; - optind++; - optopt = 0; - return '?'; - } - } - - /* Look at and handle the next short option-character. */ - - { - char c = *nextchar++; - char *temp = my_index (optstring, c); - - /* Increment `optind' when we start to process its last character. */ - if (*nextchar == '\0') - ++optind; - - if (temp == NULL || c == ':') - { - if (opterr) - { - if (posixly_correct) - /* 1003.2 specifies the format of this message. */ - fprintf (stderr, _("%s: illegal option -- %c\n"), - argv[0], c); - else - fprintf (stderr, _("%s: invalid option -- %c\n"), - argv[0], c); - } - optopt = c; - return '?'; - } - /* Convenience. Treat POSIX -W foo same as long option --foo */ - if (temp[0] == 'W' && temp[1] == ';') - { - char *nameend; - const struct option *p; - const struct option *pfound = NULL; - int exact = 0; - int ambig = 0; - int indfound = 0; - int option_index; - - /* This is an option that requires an argument. */ - if (*nextchar != '\0') - { - optarg = nextchar; - /* If we end this ARGV-element by taking the rest as an arg, - we must advance to the next element now. */ - optind++; - } - else if (optind == argc) - { - if (opterr) - { - /* 1003.2 specifies the format of this message. */ - fprintf (stderr, _("%s: option requires an argument -- %c\n"), - argv[0], c); - } - optopt = c; - if (optstring[0] == ':') - c = ':'; - else - c = '?'; - return c; - } - else - /* We already incremented `optind' once; - increment it again when taking next ARGV-elt as argument. */ - optarg = argv[optind++]; - - /* optarg is now the argument, see if it's in the - table of longopts. */ - - for (nextchar = nameend = optarg; *nameend && *nameend != '='; nameend++) - /* Do nothing. */ ; - - /* Test all long options for either exact match - or abbreviated matches. */ - for (p = longopts, option_index = 0; p->name; p++, option_index++) - if (!strncmp (p->name, nextchar, nameend - nextchar)) - { - if ((unsigned int) (nameend - nextchar) == strlen (p->name)) - { - /* Exact match found. */ - pfound = p; - indfound = option_index; - exact = 1; - break; - } - else if (pfound == NULL) - { - /* First nonexact match found. */ - pfound = p; - indfound = option_index; - } - else - /* Second or later nonexact match found. */ - ambig = 1; - } - if (ambig && !exact) - { - if (opterr) - fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"), - argv[0], argv[optind]); - nextchar += strlen (nextchar); - optind++; - return '?'; - } - if (pfound != NULL) - { - option_index = indfound; - if (*nameend) - { - /* Don't test has_arg with >, because some C compilers don't - allow it to be used on enums. */ - if (pfound->has_arg) - optarg = nameend + 1; - else - { - if (opterr) - fprintf (stderr, _("\ -%s: option `-W %s' doesn't allow an argument\n"), - argv[0], pfound->name); - - nextchar += strlen (nextchar); - return '?'; - } - } - else if (pfound->has_arg == 1) - { - if (optind < argc) - optarg = argv[optind++]; - else - { - if (opterr) - fprintf (stderr, - _("%s: option `%s' requires an argument\n"), - argv[0], argv[optind - 1]); - nextchar += strlen (nextchar); - return optstring[0] == ':' ? ':' : '?'; - } - } - nextchar += strlen (nextchar); - if (longind != NULL) - *longind = option_index; - if (pfound->flag) - { - *(pfound->flag) = pfound->val; - return 0; - } - return pfound->val; - } - nextchar = NULL; - return 'W'; /* Let the application handle it. */ - } - if (temp[1] == ':') - { - if (temp[2] == ':') - { - /* This is an option that accepts an argument optionally. */ - if (*nextchar != '\0') - { - optarg = nextchar; - optind++; - } - else - optarg = NULL; - nextchar = NULL; - } - else - { - /* This is an option that requires an argument. */ - if (*nextchar != '\0') - { - optarg = nextchar; - /* If we end this ARGV-element by taking the rest as an arg, - we must advance to the next element now. */ - optind++; - } - else if (optind == argc) - { - if (opterr) - { - /* 1003.2 specifies the format of this message. */ - fprintf (stderr, - _("%s: option requires an argument -- %c\n"), - argv[0], c); - } - optopt = c; - if (optstring[0] == ':') - c = ':'; - else - c = '?'; - } - else - /* We already incremented `optind' once; - increment it again when taking next ARGV-elt as argument. */ - optarg = argv[optind++]; - nextchar = NULL; - } - } - return c; - } -} - -int -getopt (argc, argv, optstring) - int argc; - char *const *argv; - const char *optstring; -{ - return _getopt_internal (argc, argv, optstring, - (const struct option *) 0, - (int *) 0, - 0); -} - -#endif /* Not ELIDE_CODE. */ - -#ifdef TEST - -/* Compile with -DTEST to make an executable for use in testing - the above definition of `getopt'. */ - -int -main (argc, argv) - int argc; - char **argv; -{ - int c; - int digit_optind = 0; - - while (1) - { - int this_option_optind = optind ? optind : 1; - - c = getopt (argc, argv, "abc:d:0123456789"); - if (c == -1) - break; - - switch (c) - { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - if (digit_optind != 0 && digit_optind != this_option_optind) - printf ("digits occur in two different argv-elements.\n"); - digit_optind = this_option_optind; - printf ("option %c\n", c); - break; - - case 'a': - printf ("option a\n"); - break; - - case 'b': - printf ("option b\n"); - break; - - case 'c': - printf ("option c with value `%s'\n", optarg); - break; - - case '?': - break; - - default: - printf ("?? getopt returned character code 0%o ??\n", c); - } - } - - if (optind < argc) - { - printf ("non-option ARGV-elements: "); - while (optind < argc) - printf ("%s ", argv[optind++]); - printf ("\n"); - } - - exit (0); -} - -#endif /* TEST */ diff --git a/usr/src/grub/grub-0.95/lib/getopt.h b/usr/src/grub/grub-0.95/lib/getopt.h deleted file mode 100644 index fb30719a86..0000000000 --- a/usr/src/grub/grub-0.95/lib/getopt.h +++ /dev/null @@ -1,133 +0,0 @@ -/* Declarations for getopt. - Copyright (C) 1989,90,91,92,93,94,96,97 Free Software Foundation, Inc. - - NOTE: The canonical source of this file is maintained with the GNU C Library. - Bugs can be reported to bug-glibc@gnu.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, 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 _GETOPT_H -#define _GETOPT_H 1 - -#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; - -/* 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 -{ -#if defined (__STDC__) && __STDC__ - const char *name; -#else - char *name; -#endif - /* 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 - -#if defined (__STDC__) && __STDC__ -#ifdef __GNU_LIBRARY__ -/* 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); -#else /* not __GNU_LIBRARY__ */ -extern int getopt (); -#endif /* __GNU_LIBRARY__ */ -extern int getopt_long (int argc, char *const *argv, const char *shortopts, - const struct option *longopts, int *longind); -extern int getopt_long_only (int argc, char *const *argv, - const char *shortopts, - const struct option *longopts, int *longind); - -/* Internal only. Users should not call this directly. */ -extern int _getopt_internal (int argc, char *const *argv, - const char *shortopts, - const struct option *longopts, int *longind, - int long_only); -#else /* not __STDC__ */ -extern int getopt (); -extern int getopt_long (); -extern int getopt_long_only (); - -extern int _getopt_internal (); -#endif /* __STDC__ */ - -#ifdef __cplusplus -} -#endif - -#endif /* getopt.h */ diff --git a/usr/src/grub/grub-0.95/lib/getopt1.c b/usr/src/grub/grub-0.95/lib/getopt1.c deleted file mode 100644 index ff257374c3..0000000000 --- a/usr/src/grub/grub-0.95/lib/getopt1.c +++ /dev/null @@ -1,190 +0,0 @@ -/* getopt_long and getopt_long_only entry points for GNU getopt. - Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98 - Free Software Foundation, Inc. - - NOTE: The canonical source of this file is maintained with the GNU C Library. - Bugs can be reported to bug-glibc@gnu.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, 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. */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include "getopt.h" - -#if !defined __STDC__ || !__STDC__ -/* This is a separate conditional since some stdc systems - reject `defined (const)'. */ -#ifndef const -#define const -#endif -#endif - -#include - -/* Comment out all this code if we are using the GNU C Library, and are not - actually compiling the library itself. This code is part of the GNU C - Library, but also included in many other GNU distributions. Compiling - and linking in this code is a waste when using the GNU C library - (especially if it is a shared library). Rather than having every GNU - program understand `configure --with-gnu-libc' and omit the object files, - it is simpler to just do this in the source for each such file. */ - -#define GETOPT_INTERFACE_VERSION 2 -#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2 -#include -#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION -#define ELIDE_CODE -#endif -#endif - -#ifndef ELIDE_CODE - - -/* This needs to come after some library #include - to get __GNU_LIBRARY__ defined. */ -#ifdef __GNU_LIBRARY__ -#include -#endif - -#ifndef NULL -#define NULL 0 -#endif - -int -getopt_long (argc, argv, options, long_options, opt_index) - int argc; - char *const *argv; - const char *options; - const struct option *long_options; - int *opt_index; -{ - return _getopt_internal (argc, argv, options, long_options, opt_index, 0); -} - -/* Like getopt_long, but '-' as well as '--' can indicate a long option. - If an option that starts with '-' (not '--') doesn't match a long option, - but does match a short option, it is parsed as a short option - instead. */ - -int -getopt_long_only (argc, argv, options, long_options, opt_index) - int argc; - char *const *argv; - const char *options; - const struct option *long_options; - int *opt_index; -{ - return _getopt_internal (argc, argv, options, long_options, opt_index, 1); -} - - -#endif /* Not ELIDE_CODE. */ - -#ifdef TEST - -#include - -int -main (argc, argv) - int argc; - char **argv; -{ - int c; - int digit_optind = 0; - - while (1) - { - int this_option_optind = optind ? optind : 1; - int option_index = 0; - static struct option long_options[] = - { - {"add", 1, 0, 0}, - {"append", 0, 0, 0}, - {"delete", 1, 0, 0}, - {"verbose", 0, 0, 0}, - {"create", 0, 0, 0}, - {"file", 1, 0, 0}, - {0, 0, 0, 0} - }; - - c = getopt_long (argc, argv, "abc:d:0123456789", - long_options, &option_index); - if (c == -1) - break; - - switch (c) - { - case 0: - printf ("option %s", long_options[option_index].name); - if (optarg) - printf (" with arg %s", optarg); - printf ("\n"); - break; - - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - if (digit_optind != 0 && digit_optind != this_option_optind) - printf ("digits occur in two different argv-elements.\n"); - digit_optind = this_option_optind; - printf ("option %c\n", c); - break; - - case 'a': - printf ("option a\n"); - break; - - case 'b': - printf ("option b\n"); - break; - - case 'c': - printf ("option c with value `%s'\n", optarg); - break; - - case 'd': - printf ("option d with value `%s'\n", optarg); - break; - - case '?': - break; - - default: - printf ("?? getopt returned character code 0%o ??\n", c); - } - } - - if (optind < argc) - { - printf ("non-option ARGV-elements: "); - while (optind < argc) - printf ("%s ", argv[optind++]); - printf ("\n"); - } - - exit (0); -} - -#endif /* TEST */ diff --git a/usr/src/grub/grub-0.95/missing b/usr/src/grub/grub-0.95/missing deleted file mode 100755 index e7ef83a1c2..0000000000 --- a/usr/src/grub/grub-0.95/missing +++ /dev/null @@ -1,360 +0,0 @@ -#! /bin/sh -# Common stub for a few missing GNU programs while installing. - -scriptversion=2003-09-02.23 - -# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003 -# Free Software Foundation, Inc. -# Originally by Fran,cois Pinard , 1996. - -# 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. - -# 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. - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -if test $# -eq 0; then - echo 1>&2 "Try \`$0 --help' for more information" - exit 1 -fi - -run=: - -# In the cases where this matters, `missing' is being run in the -# srcdir already. -if test -f configure.ac; then - configure_ac=configure.ac -else - configure_ac=configure.in -fi - -msg="missing on your system" - -case "$1" in ---run) - # Try to run requested program, and just exit if it succeeds. - run= - shift - "$@" && exit 0 - # Exit code 63 means version mismatch. This often happens - # when the user try to use an ancient version of a tool on - # a file that requires a minimum version. In this case we - # we should proceed has if the program had been absent, or - # if --run hadn't been passed. - if test $? = 63; then - run=: - msg="probably too old" - fi - ;; -esac - -# If it does not exist, or fails to run (possibly an outdated version), -# try to emulate it. -case "$1" in - - -h|--h|--he|--hel|--help) - echo "\ -$0 [OPTION]... PROGRAM [ARGUMENT]... - -Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an -error status if there is no known handling for PROGRAM. - -Options: - -h, --help display this help and exit - -v, --version output version information and exit - --run try to run the given command, and emulate it if it fails - -Supported PROGRAM values: - aclocal touch file \`aclocal.m4' - autoconf touch file \`configure' - autoheader touch file \`config.h.in' - automake touch all \`Makefile.in' files - bison create \`y.tab.[ch]', if possible, from existing .[ch] - flex create \`lex.yy.c', if possible, from existing .c - help2man touch the output file - lex create \`lex.yy.c', if possible, from existing .c - makeinfo touch the output file - tar try tar, gnutar, gtar, then tar without non-portable flags - yacc create \`y.tab.[ch]', if possible, from existing .[ch] - -Send bug reports to ." - ;; - - -v|--v|--ve|--ver|--vers|--versi|--versio|--version) - echo "missing $scriptversion (GNU Automake)" - ;; - - -*) - echo 1>&2 "$0: Unknown \`$1' option" - echo 1>&2 "Try \`$0 --help' for more information" - exit 1 - ;; - - aclocal*) - if test -z "$run" && ($1 --version) > /dev/null 2>&1; then - # We have it, but it failed. - exit 1 - fi - - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`acinclude.m4' or \`${configure_ac}'. You might want - to install the \`Automake' and \`Perl' packages. Grab them from - any GNU archive site." - touch aclocal.m4 - ;; - - autoconf) - if test -z "$run" && ($1 --version) > /dev/null 2>&1; then - # We have it, but it failed. - exit 1 - fi - - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`${configure_ac}'. You might want to install the - \`Autoconf' and \`GNU m4' packages. Grab them from any GNU - archive site." - touch configure - ;; - - autoheader) - if test -z "$run" && ($1 --version) > /dev/null 2>&1; then - # We have it, but it failed. - exit 1 - fi - - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`acconfig.h' or \`${configure_ac}'. You might want - to install the \`Autoconf' and \`GNU m4' packages. Grab them - from any GNU archive site." - files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` - test -z "$files" && files="config.h" - touch_files= - for f in $files; do - case "$f" in - *:*) touch_files="$touch_files "`echo "$f" | - sed -e 's/^[^:]*://' -e 's/:.*//'`;; - *) touch_files="$touch_files $f.in";; - esac - done - touch $touch_files - ;; - - automake*) - if test -z "$run" && ($1 --version) > /dev/null 2>&1; then - # We have it, but it failed. - exit 1 - fi - - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. - You might want to install the \`Automake' and \`Perl' packages. - Grab them from any GNU archive site." - find . -type f -name Makefile.am -print | - sed 's/\.am$/.in/' | - while read f; do touch "$f"; done - ;; - - autom4te) - if test -z "$run" && ($1 --version) > /dev/null 2>&1; then - # We have it, but it failed. - exit 1 - fi - - echo 1>&2 "\ -WARNING: \`$1' is needed, but is $msg. - You might have modified some files without having the - proper tools for further handling them. - You can get \`$1' as part of \`Autoconf' from any GNU - archive site." - - file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` - test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` - if test -f "$file"; then - touch $file - else - test -z "$file" || exec >$file - echo "#! /bin/sh" - echo "# Created by GNU Automake missing as a replacement of" - echo "# $ $@" - echo "exit 0" - chmod +x $file - exit 1 - fi - ;; - - bison|yacc) - echo 1>&2 "\ -WARNING: \`$1' $msg. You should only need it if - you modified a \`.y' file. You may need the \`Bison' package - in order for those modifications to take effect. You can get - \`Bison' from any GNU archive site." - rm -f y.tab.c y.tab.h - if [ $# -ne 1 ]; then - eval LASTARG="\${$#}" - case "$LASTARG" in - *.y) - SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` - if [ -f "$SRCFILE" ]; then - cp "$SRCFILE" y.tab.c - fi - SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` - if [ -f "$SRCFILE" ]; then - cp "$SRCFILE" y.tab.h - fi - ;; - esac - fi - if [ ! -f y.tab.h ]; then - echo >y.tab.h - fi - if [ ! -f y.tab.c ]; then - echo 'main() { return 0; }' >y.tab.c - fi - ;; - - lex|flex) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified a \`.l' file. You may need the \`Flex' package - in order for those modifications to take effect. You can get - \`Flex' from any GNU archive site." - rm -f lex.yy.c - if [ $# -ne 1 ]; then - eval LASTARG="\${$#}" - case "$LASTARG" in - *.l) - SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` - if [ -f "$SRCFILE" ]; then - cp "$SRCFILE" lex.yy.c - fi - ;; - esac - fi - if [ ! -f lex.yy.c ]; then - echo 'main() { return 0; }' >lex.yy.c - fi - ;; - - help2man) - if test -z "$run" && ($1 --version) > /dev/null 2>&1; then - # We have it, but it failed. - exit 1 - fi - - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified a dependency of a manual page. You may need the - \`Help2man' package in order for those modifications to take - effect. You can get \`Help2man' from any GNU archive site." - - file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` - if test -z "$file"; then - file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` - fi - if [ -f "$file" ]; then - touch $file - else - test -z "$file" || exec >$file - echo ".ab help2man is required to generate this page" - exit 1 - fi - ;; - - makeinfo) - if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then - # We have makeinfo, but it failed. - exit 1 - fi - - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified a \`.texi' or \`.texinfo' file, or any other file - indirectly affecting the aspect of the manual. The spurious - call might also be the consequence of using a buggy \`make' (AIX, - DU, IRIX). You might want to install the \`Texinfo' package or - the \`GNU make' package. Grab either from any GNU archive site." - file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` - if test -z "$file"; then - file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` - file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` - fi - touch $file - ;; - - tar) - shift - if test -n "$run"; then - echo 1>&2 "ERROR: \`tar' requires --run" - exit 1 - fi - - # We have already tried tar in the generic part. - # Look for gnutar/gtar before invocation to avoid ugly error - # messages. - if (gnutar --version > /dev/null 2>&1); then - gnutar "$@" && exit 0 - fi - if (gtar --version > /dev/null 2>&1); then - gtar "$@" && exit 0 - fi - firstarg="$1" - if shift; then - case "$firstarg" in - *o*) - firstarg=`echo "$firstarg" | sed s/o//` - tar "$firstarg" "$@" && exit 0 - ;; - esac - case "$firstarg" in - *h*) - firstarg=`echo "$firstarg" | sed s/h//` - tar "$firstarg" "$@" && exit 0 - ;; - esac - fi - - echo 1>&2 "\ -WARNING: I can't seem to be able to run \`tar' with the given arguments. - You may want to install GNU tar or Free paxutils, or check the - command line arguments." - exit 1 - ;; - - *) - echo 1>&2 "\ -WARNING: \`$1' is needed, and is $msg. - You might have modified some files without having the - proper tools for further handling them. Check the \`README' file, - it often tells you about the needed prerequisites for installing - this package. You may also peek at any GNU archive site, in case - some other package would contain this missing \`$1' program." - exit 1 - ;; -esac - -exit 0 - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-end: "$" -# End: diff --git a/usr/src/grub/grub-0.95/mkinstalldirs b/usr/src/grub/grub-0.95/mkinstalldirs deleted file mode 100755 index 6504b744b0..0000000000 --- a/usr/src/grub/grub-0.95/mkinstalldirs +++ /dev/null @@ -1,143 +0,0 @@ -#! /bin/sh -# mkinstalldirs --- make directory hierarchy - -scriptversion=2003-11-08.23 - -# Original author: Noah Friedman -# Created: 1993-05-16 -# Public domain. -# -# This file is maintained in Automake, please report -# bugs to or send patches to -# . - -errstatus=0 -dirmode="" - -usage="\ -Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ... - -Create each directory DIR (with mode MODE, if specified), including all -leading file name components. - -Report bugs to ." - -# process command line arguments -while test $# -gt 0 ; do - case $1 in - -h | --help | --h*) # -h for help - echo "$usage" - exit 0 - ;; - -m) # -m PERM arg - shift - test $# -eq 0 && { echo "$usage" 1>&2; exit 1; } - dirmode=$1 - shift - ;; - --version) - echo "$0 $scriptversion" - exit 0 - ;; - --) # stop option processing - shift - break - ;; - -*) # unknown option - echo "$usage" 1>&2 - exit 1 - ;; - *) # first non-opt arg - break - ;; - esac -done - -for file -do - if test -d "$file"; then - shift - else - break - fi -done - -case $# in - 0) exit 0 ;; -esac - -case $dirmode in - '') - if mkdir -p -- . 2>/dev/null; then - echo "mkdir -p -- $*" - exec mkdir -p -- "$@" - else - # On NextStep and OpenStep, the `mkdir' command does not - # recognize any option. It will interpret all options as - # directories to create, and then abort because `.' already - # exists. - test -d ./-p && rmdir ./-p - test -d ./-- && rmdir ./-- - fi - ;; - *) - if mkdir -m "$dirmode" -p -- . 2>/dev/null; then - echo "mkdir -m $dirmode -p -- $*" - exec mkdir -m "$dirmode" -p -- "$@" - else - # Clean up after NextStep and OpenStep mkdir. - for d in ./-m ./-p ./-- "./$dirmode"; - do - test -d $d && rmdir $d - done - fi - ;; -esac - -for file -do - set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` - shift - - pathcomp= - for d - do - pathcomp="$pathcomp$d" - case $pathcomp in - -*) pathcomp=./$pathcomp ;; - esac - - if test ! -d "$pathcomp"; then - echo "mkdir $pathcomp" - - mkdir "$pathcomp" || lasterr=$? - - if test ! -d "$pathcomp"; then - errstatus=$lasterr - else - if test ! -z "$dirmode"; then - echo "chmod $dirmode $pathcomp" - lasterr="" - chmod "$dirmode" "$pathcomp" || lasterr=$? - - if test ! -z "$lasterr"; then - errstatus=$lasterr - fi - fi - fi - fi - - pathcomp="$pathcomp/" - done -done - -exit $errstatus - -# Local Variables: -# mode: shell-script -# sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-end: "$" -# End: diff --git a/usr/src/grub/grub-0.95/netboot/3c595.c b/usr/src/grub/grub-0.95/netboot/3c595.c deleted file mode 100644 index 70894ea969..0000000000 --- a/usr/src/grub/grub-0.95/netboot/3c595.c +++ /dev/null @@ -1,550 +0,0 @@ -/* -* 3c595.c -- 3COM 3C595 Fast Etherlink III PCI driver for etherboot -* -* Copyright (C) 2000 Shusuke Nisiyama -* All rights reserved. -* Mar. 14, 2000 -* -* This software may be used, modified, copied, distributed, and sold, in -* both source and binary form provided that the above copyright and these -* terms are retained. Under no circumstances are the authors responsible for -* the proper functioning of this software, nor do the authors assume any -* responsibility for damages incurred with its use. -* -* This code is based on Martin Renters' etherboot-4.4.3 3c509.c and -* Herb Peyerl's FreeBSD 3.4-RELEASE if_vx.c driver. -* -* Copyright (C) 1993-1994, David Greenman, Martin Renters. -* Copyright (C) 1993-1995, Andres Vega Garcia. -* Copyright (C) 1995, Serge Babkin. -* -* Copyright (c) 1994 Herb Peyerl -* -* timlegge 08-24-2003 Add Multicast Support -*/ - -/* #define EDEBUG */ - -#include "etherboot.h" -#include "nic.h" -#include "pci.h" -#include "3c595.h" -#include "timer.h" - -static unsigned short eth_nic_base; -static unsigned short vx_connector, vx_connectors; - -static struct connector_entry { - int bit; - char *name; -} conn_tab[VX_CONNECTORS] = { -#define CONNECTOR_UTP 0 - { 0x08, "utp"}, -#define CONNECTOR_AUI 1 - { 0x20, "aui"}, -/* dummy */ - { 0, "???"}, -#define CONNECTOR_BNC 3 - { 0x10, "bnc"}, -#define CONNECTOR_TX 4 - { 0x02, "tx"}, -#define CONNECTOR_FX 5 - { 0x04, "fx"}, -#define CONNECTOR_MII 6 - { 0x40, "mii"}, - { 0, "???"} -}; - -static void vxgetlink(void); -static void vxsetlink(void); - -/************************************************************************** -ETH_RESET - Reset adapter -***************************************************************************/ -static void t595_reset(struct nic *nic) -{ - int i; - - /*********************************************************** - Reset 3Com 595 card - *************************************************************/ - - /* stop card */ - outw(RX_DISABLE, BASE + VX_COMMAND); - outw(RX_DISCARD_TOP_PACK, BASE + VX_COMMAND); - VX_BUSY_WAIT; - outw(TX_DISABLE, BASE + VX_COMMAND); - outw(STOP_TRANSCEIVER, BASE + VX_COMMAND); - udelay(8000); - outw(RX_RESET, BASE + VX_COMMAND); - VX_BUSY_WAIT; - outw(TX_RESET, BASE + VX_COMMAND); - VX_BUSY_WAIT; - outw(C_INTR_LATCH, BASE + VX_COMMAND); - outw(SET_RD_0_MASK, BASE + VX_COMMAND); - outw(SET_INTR_MASK, BASE + VX_COMMAND); - outw(SET_RX_FILTER, BASE + VX_COMMAND); - - /* - * initialize card - */ - VX_BUSY_WAIT; - - GO_WINDOW(0); - - /* Disable the card */ -/* outw(0, BASE + VX_W0_CONFIG_CTRL); */ - - /* Configure IRQ to none */ -/* outw(SET_IRQ(0), BASE + VX_W0_RESOURCE_CFG); */ - - /* Enable the card */ -/* outw(ENABLE_DRQ_IRQ, BASE + VX_W0_CONFIG_CTRL); */ - - GO_WINDOW(2); - - /* Reload the ether_addr. */ - for (i = 0; i < ETH_ALEN; i++) - outb(nic->node_addr[i], BASE + VX_W2_ADDR_0 + i); - - outw(RX_RESET, BASE + VX_COMMAND); - VX_BUSY_WAIT; - outw(TX_RESET, BASE + VX_COMMAND); - VX_BUSY_WAIT; - - /* Window 1 is operating window */ - GO_WINDOW(1); - for (i = 0; i < 31; i++) - inb(BASE + VX_W1_TX_STATUS); - - outw(SET_RD_0_MASK | S_CARD_FAILURE | S_RX_COMPLETE | - S_TX_COMPLETE | S_TX_AVAIL, BASE + VX_COMMAND); - outw(SET_INTR_MASK | S_CARD_FAILURE | S_RX_COMPLETE | - S_TX_COMPLETE | S_TX_AVAIL, BASE + VX_COMMAND); - -/* - * Attempt to get rid of any stray interrupts that occured during - * configuration. On the i386 this isn't possible because one may - * already be queued. However, a single stray interrupt is - * unimportant. - */ - - outw(ACK_INTR | 0xff, BASE + VX_COMMAND); - - outw(SET_RX_FILTER | FIL_INDIVIDUAL | - FIL_BRDCST|FIL_MULTICAST, BASE + VX_COMMAND); - - vxsetlink(); -/*{ - int i,j; - i = CONNECTOR_TX; - GO_WINDOW(3); - j = inl(BASE + VX_W3_INTERNAL_CFG) & ~INTERNAL_CONNECTOR_MASK; - outl(BASE + VX_W3_INTERNAL_CFG, j | (i < ETH_FRAME_LEN) { - return; - } - - /* drop acknowledgements */ - while(( status=inb(BASE + VX_W1_TX_STATUS) )& TXS_COMPLETE ) { - if(status & (TXS_UNDERRUN|TXS_MAX_COLLISION|TXS_STATUS_OVERFLOW)) { - outw(TX_RESET, BASE + VX_COMMAND); - outw(TX_ENABLE, BASE + VX_COMMAND); - } - - outb(0x0, BASE + VX_W1_TX_STATUS); - } - - while (inw(BASE + VX_W1_FREE_TX) < len + pad + 4) { - /* no room in FIFO */ - } - - outw(len, BASE + VX_W1_TX_PIO_WR_1); - outw(0x0, BASE + VX_W1_TX_PIO_WR_1); /* Second dword meaningless */ - - /* write packet */ - outsw(BASE + VX_W1_TX_PIO_WR_1, d, ETH_ALEN/2); - outsw(BASE + VX_W1_TX_PIO_WR_1, nic->node_addr, ETH_ALEN/2); - outw(t, BASE + VX_W1_TX_PIO_WR_1); - outsw(BASE + VX_W1_TX_PIO_WR_1, p, s / 2); - if (s & 1) - outb(*(p+s - 1), BASE + VX_W1_TX_PIO_WR_1); - - while (pad--) - outb(0, BASE + VX_W1_TX_PIO_WR_1); /* Padding */ - - /* wait for Tx complete */ - while((inw(BASE + VX_STATUS) & S_COMMAND_IN_PROGRESS) != 0) - ; -} - -/************************************************************************** -ETH_POLL - Wait for a frame -***************************************************************************/ -static int t595_poll(struct nic *nic, int retrieve) -{ - /* common variables */ - /* variables for 3C595 */ - short status, cst; - register short rx_fifo; - - cst=inw(BASE + VX_STATUS); - -#ifdef EDEBUG - if(cst & 0x1FFF) - printf("-%hX-",cst); -#endif - - if( (cst & S_RX_COMPLETE)==0 ) { - /* acknowledge everything */ - outw(ACK_INTR | cst, BASE + VX_COMMAND); - outw(C_INTR_LATCH, BASE + VX_COMMAND); - - return 0; - } - - status = inw(BASE + VX_W1_RX_STATUS); -#ifdef EDEBUG - printf("*%hX*",status); -#endif - - if (status & ERR_RX) { - outw(RX_DISCARD_TOP_PACK, BASE + VX_COMMAND); - return 0; - } - - rx_fifo = status & RX_BYTES_MASK; - if (rx_fifo==0) - return 0; - - if ( ! retrieve ) return 1; - - /* read packet */ -#ifdef EDEBUG - printf("[l=%d",rx_fifo); -#endif - insw(BASE + VX_W1_RX_PIO_RD_1, nic->packet, rx_fifo / 2); - if(rx_fifo & 1) - nic->packet[rx_fifo-1]=inb(BASE + VX_W1_RX_PIO_RD_1); - nic->packetlen=rx_fifo; - - while(1) { - status = inw(BASE + VX_W1_RX_STATUS); -#ifdef EDEBUG - printf("*%hX*",status); -#endif - rx_fifo = status & RX_BYTES_MASK; - - if(rx_fifo>0) { - insw(BASE + VX_W1_RX_PIO_RD_1, nic->packet+nic->packetlen, rx_fifo / 2); - if(rx_fifo & 1) - nic->packet[nic->packetlen+rx_fifo-1]=inb(BASE + VX_W1_RX_PIO_RD_1); - nic->packetlen+=rx_fifo; -#ifdef EDEBUG - printf("+%d",rx_fifo); -#endif - } - if(( status & RX_INCOMPLETE )==0) { -#ifdef EDEBUG - printf("=%d",nic->packetlen); -#endif - break; - } - udelay(1000); - } - - /* acknowledge reception of packet */ - outw(RX_DISCARD_TOP_PACK, BASE + VX_COMMAND); - while (inw(BASE + VX_STATUS) & S_COMMAND_IN_PROGRESS); -#ifdef EDEBUG -{ - unsigned short type = 0; /* used by EDEBUG */ - type = (nic->packet[12]<<8) | nic->packet[13]; - if(nic->packet[0]+nic->packet[1]+nic->packet[2]+nic->packet[3]+nic->packet[4]+ - nic->packet[5] == 0xFF*ETH_ALEN) - printf(",t=%hX,b]",type); - else - printf(",t=%hX]",type); -} -#endif - return 1; -} - - -/************************************************************************* - 3Com 595 - specific routines -**************************************************************************/ - -static int -eeprom_rdy() -{ - int i; - - for (i = 0; is_eeprom_busy(BASE) && i < MAX_EEPROMBUSY; i++) - udelay(1000); - if (i >= MAX_EEPROMBUSY) { - /* printf("3c595: eeprom failed to come ready.\n"); */ - printf("3c595: eeprom is busy.\n"); /* memory in EPROM is tight */ - return (0); - } - return (1); -} - -/* - * get_e: gets a 16 bits word from the EEPROM. we must have set the window - * before - */ -static int -get_e(offset) -int offset; -{ - if (!eeprom_rdy()) - return (0xffff); - outw(EEPROM_CMD_RD | offset, BASE + VX_W0_EEPROM_COMMAND); - if (!eeprom_rdy()) - return (0xffff); - return (inw(BASE + VX_W0_EEPROM_DATA)); -} - -static void -vxgetlink(void) -{ - int n, k; - - GO_WINDOW(3); - vx_connectors = inw(BASE + VX_W3_RESET_OPT) & 0x7f; - for (n = 0, k = 0; k < VX_CONNECTORS; k++) { - if (vx_connectors & conn_tab[k].bit) { - if (n > 0) { - printf("/"); - } - printf(conn_tab[k].name); - n++; - } - } - if (vx_connectors == 0) { - printf("no connectors!"); - return; - } - GO_WINDOW(3); - vx_connector = (inl(BASE + VX_W3_INTERNAL_CFG) - & INTERNAL_CONNECTOR_MASK) - >> INTERNAL_CONNECTOR_BITS; - if (vx_connector & 0x10) { - vx_connector &= 0x0f; - printf("[*%s*]", conn_tab[vx_connector].name); - printf(": disable 'auto select' with DOS util!"); - } else { - printf("[*%s*]", conn_tab[vx_connector].name); - } -} - -static void -vxsetlink(void) -{ - int i, j; - char *reason, *warning; - static char prev_conn = -1; - - if (prev_conn == -1) { - prev_conn = vx_connector; - } - - i = vx_connector; /* default in EEPROM */ - reason = "default"; - warning = 0; - - if ((vx_connectors & conn_tab[vx_connector].bit) == 0) { - warning = "strange connector type in EEPROM."; - reason = "forced"; - i = CONNECTOR_UTP; - } - - if (warning != 0) { - printf("warning: %s\n", warning); - } - printf("selected %s. (%s)\n", conn_tab[i].name, reason); - - /* Set the selected connector. */ - GO_WINDOW(3); - j = inl(BASE + VX_W3_INTERNAL_CFG) & ~INTERNAL_CONNECTOR_MASK; - outl(j | (i <ioaddr == 0) - return 0; -/* eth_nic_base = probeaddrs[0] & ~3; */ - eth_nic_base = pci->ioaddr; - - nic->irqno = 0; - nic->ioaddr = pci->ioaddr & ~3; - - GO_WINDOW(0); - outw(GLOBAL_RESET, BASE + VX_COMMAND); - VX_BUSY_WAIT; - - vxgetlink(); - -/* - printf("\nEEPROM:"); - for (i = 0; i < (EEPROMSIZE/2); i++) { - printf("%hX:", get_e(i)); - } - printf("\n"); -*/ - /* - * Read the station address from the eeprom - */ - p = (unsigned short *) nic->node_addr; - for (i = 0; i < 3; i++) { - GO_WINDOW(0); - p[i] = htons(get_e(EEPROM_OEM_ADDR_0 + i)); - GO_WINDOW(2); - outw(ntohs(p[i]), BASE + VX_W2_ADDR_0 + (i * 2)); - } - - printf("Ethernet address: %!\n", nic->node_addr); - - t595_reset(nic); - dev->disable = t595_disable; - nic->poll = t595_poll; - nic->transmit = t595_transmit; - nic->irq = t595_irq; - return 1; - -} - -static struct pci_id t595_nics[] = { -PCI_ROM(0x10b7, 0x5900, "3c590", "3Com590"), /* Vortex 10Mbps */ -PCI_ROM(0x10b7, 0x5950, "3c595", "3Com595"), /* Vortex 100baseTx */ -PCI_ROM(0x10b7, 0x5951, "3c595-1", "3Com595"), /* Vortex 100baseT4 */ -PCI_ROM(0x10b7, 0x5952, "3c595-2", "3Com595"), /* Vortex 100base-MII */ -PCI_ROM(0x10b7, 0x9000, "3c900-tpo", "3Com900-TPO"), /* 10 Base TPO */ -PCI_ROM(0x10b7, 0x9001, "3c900-t4", "3Com900-Combo"), /* 10/100 T4 */ -PCI_ROM(0x10b7, 0x9004, "3c900b-tpo", "3Com900B-TPO"), /* 10 Base TPO */ -PCI_ROM(0x10b7, 0x9005, "3c900b-combo", "3Com900B-Combo"), /* 10 Base Combo */ -PCI_ROM(0x10b7, 0x9006, "3c900b-tpb2", "3Com900B-2/T"), /* 10 Base TP and Base2 */ -PCI_ROM(0x10b7, 0x900a, "3c900b-fl", "3Com900B-FL"), /* 10 Base F */ -PCI_ROM(0x10b7, 0x9800, "3c980-cyclone-1", "3Com980-Cyclone"), /* Cyclone */ -PCI_ROM(0x10b7, 0x9805, "3c9805-1", "3Com9805"), /* Dual Port Server Cyclone */ -PCI_ROM(0x10b7, 0x7646, "3csoho100-tx-1", "3CSOHO100-TX"), /* Hurricane */ -PCI_ROM(0x10b7, 0x4500, "3c450-1", "3Com450 HomePNA Tornado"), -}; - -struct pci_driver t595_driver = { - .type = NIC_DRIVER, - .name = "3C595", - .probe = t595_probe, - .ids = t595_nics, - .id_count = sizeof(t595_nics)/sizeof(t595_nics[0]), - .class = 0, -}; - -/* - * Local variables: - * c-basic-offset: 8 - * End: - */ - diff --git a/usr/src/grub/grub-0.95/netboot/3c595.h b/usr/src/grub/grub-0.95/netboot/3c595.h deleted file mode 100644 index 49d8d9b049..0000000000 --- a/usr/src/grub/grub-0.95/netboot/3c595.h +++ /dev/null @@ -1,435 +0,0 @@ -/* - * Copyright (c) 1993 Herb Peyerl (hpeyerl@novatel.ca) 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. 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. - * - October 2, 1994 - - Modified by: Andres Vega Garcia - - INRIA - Sophia Antipolis, France - e-mail: avega@sophia.inria.fr - finger: avega@pax.inria.fr - - */ - -/* - * Created from if_epreg.h by Fred Gray (fgray@rice.edu) to support the - * 3c590 family. - */ - -/* - * Modified by Shusuke Nisiyama - * for etherboot - * Mar. 14, 2000 -*/ - -/* - * Ethernet software status per interface. - */ - -/* - * Some global constants - */ - -#define TX_INIT_RATE 16 -#define TX_INIT_MAX_RATE 64 -#define RX_INIT_LATENCY 64 -#define RX_INIT_EARLY_THRESH 64 -#define MIN_RX_EARLY_THRESHF 16 /* not less than ether_header */ -#define MIN_RX_EARLY_THRESHL 4 - -#define EEPROMSIZE 0x40 -#define MAX_EEPROMBUSY 1000 -#define VX_LAST_TAG 0xd7 -#define VX_MAX_BOARDS 16 -#define VX_ID_PORT 0x100 - -/* - * some macros to acces long named fields - */ -#define BASE (eth_nic_base) - -/* - * Commands to read/write EEPROM trough EEPROM command register (Window 0, - * Offset 0xa) - */ -#define EEPROM_CMD_RD 0x0080 /* Read: Address required (5 bits) */ -#define EEPROM_CMD_WR 0x0040 /* Write: Address required (5 bits) */ -#define EEPROM_CMD_ERASE 0x00c0 /* Erase: Address required (5 bits) */ -#define EEPROM_CMD_EWEN 0x0030 /* Erase/Write Enable: No data required */ - -#define EEPROM_BUSY (1<<15) - -/* - * Some short functions, worth to let them be a macro - */ - -/************************************************************************** - * * - * These define the EEPROM data structure. They are used in the probe - * function to verify the existence of the adapter after having sent - * the ID_Sequence. - * - * There are others but only the ones we use are defined here. - * - **************************************************************************/ - -#define EEPROM_NODE_ADDR_0 0x0 /* Word */ -#define EEPROM_NODE_ADDR_1 0x1 /* Word */ -#define EEPROM_NODE_ADDR_2 0x2 /* Word */ -#define EEPROM_PROD_ID 0x3 /* 0x9[0-f]50 */ -#define EEPROM_MFG_ID 0x7 /* 0x6d50 */ -#define EEPROM_ADDR_CFG 0x8 /* Base addr */ -#define EEPROM_RESOURCE_CFG 0x9 /* IRQ. Bits 12-15 */ -#define EEPROM_OEM_ADDR_0 0xa /* Word */ -#define EEPROM_OEM_ADDR_1 0xb /* Word */ -#define EEPROM_OEM_ADDR_2 0xc /* Word */ -#define EEPROM_SOFT_INFO_2 0xf /* Software information 2 */ - -#define NO_RX_OVN_ANOMALY (1<<5) - -/************************************************************************** - * * - * These are the registers for the 3Com 3c509 and their bit patterns when * - * applicable. They have been taken out the the "EtherLink III Parallel * - * Tasking EISA and ISA Technical Reference" "Beta Draft 10/30/92" manual * - * from 3com. * - * * - **************************************************************************/ - -#define VX_COMMAND 0x0e /* Write. BASE+0x0e is always a - * command reg. */ -#define VX_STATUS 0x0e /* Read. BASE+0x0e is always status - * reg. */ -#define VX_WINDOW 0x0f /* Read. BASE+0x0f is always window - * reg. */ -/* - * Window 0 registers. Setup. - */ -/* Write */ -#define VX_W0_EEPROM_DATA 0x0c -#define VX_W0_EEPROM_COMMAND 0x0a -#define VX_W0_RESOURCE_CFG 0x08 -#define VX_W0_ADDRESS_CFG 0x06 -#define VX_W0_CONFIG_CTRL 0x04 - /* Read */ -#define VX_W0_PRODUCT_ID 0x02 -#define VX_W0_MFG_ID 0x00 - - -/* - * Window 1 registers. Operating Set. - */ -/* Write */ -#define VX_W1_TX_PIO_WR_2 0x02 -#define VX_W1_TX_PIO_WR_1 0x00 -/* Read */ -#define VX_W1_FREE_TX 0x0c -#define VX_W1_TX_STATUS 0x0b /* byte */ -#define VX_W1_TIMER 0x0a /* byte */ -#define VX_W1_RX_STATUS 0x08 -#define VX_W1_RX_PIO_RD_2 0x02 -#define VX_W1_RX_PIO_RD_1 0x00 - -/* - * Window 2 registers. Station Address Setup/Read - */ -/* Read/Write */ -#define VX_W2_ADDR_5 0x05 -#define VX_W2_ADDR_4 0x04 -#define VX_W2_ADDR_3 0x03 -#define VX_W2_ADDR_2 0x02 -#define VX_W2_ADDR_1 0x01 -#define VX_W2_ADDR_0 0x00 - -/* - * Window 3 registers. FIFO Management. - */ -/* Read */ -#define VX_W3_INTERNAL_CFG 0x00 -#define VX_W3_RESET_OPT 0x08 -#define VX_W3_FREE_TX 0x0c -#define VX_W3_FREE_RX 0x0a - -/* - * Window 4 registers. Diagnostics. - */ -/* Read/Write */ -#define VX_W4_MEDIA_TYPE 0x0a -#define VX_W4_CTRLR_STATUS 0x08 -#define VX_W4_NET_DIAG 0x06 -#define VX_W4_FIFO_DIAG 0x04 -#define VX_W4_HOST_DIAG 0x02 -#define VX_W4_TX_DIAG 0x00 - -/* - * Window 5 Registers. Results and Internal status. - */ -/* Read */ -#define VX_W5_READ_0_MASK 0x0c -#define VX_W5_INTR_MASK 0x0a -#define VX_W5_RX_FILTER 0x08 -#define VX_W5_RX_EARLY_THRESH 0x06 -#define VX_W5_TX_AVAIL_THRESH 0x02 -#define VX_W5_TX_START_THRESH 0x00 - -/* - * Window 6 registers. Statistics. - */ -/* Read/Write */ -#define TX_TOTAL_OK 0x0c -#define RX_TOTAL_OK 0x0a -#define TX_DEFERRALS 0x08 -#define RX_FRAMES_OK 0x07 -#define TX_FRAMES_OK 0x06 -#define RX_OVERRUNS 0x05 -#define TX_COLLISIONS 0x04 -#define TX_AFTER_1_COLLISION 0x03 -#define TX_AFTER_X_COLLISIONS 0x02 -#define TX_NO_SQE 0x01 -#define TX_CD_LOST 0x00 - -/**************************************** - * - * Register definitions. - * - ****************************************/ - -/* - * Command register. All windows. - * - * 16 bit register. - * 15-11: 5-bit code for command to be executed. - * 10-0: 11-bit arg if any. For commands with no args; - * this can be set to anything. - */ -#define GLOBAL_RESET (unsigned short) 0x0000 /* Wait at least 1ms - * after issuing */ -#define WINDOW_SELECT (unsigned short) (0x1<<11) -#define START_TRANSCEIVER (unsigned short) (0x2<<11) /* Read ADDR_CFG reg to - * determine whether - * this is needed. If - * so; wait 800 uSec - * before using trans- - * ceiver. */ -#define RX_DISABLE (unsigned short) (0x3<<11) /* state disabled on - * power-up */ -#define RX_ENABLE (unsigned short) (0x4<<11) -#define RX_RESET (unsigned short) (0x5<<11) -#define RX_DISCARD_TOP_PACK (unsigned short) (0x8<<11) -#define TX_ENABLE (unsigned short) (0x9<<11) -#define TX_DISABLE (unsigned short) (0xa<<11) -#define TX_RESET (unsigned short) (0xb<<11) -#define REQ_INTR (unsigned short) (0xc<<11) -/* - * The following C_* acknowledge the various interrupts. Some of them don't - * do anything. See the manual. - */ -#define ACK_INTR (unsigned short) (0x6800) -# define C_INTR_LATCH (unsigned short) (ACK_INTR|0x1) -# define C_CARD_FAILURE (unsigned short) (ACK_INTR|0x2) -# define C_TX_COMPLETE (unsigned short) (ACK_INTR|0x4) -# define C_TX_AVAIL (unsigned short) (ACK_INTR|0x8) -# define C_RX_COMPLETE (unsigned short) (ACK_INTR|0x10) -# define C_RX_EARLY (unsigned short) (ACK_INTR|0x20) -# define C_INT_RQD (unsigned short) (ACK_INTR|0x40) -# define C_UPD_STATS (unsigned short) (ACK_INTR|0x80) -#define SET_INTR_MASK (unsigned short) (0xe<<11) -#define SET_RD_0_MASK (unsigned short) (0xf<<11) -#define SET_RX_FILTER (unsigned short) (0x10<<11) -# define FIL_INDIVIDUAL (unsigned short) (0x1) -# define FIL_MULTICAST (unsigned short) (0x02) -# define FIL_BRDCST (unsigned short) (0x04) -# define FIL_PROMISC (unsigned short) (0x08) -#define SET_RX_EARLY_THRESH (unsigned short) (0x11<<11) -#define SET_TX_AVAIL_THRESH (unsigned short) (0x12<<11) -#define SET_TX_START_THRESH (unsigned short) (0x13<<11) -#define STATS_ENABLE (unsigned short) (0x15<<11) -#define STATS_DISABLE (unsigned short) (0x16<<11) -#define STOP_TRANSCEIVER (unsigned short) (0x17<<11) - -/* - * Status register. All windows. - * - * 15-13: Window number(0-7). - * 12: Command_in_progress. - * 11: reserved. - * 10: reserved. - * 9: reserved. - * 8: reserved. - * 7: Update Statistics. - * 6: Interrupt Requested. - * 5: RX Early. - * 4: RX Complete. - * 3: TX Available. - * 2: TX Complete. - * 1: Adapter Failure. - * 0: Interrupt Latch. - */ -#define S_INTR_LATCH (unsigned short) (0x1) -#define S_CARD_FAILURE (unsigned short) (0x2) -#define S_TX_COMPLETE (unsigned short) (0x4) -#define S_TX_AVAIL (unsigned short) (0x8) -#define S_RX_COMPLETE (unsigned short) (0x10) -#define S_RX_EARLY (unsigned short) (0x20) -#define S_INT_RQD (unsigned short) (0x40) -#define S_UPD_STATS (unsigned short) (0x80) -#define S_COMMAND_IN_PROGRESS (unsigned short) (0x1000) - -#define VX_BUSY_WAIT while (inw(BASE + VX_STATUS) & S_COMMAND_IN_PROGRESS) - -/* Address Config. Register. - * Window 0/Port 06 - */ - -#define ACF_CONNECTOR_BITS 14 -#define ACF_CONNECTOR_UTP 0 -#define ACF_CONNECTOR_AUI 1 -#define ACF_CONNECTOR_BNC 3 - -#define INTERNAL_CONNECTOR_BITS 20 -#define INTERNAL_CONNECTOR_MASK 0x01700000 - -/* - * FIFO Registers. RX Status. - * - * 15: Incomplete or FIFO empty. - * 14: 1: Error in RX Packet 0: Incomplete or no error. - * 13-11: Type of error. - * 1000 = Overrun. - * 1011 = Run Packet Error. - * 1100 = Alignment Error. - * 1101 = CRC Error. - * 1001 = Oversize Packet Error (>1514 bytes) - * 0010 = Dribble Bits. - * (all other error codes, no errors.) - * - * 10-0: RX Bytes (0-1514) - */ -#define ERR_INCOMPLETE (unsigned short) (0x8000) -#define ERR_RX (unsigned short) (0x4000) -#define ERR_MASK (unsigned short) (0x7800) -#define ERR_OVERRUN (unsigned short) (0x4000) -#define ERR_RUNT (unsigned short) (0x5800) -#define ERR_ALIGNMENT (unsigned short) (0x6000) -#define ERR_CRC (unsigned short) (0x6800) -#define ERR_OVERSIZE (unsigned short) (0x4800) -#define ERR_DRIBBLE (unsigned short) (0x1000) - -/* - * TX Status. - * - * Reports the transmit status of a completed transmission. Writing this - * register pops the transmit completion stack. - * - * Window 1/Port 0x0b. - * - * 7: Complete - * 6: Interrupt on successful transmission requested. - * 5: Jabber Error (TP Only, TX Reset required. ) - * 4: Underrun (TX Reset required. ) - * 3: Maximum Collisions. - * 2: TX Status Overflow. - * 1-0: Undefined. - * - */ -#define TXS_COMPLETE 0x80 -#define TXS_INTR_REQ 0x40 -#define TXS_JABBER 0x20 -#define TXS_UNDERRUN 0x10 -#define TXS_MAX_COLLISION 0x8 -#define TXS_STATUS_OVERFLOW 0x4 - -#define RS_AUI (1<<5) -#define RS_BNC (1<<4) -#define RS_UTP (1<<3) -#define RS_T4 (1<<0) -#define RS_TX (1<<1) -#define RS_FX (1<<2) -#define RS_MII (1<<6) - - -/* - * FIFO Status (Window 4) - * - * Supports FIFO diagnostics - * - * Window 4/Port 0x04.1 - * - * 15: 1=RX receiving (RO). Set when a packet is being received - * into the RX FIFO. - * 14: Reserved - * 13: 1=RX underrun (RO). Generates Adapter Failure interrupt. - * Requires RX Reset or Global Reset command to recover. - * It is generated when you read past the end of a packet - - * reading past what has been received so far will give bad - * data. - * 12: 1=RX status overrun (RO). Set when there are already 8 - * packets in the RX FIFO. While this bit is set, no additional - * packets are received. Requires no action on the part of - * the host. The condition is cleared once a packet has been - * read out of the RX FIFO. - * 11: 1=RX overrun (RO). Set when the RX FIFO is full (there - * may not be an overrun packet yet). While this bit is set, - * no additional packets will be received (some additional - * bytes can still be pending between the wire and the RX - * FIFO). Requires no action on the part of the host. The - * condition is cleared once a few bytes have been read out - * from the RX FIFO. - * 10: 1=TX overrun (RO). Generates adapter failure interrupt. - * Requires TX Reset or Global Reset command to recover. - * Disables Transmitter. - * 9-8: Unassigned. - * 7-0: Built in self test bits for the RX and TX FIFO's. - */ -#define FIFOS_RX_RECEIVING (unsigned short) 0x8000 -#define FIFOS_RX_UNDERRUN (unsigned short) 0x2000 -#define FIFOS_RX_STATUS_OVERRUN (unsigned short) 0x1000 -#define FIFOS_RX_OVERRUN (unsigned short) 0x0800 -#define FIFOS_TX_OVERRUN (unsigned short) 0x0400 - -/* - * Misc defines for various things. - */ -#define TAG_ADAPTER 0xd0 -#define ACTIVATE_ADAPTER_TO_CONFIG 0xff -#define ENABLE_DRQ_IRQ 0x0001 -#define MFG_ID 0x506d /* `TCM' */ -#define PROD_ID 0x5090 -#define GO_WINDOW(x) outw(WINDOW_SELECT|(x),BASE+VX_COMMAND) -#define JABBER_GUARD_ENABLE 0x40 -#define LINKBEAT_ENABLE 0x80 -#define ENABLE_UTP (JABBER_GUARD_ENABLE | LINKBEAT_ENABLE) -#define DISABLE_UTP 0x0 -#define RX_BYTES_MASK (unsigned short) (0x07ff) -#define RX_ERROR 0x4000 -#define RX_INCOMPLETE 0x8000 -#define TX_INDICATE 1<<15 -#define is_eeprom_busy(b) (inw((b)+VX_W0_EEPROM_COMMAND)&EEPROM_BUSY) - -#define VX_IOSIZE 0x20 - -#define VX_CONNECTORS 8 - -/* - * Local variables: - * c-basic-offset: 8 - * End: - */ diff --git a/usr/src/grub/grub-0.95/netboot/3c90x.c b/usr/src/grub/grub-0.95/netboot/3c90x.c deleted file mode 100644 index 2a11e6e8c0..0000000000 --- a/usr/src/grub/grub-0.95/netboot/3c90x.c +++ /dev/null @@ -1,995 +0,0 @@ -/* - * 3c90x.c -- This file implements the 3c90x driver for etherboot. Written - * by Greg Beeley, Greg.Beeley@LightSys.org. Modified by Steve Smith, - * Steve.Smith@Juno.Com. Alignment bug fix Neil Newell (nn@icenoir.net). - * - * This program Copyright (C) 1999 LightSys Technology Services, Inc. - * Portions Copyright (C) 1999 Steve Smith - * - * This program may be re-distributed in source or binary form, modified, - * sold, or copied for any purpose, provided that the above copyright message - * and this text are included with all source copies or derivative works, and - * provided that the above copyright message and this text are included in the - * documentation of any binary-only distributions. This program is distributed - * WITHOUT ANY WARRANTY, without even the warranty of FITNESS FOR A PARTICULAR - * PURPOSE or MERCHANTABILITY. Please read the associated documentation - * "3c90x.txt" before compiling and using this driver. - * - * -------- - * - * Program written with the assistance of the 3com documentation for - * the 3c905B-TX card, as well as with some assistance from the 3c59x - * driver Donald Becker wrote for the Linux kernel, and with some assistance - * from the remainder of the Etherboot distribution. - * - * REVISION HISTORY: - * - * v0.10 1-26-1998 GRB Initial implementation. - * v0.90 1-27-1998 GRB System works. - * v1.00pre1 2-11-1998 GRB Got prom boot issue fixed. - * v2.0 9-24-1999 SCS Modified for 3c905 (from 3c905b code) - * Re-wrote poll and transmit for - * better error recovery and heavy - * network traffic operation - * v2.01 5-26-2003 NN Fixed driver alignment issue which - * caused system lockups if driver structures - * not 8-byte aligned. - * - */ - -#include "etherboot.h" -#include "nic.h" -#include "pci.h" -#include "timer.h" - -#define XCVR_MAGIC (0x5A00) -/** any single transmission fails after 16 collisions or other errors - ** this is the number of times to retry the transmission -- this should - ** be plenty - **/ -#define XMIT_RETRIES 250 - -/*** Register definitions for the 3c905 ***/ -enum Registers - { - regPowerMgmtCtrl_w = 0x7c, /** 905B Revision Only **/ - regUpMaxBurst_w = 0x7a, /** 905B Revision Only **/ - regDnMaxBurst_w = 0x78, /** 905B Revision Only **/ - regDebugControl_w = 0x74, /** 905B Revision Only **/ - regDebugData_l = 0x70, /** 905B Revision Only **/ - regRealTimeCnt_l = 0x40, /** Universal **/ - regUpBurstThresh_b = 0x3e, /** 905B Revision Only **/ - regUpPoll_b = 0x3d, /** 905B Revision Only **/ - regUpPriorityThresh_b = 0x3c, /** 905B Revision Only **/ - regUpListPtr_l = 0x38, /** Universal **/ - regCountdown_w = 0x36, /** Universal **/ - regFreeTimer_w = 0x34, /** Universal **/ - regUpPktStatus_l = 0x30, /** Universal with Exception, pg 130 **/ - regTxFreeThresh_b = 0x2f, /** 90X Revision Only **/ - regDnPoll_b = 0x2d, /** 905B Revision Only **/ - regDnPriorityThresh_b = 0x2c, /** 905B Revision Only **/ - regDnBurstThresh_b = 0x2a, /** 905B Revision Only **/ - regDnListPtr_l = 0x24, /** Universal with Exception, pg 107 **/ - regDmaCtrl_l = 0x20, /** Universal with Exception, pg 106 **/ - /** **/ - regIntStatusAuto_w = 0x1e, /** 905B Revision Only **/ - regTxStatus_b = 0x1b, /** Universal with Exception, pg 113 **/ - regTimer_b = 0x1a, /** Universal **/ - regTxPktId_b = 0x18, /** 905B Revision Only **/ - regCommandIntStatus_w = 0x0e, /** Universal (Command Variations) **/ - }; - -/** following are windowed registers **/ -enum Registers7 - { - regPowerMgmtEvent_7_w = 0x0c, /** 905B Revision Only **/ - regVlanEtherType_7_w = 0x04, /** 905B Revision Only **/ - regVlanMask_7_w = 0x00, /** 905B Revision Only **/ - }; - -enum Registers6 - { - regBytesXmittedOk_6_w = 0x0c, /** Universal **/ - regBytesRcvdOk_6_w = 0x0a, /** Universal **/ - regUpperFramesOk_6_b = 0x09, /** Universal **/ - regFramesDeferred_6_b = 0x08, /** Universal **/ - regFramesRecdOk_6_b = 0x07, /** Universal with Exceptions, pg 142 **/ - regFramesXmittedOk_6_b = 0x06, /** Universal **/ - regRxOverruns_6_b = 0x05, /** Universal **/ - regLateCollisions_6_b = 0x04, /** Universal **/ - regSingleCollisions_6_b = 0x03, /** Universal **/ - regMultipleCollisions_6_b = 0x02, /** Universal **/ - regSqeErrors_6_b = 0x01, /** Universal **/ - regCarrierLost_6_b = 0x00, /** Universal **/ - }; - -enum Registers5 - { - regIndicationEnable_5_w = 0x0c, /** Universal **/ - regInterruptEnable_5_w = 0x0a, /** Universal **/ - regTxReclaimThresh_5_b = 0x09, /** 905B Revision Only **/ - regRxFilter_5_b = 0x08, /** Universal **/ - regRxEarlyThresh_5_w = 0x06, /** Universal **/ - regTxStartThresh_5_w = 0x00, /** Universal **/ - }; - -enum Registers4 - { - regUpperBytesOk_4_b = 0x0d, /** Universal **/ - regBadSSD_4_b = 0x0c, /** Universal **/ - regMediaStatus_4_w = 0x0a, /** Universal with Exceptions, pg 201 **/ - regPhysicalMgmt_4_w = 0x08, /** Universal **/ - regNetworkDiagnostic_4_w = 0x06, /** Universal with Exceptions, pg 203 **/ - regFifoDiagnostic_4_w = 0x04, /** Universal with Exceptions, pg 196 **/ - regVcoDiagnostic_4_w = 0x02, /** Undocumented? **/ - }; - -enum Registers3 - { - regTxFree_3_w = 0x0c, /** Universal **/ - regRxFree_3_w = 0x0a, /** Universal with Exceptions, pg 125 **/ - regResetMediaOptions_3_w = 0x08, /** Media Options on B Revision, **/ - /** Reset Options on Non-B Revision **/ - regMacControl_3_w = 0x06, /** Universal with Exceptions, pg 199 **/ - regMaxPktSize_3_w = 0x04, /** 905B Revision Only **/ - regInternalConfig_3_l = 0x00, /** Universal, different bit **/ - /** definitions, pg 59 **/ - }; - -enum Registers2 - { - regResetOptions_2_w = 0x0c, /** 905B Revision Only **/ - regStationMask_2_3w = 0x06, /** Universal with Exceptions, pg 127 **/ - regStationAddress_2_3w = 0x00, /** Universal with Exceptions, pg 127 **/ - }; - -enum Registers1 - { - regRxStatus_1_w = 0x0a, /** 90X Revision Only, Pg 126 **/ - }; - -enum Registers0 - { - regEepromData_0_w = 0x0c, /** Universal **/ - regEepromCommand_0_w = 0x0a, /** Universal **/ - regBiosRomData_0_b = 0x08, /** 905B Revision Only **/ - regBiosRomAddr_0_l = 0x04, /** 905B Revision Only **/ - }; - - -/*** The names for the eight register windows ***/ -enum Windows - { - winPowerVlan7 = 0x07, - winStatistics6 = 0x06, - winTxRxControl5 = 0x05, - winDiagnostics4 = 0x04, - winTxRxOptions3 = 0x03, - winAddressing2 = 0x02, - winUnused1 = 0x01, - winEepromBios0 = 0x00, - }; - - -/*** Command definitions for the 3c90X ***/ -enum Commands - { - cmdGlobalReset = 0x00, /** Universal with Exceptions, pg 151 **/ - cmdSelectRegisterWindow = 0x01, /** Universal **/ - cmdEnableDcConverter = 0x02, /** **/ - cmdRxDisable = 0x03, /** **/ - cmdRxEnable = 0x04, /** Universal **/ - cmdRxReset = 0x05, /** Universal **/ - cmdStallCtl = 0x06, /** Universal **/ - cmdTxEnable = 0x09, /** Universal **/ - cmdTxDisable = 0x0A, /** **/ - cmdTxReset = 0x0B, /** Universal **/ - cmdRequestInterrupt = 0x0C, /** **/ - cmdAcknowledgeInterrupt = 0x0D, /** Universal **/ - cmdSetInterruptEnable = 0x0E, /** Universal **/ - cmdSetIndicationEnable = 0x0F, /** Universal **/ - cmdSetRxFilter = 0x10, /** Universal **/ - cmdSetRxEarlyThresh = 0x11, /** **/ - cmdSetTxStartThresh = 0x13, /** **/ - cmdStatisticsEnable = 0x15, /** **/ - cmdStatisticsDisable = 0x16, /** **/ - cmdDisableDcConverter = 0x17, /** **/ - cmdSetTxReclaimThresh = 0x18, /** **/ - cmdSetHashFilterBit = 0x19, /** **/ - }; - - -/*** Values for int status register bitmask **/ -#define INT_INTERRUPTLATCH (1<<0) -#define INT_HOSTERROR (1<<1) -#define INT_TXCOMPLETE (1<<2) -#define INT_RXCOMPLETE (1<<4) -#define INT_RXEARLY (1<<5) -#define INT_INTREQUESTED (1<<6) -#define INT_UPDATESTATS (1<<7) -#define INT_LINKEVENT (1<<8) -#define INT_DNCOMPLETE (1<<9) -#define INT_UPCOMPLETE (1<<10) -#define INT_CMDINPROGRESS (1<<12) -#define INT_WINDOWNUMBER (7<<13) - - -/*** TX descriptor ***/ -typedef struct - { - unsigned int DnNextPtr; - unsigned int FrameStartHeader; - unsigned int HdrAddr; - unsigned int HdrLength; - unsigned int DataAddr; - unsigned int DataLength; - } - TXD __attribute__ ((aligned(8))); /* 64-bit aligned for bus mastering */ - -/*** RX descriptor ***/ -typedef struct - { - unsigned int UpNextPtr; - unsigned int UpPktStatus; - unsigned int DataAddr; - unsigned int DataLength; - } - RXD __attribute__ ((aligned(8))); /* 64-bit aligned for bus mastering */ - -/*** Global variables ***/ -static struct - { - unsigned char isBrev; - unsigned char CurrentWindow; - unsigned int IOAddr; - unsigned char HWAddr[ETH_ALEN]; - TXD TransmitDPD; - RXD ReceiveUPD; - } - INF_3C90X; - - -/*** a3c90x_internal_IssueCommand: sends a command to the 3c90x card - ***/ -static int -a3c90x_internal_IssueCommand(int ioaddr, int cmd, int param) - { - unsigned int val; - - /** Build the cmd. **/ - val = cmd; - val <<= 11; - val |= param; - - /** Send the cmd to the cmd register **/ - outw(val, ioaddr + regCommandIntStatus_w); - - /** Wait for the cmd to complete, if necessary **/ - while (inw(ioaddr + regCommandIntStatus_w) & INT_CMDINPROGRESS); - - return 0; - } - - -/*** a3c90x_internal_SetWindow: selects a register window set. - ***/ -static int -a3c90x_internal_SetWindow(int ioaddr, int window) - { - - /** Window already as set? **/ - if (INF_3C90X.CurrentWindow == window) return 0; - - /** Issue the window command. **/ - a3c90x_internal_IssueCommand(ioaddr, cmdSelectRegisterWindow, window); - INF_3C90X.CurrentWindow = window; - - return 0; - } - - -/*** a3c90x_internal_ReadEeprom - read data from the serial eeprom. - ***/ -static unsigned short -a3c90x_internal_ReadEeprom(int ioaddr, int address) - { - unsigned short val; - - /** Select correct window **/ - a3c90x_internal_SetWindow(INF_3C90X.IOAddr, winEepromBios0); - - /** Make sure the eeprom isn't busy **/ - while((1<<15) & inw(ioaddr + regEepromCommand_0_w)); - - /** Read the value. **/ - outw(address + ((0x02)<<6), ioaddr + regEepromCommand_0_w); - while((1<<15) & inw(ioaddr + regEepromCommand_0_w)); - val = inw(ioaddr + regEepromData_0_w); - - return val; - } - - -#if 0 -/*** a3c90x_internal_WriteEepromWord - write a physical word of - *** data to the onboard serial eeprom (not the BIOS prom, but the - *** nvram in the card that stores, among other things, the MAC - *** address). - ***/ -static int -a3c90x_internal_WriteEepromWord(int ioaddr, int address, unsigned short value) - { - /** Select register window **/ - a3c90x_internal_SetWindow(ioaddr, winEepromBios0); - - /** Verify Eeprom not busy **/ - while((1<<15) & inw(ioaddr + regEepromCommand_0_w)); - - /** Issue WriteEnable, and wait for completion. **/ - outw(0x30, ioaddr + regEepromCommand_0_w); - while((1<<15) & inw(ioaddr + regEepromCommand_0_w)); - - /** Issue EraseRegister, and wait for completion. **/ - outw(address + ((0x03)<<6), ioaddr + regEepromCommand_0_w); - while((1<<15) & inw(ioaddr + regEepromCommand_0_w)); - - /** Send the new data to the eeprom, and wait for completion. **/ - outw(value, ioaddr + regEepromData_0_w); - outw(0x30, ioaddr + regEepromCommand_0_w); - while((1<<15) & inw(ioaddr + regEepromCommand_0_w)); - - /** Burn the new data into the eeprom, and wait for completion. **/ - outw(address + ((0x01)<<6), ioaddr + regEepromCommand_0_w); - while((1<<15) & inw(ioaddr + regEepromCommand_0_w)); - - return 0; - } -#endif - -#if 0 -/*** a3c90x_internal_WriteEeprom - write data to the serial eeprom, - *** and re-compute the eeprom checksum. - ***/ -static int -a3c90x_internal_WriteEeprom(int ioaddr, int address, unsigned short value) - { - int cksum = 0,v; - int i; - int maxAddress, cksumAddress; - - if (INF_3C90X.isBrev) - { - maxAddress=0x1f; - cksumAddress=0x20; - } - else - { - maxAddress=0x16; - cksumAddress=0x17; - } - - /** Write the value. **/ - if (a3c90x_internal_WriteEepromWord(ioaddr, address, value) == -1) - return -1; - - /** Recompute the checksum. **/ - for(i=0;i<=maxAddress;i++) - { - v = a3c90x_internal_ReadEeprom(ioaddr, i); - cksum ^= (v & 0xFF); - cksum ^= ((v>>8) & 0xFF); - } - /** Write the checksum to the location in the eeprom **/ - if (a3c90x_internal_WriteEepromWord(ioaddr, cksumAddress, cksum) == -1) - return -1; - - return 0; - } -#endif - -/*** a3c90x_reset: exported function that resets the card to its default - *** state. This is so the Linux driver can re-set the card up the way - *** it wants to. If CFG_3C90X_PRESERVE_XCVR is defined, then the reset will - *** not alter the selected transceiver that we used to download the boot - *** image. - ***/ -static void a3c90x_reset(void) - { -#ifdef CFG_3C90X_PRESERVE_XCVR - int cfg; - /** Read the current InternalConfig value. **/ - a3c90x_internal_SetWindow(INF_3C90X.IOAddr, winTxRxOptions3); - cfg = inl(INF_3C90X.IOAddr + regInternalConfig_3_l); -#endif - - /** Send the reset command to the card **/ - printf("Issuing RESET:\n"); - a3c90x_internal_IssueCommand(INF_3C90X.IOAddr, cmdGlobalReset, 0); - - /** wait for reset command to complete **/ - while (inw(INF_3C90X.IOAddr + regCommandIntStatus_w) & INT_CMDINPROGRESS); - - /** global reset command resets station mask, non-B revision cards - ** require explicit reset of values - **/ - a3c90x_internal_SetWindow(INF_3C90X.IOAddr, winAddressing2); - outw(0, INF_3C90X.IOAddr + regStationMask_2_3w+0); - outw(0, INF_3C90X.IOAddr + regStationMask_2_3w+2); - outw(0, INF_3C90X.IOAddr + regStationMask_2_3w+4); - -#ifdef CFG_3C90X_PRESERVE_XCVR - /** Re-set the original InternalConfig value from before reset **/ - a3c90x_internal_SetWindow(INF_3C90X.IOAddr, winTxRxOptions3); - outl(cfg, INF_3C90X.IOAddr + regInternalConfig_3_l); - - /** enable DC converter for 10-Base-T **/ - if ((cfg&0x0300) == 0x0300) - { - a3c90x_internal_IssueCommand(INF_3C90X.IOAddr, cmdEnableDcConverter, 0); - } -#endif - - /** Issue transmit reset, wait for command completion **/ - a3c90x_internal_IssueCommand(INF_3C90X.IOAddr, cmdTxReset, 0); - while (inw(INF_3C90X.IOAddr + regCommandIntStatus_w) & INT_CMDINPROGRESS) - ; - if (! INF_3C90X.isBrev) - outb(0x01, INF_3C90X.IOAddr + regTxFreeThresh_b); - a3c90x_internal_IssueCommand(INF_3C90X.IOAddr, cmdTxEnable, 0); - - /** - ** reset of the receiver on B-revision cards re-negotiates the link - ** takes several seconds (a computer eternity) - **/ - if (INF_3C90X.isBrev) - a3c90x_internal_IssueCommand(INF_3C90X.IOAddr, cmdRxReset, 0x04); - else - a3c90x_internal_IssueCommand(INF_3C90X.IOAddr, cmdRxReset, 0x00); - while (inw(INF_3C90X.IOAddr + regCommandIntStatus_w) & INT_CMDINPROGRESS); - ; - a3c90x_internal_IssueCommand(INF_3C90X.IOAddr, cmdRxEnable, 0); - - a3c90x_internal_IssueCommand(INF_3C90X.IOAddr, - cmdSetInterruptEnable, 0); - /** enable rxComplete and txComplete **/ - a3c90x_internal_IssueCommand(INF_3C90X.IOAddr, - cmdSetIndicationEnable, 0x0014); - /** acknowledge any pending status flags **/ - a3c90x_internal_IssueCommand(INF_3C90X.IOAddr, - cmdAcknowledgeInterrupt, 0x661); - - return; - } - - - -/*** a3c90x_transmit: exported function that transmits a packet. Does not - *** return any particular status. Parameters are: - *** d[6] - destination address, ethernet; - *** t - protocol type (ARP, IP, etc); - *** s - size of the non-header part of the packet that needs transmitted; - *** p - the pointer to the packet data itself. - ***/ -static void -a3c90x_transmit(struct nic *nic __unused, const char *d, unsigned int t, - unsigned int s, const char *p) - { - - struct eth_hdr - { - unsigned char dst_addr[ETH_ALEN]; - unsigned char src_addr[ETH_ALEN]; - unsigned short type; - } hdr; - - unsigned char status; - unsigned i, retries; - - for (retries=0; retries < XMIT_RETRIES ; retries++) - { - /** Stall the download engine **/ - a3c90x_internal_IssueCommand(INF_3C90X.IOAddr, cmdStallCtl, 2); - - /** Make sure the card is not waiting on us **/ - inw(INF_3C90X.IOAddr + regCommandIntStatus_w); - inw(INF_3C90X.IOAddr + regCommandIntStatus_w); - - while (inw(INF_3C90X.IOAddr+regCommandIntStatus_w) & - INT_CMDINPROGRESS) - ; - - /** Set the ethernet packet type **/ - hdr.type = htons(t); - - /** Copy the destination address **/ - memcpy(hdr.dst_addr, d, ETH_ALEN); - - /** Copy our MAC address **/ - memcpy(hdr.src_addr, INF_3C90X.HWAddr, ETH_ALEN); - - /** Setup the DPD (download descriptor) **/ - INF_3C90X.TransmitDPD.DnNextPtr = 0; - /** set notification for transmission completion (bit 15) **/ - INF_3C90X.TransmitDPD.FrameStartHeader = (s + sizeof(hdr)) | 0x8000; - INF_3C90X.TransmitDPD.HdrAddr = virt_to_bus(&hdr); - INF_3C90X.TransmitDPD.HdrLength = sizeof(hdr); - INF_3C90X.TransmitDPD.DataAddr = virt_to_bus(p); - INF_3C90X.TransmitDPD.DataLength = s + (1<<31); - - /** Send the packet **/ - outl(virt_to_bus(&(INF_3C90X.TransmitDPD)), - INF_3C90X.IOAddr + regDnListPtr_l); - - /** End Stall and Wait for upload to complete. **/ - a3c90x_internal_IssueCommand(INF_3C90X.IOAddr, cmdStallCtl, 3); - while(inl(INF_3C90X.IOAddr + regDnListPtr_l) != 0) - ; - - /** Wait for NIC Transmit to Complete **/ - load_timer2(10*TICKS_PER_MS); /* Give it 10 ms */ - while (!(inw(INF_3C90X.IOAddr + regCommandIntStatus_w)&0x0004) && - timer2_running()) - ; - - if (!(inw(INF_3C90X.IOAddr + regCommandIntStatus_w)&0x0004)) - { - printf("3C90X: Tx Timeout\n"); - continue; - } - - status = inb(INF_3C90X.IOAddr + regTxStatus_b); - - /** acknowledge transmit interrupt by writing status **/ - outb(0x00, INF_3C90X.IOAddr + regTxStatus_b); - - /** successful completion (sans "interrupt Requested" bit) **/ - if ((status & 0xbf) == 0x80) - return; - - printf("3C90X: Status (%hhX)\n", status); - /** check error codes **/ - if (status & 0x02) - { - printf("3C90X: Tx Reclaim Error (%hhX)\n", status); - a3c90x_reset(); - } - else if (status & 0x04) - { - printf("3C90X: Tx Status Overflow (%hhX)\n", status); - for (i=0; i<32; i++) - outb(0x00, INF_3C90X.IOAddr + regTxStatus_b); - /** must re-enable after max collisions before re-issuing tx **/ - a3c90x_internal_IssueCommand(INF_3C90X.IOAddr, cmdTxEnable, 0); - } - else if (status & 0x08) - { - printf("3C90X: Tx Max Collisions (%hhX)\n", status); - /** must re-enable after max collisions before re-issuing tx **/ - a3c90x_internal_IssueCommand(INF_3C90X.IOAddr, cmdTxEnable, 0); - } - else if (status & 0x10) - { - printf("3C90X: Tx Underrun (%hhX)\n", status); - a3c90x_reset(); - } - else if (status & 0x20) - { - printf("3C90X: Tx Jabber (%hhX)\n", status); - a3c90x_reset(); - } - else if ((status & 0x80) != 0x80) - { - printf("3C90X: Internal Error - Incomplete Transmission (%hhX)\n", - status); - a3c90x_reset(); - } - } - - /** failed after RETRY attempts **/ - printf("Failed to send after %d retries\n", retries); - return; - - } - - - -/*** a3c90x_poll: exported routine that waits for a certain length of time - *** for a packet, and if it sees none, returns 0. This routine should - *** copy the packet to nic->packet if it gets a packet and set the size - *** in nic->packetlen. Return 1 if a packet was found. - ***/ -static int -a3c90x_poll(struct nic *nic, int retrieve) - { - int i, errcode; - - if (!(inw(INF_3C90X.IOAddr + regCommandIntStatus_w)&0x0010)) - { - return 0; - } - - if ( ! retrieve ) return 1; - - /** we don't need to acknowledge rxComplete -- the upload engine - ** does it for us. - **/ - - /** Build the up-load descriptor **/ - INF_3C90X.ReceiveUPD.UpNextPtr = 0; - INF_3C90X.ReceiveUPD.UpPktStatus = 0; - INF_3C90X.ReceiveUPD.DataAddr = virt_to_bus(nic->packet); - INF_3C90X.ReceiveUPD.DataLength = 1536 + (1<<31); - - /** Submit the upload descriptor to the NIC **/ - outl(virt_to_bus(&(INF_3C90X.ReceiveUPD)), - INF_3C90X.IOAddr + regUpListPtr_l); - - /** Wait for upload completion (upComplete(15) or upError (14)) **/ - for(i=0;i<40000;i++); - while((INF_3C90X.ReceiveUPD.UpPktStatus & ((1<<14) | (1<<15))) == 0) - for(i=0;i<40000;i++); - - /** Check for Error (else we have good packet) **/ - if (INF_3C90X.ReceiveUPD.UpPktStatus & (1<<14)) - { - errcode = INF_3C90X.ReceiveUPD.UpPktStatus; - if (errcode & (1<<16)) - printf("3C90X: Rx Overrun (%hX)\n",errcode>>16); - else if (errcode & (1<<17)) - printf("3C90X: Runt Frame (%hX)\n",errcode>>16); - else if (errcode & (1<<18)) - printf("3C90X: Alignment Error (%hX)\n",errcode>>16); - else if (errcode & (1<<19)) - printf("3C90X: CRC Error (%hX)\n",errcode>>16); - else if (errcode & (1<<20)) - printf("3C90X: Oversized Frame (%hX)\n",errcode>>16); - else - printf("3C90X: Packet error (%hX)\n",errcode>>16); - return 0; - } - - /** Ok, got packet. Set length in nic->packetlen. **/ - nic->packetlen = (INF_3C90X.ReceiveUPD.UpPktStatus & 0x1FFF); - - return 1; - } - - - -/*** a3c90x_disable: exported routine to disable the card. What's this for? - *** the eepro100.c driver didn't have one, so I just left this one empty too. - *** Ideas anyone? - *** Must turn off receiver at least so stray packets will not corrupt memory - *** [Ken] - ***/ -static void -a3c90x_disable(struct dev *dev __unused) -{ - /* reset and disable merge */ - a3c90x_reset(); - /* Disable the receiver and transmitter. */ - outw(cmdRxDisable, INF_3C90X.IOAddr + regCommandIntStatus_w); - outw(cmdTxDisable, INF_3C90X.IOAddr + regCommandIntStatus_w); -} - -static void a3c90x_irq(struct nic *nic __unused, irq_action_t action __unused) -{ - switch ( action ) { - case DISABLE : - break; - case ENABLE : - break; - case FORCE : - break; - } -} - -/*** a3c90x_probe: exported routine to probe for the 3c905 card and perform - *** initialization. If this routine is called, the pci functions did find the - *** card. We just have to init it here. - ***/ -static int a3c90x_probe(struct dev *dev, struct pci_device *pci) -{ - struct nic *nic = (struct nic *)dev; - int i, c; - unsigned short eeprom[0x21]; - unsigned int cfg; - unsigned int mopt; - unsigned int mstat; - unsigned short linktype; -#define HWADDR_OFFSET 10 - - if (pci->ioaddr == 0) - return 0; - - adjust_pci_device(pci); - - nic->ioaddr = pci->ioaddr & ~3; - nic->irqno = 0; - - INF_3C90X.IOAddr = pci->ioaddr & ~3; - INF_3C90X.CurrentWindow = 255; - switch (a3c90x_internal_ReadEeprom(INF_3C90X.IOAddr, 0x03)) - { - case 0x9000: /** 10 Base TPO **/ - case 0x9001: /** 10/100 T4 **/ - case 0x9050: /** 10/100 TPO **/ - case 0x9051: /** 10 Base Combo **/ - INF_3C90X.isBrev = 0; - break; - - case 0x9004: /** 10 Base TPO **/ - case 0x9005: /** 10 Base Combo **/ - case 0x9006: /** 10 Base TPO and Base2 **/ - case 0x900A: /** 10 Base FL **/ - case 0x9055: /** 10/100 TPO **/ - case 0x9056: /** 10/100 T4 **/ - case 0x905A: /** 10 Base FX **/ - default: - INF_3C90X.isBrev = 1; - break; - } - - /** Load the EEPROM contents **/ - if (INF_3C90X.isBrev) - { - for(i=0;i<=0x20;i++) - { - eeprom[i] = a3c90x_internal_ReadEeprom(INF_3C90X.IOAddr, i); - } - -#ifdef CFG_3C90X_BOOTROM_FIX - /** Set xcvrSelect in InternalConfig in eeprom. **/ - /* only necessary for 3c905b revision cards with boot PROM bug!!! */ - a3c90x_internal_WriteEeprom(INF_3C90X.IOAddr, 0x13, 0x0160); -#endif - -#ifdef CFG_3C90X_XCVR - if (CFG_3C90X_XCVR == 255) - { - /** Clear the LanWorks register **/ - a3c90x_internal_WriteEeprom(INF_3C90X.IOAddr, 0x16, 0); - } - else - { - /** Set the selected permanent-xcvrSelect in the - ** LanWorks register - **/ - a3c90x_internal_WriteEeprom(INF_3C90X.IOAddr, 0x16, - XCVR_MAGIC + ((CFG_3C90X_XCVR) & 0x000F)); - } -#endif - } - else - { - for(i=0;i<=0x17;i++) - { - eeprom[i] = a3c90x_internal_ReadEeprom(INF_3C90X.IOAddr, i); - } - } - - /** Print identification message **/ - printf("\n\n3C90X Driver 2.00 " - "Copyright 1999 LightSys Technology Services, Inc.\n" - "Portions Copyright 1999 Steve Smith\n"); - printf("Provided with ABSOLUTELY NO WARRANTY.\n"); -#ifdef CFG_3C90X_BOOTROM_FIX - if (INF_3C90X.isBrev) - { - printf("NOTE: 3c905b bootrom fix enabled; has side " - "effects. See 3c90x.txt for info.\n"); - } -#endif - printf("-------------------------------------------------------" - "------------------------\n"); - - /** Retrieve the Hardware address and print it on the screen. **/ - INF_3C90X.HWAddr[0] = eeprom[HWADDR_OFFSET + 0]>>8; - INF_3C90X.HWAddr[1] = eeprom[HWADDR_OFFSET + 0]&0xFF; - INF_3C90X.HWAddr[2] = eeprom[HWADDR_OFFSET + 1]>>8; - INF_3C90X.HWAddr[3] = eeprom[HWADDR_OFFSET + 1]&0xFF; - INF_3C90X.HWAddr[4] = eeprom[HWADDR_OFFSET + 2]>>8; - INF_3C90X.HWAddr[5] = eeprom[HWADDR_OFFSET + 2]&0xFF; - printf("MAC Address = %!\n", INF_3C90X.HWAddr); - - /* Test if the link is good, if not continue */ - a3c90x_internal_SetWindow(INF_3C90X.IOAddr, winDiagnostics4); - mstat = inw(INF_3C90X.IOAddr + regMediaStatus_4_w); - if((mstat & (1<<11)) == 0) { - printf("Valid link not established\n"); - return 0; - } - - /** Program the MAC address into the station address registers **/ - a3c90x_internal_SetWindow(INF_3C90X.IOAddr, winAddressing2); - outw(htons(eeprom[HWADDR_OFFSET + 0]), INF_3C90X.IOAddr + regStationAddress_2_3w); - outw(htons(eeprom[HWADDR_OFFSET + 1]), INF_3C90X.IOAddr + regStationAddress_2_3w+2); - outw(htons(eeprom[HWADDR_OFFSET + 2]), INF_3C90X.IOAddr + regStationAddress_2_3w+4); - outw(0, INF_3C90X.IOAddr + regStationMask_2_3w+0); - outw(0, INF_3C90X.IOAddr + regStationMask_2_3w+2); - outw(0, INF_3C90X.IOAddr + regStationMask_2_3w+4); - - /** Fill in our entry in the etherboot arp table **/ - for(i=0;inode_addr[i] = (eeprom[HWADDR_OFFSET + i/2] >> (8*((i&1)^1))) & 0xff; - - /** Read the media options register, print a message and set default - ** xcvr. - ** - ** Uses Media Option command on B revision, Reset Option on non-B - ** revision cards -- same register address - **/ - a3c90x_internal_SetWindow(INF_3C90X.IOAddr, winTxRxOptions3); - mopt = inw(INF_3C90X.IOAddr + regResetMediaOptions_3_w); - - /** mask out VCO bit that is defined as 10baseFL bit on B-rev cards **/ - if (! INF_3C90X.isBrev) - { - mopt &= 0x7F; - } - - printf("Connectors present: "); - c = 0; - linktype = 0x0008; - if (mopt & 0x01) - { - printf("%s100Base-T4",(c++)?", ":""); - linktype = 0x0006; - } - if (mopt & 0x04) - { - printf("%s100Base-FX",(c++)?", ":""); - linktype = 0x0005; - } - if (mopt & 0x10) - { - printf("%s10Base-2",(c++)?", ":""); - linktype = 0x0003; - } - if (mopt & 0x20) - { - printf("%sAUI",(c++)?", ":""); - linktype = 0x0001; - } - if (mopt & 0x40) - { - printf("%sMII",(c++)?", ":""); - linktype = 0x0006; - } - if ((mopt & 0xA) == 0xA) - { - printf("%s10Base-T / 100Base-TX",(c++)?", ":""); - linktype = 0x0008; - } - else if ((mopt & 0xA) == 0x2) - { - printf("%s100Base-TX",(c++)?", ":""); - linktype = 0x0008; - } - else if ((mopt & 0xA) == 0x8) - { - printf("%s10Base-T",(c++)?", ":""); - linktype = 0x0008; - } - printf(".\n"); - - /** Determine transceiver type to use, depending on value stored in - ** eeprom 0x16 - **/ - if (INF_3C90X.isBrev) - { - if ((eeprom[0x16] & 0xFF00) == XCVR_MAGIC) - { - /** User-defined **/ - linktype = eeprom[0x16] & 0x000F; - } - } - else - { -#ifdef CFG_3C90X_XCVR - if (CFG_3C90X_XCVR != 255) - linktype = CFG_3C90X_XCVR; -#endif /* CFG_3C90X_XCVR */ - - /** I don't know what MII MAC only mode is!!! **/ - if (linktype == 0x0009) - { - if (INF_3C90X.isBrev) - printf("WARNING: MII External MAC Mode only supported on B-revision " - "cards!!!!\nFalling Back to MII Mode\n"); - linktype = 0x0006; - } - } - - /** enable DC converter for 10-Base-T **/ - if (linktype == 0x0003) - { - a3c90x_internal_IssueCommand(INF_3C90X.IOAddr, cmdEnableDcConverter, 0); - } - - /** Set the link to the type we just determined. **/ - a3c90x_internal_SetWindow(INF_3C90X.IOAddr, winTxRxOptions3); - cfg = inl(INF_3C90X.IOAddr + regInternalConfig_3_l); - cfg &= ~(0xF<<20); - cfg |= (linktype<<20); - outl(cfg, INF_3C90X.IOAddr + regInternalConfig_3_l); - - /** Now that we set the xcvr type, reset the Tx and Rx, re-enable. **/ - a3c90x_internal_IssueCommand(INF_3C90X.IOAddr, cmdTxReset, 0x00); - while (inw(INF_3C90X.IOAddr + regCommandIntStatus_w) & INT_CMDINPROGRESS) - ; - - if (!INF_3C90X.isBrev) - outb(0x01, INF_3C90X.IOAddr + regTxFreeThresh_b); - - a3c90x_internal_IssueCommand(INF_3C90X.IOAddr, cmdTxEnable, 0); - - /** - ** reset of the receiver on B-revision cards re-negotiates the link - ** takes several seconds (a computer eternity) - **/ - if (INF_3C90X.isBrev) - a3c90x_internal_IssueCommand(INF_3C90X.IOAddr, cmdRxReset, 0x04); - else - a3c90x_internal_IssueCommand(INF_3C90X.IOAddr, cmdRxReset, 0x00); - while (inw(INF_3C90X.IOAddr + regCommandIntStatus_w) & INT_CMDINPROGRESS) - ; - - /** Set the RX filter = receive only individual pkts & multicast & bcast. **/ - a3c90x_internal_IssueCommand(INF_3C90X.IOAddr, cmdSetRxFilter, 0x01 + 0x02 + 0x04); - a3c90x_internal_IssueCommand(INF_3C90X.IOAddr, cmdRxEnable, 0); - - - /** - ** set Indication and Interrupt flags , acknowledge any IRQ's - **/ - a3c90x_internal_IssueCommand(INF_3C90X.IOAddr, cmdSetInterruptEnable, 0); - a3c90x_internal_IssueCommand(INF_3C90X.IOAddr, - cmdSetIndicationEnable, 0x0014); - a3c90x_internal_IssueCommand(INF_3C90X.IOAddr, - cmdAcknowledgeInterrupt, 0x661); - - /** Set our exported functions **/ - dev->disable = a3c90x_disable; - nic->poll = a3c90x_poll; - nic->transmit = a3c90x_transmit; - nic->irq = a3c90x_irq; - - return 1; -} - - -static struct pci_id a3c90x_nics[] = { -/* Original 90x revisions: */ -PCI_ROM(0x10b7, 0x9000, "3c905-tpo", "3Com900-TPO"), /* 10 Base TPO */ -PCI_ROM(0x10b7, 0x9001, "3c905-t4", "3Com900-Combo"), /* 10/100 T4 */ -PCI_ROM(0x10b7, 0x9050, "3c905-tpo100", "3Com905-TX"), /* 100 Base TX / 10/100 TPO */ -PCI_ROM(0x10b7, 0x9051, "3c905-combo", "3Com905-T4"), /* 100 Base T4 / 10 Base Combo */ -/* Newer 90xB revisions: */ -PCI_ROM(0x10b7, 0x9004, "3c905b-tpo", "3Com900B-TPO"), /* 10 Base TPO */ -PCI_ROM(0x10b7, 0x9005, "3c905b-combo", "3Com900B-Combo"), /* 10 Base Combo */ -PCI_ROM(0x10b7, 0x9006, "3c905b-tpb2", "3Com900B-2/T"), /* 10 Base TP and Base2 */ -PCI_ROM(0x10b7, 0x900a, "3c905b-fl", "3Com900B-FL"), /* 10 Base FL */ -PCI_ROM(0x10b7, 0x9055, "3c905b-tpo100", "3Com905B-TX"), /* 10/100 TPO */ -PCI_ROM(0x10b7, 0x9056, "3c905b-t4", "3Com905B-T4"), /* 10/100 T4 */ -PCI_ROM(0x10b7, 0x9058, "3c905b-9058", "3Com905B-9058"), /* Cyclone 10/100/BNC */ -PCI_ROM(0x10b7, 0x905a, "3c905b-fx", "3Com905B-FL"), /* 100 Base FX / 10 Base FX */ -/* Newer 90xC revision: */ -PCI_ROM(0x10b7, 0x9200, "3c905c-tpo", "3Com905C-TXM"), /* 10/100 TPO (3C905C-TXM) */ -PCI_ROM(0x10b7, 0x9210, "3c920b-emb-wnm","3Com20B-EMB WNM"), -PCI_ROM(0x10b7, 0x9800, "3c980", "3Com980-Cyclone"), /* Cyclone */ -PCI_ROM(0x10b7, 0x9805, "3c9805", "3Com9805"), /* Dual Port Server Cyclone */ -PCI_ROM(0x10b7, 0x7646, "3csoho100-tx", "3CSOHO100-TX"), /* Hurricane */ -PCI_ROM(0x10b7, 0x4500, "3c450", "3Com450 HomePNA Tornado"), -PCI_ROM(0x10b7, 0x1201, "3c982a", "3Com982A"), -PCI_ROM(0x10b7, 0x1202, "3c982b", "3Com982B"), -}; - -struct pci_driver a3c90x_driver = { - .type = NIC_DRIVER, - .name = "3C90X", - .probe = a3c90x_probe, - .ids = a3c90x_nics, - .id_count = sizeof(a3c90x_nics)/sizeof(a3c90x_nics[0]), - .class = 0, -}; diff --git a/usr/src/grub/grub-0.95/netboot/Makefile.am b/usr/src/grub/grub-0.95/netboot/Makefile.am deleted file mode 100644 index 938443f818..0000000000 --- a/usr/src/grub/grub-0.95/netboot/Makefile.am +++ /dev/null @@ -1,287 +0,0 @@ -# For and . -INCLUDES = -I$(top_srcdir)/stage2 -I$(top_srcdir)/stage1 - -# Don't build the netboot support by default. -if NETBOOT_SUPPORT -LIBDRIVERS = libdrivers.a -else -LIBDRIVERS = -endif - -noinst_LIBRARIES = $(LIBDRIVERS) - -libdrivers_a_SOURCES = big_bswap.h bootp.h byteswap.h config.c cpu.h \ - dev.h elf.h endian.h etherboot.h fsys_tftp.c grub.h \ - i386_byteswap.h i386_elf.h i386_endian.h i386_timer.c \ - if_arp.h if_ether.h igmp.h in.h io.h ip.h isa.h latch.h \ - little_bswap.h misc.c nic.c nic.h osdep.h pci.c pci.h \ - pci_ids.h pci_io.c stdint.h tftp.h timer.c timer.h \ - types.h udp.h mii.h pic8259.c pic8259.h pxe.h basemem.c segoff.h -EXTRA_libdrivers_a_SOURCES = 3c595.c 3c595.h 3c90x.c davicom.c \ - e1000.c e1000_hw.h eepro100.c epic100.c epic100.h natsemi.c \ - ns8390.c ns8390.h pcnet32.c rtl8139.c sis900.c sis900.h \ - sundance.c tg3.c tg3.h tlan.c tlan.h tulip.c via-rhine.c \ - w89c840.c r8169.c forcedeth.c ns83820.c pnic.c pnic_api.c \ - undi.c undi.h -libdrivers_a_CFLAGS = $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ - -DFSYS_TFTP=1 $(NET_CFLAGS) $(NET_EXTRAFLAGS) -# Filled by configure. -libdrivers_a_LIBADD = @NETBOOT_DRIVERS@ -libdrivers_a_DEPENDENCIES = $(libdrivers_a_LIBADD) - -EXTRA_DIST = README.netboot - -# These below are several special rules for the device drivers. -# We cannot use a simple rule for them... - -# What objects are derived from a driver? -#3c509_drivers = 3c509.o 3c529.o -3c595_drivers = 3c595.o -3c90x_drivers = 3c90x.o -#cs89x0_drivers = cs89x0.o -davicom_drivers = davicom.o -#depca_drivers = depca.o -#eepro_drivers = eepro.o -e1000_drivers = e1000.o -eepro100_drivers = eepro100.o -epic100_drivers = epic100.o -#fa311_drivers = fa311.o -forcedeth_drivers = forcedeth.o -#i82586_drivers = 3c507.o exos205.o ni5210.o -#lance_drivers = lance.o ne2100.o ni6510.o -natsemi_drivers = natsemi.o -#ni5010_drivers = ni5010.o -ns83820_drivers = ns83820.o -ns8390_drivers = 3c503.o ne.o ns8390.o wd.o -#otulip_drivers = otulip.o -pcnet32_drivers = pcnet32.o -pnic_drivers = pnic.o -r8169_drivers = r8169.o -rtl8139_drivers = rtl8139.o -sis900_drivers = sis900.o -#sk_g16_drivers = sk_g16.o -sundance_drivers = sundance.o -#smc9000_drivers = smc9000.o -tg3_drivers = tg3.o -#tiara_drivers = tiara.o -tlan_drivers = tlan.o -tulip_drivers = tulip.o -undi_drivers = undi.o -via_rhine_drivers = via_rhine.o -w89c840_drivers = w89c840.o - - -# Is it really necessary to specify dependecies explicitly? -#$(3c509_drivers): 3c509.c 3c509.h -#$(3c509_drivers): %.o: 3c509.c -# $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ -# $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< - -$(3c595_drivers): 3c595.c 3c595.h -$(3c595_drivers): %.o: 3c595.c - $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ - $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< - -$(3c90x_drivers): 3c90x.c -$(3c90x_drivers): %.o: 3c90x.c - $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ - $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< - -#$(cs89x0_drivers): cs89x0.c cs89x0.h -#$(cs89x0_drivers): %.o: cs89x0.c -# $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ -# $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< - -$(davicom_drivers): davicom.c -$(davicom_drivers): %.o: davicom.c - $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ - $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< - -#$(depca_drivers): depca.c -#$(depca_drivers): %.o: depca.c -# $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ -# $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< - -#$(eepro_drivers): eepro.c -#$(eepro_drivers): %.o: eepro.c -# $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ -# $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< - -$(e1000_drivers): e1000.c e1000_hw.h -$(e1000_drivers): %.o: e1000.c - $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ - $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< - -$(eepro100_drivers): eepro100.c -$(eepro100_drivers): %.o: eepro100.c - $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ - $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< - -$(epic100_drivers): epic100.c epic100.h -$(epic100_drivers): %.o: epic100.c - $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ - $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< - -$(forcedeth_drivers): forcedeth.c -$(forcedeth_drivers): %.o: forcedeth.c - $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ - $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< - -#$(fa311_drivers): fa311.c -#$(fa311_drivers): %.o: fa311.c -# $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ -# $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< - -#$(i82586_drivers): i82586.c -#$(i82586_drivers): %.o: i82586.c -# $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ -# $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< - -#$(lance_drivers): lance.c -#$(lance_drivers): %.o: lance.c -# $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ -# $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< - -$(natsemi_drivers): natsemi.c -$(natsemi_drivers): %.o: natsemi.c - $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ - $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< - -#$(ni5010_drivers): ni5010.c -#$(ni5010_drivers): %.o: ni5010.c -# $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ -# $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< - -$(ns83820_drivers): ns83820.c -$(ns83820_drivers): %.o: ns83820.c - $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ - $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< - -$(ns8390_drivers): ns8390.c ns8390.h -$(ns8390_drivers): %.o: ns8390.c - $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ - $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< - -#$(otulip_drivers): otulip.c otulip.h -#$(otulip_drivers): %.o: otulip.c -# $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ -# $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< - -$(pcnet32_drivers): pcnet32.c -$(pcnet32_drivers): %.o: pcnet32.c - $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ - $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< - -$(pnic_drivers): pnic.c -$(pnic_drivers): %.o: pnic.c pnic_api.h - $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ - $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< - -$(rtl8139_drivers): rtl8139.c -$(rtl8139_drivers): %.o: rtl8139.c - $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ - $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< - -$(r8169_drivers): r8169.c -$(r8169_drivers): %.o: r8169.c - $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ - $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< - -$(sis900_drivers): sis900.c sis900.h -$(sis900_drivers): %.o: sis900.c - $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ - $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< - -#$(sk_g16_drivers): sk_g16.c sk_g16.h -#$(sk_g16_drivers): %.o: sk_g16.c -# $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ -# $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< - -#$(smc9000_drivers): smc9000.c smc9000.h -#$(smc9000_drivers): %.o: smc9000.c -# $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ -# $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< - -$(sundance_drivers): sundance.c -$(sundance_drivers): %.o: sundance.c - $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ - $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< - -$(tg3_drivers): tg3.c tg3.h -$(tg3_drivers): %.o: tg3.c - $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ - $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< - -#$(tiara_drivers): tiara.c -#$(tiara_drivers): %.o: tiara.c -# $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ -# $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< - -$(tlan_drivers): tlan.c tlan.h -$(tlan_drivers): %.o: tlan.c - $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ - $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< - -$(tulip_drivers): tulip.c -$(tulip_drivers): %.o: tulip.c - $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ - $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< - -$(undi_drivers): undi.c undi.h -$(undi_drivers): %.o: undi.c - $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ - $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< - -$(via_rhine_drivers): via-rhine.c -$(via_rhine_drivers): %.o: via-rhine.c - $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ - $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< - -$(w89c840_drivers): w89c840.c -$(w89c840_drivers): %.o: w89c840.c - $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ - $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< - -# Per-object flags. -#3c509_o_CFLAGS = -DINCLUDE_3C509=1 -#3c529_o_CFLAGS = -DINCLUDE_3C529=1 -3c595_o_CFLAGS = -DINCLUDE_3C595=1 -3c90x_o_CFLAGS = -DINCLUDE_3C90X=1 -#cs89x0_o_CFLAGS = -DINCLUDE_CS89X0=1 -davicom_o_CFLAGS = -DINCLUDE_DAVICOM=1 -#depca_o_CFLAGS = -DINCLUDE_DEPCA=1 -#eepro_o_CFLAGS = -DINCLUDE_EEPRO=1 -e1000_o_CFLAGS = -DINCLUDE_E1000=1 -eepro100_o_CFLAGS = -DINCLUDE_EEPRO100=1 -epic100_o_CFLAGS = -DINCLUDE_EPIC100=1 -#fa311_o_CFLAGS = -DINCLUDE_FA311=1 -forcedeth_o_CFLAGS = -DINCLUDE_FORCEDETH=1 -#3c507_o_CFLAGS = -DINCLUDE_3C507=1 -#exos205_o_CFLAGS = -DINCLUDE_EXOS205=1 -#ni5210_o_CFLAGS = -DINCLUDE_NI5210=1 -#lance_o_CFLAGS = -DINCLUDE_LANCE=1 -#ne2100_o_CFLAGS = -DINCLUDE_NE2100=1 -#ni6510_o_CFLAGS = -DINCLUDE_NI6510=1 -natsemi_o_CFLAGS = -DINCLUDE_NATSEMI=1 -#ni5010_o_CFLAGS = -DINCLUDE_NI5010=1 -#3c503_o_CFLAGS = -DINCLUDE_3C503=1 -#ne_o_CFLAGS = -DINCLUDE_NE=1 -ns83820_o_CFLAGS = -DINCLUDE_NS83820=1 -ns8390_o_CFLAGS = -DINCLUDE_NS8390=1 -#wd_o_CFLAGS = -DINCLUDE_WD=1 -#otulip_o_CFLAGS = -DINCLUDE_OTULIP=1 -pcnet32_o_CFLAGS = -DINCLUDE_PCNET32=1 -pnic_o_CFLAGS = -DINCLUDE_PNIC=1 -r8169_o_CFLAGS = -DINCLUDE_R8169=1 -rtl8139_o_CFLAGS = -DINCLUDE_RTL8139=1 -sis900_o_CFLAGS = -DINCLUDE_SIS900=1 -#sk_g16_o_CFLAGS = -DINCLUDE_SK_G16=1 -#smc9000_o_CFLAGS = -DINCLUDE_SMC9000=1 -sundance_o_CFLAGS = -DINCLUDE_SUNDANCE=1 -#tiara_o_CFLAGS = -DINCLUDE_TIARA=1 -tg3_o_CFLAGS = -DINCLUDE_TG3=1 -tlan_o_CFLAGS = -DINCLUDE_TLAN=1 -tulip_o_CFLAGS = -DINCLUDE_TULIP=1 -undi_o_CFLAGS = -DINCLUDE_UNDI=1 -via_rhine_o_CFLAGS = -DINCLUDE_VIA_RHINE=1 -w89c840_o_CFLAGS = -DINCLUDE_W89C840=1 diff --git a/usr/src/grub/grub-0.95/netboot/Makefile.in b/usr/src/grub/grub-0.95/netboot/Makefile.in deleted file mode 100644 index 635c4c66fc..0000000000 --- a/usr/src/grub/grub-0.95/netboot/Makefile.in +++ /dev/null @@ -1,1288 +0,0 @@ -# Makefile.in generated by automake 1.8.5 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -SOURCES = $(libdrivers_a_SOURCES) $(EXTRA_libdrivers_a_SOURCES) - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = .. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -host_triplet = @host@ -subdir = netboot -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -LIBRARIES = $(noinst_LIBRARIES) -AR = ar -ARFLAGS = cru -libdrivers_a_AR = $(AR) $(ARFLAGS) -am_libdrivers_a_OBJECTS = libdrivers_a-config.$(OBJEXT) \ - libdrivers_a-fsys_tftp.$(OBJEXT) \ - libdrivers_a-i386_timer.$(OBJEXT) libdrivers_a-misc.$(OBJEXT) \ - libdrivers_a-nic.$(OBJEXT) libdrivers_a-pci.$(OBJEXT) \ - libdrivers_a-pci_io.$(OBJEXT) libdrivers_a-timer.$(OBJEXT) \ - libdrivers_a-pic8259.$(OBJEXT) libdrivers_a-basemem.$(OBJEXT) -libdrivers_a_OBJECTS = $(am_libdrivers_a_OBJECTS) -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/libdrivers_a-3c595.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/libdrivers_a-3c90x.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/libdrivers_a-basemem.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/libdrivers_a-config.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/libdrivers_a-davicom.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/libdrivers_a-e1000.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/libdrivers_a-eepro100.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/libdrivers_a-epic100.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/libdrivers_a-forcedeth.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/libdrivers_a-fsys_tftp.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/libdrivers_a-i386_timer.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/libdrivers_a-misc.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/libdrivers_a-natsemi.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/libdrivers_a-nic.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/libdrivers_a-ns83820.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/libdrivers_a-ns8390.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/libdrivers_a-pci.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/libdrivers_a-pci_io.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/libdrivers_a-pcnet32.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/libdrivers_a-pic8259.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/libdrivers_a-pnic.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/libdrivers_a-pnic_api.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/libdrivers_a-r8169.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/libdrivers_a-rtl8139.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/libdrivers_a-sis900.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/libdrivers_a-sundance.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/libdrivers_a-tg3.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/libdrivers_a-timer.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/libdrivers_a-tlan.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/libdrivers_a-tulip.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/libdrivers_a-undi.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/libdrivers_a-via-rhine.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/libdrivers_a-w89c840.Po -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(libdrivers_a_SOURCES) $(EXTRA_libdrivers_a_SOURCES) -DIST_SOURCES = $(libdrivers_a_SOURCES) $(EXTRA_libdrivers_a_SOURCES) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BUILD_EXAMPLE_KERNEL_FALSE = @BUILD_EXAMPLE_KERNEL_FALSE@ -BUILD_EXAMPLE_KERNEL_TRUE = @BUILD_EXAMPLE_KERNEL_TRUE@ -CC = @CC@ -CCAS = @CCAS@ -CCASFLAGS = @CCASFLAGS@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DISKLESS_SUPPORT_FALSE = @DISKLESS_SUPPORT_FALSE@ -DISKLESS_SUPPORT_TRUE = @DISKLESS_SUPPORT_TRUE@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FSYS_CFLAGS = @FSYS_CFLAGS@ -GRUB_CFLAGS = @GRUB_CFLAGS@ -GRUB_LIBS = @GRUB_LIBS@ -HERCULES_SUPPORT_FALSE = @HERCULES_SUPPORT_FALSE@ -HERCULES_SUPPORT_TRUE = @HERCULES_SUPPORT_TRUE@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LTLIBOBJS = @LTLIBOBJS@ -MAINT = @MAINT@ -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ -MAKEINFO = @MAKEINFO@ -NETBOOT_DRIVERS = @NETBOOT_DRIVERS@ -NETBOOT_SUPPORT_FALSE = @NETBOOT_SUPPORT_FALSE@ -NETBOOT_SUPPORT_TRUE = @NETBOOT_SUPPORT_TRUE@ -NET_CFLAGS = @NET_CFLAGS@ -NET_EXTRAFLAGS = @NET_EXTRAFLAGS@ -OBJCOPY = @OBJCOPY@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -RANLIB = @RANLIB@ -SERIAL_SPEED_SIMULATION_FALSE = @SERIAL_SPEED_SIMULATION_FALSE@ -SERIAL_SPEED_SIMULATION_TRUE = @SERIAL_SPEED_SIMULATION_TRUE@ -SERIAL_SUPPORT_FALSE = @SERIAL_SUPPORT_FALSE@ -SERIAL_SUPPORT_TRUE = @SERIAL_SUPPORT_TRUE@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STAGE1_CFLAGS = @STAGE1_CFLAGS@ -STAGE2_CFLAGS = @STAGE2_CFLAGS@ -STRIP = @STRIP@ -VERSION = @VERSION@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_OBJCOPY = @ac_ct_OBJCOPY@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ - -# For and . -INCLUDES = -I$(top_srcdir)/stage2 -I$(top_srcdir)/stage1 -@NETBOOT_SUPPORT_FALSE@LIBDRIVERS = - -# Don't build the netboot support by default. -@NETBOOT_SUPPORT_TRUE@LIBDRIVERS = libdrivers.a -noinst_LIBRARIES = $(LIBDRIVERS) -libdrivers_a_SOURCES = big_bswap.h bootp.h byteswap.h config.c cpu.h \ - dev.h elf.h endian.h etherboot.h fsys_tftp.c grub.h \ - i386_byteswap.h i386_elf.h i386_endian.h i386_timer.c \ - if_arp.h if_ether.h igmp.h in.h io.h ip.h isa.h latch.h \ - little_bswap.h misc.c nic.c nic.h osdep.h pci.c pci.h \ - pci_ids.h pci_io.c stdint.h tftp.h timer.c timer.h \ - types.h udp.h mii.h pic8259.c pic8259.h pxe.h basemem.c segoff.h - -EXTRA_libdrivers_a_SOURCES = 3c595.c 3c595.h 3c90x.c davicom.c \ - e1000.c e1000_hw.h eepro100.c epic100.c epic100.h natsemi.c \ - ns8390.c ns8390.h pcnet32.c rtl8139.c sis900.c sis900.h \ - sundance.c tg3.c tg3.h tlan.c tlan.h tulip.c via-rhine.c \ - w89c840.c r8169.c forcedeth.c ns83820.c pnic.c pnic_api.c \ - undi.c undi.h - -libdrivers_a_CFLAGS = $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ - -DFSYS_TFTP=1 $(NET_CFLAGS) $(NET_EXTRAFLAGS) - -# Filled by configure. -libdrivers_a_LIBADD = @NETBOOT_DRIVERS@ -libdrivers_a_DEPENDENCIES = $(libdrivers_a_LIBADD) -EXTRA_DIST = README.netboot - -# These below are several special rules for the device drivers. -# We cannot use a simple rule for them... - -# What objects are derived from a driver? -#3c509_drivers = 3c509.o 3c529.o -3c595_drivers = 3c595.o -3c90x_drivers = 3c90x.o -#cs89x0_drivers = cs89x0.o -davicom_drivers = davicom.o -#depca_drivers = depca.o -#eepro_drivers = eepro.o -e1000_drivers = e1000.o -eepro100_drivers = eepro100.o -epic100_drivers = epic100.o -#fa311_drivers = fa311.o -forcedeth_drivers = forcedeth.o -#i82586_drivers = 3c507.o exos205.o ni5210.o -#lance_drivers = lance.o ne2100.o ni6510.o -natsemi_drivers = natsemi.o -#ni5010_drivers = ni5010.o -ns83820_drivers = ns83820.o -ns8390_drivers = 3c503.o ne.o ns8390.o wd.o -#otulip_drivers = otulip.o -pcnet32_drivers = pcnet32.o -pnic_drivers = pnic.o -r8169_drivers = r8169.o -rtl8139_drivers = rtl8139.o -sis900_drivers = sis900.o -#sk_g16_drivers = sk_g16.o -sundance_drivers = sundance.o -#smc9000_drivers = smc9000.o -tg3_drivers = tg3.o -#tiara_drivers = tiara.o -tlan_drivers = tlan.o -tulip_drivers = tulip.o -undi_drivers = undi.o -via_rhine_drivers = via_rhine.o -w89c840_drivers = w89c840.o - -# Per-object flags. -#3c509_o_CFLAGS = -DINCLUDE_3C509=1 -#3c529_o_CFLAGS = -DINCLUDE_3C529=1 -3c595_o_CFLAGS = -DINCLUDE_3C595=1 -3c90x_o_CFLAGS = -DINCLUDE_3C90X=1 -#cs89x0_o_CFLAGS = -DINCLUDE_CS89X0=1 -davicom_o_CFLAGS = -DINCLUDE_DAVICOM=1 -#depca_o_CFLAGS = -DINCLUDE_DEPCA=1 -#eepro_o_CFLAGS = -DINCLUDE_EEPRO=1 -e1000_o_CFLAGS = -DINCLUDE_E1000=1 -eepro100_o_CFLAGS = -DINCLUDE_EEPRO100=1 -epic100_o_CFLAGS = -DINCLUDE_EPIC100=1 -#fa311_o_CFLAGS = -DINCLUDE_FA311=1 -forcedeth_o_CFLAGS = -DINCLUDE_FORCEDETH=1 -#3c507_o_CFLAGS = -DINCLUDE_3C507=1 -#exos205_o_CFLAGS = -DINCLUDE_EXOS205=1 -#ni5210_o_CFLAGS = -DINCLUDE_NI5210=1 -#lance_o_CFLAGS = -DINCLUDE_LANCE=1 -#ne2100_o_CFLAGS = -DINCLUDE_NE2100=1 -#ni6510_o_CFLAGS = -DINCLUDE_NI6510=1 -natsemi_o_CFLAGS = -DINCLUDE_NATSEMI=1 -#ni5010_o_CFLAGS = -DINCLUDE_NI5010=1 -#3c503_o_CFLAGS = -DINCLUDE_3C503=1 -#ne_o_CFLAGS = -DINCLUDE_NE=1 -ns83820_o_CFLAGS = -DINCLUDE_NS83820=1 -ns8390_o_CFLAGS = -DINCLUDE_NS8390=1 -#wd_o_CFLAGS = -DINCLUDE_WD=1 -#otulip_o_CFLAGS = -DINCLUDE_OTULIP=1 -pcnet32_o_CFLAGS = -DINCLUDE_PCNET32=1 -pnic_o_CFLAGS = -DINCLUDE_PNIC=1 -r8169_o_CFLAGS = -DINCLUDE_R8169=1 -rtl8139_o_CFLAGS = -DINCLUDE_RTL8139=1 -sis900_o_CFLAGS = -DINCLUDE_SIS900=1 -#sk_g16_o_CFLAGS = -DINCLUDE_SK_G16=1 -#smc9000_o_CFLAGS = -DINCLUDE_SMC9000=1 -sundance_o_CFLAGS = -DINCLUDE_SUNDANCE=1 -#tiara_o_CFLAGS = -DINCLUDE_TIARA=1 -tg3_o_CFLAGS = -DINCLUDE_TG3=1 -tlan_o_CFLAGS = -DINCLUDE_TLAN=1 -tulip_o_CFLAGS = -DINCLUDE_TULIP=1 -undi_o_CFLAGS = -DINCLUDE_UNDI=1 -via_rhine_o_CFLAGS = -DINCLUDE_VIA_RHINE=1 -w89c840_o_CFLAGS = -DINCLUDE_W89C840=1 -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .o .obj -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu netboot/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu netboot/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -clean-noinstLIBRARIES: - -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) -libdrivers.a: $(libdrivers_a_OBJECTS) $(libdrivers_a_DEPENDENCIES) - -rm -f libdrivers.a - $(libdrivers_a_AR) libdrivers.a $(libdrivers_a_OBJECTS) $(libdrivers_a_LIBADD) - $(RANLIB) libdrivers.a - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-3c595.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-3c90x.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-basemem.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-config.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-davicom.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-e1000.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-eepro100.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-epic100.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-forcedeth.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-fsys_tftp.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-i386_timer.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-misc.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-natsemi.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-nic.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-ns83820.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-ns8390.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-pci.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-pci_io.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-pcnet32.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-pic8259.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-pnic.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-pnic_api.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-r8169.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-rtl8139.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-sis900.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-sundance.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-tg3.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-timer.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-tlan.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-tulip.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-undi.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-via-rhine.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-w89c840.Po@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -libdrivers_a-config.o: config.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-config.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-config.Tpo" -c -o libdrivers_a-config.o `test -f 'config.c' || echo '$(srcdir)/'`config.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-config.Tpo" "$(DEPDIR)/libdrivers_a-config.Po"; else rm -f "$(DEPDIR)/libdrivers_a-config.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='config.c' object='libdrivers_a-config.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-config.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-config.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-config.o `test -f 'config.c' || echo '$(srcdir)/'`config.c - -libdrivers_a-config.obj: config.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-config.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-config.Tpo" -c -o libdrivers_a-config.obj `if test -f 'config.c'; then $(CYGPATH_W) 'config.c'; else $(CYGPATH_W) '$(srcdir)/config.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-config.Tpo" "$(DEPDIR)/libdrivers_a-config.Po"; else rm -f "$(DEPDIR)/libdrivers_a-config.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='config.c' object='libdrivers_a-config.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-config.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-config.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-config.obj `if test -f 'config.c'; then $(CYGPATH_W) 'config.c'; else $(CYGPATH_W) '$(srcdir)/config.c'; fi` - -libdrivers_a-fsys_tftp.o: fsys_tftp.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-fsys_tftp.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-fsys_tftp.Tpo" -c -o libdrivers_a-fsys_tftp.o `test -f 'fsys_tftp.c' || echo '$(srcdir)/'`fsys_tftp.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-fsys_tftp.Tpo" "$(DEPDIR)/libdrivers_a-fsys_tftp.Po"; else rm -f "$(DEPDIR)/libdrivers_a-fsys_tftp.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_tftp.c' object='libdrivers_a-fsys_tftp.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-fsys_tftp.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-fsys_tftp.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-fsys_tftp.o `test -f 'fsys_tftp.c' || echo '$(srcdir)/'`fsys_tftp.c - -libdrivers_a-fsys_tftp.obj: fsys_tftp.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-fsys_tftp.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-fsys_tftp.Tpo" -c -o libdrivers_a-fsys_tftp.obj `if test -f 'fsys_tftp.c'; then $(CYGPATH_W) 'fsys_tftp.c'; else $(CYGPATH_W) '$(srcdir)/fsys_tftp.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-fsys_tftp.Tpo" "$(DEPDIR)/libdrivers_a-fsys_tftp.Po"; else rm -f "$(DEPDIR)/libdrivers_a-fsys_tftp.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_tftp.c' object='libdrivers_a-fsys_tftp.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-fsys_tftp.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-fsys_tftp.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-fsys_tftp.obj `if test -f 'fsys_tftp.c'; then $(CYGPATH_W) 'fsys_tftp.c'; else $(CYGPATH_W) '$(srcdir)/fsys_tftp.c'; fi` - -libdrivers_a-i386_timer.o: i386_timer.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-i386_timer.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-i386_timer.Tpo" -c -o libdrivers_a-i386_timer.o `test -f 'i386_timer.c' || echo '$(srcdir)/'`i386_timer.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-i386_timer.Tpo" "$(DEPDIR)/libdrivers_a-i386_timer.Po"; else rm -f "$(DEPDIR)/libdrivers_a-i386_timer.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='i386_timer.c' object='libdrivers_a-i386_timer.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-i386_timer.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-i386_timer.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-i386_timer.o `test -f 'i386_timer.c' || echo '$(srcdir)/'`i386_timer.c - -libdrivers_a-i386_timer.obj: i386_timer.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-i386_timer.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-i386_timer.Tpo" -c -o libdrivers_a-i386_timer.obj `if test -f 'i386_timer.c'; then $(CYGPATH_W) 'i386_timer.c'; else $(CYGPATH_W) '$(srcdir)/i386_timer.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-i386_timer.Tpo" "$(DEPDIR)/libdrivers_a-i386_timer.Po"; else rm -f "$(DEPDIR)/libdrivers_a-i386_timer.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='i386_timer.c' object='libdrivers_a-i386_timer.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-i386_timer.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-i386_timer.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-i386_timer.obj `if test -f 'i386_timer.c'; then $(CYGPATH_W) 'i386_timer.c'; else $(CYGPATH_W) '$(srcdir)/i386_timer.c'; fi` - -libdrivers_a-misc.o: misc.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-misc.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-misc.Tpo" -c -o libdrivers_a-misc.o `test -f 'misc.c' || echo '$(srcdir)/'`misc.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-misc.Tpo" "$(DEPDIR)/libdrivers_a-misc.Po"; else rm -f "$(DEPDIR)/libdrivers_a-misc.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='misc.c' object='libdrivers_a-misc.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-misc.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-misc.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-misc.o `test -f 'misc.c' || echo '$(srcdir)/'`misc.c - -libdrivers_a-misc.obj: misc.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-misc.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-misc.Tpo" -c -o libdrivers_a-misc.obj `if test -f 'misc.c'; then $(CYGPATH_W) 'misc.c'; else $(CYGPATH_W) '$(srcdir)/misc.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-misc.Tpo" "$(DEPDIR)/libdrivers_a-misc.Po"; else rm -f "$(DEPDIR)/libdrivers_a-misc.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='misc.c' object='libdrivers_a-misc.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-misc.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-misc.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-misc.obj `if test -f 'misc.c'; then $(CYGPATH_W) 'misc.c'; else $(CYGPATH_W) '$(srcdir)/misc.c'; fi` - -libdrivers_a-nic.o: nic.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-nic.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-nic.Tpo" -c -o libdrivers_a-nic.o `test -f 'nic.c' || echo '$(srcdir)/'`nic.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-nic.Tpo" "$(DEPDIR)/libdrivers_a-nic.Po"; else rm -f "$(DEPDIR)/libdrivers_a-nic.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nic.c' object='libdrivers_a-nic.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-nic.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-nic.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-nic.o `test -f 'nic.c' || echo '$(srcdir)/'`nic.c - -libdrivers_a-nic.obj: nic.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-nic.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-nic.Tpo" -c -o libdrivers_a-nic.obj `if test -f 'nic.c'; then $(CYGPATH_W) 'nic.c'; else $(CYGPATH_W) '$(srcdir)/nic.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-nic.Tpo" "$(DEPDIR)/libdrivers_a-nic.Po"; else rm -f "$(DEPDIR)/libdrivers_a-nic.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nic.c' object='libdrivers_a-nic.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-nic.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-nic.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-nic.obj `if test -f 'nic.c'; then $(CYGPATH_W) 'nic.c'; else $(CYGPATH_W) '$(srcdir)/nic.c'; fi` - -libdrivers_a-pci.o: pci.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-pci.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-pci.Tpo" -c -o libdrivers_a-pci.o `test -f 'pci.c' || echo '$(srcdir)/'`pci.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-pci.Tpo" "$(DEPDIR)/libdrivers_a-pci.Po"; else rm -f "$(DEPDIR)/libdrivers_a-pci.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pci.c' object='libdrivers_a-pci.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-pci.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-pci.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-pci.o `test -f 'pci.c' || echo '$(srcdir)/'`pci.c - -libdrivers_a-pci.obj: pci.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-pci.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-pci.Tpo" -c -o libdrivers_a-pci.obj `if test -f 'pci.c'; then $(CYGPATH_W) 'pci.c'; else $(CYGPATH_W) '$(srcdir)/pci.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-pci.Tpo" "$(DEPDIR)/libdrivers_a-pci.Po"; else rm -f "$(DEPDIR)/libdrivers_a-pci.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pci.c' object='libdrivers_a-pci.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-pci.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-pci.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-pci.obj `if test -f 'pci.c'; then $(CYGPATH_W) 'pci.c'; else $(CYGPATH_W) '$(srcdir)/pci.c'; fi` - -libdrivers_a-pci_io.o: pci_io.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-pci_io.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-pci_io.Tpo" -c -o libdrivers_a-pci_io.o `test -f 'pci_io.c' || echo '$(srcdir)/'`pci_io.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-pci_io.Tpo" "$(DEPDIR)/libdrivers_a-pci_io.Po"; else rm -f "$(DEPDIR)/libdrivers_a-pci_io.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pci_io.c' object='libdrivers_a-pci_io.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-pci_io.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-pci_io.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-pci_io.o `test -f 'pci_io.c' || echo '$(srcdir)/'`pci_io.c - -libdrivers_a-pci_io.obj: pci_io.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-pci_io.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-pci_io.Tpo" -c -o libdrivers_a-pci_io.obj `if test -f 'pci_io.c'; then $(CYGPATH_W) 'pci_io.c'; else $(CYGPATH_W) '$(srcdir)/pci_io.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-pci_io.Tpo" "$(DEPDIR)/libdrivers_a-pci_io.Po"; else rm -f "$(DEPDIR)/libdrivers_a-pci_io.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pci_io.c' object='libdrivers_a-pci_io.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-pci_io.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-pci_io.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-pci_io.obj `if test -f 'pci_io.c'; then $(CYGPATH_W) 'pci_io.c'; else $(CYGPATH_W) '$(srcdir)/pci_io.c'; fi` - -libdrivers_a-timer.o: timer.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-timer.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-timer.Tpo" -c -o libdrivers_a-timer.o `test -f 'timer.c' || echo '$(srcdir)/'`timer.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-timer.Tpo" "$(DEPDIR)/libdrivers_a-timer.Po"; else rm -f "$(DEPDIR)/libdrivers_a-timer.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='timer.c' object='libdrivers_a-timer.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-timer.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-timer.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-timer.o `test -f 'timer.c' || echo '$(srcdir)/'`timer.c - -libdrivers_a-timer.obj: timer.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-timer.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-timer.Tpo" -c -o libdrivers_a-timer.obj `if test -f 'timer.c'; then $(CYGPATH_W) 'timer.c'; else $(CYGPATH_W) '$(srcdir)/timer.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-timer.Tpo" "$(DEPDIR)/libdrivers_a-timer.Po"; else rm -f "$(DEPDIR)/libdrivers_a-timer.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='timer.c' object='libdrivers_a-timer.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-timer.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-timer.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-timer.obj `if test -f 'timer.c'; then $(CYGPATH_W) 'timer.c'; else $(CYGPATH_W) '$(srcdir)/timer.c'; fi` - -libdrivers_a-pic8259.o: pic8259.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-pic8259.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-pic8259.Tpo" -c -o libdrivers_a-pic8259.o `test -f 'pic8259.c' || echo '$(srcdir)/'`pic8259.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-pic8259.Tpo" "$(DEPDIR)/libdrivers_a-pic8259.Po"; else rm -f "$(DEPDIR)/libdrivers_a-pic8259.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pic8259.c' object='libdrivers_a-pic8259.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-pic8259.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-pic8259.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-pic8259.o `test -f 'pic8259.c' || echo '$(srcdir)/'`pic8259.c - -libdrivers_a-pic8259.obj: pic8259.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-pic8259.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-pic8259.Tpo" -c -o libdrivers_a-pic8259.obj `if test -f 'pic8259.c'; then $(CYGPATH_W) 'pic8259.c'; else $(CYGPATH_W) '$(srcdir)/pic8259.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-pic8259.Tpo" "$(DEPDIR)/libdrivers_a-pic8259.Po"; else rm -f "$(DEPDIR)/libdrivers_a-pic8259.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pic8259.c' object='libdrivers_a-pic8259.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-pic8259.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-pic8259.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-pic8259.obj `if test -f 'pic8259.c'; then $(CYGPATH_W) 'pic8259.c'; else $(CYGPATH_W) '$(srcdir)/pic8259.c'; fi` - -libdrivers_a-basemem.o: basemem.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-basemem.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-basemem.Tpo" -c -o libdrivers_a-basemem.o `test -f 'basemem.c' || echo '$(srcdir)/'`basemem.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-basemem.Tpo" "$(DEPDIR)/libdrivers_a-basemem.Po"; else rm -f "$(DEPDIR)/libdrivers_a-basemem.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='basemem.c' object='libdrivers_a-basemem.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-basemem.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-basemem.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-basemem.o `test -f 'basemem.c' || echo '$(srcdir)/'`basemem.c - -libdrivers_a-basemem.obj: basemem.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-basemem.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-basemem.Tpo" -c -o libdrivers_a-basemem.obj `if test -f 'basemem.c'; then $(CYGPATH_W) 'basemem.c'; else $(CYGPATH_W) '$(srcdir)/basemem.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-basemem.Tpo" "$(DEPDIR)/libdrivers_a-basemem.Po"; else rm -f "$(DEPDIR)/libdrivers_a-basemem.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='basemem.c' object='libdrivers_a-basemem.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-basemem.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-basemem.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-basemem.obj `if test -f 'basemem.c'; then $(CYGPATH_W) 'basemem.c'; else $(CYGPATH_W) '$(srcdir)/basemem.c'; fi` - -libdrivers_a-3c595.o: 3c595.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-3c595.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-3c595.Tpo" -c -o libdrivers_a-3c595.o `test -f '3c595.c' || echo '$(srcdir)/'`3c595.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-3c595.Tpo" "$(DEPDIR)/libdrivers_a-3c595.Po"; else rm -f "$(DEPDIR)/libdrivers_a-3c595.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='3c595.c' object='libdrivers_a-3c595.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-3c595.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-3c595.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-3c595.o `test -f '3c595.c' || echo '$(srcdir)/'`3c595.c - -libdrivers_a-3c595.obj: 3c595.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-3c595.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-3c595.Tpo" -c -o libdrivers_a-3c595.obj `if test -f '3c595.c'; then $(CYGPATH_W) '3c595.c'; else $(CYGPATH_W) '$(srcdir)/3c595.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-3c595.Tpo" "$(DEPDIR)/libdrivers_a-3c595.Po"; else rm -f "$(DEPDIR)/libdrivers_a-3c595.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='3c595.c' object='libdrivers_a-3c595.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-3c595.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-3c595.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-3c595.obj `if test -f '3c595.c'; then $(CYGPATH_W) '3c595.c'; else $(CYGPATH_W) '$(srcdir)/3c595.c'; fi` - -libdrivers_a-3c90x.o: 3c90x.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-3c90x.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-3c90x.Tpo" -c -o libdrivers_a-3c90x.o `test -f '3c90x.c' || echo '$(srcdir)/'`3c90x.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-3c90x.Tpo" "$(DEPDIR)/libdrivers_a-3c90x.Po"; else rm -f "$(DEPDIR)/libdrivers_a-3c90x.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='3c90x.c' object='libdrivers_a-3c90x.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-3c90x.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-3c90x.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-3c90x.o `test -f '3c90x.c' || echo '$(srcdir)/'`3c90x.c - -libdrivers_a-3c90x.obj: 3c90x.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-3c90x.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-3c90x.Tpo" -c -o libdrivers_a-3c90x.obj `if test -f '3c90x.c'; then $(CYGPATH_W) '3c90x.c'; else $(CYGPATH_W) '$(srcdir)/3c90x.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-3c90x.Tpo" "$(DEPDIR)/libdrivers_a-3c90x.Po"; else rm -f "$(DEPDIR)/libdrivers_a-3c90x.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='3c90x.c' object='libdrivers_a-3c90x.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-3c90x.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-3c90x.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-3c90x.obj `if test -f '3c90x.c'; then $(CYGPATH_W) '3c90x.c'; else $(CYGPATH_W) '$(srcdir)/3c90x.c'; fi` - -libdrivers_a-davicom.o: davicom.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-davicom.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-davicom.Tpo" -c -o libdrivers_a-davicom.o `test -f 'davicom.c' || echo '$(srcdir)/'`davicom.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-davicom.Tpo" "$(DEPDIR)/libdrivers_a-davicom.Po"; else rm -f "$(DEPDIR)/libdrivers_a-davicom.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='davicom.c' object='libdrivers_a-davicom.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-davicom.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-davicom.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-davicom.o `test -f 'davicom.c' || echo '$(srcdir)/'`davicom.c - -libdrivers_a-davicom.obj: davicom.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-davicom.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-davicom.Tpo" -c -o libdrivers_a-davicom.obj `if test -f 'davicom.c'; then $(CYGPATH_W) 'davicom.c'; else $(CYGPATH_W) '$(srcdir)/davicom.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-davicom.Tpo" "$(DEPDIR)/libdrivers_a-davicom.Po"; else rm -f "$(DEPDIR)/libdrivers_a-davicom.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='davicom.c' object='libdrivers_a-davicom.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-davicom.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-davicom.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-davicom.obj `if test -f 'davicom.c'; then $(CYGPATH_W) 'davicom.c'; else $(CYGPATH_W) '$(srcdir)/davicom.c'; fi` - -libdrivers_a-e1000.o: e1000.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-e1000.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-e1000.Tpo" -c -o libdrivers_a-e1000.o `test -f 'e1000.c' || echo '$(srcdir)/'`e1000.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-e1000.Tpo" "$(DEPDIR)/libdrivers_a-e1000.Po"; else rm -f "$(DEPDIR)/libdrivers_a-e1000.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='e1000.c' object='libdrivers_a-e1000.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-e1000.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-e1000.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-e1000.o `test -f 'e1000.c' || echo '$(srcdir)/'`e1000.c - -libdrivers_a-e1000.obj: e1000.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-e1000.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-e1000.Tpo" -c -o libdrivers_a-e1000.obj `if test -f 'e1000.c'; then $(CYGPATH_W) 'e1000.c'; else $(CYGPATH_W) '$(srcdir)/e1000.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-e1000.Tpo" "$(DEPDIR)/libdrivers_a-e1000.Po"; else rm -f "$(DEPDIR)/libdrivers_a-e1000.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='e1000.c' object='libdrivers_a-e1000.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-e1000.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-e1000.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-e1000.obj `if test -f 'e1000.c'; then $(CYGPATH_W) 'e1000.c'; else $(CYGPATH_W) '$(srcdir)/e1000.c'; fi` - -libdrivers_a-eepro100.o: eepro100.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-eepro100.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-eepro100.Tpo" -c -o libdrivers_a-eepro100.o `test -f 'eepro100.c' || echo '$(srcdir)/'`eepro100.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-eepro100.Tpo" "$(DEPDIR)/libdrivers_a-eepro100.Po"; else rm -f "$(DEPDIR)/libdrivers_a-eepro100.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='eepro100.c' object='libdrivers_a-eepro100.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-eepro100.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-eepro100.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-eepro100.o `test -f 'eepro100.c' || echo '$(srcdir)/'`eepro100.c - -libdrivers_a-eepro100.obj: eepro100.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-eepro100.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-eepro100.Tpo" -c -o libdrivers_a-eepro100.obj `if test -f 'eepro100.c'; then $(CYGPATH_W) 'eepro100.c'; else $(CYGPATH_W) '$(srcdir)/eepro100.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-eepro100.Tpo" "$(DEPDIR)/libdrivers_a-eepro100.Po"; else rm -f "$(DEPDIR)/libdrivers_a-eepro100.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='eepro100.c' object='libdrivers_a-eepro100.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-eepro100.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-eepro100.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-eepro100.obj `if test -f 'eepro100.c'; then $(CYGPATH_W) 'eepro100.c'; else $(CYGPATH_W) '$(srcdir)/eepro100.c'; fi` - -libdrivers_a-epic100.o: epic100.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-epic100.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-epic100.Tpo" -c -o libdrivers_a-epic100.o `test -f 'epic100.c' || echo '$(srcdir)/'`epic100.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-epic100.Tpo" "$(DEPDIR)/libdrivers_a-epic100.Po"; else rm -f "$(DEPDIR)/libdrivers_a-epic100.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='epic100.c' object='libdrivers_a-epic100.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-epic100.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-epic100.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-epic100.o `test -f 'epic100.c' || echo '$(srcdir)/'`epic100.c - -libdrivers_a-epic100.obj: epic100.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-epic100.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-epic100.Tpo" -c -o libdrivers_a-epic100.obj `if test -f 'epic100.c'; then $(CYGPATH_W) 'epic100.c'; else $(CYGPATH_W) '$(srcdir)/epic100.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-epic100.Tpo" "$(DEPDIR)/libdrivers_a-epic100.Po"; else rm -f "$(DEPDIR)/libdrivers_a-epic100.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='epic100.c' object='libdrivers_a-epic100.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-epic100.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-epic100.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-epic100.obj `if test -f 'epic100.c'; then $(CYGPATH_W) 'epic100.c'; else $(CYGPATH_W) '$(srcdir)/epic100.c'; fi` - -libdrivers_a-natsemi.o: natsemi.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-natsemi.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-natsemi.Tpo" -c -o libdrivers_a-natsemi.o `test -f 'natsemi.c' || echo '$(srcdir)/'`natsemi.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-natsemi.Tpo" "$(DEPDIR)/libdrivers_a-natsemi.Po"; else rm -f "$(DEPDIR)/libdrivers_a-natsemi.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='natsemi.c' object='libdrivers_a-natsemi.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-natsemi.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-natsemi.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-natsemi.o `test -f 'natsemi.c' || echo '$(srcdir)/'`natsemi.c - -libdrivers_a-natsemi.obj: natsemi.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-natsemi.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-natsemi.Tpo" -c -o libdrivers_a-natsemi.obj `if test -f 'natsemi.c'; then $(CYGPATH_W) 'natsemi.c'; else $(CYGPATH_W) '$(srcdir)/natsemi.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-natsemi.Tpo" "$(DEPDIR)/libdrivers_a-natsemi.Po"; else rm -f "$(DEPDIR)/libdrivers_a-natsemi.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='natsemi.c' object='libdrivers_a-natsemi.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-natsemi.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-natsemi.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-natsemi.obj `if test -f 'natsemi.c'; then $(CYGPATH_W) 'natsemi.c'; else $(CYGPATH_W) '$(srcdir)/natsemi.c'; fi` - -libdrivers_a-ns8390.o: ns8390.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-ns8390.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-ns8390.Tpo" -c -o libdrivers_a-ns8390.o `test -f 'ns8390.c' || echo '$(srcdir)/'`ns8390.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-ns8390.Tpo" "$(DEPDIR)/libdrivers_a-ns8390.Po"; else rm -f "$(DEPDIR)/libdrivers_a-ns8390.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ns8390.c' object='libdrivers_a-ns8390.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-ns8390.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-ns8390.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-ns8390.o `test -f 'ns8390.c' || echo '$(srcdir)/'`ns8390.c - -libdrivers_a-ns8390.obj: ns8390.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-ns8390.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-ns8390.Tpo" -c -o libdrivers_a-ns8390.obj `if test -f 'ns8390.c'; then $(CYGPATH_W) 'ns8390.c'; else $(CYGPATH_W) '$(srcdir)/ns8390.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-ns8390.Tpo" "$(DEPDIR)/libdrivers_a-ns8390.Po"; else rm -f "$(DEPDIR)/libdrivers_a-ns8390.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ns8390.c' object='libdrivers_a-ns8390.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-ns8390.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-ns8390.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-ns8390.obj `if test -f 'ns8390.c'; then $(CYGPATH_W) 'ns8390.c'; else $(CYGPATH_W) '$(srcdir)/ns8390.c'; fi` - -libdrivers_a-pcnet32.o: pcnet32.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-pcnet32.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-pcnet32.Tpo" -c -o libdrivers_a-pcnet32.o `test -f 'pcnet32.c' || echo '$(srcdir)/'`pcnet32.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-pcnet32.Tpo" "$(DEPDIR)/libdrivers_a-pcnet32.Po"; else rm -f "$(DEPDIR)/libdrivers_a-pcnet32.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pcnet32.c' object='libdrivers_a-pcnet32.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-pcnet32.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-pcnet32.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-pcnet32.o `test -f 'pcnet32.c' || echo '$(srcdir)/'`pcnet32.c - -libdrivers_a-pcnet32.obj: pcnet32.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-pcnet32.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-pcnet32.Tpo" -c -o libdrivers_a-pcnet32.obj `if test -f 'pcnet32.c'; then $(CYGPATH_W) 'pcnet32.c'; else $(CYGPATH_W) '$(srcdir)/pcnet32.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-pcnet32.Tpo" "$(DEPDIR)/libdrivers_a-pcnet32.Po"; else rm -f "$(DEPDIR)/libdrivers_a-pcnet32.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pcnet32.c' object='libdrivers_a-pcnet32.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-pcnet32.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-pcnet32.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-pcnet32.obj `if test -f 'pcnet32.c'; then $(CYGPATH_W) 'pcnet32.c'; else $(CYGPATH_W) '$(srcdir)/pcnet32.c'; fi` - -libdrivers_a-rtl8139.o: rtl8139.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-rtl8139.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-rtl8139.Tpo" -c -o libdrivers_a-rtl8139.o `test -f 'rtl8139.c' || echo '$(srcdir)/'`rtl8139.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-rtl8139.Tpo" "$(DEPDIR)/libdrivers_a-rtl8139.Po"; else rm -f "$(DEPDIR)/libdrivers_a-rtl8139.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='rtl8139.c' object='libdrivers_a-rtl8139.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-rtl8139.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-rtl8139.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-rtl8139.o `test -f 'rtl8139.c' || echo '$(srcdir)/'`rtl8139.c - -libdrivers_a-rtl8139.obj: rtl8139.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-rtl8139.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-rtl8139.Tpo" -c -o libdrivers_a-rtl8139.obj `if test -f 'rtl8139.c'; then $(CYGPATH_W) 'rtl8139.c'; else $(CYGPATH_W) '$(srcdir)/rtl8139.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-rtl8139.Tpo" "$(DEPDIR)/libdrivers_a-rtl8139.Po"; else rm -f "$(DEPDIR)/libdrivers_a-rtl8139.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='rtl8139.c' object='libdrivers_a-rtl8139.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-rtl8139.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-rtl8139.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-rtl8139.obj `if test -f 'rtl8139.c'; then $(CYGPATH_W) 'rtl8139.c'; else $(CYGPATH_W) '$(srcdir)/rtl8139.c'; fi` - -libdrivers_a-sis900.o: sis900.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-sis900.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-sis900.Tpo" -c -o libdrivers_a-sis900.o `test -f 'sis900.c' || echo '$(srcdir)/'`sis900.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-sis900.Tpo" "$(DEPDIR)/libdrivers_a-sis900.Po"; else rm -f "$(DEPDIR)/libdrivers_a-sis900.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sis900.c' object='libdrivers_a-sis900.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-sis900.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-sis900.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-sis900.o `test -f 'sis900.c' || echo '$(srcdir)/'`sis900.c - -libdrivers_a-sis900.obj: sis900.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-sis900.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-sis900.Tpo" -c -o libdrivers_a-sis900.obj `if test -f 'sis900.c'; then $(CYGPATH_W) 'sis900.c'; else $(CYGPATH_W) '$(srcdir)/sis900.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-sis900.Tpo" "$(DEPDIR)/libdrivers_a-sis900.Po"; else rm -f "$(DEPDIR)/libdrivers_a-sis900.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sis900.c' object='libdrivers_a-sis900.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-sis900.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-sis900.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-sis900.obj `if test -f 'sis900.c'; then $(CYGPATH_W) 'sis900.c'; else $(CYGPATH_W) '$(srcdir)/sis900.c'; fi` - -libdrivers_a-sundance.o: sundance.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-sundance.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-sundance.Tpo" -c -o libdrivers_a-sundance.o `test -f 'sundance.c' || echo '$(srcdir)/'`sundance.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-sundance.Tpo" "$(DEPDIR)/libdrivers_a-sundance.Po"; else rm -f "$(DEPDIR)/libdrivers_a-sundance.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sundance.c' object='libdrivers_a-sundance.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-sundance.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-sundance.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-sundance.o `test -f 'sundance.c' || echo '$(srcdir)/'`sundance.c - -libdrivers_a-sundance.obj: sundance.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-sundance.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-sundance.Tpo" -c -o libdrivers_a-sundance.obj `if test -f 'sundance.c'; then $(CYGPATH_W) 'sundance.c'; else $(CYGPATH_W) '$(srcdir)/sundance.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-sundance.Tpo" "$(DEPDIR)/libdrivers_a-sundance.Po"; else rm -f "$(DEPDIR)/libdrivers_a-sundance.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sundance.c' object='libdrivers_a-sundance.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-sundance.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-sundance.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-sundance.obj `if test -f 'sundance.c'; then $(CYGPATH_W) 'sundance.c'; else $(CYGPATH_W) '$(srcdir)/sundance.c'; fi` - -libdrivers_a-tg3.o: tg3.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-tg3.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-tg3.Tpo" -c -o libdrivers_a-tg3.o `test -f 'tg3.c' || echo '$(srcdir)/'`tg3.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-tg3.Tpo" "$(DEPDIR)/libdrivers_a-tg3.Po"; else rm -f "$(DEPDIR)/libdrivers_a-tg3.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tg3.c' object='libdrivers_a-tg3.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-tg3.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-tg3.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-tg3.o `test -f 'tg3.c' || echo '$(srcdir)/'`tg3.c - -libdrivers_a-tg3.obj: tg3.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-tg3.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-tg3.Tpo" -c -o libdrivers_a-tg3.obj `if test -f 'tg3.c'; then $(CYGPATH_W) 'tg3.c'; else $(CYGPATH_W) '$(srcdir)/tg3.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-tg3.Tpo" "$(DEPDIR)/libdrivers_a-tg3.Po"; else rm -f "$(DEPDIR)/libdrivers_a-tg3.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tg3.c' object='libdrivers_a-tg3.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-tg3.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-tg3.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-tg3.obj `if test -f 'tg3.c'; then $(CYGPATH_W) 'tg3.c'; else $(CYGPATH_W) '$(srcdir)/tg3.c'; fi` - -libdrivers_a-tlan.o: tlan.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-tlan.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-tlan.Tpo" -c -o libdrivers_a-tlan.o `test -f 'tlan.c' || echo '$(srcdir)/'`tlan.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-tlan.Tpo" "$(DEPDIR)/libdrivers_a-tlan.Po"; else rm -f "$(DEPDIR)/libdrivers_a-tlan.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tlan.c' object='libdrivers_a-tlan.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-tlan.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-tlan.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-tlan.o `test -f 'tlan.c' || echo '$(srcdir)/'`tlan.c - -libdrivers_a-tlan.obj: tlan.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-tlan.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-tlan.Tpo" -c -o libdrivers_a-tlan.obj `if test -f 'tlan.c'; then $(CYGPATH_W) 'tlan.c'; else $(CYGPATH_W) '$(srcdir)/tlan.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-tlan.Tpo" "$(DEPDIR)/libdrivers_a-tlan.Po"; else rm -f "$(DEPDIR)/libdrivers_a-tlan.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tlan.c' object='libdrivers_a-tlan.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-tlan.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-tlan.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-tlan.obj `if test -f 'tlan.c'; then $(CYGPATH_W) 'tlan.c'; else $(CYGPATH_W) '$(srcdir)/tlan.c'; fi` - -libdrivers_a-tulip.o: tulip.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-tulip.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-tulip.Tpo" -c -o libdrivers_a-tulip.o `test -f 'tulip.c' || echo '$(srcdir)/'`tulip.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-tulip.Tpo" "$(DEPDIR)/libdrivers_a-tulip.Po"; else rm -f "$(DEPDIR)/libdrivers_a-tulip.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tulip.c' object='libdrivers_a-tulip.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-tulip.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-tulip.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-tulip.o `test -f 'tulip.c' || echo '$(srcdir)/'`tulip.c - -libdrivers_a-tulip.obj: tulip.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-tulip.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-tulip.Tpo" -c -o libdrivers_a-tulip.obj `if test -f 'tulip.c'; then $(CYGPATH_W) 'tulip.c'; else $(CYGPATH_W) '$(srcdir)/tulip.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-tulip.Tpo" "$(DEPDIR)/libdrivers_a-tulip.Po"; else rm -f "$(DEPDIR)/libdrivers_a-tulip.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tulip.c' object='libdrivers_a-tulip.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-tulip.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-tulip.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-tulip.obj `if test -f 'tulip.c'; then $(CYGPATH_W) 'tulip.c'; else $(CYGPATH_W) '$(srcdir)/tulip.c'; fi` - -libdrivers_a-via-rhine.o: via-rhine.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-via-rhine.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-via-rhine.Tpo" -c -o libdrivers_a-via-rhine.o `test -f 'via-rhine.c' || echo '$(srcdir)/'`via-rhine.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-via-rhine.Tpo" "$(DEPDIR)/libdrivers_a-via-rhine.Po"; else rm -f "$(DEPDIR)/libdrivers_a-via-rhine.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='via-rhine.c' object='libdrivers_a-via-rhine.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-via-rhine.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-via-rhine.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-via-rhine.o `test -f 'via-rhine.c' || echo '$(srcdir)/'`via-rhine.c - -libdrivers_a-via-rhine.obj: via-rhine.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-via-rhine.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-via-rhine.Tpo" -c -o libdrivers_a-via-rhine.obj `if test -f 'via-rhine.c'; then $(CYGPATH_W) 'via-rhine.c'; else $(CYGPATH_W) '$(srcdir)/via-rhine.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-via-rhine.Tpo" "$(DEPDIR)/libdrivers_a-via-rhine.Po"; else rm -f "$(DEPDIR)/libdrivers_a-via-rhine.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='via-rhine.c' object='libdrivers_a-via-rhine.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-via-rhine.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-via-rhine.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-via-rhine.obj `if test -f 'via-rhine.c'; then $(CYGPATH_W) 'via-rhine.c'; else $(CYGPATH_W) '$(srcdir)/via-rhine.c'; fi` - -libdrivers_a-w89c840.o: w89c840.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-w89c840.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-w89c840.Tpo" -c -o libdrivers_a-w89c840.o `test -f 'w89c840.c' || echo '$(srcdir)/'`w89c840.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-w89c840.Tpo" "$(DEPDIR)/libdrivers_a-w89c840.Po"; else rm -f "$(DEPDIR)/libdrivers_a-w89c840.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='w89c840.c' object='libdrivers_a-w89c840.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-w89c840.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-w89c840.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-w89c840.o `test -f 'w89c840.c' || echo '$(srcdir)/'`w89c840.c - -libdrivers_a-w89c840.obj: w89c840.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-w89c840.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-w89c840.Tpo" -c -o libdrivers_a-w89c840.obj `if test -f 'w89c840.c'; then $(CYGPATH_W) 'w89c840.c'; else $(CYGPATH_W) '$(srcdir)/w89c840.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-w89c840.Tpo" "$(DEPDIR)/libdrivers_a-w89c840.Po"; else rm -f "$(DEPDIR)/libdrivers_a-w89c840.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='w89c840.c' object='libdrivers_a-w89c840.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-w89c840.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-w89c840.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-w89c840.obj `if test -f 'w89c840.c'; then $(CYGPATH_W) 'w89c840.c'; else $(CYGPATH_W) '$(srcdir)/w89c840.c'; fi` - -libdrivers_a-r8169.o: r8169.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-r8169.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-r8169.Tpo" -c -o libdrivers_a-r8169.o `test -f 'r8169.c' || echo '$(srcdir)/'`r8169.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-r8169.Tpo" "$(DEPDIR)/libdrivers_a-r8169.Po"; else rm -f "$(DEPDIR)/libdrivers_a-r8169.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='r8169.c' object='libdrivers_a-r8169.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-r8169.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-r8169.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-r8169.o `test -f 'r8169.c' || echo '$(srcdir)/'`r8169.c - -libdrivers_a-r8169.obj: r8169.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-r8169.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-r8169.Tpo" -c -o libdrivers_a-r8169.obj `if test -f 'r8169.c'; then $(CYGPATH_W) 'r8169.c'; else $(CYGPATH_W) '$(srcdir)/r8169.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-r8169.Tpo" "$(DEPDIR)/libdrivers_a-r8169.Po"; else rm -f "$(DEPDIR)/libdrivers_a-r8169.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='r8169.c' object='libdrivers_a-r8169.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-r8169.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-r8169.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-r8169.obj `if test -f 'r8169.c'; then $(CYGPATH_W) 'r8169.c'; else $(CYGPATH_W) '$(srcdir)/r8169.c'; fi` - -libdrivers_a-forcedeth.o: forcedeth.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-forcedeth.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-forcedeth.Tpo" -c -o libdrivers_a-forcedeth.o `test -f 'forcedeth.c' || echo '$(srcdir)/'`forcedeth.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-forcedeth.Tpo" "$(DEPDIR)/libdrivers_a-forcedeth.Po"; else rm -f "$(DEPDIR)/libdrivers_a-forcedeth.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='forcedeth.c' object='libdrivers_a-forcedeth.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-forcedeth.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-forcedeth.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-forcedeth.o `test -f 'forcedeth.c' || echo '$(srcdir)/'`forcedeth.c - -libdrivers_a-forcedeth.obj: forcedeth.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-forcedeth.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-forcedeth.Tpo" -c -o libdrivers_a-forcedeth.obj `if test -f 'forcedeth.c'; then $(CYGPATH_W) 'forcedeth.c'; else $(CYGPATH_W) '$(srcdir)/forcedeth.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-forcedeth.Tpo" "$(DEPDIR)/libdrivers_a-forcedeth.Po"; else rm -f "$(DEPDIR)/libdrivers_a-forcedeth.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='forcedeth.c' object='libdrivers_a-forcedeth.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-forcedeth.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-forcedeth.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-forcedeth.obj `if test -f 'forcedeth.c'; then $(CYGPATH_W) 'forcedeth.c'; else $(CYGPATH_W) '$(srcdir)/forcedeth.c'; fi` - -libdrivers_a-ns83820.o: ns83820.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-ns83820.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-ns83820.Tpo" -c -o libdrivers_a-ns83820.o `test -f 'ns83820.c' || echo '$(srcdir)/'`ns83820.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-ns83820.Tpo" "$(DEPDIR)/libdrivers_a-ns83820.Po"; else rm -f "$(DEPDIR)/libdrivers_a-ns83820.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ns83820.c' object='libdrivers_a-ns83820.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-ns83820.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-ns83820.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-ns83820.o `test -f 'ns83820.c' || echo '$(srcdir)/'`ns83820.c - -libdrivers_a-ns83820.obj: ns83820.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-ns83820.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-ns83820.Tpo" -c -o libdrivers_a-ns83820.obj `if test -f 'ns83820.c'; then $(CYGPATH_W) 'ns83820.c'; else $(CYGPATH_W) '$(srcdir)/ns83820.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-ns83820.Tpo" "$(DEPDIR)/libdrivers_a-ns83820.Po"; else rm -f "$(DEPDIR)/libdrivers_a-ns83820.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ns83820.c' object='libdrivers_a-ns83820.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-ns83820.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-ns83820.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-ns83820.obj `if test -f 'ns83820.c'; then $(CYGPATH_W) 'ns83820.c'; else $(CYGPATH_W) '$(srcdir)/ns83820.c'; fi` - -libdrivers_a-pnic.o: pnic.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-pnic.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-pnic.Tpo" -c -o libdrivers_a-pnic.o `test -f 'pnic.c' || echo '$(srcdir)/'`pnic.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-pnic.Tpo" "$(DEPDIR)/libdrivers_a-pnic.Po"; else rm -f "$(DEPDIR)/libdrivers_a-pnic.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pnic.c' object='libdrivers_a-pnic.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-pnic.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-pnic.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-pnic.o `test -f 'pnic.c' || echo '$(srcdir)/'`pnic.c - -libdrivers_a-pnic.obj: pnic.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-pnic.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-pnic.Tpo" -c -o libdrivers_a-pnic.obj `if test -f 'pnic.c'; then $(CYGPATH_W) 'pnic.c'; else $(CYGPATH_W) '$(srcdir)/pnic.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-pnic.Tpo" "$(DEPDIR)/libdrivers_a-pnic.Po"; else rm -f "$(DEPDIR)/libdrivers_a-pnic.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pnic.c' object='libdrivers_a-pnic.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-pnic.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-pnic.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-pnic.obj `if test -f 'pnic.c'; then $(CYGPATH_W) 'pnic.c'; else $(CYGPATH_W) '$(srcdir)/pnic.c'; fi` - -libdrivers_a-pnic_api.o: pnic_api.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-pnic_api.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-pnic_api.Tpo" -c -o libdrivers_a-pnic_api.o `test -f 'pnic_api.c' || echo '$(srcdir)/'`pnic_api.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-pnic_api.Tpo" "$(DEPDIR)/libdrivers_a-pnic_api.Po"; else rm -f "$(DEPDIR)/libdrivers_a-pnic_api.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pnic_api.c' object='libdrivers_a-pnic_api.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-pnic_api.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-pnic_api.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-pnic_api.o `test -f 'pnic_api.c' || echo '$(srcdir)/'`pnic_api.c - -libdrivers_a-pnic_api.obj: pnic_api.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-pnic_api.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-pnic_api.Tpo" -c -o libdrivers_a-pnic_api.obj `if test -f 'pnic_api.c'; then $(CYGPATH_W) 'pnic_api.c'; else $(CYGPATH_W) '$(srcdir)/pnic_api.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-pnic_api.Tpo" "$(DEPDIR)/libdrivers_a-pnic_api.Po"; else rm -f "$(DEPDIR)/libdrivers_a-pnic_api.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pnic_api.c' object='libdrivers_a-pnic_api.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-pnic_api.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-pnic_api.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-pnic_api.obj `if test -f 'pnic_api.c'; then $(CYGPATH_W) 'pnic_api.c'; else $(CYGPATH_W) '$(srcdir)/pnic_api.c'; fi` - -libdrivers_a-undi.o: undi.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-undi.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-undi.Tpo" -c -o libdrivers_a-undi.o `test -f 'undi.c' || echo '$(srcdir)/'`undi.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-undi.Tpo" "$(DEPDIR)/libdrivers_a-undi.Po"; else rm -f "$(DEPDIR)/libdrivers_a-undi.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='undi.c' object='libdrivers_a-undi.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-undi.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-undi.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-undi.o `test -f 'undi.c' || echo '$(srcdir)/'`undi.c - -libdrivers_a-undi.obj: undi.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-undi.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-undi.Tpo" -c -o libdrivers_a-undi.obj `if test -f 'undi.c'; then $(CYGPATH_W) 'undi.c'; else $(CYGPATH_W) '$(srcdir)/undi.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-undi.Tpo" "$(DEPDIR)/libdrivers_a-undi.Po"; else rm -f "$(DEPDIR)/libdrivers_a-undi.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='undi.c' object='libdrivers_a-undi.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-undi.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-undi.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-undi.obj `if test -f 'undi.c'; then $(CYGPATH_W) 'undi.c'; else $(CYGPATH_W) '$(srcdir)/undi.c'; fi` -uninstall-info-am: - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LIBRARIES) -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-noinstLIBRARIES ctags distclean distclean-compile \ - distclean-generic distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-exec install-exec-am install-info \ - install-info-am install-man install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ - uninstall-am uninstall-info-am - - -# Is it really necessary to specify dependecies explicitly? -#$(3c509_drivers): 3c509.c 3c509.h -#$(3c509_drivers): %.o: 3c509.c -# $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ -# $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< - -$(3c595_drivers): 3c595.c 3c595.h -$(3c595_drivers): %.o: 3c595.c - $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ - $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< - -$(3c90x_drivers): 3c90x.c -$(3c90x_drivers): %.o: 3c90x.c - $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ - $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< - -#$(cs89x0_drivers): cs89x0.c cs89x0.h -#$(cs89x0_drivers): %.o: cs89x0.c -# $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ -# $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< - -$(davicom_drivers): davicom.c -$(davicom_drivers): %.o: davicom.c - $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ - $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< - -#$(depca_drivers): depca.c -#$(depca_drivers): %.o: depca.c -# $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ -# $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< - -#$(eepro_drivers): eepro.c -#$(eepro_drivers): %.o: eepro.c -# $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ -# $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< - -$(e1000_drivers): e1000.c e1000_hw.h -$(e1000_drivers): %.o: e1000.c - $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ - $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< - -$(eepro100_drivers): eepro100.c -$(eepro100_drivers): %.o: eepro100.c - $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ - $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< - -$(epic100_drivers): epic100.c epic100.h -$(epic100_drivers): %.o: epic100.c - $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ - $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< - -$(forcedeth_drivers): forcedeth.c -$(forcedeth_drivers): %.o: forcedeth.c - $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ - $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< - -#$(fa311_drivers): fa311.c -#$(fa311_drivers): %.o: fa311.c -# $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ -# $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< - -#$(i82586_drivers): i82586.c -#$(i82586_drivers): %.o: i82586.c -# $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ -# $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< - -#$(lance_drivers): lance.c -#$(lance_drivers): %.o: lance.c -# $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ -# $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< - -$(natsemi_drivers): natsemi.c -$(natsemi_drivers): %.o: natsemi.c - $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ - $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< - -#$(ni5010_drivers): ni5010.c -#$(ni5010_drivers): %.o: ni5010.c -# $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ -# $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< - -$(ns83820_drivers): ns83820.c -$(ns83820_drivers): %.o: ns83820.c - $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ - $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< - -$(ns8390_drivers): ns8390.c ns8390.h -$(ns8390_drivers): %.o: ns8390.c - $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ - $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< - -#$(otulip_drivers): otulip.c otulip.h -#$(otulip_drivers): %.o: otulip.c -# $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ -# $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< - -$(pcnet32_drivers): pcnet32.c -$(pcnet32_drivers): %.o: pcnet32.c - $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ - $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< - -$(pnic_drivers): pnic.c -$(pnic_drivers): %.o: pnic.c pnic_api.h - $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ - $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< - -$(rtl8139_drivers): rtl8139.c -$(rtl8139_drivers): %.o: rtl8139.c - $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ - $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< - -$(r8169_drivers): r8169.c -$(r8169_drivers): %.o: r8169.c - $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ - $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< - -$(sis900_drivers): sis900.c sis900.h -$(sis900_drivers): %.o: sis900.c - $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ - $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< - -#$(sk_g16_drivers): sk_g16.c sk_g16.h -#$(sk_g16_drivers): %.o: sk_g16.c -# $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ -# $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< - -#$(smc9000_drivers): smc9000.c smc9000.h -#$(smc9000_drivers): %.o: smc9000.c -# $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ -# $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< - -$(sundance_drivers): sundance.c -$(sundance_drivers): %.o: sundance.c - $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ - $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< - -$(tg3_drivers): tg3.c tg3.h -$(tg3_drivers): %.o: tg3.c - $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ - $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< - -#$(tiara_drivers): tiara.c -#$(tiara_drivers): %.o: tiara.c -# $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ -# $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< - -$(tlan_drivers): tlan.c tlan.h -$(tlan_drivers): %.o: tlan.c - $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ - $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< - -$(tulip_drivers): tulip.c -$(tulip_drivers): %.o: tulip.c - $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ - $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< - -$(undi_drivers): undi.c undi.h -$(undi_drivers): %.o: undi.c - $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ - $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< - -$(via_rhine_drivers): via-rhine.c -$(via_rhine_drivers): %.o: via-rhine.c - $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ - $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< - -$(w89c840_drivers): w89c840.c -$(w89c840_drivers): %.o: w89c840.c - $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ - $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/usr/src/grub/grub-0.95/netboot/Makefile.solaris b/usr/src/grub/grub-0.95/netboot/Makefile.solaris deleted file mode 100644 index af7687fe4f..0000000000 --- a/usr/src/grub/grub-0.95/netboot/Makefile.solaris +++ /dev/null @@ -1,168 +0,0 @@ -# -# Copyright 2005 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# ident "%Z%%M% %I% %E% SMI" -# -include ../../Makefile.grub -include ../Makefile.solaris.defs - -LIBDRIVERS = libdrivers.a - -LIBDRIVERS_OBJS = $(LIB_OBJS) $(DRIVER_OBJS) - -LIB_OBJS = libdrivers_a-basemem.o \ - libdrivers_a-config.o \ - libdrivers_a-fsys_tftp.o \ - libdrivers_a-i386_timer.o \ - libdrivers_a-misc.o \ - libdrivers_a-nic.o \ - libdrivers_a-pci.o \ - libdrivers_a-pci_io.o \ - libdrivers_a-pic8259.o \ - libdrivers_a-timer.o -$(LIB_OBJS) := CFLAGS = $(BASE_CFLAGS) -Os -fno-builtin -nostdinc \ - -DFSYS_TFTP=1 $(NET_CFLAGS) $(NET_EXTRAFLAGS) - -# -# The following netboot drivers are available. -# NOTE: Compiling too many netboot drivers into stage2 could cause GRUB to -# crash or misbehave. -# NOTE: NET_CFLAGS has to be adjusted to correspond to the drivers -# selected in $(DRIVER_OBJS). -# -# 3c595.o - 3Com595 driver -# 3c90x.o - 3Com90x driver -# davicom.o - Davicom driver -# e1000.o - Etherexpress Pro/1000 driver -# eepro100.o - Etherexpress Pro/100 driver -# epic100.o - SMC 83c170 EPIC/100 driver -# forcedeth.o - Nvidia Geforce driver -# natsemi.o - NatSemi DP8381x driver -# ns83820.o - NS83820 driver -# ns8390.o - NE2000 PCI driver -# pcnet32.o - AMD Lance/PCI PCNet/32 driver -# pnic.o - Bochs Pseudo Nic driver -# r8169.o - Realtek 8169 driver -# rtl8139.o - Realtek 8139 driver -# sis900.o - SIS 900 and SIS 7016 driver -# sundance.o - Sundance ST201 driver -# tg3.o - Broadcom Tigon3 driver -# tlan.o - TI ThunderLAN driver -# tulip.o - Tulip driver -# undi.o - PXE UNDI driver -# via-rhine.o - Rhine-I/II driver -# w89c840.o - Winbond W89c840 driver -# -DRIVER_OBJS = undi.o - -NET_CFLAGS = -DINCLUDE_UNDI=1 - -$(DRIVER_OBJS) := CFLAGS = $(BASE_CFLAGS) -Os -fno-builtin -nostdinc \ - $(NET_EXTRAFLAGS) $(DRIVER_DEFS) - -3c595.o := DRIVER_DEFS = -DINCLUDE_3C595=1 -3c90x.o := DRIVER_DEFS = -DINCLUDE_3C90X=1 -davicom.o := DRIVER_DEFS = -DINCLUDE_DAVICOM=1 -e1000.o := DRIVER_DEFS = -DINCLUDE_E1000=1 -eepro100.o := DRIVER_DEFS = -DINCLUDE_EEPRO100=1 -epic100.o := DRIVER_DEFS = -DINCLUDE_EPIC100=1 -forcedeth.o := DRIVER_DEFS = -DINCLUDE_FORCEDETH=1 -natsemi.o := DRIVER_DEFS = -DINCLUDE_NATSEMI=1 -ns83820.o := DRIVER_DEFS = -DINCLUDE_NS83820=1 -ns8390.o := DRIVER_DEFS = -DINCLUDE_NS8390=1 -pcnet32.o := DRIVER_DEFS = -DINCLUDE_PCNET32=1 -pnic.o := DRIVER_DEFS = -DINCLUDE_PNIC=1 -r8169.o := DRIVER_DEFS = -DINCLUDE_R8169=1 -rtl8139.o := DRIVER_DEFS = -DINCLUDE_RTL8139=1 -sis900.o := DRIVER_DEFS = -DINCLUDE_SIS900=1 -sundance.o := DRIVER_DEFS = -DINCLUDE_SUNDANCE=1 -tg3.o := DRIVER_DEFS = -DINCLUDE_TG3=1 -tlan.o := DRIVER_DEFS = -DINCLUDE_TLAN=1 -tulip.o := DRIVER_DEFS = -DINCLUDE_TULIP=1 -undi.o := DRIVER_DEFS = -DINCLUDE_UNDI=1 -via-rhine.o := DRIVER_DEFS = -DINCLUDE_VIA_RHINE=1 -w89c840.o := DRIVER_DEFS = -DINCLUDE_W89C840=1 - -3c595.o := DRIVER_SRC = 3c595.c -3c90x.o := DRIVER_SRC = 3c90x.c -davicom.o := DRIVER_SRC = davicom.c -e1000.o := DRIVER_SRC = e1000.c -eepro100.o := DRIVER_SRC = eepro100.c -epic100.o := DRIVER_SRC = epic100.c -forcedeth.o := DRIVER_SRC = forcedeth.c -natsemi.o := DRIVER_SRC = natsemi.c -ns83820.o := DRIVER_SRC = ns83820.c -ns8390.o := DRIVER_SRC = ns8390.c -pcnet32.o := DRIVER_SRC = pcnet32.c -pnic.o := DRIVER_SRC = pnic.c -r8169.o := DRIVER_SRC = r8169.c -rtl8139.o := DRIVER_SRC = rtl8139.c -sis900.o := DRIVER_SRC = sis900.c -sundance.o := DRIVER_SRC = sundance.c -tg3.o := DRIVER_SRC = tg3.c -tlan.o := DRIVER_SRC = tlan.c -tulip.o := DRIVER_SRC = tulip.c -undi.o := DRIVER_SRC = undi.c -via-rhine.o := DRIVER_SRC = via-rhine.c -w89c840.o := DRIVER_SRC = w89c840.c - - -INCLUDES = -I. -I.. -I../stage2 -I../stage1 - -NET_EXTRAFLAGS = -DCONFIG_PCI \ - -DCONFIG_PCI_DIRECT=1 \ - -DCONGESTED=1 \ - -DNE_SCAN=0x280,0x300,0x320,0x340 \ - -DWD_DEFAULT_MEM=0xCC000 - -# -# Source files to be installed in $(SRC_DIR). -# -SRC_DIR = $(ROOT_SRC)/netboot -SRC_FILES = Makefile.am Makefile.in README.netboot \ - 3c595.c 3c595.h 3c90x.c basemem.c big_bswap.h bootp.h \ - byteswap.h config.c cpu.h davicom.c dev.h e1000.c \ - e1000_hw.h eepro100.c elf.h endian.h epic100.c epic100.h \ - etherboot.h forcedeth.c fsys_tftp.c grub.h i386_byteswap.h \ - i386_elf.h i386_endian.h i386_timer.c if_arp.h if_ether.h \ - igmp.h in.h io.h ip.h isa.h latch.h little_bswap.h mii.h \ - misc.c natsemi.c nfs.h nic.c nic.h ns83820.c ns8390.c \ - ns8390.h osdep.h pci.c pci.h pci_ids.h pci_io.c pcnet32.c \ - pic8259.c pic8259.h pnic.c pnic_api.h pxe.h r8169.c \ - rtl8139.c segoff.h sis900.c sis900.h stdint.h sundance.c \ - tftp.h tg3.c tg3.h timer.c timer.h tlan.c tlan.h tulip.c \ - types.h udp.h undi.c undi.h via-rhine.c w89c840.c - -INSTALL_TARGETS = $(SRC_FILES:%=$(SRC_DIR)/%) - - -all: $(LIBDRIVERS) - -$(LIBDRIVERS): $(LIBDRIVERS_OBJS) - $(RM) $@ - $(AR) cru $@ $(LIBDRIVERS_OBJS) - $(RANLIB) $@ - -$(LIB_OBJS): $$(@:libdrivers_a-%.o=%.c) - $(CC) $(CFLAGS) -c -o $@ $(@:libdrivers_a-%.o=%.c) - -$(DRIVER_OBJS): $$(DRIVER_SRC) - $(CC) $(CFLAGS) -c -o $@ $(DRIVER_SRC) - - -install: all $(INSTALL_TARGETS) - -$(SRC_DIR)/%: $(SRC_DIR) % - $(INS.file) - -$(SRC_DIR): - $(INS.dir) - - -clean: _FORCE - $(RM) *.o $(LIBDRIVERS) - -clobber: clean - -_FORCE: diff --git a/usr/src/grub/grub-0.95/netboot/README.netboot b/usr/src/grub/grub-0.95/netboot/README.netboot deleted file mode 100644 index 7edfaf02ec..0000000000 --- a/usr/src/grub/grub-0.95/netboot/README.netboot +++ /dev/null @@ -1,168 +0,0 @@ -You can use the netboot support to download OS images from a network. -Nearly all the device drivers are coming from the network-based boot -loader, Etherboot. Please visit its web page. They have rich -documentations so you will be able to get useful information from there. -The URL is . - -These below are common options for configure. Perhaps you may not need -to specify them. - ---disable-packet-retransmission - Turns off packet retransmission. Use it on an empty network, where - no packet collision can happen. - ---enable-pci-direct - Define this for PCI BIOSes that do not implement BIOS32 or not - correctly. - ---enable-diskless - Enable the diskless support. If specified, you will get two optional - images, called "nbgrub" and "pxegrub". The former is the ``Net Boot - Image Proposal'' format, which is used by Etherboot and Netboot, while - the latter is the ``Preboot Execution Environment" format, which is - used by a PXE ROM. You may buy a PXE ROM from some companies. - -Here is the information about the device drivers. They are all disabled -by default, so you must specify configure options to enable drivers you -want to use. Some drivers have extra per-driver options, so the extra -options are also described below. - -Caution: You should enable them as you need. Don't enable any -unnecessary driver, because GRUB might crash if you include too many -drivers at the same time. - -3Com509, ISA/EISA - --enable-3c509 - -3Com529 == MCA 3c509 - --enable-3c529 - -3Com59x and 3Com900 - --enable-3c595 - -3Com90x - --enable-3c90x - -Crystal Semiconductor CS89x0 - --enable-cs89x0 - --enable-cs-scan=LIST - Probe for CS89x0 base address using LIST of comma separated hex - addresses; increasing the address by one (0x300 -> 0x301) will force - a more aggressive probing algorithm. This might be neccessary after - a soft-reset of the NIC. - -Davicom DM9102 and 9009 - --enable-davicom - -Digital DE100 and DE200 - --enable-depca - -Intel Etherexpress Pro/10 (ISA card) - --enable-eepro - -Intel Etherexpress Pro/100 - --enable-eepro100 - -SMC 83c170 EPIC/100 - --enable-epic100 - -3Com507 - --enable-3c507 - -EXOS205 - --enable-exos205 - -Racal-Interlan NI5210 - --enable-ni5210 - -Lance PCI PCNet/32 -AMD HomePNA - --enable-lance - -Novell NE2100 and NE1500 - --enable-ne2100 - -Racal-Interlan NI6510 - --enable-ni6510 - -National Semiconductor DP8381x (Netgear FA311 and FA312) - --enable-natsemi - -Racal-Interlan NI5010 - --enable-ni5010 - -3Com503, aka Etherlink II, also /16 model - --enable-3c503 - --enable-3c503-shmem - Use 3c503 shared memory mode. - --enable-3c503-aui - Use AUI by default on 3c503 cards. - -NE1000/2000 and clones (ISA) - --enable-ne - --enable-ne-scan=LIST (0x280,0x300,0x320,0x340) - Probe for NE base address using LIST of comma separated hex - addresses. - -NE2000 PCI clone (RTL8029) -Winbond 86C940 -Compex RL2000 -KTI ET32P2 -NetVin 5000SC -Holtek 80232 - --enable-ns8390 - --enable-compex-rl2000-fix - If you have a Compex RL2000 PCI 32-bit (11F6:1401), and the probe - hangs in "Probing...[NE*000/PCI]", try enabling this fix... it - worked for me :). - -WD8003/8013, SMC8216/8416 - --enable-wd - --enable-wd-default-mem=MEM (0xCC000) - Default memory location for WD/SMC cards. - -Old base driver for Tulip clones - --enable-otulip - -Realtek 8139 -SMC 1211 -D-Link DFE530TX+ and DFE538TX - --enable-rtl8139 - -SIS 900 and SIS 7016 - --enable-sis900 - -Schneider and Koch G16 - --enable-sk-g16 - -SMC9000 - --enable-smc9000 - --enable-smc9000-scan=LIST - List of I/O addresses to probe. - -Tiara, Fujitsu Lancard - --enable-tiara - -Linksys LNE100TX and other NICs using this Tulip clone chip -Netgear FA310TX and other NICs using this Tulip clone chip -Tulip clones based on the ADMtek Centaur-P -Tulip clones based on the Macronix 987x5 -Tulip-Fast -Tulip+ -Tulip 21142 -ASIX AX88140 -Intel Tulip -Compex RL100-TX - --enable-tulip - -Rhine-I, e.g. D-Link DFE-530TX -Rhine-II - --enable-via-rhine - -Winbond W89c840 -Compex RL100-ATX - --enable-w89c840 - - -The description about how to use the support can be found in the GRUB -manual. Run "info grub" in the shell prompt. diff --git a/usr/src/grub/grub-0.95/netboot/basemem.c b/usr/src/grub/grub-0.95/netboot/basemem.c deleted file mode 100644 index ee99ab3b40..0000000000 --- a/usr/src/grub/grub-0.95/netboot/basemem.c +++ /dev/null @@ -1,178 +0,0 @@ -#include "etherboot.h" -#define DEBUG_BASEMEM -/* Routines to allocate base memory in a BIOS-compatible way, by - * updating the Free Base Memory Size counter at 40:13h. - * - * Michael Brown (mcb30) - * $Id: basemem.c,v 1.5 2004/06/17 12:48:08 fengshuo Exp $ - */ - -#define fbms ( ( uint16_t * ) phys_to_virt ( 0x413 ) ) -#define BASE_MEMORY_MAX ( 640 ) -#define FREE_BLOCK_MAGIC ( ('!'<<0) + ('F'<<8) + ('R'<<16) + ('E'<<24) ) - -typedef struct free_base_memory_block { - uint32_t magic; - uint16_t size_kb; -} free_base_memory_block_t; - -/* Return amount of free base memory in bytes - */ - -uint32_t get_free_base_memory ( void ) { - return *fbms << 10; -} - -/* Adjust the real mode stack pointer. We keep the real mode stack at - * the top of free base memory, rather than allocating space for it. - */ - -static inline void adjust_real_mode_stack ( void ) { -/* real_mode_stack = ( *fbms << 10 ); */ -} - -/* Allocate N bytes of base memory. Amount allocated will be rounded - * up to the nearest kB, since that's the granularity of the BIOS FBMS - * counter. Returns NULL if memory cannot be allocated. - */ - -void * allot_base_memory ( size_t size ) { - uint16_t size_kb = ( size + 1023 ) >> 10; - void *ptr = NULL; - -#ifdef DEBUG_BASEMEM - printf ( "Trying to allocate %d kB of base memory, %d kB free\n", - size_kb, *fbms ); -#endif - - /* Free up any unused memory before we start */ - free_unused_base_memory(); - - /* Check available base memory */ - if ( size_kb > *fbms ) { return NULL; } - - /* Reduce available base memory */ - *fbms -= size_kb; - - /* Calculate address of memory allocated */ - ptr = phys_to_virt ( *fbms << 10 ); - -#ifdef DEBUG_BASEMEM - /* Zero out memory. We do this so that allocation of - * already-used space will show up in the form of a crash as - * soon as possible. - */ - memset ( ptr, 0, size_kb << 10 ); -#endif - - /* Adjust real mode stack pointer */ - adjust_real_mode_stack (); - - return ptr; -} - -/* Free base memory allocated by allot_base_memory. The BIOS provides - * nothing better than a LIFO mechanism for freeing memory (i.e. it - * just has the single "total free memory" counter), but we improve - * upon this slightly; as long as you free all the allotted blocks, it - * doesn't matter what order you free them in. (This will only work - * for blocks that are freed via forget_base_memory()). - * - * Yes, it's annoying that you have to remember the size of the blocks - * you've allotted. However, since our granularity of allocation is - * 1K, the alternative is to risk wasting the occasional kB of base - * memory, which is a Bad Thing. Really, you should be using as - * little base memory as possible, so consider the awkwardness of the - * API to be a feature! :-) - */ - -void forget_base_memory ( void *ptr, size_t size ) { - uint16_t remainder = virt_to_phys(ptr) & 1023; - uint16_t size_kb = ( size + remainder + 1023 ) >> 10; - free_base_memory_block_t *free_block = - ( free_base_memory_block_t * ) ( ptr - remainder ); - - if ( ( ptr == NULL ) || ( size == 0 ) ) { return; } - -#ifdef DEBUG_BASEMEM - printf ( "Trying to free %d bytes base memory at 0x%x\n", - size, virt_to_phys ( ptr ) ); - if ( remainder > 0 ) { - printf ( "WARNING: destructively expanding free block " - "downwards to 0x%x\n", - virt_to_phys ( ptr - remainder ) ); - } -#endif - - /* Mark every kilobyte within this block as free. This is - * overkill for normal purposes, but helps when something has - * allocated base memory with a granularity finer than the - * BIOS granularity of 1kB. PXE ROMs tend to do this when - * they allocate their own memory. This method allows us to - * free their blocks (admittedly in a rather dangerous, - * tread-on-anything-either-side sort of way, but there's no - * other way to do it). - * - * Since we're marking every kB as free, there's actually no - * need for recording the size of the blocks. However, we - * keep this in so that debug messages are friendlier. It - * probably adds around 8 bytes to the overall code size. - */ - while ( size_kb > 0 ) { - /* Mark this block as unused */ - free_block->magic = FREE_BLOCK_MAGIC; - free_block->size_kb = size_kb; - /* Move up by 1 kB */ - free_block = (void *)free_block + ( 1 << 10 ); - size_kb--; - } - - /* Free up unused base memory */ - free_unused_base_memory(); -} - -/* Do the actual freeing of memory. This is split out from - * forget_base_memory() so that it may be called separately. It - * should be called whenever base memory is deallocated by an external - * entity (if we can detect that it has done so) so that we get the - * chance to free up our own blocks. - */ -void free_unused_base_memory ( void ) { - free_base_memory_block_t *free_block = NULL; - - /* Try to release memory back to the BIOS. Free all - * consecutive blocks marked as free. - */ - while ( 1 ) { - /* Calculate address of next potential free block */ - free_block = ( free_base_memory_block_t * ) - phys_to_virt ( *fbms << 10 ); - - /* Stop processing if we're all the way up to 640K or - * if this is not a free block - */ - if ( ( *fbms == BASE_MEMORY_MAX ) || - ( free_block->magic != FREE_BLOCK_MAGIC ) ) { - break; - } - - /* Return memory to BIOS */ - *fbms += free_block->size_kb; - -#ifdef DEBUG_BASEMEM - printf ( "Freed %d kB base memory, %d kB now free\n", - free_block->size_kb, *fbms ); - - /* Zero out freed block. We do this in case - * the block contained any structures that - * might be located by scanning through - * memory. - */ - memset ( free_block, 0, free_block->size_kb << 10 ); -#endif - } - - /* Adjust real mode stack pointer */ - adjust_real_mode_stack (); -} - diff --git a/usr/src/grub/grub-0.95/netboot/big_bswap.h b/usr/src/grub/grub-0.95/netboot/big_bswap.h deleted file mode 100644 index 66c3360e0a..0000000000 --- a/usr/src/grub/grub-0.95/netboot/big_bswap.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef ETHERBOOT_BIG_BSWAP_H -#define ETHERBOOT_BIG_BSWAP_H - -#define ntohl(x) (x) -#define htonl(x) (x) -#define ntohs(x) (x) -#define htons(x) (x) -#define cpu_to_le32(x) __bswap_32(x) -#define cpu_to_le16(x) __bswap_16(x) -#define cpu_to_be32(x) (x) -#define cpu_to_be16(x) (x) -#define le32_to_cpu(x) __bswap_32(x) -#define le16_to_cpu(x) __bswap_16(x) -#define be32_to_cpu(x) (x) -#define be16_to_cpu(x) (x) - -#endif /* ETHERBOOT_BIG_BSWAP_H */ diff --git a/usr/src/grub/grub-0.95/netboot/bootp.h b/usr/src/grub/grub-0.95/netboot/bootp.h deleted file mode 100644 index c6f6088074..0000000000 --- a/usr/src/grub/grub-0.95/netboot/bootp.h +++ /dev/null @@ -1,182 +0,0 @@ -#ifndef _BOOTP_H -#define _BOOTP_H - -#include "if_ether.h" -#include "ip.h" -#include "udp.h" - -#ifndef MAX_BOOTP_RETRIES -#define MAX_BOOTP_RETRIES 20 -#endif - -#ifdef ALTERNATE_DHCP_PORTS_1067_1068 -#undef NON_STANDARD_BOOTP_SERVER -#define NON_STANDARD_BOOTP_SERVER 1067 -#undef NON_STANDARD_BOOTP_CLIENT -#define NON_STANDARD_BOOTP_CLIENT 1068 -#endif - -#ifdef NON_STANDARD_BOOTP_SERVER -#define BOOTP_SERVER NON_STANDARD_BOOTP_SERVER -#else -#define BOOTP_SERVER 67 -#endif -#ifdef NON_STANDARD_BOOTP_CLIENT -#define BOOTP_CLIENT NON_STANDARD_BOOTP_CLIENT -#else -#define BOOTP_CLIENT 68 -#endif - -#define BOOTP_REQUEST 1 -#define BOOTP_REPLY 2 - -#define TAG_LEN(p) (*((p)+1)) -#define RFC1533_COOKIE 99, 130, 83, 99 -#define RFC1533_PAD 0 -#define RFC1533_NETMASK 1 -#define RFC1533_TIMEOFFSET 2 -#define RFC1533_GATEWAY 3 -#define RFC1533_TIMESERVER 4 -#define RFC1533_IEN116NS 5 -#define RFC1533_DNS 6 -#define RFC1533_LOGSERVER 7 -#define RFC1533_COOKIESERVER 8 -#define RFC1533_LPRSERVER 9 -#define RFC1533_IMPRESSSERVER 10 -#define RFC1533_RESOURCESERVER 11 -#define RFC1533_HOSTNAME 12 -#define RFC1533_BOOTFILESIZE 13 -#define RFC1533_MERITDUMPFILE 14 -#define RFC1533_DOMAINNAME 15 -#define RFC1533_SWAPSERVER 16 -#define RFC1533_ROOTPATH 17 -#define RFC1533_EXTENSIONPATH 18 -#define RFC1533_IPFORWARDING 19 -#define RFC1533_IPSOURCEROUTING 20 -#define RFC1533_IPPOLICYFILTER 21 -#define RFC1533_IPMAXREASSEMBLY 22 -#define RFC1533_IPTTL 23 -#define RFC1533_IPMTU 24 -#define RFC1533_IPMTUPLATEAU 25 -#define RFC1533_INTMTU 26 -#define RFC1533_INTLOCALSUBNETS 27 -#define RFC1533_INTBROADCAST 28 -#define RFC1533_INTICMPDISCOVER 29 -#define RFC1533_INTICMPRESPOND 30 -#define RFC1533_INTROUTEDISCOVER 31 -#define RFC1533_INTROUTESOLICIT 32 -#define RFC1533_INTSTATICROUTES 33 -#define RFC1533_LLTRAILERENCAP 34 -#define RFC1533_LLARPCACHETMO 35 -#define RFC1533_LLETHERNETENCAP 36 -#define RFC1533_TCPTTL 37 -#define RFC1533_TCPKEEPALIVETMO 38 -#define RFC1533_TCPKEEPALIVEGB 39 -#define RFC1533_NISDOMAIN 40 -#define RFC1533_NISSERVER 41 -#define RFC1533_NTPSERVER 42 -#define RFC1533_VENDOR 43 -#define RFC1533_NBNS 44 -#define RFC1533_NBDD 45 -#define RFC1533_NBNT 46 -#define RFC1533_NBSCOPE 47 -#define RFC1533_XFS 48 -#define RFC1533_XDM 49 -#ifndef NO_DHCP_SUPPORT -#define RFC2132_REQ_ADDR 50 -#define RFC2132_MSG_TYPE 53 -#define RFC2132_SRV_ID 54 -#define RFC2132_PARAM_LIST 55 -#define RFC2132_MAX_SIZE 57 -#define RFC2132_VENDOR_CLASS_ID 60 - -#define DHCPDISCOVER 1 -#define DHCPOFFER 2 -#define DHCPREQUEST 3 -#define DHCPACK 5 -#endif /* NO_DHCP_SUPPORT */ - -#define RFC1533_VENDOR_MAJOR 0 -#define RFC1533_VENDOR_MINOR 0 - -#define RFC1533_VENDOR_MAGIC 128 -#define RFC1533_VENDOR_ADDPARM 129 -#define RFC1533_VENDOR_ETHDEV 130 -#ifdef IMAGE_FREEBSD -#define RFC1533_VENDOR_HOWTO 132 -#define RFC1533_VENDOR_KERNEL_ENV 133 -#endif -#define RFC1533_VENDOR_ETHERBOOT_ENCAP 150 -#define RFC1533_VENDOR_MNUOPTS 160 -#define RFC1533_VENDOR_NIC_DEV_ID 175 -#define RFC1533_VENDOR_SELECTION 176 -#define RFC1533_VENDOR_ARCH 177 -#define RFC1533_VENDOR_MOTD 184 -#define RFC1533_VENDOR_NUMOFMOTD 8 -#define RFC1533_VENDOR_IMG 192 -#define RFC1533_VENDOR_NUMOFIMG 16 - -#define RFC1533_VENDOR_CONFIGFILE 150 - -#define RFC1533_END 255 - -#define BOOTP_VENDOR_LEN 64 - -#define DHCP_OPT_LEN 312 - -/* Format of a bootp packet */ -struct bootp_t { - uint8_t bp_op; - uint8_t bp_htype; - uint8_t bp_hlen; - uint8_t bp_hops; - uint32_t bp_xid; - uint16_t bp_secs; - uint16_t unused; - in_addr bp_ciaddr; - in_addr bp_yiaddr; - in_addr bp_siaddr; - in_addr bp_giaddr; - uint8_t bp_hwaddr[16]; - uint8_t bp_sname[64]; - char bp_file[128]; - uint8_t bp_vend[BOOTP_VENDOR_LEN]; -}; - -struct dhcp_t { - uint8_t bp_op; - uint8_t bp_htype; - uint8_t bp_hlen; - uint8_t bp_hops; - uint32_t bp_xid; - uint16_t bp_secs; - uint16_t bp_flag; - in_addr bp_ciaddr; - in_addr bp_yiaddr; - in_addr bp_siaddr; - in_addr bp_giaddr; - uint8_t bp_hwaddr[16]; - uint8_t bp_sname[64]; - char bp_file[128]; - uint8_t bp_vend[DHCP_OPT_LEN]; -}; - -/* Format of a bootp IP packet */ -struct bootpip_t -{ - struct iphdr ip; - struct udphdr udp; - struct bootp_t bp; -}; -struct dhcpip_t -{ - struct iphdr ip; - struct udphdr udp; - struct dhcp_t bp; -}; - -#define MAX_RFC1533_VENDLEN (ETH_MAX_MTU - sizeof(struct bootpip_t) + BOOTP_VENDOR_LEN) - -#define BOOTP_DATA_ADDR (&bootp_data) - -#endif /* _BOOTP_H */ diff --git a/usr/src/grub/grub-0.95/netboot/byteswap.h b/usr/src/grub/grub-0.95/netboot/byteswap.h deleted file mode 100644 index d9bef934fc..0000000000 --- a/usr/src/grub/grub-0.95/netboot/byteswap.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef ETHERBOOT_BYTESWAP_H -#define ETHERBOOT_BYTESWAP_H - -#include "endian.h" -#include "i386_byteswap.h" - -#if __BYTE_ORDER == __LITTLE_ENDIAN -#include "little_bswap.h" -#endif -#if __BYTE_ORDER == __BIG_ENDIAN -#include "big_bswap.h" -#endif - -/* Make routines available to all */ -#define swap32(x) __bswap_32(x) -#define swap16(x) __bswap_16(x) -#define bswap_32(x) __bswap_32(x) -#define bswap_16(x) __bswap_16(x) - -#endif /* ETHERBOOT_BYTESWAP_H */ diff --git a/usr/src/grub/grub-0.95/netboot/config.c b/usr/src/grub/grub-0.95/netboot/config.c deleted file mode 100644 index 39f70c474d..0000000000 --- a/usr/src/grub/grub-0.95/netboot/config.c +++ /dev/null @@ -1,165 +0,0 @@ -/* - * 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. - */ - -#include "grub.h" -#include "pci.h" -#include "isa.h" -#include "nic.h" - -#ifdef CONFIG_PCI -static int pci_probe(struct dev *dev, const char *type_name) -{ -/* - * NIC probing is in pci device order, followed by the - * link order of the drivers. A driver that matches - * on vendor and device id will supersede a driver - * that matches on pci class. - * - * If you want to probe for another device behind the same pci - * device just increment index. And the previous probe call - * will be repeated. - */ - struct pci_probe_state *state = &dev->state.pci; - printf("Probing pci %s...\n", type_name); - if (dev->how_probe == PROBE_FIRST) { - state->advance = 1; - state->dev.driver = 0; - state->dev.bus = 0; - state->dev.devfn = 0; - dev->index = -1; - } - for(;;) { - if ((dev->how_probe != PROBE_AWAKE) && state->advance) { - find_pci(dev->type, &state->dev); - dev->index = -1; - } - state->advance = 1; - - if (state->dev.driver == 0) - break; - -#if 0 - /* FIXME the romaddr code needs a total rethought to be useful */ - if (state->dev.romaddr != ((unsigned long) rom.rom_segment << 4)) { - continue; - } -#endif - if (dev->how_probe != PROBE_AWAKE) { - dev->type_index++; - } - dev->devid.bus_type = PCI_BUS_TYPE; - dev->devid.vendor_id = htons(state->dev.vendor); - dev->devid.device_id = htons(state->dev.dev_id); - /* FIXME how do I handle dev->index + PROBE_AGAIN?? */ - - printf("[%s]", state->dev.name); - if (state->dev.driver->probe(dev, &state->dev)) { - state->advance = (dev->index == -1); - return PROBE_WORKED; - } - putchar('\n'); - } - return PROBE_FAILED; -} -#endif - -#ifdef CONFIG_ISA -static int isa_probe(struct dev *dev, const char *type_name) -{ -/* - * NIC probing is in the order the drivers were linked togeter. - * If for some reason you want to change the order, - * just change the order you list the drivers in. - */ - struct isa_probe_state *state = &dev->state.isa; - printf("Probing isa %s...\n", type_name); - if (dev->how_probe == PROBE_FIRST) { - state->advance = 0; - state->driver = isa_drivers; - dev->index = -1; - } - for(;;) - { - if ((dev->how_probe != PROBE_AWAKE) && state->advance) { - state->driver++; - dev->index = -1; - } - state->advance = 1; - - if (state->driver >= isa_drivers_end) - break; - - if (state->driver->type != dev->type) - continue; - - if (dev->how_probe != PROBE_AWAKE) { - dev->type_index++; - } - printf("[%s]", state->driver->name); - dev->devid.bus_type = ISA_BUS_TYPE; - /* FIXME how do I handle dev->index + PROBE_AGAIN?? */ - /* driver will fill in vendor and device IDs */ - if (state->driver->probe(dev, state->driver->ioaddrs)) { - state->advance = (dev->index == -1); - return PROBE_WORKED; - } - putchar('\n'); - } - return PROBE_FAILED; -} -#else -#define isa_probe(d,tn) (PROBE_FAILED) -#endif -static const char *driver_name[] = { - "nic", - "disk", - "floppy", -}; -int probe(struct dev *dev) -{ - const char *type_name; - - EnterFunction("probe"); - - type_name = ""; - if ((dev->type >= 0) && - (dev->type < sizeof(driver_name)/sizeof(driver_name[0]))) { - type_name = driver_name[dev->type]; - } - if (dev->how_probe == PROBE_FIRST) { - dev->to_probe = PROBE_PCI; - memset(&dev->state, 0, sizeof(dev->state)); - } - if (dev->to_probe == PROBE_PCI) { - dev->how_probe = pci_probe(dev, type_name); - if (dev->how_probe == PROBE_FAILED) { - dev->to_probe = PROBE_ISA; - } - } - if (dev->to_probe == PROBE_ISA) { - dev->how_probe = isa_probe(dev, type_name); - if (dev->how_probe == PROBE_FAILED) { - dev->to_probe = PROBE_NONE; - } - } - if ((dev->to_probe != PROBE_PCI) && - (dev->to_probe != PROBE_ISA)) { - dev->how_probe = PROBE_FAILED; - - } - - LeaveFunction("probe"); - return dev->how_probe; -} - -void disable(struct dev *dev) -{ - if (dev->disable) { - dev->disable(dev); - dev->disable = 0; - } -} diff --git a/usr/src/grub/grub-0.95/netboot/cpu.h b/usr/src/grub/grub-0.95/netboot/cpu.h deleted file mode 100644 index 2e9b27ba91..0000000000 --- a/usr/src/grub/grub-0.95/netboot/cpu.h +++ /dev/null @@ -1,243 +0,0 @@ -#ifndef I386_BITS_CPU_H -#define I386_BITS_CPU_H - - -/* Sample usage: CPU_FEATURE_P(cpu.x86_capability, FPU) */ -#define CPU_FEATURE_P(CAP, FEATURE) \ - (!!(CAP[(X86_FEATURE_##FEATURE)/32] & ((X86_FEATURE_##FEATURE) & 0x1f))) - -#define NCAPINTS 4 /* Currently we have 4 32-bit words worth of info */ - -/* Intel-defined CPU features, CPUID level 0x00000001, word 0 */ -#define X86_FEATURE_FPU (0*32+ 0) /* Onboard FPU */ -#define X86_FEATURE_VME (0*32+ 1) /* Virtual Mode Extensions */ -#define X86_FEATURE_DE (0*32+ 2) /* Debugging Extensions */ -#define X86_FEATURE_PSE (0*32+ 3) /* Page Size Extensions */ -#define X86_FEATURE_TSC (0*32+ 4) /* Time Stamp Counter */ -#define X86_FEATURE_MSR (0*32+ 5) /* Model-Specific Registers, RDMSR, WRMSR */ -#define X86_FEATURE_PAE (0*32+ 6) /* Physical Address Extensions */ -#define X86_FEATURE_MCE (0*32+ 7) /* Machine Check Architecture */ -#define X86_FEATURE_CX8 (0*32+ 8) /* CMPXCHG8 instruction */ -#define X86_FEATURE_APIC (0*32+ 9) /* Onboard APIC */ -#define X86_FEATURE_SEP (0*32+11) /* SYSENTER/SYSEXIT */ -#define X86_FEATURE_MTRR (0*32+12) /* Memory Type Range Registers */ -#define X86_FEATURE_PGE (0*32+13) /* Page Global Enable */ -#define X86_FEATURE_MCA (0*32+14) /* Machine Check Architecture */ -#define X86_FEATURE_CMOV (0*32+15) /* CMOV instruction (FCMOVCC and FCOMI too if FPU present) */ -#define X86_FEATURE_PAT (0*32+16) /* Page Attribute Table */ -#define X86_FEATURE_PSE36 (0*32+17) /* 36-bit PSEs */ -#define X86_FEATURE_PN (0*32+18) /* Processor serial number */ -#define X86_FEATURE_CLFLSH (0*32+19) /* Supports the CLFLUSH instruction */ -#define X86_FEATURE_DTES (0*32+21) /* Debug Trace Store */ -#define X86_FEATURE_ACPI (0*32+22) /* ACPI via MSR */ -#define X86_FEATURE_MMX (0*32+23) /* Multimedia Extensions */ -#define X86_FEATURE_FXSR (0*32+24) /* FXSAVE and FXRSTOR instructions (fast save and restore */ - /* of FPU context), and CR4.OSFXSR available */ -#define X86_FEATURE_XMM (0*32+25) /* Streaming SIMD Extensions */ -#define X86_FEATURE_XMM2 (0*32+26) /* Streaming SIMD Extensions-2 */ -#define X86_FEATURE_SELFSNOOP (0*32+27) /* CPU self snoop */ -#define X86_FEATURE_HT (0*32+28) /* Hyper-Threading */ -#define X86_FEATURE_ACC (0*32+29) /* Automatic clock control */ -#define X86_FEATURE_IA64 (0*32+30) /* IA-64 processor */ - -/* AMD-defined CPU features, CPUID level 0x80000001, word 1 */ -/* Don't duplicate feature flags which are redundant with Intel! */ -#define X86_FEATURE_SYSCALL (1*32+11) /* SYSCALL/SYSRET */ -#define X86_FEATURE_MMXEXT (1*32+22) /* AMD MMX extensions */ -#define X86_FEATURE_LM (1*32+29) /* Long Mode (x86-64) */ -#define X86_FEATURE_3DNOWEXT (1*32+30) /* AMD 3DNow! extensions */ -#define X86_FEATURE_3DNOW (1*32+31) /* 3DNow! */ - -/* Transmeta-defined CPU features, CPUID level 0x80860001, word 2 */ -#define X86_FEATURE_RECOVERY (2*32+ 0) /* CPU in recovery mode */ -#define X86_FEATURE_LONGRUN (2*32+ 1) /* Longrun power control */ -#define X86_FEATURE_LRTI (2*32+ 3) /* LongRun table interface */ - -/* Other features, Linux-defined mapping, word 3 */ -/* This range is used for feature bits which conflict or are synthesized */ -#define X86_FEATURE_CXMMX (3*32+ 0) /* Cyrix MMX extensions */ -#define X86_FEATURE_K6_MTRR (3*32+ 1) /* AMD K6 nonstandard MTRRs */ -#define X86_FEATURE_CYRIX_ARR (3*32+ 2) /* Cyrix ARRs (= MTRRs) */ -#define X86_FEATURE_CENTAUR_MCR (3*32+ 3) /* Centaur MCRs (= MTRRs) */ - -#define MAX_X86_VENDOR_ID 16 -struct cpuinfo_x86 { - uint8_t x86; /* CPU family */ - uint8_t x86_model; - uint8_t x86_mask; - - int cpuid_level; /* Maximum supported CPUID level, -1=no CPUID */ - unsigned x86_capability[NCAPINTS]; - char x86_vendor_id[MAX_X86_VENDOR_ID]; -}; - - -#define X86_VENDOR_INTEL 0 -#define X86_VENDOR_CYRIX 1 -#define X86_VENDOR_AMD 2 -#define X86_VENDOR_UMC 3 -#define X86_VENDOR_NEXGEN 4 -#define X86_VENDOR_CENTAUR 5 -#define X86_VENDOR_RISE 6 -#define X86_VENDOR_TRANSMETA 7 -#define X86_VENDOR_NSC 8 -#define X86_VENDOR_UNKNOWN 0xff - -/* - * EFLAGS bits - */ -#define X86_EFLAGS_CF 0x00000001 /* Carry Flag */ -#define X86_EFLAGS_PF 0x00000004 /* Parity Flag */ -#define X86_EFLAGS_AF 0x00000010 /* Auxillary carry Flag */ -#define X86_EFLAGS_ZF 0x00000040 /* Zero Flag */ -#define X86_EFLAGS_SF 0x00000080 /* Sign Flag */ -#define X86_EFLAGS_TF 0x00000100 /* Trap Flag */ -#define X86_EFLAGS_IF 0x00000200 /* Interrupt Flag */ -#define X86_EFLAGS_DF 0x00000400 /* Direction Flag */ -#define X86_EFLAGS_OF 0x00000800 /* Overflow Flag */ -#define X86_EFLAGS_IOPL 0x00003000 /* IOPL mask */ -#define X86_EFLAGS_NT 0x00004000 /* Nested Task */ -#define X86_EFLAGS_RF 0x00010000 /* Resume Flag */ -#define X86_EFLAGS_VM 0x00020000 /* Virtual Mode */ -#define X86_EFLAGS_AC 0x00040000 /* Alignment Check */ -#define X86_EFLAGS_VIF 0x00080000 /* Virtual Interrupt Flag */ -#define X86_EFLAGS_VIP 0x00100000 /* Virtual Interrupt Pending */ -#define X86_EFLAGS_ID 0x00200000 /* CPUID detection flag */ - -/* - * Generic CPUID function - */ -static inline void cpuid(int op, - unsigned int *eax, unsigned int *ebx, unsigned int *ecx, unsigned int *edx) -{ - __asm__("cpuid" - : "=a" (*eax), - "=b" (*ebx), - "=c" (*ecx), - "=d" (*edx) - : "0" (op)); -} - -/* - * CPUID functions returning a single datum - */ -static inline unsigned int cpuid_eax(unsigned int op) -{ - unsigned int eax; - - __asm__("cpuid" - : "=a" (eax) - : "0" (op) - : "bx", "cx", "dx"); - return eax; -} -static inline unsigned int cpuid_ebx(unsigned int op) -{ - unsigned int eax, ebx; - - __asm__("cpuid" - : "=a" (eax), "=b" (ebx) - : "0" (op) - : "cx", "dx" ); - return ebx; -} -static inline unsigned int cpuid_ecx(unsigned int op) -{ - unsigned int eax, ecx; - - __asm__("cpuid" - : "=a" (eax), "=c" (ecx) - : "0" (op) - : "bx", "dx" ); - return ecx; -} -static inline unsigned int cpuid_edx(unsigned int op) -{ - unsigned int eax, edx; - - __asm__("cpuid" - : "=a" (eax), "=d" (edx) - : "0" (op) - : "bx", "cx"); - return edx; -} - -/* - * Intel CPU features in CR4 - */ -#define X86_CR4_VME 0x0001 /* enable vm86 extensions */ -#define X86_CR4_PVI 0x0002 /* virtual interrupts flag enable */ -#define X86_CR4_TSD 0x0004 /* disable time stamp at ipl 3 */ -#define X86_CR4_DE 0x0008 /* enable debugging extensions */ -#define X86_CR4_PSE 0x0010 /* enable page size extensions */ -#define X86_CR4_PAE 0x0020 /* enable physical address extensions */ -#define X86_CR4_MCE 0x0040 /* Machine check enable */ -#define X86_CR4_PGE 0x0080 /* enable global pages */ -#define X86_CR4_PCE 0x0100 /* enable performance counters at ipl 3 */ -#define X86_CR4_OSFXSR 0x0200 /* enable fast FPU save and restore */ -#define X86_CR4_OSXMMEXCPT 0x0400 /* enable unmasked SSE exceptions */ - - -#define MSR_K6_EFER 0xC0000080 -/* EFER bits: */ -#define _EFER_SCE 0 /* SYSCALL/SYSRET */ -#define _EFER_LME 8 /* Long mode enable */ -#define _EFER_LMA 10 /* Long mode active (read-only) */ -#define _EFER_NX 11 /* No execute enable */ - -#define EFER_SCE (1<<_EFER_SCE) -#define EFER_LME (1<0; i=i>>1) - phy_write_1bit(io_dcr9, phy_addr&i ? PHY_DATA_1: PHY_DATA_0); - - /* Send register addres */ - for (i=0x10; i>0; i=i>>1) - phy_write_1bit(io_dcr9, location&i ? PHY_DATA_1: PHY_DATA_0); - - /* Skip transition state */ - phy_read_1bit(io_dcr9); - - /* read 16bit data */ - for (phy_data=0, i=0; i<16; i++) { - phy_data<<=1; - phy_data|=phy_read_1bit(io_dcr9); - } - - return phy_data; -} - -/* - Write a word to Phy register -*/ -static void phy_write(int location, u16 phy_data) -{ - u16 i, phy_addr=1; - u32 io_dcr9; - - whereami("phy_write\n"); - - io_dcr9 = ioaddr + CSR9; - - /* Send 33 synchronization clock to Phy controller */ - for (i=0; i<34; i++) - phy_write_1bit(io_dcr9, PHY_DATA_1); - - /* Send start command(01) to Phy */ - phy_write_1bit(io_dcr9, PHY_DATA_0); - phy_write_1bit(io_dcr9, PHY_DATA_1); - - /* Send write command(01) to Phy */ - phy_write_1bit(io_dcr9, PHY_DATA_0); - phy_write_1bit(io_dcr9, PHY_DATA_1); - - /* Send Phy addres */ - for (i=0x10; i>0; i=i>>1) - phy_write_1bit(io_dcr9, phy_addr&i ? PHY_DATA_1: PHY_DATA_0); - - /* Send register addres */ - for (i=0x10; i>0; i=i>>1) - phy_write_1bit(io_dcr9, location&i ? PHY_DATA_1: PHY_DATA_0); - - /* written trasnition */ - phy_write_1bit(io_dcr9, PHY_DATA_1); - phy_write_1bit(io_dcr9, PHY_DATA_0); - - /* Write a word data to PHY controller */ - for (i=0x8000; i>0; i>>=1) - phy_write_1bit(io_dcr9, phy_data&i ? PHY_DATA_1: PHY_DATA_0); -} - -/* - Write one bit data to Phy Controller -*/ -static void phy_write_1bit(u32 ee_addr, u32 phy_data) -{ - whereami("phy_write_1bit\n"); - outl(phy_data, ee_addr); /* MII Clock Low */ - eeprom_delay(); - outl(phy_data|MDCLKH, ee_addr); /* MII Clock High */ - eeprom_delay(); - outl(phy_data, ee_addr); /* MII Clock Low */ - eeprom_delay(); -} - -/* - Read one bit phy data from PHY controller -*/ -static int phy_read_1bit(u32 ee_addr) -{ - int phy_data; - - whereami("phy_read_1bit\n"); - - outl(0x50000, ee_addr); - eeprom_delay(); - - phy_data=(inl(ee_addr)>>19) & 0x1; - - outl(0x40000, ee_addr); - eeprom_delay(); - - return phy_data; -} - -/* - DM9801/DM9802 present check and program -*/ -static void HPNA_process(void) -{ - - if ( (phy_read(3) & 0xfff0) == 0xb900 ) { - if ( phy_read(31) == 0x4404 ) { - /* DM9801 present */ - if (phy_read(3) == 0xb901) - phy_write(16, 0x5); /* DM9801 E4 */ - else - phy_write(16, 0x1005); /* DM9801 E3 and others */ - phy_write(25, ((phy_read(24) + 3) & 0xff) | 0xf000); - } else { - /* DM9802 present */ - phy_write(16, 0x5); - phy_write(25, (phy_read(25) & 0xff00) + 2); - } - } -} - -/* - Sense media mode and set CR6 -*/ -static void davicom_media_chk(struct nic * nic __unused) -{ - unsigned long to, csr6; - - csr6 = 0x00200000; /* SF */ - outl(csr6, ioaddr + CSR6); - - if (vendor == PCI_VENDOR_ID_DAVICOM && dev_id == PCI_DEVICE_ID_DM9009) { - /* Set to 10BaseT mode for DM9009 */ - phy_write(0, 0); - } else { - /* For DM9102/DM9102A */ - to = currticks() + 2 * TICKS_PER_SEC; - while ( ((phy_read(1) & 0x24)!=0x24) && (currticks() < to)) - /* wait */ ; - - if ( (phy_read(1) & 0x24) == 0x24 ) { - if (phy_read(17) & 0xa000) - csr6 |= 0x00000200; /* Full Duplex mode */ - } else - csr6 |= 0x00040000; /* Select DM9801/DM9802 when Ethernet link failed */ - } - - /* set the chip's operating mode */ - outl(csr6, ioaddr + CSR6); - - /* DM9801/DM9802 present check & program */ - if (csr6 & 0x40000) - HPNA_process(); -} - - -/*********************************************************************/ -/* EEPROM Reading Code */ -/*********************************************************************/ -/* EEPROM routines adapted from the Linux Tulip Code */ -/* Reading a serial EEPROM is a "bit" grungy, but we work our way - through:->. -*/ -static int read_eeprom(unsigned long ioaddr, int location, int addr_len) -{ - int i; - unsigned short retval = 0; - long ee_addr = ioaddr + CSR9; - int read_cmd = location | EE_READ_CMD; - - whereami("read_eeprom\n"); - - outl(EE_ENB & ~EE_CS, ee_addr); - outl(EE_ENB, ee_addr); - - /* Shift the read command bits out. */ - for (i = 4 + addr_len; i >= 0; i--) { - short dataval = (read_cmd & (1 << i)) ? EE_DATA_WRITE : 0; - outl(EE_ENB | dataval, ee_addr); - eeprom_delay(); - outl(EE_ENB | dataval | EE_SHIFT_CLK, ee_addr); - eeprom_delay(); - } - outl(EE_ENB, ee_addr); - - for (i = 16; i > 0; i--) { - outl(EE_ENB | EE_SHIFT_CLK, ee_addr); - eeprom_delay(); - retval = (retval << 1) | ((inl(ee_addr) & EE_DATA_READ) ? 1 : 0); - outl(EE_ENB, ee_addr); - eeprom_delay(); - } - - /* Terminate the EEPROM access. */ - outl(EE_ENB & ~EE_CS, ee_addr); - return retval; -} - -/*********************************************************************/ -/* davicom_init_chain - setup the tx and rx descriptors */ -/* Sten 10/9 */ -/*********************************************************************/ -static void davicom_init_chain(struct nic *nic) -{ - int i; - - /* setup the transmit descriptor */ - /* Sten: Set 2 TX descriptor but use one TX buffer because - it transmit a packet and wait complete every time. */ - for (i=0; inode_addr[0]; - txb[1] = nic->node_addr[1]; - txb[4] = nic->node_addr[2]; - txb[5] = nic->node_addr[3]; - txb[8] = nic->node_addr[4]; - txb[9] = nic->node_addr[5]; - - /* setup receive descriptor */ - for (i=0; i= to) { - printf ("TX Setup Timeout!\n"); - } - /* Point to next TX descriptor */ - TxPtr = (++TxPtr >= NTXD) ? 0:TxPtr; /* Sten 10/9 */ - -#ifdef DAVICOM_DEBUG - printf("txd.status = %X\n", txd.status); - printf("ticks = %d\n", currticks() - (to - TX_TIME_OUT)); - davicom_more(); -#endif - - /* enable RX */ - outl(inl(ioaddr + CSR6) | 0x00000002, ioaddr + CSR6); - /* immediate poll demand */ - outl(0, ioaddr + CSR2); -} - - -/*********************************************************************/ -/* eth_transmit - Transmit a frame */ -/*********************************************************************/ -static void davicom_transmit(struct nic *nic, const char *d, unsigned int t, - unsigned int s, const char *p) -{ - unsigned long to; - - whereami("davicom_transmit\n"); - - /* Stop Tx */ - /* outl(inl(ioaddr + CSR6) & ~0x00002000, ioaddr + CSR6); */ - - /* setup ethernet header */ - memcpy(&txb[0], d, ETH_ALEN); /* DA 6byte */ - memcpy(&txb[ETH_ALEN], nic->node_addr, ETH_ALEN); /* SA 6byte*/ - txb[ETH_ALEN*2] = (t >> 8) & 0xFF; /* Frame type: 2byte */ - txb[ETH_ALEN*2+1] = t & 0xFF; - memcpy(&txb[ETH_HLEN], p, s); /* Frame data */ - - /* setup the transmit descriptor */ - txd[TxPtr].buf1sz = ETH_HLEN+s; - txd[TxPtr].control = 0x00000184; /* LS+FS+CE */ - txd[TxPtr].status = 0x80000000; /* give ownership to device */ - - /* immediate transmit demand */ - outl(0, ioaddr + CSR1); - - to = currticks() + TX_TIME_OUT; - while ((txd[TxPtr].status & 0x80000000) && (currticks() < to)) - /* wait */ ; - - if (currticks() >= to) { - printf ("TX Timeout!\n"); - } - - /* Point to next TX descriptor */ - TxPtr = (++TxPtr >= NTXD) ? 0:TxPtr; /* Sten 10/9 */ - -} - -/*********************************************************************/ -/* eth_poll - Wait for a frame */ -/*********************************************************************/ -static int davicom_poll(struct nic *nic, int retrieve) -{ - whereami("davicom_poll\n"); - - if (rxd[rxd_tail].status & 0x80000000) - return 0; - - if ( ! retrieve ) return 1; - - whereami("davicom_poll got one\n"); - - nic->packetlen = (rxd[rxd_tail].status & 0x3FFF0000) >> 16; - - if( rxd[rxd_tail].status & 0x00008000){ - rxd[rxd_tail].status = 0x80000000; - rxd_tail++; - if (rxd_tail == NRXD) rxd_tail = 0; - return 0; - } - - /* copy packet to working buffer */ - /* XXX - this copy could be avoided with a little more work - but for now we are content with it because the optimised - memcpy is quite fast */ - - memcpy(nic->packet, rxb + rxd_tail * BUFLEN, nic->packetlen); - - /* return the descriptor and buffer to receive ring */ - rxd[rxd_tail].status = 0x80000000; - rxd_tail++; - if (rxd_tail == NRXD) rxd_tail = 0; - - return 1; -} - -/*********************************************************************/ -/* eth_disable - Disable the interface */ -/*********************************************************************/ -static void davicom_disable(struct dev *dev) -{ - struct nic *nic = (struct nic *)dev; - whereami("davicom_disable\n"); - - davicom_reset(nic); - - /* disable interrupts */ - outl(0x00000000, ioaddr + CSR7); - - /* Stop the chip's Tx and Rx processes. */ - outl(inl(ioaddr + CSR6) & ~0x00002002, ioaddr + CSR6); - - /* Clear the missed-packet counter. */ - (volatile unsigned long)inl(ioaddr + CSR8); -} - - -/*********************************************************************/ -/* eth_irq - enable, disable and force interrupts */ -/*********************************************************************/ -static void davicom_irq(struct nic *nic __unused, irq_action_t action __unused) -{ - switch ( action ) { - case DISABLE : - break; - case ENABLE : - break; - case FORCE : - break; - } -} - - -/*********************************************************************/ -/* eth_probe - Look for an adapter */ -/*********************************************************************/ -static int davicom_probe(struct dev *dev, struct pci_device *pci) -{ - struct nic *nic = (struct nic *)dev; - unsigned int i; - - whereami("davicom_probe\n"); - - if (pci->ioaddr == 0) - return 0; - - vendor = pci->vendor; - dev_id = pci->dev_id; - ioaddr = pci->ioaddr & ~3; - - nic->irqno = 0; - nic->ioaddr = pci->ioaddr & ~3; - - /* wakeup chip */ - pcibios_write_config_dword(pci->bus, pci->devfn, 0x40, 0x00000000); - - /* Stop the chip's Tx and Rx processes. */ - outl(inl(ioaddr + CSR6) & ~0x00002002, ioaddr + CSR6); - - /* Clear the missed-packet counter. */ - (volatile unsigned long)inl(ioaddr + CSR8); - - /* Get MAC Address */ - /* read EEPROM data */ - for (i = 0; i < sizeof(ee_data)/2; i++) - ((unsigned short *)ee_data)[i] = - le16_to_cpu(read_eeprom(ioaddr, i, EEPROM_ADDRLEN)); - - /* extract MAC address from EEPROM buffer */ - for (i=0; inode_addr[i] = ee_data[20+i]; - - printf("Davicom %! at ioaddr %#hX\n", nic->node_addr, ioaddr); - - /* initialize device */ - davicom_reset(nic); - - dev->disable = davicom_disable; - nic->poll = davicom_poll; - nic->transmit = davicom_transmit; - nic->irq = davicom_irq; - - return 1; -} - -static struct pci_id davicom_nics[] = { -PCI_ROM(0x1282, 0x9100, "davicom9100", "Davicom 9100"), -PCI_ROM(0x1282, 0x9102, "davicom9102", "Davicom 9102"), -PCI_ROM(0x1282, 0x9009, "davicom9009", "Davicom 9009"), -PCI_ROM(0x1282, 0x9132, "davicom9132", "Davicom 9132"), /* Needs probably some fixing */ -}; - -struct pci_driver davicom_driver = { - .type = NIC_DRIVER, - .name = "DAVICOM", - .probe = davicom_probe, - .ids = davicom_nics, - .id_count = sizeof(davicom_nics)/sizeof(davicom_nics[0]), - .class = 0, -}; diff --git a/usr/src/grub/grub-0.95/netboot/dev.h b/usr/src/grub/grub-0.95/netboot/dev.h deleted file mode 100644 index 5578e8ef0c..0000000000 --- a/usr/src/grub/grub-0.95/netboot/dev.h +++ /dev/null @@ -1,83 +0,0 @@ -#ifndef _DEV_H -#define _DEV_H - -#include "isa.h" -#include "pci.h" - -/* Need to check the packing of this struct if Etherboot is ported */ -struct dev_id -{ - unsigned short vendor_id; - unsigned short device_id; - unsigned char bus_type; -#define PCI_BUS_TYPE 1 -#define ISA_BUS_TYPE 2 -}; - -/* Dont use sizeof, that will include the padding */ -#define DEV_ID_SIZE 8 - - -struct pci_probe_state -{ -#ifdef CONFIG_PCI - struct pci_device dev; - int advance; -#else - int dummy; -#endif -}; -struct isa_probe_state -{ -#ifdef CONFIG_ISA - const struct isa_driver *driver; - int advance; -#else - int dummy; -#endif -}; - -union probe_state -{ - struct pci_probe_state pci; - struct isa_probe_state isa; -}; - -struct dev -{ - void (*disable)P((struct dev *)); - struct dev_id devid; /* device ID string (sent to DHCP server) */ - int index; /* Index of next device on this controller to probe */ - int type; /* Type of device I am probing for */ - int how_probe; /* First, next or awake */ - int to_probe; /* Flavor of device I am probing */ - int failsafe; /* Failsafe probe requested */ - int type_index; /* Index of this device (within type) */ -#define PROBE_NONE 0 -#define PROBE_PCI 1 -#define PROBE_ISA 2 - union probe_state state; -}; - - -#define NIC_DRIVER 0 -#define DISK_DRIVER 1 -#define FLOPPY_DRIVER 2 - -#define BRIDGE_DRIVER 1000 - -#define PROBE_FIRST (-1) -#define PROBE_NEXT 0 -#define PROBE_AWAKE 1 /* After calling disable bring up the same device */ - -/* The probe result codes are selected - * to allow them to be fed back into the probe - * routine and get a successful probe. - */ -#define PROBE_FAILED PROBE_FIRST -#define PROBE_WORKED PROBE_NEXT - -extern int probe(struct dev *dev); -extern void disable(struct dev *dev); - -#endif /* _DEV_H */ diff --git a/usr/src/grub/grub-0.95/netboot/e1000.c b/usr/src/grub/grub-0.95/netboot/e1000.c deleted file mode 100644 index ad88420863..0000000000 --- a/usr/src/grub/grub-0.95/netboot/e1000.c +++ /dev/null @@ -1,3682 +0,0 @@ -/************************************************************************** -Etherboot - BOOTP/TFTP Bootstrap Program -Inter Pro 1000 for Etherboot -Drivers are port from Intel's Linux driver e1000-4.3.15 - -***************************************************************************/ -/******************************************************************************* - - - Copyright(c) 1999 - 2003 Intel 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 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. - - The full GNU General Public License is included in this distribution in the - file called LICENSE. - - Contact Information: - Linux NICS - Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - -*******************************************************************************/ -/* - * Copyright (C) Archway Digital Solutions. - * - * written by Chrsitopher Li or - * 2/9/2002 - * - * Copyright (C) Linux Networx. - * Massive upgrade to work with the new intel gigabit NICs. - * - * - * Support for 82541ei & 82547ei chips from Intel's Linux driver 5.1.13 added by - * Georg Baum , sponsored by PetaMem GmbH and linkLINE Communications, Inc. - * - * 01/2004: Updated to Linux driver 5.2.22 by Georg Baum - */ - -/* to get some global routines like printf */ -#include "etherboot.h" -/* to get the interface to the body of the program */ -#include "nic.h" -/* to get the PCI support functions, if this is a PCI NIC */ -#include "pci.h" -#include "timer.h" - -typedef unsigned char *dma_addr_t; - -typedef enum { - FALSE = 0, - TRUE = 1 -} boolean_t; - -#define DEBUG 0 - - -/* Some pieces of code are disabled with #if 0 ... #endif. - * They are not deleted to show where the etherboot driver differs - * from the linux driver below the function level. - * Some member variables of the hw struct have been eliminated - * and the corresponding inplace checks inserted instead. - * Pieces such as LED handling that we definitely don't need are deleted. - * - * The following defines should not be needed normally, - * but may be helpful for debugging purposes. */ - -/* Define this if you want to program the transmission control register - * the way the Linux driver does it. */ -#undef LINUX_DRIVER_TCTL - -/* Define this to behave more like the Linux driver. */ -#undef LINUX_DRIVER - -#include "e1000_hw.h" - -/* NIC specific static variables go here */ -static struct e1000_hw hw; -static char tx_pool[128 + 16]; -static char rx_pool[128 + 16]; -static char packet[2096]; - -static struct e1000_tx_desc *tx_base; -static struct e1000_rx_desc *rx_base; - -static int tx_tail; -static int rx_tail, rx_last; - -/* Function forward declarations */ -static int e1000_setup_link(struct e1000_hw *hw); -static int e1000_setup_fiber_serdes_link(struct e1000_hw *hw); -static int e1000_setup_copper_link(struct e1000_hw *hw); -static int e1000_phy_setup_autoneg(struct e1000_hw *hw); -static void e1000_config_collision_dist(struct e1000_hw *hw); -static int e1000_config_mac_to_phy(struct e1000_hw *hw); -static int e1000_config_fc_after_link_up(struct e1000_hw *hw); -static int e1000_check_for_link(struct e1000_hw *hw); -static int e1000_wait_autoneg(struct e1000_hw *hw); -static void e1000_get_speed_and_duplex(struct e1000_hw *hw, uint16_t *speed, uint16_t *duplex); -static int e1000_read_phy_reg(struct e1000_hw *hw, uint32_t reg_addr, uint16_t *phy_data); -static int e1000_read_phy_reg_ex(struct e1000_hw *hw, uint32_t reg_addr, uint16_t *phy_data); -static int e1000_write_phy_reg(struct e1000_hw *hw, uint32_t reg_addr, uint16_t phy_data); -static int e1000_write_phy_reg_ex(struct e1000_hw *hw, uint32_t reg_addr, uint16_t phy_data); -static void e1000_phy_hw_reset(struct e1000_hw *hw); -static int e1000_phy_reset(struct e1000_hw *hw); -static int e1000_detect_gig_phy(struct e1000_hw *hw); - -/* Printing macros... */ - -#define E1000_ERR(args...) printf("e1000: " args) - -#if DEBUG >= 3 -#define E1000_DBG(args...) printf("e1000: " args) -#else -#define E1000_DBG(args...) -#endif - -#define MSGOUT(S, A, B) printk(S "\n", A, B) -#if DEBUG >= 2 -#define DEBUGFUNC(F) DEBUGOUT(F "\n"); -#else -#define DEBUGFUNC(F) -#endif -#if DEBUG >= 1 -#define DEBUGOUT(S) printf(S) -#define DEBUGOUT1(S,A) printf(S,A) -#define DEBUGOUT2(S,A,B) printf(S,A,B) -#define DEBUGOUT3(S,A,B,C) printf(S,A,B,C) -#define DEBUGOUT7(S,A,B,C,D,E,F,G) printf(S,A,B,C,D,E,F,G) -#else -#define DEBUGOUT(S) -#define DEBUGOUT1(S,A) -#define DEBUGOUT2(S,A,B) -#define DEBUGOUT3(S,A,B,C) -#define DEBUGOUT7(S,A,B,C,D,E,F,G) -#endif - -#define E1000_WRITE_REG(a, reg, value) ( \ - ((a)->mac_type >= e1000_82543) ? \ - (writel((value), ((a)->hw_addr + E1000_##reg))) : \ - (writel((value), ((a)->hw_addr + E1000_82542_##reg)))) - -#define E1000_READ_REG(a, reg) ( \ - ((a)->mac_type >= e1000_82543) ? \ - readl((a)->hw_addr + E1000_##reg) : \ - readl((a)->hw_addr + E1000_82542_##reg)) - -#define E1000_WRITE_REG_ARRAY(a, reg, offset, value) ( \ - ((a)->mac_type >= e1000_82543) ? \ - writel((value), ((a)->hw_addr + E1000_##reg + ((offset) << 2))) : \ - writel((value), ((a)->hw_addr + E1000_82542_##reg + ((offset) << 2)))) - -#define E1000_READ_REG_ARRAY(a, reg, offset) ( \ - ((a)->mac_type >= e1000_82543) ? \ - readl((a)->hw_addr + E1000_##reg + ((offset) << 2)) : \ - readl((a)->hw_addr + E1000_82542_##reg + ((offset) << 2))) - -#define E1000_WRITE_FLUSH(a) {uint32_t x; x = E1000_READ_REG(a, STATUS);} - -uint32_t -e1000_io_read(struct e1000_hw *hw __unused, uint32_t port) -{ - return inl(port); -} - -void -e1000_io_write(struct e1000_hw *hw __unused, uint32_t port, uint32_t value) -{ - outl(value, port); -} - -static inline void e1000_pci_set_mwi(struct e1000_hw *hw) -{ - pci_write_config_word(hw->pdev, PCI_COMMAND, hw->pci_cmd_word); -} - -static inline void e1000_pci_clear_mwi(struct e1000_hw *hw) -{ - pci_write_config_word(hw->pdev, PCI_COMMAND, - hw->pci_cmd_word & ~PCI_COMMAND_INVALIDATE); -} - -/****************************************************************************** - * Raises the EEPROM's clock input. - * - * hw - Struct containing variables accessed by shared code - * eecd - EECD's current value - *****************************************************************************/ -static void -e1000_raise_ee_clk(struct e1000_hw *hw, - uint32_t *eecd) -{ - /* Raise the clock input to the EEPROM (by setting the SK bit), and then - * wait microseconds. - */ - *eecd = *eecd | E1000_EECD_SK; - E1000_WRITE_REG(hw, EECD, *eecd); - E1000_WRITE_FLUSH(hw); - udelay(hw->eeprom.delay_usec); -} - -/****************************************************************************** - * Lowers the EEPROM's clock input. - * - * hw - Struct containing variables accessed by shared code - * eecd - EECD's current value - *****************************************************************************/ -static void -e1000_lower_ee_clk(struct e1000_hw *hw, - uint32_t *eecd) -{ - /* Lower the clock input to the EEPROM (by clearing the SK bit), and then - * wait 50 microseconds. - */ - *eecd = *eecd & ~E1000_EECD_SK; - E1000_WRITE_REG(hw, EECD, *eecd); - E1000_WRITE_FLUSH(hw); - udelay(hw->eeprom.delay_usec); -} - -/****************************************************************************** - * Shift data bits out to the EEPROM. - * - * hw - Struct containing variables accessed by shared code - * data - data to send to the EEPROM - * count - number of bits to shift out - *****************************************************************************/ -static void -e1000_shift_out_ee_bits(struct e1000_hw *hw, - uint16_t data, - uint16_t count) -{ - struct e1000_eeprom_info *eeprom = &hw->eeprom; - uint32_t eecd; - uint32_t mask; - - /* We need to shift "count" bits out to the EEPROM. So, value in the - * "data" parameter will be shifted out to the EEPROM one bit at a time. - * In order to do this, "data" must be broken down into bits. - */ - mask = 0x01 << (count - 1); - eecd = E1000_READ_REG(hw, EECD); - if (eeprom->type == e1000_eeprom_microwire) { - eecd &= ~E1000_EECD_DO; - } else if (eeprom->type == e1000_eeprom_spi) { - eecd |= E1000_EECD_DO; - } - do { - /* A "1" is shifted out to the EEPROM by setting bit "DI" to a "1", - * and then raising and then lowering the clock (the SK bit controls - * the clock input to the EEPROM). A "0" is shifted out to the EEPROM - * by setting "DI" to "0" and then raising and then lowering the clock. - */ - eecd &= ~E1000_EECD_DI; - - if(data & mask) - eecd |= E1000_EECD_DI; - - E1000_WRITE_REG(hw, EECD, eecd); - E1000_WRITE_FLUSH(hw); - - udelay(eeprom->delay_usec); - - e1000_raise_ee_clk(hw, &eecd); - e1000_lower_ee_clk(hw, &eecd); - - mask = mask >> 1; - - } while(mask); - - /* We leave the "DI" bit set to "0" when we leave this routine. */ - eecd &= ~E1000_EECD_DI; - E1000_WRITE_REG(hw, EECD, eecd); -} - -/****************************************************************************** - * Shift data bits in from the EEPROM - * - * hw - Struct containing variables accessed by shared code - *****************************************************************************/ -static uint16_t -e1000_shift_in_ee_bits(struct e1000_hw *hw, - uint16_t count) -{ - uint32_t eecd; - uint32_t i; - uint16_t data; - - /* In order to read a register from the EEPROM, we need to shift 'count' - * bits in from the EEPROM. Bits are "shifted in" by raising the clock - * input to the EEPROM (setting the SK bit), and then reading the value of - * the "DO" bit. During this "shifting in" process the "DI" bit should - * always be clear. - */ - - eecd = E1000_READ_REG(hw, EECD); - - eecd &= ~(E1000_EECD_DO | E1000_EECD_DI); - data = 0; - - for(i = 0; i < count; i++) { - data = data << 1; - e1000_raise_ee_clk(hw, &eecd); - - eecd = E1000_READ_REG(hw, EECD); - - eecd &= ~(E1000_EECD_DI); - if(eecd & E1000_EECD_DO) - data |= 1; - - e1000_lower_ee_clk(hw, &eecd); - } - - return data; -} - -/****************************************************************************** - * Prepares EEPROM for access - * - * hw - Struct containing variables accessed by shared code - * - * Lowers EEPROM clock. Clears input pin. Sets the chip select pin. This - * function should be called before issuing a command to the EEPROM. - *****************************************************************************/ -static int32_t -e1000_acquire_eeprom(struct e1000_hw *hw) -{ - struct e1000_eeprom_info *eeprom = &hw->eeprom; - uint32_t eecd, i=0; - - eecd = E1000_READ_REG(hw, EECD); - - /* Request EEPROM Access */ - if(hw->mac_type > e1000_82544) { - eecd |= E1000_EECD_REQ; - E1000_WRITE_REG(hw, EECD, eecd); - eecd = E1000_READ_REG(hw, EECD); - while((!(eecd & E1000_EECD_GNT)) && - (i < E1000_EEPROM_GRANT_ATTEMPTS)) { - i++; - udelay(5); - eecd = E1000_READ_REG(hw, EECD); - } - if(!(eecd & E1000_EECD_GNT)) { - eecd &= ~E1000_EECD_REQ; - E1000_WRITE_REG(hw, EECD, eecd); - DEBUGOUT("Could not acquire EEPROM grant\n"); - return -E1000_ERR_EEPROM; - } - } - - /* Setup EEPROM for Read/Write */ - - if (eeprom->type == e1000_eeprom_microwire) { - /* Clear SK and DI */ - eecd &= ~(E1000_EECD_DI | E1000_EECD_SK); - E1000_WRITE_REG(hw, EECD, eecd); - - /* Set CS */ - eecd |= E1000_EECD_CS; - E1000_WRITE_REG(hw, EECD, eecd); - } else if (eeprom->type == e1000_eeprom_spi) { - /* Clear SK and CS */ - eecd &= ~(E1000_EECD_CS | E1000_EECD_SK); - E1000_WRITE_REG(hw, EECD, eecd); - udelay(1); - } - - return E1000_SUCCESS; -} - -/****************************************************************************** - * Returns EEPROM to a "standby" state - * - * hw - Struct containing variables accessed by shared code - *****************************************************************************/ -static void -e1000_standby_eeprom(struct e1000_hw *hw) -{ - struct e1000_eeprom_info *eeprom = &hw->eeprom; - uint32_t eecd; - - eecd = E1000_READ_REG(hw, EECD); - - if(eeprom->type == e1000_eeprom_microwire) { - - /* Deselect EEPROM */ - eecd &= ~(E1000_EECD_CS | E1000_EECD_SK); - E1000_WRITE_REG(hw, EECD, eecd); - E1000_WRITE_FLUSH(hw); - udelay(eeprom->delay_usec); - - /* Clock high */ - eecd |= E1000_EECD_SK; - E1000_WRITE_REG(hw, EECD, eecd); - E1000_WRITE_FLUSH(hw); - udelay(eeprom->delay_usec); - - /* Select EEPROM */ - eecd |= E1000_EECD_CS; - E1000_WRITE_REG(hw, EECD, eecd); - E1000_WRITE_FLUSH(hw); - udelay(eeprom->delay_usec); - - /* Clock low */ - eecd &= ~E1000_EECD_SK; - E1000_WRITE_REG(hw, EECD, eecd); - E1000_WRITE_FLUSH(hw); - udelay(eeprom->delay_usec); - } else if(eeprom->type == e1000_eeprom_spi) { - /* Toggle CS to flush commands */ - eecd |= E1000_EECD_CS; - E1000_WRITE_REG(hw, EECD, eecd); - E1000_WRITE_FLUSH(hw); - udelay(eeprom->delay_usec); - eecd &= ~E1000_EECD_CS; - E1000_WRITE_REG(hw, EECD, eecd); - E1000_WRITE_FLUSH(hw); - udelay(eeprom->delay_usec); - } -} - -/****************************************************************************** - * Terminates a command by inverting the EEPROM's chip select pin - * - * hw - Struct containing variables accessed by shared code - *****************************************************************************/ -static void -e1000_release_eeprom(struct e1000_hw *hw) -{ - uint32_t eecd; - - eecd = E1000_READ_REG(hw, EECD); - - if (hw->eeprom.type == e1000_eeprom_spi) { - eecd |= E1000_EECD_CS; /* Pull CS high */ - eecd &= ~E1000_EECD_SK; /* Lower SCK */ - - E1000_WRITE_REG(hw, EECD, eecd); - - udelay(hw->eeprom.delay_usec); - } else if(hw->eeprom.type == e1000_eeprom_microwire) { - /* cleanup eeprom */ - - /* CS on Microwire is active-high */ - eecd &= ~(E1000_EECD_CS | E1000_EECD_DI); - - E1000_WRITE_REG(hw, EECD, eecd); - - /* Rising edge of clock */ - eecd |= E1000_EECD_SK; - E1000_WRITE_REG(hw, EECD, eecd); - E1000_WRITE_FLUSH(hw); - udelay(hw->eeprom.delay_usec); - - /* Falling edge of clock */ - eecd &= ~E1000_EECD_SK; - E1000_WRITE_REG(hw, EECD, eecd); - E1000_WRITE_FLUSH(hw); - udelay(hw->eeprom.delay_usec); - } - - /* Stop requesting EEPROM access */ - if(hw->mac_type > e1000_82544) { - eecd &= ~E1000_EECD_REQ; - E1000_WRITE_REG(hw, EECD, eecd); - } -} - -/****************************************************************************** - * Reads a 16 bit word from the EEPROM. - * - * hw - Struct containing variables accessed by shared code - *****************************************************************************/ -static int32_t -e1000_spi_eeprom_ready(struct e1000_hw *hw) -{ - uint16_t retry_count = 0; - uint8_t spi_stat_reg; - - /* Read "Status Register" repeatedly until the LSB is cleared. The - * EEPROM will signal that the command has been completed by clearing - * bit 0 of the internal status register. If it's not cleared within - * 5 milliseconds, then error out. - */ - retry_count = 0; - do { - e1000_shift_out_ee_bits(hw, EEPROM_RDSR_OPCODE_SPI, - hw->eeprom.opcode_bits); - spi_stat_reg = (uint8_t)e1000_shift_in_ee_bits(hw, 8); - if (!(spi_stat_reg & EEPROM_STATUS_RDY_SPI)) - break; - - udelay(5); - retry_count += 5; - - } while(retry_count < EEPROM_MAX_RETRY_SPI); - - /* ATMEL SPI write time could vary from 0-20mSec on 3.3V devices (and - * only 0-5mSec on 5V devices) - */ - if(retry_count >= EEPROM_MAX_RETRY_SPI) { - DEBUGOUT("SPI EEPROM Status error\n"); - return -E1000_ERR_EEPROM; - } - - return E1000_SUCCESS; -} - -/****************************************************************************** - * Reads a 16 bit word from the EEPROM. - * - * hw - Struct containing variables accessed by shared code - * offset - offset of word in the EEPROM to read - * data - word read from the EEPROM - * words - number of words to read - *****************************************************************************/ -static int -e1000_read_eeprom(struct e1000_hw *hw, - uint16_t offset, - uint16_t words, - uint16_t *data) -{ - struct e1000_eeprom_info *eeprom = &hw->eeprom; - uint32_t i = 0; - - DEBUGFUNC("e1000_read_eeprom"); - - /* A check for invalid values: offset too large, too many words, and not - * enough words. - */ - if((offset > eeprom->word_size) || (words > eeprom->word_size - offset) || - (words == 0)) { - DEBUGOUT("\"words\" parameter out of bounds\n"); - return -E1000_ERR_EEPROM; - } - - /* Prepare the EEPROM for reading */ - if(e1000_acquire_eeprom(hw) != E1000_SUCCESS) - return -E1000_ERR_EEPROM; - - if(eeprom->type == e1000_eeprom_spi) { - uint16_t word_in; - uint8_t read_opcode = EEPROM_READ_OPCODE_SPI; - - if(e1000_spi_eeprom_ready(hw)) { - e1000_release_eeprom(hw); - return -E1000_ERR_EEPROM; - } - - e1000_standby_eeprom(hw); - - /* Some SPI eeproms use the 8th address bit embedded in the opcode */ - if((eeprom->address_bits == 8) && (offset >= 128)) - read_opcode |= EEPROM_A8_OPCODE_SPI; - - /* Send the READ command (opcode + addr) */ - e1000_shift_out_ee_bits(hw, read_opcode, eeprom->opcode_bits); - e1000_shift_out_ee_bits(hw, (uint16_t)(offset*2), eeprom->address_bits); - - /* Read the data. The address of the eeprom internally increments with - * each byte (spi) being read, saving on the overhead of eeprom setup - * and tear-down. The address counter will roll over if reading beyond - * the size of the eeprom, thus allowing the entire memory to be read - * starting from any offset. */ - for (i = 0; i < words; i++) { - word_in = e1000_shift_in_ee_bits(hw, 16); - data[i] = (word_in >> 8) | (word_in << 8); - } - } else if(eeprom->type == e1000_eeprom_microwire) { - for (i = 0; i < words; i++) { - /* Send the READ command (opcode + addr) */ - e1000_shift_out_ee_bits(hw, EEPROM_READ_OPCODE_MICROWIRE, - eeprom->opcode_bits); - e1000_shift_out_ee_bits(hw, (uint16_t)(offset + i), - eeprom->address_bits); - - /* Read the data. For microwire, each word requires the overhead - * of eeprom setup and tear-down. */ - data[i] = e1000_shift_in_ee_bits(hw, 16); - e1000_standby_eeprom(hw); - } - } - - /* End this read operation */ - e1000_release_eeprom(hw); - - return E1000_SUCCESS; -} - -/****************************************************************************** - * Verifies that the EEPROM has a valid checksum - * - * hw - Struct containing variables accessed by shared code - * - * Reads the first 64 16 bit words of the EEPROM and sums the values read. - * If the the sum of the 64 16 bit words is 0xBABA, the EEPROM's checksum is - * valid. - *****************************************************************************/ -static int -e1000_validate_eeprom_checksum(struct e1000_hw *hw) -{ - uint16_t checksum = 0; - uint16_t i, eeprom_data; - - DEBUGFUNC("e1000_validate_eeprom_checksum"); - - for(i = 0; i < (EEPROM_CHECKSUM_REG + 1); i++) { - if(e1000_read_eeprom(hw, i, 1, &eeprom_data) < 0) { - DEBUGOUT("EEPROM Read Error\n"); - return -E1000_ERR_EEPROM; - } - checksum += eeprom_data; - } - - if(checksum == (uint16_t) EEPROM_SUM) - return E1000_SUCCESS; - else { - DEBUGOUT("EEPROM Checksum Invalid\n"); - return -E1000_ERR_EEPROM; - } -} - -/****************************************************************************** - * Reads the adapter's MAC address from the EEPROM and inverts the LSB for the - * second function of dual function devices - * - * hw - Struct containing variables accessed by shared code - *****************************************************************************/ -static int -e1000_read_mac_addr(struct e1000_hw *hw) -{ - uint16_t offset; - uint16_t eeprom_data; - int i; - - DEBUGFUNC("e1000_read_mac_addr"); - - for(i = 0; i < NODE_ADDRESS_SIZE; i += 2) { - offset = i >> 1; - if(e1000_read_eeprom(hw, offset, 1, &eeprom_data) < 0) { - DEBUGOUT("EEPROM Read Error\n"); - return -E1000_ERR_EEPROM; - } - hw->mac_addr[i] = eeprom_data & 0xff; - hw->mac_addr[i+1] = (eeprom_data >> 8) & 0xff; - } - if(((hw->mac_type == e1000_82546) || (hw->mac_type == e1000_82546_rev_3)) && - (E1000_READ_REG(hw, STATUS) & E1000_STATUS_FUNC_1)) - /* Invert the last bit if this is the second device */ - hw->mac_addr[5] ^= 1; - return E1000_SUCCESS; -} - -/****************************************************************************** - * Initializes receive address filters. - * - * hw - Struct containing variables accessed by shared code - * - * Places the MAC address in receive address register 0 and clears the rest - * of the receive addresss registers. Clears the multicast table. Assumes - * the receiver is in reset when the routine is called. - *****************************************************************************/ -static void -e1000_init_rx_addrs(struct e1000_hw *hw) -{ - uint32_t i; - uint32_t addr_low; - uint32_t addr_high; - - DEBUGFUNC("e1000_init_rx_addrs"); - - /* Setup the receive address. */ - DEBUGOUT("Programming MAC Address into RAR[0]\n"); - addr_low = (hw->mac_addr[0] | - (hw->mac_addr[1] << 8) | - (hw->mac_addr[2] << 16) | (hw->mac_addr[3] << 24)); - - addr_high = (hw->mac_addr[4] | - (hw->mac_addr[5] << 8) | E1000_RAH_AV); - - E1000_WRITE_REG_ARRAY(hw, RA, 0, addr_low); - E1000_WRITE_REG_ARRAY(hw, RA, 1, addr_high); - - /* Zero out the other 15 receive addresses. */ - DEBUGOUT("Clearing RAR[1-15]\n"); - for(i = 1; i < E1000_RAR_ENTRIES; i++) { - E1000_WRITE_REG_ARRAY(hw, RA, (i << 1), 0); - E1000_WRITE_REG_ARRAY(hw, RA, ((i << 1) + 1), 0); - } -} - -/****************************************************************************** - * Clears the VLAN filer table - * - * hw - Struct containing variables accessed by shared code - *****************************************************************************/ -static void -e1000_clear_vfta(struct e1000_hw *hw) -{ - uint32_t offset; - - for(offset = 0; offset < E1000_VLAN_FILTER_TBL_SIZE; offset++) - E1000_WRITE_REG_ARRAY(hw, VFTA, offset, 0); -} - -/****************************************************************************** -* Writes a value to one of the devices registers using port I/O (as opposed to -* memory mapped I/O). Only 82544 and newer devices support port I/O. * -* hw - Struct containing variables accessed by shared code -* offset - offset to write to * value - value to write -*****************************************************************************/ -void e1000_write_reg_io(struct e1000_hw *hw, uint32_t offset, uint32_t value){ - uint32_t io_addr = hw->io_base; - uint32_t io_data = hw->io_base + 4; - e1000_io_write(hw, io_addr, offset); - e1000_io_write(hw, io_data, value); -} - -/****************************************************************************** - * Set the phy type member in the hw struct. - * - * hw - Struct containing variables accessed by shared code - *****************************************************************************/ -static int32_t -e1000_set_phy_type(struct e1000_hw *hw) -{ - DEBUGFUNC("e1000_set_phy_type"); - - switch(hw->phy_id) { - case M88E1000_E_PHY_ID: - case M88E1000_I_PHY_ID: - case M88E1011_I_PHY_ID: - hw->phy_type = e1000_phy_m88; - break; - case IGP01E1000_I_PHY_ID: - hw->phy_type = e1000_phy_igp; - break; - default: - /* Should never have loaded on this device */ - hw->phy_type = e1000_phy_undefined; - return -E1000_ERR_PHY_TYPE; - } - - return E1000_SUCCESS; -} - -/****************************************************************************** - * IGP phy init script - initializes the GbE PHY - * - * hw - Struct containing variables accessed by shared code - *****************************************************************************/ -static void -e1000_phy_init_script(struct e1000_hw *hw) -{ - DEBUGFUNC("e1000_phy_init_script"); - -#if 0 - /* See e1000_sw_init() of the Linux driver */ - if(hw->phy_init_script) { -#else - if((hw->mac_type == e1000_82541) || - (hw->mac_type == e1000_82547) || - (hw->mac_type == e1000_82541_rev_2) || - (hw->mac_type == e1000_82547_rev_2)) { -#endif - mdelay(20); - - e1000_write_phy_reg(hw,0x0000,0x0140); - - mdelay(5); - - if(hw->mac_type == e1000_82541 || hw->mac_type == e1000_82547) { - e1000_write_phy_reg(hw, 0x1F95, 0x0001); - - e1000_write_phy_reg(hw, 0x1F71, 0xBD21); - - e1000_write_phy_reg(hw, 0x1F79, 0x0018); - - e1000_write_phy_reg(hw, 0x1F30, 0x1600); - - e1000_write_phy_reg(hw, 0x1F31, 0x0014); - - e1000_write_phy_reg(hw, 0x1F32, 0x161C); - - e1000_write_phy_reg(hw, 0x1F94, 0x0003); - - e1000_write_phy_reg(hw, 0x1F96, 0x003F); - - e1000_write_phy_reg(hw, 0x2010, 0x0008); - } else { - e1000_write_phy_reg(hw, 0x1F73, 0x0099); - } - - e1000_write_phy_reg(hw, 0x0000, 0x3300); - - - if(hw->mac_type == e1000_82547) { - uint16_t fused, fine, coarse; - - /* Move to analog registers page */ - e1000_read_phy_reg(hw, IGP01E1000_ANALOG_SPARE_FUSE_STATUS, &fused); - - if(!(fused & IGP01E1000_ANALOG_SPARE_FUSE_ENABLED)) { - e1000_read_phy_reg(hw, IGP01E1000_ANALOG_FUSE_STATUS, &fused); - - fine = fused & IGP01E1000_ANALOG_FUSE_FINE_MASK; - coarse = fused & IGP01E1000_ANALOG_FUSE_COARSE_MASK; - - if(coarse > IGP01E1000_ANALOG_FUSE_COARSE_THRESH) { - coarse -= IGP01E1000_ANALOG_FUSE_COARSE_10; - fine -= IGP01E1000_ANALOG_FUSE_FINE_1; - } else if(coarse == IGP01E1000_ANALOG_FUSE_COARSE_THRESH) - fine -= IGP01E1000_ANALOG_FUSE_FINE_10; - - fused = (fused & IGP01E1000_ANALOG_FUSE_POLY_MASK) | - (fine & IGP01E1000_ANALOG_FUSE_FINE_MASK) | - (coarse & IGP01E1000_ANALOG_FUSE_COARSE_MASK); - - e1000_write_phy_reg(hw, IGP01E1000_ANALOG_FUSE_CONTROL, fused); - e1000_write_phy_reg(hw, IGP01E1000_ANALOG_FUSE_BYPASS, - IGP01E1000_ANALOG_FUSE_ENABLE_SW_CONTROL); - } - } - } -} - -/****************************************************************************** - * Set the mac type member in the hw struct. - * - * hw - Struct containing variables accessed by shared code - *****************************************************************************/ -static int -e1000_set_mac_type(struct e1000_hw *hw) -{ - DEBUGFUNC("e1000_set_mac_type"); - - switch (hw->device_id) { - case E1000_DEV_ID_82542: - switch (hw->revision_id) { - case E1000_82542_2_0_REV_ID: - hw->mac_type = e1000_82542_rev2_0; - break; - case E1000_82542_2_1_REV_ID: - hw->mac_type = e1000_82542_rev2_1; - break; - default: - /* Invalid 82542 revision ID */ - return -E1000_ERR_MAC_TYPE; - } - break; - case E1000_DEV_ID_82543GC_FIBER: - case E1000_DEV_ID_82543GC_COPPER: - hw->mac_type = e1000_82543; - break; - case E1000_DEV_ID_82544EI_COPPER: - case E1000_DEV_ID_82544EI_FIBER: - case E1000_DEV_ID_82544GC_COPPER: - case E1000_DEV_ID_82544GC_LOM: - hw->mac_type = e1000_82544; - break; - case E1000_DEV_ID_82540EM: - case E1000_DEV_ID_82540EM_LOM: - case E1000_DEV_ID_82540EP: - case E1000_DEV_ID_82540EP_LOM: - case E1000_DEV_ID_82540EP_LP: - hw->mac_type = e1000_82540; - break; - case E1000_DEV_ID_82545EM_COPPER: - case E1000_DEV_ID_82545EM_FIBER: - hw->mac_type = e1000_82545; - break; - case E1000_DEV_ID_82545GM_COPPER: - case E1000_DEV_ID_82545GM_FIBER: - case E1000_DEV_ID_82545GM_SERDES: - hw->mac_type = e1000_82545_rev_3; - break; - case E1000_DEV_ID_82546EB_COPPER: - case E1000_DEV_ID_82546EB_FIBER: - case E1000_DEV_ID_82546EB_QUAD_COPPER: - hw->mac_type = e1000_82546; - break; - case E1000_DEV_ID_82546GB_COPPER: - case E1000_DEV_ID_82546GB_FIBER: - case E1000_DEV_ID_82546GB_SERDES: - hw->mac_type = e1000_82546_rev_3; - break; - case E1000_DEV_ID_82541EI: - case E1000_DEV_ID_82541EI_MOBILE: - hw->mac_type = e1000_82541; - break; - case E1000_DEV_ID_82541ER: - case E1000_DEV_ID_82541GI: - case E1000_DEV_ID_82541GI_MOBILE: - hw->mac_type = e1000_82541_rev_2; - break; - case E1000_DEV_ID_82547EI: - hw->mac_type = e1000_82547; - break; - case E1000_DEV_ID_82547GI: - hw->mac_type = e1000_82547_rev_2; - break; - default: - /* Should never have loaded on this device */ - return -E1000_ERR_MAC_TYPE; - } - - return E1000_SUCCESS; -} - -/***************************************************************************** - * Set media type and TBI compatibility. - * - * hw - Struct containing variables accessed by shared code - * **************************************************************************/ -static void -e1000_set_media_type(struct e1000_hw *hw) -{ - uint32_t status; - - DEBUGFUNC("e1000_set_media_type"); - - if(hw->mac_type != e1000_82543) { - /* tbi_compatibility is only valid on 82543 */ - hw->tbi_compatibility_en = FALSE; - } - - switch (hw->device_id) { - case E1000_DEV_ID_82545GM_SERDES: - case E1000_DEV_ID_82546GB_SERDES: - hw->media_type = e1000_media_type_internal_serdes; - break; - default: - if(hw->mac_type >= e1000_82543) { - status = E1000_READ_REG(hw, STATUS); - if(status & E1000_STATUS_TBIMODE) { - hw->media_type = e1000_media_type_fiber; - /* tbi_compatibility not valid on fiber */ - hw->tbi_compatibility_en = FALSE; - } else { - hw->media_type = e1000_media_type_copper; - } - } else { - /* This is an 82542 (fiber only) */ - hw->media_type = e1000_media_type_fiber; - } - } -} - -/****************************************************************************** - * Reset the transmit and receive units; mask and clear all interrupts. - * - * hw - Struct containing variables accessed by shared code - *****************************************************************************/ -static void -e1000_reset_hw(struct e1000_hw *hw) -{ - uint32_t ctrl; - uint32_t ctrl_ext; - uint32_t icr; - uint32_t manc; - - DEBUGFUNC("e1000_reset_hw"); - - /* For 82542 (rev 2.0), disable MWI before issuing a device reset */ - if(hw->mac_type == e1000_82542_rev2_0) { - DEBUGOUT("Disabling MWI on 82542 rev 2.0\n"); - e1000_pci_clear_mwi(hw); - } - - /* Clear interrupt mask to stop board from generating interrupts */ - DEBUGOUT("Masking off all interrupts\n"); - E1000_WRITE_REG(hw, IMC, 0xffffffff); - - /* Disable the Transmit and Receive units. Then delay to allow - * any pending transactions to complete before we hit the MAC with - * the global reset. - */ - E1000_WRITE_REG(hw, RCTL, 0); - E1000_WRITE_REG(hw, TCTL, E1000_TCTL_PSP); - E1000_WRITE_FLUSH(hw); - - /* The tbi_compatibility_on Flag must be cleared when Rctl is cleared. */ - hw->tbi_compatibility_on = FALSE; - - /* Delay to allow any outstanding PCI transactions to complete before - * resetting the device - */ - mdelay(10); - - ctrl = E1000_READ_REG(hw, CTRL); - - /* Must reset the PHY before resetting the MAC */ - if((hw->mac_type == e1000_82541) || (hw->mac_type == e1000_82547)) { - E1000_WRITE_REG_IO(hw, CTRL, (ctrl | E1000_CTRL_PHY_RST)); - mdelay(5); - } - - /* Issue a global reset to the MAC. This will reset the chip's - * transmit, receive, DMA, and link units. It will not effect - * the current PCI configuration. The global reset bit is self- - * clearing, and should clear within a microsecond. - */ - DEBUGOUT("Issuing a global reset to MAC\n"); - - switch(hw->mac_type) { - case e1000_82544: - case e1000_82540: - case e1000_82545: - case e1000_82546: - case e1000_82541: - case e1000_82541_rev_2: - /* These controllers can't ack the 64-bit write when issuing the - * reset, so use IO-mapping as a workaround to issue the reset */ - E1000_WRITE_REG_IO(hw, CTRL, (ctrl | E1000_CTRL_RST)); - break; - case e1000_82545_rev_3: - case e1000_82546_rev_3: - /* Reset is performed on a shadow of the control register */ - E1000_WRITE_REG(hw, CTRL_DUP, (ctrl | E1000_CTRL_RST)); - break; - default: - E1000_WRITE_REG(hw, CTRL, (ctrl | E1000_CTRL_RST)); - break; - } - - /* After MAC reset, force reload of EEPROM to restore power-on settings to - * device. Later controllers reload the EEPROM automatically, so just wait - * for reload to complete. - */ - switch(hw->mac_type) { - case e1000_82542_rev2_0: - case e1000_82542_rev2_1: - case e1000_82543: - case e1000_82544: - /* Wait for reset to complete */ - udelay(10); - ctrl_ext = E1000_READ_REG(hw, CTRL_EXT); - ctrl_ext |= E1000_CTRL_EXT_EE_RST; - E1000_WRITE_REG(hw, CTRL_EXT, ctrl_ext); - E1000_WRITE_FLUSH(hw); - /* Wait for EEPROM reload */ - mdelay(2); - break; - case e1000_82541: - case e1000_82541_rev_2: - case e1000_82547: - case e1000_82547_rev_2: - /* Wait for EEPROM reload */ - mdelay(20); - break; - default: - /* Wait for EEPROM reload (it happens automatically) */ - mdelay(5); - break; - } - - /* Disable HW ARPs on ASF enabled adapters */ - if(hw->mac_type >= e1000_82540) { - manc = E1000_READ_REG(hw, MANC); - manc &= ~(E1000_MANC_ARP_EN); - E1000_WRITE_REG(hw, MANC, manc); - } - - if((hw->mac_type == e1000_82541) || (hw->mac_type == e1000_82547)) { - e1000_phy_init_script(hw); - } - - /* Clear interrupt mask to stop board from generating interrupts */ - DEBUGOUT("Masking off all interrupts\n"); - E1000_WRITE_REG(hw, IMC, 0xffffffff); - - /* Clear any pending interrupt events. */ - icr = E1000_READ_REG(hw, ICR); - - /* If MWI was previously enabled, reenable it. */ - if(hw->mac_type == e1000_82542_rev2_0) { -#ifdef LINUX_DRIVER - if(hw->pci_cmd_word & CMD_MEM_WRT_INVALIDATE) -#endif - e1000_pci_set_mwi(hw); - } -} - -/****************************************************************************** - * Performs basic configuration of the adapter. - * - * hw - Struct containing variables accessed by shared code - * - * Assumes that the controller has previously been reset and is in a - * post-reset uninitialized state. Initializes the receive address registers, - * multicast table, and VLAN filter table. Calls routines to setup link - * configuration and flow control settings. Clears all on-chip counters. Leaves - * the transmit and receive units disabled and uninitialized. - *****************************************************************************/ -static int -e1000_init_hw(struct e1000_hw *hw) -{ - uint32_t ctrl, status; - uint32_t i; - int32_t ret_val; - uint16_t pcix_cmd_word; - uint16_t pcix_stat_hi_word; - uint16_t cmd_mmrbc; - uint16_t stat_mmrbc; - e1000_bus_type bus_type = e1000_bus_type_unknown; - - DEBUGFUNC("e1000_init_hw"); - - /* Set the media type and TBI compatibility */ - e1000_set_media_type(hw); - - /* Disabling VLAN filtering. */ - DEBUGOUT("Initializing the IEEE VLAN\n"); - E1000_WRITE_REG(hw, VET, 0); - - e1000_clear_vfta(hw); - - /* For 82542 (rev 2.0), disable MWI and put the receiver into reset */ - if(hw->mac_type == e1000_82542_rev2_0) { - DEBUGOUT("Disabling MWI on 82542 rev 2.0\n"); - e1000_pci_clear_mwi(hw); - E1000_WRITE_REG(hw, RCTL, E1000_RCTL_RST); - E1000_WRITE_FLUSH(hw); - mdelay(5); - } - - /* Setup the receive address. This involves initializing all of the Receive - * Address Registers (RARs 0 - 15). - */ - e1000_init_rx_addrs(hw); - - /* For 82542 (rev 2.0), take the receiver out of reset and enable MWI */ - if(hw->mac_type == e1000_82542_rev2_0) { - E1000_WRITE_REG(hw, RCTL, 0); - E1000_WRITE_FLUSH(hw); - mdelay(1); -#ifdef LINUX_DRIVER - if(hw->pci_cmd_word & CMD_MEM_WRT_INVALIDATE) -#endif - e1000_pci_set_mwi(hw); - } - - /* Zero out the Multicast HASH table */ - DEBUGOUT("Zeroing the MTA\n"); - for(i = 0; i < E1000_MC_TBL_SIZE; i++) - E1000_WRITE_REG_ARRAY(hw, MTA, i, 0); - -#if 0 - /* Set the PCI priority bit correctly in the CTRL register. This - * determines if the adapter gives priority to receives, or if it - * gives equal priority to transmits and receives. - */ - if(hw->dma_fairness) { - ctrl = E1000_READ_REG(hw, CTRL); - E1000_WRITE_REG(hw, CTRL, ctrl | E1000_CTRL_PRIOR); - } -#endif - - switch(hw->mac_type) { - case e1000_82545_rev_3: - case e1000_82546_rev_3: - break; - default: - if (hw->mac_type >= e1000_82543) { - /* See e1000_get_bus_info() of the Linux driver */ - status = E1000_READ_REG(hw, STATUS); - bus_type = (status & E1000_STATUS_PCIX_MODE) ? - e1000_bus_type_pcix : e1000_bus_type_pci; - } - - /* Workaround for PCI-X problem when BIOS sets MMRBC incorrectly. */ - if(bus_type == e1000_bus_type_pcix) { - pci_read_config_word(hw->pdev, PCIX_COMMAND_REGISTER, &pcix_cmd_word); - pci_read_config_word(hw->pdev, PCIX_STATUS_REGISTER_HI, &pcix_stat_hi_word); - cmd_mmrbc = (pcix_cmd_word & PCIX_COMMAND_MMRBC_MASK) >> - PCIX_COMMAND_MMRBC_SHIFT; - stat_mmrbc = (pcix_stat_hi_word & PCIX_STATUS_HI_MMRBC_MASK) >> - PCIX_STATUS_HI_MMRBC_SHIFT; - if(stat_mmrbc == PCIX_STATUS_HI_MMRBC_4K) - stat_mmrbc = PCIX_STATUS_HI_MMRBC_2K; - if(cmd_mmrbc > stat_mmrbc) { - pcix_cmd_word &= ~PCIX_COMMAND_MMRBC_MASK; - pcix_cmd_word |= stat_mmrbc << PCIX_COMMAND_MMRBC_SHIFT; - pci_write_config_word(hw->pdev, PCIX_COMMAND_REGISTER, pcix_cmd_word); - } - } - break; - } - - /* Call a subroutine to configure the link and setup flow control. */ - ret_val = e1000_setup_link(hw); - - /* Set the transmit descriptor write-back policy */ - if(hw->mac_type > e1000_82544) { - ctrl = E1000_READ_REG(hw, TXDCTL); - ctrl = (ctrl & ~E1000_TXDCTL_WTHRESH) | E1000_TXDCTL_FULL_TX_DESC_WB; - E1000_WRITE_REG(hw, TXDCTL, ctrl); - } - -#if 0 - /* Clear all of the statistics registers (clear on read). It is - * important that we do this after we have tried to establish link - * because the symbol error count will increment wildly if there - * is no link. - */ - e1000_clear_hw_cntrs(hw); -#endif - - return ret_val; -} - -/****************************************************************************** - * Adjust SERDES output amplitude based on EEPROM setting. - * - * hw - Struct containing variables accessed by shared code. - *****************************************************************************/ -static int32_t -e1000_adjust_serdes_amplitude(struct e1000_hw *hw) -{ - uint16_t eeprom_data; - int32_t ret_val; - - DEBUGFUNC("e1000_adjust_serdes_amplitude"); - - if(hw->media_type != e1000_media_type_internal_serdes) - return E1000_SUCCESS; - - switch(hw->mac_type) { - case e1000_82545_rev_3: - case e1000_82546_rev_3: - break; - default: - return E1000_SUCCESS; - } - - if ((ret_val = e1000_read_eeprom(hw, EEPROM_SERDES_AMPLITUDE, 1, - &eeprom_data))) { - return ret_val; - } - - if(eeprom_data != EEPROM_RESERVED_WORD) { - /* Adjust SERDES output amplitude only. */ - eeprom_data &= EEPROM_SERDES_AMPLITUDE_MASK; - if((ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_EXT_CTRL, - eeprom_data))) - return ret_val; - } - - return E1000_SUCCESS; -} - -/****************************************************************************** - * Configures flow control and link settings. - * - * hw - Struct containing variables accessed by shared code - * - * Determines which flow control settings to use. Calls the apropriate media- - * specific link configuration function. Configures the flow control settings. - * Assuming the adapter has a valid link partner, a valid link should be - * established. Assumes the hardware has previously been reset and the - * transmitter and receiver are not enabled. - *****************************************************************************/ -static int -e1000_setup_link(struct e1000_hw *hw) -{ - uint32_t ctrl_ext; - int32_t ret_val; - uint16_t eeprom_data; - - DEBUGFUNC("e1000_setup_link"); - - /* Read and store word 0x0F of the EEPROM. This word contains bits - * that determine the hardware's default PAUSE (flow control) mode, - * a bit that determines whether the HW defaults to enabling or - * disabling auto-negotiation, and the direction of the - * SW defined pins. If there is no SW over-ride of the flow - * control setting, then the variable hw->fc will - * be initialized based on a value in the EEPROM. - */ - if(e1000_read_eeprom(hw, EEPROM_INIT_CONTROL2_REG, 1, &eeprom_data) < 0) { - DEBUGOUT("EEPROM Read Error\n"); - return -E1000_ERR_EEPROM; - } - - if(hw->fc == e1000_fc_default) { - if((eeprom_data & EEPROM_WORD0F_PAUSE_MASK) == 0) - hw->fc = e1000_fc_none; - else if((eeprom_data & EEPROM_WORD0F_PAUSE_MASK) == - EEPROM_WORD0F_ASM_DIR) - hw->fc = e1000_fc_tx_pause; - else - hw->fc = e1000_fc_full; - } - - /* We want to save off the original Flow Control configuration just - * in case we get disconnected and then reconnected into a different - * hub or switch with different Flow Control capabilities. - */ - if(hw->mac_type == e1000_82542_rev2_0) - hw->fc &= (~e1000_fc_tx_pause); - -#if 0 - /* See e1000_sw_init() of the Linux driver */ - if((hw->mac_type < e1000_82543) && (hw->report_tx_early == 1)) -#else - if((hw->mac_type < e1000_82543) && (hw->mac_type >= e1000_82543)) -#endif - hw->fc &= (~e1000_fc_rx_pause); - -#if 0 - hw->original_fc = hw->fc; -#endif - - DEBUGOUT1("After fix-ups FlowControl is now = %x\n", hw->fc); - - /* Take the 4 bits from EEPROM word 0x0F that determine the initial - * polarity value for the SW controlled pins, and setup the - * Extended Device Control reg with that info. - * This is needed because one of the SW controlled pins is used for - * signal detection. So this should be done before e1000_setup_pcs_link() - * or e1000_phy_setup() is called. - */ - if(hw->mac_type == e1000_82543) { - ctrl_ext = ((eeprom_data & EEPROM_WORD0F_SWPDIO_EXT) << - SWDPIO__EXT_SHIFT); - E1000_WRITE_REG(hw, CTRL_EXT, ctrl_ext); - } - - /* Call the necessary subroutine to configure the link. */ - ret_val = (hw->media_type == e1000_media_type_copper) ? - e1000_setup_copper_link(hw) : - e1000_setup_fiber_serdes_link(hw); - if (ret_val < 0) { - return ret_val; - } - - /* Initialize the flow control address, type, and PAUSE timer - * registers to their default values. This is done even if flow - * control is disabled, because it does not hurt anything to - * initialize these registers. - */ - DEBUGOUT("Initializing the Flow Control address, type and timer regs\n"); - - E1000_WRITE_REG(hw, FCAL, FLOW_CONTROL_ADDRESS_LOW); - E1000_WRITE_REG(hw, FCAH, FLOW_CONTROL_ADDRESS_HIGH); - E1000_WRITE_REG(hw, FCT, FLOW_CONTROL_TYPE); -#if 0 - E1000_WRITE_REG(hw, FCTTV, hw->fc_pause_time); -#else - E1000_WRITE_REG(hw, FCTTV, FC_DEFAULT_TX_TIMER); -#endif - - /* Set the flow control receive threshold registers. Normally, - * these registers will be set to a default threshold that may be - * adjusted later by the driver's runtime code. However, if the - * ability to transmit pause frames in not enabled, then these - * registers will be set to 0. - */ - if(!(hw->fc & e1000_fc_tx_pause)) { - E1000_WRITE_REG(hw, FCRTL, 0); - E1000_WRITE_REG(hw, FCRTH, 0); - } else { - /* We need to set up the Receive Threshold high and low water marks - * as well as (optionally) enabling the transmission of XON frames. - */ -#if 0 - if(hw->fc_send_xon) { - E1000_WRITE_REG(hw, FCRTL, (hw->fc_low_water | E1000_FCRTL_XONE)); - E1000_WRITE_REG(hw, FCRTH, hw->fc_high_water); - } else { - E1000_WRITE_REG(hw, FCRTL, hw->fc_low_water); - E1000_WRITE_REG(hw, FCRTH, hw->fc_high_water); - } -#else - E1000_WRITE_REG(hw, FCRTL, (FC_DEFAULT_LO_THRESH | E1000_FCRTL_XONE)); - E1000_WRITE_REG(hw, FCRTH, FC_DEFAULT_HI_THRESH); -#endif - } - return ret_val; -} - -/****************************************************************************** - * Sets up link for a fiber based or serdes based adapter - * - * hw - Struct containing variables accessed by shared code - * - * Manipulates Physical Coding Sublayer functions in order to configure - * link. Assumes the hardware has been previously reset and the transmitter - * and receiver are not enabled. - *****************************************************************************/ -static int -e1000_setup_fiber_serdes_link(struct e1000_hw *hw) -{ - uint32_t ctrl; - uint32_t status; - uint32_t txcw = 0; - uint32_t i; - uint32_t signal = 0; - int32_t ret_val; - - DEBUGFUNC("e1000_setup_fiber_serdes_link"); - - /* On adapters with a MAC newer than 82544, SW Defineable pin 1 will be - * set when the optics detect a signal. On older adapters, it will be - * cleared when there is a signal. This applies to fiber media only. - * If we're on serdes media, adjust the output amplitude to value set in - * the EEPROM. - */ - ctrl = E1000_READ_REG(hw, CTRL); - if(hw->media_type == e1000_media_type_fiber) - signal = (hw->mac_type > e1000_82544) ? E1000_CTRL_SWDPIN1 : 0; - - if((ret_val = e1000_adjust_serdes_amplitude(hw))) - return ret_val; - - /* Take the link out of reset */ - ctrl &= ~(E1000_CTRL_LRST); - -#if 0 - /* Adjust VCO speed to improve BER performance */ - if((ret_val = e1000_set_vco_speed(hw))) - return ret_val; -#endif - - e1000_config_collision_dist(hw); - - /* Check for a software override of the flow control settings, and setup - * the device accordingly. If auto-negotiation is enabled, then software - * will have to set the "PAUSE" bits to the correct value in the Tranmsit - * Config Word Register (TXCW) and re-start auto-negotiation. However, if - * auto-negotiation is disabled, then software will have to manually - * configure the two flow control enable bits in the CTRL register. - * - * The possible values of the "fc" parameter are: - * 0: Flow control is completely disabled - * 1: Rx flow control is enabled (we can receive pause frames, but - * not send pause frames). - * 2: Tx flow control is enabled (we can send pause frames but we do - * not support receiving pause frames). - * 3: Both Rx and TX flow control (symmetric) are enabled. - */ - switch (hw->fc) { - case e1000_fc_none: - /* Flow control is completely disabled by a software over-ride. */ - txcw = (E1000_TXCW_ANE | E1000_TXCW_FD); - break; - case e1000_fc_rx_pause: - /* RX Flow control is enabled and TX Flow control is disabled by a - * software over-ride. Since there really isn't a way to advertise - * that we are capable of RX Pause ONLY, we will advertise that we - * support both symmetric and asymmetric RX PAUSE. Later, we will - * disable the adapter's ability to send PAUSE frames. - */ - txcw = (E1000_TXCW_ANE | E1000_TXCW_FD | E1000_TXCW_PAUSE_MASK); - break; - case e1000_fc_tx_pause: - /* TX Flow control is enabled, and RX Flow control is disabled, by a - * software over-ride. - */ - txcw = (E1000_TXCW_ANE | E1000_TXCW_FD | E1000_TXCW_ASM_DIR); - break; - case e1000_fc_full: - /* Flow control (both RX and TX) is enabled by a software over-ride. */ - txcw = (E1000_TXCW_ANE | E1000_TXCW_FD | E1000_TXCW_PAUSE_MASK); - break; - default: - DEBUGOUT("Flow control param set incorrectly\n"); - return -E1000_ERR_CONFIG; - break; - } - - /* Since auto-negotiation is enabled, take the link out of reset (the link - * will be in reset, because we previously reset the chip). This will - * restart auto-negotiation. If auto-neogtiation is successful then the - * link-up status bit will be set and the flow control enable bits (RFCE - * and TFCE) will be set according to their negotiated value. - */ - DEBUGOUT("Auto-negotiation enabled\n"); - - E1000_WRITE_REG(hw, TXCW, txcw); - E1000_WRITE_REG(hw, CTRL, ctrl); - E1000_WRITE_FLUSH(hw); - - hw->txcw = txcw; - mdelay(1); - - /* If we have a signal (the cable is plugged in) then poll for a "Link-Up" - * indication in the Device Status Register. Time-out if a link isn't - * seen in 500 milliseconds seconds (Auto-negotiation should complete in - * less than 500 milliseconds even if the other end is doing it in SW). - * For internal serdes, we just assume a signal is present, then poll. - */ - if(hw->media_type == e1000_media_type_internal_serdes || - (E1000_READ_REG(hw, CTRL) & E1000_CTRL_SWDPIN1) == signal) { - DEBUGOUT("Looking for Link\n"); - for(i = 0; i < (LINK_UP_TIMEOUT / 10); i++) { - mdelay(10); - status = E1000_READ_REG(hw, STATUS); - if(status & E1000_STATUS_LU) break; - } - if(i == (LINK_UP_TIMEOUT / 10)) { - DEBUGOUT("Never got a valid link from auto-neg!!!\n"); - hw->autoneg_failed = 1; - /* AutoNeg failed to achieve a link, so we'll call - * e1000_check_for_link. This routine will force the link up if - * we detect a signal. This will allow us to communicate with - * non-autonegotiating link partners. - */ - if((ret_val = e1000_check_for_link(hw))) { - DEBUGOUT("Error while checking for link\n"); - return ret_val; - } - hw->autoneg_failed = 0; - } else { - hw->autoneg_failed = 0; - DEBUGOUT("Valid Link Found\n"); - } - } else { - DEBUGOUT("No Signal Detected\n"); - } - return E1000_SUCCESS; -} - -/****************************************************************************** -* Detects which PHY is present and the speed and duplex -* -* hw - Struct containing variables accessed by shared code -******************************************************************************/ -static int -e1000_setup_copper_link(struct e1000_hw *hw) -{ - uint32_t ctrl; - int32_t ret_val; - uint16_t i; - uint16_t phy_data; - - DEBUGFUNC("e1000_setup_copper_link"); - - ctrl = E1000_READ_REG(hw, CTRL); - /* With 82543, we need to force speed and duplex on the MAC equal to what - * the PHY speed and duplex configuration is. In addition, we need to - * perform a hardware reset on the PHY to take it out of reset. - */ - if(hw->mac_type > e1000_82543) { - ctrl |= E1000_CTRL_SLU; - ctrl &= ~(E1000_CTRL_FRCSPD | E1000_CTRL_FRCDPX); - E1000_WRITE_REG(hw, CTRL, ctrl); - } else { - ctrl |= (E1000_CTRL_FRCSPD | E1000_CTRL_FRCDPX | E1000_CTRL_SLU); - E1000_WRITE_REG(hw, CTRL, ctrl); - e1000_phy_hw_reset(hw); - } - - /* Make sure we have a valid PHY */ - if((ret_val = e1000_detect_gig_phy(hw))) { - DEBUGOUT("Error, did not detect valid phy.\n"); - return ret_val; - } - DEBUGOUT1("Phy ID = %x \n", hw->phy_id); - - if(hw->mac_type <= e1000_82543 || - hw->mac_type == e1000_82541 || hw->mac_type == e1000_82547 || -#if 0 - hw->mac_type == e1000_82541_rev_2 || hw->mac_type == e1000_82547_rev_2) - hw->phy_reset_disable = FALSE; - - if(!hw->phy_reset_disable) { -#else - hw->mac_type == e1000_82541_rev_2 || hw->mac_type == e1000_82547_rev_2) { -#endif - if (hw->phy_type == e1000_phy_igp) { - - if((ret_val = e1000_phy_reset(hw))) { - DEBUGOUT("Error Resetting the PHY\n"); - return ret_val; - } - - /* Wait 10ms for MAC to configure PHY from eeprom settings */ - mdelay(15); - -#if 0 - /* disable lplu d3 during driver init */ - if((ret_val = e1000_set_d3_lplu_state(hw, FALSE))) { - DEBUGOUT("Error Disabling LPLU D3\n"); - return ret_val; - } - - /* Configure mdi-mdix settings */ - if((ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CTRL, - &phy_data))) - return ret_val; - - if((hw->mac_type == e1000_82541) || (hw->mac_type == e1000_82547)) { - hw->dsp_config_state = e1000_dsp_config_disabled; - /* Force MDI for IGP B-0 PHY */ - phy_data &= ~(IGP01E1000_PSCR_AUTO_MDIX | - IGP01E1000_PSCR_FORCE_MDI_MDIX); - hw->mdix = 1; - - } else { - hw->dsp_config_state = e1000_dsp_config_enabled; - phy_data &= ~IGP01E1000_PSCR_AUTO_MDIX; - - switch (hw->mdix) { - case 1: - phy_data &= ~IGP01E1000_PSCR_FORCE_MDI_MDIX; - break; - case 2: - phy_data |= IGP01E1000_PSCR_FORCE_MDI_MDIX; - break; - case 0: - default: - phy_data |= IGP01E1000_PSCR_AUTO_MDIX; - break; - } - } - if((ret_val = e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CTRL, - phy_data))) - return ret_val; - - /* set auto-master slave resolution settings */ - e1000_ms_type phy_ms_setting = hw->master_slave; - - if(hw->ffe_config_state == e1000_ffe_config_active) - hw->ffe_config_state = e1000_ffe_config_enabled; - - if(hw->dsp_config_state == e1000_dsp_config_activated) - hw->dsp_config_state = e1000_dsp_config_enabled; -#endif - - /* when autonegotiation advertisment is only 1000Mbps then we - * should disable SmartSpeed and enable Auto MasterSlave - * resolution as hardware default. */ - if(hw->autoneg_advertised == ADVERTISE_1000_FULL) { - /* Disable SmartSpeed */ - if((ret_val = e1000_read_phy_reg(hw, - IGP01E1000_PHY_PORT_CONFIG, - &phy_data))) - return ret_val; - phy_data &= ~IGP01E1000_PSCFR_SMART_SPEED; - if((ret_val = e1000_write_phy_reg(hw, - IGP01E1000_PHY_PORT_CONFIG, - phy_data))) - return ret_val; - /* Set auto Master/Slave resolution process */ - if((ret_val = e1000_read_phy_reg(hw, PHY_1000T_CTRL, - &phy_data))) - return ret_val; - phy_data &= ~CR_1000T_MS_ENABLE; - if((ret_val = e1000_write_phy_reg(hw, PHY_1000T_CTRL, - phy_data))) - return ret_val; - } - - if((ret_val = e1000_read_phy_reg(hw, PHY_1000T_CTRL, - &phy_data))) - return ret_val; - -#if 0 - /* load defaults for future use */ - hw->original_master_slave = (phy_data & CR_1000T_MS_ENABLE) ? - ((phy_data & CR_1000T_MS_VALUE) ? - e1000_ms_force_master : - e1000_ms_force_slave) : - e1000_ms_auto; - - switch (phy_ms_setting) { - case e1000_ms_force_master: - phy_data |= (CR_1000T_MS_ENABLE | CR_1000T_MS_VALUE); - break; - case e1000_ms_force_slave: - phy_data |= CR_1000T_MS_ENABLE; - phy_data &= ~(CR_1000T_MS_VALUE); - break; - case e1000_ms_auto: - phy_data &= ~CR_1000T_MS_ENABLE; - default: - break; - } -#endif - - if((ret_val = e1000_write_phy_reg(hw, PHY_1000T_CTRL, - phy_data))) - return ret_val; - } else { - /* Enable CRS on TX. This must be set for half-duplex operation. */ - if((ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, - &phy_data))) - return ret_val; - - phy_data |= M88E1000_PSCR_ASSERT_CRS_ON_TX; - - /* Options: - * MDI/MDI-X = 0 (default) - * 0 - Auto for all speeds - * 1 - MDI mode - * 2 - MDI-X mode - * 3 - Auto for 1000Base-T only (MDI-X for 10/100Base-T modes) - */ -#if 0 - phy_data &= ~M88E1000_PSCR_AUTO_X_MODE; - - switch (hw->mdix) { - case 1: - phy_data |= M88E1000_PSCR_MDI_MANUAL_MODE; - break; - case 2: - phy_data |= M88E1000_PSCR_MDIX_MANUAL_MODE; - break; - case 3: - phy_data |= M88E1000_PSCR_AUTO_X_1000T; - break; - case 0: - default: -#endif - phy_data |= M88E1000_PSCR_AUTO_X_MODE; -#if 0 - break; - } -#endif - - /* Options: - * disable_polarity_correction = 0 (default) - * Automatic Correction for Reversed Cable Polarity - * 0 - Disabled - * 1 - Enabled - */ - phy_data &= ~M88E1000_PSCR_POLARITY_REVERSAL; - if((ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, - phy_data))) - return ret_val; - - /* Force TX_CLK in the Extended PHY Specific Control Register - * to 25MHz clock. - */ - if((ret_val = e1000_read_phy_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL, - &phy_data))) - return ret_val; - - phy_data |= M88E1000_EPSCR_TX_CLK_25; - -#ifdef LINUX_DRIVER - if (hw->phy_revision < M88E1011_I_REV_4) { -#endif - /* Configure Master and Slave downshift values */ - phy_data &= ~(M88E1000_EPSCR_MASTER_DOWNSHIFT_MASK | - M88E1000_EPSCR_SLAVE_DOWNSHIFT_MASK); - phy_data |= (M88E1000_EPSCR_MASTER_DOWNSHIFT_1X | - M88E1000_EPSCR_SLAVE_DOWNSHIFT_1X); - if((ret_val = e1000_write_phy_reg(hw, - M88E1000_EXT_PHY_SPEC_CTRL, - phy_data))) - return ret_val; - } - - /* SW Reset the PHY so all changes take effect */ - if((ret_val = e1000_phy_reset(hw))) { - DEBUGOUT("Error Resetting the PHY\n"); - return ret_val; -#ifdef LINUX_DRIVER - } -#endif - } - - /* Options: - * autoneg = 1 (default) - * PHY will advertise value(s) parsed from - * autoneg_advertised and fc - * autoneg = 0 - * PHY will be set to 10H, 10F, 100H, or 100F - * depending on value parsed from forced_speed_duplex. - */ - - /* Is autoneg enabled? This is enabled by default or by software - * override. If so, call e1000_phy_setup_autoneg routine to parse the - * autoneg_advertised and fc options. If autoneg is NOT enabled, then - * the user should have provided a speed/duplex override. If so, then - * call e1000_phy_force_speed_duplex to parse and set this up. - */ - /* Perform some bounds checking on the hw->autoneg_advertised - * parameter. If this variable is zero, then set it to the default. - */ - hw->autoneg_advertised &= AUTONEG_ADVERTISE_SPEED_DEFAULT; - - /* If autoneg_advertised is zero, we assume it was not defaulted - * by the calling code so we set to advertise full capability. - */ - if(hw->autoneg_advertised == 0) - hw->autoneg_advertised = AUTONEG_ADVERTISE_SPEED_DEFAULT; - - DEBUGOUT("Reconfiguring auto-neg advertisement params\n"); - if((ret_val = e1000_phy_setup_autoneg(hw))) { - DEBUGOUT("Error Setting up Auto-Negotiation\n"); - return ret_val; - } - DEBUGOUT("Restarting Auto-Neg\n"); - - /* Restart auto-negotiation by setting the Auto Neg Enable bit and - * the Auto Neg Restart bit in the PHY control register. - */ - if((ret_val = e1000_read_phy_reg(hw, PHY_CTRL, &phy_data))) - return ret_val; - - phy_data |= (MII_CR_AUTO_NEG_EN | MII_CR_RESTART_AUTO_NEG); - if((ret_val = e1000_write_phy_reg(hw, PHY_CTRL, phy_data))) - return ret_val; - -#if 0 - /* Does the user want to wait for Auto-Neg to complete here, or - * check at a later time (for example, callback routine). - */ - if(hw->wait_autoneg_complete) { - if((ret_val = e1000_wait_autoneg(hw))) { - DEBUGOUT("Error while waiting for autoneg to complete\n"); - return ret_val; - } - } -#else - /* If we do not wait for autonegotiation to complete I - * do not see a valid link status. - */ - if((ret_val = e1000_wait_autoneg(hw))) { - DEBUGOUT("Error while waiting for autoneg to complete\n"); - return ret_val; - } -#endif - } /* !hw->phy_reset_disable */ - - /* Check link status. Wait up to 100 microseconds for link to become - * valid. - */ - for(i = 0; i < 10; i++) { - if((ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data))) - return ret_val; - if((ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data))) - return ret_val; - - if(phy_data & MII_SR_LINK_STATUS) { - /* We have link, so we need to finish the config process: - * 1) Set up the MAC to the current PHY speed/duplex - * if we are on 82543. If we - * are on newer silicon, we only need to configure - * collision distance in the Transmit Control Register. - * 2) Set up flow control on the MAC to that established with - * the link partner. - */ - if(hw->mac_type >= e1000_82544) { - e1000_config_collision_dist(hw); - } else { - if((ret_val = e1000_config_mac_to_phy(hw))) { - DEBUGOUT("Error configuring MAC to PHY settings\n"); - return ret_val; - } - } - if((ret_val = e1000_config_fc_after_link_up(hw))) { - DEBUGOUT("Error Configuring Flow Control\n"); - return ret_val; - } -#if 0 - if(hw->phy_type == e1000_phy_igp) { - if((ret_val = e1000_config_dsp_after_link_change(hw, TRUE))) { - DEBUGOUT("Error Configuring DSP after link up\n"); - return ret_val; - } - } -#endif - DEBUGOUT("Valid link established!!!\n"); - return E1000_SUCCESS; - } - udelay(10); - } - - DEBUGOUT("Unable to establish link!!!\n"); - return -E1000_ERR_NOLINK; -} - -/****************************************************************************** -* Configures PHY autoneg and flow control advertisement settings -* -* hw - Struct containing variables accessed by shared code -******************************************************************************/ -static int -e1000_phy_setup_autoneg(struct e1000_hw *hw) -{ - int32_t ret_val; - uint16_t mii_autoneg_adv_reg; - uint16_t mii_1000t_ctrl_reg; - - DEBUGFUNC("e1000_phy_setup_autoneg"); - - /* Read the MII Auto-Neg Advertisement Register (Address 4). */ - if((ret_val = e1000_read_phy_reg(hw, PHY_AUTONEG_ADV, - &mii_autoneg_adv_reg))) - return ret_val; - - /* Read the MII 1000Base-T Control Register (Address 9). */ - if((ret_val = e1000_read_phy_reg(hw, PHY_1000T_CTRL, &mii_1000t_ctrl_reg))) - return ret_val; - - /* Need to parse both autoneg_advertised and fc and set up - * the appropriate PHY registers. First we will parse for - * autoneg_advertised software override. Since we can advertise - * a plethora of combinations, we need to check each bit - * individually. - */ - - /* First we clear all the 10/100 mb speed bits in the Auto-Neg - * Advertisement Register (Address 4) and the 1000 mb speed bits in - * the 1000Base-T Control Register (Address 9). - */ - mii_autoneg_adv_reg &= ~REG4_SPEED_MASK; - mii_1000t_ctrl_reg &= ~REG9_SPEED_MASK; - - DEBUGOUT1("autoneg_advertised %x\n", hw->autoneg_advertised); - - /* Do we want to advertise 10 Mb Half Duplex? */ - if(hw->autoneg_advertised & ADVERTISE_10_HALF) { - DEBUGOUT("Advertise 10mb Half duplex\n"); - mii_autoneg_adv_reg |= NWAY_AR_10T_HD_CAPS; - } - - /* Do we want to advertise 10 Mb Full Duplex? */ - if(hw->autoneg_advertised & ADVERTISE_10_FULL) { - DEBUGOUT("Advertise 10mb Full duplex\n"); - mii_autoneg_adv_reg |= NWAY_AR_10T_FD_CAPS; - } - - /* Do we want to advertise 100 Mb Half Duplex? */ - if(hw->autoneg_advertised & ADVERTISE_100_HALF) { - DEBUGOUT("Advertise 100mb Half duplex\n"); - mii_autoneg_adv_reg |= NWAY_AR_100TX_HD_CAPS; - } - - /* Do we want to advertise 100 Mb Full Duplex? */ - if(hw->autoneg_advertised & ADVERTISE_100_FULL) { - DEBUGOUT("Advertise 100mb Full duplex\n"); - mii_autoneg_adv_reg |= NWAY_AR_100TX_FD_CAPS; - } - - /* We do not allow the Phy to advertise 1000 Mb Half Duplex */ - if(hw->autoneg_advertised & ADVERTISE_1000_HALF) { - DEBUGOUT("Advertise 1000mb Half duplex requested, request denied!\n"); - } - - /* Do we want to advertise 1000 Mb Full Duplex? */ - if(hw->autoneg_advertised & ADVERTISE_1000_FULL) { - DEBUGOUT("Advertise 1000mb Full duplex\n"); - mii_1000t_ctrl_reg |= CR_1000T_FD_CAPS; - } - - /* Check for a software override of the flow control settings, and - * setup the PHY advertisement registers accordingly. If - * auto-negotiation is enabled, then software will have to set the - * "PAUSE" bits to the correct value in the Auto-Negotiation - * Advertisement Register (PHY_AUTONEG_ADV) and re-start auto-negotiation. - * - * The possible values of the "fc" parameter are: - * 0: Flow control is completely disabled - * 1: Rx flow control is enabled (we can receive pause frames - * but not send pause frames). - * 2: Tx flow control is enabled (we can send pause frames - * but we do not support receiving pause frames). - * 3: Both Rx and TX flow control (symmetric) are enabled. - * other: No software override. The flow control configuration - * in the EEPROM is used. - */ - switch (hw->fc) { - case e1000_fc_none: /* 0 */ - /* Flow control (RX & TX) is completely disabled by a - * software over-ride. - */ - mii_autoneg_adv_reg &= ~(NWAY_AR_ASM_DIR | NWAY_AR_PAUSE); - break; - case e1000_fc_rx_pause: /* 1 */ - /* RX Flow control is enabled, and TX Flow control is - * disabled, by a software over-ride. - */ - /* Since there really isn't a way to advertise that we are - * capable of RX Pause ONLY, we will advertise that we - * support both symmetric and asymmetric RX PAUSE. Later - * (in e1000_config_fc_after_link_up) we will disable the - *hw's ability to send PAUSE frames. - */ - mii_autoneg_adv_reg |= (NWAY_AR_ASM_DIR | NWAY_AR_PAUSE); - break; - case e1000_fc_tx_pause: /* 2 */ - /* TX Flow control is enabled, and RX Flow control is - * disabled, by a software over-ride. - */ - mii_autoneg_adv_reg |= NWAY_AR_ASM_DIR; - mii_autoneg_adv_reg &= ~NWAY_AR_PAUSE; - break; - case e1000_fc_full: /* 3 */ - /* Flow control (both RX and TX) is enabled by a software - * over-ride. - */ - mii_autoneg_adv_reg |= (NWAY_AR_ASM_DIR | NWAY_AR_PAUSE); - break; - default: - DEBUGOUT("Flow control param set incorrectly\n"); - return -E1000_ERR_CONFIG; - } - - if((ret_val = e1000_write_phy_reg(hw, PHY_AUTONEG_ADV, - mii_autoneg_adv_reg))) - return ret_val; - - DEBUGOUT1("Auto-Neg Advertising %x\n", mii_autoneg_adv_reg); - - if((ret_val = e1000_write_phy_reg(hw, PHY_1000T_CTRL, mii_1000t_ctrl_reg))) - return ret_val; - - return E1000_SUCCESS; -} - -/****************************************************************************** -* Sets the collision distance in the Transmit Control register -* -* hw - Struct containing variables accessed by shared code -* -* Link should have been established previously. Reads the speed and duplex -* information from the Device Status register. -******************************************************************************/ -static void -e1000_config_collision_dist(struct e1000_hw *hw) -{ - uint32_t tctl; - - tctl = E1000_READ_REG(hw, TCTL); - - tctl &= ~E1000_TCTL_COLD; - tctl |= E1000_COLLISION_DISTANCE << E1000_COLD_SHIFT; - - E1000_WRITE_REG(hw, TCTL, tctl); - E1000_WRITE_FLUSH(hw); -} - -/****************************************************************************** -* Sets MAC speed and duplex settings to reflect the those in the PHY -* -* hw - Struct containing variables accessed by shared code -* mii_reg - data to write to the MII control register -* -* The contents of the PHY register containing the needed information need to -* be passed in. -******************************************************************************/ -static int -e1000_config_mac_to_phy(struct e1000_hw *hw) -{ - uint32_t ctrl; - int32_t ret_val; - uint16_t phy_data; - - DEBUGFUNC("e1000_config_mac_to_phy"); - - /* Read the Device Control Register and set the bits to Force Speed - * and Duplex. - */ - ctrl = E1000_READ_REG(hw, CTRL); - ctrl |= (E1000_CTRL_FRCSPD | E1000_CTRL_FRCDPX); - ctrl &= ~(E1000_CTRL_SPD_SEL | E1000_CTRL_ILOS); - - /* Set up duplex in the Device Control and Transmit Control - * registers depending on negotiated values. - */ - if (hw->phy_type == e1000_phy_igp) { - if((ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_STATUS, - &phy_data))) - return ret_val; - - if(phy_data & IGP01E1000_PSSR_FULL_DUPLEX) ctrl |= E1000_CTRL_FD; - else ctrl &= ~E1000_CTRL_FD; - - e1000_config_collision_dist(hw); - - /* Set up speed in the Device Control register depending on - * negotiated values. - */ - if((phy_data & IGP01E1000_PSSR_SPEED_MASK) == - IGP01E1000_PSSR_SPEED_1000MBPS) - ctrl |= E1000_CTRL_SPD_1000; - else if((phy_data & IGP01E1000_PSSR_SPEED_MASK) == - IGP01E1000_PSSR_SPEED_100MBPS) - ctrl |= E1000_CTRL_SPD_100; - } else { - if((ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS, - &phy_data))) - return ret_val; - - if(phy_data & M88E1000_PSSR_DPLX) ctrl |= E1000_CTRL_FD; - else ctrl &= ~E1000_CTRL_FD; - - e1000_config_collision_dist(hw); - - /* Set up speed in the Device Control register depending on - * negotiated values. - */ - if((phy_data & M88E1000_PSSR_SPEED) == M88E1000_PSSR_1000MBS) - ctrl |= E1000_CTRL_SPD_1000; - else if((phy_data & M88E1000_PSSR_SPEED) == M88E1000_PSSR_100MBS) - ctrl |= E1000_CTRL_SPD_100; - } - /* Write the configured values back to the Device Control Reg. */ - E1000_WRITE_REG(hw, CTRL, ctrl); - return E1000_SUCCESS; -} - -/****************************************************************************** - * Forces the MAC's flow control settings. - * - * hw - Struct containing variables accessed by shared code - * - * Sets the TFCE and RFCE bits in the device control register to reflect - * the adapter settings. TFCE and RFCE need to be explicitly set by - * software when a Copper PHY is used because autonegotiation is managed - * by the PHY rather than the MAC. Software must also configure these - * bits when link is forced on a fiber connection. - *****************************************************************************/ -static int -e1000_force_mac_fc(struct e1000_hw *hw) -{ - uint32_t ctrl; - - DEBUGFUNC("e1000_force_mac_fc"); - - /* Get the current configuration of the Device Control Register */ - ctrl = E1000_READ_REG(hw, CTRL); - - /* Because we didn't get link via the internal auto-negotiation - * mechanism (we either forced link or we got link via PHY - * auto-neg), we have to manually enable/disable transmit an - * receive flow control. - * - * The "Case" statement below enables/disable flow control - * according to the "hw->fc" parameter. - * - * The possible values of the "fc" parameter are: - * 0: Flow control is completely disabled - * 1: Rx flow control is enabled (we can receive pause - * frames but not send pause frames). - * 2: Tx flow control is enabled (we can send pause frames - * frames but we do not receive pause frames). - * 3: Both Rx and TX flow control (symmetric) is enabled. - * other: No other values should be possible at this point. - */ - - switch (hw->fc) { - case e1000_fc_none: - ctrl &= (~(E1000_CTRL_TFCE | E1000_CTRL_RFCE)); - break; - case e1000_fc_rx_pause: - ctrl &= (~E1000_CTRL_TFCE); - ctrl |= E1000_CTRL_RFCE; - break; - case e1000_fc_tx_pause: - ctrl &= (~E1000_CTRL_RFCE); - ctrl |= E1000_CTRL_TFCE; - break; - case e1000_fc_full: - ctrl |= (E1000_CTRL_TFCE | E1000_CTRL_RFCE); - break; - default: - DEBUGOUT("Flow control param set incorrectly\n"); - return -E1000_ERR_CONFIG; - } - - /* Disable TX Flow Control for 82542 (rev 2.0) */ - if(hw->mac_type == e1000_82542_rev2_0) - ctrl &= (~E1000_CTRL_TFCE); - - E1000_WRITE_REG(hw, CTRL, ctrl); - return E1000_SUCCESS; -} - -/****************************************************************************** - * Configures flow control settings after link is established - * - * hw - Struct containing variables accessed by shared code - * - * Should be called immediately after a valid link has been established. - * Forces MAC flow control settings if link was forced. When in MII/GMII mode - * and autonegotiation is enabled, the MAC flow control settings will be set - * based on the flow control negotiated by the PHY. In TBI mode, the TFCE - * and RFCE bits will be automaticaly set to the negotiated flow control mode. - *****************************************************************************/ -static int -e1000_config_fc_after_link_up(struct e1000_hw *hw) -{ - int32_t ret_val; - uint16_t mii_status_reg; - uint16_t mii_nway_adv_reg; - uint16_t mii_nway_lp_ability_reg; - uint16_t speed; - uint16_t duplex; - - DEBUGFUNC("e1000_config_fc_after_link_up"); - - /* Check for the case where we have fiber media and auto-neg failed - * so we had to force link. In this case, we need to force the - * configuration of the MAC to match the "fc" parameter. - */ - if(((hw->media_type == e1000_media_type_fiber) && (hw->autoneg_failed)) || - ((hw->media_type == e1000_media_type_internal_serdes) && (hw->autoneg_failed))) { - if((ret_val = e1000_force_mac_fc(hw))) { - DEBUGOUT("Error forcing flow control settings\n"); - return ret_val; - } - } - - /* Check for the case where we have copper media and auto-neg is - * enabled. In this case, we need to check and see if Auto-Neg - * has completed, and if so, how the PHY and link partner has - * flow control configured. - */ - if(hw->media_type == e1000_media_type_copper) { - /* Read the MII Status Register and check to see if AutoNeg - * has completed. We read this twice because this reg has - * some "sticky" (latched) bits. - */ - if((ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg))) - return ret_val; - if((ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg))) - return ret_val; - - if(mii_status_reg & MII_SR_AUTONEG_COMPLETE) { - /* The AutoNeg process has completed, so we now need to - * read both the Auto Negotiation Advertisement Register - * (Address 4) and the Auto_Negotiation Base Page Ability - * Register (Address 5) to determine how flow control was - * negotiated. - */ - if((ret_val = e1000_read_phy_reg(hw, PHY_AUTONEG_ADV, - &mii_nway_adv_reg))) - return ret_val; - if((ret_val = e1000_read_phy_reg(hw, PHY_LP_ABILITY, - &mii_nway_lp_ability_reg))) - return ret_val; - - /* Two bits in the Auto Negotiation Advertisement Register - * (Address 4) and two bits in the Auto Negotiation Base - * Page Ability Register (Address 5) determine flow control - * for both the PHY and the link partner. The following - * table, taken out of the IEEE 802.3ab/D6.0 dated March 25, - * 1999, describes these PAUSE resolution bits and how flow - * control is determined based upon these settings. - * NOTE: DC = Don't Care - * - * LOCAL DEVICE | LINK PARTNER - * PAUSE | ASM_DIR | PAUSE | ASM_DIR | NIC Resolution - *-------|---------|-------|---------|-------------------- - * 0 | 0 | DC | DC | e1000_fc_none - * 0 | 1 | 0 | DC | e1000_fc_none - * 0 | 1 | 1 | 0 | e1000_fc_none - * 0 | 1 | 1 | 1 | e1000_fc_tx_pause - * 1 | 0 | 0 | DC | e1000_fc_none - * 1 | DC | 1 | DC | e1000_fc_full - * 1 | 1 | 0 | 0 | e1000_fc_none - * 1 | 1 | 0 | 1 | e1000_fc_rx_pause - * - */ - /* Are both PAUSE bits set to 1? If so, this implies - * Symmetric Flow Control is enabled at both ends. The - * ASM_DIR bits are irrelevant per the spec. - * - * For Symmetric Flow Control: - * - * LOCAL DEVICE | LINK PARTNER - * PAUSE | ASM_DIR | PAUSE | ASM_DIR | Result - *-------|---------|-------|---------|-------------------- - * 1 | DC | 1 | DC | e1000_fc_full - * - */ - if((mii_nway_adv_reg & NWAY_AR_PAUSE) && - (mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE)) { - /* Now we need to check if the user selected RX ONLY - * of pause frames. In this case, we had to advertise - * FULL flow control because we could not advertise RX - * ONLY. Hence, we must now check to see if we need to - * turn OFF the TRANSMISSION of PAUSE frames. - */ -#if 0 - if(hw->original_fc == e1000_fc_full) { - hw->fc = e1000_fc_full; -#else - if(hw->fc == e1000_fc_full) { -#endif - DEBUGOUT("Flow Control = FULL.\r\n"); - } else { - hw->fc = e1000_fc_rx_pause; - DEBUGOUT("Flow Control = RX PAUSE frames only.\r\n"); - } - } - /* For receiving PAUSE frames ONLY. - * - * LOCAL DEVICE | LINK PARTNER - * PAUSE | ASM_DIR | PAUSE | ASM_DIR | Result - *-------|---------|-------|---------|-------------------- - * 0 | 1 | 1 | 1 | e1000_fc_tx_pause - * - */ - else if(!(mii_nway_adv_reg & NWAY_AR_PAUSE) && - (mii_nway_adv_reg & NWAY_AR_ASM_DIR) && - (mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE) && - (mii_nway_lp_ability_reg & NWAY_LPAR_ASM_DIR)) { - hw->fc = e1000_fc_tx_pause; - DEBUGOUT("Flow Control = TX PAUSE frames only.\r\n"); - } - /* For transmitting PAUSE frames ONLY. - * - * LOCAL DEVICE | LINK PARTNER - * PAUSE | ASM_DIR | PAUSE | ASM_DIR | Result - *-------|---------|-------|---------|-------------------- - * 1 | 1 | 0 | 1 | e1000_fc_rx_pause - * - */ - else if((mii_nway_adv_reg & NWAY_AR_PAUSE) && - (mii_nway_adv_reg & NWAY_AR_ASM_DIR) && - !(mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE) && - (mii_nway_lp_ability_reg & NWAY_LPAR_ASM_DIR)) { - hw->fc = e1000_fc_rx_pause; - DEBUGOUT("Flow Control = RX PAUSE frames only.\r\n"); - } - /* Per the IEEE spec, at this point flow control should be - * disabled. However, we want to consider that we could - * be connected to a legacy switch that doesn't advertise - * desired flow control, but can be forced on the link - * partner. So if we advertised no flow control, that is - * what we will resolve to. If we advertised some kind of - * receive capability (Rx Pause Only or Full Flow Control) - * and the link partner advertised none, we will configure - * ourselves to enable Rx Flow Control only. We can do - * this safely for two reasons: If the link partner really - * didn't want flow control enabled, and we enable Rx, no - * harm done since we won't be receiving any PAUSE frames - * anyway. If the intent on the link partner was to have - * flow control enabled, then by us enabling RX only, we - * can at least receive pause frames and process them. - * This is a good idea because in most cases, since we are - * predominantly a server NIC, more times than not we will - * be asked to delay transmission of packets than asking - * our link partner to pause transmission of frames. - */ -#if 0 - else if(hw->original_fc == e1000_fc_none || - hw->original_fc == e1000_fc_tx_pause) { -#else - else if(hw->fc == e1000_fc_none) - DEBUGOUT("Flow Control = NONE.\r\n"); - else if(hw->fc == e1000_fc_tx_pause) { -#endif - hw->fc = e1000_fc_none; - DEBUGOUT("Flow Control = NONE.\r\n"); - } else { - hw->fc = e1000_fc_rx_pause; - DEBUGOUT("Flow Control = RX PAUSE frames only.\r\n"); - } - - /* Now we need to do one last check... If we auto- - * negotiated to HALF DUPLEX, flow control should not be - * enabled per IEEE 802.3 spec. - */ - e1000_get_speed_and_duplex(hw, &speed, &duplex); - - if(duplex == HALF_DUPLEX) - hw->fc = e1000_fc_none; - - /* Now we call a subroutine to actually force the MAC - * controller to use the correct flow control settings. - */ - if((ret_val = e1000_force_mac_fc(hw))) { - DEBUGOUT("Error forcing flow control settings\n"); - return ret_val; - } - } else { - DEBUGOUT("Copper PHY and Auto Neg has not completed.\r\n"); - } - } - return E1000_SUCCESS; -} - -/****************************************************************************** - * Checks to see if the link status of the hardware has changed. - * - * hw - Struct containing variables accessed by shared code - * - * Called by any function that needs to check the link status of the adapter. - *****************************************************************************/ -static int -e1000_check_for_link(struct e1000_hw *hw) -{ - uint32_t rxcw; - uint32_t ctrl; - uint32_t status; - uint32_t rctl; - uint32_t signal = 0; - int32_t ret_val; - uint16_t phy_data; - uint16_t lp_capability; - - DEBUGFUNC("e1000_check_for_link"); - - /* On adapters with a MAC newer than 82544, SW Defineable pin 1 will be - * set when the optics detect a signal. On older adapters, it will be - * cleared when there is a signal. This applies to fiber media only. - */ - if(hw->media_type == e1000_media_type_fiber) - signal = (hw->mac_type > e1000_82544) ? E1000_CTRL_SWDPIN1 : 0; - - ctrl = E1000_READ_REG(hw, CTRL); - status = E1000_READ_REG(hw, STATUS); - rxcw = E1000_READ_REG(hw, RXCW); - - /* If we have a copper PHY then we only want to go out to the PHY - * registers to see if Auto-Neg has completed and/or if our link - * status has changed. The get_link_status flag will be set if we - * receive a Link Status Change interrupt or we have Rx Sequence - * Errors. - */ -#if 0 - if((hw->media_type == e1000_media_type_copper) && hw->get_link_status) { -#else - if(hw->media_type == e1000_media_type_copper) { -#endif - /* First we want to see if the MII Status Register reports - * link. If so, then we want to get the current speed/duplex - * of the PHY. - * Read the register twice since the link bit is sticky. - */ - if((ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data))) - return ret_val; - if((ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data))) - return ret_val; - - if(phy_data & MII_SR_LINK_STATUS) { -#if 0 - hw->get_link_status = FALSE; -#endif - } else { - /* No link detected */ - return -E1000_ERR_NOLINK; - } - - /* We have a M88E1000 PHY and Auto-Neg is enabled. If we - * have Si on board that is 82544 or newer, Auto - * Speed Detection takes care of MAC speed/duplex - * configuration. So we only need to configure Collision - * Distance in the MAC. Otherwise, we need to force - * speed/duplex on the MAC to the current PHY speed/duplex - * settings. - */ - if(hw->mac_type >= e1000_82544) - e1000_config_collision_dist(hw); - else { - if((ret_val = e1000_config_mac_to_phy(hw))) { - DEBUGOUT("Error configuring MAC to PHY settings\n"); - return ret_val; - } - } - - /* Configure Flow Control now that Auto-Neg has completed. First, we - * need to restore the desired flow control settings because we may - * have had to re-autoneg with a different link partner. - */ - if((ret_val = e1000_config_fc_after_link_up(hw))) { - DEBUGOUT("Error configuring flow control\n"); - return ret_val; - } - - /* At this point we know that we are on copper and we have - * auto-negotiated link. These are conditions for checking the link - * parter capability register. We use the link partner capability to - * determine if TBI Compatibility needs to be turned on or off. If - * the link partner advertises any speed in addition to Gigabit, then - * we assume that they are GMII-based, and TBI compatibility is not - * needed. If no other speeds are advertised, we assume the link - * partner is TBI-based, and we turn on TBI Compatibility. - */ - if(hw->tbi_compatibility_en) { - if((ret_val = e1000_read_phy_reg(hw, PHY_LP_ABILITY, - &lp_capability))) - return ret_val; - if(lp_capability & (NWAY_LPAR_10T_HD_CAPS | - NWAY_LPAR_10T_FD_CAPS | - NWAY_LPAR_100TX_HD_CAPS | - NWAY_LPAR_100TX_FD_CAPS | - NWAY_LPAR_100T4_CAPS)) { - /* If our link partner advertises anything in addition to - * gigabit, we do not need to enable TBI compatibility. - */ - if(hw->tbi_compatibility_on) { - /* If we previously were in the mode, turn it off. */ - rctl = E1000_READ_REG(hw, RCTL); - rctl &= ~E1000_RCTL_SBP; - E1000_WRITE_REG(hw, RCTL, rctl); - hw->tbi_compatibility_on = FALSE; - } - } else { - /* If TBI compatibility is was previously off, turn it on. For - * compatibility with a TBI link partner, we will store bad - * packets. Some frames have an additional byte on the end and - * will look like CRC errors to to the hardware. - */ - if(!hw->tbi_compatibility_on) { - hw->tbi_compatibility_on = TRUE; - rctl = E1000_READ_REG(hw, RCTL); - rctl |= E1000_RCTL_SBP; - E1000_WRITE_REG(hw, RCTL, rctl); - } - } - } - } - /* If we don't have link (auto-negotiation failed or link partner cannot - * auto-negotiate), the cable is plugged in (we have signal), and our - * link partner is not trying to auto-negotiate with us (we are receiving - * idles or data), we need to force link up. We also need to give - * auto-negotiation time to complete, in case the cable was just plugged - * in. The autoneg_failed flag does this. - */ - else if((((hw->media_type == e1000_media_type_fiber) && - ((ctrl & E1000_CTRL_SWDPIN1) == signal)) || - (hw->media_type == e1000_media_type_internal_serdes)) && - (!(status & E1000_STATUS_LU)) && - (!(rxcw & E1000_RXCW_C))) { - if(hw->autoneg_failed == 0) { - hw->autoneg_failed = 1; - return 0; - } - DEBUGOUT("NOT RXing /C/, disable AutoNeg and force link.\r\n"); - - /* Disable auto-negotiation in the TXCW register */ - E1000_WRITE_REG(hw, TXCW, (hw->txcw & ~E1000_TXCW_ANE)); - - /* Force link-up and also force full-duplex. */ - ctrl = E1000_READ_REG(hw, CTRL); - ctrl |= (E1000_CTRL_SLU | E1000_CTRL_FD); - E1000_WRITE_REG(hw, CTRL, ctrl); - - /* Configure Flow Control after forcing link up. */ - if((ret_val = e1000_config_fc_after_link_up(hw))) { - DEBUGOUT("Error configuring flow control\n"); - return ret_val; - } - } - /* If we are forcing link and we are receiving /C/ ordered sets, re-enable - * auto-negotiation in the TXCW register and disable forced link in the - * Device Control register in an attempt to auto-negotiate with our link - * partner. - */ - else if(((hw->media_type == e1000_media_type_fiber) || - (hw->media_type == e1000_media_type_internal_serdes)) && - (ctrl & E1000_CTRL_SLU) && - (rxcw & E1000_RXCW_C)) { - DEBUGOUT("RXing /C/, enable AutoNeg and stop forcing link.\r\n"); - E1000_WRITE_REG(hw, TXCW, hw->txcw); - E1000_WRITE_REG(hw, CTRL, (ctrl & ~E1000_CTRL_SLU)); - } -#if 0 - /* If we force link for non-auto-negotiation switch, check link status - * based on MAC synchronization for internal serdes media type. - */ - else if((hw->media_type == e1000_media_type_internal_serdes) && - !(E1000_TXCW_ANE & E1000_READ_REG(hw, TXCW))) { - /* SYNCH bit and IV bit are sticky. */ - udelay(10); - if(E1000_RXCW_SYNCH & E1000_READ_REG(hw, RXCW)) { - if(!(rxcw & E1000_RXCW_IV)) { - hw->serdes_link_down = FALSE; - DEBUGOUT("SERDES: Link is up.\n"); - } - } else { - hw->serdes_link_down = TRUE; - DEBUGOUT("SERDES: Link is down.\n"); - } - } -#endif - return E1000_SUCCESS; -} - -/****************************************************************************** - * Detects the current speed and duplex settings of the hardware. - * - * hw - Struct containing variables accessed by shared code - * speed - Speed of the connection - * duplex - Duplex setting of the connection - *****************************************************************************/ -static void -e1000_get_speed_and_duplex(struct e1000_hw *hw, - uint16_t *speed, - uint16_t *duplex) -{ - uint32_t status; - - DEBUGFUNC("e1000_get_speed_and_duplex"); - - if(hw->mac_type >= e1000_82543) { - status = E1000_READ_REG(hw, STATUS); - if(status & E1000_STATUS_SPEED_1000) { - *speed = SPEED_1000; - DEBUGOUT("1000 Mbs, "); - } else if(status & E1000_STATUS_SPEED_100) { - *speed = SPEED_100; - DEBUGOUT("100 Mbs, "); - } else { - *speed = SPEED_10; - DEBUGOUT("10 Mbs, "); - } - - if(status & E1000_STATUS_FD) { - *duplex = FULL_DUPLEX; - DEBUGOUT("Full Duplex\r\n"); - } else { - *duplex = HALF_DUPLEX; - DEBUGOUT(" Half Duplex\r\n"); - } - } else { - DEBUGOUT("1000 Mbs, Full Duplex\r\n"); - *speed = SPEED_1000; - *duplex = FULL_DUPLEX; - } -} - -/****************************************************************************** -* Blocks until autoneg completes or times out (~4.5 seconds) -* -* hw - Struct containing variables accessed by shared code -******************************************************************************/ -static int -e1000_wait_autoneg(struct e1000_hw *hw) -{ - int32_t ret_val; - uint16_t i; - uint16_t phy_data; - - DEBUGFUNC("e1000_wait_autoneg"); - DEBUGOUT("Waiting for Auto-Neg to complete.\n"); - - /* We will wait for autoneg to complete or 4.5 seconds to expire. */ - for(i = PHY_AUTO_NEG_TIME; i > 0; i--) { - /* Read the MII Status Register and wait for Auto-Neg - * Complete bit to be set. - */ - if((ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data))) - return ret_val; - if((ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data))) - return ret_val; - if(phy_data & MII_SR_AUTONEG_COMPLETE) { - DEBUGOUT("Auto-Neg complete.\n"); - return E1000_SUCCESS; - } - mdelay(100); - } - DEBUGOUT("Auto-Neg timedout.\n"); - return -E1000_ERR_TIMEOUT; -} - -/****************************************************************************** -* Raises the Management Data Clock -* -* hw - Struct containing variables accessed by shared code -* ctrl - Device control register's current value -******************************************************************************/ -static void -e1000_raise_mdi_clk(struct e1000_hw *hw, - uint32_t *ctrl) -{ - /* Raise the clock input to the Management Data Clock (by setting the MDC - * bit), and then delay 10 microseconds. - */ - E1000_WRITE_REG(hw, CTRL, (*ctrl | E1000_CTRL_MDC)); - E1000_WRITE_FLUSH(hw); - udelay(10); -} - -/****************************************************************************** -* Lowers the Management Data Clock -* -* hw - Struct containing variables accessed by shared code -* ctrl - Device control register's current value -******************************************************************************/ -static void -e1000_lower_mdi_clk(struct e1000_hw *hw, - uint32_t *ctrl) -{ - /* Lower the clock input to the Management Data Clock (by clearing the MDC - * bit), and then delay 10 microseconds. - */ - E1000_WRITE_REG(hw, CTRL, (*ctrl & ~E1000_CTRL_MDC)); - E1000_WRITE_FLUSH(hw); - udelay(10); -} - -/****************************************************************************** -* Shifts data bits out to the PHY -* -* hw - Struct containing variables accessed by shared code -* data - Data to send out to the PHY -* count - Number of bits to shift out -* -* Bits are shifted out in MSB to LSB order. -******************************************************************************/ -static void -e1000_shift_out_mdi_bits(struct e1000_hw *hw, - uint32_t data, - uint16_t count) -{ - uint32_t ctrl; - uint32_t mask; - - /* We need to shift "count" number of bits out to the PHY. So, the value - * in the "data" parameter will be shifted out to the PHY one bit at a - * time. In order to do this, "data" must be broken down into bits. - */ - mask = 0x01; - mask <<= (count - 1); - - ctrl = E1000_READ_REG(hw, CTRL); - - /* Set MDIO_DIR and MDC_DIR direction bits to be used as output pins. */ - ctrl |= (E1000_CTRL_MDIO_DIR | E1000_CTRL_MDC_DIR); - - while(mask) { - /* A "1" is shifted out to the PHY by setting the MDIO bit to "1" and - * then raising and lowering the Management Data Clock. A "0" is - * shifted out to the PHY by setting the MDIO bit to "0" and then - * raising and lowering the clock. - */ - if(data & mask) ctrl |= E1000_CTRL_MDIO; - else ctrl &= ~E1000_CTRL_MDIO; - - E1000_WRITE_REG(hw, CTRL, ctrl); - E1000_WRITE_FLUSH(hw); - - udelay(10); - - e1000_raise_mdi_clk(hw, &ctrl); - e1000_lower_mdi_clk(hw, &ctrl); - - mask = mask >> 1; - } -} - -/****************************************************************************** -* Shifts data bits in from the PHY -* -* hw - Struct containing variables accessed by shared code -* -* Bits are shifted in in MSB to LSB order. -******************************************************************************/ -static uint16_t -e1000_shift_in_mdi_bits(struct e1000_hw *hw) -{ - uint32_t ctrl; - uint16_t data = 0; - uint8_t i; - - /* In order to read a register from the PHY, we need to shift in a total - * of 18 bits from the PHY. The first two bit (turnaround) times are used - * to avoid contention on the MDIO pin when a read operation is performed. - * These two bits are ignored by us and thrown away. Bits are "shifted in" - * by raising the input to the Management Data Clock (setting the MDC bit), - * and then reading the value of the MDIO bit. - */ - ctrl = E1000_READ_REG(hw, CTRL); - - /* Clear MDIO_DIR (SWDPIO1) to indicate this bit is to be used as input. */ - ctrl &= ~E1000_CTRL_MDIO_DIR; - ctrl &= ~E1000_CTRL_MDIO; - - E1000_WRITE_REG(hw, CTRL, ctrl); - E1000_WRITE_FLUSH(hw); - - /* Raise and Lower the clock before reading in the data. This accounts for - * the turnaround bits. The first clock occurred when we clocked out the - * last bit of the Register Address. - */ - e1000_raise_mdi_clk(hw, &ctrl); - e1000_lower_mdi_clk(hw, &ctrl); - - for(data = 0, i = 0; i < 16; i++) { - data = data << 1; - e1000_raise_mdi_clk(hw, &ctrl); - ctrl = E1000_READ_REG(hw, CTRL); - /* Check to see if we shifted in a "1". */ - if(ctrl & E1000_CTRL_MDIO) data |= 1; - e1000_lower_mdi_clk(hw, &ctrl); - } - - e1000_raise_mdi_clk(hw, &ctrl); - e1000_lower_mdi_clk(hw, &ctrl); - - return data; -} - -/***************************************************************************** -* Reads the value from a PHY register, if the value is on a specific non zero -* page, sets the page first. -* -* hw - Struct containing variables accessed by shared code -* reg_addr - address of the PHY register to read -******************************************************************************/ -static int -e1000_read_phy_reg(struct e1000_hw *hw, - uint32_t reg_addr, - uint16_t *phy_data) -{ - uint32_t ret_val; - - DEBUGFUNC("e1000_read_phy_reg"); - - if(hw->phy_type == e1000_phy_igp && - (reg_addr > MAX_PHY_MULTI_PAGE_REG)) { - if((ret_val = e1000_write_phy_reg_ex(hw, IGP01E1000_PHY_PAGE_SELECT, - (uint16_t)reg_addr))) - return ret_val; - } - - ret_val = e1000_read_phy_reg_ex(hw, IGP01E1000_PHY_PAGE_SELECT & reg_addr, - phy_data); - - return ret_val; -} - -static int -e1000_read_phy_reg_ex(struct e1000_hw *hw, - uint32_t reg_addr, - uint16_t *phy_data) -{ - uint32_t i; - uint32_t mdic = 0; - const uint32_t phy_addr = 1; - - DEBUGFUNC("e1000_read_phy_reg_ex"); - - if(reg_addr > MAX_PHY_REG_ADDRESS) { - DEBUGOUT1("PHY Address %d is out of range\n", reg_addr); - return -E1000_ERR_PARAM; - } - - if(hw->mac_type > e1000_82543) { - /* Set up Op-code, Phy Address, and register address in the MDI - * Control register. The MAC will take care of interfacing with the - * PHY to retrieve the desired data. - */ - mdic = ((reg_addr << E1000_MDIC_REG_SHIFT) | - (phy_addr << E1000_MDIC_PHY_SHIFT) | - (E1000_MDIC_OP_READ)); - - E1000_WRITE_REG(hw, MDIC, mdic); - - /* Poll the ready bit to see if the MDI read completed */ - for(i = 0; i < 64; i++) { - udelay(50); - mdic = E1000_READ_REG(hw, MDIC); - if(mdic & E1000_MDIC_READY) break; - } - if(!(mdic & E1000_MDIC_READY)) { - DEBUGOUT("MDI Read did not complete\n"); - return -E1000_ERR_PHY; - } - if(mdic & E1000_MDIC_ERROR) { - DEBUGOUT("MDI Error\n"); - return -E1000_ERR_PHY; - } - *phy_data = (uint16_t) mdic; - } else { - /* We must first send a preamble through the MDIO pin to signal the - * beginning of an MII instruction. This is done by sending 32 - * consecutive "1" bits. - */ - e1000_shift_out_mdi_bits(hw, PHY_PREAMBLE, PHY_PREAMBLE_SIZE); - - /* Now combine the next few fields that are required for a read - * operation. We use this method instead of calling the - * e1000_shift_out_mdi_bits routine five different times. The format of - * a MII read instruction consists of a shift out of 14 bits and is - * defined as follows: - * - * followed by a shift in of 18 bits. This first two bits shifted in - * are TurnAround bits used to avoid contention on the MDIO pin when a - * READ operation is performed. These two bits are thrown away - * followed by a shift in of 16 bits which contains the desired data. - */ - mdic = ((reg_addr) | (phy_addr << 5) | - (PHY_OP_READ << 10) | (PHY_SOF << 12)); - - e1000_shift_out_mdi_bits(hw, mdic, 14); - - /* Now that we've shifted out the read command to the MII, we need to - * "shift in" the 16-bit value (18 total bits) of the requested PHY - * register address. - */ - *phy_data = e1000_shift_in_mdi_bits(hw); - } - return E1000_SUCCESS; -} - -/****************************************************************************** -* Writes a value to a PHY register -* -* hw - Struct containing variables accessed by shared code -* reg_addr - address of the PHY register to write -* data - data to write to the PHY -******************************************************************************/ -static int -e1000_write_phy_reg(struct e1000_hw *hw, - uint32_t reg_addr, - uint16_t phy_data) -{ - uint32_t ret_val; - - DEBUGFUNC("e1000_write_phy_reg"); - - if(hw->phy_type == e1000_phy_igp && - (reg_addr > MAX_PHY_MULTI_PAGE_REG)) { - if((ret_val = e1000_write_phy_reg_ex(hw, IGP01E1000_PHY_PAGE_SELECT, - (uint16_t)reg_addr))) - return ret_val; - } - - ret_val = e1000_write_phy_reg_ex(hw, IGP01E1000_PHY_PAGE_SELECT & reg_addr, - phy_data); - - return ret_val; -} - -static int -e1000_write_phy_reg_ex(struct e1000_hw *hw, - uint32_t reg_addr, - uint16_t phy_data) -{ - uint32_t i; - uint32_t mdic = 0; - const uint32_t phy_addr = 1; - - DEBUGFUNC("e1000_write_phy_reg_ex"); - - if(reg_addr > MAX_PHY_REG_ADDRESS) { - DEBUGOUT1("PHY Address %d is out of range\n", reg_addr); - return -E1000_ERR_PARAM; - } - - if(hw->mac_type > e1000_82543) { - /* Set up Op-code, Phy Address, register address, and data intended - * for the PHY register in the MDI Control register. The MAC will take - * care of interfacing with the PHY to send the desired data. - */ - mdic = (((uint32_t) phy_data) | - (reg_addr << E1000_MDIC_REG_SHIFT) | - (phy_addr << E1000_MDIC_PHY_SHIFT) | - (E1000_MDIC_OP_WRITE)); - - E1000_WRITE_REG(hw, MDIC, mdic); - - /* Poll the ready bit to see if the MDI read completed */ - for(i = 0; i < 640; i++) { - udelay(5); - mdic = E1000_READ_REG(hw, MDIC); - if(mdic & E1000_MDIC_READY) break; - } - if(!(mdic & E1000_MDIC_READY)) { - DEBUGOUT("MDI Write did not complete\n"); - return -E1000_ERR_PHY; - } - } else { - /* We'll need to use the SW defined pins to shift the write command - * out to the PHY. We first send a preamble to the PHY to signal the - * beginning of the MII instruction. This is done by sending 32 - * consecutive "1" bits. - */ - e1000_shift_out_mdi_bits(hw, PHY_PREAMBLE, PHY_PREAMBLE_SIZE); - - /* Now combine the remaining required fields that will indicate a - * write operation. We use this method instead of calling the - * e1000_shift_out_mdi_bits routine for each field in the command. The - * format of a MII write instruction is as follows: - * . - */ - mdic = ((PHY_TURNAROUND) | (reg_addr << 2) | (phy_addr << 7) | - (PHY_OP_WRITE << 12) | (PHY_SOF << 14)); - mdic <<= 16; - mdic |= (uint32_t) phy_data; - - e1000_shift_out_mdi_bits(hw, mdic, 32); - } - - return E1000_SUCCESS; -} - -/****************************************************************************** -* Returns the PHY to the power-on reset state -* -* hw - Struct containing variables accessed by shared code -******************************************************************************/ -static void -e1000_phy_hw_reset(struct e1000_hw *hw) -{ - uint32_t ctrl, ctrl_ext; - - DEBUGFUNC("e1000_phy_hw_reset"); - - DEBUGOUT("Resetting Phy...\n"); - - if(hw->mac_type > e1000_82543) { - /* Read the device control register and assert the E1000_CTRL_PHY_RST - * bit. Then, take it out of reset. - */ - ctrl = E1000_READ_REG(hw, CTRL); - E1000_WRITE_REG(hw, CTRL, ctrl | E1000_CTRL_PHY_RST); - E1000_WRITE_FLUSH(hw); - mdelay(10); - E1000_WRITE_REG(hw, CTRL, ctrl); - E1000_WRITE_FLUSH(hw); - } else { - /* Read the Extended Device Control Register, assert the PHY_RESET_DIR - * bit to put the PHY into reset. Then, take it out of reset. - */ - ctrl_ext = E1000_READ_REG(hw, CTRL_EXT); - ctrl_ext |= E1000_CTRL_EXT_SDP4_DIR; - ctrl_ext &= ~E1000_CTRL_EXT_SDP4_DATA; - E1000_WRITE_REG(hw, CTRL_EXT, ctrl_ext); - E1000_WRITE_FLUSH(hw); - mdelay(10); - ctrl_ext |= E1000_CTRL_EXT_SDP4_DATA; - E1000_WRITE_REG(hw, CTRL_EXT, ctrl_ext); - E1000_WRITE_FLUSH(hw); - } - udelay(150); -} - -/****************************************************************************** -* Resets the PHY -* -* hw - Struct containing variables accessed by shared code -* -* Sets bit 15 of the MII Control regiser -******************************************************************************/ -static int -e1000_phy_reset(struct e1000_hw *hw) -{ - int32_t ret_val; - uint16_t phy_data; - - DEBUGFUNC("e1000_phy_reset"); - - if(hw->mac_type != e1000_82541_rev_2) { - if((ret_val = e1000_read_phy_reg(hw, PHY_CTRL, &phy_data))) - return ret_val; - - phy_data |= MII_CR_RESET; - if((ret_val = e1000_write_phy_reg(hw, PHY_CTRL, phy_data))) - return ret_val; - - udelay(1); - } else e1000_phy_hw_reset(hw); - - if(hw->phy_type == e1000_phy_igp) - e1000_phy_init_script(hw); - - return E1000_SUCCESS; -} - -/****************************************************************************** -* Probes the expected PHY address for known PHY IDs -* -* hw - Struct containing variables accessed by shared code -******************************************************************************/ -static int -e1000_detect_gig_phy(struct e1000_hw *hw) -{ - int32_t phy_init_status, ret_val; - uint16_t phy_id_high, phy_id_low; - boolean_t match = FALSE; - - DEBUGFUNC("e1000_detect_gig_phy"); - - /* Read the PHY ID Registers to identify which PHY is onboard. */ - if((ret_val = e1000_read_phy_reg(hw, PHY_ID1, &phy_id_high))) - return ret_val; - - hw->phy_id = (uint32_t) (phy_id_high << 16); - udelay(20); - if((ret_val = e1000_read_phy_reg(hw, PHY_ID2, &phy_id_low))) - return ret_val; - - hw->phy_id |= (uint32_t) (phy_id_low & PHY_REVISION_MASK); -#ifdef LINUX_DRIVER - hw->phy_revision = (uint32_t) phy_id_low & ~PHY_REVISION_MASK; -#endif - - switch(hw->mac_type) { - case e1000_82543: - if(hw->phy_id == M88E1000_E_PHY_ID) match = TRUE; - break; - case e1000_82544: - if(hw->phy_id == M88E1000_I_PHY_ID) match = TRUE; - break; - case e1000_82540: - case e1000_82545: - case e1000_82545_rev_3: - case e1000_82546: - case e1000_82546_rev_3: - if(hw->phy_id == M88E1011_I_PHY_ID) match = TRUE; - break; - case e1000_82541: - case e1000_82541_rev_2: - case e1000_82547: - case e1000_82547_rev_2: - if(hw->phy_id == IGP01E1000_I_PHY_ID) match = TRUE; - break; - default: - DEBUGOUT1("Invalid MAC type %d\n", hw->mac_type); - return -E1000_ERR_CONFIG; - } - phy_init_status = e1000_set_phy_type(hw); - - if ((match) && (phy_init_status == E1000_SUCCESS)) { - DEBUGOUT1("PHY ID 0x%X detected\n", hw->phy_id); - return E1000_SUCCESS; - } - DEBUGOUT1("Invalid PHY ID 0x%X\n", hw->phy_id); - return -E1000_ERR_PHY; -} - -/****************************************************************************** - * Sets up eeprom variables in the hw struct. Must be called after mac_type - * is configured. - * - * hw - Struct containing variables accessed by shared code - *****************************************************************************/ -static void -e1000_init_eeprom_params(struct e1000_hw *hw) -{ - struct e1000_eeprom_info *eeprom = &hw->eeprom; - uint32_t eecd = E1000_READ_REG(hw, EECD); - uint16_t eeprom_size; - - DEBUGFUNC("e1000_init_eeprom_params"); - - switch (hw->mac_type) { - case e1000_82542_rev2_0: - case e1000_82542_rev2_1: - case e1000_82543: - case e1000_82544: - eeprom->type = e1000_eeprom_microwire; - eeprom->word_size = 64; - eeprom->opcode_bits = 3; - eeprom->address_bits = 6; - eeprom->delay_usec = 50; - break; - case e1000_82540: - case e1000_82545: - case e1000_82545_rev_3: - case e1000_82546: - case e1000_82546_rev_3: - eeprom->type = e1000_eeprom_microwire; - eeprom->opcode_bits = 3; - eeprom->delay_usec = 50; - if(eecd & E1000_EECD_SIZE) { - eeprom->word_size = 256; - eeprom->address_bits = 8; - } else { - eeprom->word_size = 64; - eeprom->address_bits = 6; - } - break; - case e1000_82541: - case e1000_82541_rev_2: - case e1000_82547: - case e1000_82547_rev_2: - if (eecd & E1000_EECD_TYPE) { - eeprom->type = e1000_eeprom_spi; - if (eecd & E1000_EECD_ADDR_BITS) { - eeprom->page_size = 32; - eeprom->address_bits = 16; - } else { - eeprom->page_size = 8; - eeprom->address_bits = 8; - } - } else { - eeprom->type = e1000_eeprom_microwire; - eeprom->opcode_bits = 3; - eeprom->delay_usec = 50; - if (eecd & E1000_EECD_ADDR_BITS) { - eeprom->word_size = 256; - eeprom->address_bits = 8; - } else { - eeprom->word_size = 64; - eeprom->address_bits = 6; - } - } - break; - default: - eeprom->type = e1000_eeprom_spi; - if (eecd & E1000_EECD_ADDR_BITS) { - eeprom->page_size = 32; - eeprom->address_bits = 16; - } else { - eeprom->page_size = 8; - eeprom->address_bits = 8; - } - break; - } - - if (eeprom->type == e1000_eeprom_spi) { - eeprom->opcode_bits = 8; - eeprom->delay_usec = 1; - eeprom->word_size = 64; - if (e1000_read_eeprom(hw, EEPROM_CFG, 1, &eeprom_size) == 0) { - eeprom_size &= EEPROM_SIZE_MASK; - - switch (eeprom_size) { - case EEPROM_SIZE_16KB: - eeprom->word_size = 8192; - break; - case EEPROM_SIZE_8KB: - eeprom->word_size = 4096; - break; - case EEPROM_SIZE_4KB: - eeprom->word_size = 2048; - break; - case EEPROM_SIZE_2KB: - eeprom->word_size = 1024; - break; - case EEPROM_SIZE_1KB: - eeprom->word_size = 512; - break; - case EEPROM_SIZE_512B: - eeprom->word_size = 256; - break; - case EEPROM_SIZE_128B: - default: - break; - } - } - } -} - -/** - * e1000_reset - Reset the adapter - */ - -static int -e1000_reset(struct e1000_hw *hw) -{ - uint32_t pba; - /* Repartition Pba for greater than 9k mtu - * To take effect CTRL.RST is required. - */ - - if(hw->mac_type < e1000_82547) { - pba = E1000_PBA_48K; - } else { - pba = E1000_PBA_30K; - } - E1000_WRITE_REG(hw, PBA, pba); - - /* flow control settings */ -#if 0 - hw->fc_high_water = FC_DEFAULT_HI_THRESH; - hw->fc_low_water = FC_DEFAULT_LO_THRESH; - hw->fc_pause_time = FC_DEFAULT_TX_TIMER; - hw->fc_send_xon = 1; - hw->fc = hw->original_fc; -#endif - - e1000_reset_hw(hw); - if(hw->mac_type >= e1000_82544) - E1000_WRITE_REG(hw, WUC, 0); - return e1000_init_hw(hw); -} - -/** - * e1000_sw_init - Initialize general software structures (struct e1000_adapter) - * @adapter: board private structure to initialize - * - * e1000_sw_init initializes the Adapter private data structure. - * Fields are initialized based on PCI device information and - * OS network device settings (MTU size). - **/ - -static int -e1000_sw_init(struct pci_device *pdev, struct e1000_hw *hw) -{ - int result; - - /* PCI config space info */ - pci_read_config_word(pdev, PCI_VENDOR_ID, &hw->vendor_id); - pci_read_config_word(pdev, PCI_DEVICE_ID, &hw->device_id); - pci_read_config_byte(pdev, PCI_REVISION, &hw->revision_id); -#if 0 - pci_read_config_word(pdev, PCI_SUBSYSTEM_VENDOR_ID, - &hw->subsystem_vendor_id); - pci_read_config_word(pdev, PCI_SUBSYSTEM_ID, &hw->subsystem_id); -#endif - - pci_read_config_word(pdev, PCI_COMMAND, &hw->pci_cmd_word); - - /* identify the MAC */ - - result = e1000_set_mac_type(hw); - if (result) { - E1000_ERR("Unknown MAC Type\n"); - return result; - } - - /* initialize eeprom parameters */ - - e1000_init_eeprom_params(hw); - -#if 0 - if((hw->mac_type == e1000_82541) || - (hw->mac_type == e1000_82547) || - (hw->mac_type == e1000_82541_rev_2) || - (hw->mac_type == e1000_82547_rev_2)) - hw->phy_init_script = 1; -#endif - - e1000_set_media_type(hw); - -#if 0 - if(hw->mac_type < e1000_82543) - hw->report_tx_early = 0; - else - hw->report_tx_early = 1; - - hw->wait_autoneg_complete = FALSE; -#endif - hw->tbi_compatibility_en = TRUE; -#if 0 - hw->adaptive_ifs = TRUE; - - /* Copper options */ - - if(hw->media_type == e1000_media_type_copper) { - hw->mdix = AUTO_ALL_MODES; - hw->disable_polarity_correction = FALSE; - hw->master_slave = E1000_MASTER_SLAVE; - } -#endif - return E1000_SUCCESS; -} - -static void fill_rx (void) -{ - struct e1000_rx_desc *rd; - rx_last = rx_tail; - rd = rx_base + rx_tail; - rx_tail = (rx_tail + 1) % 8; - memset (rd, 0, 16); - rd->buffer_addr = virt_to_bus(&packet); - E1000_WRITE_REG (&hw, RDT, rx_tail); -} - -static void init_descriptor (void) -{ - unsigned long ptr; - unsigned long tctl; - - ptr = virt_to_phys(tx_pool); - if (ptr & 0xf) - ptr = (ptr + 0x10) & (~0xf); - - tx_base = phys_to_virt(ptr); - - E1000_WRITE_REG (&hw, TDBAL, virt_to_bus(tx_base)); - E1000_WRITE_REG (&hw, TDBAH, 0); - E1000_WRITE_REG (&hw, TDLEN, 128); - - /* Setup the HW Tx Head and Tail descriptor pointers */ - - E1000_WRITE_REG (&hw, TDH, 0); - E1000_WRITE_REG (&hw, TDT, 0); - tx_tail = 0; - - /* Program the Transmit Control Register */ - -#ifdef LINUX_DRIVER_TCTL - tctl = E1000_READ_REG(&hw, TCTL); - - tctl &= ~E1000_TCTL_CT; - tctl |= E1000_TCTL_EN | E1000_TCTL_PSP | - (E1000_COLLISION_THRESHOLD << E1000_CT_SHIFT); -#else - tctl = E1000_TCTL_PSP | E1000_TCTL_EN | - (E1000_COLLISION_THRESHOLD << E1000_CT_SHIFT) | - (E1000_HDX_COLLISION_DISTANCE << E1000_COLD_SHIFT); -#endif - - E1000_WRITE_REG (&hw, TCTL, tctl); - - e1000_config_collision_dist(&hw); - - - rx_tail = 0; - /* disable receive */ - E1000_WRITE_REG (&hw, RCTL, 0); - ptr = virt_to_phys(rx_pool); - if (ptr & 0xf) - ptr = (ptr + 0x10) & (~0xf); - rx_base = phys_to_virt(ptr); - - /* Setup the Base and Length of the Rx Descriptor Ring */ - - E1000_WRITE_REG (&hw, RDBAL, virt_to_bus(rx_base)); - E1000_WRITE_REG (&hw, RDBAH, 0); - - E1000_WRITE_REG (&hw, RDLEN, 128); - - /* Setup the HW Rx Head and Tail Descriptor Pointers */ - E1000_WRITE_REG (&hw, RDH, 0); - E1000_WRITE_REG (&hw, RDT, 0); - - E1000_WRITE_REG (&hw, RCTL, - E1000_RCTL_EN | - E1000_RCTL_BAM | - E1000_RCTL_SZ_2048 | - E1000_RCTL_MPE); - fill_rx(); -} - - - -/************************************************************************** -POLL - Wait for a frame -***************************************************************************/ -static int -e1000_poll (struct nic *nic, int retrieve) -{ - /* return true if there's an ethernet packet ready to read */ - /* nic->packet should contain data on return */ - /* nic->packetlen should contain length of data */ - struct e1000_rx_desc *rd; - - rd = rx_base + rx_last; - if (!rd->status & E1000_RXD_STAT_DD) - return 0; - - if ( ! retrieve ) return 1; - - // printf("recv: packet %! -> %! len=%d \n", packet+6, packet,rd->Length); - memcpy (nic->packet, packet, rd->length); - nic->packetlen = rd->length; - fill_rx (); - return 1; -} - -/************************************************************************** -TRANSMIT - Transmit a frame -***************************************************************************/ -static void -e1000_transmit (struct nic *nic, const char *d, /* Destination */ - unsigned int type, /* Type */ - unsigned int size, /* size */ - const char *p) /* Packet */ -{ - /* send the packet to destination */ - struct eth_hdr { - unsigned char dst_addr[ETH_ALEN]; - unsigned char src_addr[ETH_ALEN]; - unsigned short type; - } hdr; - struct e1000_tx_desc *txhd; /* header */ - struct e1000_tx_desc *txp; /* payload */ - DEBUGFUNC("send"); - - memcpy (&hdr.dst_addr, d, ETH_ALEN); - memcpy (&hdr.src_addr, nic->node_addr, ETH_ALEN); - - hdr.type = htons (type); - txhd = tx_base + tx_tail; - tx_tail = (tx_tail + 1) % 8; - txp = tx_base + tx_tail; - tx_tail = (tx_tail + 1) % 8; - - txhd->buffer_addr = virt_to_bus (&hdr); - txhd->lower.data = sizeof (hdr); - txhd->upper.data = 0; - - txp->buffer_addr = virt_to_bus(p); - txp->lower.data = E1000_TXD_CMD_RPS | E1000_TXD_CMD_EOP | E1000_TXD_CMD_IFCS | size; - txp->upper.data = 0; - - E1000_WRITE_REG (&hw, TDT, tx_tail); - while (!(txp->upper.data & E1000_TXD_STAT_DD)) { - udelay(10); /* give the nic a chance to write to the register */ - poll_interruptions(); - } - DEBUGFUNC("send end"); -} - - -/************************************************************************** -DISABLE - Turn off ethernet interface -***************************************************************************/ -static void e1000_disable (struct dev *dev __unused) -{ - /* Clear the transmit ring */ - E1000_WRITE_REG (&hw, TDH, 0); - E1000_WRITE_REG (&hw, TDT, 0); - - /* Clear the receive ring */ - E1000_WRITE_REG (&hw, RDH, 0); - E1000_WRITE_REG (&hw, RDT, 0); - - /* put the card in its initial state */ - E1000_WRITE_REG (&hw, CTRL, E1000_CTRL_RST); - - /* Turn off the ethernet interface */ - E1000_WRITE_REG (&hw, RCTL, 0); - E1000_WRITE_REG (&hw, TCTL, 0); - mdelay (10); - - /* Unmap my window to the device */ - iounmap(hw.hw_addr); -} - -/************************************************************************** -IRQ - Enable, Disable, or Force interrupts -***************************************************************************/ -static void e1000_irq(struct nic *nic __unused, irq_action_t action __unused) -{ - switch ( action ) { - case DISABLE : - break; - case ENABLE : - break; - case FORCE : - break; - } -} - -#define IORESOURCE_IO 0x00000100 /* Resource type */ -#define BAR_0 0 -#define BAR_1 1 -#define BAR_5 5 - -/************************************************************************** -PROBE - Look for an adapter, this routine's visible to the outside -You should omit the last argument struct pci_device * for a non-PCI NIC -***************************************************************************/ -static int e1000_probe(struct dev *dev, struct pci_device *p) -{ - struct nic *nic = (struct nic *)dev; - unsigned long mmio_start, mmio_len; - int ret_val, i; - - if (p == 0) - return 0; - /* Initialize hw with default values */ - memset(&hw, 0, sizeof(hw)); - hw.pdev = p; - -#if 1 - /* Are these variables needed? */ - hw.fc = e1000_fc_none; -#if 0 - hw.original_fc = e1000_fc_none; -#endif - hw.autoneg_failed = 0; -#if 0 - hw.get_link_status = TRUE; -#endif -#endif - - mmio_start = pci_bar_start(p, PCI_BASE_ADDRESS_0); - mmio_len = pci_bar_size(p, PCI_BASE_ADDRESS_0); - hw.hw_addr = ioremap(mmio_start, mmio_len); - - for(i = BAR_1; i <= BAR_5; i++) { - if(pci_bar_size(p, i) == 0) - continue; - if(pci_find_capability(p, i) & IORESOURCE_IO) { - hw.io_base = pci_bar_start(p, i); - break; - } - } - - adjust_pci_device(p); - - nic->ioaddr = p->ioaddr & ~3; - nic->irqno = 0; - - /* From Matt Hortman */ - /* MAC and Phy settings */ - - /* setup the private structure */ - if (e1000_sw_init(p, &hw) < 0) { - iounmap(hw.hw_addr); - return 0; - } - - /* make sure the EEPROM is good */ - - if (e1000_validate_eeprom_checksum(&hw) < 0) { - printf ("The EEPROM Checksum Is Not Valid\n"); - iounmap(hw.hw_addr); - return 0; - } - - /* copy the MAC address out of the EEPROM */ - - e1000_read_mac_addr(&hw); - memcpy (nic->node_addr, hw.mac_addr, ETH_ALEN); - - printf("Ethernet addr: %!\n", nic->node_addr); - - /* reset the hardware with the new settings */ - - ret_val = e1000_reset(&hw); - if (ret_val < 0) { - if ((ret_val == -E1000_ERR_NOLINK) || - (ret_val == -E1000_ERR_TIMEOUT)) { - E1000_ERR("Valid Link not detected\n"); - } else { - E1000_ERR("Hardware Initialization Failed\n"); - } - iounmap(hw.hw_addr); - return 0; - } - init_descriptor(); - - /* point to NIC specific routines */ - dev->disable = e1000_disable; - nic->poll = e1000_poll; - nic->transmit = e1000_transmit; - nic->irq = e1000_irq; - - return 1; -} - -static struct pci_id e1000_nics[] = { -PCI_ROM(0x8086, 0x1000, "e1000-82542", "Intel EtherExpressPro1000"), -PCI_ROM(0x8086, 0x1001, "e1000-82543gc-fiber", "Intel EtherExpressPro1000 82543GC Fiber"), -PCI_ROM(0x8086, 0x1004, "e1000-82543gc-copper", "Intel EtherExpressPro1000 82543GC Copper"), -PCI_ROM(0x8086, 0x1008, "e1000-82544ei-copper", "Intel EtherExpressPro1000 82544EI Copper"), -PCI_ROM(0x8086, 0x1009, "e1000-82544ei-fiber", "Intel EtherExpressPro1000 82544EI Fiber"), -PCI_ROM(0x8086, 0x100C, "e1000-82544gc-copper", "Intel EtherExpressPro1000 82544GC Copper"), -PCI_ROM(0x8086, 0x100D, "e1000-82544gc-lom", "Intel EtherExpressPro1000 82544GC LOM"), -PCI_ROM(0x8086, 0x100E, "e1000-82540em", "Intel EtherExpressPro1000 82540EM"), -PCI_ROM(0x8086, 0x100F, "e1000-82545em-copper", "Intel EtherExpressPro1000 82545EM Copper"), -PCI_ROM(0x8086, 0x1010, "e1000-82546eb-copper", "Intel EtherExpressPro1000 82546EB Copper"), -PCI_ROM(0x8086, 0x1011, "e1000-82545em-fiber", "Intel EtherExpressPro1000 82545EM Fiber"), -PCI_ROM(0x8086, 0x1012, "e1000-82546eb-fiber", "Intel EtherExpressPro1000 82546EB Copper"), -PCI_ROM(0x8086, 0x1013, "e1000-82541ei", "Intel EtherExpressPro1000 82541EI"), -PCI_ROM(0x8086, 0x1015, "e1000-82540em-lom", "Intel EtherExpressPro1000 82540EM LOM"), -PCI_ROM(0x8086, 0x1016, "e1000-82540ep-lom", "Intel EtherExpressPro1000 82540EP LOM"), -PCI_ROM(0x8086, 0x1017, "e1000-82540ep", "Intel EtherExpressPro1000 82540EP"), -PCI_ROM(0x8086, 0x1018, "e1000-82541ep", "Intel EtherExpressPro1000 82541EP"), -PCI_ROM(0x8086, 0x1019, "e1000-82547ei", "Intel EtherExpressPro1000 82547EI"), -PCI_ROM(0x8086, 0x101d, "e1000-82546eb-quad-copper", "Intel EtherExpressPro1000 82546EB Quad Copper"), -PCI_ROM(0x8086, 0x101e, "e1000-82540ep-lp", "Intel EtherExpressPro1000 82540EP LP"), -PCI_ROM(0x8086, 0x1026, "e1000-82545gm-copper", "Intel EtherExpressPro1000 82545GM Copper"), -PCI_ROM(0x8086, 0x1027, "e1000-82545gm-fiber", "Intel EtherExpressPro1000 82545GM Fiber"), -PCI_ROM(0x8086, 0x1028, "e1000-82545gm-serdes", "Intel EtherExpressPro1000 82545GM SERDES"), -PCI_ROM(0x8086, 0x1075, "e1000-82547gi", "Intel EtherExpressPro1000 82547GI"), -PCI_ROM(0x8086, 0x1076, "e1000-82541gi", "Intel EtherExpressPro1000 82541GI"), -PCI_ROM(0x8086, 0x1077, "e1000-82541gi-mobile", "Intel EtherExpressPro1000 82541GI Mobile"), -PCI_ROM(0x8086, 0x1078, "e1000-82541er", "Intel EtherExpressPro1000 82541ER"), -PCI_ROM(0x8086, 0x1079, "e1000-82546gb-copper", "Intel EtherExpressPro1000 82546GB Copper"), -PCI_ROM(0x8086, 0x107a, "e1000-82546gb-fiber", "Intel EtherExpressPro1000 82546GB Fiber"), -PCI_ROM(0x8086, 0x107b, "e1000-82546gb-serdes", "Intel EtherExpressPro1000 82546GB SERDES"), -}; - -struct pci_driver e1000_driver = { - .type = NIC_DRIVER, - .name = "E1000", - .probe = e1000_probe, - .ids = e1000_nics, - .id_count = sizeof(e1000_nics)/sizeof(e1000_nics[0]), - .class = 0, -}; diff --git a/usr/src/grub/grub-0.95/netboot/e1000_hw.h b/usr/src/grub/grub-0.95/netboot/e1000_hw.h deleted file mode 100644 index 7c7f48f617..0000000000 --- a/usr/src/grub/grub-0.95/netboot/e1000_hw.h +++ /dev/null @@ -1,2058 +0,0 @@ -/******************************************************************************* - - - Copyright(c) 1999 - 2003 Intel 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 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. - - The full GNU General Public License is included in this distribution in the - file called LICENSE. - - Contact Information: - Linux NICS - Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - -*******************************************************************************/ - -/* e1000_hw.h - * Structures, enums, and macros for the MAC - */ - -#ifndef _E1000_HW_H_ -#define _E1000_HW_H_ - -/* Forward declarations of structures used by the shared code */ -struct e1000_hw; -struct e1000_hw_stats; - -/* Enumerated types specific to the e1000 hardware */ -/* Media Access Controlers */ -typedef enum { - e1000_undefined = 0, - e1000_82542_rev2_0, - e1000_82542_rev2_1, - e1000_82543, - e1000_82544, - e1000_82540, - e1000_82545, - e1000_82545_rev_3, - e1000_82546, - e1000_82546_rev_3, - e1000_82541, - e1000_82541_rev_2, - e1000_82547, - e1000_82547_rev_2, - e1000_num_macs -} e1000_mac_type; - -typedef enum { - e1000_eeprom_uninitialized = 0, - e1000_eeprom_spi, - e1000_eeprom_microwire, - e1000_num_eeprom_types -} e1000_eeprom_type; - -/* Media Types */ -typedef enum { - e1000_media_type_copper = 0, - e1000_media_type_fiber = 1, - e1000_media_type_internal_serdes = 2, - e1000_num_media_types -} e1000_media_type; - -typedef enum { - e1000_10_half = 0, - e1000_10_full = 1, - e1000_100_half = 2, - e1000_100_full = 3 -} e1000_speed_duplex_type; - -/* Flow Control Settings */ -typedef enum { - e1000_fc_none = 0, - e1000_fc_rx_pause = 1, - e1000_fc_tx_pause = 2, - e1000_fc_full = 3, - e1000_fc_default = 0xFF -} e1000_fc_type; - -/* PCI bus types */ -typedef enum { - e1000_bus_type_unknown = 0, - e1000_bus_type_pci, - e1000_bus_type_pcix, - e1000_bus_type_reserved -} e1000_bus_type; - -/* PCI bus speeds */ -typedef enum { - e1000_bus_speed_unknown = 0, - e1000_bus_speed_33, - e1000_bus_speed_66, - e1000_bus_speed_100, - e1000_bus_speed_120, - e1000_bus_speed_133, - e1000_bus_speed_reserved -} e1000_bus_speed; - -/* PCI bus widths */ -typedef enum { - e1000_bus_width_unknown = 0, - e1000_bus_width_32, - e1000_bus_width_64, - e1000_bus_width_reserved -} e1000_bus_width; - -/* PHY status info structure and supporting enums */ -typedef enum { - e1000_cable_length_50 = 0, - e1000_cable_length_50_80, - e1000_cable_length_80_110, - e1000_cable_length_110_140, - e1000_cable_length_140, - e1000_cable_length_undefined = 0xFF -} e1000_cable_length; - -typedef enum { - e1000_igp_cable_length_10 = 10, - e1000_igp_cable_length_20 = 20, - e1000_igp_cable_length_30 = 30, - e1000_igp_cable_length_40 = 40, - e1000_igp_cable_length_50 = 50, - e1000_igp_cable_length_60 = 60, - e1000_igp_cable_length_70 = 70, - e1000_igp_cable_length_80 = 80, - e1000_igp_cable_length_90 = 90, - e1000_igp_cable_length_100 = 100, - e1000_igp_cable_length_110 = 110, - e1000_igp_cable_length_120 = 120, - e1000_igp_cable_length_130 = 130, - e1000_igp_cable_length_140 = 140, - e1000_igp_cable_length_150 = 150, - e1000_igp_cable_length_160 = 160, - e1000_igp_cable_length_170 = 170, - e1000_igp_cable_length_180 = 180 -} e1000_igp_cable_length; - -typedef enum { - e1000_10bt_ext_dist_enable_normal = 0, - e1000_10bt_ext_dist_enable_lower, - e1000_10bt_ext_dist_enable_undefined = 0xFF -} e1000_10bt_ext_dist_enable; - -typedef enum { - e1000_rev_polarity_normal = 0, - e1000_rev_polarity_reversed, - e1000_rev_polarity_undefined = 0xFF -} e1000_rev_polarity; - -typedef enum { - e1000_downshift_normal = 0, - e1000_downshift_activated, - e1000_downshift_undefined = 0xFF -} e1000_downshift; - -typedef enum { - e1000_polarity_reversal_enabled = 0, - e1000_polarity_reversal_disabled, - e1000_polarity_reversal_undefined = 0xFF -} e1000_polarity_reversal; - -typedef enum { - e1000_auto_x_mode_manual_mdi = 0, - e1000_auto_x_mode_manual_mdix, - e1000_auto_x_mode_auto1, - e1000_auto_x_mode_auto2, - e1000_auto_x_mode_undefined = 0xFF -} e1000_auto_x_mode; - -typedef enum { - e1000_1000t_rx_status_not_ok = 0, - e1000_1000t_rx_status_ok, - e1000_1000t_rx_status_undefined = 0xFF -} e1000_1000t_rx_status; - -typedef enum { - e1000_phy_m88 = 0, - e1000_phy_igp, - e1000_phy_undefined = 0xFF -} e1000_phy_type; - -typedef enum { - e1000_ms_hw_default = 0, - e1000_ms_force_master, - e1000_ms_force_slave, - e1000_ms_auto -} e1000_ms_type; - -typedef enum { - e1000_ffe_config_enabled = 0, - e1000_ffe_config_active, - e1000_ffe_config_blocked -} e1000_ffe_config; - -typedef enum { - e1000_dsp_config_disabled = 0, - e1000_dsp_config_enabled, - e1000_dsp_config_activated, - e1000_dsp_config_undefined = 0xFF -} e1000_dsp_config; - -struct e1000_phy_info { - e1000_cable_length cable_length; - e1000_10bt_ext_dist_enable extended_10bt_distance; - e1000_rev_polarity cable_polarity; - e1000_downshift downshift; - e1000_polarity_reversal polarity_correction; - e1000_auto_x_mode mdix_mode; - e1000_1000t_rx_status local_rx; - e1000_1000t_rx_status remote_rx; -}; - -struct e1000_phy_stats { - uint32_t idle_errors; - uint32_t receive_errors; -}; - -struct e1000_eeprom_info { - e1000_eeprom_type type; - uint16_t word_size; - uint16_t opcode_bits; - uint16_t address_bits; - uint16_t delay_usec; - uint16_t page_size; -}; - - - -/* Error Codes */ -#define E1000_SUCCESS 0 -#define E1000_ERR_EEPROM 1 -#define E1000_ERR_PHY 2 -#define E1000_ERR_CONFIG 3 -#define E1000_ERR_PARAM 4 -#define E1000_ERR_MAC_TYPE 5 -#define E1000_ERR_PHY_TYPE 6 -#define E1000_ERR_NOLINK 7 -#define E1000_ERR_TIMEOUT 8 - -#define E1000_READ_REG_IO(a, reg) \ - e1000_read_reg_io((a), E1000_##reg) -#define E1000_WRITE_REG_IO(a, reg, val) \ - e1000_write_reg_io((a), E1000_##reg, val) - -/* PCI Device IDs */ -#define E1000_DEV_ID_82542 0x1000 -#define E1000_DEV_ID_82543GC_FIBER 0x1001 -#define E1000_DEV_ID_82543GC_COPPER 0x1004 -#define E1000_DEV_ID_82544EI_COPPER 0x1008 -#define E1000_DEV_ID_82544EI_FIBER 0x1009 -#define E1000_DEV_ID_82544GC_COPPER 0x100C -#define E1000_DEV_ID_82544GC_LOM 0x100D -#define E1000_DEV_ID_82540EM 0x100E -#define E1000_DEV_ID_82540EM_LOM 0x1015 -#define E1000_DEV_ID_82540EP_LOM 0x1016 -#define E1000_DEV_ID_82540EP 0x1017 -#define E1000_DEV_ID_82540EP_LP 0x101E -#define E1000_DEV_ID_82545EM_COPPER 0x100F -#define E1000_DEV_ID_82545EM_FIBER 0x1011 -#define E1000_DEV_ID_82545GM_COPPER 0x1026 -#define E1000_DEV_ID_82545GM_FIBER 0x1027 -#define E1000_DEV_ID_82545GM_SERDES 0x1028 -#define E1000_DEV_ID_82546EB_COPPER 0x1010 -#define E1000_DEV_ID_82546EB_FIBER 0x1012 -#define E1000_DEV_ID_82546EB_QUAD_COPPER 0x101D -#define E1000_DEV_ID_82541EI 0x1013 -#define E1000_DEV_ID_82541EI_MOBILE 0x1018 -#define E1000_DEV_ID_82541ER 0x1078 -#define E1000_DEV_ID_82547GI 0x1075 -#define E1000_DEV_ID_82541GI 0x1076 -#define E1000_DEV_ID_82541GI_MOBILE 0x1077 -#define E1000_DEV_ID_82546GB_COPPER 0x1079 -#define E1000_DEV_ID_82546GB_FIBER 0x107A -#define E1000_DEV_ID_82546GB_SERDES 0x107B -#define E1000_DEV_ID_82547EI 0x1019 - -#define NODE_ADDRESS_SIZE 6 -#define ETH_LENGTH_OF_ADDRESS 6 - -/* MAC decode size is 128K - This is the size of BAR0 */ -#define MAC_DECODE_SIZE (128 * 1024) - -#define E1000_82542_2_0_REV_ID 2 -#define E1000_82542_2_1_REV_ID 3 - -#define SPEED_10 10 -#define SPEED_100 100 -#define SPEED_1000 1000 -#define HALF_DUPLEX 1 -#define FULL_DUPLEX 2 - -/* The sizes (in bytes) of a ethernet packet */ -#define ENET_HEADER_SIZE 14 -#define MAXIMUM_ETHERNET_FRAME_SIZE 1518 /* With FCS */ -#define MINIMUM_ETHERNET_FRAME_SIZE 64 /* With FCS */ -#define ETHERNET_FCS_SIZE 4 -#define MAXIMUM_ETHERNET_PACKET_SIZE \ - (MAXIMUM_ETHERNET_FRAME_SIZE - ETHERNET_FCS_SIZE) -#define MINIMUM_ETHERNET_PACKET_SIZE \ - (MINIMUM_ETHERNET_FRAME_SIZE - ETHERNET_FCS_SIZE) -#define CRC_LENGTH ETHERNET_FCS_SIZE -#define MAX_JUMBO_FRAME_SIZE 0x3F00 - - -/* 802.1q VLAN Packet Sizes */ -#define VLAN_TAG_SIZE 4 /* 802.3ac tag (not DMAed) */ - -/* Ethertype field values */ -#define ETHERNET_IEEE_VLAN_TYPE 0x8100 /* 802.3ac packet */ -#define ETHERNET_IP_TYPE 0x0800 /* IP packets */ -#define ETHERNET_ARP_TYPE 0x0806 /* Address Resolution Protocol (ARP) */ - -/* Packet Header defines */ -#define IP_PROTOCOL_TCP 6 -#define IP_PROTOCOL_UDP 0x11 - -/* This defines the bits that are set in the Interrupt Mask - * Set/Read Register. Each bit is documented below: - * o RXDMT0 = Receive Descriptor Minimum Threshold hit (ring 0) - * o RXSEQ = Receive Sequence Error - */ -#define POLL_IMS_ENABLE_MASK ( \ - E1000_IMS_RXDMT0 | \ - E1000_IMS_RXSEQ) - -/* This defines the bits that are set in the Interrupt Mask - * Set/Read Register. Each bit is documented below: - * o RXT0 = Receiver Timer Interrupt (ring 0) - * o TXDW = Transmit Descriptor Written Back - * o RXDMT0 = Receive Descriptor Minimum Threshold hit (ring 0) - * o RXSEQ = Receive Sequence Error - * o LSC = Link Status Change - */ -#define IMS_ENABLE_MASK ( \ - E1000_IMS_RXT0 | \ - E1000_IMS_TXDW | \ - E1000_IMS_RXDMT0 | \ - E1000_IMS_RXSEQ | \ - E1000_IMS_LSC) - -/* Number of high/low register pairs in the RAR. The RAR (Receive Address - * Registers) holds the directed and multicast addresses that we monitor. We - * reserve one of these spots for our directed address, allowing us room for - * E1000_RAR_ENTRIES - 1 multicast addresses. - */ -#define E1000_RAR_ENTRIES 15 - -#define MIN_NUMBER_OF_DESCRIPTORS 8 -#define MAX_NUMBER_OF_DESCRIPTORS 0xFFF8 - -/* Receive Descriptor */ -struct e1000_rx_desc { - uint64_t buffer_addr; /* Address of the descriptor's data buffer */ - uint16_t length; /* Length of data DMAed into data buffer */ - uint16_t csum; /* Packet checksum */ - uint8_t status; /* Descriptor status */ - uint8_t errors; /* Descriptor Errors */ - uint16_t special; -}; - -/* Receive Decriptor bit definitions */ -#define E1000_RXD_STAT_DD 0x01 /* Descriptor Done */ -#define E1000_RXD_STAT_EOP 0x02 /* End of Packet */ -#define E1000_RXD_STAT_IXSM 0x04 /* Ignore checksum */ -#define E1000_RXD_STAT_VP 0x08 /* IEEE VLAN Packet */ -#define E1000_RXD_STAT_TCPCS 0x20 /* TCP xsum calculated */ -#define E1000_RXD_STAT_IPCS 0x40 /* IP xsum calculated */ -#define E1000_RXD_STAT_PIF 0x80 /* passed in-exact filter */ -#define E1000_RXD_ERR_CE 0x01 /* CRC Error */ -#define E1000_RXD_ERR_SE 0x02 /* Symbol Error */ -#define E1000_RXD_ERR_SEQ 0x04 /* Sequence Error */ -#define E1000_RXD_ERR_CXE 0x10 /* Carrier Extension Error */ -#define E1000_RXD_ERR_TCPE 0x20 /* TCP/UDP Checksum Error */ -#define E1000_RXD_ERR_IPE 0x40 /* IP Checksum Error */ -#define E1000_RXD_ERR_RXE 0x80 /* Rx Data Error */ -#define E1000_RXD_SPC_VLAN_MASK 0x0FFF /* VLAN ID is in lower 12 bits */ -#define E1000_RXD_SPC_PRI_MASK 0xE000 /* Priority is in upper 3 bits */ -#define E1000_RXD_SPC_PRI_SHIFT 0x000D /* Priority is in upper 3 of 16 */ -#define E1000_RXD_SPC_CFI_MASK 0x1000 /* CFI is bit 12 */ -#define E1000_RXD_SPC_CFI_SHIFT 0x000C /* CFI is bit 12 */ - -/* mask to determine if packets should be dropped due to frame errors */ -#define E1000_RXD_ERR_FRAME_ERR_MASK ( \ - E1000_RXD_ERR_CE | \ - E1000_RXD_ERR_SE | \ - E1000_RXD_ERR_SEQ | \ - E1000_RXD_ERR_CXE | \ - E1000_RXD_ERR_RXE) - -/* Transmit Descriptor */ -struct e1000_tx_desc { - uint64_t buffer_addr; /* Address of the descriptor's data buffer */ - union { - uint32_t data; - struct { - uint16_t length; /* Data buffer length */ - uint8_t cso; /* Checksum offset */ - uint8_t cmd; /* Descriptor control */ - } flags; - } lower; - union { - uint32_t data; - struct { - uint8_t status; /* Descriptor status */ - uint8_t css; /* Checksum start */ - uint16_t special; - } fields; - } upper; -}; - -/* Transmit Descriptor bit definitions */ -#define E1000_TXD_DTYP_D 0x00100000 /* Data Descriptor */ -#define E1000_TXD_DTYP_C 0x00000000 /* Context Descriptor */ -#define E1000_TXD_POPTS_IXSM 0x01 /* Insert IP checksum */ -#define E1000_TXD_POPTS_TXSM 0x02 /* Insert TCP/UDP checksum */ -#define E1000_TXD_CMD_EOP 0x01000000 /* End of Packet */ -#define E1000_TXD_CMD_IFCS 0x02000000 /* Insert FCS (Ethernet CRC) */ -#define E1000_TXD_CMD_IC 0x04000000 /* Insert Checksum */ -#define E1000_TXD_CMD_RS 0x08000000 /* Report Status */ -#define E1000_TXD_CMD_RPS 0x10000000 /* Report Packet Sent */ -#define E1000_TXD_CMD_DEXT 0x20000000 /* Descriptor extension (0 = legacy) */ -#define E1000_TXD_CMD_VLE 0x40000000 /* Add VLAN tag */ -#define E1000_TXD_CMD_IDE 0x80000000 /* Enable Tidv register */ -#define E1000_TXD_STAT_DD 0x00000001 /* Descriptor Done */ -#define E1000_TXD_STAT_EC 0x00000002 /* Excess Collisions */ -#define E1000_TXD_STAT_LC 0x00000004 /* Late Collisions */ -#define E1000_TXD_STAT_TU 0x00000008 /* Transmit underrun */ -#define E1000_TXD_CMD_TCP 0x01000000 /* TCP packet */ -#define E1000_TXD_CMD_IP 0x02000000 /* IP packet */ -#define E1000_TXD_CMD_TSE 0x04000000 /* TCP Seg enable */ -#define E1000_TXD_STAT_TC 0x00000004 /* Tx Underrun */ - -/* Offload Context Descriptor */ -struct e1000_context_desc { - union { - uint32_t ip_config; - struct { - uint8_t ipcss; /* IP checksum start */ - uint8_t ipcso; /* IP checksum offset */ - uint16_t ipcse; /* IP checksum end */ - } ip_fields; - } lower_setup; - union { - uint32_t tcp_config; - struct { - uint8_t tucss; /* TCP checksum start */ - uint8_t tucso; /* TCP checksum offset */ - uint16_t tucse; /* TCP checksum end */ - } tcp_fields; - } upper_setup; - uint32_t cmd_and_length; /* */ - union { - uint32_t data; - struct { - uint8_t status; /* Descriptor status */ - uint8_t hdr_len; /* Header length */ - uint16_t mss; /* Maximum segment size */ - } fields; - } tcp_seg_setup; -}; - -/* Offload data descriptor */ -struct e1000_data_desc { - uint64_t buffer_addr; /* Address of the descriptor's buffer address */ - union { - uint32_t data; - struct { - uint16_t length; /* Data buffer length */ - uint8_t typ_len_ext; /* */ - uint8_t cmd; /* */ - } flags; - } lower; - union { - uint32_t data; - struct { - uint8_t status; /* Descriptor status */ - uint8_t popts; /* Packet Options */ - uint16_t special; /* */ - } fields; - } upper; -}; - -/* Filters */ -#define E1000_NUM_UNICAST 16 /* Unicast filter entries */ -#define E1000_MC_TBL_SIZE 128 /* Multicast Filter Table (4096 bits) */ -#define E1000_VLAN_FILTER_TBL_SIZE 128 /* VLAN Filter Table (4096 bits) */ - - -/* Receive Address Register */ -struct e1000_rar { - volatile uint32_t low; /* receive address low */ - volatile uint32_t high; /* receive address high */ -}; - -/* Number of entries in the Multicast Table Array (MTA). */ -#define E1000_NUM_MTA_REGISTERS 128 - -/* IPv4 Address Table Entry */ -struct e1000_ipv4_at_entry { - volatile uint32_t ipv4_addr; /* IP Address (RW) */ - volatile uint32_t reserved; -}; - -/* Four wakeup IP addresses are supported */ -#define E1000_WAKEUP_IP_ADDRESS_COUNT_MAX 4 -#define E1000_IP4AT_SIZE E1000_WAKEUP_IP_ADDRESS_COUNT_MAX -#define E1000_IP6AT_SIZE 1 - -/* IPv6 Address Table Entry */ -struct e1000_ipv6_at_entry { - volatile uint8_t ipv6_addr[16]; -}; - -/* Flexible Filter Length Table Entry */ -struct e1000_fflt_entry { - volatile uint32_t length; /* Flexible Filter Length (RW) */ - volatile uint32_t reserved; -}; - -/* Flexible Filter Mask Table Entry */ -struct e1000_ffmt_entry { - volatile uint32_t mask; /* Flexible Filter Mask (RW) */ - volatile uint32_t reserved; -}; - -/* Flexible Filter Value Table Entry */ -struct e1000_ffvt_entry { - volatile uint32_t value; /* Flexible Filter Value (RW) */ - volatile uint32_t reserved; -}; - -/* Four Flexible Filters are supported */ -#define E1000_FLEXIBLE_FILTER_COUNT_MAX 4 - -/* Each Flexible Filter is at most 128 (0x80) bytes in length */ -#define E1000_FLEXIBLE_FILTER_SIZE_MAX 128 - -#define E1000_FFLT_SIZE E1000_FLEXIBLE_FILTER_COUNT_MAX -#define E1000_FFMT_SIZE E1000_FLEXIBLE_FILTER_SIZE_MAX -#define E1000_FFVT_SIZE E1000_FLEXIBLE_FILTER_SIZE_MAX - -/* Register Set. (82543, 82544) - * - * Registers are defined to be 32 bits and should be accessed as 32 bit values. - * These registers are physically located on the NIC, but are mapped into the - * host memory address space. - * - * RW - register is both readable and writable - * RO - register is read only - * WO - register is write only - * R/clr - register is read only and is cleared when read - * A - register array - */ -#define E1000_CTRL 0x00000 /* Device Control - RW */ -#define E1000_CTRL_DUP 0x00004 /* Device Control Duplicate (Shadow) - RW */ -#define E1000_STATUS 0x00008 /* Device Status - RO */ -#define E1000_EECD 0x00010 /* EEPROM/Flash Control - RW */ -#define E1000_EERD 0x00014 /* EEPROM Read - RW */ -#define E1000_CTRL_EXT 0x00018 /* Extended Device Control - RW */ -#define E1000_FLA 0x0001C /* Flash Access - RW */ -#define E1000_MDIC 0x00020 /* MDI Control - RW */ -#define E1000_FCAL 0x00028 /* Flow Control Address Low - RW */ -#define E1000_FCAH 0x0002C /* Flow Control Address High -RW */ -#define E1000_FCT 0x00030 /* Flow Control Type - RW */ -#define E1000_VET 0x00038 /* VLAN Ether Type - RW */ -#define E1000_ICR 0x000C0 /* Interrupt Cause Read - R/clr */ -#define E1000_ITR 0x000C4 /* Interrupt Throttling Rate - RW */ -#define E1000_ICS 0x000C8 /* Interrupt Cause Set - WO */ -#define E1000_IMS 0x000D0 /* Interrupt Mask Set - RW */ -#define E1000_IMC 0x000D8 /* Interrupt Mask Clear - WO */ -#define E1000_RCTL 0x00100 /* RX Control - RW */ -#define E1000_FCTTV 0x00170 /* Flow Control Transmit Timer Value - RW */ -#define E1000_TXCW 0x00178 /* TX Configuration Word - RW */ -#define E1000_RXCW 0x00180 /* RX Configuration Word - RO */ -#define E1000_TCTL 0x00400 /* TX Control - RW */ -#define E1000_TIPG 0x00410 /* TX Inter-packet gap -RW */ -#define E1000_TBT 0x00448 /* TX Burst Timer - RW */ -#define E1000_AIT 0x00458 /* Adaptive Interframe Spacing Throttle - RW */ -#define E1000_LEDCTL 0x00E00 /* LED Control - RW */ -#define E1000_PBA 0x01000 /* Packet Buffer Allocation - RW */ -#define E1000_FCRTL 0x02160 /* Flow Control Receive Threshold Low - RW */ -#define E1000_FCRTH 0x02168 /* Flow Control Receive Threshold High - RW */ -#define E1000_RDBAL 0x02800 /* RX Descriptor Base Address Low - RW */ -#define E1000_RDBAH 0x02804 /* RX Descriptor Base Address High - RW */ -#define E1000_RDLEN 0x02808 /* RX Descriptor Length - RW */ -#define E1000_RDH 0x02810 /* RX Descriptor Head - RW */ -#define E1000_RDT 0x02818 /* RX Descriptor Tail - RW */ -#define E1000_RDTR 0x02820 /* RX Delay Timer - RW */ -#define E1000_RXDCTL 0x02828 /* RX Descriptor Control - RW */ -#define E1000_RADV 0x0282C /* RX Interrupt Absolute Delay Timer - RW */ -#define E1000_RSRPD 0x02C00 /* RX Small Packet Detect - RW */ -#define E1000_TXDMAC 0x03000 /* TX DMA Control - RW */ -#define E1000_TDFH 0x03410 /* TX Data FIFO Head - RW */ -#define E1000_TDFT 0x03418 /* TX Data FIFO Tail - RW */ -#define E1000_TDFHS 0x03420 /* TX Data FIFO Head Saved - RW */ -#define E1000_TDFTS 0x03428 /* TX Data FIFO Tail Saved - RW */ -#define E1000_TDFPC 0x03430 /* TX Data FIFO Packet Count - RW */ -#define E1000_TDBAL 0x03800 /* TX Descriptor Base Address Low - RW */ -#define E1000_TDBAH 0x03804 /* TX Descriptor Base Address High - RW */ -#define E1000_TDLEN 0x03808 /* TX Descriptor Length - RW */ -#define E1000_TDH 0x03810 /* TX Descriptor Head - RW */ -#define E1000_TDT 0x03818 /* TX Descripotr Tail - RW */ -#define E1000_TIDV 0x03820 /* TX Interrupt Delay Value - RW */ -#define E1000_TXDCTL 0x03828 /* TX Descriptor Control - RW */ -#define E1000_TADV 0x0382C /* TX Interrupt Absolute Delay Val - RW */ -#define E1000_TSPMT 0x03830 /* TCP Segmentation PAD & Min Threshold - RW */ -#define E1000_CRCERRS 0x04000 /* CRC Error Count - R/clr */ -#define E1000_ALGNERRC 0x04004 /* Alignment Error Count - R/clr */ -#define E1000_SYMERRS 0x04008 /* Symbol Error Count - R/clr */ -#define E1000_RXERRC 0x0400C /* Receive Error Count - R/clr */ -#define E1000_MPC 0x04010 /* Missed Packet Count - R/clr */ -#define E1000_SCC 0x04014 /* Single Collision Count - R/clr */ -#define E1000_ECOL 0x04018 /* Excessive Collision Count - R/clr */ -#define E1000_MCC 0x0401C /* Multiple Collision Count - R/clr */ -#define E1000_LATECOL 0x04020 /* Late Collision Count - R/clr */ -#define E1000_COLC 0x04028 /* Collision Count - R/clr */ -#define E1000_DC 0x04030 /* Defer Count - R/clr */ -#define E1000_TNCRS 0x04034 /* TX-No CRS - R/clr */ -#define E1000_SEC 0x04038 /* Sequence Error Count - R/clr */ -#define E1000_CEXTERR 0x0403C /* Carrier Extension Error Count - R/clr */ -#define E1000_RLEC 0x04040 /* Receive Length Error Count - R/clr */ -#define E1000_XONRXC 0x04048 /* XON RX Count - R/clr */ -#define E1000_XONTXC 0x0404C /* XON TX Count - R/clr */ -#define E1000_XOFFRXC 0x04050 /* XOFF RX Count - R/clr */ -#define E1000_XOFFTXC 0x04054 /* XOFF TX Count - R/clr */ -#define E1000_FCRUC 0x04058 /* Flow Control RX Unsupported Count- R/clr */ -#define E1000_PRC64 0x0405C /* Packets RX (64 bytes) - R/clr */ -#define E1000_PRC127 0x04060 /* Packets RX (65-127 bytes) - R/clr */ -#define E1000_PRC255 0x04064 /* Packets RX (128-255 bytes) - R/clr */ -#define E1000_PRC511 0x04068 /* Packets RX (255-511 bytes) - R/clr */ -#define E1000_PRC1023 0x0406C /* Packets RX (512-1023 bytes) - R/clr */ -#define E1000_PRC1522 0x04070 /* Packets RX (1024-1522 bytes) - R/clr */ -#define E1000_GPRC 0x04074 /* Good Packets RX Count - R/clr */ -#define E1000_BPRC 0x04078 /* Broadcast Packets RX Count - R/clr */ -#define E1000_MPRC 0x0407C /* Multicast Packets RX Count - R/clr */ -#define E1000_GPTC 0x04080 /* Good Packets TX Count - R/clr */ -#define E1000_GORCL 0x04088 /* Good Octets RX Count Low - R/clr */ -#define E1000_GORCH 0x0408C /* Good Octets RX Count High - R/clr */ -#define E1000_GOTCL 0x04090 /* Good Octets TX Count Low - R/clr */ -#define E1000_GOTCH 0x04094 /* Good Octets TX Count High - R/clr */ -#define E1000_RNBC 0x040A0 /* RX No Buffers Count - R/clr */ -#define E1000_RUC 0x040A4 /* RX Undersize Count - R/clr */ -#define E1000_RFC 0x040A8 /* RX Fragment Count - R/clr */ -#define E1000_ROC 0x040AC /* RX Oversize Count - R/clr */ -#define E1000_RJC 0x040B0 /* RX Jabber Count - R/clr */ -#define E1000_MGTPRC 0x040B4 /* Management Packets RX Count - R/clr */ -#define E1000_MGTPDC 0x040B8 /* Management Packets Dropped Count - R/clr */ -#define E1000_MGTPTC 0x040BC /* Management Packets TX Count - R/clr */ -#define E1000_TORL 0x040C0 /* Total Octets RX Low - R/clr */ -#define E1000_TORH 0x040C4 /* Total Octets RX High - R/clr */ -#define E1000_TOTL 0x040C8 /* Total Octets TX Low - R/clr */ -#define E1000_TOTH 0x040CC /* Total Octets TX High - R/clr */ -#define E1000_TPR 0x040D0 /* Total Packets RX - R/clr */ -#define E1000_TPT 0x040D4 /* Total Packets TX - R/clr */ -#define E1000_PTC64 0x040D8 /* Packets TX (64 bytes) - R/clr */ -#define E1000_PTC127 0x040DC /* Packets TX (65-127 bytes) - R/clr */ -#define E1000_PTC255 0x040E0 /* Packets TX (128-255 bytes) - R/clr */ -#define E1000_PTC511 0x040E4 /* Packets TX (256-511 bytes) - R/clr */ -#define E1000_PTC1023 0x040E8 /* Packets TX (512-1023 bytes) - R/clr */ -#define E1000_PTC1522 0x040EC /* Packets TX (1024-1522 Bytes) - R/clr */ -#define E1000_MPTC 0x040F0 /* Multicast Packets TX Count - R/clr */ -#define E1000_BPTC 0x040F4 /* Broadcast Packets TX Count - R/clr */ -#define E1000_TSCTC 0x040F8 /* TCP Segmentation Context TX - R/clr */ -#define E1000_TSCTFC 0x040FC /* TCP Segmentation Context TX Fail - R/clr */ -#define E1000_RXCSUM 0x05000 /* RX Checksum Control - RW */ -#define E1000_MTA 0x05200 /* Multicast Table Array - RW Array */ -#define E1000_RA 0x05400 /* Receive Address - RW Array */ -#define E1000_VFTA 0x05600 /* VLAN Filter Table Array - RW Array */ -#define E1000_WUC 0x05800 /* Wakeup Control - RW */ -#define E1000_WUFC 0x05808 /* Wakeup Filter Control - RW */ -#define E1000_WUS 0x05810 /* Wakeup Status - RO */ -#define E1000_MANC 0x05820 /* Management Control - RW */ -#define E1000_IPAV 0x05838 /* IP Address Valid - RW */ -#define E1000_IP4AT 0x05840 /* IPv4 Address Table - RW Array */ -#define E1000_IP6AT 0x05880 /* IPv6 Address Table - RW Array */ -#define E1000_WUPL 0x05900 /* Wakeup Packet Length - RW */ -#define E1000_WUPM 0x05A00 /* Wakeup Packet Memory - RO A */ -#define E1000_FFLT 0x05F00 /* Flexible Filter Length Table - RW Array */ -#define E1000_FFMT 0x09000 /* Flexible Filter Mask Table - RW Array */ -#define E1000_FFVT 0x09800 /* Flexible Filter Value Table - RW Array */ - -/* Register Set (82542) - * - * Some of the 82542 registers are located at different offsets than they are - * in more current versions of the 8254x. Despite the difference in location, - * the registers function in the same manner. - */ -#define E1000_82542_CTRL E1000_CTRL -#define E1000_82542_CTRL_DUP E1000_CTRL_DUP -#define E1000_82542_STATUS E1000_STATUS -#define E1000_82542_EECD E1000_EECD -#define E1000_82542_EERD E1000_EERD -#define E1000_82542_CTRL_EXT E1000_CTRL_EXT -#define E1000_82542_FLA E1000_FLA -#define E1000_82542_MDIC E1000_MDIC -#define E1000_82542_FCAL E1000_FCAL -#define E1000_82542_FCAH E1000_FCAH -#define E1000_82542_FCT E1000_FCT -#define E1000_82542_VET E1000_VET -#define E1000_82542_RA 0x00040 -#define E1000_82542_ICR E1000_ICR -#define E1000_82542_ITR E1000_ITR -#define E1000_82542_ICS E1000_ICS -#define E1000_82542_IMS E1000_IMS -#define E1000_82542_IMC E1000_IMC -#define E1000_82542_RCTL E1000_RCTL -#define E1000_82542_RDTR 0x00108 -#define E1000_82542_RDBAL 0x00110 -#define E1000_82542_RDBAH 0x00114 -#define E1000_82542_RDLEN 0x00118 -#define E1000_82542_RDH 0x00120 -#define E1000_82542_RDT 0x00128 -#define E1000_82542_FCRTH 0x00160 -#define E1000_82542_FCRTL 0x00168 -#define E1000_82542_FCTTV E1000_FCTTV -#define E1000_82542_TXCW E1000_TXCW -#define E1000_82542_RXCW E1000_RXCW -#define E1000_82542_MTA 0x00200 -#define E1000_82542_TCTL E1000_TCTL -#define E1000_82542_TIPG E1000_TIPG -#define E1000_82542_TDBAL 0x00420 -#define E1000_82542_TDBAH 0x00424 -#define E1000_82542_TDLEN 0x00428 -#define E1000_82542_TDH 0x00430 -#define E1000_82542_TDT 0x00438 -#define E1000_82542_TIDV 0x00440 -#define E1000_82542_TBT E1000_TBT -#define E1000_82542_AIT E1000_AIT -#define E1000_82542_VFTA 0x00600 -#define E1000_82542_LEDCTL E1000_LEDCTL -#define E1000_82542_PBA E1000_PBA -#define E1000_82542_RXDCTL E1000_RXDCTL -#define E1000_82542_RADV E1000_RADV -#define E1000_82542_RSRPD E1000_RSRPD -#define E1000_82542_TXDMAC E1000_TXDMAC -#define E1000_82542_TDFHS E1000_TDFHS -#define E1000_82542_TDFTS E1000_TDFTS -#define E1000_82542_TDFPC E1000_TDFPC -#define E1000_82542_TXDCTL E1000_TXDCTL -#define E1000_82542_TADV E1000_TADV -#define E1000_82542_TSPMT E1000_TSPMT -#define E1000_82542_CRCERRS E1000_CRCERRS -#define E1000_82542_ALGNERRC E1000_ALGNERRC -#define E1000_82542_SYMERRS E1000_SYMERRS -#define E1000_82542_RXERRC E1000_RXERRC -#define E1000_82542_MPC E1000_MPC -#define E1000_82542_SCC E1000_SCC -#define E1000_82542_ECOL E1000_ECOL -#define E1000_82542_MCC E1000_MCC -#define E1000_82542_LATECOL E1000_LATECOL -#define E1000_82542_COLC E1000_COLC -#define E1000_82542_DC E1000_DC -#define E1000_82542_TNCRS E1000_TNCRS -#define E1000_82542_SEC E1000_SEC -#define E1000_82542_CEXTERR E1000_CEXTERR -#define E1000_82542_RLEC E1000_RLEC -#define E1000_82542_XONRXC E1000_XONRXC -#define E1000_82542_XONTXC E1000_XONTXC -#define E1000_82542_XOFFRXC E1000_XOFFRXC -#define E1000_82542_XOFFTXC E1000_XOFFTXC -#define E1000_82542_FCRUC E1000_FCRUC -#define E1000_82542_PRC64 E1000_PRC64 -#define E1000_82542_PRC127 E1000_PRC127 -#define E1000_82542_PRC255 E1000_PRC255 -#define E1000_82542_PRC511 E1000_PRC511 -#define E1000_82542_PRC1023 E1000_PRC1023 -#define E1000_82542_PRC1522 E1000_PRC1522 -#define E1000_82542_GPRC E1000_GPRC -#define E1000_82542_BPRC E1000_BPRC -#define E1000_82542_MPRC E1000_MPRC -#define E1000_82542_GPTC E1000_GPTC -#define E1000_82542_GORCL E1000_GORCL -#define E1000_82542_GORCH E1000_GORCH -#define E1000_82542_GOTCL E1000_GOTCL -#define E1000_82542_GOTCH E1000_GOTCH -#define E1000_82542_RNBC E1000_RNBC -#define E1000_82542_RUC E1000_RUC -#define E1000_82542_RFC E1000_RFC -#define E1000_82542_ROC E1000_ROC -#define E1000_82542_RJC E1000_RJC -#define E1000_82542_MGTPRC E1000_MGTPRC -#define E1000_82542_MGTPDC E1000_MGTPDC -#define E1000_82542_MGTPTC E1000_MGTPTC -#define E1000_82542_TORL E1000_TORL -#define E1000_82542_TORH E1000_TORH -#define E1000_82542_TOTL E1000_TOTL -#define E1000_82542_TOTH E1000_TOTH -#define E1000_82542_TPR E1000_TPR -#define E1000_82542_TPT E1000_TPT -#define E1000_82542_PTC64 E1000_PTC64 -#define E1000_82542_PTC127 E1000_PTC127 -#define E1000_82542_PTC255 E1000_PTC255 -#define E1000_82542_PTC511 E1000_PTC511 -#define E1000_82542_PTC1023 E1000_PTC1023 -#define E1000_82542_PTC1522 E1000_PTC1522 -#define E1000_82542_MPTC E1000_MPTC -#define E1000_82542_BPTC E1000_BPTC -#define E1000_82542_TSCTC E1000_TSCTC -#define E1000_82542_TSCTFC E1000_TSCTFC -#define E1000_82542_RXCSUM E1000_RXCSUM -#define E1000_82542_WUC E1000_WUC -#define E1000_82542_WUFC E1000_WUFC -#define E1000_82542_WUS E1000_WUS -#define E1000_82542_MANC E1000_MANC -#define E1000_82542_IPAV E1000_IPAV -#define E1000_82542_IP4AT E1000_IP4AT -#define E1000_82542_IP6AT E1000_IP6AT -#define E1000_82542_WUPL E1000_WUPL -#define E1000_82542_WUPM E1000_WUPM -#define E1000_82542_FFLT E1000_FFLT -#define E1000_82542_TDFH 0x08010 -#define E1000_82542_TDFT 0x08018 -#define E1000_82542_FFMT E1000_FFMT -#define E1000_82542_FFVT E1000_FFVT - -/* Statistics counters collected by the MAC */ -struct e1000_hw_stats { - uint64_t crcerrs; - uint64_t algnerrc; - uint64_t symerrs; - uint64_t rxerrc; - uint64_t mpc; - uint64_t scc; - uint64_t ecol; - uint64_t mcc; - uint64_t latecol; - uint64_t colc; - uint64_t dc; - uint64_t tncrs; - uint64_t sec; - uint64_t cexterr; - uint64_t rlec; - uint64_t xonrxc; - uint64_t xontxc; - uint64_t xoffrxc; - uint64_t xofftxc; - uint64_t fcruc; - uint64_t prc64; - uint64_t prc127; - uint64_t prc255; - uint64_t prc511; - uint64_t prc1023; - uint64_t prc1522; - uint64_t gprc; - uint64_t bprc; - uint64_t mprc; - uint64_t gptc; - uint64_t gorcl; - uint64_t gorch; - uint64_t gotcl; - uint64_t gotch; - uint64_t rnbc; - uint64_t ruc; - uint64_t rfc; - uint64_t roc; - uint64_t rjc; - uint64_t mgprc; - uint64_t mgpdc; - uint64_t mgptc; - uint64_t torl; - uint64_t torh; - uint64_t totl; - uint64_t toth; - uint64_t tpr; - uint64_t tpt; - uint64_t ptc64; - uint64_t ptc127; - uint64_t ptc255; - uint64_t ptc511; - uint64_t ptc1023; - uint64_t ptc1522; - uint64_t mptc; - uint64_t bptc; - uint64_t tsctc; - uint64_t tsctfc; -}; - -/* Structure containing variables used by the shared code (e1000_hw.c) */ -struct e1000_hw { - struct pci_device *pdev; - uint8_t *hw_addr; - e1000_mac_type mac_type; - e1000_phy_type phy_type; -#if 0 - uint32_t phy_init_script; -#endif - e1000_media_type media_type; - e1000_fc_type fc; -#if 0 - e1000_bus_speed bus_speed; - e1000_bus_width bus_width; - e1000_bus_type bus_type; -#endif - struct e1000_eeprom_info eeprom; -#if 0 - e1000_ms_type master_slave; - e1000_ms_type original_master_slave; - e1000_ffe_config ffe_config_state; -#endif - uint32_t io_base; - uint32_t phy_id; -#ifdef LINUX_DRIVER - uint32_t phy_revision; -#endif - uint32_t phy_addr; -#if 0 - uint32_t original_fc; -#endif - uint32_t txcw; - uint32_t autoneg_failed; -#if 0 - uint32_t max_frame_size; - uint32_t min_frame_size; - uint32_t mc_filter_type; - uint32_t num_mc_addrs; - uint32_t collision_delta; - uint32_t tx_packet_delta; - uint32_t ledctl_default; - uint32_t ledctl_mode1; - uint32_t ledctl_mode2; - uint16_t phy_spd_default; -#endif - uint16_t autoneg_advertised; - uint16_t pci_cmd_word; -#if 0 - uint16_t fc_high_water; - uint16_t fc_low_water; - uint16_t fc_pause_time; - uint16_t current_ifs_val; - uint16_t ifs_min_val; - uint16_t ifs_max_val; - uint16_t ifs_step_size; - uint16_t ifs_ratio; -#endif - uint16_t device_id; - uint16_t vendor_id; -#if 0 - uint16_t subsystem_id; - uint16_t subsystem_vendor_id; -#endif - uint8_t revision_id; -#if 0 - uint8_t autoneg; - uint8_t mdix; - uint8_t forced_speed_duplex; - uint8_t wait_autoneg_complete; - uint8_t dma_fairness; -#endif - uint8_t mac_addr[NODE_ADDRESS_SIZE]; -#if 0 - uint8_t perm_mac_addr[NODE_ADDRESS_SIZE]; - boolean_t disable_polarity_correction; - boolean_t speed_downgraded; - e1000_dsp_config dsp_config_state; - boolean_t get_link_status; - boolean_t serdes_link_down; -#endif - boolean_t tbi_compatibility_en; - boolean_t tbi_compatibility_on; -#if 0 - boolean_t phy_reset_disable; - boolean_t fc_send_xon; - boolean_t fc_strict_ieee; - boolean_t report_tx_early; - boolean_t adaptive_ifs; - boolean_t ifs_params_forced; - boolean_t in_ifs_mode; -#endif -}; - - -#define E1000_EEPROM_SWDPIN0 0x0001 /* SWDPIN 0 EEPROM Value */ -#define E1000_EEPROM_LED_LOGIC 0x0020 /* Led Logic Word */ - -/* Register Bit Masks */ -/* Device Control */ -#define E1000_CTRL_FD 0x00000001 /* Full duplex.0=half; 1=full */ -#define E1000_CTRL_BEM 0x00000002 /* Endian Mode.0=little,1=big */ -#define E1000_CTRL_PRIOR 0x00000004 /* Priority on PCI. 0=rx,1=fair */ -#define E1000_CTRL_LRST 0x00000008 /* Link reset. 0=normal,1=reset */ -#define E1000_CTRL_TME 0x00000010 /* Test mode. 0=normal,1=test */ -#define E1000_CTRL_SLE 0x00000020 /* Serial Link on 0=dis,1=en */ -#define E1000_CTRL_ASDE 0x00000020 /* Auto-speed detect enable */ -#define E1000_CTRL_SLU 0x00000040 /* Set link up (Force Link) */ -#define E1000_CTRL_ILOS 0x00000080 /* Invert Loss-Of Signal */ -#define E1000_CTRL_SPD_SEL 0x00000300 /* Speed Select Mask */ -#define E1000_CTRL_SPD_10 0x00000000 /* Force 10Mb */ -#define E1000_CTRL_SPD_100 0x00000100 /* Force 100Mb */ -#define E1000_CTRL_SPD_1000 0x00000200 /* Force 1Gb */ -#define E1000_CTRL_BEM32 0x00000400 /* Big Endian 32 mode */ -#define E1000_CTRL_FRCSPD 0x00000800 /* Force Speed */ -#define E1000_CTRL_FRCDPX 0x00001000 /* Force Duplex */ -#define E1000_CTRL_SWDPIN0 0x00040000 /* SWDPIN 0 value */ -#define E1000_CTRL_SWDPIN1 0x00080000 /* SWDPIN 1 value */ -#define E1000_CTRL_SWDPIN2 0x00100000 /* SWDPIN 2 value */ -#define E1000_CTRL_SWDPIN3 0x00200000 /* SWDPIN 3 value */ -#define E1000_CTRL_SWDPIO0 0x00400000 /* SWDPIN 0 Input or output */ -#define E1000_CTRL_SWDPIO1 0x00800000 /* SWDPIN 1 input or output */ -#define E1000_CTRL_SWDPIO2 0x01000000 /* SWDPIN 2 input or output */ -#define E1000_CTRL_SWDPIO3 0x02000000 /* SWDPIN 3 input or output */ -#define E1000_CTRL_RST 0x04000000 /* Global reset */ -#define E1000_CTRL_RFCE 0x08000000 /* Receive Flow Control enable */ -#define E1000_CTRL_TFCE 0x10000000 /* Transmit flow control enable */ -#define E1000_CTRL_RTE 0x20000000 /* Routing tag enable */ -#define E1000_CTRL_VME 0x40000000 /* IEEE VLAN mode enable */ -#define E1000_CTRL_PHY_RST 0x80000000 /* PHY Reset */ - -/* Device Status */ -#define E1000_STATUS_FD 0x00000001 /* Full duplex.0=half,1=full */ -#define E1000_STATUS_LU 0x00000002 /* Link up.0=no,1=link */ -#define E1000_STATUS_FUNC_MASK 0x0000000C /* PCI Function Mask */ -#define E1000_STATUS_FUNC_0 0x00000000 /* Function 0 */ -#define E1000_STATUS_FUNC_1 0x00000004 /* Function 1 */ -#define E1000_STATUS_TXOFF 0x00000010 /* transmission paused */ -#define E1000_STATUS_TBIMODE 0x00000020 /* TBI mode */ -#define E1000_STATUS_SPEED_MASK 0x000000C0 -#define E1000_STATUS_SPEED_10 0x00000000 /* Speed 10Mb/s */ -#define E1000_STATUS_SPEED_100 0x00000040 /* Speed 100Mb/s */ -#define E1000_STATUS_SPEED_1000 0x00000080 /* Speed 1000Mb/s */ -#define E1000_STATUS_ASDV 0x00000300 /* Auto speed detect value */ -#define E1000_STATUS_MTXCKOK 0x00000400 /* MTX clock running OK */ -#define E1000_STATUS_PCI66 0x00000800 /* In 66Mhz slot */ -#define E1000_STATUS_BUS64 0x00001000 /* In 64 bit slot */ -#define E1000_STATUS_PCIX_MODE 0x00002000 /* PCI-X mode */ -#define E1000_STATUS_PCIX_SPEED 0x0000C000 /* PCI-X bus speed */ - -/* Constants used to intrepret the masked PCI-X bus speed. */ -#define E1000_STATUS_PCIX_SPEED_66 0x00000000 /* PCI-X bus speed 50-66 MHz */ -#define E1000_STATUS_PCIX_SPEED_100 0x00004000 /* PCI-X bus speed 66-100 MHz */ -#define E1000_STATUS_PCIX_SPEED_133 0x00008000 /* PCI-X bus speed 100-133 MHz */ - -/* EEPROM/Flash Control */ -#define E1000_EECD_SK 0x00000001 /* EEPROM Clock */ -#define E1000_EECD_CS 0x00000002 /* EEPROM Chip Select */ -#define E1000_EECD_DI 0x00000004 /* EEPROM Data In */ -#define E1000_EECD_DO 0x00000008 /* EEPROM Data Out */ -#define E1000_EECD_FWE_MASK 0x00000030 -#define E1000_EECD_FWE_DIS 0x00000010 /* Disable FLASH writes */ -#define E1000_EECD_FWE_EN 0x00000020 /* Enable FLASH writes */ -#define E1000_EECD_FWE_SHIFT 4 -#define E1000_EECD_REQ 0x00000040 /* EEPROM Access Request */ -#define E1000_EECD_GNT 0x00000080 /* EEPROM Access Grant */ -#define E1000_EECD_PRES 0x00000100 /* EEPROM Present */ -#define E1000_EECD_SIZE 0x00000200 /* EEPROM Size (0=64 word 1=256 word) */ -#define E1000_EECD_ADDR_BITS 0x00000400 /* EEPROM Addressing bits based on type - * (0-small, 1-large) */ -#define E1000_EECD_TYPE 0x00002000 /* EEPROM Type (1-SPI, 0-Microwire) */ -#ifndef E1000_EEPROM_GRANT_ATTEMPTS -#define E1000_EEPROM_GRANT_ATTEMPTS 1000 /* EEPROM # attempts to gain grant */ -#endif - -/* EEPROM Read */ -#define E1000_EERD_START 0x00000001 /* Start Read */ -#define E1000_EERD_DONE 0x00000010 /* Read Done */ -#define E1000_EERD_ADDR_SHIFT 8 -#define E1000_EERD_ADDR_MASK 0x0000FF00 /* Read Address */ -#define E1000_EERD_DATA_SHIFT 16 -#define E1000_EERD_DATA_MASK 0xFFFF0000 /* Read Data */ - -/* SPI EEPROM Status Register */ -#define EEPROM_STATUS_RDY_SPI 0x01 -#define EEPROM_STATUS_WEN_SPI 0x02 -#define EEPROM_STATUS_BP0_SPI 0x04 -#define EEPROM_STATUS_BP1_SPI 0x08 -#define EEPROM_STATUS_WPEN_SPI 0x80 - -/* Extended Device Control */ -#define E1000_CTRL_EXT_GPI0_EN 0x00000001 /* Maps SDP4 to GPI0 */ -#define E1000_CTRL_EXT_GPI1_EN 0x00000002 /* Maps SDP5 to GPI1 */ -#define E1000_CTRL_EXT_PHYINT_EN E1000_CTRL_EXT_GPI1_EN -#define E1000_CTRL_EXT_GPI2_EN 0x00000004 /* Maps SDP6 to GPI2 */ -#define E1000_CTRL_EXT_GPI3_EN 0x00000008 /* Maps SDP7 to GPI3 */ -#define E1000_CTRL_EXT_SDP4_DATA 0x00000010 /* Value of SW Defineable Pin 4 */ -#define E1000_CTRL_EXT_SDP5_DATA 0x00000020 /* Value of SW Defineable Pin 5 */ -#define E1000_CTRL_EXT_PHY_INT E1000_CTRL_EXT_SDP5_DATA -#define E1000_CTRL_EXT_SDP6_DATA 0x00000040 /* Value of SW Defineable Pin 6 */ -#define E1000_CTRL_EXT_SDP7_DATA 0x00000080 /* Value of SW Defineable Pin 7 */ -#define E1000_CTRL_EXT_SDP4_DIR 0x00000100 /* Direction of SDP4 0=in 1=out */ -#define E1000_CTRL_EXT_SDP5_DIR 0x00000200 /* Direction of SDP5 0=in 1=out */ -#define E1000_CTRL_EXT_SDP6_DIR 0x00000400 /* Direction of SDP6 0=in 1=out */ -#define E1000_CTRL_EXT_SDP7_DIR 0x00000800 /* Direction of SDP7 0=in 1=out */ -#define E1000_CTRL_EXT_ASDCHK 0x00001000 /* Initiate an ASD sequence */ -#define E1000_CTRL_EXT_EE_RST 0x00002000 /* Reinitialize from EEPROM */ -#define E1000_CTRL_EXT_IPS 0x00004000 /* Invert Power State */ -#define E1000_CTRL_EXT_SPD_BYPS 0x00008000 /* Speed Select Bypass */ -#define E1000_CTRL_EXT_LINK_MODE_MASK 0x00C00000 -#define E1000_CTRL_EXT_LINK_MODE_GMII 0x00000000 -#define E1000_CTRL_EXT_LINK_MODE_TBI 0x00C00000 -#define E1000_CTRL_EXT_WR_WMARK_MASK 0x03000000 -#define E1000_CTRL_EXT_WR_WMARK_256 0x00000000 -#define E1000_CTRL_EXT_WR_WMARK_320 0x01000000 -#define E1000_CTRL_EXT_WR_WMARK_384 0x02000000 -#define E1000_CTRL_EXT_WR_WMARK_448 0x03000000 - -/* MDI Control */ -#define E1000_MDIC_DATA_MASK 0x0000FFFF -#define E1000_MDIC_REG_MASK 0x001F0000 -#define E1000_MDIC_REG_SHIFT 16 -#define E1000_MDIC_PHY_MASK 0x03E00000 -#define E1000_MDIC_PHY_SHIFT 21 -#define E1000_MDIC_OP_WRITE 0x04000000 -#define E1000_MDIC_OP_READ 0x08000000 -#define E1000_MDIC_READY 0x10000000 -#define E1000_MDIC_INT_EN 0x20000000 -#define E1000_MDIC_ERROR 0x40000000 - -/* LED Control */ -#define E1000_LEDCTL_LED0_MODE_MASK 0x0000000F -#define E1000_LEDCTL_LED0_MODE_SHIFT 0 -#define E1000_LEDCTL_LED0_IVRT 0x00000040 -#define E1000_LEDCTL_LED0_BLINK 0x00000080 -#define E1000_LEDCTL_LED1_MODE_MASK 0x00000F00 -#define E1000_LEDCTL_LED1_MODE_SHIFT 8 -#define E1000_LEDCTL_LED1_IVRT 0x00004000 -#define E1000_LEDCTL_LED1_BLINK 0x00008000 -#define E1000_LEDCTL_LED2_MODE_MASK 0x000F0000 -#define E1000_LEDCTL_LED2_MODE_SHIFT 16 -#define E1000_LEDCTL_LED2_IVRT 0x00400000 -#define E1000_LEDCTL_LED2_BLINK 0x00800000 -#define E1000_LEDCTL_LED3_MODE_MASK 0x0F000000 -#define E1000_LEDCTL_LED3_MODE_SHIFT 24 -#define E1000_LEDCTL_LED3_IVRT 0x40000000 -#define E1000_LEDCTL_LED3_BLINK 0x80000000 - -#define E1000_LEDCTL_MODE_LINK_10_1000 0x0 -#define E1000_LEDCTL_MODE_LINK_100_1000 0x1 -#define E1000_LEDCTL_MODE_LINK_UP 0x2 -#define E1000_LEDCTL_MODE_ACTIVITY 0x3 -#define E1000_LEDCTL_MODE_LINK_ACTIVITY 0x4 -#define E1000_LEDCTL_MODE_LINK_10 0x5 -#define E1000_LEDCTL_MODE_LINK_100 0x6 -#define E1000_LEDCTL_MODE_LINK_1000 0x7 -#define E1000_LEDCTL_MODE_PCIX_MODE 0x8 -#define E1000_LEDCTL_MODE_FULL_DUPLEX 0x9 -#define E1000_LEDCTL_MODE_COLLISION 0xA -#define E1000_LEDCTL_MODE_BUS_SPEED 0xB -#define E1000_LEDCTL_MODE_BUS_SIZE 0xC -#define E1000_LEDCTL_MODE_PAUSED 0xD -#define E1000_LEDCTL_MODE_LED_ON 0xE -#define E1000_LEDCTL_MODE_LED_OFF 0xF - -/* Receive Address */ -#define E1000_RAH_AV 0x80000000 /* Receive descriptor valid */ - -/* Interrupt Cause Read */ -#define E1000_ICR_TXDW 0x00000001 /* Transmit desc written back */ -#define E1000_ICR_TXQE 0x00000002 /* Transmit Queue empty */ -#define E1000_ICR_LSC 0x00000004 /* Link Status Change */ -#define E1000_ICR_RXSEQ 0x00000008 /* rx sequence error */ -#define E1000_ICR_RXDMT0 0x00000010 /* rx desc min. threshold (0) */ -#define E1000_ICR_RXO 0x00000040 /* rx overrun */ -#define E1000_ICR_RXT0 0x00000080 /* rx timer intr (ring 0) */ -#define E1000_ICR_MDAC 0x00000200 /* MDIO access complete */ -#define E1000_ICR_RXCFG 0x00000400 /* RX /c/ ordered set */ -#define E1000_ICR_GPI_EN0 0x00000800 /* GP Int 0 */ -#define E1000_ICR_GPI_EN1 0x00001000 /* GP Int 1 */ -#define E1000_ICR_GPI_EN2 0x00002000 /* GP Int 2 */ -#define E1000_ICR_GPI_EN3 0x00004000 /* GP Int 3 */ -#define E1000_ICR_TXD_LOW 0x00008000 -#define E1000_ICR_SRPD 0x00010000 - -/* Interrupt Cause Set */ -#define E1000_ICS_TXDW E1000_ICR_TXDW /* Transmit desc written back */ -#define E1000_ICS_TXQE E1000_ICR_TXQE /* Transmit Queue empty */ -#define E1000_ICS_LSC E1000_ICR_LSC /* Link Status Change */ -#define E1000_ICS_RXSEQ E1000_ICR_RXSEQ /* rx sequence error */ -#define E1000_ICS_RXDMT0 E1000_ICR_RXDMT0 /* rx desc min. threshold */ -#define E1000_ICS_RXO E1000_ICR_RXO /* rx overrun */ -#define E1000_ICS_RXT0 E1000_ICR_RXT0 /* rx timer intr */ -#define E1000_ICS_MDAC E1000_ICR_MDAC /* MDIO access complete */ -#define E1000_ICS_RXCFG E1000_ICR_RXCFG /* RX /c/ ordered set */ -#define E1000_ICS_GPI_EN0 E1000_ICR_GPI_EN0 /* GP Int 0 */ -#define E1000_ICS_GPI_EN1 E1000_ICR_GPI_EN1 /* GP Int 1 */ -#define E1000_ICS_GPI_EN2 E1000_ICR_GPI_EN2 /* GP Int 2 */ -#define E1000_ICS_GPI_EN3 E1000_ICR_GPI_EN3 /* GP Int 3 */ -#define E1000_ICS_TXD_LOW E1000_ICR_TXD_LOW -#define E1000_ICS_SRPD E1000_ICR_SRPD - -/* Interrupt Mask Set */ -#define E1000_IMS_TXDW E1000_ICR_TXDW /* Transmit desc written back */ -#define E1000_IMS_TXQE E1000_ICR_TXQE /* Transmit Queue empty */ -#define E1000_IMS_LSC E1000_ICR_LSC /* Link Status Change */ -#define E1000_IMS_RXSEQ E1000_ICR_RXSEQ /* rx sequence error */ -#define E1000_IMS_RXDMT0 E1000_ICR_RXDMT0 /* rx desc min. threshold */ -#define E1000_IMS_RXO E1000_ICR_RXO /* rx overrun */ -#define E1000_IMS_RXT0 E1000_ICR_RXT0 /* rx timer intr */ -#define E1000_IMS_MDAC E1000_ICR_MDAC /* MDIO access complete */ -#define E1000_IMS_RXCFG E1000_ICR_RXCFG /* RX /c/ ordered set */ -#define E1000_IMS_GPI_EN0 E1000_ICR_GPI_EN0 /* GP Int 0 */ -#define E1000_IMS_GPI_EN1 E1000_ICR_GPI_EN1 /* GP Int 1 */ -#define E1000_IMS_GPI_EN2 E1000_ICR_GPI_EN2 /* GP Int 2 */ -#define E1000_IMS_GPI_EN3 E1000_ICR_GPI_EN3 /* GP Int 3 */ -#define E1000_IMS_TXD_LOW E1000_ICR_TXD_LOW -#define E1000_IMS_SRPD E1000_ICR_SRPD - -/* Interrupt Mask Clear */ -#define E1000_IMC_TXDW E1000_ICR_TXDW /* Transmit desc written back */ -#define E1000_IMC_TXQE E1000_ICR_TXQE /* Transmit Queue empty */ -#define E1000_IMC_LSC E1000_ICR_LSC /* Link Status Change */ -#define E1000_IMC_RXSEQ E1000_ICR_RXSEQ /* rx sequence error */ -#define E1000_IMC_RXDMT0 E1000_ICR_RXDMT0 /* rx desc min. threshold */ -#define E1000_IMC_RXO E1000_ICR_RXO /* rx overrun */ -#define E1000_IMC_RXT0 E1000_ICR_RXT0 /* rx timer intr */ -#define E1000_IMC_MDAC E1000_ICR_MDAC /* MDIO access complete */ -#define E1000_IMC_RXCFG E1000_ICR_RXCFG /* RX /c/ ordered set */ -#define E1000_IMC_GPI_EN0 E1000_ICR_GPI_EN0 /* GP Int 0 */ -#define E1000_IMC_GPI_EN1 E1000_ICR_GPI_EN1 /* GP Int 1 */ -#define E1000_IMC_GPI_EN2 E1000_ICR_GPI_EN2 /* GP Int 2 */ -#define E1000_IMC_GPI_EN3 E1000_ICR_GPI_EN3 /* GP Int 3 */ -#define E1000_IMC_TXD_LOW E1000_ICR_TXD_LOW -#define E1000_IMC_SRPD E1000_ICR_SRPD - -/* Receive Control */ -#define E1000_RCTL_RST 0x00000001 /* Software reset */ -#define E1000_RCTL_EN 0x00000002 /* enable */ -#define E1000_RCTL_SBP 0x00000004 /* store bad packet */ -#define E1000_RCTL_UPE 0x00000008 /* unicast promiscuous enable */ -#define E1000_RCTL_MPE 0x00000010 /* multicast promiscuous enab */ -#define E1000_RCTL_LPE 0x00000020 /* long packet enable */ -#define E1000_RCTL_LBM_NO 0x00000000 /* no loopback mode */ -#define E1000_RCTL_LBM_MAC 0x00000040 /* MAC loopback mode */ -#define E1000_RCTL_LBM_SLP 0x00000080 /* serial link loopback mode */ -#define E1000_RCTL_LBM_TCVR 0x000000C0 /* tcvr loopback mode */ -#define E1000_RCTL_RDMTS_HALF 0x00000000 /* rx desc min threshold size */ -#define E1000_RCTL_RDMTS_QUAT 0x00000100 /* rx desc min threshold size */ -#define E1000_RCTL_RDMTS_EIGTH 0x00000200 /* rx desc min threshold size */ -#define E1000_RCTL_MO_SHIFT 12 /* multicast offset shift */ -#define E1000_RCTL_MO_0 0x00000000 /* multicast offset 11:0 */ -#define E1000_RCTL_MO_1 0x00001000 /* multicast offset 12:1 */ -#define E1000_RCTL_MO_2 0x00002000 /* multicast offset 13:2 */ -#define E1000_RCTL_MO_3 0x00003000 /* multicast offset 15:4 */ -#define E1000_RCTL_MDR 0x00004000 /* multicast desc ring 0 */ -#define E1000_RCTL_BAM 0x00008000 /* broadcast enable */ -/* these buffer sizes are valid if E1000_RCTL_BSEX is 0 */ -#define E1000_RCTL_SZ_2048 0x00000000 /* rx buffer size 2048 */ -#define E1000_RCTL_SZ_1024 0x00010000 /* rx buffer size 1024 */ -#define E1000_RCTL_SZ_512 0x00020000 /* rx buffer size 512 */ -#define E1000_RCTL_SZ_256 0x00030000 /* rx buffer size 256 */ -/* these buffer sizes are valid if E1000_RCTL_BSEX is 1 */ -#define E1000_RCTL_SZ_16384 0x00010000 /* rx buffer size 16384 */ -#define E1000_RCTL_SZ_8192 0x00020000 /* rx buffer size 8192 */ -#define E1000_RCTL_SZ_4096 0x00030000 /* rx buffer size 4096 */ -#define E1000_RCTL_VFE 0x00040000 /* vlan filter enable */ -#define E1000_RCTL_CFIEN 0x00080000 /* canonical form enable */ -#define E1000_RCTL_CFI 0x00100000 /* canonical form indicator */ -#define E1000_RCTL_DPF 0x00400000 /* discard pause frames */ -#define E1000_RCTL_PMCF 0x00800000 /* pass MAC control frames */ -#define E1000_RCTL_BSEX 0x02000000 /* Buffer size extension */ - -/* Receive Descriptor */ -#define E1000_RDT_DELAY 0x0000ffff /* Delay timer (1=1024us) */ -#define E1000_RDT_FPDB 0x80000000 /* Flush descriptor block */ -#define E1000_RDLEN_LEN 0x0007ff80 /* descriptor length */ -#define E1000_RDH_RDH 0x0000ffff /* receive descriptor head */ -#define E1000_RDT_RDT 0x0000ffff /* receive descriptor tail */ - -/* Flow Control */ -#define E1000_FCRTH_RTH 0x0000FFF8 /* Mask Bits[15:3] for RTH */ -#define E1000_FCRTH_XFCE 0x80000000 /* External Flow Control Enable */ -#define E1000_FCRTL_RTL 0x0000FFF8 /* Mask Bits[15:3] for RTL */ -#define E1000_FCRTL_XONE 0x80000000 /* Enable XON frame transmission */ - -/* Receive Descriptor Control */ -#define E1000_RXDCTL_PTHRESH 0x0000003F /* RXDCTL Prefetch Threshold */ -#define E1000_RXDCTL_HTHRESH 0x00003F00 /* RXDCTL Host Threshold */ -#define E1000_RXDCTL_WTHRESH 0x003F0000 /* RXDCTL Writeback Threshold */ -#define E1000_RXDCTL_GRAN 0x01000000 /* RXDCTL Granularity */ - -/* Transmit Descriptor Control */ -#define E1000_TXDCTL_PTHRESH 0x000000FF /* TXDCTL Prefetch Threshold */ -#define E1000_TXDCTL_HTHRESH 0x0000FF00 /* TXDCTL Host Threshold */ -#define E1000_TXDCTL_WTHRESH 0x00FF0000 /* TXDCTL Writeback Threshold */ -#define E1000_TXDCTL_GRAN 0x01000000 /* TXDCTL Granularity */ -#define E1000_TXDCTL_LWTHRESH 0xFE000000 /* TXDCTL Low Threshold */ -#define E1000_TXDCTL_FULL_TX_DESC_WB 0x01010000 /* GRAN=1, WTHRESH=1 */ - -/* Transmit Configuration Word */ -#define E1000_TXCW_FD 0x00000020 /* TXCW full duplex */ -#define E1000_TXCW_HD 0x00000040 /* TXCW half duplex */ -#define E1000_TXCW_PAUSE 0x00000080 /* TXCW sym pause request */ -#define E1000_TXCW_ASM_DIR 0x00000100 /* TXCW astm pause direction */ -#define E1000_TXCW_PAUSE_MASK 0x00000180 /* TXCW pause request mask */ -#define E1000_TXCW_RF 0x00003000 /* TXCW remote fault */ -#define E1000_TXCW_NP 0x00008000 /* TXCW next page */ -#define E1000_TXCW_CW 0x0000ffff /* TxConfigWord mask */ -#define E1000_TXCW_TXC 0x40000000 /* Transmit Config control */ -#define E1000_TXCW_ANE 0x80000000 /* Auto-neg enable */ - -/* Receive Configuration Word */ -#define E1000_RXCW_CW 0x0000ffff /* RxConfigWord mask */ -#define E1000_RXCW_NC 0x04000000 /* Receive config no carrier */ -#define E1000_RXCW_IV 0x08000000 /* Receive config invalid */ -#define E1000_RXCW_CC 0x10000000 /* Receive config change */ -#define E1000_RXCW_C 0x20000000 /* Receive config */ -#define E1000_RXCW_SYNCH 0x40000000 /* Receive config synch */ -#define E1000_RXCW_ANC 0x80000000 /* Auto-neg complete */ - -/* Transmit Control */ -#define E1000_TCTL_RST 0x00000001 /* software reset */ -#define E1000_TCTL_EN 0x00000002 /* enable tx */ -#define E1000_TCTL_BCE 0x00000004 /* busy check enable */ -#define E1000_TCTL_PSP 0x00000008 /* pad short packets */ -#define E1000_TCTL_CT 0x00000ff0 /* collision threshold */ -#define E1000_TCTL_COLD 0x003ff000 /* collision distance */ -#define E1000_TCTL_SWXOFF 0x00400000 /* SW Xoff transmission */ -#define E1000_TCTL_PBE 0x00800000 /* Packet Burst Enable */ -#define E1000_TCTL_RTLC 0x01000000 /* Re-transmit on late collision */ -#define E1000_TCTL_NRTU 0x02000000 /* No Re-transmit on underrun */ - -/* Receive Checksum Control */ -#define E1000_RXCSUM_PCSS_MASK 0x000000FF /* Packet Checksum Start */ -#define E1000_RXCSUM_IPOFL 0x00000100 /* IPv4 checksum offload */ -#define E1000_RXCSUM_TUOFL 0x00000200 /* TCP / UDP checksum offload */ -#define E1000_RXCSUM_IPV6OFL 0x00000400 /* IPv6 checksum offload */ - -/* Definitions for power management and wakeup registers */ -/* Wake Up Control */ -#define E1000_WUC_APME 0x00000001 /* APM Enable */ -#define E1000_WUC_PME_EN 0x00000002 /* PME Enable */ -#define E1000_WUC_PME_STATUS 0x00000004 /* PME Status */ -#define E1000_WUC_APMPME 0x00000008 /* Assert PME on APM Wakeup */ -#define E1000_WUC_SPM 0x80000000 /* Enable SPM */ - -/* Wake Up Filter Control */ -#define E1000_WUFC_LNKC 0x00000001 /* Link Status Change Wakeup Enable */ -#define E1000_WUFC_MAG 0x00000002 /* Magic Packet Wakeup Enable */ -#define E1000_WUFC_EX 0x00000004 /* Directed Exact Wakeup Enable */ -#define E1000_WUFC_MC 0x00000008 /* Directed Multicast Wakeup Enable */ -#define E1000_WUFC_BC 0x00000010 /* Broadcast Wakeup Enable */ -#define E1000_WUFC_ARP 0x00000020 /* ARP Request Packet Wakeup Enable */ -#define E1000_WUFC_IPV4 0x00000040 /* Directed IPv4 Packet Wakeup Enable */ -#define E1000_WUFC_IPV6 0x00000080 /* Directed IPv6 Packet Wakeup Enable */ -#define E1000_WUFC_FLX0 0x00010000 /* Flexible Filter 0 Enable */ -#define E1000_WUFC_FLX1 0x00020000 /* Flexible Filter 1 Enable */ -#define E1000_WUFC_FLX2 0x00040000 /* Flexible Filter 2 Enable */ -#define E1000_WUFC_FLX3 0x00080000 /* Flexible Filter 3 Enable */ -#define E1000_WUFC_ALL_FILTERS 0x000F00FF /* Mask for all wakeup filters */ -#define E1000_WUFC_FLX_OFFSET 16 /* Offset to the Flexible Filters bits */ -#define E1000_WUFC_FLX_FILTERS 0x000F0000 /* Mask for the 4 flexible filters */ - -/* Wake Up Status */ -#define E1000_WUS_LNKC 0x00000001 /* Link Status Changed */ -#define E1000_WUS_MAG 0x00000002 /* Magic Packet Received */ -#define E1000_WUS_EX 0x00000004 /* Directed Exact Received */ -#define E1000_WUS_MC 0x00000008 /* Directed Multicast Received */ -#define E1000_WUS_BC 0x00000010 /* Broadcast Received */ -#define E1000_WUS_ARP 0x00000020 /* ARP Request Packet Received */ -#define E1000_WUS_IPV4 0x00000040 /* Directed IPv4 Packet Wakeup Received */ -#define E1000_WUS_IPV6 0x00000080 /* Directed IPv6 Packet Wakeup Received */ -#define E1000_WUS_FLX0 0x00010000 /* Flexible Filter 0 Match */ -#define E1000_WUS_FLX1 0x00020000 /* Flexible Filter 1 Match */ -#define E1000_WUS_FLX2 0x00040000 /* Flexible Filter 2 Match */ -#define E1000_WUS_FLX3 0x00080000 /* Flexible Filter 3 Match */ -#define E1000_WUS_FLX_FILTERS 0x000F0000 /* Mask for the 4 flexible filters */ - -/* Management Control */ -#define E1000_MANC_SMBUS_EN 0x00000001 /* SMBus Enabled - RO */ -#define E1000_MANC_ASF_EN 0x00000002 /* ASF Enabled - RO */ -#define E1000_MANC_R_ON_FORCE 0x00000004 /* Reset on Force TCO - RO */ -#define E1000_MANC_RMCP_EN 0x00000100 /* Enable RCMP 026Fh Filtering */ -#define E1000_MANC_0298_EN 0x00000200 /* Enable RCMP 0298h Filtering */ -#define E1000_MANC_IPV4_EN 0x00000400 /* Enable IPv4 */ -#define E1000_MANC_IPV6_EN 0x00000800 /* Enable IPv6 */ -#define E1000_MANC_SNAP_EN 0x00001000 /* Accept LLC/SNAP */ -#define E1000_MANC_ARP_EN 0x00002000 /* Enable ARP Request Filtering */ -#define E1000_MANC_NEIGHBOR_EN 0x00004000 /* Enable Neighbor Discovery - * Filtering */ -#define E1000_MANC_TCO_RESET 0x00010000 /* TCO Reset Occurred */ -#define E1000_MANC_RCV_TCO_EN 0x00020000 /* Receive TCO Packets Enabled */ -#define E1000_MANC_REPORT_STATUS 0x00040000 /* Status Reporting Enabled */ -#define E1000_MANC_SMB_REQ 0x01000000 /* SMBus Request */ -#define E1000_MANC_SMB_GNT 0x02000000 /* SMBus Grant */ -#define E1000_MANC_SMB_CLK_IN 0x04000000 /* SMBus Clock In */ -#define E1000_MANC_SMB_DATA_IN 0x08000000 /* SMBus Data In */ -#define E1000_MANC_SMB_DATA_OUT 0x10000000 /* SMBus Data Out */ -#define E1000_MANC_SMB_CLK_OUT 0x20000000 /* SMBus Clock Out */ - -#define E1000_MANC_SMB_DATA_OUT_SHIFT 28 /* SMBus Data Out Shift */ -#define E1000_MANC_SMB_CLK_OUT_SHIFT 29 /* SMBus Clock Out Shift */ - -/* Wake Up Packet Length */ -#define E1000_WUPL_LENGTH_MASK 0x0FFF /* Only the lower 12 bits are valid */ - -#define E1000_MDALIGN 4096 - -/* EEPROM Commands - Microwire */ -#define EEPROM_READ_OPCODE_MICROWIRE 0x6 /* EEPROM read opcode */ -#define EEPROM_WRITE_OPCODE_MICROWIRE 0x5 /* EEPROM write opcode */ -#define EEPROM_ERASE_OPCODE_MICROWIRE 0x7 /* EEPROM erase opcode */ -#define EEPROM_EWEN_OPCODE_MICROWIRE 0x13 /* EEPROM erase/write enable */ -#define EEPROM_EWDS_OPCODE_MICROWIRE 0x10 /* EEPROM erast/write disable */ - -/* EEPROM Commands - SPI */ -#define EEPROM_MAX_RETRY_SPI 5000 /* Max wait of 5ms, for RDY signal */ -#define EEPROM_READ_OPCODE_SPI 0x3 /* EEPROM read opcode */ -#define EEPROM_WRITE_OPCODE_SPI 0x2 /* EEPROM write opcode */ -#define EEPROM_A8_OPCODE_SPI 0x8 /* opcode bit-3 = address bit-8 */ -#define EEPROM_WREN_OPCODE_SPI 0x6 /* EEPROM set Write Enable latch */ -#define EEPROM_WRDI_OPCODE_SPI 0x4 /* EEPROM reset Write Enable latch */ -#define EEPROM_RDSR_OPCODE_SPI 0x5 /* EEPROM read Status register */ -#define EEPROM_WRSR_OPCODE_SPI 0x1 /* EEPROM write Status register */ - -/* EEPROM Size definitions */ -#define EEPROM_SIZE_16KB 0x1800 -#define EEPROM_SIZE_8KB 0x1400 -#define EEPROM_SIZE_4KB 0x1000 -#define EEPROM_SIZE_2KB 0x0C00 -#define EEPROM_SIZE_1KB 0x0800 -#define EEPROM_SIZE_512B 0x0400 -#define EEPROM_SIZE_128B 0x0000 -#define EEPROM_SIZE_MASK 0x1C00 - -/* EEPROM Word Offsets */ -#define EEPROM_COMPAT 0x0003 -#define EEPROM_ID_LED_SETTINGS 0x0004 -#define EEPROM_SERDES_AMPLITUDE 0x0006 /* For SERDES output amplitude adjustment. */ -#define EEPROM_INIT_CONTROL1_REG 0x000A -#define EEPROM_INIT_CONTROL2_REG 0x000F -#define EEPROM_INIT_CONTROL3_PORT_B 0x0014 -#define EEPROM_INIT_CONTROL3_PORT_A 0x0024 -#define EEPROM_CFG 0x0012 -#define EEPROM_FLASH_VERSION 0x0032 -#define EEPROM_CHECKSUM_REG 0x003F - -/* Word definitions for ID LED Settings */ -#define ID_LED_RESERVED_0000 0x0000 -#define ID_LED_RESERVED_FFFF 0xFFFF -#define ID_LED_DEFAULT ((ID_LED_OFF1_ON2 << 12) | \ - (ID_LED_OFF1_OFF2 << 8) | \ - (ID_LED_DEF1_DEF2 << 4) | \ - (ID_LED_DEF1_DEF2)) -#define ID_LED_DEF1_DEF2 0x1 -#define ID_LED_DEF1_ON2 0x2 -#define ID_LED_DEF1_OFF2 0x3 -#define ID_LED_ON1_DEF2 0x4 -#define ID_LED_ON1_ON2 0x5 -#define ID_LED_ON1_OFF2 0x6 -#define ID_LED_OFF1_DEF2 0x7 -#define ID_LED_OFF1_ON2 0x8 -#define ID_LED_OFF1_OFF2 0x9 - -#define IGP_ACTIVITY_LED_MASK 0xFFFFF0FF -#define IGP_ACTIVITY_LED_ENABLE 0x0300 -#define IGP_LED3_MODE 0x07000000 - - -/* Mask bits for SERDES amplitude adjustment in Word 6 of the EEPROM */ -#define EEPROM_SERDES_AMPLITUDE_MASK 0x000F - -/* Mask bits for fields in Word 0x0a of the EEPROM */ -#define EEPROM_WORD0A_ILOS 0x0010 -#define EEPROM_WORD0A_SWDPIO 0x01E0 -#define EEPROM_WORD0A_LRST 0x0200 -#define EEPROM_WORD0A_FD 0x0400 -#define EEPROM_WORD0A_66MHZ 0x0800 - -/* Mask bits for fields in Word 0x0f of the EEPROM */ -#define EEPROM_WORD0F_PAUSE_MASK 0x3000 -#define EEPROM_WORD0F_PAUSE 0x1000 -#define EEPROM_WORD0F_ASM_DIR 0x2000 -#define EEPROM_WORD0F_ANE 0x0800 -#define EEPROM_WORD0F_SWPDIO_EXT 0x00F0 - -/* For checksumming, the sum of all words in the EEPROM should equal 0xBABA. */ -#define EEPROM_SUM 0xBABA - -/* EEPROM Map defines (WORD OFFSETS)*/ -#define EEPROM_NODE_ADDRESS_BYTE_0 0 -#define EEPROM_PBA_BYTE_1 8 - -#define EEPROM_RESERVED_WORD 0xFFFF - -/* EEPROM Map Sizes (Byte Counts) */ -#define PBA_SIZE 4 - -/* Collision related configuration parameters */ -#define E1000_COLLISION_THRESHOLD 16 -#define E1000_CT_SHIFT 4 -#define E1000_COLLISION_DISTANCE 64 -#define E1000_FDX_COLLISION_DISTANCE E1000_COLLISION_DISTANCE -#define E1000_HDX_COLLISION_DISTANCE E1000_COLLISION_DISTANCE -#define E1000_COLD_SHIFT 12 - -/* Number of Transmit and Receive Descriptors must be a multiple of 8 */ -#define REQ_TX_DESCRIPTOR_MULTIPLE 8 -#define REQ_RX_DESCRIPTOR_MULTIPLE 8 - -/* Default values for the transmit IPG register */ -#define DEFAULT_82542_TIPG_IPGT 10 -#define DEFAULT_82543_TIPG_IPGT_FIBER 9 -#define DEFAULT_82543_TIPG_IPGT_COPPER 8 - -#define E1000_TIPG_IPGT_MASK 0x000003FF -#define E1000_TIPG_IPGR1_MASK 0x000FFC00 -#define E1000_TIPG_IPGR2_MASK 0x3FF00000 - -#define DEFAULT_82542_TIPG_IPGR1 2 -#define DEFAULT_82543_TIPG_IPGR1 8 -#define E1000_TIPG_IPGR1_SHIFT 10 - -#define DEFAULT_82542_TIPG_IPGR2 10 -#define DEFAULT_82543_TIPG_IPGR2 6 -#define E1000_TIPG_IPGR2_SHIFT 20 - -#define E1000_TXDMAC_DPP 0x00000001 - -/* Adaptive IFS defines */ -#define TX_THRESHOLD_START 8 -#define TX_THRESHOLD_INCREMENT 10 -#define TX_THRESHOLD_DECREMENT 1 -#define TX_THRESHOLD_STOP 190 -#define TX_THRESHOLD_DISABLE 0 -#define TX_THRESHOLD_TIMER_MS 10000 -#define MIN_NUM_XMITS 1000 -#define IFS_MAX 80 -#define IFS_STEP 10 -#define IFS_MIN 40 -#define IFS_RATIO 4 - -/* PBA constants */ -#define E1000_PBA_16K 0x0010 /* 16KB, default TX allocation */ -#define E1000_PBA_22K 0x0016 -#define E1000_PBA_24K 0x0018 -#define E1000_PBA_30K 0x001E -#define E1000_PBA_40K 0x0028 -#define E1000_PBA_48K 0x0030 /* 48KB, default RX allocation */ - -/* Flow Control Constants */ -#define FLOW_CONTROL_ADDRESS_LOW 0x00C28001 -#define FLOW_CONTROL_ADDRESS_HIGH 0x00000100 -#define FLOW_CONTROL_TYPE 0x8808 - -/* The historical defaults for the flow control values are given below. */ -#define FC_DEFAULT_HI_THRESH (0x8000) /* 32KB */ -#define FC_DEFAULT_LO_THRESH (0x4000) /* 16KB */ -#define FC_DEFAULT_TX_TIMER (0x100) /* ~130 us */ - -/* PCIX Config space */ -#define PCIX_COMMAND_REGISTER 0xE6 -#define PCIX_STATUS_REGISTER_LO 0xE8 -#define PCIX_STATUS_REGISTER_HI 0xEA - -#define PCIX_COMMAND_MMRBC_MASK 0x000C -#define PCIX_COMMAND_MMRBC_SHIFT 0x2 -#define PCIX_STATUS_HI_MMRBC_MASK 0x0060 -#define PCIX_STATUS_HI_MMRBC_SHIFT 0x5 -#define PCIX_STATUS_HI_MMRBC_4K 0x3 -#define PCIX_STATUS_HI_MMRBC_2K 0x2 - - -/* Number of bits required to shift right the "pause" bits from the - * EEPROM (bits 13:12) to the "pause" (bits 8:7) field in the TXCW register. - */ -#define PAUSE_SHIFT 5 - -/* Number of bits required to shift left the "SWDPIO" bits from the - * EEPROM (bits 8:5) to the "SWDPIO" (bits 25:22) field in the CTRL register. - */ -#define SWDPIO_SHIFT 17 - -/* Number of bits required to shift left the "SWDPIO_EXT" bits from the - * EEPROM word F (bits 7:4) to the bits 11:8 of The Extended CTRL register. - */ -#define SWDPIO__EXT_SHIFT 4 - -/* Number of bits required to shift left the "ILOS" bit from the EEPROM - * (bit 4) to the "ILOS" (bit 7) field in the CTRL register. - */ -#define ILOS_SHIFT 3 - - -#define RECEIVE_BUFFER_ALIGN_SIZE (256) - -/* Number of milliseconds we wait for auto-negotiation to complete */ -#define LINK_UP_TIMEOUT 500 - -#define E1000_TX_BUFFER_SIZE ((uint32_t)1514) - -/* The carrier extension symbol, as received by the NIC. */ -#define CARRIER_EXTENSION 0x0F - -/* TBI_ACCEPT macro definition: - * - * This macro requires: - * adapter = a pointer to struct e1000_hw - * status = the 8 bit status field of the RX descriptor with EOP set - * error = the 8 bit error field of the RX descriptor with EOP set - * length = the sum of all the length fields of the RX descriptors that - * make up the current frame - * last_byte = the last byte of the frame DMAed by the hardware - * max_frame_length = the maximum frame length we want to accept. - * min_frame_length = the minimum frame length we want to accept. - * - * This macro is a conditional that should be used in the interrupt - * handler's Rx processing routine when RxErrors have been detected. - * - * Typical use: - * ... - * if (TBI_ACCEPT) { - * accept_frame = TRUE; - * e1000_tbi_adjust_stats(adapter, MacAddress); - * frame_length--; - * } else { - * accept_frame = FALSE; - * } - * ... - */ - -#define TBI_ACCEPT(adapter, status, errors, length, last_byte) \ - ((adapter)->tbi_compatibility_on && \ - (((errors) & E1000_RXD_ERR_FRAME_ERR_MASK) == E1000_RXD_ERR_CE) && \ - ((last_byte) == CARRIER_EXTENSION) && \ - (((status) & E1000_RXD_STAT_VP) ? \ - (((length) > ((adapter)->min_frame_size - VLAN_TAG_SIZE)) && \ - ((length) <= ((adapter)->max_frame_size + 1))) : \ - (((length) > (adapter)->min_frame_size) && \ - ((length) <= ((adapter)->max_frame_size + VLAN_TAG_SIZE + 1))))) - - -/* Structures, enums, and macros for the PHY */ - -/* Bit definitions for the Management Data IO (MDIO) and Management Data - * Clock (MDC) pins in the Device Control Register. - */ -#define E1000_CTRL_PHY_RESET_DIR E1000_CTRL_SWDPIO0 -#define E1000_CTRL_PHY_RESET E1000_CTRL_SWDPIN0 -#define E1000_CTRL_MDIO_DIR E1000_CTRL_SWDPIO2 -#define E1000_CTRL_MDIO E1000_CTRL_SWDPIN2 -#define E1000_CTRL_MDC_DIR E1000_CTRL_SWDPIO3 -#define E1000_CTRL_MDC E1000_CTRL_SWDPIN3 -#define E1000_CTRL_PHY_RESET_DIR4 E1000_CTRL_EXT_SDP4_DIR -#define E1000_CTRL_PHY_RESET4 E1000_CTRL_EXT_SDP4_DATA - -/* PHY 1000 MII Register/Bit Definitions */ -/* PHY Registers defined by IEEE */ -#define PHY_CTRL 0x00 /* Control Register */ -#define PHY_STATUS 0x01 /* Status Regiser */ -#define PHY_ID1 0x02 /* Phy Id Reg (word 1) */ -#define PHY_ID2 0x03 /* Phy Id Reg (word 2) */ -#define PHY_AUTONEG_ADV 0x04 /* Autoneg Advertisement */ -#define PHY_LP_ABILITY 0x05 /* Link Partner Ability (Base Page) */ -#define PHY_AUTONEG_EXP 0x06 /* Autoneg Expansion Reg */ -#define PHY_NEXT_PAGE_TX 0x07 /* Next Page TX */ -#define PHY_LP_NEXT_PAGE 0x08 /* Link Partner Next Page */ -#define PHY_1000T_CTRL 0x09 /* 1000Base-T Control Reg */ -#define PHY_1000T_STATUS 0x0A /* 1000Base-T Status Reg */ -#define PHY_EXT_STATUS 0x0F /* Extended Status Reg */ - -/* M88E1000 Specific Registers */ -#define M88E1000_PHY_SPEC_CTRL 0x10 /* PHY Specific Control Register */ -#define M88E1000_PHY_SPEC_STATUS 0x11 /* PHY Specific Status Register */ -#define M88E1000_INT_ENABLE 0x12 /* Interrupt Enable Register */ -#define M88E1000_INT_STATUS 0x13 /* Interrupt Status Register */ -#define M88E1000_EXT_PHY_SPEC_CTRL 0x14 /* Extended PHY Specific Control */ -#define M88E1000_RX_ERR_CNTR 0x15 /* Receive Error Counter */ - -#define M88E1000_PHY_EXT_CTRL 0x1A /* PHY extend control register */ -#define M88E1000_PHY_PAGE_SELECT 0x1D /* Reg 29 for page number setting */ -#define M88E1000_PHY_GEN_CONTROL 0x1E /* Its meaning depends on reg 29 */ -#define M88E1000_PHY_VCO_REG_BIT8 0x100 /* Bits 8 & 11 are adjusted for */ -#define M88E1000_PHY_VCO_REG_BIT11 0x800 /* improved BER performance */ - -#define IGP01E1000_IEEE_REGS_PAGE 0x0000 -#define IGP01E1000_IEEE_RESTART_AUTONEG 0x3300 -#define IGP01E1000_IEEE_FORCE_GIGA 0x0140 - -/* IGP01E1000 Specific Registers */ -#define IGP01E1000_PHY_PORT_CONFIG 0x10 /* PHY Specific Port Config Register */ -#define IGP01E1000_PHY_PORT_STATUS 0x11 /* PHY Specific Status Register */ -#define IGP01E1000_PHY_PORT_CTRL 0x12 /* PHY Specific Control Register */ -#define IGP01E1000_PHY_LINK_HEALTH 0x13 /* PHY Link Health Register */ -#define IGP01E1000_GMII_FIFO 0x14 /* GMII FIFO Register */ -#define IGP01E1000_PHY_CHANNEL_QUALITY 0x15 /* PHY Channel Quality Register */ -#define IGP01E1000_PHY_PAGE_SELECT 0x1F /* PHY Page Select Core Register */ - -/* IGP01E1000 AGC Registers - stores the cable length values*/ -#define IGP01E1000_PHY_AGC_A 0x1172 -#define IGP01E1000_PHY_AGC_B 0x1272 -#define IGP01E1000_PHY_AGC_C 0x1472 -#define IGP01E1000_PHY_AGC_D 0x1872 - -/* IGP01E1000 DSP Reset Register */ -#define IGP01E1000_PHY_DSP_RESET 0x1F33 -#define IGP01E1000_PHY_DSP_SET 0x1F71 -#define IGP01E1000_PHY_DSP_FFE 0x1F35 - -#define IGP01E1000_PHY_CHANNEL_NUM 4 -#define IGP01E1000_PHY_AGC_PARAM_A 0x1171 -#define IGP01E1000_PHY_AGC_PARAM_B 0x1271 -#define IGP01E1000_PHY_AGC_PARAM_C 0x1471 -#define IGP01E1000_PHY_AGC_PARAM_D 0x1871 - -#define IGP01E1000_PHY_EDAC_MU_INDEX 0xC000 -#define IGP01E1000_PHY_EDAC_SIGN_EXT_9_BITS 0x8000 - -#define IGP01E1000_PHY_ANALOG_TX_STATE 0x2890 -#define IGP01E1000_PHY_ANALOG_CLASS_A 0x2000 -#define IGP01E1000_PHY_FORCE_ANALOG_ENABLE 0x0004 -#define IGP01E1000_PHY_DSP_FFE_CM_CP 0x0069 - -#define IGP01E1000_PHY_DSP_FFE_DEFAULT 0x002A -/* IGP01E1000 PCS Initialization register - stores the polarity status when - * speed = 1000 Mbps. */ -#define IGP01E1000_PHY_PCS_INIT_REG 0x00B4 -#define IGP01E1000_PHY_PCS_CTRL_REG 0x00B5 - -#define IGP01E1000_ANALOG_REGS_PAGE 0x20C0 - -#define MAX_PHY_REG_ADDRESS 0x1F /* 5 bit address bus (0-0x1F) */ -#define MAX_PHY_MULTI_PAGE_REG 0xF /*Registers that are equal on all pages*/ -/* PHY Control Register */ -#define MII_CR_SPEED_SELECT_MSB 0x0040 /* bits 6,13: 10=1000, 01=100, 00=10 */ -#define MII_CR_COLL_TEST_ENABLE 0x0080 /* Collision test enable */ -#define MII_CR_FULL_DUPLEX 0x0100 /* FDX =1, half duplex =0 */ -#define MII_CR_RESTART_AUTO_NEG 0x0200 /* Restart auto negotiation */ -#define MII_CR_ISOLATE 0x0400 /* Isolate PHY from MII */ -#define MII_CR_POWER_DOWN 0x0800 /* Power down */ -#define MII_CR_AUTO_NEG_EN 0x1000 /* Auto Neg Enable */ -#define MII_CR_SPEED_SELECT_LSB 0x2000 /* bits 6,13: 10=1000, 01=100, 00=10 */ -#define MII_CR_LOOPBACK 0x4000 /* 0 = normal, 1 = loopback */ -#define MII_CR_RESET 0x8000 /* 0 = normal, 1 = PHY reset */ - -/* PHY Status Register */ -#define MII_SR_EXTENDED_CAPS 0x0001 /* Extended register capabilities */ -#define MII_SR_JABBER_DETECT 0x0002 /* Jabber Detected */ -#define MII_SR_LINK_STATUS 0x0004 /* Link Status 1 = link */ -#define MII_SR_AUTONEG_CAPS 0x0008 /* Auto Neg Capable */ -#define MII_SR_REMOTE_FAULT 0x0010 /* Remote Fault Detect */ -#define MII_SR_AUTONEG_COMPLETE 0x0020 /* Auto Neg Complete */ -#define MII_SR_PREAMBLE_SUPPRESS 0x0040 /* Preamble may be suppressed */ -#define MII_SR_EXTENDED_STATUS 0x0100 /* Ext. status info in Reg 0x0F */ -#define MII_SR_100T2_HD_CAPS 0x0200 /* 100T2 Half Duplex Capable */ -#define MII_SR_100T2_FD_CAPS 0x0400 /* 100T2 Full Duplex Capable */ -#define MII_SR_10T_HD_CAPS 0x0800 /* 10T Half Duplex Capable */ -#define MII_SR_10T_FD_CAPS 0x1000 /* 10T Full Duplex Capable */ -#define MII_SR_100X_HD_CAPS 0x2000 /* 100X Half Duplex Capable */ -#define MII_SR_100X_FD_CAPS 0x4000 /* 100X Full Duplex Capable */ -#define MII_SR_100T4_CAPS 0x8000 /* 100T4 Capable */ - -/* Autoneg Advertisement Register */ -#define NWAY_AR_SELECTOR_FIELD 0x0001 /* indicates IEEE 802.3 CSMA/CD */ -#define NWAY_AR_10T_HD_CAPS 0x0020 /* 10T Half Duplex Capable */ -#define NWAY_AR_10T_FD_CAPS 0x0040 /* 10T Full Duplex Capable */ -#define NWAY_AR_100TX_HD_CAPS 0x0080 /* 100TX Half Duplex Capable */ -#define NWAY_AR_100TX_FD_CAPS 0x0100 /* 100TX Full Duplex Capable */ -#define NWAY_AR_100T4_CAPS 0x0200 /* 100T4 Capable */ -#define NWAY_AR_PAUSE 0x0400 /* Pause operation desired */ -#define NWAY_AR_ASM_DIR 0x0800 /* Asymmetric Pause Direction bit */ -#define NWAY_AR_REMOTE_FAULT 0x2000 /* Remote Fault detected */ -#define NWAY_AR_NEXT_PAGE 0x8000 /* Next Page ability supported */ - -/* Link Partner Ability Register (Base Page) */ -#define NWAY_LPAR_SELECTOR_FIELD 0x0000 /* LP protocol selector field */ -#define NWAY_LPAR_10T_HD_CAPS 0x0020 /* LP is 10T Half Duplex Capable */ -#define NWAY_LPAR_10T_FD_CAPS 0x0040 /* LP is 10T Full Duplex Capable */ -#define NWAY_LPAR_100TX_HD_CAPS 0x0080 /* LP is 100TX Half Duplex Capable */ -#define NWAY_LPAR_100TX_FD_CAPS 0x0100 /* LP is 100TX Full Duplex Capable */ -#define NWAY_LPAR_100T4_CAPS 0x0200 /* LP is 100T4 Capable */ -#define NWAY_LPAR_PAUSE 0x0400 /* LP Pause operation desired */ -#define NWAY_LPAR_ASM_DIR 0x0800 /* LP Asymmetric Pause Direction bit */ -#define NWAY_LPAR_REMOTE_FAULT 0x2000 /* LP has detected Remote Fault */ -#define NWAY_LPAR_ACKNOWLEDGE 0x4000 /* LP has rx'd link code word */ -#define NWAY_LPAR_NEXT_PAGE 0x8000 /* Next Page ability supported */ - -/* Autoneg Expansion Register */ -#define NWAY_ER_LP_NWAY_CAPS 0x0001 /* LP has Auto Neg Capability */ -#define NWAY_ER_PAGE_RXD 0x0002 /* LP is 10T Half Duplex Capable */ -#define NWAY_ER_NEXT_PAGE_CAPS 0x0004 /* LP is 10T Full Duplex Capable */ -#define NWAY_ER_LP_NEXT_PAGE_CAPS 0x0008 /* LP is 100TX Half Duplex Capable */ -#define NWAY_ER_PAR_DETECT_FAULT 0x0010 /* LP is 100TX Full Duplex Capable */ - -/* Next Page TX Register */ -#define NPTX_MSG_CODE_FIELD 0x0001 /* NP msg code or unformatted data */ -#define NPTX_TOGGLE 0x0800 /* Toggles between exchanges - * of different NP - */ -#define NPTX_ACKNOWLDGE2 0x1000 /* 1 = will comply with msg - * 0 = cannot comply with msg - */ -#define NPTX_MSG_PAGE 0x2000 /* formatted(1)/unformatted(0) pg */ -#define NPTX_NEXT_PAGE 0x8000 /* 1 = addition NP will follow - * 0 = sending last NP - */ - -/* Link Partner Next Page Register */ -#define LP_RNPR_MSG_CODE_FIELD 0x0001 /* NP msg code or unformatted data */ -#define LP_RNPR_TOGGLE 0x0800 /* Toggles between exchanges - * of different NP - */ -#define LP_RNPR_ACKNOWLDGE2 0x1000 /* 1 = will comply with msg - * 0 = cannot comply with msg - */ -#define LP_RNPR_MSG_PAGE 0x2000 /* formatted(1)/unformatted(0) pg */ -#define LP_RNPR_ACKNOWLDGE 0x4000 /* 1 = ACK / 0 = NO ACK */ -#define LP_RNPR_NEXT_PAGE 0x8000 /* 1 = addition NP will follow - * 0 = sending last NP - */ - -/* 1000BASE-T Control Register */ -#define CR_1000T_ASYM_PAUSE 0x0080 /* Advertise asymmetric pause bit */ -#define CR_1000T_HD_CAPS 0x0100 /* Advertise 1000T HD capability */ -#define CR_1000T_FD_CAPS 0x0200 /* Advertise 1000T FD capability */ -#define CR_1000T_REPEATER_DTE 0x0400 /* 1=Repeater/switch device port */ - /* 0=DTE device */ -#define CR_1000T_MS_VALUE 0x0800 /* 1=Configure PHY as Master */ - /* 0=Configure PHY as Slave */ -#define CR_1000T_MS_ENABLE 0x1000 /* 1=Master/Slave manual config value */ - /* 0=Automatic Master/Slave config */ -#define CR_1000T_TEST_MODE_NORMAL 0x0000 /* Normal Operation */ -#define CR_1000T_TEST_MODE_1 0x2000 /* Transmit Waveform test */ -#define CR_1000T_TEST_MODE_2 0x4000 /* Master Transmit Jitter test */ -#define CR_1000T_TEST_MODE_3 0x6000 /* Slave Transmit Jitter test */ -#define CR_1000T_TEST_MODE_4 0x8000 /* Transmitter Distortion test */ - -/* 1000BASE-T Status Register */ -#define SR_1000T_IDLE_ERROR_CNT 0x00FF /* Num idle errors since last read */ -#define SR_1000T_ASYM_PAUSE_DIR 0x0100 /* LP asymmetric pause direction bit */ -#define SR_1000T_LP_HD_CAPS 0x0400 /* LP is 1000T HD capable */ -#define SR_1000T_LP_FD_CAPS 0x0800 /* LP is 1000T FD capable */ -#define SR_1000T_REMOTE_RX_STATUS 0x1000 /* Remote receiver OK */ -#define SR_1000T_LOCAL_RX_STATUS 0x2000 /* Local receiver OK */ -#define SR_1000T_MS_CONFIG_RES 0x4000 /* 1=Local TX is Master, 0=Slave */ -#define SR_1000T_MS_CONFIG_FAULT 0x8000 /* Master/Slave config fault */ -#define SR_1000T_REMOTE_RX_STATUS_SHIFT 12 -#define SR_1000T_LOCAL_RX_STATUS_SHIFT 13 -#define SR_1000T_PHY_EXCESSIVE_IDLE_ERR_COUNT 5 -#define FFE_IDLE_ERR_COUNT_TIMEOUT_20 20 -#define FFE_IDLE_ERR_COUNT_TIMEOUT_100 100 - -/* Extended Status Register */ -#define IEEE_ESR_1000T_HD_CAPS 0x1000 /* 1000T HD capable */ -#define IEEE_ESR_1000T_FD_CAPS 0x2000 /* 1000T FD capable */ -#define IEEE_ESR_1000X_HD_CAPS 0x4000 /* 1000X HD capable */ -#define IEEE_ESR_1000X_FD_CAPS 0x8000 /* 1000X FD capable */ - -#define PHY_TX_POLARITY_MASK 0x0100 /* register 10h bit 8 (polarity bit) */ -#define PHY_TX_NORMAL_POLARITY 0 /* register 10h bit 8 (normal polarity) */ - -#define AUTO_POLARITY_DISABLE 0x0010 /* register 11h bit 4 */ - /* (0=enable, 1=disable) */ - -/* M88E1000 PHY Specific Control Register */ -#define M88E1000_PSCR_JABBER_DISABLE 0x0001 /* 1=Jabber Function disabled */ -#define M88E1000_PSCR_POLARITY_REVERSAL 0x0002 /* 1=Polarity Reversal enabled */ -#define M88E1000_PSCR_SQE_TEST 0x0004 /* 1=SQE Test enabled */ -#define M88E1000_PSCR_CLK125_DISABLE 0x0010 /* 1=CLK125 low, - * 0=CLK125 toggling - */ -#define M88E1000_PSCR_MDI_MANUAL_MODE 0x0000 /* MDI Crossover Mode bits 6:5 */ - /* Manual MDI configuration */ -#define M88E1000_PSCR_MDIX_MANUAL_MODE 0x0020 /* Manual MDIX configuration */ -#define M88E1000_PSCR_AUTO_X_1000T 0x0040 /* 1000BASE-T: Auto crossover, - * 100BASE-TX/10BASE-T: - * MDI Mode - */ -#define M88E1000_PSCR_AUTO_X_MODE 0x0060 /* Auto crossover enabled - * all speeds. - */ -#define M88E1000_PSCR_10BT_EXT_DIST_ENABLE 0x0080 - /* 1=Enable Extended 10BASE-T distance - * (Lower 10BASE-T RX Threshold) - * 0=Normal 10BASE-T RX Threshold */ -#define M88E1000_PSCR_MII_5BIT_ENABLE 0x0100 - /* 1=5-Bit interface in 100BASE-TX - * 0=MII interface in 100BASE-TX */ -#define M88E1000_PSCR_SCRAMBLER_DISABLE 0x0200 /* 1=Scrambler disable */ -#define M88E1000_PSCR_FORCE_LINK_GOOD 0x0400 /* 1=Force link good */ -#define M88E1000_PSCR_ASSERT_CRS_ON_TX 0x0800 /* 1=Assert CRS on Transmit */ - -#define M88E1000_PSCR_POLARITY_REVERSAL_SHIFT 1 -#define M88E1000_PSCR_AUTO_X_MODE_SHIFT 5 -#define M88E1000_PSCR_10BT_EXT_DIST_ENABLE_SHIFT 7 - -/* M88E1000 PHY Specific Status Register */ -#define M88E1000_PSSR_JABBER 0x0001 /* 1=Jabber */ -#define M88E1000_PSSR_REV_POLARITY 0x0002 /* 1=Polarity reversed */ -#define M88E1000_PSSR_DOWNSHIFT 0x0020 /* 1=Downshifted */ -#define M88E1000_PSSR_MDIX 0x0040 /* 1=MDIX; 0=MDI */ -#define M88E1000_PSSR_CABLE_LENGTH 0x0380 /* 0=<50M;1=50-80M;2=80-110M; - * 3=110-140M;4=>140M */ -#define M88E1000_PSSR_LINK 0x0400 /* 1=Link up, 0=Link down */ -#define M88E1000_PSSR_SPD_DPLX_RESOLVED 0x0800 /* 1=Speed & Duplex resolved */ -#define M88E1000_PSSR_PAGE_RCVD 0x1000 /* 1=Page received */ -#define M88E1000_PSSR_DPLX 0x2000 /* 1=Duplex 0=Half Duplex */ -#define M88E1000_PSSR_SPEED 0xC000 /* Speed, bits 14:15 */ -#define M88E1000_PSSR_10MBS 0x0000 /* 00=10Mbs */ -#define M88E1000_PSSR_100MBS 0x4000 /* 01=100Mbs */ -#define M88E1000_PSSR_1000MBS 0x8000 /* 10=1000Mbs */ - -#define M88E1000_PSSR_REV_POLARITY_SHIFT 1 -#define M88E1000_PSSR_DOWNSHIFT_SHIFT 5 -#define M88E1000_PSSR_MDIX_SHIFT 6 -#define M88E1000_PSSR_CABLE_LENGTH_SHIFT 7 - -/* M88E1000 Extended PHY Specific Control Register */ -#define M88E1000_EPSCR_FIBER_LOOPBACK 0x4000 /* 1=Fiber loopback */ -#define M88E1000_EPSCR_DOWN_NO_IDLE 0x8000 /* 1=Lost lock detect enabled. - * Will assert lost lock and bring - * link down if idle not seen - * within 1ms in 1000BASE-T - */ -/* Number of times we will attempt to autonegotiate before downshifting if we - * are the master */ -#define M88E1000_EPSCR_MASTER_DOWNSHIFT_MASK 0x0C00 -#define M88E1000_EPSCR_MASTER_DOWNSHIFT_1X 0x0000 -#define M88E1000_EPSCR_MASTER_DOWNSHIFT_2X 0x0400 -#define M88E1000_EPSCR_MASTER_DOWNSHIFT_3X 0x0800 -#define M88E1000_EPSCR_MASTER_DOWNSHIFT_4X 0x0C00 -/* Number of times we will attempt to autonegotiate before downshifting if we - * are the slave */ -#define M88E1000_EPSCR_SLAVE_DOWNSHIFT_MASK 0x0300 -#define M88E1000_EPSCR_SLAVE_DOWNSHIFT_DIS 0x0000 -#define M88E1000_EPSCR_SLAVE_DOWNSHIFT_1X 0x0100 -#define M88E1000_EPSCR_SLAVE_DOWNSHIFT_2X 0x0200 -#define M88E1000_EPSCR_SLAVE_DOWNSHIFT_3X 0x0300 -#define M88E1000_EPSCR_TX_CLK_2_5 0x0060 /* 2.5 MHz TX_CLK */ -#define M88E1000_EPSCR_TX_CLK_25 0x0070 /* 25 MHz TX_CLK */ -#define M88E1000_EPSCR_TX_CLK_0 0x0000 /* NO TX_CLK */ - -/* IGP01E1000 Specific Port Config Register - R/W */ -#define IGP01E1000_PSCFR_AUTO_MDIX_PAR_DETECT 0x0010 -#define IGP01E1000_PSCFR_PRE_EN 0x0020 -#define IGP01E1000_PSCFR_SMART_SPEED 0x0080 -#define IGP01E1000_PSCFR_DISABLE_TPLOOPBACK 0x0100 -#define IGP01E1000_PSCFR_DISABLE_JABBER 0x0400 -#define IGP01E1000_PSCFR_DISABLE_TRANSMIT 0x2000 - -/* IGP01E1000 Specific Port Status Register - R/O */ -#define IGP01E1000_PSSR_AUTONEG_FAILED 0x0001 /* RO LH SC */ -#define IGP01E1000_PSSR_POLARITY_REVERSED 0x0002 -#define IGP01E1000_PSSR_CABLE_LENGTH 0x007C -#define IGP01E1000_PSSR_FULL_DUPLEX 0x0200 -#define IGP01E1000_PSSR_LINK_UP 0x0400 -#define IGP01E1000_PSSR_MDIX 0x0800 -#define IGP01E1000_PSSR_SPEED_MASK 0xC000 /* speed bits mask */ -#define IGP01E1000_PSSR_SPEED_10MBPS 0x4000 -#define IGP01E1000_PSSR_SPEED_100MBPS 0x8000 -#define IGP01E1000_PSSR_SPEED_1000MBPS 0xC000 -#define IGP01E1000_PSSR_CABLE_LENGTH_SHIFT 0x0002 /* shift right 2 */ -#define IGP01E1000_PSSR_MDIX_SHIFT 0x000B /* shift right 11 */ - -/* IGP01E1000 Specific Port Control Register - R/W */ -#define IGP01E1000_PSCR_TP_LOOPBACK 0x0001 -#define IGP01E1000_PSCR_CORRECT_NC_SCMBLR 0x0200 -#define IGP01E1000_PSCR_TEN_CRS_SELECT 0x0400 -#define IGP01E1000_PSCR_FLIP_CHIP 0x0800 -#define IGP01E1000_PSCR_AUTO_MDIX 0x1000 -#define IGP01E1000_PSCR_FORCE_MDI_MDIX 0x2000 /* 0-MDI, 1-MDIX */ - -/* IGP01E1000 Specific Port Link Health Register */ -#define IGP01E1000_PLHR_SS_DOWNGRADE 0x8000 -#define IGP01E1000_PLHR_GIG_SCRAMBLER_ERROR 0x4000 -#define IGP01E1000_PLHR_GIG_REM_RCVR_NOK 0x0800 /* LH */ -#define IGP01E1000_PLHR_IDLE_ERROR_CNT_OFLOW 0x0400 /* LH */ -#define IGP01E1000_PLHR_DATA_ERR_1 0x0200 /* LH */ -#define IGP01E1000_PLHR_DATA_ERR_0 0x0100 -#define IGP01E1000_PLHR_AUTONEG_FAULT 0x0010 -#define IGP01E1000_PLHR_AUTONEG_ACTIVE 0x0008 -#define IGP01E1000_PLHR_VALID_CHANNEL_D 0x0004 -#define IGP01E1000_PLHR_VALID_CHANNEL_C 0x0002 -#define IGP01E1000_PLHR_VALID_CHANNEL_B 0x0001 -#define IGP01E1000_PLHR_VALID_CHANNEL_A 0x0000 - -/* IGP01E1000 Channel Quality Register */ -#define IGP01E1000_MSE_CHANNEL_D 0x000F -#define IGP01E1000_MSE_CHANNEL_C 0x00F0 -#define IGP01E1000_MSE_CHANNEL_B 0x0F00 -#define IGP01E1000_MSE_CHANNEL_A 0xF000 - -/* IGP01E1000 DSP reset macros */ -#define DSP_RESET_ENABLE 0x0 -#define DSP_RESET_DISABLE 0x2 -#define E1000_MAX_DSP_RESETS 10 - -/* IGP01E1000 AGC Registers */ - -#define IGP01E1000_AGC_LENGTH_SHIFT 7 /* Coarse - 13:11, Fine - 10:7 */ - -/* 7 bits (3 Coarse + 4 Fine) --> 128 optional values */ -#define IGP01E1000_AGC_LENGTH_TABLE_SIZE 128 - -/* The precision of the length is +/- 10 meters */ -#define IGP01E1000_AGC_RANGE 10 - -/* IGP01E1000 PCS Initialization register */ -/* bits 3:6 in the PCS registers stores the channels polarity */ -#define IGP01E1000_PHY_POLARITY_MASK 0x0078 - -/* IGP01E1000 GMII FIFO Register */ -#define IGP01E1000_GMII_FLEX_SPD 0x10 /* Enable flexible speed - * on Link-Up */ -#define IGP01E1000_GMII_SPD 0x20 /* Enable SPD */ - -/* IGP01E1000 Analog Register */ -#define IGP01E1000_ANALOG_SPARE_FUSE_STATUS 0x20D1 -#define IGP01E1000_ANALOG_FUSE_STATUS 0x20D0 -#define IGP01E1000_ANALOG_FUSE_CONTROL 0x20DC -#define IGP01E1000_ANALOG_FUSE_BYPASS 0x20DE - -#define IGP01E1000_ANALOG_FUSE_POLY_MASK 0xF000 -#define IGP01E1000_ANALOG_FUSE_FINE_MASK 0x0F80 -#define IGP01E1000_ANALOG_FUSE_COARSE_MASK 0x0070 -#define IGP01E1000_ANALOG_SPARE_FUSE_ENABLED 0x0100 -#define IGP01E1000_ANALOG_FUSE_ENABLE_SW_CONTROL 0x0002 - -#define IGP01E1000_ANALOG_FUSE_COARSE_THRESH 0x0040 -#define IGP01E1000_ANALOG_FUSE_COARSE_10 0x0010 -#define IGP01E1000_ANALOG_FUSE_FINE_1 0x0080 -#define IGP01E1000_ANALOG_FUSE_FINE_10 0x0500 - -/* Bit definitions for valid PHY IDs. */ -#define M88E1000_E_PHY_ID 0x01410C50 -#define M88E1000_I_PHY_ID 0x01410C30 -#define M88E1011_I_PHY_ID 0x01410C20 -#define IGP01E1000_I_PHY_ID 0x02A80380 -#define M88E1000_12_PHY_ID M88E1000_E_PHY_ID -#define M88E1000_14_PHY_ID M88E1000_E_PHY_ID -#define M88E1011_I_REV_4 0x04 - -/* Miscellaneous PHY bit definitions. */ -#define PHY_PREAMBLE 0xFFFFFFFF -#define PHY_SOF 0x01 -#define PHY_OP_READ 0x02 -#define PHY_OP_WRITE 0x01 -#define PHY_TURNAROUND 0x02 -#define PHY_PREAMBLE_SIZE 32 -#define MII_CR_SPEED_1000 0x0040 -#define MII_CR_SPEED_100 0x2000 -#define MII_CR_SPEED_10 0x0000 -#define E1000_PHY_ADDRESS 0x01 -#define PHY_AUTO_NEG_TIME 45 /* 4.5 Seconds */ -#define PHY_FORCE_TIME 20 /* 2.0 Seconds */ -#define PHY_REVISION_MASK 0xFFFFFFF0 -#define DEVICE_SPEED_MASK 0x00000300 /* Device Ctrl Reg Speed Mask */ -#define REG4_SPEED_MASK 0x01E0 -#define REG9_SPEED_MASK 0x0300 -#define ADVERTISE_10_HALF 0x0001 -#define ADVERTISE_10_FULL 0x0002 -#define ADVERTISE_100_HALF 0x0004 -#define ADVERTISE_100_FULL 0x0008 -#define ADVERTISE_1000_HALF 0x0010 -#define ADVERTISE_1000_FULL 0x0020 -#define AUTONEG_ADVERTISE_SPEED_DEFAULT 0x002F /* Everything but 1000-Half */ -#define AUTONEG_ADVERTISE_10_100_ALL 0x000F /* All 10/100 speeds*/ -#define AUTONEG_ADVERTISE_10_ALL 0x0003 /* 10Mbps Full & Half speeds*/ - -#endif /* _E1000_HW_H_ */ diff --git a/usr/src/grub/grub-0.95/netboot/eepro100.c b/usr/src/grub/grub-0.95/netboot/eepro100.c deleted file mode 100644 index 4aeeff97e2..0000000000 --- a/usr/src/grub/grub-0.95/netboot/eepro100.c +++ /dev/null @@ -1,809 +0,0 @@ -/* - * eepro100.c -- This file implements the eepro100 driver for etherboot. - * - * - * Copyright (C) AW Computer Systems. - * written by R.E.Wolff -- R.E.Wolff@BitWizard.nl - * - * - * AW Computer Systems is contributing to the free software community - * by paying for this driver and then putting the result under GPL. - * - * If you need a Linux device driver, please contact BitWizard for a - * quote. - * - * - * 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. - * - * 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. - * - * - * date version by what - * Written: May 29 1997 V0.10 REW Initial revision. - * changes: May 31 1997 V0.90 REW Works! - * Jun 1 1997 V0.91 REW Cleanup - * Jun 2 1997 V0.92 REW Add some code documentation - * Jul 25 1997 V1.00 REW Tested by AW to work in a PROM - * Cleanup for publication - * - * This is the etherboot intel etherexpress Pro/100B driver. - * - * It was written from scratch, with Donald Beckers eepro100.c kernel - * driver as a guideline. Mostly the 82557 related definitions and the - * lower level routines have been cut-and-pasted into this source. - * - * The driver was finished before Intel got the NDA out of the closet. - * I still don't have the docs. - * */ - -/* Philosophy of this driver. - * - * Probing: - * - * Using the pci.c functions of the Etherboot code, the 82557 chip is detected. - * It is verified that the BIOS initialized everything properly and if - * something is missing it is done now. - * - * - * Initialization: - * - * - * The chip is then initialized to "know" its ethernet address, and to - * start recieving packets. The Linux driver has a whole transmit and - * recieve ring of buffers. This is neat if you need high performance: - * you can write the buffers asynchronously to the chip reading the - * buffers and transmitting them over the network. Performance is NOT - * an issue here. We can boot a 400k kernel in about two - * seconds. (Theory: 0.4 seconds). Booting a system is going to take - * about half a minute anyway, so getting 10 times closer to the - * theoretical limit is going to make a difference of a few percent. - * - * - * Transmitting and recieving. - * - * We have only one transmit descriptor. It has two buffer descriptors: - * one for the header, and the other for the data. - * We have only one receive buffer. The chip is told to recieve packets, - * and suspend itself once it got one. The recieve (poll) routine simply - * looks at the recieve buffer to see if there is already a packet there. - * if there is, the buffer is copied, and the reciever is restarted. - * - * Caveats: - * - * The Etherboot framework moves the code to the 48k segment from - * 0x94000 to 0xa0000. There is just a little room between the end of - * this driver and the 0xa0000 address. If you compile in too many - * features, this will overflow. - * The number under "hex" in the output of size that scrolls by while - * compiling should be less than 8000. Maybe even the stack is up there, - * so that you need even more headroom. - */ - -/* The etherboot authors seem to dislike the argument ordering in - * outb macros that Linux uses. I disklike the confusion that this - * has caused even more.... This file uses the Linux argument ordering. */ -/* Sorry not us. It's inherited code from FreeBSD. [The authors] */ - -#include "etherboot.h" -#include "nic.h" -#include "pci.h" -#include "timer.h" - -static int ioaddr; - -typedef unsigned char u8; -typedef signed char s8; -typedef unsigned short u16; -typedef signed short s16; -typedef unsigned int u32; -typedef signed int s32; - -enum speedo_offsets { - SCBStatus = 0, SCBCmd = 2, /* Rx/Command Unit command and status. */ - SCBPointer = 4, /* General purpose pointer. */ - SCBPort = 8, /* Misc. commands and operands. */ - SCBflash = 12, SCBeeprom = 14, /* EEPROM and flash memory control. */ - SCBCtrlMDI = 16, /* MDI interface control. */ - SCBEarlyRx = 20, /* Early receive byte count. */ -}; - -enum SCBCmdBits { - SCBMaskCmdDone=0x8000, SCBMaskRxDone=0x4000, SCBMaskCmdIdle=0x2000, - SCBMaskRxSuspend=0x1000, SCBMaskEarlyRx=0x0800, SCBMaskFlowCtl=0x0400, - SCBTriggerIntr=0x0200, SCBMaskAll=0x0100, - /* The rest are Rx and Tx commands. */ - CUStart=0x0010, CUResume=0x0020, CUStatsAddr=0x0040, CUShowStats=0x0050, - CUCmdBase=0x0060, /* CU Base address (set to zero) . */ - CUDumpStats=0x0070, /* Dump then reset stats counters. */ - RxStart=0x0001, RxResume=0x0002, RxAbort=0x0004, RxAddrLoad=0x0006, - RxResumeNoResources=0x0007, -}; - -static int do_eeprom_cmd(int cmd, int cmd_len); -void hd(void *where, int n); - -/***********************************************************************/ -/* I82557 related defines */ -/***********************************************************************/ - -/* Serial EEPROM section. - A "bit" grungy, but we work our way through bit-by-bit :->. */ -/* EEPROM_Ctrl bits. */ -#define EE_SHIFT_CLK 0x01 /* EEPROM shift clock. */ -#define EE_CS 0x02 /* EEPROM chip select. */ -#define EE_DATA_WRITE 0x04 /* EEPROM chip data in. */ -#define EE_DATA_READ 0x08 /* EEPROM chip data out. */ -#define EE_WRITE_0 0x4802 -#define EE_WRITE_1 0x4806 -#define EE_ENB (0x4800 | EE_CS) - -/* The EEPROM commands include the alway-set leading bit. */ -#define EE_READ_CMD 6 - -/* The SCB accepts the following controls for the Tx and Rx units: */ -#define CU_START 0x0010 -#define CU_RESUME 0x0020 -#define CU_STATSADDR 0x0040 -#define CU_SHOWSTATS 0x0050 /* Dump statistics counters. */ -#define CU_CMD_BASE 0x0060 /* Base address to add to add CU commands. */ -#define CU_DUMPSTATS 0x0070 /* Dump then reset stats counters. */ - -#define RX_START 0x0001 -#define RX_RESUME 0x0002 -#define RX_ABORT 0x0004 -#define RX_ADDR_LOAD 0x0006 -#define RX_RESUMENR 0x0007 -#define INT_MASK 0x0100 -#define DRVR_INT 0x0200 /* Driver generated interrupt. */ - -enum phy_chips { NonSuchPhy=0, I82553AB, I82553C, I82503, DP83840, S80C240, - S80C24, PhyUndefined, DP83840A=10, }; - -/* Commands that can be put in a command list entry. */ -enum commands { - CmdNOp = 0, - CmdIASetup = 1, - CmdConfigure = 2, - CmdMulticastList = 3, - CmdTx = 4, - CmdTDR = 5, - CmdDump = 6, - CmdDiagnose = 7, - - /* And some extra flags: */ - CmdSuspend = 0x4000, /* Suspend after completion. */ - CmdIntr = 0x2000, /* Interrupt after completion. */ - CmdTxFlex = 0x0008, /* Use "Flexible mode" for CmdTx command. */ -}; - -/* How to wait for the command unit to accept a command. - Typically this takes 0 ticks. */ -static inline void wait_for_cmd_done(int cmd_ioaddr) -{ - int wait = 0; - int delayed_cmd; - - do - if (inb(cmd_ioaddr) == 0) return; - while(++wait <= 100); - delayed_cmd = inb(cmd_ioaddr); - do - if (inb(cmd_ioaddr) == 0) break; - while(++wait <= 10000); - printf("Command %2.2x was not immediately accepted, %d ticks!\n", - delayed_cmd, wait); -} - -/* Elements of the dump_statistics block. This block must be lword aligned. */ -static struct speedo_stats { - u32 tx_good_frames; - u32 tx_coll16_errs; - u32 tx_late_colls; - u32 tx_underruns; - u32 tx_lost_carrier; - u32 tx_deferred; - u32 tx_one_colls; - u32 tx_multi_colls; - u32 tx_total_colls; - u32 rx_good_frames; - u32 rx_crc_errs; - u32 rx_align_errs; - u32 rx_resource_errs; - u32 rx_overrun_errs; - u32 rx_colls_errs; - u32 rx_runt_errs; - u32 done_marker; -} lstats; - -/* A speedo3 TX buffer descriptor with two buffers... */ -static struct TxFD { - volatile s16 status; - s16 command; - u32 link; /* void * */ - u32 tx_desc_addr; /* (almost) Always points to the tx_buf_addr element. */ - s32 count; /* # of TBD (=2), Tx start thresh., etc. */ - /* This constitutes two "TBD" entries: hdr and data */ - u32 tx_buf_addr0; /* void *, header of frame to be transmitted. */ - s32 tx_buf_size0; /* Length of Tx hdr. */ - u32 tx_buf_addr1; /* void *, data to be transmitted. */ - s32 tx_buf_size1; /* Length of Tx data. */ -} txfd; - -struct RxFD { /* Receive frame descriptor. */ - volatile s16 status; - s16 command; - u32 link; /* struct RxFD * */ - u32 rx_buf_addr; /* void * */ - u16 count; - u16 size; - char packet[1518]; -}; - -static struct RxFD rxfd; -#define ACCESS(x) x. - -static int congenb = 0; /* Enable congestion control in the DP83840. */ -static int txfifo = 8; /* Tx FIFO threshold in 4 byte units, 0-15 */ -static int rxfifo = 8; /* Rx FIFO threshold, default 32 bytes. */ -static int txdmacount = 0; /* Tx DMA burst length, 0-127, default 0. */ -static int rxdmacount = 0; /* Rx DMA length, 0 means no preemption. */ - -/* I don't understand a byte in this structure. It was copied from the - * Linux kernel initialization for the eepro100. -- REW */ -static struct ConfCmd { - s16 status; - s16 command; - u32 link; - unsigned char data[22]; -} confcmd = { - 0, 0, 0, /* filled in later */ - {22, 0x08, 0, 0, 0, 0x80, 0x32, 0x03, 1, /* 1=Use MII 0=Use AUI */ - 0, 0x2E, 0, 0x60, 0, - 0xf2, 0x48, 0, 0x40, 0xf2, 0x80, /* 0x40=Force full-duplex */ - 0x3f, 0x05, } -}; - -/***********************************************************************/ -/* Locally used functions */ -/***********************************************************************/ - -/* Support function: mdio_write - * - * This probably writes to the "physical media interface chip". - * -- REW - */ - -static int mdio_write(int phy_id, int location, int value) -{ - int val, boguscnt = 64*4; /* <64 usec. to complete, typ 27 ticks */ - - outl(0x04000000 | (location<<16) | (phy_id<<21) | value, - ioaddr + SCBCtrlMDI); - do { - udelay(16); - - val = inl(ioaddr + SCBCtrlMDI); - if (--boguscnt < 0) { - printf(" mdio_write() timed out with val = %X.\n", val); - break; - } - } while (! (val & 0x10000000)); - return val & 0xffff; -} - -/* Support function: mdio_read - * - * This probably reads a register in the "physical media interface chip". - * -- REW - */ -static int mdio_read(int phy_id, int location) -{ - int val, boguscnt = 64*4; /* <64 usec. to complete, typ 27 ticks */ - outl(0x08000000 | (location<<16) | (phy_id<<21), ioaddr + SCBCtrlMDI); - do { - udelay(16); - - val = inl(ioaddr + SCBCtrlMDI); - - if (--boguscnt < 0) { - printf( " mdio_read() timed out with val = %X.\n", val); - break; - } - } while (! (val & 0x10000000)); - return val & 0xffff; -} - -/* The fixes for the code were kindly provided by Dragan Stancevic - to strictly follow Intel specifications of EEPROM - access timing. - The publicly available sheet 64486302 (sec. 3.1) specifies 1us access - interval for serial EEPROM. However, it looks like that there is an - additional requirement dictating larger udelay's in the code below. - 2000/05/24 SAW */ -static int do_eeprom_cmd(int cmd, int cmd_len) -{ - unsigned retval = 0; - long ee_addr = ioaddr + SCBeeprom; - - outw(EE_ENB, ee_addr); udelay(2); - outw(EE_ENB | EE_SHIFT_CLK, ee_addr); udelay(2); - - /* Shift the command bits out. */ - do { - short dataval = (cmd & (1 << cmd_len)) ? EE_WRITE_1 : EE_WRITE_0; - outw(dataval, ee_addr); udelay(2); - outw(dataval | EE_SHIFT_CLK, ee_addr); udelay(2); - retval = (retval << 1) | ((inw(ee_addr) & EE_DATA_READ) ? 1 : 0); - } while (--cmd_len >= 0); - outw(EE_ENB, ee_addr); udelay(2); - - /* Terminate the EEPROM access. */ - outw(EE_ENB & ~EE_CS, ee_addr); - return retval; -} - -#if 0 -static inline void whereami (const char *str) -{ - printf ("%s\n", str); - sleep (2); -} -#else -#define whereami(s) -#endif - -static void eepro100_irq(struct nic *nic __unused, irq_action_t action __unused) -{ - switch ( action ) { - case DISABLE : - break; - case ENABLE : - break; - case FORCE : - break; - } -} - -/* function: eepro100_transmit - * This transmits a packet. - * - * Arguments: char d[6]: destination ethernet address. - * unsigned short t: ethernet protocol type. - * unsigned short s: size of the data-part of the packet. - * char *p: the data for the packet. - * returns: void. - */ - -static void eepro100_transmit(struct nic *nic, const char *d, unsigned int t, unsigned int s, const char *p) -{ - struct eth_hdr { - unsigned char dst_addr[ETH_ALEN]; - unsigned char src_addr[ETH_ALEN]; - unsigned short type; - } hdr; - unsigned short status; - int s1, s2; - - status = inw(ioaddr + SCBStatus); - /* Acknowledge all of the current interrupt sources ASAP. */ - outw(status & 0xfc00, ioaddr + SCBStatus); - -#ifdef DEBUG - printf ("transmitting type %hX packet (%d bytes). status = %hX, cmd=%hX\n", - t, s, status, inw (ioaddr + SCBCmd)); -#endif - - memcpy (&hdr.dst_addr, d, ETH_ALEN); - memcpy (&hdr.src_addr, nic->node_addr, ETH_ALEN); - - hdr.type = htons (t); - - txfd.status = 0; - txfd.command = CmdSuspend | CmdTx | CmdTxFlex; - txfd.link = virt_to_bus (&txfd); - txfd.count = 0x02208000; - txfd.tx_desc_addr = virt_to_bus(&txfd.tx_buf_addr0); - - txfd.tx_buf_addr0 = virt_to_bus (&hdr); - txfd.tx_buf_size0 = sizeof (hdr); - - txfd.tx_buf_addr1 = virt_to_bus (p); - txfd.tx_buf_size1 = s; - -#ifdef DEBUG - printf ("txfd: \n"); - hd (&txfd, sizeof (txfd)); -#endif - - outl(virt_to_bus(&txfd), ioaddr + SCBPointer); - outw(INT_MASK | CU_START, ioaddr + SCBCmd); - wait_for_cmd_done(ioaddr + SCBCmd); - - s1 = inw (ioaddr + SCBStatus); - load_timer2(10*TICKS_PER_MS); /* timeout 10 ms for transmit */ - while (!txfd.status && timer2_running()) - /* Wait */; - s2 = inw (ioaddr + SCBStatus); - -#ifdef DEBUG - printf ("s1 = %hX, s2 = %hX.\n", s1, s2); -#endif -} - -/* - * Sometimes the receiver stops making progress. This routine knows how to - * get it going again, without losing packets or being otherwise nasty like - * a chip reset would be. Previously the driver had a whole sequence - * of if RxSuspended, if it's no buffers do one thing, if it's no resources, - * do another, etc. But those things don't really matter. Separate logic - * in the ISR provides for allocating buffers--the other half of operation - * is just making sure the receiver is active. speedo_rx_soft_reset does that. - * This problem with the old, more involved algorithm is shown up under - * ping floods on the order of 60K packets/second on a 100Mbps fdx network. - */ -static void -speedo_rx_soft_reset(void) -{ - wait_for_cmd_done(ioaddr + SCBCmd); - /* - * Put the hardware into a known state. - */ - outb(RX_ABORT, ioaddr + SCBCmd); - - ACCESS(rxfd)rx_buf_addr = 0xffffffff; - - wait_for_cmd_done(ioaddr + SCBCmd); - - outb(RX_START, ioaddr + SCBCmd); -} - -/* function: eepro100_poll / eth_poll - * This recieves a packet from the network. - * - * Arguments: none - * - * returns: 1 if a packet was recieved. - * 0 if no pacet was recieved. - * side effects: - * returns the packet in the array nic->packet. - * returns the length of the packet in nic->packetlen. - */ - -static int eepro100_poll(struct nic *nic, int retrieve) -{ - unsigned int status; - status = inw(ioaddr + SCBStatus); - - if (!ACCESS(rxfd)status) - return 0; - - /* There is a packet ready */ - if ( ! retrieve ) return 1; - - /* - * The chip may have suspended reception for various reasons. - * Check for that, and re-prime it should this be the case. - */ - switch ((status >> 2) & 0xf) { - case 0: /* Idle */ - break; - case 1: /* Suspended */ - case 2: /* No resources (RxFDs) */ - case 9: /* Suspended with no more RBDs */ - case 10: /* No resources due to no RBDs */ - case 12: /* Ready with no RBDs */ - speedo_rx_soft_reset(); - break; - case 3: case 5: case 6: case 7: case 8: - case 11: case 13: case 14: case 15: - /* these are all reserved values */ - break; - } - - /* Ok. We got a packet. Now restart the reciever.... */ - ACCESS(rxfd)status = 0; - ACCESS(rxfd)command = 0xc000; - outl(virt_to_bus(&(ACCESS(rxfd)status)), ioaddr + SCBPointer); - outw(INT_MASK | RX_START, ioaddr + SCBCmd); - wait_for_cmd_done(ioaddr + SCBCmd); - -#ifdef DEBUG - printf ("Got a packet: Len = %d.\n", ACCESS(rxfd)count & 0x3fff); -#endif - nic->packetlen = ACCESS(rxfd)count & 0x3fff; - memcpy (nic->packet, ACCESS(rxfd)packet, nic->packetlen); -#ifdef DEBUG - hd (nic->packet, 0x30); -#endif - return 1; -} - -/* function: eepro100_disable - * resets the card. This is used to allow Etherboot or Linux - * to probe the card again from a "virginal" state.... - * Arguments: none - * - * returns: void. - */ -static void eepro100_disable(struct dev *dev __unused) -{ -/* from eepro100_reset */ - outl(0, ioaddr + SCBPort); -/* from eepro100_disable */ - /* See if this PartialReset solves the problem with interfering with - kernel operation after Etherboot hands over. - Ken 20001102 */ - outl(2, ioaddr + SCBPort); - - /* The following is from the Intel e100 driver. - * This hopefully solves the problem with hanging hard DOS images. */ - - /* wait for the reset to take effect */ - udelay(20); - - /* Mask off our interrupt line -- it is unmasked after reset */ - { - u16 intr_status; - /* Disable interrupts on our PCI board by setting the mask bit */ - outw(INT_MASK, ioaddr + SCBCmd); - intr_status = inw(ioaddr + SCBStatus); - /* ack and clear intrs */ - outw(intr_status, ioaddr + SCBStatus); - inw(ioaddr + SCBStatus); - } -} - -/* exported function: eepro100_probe / eth_probe - * initializes a card - * - * side effects: - * leaves the ioaddress of the 82557 chip in the variable ioaddr. - * leaves the 82557 initialized, and ready to recieve packets. - */ - -static int eepro100_probe(struct dev *dev, struct pci_device *p) -{ - struct nic *nic = (struct nic *)dev; - unsigned short sum = 0; - int i; - int read_cmd, ee_size; - int options; - int rx_mode; - - /* we cache only the first few words of the EEPROM data - be careful not to access beyond this array */ - unsigned short eeprom[16]; - - if (p->ioaddr == 0) - return 0; - ioaddr = p->ioaddr & ~3; /* Mask the bit that says "this is an io addr" */ - nic->ioaddr = ioaddr; - - adjust_pci_device(p); - - /* Copy IRQ from PCI information */ - /* nic->irqno = pci->irq; */ - nic->irqno = 0; - - if ((do_eeprom_cmd(EE_READ_CMD << 24, 27) & 0xffe0000) - == 0xffe0000) { - ee_size = 0x100; - read_cmd = EE_READ_CMD << 24; - } else { - ee_size = 0x40; - read_cmd = EE_READ_CMD << 22; - } - - for (i = 0, sum = 0; i < ee_size; i++) { - unsigned short value = do_eeprom_cmd(read_cmd | (i << 16), 27); - if (i < (int)(sizeof(eeprom)/sizeof(eeprom[0]))) - eeprom[i] = value; - sum += value; - } - - for (i=0;inode_addr[i] = (eeprom[i/2] >> (8*(i&1))) & 0xff; - } - printf ("Ethernet addr: %!\n", nic->node_addr); - - if (sum != 0xBABA) - printf("eepro100: Invalid EEPROM checksum %#hX, " - "check settings before activating this device!\n", sum); - outl(0, ioaddr + SCBPort); - udelay (10000); - whereami ("Got eeprom."); - - /* Base = 0 */ - outl(0, ioaddr + SCBPointer); - outw(INT_MASK | RX_ADDR_LOAD, ioaddr + SCBCmd); - wait_for_cmd_done(ioaddr + SCBCmd); - whereami ("set rx base addr."); - - outl(virt_to_bus(&lstats), ioaddr + SCBPointer); - outw(INT_MASK | CU_STATSADDR, ioaddr + SCBCmd); - wait_for_cmd_done(ioaddr + SCBCmd); - whereami ("set stats addr."); - - /* INIT RX stuff. */ - ACCESS(rxfd)status = 0x0001; - ACCESS(rxfd)command = 0x0000; - ACCESS(rxfd)link = virt_to_bus(&(ACCESS(rxfd)status)); - ACCESS(rxfd)rx_buf_addr = virt_to_bus(&nic->packet); - ACCESS(rxfd)count = 0; - ACCESS(rxfd)size = 1528; - - outl(virt_to_bus(&(ACCESS(rxfd)status)), ioaddr + SCBPointer); - outw(INT_MASK | RX_START, ioaddr + SCBCmd); - wait_for_cmd_done(ioaddr + SCBCmd); - - whereami ("started RX process."); - - /* Start the reciever.... */ - ACCESS(rxfd)status = 0; - ACCESS(rxfd)command = 0xc000; - outl(virt_to_bus(&(ACCESS(rxfd)status)), ioaddr + SCBPointer); - outw(INT_MASK | RX_START, ioaddr + SCBCmd); - - /* INIT TX stuff. */ - - /* Base = 0 */ - outl(0, ioaddr + SCBPointer); - outw(INT_MASK | CU_CMD_BASE, ioaddr + SCBCmd); - wait_for_cmd_done(ioaddr + SCBCmd); - - whereami ("set TX base addr."); - - txfd.command = (CmdIASetup); - txfd.status = 0x0000; - txfd.link = virt_to_bus (&confcmd); - - { - char *t = (char *)&txfd.tx_desc_addr; - - for (i=0;inode_addr[i]; - } - -#ifdef DEBUG - printf ("Setup_eaddr:\n"); - hd (&txfd, 0x20); -#endif - /* options = 0x40; */ /* 10mbps half duplex... */ - options = 0x00; /* Autosense */ - -#ifdef PROMISC - rx_mode = 3; -#elif ALLMULTI - rx_mode = 1; -#else - rx_mode = 0; -#endif - - if ( ((eeprom[6]>>8) & 0x3f) == DP83840 - || ((eeprom[6]>>8) & 0x3f) == DP83840A) { - int mdi_reg23 = mdio_read(eeprom[6] & 0x1f, 23) | 0x0422; - if (congenb) - mdi_reg23 |= 0x0100; - printf(" DP83840 specific setup, setting register 23 to %hX.\n", - mdi_reg23); - mdio_write(eeprom[6] & 0x1f, 23, mdi_reg23); - } - whereami ("Done DP8340 special setup."); - if (options != 0) { - mdio_write(eeprom[6] & 0x1f, 0, - ((options & 0x20) ? 0x2000 : 0) | /* 100mbps? */ - ((options & 0x10) ? 0x0100 : 0)); /* Full duplex? */ - whereami ("set mdio_register."); - } - - confcmd.command = CmdSuspend | CmdConfigure; - confcmd.status = 0x0000; - confcmd.link = virt_to_bus (&txfd); - confcmd.data[1] = (txfifo << 4) | rxfifo; - confcmd.data[4] = rxdmacount; - confcmd.data[5] = txdmacount + 0x80; - confcmd.data[15] = (rx_mode & 2) ? 0x49: 0x48; - confcmd.data[19] = (options & 0x10) ? 0xC0 : 0x80; - confcmd.data[21] = (rx_mode & 1) ? 0x0D: 0x05; - - outl(virt_to_bus(&txfd), ioaddr + SCBPointer); - outw(INT_MASK | CU_START, ioaddr + SCBCmd); - wait_for_cmd_done(ioaddr + SCBCmd); - - whereami ("started TX thingy (config, iasetup)."); - - load_timer2(10*TICKS_PER_MS); - while (!txfd.status && timer2_running()) - /* Wait */; - - /* Read the status register once to disgard stale data */ - mdio_read(eeprom[6] & 0x1f, 1); - /* Check to see if the network cable is plugged in. - * This allows for faster failure if there is nothing - * we can do. - */ - if (!(mdio_read(eeprom[6] & 0x1f, 1) & (1 << 2))) { - printf("Valid link not established\n"); - eepro100_disable(dev); - return 0; - } - - dev->disable = eepro100_disable; - nic->poll = eepro100_poll; - nic->transmit = eepro100_transmit; - nic->irq = eepro100_irq; - return 1; -} - -/*********************************************************************/ - -#ifdef DEBUG - -/* Hexdump a number of bytes from memory... */ -void hd (void *where, int n) -{ - int i; - - while (n > 0) { - printf ("%X ", where); - for (i=0;i < ( (n>16)?16:n);i++) - printf (" %hhX", ((char *)where)[i]); - printf ("\n"); - n -= 16; - where += 16; - } -} -#endif - -static struct pci_id eepro100_nics[] = { -PCI_ROM(0x8086, 0x1029, "id1029", "Intel EtherExpressPro100 ID1029"), -PCI_ROM(0x8086, 0x1030, "id1030", "Intel EtherExpressPro100 ID1030"), -PCI_ROM(0x8086, 0x1031, "82801cam", "Intel 82801CAM (ICH3) Chipset Ethernet Controller"), -PCI_ROM(0x8086, 0x1032, "eepro100-1032", "Intel PRO/100 VE Network Connection"), -PCI_ROM(0x8086, 0x1033, "eepro100-1033", "Intel PRO/100 VM Network Connection"), -PCI_ROM(0x8086, 0x1034, "eepro100-1034", "Intel PRO/100 VM Network Connection"), -PCI_ROM(0x8086, 0x1035, "eepro100-1035", "Intel 82801CAM (ICH3) Chipset Ethernet Controller"), -PCI_ROM(0x8086, 0x1036, "eepro100-1036", "Intel 82801CAM (ICH3) Chipset Ethernet Controller"), -PCI_ROM(0x8086, 0x1037, "eepro100-1037", "Intel 82801CAM (ICH3) Chipset Ethernet Controller"), -PCI_ROM(0x8086, 0x1038, "id1038", "Intel PRO/100 VM Network Connection"), -PCI_ROM(0x8086, 0x1039, "82562et", "Intel PRO100 VE 82562ET"), -PCI_ROM(0x8086, 0x103a, "id103a", "Intel Corporation 82559 InBusiness 10/100"), -PCI_ROM(0x8086, 0x103b, "82562etb", "Intel PRO100 VE 82562ETB"), -PCI_ROM(0x8086, 0x103c, "eepro100-103c", "Intel PRO/100 VM Network Connection"), -PCI_ROM(0x8086, 0x103d, "eepro100-103d", "Intel PRO/100 VE Network Connection"), -PCI_ROM(0x8086, 0x103e, "eepro100-103e", "Intel PRO/100 VM Network Connection"), -PCI_ROM(0x8086, 0x1059, "82551qm", "Intel PRO/100 M Mobile Connection"), -PCI_ROM(0x8086, 0x1209, "82559er", "Intel EtherExpressPro100 82559ER"), -PCI_ROM(0x8086, 0x1227, "82865", "Intel 82865 EtherExpress PRO/100A"), -PCI_ROM(0x8086, 0x1228, "82556", "Intel 82556 EtherExpress PRO/100 Smart"), -PCI_ROM(0x8086, 0x1229, "eepro100", "Intel EtherExpressPro100"), -PCI_ROM(0x8086, 0x2449, "82562em", "Intel EtherExpressPro100 82562EM"), -PCI_ROM(0x8086, 0x2459, "82562-1", "Intel 82562 based Fast Ethernet Connection"), -PCI_ROM(0x8086, 0x245d, "82562-2", "Intel 82562 based Fast Ethernet Connection"), -PCI_ROM(0x8086, 0x1050, "82562ez", "Intel 82562EZ Network Connection"), -PCI_ROM(0x8086, 0x5200, "eepro100-5200", "Intel EtherExpress PRO/100 Intelligent Server"), -PCI_ROM(0x8086, 0x5201, "eepro100-5201", "Intel EtherExpress PRO/100 Intelligent Server"), -}; - -/* Cards with device ids 0x1030 to 0x103F, 0x2449, 0x2459 or 0x245D might need - * a workaround for hardware bug on 10 mbit half duplex (see linux driver eepro100.c) - * 2003/03/17 gbaum */ - - -struct pci_driver eepro100_driver = { - .type = NIC_DRIVER, - .name = "EEPRO100", - .probe = eepro100_probe, - .ids = eepro100_nics, - .id_count = sizeof(eepro100_nics)/sizeof(eepro100_nics[0]), - .class = 0 -}; diff --git a/usr/src/grub/grub-0.95/netboot/elf.h b/usr/src/grub/grub-0.95/netboot/elf.h deleted file mode 100644 index 2eb08de151..0000000000 --- a/usr/src/grub/grub-0.95/netboot/elf.h +++ /dev/null @@ -1,234 +0,0 @@ -#ifndef ELF_H -#define ELF_H - -#define EI_NIDENT 16 /* Size of e_ident array. */ - -/* Values for 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 */ - -/* Values for e_machine (architecute). */ -#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 /* Perhaps disused */ -#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_RCE 39 /* Motorola RCE */ -#define EM_ARM 40 /* ARM */ -#define EM_FAKE_ALPHA 41 /* Digital Alpha */ -#define EM_SH 42 /* Hitachi 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 /* Hitachi H8/300 */ -#define EM_H8_300H 47 /* Hitachi H8/300H */ -#define EM_H8S 48 /* Hitachi H8S */ -#define EM_H8_500 49 /* Hitachi 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_AT19 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 /* Mitsubishi 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_NUM 95 - -/* Values for p_type. */ -#define PT_NULL 0 /* Unused entry. */ -#define PT_LOAD 1 /* Loadable segment. */ -#define PT_DYNAMIC 2 /* Dynamic linking information segment. */ -#define PT_INTERP 3 /* Pathname of interpreter. */ -#define PT_NOTE 4 /* Auxiliary information. */ -#define PT_SHLIB 5 /* Reserved (not used). */ -#define PT_PHDR 6 /* Location of program header itself. */ - -/* Values for p_flags. */ -#define PF_X 0x1 /* Executable. */ -#define PF_W 0x2 /* Writable. */ -#define PF_R 0x4 /* Readable. */ - - -#define ELF_PROGRAM_RETURNS_BIT 0x8000000 /* e_flags bit 31 */ - -#define EI_MAG0 0 -#define ELFMAG0 0x7f - -#define EI_MAG1 1 -#define ELFMAG1 'E' - -#define EI_MAG2 2 -#define ELFMAG2 'L' - -#define EI_MAG3 3 -#define ELFMAG3 'F' - -#define ELFMAG "\177ELF" - -#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 EI_DATA 5 /* Data encodeing 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 EI_VERSION 6 /* File version byte index */ - /* Value must be EV_CURRENT */ - -#define EV_NONE 0 /* Invalid ELF Version */ -#define EV_CURRENT 1 /* Current version */ - -#define ELF32_PHDR_SIZE (8*4) /* Size of an elf program header */ - -#ifndef ASSEMBLY -/* - * ELF definitions common to all 32-bit architectures. - */ - -typedef uint32_t Elf32_Addr; -typedef uint16_t Elf32_Half; -typedef uint32_t Elf32_Off; -typedef int32_t Elf32_Sword; -typedef uint32_t Elf32_Word; -typedef uint32_t Elf32_Size; - -typedef uint64_t Elf64_Addr; -typedef uint16_t Elf64_Half; -typedef uint64_t Elf64_Off; -typedef int32_t Elf64_Sword; -typedef uint32_t Elf64_Word; -typedef uint64_t Elf64_Size; - -/* - * ELF header. - */ -typedef struct { - unsigned char e_ident[EI_NIDENT]; /* File identification. */ - Elf32_Half e_type; /* File type. */ - Elf32_Half e_machine; /* Machine architecture. */ - Elf32_Word e_version; /* ELF format version. */ - Elf32_Addr e_entry; /* Entry point. */ - Elf32_Off e_phoff; /* Program header file offset. */ - Elf32_Off e_shoff; /* Section header file offset. */ - Elf32_Word e_flags; /* Architecture-specific flags. */ - Elf32_Half e_ehsize; /* Size of ELF header in bytes. */ - Elf32_Half e_phentsize; /* Size of program header entry. */ - Elf32_Half e_phnum; /* Number of program header entries. */ - Elf32_Half e_shentsize; /* Size of section header entry. */ - Elf32_Half e_shnum; /* Number of section header entries. */ - Elf32_Half e_shstrndx; /* Section name strings section. */ -} Elf32_Ehdr; - -typedef struct { - unsigned char e_ident[EI_NIDENT]; /* File identification. */ - Elf64_Half e_type; /* File type. */ - Elf64_Half e_machine; /* Machine architecture. */ - Elf64_Word e_version; /* ELF format version. */ - Elf64_Addr e_entry; /* Entry point. */ - Elf64_Off e_phoff; /* Program header file offset. */ - Elf64_Off e_shoff; /* Section header file offset. */ - Elf64_Word e_flags; /* Architecture-specific flags. */ - Elf64_Half e_ehsize; /* Size of ELF header in bytes. */ - Elf64_Half e_phentsize; /* Size of program header entry. */ - Elf64_Half e_phnum; /* Number of program header entries. */ - Elf64_Half e_shentsize; /* Size of section header entry. */ - Elf64_Half e_shnum; /* Number of section header entries. */ - Elf64_Half e_shstrndx; /* Section name strings section. */ -} Elf64_Ehdr; - -/* - * Program header. - */ -typedef struct { - Elf32_Word p_type; /* Entry type. */ - Elf32_Off p_offset; /* File offset of contents. */ - Elf32_Addr p_vaddr; /* Virtual address (not used). */ - Elf32_Addr p_paddr; /* Physical address. */ - Elf32_Size p_filesz; /* Size of contents in file. */ - Elf32_Size p_memsz; /* Size of contents in memory. */ - Elf32_Word p_flags; /* Access permission flags. */ - Elf32_Size p_align; /* Alignment in memory and file. */ -} Elf32_Phdr; - -typedef struct { - Elf64_Word p_type; /* Entry type. */ - Elf64_Word p_flags; /* Access permission flags. */ - Elf64_Off p_offset; /* File offset of contents. */ - Elf64_Addr p_vaddr; /* Virtual address (not used). */ - Elf64_Addr p_paddr; /* Physical address. */ - Elf64_Size p_filesz; /* Size of contents in file. */ - Elf64_Size p_memsz; /* Size of contents in memory. */ - Elf64_Size p_align; /* Alignment in memory and file. */ -} Elf64_Phdr; - -/* Standardized Elf image notes for booting... The name for all of these is ELFBoot */ - - -/* ELF Defines for the current architecture */ -#include "i386_elf.h" - -#endif /* ASSEMBLY */ - -//#include "elf_boot.h" - -#endif /* ELF_H */ diff --git a/usr/src/grub/grub-0.95/netboot/endian.h b/usr/src/grub/grub-0.95/netboot/endian.h deleted file mode 100644 index f8381be251..0000000000 --- a/usr/src/grub/grub-0.95/netboot/endian.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef ETHERBOOT_ENDIAN_H -#define ETHERBOOT_ENDIAN_H - -/* 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 - -#include "i386_endian.h" - - -#endif /* ETHERBOOT_ENDIAN_H */ diff --git a/usr/src/grub/grub-0.95/netboot/epic100.c b/usr/src/grub/grub-0.95/netboot/epic100.c deleted file mode 100644 index 9015c612ba..0000000000 --- a/usr/src/grub/grub-0.95/netboot/epic100.c +++ /dev/null @@ -1,520 +0,0 @@ - -/* epic100.c: A SMC 83c170 EPIC/100 fast ethernet driver for Etherboot */ - -/* 05/06/2003 timlegge Fixed relocation and implemented Multicast */ -#define LINUX_OUT_MACROS - -#include "etherboot.h" -#include "pci.h" -#include "nic.h" -#include "timer.h" -#include "epic100.h" - -/* Condensed operations for readability */ -#define virt_to_le32desc(addr) cpu_to_le32(virt_to_bus(addr)) -#define le32desc_to_virt(addr) bus_to_virt(le32_to_cpu(addr)) - -#define TX_RING_SIZE 2 /* use at least 2 buffers for TX */ -#define RX_RING_SIZE 2 - -#define PKT_BUF_SZ 1536 /* Size of each temporary Tx/Rx buffer.*/ - -/* -#define DEBUG_RX -#define DEBUG_TX -#define DEBUG_EEPROM -*/ - -#define EPIC_DEBUG 0 /* debug level */ - -/* The EPIC100 Rx and Tx buffer descriptors. */ -struct epic_rx_desc { - unsigned long status; - unsigned long bufaddr; - unsigned long buflength; - unsigned long next; -}; -/* description of the tx descriptors control bits commonly used */ -#define TD_STDFLAGS TD_LASTDESC - -struct epic_tx_desc { - unsigned long status; - unsigned long bufaddr; - unsigned long buflength; - unsigned long next; -}; - -#define delay(nanosec) do { int _i = 3; while (--_i > 0) \ - { __SLOW_DOWN_IO; }} while (0) - -static void epic100_open(void); -static void epic100_init_ring(void); -static void epic100_disable(struct dev *dev); -static int epic100_poll(struct nic *nic, int retrieve); -static void epic100_transmit(struct nic *nic, const char *destaddr, - unsigned int type, unsigned int len, const char *data); -#ifdef DEBUG_EEPROM -static int read_eeprom(int location); -#endif -static int mii_read(int phy_id, int location); -static void epic100_irq(struct nic *nic, irq_action_t action); - -static int ioaddr; - -static int command; -static int intstat; -static int intmask; -static int genctl ; -static int eectl ; -static int test ; -static int mmctl ; -static int mmdata ; -static int lan0 ; -static int mc0 ; -static int rxcon ; -static int txcon ; -static int prcdar ; -static int ptcdar ; -static int eththr ; - -static unsigned int cur_rx, cur_tx; /* The next free ring entry */ -#ifdef DEBUG_EEPROM -static unsigned short eeprom[64]; -#endif -static signed char phys[4]; /* MII device addresses. */ -static struct epic_rx_desc rx_ring[RX_RING_SIZE] - __attribute__ ((aligned(4))); -static struct epic_tx_desc tx_ring[TX_RING_SIZE] - __attribute__ ((aligned(4))); -static unsigned char rx_packet[PKT_BUF_SZ * RX_RING_SIZE]; -static unsigned char tx_packet[PKT_BUF_SZ * TX_RING_SIZE]; - -/***********************************************************************/ -/* Externally visible functions */ -/***********************************************************************/ - - - static int -epic100_probe(struct dev *dev, struct pci_device *pci) -{ - struct nic *nic = (struct nic *)dev; - int i; - unsigned short* ap; - unsigned int phy, phy_idx; - - if (pci->ioaddr == 0) - return 0; - - /* Ideally we would detect all network cards in slot order. That would - be best done a central PCI probe dispatch, which wouldn't work - well with the current structure. So instead we detect just the - Epic cards in slot order. */ - - ioaddr = pci->ioaddr; - nic->irqno = 0; - nic->ioaddr = pci->ioaddr & ~3; - - /* compute all used static epic100 registers address */ - command = ioaddr + COMMAND; /* Control Register */ - intstat = ioaddr + INTSTAT; /* Interrupt Status */ - intmask = ioaddr + INTMASK; /* Interrupt Mask */ - genctl = ioaddr + GENCTL; /* General Control */ - eectl = ioaddr + EECTL; /* EEPROM Control */ - test = ioaddr + TEST; /* Test register (clocks) */ - mmctl = ioaddr + MMCTL; /* MII Management Interface Control */ - mmdata = ioaddr + MMDATA; /* MII Management Interface Data */ - lan0 = ioaddr + LAN0; /* MAC address. (0x40-0x48) */ - mc0 = ioaddr + MC0; /* Multicast Control */ - rxcon = ioaddr + RXCON; /* Receive Control */ - txcon = ioaddr + TXCON; /* Transmit Control */ - prcdar = ioaddr + PRCDAR; /* PCI Receive Current Descr Address */ - ptcdar = ioaddr + PTCDAR; /* PCI Transmit Current Descr Address */ - eththr = ioaddr + ETHTHR; /* Early Transmit Threshold */ - - /* Reset the chip & bring it out of low-power mode. */ - outl(GC_SOFT_RESET, genctl); - - /* Disable ALL interrupts by setting the interrupt mask. */ - outl(INTR_DISABLE, intmask); - - /* - * set the internal clocks: - * Application Note 7.15 says: - * In order to set the CLOCK TEST bit in the TEST register, - * perform the following: - * - * Write 0x0008 to the test register at least sixteen - * consecutive times. - * - * The CLOCK TEST bit is Write-Only. Writing it several times - * consecutively insures a successful write to the bit... - */ - - for (i = 0; i < 16; i++) { - outl(0x00000008, test); - } - -#ifdef DEBUG_EEPROM -{ - unsigned short sum = 0; - unsigned short value; - for (i = 0; i < 64; i++) { - value = read_eeprom(i); - eeprom[i] = value; - sum += value; - } -} - -#if (EPIC_DEBUG > 1) - printf("EEPROM contents\n"); - for (i = 0; i < 64; i++) { - printf(" %hhX%s", eeprom[i], i % 16 == 15 ? "\n" : ""); - } -#endif -#endif - - /* This could also be read from the EEPROM. */ - ap = (unsigned short*)nic->node_addr; - for (i = 0; i < 3; i++) - *ap++ = inw(lan0 + i*4); - - printf(" I/O %#hX %! ", ioaddr, nic->node_addr); - - /* Find the connected MII xcvrs. */ - for (phy = 0, phy_idx = 0; phy < 32 && phy_idx < sizeof(phys); phy++) { - int mii_status = mii_read(phy, 0); - - if (mii_status != 0xffff && mii_status != 0x0000) { - phys[phy_idx++] = phy; -#if (EPIC_DEBUG > 1) - printf("MII transceiver found at address %d.\n", phy); -#endif - } - } - if (phy_idx == 0) { -#if (EPIC_DEBUG > 1) - printf("***WARNING***: No MII transceiver found!\n"); -#endif - /* Use the known PHY address of the EPII. */ - phys[0] = 3; - } - - epic100_open(); - - dev->disable = epic100_disable; - nic->poll = epic100_poll; - nic->transmit = epic100_transmit; - nic->irq = epic100_irq; - - return 1; -} - -static void set_rx_mode(void) -{ - unsigned char mc_filter[8]; - int i; - memset(mc_filter, 0xff, sizeof(mc_filter)); - outl(0x0C, rxcon); - for(i = 0; i < 4; i++) - outw(((unsigned short *)mc_filter)[i], mc0 + i*4); - return; -} - - static void -epic100_open(void) -{ - int mii_reg5; - int full_duplex = 0; - unsigned long tmp; - - epic100_init_ring(); - - /* Pull the chip out of low-power mode, and set for PCI read multiple. */ - outl(GC_RX_FIFO_THR_64 | GC_MRC_READ_MULT | GC_ONE_COPY, genctl); - - outl(TX_FIFO_THRESH, eththr); - - tmp = TC_EARLY_TX_ENABLE | TX_SLOT_TIME; - - mii_reg5 = mii_read(phys[0], 5); - if (mii_reg5 != 0xffff && (mii_reg5 & 0x0100)) { - full_duplex = 1; - printf(" full-duplex mode"); - tmp |= TC_LM_FULL_DPX; - } else - tmp |= TC_LM_NORMAL; - - outl(tmp, txcon); - - /* Give adress of RX and TX ring to the chip */ - outl(virt_to_le32desc(&rx_ring), prcdar); - outl(virt_to_le32desc(&tx_ring), ptcdar); - - /* Start the chip's Rx process: receive unicast and broadcast */ - set_rx_mode(); - outl(CR_START_RX | CR_QUEUE_RX, command); - - putchar('\n'); -} - -/* Initialize the Rx and Tx rings. */ - static void -epic100_init_ring(void) -{ - int i; - - cur_rx = cur_tx = 0; - - for (i = 0; i < RX_RING_SIZE; i++) { - rx_ring[i].status = cpu_to_le32(RRING_OWN); /* Owned by Epic chip */ - rx_ring[i].buflength = cpu_to_le32(PKT_BUF_SZ); - rx_ring[i].bufaddr = virt_to_bus(&rx_packet[i * PKT_BUF_SZ]); - rx_ring[i].next = virt_to_le32desc(&rx_ring[i + 1]) ; - } - /* Mark the last entry as wrapping the ring. */ - rx_ring[i-1].next = virt_to_le32desc(&rx_ring[0]); - - /* - *The Tx buffer descriptor is filled in as needed, - * but we do need to clear the ownership bit. - */ - - for (i = 0; i < TX_RING_SIZE; i++) { - tx_ring[i].status = 0x0000; /* Owned by CPU */ - tx_ring[i].buflength = 0x0000 | cpu_to_le32(TD_STDFLAGS << 16); - tx_ring[i].bufaddr = virt_to_bus(&tx_packet[i * PKT_BUF_SZ]); - tx_ring[i].next = virt_to_le32desc(&tx_ring[i + 1]); - } - tx_ring[i-1].next = virt_to_le32desc(&tx_ring[0]); -} - -/* function: epic100_transmit - * This transmits a packet. - * - * Arguments: char d[6]: destination ethernet address. - * unsigned short t: ethernet protocol type. - * unsigned short s: size of the data-part of the packet. - * char *p: the data for the packet. - * returns: void. - */ - static void -epic100_transmit(struct nic *nic, const char *destaddr, unsigned int type, - unsigned int len, const char *data) -{ - unsigned short nstype; - unsigned char *txp; - int entry; - - /* Calculate the next Tx descriptor entry. */ - entry = cur_tx % TX_RING_SIZE; - - if ((tx_ring[entry].status & TRING_OWN) == TRING_OWN) { - printf("eth_transmit: Unable to transmit. status=%hX. Resetting...\n", - tx_ring[entry].status); - - epic100_open(); - return; - } - - txp = tx_packet + (entry * PKT_BUF_SZ); - - memcpy(txp, destaddr, ETH_ALEN); - memcpy(txp + ETH_ALEN, nic->node_addr, ETH_ALEN); - nstype = htons(type); - memcpy(txp + 12, (char*)&nstype, 2); - memcpy(txp + ETH_HLEN, data, len); - - len += ETH_HLEN; - len &= 0x0FFF; - while(len < ETH_ZLEN) - txp[len++] = '\0'; - /* - * Caution: the write order is important here, - * set the base address with the "ownership" - * bits last. - */ - - tx_ring[entry].buflength |= cpu_to_le32(len); - tx_ring[entry].status = cpu_to_le32(len << 16) | - cpu_to_le32(TRING_OWN); /* Pass ownership to the chip. */ - - cur_tx++; - - /* Trigger an immediate transmit demand. */ - outl(CR_QUEUE_TX, command); - - load_timer2(10*TICKS_PER_MS); /* timeout 10 ms for transmit */ - while ((le32_to_cpu(tx_ring[entry].status) & (TRING_OWN)) && timer2_running()) - /* Wait */; - - if ((le32_to_cpu(tx_ring[entry].status) & TRING_OWN) != 0) - printf("Oops, transmitter timeout, status=%hX\n", - tx_ring[entry].status); -} - -/* function: epic100_poll / eth_poll - * This receives a packet from the network. - * - * Arguments: none - * - * returns: 1 if a packet was received. - * 0 if no pacet was received. - * side effects: - * returns the packet in the array nic->packet. - * returns the length of the packet in nic->packetlen. - */ - - static int -epic100_poll(struct nic *nic, int retrieve) -{ - int entry; - int retcode; - int status; - entry = cur_rx % RX_RING_SIZE; - - if ((rx_ring[entry].status & cpu_to_le32(RRING_OWN)) == RRING_OWN) - return (0); - - if ( ! retrieve ) return 1; - - status = le32_to_cpu(rx_ring[entry].status); - /* We own the next entry, it's a new packet. Send it up. */ - -#if (EPIC_DEBUG > 4) - printf("epic_poll: entry %d status %hX\n", entry, status); -#endif - - cur_rx++; - if (status & 0x2000) { - printf("epic_poll: Giant packet\n"); - retcode = 0; - } else if (status & 0x0006) { - /* Rx Frame errors are counted in hardware. */ - printf("epic_poll: Frame received with errors\n"); - retcode = 0; - } else { - /* Omit the four octet CRC from the length. */ - nic->packetlen = le32_to_cpu((rx_ring[entry].buflength))- 4; - memcpy(nic->packet, &rx_packet[entry * PKT_BUF_SZ], nic->packetlen); - retcode = 1; - } - - /* Clear all error sources. */ - outl(status & INTR_CLEARERRS, intstat); - - /* Give the descriptor back to the chip */ - rx_ring[entry].status = RRING_OWN; - - /* Restart Receiver */ - outl(CR_START_RX | CR_QUEUE_RX, command); - - return retcode; -} - - - static void -epic100_disable(struct dev *dev __unused) -{ - /* Soft reset the chip. */ - outl(GC_SOFT_RESET, genctl); -} - -static void epic100_irq(struct nic *nic __unused, irq_action_t action __unused) -{ - switch ( action ) { - case DISABLE : - break; - case ENABLE : - break; - case FORCE : - break; - } -} - -#ifdef DEBUG_EEPROM -/* Serial EEPROM section. */ - -/* EEPROM_Ctrl bits. */ -#define EE_SHIFT_CLK 0x04 /* EEPROM shift clock. */ -#define EE_CS 0x02 /* EEPROM chip select. */ -#define EE_DATA_WRITE 0x08 /* EEPROM chip data in. */ -#define EE_WRITE_0 0x01 -#define EE_WRITE_1 0x09 -#define EE_DATA_READ 0x10 /* EEPROM chip data out. */ -#define EE_ENB (0x0001 | EE_CS) - -/* The EEPROM commands include the alway-set leading bit. */ -#define EE_WRITE_CMD (5 << 6) -#define EE_READ_CMD (6 << 6) -#define EE_ERASE_CMD (7 << 6) - -#define eeprom_delay(n) delay(n) - - static int -read_eeprom(int location) -{ - int i; - int retval = 0; - int read_cmd = location | EE_READ_CMD; - - outl(EE_ENB & ~EE_CS, eectl); - outl(EE_ENB, eectl); - - /* Shift the read command bits out. */ - for (i = 10; i >= 0; i--) { - short dataval = (read_cmd & (1 << i)) ? EE_DATA_WRITE : 0; - outl(EE_ENB | dataval, eectl); - eeprom_delay(100); - outl(EE_ENB | dataval | EE_SHIFT_CLK, eectl); - eeprom_delay(150); - outl(EE_ENB | dataval, eectl); /* Finish EEPROM a clock tick. */ - eeprom_delay(250); - } - outl(EE_ENB, eectl); - - for (i = 16; i > 0; i--) { - outl(EE_ENB | EE_SHIFT_CLK, eectl); - eeprom_delay(100); - retval = (retval << 1) | ((inl(eectl) & EE_DATA_READ) ? 1 : 0); - outl(EE_ENB, eectl); - eeprom_delay(100); - } - - /* Terminate the EEPROM access. */ - outl(EE_ENB & ~EE_CS, eectl); - return retval; -} -#endif - - -#define MII_READOP 1 -#define MII_WRITEOP 2 - - static int -mii_read(int phy_id, int location) -{ - int i; - - outl((phy_id << 9) | (location << 4) | MII_READOP, mmctl); - /* Typical operation takes < 50 ticks. */ - - for (i = 4000; i > 0; i--) - if ((inl(mmctl) & MII_READOP) == 0) - break; - return inw(mmdata); -} - - -static struct pci_id epic100_nics[] = { -PCI_ROM(0x10b8, 0x0005, "epic100", "SMC EtherPowerII"), /* SMC 83c170 EPIC/100 */ -PCI_ROM(0x10b8, 0x0006, "smc-83c175", "SMC EPIC/C 83c175"), -}; - -struct pci_driver epic100_driver = { - .type = NIC_DRIVER, - .name = "EPIC100", - .probe = epic100_probe, - .ids = epic100_nics, - .id_count = sizeof(epic100_nics)/sizeof(epic100_nics[0]), - .class = 0, -}; diff --git a/usr/src/grub/grub-0.95/netboot/epic100.h b/usr/src/grub/grub-0.95/netboot/epic100.h deleted file mode 100644 index 61bd1d94b3..0000000000 --- a/usr/src/grub/grub-0.95/netboot/epic100.h +++ /dev/null @@ -1,188 +0,0 @@ -#ifndef _EPIC100_H_ -# define _EPIC100_H_ - -#ifndef PCI_VENDOR_SMC -# define PCI_VENDOR_SMC 0x10B8 -#endif - -#ifndef PCI_DEVICE_SMC_EPIC100 -# define PCI_DEVICE_SMC_EPIC100 0x0005 -#endif - -#define PCI_DEVICE_ID_NONE 0xFFFF - -/* Offsets to registers (using SMC names). */ -enum epic100_registers { - COMMAND= 0, /* Control Register */ - INTSTAT= 4, /* Interrupt Status */ - INTMASK= 8, /* Interrupt Mask */ - GENCTL = 0x0C, /* General Control */ - NVCTL = 0x10, /* Non Volatile Control */ - EECTL = 0x14, /* EEPROM Control */ - TEST = 0x1C, /* Test register: marked as reserved (see in source code) */ - CRCCNT = 0x20, /* CRC Error Counter */ - ALICNT = 0x24, /* Frame Alignment Error Counter */ - MPCNT = 0x28, /* Missed Packet Counter */ - MMCTL = 0x30, /* MII Management Interface Control */ - MMDATA = 0x34, /* MII Management Interface Data */ - MIICFG = 0x38, /* MII Configuration */ - IPG = 0x3C, /* InterPacket Gap */ - LAN0 = 0x40, /* MAC address. (0x40-0x48) */ - IDCHK = 0x4C, /* BoardID/ Checksum */ - MC0 = 0x50, /* Multicast filter table. (0x50-0x5c) */ - RXCON = 0x60, /* Receive Control */ - TXCON = 0x70, /* Transmit Control */ - TXSTAT = 0x74, /* Transmit Status */ - PRCDAR = 0x84, /* PCI Receive Current Descriptor Address */ - PRSTAT = 0xA4, /* PCI Receive DMA Status */ - PRCPTHR= 0xB0, /* PCI Receive Copy Threshold */ - PTCDAR = 0xC4, /* PCI Transmit Current Descriptor Address */ - ETHTHR = 0xDC /* Early Transmit Threshold */ -}; - -/* Command register (CR_) bits */ -#define CR_STOP_RX (0x00000001) -#define CR_START_RX (0x00000002) -#define CR_QUEUE_TX (0x00000004) -#define CR_QUEUE_RX (0x00000008) -#define CR_NEXTFRAME (0x00000010) -#define CR_STOP_TX_DMA (0x00000020) -#define CR_STOP_RX_DMA (0x00000040) -#define CR_TX_UGO (0x00000080) - -/* Interrupt register bits. NI means No Interrupt generated */ - -#define INTR_RX_THR_STA (0x00400000) /* rx copy threshold status NI */ -#define INTR_RX_BUFF_EMPTY (0x00200000) /* rx buffers empty. NI */ -#define INTR_TX_IN_PROG (0x00100000) /* tx copy in progess. NI */ -#define INTR_RX_IN_PROG (0x00080000) /* rx copy in progress. NI */ -#define INTR_TXIDLE (0x00040000) /* tx idle. NI */ -#define INTR_RXIDLE (0x00020000) /* rx idle. NI */ -#define INTR_INTR_ACTIVE (0x00010000) /* Interrupt active. NI */ -#define INTR_RX_STATUS_OK (0x00008000) /* rx status valid. NI */ -#define INTR_PCI_TGT_ABT (0x00004000) /* PCI Target abort */ -#define INTR_PCI_MASTER_ABT (0x00002000) /* PCI Master abort */ -#define INTR_PCI_PARITY_ERR (0x00001000) /* PCI adress parity error */ -#define INTR_PCI_DATA_ERR (0x00000800) /* PCI data parity error */ -#define INTR_RX_THR_CROSSED (0x00000400) /* rx copy threshold crossed */ -#define INTR_CNTFULL (0x00000200) /* Counter overflow */ -#define INTR_TXUNDERRUN (0x00000100) /* tx underrun. */ -#define INTR_TXEMPTY (0x00000080) /* tx queue empty */ -#define INTR_TX_CH_COMPLETE (0x00000040) /* tx chain complete */ -#define INTR_TXDONE (0x00000020) /* tx complete (w or w/o err) */ -#define INTR_RXERROR (0x00000010) /* rx error (CRC) */ -#define INTR_RXOVERFLOW (0x00000008) /* rx buffer overflow */ -#define INTR_RX_QUEUE_EMPTY (0x00000004) /* rx queue empty. */ -#define INTR_RXHEADER (0x00000002) /* header copy complete */ -#define INTR_RXDONE (0x00000001) /* Receive copy complete */ - -#define INTR_CLEARINTR (0x00007FFF) -#define INTR_VALIDBITS (0x007FFFFF) -#define INTR_DISABLE (0x00000000) -#define INTR_CLEARERRS (0x00007F18) -#define INTR_ABNINTR (INTR_CNTFULL | INTR_TXUNDERRUN | INTR_RXOVERFLOW) - -/* General Control (GC_) bits */ - -#define GC_SOFT_RESET (0x00000001) -#define GC_INTR_ENABLE (0x00000002) -#define GC_SOFT_INTR (0x00000004) -#define GC_POWER_DOWN (0x00000008) -#define GC_ONE_COPY (0x00000010) -#define GC_BIG_ENDIAN (0x00000020) -#define GC_RX_PREEMPT_TX (0x00000040) -#define GC_TX_PREEMPT_RX (0x00000080) - -/* - * Receive FIFO Threshold values - * Control the level at which the PCI burst state machine - * begins to empty the receive FIFO. Possible values: 0-3 - * - * 0 => 32, 1 => 64, 2 => 96 3 => 128 bytes. - */ -#define GC_RX_FIFO_THR_32 (0x00000000) -#define GC_RX_FIFO_THR_64 (0x00000100) -#define GC_RX_FIFO_THR_96 (0x00000200) -#define GC_RX_FIFO_THR_128 (0x00000300) - -/* Memory Read Control (MRC_) values */ -#define GC_MRC_MEM_READ (0x00000000) -#define GC_MRC_READ_MULT (0x00000400) -#define GC_MRC_READ_LINE (0x00000800) - -#define GC_SOFTBIT0 (0x00001000) -#define GC_SOFTBIT1 (0x00002000) -#define GC_RESET_PHY (0x00004000) - -/* Definitions of the Receive Control (RC_) register bits */ - -#define RC_SAVE_ERRORED_PKT (0x00000001) -#define RC_SAVE_RUNT_FRAMES (0x00000002) -#define RC_RCV_BROADCAST (0x00000004) -#define RC_RCV_MULTICAST (0x00000008) -#define RC_RCV_INVERSE_PKT (0x00000010) -#define RC_PROMISCUOUS_MODE (0x00000020) -#define RC_MONITOR_MODE (0x00000040) -#define RC_EARLY_RCV_ENABLE (0x00000080) - -/* description of the rx descriptors control bits */ -#define RD_FRAGLIST (0x0001) /* Desc points to a fragment list */ -#define RD_LLFORM (0x0002) /* Frag list format */ -#define RD_HDR_CPY (0x0004) /* Desc used for header copy */ - -/* Definition of the Transmit CONTROL (TC) register bits */ - -#define TC_EARLY_TX_ENABLE (0x00000001) - -/* Loopback Mode (LM_) Select valuesbits */ -#define TC_LM_NORMAL (0x00000000) -#define TC_LM_INTERNAL (0x00000002) -#define TC_LM_EXTERNAL (0x00000004) -#define TC_LM_FULL_DPX (0x00000006) - -#define TX_SLOT_TIME (0x00000078) - -/* Bytes transferred to chip before transmission starts. */ -#define TX_FIFO_THRESH 128 /* Rounded down to 4 byte units. */ - -/* description of rx descriptors status bits */ -#define RRING_PKT_INTACT (0x0001) -#define RRING_ALIGN_ERR (0x0002) -#define RRING_CRC_ERR (0x0004) -#define RRING_MISSED_PKT (0x0008) -#define RRING_MULTICAST (0x0010) -#define RRING_BROADCAST (0x0020) -#define RRING_RECEIVER_DISABLE (0x0040) -#define RRING_STATUS_VALID (0x1000) -#define RRING_FRAGLIST_ERR (0x2000) -#define RRING_HDR_COPIED (0x4000) -#define RRING_OWN (0x8000) - -/* error summary */ -#define RRING_ERROR (RRING_ALIGN_ERR|RRING_CRC_ERR) - -/* description of tx descriptors status bits */ -#define TRING_PKT_INTACT (0x0001) /* pkt transmitted. */ -#define TRING_PKT_NONDEFER (0x0002) /* pkt xmitted w/o deferring */ -#define TRING_COLL (0x0004) /* pkt xmitted w collisions */ -#define TRING_CARR (0x0008) /* carrier sense lost */ -#define TRING_UNDERRUN (0x0010) /* DMA underrun */ -#define TRING_HB_COLL (0x0020) /* Collision detect Heartbeat */ -#define TRING_WIN_COLL (0x0040) /* out of window collision */ -#define TRING_DEFERRED (0x0080) /* Deferring */ -#define TRING_COLL_COUNT (0x0F00) /* collision counter (mask) */ -#define TRING_COLL_EXCESS (0x1000) /* tx aborted: excessive colls */ -#define TRING_OWN (0x8000) /* desc ownership bit */ - -/* error summary */ -#define TRING_ABORT (TRING_COLL_EXCESS|TRING_WIN_COLL|TRING_UNDERRUN) -#define TRING_ERROR (TRING_DEFERRED|TRING_WIN_COLL|TRING_UNDERRUN|TRING_CARR/*|TRING_COLL*/ ) - -/* description of the tx descriptors control bits */ -#define TD_FRAGLIST (0x0001) /* Desc points to a fragment list */ -#define TD_LLFORM (0x0002) /* Frag list format */ -#define TD_IAF (0x0004) /* Generate Interrupt after tx */ -#define TD_NOCRC (0x0008) /* No CRC generated */ -#define TD_LASTDESC (0x0010) /* Last desc for this frame */ - -#endif /* _EPIC100_H_ */ diff --git a/usr/src/grub/grub-0.95/netboot/etherboot.h b/usr/src/grub/grub-0.95/netboot/etherboot.h deleted file mode 100644 index 1701493378..0000000000 --- a/usr/src/grub/grub-0.95/netboot/etherboot.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, 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 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. - */ - -/* - * Transport layer to use Etherboot NIC drivers in GRUB. - */ - -#ifndef ETHERBOOT_H -#define ETHERBOOT_H - -#include "shared.h" -#include "osdep.h" -#include "if_ether.h" -#include "in.h" - -/* Link configuration time in tenths of a second */ -#ifndef VALID_LINK_TIMEOUT -#define VALID_LINK_TIMEOUT 100 /* 10.0 seconds */ -#endif - -#ifndef NULL -#define NULL ((void *)0) -#endif - - -#define gateA20_set() gateA20(1) -#define gateA20_unset() gateA20(0) -#if !defined(__sun) -#define EBDEBUG 0 -#endif -/* The 'rom_info' maybe arch depended. It must be moved to some other - * place */ -struct rom_info { - unsigned short rom_segment; - unsigned short rom_length; -}; - -extern void poll_interruptions P((void)); - -/* For UNDI drivers */ -extern uint32_t get_free_base_memory ( void ); -extern void *allot_base_memory ( size_t ); -extern void forget_base_memory ( void*, size_t ); -extern void free_unused_base_memory ( void ); - -#endif /* ETHERBOOT_H */ diff --git a/usr/src/grub/grub-0.95/netboot/forcedeth.c b/usr/src/grub/grub-0.95/netboot/forcedeth.c deleted file mode 100644 index 88486568d7..0000000000 --- a/usr/src/grub/grub-0.95/netboot/forcedeth.c +++ /dev/null @@ -1,1039 +0,0 @@ -/************************************************************************** -* forcedeth.c -- Etherboot device driver for the NVIDIA nForce -* media access controllers. -* -* Note: This driver is based on the Linux driver that was based on -* a cleanroom reimplementation which was based on reverse -* engineered documentation written by Carl-Daniel Hailfinger -* and Andrew de Quincey. It's neither supported nor endorsed -* by NVIDIA Corp. Use at your own risk. -* -* Written 2004 by Timothy Legge -* -* 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. -* -* Portions of this code based on: -* forcedeth: Ethernet driver for NVIDIA nForce media access controllers: -* -* (C) 2003 Manfred Spraul -* See Linux Driver for full information -* -* Linux Driver Version 0.22, 19 Jan 2004 -* -* -* REVISION HISTORY: -* ================ -* v1.0 01-31-2004 timlegge Initial port of Linux driver -* v1.1 02-03-2004 timlegge Large Clean up, first release -* -* Indent Options: indent -kr -i8 -***************************************************************************/ - -/* to get some global routines like printf */ -#include "etherboot.h" -/* to get the interface to the body of the program */ -#include "nic.h" -/* to get the PCI support functions, if this is a PCI NIC */ -#include "pci.h" -/* Include timer support functions */ -#include "timer.h" - -#define drv_version "v1.1" -#define drv_date "02-03-2004" - -//#define TFTM_DEBUG -#ifdef TFTM_DEBUG -#define dprintf(x) printf x -#else -#define dprintf(x) -#endif - -typedef unsigned char u8; -typedef signed char s8; -typedef unsigned short u16; -typedef signed short s16; -typedef unsigned int u32; -typedef signed int s32; - -/* Condensed operations for readability. */ -#define virt_to_le32desc(addr) cpu_to_le32(virt_to_bus(addr)) -#define le32desc_to_virt(addr) bus_to_virt(le32_to_cpu(addr)) - -unsigned long BASE; -/* NIC specific static variables go here */ - - -/* - * Hardware access: - */ - -#define DEV_NEED_LASTPACKET1 0x0001 -#define DEV_IRQMASK_1 0x0002 -#define DEV_IRQMASK_2 0x0004 -#define DEV_NEED_TIMERIRQ 0x0008 - -enum { - NvRegIrqStatus = 0x000, -#define NVREG_IRQSTAT_MIIEVENT 0040 -#define NVREG_IRQSTAT_MASK 0x1ff - NvRegIrqMask = 0x004, -#define NVREG_IRQ_RX 0x0002 -#define NVREG_IRQ_RX_NOBUF 0x0004 -#define NVREG_IRQ_TX_ERR 0x0008 -#define NVREG_IRQ_TX2 0x0010 -#define NVREG_IRQ_TIMER 0x0020 -#define NVREG_IRQ_LINK 0x0040 -#define NVREG_IRQ_TX1 0x0100 -#define NVREG_IRQMASK_WANTED_1 0x005f -#define NVREG_IRQMASK_WANTED_2 0x0147 -#define NVREG_IRQ_UNKNOWN (~(NVREG_IRQ_RX|NVREG_IRQ_RX_NOBUF|NVREG_IRQ_TX_ERR|NVREG_IRQ_TX2|NVREG_IRQ_TIMER|NVREG_IRQ_LINK|NVREG_IRQ_TX1)) - - NvRegUnknownSetupReg6 = 0x008, -#define NVREG_UNKSETUP6_VAL 3 - -/* - * NVREG_POLL_DEFAULT is the interval length of the timer source on the nic - * NVREG_POLL_DEFAULT=97 would result in an interval length of 1 ms - */ - NvRegPollingInterval = 0x00c, -#define NVREG_POLL_DEFAULT 970 - NvRegMisc1 = 0x080, -#define NVREG_MISC1_HD 0x02 -#define NVREG_MISC1_FORCE 0x3b0f3c - - NvRegTransmitterControl = 0x084, -#define NVREG_XMITCTL_START 0x01 - NvRegTransmitterStatus = 0x088, -#define NVREG_XMITSTAT_BUSY 0x01 - - NvRegPacketFilterFlags = 0x8c, -#define NVREG_PFF_ALWAYS 0x7F0008 -#define NVREG_PFF_PROMISC 0x80 -#define NVREG_PFF_MYADDR 0x20 - - NvRegOffloadConfig = 0x90, -#define NVREG_OFFLOAD_HOMEPHY 0x601 -#define NVREG_OFFLOAD_NORMAL 0x5ee - NvRegReceiverControl = 0x094, -#define NVREG_RCVCTL_START 0x01 - NvRegReceiverStatus = 0x98, -#define NVREG_RCVSTAT_BUSY 0x01 - - NvRegRandomSeed = 0x9c, -#define NVREG_RNDSEED_MASK 0x00ff -#define NVREG_RNDSEED_FORCE 0x7f00 - - NvRegUnknownSetupReg1 = 0xA0, -#define NVREG_UNKSETUP1_VAL 0x16070f - NvRegUnknownSetupReg2 = 0xA4, -#define NVREG_UNKSETUP2_VAL 0x16 - NvRegMacAddrA = 0xA8, - NvRegMacAddrB = 0xAC, - NvRegMulticastAddrA = 0xB0, -#define NVREG_MCASTADDRA_FORCE 0x01 - NvRegMulticastAddrB = 0xB4, - NvRegMulticastMaskA = 0xB8, - NvRegMulticastMaskB = 0xBC, - - NvRegTxRingPhysAddr = 0x100, - NvRegRxRingPhysAddr = 0x104, - NvRegRingSizes = 0x108, -#define NVREG_RINGSZ_TXSHIFT 0 -#define NVREG_RINGSZ_RXSHIFT 16 - NvRegUnknownTransmitterReg = 0x10c, - NvRegLinkSpeed = 0x110, -#define NVREG_LINKSPEED_FORCE 0x10000 -#define NVREG_LINKSPEED_10 10 -#define NVREG_LINKSPEED_100 100 -#define NVREG_LINKSPEED_1000 1000 - NvRegUnknownSetupReg5 = 0x130, -#define NVREG_UNKSETUP5_BIT31 (1<<31) - NvRegUnknownSetupReg3 = 0x134, -#define NVREG_UNKSETUP3_VAL1 0x200010 - NvRegTxRxControl = 0x144, -#define NVREG_TXRXCTL_KICK 0x0001 -#define NVREG_TXRXCTL_BIT1 0x0002 -#define NVREG_TXRXCTL_BIT2 0x0004 -#define NVREG_TXRXCTL_IDLE 0x0008 -#define NVREG_TXRXCTL_RESET 0x0010 - NvRegMIIStatus = 0x180, -#define NVREG_MIISTAT_ERROR 0x0001 -#define NVREG_MIISTAT_LINKCHANGE 0x0008 -#define NVREG_MIISTAT_MASK 0x000f -#define NVREG_MIISTAT_MASK2 0x000f - NvRegUnknownSetupReg4 = 0x184, -#define NVREG_UNKSETUP4_VAL 8 - - NvRegAdapterControl = 0x188, -#define NVREG_ADAPTCTL_START 0x02 -#define NVREG_ADAPTCTL_LINKUP 0x04 -#define NVREG_ADAPTCTL_PHYVALID 0x4000 -#define NVREG_ADAPTCTL_RUNNING 0x100000 -#define NVREG_ADAPTCTL_PHYSHIFT 24 - NvRegMIISpeed = 0x18c, -#define NVREG_MIISPEED_BIT8 (1<<8) -#define NVREG_MIIDELAY 5 - NvRegMIIControl = 0x190, -#define NVREG_MIICTL_INUSE 0x10000 -#define NVREG_MIICTL_WRITE 0x08000 -#define NVREG_MIICTL_ADDRSHIFT 5 - NvRegMIIData = 0x194, - NvRegWakeUpFlags = 0x200, -#define NVREG_WAKEUPFLAGS_VAL 0x7770 -#define NVREG_WAKEUPFLAGS_BUSYSHIFT 24 -#define NVREG_WAKEUPFLAGS_ENABLESHIFT 16 -#define NVREG_WAKEUPFLAGS_D3SHIFT 12 -#define NVREG_WAKEUPFLAGS_D2SHIFT 8 -#define NVREG_WAKEUPFLAGS_D1SHIFT 4 -#define NVREG_WAKEUPFLAGS_D0SHIFT 0 -#define NVREG_WAKEUPFLAGS_ACCEPT_MAGPAT 0x01 -#define NVREG_WAKEUPFLAGS_ACCEPT_WAKEUPPAT 0x02 -#define NVREG_WAKEUPFLAGS_ACCEPT_LINKCHANGE 0x04 - - NvRegPatternCRC = 0x204, - NvRegPatternMask = 0x208, - NvRegPowerCap = 0x268, -#define NVREG_POWERCAP_D3SUPP (1<<30) -#define NVREG_POWERCAP_D2SUPP (1<<26) -#define NVREG_POWERCAP_D1SUPP (1<<25) - NvRegPowerState = 0x26c, -#define NVREG_POWERSTATE_POWEREDUP 0x8000 -#define NVREG_POWERSTATE_VALID 0x0100 -#define NVREG_POWERSTATE_MASK 0x0003 -#define NVREG_POWERSTATE_D0 0x0000 -#define NVREG_POWERSTATE_D1 0x0001 -#define NVREG_POWERSTATE_D2 0x0002 -#define NVREG_POWERSTATE_D3 0x0003 -}; - - - -#define NV_TX_LASTPACKET (1<<0) -#define NV_TX_RETRYERROR (1<<3) -#define NV_TX_LASTPACKET1 (1<<8) -#define NV_TX_DEFERRED (1<<10) -#define NV_TX_CARRIERLOST (1<<11) -#define NV_TX_LATECOLLISION (1<<12) -#define NV_TX_UNDERFLOW (1<<13) -#define NV_TX_ERROR (1<<14) -#define NV_TX_VALID (1<<15) - -#define NV_RX_DESCRIPTORVALID (1<<0) -#define NV_RX_MISSEDFRAME (1<<1) -#define NV_RX_SUBSTRACT1 (1<<3) -#define NV_RX_ERROR1 (1<<7) -#define NV_RX_ERROR2 (1<<8) -#define NV_RX_ERROR3 (1<<9) -#define NV_RX_ERROR4 (1<<10) -#define NV_RX_CRCERR (1<<11) -#define NV_RX_OVERFLOW (1<<12) -#define NV_RX_FRAMINGERR (1<<13) -#define NV_RX_ERROR (1<<14) -#define NV_RX_AVAIL (1<<15) - -/* Miscelaneous hardware related defines: */ -#define NV_PCI_REGSZ 0x270 - -/* various timeout delays: all in usec */ -#define NV_TXRX_RESET_DELAY 4 -#define NV_TXSTOP_DELAY1 10 -#define NV_TXSTOP_DELAY1MAX 500000 -#define NV_TXSTOP_DELAY2 100 -#define NV_RXSTOP_DELAY1 10 -#define NV_RXSTOP_DELAY1MAX 500000 -#define NV_RXSTOP_DELAY2 100 -#define NV_SETUP5_DELAY 5 -#define NV_SETUP5_DELAYMAX 50000 -#define NV_POWERUP_DELAY 5 -#define NV_POWERUP_DELAYMAX 5000 -#define NV_MIIBUSY_DELAY 50 -#define NV_MIIPHY_DELAY 10 -#define NV_MIIPHY_DELAYMAX 10000 - -#define NV_WAKEUPPATTERNS 5 -#define NV_WAKEUPMASKENTRIES 4 - -/* General driver defaults */ -#define NV_WATCHDOG_TIMEO (2*HZ) -#define DEFAULT_MTU 1500 /* also maximum supported, at least for now */ - -#define RX_RING 4 -#define TX_RING 2 -/* limited to 1 packet until we understand NV_TX_LASTPACKET */ -#define TX_LIMIT_STOP 10 -#define TX_LIMIT_START 5 - -/* rx/tx mac addr + type + vlan + align + slack*/ -#define RX_NIC_BUFSIZE (DEFAULT_MTU + 64) -/* even more slack */ -#define RX_ALLOC_BUFSIZE (DEFAULT_MTU + 128) - -#define OOM_REFILL (1+HZ/20) -#define POLL_WAIT (1+HZ/100) - -struct ring_desc { - u32 PacketBuffer; - u16 Length; - u16 Flags; -}; - - -/* Define the TX Descriptor */ -static struct ring_desc tx_ring[TX_RING]; - -/* Create a static buffer of size RX_BUF_SZ for each -TX Descriptor. All descriptors point to a -part of this buffer */ -static unsigned char txb[TX_RING * RX_NIC_BUFSIZE]; - -/* Define the TX Descriptor */ -static struct ring_desc rx_ring[RX_RING]; - -/* Create a static buffer of size RX_BUF_SZ for each -RX Descriptor All descriptors point to a -part of this buffer */ -static unsigned char rxb[RX_RING * RX_NIC_BUFSIZE]; - -/* Private Storage for the NIC */ -struct forcedeth_private { - /* General data: - * Locking: spin_lock(&np->lock); */ - int in_shutdown; - u32 linkspeed; - int duplex; - int phyaddr; - - /* General data: RO fields */ - u8 *ring_addr; - u32 orig_mac[2]; - u32 irqmask; - /* rx specific fields. - * Locking: Within irq hander or disable_irq+spin_lock(&np->lock); - */ - struct ring_desc *rx_ring; - unsigned int cur_rx, refill_rx; - struct sk_buff *rx_skbuff[RX_RING]; - u32 rx_dma[RX_RING]; - unsigned int rx_buf_sz; - - /* - * tx specific fields. - */ - struct ring_desc *tx_ring; - unsigned int next_tx, nic_tx; - struct sk_buff *tx_skbuff[TX_RING]; - u32 tx_dma[TX_RING]; - u16 tx_flags; -} npx; - -static struct forcedeth_private *np; - -static inline void pci_push(u8 * base) -{ - /* force out pending posted writes */ - readl(base); -} -static int reg_delay(int offset, u32 mask, - u32 target, int delay, int delaymax, const char *msg) -{ - u8 *base = (u8 *) BASE; - - pci_push(base); - do { - udelay(delay); - delaymax -= delay; - if (delaymax < 0) { - if (msg) - printf(msg); - return 1; - } - } while ((readl(base + offset) & mask) != target); - return 0; -} - -#define MII_READ (-1) -#define MII_PHYSID1 0x02 /* PHYS ID 1 */ -#define MII_PHYSID2 0x03 /* PHYS ID 2 */ -#define MII_BMCR 0x00 /* Basic mode control register */ -#define MII_BMSR 0x01 /* Basic mode status register */ -#define MII_ADVERTISE 0x04 /* Advertisement control reg */ -#define MII_LPA 0x05 /* Link partner ability reg */ - -#define BMSR_ANEGCOMPLETE 0x0020 /* Auto-negotiation complete */ - -/* Link partner ability register. */ -#define LPA_SLCT 0x001f /* Same as advertise selector */ -#define LPA_10HALF 0x0020 /* Can do 10mbps half-duplex */ -#define LPA_10FULL 0x0040 /* Can do 10mbps full-duplex */ -#define LPA_100HALF 0x0080 /* Can do 100mbps half-duplex */ -#define LPA_100FULL 0x0100 /* Can do 100mbps full-duplex */ -#define LPA_100BASE4 0x0200 /* Can do 100mbps 4k packets */ -#define LPA_RESV 0x1c00 /* Unused... */ -#define LPA_RFAULT 0x2000 /* Link partner faulted */ -#define LPA_LPACK 0x4000 /* Link partner acked us */ -#define LPA_NPAGE 0x8000 /* Next page bit */ - -/* mii_rw: read/write a register on the PHY. - * - * Caller must guarantee serialization - */ -static int mii_rw(struct nic *nic __unused, int addr, int miireg, - int value) -{ - u8 *base = (u8 *) BASE; - int was_running; - u32 reg; - int retval; - - writel(NVREG_MIISTAT_MASK, base + NvRegMIIStatus); - was_running = 0; - reg = readl(base + NvRegAdapterControl); - if (reg & NVREG_ADAPTCTL_RUNNING) { - was_running = 1; - writel(reg & ~NVREG_ADAPTCTL_RUNNING, - base + NvRegAdapterControl); - } - reg = readl(base + NvRegMIIControl); - if (reg & NVREG_MIICTL_INUSE) { - writel(NVREG_MIICTL_INUSE, base + NvRegMIIControl); - udelay(NV_MIIBUSY_DELAY); - } - - reg = - NVREG_MIICTL_INUSE | (addr << NVREG_MIICTL_ADDRSHIFT) | miireg; - if (value != MII_READ) { - writel(value, base + NvRegMIIData); - reg |= NVREG_MIICTL_WRITE; - } - writel(reg, base + NvRegMIIControl); - - if (reg_delay(NvRegMIIControl, NVREG_MIICTL_INUSE, 0, - NV_MIIPHY_DELAY, NV_MIIPHY_DELAYMAX, NULL)) { - dprintf(("mii_rw of reg %d at PHY %d timed out.\n", - miireg, addr)); - retval = -1; - } else if (value != MII_READ) { - /* it was a write operation - fewer failures are detectable */ - dprintf(("mii_rw wrote 0x%x to reg %d at PHY %d\n", - value, miireg, addr)); - retval = 0; - } else if (readl(base + NvRegMIIStatus) & NVREG_MIISTAT_ERROR) { - dprintf(("mii_rw of reg %d at PHY %d failed.\n", - miireg, addr)); - retval = -1; - } else { - /* FIXME: why is that required? */ - udelay(50); - retval = readl(base + NvRegMIIData); - dprintf(("mii_rw read from reg %d at PHY %d: 0x%x.\n", - miireg, addr, retval)); - } - if (was_running) { - reg = readl(base + NvRegAdapterControl); - writel(reg | NVREG_ADAPTCTL_RUNNING, - base + NvRegAdapterControl); - } - return retval; -} - -static void start_rx(struct nic *nic __unused) -{ - u8 *base = (u8 *) BASE; - - dprintf(("start_rx\n")); - /* Already running? Stop it. */ - if (readl(base + NvRegReceiverControl) & NVREG_RCVCTL_START) { - writel(0, base + NvRegReceiverControl); - pci_push(base); - } - writel(np->linkspeed, base + NvRegLinkSpeed); - pci_push(base); - writel(NVREG_RCVCTL_START, base + NvRegReceiverControl); - pci_push(base); -} - -static void stop_rx(void) -{ - u8 *base = (u8 *) BASE; - - dprintf(("stop_rx\n")); - writel(0, base + NvRegReceiverControl); - reg_delay(NvRegReceiverStatus, NVREG_RCVSTAT_BUSY, 0, - NV_RXSTOP_DELAY1, NV_RXSTOP_DELAY1MAX, - "stop_rx: ReceiverStatus remained busy"); - - udelay(NV_RXSTOP_DELAY2); - writel(0, base + NvRegLinkSpeed); -} - -static void start_tx(struct nic *nic __unused) -{ - u8 *base = (u8 *) BASE; - - dprintf(("start_tx\n")); - writel(NVREG_XMITCTL_START, base + NvRegTransmitterControl); - pci_push(base); -} - -static void stop_tx(void) -{ - u8 *base = (u8 *) BASE; - - dprintf(("stop_tx\n")); - writel(0, base + NvRegTransmitterControl); - reg_delay(NvRegTransmitterStatus, NVREG_XMITSTAT_BUSY, 0, - NV_TXSTOP_DELAY1, NV_TXSTOP_DELAY1MAX, - "stop_tx: TransmitterStatus remained busy"); - - udelay(NV_TXSTOP_DELAY2); - writel(0, base + NvRegUnknownTransmitterReg); -} - - -static void txrx_reset(struct nic *nic __unused) -{ - u8 *base = (u8 *) BASE; - - dprintf(("txrx_reset\n")); - writel(NVREG_TXRXCTL_BIT2 | NVREG_TXRXCTL_RESET, - base + NvRegTxRxControl); - pci_push(base); - udelay(NV_TXRX_RESET_DELAY); - writel(NVREG_TXRXCTL_BIT2, base + NvRegTxRxControl); - pci_push(base); -} - -/* - * alloc_rx: fill rx ring entries. - * Return 1 if the allocations for the skbs failed and the - * rx engine is without Available descriptors - */ -static int alloc_rx(struct nic *nic __unused) -{ - unsigned int refill_rx = np->refill_rx; - int i; - //while (np->cur_rx != refill_rx) { - for (i = 0; i < RX_RING; i++) { - //int nr = refill_rx % RX_RING; - rx_ring[i].PacketBuffer = - virt_to_le32desc(&rxb[i * RX_NIC_BUFSIZE]); - rx_ring[i].Length = cpu_to_le16(RX_NIC_BUFSIZE); - wmb(); - rx_ring[i].Flags = cpu_to_le16(NV_RX_AVAIL); - /* printf("alloc_rx: Packet %d marked as Available\n", - refill_rx); */ - refill_rx++; - } - np->refill_rx = refill_rx; - if (np->cur_rx - refill_rx == RX_RING) - return 1; - return 0; -} - -static int update_linkspeed(struct nic *nic) -{ - int adv, lpa, newdup; - u32 newls; - adv = mii_rw(nic, np->phyaddr, MII_ADVERTISE, MII_READ); - lpa = mii_rw(nic, np->phyaddr, MII_LPA, MII_READ); - dprintf(("update_linkspeed: PHY advertises 0x%hX, lpa 0x%hX.\n", - adv, lpa)); - - /* FIXME: handle parallel detection properly, handle gigabit ethernet */ - lpa = lpa & adv; - if (lpa & LPA_100FULL) { - newls = NVREG_LINKSPEED_FORCE | NVREG_LINKSPEED_100; - newdup = 1; - } else if (lpa & LPA_100HALF) { - newls = NVREG_LINKSPEED_FORCE | NVREG_LINKSPEED_100; - newdup = 0; - } else if (lpa & LPA_10FULL) { - newls = NVREG_LINKSPEED_FORCE | NVREG_LINKSPEED_10; - newdup = 1; - } else if (lpa & LPA_10HALF) { - newls = NVREG_LINKSPEED_FORCE | NVREG_LINKSPEED_10; - newdup = 0; - } else { - printf("bad ability %hX - falling back to 10HD.\n", lpa); - newls = NVREG_LINKSPEED_FORCE | NVREG_LINKSPEED_10; - newdup = 0; - } - if (np->duplex != newdup || np->linkspeed != newls) { - np->duplex = newdup; - np->linkspeed = newls; - return 1; - } - return 0; -} - - - -static int init_ring(struct nic *nic) -{ - int i; - - np->next_tx = np->nic_tx = 0; - for (i = 0; i < TX_RING; i++) { - tx_ring[i].Flags = 0; - } - - np->cur_rx = 0; - np->refill_rx = 0; - for (i = 0; i < RX_RING; i++) { - rx_ring[i].Flags = 0; - } - return alloc_rx(nic); -} - -static void set_multicast(struct nic *nic) -{ - - u8 *base = (u8 *) BASE; - u32 addr[2]; - u32 mask[2]; - u32 pff; - u32 alwaysOff[2]; - u32 alwaysOn[2]; - - memset(addr, 0, sizeof(addr)); - memset(mask, 0, sizeof(mask)); - - pff = NVREG_PFF_MYADDR; - - alwaysOn[0] = alwaysOn[1] = alwaysOff[0] = alwaysOff[1] = 0; - - addr[0] = alwaysOn[0]; - addr[1] = alwaysOn[1]; - mask[0] = alwaysOn[0] | alwaysOff[0]; - mask[1] = alwaysOn[1] | alwaysOff[1]; - - addr[0] |= NVREG_MCASTADDRA_FORCE; - pff |= NVREG_PFF_ALWAYS; - stop_rx(); - writel(addr[0], base + NvRegMulticastAddrA); - writel(addr[1], base + NvRegMulticastAddrB); - writel(mask[0], base + NvRegMulticastMaskA); - writel(mask[1], base + NvRegMulticastMaskB); - writel(pff, base + NvRegPacketFilterFlags); - start_rx(nic); -} - -/************************************************************************** -RESET - Reset the NIC to prepare for use -***************************************************************************/ -static int forcedeth_reset(struct nic *nic) -{ - u8 *base = (u8 *) BASE; - int ret, oom, i; - ret = 0; - dprintf(("forcedeth: open\n")); - - /* 1) erase previous misconfiguration */ - /* 4.1-1: stop adapter: ignored, 4.3 seems to be overkill */ - writel(NVREG_MCASTADDRA_FORCE, base + NvRegMulticastAddrA); - writel(0, base + NvRegMulticastAddrB); - writel(0, base + NvRegMulticastMaskA); - writel(0, base + NvRegMulticastMaskB); - writel(0, base + NvRegPacketFilterFlags); - writel(0, base + NvRegAdapterControl); - writel(0, base + NvRegLinkSpeed); - writel(0, base + NvRegUnknownTransmitterReg); - txrx_reset(nic); - writel(0, base + NvRegUnknownSetupReg6); - - /* 2) initialize descriptor rings */ - np->in_shutdown = 0; - oom = init_ring(nic); - - /* 3) set mac address */ - { - u32 mac[2]; - - mac[0] = - (nic->node_addr[0] << 0) + (nic->node_addr[1] << 8) + - (nic->node_addr[2] << 16) + (nic->node_addr[3] << 24); - mac[1] = - (nic->node_addr[4] << 0) + (nic->node_addr[5] << 8); - - writel(mac[0], base + NvRegMacAddrA); - writel(mac[1], base + NvRegMacAddrB); - } - - /* 4) continue setup */ - np->linkspeed = NVREG_LINKSPEED_FORCE | NVREG_LINKSPEED_10; - np->duplex = 0; - writel(NVREG_UNKSETUP3_VAL1, base + NvRegUnknownSetupReg3); - writel(0, base + NvRegTxRxControl); - pci_push(base); - writel(NVREG_TXRXCTL_BIT1, base + NvRegTxRxControl); - - reg_delay(NvRegUnknownSetupReg5, NVREG_UNKSETUP5_BIT31, - NVREG_UNKSETUP5_BIT31, NV_SETUP5_DELAY, - NV_SETUP5_DELAYMAX, - "open: SetupReg5, Bit 31 remained off\n"); - writel(0, base + NvRegUnknownSetupReg4); - - /* 5) Find a suitable PHY */ - writel(NVREG_MIISPEED_BIT8 | NVREG_MIIDELAY, base + NvRegMIISpeed); - for (i = 1; i < 32; i++) { - int id1, id2; - - id1 = mii_rw(nic, i, MII_PHYSID1, MII_READ); - if (id1 < 0) - continue; - id2 = mii_rw(nic, i, MII_PHYSID2, MII_READ); - if (id2 < 0) - continue; - dprintf(("open: Found PHY %04x:%04x at address %d.\n", - id1, id2, i)); - np->phyaddr = i; - - update_linkspeed(nic); - - break; - } - if (i == 32) { - printf("open: failing due to lack of suitable PHY.\n"); - ret = -1; - goto out_drain; - } - - printf("%d-Mbs Link, %s-Duplex\n", - np->linkspeed & NVREG_LINKSPEED_10 ? 10 : 100, - np->duplex ? "Full" : "Half"); - /* 6) continue setup */ - writel(NVREG_MISC1_FORCE | (np->duplex ? 0 : NVREG_MISC1_HD), - base + NvRegMisc1); - writel(readl(base + NvRegTransmitterStatus), - base + NvRegTransmitterStatus); - writel(NVREG_PFF_ALWAYS, base + NvRegPacketFilterFlags); - writel(NVREG_OFFLOAD_NORMAL, base + NvRegOffloadConfig); - - writel(readl(base + NvRegReceiverStatus), - base + NvRegReceiverStatus); - - /* FIXME: I cheated and used the calculator to get a random number */ - i = 75963081; - writel(NVREG_RNDSEED_FORCE | (i & NVREG_RNDSEED_MASK), - base + NvRegRandomSeed); - writel(NVREG_UNKSETUP1_VAL, base + NvRegUnknownSetupReg1); - writel(NVREG_UNKSETUP2_VAL, base + NvRegUnknownSetupReg2); - writel(NVREG_POLL_DEFAULT, base + NvRegPollingInterval); - writel(NVREG_UNKSETUP6_VAL, base + NvRegUnknownSetupReg6); - writel((np-> - phyaddr << NVREG_ADAPTCTL_PHYSHIFT) | - NVREG_ADAPTCTL_PHYVALID, base + NvRegAdapterControl); - writel(NVREG_UNKSETUP4_VAL, base + NvRegUnknownSetupReg4); - writel(NVREG_WAKEUPFLAGS_VAL, base + NvRegWakeUpFlags); - - /* 7) start packet processing */ - writel((u32) virt_to_le32desc(&rx_ring[0]), - base + NvRegRxRingPhysAddr); - writel((u32) virt_to_le32desc(&tx_ring[0]), - base + NvRegTxRingPhysAddr); - - - writel(((RX_RING - 1) << NVREG_RINGSZ_RXSHIFT) + - ((TX_RING - 1) << NVREG_RINGSZ_TXSHIFT), - base + NvRegRingSizes); - - i = readl(base + NvRegPowerState); - if ((i & NVREG_POWERSTATE_POWEREDUP) == 0) { - writel(NVREG_POWERSTATE_POWEREDUP | i, - base + NvRegPowerState); - } - pci_push(base); - udelay(10); - writel(readl(base + NvRegPowerState) | NVREG_POWERSTATE_VALID, - base + NvRegPowerState); - writel(NVREG_ADAPTCTL_RUNNING, base + NvRegAdapterControl); - - writel(0, base + NvRegIrqMask); - pci_push(base); - writel(NVREG_IRQSTAT_MASK, base + NvRegIrqStatus); - pci_push(base); - writel(NVREG_MIISTAT_MASK2, base + NvRegMIIStatus); - writel(NVREG_IRQSTAT_MASK, base + NvRegIrqStatus); - pci_push(base); -/* - writel(np->irqmask, base + NvRegIrqMask); -*/ - writel(NVREG_MCASTADDRA_FORCE, base + NvRegMulticastAddrA); - writel(0, base + NvRegMulticastAddrB); - writel(0, base + NvRegMulticastMaskA); - writel(0, base + NvRegMulticastMaskB); - writel(NVREG_PFF_ALWAYS | NVREG_PFF_MYADDR, - base + NvRegPacketFilterFlags); - - set_multicast(nic); - //start_rx(nic); - start_tx(nic); - - if (! - (mii_rw(nic, np->phyaddr, MII_BMSR, MII_READ) & - BMSR_ANEGCOMPLETE)) { - printf("no link during initialization.\n"); - } - - udelay(10000); - out_drain: - return ret; -} - -//extern void hex_dump(const char *data, const unsigned int len); - -/************************************************************************** -POLL - Wait for a frame -***************************************************************************/ -static int forcedeth_poll(struct nic *nic, int retrieve) -{ - /* return true if there's an ethernet packet ready to read */ - /* nic->packet should contain data on return */ - /* nic->packetlen should contain length of data */ - - struct ring_desc *prd; - int len; - int i; - - i = np->cur_rx % RX_RING; - prd = &rx_ring[i]; - - if ( ! (prd->Flags & cpu_to_le16(NV_RX_DESCRIPTORVALID)) ) { - return 0; - } - - if ( ! retrieve ) return 1; - - /* got a valid packet - forward it to the network core */ - len = cpu_to_le16(prd->Length); - nic->packetlen = len; - //hex_dump(rxb + (i * RX_NIC_BUFSIZE), len); - memcpy(nic->packet, rxb + - (i * RX_NIC_BUFSIZE), nic->packetlen); - - wmb(); - np->cur_rx++; - alloc_rx(nic); - return 1; -} - - -/************************************************************************** -TRANSMIT - Transmit a frame -***************************************************************************/ -static void forcedeth_transmit(struct nic *nic, const char *d, /* Destination */ - unsigned int t, /* Type */ - unsigned int s, /* size */ - const char *p) -{ /* Packet */ - /* send the packet to destination */ - u8 *ptxb; - u16 nstype; - //u16 status; - u8 *base = (u8 *) BASE; - int nr = np->next_tx % TX_RING; - - /* point to the current txb incase multiple tx_rings are used */ - ptxb = txb + (nr * RX_NIC_BUFSIZE); - //np->tx_skbuff[nr] = ptxb; - - /* copy the packet to ring buffer */ - memcpy(ptxb, d, ETH_ALEN); /* dst */ - memcpy(ptxb + ETH_ALEN, nic->node_addr, ETH_ALEN); /* src */ - nstype = htons((u16) t); /* type */ - memcpy(ptxb + 2 * ETH_ALEN, (u8 *) & nstype, 2); /* type */ - memcpy(ptxb + ETH_HLEN, p, s); - - s += ETH_HLEN; - while (s < ETH_ZLEN) /* pad to min length */ - ptxb[s++] = '\0'; - - tx_ring[nr].PacketBuffer = (u32) virt_to_le32desc(ptxb); - tx_ring[nr].Length = cpu_to_le16(s - 1); - - wmb(); - tx_ring[nr].Flags = np->tx_flags; - - writel(NVREG_TXRXCTL_KICK, base + NvRegTxRxControl); - pci_push(base); - tx_ring[nr].Flags = np->tx_flags; - np->next_tx++; -} - -/************************************************************************** -DISABLE - Turn off ethernet interface -***************************************************************************/ -static void forcedeth_disable(struct dev *dev __unused) -{ - /* put the card in its initial state */ - /* This function serves 3 purposes. - * This disables DMA and interrupts so we don't receive - * unexpected packets or interrupts from the card after - * etherboot has finished. - * This frees resources so etherboot may use - * this driver on another interface - * This allows etherboot to reinitialize the interface - * if something is something goes wrong. - */ - u8 *base = (u8 *) BASE; - np->in_shutdown = 1; - stop_tx(); - stop_rx(); - - /* disable interrupts on the nic or we will lock up */ - writel(0, base + NvRegIrqMask); - pci_push(base); - dprintf(("Irqmask is zero again\n")); - - /* specia op:o write back the misordered MAC address - otherwise - * the next probe_nic would see a wrong address. - */ - writel(np->orig_mac[0], base + NvRegMacAddrA); - writel(np->orig_mac[1], base + NvRegMacAddrB); -} - -/************************************************************************** -IRQ - Enable, Disable, or Force interrupts -***************************************************************************/ -static void forcedeth_irq(struct nic *nic __unused, irq_action_t action __unused) -{ - switch ( action ) { - case DISABLE : - break; - case ENABLE : - break; - case FORCE : - break; - } -} - -/************************************************************************** -PROBE - Look for an adapter, this routine's visible to the outside -***************************************************************************/ -#define IORESOURCE_MEM 0x00000200 -#define board_found 1 -#define valid_link 0 -static int forcedeth_probe(struct dev *dev, struct pci_device *pci) -{ - struct nic *nic = (struct nic *) dev; - unsigned long addr; - int sz; - u8 *base; - - if (pci->ioaddr == 0) - return 0; - - printf("forcedeth.c: Found %s, vendor=0x%hX, device=0x%hX\n", - pci->name, pci->vendor, pci->dev_id); - - nic->irqno = 0; - nic->ioaddr = pci->ioaddr & ~3; - - /* point to private storage */ - np = &npx; - - adjust_pci_device(pci); - - addr = pci_bar_start(pci, PCI_BASE_ADDRESS_0); - sz = pci_bar_size(pci, PCI_BASE_ADDRESS_0); - - /* BASE is used throughout to address the card */ - BASE = (unsigned long) ioremap(addr, sz); - if (!BASE) - return 0; - //rx_ring[0] = rx_ring; - //tx_ring[0] = tx_ring; - - /* read the mac address */ - base = (u8 *) BASE; - np->orig_mac[0] = readl(base + NvRegMacAddrA); - np->orig_mac[1] = readl(base + NvRegMacAddrB); - - nic->node_addr[0] = (np->orig_mac[1] >> 8) & 0xff; - nic->node_addr[1] = (np->orig_mac[1] >> 0) & 0xff; - nic->node_addr[2] = (np->orig_mac[0] >> 24) & 0xff; - nic->node_addr[3] = (np->orig_mac[0] >> 16) & 0xff; - nic->node_addr[4] = (np->orig_mac[0] >> 8) & 0xff; - nic->node_addr[5] = (np->orig_mac[0] >> 0) & 0xff; -#ifdef LINUX - if (!is_valid_ether_addr(dev->dev_addr)) { - /* - * Bad mac address. At least one bios sets the mac address - * to 01:23:45:67:89:ab - */ - printk(KERN_ERR - "%s: Invalid Mac address detected: %02x:%02x:%02x:%02x:%02x:%02x\n", - pci_name(pci_dev), dev->dev_addr[0], - dev->dev_addr[1], dev->dev_addr[2], - dev->dev_addr[3], dev->dev_addr[4], - dev->dev_addr[5]); - printk(KERN_ERR - "Please complain to your hardware vendor. Switching to a random MAC.\n"); - dev->dev_addr[0] = 0x00; - dev->dev_addr[1] = 0x00; - dev->dev_addr[2] = 0x6c; - get_random_bytes(&dev->dev_addr[3], 3); - } -#endif - printf("%s: MAC Address %!, ", pci->name, nic->node_addr); - - np->tx_flags = - cpu_to_le16(NV_TX_LASTPACKET | NV_TX_LASTPACKET1 | - NV_TX_VALID); - switch (pci->dev_id) { - case 0x01C3: // nforce - np->irqmask = NVREG_IRQMASK_WANTED_2; - np->irqmask |= NVREG_IRQ_TIMER; - break; - case 0x0066: // nforce2 - np->tx_flags |= cpu_to_le16(NV_TX_LASTPACKET1); - np->irqmask = NVREG_IRQMASK_WANTED_2; - np->irqmask |= NVREG_IRQ_TIMER; - break; - case 0x00D6: // nforce3 - np->tx_flags |= cpu_to_le16(NV_TX_LASTPACKET1); - np->irqmask = NVREG_IRQMASK_WANTED_2; - np->irqmask |= NVREG_IRQ_TIMER; - - } - dprintf(("%s: forcedeth.c: subsystem: %hX:%hX bound to %s\n", - pci->name, pci->vendor, pci->dev_id, pci->name)); - - forcedeth_reset(nic); -// if (board_found && valid_link) - /* point to NIC specific routines */ - dev->disable = forcedeth_disable; - nic->poll = forcedeth_poll; - nic->transmit = forcedeth_transmit; - nic->irq = forcedeth_irq; - return 1; -// } - /* else */ -} - -static struct pci_id forcedeth_nics[] = { - PCI_ROM(0x10de, 0x01C3, "nforce", "nForce Ethernet Controller"), - PCI_ROM(0x10de, 0x0066, "nforce2", "nForce2 Ethernet Controller"), - PCI_ROM(0x10de, 0x00D6, "nforce3", "nForce3 Ethernet Controller"), -}; - -struct pci_driver forcedeth_driver = { - .type = NIC_DRIVER, - .name = "forcedeth", - .probe = forcedeth_probe, - .ids = forcedeth_nics, - .id_count = sizeof(forcedeth_nics) / sizeof(forcedeth_nics[0]), - .class = 0, -}; diff --git a/usr/src/grub/grub-0.95/netboot/fsys_tftp.c b/usr/src/grub/grub-0.95/netboot/fsys_tftp.c deleted file mode 100644 index 0ba70d06ba..0000000000 --- a/usr/src/grub/grub-0.95/netboot/fsys_tftp.c +++ /dev/null @@ -1,877 +0,0 @@ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 2000,2001,2002,2004 Free Software Foundation, 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 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. - */ - -/* Based on "src/main.c" in etherboot-4.5.8. */ -/************************************************************************** -ETHERBOOT - BOOTP/TFTP Bootstrap Program - -Author: Martin Renters - Date: Dec/93 - -**************************************************************************/ - -/* #define TFTP_DEBUG 1 */ - -#include -#include - -#include "grub.h" -#include "tftp.h" -#include "nic.h" - -static int tftp_file_read_undi(const char *name, - int (*fnc)(unsigned char *, unsigned int, unsigned int, int)); -static int tftp_read_undi(char *addr, int size); -static int tftp_dir_undi(char *dirname); -static void tftp_close_undi(void); -static int buf_fill_undi(int abort); - -extern int use_bios_pxe; - -static int retry; -static unsigned short iport = 2000; -static unsigned short oport = 0; -static unsigned short block, prevblock; -static int bcounter; -static struct tftp_t tp, saved_tp; -static int packetsize; -static int buf_eof, buf_read; -static int saved_filepos; -static unsigned short len, saved_len; -static char *buf, *saved_name; - -/** - * tftp_read - * - * Read file with _name_, data handled by _fnc_. In fact, grub never - * use it, we just use it to read dhcp config file. - */ -static int await_tftp(int ival, void *ptr __unused, - unsigned short ptype __unused, struct iphdr *ip, - struct udphdr *udp) -{ - static int tftp_count = 0; - - if (!udp) { - return 0; - } - if (arptable[ARP_CLIENT].ipaddr.s_addr != ip->dest.s_addr) - return 0; - if (ntohs(udp->dest) != ival) - return 0; - tftp_count++; /* show progress */ - if ((tftp_count % 1000) == 0) - printf("."); - return 1; -} - -int tftp_file_read(const char *name, int (*fnc)(unsigned char *, unsigned int, unsigned int, int)) -{ - struct tftpreq_t tp; - struct tftp_t *tr; - int rc; - - if (use_bios_pxe) - return (tftp_file_read_undi(name, fnc)); - - retry = 0; - block = 0; - prevblock = 0; - bcounter = 0; - - - rx_qdrain(); - - tp.opcode = htons(TFTP_RRQ); - /* Warning: the following assumes the layout of bootp_t. - But that's fixed by the IP, UDP and BOOTP specs. */ - len = sizeof(tp.ip) + sizeof(tp.udp) + sizeof(tp.opcode) + - sprintf((char *)tp.u.rrq, "%s%coctet%cblksize%c%d", - name, 0, 0, 0, TFTP_MAX_PACKET) + 1; - if (!udp_transmit(arptable[ARP_SERVER].ipaddr.s_addr, ++iport, - TFTP_PORT, len, &tp)) - return (0); - for (;;) - { - long timeout; -#ifdef CONGESTED - timeout = rfc2131_sleep_interval(block?TFTP_REXMT: TIMEOUT, retry); -#else - timeout = rfc2131_sleep_interval(TIMEOUT, retry); -#endif - if (!await_reply(await_tftp, iport, NULL, timeout)) - { - if (!block && retry++ < MAX_TFTP_RETRIES) - { /* maybe initial request was lost */ - if (!udp_transmit(arptable[ARP_SERVER].ipaddr.s_addr, - ++iport, TFTP_PORT, len, &tp)) - return (0); - continue; - } -#ifdef CONGESTED - if (block && ((retry += TFTP_REXMT) < TFTP_TIMEOUT)) - { /* we resend our last ack */ -#ifdef MDEBUG - printf("\n"); -#endif - udp_transmit(arptable[ARP_SERVER].ipaddr.s_addr, - iport, oport, - TFTP_MIN_PACKET, &tp); - continue; - } -#endif - break; /* timeout */ - } - tr = (struct tftp_t *)&nic.packet[ETH_HLEN]; - if (tr->opcode == ntohs(TFTP_ERROR)) - { - printf("TFTP error %d (%s)\n", - ntohs(tr->u.err.errcode), - tr->u.err.errmsg); - break; - } - - if (tr->opcode == ntohs(TFTP_OACK)) { - char *p = tr->u.oack.data, *e; - - if (prevblock) /* shouldn't happen */ - continue; /* ignore it */ - len = ntohs(tr->udp.len) - sizeof(struct udphdr) - 2; - if (len > TFTP_MAX_PACKET) - goto noak; - e = p + len; - while (*p != '\0' && p < e) { -/* if (!strcasecmp("blksize", p)) { */ - if (!grub_strcmp("blksize", p)) { - p += 8; -/* if ((packetsize = strtoul(p, &p, 10)) < */ - if ((packetsize = getdec(&p)) < TFTP_DEFAULTSIZE_PACKET) - goto noak; - while (p < e && *p) p++; - if (p < e) - p++; - } - else { - noak: - tp.opcode = htons(TFTP_ERROR); - tp.u.err.errcode = 8; -/* - * Warning: the following assumes the layout of bootp_t. - * But that's fixed by the IP, UDP and BOOTP specs. - */ - len = sizeof(tp.ip) + sizeof(tp.udp) + sizeof(tp.opcode) + sizeof(tp.u.err.errcode) + -/* - * Normally bad form to omit the format string, but in this case - * the string we are copying from is fixed. sprintf is just being - * used as a strcpy and strlen. - */ - sprintf((char *)tp.u.err.errmsg, - "RFC1782 error") + 1; - udp_transmit(arptable[ARP_SERVER].ipaddr.s_addr, - iport, ntohs(tr->udp.src), - len, &tp); - return (0); - } - } - if (p > e) - goto noak; - block = tp.u.ack.block = 0; /* this ensures, that */ - /* the packet does not get */ - /* processed as data! */ - } - else if (tr->opcode == htons(TFTP_DATA)) { - len = ntohs(tr->udp.len) - sizeof(struct udphdr) - 4; - if (len > packetsize) /* shouldn't happen */ - continue; /* ignore it */ - block = ntohs(tp.u.ack.block = tr->u.data.block); } - else {/* neither TFTP_OACK nor TFTP_DATA */ - break; - } - - if ((block || bcounter) && (block != (unsigned short)(prevblock+1))) { - /* Block order should be continuous */ - tp.u.ack.block = htons(block = prevblock); - } - tp.opcode = htons(TFTP_ACK); - oport = ntohs(tr->udp.src); - udp_transmit(arptable[ARP_SERVER].ipaddr.s_addr, iport, - oport, TFTP_MIN_PACKET, &tp); /* ack */ - if ((unsigned short)(block-prevblock) != 1) { - /* Retransmission or OACK, don't process via callback - * and don't change the value of prevblock. */ - continue; - } - prevblock = block; - retry = 0; /* It's the right place to zero the timer? */ - if ((rc = fnc(tr->u.data.download, - ++bcounter, len, len < packetsize)) <= 0) - return(rc); - if (len < packetsize) { /* End of data --- fnc should not have returned */ - printf("tftp download complete, but\n"); - return (1); - } - } - return (0); -} - -/* Fill the buffer by receiving the data via the TFTP protocol. */ -static int -buf_fill (int abort) -{ -#ifdef TFTP_DEBUG - grub_printf ("buf_fill (%d)\n", abort); -#endif - - if (use_bios_pxe) - return (buf_fill_undi(abort)); - - while (! buf_eof && (buf_read + packetsize <= FSYS_BUFLEN)) - { - struct tftp_t *tr; - long timeout; - -#ifdef CONGESTED - timeout = rfc2131_sleep_interval (block ? TFTP_REXMT : TIMEOUT, retry); -#else - timeout = rfc2131_sleep_interval (TIMEOUT, retry); -#endif - - if (! await_reply (await_tftp, iport, NULL, timeout)) - { - if (user_abort) - return 0; - - if (! block && retry++ < MAX_TFTP_RETRIES) - { - /* Maybe initial request was lost. */ -#ifdef TFTP_DEBUG - grub_printf ("Maybe initial request was lost.\n"); -#endif - if (! udp_transmit (arptable[ARP_SERVER].ipaddr.s_addr, - ++iport, TFTP_PORT, len, &tp)) - return 0; - - continue; - } - -#ifdef CONGESTED - if (block && ((retry += TFTP_REXMT) < TFTP_TIMEOUT)) - { - /* We resend our last ack. */ -# ifdef TFTP_DEBUG - grub_printf ("\n"); -# endif - udp_transmit (arptable[ARP_SERVER].ipaddr.s_addr, - iport, oport, - TFTP_MIN_PACKET, &tp); - continue; - } -#endif - /* Timeout. */ - return 0; - } - - tr = (struct tftp_t *) &nic.packet[ETH_HLEN]; - if (tr->opcode == ntohs (TFTP_ERROR)) - { - grub_printf ("TFTP error %d (%s)\n", - ntohs (tr->u.err.errcode), - tr->u.err.errmsg); - return 0; - } - - if (tr->opcode == ntohs (TFTP_OACK)) - { - char *p = tr->u.oack.data, *e; - -#ifdef TFTP_DEBUG - grub_printf ("OACK "); -#endif - /* Shouldn't happen. */ - if (prevblock) - { - /* Ignore it. */ - grub_printf ("%s:%d: warning: PREVBLOCK != 0 (0x%x)\n", - __FILE__, __LINE__, prevblock); - continue; - } - - len = ntohs (tr->udp.len) - sizeof (struct udphdr) - 2; - if (len > TFTP_MAX_PACKET) - goto noak; - - e = p + len; - while (*p != '\000' && p < e) - { - if (! grub_strcmp ("blksize", p)) - { - p += 8; - if ((packetsize = getdec (&p)) < TFTP_DEFAULTSIZE_PACKET) - goto noak; -#ifdef TFTP_DEBUG - grub_printf ("blksize = %d\n", packetsize); -#endif - } - else if (! grub_strcmp ("tsize", p)) - { - p += 6; - if ((filemax = getdec (&p)) < 0) - { - filemax = -1; - goto noak; - } -#ifdef TFTP_DEBUG - grub_printf ("tsize = %d\n", filemax); -#endif - } - else - { - noak: -#ifdef TFTP_DEBUG - grub_printf ("NOAK\n"); -#endif - tp.opcode = htons (TFTP_ERROR); - tp.u.err.errcode = 8; - len = (grub_sprintf ((char *) tp.u.err.errmsg, - "RFC1782 error") - + sizeof (tp.ip) + sizeof (tp.udp) - + sizeof (tp.opcode) + sizeof (tp.u.err.errcode) - + 1); - udp_transmit (arptable[ARP_SERVER].ipaddr.s_addr, - iport, ntohs (tr->udp.src), - len, &tp); - return 0; - } - - while (p < e && *p) - p++; - - if (p < e) - p++; - } - - if (p > e) - goto noak; - - /* This ensures that the packet does not get processed as - data! */ - block = tp.u.ack.block = 0; - } - else if (tr->opcode == ntohs (TFTP_DATA)) - { -#ifdef TFTP_DEBUG - grub_printf ("DATA "); -#endif - len = ntohs (tr->udp.len) - sizeof (struct udphdr) - 4; - - /* Shouldn't happen. */ - if (len > packetsize) - { - /* Ignore it. */ - grub_printf ("%s:%d: warning: LEN > PACKETSIZE (0x%x > 0x%x)\n", - __FILE__, __LINE__, len, packetsize); - continue; - } - - block = ntohs (tp.u.ack.block = tr->u.data.block); - } - else - /* Neither TFTP_OACK nor TFTP_DATA. */ - break; - - if ((block || bcounter) && (block != prevblock + (unsigned short) 1)) - /* Block order should be continuous */ - tp.u.ack.block = htons (block = prevblock); - - /* Should be continuous. */ - tp.opcode = abort ? htons (TFTP_ERROR) : htons (TFTP_ACK); - oport = ntohs (tr->udp.src); - -#ifdef TFTP_DEBUG - grub_printf ("ACK\n"); -#endif - /* Ack. */ - udp_transmit (arptable[ARP_SERVER].ipaddr.s_addr, iport, - oport, TFTP_MIN_PACKET, &tp); - - if (abort) - { - buf_eof = 1; - break; - } - - /* Retransmission or OACK. */ - if ((unsigned short) (block - prevblock) != 1) - /* Don't process. */ - continue; - - prevblock = block; - /* Is it the right place to zero the timer? */ - retry = 0; - - /* In GRUB, this variable doesn't play any important role at all, - but use it for consistency with Etherboot. */ - bcounter++; - - /* Copy the downloaded data to the buffer. */ - grub_memmove (buf + buf_read, tr->u.data.download, len); - buf_read += len; - - /* End of data. */ - if (len < packetsize) - buf_eof = 1; - } - - return 1; -} - -/* Send the RRQ whose length is LEN. */ -static int -send_rrq (void) -{ - /* Initialize some variables. */ - retry = 0; - block = 0; - prevblock = 0; - packetsize = TFTP_DEFAULTSIZE_PACKET; - bcounter = 0; - - buf = (char *) FSYS_BUF; - buf_eof = 0; - buf_read = 0; - saved_filepos = 0; - - rx_qdrain(); - -#ifdef TFTP_DEBUG - grub_printf ("send_rrq ()\n"); - { - int i; - char *p; - - for (i = 0, p = (char *) &tp; i < len; i++) - if (p[i] >= ' ' && p[i] <= '~') - grub_putchar (p[i]); - else - grub_printf ("\\%x", (unsigned) p[i]); - - grub_putchar ('\n'); - } -#endif - /* Send the packet. */ - return udp_transmit (arptable[ARP_SERVER].ipaddr.s_addr, ++iport, - TFTP_PORT, len, &tp); -} - -/* Mount the network drive. If the drive is ready, return one, otherwise - return zero. */ -int -tftp_mount (void) -{ - /* Check if the current drive is the network drive. */ - if (current_drive != NETWORK_DRIVE) - return 0; - - /* If the drive is not initialized yet, abort. */ - if (! network_ready) - return 0; - - return 1; -} - -/* Read up to SIZE bytes, returned in ADDR. */ -int -tftp_read (char *addr, int size) -{ - /* How many bytes is read? */ - int ret = 0; - -#ifdef TFTP_DEBUG - grub_printf ("tftp_read (0x%x, %d)\n", (int) addr, size); -#endif - - if (use_bios_pxe) - return (tftp_read_undi(addr, size)); - - if (filepos < saved_filepos) - { - /* Uggh.. FILEPOS has been moved backwards. So reopen the file. */ - buf_read = 0; - buf_fill (1); - grub_memmove ((char *) &tp, (char *) &saved_tp, saved_len); - len = saved_len; -#ifdef TFTP_DEBUG - { - int i; - grub_printf ("opcode = 0x%x, rrq = ", (unsigned long) tp.opcode); - for (i = 0; i < TFTP_DEFAULTSIZE_PACKET; i++) - { - if (tp.u.rrq[i] >= ' ' && tp.u.rrq[i] <= '~') - grub_putchar (tp.u.rrq[i]); - else - grub_putchar ('*'); - } - grub_putchar ('\n'); - } -#endif - - if (! send_rrq ()) - { - errnum = ERR_WRITE; - return 0; - } - } - - while (size > 0) - { - int amt = buf_read + saved_filepos - filepos; - - /* If the length that can be copied from the buffer is over the - requested size, cut it down. */ - if (amt > size) - amt = size; - - if (amt > 0) - { - /* Copy the buffer to the supplied memory space. */ - grub_memmove (addr, buf + filepos - saved_filepos, amt); - size -= amt; - addr += amt; - filepos += amt; - ret += amt; - - /* If the size of the empty space becomes small, move the unused - data forwards. */ - if (filepos - saved_filepos > FSYS_BUFLEN / 2) - { - grub_memmove (buf, buf + FSYS_BUFLEN / 2, FSYS_BUFLEN / 2); - buf_read -= FSYS_BUFLEN / 2; - saved_filepos += FSYS_BUFLEN / 2; - } - } - else - { - /* Skip the whole buffer. */ - saved_filepos += buf_read; - buf_read = 0; - } - - /* Read the data. */ - if (size > 0 && ! buf_fill (0)) - { - errnum = ERR_READ; - return 0; - } - - /* Sanity check. */ - if (size > 0 && buf_read == 0) - { - errnum = ERR_READ; - return 0; - } - } - - return ret; -} - -/* Check if the file DIRNAME really exists. Get the size and save it in - FILEMAX. */ -int -tftp_dir (char *dirname) -{ - int ch; - -#ifdef TFTP_DEBUG - grub_printf ("tftp_dir (%s)\n", dirname); -#endif - - if (use_bios_pxe) - return (tftp_dir_undi(dirname)); - - /* In TFTP, there is no way to know what files exist. */ - if (print_possibilities) - return 1; - - /* Don't know the size yet. */ - filemax = -1; - - reopen: - /* Construct the TFTP request packet. */ - tp.opcode = htons (TFTP_RRQ); - /* Terminate the filename. */ - ch = nul_terminate (dirname); - /* Make the request string (octet, blksize and tsize). */ - len = (grub_sprintf ((char *) tp.u.rrq, - "%s%coctet%cblksize%c%d%ctsize%c0", - dirname, 0, 0, 0, TFTP_MAX_PACKET, 0, 0) - + sizeof (tp.ip) + sizeof (tp.udp) + sizeof (tp.opcode) + 1); - /* Restore the original DIRNAME. */ - dirname[grub_strlen (dirname)] = ch; - /* Save the TFTP packet so that we can reopen the file later. */ - grub_memmove ((char *) &saved_tp, (char *) &tp, len); - saved_len = len; - if (! send_rrq ()) - { - errnum = ERR_WRITE; - return 0; - } - - /* Read the data. */ - if (! buf_fill (0)) - { - errnum = ERR_FILE_NOT_FOUND; - return 0; - } - - if (filemax == -1) - { - /* The server doesn't support the "tsize" option, so we must read - the file twice... */ - - /* Zero the size of the file. */ - filemax = 0; - do - { - /* Add the length of the downloaded data. */ - filemax += buf_read; - /* Reset the offset. Just discard the contents of the buffer. */ - buf_read = 0; - /* Read the data. */ - if (! buf_fill (0)) - { - errnum = ERR_READ; - return 0; - } - } - while (! buf_eof); - - /* Maybe a few amounts of data remains. */ - filemax += buf_read; - - /* Retry the open instruction. */ - goto reopen; - } - - return 1; -} - -/* Close the file. */ -void -tftp_close (void) -{ -#ifdef TFTP_DEBUG - grub_printf ("tftp_close ()\n"); -#endif - - if (use_bios_pxe) { - tftp_close_undi(); - return; - } - - buf_read = 0; - buf_fill (1); -} - -/* tftp implementation using BIOS established PXE stack */ - -static int tftp_file_read_undi(const char *name, - int (*fnc)(unsigned char *, unsigned int, unsigned int, int)) -{ - int rc; - uint16_t len; - - buf = (char *)&nic.packet; - /* open tftp session */ - if (eb_pxenv_tftp_open(name, arptable[ARP_SERVER].ipaddr, - arptable[ARP_GATEWAY].ipaddr, &packetsize) == 0) - return (0); - - /* read blocks and invoke fnc for each block */ - for (;;) { - rc = eb_pxenv_tftp_read(buf, &len); - if (rc == 0) - break; - rc = fnc(buf, ++block, len, len < packetsize); - if (rc <= 0 || len < packetsize) - break; - } - - (void) eb_pxenv_tftp_close(); - return (rc > 0 ? 1 : 0); -} - -/* Fill the buffer by reading the data via the TFTP protocol. */ -static int -buf_fill_undi(int abort) -{ - int rc; - uint8_t *tmpbuf; - - while (! buf_eof && (buf_read + packetsize <= FSYS_BUFLEN)) { - poll_interruptions(); - if (user_abort) - return 0; - if (abort) { - buf_eof = 1; - break; - } - - if (eb_pxenv_tftp_read(buf + buf_read, &len) == 0) - return (0); - - buf_read += len; - - /* End of data. */ - if (len < packetsize) - buf_eof = 1; - } - return 1; -} - -static void -tftp_reopen_undi(void) -{ - tftp_close(); - (void) eb_pxenv_tftp_open(saved_name, arptable[ARP_SERVER].ipaddr, - arptable[ARP_GATEWAY].ipaddr, &packetsize); - - buf_eof = 0; - buf_read = 0; - saved_filepos = 0; -} - -/* Read up to SIZE bytes, returned in ADDR. */ -static int -tftp_read_undi(char *addr, int size) -{ - int ret = 0; - - if (filepos < saved_filepos) { - /* Uggh.. FILEPOS has been moved backwards. reopen the file. */ - tftp_reopen_undi(); - } - - while (size > 0) { - int amt = buf_read + saved_filepos - filepos; - - /* If the length that can be copied from the buffer is over - the requested size, cut it down. */ - if (amt > size) - amt = size; - - if (amt > 0) { - /* Copy the buffer to the supplied memory space. */ - grub_memmove (addr, buf + filepos - saved_filepos, amt); - size -= amt; - addr += amt; - filepos += amt; - ret += amt; - - /* If the size of the empty space becomes small, - * move the unused data forwards. - */ - if (filepos - saved_filepos > FSYS_BUFLEN / 2) { - grub_memmove (buf, buf + FSYS_BUFLEN / 2, - FSYS_BUFLEN / 2); - buf_read -= FSYS_BUFLEN / 2; - saved_filepos += FSYS_BUFLEN / 2; - } - } else { - /* Skip the whole buffer. */ - saved_filepos += buf_read; - buf_read = 0; - } - - /* Read the data. */ - if (size > 0 && ! buf_fill (0)) { - errnum = ERR_READ; - return 0; - } - - /* Sanity check. */ - if (size > 0 && buf_read == 0) { - errnum = ERR_READ; - return 0; - } - } - - return ret; -} - -static int -tftp_dir_undi(char *dirname) -{ - int rc, ch; - uint16_t len; - - /* In TFTP, there is no way to know what files exist. */ - if (print_possibilities) - return 1; - - /* name may be space terminated */ - ch = nul_terminate(dirname); - saved_name = (char *)&saved_tp; - sprintf(saved_name, "%s", dirname); - - /* Restore the original dirname */ - dirname[grub_strlen (dirname)] = ch; - - /* get the file size; must call before tftp_open */ - rc = eb_pxenv_tftp_get_fsize(saved_name, arptable[ARP_SERVER].ipaddr, - arptable[ARP_GATEWAY].ipaddr, &filemax); - - /* open tftp session */ - if (eb_pxenv_tftp_open(saved_name, arptable[ARP_SERVER].ipaddr, - arptable[ARP_GATEWAY].ipaddr, &packetsize) == 0) - return (0); - - buf = (char *) FSYS_BUF; - buf_eof = 0; - buf_read = 0; - saved_filepos = 0; - - if (rc == 0) { - /* Read the entire file to get filemax */ - filemax = 0; - do { - /* Add the length of the downloaded data. */ - filemax += buf_read; - buf_read = 0; - if (! buf_fill (0)) { - errnum = ERR_READ; - return 0; - } - } while (! buf_eof); - - /* Maybe a few amounts of data remains. */ - filemax += buf_read; - - tftp_reopen_undi(); /* reopen file to read from beginning */ - } - - return (1); -} - -static void -tftp_close_undi(void) -{ - buf_read = 0; - buf_fill (1); - (void) eb_pxenv_tftp_close(); -} diff --git a/usr/src/grub/grub-0.95/netboot/grub.h b/usr/src/grub/grub-0.95/netboot/grub.h deleted file mode 100644 index 3d0df44b0d..0000000000 --- a/usr/src/grub/grub-0.95/netboot/grub.h +++ /dev/null @@ -1,171 +0,0 @@ -#ifndef GRUB_H -#define GRUB_H - -#include "osdep.h" -#include "byteswap.h" -#include "in.h" -#include "ip.h" -#include "udp.h" -#include "if_ether.h" -#include "latch.h" -#include "io.h" -#include "nic.h" -#include - -#define K_ESC '\033' -#define K_EOF '\04' /* Ctrl-D */ -#define K_INTR '\03' /* Ctrl-C */ - -#ifndef MAX_RPC_RETRIES -#define MAX_RPC_RETRIES 20 -#endif - - -/* Inter-packet retry in ticks */ -#ifndef TIMEOUT -#define TIMEOUT (10*TICKS_PER_SEC) -#endif - -#ifndef NULL -#define NULL ((void *)0) -#endif - - -#define ARP_CLIENT 0 -#define ARP_SERVER 1 -#define ARP_GATEWAY 2 -#define MAX_ARP ARP_GATEWAY+1 - -#define IGMP_SERVER 0 -#define MAX_IGMP IGMP_SERVER+1 - -#define RARP_REQUEST 3 -#define RARP_REPLY 4 - - -#define MULTICAST_MASK 0xF0000000 -#define MULTICAST_NETWORK 0xE0000000 - -struct arptable_t { - in_addr ipaddr; - uint8_t node[6]; -}; - -struct igmptable_t { - in_addr group; - unsigned long time; -}; - -#define KERNEL_BUF (BOOTP_DATA_ADDR->bootp_reply.bp_file) - -#define FLOPPY_BOOT_LOCATION 0x7c00 -/* Must match offsets in loader.S */ -#define ROM_SEGMENT 0x1fa -#define ROM_LENGTH 0x1fc - -#define ROM_INFO_LOCATION (FLOPPY_BOOT_LOCATION+ROM_SEGMENT) -/* at end of floppy boot block */ - - - -/* Define a type for passing info to a loaded program */ -struct ebinfo { - uint8_t major, minor; /* Version */ - uint16_t flags; /* Bit flags */ -}; - -/*************************************************************************** -External prototypes -***************************************************************************/ -extern void rx_qdrain P((void)); -extern int tftp P((const char *name, int (*)(unsigned char *, unsigned int, unsigned int, int))); -extern int ip_transmit P((int len, const void *buf)); -extern void build_ip_hdr P((unsigned long destip, int ttl, int protocol, - int option_len, int len, const void *buf)); -extern void build_udp_hdr P((unsigned long destip, - unsigned int srcsock, unsigned int destsock, int ttl, - int len, const void *buf)); -extern int udp_transmit P((unsigned long destip, unsigned int srcsock, - unsigned int destsock, int len, const void *buf)); -typedef int (*reply_t)(int ival, void *ptr, unsigned short ptype, struct iphdr *ip, struct udphdr *udp); -extern int await_reply P((reply_t reply, int ival, void *ptr, long timeout)); -extern int decode_rfc1533 P((unsigned char *, unsigned int, unsigned int, int)); -extern void join_group(int slot, unsigned long group); -extern void leave_group(int slot); -#define RAND_MAX 2147483647L -extern uint16_t ipchksum P((const void *ip, unsigned long len)); -extern uint16_t add_ipchksums P((unsigned long offset, uint16_t sum, uint16_t new)); -extern int32_t random P((void)); -extern long rfc2131_sleep_interval P((long base, int exp)); -extern long rfc1112_sleep_interval P((long base, int exp)); -#ifndef DOWNLOAD_PROTO_TFTP -#define tftp(fname, load_block) 0 -#endif -extern void cleanup P((void)); - -/* misc.c */ -extern void twiddle P((void)); -extern void sleep P((int secs)); -extern void interruptible_sleep P((int secs)); -extern void poll_interruptions P((void)); -extern int strcasecmp P((const char *a, const char *b)); -extern char *substr P((const char *a, const char *b)); -extern unsigned long strtoul P((const char *p, const char **, int base)); -extern void printf P((const char *, ...)); -extern int sprintf P((char *, const char *, ...)); -extern int inet_aton P((char *p, in_addr *i)); -extern void putchar P((int)); -extern int getchar P((void)); -extern int iskey P((void)); - -extern void grub_printf(const char *, ...); -extern char config_file[128]; -extern void etherboot_printf(const char *, ...); -extern int etherboot_sprintf(char *, const char *, ...); -extern int getdec(char **s); -extern void cleanup_net(void); -extern void print_network_configuration (void); -extern int ifconfig (char *, char *, char *, char *); -extern struct arptable_t arptable[MAX_ARP]; - -#undef printf -#undef sprintf -#define printf etherboot_printf -#define sprintf etherboot_sprintf - -#ifdef DEBUG -#define EnterFunction(func) printf("Enter: " func "\n"); -#define LeaveFunction(func) printf("Leave: " func "\n"); -#else -#define EnterFunction(func) -#define LeaveFunction(func) -#endif - -/* - * Some codes from etherboot use a level in DEBUG. Define it to be - * zero means no debug info output, that will make them silence in - * compiling. Up it as you want. - */ -#ifndef DEBUG -# define DEBUG 0 -#endif - -/*#define RPC_DEBUG*/ - -extern char *hostname; - -extern int hostnamelen; -/* Whether network is ready */ -extern int network_ready; - -/* User aborted in await_reply if not zero */ -extern int user_abort; - -extern int rarp(void); -extern int grub_eth_probe(void); -extern int bootp(void); - -extern int dhcp(void); - -extern struct nic nic; -#endif /* GRUB_H */ diff --git a/usr/src/grub/grub-0.95/netboot/i386_byteswap.h b/usr/src/grub/grub-0.95/netboot/i386_byteswap.h deleted file mode 100644 index e7e8bbcd95..0000000000 --- a/usr/src/grub/grub-0.95/netboot/i386_byteswap.h +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef ETHERBOOT_BITS_BYTESWAP_H -#define ETHERBOOT_BITS_BYTESWAP_H - -#include "types.h" -static inline uint16_t __i386_bswap_16(uint16_t x) -{ - __asm__("xchgb %b0,%h0\n\t" - : "=q" (x) - : "0" (x)); - return x; -} - -static inline uint32_t __i386_bswap_32(uint32_t x) -{ - __asm__("xchgb %b0,%h0\n\t" - "rorl $16,%0\n\t" - "xchgb %b0,%h0" - : "=q" (x) - : "0" (x)); - return x; -} - - -#define __bswap_constant_16(x) \ - ((uint16_t)((((uint16_t)(x) & 0x00ff) << 8) | \ - (((uint16_t)(x) & 0xff00) >> 8))) - -#define __bswap_constant_32(x) \ - ((uint32_t)((((uint32_t)(x) & 0x000000ffU) << 24) | \ - (((uint32_t)(x) & 0x0000ff00U) << 8) | \ - (((uint32_t)(x) & 0x00ff0000U) >> 8) | \ - (((uint32_t)(x) & 0xff000000U) >> 24))) - -#define __bswap_16(x) \ - (__builtin_constant_p(x) ? \ - __bswap_constant_16(x) : \ - __i386_bswap_16(x)) - - -#define __bswap_32(x) \ - (__builtin_constant_p(x) ? \ - __bswap_constant_32(x) : \ - __i386_bswap_32(x)) - - -#endif /* ETHERBOOT_BITS_BYTESWAP_H */ diff --git a/usr/src/grub/grub-0.95/netboot/i386_elf.h b/usr/src/grub/grub-0.95/netboot/i386_elf.h deleted file mode 100644 index dad9c7b8fd..0000000000 --- a/usr/src/grub/grub-0.95/netboot/i386_elf.h +++ /dev/null @@ -1,91 +0,0 @@ -#ifndef I386_BITS_ELF_H -#define I386_BITS_ELF_H - -#include "cpu.h" - -#ifdef CONFIG_X86_64 -/* ELF Defines for the 64bit version of the current architecture */ -#define EM_CURRENT_64 EM_X86_64 -#define EM_CURRENT_64_PRESENT ( \ - CPU_FEATURE_P(cpu_info.x86_capability, LM) && \ - CPU_FEATURE_P(cpu_info.x86_capability, PAE) && \ - CPU_FEATURE_P(cpu_info.x86_capability, PSE)) - -#define ELF_CHECK_X86_64_ARCH(x) \ - (EM_CURRENT_64_PRESENT && ((x).e_machine == EM_X86_64)) -#define __unused_i386 -#else -#define ELF_CHECK_X86_64_ARCH(x) 0 -#define __unused_i386 __unused -#endif - - -/* ELF Defines for the current architecture */ -#define EM_CURRENT EM_386 -#define ELFDATA_CURRENT ELFDATA2LSB - -#define ELF_CHECK_I386_ARCH(x) \ - (((x).e_machine == EM_386) || ((x).e_machine == EM_486)) - -#define ELF_CHECK_ARCH(x) \ - ((ELF_CHECK_I386_ARCH(x) || ELF_CHECK_X86_64_ARCH(x)) && \ - ((x).e_entry <= 0xffffffffUL)) - -#ifdef IMAGE_FREEBSD -/* - * FreeBSD has this rather strange "feature" of its design. - * At some point in its evolution, FreeBSD started to rely - * externally on private/static/debug internal symbol information. - * That is, some of the interfaces that software uses to access - * and work with the FreeBSD kernel are made available not - * via the shared library symbol information (the .DYNAMIC section) - * but rather the debug symbols. This means that any symbol, not - * just publicly defined symbols can be (and are) used by system - * tools to make the system work. (such as top, swapinfo, swapon, - * etc) - * - * Even worse, however, is the fact that standard ELF loaders do - * not know how to load the symbols since they are not within - * an ELF PT_LOAD section. The kernel needs these symbols to - * operate so the following changes/additions to the boot - * loading of EtherBoot have been made to get the kernel to load. - * All of the changes are within IMAGE_FREEBSD such that the - * extra/changed code only compiles when FREEBSD support is - * enabled. - */ - -/* - * Section header for FreeBSD (debug symbol kludge!) support - */ -typedef struct { - Elf32_Word sh_name; /* Section name (index into the - section header string table). */ - Elf32_Word sh_type; /* Section type. */ - Elf32_Word sh_flags; /* Section flags. */ - Elf32_Addr sh_addr; /* Address in memory image. */ - Elf32_Off sh_offset; /* Offset in file. */ - Elf32_Size sh_size; /* Size in bytes. */ - Elf32_Word sh_link; /* Index of a related section. */ - Elf32_Word sh_info; /* Depends on section type. */ - Elf32_Size sh_addralign; /* Alignment in bytes. */ - Elf32_Size sh_entsize; /* Size of each entry in section. */ -} Elf32_Shdr; - -/* sh_type */ -#define SHT_SYMTAB 2 /* symbol table section */ -#define SHT_STRTAB 3 /* string table section */ - -/* - * Module information subtypes (for the metadata that we need to build) - */ -#define MODINFO_END 0x0000 /* End of list */ -#define MODINFO_NAME 0x0001 /* Name of module (string) */ -#define MODINFO_TYPE 0x0002 /* Type of module (string) */ -#define MODINFO_METADATA 0x8000 /* Module-specfic */ - -#define MODINFOMD_SSYM 0x0003 /* start of symbols */ -#define MODINFOMD_ESYM 0x0004 /* end of symbols */ - -#endif /* IMAGE_FREEBSD */ - -#endif /* I386_BITS_ELF_H */ diff --git a/usr/src/grub/grub-0.95/netboot/i386_endian.h b/usr/src/grub/grub-0.95/netboot/i386_endian.h deleted file mode 100644 index 413e702dba..0000000000 --- a/usr/src/grub/grub-0.95/netboot/i386_endian.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef ETHERBOOT_BITS_ENDIAN_H -#define ETHERBOOT_BITS_ENDIAN_H - -#define __BYTE_ORDER __LITTLE_ENDIAN - -#endif /* ETHERBOOT_BITS_ENDIAN_H */ diff --git a/usr/src/grub/grub-0.95/netboot/i386_timer.c b/usr/src/grub/grub-0.95/netboot/i386_timer.c deleted file mode 100644 index b5ad5e6f09..0000000000 --- a/usr/src/grub/grub-0.95/netboot/i386_timer.c +++ /dev/null @@ -1,192 +0,0 @@ -/* A couple of routines to implement a low-overhead timer for drivers */ - - /* - * 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. - */ -#include "grub.h" -#include "osdep.h" -#include "io.h" -#include "timer.h" -#include "latch.h" - -void __load_timer2(unsigned int ticks) -{ - /* - * Now let's take care of PPC channel 2 - * - * Set the Gate high, program PPC channel 2 for mode 0, - * (interrupt on terminal count mode), binary count, - * load 5 * LATCH count, (LSB and MSB) to begin countdown. - * - * Note some implementations have a bug where the high bits byte - * of channel 2 is ignored. - */ - /* Set up the timer gate, turn off the speaker */ - /* Set the Gate high, disable speaker */ - outb((inb(PPC_PORTB) & ~PPCB_SPKR) | PPCB_T2GATE, PPC_PORTB); - /* binary, mode 0, LSB/MSB, Ch 2 */ - outb(TIMER2_SEL|WORD_ACCESS|MODE0|BINARY_COUNT, TIMER_MODE_PORT); - /* LSB of ticks */ - outb(ticks & 0xFF, TIMER2_PORT); - /* MSB of ticks */ - outb(ticks >> 8, TIMER2_PORT); -} - -static int __timer2_running(void) -{ - return ((inb(PPC_PORTB) & PPCB_T2OUT) == 0); -} - -#if !defined(CONFIG_TSC_CURRTICKS) -void setup_timers(void) -{ - return; -} - -void load_timer2(unsigned int ticks) -{ - return __load_timer2(ticks); -} - -int timer2_running(void) -{ - return __timer2_running(); -} - -void ndelay(unsigned int nsecs) -{ - waiton_timer2((nsecs * CLOCK_TICK_RATE)/1000000000); -} -void udelay(unsigned int usecs) -{ - waiton_timer2((usecs * TICKS_PER_MS)/1000); -} -#endif /* !defined(CONFIG_TSC_CURRTICKS) */ - -#if defined(CONFIG_TSC_CURRTICKS) - -#define rdtsc(low,high) \ - __asm__ __volatile__("rdtsc" : "=a" (low), "=d" (high)) - -#define rdtscll(val) \ - __asm__ __volatile__ ("rdtsc" : "=A" (val)) - - -/* Number of clock ticks to time with the rtc */ -#define LATCH 0xFF - -#define LATCHES_PER_SEC ((CLOCK_TICK_RATE + (LATCH/2))/LATCH) -#define TICKS_PER_LATCH ((LATCHES_PER_SEC + (TICKS_PER_SEC/2))/TICKS_PER_SEC) - -static void sleep_latch(void) -{ - __load_timer2(LATCH); - while(__timer2_running()); -} - -/* ------ Calibrate the TSC ------- - * Time how long it takes to excute a loop that runs in known time. - * And find the convertion needed to get to CLOCK_TICK_RATE - */ - - -static unsigned long long calibrate_tsc(void) -{ - unsigned long startlow, starthigh; - unsigned long endlow, endhigh; - - rdtsc(startlow,starthigh); - sleep_latch(); - rdtsc(endlow,endhigh); - - /* 64-bit subtract - gcc just messes up with long longs */ - __asm__("subl %2,%0\n\t" - "sbbl %3,%1" - :"=a" (endlow), "=d" (endhigh) - :"g" (startlow), "g" (starthigh), - "0" (endlow), "1" (endhigh)); - - /* Error: ECPUTOOFAST */ - if (endhigh) - goto bad_ctc; - - endlow *= TICKS_PER_LATCH; - return endlow; - - /* - * The CTC wasn't reliable: we got a hit on the very first read, - * or the CPU was so fast/slow that the quotient wouldn't fit in - * 32 bits.. - */ -bad_ctc: - printf("bad_ctc\n"); - return 0; -} - -static unsigned long clocks_per_tick; -void setup_timers(void) -{ - if (!clocks_per_tick) { - clocks_per_tick = calibrate_tsc(); - /* Display the CPU Mhz to easily test if the calibration was bad */ - printf("CPU %ld Mhz\n", (clocks_per_tick/1000 * TICKS_PER_SEC)/1000); - } -} - -unsigned long currticks(void) -{ - unsigned long clocks_high, clocks_low; - unsigned long currticks; - /* Read the Time Stamp Counter */ - rdtsc(clocks_low, clocks_high); - - /* currticks = clocks / clocks_per_tick; */ - __asm__("divl %1" - :"=a" (currticks) - :"r" (clocks_per_tick), "0" (clocks_low), "d" (clocks_high)); - - - return currticks; -} - -static unsigned long long timer_timeout; -static int __timer_running(void) -{ - unsigned long long now; - rdtscll(now); - return now < timer_timeout; -} - -void udelay(unsigned int usecs) -{ - unsigned long long now; - rdtscll(now); - timer_timeout = now + usecs * ((clocks_per_tick * TICKS_PER_SEC)/(1000*1000)); - while(__timer_running()); -} -void ndelay(unsigned int nsecs) -{ - unsigned long long now; - rdtscll(now); - timer_timeout = now + nsecs * ((clocks_per_tick * TICKS_PER_SEC)/(1000*1000*1000)); - while(__timer_running()); -} - -void load_timer2(unsigned int timer2_ticks) -{ - unsigned long long now; - unsigned long clocks; - rdtscll(now); - clocks = timer2_ticks * ((clocks_per_tick * TICKS_PER_SEC)/CLOCK_TICK_RATE); - timer_timeout = now + clocks; -} - -int timer2_running(void) -{ - return __timer_running(); -} - -#endif /* RTC_CURRTICKS */ diff --git a/usr/src/grub/grub-0.95/netboot/if_arp.h b/usr/src/grub/grub-0.95/netboot/if_arp.h deleted file mode 100644 index 73b59a4c6c..0000000000 --- a/usr/src/grub/grub-0.95/netboot/if_arp.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef _IF_ARP_H -#define _IF_ARP_H - -#include "types.h" - -#define ARP_REQUEST 1 -#define ARP_REPLY 2 - -#ifndef MAX_ARP_RETRIES -#define MAX_ARP_RETRIES 20 -#endif - -/* - * A pity sipaddr and tipaddr are not longword aligned or we could use - * in_addr. No, I don't want to use #pragma packed. - */ -struct arprequest { - uint16_t hwtype; - uint16_t protocol; - uint8_t hwlen; - uint8_t protolen; - uint16_t opcode; - uint8_t shwaddr[6]; - uint8_t sipaddr[4]; - uint8_t thwaddr[6]; - uint8_t tipaddr[4]; -}; - -#endif /* _IF_ARP_H */ diff --git a/usr/src/grub/grub-0.95/netboot/if_ether.h b/usr/src/grub/grub-0.95/netboot/if_ether.h deleted file mode 100644 index 7a253dd5d5..0000000000 --- a/usr/src/grub/grub-0.95/netboot/if_ether.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef _IF_ETHER_H -#define _IF_ETHER_H - -/* - I'm moving towards the defined names in linux/if_ether.h for clarity. - The confusion between 60/64 and 1514/1518 arose because the NS8390 - counts the 4 byte frame checksum in the incoming packet, but not - in the outgoing packet. 60/1514 are the correct numbers for most - if not all of the other NIC controllers. -*/ - -#define ETH_ALEN 6 /* Size of Ethernet address */ -#define ETH_HLEN 14 /* Size of ethernet header */ -#define ETH_ZLEN 60 /* Minimum packet */ -#define ETH_FRAME_LEN 1514 /* Maximum packet */ -#define ETH_DATA_ALIGN 2 /* Amount needed to align the data after an ethernet header */ -#ifndef ETH_MAX_MTU -#define ETH_MAX_MTU (ETH_FRAME_LEN-ETH_HLEN) -#endif - -#endif /* _IF_ETHER_H */ diff --git a/usr/src/grub/grub-0.95/netboot/igmp.h b/usr/src/grub/grub-0.95/netboot/igmp.h deleted file mode 100644 index a83129092c..0000000000 --- a/usr/src/grub/grub-0.95/netboot/igmp.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef _IGMP_H -#define _IGMP_H - -/* Max interval between IGMP packets */ -#define IGMP_INTERVAL (10*TICKS_PER_SEC) -#define IGMPv1_ROUTER_PRESENT_TIMEOUT (400*TICKS_PER_SEC) - -#define IGMP_QUERY 0x11 -#define IGMPv1_REPORT 0x12 -#define IGMPv2_REPORT 0x16 -#define IGMP_LEAVE 0x17 -#define GROUP_ALL_HOSTS 0xe0000001 /* 224.0.0.1 Host byte order */ - -struct igmp { - uint8_t type; - uint8_t response_time; - uint16_t chksum; - in_addr group; -}; - -struct igmp_ip_t { /* Format of an igmp ip packet */ - struct iphdr ip; - uint8_t router_alert[4]; /* Router alert option */ - struct igmp igmp; -}; - -#endif /* _IGMP_H */ diff --git a/usr/src/grub/grub-0.95/netboot/in.h b/usr/src/grub/grub-0.95/netboot/in.h deleted file mode 100644 index e6d29f4db8..0000000000 --- a/usr/src/grub/grub-0.95/netboot/in.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef _IN_H -#define _IN_H - -#include "types.h" - -#define IP 0x0800 -#define ARP 0x0806 -#define RARP 0x8035 - -#define IP_ICMP 1 -#define IP_IGMP 2 -#define IP_UDP 17 - -/* Same after going through htonl */ -#define IP_BROADCAST 0xFFFFFFFF - -typedef struct { - uint32_t s_addr; -} in_addr; - -#endif /* _IN_H */ diff --git a/usr/src/grub/grub-0.95/netboot/io.h b/usr/src/grub/grub-0.95/netboot/io.h deleted file mode 100644 index a6e4880e3f..0000000000 --- a/usr/src/grub/grub-0.95/netboot/io.h +++ /dev/null @@ -1,239 +0,0 @@ -#ifndef IO_H -#define IO_H - - -/* Amount of relocation etherboot is experiencing */ -extern unsigned long virt_offset; - -/* Don't require identity mapped physical memory, - * osloader.c is the only valid user at the moment. - */ -unsigned long virt_to_phys(volatile const void *virt_addr); -void *phys_to_virt(unsigned long phys_addr); - -/* virt_to_bus converts an addresss inside of etherboot [_start, _end] - * into a memory access cards can use. - */ -#define virt_to_bus virt_to_phys - - -/* bus_to_virt reverses virt_to_bus, the address must be output - * from virt_to_bus to be valid. This function does not work on - * all bus addresses. - */ -#define bus_to_virt phys_to_virt - -/* ioremap converts a random 32bit bus address into something - * etherboot can access. - */ -static inline void *ioremap(unsigned long bus_addr, unsigned long length __unused) -{ - return bus_to_virt(bus_addr); -} - -/* iounmap cleans up anything ioremap had to setup */ -static inline void iounmap(void *virt_addr __unused) -{ - return; -} - -/* - * This file contains the definitions for the x86 IO instructions - * inb/inw/inl/outb/outw/outl and the "string versions" of the same - * (insb/insw/insl/outsb/outsw/outsl). You can also use "pausing" - * versions of the single-IO instructions (inb_p/inw_p/..). - * - * This file is not meant to be obfuscating: it's just complicated - * to (a) handle it all in a way that makes gcc able to optimize it - * as well as possible and (b) trying to avoid writing the same thing - * over and over again with slight variations and possibly making a - * mistake somewhere. - */ - -/* - * Thanks to James van Artsdalen for a better timing-fix than - * the two short jumps: using outb's to a nonexistent port seems - * to guarantee better timings even on fast machines. - * - * On the other hand, I'd like to be sure of a non-existent port: - * I feel a bit unsafe about using 0x80 (should be safe, though) - * - * Linus - */ - -#ifdef SLOW_IO_BY_JUMPING -#define __SLOW_DOWN_IO __asm__ __volatile__("jmp 1f\n1:\tjmp 1f\n1:") -#else -#define __SLOW_DOWN_IO __asm__ __volatile__("outb %al,$0x80") -#endif - -#ifdef REALLY_SLOW_IO -#define SLOW_DOWN_IO { __SLOW_DOWN_IO; __SLOW_DOWN_IO; __SLOW_DOWN_IO; __SLOW_DOWN_IO; } -#else -#define SLOW_DOWN_IO __SLOW_DOWN_IO -#endif - -/* - * readX/writeX() are used to access memory mapped devices. On some - * architectures the memory mapped IO stuff needs to be accessed - * differently. On the x86 architecture, we just read/write the - * memory location directly. - */ -#define readb(addr) (*(volatile unsigned char *) (addr)) -#define readw(addr) (*(volatile unsigned short *) (addr)) -#define readl(addr) (*(volatile unsigned int *) (addr)) - -#define writeb(b,addr) ((*(volatile unsigned char *) (addr)) = (b)) -#define writew(b,addr) ((*(volatile unsigned short *) (addr)) = (b)) -#define writel(b,addr) ((*(volatile unsigned int *) (addr)) = (b)) - -#define memcpy_fromio(a,b,c) memcpy((a),(void *)(b),(c)) -#define memcpy_toio(a,b,c) memcpy((void *)(a),(b),(c)) - -/* - * Force strict CPU ordering. - * And yes, this is required on UP too when we're talking - * to devices. - * - * For now, "wmb()" doesn't actually do anything, as all - * Intel CPU's follow what Intel calls a *Processor Order*, - * in which all writes are seen in the program order even - * outside the CPU. - * - * I expect future Intel CPU's to have a weaker ordering, - * but I'd also expect them to finally get their act together - * and add some real memory barriers if so. - * - * Some non intel clones support out of order store. wmb() ceases to be a - * nop for these. - */ - -#define mb() __asm__ __volatile__ ("lock; addl $0,0(%%esp)": : :"memory") -#define rmb() mb() -#define wmb() mb(); - - -/* - * Talk about misusing macros.. - */ - -#define __OUT1(s,x) \ -extern void __out##s(unsigned x value, unsigned short port); \ -extern inline void __out##s(unsigned x value, unsigned short port) { - -#define __OUT2(s,s1,s2) \ -__asm__ __volatile__ ("out" #s " %" s1 "0,%" s2 "1" - -#define __OUT(s,s1,x) \ -__OUT1(s,x) __OUT2(s,s1,"w") : : "a" (value), "d" (port)); } \ -__OUT1(s##c,x) __OUT2(s,s1,"") : : "a" (value), "id" (port)); } \ -__OUT1(s##_p,x) __OUT2(s,s1,"w") : : "a" (value), "d" (port)); SLOW_DOWN_IO; } \ -__OUT1(s##c_p,x) __OUT2(s,s1,"") : : "a" (value), "id" (port)); SLOW_DOWN_IO; } - -#define __IN1(s,x) \ -extern unsigned x __in##s(unsigned short port); \ -extern inline unsigned x __in##s(unsigned short port) { unsigned x _v; - -#define __IN2(s,s1,s2) \ -__asm__ __volatile__ ("in" #s " %" s2 "1,%" s1 "0" - -#define __IN(s,s1,x,i...) \ -__IN1(s,x) __IN2(s,s1,"w") : "=a" (_v) : "d" (port) ,##i ); return _v; } \ -__IN1(s##c,x) __IN2(s,s1,"") : "=a" (_v) : "id" (port) ,##i ); return _v; } \ -__IN1(s##_p,x) __IN2(s,s1,"w") : "=a" (_v) : "d" (port) ,##i ); SLOW_DOWN_IO; return _v; } \ -__IN1(s##c_p,x) __IN2(s,s1,"") : "=a" (_v) : "id" (port) ,##i ); SLOW_DOWN_IO; return _v; } - -#define __INS(s) \ -extern void ins##s(unsigned short port, void * addr, unsigned long count); \ -extern inline void ins##s(unsigned short port, void * addr, unsigned long count) \ -{ __asm__ __volatile__ ("cld ; rep ; ins" #s \ -: "=D" (addr), "=c" (count) : "d" (port),"0" (addr),"1" (count)); } - -#define __OUTS(s) \ -extern void outs##s(unsigned short port, const void * addr, unsigned long count); \ -extern inline void outs##s(unsigned short port, const void * addr, unsigned long count) \ -{ __asm__ __volatile__ ("cld ; rep ; outs" #s \ -: "=S" (addr), "=c" (count) : "d" (port),"0" (addr),"1" (count)); } - -__IN(b,"", char) -__IN(w,"",short) -__IN(l,"", long) - -__OUT(b,"b",char) -__OUT(w,"w",short) -__OUT(l,,int) - -__INS(b) -__INS(w) -__INS(l) - -__OUTS(b) -__OUTS(w) -__OUTS(l) - -/* - * Note that due to the way __builtin_constant_p() works, you - * - can't use it inside a inline function (it will never be true) - * - you don't have to worry about side effects within the __builtin.. - */ -#define outb(val,port) \ -((__builtin_constant_p((port)) && (port) < 256) ? \ - __outbc((val),(port)) : \ - __outb((val),(port))) - -#define inb(port) \ -((__builtin_constant_p((port)) && (port) < 256) ? \ - __inbc(port) : \ - __inb(port)) - -#define outb_p(val,port) \ -((__builtin_constant_p((port)) && (port) < 256) ? \ - __outbc_p((val),(port)) : \ - __outb_p((val),(port))) - -#define inb_p(port) \ -((__builtin_constant_p((port)) && (port) < 256) ? \ - __inbc_p(port) : \ - __inb_p(port)) - -#define outw(val,port) \ -((__builtin_constant_p((port)) && (port) < 256) ? \ - __outwc((val),(port)) : \ - __outw((val),(port))) - -#define inw(port) \ -((__builtin_constant_p((port)) && (port) < 256) ? \ - __inwc(port) : \ - __inw(port)) - -#define outw_p(val,port) \ -((__builtin_constant_p((port)) && (port) < 256) ? \ - __outwc_p((val),(port)) : \ - __outw_p((val),(port))) - -#define inw_p(port) \ -((__builtin_constant_p((port)) && (port) < 256) ? \ - __inwc_p(port) : \ - __inw_p(port)) - -#define outl(val,port) \ -((__builtin_constant_p((port)) && (port) < 256) ? \ - __outlc((val),(port)) : \ - __outl((val),(port))) - -#define inl(port) \ -((__builtin_constant_p((port)) && (port) < 256) ? \ - __inlc(port) : \ - __inl(port)) - -#define outl_p(val,port) \ -((__builtin_constant_p((port)) && (port) < 256) ? \ - __outlc_p((val),(port)) : \ - __outl_p((val),(port))) - -#define inl_p(port) \ -((__builtin_constant_p((port)) && (port) < 256) ? \ - __inlc_p(port) : \ - __inl_p(port)) - -#endif /* ETHERBOOT_IO_H */ diff --git a/usr/src/grub/grub-0.95/netboot/ip.h b/usr/src/grub/grub-0.95/netboot/ip.h deleted file mode 100644 index 496134e1e5..0000000000 --- a/usr/src/grub/grub-0.95/netboot/ip.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef _IP_H -#define _IP_H - -/* We need 'uint16_t' */ -#include "types.h" -/* We need 'in_addr' */ -#include "in.h" - -struct iphdr { - uint8_t verhdrlen; - uint8_t service; - uint16_t len; - uint16_t ident; - uint16_t frags; - uint8_t ttl; - uint8_t protocol; - uint16_t chksum; - in_addr src; - in_addr dest; -}; - -extern void build_ip_hdr(unsigned long __destip, int __ttl, int __protocol, - int __option_len, int __len, const void * __buf); - -extern int ip_transmit(int __len, const void * __buf); - -extern uint16_t ipchksum(const void * __data, unsigned long __length); - -extern uint16_t add_ipchksums(unsigned long __offset, uint16_t __sum, - uint16_t __new); - - - - - -#endif /* _IP_H */ diff --git a/usr/src/grub/grub-0.95/netboot/isa.h b/usr/src/grub/grub-0.95/netboot/isa.h deleted file mode 100644 index e0e85cdf1d..0000000000 --- a/usr/src/grub/grub-0.95/netboot/isa.h +++ /dev/null @@ -1,27 +0,0 @@ -#if !defined(ISA_H) && defined(CONFIG_ISA) -#define ISA_H - -struct dev; - -#define ISAPNP_VENDOR(a,b,c) (((((a)-'A'+1)&0x3f)<<2)|\ - ((((b)-'A'+1)&0x18)>>3)|((((b)-'A'+1)&7)<<13)|\ - ((((c)-'A'+1)&0x1f)<<8)) - -#define GENERIC_ISAPNP_VENDOR ISAPNP_VENDOR('P','N','P') - -struct isa_driver -{ - int type; - const char *name; - int (*probe)(struct dev *, unsigned short *); - unsigned short *ioaddrs; -}; - -#define __isa_driver __attribute__ ((unused,__section__(".drivers.isa"))) -extern const struct isa_driver isa_drivers[]; -extern const struct isa_driver isa_drivers_end[]; - -#define ISA_ROM(IMAGE, DESCRIPTION) - -#endif /* ISA_H */ - diff --git a/usr/src/grub/grub-0.95/netboot/latch.h b/usr/src/grub/grub-0.95/netboot/latch.h deleted file mode 100644 index 38a8bd211d..0000000000 --- a/usr/src/grub/grub-0.95/netboot/latch.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef LATCH_H -#define LATCH_H - -#define TICKS_PER_SEC 18 - -/* For different calibrators of the TSC move the declaration of - * sleep_latch and the definitions of it's length here... - */ - -#endif /* LATCH_H */ diff --git a/usr/src/grub/grub-0.95/netboot/little_bswap.h b/usr/src/grub/grub-0.95/netboot/little_bswap.h deleted file mode 100644 index 35918530b4..0000000000 --- a/usr/src/grub/grub-0.95/netboot/little_bswap.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef ETHERBOOT_LITTLE_BSWAP_H -#define ETHERBOOT_LITTLE_BSWAP_H - -#define ntohl(x) __bswap_32(x) -#define htonl(x) __bswap_32(x) -#define ntohs(x) __bswap_16(x) -#define htons(x) __bswap_16(x) -#define cpu_to_le32(x) (x) -#define cpu_to_le16(x) (x) -#define cpu_to_be32(x) __bswap_32(x) -#define cpu_to_be16(x) __bswap_16(x) -#define le32_to_cpu(x) (x) -#define le16_to_cpu(x) (x) -#define be32_to_cpu(x) __bswap_32(x) -#define be16_to_cpu(x) __bswap_16(x) - -#endif /* ETHERBOOT_LITTLE_BSWAP_H */ diff --git a/usr/src/grub/grub-0.95/netboot/mii.h b/usr/src/grub/grub-0.95/netboot/mii.h deleted file mode 100644 index 34c1ca9b13..0000000000 --- a/usr/src/grub/grub-0.95/netboot/mii.h +++ /dev/null @@ -1,105 +0,0 @@ -/* - * linux/mii.h: definitions for MII-compatible transceivers - * Originally drivers/net/sunhme.h. - * - * Copyright (C) 1996, 1999, 2001 David S. Miller (davem@redhat.com) - * - * Copied Form Linux 2.4.25 an unneeded items removed by: - * Timothy Legge (timlegge at etherboot dot org) - * - * 03/26/2004 - */ - -/* 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_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 0x007f /* Unused... */ -#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 0x07c0 /* Unused... */ -#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_10FULL 0x0040 /* Try for 10mbps full-duplex */ -#define ADVERTISE_100HALF 0x0080 /* Try for 100mbps half-duplex */ -#define ADVERTISE_100FULL 0x0100 /* Try for 100mbps full-duplex */ -#define ADVERTISE_100BASE4 0x0200 /* Try for 100mbps 4k packets */ -#define ADVERTISE_RESV 0x1c00 /* 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_10FULL 0x0040 /* Can do 10mbps full-duplex */ -#define LPA_100HALF 0x0080 /* Can do 100mbps half-duplex */ -#define LPA_100FULL 0x0100 /* Can do 100mbps full-duplex */ -#define LPA_100BASE4 0x0200 /* Can do 100mbps 4k packets */ -#define LPA_RESV 0x1c00 /* 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... */ - -/* N-way test register. */ -#define NWAYTEST_RESV1 0x00ff /* Unused... */ -#define NWAYTEST_LOOPBACK 0x0100 /* Enable loopback for N-way */ -#define NWAYTEST_RESV2 0xfe00 /* Unused... */ - diff --git a/usr/src/grub/grub-0.95/netboot/misc.c b/usr/src/grub/grub-0.95/netboot/misc.c deleted file mode 100644 index 339ef8e602..0000000000 --- a/usr/src/grub/grub-0.95/netboot/misc.c +++ /dev/null @@ -1,321 +0,0 @@ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 2000,2001,2002 Free Software Foundation, 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 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. - */ - -/* Based on "src/misc.c" in etherboot-5.0.5. */ - -#include "grub.h" -#include "timer.h" - -#include "nic.h" - -/************************************************************************** -RANDOM - compute a random number between 0 and 2147483647L or 2147483562? -**************************************************************************/ -int32_t random(void) -{ - static int32_t seed = 0; - int32_t q; - if (!seed) /* Initialize linear congruential generator */ - seed = currticks() + *(int32_t *)&arptable[ARP_CLIENT].node - + ((int16_t *)arptable[ARP_CLIENT].node)[2]; - /* simplified version of the LCG given in Bruce Schneier's - "Applied Cryptography" */ - q = seed/53668; - if ((seed = 40014*(seed-53668*q) - 12211*q) < 0) seed += 2147483563L; - return seed; -} - -/************************************************************************** -POLL INTERRUPTIONS -**************************************************************************/ -void poll_interruptions(void) -{ - if (checkkey() != -1 && ASCII_CHAR(getkey()) == K_INTR) { - user_abort++; - } -} - -/************************************************************************** -SLEEP -**************************************************************************/ -void sleep(int secs) -{ - unsigned long tmo; - - for (tmo = currticks()+secs*TICKS_PER_SEC; currticks() < tmo; ) { - poll_interruptions(); - } -} - -/************************************************************************** -INTERRUPTIBLE SLEEP -**************************************************************************/ -void interruptible_sleep(int secs) -{ - printf("\n"); - return sleep(secs); -} - -/************************************************************************** -TWIDDLE -**************************************************************************/ -void twiddle(void) -{ -#ifdef BAR_PROGRESS - static int count=0; - static const char tiddles[]="-\\|/"; - static unsigned long lastticks = 0; - unsigned long ticks; -#endif -#ifdef FREEBSD_PXEEMU - extern char pxeemu_nbp_active; - if(pxeemu_nbp_active != 0) - return; -#endif -#ifdef BAR_PROGRESS - /* Limit the maximum rate at which characters are printed */ - ticks = currticks(); - if ((lastticks + (TICKS_PER_SEC/18)) > ticks) - return; - lastticks = ticks; - - putchar(tiddles[(count++)&3]); - putchar('\b'); -#else - //putchar('.'); -#endif /* BAR_PROGRESS */ -} - - -/* Because Etherboot uses its own formats for the printf family, - define separate definitions from GRUB. */ -/************************************************************************** -PRINTF and friends - - Formats: - %[#]x - 4 bytes long (8 hex digits, lower case) - %[#]X - 4 bytes long (8 hex digits, upper case) - %[#]hx - 2 bytes int (4 hex digits, lower case) - %[#]hX - 2 bytes int (4 hex digits, upper case) - %[#]hhx - 1 byte int (2 hex digits, lower case) - %[#]hhX - 1 byte int (2 hex digits, upper case) - - optional # prefixes 0x or 0X - %d - decimal int - %c - char - %s - string - %@ - Internet address in ddd.ddd.ddd.ddd notation - %! - Ethernet address in xx:xx:xx:xx:xx:xx notation - Note: width specification not supported -**************************************************************************/ -static int -etherboot_vsprintf (char *buf, const char *fmt, const int *dp) -{ - char *p, *s; - - s = buf; - for ( ; *fmt != '\0'; ++fmt) - { - if (*fmt != '%') - { - buf ? *s++ = *fmt : grub_putchar (*fmt); - continue; - } - - if (*++fmt == 's') - { - for (p = (char *) *dp++; *p != '\0'; p++) - buf ? *s++ = *p : grub_putchar (*p); - } - else - { - /* Length of item is bounded */ - char tmp[20], *q = tmp; - int alt = 0; - int shift = 28; - - if (*fmt == '#') - { - alt = 1; - fmt++; - } - - if (*fmt == 'h') - { - shift = 12; - fmt++; - } - - if (*fmt == 'h') - { - shift = 4; - fmt++; - } - - /* - * Before each format q points to tmp buffer - * After each format q points past end of item - */ - if ((*fmt | 0x20) == 'x') - { - /* With x86 gcc, sizeof(long) == sizeof(int) */ - const long *lp = (const long *) dp; - long h = *lp++; - int ncase = (*fmt & 0x20); - - dp = (const int *) lp; - if (alt) - { - *q++ = '0'; - *q++ = 'X' | ncase; - } - for (; shift >= 0; shift -= 4) - *q++ = "0123456789ABCDEF"[(h >> shift) & 0xF] | ncase; - } - else if (*fmt == 'd') - { - int i = *dp++; - char *r; - - if (i < 0) - { - *q++ = '-'; - i = -i; - } - - p = q; /* save beginning of digits */ - do - { - *q++ = '0' + (i % 10); - i /= 10; - } - while (i); - - /* reverse digits, stop in middle */ - r = q; /* don't alter q */ - while (--r > p) - { - i = *r; - *r = *p; - *p++ = i; - } - } - else if (*fmt == '@') - { - unsigned char *r; - union - { - long l; - unsigned char c[4]; - } - u; - const long *lp = (const long *) dp; - - u.l = *lp++; - dp = (const int *) lp; - - for (r = &u.c[0]; r < &u.c[4]; ++r) - q += etherboot_sprintf (q, "%d.", *r); - - --q; - } - else if (*fmt == '!') - { - char *r; - p = (char *) *dp++; - - for (r = p + ETH_ALEN; p < r; ++p) - q += etherboot_sprintf (q, "%hhX:", *p); - - --q; - } - else if (*fmt == 'c') - *q++ = *dp++; - else - *q++ = *fmt; - - /* now output the saved string */ - for (p = tmp; p < q; ++p) - buf ? *s++ = *p : grub_putchar (*p); - } - } - - if (buf) - *s = '\0'; - - return (s - buf); -} - -int -etherboot_sprintf (char *buf, const char *fmt, ...) -{ - return etherboot_vsprintf (buf, fmt, ((const int *) &fmt) + 1); -} - -void -etherboot_printf (const char *fmt, ...) -{ - (void) etherboot_vsprintf (0, fmt, ((const int *) &fmt) + 1); -} - -int -inet_aton (char *p, in_addr *addr) -{ - unsigned long ip = 0; - int val; - int i; - - for (i = 0; i < 4; i++) - { - val = getdec (&p); - - if (val < 0 || val > 255) - return 0; - - if (i != 3 && *p++ != '.') - return 0; - - ip = (ip << 8) | val; - } - - addr->s_addr = htonl (ip); - - return 1; -} - -int -getdec (char **ptr) -{ - char *p = *ptr; - int ret = 0; - - if (*p < '0' || *p > '9') - return -1; - - while (*p >= '0' && *p <= '9') - { - ret = ret * 10 + (*p - '0'); - p++; - } - - *ptr = p; - - return ret; -} - - diff --git a/usr/src/grub/grub-0.95/netboot/natsemi.c b/usr/src/grub/grub-0.95/netboot/natsemi.c deleted file mode 100644 index 9e2e22f4ef..0000000000 --- a/usr/src/grub/grub-0.95/netboot/natsemi.c +++ /dev/null @@ -1,780 +0,0 @@ -/* -*- Mode:C; c-basic-offset:4; -*- */ - -/* - natsemi.c: An Etherboot driver for the NatSemi DP8381x series. - - Copyright (C) 2001 Entity Cyber, Inc. - - This development of this Etherboot driver was funded by - - Sicom Systems: http://www.sicompos.com/ - - Author: Marty Connor (mdc@thinguin.org) - Adapted from a Linux driver which was written by Donald Becker - - This software may be used and distributed according to the terms - of the GNU Public License (GPL), incorporated herein by reference. - - Original Copyright Notice: - - Written/copyright 1999-2001 by Donald Becker. - - This software may be used and distributed according to the terms of - the GNU General Public License (GPL), incorporated herein by reference. - Drivers based on or derived from this code fall under the GPL and must - retain the authorship, copyright and license notice. This file is not - a complete program and may only be used when the entire operating - system is licensed under the GPL. License for under other terms may be - available. Contact the original author for details. - - The original author may be reached as becker@scyld.com, or at - Scyld Computing Corporation - 410 Severn Ave., Suite 210 - Annapolis MD 21403 - - Support information and updates available at - http://www.scyld.com/network/netsemi.html - - References: - - http://www.scyld.com/expert/100mbps.html - http://www.scyld.com/expert/NWay.html - Datasheet is available from: - http://www.national.com/pf/DP/DP83815.html - -*/ - -/* Revision History */ - -/* - 13 Dec 2003 timlegge 1.1 Enabled Multicast Support - 29 May 2001 mdc 1.0 - Initial Release. Tested with Netgear FA311 and FA312 boards -*/ -/* Includes */ - -#include "etherboot.h" -#include "nic.h" -#include "pci.h" - -/* defines */ - -#define OWN 0x80000000 -#define DSIZE 0x00000FFF -#define CRC_SIZE 4 - -/* Time in ticks before concluding the transmitter is hung. */ -#define TX_TIMEOUT (4*TICKS_PER_SEC) - -#define TX_BUF_SIZE 1536 -#define RX_BUF_SIZE 1536 - -#define NUM_RX_DESC 4 /* Number of Rx descriptor registers. */ - -typedef uint8_t u8; -typedef int8_t s8; -typedef uint16_t u16; -typedef int16_t s16; -typedef uint32_t u32; -typedef int32_t s32; - -/* helpful macroes if on a big_endian machine for changing byte order. - not strictly needed on Intel */ -#define get_unaligned(ptr) (*(ptr)) -#define put_unaligned(val, ptr) ((void)( *(ptr) = (val) )) -#define get_u16(ptr) (*(u16 *)(ptr)) -#define virt_to_le32desc(addr) virt_to_bus(addr) - -enum pcistuff { - PCI_USES_IO = 0x01, - PCI_USES_MEM = 0x02, - PCI_USES_MASTER = 0x04, - PCI_ADDR0 = 0x08, - PCI_ADDR1 = 0x10, -}; - -/* MMIO operations required */ -#define PCI_IOTYPE (PCI_USES_MASTER | PCI_USES_MEM | PCI_ADDR1) - -/* Offsets to the device registers. - Unlike software-only systems, device drivers interact with complex hardware. - It's not useful to define symbolic names for every register bit in the - device. -*/ -enum register_offsets { - ChipCmd = 0x00, - ChipConfig = 0x04, - EECtrl = 0x08, - PCIBusCfg = 0x0C, - IntrStatus = 0x10, - IntrMask = 0x14, - IntrEnable = 0x18, - TxRingPtr = 0x20, - TxConfig = 0x24, - RxRingPtr = 0x30, - RxConfig = 0x34, - ClkRun = 0x3C, - WOLCmd = 0x40, - PauseCmd = 0x44, - RxFilterAddr = 0x48, - RxFilterData = 0x4C, - BootRomAddr = 0x50, - BootRomData = 0x54, - SiliconRev = 0x58, - StatsCtrl = 0x5C, - StatsData = 0x60, - RxPktErrs = 0x60, - RxMissed = 0x68, - RxCRCErrs = 0x64, - PCIPM = 0x44, - PhyStatus = 0xC0, - MIntrCtrl = 0xC4, - MIntrStatus = 0xC8, - - /* These are from the spec, around page 78... on a separate table. */ - PGSEL = 0xCC, - PMDCSR = 0xE4, - TSTDAT = 0xFC, - DSPCFG = 0xF4, - SDCFG = 0x8C -}; - -/* Bit in ChipCmd. */ -enum ChipCmdBits { - ChipReset = 0x100, - RxReset = 0x20, - TxReset = 0x10, - RxOff = 0x08, - RxOn = 0x04, - TxOff = 0x02, - TxOn = 0x01 -}; - -/* Bits in the RxMode register. */ -enum rx_mode_bits { - AcceptErr = 0x20, - AcceptRunt = 0x10, - AcceptBroadcast = 0xC0000000, - AcceptMulticast = 0x00200000, - AcceptAllMulticast = 0x20000000, - AcceptAllPhys = 0x10000000, - AcceptMyPhys = 0x08000000, - RxFilterEnable = 0x80000000 -}; - -typedef struct _BufferDesc { - u32 link; - volatile u32 cmdsts; - u32 bufptr; - u32 software_use; -} BufferDesc; - -/* Bits in network_desc.status */ -enum desc_status_bits { - DescOwn = 0x80000000, - DescMore = 0x40000000, - DescIntr = 0x20000000, - DescNoCRC = 0x10000000, - DescPktOK = 0x08000000, - RxTooLong = 0x00400000 -}; - -/* Globals */ - -static int natsemi_debug = 1; /* 1 normal messages, 0 quiet .. 7 verbose. */ - -const char *nic_name; - -static u32 SavedClkRun; - - -static unsigned short vendor, dev_id; -static unsigned long ioaddr; - -static unsigned int cur_rx; - -static unsigned int advertising; - -static unsigned int rx_config; -static unsigned int tx_config; - -/* Note: transmit and receive buffers and descriptors must be - longword aligned -*/ - -static BufferDesc txd __attribute__ ((aligned(4))); -static BufferDesc rxd[NUM_RX_DESC] __attribute__ ((aligned(4))); - -static unsigned char txb[TX_BUF_SIZE] __attribute__ ((aligned(4))); -static unsigned char rxb[NUM_RX_DESC * RX_BUF_SIZE] __attribute__ ((aligned(4))); - -/* Function Prototypes */ - -static int natsemi_probe(struct dev *dev, struct pci_device *pci); -static int eeprom_read(long addr, int location); -static int mdio_read(int phy_id, int location); -static void natsemi_init(struct nic *nic); -static void natsemi_reset(struct nic *nic); -static void natsemi_init_rxfilter(struct nic *nic); -static void natsemi_init_txd(struct nic *nic); -static void natsemi_init_rxd(struct nic *nic); -static void natsemi_set_rx_mode(struct nic *nic); -static void natsemi_check_duplex(struct nic *nic); -static void natsemi_transmit(struct nic *nic, const char *d, unsigned int t, unsigned int s, const char *p); -static int natsemi_poll(struct nic *nic, int retrieve); -static void natsemi_disable(struct dev *dev); -static void natsemi_irq(struct nic *nic, irq_action_t action); - -/* - * Function: natsemi_probe - * - * Description: Retrieves the MAC address of the card, and sets up some - * globals required by other routines, and initializes the NIC, making it - * ready to send and receive packets. - * - * Side effects: - * leaves the ioaddress of the natsemi chip in the variable ioaddr. - * leaves the natsemi initialized, and ready to recieve packets. - * - * Returns: struct nic *: pointer to NIC data structure - */ - -static int -natsemi_probe(struct dev *dev, struct pci_device *pci) -{ - struct nic *nic = (struct nic *)dev; - int i; - int prev_eedata; - u32 tmp; - - if (pci->ioaddr == 0) - return 0; - - adjust_pci_device(pci); - - /* initialize some commonly used globals */ - - nic->irqno = 0; - nic->ioaddr = pci->ioaddr & ~3; - - ioaddr = pci->ioaddr & ~3; - vendor = pci->vendor; - dev_id = pci->dev_id; - nic_name = pci->name; - - /* natsemi has a non-standard PM control register - * in PCI config space. Some boards apparently need - * to be brought to D0 in this manner. - */ - pcibios_read_config_dword(pci->bus, pci->devfn, PCIPM, &tmp); - if (tmp & (0x03|0x100)) { - /* D0 state, disable PME assertion */ - u32 newtmp = tmp & ~(0x03|0x100); - pcibios_write_config_dword(pci->bus, pci->devfn, PCIPM, newtmp); - } - - /* get MAC address */ - - prev_eedata = eeprom_read(ioaddr, 6); - for (i = 0; i < 3; i++) { - int eedata = eeprom_read(ioaddr, i + 7); - nic->node_addr[i*2] = (eedata << 1) + (prev_eedata >> 15); - nic->node_addr[i*2+1] = eedata >> 7; - prev_eedata = eedata; - } - - printf("\nnatsemi_probe: MAC addr %! at ioaddr %#hX\n", - nic->node_addr, ioaddr); - printf("natsemi_probe: Vendor:%#hX Device:%#hX\n", vendor, dev_id); - - /* Reset the chip to erase any previous misconfiguration. */ - outl(ChipReset, ioaddr + ChipCmd); - - advertising = mdio_read(1, 4); - { - u32 chip_config = inl(ioaddr + ChipConfig); - printf("%s: Transceiver default autoneg. %s " - "10%s %s duplex.\n", - nic_name, - chip_config & 0x2000 ? "enabled, advertise" : "disabled, force", - chip_config & 0x4000 ? "0" : "", - chip_config & 0x8000 ? "full" : "half"); - } - printf("%s: Transceiver status %hX advertising %hX\n", - nic_name, (int)inl(ioaddr + 0x84), advertising); - - /* Disable PME: - * The PME bit is initialized from the EEPROM contents. - * PCI cards probably have PME disabled, but motherboard - * implementations may have PME set to enable WakeOnLan. - * With PME set the chip will scan incoming packets but - * nothing will be written to memory. */ - SavedClkRun = inl(ioaddr + ClkRun); - outl(SavedClkRun & ~0x100, ioaddr + ClkRun); - - /* initialize device */ - natsemi_init(nic); - - dev->disable = natsemi_disable; - nic->poll = natsemi_poll; - nic->transmit = natsemi_transmit; - nic->irq = natsemi_irq; - - return 1; -} - -/* Read the EEPROM and MII Management Data I/O (MDIO) interfaces. - The EEPROM code is for the common 93c06/46 EEPROMs with 6 bit addresses. -*/ - -/* Delay between EEPROM clock transitions. - No extra delay is needed with 33Mhz PCI, but future 66Mhz access may need - a delay. */ -#define eeprom_delay(ee_addr) inl(ee_addr) - -enum EEPROM_Ctrl_Bits { - EE_ShiftClk = 0x04, - EE_DataIn = 0x01, - EE_ChipSelect = 0x08, - EE_DataOut = 0x02 -}; - -#define EE_Write0 (EE_ChipSelect) -#define EE_Write1 (EE_ChipSelect | EE_DataIn) - -/* The EEPROM commands include the alway-set leading bit. */ -enum EEPROM_Cmds { - EE_WriteCmd=(5 << 6), EE_ReadCmd=(6 << 6), EE_EraseCmd=(7 << 6), -}; - -static int eeprom_read(long addr, int location) -{ - int i; - int retval = 0; - int ee_addr = addr + EECtrl; - int read_cmd = location | EE_ReadCmd; - outl(EE_Write0, ee_addr); - - /* Shift the read command bits out. */ - for (i = 10; i >= 0; i--) { - short dataval = (read_cmd & (1 << i)) ? EE_Write1 : EE_Write0; - outl(dataval, ee_addr); - eeprom_delay(ee_addr); - outl(dataval | EE_ShiftClk, ee_addr); - eeprom_delay(ee_addr); - } - outl(EE_ChipSelect, ee_addr); - eeprom_delay(ee_addr); - - for (i = 0; i < 16; i++) { - outl(EE_ChipSelect | EE_ShiftClk, ee_addr); - eeprom_delay(ee_addr); - retval |= (inl(ee_addr) & EE_DataOut) ? 1 << i : 0; - outl(EE_ChipSelect, ee_addr); - eeprom_delay(ee_addr); - } - - /* Terminate the EEPROM access. */ - outl(EE_Write0, ee_addr); - outl(0, ee_addr); - - return retval; -} - -/* MII transceiver control section. - The 83815 series has an internal transceiver, and we present the - management registers as if they were MII connected. */ - -static int mdio_read(int phy_id, int location) -{ - if (phy_id == 1 && location < 32) - return inl(ioaddr + 0x80 + (location<<2)) & 0xffff; - else - return 0xffff; -} - -/* Function: natsemi_init - * - * Description: resets the ethernet controller chip and configures - * registers and data structures required for sending and receiving packets. - * - * Arguments: struct nic *nic: NIC data structure - * - * returns: void. - */ - -static void -natsemi_init(struct nic *nic) -{ - natsemi_reset(nic); - - /* Disable PME: - * The PME bit is initialized from the EEPROM contents. - * PCI cards probably have PME disabled, but motherboard - * implementations may have PME set to enable WakeOnLan. - * With PME set the chip will scan incoming packets but - * nothing will be written to memory. */ - outl(SavedClkRun & ~0x100, ioaddr + ClkRun); - - natsemi_init_rxfilter(nic); - - natsemi_init_txd(nic); - natsemi_init_rxd(nic); - - /* Initialize other registers. */ - /* Configure the PCI bus bursts and FIFO thresholds. */ - /* Configure for standard, in-spec Ethernet. */ - if (inl(ioaddr + ChipConfig) & 0x20000000) { /* Full duplex */ - tx_config = 0xD0801002; - rx_config = 0x10000020; - } else { - tx_config = 0x10801002; - rx_config = 0x0020; - } - outl(tx_config, ioaddr + TxConfig); - outl(rx_config, ioaddr + RxConfig); - - natsemi_check_duplex(nic); - natsemi_set_rx_mode(nic); - - outl(RxOn, ioaddr + ChipCmd); -} - -/* - * Function: natsemi_reset - * - * Description: soft resets the controller chip - * - * Arguments: struct nic *nic: NIC data structure - * - * Returns: void. - */ -static void -natsemi_reset(struct nic *nic __unused) -{ - outl(ChipReset, ioaddr + ChipCmd); - - /* On page 78 of the spec, they recommend some settings for "optimum - performance" to be done in sequence. These settings optimize some - of the 100Mbit autodetection circuitry. Also, we only want to do - this for rev C of the chip. - */ - if (inl(ioaddr + SiliconRev) == 0x302) { - outw(0x0001, ioaddr + PGSEL); - outw(0x189C, ioaddr + PMDCSR); - outw(0x0000, ioaddr + TSTDAT); - outw(0x5040, ioaddr + DSPCFG); - outw(0x008C, ioaddr + SDCFG); - } - /* Disable interrupts using the mask. */ - outl(0, ioaddr + IntrMask); - outl(0, ioaddr + IntrEnable); -} - -/* Function: natsemi_init_rxfilter - * - * Description: sets receive filter address to our MAC address - * - * Arguments: struct nic *nic: NIC data structure - * - * returns: void. - */ - -static void -natsemi_init_rxfilter(struct nic *nic) -{ - int i; - - for (i = 0; i < ETH_ALEN; i += 2) { - outl(i, ioaddr + RxFilterAddr); - outw(nic->node_addr[i] + (nic->node_addr[i+1] << 8), ioaddr + RxFilterData); - } -} - -/* - * Function: natsemi_init_txd - * - * Description: initializes the Tx descriptor - * - * Arguments: struct nic *nic: NIC data structure - * - * returns: void. - */ - -static void -natsemi_init_txd(struct nic *nic __unused) -{ - txd.link = (u32) 0; - txd.cmdsts = (u32) 0; - txd.bufptr = virt_to_bus(&txb[0]); - - /* load Transmit Descriptor Register */ - outl(virt_to_bus(&txd), ioaddr + TxRingPtr); - if (natsemi_debug > 1) - printf("natsemi_init_txd: TX descriptor register loaded with: %X\n", - inl(ioaddr + TxRingPtr)); -} - -/* Function: natsemi_init_rxd - * - * Description: initializes the Rx descriptor ring - * - * Arguments: struct nic *nic: NIC data structure - * - * Returns: void. - */ - -static void -natsemi_init_rxd(struct nic *nic __unused) -{ - int i; - - cur_rx = 0; - - /* init RX descriptor */ - for (i = 0; i < NUM_RX_DESC; i++) { - rxd[i].link = virt_to_bus((i+1 < NUM_RX_DESC) ? &rxd[i+1] : &rxd[0]); - rxd[i].cmdsts = (u32) RX_BUF_SIZE; - rxd[i].bufptr = virt_to_bus(&rxb[i*RX_BUF_SIZE]); - if (natsemi_debug > 1) - printf("natsemi_init_rxd: rxd[%d]=%X link=%X cmdsts=%X bufptr=%X\n", - i, &rxd[i], rxd[i].link, rxd[i].cmdsts, rxd[i].bufptr); - } - - /* load Receive Descriptor Register */ - outl(virt_to_bus(&rxd[0]), ioaddr + RxRingPtr); - - if (natsemi_debug > 1) - printf("natsemi_init_rxd: RX descriptor register loaded with: %X\n", - inl(ioaddr + RxRingPtr)); -} - -/* Function: natsemi_set_rx_mode - * - * Description: - * sets the receive mode to accept all broadcast packets and packets - * with our MAC address, and reject all multicast packets. - * - * Arguments: struct nic *nic: NIC data structure - * - * Returns: void. - */ - -static void natsemi_set_rx_mode(struct nic *nic __unused) -{ - u32 rx_mode = RxFilterEnable | AcceptBroadcast | - AcceptAllMulticast | AcceptMyPhys; - - outl(rx_mode, ioaddr + RxFilterAddr); -} - -static void natsemi_check_duplex(struct nic *nic __unused) -{ - int duplex = inl(ioaddr + ChipConfig) & 0x20000000 ? 1 : 0; - - if (natsemi_debug) - printf("%s: Setting %s-duplex based on negotiated link" - " capability.\n", nic_name, - duplex ? "full" : "half"); - if (duplex) { - rx_config |= 0x10000000; - tx_config |= 0xC0000000; - } else { - rx_config &= ~0x10000000; - tx_config &= ~0xC0000000; - } - outl(tx_config, ioaddr + TxConfig); - outl(rx_config, ioaddr + RxConfig); -} - -/* Function: natsemi_transmit - * - * Description: transmits a packet and waits for completion or timeout. - * - * Arguments: char d[6]: destination ethernet address. - * unsigned short t: ethernet protocol type. - * unsigned short s: size of the data-part of the packet. - * char *p: the data for the packet. - * - * Returns: void. - */ - -static void -natsemi_transmit(struct nic *nic, - const char *d, /* Destination */ - unsigned int t, /* Type */ - unsigned int s, /* size */ - const char *p) /* Packet */ -{ - u32 to, nstype; - u32 tx_status; - - /* Stop the transmitter */ - outl(TxOff, ioaddr + ChipCmd); - - /* load Transmit Descriptor Register */ - outl(virt_to_bus(&txd), ioaddr + TxRingPtr); - if (natsemi_debug > 1) - printf("natsemi_transmit: TX descriptor register loaded with: %X\n", - inl(ioaddr + TxRingPtr)); - - memcpy(txb, d, ETH_ALEN); - memcpy(txb + ETH_ALEN, nic->node_addr, ETH_ALEN); - nstype = htons(t); - memcpy(txb + 2 * ETH_ALEN, (char*)&nstype, 2); - memcpy(txb + ETH_HLEN, p, s); - - s += ETH_HLEN; - s &= DSIZE; - - if (natsemi_debug > 1) - printf("natsemi_transmit: sending %d bytes ethtype %hX\n", (int) s, t); - - /* pad to minimum packet size */ - while (s < ETH_ZLEN) - txb[s++] = '\0'; - - /* set the transmit buffer descriptor and enable Transmit State Machine */ - txd.bufptr = virt_to_bus(&txb[0]); - txd.cmdsts = (u32) OWN | s; - - /* restart the transmitter */ - outl(TxOn, ioaddr + ChipCmd); - - if (natsemi_debug > 1) - printf("natsemi_transmit: Queued Tx packet size %d.\n", (int) s); - - to = currticks() + TX_TIMEOUT; - - while ((((volatile u32) tx_status=txd.cmdsts) & OWN) && (currticks() < to)) - /* wait */ ; - - if (currticks() >= to) { - printf("natsemi_transmit: TX Timeout! Tx status %X.\n", tx_status); - } - - if (!(tx_status & 0x08000000)) { - printf("natsemi_transmit: Transmit error, Tx status %X.\n", tx_status); - } -} - -/* Function: natsemi_poll - * - * Description: checks for a received packet and returns it if found. - * - * Arguments: struct nic *nic: NIC data structure - * - * Returns: 1 if packet was received. - * 0 if no packet was received. - * - * Side effects: - * Returns (copies) the packet to the array nic->packet. - * Returns the length of the packet in nic->packetlen. - */ - -static int -natsemi_poll(struct nic *nic, int retrieve) -{ - u32 rx_status = rxd[cur_rx].cmdsts; - int retstat = 0; - - if (natsemi_debug > 2) - printf("natsemi_poll: cur_rx:%d, status:%X\n", cur_rx, rx_status); - - if (!(rx_status & OWN)) - return retstat; - - if ( ! retrieve ) return 1; - - if (natsemi_debug > 1) - printf("natsemi_poll: got a packet: cur_rx:%d, status:%X\n", - cur_rx, rx_status); - - nic->packetlen = (rx_status & DSIZE) - CRC_SIZE; - - if ((rx_status & (DescMore|DescPktOK|RxTooLong)) != DescPktOK) { - /* corrupted packet received */ - printf("natsemi_poll: Corrupted packet received, buffer status = %X\n", - rx_status); - retstat = 0; - } else { - /* give packet to higher level routine */ - memcpy(nic->packet, (rxb + cur_rx*RX_BUF_SIZE), nic->packetlen); - retstat = 1; - } - - /* return the descriptor and buffer to receive ring */ - rxd[cur_rx].cmdsts = RX_BUF_SIZE; - rxd[cur_rx].bufptr = virt_to_bus(&rxb[cur_rx*RX_BUF_SIZE]); - - if (++cur_rx == NUM_RX_DESC) - cur_rx = 0; - - /* re-enable the potentially idle receive state machine */ - outl(RxOn, ioaddr + ChipCmd); - - return retstat; -} - -/* Function: natsemi_disable - * - * Description: Turns off interrupts and stops Tx and Rx engines - * - * Arguments: struct nic *nic: NIC data structure - * - * Returns: void. - */ - -static void -natsemi_disable(struct dev *dev) -{ - struct nic *nic = (struct nic *)dev; - /* merge reset and disable */ - natsemi_init(nic); - - /* Disable interrupts using the mask. */ - outl(0, ioaddr + IntrMask); - outl(0, ioaddr + IntrEnable); - - /* Stop the chip's Tx and Rx processes. */ - outl(RxOff | TxOff, ioaddr + ChipCmd); - - /* Restore PME enable bit */ - outl(SavedClkRun, ioaddr + ClkRun); -} - -/* Function: natsemi_irq - * - * Description: Enable, Disable, or Force interrupts - * - * Arguments: struct nic *nic: NIC data structure - * irq_action_t action: requested action to perform - * - * Returns: void. - */ - -static void -natsemi_irq(struct nic *nic __unused, irq_action_t action __unused) -{ - switch ( action ) { - case DISABLE : - break; - case ENABLE : - break; - case FORCE : - break; - } -} - -static struct pci_id natsemi_nics[] = { -PCI_ROM(0x100b, 0x0020, "dp83815", "DP83815"), -}; - -struct pci_driver natsemi_driver = { - .type = NIC_DRIVER, - .name = "NATSEMI", - .probe = natsemi_probe, - .ids = natsemi_nics, - .id_count = sizeof(natsemi_nics)/sizeof(natsemi_nics[0]), - .class = 0, -}; diff --git a/usr/src/grub/grub-0.95/netboot/nfs.h b/usr/src/grub/grub-0.95/netboot/nfs.h deleted file mode 100644 index e159067aa8..0000000000 --- a/usr/src/grub/grub-0.95/netboot/nfs.h +++ /dev/null @@ -1,63 +0,0 @@ -#ifndef _NFS_H -#define _NFS_H - -#define SUNRPC_PORT 111 - -#define PROG_PORTMAP 100000 -#define PROG_NFS 100003 -#define PROG_MOUNT 100005 - -#define MSG_CALL 0 -#define MSG_REPLY 1 - -#define PORTMAP_GETPORT 3 - -#define MOUNT_ADDENTRY 1 -#define MOUNT_UMOUNTALL 4 - -#define NFS_LOOKUP 4 -#define NFS_READLINK 5 -#define NFS_READ 6 - -#define NFS_FHSIZE 32 - -#define NFSERR_PERM 1 -#define NFSERR_NOENT 2 -#define NFSERR_ACCES 13 -#define NFSERR_ISDIR 21 -#define NFSERR_INVAL 22 - -/* Block size used for NFS read accesses. A RPC reply packet (including all - * headers) must fit within a single Ethernet frame to avoid fragmentation. - * Chosen to be a power of two, as most NFS servers are optimized for this. */ -#define NFS_READ_SIZE 1024 - -#define NFS_MAXLINKDEPTH 16 - -struct rpc_t { - struct iphdr ip; - struct udphdr udp; - union { - uint8_t data[300]; /* longest RPC call must fit!!!! */ - struct { - uint32_t id; - uint32_t type; - uint32_t rpcvers; - uint32_t prog; - uint32_t vers; - uint32_t proc; - uint32_t data[1]; - } call; - struct { - uint32_t id; - uint32_t type; - uint32_t rstatus; - uint32_t verifier; - uint32_t v2; - uint32_t astatus; - uint32_t data[1]; - } reply; - } u; -}; - -#endif /* _NFS_H */ diff --git a/usr/src/grub/grub-0.95/netboot/nic.c b/usr/src/grub/grub-0.95/netboot/nic.c deleted file mode 100644 index f6d28fad9a..0000000000 --- a/usr/src/grub/grub-0.95/netboot/nic.c +++ /dev/null @@ -1,1312 +0,0 @@ -/************************************************************************** -Etherboot - Network Bootstrap Program - -Literature dealing with the network protocols: - ARP - RFC826 - RARP - RFC903 - IP - RFC791 - UDP - RFC768 - BOOTP - RFC951, RFC2132 (vendor extensions) - DHCP - RFC2131, RFC2132 (options) - TFTP - RFC1350, RFC2347 (options), RFC2348 (blocksize), RFC2349 (tsize) - RPC - RFC1831, RFC1832 (XDR), RFC1833 (rpcbind/portmapper) - NFS - RFC1094, RFC1813 (v3, useful for clarifications, not implemented) - IGMP - RFC1112, RFC2113, RFC2365, RFC2236, RFC3171 - -**************************************************************************/ -#include "etherboot.h" -#include "grub.h" -#include "nic.h" -#include "elf.h" /* FOR EM_CURRENT */ -#include "bootp.h" -#include "if_arp.h" -#include "tftp.h" -#include "timer.h" -#include "ip.h" -#include "udp.h" - -/* Currently no other module uses rom, but it is available */ -struct rom_info rom; -struct arptable_t arptable[MAX_ARP]; -#ifdef MULTICAST_LEVEL2 -unsigned long last_igmpv1 = 0; -struct igmptable_t igmptable[MAX_IGMP]; -#endif -static unsigned long netmask; -/* Used by nfs.c */ -char *hostname = ""; -int hostnamelen = 0; -/* Used by fsys_tftp.c */ -int use_bios_pxe = 0; -static uint32_t xid; -static unsigned char *end_of_rfc1533 = NULL; -static const unsigned char broadcast[] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; -static const in_addr zeroIP = { 0L }; -static char rfc1533_venddata[MAX_RFC1533_VENDLEN]; -static unsigned char rfc1533_cookie[4] = { RFC1533_COOKIE }; -static unsigned char rfc1533_cookie_bootp[5] = { RFC1533_COOKIE, RFC1533_END }; -static unsigned char rfc1533_cookie_dhcp[] = { RFC1533_COOKIE }; -static int dhcp_reply; -static in_addr dhcp_server = { 0L }; -static in_addr dhcp_addr = { 0L }; - -static const unsigned char dhcpdiscover[] = { - RFC2132_MSG_TYPE, 1, DHCPDISCOVER, - RFC2132_MAX_SIZE, 2, /* request as much as we can */ - ETH_MAX_MTU / 256, ETH_MAX_MTU % 256, - /* Vendor class identifier */ -#ifdef SOLARIS_NETBOOT - RFC2132_VENDOR_CLASS_ID,32,'P','X','E','C','l','i','e','n','t',':', - 'A','r','c','h',':','0','0','0','0','0',':','U','N','D','I',':', - '0','0','2','0','0','1', -#else - RFC2132_VENDOR_CLASS_ID, 10, 'G', 'R', 'U', 'B', 'C', 'l', 'i', 'e', 'n', 't', -#endif - RFC2132_PARAM_LIST, 4, RFC1533_NETMASK, RFC1533_GATEWAY, - RFC1533_HOSTNAME, RFC1533_EXTENSIONPATH, RFC1533_END -}; -static const unsigned char dhcprequest [] = { - RFC2132_MSG_TYPE,1,DHCPREQUEST, - RFC2132_SRV_ID,4,0,0,0,0, - RFC2132_REQ_ADDR,4,0,0,0,0, - RFC2132_MAX_SIZE,2, /* request as much as we can */ - ETH_MAX_MTU / 256, ETH_MAX_MTU % 256, - /* Vendor class identifier */ -#ifdef SOLARIS_NETBOOT - RFC2132_VENDOR_CLASS_ID,32,'P','X','E','C','l','i','e','n','t',':', - 'A','r','c','h',':','0','0','0','0','0',':','U','N','D','I',':', - '0','0','2','0','0','1', -#else - RFC2132_VENDOR_CLASS_ID, 10, 'G', 'R', 'U', 'B', 'C', 'l', 'i', 'e', 'n', 't', -#endif - RFC2132_PARAM_LIST, - /* 4 standard + 2 vendortags */ - 4 + 2, - /* Standard parameters */ - RFC1533_NETMASK, RFC1533_GATEWAY, - RFC1533_HOSTNAME, RFC1533_EXTENSIONPATH, - /* Etherboot vendortags */ - RFC1533_VENDOR_MAGIC, - RFC1533_VENDOR_CONFIGFILE, - RFC1533_END -}; - -/* See nic.h */ -int user_abort = 0; -int network_ready = 0; - -#ifdef REQUIRE_VCI_ETHERBOOT -int vci_etherboot; -#endif - -static void update_network_configuration(void); - -static int dummy(void *unused __unused) -{ - return (0); -} - -/* Careful. We need an aligned buffer to avoid problems on machines - * that care about alignment. To trivally align the ethernet data - * (the ip hdr and arp requests) we offset the packet by 2 bytes. - * leaving the ethernet data 16 byte aligned. Beyond this - * we use memmove but this makes the common cast simple and fast. - */ -static char packet[ETH_FRAME_LEN + ETH_DATA_ALIGN] __aligned; - -struct nic nic = -{ - { - 0, /* dev.disable */ - { - 0, - 0, - PCI_BUS_TYPE, - }, /* dev.devid */ - 0, /* index */ - 0, /* type */ - PROBE_FIRST, /* how_pobe */ - PROBE_NONE, /* to_probe */ - 0, /* failsafe */ - 0, /* type_index */ - {}, /* state */ - }, - (int (*)(struct nic *, int))dummy, /* poll */ - (void (*)(struct nic *, const char *, - unsigned int, unsigned int, - const char *))dummy, /* transmit */ - (void (*)(struct nic *, irq_action_t))dummy, /* irq */ - 0, /* flags */ - &rom, /* rom_info */ - arptable[ARP_CLIENT].node, /* node_addr */ - packet + ETH_DATA_ALIGN, /* packet */ - 0, /* packetlen */ - 0, /* ioaddr */ - 0, /* irqno */ - NULL, /* priv_data */ -}; - - - -int grub_eth_probe(void) -{ - static int probed = 0; - struct dev *dev; - - EnterFunction("grub_eth_probe"); - - if (probed) - return 1; - - network_ready = 0; - grub_memset((char *)arptable, 0, MAX_ARP * sizeof(struct arptable_t)); - dev = &nic.dev; - dev->how_probe = -1; - dev->type = NIC_DRIVER; - dev->failsafe = 1; - rom = *((struct rom_info *)ROM_INFO_LOCATION); - - probed = (eth_probe(dev) == PROBE_WORKED); - - LeaveFunction("grub_eth_probe"); - return probed; -} - -int eth_probe(struct dev *dev) -{ - return probe(dev); -} - -int eth_poll(int retrieve) -{ - return ((*nic.poll)(&nic, retrieve)); -} - -void eth_transmit(const char *d, unsigned int t, unsigned int s, const void *p) -{ - (*nic.transmit)(&nic, d, t, s, p); - if (t == IP) twiddle(); -} - -void eth_disable(void) -{ -#ifdef MULTICAST_LEVEL2 - int i; - for(i = 0; i < MAX_IGMP; i++) { - leave_group(i); - } -#endif - disable(&nic.dev); -} - -void eth_irq (irq_action_t action) -{ - (*nic.irq)(&nic,action); -} - -/************************************************************************** -IPCHKSUM - Checksum IP Header -**************************************************************************/ -uint16_t ipchksum(const void *data, unsigned long length) -{ - unsigned long sum; - unsigned long i; - const uint8_t *ptr; - - /* In the most straight forward way possible, - * compute an ip style checksum. - */ - sum = 0; - ptr = data; - for(i = 0; i < length; i++) { - unsigned long value; - value = ptr[i]; - if (i & 1) { - value <<= 8; - } - /* Add the new value */ - sum += value; - /* Wrap around the carry */ - if (sum > 0xFFFF) { - sum = (sum + (sum >> 16)) & 0xFFFF; - } - } - return (~cpu_to_le16(sum)) & 0xFFFF; -} - -uint16_t add_ipchksums(unsigned long offset, uint16_t sum, uint16_t new) -{ - unsigned long checksum; - sum = ~sum & 0xFFFF; - new = ~new & 0xFFFF; - if (offset & 1) { - /* byte swap the sum if it came from an odd offset - * since the computation is endian independant this - * works. - */ - new = bswap_16(new); - } - checksum = sum + new; - if (checksum > 0xFFFF) { - checksum -= 0xFFFF; - } - return (~checksum) & 0xFFFF; -} - -/************************************************************************** -DEFAULT_NETMASK - Return default netmask for IP address -**************************************************************************/ -static inline unsigned long default_netmask(void) -{ - int net = ntohl(arptable[ARP_CLIENT].ipaddr.s_addr) >> 24; - if (net <= 127) - return(htonl(0xff000000)); - else if (net < 192) - return(htonl(0xffff0000)); - else - return(htonl(0xffffff00)); -} - -/************************************************************************** -IP_TRANSMIT - Send an IP datagram -**************************************************************************/ -static int await_arp(int ival, void *ptr, - unsigned short ptype, struct iphdr *ip __unused, struct udphdr *udp __unused) -{ - struct arprequest *arpreply; - if (ptype != ARP) - return 0; - if (nic.packetlen < ETH_HLEN + sizeof(struct arprequest)) - return 0; - arpreply = (struct arprequest *)&nic.packet[ETH_HLEN]; - - if (arpreply->opcode != htons(ARP_REPLY)) - return 0; - if (memcmp(arpreply->sipaddr, ptr, sizeof(in_addr)) != 0) - return 0; - memcpy(arptable[ival].node, arpreply->shwaddr, ETH_ALEN); - return 1; -} - -int ip_transmit(int len, const void *buf) -{ - unsigned long destip; - struct iphdr *ip; - struct arprequest arpreq; - int arpentry, i; - int retry; - - ip = (struct iphdr *)buf; - destip = ip->dest.s_addr; - if (destip == IP_BROADCAST) { - eth_transmit(broadcast, IP, len, buf); -#ifdef MULTICAST_LEVEL1 - } else if ((destip & htonl(MULTICAST_MASK)) == htonl(MULTICAST_NETWORK)) { - unsigned char multicast[6]; - unsigned long hdestip; - hdestip = ntohl(destip); - multicast[0] = 0x01; - multicast[1] = 0x00; - multicast[2] = 0x5e; - multicast[3] = (hdestip >> 16) & 0x7; - multicast[4] = (hdestip >> 8) & 0xff; - multicast[5] = hdestip & 0xff; - eth_transmit(multicast, IP, len, buf); -#endif - } else { - if (((destip & netmask) != - (arptable[ARP_CLIENT].ipaddr.s_addr & netmask)) && - arptable[ARP_GATEWAY].ipaddr.s_addr) - destip = arptable[ARP_GATEWAY].ipaddr.s_addr; - for(arpentry = 0; arpentryverhdrlen = 0x45; - ip->verhdrlen += (option_len/4); - ip->service = 0; - ip->len = htons(len); - ip->ident = 0; - ip->frags = 0; /* Should we set don't fragment? */ - ip->ttl = ttl; - ip->protocol = protocol; - ip->chksum = 0; - ip->src.s_addr = arptable[ARP_CLIENT].ipaddr.s_addr; - ip->dest.s_addr = destip; - ip->chksum = ipchksum(buf, sizeof(struct iphdr) + option_len); -} - -static uint16_t udpchksum(struct iphdr *ip, struct udphdr *udp) -{ - struct udp_pseudo_hdr pseudo; - uint16_t checksum; - - /* Compute the pseudo header */ - pseudo.src.s_addr = ip->src.s_addr; - pseudo.dest.s_addr = ip->dest.s_addr; - pseudo.unused = 0; - pseudo.protocol = IP_UDP; - pseudo.len = udp->len; - - /* Sum the pseudo header */ - checksum = ipchksum(&pseudo, 12); - - /* Sum the rest of the udp packet */ - checksum = add_ipchksums(12, checksum, ipchksum(udp, ntohs(udp->len))); - return checksum; -} - - -void build_udp_hdr(unsigned long destip, - unsigned int srcsock, unsigned int destsock, int ttl, - int len, const void *buf) -{ - struct iphdr *ip; - struct udphdr *udp; - ip = (struct iphdr *)buf; - build_ip_hdr(destip, ttl, IP_UDP, 0, len, buf); - udp = (struct udphdr *)((char *)buf + sizeof(struct iphdr)); - udp->src = htons(srcsock); - udp->dest = htons(destsock); - udp->len = htons(len - sizeof(struct iphdr)); - udp->chksum = 0; - if ((udp->chksum = udpchksum(ip, udp)) == 0) - udp->chksum = 0xffff; -} - - -/************************************************************************** -UDP_TRANSMIT - Send an UDP datagram -**************************************************************************/ -int udp_transmit(unsigned long destip, unsigned int srcsock, - unsigned int destsock, int len, const void *buf) -{ - build_udp_hdr(destip, srcsock, destsock, 60, len, buf); - return ip_transmit(len, buf); -} - -/************************************************************************** -QDRAIN - clear the nic's receive queue -**************************************************************************/ -static int await_qdrain(int ival __unused, void *ptr __unused, - unsigned short ptype __unused, - struct iphdr *ip __unused, struct udphdr *udp __unused) -{ - return 0; -} - -void rx_qdrain(void) -{ - /* Clear out the Rx queue first. It contains nothing of interest, - * except possibly ARP requests from the DHCP/TFTP server. We use - * polling throughout Etherboot, so some time may have passed since we - * last polled the receive queue, which may now be filled with - * broadcast packets. This will cause the reply to the packets we are - * about to send to be lost immediately. Not very clever. */ - await_reply(await_qdrain, 0, NULL, 0); -} - -/** - * rarp - * - * Get IP address by rarp. Just copy from etherboot - **/ -static int await_rarp(int ival, void *ptr, unsigned short ptype, - struct iphdr *ip, struct udphdr *udp) -{ - struct arprequest *arpreply; - if (ptype != RARP) - return 0; - if (nic.packetlen < ETH_HLEN + sizeof(struct arprequest)) - return 0; - arpreply = (struct arprequest *)&nic.packet[ETH_HLEN]; - if (arpreply->opcode != htons(RARP_REPLY)) - return 0; - if (memcmp(arpreply->thwaddr, ptr, ETH_ALEN) == 0){ - memcpy(arptable[ARP_SERVER].node, arpreply->shwaddr, ETH_ALEN); - memcpy(&arptable[ARP_SERVER].ipaddr, arpreply->sipaddr, sizeof(in_addr)); - memcpy(&arptable[ARP_CLIENT].ipaddr, arpreply->tipaddr, sizeof(in_addr)); - memset(&arptable[ARP_GATEWAY].ipaddr, 0, sizeof(in_addr)); - return 1; - } - return 0; -} - -int rarp(void) -{ - int retry; - - /* arp and rarp requests share the same packet structure. */ - struct arprequest rarpreq; - - if(!grub_eth_probe()) - return 0; - network_ready = 0; - - memset(&rarpreq, 0, sizeof(rarpreq)); - - rarpreq.hwtype = htons(1); - rarpreq.protocol = htons(IP); - rarpreq.hwlen = ETH_ALEN; - rarpreq.protolen = 4; - rarpreq.opcode = htons(RARP_REQUEST); - memcpy(&rarpreq.shwaddr, arptable[ARP_CLIENT].node, ETH_ALEN); - /* sipaddr is already zeroed out */ - memcpy(&rarpreq.thwaddr, arptable[ARP_CLIENT].node, ETH_ALEN); - /* tipaddr is already zeroed out */ - - for (retry = 0; retry < MAX_ARP_RETRIES; ++retry) { - long timeout; - eth_transmit(broadcast, RARP, sizeof(rarpreq), &rarpreq); - - timeout = rfc2131_sleep_interval(TIMEOUT, retry); - if (await_reply(await_rarp, 0, rarpreq.shwaddr, timeout)) - break; - if (user_abort) - return 0; - } - - if (retry == MAX_ARP_RETRIES) { - return (0); - } - - network_ready = 1; - update_network_configuration(); - return (1); -} - -/** - * bootp - * - * Get IP address by bootp, segregate from bootp in etherboot. - **/ -static int await_bootp(int ival __unused, void *ptr __unused, - unsigned short ptype __unused, struct iphdr *ip __unused, - struct udphdr *udp) -{ - struct bootp_t *bootpreply; - int len; /* Length of vendor */ - - if (!udp) { - return 0; - } - bootpreply = (struct bootp_t *) - &nic.packet[ETH_HLEN + sizeof(struct iphdr) + sizeof(struct udphdr)]; - len = nic.packetlen - (ETH_HLEN + sizeof(struct iphdr) + - sizeof(struct udphdr) + sizeof(struct bootp_t) - BOOTP_VENDOR_LEN); - if (len < 0) { - return 0; - } - if (udp->dest != htons(BOOTP_CLIENT)) - return 0; - if (bootpreply->bp_op != BOOTP_REPLY) - return 0; - if (bootpreply->bp_xid != xid) - return 0; - if (memcmp((char *)&bootpreply->bp_siaddr, (char *)&zeroIP, sizeof(in_addr)) == 0) - return 0; - if ((memcmp(broadcast, bootpreply->bp_hwaddr, ETH_ALEN) != 0) && - (memcmp(arptable[ARP_CLIENT].node, bootpreply->bp_hwaddr, ETH_ALEN) != 0)) { - return 0; - } - -#ifdef SOLARIS_NETBOOT - /* fill in netinfo */ - dhcpack_length = len + sizeof (struct bootp_t) - BOOTP_VENDOR_LEN; - memcpy((char *)dhcpack_buf, (char *)bootpreply, dhcpack_length); -#endif - - arptable[ARP_CLIENT].ipaddr.s_addr = bootpreply->bp_yiaddr.s_addr; - netmask = default_netmask(); - arptable[ARP_SERVER].ipaddr.s_addr = bootpreply->bp_siaddr.s_addr; - memset(arptable[ARP_SERVER].node, 0, ETH_ALEN); /* Kill arp */ - arptable[ARP_GATEWAY].ipaddr.s_addr = bootpreply->bp_giaddr.s_addr; - memset(arptable[ARP_GATEWAY].node, 0, ETH_ALEN); /* Kill arp */ - /* We don't care bootpreply->bp_file, it must be 'pxegrub':-) */ - memcpy((char *)rfc1533_venddata, (char *)(bootpreply->bp_vend), len); - decode_rfc1533(rfc1533_venddata, 0, len, 1); - return(1); -} - -int bootp(void) -{ - int retry; - struct bootpip_t ip; - unsigned long starttime; - - EnterFunction("bootp"); - - if(!grub_eth_probe()) - return 0; - network_ready = 0; - - memset(&ip, 0, sizeof(struct bootpip_t)); - ip.bp.bp_op = BOOTP_REQUEST; - ip.bp.bp_htype = 1; - ip.bp.bp_hlen = ETH_ALEN; - starttime = currticks(); - /* Use lower 32 bits of node address, more likely to be - distinct than the time since booting */ - memcpy(&xid, &arptable[ARP_CLIENT].node[2], sizeof(xid)); - ip.bp.bp_xid = xid += htonl(starttime); - /* bp_secs defaults to zero */ - memcpy(ip.bp.bp_hwaddr, arptable[ARP_CLIENT].node, ETH_ALEN); - memcpy(ip.bp.bp_vend, rfc1533_cookie_bootp, sizeof(rfc1533_cookie_bootp)); /* request RFC-style options */ - - for (retry = 0; retry < MAX_BOOTP_RETRIES; ) { - long timeout; - - rx_qdrain(); - - udp_transmit(IP_BROADCAST, BOOTP_CLIENT, BOOTP_SERVER, - sizeof(struct bootpip_t), &ip); - timeout = rfc2131_sleep_interval(TIMEOUT, retry++); - if (await_reply(await_bootp, 0, NULL, timeout)){ - network_ready = 1; - return(1); - } - if (user_abort) - return 0; - ip.bp.bp_secs = htons((currticks()-starttime)/TICKS_PER_SEC); - } - return(0); -} - -/** - * dhcp - * - * Get IP address by dhcp, segregate from bootp in etherboot. - **/ -static int await_dhcp(int ival __unused, void *ptr __unused, - unsigned short ptype __unused, struct iphdr *ip __unused, - struct udphdr *udp) -{ - struct dhcp_t *dhcpreply; - int len; - - if (!udp) { - return 0; - } - dhcpreply = (struct dhcp_t *) - &nic.packet[ETH_HLEN + sizeof(struct iphdr) + sizeof(struct udphdr)]; - len = nic.packetlen - (ETH_HLEN + sizeof(struct iphdr) + - sizeof(struct udphdr) + sizeof(struct dhcp_t) - DHCP_OPT_LEN); - if (len < 0){ - return 0; - } - if (udp->dest != htons(BOOTP_CLIENT)) - return 0; - if (dhcpreply->bp_op != BOOTP_REPLY) - return 0; - if (dhcpreply->bp_xid != xid) - return 0; - if (memcmp((char *)&dhcpreply->bp_siaddr, (char *)&zeroIP, sizeof(in_addr)) == 0) - return 0; - if ((memcmp(broadcast, dhcpreply->bp_hwaddr, ETH_ALEN) != 0) && - (memcmp(arptable[ARP_CLIENT].node, dhcpreply->bp_hwaddr, ETH_ALEN) != 0)) { - return 0; - } - -#ifdef SOLARIS_NETBOOT - /* fill in netinfo */ - dhcpack_length = len + sizeof (struct dhcp_t) - DHCP_OPT_LEN; - memcpy((char *)dhcpack_buf, (char *)dhcpreply, dhcpack_length); -#endif - - arptable[ARP_CLIENT].ipaddr.s_addr = dhcpreply->bp_yiaddr.s_addr; - dhcp_addr.s_addr = dhcpreply->bp_yiaddr.s_addr; - netmask = default_netmask(); - arptable[ARP_SERVER].ipaddr.s_addr = dhcpreply->bp_siaddr.s_addr; - memset(arptable[ARP_SERVER].node, 0, ETH_ALEN); /* Kill arp */ - arptable[ARP_GATEWAY].ipaddr.s_addr = dhcpreply->bp_giaddr.s_addr; - memset(arptable[ARP_GATEWAY].node, 0, ETH_ALEN); /* Kill arp */ - /* We don't care bootpreply->bp_file. It must be 'pxegrub' */ - memcpy((char *)rfc1533_venddata, (char *)(dhcpreply->bp_vend), len); - decode_rfc1533(rfc1533_venddata, 0, len, 1); - return(1); -} - -int dhcp(void) -{ - int retry; - int reqretry; - struct dhcpip_t ip; - unsigned long starttime; - - /* try bios pxe stack first */ - if (dhcp_undi()) - return 1; - - if(!grub_eth_probe()) - return 0; - - network_ready = 0; - - memset(&ip, 0, sizeof(ip)); - ip.bp.bp_op = BOOTP_REQUEST; - ip.bp.bp_htype = 1; - ip.bp.bp_hlen = ETH_ALEN; - starttime = currticks(); - /* Use lower 32 bits of node address, more likely to be - distinct than the time since booting */ - memcpy(&xid, &arptable[ARP_CLIENT].node[2], sizeof(xid)); - ip.bp.bp_xid = xid += htonl(starttime); - memcpy(ip.bp.bp_hwaddr, arptable[ARP_CLIENT].node, ETH_ALEN); - memcpy(ip.bp.bp_vend, rfc1533_cookie_dhcp, sizeof rfc1533_cookie_dhcp); /* request RFC-style options */ - memcpy(ip.bp.bp_vend + sizeof rfc1533_cookie_dhcp, dhcpdiscover, sizeof dhcpdiscover); - - for (retry = 0; retry < MAX_BOOTP_RETRIES; ) { - long timeout; - - rx_qdrain(); - - udp_transmit(IP_BROADCAST, BOOTP_CLIENT, BOOTP_SERVER, - sizeof(ip), &ip); - timeout = rfc2131_sleep_interval(TIMEOUT, retry++); - if (await_reply(await_dhcp, 0, NULL, timeout)) { - /* If not a DHCPOFFER then must be just a - BOOTP reply, be backward compatible with - BOOTP then. Jscott report a bug here, but I - don't know how it happened */ - if (dhcp_reply != DHCPOFFER){ - network_ready = 1; - return(1); - } - dhcp_reply = 0; - memcpy(ip.bp.bp_vend, rfc1533_cookie_dhcp, sizeof rfc1533_cookie_dhcp); - memcpy(ip.bp.bp_vend + sizeof rfc1533_cookie_dhcp, dhcprequest, sizeof dhcprequest); - /* Beware: the magic numbers 9 and 15 depend on - the layout of dhcprequest */ - memcpy(&ip.bp.bp_vend[9], &dhcp_server, sizeof(in_addr)); - memcpy(&ip.bp.bp_vend[15], &dhcp_addr, sizeof(in_addr)); - for (reqretry = 0; reqretry < MAX_BOOTP_RETRIES; ) { - udp_transmit(IP_BROADCAST, BOOTP_CLIENT, BOOTP_SERVER, - sizeof(ip), &ip); - dhcp_reply=0; - timeout = rfc2131_sleep_interval(TIMEOUT, reqretry++); - if (await_reply(await_dhcp, 0, NULL, timeout)) - if (dhcp_reply == DHCPACK){ - network_ready = 1; - return(1); - } - if (user_abort) - return 0; - } - } - if (user_abort) - return 0; - ip.bp.bp_secs = htons((currticks()-starttime)/TICKS_PER_SEC); - } - return(0); -} - -#ifdef MULTICAST_LEVEL2 -static void send_igmp_reports(unsigned long now) -{ - int i; - for(i = 0; i < MAX_IGMP; i++) { - if (igmptable[i].time && (now >= igmptable[i].time)) { - struct igmp_ip_t igmp; - igmp.router_alert[0] = 0x94; - igmp.router_alert[1] = 0x04; - igmp.router_alert[2] = 0; - igmp.router_alert[3] = 0; - build_ip_hdr(igmptable[i].group.s_addr, - 1, IP_IGMP, sizeof(igmp.router_alert), sizeof(igmp), &igmp); - igmp.igmp.type = IGMPv2_REPORT; - if (last_igmpv1 && - (now < last_igmpv1 + IGMPv1_ROUTER_PRESENT_TIMEOUT)) { - igmp.igmp.type = IGMPv1_REPORT; - } - igmp.igmp.response_time = 0; - igmp.igmp.chksum = 0; - igmp.igmp.group.s_addr = igmptable[i].group.s_addr; - igmp.igmp.chksum = ipchksum(&igmp.igmp, sizeof(igmp.igmp)); - ip_transmit(sizeof(igmp), &igmp); -#ifdef MDEBUG - printf("Sent IGMP report to: %@\n", igmp.igmp.group.s_addr); -#endif - /* Don't send another igmp report until asked */ - igmptable[i].time = 0; - } - } -} - -static void process_igmp(struct iphdr *ip, unsigned long now) -{ - struct igmp *igmp; - int i; - unsigned iplen = 0; - if (!ip || (ip->protocol == IP_IGMP) || - (nic.packetlen < sizeof(struct iphdr) + sizeof(struct igmp))) { - return; - } - iplen = (ip->verhdrlen & 0xf)*4; - igmp = (struct igmp *)&nic.packet[sizeof(struct iphdr)]; - if (ipchksum(igmp, ntohs(ip->len) - iplen) != 0) - return; - if ((igmp->type == IGMP_QUERY) && - (ip->dest.s_addr == htonl(GROUP_ALL_HOSTS))) { - unsigned long interval = IGMP_INTERVAL; - if (igmp->response_time == 0) { - last_igmpv1 = now; - } else { - interval = (igmp->response_time * TICKS_PER_SEC)/10; - } - -#ifdef MDEBUG - printf("Received IGMP query for: %@\n", igmp->group.s_addr); -#endif - for(i = 0; i < MAX_IGMP; i++) { - uint32_t group = igmptable[i].group.s_addr; - if ((group == 0) || (group == igmp->group.s_addr)) { - unsigned long time; - time = currticks() + rfc1112_sleep_interval(interval, 0); - if (time < igmptable[i].time) { - igmptable[i].time = time; - } - } - } - } - if (((igmp->type == IGMPv1_REPORT) || (igmp->type == IGMPv2_REPORT)) && - (ip->dest.s_addr == igmp->group.s_addr)) { -#ifdef MDEBUG - printf("Received IGMP report for: %@\n", igmp->group.s_addr); -#endif - for(i = 0; i < MAX_IGMP; i++) { - if ((igmptable[i].group.s_addr == igmp->group.s_addr) && - igmptable[i].time != 0) { - igmptable[i].time = 0; - } - } - } -} - -void leave_group(int slot) -{ - /* Be very stupid and always send a leave group message if - * I have subscribed. Imperfect but it is standards - * compliant, easy and reliable to implement. - * - * The optimal group leave method is to only send leave when, - * we were the last host to respond to a query on this group, - * and igmpv1 compatibility is not enabled. - */ - if (igmptable[slot].group.s_addr) { - struct igmp_ip_t igmp; - igmp.router_alert[0] = 0x94; - igmp.router_alert[1] = 0x04; - igmp.router_alert[2] = 0; - igmp.router_alert[3] = 0; - build_ip_hdr(htonl(GROUP_ALL_HOSTS), - 1, IP_IGMP, sizeof(igmp.router_alert), sizeof(igmp), &igmp); - igmp.igmp.type = IGMP_LEAVE; - igmp.igmp.response_time = 0; - igmp.igmp.chksum = 0; - igmp.igmp.group.s_addr = igmptable[slot].group.s_addr; - igmp.igmp.chksum = ipchksum(&igmp.igmp, sizeof(igmp)); - ip_transmit(sizeof(igmp), &igmp); -#ifdef MDEBUG - printf("Sent IGMP leave for: %@\n", igmp.igmp.group.s_addr); -#endif - } - memset(&igmptable[slot], 0, sizeof(igmptable[0])); -} - -void join_group(int slot, unsigned long group) -{ - /* I have already joined */ - if (igmptable[slot].group.s_addr == group) - return; - if (igmptable[slot].group.s_addr) { - leave_group(slot); - } - /* Only join a group if we are given a multicast ip, this way - * code can be given a non-multicast (broadcast or unicast ip) - * and still work... - */ - if ((group & htonl(MULTICAST_MASK)) == htonl(MULTICAST_NETWORK)) { - igmptable[slot].group.s_addr = group; - igmptable[slot].time = currticks(); - } -} -#else -#define send_igmp_reports(now); -#define process_igmp(ip, now) -#endif - -/************************************************************************** -AWAIT_REPLY - Wait until we get a response for our request -************f**************************************************************/ -int await_reply(reply_t reply, int ival, void *ptr, long timeout) -{ - unsigned long time, now; - struct iphdr *ip; - unsigned iplen = 0; - struct udphdr *udp; - unsigned short ptype; - int result; - - user_abort = 0; - - time = timeout + currticks(); - /* The timeout check is done below. The timeout is only checked if - * there is no packet in the Rx queue. This assumes that eth_poll() - * needs a negligible amount of time. - */ - for (;;) { - now = currticks(); - send_igmp_reports(now); - result = eth_poll(1); - if (result == 0) { - /* We don't have anything */ - - /* Check for abort key only if the Rx queue is empty - - * as long as we have something to process, don't - * assume that something failed. It is unlikely that - * we have no processing time left between packets. */ - poll_interruptions(); - /* Do the timeout after at least a full queue walk. */ - if ((timeout == 0) || (currticks() > time) || user_abort == 1) { - break; - } - continue; - } - - /* We have something! */ - - /* Find the Ethernet packet type */ - if (nic.packetlen >= ETH_HLEN) { - ptype = ((unsigned short) nic.packet[12]) << 8 - | ((unsigned short) nic.packet[13]); - } else continue; /* what else could we do with it? */ - /* Verify an IP header */ - ip = 0; - if ((ptype == IP) && (nic.packetlen >= ETH_HLEN + sizeof(struct iphdr))) { - unsigned ipoptlen; - ip = (struct iphdr *)&nic.packet[ETH_HLEN]; - if ((ip->verhdrlen < 0x45) || (ip->verhdrlen > 0x4F)) - continue; - iplen = (ip->verhdrlen & 0xf) * 4; - if (ipchksum(ip, iplen) != 0) - continue; - if (ip->frags & htons(0x3FFF)) { - static int warned_fragmentation = 0; - if (!warned_fragmentation) { - printf("ALERT: got a fragmented packet - reconfigure your server\n"); - warned_fragmentation = 1; - } - continue; - } - if (ntohs(ip->len) > ETH_MAX_MTU) - continue; - - ipoptlen = iplen - sizeof(struct iphdr); - if (ipoptlen) { - /* Delete the ip options, to guarantee - * good alignment, and make etherboot simpler. - */ - memmove(&nic.packet[ETH_HLEN + sizeof(struct iphdr)], - &nic.packet[ETH_HLEN + iplen], - nic.packetlen - ipoptlen); - nic.packetlen -= ipoptlen; - } - } - udp = 0; - if (ip && (ip->protocol == IP_UDP) && - (nic.packetlen >= ETH_HLEN + sizeof(struct iphdr) + sizeof(struct udphdr))) { - udp = (struct udphdr *)&nic.packet[ETH_HLEN + sizeof(struct iphdr)]; - - /* Make certain we have a reasonable packet length */ - if (ntohs(udp->len) > (ntohs(ip->len) - iplen)) - continue; - - if (udp->chksum && udpchksum(ip, udp)) { - printf("UDP checksum error\n"); - continue; - } - } - result = reply(ival, ptr, ptype, ip, udp); - if (result > 0) { - return result; - } - - /* If it isn't a packet the upper layer wants see if there is a default - * action. This allows us reply to arp and igmp queryies. - */ - if ((ptype == ARP) && - (nic.packetlen >= ETH_HLEN + sizeof(struct arprequest))) { - struct arprequest *arpreply; - unsigned long tmp; - - arpreply = (struct arprequest *)&nic.packet[ETH_HLEN]; - memcpy(&tmp, arpreply->tipaddr, sizeof(in_addr)); - if ((arpreply->opcode == htons(ARP_REQUEST)) && - (tmp == arptable[ARP_CLIENT].ipaddr.s_addr)) { - arpreply->opcode = htons(ARP_REPLY); - memcpy(arpreply->tipaddr, arpreply->sipaddr, sizeof(in_addr)); - memcpy(arpreply->thwaddr, arpreply->shwaddr, ETH_ALEN); - memcpy(arpreply->sipaddr, &arptable[ARP_CLIENT].ipaddr, sizeof(in_addr)); - memcpy(arpreply->shwaddr, arptable[ARP_CLIENT].node, ETH_ALEN); - eth_transmit(arpreply->thwaddr, ARP, - sizeof(struct arprequest), - arpreply); -#ifdef MDEBUG - memcpy(&tmp, arpreply->tipaddr, sizeof(in_addr)); - printf("Sent ARP reply to: %@\n",tmp); -#endif /* MDEBUG */ - } - } - process_igmp(ip, now); - } - return(0); -} - -#ifdef REQUIRE_VCI_ETHERBOOT -/************************************************************************** -FIND_VCI_ETHERBOOT - Looks for "Etherboot" in Vendor Encapsulated Identifiers -On entry p points to byte count of VCI options -**************************************************************************/ -static int find_vci_etherboot(unsigned char *p) -{ - unsigned char *end = p + 1 + *p; - - for (p++; p < end; ) { - if (*p == RFC2132_VENDOR_CLASS_ID) { - if (strncmp("Etherboot", p + 2, sizeof("Etherboot") - 1) == 0) - return (1); - } else if (*p == RFC1533_END) - return (0); - p += TAG_LEN(p) + 2; - } - return (0); -} -#endif /* REQUIRE_VCI_ETHERBOOT */ - -/** - * decode_rfc1533 - * - * Decodes RFC1533 header - **/ -int decode_rfc1533(unsigned char *p, unsigned int block, unsigned int len, int eof) -{ - static unsigned char *extdata = NULL, *extend = NULL; - unsigned char *extpath = NULL; - unsigned char *endp; - - if (block == 0) { - end_of_rfc1533 = NULL; - if (memcmp(p, rfc1533_cookie, sizeof(rfc1533_cookie))) - return(0); /* no RFC 1533 header found */ - p += 4; - endp = p + len; - } else { - if (block == 1) { - if (memcmp(p, rfc1533_cookie, sizeof(rfc1533_cookie))) - return(0); /* no RFC 1533 header found */ - p += 4; - len -= 4; } - if (extend + len <= (unsigned char *) - rfc1533_venddata + sizeof(rfc1533_venddata)) { - memcpy(extend, p, len); - extend += len; - } else { - printf("Overflow in vendor data buffer! Aborting...\n"); - *extdata = RFC1533_END; - return(0); - } - p = extdata; endp = extend; - } - if (!eof) - return 1; - while (p < endp) { - unsigned char c = *p; - if (c == RFC1533_PAD) { - p++; - continue; - } - else if (c == RFC1533_END) { - end_of_rfc1533 = endp = p; - continue; - } - else if (c == RFC1533_NETMASK) - memcpy(&netmask, p+2, sizeof(in_addr)); - else if (c == RFC1533_GATEWAY) { - /* This is a little simplistic, but it will - usually be sufficient. - Take only the first entry */ - if (TAG_LEN(p) >= sizeof(in_addr)) - memcpy(&arptable[ARP_GATEWAY].ipaddr, p+2, sizeof(in_addr)); - } - else if (c == RFC1533_EXTENSIONPATH) - extpath = p; - else if (c == RFC2132_MSG_TYPE) - dhcp_reply=*(p+2); - else if (c == RFC2132_SRV_ID) - memcpy(&dhcp_server, p+2, sizeof(in_addr)); - else if (c == RFC1533_HOSTNAME) { - hostname = p + 2; - hostnamelen = *(p + 1); - } - else if (c == RFC1533_VENDOR_CONFIGFILE){ - int l = TAG_LEN (p); - - /* Eliminate the trailing NULs according to RFC 2132. */ - while (*(p + 2 + l - 1) == '\000' && l > 0) - l--; - - /* XXX: Should check if LEN is less than the maximum length - of CONFIG_FILE. This kind of robustness will be a goal - in GRUB 1.0. */ - memcpy (config_file, p + 2, l); - config_file[l] = 0; - } - else { - ; - } - p += TAG_LEN(p) + 2; - } - extdata = extend = endp; - if (block <= 0 && extpath != NULL) { - char fname[64]; - if (TAG_LEN(extpath) >= sizeof(fname)){ - printf("Overflow in vendor data buffer! Aborting...\n"); - *extdata = RFC1533_END; - return(0); - } - memcpy(fname, extpath+2, TAG_LEN(extpath)); - fname[(int)TAG_LEN(extpath)] = '\0'; - printf("Loading BOOTP-extension file: %s\n",fname); - tftp_file_read(fname, decode_rfc1533); - } - return 1; /* proceed with next block */ -} - - -/* FIXME double check TWO_SECOND_DIVISOR */ -#define TWO_SECOND_DIVISOR (RAND_MAX/TICKS_PER_SEC) -/************************************************************************** -RFC2131_SLEEP_INTERVAL - sleep for expotentially longer times (base << exp) +- 1 sec) -**************************************************************************/ -long rfc2131_sleep_interval(long base, int exp) -{ - unsigned long tmo; -#ifdef BACKOFF_LIMIT - if (exp > BACKOFF_LIMIT) - exp = BACKOFF_LIMIT; -#endif - tmo = (base << exp) + (TICKS_PER_SEC - (random()/TWO_SECOND_DIVISOR)); - return tmo; -} - -#ifdef MULTICAST_LEVEL2 -/************************************************************************** -RFC1112_SLEEP_INTERVAL - sleep for expotentially longer times, up to (base << exp) -**************************************************************************/ -long rfc1112_sleep_interval(long base, int exp) -{ - unsigned long divisor, tmo; -#ifdef BACKOFF_LIMIT - if (exp > BACKOFF_LIMIT) - exp = BACKOFF_LIMIT; -#endif - divisor = RAND_MAX/(base << exp); - tmo = random()/divisor; - return tmo; -} -#endif /* MULTICAST_LEVEL_2 */ -/* ifconfig - configure network interface. */ -int -ifconfig (char *ip, char *sm, char *gw, char *svr) -{ - in_addr tmp; - - if (sm) - { - if (! inet_aton (sm, &tmp)) - return 0; - - netmask = tmp.s_addr; - } - - if (ip) - { - if (! inet_aton (ip, &arptable[ARP_CLIENT].ipaddr)) - return 0; - - if (! netmask && ! sm) - netmask = default_netmask (); - } - - if (gw && ! inet_aton (gw, &arptable[ARP_GATEWAY].ipaddr)) - return 0; - - /* Clear out the ARP entry. */ - grub_memset (arptable[ARP_GATEWAY].node, 0, ETH_ALEN); - - if (svr && ! inet_aton (svr, &arptable[ARP_SERVER].ipaddr)) - return 0; - - /* Likewise. */ - grub_memset (arptable[ARP_SERVER].node, 0, ETH_ALEN); - - if (ip || sm) - { - if (IP_BROADCAST == (netmask | arptable[ARP_CLIENT].ipaddr.s_addr) - || netmask == (netmask | arptable[ARP_CLIENT].ipaddr.s_addr) - || ! netmask) - network_ready = 0; - else - network_ready = 1; - } - - update_network_configuration(); - return 1; -} - -/* - * print_network_configuration - * - * Output the network configuration. It may broke the graphic console now.:-( - */ -void print_network_configuration (void) -{ - EnterFunction("print_network_configuration"); - if (! network_ready) - grub_printf ("Network interface not initialized yet.\n"); - else { - etherboot_printf ("Address: %@\n", arptable[ARP_CLIENT].ipaddr.s_addr); - etherboot_printf ("Netmask: %@\n", netmask); - etherboot_printf ("Server: %@\n", arptable[ARP_SERVER].ipaddr.s_addr); - etherboot_printf ("Gateway: %@\n", arptable[ARP_GATEWAY].ipaddr.s_addr); - } - LeaveFunction("print_network_configuration"); -} - -/* - * update_network_configuration - * - * Update network configuration for diskless clients (Solaris only) - */ -static void update_network_configuration (void) -{ -#ifdef SOLARIS_NETBOOT - struct sol_netinfo { - uint8_t sn_infotype; - uint8_t sn_mactype; - uint8_t sn_maclen; - uint8_t sn_padding; - unsigned long sn_ciaddr; - unsigned long sn_siaddr; - unsigned long sn_giaddr; - unsigned long sn_netmask; - uint8_t sn_macaddr[1]; - } *sip; - - if (! network_ready) - return; - - sip = (struct sol_netinfo *)dhcpack_buf; - sip->sn_infotype = 0xf0; /* something not BOOTP_REPLY */ - sip->sn_mactype = 4; /* DL_ETHER */ - sip->sn_maclen = ETH_ALEN; - sip->sn_ciaddr = arptable[ARP_CLIENT].ipaddr.s_addr; - sip->sn_siaddr = arptable[ARP_SERVER].ipaddr.s_addr; - sip->sn_giaddr = arptable[ARP_GATEWAY].ipaddr.s_addr; - sip->sn_netmask = netmask; - memcpy(sip->sn_macaddr, arptable[ARP_CLIENT].node, ETH_ALEN); - dhcpack_length = sizeof (*sip) + sip->sn_maclen - 1; -#endif /* SOLARIS_NETBOOT */ -} - -/** - * cleanup_net - * - * Mark network unusable, and disable NICs - */ -void cleanup_net (void) -{ - if (network_ready){ - /* Stop receiving packets. */ - if (use_bios_pxe) - undi_pxe_disable(); - else - eth_disable (); - network_ready = 0; - } -} - -/******************************************************************* - * dhcp implementation reusing the BIOS pxe stack - */ -static void -dhcp_copy(struct dhcp_t *dhcpreply) -{ - unsigned long time; - int ret, len = DHCP_OPT_LEN; - - /* fill in netinfo */ - dhcpack_length = sizeof (struct dhcp_t); - memcpy((char *)dhcpack_buf, (char *)dhcpreply, dhcpack_length); - - memcpy(arptable[ARP_CLIENT].node, dhcpreply->bp_hwaddr, ETH_ALEN); - arptable[ARP_CLIENT].ipaddr.s_addr = dhcpreply->bp_yiaddr.s_addr; - dhcp_addr.s_addr = dhcpreply->bp_yiaddr.s_addr; - netmask = default_netmask(); - arptable[ARP_SERVER].ipaddr.s_addr = dhcpreply->bp_siaddr.s_addr; - memset(arptable[ARP_SERVER].node, 0, ETH_ALEN); /* Kill arp */ - arptable[ARP_GATEWAY].ipaddr.s_addr = dhcpreply->bp_giaddr.s_addr; - memset(arptable[ARP_GATEWAY].node, 0, ETH_ALEN); /* Kill arp */ - /* We don't care bootpreply->bp_file. It must be 'pxegrub' */ - memcpy((char *)rfc1533_venddata, (char *)(dhcpreply->bp_vend), len); - decode_rfc1533(rfc1533_venddata, 0, len, 1); -} - -int dhcp_undi(void) -{ - struct dhcp_t *dhcpreply; - - if (!undi_bios_pxe((void **)&dhcpreply)) - return 0; - - dhcp_copy(dhcpreply); - network_ready = 1; - use_bios_pxe = 1; - return (1); -} diff --git a/usr/src/grub/grub-0.95/netboot/nic.h b/usr/src/grub/grub-0.95/netboot/nic.h deleted file mode 100644 index 40b35daf01..0000000000 --- a/usr/src/grub/grub-0.95/netboot/nic.h +++ /dev/null @@ -1,45 +0,0 @@ - /* - * 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. - */ - -#ifndef NIC_H -#define NIC_H - -#include "dev.h" - -typedef enum { - DISABLE = 0, - ENABLE, - FORCE -} irq_action_t; - -/* - * Structure returned from eth_probe and passed to other driver - * functions. - */ -struct nic -{ - struct dev dev; /* This must come first */ - int (*poll)P((struct nic *, int retrieve)); - void (*transmit)P((struct nic *, const char *d, - unsigned int t, unsigned int s, const char *p)); - void (*irq)P((struct nic *, irq_action_t)); - int flags; /* driver specific flags */ - struct rom_info *rom_info; /* -> rom_info from main */ - unsigned char *node_addr; - unsigned char *packet; - unsigned int packetlen; - unsigned int ioaddr; - unsigned char irqno; - void *priv_data; /* driver can hang private data here */ -}; - -extern int eth_probe(struct dev *dev); -extern int eth_poll(int retrieve); -extern void eth_transmit(const char *d, unsigned int t, unsigned int s, const void *p); -extern void eth_disable(void); -extern void eth_irq(irq_action_t action); -#endif /* NIC_H */ diff --git a/usr/src/grub/grub-0.95/netboot/ns83820.c b/usr/src/grub/grub-0.95/netboot/ns83820.c deleted file mode 100644 index d104d9cdae..0000000000 --- a/usr/src/grub/grub-0.95/netboot/ns83820.c +++ /dev/null @@ -1,1020 +0,0 @@ -/************************************************************************** -* ns83820.c: Etherboot device driver for the National Semiconductor 83820 -* Written 2004 by Timothy Legge -* -* 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. -* -* Portions of this code based on: -* ns83820.c by Benjamin LaHaise with contributions -* for Linux kernel 2.4.x. -* -* Linux Driver Version 0.20, 20020610 -* -* This development of this Etherboot driver was funded by: -* -* NXTV: http://www.nxtv.com/ -* -* REVISION HISTORY: -* ================ -* -* v1.0 02-16-2004 timlegge Initial port of Linux driver -* v1.1 02-19-2004 timlegge More rohbust transmit and poll -* -* Indent Options: indent -kr -i8 -***************************************************************************/ - -/* to get some global routines like printf */ -#include "etherboot.h" -/* to get the interface to the body of the program */ -#include "nic.h" -/* to get the PCI support functions, if this is a PCI NIC */ -#include "pci.h" - -#if ARCH == ia64 /* Support 64-bit addressing */ -#define USE_64BIT_ADDR -#endif - -//#define DDEBUG -#ifdef DDEBUG -#define dprintf(x) printf x -#else -#define dprintf(x) -#endif - -typedef unsigned char u8; -typedef signed char s8; -typedef unsigned short u16; -typedef signed short s16; -typedef unsigned int u32; -typedef signed int s32; - -#define HZ 100 - -/* Condensed operations for readability. */ -#define virt_to_le32desc(addr) cpu_to_le32(virt_to_bus(addr)) -#define le32desc_to_virt(addr) bus_to_virt(le32_to_cpu(addr)) - -/* NIC specific static variables go here */ - -/* Global parameters. See MODULE_PARM near the bottom. */ -// static int ihr = 2; -static int reset_phy = 0; -static int lnksts = 0; /* CFG_LNKSTS bit polarity */ - -#if defined(CONFIG_HIGHMEM64G) || defined(__ia64__) -#define USE_64BIT_ADDR "+" -#endif - -#if defined(USE_64BIT_ADDR) -#define TRY_DAC 1 -#else -#define TRY_DAC 0 -#endif - -/* tunables */ -#define RX_BUF_SIZE 1500 /* 8192 */ - -/* Must not exceed ~65000. */ -#define NR_RX_DESC 64 -#define NR_TX_DESC 1 - - /* not tunable *//* Extra 6 bytes for 64 bit alignment (divisable by 8) */ -#define REAL_RX_BUF_SIZE (RX_BUF_SIZE + 14 + 6) /* rx/tx mac addr + type */ - -#define MIN_TX_DESC_FREE 8 - -/* register defines */ -#define CFGCS 0x04 - -#define CR_TXE 0x00000001 -#define CR_TXD 0x00000002 -/* Ramit : Here's a tip, don't do a RXD immediately followed by an RXE - * The Receive engine skips one descriptor and moves - * onto the next one!! */ -#define CR_RXE 0x00000004 -#define CR_RXD 0x00000008 -#define CR_TXR 0x00000010 -#define CR_RXR 0x00000020 -#define CR_SWI 0x00000080 -#define CR_RST 0x00000100 - -#define PTSCR_EEBIST_FAIL 0x00000001 -#define PTSCR_EEBIST_EN 0x00000002 -#define PTSCR_EELOAD_EN 0x00000004 -#define PTSCR_RBIST_FAIL 0x000001b8 -#define PTSCR_RBIST_DONE 0x00000200 -#define PTSCR_RBIST_EN 0x00000400 -#define PTSCR_RBIST_RST 0x00002000 - -#define MEAR_EEDI 0x00000001 -#define MEAR_EEDO 0x00000002 -#define MEAR_EECLK 0x00000004 -#define MEAR_EESEL 0x00000008 -#define MEAR_MDIO 0x00000010 -#define MEAR_MDDIR 0x00000020 -#define MEAR_MDC 0x00000040 - -#define ISR_TXDESC3 0x40000000 -#define ISR_TXDESC2 0x20000000 -#define ISR_TXDESC1 0x10000000 -#define ISR_TXDESC0 0x08000000 -#define ISR_RXDESC3 0x04000000 -#define ISR_RXDESC2 0x02000000 -#define ISR_RXDESC1 0x01000000 -#define ISR_RXDESC0 0x00800000 -#define ISR_TXRCMP 0x00400000 -#define ISR_RXRCMP 0x00200000 -#define ISR_DPERR 0x00100000 -#define ISR_SSERR 0x00080000 -#define ISR_RMABT 0x00040000 -#define ISR_RTABT 0x00020000 -#define ISR_RXSOVR 0x00010000 -#define ISR_HIBINT 0x00008000 -#define ISR_PHY 0x00004000 -#define ISR_PME 0x00002000 -#define ISR_SWI 0x00001000 -#define ISR_MIB 0x00000800 -#define ISR_TXURN 0x00000400 -#define ISR_TXIDLE 0x00000200 -#define ISR_TXERR 0x00000100 -#define ISR_TXDESC 0x00000080 -#define ISR_TXOK 0x00000040 -#define ISR_RXORN 0x00000020 -#define ISR_RXIDLE 0x00000010 -#define ISR_RXEARLY 0x00000008 -#define ISR_RXERR 0x00000004 -#define ISR_RXDESC 0x00000002 -#define ISR_RXOK 0x00000001 - -#define TXCFG_CSI 0x80000000 -#define TXCFG_HBI 0x40000000 -#define TXCFG_MLB 0x20000000 -#define TXCFG_ATP 0x10000000 -#define TXCFG_ECRETRY 0x00800000 -#define TXCFG_BRST_DIS 0x00080000 -#define TXCFG_MXDMA1024 0x00000000 -#define TXCFG_MXDMA512 0x00700000 -#define TXCFG_MXDMA256 0x00600000 -#define TXCFG_MXDMA128 0x00500000 -#define TXCFG_MXDMA64 0x00400000 -#define TXCFG_MXDMA32 0x00300000 -#define TXCFG_MXDMA16 0x00200000 -#define TXCFG_MXDMA8 0x00100000 - -#define CFG_LNKSTS 0x80000000 -#define CFG_SPDSTS 0x60000000 -#define CFG_SPDSTS1 0x40000000 -#define CFG_SPDSTS0 0x20000000 -#define CFG_DUPSTS 0x10000000 -#define CFG_TBI_EN 0x01000000 -#define CFG_MODE_1000 0x00400000 -/* Ramit : Dont' ever use AUTO_1000, it never works and is buggy. - * Read the Phy response and then configure the MAC accordingly */ -#define CFG_AUTO_1000 0x00200000 -#define CFG_PINT_CTL 0x001c0000 -#define CFG_PINT_DUPSTS 0x00100000 -#define CFG_PINT_LNKSTS 0x00080000 -#define CFG_PINT_SPDSTS 0x00040000 -#define CFG_TMRTEST 0x00020000 -#define CFG_MRM_DIS 0x00010000 -#define CFG_MWI_DIS 0x00008000 -#define CFG_T64ADDR 0x00004000 -#define CFG_PCI64_DET 0x00002000 -#define CFG_DATA64_EN 0x00001000 -#define CFG_M64ADDR 0x00000800 -#define CFG_PHY_RST 0x00000400 -#define CFG_PHY_DIS 0x00000200 -#define CFG_EXTSTS_EN 0x00000100 -#define CFG_REQALG 0x00000080 -#define CFG_SB 0x00000040 -#define CFG_POW 0x00000020 -#define CFG_EXD 0x00000010 -#define CFG_PESEL 0x00000008 -#define CFG_BROM_DIS 0x00000004 -#define CFG_EXT_125 0x00000002 -#define CFG_BEM 0x00000001 - -#define EXTSTS_UDPPKT 0x00200000 -#define EXTSTS_TCPPKT 0x00080000 -#define EXTSTS_IPPKT 0x00020000 - -#define SPDSTS_POLARITY (CFG_SPDSTS1 | CFG_SPDSTS0 | CFG_DUPSTS | (lnksts ? CFG_LNKSTS : 0)) - -#define MIBC_MIBS 0x00000008 -#define MIBC_ACLR 0x00000004 -#define MIBC_FRZ 0x00000002 -#define MIBC_WRN 0x00000001 - -#define PCR_PSEN (1 << 31) -#define PCR_PS_MCAST (1 << 30) -#define PCR_PS_DA (1 << 29) -#define PCR_STHI_8 (3 << 23) -#define PCR_STLO_4 (1 << 23) -#define PCR_FFHI_8K (3 << 21) -#define PCR_FFLO_4K (1 << 21) -#define PCR_PAUSE_CNT 0xFFFE - -#define RXCFG_AEP 0x80000000 -#define RXCFG_ARP 0x40000000 -#define RXCFG_STRIPCRC 0x20000000 -#define RXCFG_RX_FD 0x10000000 -#define RXCFG_ALP 0x08000000 -#define RXCFG_AIRL 0x04000000 -#define RXCFG_MXDMA512 0x00700000 -#define RXCFG_DRTH 0x0000003e -#define RXCFG_DRTH0 0x00000002 - -#define RFCR_RFEN 0x80000000 -#define RFCR_AAB 0x40000000 -#define RFCR_AAM 0x20000000 -#define RFCR_AAU 0x10000000 -#define RFCR_APM 0x08000000 -#define RFCR_APAT 0x07800000 -#define RFCR_APAT3 0x04000000 -#define RFCR_APAT2 0x02000000 -#define RFCR_APAT1 0x01000000 -#define RFCR_APAT0 0x00800000 -#define RFCR_AARP 0x00400000 -#define RFCR_MHEN 0x00200000 -#define RFCR_UHEN 0x00100000 -#define RFCR_ULM 0x00080000 - -#define VRCR_RUDPE 0x00000080 -#define VRCR_RTCPE 0x00000040 -#define VRCR_RIPE 0x00000020 -#define VRCR_IPEN 0x00000010 -#define VRCR_DUTF 0x00000008 -#define VRCR_DVTF 0x00000004 -#define VRCR_VTREN 0x00000002 -#define VRCR_VTDEN 0x00000001 - -#define VTCR_PPCHK 0x00000008 -#define VTCR_GCHK 0x00000004 -#define VTCR_VPPTI 0x00000002 -#define VTCR_VGTI 0x00000001 - -#define CR 0x00 -#define CFG 0x04 -#define MEAR 0x08 -#define PTSCR 0x0c -#define ISR 0x10 -#define IMR 0x14 -#define IER 0x18 -#define IHR 0x1c -#define TXDP 0x20 -#define TXDP_HI 0x24 -#define TXCFG 0x28 -#define GPIOR 0x2c -#define RXDP 0x30 -#define RXDP_HI 0x34 -#define RXCFG 0x38 -#define PQCR 0x3c -#define WCSR 0x40 -#define PCR 0x44 -#define RFCR 0x48 -#define RFDR 0x4c - -#define SRR 0x58 - -#define VRCR 0xbc -#define VTCR 0xc0 -#define VDR 0xc4 -#define CCSR 0xcc - -#define TBICR 0xe0 -#define TBISR 0xe4 -#define TANAR 0xe8 -#define TANLPAR 0xec -#define TANER 0xf0 -#define TESR 0xf4 - -#define TBICR_MR_AN_ENABLE 0x00001000 -#define TBICR_MR_RESTART_AN 0x00000200 - -#define TBISR_MR_LINK_STATUS 0x00000020 -#define TBISR_MR_AN_COMPLETE 0x00000004 - -#define TANAR_PS2 0x00000100 -#define TANAR_PS1 0x00000080 -#define TANAR_HALF_DUP 0x00000040 -#define TANAR_FULL_DUP 0x00000020 - -#define GPIOR_GP5_OE 0x00000200 -#define GPIOR_GP4_OE 0x00000100 -#define GPIOR_GP3_OE 0x00000080 -#define GPIOR_GP2_OE 0x00000040 -#define GPIOR_GP1_OE 0x00000020 -#define GPIOR_GP3_OUT 0x00000004 -#define GPIOR_GP1_OUT 0x00000001 - -#define LINK_AUTONEGOTIATE 0x01 -#define LINK_DOWN 0x02 -#define LINK_UP 0x04 - - -#define __kick_rx() writel(CR_RXE, ns->base + CR) - -#define kick_rx() do { \ - dprintf(("kick_rx: maybe kicking\n")); \ - writel(virt_to_le32desc(&rx_ring[ns->cur_rx]), ns->base + RXDP); \ - if (ns->next_rx == ns->next_empty) \ - printf("uh-oh: next_rx == next_empty???\n"); \ - __kick_rx(); \ -} while(0) - - -#ifdef USE_64BIT_ADDR -#define HW_ADDR_LEN 8 -#else -#define HW_ADDR_LEN 4 -#endif - -#define CMDSTS_OWN 0x80000000 -#define CMDSTS_MORE 0x40000000 -#define CMDSTS_INTR 0x20000000 -#define CMDSTS_ERR 0x10000000 -#define CMDSTS_OK 0x08000000 -#define CMDSTS_LEN_MASK 0x0000ffff - -#define CMDSTS_DEST_MASK 0x01800000 -#define CMDSTS_DEST_SELF 0x00800000 -#define CMDSTS_DEST_MULTI 0x01000000 - -#define DESC_SIZE 8 /* Should be cache line sized */ - -#ifdef USE_64BIT_ADDR -struct ring_desc { - uint64_t link; - uint64_t bufptr; - u32 cmdsts; - u32 extsts; /* Extended status field */ -}; -#else -struct ring_desc { - u32 link; - u32 bufptr; - u32 cmdsts; - u32 extsts; /* Extended status field */ -}; -#endif - -/* Define the TX Descriptor */ -static struct ring_desc tx_ring[NR_TX_DESC] - __attribute__ ((aligned(8))); - -/* Create a static buffer of size REAL_RX_BUF_SIZE for each -TX Descriptor. All descriptors point to a -part of this buffer */ -static unsigned char txb[NR_TX_DESC * REAL_RX_BUF_SIZE]; - -/* Define the TX Descriptor */ -static struct ring_desc rx_ring[NR_RX_DESC] - __attribute__ ((aligned(8))); - -/* Create a static buffer of size REAL_RX_BUF_SIZE for each -RX Descriptor All descriptors point to a -part of this buffer */ -static unsigned char rxb[NR_RX_DESC * REAL_RX_BUF_SIZE] - __attribute__ ((aligned(8))); - -/* Private Storage for the NIC */ -struct ns83820_private { - u8 *base; - int up; - long idle; - u32 *next_rx_desc; - u16 next_rx, next_empty; - u32 cur_rx; - u32 *descs; - unsigned ihr; - u32 CFG_cache; - u32 MEAR_cache; - u32 IMR_cache; - int linkstate; - u16 tx_done_idx; - u16 tx_idx; - u16 tx_intr_idx; - u32 phy_descs; - u32 *tx_descs; - -} nsx; -static struct ns83820_private *ns; - -static void phy_intr(struct nic *nic __unused) -{ - static char *speeds[] = - { "10", "100", "1000", "1000(?)", "1000F" }; - u32 cfg, new_cfg; - u32 tbisr, tanar, tanlpar; - int speed, fullduplex, newlinkstate; - - cfg = readl(ns->base + CFG) ^ SPDSTS_POLARITY; - if (ns->CFG_cache & CFG_TBI_EN) { - /* we have an optical transceiver */ - tbisr = readl(ns->base + TBISR); - tanar = readl(ns->base + TANAR); - tanlpar = readl(ns->base + TANLPAR); - dprintf(("phy_intr: tbisr=%hX, tanar=%hX, tanlpar=%hX\n", - tbisr, tanar, tanlpar)); - - if ((fullduplex = (tanlpar & TANAR_FULL_DUP) - && (tanar & TANAR_FULL_DUP))) { - - /* both of us are full duplex */ - writel(readl(ns->base + TXCFG) - | TXCFG_CSI | TXCFG_HBI | TXCFG_ATP, - ns->base + TXCFG); - writel(readl(ns->base + RXCFG) | RXCFG_RX_FD, - ns->base + RXCFG); - /* Light up full duplex LED */ - writel(readl(ns->base + GPIOR) | GPIOR_GP1_OUT, - ns->base + GPIOR); - - } else if (((tanlpar & TANAR_HALF_DUP) - && (tanar & TANAR_HALF_DUP)) - || ((tanlpar & TANAR_FULL_DUP) - && (tanar & TANAR_HALF_DUP)) - || ((tanlpar & TANAR_HALF_DUP) - && (tanar & TANAR_FULL_DUP))) { - - /* one or both of us are half duplex */ - writel((readl(ns->base + TXCFG) - & ~(TXCFG_CSI | TXCFG_HBI)) | TXCFG_ATP, - ns->base + TXCFG); - writel(readl(ns->base + RXCFG) & ~RXCFG_RX_FD, - ns->base + RXCFG); - /* Turn off full duplex LED */ - writel(readl(ns->base + GPIOR) & ~GPIOR_GP1_OUT, - ns->base + GPIOR); - } - - speed = 4; /* 1000F */ - - } else { - /* we have a copper transceiver */ - new_cfg = - ns->CFG_cache & ~(CFG_SB | CFG_MODE_1000 | CFG_SPDSTS); - - if (cfg & CFG_SPDSTS1) - new_cfg |= CFG_MODE_1000; - else - new_cfg &= ~CFG_MODE_1000; - - speed = ((cfg / CFG_SPDSTS0) & 3); - fullduplex = (cfg & CFG_DUPSTS); - - if (fullduplex) - new_cfg |= CFG_SB; - - if ((cfg & CFG_LNKSTS) && - ((new_cfg ^ ns->CFG_cache) & CFG_MODE_1000)) { - writel(new_cfg, ns->base + CFG); - ns->CFG_cache = new_cfg; - } - - ns->CFG_cache &= ~CFG_SPDSTS; - ns->CFG_cache |= cfg & CFG_SPDSTS; - } - - newlinkstate = (cfg & CFG_LNKSTS) ? LINK_UP : LINK_DOWN; - - if (newlinkstate & LINK_UP && ns->linkstate != newlinkstate) { - printf("link now %s mbps, %s duplex and up.\n", - speeds[speed], fullduplex ? "full" : "half"); - } else if (newlinkstate & LINK_DOWN - && ns->linkstate != newlinkstate) { - printf("link now down.\n"); - } - ns->linkstate = newlinkstate; -} -static void ns83820_set_multicast(struct nic *nic __unused); -static void ns83820_setup_rx(struct nic *nic) -{ - unsigned i; - ns->idle = 1; - ns->next_rx = 0; - ns->next_rx_desc = ns->descs; - ns->next_empty = 0; - ns->cur_rx = 0; - - - for (i = 0; i < NR_RX_DESC; i++) { - rx_ring[i].link = virt_to_le32desc(&rx_ring[i + 1]); - rx_ring[i].bufptr = - virt_to_le32desc(&rxb[i * REAL_RX_BUF_SIZE]); - rx_ring[i].cmdsts = cpu_to_le32(REAL_RX_BUF_SIZE); - rx_ring[i].extsts = cpu_to_le32(0); - } -// No need to wrap the ring -// rx_ring[i].link = virt_to_le32desc(&rx_ring[0]); - writel(0, ns->base + RXDP_HI); - writel(virt_to_le32desc(&rx_ring[0]), ns->base + RXDP); - - dprintf(("starting receiver\n")); - - writel(0x0001, ns->base + CCSR); - writel(0, ns->base + RFCR); - writel(0x7fc00000, ns->base + RFCR); - writel(0xffc00000, ns->base + RFCR); - - ns->up = 1; - - phy_intr(nic); - - /* Okay, let it rip */ - ns->IMR_cache |= ISR_PHY; - ns->IMR_cache |= ISR_RXRCMP; - //dev->IMR_cache |= ISR_RXERR; - //dev->IMR_cache |= ISR_RXOK; - ns->IMR_cache |= ISR_RXORN; - ns->IMR_cache |= ISR_RXSOVR; - ns->IMR_cache |= ISR_RXDESC; - ns->IMR_cache |= ISR_RXIDLE; - ns->IMR_cache |= ISR_TXDESC; - ns->IMR_cache |= ISR_TXIDLE; - - // No reason to enable interupts... - // writel(ns->IMR_cache, ns->base + IMR); - // writel(1, ns->base + IER); - ns83820_set_multicast(nic); - kick_rx(); -} - - -static void ns83820_do_reset(struct nic *nic __unused, u32 which) -{ - dprintf(("resetting chip...\n")); - writel(which, ns->base + CR); - do { - - } while (readl(ns->base + CR) & which); - dprintf(("okay!\n")); -} - -static void ns83820_reset(struct nic *nic) -{ - unsigned i; - dprintf(("ns83820_reset\n")); - - writel(0, ns->base + PQCR); - - ns83820_setup_rx(nic); - - for (i = 0; i < NR_TX_DESC; i++) { - tx_ring[i].link = 0; - tx_ring[i].bufptr = 0; - tx_ring[i].cmdsts = cpu_to_le32(0); - tx_ring[i].extsts = cpu_to_le32(0); - } - - ns->tx_idx = 0; - ns->tx_done_idx = 0; - writel(0, ns->base + TXDP_HI); - return; -} -static void ns83820_getmac(struct nic *nic __unused, u8 * mac) -{ - unsigned i; - for (i = 0; i < 3; i++) { - u32 data; - /* Read from the perfect match memory: this is loaded by - * the chip from the EEPROM via the EELOAD self test. - */ - writel(i * 2, ns->base + RFCR); - data = readl(ns->base + RFDR); - *mac++ = data; - *mac++ = data >> 8; - } -} - -static void ns83820_set_multicast(struct nic *nic __unused) -{ - u8 *rfcr = ns->base + RFCR; - u32 and_mask = 0xffffffff; - u32 or_mask = 0; - u32 val; - - /* Support Multicast */ - and_mask &= ~(RFCR_AAU | RFCR_AAM); - or_mask |= RFCR_AAM; - val = (readl(rfcr) & and_mask) | or_mask; - /* Ramit : RFCR Write Fix doc says RFEN must be 0 modify other bits */ - writel(val & ~RFCR_RFEN, rfcr); - writel(val, rfcr); - -} -static void ns83820_run_bist(struct nic *nic __unused, const char *name, - u32 enable, u32 done, u32 fail) -{ - int timed_out = 0; - long start; - u32 status; - int loops = 0; - - dprintf(("start %s\n", name)) - - start = currticks(); - - writel(enable, ns->base + PTSCR); - for (;;) { - loops++; - status = readl(ns->base + PTSCR); - if (!(status & enable)) - break; - if (status & done) - break; - if (status & fail) - break; - if ((currticks() - start) >= HZ) { - timed_out = 1; - break; - } - } - - if (status & fail) - printf("%s failed! (0x%hX & 0x%hX)\n", name, status, fail); - else if (timed_out) - printf("run_bist %s timed out! (%hX)\n", name, status); - dprintf(("done %s in %d loops\n", name, loops)); -} - -/************************************* -Check Link -*************************************/ -static void ns83820_check_intr(struct nic *nic) { - int i; - u32 isr = readl(ns->base + ISR); - if(ISR_PHY & isr) - phy_intr(nic); - if(( ISR_RXIDLE | ISR_RXDESC | ISR_RXERR) & isr) - kick_rx(); - for (i = 0; i < NR_RX_DESC; i++) { - if (rx_ring[i].cmdsts == CMDSTS_OWN) { -// rx_ring[i].link = virt_to_le32desc(&rx_ring[i + 1]); - rx_ring[i].cmdsts = cpu_to_le32(REAL_RX_BUF_SIZE); - } - } -} -/************************************************************************** -POLL - Wait for a frame -***************************************************************************/ -static int ns83820_poll(struct nic *nic, int retrieve) -{ - /* return true if there's an ethernet packet ready to read */ - /* nic->packet should contain data on return */ - /* nic->packetlen should contain length of data */ - u32 cmdsts; - int entry = ns->cur_rx; - - ns83820_check_intr(nic); - - cmdsts = le32_to_cpu(rx_ring[entry].cmdsts); - - if ( ! ( (CMDSTS_OWN & (cmdsts)) && (cmdsts != (CMDSTS_OWN)) ) ) - return 0; - - if ( ! retrieve ) return 1; - - if (! (CMDSTS_OK & cmdsts) ) - return 0; - - nic->packetlen = cmdsts & 0xffff; - memcpy(nic->packet, - rxb + (entry * REAL_RX_BUF_SIZE), - nic->packetlen); - // rx_ring[entry].link = 0; - rx_ring[entry].cmdsts = cpu_to_le32(CMDSTS_OWN); - - ns->cur_rx = ++ns->cur_rx % NR_RX_DESC; - - if (ns->cur_rx == 0) /* We have wrapped the ring */ - kick_rx(); - - return 1; -} - -static inline void kick_tx(struct nic *nic __unused) -{ - dprintf(("kick_tx\n")); - writel(CR_TXE, ns->base + CR); -} - -/************************************************************************** -TRANSMIT - Transmit a frame -***************************************************************************/ -static void ns83820_transmit(struct nic *nic, const char *d, /* Destination */ - unsigned int t, /* Type */ - unsigned int s, /* size */ - const char *p) -{ /* Packet */ - /* send the packet to destination */ - - u16 nstype; - u32 cmdsts, extsts; - int cur_tx = 0; - u32 isr = readl(ns->base + ISR); - if (ISR_TXIDLE & isr) - kick_tx(nic); - /* point to the current txb incase multiple tx_rings are used */ - memcpy(txb, d, ETH_ALEN); - memcpy(txb + ETH_ALEN, nic->node_addr, ETH_ALEN); - nstype = htons((u16) t); - memcpy(txb + 2 * ETH_ALEN, (u8 *) & nstype, 2); - memcpy(txb + ETH_HLEN, p, s); - s += ETH_HLEN; - s &= 0x0FFF; - while (s < ETH_ZLEN) - txb[s++] = '\0'; - - /* Setup the transmit descriptor */ - extsts = 0; - extsts |= EXTSTS_UDPPKT; - - tx_ring[cur_tx].bufptr = virt_to_le32desc(&txb); - tx_ring[cur_tx].extsts = cpu_to_le32(extsts); - - cmdsts = cpu_to_le32(0); - cmdsts |= cpu_to_le32(CMDSTS_OWN | s); - tx_ring[cur_tx].cmdsts = cpu_to_le32(cmdsts); - - writel(virt_to_le32desc(&tx_ring[0]), ns->base + TXDP); - kick_tx(nic); -} - -/************************************************************************** -DISABLE - Turn off ethernet interface -***************************************************************************/ -static void ns83820_disable(struct dev *dev) -{ - /* put the card in its initial state */ - /* This function serves 3 purposes. - * This disables DMA and interrupts so we don't receive - * unexpected packets or interrupts from the card after - * etherboot has finished. - * This frees resources so etherboot may use - * this driver on another interface - * This allows etherboot to reinitialize the interface - * if something is something goes wrong. - */ - /* disable interrupts */ - writel(0, ns->base + IMR); - writel(0, ns->base + IER); - readl(ns->base + IER); - - ns->up = 0; - - ns83820_do_reset((struct nic *) dev, CR_RST); - - ns->IMR_cache &= - ~(ISR_RXOK | ISR_RXDESC | ISR_RXERR | ISR_RXEARLY | - ISR_RXIDLE); - writel(ns->IMR_cache, ns->base + IMR); - - /* touch the pci bus... */ - readl(ns->base + IMR); - - /* assumes the transmitter is already disabled and reset */ - writel(0, ns->base + RXDP_HI); - writel(0, ns->base + RXDP); -} - -/************************************************************************** -IRQ - Enable, Disable, or Force interrupts -***************************************************************************/ -static void ns83820_irq(struct nic *nic __unused, irq_action_t action __unused) -{ - switch ( action ) { - case DISABLE : - break; - case ENABLE : - break; - case FORCE : - break; - } -} - -/************************************************************************** -PROBE - Look for an adapter, this routine's visible to the outside -***************************************************************************/ - -#define board_found 1 -#define valid_link 0 -static int ns83820_probe(struct dev *dev, struct pci_device *pci) -{ - struct nic *nic = (struct nic *) dev; - int sz; - long addr; - int using_dac = 0; - - if (pci->ioaddr == 0) - return 0; - - printf("ns83820.c: Found %s, vendor=0x%hX, device=0x%hX\n", - pci->name, pci->vendor, pci->dev_id); - - /* point to private storage */ - ns = &nsx; - - adjust_pci_device(pci); - - addr = pci_bar_start(pci, PCI_BASE_ADDRESS_1); - sz = pci_bar_size(pci, PCI_BASE_ADDRESS_1); - - ns->base = ioremap(addr, (1UL << 12)); -// ns->base = ioremap(addr, sz); - - if (!ns->base) - return 0; - - nic->irqno = 0; - nic->ioaddr = pci->ioaddr & ~3; - - /* disable interrupts */ - writel(0, ns->base + IMR); - writel(0, ns->base + IER); - readl(ns->base + IER); - - ns->IMR_cache = 0; - - ns83820_do_reset(nic, CR_RST); - - /* Must reset the ram bist before running it */ - writel(PTSCR_RBIST_RST, ns->base + PTSCR); - ns83820_run_bist(nic, "sram bist", PTSCR_RBIST_EN, - PTSCR_RBIST_DONE, PTSCR_RBIST_FAIL); - ns83820_run_bist(nic, "eeprom bist", PTSCR_EEBIST_EN, 0, - PTSCR_EEBIST_FAIL); - ns83820_run_bist(nic, "eeprom load", PTSCR_EELOAD_EN, 0, 0); - - /* I love config registers */ - ns->CFG_cache = readl(ns->base + CFG); - - if ((ns->CFG_cache & CFG_PCI64_DET)) { - printf("%s: detected 64 bit PCI data bus.\n", pci->name); - /*dev->CFG_cache |= CFG_DATA64_EN; */ - if (!(ns->CFG_cache & CFG_DATA64_EN)) - printf - ("%s: EEPROM did not enable 64 bit bus. Disabled.\n", - pci->name); - } else - ns->CFG_cache &= ~(CFG_DATA64_EN); - - ns->CFG_cache &= (CFG_TBI_EN | CFG_MRM_DIS | CFG_MWI_DIS | - CFG_T64ADDR | CFG_DATA64_EN | CFG_EXT_125 | - CFG_M64ADDR); - ns->CFG_cache |= - CFG_PINT_DUPSTS | CFG_PINT_LNKSTS | CFG_PINT_SPDSTS | - CFG_EXTSTS_EN | CFG_EXD | CFG_PESEL; - ns->CFG_cache |= CFG_REQALG; - ns->CFG_cache |= CFG_POW; - ns->CFG_cache |= CFG_TMRTEST; - - /* When compiled with 64 bit addressing, we must always enable - * the 64 bit descriptor format. - */ -#ifdef USE_64BIT_ADDR - ns->CFG_cache |= CFG_M64ADDR; -#endif - -//FIXME: Enable section on dac or remove this - if (using_dac) - ns->CFG_cache |= CFG_T64ADDR; - - /* Big endian mode does not seem to do what the docs suggest */ - ns->CFG_cache &= ~CFG_BEM; - - /* setup optical transceiver if we have one */ - if (ns->CFG_cache & CFG_TBI_EN) { - dprintf(("%s: enabling optical transceiver\n", pci->name)); - writel(readl(ns->base + GPIOR) | 0x3e8, ns->base + GPIOR); - - /* setup auto negotiation feature advertisement */ - writel(readl(ns->base + TANAR) - | TANAR_HALF_DUP | TANAR_FULL_DUP, - ns->base + TANAR); - - /* start auto negotiation */ - writel(TBICR_MR_AN_ENABLE | TBICR_MR_RESTART_AN, - ns->base + TBICR); - writel(TBICR_MR_AN_ENABLE, ns->base + TBICR); - ns->linkstate = LINK_AUTONEGOTIATE; - - ns->CFG_cache |= CFG_MODE_1000; - } - writel(ns->CFG_cache, ns->base + CFG); - dprintf(("CFG: %hX\n", ns->CFG_cache)); - - /* FIXME: reset_phy is defaulted to 0, should we reset anyway? */ - if (reset_phy) { - dprintf(("%s: resetting phy\n", pci->name)); - writel(ns->CFG_cache | CFG_PHY_RST, ns->base + CFG); - writel(ns->CFG_cache, ns->base + CFG); - } -#if 0 /* Huh? This sets the PCI latency register. Should be done via - * the PCI layer. FIXME. - */ - if (readl(dev->base + SRR)) - writel(readl(dev->base + 0x20c) | 0xfe00, - dev->base + 0x20c); -#endif - - /* Note! The DMA burst size interacts with packet - * transmission, such that the largest packet that - * can be transmitted is 8192 - FLTH - burst size. - * If only the transmit fifo was larger... - */ - /* Ramit : 1024 DMA is not a good idea, it ends up banging - * some DELL and COMPAQ SMP systems */ - writel(TXCFG_CSI | TXCFG_HBI | TXCFG_ATP | TXCFG_MXDMA512 - | ((1600 / 32) * 0x100), ns->base + TXCFG); - - /* Set Rx to full duplex, don't accept runt, errored, long or length - * range errored packets. Use 512 byte DMA. - */ - /* Ramit : 1024 DMA is not a good idea, it ends up banging - * some DELL and COMPAQ SMP systems - * Turn on ALP, only we are accpeting Jumbo Packets */ - writel(RXCFG_AEP | RXCFG_ARP | RXCFG_AIRL | RXCFG_RX_FD - | RXCFG_STRIPCRC - //| RXCFG_ALP - | (RXCFG_MXDMA512) | 0, ns->base + RXCFG); - - /* Disable priority queueing */ - writel(0, ns->base + PQCR); - - /* Enable IP checksum validation and detetion of VLAN headers. - * Note: do not set the reject options as at least the 0x102 - * revision of the chip does not properly accept IP fragments - * at least for UDP. - */ - /* Ramit : Be sure to turn on RXCFG_ARP if VLAN's are enabled, since - * the MAC it calculates the packetsize AFTER stripping the VLAN - * header, and if a VLAN Tagged packet of 64 bytes is received (like - * a ping with a VLAN header) then the card, strips the 4 byte VLAN - * tag and then checks the packet size, so if RXCFG_ARP is not enabled, - * it discrards it!. These guys...... - */ - writel(VRCR_IPEN | VRCR_VTDEN, ns->base + VRCR); - - /* Enable per-packet TCP/UDP/IP checksumming */ - writel(VTCR_PPCHK, ns->base + VTCR); - - /* Ramit : Enable async and sync pause frames */ -// writel(0, ns->base + PCR); - writel((PCR_PS_MCAST | PCR_PS_DA | PCR_PSEN | PCR_FFLO_4K | - PCR_FFHI_8K | PCR_STLO_4 | PCR_STHI_8 | PCR_PAUSE_CNT), - ns->base + PCR); - - /* Disable Wake On Lan */ - writel(0, ns->base + WCSR); - - ns83820_getmac(nic, nic->node_addr); - printf("%! at ioaddr 0x%hX, ", nic->node_addr, ns->base); - - if (using_dac) { - dprintf(("%s: using 64 bit addressing.\n", pci->name)); - } - - dprintf(("%s: DP83820 %d.%d: %! io=0x%hX\n", - pci->name, - (unsigned) readl(ns->base + SRR) >> 8, - (unsigned) readl(ns->base + SRR) & 0xff, - nic->node_addr, pci->ioaddr)); - -#ifdef PHY_CODE_IS_FINISHED - ns83820_probe_phy(dev); -#endif - - ns83820_reset(nic); - /* point to NIC specific routines */ - dev->disable = ns83820_disable; - nic->poll = ns83820_poll; - nic->transmit = ns83820_transmit; - nic->irq = ns83820_irq; - return 1; -} - -static struct pci_id ns83820_nics[] = { - PCI_ROM(0x100b, 0x0022, "ns83820", "National Semiconductor 83820"), -}; - -struct pci_driver ns83820_driver = { - .type = NIC_DRIVER, - .name = "NS83820/PCI", - .probe = ns83820_probe, - .ids = ns83820_nics, - .id_count = sizeof(ns83820_nics) / sizeof(ns83820_nics[0]), - .class = 0, -}; diff --git a/usr/src/grub/grub-0.95/netboot/ns8390.c b/usr/src/grub/grub-0.95/netboot/ns8390.c deleted file mode 100644 index 14e0dd1176..0000000000 --- a/usr/src/grub/grub-0.95/netboot/ns8390.c +++ /dev/null @@ -1,1016 +0,0 @@ -/************************************************************************** -ETHERBOOT - BOOTP/TFTP Bootstrap Program - -Author: Martin Renters - Date: May/94 - - This code is based heavily on David Greenman's if_ed.c driver - - Copyright (C) 1993-1994, David Greenman, Martin Renters. - This software may be used, modified, copied, distributed, and sold, in - both source and binary form provided that the above copyright and these - terms are retained. Under no circumstances are the authors responsible for - the proper functioning of this software, nor do the authors assume any - responsibility for damages incurred with its use. - -Multicast support added by Timothy Legge (timlegge@users.sourceforge.net) 09/28/2003 -Relocation support added by Ken Yap (ken_yap@users.sourceforge.net) 28/12/02 -3c503 support added by Bill Paul (wpaul@ctr.columbia.edu) on 11/15/94 -SMC8416 support added by Bill Paul (wpaul@ctr.columbia.edu) on 12/25/94 -3c503 PIO support added by Jim Hague (jim.hague@acm.org) on 2/17/98 -RX overrun by Klaus Espenlaub (espenlaub@informatik.uni-ulm.de) on 3/10/99 - parts taken from the Linux 8390 driver (by Donald Becker and Paul Gortmaker) -SMC8416 PIO support added by Andrew Bettison (andrewb@zip.com.au) on 4/3/02 - based on the Linux 8390 driver (by Donald Becker and Paul Gortmaker) - -**************************************************************************/ - -#include "etherboot.h" -#include "nic.h" -#include "ns8390.h" -#ifdef INCLUDE_NS8390 -#include "pci.h" -#else -#include "isa.h" -#endif - -static unsigned char eth_vendor, eth_flags; -#ifdef INCLUDE_WD -static unsigned char eth_laar; -#endif -static unsigned short eth_nic_base, eth_asic_base; -static unsigned char eth_memsize, eth_rx_start, eth_tx_start; -static Address eth_bmem, eth_rmem; -static unsigned char eth_drain_receiver; - -#ifdef INCLUDE_WD -static struct wd_board { - const char *name; - char id; - char flags; - char memsize; -} wd_boards[] = { - {"WD8003S", TYPE_WD8003S, 0, MEM_8192}, - {"WD8003E", TYPE_WD8003E, 0, MEM_8192}, - {"WD8013EBT", TYPE_WD8013EBT, FLAG_16BIT, MEM_16384}, - {"WD8003W", TYPE_WD8003W, 0, MEM_8192}, - {"WD8003EB", TYPE_WD8003EB, 0, MEM_8192}, - {"WD8013W", TYPE_WD8013W, FLAG_16BIT, MEM_16384}, - {"WD8003EP/WD8013EP", - TYPE_WD8013EP, 0, MEM_8192}, - {"WD8013WC", TYPE_WD8013WC, FLAG_16BIT, MEM_16384}, - {"WD8013EPC", TYPE_WD8013EPC, FLAG_16BIT, MEM_16384}, - {"SMC8216T", TYPE_SMC8216T, FLAG_16BIT | FLAG_790, MEM_16384}, - {"SMC8216C", TYPE_SMC8216C, FLAG_16BIT | FLAG_790, MEM_16384}, - {"SMC8416T", TYPE_SMC8416T, FLAG_16BIT | FLAG_790, MEM_8192}, - {"SMC8416C/BT", TYPE_SMC8416C, FLAG_16BIT | FLAG_790, MEM_8192}, - {"SMC8013EBP", TYPE_SMC8013EBP,FLAG_16BIT, MEM_16384}, - {NULL, 0, 0, 0} -}; -#endif - -#ifdef INCLUDE_3C503 -static unsigned char t503_output; /* AUI or internal xcvr (Thinnet) */ -#endif - -#if defined(INCLUDE_WD) -#define ASIC_PIO WD_IAR -#define eth_probe wd_probe -#if defined(INCLUDE_3C503) || defined(INCLUDE_NE) || defined(INCLUDE_NS8390) -Error you must only define one of INCLUDE_WD, INCLUDE_3C503, INCLUDE_NE, INCLUDE_NS8390 -#endif -#endif - -#if defined(INCLUDE_3C503) -#define eth_probe t503_probe -#if defined(INCLUDE_NE) || defined(INCLUDE_NS8390) || defined(INCLUDE_WD) -Error you must only define one of INCLUDE_WD, INCLUDE_3C503, INCLUDE_NE, INCLUDE_NS8390 -#endif -#endif - -#if defined(INCLUDE_NE) -#define eth_probe ne_probe -#if defined(INCLUDE_NS8390) || defined(INCLUDE_3C503) || defined(INCLUDE_WD) -Error you must only define one of INCLUDE_WD, INCLUDE_3C503, INCLUDE_NE, INCLUDE_NS8390 -#endif -#endif - -#if defined(INCLUDE_NS8390) -#define eth_probe nepci_probe -#if defined(INCLUDE_NE) || defined(INCLUDE_3C503) || defined(INCLUDE_WD) -Error you must only define one of INCLUDE_WD, INCLUDE_3C503, INCLUDE_NE, INCLUDE_NS8390 -#endif -#endif - -#if defined(INCLUDE_3C503) -#define ASIC_PIO _3COM_RFMSB -#else -#if defined(INCLUDE_NE) || defined(INCLUDE_NS8390) -#define ASIC_PIO NE_DATA -#endif -#endif - -#if defined(INCLUDE_NE) || defined(INCLUDE_NS8390) || (defined(INCLUDE_3C503) && !defined(T503_SHMEM)) || (defined(INCLUDE_WD) && defined(WD_790_PIO)) -/************************************************************************** -ETH_PIO_READ - Read a frame via Programmed I/O -**************************************************************************/ -static void eth_pio_read(unsigned int src, unsigned char *dst, unsigned int cnt) -{ -#ifdef INCLUDE_WD - outb(src & 0xff, eth_asic_base + WD_GP2); - outb(src >> 8, eth_asic_base + WD_GP2); -#else - outb(D8390_COMMAND_RD2 | - D8390_COMMAND_STA, eth_nic_base + D8390_P0_COMMAND); - outb(cnt, eth_nic_base + D8390_P0_RBCR0); - outb(cnt>>8, eth_nic_base + D8390_P0_RBCR1); - outb(src, eth_nic_base + D8390_P0_RSAR0); - outb(src>>8, eth_nic_base + D8390_P0_RSAR1); - outb(D8390_COMMAND_RD0 | - D8390_COMMAND_STA, eth_nic_base + D8390_P0_COMMAND); - -#ifdef INCLUDE_3C503 - outb(src & 0xff, eth_asic_base + _3COM_DALSB); - outb(src >> 8, eth_asic_base + _3COM_DAMSB); - outb(t503_output | _3COM_CR_START, eth_asic_base + _3COM_CR); -#endif -#endif - - if (eth_flags & FLAG_16BIT) - cnt = (cnt + 1) >> 1; - - while(cnt--) { -#ifdef INCLUDE_3C503 - while((inb(eth_asic_base + _3COM_STREG) & _3COM_STREG_DPRDY) == 0) - ; -#endif - - if (eth_flags & FLAG_16BIT) { - *((unsigned short *)dst) = inw(eth_asic_base + ASIC_PIO); - dst += 2; - } - else - *(dst++) = inb(eth_asic_base + ASIC_PIO); - } - -#ifdef INCLUDE_3C503 - outb(t503_output, eth_asic_base + _3COM_CR); -#endif -} - -/************************************************************************** -ETH_PIO_WRITE - Write a frame via Programmed I/O -**************************************************************************/ -static void eth_pio_write(const unsigned char *src, unsigned int dst, unsigned int cnt) -{ -#ifdef COMPEX_RL2000_FIX - unsigned int x; -#endif /* COMPEX_RL2000_FIX */ -#ifdef INCLUDE_WD - outb(dst & 0xff, eth_asic_base + WD_GP2); - outb(dst >> 8, eth_asic_base + WD_GP2); -#else - outb(D8390_COMMAND_RD2 | - D8390_COMMAND_STA, eth_nic_base + D8390_P0_COMMAND); - outb(D8390_ISR_RDC, eth_nic_base + D8390_P0_ISR); - outb(cnt, eth_nic_base + D8390_P0_RBCR0); - outb(cnt>>8, eth_nic_base + D8390_P0_RBCR1); - outb(dst, eth_nic_base + D8390_P0_RSAR0); - outb(dst>>8, eth_nic_base + D8390_P0_RSAR1); - outb(D8390_COMMAND_RD1 | - D8390_COMMAND_STA, eth_nic_base + D8390_P0_COMMAND); - -#ifdef INCLUDE_3C503 - outb(dst & 0xff, eth_asic_base + _3COM_DALSB); - outb(dst >> 8, eth_asic_base + _3COM_DAMSB); - - outb(t503_output | _3COM_CR_DDIR | _3COM_CR_START, eth_asic_base + _3COM_CR); -#endif -#endif - - if (eth_flags & FLAG_16BIT) - cnt = (cnt + 1) >> 1; - - while(cnt--) - { -#ifdef INCLUDE_3C503 - while((inb(eth_asic_base + _3COM_STREG) & _3COM_STREG_DPRDY) == 0) - ; -#endif - - if (eth_flags & FLAG_16BIT) { - outw(*((unsigned short *)src), eth_asic_base + ASIC_PIO); - src += 2; - } - else - outb(*(src++), eth_asic_base + ASIC_PIO); - } - -#ifdef INCLUDE_3C503 - outb(t503_output, eth_asic_base + _3COM_CR); -#else -#ifdef COMPEX_RL2000_FIX - for (x = 0; - x < COMPEX_RL2000_TRIES && - (inb(eth_nic_base + D8390_P0_ISR) & D8390_ISR_RDC) - != D8390_ISR_RDC; - ++x); - if (x >= COMPEX_RL2000_TRIES) - printf("Warning: Compex RL2000 aborted wait!\n"); -#endif /* COMPEX_RL2000_FIX */ -#ifndef INCLUDE_WD - while((inb(eth_nic_base + D8390_P0_ISR) & D8390_ISR_RDC) - != D8390_ISR_RDC); -#endif -#endif -} -#else -/************************************************************************** -ETH_PIO_READ - Dummy routine when NE2000 not compiled in -**************************************************************************/ -static void eth_pio_read(unsigned int src __unused, unsigned char *dst __unused, unsigned int cnt __unused) {} -#endif - - -/************************************************************************** -enable_multycast - Enable Multicast -**************************************************************************/ -static void enable_multicast(unsigned short eth_nic_base) -{ - unsigned char mcfilter[8]; - int i; - memset(mcfilter, 0xFF, 8); - outb(4, eth_nic_base+D8390_P0_RCR); - outb(D8390_COMMAND_RD2 + D8390_COMMAND_PS1, eth_nic_base + D8390_P0_COMMAND); - for(i=0;i<8;i++) - { - outb(mcfilter[i], eth_nic_base + 8 + i); - if(inb(eth_nic_base + 8 + i)!=mcfilter[i]) - printf("Error SMC 83C690 Multicast filter read/write mishap %d\n",i); - } - outb(D8390_COMMAND_RD2 + D8390_COMMAND_PS0, eth_nic_base + D8390_P0_COMMAND); - outb(4 | 0x08, eth_nic_base+D8390_P0_RCR); -} - -/************************************************************************** -NS8390_RESET - Reset adapter -**************************************************************************/ -static void ns8390_reset(struct nic *nic) -{ - int i; - - eth_drain_receiver = 0; -#ifdef INCLUDE_WD - if (eth_flags & FLAG_790) - outb(D8390_COMMAND_PS0 | D8390_COMMAND_STP, eth_nic_base+D8390_P0_COMMAND); - else -#endif - outb(D8390_COMMAND_PS0 | D8390_COMMAND_RD2 | - D8390_COMMAND_STP, eth_nic_base+D8390_P0_COMMAND); - if (eth_flags & FLAG_16BIT) - outb(0x49, eth_nic_base+D8390_P0_DCR); - else - outb(0x48, eth_nic_base+D8390_P0_DCR); - outb(0, eth_nic_base+D8390_P0_RBCR0); - outb(0, eth_nic_base+D8390_P0_RBCR1); - outb(0x20, eth_nic_base+D8390_P0_RCR); /* monitor mode */ - outb(2, eth_nic_base+D8390_P0_TCR); - outb(eth_tx_start, eth_nic_base+D8390_P0_TPSR); - outb(eth_rx_start, eth_nic_base+D8390_P0_PSTART); -#ifdef INCLUDE_WD - if (eth_flags & FLAG_790) { -#ifdef WD_790_PIO - outb(0x10, eth_asic_base + 0x06); /* disable interrupts, enable PIO */ - outb(0x01, eth_nic_base + 0x09); /* enable ring read auto-wrap */ -#else - outb(0, eth_nic_base + 0x09); -#endif - } -#endif - outb(eth_memsize, eth_nic_base+D8390_P0_PSTOP); - outb(eth_memsize - 1, eth_nic_base+D8390_P0_BOUND); - outb(0xFF, eth_nic_base+D8390_P0_ISR); - outb(0, eth_nic_base+D8390_P0_IMR); -#ifdef INCLUDE_WD - if (eth_flags & FLAG_790) - outb(D8390_COMMAND_PS1 | - D8390_COMMAND_STP, eth_nic_base+D8390_P0_COMMAND); - else -#endif - outb(D8390_COMMAND_PS1 | - D8390_COMMAND_RD2 | D8390_COMMAND_STP, eth_nic_base+D8390_P0_COMMAND); - for (i=0; inode_addr[i], eth_nic_base+D8390_P1_PAR0+i); - for (i=0; iflags) ? 0 : _3COM_CR_XSEL; - outb(t503_output, eth_asic_base + _3COM_CR); -#endif -} - -static int ns8390_poll(struct nic *nic, int retrieve); - -#ifndef INCLUDE_3C503 -/************************************************************************** -ETH_RX_OVERRUN - Bring adapter back to work after an RX overrun -**************************************************************************/ -static void eth_rx_overrun(struct nic *nic) -{ - int start_time; - -#ifdef INCLUDE_WD - if (eth_flags & FLAG_790) - outb(D8390_COMMAND_PS0 | D8390_COMMAND_STP, eth_nic_base+D8390_P0_COMMAND); - else -#endif - outb(D8390_COMMAND_PS0 | D8390_COMMAND_RD2 | - D8390_COMMAND_STP, eth_nic_base+D8390_P0_COMMAND); - - /* wait for at least 1.6ms - we wait one timer tick */ - start_time = currticks(); - while (currticks() - start_time <= 1) - /* Nothing */; - - outb(0, eth_nic_base+D8390_P0_RBCR0); /* reset byte counter */ - outb(0, eth_nic_base+D8390_P0_RBCR1); - - /* - * Linux driver checks for interrupted TX here. This is not necessary, - * because the transmit routine waits until the frame is sent. - */ - - /* enter loopback mode and restart NIC */ - outb(2, eth_nic_base+D8390_P0_TCR); -#ifdef INCLUDE_WD - if (eth_flags & FLAG_790) - outb(D8390_COMMAND_PS0 | D8390_COMMAND_STA, eth_nic_base+D8390_P0_COMMAND); - else -#endif - outb(D8390_COMMAND_PS0 | D8390_COMMAND_RD2 | - D8390_COMMAND_STA, eth_nic_base+D8390_P0_COMMAND); - - /* clear the RX ring, acknowledge overrun interrupt */ - eth_drain_receiver = 1; - while (ns8390_poll(nic, 1)) - /* Nothing */; - eth_drain_receiver = 0; - outb(D8390_ISR_OVW, eth_nic_base+D8390_P0_ISR); - - /* leave loopback mode - no packets to be resent (see Linux driver) */ - outb(0, eth_nic_base+D8390_P0_TCR); -} -#endif /* INCLUDE_3C503 */ - -/************************************************************************** -NS8390_TRANSMIT - Transmit a frame -**************************************************************************/ -static void ns8390_transmit( - struct nic *nic, - const char *d, /* Destination */ - unsigned int t, /* Type */ - unsigned int s, /* size */ - const char *p) /* Packet */ -{ -#if defined(INCLUDE_3C503) || (defined(INCLUDE_WD) && ! defined(WD_790_PIO)) - Address eth_vmem = bus_to_virt(eth_bmem); -#endif -#ifdef INCLUDE_3C503 - if (!(eth_flags & FLAG_PIO)) { - memcpy((char *)eth_vmem, d, ETH_ALEN); /* dst */ - memcpy((char *)eth_vmem+ETH_ALEN, nic->node_addr, ETH_ALEN); /* src */ - *((char *)eth_vmem+12) = t>>8; /* type */ - *((char *)eth_vmem+13) = t; - memcpy((char *)eth_vmem+ETH_HLEN, p, s); - s += ETH_HLEN; - while (s < ETH_ZLEN) *((char *)eth_vmem+(s++)) = 0; - } -#endif - -#ifdef INCLUDE_WD - if (eth_flags & FLAG_16BIT) { - outb(eth_laar | WD_LAAR_M16EN, eth_asic_base + WD_LAAR); - inb(0x84); - } -#ifndef WD_790_PIO - /* Memory interface */ - if (eth_flags & FLAG_790) { - outb(WD_MSR_MENB, eth_asic_base + WD_MSR); - inb(0x84); - } - inb(0x84); - memcpy((char *)eth_vmem, d, ETH_ALEN); /* dst */ - memcpy((char *)eth_vmem+ETH_ALEN, nic->node_addr, ETH_ALEN); /* src */ - *((char *)eth_vmem+12) = t>>8; /* type */ - *((char *)eth_vmem+13) = t; - memcpy((char *)eth_vmem+ETH_HLEN, p, s); - s += ETH_HLEN; - while (s < ETH_ZLEN) *((char *)eth_vmem+(s++)) = 0; - if (eth_flags & FLAG_790) { - outb(0, eth_asic_base + WD_MSR); - inb(0x84); - } -#else - inb(0x84); -#endif -#endif - -#if defined(INCLUDE_3C503) - if (eth_flags & FLAG_PIO) -#endif -#if defined(INCLUDE_NE) || defined(INCLUDE_NS8390) || (defined(INCLUDE_3C503) && !defined(T503_SHMEM)) || (defined(INCLUDE_WD) && defined(WD_790_PIO)) - { - /* Programmed I/O */ - unsigned short type; - type = (t >> 8) | (t << 8); - eth_pio_write(d, eth_tx_start<<8, ETH_ALEN); - eth_pio_write(nic->node_addr, (eth_tx_start<<8)+ETH_ALEN, ETH_ALEN); - /* bcc generates worse code without (const+const) below */ - eth_pio_write((unsigned char *)&type, (eth_tx_start<<8)+(ETH_ALEN+ETH_ALEN), 2); - eth_pio_write(p, (eth_tx_start<<8)+ETH_HLEN, s); - s += ETH_HLEN; - if (s < ETH_ZLEN) s = ETH_ZLEN; - } -#endif -#if defined(INCLUDE_3C503) -#endif - -#ifdef INCLUDE_WD - if (eth_flags & FLAG_16BIT) { - outb(eth_laar & ~WD_LAAR_M16EN, eth_asic_base + WD_LAAR); - inb(0x84); - } - if (eth_flags & FLAG_790) - outb(D8390_COMMAND_PS0 | - D8390_COMMAND_STA, eth_nic_base+D8390_P0_COMMAND); - else -#endif - outb(D8390_COMMAND_PS0 | - D8390_COMMAND_RD2 | D8390_COMMAND_STA, eth_nic_base+D8390_P0_COMMAND); - outb(eth_tx_start, eth_nic_base+D8390_P0_TPSR); - outb(s, eth_nic_base+D8390_P0_TBCR0); - outb(s>>8, eth_nic_base+D8390_P0_TBCR1); -#ifdef INCLUDE_WD - if (eth_flags & FLAG_790) - outb(D8390_COMMAND_PS0 | - D8390_COMMAND_TXP | D8390_COMMAND_STA, eth_nic_base+D8390_P0_COMMAND); - else -#endif - outb(D8390_COMMAND_PS0 | - D8390_COMMAND_TXP | D8390_COMMAND_RD2 | - D8390_COMMAND_STA, eth_nic_base+D8390_P0_COMMAND); -} - -/************************************************************************** -NS8390_POLL - Wait for a frame -**************************************************************************/ -static int ns8390_poll(struct nic *nic, int retrieve) -{ - int ret = 0; - unsigned char rstat, curr, next; - unsigned short len, frag; - unsigned short pktoff; - unsigned char *p; - struct ringbuffer pkthdr; - -#ifndef INCLUDE_3C503 - /* avoid infinite recursion: see eth_rx_overrun() */ - if (!eth_drain_receiver && (inb(eth_nic_base+D8390_P0_ISR) & D8390_ISR_OVW)) { - eth_rx_overrun(nic); - return(0); - } -#endif /* INCLUDE_3C503 */ - rstat = inb(eth_nic_base+D8390_P0_RSR); - if (!(rstat & D8390_RSTAT_PRX)) return(0); - next = inb(eth_nic_base+D8390_P0_BOUND)+1; - if (next >= eth_memsize) next = eth_rx_start; - outb(D8390_COMMAND_PS1, eth_nic_base+D8390_P0_COMMAND); - curr = inb(eth_nic_base+D8390_P1_CURR); - outb(D8390_COMMAND_PS0, eth_nic_base+D8390_P0_COMMAND); - if (curr >= eth_memsize) curr=eth_rx_start; - if (curr == next) return(0); - - if ( ! retrieve ) return 1; - -#ifdef INCLUDE_WD - if (eth_flags & FLAG_16BIT) { - outb(eth_laar | WD_LAAR_M16EN, eth_asic_base + WD_LAAR); - inb(0x84); - } -#ifndef WD_790_PIO - if (eth_flags & FLAG_790) { - outb(WD_MSR_MENB, eth_asic_base + WD_MSR); - inb(0x84); - } -#endif - inb(0x84); -#endif - pktoff = next << 8; - if (eth_flags & FLAG_PIO) - eth_pio_read(pktoff, (char *)&pkthdr, 4); - else - memcpy(&pkthdr, bus_to_virt(eth_rmem + pktoff), 4); - pktoff += sizeof(pkthdr); - /* incoming length includes FCS so must sub 4 */ - len = pkthdr.len - 4; - if ((pkthdr.status & D8390_RSTAT_PRX) == 0 || len < ETH_ZLEN - || len > ETH_FRAME_LEN) { - printf("Bogus packet, ignoring\n"); - return (0); - } - else { - p = nic->packet; - nic->packetlen = len; /* available to caller */ - frag = (eth_memsize << 8) - pktoff; - if (len > frag) { /* We have a wrap-around */ - /* read first part */ - if (eth_flags & FLAG_PIO) - eth_pio_read(pktoff, p, frag); - else - memcpy(p, bus_to_virt(eth_rmem + pktoff), frag); - pktoff = eth_rx_start << 8; - p += frag; - len -= frag; - } - /* read second part */ - if (eth_flags & FLAG_PIO) - eth_pio_read(pktoff, p, len); - else - memcpy(p, bus_to_virt(eth_rmem + pktoff), len); - ret = 1; - } -#ifdef INCLUDE_WD -#ifndef WD_790_PIO - if (eth_flags & FLAG_790) { - outb(0, eth_asic_base + WD_MSR); - inb(0x84); - } -#endif - if (eth_flags & FLAG_16BIT) { - outb(eth_laar & ~WD_LAAR_M16EN, eth_asic_base + WD_LAAR); - inb(0x84); - } - inb(0x84); -#endif - next = pkthdr.next; /* frame number of next packet */ - if (next == eth_rx_start) - next = eth_memsize; - outb(next-1, eth_nic_base+D8390_P0_BOUND); - return(ret); -} - -/************************************************************************** -NS8390_DISABLE - Turn off adapter -**************************************************************************/ -static void ns8390_disable(struct dev *dev) -{ - struct nic *nic = (struct nic *)dev; - /* reset and disable merge */ - ns8390_reset(nic); -} - -/************************************************************************** -NS8390_IRQ - Enable, Disable, or Force interrupts -**************************************************************************/ -static void ns8390_irq(struct nic *nic __unused, irq_action_t action __unused) -{ - switch ( action ) { - case DISABLE : - break; - case ENABLE : - break; - case FORCE : - break; - } -} - -/************************************************************************** -ETH_PROBE - Look for an adapter -**************************************************************************/ -#ifdef INCLUDE_NS8390 -static int eth_probe (struct dev *dev, struct pci_device *pci) -#else -static int eth_probe (struct dev *dev, unsigned short *probe_addrs __unused) -#endif -{ - struct nic *nic = (struct nic *)dev; - int i; -#ifdef INCLUDE_NS8390 - unsigned short pci_probe_addrs[] = { pci->ioaddr, 0 }; - unsigned short *probe_addrs = pci_probe_addrs; -#endif - eth_vendor = VENDOR_NONE; - eth_drain_receiver = 0; - - nic->irqno = 0; - -#ifdef INCLUDE_WD -{ - /****************************************************************** - Search for WD/SMC cards - ******************************************************************/ - struct wd_board *brd; - unsigned short chksum; - unsigned char c; - for (eth_asic_base = WD_LOW_BASE; eth_asic_base <= WD_HIGH_BASE; - eth_asic_base += 0x20) { - chksum = 0; - for (i=8; i<16; i++) - chksum += inb(eth_asic_base+i); - /* Extra checks to avoid soundcard */ - if ((chksum & 0xFF) == 0xFF && - inb(eth_asic_base+8) != 0xFF && - inb(eth_asic_base+9) != 0xFF) - break; - } - if (eth_asic_base > WD_HIGH_BASE) - return (0); - /* We've found a board */ - eth_vendor = VENDOR_WD; - eth_nic_base = eth_asic_base + WD_NIC_ADDR; - - nic->ioaddr = eth_nic_base; - - c = inb(eth_asic_base+WD_BID); /* Get board id */ - for (brd = wd_boards; brd->name; brd++) - if (brd->id == c) break; - if (!brd->name) { - printf("Unknown WD/SMC NIC type %hhX\n", c); - return (0); /* Unknown type */ - } - eth_flags = brd->flags; - eth_memsize = brd->memsize; - eth_tx_start = 0; - eth_rx_start = D8390_TXBUF_SIZE; - if ((c == TYPE_WD8013EP) && - (inb(eth_asic_base + WD_ICR) & WD_ICR_16BIT)) { - eth_flags = FLAG_16BIT; - eth_memsize = MEM_16384; - } - if ((c & WD_SOFTCONFIG) && (!(eth_flags & FLAG_790))) { - eth_bmem = (0x80000 | - ((inb(eth_asic_base + WD_MSR) & 0x3F) << 13)); - } else - eth_bmem = WD_DEFAULT_MEM; - if (brd->id == TYPE_SMC8216T || brd->id == TYPE_SMC8216C) { - /* from Linux driver, 8416BT detects as 8216 sometimes */ - unsigned int addr = inb(eth_asic_base + 0xb); - if (((addr >> 4) & 3) == 0) { - brd += 2; - eth_memsize = brd->memsize; - } - } - outb(0x80, eth_asic_base + WD_MSR); /* Reset */ - for (i=0; inode_addr[i] = inb(i+eth_asic_base+WD_LAR); - } - printf("\n%s base %#hx", brd->name, eth_asic_base); - if (eth_flags & FLAG_790) { -#ifdef WD_790_PIO - printf(", PIO mode, addr %!\n", nic->node_addr); - eth_bmem = 0; - eth_flags |= FLAG_PIO; /* force PIO mode */ - outb(0, eth_asic_base+WD_MSR); -#else - printf(", memory %#x, addr %!\n", eth_bmem, nic->node_addr); - outb(WD_MSR_MENB, eth_asic_base+WD_MSR); - outb((inb(eth_asic_base+0x04) | - 0x80), eth_asic_base+0x04); - outb(((unsigned)(eth_bmem >> 13) & 0x0F) | - ((unsigned)(eth_bmem >> 11) & 0x40) | - (inb(eth_asic_base+0x0B) & 0xB0), eth_asic_base+0x0B); - outb((inb(eth_asic_base+0x04) & - ~0x80), eth_asic_base+0x04); -#endif - } else { - printf(", memory %#x, addr %!\n", eth_bmem, nic->node_addr); - outb(((unsigned)(eth_bmem >> 13) & 0x3F) | 0x40, eth_asic_base+WD_MSR); - } - if (eth_flags & FLAG_16BIT) { - if (eth_flags & FLAG_790) { - eth_laar = inb(eth_asic_base + WD_LAAR); - outb(WD_LAAR_M16EN, eth_asic_base + WD_LAAR); - } else { - outb((eth_laar = - WD_LAAR_L16EN | 1), eth_asic_base + WD_LAAR); -/* - The previous line used to be - WD_LAAR_M16EN | WD_LAAR_L16EN | 1)); - jluke@deakin.edu.au reported that removing WD_LAAR_M16EN made - it work for WD8013s. This seems to work for my 8013 boards. I - don't know what is really happening. I wish I had data sheets - or more time to decode the Linux driver. - Ken -*/ - } - inb(0x84); - } -} -#endif -#ifdef INCLUDE_3C503 -#ifdef T503_AUI - nic->flags = 1; /* aui */ -#else - nic->flags = 0; /* no aui */ -#endif - /****************************************************************** - Search for 3Com 3c503 if no WD/SMC cards - ******************************************************************/ - if (eth_vendor == VENDOR_NONE) { - int idx; - int iobase_reg, membase_reg; - static unsigned short base[] = { - 0x300, 0x310, 0x330, 0x350, - 0x250, 0x280, 0x2A0, 0x2E0, 0 }; - - /* Loop through possible addresses checking each one */ - - for (idx = 0; (eth_nic_base = base[idx]) != 0; ++idx) { - - eth_asic_base = eth_nic_base + _3COM_ASIC_OFFSET; -/* - * Note that we use the same settings for both 8 and 16 bit cards: - * both have an 8K bank of memory at page 1 while only the 16 bit - * cards have a bank at page 0. - */ - eth_memsize = MEM_16384; - eth_tx_start = 32; - eth_rx_start = 32 + D8390_TXBUF_SIZE; - - /* Check our base address. iobase and membase should */ - /* both have a maximum of 1 bit set or be 0. */ - - iobase_reg = inb(eth_asic_base + _3COM_BCFR); - membase_reg = inb(eth_asic_base + _3COM_PCFR); - - if ((iobase_reg & (iobase_reg - 1)) || - (membase_reg & (membase_reg - 1))) - continue; /* nope */ - - /* Now get the shared memory address */ - - eth_flags = 0; - - switch (membase_reg) { - case _3COM_PCFR_DC000: - eth_bmem = 0xdc000; - break; - case _3COM_PCFR_D8000: - eth_bmem = 0xd8000; - break; - case _3COM_PCFR_CC000: - eth_bmem = 0xcc000; - break; - case _3COM_PCFR_C8000: - eth_bmem = 0xc8000; - break; - case _3COM_PCFR_PIO: - eth_flags |= FLAG_PIO; - eth_bmem = 0; - break; - default: - continue; /* nope */ - } - break; - } - - if (base[idx] == 0) /* not found */ - return (0); -#ifndef T503_SHMEM - eth_flags |= FLAG_PIO; /* force PIO mode */ - eth_bmem = 0; -#endif - eth_vendor = VENDOR_3COM; - - - /* Need this to make ns8390_poll() happy. */ - - eth_rmem = eth_bmem - 0x2000; - - /* Reset NIC and ASIC */ - - outb(_3COM_CR_RST | _3COM_CR_XSEL, eth_asic_base + _3COM_CR ); - outb(_3COM_CR_XSEL, eth_asic_base + _3COM_CR ); - - /* Get our ethernet address */ - - outb(_3COM_CR_EALO | _3COM_CR_XSEL, eth_asic_base + _3COM_CR); - nic->ioaddr = eth_nic_base; - printf("\n3Com 3c503 base %#hx, ", eth_nic_base); - if (eth_flags & FLAG_PIO) - printf("PIO mode"); - else - printf("memory %#x", eth_bmem); - for (i=0; inode_addr[i] = inb(eth_nic_base+i); - } - printf(", %s, addr %!\n", nic->flags ? "AUI" : "internal xcvr", - nic->node_addr); - outb(_3COM_CR_XSEL, eth_asic_base + _3COM_CR); - /* - * Initialize GA configuration register. Set bank and enable shared - * mem. We always use bank 1. Disable interrupts. - */ - outb(_3COM_GACFR_RSEL | - _3COM_GACFR_MBS0 | _3COM_GACFR_TCM | _3COM_GACFR_NIM, eth_asic_base + _3COM_GACFR); - - outb(0xff, eth_asic_base + _3COM_VPTR2); - outb(0xff, eth_asic_base + _3COM_VPTR1); - outb(0x00, eth_asic_base + _3COM_VPTR0); - /* - * Clear memory and verify that it worked (we use only 8K) - */ - - if (!(eth_flags & FLAG_PIO)) { - memset(bus_to_virt(eth_bmem), 0, 0x2000); - for(i = 0; i < 0x2000; ++i) - if (*((char *)(bus_to_virt(eth_bmem+i)))) { - printf ("Failed to clear 3c503 shared mem.\n"); - return (0); - } - } - /* - * Initialize GA page/start/stop registers. - */ - outb(eth_tx_start, eth_asic_base + _3COM_PSTR); - outb(eth_memsize, eth_asic_base + _3COM_PSPR); - } -#endif -#if defined(INCLUDE_NE) || defined(INCLUDE_NS8390) -{ - /****************************************************************** - Search for NE1000/2000 if no WD/SMC or 3com cards - ******************************************************************/ - unsigned char c; - if (eth_vendor == VENDOR_NONE) { - char romdata[16], testbuf[32]; - int idx; - static char test[] = "NE*000 memory"; - static unsigned short base[] = { -#ifdef NE_SCAN - NE_SCAN, -#endif - 0 }; - /* if no addresses supplied, fall back on defaults */ - if (probe_addrs == 0 || probe_addrs[0] == 0) - probe_addrs = base; - eth_bmem = 0; /* No shared memory */ - for (idx = 0; (eth_nic_base = probe_addrs[idx]) != 0; ++idx) { - eth_flags = FLAG_PIO; - eth_asic_base = eth_nic_base + NE_ASIC_OFFSET; - eth_memsize = MEM_16384; - eth_tx_start = 32; - eth_rx_start = 32 + D8390_TXBUF_SIZE; - c = inb(eth_asic_base + NE_RESET); - outb(c, eth_asic_base + NE_RESET); - inb(0x84); - outb(D8390_COMMAND_STP | - D8390_COMMAND_RD2, eth_nic_base + D8390_P0_COMMAND); - outb(D8390_RCR_MON, eth_nic_base + D8390_P0_RCR); - outb(D8390_DCR_FT1 | D8390_DCR_LS, eth_nic_base + D8390_P0_DCR); - outb(MEM_8192, eth_nic_base + D8390_P0_PSTART); - outb(MEM_16384, eth_nic_base + D8390_P0_PSTOP); -#ifdef NS8390_FORCE_16BIT - eth_flags |= FLAG_16BIT; /* force 16-bit mode */ -#endif - - eth_pio_write(test, 8192, sizeof(test)); - eth_pio_read(8192, testbuf, sizeof(test)); - if (!memcmp(test, testbuf, sizeof(test))) - break; - eth_flags |= FLAG_16BIT; - eth_memsize = MEM_32768; - eth_tx_start = 64; - eth_rx_start = 64 + D8390_TXBUF_SIZE; - outb(D8390_DCR_WTS | - D8390_DCR_FT1 | D8390_DCR_LS, eth_nic_base + D8390_P0_DCR); - outb(MEM_16384, eth_nic_base + D8390_P0_PSTART); - outb(MEM_32768, eth_nic_base + D8390_P0_PSTOP); - eth_pio_write(test, 16384, sizeof(test)); - eth_pio_read(16384, testbuf, sizeof(test)); - if (!memcmp(testbuf, test, sizeof(test))) - break; - } - if (eth_nic_base == 0) - return (0); - if (eth_nic_base > ISA_MAX_ADDR) /* PCI probably */ - eth_flags |= FLAG_16BIT; - eth_vendor = VENDOR_NOVELL; - eth_pio_read(0, romdata, sizeof(romdata)); - for (i=0; inode_addr[i] = romdata[i + ((eth_flags & FLAG_16BIT) ? i : 0)]; - } - nic->ioaddr = eth_nic_base; - printf("\nNE%c000 base %#hx, addr %!\n", - (eth_flags & FLAG_16BIT) ? '2' : '1', eth_nic_base, - nic->node_addr); - } -} -#endif - if (eth_vendor == VENDOR_NONE) - return(0); - if (eth_vendor != VENDOR_3COM) - eth_rmem = eth_bmem; - ns8390_reset(nic); - - dev->disable = ns8390_disable; - nic->poll = ns8390_poll; - nic->transmit = ns8390_transmit; - nic->irq = ns8390_irq; - - /* Based on PnP ISA map */ -#ifdef INCLUDE_WD - dev->devid.vendor_id = htons(GENERIC_ISAPNP_VENDOR); - dev->devid.device_id = htons(0x812a); -#endif -#ifdef INCLUDE_3C503 - dev->devid.vendor_id = htons(GENERIC_ISAPNP_VENDOR); - dev->devid.device_id = htons(0x80f3); -#endif -#ifdef INCLUDE_NE - dev->devid.vendor_id = htons(GENERIC_ISAPNP_VENDOR); - dev->devid.device_id = htons(0x80d6); -#endif - return 1; -} - -#ifdef INCLUDE_WD -static struct isa_driver wd_driver __isa_driver = { - .type = NIC_DRIVER, - .name = "WD", - .probe = wd_probe, - .ioaddrs = 0, -}; -#endif - -#ifdef INCLUDE_3C503 -static struct isa_driver t503_driver __isa_driver = { - .type = NIC_DRIVER, - .name = "3C503", - .probe = t503_probe, - .ioaddrs = 0, -}; -#endif - -#ifdef INCLUDE_NE -static struct isa_driver ne_driver __isa_driver = { - .type = NIC_DRIVER, - .name = "NE*000", - .probe = ne_probe, - .ioaddrs = 0, -}; -#endif - -#ifdef INCLUDE_NS8390 -static struct pci_id nepci_nics[] = { -/* A few NE2000 PCI clones, list not exhaustive */ -PCI_ROM(0x10ec, 0x8029, "rtl8029", "Realtek 8029"), -PCI_ROM(0x1186, 0x0300, "dlink-528", "D-Link DE-528"), -PCI_ROM(0x1050, 0x0940, "winbond940", "Winbond NE2000-PCI"), /* Winbond 86C940 / 89C940 */ -PCI_ROM(0x1050, 0x5a5a, "winbond940f", "Winbond W89c940F"), /* Winbond 89C940F */ -PCI_ROM(0x11f6, 0x1401, "compexrl2000", "Compex ReadyLink 2000"), -PCI_ROM(0x8e2e, 0x3000, "ktiet32p2", "KTI ET32P2"), -PCI_ROM(0x4a14, 0x5000, "nv5000sc", "NetVin NV5000SC"), -PCI_ROM(0x12c3, 0x0058, "holtek80232", "Holtek HT80232"), -PCI_ROM(0x12c3, 0x5598, "holtek80229", "Holtek HT80229"), -PCI_ROM(0x10bd, 0x0e34, "surecom-ne34", "Surecom NE34"), -PCI_ROM(0x1106, 0x0926, "via86c926", "Via 86c926"), -}; - -struct pci_driver nepci_driver = { - .type = NIC_DRIVER, - .name = "NE2000/PCI", - .probe = nepci_probe, - .ids = nepci_nics, - .id_count = sizeof(nepci_nics)/sizeof(nepci_nics[0]), - .class = 0, -}; - -#endif /* INCLUDE_NS8390 */ - -/* - * Local variables: - * c-basic-offset: 8 - * End: - */ - diff --git a/usr/src/grub/grub-0.95/netboot/ns8390.h b/usr/src/grub/grub-0.95/netboot/ns8390.h deleted file mode 100644 index 2c4e972d52..0000000000 --- a/usr/src/grub/grub-0.95/netboot/ns8390.h +++ /dev/null @@ -1,238 +0,0 @@ -/************************************************************************** -ETHERBOOT - BOOTP/TFTP Bootstrap Program - -Author: Martin Renters - Date: Jun/94 - -**************************************************************************/ - -#define VENDOR_NONE 0 -#define VENDOR_WD 1 -#define VENDOR_NOVELL 2 -#define VENDOR_3COM 3 - -#define FLAG_PIO 0x01 -#define FLAG_16BIT 0x02 -#define FLAG_790 0x04 - -#define MEM_8192 32 -#define MEM_16384 64 -#define MEM_32768 128 - -#define ISA_MAX_ADDR 0x400 - -/************************************************************************** -Western Digital/SMC Board Definitions -**************************************************************************/ -#define WD_LOW_BASE 0x200 -#define WD_HIGH_BASE 0x3e0 -#ifndef WD_DEFAULT_MEM -#define WD_DEFAULT_MEM 0xD0000 -#endif -#define WD_NIC_ADDR 0x10 - -/************************************************************************** -Western Digital/SMC ASIC Addresses -**************************************************************************/ -#define WD_MSR 0x00 -#define WD_ICR 0x01 -#define WD_IAR 0x02 -#define WD_BIO 0x03 -#define WD_IRR 0x04 -#define WD_LAAR 0x05 -#define WD_IJR 0x06 -#define WD_GP2 0x07 -#define WD_LAR 0x08 -#define WD_BID 0x0E - -#define WD_ICR_16BIT 0x01 - -#define WD_MSR_MENB 0x40 - -#define WD_LAAR_L16EN 0x40 -#define WD_LAAR_M16EN 0x80 - -#define WD_SOFTCONFIG 0x20 - -/************************************************************************** -Western Digital/SMC Board Types -**************************************************************************/ -#define TYPE_WD8003S 0x02 -#define TYPE_WD8003E 0x03 -#define TYPE_WD8013EBT 0x05 -#define TYPE_WD8003W 0x24 -#define TYPE_WD8003EB 0x25 -#define TYPE_WD8013W 0x26 -#define TYPE_WD8013EP 0x27 -#define TYPE_WD8013WC 0x28 -#define TYPE_WD8013EPC 0x29 -#define TYPE_SMC8216T 0x2a -#define TYPE_SMC8216C 0x2b -#define TYPE_SMC8416T 0x00 /* Bogus entries: the 8416 generates the */ -#define TYPE_SMC8416C 0x00 /* the same codes as the 8216. */ -#define TYPE_SMC8013EBP 0x2c - -/************************************************************************** -3com 3c503 definitions -**************************************************************************/ - -#ifndef _3COM_BASE -#define _3COM_BASE 0x300 -#endif - -#define _3COM_TX_PAGE_OFFSET_8BIT 0x20 -#define _3COM_TX_PAGE_OFFSET_16BIT 0x0 -#define _3COM_RX_PAGE_OFFSET_16BIT 0x20 - -#define _3COM_ASIC_OFFSET 0x400 -#define _3COM_NIC_OFFSET 0x0 - -#define _3COM_PSTR 0 -#define _3COM_PSPR 1 - -#define _3COM_BCFR 3 -#define _3COM_BCFR_2E0 0x01 -#define _3COM_BCFR_2A0 0x02 -#define _3COM_BCFR_280 0x04 -#define _3COM_BCFR_250 0x08 -#define _3COM_BCFR_350 0x10 -#define _3COM_BCFR_330 0x20 -#define _3COM_BCFR_310 0x40 -#define _3COM_BCFR_300 0x80 -#define _3COM_PCFR 4 -#define _3COM_PCFR_PIO 0 -#define _3COM_PCFR_C8000 0x10 -#define _3COM_PCFR_CC000 0x20 -#define _3COM_PCFR_D8000 0x40 -#define _3COM_PCFR_DC000 0x80 -#define _3COM_CR 6 -#define _3COM_CR_RST 0x01 /* Reset GA and NIC */ -#define _3COM_CR_XSEL 0x02 /* Transceiver select. BNC=1(def) AUI=0 */ -#define _3COM_CR_EALO 0x04 /* window EA PROM 0-15 to I/O base */ -#define _3COM_CR_EAHI 0x08 /* window EA PROM 16-31 to I/O base */ -#define _3COM_CR_SHARE 0x10 /* select interrupt sharing option */ -#define _3COM_CR_DBSEL 0x20 /* Double buffer select */ -#define _3COM_CR_DDIR 0x40 /* DMA direction select */ -#define _3COM_CR_START 0x80 /* Start DMA controller */ -#define _3COM_GACFR 5 -#define _3COM_GACFR_MBS0 0x01 -#define _3COM_GACFR_MBS1 0x02 -#define _3COM_GACFR_MBS2 0x04 -#define _3COM_GACFR_RSEL 0x08 /* enable shared memory */ -#define _3COM_GACFR_TEST 0x10 /* for GA testing */ -#define _3COM_GACFR_OWS 0x20 /* select 0WS access to GA */ -#define _3COM_GACFR_TCM 0x40 /* Mask DMA interrupts */ -#define _3COM_GACFR_NIM 0x80 /* Mask NIC interrupts */ -#define _3COM_STREG 7 -#define _3COM_STREG_REV 0x07 /* GA revision */ -#define _3COM_STREG_DIP 0x08 /* DMA in progress */ -#define _3COM_STREG_DTC 0x10 /* DMA terminal count */ -#define _3COM_STREG_OFLW 0x20 /* Overflow */ -#define _3COM_STREG_UFLW 0x40 /* Underflow */ -#define _3COM_STREG_DPRDY 0x80 /* Data port ready */ -#define _3COM_IDCFR 8 -#define _3COM_IDCFR_DRQ0 0x01 /* DMA request 1 select */ -#define _3COM_IDCFR_DRQ1 0x02 /* DMA request 2 select */ -#define _3COM_IDCFR_DRQ2 0x04 /* DMA request 3 select */ -#define _3COM_IDCFR_UNUSED 0x08 /* not used */ -#define _3COM_IDCFR_IRQ2 0x10 /* Interrupt request 2 select */ -#define _3COM_IDCFR_IRQ3 0x20 /* Interrupt request 3 select */ -#define _3COM_IDCFR_IRQ4 0x40 /* Interrupt request 4 select */ -#define _3COM_IDCFR_IRQ5 0x80 /* Interrupt request 5 select */ -#define _3COM_IRQ2 2 -#define _3COM_IRQ3 3 -#define _3COM_IRQ4 4 -#define _3COM_IRQ5 5 -#define _3COM_DAMSB 9 -#define _3COM_DALSB 0x0a -#define _3COM_VPTR2 0x0b -#define _3COM_VPTR1 0x0c -#define _3COM_VPTR0 0x0d -#define _3COM_RFMSB 0x0e -#define _3COM_RFLSB 0x0f - -/************************************************************************** -NE1000/2000 definitions -**************************************************************************/ -#define NE_ASIC_OFFSET 0x10 -#define NE_RESET 0x0F /* Used to reset card */ -#define NE_DATA 0x00 /* Used to read/write NIC mem */ - -#define COMPEX_RL2000_TRIES 200 - -/************************************************************************** -8390 Register Definitions -**************************************************************************/ -#define D8390_P0_COMMAND 0x00 -#define D8390_P0_PSTART 0x01 -#define D8390_P0_PSTOP 0x02 -#define D8390_P0_BOUND 0x03 -#define D8390_P0_TSR 0x04 -#define D8390_P0_TPSR 0x04 -#define D8390_P0_TBCR0 0x05 -#define D8390_P0_TBCR1 0x06 -#define D8390_P0_ISR 0x07 -#define D8390_P0_RSAR0 0x08 -#define D8390_P0_RSAR1 0x09 -#define D8390_P0_RBCR0 0x0A -#define D8390_P0_RBCR1 0x0B -#define D8390_P0_RSR 0x0C -#define D8390_P0_RCR 0x0C -#define D8390_P0_TCR 0x0D -#define D8390_P0_DCR 0x0E -#define D8390_P0_IMR 0x0F -#define D8390_P1_COMMAND 0x00 -#define D8390_P1_PAR0 0x01 -#define D8390_P1_PAR1 0x02 -#define D8390_P1_PAR2 0x03 -#define D8390_P1_PAR3 0x04 -#define D8390_P1_PAR4 0x05 -#define D8390_P1_PAR5 0x06 -#define D8390_P1_CURR 0x07 -#define D8390_P1_MAR0 0x08 - -#define D8390_COMMAND_PS0 0x0 /* Page 0 select */ -#define D8390_COMMAND_PS1 0x40 /* Page 1 select */ -#define D8390_COMMAND_PS2 0x80 /* Page 2 select */ -#define D8390_COMMAND_RD2 0x20 /* Remote DMA control */ -#define D8390_COMMAND_RD1 0x10 -#define D8390_COMMAND_RD0 0x08 -#define D8390_COMMAND_TXP 0x04 /* transmit packet */ -#define D8390_COMMAND_STA 0x02 /* start */ -#define D8390_COMMAND_STP 0x01 /* stop */ - -#define D8390_RCR_MON 0x20 /* monitor mode */ - -#define D8390_DCR_FT1 0x40 -#define D8390_DCR_LS 0x08 /* Loopback select */ -#define D8390_DCR_WTS 0x01 /* Word transfer select */ - -#define D8390_ISR_PRX 0x01 /* successful recv */ -#define D8390_ISR_PTX 0x02 /* successful xmit */ -#define D8390_ISR_RXE 0x04 /* receive error */ -#define D8390_ISR_TXE 0x08 /* transmit error */ -#define D8390_ISR_OVW 0x10 /* Overflow */ -#define D8390_ISR_CNT 0x20 /* Counter overflow */ -#define D8390_ISR_RDC 0x40 /* Remote DMA complete */ -#define D8390_ISR_RST 0x80 /* reset */ - -#define D8390_RSTAT_PRX 0x01 /* successful recv */ -#define D8390_RSTAT_CRC 0x02 /* CRC error */ -#define D8390_RSTAT_FAE 0x04 /* Frame alignment error */ -#define D8390_RSTAT_OVER 0x08 /* FIFO overrun */ - -#define D8390_TXBUF_SIZE 6 -#define D8390_RXBUF_END 32 -#define D8390_PAGE_SIZE 256 - -struct ringbuffer { - unsigned char status; - unsigned char next; - unsigned short len; -}; -/* - * Local variables: - * c-basic-offset: 8 - * End: - */ - diff --git a/usr/src/grub/grub-0.95/netboot/osdep.h b/usr/src/grub/grub-0.95/netboot/osdep.h deleted file mode 100644 index 03b8981d82..0000000000 --- a/usr/src/grub/grub-0.95/netboot/osdep.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef _OSDEP_H -#define _OSDEP_H - -#define __unused __attribute__((unused)) -#define __aligned __attribute__((aligned(16))) - -#include "io.h" -#include "byteswap.h" -#include "latch.h" - -#if defined(__sun) -typedef unsigned long Address; -#endif - -/* ANSI prototyping macro */ -#ifdef __STDC__ -# define P(x) x -#else -# define P(x) () -#endif - -#endif diff --git a/usr/src/grub/grub-0.95/netboot/pci.c b/usr/src/grub/grub-0.95/netboot/pci.c deleted file mode 100644 index 59daf02816..0000000000 --- a/usr/src/grub/grub-0.95/netboot/pci.c +++ /dev/null @@ -1,530 +0,0 @@ - -/* - * 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. - */ - -#include "grub.h" -#include "pci.h" - -unsigned long virt_offset = 0; -unsigned long virt_to_phys(volatile const void *virt_addr) -{ - return ((unsigned long)virt_addr) + virt_offset; -} - -void *phys_to_virt(unsigned long phys_addr) -{ - return (void *)(phys_addr - virt_offset); -} - -#ifdef INCLUDE_3C595 -extern struct pci_driver t595_driver; -#endif /* INCLUDE_3C595 */ - -#ifdef INCLUDE_3C90X -extern struct pci_driver a3c90x_driver; -#endif /* INCLUDE_3C90X */ - -#ifdef INCLUDE_DAVICOM -extern struct pci_driver davicom_driver; -#endif /* INCLUDE_DAVICOM */ - -#ifdef INCLUDE_E1000 -extern struct pci_driver e1000_driver; -#endif /* INCLUDE_E1000 */ - -#ifdef INCLUDE_EEPRO100 -extern struct pci_driver eepro100_driver; -#endif /* INCLUDE_EEPRO100 */ - -#ifdef INCLUDE_EPIC100 -extern struct pci_driver epic100_driver; -#endif /* INCLUDE_EPIC100 */ - -#ifdef INCLUDE_FORCEDETH -extern struct pci_driver forcedeth_driver; -#endif /* INCLUDE_FORCEDETH */ - -#ifdef INCLUDE_NATSEMI -extern struct pci_driver natsemi_driver; -#endif /* INCLUDE_NATSEMI */ - -#ifdef INCLUDE_NS83820 -extern struct pci_driver ns83820_driver; -#endif /* INCLUDE_NS83820 */ - -#ifdef INCLUDE_NS8390 -extern struct pci_driver nepci_driver; -#endif /* INCLUDE_NS8390 */ - -#ifdef INCLUDE_PCNET32 -extern struct pci_driver pcnet32_driver; -#endif /* INCLUDE_PCNET32 */ - -#ifdef INCLUDE_PNIC -extern struct pci_driver pnic_driver; -#endif /* INCLUDE_PNIC */ - -#ifdef INCLUDE_RTL8139 -extern struct pci_driver rtl8139_driver; -#endif /* INCLUDE_RTL8139 */ - -#ifdef INCLUDE_SIS900 -extern struct pci_driver sis900_driver; -extern struct pci_driver sis_bridge_driver; -#endif /* INCLUDE_SIS900 */ - -#ifdef INCLUDE_SUNDANCE -extern struct pci_driver sundance_driver; -#endif /* INCLUDE_SUNDANCE */ - -#ifdef INCLUDE_TG3 -extern struct pci_driver tg3_driver; -#endif /* INCLUDE_TG3 */ - -#ifdef INCLUDE_TLAN -extern struct pci_driver tlan_driver; -#endif /* INCLUDE_TLAN */ - -#ifdef INCLUDE_TULIP -extern struct pci_driver tulip_driver; -#endif /* INCLUDE_TULIP */ - -#ifdef INCLUDE_UNDI -extern struct pci_driver undi_driver; -#endif /* INCLUDE_UNDI */ - -#ifdef INCLUDE_VIA_RHINE -extern struct pci_driver rhine_driver; -#endif/* INCLUDE_VIA_RHINE */ - -#ifdef INCLUDE_W89C840 -extern struct pci_driver w89c840_driver; -#endif /* INCLUDE_W89C840 */ - -#ifdef INCLUDE_R8169 -extern struct pci_driver r8169_driver; -#endif /* INCLUDE_R8169 */ - -static const struct pci_driver *pci_drivers[] = { - -#ifdef INCLUDE_3C595 - &t595_driver, -#endif /* INCLUDE_3C595 */ - -#ifdef INCLUDE_3C90X - &a3c90x_driver, -#endif /* INCLUDE_3C90X */ - -#ifdef INCLUDE_DAVICOM - &davicom_driver, -#endif /* INCLUDE_DAVICOM */ - -#ifdef INCLUDE_E1000 - &e1000_driver, -#endif /* INCLUDE_E1000 */ - -#ifdef INCLUDE_EEPRO100 - &eepro100_driver, -#endif /* INCLUDE_EEPRO100 */ - -#ifdef INCLUDE_EPIC100 - &epic100_driver, -#endif /* INCLUDE_EPIC100 */ - -#ifdef INCLUDE_FORCEDETH - &forcedeth_driver, -#endif /* INCLUDE_FORCEDETH */ - -#ifdef INCLUDE_NATSEMI - &natsemi_driver, -#endif /* INCLUDE_NATSEMI */ - -#ifdef INCLUDE_NS83820 - &ns83820_driver, -#endif /* INCLUDE_NS83820 */ - -#ifdef INCLUDE_NS8390 - &nepci_driver, -#endif /* INCLUDE_NS8390 */ - -#ifdef INCLUDE_PCNET32 - &pcnet32_driver, -#endif /* INCLUDE_PCNET32 */ - -#ifdef INCLUDE_PNIC - &pnic_driver, -#endif /* INCLUDE_PNIC */ - -#ifdef INCLUDE_RTL8139 - &rtl8139_driver, -#endif /* INCLUDE_RTL8139 */ - -#ifdef INCLUDE_SIS900 - &sis900_driver, - &sis_bridge_driver, -#endif /* INCLUDE_SIS900 */ - -#ifdef INCLUDE_SUNDANCE - &sundance_driver, -#endif /* INCLUDE_SUNDANCE */ - -#ifdef INCLUDE_TG3 - & tg3_driver, -#endif /* INCLUDE_TG3 */ - -#ifdef INCLUDE_TLAN - &tlan_driver, -#endif /* INCLUDE_TLAN */ - -#ifdef INCLUDE_TULIP - & tulip_driver, -#endif /* INCLUDE_TULIP */ - -#ifdef INCLUDE_VIA_RHINE - &rhine_driver, -#endif/* INCLUDE_VIA_RHINE */ - -#ifdef INCLUDE_W89C840 - &w89c840_driver, -#endif /* INCLUDE_W89C840 */ - -#ifdef INCLUDE_R8169 - &r8169_driver, -#endif /* INCLUDE_R8169 */ - -/* We must be the last one */ -#ifdef INCLUDE_UNDI - &undi_driver, -#endif /* INCLUDE_UNDI */ - - 0 -}; - -static void scan_drivers( - int type, - uint32_t class, uint16_t vendor, uint16_t device, - const struct pci_driver *last_driver, struct pci_device *dev) -{ - const struct pci_driver *skip_driver = last_driver; - /* Assume there is only one match of the correct type */ - const struct pci_driver *driver; - int i, j; - - for(j = 0; pci_drivers[j] != 0; j++){ - driver = pci_drivers[j]; - if (driver->type != type) - continue; - if (skip_driver) { - if (skip_driver == driver) - skip_driver = 0; - continue; - } - for(i = 0; i < driver->id_count; i++) { - if ((vendor == driver->ids[i].vendor) && - (device == driver->ids[i].dev_id)) { - - dev->driver = driver; - dev->name = driver->ids[i].name; - - goto out; - } - } - } - if (!class) { - goto out; - } - for(j = 0; pci_drivers[j] != 0; j++){ - driver = pci_drivers[j]; - if (driver->type != type) - continue; - if (skip_driver) { - if (skip_driver == driver) - skip_driver = 0; - continue; - } - if (last_driver == driver) - continue; - if ((class >> 8) == driver->class) { - dev->driver = driver; - dev->name = driver->name; - goto out; - } - } - out: - return; -} - -void scan_pci_bus(int type, struct pci_device *dev) -{ - unsigned int first_bus, first_devfn; - const struct pci_driver *first_driver; - unsigned int devfn, bus, buses; - unsigned char hdr_type = 0; - uint32_t class; - uint16_t vendor, device; - uint32_t l, membase, ioaddr, romaddr; - int reg; - - EnterFunction("scan_pci_bus"); - first_bus = 0; - first_devfn = 0; - first_driver = 0; - if (dev->driver) { - first_driver = dev->driver; - first_bus = dev->bus; - first_devfn = dev->devfn; - /* Re read the header type on a restart */ - pcibios_read_config_byte(first_bus, first_devfn & ~0x7, - PCI_HEADER_TYPE, &hdr_type); - dev->driver = 0; - dev->bus = 0; - dev->devfn = 0; - } - - /* Scan all PCI buses, until we find our card. - * We could be smart only scan the required buses but that - * is error prone, and tricky. - * By scanning all possible pci buses in order we should find - * our card eventually. - */ - buses=256; - for (bus = first_bus; bus < buses; ++bus) { - for (devfn = first_devfn; devfn < 0xff; ++devfn, first_driver = 0) { - if (PCI_FUNC (devfn) == 0) - pcibios_read_config_byte(bus, devfn, PCI_HEADER_TYPE, &hdr_type); - else if (!(hdr_type & 0x80)) /* not a multi-function device */ - continue; - pcibios_read_config_dword(bus, devfn, PCI_VENDOR_ID, &l); - /* some broken boards return 0 if a slot is empty: */ - if (l == 0xffffffff || l == 0x00000000) { - continue; - } - vendor = l & 0xffff; - device = (l >> 16) & 0xffff; - - pcibios_read_config_dword(bus, devfn, PCI_REVISION, &l); - class = (l >> 8) & 0xffffff; -#if DEBUG - { - int i; - printf("%hhx:%hhx.%hhx [%hX/%hX] ---- ", - bus, PCI_SLOT(devfn), PCI_FUNC(devfn), - vendor, device); -#if DEBUG > 1 - for(i = 0; i < 256; i++) { - unsigned char byte; - if ((i & 0xf) == 0) { - printf("%hhx: ", i); - } - pcibios_read_config_byte(bus, devfn, i, &byte); - printf("%hhx ", byte); - if ((i & 0xf) == 0xf) { - printf("\n"); - } - } -#endif - - } -#endif - scan_drivers(type, class, vendor, device, first_driver, dev); - if (!dev->driver){ -#if DEBUG - printf("No driver fit.\n"); -#endif - continue; - } -#if DEBUG - printf("Get Driver:\n"); -#endif - dev->devfn = devfn; - dev->bus = bus; - dev->class = class; - dev->vendor = vendor; - dev->dev_id = device; - - - /* Get the ROM base address */ - pcibios_read_config_dword(bus, devfn, - PCI_ROM_ADDRESS, &romaddr); - romaddr >>= 10; - dev->romaddr = romaddr; - - /* Get the ``membase'' */ - pcibios_read_config_dword(bus, devfn, - PCI_BASE_ADDRESS_1, &membase); - dev->membase = membase; - - /* Get the ``ioaddr'' */ - for (reg = PCI_BASE_ADDRESS_0; reg <= PCI_BASE_ADDRESS_5; reg += 4) { - pcibios_read_config_dword(bus, devfn, reg, &ioaddr); - if ((ioaddr & PCI_BASE_ADDRESS_IO_MASK) == 0 || (ioaddr & PCI_BASE_ADDRESS_SPACE_IO) == 0) - continue; - - - /* Strip the I/O address out of the returned value */ - ioaddr &= PCI_BASE_ADDRESS_IO_MASK; - - /* Take the first one or the one that matches in boot ROM address */ - dev->ioaddr = ioaddr; - } -#if DEBUG > 2 - printf("Found %s ROM address %#hx\n", - dev->name, romaddr); -#endif - LeaveFunction("scan_pci_bus"); - return; - } - first_devfn = 0; - } - first_bus = 0; - LeaveFunction("scan_pci_bus"); -} - - - -/* - * Set device to be a busmaster in case BIOS neglected to do so. - * Also adjust PCI latency timer to a reasonable value, 32. - */ -void adjust_pci_device(struct pci_device *p) -{ - unsigned short new_command, pci_command; - unsigned char pci_latency; - - pcibios_read_config_word(p->bus, p->devfn, PCI_COMMAND, &pci_command); - new_command = pci_command | PCI_COMMAND_MASTER|PCI_COMMAND_IO; - if (pci_command != new_command) { -#if DEBUG > 0 - printf( - "The PCI BIOS has not enabled this device!\n" - "Updating PCI command %hX->%hX. pci_bus %hhX pci_device_fn %hhX\n", - pci_command, new_command, p->bus, p->devfn); -#endif - pcibios_write_config_word(p->bus, p->devfn, PCI_COMMAND, new_command); - } - pcibios_read_config_byte(p->bus, p->devfn, PCI_LATENCY_TIMER, &pci_latency); - if (pci_latency < 32) { -#if DEBUG > 0 - printf("PCI latency timer (CFLT) is unreasonably low at %d. Setting to 32 clocks.\n", - pci_latency); -#endif - pcibios_write_config_byte(p->bus, p->devfn, PCI_LATENCY_TIMER, 32); - } -} - -/* - * Find the start of a pci resource. - */ -unsigned long pci_bar_start(struct pci_device *dev, unsigned int index) -{ - uint32_t lo, hi; - unsigned long bar; - pci_read_config_dword(dev, index, &lo); - if (lo & PCI_BASE_ADDRESS_SPACE_IO) { - bar = lo & PCI_BASE_ADDRESS_IO_MASK; - } else { - bar = 0; - if ((lo & PCI_BASE_ADDRESS_MEM_TYPE_MASK) == PCI_BASE_ADDRESS_MEM_TYPE_64) { - pci_read_config_dword(dev, index + 4, &hi); - if (hi) { - if (sizeof(unsigned long) > sizeof(uint32_t)) { - /* It's REALLY interesting:-) */ - bar = (uint64_t)hi << 32; - } - else { - printf("Unhandled 64bit BAR\n"); - return -1UL; - } - } - } - bar |= lo & PCI_BASE_ADDRESS_MEM_MASK; - } - return bar + pcibios_bus_base(dev->bus); -} - -/* - * Find the size of a pci resource. - */ -unsigned long pci_bar_size(struct pci_device *dev, unsigned int bar) -{ - uint32_t start, size; - /* Save the original bar */ - pci_read_config_dword(dev, bar, &start); - /* Compute which bits can be set */ - pci_write_config_dword(dev, bar, ~0); - pci_read_config_dword(dev, bar, &size); - /* Restore the original size */ - pci_write_config_dword(dev, bar, start); - /* Find the significant bits */ - if (start & PCI_BASE_ADDRESS_SPACE_IO) { - size &= PCI_BASE_ADDRESS_IO_MASK; - } else { - size &= PCI_BASE_ADDRESS_MEM_MASK; - } - /* Find the lowest bit set */ - size = size & ~(size - 1); - return size; -} - -/** - * pci_find_capability - query for devices' capabilities - * @dev: PCI device to query - * @cap: capability code - * - * Tell if a device supports a given PCI capability. - * Returns the address of the requested capability structure within the - * device's PCI configuration space or 0 in case the device does not - * support it. Possible values for @cap: - * - * %PCI_CAP_ID_PM Power Management - * - * %PCI_CAP_ID_AGP Accelerated Graphics Port - * - * %PCI_CAP_ID_VPD Vital Product Data - * - * %PCI_CAP_ID_SLOTID Slot Identification - * - * %PCI_CAP_ID_MSI Message Signalled Interrupts - * - * %PCI_CAP_ID_CHSWP CompactPCI HotSwap - */ -int pci_find_capability(struct pci_device *dev, int cap) -{ - uint16_t status; - uint8_t pos, id; - uint8_t hdr_type; - int ttl = 48; - - pci_read_config_word(dev, PCI_STATUS, &status); - if (!(status & PCI_STATUS_CAP_LIST)) - return 0; - pci_read_config_byte(dev, PCI_HEADER_TYPE, &hdr_type); - switch (hdr_type & 0x7F) { - case PCI_HEADER_TYPE_NORMAL: - case PCI_HEADER_TYPE_BRIDGE: - default: - pci_read_config_byte(dev, PCI_CAPABILITY_LIST, &pos); - break; - case PCI_HEADER_TYPE_CARDBUS: - pci_read_config_byte(dev, PCI_CB_CAPABILITY_LIST, &pos); - break; - } - while (ttl-- && pos >= 0x40) { - pos &= ~3; - pci_read_config_byte(dev, pos + PCI_CAP_LIST_ID, &id); -#if DEBUG > 0 - printf("Capability: %d\n", id); -#endif - if (id == 0xff) - break; - if (id == cap) - return pos; - pci_read_config_byte(dev, pos + PCI_CAP_LIST_NEXT, &pos); - } - return 0; -} - diff --git a/usr/src/grub/grub-0.95/netboot/pci.h b/usr/src/grub/grub-0.95/netboot/pci.h deleted file mode 100644 index ac54b7833d..0000000000 --- a/usr/src/grub/grub-0.95/netboot/pci.h +++ /dev/null @@ -1,357 +0,0 @@ -#if !defined(PCI_H) && defined(CONFIG_PCI) -#define PCI_H - -/* -** Support for NE2000 PCI clones added David Monro June 1997 -** Generalised for other PCI NICs by Ken Yap July 1997 -** -** Most of this is taken from: -** -** /usr/src/linux/drivers/pci/pci.c -** /usr/src/linux/include/linux/pci.h -** /usr/src/linux/arch/i386/bios32.c -** /usr/src/linux/include/linux/bios32.h -** /usr/src/linux/drivers/net/ne.c -*/ - -/* - * 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. - */ - -#include "pci_ids.h" - -#define PCI_COMMAND_IO 0x1 /* Enable response in I/O space */ -#define PCI_COMMAND_MEM 0x2 /* Enable response in mem space */ -#define PCI_COMMAND_MASTER 0x4 /* Enable bus mastering */ -#define PCI_LATENCY_TIMER 0x0d /* 8 bits */ -#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 PCIBIOS_PCI_FUNCTION_ID 0xb1XX -#define PCIBIOS_PCI_BIOS_PRESENT 0xb101 -#define PCIBIOS_FIND_PCI_DEVICE 0xb102 -#define PCIBIOS_FIND_PCI_CLASS_CODE 0xb103 -#define PCIBIOS_GENERATE_SPECIAL_CYCLE 0xb106 -#define PCIBIOS_READ_CONFIG_BYTE 0xb108 -#define PCIBIOS_READ_CONFIG_WORD 0xb109 -#define PCIBIOS_READ_CONFIG_DWORD 0xb10a -#define PCIBIOS_WRITE_CONFIG_BYTE 0xb10b -#define PCIBIOS_WRITE_CONFIG_WORD 0xb10c -#define PCIBIOS_WRITE_CONFIG_DWORD 0xb10d - -#define PCI_VENDOR_ID 0x00 /* 16 bits */ -#define PCI_DEVICE_ID 0x02 /* 16 bits */ -#define PCI_COMMAND 0x04 /* 16 bits */ - -#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_REVISION 0x08 /* 8 bits */ -#define PCI_REVISION_ID 0x08 /* 8 bits */ -#define PCI_CLASS_REVISION 0x08 /* 32 bits */ -#define PCI_CLASS_CODE 0x0b /* 8 bits */ -#define PCI_SUBCLASS_CODE 0x0a /* 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 - - -/* Header type 0 (normal devices) */ -#define PCI_CARDBUS_CIS 0x28 -#define PCI_SUBSYSTEM_VENDOR_ID 0x2c -#define PCI_SUBSYSTEM_ID 0x2e - -#define PCI_BASE_ADDRESS_0 0x10 /* 32 bits */ -#define PCI_BASE_ADDRESS_1 0x14 /* 32 bits */ -#define PCI_BASE_ADDRESS_2 0x18 /* 32 bits */ -#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_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 */ - -#ifndef PCI_BASE_ADDRESS_IO_MASK -#define PCI_BASE_ADDRESS_IO_MASK (~0x03) -#endif -#ifndef PCI_BASE_ADDRESS_MEM_MASK -#define PCI_BASE_ADDRESS_MEM_MASK (~0x0f) -#endif -#define PCI_BASE_ADDRESS_SPACE_IO 0x01 -#define PCI_ROM_ADDRESS 0x30 /* 32 bits */ -#define PCI_ROM_ADDRESS_ENABLE 0x01 /* Write 1 to enable ROM, - bits 31..11 are address, - 10..2 are reserved */ - -#define PCI_CAPABILITY_LIST 0x34 /* Offset of first capability list entry */ - -#define PCI_INTERRUPT_LINE 0x3c /* IRQ number (0-15) */ -#define PCI_INTERRUPT_PIN 0x3d /* IRQ pin on PCI bus (A-D) */ - -/* 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 0x0f /* I/O bridging type */ -#define PCI_IO_RANGE_TYPE_16 0x00 -#define PCI_IO_RANGE_TYPE_32 0x01 -#define PCI_IO_RANGE_MASK ~0x0f -#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 0x0f -#define PCI_MEMORY_RANGE_MASK ~0x0f -#define PCI_PREF_MEMORY_BASE 0x24 /* Prefetchable memory range behind */ -#define PCI_PREF_MEMORY_LIMIT 0x26 -#define PCI_PREF_RANGE_TYPE_MASK 0x0f -#define PCI_PREF_RANGE_TYPE_32 0x00 -#define PCI_PREF_RANGE_TYPE_64 0x01 -#define PCI_PREF_RANGE_MASK ~0x0f -#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_NO_ISA 0x04 /* Disable bridging of ISA ports */ -#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 */ - -#define PCI_CB_CAPABILITY_LIST 0x14 - -/* 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_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_CTRL 4 /* PM control and status register */ -#define PCI_PM_CTRL_STATE_MASK 0x0003 /* Current power state (D0 to D3) */ -#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 - -/* 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_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_SLOT(devfn) ((devfn) >> 3) -#define PCI_FUNC(devfn) ((devfn) & 0x07) - -#define BIOS32_SIGNATURE (('_' << 0) + ('3' << 8) + ('2' << 16) + ('_' << 24)) - -/* PCI signature: "PCI " */ -#define PCI_SIGNATURE (('P' << 0) + ('C' << 8) + ('I' << 16) + (' ' << 24)) - -/* PCI service signature: "$PCI" */ -#define PCI_SERVICE (('$' << 0) + ('P' << 8) + ('C' << 16) + ('I' << 24)) - -union bios32 { - struct { - unsigned long signature; /* _32_ */ - unsigned long entry; /* 32 bit physical address */ - unsigned char revision; /* Revision level, 0 */ - unsigned char length; /* Length in paragraphs should be 01 */ - unsigned char checksum; /* All bytes must add up to zero */ - unsigned char reserved[5]; /* Must be zero */ - } fields; - char chars[16]; -}; - -struct pci_device; -struct dev; -typedef int (*pci_probe_t)(struct dev *, struct pci_device *); - -struct pci_device { - uint32_t class; - uint16_t vendor, dev_id; - const char *name; - /* membase and ioaddr are silly and depricated */ - unsigned int membase; - unsigned int ioaddr; - unsigned int romaddr; - unsigned char irq; - unsigned char devfn; - unsigned char bus; - unsigned char use_specified; - const struct pci_driver *driver; -}; - -extern void scan_pci_bus(int type, struct pci_device *dev); -extern void find_pci(int type, struct pci_device *dev); - -extern int pcibios_read_config_byte(unsigned int bus, unsigned int device_fn, unsigned int where, uint8_t *value); -extern int pcibios_write_config_byte (unsigned int bus, unsigned int device_fn, unsigned int where, uint8_t value); -extern int pcibios_read_config_word(unsigned int bus, unsigned int device_fn, unsigned int where, uint16_t *value); -extern int pcibios_write_config_word (unsigned int bus, unsigned int device_fn, unsigned int where, uint16_t value); -extern int pcibios_read_config_dword(unsigned int bus, unsigned int device_fn, unsigned int where, uint32_t *value); -extern int pcibios_write_config_dword(unsigned int bus, unsigned int device_fn, unsigned int where, uint32_t value); -extern unsigned long pcibios_bus_base(unsigned int bus); -extern void adjust_pci_device(struct pci_device *p); - - -static inline int -pci_read_config_byte(struct pci_device *dev, unsigned int where, uint8_t *value) -{ - return pcibios_read_config_byte(dev->bus, dev->devfn, where, value); -} -static inline int -pci_write_config_byte(struct pci_device *dev, unsigned int where, uint8_t value) -{ - return pcibios_write_config_byte(dev->bus, dev->devfn, where, value); -} -static inline int -pci_read_config_word(struct pci_device *dev, unsigned int where, uint16_t *value) -{ - return pcibios_read_config_word(dev->bus, dev->devfn, where, value); -} -static inline int -pci_write_config_word(struct pci_device *dev, unsigned int where, uint16_t value) -{ - return pcibios_write_config_word(dev->bus, dev->devfn, where, value); -} -static inline int -pci_read_config_dword(struct pci_device *dev, unsigned int where, uint32_t *value) -{ - return pcibios_read_config_dword(dev->bus, dev->devfn, where, value); -} -static inline int -pci_write_config_dword(struct pci_device *dev, unsigned int where, uint32_t value) -{ - return pcibios_write_config_dword(dev->bus, dev->devfn, where, value); -} - -/* Helper functions to find the size of a pci bar */ -extern unsigned long pci_bar_start(struct pci_device *dev, unsigned int bar); -extern unsigned long pci_bar_size(struct pci_device *dev, unsigned int bar); -/* Helper function to find pci capabilities */ -extern int pci_find_capability(struct pci_device *dev, int cap); -struct pci_id { - unsigned short vendor, dev_id; - const char *name; -}; - -struct dev; -/* Most pci drivers will use this */ -struct pci_driver { - int type; - const char *name; - pci_probe_t probe; - struct pci_id *ids; - int id_count; - -/* On a few occasions the hardware is standardized enough that - * we only need to know the class of the device and not the exact - * type to drive the device correctly. If this is the case - * set a class value other than 0. - */ - unsigned short class; -}; - -#define PCI_ROM(VENDOR_ID, DEVICE_ID, IMAGE, DESCRIPTION) \ - { VENDOR_ID, DEVICE_ID, IMAGE, } - -#endif /* PCI_H */ diff --git a/usr/src/grub/grub-0.95/netboot/pci_ids.h b/usr/src/grub/grub-0.95/netboot/pci_ids.h deleted file mode 100644 index deec4103cf..0000000000 --- a/usr/src/grub/grub-0.95/netboot/pci_ids.h +++ /dev/null @@ -1,1809 +0,0 @@ -/* - * PCI Class, Vendor and Device IDs - * - * Please keep sorted. - */ - -/* Device classes and subclasses */ - -#define PCI_CLASS_NOT_DEFINED 0x0000 -#define PCI_CLASS_NOT_DEFINED_VGA 0x0001 - -#define PCI_BASE_CLASS_STORAGE 0x01 -#define PCI_CLASS_STORAGE_SCSI 0x0100 -#define PCI_CLASS_STORAGE_IDE 0x0101 -#define PCI_CLASS_STORAGE_FLOPPY 0x0102 -#define PCI_CLASS_STORAGE_IPI 0x0103 -#define PCI_CLASS_STORAGE_RAID 0x0104 -#define PCI_CLASS_STORAGE_OTHER 0x0180 - -#define PCI_BASE_CLASS_NETWORK 0x02 -#define PCI_CLASS_NETWORK_ETHERNET 0x0200 -#define PCI_CLASS_NETWORK_TOKEN_RING 0x0201 -#define PCI_CLASS_NETWORK_FDDI 0x0202 -#define PCI_CLASS_NETWORK_ATM 0x0203 -#define PCI_CLASS_NETWORK_OTHER 0x0280 - -#define PCI_BASE_CLASS_DISPLAY 0x03 -#define PCI_CLASS_DISPLAY_VGA 0x0300 -#define PCI_CLASS_DISPLAY_XGA 0x0301 -#define PCI_CLASS_DISPLAY_3D 0x0302 -#define PCI_CLASS_DISPLAY_OTHER 0x0380 - -#define PCI_BASE_CLASS_MULTIMEDIA 0x04 -#define PCI_CLASS_MULTIMEDIA_VIDEO 0x0400 -#define PCI_CLASS_MULTIMEDIA_AUDIO 0x0401 -#define PCI_CLASS_MULTIMEDIA_PHONE 0x0402 -#define PCI_CLASS_MULTIMEDIA_OTHER 0x0480 - -#define PCI_BASE_CLASS_MEMORY 0x05 -#define PCI_CLASS_MEMORY_RAM 0x0500 -#define PCI_CLASS_MEMORY_FLASH 0x0501 -#define PCI_CLASS_MEMORY_OTHER 0x0580 - -#define PCI_BASE_CLASS_BRIDGE 0x06 -#define PCI_CLASS_BRIDGE_HOST 0x0600 -#define PCI_CLASS_BRIDGE_ISA 0x0601 -#define PCI_CLASS_BRIDGE_EISA 0x0602 -#define PCI_CLASS_BRIDGE_MC 0x0603 -#define PCI_CLASS_BRIDGE_PCI 0x0604 -#define PCI_CLASS_BRIDGE_PCMCIA 0x0605 -#define PCI_CLASS_BRIDGE_NUBUS 0x0606 -#define PCI_CLASS_BRIDGE_CARDBUS 0x0607 -#define PCI_CLASS_BRIDGE_RACEWAY 0x0608 -#define PCI_CLASS_BRIDGE_OTHER 0x0680 - -#define PCI_BASE_CLASS_COMMUNICATION 0x07 -#define PCI_CLASS_COMMUNICATION_SERIAL 0x0700 -#define PCI_CLASS_COMMUNICATION_PARALLEL 0x0701 -#define PCI_CLASS_COMMUNICATION_MULTISERIAL 0x0702 -#define PCI_CLASS_COMMUNICATION_MODEM 0x0703 -#define PCI_CLASS_COMMUNICATION_OTHER 0x0780 - -#define PCI_BASE_CLASS_SYSTEM 0x08 -#define PCI_CLASS_SYSTEM_PIC 0x0800 -#define PCI_CLASS_SYSTEM_DMA 0x0801 -#define PCI_CLASS_SYSTEM_TIMER 0x0802 -#define PCI_CLASS_SYSTEM_RTC 0x0803 -#define PCI_CLASS_SYSTEM_PCI_HOTPLUG 0x0804 -#define PCI_CLASS_SYSTEM_OTHER 0x0880 - -#define PCI_BASE_CLASS_INPUT 0x09 -#define PCI_CLASS_INPUT_KEYBOARD 0x0900 -#define PCI_CLASS_INPUT_PEN 0x0901 -#define PCI_CLASS_INPUT_MOUSE 0x0902 -#define PCI_CLASS_INPUT_SCANNER 0x0903 -#define PCI_CLASS_INPUT_GAMEPORT 0x0904 -#define PCI_CLASS_INPUT_OTHER 0x0980 - -#define PCI_BASE_CLASS_DOCKING 0x0a -#define PCI_CLASS_DOCKING_GENERIC 0x0a00 -#define PCI_CLASS_DOCKING_OTHER 0x0a80 - -#define PCI_BASE_CLASS_PROCESSOR 0x0b -#define PCI_CLASS_PROCESSOR_386 0x0b00 -#define PCI_CLASS_PROCESSOR_486 0x0b01 -#define PCI_CLASS_PROCESSOR_PENTIUM 0x0b02 -#define PCI_CLASS_PROCESSOR_ALPHA 0x0b10 -#define PCI_CLASS_PROCESSOR_POWERPC 0x0b20 -#define PCI_CLASS_PROCESSOR_MIPS 0x0b30 -#define PCI_CLASS_PROCESSOR_CO 0x0b40 - -#define PCI_BASE_CLASS_SERIAL 0x0c -#define PCI_CLASS_SERIAL_FIREWIRE 0x0c00 -#define PCI_CLASS_SERIAL_ACCESS 0x0c01 -#define PCI_CLASS_SERIAL_SSA 0x0c02 -#define PCI_CLASS_SERIAL_USB 0x0c03 -#define PCI_CLASS_SERIAL_FIBER 0x0c04 -#define PCI_CLASS_SERIAL_SMBUS 0x0c05 - -#define PCI_BASE_CLASS_INTELLIGENT 0x0e -#define PCI_CLASS_INTELLIGENT_I2O 0x0e00 - -#define PCI_BASE_CLASS_SATELLITE 0x0f -#define PCI_CLASS_SATELLITE_TV 0x0f00 -#define PCI_CLASS_SATELLITE_AUDIO 0x0f01 -#define PCI_CLASS_SATELLITE_VOICE 0x0f03 -#define PCI_CLASS_SATELLITE_DATA 0x0f04 - -#define PCI_BASE_CLASS_CRYPT 0x10 -#define PCI_CLASS_CRYPT_NETWORK 0x1000 -#define PCI_CLASS_CRYPT_ENTERTAINMENT 0x1001 -#define PCI_CLASS_CRYPT_OTHER 0x1080 - -#define PCI_BASE_CLASS_SIGNAL_PROCESSING 0x11 -#define PCI_CLASS_SP_DPIO 0x1100 -#define PCI_CLASS_SP_OTHER 0x1180 - -#define PCI_CLASS_OTHERS 0xff - -/* Vendors and devices. Sort key: vendor first, device next. */ - -#define PCI_VENDOR_ID_DYNALINK 0x0675 -#define PCI_DEVICE_ID_DYNALINK_IS64PH 0x1702 - -#define PCI_VENDOR_ID_BERKOM 0x0871 -#define PCI_DEVICE_ID_BERKOM_A1T 0xffa1 -#define PCI_DEVICE_ID_BERKOM_T_CONCEPT 0xffa2 -#define PCI_DEVICE_ID_BERKOM_A4T 0xffa4 -#define PCI_DEVICE_ID_BERKOM_SCITEL_QUADRO 0xffa8 - -#define PCI_VENDOR_ID_COMPAQ 0x0e11 -#define PCI_DEVICE_ID_COMPAQ_TOKENRING 0x0508 -#define PCI_DEVICE_ID_COMPAQ_1280 0x3033 -#define PCI_DEVICE_ID_COMPAQ_TRIFLEX 0x4000 -#define PCI_DEVICE_ID_COMPAQ_6010 0x6010 -#define PCI_DEVICE_ID_COMPAQ_SMART2P 0xae10 -#define PCI_DEVICE_ID_COMPAQ_NETEL100 0xae32 -#define PCI_DEVICE_ID_COMPAQ_NETEL10 0xae34 -#define PCI_DEVICE_ID_COMPAQ_NETFLEX3I 0xae35 -#define PCI_DEVICE_ID_COMPAQ_NETEL100D 0xae40 -#define PCI_DEVICE_ID_COMPAQ_NETEL100PI 0xae43 -#define PCI_DEVICE_ID_COMPAQ_NETEL100I 0xb011 -#define PCI_DEVICE_ID_COMPAQ_CISS 0xb060 -#define PCI_DEVICE_ID_COMPAQ_CISSB 0xb178 -#define PCI_DEVICE_ID_COMPAQ_THUNDER 0xf130 -#define PCI_DEVICE_ID_COMPAQ_NETFLEX3B 0xf150 - -#define PCI_VENDOR_ID_NCR 0x1000 -#define PCI_VENDOR_ID_LSI_LOGIC 0x1000 -#define PCI_DEVICE_ID_NCR_53C810 0x0001 -#define PCI_DEVICE_ID_NCR_53C820 0x0002 -#define PCI_DEVICE_ID_NCR_53C825 0x0003 -#define PCI_DEVICE_ID_NCR_53C815 0x0004 -#define PCI_DEVICE_ID_LSI_53C810AP 0x0005 -#define PCI_DEVICE_ID_NCR_53C860 0x0006 -#define PCI_DEVICE_ID_LSI_53C1510 0x000a -#define PCI_DEVICE_ID_NCR_53C896 0x000b -#define PCI_DEVICE_ID_NCR_53C895 0x000c -#define PCI_DEVICE_ID_NCR_53C885 0x000d -#define PCI_DEVICE_ID_NCR_53C875 0x000f -#define PCI_DEVICE_ID_NCR_53C1510 0x0010 -#define PCI_DEVICE_ID_LSI_53C895A 0x0012 -#define PCI_DEVICE_ID_LSI_53C875A 0x0013 -#define PCI_DEVICE_ID_LSI_53C1010_33 0x0020 -#define PCI_DEVICE_ID_LSI_53C1010_66 0x0021 -#define PCI_DEVICE_ID_LSI_53C1030 0x0030 -#define PCI_DEVICE_ID_LSI_53C1035 0x0040 -#define PCI_DEVICE_ID_NCR_53C875J 0x008f -#define PCI_DEVICE_ID_LSI_FC909 0x0621 -#define PCI_DEVICE_ID_LSI_FC929 0x0622 -#define PCI_DEVICE_ID_LSI_FC929_LAN 0x0623 -#define PCI_DEVICE_ID_LSI_FC919 0x0624 -#define PCI_DEVICE_ID_LSI_FC919_LAN 0x0625 -#define PCI_DEVICE_ID_NCR_YELLOWFIN 0x0701 -#define PCI_DEVICE_ID_LSI_61C102 0x0901 -#define PCI_DEVICE_ID_LSI_63C815 0x1000 - -#define PCI_VENDOR_ID_ATI 0x1002 -/* Mach64 */ -#define PCI_DEVICE_ID_ATI_68800 0x4158 -#define PCI_DEVICE_ID_ATI_215CT222 0x4354 -#define PCI_DEVICE_ID_ATI_210888CX 0x4358 -#define PCI_DEVICE_ID_ATI_215ET222 0x4554 -/* Mach64 / Rage */ -#define PCI_DEVICE_ID_ATI_215GB 0x4742 -#define PCI_DEVICE_ID_ATI_215GD 0x4744 -#define PCI_DEVICE_ID_ATI_215GI 0x4749 -#define PCI_DEVICE_ID_ATI_215GP 0x4750 -#define PCI_DEVICE_ID_ATI_215GQ 0x4751 -#define PCI_DEVICE_ID_ATI_215XL 0x4752 -#define PCI_DEVICE_ID_ATI_215GT 0x4754 -#define PCI_DEVICE_ID_ATI_215GTB 0x4755 -#define PCI_DEVICE_ID_ATI_215_IV 0x4756 -#define PCI_DEVICE_ID_ATI_215_IW 0x4757 -#define PCI_DEVICE_ID_ATI_215_IZ 0x475A -#define PCI_DEVICE_ID_ATI_210888GX 0x4758 -#define PCI_DEVICE_ID_ATI_215_LB 0x4c42 -#define PCI_DEVICE_ID_ATI_215_LD 0x4c44 -#define PCI_DEVICE_ID_ATI_215_LG 0x4c47 -#define PCI_DEVICE_ID_ATI_215_LI 0x4c49 -#define PCI_DEVICE_ID_ATI_215_LM 0x4c4D -#define PCI_DEVICE_ID_ATI_215_LN 0x4c4E -#define PCI_DEVICE_ID_ATI_215_LR 0x4c52 -#define PCI_DEVICE_ID_ATI_215_LS 0x4c53 -#define PCI_DEVICE_ID_ATI_264_LT 0x4c54 -/* Mach64 VT */ -#define PCI_DEVICE_ID_ATI_264VT 0x5654 -#define PCI_DEVICE_ID_ATI_264VU 0x5655 -#define PCI_DEVICE_ID_ATI_264VV 0x5656 -/* Rage128 Pro GL */ -#define PCI_DEVICE_ID_ATI_Rage128_PA 0x5041 -#define PCI_DEVICE_ID_ATI_Rage128_PB 0x5042 -#define PCI_DEVICE_ID_ATI_Rage128_PC 0x5043 -#define PCI_DEVICE_ID_ATI_Rage128_PD 0x5044 -#define PCI_DEVICE_ID_ATI_Rage128_PE 0x5045 -#define PCI_DEVICE_ID_ATI_RAGE128_PF 0x5046 -/* Rage128 Pro VR */ -#define PCI_DEVICE_ID_ATI_RAGE128_PG 0x5047 -#define PCI_DEVICE_ID_ATI_RAGE128_PH 0x5048 -#define PCI_DEVICE_ID_ATI_RAGE128_PI 0x5049 -#define PCI_DEVICE_ID_ATI_RAGE128_PJ 0x504A -#define PCI_DEVICE_ID_ATI_RAGE128_PK 0x504B -#define PCI_DEVICE_ID_ATI_RAGE128_PL 0x504C -#define PCI_DEVICE_ID_ATI_RAGE128_PM 0x504D -#define PCI_DEVICE_ID_ATI_RAGE128_PN 0x504E -#define PCI_DEVICE_ID_ATI_RAGE128_PO 0x504F -#define PCI_DEVICE_ID_ATI_RAGE128_PP 0x5050 -#define PCI_DEVICE_ID_ATI_RAGE128_PQ 0x5051 -#define PCI_DEVICE_ID_ATI_RAGE128_PR 0x5052 -#define PCI_DEVICE_ID_ATI_RAGE128_TR 0x5452 -#define PCI_DEVICE_ID_ATI_RAGE128_PS 0x5053 -#define PCI_DEVICE_ID_ATI_RAGE128_PT 0x5054 -#define PCI_DEVICE_ID_ATI_RAGE128_PU 0x5055 -#define PCI_DEVICE_ID_ATI_RAGE128_PV 0x5056 -#define PCI_DEVICE_ID_ATI_RAGE128_PW 0x5057 -#define PCI_DEVICE_ID_ATI_RAGE128_PX 0x5058 -/* Rage128 GL */ -#define PCI_DEVICE_ID_ATI_RAGE128_RE 0x5245 -#define PCI_DEVICE_ID_ATI_RAGE128_RF 0x5246 -#define PCI_DEVICE_ID_ATI_RAGE128_RG 0x534b -#define PCI_DEVICE_ID_ATI_RAGE128_RH 0x534c -#define PCI_DEVICE_ID_ATI_RAGE128_RI 0x534d -/* Rage128 VR */ -#define PCI_DEVICE_ID_ATI_RAGE128_RK 0x524b -#define PCI_DEVICE_ID_ATI_RAGE128_RL 0x524c -#define PCI_DEVICE_ID_ATI_RAGE128_RM 0x5345 -#define PCI_DEVICE_ID_ATI_RAGE128_RN 0x5346 -#define PCI_DEVICE_ID_ATI_RAGE128_RO 0x5347 -/* Rage128 M3 */ -#define PCI_DEVICE_ID_ATI_RAGE128_LE 0x4c45 -#define PCI_DEVICE_ID_ATI_RAGE128_LF 0x4c46 -/* Rage128 Pro Ultra */ -#define PCI_DEVICE_ID_ATI_RAGE128_U1 0x5446 -#define PCI_DEVICE_ID_ATI_RAGE128_U2 0x544C -#define PCI_DEVICE_ID_ATI_RAGE128_U3 0x5452 -/* Radeon M4 */ -#define PCI_DEVICE_ID_ATI_RADEON_LE 0x4d45 -#define PCI_DEVICE_ID_ATI_RADEON_LF 0x4d46 -/* Radeon NV-100 */ -#define PCI_DEVICE_ID_ATI_RADEON_N1 0x5159 -#define PCI_DEVICE_ID_ATI_RADEON_N2 0x515a -/* Radeon */ -#define PCI_DEVICE_ID_ATI_RADEON_RA 0x5144 -#define PCI_DEVICE_ID_ATI_RADEON_RB 0x5145 -#define PCI_DEVICE_ID_ATI_RADEON_RC 0x5146 -#define PCI_DEVICE_ID_ATI_RADEON_RD 0x5147 - -#define PCI_VENDOR_ID_VLSI 0x1004 -#define PCI_DEVICE_ID_VLSI_82C592 0x0005 -#define PCI_DEVICE_ID_VLSI_82C593 0x0006 -#define PCI_DEVICE_ID_VLSI_82C594 0x0007 -#define PCI_DEVICE_ID_VLSI_82C597 0x0009 -#define PCI_DEVICE_ID_VLSI_82C541 0x000c -#define PCI_DEVICE_ID_VLSI_82C543 0x000d -#define PCI_DEVICE_ID_VLSI_82C532 0x0101 -#define PCI_DEVICE_ID_VLSI_82C534 0x0102 -#define PCI_DEVICE_ID_VLSI_82C535 0x0104 -#define PCI_DEVICE_ID_VLSI_82C147 0x0105 -#define PCI_DEVICE_ID_VLSI_VAS96011 0x0702 - -#define PCI_VENDOR_ID_ADL 0x1005 -#define PCI_DEVICE_ID_ADL_2301 0x2301 - -#define PCI_VENDOR_ID_NS 0x100b -#define PCI_DEVICE_ID_NS_87415 0x0002 -#define PCI_DEVICE_ID_NS_87560_LIO 0x000e -#define PCI_DEVICE_ID_NS_87560_USB 0x0012 -#define PCI_DEVICE_ID_NS_83815 0x0020 -#define PCI_DEVICE_ID_DP83815 0x0020 -#define PCI_DEVICE_ID_NS_83820 0x0022 -#define PCI_DEVICE_ID_NS_87410 0xd001 - -#define PCI_VENDOR_ID_TSENG 0x100c -#define PCI_DEVICE_ID_TSENG_W32P_2 0x3202 -#define PCI_DEVICE_ID_TSENG_W32P_b 0x3205 -#define PCI_DEVICE_ID_TSENG_W32P_c 0x3206 -#define PCI_DEVICE_ID_TSENG_W32P_d 0x3207 -#define PCI_DEVICE_ID_TSENG_ET6000 0x3208 - -#define PCI_VENDOR_ID_WEITEK 0x100e -#define PCI_DEVICE_ID_WEITEK_P9000 0x9001 -#define PCI_DEVICE_ID_WEITEK_P9100 0x9100 - -#define PCI_VENDOR_ID_DEC 0x1011 -#define PCI_DEVICE_ID_DEC_BRD 0x0001 -#define PCI_DEVICE_ID_DEC_TULIP 0x0002 -#define PCI_DEVICE_ID_DEC_TGA 0x0004 -#define PCI_DEVICE_ID_DEC_TULIP_FAST 0x0009 -#define PCI_DEVICE_ID_DEC_TGA2 0x000D -#define PCI_DEVICE_ID_DEC_FDDI 0x000F -#define PCI_DEVICE_ID_DEC_TULIP_PLUS 0x0014 -#define PCI_DEVICE_ID_DEC_21142 0x0019 -#define PCI_DEVICE_ID_DEC_21052 0x0021 -#define PCI_DEVICE_ID_DEC_21150 0x0022 -#define PCI_DEVICE_ID_DEC_21152 0x0024 -#define PCI_DEVICE_ID_DEC_21153 0x0025 -#define PCI_DEVICE_ID_DEC_21154 0x0026 -#define PCI_DEVICE_ID_DEC_21285 0x1065 -#define PCI_DEVICE_ID_COMPAQ_42XX 0x0046 - -#define PCI_VENDOR_ID_CIRRUS 0x1013 -#define PCI_DEVICE_ID_CIRRUS_7548 0x0038 -#define PCI_DEVICE_ID_CIRRUS_5430 0x00a0 -#define PCI_DEVICE_ID_CIRRUS_5434_4 0x00a4 -#define PCI_DEVICE_ID_CIRRUS_5434_8 0x00a8 -#define PCI_DEVICE_ID_CIRRUS_5436 0x00ac -#define PCI_DEVICE_ID_CIRRUS_5446 0x00b8 -#define PCI_DEVICE_ID_CIRRUS_5480 0x00bc -#define PCI_DEVICE_ID_CIRRUS_5462 0x00d0 -#define PCI_DEVICE_ID_CIRRUS_5464 0x00d4 -#define PCI_DEVICE_ID_CIRRUS_5465 0x00d6 -#define PCI_DEVICE_ID_CIRRUS_6729 0x1100 -#define PCI_DEVICE_ID_CIRRUS_6832 0x1110 -#define PCI_DEVICE_ID_CIRRUS_7542 0x1200 -#define PCI_DEVICE_ID_CIRRUS_7543 0x1202 -#define PCI_DEVICE_ID_CIRRUS_7541 0x1204 - -#define PCI_VENDOR_ID_IBM 0x1014 -#define PCI_DEVICE_ID_IBM_FIRE_CORAL 0x000a -#define PCI_DEVICE_ID_IBM_TR 0x0018 -#define PCI_DEVICE_ID_IBM_82G2675 0x001d -#define PCI_DEVICE_ID_IBM_MCA 0x0020 -#define PCI_DEVICE_ID_IBM_82351 0x0022 -#define PCI_DEVICE_ID_IBM_PYTHON 0x002d -#define PCI_DEVICE_ID_IBM_SERVERAID 0x002e -#define PCI_DEVICE_ID_IBM_TR_WAKE 0x003e -#define PCI_DEVICE_ID_IBM_MPIC 0x0046 -#define PCI_DEVICE_ID_IBM_3780IDSP 0x007d -#define PCI_DEVICE_ID_IBM_CHUKAR 0x0096 -#define PCI_DEVICE_ID_IBM_405GP 0x0156 -#define PCI_DEVICE_ID_IBM_SERVERAIDI960 0x01bd -#define PCI_DEVICE_ID_IBM_MPIC_2 0xffff - -#define PCI_VENDOR_ID_COMPEX2 0x101a // pci.ids says "AT&T GIS (NCR)" -#define PCI_DEVICE_ID_COMPEX2_100VG 0x0005 - -#define PCI_VENDOR_ID_WD 0x101c -#define PCI_DEVICE_ID_WD_7197 0x3296 - -#define PCI_VENDOR_ID_AMI 0x101e -#define PCI_DEVICE_ID_AMI_MEGARAID3 0x1960 -#define PCI_DEVICE_ID_AMI_MEGARAID 0x9010 -#define PCI_DEVICE_ID_AMI_MEGARAID2 0x9060 - -#define PCI_VENDOR_ID_AMD 0x1022 - -#define PCI_DEVICE_ID_AMD_LANCE 0x2000 -#define PCI_DEVICE_ID_AMD_LANCE_HOME 0x2001 -#define PCI_DEVICE_ID_AMD_HOMEPNA 0x2001 -#define PCI_DEVICE_ID_AMD_SCSI 0x2020 -#define PCI_DEVICE_ID_AMD_FE_GATE_7006 0x7006 -#define PCI_DEVICE_ID_AMD_FE_GATE_7007 0x7007 -#define PCI_DEVICE_ID_AMD_FE_GATE_700C 0x700C -#define PCI_DEVIDE_ID_AMD_FE_GATE_700D 0x700D -#define PCI_DEVICE_ID_AMD_FE_GATE_700E 0x700E -#define PCI_DEVICE_ID_AMD_FE_GATE_700F 0x700F -#define PCI_DEVICE_ID_AMD_COBRA_7400 0x7400 -#define PCI_DEVICE_ID_AMD_COBRA_7401 0x7401 -#define PCI_DEVICE_ID_AMD_COBRA_7403 0x7403 -#define PCI_DEVICE_ID_AMD_COBRA_7404 0x7404 -#define PCI_DEVICE_ID_AMD_VIPER_7408 0x7408 -#define PCI_DEVICE_ID_AMD_VIPER_7409 0x7409 -#define PCI_DEVICE_ID_AMD_VIPER_740B 0x740B -#define PCI_DEVICE_ID_AMD_VIPER_740C 0x740C -#define PCI_DEVICE_ID_AMD_VIPER_7410 0x7410 -#define PCI_DEVICE_ID_AMD_VIPER_7411 0x7411 -#define PCI_DEVICE_ID_AMD_VIPER_7413 0x7413 -#define PCI_DEVICE_ID_AMD_VIPER_7414 0x7414 -#define PCI_DEVICE_ID_AMD_VIPER_7440 0x7440 -#define PCI_DEVICE_ID_AMD_VIPER_7441 0x7441 -#define PCI_DEVICE_ID_AMD_VIPER_7443 0x7443 -#define PCI_DEVICE_ID_AMD_VIPER_7448 0x7448 -#define PCI_DEVICE_ID_AMD_VIPER_7449 0x7449 - -#define PCI_VENDOR_ID_TRIDENT 0x1023 -#define PCI_DEVICE_ID_TRIDENT_4DWAVE_DX 0x2000 -#define PCI_DEVICE_ID_TRIDENT_4DWAVE_NX 0x2001 -#define PCI_DEVICE_ID_TRIDENT_9320 0x9320 -#define PCI_DEVICE_ID_TRIDENT_9388 0x9388 -#define PCI_DEVICE_ID_TRIDENT_9397 0x9397 -#define PCI_DEVICE_ID_TRIDENT_939A 0x939A -#define PCI_DEVICE_ID_TRIDENT_9520 0x9520 -#define PCI_DEVICE_ID_TRIDENT_9525 0x9525 -#define PCI_DEVICE_ID_TRIDENT_9420 0x9420 -#define PCI_DEVICE_ID_TRIDENT_9440 0x9440 -#define PCI_DEVICE_ID_TRIDENT_9660 0x9660 -#define PCI_DEVICE_ID_TRIDENT_9750 0x9750 -#define PCI_DEVICE_ID_TRIDENT_9850 0x9850 -#define PCI_DEVICE_ID_TRIDENT_9880 0x9880 -#define PCI_DEVICE_ID_TRIDENT_8400 0x8400 -#define PCI_DEVICE_ID_TRIDENT_8420 0x8420 -#define PCI_DEVICE_ID_TRIDENT_8500 0x8500 - -#define PCI_VENDOR_ID_AI 0x1025 -#define PCI_DEVICE_ID_AI_M1435 0x1435 - -#define PCI_VENDOR_ID_DELL 0x1028 - -#define PCI_VENDOR_ID_MATROX 0x102B -#define PCI_DEVICE_ID_MATROX_MGA_2 0x0518 -#define PCI_DEVICE_ID_MATROX_MIL 0x0519 -#define PCI_DEVICE_ID_MATROX_MYS 0x051A -#define PCI_DEVICE_ID_MATROX_MIL_2 0x051b -#define PCI_DEVICE_ID_MATROX_MIL_2_AGP 0x051f -#define PCI_DEVICE_ID_MATROX_MGA_IMP 0x0d10 -#define PCI_DEVICE_ID_MATROX_G100_MM 0x1000 -#define PCI_DEVICE_ID_MATROX_G100_AGP 0x1001 -#define PCI_DEVICE_ID_MATROX_G200_PCI 0x0520 -#define PCI_DEVICE_ID_MATROX_G200_AGP 0x0521 -#define PCI_DEVICE_ID_MATROX_G400 0x0525 -#define PCI_DEVICE_ID_MATROX_G550 0x2527 -#define PCI_DEVICE_ID_MATROX_VIA 0x4536 - -#define PCI_VENDOR_ID_CT 0x102c -#define PCI_DEVICE_ID_CT_65545 0x00d8 -#define PCI_DEVICE_ID_CT_65548 0x00dc -#define PCI_DEVICE_ID_CT_65550 0x00e0 -#define PCI_DEVICE_ID_CT_65554 0x00e4 -#define PCI_DEVICE_ID_CT_65555 0x00e5 - -#define PCI_VENDOR_ID_MIRO 0x1031 -#define PCI_DEVICE_ID_MIRO_36050 0x5601 - -#define PCI_VENDOR_ID_NEC 0x1033 -#define PCI_DEVICE_ID_NEC_PCX2 0x0046 -#define PCI_DEVICE_ID_NEC_NILE4 0x005a -#define PCI_DEVICE_ID_NEC_VRC5476 0x009b - -#define PCI_VENDOR_ID_FD 0x1036 -#define PCI_DEVICE_ID_FD_36C70 0x0000 - -#define PCI_VENDOR_ID_SIS 0x1039 -#define PCI_VENDOR_ID_SI 0x1039 -#define PCI_DEVICE_ID_SI_5591_AGP 0x0001 -#define PCI_DEVICE_ID_SI_6202 0x0002 -#define PCI_DEVICE_ID_SI_503 0x0008 -#define PCI_DEVICE_ID_SI_ACPI 0x0009 -#define PCI_DEVICE_ID_SI_5597_VGA 0x0200 -#define PCI_DEVICE_ID_SI_6205 0x0205 -#define PCI_DEVICE_ID_SI_501 0x0406 -#define PCI_DEVICE_ID_SI_496 0x0496 -#define PCI_DEVICE_ID_SI_300 0x0300 -#define PCI_DEVICE_ID_SI_315H 0x0310 -#define PCI_DEVICE_ID_SI_315 0x0315 -#define PCI_DEVICE_ID_SI_315PRO 0x0325 -#define PCI_DEVICE_ID_SI_530 0x0530 -#define PCI_DEVICE_ID_SI_540 0x0540 -#define PCI_DEVICE_ID_SI_550 0x0550 -#define PCI_DEVICE_ID_SI_601 0x0601 -#define PCI_DEVICE_ID_SI_620 0x0620 -#define PCI_DEVICE_ID_SI_630 0x0630 -#define PCI_DEVICE_ID_SI_635 0x0635 -#define PCI_DEVICE_ID_SI_640 0x0640 -#define PCI_DEVICE_ID_SI_645 0x0645 -#define PCI_DEVICE_ID_SI_650 0x0650 -#define PCI_DEVICE_ID_SI_730 0x0730 -#define PCI_DEVICE_ID_SI_735 0x0735 -#define PCI_DEVICE_ID_SI_740 0x0740 -#define PCI_DEVICE_ID_SI_745 0x0745 -#define PCI_DEVICE_ID_SI_750 0x0750 -#define PCI_DEVICE_ID_SI_900 0x0900 -#define PCI_DEVICE_ID_SIS900 0x0900 -#define PCI_DEVICE_ID_SI_5107 0x5107 -#define PCI_DEVICE_ID_SI_5300 0x5300 -#define PCI_DEVICE_ID_SI_540_VGA 0x5300 -#define PCI_DEVICE_ID_SI_550_VGA 0x5315 -#define PCI_DEVICE_ID_SI_5511 0x5511 -#define PCI_DEVICE_ID_SI_5513 0x5513 -#define PCI_DEVICE_ID_SI_5571 0x5571 -#define PCI_DEVICE_ID_SI_5591 0x5591 -#define PCI_DEVICE_ID_SI_5597 0x5597 -#define PCI_DEVICE_ID_SI_5598 0x5598 -#define PCI_DEVICE_ID_SI_5600 0x5600 -#define PCI_DEVICE_ID_SI_6300 0x6300 -#define PCI_DEVICE_ID_SI_630_VGA 0x6300 -#define PCI_DEVICE_ID_SI_6306 0x6306 -#define PCI_DEVICE_ID_SI_6326 0x6326 -#define PCI_DEVICE_ID_SI_7001 0x7001 -#define PCI_DEVICE_ID_SI_7016 0x7016 -#define PCI_DEVICE_ID_SIS7016 0x7016 -#define PCI_DEVICE_ID_SI_730_VGA 0x7300 - -#define PCI_VENDOR_ID_HP 0x103c -#define PCI_DEVICE_ID_HP_DONNER_GFX 0x1008 -#define PCI_DEVICE_ID_HP_TACHYON 0x1028 -#define PCI_DEVICE_ID_HP_TACHLITE 0x1029 -#define PCI_DEVICE_ID_HP_J2585A 0x1030 -#define PCI_DEVICE_ID_HP_J2585B 0x1031 -#define PCI_DEVICE_ID_HP_SAS 0x1048 -#define PCI_DEVICE_ID_HP_DIVA1 0x1049 -#define PCI_DEVICE_ID_HP_DIVA2 0x104A -#define PCI_DEVICE_ID_HP_SP2_0 0x104B - -#define PCI_VENDOR_ID_PCTECH 0x1042 -#define PCI_DEVICE_ID_PCTECH_RZ1000 0x1000 -#define PCI_DEVICE_ID_PCTECH_RZ1001 0x1001 -#define PCI_DEVICE_ID_PCTECH_SAMURAI_0 0x3000 -#define PCI_DEVICE_ID_PCTECH_SAMURAI_1 0x3010 -#define PCI_DEVICE_ID_PCTECH_SAMURAI_IDE 0x3020 - -#define PCI_VENDOR_ID_ASUSTEK 0x1043 -#define PCI_DEVICE_ID_ASUSTEK_0675 0x0675 - -#define PCI_VENDOR_ID_DPT 0x1044 -#define PCI_DEVICE_ID_DPT 0xa400 - -#define PCI_VENDOR_ID_OPTI 0x1045 -#define PCI_DEVICE_ID_OPTI_92C178 0xc178 -#define PCI_DEVICE_ID_OPTI_82C557 0xc557 -#define PCI_DEVICE_ID_OPTI_82C558 0xc558 -#define PCI_DEVICE_ID_OPTI_82C621 0xc621 -#define PCI_DEVICE_ID_OPTI_82C700 0xc700 -#define PCI_DEVICE_ID_OPTI_82C701 0xc701 -#define PCI_DEVICE_ID_OPTI_82C814 0xc814 -#define PCI_DEVICE_ID_OPTI_82C822 0xc822 -#define PCI_DEVICE_ID_OPTI_82C861 0xc861 -#define PCI_DEVICE_ID_OPTI_82C825 0xd568 - -#define PCI_VENDOR_ID_ELSA 0x1048 -#define PCI_DEVICE_ID_ELSA_MICROLINK 0x1000 -#define PCI_DEVICE_ID_ELSA_QS3000 0x3000 - -#define PCI_VENDOR_ID_ELSA 0x1048 -#define PCI_DEVICE_ID_ELSA_MICROLINK 0x1000 -#define PCI_DEVICE_ID_ELSA_QS3000 0x3000 - -#define PCI_VENDOR_ID_SGS 0x104a -#define PCI_DEVICE_ID_SGS_2000 0x0008 -#define PCI_DEVICE_ID_SGS_1764 0x0009 - -#define PCI_VENDOR_ID_BUSLOGIC 0x104B -#define PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER_NC 0x0140 -#define PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER 0x1040 -#define PCI_DEVICE_ID_BUSLOGIC_FLASHPOINT 0x8130 - -#define PCI_VENDOR_ID_TI 0x104c -#define PCI_DEVICE_ID_TI_TVP4010 0x3d04 -#define PCI_DEVICE_ID_TI_TVP4020 0x3d07 -#define PCI_DEVICE_ID_TI_1130 0xac12 -#define PCI_DEVICE_ID_TI_1031 0xac13 -#define PCI_DEVICE_ID_TI_1131 0xac15 -#define PCI_DEVICE_ID_TI_1250 0xac16 -#define PCI_DEVICE_ID_TI_1220 0xac17 -#define PCI_DEVICE_ID_TI_1221 0xac19 -#define PCI_DEVICE_ID_TI_1210 0xac1a -#define PCI_DEVICE_ID_TI_1410 0xac50 -#define PCI_DEVICE_ID_TI_1450 0xac1b -#define PCI_DEVICE_ID_TI_1225 0xac1c -#define PCI_DEVICE_ID_TI_1251A 0xac1d -#define PCI_DEVICE_ID_TI_1211 0xac1e -#define PCI_DEVICE_ID_TI_1251B 0xac1f -#define PCI_DEVICE_ID_TI_4410 0xac41 -#define PCI_DEVICE_ID_TI_4451 0xac42 -#define PCI_DEVICE_ID_TI_1420 0xac51 - -#define PCI_VENDOR_ID_SONY 0x104d -#define PCI_DEVICE_ID_SONY_CXD3222 0x8039 - -#define PCI_VENDOR_ID_OAK 0x104e -#define PCI_DEVICE_ID_OAK_OTI107 0x0107 - -/* Winbond have two vendor IDs! See 0x10ad as well */ -#define PCI_VENDOR_ID_WINBOND2 0x1050 -#define PCI_DEVICE_ID_WINBOND2_89C840 0x0840 -#define PCI_DEVICE_ID_WINBOND2_89C940 0x0940 -#define PCI_DEVICE_ID_WINBOND2_89C940F 0x5a5a -#define PCI_DEVICE_ID_WINBOND2_6692 0x6692 - -#define PCI_VENDOR_ID_ANIGMA 0x1051 -#define PCI_DEVICE_ID_ANIGMA_MC145575 0x0100 - -#define PCI_VENDOR_ID_EFAR 0x1055 -#define PCI_DEVICE_ID_EFAR_SLC90E66_1 0x9130 -#define PCI_DEVICE_ID_EFAR_SLC90E66_0 0x9460 -#define PCI_DEVICE_ID_EFAR_SLC90E66_2 0x9462 -#define PCI_DEVICE_ID_EFAR_SLC90E66_3 0x9463 - -#define PCI_VENDOR_ID_MOTOROLA 0x1057 -#define PCI_VENDOR_ID_MOTOROLA_OOPS 0x1507 -#define PCI_DEVICE_ID_MOTOROLA_MPC105 0x0001 -#define PCI_DEVICE_ID_MOTOROLA_MPC106 0x0002 -#define PCI_DEVICE_ID_MOTOROLA_RAVEN 0x4801 -#define PCI_DEVICE_ID_MOTOROLA_FALCON 0x4802 -#define PCI_DEVICE_ID_MOTOROLA_CPX8216 0x4806 - -#define PCI_VENDOR_ID_PROMISE 0x105a -#define PCI_DEVICE_ID_PROMISE_20265 0x0d30 -#define PCI_DEVICE_ID_PROMISE_20267 0x4d30 -#define PCI_DEVICE_ID_PROMISE_20246 0x4d33 -#define PCI_DEVICE_ID_PROMISE_20262 0x4d38 -#define PCI_DEVICE_ID_PROMISE_20268 0x4d68 -#define PCI_DEVICE_ID_PROMISE_20268R 0x6268 -#define PCI_DEVICE_ID_PROMISE_20269 0x4d69 -#define PCI_DEVICE_ID_PROMISE_20275 0x1275 -#define PCI_DEVICE_ID_PROMISE_5300 0x5300 - -#define PCI_VENDOR_ID_N9 0x105d -#define PCI_DEVICE_ID_N9_I128 0x2309 -#define PCI_DEVICE_ID_N9_I128_2 0x2339 -#define PCI_DEVICE_ID_N9_I128_T2R 0x493d - -#define PCI_VENDOR_ID_UMC 0x1060 -#define PCI_DEVICE_ID_UMC_UM8673F 0x0101 -#define PCI_DEVICE_ID_UMC_UM8891A 0x0891 -#define PCI_DEVICE_ID_UMC_UM8886BF 0x673a -#define PCI_DEVICE_ID_UMC_UM8886A 0x886a -#define PCI_DEVICE_ID_UMC_UM8881F 0x8881 -#define PCI_DEVICE_ID_UMC_UM8886F 0x8886 -#define PCI_DEVICE_ID_UMC_UM9017F 0x9017 -#define PCI_DEVICE_ID_UMC_UM8886N 0xe886 -#define PCI_DEVICE_ID_UMC_UM8891N 0xe891 - -#define PCI_VENDOR_ID_X 0x1061 -#define PCI_DEVICE_ID_X_AGX016 0x0001 - -#define PCI_VENDOR_ID_MYLEX 0x1069 -#define PCI_DEVICE_ID_MYLEX_DAC960_P 0x0001 -#define PCI_DEVICE_ID_MYLEX_DAC960_PD 0x0002 -#define PCI_DEVICE_ID_MYLEX_DAC960_PG 0x0010 -#define PCI_DEVICE_ID_MYLEX_DAC960_LA 0x0020 -#define PCI_DEVICE_ID_MYLEX_DAC960_LP 0x0050 -#define PCI_DEVICE_ID_MYLEX_DAC960_BA 0xBA56 - -#define PCI_VENDOR_ID_PICOP 0x1066 -#define PCI_DEVICE_ID_PICOP_PT86C52X 0x0001 -#define PCI_DEVICE_ID_PICOP_PT80C524 0x8002 - -#define PCI_VENDOR_ID_APPLE 0x106b -#define PCI_DEVICE_ID_APPLE_BANDIT 0x0001 -#define PCI_DEVICE_ID_APPLE_GC 0x0002 -#define PCI_DEVICE_ID_APPLE_HYDRA 0x000e -#define PCI_DEVICE_ID_APPLE_UNI_N_FW 0x0018 -#define PCI_DEVICE_ID_APPLE_KL_USB 0x0019 -#define PCI_DEVICE_ID_APPLE_UNI_N_AGP 0x0020 -#define PCI_DEVICE_ID_APPLE_UNI_N_GMAC 0x0021 -#define PCI_DEVICE_ID_APPLE_UNI_N_FW2 0x0030 - -#define PCI_VENDOR_ID_YAMAHA 0x1073 -#define PCI_DEVICE_ID_YAMAHA_724 0x0004 -#define PCI_DEVICE_ID_YAMAHA_724F 0x000d -#define PCI_DEVICE_ID_YAMAHA_740 0x000a -#define PCI_DEVICE_ID_YAMAHA_740C 0x000c -#define PCI_DEVICE_ID_YAMAHA_744 0x0010 -#define PCI_DEVICE_ID_YAMAHA_754 0x0012 - -#define PCI_VENDOR_ID_NEXGEN 0x1074 -#define PCI_DEVICE_ID_NEXGEN_82C501 0x4e78 - -#define PCI_VENDOR_ID_QLOGIC 0x1077 -#define PCI_DEVICE_ID_QLOGIC_ISP1020 0x1020 -#define PCI_DEVICE_ID_QLOGIC_ISP1022 0x1022 -#define PCI_DEVICE_ID_QLOGIC_ISP2100 0x2100 -#define PCI_DEVICE_ID_QLOGIC_ISP2200 0x2200 - -#define PCI_VENDOR_ID_CYRIX 0x1078 -#define PCI_DEVICE_ID_CYRIX_5510 0x0000 -#define PCI_DEVICE_ID_CYRIX_PCI_MASTER 0x0001 -#define PCI_DEVICE_ID_CYRIX_5520 0x0002 -#define PCI_DEVICE_ID_CYRIX_5530_LEGACY 0x0100 -#define PCI_DEVICE_ID_CYRIX_5530_SMI 0x0101 -#define PCI_DEVICE_ID_CYRIX_5530_IDE 0x0102 -#define PCI_DEVICE_ID_CYRIX_5530_AUDIO 0x0103 -#define PCI_DEVICE_ID_CYRIX_5530_VIDEO 0x0104 - -#define PCI_VENDOR_ID_LEADTEK 0x107d -#define PCI_DEVICE_ID_LEADTEK_805 0x0000 - -#define PCI_VENDOR_ID_INTERPHASE 0x107e -#define PCI_DEVICE_ID_INTERPHASE_5526 0x0004 -#define PCI_DEVICE_ID_INTERPHASE_55x6 0x0005 -#define PCI_DEVICE_ID_INTERPHASE_5575 0x0008 - -#define PCI_VENDOR_ID_CONTAQ 0x1080 -#define PCI_DEVICE_ID_CONTAQ_82C599 0x0600 -#define PCI_DEVICE_ID_CONTAQ_82C693 0xc693 - -#define PCI_VENDOR_ID_FOREX 0x1083 - -#define PCI_VENDOR_ID_OLICOM 0x108d -#define PCI_DEVICE_ID_OLICOM_OC3136 0x0001 -#define PCI_DEVICE_ID_OLICOM_OC2315 0x0011 -#define PCI_DEVICE_ID_OLICOM_OC2325 0x0012 -#define PCI_DEVICE_ID_OLICOM_OC2183 0x0013 -#define PCI_DEVICE_ID_OLICOM_OC2326 0x0014 -#define PCI_DEVICE_ID_OLICOM_OC6151 0x0021 - -#define PCI_VENDOR_ID_SUN 0x108e -#define PCI_DEVICE_ID_SUN_EBUS 0x1000 -#define PCI_DEVICE_ID_SUN_HAPPYMEAL 0x1001 -#define PCI_DEVICE_ID_SUN_RIO_EBUS 0x1100 -#define PCI_DEVICE_ID_SUN_RIO_GEM 0x1101 -#define PCI_DEVICE_ID_SUN_RIO_1394 0x1102 -#define PCI_DEVICE_ID_SUN_RIO_USB 0x1103 -#define PCI_DEVICE_ID_SUN_GEM 0x2bad -#define PCI_DEVICE_ID_SUN_SIMBA 0x5000 -#define PCI_DEVICE_ID_SUN_PBM 0x8000 -#define PCI_DEVICE_ID_SUN_SCHIZO 0x8001 -#define PCI_DEVICE_ID_SUN_SABRE 0xa000 -#define PCI_DEVICE_ID_SUN_HUMMINGBIRD 0xa001 - -#define PCI_VENDOR_ID_CMD 0x1095 -#define PCI_DEVICE_ID_CMD_640 0x0640 -#define PCI_DEVICE_ID_CMD_643 0x0643 -#define PCI_DEVICE_ID_CMD_646 0x0646 -#define PCI_DEVICE_ID_CMD_647 0x0647 -#define PCI_DEVICE_ID_CMD_648 0x0648 -#define PCI_DEVICE_ID_CMD_649 0x0649 -#define PCI_DEVICE_ID_CMD_670 0x0670 -#define PCI_DEVICE_ID_CMD_680 0x0680 - -#define PCI_VENDOR_ID_VISION 0x1098 -#define PCI_DEVICE_ID_VISION_QD8500 0x0001 -#define PCI_DEVICE_ID_VISION_QD8580 0x0002 - -#define PCI_VENDOR_ID_BROOKTREE 0x109e -#define PCI_DEVICE_ID_BROOKTREE_848 0x0350 -#define PCI_DEVICE_ID_BROOKTREE_849A 0x0351 -#define PCI_DEVICE_ID_BROOKTREE_878_1 0x036e -#define PCI_DEVICE_ID_BROOKTREE_878 0x0878 -#define PCI_DEVICE_ID_BROOKTREE_8474 0x8474 - -#define PCI_VENDOR_ID_SIERRA 0x10a8 -#define PCI_DEVICE_ID_SIERRA_STB 0x0000 - -#define PCI_VENDOR_ID_SGI 0x10a9 -#define PCI_DEVICE_ID_SGI_IOC3 0x0003 - -#define PCI_VENDOR_ID_ACC 0x10aa -#define PCI_DEVICE_ID_ACC_2056 0x0000 - -#define PCI_VENDOR_ID_WINBOND 0x10ad -#define PCI_DEVICE_ID_WINBOND_83769 0x0001 -#define PCI_DEVICE_ID_WINBOND_82C105 0x0105 -#define PCI_DEVICE_ID_WINBOND_83C553 0x0565 - -#define PCI_VENDOR_ID_DATABOOK 0x10b3 -#define PCI_DEVICE_ID_DATABOOK_87144 0xb106 - -#define PCI_VENDOR_ID_PLX 0x10b5 -#define PCI_DEVICE_ID_PLX_R685 0x1030 -#define PCI_DEVICE_ID_PLX_ROMULUS 0x106a -#define PCI_DEVICE_ID_PLX_SPCOM800 0x1076 -#define PCI_DEVICE_ID_PLX_1077 0x1077 -#define PCI_DEVICE_ID_PLX_SPCOM200 0x1103 -#define PCI_DEVICE_ID_PLX_DJINN_ITOO 0x1151 -#define PCI_DEVICE_ID_PLX_R753 0x1152 -#define PCI_DEVICE_ID_PLX_9050 0x9050 -#define PCI_DEVICE_ID_PLX_9060 0x9060 -#define PCI_DEVICE_ID_PLX_9060ES 0x906E -#define PCI_DEVICE_ID_PLX_9060SD 0x906D -#define PCI_DEVICE_ID_PLX_9080 0x9080 -#define PCI_DEVICE_ID_PLX_GTEK_SERIAL2 0xa001 - -#define PCI_VENDOR_ID_MADGE 0x10b6 -#define PCI_DEVICE_ID_MADGE_MK2 0x0002 -#define PCI_DEVICE_ID_MADGE_C155S 0x1001 - -#define PCI_VENDOR_ID_3COM 0x10b7 -#define PCI_DEVICE_ID_3COM_3C985 0x0001 -#define PCI_DEVICE_ID_3COM_3C339 0x3390 -#define PCI_DEVICE_ID_3COM_3C590 0x5900 -#define PCI_DEVICE_ID_3COM_3C595 0x5950 -#define PCI_DEVICE_ID_3COM_3C595TX 0x5950 -#define PCI_DEVICE_ID_3COM_3C595_1 0x5951 -#define PCI_DEVICE_ID_3COM_3C595T4 0x5951 -#define PCI_DEVICE_ID_3COM_3C595_2 0x5952 -#define PCI_DEVICE_ID_3COM_3C595MII 0x5952 -#define PCI_DEVICE_ID_3COM_3C900TPO 0x9000 -#define PCI_DEVICE_ID_3COM_3C900COMBO 0x9001 -#define PCI_DEVICE_ID_3COM_3C905TX 0x9050 -#define PCI_DEVICE_ID_3COM_3C905T4 0x9051 -#define PCI_DEVICE_ID_3COM_3C905B_TX 0x9055 -#define PCI_DEVICE_ID_3COM_3C905C_TXM 0x9200 - -#define PCI_VENDOR_ID_SMC 0x10b8 -#define PCI_DEVICE_ID_SMC_EPIC100 0x0005 - -#define PCI_VENDOR_ID_SUNDANCE 0x13F0 -#define PCI_DEVICE_ID_SUNDANCE_ALTA 0x0201 - -#define PCI_VENDOR_ID_AL 0x10b9 -#define PCI_DEVICE_ID_AL_M1445 0x1445 -#define PCI_DEVICE_ID_AL_M1449 0x1449 -#define PCI_DEVICE_ID_AL_M1451 0x1451 -#define PCI_DEVICE_ID_AL_M1461 0x1461 -#define PCI_DEVICE_ID_AL_M1489 0x1489 -#define PCI_DEVICE_ID_AL_M1511 0x1511 -#define PCI_DEVICE_ID_AL_M1513 0x1513 -#define PCI_DEVICE_ID_AL_M1521 0x1521 -#define PCI_DEVICE_ID_AL_M1523 0x1523 -#define PCI_DEVICE_ID_AL_M1531 0x1531 -#define PCI_DEVICE_ID_AL_M1533 0x1533 -#define PCI_DEVICE_ID_AL_M1541 0x1541 -#define PCI_DEVICE_ID_AL_M1621 0x1621 -#define PCI_DEVICE_ID_AL_M1631 0x1631 -#define PCI_DEVICE_ID_AL_M1641 0x1641 -#define PCI_DEVICE_ID_AL_M1647 0x1647 -#define PCI_DEVICE_ID_AL_M1651 0x1651 -#define PCI_DEVICE_ID_AL_M1543 0x1543 -#define PCI_DEVICE_ID_AL_M3307 0x3307 -#define PCI_DEVICE_ID_AL_M4803 0x5215 -#define PCI_DEVICE_ID_AL_M5219 0x5219 -#define PCI_DEVICE_ID_AL_M5229 0x5229 -#define PCI_DEVICE_ID_AL_M5237 0x5237 -#define PCI_DEVICE_ID_AL_M5243 0x5243 -#define PCI_DEVICE_ID_AL_M5451 0x5451 -#define PCI_DEVICE_ID_AL_M7101 0x7101 - -#define PCI_VENDOR_ID_MITSUBISHI 0x10ba - -#define PCI_VENDOR_ID_SURECOM 0x10bd -#define PCI_DEVICE_ID_SURECOM_NE34 0x0e34 - -#define PCI_VENDOR_ID_NEOMAGIC 0x10c8 -#define PCI_DEVICE_ID_NEOMAGIC_MAGICGRAPH_NM2070 0x0001 -#define PCI_DEVICE_ID_NEOMAGIC_MAGICGRAPH_128V 0x0002 -#define PCI_DEVICE_ID_NEOMAGIC_MAGICGRAPH_128ZV 0x0003 -#define PCI_DEVICE_ID_NEOMAGIC_MAGICGRAPH_NM2160 0x0004 -#define PCI_DEVICE_ID_NEOMAGIC_MAGICMEDIA_256AV 0x0005 -#define PCI_DEVICE_ID_NEOMAGIC_MAGICGRAPH_128ZVPLUS 0x0083 - -#define PCI_VENDOR_ID_ASP 0x10cd -#define PCI_DEVICE_ID_ASP_ABP940 0x1200 -#define PCI_DEVICE_ID_ASP_ABP940U 0x1300 -#define PCI_DEVICE_ID_ASP_ABP940UW 0x2300 - -#define PCI_VENDOR_ID_MACRONIX 0x10d9 -#define PCI_DEVICE_ID_MACRONIX_MX98713 0x0512 -#define PCI_DEVICE_ID_MX987x3 0x0512 -#define PCI_DEVICE_ID_MACRONIX_MX987x5 0x0531 -#define PCI_DEVICE_ID_MX987x5 0x0531 - -#define PCI_VENDOR_ID_TCONRAD 0x10da -#define PCI_DEVICE_ID_TCONRAD_TOKENRING 0x0508 - -#define PCI_VENDOR_ID_CERN 0x10dc -#define PCI_DEVICE_ID_CERN_SPSB_PMC 0x0001 -#define PCI_DEVICE_ID_CERN_SPSB_PCI 0x0002 -#define PCI_DEVICE_ID_CERN_HIPPI_DST 0x0021 -#define PCI_DEVICE_ID_CERN_HIPPI_SRC 0x0022 - -#define PCI_VENDOR_ID_NVIDIA 0x10de -#define PCI_DEVICE_ID_NVIDIA_TNT 0x0020 -#define PCI_DEVICE_ID_NVIDIA_TNT2 0x0028 -#define PCI_DEVICE_ID_NVIDIA_UTNT2 0x0029 -#define PCI_DEVICE_ID_NVIDIA_VTNT2 0x002C -#define PCI_DEVICE_ID_NVIDIA_UVTNT2 0x002D -#define PCI_DEVICE_ID_NVIDIA_ITNT2 0x00A0 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE_SDR 0x0100 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE_DDR 0x0101 -#define PCI_DEVICE_ID_NVIDIA_QUADRO 0x0103 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE2_MX 0x0110 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE2_MX2 0x0111 -#define PCI_DEVICE_ID_NVIDIA_QUADRO2_MXR 0x0113 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE2_GTS 0x0150 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE2_GTS2 0x0151 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE2_ULTRA 0x0152 -#define PCI_DEVICE_ID_NVIDIA_QUADRO2_PRO 0x0153 - -#define PCI_VENDOR_ID_IMS 0x10e0 -#define PCI_DEVICE_ID_IMS_8849 0x8849 -#define PCI_DEVICE_ID_IMS_TT128 0x9128 -#define PCI_DEVICE_ID_IMS_TT3D 0x9135 - -#define PCI_VENDOR_ID_TEKRAM2 0x10e1 -#define PCI_DEVICE_ID_TEKRAM2_690c 0x690c - -#define PCI_VENDOR_ID_TUNDRA 0x10e3 -#define PCI_DEVICE_ID_TUNDRA_CA91C042 0x0000 - -#define PCI_VENDOR_ID_AMCC 0x10e8 -#define PCI_DEVICE_ID_AMCC_MYRINET 0x8043 -#define PCI_DEVICE_ID_AMCC_PARASTATION 0x8062 -#define PCI_DEVICE_ID_AMCC_S5933 0x807d -#define PCI_DEVICE_ID_AMCC_S5933_HEPC3 0x809c - -#define PCI_VENDOR_ID_INTERG 0x10ea -#define PCI_DEVICE_ID_INTERG_1680 0x1680 -#define PCI_DEVICE_ID_INTERG_1682 0x1682 -#define PCI_DEVICE_ID_INTERG_2000 0x2000 -#define PCI_DEVICE_ID_INTERG_2010 0x2010 -#define PCI_DEVICE_ID_INTERG_5000 0x5000 -#define PCI_DEVICE_ID_INTERG_5050 0x5050 - -#define PCI_VENDOR_ID_REALTEK 0x10ec -#define PCI_DEVICE_ID_REALTEK_8029 0x8029 -#define PCI_DEVICE_ID_REALTEK_8129 0x8129 -#define PCI_DEVICE_ID_REALTEK_8139 0x8139 - -#define PCI_VENDOR_ID_XILINX 0x10ee -#define PCI_DEVICE_ID_TURBOPAM 0x4020 - -#define PCI_VENDOR_ID_TRUEVISION 0x10fa -#define PCI_DEVICE_ID_TRUEVISION_T1000 0x000c - -#define PCI_VENDOR_ID_INIT 0x1101 -#define PCI_DEVICE_ID_INIT_320P 0x9100 -#define PCI_DEVICE_ID_INIT_360P 0x9500 - -#define PCI_VENDOR_ID_CREATIVE 0x1102 // duplicate: ECTIVA -#define PCI_DEVICE_ID_CREATIVE_EMU10K1 0x0002 - -#define PCI_VENDOR_ID_ECTIVA 0x1102 // duplicate: CREATIVE -#define PCI_DEVICE_ID_ECTIVA_EV1938 0x8938 - -#define PCI_VENDOR_ID_TTI 0x1103 -#define PCI_DEVICE_ID_TTI_HPT343 0x0003 -#define PCI_DEVICE_ID_TTI_HPT366 0x0004 - -#define PCI_VENDOR_ID_VIA 0x1106 -#define PCI_VENDOR_ID_VIATEC 0x1106 -#define PCI_DEVICE_ID_VIA_8363_0 0x0305 -#define PCI_DEVICE_ID_VIA_8371_0 0x0391 -#define PCI_DEVICE_ID_VIA_8501_0 0x0501 -#define PCI_DEVICE_ID_VIA_82C505 0x0505 -#define PCI_DEVICE_ID_VIA_82C561 0x0561 -#define PCI_DEVICE_ID_VIA_82C586_1 0x0571 -#define PCI_DEVICE_ID_VIA_82C576 0x0576 -#define PCI_DEVICE_ID_VIA_82C585 0x0585 -#define PCI_DEVICE_ID_VIA_82C586_0 0x0586 -#define PCI_DEVICE_ID_VIA_82C595 0x0595 -#define PCI_DEVICE_ID_VIA_82C596 0x0596 -#define PCI_DEVICE_ID_VIA_82C597_0 0x0597 -#define PCI_DEVICE_ID_VIA_82C598_0 0x0598 -#define PCI_DEVICE_ID_VIA_8601_0 0x0601 -#define PCI_DEVICE_ID_VIA_8605_0 0x0605 -#define PCI_DEVICE_ID_VIA_82C680 0x0680 -#define PCI_DEVICE_ID_VIA_82C686 0x0686 -#define PCI_DEVICE_ID_VIA_82C691 0x0691 -#define PCI_DEVICE_ID_VIA_82C693 0x0693 -#define PCI_DEVICE_ID_VIA_82C693_1 0x0698 -#define PCI_DEVICE_ID_VIA_82C926 0x0926 -#define PCI_DEVICE_ID_VIA_82C576_1 0x1571 -#define PCI_DEVICE_ID_VIA_82C595_97 0x1595 -#define PCI_DEVICE_ID_VIA_82C586_2 0x3038 -#define PCI_DEVICE_ID_VIA_82C586_3 0x3040 -#define PCI_DEVICE_ID_VIA_RHINE_I 0x3043 -#define PCI_DEVICE_ID_VIA_6305 0x3044 -#define PCI_DEVICE_ID_VIA_82C596_3 0x3050 -#define PCI_DEVICE_ID_VIA_82C596B_3 0x3051 -#define PCI_DEVICE_ID_VIA_82C686_4 0x3057 -#define PCI_DEVICE_ID_VIA_82C686_5 0x3058 -#define PCI_DEVICE_ID_VIA_8233_5 0x3059 -#define PCI_DEVICE_ID_VIA_8233_7 0x3065 -#define PCI_DEVICE_ID_VIA_VT6102 0x3065 -#define PCI_DEVICE_ID_VIA_82C686_6 0x3068 -#define PCI_DEVICE_ID_VIA_8233_0 0x3074 -#define PCI_DEVICE_ID_VIA_VT6105 0x3106 -#define PCI_DEVICE_ID_VIA_8233C_0 0x3109 -#define PCI_DEVICE_ID_VIA_8633_0 0x3091 -#define PCI_DEVICE_ID_VIA_8367_0 0x3099 -#define PCI_DEVICE_ID_VIA_86C100A 0x6100 -#define PCI_DEVICE_ID_VIA_8231 0x8231 -#define PCI_DEVICE_ID_VIA_8231_4 0x8235 -#define PCI_DEVICE_ID_VIA_8365_1 0x8305 -#define PCI_DEVICE_ID_VIA_8371_1 0x8391 -#define PCI_DEVICE_ID_VIA_8501_1 0x8501 -#define PCI_DEVICE_ID_VIA_82C597_1 0x8597 -#define PCI_DEVICE_ID_VIA_82C598_1 0x8598 -#define PCI_DEVICE_ID_VIA_8601_1 0x8601 -#define PCI_DEVICE_ID_VIA_8505_1 0X8605 -#define PCI_DEVICE_ID_VIA_8633_1 0xB091 -#define PCI_DEVICE_ID_VIA_8367_1 0xB099 - -#define PCI_VENDOR_ID_SIEMENS 0x110A -#define PCI_DEVICE_ID_SIEMENS_DSCC4 0x2102 - -#define PCI_VENDOR_ID_SMC2 0x1113 -#define PCI_DEVICE_ID_SMC2_1211TX 0x1211 -#define PCI_DEVICE_ID_SMC2_1211 0x1211 -#define PCI_DEVICE_ID_SMC2_1216 0x1216 - -#define PCI_VENDOR_ID_VORTEX 0x1119 -#define PCI_DEVICE_ID_VORTEX_GDT60x0 0x0000 -#define PCI_DEVICE_ID_VORTEX_GDT6000B 0x0001 -#define PCI_DEVICE_ID_VORTEX_GDT6x10 0x0002 -#define PCI_DEVICE_ID_VORTEX_GDT6x20 0x0003 -#define PCI_DEVICE_ID_VORTEX_GDT6530 0x0004 -#define PCI_DEVICE_ID_VORTEX_GDT6550 0x0005 -#define PCI_DEVICE_ID_VORTEX_GDT6x17 0x0006 -#define PCI_DEVICE_ID_VORTEX_GDT6x27 0x0007 -#define PCI_DEVICE_ID_VORTEX_GDT6537 0x0008 -#define PCI_DEVICE_ID_VORTEX_GDT6557 0x0009 -#define PCI_DEVICE_ID_VORTEX_GDT6x15 0x000a -#define PCI_DEVICE_ID_VORTEX_GDT6x25 0x000b -#define PCI_DEVICE_ID_VORTEX_GDT6535 0x000c -#define PCI_DEVICE_ID_VORTEX_GDT6555 0x000d -#define PCI_DEVICE_ID_VORTEX_GDT6x17RP 0x0100 -#define PCI_DEVICE_ID_VORTEX_GDT6x27RP 0x0101 -#define PCI_DEVICE_ID_VORTEX_GDT6537RP 0x0102 -#define PCI_DEVICE_ID_VORTEX_GDT6557RP 0x0103 -#define PCI_DEVICE_ID_VORTEX_GDT6x11RP 0x0104 -#define PCI_DEVICE_ID_VORTEX_GDT6x21RP 0x0105 -#define PCI_DEVICE_ID_VORTEX_GDT6x17RP1 0x0110 -#define PCI_DEVICE_ID_VORTEX_GDT6x27RP1 0x0111 -#define PCI_DEVICE_ID_VORTEX_GDT6537RP1 0x0112 -#define PCI_DEVICE_ID_VORTEX_GDT6557RP1 0x0113 -#define PCI_DEVICE_ID_VORTEX_GDT6x11RP1 0x0114 -#define PCI_DEVICE_ID_VORTEX_GDT6x21RP1 0x0115 -#define PCI_DEVICE_ID_VORTEX_GDT6x17RP2 0x0120 -#define PCI_DEVICE_ID_VORTEX_GDT6x27RP2 0x0121 -#define PCI_DEVICE_ID_VORTEX_GDT6537RP2 0x0122 -#define PCI_DEVICE_ID_VORTEX_GDT6557RP2 0x0123 -#define PCI_DEVICE_ID_VORTEX_GDT6x11RP2 0x0124 -#define PCI_DEVICE_ID_VORTEX_GDT6x21RP2 0x0125 - -#define PCI_VENDOR_ID_EF 0x111a -#define PCI_DEVICE_ID_EF_ATM_FPGA 0x0000 -#define PCI_DEVICE_ID_EF_ATM_ASIC 0x0002 - -#define PCI_VENDOR_ID_IDT 0x111d -#define PCI_DEVICE_ID_IDT_IDT77201 0x0001 - -#define PCI_VENDOR_ID_FORE 0x1127 -#define PCI_DEVICE_ID_FORE_PCA200PC 0x0210 -#define PCI_DEVICE_ID_FORE_PCA200E 0x0300 - -#define PCI_VENDOR_ID_IMAGINGTECH 0x112f -#define PCI_DEVICE_ID_IMAGINGTECH_ICPCI 0x0000 - -#define PCI_VENDOR_ID_PHILIPS 0x1131 -#define PCI_DEVICE_ID_PHILIPS_SAA7145 0x7145 -#define PCI_DEVICE_ID_PHILIPS_SAA7146 0x7146 -#define PCI_DEVICE_ID_PHILIPS_SAA9730 0x9730 - -#define PCI_VENDOR_ID_EICON 0x1133 -#define PCI_DEVICE_ID_EICON_DIVA20PRO 0xe001 -#define PCI_DEVICE_ID_EICON_DIVA20 0xe002 -#define PCI_DEVICE_ID_EICON_DIVA20PRO_U 0xe003 -#define PCI_DEVICE_ID_EICON_DIVA20_U 0xe004 -#define PCI_DEVICE_ID_EICON_DIVA201 0xe005 -#define PCI_DEVICE_ID_EICON_MAESTRA 0xe010 -#define PCI_DEVICE_ID_EICON_MAESTRAQ 0xe012 -#define PCI_DEVICE_ID_EICON_MAESTRAQ_U 0xe013 -#define PCI_DEVICE_ID_EICON_MAESTRAP 0xe014 - -#define PCI_VENDOR_ID_CYCLONE 0x113c -#define PCI_DEVICE_ID_CYCLONE_SDK 0x0001 - -#define PCI_VENDOR_ID_ALLIANCE 0x1142 -#define PCI_DEVICE_ID_ALLIANCE_PROMOTIO 0x3210 -#define PCI_DEVICE_ID_ALLIANCE_PROVIDEO 0x6422 -#define PCI_DEVICE_ID_ALLIANCE_AT24 0x6424 -#define PCI_DEVICE_ID_ALLIANCE_AT3D 0x643d - -#define PCI_VENDOR_ID_SYSKONNECT 0x1148 -#define PCI_DEVICE_ID_SYSKONNECT_FP 0x4000 -#define PCI_DEVICE_ID_SYSKONNECT_TR 0x4200 -#define PCI_DEVICE_ID_SYSKONNECT_GE 0x4300 - -#define PCI_VENDOR_ID_VMIC 0x114a -#define PCI_DEVICE_ID_VMIC_VME 0x7587 - -#define PCI_VENDOR_ID_DIGI 0x114f -#define PCI_DEVICE_ID_DIGI_EPC 0x0002 -#define PCI_DEVICE_ID_DIGI_RIGHTSWITCH 0x0003 -#define PCI_DEVICE_ID_DIGI_XEM 0x0004 -#define PCI_DEVICE_ID_DIGI_XR 0x0005 -#define PCI_DEVICE_ID_DIGI_CX 0x0006 -#define PCI_DEVICE_ID_DIGI_XRJ 0x0009 -#define PCI_DEVICE_ID_DIGI_EPCJ 0x000a -#define PCI_DEVICE_ID_DIGI_XR_920 0x0027 -#define PCI_DEVICE_ID_DIGI_DF_M_IOM2_E 0x0070 -#define PCI_DEVICE_ID_DIGI_DF_M_E 0x0071 -#define PCI_DEVICE_ID_DIGI_DF_M_IOM2_A 0x0072 -#define PCI_DEVICE_ID_DIGI_DF_M_A 0x0073 - -#define PCI_VENDOR_ID_MUTECH 0x1159 -#define PCI_DEVICE_ID_MUTECH_MV1000 0x0001 - -#define PCI_VENDOR_ID_XIRCOM 0x115d -#define PCI_DEVICE_ID_XIRCOM_X3201_ETH 0x0003 -#define PCI_DEVICE_ID_XIRCOM_X3201_MDM 0x0103 - -#define PCI_VENDOR_ID_RENDITION 0x1163 -#define PCI_DEVICE_ID_RENDITION_VERITE 0x0001 -#define PCI_DEVICE_ID_RENDITION_VERITE2100 0x2000 - -#define PCI_VENDOR_ID_SERVERWORKS 0x1166 -#define PCI_DEVICE_ID_SERVERWORKS_HE 0x0008 -#define PCI_DEVICE_ID_SERVERWORKS_LE 0x0009 -#define PCI_DEVICE_ID_SERVERWORKS_CIOB30 0x0010 -#define PCI_DEVICE_ID_SERVERWORKS_CMIC_HE 0x0011 -#define PCI_DEVICE_ID_SERVERWORKS_OSB4 0x0200 -#define PCI_DEVICE_ID_SERVERWORKS_CSB5 0x0201 -#define PCI_DEVICE_ID_SERVERWORKS_OSB4IDE 0x0211 -#define PCI_DEVICE_ID_SERVERWORKS_CSB5IDE 0x0212 -#define PCI_DEVICE_ID_SERVERWORKS_OSB4USB 0x0220 -#define PCI_DEVICE_ID_SERVERWORKS_CSB5USB PCI_DEVICE_ID_SERVERWORKS_OSB4USB -#define PCI_DEVICE_ID_SERVERWORKS_CSB5ISA 0x0230 - -#define PCI_VENDOR_ID_SBE 0x1176 -#define PCI_DEVICE_ID_SBE_WANXL100 0x0301 -#define PCI_DEVICE_ID_SBE_WANXL200 0x0302 -#define PCI_DEVICE_ID_SBE_WANXL400 0x0104 - -#define PCI_VENDOR_ID_TOSHIBA 0x1179 -#define PCI_DEVICE_ID_TOSHIBA_601 0x0601 -#define PCI_DEVICE_ID_TOSHIBA_TOPIC95 0x060a -#define PCI_DEVICE_ID_TOSHIBA_TOPIC97 0x060f - -#define PCI_VENDOR_ID_RICOH 0x1180 -#define PCI_DEVICE_ID_RICOH_RL5C465 0x0465 -#define PCI_DEVICE_ID_RICOH_RL5C466 0x0466 -#define PCI_DEVICE_ID_RICOH_RL5C475 0x0475 -#define PCI_DEVICE_ID_RICOH_RL5C476 0x0476 -#define PCI_DEVICE_ID_RICOH_RL5C478 0x0478 - -#define PCI_VENDOR_ID_DLINK 0x1186 -#define PCI_DEVICE_ID_DFE530TXP 0x1300 -#define PCI_DEVICE_ID_DFE530TXS 0x1002 - -#define PCI_VENDOR_ID_ARTOP 0x1191 -#define PCI_DEVICE_ID_ARTOP_ATP8400 0x0004 -#define PCI_DEVICE_ID_ARTOP_ATP850UF 0x0005 -#define PCI_DEVICE_ID_ARTOP_ATP860 0x0006 -#define PCI_DEVICE_ID_ARTOP_ATP860R 0x0007 -#define PCI_DEVICE_ID_ARTOP_AEC7610 0x8002 -#define PCI_DEVICE_ID_ARTOP_AEC7612UW 0x8010 -#define PCI_DEVICE_ID_ARTOP_AEC7612U 0x8020 -#define PCI_DEVICE_ID_ARTOP_AEC7612S 0x8030 -#define PCI_DEVICE_ID_ARTOP_AEC7612D 0x8040 -#define PCI_DEVICE_ID_ARTOP_AEC7612SUW 0x8050 -#define PCI_DEVICE_ID_ARTOP_8060 0x8060 - -#define PCI_VENDOR_ID_ZEITNET 0x1193 -#define PCI_DEVICE_ID_ZEITNET_1221 0x0001 -#define PCI_DEVICE_ID_ZEITNET_1225 0x0002 - -#define PCI_VENDOR_ID_OMEGA 0x119b -#define PCI_DEVICE_ID_OMEGA_82C092G 0x1221 - -#define PCI_VENDOR_ID_FUJITSU_ME 0x119e -#define PCI_DEVICE_ID_FUJITSU_FS155 0x0001 -#define PCI_DEVICE_ID_FUJITSU_FS50 0x0003 - -#define PCI_SUBVENDOR_ID_KEYSPAN 0x11a9 -#define PCI_SUBDEVICE_ID_KEYSPAN_SX2 0x5334 - -#define PCI_VENDOR_ID_GALILEO 0x11ab -#define PCI_DEVICE_ID_GALILEO_GT64011 0x4146 -#define PCI_DEVICE_ID_GALILEO_GT64111 0x4146 -#define PCI_DEVICE_ID_GALILEO_GT96100 0x9652 -#define PCI_DEVICE_ID_GALILEO_GT96100A 0x9653 - -#define PCI_VENDOR_ID_LINKSYS 0x11ad -#define PCI_VENDOR_ID_LITEON 0x11ad -#define PCI_DEVICE_ID_LITEON_LNE100TX 0x0002 -#define PCI_DEVICE_ID_LC82C115 0xC115 - -#define PCI_VENDOR_ID_V3 0x11b0 -#define PCI_DEVICE_ID_V3_V960 0x0001 -#define PCI_DEVICE_ID_V3_V350 0x0001 -#define PCI_DEVICE_ID_V3_V961 0x0002 -#define PCI_DEVICE_ID_V3_V351 0x0002 - -#define PCI_VENDOR_ID_NP 0x11bc -#define PCI_DEVICE_ID_NP_PCI_FDDI 0x0001 - -#define PCI_VENDOR_ID_ATT 0x11c1 -#define PCI_DEVICE_ID_ATT_L56XMF 0x0440 -#define PCI_DEVICE_ID_ATT_VENUS_MODEM 0x480 - -#define PCI_VENDOR_ID_SPECIALIX 0x11cb -#define PCI_DEVICE_ID_SPECIALIX_IO8 0x2000 -#define PCI_DEVICE_ID_SPECIALIX_XIO 0x4000 -#define PCI_DEVICE_ID_SPECIALIX_RIO 0x8000 -#define PCI_SUBDEVICE_ID_SPECIALIX_SPEED4 0xa004 - -#define PCI_VENDOR_ID_AURAVISION 0x11d1 -#define PCI_DEVICE_ID_AURAVISION_VXP524 0x01f7 - -#define PCI_VENDOR_ID_ANALOG_DEVICES 0x11d4 -#define PCI_DEVICE_ID_AD1889JS 0x1889 - -#define PCI_VENDOR_ID_IKON 0x11d5 -#define PCI_DEVICE_ID_IKON_10115 0x0115 -#define PCI_DEVICE_ID_IKON_10117 0x0117 - -#define PCI_VENDOR_ID_ZORAN 0x11de -#define PCI_DEVICE_ID_ZORAN_36057 0x6057 -#define PCI_DEVICE_ID_ZORAN_36120 0x6120 - -#define PCI_VENDOR_ID_KINETIC 0x11f4 -#define PCI_DEVICE_ID_KINETIC_2915 0x2915 - -#define PCI_VENDOR_ID_COMPEX 0x11f6 -#define PCI_DEVICE_ID_COMPEX_ENET100VG4 0x0112 -#define PCI_DEVICE_ID_COMPEX_RL2000 0x1401 -#define PCI_DEVICE_ID_COMPEX_RL100ATX 0x2011 - -#define PCI_VENDOR_ID_RP 0x11fe -#define PCI_DEVICE_ID_RP32INTF 0x0001 -#define PCI_DEVICE_ID_RP8INTF 0x0002 -#define PCI_DEVICE_ID_RP16INTF 0x0003 -#define PCI_DEVICE_ID_RP4QUAD 0x0004 -#define PCI_DEVICE_ID_RP8OCTA 0x0005 -#define PCI_DEVICE_ID_RP8J 0x0006 -#define PCI_DEVICE_ID_RPP4 0x000A -#define PCI_DEVICE_ID_RPP8 0x000B -#define PCI_DEVICE_ID_RP8M 0x000C - -#define PCI_VENDOR_ID_CYCLADES 0x120e -#define PCI_DEVICE_ID_CYCLOM_Y_Lo 0x0100 -#define PCI_DEVICE_ID_CYCLOM_Y_Hi 0x0101 -#define PCI_DEVICE_ID_CYCLOM_4Y_Lo 0x0102 -#define PCI_DEVICE_ID_CYCLOM_4Y_Hi 0x0103 -#define PCI_DEVICE_ID_CYCLOM_8Y_Lo 0x0104 -#define PCI_DEVICE_ID_CYCLOM_8Y_Hi 0x0105 -#define PCI_DEVICE_ID_CYCLOM_Z_Lo 0x0200 -#define PCI_DEVICE_ID_CYCLOM_Z_Hi 0x0201 -#define PCI_DEVICE_ID_PC300_RX_2 0x0300 -#define PCI_DEVICE_ID_PC300_RX_1 0x0301 -#define PCI_DEVICE_ID_PC300_TE_2 0x0310 -#define PCI_DEVICE_ID_PC300_TE_1 0x0311 - -#define PCI_VENDOR_ID_ESSENTIAL 0x120f -#define PCI_DEVICE_ID_ESSENTIAL_ROADRUNNER 0x0001 - -#define PCI_VENDOR_ID_O2 0x1217 -#define PCI_DEVICE_ID_O2_6729 0x6729 -#define PCI_DEVICE_ID_O2_6730 0x673a -#define PCI_DEVICE_ID_O2_6832 0x6832 -#define PCI_DEVICE_ID_O2_6836 0x6836 - -#define PCI_VENDOR_ID_3DFX 0x121a -#define PCI_DEVICE_ID_3DFX_VOODOO 0x0001 -#define PCI_DEVICE_ID_3DFX_VOODOO2 0x0002 -#define PCI_DEVICE_ID_3DFX_BANSHEE 0x0003 -#define PCI_DEVICE_ID_3DFX_VOODOO3 0x0005 - -#define PCI_VENDOR_ID_SIGMADES 0x1236 -#define PCI_DEVICE_ID_SIGMADES_6425 0x6401 - -#define PCI_VENDOR_ID_CCUBE 0x123f - -#define PCI_VENDOR_ID_AVM 0x1244 -#define PCI_DEVICE_ID_AVM_B1 0x0700 -#define PCI_DEVICE_ID_AVM_C4 0x0800 -#define PCI_DEVICE_ID_AVM_A1 0x0a00 -#define PCI_DEVICE_ID_AVM_A1_V2 0x0e00 -#define PCI_DEVICE_ID_AVM_C2 0x1100 -#define PCI_DEVICE_ID_AVM_T1 0x1200 - -#define PCI_VENDOR_ID_DIPIX 0x1246 - -#define PCI_VENDOR_ID_STALLION 0x124d -#define PCI_DEVICE_ID_STALLION_ECHPCI832 0x0000 -#define PCI_DEVICE_ID_STALLION_ECHPCI864 0x0002 -#define PCI_DEVICE_ID_STALLION_EIOPCI 0x0003 - -#define PCI_VENDOR_ID_OPTIBASE 0x1255 -#define PCI_DEVICE_ID_OPTIBASE_FORGE 0x1110 -#define PCI_DEVICE_ID_OPTIBASE_FUSION 0x1210 -#define PCI_DEVICE_ID_OPTIBASE_VPLEX 0x2110 -#define PCI_DEVICE_ID_OPTIBASE_VPLEXCC 0x2120 -#define PCI_DEVICE_ID_OPTIBASE_VQUEST 0x2130 - -#define PCI_VENDOR_ID_ESS 0x125d -#define PCI_DEVICE_ID_ESS_ESS1968 0x1968 -#define PCI_DEVICE_ID_ESS_AUDIOPCI 0x1969 -#define PCI_DEVICE_ID_ESS_ESS1978 0x1978 - -#define PCI_VENDOR_ID_HARRIS 0x1260 -#define PCI_DEVICE_ID_HARRIS_PRISM2 0x3873 - -#define PCI_VENDOR_ID_SATSAGEM 0x1267 -#define PCI_DEVICE_ID_SATSAGEM_NICCY 0x1016 -#define PCI_DEVICE_ID_SATSAGEM_PCR2101 0x5352 -#define PCI_DEVICE_ID_SATSAGEM_TELSATTURBO 0x5a4b - -#define PCI_VENDOR_ID_HUGHES 0x1273 -#define PCI_DEVICE_ID_HUGHES_DIRECPC 0x0002 - -#define PCI_VENDOR_ID_ENSONIQ 0x1274 -#define PCI_DEVICE_ID_ENSONIQ_CT5880 0x5880 -#define PCI_DEVICE_ID_ENSONIQ_ES1370 0x5000 -#define PCI_DEVICE_ID_ENSONIQ_ES1371 0x1371 - -#define PCI_VENDOR_ID_ROCKWELL 0x127A - -#define PCI_VENDOR_ID_DAVICOM 0x1282 -#define PCI_DEVICE_ID_DM9009 0x9009 -#define PCI_DEVICE_ID_DM9102 0x9102 - -#define PCI_VENDOR_ID_ITE 0x1283 -#define PCI_DEVICE_ID_ITE_IT8172G_AUDIO 0x0801 -#define PCI_DEVICE_ID_ITE_IT8172G 0x8172 -#define PCI_DEVICE_ID_ITE_8872 0x8872 - - -/* formerly Platform Tech */ -#define PCI_VENDOR_ID_ESS_OLD 0x1285 -#define PCI_DEVICE_ID_ESS_ESS0100 0x0100 - -#define PCI_VENDOR_ID_ALTEON 0x12ae -#define PCI_DEVICE_ID_ALTEON_ACENIC 0x0001 - -#define PCI_VENDOR_ID_USR 0x12B9 - -#define PCI_VENDOR_ID_HOLTEK 0x12c3 -#define PCI_DEVICE_ID_HOLTEK_HT80232 0x0058 - -#define PCI_SUBVENDOR_ID_CONNECT_TECH 0x12c4 -#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_232 0x0001 -#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH4_232 0x0002 -#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH2_232 0x0003 -#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_485 0x0004 -#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_485_4_4 0x0005 -#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH4_485 0x0006 -#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH4_485_2_2 0x0007 -#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH2_485 0x0008 -#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_485_2_6 0x0009 -#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH081101V1 0x000A -#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH041101V1 0x000B - -#define PCI_VENDOR_ID_PICTUREL 0x12c5 -#define PCI_DEVICE_ID_PICTUREL_PCIVST 0x0081 - -#define PCI_VENDOR_ID_NVIDIA_SGS 0x12d2 -#define PCI_DEVICE_ID_NVIDIA_SGS_RIVA128 0x0018 - -#define PCI_SUBVENDOR_ID_CHASE_PCIFAST 0x12E0 -#define PCI_SUBDEVICE_ID_CHASE_PCIFAST4 0x0031 -#define PCI_SUBDEVICE_ID_CHASE_PCIFAST8 0x0021 -#define PCI_SUBDEVICE_ID_CHASE_PCIFAST16 0x0011 -#define PCI_SUBDEVICE_ID_CHASE_PCIFAST16FMC 0x0041 -#define PCI_SUBVENDOR_ID_CHASE_PCIRAS 0x124D -#define PCI_SUBDEVICE_ID_CHASE_PCIRAS4 0xF001 -#define PCI_SUBDEVICE_ID_CHASE_PCIRAS8 0xF010 - -#define PCI_VENDOR_ID_AUREAL 0x12eb -#define PCI_DEVICE_ID_AUREAL_VORTEX_1 0x0001 -#define PCI_DEVICE_ID_AUREAL_VORTEX_2 0x0002 - -#define PCI_VENDOR_ID_CBOARDS 0x1307 -#define PCI_DEVICE_ID_CBOARDS_DAS1602_16 0x0001 - -#define PCI_VENDOR_ID_SIIG 0x131f -#define PCI_DEVICE_ID_SIIG_1S_10x_550 0x1000 -#define PCI_DEVICE_ID_SIIG_1S_10x_650 0x1001 -#define PCI_DEVICE_ID_SIIG_1S_10x_850 0x1002 -#define PCI_DEVICE_ID_SIIG_1S1P_10x_550 0x1010 -#define PCI_DEVICE_ID_SIIG_1S1P_10x_650 0x1011 -#define PCI_DEVICE_ID_SIIG_1S1P_10x_850 0x1012 -#define PCI_DEVICE_ID_SIIG_1P_10x 0x1020 -#define PCI_DEVICE_ID_SIIG_2P_10x 0x1021 -#define PCI_DEVICE_ID_SIIG_2S_10x_550 0x1030 -#define PCI_DEVICE_ID_SIIG_2S_10x_650 0x1031 -#define PCI_DEVICE_ID_SIIG_2S_10x_850 0x1032 -#define PCI_DEVICE_ID_SIIG_2S1P_10x_550 0x1034 -#define PCI_DEVICE_ID_SIIG_2S1P_10x_650 0x1035 -#define PCI_DEVICE_ID_SIIG_2S1P_10x_850 0x1036 -#define PCI_DEVICE_ID_SIIG_4S_10x_550 0x1050 -#define PCI_DEVICE_ID_SIIG_4S_10x_650 0x1051 -#define PCI_DEVICE_ID_SIIG_4S_10x_850 0x1052 -#define PCI_DEVICE_ID_SIIG_1S_20x_550 0x2000 -#define PCI_DEVICE_ID_SIIG_1S_20x_650 0x2001 -#define PCI_DEVICE_ID_SIIG_1S_20x_850 0x2002 -#define PCI_DEVICE_ID_SIIG_1P_20x 0x2020 -#define PCI_DEVICE_ID_SIIG_2P_20x 0x2021 -#define PCI_DEVICE_ID_SIIG_2S_20x_550 0x2030 -#define PCI_DEVICE_ID_SIIG_2S_20x_650 0x2031 -#define PCI_DEVICE_ID_SIIG_2S_20x_850 0x2032 -#define PCI_DEVICE_ID_SIIG_2P1S_20x_550 0x2040 -#define PCI_DEVICE_ID_SIIG_2P1S_20x_650 0x2041 -#define PCI_DEVICE_ID_SIIG_2P1S_20x_850 0x2042 -#define PCI_DEVICE_ID_SIIG_1S1P_20x_550 0x2010 -#define PCI_DEVICE_ID_SIIG_1S1P_20x_650 0x2011 -#define PCI_DEVICE_ID_SIIG_1S1P_20x_850 0x2012 -#define PCI_DEVICE_ID_SIIG_4S_20x_550 0x2050 -#define PCI_DEVICE_ID_SIIG_4S_20x_650 0x2051 -#define PCI_DEVICE_ID_SIIG_4S_20x_850 0x2052 -#define PCI_DEVICE_ID_SIIG_2S1P_20x_550 0x2060 -#define PCI_DEVICE_ID_SIIG_2S1P_20x_650 0x2061 -#define PCI_DEVICE_ID_SIIG_2S1P_20x_850 0x2062 - -#define PCI_VENDOR_ID_ADMTEK 0x1317 -#define PCI_DEVICE_ID_ADMTEK_0985 0x0985 - -#define PCI_VENDOR_ID_DOMEX 0x134a -#define PCI_DEVICE_ID_DOMEX_DMX3191D 0x0001 - -#define PCI_VENDOR_ID_QUATECH 0x135C -#define PCI_DEVICE_ID_QUATECH_QSC100 0x0010 -#define PCI_DEVICE_ID_QUATECH_DSC100 0x0020 -#define PCI_DEVICE_ID_QUATECH_DSC200 0x0030 -#define PCI_DEVICE_ID_QUATECH_QSC200 0x0040 -#define PCI_DEVICE_ID_QUATECH_ESC100D 0x0050 -#define PCI_DEVICE_ID_QUATECH_ESC100M 0x0060 - -#define PCI_VENDOR_ID_SEALEVEL 0x135e -#define PCI_DEVICE_ID_SEALEVEL_U530 0x7101 -#define PCI_DEVICE_ID_SEALEVEL_UCOMM2 0x7201 -#define PCI_DEVICE_ID_SEALEVEL_UCOMM422 0x7402 -#define PCI_DEVICE_ID_SEALEVEL_UCOMM232 0x7202 -#define PCI_DEVICE_ID_SEALEVEL_COMM4 0x7401 -#define PCI_DEVICE_ID_SEALEVEL_COMM8 0x7801 - -#define PCI_VENDOR_ID_HYPERCOPE 0x1365 -#define PCI_DEVICE_ID_HYPERCOPE_PLX 0x9050 -#define PCI_SUBDEVICE_ID_HYPERCOPE_OLD_ERGO 0x0104 -#define PCI_SUBDEVICE_ID_HYPERCOPE_ERGO 0x0106 -#define PCI_SUBDEVICE_ID_HYPERCOPE_METRO 0x0107 -#define PCI_SUBDEVICE_ID_HYPERCOPE_CHAMP2 0x0108 -#define PCI_SUBDEVICE_ID_HYPERCOPE_PLEXUS 0x0109 - -#define PCI_VENDOR_ID_KAWASAKI 0x136b -#define PCI_DEVICE_ID_MCHIP_KL5A72002 0xff01 - -#define PCI_VENDOR_ID_LMC 0x1376 -#define PCI_DEVICE_ID_LMC_HSSI 0x0003 -#define PCI_DEVICE_ID_LMC_DS3 0x0004 -#define PCI_DEVICE_ID_LMC_SSI 0x0005 -#define PCI_DEVICE_ID_LMC_T1 0x0006 - -#define PCI_VENDOR_ID_NETGEAR 0x1385 -#define PCI_DEVICE_ID_NETGEAR_MA301 0x4100 -#define PCI_DEVICE_ID_NETGEAR_GA620 0x620a -#define PCI_DEVICE_ID_NETGEAR_GA622 0x622a - -#define PCI_VENDOR_ID_APPLICOM 0x1389 -#define PCI_DEVICE_ID_APPLICOM_PCIGENERIC 0x0001 -#define PCI_DEVICE_ID_APPLICOM_PCI2000IBS_CAN 0x0002 -#define PCI_DEVICE_ID_APPLICOM_PCI2000PFB 0x0003 - -#define PCI_VENDOR_ID_MOXA 0x1393 -#define PCI_DEVICE_ID_MOXA_C104 0x1040 -#define PCI_DEVICE_ID_MOXA_C168 0x1680 -#define PCI_DEVICE_ID_MOXA_CP204J 0x2040 -#define PCI_DEVICE_ID_MOXA_C218 0x2180 -#define PCI_DEVICE_ID_MOXA_C320 0x3200 - -#define PCI_VENDOR_ID_CCD 0x1397 -#define PCI_DEVICE_ID_CCD_2BD0 0x2bd0 -#define PCI_DEVICE_ID_CCD_B000 0xb000 -#define PCI_DEVICE_ID_CCD_B006 0xb006 -#define PCI_DEVICE_ID_CCD_B007 0xb007 -#define PCI_DEVICE_ID_CCD_B008 0xb008 -#define PCI_DEVICE_ID_CCD_B009 0xb009 -#define PCI_DEVICE_ID_CCD_B00A 0xb00a -#define PCI_DEVICE_ID_CCD_B00B 0xb00b -#define PCI_DEVICE_ID_CCD_B00C 0xb00c -#define PCI_DEVICE_ID_CCD_B100 0xb100 - -#define PCI_VENDOR_ID_MICROGATE 0x13c0 -#define PCI_DEVICE_ID_MICROGATE_USC 0x0010 -#define PCI_DEVICE_ID_MICROGATE_SCC 0x0020 -#define PCI_DEVICE_ID_MICROGATE_SCA 0x0030 - -#define PCI_VENDOR_ID_3WARE 0x13C1 -#define PCI_DEVICE_ID_3WARE_1000 0x1000 - -#define PCI_VENDOR_ID_ABOCOM 0x13D1 -#define PCI_DEVICE_ID_ABOCOM_2BD1 0x2BD1 - -#define PCI_VENDOR_ID_CMEDIA 0x13f6 -#define PCI_DEVICE_ID_CMEDIA_CM8338A 0x0100 -#define PCI_DEVICE_ID_CMEDIA_CM8338B 0x0101 -#define PCI_DEVICE_ID_CMEDIA_CM8738 0x0111 -#define PCI_DEVICE_ID_CMEDIA_CM8738B 0x0112 - -#define PCI_VENDOR_ID_LAVA 0x1407 -#define PCI_DEVICE_ID_LAVA_DSERIAL 0x0100 /* 2x 16550 */ -#define PCI_DEVICE_ID_LAVA_QUATRO_A 0x0101 /* 2x 16550, half of 4 port */ -#define PCI_DEVICE_ID_LAVA_QUATRO_B 0x0102 /* 2x 16550, half of 4 port */ -#define PCI_DEVICE_ID_LAVA_PORT_PLUS 0x0200 /* 2x 16650 */ -#define PCI_DEVICE_ID_LAVA_QUAD_A 0x0201 /* 2x 16650, half of 4 port */ -#define PCI_DEVICE_ID_LAVA_QUAD_B 0x0202 /* 2x 16650, half of 4 port */ -#define PCI_DEVICE_ID_LAVA_SSERIAL 0x0500 /* 1x 16550 */ -#define PCI_DEVICE_ID_LAVA_PORT_650 0x0600 /* 1x 16650 */ -#define PCI_DEVICE_ID_LAVA_PARALLEL 0x8000 -#define PCI_DEVICE_ID_LAVA_DUAL_PAR_A 0x8002 /* The Lava Dual Parallel is */ -#define PCI_DEVICE_ID_LAVA_DUAL_PAR_B 0x8003 /* two PCI devices on a card */ -#define PCI_DEVICE_ID_LAVA_BOCA_IOPPAR 0x8800 - -#define PCI_VENDOR_ID_TIMEDIA 0x1409 -#define PCI_DEVICE_ID_TIMEDIA_1889 0x7168 - -#define PCI_VENDOR_ID_OXSEMI 0x1415 -#define PCI_DEVICE_ID_OXSEMI_12PCI840 0x8403 -#define PCI_DEVICE_ID_OXSEMI_16PCI954 0x9501 -#define PCI_DEVICE_ID_OXSEMI_16PCI952 0x950A -#define PCI_DEVICE_ID_OXSEMI_16PCI95N 0x9511 -#define PCI_DEVICE_ID_OXSEMI_16PCI954PP 0x9513 - -#define PCI_VENDOR_ID_AIRONET 0x14b9 -#define PCI_DEVICE_ID_AIRONET_4800_1 0x0001 -#define PCI_DEVICE_ID_AIRONET_4800 0x4500 // values switched? see -#define PCI_DEVICE_ID_AIRONET_4500 0x4800 // drivers/net/aironet4500_card.c - -#define PCI_VENDOR_ID_TITAN 0x14D2 -#define PCI_DEVICE_ID_TITAN_010L 0x8001 -#define PCI_DEVICE_ID_TITAN_100L 0x8010 -#define PCI_DEVICE_ID_TITAN_110L 0x8011 -#define PCI_DEVICE_ID_TITAN_200L 0x8020 -#define PCI_DEVICE_ID_TITAN_210L 0x8021 -#define PCI_DEVICE_ID_TITAN_400L 0x8040 -#define PCI_DEVICE_ID_TITAN_800L 0x8080 -#define PCI_DEVICE_ID_TITAN_100 0xA001 -#define PCI_DEVICE_ID_TITAN_200 0xA005 -#define PCI_DEVICE_ID_TITAN_400 0xA003 -#define PCI_DEVICE_ID_TITAN_800B 0xA004 - -#define PCI_VENDOR_ID_PANACOM 0x14d4 -#define PCI_DEVICE_ID_PANACOM_QUADMODEM 0x0400 -#define PCI_DEVICE_ID_PANACOM_DUALMODEM 0x0402 - -#define PCI_VENDOR_ID_BROADCOM 0x14e4 -#define PCI_DEVICE_ID_TIGON3_5700 0x1644 -#define PCI_DEVICE_ID_TIGON3_5701 0x1645 -#define PCI_DEVICE_ID_TIGON3_5702 0x1646 -#define PCI_DEVICE_ID_TIGON3_5703 0x1647 -#define PCI_DEVICE_ID_TIGON3_5704 0x1648 -#define PCI_DEVICE_ID_TIGON3_5702FE 0x164d -#define PCI_DEVICE_ID_TIGON3_5705 0x1653 -#define PCI_DEVICE_ID_TIGON3_5705_2 0x1654 -#define PCI_DEVICE_ID_TIGON3_5705M 0x165d -#define PCI_DEVICE_ID_TIGON3_5705M_2 0x165e -#define PCI_DEVICE_ID_TIGON3_5782 0x1696 -#define PCI_DEVICE_ID_TIGON3_5788 0x169c -#define PCI_DEVICE_ID_TIGON3_5702X 0x16a6 -#define PCI_DEVICE_ID_TIGON3_5703X 0x16a7 -#define PCI_DEVICE_ID_TIGON3_5704S 0x16a8 -#define PCI_DEVICE_ID_TIGON3_5702A3 0x16c6 -#define PCI_DEVICE_ID_TIGON3_5703A3 0x16c7 -#define PCI_DEVICE_ID_TIGON3_5901 0x170d -#define PCI_DEVICE_ID_TIGON3_5901_2 0x170e - -#define PCI_VENDOR_ID_SYBA 0x1592 -#define PCI_DEVICE_ID_SYBA_2P_EPP 0x0782 -#define PCI_DEVICE_ID_SYBA_1P_ECP 0x0783 - -#define PCI_VENDOR_ID_MORETON 0x15aa -#define PCI_DEVICE_ID_RASTEL_2PORT 0x2000 - -#define PCI_VENDOR_ID_ZOLTRIX 0x15b0 -#define PCI_DEVICE_ID_ZOLTRIX_2BD0 0x2bd0 - -#define PCI_VENDOR_ID_PDC 0x15e9 -#define PCI_DEVICE_ID_PDC_1841 0x1841 - -#define PCI_VENDOR_ID_SYMPHONY 0x1c1c -#define PCI_DEVICE_ID_SYMPHONY_101 0x0001 - -#define PCI_VENDOR_ID_TEKRAM 0x1de1 -#define PCI_DEVICE_ID_TEKRAM_DC290 0xdc29 - -#define PCI_VENDOR_ID_3DLABS 0x3d3d -#define PCI_DEVICE_ID_3DLABS_300SX 0x0001 -#define PCI_DEVICE_ID_3DLABS_500TX 0x0002 -#define PCI_DEVICE_ID_3DLABS_DELTA 0x0003 -#define PCI_DEVICE_ID_3DLABS_PERMEDIA 0x0004 -#define PCI_DEVICE_ID_3DLABS_MX 0x0006 -#define PCI_DEVICE_ID_3DLABS_PERMEDIA2 0x0007 -#define PCI_DEVICE_ID_3DLABS_GAMMA 0x0008 -#define PCI_DEVICE_ID_3DLABS_PERMEDIA2V 0x0009 - -#define PCI_VENDOR_ID_AVANCE 0x4005 -#define PCI_DEVICE_ID_AVANCE_ALG2064 0x2064 -#define PCI_DEVICE_ID_AVANCE_2302 0x2302 - -#define PCI_VENDOR_ID_AKS 0x416c -#define PCI_DEVICE_ID_AKS_ALADDINCARD 0x0100 -#define PCI_DEVICE_ID_AKS_CPC 0x0200 - -#define PCI_VENDOR_ID_NETVIN 0x4a14 -#define PCI_DEVICE_ID_NETVIN_NV5000SC 0x5000 - -#define PCI_VENDOR_ID_S3 0x5333 -#define PCI_DEVICE_ID_S3_PLATO_PXS 0x0551 -#define PCI_DEVICE_ID_S3_ViRGE 0x5631 -#define PCI_DEVICE_ID_S3_TRIO 0x8811 -#define PCI_DEVICE_ID_S3_AURORA64VP 0x8812 -#define PCI_DEVICE_ID_S3_TRIO64UVP 0x8814 -#define PCI_DEVICE_ID_S3_ViRGE_VX 0x883d -#define PCI_DEVICE_ID_S3_868 0x8880 -#define PCI_DEVICE_ID_S3_928 0x88b0 -#define PCI_DEVICE_ID_S3_864_1 0x88c0 -#define PCI_DEVICE_ID_S3_864_2 0x88c1 -#define PCI_DEVICE_ID_S3_964_1 0x88d0 -#define PCI_DEVICE_ID_S3_964_2 0x88d1 -#define PCI_DEVICE_ID_S3_968 0x88f0 -#define PCI_DEVICE_ID_S3_TRIO64V2 0x8901 -#define PCI_DEVICE_ID_S3_PLATO_PXG 0x8902 -#define PCI_DEVICE_ID_S3_ViRGE_DXGX 0x8a01 -#define PCI_DEVICE_ID_S3_ViRGE_GX2 0x8a10 -#define PCI_DEVICE_ID_S3_ViRGE_MX 0x8c01 -#define PCI_DEVICE_ID_S3_ViRGE_MXP 0x8c02 -#define PCI_DEVICE_ID_S3_ViRGE_MXPMV 0x8c03 -#define PCI_DEVICE_ID_S3_SONICVIBES 0xca00 - -#define PCI_VENDOR_ID_DCI 0x6666 -#define PCI_DEVICE_ID_DCI_PCCOM4 0x0001 -#define PCI_DEVICE_ID_DCI_PCCOM8 0x0002 - -#define PCI_VENDOR_ID_GENROCO 0x5555 -#define PCI_DEVICE_ID_GENROCO_HFP832 0x0003 - -#define PCI_VENDOR_ID_INTEL 0x8086 -#define PCI_DEVICE_ID_INTEL_21145 0x0039 -#define PCI_DEVICE_ID_INTEL_82375 0x0482 -#define PCI_DEVICE_ID_INTEL_82424 0x0483 -#define PCI_DEVICE_ID_INTEL_82378 0x0484 -#define PCI_DEVICE_ID_INTEL_82430 0x0486 -#define PCI_DEVICE_ID_INTEL_82434 0x04a3 -#define PCI_DEVICE_ID_INTEL_I960 0x0960 -#define PCI_DEVICE_ID_INTEL_82542 0x1000 -#define PCI_DEVICE_ID_INTEL_82543GC_FIBER 0x1001 -#define PCI_DEVICE_ID_INTEL_82543GC_COPPER 0x1004 -#define PCI_DEVICE_ID_INTEL_82544EI_COPPER 0x1008 -#define PCI_DEVICE_ID_INTEL_82544EI_FIBER 0x1009 -#define PCI_DEVICE_ID_INTEL_82544GC_COPPER 0x100C -#define PCI_DEVICE_ID_INTEL_82544GC_LOM 0x100D -#define PCI_DEVICE_ID_INTEL_82540EM 0x100E -#define PCI_DEVICE_ID_INTEL_82545EM_COPPER 0x100F -#define PCI_DEVICE_ID_INTEL_82546EB_COPPER 0x1010 -#define PCI_DEVICE_ID_INTEL_82545EM_FIBER 0x1011 -#define PCI_DEVICE_ID_INTEL_82546EB_FIBER 0x1012 -#define PCI_DEVICE_ID_INTEL_82540EM_LOM 0x1015 -#define PCI_DEVICE_ID_INTEL_ID1029 0x1029 -#define PCI_DEVICE_ID_INTEL_ID1030 0x1030 -#define PCI_DEVICE_ID_INTEL_ID1031 0x1031 -#define PCI_DEVICE_ID_INTEL_ID1038 0x1038 -#define PCI_DEVICE_ID_INTEL_ID1039 0x1039 -#define PCI_DEVICE_ID_INTEL_ID103A 0x103A -#define PCI_DEVICE_ID_INTEL_82562ET 0x1031 -#define PCI_DEVICE_ID_INTEL_82559ER 0x1209 -#define PCI_DEVICE_ID_INTEL_82092AA_0 0x1221 -#define PCI_DEVICE_ID_INTEL_82092AA_1 0x1222 -#define PCI_DEVICE_ID_INTEL_7116 0x1223 -#define PCI_DEVICE_ID_INTEL_82596 0x1226 -#define PCI_DEVICE_ID_INTEL_82865 0x1227 -#define PCI_DEVICE_ID_INTEL_82557 0x1229 -#define PCI_DEVICE_ID_INTEL_82437 0x122d -#define PCI_DEVICE_ID_INTEL_82371FB_0 0x122e -#define PCI_DEVICE_ID_INTEL_82371FB_1 0x1230 -#define PCI_DEVICE_ID_INTEL_82371MX 0x1234 -#define PCI_DEVICE_ID_INTEL_82437MX 0x1235 -#define PCI_DEVICE_ID_INTEL_82441 0x1237 -#define PCI_DEVICE_ID_INTEL_82380FB 0x124b -#define PCI_DEVICE_ID_INTEL_82439 0x1250 -#define PCI_DEVICE_ID_INTEL_80960_RP 0x1960 -#define PCI_DEVICE_ID_INTEL_82801AA_0 0x2410 -#define PCI_DEVICE_ID_INTEL_82801AA_1 0x2411 -#define PCI_DEVICE_ID_INTEL_82801AA_2 0x2412 -#define PCI_DEVICE_ID_INTEL_82801AA_3 0x2413 -#define PCI_DEVICE_ID_INTEL_82801AA_5 0x2415 -#define PCI_DEVICE_ID_INTEL_82801AA_6 0x2416 -#define PCI_DEVICE_ID_INTEL_82801AA_8 0x2418 -#define PCI_DEVICE_ID_INTEL_82801AB_0 0x2420 -#define PCI_DEVICE_ID_INTEL_82801AB_1 0x2421 -#define PCI_DEVICE_ID_INTEL_82801AB_2 0x2422 -#define PCI_DEVICE_ID_INTEL_82801AB_3 0x2423 -#define PCI_DEVICE_ID_INTEL_82801AB_5 0x2425 -#define PCI_DEVICE_ID_INTEL_82801AB_6 0x2426 -#define PCI_DEVICE_ID_INTEL_82801AB_8 0x2428 -#define PCI_DEVICE_ID_INTEL_82801BA_0 0x2440 -#define PCI_DEVICE_ID_INTEL_82801BA_1 0x2442 -#define PCI_DEVICE_ID_INTEL_82801BA_2 0x2443 -#define PCI_DEVICE_ID_INTEL_82801BA_3 0x2444 -#define PCI_DEVICE_ID_INTEL_82801BA_4 0x2445 -#define PCI_DEVICE_ID_INTEL_82801BA_5 0x2446 -#define PCI_DEVICE_ID_INTEL_82801BA_6 0x2448 -#define PCI_DEVICE_ID_INTEL_82801BA_7 0x2449 -#define PCI_DEVICE_ID_INTEL_82562 0x2449 -#define PCI_DEVICE_ID_INTEL_82801BA_8 0x244a -#define PCI_DEVICE_ID_INTEL_82801BA_9 0x244b -#define PCI_DEVICE_ID_INTEL_82801BA_10 0x244c -#define PCI_DEVICE_ID_INTEL_82801BA_11 0x244e -#define PCI_DEVICE_ID_INTEL_82801CA_0 0x2480 -#define PCI_DEVICE_ID_INTEL_82801CA_2 0x2482 -#define PCI_DEVICE_ID_INTEL_82801CA_3 0x2483 -#define PCI_DEVICE_ID_INTEL_82801CA_4 0x2484 -#define PCI_DEVICE_ID_INTEL_82801CA_5 0x2485 -#define PCI_DEVICE_ID_INTEL_82801CA_6 0x2486 -#define PCI_DEVICE_ID_INTEL_82801CA_7 0x2487 -#define PCI_DEVICE_ID_INTEL_82801CA_10 0x248a -#define PCI_DEVICE_ID_INTEL_82801CA_11 0x248b -#define PCI_DEVICE_ID_INTEL_82801CA_12 0x248c -#define PCI_DEVICE_ID_INTEL_80310 0x530d -#define PCI_DEVICE_ID_INTEL_82371SB_0 0x7000 -#define PCI_DEVICE_ID_INTEL_82371SB_1 0x7010 -#define PCI_DEVICE_ID_INTEL_82371SB_2 0x7020 -#define PCI_DEVICE_ID_INTEL_82437VX 0x7030 -#define PCI_DEVICE_ID_INTEL_82439TX 0x7100 -#define PCI_DEVICE_ID_INTEL_82371AB_0 0x7110 -#define PCI_DEVICE_ID_INTEL_82371AB 0x7111 -#define PCI_DEVICE_ID_INTEL_82371AB_2 0x7112 -#define PCI_DEVICE_ID_INTEL_82371AB_3 0x7113 -#define PCI_DEVICE_ID_INTEL_82810_MC1 0x7120 -#define PCI_DEVICE_ID_INTEL_82810_IG1 0x7121 -#define PCI_DEVICE_ID_INTEL_82810_MC3 0x7122 -#define PCI_DEVICE_ID_INTEL_82810_IG3 0x7123 -#define PCI_DEVICE_ID_INTEL_82443LX_0 0x7180 -#define PCI_DEVICE_ID_INTEL_82443LX_1 0x7181 -#define PCI_DEVICE_ID_INTEL_82443BX_0 0x7190 -#define PCI_DEVICE_ID_INTEL_82443BX_1 0x7191 -#define PCI_DEVICE_ID_INTEL_82443BX_2 0x7192 -#define PCI_DEVICE_ID_INTEL_82443MX_0 0x7198 -#define PCI_DEVICE_ID_INTEL_82443MX_1 0x7199 -#define PCI_DEVICE_ID_INTEL_82443MX_2 0x719a -#define PCI_DEVICE_ID_INTEL_82443MX_3 0x719b -#define PCI_DEVICE_ID_INTEL_82372FB_0 0x7600 -#define PCI_DEVICE_ID_INTEL_82372FB_1 0x7601 -#define PCI_DEVICE_ID_INTEL_82372FB_2 0x7602 -#define PCI_DEVICE_ID_INTEL_82372FB_3 0x7603 -#define PCI_DEVICE_ID_INTEL_82454GX 0x84c4 -#define PCI_DEVICE_ID_INTEL_82450GX 0x84c5 -#define PCI_DEVICE_ID_INTEL_82451NX 0x84ca - -#define PCI_VENDOR_ID_COMPUTONE 0x8e0e -#define PCI_DEVICE_ID_COMPUTONE_IP2EX 0x0291 -#define PCI_DEVICE_ID_COMPUTONE_PG 0x0302 -#define PCI_SUBVENDOR_ID_COMPUTONE 0x8e0e -#define PCI_SUBDEVICE_ID_COMPUTONE_PG4 0x0001 -#define PCI_SUBDEVICE_ID_COMPUTONE_PG8 0x0002 -#define PCI_SUBDEVICE_ID_COMPUTONE_PG6 0x0003 - -#define PCI_VENDOR_ID_KTI 0x8e2e -#define PCI_DEVICE_ID_KTI_ET32P2 0x3000 - -#define PCI_VENDOR_ID_ADAPTEC 0x9004 -#define PCI_DEVICE_ID_ADAPTEC_7810 0x1078 -#define PCI_DEVICE_ID_ADAPTEC_7821 0x2178 -#define PCI_DEVICE_ID_ADAPTEC_38602 0x3860 -#define PCI_DEVICE_ID_ADAPTEC_7850 0x5078 -#define PCI_DEVICE_ID_ADAPTEC_7855 0x5578 -#define PCI_DEVICE_ID_ADAPTEC_5800 0x5800 -#define PCI_DEVICE_ID_ADAPTEC_3860 0x6038 -#define PCI_DEVICE_ID_ADAPTEC_1480A 0x6075 -#define PCI_DEVICE_ID_ADAPTEC_7860 0x6078 -#define PCI_DEVICE_ID_ADAPTEC_7861 0x6178 -#define PCI_DEVICE_ID_ADAPTEC_7870 0x7078 -#define PCI_DEVICE_ID_ADAPTEC_7871 0x7178 -#define PCI_DEVICE_ID_ADAPTEC_7872 0x7278 -#define PCI_DEVICE_ID_ADAPTEC_7873 0x7378 -#define PCI_DEVICE_ID_ADAPTEC_7874 0x7478 -#define PCI_DEVICE_ID_ADAPTEC_7895 0x7895 -#define PCI_DEVICE_ID_ADAPTEC_7880 0x8078 -#define PCI_DEVICE_ID_ADAPTEC_7881 0x8178 -#define PCI_DEVICE_ID_ADAPTEC_7882 0x8278 -#define PCI_DEVICE_ID_ADAPTEC_7883 0x8378 -#define PCI_DEVICE_ID_ADAPTEC_7884 0x8478 -#define PCI_DEVICE_ID_ADAPTEC_7885 0x8578 -#define PCI_DEVICE_ID_ADAPTEC_7886 0x8678 -#define PCI_DEVICE_ID_ADAPTEC_7887 0x8778 -#define PCI_DEVICE_ID_ADAPTEC_7888 0x8878 -#define PCI_DEVICE_ID_ADAPTEC_1030 0x8b78 - -#define PCI_VENDOR_ID_ADAPTEC2 0x9005 -#define PCI_DEVICE_ID_ADAPTEC2_2940U2 0x0010 -#define PCI_DEVICE_ID_ADAPTEC2_2930U2 0x0011 -#define PCI_DEVICE_ID_ADAPTEC2_7890B 0x0013 -#define PCI_DEVICE_ID_ADAPTEC2_7890 0x001f -#define PCI_DEVICE_ID_ADAPTEC2_3940U2 0x0050 -#define PCI_DEVICE_ID_ADAPTEC2_3950U2D 0x0051 -#define PCI_DEVICE_ID_ADAPTEC2_7896 0x005f -#define PCI_DEVICE_ID_ADAPTEC2_7892A 0x0080 -#define PCI_DEVICE_ID_ADAPTEC2_7892B 0x0081 -#define PCI_DEVICE_ID_ADAPTEC2_7892D 0x0083 -#define PCI_DEVICE_ID_ADAPTEC2_7892P 0x008f -#define PCI_DEVICE_ID_ADAPTEC2_7899A 0x00c0 -#define PCI_DEVICE_ID_ADAPTEC2_7899B 0x00c1 -#define PCI_DEVICE_ID_ADAPTEC2_7899D 0x00c3 -#define PCI_DEVICE_ID_ADAPTEC2_7899P 0x00cf - -#define PCI_VENDOR_ID_ATRONICS 0x907f -#define PCI_DEVICE_ID_ATRONICS_2015 0x2015 - -#define PCI_VENDOR_ID_HOLTEK2 0x9412 -#define PCI_DEVICE_ID_HOLTEK2_6565 0x6565 - -#define PCI_VENDOR_ID_NETMOS 0x9710 -#define PCI_DEVICE_ID_NETMOS_9735 0x9735 -#define PCI_DEVICE_ID_NETMOS_9835 0x9835 - -#define PCI_SUBVENDOR_ID_EXSYS 0xd84d -#define PCI_SUBDEVICE_ID_EXSYS_4014 0x4014 - -#define PCI_VENDOR_ID_TIGERJET 0xe159 -#define PCI_DEVICE_ID_TIGERJET_300 0x0001 -#define PCI_DEVICE_ID_TIGERJET_100 0x0002 - -#define PCI_VENDOR_ID_ARK 0xedd8 -#define PCI_DEVICE_ID_ARK_STING 0xa091 -#define PCI_DEVICE_ID_ARK_STINGARK 0xa099 -#define PCI_DEVICE_ID_ARK_2000MT 0xa0a1 - diff --git a/usr/src/grub/grub-0.95/netboot/pci_io.c b/usr/src/grub/grub-0.95/netboot/pci_io.c deleted file mode 100644 index 029482528a..0000000000 --- a/usr/src/grub/grub-0.95/netboot/pci_io.c +++ /dev/null @@ -1,431 +0,0 @@ -/* -** Support for NE2000 PCI clones added David Monro June 1997 -** Generalised to other NICs by Ken Yap July 1997 -** -** Most of this is taken from: -** -** /usr/src/linux/drivers/pci/pci.c -** /usr/src/linux/include/linux/pci.h -** /usr/src/linux/arch/i386/bios32.c -** /usr/src/linux/include/linux/bios32.h -** /usr/src/linux/drivers/net/ne.c -*/ -#define PCBIOS -#include "grub.h" -#include "pci.h" - -#ifdef CONFIG_PCI_DIRECT -#define PCIBIOS_SUCCESSFUL 0x00 - -#define DEBUG 0 - -/* - * Functions for accessing PCI configuration space with type 1 accesses - */ - -#define CONFIG_CMD(bus, device_fn, where) (0x80000000 | (bus << 16) | (device_fn << 8) | (where & ~3)) - -int pcibios_read_config_byte(unsigned int bus, unsigned int device_fn, - unsigned int where, uint8_t *value) -{ - outl(CONFIG_CMD(bus,device_fn,where), 0xCF8); - *value = inb(0xCFC + (where&3)); - return PCIBIOS_SUCCESSFUL; -} - -int pcibios_read_config_word (unsigned int bus, - unsigned int device_fn, unsigned int where, uint16_t *value) -{ - outl(CONFIG_CMD(bus,device_fn,where), 0xCF8); - *value = inw(0xCFC + (where&2)); - return PCIBIOS_SUCCESSFUL; -} - -int pcibios_read_config_dword (unsigned int bus, unsigned int device_fn, - unsigned int where, uint32_t *value) -{ - outl(CONFIG_CMD(bus,device_fn,where), 0xCF8); - *value = inl(0xCFC); - return PCIBIOS_SUCCESSFUL; -} - -int pcibios_write_config_byte (unsigned int bus, unsigned int device_fn, - unsigned int where, uint8_t value) -{ - outl(CONFIG_CMD(bus,device_fn,where), 0xCF8); - outb(value, 0xCFC + (where&3)); - return PCIBIOS_SUCCESSFUL; -} - -int pcibios_write_config_word (unsigned int bus, unsigned int device_fn, - unsigned int where, uint16_t value) -{ - outl(CONFIG_CMD(bus,device_fn,where), 0xCF8); - outw(value, 0xCFC + (where&2)); - return PCIBIOS_SUCCESSFUL; -} - -int pcibios_write_config_dword (unsigned int bus, unsigned int device_fn, unsigned int where, uint32_t value) -{ - outl(CONFIG_CMD(bus,device_fn,where), 0xCF8); - outl(value, 0xCFC); - return PCIBIOS_SUCCESSFUL; -} - -#undef CONFIG_CMD - -#else /* CONFIG_PCI_DIRECT not defined */ - -#if !defined(PCBIOS) -#error "The pcibios can only be used when the PCBIOS support is compiled in" -#endif - - -#define KERN_CODE_SEG 0X8 -/* Stuff for asm */ -#define save_flags(x) \ -__asm__ __volatile__("pushfl ; popl %0":"=g" (x): /* no input */ :"memory") - -#define cli() __asm__ __volatile__ ("cli": : :"memory") - -#define restore_flags(x) \ -__asm__ __volatile__("pushl %0 ; popfl": /* no output */ :"g" (x):"memory") - - - -static struct { - unsigned long address; - unsigned short segment; -} bios32_indirect = { 0, KERN_CODE_SEG }; - -static long pcibios_entry = 0; -static struct { - unsigned long address; - unsigned short segment; -} pci_indirect = { 0, KERN_CODE_SEG }; - -static unsigned long bios32_service(unsigned long service) -{ - unsigned char return_code; /* %al */ - unsigned long address; /* %ebx */ - unsigned long length; /* %ecx */ - unsigned long entry; /* %edx */ - unsigned long flags; - - save_flags(flags); - __asm__( -#ifdef ABSOLUTE_WITHOUT_ASTERISK - "lcall (%%edi)" -#else - "lcall *(%%edi)" -#endif - : "=a" (return_code), - "=b" (address), - "=c" (length), - "=d" (entry) - : "0" (service), - "1" (0), - "D" (&bios32_indirect)); - restore_flags(flags); - - switch (return_code) { - case 0: - return address + entry; - case 0x80: /* Not present */ - printf("bios32_service(%d) : not present\n", service); - return 0; - default: /* Shouldn't happen */ - printf("bios32_service(%d) : returned %#X, mail drew@colorado.edu\n", - service, return_code); - return 0; - } -} - -int pcibios_read_config_byte(unsigned int bus, - unsigned int device_fn, unsigned int where, uint8_t *value) -{ - unsigned long ret; - unsigned long bx = (bus << 8) | device_fn; - unsigned long flags; - - save_flags(flags); - __asm__( -#ifdef ABSOLUTE_WITHOUT_ASTERISK - "lcall (%%esi)\n\t" -#else - "lcall *(%%esi)\n\t" -#endif - "jc 1f\n\t" - "xor %%ah, %%ah\n" - "1:" - : "=c" (*value), - "=a" (ret) - : "1" (PCIBIOS_READ_CONFIG_BYTE), - "b" (bx), - "D" ((long) where), - "S" (&pci_indirect)); - restore_flags(flags); - return (int) (ret & 0xff00) >> 8; -} - -int pcibios_read_config_word(unsigned int bus, - unsigned int device_fn, unsigned int where, uint16_t *value) -{ - unsigned long ret; - unsigned long bx = (bus << 8) | device_fn; - unsigned long flags; - - save_flags(flags); - __asm__( -#ifdef ABSOLUTE_WITHOUT_ASTERISK - "lcall (%%esi)\n\t" -#else - "lcall *(%%esi)\n\t" -#endif - "jc 1f\n\t" - "xor %%ah, %%ah\n" - "1:" - : "=c" (*value), - "=a" (ret) - : "1" (PCIBIOS_READ_CONFIG_WORD), - "b" (bx), - "D" ((long) where), - "S" (&pci_indirect)); - restore_flags(flags); - return (int) (ret & 0xff00) >> 8; -} - -int pcibios_read_config_dword(unsigned int bus, - unsigned int device_fn, unsigned int where, uint32_t *value) -{ - unsigned long ret; - unsigned long bx = (bus << 8) | device_fn; - unsigned long flags; - - save_flags(flags); - __asm__( -#ifdef ABSOLUTE_WITHOUT_ASTERISK - "lcall (%%esi)\n\t" -#else - "lcall *(%%esi)\n\t" -#endif - "jc 1f\n\t" - "xor %%ah, %%ah\n" - "1:" - : "=c" (*value), - "=a" (ret) - : "1" (PCIBIOS_READ_CONFIG_DWORD), - "b" (bx), - "D" ((long) where), - "S" (&pci_indirect)); - restore_flags(flags); - return (int) (ret & 0xff00) >> 8; -} - -int pcibios_write_config_byte (unsigned int bus, - unsigned int device_fn, unsigned int where, uint8_t value) -{ - unsigned long ret; - unsigned long bx = (bus << 8) | device_fn; - unsigned long flags; - - save_flags(flags); cli(); - __asm__( -#ifdef ABSOLUTE_WITHOUT_ASTERISK - "lcall (%%esi)\n\t" -#else - "lcall *(%%esi)\n\t" -#endif - "jc 1f\n\t" - "xor %%ah, %%ah\n" - "1:" - : "=a" (ret) - : "0" (PCIBIOS_WRITE_CONFIG_BYTE), - "c" (value), - "b" (bx), - "D" ((long) where), - "S" (&pci_indirect)); - restore_flags(flags); - return (int) (ret & 0xff00) >> 8; -} - -int pcibios_write_config_word (unsigned int bus, - unsigned int device_fn, unsigned int where, uint16_t value) -{ - unsigned long ret; - unsigned long bx = (bus << 8) | device_fn; - unsigned long flags; - - save_flags(flags); cli(); - __asm__( -#ifdef ABSOLUTE_WITHOUT_ASTERISK - "lcall (%%esi)\n\t" -#else - "lcall *(%%esi)\n\t" -#endif - "jc 1f\n\t" - "xor %%ah, %%ah\n" - "1:" - : "=a" (ret) - : "0" (PCIBIOS_WRITE_CONFIG_WORD), - "c" (value), - "b" (bx), - "D" ((long) where), - "S" (&pci_indirect)); - restore_flags(flags); - return (int) (ret & 0xff00) >> 8; -} - -int pcibios_write_config_dword (unsigned int bus, - unsigned int device_fn, unsigned int where, uint32_t value) -{ - unsigned long ret; - unsigned long bx = (bus << 8) | device_fn; - unsigned long flags; - - save_flags(flags); cli(); - __asm__( -#ifdef ABSOLUTE_WITHOUT_ASTERISK - "lcall (%%esi)\n\t" -#else - "lcall *(%%esi)\n\t" -#endif - "jc 1f\n\t" - "xor %%ah, %%ah\n" - "1:" - : "=a" (ret) - : "0" (PCIBIOS_WRITE_CONFIG_DWORD), - "c" (value), - "b" (bx), - "D" ((long) where), - "S" (&pci_indirect)); - restore_flags(flags); - return (int) (ret & 0xff00) >> 8; -} - -static void check_pcibios(void) -{ - unsigned long signature; - unsigned char present_status; - unsigned char major_revision; - unsigned char minor_revision; - unsigned long flags; - int pack; - - if ((pcibios_entry = bios32_service(PCI_SERVICE))) { - pci_indirect.address = pcibios_entry; - - save_flags(flags); - __asm__( -#ifdef ABSOLUTE_WITHOUT_ASTERISK - "lcall (%%edi)\n\t" -#else - "lcall *(%%edi)\n\t" -#endif - "jc 1f\n\t" - "xor %%ah, %%ah\n" - "1:\tshl $8, %%eax\n\t" - "movw %%bx, %%ax" - : "=d" (signature), - "=a" (pack) - : "1" (PCIBIOS_PCI_BIOS_PRESENT), - "D" (&pci_indirect) - : "bx", "cx"); - restore_flags(flags); - - present_status = (pack >> 16) & 0xff; - major_revision = (pack >> 8) & 0xff; - minor_revision = pack & 0xff; - if (present_status || (signature != PCI_SIGNATURE)) { - printf("ERROR: BIOS32 says PCI BIOS, but no PCI " - "BIOS????\n"); - pcibios_entry = 0; - } -#if DEBUG - if (pcibios_entry) { - printf ("pcibios_init : PCI BIOS revision %hhX.%hhX" - " entry at %#X\n", major_revision, - minor_revision, pcibios_entry); - } -#endif - } -} - -static void pcibios_init(void) -{ - union bios32 *check; - unsigned char sum; - int i, length; - unsigned long bios32_entry = 0; - - EnterFunction("pcibios_init"); - /* - * Follow the standard procedure for locating the BIOS32 Service - * directory by scanning the permissible address range from - * 0xe0000 through 0xfffff for a valid BIOS32 structure. - * - */ - - for (check = (union bios32 *) 0xe0000; check <= (union bios32 *) 0xffff0; ++check) { - if (check->fields.signature != BIOS32_SIGNATURE) - continue; - length = check->fields.length * 16; - if (!length) - continue; - sum = 0; - for (i = 0; i < length ; ++i) - sum += check->chars[i]; - if (sum != 0) - continue; - if (check->fields.revision != 0) { - printf("pcibios_init : unsupported revision %d at %#X, mail drew@colorado.edu\n", - check->fields.revision, check); - continue; - } -#if DEBUG - printf("pcibios_init : BIOS32 Service Directory " - "structure at %#X\n", check); -#endif - if (!bios32_entry) { - if (check->fields.entry >= 0x100000) { - printf("pcibios_init: entry in high " - "memory, giving up\n"); - return; - } else { - bios32_entry = check->fields.entry; -#if DEBUG - printf("pcibios_init : BIOS32 Service Directory" - " entry at %#X\n", bios32_entry); -#endif - bios32_indirect.address = bios32_entry; - } - } - } - if (bios32_entry) - check_pcibios(); - LeaveFunction("pcibios_init"); -} - -#endif /* CONFIG_PCI_DIRECT not defined*/ - -unsigned long pcibios_bus_base(unsigned int bus __unused) -{ - /* architecturally this must be 0 */ - return 0; -} - -void find_pci(int type, struct pci_device *dev) -{ - EnterFunction("find_pci"); -#ifndef CONFIG_PCI_DIRECT - if (!pcibios_entry) { - pcibios_init(); - } - if (!pcibios_entry) { - printf("pci_init: no BIOS32 detected\n"); - return; - } -#endif - LeaveFunction("find_pci"); - return scan_pci_bus(type, dev); -} diff --git a/usr/src/grub/grub-0.95/netboot/pcnet32.c b/usr/src/grub/grub-0.95/netboot/pcnet32.c deleted file mode 100644 index f7bd1f6d10..0000000000 --- a/usr/src/grub/grub-0.95/netboot/pcnet32.c +++ /dev/null @@ -1,1004 +0,0 @@ -/************************************************************************** -* -* pcnet32.c -- Etherboot device driver for the AMD PCnet32 -* Written 2003-2003 by Timothy Legge -* -* 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. -* -* Portions of this code based on: -* pcnet32.c: An AMD PCnet32 ethernet driver for linux: -* -* (C) 1996-1999 Thomas Bogendoerfer -* See Linux Driver for full information -* -* The transmit and poll functions were written with reference to: -* lance.c - LANCE NIC driver for Etherboot written by Ken Yap -* -* Linux Driver Version 1.27a, 10.02.2002 -* -* -* REVISION HISTORY: -* ================ -* v1.0 08-06-2003 timlegge Initial port of Linux driver -* v1.1 08-23-2003 timlegge Add multicast support -* v1.2 01-17-2004 timlegge Initial driver output cleanup -* v1.3 03-29-2004 timlegge More driver cleanup -* -* Indent Options: indent -kr -i8 -***************************************************************************/ - -/* to get some global routines like printf */ -#include "etherboot.h" -/* to get the interface to the body of the program */ -#include "nic.h" -/* to get the PCI support functions, if this is a PCI NIC */ -#include "pci.h" -/* Include the time functions */ -#include "timer.h" -#include "mii.h" -/* void hex_dump(const char *data, const unsigned int len); */ - -/* Etherboot Specific definations */ -#define drv_version "v1.3" -#define drv_date "03-29-2004" - -typedef unsigned char u8; -typedef signed char s8; -typedef unsigned short u16; -typedef signed short s16; -typedef unsigned int u32; -typedef signed int s32; - -static u32 ioaddr; /* Globally used for the card's io address */ - -#ifdef EDEBUG -#define dprintf(x) printf x -#else -#define dprintf(x) -#endif - -/* Condensed operations for readability. */ -#define virt_to_le32desc(addr) cpu_to_le32(virt_to_bus(addr)) -#define le32desc_to_virt(addr) bus_to_virt(le32_to_cpu(addr)) - -/* End Etherboot Specific */ - -int cards_found /* __initdata */ ; - -#ifdef REMOVE -/* FIXME: Remove these they are probably pointless */ - -/* - * VLB I/O addresses - */ -static unsigned int pcnet32_portlist[] /*__initdata */ = -{ 0x300, 0x320, 0x340, 0x360, 0 }; - -static int pcnet32_debug = 1; -static int tx_start = 1; /* Mapping -- 0:20, 1:64, 2:128, 3:~220 (depends on chip vers) */ -static int pcnet32vlb; /* check for VLB cards ? */ - -static struct net_device *pcnet32_dev; - -static int max_interrupt_work = 80; -static int rx_copybreak = 200; -#endif -#define PCNET32_PORT_AUI 0x00 -#define PCNET32_PORT_10BT 0x01 -#define PCNET32_PORT_GPSI 0x02 -#define PCNET32_PORT_MII 0x03 - -#define PCNET32_PORT_PORTSEL 0x03 -#define PCNET32_PORT_ASEL 0x04 -#define PCNET32_PORT_100 0x40 -#define PCNET32_PORT_FD 0x80 - -#define PCNET32_DMA_MASK 0xffffffff - -/* - * table to translate option values from tulip - * to internal options - */ -static unsigned char options_mapping[] = { - PCNET32_PORT_ASEL, /* 0 Auto-select */ - PCNET32_PORT_AUI, /* 1 BNC/AUI */ - PCNET32_PORT_AUI, /* 2 AUI/BNC */ - PCNET32_PORT_ASEL, /* 3 not supported */ - PCNET32_PORT_10BT | PCNET32_PORT_FD, /* 4 10baseT-FD */ - PCNET32_PORT_ASEL, /* 5 not supported */ - PCNET32_PORT_ASEL, /* 6 not supported */ - PCNET32_PORT_ASEL, /* 7 not supported */ - PCNET32_PORT_ASEL, /* 8 not supported */ - PCNET32_PORT_MII, /* 9 MII 10baseT */ - PCNET32_PORT_MII | PCNET32_PORT_FD, /* 10 MII 10baseT-FD */ - PCNET32_PORT_MII, /* 11 MII (autosel) */ - PCNET32_PORT_10BT, /* 12 10BaseT */ - PCNET32_PORT_MII | PCNET32_PORT_100, /* 13 MII 100BaseTx */ - PCNET32_PORT_MII | PCNET32_PORT_100 | PCNET32_PORT_FD, /* 14 MII 100BaseTx-FD */ - PCNET32_PORT_ASEL /* 15 not supported */ -}; - -#define MAX_UNITS 8 /* More are supported, limit only on options */ -static int options[MAX_UNITS]; -static int full_duplex[MAX_UNITS]; - -/* - * Theory of Operation - * - * This driver uses the same software structure as the normal lance - * driver. So look for a verbose description in lance.c. The differences - * to the normal lance driver is the use of the 32bit mode of PCnet32 - * and PCnetPCI chips. Because these chips are 32bit chips, there is no - * 16MB limitation and we don't need bounce buffers. - */ - - - -/* - * Set the number of Tx and Rx buffers, using Log_2(# buffers). - * Reasonable default values are 4 Tx buffers, and 16 Rx buffers. - * That translates to 2 (4 == 2^^2) and 4 (16 == 2^^4). - */ -#ifndef PCNET32_LOG_TX_BUFFERS -#define PCNET32_LOG_TX_BUFFERS 1 -#define PCNET32_LOG_RX_BUFFERS 2 -#endif - -#define TX_RING_SIZE (1 << (PCNET32_LOG_TX_BUFFERS)) -#define TX_RING_MOD_MASK (TX_RING_SIZE - 1) -/* FIXME: Fix this to allow multiple tx_ring descriptors */ -#define TX_RING_LEN_BITS 0x0000 /*PCNET32_LOG_TX_BUFFERS) << 12) */ - -#define RX_RING_SIZE (1 << (PCNET32_LOG_RX_BUFFERS)) -#define RX_RING_MOD_MASK (RX_RING_SIZE - 1) -#define RX_RING_LEN_BITS ((PCNET32_LOG_RX_BUFFERS) << 4) - -#define PKT_BUF_SZ 1544 - -/* Offsets from base I/O address. */ -#define PCNET32_WIO_RDP 0x10 -#define PCNET32_WIO_RAP 0x12 -#define PCNET32_WIO_RESET 0x14 -#define PCNET32_WIO_BDP 0x16 - -#define PCNET32_DWIO_RDP 0x10 -#define PCNET32_DWIO_RAP 0x14 -#define PCNET32_DWIO_RESET 0x18 -#define PCNET32_DWIO_BDP 0x1C - -#define PCNET32_TOTAL_SIZE 0x20 - -/* Buffers for the tx and Rx */ - -/* Create a static buffer of size PKT_BUF_SZ for each -TX Descriptor. All descriptors point to a -part of this buffer */ -static unsigned char txb[PKT_BUF_SZ * TX_RING_SIZE]; -// __attribute__ ((aligned(16))); - -/* Create a static buffer of size PKT_BUF_SZ for each -RX Descriptor All descriptors point to a -part of this buffer */ -static unsigned char rxb[RX_RING_SIZE * PKT_BUF_SZ]; -// __attribute__ ((aligned(16))); - -/* The PCNET32 Rx and Tx ring descriptors. */ -struct pcnet32_rx_head { - u32 base; - s16 buf_length; - s16 status; - u32 msg_length; - u32 reserved; -}; - -struct pcnet32_tx_head { - u32 base; - s16 length; - s16 status; - u32 misc; - u32 reserved; -}; - -/* The PCNET32 32-Bit initialization block, described in databook. */ -struct pcnet32_init_block { - u16 mode; - u16 tlen_rlen; - u8 phys_addr[6]; - u16 reserved; - u32 filter[2]; - /* Receive and transmit ring base, along with extra bits. */ - u32 rx_ring; - u32 tx_ring; -}; -/* PCnet32 access functions */ -struct pcnet32_access { - u16(*read_csr) (unsigned long, int); - void (*write_csr) (unsigned long, int, u16); - u16(*read_bcr) (unsigned long, int); - void (*write_bcr) (unsigned long, int, u16); - u16(*read_rap) (unsigned long); - void (*write_rap) (unsigned long, u16); - void (*reset) (unsigned long); -}; - -/* Define the TX Descriptor */ -static struct pcnet32_tx_head tx_ring[TX_RING_SIZE] - __attribute__ ((aligned(16))); - - -/* Define the RX Descriptor */ -static struct pcnet32_rx_head rx_ring[RX_RING_SIZE] - __attribute__ ((aligned(16))); - -/* May need to be moved to mii.h */ -struct mii_if_info { - int phy_id; - int advertising; - unsigned int full_duplex:1; /* is full duplex? */ -}; - -/* - * The first three fields of pcnet32_private are read by the ethernet device - * so we allocate the structure should be allocated by pci_alloc_consistent(). - */ -#define MII_CNT 4 -struct pcnet32_private { - struct pcnet32_init_block init_block; - struct pci_dev *pci_dev; /* Pointer to the associated pci device structure */ - const char *name; - /* The saved address of a sent-in-place packet/buffer, for skfree(). */ - struct sk_buff *tx_skbuff[TX_RING_SIZE]; - struct sk_buff *rx_skbuff[RX_RING_SIZE]; - struct pcnet32_access a; - unsigned int cur_rx, cur_tx; /* The next free ring entry */ - char tx_full; - int options; - int shared_irq:1, /* shared irq possible */ - ltint:1, /* enable TxDone-intr inhibitor */ - dxsuflo:1, /* disable transmit stop on uflo */ - mii:1; /* mii port available */ - struct mii_if_info mii_if; - unsigned char phys[MII_CNT]; - struct net_device *next; - int full_duplex:1; -} lpx; - -static struct pcnet32_private *lp; - -static int mdio_read(struct nic *nic __unused, int phy_id, int reg_num); -#if 0 -static void mdio_write(struct nic *nic __unused, int phy_id, int reg_num, - int val); -#endif -enum pci_flags_bit { - PCI_USES_IO = 1, PCI_USES_MEM = 2, PCI_USES_MASTER = 4, - PCI_ADDR0 = 0x10 << 0, PCI_ADDR1 = 0x10 << 1, PCI_ADDR2 = - 0x10 << 2, PCI_ADDR3 = 0x10 << 3, -}; - - -static u16 pcnet32_wio_read_csr(unsigned long addr, int index) -{ - outw(index, addr + PCNET32_WIO_RAP); - return inw(addr + PCNET32_WIO_RDP); -} - -static void pcnet32_wio_write_csr(unsigned long addr, int index, u16 val) -{ - outw(index, addr + PCNET32_WIO_RAP); - outw(val, addr + PCNET32_WIO_RDP); -} - -static u16 pcnet32_wio_read_bcr(unsigned long addr, int index) -{ - outw(index, addr + PCNET32_WIO_RAP); - return inw(addr + PCNET32_WIO_BDP); -} - -static void pcnet32_wio_write_bcr(unsigned long addr, int index, u16 val) -{ - outw(index, addr + PCNET32_WIO_RAP); - outw(val, addr + PCNET32_WIO_BDP); -} - -static u16 pcnet32_wio_read_rap(unsigned long addr) -{ - return inw(addr + PCNET32_WIO_RAP); -} - -static void pcnet32_wio_write_rap(unsigned long addr, u16 val) -{ - outw(val, addr + PCNET32_WIO_RAP); -} - -static void pcnet32_wio_reset(unsigned long addr) -{ - inw(addr + PCNET32_WIO_RESET); -} - -static int pcnet32_wio_check(unsigned long addr) -{ - outw(88, addr + PCNET32_WIO_RAP); - return (inw(addr + PCNET32_WIO_RAP) == 88); -} - -static struct pcnet32_access pcnet32_wio = { - read_csr:pcnet32_wio_read_csr, - write_csr:pcnet32_wio_write_csr, - read_bcr:pcnet32_wio_read_bcr, - write_bcr:pcnet32_wio_write_bcr, - read_rap:pcnet32_wio_read_rap, - write_rap:pcnet32_wio_write_rap, - reset:pcnet32_wio_reset -}; - -static u16 pcnet32_dwio_read_csr(unsigned long addr, int index) -{ - outl(index, addr + PCNET32_DWIO_RAP); - return (inl(addr + PCNET32_DWIO_RDP) & 0xffff); -} - -static void pcnet32_dwio_write_csr(unsigned long addr, int index, u16 val) -{ - outl(index, addr + PCNET32_DWIO_RAP); - outl(val, addr + PCNET32_DWIO_RDP); -} - -static u16 pcnet32_dwio_read_bcr(unsigned long addr, int index) -{ - outl(index, addr + PCNET32_DWIO_RAP); - return (inl(addr + PCNET32_DWIO_BDP) & 0xffff); -} - -static void pcnet32_dwio_write_bcr(unsigned long addr, int index, u16 val) -{ - outl(index, addr + PCNET32_DWIO_RAP); - outl(val, addr + PCNET32_DWIO_BDP); -} - -static u16 pcnet32_dwio_read_rap(unsigned long addr) -{ - return (inl(addr + PCNET32_DWIO_RAP) & 0xffff); -} - -static void pcnet32_dwio_write_rap(unsigned long addr, u16 val) -{ - outl(val, addr + PCNET32_DWIO_RAP); -} - -static void pcnet32_dwio_reset(unsigned long addr) -{ - inl(addr + PCNET32_DWIO_RESET); -} - -static int pcnet32_dwio_check(unsigned long addr) -{ - outl(88, addr + PCNET32_DWIO_RAP); - return ((inl(addr + PCNET32_DWIO_RAP) & 0xffff) == 88); -} - -static struct pcnet32_access pcnet32_dwio = { - read_csr:pcnet32_dwio_read_csr, - write_csr:pcnet32_dwio_write_csr, - read_bcr:pcnet32_dwio_read_bcr, - write_bcr:pcnet32_dwio_write_bcr, - read_rap:pcnet32_dwio_read_rap, - write_rap:pcnet32_dwio_write_rap, - reset:pcnet32_dwio_reset -}; - - -/* Initialize the PCNET32 Rx and Tx rings. */ -static int pcnet32_init_ring(struct nic *nic) -{ - int i; - - lp->tx_full = 0; - lp->cur_rx = lp->cur_tx = 0; - - for (i = 0; i < RX_RING_SIZE; i++) { - rx_ring[i].base = (u32) virt_to_le32desc(&rxb[i]); - rx_ring[i].buf_length = le16_to_cpu(-PKT_BUF_SZ); - rx_ring[i].status = le16_to_cpu(0x8000); - } - - /* The Tx buffer address is filled in as needed, but we do need to clear - the upper ownership bit. */ - for (i = 0; i < TX_RING_SIZE; i++) { - tx_ring[i].base = 0; - tx_ring[i].status = 0; - } - - - lp->init_block.tlen_rlen = - le16_to_cpu(TX_RING_LEN_BITS | RX_RING_LEN_BITS); - for (i = 0; i < 6; i++) - lp->init_block.phys_addr[i] = nic->node_addr[i]; - lp->init_block.rx_ring = (u32) virt_to_le32desc(&rx_ring[0]); - lp->init_block.tx_ring = (u32) virt_to_le32desc(&tx_ring[0]); - return 0; -} - -/************************************************************************** -RESET - Reset adapter -***************************************************************************/ -static void pcnet32_reset(struct nic *nic) -{ - /* put the card in its initial state */ - u16 val; - int i; - - /* Reset the PCNET32 */ - lp->a.reset(ioaddr); - - /* switch pcnet32 to 32bit mode */ - lp->a.write_bcr(ioaddr, 20, 2); - - /* set/reset autoselect bit */ - val = lp->a.read_bcr(ioaddr, 2) & ~2; - if (lp->options & PCNET32_PORT_ASEL) - val |= 2; - lp->a.write_bcr(ioaddr, 2, val); - /* handle full duplex setting */ - if (lp->full_duplex) { - val = lp->a.read_bcr(ioaddr, 9) & ~3; - if (lp->options & PCNET32_PORT_FD) { - val |= 1; - if (lp->options == - (PCNET32_PORT_FD | PCNET32_PORT_AUI)) - val |= 2; - } else if (lp->options & PCNET32_PORT_ASEL) { - /* workaround of xSeries250, turn on for 79C975 only */ - i = ((lp->a. - read_csr(ioaddr, - 88) | (lp->a.read_csr(ioaddr, - 89) << 16)) >> - 12) & 0xffff; - if (i == 0x2627) - val |= 3; - } - lp->a.write_bcr(ioaddr, 9, val); - } - - /* set/reset GPSI bit in test register */ - val = lp->a.read_csr(ioaddr, 124) & ~0x10; - if ((lp->options & PCNET32_PORT_PORTSEL) == PCNET32_PORT_GPSI) - val |= 0x10; - lp->a.write_csr(ioaddr, 124, val); - - if (lp->mii && !(lp->options & PCNET32_PORT_ASEL)) { - val = lp->a.read_bcr(ioaddr, 32) & ~0x38; /* disable Auto Negotiation, set 10Mpbs, HD */ - if (lp->options & PCNET32_PORT_FD) - val |= 0x10; - if (lp->options & PCNET32_PORT_100) - val |= 0x08; - lp->a.write_bcr(ioaddr, 32, val); - } else { - if (lp->options & PCNET32_PORT_ASEL) { /* enable auto negotiate, setup, disable fd */ - val = lp->a.read_bcr(ioaddr, 32) & ~0x98; - val |= 0x20; - lp->a.write_bcr(ioaddr, 32, val); - } - } - -#ifdef DO_DXSUFLO - if (lp->dxsuflo) { /* Disable transmit stop on underflow */ - val = lp->a.read_csr(ioaddr, 3); - val |= 0x40; - lp->a.write_csr(ioaddr, 3, val); - } -#endif - - if (lp->ltint) { /* Enable TxDone-intr inhibitor */ - val = lp->a.read_csr(ioaddr, 5); - val |= (1 << 14); - lp->a.write_csr(ioaddr, 5, val); - } - lp->init_block.mode = - le16_to_cpu((lp->options & PCNET32_PORT_PORTSEL) << 7); - lp->init_block.filter[0] = 0xffffffff; - lp->init_block.filter[1] = 0xffffffff; - - pcnet32_init_ring(nic); - - - /* Re-initialize the PCNET32, and start it when done. */ - lp->a.write_csr(ioaddr, 1, - (virt_to_bus(&lp->init_block)) & 0xffff); - lp->a.write_csr(ioaddr, 2, (virt_to_bus(&lp->init_block)) >> 16); - lp->a.write_csr(ioaddr, 4, 0x0915); - lp->a.write_csr(ioaddr, 0, 0x0001); - - - i = 0; - while (i++ < 100) - if (lp->a.read_csr(ioaddr, 0) & 0x0100) - break; - /* - * We used to clear the InitDone bit, 0x0100, here but Mark Stockton - * reports that doing so triggers a bug in the '974. - */ - lp->a.write_csr(ioaddr, 0, 0x0042); - - dprintf(("pcnet32 open, csr0 %hX.\n", lp->a.read_csr(ioaddr, 0))); - -} - -/************************************************************************** -POLL - Wait for a frame -***************************************************************************/ -static int pcnet32_poll(struct nic *nic __unused, int retrieve) -{ - /* return true if there's an ethernet packet ready to read */ - /* nic->packet should contain data on return */ - /* nic->packetlen should contain length of data */ - - int status; - int entry; - - entry = lp->cur_rx & RX_RING_MOD_MASK; - status = ((short) le16_to_cpu(rx_ring[entry].status) >> 8); - - if (status < 0) - return 0; - - if ( ! retrieve ) return 1; - - if (status == 0x03) { - nic->packetlen = - (le32_to_cpu(rx_ring[entry].msg_length) & 0xfff) - 4; - memcpy(nic->packet, &rxb[entry], nic->packetlen); - - /* Andrew Boyd of QNX reports that some revs of the 79C765 - * clear the buffer length */ - rx_ring[entry].buf_length = le16_to_cpu(-PKT_BUF_SZ); - rx_ring[entry].status |= le16_to_cpu(0x8000); /* prime for next receive */ - /* Switch to the next Rx ring buffer */ - lp->cur_rx++; - - } else { - return 0; - } - - return 1; -} - -/************************************************************************** -TRANSMIT - Transmit a frame -***************************************************************************/ -static void pcnet32_transmit(struct nic *nic __unused, const char *d, /* Destination */ - unsigned int t, /* Type */ - unsigned int s, /* size */ - const char *p) -{ /* Packet */ - /* send the packet to destination */ - unsigned long time; - u8 *ptxb; - u16 nstype; - u16 status; - int entry = 0; /*lp->cur_tx & TX_RING_MOD_MASK; */ - - status = 0x8300; - /* point to the current txb incase multiple tx_rings are used */ - ptxb = txb + (lp->cur_tx * PKT_BUF_SZ); - - /* copy the packet to ring buffer */ - memcpy(ptxb, d, ETH_ALEN); /* dst */ - memcpy(ptxb + ETH_ALEN, nic->node_addr, ETH_ALEN); /* src */ - nstype = htons((u16) t); /* type */ - memcpy(ptxb + 2 * ETH_ALEN, (u8 *) & nstype, 2); /* type */ - memcpy(ptxb + ETH_HLEN, p, s); - - s += ETH_HLEN; - while (s < ETH_ZLEN) /* pad to min length */ - ptxb[s++] = '\0'; - - tx_ring[entry].length = le16_to_cpu(-s); - tx_ring[entry].misc = 0x00000000; - tx_ring[entry].base = (u32) virt_to_le32desc(ptxb); - - /* we set the top byte as the very last thing */ - tx_ring[entry].status = le16_to_cpu(status); - - - /* Trigger an immediate send poll */ - lp->a.write_csr(ioaddr, 0, 0x0048); - - /* wait for transmit complete */ - lp->cur_tx = 0; /* (lp->cur_tx + 1); */ - time = currticks() + TICKS_PER_SEC; /* wait one second */ - while (currticks() < time && - ((short) le16_to_cpu(tx_ring[entry].status) < 0)); - - if ((short) le16_to_cpu(tx_ring[entry].status) < 0) - printf("PCNET32 timed out on transmit\n"); - - /* Stop pointing at the current txb - * otherwise the card continues to send the packet */ - tx_ring[entry].base = 0; - -} - -/************************************************************************** -DISABLE - Turn off ethernet interface -***************************************************************************/ -static void pcnet32_disable(struct dev *dev __unused) -{ - /* Stop the PCNET32 here -- it ocassionally polls memory if we don't */ - lp->a.write_csr(ioaddr, 0, 0x0004); - - /* - * Switch back to 16-bit mode to avoid problesm with dumb - * DOS packet driver after a warm reboot - */ - lp->a.write_bcr(ioaddr, 20, 4); -} - -/************************************************************************** -IRQ - Enable, Disable, or Force interrupts -***************************************************************************/ -static void pcnet32_irq(struct nic *nic __unused, irq_action_t action __unused) -{ - switch ( action ) { - case DISABLE : - break; - case ENABLE : - break; - case FORCE : - break; - } -} - -/************************************************************************** -PROBE - Look for an adapter, this routine's visible to the outside -You should omit the last argument struct pci_device * for a non-PCI NIC -***************************************************************************/ -static int pcnet32_probe(struct dev *dev, struct pci_device *pci) -{ - struct nic *nic = (struct nic *) dev; - int i, media; - int fdx, mii, fset, dxsuflo, ltint; - int chip_version; - char *chipname; - struct pcnet32_access *a = NULL; - u8 promaddr[6]; - - int shared = 1; - if (pci->ioaddr == 0) - return 0; - - /* BASE is used throughout to address the card */ - ioaddr = pci->ioaddr; - printf("pcnet32.c: Found %s, Vendor=0x%hX Device=0x%hX\n", - pci->name, pci->vendor, pci->dev_id); - - nic->irqno = 0; - nic->ioaddr = pci->ioaddr & ~3; - - /* reset the chip */ - pcnet32_wio_reset(ioaddr); - - /* NOTE: 16-bit check is first, otherwise some older PCnet chips fail */ - if (pcnet32_wio_read_csr(ioaddr, 0) == 4 - && pcnet32_wio_check(ioaddr)) { - a = &pcnet32_wio; - } else { - pcnet32_dwio_reset(ioaddr); - if (pcnet32_dwio_read_csr(ioaddr, 0) == 4 - && pcnet32_dwio_check(ioaddr)) { - a = &pcnet32_dwio; - } else - return 0; - } - - chip_version = - a->read_csr(ioaddr, 88) | (a->read_csr(ioaddr, 89) << 16); - - dprintf(("PCnet chip version is %0xhX\n", chip_version)); - if ((chip_version & 0xfff) != 0x003) - return 0; - - /* initialize variables */ - fdx = mii = fset = dxsuflo = ltint = 0; - chip_version = (chip_version >> 12) & 0xffff; - - switch (chip_version) { - case 0x2420: - chipname = "PCnet/PCI 79C970"; /* PCI */ - break; - case 0x2430: - if (shared) - chipname = "PCnet/PCI 79C970"; /* 970 gives the wrong chip id back */ - else - chipname = "PCnet/32 79C965"; /* 486/VL bus */ - break; - case 0x2621: - chipname = "PCnet/PCI II 79C970A"; /* PCI */ - fdx = 1; - break; - case 0x2623: - chipname = "PCnet/FAST 79C971"; /* PCI */ - fdx = 1; - mii = 1; - fset = 1; - ltint = 1; - break; - case 0x2624: - chipname = "PCnet/FAST+ 79C972"; /* PCI */ - fdx = 1; - mii = 1; - fset = 1; - break; - case 0x2625: - chipname = "PCnet/FAST III 79C973"; /* PCI */ - fdx = 1; - mii = 1; - break; - case 0x2626: - chipname = "PCnet/Home 79C978"; /* PCI */ - fdx = 1; - /* - * This is based on specs published at www.amd.com. This section - * assumes that a card with a 79C978 wants to go into 1Mb HomePNA - * mode. The 79C978 can also go into standard ethernet, and there - * probably should be some sort of module option to select the - * mode by which the card should operate - */ - /* switch to home wiring mode */ - media = a->read_bcr(ioaddr, 49); - - printf("media reset to %#x.\n", media); - a->write_bcr(ioaddr, 49, media); - break; - case 0x2627: - chipname = "PCnet/FAST III 79C975"; /* PCI */ - fdx = 1; - mii = 1; - break; - default: - printf("PCnet version %#x, no PCnet32 chip.\n", - chip_version); - return 0; - } - - /* - * On selected chips turn on the BCR18:NOUFLO bit. This stops transmit - * starting until the packet is loaded. Strike one for reliability, lose - * one for latency - although on PCI this isnt a big loss. Older chips - * have FIFO's smaller than a packet, so you can't do this. - */ - - if (fset) { - a->write_bcr(ioaddr, 18, - (a->read_bcr(ioaddr, 18) | 0x0800)); - a->write_csr(ioaddr, 80, - (a->read_csr(ioaddr, 80) & 0x0C00) | 0x0c00); - dxsuflo = 1; - ltint = 1; - } - - dprintf(("%s at %hX,", chipname, ioaddr)); - - /* read PROM address */ - for (i = 0; i < 6; i++) - promaddr[i] = inb(ioaddr + i); - - /* Update the nic structure with the MAC Address */ - for (i = 0; i < ETH_ALEN; i++) { - nic->node_addr[i] = promaddr[i]; - } - /* Print out some hardware info */ - printf("%s: %! at ioaddr %hX, ", pci->name, nic->node_addr, - ioaddr); - - /* Set to pci bus master */ - adjust_pci_device(pci); - - /* point to private storage */ - lp = &lpx; - -#if EBDEBUG - if (((chip_version + 1) & 0xfffe) == 0x2624) { /* Version 0x2623 or 0x2624 */ - i = a->read_csr(ioaddr, 80) & 0x0C00; /* Check tx_start_pt */ - dprintf((" tx_start_pt(0x%hX):", i)); - switch (i >> 10) { - case 0: - dprintf((" 20 bytes,")); - break; - case 1: - dprintf((" 64 bytes,")); - break; - case 2: - dprintf((" 128 bytes,")); - break; - case 3: - dprintf(("~220 bytes,")); - break; - } - i = a->read_bcr(ioaddr, 18); /* Check Burst/Bus control */ - dprintf((" BCR18(%hX):", i & 0xffff)); - if (i & (1 << 5)) - dprintf(("BurstWrEn ")); - if (i & (1 << 6)) - dprintf(("BurstRdEn ")); - if (i & (1 << 7)) - dprintf(("DWordIO ")); - if (i & (1 << 11)) - dprintf(("NoUFlow ")); - i = a->read_bcr(ioaddr, 25); - dprintf((" SRAMSIZE=0x%hX,", i << 8)); - i = a->read_bcr(ioaddr, 26); - dprintf((" SRAM_BND=0x%hX,", i << 8)); - i = a->read_bcr(ioaddr, 27); - if (i & (1 << 14)) - dprintf(("LowLatRx")); - } -#endif - lp->name = chipname; - lp->shared_irq = shared; - lp->full_duplex = fdx; - lp->dxsuflo = dxsuflo; - lp->ltint = ltint; - lp->mii = mii; - /* FIXME: Fix Options for only one card */ - if ((cards_found >= MAX_UNITS) - || ((unsigned int) options[cards_found] > sizeof(options_mapping))) - lp->options = PCNET32_PORT_ASEL; - else - lp->options = options_mapping[options[cards_found]]; - - if (fdx && !(lp->options & PCNET32_PORT_ASEL) && - ((cards_found >= MAX_UNITS) || full_duplex[cards_found])) - lp->options |= PCNET32_PORT_FD; - - if (!a) { - printf("No access methods\n"); - return 0; - } - lp->a = *a; - - /* detect special T1/E1 WAN card by checking for MAC address */ - if (nic->node_addr[0] == 0x00 && nic->node_addr[1] == 0xe0 - && nic->node_addr[2] == 0x75) - lp->options = PCNET32_PORT_FD | PCNET32_PORT_GPSI; - - lp->init_block.mode = le16_to_cpu(0x0003); /* Disable Rx and Tx. */ - lp->init_block.tlen_rlen = - le16_to_cpu(TX_RING_LEN_BITS | RX_RING_LEN_BITS); - for (i = 0; i < 6; i++) - lp->init_block.phys_addr[i] = nic->node_addr[i]; - lp->init_block.filter[0] = 0xffffffff; - lp->init_block.filter[1] = 0xffffffff; - lp->init_block.rx_ring = virt_to_bus(&rx_ring); - lp->init_block.tx_ring = virt_to_bus(&tx_ring); - - /* switch pcnet32 to 32bit mode */ - a->write_bcr(ioaddr, 20, 2); - - - a->write_csr(ioaddr, 1, (virt_to_bus(&lp->init_block)) & 0xffff); - a->write_csr(ioaddr, 2, (virt_to_bus(&lp->init_block)) >> 16); - - /* - * To auto-IRQ we enable the initialization-done and DMA error - * interrupts. For ISA boards we get a DMA error, but VLB and PCI - * boards will work. - */ - /* Trigger an initialization just for the interrupt. */ - - a->write_csr(ioaddr, 0, 0x41); - mdelay(1); - - cards_found++; - - /* point to NIC specific routines */ - pcnet32_reset(nic); - if (1) { - int tmp; - int phy, phy_idx = 0; - u16 mii_lpa; - lp->phys[0] = 1; /* Default Setting */ - for (phy = 1; phy < 32 && phy_idx < MII_CNT; phy++) { - int mii_status = mdio_read(nic, phy, MII_BMSR); - if (mii_status != 0xffff && mii_status != 0x0000) { - lp->phys[phy_idx++] = phy; - lp->mii_if.advertising = - mdio_read(nic, phy, MII_ADVERTISE); - if ((mii_status & 0x0040) == 0) { - tmp = phy; - dprintf (("MII PHY found at address %d, status " - "%hX advertising %hX\n", phy, mii_status, - lp->mii_if.advertising)); - } - } - } - if (phy_idx == 0) - printf("No MII transceiver found!\n"); - lp->mii_if.phy_id = lp->phys[0]; - - lp->mii_if.advertising = - mdio_read(nic, lp->phys[0], MII_ADVERTISE); - - mii_lpa = mdio_read(nic, lp->phys[0], MII_LPA); - lp->mii_if.advertising &= mii_lpa; - if (lp->mii_if.advertising & ADVERTISE_100FULL) - printf("100Mbps Full-Duplex\n"); - else if (lp->mii_if.advertising & ADVERTISE_100HALF) - printf("100Mbps Half-Duplex\n"); - else if (lp->mii_if.advertising & ADVERTISE_10FULL) - printf("10Mbps Full-Duplex\n"); - else if (lp->mii_if.advertising & ADVERTISE_10HALF) - printf("10Mbps Half-Duplex\n"); - else - printf("\n"); - } - - nic->poll = pcnet32_poll; - nic->transmit = pcnet32_transmit; - dev->disable = pcnet32_disable; - nic->irq = pcnet32_irq; - - return 1; -} -static int mdio_read(struct nic *nic __unused, int phy_id, int reg_num) -{ - u16 val_out; - int phyaddr; - - if (!lp->mii) - return 0; - - phyaddr = lp->a.read_bcr(ioaddr, 33); - - lp->a.write_bcr(ioaddr, 33, - ((phy_id & 0x1f) << 5) | (reg_num & 0x1f)); - val_out = lp->a.read_bcr(ioaddr, 34); - lp->a.write_bcr(ioaddr, 33, phyaddr); - - return val_out; -} - -#if 0 -static void mdio_write(struct nic *nic __unused, int phy_id, int reg_num, - int val) -{ - int phyaddr; - - if (!lp->mii) - return; - - phyaddr = lp->a.read_bcr(ioaddr, 33); - - lp->a.write_bcr(ioaddr, 33, - ((phy_id & 0x1f) << 5) | (reg_num & 0x1f)); - lp->a.write_bcr(ioaddr, 34, val); - lp->a.write_bcr(ioaddr, 33, phyaddr); -} -#endif - -static struct pci_id pcnet32_nics[] = { - PCI_ROM(0x1022, 0x2000, "lancepci", "AMD Lance/PCI"), - PCI_ROM(0x1022, 0x2625, "pcnetfastiii", "AMD Lance/PCI PCNet/32"), - PCI_ROM(0x1022, 0x2001, "amdhomepna", "AMD Lance/HomePNA"), -}; - -struct pci_driver pcnet32_driver = { - .type = NIC_DRIVER, - .name = "PCNET32/PCI", - .probe = pcnet32_probe, - .ids = pcnet32_nics, - .id_count = sizeof(pcnet32_nics) / sizeof(pcnet32_nics[0]), - .class = 0, -}; diff --git a/usr/src/grub/grub-0.95/netboot/pic8259.c b/usr/src/grub/grub-0.95/netboot/pic8259.c deleted file mode 100644 index 25002d9b82..0000000000 --- a/usr/src/grub/grub-0.95/netboot/pic8259.c +++ /dev/null @@ -1,205 +0,0 @@ -/* - * Basic support for controlling the 8259 Programmable Interrupt Controllers. - * - * Initially written by Michael Brown (mcb30). - */ - -#include -#include - -#ifdef DEBUG_IRQ -#define DBG(...) printf ( __VA_ARGS__ ) -#else -#define DBG(...) -#endif - -/* Install a handler for the specified IRQ. Address of previous - * handler will be stored in previous_handler. Enabled/disabled state - * of IRQ will be preserved across call, therefore if the handler does - * chaining, ensure that either (a) IRQ is disabled before call, or - * (b) previous_handler points directly to the place that the handler - * picks up its chain-to address. - */ - -int install_irq_handler ( irq_t irq, segoff_t *handler, - uint8_t *previously_enabled, - segoff_t *previous_handler ) { - segoff_t *irq_vector = IRQ_VECTOR ( irq ); - *previously_enabled = irq_enabled ( irq ); - - if ( irq > IRQ_MAX ) { - DBG ( "Invalid IRQ number %d\n" ); - return 0; - } - - previous_handler->segment = irq_vector->segment; - previous_handler->offset = irq_vector->offset; - if ( *previously_enabled ) disable_irq ( irq ); - DBG ( "Installing handler at %hx:%hx for IRQ %d, leaving %s\n", - handler->segment, handler->offset, irq, - ( *previously_enabled ? "enabled" : "disabled" ) ); - DBG ( "...(previous handler at %hx:%hx)\n", - previous_handler->segment, previous_handler->offset ); - irq_vector->segment = handler->segment; - irq_vector->offset = handler->offset; - if ( *previously_enabled ) enable_irq ( irq ); - return 1; -} - -/* Remove handler for the specified IRQ. Routine checks that another - * handler has not been installed that chains to handler before - * uninstalling handler. Enabled/disabled state of the IRQ will be - * restored to that specified by previously_enabled. - */ - -int remove_irq_handler ( irq_t irq, segoff_t *handler, - uint8_t *previously_enabled, - segoff_t *previous_handler ) { - segoff_t *irq_vector = IRQ_VECTOR ( irq ); - - if ( irq > IRQ_MAX ) { - DBG ( "Invalid IRQ number %d\n" ); - return 0; - } - if ( ( irq_vector->segment != handler->segment ) || - ( irq_vector->offset != handler->offset ) ) { - DBG ( "Cannot remove handler for IRQ %d\n" ); - return 0; - } - - DBG ( "Removing handler for IRQ %d\n", irq ); - disable_irq ( irq ); - irq_vector->segment = previous_handler->segment; - irq_vector->offset = previous_handler->offset; - if ( *previously_enabled ) enable_irq ( irq ); - return 1; -} - -/* Send specific EOI(s). - */ - -void send_specific_eoi ( irq_t irq ) { - DBG ( "Sending specific EOI for IRQ %d\n", irq ); - outb ( ICR_EOI_SPECIFIC | ICR_VALUE(irq), ICR_REG(irq) ); - if ( irq >= IRQ_PIC_CUTOFF ) { - outb ( ICR_EOI_SPECIFIC | ICR_VALUE(CHAINED_IRQ), - ICR_REG(CHAINED_IRQ) ); - } -} - -/* Dump current 8259 status: enabled IRQs and handler addresses. - */ - -#ifdef DEBUG_IRQ -void dump_irq_status (void) { - int irq = 0; - - for ( irq = 0; irq < 16; irq++ ) { - if ( irq_enabled ( irq ) ) { - printf ( "IRQ%d enabled, ISR at %hx:%hx\n", irq, - IRQ_VECTOR(irq)->segment, - IRQ_VECTOR(irq)->offset ); - } - } -} -#endif - -/******************************************************************** - * UNDI interrupt handling - * This essentially follows the defintion of the trivial interrupt - * handler routines. The text is assumed to locate in base memory. - */ -void (*undi_irq_handler)P((void)) = _undi_irq_handler; -uint16_t volatile *undi_irq_trigger_count = &_undi_irq_trigger_count; -segoff_t *undi_irq_chain_to = &_undi_irq_chain_to; -uint8_t *undi_irq_chain = &_undi_irq_chain; -irq_t undi_irq_installed_on = IRQ_NONE; - -/* UNDI entry point and irq, used by interrupt handler - */ -segoff_t *pxenv_undi_entrypointsp = &_pxenv_undi_entrypointsp; -uint8_t *pxenv_undi_irq = &_pxenv_undi_irq; - -/* Previous trigger count for undi IRQ handler */ -static uint16_t undi_irq_previous_trigger_count = 0; - -/* Install the undi IRQ handler. Don't test as UNDI has not be opened. - */ - -int install_undi_irq_handler ( irq_t irq, segoff_t entrypointsp ) { - segoff_t undi_irq_handler_segoff = SEGOFF(undi_irq_handler); - - if ( undi_irq_installed_on != IRQ_NONE ) { - DBG ( "Can install undi IRQ handler only once\n" ); - return 0; - } - if ( SEGMENT(undi_irq_handler) > 0xffff ) { - DBG ( "Trivial IRQ handler not in base memory\n" ); - return 0; - } - - DBG ( "Installing undi IRQ handler on IRQ %d\n", irq ); - *pxenv_undi_entrypointsp = entrypointsp; - *pxenv_undi_irq = irq; - if ( ! install_irq_handler ( irq, &undi_irq_handler_segoff, - undi_irq_chain, - undi_irq_chain_to ) ) - return 0; - undi_irq_installed_on = irq; - - DBG ( "Disabling undi IRQ %d\n", irq ); - disable_irq ( irq ); - *undi_irq_trigger_count = 0; - undi_irq_previous_trigger_count = 0; - DBG ( "UNDI IRQ handler installed successfully\n" ); - return 1; -} - -/* Remove the undi IRQ handler. - */ - -int remove_undi_irq_handler ( irq_t irq ) { - segoff_t undi_irq_handler_segoff = SEGOFF(undi_irq_handler); - - if ( undi_irq_installed_on == IRQ_NONE ) return 1; - if ( irq != undi_irq_installed_on ) { - DBG ( "Cannot uninstall undi IRQ handler from IRQ %d; " - "is installed on IRQ %d\n", irq, - undi_irq_installed_on ); - return 0; - } - - if ( ! remove_irq_handler ( irq, &undi_irq_handler_segoff, - undi_irq_chain, - undi_irq_chain_to ) ) - return 0; - - if ( undi_irq_triggered ( undi_irq_installed_on ) ) { - DBG ( "Sending EOI for unwanted undi IRQ\n" ); - send_specific_eoi ( undi_irq_installed_on ); - } - - undi_irq_installed_on = IRQ_NONE; - return 1; -} - -/* Safe method to detect whether or not undi IRQ has been - * triggered. Using this call avoids potential race conditions. This - * call will return success only once per trigger. - */ - -int undi_irq_triggered ( irq_t irq ) { - uint16_t undi_irq_this_trigger_count = *undi_irq_trigger_count; - int triggered = ( undi_irq_this_trigger_count - - undi_irq_previous_trigger_count ); - - /* irq is not used at present, but we have it in the API for - * future-proofing; in case we want the facility to have - * multiple undi IRQ handlers installed simultaneously. - * - * Avoid compiler warning about unused variable. - */ - if ( irq == IRQ_NONE ) {}; - undi_irq_previous_trigger_count = undi_irq_this_trigger_count; - return triggered ? 1 : 0; -} diff --git a/usr/src/grub/grub-0.95/netboot/pic8259.h b/usr/src/grub/grub-0.95/netboot/pic8259.h deleted file mode 100644 index 76cc711a7b..0000000000 --- a/usr/src/grub/grub-0.95/netboot/pic8259.h +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Basic support for controlling the 8259 Programmable Interrupt Controllers. - * - * Initially written by Michael Brown (mcb30). - */ - -#ifndef PIC8259_H -#define PIC8259_H - -/* For segoff_t */ -#include - -#define IRQ_PIC_CUTOFF (8) - -/* 8259 register locations */ -#define PIC1_ICW1 (0x20) -#define PIC1_OCW2 (0x20) -#define PIC1_OCW3 (0x20) -#define PIC1_ICR (0x20) -#define PIC1_IRR (0x20) -#define PIC1_ISR (0x20) -#define PIC1_ICW2 (0x21) -#define PIC1_ICW3 (0x21) -#define PIC1_ICW4 (0x21) -#define PIC1_IMR (0x21) -#define PIC2_ICW1 (0xa0) -#define PIC2_OCW2 (0xa0) -#define PIC2_OCW3 (0xa0) -#define PIC2_ICR (0xa0) -#define PIC2_IRR (0xa0) -#define PIC2_ISR (0xa0) -#define PIC2_ICW2 (0xa1) -#define PIC2_ICW3 (0xa1) -#define PIC2_ICW4 (0xa1) -#define PIC2_IMR (0xa1) - -/* Register command values */ -#define OCW3_ID (0x08) -#define OCW3_READ_IRR (0x03) -#define OCW3_READ_ISR (0x02) -#define ICR_EOI_NON_SPECIFIC (0x20) -#define ICR_EOI_NOP (0x40) -#define ICR_EOI_SPECIFIC (0x60) -#define ICR_EOI_SET_PRIORITY (0xc0) - -/* Macros to enable/disable IRQs */ -#define IMR_REG(x) ( (x) < IRQ_PIC_CUTOFF ? PIC1_IMR : PIC2_IMR ) -#define IMR_BIT(x) ( 1 << ( (x) % IRQ_PIC_CUTOFF ) ) -#define irq_enabled(x) ( ( inb ( IMR_REG(x) ) & IMR_BIT(x) ) == 0 ) -#define enable_irq(x) outb ( inb( IMR_REG(x) ) & ~IMR_BIT(x), IMR_REG(x) ) -#define disable_irq(x) outb ( inb( IMR_REG(x) ) | IMR_BIT(x), IMR_REG(x) ) - -/* Macros for acknowledging IRQs */ -#define ICR_REG(x) ( (x) < IRQ_PIC_CUTOFF ? PIC1_ICR : PIC2_ICR ) -#define ICR_VALUE(x) ( (x) % IRQ_PIC_CUTOFF ) -#define CHAINED_IRQ 2 - -/* Utility macros to convert IRQ numbers to INT numbers and INT vectors */ -#define IRQ_INT(x) ( (x)ioaddr + PNIC_REG_LEN ); - /* Write input data */ - for ( i = 0; i < input_length; i++ ) { - outb( ((char*)input)[i], nic->ioaddr + PNIC_REG_DATA ); - } - } - /* Write command */ - outw ( command, nic->ioaddr + PNIC_REG_CMD ); - /* Retrieve status */ - status = inw ( nic->ioaddr + PNIC_REG_STAT ); - /* Retrieve output length */ - _output_length = inw ( nic->ioaddr + PNIC_REG_LEN ); - if ( output_length == NULL ) { - if ( _output_length != output_max_length ) { - printf ( "pnic_command %#hx: wrong data length " - "returned (expected %d, got %d)\n", command, - output_max_length, _output_length ); - } - } else { - *output_length = _output_length; - } - if ( output != NULL ) { - if ( _output_length > output_max_length ) { - printf ( "pnic_command %#hx: output buffer too small " - "(have %d, need %d)\n", command, - output_max_length, _output_length ); - _output_length = output_max_length; - } - /* Retrieve output data */ - for ( i = 0; i < _output_length; i++ ) { - ((char*)output)[i] = - inb ( nic->ioaddr + PNIC_REG_DATA ); - } - } - return status; -} - -static uint16_t pnic_command ( struct nic *nic, uint16_t command, - void *input, uint16_t input_length, - void *output, uint16_t output_max_length, - uint16_t *output_length ) { - pnic_priv_data_t *priv = (pnic_priv_data_t*)nic->priv_data; - uint16_t status = pnic_command_quiet ( nic, command, - input, input_length, - output, output_max_length, - output_length ); - if ( status == PNIC_STATUS_OK ) return status; - printf ( "PNIC command %#hx (len %#hx) failed with status %#hx\n", - command, input_length, status ); - if ( priv->api_version ) pnic_api_check(priv->api_version); - return status; -} - -/* Check API version matches that of NIC */ -static int pnic_api_check ( uint16_t api_version ) { - if ( api_version != PNIC_API_VERSION ) { - printf ( "Warning: API version mismatch! " - "(NIC's is %d.%d, ours is %d.%d)\n", - api_version >> 8, api_version & 0xff, - PNIC_API_VERSION >> 8, PNIC_API_VERSION & 0xff ); - } - if ( api_version < PNIC_API_VERSION ) { - printf ( "*** You may need to update your copy of Bochs ***\n" ); - } - return ( api_version == PNIC_API_VERSION ); -} - -/************************************************************************** -POLL - Wait for a frame -***************************************************************************/ -static int pnic_poll(struct nic *nic, int retrieve) -{ - uint16_t length; - uint16_t qlen; - - /* Check receive queue length to see if there's anything to - * get. Necessary since once we've called PNIC_CMD_RECV we - * have to read out the packet, otherwise it's lost forever. - */ - if ( pnic_command ( nic, PNIC_CMD_RECV_QLEN, NULL, 0, - &qlen, sizeof(qlen), NULL ) - != PNIC_STATUS_OK ) return ( 0 ); - if ( qlen == 0 ) return ( 0 ); - - /* There is a packet ready. Return 1 if we're only checking. */ - if ( ! retrieve ) return ( 1 ); - - /* Retrieve the packet */ - if ( pnic_command ( nic, PNIC_CMD_RECV, NULL, 0, - nic->packet, ETH_FRAME_LEN, &length ) - != PNIC_STATUS_OK ) return ( 0 ); - nic->packetlen = length; - return ( 1 ); -} - -/************************************************************************** -TRANSMIT - Transmit a frame -***************************************************************************/ -static void pnic_transmit( - struct nic *nic, - const char *dest, /* Destination */ - unsigned int type, /* Type */ - unsigned int size, /* size */ - const char *data) /* Packet */ -{ - unsigned int nstype = htons ( type ); - - if ( ( ETH_HLEN + size ) >= ETH_FRAME_LEN ) { - printf ( "pnic_transmit: packet too large\n" ); - return; - } - - /* Assemble packet */ - memcpy ( tx_buffer, dest, ETH_ALEN ); - memcpy ( tx_buffer + ETH_ALEN, nic->node_addr, ETH_ALEN ); - memcpy ( tx_buffer + 2 * ETH_ALEN, &nstype, 2 ); - memcpy ( tx_buffer + ETH_HLEN, data, size ); - - pnic_command ( nic, PNIC_CMD_XMIT, tx_buffer, ETH_HLEN + size, - NULL, 0, NULL ); -} - -/************************************************************************** -DISABLE - Turn off ethernet interface -***************************************************************************/ -static void pnic_disable(struct dev *dev) -{ - struct nic *nic = (struct nic *)dev; - pnic_command ( nic, PNIC_CMD_RESET, NULL, 0, NULL, 0, NULL ); -} - -/************************************************************************** -IRQ - Handle card interrupt status -***************************************************************************/ -static void pnic_irq ( struct nic *nic, irq_action_t action ) -{ - uint8_t enabled; - - switch ( action ) { - case DISABLE : - case ENABLE : - enabled = ( action == ENABLE ? 1 : 0 ); - pnic_command ( nic, PNIC_CMD_MASK_IRQ, - &enabled, sizeof(enabled), NULL, 0, NULL ); - break; - case FORCE : - pnic_command ( nic, PNIC_CMD_FORCE_IRQ, - NULL, 0, NULL, 0, NULL ); - break; - } -} - -/************************************************************************** -PROBE - Look for an adapter, this routine's visible to the outside -***************************************************************************/ - -static int pnic_probe(struct dev *dev, struct pci_device *pci) -{ - struct nic *nic = (struct nic *)dev; - static pnic_priv_data_t priv; - uint16_t status; - - printf(" - "); - - /* Clear private data structure and chain it in */ - memset ( &priv, 0, sizeof(priv) ); - nic->priv_data = &priv; - - /* Mask the bit that says "this is an io addr" */ - nic->ioaddr = pci->ioaddr & ~3; - nic->irqno = pci->irq; - /* Not sure what this does, but the rtl8139 driver does it */ - adjust_pci_device(pci); - - status = pnic_command_quiet( nic, PNIC_CMD_API_VER, NULL, 0, - &priv.api_version, - sizeof(priv.api_version), NULL ); - if ( status != PNIC_STATUS_OK ) { - printf ( "PNIC failed installation check, code %#hx\n", - status ); - return 0; - } - pnic_api_check(priv.api_version); - status = pnic_command ( nic, PNIC_CMD_READ_MAC, NULL, 0, - nic->node_addr, ETH_ALEN, NULL ); - printf ( "Detected Bochs Pseudo NIC MAC %! (API v%d.%d) at %#hx\n", - nic->node_addr, priv.api_version>>8, priv.api_version&0xff, - nic->ioaddr ); - - /* point to NIC specific routines */ - dev->disable = pnic_disable; - nic->poll = pnic_poll; - nic->transmit = pnic_transmit; - nic->irq = pnic_irq; - return 1; -} - -static struct pci_id pnic_nics[] = { -/* genrules.pl doesn't let us use macros for PCI IDs...*/ -PCI_ROM(0xfefe, 0xefef, "pnic", "Bochs Pseudo NIC Adaptor"), -}; - -struct pci_driver pnic_driver = { - .type = NIC_DRIVER, - .name = "PNIC", - .probe = pnic_probe, - .ids = pnic_nics, - .id_count = sizeof(pnic_nics)/sizeof(pnic_nics[0]), - .class = 0, -}; diff --git a/usr/src/grub/grub-0.95/netboot/pnic_api.h b/usr/src/grub/grub-0.95/netboot/pnic_api.h deleted file mode 100644 index 6d117fa60c..0000000000 --- a/usr/src/grub/grub-0.95/netboot/pnic_api.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Constants etc. for the Bochs/Etherboot pseudo-NIC - * - * This header file must be valid C and C++. - * - * Operation of the pseudo-NIC (PNIC) is pretty simple. To write a - * command plus data, first write the length of the data to - * PNIC_REG_LEN, then write the data a byte at a type to - * PNIC_REG_DATA, then write the command code to PNIC_REG_CMD. The - * status will be available from PNIC_REG_STAT. The length of any - * data returned will be in PNIC_REG_LEN and can be read a byte at a - * time from PNIC_REG_DATA. - */ - -/* - * PCI parameters - */ -#define PNIC_PCI_VENDOR 0xfefe /* Hopefully these won't clash with */ -#define PNIC_PCI_DEVICE 0xefef /* any real PCI device IDs. */ - -/* - * 'Hardware' register addresses, offset from io_base - */ -#define PNIC_REG_CMD 0x00 /* Command register, 2 bytes, write only */ -#define PNIC_REG_STAT 0x00 /* Status register, 2 bytes, read only */ -#define PNIC_REG_LEN 0x02 /* Length register, 2 bytes, read-write */ -#define PNIC_REG_DATA 0x04 /* Data port, 1 byte, read-write */ -/* - * PNIC_MAX_REG used in Bochs to claim i/o space - */ -#define PNIC_MAX_REG 0x04 - -/* - * Command code definitions: write these into PNIC_REG_CMD - */ -#define PNIC_CMD_NOOP 0x0000 -#define PNIC_CMD_API_VER 0x0001 -#define PNIC_CMD_READ_MAC 0x0002 -#define PNIC_CMD_RESET 0x0003 -#define PNIC_CMD_XMIT 0x0004 -#define PNIC_CMD_RECV 0x0005 -#define PNIC_CMD_RECV_QLEN 0x0006 -#define PNIC_CMD_MASK_IRQ 0x0007 -#define PNIC_CMD_FORCE_IRQ 0x0008 - -/* - * Status code definitions: read these from PNIC_REG_STAT - * - * We avoid using status codes that might be confused with - * randomly-read data (e.g. 0x0000, 0xffff etc.) - */ -#define PNIC_STATUS_OK 0x4f4b /* 'OK' */ -#define PNIC_STATUS_UNKNOWN_CMD 0x3f3f /* '??' */ - -/* - * Other miscellaneous information - */ - -#define PNIC_API_VERSION 0x0101 /* 1.1 */ diff --git a/usr/src/grub/grub-0.95/netboot/pxe.h b/usr/src/grub/grub-0.95/netboot/pxe.h deleted file mode 100644 index a266eb7094..0000000000 --- a/usr/src/grub/grub-0.95/netboot/pxe.h +++ /dev/null @@ -1,521 +0,0 @@ -/* - * Copyright (c) 2000 Alfred Perlstein - * All rights reserved. - * Copyright (c) 2000 Paul Saab - * All rights reserved. - * Copyright (c) 2000 John Baldwin - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD: src/sys/boot/i386/libi386/pxe.h,v 1.4.2.2 2000/09/10 02:52:18 ps Exp $ - */ - -/* - * The typedefs and structures declared in this file - * clearly violate style(9), the reason for this is to conform to the - * typedefs/structure-names used in the Intel literature to avoid confusion. - * - * It's for your own good. :) - */ - -/* SEGOFF16_t defined in separate header for Etherboot - */ -#include - -/* It seems that intel didn't think about ABI, - * either that or 16bit ABI != 32bit ABI (which seems reasonable) - * I have to thank Intel for the hair loss I incurred trying to figure - * out why PXE was mis-reading structures I was passing it (at least - * from my point of view) - * - * Solution: use gcc's '__attribute__ ((packed))' to correctly align - * structures passed into PXE - * Question: does this really work for PXE's expected ABI? - */ -#define PACKED __attribute__ ((packed)) - -#define S_SIZE(s) s, sizeof(s) - 1 - -#define IP_STR "%d.%d.%d.%d" -#define IP_ARGS(ip) \ - (int)(ip >> 24) & 0xff, (int)(ip >> 16) & 0xff, \ - (int)(ip >> 8) & 0xff, (int)ip & 0xff - -#define MAC_STR "%02x:%02x:%02x:%02x:%02x:%02x" -#define MAC_ARGS(mac) \ - mac[0], mac[1], mac[2], mac[3], mac[4], mac[5] - -#define PXENFSROOTPATH "/pxeroot" - -typedef struct { - uint16_t Seg_Addr; - uint32_t Phy_Addr; - uint16_t Seg_Size; -} PACKED SEGDESC_t; /* PACKED is required, otherwise gcc pads this out to 12 - bytes - mbrown@fensystems.co.uk (mcb30) 17/5/03 */ - -typedef uint16_t SEGSEL_t; -typedef uint16_t PXENV_STATUS_t; -typedef uint32_t IP4_t; -typedef uint32_t ADDR32_t; -typedef uint16_t UDP_PORT_t; - -#define MAC_ADDR_LEN 16 -typedef uint8_t MAC_ADDR[MAC_ADDR_LEN]; - -/* PXENV+ */ -typedef struct { - uint8_t Signature[6]; /* 'PXENV+' */ - uint16_t Version; /* MSB = major, LSB = minor */ - uint8_t Length; /* structure length */ - uint8_t Checksum; /* checksum pad */ - SEGOFF16_t RMEntry; /* SEG:OFF to PXE entry point */ - /* don't use PMOffset and PMSelector (from the 2.1 PXE manual) */ - uint32_t PMOffset; /* Protected mode entry */ - SEGSEL_t PMSelector; /* Protected mode selector */ - SEGSEL_t StackSeg; /* Stack segment address */ - uint16_t StackSize; /* Stack segment size (bytes) */ - SEGSEL_t BC_CodeSeg; /* BC Code segment address */ - uint16_t BC_CodeSize; /* BC Code segment size (bytes) */ - SEGSEL_t BC_DataSeg; /* BC Data segment address */ - uint16_t BC_DataSize; /* BC Data segment size (bytes) */ - SEGSEL_t UNDIDataSeg; /* UNDI Data segment address */ - uint16_t UNDIDataSize; /* UNDI Data segment size (bytes) */ - SEGSEL_t UNDICodeSeg; /* UNDI Code segment address */ - uint16_t UNDICodeSize; /* UNDI Code segment size (bytes) */ - SEGOFF16_t PXEPtr; /* SEG:OFF to !PXE struct, - only present when Version > 2.1 */ -} PACKED pxenv_t; - -/* !PXE */ -typedef struct { - uint8_t Signature[4]; - uint8_t StructLength; - uint8_t StructCksum; - uint8_t StructRev; - uint8_t reserved_1; - SEGOFF16_t UNDIROMID; - SEGOFF16_t BaseROMID; - SEGOFF16_t EntryPointSP; - SEGOFF16_t EntryPointESP; - SEGOFF16_t StatusCallout; - uint8_t reserved_2; - uint8_t SegDescCn; - SEGSEL_t FirstSelector; - SEGDESC_t Stack; - SEGDESC_t UNDIData; - SEGDESC_t UNDICode; - SEGDESC_t UNDICodeWrite; - SEGDESC_t BC_Data; - SEGDESC_t BC_Code; - SEGDESC_t BC_CodeWrite; -} PACKED pxe_t; - -#define PXENV_START_UNDI 0x0000 -typedef struct { - PXENV_STATUS_t Status; - uint16_t ax; - uint16_t bx; - uint16_t dx; - uint16_t di; - uint16_t es; -} PACKED t_PXENV_START_UNDI; - -#define PXENV_UNDI_STARTUP 0x0001 -typedef struct { - PXENV_STATUS_t Status; -} PACKED t_PXENV_UNDI_STARTUP; - -#define PXENV_UNDI_CLEANUP 0x0002 -typedef struct { - PXENV_STATUS_t Status; -} PACKED t_PXENV_UNDI_CLEANUP; - -#define PXENV_UNDI_INITIALIZE 0x0003 -typedef struct { - PXENV_STATUS_t Status; - ADDR32_t ProtocolIni; /* Phys addr of a copy of the driver module */ - uint8_t reserved[8]; -} PACKED t_PXENV_UNDI_INITIALIZE; - - -#define MAXNUM_MCADDR 8 -typedef struct { - uint16_t MCastAddrCount; - MAC_ADDR McastAddr[MAXNUM_MCADDR]; -} PACKED t_PXENV_UNDI_MCAST_ADDRESS; - -#define PXENV_UNDI_RESET_ADAPTER 0x0004 -typedef struct { - PXENV_STATUS_t Status; - t_PXENV_UNDI_MCAST_ADDRESS R_Mcast_Buf; -} PACKED t_PXENV_UNDI_RESET; - -#define PXENV_UNDI_SHUTDOWN 0x0005 -typedef struct { - PXENV_STATUS_t Status; -} PACKED t_PXENV_UNDI_SHUTDOWN; - -#define PXENV_UNDI_OPEN 0x0006 -typedef struct { - PXENV_STATUS_t Status; - uint16_t OpenFlag; - uint16_t PktFilter; -# define FLTR_DIRECTED 0x0001 -# define FLTR_BRDCST 0x0002 -# define FLTR_PRMSCS 0x0003 -# define FLTR_SRC_RTG 0x0004 - - t_PXENV_UNDI_MCAST_ADDRESS R_Mcast_Buf; -} PACKED t_PXENV_UNDI_OPEN; - -#define PXENV_UNDI_CLOSE 0x0007 -typedef struct { - PXENV_STATUS_t Status; -} PACKED t_PXENV_UNDI_CLOSE; - -#define PXENV_UNDI_TRANSMIT 0x0008 -typedef struct { - PXENV_STATUS_t Status; - uint8_t Protocol; -# define P_UNKNOWN 0 -# define P_IP 1 -# define P_ARP 2 -# define P_RARP 3 - - uint8_t XmitFlag; -# define XMT_DESTADDR 0x0000 -# define XMT_BROADCAST 0x0001 - - SEGOFF16_t DestAddr; - SEGOFF16_t TBD; - uint32_t Reserved[2]; -} PACKED t_PXENV_UNDI_TRANSMIT; - -#define MAX_DATA_BLKS 8 -typedef struct { - uint16_t ImmedLength; - SEGOFF16_t Xmit; - uint16_t DataBlkCount; - struct DataBlk { - uint8_t TDPtrType; - uint8_t TDRsvdByte; - uint16_t TDDataLen; - SEGOFF16_t TDDataPtr; - } DataBlock[MAX_DATA_BLKS]; -} PACKED t_PXENV_UNDI_TBD; - -#define PXENV_UNDI_SET_MCAST_ADDRESS 0x0009 -typedef struct { - PXENV_STATUS_t Status; - t_PXENV_UNDI_MCAST_ADDRESS R_Mcast_Buf; -} PACKED t_PXENV_UNDI_SET_MCAST_ADDR; - -#define PXENV_UNDI_SET_STATION_ADDRESS 0x000A -typedef struct { - PXENV_STATUS_t Status; - MAC_ADDR StationAddress; /* Temp MAC addres to use */ -} PACKED t_PXENV_UNDI_SET_STATION_ADDRESS; - -#define PXENV_UNDI_SET_PACKET_FILTER 0x000B -typedef struct { - PXENV_STATUS_t Status; - uint8_t filter; /* see UNDI_OPEN (0x0006) */ -} PACKED t_PXENV_UNDI_SET_PACKET_FILTER; - -#define PXENV_UNDI_GET_INFORMATION 0x000C -typedef struct { - PXENV_STATUS_t Status; - uint16_t BaseIo; /* Adapter base I/O address */ - uint16_t IntNumber; /* Adapter IRQ number */ - uint16_t MaxTranUnit; /* Adapter maximum transmit unit */ - uint16_t HwType; /* Type of protocol at the hardware addr */ -# define ETHER_TYPE 1 -# define EXP_ETHER_TYPE 2 -# define IEEE_TYPE 6 -# define ARCNET_TYPE 7 - - uint16_t HwAddrLen; /* Length of hardware address */ - MAC_ADDR CurrentNodeAddress; /* Current hardware address */ - MAC_ADDR PermNodeAddress; /* Permanent hardware address */ - SEGSEL_t ROMAddress; /* Real mode ROM segment address */ - uint16_t RxBufCt; /* Receive queue length */ - uint16_t TxBufCt; /* Transmit queue length */ -} PACKED t_PXENV_UNDI_GET_INFORMATION; - -#define PXENV_UNDI_GET_STATISTICS 0x000D -typedef struct { - PXENV_STATUS_t Status; - uint32_t XmitGoodFrames; /* Number of successful transmissions */ - uint32_t RcvGoodFrames; /* Number of good frames received */ - uint32_t RcvCRCErrors; /* Number of frames with CRC errors */ - uint32_t RcvResourceErrors; /* Number of frames dropped */ -} PACKED t_PXENV_UNDI_GET_STATISTICS; - -#define PXENV_UNDI_CLEAR_STATISTICS 0x000E -typedef struct { - PXENV_STATUS_t Status; -} PACKED t_PXENV_UNDI_CLEAR_STATISTICS; - -#define PXENV_UNDI_INITIATE_DIAGS 0x000F -typedef struct { - PXENV_STATUS_t Status; -} PACKED t_PXENV_UNDI_INITIATE_DIAGS; - -#define PXENV_UNDI_FORCE_INTERRUPT 0x0010 -typedef struct { - PXENV_STATUS_t Status; -} PACKED t_PXENV_UNDI_FORCE_INTERRUPT; - -#define PXENV_UNDI_GET_MCAST_ADDRESS 0x0011 -typedef struct { - PXENV_STATUS_t Status; - IP4_t InetAddr; /* IP mulicast address */ - MAC_ADDR MediaAddr; /* MAC multicast address */ -} PACKED t_PXENV_UNDI_GET_MCAST_ADDR; - -#define PXENV_UNDI_GET_NIC_TYPE 0x0012 -typedef struct { - PXENV_STATUS_t Status; - uint8_t NicType; /* Type of NIC */ -# define PCI_NIC 2 -# define PnP_NIC 3 -# define CardBus_NIC 4 - - union { - struct { - uint16_t Vendor_ID; - uint16_t Dev_ID; - uint8_t Base_Class; - uint8_t Sub_Class; - uint8_t Prog_Intf; - uint8_t Rev; - uint16_t BusDevFunc; - uint16_t SubVendor_ID; - uint16_t SubDevice_ID; - } pci, cardbus; - struct { - uint32_t EISA_Dev_ID; - uint8_t Base_Class; - uint8_t Sub_Class; - uint8_t Prog_Intf; - uint16_t CardSelNum; - } pnp; - } info; -} PACKED t_PXENV_UNDI_GET_NIC_TYPE; - -#define PXENV_UNDI_GET_IFACE_INFO 0x0013 -typedef struct { - PXENV_STATUS_t Status; - uint8_t IfaceType[16]; /* Name of MAC type in ASCII. */ - uint32_t LinkSpeed; /* Defined in NDIS 2.0 spec */ - uint32_t ServiceFlags; /* Defined in NDIS 2.0 spec */ - uint32_t Reserved[4]; /* must be 0 */ -} PACKED t_PXENV_UNDI_GET_IFACE_INFO; - -#define PXENV_UNDI_ISR 0x0014 -typedef struct { - PXENV_STATUS_t Status; - uint16_t FuncFlag; /* PXENV_UNDI_ISR_OUT_xxx */ - uint16_t BufferLength; /* Length of Frame */ - uint16_t FrameLength; /* Total length of reciever frame */ - uint16_t FrameHeaderLength; /* Length of the media header in Frame */ - SEGOFF16_t Frame; /* receive buffer */ - uint8_t ProtType; /* Protocol type */ - uint8_t PktType; /* Packet Type */ -# define PXENV_UNDI_ISR_IN_START 1 -# define PXENV_UNDI_ISR_IN_PROCESS 2 -# define PXENV_UNDI_ISR_IN_GET_NEXT 3 - - /* one of these will be returned for PXENV_UNDI_ISR_IN_START */ -# define PXENV_UNDI_ISR_OUT_OURS 0 -# define PXENV_UNDI_ISR_OUT_NOT_OURS 1 - - /* - * one of these will bre returnd for PXEND_UNDI_ISR_IN_PROCESS - * and PXENV_UNDI_ISR_IN_GET_NEXT - */ -# define PXENV_UNDI_ISR_OUT_DONE 0 -# define PXENV_UNDI_ISR_OUT_TRANSMIT 2 -# define PXENV_UNDI_ISR_OUT_RECEIVE 3 -# define PXENV_UNDI_ISR_OUT_BUSY 4 -} PACKED t_PXENV_UNDI_ISR; - -#define PXENV_STOP_UNDI 0x0015 -typedef struct { - PXENV_STATUS_t Status; -} PACKED t_PXENV_STOP_UNDI; - -#define PXENV_TFTP_OPEN 0x0020 -typedef struct { - PXENV_STATUS_t Status; - IP4_t ServerIPAddress; - IP4_t GatewayIPAddress; - uint8_t FileName[128]; - UDP_PORT_t TFTPPort; - uint16_t PacketSize; -} PACKED t_PXENV_TFTP_OPEN; - -#define PXENV_TFTP_CLOSE 0x0021 -typedef struct { - PXENV_STATUS_t Status; -} PACKED t_PXENV_TFTP_CLOSE; - -#define PXENV_TFTP_READ 0x0022 -typedef struct { - PXENV_STATUS_t Status; - uint16_t PacketNumber; - uint16_t BufferSize; - SEGOFF16_t Buffer; -} PACKED t_PXENV_TFTP_READ; - -#define PXENV_TFTP_READ_FILE 0x0023 -typedef struct { - PXENV_STATUS_t Status; - uint8_t FileName[128]; - uint32_t BufferSize; - ADDR32_t Buffer; - IP4_t ServerIPAddress; - IP4_t GatewayIPAdress; - IP4_t McastIPAdress; - UDP_PORT_t TFTPClntPort; - UDP_PORT_t TFTPSrvPort; - uint16_t TFTPOpenTimeOut; - uint16_t TFTPReopenDelay; -} PACKED t_PXENV_TFTP_READ_FILE; - -#define PXENV_TFTP_GET_FSIZE 0x0025 -typedef struct { - PXENV_STATUS_t Status; - IP4_t ServerIPAddress; - IP4_t GatewayIPAdress; - uint8_t FileName[128]; - uint32_t FileSize; -} PACKED t_PXENV_TFTP_GET_FSIZE; - -#define PXENV_UDP_OPEN 0x0030 -typedef struct { - PXENV_STATUS_t Status; - IP4_t src_ip; /* IP address of this station */ -} PACKED t_PXENV_UDP_OPEN; - -#define PXENV_UDP_CLOSE 0x0031 -typedef struct { - PXENV_STATUS_t status; -} PACKED t_PXENV_UDP_CLOSE; - -#define PXENV_UDP_READ 0x0032 -typedef struct { - PXENV_STATUS_t status; - IP4_t src_ip; /* IP of sender */ - IP4_t dest_ip; /* Only accept packets sent to this IP */ - UDP_PORT_t s_port; /* UDP source port of sender */ - UDP_PORT_t d_port; /* Only accept packets sent to this port */ - uint16_t buffer_size; /* Size of the packet buffer */ - SEGOFF16_t buffer; /* SEG:OFF to the packet buffer */ -} PACKED t_PXENV_UDP_READ; - -#define PXENV_UDP_WRITE 0x0033 -typedef struct { - PXENV_STATUS_t status; - IP4_t ip; /* dest ip addr */ - IP4_t gw; /* ip gateway */ - UDP_PORT_t src_port; /* source udp port */ - UDP_PORT_t dst_port; /* destination udp port */ - uint16_t buffer_size; /* Size of the packet buffer */ - SEGOFF16_t buffer; /* SEG:OFF to the packet buffer */ -} PACKED t_PXENV_UDP_WRITE; - -#define PXENV_UNLOAD_STACK 0x0070 -typedef struct { - PXENV_STATUS_t Status; - uint8_t reserved[10]; -} PACKED t_PXENV_UNLOAD_STACK; - - -#define PXENV_GET_CACHED_INFO 0x0071 -typedef struct { - PXENV_STATUS_t Status; - uint16_t PacketType; /* type (defined right here) */ -# define PXENV_PACKET_TYPE_DHCP_DISCOVER 1 -# define PXENV_PACKET_TYPE_DHCP_ACK 2 -# define PXENV_PACKET_TYPE_BINL_REPLY 3 - uint16_t BufferSize; /* max to copy, leave at 0 for pointer */ - SEGOFF16_t Buffer; /* copy to, leave at 0 for pointer */ - uint16_t BufferLimit; /* max size of buffer in BC dataseg ? */ -} PACKED t_PXENV_GET_CACHED_INFO; - - -/* structure filled in by PXENV_GET_CACHED_INFO - * (how we determine which IP we downloaded the initial bootstrap from) - * words can't describe... - */ -typedef struct { - uint8_t opcode; -# define BOOTP_REQ 1 -# define BOOTP_REP 2 - uint8_t Hardware; /* hardware type */ - uint8_t Hardlen; /* hardware addr len */ - uint8_t Gatehops; /* zero it */ - uint32_t ident; /* random number chosen by client */ - uint16_t seconds; /* seconds since did initial bootstrap */ - uint16_t Flags; /* seconds since did initial bootstrap */ -# define BOOTP_BCAST 0x8000 /* ? */ - IP4_t cip; /* Client IP */ - IP4_t yip; /* Your IP */ - IP4_t sip; /* IP to use for next boot stage */ - IP4_t gip; /* Relay IP ? */ - MAC_ADDR CAddr; /* Client hardware address */ - uint8_t Sname[64]; /* Server's hostname (Optional) */ - uint8_t bootfile[128]; /* boot filename */ - union { -# if 1 -# define BOOTP_DHCPVEND 1024 /* DHCP extended vendor field size */ -# else -# define BOOTP_DHCPVEND 312 /* DHCP standard vendor field size */ -# endif - uint8_t d[BOOTP_DHCPVEND]; /* raw array of vendor/dhcp options */ - struct { - uint8_t magic[4]; /* DHCP magic cookie */ -# ifndef VM_RFC1048 -# define VM_RFC1048 0x63825363L /* ? */ -# endif - uint32_t flags; /* bootp flags/opcodes */ - uint8_t pad[56]; /* I don't think intel knows what a - union does... */ - } v; - } vendor; -} PACKED BOOTPLAYER; - -#define PXENV_RESTART_TFTP 0x0073 -#define t_PXENV_RESTART_TFTP t_PXENV_TFTP_READ_FILE - -#define PXENV_START_BASE 0x0075 -typedef struct { - PXENV_STATUS_t Status; -} PACKED t_PXENV_START_BASE; - -#define PXENV_STOP_BASE 0x0076 -typedef struct { - PXENV_STATUS_t Status; -} PACKED t_PXENV_STOP_BASE; diff --git a/usr/src/grub/grub-0.95/netboot/r8169.c b/usr/src/grub/grub-0.95/netboot/r8169.c deleted file mode 100644 index a7f0e15e34..0000000000 --- a/usr/src/grub/grub-0.95/netboot/r8169.c +++ /dev/null @@ -1,854 +0,0 @@ -/************************************************************************** -* r8169.c: Etherboot device driver for the RealTek RTL-8169 Gigabit -* Written 2003 by Timothy Legge -* -* 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. -* -* Portions of this code based on: -* r8169.c: A RealTek RTL-8169 Gigabit Ethernet driver -* for Linux kernel 2.4.x. -* -* Written 2002 ShuChen -* See Linux Driver for full information -* -* Linux Driver Version 1.27a, 10.02.2002 -* -* Thanks to: -* Jean Chen of RealTek Semiconductor Corp. for -* providing the evaluation NIC used to develop -* this driver. RealTek's support for Etherboot -* is appreciated. -* -* REVISION HISTORY: -* ================ -* -* v1.0 11-26-2003 timlegge Initial port of Linux driver -* v1.5 01-17-2004 timlegge Initial driver output cleanup -* v1.6 03-27-2004 timlegge Additional Cleanup -* -* Indent Options: indent -kr -i8 -***************************************************************************/ - -/* to get some global routines like printf */ -#include "etherboot.h" -/* to get the interface to the body of the program */ -#include "nic.h" -/* to get the PCI support functions, if this is a PCI NIC */ -#include "pci.h" -#include "timer.h" - -#define drv_version "v1.6" -#define drv_date "03-27-2004" - -typedef unsigned char u8; -typedef signed char s8; -typedef unsigned short u16; -typedef signed short s16; -typedef unsigned int u32; -typedef signed int s32; - -#define HZ 1000 - -static u32 ioaddr; - -#ifdef EDEBUG -#define dprintf(x) printf x -#else -#define dprintf(x) -#endif - -/* Condensed operations for readability. */ -#define virt_to_le32desc(addr) cpu_to_le32(virt_to_bus(addr)) -#define le32desc_to_virt(addr) bus_to_virt(le32_to_cpu(addr)) - -#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) - -/* media options - _10_Half = 0x01, - _10_Full = 0x02, - _100_Half = 0x04, - _100_Full = 0x08, - _1000_Full = 0x10, -*/ -static int media = -1; - -#if 0 -/* Maximum events (Rx packets, etc.) to handle at each interrupt. */ -static int max_interrupt_work = 20; -#endif - -#if 0 -/* Maximum number of multicast addresses to filter (vs. Rx-all-multicast). - The RTL chips use a 64 element hash table based on the Ethernet CRC. */ -static int multicast_filter_limit = 32; -#endif - -/* MAC address length*/ -#define MAC_ADDR_LEN 6 - -/* max supported gigabit ethernet frame size -- must be at least (dev->mtu+14+4).*/ -#define MAX_ETH_FRAME_SIZE 1536 - -#define TX_FIFO_THRESH 256 /* In bytes */ - -#define RX_FIFO_THRESH 7 /* 7 means NO threshold, Rx buffer level before first PCI xfer. */ -#define RX_DMA_BURST 6 /* Maximum PCI burst, '6' is 1024 */ -#define TX_DMA_BURST 6 /* Maximum PCI burst, '6' is 1024 */ -#define EarlyTxThld 0x3F /* 0x3F means NO early transmit */ -#define RxPacketMaxSize 0x0800 /* Maximum size supported is 16K-1 */ -#define InterFrameGap 0x03 /* 3 means InterFrameGap = the shortest one */ - -#define NUM_TX_DESC 1 /* Number of Tx descriptor registers */ -#define NUM_RX_DESC 4 /* Number of Rx descriptor registers */ -#define RX_BUF_SIZE 1536 /* Rx Buffer size */ - -#define RTL_MIN_IO_SIZE 0x80 -#define TX_TIMEOUT (6*HZ) - -/* write/read MMIO register */ -#define RTL_W8(reg, val8) writeb ((val8), ioaddr + (reg)) -#define RTL_W16(reg, val16) writew ((val16), ioaddr + (reg)) -#define RTL_W32(reg, val32) writel ((val32), ioaddr + (reg)) -#define RTL_R8(reg) readb (ioaddr + (reg)) -#define RTL_R16(reg) readw (ioaddr + (reg)) -#define RTL_R32(reg) ((unsigned long) readl (ioaddr + (reg))) - -enum RTL8169_registers { - MAC0 = 0, /* Ethernet hardware address. */ - MAR0 = 8, /* Multicast filter. */ - TxDescStartAddr = 0x20, - TxHDescStartAddr = 0x28, - FLASH = 0x30, - ERSR = 0x36, - ChipCmd = 0x37, - TxPoll = 0x38, - IntrMask = 0x3C, - IntrStatus = 0x3E, - TxConfig = 0x40, - RxConfig = 0x44, - RxMissed = 0x4C, - Cfg9346 = 0x50, - Config0 = 0x51, - Config1 = 0x52, - Config2 = 0x53, - Config3 = 0x54, - Config4 = 0x55, - Config5 = 0x56, - MultiIntr = 0x5C, - PHYAR = 0x60, - TBICSR = 0x64, - TBI_ANAR = 0x68, - TBI_LPAR = 0x6A, - PHYstatus = 0x6C, - RxMaxSize = 0xDA, - CPlusCmd = 0xE0, - RxDescStartAddr = 0xE4, - EarlyTxThres = 0xEC, - FuncEvent = 0xF0, - FuncEventMask = 0xF4, - FuncPresetState = 0xF8, - FuncForceEvent = 0xFC, -}; - -enum RTL8169_register_content { - /*InterruptStatusBits */ - SYSErr = 0x8000, - PCSTimeout = 0x4000, - SWInt = 0x0100, - TxDescUnavail = 0x80, - RxFIFOOver = 0x40, - RxUnderrun = 0x20, - RxOverflow = 0x10, - TxErr = 0x08, - TxOK = 0x04, - RxErr = 0x02, - RxOK = 0x01, - - /*RxStatusDesc */ - RxRES = 0x00200000, - RxCRC = 0x00080000, - RxRUNT = 0x00100000, - RxRWT = 0x00400000, - - /*ChipCmdBits */ - CmdReset = 0x10, - CmdRxEnb = 0x08, - CmdTxEnb = 0x04, - RxBufEmpty = 0x01, - - /*Cfg9346Bits */ - Cfg9346_Lock = 0x00, - Cfg9346_Unlock = 0xC0, - - /*rx_mode_bits */ - AcceptErr = 0x20, - AcceptRunt = 0x10, - AcceptBroadcast = 0x08, - AcceptMulticast = 0x04, - AcceptMyPhys = 0x02, - AcceptAllPhys = 0x01, - - /*RxConfigBits */ - RxCfgFIFOShift = 13, - RxCfgDMAShift = 8, - - /*TxConfigBits */ - TxInterFrameGapShift = 24, - TxDMAShift = 8, /* DMA burst value (0-7) is shift this many bits */ - - /*rtl8169_PHYstatus */ - TBI_Enable = 0x80, - TxFlowCtrl = 0x40, - RxFlowCtrl = 0x20, - _1000bpsF = 0x10, - _100bps = 0x08, - _10bps = 0x04, - LinkStatus = 0x02, - FullDup = 0x01, - - /*GIGABIT_PHY_registers */ - PHY_CTRL_REG = 0, - PHY_STAT_REG = 1, - PHY_AUTO_NEGO_REG = 4, - PHY_1000_CTRL_REG = 9, - - /*GIGABIT_PHY_REG_BIT */ - PHY_Restart_Auto_Nego = 0x0200, - PHY_Enable_Auto_Nego = 0x1000, - - /* PHY_STAT_REG = 1; */ - PHY_Auto_Neco_Comp = 0x0020, - - /* PHY_AUTO_NEGO_REG = 4; */ - PHY_Cap_10_Half = 0x0020, - PHY_Cap_10_Full = 0x0040, - PHY_Cap_100_Half = 0x0080, - PHY_Cap_100_Full = 0x0100, - - /* PHY_1000_CTRL_REG = 9; */ - PHY_Cap_1000_Full = 0x0200, - - PHY_Cap_Null = 0x0, - - /*_MediaType*/ - _10_Half = 0x01, - _10_Full = 0x02, - _100_Half = 0x04, - _100_Full = 0x08, - _1000_Full = 0x10, - - /*_TBICSRBit*/ - TBILinkOK = 0x02000000, -}; - -static struct { - const char *name; - u8 version; /* depend on RTL8169 docs */ - u32 RxConfigMask; /* should clear the bits supported by this chip */ -} rtl_chip_info[] = { - { -"RTL-8169", 0x00, 0xff7e1880,},}; - -enum _DescStatusBit { - OWNbit = 0x80000000, - EORbit = 0x40000000, - FSbit = 0x20000000, - LSbit = 0x10000000, -}; - -struct TxDesc { - u32 status; - u32 vlan_tag; - u32 buf_addr; - u32 buf_Haddr; -}; - -struct RxDesc { - u32 status; - u32 vlan_tag; - u32 buf_addr; - u32 buf_Haddr; -}; - -/* The descriptors for this card are required to be aligned on -256 byte boundaries. As the align attribute does not do more than -16 bytes of alignment it requires some extra steps. Add 256 to the -size of the array and the init_ring adjusts the alignment */ - -/* Define the TX Descriptor */ -static u8 tx_ring[NUM_TX_DESC * sizeof(struct TxDesc) + 256]; - -/* Create a static buffer of size RX_BUF_SZ for each -TX Descriptor. All descriptors point to a -part of this buffer */ -static unsigned char txb[NUM_TX_DESC * RX_BUF_SIZE]; - -/* Define the RX Descriptor */ -static u8 rx_ring[NUM_RX_DESC * sizeof(struct TxDesc) + 256]; - -/* Create a static buffer of size RX_BUF_SZ for each -RX Descriptor All descriptors point to a -part of this buffer */ -static unsigned char rxb[NUM_RX_DESC * RX_BUF_SIZE]; - -struct rtl8169_private { - void *mmio_addr; /* memory map physical address */ - int chipset; - unsigned long cur_rx; /* Index into the Rx descriptor buffer of next Rx pkt. */ - unsigned long cur_tx; /* Index into the Tx descriptor buffer of next Rx pkt. */ - unsigned char *TxDescArrays; /* Index of Tx Descriptor buffer */ - unsigned char *RxDescArrays; /* Index of Rx Descriptor buffer */ - struct TxDesc *TxDescArray; /* Index of 256-alignment Tx Descriptor buffer */ - struct RxDesc *RxDescArray; /* Index of 256-alignment Rx Descriptor buffer */ - unsigned char *RxBufferRing[NUM_RX_DESC]; /* Index of Rx Buffer array */ - unsigned char *Tx_skbuff[NUM_TX_DESC]; -} tpx; - -static struct rtl8169_private *tpc; - -static const u16 rtl8169_intr_mask = - SYSErr | PCSTimeout | RxUnderrun | RxOverflow | RxFIFOOver | TxErr | - TxOK | RxErr | RxOK; -static const unsigned int rtl8169_rx_config = - (RX_FIFO_THRESH << RxCfgFIFOShift) | (RX_DMA_BURST << RxCfgDMAShift); - -void mdio_write(int RegAddr, int value) -{ - int i; - - RTL_W32(PHYAR, 0x80000000 | (RegAddr & 0xFF) << 16 | value); - udelay(1000); - - for (i = 2000; i > 0; i--) { - /* Check if the RTL8169 has completed writing to the specified MII register */ - if (!(RTL_R32(PHYAR) & 0x80000000)) { - break; - } else { - udelay(100); - } - } -} - -int mdio_read(int RegAddr) -{ - int i, value = -1; - - RTL_W32(PHYAR, 0x0 | (RegAddr & 0xFF) << 16); - udelay(1000); - - for (i = 2000; i > 0; i--) { - /* Check if the RTL8169 has completed retrieving data from the specified MII register */ - if (RTL_R32(PHYAR) & 0x80000000) { - value = (int) (RTL_R32(PHYAR) & 0xFFFF); - break; - } else { - udelay(100); - } - } - return value; -} - -static int rtl8169_init_board(struct pci_device *pdev) -{ - int i; - unsigned long rtreg_base, rtreg_len; - u32 tmp; - - rtreg_base = pci_bar_start(pdev, PCI_BASE_ADDRESS_1); - rtreg_len = pci_bar_size(pdev, PCI_BASE_ADDRESS_1); - - /* check for weird/broken PCI region reporting */ - if (rtreg_len < RTL_MIN_IO_SIZE) { - printf("Invalid PCI region size(s), aborting\n"); - } - - adjust_pci_device(pdev); -/* pm_cap = pci_find_capability(pdev, PCI_CAP_ID_PM); */ - - /* ioremap MMIO region */ - ioaddr = (unsigned long) ioremap(rtreg_base, rtreg_len); - if (ioaddr == 0) - return 0; - - tpc->mmio_addr = &ioaddr; - /* Soft reset the chip. */ - RTL_W8(ChipCmd, CmdReset); - - /* Check that the chip has finished the reset. */ - for (i = 1000; i > 0; i--) - if ((RTL_R8(ChipCmd) & CmdReset) == 0) - break; - else - udelay(10); - - /* identify chip attached to board */ - tmp = RTL_R32(TxConfig); - tmp = ((tmp & 0x7c000000) + ((tmp & 0x00800000) << 2)) >> 24; - - for (i = ARRAY_SIZE(rtl_chip_info) - 1; i >= 0; i--) - if (tmp == rtl_chip_info[i].version) { - tpc->chipset = i; - goto match; - } - /* if unknown chip, assume array element #0, original RTL-8169 in this case */ - dprintf(("PCI device: unknown chip version, assuming RTL-8169\n")); - dprintf(("PCI device: TxConfig = 0x%hX\n", - (unsigned long) RTL_R32(TxConfig))); - tpc->chipset = 0; - return 1; - match: - return 0; - -} - -/************************************************************************** -IRQ - Wait for a frame -***************************************************************************/ -void r8169_irq ( struct nic *nic __unused, irq_action_t action ) { - int intr_status = 0; - int interested = RxUnderrun | RxOverflow | RxFIFOOver | RxErr | RxOK; - - switch ( action ) { - case DISABLE: - case ENABLE: - intr_status = RTL_R16(IntrStatus); - /* h/w no longer present (hotplug?) or major error, - bail */ - if (intr_status == 0xFFFF) - break; - - intr_status = intr_status & ~interested; - if ( action == ENABLE ) - intr_status = intr_status | interested; - RTL_W16(IntrMask, intr_status); - break; - case FORCE : - RTL_W8(TxPoll, (RTL_R8(TxPoll) | 0x01)); - break; - } -} - -/************************************************************************** -POLL - Wait for a frame -***************************************************************************/ -static int r8169_poll(struct nic *nic, int retreive) -{ - /* return true if there's an ethernet packet ready to read */ - /* nic->packet should contain data on return */ - /* nic->packetlen should contain length of data */ - int cur_rx; - unsigned int intr_status = 0; - cur_rx = tpc->cur_rx; - if ((tpc->RxDescArray[cur_rx].status & OWNbit) == 0) { - /* There is a packet ready */ - if(!retreive) - return 1; - intr_status = RTL_R16(IntrStatus); - /* h/w no longer present (hotplug?) or major error, - bail */ - if (intr_status == 0xFFFF) - return 0; - RTL_W16(IntrStatus, intr_status & - ~(RxFIFOOver | RxOverflow | RxOK)); - - if (!(tpc->RxDescArray[cur_rx].status & RxRES)) { - nic->packetlen = (int) (tpc->RxDescArray[cur_rx]. - status & 0x00001FFF) - 4; - memcpy(nic->packet, tpc->RxBufferRing[cur_rx], - nic->packetlen); - if (cur_rx == NUM_RX_DESC - 1) - tpc->RxDescArray[cur_rx].status = - (OWNbit | EORbit) + RX_BUF_SIZE; - else - tpc->RxDescArray[cur_rx].status = - OWNbit + RX_BUF_SIZE; - tpc->RxDescArray[cur_rx].buf_addr = - virt_to_bus(tpc->RxBufferRing[cur_rx]); - } else - printf("Error Rx"); - /* FIXME: shouldn't I reset the status on an error */ - cur_rx = (cur_rx + 1) % NUM_RX_DESC; - tpc->cur_rx = cur_rx; - RTL_W16(IntrStatus, intr_status & - (RxFIFOOver | RxOverflow | RxOK)); - - return 1; - - } - tpc->cur_rx = cur_rx; - /* FIXME: There is no reason to do this as cur_rx did not change */ - - return (0); /* initially as this is called to flush the input */ - -} - -/************************************************************************** -TRANSMIT - Transmit a frame -***************************************************************************/ -static void r8169_transmit(struct nic *nic, const char *d, /* Destination */ - unsigned int t, /* Type */ - unsigned int s, /* size */ - const char *p) -{ /* Packet */ - /* send the packet to destination */ - - u16 nstype; - u32 to; - u8 *ptxb; - int entry = tpc->cur_tx % NUM_TX_DESC; - - /* point to the current txb incase multiple tx_rings are used */ - ptxb = tpc->Tx_skbuff[entry * MAX_ETH_FRAME_SIZE]; - memcpy(ptxb, d, ETH_ALEN); - memcpy(ptxb + ETH_ALEN, nic->node_addr, ETH_ALEN); - nstype = htons((u16) t); - memcpy(ptxb + 2 * ETH_ALEN, (u8 *) & nstype, 2); - memcpy(ptxb + ETH_HLEN, p, s); - s += ETH_HLEN; - s &= 0x0FFF; - while (s < ETH_ZLEN) - ptxb[s++] = '\0'; - - tpc->TxDescArray[entry].buf_addr = virt_to_bus(ptxb); - if (entry != (NUM_TX_DESC - 1)) - tpc->TxDescArray[entry].status = - (OWNbit | FSbit | LSbit) | ((s > ETH_ZLEN) ? s : - ETH_ZLEN); - else - tpc->TxDescArray[entry].status = - (OWNbit | EORbit | FSbit | LSbit) | ((s > ETH_ZLEN) ? s - : ETH_ZLEN); - RTL_W8(TxPoll, 0x40); /* set polling bit */ - - tpc->cur_tx++; - to = currticks() + TX_TIMEOUT; - while ((tpc->TxDescArray[entry].status & OWNbit) && (currticks() < to)); /* wait */ - - if (currticks() >= to) { - printf("TX Time Out"); - } -} - -static void rtl8169_set_rx_mode(struct nic *nic __unused) -{ - u32 mc_filter[2]; /* Multicast hash filter */ - int rx_mode; - u32 tmp = 0; - - /* IFF_ALLMULTI */ - /* Too many to filter perfectly -- accept all multicasts. */ - rx_mode = AcceptBroadcast | AcceptMulticast | AcceptMyPhys; - mc_filter[1] = mc_filter[0] = 0xffffffff; - - tmp = - rtl8169_rx_config | rx_mode | (RTL_R32(RxConfig) & - rtl_chip_info[tpc->chipset]. - RxConfigMask); - - RTL_W32(RxConfig, tmp); - RTL_W32(MAR0 + 0, mc_filter[0]); - RTL_W32(MAR0 + 4, mc_filter[1]); -} -static void rtl8169_hw_start(struct nic *nic) -{ - u32 i; - - /* Soft reset the chip. */ - RTL_W8(ChipCmd, CmdReset); - - /* Check that the chip has finished the reset. */ - for (i = 1000; i > 0; i--) { - if ((RTL_R8(ChipCmd) & CmdReset) == 0) - break; - else - udelay(10); - } - - RTL_W8(Cfg9346, Cfg9346_Unlock); - RTL_W8(ChipCmd, CmdTxEnb | CmdRxEnb); - RTL_W8(EarlyTxThres, EarlyTxThld); - - /* For gigabit rtl8169 */ - RTL_W16(RxMaxSize, RxPacketMaxSize); - - /* Set Rx Config register */ - i = rtl8169_rx_config | (RTL_R32(RxConfig) & - rtl_chip_info[tpc->chipset].RxConfigMask); - RTL_W32(RxConfig, i); - - /* Set DMA burst size and Interframe Gap Time */ - RTL_W32(TxConfig, - (TX_DMA_BURST << TxDMAShift) | (InterFrameGap << - TxInterFrameGapShift)); - - - tpc->cur_rx = 0; - - RTL_W32(TxDescStartAddr, virt_to_le32desc(tpc->TxDescArray)); - RTL_W32(RxDescStartAddr, virt_to_le32desc(tpc->RxDescArray)); - RTL_W8(Cfg9346, Cfg9346_Lock); - udelay(10); - - RTL_W32(RxMissed, 0); - - rtl8169_set_rx_mode(nic); - - /* no early-rx interrupts */ - RTL_W16(MultiIntr, RTL_R16(MultiIntr) & 0xF000); -} - -static void rtl8169_init_ring(struct nic *nic __unused) -{ - int i; - - tpc->cur_rx = 0; - tpc->cur_tx = 0; - memset(tpc->TxDescArray, 0x0, NUM_TX_DESC * sizeof(struct TxDesc)); - memset(tpc->RxDescArray, 0x0, NUM_RX_DESC * sizeof(struct RxDesc)); - - for (i = 0; i < NUM_TX_DESC; i++) { - tpc->Tx_skbuff[i] = &txb[i]; - } - - for (i = 0; i < NUM_RX_DESC; i++) { - if (i == (NUM_RX_DESC - 1)) - tpc->RxDescArray[i].status = - (OWNbit | EORbit) + RX_BUF_SIZE; - else - tpc->RxDescArray[i].status = OWNbit + RX_BUF_SIZE; - - tpc->RxBufferRing[i] = &rxb[i * RX_BUF_SIZE]; - tpc->RxDescArray[i].buf_addr = - virt_to_bus(tpc->RxBufferRing[i]); - } -} - -/************************************************************************** -RESET - Finish setting up the ethernet interface -***************************************************************************/ -static void r8169_reset(struct nic *nic) -{ - int i; - u8 diff; - u32 TxPhyAddr, RxPhyAddr; - - tpc->TxDescArrays = tx_ring; - if (tpc->TxDescArrays == 0) - printf("Allot Error"); - /* Tx Desscriptor needs 256 bytes alignment; */ - TxPhyAddr = virt_to_bus(tpc->TxDescArrays); - diff = 256 - (TxPhyAddr - ((TxPhyAddr >> 8) << 8)); - TxPhyAddr += diff; - tpc->TxDescArray = (struct TxDesc *) (tpc->TxDescArrays + diff); - - tpc->RxDescArrays = rx_ring; - /* Rx Desscriptor needs 256 bytes alignment; */ - RxPhyAddr = virt_to_bus(tpc->RxDescArrays); - diff = 256 - (RxPhyAddr - ((RxPhyAddr >> 8) << 8)); - RxPhyAddr += diff; - tpc->RxDescArray = (struct RxDesc *) (tpc->RxDescArrays + diff); - - if (tpc->TxDescArrays == NULL || tpc->RxDescArrays == NULL) { - printf("Allocate RxDescArray or TxDescArray failed\n"); - return; - } - - rtl8169_init_ring(nic); - rtl8169_hw_start(nic); - /* Construct a perfect filter frame with the mac address as first match - * and broadcast for all others */ - for (i = 0; i < 192; i++) - txb[i] = 0xFF; - - txb[0] = nic->node_addr[0]; - txb[1] = nic->node_addr[1]; - txb[2] = nic->node_addr[2]; - txb[3] = nic->node_addr[3]; - txb[4] = nic->node_addr[4]; - txb[5] = nic->node_addr[5]; -} - -/************************************************************************** -DISABLE - Turn off ethernet interface -***************************************************************************/ -static void r8169_disable(struct dev *dev __unused) -{ - int i; - /* Stop the chip's Tx and Rx DMA processes. */ - RTL_W8(ChipCmd, 0x00); - - /* Disable interrupts by clearing the interrupt mask. */ - RTL_W16(IntrMask, 0x0000); - - RTL_W32(RxMissed, 0); - - tpc->TxDescArrays = NULL; - tpc->RxDescArrays = NULL; - tpc->TxDescArray = NULL; - tpc->RxDescArray = NULL; - for (i = 0; i < NUM_RX_DESC; i++) { - tpc->RxBufferRing[i] = NULL; - } -} - -/************************************************************************** -PROBE - Look for an adapter, this routine's visible to the outside -***************************************************************************/ - -#define board_found 1 -#define valid_link 0 -static int r8169_probe(struct dev *dev, struct pci_device *pci) -{ - struct nic *nic = (struct nic *) dev; - static int board_idx = -1; - static int printed_version = 0; - int i, rc; - int option = -1, Cap10_100 = 0, Cap1000 = 0; - - printf("r8169.c: Found %s, Vendor=%hX Device=%hX\n", - pci->name, pci->vendor, pci->dev_id); - - board_idx++; - - printed_version = 1; - - /* point to private storage */ - tpc = &tpx; - - rc = rtl8169_init_board(pci); /* Return code is meaningless */ - - /* Get MAC address. FIXME: read EEPROM */ - for (i = 0; i < MAC_ADDR_LEN; i++) - nic->node_addr[i] = RTL_R8(MAC0 + i); - - dprintf(("%s: Identified chip type is '%s'.\n", pci->name, - rtl_chip_info[tpc->chipset].name)); - /* Print out some hardware info */ - printf("%s: %! at ioaddr %hX, ", pci->name, nic->node_addr, - ioaddr); - - /* if TBI is not endbled */ - if (!(RTL_R8(PHYstatus) & TBI_Enable)) { - int val = mdio_read(PHY_AUTO_NEGO_REG); - - option = media; - /* Force RTL8169 in 10/100/1000 Full/Half mode. */ - if (option > 0) { - printf(" Force-mode Enabled.\n"); - Cap10_100 = 0, Cap1000 = 0; - switch (option) { - case _10_Half: - Cap10_100 = PHY_Cap_10_Half; - Cap1000 = PHY_Cap_Null; - break; - case _10_Full: - Cap10_100 = PHY_Cap_10_Full; - Cap1000 = PHY_Cap_Null; - break; - case _100_Half: - Cap10_100 = PHY_Cap_100_Half; - Cap1000 = PHY_Cap_Null; - break; - case _100_Full: - Cap10_100 = PHY_Cap_100_Full; - Cap1000 = PHY_Cap_Null; - break; - case _1000_Full: - Cap10_100 = PHY_Cap_Null; - Cap1000 = PHY_Cap_1000_Full; - break; - default: - break; - } - /* leave PHY_AUTO_NEGO_REG bit4:0 unchanged */ - mdio_write(PHY_AUTO_NEGO_REG, - Cap10_100 | (val & 0x1F)); - mdio_write(PHY_1000_CTRL_REG, Cap1000); - } else { - dprintf(("Auto-negotiation Enabled.\n", - pci->name)); - - /* enable 10/100 Full/Half Mode, leave PHY_AUTO_NEGO_REG bit4:0 unchanged */ - mdio_write(PHY_AUTO_NEGO_REG, - PHY_Cap_10_Half | PHY_Cap_10_Full | - PHY_Cap_100_Half | PHY_Cap_100_Full | - (val & 0x1F)); - - /* enable 1000 Full Mode */ - mdio_write(PHY_1000_CTRL_REG, PHY_Cap_1000_Full); - - } - - /* Enable auto-negotiation and restart auto-nigotiation */ - mdio_write(PHY_CTRL_REG, - PHY_Enable_Auto_Nego | PHY_Restart_Auto_Nego); - udelay(100); - - /* wait for auto-negotiation process */ - for (i = 10000; i > 0; i--) { - /* Check if auto-negotiation complete */ - if (mdio_read(PHY_STAT_REG) & PHY_Auto_Neco_Comp) { - udelay(100); - option = RTL_R8(PHYstatus); - if (option & _1000bpsF) { - printf - ("1000Mbps Full-duplex operation.\n"); - } else { - printf - ("%sMbps %s-duplex operation.\n", - (option & _100bps) ? "100" : - "10", - (option & FullDup) ? "Full" : - "Half"); - } - break; - } else { - udelay(100); - } - } /* end for-loop to wait for auto-negotiation process */ - - } else { - udelay(100); - printf - ("%s: 1000Mbps Full-duplex operation, TBI Link %s!\n", - pci->name, - (RTL_R32(TBICSR) & TBILinkOK) ? "OK" : "Failed"); - - } - - r8169_reset(nic); - /* point to NIC specific routines */ - dev->disable = r8169_disable; - nic->poll = r8169_poll; - nic->transmit = r8169_transmit; - nic->irqno = pci->irq; - nic->irq = r8169_irq; - nic->ioaddr = ioaddr; - return 1; - -} - -static struct pci_id r8169_nics[] = { - PCI_ROM(0x10ec, 0x8169, "r8169", "RealTek RTL8169 Gigabit Ethernet"), -}; - -struct pci_driver r8169_driver = { - .type = NIC_DRIVER, - .name = "r8169/PCI", - .probe = r8169_probe, - .ids = r8169_nics, - .id_count = sizeof(r8169_nics) / sizeof(r8169_nics[0]), - .class = 0, -}; diff --git a/usr/src/grub/grub-0.95/netboot/rtl8139.c b/usr/src/grub/grub-0.95/netboot/rtl8139.c deleted file mode 100644 index 59a2601855..0000000000 --- a/usr/src/grub/grub-0.95/netboot/rtl8139.c +++ /dev/null @@ -1,551 +0,0 @@ -/* rtl8139.c - etherboot driver for the Realtek 8139 chipset - - ported from the linux driver written by Donald Becker - by Rainer Bawidamann (Rainer.Bawidamann@informatik.uni-ulm.de) 1999 - - This software may be used and distributed according to the terms - of the GNU Public License, incorporated herein by reference. - - changes to the original driver: - - removed support for interrupts, switching to polling mode (yuck!) - - removed support for the 8129 chip (external MII) - -*/ - -/*********************************************************************/ -/* Revision History */ -/*********************************************************************/ - -/* - 28 Dec 2002 ken_yap@users.sourceforge.net (Ken Yap) - Put in virt_to_bus calls to allow Etherboot relocation. - - 06 Apr 2001 ken_yap@users.sourceforge.net (Ken Yap) - Following email from Hyun-Joon Cha, added a disable routine, otherwise - NIC remains live and can crash the kernel later. - - 4 Feb 2000 espenlaub@informatik.uni-ulm.de (Klaus Espenlaub) - Shuffled things around, removed the leftovers from the 8129 support - that was in the Linux driver and added a bit more 8139 definitions. - Moved the 8K receive buffer to a fixed, available address outside the - 0x98000-0x9ffff range. This is a bit of a hack, but currently the only - way to make room for the Etherboot features that need substantial amounts - of code like the ANSI console support. Currently the buffer is just below - 0x10000, so this even conforms to the tagged boot image specification, - which reserves the ranges 0x00000-0x10000 and 0x98000-0xA0000. My - interpretation of this "reserved" is that Etherboot may do whatever it - likes, as long as its environment is kept intact (like the BIOS - variables). Hopefully fixed rtl_poll() once and for all. The symptoms - were that if Etherboot was left at the boot menu for several minutes, the - first eth_poll failed. Seems like I am the only person who does this. - First of all I fixed the debugging code and then set out for a long bug - hunting session. It took me about a week full time work - poking around - various places in the driver, reading Don Becker's and Jeff Garzik's Linux - driver and even the FreeBSD driver (what a piece of crap!) - and - eventually spotted the nasty thing: the transmit routine was acknowledging - each and every interrupt pending, including the RxOverrun and RxFIFIOver - interrupts. This confused the RTL8139 thoroughly. It destroyed the - Rx ring contents by dumping the 2K FIFO contents right where we wanted to - get the next packet. Oh well, what fun. - - 18 Jan 2000 mdc@thinguin.org (Marty Connor) - Drastically simplified error handling. Basically, if any error - in transmission or reception occurs, the card is reset. - Also, pointed all transmit descriptors to the same buffer to - save buffer space. This should decrease driver size and avoid - corruption because of exceeding 32K during runtime. - - 28 Jul 1999 (Matthias Meixner - meixner@rbg.informatik.tu-darmstadt.de) - rtl_poll was quite broken: it used the RxOK interrupt flag instead - of the RxBufferEmpty flag which often resulted in very bad - transmission performace - below 1kBytes/s. - -*/ - -#include "etherboot.h" -#include "nic.h" -#include "pci.h" -#include "timer.h" - -#define RTL_TIMEOUT (1*TICKS_PER_SEC) - -/* PCI Tuning Parameters - Threshold is bytes transferred to chip before transmission starts. */ -#define TX_FIFO_THRESH 256 /* In bytes, rounded down to 32 byte units. */ -#define RX_FIFO_THRESH 4 /* Rx buffer level before first PCI xfer. */ -#define RX_DMA_BURST 4 /* Maximum PCI burst, '4' is 256 bytes */ -#define TX_DMA_BURST 4 /* Calculate as 16<node_addr; - - /* There are enough "RTL8139" strings on the console already, so - * be brief and concentrate on the interesting pieces of info... */ - printf(" - "); - - /* Mask the bit that says "this is an io addr" */ - nic->ioaddr = pci->ioaddr & ~3; - - /* Copy IRQ from PCI information */ - nic->irqno = pci->irq; - - adjust_pci_device(pci); - - /* Bring the chip out of low-power mode. */ - outb(0x00, nic->ioaddr + Config1); - - addr_len = read_eeprom(nic,0,8) == 0x8129 ? 8 : 6; - for (i = 0; i < 3; i++) - *ap++ = read_eeprom(nic,i + 7,addr_len); - - speed10 = inb(nic->ioaddr + MediaStatus) & MSRSpeed10; - fullduplex = inw(nic->ioaddr + MII_BMCR) & BMCRDuplex; - printf("ioaddr %#hX, irq %d, addr %! %sMbps %s-duplex\n", nic->ioaddr, - nic->irqno, nic->node_addr, speed10 ? "10" : "100", - fullduplex ? "full" : "half"); - - rtl_reset(nic); - - if (inb(nic->ioaddr + MediaStatus) & MSRLinkFail) { - printf("Cable not connected or other link failure\n"); - return(0); - } - - dev->disable = rtl_disable; - nic->poll = rtl_poll; - nic->transmit = rtl_transmit; - nic->irq = rtl_irq; - - return 1; -} - -/* Serial EEPROM section. */ - -/* EEPROM_Ctrl bits. */ -#define EE_SHIFT_CLK 0x04 /* EEPROM shift clock. */ -#define EE_CS 0x08 /* EEPROM chip select. */ -#define EE_DATA_WRITE 0x02 /* EEPROM chip data in. */ -#define EE_WRITE_0 0x00 -#define EE_WRITE_1 0x02 -#define EE_DATA_READ 0x01 /* EEPROM chip data out. */ -#define EE_ENB (0x80 | EE_CS) - -/* - Delay between EEPROM clock transitions. - No extra delay is needed with 33Mhz PCI, but 66Mhz may change this. -*/ - -#define eeprom_delay() inl(ee_addr) - -/* The EEPROM commands include the alway-set leading bit. */ -#define EE_WRITE_CMD (5) -#define EE_READ_CMD (6) -#define EE_ERASE_CMD (7) - -static int read_eeprom(struct nic *nic, int location, int addr_len) -{ - int i; - unsigned int retval = 0; - long ee_addr = nic->ioaddr + Cfg9346; - int read_cmd = location | (EE_READ_CMD << addr_len); - - outb(EE_ENB & ~EE_CS, ee_addr); - outb(EE_ENB, ee_addr); - eeprom_delay(); - - /* Shift the read command bits out. */ - for (i = 4 + addr_len; i >= 0; i--) { - int dataval = (read_cmd & (1 << i)) ? EE_DATA_WRITE : 0; - outb(EE_ENB | dataval, ee_addr); - eeprom_delay(); - outb(EE_ENB | dataval | EE_SHIFT_CLK, ee_addr); - eeprom_delay(); - } - outb(EE_ENB, ee_addr); - eeprom_delay(); - - for (i = 16; i > 0; i--) { - outb(EE_ENB | EE_SHIFT_CLK, ee_addr); - eeprom_delay(); - retval = (retval << 1) | ((inb(ee_addr) & EE_DATA_READ) ? 1 : 0); - outb(EE_ENB, ee_addr); - eeprom_delay(); - } - - /* Terminate the EEPROM access. */ - outb(~EE_CS, ee_addr); - eeprom_delay(); - return retval; -} - -static const unsigned int rtl8139_rx_config = - (RX_BUF_LEN_IDX << 11) | - (RX_FIFO_THRESH << 13) | - (RX_DMA_BURST << 8); - -static void set_rx_mode(struct nic *nic) { - unsigned int mc_filter[2]; - int rx_mode; - /* !IFF_PROMISC */ - rx_mode = AcceptBroadcast | AcceptMulticast | AcceptMyPhys; - mc_filter[1] = mc_filter[0] = 0xffffffff; - - outl(rtl8139_rx_config | rx_mode, nic->ioaddr + RxConfig); - - outl(mc_filter[0], nic->ioaddr + MAR0 + 0); - outl(mc_filter[1], nic->ioaddr + MAR0 + 4); -} - -static void rtl_reset(struct nic* nic) -{ - int i; - - outb(CmdReset, nic->ioaddr + ChipCmd); - - cur_rx = 0; - cur_tx = 0; - - /* Give the chip 10ms to finish the reset. */ - load_timer2(10*TICKS_PER_MS); - while ((inb(nic->ioaddr + ChipCmd) & CmdReset) != 0 && - timer2_running()) - /* wait */; - - for (i = 0; i < ETH_ALEN; i++) - outb(nic->node_addr[i], nic->ioaddr + MAC0 + i); - - /* Must enable Tx/Rx before setting transfer thresholds! */ - outb(CmdRxEnb | CmdTxEnb, nic->ioaddr + ChipCmd); - outl((RX_FIFO_THRESH<<13) | (RX_BUF_LEN_IDX<<11) | (RX_DMA_BURST<<8), - nic->ioaddr + RxConfig); /* accept no frames yet! */ - outl((TX_DMA_BURST<<8)|0x03000000, nic->ioaddr + TxConfig); - - /* The Linux driver changes Config1 here to use a different LED pattern - * for half duplex or full/autodetect duplex (for full/autodetect, the - * outputs are TX/RX, Link10/100, FULL, while for half duplex it uses - * TX/RX, Link100, Link10). This is messy, because it doesn't match - * the inscription on the mounting bracket. It should not be changed - * from the configuration EEPROM default, because the card manufacturer - * should have set that to match the card. */ - -#ifdef DEBUG_RX - printf("rx ring address is %X\n",(unsigned long)rx_ring); -#endif - outl((unsigned long)virt_to_bus(rx_ring), nic->ioaddr + RxBuf); - - - - /* If we add multicast support, the MAR0 register would have to be - * initialized to 0xffffffffffffffff (two 32 bit accesses). Etherboot - * only needs broadcast (for ARP/RARP/BOOTP/DHCP) and unicast. */ - - outb(CmdRxEnb | CmdTxEnb, nic->ioaddr + ChipCmd); - - outl(rtl8139_rx_config, nic->ioaddr + RxConfig); - - /* Start the chip's Tx and Rx process. */ - outl(0, nic->ioaddr + RxMissed); - - /* set_rx_mode */ - set_rx_mode(nic); - - /* Disable all known interrupts by setting the interrupt mask. */ - outw(0, nic->ioaddr + IntrMask); -} - -static void rtl_transmit(struct nic *nic, const char *destaddr, - unsigned int type, unsigned int len, const char *data) -{ - unsigned int status, to, nstype; - unsigned long txstatus; - - /* nstype assignment moved up here to avoid gcc 3.0.3 compiler bug */ - nstype = htons(type); - memcpy(tx_buffer, destaddr, ETH_ALEN); - memcpy(tx_buffer + ETH_ALEN, nic->node_addr, ETH_ALEN); - memcpy(tx_buffer + 2 * ETH_ALEN, &nstype, 2); - memcpy(tx_buffer + ETH_HLEN, data, len); - - len += ETH_HLEN; -#ifdef DEBUG_TX - printf("sending %d bytes ethtype %hX\n", len, type); -#endif - - /* Note: RTL8139 doesn't auto-pad, send minimum payload (another 4 - * bytes are sent automatically for the FCS, totalling to 64 bytes). */ - while (len < ETH_ZLEN) { - tx_buffer[len++] = '\0'; - } - - outl((unsigned long)virt_to_bus(tx_buffer), nic->ioaddr + TxAddr0 + cur_tx*4); - outl(((TX_FIFO_THRESH<<11) & 0x003f0000) | len, - nic->ioaddr + TxStatus0 + cur_tx*4); - - to = currticks() + RTL_TIMEOUT; - - do { - status = inw(nic->ioaddr + IntrStatus); - /* Only acknlowledge interrupt sources we can properly handle - * here - the RxOverflow/RxFIFOOver MUST be handled in the - * rtl_poll() function. */ - outw(status & (TxOK | TxErr | PCIErr), nic->ioaddr + IntrStatus); - if ((status & (TxOK | TxErr | PCIErr)) != 0) break; - } while (currticks() < to); - - txstatus = inl(nic->ioaddr+ TxStatus0 + cur_tx*4); - - if (status & TxOK) { - cur_tx = (cur_tx + 1) % NUM_TX_DESC; -#ifdef DEBUG_TX - printf("tx done (%d ticks), status %hX txstatus %X\n", - to-currticks(), status, txstatus); -#endif - } else { -#ifdef DEBUG_TX - printf("tx timeout/error (%d ticks), status %hX txstatus %X\n", - currticks()-to, status, txstatus); -#endif - rtl_reset(nic); - } -} - -static int rtl_poll(struct nic *nic, int retrieve) -{ - unsigned int status; - unsigned int ring_offs; - unsigned int rx_size, rx_status; - - if (inb(nic->ioaddr + ChipCmd) & RxBufEmpty) { - return 0; - } - - /* There is a packet ready */ - if ( ! retrieve ) return 1; - - status = inw(nic->ioaddr + IntrStatus); - /* See below for the rest of the interrupt acknowledges. */ - outw(status & ~(RxFIFOOver | RxOverflow | RxOK), nic->ioaddr + IntrStatus); - -#ifdef DEBUG_RX - printf("rtl_poll: int %hX ", status); -#endif - - ring_offs = cur_rx % RX_BUF_LEN; - rx_status = *(unsigned int*)(rx_ring + ring_offs); - rx_size = rx_status >> 16; - rx_status &= 0xffff; - - if ((rx_status & (RxBadSymbol|RxRunt|RxTooLong|RxCRCErr|RxBadAlign)) || - (rx_size < ETH_ZLEN) || (rx_size > ETH_FRAME_LEN + 4)) { - printf("rx error %hX\n", rx_status); - rtl_reset(nic); /* this clears all interrupts still pending */ - return 0; - } - - /* Received a good packet */ - nic->packetlen = rx_size - 4; /* no one cares about the FCS */ - if (ring_offs+4+rx_size-4 > RX_BUF_LEN) { - int semi_count = RX_BUF_LEN - ring_offs - 4; - - memcpy(nic->packet, rx_ring + ring_offs + 4, semi_count); - memcpy(nic->packet+semi_count, rx_ring, rx_size-4-semi_count); -#ifdef DEBUG_RX - printf("rx packet %d+%d bytes", semi_count,rx_size-4-semi_count); -#endif - } else { - memcpy(nic->packet, rx_ring + ring_offs + 4, nic->packetlen); -#ifdef DEBUG_RX - printf("rx packet %d bytes", rx_size-4); -#endif - } -#ifdef DEBUG_RX - printf(" at %X type %hhX%hhX rxstatus %hX\n", - (unsigned long)(rx_ring+ring_offs+4), - nic->packet[12], nic->packet[13], rx_status); -#endif - cur_rx = (cur_rx + rx_size + 4 + 3) & ~3; - outw(cur_rx - 16, nic->ioaddr + RxBufPtr); - /* See RTL8139 Programming Guide V0.1 for the official handling of - * Rx overflow situations. The document itself contains basically no - * usable information, except for a few exception handling rules. */ - outw(status & (RxFIFOOver | RxOverflow | RxOK), nic->ioaddr + IntrStatus); - return 1; -} - -static void rtl_irq(struct nic *nic, irq_action_t action) -{ - unsigned int mask; - /* Bit of a guess as to which interrupts we should allow */ - unsigned int interested = ROK | RER | RXOVW | FOVW | SERR; - - switch ( action ) { - case DISABLE : - case ENABLE : - mask = inw(nic->ioaddr + IntrMask); - mask = mask & ~interested; - if ( action == ENABLE ) mask = mask | interested; - outw(mask, nic->ioaddr + IntrMask); - break; - case FORCE : - /* Apparently writing a 1 to this read-only bit of a - * read-only and otherwise unrelated register will - * force an interrupt. If you ever want to see how - * not to write a datasheet, read the one for the - * RTL8139... - */ - outb(EROK, nic->ioaddr + RxEarlyStatus); - break; - } -} - -static void rtl_disable(struct dev *dev) -{ - struct nic *nic = (struct nic *)dev; - /* merge reset and disable */ - rtl_reset(nic); - - /* reset the chip */ - outb(CmdReset, nic->ioaddr + ChipCmd); - - /* 10 ms timeout */ - load_timer2(10*TICKS_PER_MS); - while ((inb(nic->ioaddr + ChipCmd) & CmdReset) != 0 && timer2_running()) - /* wait */; -} - -static struct pci_id rtl8139_nics[] = { -PCI_ROM(0x10ec, 0x8129, "rtl8129", "Realtek 8129"), -PCI_ROM(0x10ec, 0x8139, "rtl8139", "Realtek 8139"), -PCI_ROM(0x10ec, 0x8138, "rtl8139b", "Realtek 8139B"), -PCI_ROM(0x1186, 0x1300, "dfe538", "DFE530TX+/DFE538TX"), -PCI_ROM(0x1113, 0x1211, "smc1211-1", "SMC EZ10/100"), -PCI_ROM(0x1112, 0x1211, "smc1211", "SMC EZ10/100"), -PCI_ROM(0x1500, 0x1360, "delta8139", "Delta Electronics 8139"), -PCI_ROM(0x4033, 0x1360, "addtron8139", "Addtron Technology 8139"), -PCI_ROM(0x1186, 0x1340, "dfe690txd", "D-Link DFE690TXD"), -PCI_ROM(0x13d1, 0xab06, "fe2000vx", "AboCom FE2000VX"), -PCI_ROM(0x1259, 0xa117, "allied8139", "Allied Telesyn 8139"), -PCI_ROM(0x14ea, 0xab06, "fnw3603tx", "Planex FNW-3603-TX"), -PCI_ROM(0x14ea, 0xab07, "fnw3800tx", "Planex FNW-3800-TX"), -PCI_ROM(0xffff, 0x8139, "clone-rtl8139", "Cloned 8139"), -}; - -struct pci_driver rtl8139_driver = { - .type = NIC_DRIVER, - .name = "RTL8139", - .probe = rtl8139_probe, - .ids = rtl8139_nics, - .id_count = sizeof(rtl8139_nics)/sizeof(rtl8139_nics[0]), - .class = 0, -}; diff --git a/usr/src/grub/grub-0.95/netboot/segoff.h b/usr/src/grub/grub-0.95/netboot/segoff.h deleted file mode 100644 index 958de63f43..0000000000 --- a/usr/src/grub/grub-0.95/netboot/segoff.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Segment:offset types and macros - * - * Initially written by Michael Brown (mcb30). - */ - -#ifndef SEGOFF_H -#define SEGOFF_H - -#include -#include - -/* Segment:offset structure. Note that the order within the structure - * is offset:segment. - */ -typedef struct { - uint16_t offset; - uint16_t segment; -} segoff_t; - -/* For PXE stuff */ -typedef segoff_t SEGOFF16_t; - -/* Macros for converting from virtual to segment:offset addresses, - * when we don't actually care which of the many isomorphic results we - * get. - */ -#ifdef DEBUG_SEGMENT -uint16_t SEGMENT ( const void * const ptr ) { - uint32_t phys = virt_to_phys ( ptr ); - if ( phys > 0xfffff ) { - printf ( "FATAL ERROR: segment address out of range\n" ); - } - return phys >> 4; -} -#else -#define SEGMENT(x) ( virt_to_phys ( x ) >> 4 ) -#endif -#define OFFSET(x) ( virt_to_phys ( x ) & 0xf ) -#define SEGOFF(x) { OFFSET(x), SEGMENT(x) } -#define VIRTUAL(x,y) ( phys_to_virt ( ( ( x ) << 4 ) + ( y ) ) ) - -#endif /* SEGOFF_H */ diff --git a/usr/src/grub/grub-0.95/netboot/sis900.c b/usr/src/grub/grub-0.95/netboot/sis900.c deleted file mode 100644 index 6d5d2c769e..0000000000 --- a/usr/src/grub/grub-0.95/netboot/sis900.c +++ /dev/null @@ -1,1251 +0,0 @@ -/* -*- Mode:C; c-basic-offset:4; -*- */ - -/* - sis900.c: An SiS 900/7016 PCI Fast Ethernet driver for Etherboot - Copyright (C) 2001 Entity Cyber, Inc. - - Revision: 1.0 March 1, 2001 - - Author: Marty Connor (mdc@thinguin.org) - - Adapted from a Linux driver which was written by Donald Becker - and modified by Ollie Lho and Chin-Shan Li of SiS Corporation. - Rewritten for Etherboot by Marty Connor. - - This software may be used and distributed according to the terms - of the GNU Public License (GPL), incorporated herein by reference. - - References: - SiS 7016 Fast Ethernet PCI Bus 10/100 Mbps LAN Controller with OnNow Support, - preliminary Rev. 1.0 Jan. 14, 1998 - SiS 900 Fast Ethernet PCI Bus 10/100 Mbps LAN Single Chip with OnNow Support, - preliminary Rev. 1.0 Nov. 10, 1998 - SiS 7014 Single Chip 100BASE-TX/10BASE-T Physical Layer Solution, - preliminary Rev. 1.0 Jan. 18, 1998 - http://www.sis.com.tw/support/databook.htm */ - -/* Revision History */ - -/* - 07 Dec 2003 timlegge - Enabled Multicast Support - 06 Dec 2003 timlegge - Fixed relocation issue in 5.2 - 04 Jan 2002 Chien-Yu Chen, Doug Ambrisko, Marty Connor Patch to Etherboot 5.0.5 - Added support for the SiS 630ET plus various bug fixes from linux kernel - source 2.4.17. - 01 March 2001 mdc 1.0 - Initial Release. Tested with PCI based sis900 card and ThinkNIC - computer. - 20 March 2001 P.Koegel - added support for sis630e and PHY ICS1893 and RTL8201 - Testet with SIS730S chipset + ICS1893 -*/ - -/* Includes */ - -#include "etherboot.h" -#include "nic.h" -#include "pci.h" -#include "timer.h" - -#include "sis900.h" - -/* Globals */ - -static int sis900_debug = 0; - -static unsigned short vendor, dev_id; -static unsigned long ioaddr; -static u8 pci_revision; - -static unsigned int cur_phy; - -static unsigned int cur_rx; - -static BufferDesc txd; -static BufferDesc rxd[NUM_RX_DESC]; -static unsigned char txb[TX_BUF_SIZE]; -static unsigned char rxb[NUM_RX_DESC * RX_BUF_SIZE]; - -#if 0 -static struct mac_chip_info { - const char *name; - u16 vendor_id, device_id, flags; - int io_size; -} mac_chip_table[] = { - { "SiS 900 PCI Fast Ethernet", PCI_VENDOR_ID_SIS, PCI_DEVICE_ID_SIS900, - PCI_COMMAND_IO|PCI_COMMAND_MASTER, SIS900_TOTAL_SIZE}, - { "SiS 7016 PCI Fast Ethernet",PCI_VENDOR_ID_SIS, PCI_DEVICE_ID_SIS7016, - PCI_COMMAND_IO|PCI_COMMAND_MASTER, SIS900_TOTAL_SIZE}, - {0,0,0,0,0} /* 0 terminated list. */ -}; -#endif - -static void sis900_read_mode(struct nic *nic, int phy_addr, int *speed, int *duplex); -static void amd79c901_read_mode(struct nic *nic, int phy_addr, int *speed, int *duplex); -static void ics1893_read_mode(struct nic *nic, int phy_addr, int *speed, int *duplex); -static void rtl8201_read_mode(struct nic *nic, int phy_addr, int *speed, int *duplex); -static void vt6103_read_mode(struct nic *nic, int phy_addr, int *speed, int *duplex); - -static struct mii_chip_info { - const char * name; - u16 phy_id0; - u16 phy_id1; - void (*read_mode) (struct nic *nic, int phy_addr, int *speed, int *duplex); -} mii_chip_table[] = { - {"SiS 900 Internal MII PHY", 0x001d, 0x8000, sis900_read_mode}, - {"SiS 7014 Physical Layer Solution", 0x0016, 0xf830,sis900_read_mode}, - {"AMD 79C901 10BASE-T PHY", 0x0000, 0x35b9, amd79c901_read_mode}, - {"AMD 79C901 HomePNA PHY", 0x0000, 0x35c8, amd79c901_read_mode}, - {"ICS 1893 Integrated PHYceiver" , 0x0015, 0xf441,ics1893_read_mode}, - {"RTL 8201 10/100Mbps Phyceiver" , 0x0000, 0x8201,rtl8201_read_mode}, - {"VIA 6103 10/100Mbps Phyceiver", 0x0101, 0x8f20,vt6103_read_mode}, - {0,0,0,0} -}; - -static struct mii_phy { - struct mii_phy * next; - struct mii_chip_info * chip_info; - int phy_addr; - u16 status; -} mii; - -// PCI to ISA bridge for SIS640E access -static struct pci_id pci_isa_bridge_list[] = { - { 0x1039, 0x0008, - "SIS 85C503/5513 PCI to ISA bridge"}, -}; - -struct pci_driver sis_bridge_driver = { - .type = BRIDGE_DRIVER, - .name = "", - .probe = 0, - .ids = pci_isa_bridge_list, - .id_count = sizeof(pci_isa_bridge_list)/sizeof(pci_isa_bridge_list[0]), - .class = 0, -}; - -/* Function Prototypes */ - -static int sis900_probe(struct dev *dev, struct pci_device *pci); - -static u16 sis900_read_eeprom(int location); -static void sis900_mdio_reset(long mdio_addr); -static void sis900_mdio_idle(long mdio_addr); -static u16 sis900_mdio_read(int phy_id, int location); -#if 0 -static void sis900_mdio_write(int phy_id, int location, int val); -#endif -static void sis900_init(struct nic *nic); - -static void sis900_reset(struct nic *nic); - -static void sis900_init_rxfilter(struct nic *nic); -static void sis900_init_txd(struct nic *nic); -static void sis900_init_rxd(struct nic *nic); -static void sis900_set_rx_mode(struct nic *nic); -static void sis900_check_mode(struct nic *nic); - -static void sis900_transmit(struct nic *nic, const char *d, - unsigned int t, unsigned int s, const char *p); -static int sis900_poll(struct nic *nic, int retrieve); - -static void sis900_disable(struct dev *dev); - -static void sis900_irq(struct nic *nic, irq_action_t action); - -/** - * sis900_get_mac_addr: - Get MAC address for stand alone SiS900 model - * @pci_dev: the sis900 pci device - * @net_dev: the net device to get address for - * - * Older SiS900 and friends, use EEPROM to store MAC address. - * MAC address is read from read_eeprom() into @net_dev->dev_addr. - */ - -static int sis900_get_mac_addr(struct pci_device * pci_dev __unused, struct nic *nic) -{ - u16 signature; - int i; - - /* check to see if we have sane EEPROM */ - signature = (u16) sis900_read_eeprom( EEPROMSignature); - if (signature == 0xffff || signature == 0x0000) { - printf ("sis900_probe: Error EERPOM read %hX\n", signature); - return 0; - } - - /* get MAC address from EEPROM */ - for (i = 0; i < 3; i++) - ((u16 *)(nic->node_addr))[i] = sis900_read_eeprom(i+EEPROMMACAddr); - return 1; -} - -/** - * sis96x_get_mac_addr: - Get MAC address for SiS962 or SiS963 model - * @pci_dev: the sis900 pci device - * @net_dev: the net device to get address for - * - * SiS962 or SiS963 model, use EEPROM to store MAC address. And EEPROM - * is shared by - * LAN and 1394. When access EEPROM, send EEREQ signal to hardware first - * and wait for EEGNT. If EEGNT is ON, EEPROM is permitted to be access - * by LAN, otherwise is not. After MAC address is read from EEPROM, send - * EEDONE signal to refuse EEPROM access by LAN. - * The EEPROM map of SiS962 or SiS963 is different to SiS900. - * The signature field in SiS962 or SiS963 spec is meaningless. - * MAC address is read into @net_dev->dev_addr. - */ - -static int sis96x_get_mac_addr(struct pci_device * pci_dev __unused, struct nic *nic) -{ -/* long ioaddr = net_dev->base_addr; */ - long ee_addr = ioaddr + mear; - u32 waittime = 0; - int i; - - printf("Alternate function\n"); - - outl(EEREQ, ee_addr); - while(waittime < 2000) { - if(inl(ee_addr) & EEGNT) { - - /* get MAC address from EEPROM */ - for (i = 0; i < 3; i++) - ((u16 *)(nic->node_addr))[i] = sis900_read_eeprom(i+EEPROMMACAddr); - - outl(EEDONE, ee_addr); - return 1; - } else { - udelay(1); - waittime ++; - } - } - outl(EEDONE, ee_addr); - return 0; -} - -/** - * sis630e_get_mac_addr: - Get MAC address for SiS630E model - * @pci_dev: the sis900 pci device - * @net_dev: the net device to get address for - * - * SiS630E model, use APC CMOS RAM to store MAC address. - * APC CMOS RAM is accessed through ISA bridge. - * MAC address is read into @net_dev->dev_addr. - */ - -static int sis630e_get_mac_addr(struct pci_device * pci_dev __unused, struct nic *nic) -{ - u8 reg; - int i; - struct pci_device p[1]; - - /* find PCI to ISA bridge */ - memset(p, 0, sizeof(p)); - do { - find_pci(BRIDGE_DRIVER, p); - } while(p->driver && p->driver != &sis_bridge_driver); - - /* error on failure */ - if (!p->driver) - return 0; - - pcibios_read_config_byte(p->bus,p->devfn, 0x48, ®); - pcibios_write_config_byte(p->bus,p->devfn, 0x48, reg | 0x40); - - for (i = 0; i < ETH_ALEN; i++) - { - outb(0x09 + i, 0x70); - ((u8 *)(nic->node_addr))[i] = inb(0x71); - } - pcibios_write_config_byte(p->bus,p->devfn, 0x48, reg & ~0x40); - - return 1; -} - -/** - * sis630e_get_mac_addr: - Get MAC address for SiS630E model - * @pci_dev: the sis900 pci device - * @net_dev: the net device to get address for - * - * SiS630E model, use APC CMOS RAM to store MAC address. - * APC CMOS RAM is accessed through ISA bridge. - * MAC address is read into @net_dev->dev_addr. - */ - -static int sis635_get_mac_addr(struct pci_device * pci_dev __unused, struct nic *nic) -{ - u32 rfcrSave; - u32 i; - - - rfcrSave = inl(rfcr + ioaddr); - - outl(rfcrSave | RELOAD, ioaddr + cr); - outl(0, ioaddr + cr); - - /* disable packet filtering before setting filter */ - outl(rfcrSave & ~RFEN, rfcr + ioaddr); - - /* load MAC addr to filter data register */ - for (i = 0 ; i < 3 ; i++) { - outl((i << RFADDR_shift), ioaddr + rfcr); - *( ((u16 *)nic->node_addr) + i) = inw(ioaddr + rfdr); - } - - /* enable packet filitering */ - outl(rfcrSave | RFEN, rfcr + ioaddr); - - return 1; -} - -/* - * Function: sis900_probe - * - * Description: initializes initializes the NIC, retrieves the - * MAC address of the card, and sets up some globals required by - * other routines. - * - * Side effects: - * leaves the ioaddress of the sis900 chip in the variable ioaddr. - * leaves the sis900 initialized, and ready to recieve packets. - * - * Returns: struct nic *: pointer to NIC data structure - */ - -static int sis900_probe(struct dev *dev, struct pci_device *pci) -{ - struct nic *nic = (struct nic *)dev; - int i; - int found=0; - int phy_addr; - u8 revision; - int ret; - - if (pci->ioaddr == 0) - return 0; - - nic->irqno = 0; - nic->ioaddr = pci->ioaddr & ~3; - ioaddr = pci->ioaddr & ~3; - vendor = pci->vendor; - dev_id = pci->dev_id; - - /* wakeup chip */ - pcibios_write_config_dword(pci->bus, pci->devfn, 0x40, 0x00000000); - - adjust_pci_device(pci); - - /* get MAC address */ - ret = 0; - pcibios_read_config_byte(pci->bus,pci->devfn, PCI_REVISION, &revision); - - /* save for use later in sis900_reset() */ - pci_revision = revision; - - if (revision == SIS630E_900_REV) - ret = sis630e_get_mac_addr(pci, nic); - else if ((revision > 0x81) && (revision <= 0x90)) - ret = sis635_get_mac_addr(pci, nic); - else if (revision == SIS96x_900_REV) - ret = sis96x_get_mac_addr(pci, nic); - else - ret = sis900_get_mac_addr(pci, nic); - - if (ret == 0) - { - printf ("sis900_probe: Error MAC address not found\n"); - return 0; - } - - /* 630ET : set the mii access mode as software-mode */ - if (revision == SIS630ET_900_REV) - outl(ACCESSMODE | inl(ioaddr + cr), ioaddr + cr); - - printf("\nsis900_probe: MAC addr %! at ioaddr %#hX\n", - nic->node_addr, ioaddr); - printf("sis900_probe: Vendor:%#hX Device:%#hX\n", vendor, dev_id); - - /* probe for mii transceiver */ - /* search for total of 32 possible mii phy addresses */ - - found = 0; - for (phy_addr = 0; phy_addr < 32; phy_addr++) { - u16 mii_status; - u16 phy_id0, phy_id1; - - mii_status = sis900_mdio_read(phy_addr, MII_STATUS); - if (mii_status == 0xffff || mii_status == 0x0000) - /* the mii is not accessable, try next one */ - continue; - - phy_id0 = sis900_mdio_read(phy_addr, MII_PHY_ID0); - phy_id1 = sis900_mdio_read(phy_addr, MII_PHY_ID1); - - /* search our mii table for the current mii */ - for (i = 0; mii_chip_table[i].phy_id1; i++) { - - if (phy_id0 == mii_chip_table[i].phy_id0) { - - printf("sis900_probe: %s transceiver found at address %d.\n", - mii_chip_table[i].name, phy_addr); - - mii.chip_info = &mii_chip_table[i]; - mii.phy_addr = phy_addr; - mii.status = sis900_mdio_read(phy_addr, MII_STATUS); - mii.next = NULL; - - found=1; - break; - } - } - } - - if (found == 0) { - printf("sis900_probe: No MII transceivers found!\n"); - return 0; - } - - /* Arbitrarily select the last PHY found as current PHY */ - cur_phy = mii.phy_addr; - printf("sis900_probe: Using %s as default\n", mii.chip_info->name); - - /* initialize device */ - sis900_init(nic); - - dev->disable = sis900_disable; - nic->poll = sis900_poll; - nic->transmit = sis900_transmit; - nic->irq = sis900_irq; - - return 1; -} - -/* - * EEPROM Routines: These functions read and write to EEPROM for - * retrieving the MAC address and other configuration information about - * the card. - */ - -/* Delay between EEPROM clock transitions. */ -#define eeprom_delay() inl(ee_addr) - -/* Function: sis900_read_eeprom - * - * Description: reads and returns a given location from EEPROM - * - * Arguments: int location: requested EEPROM location - * - * Returns: u16: contents of requested EEPROM location - * - */ - -/* Read Serial EEPROM through EEPROM Access Register, Note that location is - in word (16 bits) unit */ -static u16 sis900_read_eeprom(int location) -{ - int i; - u16 retval = 0; - long ee_addr = ioaddr + mear; - u32 read_cmd = location | EEread; - - outl(0, ee_addr); - eeprom_delay(); - outl(EECLK, ee_addr); - eeprom_delay(); - - /* Shift the read command (9) bits out. */ - for (i = 8; i >= 0; i--) { - u32 dataval = (read_cmd & (1 << i)) ? EEDI | EECS : EECS; - outl(dataval, ee_addr); - eeprom_delay(); - outl(dataval | EECLK, ee_addr); - eeprom_delay(); - } - outb(EECS, ee_addr); - eeprom_delay(); - - /* read the 16-bits data in */ - for (i = 16; i > 0; i--) { - outl(EECS, ee_addr); - eeprom_delay(); - outl(EECS | EECLK, ee_addr); - eeprom_delay(); - retval = (retval << 1) | ((inl(ee_addr) & EEDO) ? 1 : 0); - eeprom_delay(); - } - - /* Terminate the EEPROM access. */ - outl(0, ee_addr); - eeprom_delay(); - outl(EECLK, ee_addr); - - return (retval); -} - -#define sis900_mdio_delay() inl(mdio_addr) - -/* - Read and write the MII management registers using software-generated - serial MDIO protocol. Note that the command bits and data bits are - send out seperately -*/ - -static void sis900_mdio_idle(long mdio_addr) -{ - outl(MDIO | MDDIR, mdio_addr); - sis900_mdio_delay(); - outl(MDIO | MDDIR | MDC, mdio_addr); -} - -/* Syncronize the MII management interface by shifting 32 one bits out. */ -static void sis900_mdio_reset(long mdio_addr) -{ - int i; - - for (i = 31; i >= 0; i--) { - outl(MDDIR | MDIO, mdio_addr); - sis900_mdio_delay(); - outl(MDDIR | MDIO | MDC, mdio_addr); - sis900_mdio_delay(); - } - return; -} - -static u16 sis900_mdio_read(int phy_id, int location) -{ - long mdio_addr = ioaddr + mear; - int mii_cmd = MIIread|(phy_id<= 0; i--) { - int dataval = (mii_cmd & (1 << i)) ? MDDIR | MDIO : MDDIR; - outl(dataval, mdio_addr); - sis900_mdio_delay(); - outl(dataval | MDC, mdio_addr); - sis900_mdio_delay(); - } - - /* Read the 16 data bits. */ - for (i = 16; i > 0; i--) { - outl(0, mdio_addr); - sis900_mdio_delay(); - retval = (retval << 1) | ((inl(mdio_addr) & MDIO) ? 1 : 0); - outl(MDC, mdio_addr); - sis900_mdio_delay(); - } - outl(0x00, mdio_addr); - return retval; -} - -#if 0 -static void sis900_mdio_write(int phy_id, int location, int value) -{ - long mdio_addr = ioaddr + mear; - int mii_cmd = MIIwrite|(phy_id<= 0; i--) { - int dataval = (mii_cmd & (1 << i)) ? MDDIR | MDIO : MDDIR; - outb(dataval, mdio_addr); - sis900_mdio_delay(); - outb(dataval | MDC, mdio_addr); - sis900_mdio_delay(); - } - sis900_mdio_delay(); - - /* Shift the value bits out. */ - for (i = 15; i >= 0; i--) { - int dataval = (value & (1 << i)) ? MDDIR | MDIO : MDDIR; - outl(dataval, mdio_addr); - sis900_mdio_delay(); - outl(dataval | MDC, mdio_addr); - sis900_mdio_delay(); - } - sis900_mdio_delay(); - - /* Clear out extra bits. */ - for (i = 2; i > 0; i--) { - outb(0, mdio_addr); - sis900_mdio_delay(); - outb(MDC, mdio_addr); - sis900_mdio_delay(); - } - outl(0x00, mdio_addr); - return; -} -#endif - -/* Function: sis900_init - * - * Description: resets the ethernet controller chip and various - * data structures required for sending and receiving packets. - * - * Arguments: struct nic *nic: NIC data structure - * - * returns: void. - */ - -static void -sis900_init(struct nic *nic) -{ - /* Soft reset the chip. */ - sis900_reset(nic); - - sis900_init_rxfilter(nic); - - sis900_init_txd(nic); - sis900_init_rxd(nic); - - sis900_set_rx_mode(nic); - - sis900_check_mode(nic); - - outl(RxENA| inl(ioaddr + cr), ioaddr + cr); -} - -/* - * Function: sis900_reset - * - * Description: disables interrupts and soft resets the controller chip - * - * Arguments: struct nic *nic: NIC data structure - * - * Returns: void. - */ - -static void -sis900_reset(struct nic *nic __unused) -{ - int i = 0; - u32 status = TxRCMP | RxRCMP; - - outl(0, ioaddr + ier); - outl(0, ioaddr + imr); - outl(0, ioaddr + rfcr); - - outl(RxRESET | TxRESET | RESET | inl(ioaddr + cr), ioaddr + cr); - - /* Check that the chip has finished the reset. */ - while (status && (i++ < 1000)) { - status ^= (inl(isr + ioaddr) & status); - } - - if( (pci_revision == SIS635A_900_REV) || (pci_revision == SIS900B_900_REV) ) - outl(PESEL | RND_CNT, ioaddr + cfg); - else - outl(PESEL, ioaddr + cfg); -} - -/* Function: sis_init_rxfilter - * - * Description: sets receive filter address to our MAC address - * - * Arguments: struct nic *nic: NIC data structure - * - * returns: void. - */ - -static void -sis900_init_rxfilter(struct nic *nic) -{ - u32 rfcrSave; - int i; - - rfcrSave = inl(rfcr + ioaddr); - - /* disable packet filtering before setting filter */ - outl(rfcrSave & ~RFEN, rfcr + ioaddr); - - /* load MAC addr to filter data register */ - for (i = 0 ; i < 3 ; i++) { - u32 w; - - w = (u32) *((u16 *)(nic->node_addr)+i); - outl((i << RFADDR_shift), ioaddr + rfcr); - outl(w, ioaddr + rfdr); - - if (sis900_debug > 0) - printf("sis900_init_rxfilter: Receive Filter Addrss[%d]=%X\n", - i, inl(ioaddr + rfdr)); - } - - /* enable packet filitering */ - outl(rfcrSave | RFEN, rfcr + ioaddr); -} - -/* - * Function: sis_init_txd - * - * Description: initializes the Tx descriptor - * - * Arguments: struct nic *nic: NIC data structure - * - * returns: void. - */ - -static void -sis900_init_txd(struct nic *nic __unused) -{ - txd.link = (u32) 0; - txd.cmdsts = (u32) 0; - txd.bufptr = virt_to_bus(&txb[0]); - - /* load Transmit Descriptor Register */ - outl(virt_to_bus(&txd), ioaddr + txdp); - if (sis900_debug > 0) - printf("sis900_init_txd: TX descriptor register loaded with: %X\n", - inl(ioaddr + txdp)); -} - -/* Function: sis_init_rxd - * - * Description: initializes the Rx descriptor ring - * - * Arguments: struct nic *nic: NIC data structure - * - * Returns: void. - */ - -static void -sis900_init_rxd(struct nic *nic __unused) -{ - int i; - - cur_rx = 0; - - /* init RX descriptor */ - for (i = 0; i < NUM_RX_DESC; i++) { - rxd[i].link = virt_to_bus((i+1 < NUM_RX_DESC) ? &rxd[i+1] : &rxd[0]); - rxd[i].cmdsts = (u32) RX_BUF_SIZE; - rxd[i].bufptr = virt_to_bus(&rxb[i*RX_BUF_SIZE]); - if (sis900_debug > 0) - printf("sis900_init_rxd: rxd[%d]=%X link=%X cmdsts=%X bufptr=%X\n", - i, &rxd[i], rxd[i].link, rxd[i].cmdsts, rxd[i].bufptr); - } - - /* load Receive Descriptor Register */ - outl(virt_to_bus(&rxd[0]), ioaddr + rxdp); - - if (sis900_debug > 0) - printf("sis900_init_rxd: RX descriptor register loaded with: %X\n", - inl(ioaddr + rxdp)); - -} - -/* Function: sis_init_rxd - * - * Description: - * sets the receive mode to accept all broadcast packets and packets - * with our MAC address, and reject all multicast packets. - * - * Arguments: struct nic *nic: NIC data structure - * - * Returns: void. - */ - -static void sis900_set_rx_mode(struct nic *nic __unused) -{ - int i, table_entries; - u32 rx_mode; - u16 mc_filter[16] = {0}; /* 256/128 bits multicast hash table */ - - if((pci_revision == SIS635A_900_REV) || (pci_revision == SIS900B_900_REV)) - table_entries = 16; - else - table_entries = 8; - - /* accept all multicast packet */ - rx_mode = RFAAB | RFAAM; - for (i = 0; i < table_entries; i++) - mc_filter[i] = 0xffff; - - /* update Multicast Hash Table in Receive Filter */ - for (i = 0; i < table_entries; i++) { - /* why plus 0x04? That makes the correct value for hash table. */ - outl((u32)(0x00000004+i) << RFADDR_shift, ioaddr + rfcr); - outl(mc_filter[i], ioaddr + rfdr); - } - - /* Accept Broadcast and multicast packets, destination addresses that match - our MAC address */ - outl(RFEN | rx_mode, ioaddr + rfcr); - - return; -} - -/* Function: sis900_check_mode - * - * Description: checks the state of transmit and receive - * parameters on the NIC, and updates NIC registers to match - * - * Arguments: struct nic *nic: NIC data structure - * - * Returns: void. - */ - -static void -sis900_check_mode(struct nic *nic) -{ - int speed, duplex; - u32 tx_flags = 0, rx_flags = 0; - - mii.chip_info->read_mode(nic, cur_phy, &speed, &duplex); - - if( inl(ioaddr + cfg) & EDB_MASTER_EN ) { - tx_flags = TxATP | (DMA_BURST_64 << TxMXDMA_shift) | (TX_FILL_THRESH << TxFILLT_shift); - rx_flags = DMA_BURST_64 << RxMXDMA_shift; - } - else { - tx_flags = TxATP | (DMA_BURST_512 << TxMXDMA_shift) | (TX_FILL_THRESH << TxFILLT_shift); - rx_flags = DMA_BURST_512 << RxMXDMA_shift; - } - - if (speed == HW_SPEED_HOME || speed == HW_SPEED_10_MBPS) { - rx_flags |= (RxDRNT_10 << RxDRNT_shift); - tx_flags |= (TxDRNT_10 << TxDRNT_shift); - } - else { - rx_flags |= (RxDRNT_100 << RxDRNT_shift); - tx_flags |= (TxDRNT_100 << TxDRNT_shift); - } - - if (duplex == FDX_CAPABLE_FULL_SELECTED) { - tx_flags |= (TxCSI | TxHBI); - rx_flags |= RxATX; - } - - outl (tx_flags, ioaddr + txcfg); - outl (rx_flags, ioaddr + rxcfg); -} - -/* Function: sis900_read_mode - * - * Description: retrieves and displays speed and duplex - * parameters from the NIC - * - * Arguments: struct nic *nic: NIC data structure - * - * Returns: void. - */ - -static void -sis900_read_mode(struct nic *nic __unused, int phy_addr, int *speed, int *duplex) -{ - int i = 0; - u32 status; - u16 phy_id0, phy_id1; - - /* STSOUT register is Latched on Transition, read operation updates it */ - while (i++ < 2) - status = sis900_mdio_read(phy_addr, MII_STSOUT); - - *speed = HW_SPEED_10_MBPS; - *duplex = FDX_CAPABLE_HALF_SELECTED; - - if (status & (MII_NWAY_TX | MII_NWAY_TX_FDX)) - *speed = HW_SPEED_100_MBPS; - if (status & ( MII_NWAY_TX_FDX | MII_NWAY_T_FDX)) - *duplex = FDX_CAPABLE_FULL_SELECTED; - - /* Workaround for Realtek RTL8201 PHY issue */ - phy_id0 = sis900_mdio_read(phy_addr, MII_PHY_ID0); - phy_id1 = sis900_mdio_read(phy_addr, MII_PHY_ID1); - if((phy_id0 == 0x0000) && ((phy_id1 & 0xFFF0) == 0x8200)){ - if(sis900_mdio_read(phy_addr, MII_CONTROL) & MII_CNTL_FDX) - *duplex = FDX_CAPABLE_FULL_SELECTED; - if(sis900_mdio_read(phy_addr, 0x0019) & 0x01) - *speed = HW_SPEED_100_MBPS; - } - - if (status & MII_STSOUT_LINK_FAIL) - printf("sis900_read_mode: Media Link Off\n"); - else - printf("sis900_read_mode: Media Link On %s %s-duplex \n", - *speed == HW_SPEED_100_MBPS ? - "100mbps" : "10mbps", - *duplex == FDX_CAPABLE_FULL_SELECTED ? - "full" : "half"); -} - -/* Function: amd79c901_read_mode - * - * Description: retrieves and displays speed and duplex - * parameters from the NIC - * - * Arguments: struct nic *nic: NIC data structure - * - * Returns: void. - */ - -static void -amd79c901_read_mode(struct nic *nic __unused, int phy_addr, int *speed, int *duplex) -{ - int i; - u16 status; - - for (i = 0; i < 2; i++) - status = sis900_mdio_read(phy_addr, MII_STATUS); - - if (status & MII_STAT_CAN_AUTO) { - /* 10BASE-T PHY */ - for (i = 0; i < 2; i++) - status = sis900_mdio_read(phy_addr, MII_STATUS_SUMMARY); - if (status & MII_STSSUM_SPD) - *speed = HW_SPEED_100_MBPS; - else - *speed = HW_SPEED_10_MBPS; - if (status & MII_STSSUM_DPLX) - *duplex = FDX_CAPABLE_FULL_SELECTED; - else - *duplex = FDX_CAPABLE_HALF_SELECTED; - - if (status & MII_STSSUM_LINK) - printf("amd79c901_read_mode: Media Link On %s %s-duplex \n", - *speed == HW_SPEED_100_MBPS ? - "100mbps" : "10mbps", - *duplex == FDX_CAPABLE_FULL_SELECTED ? - "full" : "half"); - else - printf("amd79c901_read_mode: Media Link Off\n"); - } - else { - /* HomePNA */ - *speed = HW_SPEED_HOME; - *duplex = FDX_CAPABLE_HALF_SELECTED; - if (status & MII_STAT_LINK) - printf("amd79c901_read_mode:Media Link On 1mbps half-duplex \n"); - else - printf("amd79c901_read_mode: Media Link Off\n"); - } -} - -/** - * ics1893_read_mode: - read media mode for ICS1893 PHY - * @net_dev: the net device to read mode for - * @phy_addr: mii phy address - * @speed: the transmit speed to be determined - * @duplex: the duplex mode to be determined - * - * ICS1893 PHY use Quick Poll Detailed Status register - * to determine the speed and duplex mode for sis900 - */ - -static void ics1893_read_mode(struct nic *nic __unused, int phy_addr, int *speed, int *duplex) -{ - int i = 0; - u32 status; - - /* MII_QPDSTS is Latched, read twice in succession will reflect the current state */ - for (i = 0; i < 2; i++) - status = sis900_mdio_read(phy_addr, MII_QPDSTS); - - if (status & MII_STSICS_SPD) - *speed = HW_SPEED_100_MBPS; - else - *speed = HW_SPEED_10_MBPS; - - if (status & MII_STSICS_DPLX) - *duplex = FDX_CAPABLE_FULL_SELECTED; - else - *duplex = FDX_CAPABLE_HALF_SELECTED; - - if (status & MII_STSICS_LINKSTS) - printf("ics1893_read_mode: Media Link On %s %s-duplex \n", - *speed == HW_SPEED_100_MBPS ? - "100mbps" : "10mbps", - *duplex == FDX_CAPABLE_FULL_SELECTED ? - "full" : "half"); - else - printf("ics1893_read_mode: Media Link Off\n"); -} - -/** - * rtl8201_read_mode: - read media mode for rtl8201 phy - * @nic: the net device to read mode for - * @phy_addr: mii phy address - * @speed: the transmit speed to be determined - * @duplex: the duplex mode to be determined - * - * read MII_STATUS register from rtl8201 phy - * to determine the speed and duplex mode for sis900 - */ - -static void rtl8201_read_mode(struct nic *nic __unused, int phy_addr, int *speed, int *duplex) -{ - u32 status; - - status = sis900_mdio_read(phy_addr, MII_STATUS); - - if (status & MII_STAT_CAN_TX_FDX) { - *speed = HW_SPEED_100_MBPS; - *duplex = FDX_CAPABLE_FULL_SELECTED; - } - else if (status & MII_STAT_CAN_TX) { - *speed = HW_SPEED_100_MBPS; - *duplex = FDX_CAPABLE_HALF_SELECTED; - } - else if (status & MII_STAT_CAN_T_FDX) { - *speed = HW_SPEED_10_MBPS; - *duplex = FDX_CAPABLE_FULL_SELECTED; - } - else if (status & MII_STAT_CAN_T) { - *speed = HW_SPEED_10_MBPS; - *duplex = FDX_CAPABLE_HALF_SELECTED; - } - - if (status & MII_STAT_LINK) - printf("rtl8201_read_mode: Media Link On %s %s-duplex \n", - *speed == HW_SPEED_100_MBPS ? - "100mbps" : "10mbps", - *duplex == FDX_CAPABLE_FULL_SELECTED ? - "full" : "half"); - else - printf("rtl8201_read_config_mode: Media Link Off\n"); -} - -/** - * vt6103_read_mode: - read media mode for vt6103 phy - * @nic: the net device to read mode for - * @phy_addr: mii phy address - * @speed: the transmit speed to be determined - * @duplex: the duplex mode to be determined - * - * read MII_STATUS register from rtl8201 phy - * to determine the speed and duplex mode for sis900 - */ - -static void vt6103_read_mode(struct nic *nic __unused, int phy_addr, int *speed, int *duplex) -{ - u32 status; - - status = sis900_mdio_read(phy_addr, MII_STATUS); - - if (status & MII_STAT_CAN_TX_FDX) { - *speed = HW_SPEED_100_MBPS; - *duplex = FDX_CAPABLE_FULL_SELECTED; - } - else if (status & MII_STAT_CAN_TX) { - *speed = HW_SPEED_100_MBPS; - *duplex = FDX_CAPABLE_HALF_SELECTED; - } - else if (status & MII_STAT_CAN_T_FDX) { - *speed = HW_SPEED_10_MBPS; - *duplex = FDX_CAPABLE_FULL_SELECTED; - } - else if (status & MII_STAT_CAN_T) { - *speed = HW_SPEED_10_MBPS; - *duplex = FDX_CAPABLE_HALF_SELECTED; - } - - if (status & MII_STAT_LINK) - printf("vt6103_read_mode: Media Link On %s %s-duplex \n", - *speed == HW_SPEED_100_MBPS ? - "100mbps" : "10mbps", - *duplex == FDX_CAPABLE_FULL_SELECTED ? - "full" : "half"); - else - printf("vt6103_read_config_mode: Media Link Off\n"); -} - -/* Function: sis900_transmit - * - * Description: transmits a packet and waits for completion or timeout. - * - * Arguments: char d[6]: destination ethernet address. - * unsigned short t: ethernet protocol type. - * unsigned short s: size of the data-part of the packet. - * char *p: the data for the packet. - * - * Returns: void. - */ - -static void -sis900_transmit(struct nic *nic, - const char *d, /* Destination */ - unsigned int t, /* Type */ - unsigned int s, /* size */ - const char *p) /* Packet */ -{ - u32 to, nstype; - u32 tx_status; - - /* Stop the transmitter */ - outl(TxDIS | inl(ioaddr + cr), ioaddr + cr); - - /* load Transmit Descriptor Register */ - outl(virt_to_bus(&txd), ioaddr + txdp); - if (sis900_debug > 1) - printf("sis900_transmit: TX descriptor register loaded with: %X\n", - inl(ioaddr + txdp)); - - memcpy(txb, d, ETH_ALEN); - memcpy(txb + ETH_ALEN, nic->node_addr, ETH_ALEN); - nstype = htons(t); - memcpy(txb + 2 * ETH_ALEN, (char*)&nstype, 2); - memcpy(txb + ETH_HLEN, p, s); - - s += ETH_HLEN; - s &= DSIZE; - - if (sis900_debug > 1) - printf("sis900_transmit: sending %d bytes ethtype %hX\n", (int) s, t); - - /* pad to minimum packet size */ - while (s < ETH_ZLEN) - txb[s++] = '\0'; - - /* set the transmit buffer descriptor and enable Transmit State Machine */ - txd.bufptr = virt_to_bus(&txb[0]); - txd.cmdsts = (u32) OWN | s; - - /* restart the transmitter */ - outl(TxENA | inl(ioaddr + cr), ioaddr + cr); - - if (sis900_debug > 1) - printf("sis900_transmit: Queued Tx packet size %d.\n", (int) s); - - to = currticks() + TX_TIMEOUT; - - while ((((volatile u32) tx_status=txd.cmdsts) & OWN) && (currticks() < to)) - /* wait */ ; - - if (currticks() >= to) { - printf("sis900_transmit: TX Timeout! Tx status %X.\n", tx_status); - } - - if (tx_status & (ABORT | UNDERRUN | OWCOLL)) { - /* packet unsuccessfully transmited */ - printf("sis900_transmit: Transmit error, Tx status %X.\n", tx_status); - } - /* Disable interrupts by clearing the interrupt mask. */ - outl(0, ioaddr + imr); -} - -/* Function: sis900_poll - * - * Description: checks for a received packet and returns it if found. - * - * Arguments: struct nic *nic: NIC data structure - * - * Returns: 1 if a packet was recieved. - * 0 if no pacet was recieved. - * - * Side effects: - * Returns (copies) the packet to the array nic->packet. - * Returns the length of the packet in nic->packetlen. - */ - -static int -sis900_poll(struct nic *nic, int retrieve) -{ - u32 rx_status = rxd[cur_rx].cmdsts; - int retstat = 0; - - if (sis900_debug > 2) - printf("sis900_poll: cur_rx:%d, status:%X\n", cur_rx, rx_status); - - if (!(rx_status & OWN)) - return retstat; - - if (sis900_debug > 1) - printf("sis900_poll: got a packet: cur_rx:%d, status:%X\n", - cur_rx, rx_status); - - if ( ! retrieve ) return 1; - - nic->packetlen = (rx_status & DSIZE) - CRC_SIZE; - - if (rx_status & (ABORT|OVERRUN|TOOLONG|RUNT|RXISERR|CRCERR|FAERR)) { - /* corrupted packet received */ - printf("sis900_poll: Corrupted packet received, buffer status = %X\n", - rx_status); - retstat = 0; - } else { - /* give packet to higher level routine */ - memcpy(nic->packet, (rxb + cur_rx*RX_BUF_SIZE), nic->packetlen); - retstat = 1; - } - - /* return the descriptor and buffer to receive ring */ - rxd[cur_rx].cmdsts = RX_BUF_SIZE; - rxd[cur_rx].bufptr = virt_to_bus(&rxb[cur_rx*RX_BUF_SIZE]); - - if (++cur_rx == NUM_RX_DESC) - cur_rx = 0; - - /* re-enable the potentially idle receive state machine */ - outl(RxENA | inl(ioaddr + cr), ioaddr + cr); - - return retstat; - -} - -/* Function: sis900_disable - * - * Description: Turns off interrupts and stops Tx and Rx engines - * - * Arguments: struct nic *nic: NIC data structure - * - * Returns: void. - */ - -static void -sis900_disable(struct dev *dev) -{ - struct nic *nic = (struct nic *)dev; - /* merge reset and disable */ - sis900_init(nic); - - /* Disable interrupts by clearing the interrupt mask. */ - outl(0, ioaddr + imr); - outl(0, ioaddr + ier); - - /* Stop the chip's Tx and Rx Status Machine */ - outl(RxDIS | TxDIS | inl(ioaddr + cr), ioaddr + cr); -} - -/* Function: sis900_irq - * - * Description: Enable, Disable, or Force, interrupts - * - * Arguments: struct nic *nic: NIC data structure - * irq_action_t action: Requested action - * - * Returns: void. - */ - -static void -sis900_irq(struct nic *nic __unused, irq_action_t action __unused) -{ - switch ( action ) { - case DISABLE : - break; - case ENABLE : - break; - case FORCE : - break; - } -} - -static struct pci_id sis900_nics[] = { -PCI_ROM(0x1039, 0x0900, "sis900", "SIS900"), -PCI_ROM(0x1039, 0x7016, "sis7016", "SIS7016"), -}; - -struct pci_driver sis900_driver = { - .type = NIC_DRIVER, - .name = "SIS900", - .probe = sis900_probe, - .ids = sis900_nics, - .id_count = sizeof(sis900_nics)/sizeof(sis900_nics[0]), - .class = 0, -}; diff --git a/usr/src/grub/grub-0.95/netboot/sis900.h b/usr/src/grub/grub-0.95/netboot/sis900.h deleted file mode 100644 index 89aa3aa5aa..0000000000 --- a/usr/src/grub/grub-0.95/netboot/sis900.h +++ /dev/null @@ -1,380 +0,0 @@ -/* -*- Mode:C; c-basic-offset:4; -*- */ - -/* Definitions for SiS ethernet controllers including 7014/7016 and 900 - * References: - * SiS 7016 Fast Ethernet PCI Bus 10/100 Mbps LAN Controller with OnNow Support, - * preliminary Rev. 1.0 Jan. 14, 1998 - * SiS 900 Fast Ethernet PCI Bus 10/100 Mbps LAN Single Chip with OnNow Support, - * preliminary Rev. 1.0 Nov. 10, 1998 - * SiS 7014 Single Chip 100BASE-TX/10BASE-T Physical Layer Solution, - * preliminary Rev. 1.0 Jan. 18, 1998 - * http://www.sis.com.tw/support/databook.htm - */ - -/* MAC operationl registers of SiS 7016 and SiS 900 ethernet controller */ -/* The I/O extent, SiS 900 needs 256 bytes of io address */ -#define SIS900_TOTAL_SIZE 0x100 - -/* Symbolic offsets to registers. */ -enum sis900_registers { - cr=0x0, /* Command Register */ - cfg=0x4, /* Configuration Register */ - mear=0x8, /* EEPROM Access Register */ - ptscr=0xc, /* PCI Test Control Register */ - isr=0x10, /* Interrupt Status Register */ - imr=0x14, /* Interrupt Mask Register */ - ier=0x18, /* Interrupt Enable Register */ - epar=0x18, /* Enhanced PHY Access Register */ - txdp=0x20, /* Transmit Descriptor Pointer Register */ - txcfg=0x24, /* Transmit Configuration Register */ - rxdp=0x30, /* Receive Descriptor Pointer Register */ - rxcfg=0x34, /* Receive Configuration Register */ - flctrl=0x38, /* Flow Control Register */ - rxlen=0x3c, /* Receive Packet Length Register */ - rfcr=0x48, /* Receive Filter Control Register */ - rfdr=0x4C, /* Receive Filter Data Register */ - pmctrl=0xB0, /* Power Management Control Register */ - pmer=0xB4 /* Power Management Wake-up Event Register */ -}; - -/* Symbolic names for bits in various registers */ -enum sis900_command_register_bits { - RELOAD = 0x00000400, - ACCESSMODE = 0x00000200, - RESET = 0x00000100, - SWI = 0x00000080, - RxRESET = 0x00000020, - TxRESET = 0x00000010, - RxDIS = 0x00000008, - RxENA = 0x00000004, - TxDIS = 0x00000002, - TxENA = 0x00000001 -}; - -enum sis900_configuration_register_bits { - DESCRFMT = 0x00000100, /* 7016 specific */ - REQALG = 0x00000080, - SB = 0x00000040, - POW = 0x00000020, - EXD = 0x00000010, - PESEL = 0x00000008, - LPM = 0x00000004, - BEM = 0x00000001, - RND_CNT = 0x00000400, - FAIR_BACKOFF = 0x00000200, - EDB_MASTER_EN = 0x00002000 -}; - -enum sis900_eeprom_access_reigster_bits { - MDC = 0x00000040, - MDDIR = 0x00000020, - MDIO = 0x00000010, /* 7016 specific */ - EECS = 0x00000008, - EECLK = 0x00000004, - EEDO = 0x00000002, - EEDI = 0x00000001 -}; - -enum sis900_interrupt_register_bits { - WKEVT = 0x10000000, - TxPAUSEEND = 0x08000000, - TxPAUSE = 0x04000000, - TxRCMP = 0x02000000, - RxRCMP = 0x01000000, - DPERR = 0x00800000, - SSERR = 0x00400000, - RMABT = 0x00200000, - RTABT = 0x00100000, - RxSOVR = 0x00010000, - HIBERR = 0x00008000, - SWINT = 0x00001000, - MIBINT = 0x00000800, - TxURN = 0x00000400, - TxIDLE = 0x00000200, - TxERR = 0x00000100, - TxDESC = 0x00000080, - TxOK = 0x00000040, - RxORN = 0x00000020, - RxIDLE = 0x00000010, - RxEARLY = 0x00000008, - RxERR = 0x00000004, - RxDESC = 0x00000002, - RxOK = 0x00000001 -}; - -enum sis900_interrupt_enable_reigster_bits { - IE = 0x00000001 -}; - -/* maximum dma burst fro transmission and receive*/ -#define MAX_DMA_RANGE 7 /* actually 0 means MAXIMUM !! */ -#define TxMXDMA_shift 20 -#define RxMXDMA_shift 20 -#define TX_DMA_BURST 0 -#define RX_DMA_BURST 0 - -enum sis900_tx_rx_dma{ - DMA_BURST_512 = 0, DMA_BURST_64 = 5 -}; - -/* transmit FIFO threshholds */ -#define TX_FILL_THRESH 16 /* 1/4 FIFO size */ -#define TxFILLT_shift 8 -#define TxDRNT_shift 0 -#define TxDRNT_100 48 /* 3/4 FIFO size */ -#define TxDRNT_10 16 /* 1/2 FIFO size */ - -enum sis900_transmit_config_register_bits { - TxCSI = 0x80000000, - TxHBI = 0x40000000, - TxMLB = 0x20000000, - TxATP = 0x10000000, - TxIFG = 0x0C000000, - TxFILLT = 0x00003F00, - TxDRNT = 0x0000003F -}; - -/* recevie FIFO thresholds */ -#define RxDRNT_shift 1 -#define RxDRNT_100 16 /* 1/2 FIFO size */ -#define RxDRNT_10 24 /* 3/4 FIFO size */ - -enum sis900_reveive_config_register_bits { - RxAEP = 0x80000000, - RxARP = 0x40000000, - RxATX = 0x10000000, - RxAJAB = 0x08000000, - RxDRNT = 0x0000007F -}; - -#define RFAA_shift 28 -#define RFADDR_shift 16 - -enum sis900_receive_filter_control_register_bits { - RFEN = 0x80000000, - RFAAB = 0x40000000, - RFAAM = 0x20000000, - RFAAP = 0x10000000, - RFPromiscuous = (RFAAB|RFAAM|RFAAP) -}; - -enum sis900_reveive_filter_data_mask { - RFDAT = 0x0000FFFF -}; - -/* EEPROM Addresses */ -enum sis900_eeprom_address { - EEPROMSignature = 0x00, - EEPROMVendorID = 0x02, - EEPROMDeviceID = 0x03, - EEPROMMACAddr = 0x08, - EEPROMChecksum = 0x0b -}; - -/* The EEPROM commands include the alway-set leading bit. Refer to NM93Cxx datasheet */ -enum sis900_eeprom_command { - EEread = 0x0180, - EEwrite = 0x0140, - EEerase = 0x01C0, - EEwriteEnable = 0x0130, - EEwriteDisable = 0x0100, - EEeraseAll = 0x0120, - EEwriteAll = 0x0110, - EEaddrMask = 0x013F, - EEcmdShift = 16 -}; -/* For SiS962 or SiS963, request the eeprom software access */ -enum sis96x_eeprom_command { - EEREQ = 0x00000400, EEDONE = 0x00000200, EEGNT = 0x00000100 -}; - -/* Manamgement Data I/O (mdio) frame */ -#define MIIread 0x6000 -#define MIIwrite 0x5002 -#define MIIpmdShift 7 -#define MIIregShift 2 -#define MIIcmdLen 16 -#define MIIcmdShift 16 - -/* Buffer Descriptor Status*/ -enum sis900_buffer_status { - OWN = 0x80000000, - MORE = 0x40000000, - INTR = 0x20000000, - SUPCRC = 0x10000000, - INCCRC = 0x10000000, - OK = 0x08000000, - DSIZE = 0x00000FFF -}; - -/* Status for TX Buffers */ -enum sis900_tx_buffer_status { - ABORT = 0x04000000, - UNDERRUN = 0x02000000, - NOCARRIER = 0x01000000, - DEFERD = 0x00800000, - EXCDEFER = 0x00400000, - OWCOLL = 0x00200000, - EXCCOLL = 0x00100000, - COLCNT = 0x000F0000 -}; - -enum sis900_rx_bufer_status { - OVERRUN = 0x02000000, - DEST = 0x00800000, - BCAST = 0x01800000, - MCAST = 0x01000000, - UNIMATCH = 0x00800000, - TOOLONG = 0x00400000, - RUNT = 0x00200000, - RXISERR = 0x00100000, - CRCERR = 0x00080000, - FAERR = 0x00040000, - LOOPBK = 0x00020000, - RXCOL = 0x00010000 -}; - -/* MII register offsets */ -enum mii_registers { - MII_CONTROL = 0x0000, - MII_STATUS = 0x0001, - MII_PHY_ID0 = 0x0002, - MII_PHY_ID1 = 0x0003, - MII_ANADV = 0x0004, - MII_ANLPAR = 0x0005, - MII_ANEXT = 0x0006 -}; - -/* mii registers specific to SiS 900 */ -enum sis_mii_registers { - MII_CONFIG1 = 0x0010, - MII_CONFIG2 = 0x0011, - MII_STSOUT = 0x0012, - MII_MASK = 0x0013, - MII_RESV = 0x0014 -}; - -/* mii registers specific to AMD 79C901 */ -enum amd_mii_registers { - MII_STATUS_SUMMARY = 0x0018 -}; - -/* mii registers specific to ICS 1893 */ -enum ics_mii_registers { - MII_EXTCTRL = 0x0010, MII_QPDSTS = 0x0011, MII_10BTOP = 0x0012, - MII_EXTCTRL2 = 0x0013 -}; - - - -/* MII Control register bit definitions. */ -enum mii_control_register_bits { - MII_CNTL_FDX = 0x0100, - MII_CNTL_RST_AUTO = 0x0200, - MII_CNTL_ISOLATE = 0x0400, - MII_CNTL_PWRDWN = 0x0800, - MII_CNTL_AUTO = 0x1000, - MII_CNTL_SPEED = 0x2000, - MII_CNTL_LPBK = 0x4000, - MII_CNTL_RESET = 0x8000 -}; - -/* MII Status register bit */ -enum mii_status_register_bits { - MII_STAT_EXT = 0x0001, - MII_STAT_JAB = 0x0002, - MII_STAT_LINK = 0x0004, - MII_STAT_CAN_AUTO = 0x0008, - MII_STAT_FAULT = 0x0010, - MII_STAT_AUTO_DONE = 0x0020, - MII_STAT_CAN_T = 0x0800, - MII_STAT_CAN_T_FDX = 0x1000, - MII_STAT_CAN_TX = 0x2000, - MII_STAT_CAN_TX_FDX = 0x4000, - MII_STAT_CAN_T4 = 0x8000 -}; - -#define MII_ID1_OUI_LO 0xFC00 /* low bits of OUI mask */ -#define MII_ID1_MODEL 0x03F0 /* model number */ -#define MII_ID1_REV 0x000F /* model number */ - -/* MII NWAY Register Bits ... - valid for the ANAR (Auto-Negotiation Advertisement) and - ANLPAR (Auto-Negotiation Link Partner) registers */ -enum mii_nway_register_bits { - MII_NWAY_NODE_SEL = 0x001f, - MII_NWAY_CSMA_CD = 0x0001, - MII_NWAY_T = 0x0020, - MII_NWAY_T_FDX = 0x0040, - MII_NWAY_TX = 0x0080, - MII_NWAY_TX_FDX = 0x0100, - MII_NWAY_T4 = 0x0200, - MII_NWAY_PAUSE = 0x0400, - MII_NWAY_RF = 0x2000, - MII_NWAY_ACK = 0x4000, - MII_NWAY_NP = 0x8000 -}; - -enum mii_stsout_register_bits { - MII_STSOUT_LINK_FAIL = 0x4000, - MII_STSOUT_SPD = 0x0080, - MII_STSOUT_DPLX = 0x0040 -}; - -enum mii_stsics_register_bits { - MII_STSICS_SPD = 0x8000, MII_STSICS_DPLX = 0x4000, - MII_STSICS_LINKSTS = 0x0001 -}; - -enum mii_stssum_register_bits { - MII_STSSUM_LINK = 0x0008, - MII_STSSUM_DPLX = 0x0004, - MII_STSSUM_AUTO = 0x0002, - MII_STSSUM_SPD = 0x0001 -}; - -enum sis900_revision_id { - SIS630A_900_REV = 0x80, SIS630E_900_REV = 0x81, - SIS630S_900_REV = 0x82, SIS630EA1_900_REV = 0x83, - SIS630ET_900_REV = 0x84, SIS635A_900_REV = 0x90, - SIS96x_900_REV = 0X91, SIS900B_900_REV = 0x03 -}; - -enum sis630_revision_id { - SIS630A0 = 0x00, SIS630A1 = 0x01, - SIS630B0 = 0x10, SIS630B1 = 0x11 -}; - -#define FDX_CAPABLE_DUPLEX_UNKNOWN 0 -#define FDX_CAPABLE_HALF_SELECTED 1 -#define FDX_CAPABLE_FULL_SELECTED 2 - -#define HW_SPEED_UNCONFIG 0 -#define HW_SPEED_HOME 1 -#define HW_SPEED_10_MBPS 10 -#define HW_SPEED_100_MBPS 100 -#define HW_SPEED_DEFAULT (HW_SPEED_100_MBPS) - -#define CRC_SIZE 4 -#define MAC_HEADER_SIZE 14 - -#define TX_BUF_SIZE 1536 -#define RX_BUF_SIZE 1536 - -#define NUM_RX_DESC 4 /* Number of Rx descriptor registers. */ - -typedef unsigned char u8; -typedef signed char s8; -typedef unsigned short u16; -typedef signed short s16; -typedef unsigned int u32; -typedef signed int s32; - -/* Time in ticks before concluding the transmitter is hung. */ -#define TX_TIMEOUT (4*TICKS_PER_SEC) - -typedef struct _BufferDesc { - u32 link; - volatile u32 cmdsts; - u32 bufptr; -} BufferDesc; diff --git a/usr/src/grub/grub-0.95/netboot/stdint.h b/usr/src/grub/grub-0.95/netboot/stdint.h deleted file mode 100644 index 037f12fa48..0000000000 --- a/usr/src/grub/grub-0.95/netboot/stdint.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef STDINT_H -#define STDINT_H -/* - * I'm architecture depended. Check me before port GRUB - */ -typedef unsigned size_t; - -typedef unsigned char uint8_t; -typedef unsigned short uint16_t; -typedef unsigned long uint32_t; -typedef unsigned long long uint64_t; - -typedef signed char int8_t; -typedef signed short int16_t; -typedef signed long int32_t; -typedef signed long long int64_t; - -#endif /* STDINT_H */ diff --git a/usr/src/grub/grub-0.95/netboot/sundance.c b/usr/src/grub/grub-0.95/netboot/sundance.c deleted file mode 100644 index 04ace8b804..0000000000 --- a/usr/src/grub/grub-0.95/netboot/sundance.c +++ /dev/null @@ -1,896 +0,0 @@ -/************************************************************************** -* -* sundance.c -- Etherboot device driver for the Sundance ST201 "Alta". -* Written 2002-2002 by Timothy Legge -* -* 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. -* -* Portions of this code based on: -* sundance.c: A Linux device driver for the Sundance ST201 "Alta" -* Written 1999-2002 by Donald Becker -* -* tulip.c: Tulip and Clone Etherboot Driver -* By Marty Conner -* Copyright (C) 2001 Entity Cyber, Inc. -* -* Linux Driver Version LK1.09a, 10-Jul-2003 (2.4.25) -* -* REVISION HISTORY: -* ================ -* v1.1 01-01-2003 timlegge Initial implementation -* v1.7 04-10-2003 timlegge Transfers Linux Kernel (30 sec) -* v1.8 04-13-2003 timlegge Fix multiple transmission bug -* v1.9 08-19-2003 timlegge Support Multicast -* v1.10 01-17-2004 timlegge Initial driver output cleanup -* v1.11 03-21-2004 timlegge Remove unused variables -* v1.12 03-21-2004 timlegge Remove excess MII defines -* v1.13 03-24-2004 timlegge Update to Linux 2.4.25 driver -* -****************************************************************************/ - -/* to get some global routines like printf */ -#include "etherboot.h" -/* to get the interface to the body of the program */ -#include "nic.h" -/* to get the PCI support functions, if this is a PCI NIC */ -#include "pci.h" -#include "timer.h" -#include "mii.h" - -#define drv_version "v1.12" -#define drv_date "2004-03-21" - -typedef unsigned char u8; -typedef signed char s8; -typedef unsigned short u16; -typedef signed short s16; -typedef unsigned int u32; -typedef signed int s32; - -#define HZ 100 - -/* Condensed operations for readability. */ -#define virt_to_le32desc(addr) cpu_to_le32(virt_to_bus(addr)) -#define le32desc_to_virt(addr) bus_to_virt(le32_to_cpu(addr)) - -/* May need to be moved to mii.h */ -struct mii_if_info { - int phy_id; - int advertising; - unsigned int full_duplex:1; /* is full duplex? */ -}; - -//#define EDEBUG -#ifdef EDEBUG -#define dprintf(x) printf x -#else -#define dprintf(x) -#endif - -#if defined(__sun) -/* Hack: use grub_strcmp since strcasecmp is undefined */ -#define strcasecmp grub_strcmp -#endif - - -/* Set the mtu */ -static int mtu = 1514; - -/* Maximum number of multicast addresses to filter (vs. rx-all-multicast). - The sundance uses a 64 element hash table based on the Ethernet CRC. */ -// static int multicast_filter_limit = 32; - -/* Set the copy breakpoint for the copy-only-tiny-frames scheme. - Setting to > 1518 effectively disables this feature. - This chip can receive into any byte alignment buffers, so word-oriented - archs do not need a copy-align of the IP header. */ -static int rx_copybreak = 0; -static int flowctrl = 1; - -/* Allow forcing the media type */ -/* media[] specifies the media type the NIC operates at. - autosense Autosensing active media. - 10mbps_hd 10Mbps half duplex. - 10mbps_fd 10Mbps full duplex. - 100mbps_hd 100Mbps half duplex. - 100mbps_fd 100Mbps full duplex. -*/ -static char media[] = "autosense"; - -/* Operational parameters that are set at compile time. */ - -/* As Etherboot uses a Polling driver we can keep the number of rings -to the minimum number required. In general that is 1 transmit and 4 receive receive rings. However some cards require that -there be a minimum of 2 rings */ -#define TX_RING_SIZE 2 -#define TX_QUEUE_LEN 10 /* Limit ring entries actually used. */ -#define RX_RING_SIZE 4 - - -/* Operational parameters that usually are not changed. */ -/* Time in jiffies before concluding the transmitter is hung. */ -#define TX_TIME_OUT (4*HZ) -#define PKT_BUF_SZ 1536 - -/* Offsets to the device registers. - Unlike software-only systems, device drivers interact with complex hardware. - It's not useful to define symbolic names for every register bit in the - device. The name can only partially document the semantics and make - the driver longer and more difficult to read. - In general, only the important configuration values or bits changed - multiple times should be defined symbolically. -*/ -enum alta_offsets { - DMACtrl = 0x00, - TxListPtr = 0x04, - TxDMABurstThresh = 0x08, - TxDMAUrgentThresh = 0x09, - TxDMAPollPeriod = 0x0a, - RxDMAStatus = 0x0c, - RxListPtr = 0x10, - DebugCtrl0 = 0x1a, - DebugCtrl1 = 0x1c, - RxDMABurstThresh = 0x14, - RxDMAUrgentThresh = 0x15, - RxDMAPollPeriod = 0x16, - LEDCtrl = 0x1a, - ASICCtrl = 0x30, - EEData = 0x34, - EECtrl = 0x36, - TxStartThresh = 0x3c, - RxEarlyThresh = 0x3e, - FlashAddr = 0x40, - FlashData = 0x44, - TxStatus = 0x46, - TxFrameId = 0x47, - DownCounter = 0x18, - IntrClear = 0x4a, - IntrEnable = 0x4c, - IntrStatus = 0x4e, - MACCtrl0 = 0x50, - MACCtrl1 = 0x52, - StationAddr = 0x54, - MaxFrameSize = 0x5A, - RxMode = 0x5c, - MIICtrl = 0x5e, - MulticastFilter0 = 0x60, - MulticastFilter1 = 0x64, - RxOctetsLow = 0x68, - RxOctetsHigh = 0x6a, - TxOctetsLow = 0x6c, - TxOctetsHigh = 0x6e, - TxFramesOK = 0x70, - RxFramesOK = 0x72, - StatsCarrierError = 0x74, - StatsLateColl = 0x75, - StatsMultiColl = 0x76, - StatsOneColl = 0x77, - StatsTxDefer = 0x78, - RxMissed = 0x79, - StatsTxXSDefer = 0x7a, - StatsTxAbort = 0x7b, - StatsBcastTx = 0x7c, - StatsBcastRx = 0x7d, - StatsMcastTx = 0x7e, - StatsMcastRx = 0x7f, - /* Aliased and bogus values! */ - RxStatus = 0x0c, -}; -enum ASICCtrl_HiWord_bit { - GlobalReset = 0x0001, - RxReset = 0x0002, - TxReset = 0x0004, - DMAReset = 0x0008, - FIFOReset = 0x0010, - NetworkReset = 0x0020, - HostReset = 0x0040, - ResetBusy = 0x0400, -}; - -/* Bits in the interrupt status/mask registers. */ -enum intr_status_bits { - IntrSummary = 0x0001, IntrPCIErr = 0x0002, IntrMACCtrl = 0x0008, - IntrTxDone = 0x0004, IntrRxDone = 0x0010, IntrRxStart = 0x0020, - IntrDrvRqst = 0x0040, - StatsMax = 0x0080, LinkChange = 0x0100, - IntrTxDMADone = 0x0200, IntrRxDMADone = 0x0400, -}; - -/* Bits in the RxMode register. */ -enum rx_mode_bits { - AcceptAllIPMulti = 0x20, AcceptMultiHash = 0x10, AcceptAll = 0x08, - AcceptBroadcast = 0x04, AcceptMulticast = 0x02, AcceptMyPhys = - 0x01, -}; -/* Bits in MACCtrl. */ -enum mac_ctrl0_bits { - EnbFullDuplex = 0x20, EnbRcvLargeFrame = 0x40, - EnbFlowCtrl = 0x100, EnbPassRxCRC = 0x200, -}; -enum mac_ctrl1_bits { - StatsEnable = 0x0020, StatsDisable = 0x0040, StatsEnabled = 0x0080, - TxEnable = 0x0100, TxDisable = 0x0200, TxEnabled = 0x0400, - RxEnable = 0x0800, RxDisable = 0x1000, RxEnabled = 0x2000, -}; - -/* The Rx and Tx buffer descriptors. - Using only 32 bit fields simplifies software endian correction. - This structure must be aligned, and should avoid spanning cache lines. -*/ -struct netdev_desc { - u32 next_desc; - u32 status; - u32 addr; - u32 length; -}; - -/* Bits in netdev_desc.status */ -enum desc_status_bits { - DescOwn = 0x8000, - DescEndPacket = 0x4000, - DescEndRing = 0x2000, - LastFrag = 0x80000000, - DescIntrOnTx = 0x8000, - DescIntrOnDMADone = 0x80000000, - DisableAlign = 0x00000001, -}; - -/********************************************** -* Descriptor Ring and Buffer defination -***********************************************/ -/* Define the TX Descriptor */ -static struct netdev_desc tx_ring[TX_RING_SIZE]; - -/* Create a static buffer of size PKT_BUF_SZ for each TX Descriptor. - All descriptors point to a part of this buffer */ -static unsigned char txb[PKT_BUF_SZ * TX_RING_SIZE]; - -/* Define the RX Descriptor */ -static struct netdev_desc rx_ring[RX_RING_SIZE]; - -/* Create a static buffer of size PKT_BUF_SZ for each RX Descriptor. - All descriptors point to a part of this buffer */ -static unsigned char rxb[RX_RING_SIZE * PKT_BUF_SZ]; - -/* FIXME: Move BASE to the private structure */ -static u32 BASE; -#define EEPROM_SIZE 128 - -enum pci_id_flags_bits { - PCI_USES_IO = 1, PCI_USES_MEM = 2, PCI_USES_MASTER = 4, - PCI_ADDR0 = 0 << 4, PCI_ADDR1 = 1 << 4, PCI_ADDR2 = - 2 << 4, PCI_ADDR3 = 3 << 4, -}; - -enum chip_capability_flags { CanHaveMII = 1, KendinPktDropBug = 2, }; -#define PCI_IOTYPE (PCI_USES_MASTER | PCI_USES_IO | PCI_ADDR0) - -#define MII_CNT 4 -struct sundance_private { - const char *nic_name; - /* Frequently used values */ - - unsigned int cur_rx; /* Producer/consumer ring indicies */ - unsigned int mtu; - - /* These values keep track of the tranceiver/media in use */ - unsigned int flowctrl:1; - unsigned int an_enable:1; - - unsigned int speed; - - /* MII tranceiver section */ - struct mii_if_info mii_if; - int mii_preamble_required; - unsigned char phys[MII_CNT]; - unsigned char pci_rev_id; -} sdx; - -static struct sundance_private *sdc; - -/* Station Address location within the EEPROM */ -#define EEPROM_SA_OFFSET 0x10 -#define DEFAULT_INTR (IntrRxDMADone | IntrPCIErr | \ - IntrDrvRqst | IntrTxDone | StatsMax | \ - LinkChange) - -static int eeprom_read(long ioaddr, int location); -static int mdio_read(struct nic *nic, int phy_id, unsigned int location); -static void mdio_write(struct nic *nic, int phy_id, unsigned int location, - int value); -static void set_rx_mode(struct nic *nic); - -static void check_duplex(struct nic *nic) -{ - int mii_lpa = mdio_read(nic, sdc->phys[0], MII_LPA); - int negotiated = mii_lpa & sdc->mii_if.advertising; - int duplex; - - /* Force media */ - if (!sdc->an_enable || mii_lpa == 0xffff) { - if (sdc->mii_if.full_duplex) - outw(inw(BASE + MACCtrl0) | EnbFullDuplex, - BASE + MACCtrl0); - return; - } - - /* Autonegotiation */ - duplex = (negotiated & 0x0100) || (negotiated & 0x01C0) == 0x0040; - if (sdc->mii_if.full_duplex != duplex) { - sdc->mii_if.full_duplex = duplex; - dprintf(("%s: Setting %s-duplex based on MII #%d " - "negotiated capability %4.4x.\n", sdc->nic_name, - duplex ? "full" : "half", sdc->phys[0], - negotiated)); - outw(inw(BASE + MACCtrl0) | duplex ? 0x20 : 0, - BASE + MACCtrl0); - } -} - - -/************************************************************************** - * init_ring - setup the tx and rx descriptors - *************************************************************************/ -static void init_ring(struct nic *nic __unused) -{ - int i; - - sdc->cur_rx = 0; - - /* Initialize all the Rx descriptors */ - for (i = 0; i < RX_RING_SIZE; i++) { - rx_ring[i].next_desc = virt_to_le32desc(&rx_ring[i + 1]); - rx_ring[i].status = 0; - rx_ring[i].length = 0; - rx_ring[i].addr = 0; - } - - /* Mark the last entry as wrapping the ring */ - rx_ring[i - 1].next_desc = virt_to_le32desc(&rx_ring[0]); - - for (i = 0; i < RX_RING_SIZE; i++) { - rx_ring[i].addr = virt_to_le32desc(&rxb[i * PKT_BUF_SZ]); - rx_ring[i].length = cpu_to_le32(PKT_BUF_SZ | LastFrag); - } - - /* We only use one transmit buffer, but two - * descriptors so transmit engines have somewhere - * to point should they feel the need */ - tx_ring[0].status = 0x00000000; - tx_ring[0].addr = virt_to_bus(&txb[0]); - tx_ring[0].next_desc = 0; /* virt_to_bus(&tx_ring[1]); */ - - /* This descriptor is never used */ - tx_ring[1].status = 0x00000000; - tx_ring[1].addr = 0; /*virt_to_bus(&txb[0]); */ - tx_ring[1].next_desc = 0; - - /* Mark the last entry as wrapping the ring, - * though this should never happen */ - tx_ring[1].length = cpu_to_le32(LastFrag | PKT_BUF_SZ); -} - -/************************************************************************** - * RESET - Reset Adapter - * ***********************************************************************/ -static void sundance_reset(struct nic *nic) -{ - int i; - - init_ring(nic); - - outl(virt_to_le32desc(&rx_ring[0]), BASE + RxListPtr); - /* The Tx List Pointer is written as packets are queued */ - - /* Initialize other registers. */ - /* __set_mac_addr(dev); */ - { - u16 addr16; - - addr16 = (nic->node_addr[0] | (nic->node_addr[1] << 8)); - outw(addr16, BASE + StationAddr); - addr16 = (nic->node_addr[2] | (nic->node_addr[3] << 8)); - outw(addr16, BASE + StationAddr + 2); - addr16 = (nic->node_addr[4] | (nic->node_addr[5] << 8)); - outw(addr16, BASE + StationAddr + 4); - } - - outw(sdc->mtu + 14, BASE + MaxFrameSize); - if (sdc->mtu > 2047) /* this will never happen with default options */ - outl(inl(BASE + ASICCtrl) | 0x0c, BASE + ASICCtrl); - - set_rx_mode(nic); - - outw(0, BASE + DownCounter); - /* Set the chip to poll every N*30nsec */ - outb(100, BASE + RxDMAPollPeriod); - - /* Fix DFE-580TX packet drop issue */ - if (sdc->pci_rev_id >= 0x14) - writeb(0x01, BASE + DebugCtrl1); - - outw(RxEnable | TxEnable, BASE + MACCtrl1); - - /* Construct a perfect filter frame with the mac address as first match - * and broadcast for all others */ - for (i = 0; i < 192; i++) - txb[i] = 0xFF; - - txb[0] = nic->node_addr[0]; - txb[1] = nic->node_addr[1]; - txb[2] = nic->node_addr[2]; - txb[3] = nic->node_addr[3]; - txb[4] = nic->node_addr[4]; - txb[5] = nic->node_addr[5]; - - dprintf(("%s: Done sundance_reset, status: Rx %hX Tx %hX " - "MAC Control %hX, %hX %hX\n", - sdc->nic_name, (int) inl(BASE + RxStatus), - (int) inw(BASE + TxStatus), (int) inl(BASE + MACCtrl0), - (int) inw(BASE + MACCtrl1), (int) inw(BASE + MACCtrl0))); -} - -/************************************************************************** -IRQ - Wait for a frame -***************************************************************************/ -void sundance_irq ( struct nic *nic, irq_action_t action ) { - unsigned int intr_status; - - switch ( action ) { - case DISABLE : - case ENABLE : - intr_status = inw(nic->ioaddr + IntrStatus); - intr_status = intr_status & ~DEFAULT_INTR; - if ( action == ENABLE ) - intr_status = intr_status | DEFAULT_INTR; - outw(intr_status, nic->ioaddr + IntrEnable); - break; - case FORCE : - outw(0x0200, BASE + ASICCtrl); - break; - } -} -/************************************************************************** -POLL - Wait for a frame -***************************************************************************/ -static int sundance_poll(struct nic *nic, int retreive) -{ - /* return true if there's an ethernet packet ready to read */ - /* nic->packet should contain data on return */ - /* nic->packetlen should contain length of data */ - int entry = sdc->cur_rx % RX_RING_SIZE; - u32 frame_status = le32_to_cpu(rx_ring[entry].status); - int intr_status; - int pkt_len = 0; - - if (!(frame_status & DescOwn)) - return 0; - - /* There is a packet ready */ - if(!retreive) - return 1; - - intr_status = inw(nic->ioaddr + IntrStatus); - outw(intr_status, nic->ioaddr + IntrStatus); - - pkt_len = frame_status & 0x1fff; - - if (frame_status & 0x001f4000) { - dprintf(("Polling frame_status error\n")); /* Do we really care about this */ - } else { - if (pkt_len < rx_copybreak) { - /* FIXME: What should happen Will this ever occur */ - printf("Poll Error: pkt_len < rx_copybreak"); - } else { - nic->packetlen = pkt_len; - memcpy(nic->packet, rxb + - (sdc->cur_rx * PKT_BUF_SZ), nic->packetlen); - - } - } - rx_ring[entry].length = cpu_to_le32(PKT_BUF_SZ | LastFrag); - rx_ring[entry].status = 0; - entry++; - sdc->cur_rx = entry % RX_RING_SIZE; - outw(DEFAULT_INTR & ~(IntrRxDone|IntrRxDMADone), - nic->ioaddr + IntrStatus); - return 1; -} - -/************************************************************************** -TRANSMIT - Transmit a frame -***************************************************************************/ -static void sundance_transmit(struct nic *nic, const char *d, /* Destination */ - unsigned int t, /* Type */ - unsigned int s, /* size */ - const char *p) -{ /* Packet */ - u16 nstype; - u32 to; - - /* Disable the Tx */ - outw(TxDisable, BASE + MACCtrl1); - - memcpy(txb, d, ETH_ALEN); - memcpy(txb + ETH_ALEN, nic->node_addr, ETH_ALEN); - nstype = htons((u16) t); - memcpy(txb + 2 * ETH_ALEN, (u8 *) & nstype, 2); - memcpy(txb + ETH_HLEN, p, s); - - s += ETH_HLEN; - s &= 0x0FFF; - while (s < ETH_ZLEN) - txb[s++] = '\0'; - - /* Setup the transmit descriptor */ - tx_ring[0].length = cpu_to_le32(s | LastFrag); - tx_ring[0].status = cpu_to_le32(0x00000001); - - /* Point to transmit descriptor */ - outl(virt_to_le32desc(&tx_ring[0]), BASE + TxListPtr); - - /* Enable Tx */ - outw(TxEnable, BASE + MACCtrl1); - /* Trigger an immediate send */ - outw(0, BASE + TxStatus); - - to = currticks() + TX_TIME_OUT; - while (!(tx_ring[0].status & 0x00010000) && (currticks() < to)); /* wait */ - - if (currticks() >= to) { - printf("TX Time Out"); - } - /* Disable Tx */ - outw(TxDisable, BASE + MACCtrl1); - -} - -/************************************************************************** -DISABLE - Turn off ethernet interface -***************************************************************************/ -static void sundance_disable(struct dev *dev __unused) -{ - /* put the card in its initial state */ - /* This function serves 3 purposes. - * This disables DMA and interrupts so we don't receive - * unexpected packets or interrupts from the card after - * etherboot has finished. - * This frees resources so etherboot may use - * this driver on another interface - * This allows etherboot to reinitialize the interface - * if something is something goes wrong. - */ - outw(0x0000, BASE + IntrEnable); - /* Stop the Chipchips Tx and Rx Status */ - outw(TxDisable | RxDisable | StatsDisable, BASE + MACCtrl1); -} - - - -/************************************************************************** -PROBE - Look for an adapter, this routine's visible to the outside -***************************************************************************/ -static int sundance_probe(struct dev *dev, struct pci_device *pci) -{ - struct nic *nic = (struct nic *) dev; - u8 ee_data[EEPROM_SIZE]; - u16 mii_ctl; - int i; - int speed; - - if (pci->ioaddr == 0) - return 0; - - /* BASE is used throughout to address the card */ - BASE = pci->ioaddr; - printf(" sundance.c: Found %s Vendor=0x%hX Device=0x%hX\n", - pci->name, pci->vendor, pci->dev_id); - - /* Get the MAC Address by reading the EEPROM */ - for (i = 0; i < 3; i++) { - ((u16 *) ee_data)[i] = - le16_to_cpu(eeprom_read(BASE, i + EEPROM_SA_OFFSET)); - } - /* Update the nic structure with the MAC Address */ - for (i = 0; i < ETH_ALEN; i++) { - nic->node_addr[i] = ee_data[i]; - } - - /* Set the card as PCI Bus Master */ - adjust_pci_device(pci); - -// sdc->mii_if.dev = pci; -// sdc->mii_if.phy_id_mask = 0x1f; -// sdc->mii_if.reg_num_mask = 0x1f; - - /* point to private storage */ - sdc = &sdx; - - sdc->nic_name = pci->name; - sdc->mtu = mtu; - - pci_read_config_byte(pci, PCI_REVISION_ID, &sdc->pci_rev_id); - dprintf(("Device revision id: %hx\n", sdc->pci_rev_id)); - /* Print out some hardware info */ - printf("%s: %! at ioaddr %hX, ", pci->name, nic->node_addr, BASE); - sdc->mii_preamble_required = 0; - if (1) { - int phy, phy_idx = 0; - sdc->phys[0] = 1; /* Default Setting */ - sdc->mii_preamble_required++; - for (phy = 1; phy < 32 && phy_idx < MII_CNT; phy++) { - int mii_status = mdio_read(nic, phy, MII_BMSR); - if (mii_status != 0xffff && mii_status != 0x0000) { - sdc->phys[phy_idx++] = phy; - sdc->mii_if.advertising = - mdio_read(nic, phy, MII_ADVERTISE); - if ((mii_status & 0x0040) == 0) - sdc->mii_preamble_required++; - dprintf - (("%s: MII PHY found at address %d, status " "%hX advertising %hX\n", sdc->nic_name, phy, mii_status, sdc->mii_if.advertising)); - } - } - sdc->mii_preamble_required--; - if (phy_idx == 0) - printf("%s: No MII transceiver found!\n", - sdc->nic_name); - sdc->mii_if.phy_id = sdc->phys[0]; - } - - /* Parse override configuration */ - sdc->an_enable = 1; - if (strcasecmp(media, "autosense") != 0) { - sdc->an_enable = 0; - if (strcasecmp(media, "100mbps_fd") == 0 || - strcasecmp(media, "4") == 0) { - sdc->speed = 100; - sdc->mii_if.full_duplex = 1; - } else if (strcasecmp(media, "100mbps_hd") == 0 - || strcasecmp(media, "3") == 0) { - sdc->speed = 100; - sdc->mii_if.full_duplex = 0; - } else if (strcasecmp(media, "10mbps_fd") == 0 || - strcasecmp(media, "2") == 0) { - sdc->speed = 10; - sdc->mii_if.full_duplex = 1; - } else if (strcasecmp(media, "10mbps_hd") == 0 || - strcasecmp(media, "1") == 0) { - sdc->speed = 10; - sdc->mii_if.full_duplex = 0; - } else { - sdc->an_enable = 1; - } - } - if (flowctrl == 1) - sdc->flowctrl = 1; - - /* Fibre PHY? */ - if (inl(BASE + ASICCtrl) & 0x80) { - /* Default 100Mbps Full */ - if (sdc->an_enable) { - sdc->speed = 100; - sdc->mii_if.full_duplex = 1; - sdc->an_enable = 0; - } - } - - /* The Linux driver uses flow control and resets the link here. This means the - mii section from above would need to be re done I believe. Since it serves - no real purpose leave it out. */ - - /* Force media type */ - if (!sdc->an_enable) { - mii_ctl = 0; - mii_ctl |= (sdc->speed == 100) ? BMCR_SPEED100 : 0; - mii_ctl |= (sdc->mii_if.full_duplex) ? BMCR_FULLDPLX : 0; - mdio_write(nic, sdc->phys[0], MII_BMCR, mii_ctl); - printf("Override speed=%d, %s duplex\n", - sdc->speed, - sdc->mii_if.full_duplex ? "Full" : "Half"); - } - - /* Reset the chip to erase previous misconfiguration */ - dprintf(("ASIC Control is %x.\n", inl(BASE + ASICCtrl))); - outw(0x007f, BASE + ASICCtrl + 2); - dprintf(("ASIC Control is now %x.\n", inl(BASE + ASICCtrl))); - - sundance_reset(nic); - if (sdc->an_enable) { - u16 mii_advertise, mii_lpa; - mii_advertise = - mdio_read(nic, sdc->phys[0], MII_ADVERTISE); - mii_lpa = mdio_read(nic, sdc->phys[0], MII_LPA); - mii_advertise &= mii_lpa; - if (mii_advertise & ADVERTISE_100FULL) - sdc->speed = 100; - else if (mii_advertise & ADVERTISE_100HALF) - sdc->speed = 100; - else if (mii_advertise & ADVERTISE_10FULL) - sdc->speed = 10; - else if (mii_advertise & ADVERTISE_10HALF) - sdc->speed = 10; - } else { - mii_ctl = mdio_read(nic, sdc->phys[0], MII_BMCR); - speed = (mii_ctl & BMCR_SPEED100) ? 100 : 10; - sdc->speed = speed; - printf("%s: Link changed: %dMbps ,", sdc->nic_name, speed); - printf("%s duplex.\n", (mii_ctl & BMCR_FULLDPLX) ? - "full" : "half"); - } - check_duplex(nic); - if (sdc->flowctrl && sdc->mii_if.full_duplex) { - outw(inw(BASE + MulticastFilter1 + 2) | 0x0200, - BASE + MulticastFilter1 + 2); - outw(inw(BASE + MACCtrl0) | EnbFlowCtrl, BASE + MACCtrl0); - } - printf("%dMbps, %s-Duplex\n", sdc->speed, - sdc->mii_if.full_duplex ? "Full" : "Half"); - - /* point to NIC specific routines */ - dev->disable = sundance_disable; - nic->poll = sundance_poll; - nic->transmit = sundance_transmit; - nic->irqno = pci->irq; - nic->irq = sundance_irq; - nic->ioaddr = BASE; - - return 1; -} - - -/* Read the EEPROM and MII Management Data I/O (MDIO) interfaces. */ -static int eeprom_read(long ioaddr, int location) -{ - int boguscnt = 10000; /* Typical 1900 ticks */ - outw(0x0200 | (location & 0xff), ioaddr + EECtrl); - do { - if (!(inw(ioaddr + EECtrl) & 0x8000)) { - return inw(ioaddr + EEData); - } - } - while (--boguscnt > 0); - return 0; -} - -/* MII transceiver control section. - Read and write the MII registers using software-generated serial - MDIO protocol. See the MII specifications or DP83840A data sheet - for details. - - The maximum data clock rate is 2.5 Mhz. - The timing is decoupled from the processor clock by flushing the write - from the CPU write buffer with a following read, and using PCI - transaction time. */ - -#define mdio_in(mdio_addr) inb(mdio_addr) -#define mdio_out(value, mdio_addr) outb(value, mdio_addr) -#define mdio_delay(mdio_addr) inb(mdio_addr) - -enum mii_reg_bits { - MDIO_ShiftClk = 0x0001, MDIO_Data = 0x0002, MDIO_EnbOutput = - 0x0004, -}; -#define MDIO_EnbIn (0) -#define MDIO_WRITE0 (MDIO_EnbOutput) -#define MDIO_WRITE1 (MDIO_Data | MDIO_EnbOutput) - -/* Generate the preamble required for initial synchronization and - a few older transceivers. */ -static void mdio_sync(long mdio_addr) -{ - int bits = 32; - - /* Establish sync by sending at least 32 logic ones. */ - while (--bits >= 0) { - mdio_out(MDIO_WRITE1, mdio_addr); - mdio_delay(mdio_addr); - mdio_out(MDIO_WRITE1 | MDIO_ShiftClk, mdio_addr); - mdio_delay(mdio_addr); - } -} - -static int -mdio_read(struct nic *nic __unused, int phy_id, unsigned int location) -{ - long mdio_addr = BASE + MIICtrl; - int mii_cmd = (0xf6 << 10) | (phy_id << 5) | location; - int i, retval = 0; - - if (sdc->mii_preamble_required) - mdio_sync(mdio_addr); - - /* Shift the read command bits out. */ - for (i = 15; i >= 0; i--) { - int dataval = - (mii_cmd & (1 << i)) ? MDIO_WRITE1 : MDIO_WRITE0; - - mdio_out(dataval, mdio_addr); - mdio_delay(mdio_addr); - mdio_out(dataval | MDIO_ShiftClk, mdio_addr); - mdio_delay(mdio_addr); - } - /* Read the two transition, 16 data, and wire-idle bits. */ - for (i = 19; i > 0; i--) { - mdio_out(MDIO_EnbIn, mdio_addr); - mdio_delay(mdio_addr); - retval = (retval << 1) | ((mdio_in(mdio_addr) & MDIO_Data) - ? 1 : 0); - mdio_out(MDIO_EnbIn | MDIO_ShiftClk, mdio_addr); - mdio_delay(mdio_addr); - } - return (retval >> 1) & 0xffff; -} - -static void -mdio_write(struct nic *nic __unused, int phy_id, - unsigned int location, int value) -{ - long mdio_addr = BASE + MIICtrl; - int mii_cmd = - (0x5002 << 16) | (phy_id << 23) | (location << 18) | value; - int i; - - if (sdc->mii_preamble_required) - mdio_sync(mdio_addr); - - /* Shift the command bits out. */ - for (i = 31; i >= 0; i--) { - int dataval = - (mii_cmd & (1 << i)) ? MDIO_WRITE1 : MDIO_WRITE0; - mdio_out(dataval, mdio_addr); - mdio_delay(mdio_addr); - mdio_out(dataval | MDIO_ShiftClk, mdio_addr); - mdio_delay(mdio_addr); - } - /* Clear out extra bits. */ - for (i = 2; i > 0; i--) { - mdio_out(MDIO_EnbIn, mdio_addr); - mdio_delay(mdio_addr); - mdio_out(MDIO_EnbIn | MDIO_ShiftClk, mdio_addr); - mdio_delay(mdio_addr); - } - return; -} - -static void set_rx_mode(struct nic *nic __unused) -{ - int i; - u16 mc_filter[4]; /* Multicast hash filter */ - u32 rx_mode; - - memset(mc_filter, 0xff, sizeof(mc_filter)); - rx_mode = AcceptBroadcast | AcceptMulticast | AcceptMyPhys; - - if (sdc->mii_if.full_duplex && sdc->flowctrl) - mc_filter[3] |= 0x0200; - for (i = 0; i < 4; i++) - outw(mc_filter[i], BASE + MulticastFilter0 + i * 2); - outb(rx_mode, BASE + RxMode); - return; -} - -static struct pci_id sundance_nics[] = { - PCI_ROM(0x13f0, 0x0201, "sundance", "ST201 Sundance 'Alta' based Adaptor"), - PCI_ROM(0x1186, 0x1002, "dfe530txs", "D-Link DFE530TXS (Sundance ST201 Alta)"), -}; - -struct pci_driver sundance_driver = { - .type = NIC_DRIVER, - .name = "SUNDANCE/PCI", - .probe = sundance_probe, - .ids = sundance_nics, - .id_count = sizeof(sundance_nics) / sizeof(sundance_nics[0]), - .class = 0, -}; diff --git a/usr/src/grub/grub-0.95/netboot/tftp.h b/usr/src/grub/grub-0.95/netboot/tftp.h deleted file mode 100644 index dec4a3c0bc..0000000000 --- a/usr/src/grub/grub-0.95/netboot/tftp.h +++ /dev/null @@ -1,82 +0,0 @@ -#ifndef _TFTP_H -#define _TFTP_H - -#include "if_ether.h" -#include "ip.h" -#include "udp.h" - -#ifndef MAX_TFTP_RETRIES -#define MAX_TFTP_RETRIES 20 -#endif - -/* These settings have sense only if compiled with -DCONGESTED */ -/* total retransmission timeout in ticks */ -#define TFTP_TIMEOUT (30*TICKS_PER_SEC) -/* packet retransmission timeout in ticks */ -#define TFTP_REXMT (3*TICKS_PER_SEC) - -#define TFTP_PORT 69 -#define TFTP_DEFAULTSIZE_PACKET 512 -#define TFTP_MAX_PACKET 1432 /* 512 */ - -#define TFTP_RRQ 1 -#define TFTP_WRQ 2 -#define TFTP_DATA 3 -#define TFTP_ACK 4 -#define TFTP_ERROR 5 -#define TFTP_OACK 6 - -#define TFTP_CODE_EOF 1 -#define TFTP_CODE_MORE 2 -#define TFTP_CODE_ERROR 3 -#define TFTP_CODE_BOOT 4 -#define TFTP_CODE_CFG 5 - -struct tftp_t { - struct iphdr ip; - struct udphdr udp; - uint16_t opcode; - union { - uint8_t rrq[TFTP_DEFAULTSIZE_PACKET]; - struct { - uint16_t block; - uint8_t download[TFTP_MAX_PACKET]; - } data; - struct { - uint16_t block; - } ack; - struct { - uint16_t errcode; - uint8_t errmsg[TFTP_DEFAULTSIZE_PACKET]; - } err; - struct { - uint8_t data[TFTP_DEFAULTSIZE_PACKET+2]; - } oack; - } u; -}; - -/* define a smaller tftp packet solely for making requests to conserve stack - 512 bytes should be enough */ -struct tftpreq_t { - struct iphdr ip; - struct udphdr udp; - uint16_t opcode; - union { - uint8_t rrq[512]; - struct { - uint16_t block; - } ack; - struct { - uint16_t errcode; - uint8_t errmsg[512-2]; - } err; - } u; -}; - -#define TFTP_MIN_PACKET (sizeof(struct iphdr) + sizeof(struct udphdr) + 4) - -typedef int (*read_actor_t)(unsigned char *, unsigned int, unsigned int, int); - -int tftp_file_read(const char *name, read_actor_t); - -#endif /* _TFTP_H */ diff --git a/usr/src/grub/grub-0.95/netboot/tg3.c b/usr/src/grub/grub-0.95/netboot/tg3.c deleted file mode 100644 index 76525f584c..0000000000 --- a/usr/src/grub/grub-0.95/netboot/tg3.c +++ /dev/null @@ -1,3322 +0,0 @@ -/* $Id: tg3.c,v 1.5 2003/03/19 21:26:20 gbaum Exp $ - * tg3.c: Broadcom Tigon3 ethernet driver. - * - * Copyright (C) 2001, 2002 David S. Miller (davem@redhat.com) - * Copyright (C) 2001, 2002 Jeff Garzik (jgarzik@mandrakesoft.com) - * Copyright (C) 2003 Eric Biederman (ebiederman@lnxi.com) [etherboot port] - */ - -/* 11-13-2003 timlegge Fix Issue with NetGear GA302T - * 11-18-2003 ebiederm Generalize NetGear Fix to what the code was supposed to be. - */ - -#include "etherboot.h" -#include "nic.h" -#include "pci.h" -#include "timer.h" -/*#include "string.h"*/ -#include "tg3.h" - -#define SUPPORT_COPPER_PHY 1 -#define SUPPORT_FIBER_PHY 1 -#define SUPPORT_LINK_REPORT 1 -#define SUPPORT_PARTNO_STR 1 -#define SUPPORT_PHY_STR 1 - -struct tg3 tg3; - -/* Dummy defines for error handling */ -#define EBUSY 1 -#define ENODEV 2 -#define EINVAL 3 -#define ENOMEM 4 - - -/* These numbers seem to be hard coded in the NIC firmware somehow. - * You can't change the ring sizes, but you can change where you place - * them in the NIC onboard memory. - */ -#define TG3_RX_RING_SIZE 512 -#define TG3_DEF_RX_RING_PENDING 20 /* RX_RING_PENDING seems to be o.k. at 20 and 200 */ -#define TG3_RX_RCB_RING_SIZE 1024 - -/* (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705 ? \ - 512 : 1024) */ - #define TG3_TX_RING_SIZE 512 -#define TG3_DEF_TX_RING_PENDING (TG3_TX_RING_SIZE - 1) - -#define TG3_RX_RING_BYTES (sizeof(struct tg3_rx_buffer_desc) * TG3_RX_RING_SIZE) -#define TG3_RX_RCB_RING_BYTES (sizeof(struct tg3_rx_buffer_desc) * TG3_RX_RCB_RING_SIZE) - -#define TG3_TX_RING_BYTES (sizeof(struct tg3_tx_buffer_desc) * TG3_TX_RING_SIZE) -#define NEXT_TX(N) (((N) + 1) & (TG3_TX_RING_SIZE - 1)) -#define PREV_TX(N) (((N) - 1) & (TG3_TX_RING_SIZE - 1)) - -#define RX_PKT_BUF_SZ (1536 + 2 + 64) - - -static struct bss { - struct tg3_rx_buffer_desc rx_std[TG3_RX_RING_SIZE]; - struct tg3_rx_buffer_desc rx_rcb[TG3_RX_RCB_RING_SIZE]; - struct tg3_tx_buffer_desc tx_ring[TG3_TX_RING_SIZE]; - struct tg3_hw_status hw_status; - struct tg3_hw_stats hw_stats; - unsigned char rx_bufs[TG3_DEF_RX_RING_PENDING][RX_PKT_BUF_SZ]; -} tg3_bss; - -/** - * pci_save_state - save the PCI configuration space of a device before suspending - * @dev: - PCI device that we're dealing with - * @buffer: - buffer to hold config space context - * - * @buffer must be large enough to hold the entire PCI 2.2 config space - * (>= 64 bytes). - */ -static int pci_save_state(struct pci_device *dev, uint32_t *buffer) -{ - int i; - for (i = 0; i < 16; i++) - pci_read_config_dword(dev, i * 4,&buffer[i]); - return 0; -} - -/** - * pci_restore_state - Restore the saved state of a PCI device - * @dev: - PCI device that we're dealing with - * @buffer: - saved PCI config space - * - */ -static int pci_restore_state(struct pci_device *dev, uint32_t *buffer) -{ - int i; - - for (i = 0; i < 16; i++) - pci_write_config_dword(dev,i * 4, buffer[i]); - return 0; -} - -static void tg3_write_indirect_reg32(uint32_t off, uint32_t val) -{ - pci_write_config_dword(tg3.pdev, TG3PCI_REG_BASE_ADDR, off); - pci_write_config_dword(tg3.pdev, TG3PCI_REG_DATA, val); -} - -#define tw32(reg,val) tg3_write_indirect_reg32((reg),(val)) -#define tw32_mailbox(reg, val) writel(((val) & 0xffffffff), tg3.regs + (reg)) -#define tw16(reg,val) writew(((val) & 0xffff), tg3.regs + (reg)) -#define tw8(reg,val) writeb(((val) & 0xff), tg3.regs + (reg)) -#define tr32(reg) readl(tg3.regs + (reg)) -#define tr16(reg) readw(tg3.regs + (reg)) -#define tr8(reg) readb(tg3.regs + (reg)) - -static void tw32_carefully(uint32_t reg, uint32_t val) -{ - tw32(reg, val); - tr32(reg); - udelay(100); -} - -static void tw32_mailbox2(uint32_t reg, uint32_t val) -{ - tw32_mailbox(reg, val); - tr32(reg); -} - -static void tg3_write_mem(uint32_t off, uint32_t val) -{ - pci_write_config_dword(tg3.pdev, TG3PCI_MEM_WIN_BASE_ADDR, off); - pci_write_config_dword(tg3.pdev, TG3PCI_MEM_WIN_DATA, val); - - /* Always leave this as zero. */ - pci_write_config_dword(tg3.pdev, TG3PCI_MEM_WIN_BASE_ADDR, 0); -} - -static void tg3_read_mem(uint32_t off, uint32_t *val) -{ - pci_write_config_dword(tg3.pdev, TG3PCI_MEM_WIN_BASE_ADDR, off); - pci_read_config_dword(tg3.pdev, TG3PCI_MEM_WIN_DATA, val); - - /* Always leave this as zero. */ - pci_write_config_dword(tg3.pdev, TG3PCI_MEM_WIN_BASE_ADDR, 0); -} - -static void tg3_disable_ints(struct tg3 *tp) -{ - tw32(TG3PCI_MISC_HOST_CTRL, - (tp->misc_host_ctrl | MISC_HOST_CTRL_MASK_PCI_INT)); - tw32_mailbox2(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, 0x00000001); -} - -static void tg3_switch_clocks(struct tg3 *tp) -{ - uint32_t orig_clock_ctrl, clock_ctrl; - - clock_ctrl = tr32(TG3PCI_CLOCK_CTRL); - - orig_clock_ctrl = clock_ctrl; - clock_ctrl &= (CLOCK_CTRL_FORCE_CLKRUN | CLOCK_CTRL_CLKRUN_OENABLE | 0x1f); - tp->pci_clock_ctrl = clock_ctrl; - - if ((GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705) && - (orig_clock_ctrl & CLOCK_CTRL_44MHZ_CORE)!=0) { - tw32_carefully(TG3PCI_CLOCK_CTRL, - clock_ctrl | (CLOCK_CTRL_44MHZ_CORE | CLOCK_CTRL_ALTCLK)); - tw32_carefully(TG3PCI_CLOCK_CTRL, - clock_ctrl | (CLOCK_CTRL_ALTCLK)); - } - tw32_carefully(TG3PCI_CLOCK_CTRL, clock_ctrl); -} - -#define PHY_BUSY_LOOPS 5000 - -static int tg3_readphy(struct tg3 *tp, int reg, uint32_t *val) -{ - uint32_t frame_val; - int loops, ret; - - tw32_carefully(MAC_MI_MODE, tp->mi_mode & ~MAC_MI_MODE_AUTO_POLL); - - *val = 0xffffffff; - - frame_val = ((PHY_ADDR << MI_COM_PHY_ADDR_SHIFT) & - MI_COM_PHY_ADDR_MASK); - frame_val |= ((reg << MI_COM_REG_ADDR_SHIFT) & - MI_COM_REG_ADDR_MASK); - frame_val |= (MI_COM_CMD_READ | MI_COM_START); - - tw32_carefully(MAC_MI_COM, frame_val); - - loops = PHY_BUSY_LOOPS; - while (loops-- > 0) { - udelay(10); - frame_val = tr32(MAC_MI_COM); - - if ((frame_val & MI_COM_BUSY) == 0) { - udelay(5); - frame_val = tr32(MAC_MI_COM); - break; - } - } - - ret = -EBUSY; - if (loops > 0) { - *val = frame_val & MI_COM_DATA_MASK; - ret = 0; - } - - tw32_carefully(MAC_MI_MODE, tp->mi_mode); - - return ret; -} - -static int tg3_writephy(struct tg3 *tp, int reg, uint32_t val) -{ - uint32_t frame_val; - int loops, ret; - - tw32_carefully(MAC_MI_MODE, tp->mi_mode & ~MAC_MI_MODE_AUTO_POLL); - - frame_val = ((PHY_ADDR << MI_COM_PHY_ADDR_SHIFT) & - MI_COM_PHY_ADDR_MASK); - frame_val |= ((reg << MI_COM_REG_ADDR_SHIFT) & - MI_COM_REG_ADDR_MASK); - frame_val |= (val & MI_COM_DATA_MASK); - frame_val |= (MI_COM_CMD_WRITE | MI_COM_START); - - tw32_carefully(MAC_MI_COM, frame_val); - - loops = PHY_BUSY_LOOPS; - while (loops-- > 0) { - udelay(10); - frame_val = tr32(MAC_MI_COM); - if ((frame_val & MI_COM_BUSY) == 0) { - udelay(5); - frame_val = tr32(MAC_MI_COM); - break; - } - } - - ret = -EBUSY; - if (loops > 0) - ret = 0; - - tw32_carefully(MAC_MI_MODE, tp->mi_mode); - - return ret; -} - -static int tg3_writedsp(struct tg3 *tp, uint16_t addr, uint16_t val) -{ - int err; - err = tg3_writephy(tp, MII_TG3_DSP_ADDRESS, addr); - err |= tg3_writephy(tp, MII_TG3_DSP_RW_PORT, val); - return err; -} - - -static void tg3_phy_set_wirespeed(struct tg3 *tp) -{ - uint32_t val; - - if (tp->tg3_flags2 & TG3_FLG2_NO_ETH_WIRE_SPEED) - return; - - tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x7007); - tg3_readphy(tp, MII_TG3_AUX_CTRL, &val); - tg3_writephy(tp, MII_TG3_AUX_CTRL, (val | (1 << 15) | (1 << 4))); -} - -static int tg3_bmcr_reset(struct tg3 *tp) -{ - uint32_t phy_control; - int limit, err; - - /* OK, reset it, and poll the BMCR_RESET bit until it - * clears or we time out. - */ - phy_control = BMCR_RESET; - err = tg3_writephy(tp, MII_BMCR, phy_control); - if (err != 0) - return -EBUSY; - - limit = 5000; - while (limit--) { - err = tg3_readphy(tp, MII_BMCR, &phy_control); - if (err != 0) - return -EBUSY; - - if ((phy_control & BMCR_RESET) == 0) { - udelay(40); - break; - } - udelay(10); - } - if (limit <= 0) - return -EBUSY; - - return 0; -} - -static int tg3_wait_macro_done(struct tg3 *tp) -{ - int limit = 100; - - while (limit--) { - uint32_t tmp32; - - tg3_readphy(tp, 0x16, &tmp32); - if ((tmp32 & 0x1000) == 0) - break; - } - if (limit <= 0) - return -EBUSY; - - return 0; -} - -static int tg3_phy_write_and_check_testpat(struct tg3 *tp, int *resetp) -{ - static const uint32_t test_pat[4][6] = { - { 0x00005555, 0x00000005, 0x00002aaa, 0x0000000a, 0x00003456, 0x00000003 }, - { 0x00002aaa, 0x0000000a, 0x00003333, 0x00000003, 0x0000789a, 0x00000005 }, - { 0x00005a5a, 0x00000005, 0x00002a6a, 0x0000000a, 0x00001bcd, 0x00000003 }, - { 0x00002a5a, 0x0000000a, 0x000033c3, 0x00000003, 0x00002ef1, 0x00000005 } - }; - int chan; - - for (chan = 0; chan < 4; chan++) { - int i; - - tg3_writephy(tp, MII_TG3_DSP_ADDRESS, - (chan * 0x2000) | 0x0200); - tg3_writephy(tp, 0x16, 0x0002); - - for (i = 0; i < 6; i++) - tg3_writephy(tp, MII_TG3_DSP_RW_PORT, - test_pat[chan][i]); - - tg3_writephy(tp, 0x16, 0x0202); - if (tg3_wait_macro_done(tp)) { - *resetp = 1; - return -EBUSY; - } - - tg3_writephy(tp, MII_TG3_DSP_ADDRESS, - (chan * 0x2000) | 0x0200); - tg3_writephy(tp, 0x16, 0x0082); - if (tg3_wait_macro_done(tp)) { - *resetp = 1; - return -EBUSY; - } - - tg3_writephy(tp, 0x16, 0x0802); - if (tg3_wait_macro_done(tp)) { - *resetp = 1; - return -EBUSY; - } - - for (i = 0; i < 6; i += 2) { - uint32_t low, high; - - tg3_readphy(tp, MII_TG3_DSP_RW_PORT, &low); - tg3_readphy(tp, MII_TG3_DSP_RW_PORT, &high); - if (tg3_wait_macro_done(tp)) { - *resetp = 1; - return -EBUSY; - } - low &= 0x7fff; - high &= 0x000f; - if (low != test_pat[chan][i] || - high != test_pat[chan][i+1]) { - tg3_writephy(tp, MII_TG3_DSP_ADDRESS, 0x000b); - tg3_writephy(tp, MII_TG3_DSP_RW_PORT, 0x4001); - tg3_writephy(tp, MII_TG3_DSP_RW_PORT, 0x4005); - - return -EBUSY; - } - } - } - - return 0; -} - -static int tg3_phy_reset_chanpat(struct tg3 *tp) -{ - int chan; - - for (chan = 0; chan < 4; chan++) { - int i; - - tg3_writephy(tp, MII_TG3_DSP_ADDRESS, - (chan * 0x2000) | 0x0200); - tg3_writephy(tp, 0x16, 0x0002); - for (i = 0; i < 6; i++) - tg3_writephy(tp, MII_TG3_DSP_RW_PORT, 0x000); - tg3_writephy(tp, 0x16, 0x0202); - if (tg3_wait_macro_done(tp)) - return -EBUSY; - } - - return 0; -} - -static int tg3_phy_reset_5703_4_5(struct tg3 *tp) -{ - uint32_t reg32, phy9_orig; - int retries, do_phy_reset, err; - - retries = 10; - do_phy_reset = 1; - do { - if (do_phy_reset) { - err = tg3_bmcr_reset(tp); - if (err) - return err; - do_phy_reset = 0; - } - - /* Disable transmitter and interrupt. */ - tg3_readphy(tp, MII_TG3_EXT_CTRL, ®32); - reg32 |= 0x3000; - tg3_writephy(tp, MII_TG3_EXT_CTRL, reg32); - - /* Set full-duplex, 1000 mbps. */ - tg3_writephy(tp, MII_BMCR, - BMCR_FULLDPLX | TG3_BMCR_SPEED1000); - - /* Set to master mode. */ - tg3_readphy(tp, MII_TG3_CTRL, &phy9_orig); - tg3_writephy(tp, MII_TG3_CTRL, - (MII_TG3_CTRL_AS_MASTER | - MII_TG3_CTRL_ENABLE_AS_MASTER)); - - /* Enable SM_DSP_CLOCK and 6dB. */ - tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x0c00); - - /* Block the PHY control access. */ - tg3_writephy(tp, MII_TG3_DSP_ADDRESS, 0x8005); - tg3_writephy(tp, MII_TG3_DSP_RW_PORT, 0x0800); - - err = tg3_phy_write_and_check_testpat(tp, &do_phy_reset); - if (!err) - break; - } while (--retries); - - err = tg3_phy_reset_chanpat(tp); - if (err) - return err; - - tg3_writephy(tp, MII_TG3_DSP_ADDRESS, 0x8005); - tg3_writephy(tp, MII_TG3_DSP_RW_PORT, 0x0000); - - tg3_writephy(tp, MII_TG3_DSP_ADDRESS, 0x8200); - tg3_writephy(tp, 0x16, 0x0000); - - tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x0400); - - tg3_writephy(tp, MII_TG3_CTRL, phy9_orig); - - tg3_readphy(tp, MII_TG3_EXT_CTRL, ®32); - reg32 &= ~0x3000; - tg3_writephy(tp, MII_TG3_EXT_CTRL, reg32); - - return err; -} - -/* This will reset the tigon3 PHY if there is no valid - * link. - */ -static int tg3_phy_reset(struct tg3 *tp) -{ - uint32_t phy_status; - int err; - - err = tg3_readphy(tp, MII_BMSR, &phy_status); - err |= tg3_readphy(tp, MII_BMSR, &phy_status); - if (err != 0) - return -EBUSY; - - if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5703) || - (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) || - (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705)) { - err = tg3_phy_reset_5703_4_5(tp); - if (err) - return err; - goto out; - } - err = tg3_bmcr_reset(tp); - if (err) - return err; - out: - tg3_phy_set_wirespeed(tp); - return 0; -} - -static void tg3_set_power_state_0(struct tg3 *tp) -{ - uint16_t power_control; - int pm = tp->pm_cap; - - /* Make sure register accesses (indirect or otherwise) - * will function correctly. - */ - pci_write_config_dword(tp->pdev, TG3PCI_MISC_HOST_CTRL, tp->misc_host_ctrl); - - pci_read_config_word(tp->pdev, pm + PCI_PM_CTRL, &power_control); - - power_control |= PCI_PM_CTRL_PME_STATUS; - power_control &= ~(PCI_PM_CTRL_STATE_MASK); - power_control |= 0; - pci_write_config_word(tp->pdev, pm + PCI_PM_CTRL, power_control); - - tw32_carefully(GRC_LOCAL_CTRL, tp->grc_local_ctrl); - - return; -} - - -#if SUPPORT_LINK_REPORT -static void tg3_link_report(struct tg3 *tp) -{ - if (!tp->carrier_ok) { - printf("Link is down.\n"); - } else { - printf("Link is up at %d Mbps, %s duplex. %s %s %s\n", - (tp->link_config.active_speed == SPEED_1000 ? - 1000 : - (tp->link_config.active_speed == SPEED_100 ? - 100 : 10)), - (tp->link_config.active_duplex == DUPLEX_FULL ? - "full" : "half"), - (tp->tg3_flags & TG3_FLAG_TX_PAUSE) ? "TX" : "", - (tp->tg3_flags & TG3_FLAG_RX_PAUSE) ? "RX" : "", - (tp->tg3_flags & (TG3_FLAG_TX_PAUSE |TG3_FLAG_RX_PAUSE)) ? "flow control" : ""); - } -} -#else -#define tg3_link_report(tp) -#endif - -static void tg3_setup_flow_control(struct tg3 *tp, uint32_t local_adv, uint32_t remote_adv) -{ - uint32_t new_tg3_flags = 0; - - if (local_adv & ADVERTISE_PAUSE_CAP) { - if (local_adv & ADVERTISE_PAUSE_ASYM) { - if (remote_adv & LPA_PAUSE_CAP) - new_tg3_flags |= - (TG3_FLAG_RX_PAUSE | - TG3_FLAG_TX_PAUSE); - else if (remote_adv & LPA_PAUSE_ASYM) - new_tg3_flags |= - (TG3_FLAG_RX_PAUSE); - } else { - if (remote_adv & LPA_PAUSE_CAP) - new_tg3_flags |= - (TG3_FLAG_RX_PAUSE | - TG3_FLAG_TX_PAUSE); - } - } else if (local_adv & ADVERTISE_PAUSE_ASYM) { - if ((remote_adv & LPA_PAUSE_CAP) && - (remote_adv & LPA_PAUSE_ASYM)) - new_tg3_flags |= TG3_FLAG_TX_PAUSE; - } - - tp->tg3_flags &= ~(TG3_FLAG_RX_PAUSE | TG3_FLAG_TX_PAUSE); - tp->tg3_flags |= new_tg3_flags; - - if (new_tg3_flags & TG3_FLAG_RX_PAUSE) - tp->rx_mode |= RX_MODE_FLOW_CTRL_ENABLE; - else - tp->rx_mode &= ~RX_MODE_FLOW_CTRL_ENABLE; - - if (new_tg3_flags & TG3_FLAG_TX_PAUSE) - tp->tx_mode |= TX_MODE_FLOW_CTRL_ENABLE; - else - tp->tx_mode &= ~TX_MODE_FLOW_CTRL_ENABLE; -} - -#if SUPPORT_COPPER_PHY -static void tg3_aux_stat_to_speed_duplex( - struct tg3 *tp __unused, uint32_t val, uint8_t *speed, uint8_t *duplex) -{ - static const uint8_t map[] = { - [0] = (SPEED_INVALID << 2) | DUPLEX_INVALID, - [MII_TG3_AUX_STAT_10HALF >> 8] = (SPEED_10 << 2) | DUPLEX_HALF, - [MII_TG3_AUX_STAT_10FULL >> 8] = (SPEED_10 << 2) | DUPLEX_FULL, - [MII_TG3_AUX_STAT_100HALF >> 8] = (SPEED_100 << 2) | DUPLEX_HALF, - [MII_TG3_AUX_STAT_100_4 >> 8] = (SPEED_INVALID << 2) | DUPLEX_INVALID, - [MII_TG3_AUX_STAT_100FULL >> 8] = (SPEED_100 << 2) | DUPLEX_FULL, - [MII_TG3_AUX_STAT_1000HALF >> 8] = (SPEED_1000 << 2) | DUPLEX_HALF, - [MII_TG3_AUX_STAT_1000FULL >> 8] = (SPEED_1000 << 2) | DUPLEX_FULL, - }; - uint8_t result; - result = map[(val & MII_TG3_AUX_STAT_SPDMASK) >> 8]; - *speed = result >> 2; - *duplex = result & 3; -} - -static int tg3_phy_copper_begin(struct tg3 *tp) -{ - uint32_t new_adv; - - tp->link_config.advertising = - (ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full | - ADVERTISED_100baseT_Half | ADVERTISED_100baseT_Full | - ADVERTISED_1000baseT_Half | ADVERTISED_1000baseT_Full | - ADVERTISED_Autoneg | ADVERTISED_MII); - - if (tp->tg3_flags & TG3_FLAG_10_100_ONLY) { - tp->link_config.advertising &= - ~(ADVERTISED_1000baseT_Half | ADVERTISED_1000baseT_Full); - } - - new_adv = (ADVERTISE_CSMA | ADVERTISE_PAUSE_CAP); - if (tp->link_config.advertising & ADVERTISED_10baseT_Half) { - new_adv |= ADVERTISE_10HALF; - } - if (tp->link_config.advertising & ADVERTISED_10baseT_Full) { - new_adv |= ADVERTISE_10FULL; - } - if (tp->link_config.advertising & ADVERTISED_100baseT_Half) { - new_adv |= ADVERTISE_100HALF; - } - if (tp->link_config.advertising & ADVERTISED_100baseT_Full) { - new_adv |= ADVERTISE_100FULL; - } - tg3_writephy(tp, MII_ADVERTISE, new_adv); - - if (tp->link_config.advertising & - (ADVERTISED_1000baseT_Half | ADVERTISED_1000baseT_Full)) { - new_adv = 0; - if (tp->link_config.advertising & ADVERTISED_1000baseT_Half) { - new_adv |= MII_TG3_CTRL_ADV_1000_HALF; - } - if (tp->link_config.advertising & ADVERTISED_1000baseT_Full) { - new_adv |= MII_TG3_CTRL_ADV_1000_FULL; - } - if (!(tp->tg3_flags & TG3_FLAG_10_100_ONLY) && - (tp->pci_chip_rev_id == CHIPREV_ID_5701_A0 || - tp->pci_chip_rev_id == CHIPREV_ID_5701_B0)) { - new_adv |= (MII_TG3_CTRL_AS_MASTER | - MII_TG3_CTRL_ENABLE_AS_MASTER); - } - tg3_writephy(tp, MII_TG3_CTRL, new_adv); - } else { - tg3_writephy(tp, MII_TG3_CTRL, 0); - } - - tg3_writephy(tp, MII_BMCR, BMCR_ANENABLE | BMCR_ANRESTART); - - return 0; -} - -static int tg3_init_5401phy_dsp(struct tg3 *tp) -{ - int err; - - /* Turn off tap power management. */ - err = tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x0c20); - - err |= tg3_writedsp(tp, 0x0012, 0x1804); - err |= tg3_writedsp(tp, 0x0013, 0x1204); - err |= tg3_writedsp(tp, 0x8006, 0x0132); - err |= tg3_writedsp(tp, 0x8006, 0x0232); - err |= tg3_writedsp(tp, 0x201f, 0x0a20); - - udelay(40); - - return err; -} - -static int tg3_setup_copper_phy(struct tg3 *tp) -{ - int current_link_up; - uint32_t bmsr, dummy; - int i, err; - - tw32_carefully(MAC_STATUS, - (MAC_STATUS_SYNC_CHANGED | MAC_STATUS_CFG_CHANGED)); - - tp->mi_mode = MAC_MI_MODE_BASE; - tw32_carefully(MAC_MI_MODE, tp->mi_mode); - - tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x02); - - /* Some third-party PHYs need to be reset on link going - * down. - */ - if ( ( (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5703) || - (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) || - (tp->pci_chip_rev_id == CHIPREV_ID_5705_A0)) && - (tp->carrier_ok)) { - tg3_readphy(tp, MII_BMSR, &bmsr); - tg3_readphy(tp, MII_BMSR, &bmsr); - if (!(bmsr & BMSR_LSTATUS)) - tg3_phy_reset(tp); - } - - if ((tp->phy_id & PHY_ID_MASK) == PHY_ID_BCM5401) { - tg3_readphy(tp, MII_BMSR, &bmsr); - tg3_readphy(tp, MII_BMSR, &bmsr); - - if (!(tp->tg3_flags & TG3_FLAG_INIT_COMPLETE)) - bmsr = 0; - - if (!(bmsr & BMSR_LSTATUS)) { - err = tg3_init_5401phy_dsp(tp); - if (err) - return err; - - tg3_readphy(tp, MII_BMSR, &bmsr); - for (i = 0; i < 1000; i++) { - udelay(10); - tg3_readphy(tp, MII_BMSR, &bmsr); - if (bmsr & BMSR_LSTATUS) { - udelay(40); - break; - } - } - - if ((tp->phy_id & PHY_ID_REV_MASK) == PHY_REV_BCM5401_B0 && - !(bmsr & BMSR_LSTATUS) && - tp->link_config.active_speed == SPEED_1000) { - err = tg3_phy_reset(tp); - if (!err) - err = tg3_init_5401phy_dsp(tp); - if (err) - return err; - } - } - } else if (tp->pci_chip_rev_id == CHIPREV_ID_5701_A0 || - tp->pci_chip_rev_id == CHIPREV_ID_5701_B0) { - /* 5701 {A0,B0} CRC bug workaround */ - tg3_writephy(tp, 0x15, 0x0a75); - tg3_writephy(tp, 0x1c, 0x8c68); - tg3_writephy(tp, 0x1c, 0x8d68); - tg3_writephy(tp, 0x1c, 0x8c68); - } - - /* Clear pending interrupts... */ - tg3_readphy(tp, MII_TG3_ISTAT, &dummy); - tg3_readphy(tp, MII_TG3_ISTAT, &dummy); - - tg3_writephy(tp, MII_TG3_IMASK, ~0); - - if (tp->led_mode == led_mode_three_link) - tg3_writephy(tp, MII_TG3_EXT_CTRL, - MII_TG3_EXT_CTRL_LNK3_LED_MODE); - else - tg3_writephy(tp, MII_TG3_EXT_CTRL, 0); - - current_link_up = 0; - - tg3_readphy(tp, MII_BMSR, &bmsr); - tg3_readphy(tp, MII_BMSR, &bmsr); - - if (bmsr & BMSR_LSTATUS) { - uint32_t aux_stat, bmcr; - - tg3_readphy(tp, MII_TG3_AUX_STAT, &aux_stat); - for (i = 0; i < 2000; i++) { - udelay(10); - tg3_readphy(tp, MII_TG3_AUX_STAT, &aux_stat); - if (aux_stat) - break; - } - - tg3_aux_stat_to_speed_duplex(tp, aux_stat, - &tp->link_config.active_speed, - &tp->link_config.active_duplex); - tg3_readphy(tp, MII_BMCR, &bmcr); - tg3_readphy(tp, MII_BMCR, &bmcr); - if (bmcr & BMCR_ANENABLE) { - uint32_t gig_ctrl; - - current_link_up = 1; - - /* Force autoneg restart if we are exiting - * low power mode. - */ - tg3_readphy(tp, MII_TG3_CTRL, &gig_ctrl); - if (!(gig_ctrl & (MII_TG3_CTRL_ADV_1000_HALF | - MII_TG3_CTRL_ADV_1000_FULL))) { - current_link_up = 0; - } - } else { - current_link_up = 0; - } - } - - if (current_link_up == 1 && - (tp->link_config.active_duplex == DUPLEX_FULL)) { - uint32_t local_adv, remote_adv; - - tg3_readphy(tp, MII_ADVERTISE, &local_adv); - local_adv &= (ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM); - - tg3_readphy(tp, MII_LPA, &remote_adv); - remote_adv &= (LPA_PAUSE_CAP | LPA_PAUSE_ASYM); - - /* If we are not advertising full pause capability, - * something is wrong. Bring the link down and reconfigure. - */ - if (local_adv != ADVERTISE_PAUSE_CAP) { - current_link_up = 0; - } else { - tg3_setup_flow_control(tp, local_adv, remote_adv); - } - } - - if (current_link_up == 0) { - uint32_t tmp; - - tg3_phy_copper_begin(tp); - - tg3_readphy(tp, MII_BMSR, &tmp); - tg3_readphy(tp, MII_BMSR, &tmp); - if (tmp & BMSR_LSTATUS) - current_link_up = 1; - } - - tp->mac_mode &= ~MAC_MODE_PORT_MODE_MASK; - if (current_link_up == 1) { - if (tp->link_config.active_speed == SPEED_100 || - tp->link_config.active_speed == SPEED_10) - tp->mac_mode |= MAC_MODE_PORT_MODE_MII; - else - tp->mac_mode |= MAC_MODE_PORT_MODE_GMII; - } else - tp->mac_mode |= MAC_MODE_PORT_MODE_GMII; - - tp->mac_mode &= ~MAC_MODE_HALF_DUPLEX; - if (tp->link_config.active_duplex == DUPLEX_HALF) - tp->mac_mode |= MAC_MODE_HALF_DUPLEX; - - tp->mac_mode &= ~MAC_MODE_LINK_POLARITY; - if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700) { - if ((tp->led_mode == led_mode_link10) || - (current_link_up == 1 && - tp->link_config.active_speed == SPEED_10)) - tp->mac_mode |= MAC_MODE_LINK_POLARITY; - } else { - if (current_link_up == 1) - tp->mac_mode |= MAC_MODE_LINK_POLARITY; - tw32(MAC_LED_CTRL, LED_CTRL_PHY_MODE_1); - } - - /* ??? Without this setting Netgear GA302T PHY does not - * ??? send/receive packets... - * With this other PHYs cannot bring up the link - */ - if ((tp->phy_id & PHY_ID_MASK) == PHY_ID_BCM5411 && - tp->pci_chip_rev_id == CHIPREV_ID_5700_ALTIMA) { - tp->mi_mode |= MAC_MI_MODE_AUTO_POLL; - tw32_carefully(MAC_MI_MODE, tp->mi_mode); - } - - tw32_carefully(MAC_MODE, tp->mac_mode); - - /* Link change polled. */ - tw32_carefully(MAC_EVENT, 0); - - if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700 && - current_link_up == 1 && - tp->link_config.active_speed == SPEED_1000 && - ((tp->tg3_flags & TG3_FLAG_PCIX_MODE) || - (tp->tg3_flags & TG3_FLAG_PCI_HIGH_SPEED))) { - udelay(120); - tw32_carefully(MAC_STATUS, - (MAC_STATUS_SYNC_CHANGED | MAC_STATUS_CFG_CHANGED)); - tg3_write_mem( - NIC_SRAM_FIRMWARE_MBOX, - NIC_SRAM_FIRMWARE_MBOX_MAGIC2); - } - - if (current_link_up != tp->carrier_ok) { - tp->carrier_ok = current_link_up; - tg3_link_report(tp); - } - - return 0; -} -#else -#define tg3_setup_copper_phy(TP) (-EINVAL) -#endif /* SUPPORT_COPPER_PHY */ - -#if SUPPORT_FIBER_PHY -struct tg3_fiber_aneginfo { - int state; -#define ANEG_STATE_UNKNOWN 0 -#define ANEG_STATE_AN_ENABLE 1 -#define ANEG_STATE_RESTART_INIT 2 -#define ANEG_STATE_RESTART 3 -#define ANEG_STATE_DISABLE_LINK_OK 4 -#define ANEG_STATE_ABILITY_DETECT_INIT 5 -#define ANEG_STATE_ABILITY_DETECT 6 -#define ANEG_STATE_ACK_DETECT_INIT 7 -#define ANEG_STATE_ACK_DETECT 8 -#define ANEG_STATE_COMPLETE_ACK_INIT 9 -#define ANEG_STATE_COMPLETE_ACK 10 -#define ANEG_STATE_IDLE_DETECT_INIT 11 -#define ANEG_STATE_IDLE_DETECT 12 -#define ANEG_STATE_LINK_OK 13 -#define ANEG_STATE_NEXT_PAGE_WAIT_INIT 14 -#define ANEG_STATE_NEXT_PAGE_WAIT 15 - - uint32_t flags; -#define MR_AN_ENABLE 0x00000001 -#define MR_RESTART_AN 0x00000002 -#define MR_AN_COMPLETE 0x00000004 -#define MR_PAGE_RX 0x00000008 -#define MR_NP_LOADED 0x00000010 -#define MR_TOGGLE_TX 0x00000020 -#define MR_LP_ADV_FULL_DUPLEX 0x00000040 -#define MR_LP_ADV_HALF_DUPLEX 0x00000080 -#define MR_LP_ADV_SYM_PAUSE 0x00000100 -#define MR_LP_ADV_ASYM_PAUSE 0x00000200 -#define MR_LP_ADV_REMOTE_FAULT1 0x00000400 -#define MR_LP_ADV_REMOTE_FAULT2 0x00000800 -#define MR_LP_ADV_NEXT_PAGE 0x00001000 -#define MR_TOGGLE_RX 0x00002000 -#define MR_NP_RX 0x00004000 - -#define MR_LINK_OK 0x80000000 - - unsigned long link_time, cur_time; - - uint32_t ability_match_cfg; - int ability_match_count; - - char ability_match, idle_match, ack_match; - - uint32_t txconfig, rxconfig; -#define ANEG_CFG_NP 0x00000080 -#define ANEG_CFG_ACK 0x00000040 -#define ANEG_CFG_RF2 0x00000020 -#define ANEG_CFG_RF1 0x00000010 -#define ANEG_CFG_PS2 0x00000001 -#define ANEG_CFG_PS1 0x00008000 -#define ANEG_CFG_HD 0x00004000 -#define ANEG_CFG_FD 0x00002000 -#define ANEG_CFG_INVAL 0x00001f06 - -}; -#define ANEG_OK 0 -#define ANEG_DONE 1 -#define ANEG_TIMER_ENAB 2 -#define ANEG_FAILED -1 - -#define ANEG_STATE_SETTLE_TIME 10000 - -static int tg3_fiber_aneg_smachine(struct tg3 *tp, - struct tg3_fiber_aneginfo *ap) -{ - unsigned long delta; - uint32_t rx_cfg_reg; - int ret; - - if (ap->state == ANEG_STATE_UNKNOWN) { - ap->rxconfig = 0; - ap->link_time = 0; - ap->cur_time = 0; - ap->ability_match_cfg = 0; - ap->ability_match_count = 0; - ap->ability_match = 0; - ap->idle_match = 0; - ap->ack_match = 0; - } - ap->cur_time++; - - if (tr32(MAC_STATUS) & MAC_STATUS_RCVD_CFG) { - rx_cfg_reg = tr32(MAC_RX_AUTO_NEG); - - if (rx_cfg_reg != ap->ability_match_cfg) { - ap->ability_match_cfg = rx_cfg_reg; - ap->ability_match = 0; - ap->ability_match_count = 0; - } else { - if (++ap->ability_match_count > 1) { - ap->ability_match = 1; - ap->ability_match_cfg = rx_cfg_reg; - } - } - if (rx_cfg_reg & ANEG_CFG_ACK) - ap->ack_match = 1; - else - ap->ack_match = 0; - - ap->idle_match = 0; - } else { - ap->idle_match = 1; - ap->ability_match_cfg = 0; - ap->ability_match_count = 0; - ap->ability_match = 0; - ap->ack_match = 0; - - rx_cfg_reg = 0; - } - - ap->rxconfig = rx_cfg_reg; - ret = ANEG_OK; - - switch(ap->state) { - case ANEG_STATE_UNKNOWN: - if (ap->flags & (MR_AN_ENABLE | MR_RESTART_AN)) - ap->state = ANEG_STATE_AN_ENABLE; - - /* fallthru */ - case ANEG_STATE_AN_ENABLE: - ap->flags &= ~(MR_AN_COMPLETE | MR_PAGE_RX); - if (ap->flags & MR_AN_ENABLE) { - ap->link_time = 0; - ap->cur_time = 0; - ap->ability_match_cfg = 0; - ap->ability_match_count = 0; - ap->ability_match = 0; - ap->idle_match = 0; - ap->ack_match = 0; - - ap->state = ANEG_STATE_RESTART_INIT; - } else { - ap->state = ANEG_STATE_DISABLE_LINK_OK; - } - break; - - case ANEG_STATE_RESTART_INIT: - ap->link_time = ap->cur_time; - ap->flags &= ~(MR_NP_LOADED); - ap->txconfig = 0; - tw32(MAC_TX_AUTO_NEG, 0); - tp->mac_mode |= MAC_MODE_SEND_CONFIGS; - tw32_carefully(MAC_MODE, tp->mac_mode); - - ret = ANEG_TIMER_ENAB; - ap->state = ANEG_STATE_RESTART; - - /* fallthru */ - case ANEG_STATE_RESTART: - delta = ap->cur_time - ap->link_time; - if (delta > ANEG_STATE_SETTLE_TIME) { - ap->state = ANEG_STATE_ABILITY_DETECT_INIT; - } else { - ret = ANEG_TIMER_ENAB; - } - break; - - case ANEG_STATE_DISABLE_LINK_OK: - ret = ANEG_DONE; - break; - - case ANEG_STATE_ABILITY_DETECT_INIT: - ap->flags &= ~(MR_TOGGLE_TX); - ap->txconfig = (ANEG_CFG_FD | ANEG_CFG_PS1); - tw32(MAC_TX_AUTO_NEG, ap->txconfig); - tp->mac_mode |= MAC_MODE_SEND_CONFIGS; - tw32_carefully(MAC_MODE, tp->mac_mode); - - ap->state = ANEG_STATE_ABILITY_DETECT; - break; - - case ANEG_STATE_ABILITY_DETECT: - if (ap->ability_match != 0 && ap->rxconfig != 0) { - ap->state = ANEG_STATE_ACK_DETECT_INIT; - } - break; - - case ANEG_STATE_ACK_DETECT_INIT: - ap->txconfig |= ANEG_CFG_ACK; - tw32(MAC_TX_AUTO_NEG, ap->txconfig); - tp->mac_mode |= MAC_MODE_SEND_CONFIGS; - tw32_carefully(MAC_MODE, tp->mac_mode); - - ap->state = ANEG_STATE_ACK_DETECT; - - /* fallthru */ - case ANEG_STATE_ACK_DETECT: - if (ap->ack_match != 0) { - if ((ap->rxconfig & ~ANEG_CFG_ACK) == - (ap->ability_match_cfg & ~ANEG_CFG_ACK)) { - ap->state = ANEG_STATE_COMPLETE_ACK_INIT; - } else { - ap->state = ANEG_STATE_AN_ENABLE; - } - } else if (ap->ability_match != 0 && - ap->rxconfig == 0) { - ap->state = ANEG_STATE_AN_ENABLE; - } - break; - - case ANEG_STATE_COMPLETE_ACK_INIT: - if (ap->rxconfig & ANEG_CFG_INVAL) { - ret = ANEG_FAILED; - break; - } - ap->flags &= ~(MR_LP_ADV_FULL_DUPLEX | - MR_LP_ADV_HALF_DUPLEX | - MR_LP_ADV_SYM_PAUSE | - MR_LP_ADV_ASYM_PAUSE | - MR_LP_ADV_REMOTE_FAULT1 | - MR_LP_ADV_REMOTE_FAULT2 | - MR_LP_ADV_NEXT_PAGE | - MR_TOGGLE_RX | - MR_NP_RX); - if (ap->rxconfig & ANEG_CFG_FD) - ap->flags |= MR_LP_ADV_FULL_DUPLEX; - if (ap->rxconfig & ANEG_CFG_HD) - ap->flags |= MR_LP_ADV_HALF_DUPLEX; - if (ap->rxconfig & ANEG_CFG_PS1) - ap->flags |= MR_LP_ADV_SYM_PAUSE; - if (ap->rxconfig & ANEG_CFG_PS2) - ap->flags |= MR_LP_ADV_ASYM_PAUSE; - if (ap->rxconfig & ANEG_CFG_RF1) - ap->flags |= MR_LP_ADV_REMOTE_FAULT1; - if (ap->rxconfig & ANEG_CFG_RF2) - ap->flags |= MR_LP_ADV_REMOTE_FAULT2; - if (ap->rxconfig & ANEG_CFG_NP) - ap->flags |= MR_LP_ADV_NEXT_PAGE; - - ap->link_time = ap->cur_time; - - ap->flags ^= (MR_TOGGLE_TX); - if (ap->rxconfig & 0x0008) - ap->flags |= MR_TOGGLE_RX; - if (ap->rxconfig & ANEG_CFG_NP) - ap->flags |= MR_NP_RX; - ap->flags |= MR_PAGE_RX; - - ap->state = ANEG_STATE_COMPLETE_ACK; - ret = ANEG_TIMER_ENAB; - break; - - case ANEG_STATE_COMPLETE_ACK: - if (ap->ability_match != 0 && - ap->rxconfig == 0) { - ap->state = ANEG_STATE_AN_ENABLE; - break; - } - delta = ap->cur_time - ap->link_time; - if (delta > ANEG_STATE_SETTLE_TIME) { - if (!(ap->flags & (MR_LP_ADV_NEXT_PAGE))) { - ap->state = ANEG_STATE_IDLE_DETECT_INIT; - } else { - if ((ap->txconfig & ANEG_CFG_NP) == 0 && - !(ap->flags & MR_NP_RX)) { - ap->state = ANEG_STATE_IDLE_DETECT_INIT; - } else { - ret = ANEG_FAILED; - } - } - } - break; - - case ANEG_STATE_IDLE_DETECT_INIT: - ap->link_time = ap->cur_time; - tp->mac_mode &= ~MAC_MODE_SEND_CONFIGS; - tw32_carefully(MAC_MODE, tp->mac_mode); - - ap->state = ANEG_STATE_IDLE_DETECT; - ret = ANEG_TIMER_ENAB; - break; - - case ANEG_STATE_IDLE_DETECT: - if (ap->ability_match != 0 && - ap->rxconfig == 0) { - ap->state = ANEG_STATE_AN_ENABLE; - break; - } - delta = ap->cur_time - ap->link_time; - if (delta > ANEG_STATE_SETTLE_TIME) { - /* XXX another gem from the Broadcom driver :( */ - ap->state = ANEG_STATE_LINK_OK; - } - break; - - case ANEG_STATE_LINK_OK: - ap->flags |= (MR_AN_COMPLETE | MR_LINK_OK); - ret = ANEG_DONE; - break; - - case ANEG_STATE_NEXT_PAGE_WAIT_INIT: - /* ??? unimplemented */ - break; - - case ANEG_STATE_NEXT_PAGE_WAIT: - /* ??? unimplemented */ - break; - - default: - ret = ANEG_FAILED; - break; - }; - - return ret; -} - -static int tg3_setup_fiber_phy(struct tg3 *tp) -{ - uint32_t orig_pause_cfg; - uint16_t orig_active_speed; - uint8_t orig_active_duplex; - int current_link_up; - int i; - - orig_pause_cfg = - (tp->tg3_flags & (TG3_FLAG_RX_PAUSE | - TG3_FLAG_TX_PAUSE)); - orig_active_speed = tp->link_config.active_speed; - orig_active_duplex = tp->link_config.active_duplex; - - tp->mac_mode &= ~(MAC_MODE_PORT_MODE_MASK | MAC_MODE_HALF_DUPLEX); - tp->mac_mode |= MAC_MODE_PORT_MODE_TBI; - tw32_carefully(MAC_MODE, tp->mac_mode); - - /* Reset when initting first time or we have a link. */ - if (!(tp->tg3_flags & TG3_FLAG_INIT_COMPLETE) || - (tr32(MAC_STATUS) & MAC_STATUS_PCS_SYNCED)) { - /* Set PLL lock range. */ - tg3_writephy(tp, 0x16, 0x8007); - - /* SW reset */ - tg3_writephy(tp, MII_BMCR, BMCR_RESET); - - /* Wait for reset to complete. */ - mdelay(5); - - /* Config mode; select PMA/Ch 1 regs. */ - tg3_writephy(tp, 0x10, 0x8411); - - /* Enable auto-lock and comdet, select txclk for tx. */ - tg3_writephy(tp, 0x11, 0x0a10); - - tg3_writephy(tp, 0x18, 0x00a0); - tg3_writephy(tp, 0x16, 0x41ff); - - /* Assert and deassert POR. */ - tg3_writephy(tp, 0x13, 0x0400); - udelay(40); - tg3_writephy(tp, 0x13, 0x0000); - - tg3_writephy(tp, 0x11, 0x0a50); - udelay(40); - tg3_writephy(tp, 0x11, 0x0a10); - - /* Wait for signal to stabilize */ - mdelay(150); - - /* Deselect the channel register so we can read the PHYID - * later. - */ - tg3_writephy(tp, 0x10, 0x8011); - } - - /* Disable link change interrupt. */ - tw32_carefully(MAC_EVENT, 0); - - current_link_up = 0; - if (tr32(MAC_STATUS) & MAC_STATUS_PCS_SYNCED) { - if (!(tp->tg3_flags & TG3_FLAG_GOT_SERDES_FLOWCTL)) { - struct tg3_fiber_aneginfo aninfo; - int status = ANEG_FAILED; - unsigned int tick; - uint32_t tmp; - - memset(&aninfo, 0, sizeof(aninfo)); - aninfo.flags |= (MR_AN_ENABLE); - - tw32(MAC_TX_AUTO_NEG, 0); - - tmp = tp->mac_mode & ~MAC_MODE_PORT_MODE_MASK; - tw32_carefully(MAC_MODE, tmp | MAC_MODE_PORT_MODE_GMII); - - tw32_carefully(MAC_MODE, tp->mac_mode | MAC_MODE_SEND_CONFIGS); - - aninfo.state = ANEG_STATE_UNKNOWN; - aninfo.cur_time = 0; - tick = 0; - while (++tick < 195000) { - status = tg3_fiber_aneg_smachine(tp, &aninfo); - if (status == ANEG_DONE || - status == ANEG_FAILED) - break; - - udelay(1); - } - - tp->mac_mode &= ~MAC_MODE_SEND_CONFIGS; - tw32_carefully(MAC_MODE, tp->mac_mode); - - if (status == ANEG_DONE && - (aninfo.flags & - (MR_AN_COMPLETE | MR_LINK_OK | - MR_LP_ADV_FULL_DUPLEX))) { - uint32_t local_adv, remote_adv; - - local_adv = ADVERTISE_PAUSE_CAP; - remote_adv = 0; - if (aninfo.flags & MR_LP_ADV_SYM_PAUSE) - remote_adv |= LPA_PAUSE_CAP; - if (aninfo.flags & MR_LP_ADV_ASYM_PAUSE) - remote_adv |= LPA_PAUSE_ASYM; - - tg3_setup_flow_control(tp, local_adv, remote_adv); - - tp->tg3_flags |= - TG3_FLAG_GOT_SERDES_FLOWCTL; - current_link_up = 1; - } - for (i = 0; i < 60; i++) { - udelay(20); - tw32_carefully(MAC_STATUS, - (MAC_STATUS_SYNC_CHANGED | MAC_STATUS_CFG_CHANGED)); - if ((tr32(MAC_STATUS) & - (MAC_STATUS_SYNC_CHANGED | - MAC_STATUS_CFG_CHANGED)) == 0) - break; - } - if (current_link_up == 0 && - (tr32(MAC_STATUS) & MAC_STATUS_PCS_SYNCED)) { - current_link_up = 1; - } - } else { - /* Forcing 1000FD link up. */ - current_link_up = 1; - } - } - - tp->mac_mode &= ~MAC_MODE_LINK_POLARITY; - tw32_carefully(MAC_MODE, tp->mac_mode); - - tp->hw_status->status = - (SD_STATUS_UPDATED | - (tp->hw_status->status & ~SD_STATUS_LINK_CHG)); - - for (i = 0; i < 100; i++) { - udelay(20); - tw32_carefully(MAC_STATUS, - (MAC_STATUS_SYNC_CHANGED | MAC_STATUS_CFG_CHANGED)); - if ((tr32(MAC_STATUS) & - (MAC_STATUS_SYNC_CHANGED | - MAC_STATUS_CFG_CHANGED)) == 0) - break; - } - - if ((tr32(MAC_STATUS) & MAC_STATUS_PCS_SYNCED) == 0) - current_link_up = 0; - - if (current_link_up == 1) { - tp->link_config.active_speed = SPEED_1000; - tp->link_config.active_duplex = DUPLEX_FULL; - } else { - tp->link_config.active_speed = SPEED_INVALID; - tp->link_config.active_duplex = DUPLEX_INVALID; - } - - if (current_link_up != tp->carrier_ok) { - tp->carrier_ok = current_link_up; - tg3_link_report(tp); - } else { - uint32_t now_pause_cfg = - tp->tg3_flags & (TG3_FLAG_RX_PAUSE | - TG3_FLAG_TX_PAUSE); - if (orig_pause_cfg != now_pause_cfg || - orig_active_speed != tp->link_config.active_speed || - orig_active_duplex != tp->link_config.active_duplex) - tg3_link_report(tp); - } - - if ((tr32(MAC_STATUS) & MAC_STATUS_PCS_SYNCED) == 0) { - tw32_carefully(MAC_MODE, tp->mac_mode | MAC_MODE_LINK_POLARITY); - if (tp->tg3_flags & TG3_FLAG_INIT_COMPLETE) { - tw32_carefully(MAC_MODE, tp->mac_mode); - } - } - - return 0; -} -#else -#define tg3_setup_fiber_phy(TP) (-EINVAL) -#endif /* SUPPORT_FIBER_PHY */ - -static int tg3_setup_phy(struct tg3 *tp) -{ - int err; - - if (tp->phy_id == PHY_ID_SERDES) { - err = tg3_setup_fiber_phy(tp); - } else { - err = tg3_setup_copper_phy(tp); - } - - if (tp->link_config.active_speed == SPEED_1000 && - tp->link_config.active_duplex == DUPLEX_HALF) - tw32(MAC_TX_LENGTHS, - ((2 << TX_LENGTHS_IPG_CRS_SHIFT) | - (6 << TX_LENGTHS_IPG_SHIFT) | - (0xff << TX_LENGTHS_SLOT_TIME_SHIFT))); - else - tw32(MAC_TX_LENGTHS, - ((2 << TX_LENGTHS_IPG_CRS_SHIFT) | - (6 << TX_LENGTHS_IPG_SHIFT) | - (32 << TX_LENGTHS_SLOT_TIME_SHIFT))); - - return err; -} - - -#define MAX_WAIT_CNT 1000 - -/* To stop a block, clear the enable bit and poll till it - * clears. - */ -static int tg3_stop_block(struct tg3 *tp, unsigned long ofs, uint32_t enable_bit) -{ - unsigned int i; - uint32_t val; - - if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705) { - switch(ofs) { - case RCVLSC_MODE: - case DMAC_MODE: - case MBFREE_MODE: - case BUFMGR_MODE: - case MEMARB_MODE: - /* We can't enable/disable these bits of the - * 5705, just say success. - */ - return 0; - default: - break; - } - } - val = tr32(ofs); - val &= ~enable_bit; - tw32(ofs, val); - tr32(ofs); - - for (i = 0; i < MAX_WAIT_CNT; i++) { - udelay(100); - val = tr32(ofs); - if ((val & enable_bit) == 0) - break; - } - - if (i == MAX_WAIT_CNT) { - printf("tg3_stop_block timed out, ofs=%lx enable_bit=%x\n", - ofs, enable_bit); - return -ENODEV; - } - - return 0; -} - -static int tg3_abort_hw(struct tg3 *tp) -{ - int i, err; - - tg3_disable_ints(tp); - - tp->rx_mode &= ~RX_MODE_ENABLE; - tw32_carefully(MAC_RX_MODE, tp->rx_mode); - - err = tg3_stop_block(tp, RCVBDI_MODE, RCVBDI_MODE_ENABLE); - err |= tg3_stop_block(tp, RCVLPC_MODE, RCVLPC_MODE_ENABLE); - err |= tg3_stop_block(tp, RCVLSC_MODE, RCVLSC_MODE_ENABLE); - err |= tg3_stop_block(tp, RCVDBDI_MODE, RCVDBDI_MODE_ENABLE); - err |= tg3_stop_block(tp, RCVDCC_MODE, RCVDCC_MODE_ENABLE); - err |= tg3_stop_block(tp, RCVCC_MODE, RCVCC_MODE_ENABLE); - - err |= tg3_stop_block(tp, SNDBDS_MODE, SNDBDS_MODE_ENABLE); - err |= tg3_stop_block(tp, SNDBDI_MODE, SNDBDI_MODE_ENABLE); - err |= tg3_stop_block(tp, SNDDATAI_MODE, SNDDATAI_MODE_ENABLE); - err |= tg3_stop_block(tp, RDMAC_MODE, RDMAC_MODE_ENABLE); - err |= tg3_stop_block(tp, SNDDATAC_MODE, SNDDATAC_MODE_ENABLE); - err |= tg3_stop_block(tp, SNDBDC_MODE, SNDBDC_MODE_ENABLE); - if (err) - goto out; - - tp->mac_mode &= ~MAC_MODE_TDE_ENABLE; - tw32_carefully(MAC_MODE, tp->mac_mode); - - tp->tx_mode &= ~TX_MODE_ENABLE; - tw32_carefully(MAC_TX_MODE, tp->tx_mode); - - for (i = 0; i < MAX_WAIT_CNT; i++) { - udelay(100); - if (!(tr32(MAC_TX_MODE) & TX_MODE_ENABLE)) - break; - } - if (i >= MAX_WAIT_CNT) { - printf("tg3_abort_hw timed out TX_MODE_ENABLE will not clear MAC_TX_MODE=%x\n", - tr32(MAC_TX_MODE)); - return -ENODEV; - } - - err = tg3_stop_block(tp, HOSTCC_MODE, HOSTCC_MODE_ENABLE); - err |= tg3_stop_block(tp, WDMAC_MODE, WDMAC_MODE_ENABLE); - err |= tg3_stop_block(tp, MBFREE_MODE, MBFREE_MODE_ENABLE); - - tw32(FTQ_RESET, 0xffffffff); - tw32(FTQ_RESET, 0x00000000); - - err |= tg3_stop_block(tp, BUFMGR_MODE, BUFMGR_MODE_ENABLE); - err |= tg3_stop_block(tp, MEMARB_MODE, MEMARB_MODE_ENABLE); - if (err) - goto out; - - memset(tp->hw_status, 0, TG3_HW_STATUS_SIZE); - -out: - return err; -} - -static void tg3_chip_reset(struct tg3 *tp) -{ - uint32_t val; - - if (!(tp->tg3_flags2 & TG3_FLG2_SUN_5704)) { - /* Force NVRAM to settle. - * This deals with a chip bug which can result in EEPROM - * corruption. - */ - if (tp->tg3_flags & TG3_FLAG_NVRAM) { - int i; - - tw32(NVRAM_SWARB, SWARB_REQ_SET1); - for (i = 0; i < 100000; i++) { - if (tr32(NVRAM_SWARB) & SWARB_GNT1) - break; - udelay(10); - } - } - } - /* In Etherboot we don't need to worry about the 5701 - * REG_WRITE_BUG because we do all register writes indirectly. - */ - - /* do the reset */ - val = GRC_MISC_CFG_CORECLK_RESET; - if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705) - val |= GRC_MISC_CFG_KEEP_GPHY_POWER; - tw32(GRC_MISC_CFG, val); - - /* Flush PCI posted writes. The normal MMIO registers - * are inaccessible at this time so this is the only - * way to make this reliably. I tried to use indirect - * register read/write but this upset some 5701 variants. - */ - pci_read_config_dword(tp->pdev, PCI_COMMAND, &val); - - udelay(120); - - /* Re-enable indirect register accesses. */ - pci_write_config_dword(tp->pdev, TG3PCI_MISC_HOST_CTRL, - tp->misc_host_ctrl); - - /* Set MAX PCI retry to zero. */ - val = (PCISTATE_ROM_ENABLE | PCISTATE_ROM_RETRY_ENABLE); - if (tp->pci_chip_rev_id == CHIPREV_ID_5704_A0 && - (tp->tg3_flags & TG3_FLAG_PCIX_MODE)) - val |= PCISTATE_RETRY_SAME_DMA; - pci_write_config_dword(tp->pdev, TG3PCI_PCISTATE, val); - - pci_restore_state(tp->pdev, tp->pci_cfg_state); - - /* Make sure PCI-X relaxed ordering bit is clear. */ - pci_read_config_dword(tp->pdev, TG3PCI_X_CAPS, &val); - val &= ~PCIX_CAPS_RELAXED_ORDERING; - pci_write_config_dword(tp->pdev, TG3PCI_X_CAPS, val); - - tw32(MEMARB_MODE, MEMARB_MODE_ENABLE); - - if (((tp->nic_sram_data_cfg & NIC_SRAM_DATA_CFG_MINI_PCI) != 0) && - (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705)) { - tp->pci_clock_ctrl |= - (CLOCK_CTRL_FORCE_CLKRUN | CLOCK_CTRL_CLKRUN_OENABLE); - tw32(TG3PCI_CLOCK_CTRL, tp->pci_clock_ctrl); - } - - tw32(TG3PCI_MISC_HOST_CTRL, tp->misc_host_ctrl); -} - -static void tg3_stop_fw(struct tg3 *tp) -{ - if (tp->tg3_flags & TG3_FLAG_ENABLE_ASF) { - uint32_t val; - int i; - - tg3_write_mem(NIC_SRAM_FW_CMD_MBOX, FWCMD_NICDRV_PAUSE_FW); - val = tr32(GRC_RX_CPU_EVENT); - val |= (1 << 14); - tw32(GRC_RX_CPU_EVENT, val); - - /* Wait for RX cpu to ACK the event. */ - for (i = 0; i < 100; i++) { - if (!(tr32(GRC_RX_CPU_EVENT) & (1 << 14))) - break; - udelay(1); - } - } -} - -static int tg3_restart_fw(struct tg3 *tp, uint32_t state) -{ - uint32_t val; - int i; - - tg3_write_mem(NIC_SRAM_FIRMWARE_MBOX, - NIC_SRAM_FIRMWARE_MBOX_MAGIC1); - /* Wait for firmware initialization to complete. */ - for (i = 0; i < 100000; i++) { - tg3_read_mem(NIC_SRAM_FIRMWARE_MBOX, &val); - if (val == (uint32_t) ~NIC_SRAM_FIRMWARE_MBOX_MAGIC1) - break; - udelay(10); - } - if (i >= 100000 && - !(tp->tg3_flags2 & TG3_FLG2_SUN_5704)) { - printf("Firmware will not restart magic=%x\n", - val); - return -ENODEV; - } - if (!(tp->tg3_flags & TG3_FLAG_ENABLE_ASF)) { - state = DRV_STATE_SUSPEND; - } - tg3_write_mem(NIC_SRAM_FW_DRV_STATE_MBOX, state); - return 0; -} - -static int tg3_halt(struct tg3 *tp) -{ - tg3_stop_fw(tp); - tg3_abort_hw(tp); - tg3_chip_reset(tp); - return tg3_restart_fw(tp, DRV_STATE_UNLOAD); -} - -static void __tg3_set_mac_addr(struct tg3 *tp) -{ - uint32_t addr_high, addr_low; - int i; - - addr_high = ((tp->nic->node_addr[0] << 8) | - tp->nic->node_addr[1]); - addr_low = ((tp->nic->node_addr[2] << 24) | - (tp->nic->node_addr[3] << 16) | - (tp->nic->node_addr[4] << 8) | - (tp->nic->node_addr[5] << 0)); - for (i = 0; i < 4; i++) { - tw32(MAC_ADDR_0_HIGH + (i * 8), addr_high); - tw32(MAC_ADDR_0_LOW + (i * 8), addr_low); - } - - if ((GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5700) && - (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5701) && - (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705)) { - for(i = 0; i < 12; i++) { - tw32(MAC_EXTADDR_0_HIGH + (i * 8), addr_high); - tw32(MAC_EXTADDR_0_LOW + (i * 8), addr_low); - } - } - addr_high = (tp->nic->node_addr[0] + - tp->nic->node_addr[1] + - tp->nic->node_addr[2] + - tp->nic->node_addr[3] + - tp->nic->node_addr[4] + - tp->nic->node_addr[5]) & - TX_BACKOFF_SEED_MASK; - tw32(MAC_TX_BACKOFF_SEED, addr_high); -} - -static void tg3_set_bdinfo(struct tg3 *tp, uint32_t bdinfo_addr, - dma_addr_t mapping, uint32_t maxlen_flags, - uint32_t nic_addr) -{ - tg3_write_mem((bdinfo_addr + - TG3_BDINFO_HOST_ADDR + TG3_64BIT_REG_HIGH), - ((uint64_t) mapping >> 32)); - tg3_write_mem((bdinfo_addr + - TG3_BDINFO_HOST_ADDR + TG3_64BIT_REG_LOW), - ((uint64_t) mapping & 0xffffffff)); - tg3_write_mem((bdinfo_addr + - TG3_BDINFO_MAXLEN_FLAGS), - maxlen_flags); - if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705) { - tg3_write_mem((bdinfo_addr + TG3_BDINFO_NIC_ADDR), nic_addr); - } -} - - -static void tg3_init_rings(struct tg3 *tp) -{ - unsigned i; - - /* Zero out the tg3 variables */ - memset(&tg3_bss, 0, sizeof(tg3_bss)); - tp->rx_std = &tg3_bss.rx_std[0]; - tp->rx_rcb = &tg3_bss.rx_rcb[0]; - tp->tx_ring = &tg3_bss.tx_ring[0]; - tp->hw_status = &tg3_bss.hw_status; - tp->hw_stats = &tg3_bss.hw_stats; - tp->mac_mode = 0; - - - /* Initialize tx/rx rings for packet processing. - * - * The chip has been shut down and the driver detached from - * the networking, so no interrupts or new tx packets will - * end up in the driver. - */ - - /* Initialize invariants of the rings, we only set this - * stuff once. This works because the card does not - * write into the rx buffer posting rings. - */ - for (i = 0; i < TG3_RX_RING_SIZE; i++) { - struct tg3_rx_buffer_desc *rxd; - - rxd = &tp->rx_std[i]; - rxd->idx_len = (RX_PKT_BUF_SZ - 2 - 64) << RXD_LEN_SHIFT; - rxd->type_flags = (RXD_FLAG_END << RXD_FLAGS_SHIFT); - rxd->opaque = (RXD_OPAQUE_RING_STD | (i << RXD_OPAQUE_INDEX_SHIFT)); - - /* Note where the receive buffer for the ring is placed */ - rxd->addr_hi = 0; - rxd->addr_lo = virt_to_bus( - &tg3_bss.rx_bufs[i%TG3_DEF_RX_RING_PENDING][2]); - } -} - -#define TG3_WRITE_SETTINGS(TABLE) \ -do { \ - const uint32_t *_table, *_end; \ - _table = TABLE; \ - _end = _table + sizeof(TABLE)/sizeof(TABLE[0]); \ - for(; _table < _end; _table += 2) { \ - tw32(_table[0], _table[1]); \ - } \ -} while(0) - - -/* initialize/reset the tg3 */ -static int tg3_setup_hw(struct tg3 *tp) -{ - uint32_t val, rdmac_mode; - int i, err, limit; - - /* Simply don't support setups with extremly buggy firmware in etherboot */ - if (tp->pci_chip_rev_id == CHIPREV_ID_5701_A0) { - printf("Error 5701_A0 firmware bug detected\n"); - return -EINVAL; - } - - tg3_disable_ints(tp); - - /* Originally this was all in tg3_init_hw */ - - /* Force the chip into D0. */ - tg3_set_power_state_0(tp); - - tg3_switch_clocks(tp); - - tw32(TG3PCI_MEM_WIN_BASE_ADDR, 0); - - - /* Originally this was all in tg3_reset_hw */ - - tg3_stop_fw(tp); - - /* No need to call tg3_abort_hw here, it is called before tg3_setup_hw. */ - - tg3_chip_reset(tp); - - tw32(GRC_MODE, tp->grc_mode); /* Redundant? */ - - err = tg3_restart_fw(tp, DRV_STATE_START); - if (err) - return err; - - if (tp->phy_id == PHY_ID_SERDES) { - tp->mac_mode = MAC_MODE_PORT_MODE_TBI; - } - tw32_carefully(MAC_MODE, tp->mac_mode); - - - /* This works around an issue with Athlon chipsets on - * B3 tigon3 silicon. This bit has no effect on any - * other revision. - */ - tp->pci_clock_ctrl |= CLOCK_CTRL_DELAY_PCI_GRANT; - tw32_carefully(TG3PCI_CLOCK_CTRL, tp->pci_clock_ctrl); - - if (tp->pci_chip_rev_id == CHIPREV_ID_5704_A0 && - (tp->tg3_flags & TG3_FLAG_PCIX_MODE)) { - val = tr32(TG3PCI_PCISTATE); - val |= PCISTATE_RETRY_SAME_DMA; - tw32(TG3PCI_PCISTATE, val); - } - - /* Descriptor ring init may make accesses to the - * NIC SRAM area to setup the TX descriptors, so we - * can only do this after the hardware has been - * successfully reset. - */ - tg3_init_rings(tp); - - /* Clear statistics/status block in chip */ - if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705) { - for (i = NIC_SRAM_STATS_BLK; - i < NIC_SRAM_STATUS_BLK + TG3_HW_STATUS_SIZE; - i += sizeof(uint32_t)) { - tg3_write_mem(i, 0); - udelay(40); - } - } - - /* This value is determined during the probe time DMA - * engine test, tg3_setup_dma. - */ - tw32(TG3PCI_DMA_RW_CTRL, tp->dma_rwctrl); - - tp->grc_mode &= ~(GRC_MODE_HOST_SENDBDS | - GRC_MODE_4X_NIC_SEND_RINGS | - GRC_MODE_NO_TX_PHDR_CSUM | - GRC_MODE_NO_RX_PHDR_CSUM); - tp->grc_mode |= GRC_MODE_HOST_SENDBDS; - tp->grc_mode |= GRC_MODE_NO_TX_PHDR_CSUM; - tp->grc_mode |= GRC_MODE_NO_RX_PHDR_CSUM; - - tw32(GRC_MODE, - tp->grc_mode | - (GRC_MODE_IRQ_ON_MAC_ATTN | GRC_MODE_HOST_STACKUP)); - - /* Setup the timer prescalar register. Clock is always 66Mhz. */ - tw32(GRC_MISC_CFG, - (65 << GRC_MISC_CFG_PRESCALAR_SHIFT)); - - /* Initialize MBUF/DESC pool. */ - if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705) { - tw32(BUFMGR_MB_POOL_ADDR, NIC_SRAM_MBUF_POOL_BASE); - if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) - tw32(BUFMGR_MB_POOL_SIZE, NIC_SRAM_MBUF_POOL_SIZE64); - else - tw32(BUFMGR_MB_POOL_SIZE, NIC_SRAM_MBUF_POOL_SIZE96); - tw32(BUFMGR_DMA_DESC_POOL_ADDR, NIC_SRAM_DMA_DESC_POOL_BASE); - tw32(BUFMGR_DMA_DESC_POOL_SIZE, NIC_SRAM_DMA_DESC_POOL_SIZE); - } - if (!(tp->tg3_flags & TG3_FLAG_JUMBO_ENABLE)) { - tw32(BUFMGR_MB_RDMA_LOW_WATER, - tp->bufmgr_config.mbuf_read_dma_low_water); - tw32(BUFMGR_MB_MACRX_LOW_WATER, - tp->bufmgr_config.mbuf_mac_rx_low_water); - tw32(BUFMGR_MB_HIGH_WATER, - tp->bufmgr_config.mbuf_high_water); - } else { - tw32(BUFMGR_MB_RDMA_LOW_WATER, - tp->bufmgr_config.mbuf_read_dma_low_water_jumbo); - tw32(BUFMGR_MB_MACRX_LOW_WATER, - tp->bufmgr_config.mbuf_mac_rx_low_water_jumbo); - tw32(BUFMGR_MB_HIGH_WATER, - tp->bufmgr_config.mbuf_high_water_jumbo); - } - tw32(BUFMGR_DMA_LOW_WATER, - tp->bufmgr_config.dma_low_water); - tw32(BUFMGR_DMA_HIGH_WATER, - tp->bufmgr_config.dma_high_water); - - tw32(BUFMGR_MODE, BUFMGR_MODE_ENABLE | BUFMGR_MODE_ATTN_ENABLE); - for (i = 0; i < 2000; i++) { - if (tr32(BUFMGR_MODE) & BUFMGR_MODE_ENABLE) - break; - udelay(10); - } - if (i >= 2000) { - printf("tg3_setup_hw cannot enable BUFMGR\n"); - return -ENODEV; - } - - tw32(FTQ_RESET, 0xffffffff); - tw32(FTQ_RESET, 0x00000000); - for (i = 0; i < 2000; i++) { - if (tr32(FTQ_RESET) == 0x00000000) - break; - udelay(10); - } - if (i >= 2000) { - printf("tg3_setup_hw cannot reset FTQ\n"); - return -ENODEV; - } - - /* Initialize TG3_BDINFO's at: - * RCVDBDI_STD_BD: standard eth size rx ring - * RCVDBDI_JUMBO_BD: jumbo frame rx ring - * RCVDBDI_MINI_BD: small frame rx ring (??? does not work) - * - * like so: - * TG3_BDINFO_HOST_ADDR: high/low parts of DMA address of ring - * TG3_BDINFO_MAXLEN_FLAGS: (rx max buffer size << 16) | - * ring attribute flags - * TG3_BDINFO_NIC_ADDR: location of descriptors in nic SRAM - * - * Standard receive ring @ NIC_SRAM_RX_BUFFER_DESC, 512 entries. - * Jumbo receive ring @ NIC_SRAM_RX_JUMBO_BUFFER_DESC, 256 entries. - * - * ??? No space allocated for mini receive ring? :( - * - * The size of each ring is fixed in the firmware, but the location is - * configurable. - */ - { - static const uint32_t table_all[] = { - /* Setup replenish thresholds. */ - RCVBDI_STD_THRESH, TG3_DEF_RX_RING_PENDING / 8, - - /* Etherboot lives below 4GB */ - RCVDBDI_STD_BD + TG3_BDINFO_HOST_ADDR + TG3_64BIT_REG_HIGH, 0, - RCVDBDI_STD_BD + TG3_BDINFO_NIC_ADDR, NIC_SRAM_RX_BUFFER_DESC, - }; - static const uint32_t table_not_5705[] = { - /* Buffer maximum length */ - RCVDBDI_STD_BD + TG3_BDINFO_MAXLEN_FLAGS, RX_STD_MAX_SIZE << BDINFO_FLAGS_MAXLEN_SHIFT, - - /* Disable the mini frame rx ring */ - RCVDBDI_MINI_BD + TG3_BDINFO_MAXLEN_FLAGS, BDINFO_FLAGS_DISABLED, - - /* Disable the jumbo frame rx ring */ - RCVBDI_JUMBO_THRESH, 0, - RCVDBDI_JUMBO_BD + TG3_BDINFO_MAXLEN_FLAGS, BDINFO_FLAGS_DISABLED, - - - }; - TG3_WRITE_SETTINGS(table_all); - tw32(RCVDBDI_STD_BD + TG3_BDINFO_HOST_ADDR + TG3_64BIT_REG_LOW, - virt_to_bus(tp->rx_std)); - if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705) { - tw32(RCVDBDI_STD_BD + TG3_BDINFO_MAXLEN_FLAGS, - RX_STD_MAX_SIZE_5705 << BDINFO_FLAGS_MAXLEN_SHIFT); - } else { - TG3_WRITE_SETTINGS(table_not_5705); - } - } - - - /* There is only one send ring on 5705, no need to explicitly - * disable the others. - */ - if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705) { - /* Clear out send RCB ring in SRAM. */ - for (i = NIC_SRAM_SEND_RCB; i < NIC_SRAM_RCV_RET_RCB; i += TG3_BDINFO_SIZE) - tg3_write_mem(i + TG3_BDINFO_MAXLEN_FLAGS, BDINFO_FLAGS_DISABLED); - } - - tp->tx_prod = 0; - tw32_mailbox(MAILBOX_SNDHOST_PROD_IDX_0 + TG3_64BIT_REG_LOW, 0); - tw32_mailbox2(MAILBOX_SNDNIC_PROD_IDX_0 + TG3_64BIT_REG_LOW, 0); - - tg3_set_bdinfo(tp, - NIC_SRAM_SEND_RCB, - virt_to_bus(tp->tx_ring), - (TG3_TX_RING_SIZE << BDINFO_FLAGS_MAXLEN_SHIFT), - NIC_SRAM_TX_BUFFER_DESC); - - /* There is only one receive return ring on 5705, no need to explicitly - * disable the others. - */ - if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705) { - for (i = NIC_SRAM_RCV_RET_RCB; i < NIC_SRAM_STATS_BLK; i += TG3_BDINFO_SIZE) { - tg3_write_mem(i + TG3_BDINFO_MAXLEN_FLAGS, - BDINFO_FLAGS_DISABLED); - } - } - - tp->rx_rcb_ptr = 0; - tw32_mailbox2(MAILBOX_RCVRET_CON_IDX_0 + TG3_64BIT_REG_LOW, 0); - - tg3_set_bdinfo(tp, - NIC_SRAM_RCV_RET_RCB, - virt_to_bus(tp->rx_rcb), - (TG3_RX_RCB_RING_SIZE << BDINFO_FLAGS_MAXLEN_SHIFT), - 0); - - tp->rx_std_ptr = TG3_DEF_RX_RING_PENDING; - tw32_mailbox2(MAILBOX_RCV_STD_PROD_IDX + TG3_64BIT_REG_LOW, - tp->rx_std_ptr); - - tw32_mailbox2(MAILBOX_RCV_JUMBO_PROD_IDX + TG3_64BIT_REG_LOW, 0); - - /* Initialize MAC address and backoff seed. */ - __tg3_set_mac_addr(tp); - - /* Calculate RDMAC_MODE setting early, we need it to determine - * the RCVLPC_STATE_ENABLE mask. - */ - rdmac_mode = (RDMAC_MODE_ENABLE | RDMAC_MODE_TGTABORT_ENAB | - RDMAC_MODE_MSTABORT_ENAB | RDMAC_MODE_PARITYERR_ENAB | - RDMAC_MODE_ADDROFLOW_ENAB | RDMAC_MODE_FIFOOFLOW_ENAB | - RDMAC_MODE_FIFOURUN_ENAB | RDMAC_MODE_FIFOOREAD_ENAB | - RDMAC_MODE_LNGREAD_ENAB); - if (tp->tg3_flags & TG3_FLAG_SPLIT_MODE) - rdmac_mode |= RDMAC_MODE_SPLIT_ENABLE; - if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705) { - if (tp->pci_chip_rev_id != CHIPREV_ID_5705_A0) { - if (!(tr32(TG3PCI_PCISTATE) & PCISTATE_BUS_SPEED_HIGH) && - !(tp->tg3_flags2 & TG3_FLG2_IS_5788)) { - rdmac_mode |= RDMAC_MODE_FIFO_LONG_BURST; - } - } - } - - /* Setup host coalescing engine. */ - tw32(HOSTCC_MODE, 0); - for (i = 0; i < 2000; i++) { - if (!(tr32(HOSTCC_MODE) & HOSTCC_MODE_ENABLE)) - break; - udelay(10); - } - - tp->mac_mode = MAC_MODE_TXSTAT_ENABLE | MAC_MODE_RXSTAT_ENABLE | - MAC_MODE_TDE_ENABLE | MAC_MODE_RDE_ENABLE | MAC_MODE_FHDE_ENABLE; - tw32_carefully(MAC_MODE, tp->mac_mode | MAC_MODE_RXSTAT_CLEAR | MAC_MODE_TXSTAT_CLEAR); - - tp->grc_local_ctrl = GRC_LCLCTRL_INT_ON_ATTN | GRC_LCLCTRL_AUTO_SEEPROM; - if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700) - tp->grc_local_ctrl |= (GRC_LCLCTRL_GPIO_OE1 | - GRC_LCLCTRL_GPIO_OUTPUT1); - tw32_carefully(GRC_LOCAL_CTRL, tp->grc_local_ctrl); - - tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, 0); - tr32(MAILBOX_INTERRUPT_0); - - if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705) { - tw32_carefully(DMAC_MODE, DMAC_MODE_ENABLE); - } - - val = ( WDMAC_MODE_ENABLE | WDMAC_MODE_TGTABORT_ENAB | - WDMAC_MODE_MSTABORT_ENAB | WDMAC_MODE_PARITYERR_ENAB | - WDMAC_MODE_ADDROFLOW_ENAB | WDMAC_MODE_FIFOOFLOW_ENAB | - WDMAC_MODE_FIFOURUN_ENAB | WDMAC_MODE_FIFOOREAD_ENAB | - WDMAC_MODE_LNGREAD_ENAB); - if ((GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705) && - ((tr32(TG3PCI_PCISTATE) & PCISTATE_BUS_SPEED_HIGH) != 0) && - !(tp->tg3_flags2 & TG3_FLG2_IS_5788)) { - val |= WDMAC_MODE_RX_ACCEL; - } - tw32_carefully(WDMAC_MODE, val); - - if ((tp->tg3_flags & TG3_FLAG_PCIX_MODE) != 0) { - val = tr32(TG3PCI_X_CAPS); - if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5703) { - val &= PCIX_CAPS_BURST_MASK; - val |= (PCIX_CAPS_MAX_BURST_CPIOB << PCIX_CAPS_BURST_SHIFT); - } else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) { - val &= ~(PCIX_CAPS_SPLIT_MASK | PCIX_CAPS_BURST_MASK); - val |= (PCIX_CAPS_MAX_BURST_CPIOB << PCIX_CAPS_BURST_SHIFT); - if (tp->tg3_flags & TG3_FLAG_SPLIT_MODE) - val |= (tp->split_mode_max_reqs << - PCIX_CAPS_SPLIT_SHIFT); - } - tw32(TG3PCI_X_CAPS, val); - } - - tw32_carefully(RDMAC_MODE, rdmac_mode); - { - static const uint32_t table_all[] = { - /* MTU + ethernet header + FCS + optional VLAN tag */ - MAC_RX_MTU_SIZE, ETH_MAX_MTU + ETH_HLEN + 8, - - /* The slot time is changed by tg3_setup_phy if we - * run at gigabit with half duplex. - */ - MAC_TX_LENGTHS, - (2 << TX_LENGTHS_IPG_CRS_SHIFT) | - (6 << TX_LENGTHS_IPG_SHIFT) | - (32 << TX_LENGTHS_SLOT_TIME_SHIFT), - - /* Receive rules. */ - MAC_RCV_RULE_CFG, RCV_RULE_CFG_DEFAULT_CLASS, - RCVLPC_CONFIG, 0x0181, - - /* Receive/send statistics. */ - RCVLPC_STATS_ENABLE, 0xffffff, - RCVLPC_STATSCTRL, RCVLPC_STATSCTRL_ENABLE, - SNDDATAI_STATSENAB, 0xffffff, - SNDDATAI_STATSCTRL, (SNDDATAI_SCTRL_ENABLE |SNDDATAI_SCTRL_FASTUPD), - - /* Host coalescing engine */ - HOSTCC_RXCOL_TICKS, 0, - HOSTCC_TXCOL_TICKS, LOW_TXCOL_TICKS, - HOSTCC_RXMAX_FRAMES, 1, - HOSTCC_TXMAX_FRAMES, LOW_RXMAX_FRAMES, - HOSTCC_RXCOAL_MAXF_INT, 1, - HOSTCC_TXCOAL_MAXF_INT, 0, - - /* Status/statistics block address. */ - /* Etherboot lives below 4GB, so HIGH == 0 */ - HOSTCC_STATUS_BLK_HOST_ADDR + TG3_64BIT_REG_HIGH, 0, - - /* No need to enable 32byte coalesce mode. */ - HOSTCC_MODE, HOSTCC_MODE_ENABLE | 0, - - RCVCC_MODE, RCVCC_MODE_ENABLE | RCVCC_MODE_ATTN_ENABLE, - RCVLPC_MODE, RCVLPC_MODE_ENABLE, - - RCVDCC_MODE, RCVDCC_MODE_ENABLE | RCVDCC_MODE_ATTN_ENABLE, - - SNDDATAC_MODE, SNDDATAC_MODE_ENABLE, - SNDBDC_MODE, SNDBDC_MODE_ENABLE | SNDBDC_MODE_ATTN_ENABLE, - RCVBDI_MODE, RCVBDI_MODE_ENABLE | RCVBDI_MODE_RCB_ATTN_ENAB, - RCVDBDI_MODE, RCVDBDI_MODE_ENABLE | RCVDBDI_MODE_INV_RING_SZ, - SNDDATAI_MODE, SNDDATAI_MODE_ENABLE, - SNDBDI_MODE, SNDBDI_MODE_ENABLE | SNDBDI_MODE_ATTN_ENABLE, - SNDBDS_MODE, SNDBDS_MODE_ENABLE | SNDBDS_MODE_ATTN_ENABLE, - - /* Accept all multicast frames. */ - MAC_HASH_REG_0, 0xffffffff, - MAC_HASH_REG_1, 0xffffffff, - MAC_HASH_REG_2, 0xffffffff, - MAC_HASH_REG_3, 0xffffffff, - }; - static const uint32_t table_not_5705[] = { - /* Host coalescing engine */ - HOSTCC_RXCOAL_TICK_INT, 0, - HOSTCC_TXCOAL_TICK_INT, 0, - - /* Status/statistics block address. */ - /* Etherboot lives below 4GB, so HIGH == 0 */ - HOSTCC_STAT_COAL_TICKS, DEFAULT_STAT_COAL_TICKS, - HOSTCC_STATS_BLK_HOST_ADDR + TG3_64BIT_REG_HIGH, 0, - HOSTCC_STATS_BLK_NIC_ADDR, NIC_SRAM_STATS_BLK, - HOSTCC_STATUS_BLK_NIC_ADDR, NIC_SRAM_STATUS_BLK, - - RCVLSC_MODE, RCVLSC_MODE_ENABLE | RCVLSC_MODE_ATTN_ENABLE, - - MBFREE_MODE, MBFREE_MODE_ENABLE, - }; - TG3_WRITE_SETTINGS(table_all); - tw32(HOSTCC_STATS_BLK_HOST_ADDR + TG3_64BIT_REG_LOW, - virt_to_bus(tp->hw_stats)); - tw32(HOSTCC_STATUS_BLK_HOST_ADDR + TG3_64BIT_REG_LOW, - virt_to_bus(tp->hw_status)); - if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705) { - TG3_WRITE_SETTINGS(table_not_5705); - } - } - - tp->tx_mode = TX_MODE_ENABLE; - tw32_carefully(MAC_TX_MODE, tp->tx_mode); - - tp->rx_mode = RX_MODE_ENABLE; - tw32_carefully(MAC_RX_MODE, tp->rx_mode); - - tp->mi_mode = MAC_MI_MODE_BASE; - tw32_carefully(MAC_MI_MODE, tp->mi_mode); - - tw32(MAC_LED_CTRL, 0); - tw32(MAC_MI_STAT, MAC_MI_STAT_LNKSTAT_ATTN_ENAB); - if (tp->phy_id == PHY_ID_SERDES) { - tw32_carefully(MAC_RX_MODE, RX_MODE_RESET); - } - tp->rx_mode |= RX_MODE_KEEP_VLAN_TAG; /* drop tagged vlan packets */ - tw32_carefully(MAC_RX_MODE, tp->rx_mode); - - if (tp->pci_chip_rev_id == CHIPREV_ID_5703_A1) - tw32(MAC_SERDES_CFG, 0x616000); - - /* Prevent chip from dropping frames when flow control - * is enabled. - */ - tw32(MAC_LOW_WMARK_MAX_RX_FRAME, 2); - tr32(MAC_LOW_WMARK_MAX_RX_FRAME); - - err = tg3_setup_phy(tp); - - /* Ignore CRC stats */ - - /* Initialize receive rules. */ - tw32(MAC_RCV_RULE_0, 0xc2000000 & RCV_RULE_DISABLE_MASK); - tw32(MAC_RCV_VALUE_0, 0xffffffff & RCV_RULE_DISABLE_MASK); - tw32(MAC_RCV_RULE_1, 0x86000004 & RCV_RULE_DISABLE_MASK); - tw32(MAC_RCV_VALUE_1, 0xffffffff & RCV_RULE_DISABLE_MASK); - - if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705) - limit = 8; - else - limit = 16; - if (tp->tg3_flags & TG3_FLAG_ENABLE_ASF) - limit -= 4; - switch (limit) { - case 16: tw32(MAC_RCV_RULE_15, 0); tw32(MAC_RCV_VALUE_15, 0); - case 15: tw32(MAC_RCV_RULE_14, 0); tw32(MAC_RCV_VALUE_14, 0); - case 14: tw32(MAC_RCV_RULE_13, 0); tw32(MAC_RCV_VALUE_13, 0); - case 13: tw32(MAC_RCV_RULE_12, 0); tw32(MAC_RCV_VALUE_12, 0); - case 12: tw32(MAC_RCV_RULE_11, 0); tw32(MAC_RCV_VALUE_11, 0); - case 11: tw32(MAC_RCV_RULE_10, 0); tw32(MAC_RCV_VALUE_10, 0); - case 10: tw32(MAC_RCV_RULE_9, 0); tw32(MAC_RCV_VALUE_9, 0); - case 9: tw32(MAC_RCV_RULE_8, 0); tw32(MAC_RCV_VALUE_8, 0); - case 8: tw32(MAC_RCV_RULE_7, 0); tw32(MAC_RCV_VALUE_7, 0); - case 7: tw32(MAC_RCV_RULE_6, 0); tw32(MAC_RCV_VALUE_6, 0); - case 6: tw32(MAC_RCV_RULE_5, 0); tw32(MAC_RCV_VALUE_5, 0); - case 5: tw32(MAC_RCV_RULE_4, 0); tw32(MAC_RCV_VALUE_4, 0); - case 4: /* tw32(MAC_RCV_RULE_3, 0); tw32(MAC_RCV_VALUE_3, 0); */ - case 3: /* tw32(MAC_RCV_RULE_2, 0); tw32(MAC_RCV_VALUE_2, 0); */ - case 2: - case 1: - default: - break; - }; - - return err; -} - - - -/* Chips other than 5700/5701 use the NVRAM for fetching info. */ -static void tg3_nvram_init(struct tg3 *tp) -{ - tw32(GRC_EEPROM_ADDR, - (EEPROM_ADDR_FSM_RESET | - (EEPROM_DEFAULT_CLOCK_PERIOD << - EEPROM_ADDR_CLKPERD_SHIFT))); - - mdelay(1); - - /* Enable seeprom accesses. */ - tw32_carefully(GRC_LOCAL_CTRL, - tr32(GRC_LOCAL_CTRL) | GRC_LCLCTRL_AUTO_SEEPROM); - - if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5700 && - GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5701) { - uint32_t nvcfg1 = tr32(NVRAM_CFG1); - - tp->tg3_flags |= TG3_FLAG_NVRAM; - if (nvcfg1 & NVRAM_CFG1_FLASHIF_ENAB) { - if (nvcfg1 & NVRAM_CFG1_BUFFERED_MODE) - tp->tg3_flags |= TG3_FLAG_NVRAM_BUFFERED; - } else { - nvcfg1 &= ~NVRAM_CFG1_COMPAT_BYPASS; - tw32(NVRAM_CFG1, nvcfg1); - } - - } else { - tp->tg3_flags &= ~(TG3_FLAG_NVRAM | TG3_FLAG_NVRAM_BUFFERED); - } -} - - -static int tg3_nvram_read_using_eeprom( - struct tg3 *tp __unused, uint32_t offset, uint32_t *val) -{ - uint32_t tmp; - int i; - - if (offset > EEPROM_ADDR_ADDR_MASK || - (offset % 4) != 0) { - return -EINVAL; - } - - tmp = tr32(GRC_EEPROM_ADDR) & ~(EEPROM_ADDR_ADDR_MASK | - EEPROM_ADDR_DEVID_MASK | - EEPROM_ADDR_READ); - tw32(GRC_EEPROM_ADDR, - tmp | - (0 << EEPROM_ADDR_DEVID_SHIFT) | - ((offset << EEPROM_ADDR_ADDR_SHIFT) & - EEPROM_ADDR_ADDR_MASK) | - EEPROM_ADDR_READ | EEPROM_ADDR_START); - - for (i = 0; i < 10000; i++) { - tmp = tr32(GRC_EEPROM_ADDR); - - if (tmp & EEPROM_ADDR_COMPLETE) - break; - udelay(100); - } - if (!(tmp & EEPROM_ADDR_COMPLETE)) { - return -EBUSY; - } - - *val = tr32(GRC_EEPROM_DATA); - return 0; -} - -static int tg3_nvram_read(struct tg3 *tp, uint32_t offset, uint32_t *val) -{ - int i, saw_done_clear; - - if (!(tp->tg3_flags & TG3_FLAG_NVRAM)) - return tg3_nvram_read_using_eeprom(tp, offset, val); - - if (tp->tg3_flags & TG3_FLAG_NVRAM_BUFFERED) - offset = ((offset / NVRAM_BUFFERED_PAGE_SIZE) << - NVRAM_BUFFERED_PAGE_POS) + - (offset % NVRAM_BUFFERED_PAGE_SIZE); - - if (offset > NVRAM_ADDR_MSK) - return -EINVAL; - - tw32(NVRAM_SWARB, SWARB_REQ_SET1); - for (i = 0; i < 1000; i++) { - if (tr32(NVRAM_SWARB) & SWARB_GNT1) - break; - udelay(20); - } - - tw32(NVRAM_ADDR, offset); - tw32(NVRAM_CMD, - NVRAM_CMD_RD | NVRAM_CMD_GO | - NVRAM_CMD_FIRST | NVRAM_CMD_LAST | NVRAM_CMD_DONE); - - /* Wait for done bit to clear then set again. */ - saw_done_clear = 0; - for (i = 0; i < 1000; i++) { - udelay(10); - if (!saw_done_clear && - !(tr32(NVRAM_CMD) & NVRAM_CMD_DONE)) - saw_done_clear = 1; - else if (saw_done_clear && - (tr32(NVRAM_CMD) & NVRAM_CMD_DONE)) - break; - } - if (i >= 1000) { - tw32(NVRAM_SWARB, SWARB_REQ_CLR1); - return -EBUSY; - } - - *val = bswap_32(tr32(NVRAM_RDDATA)); - tw32(NVRAM_SWARB, 0x20); - - return 0; -} - -struct subsys_tbl_ent { - uint16_t subsys_vendor, subsys_devid; - uint32_t phy_id; -}; - -static struct subsys_tbl_ent subsys_id_to_phy_id[] = { - /* Broadcom boards. */ - { 0x14e4, 0x1644, PHY_ID_BCM5401 }, /* BCM95700A6 */ - { 0x14e4, 0x0001, PHY_ID_BCM5701 }, /* BCM95701A5 */ - { 0x14e4, 0x0002, PHY_ID_BCM8002 }, /* BCM95700T6 */ - { 0x14e4, 0x0003, PHY_ID_SERDES }, /* BCM95700A9 */ - { 0x14e4, 0x0005, PHY_ID_BCM5701 }, /* BCM95701T1 */ - { 0x14e4, 0x0006, PHY_ID_BCM5701 }, /* BCM95701T8 */ - { 0x14e4, 0x0007, PHY_ID_SERDES }, /* BCM95701A7 */ - { 0x14e4, 0x0008, PHY_ID_BCM5701 }, /* BCM95701A10 */ - { 0x14e4, 0x8008, PHY_ID_BCM5701 }, /* BCM95701A12 */ - { 0x14e4, 0x0009, PHY_ID_BCM5701 }, /* BCM95703Ax1 */ - { 0x14e4, 0x8009, PHY_ID_BCM5701 }, /* BCM95703Ax2 */ - - /* 3com boards. */ - { PCI_VENDOR_ID_3COM, 0x1000, PHY_ID_BCM5401 }, /* 3C996T */ - { PCI_VENDOR_ID_3COM, 0x1006, PHY_ID_BCM5701 }, /* 3C996BT */ - /* { PCI_VENDOR_ID_3COM, 0x1002, PHY_ID_XXX }, 3C996CT */ - /* { PCI_VENDOR_ID_3COM, 0x1003, PHY_ID_XXX }, 3C997T */ - { PCI_VENDOR_ID_3COM, 0x1004, PHY_ID_SERDES }, /* 3C996SX */ - /* { PCI_VENDOR_ID_3COM, 0x1005, PHY_ID_XXX }, 3C997SZ */ - { PCI_VENDOR_ID_3COM, 0x1007, PHY_ID_BCM5701 }, /* 3C1000T */ - { PCI_VENDOR_ID_3COM, 0x1008, PHY_ID_BCM5701 }, /* 3C940BR01 */ - - /* DELL boards. */ - { PCI_VENDOR_ID_DELL, 0x00d1, PHY_ID_BCM5401 }, /* VIPER */ - { PCI_VENDOR_ID_DELL, 0x0106, PHY_ID_BCM5401 }, /* JAGUAR */ - { PCI_VENDOR_ID_DELL, 0x0109, PHY_ID_BCM5411 }, /* MERLOT */ - { PCI_VENDOR_ID_DELL, 0x010a, PHY_ID_BCM5411 }, /* SLIM_MERLOT */ - - /* Compaq boards. */ - { PCI_VENDOR_ID_COMPAQ, 0x007c, PHY_ID_BCM5701 }, /* BANSHEE */ - { PCI_VENDOR_ID_COMPAQ, 0x009a, PHY_ID_BCM5701 }, /* BANSHEE_2 */ - { PCI_VENDOR_ID_COMPAQ, 0x007d, PHY_ID_SERDES }, /* CHANGELING */ - { PCI_VENDOR_ID_COMPAQ, 0x0085, PHY_ID_BCM5701 }, /* NC7780 */ - { PCI_VENDOR_ID_COMPAQ, 0x0099, PHY_ID_BCM5701 } /* NC7780_2 */ -}; - -static int tg3_phy_probe(struct tg3 *tp) -{ - uint32_t eeprom_phy_id, hw_phy_id_1, hw_phy_id_2; - uint32_t hw_phy_id, hw_phy_id_masked; - enum phy_led_mode eeprom_led_mode; - uint32_t val; - unsigned i; - int eeprom_signature_found, err; - - tp->phy_id = PHY_ID_INVALID; - - for (i = 0; i < sizeof(subsys_id_to_phy_id)/sizeof(subsys_id_to_phy_id[0]); i++) { - if ((subsys_id_to_phy_id[i].subsys_vendor == tp->subsystem_vendor) && - (subsys_id_to_phy_id[i].subsys_devid == tp->subsystem_device)) { - tp->phy_id = subsys_id_to_phy_id[i].phy_id; - break; - } - } - - eeprom_phy_id = PHY_ID_INVALID; - eeprom_led_mode = led_mode_auto; - eeprom_signature_found = 0; - tg3_read_mem(NIC_SRAM_DATA_SIG, &val); - if (val == NIC_SRAM_DATA_SIG_MAGIC) { - uint32_t nic_cfg; - - tg3_read_mem(NIC_SRAM_DATA_CFG, &nic_cfg); - tp->nic_sram_data_cfg = nic_cfg; - - eeprom_signature_found = 1; - - if ((nic_cfg & NIC_SRAM_DATA_CFG_PHY_TYPE_MASK) == - NIC_SRAM_DATA_CFG_PHY_TYPE_FIBER) { - eeprom_phy_id = PHY_ID_SERDES; - } else { - uint32_t nic_phy_id; - - tg3_read_mem(NIC_SRAM_DATA_PHY_ID, &nic_phy_id); - if (nic_phy_id != 0) { - uint32_t id1 = nic_phy_id & NIC_SRAM_DATA_PHY_ID1_MASK; - uint32_t id2 = nic_phy_id & NIC_SRAM_DATA_PHY_ID2_MASK; - - eeprom_phy_id = (id1 >> 16) << 10; - eeprom_phy_id |= (id2 & 0xfc00) << 16; - eeprom_phy_id |= (id2 & 0x03ff) << 0; - } - } - - switch (nic_cfg & NIC_SRAM_DATA_CFG_LED_MODE_MASK) { - case NIC_SRAM_DATA_CFG_LED_TRIPLE_SPD: - eeprom_led_mode = led_mode_three_link; - break; - - case NIC_SRAM_DATA_CFG_LED_LINK_SPD: - eeprom_led_mode = led_mode_link10; - break; - - default: - eeprom_led_mode = led_mode_auto; - break; - }; - if (((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5703) || - (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) || - (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705)) && - (nic_cfg & NIC_SRAM_DATA_CFG_EEPROM_WP)) { - tp->tg3_flags |= TG3_FLAG_EEPROM_WRITE_PROT; - } - - if (nic_cfg & NIC_SRAM_DATA_CFG_ASF_ENABLE) - tp->tg3_flags |= TG3_FLAG_ENABLE_ASF; - if (nic_cfg & NIC_SRAM_DATA_CFG_FIBER_WOL) - tp->tg3_flags |= TG3_FLAG_SERDES_WOL_CAP; - } - - /* Now read the physical PHY_ID from the chip and verify - * that it is sane. If it doesn't look good, we fall back - * to either the hard-coded table based PHY_ID and failing - * that the value found in the eeprom area. - */ - err = tg3_readphy(tp, MII_PHYSID1, &hw_phy_id_1); - err |= tg3_readphy(tp, MII_PHYSID2, &hw_phy_id_2); - - hw_phy_id = (hw_phy_id_1 & 0xffff) << 10; - hw_phy_id |= (hw_phy_id_2 & 0xfc00) << 16; - hw_phy_id |= (hw_phy_id_2 & 0x03ff) << 0; - - hw_phy_id_masked = hw_phy_id & PHY_ID_MASK; - - if (!err && KNOWN_PHY_ID(hw_phy_id_masked)) { - tp->phy_id = hw_phy_id; - } else { - /* phy_id currently holds the value found in the - * subsys_id_to_phy_id[] table or PHY_ID_INVALID - * if a match was not found there. - */ - if (tp->phy_id == PHY_ID_INVALID) { - if (!eeprom_signature_found || - !KNOWN_PHY_ID(eeprom_phy_id & PHY_ID_MASK)) - return -ENODEV; - tp->phy_id = eeprom_phy_id; - } - } - - err = tg3_phy_reset(tp); - if (err) - return err; - - if (tp->pci_chip_rev_id == CHIPREV_ID_5701_A0 || - tp->pci_chip_rev_id == CHIPREV_ID_5701_B0) { - uint32_t mii_tg3_ctrl; - - /* These chips, when reset, only advertise 10Mb - * capabilities. Fix that. - */ - err = tg3_writephy(tp, MII_ADVERTISE, - (ADVERTISE_CSMA | - ADVERTISE_PAUSE_CAP | - ADVERTISE_10HALF | - ADVERTISE_10FULL | - ADVERTISE_100HALF | - ADVERTISE_100FULL)); - mii_tg3_ctrl = (MII_TG3_CTRL_ADV_1000_HALF | - MII_TG3_CTRL_ADV_1000_FULL | - MII_TG3_CTRL_AS_MASTER | - MII_TG3_CTRL_ENABLE_AS_MASTER); - if (tp->tg3_flags & TG3_FLAG_10_100_ONLY) - mii_tg3_ctrl = 0; - - err |= tg3_writephy(tp, MII_TG3_CTRL, mii_tg3_ctrl); - err |= tg3_writephy(tp, MII_BMCR, - (BMCR_ANRESTART | BMCR_ANENABLE)); - } - - if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5703) { - tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x0c00); - tg3_writephy(tp, MII_TG3_DSP_ADDRESS, 0x201f); - tg3_writedsp(tp, MII_TG3_DSP_RW_PORT, 0x2aaa); - } - - if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) { - tg3_writephy(tp, 0x1c, 0x8d68); - tg3_writephy(tp, 0x1c, 0x8d68); - } - - /* Enable Ethernet@WireSpeed */ - tg3_phy_set_wirespeed(tp); - - if (!err && ((tp->phy_id & PHY_ID_MASK) == PHY_ID_BCM5401)) { - err = tg3_init_5401phy_dsp(tp); - } - - /* Determine the PHY led mode. - * Be careful if this gets set wrong it can result in an inability to - * establish a link. - */ - if (tp->phy_id == PHY_ID_SERDES) { - tp->led_mode = led_mode_three_link; - } - else if (tp->subsystem_vendor == PCI_VENDOR_ID_DELL) { - tp->led_mode = led_mode_link10; - } else { - tp->led_mode = led_mode_three_link; - if (eeprom_signature_found && - eeprom_led_mode != led_mode_auto) - tp->led_mode = eeprom_led_mode; - } - - if (tp->phy_id == PHY_ID_SERDES) - tp->link_config.advertising = - (ADVERTISED_1000baseT_Half | - ADVERTISED_1000baseT_Full | - ADVERTISED_Autoneg | - ADVERTISED_FIBRE); - if (tp->tg3_flags & TG3_FLAG_10_100_ONLY) - tp->link_config.advertising &= - ~(ADVERTISED_1000baseT_Half | - ADVERTISED_1000baseT_Full); - - return err; -} - -#if SUPPORT_PARTNO_STR -static void tg3_read_partno(struct tg3 *tp) -{ - unsigned char vpd_data[256]; - int i; - - for (i = 0; i < 256; i += 4) { - uint32_t tmp; - - if (tg3_nvram_read(tp, 0x100 + i, &tmp)) - goto out_not_found; - - vpd_data[i + 0] = ((tmp >> 0) & 0xff); - vpd_data[i + 1] = ((tmp >> 8) & 0xff); - vpd_data[i + 2] = ((tmp >> 16) & 0xff); - vpd_data[i + 3] = ((tmp >> 24) & 0xff); - } - - /* Now parse and find the part number. */ - for (i = 0; i < 256; ) { - unsigned char val = vpd_data[i]; - int block_end; - - if (val == 0x82 || val == 0x91) { - i = (i + 3 + - (vpd_data[i + 1] + - (vpd_data[i + 2] << 8))); - continue; - } - - if (val != 0x90) - goto out_not_found; - - block_end = (i + 3 + - (vpd_data[i + 1] + - (vpd_data[i + 2] << 8))); - i += 3; - while (i < block_end) { - if (vpd_data[i + 0] == 'P' && - vpd_data[i + 1] == 'N') { - int partno_len = vpd_data[i + 2]; - - if (partno_len > 24) - goto out_not_found; - - memcpy(tp->board_part_number, - &vpd_data[i + 3], - partno_len); - - /* Success. */ - return; - } - } - - /* Part number not found. */ - goto out_not_found; - } - -out_not_found: - memcpy(tp->board_part_number, "none", sizeof("none")); -} -#else -#define tg3_read_partno(TP) ((TP)->board_part_number[0] = '\0') -#endif - -static int tg3_get_invariants(struct tg3 *tp) -{ - uint32_t misc_ctrl_reg; - uint32_t pci_state_reg, grc_misc_cfg; - uint16_t pci_cmd; - uint8_t pci_latency; - int err; - - /* Read the subsystem vendor and device ids */ - pci_read_config_word(tp->pdev, PCI_SUBSYSTEM_VENDOR_ID, &tp->subsystem_vendor); - pci_read_config_word(tp->pdev, PCI_SUBSYSTEM_ID, &tp->subsystem_device); - - /* The sun_5704 code needs infrastructure etherboot does have - * ignore it for now. - */ - - /* If we have an AMD 762 or Intel ICH/ICH0 chipset, write - * reordering to the mailbox registers done by the host - * controller can cause major troubles. We read back from - * every mailbox register write to force the writes to be - * posted to the chip in order. - * - * TG3_FLAG_MBOX_WRITE_REORDER has been forced on. - */ - - /* Force memory write invalidate off. If we leave it on, - * then on 5700_BX chips we have to enable a workaround. - * The workaround is to set the TG3PCI_DMA_RW_CTRL boundry - * to match the cacheline size. The Broadcom driver have this - * workaround but turns MWI off all the times so never uses - * it. This seems to suggest that the workaround is insufficient. - */ - pci_read_config_word(tp->pdev, PCI_COMMAND, &pci_cmd); - pci_cmd &= ~PCI_COMMAND_INVALIDATE; - /* Also, force SERR#/PERR# in PCI command. */ - pci_cmd |= PCI_COMMAND_PARITY | PCI_COMMAND_SERR; - pci_write_config_word(tp->pdev, PCI_COMMAND, pci_cmd); - - /* It is absolutely critical that TG3PCI_MISC_HOST_CTRL - * has the register indirect write enable bit set before - * we try to access any of the MMIO registers. It is also - * critical that the PCI-X hw workaround situation is decided - * before that as well. - */ - pci_read_config_dword(tp->pdev, TG3PCI_MISC_HOST_CTRL, &misc_ctrl_reg); - - tp->pci_chip_rev_id = (misc_ctrl_reg >> MISC_HOST_CTRL_CHIPREV_SHIFT); - - /* Initialize misc host control in PCI block. */ - tp->misc_host_ctrl |= (misc_ctrl_reg & - MISC_HOST_CTRL_CHIPREV); - pci_write_config_dword(tp->pdev, TG3PCI_MISC_HOST_CTRL, - tp->misc_host_ctrl); - - pci_read_config_byte(tp->pdev, PCI_LATENCY_TIMER, &pci_latency); - if (pci_latency < 64) { - pci_write_config_byte(tp->pdev, PCI_LATENCY_TIMER, 64); - } - - pci_read_config_dword(tp->pdev, TG3PCI_PCISTATE, &pci_state_reg); - - /* If this is a 5700 BX chipset, and we are in PCI-X - * mode, enable register write workaround. - * - * The workaround is to use indirect register accesses - * for all chip writes not to mailbox registers. - * - * In etherboot to simplify things we just always use this work around. - */ - if ((pci_state_reg & PCISTATE_CONV_PCI_MODE) == 0) { - tp->tg3_flags |= TG3_FLAG_PCIX_MODE; - } - /* Back to back register writes can cause problems on the 5701, - * the workaround is to read back all reg writes except those to - * mailbox regs. - * In etherboot we always use indirect register accesses so - * we don't see this. - */ - - if ((pci_state_reg & PCISTATE_BUS_SPEED_HIGH) != 0) - tp->tg3_flags |= TG3_FLAG_PCI_HIGH_SPEED; - if ((pci_state_reg & PCISTATE_BUS_32BIT) != 0) - tp->tg3_flags |= TG3_FLAG_PCI_32BIT; - - /* Chip-specific fixup from Broadcom driver */ - if ((tp->pci_chip_rev_id == CHIPREV_ID_5704_A0) && - (!(pci_state_reg & PCISTATE_RETRY_SAME_DMA))) { - pci_state_reg |= PCISTATE_RETRY_SAME_DMA; - pci_write_config_dword(tp->pdev, TG3PCI_PCISTATE, pci_state_reg); - } - - /* Force the chip into D0. */ - tg3_set_power_state_0(tp); - - /* Etherboot does not ask the tg3 to do checksums */ - /* Etherboot does not ask the tg3 to do jumbo frames */ - /* Ehterboot does not ask the tg3 to use WakeOnLan. */ - - /* A few boards don't want Ethernet@WireSpeed phy feature */ - if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700) || - ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705) && - (tp->pci_chip_rev_id != CHIPREV_ID_5705_A0) && - (tp->pci_chip_rev_id != CHIPREV_ID_5705_A1))) { - tp->tg3_flags2 |= TG3_FLG2_NO_ETH_WIRE_SPEED; - } - - /* Avoid tagged irq status etherboot does not use irqs */ - - /* Only 5701 and later support tagged irq status mode. - * Also, 5788 chips cannot use tagged irq status. - * - * However, since etherboot does not use irqs avoid tagged irqs - * status because the interrupt condition is more difficult to - * fully clear in that mode. - */ - - /* Since some 5700_AX && 5700_BX have problems with 32BYTE - * coalesce_mode, and the rest work fine anything set. - * Don't enable HOST_CC_MODE_32BYTE in etherboot. - */ - - /* Initialize MAC MI mode, polling disabled. */ - tw32_carefully(MAC_MI_MODE, tp->mi_mode); - - /* Initialize data/descriptor byte/word swapping. */ - tw32(GRC_MODE, tp->grc_mode); - - tg3_switch_clocks(tp); - - /* Clear this out for sanity. */ - tw32(TG3PCI_MEM_WIN_BASE_ADDR, 0); - - /* Etherboot does not need to check if the PCIX_TARGET_HWBUG - * is needed. It always uses it. - */ - - udelay(50); - tg3_nvram_init(tp); - - /* The TX descriptors will reside in main memory. - */ - - /* See which board we are using. - */ - grc_misc_cfg = tr32(GRC_MISC_CFG); - grc_misc_cfg &= GRC_MISC_CFG_BOARD_ID_MASK; - - if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704 && - grc_misc_cfg == GRC_MISC_CFG_BOARD_ID_5704CIOBE) { - tp->tg3_flags |= TG3_FLAG_SPLIT_MODE; - tp->split_mode_max_reqs = SPLIT_MODE_5704_MAX_REQ; - } - - if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705 && - (grc_misc_cfg == GRC_MISC_CFG_BOARD_ID_5788 || - grc_misc_cfg == GRC_MISC_CFG_BOARD_ID_5788M)) - tp->tg3_flags2 |= TG3_FLG2_IS_5788; - - /* these are limited to 10/100 only */ - if (((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5703) && - ((grc_misc_cfg == 0x8000) || (grc_misc_cfg == 0x4000))) || - ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705) && - (tp->pdev->vendor == PCI_VENDOR_ID_BROADCOM) && - ((tp->pdev->dev_id == PCI_DEVICE_ID_TIGON3_5901) || - (tp->pdev->dev_id == PCI_DEVICE_ID_TIGON3_5901_2)))) { - tp->tg3_flags |= TG3_FLAG_10_100_ONLY; - } - - err = tg3_phy_probe(tp); - if (err) { - printf("phy probe failed, err %d\n", err); - } - - tg3_read_partno(tp); - - - /* 5700 BX chips need to have their TX producer index mailboxes - * written twice to workaround a bug. - * In etherboot we do this unconditionally to simplify things. - */ - - /* 5700 chips can get confused if TX buffers straddle the - * 4GB address boundary in some cases. - * - * In etherboot we can ignore the problem as etherboot lives below 4GB. - */ - - /* In etherboot wake-on-lan is unconditionally disabled */ - return err; -} - -static int tg3_get_device_address(struct tg3 *tp) -{ - struct nic *nic = tp->nic; - uint32_t hi, lo, mac_offset; - - if (PCI_FUNC(tp->pdev->devfn) == 0) - mac_offset = 0x7c; - else - mac_offset = 0xcc; - - /* First try to get it from MAC address mailbox. */ - tg3_read_mem(NIC_SRAM_MAC_ADDR_HIGH_MBOX, &hi); - if ((hi >> 16) == 0x484b) { - nic->node_addr[0] = (hi >> 8) & 0xff; - nic->node_addr[1] = (hi >> 0) & 0xff; - - tg3_read_mem(NIC_SRAM_MAC_ADDR_LOW_MBOX, &lo); - nic->node_addr[2] = (lo >> 24) & 0xff; - nic->node_addr[3] = (lo >> 16) & 0xff; - nic->node_addr[4] = (lo >> 8) & 0xff; - nic->node_addr[5] = (lo >> 0) & 0xff; - } - /* Next, try NVRAM. */ - else if (!tg3_nvram_read(tp, mac_offset + 0, &hi) && - !tg3_nvram_read(tp, mac_offset + 4, &lo)) { - nic->node_addr[0] = ((hi >> 16) & 0xff); - nic->node_addr[1] = ((hi >> 24) & 0xff); - nic->node_addr[2] = ((lo >> 0) & 0xff); - nic->node_addr[3] = ((lo >> 8) & 0xff); - nic->node_addr[4] = ((lo >> 16) & 0xff); - nic->node_addr[5] = ((lo >> 24) & 0xff); - } - /* Finally just fetch it out of the MAC control regs. */ - else { - hi = tr32(MAC_ADDR_0_HIGH); - lo = tr32(MAC_ADDR_0_LOW); - - nic->node_addr[5] = lo & 0xff; - nic->node_addr[4] = (lo >> 8) & 0xff; - nic->node_addr[3] = (lo >> 16) & 0xff; - nic->node_addr[2] = (lo >> 24) & 0xff; - nic->node_addr[1] = hi & 0xff; - nic->node_addr[0] = (hi >> 8) & 0xff; - } - - return 0; -} - - -static int tg3_setup_dma(struct tg3 *tp) -{ - tw32(TG3PCI_CLOCK_CTRL, 0); - - if ((tp->tg3_flags & TG3_FLAG_PCIX_MODE) == 0) { - tp->dma_rwctrl = - (0x7 << DMA_RWCTRL_PCI_WRITE_CMD_SHIFT) | - (0x6 << DMA_RWCTRL_PCI_READ_CMD_SHIFT) | - (0x7 << DMA_RWCTRL_WRITE_WATER_SHIFT) | - (0x7 << DMA_RWCTRL_READ_WATER_SHIFT) | - (0x0f << DMA_RWCTRL_MIN_DMA_SHIFT); - if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705) { - tp->dma_rwctrl &= ~(DMA_RWCTRL_MIN_DMA << DMA_RWCTRL_MIN_DMA_SHIFT); - } - } else { - if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) - tp->dma_rwctrl = - (0x7 << DMA_RWCTRL_PCI_WRITE_CMD_SHIFT) | - (0x6 << DMA_RWCTRL_PCI_READ_CMD_SHIFT) | - (0x3 << DMA_RWCTRL_WRITE_WATER_SHIFT) | - (0x7 << DMA_RWCTRL_READ_WATER_SHIFT) | - (0x00 << DMA_RWCTRL_MIN_DMA_SHIFT); - else - tp->dma_rwctrl = - (0x7 << DMA_RWCTRL_PCI_WRITE_CMD_SHIFT) | - (0x6 << DMA_RWCTRL_PCI_READ_CMD_SHIFT) | - (0x3 << DMA_RWCTRL_WRITE_WATER_SHIFT) | - (0x3 << DMA_RWCTRL_READ_WATER_SHIFT) | - (0x0f << DMA_RWCTRL_MIN_DMA_SHIFT); - - /* Wheee, some more chip bugs... */ - if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5703) || - (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704)) { - uint32_t ccval = tr32(TG3PCI_CLOCK_CTRL) & 0x1f; - - if ((ccval == 0x6) || (ccval == 0x7)) { - tp->dma_rwctrl |= DMA_RWCTRL_ONE_DMA; - } - } - } - - if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5703) || - (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704)) { - tp->dma_rwctrl &= ~(DMA_RWCTRL_MIN_DMA << DMA_RWCTRL_MIN_DMA_SHIFT); - } - - tp->dma_rwctrl |= DMA_RWCTRL_ASSERT_ALL_BE; - - tw32(TG3PCI_DMA_RW_CTRL, tp->dma_rwctrl); - - return 0; -} - -static void tg3_init_link_config(struct tg3 *tp) -{ - tp->link_config.advertising = - (ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full | - ADVERTISED_100baseT_Half | ADVERTISED_100baseT_Full | - ADVERTISED_1000baseT_Half | ADVERTISED_1000baseT_Full | - ADVERTISED_Autoneg | ADVERTISED_MII); - tp->carrier_ok = 0; - tp->link_config.active_speed = SPEED_INVALID; - tp->link_config.active_duplex = DUPLEX_INVALID; -} - - -#if SUPPORT_PHY_STR -static const char * tg3_phy_string(struct tg3 *tp) -{ - switch (tp->phy_id & PHY_ID_MASK) { - case PHY_ID_BCM5400: return "5400"; - case PHY_ID_BCM5401: return "5401"; - case PHY_ID_BCM5411: return "5411"; - case PHY_ID_BCM5701: return "5701"; - case PHY_ID_BCM5703: return "5703"; - case PHY_ID_BCM5704: return "5704"; - case PHY_ID_BCM8002: return "8002"; - case PHY_ID_SERDES: return "serdes"; - default: return "unknown"; - }; -} -#else -#define tg3_phy_string(TP) "?" -#endif - - -static void tg3_poll_link(struct tg3 *tp) -{ - uint32_t mac_stat; - - mac_stat = tr32(MAC_STATUS); - if (tp->phy_id == PHY_ID_SERDES) { - if (tp->carrier_ok? - (mac_stat & MAC_STATUS_LNKSTATE_CHANGED): - (mac_stat & MAC_STATUS_PCS_SYNCED)) { - tw32_carefully(MAC_MODE, tp->mac_mode & ~MAC_MODE_PORT_MODE_MASK); - tw32_carefully(MAC_MODE, tp->mac_mode); - - tg3_setup_phy(tp); - } - } - else { - if (mac_stat & MAC_STATUS_LNKSTATE_CHANGED) { - tg3_setup_phy(tp); - } - } -} - -/************************************************************************** -POLL - Wait for a frame -***************************************************************************/ -static void tg3_ack_irqs(struct tg3 *tp) -{ - if (tp->hw_status->status & SD_STATUS_UPDATED) { - /* - * writing any value to intr-mbox-0 clears PCI INTA# and - * chip-internal interrupt pending events. - * writing non-zero to intr-mbox-0 additional tells the - * NIC to stop sending us irqs, engaging "in-intr-handler" - * event coalescing. - */ - tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, - 0x00000001); - /* - * Flush PCI write. This also guarantees that our - * status block has been flushed to host memory. - */ - tr32(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW); - tp->hw_status->status &= ~SD_STATUS_UPDATED; - } -} - -static int tg3_poll(struct nic *nic, int retrieve) -{ - /* return true if there's an ethernet packet ready to read */ - /* nic->packet should contain data on return */ - /* nic->packetlen should contain length of data */ - - struct tg3 *tp = &tg3; - int result; - - result = 0; - - if ( (tp->hw_status->idx[0].rx_producer != tp->rx_rcb_ptr) && !retrieve ) - return 1; - - tg3_ack_irqs(tp); - - if (tp->hw_status->idx[0].rx_producer != tp->rx_rcb_ptr) { - struct tg3_rx_buffer_desc *desc; - unsigned int len; - desc = &tp->rx_rcb[tp->rx_rcb_ptr]; - if ((desc->opaque & RXD_OPAQUE_RING_MASK) == RXD_OPAQUE_RING_STD) { - len = ((desc->idx_len & RXD_LEN_MASK) >> RXD_LEN_SHIFT) - 4; /* omit crc */ - - nic->packetlen = len; - memcpy(nic->packet, bus_to_virt(desc->addr_lo), len); - result = 1; - } - tp->rx_rcb_ptr = (tp->rx_rcb_ptr + 1) % TG3_RX_RCB_RING_SIZE; - - /* ACK the status ring */ - tw32_mailbox2(MAILBOX_RCVRET_CON_IDX_0 + TG3_64BIT_REG_LOW, tp->rx_rcb_ptr); - - /* Refill RX ring. */ - if (result) { - tp->rx_std_ptr = (tp->rx_std_ptr + 1) % TG3_RX_RING_SIZE; - tw32_mailbox2(MAILBOX_RCV_STD_PROD_IDX + TG3_64BIT_REG_LOW, tp->rx_std_ptr); - } - } - tg3_poll_link(tp); - return result; -} - -/************************************************************************** -TRANSMIT - Transmit a frame -***************************************************************************/ -#if 0 -static void tg3_set_txd(struct tg3 *tp, int entry, - dma_addr_t mapping, int len, uint32_t flags, - uint32_t mss_and_is_end) -{ - struct tg3_tx_buffer_desc *txd = &tp->tx_ring[entry]; - int is_end = (mss_and_is_end & 0x1); - if (is_end) { - flags |= TXD_FLAG_END; - } - - txd->addr_hi = 0; - txd->addr_lo = mapping & 0xffffffff; - txd->len_flags = (len << TXD_LEN_SHIFT) | flags; - txd->vlan_tag = 0 << TXD_VLAN_TAG_SHIFT; -} -#endif - -static void tg3_transmit(struct nic *nic, const char *dst_addr, - unsigned int type, unsigned int size, const char *packet) -{ - static struct eth_frame { - uint8_t dst_addr[ETH_ALEN]; - uint8_t src_addr[ETH_ALEN]; - uint16_t type; - uint8_t data [ETH_FRAME_LEN - ETH_HLEN]; - } frame[2]; - static int frame_idx; - - /* send the packet to destination */ - struct tg3_tx_buffer_desc *txd; - struct tg3 *tp; - uint32_t entry; - int i; - - /* Wait until there is a free packet frame */ - tp = &tg3; - i = 0; - entry = tp->tx_prod; - while((tp->hw_status->idx[0].tx_consumer != entry) && - (tp->hw_status->idx[0].tx_consumer != PREV_TX(entry))) { - mdelay(10); /* give the nick a chance */ - poll_interruptions(); - if (++i > 500) { /* timeout 5s for transmit */ - printf("transmit timed out\n"); - tg3_halt(tp); - tg3_setup_hw(tp); - return; - } - } - if (i != 0) { - printf("#"); - } - - /* Copy the packet to the our local buffer */ - memcpy(&frame[frame_idx].dst_addr, dst_addr, ETH_ALEN); - memcpy(&frame[frame_idx].src_addr, nic->node_addr, ETH_ALEN); - frame[frame_idx].type = htons(type); - memset(&frame[frame_idx].data, 0, sizeof(frame[frame_idx].data)); - memcpy(&frame[frame_idx].data, packet, size); - - /* Setup the ring buffer entry to transmit */ - txd = &tp->tx_ring[entry]; - txd->addr_hi = 0; /* Etherboot runs under 4GB */ - txd->addr_lo = virt_to_bus(&frame[frame_idx]); - txd->len_flags = ((size + ETH_HLEN) << TXD_LEN_SHIFT) | TXD_FLAG_END; - txd->vlan_tag = 0 << TXD_VLAN_TAG_SHIFT; - - /* Advance to the next entry */ - entry = NEXT_TX(entry); - frame_idx ^= 1; - - /* Packets are ready, update Tx producer idx local and on card */ - tw32_mailbox((MAILBOX_SNDHOST_PROD_IDX_0 + TG3_64BIT_REG_LOW), entry); - tw32_mailbox2((MAILBOX_SNDHOST_PROD_IDX_0 + TG3_64BIT_REG_LOW), entry); - tp->tx_prod = entry; -} - -/************************************************************************** -DISABLE - Turn off ethernet interface -***************************************************************************/ -static void tg3_disable(struct dev *dev __unused) -{ - struct tg3 *tp = &tg3; - /* put the card in its initial state */ - /* This function serves 3 purposes. - * This disables DMA and interrupts so we don't receive - * unexpected packets or interrupts from the card after - * etherboot has finished. - * This frees resources so etherboot may use - * this driver on another interface - * This allows etherboot to reinitialize the interface - * if something is something goes wrong. - */ - tg3_halt(tp); - tp->tg3_flags &= ~(TG3_FLAG_INIT_COMPLETE|TG3_FLAG_GOT_SERDES_FLOWCTL); - tp->carrier_ok = 0; - iounmap((void *)tp->regs); -} - -/************************************************************************** -IRQ - Enable, Disable, or Force interrupts -***************************************************************************/ -static void tg3_irq(struct nic *nic __unused, irq_action_t action __unused) -{ - switch ( action ) { - case DISABLE : - break; - case ENABLE : - break; - case FORCE : - break; - } -} - -/************************************************************************** -PROBE - Look for an adapter, this routine's visible to the outside -You should omit the last argument struct pci_device * for a non-PCI NIC -***************************************************************************/ -static int tg3_probe(struct dev *dev, struct pci_device *pdev) -{ - struct nic *nic = (struct nic *)dev; - struct tg3 *tp = &tg3; - unsigned long tg3reg_base, tg3reg_len; - int i, err, pm_cap; - - if (pdev == 0) - return 0; - - memset(tp, 0, sizeof(*tp)); - - adjust_pci_device(pdev); - - nic->irqno = 0; - nic->ioaddr = pdev->ioaddr & ~3; - - /* Find power-management capability. */ - pm_cap = pci_find_capability(pdev, PCI_CAP_ID_PM); - if (pm_cap == 0) { - printf("Cannot find PowerManagement capability, aborting.\n"); - return 0; - } - tg3reg_base = pci_bar_start(pdev, PCI_BASE_ADDRESS_0); - if (tg3reg_base == -1UL) { - printf("Unuseable bar\n"); - return 0; - } - tg3reg_len = pci_bar_size(pdev, PCI_BASE_ADDRESS_0); - - tp->pdev = pdev; - tp->nic = nic; - tp->pm_cap = pm_cap; - tp->rx_mode = 0; - tp->tx_mode = 0; - tp->mi_mode = MAC_MI_MODE_BASE; - tp->tg3_flags = 0 & ~TG3_FLAG_INIT_COMPLETE; - - /* The word/byte swap controls here control register access byte - * swapping. DMA data byte swapping is controlled in the GRC_MODE - * setting below. - */ - tp->misc_host_ctrl = - MISC_HOST_CTRL_MASK_PCI_INT | - MISC_HOST_CTRL_WORD_SWAP | - MISC_HOST_CTRL_INDIR_ACCESS | - MISC_HOST_CTRL_PCISTATE_RW; - - /* The NONFRM (non-frame) byte/word swap controls take effect - * on descriptor entries, anything which isn't packet data. - * - * The StrongARM chips on the board (one for tx, one for rx) - * are running in big-endian mode. - */ - tp->grc_mode = (GRC_MODE_WSWAP_DATA | GRC_MODE_BSWAP_DATA | - GRC_MODE_WSWAP_NONFRM_DATA); -#if __BYTE_ORDER == __BIG_ENDIAN - tp->grc_mode |= GRC_MODE_BSWAP_NONFRM_DATA; -#endif - tp->regs = (unsigned long) ioremap(tg3reg_base, tg3reg_len); - if (tp->regs == 0UL) { - printf("Cannot map device registers, aborting\n"); - return 0; - } - - tg3_init_link_config(tp); - - err = tg3_get_invariants(tp); - if (err) { - printf("Problem fetching invariants of chip, aborting.\n"); - goto err_out_iounmap; - } - - err = tg3_get_device_address(tp); - if (err) { - printf("Could not obtain valid ethernet address, aborting.\n"); - goto err_out_iounmap; - } - printf("Ethernet addr: %!\n", nic->node_addr); - - tg3_setup_dma(tp); - - /* Now that we have fully setup the chip, save away a snapshot - * of the PCI config space. We need to restore this after - * GRC_MISC_CFG core clock resets and some resume events. - */ - pci_save_state(tp->pdev, tp->pci_cfg_state); - - printf("Tigon3 [partno(%s) rev %hx PHY(%s)] (PCI%s:%s:%s)\n", - tp->board_part_number, - tp->pci_chip_rev_id, - tg3_phy_string(tp), - ((tp->tg3_flags & TG3_FLAG_PCIX_MODE) ? "X" : ""), - ((tp->tg3_flags & TG3_FLAG_PCI_HIGH_SPEED) ? - ((tp->tg3_flags & TG3_FLAG_PCIX_MODE) ? "133MHz" : "66MHz") : - ((tp->tg3_flags & TG3_FLAG_PCIX_MODE) ? "100MHz" : "33MHz")), - ((tp->tg3_flags & TG3_FLAG_PCI_32BIT) ? "32-bit" : "64-bit")); - - - err = tg3_setup_hw(tp); - if (err) { - goto err_out_disable; - } - tp->tg3_flags |= TG3_FLAG_INIT_COMPLETE; - - /* Wait for a reasonable time for the link to come up */ - tg3_poll_link(tp); - for(i = 0; !tp->carrier_ok && (i < VALID_LINK_TIMEOUT*100); i++) { - mdelay(1); - tg3_poll_link(tp); - } - if (!tp->carrier_ok){ - printf("Valid link not established\n"); - goto err_out_disable; - } - - dev->disable = tg3_disable; - nic->poll = tg3_poll; - nic->transmit = tg3_transmit; - nic->irq = tg3_irq; - - return 1; - - err_out_iounmap: - iounmap((void *)tp->regs); - return 0; - err_out_disable: - tg3_disable(dev); - return 0; -} - -static struct pci_id tg3_nics[] = { -PCI_ROM(0x14e4, 0x1644, "tg3-5700", "Broadcom Tigon 3 5700"), -PCI_ROM(0x14e4, 0x1645, "tg3-5701", "Broadcom Tigon 3 5701"), -PCI_ROM(0x14e4, 0x1646, "tg3-5702", "Broadcom Tigon 3 5702"), -PCI_ROM(0x14e4, 0x1647, "tg3-5703", "Broadcom Tigon 3 5703"), -PCI_ROM(0x14e4, 0x1648, "tg3-5704", "Broadcom Tigon 3 5704"), -PCI_ROM(0x14e4, 0x164d, "tg3-5702FE", "Broadcom Tigon 3 5702FE"), -PCI_ROM(0x14e4, 0x1653, "tg3-5705", "Broadcom Tigon 3 5705"), -PCI_ROM(0x14e4, 0x1654, "tg3-5705_2", "Broadcom Tigon 3 5705_2"), -PCI_ROM(0x14e4, 0x165d, "tg3-5705M", "Broadcom Tigon 3 5705M"), -PCI_ROM(0x14e4, 0x165e, "tg3-5705M_2", "Broadcom Tigon 3 5705M_2"), -PCI_ROM(0x14e4, 0x1696, "tg3-5782", "Broadcom Tigon 3 5782"), -PCI_ROM(0x14e4, 0x169c, "tg3-5788", "Broadcom Tigon 3 5788"), -PCI_ROM(0x14e4, 0x16a6, "tg3-5702X", "Broadcom Tigon 3 5702X"), -PCI_ROM(0x14e4, 0x16a7, "tg3-5703X", "Broadcom Tigon 3 5703X"), -PCI_ROM(0x14e4, 0x16a8, "tg3-5704S", "Broadcom Tigon 3 5704S"), -PCI_ROM(0x14e4, 0x16c6, "tg3-5702A3", "Broadcom Tigon 3 5702A3"), -PCI_ROM(0x14e4, 0x16c7, "tg3-5703A3", "Broadcom Tigon 3 5703A3"), -PCI_ROM(0x14e4, 0x170d, "tg3-5901", "Broadcom Tigon 3 5901"), -PCI_ROM(0x14e4, 0x170e, "tg3-5901_2", "Broadcom Tigon 3 5901_2"), -PCI_ROM(0x1148, 0x4400, "tg3-9DXX", "Syskonnect 9DXX"), -PCI_ROM(0x1148, 0x4500, "tg3-9MXX", "Syskonnect 9MXX"), -PCI_ROM(0x173b, 0x03e8, "tg3-ac1000", "Altima AC1000"), -PCI_ROM(0x173b, 0x03e9, "tg3-ac1001", "Altima AC1001"), -PCI_ROM(0x173b, 0x03ea, "tg3-ac9100", "Altima AC9100"), -PCI_ROM(0x173b, 0x03eb, "tg3-ac1003", "Altima AC1003"), -}; - -struct pci_driver tg3_driver = { - .type = NIC_DRIVER, - .name = "TG3", - .probe = tg3_probe, - .ids = tg3_nics, - .id_count = sizeof(tg3_nics)/sizeof(tg3_nics[0]), - .class = 0, -}; diff --git a/usr/src/grub/grub-0.95/netboot/tg3.h b/usr/src/grub/grub-0.95/netboot/tg3.h deleted file mode 100644 index a337a2aca8..0000000000 --- a/usr/src/grub/grub-0.95/netboot/tg3.h +++ /dev/null @@ -1,2203 +0,0 @@ -/* $Id: tg3.h,v 1.3 2003/02/25 06:02:58 ebiederm Exp $ - * tg3.h: Definitions for Broadcom Tigon3 ethernet driver. - * - * Copyright (C) 2001, 2002 David S. Miller (davem@redhat.com) - * Copyright (C) 2001 Jeff Garzik (jgarzik@mandrakesoft.com) - */ - -#ifndef _T3_H -#define _T3_H - -#include "stdint.h" - -typedef unsigned long dma_addr_t; - -/* From mii.h */ - -/* 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) - -/* 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. */ -#define SPEED_10 0 -#define SPEED_100 1 -#define SPEED_1000 2 -#define SPEED_INVALID 3 - - -/* Duplex, half or full. */ -#define DUPLEX_HALF 0x00 -#define DUPLEX_FULL 0x01 -#define DUPLEX_INVALID 0x02 - -/* Which connector port. */ -#define PORT_TP 0x00 -#define PORT_AUI 0x01 -#define PORT_MII 0x02 -#define PORT_FIBRE 0x03 -#define PORT_BNC 0x04 - -/* Which tranceiver 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 */ - -/* 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_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 0x007f /* Unused... */ -#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 0x07c0 /* Unused... */ -#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_10FULL 0x0040 /* Try for 10mbps full-duplex */ -#define ADVERTISE_100HALF 0x0080 /* Try for 100mbps half-duplex */ -#define ADVERTISE_100FULL 0x0100 /* Try for 100mbps full-duplex */ -#define ADVERTISE_100BASE4 0x0200 /* Try for 100mbps 4k packets */ -#define ADVERTISE_RESV 0x1c00 /* 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_10FULL 0x0040 /* Can do 10mbps full-duplex */ -#define LPA_100HALF 0x0080 /* Can do 100mbps half-duplex */ -#define LPA_100FULL 0x0100 /* Can do 100mbps full-duplex */ -#define LPA_100BASE4 0x0200 /* Can do 100mbps 4k packets */ -#define LPA_RESV 0x1c00 /* 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... */ - -/* N-way test register. */ -#define NWAYTEST_RESV1 0x00ff /* Unused... */ -#define NWAYTEST_LOOPBACK 0x0100 /* Enable loopback for N-way */ -#define NWAYTEST_RESV2 0xfe00 /* Unused... */ - - -/* From tg3.h */ - -#define TG3_64BIT_REG_HIGH 0x00UL -#define TG3_64BIT_REG_LOW 0x04UL - -/* Descriptor block info. */ -#define TG3_BDINFO_HOST_ADDR 0x0UL /* 64-bit */ -#define TG3_BDINFO_MAXLEN_FLAGS 0x8UL /* 32-bit */ -#define BDINFO_FLAGS_USE_EXT_RECV 0x00000001 /* ext rx_buffer_desc */ -#define BDINFO_FLAGS_DISABLED 0x00000002 -#define BDINFO_FLAGS_MAXLEN_MASK 0xffff0000 -#define BDINFO_FLAGS_MAXLEN_SHIFT 16 -#define TG3_BDINFO_NIC_ADDR 0xcUL /* 32-bit */ -#define TG3_BDINFO_SIZE 0x10UL - -#define RX_COPY_THRESHOLD 256 - -#define RX_STD_MAX_SIZE 1536 -#define RX_STD_MAX_SIZE_5705 512 -#define RX_JUMBO_MAX_SIZE 0xdeadbeef /* XXX */ - -/* First 256 bytes are a mirror of PCI config space. */ -#define TG3PCI_VENDOR 0x00000000 -#define TG3PCI_VENDOR_BROADCOM 0x14e4 -#define TG3PCI_DEVICE 0x00000002 -#define TG3PCI_DEVICE_TIGON3_1 0x1644 /* BCM5700 */ -#define TG3PCI_DEVICE_TIGON3_2 0x1645 /* BCM5701 */ -#define TG3PCI_DEVICE_TIGON3_3 0x1646 /* BCM5702 */ -#define TG3PCI_DEVICE_TIGON3_4 0x1647 /* BCM5703 */ -#define TG3PCI_COMMAND 0x00000004 -#define TG3PCI_STATUS 0x00000006 -#define TG3PCI_CCREVID 0x00000008 -#define TG3PCI_CACHELINESZ 0x0000000c -#define TG3PCI_LATTIMER 0x0000000d -#define TG3PCI_HEADERTYPE 0x0000000e -#define TG3PCI_BIST 0x0000000f -#define TG3PCI_BASE0_LOW 0x00000010 -#define TG3PCI_BASE0_HIGH 0x00000014 -/* 0x18 --> 0x2c unused */ -#define TG3PCI_SUBSYSVENID 0x0000002c -#define TG3PCI_SUBSYSID 0x0000002e -#define TG3PCI_ROMADDR 0x00000030 -#define TG3PCI_CAPLIST 0x00000034 -/* 0x35 --> 0x3c unused */ -#define TG3PCI_IRQ_LINE 0x0000003c -#define TG3PCI_IRQ_PIN 0x0000003d -#define TG3PCI_MIN_GNT 0x0000003e -#define TG3PCI_MAX_LAT 0x0000003f -#define TG3PCI_X_CAPS 0x00000040 -#define PCIX_CAPS_RELAXED_ORDERING 0x00020000 -#define PCIX_CAPS_SPLIT_MASK 0x00700000 -#define PCIX_CAPS_SPLIT_SHIFT 20 -#define PCIX_CAPS_BURST_MASK 0x000c0000 -#define PCIX_CAPS_BURST_SHIFT 18 -#define PCIX_CAPS_MAX_BURST_CPIOB 2 -#define TG3PCI_PM_CAP_PTR 0x00000041 -#define TG3PCI_X_COMMAND 0x00000042 -#define TG3PCI_X_STATUS 0x00000044 -#define TG3PCI_PM_CAP_ID 0x00000048 -#define TG3PCI_VPD_CAP_PTR 0x00000049 -#define TG3PCI_PM_CAPS 0x0000004a -#define TG3PCI_PM_CTRL_STAT 0x0000004c -#define TG3PCI_BR_SUPP_EXT 0x0000004e -#define TG3PCI_PM_DATA 0x0000004f -#define TG3PCI_VPD_CAP_ID 0x00000050 -#define TG3PCI_MSI_CAP_PTR 0x00000051 -#define TG3PCI_VPD_ADDR_FLAG 0x00000052 -#define VPD_ADDR_FLAG_WRITE 0x00008000 -#define TG3PCI_VPD_DATA 0x00000054 -#define TG3PCI_MSI_CAP_ID 0x00000058 -#define TG3PCI_NXT_CAP_PTR 0x00000059 -#define TG3PCI_MSI_CTRL 0x0000005a -#define TG3PCI_MSI_ADDR_LOW 0x0000005c -#define TG3PCI_MSI_ADDR_HIGH 0x00000060 -#define TG3PCI_MSI_DATA 0x00000064 -/* 0x66 --> 0x68 unused */ -#define TG3PCI_MISC_HOST_CTRL 0x00000068 -#define MISC_HOST_CTRL_CLEAR_INT 0x00000001 -#define MISC_HOST_CTRL_MASK_PCI_INT 0x00000002 -#define MISC_HOST_CTRL_BYTE_SWAP 0x00000004 -#define MISC_HOST_CTRL_WORD_SWAP 0x00000008 -#define MISC_HOST_CTRL_PCISTATE_RW 0x00000010 -#define MISC_HOST_CTRL_CLKREG_RW 0x00000020 -#define MISC_HOST_CTRL_REGWORD_SWAP 0x00000040 -#define MISC_HOST_CTRL_INDIR_ACCESS 0x00000080 -#define MISC_HOST_CTRL_IRQ_MASK_MODE 0x00000100 -#define MISC_HOST_CTRL_TAGGED_STATUS 0x00000200 -#define MISC_HOST_CTRL_CHIPREV 0xffff0000 -#define MISC_HOST_CTRL_CHIPREV_SHIFT 16 -#define GET_CHIP_REV_ID(MISC_HOST_CTRL) \ - (((MISC_HOST_CTRL) & MISC_HOST_CTRL_CHIPREV) >> \ - MISC_HOST_CTRL_CHIPREV_SHIFT) -#define CHIPREV_ID_5700_A0 0x7000 -#define CHIPREV_ID_5700_A1 0x7001 -#define CHIPREV_ID_5700_B0 0x7100 -#define CHIPREV_ID_5700_B1 0x7101 -#define CHIPREV_ID_5700_B3 0x7102 -#define CHIPREV_ID_5700_ALTIMA 0x7104 -#define CHIPREV_ID_5700_C0 0x7200 -#define CHIPREV_ID_5701_A0 0x0000 -#define CHIPREV_ID_5701_B0 0x0100 -#define CHIPREV_ID_5701_B2 0x0102 -#define CHIPREV_ID_5701_B5 0x0105 -#define CHIPREV_ID_5703_A0 0x1000 -#define CHIPREV_ID_5703_A1 0x1001 -#define CHIPREV_ID_5703_A2 0x1002 -#define CHIPREV_ID_5703_A3 0x1003 -#define CHIPREV_ID_5704_A0 0x2000 -#define CHIPREV_ID_5704_A1 0x2001 -#define CHIPREV_ID_5704_A2 0x2002 -#define CHIPREV_ID_5705_A0 0x3000 -#define CHIPREV_ID_5705_A1 0x3001 -#define CHIPREV_ID_5705_A2 0x3002 -#define CHIPREV_ID_5705_A3 0x3003 -#define GET_ASIC_REV(CHIP_REV_ID) ((CHIP_REV_ID) >> 12) -#define ASIC_REV_5700 0x07 -#define ASIC_REV_5701 0x00 -#define ASIC_REV_5703 0x01 -#define ASIC_REV_5704 0x02 -#define ASIC_REV_5705 0x03 -#define GET_CHIP_REV(CHIP_REV_ID) ((CHIP_REV_ID) >> 8) -#define CHIPREV_5700_AX 0x70 -#define CHIPREV_5700_BX 0x71 -#define CHIPREV_5700_CX 0x72 -#define CHIPREV_5701_AX 0x00 -#define GET_METAL_REV(CHIP_REV_ID) ((CHIP_REV_ID) & 0xff) -#define METAL_REV_A0 0x00 -#define METAL_REV_A1 0x01 -#define METAL_REV_B0 0x00 -#define METAL_REV_B1 0x01 -#define METAL_REV_B2 0x02 -#define TG3PCI_DMA_RW_CTRL 0x0000006c -#define DMA_RWCTRL_MIN_DMA 0x000000ff -#define DMA_RWCTRL_MIN_DMA_SHIFT 0 -#define DMA_RWCTRL_READ_BNDRY_MASK 0x00000700 -#define DMA_RWCTRL_READ_BNDRY_DISAB 0x00000000 -#define DMA_RWCTRL_READ_BNDRY_16 0x00000100 -#define DMA_RWCTRL_READ_BNDRY_32 0x00000200 -#define DMA_RWCTRL_READ_BNDRY_64 0x00000300 -#define DMA_RWCTRL_READ_BNDRY_128 0x00000400 -#define DMA_RWCTRL_READ_BNDRY_256 0x00000500 -#define DMA_RWCTRL_READ_BNDRY_512 0x00000600 -#define DMA_RWCTRL_READ_BNDRY_1024 0x00000700 -#define DMA_RWCTRL_WRITE_BNDRY_MASK 0x00003800 -#define DMA_RWCTRL_WRITE_BNDRY_DISAB 0x00000000 -#define DMA_RWCTRL_WRITE_BNDRY_16 0x00000800 -#define DMA_RWCTRL_WRITE_BNDRY_32 0x00001000 -#define DMA_RWCTRL_WRITE_BNDRY_64 0x00001800 -#define DMA_RWCTRL_WRITE_BNDRY_128 0x00002000 -#define DMA_RWCTRL_WRITE_BNDRY_256 0x00002800 -#define DMA_RWCTRL_WRITE_BNDRY_512 0x00003000 -#define DMA_RWCTRL_WRITE_BNDRY_1024 0x00003800 -#define DMA_RWCTRL_ONE_DMA 0x00004000 -#define DMA_RWCTRL_READ_WATER 0x00070000 -#define DMA_RWCTRL_READ_WATER_SHIFT 16 -#define DMA_RWCTRL_WRITE_WATER 0x00380000 -#define DMA_RWCTRL_WRITE_WATER_SHIFT 19 -#define DMA_RWCTRL_USE_MEM_READ_MULT 0x00400000 -#define DMA_RWCTRL_ASSERT_ALL_BE 0x00800000 -#define DMA_RWCTRL_PCI_READ_CMD 0x0f000000 -#define DMA_RWCTRL_PCI_READ_CMD_SHIFT 24 -#define DMA_RWCTRL_PCI_WRITE_CMD 0xf0000000 -#define DMA_RWCTRL_PCI_WRITE_CMD_SHIFT 28 -#define TG3PCI_PCISTATE 0x00000070 -#define PCISTATE_FORCE_RESET 0x00000001 -#define PCISTATE_INT_NOT_ACTIVE 0x00000002 -#define PCISTATE_CONV_PCI_MODE 0x00000004 -#define PCISTATE_BUS_SPEED_HIGH 0x00000008 -#define PCISTATE_BUS_32BIT 0x00000010 -#define PCISTATE_ROM_ENABLE 0x00000020 -#define PCISTATE_ROM_RETRY_ENABLE 0x00000040 -#define PCISTATE_FLAT_VIEW 0x00000100 -#define PCISTATE_RETRY_SAME_DMA 0x00002000 -#define TG3PCI_CLOCK_CTRL 0x00000074 -#define CLOCK_CTRL_CORECLK_DISABLE 0x00000200 -#define CLOCK_CTRL_RXCLK_DISABLE 0x00000400 -#define CLOCK_CTRL_TXCLK_DISABLE 0x00000800 -#define CLOCK_CTRL_ALTCLK 0x00001000 -#define CLOCK_CTRL_PWRDOWN_PLL133 0x00008000 -#define CLOCK_CTRL_44MHZ_CORE 0x00040000 -#define CLOCK_CTRL_625_CORE 0x00100000 -#define CLOCK_CTRL_FORCE_CLKRUN 0x00200000 -#define CLOCK_CTRL_CLKRUN_OENABLE 0x00400000 -#define CLOCK_CTRL_DELAY_PCI_GRANT 0x80000000 -#define TG3PCI_REG_BASE_ADDR 0x00000078 -#define TG3PCI_MEM_WIN_BASE_ADDR 0x0000007c -#define TG3PCI_REG_DATA 0x00000080 -#define TG3PCI_MEM_WIN_DATA 0x00000084 -#define TG3PCI_MODE_CTRL 0x00000088 -#define TG3PCI_MISC_CFG 0x0000008c -#define TG3PCI_MISC_LOCAL_CTRL 0x00000090 -/* 0x94 --> 0x98 unused */ -#define TG3PCI_STD_RING_PROD_IDX 0x00000098 /* 64-bit */ -#define TG3PCI_RCV_RET_RING_CON_IDX 0x000000a0 /* 64-bit */ -#define TG3PCI_SND_PROD_IDX 0x000000a8 /* 64-bit */ -/* 0xb0 --> 0x100 unused */ - -/* 0x100 --> 0x200 unused */ - -/* Mailbox registers */ -#define MAILBOX_INTERRUPT_0 0x00000200 /* 64-bit */ -#define MAILBOX_INTERRUPT_1 0x00000208 /* 64-bit */ -#define MAILBOX_INTERRUPT_2 0x00000210 /* 64-bit */ -#define MAILBOX_INTERRUPT_3 0x00000218 /* 64-bit */ -#define MAILBOX_GENERAL_0 0x00000220 /* 64-bit */ -#define MAILBOX_GENERAL_1 0x00000228 /* 64-bit */ -#define MAILBOX_GENERAL_2 0x00000230 /* 64-bit */ -#define MAILBOX_GENERAL_3 0x00000238 /* 64-bit */ -#define MAILBOX_GENERAL_4 0x00000240 /* 64-bit */ -#define MAILBOX_GENERAL_5 0x00000248 /* 64-bit */ -#define MAILBOX_GENERAL_6 0x00000250 /* 64-bit */ -#define MAILBOX_GENERAL_7 0x00000258 /* 64-bit */ -#define MAILBOX_RELOAD_STAT 0x00000260 /* 64-bit */ -#define MAILBOX_RCV_STD_PROD_IDX 0x00000268 /* 64-bit */ -#define MAILBOX_RCV_JUMBO_PROD_IDX 0x00000270 /* 64-bit */ -#define MAILBOX_RCV_MINI_PROD_IDX 0x00000278 /* 64-bit */ -#define MAILBOX_RCVRET_CON_IDX_0 0x00000280 /* 64-bit */ -#define MAILBOX_RCVRET_CON_IDX_1 0x00000288 /* 64-bit */ -#define MAILBOX_RCVRET_CON_IDX_2 0x00000290 /* 64-bit */ -#define MAILBOX_RCVRET_CON_IDX_3 0x00000298 /* 64-bit */ -#define MAILBOX_RCVRET_CON_IDX_4 0x000002a0 /* 64-bit */ -#define MAILBOX_RCVRET_CON_IDX_5 0x000002a8 /* 64-bit */ -#define MAILBOX_RCVRET_CON_IDX_6 0x000002b0 /* 64-bit */ -#define MAILBOX_RCVRET_CON_IDX_7 0x000002b8 /* 64-bit */ -#define MAILBOX_RCVRET_CON_IDX_8 0x000002c0 /* 64-bit */ -#define MAILBOX_RCVRET_CON_IDX_9 0x000002c8 /* 64-bit */ -#define MAILBOX_RCVRET_CON_IDX_10 0x000002d0 /* 64-bit */ -#define MAILBOX_RCVRET_CON_IDX_11 0x000002d8 /* 64-bit */ -#define MAILBOX_RCVRET_CON_IDX_12 0x000002e0 /* 64-bit */ -#define MAILBOX_RCVRET_CON_IDX_13 0x000002e8 /* 64-bit */ -#define MAILBOX_RCVRET_CON_IDX_14 0x000002f0 /* 64-bit */ -#define MAILBOX_RCVRET_CON_IDX_15 0x000002f8 /* 64-bit */ -#define MAILBOX_SNDHOST_PROD_IDX_0 0x00000300 /* 64-bit */ -#define MAILBOX_SNDHOST_PROD_IDX_1 0x00000308 /* 64-bit */ -#define MAILBOX_SNDHOST_PROD_IDX_2 0x00000310 /* 64-bit */ -#define MAILBOX_SNDHOST_PROD_IDX_3 0x00000318 /* 64-bit */ -#define MAILBOX_SNDHOST_PROD_IDX_4 0x00000320 /* 64-bit */ -#define MAILBOX_SNDHOST_PROD_IDX_5 0x00000328 /* 64-bit */ -#define MAILBOX_SNDHOST_PROD_IDX_6 0x00000330 /* 64-bit */ -#define MAILBOX_SNDHOST_PROD_IDX_7 0x00000338 /* 64-bit */ -#define MAILBOX_SNDHOST_PROD_IDX_8 0x00000340 /* 64-bit */ -#define MAILBOX_SNDHOST_PROD_IDX_9 0x00000348 /* 64-bit */ -#define MAILBOX_SNDHOST_PROD_IDX_10 0x00000350 /* 64-bit */ -#define MAILBOX_SNDHOST_PROD_IDX_11 0x00000358 /* 64-bit */ -#define MAILBOX_SNDHOST_PROD_IDX_12 0x00000360 /* 64-bit */ -#define MAILBOX_SNDHOST_PROD_IDX_13 0x00000368 /* 64-bit */ -#define MAILBOX_SNDHOST_PROD_IDX_14 0x00000370 /* 64-bit */ -#define MAILBOX_SNDHOST_PROD_IDX_15 0x00000378 /* 64-bit */ -#define MAILBOX_SNDNIC_PROD_IDX_0 0x00000380 /* 64-bit */ -#define MAILBOX_SNDNIC_PROD_IDX_1 0x00000388 /* 64-bit */ -#define MAILBOX_SNDNIC_PROD_IDX_2 0x00000390 /* 64-bit */ -#define MAILBOX_SNDNIC_PROD_IDX_3 0x00000398 /* 64-bit */ -#define MAILBOX_SNDNIC_PROD_IDX_4 0x000003a0 /* 64-bit */ -#define MAILBOX_SNDNIC_PROD_IDX_5 0x000003a8 /* 64-bit */ -#define MAILBOX_SNDNIC_PROD_IDX_6 0x000003b0 /* 64-bit */ -#define MAILBOX_SNDNIC_PROD_IDX_7 0x000003b8 /* 64-bit */ -#define MAILBOX_SNDNIC_PROD_IDX_8 0x000003c0 /* 64-bit */ -#define MAILBOX_SNDNIC_PROD_IDX_9 0x000003c8 /* 64-bit */ -#define MAILBOX_SNDNIC_PROD_IDX_10 0x000003d0 /* 64-bit */ -#define MAILBOX_SNDNIC_PROD_IDX_11 0x000003d8 /* 64-bit */ -#define MAILBOX_SNDNIC_PROD_IDX_12 0x000003e0 /* 64-bit */ -#define MAILBOX_SNDNIC_PROD_IDX_13 0x000003e8 /* 64-bit */ -#define MAILBOX_SNDNIC_PROD_IDX_14 0x000003f0 /* 64-bit */ -#define MAILBOX_SNDNIC_PROD_IDX_15 0x000003f8 /* 64-bit */ - -/* MAC control registers */ -#define MAC_MODE 0x00000400 -#define MAC_MODE_RESET 0x00000001 -#define MAC_MODE_HALF_DUPLEX 0x00000002 -#define MAC_MODE_PORT_MODE_MASK 0x0000000c -#define MAC_MODE_PORT_MODE_TBI 0x0000000c -#define MAC_MODE_PORT_MODE_GMII 0x00000008 -#define MAC_MODE_PORT_MODE_MII 0x00000004 -#define MAC_MODE_PORT_MODE_NONE 0x00000000 -#define MAC_MODE_PORT_INT_LPBACK 0x00000010 -#define MAC_MODE_TAGGED_MAC_CTRL 0x00000080 -#define MAC_MODE_TX_BURSTING 0x00000100 -#define MAC_MODE_MAX_DEFER 0x00000200 -#define MAC_MODE_LINK_POLARITY 0x00000400 -#define MAC_MODE_RXSTAT_ENABLE 0x00000800 -#define MAC_MODE_RXSTAT_CLEAR 0x00001000 -#define MAC_MODE_RXSTAT_FLUSH 0x00002000 -#define MAC_MODE_TXSTAT_ENABLE 0x00004000 -#define MAC_MODE_TXSTAT_CLEAR 0x00008000 -#define MAC_MODE_TXSTAT_FLUSH 0x00010000 -#define MAC_MODE_SEND_CONFIGS 0x00020000 -#define MAC_MODE_MAGIC_PKT_ENABLE 0x00040000 -#define MAC_MODE_ACPI_ENABLE 0x00080000 -#define MAC_MODE_MIP_ENABLE 0x00100000 -#define MAC_MODE_TDE_ENABLE 0x00200000 -#define MAC_MODE_RDE_ENABLE 0x00400000 -#define MAC_MODE_FHDE_ENABLE 0x00800000 -#define MAC_STATUS 0x00000404 -#define MAC_STATUS_PCS_SYNCED 0x00000001 -#define MAC_STATUS_SIGNAL_DET 0x00000002 -#define MAC_STATUS_RCVD_CFG 0x00000004 -#define MAC_STATUS_CFG_CHANGED 0x00000008 -#define MAC_STATUS_SYNC_CHANGED 0x00000010 -#define MAC_STATUS_PORT_DEC_ERR 0x00000400 -#define MAC_STATUS_LNKSTATE_CHANGED 0x00001000 -#define MAC_STATUS_MI_COMPLETION 0x00400000 -#define MAC_STATUS_MI_INTERRUPT 0x00800000 -#define MAC_STATUS_AP_ERROR 0x01000000 -#define MAC_STATUS_ODI_ERROR 0x02000000 -#define MAC_STATUS_RXSTAT_OVERRUN 0x04000000 -#define MAC_STATUS_TXSTAT_OVERRUN 0x08000000 -#define MAC_EVENT 0x00000408 -#define MAC_EVENT_PORT_DECODE_ERR 0x00000400 -#define MAC_EVENT_LNKSTATE_CHANGED 0x00001000 -#define MAC_EVENT_MI_COMPLETION 0x00400000 -#define MAC_EVENT_MI_INTERRUPT 0x00800000 -#define MAC_EVENT_AP_ERROR 0x01000000 -#define MAC_EVENT_ODI_ERROR 0x02000000 -#define MAC_EVENT_RXSTAT_OVERRUN 0x04000000 -#define MAC_EVENT_TXSTAT_OVERRUN 0x08000000 -#define MAC_LED_CTRL 0x0000040c -#define LED_CTRL_LNKLED_OVERRIDE 0x00000001 -#define LED_CTRL_1000MBPS_ON 0x00000002 -#define LED_CTRL_100MBPS_ON 0x00000004 -#define LED_CTRL_10MBPS_ON 0x00000008 -#define LED_CTRL_TRAFFIC_OVERRIDE 0x00000010 -#define LED_CTRL_TRAFFIC_BLINK 0x00000020 -#define LED_CTRL_TRAFFIC_LED 0x00000040 -#define LED_CTRL_1000MBPS_STATUS 0x00000080 -#define LED_CTRL_100MBPS_STATUS 0x00000100 -#define LED_CTRL_10MBPS_STATUS 0x00000200 -#define LED_CTRL_TRAFFIC_STATUS 0x00000400 -#define LED_CTRL_MAC_MODE 0x00000000 -#define LED_CTRL_PHY_MODE_1 0x00000800 -#define LED_CTRL_PHY_MODE_2 0x00001000 -#define LED_CTRL_BLINK_RATE_MASK 0x7ff80000 -#define LED_CTRL_BLINK_RATE_SHIFT 19 -#define LED_CTRL_BLINK_PER_OVERRIDE 0x00080000 -#define LED_CTRL_BLINK_RATE_OVERRIDE 0x80000000 -#define MAC_ADDR_0_HIGH 0x00000410 /* upper 2 bytes */ -#define MAC_ADDR_0_LOW 0x00000414 /* lower 4 bytes */ -#define MAC_ADDR_1_HIGH 0x00000418 /* upper 2 bytes */ -#define MAC_ADDR_1_LOW 0x0000041c /* lower 4 bytes */ -#define MAC_ADDR_2_HIGH 0x00000420 /* upper 2 bytes */ -#define MAC_ADDR_2_LOW 0x00000424 /* lower 4 bytes */ -#define MAC_ADDR_3_HIGH 0x00000428 /* upper 2 bytes */ -#define MAC_ADDR_3_LOW 0x0000042c /* lower 4 bytes */ -#define MAC_ACPI_MBUF_PTR 0x00000430 -#define MAC_ACPI_LEN_OFFSET 0x00000434 -#define ACPI_LENOFF_LEN_MASK 0x0000ffff -#define ACPI_LENOFF_LEN_SHIFT 0 -#define ACPI_LENOFF_OFF_MASK 0x0fff0000 -#define ACPI_LENOFF_OFF_SHIFT 16 -#define MAC_TX_BACKOFF_SEED 0x00000438 -#define TX_BACKOFF_SEED_MASK 0x000003ff -#define MAC_RX_MTU_SIZE 0x0000043c -#define RX_MTU_SIZE_MASK 0x0000ffff -#define MAC_PCS_TEST 0x00000440 -#define PCS_TEST_PATTERN_MASK 0x000fffff -#define PCS_TEST_PATTERN_SHIFT 0 -#define PCS_TEST_ENABLE 0x00100000 -#define MAC_TX_AUTO_NEG 0x00000444 -#define TX_AUTO_NEG_MASK 0x0000ffff -#define TX_AUTO_NEG_SHIFT 0 -#define MAC_RX_AUTO_NEG 0x00000448 -#define RX_AUTO_NEG_MASK 0x0000ffff -#define RX_AUTO_NEG_SHIFT 0 -#define MAC_MI_COM 0x0000044c -#define MI_COM_CMD_MASK 0x0c000000 -#define MI_COM_CMD_WRITE 0x04000000 -#define MI_COM_CMD_READ 0x08000000 -#define MI_COM_READ_FAILED 0x10000000 -#define MI_COM_START 0x20000000 -#define MI_COM_BUSY 0x20000000 -#define MI_COM_PHY_ADDR_MASK 0x03e00000 -#define MI_COM_PHY_ADDR_SHIFT 21 -#define MI_COM_REG_ADDR_MASK 0x001f0000 -#define MI_COM_REG_ADDR_SHIFT 16 -#define MI_COM_DATA_MASK 0x0000ffff -#define MAC_MI_STAT 0x00000450 -#define MAC_MI_STAT_LNKSTAT_ATTN_ENAB 0x00000001 -#define MAC_MI_MODE 0x00000454 -#define MAC_MI_MODE_CLK_10MHZ 0x00000001 -#define MAC_MI_MODE_SHORT_PREAMBLE 0x00000002 -#define MAC_MI_MODE_AUTO_POLL 0x00000010 -#define MAC_MI_MODE_CORE_CLK_62MHZ 0x00008000 -#define MAC_MI_MODE_BASE 0x000c0000 /* XXX magic values XXX */ -#define MAC_AUTO_POLL_STATUS 0x00000458 -#define MAC_AUTO_POLL_ERROR 0x00000001 -#define MAC_TX_MODE 0x0000045c -#define TX_MODE_RESET 0x00000001 -#define TX_MODE_ENABLE 0x00000002 -#define TX_MODE_FLOW_CTRL_ENABLE 0x00000010 -#define TX_MODE_BIG_BCKOFF_ENABLE 0x00000020 -#define TX_MODE_LONG_PAUSE_ENABLE 0x00000040 -#define MAC_TX_STATUS 0x00000460 -#define TX_STATUS_XOFFED 0x00000001 -#define TX_STATUS_SENT_XOFF 0x00000002 -#define TX_STATUS_SENT_XON 0x00000004 -#define TX_STATUS_LINK_UP 0x00000008 -#define TX_STATUS_ODI_UNDERRUN 0x00000010 -#define TX_STATUS_ODI_OVERRUN 0x00000020 -#define MAC_TX_LENGTHS 0x00000464 -#define TX_LENGTHS_SLOT_TIME_MASK 0x000000ff -#define TX_LENGTHS_SLOT_TIME_SHIFT 0 -#define TX_LENGTHS_IPG_MASK 0x00000f00 -#define TX_LENGTHS_IPG_SHIFT 8 -#define TX_LENGTHS_IPG_CRS_MASK 0x00003000 -#define TX_LENGTHS_IPG_CRS_SHIFT 12 -#define MAC_RX_MODE 0x00000468 -#define RX_MODE_RESET 0x00000001 -#define RX_MODE_ENABLE 0x00000002 -#define RX_MODE_FLOW_CTRL_ENABLE 0x00000004 -#define RX_MODE_KEEP_MAC_CTRL 0x00000008 -#define RX_MODE_KEEP_PAUSE 0x00000010 -#define RX_MODE_ACCEPT_OVERSIZED 0x00000020 -#define RX_MODE_ACCEPT_RUNTS 0x00000040 -#define RX_MODE_LEN_CHECK 0x00000080 -#define RX_MODE_PROMISC 0x00000100 -#define RX_MODE_NO_CRC_CHECK 0x00000200 -#define RX_MODE_KEEP_VLAN_TAG 0x00000400 -#define MAC_RX_STATUS 0x0000046c -#define RX_STATUS_REMOTE_TX_XOFFED 0x00000001 -#define RX_STATUS_XOFF_RCVD 0x00000002 -#define RX_STATUS_XON_RCVD 0x00000004 -#define MAC_HASH_REG_0 0x00000470 -#define MAC_HASH_REG_1 0x00000474 -#define MAC_HASH_REG_2 0x00000478 -#define MAC_HASH_REG_3 0x0000047c -#define MAC_RCV_RULE_0 0x00000480 -#define MAC_RCV_VALUE_0 0x00000484 -#define MAC_RCV_RULE_1 0x00000488 -#define MAC_RCV_VALUE_1 0x0000048c -#define MAC_RCV_RULE_2 0x00000490 -#define MAC_RCV_VALUE_2 0x00000494 -#define MAC_RCV_RULE_3 0x00000498 -#define MAC_RCV_VALUE_3 0x0000049c -#define MAC_RCV_RULE_4 0x000004a0 -#define MAC_RCV_VALUE_4 0x000004a4 -#define MAC_RCV_RULE_5 0x000004a8 -#define MAC_RCV_VALUE_5 0x000004ac -#define MAC_RCV_RULE_6 0x000004b0 -#define MAC_RCV_VALUE_6 0x000004b4 -#define MAC_RCV_RULE_7 0x000004b8 -#define MAC_RCV_VALUE_7 0x000004bc -#define MAC_RCV_RULE_8 0x000004c0 -#define MAC_RCV_VALUE_8 0x000004c4 -#define MAC_RCV_RULE_9 0x000004c8 -#define MAC_RCV_VALUE_9 0x000004cc -#define MAC_RCV_RULE_10 0x000004d0 -#define MAC_RCV_VALUE_10 0x000004d4 -#define MAC_RCV_RULE_11 0x000004d8 -#define MAC_RCV_VALUE_11 0x000004dc -#define MAC_RCV_RULE_12 0x000004e0 -#define MAC_RCV_VALUE_12 0x000004e4 -#define MAC_RCV_RULE_13 0x000004e8 -#define MAC_RCV_VALUE_13 0x000004ec -#define MAC_RCV_RULE_14 0x000004f0 -#define MAC_RCV_VALUE_14 0x000004f4 -#define MAC_RCV_RULE_15 0x000004f8 -#define MAC_RCV_VALUE_15 0x000004fc -#define RCV_RULE_DISABLE_MASK 0x7fffffff -#define MAC_RCV_RULE_CFG 0x00000500 -#define RCV_RULE_CFG_DEFAULT_CLASS 0x00000008 -#define MAC_LOW_WMARK_MAX_RX_FRAME 0x00000504 -/* 0x508 --> 0x520 unused */ -#define MAC_HASHREGU_0 0x00000520 -#define MAC_HASHREGU_1 0x00000524 -#define MAC_HASHREGU_2 0x00000528 -#define MAC_HASHREGU_3 0x0000052c -#define MAC_EXTADDR_0_HIGH 0x00000530 -#define MAC_EXTADDR_0_LOW 0x00000534 -#define MAC_EXTADDR_1_HIGH 0x00000538 -#define MAC_EXTADDR_1_LOW 0x0000053c -#define MAC_EXTADDR_2_HIGH 0x00000540 -#define MAC_EXTADDR_2_LOW 0x00000544 -#define MAC_EXTADDR_3_HIGH 0x00000548 -#define MAC_EXTADDR_3_LOW 0x0000054c -#define MAC_EXTADDR_4_HIGH 0x00000550 -#define MAC_EXTADDR_4_LOW 0x00000554 -#define MAC_EXTADDR_5_HIGH 0x00000558 -#define MAC_EXTADDR_5_LOW 0x0000055c -#define MAC_EXTADDR_6_HIGH 0x00000560 -#define MAC_EXTADDR_6_LOW 0x00000564 -#define MAC_EXTADDR_7_HIGH 0x00000568 -#define MAC_EXTADDR_7_LOW 0x0000056c -#define MAC_EXTADDR_8_HIGH 0x00000570 -#define MAC_EXTADDR_8_LOW 0x00000574 -#define MAC_EXTADDR_9_HIGH 0x00000578 -#define MAC_EXTADDR_9_LOW 0x0000057c -#define MAC_EXTADDR_10_HIGH 0x00000580 -#define MAC_EXTADDR_10_LOW 0x00000584 -#define MAC_EXTADDR_11_HIGH 0x00000588 -#define MAC_EXTADDR_11_LOW 0x0000058c -#define MAC_SERDES_CFG 0x00000590 -#define MAC_SERDES_STAT 0x00000594 -/* 0x598 --> 0x600 unused */ -#define MAC_TX_MAC_STATE_BASE 0x00000600 /* 16 bytes */ -#define MAC_RX_MAC_STATE_BASE 0x00000610 /* 20 bytes */ -/* 0x624 --> 0x800 unused */ -#define MAC_TX_STATS_OCTETS 0x00000800 -#define MAC_TX_STATS_RESV1 0x00000804 -#define MAC_TX_STATS_COLLISIONS 0x00000808 -#define MAC_TX_STATS_XON_SENT 0x0000080c -#define MAC_TX_STATS_XOFF_SENT 0x00000810 -#define MAC_TX_STATS_RESV2 0x00000814 -#define MAC_TX_STATS_MAC_ERRORS 0x00000818 -#define MAC_TX_STATS_SINGLE_COLLISIONS 0x0000081c -#define MAC_TX_STATS_MULT_COLLISIONS 0x00000820 -#define MAC_TX_STATS_DEFERRED 0x00000824 -#define MAC_TX_STATS_RESV3 0x00000828 -#define MAC_TX_STATS_EXCESSIVE_COL 0x0000082c -#define MAC_TX_STATS_LATE_COL 0x00000830 -#define MAC_TX_STATS_RESV4_1 0x00000834 -#define MAC_TX_STATS_RESV4_2 0x00000838 -#define MAC_TX_STATS_RESV4_3 0x0000083c -#define MAC_TX_STATS_RESV4_4 0x00000840 -#define MAC_TX_STATS_RESV4_5 0x00000844 -#define MAC_TX_STATS_RESV4_6 0x00000848 -#define MAC_TX_STATS_RESV4_7 0x0000084c -#define MAC_TX_STATS_RESV4_8 0x00000850 -#define MAC_TX_STATS_RESV4_9 0x00000854 -#define MAC_TX_STATS_RESV4_10 0x00000858 -#define MAC_TX_STATS_RESV4_11 0x0000085c -#define MAC_TX_STATS_RESV4_12 0x00000860 -#define MAC_TX_STATS_RESV4_13 0x00000864 -#define MAC_TX_STATS_RESV4_14 0x00000868 -#define MAC_TX_STATS_UCAST 0x0000086c -#define MAC_TX_STATS_MCAST 0x00000870 -#define MAC_TX_STATS_BCAST 0x00000874 -#define MAC_TX_STATS_RESV5_1 0x00000878 -#define MAC_TX_STATS_RESV5_2 0x0000087c -#define MAC_RX_STATS_OCTETS 0x00000880 -#define MAC_RX_STATS_RESV1 0x00000884 -#define MAC_RX_STATS_FRAGMENTS 0x00000888 -#define MAC_RX_STATS_UCAST 0x0000088c -#define MAC_RX_STATS_MCAST 0x00000890 -#define MAC_RX_STATS_BCAST 0x00000894 -#define MAC_RX_STATS_FCS_ERRORS 0x00000898 -#define MAC_RX_STATS_ALIGN_ERRORS 0x0000089c -#define MAC_RX_STATS_XON_PAUSE_RECVD 0x000008a0 -#define MAC_RX_STATS_XOFF_PAUSE_RECVD 0x000008a4 -#define MAC_RX_STATS_MAC_CTRL_RECVD 0x000008a8 -#define MAC_RX_STATS_XOFF_ENTERED 0x000008ac -#define MAC_RX_STATS_FRAME_TOO_LONG 0x000008b0 -#define MAC_RX_STATS_JABBERS 0x000008b4 -#define MAC_RX_STATS_UNDERSIZE 0x000008b8 -/* 0x8bc --> 0xc00 unused */ - -/* Send data initiator control registers */ -#define SNDDATAI_MODE 0x00000c00 -#define SNDDATAI_MODE_RESET 0x00000001 -#define SNDDATAI_MODE_ENABLE 0x00000002 -#define SNDDATAI_MODE_STAT_OFLOW_ENAB 0x00000004 -#define SNDDATAI_STATUS 0x00000c04 -#define SNDDATAI_STATUS_STAT_OFLOW 0x00000004 -#define SNDDATAI_STATSCTRL 0x00000c08 -#define SNDDATAI_SCTRL_ENABLE 0x00000001 -#define SNDDATAI_SCTRL_FASTUPD 0x00000002 -#define SNDDATAI_SCTRL_CLEAR 0x00000004 -#define SNDDATAI_SCTRL_FLUSH 0x00000008 -#define SNDDATAI_SCTRL_FORCE_ZERO 0x00000010 -#define SNDDATAI_STATSENAB 0x00000c0c -#define SNDDATAI_STATSINCMASK 0x00000c10 -/* 0xc14 --> 0xc80 unused */ -#define SNDDATAI_COS_CNT_0 0x00000c80 -#define SNDDATAI_COS_CNT_1 0x00000c84 -#define SNDDATAI_COS_CNT_2 0x00000c88 -#define SNDDATAI_COS_CNT_3 0x00000c8c -#define SNDDATAI_COS_CNT_4 0x00000c90 -#define SNDDATAI_COS_CNT_5 0x00000c94 -#define SNDDATAI_COS_CNT_6 0x00000c98 -#define SNDDATAI_COS_CNT_7 0x00000c9c -#define SNDDATAI_COS_CNT_8 0x00000ca0 -#define SNDDATAI_COS_CNT_9 0x00000ca4 -#define SNDDATAI_COS_CNT_10 0x00000ca8 -#define SNDDATAI_COS_CNT_11 0x00000cac -#define SNDDATAI_COS_CNT_12 0x00000cb0 -#define SNDDATAI_COS_CNT_13 0x00000cb4 -#define SNDDATAI_COS_CNT_14 0x00000cb8 -#define SNDDATAI_COS_CNT_15 0x00000cbc -#define SNDDATAI_DMA_RDQ_FULL_CNT 0x00000cc0 -#define SNDDATAI_DMA_PRIO_RDQ_FULL_CNT 0x00000cc4 -#define SNDDATAI_SDCQ_FULL_CNT 0x00000cc8 -#define SNDDATAI_NICRNG_SSND_PIDX_CNT 0x00000ccc -#define SNDDATAI_STATS_UPDATED_CNT 0x00000cd0 -#define SNDDATAI_INTERRUPTS_CNT 0x00000cd4 -#define SNDDATAI_AVOID_INTERRUPTS_CNT 0x00000cd8 -#define SNDDATAI_SND_THRESH_HIT_CNT 0x00000cdc -/* 0xce0 --> 0x1000 unused */ - -/* Send data completion control registers */ -#define SNDDATAC_MODE 0x00001000 -#define SNDDATAC_MODE_RESET 0x00000001 -#define SNDDATAC_MODE_ENABLE 0x00000002 -/* 0x1004 --> 0x1400 unused */ - -/* Send BD ring selector */ -#define SNDBDS_MODE 0x00001400 -#define SNDBDS_MODE_RESET 0x00000001 -#define SNDBDS_MODE_ENABLE 0x00000002 -#define SNDBDS_MODE_ATTN_ENABLE 0x00000004 -#define SNDBDS_STATUS 0x00001404 -#define SNDBDS_STATUS_ERROR_ATTN 0x00000004 -#define SNDBDS_HWDIAG 0x00001408 -/* 0x140c --> 0x1440 */ -#define SNDBDS_SEL_CON_IDX_0 0x00001440 -#define SNDBDS_SEL_CON_IDX_1 0x00001444 -#define SNDBDS_SEL_CON_IDX_2 0x00001448 -#define SNDBDS_SEL_CON_IDX_3 0x0000144c -#define SNDBDS_SEL_CON_IDX_4 0x00001450 -#define SNDBDS_SEL_CON_IDX_5 0x00001454 -#define SNDBDS_SEL_CON_IDX_6 0x00001458 -#define SNDBDS_SEL_CON_IDX_7 0x0000145c -#define SNDBDS_SEL_CON_IDX_8 0x00001460 -#define SNDBDS_SEL_CON_IDX_9 0x00001464 -#define SNDBDS_SEL_CON_IDX_10 0x00001468 -#define SNDBDS_SEL_CON_IDX_11 0x0000146c -#define SNDBDS_SEL_CON_IDX_12 0x00001470 -#define SNDBDS_SEL_CON_IDX_13 0x00001474 -#define SNDBDS_SEL_CON_IDX_14 0x00001478 -#define SNDBDS_SEL_CON_IDX_15 0x0000147c -/* 0x1480 --> 0x1800 unused */ - -/* Send BD initiator control registers */ -#define SNDBDI_MODE 0x00001800 -#define SNDBDI_MODE_RESET 0x00000001 -#define SNDBDI_MODE_ENABLE 0x00000002 -#define SNDBDI_MODE_ATTN_ENABLE 0x00000004 -#define SNDBDI_STATUS 0x00001804 -#define SNDBDI_STATUS_ERROR_ATTN 0x00000004 -#define SNDBDI_IN_PROD_IDX_0 0x00001808 -#define SNDBDI_IN_PROD_IDX_1 0x0000180c -#define SNDBDI_IN_PROD_IDX_2 0x00001810 -#define SNDBDI_IN_PROD_IDX_3 0x00001814 -#define SNDBDI_IN_PROD_IDX_4 0x00001818 -#define SNDBDI_IN_PROD_IDX_5 0x0000181c -#define SNDBDI_IN_PROD_IDX_6 0x00001820 -#define SNDBDI_IN_PROD_IDX_7 0x00001824 -#define SNDBDI_IN_PROD_IDX_8 0x00001828 -#define SNDBDI_IN_PROD_IDX_9 0x0000182c -#define SNDBDI_IN_PROD_IDX_10 0x00001830 -#define SNDBDI_IN_PROD_IDX_11 0x00001834 -#define SNDBDI_IN_PROD_IDX_12 0x00001838 -#define SNDBDI_IN_PROD_IDX_13 0x0000183c -#define SNDBDI_IN_PROD_IDX_14 0x00001840 -#define SNDBDI_IN_PROD_IDX_15 0x00001844 -/* 0x1848 --> 0x1c00 unused */ - -/* Send BD completion control registers */ -#define SNDBDC_MODE 0x00001c00 -#define SNDBDC_MODE_RESET 0x00000001 -#define SNDBDC_MODE_ENABLE 0x00000002 -#define SNDBDC_MODE_ATTN_ENABLE 0x00000004 -/* 0x1c04 --> 0x2000 unused */ - -/* Receive list placement control registers */ -#define RCVLPC_MODE 0x00002000 -#define RCVLPC_MODE_RESET 0x00000001 -#define RCVLPC_MODE_ENABLE 0x00000002 -#define RCVLPC_MODE_CLASS0_ATTN_ENAB 0x00000004 -#define RCVLPC_MODE_MAPOOR_AATTN_ENAB 0x00000008 -#define RCVLPC_MODE_STAT_OFLOW_ENAB 0x00000010 -#define RCVLPC_STATUS 0x00002004 -#define RCVLPC_STATUS_CLASS0 0x00000004 -#define RCVLPC_STATUS_MAPOOR 0x00000008 -#define RCVLPC_STATUS_STAT_OFLOW 0x00000010 -#define RCVLPC_LOCK 0x00002008 -#define RCVLPC_LOCK_REQ_MASK 0x0000ffff -#define RCVLPC_LOCK_REQ_SHIFT 0 -#define RCVLPC_LOCK_GRANT_MASK 0xffff0000 -#define RCVLPC_LOCK_GRANT_SHIFT 16 -#define RCVLPC_NON_EMPTY_BITS 0x0000200c -#define RCVLPC_NON_EMPTY_BITS_MASK 0x0000ffff -#define RCVLPC_CONFIG 0x00002010 -#define RCVLPC_STATSCTRL 0x00002014 -#define RCVLPC_STATSCTRL_ENABLE 0x00000001 -#define RCVLPC_STATSCTRL_FASTUPD 0x00000002 -#define RCVLPC_STATS_ENABLE 0x00002018 -#define RCVLPC_STATSENAB_LNGBRST_RFIX 0x00400000 -#define RCVLPC_STATS_INCMASK 0x0000201c -/* 0x2020 --> 0x2100 unused */ -#define RCVLPC_SELLST_BASE 0x00002100 /* 16 16-byte entries */ -#define SELLST_TAIL 0x00000004 -#define SELLST_CONT 0x00000008 -#define SELLST_UNUSED 0x0000000c -#define RCVLPC_COS_CNTL_BASE 0x00002200 /* 16 4-byte entries */ -#define RCVLPC_DROP_FILTER_CNT 0x00002240 -#define RCVLPC_DMA_WQ_FULL_CNT 0x00002244 -#define RCVLPC_DMA_HIPRIO_WQ_FULL_CNT 0x00002248 -#define RCVLPC_NO_RCV_BD_CNT 0x0000224c -#define RCVLPC_IN_DISCARDS_CNT 0x00002250 -#define RCVLPC_IN_ERRORS_CNT 0x00002254 -#define RCVLPC_RCV_THRESH_HIT_CNT 0x00002258 -/* 0x225c --> 0x2400 unused */ - -/* Receive Data and Receive BD Initiator Control */ -#define RCVDBDI_MODE 0x00002400 -#define RCVDBDI_MODE_RESET 0x00000001 -#define RCVDBDI_MODE_ENABLE 0x00000002 -#define RCVDBDI_MODE_JUMBOBD_NEEDED 0x00000004 -#define RCVDBDI_MODE_FRM_TOO_BIG 0x00000008 -#define RCVDBDI_MODE_INV_RING_SZ 0x00000010 -#define RCVDBDI_STATUS 0x00002404 -#define RCVDBDI_STATUS_JUMBOBD_NEEDED 0x00000004 -#define RCVDBDI_STATUS_FRM_TOO_BIG 0x00000008 -#define RCVDBDI_STATUS_INV_RING_SZ 0x00000010 -#define RCVDBDI_SPLIT_FRAME_MINSZ 0x00002408 -/* 0x240c --> 0x2440 unused */ -#define RCVDBDI_JUMBO_BD 0x00002440 /* TG3_BDINFO_... */ -#define RCVDBDI_STD_BD 0x00002450 /* TG3_BDINFO_... */ -#define RCVDBDI_MINI_BD 0x00002460 /* TG3_BDINFO_... */ -#define RCVDBDI_JUMBO_CON_IDX 0x00002470 -#define RCVDBDI_STD_CON_IDX 0x00002474 -#define RCVDBDI_MINI_CON_IDX 0x00002478 -/* 0x247c --> 0x2480 unused */ -#define RCVDBDI_BD_PROD_IDX_0 0x00002480 -#define RCVDBDI_BD_PROD_IDX_1 0x00002484 -#define RCVDBDI_BD_PROD_IDX_2 0x00002488 -#define RCVDBDI_BD_PROD_IDX_3 0x0000248c -#define RCVDBDI_BD_PROD_IDX_4 0x00002490 -#define RCVDBDI_BD_PROD_IDX_5 0x00002494 -#define RCVDBDI_BD_PROD_IDX_6 0x00002498 -#define RCVDBDI_BD_PROD_IDX_7 0x0000249c -#define RCVDBDI_BD_PROD_IDX_8 0x000024a0 -#define RCVDBDI_BD_PROD_IDX_9 0x000024a4 -#define RCVDBDI_BD_PROD_IDX_10 0x000024a8 -#define RCVDBDI_BD_PROD_IDX_11 0x000024ac -#define RCVDBDI_BD_PROD_IDX_12 0x000024b0 -#define RCVDBDI_BD_PROD_IDX_13 0x000024b4 -#define RCVDBDI_BD_PROD_IDX_14 0x000024b8 -#define RCVDBDI_BD_PROD_IDX_15 0x000024bc -#define RCVDBDI_HWDIAG 0x000024c0 -/* 0x24c4 --> 0x2800 unused */ - -/* Receive Data Completion Control */ -#define RCVDCC_MODE 0x00002800 -#define RCVDCC_MODE_RESET 0x00000001 -#define RCVDCC_MODE_ENABLE 0x00000002 -#define RCVDCC_MODE_ATTN_ENABLE 0x00000004 -/* 0x2804 --> 0x2c00 unused */ - -/* Receive BD Initiator Control Registers */ -#define RCVBDI_MODE 0x00002c00 -#define RCVBDI_MODE_RESET 0x00000001 -#define RCVBDI_MODE_ENABLE 0x00000002 -#define RCVBDI_MODE_RCB_ATTN_ENAB 0x00000004 -#define RCVBDI_STATUS 0x00002c04 -#define RCVBDI_STATUS_RCB_ATTN 0x00000004 -#define RCVBDI_JUMBO_PROD_IDX 0x00002c08 -#define RCVBDI_STD_PROD_IDX 0x00002c0c -#define RCVBDI_MINI_PROD_IDX 0x00002c10 -#define RCVBDI_MINI_THRESH 0x00002c14 -#define RCVBDI_STD_THRESH 0x00002c18 -#define RCVBDI_JUMBO_THRESH 0x00002c1c -/* 0x2c20 --> 0x3000 unused */ - -/* Receive BD Completion Control Registers */ -#define RCVCC_MODE 0x00003000 -#define RCVCC_MODE_RESET 0x00000001 -#define RCVCC_MODE_ENABLE 0x00000002 -#define RCVCC_MODE_ATTN_ENABLE 0x00000004 -#define RCVCC_STATUS 0x00003004 -#define RCVCC_STATUS_ERROR_ATTN 0x00000004 -#define RCVCC_JUMP_PROD_IDX 0x00003008 -#define RCVCC_STD_PROD_IDX 0x0000300c -#define RCVCC_MINI_PROD_IDX 0x00003010 -/* 0x3014 --> 0x3400 unused */ - -/* Receive list selector control registers */ -#define RCVLSC_MODE 0x00003400 -#define RCVLSC_MODE_RESET 0x00000001 -#define RCVLSC_MODE_ENABLE 0x00000002 -#define RCVLSC_MODE_ATTN_ENABLE 0x00000004 -#define RCVLSC_STATUS 0x00003404 -#define RCVLSC_STATUS_ERROR_ATTN 0x00000004 -/* 0x3408 --> 0x3800 unused */ - -/* Mbuf cluster free registers */ -#define MBFREE_MODE 0x00003800 -#define MBFREE_MODE_RESET 0x00000001 -#define MBFREE_MODE_ENABLE 0x00000002 -#define MBFREE_STATUS 0x00003804 -/* 0x3808 --> 0x3c00 unused */ - -/* Host coalescing control registers */ -#define HOSTCC_MODE 0x00003c00 -#define HOSTCC_MODE_RESET 0x00000001 -#define HOSTCC_MODE_ENABLE 0x00000002 -#define HOSTCC_MODE_ATTN 0x00000004 -#define HOSTCC_MODE_NOW 0x00000008 -#define HOSTCC_MODE_FULL_STATUS 0x00000000 -#define HOSTCC_MODE_64BYTE 0x00000080 -#define HOSTCC_MODE_32BYTE 0x00000100 -#define HOSTCC_MODE_CLRTICK_RXBD 0x00000200 -#define HOSTCC_MODE_CLRTICK_TXBD 0x00000400 -#define HOSTCC_MODE_NOINT_ON_NOW 0x00000800 -#define HOSTCC_MODE_NOINT_ON_FORCE 0x00001000 -#define HOSTCC_STATUS 0x00003c04 -#define HOSTCC_STATUS_ERROR_ATTN 0x00000004 -#define HOSTCC_RXCOL_TICKS 0x00003c08 -#define LOW_RXCOL_TICKS 0x00000032 -#define DEFAULT_RXCOL_TICKS 0x00000048 -#define HIGH_RXCOL_TICKS 0x00000096 -#define HOSTCC_TXCOL_TICKS 0x00003c0c -#define LOW_TXCOL_TICKS 0x00000096 -#define DEFAULT_TXCOL_TICKS 0x0000012c -#define HIGH_TXCOL_TICKS 0x00000145 -#define HOSTCC_RXMAX_FRAMES 0x00003c10 -#define LOW_RXMAX_FRAMES 0x00000005 -#define DEFAULT_RXMAX_FRAMES 0x00000008 -#define HIGH_RXMAX_FRAMES 0x00000012 -#define HOSTCC_TXMAX_FRAMES 0x00003c14 -#define LOW_TXMAX_FRAMES 0x00000035 -#define DEFAULT_TXMAX_FRAMES 0x0000004b -#define HIGH_TXMAX_FRAMES 0x00000052 -#define HOSTCC_RXCOAL_TICK_INT 0x00003c18 -#define DEFAULT_RXCOAL_TICK_INT 0x00000019 -#define HOSTCC_TXCOAL_TICK_INT 0x00003c1c -#define DEFAULT_TXCOAL_TICK_INT 0x00000019 -#define HOSTCC_RXCOAL_MAXF_INT 0x00003c20 -#define DEFAULT_RXCOAL_MAXF_INT 0x00000005 -#define HOSTCC_TXCOAL_MAXF_INT 0x00003c24 -#define DEFAULT_TXCOAL_MAXF_INT 0x00000005 -#define HOSTCC_STAT_COAL_TICKS 0x00003c28 -#define DEFAULT_STAT_COAL_TICKS 0x000f4240 -/* 0x3c2c --> 0x3c30 unused */ -#define HOSTCC_STATS_BLK_HOST_ADDR 0x00003c30 /* 64-bit */ -#define HOSTCC_STATUS_BLK_HOST_ADDR 0x00003c38 /* 64-bit */ -#define HOSTCC_STATS_BLK_NIC_ADDR 0x00003c40 -#define HOSTCC_STATUS_BLK_NIC_ADDR 0x00003c44 -#define HOSTCC_FLOW_ATTN 0x00003c48 -/* 0x3c4c --> 0x3c50 unused */ -#define HOSTCC_JUMBO_CON_IDX 0x00003c50 -#define HOSTCC_STD_CON_IDX 0x00003c54 -#define HOSTCC_MINI_CON_IDX 0x00003c58 -/* 0x3c5c --> 0x3c80 unused */ -#define HOSTCC_RET_PROD_IDX_0 0x00003c80 -#define HOSTCC_RET_PROD_IDX_1 0x00003c84 -#define HOSTCC_RET_PROD_IDX_2 0x00003c88 -#define HOSTCC_RET_PROD_IDX_3 0x00003c8c -#define HOSTCC_RET_PROD_IDX_4 0x00003c90 -#define HOSTCC_RET_PROD_IDX_5 0x00003c94 -#define HOSTCC_RET_PROD_IDX_6 0x00003c98 -#define HOSTCC_RET_PROD_IDX_7 0x00003c9c -#define HOSTCC_RET_PROD_IDX_8 0x00003ca0 -#define HOSTCC_RET_PROD_IDX_9 0x00003ca4 -#define HOSTCC_RET_PROD_IDX_10 0x00003ca8 -#define HOSTCC_RET_PROD_IDX_11 0x00003cac -#define HOSTCC_RET_PROD_IDX_12 0x00003cb0 -#define HOSTCC_RET_PROD_IDX_13 0x00003cb4 -#define HOSTCC_RET_PROD_IDX_14 0x00003cb8 -#define HOSTCC_RET_PROD_IDX_15 0x00003cbc -#define HOSTCC_SND_CON_IDX_0 0x00003cc0 -#define HOSTCC_SND_CON_IDX_1 0x00003cc4 -#define HOSTCC_SND_CON_IDX_2 0x00003cc8 -#define HOSTCC_SND_CON_IDX_3 0x00003ccc -#define HOSTCC_SND_CON_IDX_4 0x00003cd0 -#define HOSTCC_SND_CON_IDX_5 0x00003cd4 -#define HOSTCC_SND_CON_IDX_6 0x00003cd8 -#define HOSTCC_SND_CON_IDX_7 0x00003cdc -#define HOSTCC_SND_CON_IDX_8 0x00003ce0 -#define HOSTCC_SND_CON_IDX_9 0x00003ce4 -#define HOSTCC_SND_CON_IDX_10 0x00003ce8 -#define HOSTCC_SND_CON_IDX_11 0x00003cec -#define HOSTCC_SND_CON_IDX_12 0x00003cf0 -#define HOSTCC_SND_CON_IDX_13 0x00003cf4 -#define HOSTCC_SND_CON_IDX_14 0x00003cf8 -#define HOSTCC_SND_CON_IDX_15 0x00003cfc -/* 0x3d00 --> 0x4000 unused */ - -/* Memory arbiter control registers */ -#define MEMARB_MODE 0x00004000 -#define MEMARB_MODE_RESET 0x00000001 -#define MEMARB_MODE_ENABLE 0x00000002 -#define MEMARB_STATUS 0x00004004 -#define MEMARB_TRAP_ADDR_LOW 0x00004008 -#define MEMARB_TRAP_ADDR_HIGH 0x0000400c -/* 0x4010 --> 0x4400 unused */ - -/* Buffer manager control registers */ -#define BUFMGR_MODE 0x00004400 -#define BUFMGR_MODE_RESET 0x00000001 -#define BUFMGR_MODE_ENABLE 0x00000002 -#define BUFMGR_MODE_ATTN_ENABLE 0x00000004 -#define BUFMGR_MODE_BM_TEST 0x00000008 -#define BUFMGR_MODE_MBLOW_ATTN_ENAB 0x00000010 -#define BUFMGR_STATUS 0x00004404 -#define BUFMGR_STATUS_ERROR 0x00000004 -#define BUFMGR_STATUS_MBLOW 0x00000010 -#define BUFMGR_MB_POOL_ADDR 0x00004408 -#define BUFMGR_MB_POOL_SIZE 0x0000440c -#define BUFMGR_MB_RDMA_LOW_WATER 0x00004410 -#define DEFAULT_MB_RDMA_LOW_WATER 0x00000050 -#define DEFAULT_MB_RDMA_LOW_WATER_5705 0x00000000 -#define DEFAULT_MB_RDMA_LOW_WATER_JUMBO 0x00000130 -#define BUFMGR_MB_MACRX_LOW_WATER 0x00004414 -#define DEFAULT_MB_MACRX_LOW_WATER 0x00000020 -#define DEFAULT_MB_MACRX_LOW_WATER_5705 0x00000010 -#define DEFAULT_MB_MACRX_LOW_WATER_JUMBO 0x00000098 -#define BUFMGR_MB_HIGH_WATER 0x00004418 -#define DEFAULT_MB_HIGH_WATER 0x00000060 -#define DEFAULT_MB_HIGH_WATER_5705 0x00000060 -#define DEFAULT_MB_HIGH_WATER_JUMBO 0x0000017c -#define BUFMGR_RX_MB_ALLOC_REQ 0x0000441c -#define BUFMGR_MB_ALLOC_BIT 0x10000000 -#define BUFMGR_RX_MB_ALLOC_RESP 0x00004420 -#define BUFMGR_TX_MB_ALLOC_REQ 0x00004424 -#define BUFMGR_TX_MB_ALLOC_RESP 0x00004428 -#define BUFMGR_DMA_DESC_POOL_ADDR 0x0000442c -#define BUFMGR_DMA_DESC_POOL_SIZE 0x00004430 -#define BUFMGR_DMA_LOW_WATER 0x00004434 -#define DEFAULT_DMA_LOW_WATER 0x00000005 -#define BUFMGR_DMA_HIGH_WATER 0x00004438 -#define DEFAULT_DMA_HIGH_WATER 0x0000000a -#define BUFMGR_RX_DMA_ALLOC_REQ 0x0000443c -#define BUFMGR_RX_DMA_ALLOC_RESP 0x00004440 -#define BUFMGR_TX_DMA_ALLOC_REQ 0x00004444 -#define BUFMGR_TX_DMA_ALLOC_RESP 0x00004448 -#define BUFMGR_HWDIAG_0 0x0000444c -#define BUFMGR_HWDIAG_1 0x00004450 -#define BUFMGR_HWDIAG_2 0x00004454 -/* 0x4458 --> 0x4800 unused */ - -/* Read DMA control registers */ -#define RDMAC_MODE 0x00004800 -#define RDMAC_MODE_RESET 0x00000001 -#define RDMAC_MODE_ENABLE 0x00000002 -#define RDMAC_MODE_TGTABORT_ENAB 0x00000004 -#define RDMAC_MODE_MSTABORT_ENAB 0x00000008 -#define RDMAC_MODE_PARITYERR_ENAB 0x00000010 -#define RDMAC_MODE_ADDROFLOW_ENAB 0x00000020 -#define RDMAC_MODE_FIFOOFLOW_ENAB 0x00000040 -#define RDMAC_MODE_FIFOURUN_ENAB 0x00000080 -#define RDMAC_MODE_FIFOOREAD_ENAB 0x00000100 -#define RDMAC_MODE_LNGREAD_ENAB 0x00000200 -#define RDMAC_MODE_SPLIT_ENABLE 0x00000800 -#define RDMAC_MODE_SPLIT_RESET 0x00001000 -#define RDMAC_MODE_FIFO_SIZE_128 0x00020000 -#define RDMAC_MODE_FIFO_LONG_BURST 0x00030000 -#define RDMAC_STATUS 0x00004804 -#define RDMAC_STATUS_TGTABORT 0x00000004 -#define RDMAC_STATUS_MSTABORT 0x00000008 -#define RDMAC_STATUS_PARITYERR 0x00000010 -#define RDMAC_STATUS_ADDROFLOW 0x00000020 -#define RDMAC_STATUS_FIFOOFLOW 0x00000040 -#define RDMAC_STATUS_FIFOURUN 0x00000080 -#define RDMAC_STATUS_FIFOOREAD 0x00000100 -#define RDMAC_STATUS_LNGREAD 0x00000200 -/* 0x4808 --> 0x4c00 unused */ - -/* Write DMA control registers */ -#define WDMAC_MODE 0x00004c00 -#define WDMAC_MODE_RESET 0x00000001 -#define WDMAC_MODE_ENABLE 0x00000002 -#define WDMAC_MODE_TGTABORT_ENAB 0x00000004 -#define WDMAC_MODE_MSTABORT_ENAB 0x00000008 -#define WDMAC_MODE_PARITYERR_ENAB 0x00000010 -#define WDMAC_MODE_ADDROFLOW_ENAB 0x00000020 -#define WDMAC_MODE_FIFOOFLOW_ENAB 0x00000040 -#define WDMAC_MODE_FIFOURUN_ENAB 0x00000080 -#define WDMAC_MODE_FIFOOREAD_ENAB 0x00000100 -#define WDMAC_MODE_LNGREAD_ENAB 0x00000200 -#define WDMAC_MODE_RX_ACCEL 0x00000400 -#define WDMAC_STATUS 0x00004c04 -#define WDMAC_STATUS_TGTABORT 0x00000004 -#define WDMAC_STATUS_MSTABORT 0x00000008 -#define WDMAC_STATUS_PARITYERR 0x00000010 -#define WDMAC_STATUS_ADDROFLOW 0x00000020 -#define WDMAC_STATUS_FIFOOFLOW 0x00000040 -#define WDMAC_STATUS_FIFOURUN 0x00000080 -#define WDMAC_STATUS_FIFOOREAD 0x00000100 -#define WDMAC_STATUS_LNGREAD 0x00000200 -/* 0x4c08 --> 0x5000 unused */ - -/* Per-cpu register offsets (arm9) */ -#define CPU_MODE 0x00000000 -#define CPU_MODE_RESET 0x00000001 -#define CPU_MODE_HALT 0x00000400 -#define CPU_STATE 0x00000004 -#define CPU_EVTMASK 0x00000008 -/* 0xc --> 0x1c reserved */ -#define CPU_PC 0x0000001c -#define CPU_INSN 0x00000020 -#define CPU_SPAD_UFLOW 0x00000024 -#define CPU_WDOG_CLEAR 0x00000028 -#define CPU_WDOG_VECTOR 0x0000002c -#define CPU_WDOG_PC 0x00000030 -#define CPU_HW_BP 0x00000034 -/* 0x38 --> 0x44 unused */ -#define CPU_WDOG_SAVED_STATE 0x00000044 -#define CPU_LAST_BRANCH_ADDR 0x00000048 -#define CPU_SPAD_UFLOW_SET 0x0000004c -/* 0x50 --> 0x200 unused */ -#define CPU_R0 0x00000200 -#define CPU_R1 0x00000204 -#define CPU_R2 0x00000208 -#define CPU_R3 0x0000020c -#define CPU_R4 0x00000210 -#define CPU_R5 0x00000214 -#define CPU_R6 0x00000218 -#define CPU_R7 0x0000021c -#define CPU_R8 0x00000220 -#define CPU_R9 0x00000224 -#define CPU_R10 0x00000228 -#define CPU_R11 0x0000022c -#define CPU_R12 0x00000230 -#define CPU_R13 0x00000234 -#define CPU_R14 0x00000238 -#define CPU_R15 0x0000023c -#define CPU_R16 0x00000240 -#define CPU_R17 0x00000244 -#define CPU_R18 0x00000248 -#define CPU_R19 0x0000024c -#define CPU_R20 0x00000250 -#define CPU_R21 0x00000254 -#define CPU_R22 0x00000258 -#define CPU_R23 0x0000025c -#define CPU_R24 0x00000260 -#define CPU_R25 0x00000264 -#define CPU_R26 0x00000268 -#define CPU_R27 0x0000026c -#define CPU_R28 0x00000270 -#define CPU_R29 0x00000274 -#define CPU_R30 0x00000278 -#define CPU_R31 0x0000027c -/* 0x280 --> 0x400 unused */ - -#define RX_CPU_BASE 0x00005000 -#define TX_CPU_BASE 0x00005400 - -/* Mailboxes */ -#define GRCMBOX_INTERRUPT_0 0x00005800 /* 64-bit */ -#define GRCMBOX_INTERRUPT_1 0x00005808 /* 64-bit */ -#define GRCMBOX_INTERRUPT_2 0x00005810 /* 64-bit */ -#define GRCMBOX_INTERRUPT_3 0x00005818 /* 64-bit */ -#define GRCMBOX_GENERAL_0 0x00005820 /* 64-bit */ -#define GRCMBOX_GENERAL_1 0x00005828 /* 64-bit */ -#define GRCMBOX_GENERAL_2 0x00005830 /* 64-bit */ -#define GRCMBOX_GENERAL_3 0x00005838 /* 64-bit */ -#define GRCMBOX_GENERAL_4 0x00005840 /* 64-bit */ -#define GRCMBOX_GENERAL_5 0x00005848 /* 64-bit */ -#define GRCMBOX_GENERAL_6 0x00005850 /* 64-bit */ -#define GRCMBOX_GENERAL_7 0x00005858 /* 64-bit */ -#define GRCMBOX_RELOAD_STAT 0x00005860 /* 64-bit */ -#define GRCMBOX_RCVSTD_PROD_IDX 0x00005868 /* 64-bit */ -#define GRCMBOX_RCVJUMBO_PROD_IDX 0x00005870 /* 64-bit */ -#define GRCMBOX_RCVMINI_PROD_IDX 0x00005878 /* 64-bit */ -#define GRCMBOX_RCVRET_CON_IDX_0 0x00005880 /* 64-bit */ -#define GRCMBOX_RCVRET_CON_IDX_1 0x00005888 /* 64-bit */ -#define GRCMBOX_RCVRET_CON_IDX_2 0x00005890 /* 64-bit */ -#define GRCMBOX_RCVRET_CON_IDX_3 0x00005898 /* 64-bit */ -#define GRCMBOX_RCVRET_CON_IDX_4 0x000058a0 /* 64-bit */ -#define GRCMBOX_RCVRET_CON_IDX_5 0x000058a8 /* 64-bit */ -#define GRCMBOX_RCVRET_CON_IDX_6 0x000058b0 /* 64-bit */ -#define GRCMBOX_RCVRET_CON_IDX_7 0x000058b8 /* 64-bit */ -#define GRCMBOX_RCVRET_CON_IDX_8 0x000058c0 /* 64-bit */ -#define GRCMBOX_RCVRET_CON_IDX_9 0x000058c8 /* 64-bit */ -#define GRCMBOX_RCVRET_CON_IDX_10 0x000058d0 /* 64-bit */ -#define GRCMBOX_RCVRET_CON_IDX_11 0x000058d8 /* 64-bit */ -#define GRCMBOX_RCVRET_CON_IDX_12 0x000058e0 /* 64-bit */ -#define GRCMBOX_RCVRET_CON_IDX_13 0x000058e8 /* 64-bit */ -#define GRCMBOX_RCVRET_CON_IDX_14 0x000058f0 /* 64-bit */ -#define GRCMBOX_RCVRET_CON_IDX_15 0x000058f8 /* 64-bit */ -#define GRCMBOX_SNDHOST_PROD_IDX_0 0x00005900 /* 64-bit */ -#define GRCMBOX_SNDHOST_PROD_IDX_1 0x00005908 /* 64-bit */ -#define GRCMBOX_SNDHOST_PROD_IDX_2 0x00005910 /* 64-bit */ -#define GRCMBOX_SNDHOST_PROD_IDX_3 0x00005918 /* 64-bit */ -#define GRCMBOX_SNDHOST_PROD_IDX_4 0x00005920 /* 64-bit */ -#define GRCMBOX_SNDHOST_PROD_IDX_5 0x00005928 /* 64-bit */ -#define GRCMBOX_SNDHOST_PROD_IDX_6 0x00005930 /* 64-bit */ -#define GRCMBOX_SNDHOST_PROD_IDX_7 0x00005938 /* 64-bit */ -#define GRCMBOX_SNDHOST_PROD_IDX_8 0x00005940 /* 64-bit */ -#define GRCMBOX_SNDHOST_PROD_IDX_9 0x00005948 /* 64-bit */ -#define GRCMBOX_SNDHOST_PROD_IDX_10 0x00005950 /* 64-bit */ -#define GRCMBOX_SNDHOST_PROD_IDX_11 0x00005958 /* 64-bit */ -#define GRCMBOX_SNDHOST_PROD_IDX_12 0x00005960 /* 64-bit */ -#define GRCMBOX_SNDHOST_PROD_IDX_13 0x00005968 /* 64-bit */ -#define GRCMBOX_SNDHOST_PROD_IDX_14 0x00005970 /* 64-bit */ -#define GRCMBOX_SNDHOST_PROD_IDX_15 0x00005978 /* 64-bit */ -#define GRCMBOX_SNDNIC_PROD_IDX_0 0x00005980 /* 64-bit */ -#define GRCMBOX_SNDNIC_PROD_IDX_1 0x00005988 /* 64-bit */ -#define GRCMBOX_SNDNIC_PROD_IDX_2 0x00005990 /* 64-bit */ -#define GRCMBOX_SNDNIC_PROD_IDX_3 0x00005998 /* 64-bit */ -#define GRCMBOX_SNDNIC_PROD_IDX_4 0x000059a0 /* 64-bit */ -#define GRCMBOX_SNDNIC_PROD_IDX_5 0x000059a8 /* 64-bit */ -#define GRCMBOX_SNDNIC_PROD_IDX_6 0x000059b0 /* 64-bit */ -#define GRCMBOX_SNDNIC_PROD_IDX_7 0x000059b8 /* 64-bit */ -#define GRCMBOX_SNDNIC_PROD_IDX_8 0x000059c0 /* 64-bit */ -#define GRCMBOX_SNDNIC_PROD_IDX_9 0x000059c8 /* 64-bit */ -#define GRCMBOX_SNDNIC_PROD_IDX_10 0x000059d0 /* 64-bit */ -#define GRCMBOX_SNDNIC_PROD_IDX_11 0x000059d8 /* 64-bit */ -#define GRCMBOX_SNDNIC_PROD_IDX_12 0x000059e0 /* 64-bit */ -#define GRCMBOX_SNDNIC_PROD_IDX_13 0x000059e8 /* 64-bit */ -#define GRCMBOX_SNDNIC_PROD_IDX_14 0x000059f0 /* 64-bit */ -#define GRCMBOX_SNDNIC_PROD_IDX_15 0x000059f8 /* 64-bit */ -#define GRCMBOX_HIGH_PRIO_EV_VECTOR 0x00005a00 -#define GRCMBOX_HIGH_PRIO_EV_MASK 0x00005a04 -#define GRCMBOX_LOW_PRIO_EV_VEC 0x00005a08 -#define GRCMBOX_LOW_PRIO_EV_MASK 0x00005a0c -/* 0x5a10 --> 0x5c00 */ - -/* Flow Through queues */ -#define FTQ_RESET 0x00005c00 -/* 0x5c04 --> 0x5c10 unused */ -#define FTQ_DMA_NORM_READ_CTL 0x00005c10 -#define FTQ_DMA_NORM_READ_FULL_CNT 0x00005c14 -#define FTQ_DMA_NORM_READ_FIFO_ENQDEQ 0x00005c18 -#define FTQ_DMA_NORM_READ_WRITE_PEEK 0x00005c1c -#define FTQ_DMA_HIGH_READ_CTL 0x00005c20 -#define FTQ_DMA_HIGH_READ_FULL_CNT 0x00005c24 -#define FTQ_DMA_HIGH_READ_FIFO_ENQDEQ 0x00005c28 -#define FTQ_DMA_HIGH_READ_WRITE_PEEK 0x00005c2c -#define FTQ_DMA_COMP_DISC_CTL 0x00005c30 -#define FTQ_DMA_COMP_DISC_FULL_CNT 0x00005c34 -#define FTQ_DMA_COMP_DISC_FIFO_ENQDEQ 0x00005c38 -#define FTQ_DMA_COMP_DISC_WRITE_PEEK 0x00005c3c -#define FTQ_SEND_BD_COMP_CTL 0x00005c40 -#define FTQ_SEND_BD_COMP_FULL_CNT 0x00005c44 -#define FTQ_SEND_BD_COMP_FIFO_ENQDEQ 0x00005c48 -#define FTQ_SEND_BD_COMP_WRITE_PEEK 0x00005c4c -#define FTQ_SEND_DATA_INIT_CTL 0x00005c50 -#define FTQ_SEND_DATA_INIT_FULL_CNT 0x00005c54 -#define FTQ_SEND_DATA_INIT_FIFO_ENQDEQ 0x00005c58 -#define FTQ_SEND_DATA_INIT_WRITE_PEEK 0x00005c5c -#define FTQ_DMA_NORM_WRITE_CTL 0x00005c60 -#define FTQ_DMA_NORM_WRITE_FULL_CNT 0x00005c64 -#define FTQ_DMA_NORM_WRITE_FIFO_ENQDEQ 0x00005c68 -#define FTQ_DMA_NORM_WRITE_WRITE_PEEK 0x00005c6c -#define FTQ_DMA_HIGH_WRITE_CTL 0x00005c70 -#define FTQ_DMA_HIGH_WRITE_FULL_CNT 0x00005c74 -#define FTQ_DMA_HIGH_WRITE_FIFO_ENQDEQ 0x00005c78 -#define FTQ_DMA_HIGH_WRITE_WRITE_PEEK 0x00005c7c -#define FTQ_SWTYPE1_CTL 0x00005c80 -#define FTQ_SWTYPE1_FULL_CNT 0x00005c84 -#define FTQ_SWTYPE1_FIFO_ENQDEQ 0x00005c88 -#define FTQ_SWTYPE1_WRITE_PEEK 0x00005c8c -#define FTQ_SEND_DATA_COMP_CTL 0x00005c90 -#define FTQ_SEND_DATA_COMP_FULL_CNT 0x00005c94 -#define FTQ_SEND_DATA_COMP_FIFO_ENQDEQ 0x00005c98 -#define FTQ_SEND_DATA_COMP_WRITE_PEEK 0x00005c9c -#define FTQ_HOST_COAL_CTL 0x00005ca0 -#define FTQ_HOST_COAL_FULL_CNT 0x00005ca4 -#define FTQ_HOST_COAL_FIFO_ENQDEQ 0x00005ca8 -#define FTQ_HOST_COAL_WRITE_PEEK 0x00005cac -#define FTQ_MAC_TX_CTL 0x00005cb0 -#define FTQ_MAC_TX_FULL_CNT 0x00005cb4 -#define FTQ_MAC_TX_FIFO_ENQDEQ 0x00005cb8 -#define FTQ_MAC_TX_WRITE_PEEK 0x00005cbc -#define FTQ_MB_FREE_CTL 0x00005cc0 -#define FTQ_MB_FREE_FULL_CNT 0x00005cc4 -#define FTQ_MB_FREE_FIFO_ENQDEQ 0x00005cc8 -#define FTQ_MB_FREE_WRITE_PEEK 0x00005ccc -#define FTQ_RCVBD_COMP_CTL 0x00005cd0 -#define FTQ_RCVBD_COMP_FULL_CNT 0x00005cd4 -#define FTQ_RCVBD_COMP_FIFO_ENQDEQ 0x00005cd8 -#define FTQ_RCVBD_COMP_WRITE_PEEK 0x00005cdc -#define FTQ_RCVLST_PLMT_CTL 0x00005ce0 -#define FTQ_RCVLST_PLMT_FULL_CNT 0x00005ce4 -#define FTQ_RCVLST_PLMT_FIFO_ENQDEQ 0x00005ce8 -#define FTQ_RCVLST_PLMT_WRITE_PEEK 0x00005cec -#define FTQ_RCVDATA_INI_CTL 0x00005cf0 -#define FTQ_RCVDATA_INI_FULL_CNT 0x00005cf4 -#define FTQ_RCVDATA_INI_FIFO_ENQDEQ 0x00005cf8 -#define FTQ_RCVDATA_INI_WRITE_PEEK 0x00005cfc -#define FTQ_RCVDATA_COMP_CTL 0x00005d00 -#define FTQ_RCVDATA_COMP_FULL_CNT 0x00005d04 -#define FTQ_RCVDATA_COMP_FIFO_ENQDEQ 0x00005d08 -#define FTQ_RCVDATA_COMP_WRITE_PEEK 0x00005d0c -#define FTQ_SWTYPE2_CTL 0x00005d10 -#define FTQ_SWTYPE2_FULL_CNT 0x00005d14 -#define FTQ_SWTYPE2_FIFO_ENQDEQ 0x00005d18 -#define FTQ_SWTYPE2_WRITE_PEEK 0x00005d1c -/* 0x5d20 --> 0x6000 unused */ - -/* Message signaled interrupt registers */ -#define MSGINT_MODE 0x00006000 -#define MSGINT_MODE_RESET 0x00000001 -#define MSGINT_MODE_ENABLE 0x00000002 -#define MSGINT_STATUS 0x00006004 -#define MSGINT_FIFO 0x00006008 -/* 0x600c --> 0x6400 unused */ - -/* DMA completion registers */ -#define DMAC_MODE 0x00006400 -#define DMAC_MODE_RESET 0x00000001 -#define DMAC_MODE_ENABLE 0x00000002 -/* 0x6404 --> 0x6800 unused */ - -/* GRC registers */ -#define GRC_MODE 0x00006800 -#define GRC_MODE_UPD_ON_COAL 0x00000001 -#define GRC_MODE_BSWAP_NONFRM_DATA 0x00000002 -#define GRC_MODE_WSWAP_NONFRM_DATA 0x00000004 -#define GRC_MODE_BSWAP_DATA 0x00000010 -#define GRC_MODE_WSWAP_DATA 0x00000020 -#define GRC_MODE_SPLITHDR 0x00000100 -#define GRC_MODE_NOFRM_CRACKING 0x00000200 -#define GRC_MODE_INCL_CRC 0x00000400 -#define GRC_MODE_ALLOW_BAD_FRMS 0x00000800 -#define GRC_MODE_NOIRQ_ON_SENDS 0x00002000 -#define GRC_MODE_NOIRQ_ON_RCV 0x00004000 -#define GRC_MODE_FORCE_PCI32BIT 0x00008000 -#define GRC_MODE_HOST_STACKUP 0x00010000 -#define GRC_MODE_HOST_SENDBDS 0x00020000 -#define GRC_MODE_NO_TX_PHDR_CSUM 0x00100000 -#define GRC_MODE_NO_RX_PHDR_CSUM 0x00800000 -#define GRC_MODE_IRQ_ON_TX_CPU_ATTN 0x01000000 -#define GRC_MODE_IRQ_ON_RX_CPU_ATTN 0x02000000 -#define GRC_MODE_IRQ_ON_MAC_ATTN 0x04000000 -#define GRC_MODE_IRQ_ON_DMA_ATTN 0x08000000 -#define GRC_MODE_IRQ_ON_FLOW_ATTN 0x10000000 -#define GRC_MODE_4X_NIC_SEND_RINGS 0x20000000 -#define GRC_MODE_MCAST_FRM_ENABLE 0x40000000 -#define GRC_MISC_CFG 0x00006804 -#define GRC_MISC_CFG_CORECLK_RESET 0x00000001 -#define GRC_MISC_CFG_PRESCALAR_MASK 0x000000fe -#define GRC_MISC_CFG_PRESCALAR_SHIFT 1 -#define GRC_MISC_CFG_BOARD_ID_MASK 0x0001e000 -#define GRC_MISC_CFG_BOARD_ID_5700 0x0001e000 -#define GRC_MISC_CFG_BOARD_ID_5701 0x00000000 -#define GRC_MISC_CFG_BOARD_ID_5702FE 0x00004000 -#define GRC_MISC_CFG_BOARD_ID_5703 0x00000000 -#define GRC_MISC_CFG_BOARD_ID_5703S 0x00002000 -#define GRC_MISC_CFG_BOARD_ID_5704 0x00000000 -#define GRC_MISC_CFG_BOARD_ID_5704CIOBE 0x00004000 -#define GRC_MISC_CFG_BOARD_ID_5704_A2 0x00008000 -#define GRC_MISC_CFG_BOARD_ID_5788 0x00010000 -#define GRC_MISC_CFG_BOARD_ID_5788M 0x00018000 -#define GRC_MISC_CFG_BOARD_ID_AC91002A1 0x00018000 -#define GRC_MISC_CFG_KEEP_GPHY_POWER 0x04000000 -#define GRC_LOCAL_CTRL 0x00006808 -#define GRC_LCLCTRL_INT_ACTIVE 0x00000001 -#define GRC_LCLCTRL_CLEARINT 0x00000002 -#define GRC_LCLCTRL_SETINT 0x00000004 -#define GRC_LCLCTRL_INT_ON_ATTN 0x00000008 -#define GRC_LCLCTRL_GPIO_INPUT0 0x00000100 -#define GRC_LCLCTRL_GPIO_INPUT1 0x00000200 -#define GRC_LCLCTRL_GPIO_INPUT2 0x00000400 -#define GRC_LCLCTRL_GPIO_OE0 0x00000800 -#define GRC_LCLCTRL_GPIO_OE1 0x00001000 -#define GRC_LCLCTRL_GPIO_OE2 0x00002000 -#define GRC_LCLCTRL_GPIO_OUTPUT0 0x00004000 -#define GRC_LCLCTRL_GPIO_OUTPUT1 0x00008000 -#define GRC_LCLCTRL_GPIO_OUTPUT2 0x00010000 -#define GRC_LCLCTRL_EXTMEM_ENABLE 0x00020000 -#define GRC_LCLCTRL_MEMSZ_MASK 0x001c0000 -#define GRC_LCLCTRL_MEMSZ_256K 0x00000000 -#define GRC_LCLCTRL_MEMSZ_512K 0x00040000 -#define GRC_LCLCTRL_MEMSZ_1M 0x00080000 -#define GRC_LCLCTRL_MEMSZ_2M 0x000c0000 -#define GRC_LCLCTRL_MEMSZ_4M 0x00100000 -#define GRC_LCLCTRL_MEMSZ_8M 0x00140000 -#define GRC_LCLCTRL_MEMSZ_16M 0x00180000 -#define GRC_LCLCTRL_BANK_SELECT 0x00200000 -#define GRC_LCLCTRL_SSRAM_TYPE 0x00400000 -#define GRC_LCLCTRL_AUTO_SEEPROM 0x01000000 -#define GRC_TIMER 0x0000680c -#define GRC_RX_CPU_EVENT 0x00006810 -#define GRC_RX_TIMER_REF 0x00006814 -#define GRC_RX_CPU_SEM 0x00006818 -#define GRC_REMOTE_RX_CPU_ATTN 0x0000681c -#define GRC_TX_CPU_EVENT 0x00006820 -#define GRC_TX_TIMER_REF 0x00006824 -#define GRC_TX_CPU_SEM 0x00006828 -#define GRC_REMOTE_TX_CPU_ATTN 0x0000682c -#define GRC_MEM_POWER_UP 0x00006830 /* 64-bit */ -#define GRC_EEPROM_ADDR 0x00006838 -#define EEPROM_ADDR_WRITE 0x00000000 -#define EEPROM_ADDR_READ 0x80000000 -#define EEPROM_ADDR_COMPLETE 0x40000000 -#define EEPROM_ADDR_FSM_RESET 0x20000000 -#define EEPROM_ADDR_DEVID_MASK 0x1c000000 -#define EEPROM_ADDR_DEVID_SHIFT 26 -#define EEPROM_ADDR_START 0x02000000 -#define EEPROM_ADDR_CLKPERD_SHIFT 16 -#define EEPROM_ADDR_ADDR_MASK 0x0000ffff -#define EEPROM_ADDR_ADDR_SHIFT 0 -#define EEPROM_DEFAULT_CLOCK_PERIOD 0x60 -#define EEPROM_CHIP_SIZE (64 * 1024) -#define GRC_EEPROM_DATA 0x0000683c -#define GRC_EEPROM_CTRL 0x00006840 -#define GRC_MDI_CTRL 0x00006844 -#define GRC_SEEPROM_DELAY 0x00006848 -/* 0x684c --> 0x6c00 unused */ - -/* 0x6c00 --> 0x7000 unused */ - -/* NVRAM Control registers */ -#define NVRAM_CMD 0x00007000 -#define NVRAM_CMD_RESET 0x00000001 -#define NVRAM_CMD_DONE 0x00000008 -#define NVRAM_CMD_GO 0x00000010 -#define NVRAM_CMD_WR 0x00000020 -#define NVRAM_CMD_RD 0x00000000 -#define NVRAM_CMD_ERASE 0x00000040 -#define NVRAM_CMD_FIRST 0x00000080 -#define NVRAM_CMD_LAST 0x00000100 -#define NVRAM_STAT 0x00007004 -#define NVRAM_WRDATA 0x00007008 -#define NVRAM_ADDR 0x0000700c -#define NVRAM_ADDR_MSK 0x00ffffff -#define NVRAM_RDDATA 0x00007010 -#define NVRAM_CFG1 0x00007014 -#define NVRAM_CFG1_FLASHIF_ENAB 0x00000001 -#define NVRAM_CFG1_BUFFERED_MODE 0x00000002 -#define NVRAM_CFG1_PASS_THRU 0x00000004 -#define NVRAM_CFG1_BIT_BANG 0x00000008 -#define NVRAM_CFG1_COMPAT_BYPASS 0x80000000 -#define NVRAM_CFG2 0x00007018 -#define NVRAM_CFG3 0x0000701c -#define NVRAM_SWARB 0x00007020 -#define SWARB_REQ_SET0 0x00000001 -#define SWARB_REQ_SET1 0x00000002 -#define SWARB_REQ_SET2 0x00000004 -#define SWARB_REQ_SET3 0x00000008 -#define SWARB_REQ_CLR0 0x00000010 -#define SWARB_REQ_CLR1 0x00000020 -#define SWARB_REQ_CLR2 0x00000040 -#define SWARB_REQ_CLR3 0x00000080 -#define SWARB_GNT0 0x00000100 -#define SWARB_GNT1 0x00000200 -#define SWARB_GNT2 0x00000400 -#define SWARB_GNT3 0x00000800 -#define SWARB_REQ0 0x00001000 -#define SWARB_REQ1 0x00002000 -#define SWARB_REQ2 0x00004000 -#define SWARB_REQ3 0x00008000 -#define NVRAM_BUFFERED_PAGE_SIZE 264 -#define NVRAM_BUFFERED_PAGE_POS 9 -/* 0x7024 --> 0x7400 unused */ - -/* 0x7400 --> 0x8000 unused */ - -/* 32K Window into NIC internal memory */ -#define NIC_SRAM_WIN_BASE 0x00008000 - -/* Offsets into first 32k of NIC internal memory. */ -#define NIC_SRAM_PAGE_ZERO 0x00000000 -#define NIC_SRAM_SEND_RCB 0x00000100 /* 16 * TG3_BDINFO_... */ -#define NIC_SRAM_RCV_RET_RCB 0x00000200 /* 16 * TG3_BDINFO_... */ -#define NIC_SRAM_STATS_BLK 0x00000300 -#define NIC_SRAM_STATUS_BLK 0x00000b00 - -#define NIC_SRAM_FIRMWARE_MBOX 0x00000b50 -#define NIC_SRAM_FIRMWARE_MBOX_MAGIC1 0x4B657654 -#define NIC_SRAM_FIRMWARE_MBOX_MAGIC2 0x4861764b /* !dma on linkchg */ - -#define NIC_SRAM_DATA_SIG 0x00000b54 -#define NIC_SRAM_DATA_SIG_MAGIC 0x4b657654 /* ascii for 'KevT' */ - -#define NIC_SRAM_DATA_CFG 0x00000b58 -#define NIC_SRAM_DATA_CFG_LED_MODE_MASK 0x0000000c -#define NIC_SRAM_DATA_CFG_LED_MODE_UNKNOWN 0x00000000 -#define NIC_SRAM_DATA_CFG_LED_TRIPLE_SPD 0x00000004 -#define NIC_SRAM_DATA_CFG_LED_OPEN_DRAIN 0x00000004 -#define NIC_SRAM_DATA_CFG_LED_LINK_SPD 0x00000008 -#define NIC_SRAM_DATA_CFG_LED_OUTPUT 0x00000008 -#define NIC_SRAM_DATA_CFG_PHY_TYPE_MASK 0x00000030 -#define NIC_SRAM_DATA_CFG_PHY_TYPE_UNKNOWN 0x00000000 -#define NIC_SRAM_DATA_CFG_PHY_TYPE_COPPER 0x00000010 -#define NIC_SRAM_DATA_CFG_PHY_TYPE_FIBER 0x00000020 -#define NIC_SRAM_DATA_CFG_WOL_ENABLE 0x00000040 -#define NIC_SRAM_DATA_CFG_ASF_ENABLE 0x00000080 -#define NIC_SRAM_DATA_CFG_EEPROM_WP 0x00000100 -#define NIC_SRAM_DATA_CFG_MINI_PCI 0x00001000 -#define NIC_SRAM_DATA_CFG_FIBER_WOL 0x00004000 - -#define NIC_SRAM_DATA_PHY_ID 0x00000b74 -#define NIC_SRAM_DATA_PHY_ID1_MASK 0xffff0000 -#define NIC_SRAM_DATA_PHY_ID2_MASK 0x0000ffff - -#define NIC_SRAM_FW_CMD_MBOX 0x00000b78 -#define FWCMD_NICDRV_ALIVE 0x00000001 -#define FWCMD_NICDRV_PAUSE_FW 0x00000002 -#define FWCMD_NICDRV_IPV4ADDR_CHG 0x00000003 -#define FWCMD_NICDRV_IPV6ADDR_CHG 0x00000004 -#define FWCMD_NICDRV_FIX_DMAR 0x00000005 -#define FWCMD_NICDRV_FIX_DMAW 0x00000006 -#define NIC_SRAM_FW_CMD_LEN_MBOX 0x00000b7c -#define NIC_SRAM_FW_CMD_DATA_MBOX 0x00000b80 -#define NIC_SRAM_FW_ASF_STATUS_MBOX 0x00000c00 -#define NIC_SRAM_FW_DRV_STATE_MBOX 0x00000c04 -#define DRV_STATE_START 0x00000001 -#define DRV_STATE_UNLOAD 0x00000002 -#define DRV_STATE_WOL 0x00000003 -#define DRV_STATE_SUSPEND 0x00000004 - -#define NIC_SRAM_FW_RESET_TYPE_MBOX 0x00000c08 - -#define NIC_SRAM_MAC_ADDR_HIGH_MBOX 0x00000c14 -#define NIC_SRAM_MAC_ADDR_LOW_MBOX 0x00000c18 - -#define NIC_SRAM_RX_MINI_BUFFER_DESC 0x00001000 - -#define NIC_SRAM_DMA_DESC_POOL_BASE 0x00002000 -#define NIC_SRAM_DMA_DESC_POOL_SIZE 0x00002000 -#define NIC_SRAM_TX_BUFFER_DESC 0x00004000 /* 512 entries */ -#define NIC_SRAM_RX_BUFFER_DESC 0x00006000 /* 256 entries */ -#define NIC_SRAM_RX_JUMBO_BUFFER_DESC 0x00007000 /* 256 entries */ -#define NIC_SRAM_MBUF_POOL_BASE 0x00008000 -#define NIC_SRAM_MBUF_POOL_SIZE96 0x00018000 -#define NIC_SRAM_MBUF_POOL_SIZE64 0x00010000 -#define NIC_SRAM_MBUF_POOL_BASE5705 0x00010000 -#define NIC_SRAM_MBUF_POOL_SIZE5705 0x0000e000 - -/* Currently this is fixed. */ -#define PHY_ADDR 0x01 - -/* Tigon3 specific PHY MII registers. */ -#define TG3_BMCR_SPEED1000 0x0040 - -#define MII_TG3_CTRL 0x09 /* 1000-baseT control register */ -#define MII_TG3_CTRL_ADV_1000_HALF 0x0100 -#define MII_TG3_CTRL_ADV_1000_FULL 0x0200 -#define MII_TG3_CTRL_AS_MASTER 0x0800 -#define MII_TG3_CTRL_ENABLE_AS_MASTER 0x1000 - -#define MII_TG3_EXT_CTRL 0x10 /* Extended control register */ -#define MII_TG3_EXT_CTRL_LNK3_LED_MODE 0x0002 -#define MII_TG3_EXT_CTRL_TBI 0x8000 - -#define MII_TG3_EXT_STAT 0x11 /* Extended status register */ -#define MII_TG3_EXT_STAT_LPASS 0x0100 - -#define MII_TG3_DSP_RW_PORT 0x15 /* DSP coefficient read/write port */ - -#define MII_TG3_DSP_ADDRESS 0x17 /* DSP address register */ - -#define MII_TG3_AUX_CTRL 0x18 /* auxilliary control register */ - -#define MII_TG3_AUX_STAT 0x19 /* auxilliary status register */ -#define MII_TG3_AUX_STAT_LPASS 0x0004 -#define MII_TG3_AUX_STAT_SPDMASK 0x0700 -#define MII_TG3_AUX_STAT_10HALF 0x0100 -#define MII_TG3_AUX_STAT_10FULL 0x0200 -#define MII_TG3_AUX_STAT_100HALF 0x0300 -#define MII_TG3_AUX_STAT_100_4 0x0400 -#define MII_TG3_AUX_STAT_100FULL 0x0500 -#define MII_TG3_AUX_STAT_1000HALF 0x0600 -#define MII_TG3_AUX_STAT_1000FULL 0x0700 - -#define MII_TG3_ISTAT 0x1a /* IRQ status register */ -#define MII_TG3_IMASK 0x1b /* IRQ mask register */ - -/* ISTAT/IMASK event bits */ -#define MII_TG3_INT_LINKCHG 0x0002 -#define MII_TG3_INT_SPEEDCHG 0x0004 -#define MII_TG3_INT_DUPLEXCHG 0x0008 -#define MII_TG3_INT_ANEG_PAGE_RX 0x0400 - -/* XXX Add this to mii.h */ -#ifndef ADVERTISE_PAUSE -#define ADVERTISE_PAUSE_CAP 0x0400 -#endif -#ifndef ADVERTISE_PAUSE_ASYM -#define ADVERTISE_PAUSE_ASYM 0x0800 -#endif -#ifndef LPA_PAUSE -#define LPA_PAUSE_CAP 0x0400 -#endif -#ifndef LPA_PAUSE_ASYM -#define LPA_PAUSE_ASYM 0x0800 -#endif - -/* There are two ways to manage the TX descriptors on the tigon3. - * Either the descriptors are in host DMA'able memory, or they - * exist only in the cards on-chip SRAM. All 16 send bds are under - * the same mode, they may not be configured individually. - * - * The mode we use is controlled by TG3_FLAG_HOST_TXDS in tp->tg3_flags. - * - * To use host memory TX descriptors: - * 1) Set GRC_MODE_HOST_SENDBDS in GRC_MODE register. - * Make sure GRC_MODE_4X_NIC_SEND_RINGS is clear. - * 2) Allocate DMA'able memory. - * 3) In NIC_SRAM_SEND_RCB (of desired index) of on-chip SRAM: - * a) Set TG3_BDINFO_HOST_ADDR to DMA address of memory - * obtained in step 2 - * b) Set TG3_BDINFO_NIC_ADDR to NIC_SRAM_TX_BUFFER_DESC. - * c) Set len field of TG3_BDINFO_MAXLEN_FLAGS to number - * of TX descriptors. Leave flags field clear. - * 4) Access TX descriptors via host memory. The chip - * will refetch into local SRAM as needed when producer - * index mailboxes are updated. - * - * To use on-chip TX descriptors: - * 1) Set GRC_MODE_4X_NIC_SEND_RINGS in GRC_MODE register. - * Make sure GRC_MODE_HOST_SENDBDS is clear. - * 2) In NIC_SRAM_SEND_RCB (of desired index) of on-chip SRAM: - * a) Set TG3_BDINFO_HOST_ADDR to zero. - * b) Set TG3_BDINFO_NIC_ADDR to NIC_SRAM_TX_BUFFER_DESC - * c) TG3_BDINFO_MAXLEN_FLAGS is don't care. - * 3) Access TX descriptors directly in on-chip SRAM - * using normal {read,write}l(). (and not using - * pointer dereferencing of ioremap()'d memory like - * the broken Broadcom driver does) - * - * Note that BDINFO_FLAGS_DISABLED should be set in the flags field of - * TG3_BDINFO_MAXLEN_FLAGS of all unused SEND_RCB indices. - */ -struct tg3_tx_buffer_desc { - uint32_t addr_hi; - uint32_t addr_lo; - - uint32_t len_flags; -#define TXD_FLAG_TCPUDP_CSUM 0x0001 -#define TXD_FLAG_IP_CSUM 0x0002 -#define TXD_FLAG_END 0x0004 -#define TXD_FLAG_IP_FRAG 0x0008 -#define TXD_FLAG_IP_FRAG_END 0x0010 -#define TXD_FLAG_VLAN 0x0040 -#define TXD_FLAG_COAL_NOW 0x0080 -#define TXD_FLAG_CPU_PRE_DMA 0x0100 -#define TXD_FLAG_CPU_POST_DMA 0x0200 -#define TXD_FLAG_ADD_SRC_ADDR 0x1000 -#define TXD_FLAG_CHOOSE_SRC_ADDR 0x6000 -#define TXD_FLAG_NO_CRC 0x8000 -#define TXD_LEN_SHIFT 16 - - uint32_t vlan_tag; -#define TXD_VLAN_TAG_SHIFT 0 -#define TXD_MSS_SHIFT 16 -}; - -#define TXD_ADDR 0x00UL /* 64-bit */ -#define TXD_LEN_FLAGS 0x08UL /* 32-bit (upper 16-bits are len) */ -#define TXD_VLAN_TAG 0x0cUL /* 32-bit (upper 16-bits are tag) */ -#define TXD_SIZE 0x10UL - -struct tg3_rx_buffer_desc { - uint32_t addr_hi; - uint32_t addr_lo; - - uint32_t idx_len; -#define RXD_IDX_MASK 0xffff0000 -#define RXD_IDX_SHIFT 16 -#define RXD_LEN_MASK 0x0000ffff -#define RXD_LEN_SHIFT 0 - - uint32_t type_flags; -#define RXD_TYPE_SHIFT 16 -#define RXD_FLAGS_SHIFT 0 - -#define RXD_FLAG_END 0x0004 -#define RXD_FLAG_MINI 0x0800 -#define RXD_FLAG_JUMBO 0x0020 -#define RXD_FLAG_VLAN 0x0040 -#define RXD_FLAG_ERROR 0x0400 -#define RXD_FLAG_IP_CSUM 0x1000 -#define RXD_FLAG_TCPUDP_CSUM 0x2000 -#define RXD_FLAG_IS_TCP 0x4000 - - uint32_t ip_tcp_csum; -#define RXD_IPCSUM_MASK 0xffff0000 -#define RXD_IPCSUM_SHIFT 16 -#define RXD_TCPCSUM_MASK 0x0000ffff -#define RXD_TCPCSUM_SHIFT 0 - - uint32_t err_vlan; - -#define RXD_VLAN_MASK 0x0000ffff - -#define RXD_ERR_BAD_CRC 0x00010000 -#define RXD_ERR_COLLISION 0x00020000 -#define RXD_ERR_LINK_LOST 0x00040000 -#define RXD_ERR_PHY_DECODE 0x00080000 -#define RXD_ERR_ODD_NIBBLE_RCVD_MII 0x00100000 -#define RXD_ERR_MAC_ABRT 0x00200000 -#define RXD_ERR_TOO_SMALL 0x00400000 -#define RXD_ERR_NO_RESOURCES 0x00800000 -#define RXD_ERR_HUGE_FRAME 0x01000000 -#define RXD_ERR_MASK 0xffff0000 - - uint32_t reserved; - uint32_t opaque; -#define RXD_OPAQUE_INDEX_MASK 0x0000ffff -#define RXD_OPAQUE_INDEX_SHIFT 0 -#define RXD_OPAQUE_RING_STD 0x00010000 -#define RXD_OPAQUE_RING_JUMBO 0x00020000 -#define RXD_OPAQUE_RING_MINI 0x00040000 -#define RXD_OPAQUE_RING_MASK 0x00070000 -}; - -struct tg3_ext_rx_buffer_desc { - struct { - uint32_t addr_hi; - uint32_t addr_lo; - } addrlist[3]; - uint32_t len2_len1; - uint32_t resv_len3; - struct tg3_rx_buffer_desc std; -}; - -/* We only use this when testing out the DMA engine - * at probe time. This is the internal format of buffer - * descriptors used by the chip at NIC_SRAM_DMA_DESCS. - */ -struct tg3_internal_buffer_desc { - uint32_t addr_hi; - uint32_t addr_lo; - uint32_t nic_mbuf; - /* XXX FIX THIS */ -#if __BYTE_ORDER == __BIG_ENDIAN - uint16_t cqid_sqid; - uint16_t len; -#else - uint16_t len; - uint16_t cqid_sqid; -#endif - uint32_t flags; - uint32_t __cookie1; - uint32_t __cookie2; - uint32_t __cookie3; -}; - -#define TG3_HW_STATUS_SIZE 0x50 -struct tg3_hw_status { - uint32_t status; -#define SD_STATUS_UPDATED 0x00000001 -#define SD_STATUS_LINK_CHG 0x00000002 -#define SD_STATUS_ERROR 0x00000004 - - uint32_t status_tag; - -#if __BYTE_ORDER == __BIG_ENDIAN - uint16_t rx_consumer; - uint16_t rx_jumbo_consumer; -#else - uint16_t rx_jumbo_consumer; - uint16_t rx_consumer; -#endif - -#if __BYTE_ORDER == __BIG_ENDIAN - uint16_t reserved; - uint16_t rx_mini_consumer; -#else - uint16_t rx_mini_consumer; - uint16_t reserved; -#endif - struct { -#if __BYTE_ORDER == __BIG_ENDIAN - uint16_t tx_consumer; - uint16_t rx_producer; -#else - uint16_t rx_producer; - uint16_t tx_consumer; -#endif - } idx[16]; -}; - -typedef struct { - uint32_t high, low; -} tg3_stat64_t; - -struct tg3_hw_stats { - uint8_t __reserved0[0x400-0x300]; - - /* Statistics maintained by Receive MAC. */ - tg3_stat64_t rx_octets; - uint64_t __reserved1; - tg3_stat64_t rx_fragments; - tg3_stat64_t rx_ucast_packets; - tg3_stat64_t rx_mcast_packets; - tg3_stat64_t rx_bcast_packets; - tg3_stat64_t rx_fcs_errors; - tg3_stat64_t rx_align_errors; - tg3_stat64_t rx_xon_pause_rcvd; - tg3_stat64_t rx_xoff_pause_rcvd; - tg3_stat64_t rx_mac_ctrl_rcvd; - tg3_stat64_t rx_xoff_entered; - tg3_stat64_t rx_frame_too_long_errors; - tg3_stat64_t rx_jabbers; - tg3_stat64_t rx_undersize_packets; - tg3_stat64_t rx_in_length_errors; - tg3_stat64_t rx_out_length_errors; - tg3_stat64_t rx_64_or_less_octet_packets; - tg3_stat64_t rx_65_to_127_octet_packets; - tg3_stat64_t rx_128_to_255_octet_packets; - tg3_stat64_t rx_256_to_511_octet_packets; - tg3_stat64_t rx_512_to_1023_octet_packets; - tg3_stat64_t rx_1024_to_1522_octet_packets; - tg3_stat64_t rx_1523_to_2047_octet_packets; - tg3_stat64_t rx_2048_to_4095_octet_packets; - tg3_stat64_t rx_4096_to_8191_octet_packets; - tg3_stat64_t rx_8192_to_9022_octet_packets; - - uint64_t __unused0[37]; - - /* Statistics maintained by Transmit MAC. */ - tg3_stat64_t tx_octets; - uint64_t __reserved2; - tg3_stat64_t tx_collisions; - tg3_stat64_t tx_xon_sent; - tg3_stat64_t tx_xoff_sent; - tg3_stat64_t tx_flow_control; - tg3_stat64_t tx_mac_errors; - tg3_stat64_t tx_single_collisions; - tg3_stat64_t tx_mult_collisions; - tg3_stat64_t tx_deferred; - uint64_t __reserved3; - tg3_stat64_t tx_excessive_collisions; - tg3_stat64_t tx_late_collisions; - tg3_stat64_t tx_collide_2times; - tg3_stat64_t tx_collide_3times; - tg3_stat64_t tx_collide_4times; - tg3_stat64_t tx_collide_5times; - tg3_stat64_t tx_collide_6times; - tg3_stat64_t tx_collide_7times; - tg3_stat64_t tx_collide_8times; - tg3_stat64_t tx_collide_9times; - tg3_stat64_t tx_collide_10times; - tg3_stat64_t tx_collide_11times; - tg3_stat64_t tx_collide_12times; - tg3_stat64_t tx_collide_13times; - tg3_stat64_t tx_collide_14times; - tg3_stat64_t tx_collide_15times; - tg3_stat64_t tx_ucast_packets; - tg3_stat64_t tx_mcast_packets; - tg3_stat64_t tx_bcast_packets; - tg3_stat64_t tx_carrier_sense_errors; - tg3_stat64_t tx_discards; - tg3_stat64_t tx_errors; - - uint64_t __unused1[31]; - - /* Statistics maintained by Receive List Placement. */ - tg3_stat64_t COS_rx_packets[16]; - tg3_stat64_t COS_rx_filter_dropped; - tg3_stat64_t dma_writeq_full; - tg3_stat64_t dma_write_prioq_full; - tg3_stat64_t rxbds_empty; - tg3_stat64_t rx_discards; - tg3_stat64_t rx_errors; - tg3_stat64_t rx_threshold_hit; - - uint64_t __unused2[9]; - - /* Statistics maintained by Send Data Initiator. */ - tg3_stat64_t COS_out_packets[16]; - tg3_stat64_t dma_readq_full; - tg3_stat64_t dma_read_prioq_full; - tg3_stat64_t tx_comp_queue_full; - - /* Statistics maintained by Host Coalescing. */ - tg3_stat64_t ring_set_send_prod_index; - tg3_stat64_t ring_status_update; - tg3_stat64_t nic_irqs; - tg3_stat64_t nic_avoided_irqs; - tg3_stat64_t nic_tx_threshold_hit; - - uint8_t __reserved4[0xb00-0x9c0]; -}; - -enum phy_led_mode { - led_mode_auto, - led_mode_three_link, - led_mode_link10 -}; - -#if 0 -/* 'mapping' is superfluous as the chip does not write into - * the tx/rx post rings so we could just fetch it from there. - * But the cache behavior is better how we are doing it now. - */ -struct ring_info { - struct sk_buff *skb; - DECLARE_PCI_UNMAP_ADDR(mapping) -}; - -struct tx_ring_info { - struct sk_buff *skb; - DECLARE_PCI_UNMAP_ADDR(mapping) - uint32_t prev_vlan_tag; -}; -#endif - -struct tg3_config_info { - uint32_t flags; -}; - -struct tg3_link_config { - /* Describes what we're trying to get. */ - uint32_t advertising; -#if 0 - uint16_t speed; - uint8_t duplex; - uint8_t autoneg; -#define SPEED_INVALID 0xffff -#define DUPLEX_INVALID 0xff -#define AUTONEG_INVALID 0xff -#endif - - /* Describes what we actually have. */ - uint8_t active_speed; - uint8_t active_duplex; - - /* When we go in and out of low power mode we need - * to swap with this state. - */ -#if 0 - int phy_is_low_power; - uint16_t orig_speed; - uint8_t orig_duplex; - uint8_t orig_autoneg; -#endif -}; - -struct tg3_bufmgr_config { - uint32_t mbuf_read_dma_low_water; - uint32_t mbuf_mac_rx_low_water; - uint32_t mbuf_high_water; - - uint32_t mbuf_read_dma_low_water_jumbo; - uint32_t mbuf_mac_rx_low_water_jumbo; - uint32_t mbuf_high_water_jumbo; - - uint32_t dma_low_water; - uint32_t dma_high_water; -}; - -struct tg3 { -#if 0 - /* SMP locking strategy: - * - * lock: Held during all operations except TX packet - * processing. - * - * tx_lock: Held during tg3_start_xmit{,_4gbug} and tg3_tx - * - * If you want to shut up all asynchronous processing you must - * acquire both locks, 'lock' taken before 'tx_lock'. IRQs must - * be disabled to take 'lock' but only softirq disabling is - * necessary for acquisition of 'tx_lock'. - */ - spinlock_t lock; - spinlock_t tx_lock; -#endif - - uint32_t tx_prod; -#if 0 - uint32_t tx_cons; -#endif - uint32_t rx_rcb_ptr; - uint32_t rx_std_ptr; -#if 0 - uint32_t rx_jumbo_ptr; - spinlock_t indirect_lock; - - struct net_device_stats net_stats; - struct net_device_stats net_stats_prev; -#endif - unsigned long phy_crc_errors; - -#if 0 - uint32_t rx_offset; -#endif - uint32_t tg3_flags; -#if 0 -#define TG3_FLAG_HOST_TXDS 0x00000001 -#endif -#define TG3_FLAG_TXD_MBOX_HWBUG 0x00000002 -#define TG3_FLAG_RX_CHECKSUMS 0x00000004 -#define TG3_FLAG_USE_LINKCHG_REG 0x00000008 -#define TG3_FLAG_USE_MI_INTERRUPT 0x00000010 -#define TG3_FLAG_ENABLE_ASF 0x00000020 -#define TG3_FLAG_5701_REG_WRITE_BUG 0x00000040 -#define TG3_FLAG_POLL_SERDES 0x00000080 -#define TG3_FLAG_MBOX_WRITE_REORDER 0x00000100 -#define TG3_FLAG_PCIX_TARGET_HWBUG 0x00000200 -#define TG3_FLAG_WOL_SPEED_100MB 0x00000400 -#define TG3_FLAG_WOL_ENABLE 0x00000800 -#define TG3_FLAG_EEPROM_WRITE_PROT 0x00001000 -#define TG3_FLAG_NVRAM 0x00002000 -#define TG3_FLAG_NVRAM_BUFFERED 0x00004000 -#define TG3_FLAG_RX_PAUSE 0x00008000 -#define TG3_FLAG_TX_PAUSE 0x00010000 -#define TG3_FLAG_PCIX_MODE 0x00020000 -#define TG3_FLAG_PCI_HIGH_SPEED 0x00040000 -#define TG3_FLAG_PCI_32BIT 0x00080000 -#define TG3_FLAG_NO_TX_PSEUDO_CSUM 0x00100000 -#define TG3_FLAG_NO_RX_PSEUDO_CSUM 0x00200000 -#define TG3_FLAG_SERDES_WOL_CAP 0x00400000 -#define TG3_FLAG_JUMBO_ENABLE 0x00800000 -#define TG3_FLAG_10_100_ONLY 0x01000000 -#define TG3_FLAG_PAUSE_AUTONEG 0x02000000 -#define TG3_FLAG_PAUSE_RX 0x04000000 -#define TG3_FLAG_PAUSE_TX 0x08000000 -#define TG3_FLAG_BROKEN_CHECKSUMS 0x10000000 -#define TG3_FLAG_GOT_SERDES_FLOWCTL 0x20000000 -#define TG3_FLAG_SPLIT_MODE 0x40000000 -#define TG3_FLAG_INIT_COMPLETE 0x80000000 - - uint32_t tg3_flags2; -#define TG3_FLG2_RESTART_TIMER 0x00000001 -#define TG3_FLG2_SUN_5704 0x00000002 -#define TG3_FLG2_NO_ETH_WIRE_SPEED 0x00000004 -#define TG3_FLG2_IS_5788 0x00000008 -#define TG3_FLG2_MAX_RXPEND_64 0x00000010 -#define TG3_FLG2_TSO_CAPABLE 0x00000020 - - - - uint32_t split_mode_max_reqs; -#define SPLIT_MODE_5704_MAX_REQ 3 - -#if 0 - struct timer_list timer; - uint16_t timer_counter; - uint16_t timer_multiplier; - uint32_t timer_offset; - uint16_t asf_counter; - uint16_t asf_multiplier; -#endif - - struct tg3_link_config link_config; - struct tg3_bufmgr_config bufmgr_config; - -#if 0 - uint32_t rx_pending; - uint32_t rx_jumbo_pending; - uint32_t tx_pending; -#endif - - /* cache h/w values, often passed straight to h/w */ - uint32_t rx_mode; - uint32_t tx_mode; - uint32_t mac_mode; - uint32_t mi_mode; - uint32_t misc_host_ctrl; - uint32_t grc_mode; - uint32_t grc_local_ctrl; - uint32_t dma_rwctrl; -#if 0 - uint32_t coalesce_mode; -#endif - - /* PCI block */ - uint16_t pci_chip_rev_id; -#if 0 - uint8_t pci_cacheline_sz; - uint8_t pci_lat_timer; - uint8_t pci_hdr_type; - uint8_t pci_bist; -#endif - uint32_t pci_cfg_state[64 / sizeof(uint32_t)]; - - int pm_cap; - - /* PHY info */ - uint32_t phy_id; -#define PHY_ID_MASK 0xfffffff0 -#define PHY_ID_BCM5400 0x60008040 -#define PHY_ID_BCM5401 0x60008050 -#define PHY_ID_BCM5411 0x60008070 -#define PHY_ID_BCM5701 0x60008110 -#define PHY_ID_BCM5703 0x60008160 -#define PHY_ID_BCM5704 0x60008190 -#define PHY_ID_BCM5705 0x600081a0 -#define PHY_ID_BCM8002 0x60010140 -#define PHY_ID_SERDES 0xfeedbee0 -#define PHY_ID_INVALID 0xffffffff -#define PHY_ID_REV_MASK 0x0000000f -#define PHY_REV_BCM5401_B0 0x1 -#define PHY_REV_BCM5401_B2 0x3 -#define PHY_REV_BCM5401_C0 0x6 -#define PHY_REV_BCM5411_X0 0x1 /* Found on Netgear GA302T */ - - enum phy_led_mode led_mode; - - char board_part_number[24]; - uint32_t nic_sram_data_cfg; - uint32_t pci_clock_ctrl; -#if 0 - struct pci_device *pdev_peer; -#endif - - /* This macro assumes the passed PHY ID is already masked - * with PHY_ID_MASK. - */ -#define KNOWN_PHY_ID(X) \ - ((X) == PHY_ID_BCM5400 || (X) == PHY_ID_BCM5401 || \ - (X) == PHY_ID_BCM5411 || (X) == PHY_ID_BCM5701 || \ - (X) == PHY_ID_BCM5703 || (X) == PHY_ID_BCM5704 || \ - (X) == PHY_ID_BCM5705 || \ - (X) == PHY_ID_BCM8002 || (X) == PHY_ID_SERDES) - - unsigned long regs; - struct pci_device *pdev; - struct nic *nic; -#if 0 - struct net_device *dev; -#endif -#if TG3_VLAN_TAG_USED - struct vlan_group *vlgrp; -#endif - - struct tg3_rx_buffer_desc *rx_std; -#if 0 - struct ring_info *rx_std_buffers; - dma_addr_t rx_std_mapping; - struct tg3_rx_buffer_desc *rx_jumbo; - struct ring_info *rx_jumbo_buffers; - dma_addr_t rx_jumbo_mapping; -#endif - - struct tg3_rx_buffer_desc *rx_rcb; -#if 0 - dma_addr_t rx_rcb_mapping; -#endif - - /* TX descs are only used if TG3_FLAG_HOST_TXDS is set. */ - struct tg3_tx_buffer_desc *tx_ring; -#if 0 - struct tx_ring_info *tx_buffers; - dma_addr_t tx_desc_mapping; -#endif - - struct tg3_hw_status *hw_status; -#if 0 - dma_addr_t status_mapping; -#endif -#if 0 - uint32_t msg_enable; -#endif - - struct tg3_hw_stats *hw_stats; -#if 0 - dma_addr_t stats_mapping; -#endif - - int carrier_ok; - uint16_t subsystem_vendor; - uint16_t subsystem_device; -}; - -#endif /* !(_T3_H) */ diff --git a/usr/src/grub/grub-0.95/netboot/timer.c b/usr/src/grub/grub-0.95/netboot/timer.c deleted file mode 100644 index e4f62421e5..0000000000 --- a/usr/src/grub/grub-0.95/netboot/timer.c +++ /dev/null @@ -1,29 +0,0 @@ -/* A couple of routines to implement a low-overhead timer for drivers */ - - /* - * 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. - */ -#include "grub.h" -#include "timer.h" - -/* Machine Independant timer helper functions */ - -void mdelay(unsigned int msecs) -{ - unsigned int i; - for(i = 0; i < msecs; i++) { - udelay(1000); - poll_interruptions(); - } -} - -void waiton_timer2(unsigned int ticks) -{ - load_timer2(ticks); - while(timer2_running()) { - poll_interruptions(); - } -} diff --git a/usr/src/grub/grub-0.95/netboot/timer.h b/usr/src/grub/grub-0.95/netboot/timer.h deleted file mode 100644 index e9ab9ddcd8..0000000000 --- a/usr/src/grub/grub-0.95/netboot/timer.h +++ /dev/null @@ -1,68 +0,0 @@ -/* Defines for routines to implement a low-overhead timer for drivers */ - - /* - * 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. - */ - -#ifndef TIMER_H -#define TIMER_H - -/* Ports for the 8254 timer chip */ -#define TIMER2_PORT 0x42 -#define TIMER_MODE_PORT 0x43 - -/* Meaning of the mode bits */ -#define TIMER0_SEL 0x00 -#define TIMER1_SEL 0x40 -#define TIMER2_SEL 0x80 -#define READBACK_SEL 0xC0 - -#define LATCH_COUNT 0x00 -#define LOBYTE_ACCESS 0x10 -#define HIBYTE_ACCESS 0x20 -#define WORD_ACCESS 0x30 - -#define MODE0 0x00 -#define MODE1 0x02 -#define MODE2 0x04 -#define MODE3 0x06 -#define MODE4 0x08 -#define MODE5 0x0A - -#define BINARY_COUNT 0x00 -#define BCD_COUNT 0x01 - -/* Timers tick over at this rate */ -#define CLOCK_TICK_RATE 1193180U -#define TICKS_PER_MS (CLOCK_TICK_RATE/1000) - -/* Parallel Peripheral Controller Port B */ -#define PPC_PORTB 0x61 - -/* Meaning of the port bits */ -#define PPCB_T2OUT 0x20 /* Bit 5 */ -#define PPCB_SPKR 0x02 /* Bit 1 */ -#define PPCB_T2GATE 0x01 /* Bit 0 */ - -/* Ticks must be between 0 and 65535 (0 == 65536) - because it is a 16 bit counter */ -extern void load_timer2(unsigned int ticks); -extern inline int timer2_running(void); -extern void waiton_timer2(unsigned int ticks); -extern void __load_timer2(unsigned int ticks); - -extern void setup_timers(void); -extern void ndelay(unsigned int nsecs); -extern void udelay(unsigned int usecs); -extern void mdelay(unsigned int msecs); -//extern unsigned long currticks(void); - -struct timeval { - long tv_sec; - long tv_usec; -}; - -#endif /* TIMER_H */ diff --git a/usr/src/grub/grub-0.95/netboot/tlan.c b/usr/src/grub/grub-0.95/netboot/tlan.c deleted file mode 100644 index df52c98d2a..0000000000 --- a/usr/src/grub/grub-0.95/netboot/tlan.c +++ /dev/null @@ -1,1814 +0,0 @@ -#define EB51 - -#ifdef EB50 -#define __unused __attribute__((unused)) -#endif - -/************************************************************************** -* -* tlan.c -- Etherboot device driver for the Texas Instruments ThunderLAN -* Written 2003-2003 by Timothy Legge -* -* 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. -* -* Portions of this code based on: -* lan.c: Linux ThunderLan Driver: -* -* by James Banks -* -* (C) 1997-1998 Caldera, Inc. -* (C) 1998 James Banks -* (C) 1999-2001 Torben Mathiasen -* (C) 2002 Samuel Chessman -* -* REVISION HISTORY: -* ================ -* v1.0 07-08-2003 timlegge Initial not quite working version -* v1.1 07-27-2003 timlegge Sync 5.0 and 5.1 versions -* v1.2 08-19-2003 timlegge Implement Multicast Support -* v1.3 08-23-2003 timlegge Fix the transmit Function -* v1.4 01-17-2004 timlegge Initial driver output cleanup -* -* Indent Options: indent -kr -i8 -***************************************************************************/ - -/* to get some global routines like printf */ -#include "etherboot.h" -/* to get the interface to the body of the program */ -#include "nic.h" -/* to get the PCI support functions, if this is a PCI NIC */ -#include "pci.h" -#include "timer.h" -#include "tlan.h" - -#define drv_version "v1.4" -#define drv_date "01-17-2004" - -/* NIC specific static variables go here */ -#define HZ 100 -#define TX_TIME_OUT (6*HZ) - -#ifdef EB50 -#define cpu_to_le32(val) (val) -#define le32_to_cpu(val) (val) -#define virt_to_bus(x) ((unsigned long) x) -#define bus_to_virt(x) ((unsigned long) x) -#endif - -/* Condensed operations for readability. */ -#define virt_to_le32desc(addr) cpu_to_le32(virt_to_bus(addr)) -#define le32desc_to_virt(addr) bus_to_virt(le32_to_cpu(addr)) - - -static void TLan_ResetLists(struct nic *nic __unused); -static void TLan_ResetAdapter(struct nic *nic __unused); -static void TLan_FinishReset(struct nic *nic __unused); - -static void TLan_EeSendStart(u16); -static int TLan_EeSendByte(u16, u8, int); -static void TLan_EeReceiveByte(u16, u8 *, int); -static int TLan_EeReadByte(u16 io_base, u8, u8 *); - -static void TLan_PhyDetect(struct nic *nic); -static void TLan_PhyPowerDown(struct nic *nic); -static void TLan_PhyPowerUp(struct nic *nic); - - -static void TLan_SetMac(struct nic *nic __unused, int areg, char *mac); - -static void TLan_PhyReset(struct nic *nic); -static void TLan_PhyStartLink(struct nic *nic); -static void TLan_PhyFinishAutoNeg(struct nic *nic); - -#ifdef MONITOR -static void TLan_PhyMonitor(struct nic *nic); -#endif - - -static void refill_rx(struct nic *nic __unused); - -static int TLan_MiiReadReg(struct nic *nic __unused, u16, u16, u16 *); -static void TLan_MiiSendData(u16, u32, unsigned); -static void TLan_MiiSync(u16); -static void TLan_MiiWriteReg(struct nic *nic __unused, u16, u16, u16); - - -const char *media[] = { - "10BaseT-HD ", "10BaseT-FD ", "100baseTx-HD ", - "100baseTx-FD", "100baseT4", 0 -}; - -/* This much match tlan_pci_tbl[]! */ -enum tlan_nics { - NETEL10 = 0, NETEL100 = 1, NETFLEX3I = 2, THUNDER = 3, NETFLEX3B = - 4, NETEL100PI = 5, - NETEL100D = 6, NETEL100I = 7, OC2183 = 8, OC2325 = 9, OC2326 = - 10, NETELLIGENT_10_100_WS_5100 = 11, - NETELLIGENT_10_T2 = 12 -}; - -struct pci_id_info { - const char *name; - int nic_id; - struct match_info { - u32 pci, pci_mask, subsystem, subsystem_mask; - u32 revision, revision_mask; /* Only 8 bits. */ - } id; - u32 flags; - u16 addrOfs; /* Address Offset */ -}; - -static struct pci_id_info tlan_pci_tbl[] = { - {"Compaq Netelligent 10 T PCI UTP", NETEL10, - {0xae340e11, 0xffffffff, 0, 0, 0, 0}, - TLAN_ADAPTER_ACTIVITY_LED, 0x83}, - {"Compaq Netelligent 10/100 TX PCI UTP", NETEL100, - {0xae320e11, 0xffffffff, 0, 0, 0, 0}, - TLAN_ADAPTER_ACTIVITY_LED, 0x83}, - {"Compaq Integrated NetFlex-3/P", NETFLEX3I, - {0xae350e11, 0xffffffff, 0, 0, 0, 0}, - TLAN_ADAPTER_NONE, 0x83}, - {"Compaq NetFlex-3/P", THUNDER, - {0xf1300e11, 0xffffffff, 0, 0, 0, 0}, - TLAN_ADAPTER_UNMANAGED_PHY | TLAN_ADAPTER_BIT_RATE_PHY, 0x83}, - {"Compaq NetFlex-3/P", NETFLEX3B, - {0xf1500e11, 0xffffffff, 0, 0, 0, 0}, - TLAN_ADAPTER_NONE, 0x83}, - {"Compaq Netelligent Integrated 10/100 TX UTP", NETEL100PI, - {0xae430e11, 0xffffffff, 0, 0, 0, 0}, - TLAN_ADAPTER_ACTIVITY_LED, 0x83}, - {"Compaq Netelligent Dual 10/100 TX PCI UTP", NETEL100D, - {0xae400e11, 0xffffffff, 0, 0, 0, 0}, - TLAN_ADAPTER_NONE, 0x83}, - {"Compaq Netelligent 10/100 TX Embedded UTP", NETEL100I, - {0xb0110e11, 0xffffffff, 0, 0, 0, 0}, - TLAN_ADAPTER_NONE, 0x83}, - {"Olicom OC-2183/2185", OC2183, - {0x0013108d, 0xffffffff, 0, 0, 0, 0}, - TLAN_ADAPTER_USE_INTERN_10, 0x83}, - {"Olicom OC-2325", OC2325, - {0x0012108d, 0xffffffff, 0, 0, 0, 0}, - TLAN_ADAPTER_UNMANAGED_PHY, 0xF8}, - {"Olicom OC-2326", OC2326, - {0x0014108d, 0xffffffff, 0, 0, 0, 0}, - TLAN_ADAPTER_USE_INTERN_10, 0xF8}, - {"Compaq Netelligent 10/100 TX UTP", NETELLIGENT_10_100_WS_5100, - {0xb0300e11, 0xffffffff, 0, 0, 0, 0}, - TLAN_ADAPTER_ACTIVITY_LED, 0x83}, - {"Compaq Netelligent 10 T/2 PCI UTP/Coax", NETELLIGENT_10_T2, - {0xb0120e11, 0xffffffff, 0, 0, 0, 0}, - TLAN_ADAPTER_NONE, 0x83}, - {"Compaq NetFlex-3/E", 0, /* EISA card */ - {0, 0, 0, 0, 0, 0}, - TLAN_ADAPTER_ACTIVITY_LED | TLAN_ADAPTER_UNMANAGED_PHY | - TLAN_ADAPTER_BIT_RATE_PHY, 0x83}, - {"Compaq NetFlex-3/E", 0, /* EISA card */ - {0, 0, 0, 0, 0, 0}, - TLAN_ADAPTER_ACTIVITY_LED, 0x83}, - {0, 0, - {0, 0, 0, 0, 0, 0}, - 0, 0}, -}; - - -struct TLanList { - u32 forward; - u16 cStat; - u16 frameSize; - struct { - u32 count; - u32 address; - } buffer[TLAN_BUFFERS_PER_LIST]; -}; - - - -struct TLanList tx_ring[TLAN_NUM_TX_LISTS]; -static unsigned char txb[TLAN_MAX_FRAME_SIZE * TLAN_NUM_TX_LISTS]; - -struct TLanList rx_ring[TLAN_NUM_RX_LISTS]; -static unsigned char rxb[TLAN_MAX_FRAME_SIZE * TLAN_NUM_RX_LISTS]; - -typedef u8 TLanBuffer[TLAN_MAX_FRAME_SIZE]; - - -int chip_idx; - - -/***************************************************************** -* TLAN Private Information Structure -* -****************************************************************/ -struct tlan_private { - unsigned short vendor_id; /* PCI Vendor code */ - unsigned short dev_id; /* PCI Device code */ - const char *nic_name; - u8 *padBuffer; - u8 *rxBuffer; - struct TLanList *rx_head_desc; - u32 rxHead; - u32 rxTail; - u32 rxEocCount; - unsigned int cur_rx, dirty_rx; /* Producer/consumer ring indicies */ - unsigned int cur_tx, dirty_tx; - unsigned rx_buf_sz; /* Based on mtu + Slack */ - struct TLanList *txList; - struct TLanList *rxList; - u8 *txBuffer; - u32 txHead; - u32 txInProgress; - u32 txTail; - int eoc; - u32 txBusyCount; - u32 phyOnline; - u32 timerSetAt; - u32 timerType; - u32 adapterRev; - u32 aui; - u32 debug; - u32 duplex; - u32 phy[2]; - u32 phyNum; - u32 speed; - u8 tlanRev; - u8 tlanFullDuplex; - char devName[8]; - u8 link; - u8 is_eisa; - u8 neg_be_verbose; -} TLanPrivateInfo; - -static struct tlan_private *priv; - -u32 BASE; - - - -/*************************************************************** -* TLan_ResetLists -* -* Returns: -* Nothing -* Parms: -* dev The device structure with the list -* stuctures to be reset. -* -* This routine sets the variables associated with managing -* the TLAN lists to their initial values. -* -**************************************************************/ - -void TLan_ResetLists(struct nic *nic __unused) -{ - - int i; - struct TLanList *list; - priv->txHead = 0; - priv->txTail = 0; - - for (i = 0; i < TLAN_NUM_TX_LISTS; i++) { - list = &tx_ring[i]; - list->cStat = TLAN_CSTAT_UNUSED; -/* list->buffer[0].address = 0; */ - list->buffer[0].address = virt_to_bus(txb + - (i * TLAN_MAX_FRAME_SIZE)); - list->buffer[2].count = 0; - list->buffer[2].address = 0; - list->buffer[9].address = 0; -/* list->forward = 0; */ - } - - priv->cur_rx = 0; - priv->rx_buf_sz = (TLAN_MAX_FRAME_SIZE); - priv->rx_head_desc = &rx_ring[0]; - - /* Initialize all the Rx descriptors */ - for (i = 0; i < TLAN_NUM_RX_LISTS; i++) { - rx_ring[i].forward = virt_to_le32desc(&rx_ring[i + 1]); - rx_ring[i].cStat = TLAN_CSTAT_READY; - rx_ring[i].frameSize = TLAN_MAX_FRAME_SIZE; - rx_ring[i].buffer[0].count = - TLAN_MAX_FRAME_SIZE | TLAN_LAST_BUFFER; - rx_ring[i].buffer[0].address = - virt_to_le32desc(&rxb[i * TLAN_MAX_FRAME_SIZE]); - rx_ring[i].buffer[1].count = 0; - rx_ring[i].buffer[1].address = 0; - } - - /* Mark the last entry as wrapping the ring */ - rx_ring[i - 1].forward = virt_to_le32desc(&rx_ring[0]); - priv->dirty_rx = (unsigned int) (i - TLAN_NUM_RX_LISTS); - -} /* TLan_ResetLists */ - -/*************************************************************** -* TLan_Reset -* -* Returns: -* 0 -* Parms: -* dev Pointer to device structure of adapter -* to be reset. -* -* This function resets the adapter and it's physical -* device. See Chap. 3, pp. 9-10 of the "ThunderLAN -* Programmer's Guide" for details. The routine tries to -* implement what is detailed there, though adjustments -* have been made. -* -**************************************************************/ - -void TLan_ResetAdapter(struct nic *nic __unused) -{ - int i; - u32 addr; - u32 data; - u8 data8; - - priv->tlanFullDuplex = FALSE; - priv->phyOnline = 0; -/* 1. Assert reset bit. */ - - data = inl(BASE + TLAN_HOST_CMD); - data |= TLAN_HC_AD_RST; - outl(data, BASE + TLAN_HOST_CMD); - - udelay(1000); - -/* 2. Turn off interrupts. ( Probably isn't necessary ) */ - - data = inl(BASE + TLAN_HOST_CMD); - data |= TLAN_HC_INT_OFF; - outl(data, BASE + TLAN_HOST_CMD); -/* 3. Clear AREGs and HASHs. */ - - for (i = TLAN_AREG_0; i <= TLAN_HASH_2; i += 4) { - TLan_DioWrite32(BASE, (u16) i, 0); - } - -/* 4. Setup NetConfig register. */ - - data = - TLAN_NET_CFG_1FRAG | TLAN_NET_CFG_1CHAN | TLAN_NET_CFG_PHY_EN; - TLan_DioWrite16(BASE, TLAN_NET_CONFIG, (u16) data); - -/* 5. Load Ld_Tmr and Ld_Thr in HOST_CMD. */ - - outl(TLAN_HC_LD_TMR | 0x3f, BASE + TLAN_HOST_CMD); - outl(TLAN_HC_LD_THR | 0x0, BASE + TLAN_HOST_CMD); - -/* 6. Unreset the MII by setting NMRST (in NetSio) to 1. */ - - outw(TLAN_NET_SIO, BASE + TLAN_DIO_ADR); - addr = BASE + TLAN_DIO_DATA + TLAN_NET_SIO; - TLan_SetBit(TLAN_NET_SIO_NMRST, addr); - -/* 7. Setup the remaining registers. */ - - if (priv->tlanRev >= 0x30) { - data8 = TLAN_ID_TX_EOC | TLAN_ID_RX_EOC; - TLan_DioWrite8(BASE, TLAN_INT_DIS, data8); - } - TLan_PhyDetect(nic); - data = TLAN_NET_CFG_1FRAG | TLAN_NET_CFG_1CHAN; - - if (tlan_pci_tbl[chip_idx].flags & TLAN_ADAPTER_BIT_RATE_PHY) { - data |= TLAN_NET_CFG_BIT; - if (priv->aui == 1) { - TLan_DioWrite8(BASE, TLAN_ACOMMIT, 0x0a); - } else if (priv->duplex == TLAN_DUPLEX_FULL) { - TLan_DioWrite8(BASE, TLAN_ACOMMIT, 0x00); - priv->tlanFullDuplex = TRUE; - } else { - TLan_DioWrite8(BASE, TLAN_ACOMMIT, 0x08); - } - } - - if (priv->phyNum == 0) { - data |= TLAN_NET_CFG_PHY_EN; - } - TLan_DioWrite16(BASE, TLAN_NET_CONFIG, (u16) data); - - if (tlan_pci_tbl[chip_idx].flags & TLAN_ADAPTER_UNMANAGED_PHY) { - TLan_FinishReset(nic); - } else { - TLan_PhyPowerDown(nic); - } - -} /* TLan_ResetAdapter */ - -void TLan_FinishReset(struct nic *nic) -{ - - u8 data; - u32 phy; - u8 sio; - u16 status; - u16 partner; - u16 tlphy_ctl; - u16 tlphy_par; - u16 tlphy_id1, tlphy_id2; - int i; - - phy = priv->phy[priv->phyNum]; - - data = TLAN_NET_CMD_NRESET | TLAN_NET_CMD_NWRAP; - if (priv->tlanFullDuplex) { - data |= TLAN_NET_CMD_DUPLEX; - } - TLan_DioWrite8(BASE, TLAN_NET_CMD, data); - data = TLAN_NET_MASK_MASK4 | TLAN_NET_MASK_MASK5; - if (priv->phyNum == 0) { - data |= TLAN_NET_MASK_MASK7; - } - TLan_DioWrite8(BASE, TLAN_NET_MASK, data); - TLan_DioWrite16(BASE, TLAN_MAX_RX, ((1536) + 7) & ~7); - TLan_MiiReadReg(nic, phy, MII_GEN_ID_HI, &tlphy_id1); - TLan_MiiReadReg(nic, phy, MII_GEN_ID_LO, &tlphy_id2); - - if ((tlan_pci_tbl[chip_idx].flags & TLAN_ADAPTER_UNMANAGED_PHY) - || (priv->aui)) { - status = MII_GS_LINK; - printf("TLAN: %s: Link forced.\n", priv->nic_name); - } else { - TLan_MiiReadReg(nic, phy, MII_GEN_STS, &status); - udelay(1000); - TLan_MiiReadReg(nic, phy, MII_GEN_STS, &status); - if ((status & MII_GS_LINK) && /* We only support link info on Nat.Sem. PHY's */ - (tlphy_id1 == NAT_SEM_ID1) - && (tlphy_id2 == NAT_SEM_ID2)) { - TLan_MiiReadReg(nic, phy, MII_AN_LPA, &partner); - TLan_MiiReadReg(nic, phy, TLAN_TLPHY_PAR, - &tlphy_par); - - printf("TLAN: %s: Link active with ", - priv->nic_name); - if (!(tlphy_par & TLAN_PHY_AN_EN_STAT)) { - printf("forced 10%sMbps %s-Duplex\n", - tlphy_par & TLAN_PHY_SPEED_100 ? "" - : "0", - tlphy_par & TLAN_PHY_DUPLEX_FULL ? - "Full" : "Half"); - } else { - printf - ("AutoNegotiation enabled, at 10%sMbps %s-Duplex\n", - tlphy_par & TLAN_PHY_SPEED_100 ? "" : - "0", - tlphy_par & TLAN_PHY_DUPLEX_FULL ? - "Full" : "Half"); - printf("TLAN: Partner capability: "); - for (i = 5; i <= 10; i++) - if (partner & (1 << i)) - printf("%s", media[i - 5]); - printf("\n"); - } - - TLan_DioWrite8(BASE, TLAN_LED_REG, TLAN_LED_LINK); -#ifdef MONITOR - /* We have link beat..for now anyway */ - priv->link = 1; - /*Enabling link beat monitoring */ - /* TLan_SetTimer( nic, (10*HZ), TLAN_TIMER_LINK_BEAT ); */ - mdelay(10000); - TLan_PhyMonitor(nic); -#endif - } else if (status & MII_GS_LINK) { - printf("TLAN: %s: Link active\n", priv->nic_name); - TLan_DioWrite8(BASE, TLAN_LED_REG, TLAN_LED_LINK); - } - } - - if (priv->phyNum == 0) { - TLan_MiiReadReg(nic, phy, TLAN_TLPHY_CTL, &tlphy_ctl); - tlphy_ctl |= TLAN_TC_INTEN; - TLan_MiiWriteReg(nic, phy, TLAN_TLPHY_CTL, tlphy_ctl); - sio = TLan_DioRead8(BASE, TLAN_NET_SIO); - sio |= TLAN_NET_SIO_MINTEN; - TLan_DioWrite8(BASE, TLAN_NET_SIO, sio); - } - - if (status & MII_GS_LINK) { - TLan_SetMac(nic, 0, nic->node_addr); - priv->phyOnline = 1; - outb((TLAN_HC_INT_ON >> 8), BASE + TLAN_HOST_CMD + 1); -/* if ( debug >= 1 && debug != TLAN_DEBUG_PROBE ) { - outb( ( TLAN_HC_REQ_INT >> 8 ), BASE + TLAN_HOST_CMD + 1 ); - } - - */ - outl(virt_to_bus(&rx_ring), BASE + TLAN_CH_PARM); - outl(TLAN_HC_GO | TLAN_HC_RT, BASE + TLAN_HOST_CMD); - } else { - printf - ("TLAN: %s: Link inactive, will retry in 10 secs...\n", - priv->nic_name); - /* TLan_SetTimer( nic, (10*HZ), TLAN_TIMER_FINISH_RESET ); */ - mdelay(10000); - TLan_FinishReset(nic); - return; - - } - -} /* TLan_FinishReset */ - -/************************************************************************** -POLL - Wait for a frame -***************************************************************************/ -static int tlan_poll(struct nic *nic, int retrieve) -{ - /* return true if there's an ethernet packet ready to read */ - /* nic->packet should contain data on return */ - /* nic->packetlen should contain length of data */ - u32 framesize; - u32 host_cmd = 0; - u32 ack = 1; - int eoc = 0; - int entry = priv->cur_rx % TLAN_NUM_RX_LISTS; - u16 tmpCStat = le32_to_cpu(rx_ring[entry].cStat); - u16 host_int = inw(BASE + TLAN_HOST_INT); - - if ((tmpCStat & TLAN_CSTAT_FRM_CMP) && !retrieve) - return 1; - - outw(host_int, BASE + TLAN_HOST_INT); - - if (!(tmpCStat & TLAN_CSTAT_FRM_CMP)) - return 0; - - /* printf("PI-1: 0x%hX\n", host_int); */ - if (tmpCStat & TLAN_CSTAT_EOC) - eoc = 1; - - framesize = rx_ring[entry].frameSize; - - nic->packetlen = framesize; - -#ifdef EBDEBUG - printf(".%d.", framesize); -#endif - - memcpy(nic->packet, rxb + - (priv->cur_rx * TLAN_MAX_FRAME_SIZE), nic->packetlen); - - rx_ring[entry].cStat = 0; -#ifdef EBDEBUG - hex_dump(nic->packet, nic->packetlen); - printf("%d", entry); -#endif - entry = (entry + 1) % TLAN_NUM_RX_LISTS; - priv->cur_rx = entry; - if (eoc) { - if ((rx_ring[entry].cStat & TLAN_CSTAT_READY) == - TLAN_CSTAT_READY) { - ack |= TLAN_HC_GO | TLAN_HC_RT; - host_cmd = TLAN_HC_ACK | ack | 0x001C0000; - outl(host_cmd, BASE + TLAN_HOST_CMD); - } - } else { - host_cmd = TLAN_HC_ACK | ack | (0x000C0000); - outl(host_cmd, BASE + TLAN_HOST_CMD); -#ifdef EBDEBUG - printf("AC: 0x%hX\n", inw(BASE + TLAN_CH_PARM)); - host_int = inw(BASE + TLAN_HOST_INT); - printf("PI-2: 0x%hX\n", host_int); -#endif - } - refill_rx(nic); - return (1); /* initially as this is called to flush the input */ -} - -static void refill_rx(struct nic *nic __unused) -{ - int entry = 0; - - for (; - (priv->cur_rx - priv->dirty_rx + - TLAN_NUM_RX_LISTS) % TLAN_NUM_RX_LISTS > 0; - priv->dirty_rx = (priv->dirty_rx + 1) % TLAN_NUM_RX_LISTS) { - entry = priv->dirty_rx % TLAN_NUM_TX_LISTS; - rx_ring[entry].frameSize = TLAN_MAX_FRAME_SIZE; - rx_ring[entry].cStat = TLAN_CSTAT_READY; - } - -} - -/* #define EBDEBUG */ -/************************************************************************** -TRANSMIT - Transmit a frame -***************************************************************************/ -static void tlan_transmit(struct nic *nic, const char *d, /* Destination */ - unsigned int t, /* Type */ - unsigned int s, /* size */ - const char *p) -{ /* Packet */ - u16 nstype; - u32 to; - struct TLanList *tail_list; - struct TLanList *head_list; - u8 *tail_buffer; - u32 ack = 0; - u32 host_cmd; - int eoc = 0; - u16 tmpCStat; -#ifdef EBDEBUG - u16 host_int = inw(BASE + TLAN_HOST_INT); -#endif - int entry = 0; - -#ifdef EBDEBUG - printf("INT0-0x%hX\n", host_int); -#endif - - if (!priv->phyOnline) { - printf("TRANSMIT: %s PHY is not ready\n", priv->nic_name); - return; - } - - tail_list = priv->txList + priv->txTail; - - if (tail_list->cStat != TLAN_CSTAT_UNUSED) { - printf("TRANSMIT: %s is busy (Head=%d Tail=%d)\n", - priv->nic_name, priv->txList, priv->txTail); - tx_ring[entry].cStat = TLAN_CSTAT_UNUSED; - priv->txBusyCount++; - return; - } - - tail_list->forward = 0; - - tail_buffer = txb + (priv->txTail * TLAN_MAX_FRAME_SIZE); - - /* send the packet to destination */ - memcpy(tail_buffer, d, ETH_ALEN); - memcpy(tail_buffer + ETH_ALEN, nic->node_addr, ETH_ALEN); - nstype = htons((u16) t); - memcpy(tail_buffer + 2 * ETH_ALEN, (u8 *) & nstype, 2); - memcpy(tail_buffer + ETH_HLEN, p, s); - - s += ETH_HLEN; - s &= 0x0FFF; - while (s < ETH_ZLEN) - tail_buffer[s++] = '\0'; - - /*=====================================================*/ - /* Receive - * 0000 0000 0001 1100 - * 0000 0000 0000 1100 - * 0000 0000 0000 0011 = 0x0003 - * - * 0000 0000 0000 0000 0000 0000 0000 0011 - * 0000 0000 0000 1100 0000 0000 0000 0000 = 0x000C0000 - * - * Transmit - * 0000 0000 0001 1100 - * 0000 0000 0000 0100 - * 0000 0000 0000 0001 = 0x0001 - * - * 0000 0000 0000 0000 0000 0000 0000 0001 - * 0000 0000 0000 0100 0000 0000 0000 0000 = 0x00040000 - * */ - - /* Setup the transmit descriptor */ - tail_list->frameSize = (u16) s; - tail_list->buffer[0].count = TLAN_LAST_BUFFER | (u32) s; - tail_list->buffer[1].count = 0; - tail_list->buffer[1].address = 0; - - tail_list->cStat = TLAN_CSTAT_READY; - -#ifdef EBDEBUG - host_int = inw(BASE + TLAN_HOST_INT); - printf("INT1-0x%hX\n", host_int); -#endif - - if (!priv->txInProgress) { - priv->txInProgress = 1; - outl(virt_to_le32desc(tail_list), BASE + TLAN_CH_PARM); - outl(TLAN_HC_GO, BASE + TLAN_HOST_CMD); - } else { - if (priv->txTail == 0) { -#ifdef EBDEBUG - printf("Out buffer\n"); -#endif - (priv->txList + (TLAN_NUM_TX_LISTS - 1))->forward = - virt_to_le32desc(tail_list); - } else { -#ifdef EBDEBUG - printf("Fix this \n"); -#endif - (priv->txList + (priv->txTail - 1))->forward = - virt_to_le32desc(tail_list); - } - } - - CIRC_INC(priv->txTail, TLAN_NUM_TX_LISTS); - -#ifdef EBDEBUG - host_int = inw(BASE + TLAN_HOST_INT); - printf("INT2-0x%hX\n", host_int); -#endif - - to = currticks() + TX_TIME_OUT; - while ((tail_list->cStat == TLAN_CSTAT_READY) && currticks() < to); - - head_list = priv->txList + priv->txHead; - while (((tmpCStat = head_list->cStat) & TLAN_CSTAT_FRM_CMP) - && (ack < 255)) { - ack++; - if(tmpCStat & TLAN_CSTAT_EOC) - eoc =1; - head_list->cStat = TLAN_CSTAT_UNUSED; - CIRC_INC(priv->txHead, TLAN_NUM_TX_LISTS); - head_list = priv->txList + priv->txHead; - - } - if(!ack) - printf("Incomplete TX Frame\n"); - - if(eoc) { - head_list = priv->txList + priv->txHead; - if ((head_list->cStat & TLAN_CSTAT_READY) == TLAN_CSTAT_READY) { - outl(virt_to_le32desc(head_list), BASE + TLAN_CH_PARM); - ack |= TLAN_HC_GO; - } else { - priv->txInProgress = 0; - } - } - if(ack) { - host_cmd = TLAN_HC_ACK | ack; - outl(host_cmd, BASE + TLAN_HOST_CMD); - } - - if(priv->tlanRev < 0x30 ) { - ack = 1; - head_list = priv->txList + priv->txHead; - if ((head_list->cStat & TLAN_CSTAT_READY) == TLAN_CSTAT_READY) { - outl(virt_to_le32desc(head_list), BASE + TLAN_CH_PARM); - ack |= TLAN_HC_GO; - } else { - priv->txInProgress = 0; - } - host_cmd = TLAN_HC_ACK | ack | 0x00140000; - outl(host_cmd, BASE + TLAN_HOST_CMD); - - } - - if (currticks() >= to) { - printf("TX Time Out"); - } -} - -/************************************************************************** -DISABLE - Turn off ethernet interface -***************************************************************************/ -#ifdef EB51 -static void tlan_disable(struct dev *dev __unused) -#else -static void tlan_disable(struct nic *nic __unused) -#endif -{ - /* put the card in its initial state */ - /* This function serves 3 purposes. - * This disables DMA and interrupts so we don't receive - * unexpected packets or interrupts from the card after - * etherboot has finished. - * This frees resources so etherboot may use - * this driver on another interface - * This allows etherboot to reinitialize the interface - * if something is something goes wrong. - * - */ - outl(TLAN_HC_AD_RST, BASE + TLAN_HOST_CMD); -} - -/************************************************************************** -IRQ - Enable, Disable, or Force interrupts -***************************************************************************/ -static void tlan_irq(struct nic *nic __unused, irq_action_t action __unused) -{ - switch ( action ) { - case DISABLE : - break; - case ENABLE : - break; - case FORCE : - break; - } -} - -static void TLan_SetMulticastList(struct nic *nic) { - int i; - u8 tmp; - - /* !IFF_PROMISC */ - tmp = TLan_DioRead8(BASE, TLAN_NET_CMD); - TLan_DioWrite8(BASE, TLAN_NET_CMD, tmp & ~TLAN_NET_CMD_CAF); - - /* IFF_ALLMULTI */ - for(i = 0; i< 3; i++) - TLan_SetMac(nic, i + 1, NULL); - TLan_DioWrite32(BASE, TLAN_HASH_1, 0xFFFFFFFF); - TLan_DioWrite32(BASE, TLAN_HASH_2, 0xFFFFFFFF); - - -} -/************************************************************************** -PROBE - Look for an adapter, this routine's visible to the outside -***************************************************************************/ - -#define board_found 1 -#define valid_link 0 -#ifdef EB51 -static int tlan_probe(struct dev *dev, struct pci_device *pci) -{ - struct nic *nic = (struct nic *) dev; -#else -struct nic *tlan_probe(struct nic *nic, unsigned short *io_addrs, struct pci_device *pci) -{ -#endif - u16 data = 0; - int err; - int i; - - if (pci->ioaddr == 0) - return 0; - - nic->irqno = 0; - nic->ioaddr = pci->ioaddr & ~3; - - BASE = pci->ioaddr; - printf("\n"); - printf("tlan.c: %s, %s\n", drv_version, drv_date); - printf("%s: Probing for Vendor 0x%hX, Device 0x%hX", - pci->name, pci->vendor, pci->dev_id); - - - /* I really must find out what this does */ - adjust_pci_device(pci); - - /* Point to private storage */ - priv = &TLanPrivateInfo; - /* Figure out which chip we're dealing with */ - i = 0; - chip_idx = -1; - - while (tlan_pci_tbl[i].name) { - if ((((u32) pci->dev_id << 16) | pci->vendor) == - (tlan_pci_tbl[i].id.pci & 0xffffffff)) { - chip_idx = i; - break; - } - i++; - } - - priv->vendor_id = pci->vendor; - priv->dev_id = pci->dev_id; - priv->nic_name = pci->name; - priv->eoc = 0; - - err = 0; - for (i = 0; i < 6; i++) - err |= TLan_EeReadByte(BASE, - (u8) tlan_pci_tbl[chip_idx]. - addrOfs + i, - (u8 *) & nic->node_addr[i]); - if (err) { - printf("TLAN: %s: Error reading MAC from eeprom: %d\n", - pci->name, err); - } else - printf("\nAddress: %!\n", nic->node_addr); - - priv->tlanRev = TLan_DioRead8(BASE, TLAN_DEF_REVISION); - printf("\nRevision = 0x%hX\n", priv->tlanRev); - - TLan_ResetLists(nic); - TLan_ResetAdapter(nic); -/* - data = inl(BASE + TLAN_HOST_CMD); - data |= TLAN_HC_EOC; - outw(data, BASE + TLAN_HOST_CMD); -*/ - - data = inl(BASE + TLAN_HOST_CMD); - data |= TLAN_HC_INT_OFF; - outw(data, BASE + TLAN_HOST_CMD); - - TLan_SetMulticastList(nic); - udelay(100); - priv->txList = tx_ring; - priv->rxList = rx_ring; -/* if (board_found && valid_link) - {*/ - /* point to NIC specific routines */ -#ifdef EB51 - dev->disable = tlan_disable; - nic->poll = tlan_poll; - nic->transmit = tlan_transmit; - nic->irq = tlan_irq; - return 1; -#else - nic->disable = tlan_disable; - nic->poll = tlan_poll; - nic->transmit = tlan_transmit; - nic->irq = tlan_irq; - return nic; -#endif -} - - -/***************************************************************************** -****************************************************************************** - - ThunderLAN Driver Eeprom routines - - The Compaq Netelligent 10 and 10/100 cards use a Microchip 24C02A - EEPROM. These functions are based on information in Microchip's - data sheet. I don't know how well this functions will work with - other EEPROMs. - -****************************************************************************** -*****************************************************************************/ - - - /*************************************************************** - * TLan_EeSendStart - * - * Returns: - * Nothing - * Parms: - * io_base The IO port base address for the - * TLAN device with the EEPROM to - * use. - * - * This function sends a start cycle to an EEPROM attached - * to a TLAN chip. - * - **************************************************************/ - -void TLan_EeSendStart(u16 io_base) -{ - u16 sio; - - outw(TLAN_NET_SIO, io_base + TLAN_DIO_ADR); - sio = io_base + TLAN_DIO_DATA + TLAN_NET_SIO; - - TLan_SetBit(TLAN_NET_SIO_ECLOK, sio); - TLan_SetBit(TLAN_NET_SIO_EDATA, sio); - TLan_SetBit(TLAN_NET_SIO_ETXEN, sio); - TLan_ClearBit(TLAN_NET_SIO_EDATA, sio); - TLan_ClearBit(TLAN_NET_SIO_ECLOK, sio); - -} /* TLan_EeSendStart */ - - - - - /*************************************************************** - * TLan_EeSendByte - * - * Returns: - * If the correct ack was received, 0, otherwise 1 - * Parms: io_base The IO port base address for the - * TLAN device with the EEPROM to - * use. - * data The 8 bits of information to - * send to the EEPROM. - * stop If TLAN_EEPROM_STOP is passed, a - * stop cycle is sent after the - * byte is sent after the ack is - * read. - * - * This function sends a byte on the serial EEPROM line, - * driving the clock to send each bit. The function then - * reverses transmission direction and reads an acknowledge - * bit. - * - **************************************************************/ - -int TLan_EeSendByte(u16 io_base, u8 data, int stop) -{ - int err; - u8 place; - u16 sio; - - outw(TLAN_NET_SIO, io_base + TLAN_DIO_ADR); - sio = io_base + TLAN_DIO_DATA + TLAN_NET_SIO; - - /* Assume clock is low, tx is enabled; */ - for (place = 0x80; place != 0; place >>= 1) { - if (place & data) - TLan_SetBit(TLAN_NET_SIO_EDATA, sio); - else - TLan_ClearBit(TLAN_NET_SIO_EDATA, sio); - TLan_SetBit(TLAN_NET_SIO_ECLOK, sio); - TLan_ClearBit(TLAN_NET_SIO_ECLOK, sio); - } - TLan_ClearBit(TLAN_NET_SIO_ETXEN, sio); - TLan_SetBit(TLAN_NET_SIO_ECLOK, sio); - err = TLan_GetBit(TLAN_NET_SIO_EDATA, sio); - TLan_ClearBit(TLAN_NET_SIO_ECLOK, sio); - TLan_SetBit(TLAN_NET_SIO_ETXEN, sio); - - if ((!err) && stop) { - TLan_ClearBit(TLAN_NET_SIO_EDATA, sio); /* STOP, raise data while clock is high */ - TLan_SetBit(TLAN_NET_SIO_ECLOK, sio); - TLan_SetBit(TLAN_NET_SIO_EDATA, sio); - } - - return (err); - -} /* TLan_EeSendByte */ - - - - - /*************************************************************** - * TLan_EeReceiveByte - * - * Returns: - * Nothing - * Parms: - * io_base The IO port base address for the - * TLAN device with the EEPROM to - * use. - * data An address to a char to hold the - * data sent from the EEPROM. - * stop If TLAN_EEPROM_STOP is passed, a - * stop cycle is sent after the - * byte is received, and no ack is - * sent. - * - * This function receives 8 bits of data from the EEPROM - * over the serial link. It then sends and ack bit, or no - * ack and a stop bit. This function is used to retrieve - * data after the address of a byte in the EEPROM has been - * sent. - * - **************************************************************/ - -void TLan_EeReceiveByte(u16 io_base, u8 * data, int stop) -{ - u8 place; - u16 sio; - - outw(TLAN_NET_SIO, io_base + TLAN_DIO_ADR); - sio = io_base + TLAN_DIO_DATA + TLAN_NET_SIO; - *data = 0; - - /* Assume clock is low, tx is enabled; */ - TLan_ClearBit(TLAN_NET_SIO_ETXEN, sio); - for (place = 0x80; place; place >>= 1) { - TLan_SetBit(TLAN_NET_SIO_ECLOK, sio); - if (TLan_GetBit(TLAN_NET_SIO_EDATA, sio)) - *data |= place; - TLan_ClearBit(TLAN_NET_SIO_ECLOK, sio); - } - - TLan_SetBit(TLAN_NET_SIO_ETXEN, sio); - if (!stop) { - TLan_ClearBit(TLAN_NET_SIO_EDATA, sio); /* Ack = 0 */ - TLan_SetBit(TLAN_NET_SIO_ECLOK, sio); - TLan_ClearBit(TLAN_NET_SIO_ECLOK, sio); - } else { - TLan_SetBit(TLAN_NET_SIO_EDATA, sio); /* No ack = 1 (?) */ - TLan_SetBit(TLAN_NET_SIO_ECLOK, sio); - TLan_ClearBit(TLAN_NET_SIO_ECLOK, sio); - TLan_ClearBit(TLAN_NET_SIO_EDATA, sio); /* STOP, raise data while clock is high */ - TLan_SetBit(TLAN_NET_SIO_ECLOK, sio); - TLan_SetBit(TLAN_NET_SIO_EDATA, sio); - } - -} /* TLan_EeReceiveByte */ - - - - /*************************************************************** - * TLan_EeReadByte - * - * Returns: - * No error = 0, else, the stage at which the error - * occurred. - * Parms: - * io_base The IO port base address for the - * TLAN device with the EEPROM to - * use. - * ee_addr The address of the byte in the - * EEPROM whose contents are to be - * retrieved. - * data An address to a char to hold the - * data obtained from the EEPROM. - * - * This function reads a byte of information from an byte - * cell in the EEPROM. - * - **************************************************************/ - -int TLan_EeReadByte(u16 io_base, u8 ee_addr, u8 * data) -{ - int err; - int ret = 0; - - - TLan_EeSendStart(io_base); - err = TLan_EeSendByte(io_base, 0xA0, TLAN_EEPROM_ACK); - if (err) { - ret = 1; - goto fail; - } - err = TLan_EeSendByte(io_base, ee_addr, TLAN_EEPROM_ACK); - if (err) { - ret = 2; - goto fail; - } - TLan_EeSendStart(io_base); - err = TLan_EeSendByte(io_base, 0xA1, TLAN_EEPROM_ACK); - if (err) { - ret = 3; - goto fail; - } - TLan_EeReceiveByte(io_base, data, TLAN_EEPROM_STOP); - fail: - - return ret; - -} /* TLan_EeReadByte */ - - -/***************************************************************************** -****************************************************************************** - - ThunderLAN Driver MII Routines - - These routines are based on the information in Chap. 2 of the - "ThunderLAN Programmer's Guide", pp. 15-24. - -****************************************************************************** -*****************************************************************************/ - - - /*************************************************************** - * TLan_MiiReadReg - * - * Returns: - * 0 if ack received ok - * 1 otherwise. - * - * Parms: - * dev The device structure containing - * The io address and interrupt count - * for this device. - * phy The address of the PHY to be queried. - * reg The register whose contents are to be - * retreived. - * val A pointer to a variable to store the - * retrieved value. - * - * This function uses the TLAN's MII bus to retreive the contents - * of a given register on a PHY. It sends the appropriate info - * and then reads the 16-bit register value from the MII bus via - * the TLAN SIO register. - * - **************************************************************/ - -int TLan_MiiReadReg(struct nic *nic __unused, u16 phy, u16 reg, u16 * val) -{ - u8 nack; - u16 sio, tmp; - u32 i; - int err; - int minten; - - err = FALSE; - outw(TLAN_NET_SIO, BASE + TLAN_DIO_ADR); - sio = BASE + TLAN_DIO_DATA + TLAN_NET_SIO; - - TLan_MiiSync(BASE); - - minten = TLan_GetBit(TLAN_NET_SIO_MINTEN, sio); - if (minten) - TLan_ClearBit(TLAN_NET_SIO_MINTEN, sio); - - TLan_MiiSendData(BASE, 0x1, 2); /* Start ( 01b ) */ - TLan_MiiSendData(BASE, 0x2, 2); /* Read ( 10b ) */ - TLan_MiiSendData(BASE, phy, 5); /* Device # */ - TLan_MiiSendData(BASE, reg, 5); /* Register # */ - - - TLan_ClearBit(TLAN_NET_SIO_MTXEN, sio); /* Change direction */ - - TLan_ClearBit(TLAN_NET_SIO_MCLK, sio); /* Clock Idle bit */ - TLan_SetBit(TLAN_NET_SIO_MCLK, sio); - TLan_ClearBit(TLAN_NET_SIO_MCLK, sio); /* Wait 300ns */ - - nack = TLan_GetBit(TLAN_NET_SIO_MDATA, sio); /* Check for ACK */ - TLan_SetBit(TLAN_NET_SIO_MCLK, sio); /* Finish ACK */ - if (nack) { /* No ACK, so fake it */ - for (i = 0; i < 16; i++) { - TLan_ClearBit(TLAN_NET_SIO_MCLK, sio); - TLan_SetBit(TLAN_NET_SIO_MCLK, sio); - } - tmp = 0xffff; - err = TRUE; - } else { /* ACK, so read data */ - for (tmp = 0, i = 0x8000; i; i >>= 1) { - TLan_ClearBit(TLAN_NET_SIO_MCLK, sio); - if (TLan_GetBit(TLAN_NET_SIO_MDATA, sio)) - tmp |= i; - TLan_SetBit(TLAN_NET_SIO_MCLK, sio); - } - } - - - TLan_ClearBit(TLAN_NET_SIO_MCLK, sio); /* Idle cycle */ - TLan_SetBit(TLAN_NET_SIO_MCLK, sio); - - if (minten) - TLan_SetBit(TLAN_NET_SIO_MINTEN, sio); - - *val = tmp; - - return err; - -} /* TLan_MiiReadReg */ - - /*************************************************************** - * TLan_MiiSendData - * - * Returns: - * Nothing - * Parms: - * base_port The base IO port of the adapter in - * question. - * dev The address of the PHY to be queried. - * data The value to be placed on the MII bus. - * num_bits The number of bits in data that are to - * be placed on the MII bus. - * - * This function sends on sequence of bits on the MII - * configuration bus. - * - **************************************************************/ - -void TLan_MiiSendData(u16 base_port, u32 data, unsigned num_bits) -{ - u16 sio; - u32 i; - - if (num_bits == 0) - return; - - outw(TLAN_NET_SIO, base_port + TLAN_DIO_ADR); - sio = base_port + TLAN_DIO_DATA + TLAN_NET_SIO; - TLan_SetBit(TLAN_NET_SIO_MTXEN, sio); - - for (i = (0x1 << (num_bits - 1)); i; i >>= 1) { - TLan_ClearBit(TLAN_NET_SIO_MCLK, sio); - (void) TLan_GetBit(TLAN_NET_SIO_MCLK, sio); - if (data & i) - TLan_SetBit(TLAN_NET_SIO_MDATA, sio); - else - TLan_ClearBit(TLAN_NET_SIO_MDATA, sio); - TLan_SetBit(TLAN_NET_SIO_MCLK, sio); - (void) TLan_GetBit(TLAN_NET_SIO_MCLK, sio); - } - -} /* TLan_MiiSendData */ - - - - - /*************************************************************** - * TLan_MiiSync - * - * Returns: - * Nothing - * Parms: - * base_port The base IO port of the adapter in - * question. - * - * This functions syncs all PHYs in terms of the MII configuration - * bus. - * - **************************************************************/ - -void TLan_MiiSync(u16 base_port) -{ - int i; - u16 sio; - - outw(TLAN_NET_SIO, base_port + TLAN_DIO_ADR); - sio = base_port + TLAN_DIO_DATA + TLAN_NET_SIO; - - TLan_ClearBit(TLAN_NET_SIO_MTXEN, sio); - for (i = 0; i < 32; i++) { - TLan_ClearBit(TLAN_NET_SIO_MCLK, sio); - TLan_SetBit(TLAN_NET_SIO_MCLK, sio); - } - -} /* TLan_MiiSync */ - - - - - /*************************************************************** - * TLan_MiiWriteReg - * - * Returns: - * Nothing - * Parms: - * dev The device structure for the device - * to write to. - * phy The address of the PHY to be written to. - * reg The register whose contents are to be - * written. - * val The value to be written to the register. - * - * This function uses the TLAN's MII bus to write the contents of a - * given register on a PHY. It sends the appropriate info and then - * writes the 16-bit register value from the MII configuration bus - * via the TLAN SIO register. - * - **************************************************************/ - -void TLan_MiiWriteReg(struct nic *nic __unused, u16 phy, u16 reg, u16 val) -{ - u16 sio; - int minten; - - outw(TLAN_NET_SIO, BASE + TLAN_DIO_ADR); - sio = BASE + TLAN_DIO_DATA + TLAN_NET_SIO; - - TLan_MiiSync(BASE); - - minten = TLan_GetBit(TLAN_NET_SIO_MINTEN, sio); - if (minten) - TLan_ClearBit(TLAN_NET_SIO_MINTEN, sio); - - TLan_MiiSendData(BASE, 0x1, 2); /* Start ( 01b ) */ - TLan_MiiSendData(BASE, 0x1, 2); /* Write ( 01b ) */ - TLan_MiiSendData(BASE, phy, 5); /* Device # */ - TLan_MiiSendData(BASE, reg, 5); /* Register # */ - - TLan_MiiSendData(BASE, 0x2, 2); /* Send ACK */ - TLan_MiiSendData(BASE, val, 16); /* Send Data */ - - TLan_ClearBit(TLAN_NET_SIO_MCLK, sio); /* Idle cycle */ - TLan_SetBit(TLAN_NET_SIO_MCLK, sio); - - if (minten) - TLan_SetBit(TLAN_NET_SIO_MINTEN, sio); - - -} /* TLan_MiiWriteReg */ - - /*************************************************************** - * TLan_SetMac - * - * Returns: - * Nothing - * Parms: - * dev Pointer to device structure of adapter - * on which to change the AREG. - * areg The AREG to set the address in (0 - 3). - * mac A pointer to an array of chars. Each - * element stores one byte of the address. - * IE, it isn't in ascii. - * - * This function transfers a MAC address to one of the - * TLAN AREGs (address registers). The TLAN chip locks - * the register on writing to offset 0 and unlocks the - * register after writing to offset 5. If NULL is passed - * in mac, then the AREG is filled with 0's. - * - **************************************************************/ - -void TLan_SetMac(struct nic *nic __unused, int areg, char *mac) -{ - int i; - - areg *= 6; - - if (mac != NULL) { - for (i = 0; i < 6; i++) - TLan_DioWrite8(BASE, TLAN_AREG_0 + areg + i, - mac[i]); - } else { - for (i = 0; i < 6; i++) - TLan_DioWrite8(BASE, TLAN_AREG_0 + areg + i, 0); - } - -} /* TLan_SetMac */ - - /********************************************************************* - * TLan_PhyDetect - * - * Returns: - * Nothing - * Parms: - * dev A pointer to the device structure of the adapter - * for which the PHY needs determined. - * - * So far I've found that adapters which have external PHYs - * may also use the internal PHY for part of the functionality. - * (eg, AUI/Thinnet). This function finds out if this TLAN - * chip has an internal PHY, and then finds the first external - * PHY (starting from address 0) if it exists). - * - ********************************************************************/ - -void TLan_PhyDetect(struct nic *nic) -{ - u16 control; - u16 hi; - u16 lo; - u32 phy; - - if (tlan_pci_tbl[chip_idx].flags & TLAN_ADAPTER_UNMANAGED_PHY) { - priv->phyNum = 0xFFFF; - return; - } - - TLan_MiiReadReg(nic, TLAN_PHY_MAX_ADDR, MII_GEN_ID_HI, &hi); - - if (hi != 0xFFFF) { - priv->phy[0] = TLAN_PHY_MAX_ADDR; - } else { - priv->phy[0] = TLAN_PHY_NONE; - } - - priv->phy[1] = TLAN_PHY_NONE; - for (phy = 0; phy <= TLAN_PHY_MAX_ADDR; phy++) { - TLan_MiiReadReg(nic, phy, MII_GEN_CTL, &control); - TLan_MiiReadReg(nic, phy, MII_GEN_ID_HI, &hi); - TLan_MiiReadReg(nic, phy, MII_GEN_ID_LO, &lo); - if ((control != 0xFFFF) || (hi != 0xFFFF) - || (lo != 0xFFFF)) { - printf("PHY found at %hX %hX %hX %hX\n", phy, - control, hi, lo); - if ((priv->phy[1] == TLAN_PHY_NONE) - && (phy != TLAN_PHY_MAX_ADDR)) { - priv->phy[1] = phy; - } - } - } - - if (priv->phy[1] != TLAN_PHY_NONE) { - priv->phyNum = 1; - } else if (priv->phy[0] != TLAN_PHY_NONE) { - priv->phyNum = 0; - } else { - printf - ("TLAN: Cannot initialize device, no PHY was found!\n"); - } - -} /* TLan_PhyDetect */ - -void TLan_PhyPowerDown(struct nic *nic) -{ - - u16 value; - printf("%s: Powering down PHY(s).\n", priv->nic_name); - value = MII_GC_PDOWN | MII_GC_LOOPBK | MII_GC_ISOLATE; - TLan_MiiSync(BASE); - TLan_MiiWriteReg(nic, priv->phy[priv->phyNum], MII_GEN_CTL, value); - if ((priv->phyNum == 0) && (priv->phy[1] != TLAN_PHY_NONE) - && - (!(tlan_pci_tbl[chip_idx]. - flags & TLAN_ADAPTER_USE_INTERN_10))) { - TLan_MiiSync(BASE); - TLan_MiiWriteReg(nic, priv->phy[1], MII_GEN_CTL, value); - } - - /* Wait for 50 ms and powerup - * This is abitrary. It is intended to make sure the - * tranceiver settles. - */ - /* TLan_SetTimer( dev, (HZ/20), TLAN_TIMER_PHY_PUP ); */ - mdelay(50); - TLan_PhyPowerUp(nic); - -} /* TLan_PhyPowerDown */ - - -void TLan_PhyPowerUp(struct nic *nic) -{ - u16 value; - - printf("%s: Powering up PHY.\n", priv->nic_name); - TLan_MiiSync(BASE); - value = MII_GC_LOOPBK; - TLan_MiiWriteReg(nic, priv->phy[priv->phyNum], MII_GEN_CTL, value); - TLan_MiiSync(BASE); - /* Wait for 500 ms and reset the - * tranceiver. The TLAN docs say both 50 ms and - * 500 ms, so do the longer, just in case. - */ - mdelay(500); - TLan_PhyReset(nic); - /* TLan_SetTimer( dev, (HZ/20), TLAN_TIMER_PHY_RESET ); */ - -} /* TLan_PhyPowerUp */ - -void TLan_PhyReset(struct nic *nic) -{ - u16 phy; - u16 value; - - phy = priv->phy[priv->phyNum]; - - printf("%s: Reseting PHY.\n", priv->nic_name); - TLan_MiiSync(BASE); - value = MII_GC_LOOPBK | MII_GC_RESET; - TLan_MiiWriteReg(nic, phy, MII_GEN_CTL, value); - TLan_MiiReadReg(nic, phy, MII_GEN_CTL, &value); - while (value & MII_GC_RESET) { - TLan_MiiReadReg(nic, phy, MII_GEN_CTL, &value); - } - - /* Wait for 500 ms and initialize. - * I don't remember why I wait this long. - * I've changed this to 50ms, as it seems long enough. - */ - /* TLan_SetTimer( dev, (HZ/20), TLAN_TIMER_PHY_START_LINK ); */ - mdelay(50); - TLan_PhyStartLink(nic); - -} /* TLan_PhyReset */ - - -void TLan_PhyStartLink(struct nic *nic) -{ - - u16 ability; - u16 control; - u16 data; - u16 phy; - u16 status; - u16 tctl; - - phy = priv->phy[priv->phyNum]; - printf("%s: Trying to activate link.\n", priv->nic_name); - TLan_MiiReadReg(nic, phy, MII_GEN_STS, &status); - TLan_MiiReadReg(nic, phy, MII_GEN_STS, &ability); - - if ((status & MII_GS_AUTONEG) && (!priv->aui)) { - ability = status >> 11; - if (priv->speed == TLAN_SPEED_10 && - priv->duplex == TLAN_DUPLEX_HALF) { - TLan_MiiWriteReg(nic, phy, MII_GEN_CTL, 0x0000); - } else if (priv->speed == TLAN_SPEED_10 && - priv->duplex == TLAN_DUPLEX_FULL) { - priv->tlanFullDuplex = TRUE; - TLan_MiiWriteReg(nic, phy, MII_GEN_CTL, 0x0100); - } else if (priv->speed == TLAN_SPEED_100 && - priv->duplex == TLAN_DUPLEX_HALF) { - TLan_MiiWriteReg(nic, phy, MII_GEN_CTL, 0x2000); - } else if (priv->speed == TLAN_SPEED_100 && - priv->duplex == TLAN_DUPLEX_FULL) { - priv->tlanFullDuplex = TRUE; - TLan_MiiWriteReg(nic, phy, MII_GEN_CTL, 0x2100); - } else { - - /* Set Auto-Neg advertisement */ - TLan_MiiWriteReg(nic, phy, MII_AN_ADV, - (ability << 5) | 1); - /* Enablee Auto-Neg */ - TLan_MiiWriteReg(nic, phy, MII_GEN_CTL, 0x1000); - /* Restart Auto-Neg */ - TLan_MiiWriteReg(nic, phy, MII_GEN_CTL, 0x1200); - /* Wait for 4 sec for autonegotiation - * to complete. The max spec time is less than this - * but the card need additional time to start AN. - * .5 sec should be plenty extra. - */ - printf("TLAN: %s: Starting autonegotiation.\n", - priv->nic_name); - mdelay(4000); - TLan_PhyFinishAutoNeg(nic); - /* TLan_SetTimer( dev, (2*HZ), TLAN_TIMER_PHY_FINISH_AN ); */ - return; - } - - } - - if ((priv->aui) && (priv->phyNum != 0)) { - priv->phyNum = 0; - data = - TLAN_NET_CFG_1FRAG | TLAN_NET_CFG_1CHAN | - TLAN_NET_CFG_PHY_EN; - TLan_DioWrite16(BASE, TLAN_NET_CONFIG, data); - mdelay(50); - /* TLan_SetTimer( dev, (40*HZ/1000), TLAN_TIMER_PHY_PDOWN ); */ - TLan_PhyPowerDown(nic); - return; - } else if (priv->phyNum == 0) { - control = 0; - TLan_MiiReadReg(nic, phy, TLAN_TLPHY_CTL, &tctl); - if (priv->aui) { - tctl |= TLAN_TC_AUISEL; - } else { - tctl &= ~TLAN_TC_AUISEL; - if (priv->duplex == TLAN_DUPLEX_FULL) { - control |= MII_GC_DUPLEX; - priv->tlanFullDuplex = TRUE; - } - if (priv->speed == TLAN_SPEED_100) { - control |= MII_GC_SPEEDSEL; - } - } - TLan_MiiWriteReg(nic, phy, MII_GEN_CTL, control); - TLan_MiiWriteReg(nic, phy, TLAN_TLPHY_CTL, tctl); - } - - /* Wait for 2 sec to give the tranceiver time - * to establish link. - */ - /* TLan_SetTimer( dev, (4*HZ), TLAN_TIMER_FINISH_RESET ); */ - mdelay(2000); - TLan_FinishReset(nic); - -} /* TLan_PhyStartLink */ - -void TLan_PhyFinishAutoNeg(struct nic *nic) -{ - - u16 an_adv; - u16 an_lpa; - u16 data; - u16 mode; - u16 phy; - u16 status; - - phy = priv->phy[priv->phyNum]; - - TLan_MiiReadReg(nic, phy, MII_GEN_STS, &status); - udelay(1000); - TLan_MiiReadReg(nic, phy, MII_GEN_STS, &status); - - if (!(status & MII_GS_AUTOCMPLT)) { - /* Wait for 8 sec to give the process - * more time. Perhaps we should fail after a while. - */ - if (!priv->neg_be_verbose++) { - printf - ("TLAN: Giving autonegotiation more time.\n"); - printf - ("TLAN: Please check that your adapter has\n"); - printf - ("TLAN: been properly connected to a HUB or Switch.\n"); - printf - ("TLAN: Trying to establish link in the background...\n"); - } - mdelay(8000); - TLan_PhyFinishAutoNeg(nic); - /* TLan_SetTimer( dev, (8*HZ), TLAN_TIMER_PHY_FINISH_AN ); */ - return; - } - - printf("TLAN: %s: Autonegotiation complete.\n", priv->nic_name); - TLan_MiiReadReg(nic, phy, MII_AN_ADV, &an_adv); - TLan_MiiReadReg(nic, phy, MII_AN_LPA, &an_lpa); - mode = an_adv & an_lpa & 0x03E0; - if (mode & 0x0100) { - printf("Full Duplex\n"); - priv->tlanFullDuplex = TRUE; - } else if (!(mode & 0x0080) && (mode & 0x0040)) { - priv->tlanFullDuplex = TRUE; - printf("Full Duplex\n"); - } - - if ((!(mode & 0x0180)) - && (tlan_pci_tbl[chip_idx].flags & TLAN_ADAPTER_USE_INTERN_10) - && (priv->phyNum != 0)) { - priv->phyNum = 0; - data = - TLAN_NET_CFG_1FRAG | TLAN_NET_CFG_1CHAN | - TLAN_NET_CFG_PHY_EN; - TLan_DioWrite16(BASE, TLAN_NET_CONFIG, data); - /* TLan_SetTimer( nic, (400*HZ/1000), TLAN_TIMER_PHY_PDOWN ); */ - mdelay(400); - TLan_PhyPowerDown(nic); - return; - } - - if (priv->phyNum == 0) { - if ((priv->duplex == TLAN_DUPLEX_FULL) - || (an_adv & an_lpa & 0x0040)) { - TLan_MiiWriteReg(nic, phy, MII_GEN_CTL, - MII_GC_AUTOENB | MII_GC_DUPLEX); - printf - ("TLAN: Starting internal PHY with FULL-DUPLEX\n"); - } else { - TLan_MiiWriteReg(nic, phy, MII_GEN_CTL, - MII_GC_AUTOENB); - printf - ("TLAN: Starting internal PHY with HALF-DUPLEX\n"); - } - } - - /* Wait for 100 ms. No reason in partiticular. - */ - /* TLan_SetTimer( dev, (HZ/10), TLAN_TIMER_FINISH_RESET ); */ - mdelay(100); - TLan_FinishReset(nic); - -} /* TLan_PhyFinishAutoNeg */ - -#ifdef MONITOR - - /********************************************************************* - * - * TLan_phyMonitor - * - * Returns: - * None - * - * Params: - * dev The device structure of this device. - * - * - * This function monitors PHY condition by reading the status - * register via the MII bus. This can be used to give info - * about link changes (up/down), and possible switch to alternate - * media. - * - * ******************************************************************/ - -void TLan_PhyMonitor(struct net_device *dev) -{ - TLanPrivateInfo *priv = dev->priv; - u16 phy; - u16 phy_status; - - phy = priv->phy[priv->phyNum]; - - /* Get PHY status register */ - TLan_MiiReadReg(nic, phy, MII_GEN_STS, &phy_status); - - /* Check if link has been lost */ - if (!(phy_status & MII_GS_LINK)) { - if (priv->link) { - priv->link = 0; - printf("TLAN: %s has lost link\n", priv->nic_name); - priv->flags &= ~IFF_RUNNING; - mdelay(2000); - TLan_PhyMonitor(nic); - /* TLan_SetTimer( dev, (2*HZ), TLAN_TIMER_LINK_BEAT ); */ - return; - } - } - - /* Link restablished? */ - if ((phy_status & MII_GS_LINK) && !priv->link) { - priv->link = 1; - printf("TLAN: %s has reestablished link\n", - priv->nic_name); - priv->flags |= IFF_RUNNING; - } - - /* Setup a new monitor */ - /* TLan_SetTimer( dev, (2*HZ), TLAN_TIMER_LINK_BEAT ); */ - mdelay(2000); - TLan_PhyMonitor(nic); -} - -#endif /* MONITOR */ - -#ifdef EB51 -static struct pci_id tlan_nics[] = { - PCI_ROM(0x0e11, 0xae34, "netel10", "Compaq Netelligent 10 T PCI UTP"), - PCI_ROM(0x0e11, 0xae32, "netel100","Compaq Netelligent 10/100 TX PCI UTP"), - PCI_ROM(0x0e11, 0xae35, "netflex3i", "Compaq Integrated NetFlex-3/P"), - PCI_ROM(0x0e11, 0xf130, "thunder", "Compaq NetFlex-3/P"), - PCI_ROM(0x0e11, 0xf150, "netflex3b", "Compaq NetFlex-3/P"), - PCI_ROM(0x0e11, 0xae43, "netel100pi", "Compaq Netelligent Integrated 10/100 TX UTP"), - PCI_ROM(0x0e11, 0xae40, "netel100d", "Compaq Netelligent Dual 10/100 TX PCI UTP"), - PCI_ROM(0x0e11, 0xb011, "netel100i", "Compaq Netelligent 10/100 TX Embedded UTP"), - PCI_ROM(0x108d, 0x0013, "oc2183", "Olicom OC-2183/2185"), - PCI_ROM(0x108d, 0x0012, "oc2325", "Olicom OC-2325"), - PCI_ROM(0x108d, 0x0014, "oc2326", "Olicom OC-2326"), - PCI_ROM(0x0e11, 0xb030, "netelligent_10_100_ws_5100", "Compaq Netelligent 10/100 TX UTP"), - PCI_ROM(0x0e11, 0xb012, "netelligent_10_t2", "Compaq Netelligent 10 T/2 PCI UTP/Coax"), -}; - -struct pci_driver tlan_driver = { - .type = NIC_DRIVER, - .name = "TLAN/PCI", - .probe = tlan_probe, - .ids = tlan_nics, - .id_count = sizeof(tlan_nics) / sizeof(tlan_nics[0]), - .class = 0, -}; -#endif diff --git a/usr/src/grub/grub-0.95/netboot/tlan.h b/usr/src/grub/grub-0.95/netboot/tlan.h deleted file mode 100644 index 35753e6a9e..0000000000 --- a/usr/src/grub/grub-0.95/netboot/tlan.h +++ /dev/null @@ -1,536 +0,0 @@ -/************************************************************************** -* -* tlan.c -- Etherboot device driver for the Texas Instruments ThunderLAN -* Written 2003-2003 by Timothy Legge -* -* 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. -* -* Portions of this code (almost all) based on: -* tlan.c: Linux ThunderLan Driver: -* -* by James Banks -* -* (C) 1997-1998 Caldera, Inc. -* (C) 1998 James Banks -* (C) 1999-2001 Torben Mathiasen -* (C) 2002 Samuel Chessman -* -* REVISION HISTORY: -* ================ -* v1.0 07-08-2003 timlegge Initial not quite working version -* -* Indent Style: indent -kr -i8 -***************************************************************************/ - -/* -#include -#include -#include -*/ - -typedef unsigned char u8; -typedef signed char s8; -typedef unsigned short u16; -typedef signed short s16; -typedef unsigned int u32; -typedef signed int s32; - /***************************************************************** - * TLan Definitions - * - ****************************************************************/ - -#define FALSE 0 -#define TRUE 1 - -#define TLAN_MIN_FRAME_SIZE 64 -#define TLAN_MAX_FRAME_SIZE 1600 - -#define TLAN_NUM_RX_LISTS 4 -#define TLAN_NUM_TX_LISTS 2 - -#define TLAN_IGNORE 0 -#define TLAN_RECORD 1 -/* -#define TLAN_DBG(lvl, format, args...) if (debug&lvl) printf("TLAN: " format, ##args ); -*/ -#define TLAN_DEBUG_GNRL 0x0001 -#define TLAN_DEBUG_TX 0x0002 -#define TLAN_DEBUG_RX 0x0004 -#define TLAN_DEBUG_LIST 0x0008 -#define TLAN_DEBUG_PROBE 0x0010 - -#define TX_TIMEOUT (10*HZ) /* We need time for auto-neg */ -#define MAX_TLAN_BOARDS 8 /* Max number of boards installed at a time */ - - - /***************************************************************** - * Device Identification Definitions - * - ****************************************************************/ - -#define PCI_DEVICE_ID_NETELLIGENT_10_T2 0xB012 -#define PCI_DEVICE_ID_NETELLIGENT_10_100_WS_5100 0xB030 -#ifndef PCI_DEVICE_ID_OLICOM_OC2183 -#define PCI_DEVICE_ID_OLICOM_OC2183 0x0013 -#endif -#ifndef PCI_DEVICE_ID_OLICOM_OC2325 -#define PCI_DEVICE_ID_OLICOM_OC2325 0x0012 -#endif -#ifndef PCI_DEVICE_ID_OLICOM_OC2326 -#define PCI_DEVICE_ID_OLICOM_OC2326 0x0014 -#endif - -typedef struct tlan_adapter_entry { - u16 vendorId; - u16 deviceId; - char *deviceLabel; - u32 flags; - u16 addrOfs; -} TLanAdapterEntry; - -#define TLAN_ADAPTER_NONE 0x00000000 -#define TLAN_ADAPTER_UNMANAGED_PHY 0x00000001 -#define TLAN_ADAPTER_BIT_RATE_PHY 0x00000002 -#define TLAN_ADAPTER_USE_INTERN_10 0x00000004 -#define TLAN_ADAPTER_ACTIVITY_LED 0x00000008 - -#define TLAN_SPEED_DEFAULT 0 -#define TLAN_SPEED_10 10 -#define TLAN_SPEED_100 100 - -#define TLAN_DUPLEX_DEFAULT 0 -#define TLAN_DUPLEX_HALF 1 -#define TLAN_DUPLEX_FULL 2 - - - - /***************************************************************** - * EISA Definitions - * - ****************************************************************/ - -#define EISA_ID 0xc80 /* EISA ID Registers */ -#define EISA_ID0 0xc80 /* EISA ID Register 0 */ -#define EISA_ID1 0xc81 /* EISA ID Register 1 */ -#define EISA_ID2 0xc82 /* EISA ID Register 2 */ -#define EISA_ID3 0xc83 /* EISA ID Register 3 */ -#define EISA_CR 0xc84 /* EISA Control Register */ -#define EISA_REG0 0xc88 /* EISA Configuration Register 0 */ -#define EISA_REG1 0xc89 /* EISA Configuration Register 1 */ -#define EISA_REG2 0xc8a /* EISA Configuration Register 2 */ -#define EISA_REG3 0xc8f /* EISA Configuration Register 3 */ -#define EISA_APROM 0xc90 /* Ethernet Address PROM */ - - - - /***************************************************************** - * Rx/Tx List Definitions - * - ****************************************************************/ - -#define TLAN_BUFFERS_PER_LIST 10 -#define TLAN_LAST_BUFFER 0x80000000 -#define TLAN_CSTAT_UNUSED 0x8000 -#define TLAN_CSTAT_FRM_CMP 0x4000 -#define TLAN_CSTAT_READY 0x3000 -#define TLAN_CSTAT_EOC 0x0800 -#define TLAN_CSTAT_RX_ERROR 0x0400 -#define TLAN_CSTAT_PASS_CRC 0x0200 -#define TLAN_CSTAT_DP_PR 0x0100 - - - - - - - /***************************************************************** - * PHY definitions - * - ****************************************************************/ - -#define TLAN_PHY_MAX_ADDR 0x1F -#define TLAN_PHY_NONE 0x20 - - - - /***************************************************************** - * TLan Driver Timer Definitions - * - ****************************************************************/ - -#define TLAN_TIMER_LINK_BEAT 1 -#define TLAN_TIMER_ACTIVITY 2 -#define TLAN_TIMER_PHY_PDOWN 3 -#define TLAN_TIMER_PHY_PUP 4 -#define TLAN_TIMER_PHY_RESET 5 -#define TLAN_TIMER_PHY_START_LINK 6 -#define TLAN_TIMER_PHY_FINISH_AN 7 -#define TLAN_TIMER_FINISH_RESET 8 - -#define TLAN_TIMER_ACT_DELAY (HZ/10) - - - - - /***************************************************************** - * TLan Driver Eeprom Definitions - * - ****************************************************************/ - -#define TLAN_EEPROM_ACK 0 -#define TLAN_EEPROM_STOP 1 - - - - - /***************************************************************** - * Host Register Offsets and Contents - * - ****************************************************************/ - -#define TLAN_HOST_CMD 0x00 -#define TLAN_HC_GO 0x80000000 -#define TLAN_HC_STOP 0x40000000 -#define TLAN_HC_ACK 0x20000000 -#define TLAN_HC_CS_MASK 0x1FE00000 -#define TLAN_HC_EOC 0x00100000 -#define TLAN_HC_RT 0x00080000 -#define TLAN_HC_NES 0x00040000 -#define TLAN_HC_AD_RST 0x00008000 -#define TLAN_HC_LD_TMR 0x00004000 -#define TLAN_HC_LD_THR 0x00002000 -#define TLAN_HC_REQ_INT 0x00001000 -#define TLAN_HC_INT_OFF 0x00000800 -#define TLAN_HC_INT_ON 0x00000400 -#define TLAN_HC_AC_MASK 0x000000FF -#define TLAN_CH_PARM 0x04 -#define TLAN_DIO_ADR 0x08 -#define TLAN_DA_ADR_INC 0x8000 -#define TLAN_DA_RAM_ADR 0x4000 -#define TLAN_HOST_INT 0x0A -#define TLAN_HI_IV_MASK 0x1FE0 -#define TLAN_HI_IT_MASK 0x001C -#define TLAN_DIO_DATA 0x0C - - -/* ThunderLAN Internal Register DIO Offsets */ - -#define TLAN_NET_CMD 0x00 -#define TLAN_NET_CMD_NRESET 0x80 -#define TLAN_NET_CMD_NWRAP 0x40 -#define TLAN_NET_CMD_CSF 0x20 -#define TLAN_NET_CMD_CAF 0x10 -#define TLAN_NET_CMD_NOBRX 0x08 -#define TLAN_NET_CMD_DUPLEX 0x04 -#define TLAN_NET_CMD_TRFRAM 0x02 -#define TLAN_NET_CMD_TXPACE 0x01 -#define TLAN_NET_SIO 0x01 -#define TLAN_NET_SIO_MINTEN 0x80 -#define TLAN_NET_SIO_ECLOK 0x40 -#define TLAN_NET_SIO_ETXEN 0x20 -#define TLAN_NET_SIO_EDATA 0x10 -#define TLAN_NET_SIO_NMRST 0x08 -#define TLAN_NET_SIO_MCLK 0x04 -#define TLAN_NET_SIO_MTXEN 0x02 -#define TLAN_NET_SIO_MDATA 0x01 -#define TLAN_NET_STS 0x02 -#define TLAN_NET_STS_MIRQ 0x80 -#define TLAN_NET_STS_HBEAT 0x40 -#define TLAN_NET_STS_TXSTOP 0x20 -#define TLAN_NET_STS_RXSTOP 0x10 -#define TLAN_NET_STS_RSRVD 0x0F -#define TLAN_NET_MASK 0x03 -#define TLAN_NET_MASK_MASK7 0x80 -#define TLAN_NET_MASK_MASK6 0x40 -#define TLAN_NET_MASK_MASK5 0x20 -#define TLAN_NET_MASK_MASK4 0x10 -#define TLAN_NET_MASK_RSRVD 0x0F -#define TLAN_NET_CONFIG 0x04 -#define TLAN_NET_CFG_RCLK 0x8000 -#define TLAN_NET_CFG_TCLK 0x4000 -#define TLAN_NET_CFG_BIT 0x2000 -#define TLAN_NET_CFG_RXCRC 0x1000 -#define TLAN_NET_CFG_PEF 0x0800 -#define TLAN_NET_CFG_1FRAG 0x0400 -#define TLAN_NET_CFG_1CHAN 0x0200 -#define TLAN_NET_CFG_MTEST 0x0100 -#define TLAN_NET_CFG_PHY_EN 0x0080 -#define TLAN_NET_CFG_MSMASK 0x007F -#define TLAN_MAN_TEST 0x06 -#define TLAN_DEF_VENDOR_ID 0x08 -#define TLAN_DEF_DEVICE_ID 0x0A -#define TLAN_DEF_REVISION 0x0C -#define TLAN_DEF_SUBCLASS 0x0D -#define TLAN_DEF_MIN_LAT 0x0E -#define TLAN_DEF_MAX_LAT 0x0F -#define TLAN_AREG_0 0x10 -#define TLAN_AREG_1 0x16 -#define TLAN_AREG_2 0x1C -#define TLAN_AREG_3 0x22 -#define TLAN_HASH_1 0x28 -#define TLAN_HASH_2 0x2C -#define TLAN_GOOD_TX_FRMS 0x30 -#define TLAN_TX_UNDERUNS 0x33 -#define TLAN_GOOD_RX_FRMS 0x34 -#define TLAN_RX_OVERRUNS 0x37 -#define TLAN_DEFERRED_TX 0x38 -#define TLAN_CRC_ERRORS 0x3A -#define TLAN_CODE_ERRORS 0x3B -#define TLAN_MULTICOL_FRMS 0x3C -#define TLAN_SINGLECOL_FRMS 0x3E -#define TLAN_EXCESSCOL_FRMS 0x40 -#define TLAN_LATE_COLS 0x41 -#define TLAN_CARRIER_LOSS 0x42 -#define TLAN_ACOMMIT 0x43 -#define TLAN_LED_REG 0x44 -#define TLAN_LED_ACT 0x10 -#define TLAN_LED_LINK 0x01 -#define TLAN_BSIZE_REG 0x45 -#define TLAN_MAX_RX 0x46 -#define TLAN_INT_DIS 0x48 -#define TLAN_ID_TX_EOC 0x04 -#define TLAN_ID_RX_EOF 0x02 -#define TLAN_ID_RX_EOC 0x01 - - - -/* ThunderLAN Interrupt Codes */ - -#define TLAN_INT_NUMBER_OF_INTS 8 - -#define TLAN_INT_NONE 0x0000 -#define TLAN_INT_TX_EOF 0x0001 -#define TLAN_INT_STAT_OVERFLOW 0x0002 -#define TLAN_INT_RX_EOF 0x0003 -#define TLAN_INT_DUMMY 0x0004 -#define TLAN_INT_TX_EOC 0x0005 -#define TLAN_INT_STATUS_CHECK 0x0006 -#define TLAN_INT_RX_EOC 0x0007 - - - -/* ThunderLAN MII Registers */ - -/* Generic MII/PHY Registers */ - -#define MII_GEN_CTL 0x00 -#define MII_GC_RESET 0x8000 -#define MII_GC_LOOPBK 0x4000 -#define MII_GC_SPEEDSEL 0x2000 -#define MII_GC_AUTOENB 0x1000 -#define MII_GC_PDOWN 0x0800 -#define MII_GC_ISOLATE 0x0400 -#define MII_GC_AUTORSRT 0x0200 -#define MII_GC_DUPLEX 0x0100 -#define MII_GC_COLTEST 0x0080 -#define MII_GC_RESERVED 0x007F -#define MII_GEN_STS 0x01 -#define MII_GS_100BT4 0x8000 -#define MII_GS_100BTXFD 0x4000 -#define MII_GS_100BTXHD 0x2000 -#define MII_GS_10BTFD 0x1000 -#define MII_GS_10BTHD 0x0800 -#define MII_GS_RESERVED 0x07C0 -#define MII_GS_AUTOCMPLT 0x0020 -#define MII_GS_RFLT 0x0010 -#define MII_GS_AUTONEG 0x0008 -#define MII_GS_LINK 0x0004 -#define MII_GS_JABBER 0x0002 -#define MII_GS_EXTCAP 0x0001 -#define MII_GEN_ID_HI 0x02 -#define MII_GEN_ID_LO 0x03 -#define MII_GIL_OUI 0xFC00 -#define MII_GIL_MODEL 0x03F0 -#define MII_GIL_REVISION 0x000F -#define MII_AN_ADV 0x04 -#define MII_AN_LPA 0x05 -#define MII_AN_EXP 0x06 - -/* ThunderLAN Specific MII/PHY Registers */ - -#define TLAN_TLPHY_ID 0x10 -#define TLAN_TLPHY_CTL 0x11 -#define TLAN_TC_IGLINK 0x8000 -#define TLAN_TC_SWAPOL 0x4000 -#define TLAN_TC_AUISEL 0x2000 -#define TLAN_TC_SQEEN 0x1000 -#define TLAN_TC_MTEST 0x0800 -#define TLAN_TC_RESERVED 0x07F8 -#define TLAN_TC_NFEW 0x0004 -#define TLAN_TC_INTEN 0x0002 -#define TLAN_TC_TINT 0x0001 -#define TLAN_TLPHY_STS 0x12 -#define TLAN_TS_MINT 0x8000 -#define TLAN_TS_PHOK 0x4000 -#define TLAN_TS_POLOK 0x2000 -#define TLAN_TS_TPENERGY 0x1000 -#define TLAN_TS_RESERVED 0x0FFF -#define TLAN_TLPHY_PAR 0x19 -#define TLAN_PHY_CIM_STAT 0x0020 -#define TLAN_PHY_SPEED_100 0x0040 -#define TLAN_PHY_DUPLEX_FULL 0x0080 -#define TLAN_PHY_AN_EN_STAT 0x0400 - -/* National Sem. & Level1 PHY id's */ -#define NAT_SEM_ID1 0x2000 -#define NAT_SEM_ID2 0x5C01 -#define LEVEL1_ID1 0x7810 -#define LEVEL1_ID2 0x0000 - -#define CIRC_INC( a, b ) if ( ++a >= b ) a = 0 - -/* Routines to access internal registers. */ - -inline u8 TLan_DioRead8(u16 base_addr, u16 internal_addr) -{ - outw(internal_addr, base_addr + TLAN_DIO_ADR); - return (inb((base_addr + TLAN_DIO_DATA) + (internal_addr & 0x3))); - -} /* TLan_DioRead8 */ - - - - -inline u16 TLan_DioRead16(u16 base_addr, u16 internal_addr) -{ - outw(internal_addr, base_addr + TLAN_DIO_ADR); - return (inw((base_addr + TLAN_DIO_DATA) + (internal_addr & 0x2))); - -} /* TLan_DioRead16 */ - - - - -inline u32 TLan_DioRead32(u16 base_addr, u16 internal_addr) -{ - outw(internal_addr, base_addr + TLAN_DIO_ADR); - return (inl(base_addr + TLAN_DIO_DATA)); - -} /* TLan_DioRead32 */ - - - - -inline void TLan_DioWrite8(u16 base_addr, u16 internal_addr, u8 data) -{ - outw(internal_addr, base_addr + TLAN_DIO_ADR); - outb(data, base_addr + TLAN_DIO_DATA + (internal_addr & 0x3)); - -} - - - - -inline void TLan_DioWrite16(u16 base_addr, u16 internal_addr, u16 data) -{ - outw(internal_addr, base_addr + TLAN_DIO_ADR); - outw(data, base_addr + TLAN_DIO_DATA + (internal_addr & 0x2)); - -} - - - - -inline void TLan_DioWrite32(u16 base_addr, u16 internal_addr, u32 data) -{ - outw(internal_addr, base_addr + TLAN_DIO_ADR); - outl(data, base_addr + TLAN_DIO_DATA + (internal_addr & 0x2)); - -} - - - -#if 0 -inline void TLan_ClearBit(u8 bit, u16 port) -{ - outb_p(inb_p(port) & ~bit, port); -} - - - - -inline int TLan_GetBit(u8 bit, u16 port) -{ - return ((int) (inb_p(port) & bit)); -} - - - - -inline void TLan_SetBit(u8 bit, u16 port) -{ - outb_p(inb_p(port) | bit, port); -} -#endif - -#define TLan_ClearBit( bit, port ) outb_p(inb_p(port) & ~bit, port) -#define TLan_GetBit( bit, port ) ((int) (inb_p(port) & bit)) -#define TLan_SetBit( bit, port ) outb_p(inb_p(port) | bit, port) - -#ifdef I_LIKE_A_FAST_HASH_FUNCTION -/* given 6 bytes, view them as 8 6-bit numbers and return the XOR of those */ -/* the code below is about seven times as fast as the original code */ -inline u32 TLan_HashFunc(u8 * a) -{ - u8 hash; - - hash = (a[0] ^ a[3]); /* & 077 */ - hash ^= ((a[0] ^ a[3]) >> 6); /* & 003 */ - hash ^= ((a[1] ^ a[4]) << 2); /* & 074 */ - hash ^= ((a[1] ^ a[4]) >> 4); /* & 017 */ - hash ^= ((a[2] ^ a[5]) << 4); /* & 060 */ - hash ^= ((a[2] ^ a[5]) >> 2); /* & 077 */ - - return (hash & 077); -} - -#else /* original code */ - -inline u32 xor(u32 a, u32 b) -{ - return ((a && !b) || (!a && b)); -} - -#define XOR8( a, b, c, d, e, f, g, h ) xor( a, xor( b, xor( c, xor( d, xor( e, xor( f, xor( g, h ) ) ) ) ) ) ) -#define DA( a, bit ) ( ( (u8) a[bit/8] ) & ( (u8) ( 1 << bit%8 ) ) ) - -inline u32 TLan_HashFunc(u8 * a) -{ - u32 hash; - - hash = - XOR8(DA(a, 0), DA(a, 6), DA(a, 12), DA(a, 18), DA(a, 24), - DA(a, 30), DA(a, 36), DA(a, 42)); - hash |= - XOR8(DA(a, 1), DA(a, 7), DA(a, 13), DA(a, 19), DA(a, 25), - DA(a, 31), DA(a, 37), DA(a, 43)) << 1; - hash |= - XOR8(DA(a, 2), DA(a, 8), DA(a, 14), DA(a, 20), DA(a, 26), - DA(a, 32), DA(a, 38), DA(a, 44)) << 2; - hash |= - XOR8(DA(a, 3), DA(a, 9), DA(a, 15), DA(a, 21), DA(a, 27), - DA(a, 33), DA(a, 39), DA(a, 45)) << 3; - hash |= - XOR8(DA(a, 4), DA(a, 10), DA(a, 16), DA(a, 22), DA(a, 28), - DA(a, 34), DA(a, 40), DA(a, 46)) << 4; - hash |= - XOR8(DA(a, 5), DA(a, 11), DA(a, 17), DA(a, 23), DA(a, 29), - DA(a, 35), DA(a, 41), DA(a, 47)) << 5; - - return hash; - -} - -#endif /* I_LIKE_A_FAST_HASH_FUNCTION */ diff --git a/usr/src/grub/grub-0.95/netboot/tulip.c b/usr/src/grub/grub-0.95/netboot/tulip.c deleted file mode 100644 index 747ea53659..0000000000 --- a/usr/src/grub/grub-0.95/netboot/tulip.c +++ /dev/null @@ -1,2069 +0,0 @@ -/* -*- Mode:C; c-basic-offset:4; -*- */ - -/* - Tulip and clone Etherboot Driver - - By Marty Connor (mdc@thinguin.org) - Copyright (C) 2001 Entity Cyber, Inc. - - This software may be used and distributed according to the terms - of the GNU Public License, incorporated herein by reference. - - As of April 2001 this driver should support most tulip cards that - the Linux tulip driver supports because Donald Becker's Linux media - detection code is now included. - - Based on Ken Yap's Tulip Etherboot Driver and Donald Becker's - Linux Tulip Driver. Supports N-Way speed auto-configuration on - MX98715, MX98715A and MX98725. Support inexpensive PCI 10/100 cards - based on the Macronix MX987x5 chip, such as the SOHOware Fast - model SFA110A, and the LinkSYS model LNE100TX. The NetGear - model FA310X, based on the LC82C168 chip is supported. - The TRENDnet TE100-PCIA NIC which uses a genuine Intel 21143-PD - chipset is supported. Also, Davicom DM9102's. - - Documentation and source code used: - Source for Etherboot driver at - http://etherboot.sourceforge.net/ - MX98715A Data Sheet and MX98715A Application Note - on http://www.macronix.com/ (PDF format files) - Source for Linux tulip driver at - http://cesdis.gsfc.nasa.gov/linux/drivers/tulip.html - - Adapted by Ken Yap from - FreeBSD netboot DEC 21143 driver - Author: David Sharp - date: Nov/98 - - Some code fragments were taken from verious places, Ken Yap's - etherboot, FreeBSD's if_de.c, and various Linux related files. - DEC's manuals for the 21143 and SROM format were very helpful. - The Linux de driver development page has a number of links to - useful related information. Have a look at: - ftp://cesdis.gsfc.nasa.gov/pub/linux/drivers/tulip-devel.html -*/ - -/*********************************************************************/ -/* Revision History */ -/*********************************************************************/ - -/* - 07 Sep 2003 timlegge Multicast Support Added - 11 Apr 2001 mdc [patch to etherboot 4.7.24] - Major rewrite to include Linux tulip driver media detection - code. This driver should support a lot more cards now. - 16 Jul 2000 mdc 0.75b11 - Added support for ADMtek 0985 Centaur-P, a "Comet" tulip clone - which is used on the LinkSYS LNE100TX v4.x cards. We already - support LNE100TX v2.0 cards, which use a different controller. - 04 Jul 2000 jam ? - Added test of status after receiving a packet from the card. - Also uncommented the tulip_disable routine. Stray packets - seemed to be causing problems. - 27 Apr 2000 njl ? - 29 Feb 2000 mdc 0.75b7 - Increased reset delay to 3 seconds because Macronix cards seem to - need more reset time before card comes back to a usable state. - 26 Feb 2000 mdc 0.75b6 - Added a 1 second delay after initializing the transmitter because - some cards seem to need the time or they drop the first packet - transmitted. - 23 Feb 2000 mdc 0.75b5 - removed udelay code and used currticks() for more reliable delay - code in reset pause and sanity timeouts. Added function prototypes - and TX debugging code. - 21 Feb 2000 mdc patch to Etherboot 4.4.3 - Incorporated patches from Bob Edwards and Paul Mackerras of - Linuxcare's OZLabs to deal with inefficiencies in tulip_transmit - and udelay. We now wait for packet transmission to complete - (or sanity timeout). - 04 Feb 2000 Robert.Edwards@anu.edu.au patch to Etherboot 4.4.2 - patch to tulip.c that implements the automatic selection of the MII - interface on cards using the Intel/DEC 21143 reference design, in - particular, the TRENDnet TE100-PCIA NIC which uses a genuine Intel - 21143-PD chipset. - 11 Jan 2000 mdc 0.75b4 - Added support for NetGear FA310TX card based on the LC82C168 - chip. This should also support Lite-On LC82C168 boards. - Added simple MII support. Re-arranged code to better modularize - initializations. - 04 Dec 1999 mdc 0.75b3 - Added preliminary support for LNE100TX PCI cards. Should work for - PNIC2 cards. No MII support, but single interface (RJ45) tulip - cards seem to not care. - 03 Dec 1999 mdc 0.75b2 - Renamed from mx987x5 to tulip, merged in original tulip init code - from tulip.c to support other tulip compatible cards. - 02 Dec 1999 mdc 0.75b1 - Released Beta MX987x5 Driver for code review and testing to netboot - and thinguin mailing lists. -*/ - -/*********************************************************************/ -/* Declarations */ -/*********************************************************************/ - -#include "etherboot.h" -#include "nic.h" -#include "pci.h" - -/* User settable parameters */ - -#undef TULIP_DEBUG -#undef TULIP_DEBUG_WHERE -#ifdef TULIP_DEBUG -static int tulip_debug = 2; /* 1 normal messages, 0 quiet .. 7 verbose. */ -#endif - -#define TX_TIME_OUT 2*TICKS_PER_SEC - -typedef uint8_t u8; -typedef int8_t s8; -typedef uint16_t u16; -typedef int16_t s16; -typedef uint32_t u32; -typedef int32_t s32; - -/* helpful macros if on a big_endian machine for changing byte order. - not strictly needed on Intel */ -#define get_unaligned(ptr) (*(ptr)) -#define put_unaligned(val, ptr) ((void)( *(ptr) = (val) )) -#define get_u16(ptr) (*(u16 *)(ptr)) -#define virt_to_le32desc(addr) virt_to_bus(addr) - -#define TULIP_IOTYPE PCI_USES_MASTER | PCI_USES_IO | PCI_ADDR0 -#define TULIP_SIZE 0x80 - -/* This is a mysterious value that can be written to CSR11 in the 21040 (only) - to support a pre-NWay full-duplex signaling mechanism using short frames. - No one knows what it should be, but if left at its default value some - 10base2(!) packets trigger a full-duplex-request interrupt. */ -#define FULL_DUPLEX_MAGIC 0x6969 - -static const int csr0 = 0x01A00000 | 0x8000; - -/* The possible media types that can be set in options[] are: */ -#define MEDIA_MASK 31 -static const char * const medianame[32] = { - "10baseT", "10base2", "AUI", "100baseTx", - "10baseT-FDX", "100baseTx-FDX", "100baseT4", "100baseFx", - "100baseFx-FDX", "MII 10baseT", "MII 10baseT-FDX", "MII", - "10baseT(forced)", "MII 100baseTx", "MII 100baseTx-FDX", "MII 100baseT4", - "MII 100baseFx-HDX", "MII 100baseFx-FDX", "Home-PNA 1Mbps", "Invalid-19", -}; - -/* This much match tulip_tbl[]! Note 21142 == 21143. */ -enum tulip_chips { - DC21040=0, DC21041=1, DC21140=2, DC21142=3, DC21143=3, - LC82C168, MX98713, MX98715, MX98725, AX88141, AX88140, PNIC2, COMET, - COMPEX9881, I21145, XIRCOM -}; - -enum pci_id_flags_bits { - /* Set PCI command register bits before calling probe1(). */ - PCI_USES_IO=1, PCI_USES_MEM=2, PCI_USES_MASTER=4, - /* Read and map the single following PCI BAR. */ - PCI_ADDR0=0<<4, PCI_ADDR1=1<<4, PCI_ADDR2=2<<4, PCI_ADDR3=3<<4, - PCI_ADDR_64BITS=0x100, PCI_NO_ACPI_WAKE=0x200, PCI_NO_MIN_LATENCY=0x400, - PCI_UNUSED_IRQ=0x800, -}; - -struct pci_id_info { - char *name; - struct match_info { - u32 pci, pci_mask, subsystem, subsystem_mask; - u32 revision, revision_mask; /* Only 8 bits. */ - } id; - enum pci_id_flags_bits pci_flags; - int io_size; /* Needed for I/O region check or ioremap(). */ - int drv_flags; /* Driver use, intended as capability flags. */ -}; - -static struct pci_id_info pci_id_tbl[] = { - { "Digital DC21040 Tulip", { 0x00021011, 0xffffffff, 0, 0, 0, 0 }, - TULIP_IOTYPE, 0x80, DC21040 }, - { "Digital DC21041 Tulip", { 0x00141011, 0xffffffff, 0, 0, 0, 0 }, - TULIP_IOTYPE, 0x80, DC21041 }, - { "Digital DS21140A Tulip", { 0x00091011, 0xffffffff, 0,0, 0x20,0xf0 }, - TULIP_IOTYPE, 0x80, DC21140 }, - { "Digital DS21140 Tulip", { 0x00091011, 0xffffffff, 0, 0, 0, 0 }, - TULIP_IOTYPE, 0x80, DC21140 }, - { "Digital DS21143 Tulip", { 0x00191011, 0xffffffff, 0,0, 65,0xff }, - TULIP_IOTYPE, TULIP_SIZE, DC21142 }, - { "Digital DS21142 Tulip", { 0x00191011, 0xffffffff, 0, 0, 0, 0 }, - TULIP_IOTYPE, TULIP_SIZE, DC21142 }, - { "Kingston KNE110tx (PNIC)", { 0x000211AD, 0xffffffff, 0xf0022646, 0xffffffff, 0, 0 }, - TULIP_IOTYPE, 256, LC82C168 }, - { "Lite-On 82c168 PNIC", { 0x000211AD, 0xffffffff, 0, 0, 0, 0 }, - TULIP_IOTYPE, 256, LC82C168 }, - { "Macronix 98713 PMAC", { 0x051210d9, 0xffffffff, 0, 0, 0, 0 }, - TULIP_IOTYPE, 256, MX98713 }, - { "Macronix 98715 PMAC", { 0x053110d9, 0xffffffff, 0, 0, 0, 0 }, - TULIP_IOTYPE, 256, MX98715 }, - { "Macronix 98725 PMAC", { 0x053110d9, 0xffffffff, 0, 0, 0, 0 }, - TULIP_IOTYPE, 256, MX98725 }, - { "ASIX AX88141", { 0x1400125B, 0xffffffff, 0,0, 0x10, 0xf0 }, - TULIP_IOTYPE, 128, AX88141 }, - { "ASIX AX88140", { 0x1400125B, 0xffffffff, 0, 0, 0, 0 }, - TULIP_IOTYPE, 128, AX88140 }, - { "Lite-On LC82C115 PNIC-II", { 0xc11511AD, 0xffffffff, 0, 0, 0, 0 }, - TULIP_IOTYPE, 256, PNIC2 }, - { "ADMtek AN981 Comet", { 0x09811317, 0xffffffff, 0, 0, 0, 0 }, - TULIP_IOTYPE, 256, COMET }, - { "ADMTek AN983 Comet", { 0x12161113, 0xffffffff, 0, 0, 0, 0 }, - TULIP_IOTYPE, 256, COMET }, - { "ADMtek Centaur-P", { 0x09851317, 0xffffffff, 0, 0, 0, 0 }, - TULIP_IOTYPE, 256, COMET }, - { "ADMtek Centaur-C", { 0x19851317, 0xffffffff, 0, 0, 0, 0 }, - TULIP_IOTYPE, 256, COMET }, - { "Compex RL100-TX", { 0x988111F6, 0xffffffff, 0, 0, 0, 0 }, - TULIP_IOTYPE, 128, COMPEX9881 }, - { "Intel 21145 Tulip", { 0x00398086, 0xffffffff, 0, 0, 0, 0 }, - TULIP_IOTYPE, 128, I21145 }, - { "Xircom Tulip clone", { 0x0003115d, 0xffffffff, 0, 0, 0, 0 }, - TULIP_IOTYPE, 128, XIRCOM }, - { "Davicom DM9102", { 0x91021282, 0xffffffff, 0, 0, 0, 0 }, - TULIP_IOTYPE, 0x80, DC21140 }, - { "Davicom DM9100", { 0x91001282, 0xffffffff, 0, 0, 0, 0 }, - TULIP_IOTYPE, 0x80, DC21140 }, - { "Macronix mxic-98715 (EN1217)", { 0x12171113, 0xffffffff, 0, 0, 0, 0 }, - TULIP_IOTYPE, 256, MX98715 }, - { 0, { 0, 0, 0, 0, 0, 0 }, 0, 0, 0 }, -}; - -enum tbl_flag { - HAS_MII=1, HAS_MEDIA_TABLE=2, CSR12_IN_SROM=4, ALWAYS_CHECK_MII=8, - HAS_PWRDWN=0x10, MC_HASH_ONLY=0x20, /* Hash-only multicast filter. */ - HAS_PNICNWAY=0x80, HAS_NWAY=0x40, /* Uses internal NWay xcvr. */ - HAS_INTR_MITIGATION=0x100, IS_ASIX=0x200, HAS_8023X=0x400, -}; - -/* Note: this table must match enum tulip_chips above. */ -static struct tulip_chip_table { - char *chip_name; - int flags; -} tulip_tbl[] = { - { "Digital DC21040 Tulip", 0}, - { "Digital DC21041 Tulip", HAS_MEDIA_TABLE | HAS_NWAY }, - { "Digital DS21140 Tulip", HAS_MII | HAS_MEDIA_TABLE | CSR12_IN_SROM }, - { "Digital DS21143 Tulip", HAS_MII | HAS_MEDIA_TABLE | ALWAYS_CHECK_MII - | HAS_PWRDWN | HAS_NWAY | HAS_INTR_MITIGATION }, - { "Lite-On 82c168 PNIC", HAS_MII | HAS_PNICNWAY }, - { "Macronix 98713 PMAC", HAS_MII | HAS_MEDIA_TABLE | CSR12_IN_SROM }, - { "Macronix 98715 PMAC", HAS_MEDIA_TABLE }, - { "Macronix 98725 PMAC", HAS_MEDIA_TABLE }, - { "ASIX AX88140", HAS_MII | HAS_MEDIA_TABLE | CSR12_IN_SROM - | MC_HASH_ONLY | IS_ASIX }, - { "ASIX AX88141", HAS_MII | HAS_MEDIA_TABLE | CSR12_IN_SROM | MC_HASH_ONLY - | IS_ASIX }, - { "Lite-On PNIC-II", HAS_MII | HAS_NWAY | HAS_8023X }, - { "ADMtek Comet", MC_HASH_ONLY }, - { "Compex 9881 PMAC", HAS_MII | HAS_MEDIA_TABLE | CSR12_IN_SROM }, - { "Intel DS21145 Tulip", HAS_MII | HAS_MEDIA_TABLE | ALWAYS_CHECK_MII - | HAS_PWRDWN | HAS_NWAY }, - { "Xircom tulip work-alike", HAS_MII | HAS_MEDIA_TABLE | ALWAYS_CHECK_MII - | HAS_PWRDWN | HAS_NWAY }, - { 0, 0 }, -}; - -/* A full-duplex map for media types. */ -enum MediaIs { - MediaIsFD = 1, MediaAlwaysFD=2, MediaIsMII=4, MediaIsFx=8, - MediaIs100=16}; - -static const char media_cap[32] = -{0,0,0,16, 3,19,16,24, 27,4,7,5, 0,20,23,20, 20,31,0,0, }; -static u8 t21040_csr13[] = {2,0x0C,8,4, 4,0,0,0, 0,0,0,0, 4,0,0,0}; - -/* 21041 transceiver register settings: 10-T, 10-2, AUI, 10-T, 10T-FD */ -static u16 t21041_csr13[] = { 0xEF01, 0xEF09, 0xEF09, 0xEF01, 0xEF09, }; -static u16 t21041_csr14[] = { 0xFFFF, 0xF7FD, 0xF7FD, 0x7F3F, 0x7F3D, }; -static u16 t21041_csr15[] = { 0x0008, 0x0006, 0x000E, 0x0008, 0x0008, }; - -/* not used -static u16 t21142_csr13[] = { 0x0001, 0x0009, 0x0009, 0x0000, 0x0001, }; -*/ -static u16 t21142_csr14[] = { 0xFFFF, 0x0705, 0x0705, 0x0000, 0x7F3D, }; -/* not used -static u16 t21142_csr15[] = { 0x0008, 0x0006, 0x000E, 0x0008, 0x0008, }; -*/ - -/* Offsets to the Command and Status Registers, "CSRs". All accesses - must be longword instructions and quadword aligned. */ -enum tulip_offsets { - CSR0=0, CSR1=0x08, CSR2=0x10, CSR3=0x18, CSR4=0x20, CSR5=0x28, - CSR6=0x30, CSR7=0x38, CSR8=0x40, CSR9=0x48, CSR10=0x50, CSR11=0x58, - CSR12=0x60, CSR13=0x68, CSR14=0x70, CSR15=0x78, CSR16=0x80, CSR20=0xA0 -}; - -/* The bits in the CSR5 status registers, mostly interrupt sources. */ -enum status_bits { - TimerInt=0x800, TPLnkFail=0x1000, TPLnkPass=0x10, - NormalIntr=0x10000, AbnormalIntr=0x8000, - RxJabber=0x200, RxDied=0x100, RxNoBuf=0x80, RxIntr=0x40, - TxFIFOUnderflow=0x20, TxJabber=0x08, TxNoBuf=0x04, TxDied=0x02, TxIntr=0x01, -}; - -/* The configuration bits in CSR6. */ -enum csr6_mode_bits { - TxOn=0x2000, RxOn=0x0002, FullDuplex=0x0200, - AcceptBroadcast=0x0100, AcceptAllMulticast=0x0080, - AcceptAllPhys=0x0040, AcceptRunt=0x0008, -}; - - -enum desc_status_bits { - DescOwnded=0x80000000, RxDescFatalErr=0x8000, RxWholePkt=0x0300, -}; - -struct medialeaf { - u8 type; - u8 media; - unsigned char *leafdata; -}; - -struct mediatable { - u16 defaultmedia; - u8 leafcount, csr12dir; /* General purpose pin directions. */ - unsigned has_mii:1, has_nonmii:1, has_reset:6; - u32 csr15dir, csr15val; /* 21143 NWay setting. */ - struct medialeaf mleaf[0]; -}; - -struct mediainfo { - struct mediainfo *next; - int info_type; - int index; - unsigned char *info; -}; - -/* EEPROM Address width definitions */ -#define EEPROM_ADDRLEN 6 -#define EEPROM_SIZE 128 /* 2 << EEPROM_ADDRLEN */ - -/* The EEPROM commands include the alway-set leading bit. */ -#define EE_WRITE_CMD (5 << addr_len) -#define EE_READ_CMD (6 << addr_len) -#define EE_ERASE_CMD (7 << addr_len) - -/* EEPROM_Ctrl bits. */ -#define EE_SHIFT_CLK 0x02 /* EEPROM shift clock. */ -#define EE_CS 0x01 /* EEPROM chip select. */ -#define EE_DATA_WRITE 0x04 /* EEPROM chip data in. */ -#define EE_WRITE_0 0x01 -#define EE_WRITE_1 0x05 -#define EE_DATA_READ 0x08 /* EEPROM chip data out. */ -#define EE_ENB (0x4800 | EE_CS) - -/* Delay between EEPROM clock transitions. Even at 33Mhz current PCI - implementations don't overrun the EEPROM clock. We add a bus - turn-around to insure that this remains true. */ -#define eeprom_delay() inl(ee_addr) - -/* Size of transmit and receive buffers */ -#define BUFLEN 1536 - -/* Ring-wrap flag in length field, use for last ring entry. - 0x01000000 means chain on buffer2 address, - 0x02000000 means use the ring start address in CSR2/3. - Note: Some work-alike chips do not function correctly in chained mode. - The ASIX chip works only in chained mode. - Thus we indicate ring mode, but always write the 'next' field for - chained mode as well. */ -#define DESC_RING_WRAP 0x02000000 - -/* transmit and receive descriptor format */ -struct tulip_rx_desc { - volatile u32 status; - u32 length; - u32 buffer1, buffer2; -}; - -struct tulip_tx_desc { - volatile u32 status; - u32 length; - u32 buffer1, buffer2; -}; - -/*********************************************************************/ -/* Global Storage */ -/*********************************************************************/ - -static u32 ioaddr; - -/* Note: transmit and receive buffers must be longword aligned and - longword divisable */ - -#define TX_RING_SIZE 2 -static struct tulip_tx_desc tx_ring[TX_RING_SIZE] __attribute__ ((aligned(4))); -static unsigned char txb[BUFLEN] __attribute__ ((aligned(4))); - -#define RX_RING_SIZE 4 -static struct tulip_rx_desc rx_ring[RX_RING_SIZE] __attribute__ ((aligned(4))); -static unsigned char rxb[RX_RING_SIZE * BUFLEN] __attribute__ ((aligned(4))); - -static struct tulip_private { - int cur_rx; - int chip_id; /* index into tulip_tbl[] */ - int pci_id_idx; /* index into pci_id_tbl[] */ - int revision; - int flags; - unsigned short vendor_id; /* PCI card vendor code */ - unsigned short dev_id; /* PCI card device code */ - unsigned char ehdr[ETH_HLEN]; /* buffer for ethernet header */ - const char *nic_name; - unsigned int csr0, csr6; /* Current CSR0, CSR6 settings. */ - unsigned int if_port; - unsigned int full_duplex; /* Full-duplex operation requested. */ - unsigned int full_duplex_lock; - unsigned int medialock; /* Do not sense media type. */ - unsigned int mediasense; /* Media sensing in progress. */ - unsigned int nway, nwayset; /* 21143 internal NWay. */ - unsigned int default_port; - unsigned char eeprom[EEPROM_SIZE]; /* Serial EEPROM contents. */ - u8 media_table_storage[(sizeof(struct mediatable) + 32*sizeof(struct medialeaf))]; - u16 sym_advertise, mii_advertise; /* NWay to-advertise. */ - struct mediatable *mtable; - u16 lpar; /* 21143 Link partner ability. */ - u16 advertising[4]; /* MII advertise, from SROM table. */ - signed char phys[4], mii_cnt; /* MII device addresses. */ - int cur_index; /* Current media index. */ - int saved_if_port; -} tpx; - -static struct tulip_private *tp; - -/* Known cards that have old-style EEPROMs. - Writing this table is described at - http://cesdis.gsfc.nasa.gov/linux/drivers/tulip-drivers/tulip-media.html */ -static struct fixups { - char *name; - unsigned char addr0, addr1, addr2; - u16 newtable[32]; /* Max length below. */ -} eeprom_fixups[] = { - {"Asante", 0, 0, 0x94, {0x1e00, 0x0000, 0x0800, 0x0100, 0x018c, - 0x0000, 0x0000, 0xe078, 0x0001, 0x0050, 0x0018 }}, - {"SMC9332DST", 0, 0, 0xC0, { 0x1e00, 0x0000, 0x0800, 0x041f, - 0x0000, 0x009E, /* 10baseT */ - 0x0004, 0x009E, /* 10baseT-FD */ - 0x0903, 0x006D, /* 100baseTx */ - 0x0905, 0x006D, /* 100baseTx-FD */ }}, - {"Cogent EM100", 0, 0, 0x92, { 0x1e00, 0x0000, 0x0800, 0x063f, - 0x0107, 0x8021, /* 100baseFx */ - 0x0108, 0x8021, /* 100baseFx-FD */ - 0x0100, 0x009E, /* 10baseT */ - 0x0104, 0x009E, /* 10baseT-FD */ - 0x0103, 0x006D, /* 100baseTx */ - 0x0105, 0x006D, /* 100baseTx-FD */ }}, - {"Maxtech NX-110", 0, 0, 0xE8, { 0x1e00, 0x0000, 0x0800, 0x0513, - 0x1001, 0x009E, /* 10base2, CSR12 0x10*/ - 0x0000, 0x009E, /* 10baseT */ - 0x0004, 0x009E, /* 10baseT-FD */ - 0x0303, 0x006D, /* 100baseTx, CSR12 0x03 */ - 0x0305, 0x006D, /* 100baseTx-FD CSR12 0x03 */}}, - {"Accton EN1207", 0, 0, 0xE8, { 0x1e00, 0x0000, 0x0800, 0x051F, - 0x1B01, 0x0000, /* 10base2, CSR12 0x1B */ - 0x0B00, 0x009E, /* 10baseT, CSR12 0x0B */ - 0x0B04, 0x009E, /* 10baseT-FD,CSR12 0x0B */ - 0x1B03, 0x006D, /* 100baseTx, CSR12 0x1B */ - 0x1B05, 0x006D, /* 100baseTx-FD CSR12 0x1B */ - }}, - {0, 0, 0, 0, {}}}; - -static const char * block_name[] = {"21140 non-MII", "21140 MII PHY", - "21142 Serial PHY", "21142 MII PHY", "21143 SYM PHY", "21143 reset method"}; - -/*********************************************************************/ -/* Function Prototypes */ -/*********************************************************************/ -static int mdio_read(struct nic *nic, int phy_id, int location); -static void mdio_write(struct nic *nic, int phy_id, int location, int value); -static int read_eeprom(unsigned long ioaddr, int location, int addr_len); -static void parse_eeprom(struct nic *nic); -static int tulip_probe(struct dev *dev, struct pci_device *pci); -static void tulip_init_ring(struct nic *nic); -static void tulip_reset(struct nic *nic); -static void tulip_transmit(struct nic *nic, const char *d, unsigned int t, - unsigned int s, const char *p); -static int tulip_poll(struct nic *nic, int retrieve); -static void tulip_disable(struct dev *dev); -static void nway_start(struct nic *nic); -static void pnic_do_nway(struct nic *nic); -static void select_media(struct nic *nic, int startup); -static void init_media(struct nic *nic); -static void start_link(struct nic *nic); -static int tulip_check_duplex(struct nic *nic); - -static void tulip_wait(unsigned int nticks); - -#ifdef TULIP_DEBUG_WHERE -static void whereami(const char *str); -#endif - -#ifdef TULIP_DEBUG -static void tulip_more(void); -#endif - -/*********************************************************************/ -/* Utility Routines */ -/*********************************************************************/ - -#ifdef TULIP_DEBUG_WHERE -static void whereami (const char *str) -{ - printf("%s: %s\n", tp->nic_name, str); - /* sleep(2); */ -} -#endif - -#ifdef TULIP_DEBUG -static void tulip_more(void) -{ - printf("\n\n-- more --"); - while (!iskey()) - /* wait */; - getchar(); - printf("\n\n"); -} -#endif /* TULIP_DEBUG */ - -static void tulip_wait(unsigned int nticks) -{ - unsigned int to = currticks() + nticks; - while (currticks() < to) - /* wait */ ; -} - -/*********************************************************************/ -/* Media Descriptor Code */ -/*********************************************************************/ - -/* MII transceiver control section. - Read and write the MII registers using software-generated serial - MDIO protocol. See the MII specifications or DP83840A data sheet - for details. */ - -/* The maximum data clock rate is 2.5 Mhz. The minimum timing is usually - met by back-to-back PCI I/O cycles, but we insert a delay to avoid - "overclocking" issues or future 66Mhz PCI. */ -#define mdio_delay() inl(mdio_addr) - -/* Read and write the MII registers using software-generated serial - MDIO protocol. It is just different enough from the EEPROM protocol - to not share code. The maxium data clock rate is 2.5 Mhz. */ -#define MDIO_SHIFT_CLK 0x10000 -#define MDIO_DATA_WRITE0 0x00000 -#define MDIO_DATA_WRITE1 0x20000 -#define MDIO_ENB 0x00000 /* Ignore the 0x02000 databook setting. */ -#define MDIO_ENB_IN 0x40000 -#define MDIO_DATA_READ 0x80000 - -/* MII transceiver control section. - Read and write the MII registers using software-generated serial - MDIO protocol. See the MII specifications or DP83840A data sheet - for details. */ - -int mdio_read(struct nic *nic __unused, int phy_id, int location) -{ - int i; - int read_cmd = (0xf6 << 10) | (phy_id << 5) | location; - int retval = 0; - long mdio_addr = ioaddr + CSR9; - -#ifdef TULIP_DEBUG_WHERE - whereami("mdio_read\n"); -#endif - - if (tp->chip_id == LC82C168) { - int i = 1000; - outl(0x60020000 + (phy_id<<23) + (location<<18), ioaddr + 0xA0); - inl(ioaddr + 0xA0); - inl(ioaddr + 0xA0); - while (--i > 0) - if ( ! ((retval = inl(ioaddr + 0xA0)) & 0x80000000)) - return retval & 0xffff; - return 0xffff; - } - - if (tp->chip_id == COMET) { - if (phy_id == 1) { - if (location < 7) - return inl(ioaddr + 0xB4 + (location<<2)); - else if (location == 17) - return inl(ioaddr + 0xD0); - else if (location >= 29 && location <= 31) - return inl(ioaddr + 0xD4 + ((location-29)<<2)); - } - return 0xffff; - } - - /* Establish sync by sending at least 32 logic ones. */ - for (i = 32; i >= 0; i--) { - outl(MDIO_ENB | MDIO_DATA_WRITE1, mdio_addr); - mdio_delay(); - outl(MDIO_ENB | MDIO_DATA_WRITE1 | MDIO_SHIFT_CLK, mdio_addr); - mdio_delay(); - } - /* Shift the read command bits out. */ - for (i = 15; i >= 0; i--) { - int dataval = (read_cmd & (1 << i)) ? MDIO_DATA_WRITE1 : 0; - - outl(MDIO_ENB | dataval, mdio_addr); - mdio_delay(); - outl(MDIO_ENB | dataval | MDIO_SHIFT_CLK, mdio_addr); - mdio_delay(); - } - /* Read the two transition, 16 data, and wire-idle bits. */ - for (i = 19; i > 0; i--) { - outl(MDIO_ENB_IN, mdio_addr); - mdio_delay(); - retval = (retval << 1) | ((inl(mdio_addr) & MDIO_DATA_READ) ? 1 : 0); - outl(MDIO_ENB_IN | MDIO_SHIFT_CLK, mdio_addr); - mdio_delay(); - } - return (retval>>1) & 0xffff; -} - -void mdio_write(struct nic *nic __unused, int phy_id, int location, int value) -{ - int i; - int cmd = (0x5002 << 16) | (phy_id << 23) | (location<<18) | value; - long mdio_addr = ioaddr + CSR9; - -#ifdef TULIP_DEBUG_WHERE - whereami("mdio_write\n"); -#endif - - if (tp->chip_id == LC82C168) { - int i = 1000; - outl(cmd, ioaddr + 0xA0); - do - if ( ! (inl(ioaddr + 0xA0) & 0x80000000)) - break; - while (--i > 0); - return; - } - - if (tp->chip_id == COMET) { - if (phy_id != 1) - return; - if (location < 7) - outl(value, ioaddr + 0xB4 + (location<<2)); - else if (location == 17) - outl(value, ioaddr + 0xD0); - else if (location >= 29 && location <= 31) - outl(value, ioaddr + 0xD4 + ((location-29)<<2)); - return; - } - - /* Establish sync by sending 32 logic ones. */ - for (i = 32; i >= 0; i--) { - outl(MDIO_ENB | MDIO_DATA_WRITE1, mdio_addr); - mdio_delay(); - outl(MDIO_ENB | MDIO_DATA_WRITE1 | MDIO_SHIFT_CLK, mdio_addr); - mdio_delay(); - } - /* Shift the command bits out. */ - for (i = 31; i >= 0; i--) { - int dataval = (cmd & (1 << i)) ? MDIO_DATA_WRITE1 : 0; - outl(MDIO_ENB | dataval, mdio_addr); - mdio_delay(); - outl(MDIO_ENB | dataval | MDIO_SHIFT_CLK, mdio_addr); - mdio_delay(); - } - /* Clear out extra bits. */ - for (i = 2; i > 0; i--) { - outl(MDIO_ENB_IN, mdio_addr); - mdio_delay(); - outl(MDIO_ENB_IN | MDIO_SHIFT_CLK, mdio_addr); - mdio_delay(); - } -} - -/*********************************************************************/ -/* EEPROM Reading Code */ -/*********************************************************************/ -/* EEPROM routines adapted from the Linux Tulip Code */ -/* Reading a serial EEPROM is a "bit" grungy, but we work our way - through:->. -*/ -static int read_eeprom(unsigned long ioaddr, int location, int addr_len) -{ - int i; - unsigned short retval = 0; - long ee_addr = ioaddr + CSR9; - int read_cmd = location | EE_READ_CMD; - -#ifdef TULIP_DEBUG_WHERE - whereami("read_eeprom\n"); -#endif - - outl(EE_ENB & ~EE_CS, ee_addr); - outl(EE_ENB, ee_addr); - - /* Shift the read command bits out. */ - for (i = 4 + addr_len; i >= 0; i--) { - short dataval = (read_cmd & (1 << i)) ? EE_DATA_WRITE : 0; - outl(EE_ENB | dataval, ee_addr); - eeprom_delay(); - outl(EE_ENB | dataval | EE_SHIFT_CLK, ee_addr); - eeprom_delay(); - } - outl(EE_ENB, ee_addr); - - for (i = 16; i > 0; i--) { - outl(EE_ENB | EE_SHIFT_CLK, ee_addr); - eeprom_delay(); - retval = (retval << 1) | ((inl(ee_addr) & EE_DATA_READ) ? 1 : 0); - outl(EE_ENB, ee_addr); - eeprom_delay(); - } - - /* Terminate the EEPROM access. */ - outl(EE_ENB & ~EE_CS, ee_addr); - return retval; -} - -/*********************************************************************/ -/* EEPROM Parsing Code */ -/*********************************************************************/ -static void parse_eeprom(struct nic *nic) -{ - unsigned char *p, *ee_data = tp->eeprom; - int new_advertise = 0; - int i; - -#ifdef TULIP_DEBUG_WHERE - whereami("parse_eeprom\n"); -#endif - - tp->mtable = 0; - /* Detect an old-style (SA only) EEPROM layout: - memcmp(ee_data, ee_data+16, 8). */ - for (i = 0; i < 8; i ++) - if (ee_data[i] != ee_data[16+i]) - break; - if (i >= 8) { - /* Do a fix-up based on the vendor half of the station address. */ - for (i = 0; eeprom_fixups[i].name; i++) { - if (nic->node_addr[0] == eeprom_fixups[i].addr0 - && nic->node_addr[1] == eeprom_fixups[i].addr1 - && nic->node_addr[2] == eeprom_fixups[i].addr2) { - if (nic->node_addr[2] == 0xE8 && ee_data[0x1a] == 0x55) - i++; /* An Accton EN1207, not an outlaw Maxtech. */ - memcpy(ee_data + 26, eeprom_fixups[i].newtable, - sizeof(eeprom_fixups[i].newtable)); -#ifdef TULIP_DEBUG - printf("%s: Old format EEPROM on '%s' board.\n%s: Using substitute media control info.\n", - tp->nic_name, eeprom_fixups[i].name, tp->nic_name); -#endif - break; - } - } - if (eeprom_fixups[i].name == NULL) { /* No fixup found. */ -#ifdef TULIP_DEBUG - printf("%s: Old style EEPROM with no media selection information.\n", - tp->nic_name); -#endif - return; - } - } - - if (ee_data[19] > 1) { -#ifdef TULIP_DEBUG - printf("%s: Multiport cards (%d ports) may not work correctly.\n", - tp->nic_name, ee_data[19]); -#endif - } - - p = (void *)ee_data + ee_data[27]; - - if (ee_data[27] == 0) { /* No valid media table. */ -#ifdef TULIP_DEBUG - if (tulip_debug > 1) { - printf("%s: No Valid Media Table. ee_data[27] = %hhX\n", - tp->nic_name, ee_data[27]); - } -#endif - } else if (tp->chip_id == DC21041) { - int media = get_u16(p); - int count = p[2]; - p += 3; - - printf("%s: 21041 Media table, default media %hX (%s).\n", - tp->nic_name, media, - media & 0x0800 ? "Autosense" : medianame[media & 15]); - for (i = 0; i < count; i++) { - unsigned char media_block = *p++; - int media_code = media_block & MEDIA_MASK; - if (media_block & 0x40) - p += 6; - switch(media_code) { - case 0: new_advertise |= 0x0020; break; - case 4: new_advertise |= 0x0040; break; - } - printf("%s: 21041 media #%d, %s.\n", - tp->nic_name, media_code, medianame[media_code]); - } - } else { - unsigned char csr12dir = 0; - int count; - struct mediatable *mtable; - u16 media = get_u16(p); - - p += 2; - if (tp->flags & CSR12_IN_SROM) - csr12dir = *p++; - count = *p++; - - tp->mtable = mtable = (struct mediatable *)&tp->media_table_storage[0]; - - mtable->defaultmedia = media; - mtable->leafcount = count; - mtable->csr12dir = csr12dir; - mtable->has_nonmii = mtable->has_mii = mtable->has_reset = 0; - mtable->csr15dir = mtable->csr15val = 0; - - printf("%s: EEPROM default media type %s.\n", tp->nic_name, - media & 0x0800 ? "Autosense" : medianame[media & MEDIA_MASK]); - - for (i = 0; i < count; i++) { - struct medialeaf *leaf = &mtable->mleaf[i]; - - if ((p[0] & 0x80) == 0) { /* 21140 Compact block. */ - leaf->type = 0; - leaf->media = p[0] & 0x3f; - leaf->leafdata = p; - if ((p[2] & 0x61) == 0x01) /* Bogus, but Znyx boards do it. */ - mtable->has_mii = 1; - p += 4; - } else { - switch(leaf->type = p[1]) { - case 5: - mtable->has_reset = i; - leaf->media = p[2] & 0x0f; - break; - case 1: case 3: - mtable->has_mii = 1; - leaf->media = 11; - break; - case 2: - if ((p[2] & 0x3f) == 0) { - u32 base15 = (p[2] & 0x40) ? get_u16(p + 7) : 0x0008; - u16 *p1 = (u16 *)(p + (p[2] & 0x40 ? 9 : 3)); - mtable->csr15dir = (get_unaligned(p1 + 0)<<16) + base15; - mtable->csr15val = (get_unaligned(p1 + 1)<<16) + base15; - } - /* Fall through. */ - case 0: case 4: - mtable->has_nonmii = 1; - leaf->media = p[2] & MEDIA_MASK; - switch (leaf->media) { - case 0: new_advertise |= 0x0020; break; - case 4: new_advertise |= 0x0040; break; - case 3: new_advertise |= 0x0080; break; - case 5: new_advertise |= 0x0100; break; - case 6: new_advertise |= 0x0200; break; - } - break; - default: - leaf->media = 19; - } - leaf->leafdata = p + 2; - p += (p[0] & 0x3f) + 1; - } -#ifdef TULIP_DEBUG - if (tulip_debug > 1 && leaf->media == 11) { - unsigned char *bp = leaf->leafdata; - printf("%s: MII interface PHY %d, setup/reset sequences %d/%d long, capabilities %hhX %hhX.\n", - tp->nic_name, bp[0], bp[1], bp[2 + bp[1]*2], - bp[5 + bp[2 + bp[1]*2]*2], bp[4 + bp[2 + bp[1]*2]*2]); - } -#endif - printf("%s: Index #%d - Media %s (#%d) described " - "by a %s (%d) block.\n", - tp->nic_name, i, medianame[leaf->media], leaf->media, - leaf->type < 6 ? block_name[leaf->type] : "UNKNOWN", - leaf->type); - } - if (new_advertise) - tp->sym_advertise = new_advertise; - } -} - -/*********************************************************************/ -/* tulip_init_ring - setup the tx and rx descriptors */ -/*********************************************************************/ -static void tulip_init_ring(struct nic *nic __unused) -{ - int i; - -#ifdef TULIP_DEBUG_WHERE - whereami("tulip_init_ring\n"); -#endif - - tp->cur_rx = 0; - - for (i = 0; i < RX_RING_SIZE; i++) { - rx_ring[i].status = cpu_to_le32(0x80000000); - rx_ring[i].length = cpu_to_le32(BUFLEN); - rx_ring[i].buffer1 = virt_to_le32desc(&rxb[i * BUFLEN]); - rx_ring[i].buffer2 = virt_to_le32desc(&rx_ring[i+1]); - } - /* Mark the last entry as wrapping the ring. */ - rx_ring[i-1].length = cpu_to_le32(DESC_RING_WRAP | BUFLEN); - rx_ring[i-1].buffer2 = virt_to_le32desc(&rx_ring[0]); - - /* We only use 1 transmit buffer, but we use 2 descriptors so - transmit engines have somewhere to point to if they feel the need */ - - tx_ring[0].status = 0x00000000; - tx_ring[0].buffer1 = virt_to_le32desc(&txb[0]); - tx_ring[0].buffer2 = virt_to_le32desc(&tx_ring[1]); - - /* this descriptor should never get used, since it will never be owned - by the machine (status will always == 0) */ - tx_ring[1].status = 0x00000000; - tx_ring[1].buffer1 = virt_to_le32desc(&txb[0]); - tx_ring[1].buffer2 = virt_to_le32desc(&tx_ring[0]); - - /* Mark the last entry as wrapping the ring, though this should never happen */ - tx_ring[1].length = cpu_to_le32(DESC_RING_WRAP | BUFLEN); -} - -static void set_rx_mode(struct nic *nic __unused) { - int csr6 = inl(ioaddr + CSR6) & ~0x00D5; - - tp->csr6 &= ~0x00D5; - - /* !IFF_PROMISC */ - tp->csr6 |= AcceptAllMulticast; - csr6 |= AcceptAllMulticast; - - outl(csr6, ioaddr + CSR6); - - - -} - -/*********************************************************************/ -/* eth_reset - Reset adapter */ -/*********************************************************************/ -static void tulip_reset(struct nic *nic) -{ - int i; - unsigned long to; - -#ifdef TULIP_DEBUG_WHERE - whereami("tulip_reset\n"); -#endif - - /* Stop Tx and RX */ - outl(inl(ioaddr + CSR6) & ~0x00002002, ioaddr + CSR6); - - /* On some chip revs we must set the MII/SYM port before the reset!? */ - if (tp->mii_cnt || (tp->mtable && tp->mtable->has_mii)) { - outl(0x814C0000, ioaddr + CSR6); - } - - /* Reset the chip, holding bit 0 set at least 50 PCI cycles. */ - outl(0x00000001, ioaddr + CSR0); - tulip_wait(1); - - /* turn off reset and set cache align=16lword, burst=unlimit */ - outl(tp->csr0, ioaddr + CSR0); - - /* Wait the specified 50 PCI cycles after a reset */ - tulip_wait(1); - - /* set up transmit and receive descriptors */ - tulip_init_ring(nic); - - if (tp->chip_id == PNIC2) { - u32 addr_high = (nic->node_addr[1]<<8) + (nic->node_addr[0]<<0); - /* This address setting does not appear to impact chip operation?? */ - outl((nic->node_addr[5]<<8) + nic->node_addr[4] + - (nic->node_addr[3]<<24) + (nic->node_addr[2]<<16), - ioaddr + 0xB0); - outl(addr_high + (addr_high<<16), ioaddr + 0xB8); - } - - /* MC_HASH_ONLY boards don't support setup packets */ - if (tp->flags & MC_HASH_ONLY) { - u32 addr_low = cpu_to_le32(get_unaligned((u32 *)nic->node_addr)); - u32 addr_high = cpu_to_le32(get_unaligned((u16 *)(nic->node_addr+4))); - - /* clear multicast hash filters and setup MAC address filters */ - if (tp->flags & IS_ASIX) { - outl(0, ioaddr + CSR13); - outl(addr_low, ioaddr + CSR14); - outl(1, ioaddr + CSR13); - outl(addr_high, ioaddr + CSR14); - outl(2, ioaddr + CSR13); - outl(0, ioaddr + CSR14); - outl(3, ioaddr + CSR13); - outl(0, ioaddr + CSR14); - } else if (tp->chip_id == COMET) { - outl(addr_low, ioaddr + 0xA4); - outl(addr_high, ioaddr + 0xA8); - outl(0, ioaddr + 0xAC); - outl(0, ioaddr + 0xB0); - } - } else { - /* for other boards we send a setup packet to initialize - the filters */ - u32 tx_flags = 0x08000000 | 192; - - /* construct perfect filter frame with mac address as first match - and broadcast address for all others */ - for (i=0; i<192; i++) - txb[i] = 0xFF; - txb[0] = nic->node_addr[0]; - txb[1] = nic->node_addr[1]; - txb[4] = nic->node_addr[2]; - txb[5] = nic->node_addr[3]; - txb[8] = nic->node_addr[4]; - txb[9] = nic->node_addr[5]; - - tx_ring[0].length = cpu_to_le32(tx_flags); - tx_ring[0].buffer1 = virt_to_le32desc(&txb[0]); - tx_ring[0].status = cpu_to_le32(0x80000000); - } - - /* Point to rx and tx descriptors */ - outl(virt_to_le32desc(&rx_ring[0]), ioaddr + CSR3); - outl(virt_to_le32desc(&tx_ring[0]), ioaddr + CSR4); - - init_media(nic); - - /* set the chip's operating mode (but don't turn on xmit and recv yet) */ - outl((tp->csr6 & ~0x00002002), ioaddr + CSR6); - - /* send setup packet for cards that support it */ - if (!(tp->flags & MC_HASH_ONLY)) { - /* enable transmit wait for completion */ - outl(tp->csr6 | 0x00002000, ioaddr + CSR6); - /* immediate transmit demand */ - outl(0, ioaddr + CSR1); - - to = currticks() + TX_TIME_OUT; - while ((tx_ring[0].status & 0x80000000) && (currticks() < to)) - /* wait */ ; - - if (currticks() >= to) { - printf ("%s: TX Setup Timeout.\n", tp->nic_name); - } - } - - if (tp->chip_id == LC82C168) - tulip_check_duplex(nic); - - set_rx_mode(nic); - - /* enable transmit and receive */ - outl(tp->csr6 | 0x00002002, ioaddr + CSR6); -} - -/*********************************************************************/ -/* eth_transmit - Transmit a frame */ -/*********************************************************************/ -static void tulip_transmit(struct nic *nic, const char *d, unsigned int t, - unsigned int s, const char *p) -{ - u16 nstype; - u32 to; - u32 csr6 = inl(ioaddr + CSR6); - -#ifdef TULIP_DEBUG_WHERE - whereami("tulip_transmit\n"); -#endif - - /* Disable Tx */ - outl(csr6 & ~0x00002000, ioaddr + CSR6); - - memcpy(txb, d, ETH_ALEN); - memcpy(txb + ETH_ALEN, nic->node_addr, ETH_ALEN); - nstype = htons((u16) t); - memcpy(txb + 2 * ETH_ALEN, (u8 *)&nstype, 2); - memcpy(txb + ETH_HLEN, p, s); - - s += ETH_HLEN; - s &= 0x0FFF; - - /* pad to minimum packet size */ - while (s < ETH_ZLEN) - txb[s++] = '\0'; - -#ifdef TULIP_DEBUG - if (tulip_debug > 1) - printf("%s: sending %d bytes ethtype %hX\n", tp->nic_name, s, t); -#endif - - /* setup the transmit descriptor */ - /* 0x60000000 = no interrupt on completion */ - tx_ring[0].length = cpu_to_le32(0x60000000 | s); - tx_ring[0].status = cpu_to_le32(0x80000000); - - /* Point to transmit descriptor */ - outl(virt_to_le32desc(&tx_ring[0]), ioaddr + CSR4); - - /* Enable Tx */ - outl(csr6 | 0x00002000, ioaddr + CSR6); - /* immediate transmit demand */ - outl(0, ioaddr + CSR1); - - to = currticks() + TX_TIME_OUT; - while ((tx_ring[0].status & 0x80000000) && (currticks() < to)) - /* wait */ ; - - if (currticks() >= to) { - printf ("TX Timeout!\n"); - } - - /* Disable Tx */ - outl(csr6 & ~0x00002000, ioaddr + CSR6); -} - -/*********************************************************************/ -/* eth_poll - Wait for a frame */ -/*********************************************************************/ -static int tulip_poll(struct nic *nic, int retrieve) -{ - -#ifdef TULIP_DEBUG_WHERE - whereami("tulip_poll\n"); -#endif - - /* no packet waiting. packet still owned by NIC */ - if (rx_ring[tp->cur_rx].status & 0x80000000) - return 0; - - if ( ! retrieve ) return 1; - -#ifdef TULIP_DEBUG_WHERE - whereami("tulip_poll got one\n"); -#endif - - nic->packetlen = (rx_ring[tp->cur_rx].status & 0x3FFF0000) >> 16; - - /* if we get a corrupted packet. throw it away and move on */ - if (rx_ring[tp->cur_rx].status & 0x00008000) { - /* return the descriptor and buffer to receive ring */ - rx_ring[tp->cur_rx].status = 0x80000000; - tp->cur_rx = (++tp->cur_rx) % RX_RING_SIZE; - return 0; - } - - /* copy packet to working buffer */ - memcpy(nic->packet, rxb + tp->cur_rx * BUFLEN, nic->packetlen); - - /* return the descriptor and buffer to receive ring */ - rx_ring[tp->cur_rx].status = 0x80000000; - tp->cur_rx = (++tp->cur_rx) % RX_RING_SIZE; - - return 1; -} - -/*********************************************************************/ -/* eth_disable - Disable the interface */ -/*********************************************************************/ -static void tulip_disable(struct dev *dev) -{ - struct nic *nic = (struct nic *)dev; -#ifdef TULIP_DEBUG_WHERE - whereami("tulip_disable\n"); -#endif - - /* merge reset and disable */ - tulip_reset(nic); - - /* disable interrupts */ - outl(0x00000000, ioaddr + CSR7); - - /* Stop the chip's Tx and Rx processes. */ - outl(inl(ioaddr + CSR6) & ~0x00002002, ioaddr + CSR6); - - /* Clear the missed-packet counter. */ - (volatile unsigned long)inl(ioaddr + CSR8); -} - -/*********************************************************************/ -/*IRQ - Enable, Disable, or Force interrupts */ -/*********************************************************************/ -static void tulip_irq(struct nic *nic __unused, irq_action_t action __unused) -{ - switch ( action ) { - case DISABLE : - break; - case ENABLE : - break; - case FORCE : - break; - } -} - -/*********************************************************************/ -/* eth_probe - Look for an adapter */ -/*********************************************************************/ -static int tulip_probe(struct dev *dev, struct pci_device *pci) -{ - struct nic *nic = (struct nic *)dev; - u32 i; - u8 chip_rev; - u8 ee_data[EEPROM_SIZE]; - unsigned short sum; - int chip_idx; - static unsigned char last_phys_addr[ETH_ALEN] = {0x00, 'L', 'i', 'n', 'u', 'x'}; - - if (pci->ioaddr == 0) - return 0; - - ioaddr = pci->ioaddr; - nic->ioaddr = pci->ioaddr & ~3; - nic->irqno = 0; - - /* point to private storage */ - tp = &tpx; - - tp->vendor_id = pci->vendor; - tp->dev_id = pci->dev_id; - tp->nic_name = pci->name; - - tp->if_port = 0; - tp->default_port = 0; - - adjust_pci_device(pci); - - /* disable interrupts */ - outl(0x00000000, ioaddr + CSR7); - - /* Stop the chip's Tx and Rx processes. */ - outl(inl(ioaddr + CSR6) & ~0x00002002, ioaddr + CSR6); - - /* Clear the missed-packet counter. */ - (volatile unsigned long)inl(ioaddr + CSR8); - - printf("\n"); /* so we start on a fresh line */ -#ifdef TULIP_DEBUG_WHERE - whereami("tulip_probe\n"); -#endif - -#ifdef TULIP_DEBUG - if (tulip_debug > 1) - printf ("%s: Looking for Tulip Chip: Vendor=%hX Device=%hX\n", tp->nic_name, - tp->vendor_id, tp->dev_id); -#endif - - /* Figure out which chip we're dealing with */ - i = 0; - chip_idx = -1; - - while (pci_id_tbl[i].name) { - if ( (((u32) tp->dev_id << 16) | tp->vendor_id) == - (pci_id_tbl[i].id.pci & pci_id_tbl[i].id.pci_mask) ) { - chip_idx = pci_id_tbl[i].drv_flags; - break; - } - i++; - } - - if (chip_idx == -1) { - printf ("%s: Unknown Tulip Chip: Vendor=%hX Device=%hX\n", tp->nic_name, - tp->vendor_id, tp->dev_id); - return 0; - } - - tp->pci_id_idx = i; - tp->flags = tulip_tbl[chip_idx].flags; - -#ifdef TULIP_DEBUG - if (tulip_debug > 1) { - printf ("%s: tp->pci_id_idx == %d, name == %s\n", tp->nic_name, - tp->pci_id_idx, pci_id_tbl[tp->pci_id_idx].name); - printf ("%s: chip_idx == %d, name == %s\n", tp->nic_name, chip_idx, - tulip_tbl[chip_idx].chip_name); - } -#endif - - /* Bring the 21041/21143 out of sleep mode. - Caution: Snooze mode does not work with some boards! */ - if (tp->flags & HAS_PWRDWN) - pcibios_write_config_dword(pci->bus, pci->devfn, 0x40, 0x00000000); - - if (inl(ioaddr + CSR5) == 0xFFFFFFFF) { - printf("%s: The Tulip chip at %X is not functioning.\n", - tp->nic_name, ioaddr); - return 0; - } - - pcibios_read_config_byte(pci->bus, pci->devfn, PCI_REVISION, &chip_rev); - - printf("%s: [chip: %s] rev %d at %hX\n", tp->nic_name, - tulip_tbl[chip_idx].chip_name, chip_rev, ioaddr); - printf("%s: Vendor=%hX Device=%hX", tp->nic_name, tp->vendor_id, tp->dev_id); - - if (chip_idx == DC21041 && inl(ioaddr + CSR9) & 0x8000) { - printf(" 21040 compatible mode."); - chip_idx = DC21040; - } - - printf("\n"); - - /* The SROM/EEPROM interface varies dramatically. */ - sum = 0; - if (chip_idx == DC21040) { - outl(0, ioaddr + CSR9); /* Reset the pointer with a dummy write. */ - for (i = 0; i < ETH_ALEN; i++) { - int value, boguscnt = 100000; - do - value = inl(ioaddr + CSR9); - while (value < 0 && --boguscnt > 0); - nic->node_addr[i] = value; - sum += value & 0xff; - } - } else if (chip_idx == LC82C168) { - for (i = 0; i < 3; i++) { - int value, boguscnt = 100000; - outl(0x600 | i, ioaddr + 0x98); - do - value = inl(ioaddr + CSR9); - while (value < 0 && --boguscnt > 0); - put_unaligned(le16_to_cpu(value), ((u16*)nic->node_addr) + i); - sum += value & 0xffff; - } - } else if (chip_idx == COMET) { - /* No need to read the EEPROM. */ - put_unaligned(inl(ioaddr + 0xA4), (u32 *)nic->node_addr); - put_unaligned(inl(ioaddr + 0xA8), (u16 *)(nic->node_addr + 4)); - for (i = 0; i < ETH_ALEN; i ++) - sum += nic->node_addr[i]; - } else { - /* A serial EEPROM interface, we read now and sort it out later. */ - int sa_offset = 0; - int ee_addr_size = read_eeprom(ioaddr, 0xff, 8) & 0x40000 ? 8 : 6; - - for (i = 0; i < sizeof(ee_data)/2; i++) - ((u16 *)ee_data)[i] = - le16_to_cpu(read_eeprom(ioaddr, i, ee_addr_size)); - - /* DEC now has a specification (see Notes) but early board makers - just put the address in the first EEPROM locations. */ - /* This does memcmp(eedata, eedata+16, 8) */ - for (i = 0; i < 8; i ++) - if (ee_data[i] != ee_data[16+i]) - sa_offset = 20; - if (ee_data[0] == 0xff && ee_data[1] == 0xff && ee_data[2] == 0) { - sa_offset = 2; /* Grrr, damn Matrox boards. */ - } - for (i = 0; i < ETH_ALEN; i ++) { - nic->node_addr[i] = ee_data[i + sa_offset]; - sum += ee_data[i + sa_offset]; - } - } - /* Lite-On boards have the address byte-swapped. */ - if ((nic->node_addr[0] == 0xA0 || nic->node_addr[0] == 0xC0) - && nic->node_addr[1] == 0x00) - for (i = 0; i < ETH_ALEN; i+=2) { - char tmp = nic->node_addr[i]; - nic->node_addr[i] = nic->node_addr[i+1]; - nic->node_addr[i+1] = tmp; - } - - if (sum == 0 || sum == ETH_ALEN*0xff) { - printf("%s: EEPROM not present!\n", tp->nic_name); - for (i = 0; i < ETH_ALEN-1; i++) - nic->node_addr[i] = last_phys_addr[i]; - nic->node_addr[i] = last_phys_addr[i] + 1; - } - - for (i = 0; i < ETH_ALEN; i++) - last_phys_addr[i] = nic->node_addr[i]; - - printf("%s: %! at ioaddr %hX\n", tp->nic_name, nic->node_addr, ioaddr); - - tp->chip_id = chip_idx; - tp->revision = chip_rev; - tp->csr0 = csr0; - - /* BugFixes: The 21143-TD hangs with PCI Write-and-Invalidate cycles. - And the ASIX must have a burst limit or horrible things happen. */ - if (chip_idx == DC21143 && chip_rev == 65) - tp->csr0 &= ~0x01000000; - else if (tp->flags & IS_ASIX) - tp->csr0 |= 0x2000; - - if (media_cap[tp->default_port] & MediaIsMII) { - u16 media2advert[] = { 0x20, 0x40, 0x03e0, 0x60, 0x80, 0x100, 0x200 }; - tp->mii_advertise = media2advert[tp->default_port - 9]; - tp->mii_advertise |= (tp->flags & HAS_8023X); /* Matching bits! */ - } - - /* This is logically part of the probe routine, but too complex - to write inline. */ - if (tp->flags & HAS_MEDIA_TABLE) { - memcpy(tp->eeprom, ee_data, sizeof(tp->eeprom)); - parse_eeprom(nic); - } - - start_link(nic); - - /* reset the device and make ready for tx and rx of packets */ - tulip_reset(nic); - - dev->disable = tulip_disable; - nic->poll = tulip_poll; - nic->transmit = tulip_transmit; - nic->irq = tulip_irq; - - /* give the board a chance to reset before returning */ - tulip_wait(4*TICKS_PER_SEC); - - return 1; -} - -static void start_link(struct nic *nic) -{ - int i; - -#ifdef TULIP_DEBUG_WHERE - whereami("start_link\n"); -#endif - - if ((tp->flags & ALWAYS_CHECK_MII) || - (tp->mtable && tp->mtable->has_mii) || - ( ! tp->mtable && (tp->flags & HAS_MII))) { - unsigned int phy, phy_idx; - if (tp->mtable && tp->mtable->has_mii) { - for (i = 0; i < tp->mtable->leafcount; i++) - if (tp->mtable->mleaf[i].media == 11) { - tp->cur_index = i; - tp->saved_if_port = tp->if_port; - select_media(nic, 2); - tp->if_port = tp->saved_if_port; - break; - } - } - - /* Find the connected MII xcvrs. */ - for (phy = 0, phy_idx = 0; phy < 32 && phy_idx < sizeof(tp->phys); - phy++) { - int mii_status = mdio_read(nic, phy, 1); - if ((mii_status & 0x8301) == 0x8001 || - ((mii_status & 0x8000) == 0 && (mii_status & 0x7800) != 0)) { - int mii_reg0 = mdio_read(nic, phy, 0); - int mii_advert = mdio_read(nic, phy, 4); - int to_advert; - - if (tp->mii_advertise) - to_advert = tp->mii_advertise; - else if (tp->advertising[phy_idx]) - to_advert = tp->advertising[phy_idx]; - else /* Leave unchanged. */ - tp->mii_advertise = to_advert = mii_advert; - - tp->phys[phy_idx++] = phy; - printf("%s: MII transceiver %d config %hX status %hX advertising %hX.\n", - tp->nic_name, phy, mii_reg0, mii_status, mii_advert); - /* Fixup for DLink with miswired PHY. */ - if (mii_advert != to_advert) { - printf("%s: Advertising %hX on PHY %d previously advertising %hX.\n", - tp->nic_name, to_advert, phy, mii_advert); - mdio_write(nic, phy, 4, to_advert); - } - /* Enable autonegotiation: some boards default to off. */ - mdio_write(nic, phy, 0, mii_reg0 | - (tp->full_duplex ? 0x1100 : 0x1000) | - (media_cap[tp->default_port]&MediaIs100 ? 0x2000:0)); - } - } - tp->mii_cnt = phy_idx; - if (tp->mtable && tp->mtable->has_mii && phy_idx == 0) { - printf("%s: ***WARNING***: No MII transceiver found!\n", - tp->nic_name); - tp->phys[0] = 1; - } - } - - /* Reset the xcvr interface and turn on heartbeat. */ - switch (tp->chip_id) { - case DC21040: - outl(0x00000000, ioaddr + CSR13); - outl(0x00000004, ioaddr + CSR13); - break; - case DC21041: - /* This is nway_start(). */ - if (tp->sym_advertise == 0) - tp->sym_advertise = 0x0061; - outl(0x00000000, ioaddr + CSR13); - outl(0xFFFFFFFF, ioaddr + CSR14); - outl(0x00000008, ioaddr + CSR15); /* Listen on AUI also. */ - outl(inl(ioaddr + CSR6) | 0x0200, ioaddr + CSR6); - outl(0x0000EF01, ioaddr + CSR13); - break; - case DC21140: default: - if (tp->mtable) - outl(tp->mtable->csr12dir | 0x100, ioaddr + CSR12); - break; - case DC21142: - case PNIC2: - if (tp->mii_cnt || media_cap[tp->if_port] & MediaIsMII) { - outl(0x82020000, ioaddr + CSR6); - outl(0x0000, ioaddr + CSR13); - outl(0x0000, ioaddr + CSR14); - outl(0x820E0000, ioaddr + CSR6); - } else - nway_start(nic); - break; - case LC82C168: - if ( ! tp->mii_cnt) { - tp->nway = 1; - tp->nwayset = 0; - outl(0x00420000, ioaddr + CSR6); - outl(0x30, ioaddr + CSR12); - outl(0x0001F078, ioaddr + 0xB8); - outl(0x0201F078, ioaddr + 0xB8); /* Turn on autonegotiation. */ - } - break; - case MX98713: case COMPEX9881: - outl(0x00000000, ioaddr + CSR6); - outl(0x000711C0, ioaddr + CSR14); /* Turn on NWay. */ - outl(0x00000001, ioaddr + CSR13); - break; - case MX98715: case MX98725: - outl(0x01a80000, ioaddr + CSR6); - outl(0xFFFFFFFF, ioaddr + CSR14); - outl(0x00001000, ioaddr + CSR12); - break; - case COMET: - /* No initialization necessary. */ - break; - } -} - -static void nway_start(struct nic *nic __unused) -{ - int csr14 = ((tp->sym_advertise & 0x0780) << 9) | - ((tp->sym_advertise&0x0020)<<1) | 0xffbf; - -#ifdef TULIP_DEBUG_WHERE - whereami("nway_start\n"); -#endif - - tp->if_port = 0; - tp->nway = tp->mediasense = 1; - tp->nwayset = tp->lpar = 0; - if (tp->chip_id == PNIC2) { - tp->csr6 = 0x01000000 | (tp->sym_advertise & 0x0040 ? 0x0200 : 0); - return; - } -#ifdef TULIP_DEBUG - if (tulip_debug > 1) - printf("%s: Restarting internal NWay autonegotiation, %X.\n", - tp->nic_name, csr14); -#endif - outl(0x0001, ioaddr + CSR13); - outl(csr14, ioaddr + CSR14); - tp->csr6 = 0x82420000 | (tp->sym_advertise & 0x0040 ? 0x0200 : 0); - outl(tp->csr6, ioaddr + CSR6); - if (tp->mtable && tp->mtable->csr15dir) { - outl(tp->mtable->csr15dir, ioaddr + CSR15); - outl(tp->mtable->csr15val, ioaddr + CSR15); - } else if (tp->chip_id != PNIC2) - outw(0x0008, ioaddr + CSR15); - if (tp->chip_id == DC21041) /* Trigger NWAY. */ - outl(0xEF01, ioaddr + CSR12); - else - outl(0x1301, ioaddr + CSR12); -} - -static void init_media(struct nic *nic) -{ - int i; - -#ifdef TULIP_DEBUG_WHERE - whereami("init_media\n"); -#endif - - tp->saved_if_port = tp->if_port; - if (tp->if_port == 0) - tp->if_port = tp->default_port; - - /* Allow selecting a default media. */ - i = 0; - if (tp->mtable == NULL) - goto media_picked; - if (tp->if_port) { - int looking_for = media_cap[tp->if_port] & MediaIsMII ? 11 : - (tp->if_port == 12 ? 0 : tp->if_port); - for (i = 0; i < tp->mtable->leafcount; i++) - if (tp->mtable->mleaf[i].media == looking_for) { - printf("%s: Using user-specified media %s.\n", - tp->nic_name, medianame[tp->if_port]); - goto media_picked; - } - } - if ((tp->mtable->defaultmedia & 0x0800) == 0) { - int looking_for = tp->mtable->defaultmedia & 15; - for (i = 0; i < tp->mtable->leafcount; i++) - if (tp->mtable->mleaf[i].media == looking_for) { - printf("%s: Using EEPROM-set media %s.\n", - tp->nic_name, medianame[looking_for]); - goto media_picked; - } - } - /* Start sensing first non-full-duplex media. */ - for (i = tp->mtable->leafcount - 1; - (media_cap[tp->mtable->mleaf[i].media] & MediaAlwaysFD) && i > 0; i--) - ; - media_picked: - - tp->csr6 = 0; - tp->cur_index = i; - tp->nwayset = 0; - - if (tp->if_port) { - if (tp->chip_id == DC21143 && media_cap[tp->if_port] & MediaIsMII) { - /* We must reset the media CSRs when we force-select MII mode. */ - outl(0x0000, ioaddr + CSR13); - outl(0x0000, ioaddr + CSR14); - outl(0x0008, ioaddr + CSR15); - } - select_media(nic, 1); - return; - } - switch(tp->chip_id) { - case DC21041: - /* tp->nway = 1;*/ - nway_start(nic); - break; - case DC21142: - if (tp->mii_cnt) { - select_media(nic, 1); -#ifdef TULIP_DEBUG - if (tulip_debug > 1) - printf("%s: Using MII transceiver %d, status %hX.\n", - tp->nic_name, tp->phys[0], mdio_read(nic, tp->phys[0], 1)); -#endif - outl(0x82020000, ioaddr + CSR6); - tp->csr6 = 0x820E0000; - tp->if_port = 11; - outl(0x0000, ioaddr + CSR13); - outl(0x0000, ioaddr + CSR14); - } else - nway_start(nic); - break; - case PNIC2: - nway_start(nic); - break; - case LC82C168: - if (tp->mii_cnt) { - tp->if_port = 11; - tp->csr6 = 0x814C0000 | (tp->full_duplex ? 0x0200 : 0); - outl(0x0001, ioaddr + CSR15); - } else if (inl(ioaddr + CSR5) & TPLnkPass) - pnic_do_nway(nic); - else { - /* Start with 10mbps to do autonegotiation. */ - outl(0x32, ioaddr + CSR12); - tp->csr6 = 0x00420000; - outl(0x0001B078, ioaddr + 0xB8); - outl(0x0201B078, ioaddr + 0xB8); - } - break; - case MX98713: case COMPEX9881: - tp->if_port = 0; - tp->csr6 = 0x01880000 | (tp->full_duplex ? 0x0200 : 0); - outl(0x0f370000 | inw(ioaddr + 0x80), ioaddr + 0x80); - break; - case MX98715: case MX98725: - /* Provided by BOLO, Macronix - 12/10/1998. */ - tp->if_port = 0; - tp->csr6 = 0x01a80200; - outl(0x0f370000 | inw(ioaddr + 0x80), ioaddr + 0x80); - outl(0x11000 | inw(ioaddr + 0xa0), ioaddr + 0xa0); - break; - case COMET: - tp->if_port = 0; - tp->csr6 = 0x00040000; - break; - case AX88140: case AX88141: - tp->csr6 = tp->mii_cnt ? 0x00040100 : 0x00000100; - break; - default: - select_media(nic, 1); - } -} - -static void pnic_do_nway(struct nic *nic __unused) -{ - u32 phy_reg = inl(ioaddr + 0xB8); - u32 new_csr6 = tp->csr6 & ~0x40C40200; - -#ifdef TULIP_DEBUG_WHERE - whereami("pnic_do_nway\n"); -#endif - - if (phy_reg & 0x78000000) { /* Ignore baseT4 */ - if (phy_reg & 0x20000000) tp->if_port = 5; - else if (phy_reg & 0x40000000) tp->if_port = 3; - else if (phy_reg & 0x10000000) tp->if_port = 4; - else if (phy_reg & 0x08000000) tp->if_port = 0; - tp->nwayset = 1; - new_csr6 = (tp->if_port & 1) ? 0x01860000 : 0x00420000; - outl(0x32 | (tp->if_port & 1), ioaddr + CSR12); - if (tp->if_port & 1) - outl(0x1F868, ioaddr + 0xB8); - if (phy_reg & 0x30000000) { - tp->full_duplex = 1; - new_csr6 |= 0x00000200; - } -#ifdef TULIP_DEBUG - if (tulip_debug > 1) - printf("%s: PNIC autonegotiated status %X, %s.\n", - tp->nic_name, phy_reg, medianame[tp->if_port]); -#endif - if (tp->csr6 != new_csr6) { - tp->csr6 = new_csr6; - outl(tp->csr6 | 0x0002, ioaddr + CSR6); /* Restart Tx */ - outl(tp->csr6 | 0x2002, ioaddr + CSR6); - } - } -} - -/* Set up the transceiver control registers for the selected media type. */ -static void select_media(struct nic *nic, int startup) -{ - struct mediatable *mtable = tp->mtable; - u32 new_csr6; - int i; - -#ifdef TULIP_DEBUG_WHERE - whereami("select_media\n"); -#endif - - if (mtable) { - struct medialeaf *mleaf = &mtable->mleaf[tp->cur_index]; - unsigned char *p = mleaf->leafdata; - switch (mleaf->type) { - case 0: /* 21140 non-MII xcvr. */ -#ifdef TULIP_DEBUG - if (tulip_debug > 1) - printf("%s: Using a 21140 non-MII transceiver" - " with control setting %hhX.\n", - tp->nic_name, p[1]); -#endif - tp->if_port = p[0]; - if (startup) - outl(mtable->csr12dir | 0x100, ioaddr + CSR12); - outl(p[1], ioaddr + CSR12); - new_csr6 = 0x02000000 | ((p[2] & 0x71) << 18); - break; - case 2: case 4: { - u16 setup[5]; - u32 csr13val, csr14val, csr15dir, csr15val; - for (i = 0; i < 5; i++) - setup[i] = get_u16(&p[i*2 + 1]); - - tp->if_port = p[0] & 15; - if (media_cap[tp->if_port] & MediaAlwaysFD) - tp->full_duplex = 1; - - if (startup && mtable->has_reset) { - struct medialeaf *rleaf = &mtable->mleaf[mtable->has_reset]; - unsigned char *rst = rleaf->leafdata; -#ifdef TULIP_DEBUG - if (tulip_debug > 1) - printf("%s: Resetting the transceiver.\n", - tp->nic_name); -#endif - for (i = 0; i < rst[0]; i++) - outl(get_u16(rst + 1 + (i<<1)) << 16, ioaddr + CSR15); - } -#ifdef TULIP_DEBUG - if (tulip_debug > 1) - printf("%s: 21143 non-MII %s transceiver control " - "%hX/%hX.\n", - tp->nic_name, medianame[tp->if_port], setup[0], setup[1]); -#endif - if (p[0] & 0x40) { /* SIA (CSR13-15) setup values are provided. */ - csr13val = setup[0]; - csr14val = setup[1]; - csr15dir = (setup[3]<<16) | setup[2]; - csr15val = (setup[4]<<16) | setup[2]; - outl(0, ioaddr + CSR13); - outl(csr14val, ioaddr + CSR14); - outl(csr15dir, ioaddr + CSR15); /* Direction */ - outl(csr15val, ioaddr + CSR15); /* Data */ - outl(csr13val, ioaddr + CSR13); - } else { - csr13val = 1; - csr14val = 0x0003FF7F; - csr15dir = (setup[0]<<16) | 0x0008; - csr15val = (setup[1]<<16) | 0x0008; - if (tp->if_port <= 4) - csr14val = t21142_csr14[tp->if_port]; - if (startup) { - outl(0, ioaddr + CSR13); - outl(csr14val, ioaddr + CSR14); - } - outl(csr15dir, ioaddr + CSR15); /* Direction */ - outl(csr15val, ioaddr + CSR15); /* Data */ - if (startup) outl(csr13val, ioaddr + CSR13); - } -#ifdef TULIP_DEBUG - if (tulip_debug > 1) - printf("%s: Setting CSR15 to %X/%X.\n", - tp->nic_name, csr15dir, csr15val); -#endif - if (mleaf->type == 4) - new_csr6 = 0x82020000 | ((setup[2] & 0x71) << 18); - else - new_csr6 = 0x82420000; - break; - } - case 1: case 3: { - int phy_num = p[0]; - int init_length = p[1]; - u16 *misc_info; - - tp->if_port = 11; - new_csr6 = 0x020E0000; - if (mleaf->type == 3) { /* 21142 */ - u16 *init_sequence = (u16*)(p+2); - u16 *reset_sequence = &((u16*)(p+3))[init_length]; - int reset_length = p[2 + init_length*2]; - misc_info = reset_sequence + reset_length; - if (startup) - for (i = 0; i < reset_length; i++) - outl(get_u16(&reset_sequence[i]) << 16, ioaddr + CSR15); - for (i = 0; i < init_length; i++) - outl(get_u16(&init_sequence[i]) << 16, ioaddr + CSR15); - } else { - u8 *init_sequence = p + 2; - u8 *reset_sequence = p + 3 + init_length; - int reset_length = p[2 + init_length]; - misc_info = (u16*)(reset_sequence + reset_length); - if (startup) { - outl(mtable->csr12dir | 0x100, ioaddr + CSR12); - for (i = 0; i < reset_length; i++) - outl(reset_sequence[i], ioaddr + CSR12); - } - for (i = 0; i < init_length; i++) - outl(init_sequence[i], ioaddr + CSR12); - } - tp->advertising[phy_num] = get_u16(&misc_info[1]) | 1; - if (startup < 2) { - if (tp->mii_advertise == 0) - tp->mii_advertise = tp->advertising[phy_num]; -#ifdef TULIP_DEBUG - if (tulip_debug > 1) - printf("%s: Advertising %hX on MII %d.\n", - tp->nic_name, tp->mii_advertise, tp->phys[phy_num]); -#endif - mdio_write(nic, tp->phys[phy_num], 4, tp->mii_advertise); - } - break; - } - default: - printf("%s: Invalid media table selection %d.\n", - tp->nic_name, mleaf->type); - new_csr6 = 0x020E0000; - } -#ifdef TULIP_DEBUG - if (tulip_debug > 1) - printf("%s: Using media type %s, CSR12 is %hhX.\n", - tp->nic_name, medianame[tp->if_port], - inl(ioaddr + CSR12) & 0xff); -#endif - } else if (tp->chip_id == DC21041) { - int port = tp->if_port <= 4 ? tp->if_port : 0; -#ifdef TULIP_DEBUG - if (tulip_debug > 1) - printf("%s: 21041 using media %s, CSR12 is %hX.\n", - tp->nic_name, medianame[port == 3 ? 12: port], - inl(ioaddr + CSR12)); -#endif - outl(0x00000000, ioaddr + CSR13); /* Reset the serial interface */ - outl(t21041_csr14[port], ioaddr + CSR14); - outl(t21041_csr15[port], ioaddr + CSR15); - outl(t21041_csr13[port], ioaddr + CSR13); - new_csr6 = 0x80020000; - } else if (tp->chip_id == LC82C168) { - if (startup && ! tp->medialock) - tp->if_port = tp->mii_cnt ? 11 : 0; -#ifdef TULIP_DEBUG - if (tulip_debug > 1) - printf("%s: PNIC PHY status is %hX, media %s.\n", - tp->nic_name, inl(ioaddr + 0xB8), medianame[tp->if_port]); -#endif - if (tp->mii_cnt) { - new_csr6 = 0x810C0000; - outl(0x0001, ioaddr + CSR15); - outl(0x0201B07A, ioaddr + 0xB8); - } else if (startup) { - /* Start with 10mbps to do autonegotiation. */ - outl(0x32, ioaddr + CSR12); - new_csr6 = 0x00420000; - outl(0x0001B078, ioaddr + 0xB8); - outl(0x0201B078, ioaddr + 0xB8); - } else if (tp->if_port == 3 || tp->if_port == 5) { - outl(0x33, ioaddr + CSR12); - new_csr6 = 0x01860000; - /* Trigger autonegotiation. */ - outl(startup ? 0x0201F868 : 0x0001F868, ioaddr + 0xB8); - } else { - outl(0x32, ioaddr + CSR12); - new_csr6 = 0x00420000; - outl(0x1F078, ioaddr + 0xB8); - } - } else if (tp->chip_id == DC21040) { /* 21040 */ - /* Turn on the xcvr interface. */ -#ifdef TULIP_DEBUG - int csr12 = inl(ioaddr + CSR12); - if (tulip_debug > 1) - printf("%s: 21040 media type is %s, CSR12 is %hhX.\n", - tp->nic_name, medianame[tp->if_port], csr12); -#endif - if (media_cap[tp->if_port] & MediaAlwaysFD) - tp->full_duplex = 1; - new_csr6 = 0x20000; - /* Set the full duplux match frame. */ - outl(FULL_DUPLEX_MAGIC, ioaddr + CSR11); - outl(0x00000000, ioaddr + CSR13); /* Reset the serial interface */ - if (t21040_csr13[tp->if_port] & 8) { - outl(0x0705, ioaddr + CSR14); - outl(0x0006, ioaddr + CSR15); - } else { - outl(0xffff, ioaddr + CSR14); - outl(0x0000, ioaddr + CSR15); - } - outl(0x8f01 | t21040_csr13[tp->if_port], ioaddr + CSR13); - } else { /* Unknown chip type with no media table. */ - if (tp->default_port == 0) - tp->if_port = tp->mii_cnt ? 11 : 3; - if (media_cap[tp->if_port] & MediaIsMII) { - new_csr6 = 0x020E0000; - } else if (media_cap[tp->if_port] & MediaIsFx) { - new_csr6 = 0x028600000; - } else - new_csr6 = 0x038600000; -#ifdef TULIP_DEBUG - if (tulip_debug > 1) - printf("%s: No media description table, assuming " - "%s transceiver, CSR12 %hhX.\n", - tp->nic_name, medianame[tp->if_port], - inl(ioaddr + CSR12)); -#endif - } - - tp->csr6 = new_csr6 | (tp->csr6 & 0xfdff) | (tp->full_duplex ? 0x0200 : 0); - return; -} - -/* - Check the MII negotiated duplex and change the CSR6 setting if - required. - Return 0 if everything is OK. - Return < 0 if the transceiver is missing or has no link beat. -*/ -static int tulip_check_duplex(struct nic *nic) -{ - unsigned int bmsr, lpa, negotiated, new_csr6; - - bmsr = mdio_read(nic, tp->phys[0], 1); - lpa = mdio_read(nic, tp->phys[0], 5); - -#ifdef TULIP_DEBUG - if (tulip_debug > 1) - printf("%s: MII status %#x, Link partner report " - "%#x.\n", tp->nic_name, bmsr, lpa); -#endif - - if (bmsr == 0xffff) - return -2; - if ((bmsr & 4) == 0) { - int new_bmsr = mdio_read(nic, tp->phys[0], 1); - if ((new_bmsr & 4) == 0) { -#ifdef TULIP_DEBUG - if (tulip_debug > 1) - printf("%s: No link beat on the MII interface," - " status %#x.\n", tp->nic_name, - new_bmsr); -#endif - return -1; - } - } - tp->full_duplex = lpa & 0x140; - - new_csr6 = tp->csr6; - negotiated = lpa & tp->advertising[0]; - - if(negotiated & 0x380) new_csr6 &= ~0x400000; - else new_csr6 |= 0x400000; - if (tp->full_duplex) new_csr6 |= 0x200; - else new_csr6 &= ~0x200; - - if (new_csr6 != tp->csr6) { - tp->csr6 = new_csr6; - -#ifdef TULIP_DEBUG - if (tulip_debug > 0) - printf("%s: Setting %s-duplex based on MII" - "#%d link partner capability of %#x.\n", - tp->nic_name, - tp->full_duplex ? "full" : "half", - tp->phys[0], lpa); -#endif - return 1; - } - - return 0; -} - -static struct pci_id tulip_nics[] = { -PCI_ROM(0x1011, 0x0002, "dc21040", "Digital Tulip"), -PCI_ROM(0x1011, 0x0009, "ds21140", "Digital Tulip Fast"), -PCI_ROM(0x1011, 0x0014, "dc21041", "Digital Tulip+"), -PCI_ROM(0x1011, 0x0019, "ds21142", "Digital Tulip 21142"), -PCI_ROM(0x10b7, 0x9300, "3csoho100b-tx","3ComSOHO100B-TX"), -PCI_ROM(0x10b9, 0x5261, "ali1563", "ALi 1563 integrated ethernet"), -PCI_ROM(0x10d9, 0x0512, "mx98713", "Macronix MX987x3"), -PCI_ROM(0x10d9, 0x0531, "mx98715", "Macronix MX987x5"), -PCI_ROM(0x1113, 0x1217, "mxic-98715", "Macronix MX987x5"), -PCI_ROM(0x11ad, 0xc115, "lc82c115", "LinkSys LNE100TX"), -PCI_ROM(0x11ad, 0x0002, "82c168", "Netgear FA310TX"), -PCI_ROM(0x1282, 0x9100, "dm9100", "Davicom 9100"), -PCI_ROM(0x1282, 0x9102, "dm9102", "Davicom 9102"), -PCI_ROM(0x1282, 0x9009, "dm9009", "Davicom 9009"), -PCI_ROM(0x1282, 0x9132, "dm9132", "Davicom 9132"), -PCI_ROM(0x1317, 0x0985, "centaur-p", "ADMtek Centaur-P"), -PCI_ROM(0x1317, 0x0981, "an981", "ADMtek AN981 Comet"), /* ADMTek Centaur-P (stmicro) */ -PCI_ROM(0x1113, 0x1216, "an983", "ADMTek AN983 Comet"), -PCI_ROM(0x1317, 0x9511, "an983b", "ADMTek Comet 983b"), -PCI_ROM(0x1317, 0x1985, "centaur-c", "ADMTek Centaur-C"), -PCI_ROM(0x8086, 0x0039, "intel21145", "Intel Tulip"), -PCI_ROM(0x125b, 0x1400, "ax88140", "ASIX AX88140"), -PCI_ROM(0x11f6, 0x9881, "rl100tx", "Compex RL100-TX"), -PCI_ROM(0x115d, 0x0003, "xircomtulip", "Xircom Tulip"), -PCI_ROM(0x104a, 0x0981, "tulip-0981", "Tulip 0x104a 0x0981"), -PCI_ROM(0x104a, 0x2774, "tulip-2774", "Tulip 0x104a 0x2774"), -PCI_ROM(0x1113, 0x9511, "tulip-9511", "Tulip 0x1113 0x9511"), -PCI_ROM(0x1186, 0x1561, "tulip-1561", "Tulip 0x1186 0x1561"), -PCI_ROM(0x1259, 0xa120, "tulip-a120", "Tulip 0x1259 0xa120"), -PCI_ROM(0x13d1, 0xab02, "tulip-ab02", "Tulip 0x13d1 0xab02"), -PCI_ROM(0x13d1, 0xab03, "tulip-ab03", "Tulip 0x13d1 0xab03"), -PCI_ROM(0x13d1, 0xab08, "tulip-ab08", "Tulip 0x13d1 0xab08"), -PCI_ROM(0x14f1, 0x1803, "lanfinity", "Conexant LANfinity"), -PCI_ROM(0x1626, 0x8410, "tulip-8410", "Tulip 0x1626 0x8410"), -PCI_ROM(0x1737, 0xab08, "tulip-1737-ab08","Tulip 0x1737 0xab08"), -PCI_ROM(0x1737, 0xab09, "tulip-ab09", "Tulip 0x1737 0xab09"), -}; - -struct pci_driver tulip_driver = { - .type = NIC_DRIVER, - .name = "Tulip", - .probe = tulip_probe, - .ids = tulip_nics, - .id_count = sizeof(tulip_nics)/sizeof(tulip_nics[0]), - .class = 0, -}; diff --git a/usr/src/grub/grub-0.95/netboot/types.h b/usr/src/grub/grub-0.95/netboot/types.h deleted file mode 100644 index 54fe5aafea..0000000000 --- a/usr/src/grub/grub-0.95/netboot/types.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef _TYPES_H -#define _TYPES_H - -/* I'm architecture independed :-) */ - -/* - * It's architecture depended headers for common integer types - */ -#include "stdint.h" - -/* - * Here are some RPC types define from linux /usr/include/rpc/types.h - */ -typedef int bool_t; -typedef int enum_t; -typedef uint32_t rpcprog_t; -typedef uint32_t rpcvers_t; -typedef uint32_t rpcproc_t; -typedef uint32_t rpcprot_t; -typedef uint32_t rpcport_t; - -/* For bool_t */ -/* typedef enum { */ -/* FALSE = 0, */ -/* TRUE = 1 */ -/* } boolean_t; */ - - - -/* Some BSD or RPC style types */ -typedef unsigned char u_char; -typedef unsigned short u_short; -typedef unsigned int u_int; -typedef unsigned long u_long; -typedef long long quad_t; -typedef unsigned long long u_quad_t; -typedef struct { - int __val[2]; -}fsid_t; /* Type of file system IDs, from bits/types.h */ - -typedef int daddr_t; /* The type of a disk address, from bits/types.h */ -typedef char * caddr_t; - -#endif /* _TYPES_H */ diff --git a/usr/src/grub/grub-0.95/netboot/udp.h b/usr/src/grub/grub-0.95/netboot/udp.h deleted file mode 100644 index 9d4f6123ea..0000000000 --- a/usr/src/grub/grub-0.95/netboot/udp.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef _UDP_H -#define _UDP_H - -/* We need 'uint16_t' and 'uint8_t' */ -#include "types.h" -/* We need 'in_addr' */ -#include "in.h" - -struct udp_pseudo_hdr { - in_addr src; - in_addr dest; - uint8_t unused; - uint8_t protocol; - uint16_t len; -}; -struct udphdr { - uint16_t src; - uint16_t dest; - uint16_t len; - uint16_t chksum; -}; - -extern void build_udp_hdr(unsigned long __destip, unsigned int __srcsock, - unsigned int __destsock, int __ttl, int __len, - const void * __buf); - -extern int udp_transmit(unsigned long __destip, unsigned int __srcsock, - unsigned int __destsock, int __len, const void * __buf); - -#endif /* _UDP_H */ diff --git a/usr/src/grub/grub-0.95/netboot/undi.c b/usr/src/grub/grub-0.95/netboot/undi.c deleted file mode 100644 index 54e5061793..0000000000 --- a/usr/src/grub/grub-0.95/netboot/undi.c +++ /dev/null @@ -1,1321 +0,0 @@ -/************************************************************************** -Etherboot - BOOTP/TFTP Bootstrap Program -UNDI NIC driver for Etherboot - -This file Copyright (C) 2003 Michael Brown -of Fen Systems Ltd. (http://www.fensystems.co.uk/). All rights -reserved. - -$Id: undi.c,v 1.8 2003/10/25 13:54:53 mcb30 Exp $ -***************************************************************************/ - -/* - * 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. - */ - -/* to get some global routines like printf */ -#include "etherboot.h" -/* to get the interface to the body of the program */ -#include "nic.h" -/* to get the PCI support functions, if this is a PCI NIC */ -#include "pci.h" -/* UNDI and PXE defines. Includes pxe.h. */ -#include "undi.h" -/* 8259 PIC defines */ -#include "pic8259.h" -#include "bootp.h" -#include "tftp.h" -#include "shared.h" - -/* NIC specific static variables go here */ -static undi_t undi = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, 0, NULL, 0, NULL, - 0, 0, 0, 0, - { 0, 0, 0, NULL, 0, 0, 0, 0, 0, 0, 0, NULL }, - IRQ_NONE }; -static undi_base_mem_data_t undi_base_mem_data; - -#define UNDI_HEAP (void *)(512 << 10) - -/* Function prototypes */ -int allocate_base_mem_data ( void ); -int free_base_mem_data ( void ); -int eb_pxenv_undi_shutdown ( void ); -int eb_pxenv_stop_undi ( void ); -int undi_unload_base_code ( void ); -int undi_full_shutdown ( void ); -int eb_pxenv_get_cached_info (uint8_t, void **info); - -/************************************************************************** - * Utility functions - **************************************************************************/ - -/* Checksum a block. - */ - -uint8_t checksum ( void *block, size_t size ) { - uint8_t sum = 0; - uint16_t i = 0; - for ( i = 0; i < size; i++ ) { - sum += ( ( uint8_t * ) block )[i]; - } - return sum; -} - -/* Print the status of a !PXE structure - */ - -void pxe_dump ( void ) { -#ifdef TRACE_UNDI - printf ( "API %hx:%hx St %hx:%hx UD %hx:%hx UC %hx:%hx " - "BD %hx:%hx BC %hx:%hx\n", - undi.pxe->EntryPointSP.segment, undi.pxe->EntryPointSP.offset, - undi.pxe->Stack.Seg_Addr, undi.pxe->Stack.Seg_Size, - undi.pxe->UNDIData.Seg_Addr, undi.pxe->UNDIData.Seg_Size, - undi.pxe->UNDICode.Seg_Addr, undi.pxe->UNDICode.Seg_Size, - undi.pxe->BC_Data.Seg_Addr, undi.pxe->BC_Data.Seg_Size, - undi.pxe->BC_Code.Seg_Addr, undi.pxe->BC_Code.Seg_Size ); -#endif -} - -/* Allocate/free space for structures that must reside in base memory - */ - -int allocate_base_mem_data ( void ) { - /* In GRUB, anything is in base address, so we do not need - * allocate anything */ - undi.base_mem_data = &undi_base_mem_data; - memset ( undi.base_mem_data, 0, sizeof(undi_base_mem_data_t) ); - undi.undi_call_info = &undi.base_mem_data->undi_call_info; - undi.pxs = &undi.base_mem_data->pxs; - undi.xmit_data = &undi.base_mem_data->xmit_data; - undi.xmit_buffer = undi.base_mem_data->xmit_buffer; -#if 0 /* Etherboot Code */ - /* Allocate space in base memory. - * Initialise pointers to base memory structures. - */ - if ( undi.base_mem_data == NULL ) { - undi.base_mem_data = - allot_base_memory ( sizeof(undi_base_mem_data_t) + - TRIVIAL_IRQ_HANDLER_SIZE ); - if ( undi.base_mem_data == NULL ) { - printf ( "Failed to allocate base memory\n" ); - free_base_mem_data(); - return 0; - } - memset ( undi.base_mem_data, 0, sizeof(undi_base_mem_data_t) ); - undi.undi_call_info = &undi.base_mem_data->undi_call_info; - undi.pxs = &undi.base_mem_data->pxs; - undi.xmit_data = &undi.base_mem_data->xmit_data; - undi.xmit_buffer = undi.base_mem_data->xmit_buffer; - copy_trivial_irq_handler ( undi.base_mem_data->irq_handler, - TRIVIAL_IRQ_HANDLER_SIZE ); - } -#endif /* Etherboot Code */ - return 1; -} - -int free_base_mem_data ( void ) { - /* Just pretend to free something :-) */ - undi.base_mem_data = NULL; - undi.undi_call_info = NULL; - undi.pxs = NULL; - undi.xmit_data = NULL; - undi.xmit_buffer = NULL; -#if 0 /* Etherboot Code */ - if ( undi.base_mem_data != NULL ) { - forget_base_memory ( undi.base_mem_data, - sizeof(undi_base_mem_data_t) + - TRIVIAL_IRQ_HANDLER_SIZE ); - undi.base_mem_data = NULL; - undi.undi_call_info = NULL; - undi.pxs = NULL; - undi.xmit_data = NULL; - undi.xmit_buffer = NULL; - copy_trivial_irq_handler ( NULL, 0 ); - } -#endif /* Etherboot Code */ - return 1; -} - -void assemble_firing_squad ( firing_squad_lineup_t *lineup, - void *start, size_t size, - firing_squad_shoot_t shoot ) { - int target; - int index; - int bit; - int start_kb = virt_to_phys(start) >> 10; - int end_kb = ( virt_to_phys(start+size) + (1<<10) - 1 ) >> 10; - - for ( target = start_kb; target <= end_kb; target++ ) { - index = FIRING_SQUAD_TARGET_INDEX ( target ); - bit = FIRING_SQUAD_TARGET_BIT ( target ); - lineup->targets[index] = ( shoot << bit ) | - ( lineup->targets[index] & ~( 1 << bit ) ); - } -} - -void shoot_targets ( firing_squad_lineup_t *lineup ) { - int shoot_this_target = 0; - int shoot_last_target = 0; - int start_target = 0; - int target; - - for ( target = 0; target <= 640; target++ ) { - shoot_this_target = ( target == 640 ? 0 : - ( 1 << FIRING_SQUAD_TARGET_BIT(target) ) & - lineup->targets[FIRING_SQUAD_TARGET_INDEX(target)] ); - if ( shoot_this_target && !shoot_last_target ) { - start_target = target; - } else if ( shoot_last_target && !shoot_this_target ) { - size_t range_size = ( target - start_target ) << 10; - forget_base_memory ( phys_to_virt( start_target<<10 ), - range_size ); - } - shoot_last_target = shoot_this_target; - } -} - -/* Debug macros - */ - -#ifdef TRACE_UNDI -#define DBG(...) printf ( __VA_ARGS__ ) -#else -#define DBG(...) -#endif - -#define UNDI_STATUS(pxs) ( (pxs)->Status == PXENV_EXIT_SUCCESS ? \ - "SUCCESS" : \ - ( (pxs)->Status == PXENV_EXIT_FAILURE ? \ - "FAILURE" : "UNKNOWN" ) ) - -/************************************************************************** - * Base memory scanning functions - **************************************************************************/ - -/* Locate the $PnP structure indicating a PnP BIOS. - */ - -int hunt_pnp_bios ( void ) { - uint32_t off = 0x10000; - - DBG ( "Hunting for PnP BIOS..." ); - while ( off > 0 ) { - off -= 16; - undi.pnp_bios = (pnp_bios_t *) phys_to_virt ( 0xf0000 + off ); - if ( undi.pnp_bios->signature == PNP_BIOS_SIGNATURE ) { - DBG ( "found $PnP at f000:%hx...", off ); - if ( checksum(undi.pnp_bios,sizeof(pnp_bios_t)) !=0) { - DBG ( "invalid checksum\n..." ); - continue; - } - DBG ( "ok\n" ); - return 1; - } - } - DBG ( "none found\n" ); - undi.pnp_bios = NULL; - return 0; -} - -/* Locate the !PXE structure indicating a loaded UNDI driver. - */ - -int hunt_pixie ( void ) { - static uint32_t ptr = 0; - pxe_t *pxe = NULL; - - DBG ( "Hunting for pixies..." ); - if ( ptr == 0 ) ptr = 0xa0000; - while ( ptr > 0x10000 ) { - ptr -= 16; - pxe = (pxe_t *) phys_to_virt ( ptr ); - if ( memcmp ( pxe->Signature, "!PXE", 4 ) == 0 ) { - DBG ( "found !PXE at %x...", ptr ); - if ( checksum ( pxe, sizeof(pxe_t) ) != 0 ) { - DBG ( "invalid checksum\n..." ); - continue; - } - if ( ptr < get_free_base_memory() ) { - DBG ( "in free base memory!\n\n" - "WARNING: a valid !PXE structure was " - "found in an area of memory marked " - "as free!\n\n" ); - undi.pxe = pxe; - pxe_dump(); - undi.pxe = NULL; - DBG ( "\nIgnoring and continuing, but this " - "may cause problems later!\n\n" ); - continue; - } - DBG ( "ok\n" ); - undi.pxe = pxe; - pxe_dump(); - DBG ( "Resetting pixie...\n" ); - undi_unload_base_code(); - eb_pxenv_stop_undi(); - pxe_dump(); - return 1; - } - } - DBG ( "none found\n" ); - ptr = 0; - return 0; -} - -/* Locate PCI PnP ROMs. - */ - -int hunt_rom ( void ) { - static uint32_t ptr = 0; - - DBG ( "Hunting for ROMs..." ); - if ( ptr == 0 ) ptr = 0x100000; - while ( ptr > 0x0c0000 ) { - ptr -= 0x800; - undi.rom = ( rom_t * ) phys_to_virt ( ptr ); - if ( undi.rom->signature == ROM_SIGNATURE ) { - pcir_header_t *pcir_header = NULL; - pnp_header_t *pnp_header = NULL; - - DBG ( "found 55AA at %x...", ptr ); - if ( undi.rom->pcir_off == 0 ) { - DBG ( "not a PCI ROM\n..." ); - continue; - } - pcir_header = (pcir_header_t*)( ( void * ) undi.rom + - undi.rom->pcir_off ); - if ( pcir_header->signature != PCIR_SIGNATURE ) { - DBG ( "invalid PCI signature\n..." ); - continue; - } - DBG ( "PCI:%hx:%hx...", pcir_header->vendor_id, - pcir_header->device_id ); - if ( ( pcir_header->vendor_id != undi.pci.vendor ) || - ( pcir_header->device_id != undi.pci.dev_id ) ) { - DBG ( "not me (%hx:%hx)\n...", - undi.pci.vendor, - undi.pci.dev_id ); - continue; - } - if ( undi.rom->pnp_off == 0 ) { - DBG ( "not a PnP ROM\n..." ); - continue; - } - pnp_header = (pnp_header_t*)( ( void * ) undi.rom + - undi.rom->pnp_off ); - if ( pnp_header->signature != PNP_SIGNATURE ) { - DBG ( "invalid $PnP signature\n..." ); - continue; - } - if ( checksum(pnp_header,sizeof(pnp_header_t)) != 0 ) { - DBG ( "invalid PnP checksum\n..." ); - continue; - } - DBG ( "ok\n"); - printf ("ROM %s by %s\n", - pnp_header->product_str_off==0 ? "(unknown)" : - (void*)undi.rom+pnp_header->product_str_off, - pnp_header->manuf_str_off==0 ? "(unknown)" : - (void*)undi.rom+pnp_header->manuf_str_off ); - return 1; - } - } - DBG ( "none found\n" ); - ptr = 0; - undi.rom = NULL; - return 0; -} - -/* Locate ROMs containing UNDI drivers. - */ - -int hunt_undi_rom ( void ) { - while ( hunt_rom() ) { - if ( undi.rom->undi_rom_id_off == 0 ) { - DBG ( "Not a PXE ROM\n" ); - continue; - } - undi.undi_rom_id = (undi_rom_id_t *) - ( (void *)undi.rom + undi.rom->undi_rom_id_off ); - if ( undi.undi_rom_id->signature != UNDI_SIGNATURE ) { - DBG ( "Invalid UNDI signature\n" ); - continue; - } - printf ( "Revision %d.%d.%d", - undi.undi_rom_id->undi_rev[2], - undi.undi_rom_id->undi_rev[1], - undi.undi_rom_id->undi_rev[0] ); - return 1; - } - return 0; -} - -/************************************************************************** - * Low-level UNDI API call wrappers - **************************************************************************/ - -/* Make a real-mode UNDI API call to the UNDI routine at - * routine_seg:routine_off, passing in three uint16 parameters on the - * real-mode stack. - * Calls the assembler wrapper routine __undi_call. - */ - -static inline PXENV_EXIT_t _undi_call ( uint16_t routine_seg, - uint16_t routine_off, uint16_t st0, - uint16_t st1, uint16_t st2 ) { - PXENV_EXIT_t ret = PXENV_EXIT_FAILURE; - - undi.undi_call_info->routine.segment = routine_seg; - undi.undi_call_info->routine.offset = routine_off; - undi.undi_call_info->stack[0] = st0; - undi.undi_call_info->stack[1] = st1; - undi.undi_call_info->stack[2] = st2; - ret = __undi_call ( SEGMENT( undi.undi_call_info ), - OFFSET( undi.undi_call_info ) ); - - /* UNDI API calls may rudely change the status of A20 and not - * bother to restore it afterwards. Intel is known to be - * guilty of this. - * - * Note that we will return to this point even if A20 gets - * screwed up by the UNDI driver, because Etherboot always - * resides in an even megabyte of RAM. - */ - gateA20_set(); - - return ret; -} - -/* Make a real-mode call to the UNDI loader routine at - * routine_seg:routine_off, passing in the seg:off address of a - * pxenv_structure on the real-mode stack. - */ - -int undi_call_loader ( void ) { - PXENV_EXIT_t pxenv_exit = PXENV_EXIT_FAILURE; - - pxenv_exit = _undi_call ( SEGMENT( undi.rom ), - undi.undi_rom_id->undi_loader_off, - OFFSET( undi.pxs ), - SEGMENT( undi.pxs ), - 0 /* Unused for UNDI loader API */ ); - /* Return 1 for success, to be consistent with other routines */ - if ( pxenv_exit == PXENV_EXIT_SUCCESS ) return 1; - DBG ( "UNDI loader call failed with status %#hx\n", - undi.pxs->Status ); - return 0; -} - -/* Make a real-mode UNDI API call, passing in the opcode and the - * seg:off address of a pxenv_structure on the real-mode stack. - * - * Two versions: undi_call() will automatically report any failure - * codes, undi_call_silent() will not. - */ - -int undi_call_silent ( uint16_t opcode ) { - PXENV_EXIT_t pxenv_exit = PXENV_EXIT_FAILURE; - - pxenv_exit = _undi_call ( undi.pxe->EntryPointSP.segment, - undi.pxe->EntryPointSP.offset, - opcode, - OFFSET( undi.pxs ), - SEGMENT( undi.pxs ) ); - /* Return 1 for success, to be consistent with other routines */ - return pxenv_exit == PXENV_EXIT_SUCCESS ? 1 : 0; -} - -int undi_call ( uint16_t opcode ) { - if ( undi_call_silent ( opcode ) ) return 1; - DBG ( "UNDI API call %#hx failed with status %#hx\n", - opcode, undi.pxs->Status ); - return 0; -} - -/************************************************************************** - * High-level UNDI API call wrappers - **************************************************************************/ - -/* Install the UNDI driver from a located UNDI ROM. - */ - -int undi_loader ( void ) { - pxe_t *pxe = NULL; - - /* AX contains PCI bus:devfn (PCI specification) */ - undi.pxs->loader.ax = ( undi.pci.bus << 8 ) | undi.pci.devfn; - /* BX and DX set to 0xffff for non-ISAPnP devices - * (BIOS boot specification) - */ - undi.pxs->loader.bx = 0xffff; - undi.pxs->loader.dx = 0xffff; - /* ES:DI points to PnP BIOS' $PnP structure - * (BIOS boot specification) - */ - undi.pxs->loader.es = 0xf000; - undi.pxs->loader.di = virt_to_phys ( undi.pnp_bios ) - 0xf0000; - - /* Allocate space for UNDI driver's code and data segments */ - undi.driver_code_size = undi.undi_rom_id->code_size; - undi.driver_code = UNDI_HEAP; - if ( undi.driver_code == NULL ) { - printf ( "Could not allocate %d bytes for UNDI code segment\n", - undi.driver_code_size ); - return 0; - } - undi.pxs->loader.undi_cs = SEGMENT( undi.driver_code ); - - undi.driver_data_size = undi.undi_rom_id->data_size; - undi.driver_data = (void *)((((unsigned long)UNDI_HEAP + undi.undi_rom_id->code_size) | (1024 -1)) + 1); - if ( undi.driver_data == NULL ) { - printf ( "Could not allocate %d bytes for UNDI code segment\n", - undi.driver_data_size ); - return 0; - } - undi.pxs->loader.undi_ds = SEGMENT( undi.driver_data ); - - DBG ( "Installing UNDI driver code to %hx:0000, data at %hx:0000\n", - undi.pxs->loader.undi_cs, undi.pxs->loader.undi_ds ); - - /* Do the API call to install the loader */ - if ( ! undi_call_loader () ) return 0; - - pxe = VIRTUAL( undi.pxs->loader.undi_cs, undi.pxs->loader.pxe_off ); - DBG ( "UNDI driver created a pixie at %hx:%hx...", - undi.pxs->loader.undi_cs, undi.pxs->loader.pxe_off ); - if ( memcmp ( pxe->Signature, "!PXE", 4 ) != 0 ) { - DBG ( "invalid signature\n" ); - return 0; - } - if ( checksum ( pxe, sizeof(pxe_t) ) != 0 ) { - DBG ( "invalid checksum\n" ); - return 0; - } - DBG ( "ok\n" ); - undi.pxe = pxe; - pxe_dump(); - return 1; -} - -/* Start the UNDI driver. - */ - -int eb_pxenv_start_undi ( void ) { - int success = 0; - - /* AX contains PCI bus:devfn (PCI specification) */ - undi.pxs->start_undi.ax = ( undi.pci.bus << 8 ) | undi.pci.devfn; - /* BX and DX set to 0xffff for non-ISAPnP devices - * (BIOS boot specification) - */ - undi.pxs->start_undi.bx = 0xffff; - undi.pxs->start_undi.dx = 0xffff; - /* ES:DI points to PnP BIOS' $PnP structure - * (BIOS boot specification) - */ - undi.pxs->start_undi.es = 0xf000; - undi.pxs->start_undi.di = virt_to_phys ( undi.pnp_bios ) - 0xf0000; - - DBG ( "PXENV_START_UNDI => AX=%hx BX=%hx DX=%hx ES:DI=%hx:%hx\n", - undi.pxs->start_undi.ax, - undi.pxs->start_undi.bx, undi.pxs->start_undi.dx, - undi.pxs->start_undi.es, undi.pxs->start_undi.di ); - success = undi_call ( PXENV_START_UNDI ); - DBG ( "PXENV_START_UNDI <= Status=%s\n", UNDI_STATUS(undi.pxs) ); - if ( success ) undi.prestarted = 1; - return success; -} - -int eb_pxenv_undi_startup ( void ) { - int success = 0; - - DBG ( "PXENV_UNDI_STARTUP => (void)\n" ); - success = undi_call ( PXENV_UNDI_STARTUP ); - DBG ( "PXENV_UNDI_STARTUP <= Status=%s\n", UNDI_STATUS(undi.pxs) ); - if ( success ) undi.started = 1; - return success; -} - -int eb_pxenv_undi_cleanup ( void ) { - int success = 0; - - DBG ( "PXENV_UNDI_CLEANUP => (void)\n" ); - success = undi_call ( PXENV_UNDI_CLEANUP ); - DBG ( "PXENV_UNDI_CLEANUP <= Status=%s\n", UNDI_STATUS(undi.pxs) ); - return success; -} - -int eb_pxenv_undi_initialize ( void ) { - int success = 0; - - undi.pxs->undi_initialize.ProtocolIni = 0; - memset ( &undi.pxs->undi_initialize.reserved, 0, - sizeof ( undi.pxs->undi_initialize.reserved ) ); - DBG ( "PXENV_UNDI_INITIALIZE => ProtocolIni=%x\n" ); - success = undi_call ( PXENV_UNDI_INITIALIZE ); - DBG ( "PXENV_UNDI_INITIALIZE <= Status=%s\n", UNDI_STATUS(undi.pxs) ); - if ( success ) undi.initialized = 1; - return success; -} - -int eb_pxenv_undi_shutdown ( void ) { - int success = 0; - - DBG ( "PXENV_UNDI_SHUTDOWN => (void)\n" ); - success = undi_call ( PXENV_UNDI_SHUTDOWN ); - DBG ( "PXENV_UNDI_SHUTDOWN <= Status=%s\n", UNDI_STATUS(undi.pxs) ); - if ( success ) { - undi.initialized = 0; - undi.started = 0; - } - return success; -} - -int eb_pxenv_undi_open ( void ) { - int success = 0; - - undi.pxs->undi_open.OpenFlag = 0; - undi.pxs->undi_open.PktFilter = FLTR_DIRECTED | FLTR_BRDCST; - - /* Multicast support not yet implemented */ - undi.pxs->undi_open.R_Mcast_Buf.MCastAddrCount = 0; - DBG ( "PXENV_UNDI_OPEN => OpenFlag=%hx PktFilter=%hx " - "MCastAddrCount=%hx\n", - undi.pxs->undi_open.OpenFlag, undi.pxs->undi_open.PktFilter, - undi.pxs->undi_open.R_Mcast_Buf.MCastAddrCount ); - success = undi_call ( PXENV_UNDI_OPEN ); - DBG ( "PXENV_UNDI_OPEN <= Status=%s\n", UNDI_STATUS(undi.pxs) ); - if ( success ) undi.opened = 1; - return success; -} - -int eb_pxenv_undi_close ( void ) { - int success = 0; - - DBG ( "PXENV_UNDI_CLOSE => (void)\n" ); - success = undi_call ( PXENV_UNDI_CLOSE ); - DBG ( "PXENV_UNDI_CLOSE <= Status=%s\n", UNDI_STATUS(undi.pxs) ); - if ( success ) undi.opened = 0; - return success; -} - -int eb_pxenv_undi_transmit_packet ( void ) { - int success = 0; - static const uint8_t broadcast[] = { 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF }; - - /* XMitFlag selects unicast / broadcast */ - if ( memcmp ( undi.xmit_data->destaddr, broadcast, - sizeof(broadcast) ) == 0 ) { - undi.pxs->undi_transmit.XmitFlag = XMT_BROADCAST; - } else { - undi.pxs->undi_transmit.XmitFlag = XMT_DESTADDR; - } - - /* Zero reserved dwords */ - undi.pxs->undi_transmit.Reserved[0] = 0; - undi.pxs->undi_transmit.Reserved[1] = 0; - - /* Segment:offset pointer to DestAddr in base memory */ - undi.pxs->undi_transmit.DestAddr.segment = - SEGMENT( undi.xmit_data->destaddr ); - undi.pxs->undi_transmit.DestAddr.offset = - OFFSET( undi.xmit_data->destaddr ); - - /* Segment:offset pointer to TBD in base memory */ - undi.pxs->undi_transmit.TBD.segment = SEGMENT( &undi.xmit_data->tbd ); - undi.pxs->undi_transmit.TBD.offset = OFFSET( &undi.xmit_data->tbd ); - - /* Use only the "immediate" part of the TBD */ - undi.xmit_data->tbd.DataBlkCount = 0; - - DBG ( "PXENV_UNDI_TRANSMIT_PACKET => Protocol=%hx XmitFlag=%hx ...\n" - "... DestAddr=%hx:%hx TBD=%hx:%hx ...\n", - undi.pxs->undi_transmit.Protocol, - undi.pxs->undi_transmit.XmitFlag, - undi.pxs->undi_transmit.DestAddr.segment, - undi.pxs->undi_transmit.DestAddr.offset, - undi.pxs->undi_transmit.TBD.segment, - undi.pxs->undi_transmit.TBD.offset ); - DBG ( "... TBD { ImmedLength=%hx Xmit=%hx:%hx DataBlkCount=%hx }\n", - undi.xmit_data->tbd.ImmedLength, - undi.xmit_data->tbd.Xmit.segment, - undi.xmit_data->tbd.Xmit.offset, - undi.xmit_data->tbd.DataBlkCount ); - success = undi_call ( PXENV_UNDI_TRANSMIT ); - DBG ( "PXENV_UNDI_TRANSMIT_PACKET <= Status=%s\n", - UNDI_STATUS(undi.pxs) ); - return success; -} - -int eb_pxenv_undi_set_station_address ( void ) { - /* This will spuriously fail on some cards. Ignore failures. - * We only ever use it to set the MAC address to the card's - * permanent value anyway, so it's a useless call (although we - * make it because PXE spec says we should). - */ - DBG ( "PXENV_UNDI_SET_STATION_ADDRESS => " - "StationAddress=%!\n", - undi.pxs->undi_set_station_address.StationAddress ); - undi_call_silent ( PXENV_UNDI_SET_STATION_ADDRESS ); - DBG ( "PXENV_UNDI_SET_STATION_ADDRESS <= Status=%s\n", - UNDI_STATUS(undi.pxs) ); - return 1; -} - -int eb_pxenv_undi_get_information ( void ) { - int success = 0; - memset ( undi.pxs, 0, sizeof ( undi.pxs ) ); - DBG ( "PXENV_UNDI_GET_INFORMATION => (void)\n" ); - success = undi_call ( PXENV_UNDI_GET_INFORMATION ); - DBG ( "PXENV_UNDI_GET_INFORMATION <= Status=%s " - "BaseIO=%hx IntNumber=%hx ...\n" - "... MaxTranUnit=%hx HwType=%hx HwAddrlen=%hx ...\n" - "... CurrentNodeAddress=%! PermNodeAddress=%! ...\n" - "... ROMAddress=%hx RxBufCt=%hx TxBufCt=%hx\n", - UNDI_STATUS(undi.pxs), - undi.pxs->undi_get_information.BaseIo, - undi.pxs->undi_get_information.IntNumber, - undi.pxs->undi_get_information.MaxTranUnit, - undi.pxs->undi_get_information.HwType, - undi.pxs->undi_get_information.HwAddrLen, - undi.pxs->undi_get_information.CurrentNodeAddress, - undi.pxs->undi_get_information.PermNodeAddress, - undi.pxs->undi_get_information.ROMAddress, - undi.pxs->undi_get_information.RxBufCt, - undi.pxs->undi_get_information.TxBufCt ); - return success; -} - -int eb_pxenv_undi_get_iface_info ( void ) { - int success = 0; - - DBG ( "PXENV_UNDI_GET_IFACE_INFO => (void)\n" ); - success = undi_call ( PXENV_UNDI_GET_IFACE_INFO ); - DBG ( "PXENV_UNDI_GET_IFACE_INFO <= Status=%s IfaceType=%s ...\n" - "... LinkSpeed=%x ServiceFlags=%x\n", - UNDI_STATUS(undi.pxs), - undi.pxs->undi_get_iface_info.IfaceType, - undi.pxs->undi_get_iface_info.LinkSpeed, - undi.pxs->undi_get_iface_info.ServiceFlags ); - return success; -} - -int eb_pxenv_undi_isr ( void ) { - int success = 0; - - DBG ( "PXENV_UNDI_ISR => FuncFlag=%hx\n", - undi.pxs->undi_isr.FuncFlag ); - success = undi_call ( PXENV_UNDI_ISR ); - DBG ( "PXENV_UNDI_ISR <= Status=%s FuncFlag=%hx BufferLength=%hx ...\n" - "... FrameLength=%hx FrameHeaderLength=%hx Frame=%hx:%hx " - "ProtType=%hhx ...\n... PktType=%hhx\n", - UNDI_STATUS(undi.pxs), undi.pxs->undi_isr.FuncFlag, - undi.pxs->undi_isr.BufferLength, - undi.pxs->undi_isr.FrameLength, - undi.pxs->undi_isr.FrameHeaderLength, - undi.pxs->undi_isr.Frame.segment, - undi.pxs->undi_isr.Frame.offset, - undi.pxs->undi_isr.ProtType, - undi.pxs->undi_isr.PktType ); - return success; -} - -int eb_pxenv_stop_undi ( void ) { - int success = 0; - - DBG ( "PXENV_STOP_UNDI => (void)\n" ); - success = undi_call ( PXENV_STOP_UNDI ); - DBG ( "PXENV_STOP_UNDI <= Status=%s\n", UNDI_STATUS(undi.pxs) ); - if ( success ) undi.prestarted = 0; - return success; -} - -int eb_pxenv_unload_stack ( void ) { - int success = 0; - - memset ( undi.pxs, 0, sizeof ( undi.pxs ) ); - DBG ( "PXENV_UNLOAD_STACK => (void)\n" ); - success = undi_call_silent ( PXENV_UNLOAD_STACK ); - DBG ( "PXENV_UNLOAD_STACK <= Status=%s ...\n... (%s)\n", - UNDI_STATUS(undi.pxs), - ( undi.pxs->Status == PXENV_STATUS_SUCCESS ? - "base-code is ready to be removed" : - ( undi.pxs->Status == PXENV_STATUS_FAILURE ? - "the size of free base memory has been changed" : - ( undi.pxs->Status == PXENV_STATUS_KEEP_ALL ? - "the NIC interrupt vector has been changed" : - "UNEXPECTED STATUS CODE" ) ) ) ); - return success; -} - -int eb_pxenv_stop_base ( void ) { - int success = 0; - - DBG ( "PXENV_STOP_BASE => (void)\n" ); - success = undi_call ( PXENV_STOP_BASE ); - DBG ( "PXENV_STOP_BASE <= Status=%s\n", UNDI_STATUS(undi.pxs) ); - return success; -} - -/* Unload UNDI base code (if any present) and free memory. - */ -int undi_unload_base_code ( void ) { - /* In GRUB, we do not allocate anything, but we still can call - * to free the base space */ - void *bc_code = VIRTUAL( undi.pxe->BC_Code.Seg_Addr, 0 ); - size_t bc_code_size = undi.pxe->BC_Code.Seg_Size; - void *bc_data = VIRTUAL( undi.pxe->BC_Data.Seg_Addr, 0 ); - size_t bc_data_size = undi.pxe->BC_Data.Seg_Size; - void *bc_stck = VIRTUAL( undi.pxe->Stack.Seg_Addr, 0 ); - size_t bc_stck_size = undi.pxe->Stack.Seg_Size; - firing_squad_lineup_t lineup; - - /* Don't unload if there is no base code present */ - if ( undi.pxe->BC_Code.Seg_Addr == 0 ) return 1; - - /* Since we never start the base code, the only time we should - * reach this is if we were loaded via PXE. There are many - * different and conflicting versions of the "correct" way to - * unload the PXE base code, several of which appear within - * the PXE specification itself. This one seems to work for - * our purposes. - */ - eb_pxenv_stop_base(); - //eb_pxenv_unload_stack(); -/* if ( ( undi.pxs->unload_stack.Status != PXENV_STATUS_SUCCESS ) && - ( undi.pxs->unload_stack.Status != PXENV_STATUS_FAILURE ) ) { - printf ( "Could not free memory allocated to PXE base code: " - "possible memory leak\n" ); - return 0; - }*/ - /* Free data structures. Forget what the PXE specification - * says about how to calculate the new size of base memory; - * basemem.c takes care of all that for us. Note that we also - * have to free the stack (even though PXE spec doesn't say - * anything about it) because nothing else is going to do so. - * - * Structures will almost certainly not be kB-aligned and - * there's a reasonable chance that the UNDI code or data - * portions will lie in the same kB as the base code. Since - * forget_base_memory works only in 1kB increments, this means - * we have to do some arcane trickery. - */ - memset ( &lineup, 0, sizeof(lineup) ); - if ( SEGMENT(bc_code) != 0 ) - assemble_firing_squad( &lineup, bc_code, bc_code_size, SHOOT ); - if ( SEGMENT(bc_data) != 0 ) - assemble_firing_squad( &lineup, bc_data, bc_data_size, SHOOT ); - if ( SEGMENT(bc_stck) != 0 ) - assemble_firing_squad( &lineup, bc_stck, bc_stck_size, SHOOT ); - /* Don't shoot any bits of the UNDI driver code or data */ - assemble_firing_squad ( &lineup, - VIRTUAL(undi.pxe->UNDICode.Seg_Addr, 0), - undi.pxe->UNDICode.Seg_Size, DONTSHOOT ); - assemble_firing_squad ( &lineup, - VIRTUAL(undi.pxe->UNDIData.Seg_Addr, 0), - undi.pxe->UNDIData.Seg_Size, DONTSHOOT ); - //shoot_targets ( &lineup ); - //undi.pxe->BC_Code.Seg_Addr = 0; - //undi.pxe->BC_Data.Seg_Addr = 0; - //undi.pxe->Stack.Seg_Addr = 0; - - /* Free and reallocate our own base memory data structures, to - * allow the freed base-code blocks to be fully released. - */ - free_base_mem_data(); - if ( ! allocate_base_mem_data() ) { - printf ( "FATAL: memory unaccountably lost\n" ); - while ( 1 ) {}; - } - - return 1; -} - -/* UNDI full initialization - * - * This calls all the various UNDI initialization routines in sequence. - */ - -int undi_full_startup ( void ) { - if ( ! eb_pxenv_start_undi() ) return 0; - if ( ! eb_pxenv_undi_startup() ) return 0; - if ( ! eb_pxenv_undi_initialize() ) return 0; - if ( ! eb_pxenv_undi_get_information() ) return 0; - undi.irq = undi.pxs->undi_get_information.IntNumber; - if ( ! install_undi_irq_handler ( undi.irq, undi.pxe->EntryPointSP ) ) { - undi.irq = IRQ_NONE; - return 0; - } - memmove ( &undi.pxs->undi_set_station_address.StationAddress, - &undi.pxs->undi_get_information.PermNodeAddress, - sizeof (undi.pxs->undi_set_station_address.StationAddress) ); - if ( ! eb_pxenv_undi_set_station_address() ) return 0; - if ( ! eb_pxenv_undi_open() ) return 0; - /* install_undi_irq_handler leaves irq disabled */ - enable_irq ( undi.irq ); - return 1; -} - -/* UNDI full shutdown - * - * This calls all the various UNDI shutdown routines in sequence and - * also frees any memory that it can. - */ - -int undi_full_shutdown ( void ) { - if ( undi.pxe != NULL ) { - /* In case we didn't allocate the driver's memory in the first - * place, try to grab the code and data segments and sizes - * from the !PXE structure. - */ - if ( undi.driver_code == NULL ) { - undi.driver_code = VIRTUAL(undi.pxe->UNDICode.Seg_Addr, - 0 ); - undi.driver_code_size = undi.pxe->UNDICode.Seg_Size; - } - if ( undi.driver_data == NULL ) { - undi.driver_data = VIRTUAL(undi.pxe->UNDIData.Seg_Addr, - 0 ); - undi.driver_data_size = undi.pxe->UNDIData.Seg_Size; - } - - /* Ignore errors and continue in the hope of shutting - * down anyway - */ - if ( undi.opened ) eb_pxenv_undi_close(); - if ( undi.started ) { - eb_pxenv_undi_cleanup(); - /* We may get spurious UNDI API errors at this - * point. If startup() succeeded but - * initialize() failed then according to the - * spec, we should call shutdown(). However, - * some NICS will fail with a status code - * 0x006a (INVALID_STATE). - */ - eb_pxenv_undi_shutdown(); - } - if ( undi.irq != IRQ_NONE ) { - remove_undi_irq_handler ( undi.irq ); - undi.irq = IRQ_NONE; - } - undi_unload_base_code(); - if ( undi.prestarted ) { - eb_pxenv_stop_undi(); - /* Success OR Failure indicates that memory - * can be freed. Any other status code means - * that it can't. - */ - if (( undi.pxs->Status == PXENV_STATUS_KEEP_UNDI ) || - ( undi.pxs->Status == PXENV_STATUS_KEEP_ALL ) ) { - printf ("Could not free memory allocated to " - "UNDI driver: possible memory leak\n"); - return 0; - } - } - } - /* Free memory allocated to UNDI driver */ - if ( undi.driver_code != NULL ) { - /* Clear contents in order to eliminate !PXE and PXENV - * signatures to prevent spurious detection via base - * memory scan. - */ - memset ( undi.driver_code, 0, undi.driver_code_size ); - /* forget_base_memory ( undi.driver_code, undi.driver_code_size ); */ - undi.driver_code = NULL; - undi.driver_code_size = 0; - } - if ( undi.driver_data != NULL ) { - /* forget_base_memory ( undi.driver_data, undi.driver_data_size ); */ - undi.driver_data = NULL; - undi.driver_data_size = 0; - } - /* !PXE structure now gone; memory freed */ - undi.pxe = NULL; - return 1; -} - -/************************************************************************** -POLL - Wait for a frame -***************************************************************************/ -static int undi_poll(struct nic *nic, int retrieve) -{ - /* Fun, fun, fun. UNDI drivers don't use polling; they use - * interrupts. We therefore cheat and pretend that an - * interrupt has occurred every time undi_poll() is called. - * This isn't too much of a hack; PCI devices share IRQs and - * so the first thing that a proper ISR should do is call - * PXENV_UNDI_ISR to determine whether or not the UNDI NIC - * generated the interrupt; there is no harm done by spurious - * calls to PXENV_UNDI_ISR. Similarly, we wouldn't be - * handling them any more rapidly than the usual rate of - * undi_poll() being called even if we did implement a full - * ISR. So it should work. Ha! - * - * Addendum (21/10/03). Some cards don't play nicely with - * this trick, so instead of doing it the easy way we have to - * go to all the hassle of installing a genuine interrupt - * service routine and dealing with the wonderful 8259 - * Programmable Interrupt Controller. Joy. - * - * (02/01/2005). A real UNDI ISR is now implemented in, - * following Figure 3-4 in PXE spec 2.0. The interrupt - * handler, undi_irq_handler, issues PXENV_UNDI_ISR_IN_START. - * If the interrupt is ours, the handler sends EOI and bumps the - * undi_irq_trigger_count. This polled routine is equivalent - * to the "driver strategy routine". - * - * Another issue is that upper layer await_*() does not handle - * coalesced packets. The UNDI implementation on broadcom chips - * appear to combine interrupts. If we loop through GET_NEXT, - * we may hand up coalesced packets, resulting in drops, and - * severe time delay. As a temperary hack, we return as soon as - * we get something, remembering where we were (IN_PROCESS - * or GET_NEXT). This assume packets are never broken up. - * XXX Need to fix upper layer to handle coalesced data. - */ - - static int undi_opcode = PXENV_UNDI_ISR_IN_PROCESS; - - /* See if a hardware interrupt has occurred since the last poll(). - */ - switch ( undi_opcode ) { - case PXENV_UNDI_ISR_IN_PROCESS: - if ( ! undi_irq_triggered ( undi.irq ) ) - return 0; - default: - break; - } - - /* We have an interrupt or there is something left from - * last poll. Either way, we need to call UNDI ISR. - */ - nic->packetlen = 0; - undi.pxs->undi_isr.FuncFlag = undi_opcode; - /* there is no good way to handle this error */ - if ( ! eb_pxenv_undi_isr() ) { - printf ("undi isr call failed: opcode = %d\n", undi_opcode); - return 0; - } - switch ( undi.pxs->undi_isr.FuncFlag ) { - case PXENV_UNDI_ISR_OUT_DONE: - /* Set opcode back to IN_PROCESS and wait for next intr */ - undi_opcode = PXENV_UNDI_ISR_IN_PROCESS; - return 0; - case PXENV_UNDI_ISR_OUT_TRANSMIT: - /* We really don't care about transmission complete - * interrupts. Move on to next frame. - */ - undi_opcode = PXENV_UNDI_ISR_IN_GET_NEXT; - return 0; - case PXENV_UNDI_ISR_OUT_BUSY: - /* This should never happen. - */ - undi_opcode = PXENV_UNDI_ISR_IN_GET_NEXT; - printf ( "UNDI ISR thinks it's being re-entered!\n" - "Aborting receive\n" ); - return 0; - case PXENV_UNDI_ISR_OUT_RECEIVE: - /* Copy data to receive buffer and move on to next frame */ - undi_opcode = PXENV_UNDI_ISR_IN_GET_NEXT; - memcpy ( nic->packet + nic->packetlen, - VIRTUAL( undi.pxs->undi_isr.Frame.segment, - undi.pxs->undi_isr.Frame.offset ), - undi.pxs->undi_isr.BufferLength ); - nic->packetlen += undi.pxs->undi_isr.BufferLength; - break; - default: - undi_opcode = PXENV_UNDI_ISR_IN_PROCESS; - printf ( "UNDI ISR returned bizzare status code %d\n", - undi.pxs->undi_isr.FuncFlag ); - } - - return nic->packetlen > 0 ? 1 : 0; -} - -/************************************************************************** -TRANSMIT - Transmit a frame -***************************************************************************/ -static void undi_transmit( - struct nic *nic, - const char *d, /* Destination */ - unsigned int t, /* Type */ - unsigned int s, /* size */ - const char *p) /* Packet */ -{ - /* Inhibit compiler warning about unused parameter nic */ - if ( nic == NULL ) {}; - - /* Copy destination to buffer in base memory */ - memcpy ( undi.xmit_data->destaddr, d, sizeof(MAC_ADDR) ); - - /* Translate packet type to UNDI packet type */ - switch ( t ) { - case IP : undi.pxs->undi_transmit.Protocol = P_IP; break; - case ARP: undi.pxs->undi_transmit.Protocol = P_ARP; break; - case RARP: undi.pxs->undi_transmit.Protocol = P_RARP; break; - default: undi.pxs->undi_transmit.Protocol = P_UNKNOWN; break; - } - - /* Store packet length in TBD */ - undi.xmit_data->tbd.ImmedLength = s; - - /* Check to see if data to be transmitted is currently in base - * memory. If not, allocate temporary storage in base memory - * and copy it there. - */ - if ( SEGMENT( p ) <= 0xffff ) { - undi.xmit_data->tbd.Xmit.segment = SEGMENT( p ); - undi.xmit_data->tbd.Xmit.offset = OFFSET( p ); - } else { - memcpy ( undi.xmit_buffer, p, s ); - undi.xmit_data->tbd.Xmit.segment = SEGMENT( undi.xmit_buffer ); - undi.xmit_data->tbd.Xmit.offset = OFFSET( undi.xmit_buffer ); - } - - eb_pxenv_undi_transmit_packet(); -} - -/************************************************************************** -DISABLE - Turn off ethernet interface -***************************************************************************/ -static void undi_disable(struct dev *dev) -{ - /* Inhibit compiler warning about unused parameter dev */ - if ( dev == NULL ) {}; - undi_full_shutdown(); - free_base_mem_data(); -} - -/************************************************************************** -PROBE - Look for an adapter, this routine's visible to the outside -***************************************************************************/ - -/* Locate an UNDI driver by first scanning through base memory for an - * installed driver and then by scanning for UNDI ROMs and attempting - * to install their drivers. - */ - -int hunt_pixies_and_undi_roms ( void ) { - static uint8_t hunt_type = HUNT_FOR_PIXIES; - - if ( hunt_type == HUNT_FOR_PIXIES ) { - if ( hunt_pixie() ) { - return 1; - } - } - hunt_type = HUNT_FOR_UNDI_ROMS; - while ( hunt_undi_rom() ) { - if ( undi_loader() ) { - return 1; - } - undi_full_shutdown(); /* Free any allocated memory */ - } - hunt_type = HUNT_FOR_PIXIES; - return 0; -} - -/* The actual Etherboot probe routine. - */ - -static int undi_probe(struct dev *dev, struct pci_device *pci) -{ - struct nic *nic = (struct nic *)dev; - - /* Zero out global undi structure */ - memset ( &undi, 0, sizeof(undi) ); - - /* Store PCI parameters; we will need them to initialize the UNDI - * driver later. - */ - memcpy ( &undi.pci, pci, sizeof(undi.pci) ); - - /* Find the BIOS' $PnP structure */ - if ( ! hunt_pnp_bios() ) { - printf ( "No PnP BIOS found; aborting\n" ); - return 0; - } - - /* Allocate base memory data structures */ - if ( ! allocate_base_mem_data() ) return 0; - - /* Search thoroughly for UNDI drivers */ - for ( ; hunt_pixies_and_undi_roms(); undi_full_shutdown() ) { - /* Try to initialise UNDI driver */ - DBG ( "Initializing UNDI driver. Please wait...\n" ); - if ( ! undi_full_startup() ) { - if ( undi.pxs->Status == - PXENV_STATUS_UNDI_MEDIATEST_FAILED ) { - DBG ( "Cable not connected (code %#hx)\n", - PXENV_STATUS_UNDI_MEDIATEST_FAILED ); - } - continue; - } - /* Basic information: MAC, IO addr, IRQ */ - if ( ! eb_pxenv_undi_get_information() ) continue; - DBG ( "Initialized UNDI NIC with IO %#hx, IRQ %d, MAC %!\n", - undi.pxs->undi_get_information.BaseIo, - undi.pxs->undi_get_information.IntNumber, - undi.pxs->undi_get_information.CurrentNodeAddress ); - /* Fill out MAC address in nic structure */ - memcpy ( nic->node_addr, - undi.pxs->undi_get_information.CurrentNodeAddress, - ETH_ALEN ); - /* More diagnostic information including link speed */ - if ( ! eb_pxenv_undi_get_iface_info() ) continue; - printf ( " NDIS type %s interface at %d Mbps\n", - undi.pxs->undi_get_iface_info.IfaceType, - undi.pxs->undi_get_iface_info.LinkSpeed / 1000000 ); - DBG ("UNDI Stack at %#hx:%#hx",UNDI_STACK_SEG, UNDI_STACK_OFF); - dev->disable = undi_disable; - nic->poll = undi_poll; - nic->transmit = undi_transmit; - return 1; - } - undi_disable ( dev ); /* To free base memory structures */ - return 0; -} - -/* UNDI driver states that it is suitable for any PCI NIC (i.e. any - * PCI device of class PCI_CLASS_NETWORK_ETHERNET). If there are any - * obscure UNDI NICs that have the incorrect PCI class, add them to - * this list. - */ -static struct pci_id undi_nics[] = { - /* PCI_ROM(0x0000, 0x0000, "undi", "UNDI adaptor"), */ -}; - -struct pci_driver undi_driver = { - .type = NIC_DRIVER, - .name = "UNDI", - .probe = undi_probe, - .ids = undi_nics, - .id_count = sizeof(undi_nics)/sizeof(undi_nics[0]), - .class = PCI_CLASS_NETWORK_ETHERNET, -}; - -/************************************************ - * Code for reusing the BIOS provided pxe stack - */ - -/* Verify !PXE structure saved by pxeloader. */ -int undi_bios_pxe(void **dhcpreply) -{ - pxe_t *pxe; - uint16_t *ptr = (uint16_t *)0x7C80; - - pxe = (pxe_t *) VIRTUAL(ptr[0], ptr[1]); - if (memcmp(pxe->Signature, "!PXE", 4) != 0) { - DBG ("invalid !PXE signature at %x:%x\n", ptr[0], ptr[1]); - return 0; - } - - if (checksum(pxe, sizeof(pxe_t)) != 0) { - DBG ("invalid checksum\n"); - return 0; - } - - /* Zero out global undi structure */ - memset (&undi, 0, sizeof(undi)); - - /* Allocate base memory data structures */ - if (! allocate_base_mem_data()) return 0; - - undi.pxe = pxe; - pxe_dump(); - - if (!eb_pxenv_get_cached_info(PXENV_PACKET_TYPE_DHCP_ACK, dhcpreply)) { - DBG ("failed to get cached DHCP reply\n"); - return 0; - } - return 1; -} - -void undi_pxe_disable(void) -{ - /* full shutdown is problematic for some machines */ - (void) eb_pxenv_undi_shutdown(); -} - -/* - * Various helper functions for dhcp and tftp - */ -int eb_pxenv_get_cached_info (uint8_t type, void **info) -{ - int success; - - memset(undi.pxs, 0, sizeof (undi.pxs)); - /* Segment:offset pointer to DestAddr in base memory */ - undi.pxs->get_cached_info.PacketType = type; - undi.pxs->get_cached_info.BufferSize = 0; - undi.pxs->get_cached_info.Buffer.segment = 0; - undi.pxs->get_cached_info.Buffer.offset = 0; - - success = undi_call(PXENV_GET_CACHED_INFO); - DBG ("PXENV_GET_CACHED_INFO <= Status=%s\n", UNDI_STATUS(undi.pxs)); - - *info = (void *)VIRTUAL(undi.pxs->get_cached_info.Buffer.segment, - undi.pxs->get_cached_info.Buffer.offset); - return success; -} - -/* tftp help routines */ -int eb_pxenv_tftp_open(char *file, IP4_t serverip, IP4_t gatewayip, - uint16_t *pktlen) -{ - int success; - memset(undi.pxs, 0, sizeof (undi.pxs)); - undi.pxs->tftp_open.ServerIPAddress = serverip; - undi.pxs->tftp_open.GatewayIPAddress = gatewayip; - undi.pxs->tftp_open.TFTPPort = htons(TFTP_PORT); - undi.pxs->tftp_open.PacketSize = TFTP_MAX_PACKET; - (void) sprintf(undi.pxs->tftp_open.FileName, "%s", file); - success = undi_call(PXENV_TFTP_OPEN); - DBG ("PXENV_TFTP_OPEN <= Status=%s\n", UNDI_STATUS(undi.pxs)); - *pktlen = undi.pxs->tftp_open.PacketSize; - return success; -} - -int eb_pxenv_tftp_read(uint8_t *buf, uint16_t *len) -{ - static int tftp_count = 0; - - int success; - memset(undi.pxs, 0, sizeof (undi.pxs)); - undi.pxs->tftp_read.Buffer.segment = SEGMENT(buf); - undi.pxs->tftp_read.Buffer.offset = OFFSET(buf); - success = undi_call(PXENV_TFTP_READ); - DBG ("PXENV_TFTP_READ <= Status=%s\n", UNDI_STATUS(undi.pxs)); - *len = undi.pxs->tftp_read.BufferSize; - tftp_count++; - if ((tftp_count % 1000) == 0) - noisy_printf("."); - return success; -} - -int eb_pxenv_tftp_close(void) -{ - int success; - memset(undi.pxs, 0, sizeof (undi.pxs)); - success = undi_call(PXENV_TFTP_CLOSE); - DBG ("PXENV_TFTP_CLOSE <= Status=%s\n", UNDI_STATUS(undi.pxs)); - return success; -} - -int eb_pxenv_tftp_get_fsize(char *file, IP4_t serverip, IP4_t gatewayip, - uint32_t *fsize) -{ - int success; - memset(undi.pxs, 0, sizeof (undi.pxs)); - undi.pxs->tftp_open.ServerIPAddress = serverip; - undi.pxs->tftp_open.GatewayIPAddress = gatewayip; - (void) sprintf(undi.pxs->tftp_open.FileName, "%s", file); - success = undi_call(PXENV_TFTP_GET_FSIZE); - DBG ("PXENV_TFTP_GET_FSIZE <= Status=%s\n", UNDI_STATUS(undi.pxs)); - *fsize = undi.pxs->tftp_get_fsize.FileSize; - return success; -} diff --git a/usr/src/grub/grub-0.95/netboot/undi.h b/usr/src/grub/grub-0.95/netboot/undi.h deleted file mode 100644 index 511de98b8a..0000000000 --- a/usr/src/grub/grub-0.95/netboot/undi.h +++ /dev/null @@ -1,239 +0,0 @@ -/************************************************************************** -Etherboot - BOOTP/TFTP Bootstrap Program -UNDI NIC driver for Etherboot - header file - -This file Copyright (C) 2003 Michael Brown -of Fen Systems Ltd. (http://www.fensystems.co.uk/). All rights -reserved. - -$Id: undi.h,v 1.5 2003/10/24 10:05:06 mcb30 Exp $ -***************************************************************************/ - -/* - * 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. - */ - -/* Include pxe.h from FreeBSD. - * pxe.h defines PACKED, which etherboot.h has already defined. - */ - -#undef PACKED -#include "pxe.h" -#include "pic8259.h" - -/* __undi_call is the assembler wrapper to the real-mode UNDI calls. - * Pass it the real-mode segment:offset address of an undi_call_info_t - * structure. The parameters are only uint16_t, but GCC will push - * them on the stack as uint32_t anyway for the sake of alignment. We - * specify them here as uint32_t to remove ambiguity. - */ - -typedef struct undi_call_info { - SEGOFF16_t routine; - uint16_t stack[3]; -} undi_call_info_t; - -typedef uint16_t PXENV_EXIT_t; -#define PXENV_EXIT_SUCCESS 0x0000 -#define PXENV_EXIT_FAILURE 0x0001 -PXENV_EXIT_t __undi_call ( uint32_t, uint32_t ); - -/* The UNDI loader parameter structure is not defined in pxe.h - */ - -typedef struct undi_loader { - PXENV_STATUS_t status; - uint16_t ax; - uint16_t bx; - uint16_t dx; - uint16_t di; - uint16_t es; - uint16_t undi_ds; - uint16_t undi_cs; - uint16_t pxe_off; - uint16_t pxenv_off; -} undi_loader_t; - -/* A union that can function as the parameter block for any UNDI API call. - */ - -typedef union pxenv_structure { - PXENV_STATUS_t Status; /* Make it easy to read status - for any operation */ - undi_loader_t loader; - t_PXENV_START_UNDI start_undi; - t_PXENV_UNDI_STARTUP undi_startup; - t_PXENV_UNDI_CLEANUP undi_cleanup; - t_PXENV_UNDI_INITIALIZE undi_initialize; - t_PXENV_UNDI_SHUTDOWN undi_shutdown; - t_PXENV_UNDI_OPEN undi_open; - t_PXENV_UNDI_CLOSE undi_close; - t_PXENV_UNDI_TRANSMIT undi_transmit; - t_PXENV_UNDI_SET_STATION_ADDRESS undi_set_station_address; - t_PXENV_UNDI_GET_INFORMATION undi_get_information; - t_PXENV_UNDI_GET_IFACE_INFO undi_get_iface_info; - t_PXENV_UNDI_ISR undi_isr; - t_PXENV_STOP_UNDI stop_undi; - t_PXENV_UNLOAD_STACK unload_stack; - t_PXENV_GET_CACHED_INFO get_cached_info; - t_PXENV_UDP_OPEN udp_open; - t_PXENV_UDP_CLOSE udp_close; - t_PXENV_UDP_READ udp_read; - t_PXENV_UDP_WRITE udp_write; - t_PXENV_TFTP_OPEN tftp_open; - t_PXENV_TFTP_CLOSE tftp_close; - t_PXENV_TFTP_READ tftp_read; - t_PXENV_TFTP_GET_FSIZE tftp_get_fsize; -} pxenv_structure_t; - -/* UNDI status codes - */ - -#define PXENV_STATUS_SUCCESS 0x0000 -#define PXENV_STATUS_FAILURE 0x0001 -#define PXENV_STATUS_KEEP_UNDI 0x0004 -#define PXENV_STATUS_KEEP_ALL 0x0005 -#define PXENV_STATUS_UNDI_MEDIATEST_FAILED 0x0061 - -/* BIOS PnP parameter block. We scan for this so that we can pass it - * to the UNDI driver. - */ - -#define PNP_BIOS_SIGNATURE ( ('$'<<0) + ('P'<<8) + ('n'<<16) + ('P'<<24) ) -typedef struct pnp_bios { - uint32_t signature; - uint8_t version; - uint8_t length; - uint16_t control; - uint8_t checksum; - uint8_t dontcare[24]; -} PACKED pnp_bios_t; - -/* Structures within the PXE ROM. - */ - -#define ROM_SIGNATURE 0xaa55 -typedef struct rom { - uint16_t signature; - uint8_t unused[0x14]; - uint16_t undi_rom_id_off; - uint16_t pcir_off; - uint16_t pnp_off; -} PACKED rom_t; - -#define PCIR_SIGNATURE ( ('P'<<0) + ('C'<<8) + ('I'<<16) + ('R'<<24) ) -typedef struct pcir_header { - uint32_t signature; - uint16_t vendor_id; - uint16_t device_id; -} PACKED pcir_header_t; - -#define PNP_SIGNATURE ( ('$'<<0) + ('P'<<8) + ('n'<<16) + ('P'<<24) ) -typedef struct pnp_header { - uint32_t signature; - uint8_t struct_revision; - uint8_t length; - uint16_t next; - uint8_t reserved; - uint8_t checksum; - uint16_t id[2]; - uint16_t manuf_str_off; - uint16_t product_str_off; - uint8_t base_type; - uint8_t sub_type; - uint8_t interface_type; - uint8_t indicator; - uint16_t boot_connect_off; - uint16_t disconnect_off; - uint16_t initialise_off; - uint16_t reserved2; - uint16_t info; -} PACKED pnp_header_t; - -#define UNDI_SIGNATURE ( ('U'<<0) + ('N'<<8) + ('D'<<16) + ('I'<<24) ) -typedef struct undi_rom_id { - uint32_t signature; - uint8_t struct_length; - uint8_t struct_cksum; - uint8_t struct_rev; - uint8_t undi_rev[3]; - uint16_t undi_loader_off; - uint16_t stack_size; - uint16_t data_size; - uint16_t code_size; -} PACKED undi_rom_id_t; - -/* Storage buffers that we need in base memory. We collect these into - * a single structure to make allocation simpler. - */ - -typedef struct undi_base_mem_xmit_data { - MAC_ADDR destaddr; - t_PXENV_UNDI_TBD tbd; -} undi_base_mem_xmit_data_t; - -typedef struct undi_base_mem_data { - undi_call_info_t undi_call_info; - pxenv_structure_t pxs; - undi_base_mem_xmit_data_t xmit_data; - char xmit_buffer[ETH_FRAME_LEN]; - char irq_handler[0]; /* Must be last in structure */ -} undi_base_mem_data_t; - -/* Macros and data structures used when freeing bits of base memory - * used by the UNDI driver. - */ - -#define FIRING_SQUAD_TARGET_SIZE 8 -#define FIRING_SQUAD_TARGET_INDEX(x) ( (x) / FIRING_SQUAD_TARGET_SIZE ) -#define FIRING_SQUAD_TARGET_BIT(x) ( (x) % FIRING_SQUAD_TARGET_SIZE ) -typedef struct firing_squad_lineup { - uint8_t targets[ 640 / FIRING_SQUAD_TARGET_SIZE ]; -} firing_squad_lineup_t; -typedef enum firing_squad_shoot { - DONTSHOOT = 0, - SHOOT = 1 -} firing_squad_shoot_t; - -/* Driver private data structure. - */ - -typedef struct undi { - /* Pointers to various data structures */ - pnp_bios_t *pnp_bios; - rom_t *rom; - undi_rom_id_t *undi_rom_id; - pxe_t *pxe; - undi_call_info_t *undi_call_info; - pxenv_structure_t *pxs; - undi_base_mem_xmit_data_t *xmit_data; - /* Pointers and sizes to keep track of allocated base memory */ - undi_base_mem_data_t *base_mem_data; - void *driver_code; - size_t driver_code_size; - void *driver_data; - size_t driver_data_size; - char *xmit_buffer; - /* Flags. We keep our own instead of trusting the UNDI driver - * to have implemented PXENV_UNDI_GET_STATE correctly. Plus - * there's the small issue of PXENV_UNDI_GET_STATE being the - * same API call as PXENV_STOP_UNDI... - */ - uint8_t prestarted; /* pxenv_start_undi() has been called */ - uint8_t started; /* pxenv_undi_startup() has been called */ - uint8_t initialized; /* pxenv_undi_initialize() has been called */ - uint8_t opened; /* pxenv_undi_open() has been called */ - /* Parameters that we need to store for future reference - */ - struct pci_device pci; - irq_t irq; -} undi_t; - -/* Constants - */ - -#define HUNT_FOR_PIXIES 0 -#define HUNT_FOR_UNDI_ROMS 1 diff --git a/usr/src/grub/grub-0.95/netboot/via-rhine.c b/usr/src/grub/grub-0.95/netboot/via-rhine.c deleted file mode 100644 index b27205e7e5..0000000000 --- a/usr/src/grub/grub-0.95/netboot/via-rhine.c +++ /dev/null @@ -1,1318 +0,0 @@ -/* rhine.c:Fast Ethernet driver for Linux. */ -/* - Adapted 09-jan-2000 by Paolo Marini (paolom@prisma-eng.it) - - originally written by Donald Becker. - - This software may be used and distributed according to the terms - of the GNU Public License (GPL), incorporated herein by reference. - Drivers derived from this code also fall under the GPL and must retain - this authorship and copyright notice. - - Under no circumstances are the authors responsible for - the proper functioning of this software, nor do the authors assume any - responsibility for damages incurred with its use. - - This driver is designed for the VIA VT86C100A Rhine-II PCI Fast Ethernet - controller. - -*/ - -static const char *version = "rhine.c v1.0.1 2003-02-06\n"; - -/* A few user-configurable values. */ - -/* Size of the in-memory receive ring. */ -#define RX_BUF_LEN_IDX 3 /* 0==8K, 1==16K, 2==32K, 3==64K */ -#define RX_BUF_LEN (8192 << RX_BUF_LEN_IDX) - -/* Size of the Tx bounce buffers -- must be at least (dev->mtu+14+4). */ -#define TX_BUF_SIZE 1536 -#define RX_BUF_SIZE 1536 - -/* PCI Tuning Parameters - Threshold is bytes transferred to chip before transmission starts. */ -#define TX_FIFO_THRESH 256 /* In bytes, rounded down to 32 byte units. */ - -/* The following settings are log_2(bytes)-4: 0 == 16 bytes .. 6==1024. */ -#define RX_FIFO_THRESH 4 /* Rx buffer level before first PCI xfer. */ -#define RX_DMA_BURST 4 /* Maximum PCI burst, '4' is 256 bytes */ -#define TX_DMA_BURST 4 - -/* Operational parameters that usually are not changed. */ -/* Time in jiffies before concluding the transmitter is hung. */ -#define TX_TIMEOUT ((2000*HZ)/1000) - -#include "etherboot.h" -#include "nic.h" -#include "pci.h" - -/* define all ioaddr */ - -#define byPAR0 ioaddr -#define byRCR ioaddr + 6 -#define byTCR ioaddr + 7 -#define byCR0 ioaddr + 8 -#define byCR1 ioaddr + 9 -#define byISR0 ioaddr + 0x0c -#define byISR1 ioaddr + 0x0d -#define byIMR0 ioaddr + 0x0e -#define byIMR1 ioaddr + 0x0f -#define byMAR0 ioaddr + 0x10 -#define byMAR1 ioaddr + 0x11 -#define byMAR2 ioaddr + 0x12 -#define byMAR3 ioaddr + 0x13 -#define byMAR4 ioaddr + 0x14 -#define byMAR5 ioaddr + 0x15 -#define byMAR6 ioaddr + 0x16 -#define byMAR7 ioaddr + 0x17 -#define dwCurrentRxDescAddr ioaddr + 0x18 -#define dwCurrentTxDescAddr ioaddr + 0x1c -#define dwCurrentRDSE0 ioaddr + 0x20 -#define dwCurrentRDSE1 ioaddr + 0x24 -#define dwCurrentRDSE2 ioaddr + 0x28 -#define dwCurrentRDSE3 ioaddr + 0x2c -#define dwNextRDSE0 ioaddr + 0x30 -#define dwNextRDSE1 ioaddr + 0x34 -#define dwNextRDSE2 ioaddr + 0x38 -#define dwNextRDSE3 ioaddr + 0x3c -#define dwCurrentTDSE0 ioaddr + 0x40 -#define dwCurrentTDSE1 ioaddr + 0x44 -#define dwCurrentTDSE2 ioaddr + 0x48 -#define dwCurrentTDSE3 ioaddr + 0x4c -#define dwNextTDSE0 ioaddr + 0x50 -#define dwNextTDSE1 ioaddr + 0x54 -#define dwNextTDSE2 ioaddr + 0x58 -#define dwNextTDSE3 ioaddr + 0x5c -#define dwCurrRxDMAPtr ioaddr + 0x60 -#define dwCurrTxDMAPtr ioaddr + 0x64 -#define byMPHY ioaddr + 0x6c -#define byMIISR ioaddr + 0x6d -#define byBCR0 ioaddr + 0x6e -#define byBCR1 ioaddr + 0x6f -#define byMIICR ioaddr + 0x70 -#define byMIIAD ioaddr + 0x71 -#define wMIIDATA ioaddr + 0x72 -#define byEECSR ioaddr + 0x74 -#define byTEST ioaddr + 0x75 -#define byGPIO ioaddr + 0x76 -#define byCFGA ioaddr + 0x78 -#define byCFGB ioaddr + 0x79 -#define byCFGC ioaddr + 0x7a -#define byCFGD ioaddr + 0x7b -#define wTallyCntMPA ioaddr + 0x7c -#define wTallyCntCRC ioaddr + 0x7d -#define bySTICKHW ioaddr + 0x83 -#define byWOLcrClr ioaddr + 0xA4 -#define byWOLcgClr ioaddr + 0xA7 -#define byPwrcsrClr ioaddr + 0xAC - -/*--------------------- Exioaddr Definitions -------------------------*/ - -/* - * Bits in the RCR register - */ - -#define RCR_RRFT2 0x80 -#define RCR_RRFT1 0x40 -#define RCR_RRFT0 0x20 -#define RCR_PROM 0x10 -#define RCR_AB 0x08 -#define RCR_AM 0x04 -#define RCR_AR 0x02 -#define RCR_SEP 0x01 - -/* - * Bits in the TCR register - */ - -#define TCR_RTSF 0x80 -#define TCR_RTFT1 0x40 -#define TCR_RTFT0 0x20 -#define TCR_OFSET 0x08 -#define TCR_LB1 0x04 /* loopback[1] */ -#define TCR_LB0 0x02 /* loopback[0] */ - -/* - * Bits in the CR0 register - */ - -#define CR0_RDMD 0x40 /* rx descriptor polling demand */ -#define CR0_TDMD 0x20 /* tx descriptor polling demand */ -#define CR0_TXON 0x10 -#define CR0_RXON 0x08 -#define CR0_STOP 0x04 /* stop NIC, default = 1 */ -#define CR0_STRT 0x02 /* start NIC */ -#define CR0_INIT 0x01 /* start init process */ - - -/* - * Bits in the CR1 register - */ - -#define CR1_SFRST 0x80 /* software reset */ -#define CR1_RDMD1 0x40 /* RDMD1 */ -#define CR1_TDMD1 0x20 /* TDMD1 */ -#define CR1_KEYPAG 0x10 /* turn on par/key */ -#define CR1_DPOLL 0x08 /* disable rx/tx auto polling */ -#define CR1_FDX 0x04 /* full duplex mode */ -#define CR1_ETEN 0x02 /* early tx mode */ -#define CR1_EREN 0x01 /* early rx mode */ - -/* - * Bits in the CR register - */ - -#define CR_RDMD 0x0040 /* rx descriptor polling demand */ -#define CR_TDMD 0x0020 /* tx descriptor polling demand */ -#define CR_TXON 0x0010 -#define CR_RXON 0x0008 -#define CR_STOP 0x0004 /* stop NIC, default = 1 */ -#define CR_STRT 0x0002 /* start NIC */ -#define CR_INIT 0x0001 /* start init process */ -#define CR_SFRST 0x8000 /* software reset */ -#define CR_RDMD1 0x4000 /* RDMD1 */ -#define CR_TDMD1 0x2000 /* TDMD1 */ -#define CR_KEYPAG 0x1000 /* turn on par/key */ -#define CR_DPOLL 0x0800 /* disable rx/tx auto polling */ -#define CR_FDX 0x0400 /* full duplex mode */ -#define CR_ETEN 0x0200 /* early tx mode */ -#define CR_EREN 0x0100 /* early rx mode */ - -/* - * Bits in the IMR0 register - */ - -#define IMR0_CNTM 0x80 -#define IMR0_BEM 0x40 -#define IMR0_RUM 0x20 -#define IMR0_TUM 0x10 -#define IMR0_TXEM 0x08 -#define IMR0_RXEM 0x04 -#define IMR0_PTXM 0x02 -#define IMR0_PRXM 0x01 - -/* define imrshadow */ - -#define IMRShadow 0x5AFF - -/* - * Bits in the IMR1 register - */ - -#define IMR1_INITM 0x80 -#define IMR1_SRCM 0x40 -#define IMR1_NBFM 0x10 -#define IMR1_PRAIM 0x08 -#define IMR1_RES0M 0x04 -#define IMR1_ETM 0x02 -#define IMR1_ERM 0x01 - -/* - * Bits in the ISR register - */ - -#define ISR_INITI 0x8000 -#define ISR_SRCI 0x4000 -#define ISR_ABTI 0x2000 -#define ISR_NORBF 0x1000 -#define ISR_PKTRA 0x0800 -#define ISR_RES0 0x0400 -#define ISR_ETI 0x0200 -#define ISR_ERI 0x0100 -#define ISR_CNT 0x0080 -#define ISR_BE 0x0040 -#define ISR_RU 0x0020 -#define ISR_TU 0x0010 -#define ISR_TXE 0x0008 -#define ISR_RXE 0x0004 -#define ISR_PTX 0x0002 -#define ISR_PRX 0x0001 - -/* - * Bits in the ISR0 register - */ - -#define ISR0_CNT 0x80 -#define ISR0_BE 0x40 -#define ISR0_RU 0x20 -#define ISR0_TU 0x10 -#define ISR0_TXE 0x08 -#define ISR0_RXE 0x04 -#define ISR0_PTX 0x02 -#define ISR0_PRX 0x01 - -/* - * Bits in the ISR1 register - */ - -#define ISR1_INITI 0x80 -#define ISR1_SRCI 0x40 -#define ISR1_NORBF 0x10 -#define ISR1_PKTRA 0x08 -#define ISR1_ETI 0x02 -#define ISR1_ERI 0x01 - -/* ISR ABNORMAL CONDITION */ - -#define ISR_ABNORMAL ISR_BE+ISR_RU+ISR_TU+ISR_CNT+ISR_NORBF+ISR_PKTRA - -/* - * Bits in the MIISR register - */ - -#define MIISR_MIIERR 0x08 -#define MIISR_MRERR 0x04 -#define MIISR_LNKFL 0x02 -#define MIISR_SPEED 0x01 - -/* - * Bits in the MIICR register - */ - -#define MIICR_MAUTO 0x80 -#define MIICR_RCMD 0x40 -#define MIICR_WCMD 0x20 -#define MIICR_MDPM 0x10 -#define MIICR_MOUT 0x08 -#define MIICR_MDO 0x04 -#define MIICR_MDI 0x02 -#define MIICR_MDC 0x01 - -/* - * Bits in the EECSR register - */ - -#define EECSR_EEPR 0x80 /* eeprom programed status, 73h means programed */ -#define EECSR_EMBP 0x40 /* eeprom embeded programming */ -#define EECSR_AUTOLD 0x20 /* eeprom content reload */ -#define EECSR_DPM 0x10 /* eeprom direct programming */ -#define EECSR_CS 0x08 /* eeprom CS pin */ -#define EECSR_SK 0x04 /* eeprom SK pin */ -#define EECSR_DI 0x02 /* eeprom DI pin */ -#define EECSR_DO 0x01 /* eeprom DO pin */ - -/* - * Bits in the BCR0 register - */ - -#define BCR0_CRFT2 0x20 -#define BCR0_CRFT1 0x10 -#define BCR0_CRFT0 0x08 -#define BCR0_DMAL2 0x04 -#define BCR0_DMAL1 0x02 -#define BCR0_DMAL0 0x01 - -/* - * Bits in the BCR1 register - */ - -#define BCR1_CTSF 0x20 -#define BCR1_CTFT1 0x10 -#define BCR1_CTFT0 0x08 -#define BCR1_POT2 0x04 -#define BCR1_POT1 0x02 -#define BCR1_POT0 0x01 - -/* - * Bits in the CFGA register - */ - -#define CFGA_EELOAD 0x80 /* enable eeprom embeded and direct programming */ -#define CFGA_JUMPER 0x40 -#define CFGA_MTGPIO 0x08 -#define CFGA_T10EN 0x02 -#define CFGA_AUTO 0x01 - -/* - * Bits in the CFGB register - */ - -#define CFGB_PD 0x80 -#define CFGB_POLEN 0x02 -#define CFGB_LNKEN 0x01 - -/* - * Bits in the CFGC register - */ - -#define CFGC_M10TIO 0x80 -#define CFGC_M10POL 0x40 -#define CFGC_PHY1 0x20 -#define CFGC_PHY0 0x10 -#define CFGC_BTSEL 0x08 -#define CFGC_BPS2 0x04 /* bootrom select[2] */ -#define CFGC_BPS1 0x02 /* bootrom select[1] */ -#define CFGC_BPS0 0x01 /* bootrom select[0] */ - -/* - * Bits in the CFGD register - */ - -#define CFGD_GPIOEN 0x80 -#define CFGD_DIAG 0x40 -#define CFGD_MAGIC 0x10 -#define CFGD_CFDX 0x04 -#define CFGD_CEREN 0x02 -#define CFGD_CETEN 0x01 - -/* Bits in RSR */ -#define RSR_RERR 0x00000001 -#define RSR_CRC 0x00000002 -#define RSR_FAE 0x00000004 -#define RSR_FOV 0x00000008 -#define RSR_LONG 0x00000010 -#define RSR_RUNT 0x00000020 -#define RSR_SERR 0x00000040 -#define RSR_BUFF 0x00000080 -#define RSR_EDP 0x00000100 -#define RSR_STP 0x00000200 -#define RSR_CHN 0x00000400 -#define RSR_PHY 0x00000800 -#define RSR_BAR 0x00001000 -#define RSR_MAR 0x00002000 -#define RSR_RXOK 0x00008000 -#define RSR_ABNORMAL RSR_RERR+RSR_LONG+RSR_RUNT - -/* Bits in TSR */ -#define TSR_NCR0 0x00000001 -#define TSR_NCR1 0x00000002 -#define TSR_NCR2 0x00000004 -#define TSR_NCR3 0x00000008 -#define TSR_COLS 0x00000010 -#define TSR_CDH 0x00000080 -#define TSR_ABT 0x00000100 -#define TSR_OWC 0x00000200 -#define TSR_CRS 0x00000400 -#define TSR_UDF 0x00000800 -#define TSR_TBUFF 0x00001000 -#define TSR_SERR 0x00002000 -#define TSR_JAB 0x00004000 -#define TSR_TERR 0x00008000 -#define TSR_ABNORMAL TSR_TERR+TSR_OWC+TSR_ABT+TSR_JAB+TSR_CRS -#define TSR_OWN_BIT 0x80000000 - -#define CB_DELAY_LOOP_WAIT 10 /* 10ms */ -/* enabled mask value of irq */ - -#define W_IMR_MASK_VALUE 0x1BFF /* initial value of IMR */ - -/* Ethernet address filter type */ -#define PKT_TYPE_DIRECTED 0x0001 /* obsolete, directed address is always accepted */ -#define PKT_TYPE_MULTICAST 0x0002 -#define PKT_TYPE_ALL_MULTICAST 0x0004 -#define PKT_TYPE_BROADCAST 0x0008 -#define PKT_TYPE_PROMISCUOUS 0x0020 -#define PKT_TYPE_LONG 0x2000 -#define PKT_TYPE_RUNT 0x4000 -#define PKT_TYPE_ERROR 0x8000 /* accept error packets, e.g. CRC error */ - -/* Loopback mode */ - -#define NIC_LB_NONE 0x00 -#define NIC_LB_INTERNAL 0x01 -#define NIC_LB_PHY 0x02 /* MII or Internal-10BaseT loopback */ - -#define TX_RING_SIZE 2 -#define RX_RING_SIZE 2 -#define PKT_BUF_SZ 1536 /* Size of each temporary Rx buffer. */ - -/* Transmit and receive descriptors definition */ - -struct rhine_tx_desc -{ - union VTC_tx_status_tag - { - struct - { - unsigned long ncro:1; - unsigned long ncr1:1; - unsigned long ncr2:1; - unsigned long ncr3:1; - unsigned long cols:1; - unsigned long reserve_1:2; - unsigned long cdh:1; - unsigned long abt:1; - unsigned long owc:1; - unsigned long crs:1; - unsigned long udf:1; - unsigned long tbuff:1; - unsigned long serr:1; - unsigned long jab:1; - unsigned long terr:1; - unsigned long reserve_2:15; - unsigned long own_bit:1; - } - bits; - unsigned long lw; - } - tx_status; - - union VTC_tx_ctrl_tag - { - struct - { - unsigned long tx_buf_size:11; - unsigned long extend_tx_buf_size:4; - unsigned long chn:1; - unsigned long crc:1; - unsigned long reserve_1:4; - unsigned long stp:1; - unsigned long edp:1; - unsigned long ic:1; - unsigned long reserve_2:8; - } - bits; - unsigned long lw; - } - tx_ctrl; - - unsigned long buf_addr_1:32; - unsigned long buf_addr_2:32; - -}; - -struct rhine_rx_desc -{ - union VTC_rx_status_tag - { - struct - { - unsigned long rerr:1; - unsigned long crc_error:1; - unsigned long fae:1; - unsigned long fov:1; - unsigned long toolong:1; - unsigned long runt:1; - unsigned long serr:1; - unsigned long buff:1; - unsigned long edp:1; - unsigned long stp:1; - unsigned long chn:1; - unsigned long phy:1; - unsigned long bar:1; - unsigned long mar:1; - unsigned long reserve_1:1; - unsigned long rxok:1; - unsigned long frame_length:11; - unsigned long reverve_2:4; - unsigned long own_bit:1; - } - bits; - unsigned long lw; - } - rx_status; - - union VTC_rx_ctrl_tag - { - struct - { - unsigned long rx_buf_size:11; - unsigned long extend_rx_buf_size:4; - unsigned long reserved_1:17; - } - bits; - unsigned long lw; - } - rx_ctrl; - - unsigned long buf_addr_1:32; - unsigned long buf_addr_2:32; - -}; - - -/* The I/O extent. */ -#define rhine_TOTAL_SIZE 0x80 - -#ifdef HAVE_DEVLIST -struct netdev_entry rhine_drv = - { "rhine", rhine_probe, rhine_TOTAL_SIZE, NULL }; -#endif - -static int rhine_debug = 1; - -/* - Theory of Operation - -I. Board Compatibility - -This driver is designed for the VIA 86c100A Rhine-II PCI Fast Ethernet -controller. - -II. Board-specific settings - -Boards with this chip are functional only in a bus-master PCI slot. - -Many operational settings are loaded from the EEPROM to the Config word at -offset 0x78. This driver assumes that they are correct. -If this driver is compiled to use PCI memory space operations the EEPROM -must be configured to enable memory ops. - -III. Driver operation - -IIIa. Ring buffers - -This driver uses two statically allocated fixed-size descriptor lists -formed into rings by a branch from the final descriptor to the beginning of -the list. The ring sizes are set at compile time by RX/TX_RING_SIZE. - -IIIb/c. Transmit/Receive Structure - -This driver attempts to use a zero-copy receive and transmit scheme. - -Alas, all data buffers are required to start on a 32 bit boundary, so -the driver must often copy transmit packets into bounce buffers. - -The driver allocates full frame size skbuffs for the Rx ring buffers at -open() time and passes the skb->data field to the chip as receive data -buffers. When an incoming frame is less than RX_COPYBREAK bytes long, -a fresh skbuff is allocated and the frame is copied to the new skbuff. -When the incoming frame is larger, the skbuff is passed directly up the -protocol stack. Buffers consumed this way are replaced by newly allocated -skbuffs in the last phase of netdev_rx(). - -The RX_COPYBREAK value is chosen to trade-off the memory wasted by -using a full-sized skbuff for small frames vs. the copying costs of larger -frames. New boards are typically used in generously configured machines -and the underfilled buffers have negligible impact compared to the benefit of -a single allocation size, so the default value of zero results in never -copying packets. When copying is done, the cost is usually mitigated by using -a combined copy/checksum routine. Copying also preloads the cache, which is -most useful with small frames. - -Since the VIA chips are only able to transfer data to buffers on 32 bit -boundaries, the the IP header at offset 14 in an ethernet frame isn't -longword aligned for further processing. Copying these unaligned buffers -has the beneficial effect of 16-byte aligning the IP header. - -IIId. Synchronization - -The driver runs as two independent, single-threaded flows of control. One -is the send-packet routine, which enforces single-threaded use by the -dev->tbusy flag. The other thread is the interrupt handler, which is single -threaded by the hardware and interrupt handling software. - -The send packet thread has partial control over the Tx ring and 'dev->tbusy' -flag. It sets the tbusy flag whenever it's queuing a Tx packet. If the next -queue slot is empty, it clears the tbusy flag when finished otherwise it sets -the 'lp->tx_full' flag. - -The interrupt handler has exclusive control over the Rx ring and records stats -from the Tx ring. After reaping the stats, it marks the Tx queue entry as -empty by incrementing the dirty_tx mark. Iff the 'lp->tx_full' flag is set, it -clears both the tx_full and tbusy flags. - -IV. Notes - -IVb. References - -Preliminary VT86C100A manual from http://www.via.com.tw/ -http://cesdis.gsfc.nasa.gov/linux/misc/100mbps.html -http://cesdis.gsfc.nasa.gov/linux/misc/NWay.html - -IVc. Errata - -The VT86C100A manual is not reliable information. -The chip does not handle unaligned transmit or receive buffers, resulting -in significant performance degradation for bounce buffer copies on transmit -and unaligned IP headers on receive. -The chip does not pad to minimum transmit length. - -*/ - -/* The rest of these values should never change. */ -#define NUM_TX_DESC 2 /* Number of Tx descriptor registers. */ - -static struct rhine_private -{ - char devname[8]; /* Used only for kernel debugging. */ - const char *product_name; - struct rhine_rx_desc *rx_ring; - struct rhine_tx_desc *tx_ring; - char *rx_buffs[RX_RING_SIZE]; - char *tx_buffs[TX_RING_SIZE]; - - /* temporary Rx buffers. */ - - int chip_id; - int chip_revision; - unsigned short ioaddr; - unsigned int cur_rx, cur_tx; /* The next free and used entries */ - unsigned int dirty_rx, dirty_tx; - /* The saved address of a sent-in-place packet/buffer, for skfree(). */ - struct sk_buff *tx_skbuff[TX_RING_SIZE]; - unsigned char mc_filter[8]; /* Current multicast filter. */ - char phys[4]; /* MII device addresses. */ - unsigned int tx_full:1; /* The Tx queue is full. */ - unsigned int full_duplex:1; /* Full-duplex operation requested. */ - unsigned int default_port:4; /* Last dev->if_port value. */ - unsigned int media2:4; /* Secondary monitored media port. */ - unsigned int medialock:1; /* Don't sense media type. */ - unsigned int mediasense:1; /* Media sensing in progress. */ -} -rhine; - -static void rhine_probe1 (struct nic *nic, int ioaddr, - int chip_id, int options); -static int QueryAuto (int); -static int ReadMII (int byMIIIndex, int); -static void WriteMII (char, char, char, int); -static void MIIDelay (void); -static void rhine_init_ring (struct nic *dev); -static void rhine_disable (struct dev *dev); -static void rhine_reset (struct nic *nic); -static int rhine_poll (struct nic *nic, int retreive); -static void rhine_transmit (struct nic *nic, const char *d, unsigned int t, - unsigned int s, const char *p); - -/* Initialize the Rx and Tx rings, along with various 'dev' bits. */ -static void -rhine_init_ring (struct nic *nic) -{ - struct rhine_private *tp = (struct rhine_private *) nic->priv_data; - int i; - - tp->tx_full = 0; - tp->cur_rx = tp->cur_tx = 0; - tp->dirty_rx = tp->dirty_tx = 0; - - for (i = 0; i < RX_RING_SIZE; i++) - { - - tp->rx_ring[i].rx_status.bits.own_bit = 1; - tp->rx_ring[i].rx_ctrl.bits.rx_buf_size = 1536; - - tp->rx_ring[i].buf_addr_1 = virt_to_bus (tp->rx_buffs[i]); - tp->rx_ring[i].buf_addr_2 = virt_to_bus (&tp->rx_ring[i + 1]); - /* printf("[%d]buf1=%hX,buf2=%hX",i,tp->rx_ring[i].buf_addr_1,tp->rx_ring[i].buf_addr_2); */ - } - /* Mark the last entry as wrapping the ring. */ - /* tp->rx_ring[i-1].rx_ctrl.bits.rx_buf_size =1518; */ - tp->rx_ring[i - 1].buf_addr_2 = virt_to_bus (&tp->rx_ring[0]); - /*printf("[%d]buf1=%hX,buf2=%hX",i-1,tp->rx_ring[i-1].buf_addr_1,tp->rx_ring[i-1].buf_addr_2); */ - - /* The Tx buffer descriptor is filled in as needed, but we - do need to clear the ownership bit. */ - - for (i = 0; i < TX_RING_SIZE; i++) - { - - tp->tx_ring[i].tx_status.lw = 0; - tp->tx_ring[i].tx_ctrl.lw = 0x00e08000; - tp->tx_ring[i].buf_addr_1 = virt_to_bus (tp->tx_buffs[i]); - tp->tx_ring[i].buf_addr_2 = virt_to_bus (&tp->tx_ring[i + 1]); - /* printf("[%d]buf1=%hX,buf2=%hX",i,tp->tx_ring[i].buf_addr_1,tp->tx_ring[i].buf_addr_2); */ - } - - tp->tx_ring[i - 1].buf_addr_2 = virt_to_bus (&tp->tx_ring[0]); - /* printf("[%d]buf1=%hX,buf2=%hX",i,tp->tx_ring[i-1].buf_addr_1,tp->tx_ring[i-1].buf_addr_2); */ -} - -int -QueryAuto (int ioaddr) -{ - int byMIIIndex; - int MIIReturn; - - int advertising,mii_reg5; - int negociated; - - byMIIIndex = 0x04; - MIIReturn = ReadMII (byMIIIndex, ioaddr); - advertising=MIIReturn; - - byMIIIndex = 0x05; - MIIReturn = ReadMII (byMIIIndex, ioaddr); - mii_reg5=MIIReturn; - - negociated=mii_reg5 & advertising; - - if ( (negociated & 0x100) || (negociated & 0x1C0) == 0x40 ) - return 1; - else - return 0; - -} - -int -ReadMII (int byMIIIndex, int ioaddr) -{ - int ReturnMII; - char byMIIAdrbak; - char byMIICRbak; - char byMIItemp; - - byMIIAdrbak = inb (byMIIAD); - byMIICRbak = inb (byMIICR); - outb (byMIICRbak & 0x7f, byMIICR); - MIIDelay (); - - outb (byMIIIndex, byMIIAD); - MIIDelay (); - - outb (inb (byMIICR) | 0x40, byMIICR); - - byMIItemp = inb (byMIICR); - byMIItemp = byMIItemp & 0x40; - - while (byMIItemp != 0) - { - byMIItemp = inb (byMIICR); - byMIItemp = byMIItemp & 0x40; - } - MIIDelay (); - - ReturnMII = inw (wMIIDATA); - - outb (byMIIAdrbak, byMIIAD); - outb (byMIICRbak, byMIICR); - MIIDelay (); - - return (ReturnMII); - -} - -void -WriteMII (char byMIISetByte, char byMIISetBit, char byMIIOP, int ioaddr) -{ - int ReadMIItmp; - int MIIMask; - char byMIIAdrbak; - char byMIICRbak; - char byMIItemp; - - - byMIIAdrbak = inb (byMIIAD); - - byMIICRbak = inb (byMIICR); - outb (byMIICRbak & 0x7f, byMIICR); - MIIDelay (); - outb (byMIISetByte, byMIIAD); - MIIDelay (); - - outb (inb (byMIICR) | 0x40, byMIICR); - - byMIItemp = inb (byMIICR); - byMIItemp = byMIItemp & 0x40; - - while (byMIItemp != 0) - { - byMIItemp = inb (byMIICR); - byMIItemp = byMIItemp & 0x40; - } - MIIDelay (); - - ReadMIItmp = inw (wMIIDATA); - MIIMask = 0x0001; - MIIMask = MIIMask << byMIISetBit; - - - if (byMIIOP == 0) - { - MIIMask = ~MIIMask; - ReadMIItmp = ReadMIItmp & MIIMask; - } - else - { - ReadMIItmp = ReadMIItmp | MIIMask; - - } - outw (ReadMIItmp, wMIIDATA); - MIIDelay (); - - outb (inb (byMIICR) | 0x20, byMIICR); - byMIItemp = inb (byMIICR); - byMIItemp = byMIItemp & 0x20; - - while (byMIItemp != 0) - { - byMIItemp = inb (byMIICR); - byMIItemp = byMIItemp & 0x20; - } - MIIDelay (); - - outb (byMIIAdrbak & 0x7f, byMIIAD); - outb (byMIICRbak, byMIICR); - MIIDelay (); - -} - -void -MIIDelay (void) -{ - int i; - for (i = 0; i < 0x7fff; i++) - { - inb (0x61); - inb (0x61); - inb (0x61); - inb (0x61); - } -} - -/* Offsets to the device registers. */ -enum register_offsets { - StationAddr=0x00, RxConfig=0x06, TxConfig=0x07, ChipCmd=0x08, - IntrStatus=0x0C, IntrEnable=0x0E, - MulticastFilter0=0x10, MulticastFilter1=0x14, - RxRingPtr=0x18, TxRingPtr=0x1C, GFIFOTest=0x54, - MIIPhyAddr=0x6C, MIIStatus=0x6D, PCIBusConfig=0x6E, - MIICmd=0x70, MIIRegAddr=0x71, MIIData=0x72, MACRegEEcsr=0x74, - ConfigA=0x78, ConfigB=0x79, ConfigC=0x7A, ConfigD=0x7B, - RxMissed=0x7C, RxCRCErrs=0x7E, MiscCmd=0x81, - StickyHW=0x83, IntrStatus2=0x84, WOLcrClr=0xA4, WOLcgClr=0xA7, - PwrcsrClr=0xAC, -}; - -/* Bits in the interrupt status/mask registers. */ -enum intr_status_bits { - IntrRxDone=0x0001, IntrRxErr=0x0004, IntrRxEmpty=0x0020, - IntrTxDone=0x0002, IntrTxError=0x0008, IntrTxUnderrun=0x0210, - IntrPCIErr=0x0040, - IntrStatsMax=0x0080, IntrRxEarly=0x0100, - IntrRxOverflow=0x0400, IntrRxDropped=0x0800, IntrRxNoBuf=0x1000, - IntrTxAborted=0x2000, IntrLinkChange=0x4000, - IntrRxWakeUp=0x8000, - IntrNormalSummary=0x0003, IntrAbnormalSummary=0xC260, - IntrTxDescRace=0x080000, /* mapped from IntrStatus2 */ - IntrTxErrSummary=0x082218, -}; -#define DEFAULT_INTR (IntrRxDone | IntrRxErr | IntrRxEmpty| IntrRxOverflow | \ - IntrRxDropped | IntrRxNoBuf) - -/*************************************************************************** - IRQ - PXE IRQ Handler -***************************************************************************/ -void rhine_irq ( struct nic *nic, irq_action_t action ) { - struct rhine_private *tp = (struct rhine_private *) nic->priv_data; - /* Enable interrupts by setting the interrupt mask. */ - unsigned int intr_status; - - switch ( action ) { - case DISABLE : - case ENABLE : - intr_status = inw(nic->ioaddr + IntrStatus); - /* On Rhine-II, Bit 3 indicates Tx descriptor write-back race. */ - if (tp->chip_id == 0x3065) - intr_status |= inb(nic->ioaddr + IntrStatus2) << 16; - intr_status = (intr_status & ~DEFAULT_INTR); - if ( action == ENABLE ) - intr_status = intr_status | DEFAULT_INTR; - outw(intr_status, nic->ioaddr + IntrEnable); - break; - case FORCE : - outw(0x0010, nic->ioaddr + 0x84); - break; - } -} - -static int -rhine_probe (struct dev *dev, struct pci_device *pci) -{ - struct nic *nic = (struct nic *)dev; - struct rhine_private *tp = &rhine; - if (!pci->ioaddr) - return 0; - rhine_probe1 (nic, pci->ioaddr, pci->dev_id, -1); - - adjust_pci_device(pci); - rhine_reset (nic); - - dev->disable = rhine_disable; - nic->poll = rhine_poll; - nic->transmit = rhine_transmit; - nic->irqno = pci->irq; - nic->irq = rhine_irq; - nic->ioaddr = tp->ioaddr; - - - return 1; -} - -static void set_rx_mode(struct nic *nic __unused) { - struct rhine_private *tp = (struct rhine_private *) nic->priv_data; - unsigned char rx_mode; - int ioaddr = tp->ioaddr; - - /* ! IFF_PROMISC */ - outl(0xffffffff, byMAR0); - outl(0xffffffff, byMAR4); - rx_mode = 0x0C; - - outb(0x60 /* thresh */ | rx_mode, byRCR ); -} - -static void -rhine_probe1 (struct nic *nic, int ioaddr, int chip_id, int options) -{ - struct rhine_private *tp; - static int did_version = 0; /* Already printed version info. */ - int i; - unsigned int timeout; - int FDXFlag; - int byMIIvalue, LineSpeed, MIICRbak; - - if (rhine_debug > 0 && did_version++ == 0) - printf (version); - - /* D-Link provided reset code (with comment additions) */ - if((chip_id != 0x3043) && (chip_id != 0x6100)) { - unsigned char byOrgValue; - - if(rhine_debug > 0) - printf("Enabling Sticky Bit Workaround for Chip_id: 0x%hX\n" - , chip_id); - /* clear sticky bit before reset & read ethernet address */ - byOrgValue = inb(bySTICKHW); - byOrgValue = byOrgValue & 0xFC; - outb(byOrgValue, bySTICKHW); - - /* (bits written are cleared?) */ - /* disable force PME-enable */ - outb(0x80, byWOLcgClr); - /* disable power-event config bit */ - outb(0xFF, byWOLcrClr); - /* clear power status (undocumented in vt6102 docs?) */ - outb(0xFF, byPwrcsrClr); - - } - - /* Perhaps this should be read from the EEPROM? */ - for (i = 0; i < ETH_ALEN; i++) - nic->node_addr[i] = inb (byPAR0 + i); - printf ("IO address %hX Ethernet Address: %!\n", ioaddr, nic->node_addr); - - /* restart MII auto-negotiation */ - WriteMII (0, 9, 1, ioaddr); - printf ("Analyzing Media type,this will take several seconds........"); - for (i = 0; i < 5; i++) - { - /* need to wait 1 millisecond - we will round it up to 50-100ms */ - timeout = currticks() + 2; - for (timeout = currticks() + 2; currticks() < timeout;) - /* nothing */; - if (ReadMII (1, ioaddr) & 0x0020) - break; - } - printf ("OK\n"); - -#if 0 - /* JJM : for Debug */ - printf("MII : Address %hhX ",inb(ioaddr+0x6c)); - { - unsigned char st1,st2,adv1,adv2,l1,l2; - - st1=ReadMII(1,ioaddr)>>8; - st2=ReadMII(1,ioaddr)&0xFF; - adv1=ReadMII(4,ioaddr)>>8; - adv2=ReadMII(4,ioaddr)&0xFF; - l1=ReadMII(5,ioaddr)>>8; - l2=ReadMII(5,ioaddr)&0xFF; - printf(" status 0x%hhX%hhX, advertising 0x%hhX%hhX, link 0x%hhX%hhX\n", st1,st2,adv1,adv2,l1,l2); - } -#endif - - - /* query MII to know LineSpeed,duplex mode */ - byMIIvalue = inb (ioaddr + 0x6d); - LineSpeed = byMIIvalue & MIISR_SPEED; - if (LineSpeed != 0) //JJM - { - printf ("Linespeed=10Mbs"); - } - else - { - printf ("Linespeed=100Mbs"); - } - - FDXFlag = QueryAuto (ioaddr); - if (FDXFlag == 1) - { - printf (" Fullduplex\n"); - outw (CR_FDX, byCR0); - } - else - { - printf (" Halfduplex\n"); - } - - - /* set MII 10 FULL ON */ - WriteMII (17, 1, 1, ioaddr); - - /* turn on MII link change */ - MIICRbak = inb (byMIICR); - outb (MIICRbak & 0x7F, byMIICR); - MIIDelay (); - outb (0x41, byMIIAD); - MIIDelay (); - - /* while((inb(byMIIAD)&0x20)==0) ; */ - outb (MIICRbak | 0x80, byMIICR); - - nic->priv_data = &rhine; - tp = &rhine; - tp->chip_id = chip_id; - tp->ioaddr = ioaddr; - tp->phys[0] = -1; - - /* The lower four bits are the media type. */ - if (options > 0) - { - tp->full_duplex = (options & 16) ? 1 : 0; - tp->default_port = options & 15; - if (tp->default_port) - tp->medialock = 1; - } - return; -} - -static void -rhine_disable (struct dev *dev) -{ - struct nic *nic = (struct nic *)dev; - struct rhine_private *tp = (struct rhine_private *) nic->priv_data; - int ioaddr = tp->ioaddr; - - /* merge reset and disable */ - rhine_reset(nic); - - printf ("rhine disable\n"); - /* Switch to loopback mode to avoid hardware races. */ - writeb(0x60 | 0x01, byTCR); - /* Stop the chip's Tx and Rx processes. */ - writew(CR_STOP, byCR0); -} - -/************************************************************************** -ETH_RESET - Reset adapter -***************************************************************************/ -static void -rhine_reset (struct nic *nic) -{ - struct rhine_private *tp = (struct rhine_private *) nic->priv_data; - int ioaddr = tp->ioaddr; - int i, j; - int FDXFlag, CRbak; - int rx_ring_tmp, rx_ring_tmp1; - int tx_ring_tmp, tx_ring_tmp1; - int rx_bufs_tmp, rx_bufs_tmp1; - int tx_bufs_tmp, tx_bufs_tmp1; - - static char buf1[RX_RING_SIZE * PKT_BUF_SZ + 32]; - static char buf2[RX_RING_SIZE * PKT_BUF_SZ + 32]; - static char desc1[TX_RING_SIZE * sizeof (struct rhine_tx_desc) + 32]; - static char desc2[TX_RING_SIZE * sizeof (struct rhine_tx_desc) + 32]; - - /* printf ("rhine_reset\n"); */ - /* Soft reset the chip. */ - /*outb(CmdReset, ioaddr + ChipCmd); */ - - tx_bufs_tmp = (int) buf1; - tx_ring_tmp = (int) desc1; - rx_bufs_tmp = (int) buf2; - rx_ring_tmp = (int) desc2; - - /* tune RD TD 32 byte alignment */ - rx_ring_tmp1 = (int) virt_to_bus ((char *) rx_ring_tmp); - j = (rx_ring_tmp1 + 32) & (~0x1f); - /* printf ("txring[%d]", j); */ - tp->rx_ring = (struct rhine_rx_desc *) bus_to_virt (j); - - tx_ring_tmp1 = (int) virt_to_bus ((char *) tx_ring_tmp); - j = (tx_ring_tmp1 + 32) & (~0x1f); - tp->tx_ring = (struct rhine_tx_desc *) bus_to_virt (j); - /* printf ("rxring[%X]", j); */ - - - tx_bufs_tmp1 = (int) virt_to_bus ((char *) tx_bufs_tmp); - j = (int) (tx_bufs_tmp1 + 32) & (~0x1f); - tx_bufs_tmp = (int) bus_to_virt (j); - /* printf ("txb[%X]", j); */ - - rx_bufs_tmp1 = (int) virt_to_bus ((char *) rx_bufs_tmp); - j = (int) (rx_bufs_tmp1 + 32) & (~0x1f); - rx_bufs_tmp = (int) bus_to_virt (j); - /* printf ("rxb[%X][%X]", rx_bufs_tmp1, j); */ - - for (i = 0; i < RX_RING_SIZE; i++) - { - tp->rx_buffs[i] = (char *) rx_bufs_tmp; - /* printf("r[%X]",tp->rx_buffs[i]); */ - rx_bufs_tmp += 1536; - } - - for (i = 0; i < TX_RING_SIZE; i++) - { - tp->tx_buffs[i] = (char *) tx_bufs_tmp; - /* printf("t[%X]",tp->tx_buffs[i]); */ - tx_bufs_tmp += 1536; - } - - /* software reset */ - outb (CR1_SFRST, byCR1); - MIIDelay (); - - /* printf ("init ring"); */ - rhine_init_ring (nic); - /*write TD RD Descriptor to MAC */ - outl (virt_to_bus (tp->rx_ring), dwCurrentRxDescAddr); - outl (virt_to_bus (tp->tx_ring), dwCurrentTxDescAddr); - - /* Setup Multicast */ - set_rx_mode(nic); - - /* close IMR */ - outw (0x0000, byIMR0); - - /* set TCR RCR threshold */ - outb (0x06, byBCR0); - outb (0x00, byBCR1); - outb (0x2c, byRCR); - outb (0x60, byTCR); - /* Set Fulldupex */ - FDXFlag = QueryAuto (ioaddr); - if (FDXFlag == 1) - { - outb (CFGD_CFDX, byCFGD); - outw (CR_FDX, byCR0); - } - - /* KICK NIC to WORK */ - CRbak = inw (byCR0); - CRbak = CRbak & 0xFFFB; /* not CR_STOP */ - outw ((CRbak | CR_STRT | CR_TXON | CR_RXON | CR_DPOLL), byCR0); - - /*set IMR to work */ - outw (IMRShadow, byIMR0); -} -/* Beware of PCI posted writes */ -#define IOSYNC do { readb(nic->ioaddr + StationAddr); } while (0) - -static int -rhine_poll (struct nic *nic, int retreive) -{ - struct rhine_private *tp = (struct rhine_private *) nic->priv_data; - int rxstatus, good = 0;; - - if (tp->rx_ring[tp->cur_rx].rx_status.bits.own_bit == 0) - { - unsigned int intr_status; - /* There is a packet ready */ - if(!retreive) - return 1; - - intr_status = inw(nic->ioaddr + IntrStatus); - /* On Rhine-II, Bit 3 indicates Tx descriptor write-back race. */ -#if 0 - if (tp->chip_id == 0x3065) - intr_status |= inb(nic->ioaddr + IntrStatus2) << 16; -#endif - /* Acknowledge all of the current interrupt sources ASAP. */ - if (intr_status & IntrTxDescRace) - outb(0x08, nic->ioaddr + IntrStatus2); - outw(intr_status & 0xffff, nic->ioaddr + IntrStatus); - IOSYNC; - - rxstatus = tp->rx_ring[tp->cur_rx].rx_status.lw; - if ((rxstatus & 0x0300) != 0x0300) - { - printf("rhine_poll: bad status\n"); - } - else if (rxstatus & (RSR_ABNORMAL)) - { - printf ("rxerr[%X]\n", rxstatus); - } - else - good = 1; - - if (good) - { - nic->packetlen = tp->rx_ring[tp->cur_rx].rx_status.bits.frame_length; - memcpy (nic->packet, tp->rx_buffs[tp->cur_rx], nic->packetlen); - /* printf ("Packet RXed\n"); */ - } - tp->rx_ring[tp->cur_rx].rx_status.bits.own_bit = 1; - tp->cur_rx++; - tp->cur_rx = tp->cur_rx % RX_RING_SIZE; - } - /* Acknowledge all of the current interrupt sources ASAP. */ - outw(DEFAULT_INTR & ~IntrRxDone, nic->ioaddr + IntrStatus); - - IOSYNC; - - return good; -} - -static void -rhine_transmit (struct nic *nic, - const char *d, unsigned int t, unsigned int s, const char *p) -{ - struct rhine_private *tp = (struct rhine_private *) nic->priv_data; - int ioaddr = tp->ioaddr; - int entry; - unsigned char CR1bak; - - /*printf ("rhine_transmit\n"); */ - /* setup ethernet header */ - - - /* Calculate the next Tx descriptor entry. */ - entry = tp->cur_tx % TX_RING_SIZE; - - memcpy (tp->tx_buffs[entry], d, ETH_ALEN); /* dst */ - memcpy (tp->tx_buffs[entry] + ETH_ALEN, nic->node_addr, ETH_ALEN); /* src */ - *((char *) tp->tx_buffs[entry] + 12) = t >> 8; /* type */ - *((char *) tp->tx_buffs[entry] + 13) = t; - memcpy (tp->tx_buffs[entry] + ETH_HLEN, p, s); - s += ETH_HLEN; - while (s < ETH_ZLEN) - *((char *) tp->tx_buffs[entry] + ETH_HLEN + (s++)) = 0; - - tp->tx_ring[entry].tx_ctrl.bits.tx_buf_size = s; - - tp->tx_ring[entry].tx_status.bits.own_bit = 1; - - - CR1bak = inb (byCR1); - - CR1bak = CR1bak | CR1_TDMD1; - /*printf("tdsw=[%X]",tp->tx_ring[entry].tx_status.lw); */ - /*printf("tdcw=[%X]",tp->tx_ring[entry].tx_ctrl.lw); */ - /*printf("tdbuf1=[%X]",tp->tx_ring[entry].buf_addr_1); */ - /*printf("tdbuf2=[%X]",tp->tx_ring[entry].buf_addr_2); */ - /*printf("td1=[%X]",inl(dwCurrentTDSE0)); */ - /*printf("td2=[%X]",inl(dwCurrentTDSE1)); */ - /*printf("td3=[%X]",inl(dwCurrentTDSE2)); */ - /*printf("td4=[%X]",inl(dwCurrentTDSE3)); */ - - outb (CR1bak, byCR1); - /* Wait until transmit is finished */ - while (tp->tx_ring[entry].tx_status.bits.own_bit != 0) - ; - tp->cur_tx++; - - /*outw(IMRShadow,byIMR0); */ - /*dev_kfree_skb(tp->tx_skbuff[entry], FREE_WRITE); */ - /*tp->tx_skbuff[entry] = 0; */ -} - -static struct pci_id rhine_nics[] = { -PCI_ROM(0x1106, 0x3065, "dlink-530tx", "VIA 6102"), -PCI_ROM(0x1106, 0x3106, "via-rhine-6105", "VIA 6105"), -PCI_ROM(0x1106, 0x3043, "dlink-530tx-old", "VIA 3043"), /* Rhine-I 86c100a */ -PCI_ROM(0x1106, 0x3053, "via6105m", "VIA 6105M"), -PCI_ROM(0x1106, 0x6100, "via-rhine-old", "VIA 86C100A"), /* Rhine-II */ -}; - -struct pci_driver rhine_driver = { - .type = NIC_DRIVER, - .name = "VIA 86C100", - .probe = rhine_probe, - .ids = rhine_nics, - .id_count = sizeof(rhine_nics)/sizeof(rhine_nics[0]), - .class = 0, -}; - -/* EOF via-rhine.c */ diff --git a/usr/src/grub/grub-0.95/netboot/w89c840.c b/usr/src/grub/grub-0.95/netboot/w89c840.c deleted file mode 100644 index fa31bc957b..0000000000 --- a/usr/src/grub/grub-0.95/netboot/w89c840.c +++ /dev/null @@ -1,955 +0,0 @@ -/* - * Etherboot - BOOTP/TFTP Bootstrap Program - * - * w89c840.c -- This file implements the winbond-840 driver for etherboot. - * - */ - -/* - * Adapted by Igor V. Kovalenko - * -- - * OR - * -- - * Initial adaptaion stage, including testing, completed 23 August 2000. - */ - -/* - * 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. - * - * 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. - */ - -/* - * date version by what - * Written: Aug 20 2000 V0.10 iko Initial revision. - * changes: Aug 22 2000 V0.90 iko Works! - * Aug 23 2000 V0.91 iko Cleanup, posted to etherboot - * maintainer. - * Aug 26 2000 V0.92 iko Fixed Rx ring handling. - * First Linux Kernel (TM) - * successfully loaded using - * this driver. - * Jan 07 2001 V0.93 iko Transmitter timeouts are handled - * using timer2 routines. Proposed - * by Ken Yap to eliminate CPU speed - * dependency. - * Dec 12 2003 V0.94 timlegge Fixed issues in 5.2, removed - * interrupt usage, enabled - * multicast support - * - * This is the etherboot driver for cards based on Winbond W89c840F chip. - * - * It was written from skeleton source, with Donald Becker's winbond-840.c - * kernel driver as a guideline. Mostly the w89c840 related definitions - * and the lower level routines have been cut-and-pasted into this source. - * - * Frankly speaking, about 90% of the code was obtained using cut'n'paste - * sequence :) while the remainder appeared while brainstorming - * Linux Kernel 2.4.0-testX source code. Thanks, Donald and Linus! - * - * There was a demand for using this card in a rather large - * remote boot environment at MSKP OVTI Lab of - * Moscow Institute for Physics and Technology (MIPT) -- http://www.mipt.ru/ - * so you may count that for motivation. - * - */ - -/* - * If you want to see debugging output then define W89C840_DEBUG - */ - -/* -#define W89C840_DEBUG -*/ - -/* - * Keep using IO_OPS for Etherboot driver! - */ -#define USE_IO_OPS - -#include "etherboot.h" -#include "nic.h" -#include "pci.h" -#include "timer.h" - -static const char *w89c840_version = "driver Version 0.94 - December 12, 2003"; - -typedef unsigned char u8; -typedef signed char s8; -typedef unsigned short u16; -typedef signed short s16; -typedef unsigned int u32; -typedef signed int s32; - -/* Linux support functions */ -#define virt_to_le32desc(addr) virt_to_bus(addr) -#define le32desc_to_virt(addr) bus_to_virt(addr) - -/* -#define cpu_to_le32(val) (val) -#define le32_to_cpu(val) (val) -*/ - -/* Operational parameters that are set at compile time. */ - -/* Keep the ring sizes a power of two for compile efficiency. - The compiler will convert '%'<2^N> into a bit mask. - Making the Tx ring too large decreases the effectiveness of channel - bonding and packet priority. - There are no ill effects from too-large receive rings. */ -#define TX_RING_SIZE 2 -#define RX_RING_SIZE 2 - -/* The presumed FIFO size for working around the Tx-FIFO-overflow bug. - To avoid overflowing we don't queue again until we have room for a - full-size packet. - */ -#define TX_FIFO_SIZE (2048) -#define TX_BUG_FIFO_LIMIT (TX_FIFO_SIZE-1514-16) - -/* Operational parameters that usually are not changed. */ -/* Time in jiffies before concluding the transmitter is hung. */ -#define TX_TIMEOUT (10*TICKS_PER_MS) - -#define PKT_BUF_SZ 1536 /* Size of each temporary Rx buffer.*/ - -/* - * Used to be this much CPU loops on Celeron@400 (?), - * now using real timer and TX_TIMEOUT! - * #define TX_LOOP_COUNT 10000000 - */ - -#if !defined(__OPTIMIZE__) -#warning You must compile this file with the correct options! -#warning See the last lines of the source file. -#error You must compile this driver with "-O". -#endif - -enum chip_capability_flags {CanHaveMII=1, HasBrokenTx=2}; - -#ifdef USE_IO_OPS -#define W840_FLAGS (PCI_USES_IO | PCI_ADDR0 | PCI_USES_MASTER) -#else -#define W840_FLAGS (PCI_USES_MEM | PCI_ADDR1 | PCI_USES_MASTER) -#endif - -static u32 driver_flags = CanHaveMII | HasBrokenTx; - -/* This driver was written to use PCI memory space, however some x86 systems - work only with I/O space accesses. Pass -DUSE_IO_OPS to use PCI I/O space - accesses instead of memory space. */ - -#ifdef USE_IO_OPS -#undef readb -#undef readw -#undef readl -#undef writeb -#undef writew -#undef writel -#define readb inb -#define readw inw -#define readl inl -#define writeb outb -#define writew outw -#define writel outl -#endif - -/* Offsets to the Command and Status Registers, "CSRs". - While similar to the Tulip, these registers are longword aligned. - Note: It's not useful to define symbolic names for every register bit in - the device. The name can only partially document the semantics and make - the driver longer and more difficult to read. -*/ -enum w840_offsets { - PCIBusCfg=0x00, TxStartDemand=0x04, RxStartDemand=0x08, - RxRingPtr=0x0C, TxRingPtr=0x10, - IntrStatus=0x14, NetworkConfig=0x18, IntrEnable=0x1C, - RxMissed=0x20, EECtrl=0x24, MIICtrl=0x24, BootRom=0x28, GPTimer=0x2C, - CurRxDescAddr=0x30, CurRxBufAddr=0x34, /* Debug use */ - MulticastFilter0=0x38, MulticastFilter1=0x3C, StationAddr=0x40, - CurTxDescAddr=0x4C, CurTxBufAddr=0x50, -}; - -/* Bits in the interrupt status/enable registers. */ -/* The bits in the Intr Status/Enable registers, mostly interrupt sources. */ -enum intr_status_bits { - NormalIntr=0x10000, AbnormalIntr=0x8000, - IntrPCIErr=0x2000, TimerInt=0x800, - IntrRxDied=0x100, RxNoBuf=0x80, IntrRxDone=0x40, - TxFIFOUnderflow=0x20, RxErrIntr=0x10, - TxIdle=0x04, IntrTxStopped=0x02, IntrTxDone=0x01, -}; - -/* Bits in the NetworkConfig register. */ -enum rx_mode_bits { - AcceptErr=0x80, AcceptRunt=0x40, - AcceptBroadcast=0x20, AcceptMulticast=0x10, - AcceptAllPhys=0x08, AcceptMyPhys=0x02, -}; - -enum mii_reg_bits { - MDIO_ShiftClk=0x10000, MDIO_DataIn=0x80000, MDIO_DataOut=0x20000, - MDIO_EnbOutput=0x40000, MDIO_EnbIn = 0x00000, -}; - -/* The Tulip Rx and Tx buffer descriptors. */ -struct w840_rx_desc { - s32 status; - s32 length; - u32 buffer1; - u32 next_desc; -}; - -struct w840_tx_desc { - s32 status; - s32 length; - u32 buffer1, buffer2; /* We use only buffer 1. */ -}; - -/* Bits in network_desc.status */ -enum desc_status_bits { - DescOwn=0x80000000, DescEndRing=0x02000000, DescUseLink=0x01000000, - DescWholePkt=0x60000000, DescStartPkt=0x20000000, DescEndPkt=0x40000000, - DescIntr=0x80000000, -}; -#define PRIV_ALIGN 15 /* Required alignment mask */ -#define PRIV_ALIGN_BYTES 32 - -static struct winbond_private -{ - /* Descriptor rings first for alignment. */ - struct w840_rx_desc rx_ring[RX_RING_SIZE]; - struct w840_tx_desc tx_ring[TX_RING_SIZE]; - struct net_device *next_module; /* Link for devices of this type. */ - void *priv_addr; /* Unaligned address for kfree */ - const char *product_name; - /* Frequently used values: keep some adjacent for cache effect. */ - int chip_id, drv_flags; - struct pci_dev *pci_dev; - int csr6; - struct w840_rx_desc *rx_head_desc; - unsigned int cur_rx, dirty_rx; /* Producer/consumer ring indices */ - unsigned int rx_buf_sz; /* Based on MTU+slack. */ - unsigned int cur_tx, dirty_tx; - int tx_q_bytes; - unsigned int tx_full:1; /* The Tx queue is full. */ - /* These values are keep track of the transceiver/media in use. */ - unsigned int full_duplex:1; /* Full-duplex operation requested. */ - unsigned int duplex_lock:1; - unsigned int medialock:1; /* Do not sense media. */ - unsigned int default_port:4; /* Last dev->if_port value. */ - /* MII transceiver section. */ - int mii_cnt; /* MII device addresses. */ - u16 advertising; /* NWay media advertisement */ - unsigned char phys[2]; /* MII device addresses. */ -} w840private __attribute__ ((aligned (PRIV_ALIGN_BYTES))); - -/* NIC specific static variables go here */ - -static int ioaddr; -static unsigned short eeprom [0x40]; -static char rx_packet[PKT_BUF_SZ * RX_RING_SIZE]; -static char tx_packet[PKT_BUF_SZ * TX_RING_SIZE]; - -static int eeprom_read(long ioaddr, int location); -static int mdio_read(int base_address, int phy_id, int location); -#if 0 -static void mdio_write(int base_address, int phy_id, int location, int value); -#endif - -static void check_duplex(void); -static void set_rx_mode(void); -static void init_ring(void); - -#if defined(W89C840_DEBUG) -static void decode_interrupt(u32 intr_status) -{ - printf("Interrupt status: "); - -#define TRACE_INTR(_intr_) \ - if (intr_status & (_intr_)) { printf (" " #_intr_); } - - TRACE_INTR(NormalIntr); - TRACE_INTR(AbnormalIntr); - TRACE_INTR(IntrPCIErr); - TRACE_INTR(TimerInt); - TRACE_INTR(IntrRxDied); - TRACE_INTR(RxNoBuf); - TRACE_INTR(IntrRxDone); - TRACE_INTR(TxFIFOUnderflow); - TRACE_INTR(RxErrIntr); - TRACE_INTR(TxIdle); - TRACE_INTR(IntrTxStopped); - TRACE_INTR(IntrTxDone); - - printf("\n"); - /*sleep(1);*/ -} -#endif - -/************************************************************************** -w89c840_reset - Reset adapter -***************************************************************************/ -static void w89c840_reset(struct nic *nic) -{ - int i; - - /* Reset the chip to erase previous misconfiguration. - No hold time required! */ - writel(0x00000001, ioaddr + PCIBusCfg); - - init_ring(); - - writel(virt_to_bus(w840private.rx_ring), ioaddr + RxRingPtr); - writel(virt_to_bus(w840private.tx_ring), ioaddr + TxRingPtr); - - for (i = 0; i < ETH_ALEN; i++) - writeb(nic->node_addr[i], ioaddr + StationAddr + i); - - /* Initialize other registers. */ - /* Configure the PCI bus bursts and FIFO thresholds. - 486: Set 8 longword cache alignment, 8 longword burst. - 586: Set 16 longword cache alignment, no burst limit. - Cache alignment bits 15:14 Burst length 13:8 - 0000 0000 align to cache 0800 8 longwords - 4000 8 longwords 0100 1 longword 1000 16 longwords - 8000 16 longwords 0200 2 longwords 2000 32 longwords - C000 32 longwords 0400 4 longwords - Wait the specified 50 PCI cycles after a reset by initializing - Tx and Rx queues and the address filter list. */ - - writel(0xE010, ioaddr + PCIBusCfg); - - writel(0, ioaddr + RxStartDemand); - w840private.csr6 = 0x20022002; - check_duplex(); - set_rx_mode(); - - /* Do not enable the interrupts Etherboot doesn't need them */ -/* - writel(0x1A0F5, ioaddr + IntrStatus); - writel(0x1A0F5, ioaddr + IntrEnable); -*/ -#if defined(W89C840_DEBUG) - printf("winbond-840 : Done reset.\n"); -#endif -} - -#if 0 -static void handle_intr(u32 intr_stat) -{ - if ((intr_stat & (NormalIntr|AbnormalIntr)) == 0) { - /* we are polling, do not return now */ - /*return 0;*/ - } else { - /* Acknowledge all of the current interrupt sources ASAP. */ - writel(intr_stat & 0x001ffff, ioaddr + IntrStatus); - } - - if (intr_stat & AbnormalIntr) { - /* There was an abnormal interrupt */ - printf("\n-=- Abnormal interrupt.\n"); - -#if defined(W89C840_DEBUG) - decode_interrupt(intr_stat); -#endif - - if (intr_stat & RxNoBuf) { - /* There was an interrupt */ - printf("-=- <=> No receive buffers available.\n"); - writel(0, ioaddr + RxStartDemand); - } - } -} -#endif - -/************************************************************************** -w89c840_poll - Wait for a frame -***************************************************************************/ -static int w89c840_poll(struct nic *nic, int retrieve) -{ - /* return true if there's an ethernet packet ready to read */ - /* nic->packet should contain data on return */ - /* nic->packetlen should contain length of data */ - int packet_received = 0; - -#if defined(W89C840_DEBUG) - u32 intr_status = readl(ioaddr + IntrStatus); -#endif - - do { - /* Code from netdev_rx(dev) */ - - int entry = w840private.cur_rx % RX_RING_SIZE; - - struct w840_rx_desc *desc = w840private.rx_head_desc; - s32 status = desc->status; - - if (status & DescOwn) { - /* DescOwn bit is still set, we should wait for RX to complete */ - packet_received = 0; - break; - } - - if ( !retrieve ) { - packet_received = 1; - break; - } - - if ((status & 0x38008300) != 0x0300) { - if ((status & 0x38000300) != 0x0300) { - /* Ingore earlier buffers. */ - if ((status & 0xffff) != 0x7fff) { - printf("winbond-840 : Oversized Ethernet frame spanned " - "multiple buffers, entry %d status %X !\n", - w840private.cur_rx, status); - } - } else if (status & 0x8000) { - /* There was a fatal error. */ -#if defined(W89C840_DEBUG) - printf("winbond-840 : Receive error, Rx status %X :", status); - if (status & 0x0890) { - printf(" RXLEN_ERROR"); - } - if (status & 0x004C) { - printf(", FRAME_ERROR"); - } - if (status & 0x0002) { - printf(", CRC_ERROR"); - } - printf("\n"); -#endif - - /* Simpy do a reset now... */ - w89c840_reset(nic); - - packet_received = 0; - break; - } - } else { - /* Omit the four octet CRC from the length. */ - int pkt_len = ((status >> 16) & 0x7ff) - 4; - -#if defined(W89C840_DEBUG) - printf(" netdev_rx() normal Rx pkt ring %d length %d status %X\n", entry, pkt_len, status); -#endif - - nic->packetlen = pkt_len; - - /* Check if the packet is long enough to accept without copying - to a minimally-sized skbuff. */ - - memcpy(nic->packet, le32desc_to_virt(w840private.rx_ring[entry].buffer1), pkt_len); - packet_received = 1; - - /* Release buffer to NIC */ - w840private.rx_ring[entry].status = DescOwn; - -#if defined(W89C840_DEBUG) - /* You will want this info for the initial debug. */ - printf(" Rx data %hhX:%hhX:%hhX:%hhX:%hhX:" - "%hhX %hhX:%hhX:%hhX:%hhX:%hhX:%hhX %hhX%hhX " - "%hhX.%hhX.%hhX.%hhX.\n", - nic->packet[0], nic->packet[1], nic->packet[2], nic->packet[3], - nic->packet[4], nic->packet[5], nic->packet[6], nic->packet[7], - nic->packet[8], nic->packet[9], nic->packet[10], - nic->packet[11], nic->packet[12], nic->packet[13], - nic->packet[14], nic->packet[15], nic->packet[16], - nic->packet[17]); -#endif - - } - - entry = (++w840private.cur_rx) % RX_RING_SIZE; - w840private.rx_head_desc = &w840private.rx_ring[entry]; - } while (0); - - return packet_received; -} - -/************************************************************************** -w89c840_transmit - Transmit a frame -***************************************************************************/ - -static void w89c840_transmit( - struct nic *nic, - const char *d, /* Destination */ - unsigned int t, /* Type */ - unsigned int s, /* size */ - const char *p) /* Packet */ -{ - /* send the packet to destination */ - unsigned entry; - int transmit_status; - - /* Caution: the write order is important here, set the field - with the "ownership" bits last. */ - - /* Fill in our transmit buffer */ - entry = w840private.cur_tx % TX_RING_SIZE; - - memcpy (tx_packet, d, ETH_ALEN); /* dst */ - memcpy (tx_packet + ETH_ALEN, nic->node_addr, ETH_ALEN);/* src */ - - *((char *) tx_packet + 12) = t >> 8; /* type */ - *((char *) tx_packet + 13) = t; - - memcpy (tx_packet + ETH_HLEN, p, s); - s += ETH_HLEN; - - while (s < ETH_ZLEN) - *((char *) tx_packet + ETH_HLEN + (s++)) = 0; - - w840private.tx_ring[entry].buffer1 = virt_to_le32desc(tx_packet); - - w840private.tx_ring[entry].length = (DescWholePkt | (u32) s); - if (entry >= TX_RING_SIZE-1) /* Wrap ring */ - w840private.tx_ring[entry].length |= (DescIntr | DescEndRing); - w840private.tx_ring[entry].status = (DescOwn); - w840private.cur_tx++; - - w840private.tx_q_bytes = (u16) s; - writel(0, ioaddr + TxStartDemand); - - /* Work around horrible bug in the chip by marking the queue as full - when we do not have FIFO room for a maximum sized packet. */ - - if ((w840private.drv_flags & HasBrokenTx) && w840private.tx_q_bytes > TX_BUG_FIFO_LIMIT) { - /* Actually this is left to help finding error tails later in debugging... - * See Linux kernel driver in winbond-840.c for details. - */ - w840private.tx_full = 1; - } - -#if defined(W89C840_DEBUG) - printf("winbond-840 : Transmit frame # %d size %d queued in slot %d.\n", w840private.cur_tx, s, entry); -#endif - - /* Now wait for TX to complete. */ - transmit_status = w840private.tx_ring[entry].status; - - load_timer2(TX_TIMEOUT); - - { -#if defined W89C840_DEBUG - u32 intr_stat = 0; -#endif - while (1) { - -#if defined(W89C840_DEBUG) - decode_interrupt(intr_stat); -#endif - - while ( (transmit_status & DescOwn) && timer2_running()) { - - transmit_status = w840private.tx_ring[entry].status; - } - - break; - } - } - - if ((transmit_status & DescOwn) == 0) { - -#if defined(W89C840_DEBUG) - printf("winbond-840 : transmission complete after wait loop iterations, status %X\n", - w840private.tx_ring[entry].status); -#endif - - return; - } - - /* Transmit timed out... */ - - printf("winbond-840 : transmission TIMEOUT : status %X\n", w840private.tx_ring[entry].status); - - return; -} - -/************************************************************************** -w89c840_disable - Turn off ethernet interface -***************************************************************************/ -static void w89c840_disable(struct dev *dev) -{ - struct nic *nic = (struct nic *)dev; - /* merge reset and disable */ - w89c840_reset(nic); - - /* Don't know what to do to disable the board. Is this needed at all? */ - /* Yes, a live NIC can corrupt the loaded memory later [Ken] */ - /* Stop the chip's Tx and Rx processes. */ - writel(w840private.csr6 &= ~0x20FA, ioaddr + NetworkConfig); -} - -/************************************************************************** -w89c840_irq - Enable, Disable, or Force interrupts -***************************************************************************/ -static void w89c840_irq(struct nic *nic __unused, irq_action_t action __unused) -{ - switch ( action ) { - case DISABLE : - break; - case ENABLE : - break; - case FORCE : - break; - } -} - -/************************************************************************** -w89c840_probe - Look for an adapter, this routine's visible to the outside -***************************************************************************/ -static int w89c840_probe(struct dev *dev, struct pci_device *p) -{ - struct nic *nic = (struct nic *)dev; - u16 sum = 0; - int i, j; - unsigned short value; - - if (p->ioaddr == 0) - return 0; - - ioaddr = p->ioaddr; - nic->ioaddr = p->ioaddr & ~3; - nic->irqno = 0; - - -#if defined(W89C840_DEBUG) - printf("winbond-840: PCI bus %hhX device function %hhX: I/O address: %hX\n", p->bus, p->devfn, ioaddr); -#endif - - ioaddr = ioaddr & ~3; /* Mask the bit that says "this is an io addr" */ - - /* From Matt Hortman */ - if (p->vendor == PCI_VENDOR_ID_WINBOND2 - && p->dev_id == PCI_DEVICE_ID_WINBOND2_89C840) { - - /* detected "Winbond W89c840 Fast Ethernet PCI NIC" */ - - } else if ( p->vendor == PCI_VENDOR_ID_COMPEX - && p->dev_id == PCI_DEVICE_ID_COMPEX_RL100ATX) { - - /* detected "Compex RL100ATX Fast Ethernet PCI NIC" */ - - } else { - /* Gee, guess what? They missed again. */ - printf("device ID : %X - is not a Compex RL100ATX NIC.\n", p->dev_id); - return 0; - } - - printf(" %s\n", w89c840_version); - - adjust_pci_device(p); - - /* Ok. Got one. Read the eeprom. */ - for (j = 0, i = 0; i < 0x40; i++) { - value = eeprom_read(ioaddr, i); - eeprom[i] = value; - sum += value; - } - - for (i=0;inode_addr[i] = (eeprom[i/2] >> (8*(i&1))) & 0xff; - } - printf ("Ethernet addr: %!\n", nic->node_addr); - -#if defined(W89C840_DEBUG) - printf("winbond-840: EEPROM checksum %hX, got eeprom", sum); -#endif - - /* Reset the chip to erase previous misconfiguration. - No hold time required! */ - writel(0x00000001, ioaddr + PCIBusCfg); - - if (driver_flags & CanHaveMII) { - int phy, phy_idx = 0; - for (phy = 1; phy < 32 && phy_idx < 4; phy++) { - int mii_status = mdio_read(ioaddr, phy, 1); - if (mii_status != 0xffff && mii_status != 0x0000) { - w840private.phys[phy_idx++] = phy; - w840private.advertising = mdio_read(ioaddr, phy, 4); - -#if defined(W89C840_DEBUG) - printf("winbond-840 : MII PHY found at address %d, status " - "%X advertising %hX.\n", phy, mii_status, w840private.advertising); -#endif - - } - } - - w840private.mii_cnt = phy_idx; - - if (phy_idx == 0) { - printf("winbond-840 : MII PHY not found -- this device may not operate correctly.\n"); - } - } - - /* point to NIC specific routines */ - dev->disable = w89c840_disable; - nic->poll = w89c840_poll; - nic->transmit = w89c840_transmit; - nic->irq = w89c840_irq; - - w89c840_reset(nic); - - return 1; -} - -/* Read the EEPROM and MII Management Data I/O (MDIO) interfaces. These are - often serial bit streams generated by the host processor. - The example below is for the common 93c46 EEPROM, 64 16 bit words. */ - -/* Delay between EEPROM clock transitions. - No extra delay is needed with 33Mhz PCI, but future 66Mhz access may need - a delay. Note that pre-2.0.34 kernels had a cache-alignment bug that - made udelay() unreliable. - The old method of using an ISA access as a delay, __SLOW_DOWN_IO__, is - depricated. -*/ -#define eeprom_delay(ee_addr) readl(ee_addr) - -enum EEPROM_Ctrl_Bits { - EE_ShiftClk=0x02, EE_Write0=0x801, EE_Write1=0x805, - EE_ChipSelect=0x801, EE_DataIn=0x08, -}; - -/* The EEPROM commands include the alway-set leading bit. */ -enum EEPROM_Cmds { - EE_WriteCmd=(5 << 6), EE_ReadCmd=(6 << 6), EE_EraseCmd=(7 << 6), -}; - -static int eeprom_read(long addr, int location) -{ - int i; - int retval = 0; - int ee_addr = addr + EECtrl; - int read_cmd = location | EE_ReadCmd; - writel(EE_ChipSelect, ee_addr); - - /* Shift the read command bits out. */ - for (i = 10; i >= 0; i--) { - short dataval = (read_cmd & (1 << i)) ? EE_Write1 : EE_Write0; - writel(dataval, ee_addr); - eeprom_delay(ee_addr); - writel(dataval | EE_ShiftClk, ee_addr); - eeprom_delay(ee_addr); - } - writel(EE_ChipSelect, ee_addr); - - for (i = 16; i > 0; i--) { - writel(EE_ChipSelect | EE_ShiftClk, ee_addr); - eeprom_delay(ee_addr); - retval = (retval << 1) | ((readl(ee_addr) & EE_DataIn) ? 1 : 0); - writel(EE_ChipSelect, ee_addr); - eeprom_delay(ee_addr); - } - - /* Terminate the EEPROM access. */ - writel(0, ee_addr); - return retval; -} - -/* MII transceiver control section. - Read and write the MII registers using software-generated serial - MDIO protocol. See the MII specifications or DP83840A data sheet - for details. - - The maximum data clock rate is 2.5 Mhz. The minimum timing is usually - met by back-to-back 33Mhz PCI cycles. */ -#define mdio_delay(mdio_addr) readl(mdio_addr) - -/* Set iff a MII transceiver on any interface requires mdio preamble. - This only set with older tranceivers, so the extra - code size of a per-interface flag is not worthwhile. */ -static char mii_preamble_required = 1; - -#define MDIO_WRITE0 (MDIO_EnbOutput) -#define MDIO_WRITE1 (MDIO_DataOut | MDIO_EnbOutput) - -/* Generate the preamble required for initial synchronization and - a few older transceivers. */ -static void mdio_sync(long mdio_addr) -{ - int bits = 32; - - /* Establish sync by sending at least 32 logic ones. */ - while (--bits >= 0) { - writel(MDIO_WRITE1, mdio_addr); - mdio_delay(mdio_addr); - writel(MDIO_WRITE1 | MDIO_ShiftClk, mdio_addr); - mdio_delay(mdio_addr); - } -} - -static int mdio_read(int base_address, int phy_id, int location) -{ - long mdio_addr = base_address + MIICtrl; - int mii_cmd = (0xf6 << 10) | (phy_id << 5) | location; - int i, retval = 0; - - if (mii_preamble_required) - mdio_sync(mdio_addr); - - /* Shift the read command bits out. */ - for (i = 15; i >= 0; i--) { - int dataval = (mii_cmd & (1 << i)) ? MDIO_WRITE1 : MDIO_WRITE0; - - writel(dataval, mdio_addr); - mdio_delay(mdio_addr); - writel(dataval | MDIO_ShiftClk, mdio_addr); - mdio_delay(mdio_addr); - } - /* Read the two transition, 16 data, and wire-idle bits. */ - for (i = 20; i > 0; i--) { - writel(MDIO_EnbIn, mdio_addr); - mdio_delay(mdio_addr); - retval = (retval << 1) | ((readl(mdio_addr) & MDIO_DataIn) ? 1 : 0); - writel(MDIO_EnbIn | MDIO_ShiftClk, mdio_addr); - mdio_delay(mdio_addr); - } - return (retval>>1) & 0xffff; -} - -#if 0 -static void mdio_write(int base_address, int phy_id, int location, int value) -{ - long mdio_addr = base_address + MIICtrl; - int mii_cmd = (0x5002 << 16) | (phy_id << 23) | (location<<18) | value; - int i; - - if (location == 4 && phy_id == w840private.phys[0]) - w840private.advertising = value; - - if (mii_preamble_required) - mdio_sync(mdio_addr); - - /* Shift the command bits out. */ - for (i = 31; i >= 0; i--) { - int dataval = (mii_cmd & (1 << i)) ? MDIO_WRITE1 : MDIO_WRITE0; - - writel(dataval, mdio_addr); - mdio_delay(mdio_addr); - writel(dataval | MDIO_ShiftClk, mdio_addr); - mdio_delay(mdio_addr); - } - /* Clear out extra bits. */ - for (i = 2; i > 0; i--) { - writel(MDIO_EnbIn, mdio_addr); - mdio_delay(mdio_addr); - writel(MDIO_EnbIn | MDIO_ShiftClk, mdio_addr); - mdio_delay(mdio_addr); - } - return; -} -#endif - -static void check_duplex(void) -{ - int mii_reg5 = mdio_read(ioaddr, w840private.phys[0], 5); - int negotiated = mii_reg5 & w840private.advertising; - int duplex; - - if (w840private.duplex_lock || mii_reg5 == 0xffff) - return; - - duplex = (negotiated & 0x0100) || (negotiated & 0x01C0) == 0x0040; - if (w840private.full_duplex != duplex) { - w840private.full_duplex = duplex; - -#if defined(W89C840_DEBUG) - printf("winbond-840 : Setting %s-duplex based on MII # %d negotiated capability %X\n", - duplex ? "full" : "half", w840private.phys[0], negotiated); -#endif - - w840private.csr6 &= ~0x200; - w840private.csr6 |= duplex ? 0x200 : 0; - } -} - -static void set_rx_mode(void) -{ - u32 mc_filter[2]; /* Multicast hash filter */ - u32 rx_mode; - - /* Accept all multicasts from now on. */ - memset(mc_filter, 0xff, sizeof(mc_filter)); - -/* - * works OK with multicast enabled. - */ - - rx_mode = AcceptBroadcast | AcceptMyPhys | AcceptMulticast; - - writel(mc_filter[0], ioaddr + MulticastFilter0); - writel(mc_filter[1], ioaddr + MulticastFilter1); - w840private.csr6 &= ~0x00F8; - w840private.csr6 |= rx_mode; - writel(w840private.csr6, ioaddr + NetworkConfig); - -#if defined(W89C840_DEBUG) - printf("winbond-840 : Done setting RX mode.\n"); -#endif -} - -/* Initialize the Rx and Tx rings, along with various 'dev' bits. */ -static void init_ring(void) -{ - int i; - char * p; - - w840private.tx_full = 0; - w840private.tx_q_bytes = w840private.cur_rx = w840private.cur_tx = 0; - w840private.dirty_rx = w840private.dirty_tx = 0; - - w840private.rx_buf_sz = PKT_BUF_SZ; - w840private.rx_head_desc = &w840private.rx_ring[0]; - - /* Initial all Rx descriptors. Fill in the Rx buffers. */ - - p = &rx_packet[0]; - - for (i = 0; i < RX_RING_SIZE; i++) { - w840private.rx_ring[i].length = w840private.rx_buf_sz; - w840private.rx_ring[i].status = 0; - w840private.rx_ring[i].next_desc = virt_to_le32desc(&w840private.rx_ring[i+1]); - - w840private.rx_ring[i].buffer1 = virt_to_le32desc(p + (PKT_BUF_SZ * i)); - w840private.rx_ring[i].status = DescOwn | DescIntr; - } - - /* Mark the last entry as wrapping the ring. */ - w840private.rx_ring[i-1].length |= DescEndRing; - w840private.rx_ring[i-1].next_desc = virt_to_le32desc(&w840private.rx_ring[0]); - - w840private.dirty_rx = (unsigned int)(i - RX_RING_SIZE); - - for (i = 0; i < TX_RING_SIZE; i++) { - w840private.tx_ring[i].status = 0; - } - return; -} - - -static struct pci_id w89c840_nics[] = { -PCI_ROM(0x1050, 0x0840, "winbond840", "Winbond W89C840F"), -PCI_ROM(0x11f6, 0x2011, "compexrl100atx", "Compex RL100ATX"), -}; - -struct pci_driver w89c840_driver = { - .type = NIC_DRIVER, - .name = "W89C840F", - .probe = w89c840_probe, - .ids = w89c840_nics, - .id_count = sizeof(w89c840_nics)/sizeof(w89c840_nics[0]), - .class = 0, -}; diff --git a/usr/src/grub/grub-0.95/stage1/Makefile.am b/usr/src/grub/grub-0.95/stage1/Makefile.am deleted file mode 100644 index 0afc285279..0000000000 --- a/usr/src/grub/grub-0.95/stage1/Makefile.am +++ /dev/null @@ -1,15 +0,0 @@ -pkglibdir = $(libdir)/$(PACKAGE)/$(host_cpu)-$(host_vendor) -nodist_pkglib_DATA = stage1 - -CLEANFILES = $(nodist_pkglib_DATA) - -# We can't use builtins or standard includes. -AM_CCASFLAGS = $(STAGE1_CFLAGS) -fno-builtin -nostdinc -LDFLAGS = -nostdlib -Wl,-N,-Ttext,7C00 - -noinst_PROGRAMS = stage1.exec -stage1_exec_SOURCES = stage1.S stage1.h - -SUFFIXES = .exec -.exec: - $(OBJCOPY) -O binary $< $@ diff --git a/usr/src/grub/grub-0.95/stage1/Makefile.in b/usr/src/grub/grub-0.95/stage1/Makefile.in deleted file mode 100644 index 7012740af3..0000000000 --- a/usr/src/grub/grub-0.95/stage1/Makefile.in +++ /dev/null @@ -1,424 +0,0 @@ -# Makefile.in generated by automake 1.8.5 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - - -SOURCES = $(stage1_exec_SOURCES) - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = .. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -host_triplet = @host@ -noinst_PROGRAMS = stage1.exec$(EXEEXT) -subdir = stage1 -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -PROGRAMS = $(noinst_PROGRAMS) -am_stage1_exec_OBJECTS = stage1.$(OBJEXT) -stage1_exec_OBJECTS = $(am_stage1_exec_OBJECTS) -stage1_exec_LDADD = $(LDADD) -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -CCASCOMPILE = $(CCAS) $(AM_CCASFLAGS) $(CCASFLAGS) -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(stage1_exec_SOURCES) -DIST_SOURCES = $(stage1_exec_SOURCES) -am__installdirs = "$(DESTDIR)$(pkglibdir)" -nodist_pkglibDATA_INSTALL = $(INSTALL_DATA) -DATA = $(nodist_pkglib_DATA) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -pkglibdir = $(libdir)/$(PACKAGE)/$(host_cpu)-$(host_vendor) -ACLOCAL = @ACLOCAL@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BUILD_EXAMPLE_KERNEL_FALSE = @BUILD_EXAMPLE_KERNEL_FALSE@ -BUILD_EXAMPLE_KERNEL_TRUE = @BUILD_EXAMPLE_KERNEL_TRUE@ -CC = @CC@ -CCAS = @CCAS@ -CCASFLAGS = @CCASFLAGS@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DISKLESS_SUPPORT_FALSE = @DISKLESS_SUPPORT_FALSE@ -DISKLESS_SUPPORT_TRUE = @DISKLESS_SUPPORT_TRUE@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FSYS_CFLAGS = @FSYS_CFLAGS@ -GRUB_CFLAGS = @GRUB_CFLAGS@ -GRUB_LIBS = @GRUB_LIBS@ -HERCULES_SUPPORT_FALSE = @HERCULES_SUPPORT_FALSE@ -HERCULES_SUPPORT_TRUE = @HERCULES_SUPPORT_TRUE@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LDFLAGS = -nostdlib -Wl,-N,-Ttext,7C00 -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LTLIBOBJS = @LTLIBOBJS@ -MAINT = @MAINT@ -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ -MAKEINFO = @MAKEINFO@ -NETBOOT_DRIVERS = @NETBOOT_DRIVERS@ -NETBOOT_SUPPORT_FALSE = @NETBOOT_SUPPORT_FALSE@ -NETBOOT_SUPPORT_TRUE = @NETBOOT_SUPPORT_TRUE@ -NET_CFLAGS = @NET_CFLAGS@ -NET_EXTRAFLAGS = @NET_EXTRAFLAGS@ -OBJCOPY = @OBJCOPY@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -RANLIB = @RANLIB@ -SERIAL_SPEED_SIMULATION_FALSE = @SERIAL_SPEED_SIMULATION_FALSE@ -SERIAL_SPEED_SIMULATION_TRUE = @SERIAL_SPEED_SIMULATION_TRUE@ -SERIAL_SUPPORT_FALSE = @SERIAL_SUPPORT_FALSE@ -SERIAL_SUPPORT_TRUE = @SERIAL_SUPPORT_TRUE@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STAGE1_CFLAGS = @STAGE1_CFLAGS@ -STAGE2_CFLAGS = @STAGE2_CFLAGS@ -STRIP = @STRIP@ -VERSION = @VERSION@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_OBJCOPY = @ac_ct_OBJCOPY@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -nodist_pkglib_DATA = stage1 -CLEANFILES = $(nodist_pkglib_DATA) - -# We can't use builtins or standard includes. -AM_CCASFLAGS = $(STAGE1_CFLAGS) -fno-builtin -nostdinc -stage1_exec_SOURCES = stage1.S stage1.h -SUFFIXES = .exec -all: all-am - -.SUFFIXES: -.SUFFIXES: .exec .S .o .obj -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu stage1/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu stage1/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -clean-noinstPROGRAMS: - -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) -stage1.exec$(EXEEXT): $(stage1_exec_OBJECTS) $(stage1_exec_DEPENDENCIES) - @rm -f stage1.exec$(EXEEXT) - $(LINK) $(stage1_exec_LDFLAGS) $(stage1_exec_OBJECTS) $(stage1_exec_LDADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -.S.o: - $(CCASCOMPILE) -c $< - -.S.obj: - $(CCASCOMPILE) -c `$(CYGPATH_W) '$<'` -uninstall-info-am: -install-nodist_pkglibDATA: $(nodist_pkglib_DATA) - @$(NORMAL_INSTALL) - test -z "$(pkglibdir)" || $(mkdir_p) "$(DESTDIR)$(pkglibdir)" - @list='$(nodist_pkglib_DATA)'; for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - f="`echo $$p | sed -e 's|^.*/||'`"; \ - echo " $(nodist_pkglibDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(pkglibdir)/$$f'"; \ - $(nodist_pkglibDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(pkglibdir)/$$f"; \ - done - -uninstall-nodist_pkglibDATA: - @$(NORMAL_UNINSTALL) - @list='$(nodist_pkglib_DATA)'; for p in $$list; do \ - f="`echo $$p | sed -e 's|^.*/||'`"; \ - echo " rm -f '$(DESTDIR)$(pkglibdir)/$$f'"; \ - rm -f "$(DESTDIR)$(pkglibdir)/$$f"; \ - done - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(PROGRAMS) $(DATA) -installdirs: - for dir in "$(DESTDIR)$(pkglibdir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) - -distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-noinstPROGRAMS mostlyclean-am - -distclean: distclean-am - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: - -install-exec-am: install-nodist_pkglibDATA - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am uninstall-nodist_pkglibDATA - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-noinstPROGRAMS ctags distclean distclean-compile \ - distclean-generic distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-exec install-exec-am install-info \ - install-info-am install-man install-nodist_pkglibDATA \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \ - tags uninstall uninstall-am uninstall-info-am \ - uninstall-nodist_pkglibDATA - -.exec: - $(OBJCOPY) -O binary $< $@ -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/usr/src/grub/grub-0.95/stage1/Makefile.solaris b/usr/src/grub/grub-0.95/stage1/Makefile.solaris deleted file mode 100644 index d5d34b9d1f..0000000000 --- a/usr/src/grub/grub-0.95/stage1/Makefile.solaris +++ /dev/null @@ -1,74 +0,0 @@ -# -# Copyright 2005 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# ident "%Z%%M% %I% %E% SMI" -# -include ../../Makefile.grub -include ../Makefile.solaris.defs - -.SUFFIXES: -.SUFFIXES: .exec $(SUFFIXES) - -.exec: - $(OBJCOPY) -O binary $< $@ - - -INCLUDES = -I. -I.. -CCASFLAGS += -O2 -fno-builtin -nostdinc -LDFLAGS += -nostdlib -N -Ttext 7C00 -LIBS = - - -DATA = $(STAGE1_DATA) -PROGRAMS = $(STAGE1_EXEC) - -STAGE1_DATA = stage1 -STAGE1_EXEC = stage1.exec -STAGE1_ASMOBJS = stage1.o -STAGE1_OBJS = - -INSTALL_TARGETS = $(DATA:%=$(ROOT_BOOT_GRUB)/%) - -# -# Source files to be installed in $(SRC_DIR). -# -SRC_DIR = $(ROOT_SRC)/stage1 -SRC_FILES = Makefile.am Makefile.in stage1.S stage1.h - -INSTALL_TARGETS += $(SRC_FILES:%=$(SRC_DIR)/%) - - -all: $(PROGRAMS) $(DATA) - - -$(STAGE1_EXEC): $(STAGE1_ASMOBJS) $(STAGE1_OBJS) - $(RM) $@ - $(LINK) -o $@ $(STAGE1_ASMOBJS) $(STAGE1_OBJS) $(LIBS) - -$(STAGE1_ASMOBJS): $$(@:.o=.S) - $(CCAS) $(CCASFLAGS) -c -o $@ $(@:.o=.S) - -$(STAGE1_OBJS): $$(@:.o=.c) - $(CC) $(CFLAGS) -c -o $@ $(@:.o=.c) - - -install: all $(INSTALL_TARGETS) - -$(ROOT_BOOT_GRUB)/%: $(ROOT_BOOT_GRUB) % - $(INS.file) - -$(SRC_DIR)/%: $(SRC_DIR) % - $(INS.file) - -$(ROOT_BOOT_GRUB) $(SRC_DIR): - $(INS.dir) - - -clean: _FORCE - $(RM) *.o $(PROGRAMS) - -clobber: clean - $(RM) $(DATA) - -_FORCE: diff --git a/usr/src/grub/grub-0.95/stage1/stage1.S b/usr/src/grub/grub-0.95/stage1/stage1.S deleted file mode 100644 index 50c63e4ae6..0000000000 --- a/usr/src/grub/grub-0.95/stage1/stage1.S +++ /dev/null @@ -1,493 +0,0 @@ -/* -*-Asm-*- */ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 1999,2000,2001,2002,2004 Free Software Foundation, 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 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 - -/* - * defines for the code go here - */ - - /* Absolute addresses - This makes the assembler generate the address without support - from the linker. (ELF can't relocate 16-bit addresses!) */ -#define ABS(x) (x-_start+0x7c00) - - /* Print message string */ -#define MSG(x) movw $ABS(x), %si; call message - - /* XXX: binutils-2.9.1.0.x doesn't produce a short opcode for this. */ -#define MOV_MEM_TO_AL(x) .byte 0xa0; .word x - - .file "stage1.S" - - .text - - /* Tell GAS to generate 16-bit instructions so that this code works - in real mode. */ - .code16 - -.globl _start; _start: - /* - * _start is loaded at 0x7c00 and is jumped to with CS:IP 0:0x7c00 - */ - - /* - * Beginning of the sector is compatible with the FAT/HPFS BIOS - * parameter block. - */ - - jmp after_BPB - nop /* do I care about this ??? */ - - /* - * This space is for the BIOS parameter block!!!! Don't change - * the first jump, nor start the code anywhere but right after - * this area. - */ - - . = _start + 4 - - /* scratch space */ -mode: - .byte 0 -disk_address_packet: -sectors: - .long 0 -heads: - .long 0 -cylinders: - .word 0 -sector_start: - .byte 0 -head_start: - .byte 0 -cylinder_start: - .word 0 - /* more space... */ - - . = _start + STAGE1_BPBEND - - /* - * End of BIOS parameter block. - */ - -stage1_version: - .byte COMPAT_VERSION_MAJOR, COMPAT_VERSION_MINOR -boot_drive: - .byte GRUB_INVALID_DRIVE /* the disk to load stage2 from */ -force_lba: - .byte 0 -stage2_address: - .word 0x8000 -stage2_sector: - .long 1 -stage2_segment: - .word 0x800 - -after_BPB: - -/* general setup */ - cli /* we're not safe here! */ - - /* - * This is a workaround for buggy BIOSes which don't pass boot - * drive correctly. If GRUB is installed into a HDD, do - * "orb $0x80, %dl", otherwise "orb $0x00, %dl" (i.e. nop). - */ - .byte 0x80, 0xca -boot_drive_mask: - .byte 0x00 - - /* - * ljmp to the next instruction because some bogus BIOSes - * jump to 07C0:0000 instead of 0000:7C00. - */ - ljmp $0, $ABS(real_start) - -real_start: - - /* set up %ds and %ss as offset from 0 */ - xorw %ax, %ax - movw %ax, %ds - movw %ax, %ss - - /* set up the REAL stack */ - movw $STAGE1_STACKSEG, %sp - - sti /* we're safe again */ - - /* - * Check if we have a forced disk reference here - */ - MOV_MEM_TO_AL(ABS(boot_drive)) /* movb ABS(boot_drive), %al */ - cmpb $GRUB_INVALID_DRIVE, %al - je 1f - movb %al, %dl -1: - /* save drive reference first thing! */ - pushw %dx - - /* print a notification message on the screen */ - MSG(notification_string) - - /* do not probe LBA if the drive is a floppy */ - testb $STAGE1_BIOS_HD_FLAG, %dl - jz chs_mode - - /* check if LBA is supported */ - movb $0x41, %ah - movw $0x55aa, %bx - int $0x13 - - /* - * %dl may have been clobbered by INT 13, AH=41H. - * This happens, for example, with AST BIOS 1.04. - */ - popw %dx - pushw %dx - - /* use CHS if fails */ - jc chs_mode - cmpw $0xaa55, %bx - jne chs_mode - - /* check if AH=0x42 is supported if FORCE_LBA is zero */ - MOV_MEM_TO_AL(ABS(force_lba)) /* movb ABS(force_lba), %al */ - testb %al, %al - jnz lba_mode - andw $1, %cx - jz chs_mode - -lba_mode: - /* save the total number of sectors */ - movl 0x10(%si), %ecx - - /* set %si to the disk address packet */ - movw $ABS(disk_address_packet), %si - - /* set the mode to non-zero */ - movb $1, -1(%si) - - movl ABS(stage2_sector), %ebx - - /* the size and the reserved byte */ - movw $0x0010, (%si) - - /* the blocks */ - movw $1, 2(%si) - - /* the absolute address (low 32 bits) */ - movl %ebx, 8(%si) - - /* the segment of buffer address */ - movw $STAGE1_BUFFERSEG, 6(%si) - - xorl %eax, %eax - movw %ax, 4(%si) - movl %eax, 12(%si) - -/* - * BIOS call "INT 0x13 Function 0x42" to read sectors from disk into memory - * Call with %ah = 0x42 - * %dl = drive number - * %ds:%si = segment:offset of disk address packet - * Return: - * %al = 0x0 on success; err code on failure - */ - - movb $0x42, %ah - int $0x13 - - /* LBA read is not supported, so fallback to CHS. */ - jc chs_mode - - movw $STAGE1_BUFFERSEG, %bx - jmp copy_buffer - -chs_mode: - /* - * Determine the hard disk geometry from the BIOS! - * We do this first, so that LS-120 IDE floppies work correctly. - */ - movb $8, %ah - int $0x13 - jnc final_init - - /* - * The call failed, so maybe use the floppy probe instead. - */ - testb $STAGE1_BIOS_HD_FLAG, %dl - jz floppy_probe - - /* Nope, we definitely have a hard disk, and we're screwed. */ - jmp hd_probe_error - -final_init: - - movw $ABS(sectors), %si - - /* set the mode to zero */ - movb $0, -1(%si) - - /* save number of heads */ - xorl %eax, %eax - movb %dh, %al - incw %ax - movl %eax, 4(%si) - - xorw %dx, %dx - movb %cl, %dl - shlw $2, %dx - movb %ch, %al - movb %dh, %ah - - /* save number of cylinders */ - incw %ax - movw %ax, 8(%si) - - xorw %ax, %ax - movb %dl, %al - shrb $2, %al - - /* save number of sectors */ - movl %eax, (%si) - -setup_sectors: - /* load logical sector start (bottom half) */ - movl ABS(stage2_sector), %eax - - /* zero %edx */ - xorl %edx, %edx - - /* divide by number of sectors */ - divl (%si) - - /* save sector start */ - movb %dl, 10(%si) - - xorl %edx, %edx /* zero %edx */ - divl 4(%si) /* divide by number of heads */ - - /* save head start */ - movb %dl, 11(%si) - - /* save cylinder start */ - movw %ax, 12(%si) - - /* do we need too many cylinders? */ - cmpw 8(%si), %ax - jge geometry_error - -/* - * This is the loop for taking care of BIOS geometry translation (ugh!) - */ - - /* get high bits of cylinder */ - movb 13(%si), %dl - - shlb $6, %dl /* shift left by 6 bits */ - movb 10(%si), %cl /* get sector */ - - incb %cl /* normalize sector (sectors go - from 1-N, not 0-(N-1) ) */ - orb %dl, %cl /* composite together */ - movb 12(%si), %ch /* sector+hcyl in cl, cylinder in ch */ - - /* restore %dx */ - popw %dx - - /* head number */ - movb 11(%si), %dh - -/* - * BIOS call "INT 0x13 Function 0x2" to read sectors from disk into memory - * Call with %ah = 0x2 - * %al = number of sectors - * %ch = cylinder - * %cl = sector (bits 6-7 are high bits of "cylinder") - * %dh = head - * %dl = drive (0x80 for hard disk, 0x0 for floppy disk) - * %es:%bx = segment:offset of buffer - * Return: - * %al = 0x0 on success; err code on failure - */ - - movw $STAGE1_BUFFERSEG, %bx - movw %bx, %es /* load %es segment with disk buffer */ - - xorw %bx, %bx /* %bx = 0, put it at 0 in the segment */ - movw $0x0201, %ax /* function 2 */ - int $0x13 - - jc read_error - - movw %es, %bx - -copy_buffer: - movw ABS(stage2_segment), %es - - /* - * We need to save %cx and %si because the startup code in - * stage2 uses them without initializing them. - */ - pusha - pushw %ds - - movw $0x100, %cx - movw %bx, %ds - xorw %si, %si - xorw %di, %di - - cld - - rep - movsw - - popw %ds - popa - - /* boot stage2 */ - jmp *(stage2_address) - -/* END OF MAIN LOOP */ - -/* - * BIOS Geometry translation error (past the end of the disk geometry!). - */ -geometry_error: - MSG(geometry_error_string) - jmp general_error - -/* - * Disk probe failure. - */ -hd_probe_error: - MSG(hd_probe_error_string) - jmp general_error - -/* - * Read error on the disk. - */ -read_error: - MSG(read_error_string) - -general_error: - MSG(general_error_string) - -/* go here when you need to stop the machine hard after an error condition */ -stop: jmp stop - -notification_string: .string "GRUB " -geometry_error_string: .string "Geom" -hd_probe_error_string: .string "Hard Disk" -read_error_string: .string "Read" -general_error_string: .string " Error" - -/* - * message: write the string pointed to by %si - * - * WARNING: trashes %si, %ax, and %bx - */ - - /* - * Use BIOS "int 10H Function 0Eh" to write character in teletype mode - * %ah = 0xe %al = character - * %bh = page %bl = foreground color (graphics modes) - */ -1: - movw $0x0001, %bx - movb $0xe, %ah - int $0x10 /* display a byte */ -message: - lodsb - cmpb $0, %al - jne 1b /* if not end of string, jmp to display */ - ret - - /* - * Windows NT breaks compatibility by embedding a magic - * number here. - */ - - . = _start + STAGE1_WINDOWS_NT_MAGIC -nt_magic: - .long 0 - .word 0 - - /* - * This is where an MBR would go if on a hard disk. The code - * here isn't even referenced unless we're on a floppy. Kinda - * sneaky, huh? - */ - -part_start: - . = _start + STAGE1_PARTSTART - -probe_values: - .byte 36, 18, 15, 9, 0 - -floppy_probe: -/* - * Perform floppy probe. - */ - - movw $ABS(probe_values-1), %si - -probe_loop: - /* reset floppy controller INT 13h AH=0 */ - xorw %ax, %ax - int $0x13 - - incw %si - movb (%si), %cl - - /* if number of sectors is 0, display error and die */ - cmpb $0, %cl - jne 1f - -/* - * Floppy disk probe failure. - */ - MSG(fd_probe_error_string) - jmp general_error - -fd_probe_error_string: .string "Floppy" - -1: - /* perform read */ - movw $STAGE1_BUFFERSEG, %bx - movw $0x201, %ax - movb $0, %ch - movb $0, %dh - int $0x13 - - /* if error, jump to "probe_loop" */ - jc probe_loop - - /* %cl is already the correct value! */ - movb $1, %dh - movb $79, %ch - - jmp final_init - - . = _start + STAGE1_PARTEND - -/* the last 2 bytes in the sector 0 contain the signature */ - .word STAGE1_SIGNATURE diff --git a/usr/src/grub/grub-0.95/stage1/stage1.h b/usr/src/grub/grub-0.95/stage1/stage1.h deleted file mode 100644 index 4205a5fd87..0000000000 --- a/usr/src/grub/grub-0.95/stage1/stage1.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 1999,2000,2002,2004 Free Software Foundation, 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 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 STAGE1_HEADER -#define STAGE1_HEADER 1 - - -/* Define the version numbers here, so that Stage 1 can know them. */ -#define COMPAT_VERSION_MAJOR 3 -#define COMPAT_VERSION_MINOR 2 -#define COMPAT_VERSION ((COMPAT_VERSION_MINOR << 8) \ - | COMPAT_VERSION_MAJOR) - -/* The signature for bootloader. */ -#define STAGE1_SIGNATURE 0xaa55 - -/* The offset of the end of BPB (BIOS Parameter Block). */ -#define STAGE1_BPBEND 0x3e - -/* The offset of the major version. */ -#define STAGE1_VER_MAJ_OFFS 0x3e - -/* The offset of BOOT_DRIVE. */ -#define STAGE1_BOOT_DRIVE 0x40 - -/* The offset of FORCE_LBA. */ -#define STAGE1_FORCE_LBA 0x41 - -/* The offset of STAGE2_ADDRESS. */ -#define STAGE1_STAGE2_ADDRESS 0x42 - -/* The offset of STAGE2_SECTOR. */ -#define STAGE1_STAGE2_SECTOR 0x44 - -/* The offset of STAGE2_SEGMENT. */ -#define STAGE1_STAGE2_SEGMENT 0x48 - -/* The offset of BOOT_DRIVE_MASK. */ -#define STAGE1_BOOT_DRIVE_MASK 0x4d - -/* The offset of a magic number used by Windows NT. */ -#define STAGE1_WINDOWS_NT_MAGIC 0x1b8 - -/* The offset of the start of the partition table. */ -#define STAGE1_PARTSTART 0x1be - -/* The offset of the end of the partition table. */ -#define STAGE1_PARTEND 0x1fe - -/* The stack segment. */ -#define STAGE1_STACKSEG 0x2000 - -/* The segment of disk buffer. The disk buffer MUST be 32K long and - cannot straddle a 64K boundary. */ -#define STAGE1_BUFFERSEG 0x7000 - -/* The address of drive parameters. */ -#define STAGE1_DRP_ADDR 0x7f00 - -/* The size of drive parameters. */ -#define STAGE1_DRP_SIZE 0x42 - -/* The flag for BIOS drive number to designate a hard disk vs. a - floppy. */ -#define STAGE1_BIOS_HD_FLAG 0x80 - -/* The drive number of an invalid drive. */ -#define GRUB_INVALID_DRIVE 0xFF - -#endif /* ! STAGE1_HEADER */ diff --git a/usr/src/grub/grub-0.95/stage2/Makefile.am b/usr/src/grub/grub-0.95/stage2/Makefile.am deleted file mode 100644 index 457ab4e568..0000000000 --- a/usr/src/grub/grub-0.95/stage2/Makefile.am +++ /dev/null @@ -1,304 +0,0 @@ -# For test target. -TESTS = size_test -noinst_SCRIPTS = $(TESTS) - -# For dist target. -noinst_HEADERS = apic.h defs.h dir.h disk_inode.h disk_inode_ffs.h \ - fat.h filesys.h freebsd.h fs.h hercules.h i386-elf.h \ - imgact_aout.h iso9660.h jfs.h mb_header.h mb_info.h md5.h \ - nbi.h pc_slice.h serial.h shared.h smp-imps.h term.h \ - terminfo.h tparm.h nbi.h ufs.h ufs2.h vstafs.h xfs.h graphics.h \ - fsys_zfs.h -EXTRA_DIST = setjmp.S apm.S $(noinst_SCRIPTS) - -# For . -INCLUDES = -I$(top_srcdir)/stage1 - -# The library for /sbin/grub. -noinst_LIBRARIES = libgrub.a -libgrub_a_SOURCES = boot.c builtins.c char_io.c cmdline.c common.c \ - disk_io.c fsys_ext2fs.c fsys_fat.c fsys_ffs.c fsys_iso9660.c \ - fsys_jfs.c fsys_minix.c fsys_reiserfs.c fsys_ufs.c fsys_ufs2.c \ - fsys_zfs.c zfs_fletcher.c zfs_lzjb.c zfs_sha256.c \ - fsys_vstafs.c fsys_xfs.c gunzip.c md5.c serial.c stage2.c \ - terminfo.c tparm.c graphics.c -libgrub_a_CFLAGS = $(GRUB_CFLAGS) -I$(top_srcdir)/lib \ - -DGRUB_UTIL=1 -DFSYS_EXT2FS=1 -DFSYS_FAT=1 -DFSYS_FFS=1 \ - -DFSYS_ISO9660=1 -DFSYS_JFS=1 -DFSYS_MINIX=1 -DFSYS_REISERFS=1 \ - -DFSYS_UFS=1 -DFSYS_UFS2=1 -DFSYS_ZFS=1 -DFSYS_VSTAFS=1 -DFSYS_XFS=1 \ - -DUSE_MD5_PASSWORDS=1 -DSUPPORT_SERIAL=1 -DSUPPORT_HERCULES=1 \ - -fwritable-strings - -# Stage 2 and Stage 1.5's. -pkglibdir = $(libdir)/$(PACKAGE)/$(host_cpu)-$(host_vendor) - -EXTRA_PROGRAMS = nbloader.exec pxeloader.exec diskless.exec - -if DISKLESS_SUPPORT -pkglib_DATA = stage2 stage2_eltorito e2fs_stage1_5 fat_stage1_5 \ - ffs_stage1_5 iso9660_stage1_5 jfs_stage1_5 minix_stage1_5 \ - reiserfs_stage1_5 ufs_stage1_5 ufs2_stage1_5 zfs_stage1_5 vstafs_stage1_5 \ - xfs_stage1_5 nbgrub pxegrub -noinst_DATA = pre_stage2 start start_eltorito nbloader pxeloader diskless -noinst_PROGRAMS = pre_stage2.exec start.exec start_eltorito.exec \ - e2fs_stage1_5.exec fat_stage1_5.exec ffs_stage1_5.exec \ - iso9660_stage1_5.exec jfs_stage1_5.exec minix_stage1_5.exec \ - reiserfs_stage1_5.exec ufs_stage1_5.exec ufs2_stage1_5.exec \ - zfs_stage1_5.exec \ - vstafs_stage1_5.exec xfs_stage1_5.exec \ - nbloader.exec pxeloader.exec diskless.exec -else -pkglib_DATA = stage2 stage2_eltorito e2fs_stage1_5 fat_stage1_5 \ - ffs_stage1_5 iso9660_stage1_5 jfs_stage1_5 minix_stage1_5 \ - reiserfs_stage1_5 ufs_stage1_5 ufs2_stage1_5 zfs_stage1_5 vstafs_stage1_5 \ - xfs_stage1_5 -noinst_DATA = pre_stage2 start start_eltorito -noinst_PROGRAMS = pre_stage2.exec start.exec start_eltorito.exec \ - e2fs_stage1_5.exec fat_stage1_5.exec ffs_stage1_5.exec \ - iso9660_stage1_5.exec jfs_stage1_5.exec minix_stage1_5.exec \ - reiserfs_stage1_5.exec ufs_stage1_5.exec ufs2_stage1_5.exec \ - zfs_stage1_5.exec vstafs_stage1_5.exec xfs_stage1_5.exec -endif -MOSTLYCLEANFILES = $(noinst_PROGRAMS) - -PRE_STAGE2_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,8200 -START_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,8000 -NBLOADER_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,0 -PXELOADER_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,7C00 -START_ELTORITO_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,7C00 - -if NETBOOT_SUPPORT -NETBOOT_FLAGS = -I$(top_srcdir)/netboot -DSUPPORT_NETBOOT=1 -else -NETBOOT_FLAGS = -endif - -if SERIAL_SUPPORT -SERIAL_FLAGS = -DSUPPORT_SERIAL=1 -else -SERIAL_FLAGS = -endif - -if HERCULES_SUPPORT -HERCULES_FLAGS = -DSUPPORT_HERCULES=1 -else -HERCULES_FLAGS = -endif - -if GRAPHICS_SUPPORT -GRAPHICS_FLAGS = -DSUPPORT_GRAPHICS=1 -else -GRAPHICS_FLAGS = -endif - -STAGE2_COMPILE = $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ - $(NETBOOT_FLAGS) $(SERIAL_FLAGS) $(HERCULES_FLAGS) $(GRAPHICS_FLAGS) - -STAGE1_5_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,2000 -STAGE1_5_COMPILE = $(STAGE2_COMPILE) -DNO_DECOMPRESSION=1 -DSTAGE1_5=1 - -# For stage2 target. -pre_stage2_exec_SOURCES = asm.S bios.c boot.c builtins.c char_io.c \ - cmdline.c common.c console.c disk_io.c fsys_ext2fs.c \ - fsys_fat.c fsys_ffs.c fsys_iso9660.c fsys_jfs.c fsys_minix.c \ - fsys_reiserfs.c fsys_ufs.c fsys_ufs2.c fsys_vstafs.c fsys_xfs.c \ - fsys_zfs.c zfs_fletcher.c zfs_lzjb.c zfs_sha256.c \ - gunzip.c hercules.c md5.c serial.c smp-imps.c stage2.c terminfo.c \ - tparm.c graphics.c -pre_stage2_exec_CFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS) -pre_stage2_exec_CCASFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS) -pre_stage2_exec_LDFLAGS = $(PRE_STAGE2_LINK) - -if NETBOOT_SUPPORT -pre_stage2_exec_LDADD = ../netboot/libdrivers.a -endif - -if DISKLESS_SUPPORT -BUILT_SOURCES = stage2_size.h diskless_size.h -else -BUILT_SOURCES = stage2_size.h -endif - -CLEANFILES = $(pkglib_DATA) $(noinst_DATA) $(BUILT_SOURCES) - -stage2_size.h: pre_stage2 - -rm -f stage2_size.h - set dummy `ls -l pre_stage2`; \ - echo "#define STAGE2_SIZE $$6" > stage2_size.h - -start_exec_SOURCES = start.S -start_exec_CCASFLAGS = $(STAGE2_COMPILE) -start_exec_LDFLAGS = $(START_LINK) - -# XXX: automake doesn't provide a way to specify dependencies for object -# files explicitly, so we must write this by a general Makefile scheme. -# If automake change the naming scheme for per-executable objects, this -# will be broken. -start_exec-start.$(OBJEXT): stage2_size.h - -stage2: pre_stage2 start - -rm -f stage2 - cat start pre_stage2 > stage2 - -start_eltorito_exec_SOURCES = start_eltorito.S -start_eltorito_exec_CCASFLAGS = $(STAGE2_COMPILE) -start_eltorito_exec_LDFLAGS = $(START_ELTORITO_LINK) - -start_eltorito_exec-start.$(OBJEXT): stage2_size.h - -stage2_eltorito: pre_stage2 start_eltorito - -rm -f stage2_eltorito - cat start_eltorito pre_stage2 > stage2_eltorito - -# For e2fs_stage1_5 target. -e2fs_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c disk_io.c \ - stage1_5.c fsys_ext2fs.c bios.c -e2fs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_EXT2FS=1 \ - -DNO_BLOCK_FILES=1 -e2fs_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_EXT2FS=1 \ - -DNO_BLOCK_FILES=1 -e2fs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) - -# For fat_stage1_5 target. -fat_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c disk_io.c \ - stage1_5.c fsys_fat.c bios.c -fat_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_FAT=1 \ - -DNO_BLOCK_FILES=1 -fat_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_FAT=1 \ - -DNO_BLOCK_FILES=1 -fat_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) - -# For ffs_stage1_5 target. -ffs_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c disk_io.c \ - stage1_5.c fsys_ffs.c bios.c -ffs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_FFS=1 \ - -DNO_BLOCK_FILES=1 -ffs_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_FFS=1 \ - -DNO_BLOCK_FILES=1 -ffs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) - -# For ufs_stage1_5 target. -ufs_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c disk_io.c \ - stage1_5.c fsys_ufs.c bios.c -ufs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_UFS=1 \ - -DNO_BLOCK_FILES=1 -ufs_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_UFS=1 \ - -DNO_BLOCK_FILES=1 -ufs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) - -# For ufs2_stage1_5 target. -ufs2_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c disk_io.c \ - stage1_5.c fsys_ufs2.c bios.c -ufs2_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_UFS2=1 \ - -DNO_BLOCK_FILES=1 -ufs2_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_UFS2=1 \ - -DNO_BLOCK_FILES=1 -ufs2_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) - -# For zfs_stage1_5 target. -zfs_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c disk_io.c \ - stage1_5.c fsys_zfs.c zfs_fletcher.c zfs_lzjb.c zfs_sha256.c bios.c -zfs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_ZFS=1 \ - -DNO_BLOCK_FILES=1 -zfs_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_ZFS=1 \ - -DNO_BLOCK_FILES=1 -zfs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) - -# For minix_stage1_5 target. -minix_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c disk_io.c \ - stage1_5.c fsys_minix.c bios.c -minix_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_MINIX=1 \ - -DNO_BLOCK_FILES=1 -minix_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_MINIX=1 \ - -DNO_BLOCK_FILES=1 -minix_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) - -# For reiserfs_stage1_5 target. -reiserfs_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c \ - disk_io.c stage1_5.c fsys_reiserfs.c bios.c -reiserfs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_REISERFS=1 \ - -DNO_BLOCK_FILES=1 -reiserfs_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_REISERFS=1 \ - -DNO_BLOCK_FILES=1 -reiserfs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) - -# For vstafs_stage1_5 target. -vstafs_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c \ - disk_io.c stage1_5.c fsys_vstafs.c bios.c -vstafs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_VSTAFS=1 \ - -DNO_BLOCK_FILES=1 -vstafs_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_VSTAFS=1 \ - -DNO_BLOCK_FILES=1 -vstafs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) - -# For jfs_stage1_5 target. -jfs_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c \ - disk_io.c stage1_5.c fsys_jfs.c bios.c -jfs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_JFS=1 \ - -DNO_BLOCK_FILES=1 -jfs_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_JFS=1 \ - -DNO_BLOCK_FILES=1 -jfs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) - -# For xfs_stage1_5 target. -xfs_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c \ - disk_io.c stage1_5.c fsys_xfs.c bios.c -xfs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_XFS=1 \ - -DNO_BLOCK_FILES=1 -xfs_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_XFS=1 \ - -DNO_BLOCK_FILES=1 -xfs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) - -# For iso9660_stage1_5 target. -iso9660_stage1_5_exec_SOURCES = start_eltorito.S asm.S common.c char_io.c \ - disk_io.c stage1_5.c fsys_iso9660.c bios.c -iso9660_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_ISO9660=1 \ - -DNO_BLOCK_FILES=1 -iso9660_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_ISO9660=1 \ - -DNO_BLOCK_FILES=1 -iso9660_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) - -# For diskless target. -diskless_exec_SOURCES = $(pre_stage2_exec_SOURCES) -diskless_exec_CFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS) \ - -DSUPPORT_DISKLESS=1 -diskless_exec_CCASFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS) \ - -DSUPPORT_DISKLESS=1 -diskless_exec_LDFLAGS = $(PRE_STAGE2_LINK) -diskless_exec_LDADD = ../netboot/libdrivers.a - -diskless_size.h: diskless - -rm -f $@ - set dummy `ls -l $^`; \ - echo "#define DISKLESS_SIZE $$6" > $@ - -# For nbloader target. -nbloader_exec_SOURCES = nbloader.S -nbloader_exec_CCASFLAGS = $(STAGE2_COMPILE) -nbloader_exec_LDFLAGS = $(NBLOADER_LINK) - -# XXX: See the comment for start_exec-start.o. -nbloader_exec-nbloader.$(OBJEXT): diskless_size.h - -# For nbgrub target. -nbgrub: nbloader diskless - -rm -f $@ - cat $^ > $@ - -# For pxeloader target. -pxeloader_exec_SOURCES = pxeloader.S -pxeloader_exec_CCASFLAGS = $(STAGE2_COMPILE) -pxeloader_exec_LDFLAGS = $(PXELOADER_LINK) - -# XXX: See the comment for start_exec-start.o. -pxeloader_exec-pxeloader.$(OBJEXT): diskless_size.h - -# For pxegrub target. -pxegrub: pxeloader diskless - -rm -f $@ - cat $^ > $@ - -# General rule for making a raw binary. -SUFFIXES = .exec -.exec: - $(OBJCOPY) -O binary $< $@ diff --git a/usr/src/grub/grub-0.95/stage2/Makefile.in b/usr/src/grub/grub-0.95/stage2/Makefile.in deleted file mode 100644 index ea5482675e..0000000000 --- a/usr/src/grub/grub-0.95/stage2/Makefile.in +++ /dev/null @@ -1,4349 +0,0 @@ -# Makefile.in generated by automake 1.8.5 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - - - - - -SOURCES = $(libgrub_a_SOURCES) $(diskless_exec_SOURCES) $(e2fs_stage1_5_exec_SOURCES) $(fat_stage1_5_exec_SOURCES) $(ffs_stage1_5_exec_SOURCES) $(iso9660_stage1_5_exec_SOURCES) $(jfs_stage1_5_exec_SOURCES) $(minix_stage1_5_exec_SOURCES) $(nbloader_exec_SOURCES) $(pre_stage2_exec_SOURCES) $(pxeloader_exec_SOURCES) $(reiserfs_stage1_5_exec_SOURCES) $(start_exec_SOURCES) $(start_eltorito_exec_SOURCES) $(ufs2_stage1_5_exec_SOURCES) $(zfs_stage1_5_exec_SOURCE) $(ufs_stage1_5_exec_SOURCES) $(vstafs_stage1_5_exec_SOURCES) $(xfs_stage1_5_exec_SOURCES) - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = .. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -host_triplet = @host@ -EXTRA_PROGRAMS = nbloader.exec$(EXEEXT) pxeloader.exec$(EXEEXT) \ - diskless.exec$(EXEEXT) -@DISKLESS_SUPPORT_FALSE@noinst_PROGRAMS = pre_stage2.exec$(EXEEXT) \ -@DISKLESS_SUPPORT_FALSE@ start.exec$(EXEEXT) \ -@DISKLESS_SUPPORT_FALSE@ start_eltorito.exec$(EXEEXT) \ -@DISKLESS_SUPPORT_FALSE@ e2fs_stage1_5.exec$(EXEEXT) \ -@DISKLESS_SUPPORT_FALSE@ fat_stage1_5.exec$(EXEEXT) \ -@DISKLESS_SUPPORT_FALSE@ ffs_stage1_5.exec$(EXEEXT) \ -@DISKLESS_SUPPORT_FALSE@ iso9660_stage1_5.exec$(EXEEXT) \ -@DISKLESS_SUPPORT_FALSE@ jfs_stage1_5.exec$(EXEEXT) \ -@DISKLESS_SUPPORT_FALSE@ minix_stage1_5.exec$(EXEEXT) \ -@DISKLESS_SUPPORT_FALSE@ reiserfs_stage1_5.exec$(EXEEXT) \ -@DISKLESS_SUPPORT_FALSE@ ufs_stage1_5.exec$(EXEEXT) \ -@DISKLESS_SUPPORT_FALSE@ ufs2_stage1_5.exec$(EXEEXT) \ -@DISKLESS_SUPPORT_FALSE@ zfs_stage1_5.exec$(EXEEXT) \ -@DISKLESS_SUPPORT_FALSE@ vstafs_stage1_5.exec$(EXEEXT) \ -@DISKLESS_SUPPORT_FALSE@ xfs_stage1_5.exec$(EXEEXT) -@DISKLESS_SUPPORT_TRUE@noinst_PROGRAMS = pre_stage2.exec$(EXEEXT) \ -@DISKLESS_SUPPORT_TRUE@ start.exec$(EXEEXT) \ -@DISKLESS_SUPPORT_TRUE@ start_eltorito.exec$(EXEEXT) \ -@DISKLESS_SUPPORT_TRUE@ e2fs_stage1_5.exec$(EXEEXT) \ -@DISKLESS_SUPPORT_TRUE@ fat_stage1_5.exec$(EXEEXT) \ -@DISKLESS_SUPPORT_TRUE@ ffs_stage1_5.exec$(EXEEXT) \ -@DISKLESS_SUPPORT_TRUE@ iso9660_stage1_5.exec$(EXEEXT) \ -@DISKLESS_SUPPORT_TRUE@ jfs_stage1_5.exec$(EXEEXT) \ -@DISKLESS_SUPPORT_TRUE@ minix_stage1_5.exec$(EXEEXT) \ -@DISKLESS_SUPPORT_TRUE@ reiserfs_stage1_5.exec$(EXEEXT) \ -@DISKLESS_SUPPORT_TRUE@ ufs_stage1_5.exec$(EXEEXT) \ -@DISKLESS_SUPPORT_TRUE@ ufs2_stage1_5.exec$(EXEEXT) \ -@DISKLESS_SUPPORT_TRUE@ zfs_stage1_5.exec$(EXEEXT) \ -@DISKLESS_SUPPORT_TRUE@ vstafs_stage1_5.exec$(EXEEXT) \ -@DISKLESS_SUPPORT_TRUE@ xfs_stage1_5.exec$(EXEEXT) \ -@DISKLESS_SUPPORT_TRUE@ nbloader.exec$(EXEEXT) \ -@DISKLESS_SUPPORT_TRUE@ pxeloader.exec$(EXEEXT) \ -@DISKLESS_SUPPORT_TRUE@ diskless.exec$(EXEEXT) -subdir = stage2 -DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ - $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -LIBRARIES = $(noinst_LIBRARIES) -AR = ar -ARFLAGS = cru -libgrub_a_AR = $(AR) $(ARFLAGS) -libgrub_a_LIBADD = -am_libgrub_a_OBJECTS = libgrub_a-boot.$(OBJEXT) \ - libgrub_a-builtins.$(OBJEXT) libgrub_a-char_io.$(OBJEXT) \ - libgrub_a-cmdline.$(OBJEXT) libgrub_a-common.$(OBJEXT) \ - libgrub_a-disk_io.$(OBJEXT) libgrub_a-fsys_ext2fs.$(OBJEXT) \ - libgrub_a-fsys_fat.$(OBJEXT) libgrub_a-fsys_ffs.$(OBJEXT) \ - libgrub_a-fsys_iso9660.$(OBJEXT) libgrub_a-fsys_jfs.$(OBJEXT) \ - libgrub_a-fsys_minix.$(OBJEXT) \ - libgrub_a-fsys_reiserfs.$(OBJEXT) libgrub_a-fsys_ufs.$(OBJEXT) \ - libgrub_a-zfs_sha256.$(OBJEXT) \ - libgrub_a-zfs_lzjb.$(OBJEXT) \ - libgrub_a-zfs_fletcher.$(OBJEXT) \ - libgrub_a-fsys_zfs.$(OBJEXT) \ - libgrub_a-fsys_ufs2.$(OBJEXT) libgrub_a-fsys_vstafs.$(OBJEXT) \ - libgrub_a-fsys_xfs.$(OBJEXT) libgrub_a-gunzip.$(OBJEXT) \ - libgrub_a-md5.$(OBJEXT) libgrub_a-serial.$(OBJEXT) \ - libgrub_a-stage2.$(OBJEXT) libgrub_a-terminfo.$(OBJEXT) \ - libgrub_a-tparm.$(OBJEXT) libgrub_a-graphics.$(OBJEXT) -libgrub_a_OBJECTS = $(am_libgrub_a_OBJECTS) -PROGRAMS = $(noinst_PROGRAMS) -am__objects_1 = diskless_exec-asm.$(OBJEXT) \ - diskless_exec-bios.$(OBJEXT) diskless_exec-boot.$(OBJEXT) \ - diskless_exec-builtins.$(OBJEXT) \ - diskless_exec-char_io.$(OBJEXT) \ - diskless_exec-cmdline.$(OBJEXT) diskless_exec-common.$(OBJEXT) \ - diskless_exec-console.$(OBJEXT) \ - diskless_exec-disk_io.$(OBJEXT) \ - diskless_exec-fsys_ext2fs.$(OBJEXT) \ - diskless_exec-fsys_fat.$(OBJEXT) \ - diskless_exec-fsys_ffs.$(OBJEXT) \ - diskless_exec-fsys_iso9660.$(OBJEXT) \ - diskless_exec-fsys_jfs.$(OBJEXT) \ - diskless_exec-fsys_minix.$(OBJEXT) \ - diskless_exec-fsys_reiserfs.$(OBJEXT) \ - diskless_exec-zfs_sha256.$(OBJEXT) \ - diskless_exec-zfs_lzjb.$(OBJEXT) \ - diskless_exec-zfs_fletcher.$(OBJEXT) \ - diskless_exec-fsys_zfs.$(OBJEXT) \ - diskless_exec-fsys_ufs.$(OBJEXT) \ - diskless_exec-fsys_ufs2.$(OBJEXT) \ - diskless_exec-fsys_vstafs.$(OBJEXT) \ - diskless_exec-fsys_xfs.$(OBJEXT) \ - diskless_exec-gunzip.$(OBJEXT) \ - diskless_exec-hercules.$(OBJEXT) diskless_exec-md5.$(OBJEXT) \ - diskless_exec-serial.$(OBJEXT) \ - diskless_exec-smp-imps.$(OBJEXT) \ - diskless_exec-stage2.$(OBJEXT) \ - diskless_exec-terminfo.$(OBJEXT) diskless_exec-tparm.$(OBJEXT) \ - diskless_exec-graphics.$(OBJEXT) -am_diskless_exec_OBJECTS = $(am__objects_1) -diskless_exec_OBJECTS = $(am_diskless_exec_OBJECTS) -diskless_exec_DEPENDENCIES = ../netboot/libdrivers.a -am_e2fs_stage1_5_exec_OBJECTS = e2fs_stage1_5_exec-start.$(OBJEXT) \ - e2fs_stage1_5_exec-asm.$(OBJEXT) \ - e2fs_stage1_5_exec-common.$(OBJEXT) \ - e2fs_stage1_5_exec-char_io.$(OBJEXT) \ - e2fs_stage1_5_exec-disk_io.$(OBJEXT) \ - e2fs_stage1_5_exec-stage1_5.$(OBJEXT) \ - e2fs_stage1_5_exec-fsys_ext2fs.$(OBJEXT) \ - e2fs_stage1_5_exec-bios.$(OBJEXT) -e2fs_stage1_5_exec_OBJECTS = $(am_e2fs_stage1_5_exec_OBJECTS) -e2fs_stage1_5_exec_LDADD = $(LDADD) -am_fat_stage1_5_exec_OBJECTS = fat_stage1_5_exec-start.$(OBJEXT) \ - fat_stage1_5_exec-asm.$(OBJEXT) \ - fat_stage1_5_exec-common.$(OBJEXT) \ - fat_stage1_5_exec-char_io.$(OBJEXT) \ - fat_stage1_5_exec-disk_io.$(OBJEXT) \ - fat_stage1_5_exec-stage1_5.$(OBJEXT) \ - fat_stage1_5_exec-fsys_fat.$(OBJEXT) \ - fat_stage1_5_exec-bios.$(OBJEXT) -fat_stage1_5_exec_OBJECTS = $(am_fat_stage1_5_exec_OBJECTS) -fat_stage1_5_exec_LDADD = $(LDADD) -am_ffs_stage1_5_exec_OBJECTS = ffs_stage1_5_exec-start.$(OBJEXT) \ - ffs_stage1_5_exec-asm.$(OBJEXT) \ - ffs_stage1_5_exec-common.$(OBJEXT) \ - ffs_stage1_5_exec-char_io.$(OBJEXT) \ - ffs_stage1_5_exec-disk_io.$(OBJEXT) \ - ffs_stage1_5_exec-stage1_5.$(OBJEXT) \ - ffs_stage1_5_exec-fsys_ffs.$(OBJEXT) \ - ffs_stage1_5_exec-bios.$(OBJEXT) -ffs_stage1_5_exec_OBJECTS = $(am_ffs_stage1_5_exec_OBJECTS) -ffs_stage1_5_exec_LDADD = $(LDADD) -am_iso9660_stage1_5_exec_OBJECTS = \ - iso9660_stage1_5_exec-start_eltorito.$(OBJEXT) \ - iso9660_stage1_5_exec-asm.$(OBJEXT) \ - iso9660_stage1_5_exec-common.$(OBJEXT) \ - iso9660_stage1_5_exec-char_io.$(OBJEXT) \ - iso9660_stage1_5_exec-disk_io.$(OBJEXT) \ - iso9660_stage1_5_exec-stage1_5.$(OBJEXT) \ - iso9660_stage1_5_exec-fsys_iso9660.$(OBJEXT) \ - iso9660_stage1_5_exec-bios.$(OBJEXT) -iso9660_stage1_5_exec_OBJECTS = $(am_iso9660_stage1_5_exec_OBJECTS) -iso9660_stage1_5_exec_LDADD = $(LDADD) -am_jfs_stage1_5_exec_OBJECTS = jfs_stage1_5_exec-start.$(OBJEXT) \ - jfs_stage1_5_exec-asm.$(OBJEXT) \ - jfs_stage1_5_exec-common.$(OBJEXT) \ - jfs_stage1_5_exec-char_io.$(OBJEXT) \ - jfs_stage1_5_exec-disk_io.$(OBJEXT) \ - jfs_stage1_5_exec-stage1_5.$(OBJEXT) \ - jfs_stage1_5_exec-fsys_jfs.$(OBJEXT) \ - jfs_stage1_5_exec-bios.$(OBJEXT) -jfs_stage1_5_exec_OBJECTS = $(am_jfs_stage1_5_exec_OBJECTS) -jfs_stage1_5_exec_LDADD = $(LDADD) -am_minix_stage1_5_exec_OBJECTS = minix_stage1_5_exec-start.$(OBJEXT) \ - minix_stage1_5_exec-asm.$(OBJEXT) \ - minix_stage1_5_exec-common.$(OBJEXT) \ - minix_stage1_5_exec-char_io.$(OBJEXT) \ - minix_stage1_5_exec-disk_io.$(OBJEXT) \ - minix_stage1_5_exec-stage1_5.$(OBJEXT) \ - minix_stage1_5_exec-fsys_minix.$(OBJEXT) \ - minix_stage1_5_exec-bios.$(OBJEXT) -minix_stage1_5_exec_OBJECTS = $(am_minix_stage1_5_exec_OBJECTS) -minix_stage1_5_exec_LDADD = $(LDADD) -am_nbloader_exec_OBJECTS = nbloader_exec-nbloader.$(OBJEXT) -nbloader_exec_OBJECTS = $(am_nbloader_exec_OBJECTS) -nbloader_exec_LDADD = $(LDADD) -am_pre_stage2_exec_OBJECTS = pre_stage2_exec-asm.$(OBJEXT) \ - pre_stage2_exec-bios.$(OBJEXT) pre_stage2_exec-boot.$(OBJEXT) \ - pre_stage2_exec-builtins.$(OBJEXT) \ - pre_stage2_exec-char_io.$(OBJEXT) \ - pre_stage2_exec-cmdline.$(OBJEXT) \ - pre_stage2_exec-common.$(OBJEXT) \ - pre_stage2_exec-console.$(OBJEXT) \ - pre_stage2_exec-disk_io.$(OBJEXT) \ - pre_stage2_exec-fsys_ext2fs.$(OBJEXT) \ - pre_stage2_exec-fsys_fat.$(OBJEXT) \ - pre_stage2_exec-fsys_ffs.$(OBJEXT) \ - pre_stage2_exec-fsys_iso9660.$(OBJEXT) \ - pre_stage2_exec-fsys_jfs.$(OBJEXT) \ - pre_stage2_exec-fsys_minix.$(OBJEXT) \ - pre_stage2_exec-fsys_reiserfs.$(OBJEXT) \ - pre_stage2_exec-zfs_sha256.$(OBJEXT) \ - pre_stage2_exec-zfs_lzjb.$(OBJEXT) \ - pre_stage2_exec-zfs_fletcher.$(OBJEXT) \ - pre_stage2_exec-fsys_zfs.$(OBJEXT) \ - pre_stage2_exec-fsys_ufs.$(OBJEXT) \ - pre_stage2_exec-fsys_ufs2.$(OBJEXT) \ - pre_stage2_exec-fsys_vstafs.$(OBJEXT) \ - pre_stage2_exec-fsys_xfs.$(OBJEXT) \ - pre_stage2_exec-gunzip.$(OBJEXT) \ - pre_stage2_exec-hercules.$(OBJEXT) \ - pre_stage2_exec-md5.$(OBJEXT) pre_stage2_exec-serial.$(OBJEXT) \ - pre_stage2_exec-smp-imps.$(OBJEXT) \ - pre_stage2_exec-stage2.$(OBJEXT) \ - pre_stage2_exec-terminfo.$(OBJEXT) \ - pre_stage2_exec-tparm.$(OBJEXT) \ - pre_stage2_exec-graphics.$(OBJEXT) -pre_stage2_exec_OBJECTS = $(am_pre_stage2_exec_OBJECTS) -@NETBOOT_SUPPORT_TRUE@pre_stage2_exec_DEPENDENCIES = \ -@NETBOOT_SUPPORT_TRUE@ ../netboot/libdrivers.a -am_pxeloader_exec_OBJECTS = pxeloader_exec-pxeloader.$(OBJEXT) -pxeloader_exec_OBJECTS = $(am_pxeloader_exec_OBJECTS) -pxeloader_exec_LDADD = $(LDADD) -am_reiserfs_stage1_5_exec_OBJECTS = \ - reiserfs_stage1_5_exec-start.$(OBJEXT) \ - reiserfs_stage1_5_exec-asm.$(OBJEXT) \ - reiserfs_stage1_5_exec-common.$(OBJEXT) \ - reiserfs_stage1_5_exec-char_io.$(OBJEXT) \ - reiserfs_stage1_5_exec-disk_io.$(OBJEXT) \ - reiserfs_stage1_5_exec-stage1_5.$(OBJEXT) \ - reiserfs_stage1_5_exec-fsys_reiserfs.$(OBJEXT) \ - reiserfs_stage1_5_exec-bios.$(OBJEXT) -reiserfs_stage1_5_exec_OBJECTS = $(am_reiserfs_stage1_5_exec_OBJECTS) -reiserfs_stage1_5_exec_LDADD = $(LDADD) -am_start_exec_OBJECTS = start_exec-start.$(OBJEXT) -start_exec_OBJECTS = $(am_start_exec_OBJECTS) -start_exec_LDADD = $(LDADD) -am_start_eltorito_exec_OBJECTS = \ - start_eltorito_exec-start_eltorito.$(OBJEXT) -start_eltorito_exec_OBJECTS = $(am_start_eltorito_exec_OBJECTS) -start_eltorito_exec_LDADD = $(LDADD) -am_ufs2_stage1_5_exec_OBJECTS = ufs2_stage1_5_exec-start.$(OBJEXT) \ - ufs2_stage1_5_exec-asm.$(OBJEXT) \ - ufs2_stage1_5_exec-common.$(OBJEXT) \ - ufs2_stage1_5_exec-char_io.$(OBJEXT) \ - ufs2_stage1_5_exec-disk_io.$(OBJEXT) \ - ufs2_stage1_5_exec-stage1_5.$(OBJEXT) \ - ufs2_stage1_5_exec-fsys_ufs2.$(OBJEXT) \ - ufs2_stage1_5_exec-bios.$(OBJEXT) -ufs2_stage1_5_exec_OBJECTS = $(am_ufs2_stage1_5_exec_OBJECTS) -ufs2_stage1_5_exec_LDADD = $(LDADD) -am_ufs_stage1_5_exec_OBJECTS = ufs_stage1_5_exec-start.$(OBJEXT) \ - ufs_stage1_5_exec-asm.$(OBJEXT) \ - ufs_stage1_5_exec-common.$(OBJEXT) \ - ufs_stage1_5_exec-char_io.$(OBJEXT) \ - ufs_stage1_5_exec-disk_io.$(OBJEXT) \ - ufs_stage1_5_exec-stage1_5.$(OBJEXT) \ - ufs_stage1_5_exec-fsys_ufs.$(OBJEXT) \ - ufs_stage1_5_exec-bios.$(OBJEXT) -ufs_stage1_5_exec_OBJECTS = $(am_ufs_stage1_5_exec_OBJECTS) -ufs_stage1_5_exec_LDADD = $(LDADD) -am_zfs_stage1_5_exec_OBJECTS = zfs_stage1_5_exec-start.$(OBJEXT) \ - zfs_stage1_5_exec-asm.$(OBJEXT) \ - zfs_stage1_5_exec-common.$(OBJEXT) \ - zfs_stage1_5_exec-char_io.$(OBJEXT) \ - zfs_stage1_5_exec-disk_io.$(OBJEXT) \ - zfs_stage1_5_exec-stage1_5.$(OBJEXT) \ - zfs_stage1_5_exec-zfs_sha256.$(OBJEXT) \ - zfs_stage1_5_exec-zfs_lzjb.$(OBJEXT) \ - zfs_stage1_5_exec-zfs_fletcher.$(OBJEXT) \ - zfs_stage1_5_exec-fsys_zfs.$(OBJEXT) \ - zfs_stage1_5_exec-bios.$(OBJEXT) -zfs_stage1_5_exec_OBJECTS = $(am_zfs_stage1_5_exec_OBJECTS) -zfs_stage1_5_exec_LDADD = $(LDADD) -am_vstafs_stage1_5_exec_OBJECTS = \ - vstafs_stage1_5_exec-start.$(OBJEXT) \ - vstafs_stage1_5_exec-asm.$(OBJEXT) \ - vstafs_stage1_5_exec-common.$(OBJEXT) \ - vstafs_stage1_5_exec-char_io.$(OBJEXT) \ - vstafs_stage1_5_exec-disk_io.$(OBJEXT) \ - vstafs_stage1_5_exec-stage1_5.$(OBJEXT) \ - vstafs_stage1_5_exec-fsys_vstafs.$(OBJEXT) \ - vstafs_stage1_5_exec-bios.$(OBJEXT) -vstafs_stage1_5_exec_OBJECTS = $(am_vstafs_stage1_5_exec_OBJECTS) -vstafs_stage1_5_exec_LDADD = $(LDADD) -am_xfs_stage1_5_exec_OBJECTS = xfs_stage1_5_exec-start.$(OBJEXT) \ - xfs_stage1_5_exec-asm.$(OBJEXT) \ - xfs_stage1_5_exec-common.$(OBJEXT) \ - xfs_stage1_5_exec-char_io.$(OBJEXT) \ - xfs_stage1_5_exec-disk_io.$(OBJEXT) \ - xfs_stage1_5_exec-stage1_5.$(OBJEXT) \ - xfs_stage1_5_exec-fsys_xfs.$(OBJEXT) \ - xfs_stage1_5_exec-bios.$(OBJEXT) -xfs_stage1_5_exec_OBJECTS = $(am_xfs_stage1_5_exec_OBJECTS) -xfs_stage1_5_exec_LDADD = $(LDADD) -SCRIPTS = $(noinst_SCRIPTS) -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/diskless_exec-bios.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/diskless_exec-boot.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/diskless_exec-builtins.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/diskless_exec-char_io.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/diskless_exec-cmdline.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/diskless_exec-common.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/diskless_exec-console.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/diskless_exec-disk_io.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/diskless_exec-fsys_ext2fs.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/diskless_exec-fsys_fat.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/diskless_exec-fsys_ffs.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/diskless_exec-fsys_iso9660.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/diskless_exec-fsys_jfs.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/diskless_exec-fsys_minix.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/diskless_exec-fsys_reiserfs.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/diskless_exec-zfs_sha256.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/diskless_exec-zfs_lzjb.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/diskless_exec-zfs_fletcher.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/diskless_exec-fsys_zfs.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/diskless_exec-fsys_ufs.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/diskless_exec-fsys_ufs2.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/diskless_exec-fsys_vstafs.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/diskless_exec-fsys_xfs.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/diskless_exec-graphics.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/diskless_exec-gunzip.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/diskless_exec-hercules.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/diskless_exec-md5.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/diskless_exec-serial.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/diskless_exec-smp-imps.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/diskless_exec-stage2.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/diskless_exec-terminfo.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/diskless_exec-tparm.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/e2fs_stage1_5_exec-bios.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/e2fs_stage1_5_exec-char_io.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/e2fs_stage1_5_exec-common.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/e2fs_stage1_5_exec-disk_io.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/e2fs_stage1_5_exec-fsys_ext2fs.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/e2fs_stage1_5_exec-stage1_5.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/fat_stage1_5_exec-bios.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/fat_stage1_5_exec-char_io.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/fat_stage1_5_exec-common.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/fat_stage1_5_exec-disk_io.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/fat_stage1_5_exec-fsys_fat.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/fat_stage1_5_exec-stage1_5.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/ffs_stage1_5_exec-bios.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/ffs_stage1_5_exec-char_io.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/ffs_stage1_5_exec-common.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/ffs_stage1_5_exec-disk_io.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/ffs_stage1_5_exec-fsys_ffs.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/ffs_stage1_5_exec-stage1_5.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/iso9660_stage1_5_exec-bios.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/iso9660_stage1_5_exec-char_io.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/iso9660_stage1_5_exec-common.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/iso9660_stage1_5_exec-disk_io.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/iso9660_stage1_5_exec-fsys_iso9660.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/iso9660_stage1_5_exec-stage1_5.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/jfs_stage1_5_exec-bios.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/jfs_stage1_5_exec-char_io.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/jfs_stage1_5_exec-common.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/jfs_stage1_5_exec-disk_io.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/jfs_stage1_5_exec-fsys_jfs.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/jfs_stage1_5_exec-stage1_5.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/libgrub_a-boot.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/libgrub_a-builtins.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/libgrub_a-char_io.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/libgrub_a-cmdline.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/libgrub_a-common.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/libgrub_a-disk_io.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/libgrub_a-fsys_ext2fs.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/libgrub_a-fsys_fat.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/libgrub_a-fsys_ffs.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/libgrub_a-fsys_iso9660.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/libgrub_a-fsys_jfs.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/libgrub_a-fsys_minix.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/libgrub_a-fsys_reiserfs.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/libgrub_a-zfs_sha256.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/libgrub_a-zfs_lzjb.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/libgrub_a-zfs_fletcher.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/libgrub_a-fsys_zfs.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/libgrub_a-fsys_ufs.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/libgrub_a-fsys_ufs2.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/libgrub_a-fsys_vstafs.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/libgrub_a-fsys_xfs.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/libgrub_a-graphics.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/libgrub_a-gunzip.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/libgrub_a-md5.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/libgrub_a-serial.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/libgrub_a-stage2.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/libgrub_a-terminfo.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/libgrub_a-tparm.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/minix_stage1_5_exec-bios.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/minix_stage1_5_exec-char_io.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/minix_stage1_5_exec-common.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/minix_stage1_5_exec-disk_io.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/minix_stage1_5_exec-fsys_minix.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/minix_stage1_5_exec-stage1_5.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/pre_stage2_exec-bios.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/pre_stage2_exec-boot.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/pre_stage2_exec-builtins.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/pre_stage2_exec-char_io.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/pre_stage2_exec-cmdline.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/pre_stage2_exec-common.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/pre_stage2_exec-console.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/pre_stage2_exec-disk_io.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/pre_stage2_exec-fsys_ext2fs.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/pre_stage2_exec-fsys_fat.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/pre_stage2_exec-fsys_ffs.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/pre_stage2_exec-fsys_iso9660.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/pre_stage2_exec-fsys_jfs.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/pre_stage2_exec-fsys_minix.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/pre_stage2_exec-fsys_reiserfs.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/pre_stage2_exec-zfs_sha256.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/pre_stage2_exec-zfs_lzjb.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/pre_stage2_exec-zfs_fletcher.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/pre_stage2_exec-fsys_zfs.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/pre_stage2_exec-fsys_ufs.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/pre_stage2_exec-fsys_ufs2.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/pre_stage2_exec-fsys_vstafs.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/pre_stage2_exec-fsys_xfs.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/pre_stage2_exec-graphics.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/pre_stage2_exec-gunzip.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/pre_stage2_exec-hercules.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/pre_stage2_exec-md5.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/pre_stage2_exec-serial.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/pre_stage2_exec-smp-imps.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/pre_stage2_exec-stage2.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/pre_stage2_exec-terminfo.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/pre_stage2_exec-tparm.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/reiserfs_stage1_5_exec-bios.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/reiserfs_stage1_5_exec-char_io.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/reiserfs_stage1_5_exec-common.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/reiserfs_stage1_5_exec-disk_io.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/reiserfs_stage1_5_exec-fsys_reiserfs.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/reiserfs_stage1_5_exec-stage1_5.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/ufs2_stage1_5_exec-bios.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/ufs2_stage1_5_exec-char_io.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/ufs2_stage1_5_exec-common.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/ufs2_stage1_5_exec-disk_io.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/ufs2_stage1_5_exec-fsys_ufs2.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/ufs2_stage1_5_exec-stage1_5.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/ufs_stage1_5_exec-bios.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/ufs_stage1_5_exec-char_io.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/ufs_stage1_5_exec-common.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/ufs_stage1_5_exec-disk_io.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/ufs_stage1_5_exec-fsys_ufs.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/ufs_stage1_5_exec-stage1_5.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/zfs_stage1_5_exec-bios.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/zfs_stage1_5_exec-char_io.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/zfs_stage1_5_exec-common.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/zfs_stage1_5_exec-disk_io.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/zfs_stage1_5_exec-zfs_sha256.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/zfs_stage1_5_exec-zfs_lzjb.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/zfs_stage1_5_exec-zfs_fletcher.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/zfs_stage1_5_exec-fsys_zfs.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/zfs_stage1_5_exec-stage1_5.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/vstafs_stage1_5_exec-bios.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/vstafs_stage1_5_exec-char_io.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/vstafs_stage1_5_exec-common.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/vstafs_stage1_5_exec-disk_io.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/vstafs_stage1_5_exec-fsys_vstafs.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/vstafs_stage1_5_exec-stage1_5.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/xfs_stage1_5_exec-bios.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/xfs_stage1_5_exec-char_io.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/xfs_stage1_5_exec-common.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/xfs_stage1_5_exec-disk_io.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/xfs_stage1_5_exec-fsys_xfs.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/xfs_stage1_5_exec-stage1_5.Po -CCASCOMPILE = $(CCAS) $(AM_CCASFLAGS) $(CCASFLAGS) -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(libgrub_a_SOURCES) $(diskless_exec_SOURCES) \ - $(e2fs_stage1_5_exec_SOURCES) $(fat_stage1_5_exec_SOURCES) \ - $(ffs_stage1_5_exec_SOURCES) $(iso9660_stage1_5_exec_SOURCES) \ - $(jfs_stage1_5_exec_SOURCES) $(minix_stage1_5_exec_SOURCES) \ - $(nbloader_exec_SOURCES) $(pre_stage2_exec_SOURCES) \ - $(pxeloader_exec_SOURCES) $(reiserfs_stage1_5_exec_SOURCES) \ - $(start_exec_SOURCES) $(start_eltorito_exec_SOURCES) \ - $(ufs2_stage1_5_exec_SOURCES) $(ufs_stage1_5_exec_SOURCES) \ - $(zfs_stage1_5_exec_SOURCES) \ - $(vstafs_stage1_5_exec_SOURCES) $(xfs_stage1_5_exec_SOURCES) -DIST_SOURCES = $(libgrub_a_SOURCES) $(diskless_exec_SOURCES) \ - $(e2fs_stage1_5_exec_SOURCES) $(fat_stage1_5_exec_SOURCES) \ - $(ffs_stage1_5_exec_SOURCES) $(iso9660_stage1_5_exec_SOURCES) \ - $(jfs_stage1_5_exec_SOURCES) $(minix_stage1_5_exec_SOURCES) \ - $(nbloader_exec_SOURCES) $(pre_stage2_exec_SOURCES) \ - $(pxeloader_exec_SOURCES) $(reiserfs_stage1_5_exec_SOURCES) \ - $(start_exec_SOURCES) $(start_eltorito_exec_SOURCES) \ - $(ufs2_stage1_5_exec_SOURCES) $(ufs_stage1_5_exec_SOURCES) \ - $(zfs_stage1_5_exec_SOURCES) \ - $(vstafs_stage1_5_exec_SOURCES) $(xfs_stage1_5_exec_SOURCES) -am__installdirs = "$(DESTDIR)$(pkglibdir)" -pkglibDATA_INSTALL = $(INSTALL_DATA) -DATA = $(noinst_DATA) $(pkglib_DATA) -HEADERS = $(noinst_HEADERS) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -# Stage 2 and Stage 1.5's. -pkglibdir = $(libdir)/$(PACKAGE)/$(host_cpu)-$(host_vendor) -ACLOCAL = @ACLOCAL@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BUILD_EXAMPLE_KERNEL_FALSE = @BUILD_EXAMPLE_KERNEL_FALSE@ -BUILD_EXAMPLE_KERNEL_TRUE = @BUILD_EXAMPLE_KERNEL_TRUE@ -CC = @CC@ -CCAS = @CCAS@ -CCASFLAGS = @CCASFLAGS@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DISKLESS_SUPPORT_FALSE = @DISKLESS_SUPPORT_FALSE@ -DISKLESS_SUPPORT_TRUE = @DISKLESS_SUPPORT_TRUE@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FSYS_CFLAGS = @FSYS_CFLAGS@ -GRAPHICS_SUPPORT_FALSE = @GRAPHICS_SUPPORT_FALSE@ -GRAPHICS_SUPPORT_TRUE = @GRAPHICS_SUPPORT_TRUE@ -GRUB_CFLAGS = @GRUB_CFLAGS@ -GRUB_LIBS = @GRUB_LIBS@ -HERCULES_SUPPORT_FALSE = @HERCULES_SUPPORT_FALSE@ -HERCULES_SUPPORT_TRUE = @HERCULES_SUPPORT_TRUE@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LTLIBOBJS = @LTLIBOBJS@ -MAINT = @MAINT@ -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ -MAKEINFO = @MAKEINFO@ -NETBOOT_DRIVERS = @NETBOOT_DRIVERS@ -NETBOOT_SUPPORT_FALSE = @NETBOOT_SUPPORT_FALSE@ -NETBOOT_SUPPORT_TRUE = @NETBOOT_SUPPORT_TRUE@ -NET_CFLAGS = @NET_CFLAGS@ -NET_EXTRAFLAGS = @NET_EXTRAFLAGS@ -OBJCOPY = @OBJCOPY@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -RANLIB = @RANLIB@ -SERIAL_SPEED_SIMULATION_FALSE = @SERIAL_SPEED_SIMULATION_FALSE@ -SERIAL_SPEED_SIMULATION_TRUE = @SERIAL_SPEED_SIMULATION_TRUE@ -SERIAL_SUPPORT_FALSE = @SERIAL_SUPPORT_FALSE@ -SERIAL_SUPPORT_TRUE = @SERIAL_SUPPORT_TRUE@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STAGE1_CFLAGS = @STAGE1_CFLAGS@ -STAGE2_CFLAGS = @STAGE2_CFLAGS@ -STRIP = @STRIP@ -VERSION = @VERSION@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_OBJCOPY = @ac_ct_OBJCOPY@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ - -# For test target. -TESTS = size_test -noinst_SCRIPTS = $(TESTS) - -# For dist target. -noinst_HEADERS = apic.h defs.h dir.h disk_inode.h disk_inode_ffs.h \ - fat.h filesys.h freebsd.h fs.h hercules.h i386-elf.h \ - imgact_aout.h iso9660.h jfs.h mb_header.h mb_info.h md5.h \ - nbi.h pc_slice.h serial.h shared.h smp-imps.h term.h \ - terminfo.h tparm.h nbi.h fsys_zfs.h ufs.h ufs2.h vstafs.h xfs.h graphics.h - -EXTRA_DIST = setjmp.S apm.S $(noinst_SCRIPTS) - -# For . -INCLUDES = -I$(top_srcdir)/stage1 - -# The library for /sbin/grub. -noinst_LIBRARIES = libgrub.a -libgrub_a_SOURCES = boot.c builtins.c char_io.c cmdline.c common.c \ - disk_io.c fsys_ext2fs.c fsys_fat.c fsys_ffs.c fsys_iso9660.c \ - fsys_jfs.c fsys_minix.c fsys_reiserfs.c fsys_ufs.c fsys_ufs2.c \ - zfs_sha256.c zfs_lzjb.c zfs_fletcher.c fsys_zfs.c \ - fsys_vstafs.c fsys_xfs.c gunzip.c md5.c serial.c stage2.c \ - terminfo.c tparm.c graphics.c - -libgrub_a_CFLAGS = $(GRUB_CFLAGS) -I$(top_srcdir)/lib \ - -DGRUB_UTIL=1 -DFSYS_EXT2FS=1 -DFSYS_FAT=1 -DFSYS_FFS=1 \ - -DFSYS_ISO9660=1 -DFSYS_JFS=1 -DFSYS_MINIX=1 -DFSYS_REISERFS=1 \ - -DFSYS_ZFS=1 -DFSYS_UFS=1 -DFSYS_UFS2=1 -DFSYS_VSTAFS=1 -DFSYS_XFS=1 \ - -DUSE_MD5_PASSWORDS=1 -DSUPPORT_SERIAL=1 -DSUPPORT_HERCULES=1 \ - -fwritable-strings - -@DISKLESS_SUPPORT_FALSE@pkglib_DATA = stage2 stage2_eltorito e2fs_stage1_5 fat_stage1_5 \ -@DISKLESS_SUPPORT_FALSE@ ffs_stage1_5 iso9660_stage1_5 jfs_stage1_5 minix_stage1_5 \ -@DISKLESS_SUPPORT_FALSE@ zfs_stage1_5 \ -@DISKLESS_SUPPORT_FALSE@ reiserfs_stage1_5 ufs_stage1_5 ufs2_stage1_5 vstafs_stage1_5 \ -@DISKLESS_SUPPORT_FALSE@ xfs_stage1_5 - -@DISKLESS_SUPPORT_TRUE@pkglib_DATA = stage2 stage2_eltorito e2fs_stage1_5 fat_stage1_5 \ -@DISKLESS_SUPPORT_TRUE@ ffs_stage1_5 iso9660_stage1_5 jfs_stage1_5 minix_stage1_5 \ -@DISKLESS_SUPPORT_TRUE@ zfs_stage1_5 \ -@DISKLESS_SUPPORT_TRUE@ reiserfs_stage1_5 ufs_stage1_5 ufs2_stage1_5 vstafs_stage1_5 \ -@DISKLESS_SUPPORT_TRUE@ xfs_stage1_5 nbgrub pxegrub - -@DISKLESS_SUPPORT_FALSE@noinst_DATA = pre_stage2 start start_eltorito -@DISKLESS_SUPPORT_TRUE@noinst_DATA = pre_stage2 start start_eltorito nbloader pxeloader diskless -MOSTLYCLEANFILES = $(noinst_PROGRAMS) -PRE_STAGE2_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,8200 -START_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,8000 -NBLOADER_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,0 -PXELOADER_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,7C00 -START_ELTORITO_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,7C00 -@NETBOOT_SUPPORT_FALSE@NETBOOT_FLAGS = -@NETBOOT_SUPPORT_TRUE@NETBOOT_FLAGS = -I$(top_srcdir)/netboot -DSUPPORT_NETBOOT=1 -@SERIAL_SUPPORT_FALSE@SERIAL_FLAGS = -@SERIAL_SUPPORT_TRUE@SERIAL_FLAGS = -DSUPPORT_SERIAL=1 -@HERCULES_SUPPORT_FALSE@HERCULES_FLAGS = -@HERCULES_SUPPORT_TRUE@HERCULES_FLAGS = -DSUPPORT_HERCULES=1 -@GRAPHICS_SUPPORT_FALSE@GRAPHICS_FLAGS = -@GRAPHICS_SUPPORT_TRUE@GRAPHICS_FLAGS = -DSUPPORT_GRAPHICS=1 -STAGE2_COMPILE = $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ - $(NETBOOT_FLAGS) $(SERIAL_FLAGS) $(HERCULES_FLAGS) $(GRAPHICS_FLAGS) - -STAGE1_5_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,2000 -STAGE1_5_COMPILE = $(STAGE2_COMPILE) -DNO_DECOMPRESSION=1 -DSTAGE1_5=1 - -# For stage2 target. -pre_stage2_exec_SOURCES = asm.S bios.c boot.c builtins.c char_io.c \ - cmdline.c common.c console.c disk_io.c fsys_ext2fs.c \ - fsys_fat.c fsys_ffs.c fsys_iso9660.c fsys_jfs.c fsys_minix.c \ - fsys_zfs.c zfs_fletcher.c zfs_lzjb.c zfs_sha256.c \ - fsys_reiserfs.c fsys_ufs.c fsys_ufs2.c fsys_vstafs.c fsys_xfs.c \ - gunzip.c hercules.c md5.c serial.c smp-imps.c stage2.c terminfo.c \ - tparm.c graphics.c - -pre_stage2_exec_CFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS) -pre_stage2_exec_CCASFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS) -pre_stage2_exec_LDFLAGS = $(PRE_STAGE2_LINK) -@NETBOOT_SUPPORT_TRUE@pre_stage2_exec_LDADD = ../netboot/libdrivers.a -@DISKLESS_SUPPORT_FALSE@BUILT_SOURCES = stage2_size.h -@DISKLESS_SUPPORT_TRUE@BUILT_SOURCES = stage2_size.h diskless_size.h -CLEANFILES = $(pkglib_DATA) $(noinst_DATA) $(BUILT_SOURCES) -start_exec_SOURCES = start.S -start_exec_CCASFLAGS = $(STAGE2_COMPILE) -start_exec_LDFLAGS = $(START_LINK) -start_eltorito_exec_SOURCES = start_eltorito.S -start_eltorito_exec_CCASFLAGS = $(STAGE2_COMPILE) -start_eltorito_exec_LDFLAGS = $(START_ELTORITO_LINK) - -# For e2fs_stage1_5 target. -e2fs_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c disk_io.c \ - stage1_5.c fsys_ext2fs.c bios.c - -e2fs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_EXT2FS=1 \ - -DNO_BLOCK_FILES=1 - -e2fs_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_EXT2FS=1 \ - -DNO_BLOCK_FILES=1 - -e2fs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) - -# For fat_stage1_5 target. -fat_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c disk_io.c \ - stage1_5.c fsys_fat.c bios.c - -fat_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_FAT=1 \ - -DNO_BLOCK_FILES=1 - -fat_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_FAT=1 \ - -DNO_BLOCK_FILES=1 - -fat_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) - -# For ffs_stage1_5 target. -ffs_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c disk_io.c \ - stage1_5.c fsys_ffs.c bios.c - -ffs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_FFS=1 \ - -DNO_BLOCK_FILES=1 - -ffs_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_FFS=1 \ - -DNO_BLOCK_FILES=1 - -ffs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) - -# For zfs_stage1_5 target. -zfs_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c disk_io.c \ - stage1_5.c fsys_zfs.c zfs_fletcher.c zfs_lzjb.c zfs_sha256.c bios.c - -zfs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_ZFS=1 \ - -DNO_BLOCK_FILES=1 - -zfs_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_ZFS=1 \ - -DNO_BLOCK_FILES=1 - -zfs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) - -# For ufs_stage1_5 target. -ufs_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c disk_io.c \ - stage1_5.c fsys_ufs.c bios.c - -ufs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_UFS=1 \ - -DNO_BLOCK_FILES=1 - -ufs_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_UFS=1 \ - -DNO_BLOCK_FILES=1 - -ufs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) - -# For ufs2_stage1_5 target. -ufs2_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c disk_io.c \ - stage1_5.c fsys_ufs2.c bios.c - -ufs2_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_UFS2=1 \ - -DNO_BLOCK_FILES=1 - -ufs2_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_UFS2=1 \ - -DNO_BLOCK_FILES=1 - -ufs2_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) - -# For minix_stage1_5 target. -minix_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c disk_io.c \ - stage1_5.c fsys_minix.c bios.c - -minix_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_MINIX=1 \ - -DNO_BLOCK_FILES=1 - -minix_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_MINIX=1 \ - -DNO_BLOCK_FILES=1 - -minix_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) - -# For reiserfs_stage1_5 target. -reiserfs_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c \ - disk_io.c stage1_5.c fsys_reiserfs.c bios.c - -reiserfs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_REISERFS=1 \ - -DNO_BLOCK_FILES=1 - -reiserfs_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_REISERFS=1 \ - -DNO_BLOCK_FILES=1 - -reiserfs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) - -# For vstafs_stage1_5 target. -vstafs_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c \ - disk_io.c stage1_5.c fsys_vstafs.c bios.c - -vstafs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_VSTAFS=1 \ - -DNO_BLOCK_FILES=1 - -vstafs_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_VSTAFS=1 \ - -DNO_BLOCK_FILES=1 - -vstafs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) - -# For jfs_stage1_5 target. -jfs_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c \ - disk_io.c stage1_5.c fsys_jfs.c bios.c - -jfs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_JFS=1 \ - -DNO_BLOCK_FILES=1 - -jfs_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_JFS=1 \ - -DNO_BLOCK_FILES=1 - -jfs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) - -# For xfs_stage1_5 target. -xfs_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c \ - disk_io.c stage1_5.c fsys_xfs.c bios.c - -xfs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_XFS=1 \ - -DNO_BLOCK_FILES=1 - -xfs_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_XFS=1 \ - -DNO_BLOCK_FILES=1 - -xfs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) - -# For iso9660_stage1_5 target. -iso9660_stage1_5_exec_SOURCES = start_eltorito.S asm.S common.c char_io.c \ - disk_io.c stage1_5.c fsys_iso9660.c bios.c - -iso9660_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_ISO9660=1 \ - -DNO_BLOCK_FILES=1 - -iso9660_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_ISO9660=1 \ - -DNO_BLOCK_FILES=1 - -iso9660_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) - -# For diskless target. -diskless_exec_SOURCES = $(pre_stage2_exec_SOURCES) -diskless_exec_CFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS) \ - -DSUPPORT_DISKLESS=1 - -diskless_exec_CCASFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS) \ - -DSUPPORT_DISKLESS=1 - -diskless_exec_LDFLAGS = $(PRE_STAGE2_LINK) -diskless_exec_LDADD = ../netboot/libdrivers.a - -# For nbloader target. -nbloader_exec_SOURCES = nbloader.S -nbloader_exec_CCASFLAGS = $(STAGE2_COMPILE) -nbloader_exec_LDFLAGS = $(NBLOADER_LINK) - -# For pxeloader target. -pxeloader_exec_SOURCES = pxeloader.S -pxeloader_exec_CCASFLAGS = $(STAGE2_COMPILE) -pxeloader_exec_LDFLAGS = $(PXELOADER_LINK) - -# General rule for making a raw binary. -SUFFIXES = .exec -all: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) all-am - -.SUFFIXES: -.SUFFIXES: .exec .S .c .o .obj -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu stage2/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu stage2/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -clean-noinstLIBRARIES: - -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) -libgrub.a: $(libgrub_a_OBJECTS) $(libgrub_a_DEPENDENCIES) - -rm -f libgrub.a - $(libgrub_a_AR) libgrub.a $(libgrub_a_OBJECTS) $(libgrub_a_LIBADD) - $(RANLIB) libgrub.a - -clean-noinstPROGRAMS: - -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) -diskless.exec$(EXEEXT): $(diskless_exec_OBJECTS) $(diskless_exec_DEPENDENCIES) - @rm -f diskless.exec$(EXEEXT) - $(LINK) $(diskless_exec_LDFLAGS) $(diskless_exec_OBJECTS) $(diskless_exec_LDADD) $(LIBS) -e2fs_stage1_5.exec$(EXEEXT): $(e2fs_stage1_5_exec_OBJECTS) $(e2fs_stage1_5_exec_DEPENDENCIES) - @rm -f e2fs_stage1_5.exec$(EXEEXT) - $(LINK) $(e2fs_stage1_5_exec_LDFLAGS) $(e2fs_stage1_5_exec_OBJECTS) $(e2fs_stage1_5_exec_LDADD) $(LIBS) -fat_stage1_5.exec$(EXEEXT): $(fat_stage1_5_exec_OBJECTS) $(fat_stage1_5_exec_DEPENDENCIES) - @rm -f fat_stage1_5.exec$(EXEEXT) - $(LINK) $(fat_stage1_5_exec_LDFLAGS) $(fat_stage1_5_exec_OBJECTS) $(fat_stage1_5_exec_LDADD) $(LIBS) -ffs_stage1_5.exec$(EXEEXT): $(ffs_stage1_5_exec_OBJECTS) $(ffs_stage1_5_exec_DEPENDENCIES) - @rm -f ffs_stage1_5.exec$(EXEEXT) - $(LINK) $(ffs_stage1_5_exec_LDFLAGS) $(ffs_stage1_5_exec_OBJECTS) $(ffs_stage1_5_exec_LDADD) $(LIBS) -iso9660_stage1_5.exec$(EXEEXT): $(iso9660_stage1_5_exec_OBJECTS) $(iso9660_stage1_5_exec_DEPENDENCIES) - @rm -f iso9660_stage1_5.exec$(EXEEXT) - $(LINK) $(iso9660_stage1_5_exec_LDFLAGS) $(iso9660_stage1_5_exec_OBJECTS) $(iso9660_stage1_5_exec_LDADD) $(LIBS) -jfs_stage1_5.exec$(EXEEXT): $(jfs_stage1_5_exec_OBJECTS) $(jfs_stage1_5_exec_DEPENDENCIES) - @rm -f jfs_stage1_5.exec$(EXEEXT) - $(LINK) $(jfs_stage1_5_exec_LDFLAGS) $(jfs_stage1_5_exec_OBJECTS) $(jfs_stage1_5_exec_LDADD) $(LIBS) -minix_stage1_5.exec$(EXEEXT): $(minix_stage1_5_exec_OBJECTS) $(minix_stage1_5_exec_DEPENDENCIES) - @rm -f minix_stage1_5.exec$(EXEEXT) - $(LINK) $(minix_stage1_5_exec_LDFLAGS) $(minix_stage1_5_exec_OBJECTS) $(minix_stage1_5_exec_LDADD) $(LIBS) -nbloader.exec$(EXEEXT): $(nbloader_exec_OBJECTS) $(nbloader_exec_DEPENDENCIES) - @rm -f nbloader.exec$(EXEEXT) - $(LINK) $(nbloader_exec_LDFLAGS) $(nbloader_exec_OBJECTS) $(nbloader_exec_LDADD) $(LIBS) -pre_stage2.exec$(EXEEXT): $(pre_stage2_exec_OBJECTS) $(pre_stage2_exec_DEPENDENCIES) - @rm -f pre_stage2.exec$(EXEEXT) - $(LINK) $(pre_stage2_exec_LDFLAGS) $(pre_stage2_exec_OBJECTS) $(pre_stage2_exec_LDADD) $(LIBS) -pxeloader.exec$(EXEEXT): $(pxeloader_exec_OBJECTS) $(pxeloader_exec_DEPENDENCIES) - @rm -f pxeloader.exec$(EXEEXT) - $(LINK) $(pxeloader_exec_LDFLAGS) $(pxeloader_exec_OBJECTS) $(pxeloader_exec_LDADD) $(LIBS) -reiserfs_stage1_5.exec$(EXEEXT): $(reiserfs_stage1_5_exec_OBJECTS) $(reiserfs_stage1_5_exec_DEPENDENCIES) - @rm -f reiserfs_stage1_5.exec$(EXEEXT) - $(LINK) $(reiserfs_stage1_5_exec_LDFLAGS) $(reiserfs_stage1_5_exec_OBJECTS) $(reiserfs_stage1_5_exec_LDADD) $(LIBS) -start.exec$(EXEEXT): $(start_exec_OBJECTS) $(start_exec_DEPENDENCIES) - @rm -f start.exec$(EXEEXT) - $(LINK) $(start_exec_LDFLAGS) $(start_exec_OBJECTS) $(start_exec_LDADD) $(LIBS) -start_eltorito.exec$(EXEEXT): $(start_eltorito_exec_OBJECTS) $(start_eltorito_exec_DEPENDENCIES) - @rm -f start_eltorito.exec$(EXEEXT) - $(LINK) $(start_eltorito_exec_LDFLAGS) $(start_eltorito_exec_OBJECTS) $(start_eltorito_exec_LDADD) $(LIBS) -zfs_stage1_5.exec$(EXEEXT): $(zfs_stage1_5_exec_OBJECTS) $(zfs_stage1_5_exec_DEPENDENCIES) - @rm -f zfs_stage1_5.exec$(EXEEXT) - $(LINK) $(zfs_stage1_5_exec_LDFLAGS) $(zfs_stage1_5_exec_OBJECTS) $(zfs_stage1_5_exec_LDADD) $(LIBS) -ufs2_stage1_5.exec$(EXEEXT): $(ufs2_stage1_5_exec_OBJECTS) $(ufs2_stage1_5_exec_DEPENDENCIES) - @rm -f ufs2_stage1_5.exec$(EXEEXT) - $(LINK) $(ufs2_stage1_5_exec_LDFLAGS) $(ufs2_stage1_5_exec_OBJECTS) $(ufs2_stage1_5_exec_LDADD) $(LIBS) -ufs_stage1_5.exec$(EXEEXT): $(ufs_stage1_5_exec_OBJECTS) $(ufs_stage1_5_exec_DEPENDENCIES) - @rm -f ufs_stage1_5.exec$(EXEEXT) - $(LINK) $(ufs_stage1_5_exec_LDFLAGS) $(ufs_stage1_5_exec_OBJECTS) $(ufs_stage1_5_exec_LDADD) $(LIBS) -vstafs_stage1_5.exec$(EXEEXT): $(vstafs_stage1_5_exec_OBJECTS) $(vstafs_stage1_5_exec_DEPENDENCIES) - @rm -f vstafs_stage1_5.exec$(EXEEXT) - $(LINK) $(vstafs_stage1_5_exec_LDFLAGS) $(vstafs_stage1_5_exec_OBJECTS) $(vstafs_stage1_5_exec_LDADD) $(LIBS) -xfs_stage1_5.exec$(EXEEXT): $(xfs_stage1_5_exec_OBJECTS) $(xfs_stage1_5_exec_DEPENDENCIES) - @rm -f xfs_stage1_5.exec$(EXEEXT) - $(LINK) $(xfs_stage1_5_exec_LDFLAGS) $(xfs_stage1_5_exec_OBJECTS) $(xfs_stage1_5_exec_LDADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskless_exec-bios.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskless_exec-boot.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskless_exec-builtins.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskless_exec-char_io.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskless_exec-cmdline.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskless_exec-common.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskless_exec-console.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskless_exec-disk_io.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskless_exec-fsys_ext2fs.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskless_exec-fsys_fat.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskless_exec-fsys_ffs.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskless_exec-fsys_iso9660.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskless_exec-fsys_jfs.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskless_exec-fsys_minix.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskless_exec-fsys_reiserfs.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskless_exec-zfs_sha256.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskless_exec-zfs_lzjb.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskless_exec-zfs_fletcher.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskless_exec-fsys_zfs.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskless_exec-fsys_ufs.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskless_exec-fsys_ufs2.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskless_exec-fsys_vstafs.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskless_exec-fsys_xfs.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskless_exec-graphics.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskless_exec-gunzip.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskless_exec-hercules.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskless_exec-md5.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskless_exec-serial.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskless_exec-smp-imps.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskless_exec-stage2.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskless_exec-terminfo.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskless_exec-tparm.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/e2fs_stage1_5_exec-bios.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/e2fs_stage1_5_exec-char_io.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/e2fs_stage1_5_exec-common.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/e2fs_stage1_5_exec-disk_io.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/e2fs_stage1_5_exec-fsys_ext2fs.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/e2fs_stage1_5_exec-stage1_5.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fat_stage1_5_exec-bios.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fat_stage1_5_exec-char_io.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fat_stage1_5_exec-common.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fat_stage1_5_exec-disk_io.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fat_stage1_5_exec-fsys_fat.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fat_stage1_5_exec-stage1_5.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ffs_stage1_5_exec-bios.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ffs_stage1_5_exec-char_io.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ffs_stage1_5_exec-common.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ffs_stage1_5_exec-disk_io.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ffs_stage1_5_exec-fsys_ffs.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ffs_stage1_5_exec-stage1_5.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iso9660_stage1_5_exec-bios.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iso9660_stage1_5_exec-char_io.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iso9660_stage1_5_exec-common.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iso9660_stage1_5_exec-disk_io.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iso9660_stage1_5_exec-fsys_iso9660.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iso9660_stage1_5_exec-stage1_5.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jfs_stage1_5_exec-bios.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jfs_stage1_5_exec-char_io.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jfs_stage1_5_exec-common.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jfs_stage1_5_exec-disk_io.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jfs_stage1_5_exec-fsys_jfs.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jfs_stage1_5_exec-stage1_5.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgrub_a-boot.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgrub_a-builtins.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgrub_a-char_io.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgrub_a-cmdline.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgrub_a-common.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgrub_a-disk_io.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgrub_a-fsys_ext2fs.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgrub_a-fsys_fat.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgrub_a-fsys_ffs.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgrub_a-fsys_iso9660.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgrub_a-fsys_jfs.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgrub_a-fsys_minix.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgrub_a-fsys_reiserfs.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgrub_a-zfs_sha256.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgrub_a-zfs_lzjb.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgrub_a-zfs_fletcher.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgrub_a-fsys_zfs.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgrub_a-fsys_ufs.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgrub_a-fsys_ufs2.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgrub_a-fsys_vstafs.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgrub_a-fsys_xfs.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgrub_a-graphics.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgrub_a-gunzip.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgrub_a-md5.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgrub_a-serial.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgrub_a-stage2.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgrub_a-terminfo.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgrub_a-tparm.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/minix_stage1_5_exec-bios.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/minix_stage1_5_exec-char_io.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/minix_stage1_5_exec-common.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/minix_stage1_5_exec-disk_io.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/minix_stage1_5_exec-fsys_minix.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/minix_stage1_5_exec-stage1_5.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_stage2_exec-bios.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_stage2_exec-boot.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_stage2_exec-builtins.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_stage2_exec-char_io.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_stage2_exec-cmdline.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_stage2_exec-common.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_stage2_exec-console.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_stage2_exec-disk_io.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_stage2_exec-fsys_ext2fs.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_stage2_exec-fsys_fat.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_stage2_exec-fsys_ffs.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_stage2_exec-fsys_iso9660.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_stage2_exec-fsys_jfs.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_stage2_exec-fsys_minix.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_stage2_exec-fsys_reiserfs.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_stage2_exec-zfs_sha256.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_stage2_exec-zfs_lzjb.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_stage2_exec-zfs_fletcher.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_stage2_exec-fsys_zfs.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_stage2_exec-fsys_ufs.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_stage2_exec-fsys_ufs2.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_stage2_exec-fsys_vstafs.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_stage2_exec-fsys_xfs.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_stage2_exec-graphics.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_stage2_exec-gunzip.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_stage2_exec-hercules.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_stage2_exec-md5.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_stage2_exec-serial.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_stage2_exec-smp-imps.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_stage2_exec-stage2.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_stage2_exec-terminfo.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_stage2_exec-tparm.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/reiserfs_stage1_5_exec-bios.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/reiserfs_stage1_5_exec-char_io.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/reiserfs_stage1_5_exec-common.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/reiserfs_stage1_5_exec-disk_io.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/reiserfs_stage1_5_exec-fsys_reiserfs.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/reiserfs_stage1_5_exec-stage1_5.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ufs2_stage1_5_exec-bios.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ufs2_stage1_5_exec-char_io.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ufs2_stage1_5_exec-common.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ufs2_stage1_5_exec-disk_io.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ufs2_stage1_5_exec-fsys_ufs2.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ufs2_stage1_5_exec-stage1_5.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ufs_stage1_5_exec-bios.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ufs_stage1_5_exec-char_io.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ufs_stage1_5_exec-common.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ufs_stage1_5_exec-disk_io.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ufs_stage1_5_exec-fsys_ufs.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ufs_stage1_5_exec-stage1_5.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zfs_stage1_5_exec-bios.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zfs_stage1_5_exec-char_io.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zfs_stage1_5_exec-common.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zfs_stage1_5_exec-disk_io.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zfs_stage1_5_exec-zfs_sha256.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zfs_stage1_5_exec-zfs_lzjb.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zfs_stage1_5_exec-zfs_fletcher.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zfs_stage1_5_exec-fsys_zfs.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zfs_stage1_5_exec-stage1_5.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vstafs_stage1_5_exec-bios.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vstafs_stage1_5_exec-char_io.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vstafs_stage1_5_exec-common.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vstafs_stage1_5_exec-disk_io.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vstafs_stage1_5_exec-fsys_vstafs.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vstafs_stage1_5_exec-stage1_5.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xfs_stage1_5_exec-bios.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xfs_stage1_5_exec-char_io.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xfs_stage1_5_exec-common.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xfs_stage1_5_exec-disk_io.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xfs_stage1_5_exec-fsys_xfs.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xfs_stage1_5_exec-stage1_5.Po@am__quote@ - -.S.o: - $(CCASCOMPILE) -c $< - -.S.obj: - $(CCASCOMPILE) -c `$(CYGPATH_W) '$<'` - -diskless_exec-asm.o: asm.S - $(CCAS) $(diskless_exec_CCASFLAGS) $(CCASFLAGS) -c -o diskless_exec-asm.o `test -f 'asm.S' || echo '$(srcdir)/'`asm.S - -diskless_exec-asm.obj: asm.S - $(CCAS) $(diskless_exec_CCASFLAGS) $(CCASFLAGS) -c -o diskless_exec-asm.obj `if test -f 'asm.S'; then $(CYGPATH_W) 'asm.S'; else $(CYGPATH_W) '$(srcdir)/asm.S'; fi` - -e2fs_stage1_5_exec-start.o: start.S - $(CCAS) $(e2fs_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o e2fs_stage1_5_exec-start.o `test -f 'start.S' || echo '$(srcdir)/'`start.S - -e2fs_stage1_5_exec-start.obj: start.S - $(CCAS) $(e2fs_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o e2fs_stage1_5_exec-start.obj `if test -f 'start.S'; then $(CYGPATH_W) 'start.S'; else $(CYGPATH_W) '$(srcdir)/start.S'; fi` - -e2fs_stage1_5_exec-asm.o: asm.S - $(CCAS) $(e2fs_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o e2fs_stage1_5_exec-asm.o `test -f 'asm.S' || echo '$(srcdir)/'`asm.S - -e2fs_stage1_5_exec-asm.obj: asm.S - $(CCAS) $(e2fs_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o e2fs_stage1_5_exec-asm.obj `if test -f 'asm.S'; then $(CYGPATH_W) 'asm.S'; else $(CYGPATH_W) '$(srcdir)/asm.S'; fi` - -fat_stage1_5_exec-start.o: start.S - $(CCAS) $(fat_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o fat_stage1_5_exec-start.o `test -f 'start.S' || echo '$(srcdir)/'`start.S - -fat_stage1_5_exec-start.obj: start.S - $(CCAS) $(fat_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o fat_stage1_5_exec-start.obj `if test -f 'start.S'; then $(CYGPATH_W) 'start.S'; else $(CYGPATH_W) '$(srcdir)/start.S'; fi` - -fat_stage1_5_exec-asm.o: asm.S - $(CCAS) $(fat_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o fat_stage1_5_exec-asm.o `test -f 'asm.S' || echo '$(srcdir)/'`asm.S - -fat_stage1_5_exec-asm.obj: asm.S - $(CCAS) $(fat_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o fat_stage1_5_exec-asm.obj `if test -f 'asm.S'; then $(CYGPATH_W) 'asm.S'; else $(CYGPATH_W) '$(srcdir)/asm.S'; fi` - -ffs_stage1_5_exec-start.o: start.S - $(CCAS) $(ffs_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o ffs_stage1_5_exec-start.o `test -f 'start.S' || echo '$(srcdir)/'`start.S - -ffs_stage1_5_exec-start.obj: start.S - $(CCAS) $(ffs_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o ffs_stage1_5_exec-start.obj `if test -f 'start.S'; then $(CYGPATH_W) 'start.S'; else $(CYGPATH_W) '$(srcdir)/start.S'; fi` - -ffs_stage1_5_exec-asm.o: asm.S - $(CCAS) $(ffs_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o ffs_stage1_5_exec-asm.o `test -f 'asm.S' || echo '$(srcdir)/'`asm.S - -ffs_stage1_5_exec-asm.obj: asm.S - $(CCAS) $(ffs_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o ffs_stage1_5_exec-asm.obj `if test -f 'asm.S'; then $(CYGPATH_W) 'asm.S'; else $(CYGPATH_W) '$(srcdir)/asm.S'; fi` - -iso9660_stage1_5_exec-start_eltorito.o: start_eltorito.S - $(CCAS) $(iso9660_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o iso9660_stage1_5_exec-start_eltorito.o `test -f 'start_eltorito.S' || echo '$(srcdir)/'`start_eltorito.S - -iso9660_stage1_5_exec-start_eltorito.obj: start_eltorito.S - $(CCAS) $(iso9660_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o iso9660_stage1_5_exec-start_eltorito.obj `if test -f 'start_eltorito.S'; then $(CYGPATH_W) 'start_eltorito.S'; else $(CYGPATH_W) '$(srcdir)/start_eltorito.S'; fi` - -iso9660_stage1_5_exec-asm.o: asm.S - $(CCAS) $(iso9660_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o iso9660_stage1_5_exec-asm.o `test -f 'asm.S' || echo '$(srcdir)/'`asm.S - -iso9660_stage1_5_exec-asm.obj: asm.S - $(CCAS) $(iso9660_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o iso9660_stage1_5_exec-asm.obj `if test -f 'asm.S'; then $(CYGPATH_W) 'asm.S'; else $(CYGPATH_W) '$(srcdir)/asm.S'; fi` - -jfs_stage1_5_exec-start.o: start.S - $(CCAS) $(jfs_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o jfs_stage1_5_exec-start.o `test -f 'start.S' || echo '$(srcdir)/'`start.S - -jfs_stage1_5_exec-start.obj: start.S - $(CCAS) $(jfs_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o jfs_stage1_5_exec-start.obj `if test -f 'start.S'; then $(CYGPATH_W) 'start.S'; else $(CYGPATH_W) '$(srcdir)/start.S'; fi` - -jfs_stage1_5_exec-asm.o: asm.S - $(CCAS) $(jfs_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o jfs_stage1_5_exec-asm.o `test -f 'asm.S' || echo '$(srcdir)/'`asm.S - -jfs_stage1_5_exec-asm.obj: asm.S - $(CCAS) $(jfs_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o jfs_stage1_5_exec-asm.obj `if test -f 'asm.S'; then $(CYGPATH_W) 'asm.S'; else $(CYGPATH_W) '$(srcdir)/asm.S'; fi` - -minix_stage1_5_exec-start.o: start.S - $(CCAS) $(minix_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o minix_stage1_5_exec-start.o `test -f 'start.S' || echo '$(srcdir)/'`start.S - -minix_stage1_5_exec-start.obj: start.S - $(CCAS) $(minix_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o minix_stage1_5_exec-start.obj `if test -f 'start.S'; then $(CYGPATH_W) 'start.S'; else $(CYGPATH_W) '$(srcdir)/start.S'; fi` - -minix_stage1_5_exec-asm.o: asm.S - $(CCAS) $(minix_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o minix_stage1_5_exec-asm.o `test -f 'asm.S' || echo '$(srcdir)/'`asm.S - -minix_stage1_5_exec-asm.obj: asm.S - $(CCAS) $(minix_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o minix_stage1_5_exec-asm.obj `if test -f 'asm.S'; then $(CYGPATH_W) 'asm.S'; else $(CYGPATH_W) '$(srcdir)/asm.S'; fi` - -nbloader_exec-nbloader.o: nbloader.S - $(CCAS) $(nbloader_exec_CCASFLAGS) $(CCASFLAGS) -c -o nbloader_exec-nbloader.o `test -f 'nbloader.S' || echo '$(srcdir)/'`nbloader.S - -nbloader_exec-nbloader.obj: nbloader.S - $(CCAS) $(nbloader_exec_CCASFLAGS) $(CCASFLAGS) -c -o nbloader_exec-nbloader.obj `if test -f 'nbloader.S'; then $(CYGPATH_W) 'nbloader.S'; else $(CYGPATH_W) '$(srcdir)/nbloader.S'; fi` - -pre_stage2_exec-asm.o: asm.S - $(CCAS) $(pre_stage2_exec_CCASFLAGS) $(CCASFLAGS) -c -o pre_stage2_exec-asm.o `test -f 'asm.S' || echo '$(srcdir)/'`asm.S - -pre_stage2_exec-asm.obj: asm.S - $(CCAS) $(pre_stage2_exec_CCASFLAGS) $(CCASFLAGS) -c -o pre_stage2_exec-asm.obj `if test -f 'asm.S'; then $(CYGPATH_W) 'asm.S'; else $(CYGPATH_W) '$(srcdir)/asm.S'; fi` - -pxeloader_exec-pxeloader.o: pxeloader.S - $(CCAS) $(pxeloader_exec_CCASFLAGS) $(CCASFLAGS) -c -o pxeloader_exec-pxeloader.o `test -f 'pxeloader.S' || echo '$(srcdir)/'`pxeloader.S - -pxeloader_exec-pxeloader.obj: pxeloader.S - $(CCAS) $(pxeloader_exec_CCASFLAGS) $(CCASFLAGS) -c -o pxeloader_exec-pxeloader.obj `if test -f 'pxeloader.S'; then $(CYGPATH_W) 'pxeloader.S'; else $(CYGPATH_W) '$(srcdir)/pxeloader.S'; fi` - -reiserfs_stage1_5_exec-start.o: start.S - $(CCAS) $(reiserfs_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o reiserfs_stage1_5_exec-start.o `test -f 'start.S' || echo '$(srcdir)/'`start.S - -reiserfs_stage1_5_exec-start.obj: start.S - $(CCAS) $(reiserfs_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o reiserfs_stage1_5_exec-start.obj `if test -f 'start.S'; then $(CYGPATH_W) 'start.S'; else $(CYGPATH_W) '$(srcdir)/start.S'; fi` - -reiserfs_stage1_5_exec-asm.o: asm.S - $(CCAS) $(reiserfs_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o reiserfs_stage1_5_exec-asm.o `test -f 'asm.S' || echo '$(srcdir)/'`asm.S - -reiserfs_stage1_5_exec-asm.obj: asm.S - $(CCAS) $(reiserfs_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o reiserfs_stage1_5_exec-asm.obj `if test -f 'asm.S'; then $(CYGPATH_W) 'asm.S'; else $(CYGPATH_W) '$(srcdir)/asm.S'; fi` - -start_exec-start.o: start.S - $(CCAS) $(start_exec_CCASFLAGS) $(CCASFLAGS) -c -o start_exec-start.o `test -f 'start.S' || echo '$(srcdir)/'`start.S - -start_exec-start.obj: start.S - $(CCAS) $(start_exec_CCASFLAGS) $(CCASFLAGS) -c -o start_exec-start.obj `if test -f 'start.S'; then $(CYGPATH_W) 'start.S'; else $(CYGPATH_W) '$(srcdir)/start.S'; fi` - -start_eltorito_exec-start_eltorito.o: start_eltorito.S - $(CCAS) $(start_eltorito_exec_CCASFLAGS) $(CCASFLAGS) -c -o start_eltorito_exec-start_eltorito.o `test -f 'start_eltorito.S' || echo '$(srcdir)/'`start_eltorito.S - -start_eltorito_exec-start_eltorito.obj: start_eltorito.S - $(CCAS) $(start_eltorito_exec_CCASFLAGS) $(CCASFLAGS) -c -o start_eltorito_exec-start_eltorito.obj `if test -f 'start_eltorito.S'; then $(CYGPATH_W) 'start_eltorito.S'; else $(CYGPATH_W) '$(srcdir)/start_eltorito.S'; fi` - -ufs2_stage1_5_exec-start.o: start.S - $(CCAS) $(ufs2_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o ufs2_stage1_5_exec-start.o `test -f 'start.S' || echo '$(srcdir)/'`start.S - -ufs2_stage1_5_exec-start.obj: start.S - $(CCAS) $(ufs2_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o ufs2_stage1_5_exec-start.obj `if test -f 'start.S'; then $(CYGPATH_W) 'start.S'; else $(CYGPATH_W) '$(srcdir)/start.S'; fi` - -ufs2_stage1_5_exec-asm.o: asm.S - $(CCAS) $(ufs2_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o ufs2_stage1_5_exec-asm.o `test -f 'asm.S' || echo '$(srcdir)/'`asm.S - -ufs2_stage1_5_exec-asm.obj: asm.S - $(CCAS) $(ufs2_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o ufs2_stage1_5_exec-asm.obj `if test -f 'asm.S'; then $(CYGPATH_W) 'asm.S'; else $(CYGPATH_W) '$(srcdir)/asm.S'; fi` - -ufs_stage1_5_exec-start.o: start.S - $(CCAS) $(ufs_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o ufs_stage1_5_exec-start.o `test -f 'start.S' || echo '$(srcdir)/'`start.S - -ufs_stage1_5_exec-start.obj: start.S - $(CCAS) $(ufs_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o ufs_stage1_5_exec-start.obj `if test -f 'start.S'; then $(CYGPATH_W) 'start.S'; else $(CYGPATH_W) '$(srcdir)/start.S'; fi` - -ufs_stage1_5_exec-asm.o: asm.S - $(CCAS) $(ufs_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o ufs_stage1_5_exec-asm.o `test -f 'asm.S' || echo '$(srcdir)/'`asm.S - -ufs_stage1_5_exec-asm.obj: asm.S - $(CCAS) $(ufs_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o ufs_stage1_5_exec-asm.obj `if test -f 'asm.S'; then $(CYGPATH_W) 'asm.S'; else $(CYGPATH_W) '$(srcdir)/asm.S'; fi` - -zfs_stage1_5_exec-start.o: start.S - $(CCAS) $(zfs_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o zfs_stage1_5_exec-start.o `test -f 'start.S' || echo '$(srcdir)/'`start.S - -zfs_stage1_5_exec-start.obj: start.S - $(CCAS) $(zfs_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o zfs_stage1_5_exec-start.obj `if test -f 'start.S'; then $(CYGPATH_W) 'start.S'; else $(CYGPATH_W) '$(srcdir)/start.S'; fi` - -zfs_stage1_5_exec-asm.o: asm.S - $(CCAS) $(zfs_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o zfs_stage1_5_exec-asm.o `test -f 'asm.S' || echo '$(srcdir)/'`asm.S - -zfs_stage1_5_exec-asm.obj: asm.S - $(CCAS) $(zfs_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o zfs_stage1_5_exec-asm.obj `if test -f 'asm.S'; then $(CYGPATH_W) 'asm.S'; else $(CYGPATH_W) '$(srcdir)/asm.S'; fi` - -vstafs_stage1_5_exec-start.o: start.S - $(CCAS) $(vstafs_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o vstafs_stage1_5_exec-start.o `test -f 'start.S' || echo '$(srcdir)/'`start.S - -vstafs_stage1_5_exec-start.obj: start.S - $(CCAS) $(vstafs_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o vstafs_stage1_5_exec-start.obj `if test -f 'start.S'; then $(CYGPATH_W) 'start.S'; else $(CYGPATH_W) '$(srcdir)/start.S'; fi` - -vstafs_stage1_5_exec-asm.o: asm.S - $(CCAS) $(vstafs_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o vstafs_stage1_5_exec-asm.o `test -f 'asm.S' || echo '$(srcdir)/'`asm.S - -vstafs_stage1_5_exec-asm.obj: asm.S - $(CCAS) $(vstafs_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o vstafs_stage1_5_exec-asm.obj `if test -f 'asm.S'; then $(CYGPATH_W) 'asm.S'; else $(CYGPATH_W) '$(srcdir)/asm.S'; fi` - -xfs_stage1_5_exec-start.o: start.S - $(CCAS) $(xfs_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o xfs_stage1_5_exec-start.o `test -f 'start.S' || echo '$(srcdir)/'`start.S - -xfs_stage1_5_exec-start.obj: start.S - $(CCAS) $(xfs_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o xfs_stage1_5_exec-start.obj `if test -f 'start.S'; then $(CYGPATH_W) 'start.S'; else $(CYGPATH_W) '$(srcdir)/start.S'; fi` - -xfs_stage1_5_exec-asm.o: asm.S - $(CCAS) $(xfs_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o xfs_stage1_5_exec-asm.o `test -f 'asm.S' || echo '$(srcdir)/'`asm.S - -xfs_stage1_5_exec-asm.obj: asm.S - $(CCAS) $(xfs_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o xfs_stage1_5_exec-asm.obj `if test -f 'asm.S'; then $(CYGPATH_W) 'asm.S'; else $(CYGPATH_W) '$(srcdir)/asm.S'; fi` - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -libgrub_a-boot.o: boot.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-boot.o -MD -MP -MF "$(DEPDIR)/libgrub_a-boot.Tpo" -c -o libgrub_a-boot.o `test -f 'boot.c' || echo '$(srcdir)/'`boot.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-boot.Tpo" "$(DEPDIR)/libgrub_a-boot.Po"; else rm -f "$(DEPDIR)/libgrub_a-boot.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='boot.c' object='libgrub_a-boot.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libgrub_a-boot.Po' tmpdepfile='$(DEPDIR)/libgrub_a-boot.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-boot.o `test -f 'boot.c' || echo '$(srcdir)/'`boot.c - -libgrub_a-boot.obj: boot.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-boot.obj -MD -MP -MF "$(DEPDIR)/libgrub_a-boot.Tpo" -c -o libgrub_a-boot.obj `if test -f 'boot.c'; then $(CYGPATH_W) 'boot.c'; else $(CYGPATH_W) '$(srcdir)/boot.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-boot.Tpo" "$(DEPDIR)/libgrub_a-boot.Po"; else rm -f "$(DEPDIR)/libgrub_a-boot.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='boot.c' object='libgrub_a-boot.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libgrub_a-boot.Po' tmpdepfile='$(DEPDIR)/libgrub_a-boot.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-boot.obj `if test -f 'boot.c'; then $(CYGPATH_W) 'boot.c'; else $(CYGPATH_W) '$(srcdir)/boot.c'; fi` - -libgrub_a-builtins.o: builtins.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-builtins.o -MD -MP -MF "$(DEPDIR)/libgrub_a-builtins.Tpo" -c -o libgrub_a-builtins.o `test -f 'builtins.c' || echo '$(srcdir)/'`builtins.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-builtins.Tpo" "$(DEPDIR)/libgrub_a-builtins.Po"; else rm -f "$(DEPDIR)/libgrub_a-builtins.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='builtins.c' object='libgrub_a-builtins.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libgrub_a-builtins.Po' tmpdepfile='$(DEPDIR)/libgrub_a-builtins.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-builtins.o `test -f 'builtins.c' || echo '$(srcdir)/'`builtins.c - -libgrub_a-builtins.obj: builtins.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-builtins.obj -MD -MP -MF "$(DEPDIR)/libgrub_a-builtins.Tpo" -c -o libgrub_a-builtins.obj `if test -f 'builtins.c'; then $(CYGPATH_W) 'builtins.c'; else $(CYGPATH_W) '$(srcdir)/builtins.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-builtins.Tpo" "$(DEPDIR)/libgrub_a-builtins.Po"; else rm -f "$(DEPDIR)/libgrub_a-builtins.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='builtins.c' object='libgrub_a-builtins.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libgrub_a-builtins.Po' tmpdepfile='$(DEPDIR)/libgrub_a-builtins.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-builtins.obj `if test -f 'builtins.c'; then $(CYGPATH_W) 'builtins.c'; else $(CYGPATH_W) '$(srcdir)/builtins.c'; fi` - -libgrub_a-char_io.o: char_io.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-char_io.o -MD -MP -MF "$(DEPDIR)/libgrub_a-char_io.Tpo" -c -o libgrub_a-char_io.o `test -f 'char_io.c' || echo '$(srcdir)/'`char_io.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-char_io.Tpo" "$(DEPDIR)/libgrub_a-char_io.Po"; else rm -f "$(DEPDIR)/libgrub_a-char_io.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='char_io.c' object='libgrub_a-char_io.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libgrub_a-char_io.Po' tmpdepfile='$(DEPDIR)/libgrub_a-char_io.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-char_io.o `test -f 'char_io.c' || echo '$(srcdir)/'`char_io.c - -libgrub_a-char_io.obj: char_io.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-char_io.obj -MD -MP -MF "$(DEPDIR)/libgrub_a-char_io.Tpo" -c -o libgrub_a-char_io.obj `if test -f 'char_io.c'; then $(CYGPATH_W) 'char_io.c'; else $(CYGPATH_W) '$(srcdir)/char_io.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-char_io.Tpo" "$(DEPDIR)/libgrub_a-char_io.Po"; else rm -f "$(DEPDIR)/libgrub_a-char_io.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='char_io.c' object='libgrub_a-char_io.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libgrub_a-char_io.Po' tmpdepfile='$(DEPDIR)/libgrub_a-char_io.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-char_io.obj `if test -f 'char_io.c'; then $(CYGPATH_W) 'char_io.c'; else $(CYGPATH_W) '$(srcdir)/char_io.c'; fi` - -libgrub_a-cmdline.o: cmdline.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-cmdline.o -MD -MP -MF "$(DEPDIR)/libgrub_a-cmdline.Tpo" -c -o libgrub_a-cmdline.o `test -f 'cmdline.c' || echo '$(srcdir)/'`cmdline.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-cmdline.Tpo" "$(DEPDIR)/libgrub_a-cmdline.Po"; else rm -f "$(DEPDIR)/libgrub_a-cmdline.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cmdline.c' object='libgrub_a-cmdline.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libgrub_a-cmdline.Po' tmpdepfile='$(DEPDIR)/libgrub_a-cmdline.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-cmdline.o `test -f 'cmdline.c' || echo '$(srcdir)/'`cmdline.c - -libgrub_a-cmdline.obj: cmdline.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-cmdline.obj -MD -MP -MF "$(DEPDIR)/libgrub_a-cmdline.Tpo" -c -o libgrub_a-cmdline.obj `if test -f 'cmdline.c'; then $(CYGPATH_W) 'cmdline.c'; else $(CYGPATH_W) '$(srcdir)/cmdline.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-cmdline.Tpo" "$(DEPDIR)/libgrub_a-cmdline.Po"; else rm -f "$(DEPDIR)/libgrub_a-cmdline.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cmdline.c' object='libgrub_a-cmdline.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libgrub_a-cmdline.Po' tmpdepfile='$(DEPDIR)/libgrub_a-cmdline.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-cmdline.obj `if test -f 'cmdline.c'; then $(CYGPATH_W) 'cmdline.c'; else $(CYGPATH_W) '$(srcdir)/cmdline.c'; fi` - -libgrub_a-common.o: common.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-common.o -MD -MP -MF "$(DEPDIR)/libgrub_a-common.Tpo" -c -o libgrub_a-common.o `test -f 'common.c' || echo '$(srcdir)/'`common.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-common.Tpo" "$(DEPDIR)/libgrub_a-common.Po"; else rm -f "$(DEPDIR)/libgrub_a-common.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='common.c' object='libgrub_a-common.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libgrub_a-common.Po' tmpdepfile='$(DEPDIR)/libgrub_a-common.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-common.o `test -f 'common.c' || echo '$(srcdir)/'`common.c - -libgrub_a-common.obj: common.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-common.obj -MD -MP -MF "$(DEPDIR)/libgrub_a-common.Tpo" -c -o libgrub_a-common.obj `if test -f 'common.c'; then $(CYGPATH_W) 'common.c'; else $(CYGPATH_W) '$(srcdir)/common.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-common.Tpo" "$(DEPDIR)/libgrub_a-common.Po"; else rm -f "$(DEPDIR)/libgrub_a-common.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='common.c' object='libgrub_a-common.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libgrub_a-common.Po' tmpdepfile='$(DEPDIR)/libgrub_a-common.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-common.obj `if test -f 'common.c'; then $(CYGPATH_W) 'common.c'; else $(CYGPATH_W) '$(srcdir)/common.c'; fi` - -libgrub_a-disk_io.o: disk_io.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-disk_io.o -MD -MP -MF "$(DEPDIR)/libgrub_a-disk_io.Tpo" -c -o libgrub_a-disk_io.o `test -f 'disk_io.c' || echo '$(srcdir)/'`disk_io.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-disk_io.Tpo" "$(DEPDIR)/libgrub_a-disk_io.Po"; else rm -f "$(DEPDIR)/libgrub_a-disk_io.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='disk_io.c' object='libgrub_a-disk_io.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libgrub_a-disk_io.Po' tmpdepfile='$(DEPDIR)/libgrub_a-disk_io.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-disk_io.o `test -f 'disk_io.c' || echo '$(srcdir)/'`disk_io.c - -libgrub_a-disk_io.obj: disk_io.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-disk_io.obj -MD -MP -MF "$(DEPDIR)/libgrub_a-disk_io.Tpo" -c -o libgrub_a-disk_io.obj `if test -f 'disk_io.c'; then $(CYGPATH_W) 'disk_io.c'; else $(CYGPATH_W) '$(srcdir)/disk_io.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-disk_io.Tpo" "$(DEPDIR)/libgrub_a-disk_io.Po"; else rm -f "$(DEPDIR)/libgrub_a-disk_io.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='disk_io.c' object='libgrub_a-disk_io.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libgrub_a-disk_io.Po' tmpdepfile='$(DEPDIR)/libgrub_a-disk_io.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-disk_io.obj `if test -f 'disk_io.c'; then $(CYGPATH_W) 'disk_io.c'; else $(CYGPATH_W) '$(srcdir)/disk_io.c'; fi` - -libgrub_a-fsys_ext2fs.o: fsys_ext2fs.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-fsys_ext2fs.o -MD -MP -MF "$(DEPDIR)/libgrub_a-fsys_ext2fs.Tpo" -c -o libgrub_a-fsys_ext2fs.o `test -f 'fsys_ext2fs.c' || echo '$(srcdir)/'`fsys_ext2fs.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-fsys_ext2fs.Tpo" "$(DEPDIR)/libgrub_a-fsys_ext2fs.Po"; else rm -f "$(DEPDIR)/libgrub_a-fsys_ext2fs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_ext2fs.c' object='libgrub_a-fsys_ext2fs.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libgrub_a-fsys_ext2fs.Po' tmpdepfile='$(DEPDIR)/libgrub_a-fsys_ext2fs.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-fsys_ext2fs.o `test -f 'fsys_ext2fs.c' || echo '$(srcdir)/'`fsys_ext2fs.c - -libgrub_a-fsys_ext2fs.obj: fsys_ext2fs.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-fsys_ext2fs.obj -MD -MP -MF "$(DEPDIR)/libgrub_a-fsys_ext2fs.Tpo" -c -o libgrub_a-fsys_ext2fs.obj `if test -f 'fsys_ext2fs.c'; then $(CYGPATH_W) 'fsys_ext2fs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_ext2fs.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-fsys_ext2fs.Tpo" "$(DEPDIR)/libgrub_a-fsys_ext2fs.Po"; else rm -f "$(DEPDIR)/libgrub_a-fsys_ext2fs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_ext2fs.c' object='libgrub_a-fsys_ext2fs.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libgrub_a-fsys_ext2fs.Po' tmpdepfile='$(DEPDIR)/libgrub_a-fsys_ext2fs.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-fsys_ext2fs.obj `if test -f 'fsys_ext2fs.c'; then $(CYGPATH_W) 'fsys_ext2fs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_ext2fs.c'; fi` - -libgrub_a-fsys_fat.o: fsys_fat.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-fsys_fat.o -MD -MP -MF "$(DEPDIR)/libgrub_a-fsys_fat.Tpo" -c -o libgrub_a-fsys_fat.o `test -f 'fsys_fat.c' || echo '$(srcdir)/'`fsys_fat.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-fsys_fat.Tpo" "$(DEPDIR)/libgrub_a-fsys_fat.Po"; else rm -f "$(DEPDIR)/libgrub_a-fsys_fat.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_fat.c' object='libgrub_a-fsys_fat.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libgrub_a-fsys_fat.Po' tmpdepfile='$(DEPDIR)/libgrub_a-fsys_fat.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-fsys_fat.o `test -f 'fsys_fat.c' || echo '$(srcdir)/'`fsys_fat.c - -libgrub_a-fsys_fat.obj: fsys_fat.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-fsys_fat.obj -MD -MP -MF "$(DEPDIR)/libgrub_a-fsys_fat.Tpo" -c -o libgrub_a-fsys_fat.obj `if test -f 'fsys_fat.c'; then $(CYGPATH_W) 'fsys_fat.c'; else $(CYGPATH_W) '$(srcdir)/fsys_fat.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-fsys_fat.Tpo" "$(DEPDIR)/libgrub_a-fsys_fat.Po"; else rm -f "$(DEPDIR)/libgrub_a-fsys_fat.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_fat.c' object='libgrub_a-fsys_fat.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libgrub_a-fsys_fat.Po' tmpdepfile='$(DEPDIR)/libgrub_a-fsys_fat.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-fsys_fat.obj `if test -f 'fsys_fat.c'; then $(CYGPATH_W) 'fsys_fat.c'; else $(CYGPATH_W) '$(srcdir)/fsys_fat.c'; fi` - -libgrub_a-fsys_ffs.o: fsys_ffs.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-fsys_ffs.o -MD -MP -MF "$(DEPDIR)/libgrub_a-fsys_ffs.Tpo" -c -o libgrub_a-fsys_ffs.o `test -f 'fsys_ffs.c' || echo '$(srcdir)/'`fsys_ffs.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-fsys_ffs.Tpo" "$(DEPDIR)/libgrub_a-fsys_ffs.Po"; else rm -f "$(DEPDIR)/libgrub_a-fsys_ffs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_ffs.c' object='libgrub_a-fsys_ffs.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libgrub_a-fsys_ffs.Po' tmpdepfile='$(DEPDIR)/libgrub_a-fsys_ffs.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-fsys_ffs.o `test -f 'fsys_ffs.c' || echo '$(srcdir)/'`fsys_ffs.c - -libgrub_a-fsys_ffs.obj: fsys_ffs.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-fsys_ffs.obj -MD -MP -MF "$(DEPDIR)/libgrub_a-fsys_ffs.Tpo" -c -o libgrub_a-fsys_ffs.obj `if test -f 'fsys_ffs.c'; then $(CYGPATH_W) 'fsys_ffs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_ffs.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-fsys_ffs.Tpo" "$(DEPDIR)/libgrub_a-fsys_ffs.Po"; else rm -f "$(DEPDIR)/libgrub_a-fsys_ffs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_ffs.c' object='libgrub_a-fsys_ffs.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libgrub_a-fsys_ffs.Po' tmpdepfile='$(DEPDIR)/libgrub_a-fsys_ffs.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-fsys_ffs.obj `if test -f 'fsys_ffs.c'; then $(CYGPATH_W) 'fsys_ffs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_ffs.c'; fi` - -libgrub_a-fsys_iso9660.o: fsys_iso9660.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-fsys_iso9660.o -MD -MP -MF "$(DEPDIR)/libgrub_a-fsys_iso9660.Tpo" -c -o libgrub_a-fsys_iso9660.o `test -f 'fsys_iso9660.c' || echo '$(srcdir)/'`fsys_iso9660.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-fsys_iso9660.Tpo" "$(DEPDIR)/libgrub_a-fsys_iso9660.Po"; else rm -f "$(DEPDIR)/libgrub_a-fsys_iso9660.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_iso9660.c' object='libgrub_a-fsys_iso9660.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libgrub_a-fsys_iso9660.Po' tmpdepfile='$(DEPDIR)/libgrub_a-fsys_iso9660.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-fsys_iso9660.o `test -f 'fsys_iso9660.c' || echo '$(srcdir)/'`fsys_iso9660.c - -libgrub_a-fsys_iso9660.obj: fsys_iso9660.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-fsys_iso9660.obj -MD -MP -MF "$(DEPDIR)/libgrub_a-fsys_iso9660.Tpo" -c -o libgrub_a-fsys_iso9660.obj `if test -f 'fsys_iso9660.c'; then $(CYGPATH_W) 'fsys_iso9660.c'; else $(CYGPATH_W) '$(srcdir)/fsys_iso9660.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-fsys_iso9660.Tpo" "$(DEPDIR)/libgrub_a-fsys_iso9660.Po"; else rm -f "$(DEPDIR)/libgrub_a-fsys_iso9660.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_iso9660.c' object='libgrub_a-fsys_iso9660.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libgrub_a-fsys_iso9660.Po' tmpdepfile='$(DEPDIR)/libgrub_a-fsys_iso9660.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-fsys_iso9660.obj `if test -f 'fsys_iso9660.c'; then $(CYGPATH_W) 'fsys_iso9660.c'; else $(CYGPATH_W) '$(srcdir)/fsys_iso9660.c'; fi` - -libgrub_a-fsys_jfs.o: fsys_jfs.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-fsys_jfs.o -MD -MP -MF "$(DEPDIR)/libgrub_a-fsys_jfs.Tpo" -c -o libgrub_a-fsys_jfs.o `test -f 'fsys_jfs.c' || echo '$(srcdir)/'`fsys_jfs.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-fsys_jfs.Tpo" "$(DEPDIR)/libgrub_a-fsys_jfs.Po"; else rm -f "$(DEPDIR)/libgrub_a-fsys_jfs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_jfs.c' object='libgrub_a-fsys_jfs.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libgrub_a-fsys_jfs.Po' tmpdepfile='$(DEPDIR)/libgrub_a-fsys_jfs.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-fsys_jfs.o `test -f 'fsys_jfs.c' || echo '$(srcdir)/'`fsys_jfs.c - -libgrub_a-fsys_jfs.obj: fsys_jfs.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-fsys_jfs.obj -MD -MP -MF "$(DEPDIR)/libgrub_a-fsys_jfs.Tpo" -c -o libgrub_a-fsys_jfs.obj `if test -f 'fsys_jfs.c'; then $(CYGPATH_W) 'fsys_jfs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_jfs.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-fsys_jfs.Tpo" "$(DEPDIR)/libgrub_a-fsys_jfs.Po"; else rm -f "$(DEPDIR)/libgrub_a-fsys_jfs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_jfs.c' object='libgrub_a-fsys_jfs.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libgrub_a-fsys_jfs.Po' tmpdepfile='$(DEPDIR)/libgrub_a-fsys_jfs.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-fsys_jfs.obj `if test -f 'fsys_jfs.c'; then $(CYGPATH_W) 'fsys_jfs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_jfs.c'; fi` - -libgrub_a-fsys_minix.o: fsys_minix.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-fsys_minix.o -MD -MP -MF "$(DEPDIR)/libgrub_a-fsys_minix.Tpo" -c -o libgrub_a-fsys_minix.o `test -f 'fsys_minix.c' || echo '$(srcdir)/'`fsys_minix.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-fsys_minix.Tpo" "$(DEPDIR)/libgrub_a-fsys_minix.Po"; else rm -f "$(DEPDIR)/libgrub_a-fsys_minix.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_minix.c' object='libgrub_a-fsys_minix.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libgrub_a-fsys_minix.Po' tmpdepfile='$(DEPDIR)/libgrub_a-fsys_minix.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-fsys_minix.o `test -f 'fsys_minix.c' || echo '$(srcdir)/'`fsys_minix.c - -libgrub_a-fsys_minix.obj: fsys_minix.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-fsys_minix.obj -MD -MP -MF "$(DEPDIR)/libgrub_a-fsys_minix.Tpo" -c -o libgrub_a-fsys_minix.obj `if test -f 'fsys_minix.c'; then $(CYGPATH_W) 'fsys_minix.c'; else $(CYGPATH_W) '$(srcdir)/fsys_minix.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-fsys_minix.Tpo" "$(DEPDIR)/libgrub_a-fsys_minix.Po"; else rm -f "$(DEPDIR)/libgrub_a-fsys_minix.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_minix.c' object='libgrub_a-fsys_minix.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libgrub_a-fsys_minix.Po' tmpdepfile='$(DEPDIR)/libgrub_a-fsys_minix.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-fsys_minix.obj `if test -f 'fsys_minix.c'; then $(CYGPATH_W) 'fsys_minix.c'; else $(CYGPATH_W) '$(srcdir)/fsys_minix.c'; fi` - -libgrub_a-fsys_reiserfs.o: fsys_reiserfs.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-fsys_reiserfs.o -MD -MP -MF "$(DEPDIR)/libgrub_a-fsys_reiserfs.Tpo" -c -o libgrub_a-fsys_reiserfs.o `test -f 'fsys_reiserfs.c' || echo '$(srcdir)/'`fsys_reiserfs.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-fsys_reiserfs.Tpo" "$(DEPDIR)/libgrub_a-fsys_reiserfs.Po"; else rm -f "$(DEPDIR)/libgrub_a-fsys_reiserfs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_reiserfs.c' object='libgrub_a-fsys_reiserfs.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libgrub_a-fsys_reiserfs.Po' tmpdepfile='$(DEPDIR)/libgrub_a-fsys_reiserfs.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-fsys_reiserfs.o `test -f 'fsys_reiserfs.c' || echo '$(srcdir)/'`fsys_reiserfs.c - -libgrub_a-fsys_reiserfs.obj: fsys_reiserfs.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-fsys_reiserfs.obj -MD -MP -MF "$(DEPDIR)/libgrub_a-fsys_reiserfs.Tpo" -c -o libgrub_a-fsys_reiserfs.obj `if test -f 'fsys_reiserfs.c'; then $(CYGPATH_W) 'fsys_reiserfs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_reiserfs.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-fsys_reiserfs.Tpo" "$(DEPDIR)/libgrub_a-fsys_reiserfs.Po"; else rm -f "$(DEPDIR)/libgrub_a-fsys_reiserfs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_reiserfs.c' object='libgrub_a-fsys_reiserfs.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libgrub_a-fsys_reiserfs.Po' tmpdepfile='$(DEPDIR)/libgrub_a-fsys_reiserfs.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-fsys_reiserfs.obj `if test -f 'fsys_reiserfs.c'; then $(CYGPATH_W) 'fsys_reiserfs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_reiserfs.c'; fi` - -libgrub_a-zfs_sha256.o: zfs_sha256.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-zfs_sha256.o -MD -MP -MF "$(DEPDIR)/libgrub_a-zfs_sha256.Tpo" -c -o libgrub_a-zfs_sha256.o `test -f 'zfs_sha256.c' || echo '$(srcdir)/'`zfs_sha256.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-zfs_sha256.Tpo" "$(DEPDIR)/libgrub_a-zfs_sha256.Po"; else rm -f "$(DEPDIR)/libgrub_a-zfs_sha256.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='zfs_sha256.c' object='libgrub_a-zfs_sha256.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libgrub_a-zfs_sha256.Po' tmpdepfile='$(DEPDIR)/libgrub_a-zfs_sha256.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-zfs_sha256.o `test -f 'zfs_sha256.c' || echo '$(srcdir)/'`zfs_sha256.c - -libgrub_a-zfs_sha256.obj: zfs_sha256.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-zfs_sha256.obj -MD -MP -MF "$(DEPDIR)/libgrub_a-zfs_sha256.Tpo" -c -o libgrub_a-zfs_sha256.obj `if test -f 'zfs_sha256.c'; then $(CYGPATH_W) 'zfs_sha256.c'; else $(CYGPATH_W) '$(srcdir)/zfs_sha256.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-zfs_sha256.Tpo" "$(DEPDIR)/libgrub_a-zfs_sha256.Po"; else rm -f "$(DEPDIR)/libgrub_a-zfs_sha256.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='zfs_sha256.c' object='libgrub_a-zfs_sha256.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libgrub_a-zfs_sha256.Po' tmpdepfile='$(DEPDIR)/libgrub_a-zfs_sha256.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-zfs_sha256.obj `if test -f 'zfs_sha256.c'; then $(CYGPATH_W) 'zfs_sha256.c'; else $(CYGPATH_W) '$(srcdir)/zfs_sha256.c'; fi` - -libgrub_a-zfs_lzjb.o: zfs_lzjb.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-zfs_lzjb.o -MD -MP -MF "$(DEPDIR)/libgrub_a-zfs_lzjb.Tpo" -c -o libgrub_a-zfs_lzjb.o `test -f 'zfs_lzjb.c' || echo '$(srcdir)/'`zfs_lzjb.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-zfs_lzjb.Tpo" "$(DEPDIR)/libgrub_a-zfs_lzjb.Po"; else rm -f "$(DEPDIR)/libgrub_a-zfs_lzjb.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='zfs_lzjb.c' object='libgrub_a-zfs_lzjb.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libgrub_a-zfs_lzjb.Po' tmpdepfile='$(DEPDIR)/libgrub_a-zfs_lzjb.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-zfs_lzjb.o `test -f 'zfs_lzjb.c' || echo '$(srcdir)/'`zfs_lzjb.c - -libgrub_a-zfs_lzjb.obj: zfs_lzjb.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-zfs_lzjb.obj -MD -MP -MF "$(DEPDIR)/libgrub_a-zfs_lzjb.Tpo" -c -o libgrub_a-zfs_lzjb.obj `if test -f 'zfs_lzjb.c'; then $(CYGPATH_W) 'zfs_lzjb.c'; else $(CYGPATH_W) '$(srcdir)/zfs_lzjb.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-zfs_lzjb.Tpo" "$(DEPDIR)/libgrub_a-zfs_lzjb.Po"; else rm -f "$(DEPDIR)/libgrub_a-zfs_lzjb.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='zfs_lzjb.c' object='libgrub_a-zfs_lzjb.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libgrub_a-zfs_lzjb.Po' tmpdepfile='$(DEPDIR)/libgrub_a-zfs_lzjb.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-zfs_lzjb.obj `if test -f 'zfs_lzjb.c'; then $(CYGPATH_W) 'zfs_lzjb.c'; else $(CYGPATH_W) '$(srcdir)/zfs_lzjb.c'; fi` - -libgrub_a-zfs_fletcher.o: zfs_fletcher.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-zfs_fletcher.o -MD -MP -MF "$(DEPDIR)/libgrub_a-zfs_fletcher.Tpo" -c -o libgrub_a-zfs_fletcher.o `test -f 'zfs_fletcher.c' || echo '$(srcdir)/'`zfs_fletcher.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-zfs_fletcher.Tpo" "$(DEPDIR)/libgrub_a-zfs_fletcher.Po"; else rm -f "$(DEPDIR)/libgrub_a-zfs_fletcher.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='zfs_fletcher.c' object='libgrub_a-zfs_fletcher.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libgrub_a-zfs_fletcher.Po' tmpdepfile='$(DEPDIR)/libgrub_a-zfs_fletcher.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-zfs_fletcher.o `test -f 'zfs_fletcher.c' || echo '$(srcdir)/'`zfs_fletcher.c - -libgrub_a-zfs_fletcher.obj: zfs_fletcher.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-zfs_fletcher.obj -MD -MP -MF "$(DEPDIR)/libgrub_a-zfs_fletcher.Tpo" -c -o libgrub_a-zfs_fletcher.obj `if test -f 'zfs_fletcher.c'; then $(CYGPATH_W) 'zfs_fletcher.c'; else $(CYGPATH_W) '$(srcdir)/zfs_fletcher.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-zfs_fletcher.Tpo" "$(DEPDIR)/libgrub_a-zfs_fletcher.Po"; else rm -f "$(DEPDIR)/libgrub_a-zfs_fletcher.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='zfs_fletcher.c' object='libgrub_a-zfs_fletcher.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libgrub_a-zfs_fletcher.Po' tmpdepfile='$(DEPDIR)/libgrub_a-zfs_fletcher.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-zfs_fletcher.obj `if test -f 'zfs_fletcher.c'; then $(CYGPATH_W) 'zfs_fletcher.c'; else $(CYGPATH_W) '$(srcdir)/zfs_fletcher.c'; fi` - -libgrub_a-fsys_zfs.o: fsys_zfs.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-fsys_zfs.o -MD -MP -MF "$(DEPDIR)/libgrub_a-fsys_zfs.Tpo" -c -o libgrub_a-fsys_zfs.o `test -f 'fsys_zfs.c' || echo '$(srcdir)/'`fsys_zfs.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-fsys_zfs.Tpo" "$(DEPDIR)/libgrub_a-fsys_zfs.Po"; else rm -f "$(DEPDIR)/libgrub_a-fsys_zfs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_zfs.c' object='libgrub_a-fsys_zfs.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libgrub_a-fsys_zfs.Po' tmpdepfile='$(DEPDIR)/libgrub_a-fsys_zfs.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-fsys_zfs.o `test -f 'fsys_zfs.c' || echo '$(srcdir)/'`fsys_zfs.c - -libgrub_a-fsys_zfs.obj: fsys_zfs.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-fsys_zfs.obj -MD -MP -MF "$(DEPDIR)/libgrub_a-fsys_zfs.Tpo" -c -o libgrub_a-fsys_zfs.obj `if test -f 'fsys_zfs.c'; then $(CYGPATH_W) 'fsys_zfs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_zfs.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-fsys_zfs.Tpo" "$(DEPDIR)/libgrub_a-fsys_zfs.Po"; else rm -f "$(DEPDIR)/libgrub_a-fsys_zfs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_zfs.c' object='libgrub_a-fsys_zfs.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libgrub_a-fsys_zfs.Po' tmpdepfile='$(DEPDIR)/libgrub_a-fsys_zfs.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-fsys_zfs.obj `if test -f 'fsys_zfs.c'; then $(CYGPATH_W) 'fsys_zfs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_zfs.c'; fi` - -libgrub_a-fsys_ufs.o: fsys_ufs.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-fsys_ufs.o -MD -MP -MF "$(DEPDIR)/libgrub_a-fsys_ufs.Tpo" -c -o libgrub_a-fsys_ufs.o `test -f 'fsys_ufs.c' || echo '$(srcdir)/'`fsys_ufs.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-fsys_ufs.Tpo" "$(DEPDIR)/libgrub_a-fsys_ufs.Po"; else rm -f "$(DEPDIR)/libgrub_a-fsys_ufs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_ufs.c' object='libgrub_a-fsys_ufs.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libgrub_a-fsys_ufs.Po' tmpdepfile='$(DEPDIR)/libgrub_a-fsys_ufs.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-fsys_ufs.o `test -f 'fsys_ufs.c' || echo '$(srcdir)/'`fsys_ufs.c - -libgrub_a-fsys_ufs.obj: fsys_ufs.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-fsys_ufs.obj -MD -MP -MF "$(DEPDIR)/libgrub_a-fsys_ufs.Tpo" -c -o libgrub_a-fsys_ufs.obj `if test -f 'fsys_ufs.c'; then $(CYGPATH_W) 'fsys_ufs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_ufs.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-fsys_ufs.Tpo" "$(DEPDIR)/libgrub_a-fsys_ufs.Po"; else rm -f "$(DEPDIR)/libgrub_a-fsys_ufs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_ufs.c' object='libgrub_a-fsys_ufs.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libgrub_a-fsys_ufs.Po' tmpdepfile='$(DEPDIR)/libgrub_a-fsys_ufs.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-fsys_ufs.obj `if test -f 'fsys_ufs.c'; then $(CYGPATH_W) 'fsys_ufs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_ufs.c'; fi` - -libgrub_a-fsys_ufs2.o: fsys_ufs2.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-fsys_ufs2.o -MD -MP -MF "$(DEPDIR)/libgrub_a-fsys_ufs2.Tpo" -c -o libgrub_a-fsys_ufs2.o `test -f 'fsys_ufs2.c' || echo '$(srcdir)/'`fsys_ufs2.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-fsys_ufs2.Tpo" "$(DEPDIR)/libgrub_a-fsys_ufs2.Po"; else rm -f "$(DEPDIR)/libgrub_a-fsys_ufs2.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_ufs2.c' object='libgrub_a-fsys_ufs2.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libgrub_a-fsys_ufs2.Po' tmpdepfile='$(DEPDIR)/libgrub_a-fsys_ufs2.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-fsys_ufs2.o `test -f 'fsys_ufs2.c' || echo '$(srcdir)/'`fsys_ufs2.c - -libgrub_a-fsys_ufs2.obj: fsys_ufs2.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-fsys_ufs2.obj -MD -MP -MF "$(DEPDIR)/libgrub_a-fsys_ufs2.Tpo" -c -o libgrub_a-fsys_ufs2.obj `if test -f 'fsys_ufs2.c'; then $(CYGPATH_W) 'fsys_ufs2.c'; else $(CYGPATH_W) '$(srcdir)/fsys_ufs2.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-fsys_ufs2.Tpo" "$(DEPDIR)/libgrub_a-fsys_ufs2.Po"; else rm -f "$(DEPDIR)/libgrub_a-fsys_ufs2.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_ufs2.c' object='libgrub_a-fsys_ufs2.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libgrub_a-fsys_ufs2.Po' tmpdepfile='$(DEPDIR)/libgrub_a-fsys_ufs2.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-fsys_ufs2.obj `if test -f 'fsys_ufs2.c'; then $(CYGPATH_W) 'fsys_ufs2.c'; else $(CYGPATH_W) '$(srcdir)/fsys_ufs2.c'; fi` - -libgrub_a-fsys_vstafs.o: fsys_vstafs.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-fsys_vstafs.o -MD -MP -MF "$(DEPDIR)/libgrub_a-fsys_vstafs.Tpo" -c -o libgrub_a-fsys_vstafs.o `test -f 'fsys_vstafs.c' || echo '$(srcdir)/'`fsys_vstafs.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-fsys_vstafs.Tpo" "$(DEPDIR)/libgrub_a-fsys_vstafs.Po"; else rm -f "$(DEPDIR)/libgrub_a-fsys_vstafs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_vstafs.c' object='libgrub_a-fsys_vstafs.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libgrub_a-fsys_vstafs.Po' tmpdepfile='$(DEPDIR)/libgrub_a-fsys_vstafs.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-fsys_vstafs.o `test -f 'fsys_vstafs.c' || echo '$(srcdir)/'`fsys_vstafs.c - -libgrub_a-fsys_vstafs.obj: fsys_vstafs.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-fsys_vstafs.obj -MD -MP -MF "$(DEPDIR)/libgrub_a-fsys_vstafs.Tpo" -c -o libgrub_a-fsys_vstafs.obj `if test -f 'fsys_vstafs.c'; then $(CYGPATH_W) 'fsys_vstafs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_vstafs.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-fsys_vstafs.Tpo" "$(DEPDIR)/libgrub_a-fsys_vstafs.Po"; else rm -f "$(DEPDIR)/libgrub_a-fsys_vstafs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_vstafs.c' object='libgrub_a-fsys_vstafs.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libgrub_a-fsys_vstafs.Po' tmpdepfile='$(DEPDIR)/libgrub_a-fsys_vstafs.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-fsys_vstafs.obj `if test -f 'fsys_vstafs.c'; then $(CYGPATH_W) 'fsys_vstafs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_vstafs.c'; fi` - -libgrub_a-fsys_xfs.o: fsys_xfs.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-fsys_xfs.o -MD -MP -MF "$(DEPDIR)/libgrub_a-fsys_xfs.Tpo" -c -o libgrub_a-fsys_xfs.o `test -f 'fsys_xfs.c' || echo '$(srcdir)/'`fsys_xfs.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-fsys_xfs.Tpo" "$(DEPDIR)/libgrub_a-fsys_xfs.Po"; else rm -f "$(DEPDIR)/libgrub_a-fsys_xfs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_xfs.c' object='libgrub_a-fsys_xfs.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libgrub_a-fsys_xfs.Po' tmpdepfile='$(DEPDIR)/libgrub_a-fsys_xfs.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-fsys_xfs.o `test -f 'fsys_xfs.c' || echo '$(srcdir)/'`fsys_xfs.c - -libgrub_a-fsys_xfs.obj: fsys_xfs.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-fsys_xfs.obj -MD -MP -MF "$(DEPDIR)/libgrub_a-fsys_xfs.Tpo" -c -o libgrub_a-fsys_xfs.obj `if test -f 'fsys_xfs.c'; then $(CYGPATH_W) 'fsys_xfs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_xfs.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-fsys_xfs.Tpo" "$(DEPDIR)/libgrub_a-fsys_xfs.Po"; else rm -f "$(DEPDIR)/libgrub_a-fsys_xfs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_xfs.c' object='libgrub_a-fsys_xfs.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libgrub_a-fsys_xfs.Po' tmpdepfile='$(DEPDIR)/libgrub_a-fsys_xfs.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-fsys_xfs.obj `if test -f 'fsys_xfs.c'; then $(CYGPATH_W) 'fsys_xfs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_xfs.c'; fi` - -libgrub_a-gunzip.o: gunzip.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-gunzip.o -MD -MP -MF "$(DEPDIR)/libgrub_a-gunzip.Tpo" -c -o libgrub_a-gunzip.o `test -f 'gunzip.c' || echo '$(srcdir)/'`gunzip.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-gunzip.Tpo" "$(DEPDIR)/libgrub_a-gunzip.Po"; else rm -f "$(DEPDIR)/libgrub_a-gunzip.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gunzip.c' object='libgrub_a-gunzip.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libgrub_a-gunzip.Po' tmpdepfile='$(DEPDIR)/libgrub_a-gunzip.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-gunzip.o `test -f 'gunzip.c' || echo '$(srcdir)/'`gunzip.c - -libgrub_a-gunzip.obj: gunzip.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-gunzip.obj -MD -MP -MF "$(DEPDIR)/libgrub_a-gunzip.Tpo" -c -o libgrub_a-gunzip.obj `if test -f 'gunzip.c'; then $(CYGPATH_W) 'gunzip.c'; else $(CYGPATH_W) '$(srcdir)/gunzip.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-gunzip.Tpo" "$(DEPDIR)/libgrub_a-gunzip.Po"; else rm -f "$(DEPDIR)/libgrub_a-gunzip.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gunzip.c' object='libgrub_a-gunzip.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libgrub_a-gunzip.Po' tmpdepfile='$(DEPDIR)/libgrub_a-gunzip.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-gunzip.obj `if test -f 'gunzip.c'; then $(CYGPATH_W) 'gunzip.c'; else $(CYGPATH_W) '$(srcdir)/gunzip.c'; fi` - -libgrub_a-md5.o: md5.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-md5.o -MD -MP -MF "$(DEPDIR)/libgrub_a-md5.Tpo" -c -o libgrub_a-md5.o `test -f 'md5.c' || echo '$(srcdir)/'`md5.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-md5.Tpo" "$(DEPDIR)/libgrub_a-md5.Po"; else rm -f "$(DEPDIR)/libgrub_a-md5.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='md5.c' object='libgrub_a-md5.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libgrub_a-md5.Po' tmpdepfile='$(DEPDIR)/libgrub_a-md5.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-md5.o `test -f 'md5.c' || echo '$(srcdir)/'`md5.c - -libgrub_a-md5.obj: md5.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-md5.obj -MD -MP -MF "$(DEPDIR)/libgrub_a-md5.Tpo" -c -o libgrub_a-md5.obj `if test -f 'md5.c'; then $(CYGPATH_W) 'md5.c'; else $(CYGPATH_W) '$(srcdir)/md5.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-md5.Tpo" "$(DEPDIR)/libgrub_a-md5.Po"; else rm -f "$(DEPDIR)/libgrub_a-md5.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='md5.c' object='libgrub_a-md5.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libgrub_a-md5.Po' tmpdepfile='$(DEPDIR)/libgrub_a-md5.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-md5.obj `if test -f 'md5.c'; then $(CYGPATH_W) 'md5.c'; else $(CYGPATH_W) '$(srcdir)/md5.c'; fi` - -libgrub_a-serial.o: serial.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-serial.o -MD -MP -MF "$(DEPDIR)/libgrub_a-serial.Tpo" -c -o libgrub_a-serial.o `test -f 'serial.c' || echo '$(srcdir)/'`serial.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-serial.Tpo" "$(DEPDIR)/libgrub_a-serial.Po"; else rm -f "$(DEPDIR)/libgrub_a-serial.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='serial.c' object='libgrub_a-serial.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libgrub_a-serial.Po' tmpdepfile='$(DEPDIR)/libgrub_a-serial.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-serial.o `test -f 'serial.c' || echo '$(srcdir)/'`serial.c - -libgrub_a-serial.obj: serial.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-serial.obj -MD -MP -MF "$(DEPDIR)/libgrub_a-serial.Tpo" -c -o libgrub_a-serial.obj `if test -f 'serial.c'; then $(CYGPATH_W) 'serial.c'; else $(CYGPATH_W) '$(srcdir)/serial.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-serial.Tpo" "$(DEPDIR)/libgrub_a-serial.Po"; else rm -f "$(DEPDIR)/libgrub_a-serial.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='serial.c' object='libgrub_a-serial.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libgrub_a-serial.Po' tmpdepfile='$(DEPDIR)/libgrub_a-serial.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-serial.obj `if test -f 'serial.c'; then $(CYGPATH_W) 'serial.c'; else $(CYGPATH_W) '$(srcdir)/serial.c'; fi` - -libgrub_a-stage2.o: stage2.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-stage2.o -MD -MP -MF "$(DEPDIR)/libgrub_a-stage2.Tpo" -c -o libgrub_a-stage2.o `test -f 'stage2.c' || echo '$(srcdir)/'`stage2.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-stage2.Tpo" "$(DEPDIR)/libgrub_a-stage2.Po"; else rm -f "$(DEPDIR)/libgrub_a-stage2.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='stage2.c' object='libgrub_a-stage2.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libgrub_a-stage2.Po' tmpdepfile='$(DEPDIR)/libgrub_a-stage2.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-stage2.o `test -f 'stage2.c' || echo '$(srcdir)/'`stage2.c - -libgrub_a-stage2.obj: stage2.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-stage2.obj -MD -MP -MF "$(DEPDIR)/libgrub_a-stage2.Tpo" -c -o libgrub_a-stage2.obj `if test -f 'stage2.c'; then $(CYGPATH_W) 'stage2.c'; else $(CYGPATH_W) '$(srcdir)/stage2.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-stage2.Tpo" "$(DEPDIR)/libgrub_a-stage2.Po"; else rm -f "$(DEPDIR)/libgrub_a-stage2.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='stage2.c' object='libgrub_a-stage2.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libgrub_a-stage2.Po' tmpdepfile='$(DEPDIR)/libgrub_a-stage2.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-stage2.obj `if test -f 'stage2.c'; then $(CYGPATH_W) 'stage2.c'; else $(CYGPATH_W) '$(srcdir)/stage2.c'; fi` - -libgrub_a-terminfo.o: terminfo.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-terminfo.o -MD -MP -MF "$(DEPDIR)/libgrub_a-terminfo.Tpo" -c -o libgrub_a-terminfo.o `test -f 'terminfo.c' || echo '$(srcdir)/'`terminfo.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-terminfo.Tpo" "$(DEPDIR)/libgrub_a-terminfo.Po"; else rm -f "$(DEPDIR)/libgrub_a-terminfo.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='terminfo.c' object='libgrub_a-terminfo.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libgrub_a-terminfo.Po' tmpdepfile='$(DEPDIR)/libgrub_a-terminfo.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-terminfo.o `test -f 'terminfo.c' || echo '$(srcdir)/'`terminfo.c - -libgrub_a-terminfo.obj: terminfo.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-terminfo.obj -MD -MP -MF "$(DEPDIR)/libgrub_a-terminfo.Tpo" -c -o libgrub_a-terminfo.obj `if test -f 'terminfo.c'; then $(CYGPATH_W) 'terminfo.c'; else $(CYGPATH_W) '$(srcdir)/terminfo.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-terminfo.Tpo" "$(DEPDIR)/libgrub_a-terminfo.Po"; else rm -f "$(DEPDIR)/libgrub_a-terminfo.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='terminfo.c' object='libgrub_a-terminfo.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libgrub_a-terminfo.Po' tmpdepfile='$(DEPDIR)/libgrub_a-terminfo.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-terminfo.obj `if test -f 'terminfo.c'; then $(CYGPATH_W) 'terminfo.c'; else $(CYGPATH_W) '$(srcdir)/terminfo.c'; fi` - -libgrub_a-tparm.o: tparm.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-tparm.o -MD -MP -MF "$(DEPDIR)/libgrub_a-tparm.Tpo" -c -o libgrub_a-tparm.o `test -f 'tparm.c' || echo '$(srcdir)/'`tparm.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-tparm.Tpo" "$(DEPDIR)/libgrub_a-tparm.Po"; else rm -f "$(DEPDIR)/libgrub_a-tparm.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tparm.c' object='libgrub_a-tparm.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libgrub_a-tparm.Po' tmpdepfile='$(DEPDIR)/libgrub_a-tparm.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-tparm.o `test -f 'tparm.c' || echo '$(srcdir)/'`tparm.c - -libgrub_a-tparm.obj: tparm.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-tparm.obj -MD -MP -MF "$(DEPDIR)/libgrub_a-tparm.Tpo" -c -o libgrub_a-tparm.obj `if test -f 'tparm.c'; then $(CYGPATH_W) 'tparm.c'; else $(CYGPATH_W) '$(srcdir)/tparm.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-tparm.Tpo" "$(DEPDIR)/libgrub_a-tparm.Po"; else rm -f "$(DEPDIR)/libgrub_a-tparm.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tparm.c' object='libgrub_a-tparm.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libgrub_a-tparm.Po' tmpdepfile='$(DEPDIR)/libgrub_a-tparm.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-tparm.obj `if test -f 'tparm.c'; then $(CYGPATH_W) 'tparm.c'; else $(CYGPATH_W) '$(srcdir)/tparm.c'; fi` - -libgrub_a-graphics.o: graphics.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-graphics.o -MD -MP -MF "$(DEPDIR)/libgrub_a-graphics.Tpo" -c -o libgrub_a-graphics.o `test -f 'graphics.c' || echo '$(srcdir)/'`graphics.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-graphics.Tpo" "$(DEPDIR)/libgrub_a-graphics.Po"; else rm -f "$(DEPDIR)/libgrub_a-graphics.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='graphics.c' object='libgrub_a-graphics.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libgrub_a-graphics.Po' tmpdepfile='$(DEPDIR)/libgrub_a-graphics.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-graphics.o `test -f 'graphics.c' || echo '$(srcdir)/'`graphics.c - -libgrub_a-graphics.obj: graphics.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-graphics.obj -MD -MP -MF "$(DEPDIR)/libgrub_a-graphics.Tpo" -c -o libgrub_a-graphics.obj `if test -f 'graphics.c'; then $(CYGPATH_W) 'graphics.c'; else $(CYGPATH_W) '$(srcdir)/graphics.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-graphics.Tpo" "$(DEPDIR)/libgrub_a-graphics.Po"; else rm -f "$(DEPDIR)/libgrub_a-graphics.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='graphics.c' object='libgrub_a-graphics.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libgrub_a-graphics.Po' tmpdepfile='$(DEPDIR)/libgrub_a-graphics.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-graphics.obj `if test -f 'graphics.c'; then $(CYGPATH_W) 'graphics.c'; else $(CYGPATH_W) '$(srcdir)/graphics.c'; fi` - -diskless_exec-bios.o: bios.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-bios.o -MD -MP -MF "$(DEPDIR)/diskless_exec-bios.Tpo" -c -o diskless_exec-bios.o `test -f 'bios.c' || echo '$(srcdir)/'`bios.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-bios.Tpo" "$(DEPDIR)/diskless_exec-bios.Po"; else rm -f "$(DEPDIR)/diskless_exec-bios.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bios.c' object='diskless_exec-bios.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/diskless_exec-bios.Po' tmpdepfile='$(DEPDIR)/diskless_exec-bios.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-bios.o `test -f 'bios.c' || echo '$(srcdir)/'`bios.c - -diskless_exec-bios.obj: bios.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-bios.obj -MD -MP -MF "$(DEPDIR)/diskless_exec-bios.Tpo" -c -o diskless_exec-bios.obj `if test -f 'bios.c'; then $(CYGPATH_W) 'bios.c'; else $(CYGPATH_W) '$(srcdir)/bios.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-bios.Tpo" "$(DEPDIR)/diskless_exec-bios.Po"; else rm -f "$(DEPDIR)/diskless_exec-bios.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bios.c' object='diskless_exec-bios.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/diskless_exec-bios.Po' tmpdepfile='$(DEPDIR)/diskless_exec-bios.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-bios.obj `if test -f 'bios.c'; then $(CYGPATH_W) 'bios.c'; else $(CYGPATH_W) '$(srcdir)/bios.c'; fi` - -diskless_exec-boot.o: boot.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-boot.o -MD -MP -MF "$(DEPDIR)/diskless_exec-boot.Tpo" -c -o diskless_exec-boot.o `test -f 'boot.c' || echo '$(srcdir)/'`boot.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-boot.Tpo" "$(DEPDIR)/diskless_exec-boot.Po"; else rm -f "$(DEPDIR)/diskless_exec-boot.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='boot.c' object='diskless_exec-boot.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/diskless_exec-boot.Po' tmpdepfile='$(DEPDIR)/diskless_exec-boot.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-boot.o `test -f 'boot.c' || echo '$(srcdir)/'`boot.c - -diskless_exec-boot.obj: boot.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-boot.obj -MD -MP -MF "$(DEPDIR)/diskless_exec-boot.Tpo" -c -o diskless_exec-boot.obj `if test -f 'boot.c'; then $(CYGPATH_W) 'boot.c'; else $(CYGPATH_W) '$(srcdir)/boot.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-boot.Tpo" "$(DEPDIR)/diskless_exec-boot.Po"; else rm -f "$(DEPDIR)/diskless_exec-boot.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='boot.c' object='diskless_exec-boot.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/diskless_exec-boot.Po' tmpdepfile='$(DEPDIR)/diskless_exec-boot.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-boot.obj `if test -f 'boot.c'; then $(CYGPATH_W) 'boot.c'; else $(CYGPATH_W) '$(srcdir)/boot.c'; fi` - -diskless_exec-builtins.o: builtins.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-builtins.o -MD -MP -MF "$(DEPDIR)/diskless_exec-builtins.Tpo" -c -o diskless_exec-builtins.o `test -f 'builtins.c' || echo '$(srcdir)/'`builtins.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-builtins.Tpo" "$(DEPDIR)/diskless_exec-builtins.Po"; else rm -f "$(DEPDIR)/diskless_exec-builtins.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='builtins.c' object='diskless_exec-builtins.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/diskless_exec-builtins.Po' tmpdepfile='$(DEPDIR)/diskless_exec-builtins.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-builtins.o `test -f 'builtins.c' || echo '$(srcdir)/'`builtins.c - -diskless_exec-builtins.obj: builtins.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-builtins.obj -MD -MP -MF "$(DEPDIR)/diskless_exec-builtins.Tpo" -c -o diskless_exec-builtins.obj `if test -f 'builtins.c'; then $(CYGPATH_W) 'builtins.c'; else $(CYGPATH_W) '$(srcdir)/builtins.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-builtins.Tpo" "$(DEPDIR)/diskless_exec-builtins.Po"; else rm -f "$(DEPDIR)/diskless_exec-builtins.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='builtins.c' object='diskless_exec-builtins.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/diskless_exec-builtins.Po' tmpdepfile='$(DEPDIR)/diskless_exec-builtins.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-builtins.obj `if test -f 'builtins.c'; then $(CYGPATH_W) 'builtins.c'; else $(CYGPATH_W) '$(srcdir)/builtins.c'; fi` - -diskless_exec-char_io.o: char_io.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-char_io.o -MD -MP -MF "$(DEPDIR)/diskless_exec-char_io.Tpo" -c -o diskless_exec-char_io.o `test -f 'char_io.c' || echo '$(srcdir)/'`char_io.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-char_io.Tpo" "$(DEPDIR)/diskless_exec-char_io.Po"; else rm -f "$(DEPDIR)/diskless_exec-char_io.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='char_io.c' object='diskless_exec-char_io.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/diskless_exec-char_io.Po' tmpdepfile='$(DEPDIR)/diskless_exec-char_io.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-char_io.o `test -f 'char_io.c' || echo '$(srcdir)/'`char_io.c - -diskless_exec-char_io.obj: char_io.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-char_io.obj -MD -MP -MF "$(DEPDIR)/diskless_exec-char_io.Tpo" -c -o diskless_exec-char_io.obj `if test -f 'char_io.c'; then $(CYGPATH_W) 'char_io.c'; else $(CYGPATH_W) '$(srcdir)/char_io.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-char_io.Tpo" "$(DEPDIR)/diskless_exec-char_io.Po"; else rm -f "$(DEPDIR)/diskless_exec-char_io.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='char_io.c' object='diskless_exec-char_io.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/diskless_exec-char_io.Po' tmpdepfile='$(DEPDIR)/diskless_exec-char_io.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-char_io.obj `if test -f 'char_io.c'; then $(CYGPATH_W) 'char_io.c'; else $(CYGPATH_W) '$(srcdir)/char_io.c'; fi` - -diskless_exec-cmdline.o: cmdline.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-cmdline.o -MD -MP -MF "$(DEPDIR)/diskless_exec-cmdline.Tpo" -c -o diskless_exec-cmdline.o `test -f 'cmdline.c' || echo '$(srcdir)/'`cmdline.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-cmdline.Tpo" "$(DEPDIR)/diskless_exec-cmdline.Po"; else rm -f "$(DEPDIR)/diskless_exec-cmdline.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cmdline.c' object='diskless_exec-cmdline.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/diskless_exec-cmdline.Po' tmpdepfile='$(DEPDIR)/diskless_exec-cmdline.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-cmdline.o `test -f 'cmdline.c' || echo '$(srcdir)/'`cmdline.c - -diskless_exec-cmdline.obj: cmdline.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-cmdline.obj -MD -MP -MF "$(DEPDIR)/diskless_exec-cmdline.Tpo" -c -o diskless_exec-cmdline.obj `if test -f 'cmdline.c'; then $(CYGPATH_W) 'cmdline.c'; else $(CYGPATH_W) '$(srcdir)/cmdline.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-cmdline.Tpo" "$(DEPDIR)/diskless_exec-cmdline.Po"; else rm -f "$(DEPDIR)/diskless_exec-cmdline.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cmdline.c' object='diskless_exec-cmdline.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/diskless_exec-cmdline.Po' tmpdepfile='$(DEPDIR)/diskless_exec-cmdline.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-cmdline.obj `if test -f 'cmdline.c'; then $(CYGPATH_W) 'cmdline.c'; else $(CYGPATH_W) '$(srcdir)/cmdline.c'; fi` - -diskless_exec-common.o: common.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-common.o -MD -MP -MF "$(DEPDIR)/diskless_exec-common.Tpo" -c -o diskless_exec-common.o `test -f 'common.c' || echo '$(srcdir)/'`common.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-common.Tpo" "$(DEPDIR)/diskless_exec-common.Po"; else rm -f "$(DEPDIR)/diskless_exec-common.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='common.c' object='diskless_exec-common.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/diskless_exec-common.Po' tmpdepfile='$(DEPDIR)/diskless_exec-common.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-common.o `test -f 'common.c' || echo '$(srcdir)/'`common.c - -diskless_exec-common.obj: common.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-common.obj -MD -MP -MF "$(DEPDIR)/diskless_exec-common.Tpo" -c -o diskless_exec-common.obj `if test -f 'common.c'; then $(CYGPATH_W) 'common.c'; else $(CYGPATH_W) '$(srcdir)/common.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-common.Tpo" "$(DEPDIR)/diskless_exec-common.Po"; else rm -f "$(DEPDIR)/diskless_exec-common.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='common.c' object='diskless_exec-common.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/diskless_exec-common.Po' tmpdepfile='$(DEPDIR)/diskless_exec-common.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-common.obj `if test -f 'common.c'; then $(CYGPATH_W) 'common.c'; else $(CYGPATH_W) '$(srcdir)/common.c'; fi` - -diskless_exec-console.o: console.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-console.o -MD -MP -MF "$(DEPDIR)/diskless_exec-console.Tpo" -c -o diskless_exec-console.o `test -f 'console.c' || echo '$(srcdir)/'`console.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-console.Tpo" "$(DEPDIR)/diskless_exec-console.Po"; else rm -f "$(DEPDIR)/diskless_exec-console.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='console.c' object='diskless_exec-console.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/diskless_exec-console.Po' tmpdepfile='$(DEPDIR)/diskless_exec-console.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-console.o `test -f 'console.c' || echo '$(srcdir)/'`console.c - -diskless_exec-console.obj: console.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-console.obj -MD -MP -MF "$(DEPDIR)/diskless_exec-console.Tpo" -c -o diskless_exec-console.obj `if test -f 'console.c'; then $(CYGPATH_W) 'console.c'; else $(CYGPATH_W) '$(srcdir)/console.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-console.Tpo" "$(DEPDIR)/diskless_exec-console.Po"; else rm -f "$(DEPDIR)/diskless_exec-console.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='console.c' object='diskless_exec-console.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/diskless_exec-console.Po' tmpdepfile='$(DEPDIR)/diskless_exec-console.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-console.obj `if test -f 'console.c'; then $(CYGPATH_W) 'console.c'; else $(CYGPATH_W) '$(srcdir)/console.c'; fi` - -diskless_exec-disk_io.o: disk_io.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-disk_io.o -MD -MP -MF "$(DEPDIR)/diskless_exec-disk_io.Tpo" -c -o diskless_exec-disk_io.o `test -f 'disk_io.c' || echo '$(srcdir)/'`disk_io.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-disk_io.Tpo" "$(DEPDIR)/diskless_exec-disk_io.Po"; else rm -f "$(DEPDIR)/diskless_exec-disk_io.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='disk_io.c' object='diskless_exec-disk_io.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/diskless_exec-disk_io.Po' tmpdepfile='$(DEPDIR)/diskless_exec-disk_io.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-disk_io.o `test -f 'disk_io.c' || echo '$(srcdir)/'`disk_io.c - -diskless_exec-disk_io.obj: disk_io.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-disk_io.obj -MD -MP -MF "$(DEPDIR)/diskless_exec-disk_io.Tpo" -c -o diskless_exec-disk_io.obj `if test -f 'disk_io.c'; then $(CYGPATH_W) 'disk_io.c'; else $(CYGPATH_W) '$(srcdir)/disk_io.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-disk_io.Tpo" "$(DEPDIR)/diskless_exec-disk_io.Po"; else rm -f "$(DEPDIR)/diskless_exec-disk_io.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='disk_io.c' object='diskless_exec-disk_io.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/diskless_exec-disk_io.Po' tmpdepfile='$(DEPDIR)/diskless_exec-disk_io.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-disk_io.obj `if test -f 'disk_io.c'; then $(CYGPATH_W) 'disk_io.c'; else $(CYGPATH_W) '$(srcdir)/disk_io.c'; fi` - -diskless_exec-fsys_ext2fs.o: fsys_ext2fs.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-fsys_ext2fs.o -MD -MP -MF "$(DEPDIR)/diskless_exec-fsys_ext2fs.Tpo" -c -o diskless_exec-fsys_ext2fs.o `test -f 'fsys_ext2fs.c' || echo '$(srcdir)/'`fsys_ext2fs.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-fsys_ext2fs.Tpo" "$(DEPDIR)/diskless_exec-fsys_ext2fs.Po"; else rm -f "$(DEPDIR)/diskless_exec-fsys_ext2fs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_ext2fs.c' object='diskless_exec-fsys_ext2fs.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/diskless_exec-fsys_ext2fs.Po' tmpdepfile='$(DEPDIR)/diskless_exec-fsys_ext2fs.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-fsys_ext2fs.o `test -f 'fsys_ext2fs.c' || echo '$(srcdir)/'`fsys_ext2fs.c - -diskless_exec-fsys_ext2fs.obj: fsys_ext2fs.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-fsys_ext2fs.obj -MD -MP -MF "$(DEPDIR)/diskless_exec-fsys_ext2fs.Tpo" -c -o diskless_exec-fsys_ext2fs.obj `if test -f 'fsys_ext2fs.c'; then $(CYGPATH_W) 'fsys_ext2fs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_ext2fs.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-fsys_ext2fs.Tpo" "$(DEPDIR)/diskless_exec-fsys_ext2fs.Po"; else rm -f "$(DEPDIR)/diskless_exec-fsys_ext2fs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_ext2fs.c' object='diskless_exec-fsys_ext2fs.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/diskless_exec-fsys_ext2fs.Po' tmpdepfile='$(DEPDIR)/diskless_exec-fsys_ext2fs.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-fsys_ext2fs.obj `if test -f 'fsys_ext2fs.c'; then $(CYGPATH_W) 'fsys_ext2fs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_ext2fs.c'; fi` - -diskless_exec-fsys_fat.o: fsys_fat.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-fsys_fat.o -MD -MP -MF "$(DEPDIR)/diskless_exec-fsys_fat.Tpo" -c -o diskless_exec-fsys_fat.o `test -f 'fsys_fat.c' || echo '$(srcdir)/'`fsys_fat.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-fsys_fat.Tpo" "$(DEPDIR)/diskless_exec-fsys_fat.Po"; else rm -f "$(DEPDIR)/diskless_exec-fsys_fat.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_fat.c' object='diskless_exec-fsys_fat.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/diskless_exec-fsys_fat.Po' tmpdepfile='$(DEPDIR)/diskless_exec-fsys_fat.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-fsys_fat.o `test -f 'fsys_fat.c' || echo '$(srcdir)/'`fsys_fat.c - -diskless_exec-fsys_fat.obj: fsys_fat.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-fsys_fat.obj -MD -MP -MF "$(DEPDIR)/diskless_exec-fsys_fat.Tpo" -c -o diskless_exec-fsys_fat.obj `if test -f 'fsys_fat.c'; then $(CYGPATH_W) 'fsys_fat.c'; else $(CYGPATH_W) '$(srcdir)/fsys_fat.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-fsys_fat.Tpo" "$(DEPDIR)/diskless_exec-fsys_fat.Po"; else rm -f "$(DEPDIR)/diskless_exec-fsys_fat.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_fat.c' object='diskless_exec-fsys_fat.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/diskless_exec-fsys_fat.Po' tmpdepfile='$(DEPDIR)/diskless_exec-fsys_fat.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-fsys_fat.obj `if test -f 'fsys_fat.c'; then $(CYGPATH_W) 'fsys_fat.c'; else $(CYGPATH_W) '$(srcdir)/fsys_fat.c'; fi` - -diskless_exec-fsys_ffs.o: fsys_ffs.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-fsys_ffs.o -MD -MP -MF "$(DEPDIR)/diskless_exec-fsys_ffs.Tpo" -c -o diskless_exec-fsys_ffs.o `test -f 'fsys_ffs.c' || echo '$(srcdir)/'`fsys_ffs.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-fsys_ffs.Tpo" "$(DEPDIR)/diskless_exec-fsys_ffs.Po"; else rm -f "$(DEPDIR)/diskless_exec-fsys_ffs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_ffs.c' object='diskless_exec-fsys_ffs.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/diskless_exec-fsys_ffs.Po' tmpdepfile='$(DEPDIR)/diskless_exec-fsys_ffs.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-fsys_ffs.o `test -f 'fsys_ffs.c' || echo '$(srcdir)/'`fsys_ffs.c - -diskless_exec-fsys_ffs.obj: fsys_ffs.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-fsys_ffs.obj -MD -MP -MF "$(DEPDIR)/diskless_exec-fsys_ffs.Tpo" -c -o diskless_exec-fsys_ffs.obj `if test -f 'fsys_ffs.c'; then $(CYGPATH_W) 'fsys_ffs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_ffs.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-fsys_ffs.Tpo" "$(DEPDIR)/diskless_exec-fsys_ffs.Po"; else rm -f "$(DEPDIR)/diskless_exec-fsys_ffs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_ffs.c' object='diskless_exec-fsys_ffs.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/diskless_exec-fsys_ffs.Po' tmpdepfile='$(DEPDIR)/diskless_exec-fsys_ffs.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-fsys_ffs.obj `if test -f 'fsys_ffs.c'; then $(CYGPATH_W) 'fsys_ffs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_ffs.c'; fi` - -diskless_exec-fsys_iso9660.o: fsys_iso9660.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-fsys_iso9660.o -MD -MP -MF "$(DEPDIR)/diskless_exec-fsys_iso9660.Tpo" -c -o diskless_exec-fsys_iso9660.o `test -f 'fsys_iso9660.c' || echo '$(srcdir)/'`fsys_iso9660.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-fsys_iso9660.Tpo" "$(DEPDIR)/diskless_exec-fsys_iso9660.Po"; else rm -f "$(DEPDIR)/diskless_exec-fsys_iso9660.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_iso9660.c' object='diskless_exec-fsys_iso9660.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/diskless_exec-fsys_iso9660.Po' tmpdepfile='$(DEPDIR)/diskless_exec-fsys_iso9660.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-fsys_iso9660.o `test -f 'fsys_iso9660.c' || echo '$(srcdir)/'`fsys_iso9660.c - -diskless_exec-fsys_iso9660.obj: fsys_iso9660.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-fsys_iso9660.obj -MD -MP -MF "$(DEPDIR)/diskless_exec-fsys_iso9660.Tpo" -c -o diskless_exec-fsys_iso9660.obj `if test -f 'fsys_iso9660.c'; then $(CYGPATH_W) 'fsys_iso9660.c'; else $(CYGPATH_W) '$(srcdir)/fsys_iso9660.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-fsys_iso9660.Tpo" "$(DEPDIR)/diskless_exec-fsys_iso9660.Po"; else rm -f "$(DEPDIR)/diskless_exec-fsys_iso9660.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_iso9660.c' object='diskless_exec-fsys_iso9660.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/diskless_exec-fsys_iso9660.Po' tmpdepfile='$(DEPDIR)/diskless_exec-fsys_iso9660.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-fsys_iso9660.obj `if test -f 'fsys_iso9660.c'; then $(CYGPATH_W) 'fsys_iso9660.c'; else $(CYGPATH_W) '$(srcdir)/fsys_iso9660.c'; fi` - -diskless_exec-fsys_jfs.o: fsys_jfs.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-fsys_jfs.o -MD -MP -MF "$(DEPDIR)/diskless_exec-fsys_jfs.Tpo" -c -o diskless_exec-fsys_jfs.o `test -f 'fsys_jfs.c' || echo '$(srcdir)/'`fsys_jfs.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-fsys_jfs.Tpo" "$(DEPDIR)/diskless_exec-fsys_jfs.Po"; else rm -f "$(DEPDIR)/diskless_exec-fsys_jfs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_jfs.c' object='diskless_exec-fsys_jfs.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/diskless_exec-fsys_jfs.Po' tmpdepfile='$(DEPDIR)/diskless_exec-fsys_jfs.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-fsys_jfs.o `test -f 'fsys_jfs.c' || echo '$(srcdir)/'`fsys_jfs.c - -diskless_exec-fsys_jfs.obj: fsys_jfs.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-fsys_jfs.obj -MD -MP -MF "$(DEPDIR)/diskless_exec-fsys_jfs.Tpo" -c -o diskless_exec-fsys_jfs.obj `if test -f 'fsys_jfs.c'; then $(CYGPATH_W) 'fsys_jfs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_jfs.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-fsys_jfs.Tpo" "$(DEPDIR)/diskless_exec-fsys_jfs.Po"; else rm -f "$(DEPDIR)/diskless_exec-fsys_jfs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_jfs.c' object='diskless_exec-fsys_jfs.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/diskless_exec-fsys_jfs.Po' tmpdepfile='$(DEPDIR)/diskless_exec-fsys_jfs.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-fsys_jfs.obj `if test -f 'fsys_jfs.c'; then $(CYGPATH_W) 'fsys_jfs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_jfs.c'; fi` - -diskless_exec-fsys_minix.o: fsys_minix.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-fsys_minix.o -MD -MP -MF "$(DEPDIR)/diskless_exec-fsys_minix.Tpo" -c -o diskless_exec-fsys_minix.o `test -f 'fsys_minix.c' || echo '$(srcdir)/'`fsys_minix.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-fsys_minix.Tpo" "$(DEPDIR)/diskless_exec-fsys_minix.Po"; else rm -f "$(DEPDIR)/diskless_exec-fsys_minix.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_minix.c' object='diskless_exec-fsys_minix.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/diskless_exec-fsys_minix.Po' tmpdepfile='$(DEPDIR)/diskless_exec-fsys_minix.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-fsys_minix.o `test -f 'fsys_minix.c' || echo '$(srcdir)/'`fsys_minix.c - -diskless_exec-fsys_minix.obj: fsys_minix.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-fsys_minix.obj -MD -MP -MF "$(DEPDIR)/diskless_exec-fsys_minix.Tpo" -c -o diskless_exec-fsys_minix.obj `if test -f 'fsys_minix.c'; then $(CYGPATH_W) 'fsys_minix.c'; else $(CYGPATH_W) '$(srcdir)/fsys_minix.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-fsys_minix.Tpo" "$(DEPDIR)/diskless_exec-fsys_minix.Po"; else rm -f "$(DEPDIR)/diskless_exec-fsys_minix.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_minix.c' object='diskless_exec-fsys_minix.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/diskless_exec-fsys_minix.Po' tmpdepfile='$(DEPDIR)/diskless_exec-fsys_minix.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-fsys_minix.obj `if test -f 'fsys_minix.c'; then $(CYGPATH_W) 'fsys_minix.c'; else $(CYGPATH_W) '$(srcdir)/fsys_minix.c'; fi` - -diskless_exec-fsys_reiserfs.o: fsys_reiserfs.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-fsys_reiserfs.o -MD -MP -MF "$(DEPDIR)/diskless_exec-fsys_reiserfs.Tpo" -c -o diskless_exec-fsys_reiserfs.o `test -f 'fsys_reiserfs.c' || echo '$(srcdir)/'`fsys_reiserfs.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-fsys_reiserfs.Tpo" "$(DEPDIR)/diskless_exec-fsys_reiserfs.Po"; else rm -f "$(DEPDIR)/diskless_exec-fsys_reiserfs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_reiserfs.c' object='diskless_exec-fsys_reiserfs.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/diskless_exec-fsys_reiserfs.Po' tmpdepfile='$(DEPDIR)/diskless_exec-fsys_reiserfs.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-fsys_reiserfs.o `test -f 'fsys_reiserfs.c' || echo '$(srcdir)/'`fsys_reiserfs.c - -diskless_exec-fsys_reiserfs.obj: fsys_reiserfs.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-fsys_reiserfs.obj -MD -MP -MF "$(DEPDIR)/diskless_exec-fsys_reiserfs.Tpo" -c -o diskless_exec-fsys_reiserfs.obj `if test -f 'fsys_reiserfs.c'; then $(CYGPATH_W) 'fsys_reiserfs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_reiserfs.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-fsys_reiserfs.Tpo" "$(DEPDIR)/diskless_exec-fsys_reiserfs.Po"; else rm -f "$(DEPDIR)/diskless_exec-fsys_reiserfs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_reiserfs.c' object='diskless_exec-fsys_reiserfs.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/diskless_exec-fsys_reiserfs.Po' tmpdepfile='$(DEPDIR)/diskless_exec-fsys_reiserfs.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-fsys_reiserfs.obj `if test -f 'fsys_reiserfs.c'; then $(CYGPATH_W) 'fsys_reiserfs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_reiserfs.c'; fi` - -diskless_exec-zfs_sha256.o: zfs_sha256.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-zfs_sha256.o -MD -MP -MF "$(DEPDIR)/diskless_exec-zfs_sha256.Tpo" -c -o diskless_exec-zfs_sha256.o `test -f 'zfs_sha256.c' || echo '$(srcdir)/'`zfs_sha256.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-zfs_sha256.Tpo" "$(DEPDIR)/diskless_exec-zfs_sha256.Po"; else rm -f "$(DEPDIR)/diskless_exec-zfs_sha256.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='zfs_sha256.c' object='diskless_exec-zfs_sha256.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/diskless_exec-zfs_sha256.Po' tmpdepfile='$(DEPDIR)/diskless_exec-zfs_sha256.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-zfs_sha256.o `test -f 'zfs_sha256.c' || echo '$(srcdir)/'`zfs_sha256.c - -diskless_exec-zfs_sha256.obj: zfs_sha256.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-zfs_sha256.obj -MD -MP -MF "$(DEPDIR)/diskless_exec-zfs_sha256.Tpo" -c -o diskless_exec-zfs_sha256.obj `if test -f 'zfs_sha256.c'; then $(CYGPATH_W) 'zfs_sha256.c'; else $(CYGPATH_W) '$(srcdir)/zfs_sha256.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-zfs_sha256.Tpo" "$(DEPDIR)/diskless_exec-zfs_sha256.Po"; else rm -f "$(DEPDIR)/diskless_exec-zfs_sha256.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='zfs_sha256.c' object='diskless_exec-zfs_sha256.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/diskless_exec-zfs_sha256.Po' tmpdepfile='$(DEPDIR)/diskless_exec-zfs_sha256.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-zfs_sha256.obj `if test -f 'zfs_sha256.c'; then $(CYGPATH_W) 'zfs_sha256.c'; else $(CYGPATH_W) '$(srcdir)/zfs_sha256.c'; fi` - -diskless_exec-zfs_lzjb.o: zfs_lzjb.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-zfs_lzjb.o -MD -MP -MF "$(DEPDIR)/diskless_exec-zfs_lzjb.Tpo" -c -o diskless_exec-zfs_lzjb.o `test -f 'zfs_lzjb.c' || echo '$(srcdir)/'`zfs_lzjb.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-zfs_lzjb.Tpo" "$(DEPDIR)/diskless_exec-zfs_lzjb.Po"; else rm -f "$(DEPDIR)/diskless_exec-zfs_lzjb.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='zfs_lzjb.c' object='diskless_exec-zfs_lzjb.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/diskless_exec-zfs_lzjb.Po' tmpdepfile='$(DEPDIR)/diskless_exec-zfs_lzjb.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-zfs_lzjb.o `test -f 'zfs_lzjb.c' || echo '$(srcdir)/'`zfs_lzjb.c - -diskless_exec-zfs_lzjb.obj: zfs_lzjb.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-zfs_lzjb.obj -MD -MP -MF "$(DEPDIR)/diskless_exec-zfs_lzjb.Tpo" -c -o diskless_exec-zfs_lzjb.obj `if test -f 'zfs_lzjb.c'; then $(CYGPATH_W) 'zfs_lzjb.c'; else $(CYGPATH_W) '$(srcdir)/zfs_lzjb.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-zfs_lzjb.Tpo" "$(DEPDIR)/diskless_exec-zfs_lzjb.Po"; else rm -f "$(DEPDIR)/diskless_exec-zfs_lzjb.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='zfs_lzjb.c' object='diskless_exec-zfs_lzjb.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/diskless_exec-zfs_lzjb.Po' tmpdepfile='$(DEPDIR)/diskless_exec-zfs_lzjb.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-zfs_lzjb.obj `if test -f 'zfs_lzjb.c'; then $(CYGPATH_W) 'zfs_lzjb.c'; else $(CYGPATH_W) '$(srcdir)/zfs_lzjb.c'; fi` - -diskless_exec-zfs_fletcher.o: zfs_fletcher.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-zfs_fletcher.o -MD -MP -MF "$(DEPDIR)/diskless_exec-zfs_fletcher.Tpo" -c -o diskless_exec-zfs_fletcher.o `test -f 'zfs_fletcher.c' || echo '$(srcdir)/'`zfs_fletcher.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-zfs_fletcher.Tpo" "$(DEPDIR)/diskless_exec-zfs_fletcher.Po"; else rm -f "$(DEPDIR)/diskless_exec-zfs_fletcher.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='zfs_fletcher.c' object='diskless_exec-zfs_fletcher.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/diskless_exec-zfs_fletcher.Po' tmpdepfile='$(DEPDIR)/diskless_exec-zfs_fletcher.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-zfs_fletcher.o `test -f 'zfs_fletcher.c' || echo '$(srcdir)/'`zfs_fletcher.c - -diskless_exec-zfs_fletcher.obj: zfs_fletcher.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-zfs_fletcher.obj -MD -MP -MF "$(DEPDIR)/diskless_exec-zfs_fletcher.Tpo" -c -o diskless_exec-zfs_fletcher.obj `if test -f 'zfs_fletcher.c'; then $(CYGPATH_W) 'zfs_fletcher.c'; else $(CYGPATH_W) '$(srcdir)/zfs_fletcher.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-zfs_fletcher.Tpo" "$(DEPDIR)/diskless_exec-zfs_fletcher.Po"; else rm -f "$(DEPDIR)/diskless_exec-zfs_fletcher.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='zfs_fletcher.c' object='diskless_exec-zfs_fletcher.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/diskless_exec-zfs_fletcher.Po' tmpdepfile='$(DEPDIR)/diskless_exec-zfs_fletcher.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-zfs_fletcher.obj `if test -f 'zfs_fletcher.c'; then $(CYGPATH_W) 'zfs_fletcher.c'; else $(CYGPATH_W) '$(srcdir)/zfs_fletcher.c'; fi` - -diskless_exec-fsys_zfs.o: fsys_zfs.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-fsys_zfs.o -MD -MP -MF "$(DEPDIR)/diskless_exec-fsys_zfs.Tpo" -c -o diskless_exec-fsys_zfs.o `test -f 'fsys_zfs.c' || echo '$(srcdir)/'`fsys_zfs.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-fsys_zfs.Tpo" "$(DEPDIR)/diskless_exec-fsys_zfs.Po"; else rm -f "$(DEPDIR)/diskless_exec-fsys_zfs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_zfs.c' object='diskless_exec-fsys_zfs.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/diskless_exec-fsys_zfs.Po' tmpdepfile='$(DEPDIR)/diskless_exec-fsys_zfs.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-fsys_zfs.o `test -f 'fsys_zfs.c' || echo '$(srcdir)/'`fsys_zfs.c - -diskless_exec-fsys_zfs.obj: fsys_zfs.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-fsys_zfs.obj -MD -MP -MF "$(DEPDIR)/diskless_exec-fsys_zfs.Tpo" -c -o diskless_exec-fsys_zfs.obj `if test -f 'fsys_zfs.c'; then $(CYGPATH_W) 'fsys_zfs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_zfs.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-fsys_zfs.Tpo" "$(DEPDIR)/diskless_exec-fsys_zfs.Po"; else rm -f "$(DEPDIR)/diskless_exec-fsys_zfs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_zfs.c' object='diskless_exec-fsys_zfs.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/diskless_exec-fsys_zfs.Po' tmpdepfile='$(DEPDIR)/diskless_exec-fsys_zfs.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-fsys_zfs.obj `if test -f 'fsys_zfs.c'; then $(CYGPATH_W) 'fsys_zfs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_zfs.c'; fi` - -diskless_exec-fsys_ufs.o: fsys_ufs.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-fsys_ufs.o -MD -MP -MF "$(DEPDIR)/diskless_exec-fsys_ufs.Tpo" -c -o diskless_exec-fsys_ufs.o `test -f 'fsys_ufs.c' || echo '$(srcdir)/'`fsys_ufs.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-fsys_ufs.Tpo" "$(DEPDIR)/diskless_exec-fsys_ufs.Po"; else rm -f "$(DEPDIR)/diskless_exec-fsys_ufs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_ufs.c' object='diskless_exec-fsys_ufs.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/diskless_exec-fsys_ufs.Po' tmpdepfile='$(DEPDIR)/diskless_exec-fsys_ufs.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-fsys_ufs.o `test -f 'fsys_ufs.c' || echo '$(srcdir)/'`fsys_ufs.c - -diskless_exec-fsys_ufs.obj: fsys_ufs.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-fsys_ufs.obj -MD -MP -MF "$(DEPDIR)/diskless_exec-fsys_ufs.Tpo" -c -o diskless_exec-fsys_ufs.obj `if test -f 'fsys_ufs.c'; then $(CYGPATH_W) 'fsys_ufs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_ufs.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-fsys_ufs.Tpo" "$(DEPDIR)/diskless_exec-fsys_ufs.Po"; else rm -f "$(DEPDIR)/diskless_exec-fsys_ufs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_ufs.c' object='diskless_exec-fsys_ufs.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/diskless_exec-fsys_ufs.Po' tmpdepfile='$(DEPDIR)/diskless_exec-fsys_ufs.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-fsys_ufs.obj `if test -f 'fsys_ufs.c'; then $(CYGPATH_W) 'fsys_ufs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_ufs.c'; fi` - -diskless_exec-fsys_ufs2.o: fsys_ufs2.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-fsys_ufs2.o -MD -MP -MF "$(DEPDIR)/diskless_exec-fsys_ufs2.Tpo" -c -o diskless_exec-fsys_ufs2.o `test -f 'fsys_ufs2.c' || echo '$(srcdir)/'`fsys_ufs2.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-fsys_ufs2.Tpo" "$(DEPDIR)/diskless_exec-fsys_ufs2.Po"; else rm -f "$(DEPDIR)/diskless_exec-fsys_ufs2.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_ufs2.c' object='diskless_exec-fsys_ufs2.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/diskless_exec-fsys_ufs2.Po' tmpdepfile='$(DEPDIR)/diskless_exec-fsys_ufs2.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-fsys_ufs2.o `test -f 'fsys_ufs2.c' || echo '$(srcdir)/'`fsys_ufs2.c - -diskless_exec-fsys_ufs2.obj: fsys_ufs2.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-fsys_ufs2.obj -MD -MP -MF "$(DEPDIR)/diskless_exec-fsys_ufs2.Tpo" -c -o diskless_exec-fsys_ufs2.obj `if test -f 'fsys_ufs2.c'; then $(CYGPATH_W) 'fsys_ufs2.c'; else $(CYGPATH_W) '$(srcdir)/fsys_ufs2.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-fsys_ufs2.Tpo" "$(DEPDIR)/diskless_exec-fsys_ufs2.Po"; else rm -f "$(DEPDIR)/diskless_exec-fsys_ufs2.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_ufs2.c' object='diskless_exec-fsys_ufs2.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/diskless_exec-fsys_ufs2.Po' tmpdepfile='$(DEPDIR)/diskless_exec-fsys_ufs2.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-fsys_ufs2.obj `if test -f 'fsys_ufs2.c'; then $(CYGPATH_W) 'fsys_ufs2.c'; else $(CYGPATH_W) '$(srcdir)/fsys_ufs2.c'; fi` - -diskless_exec-fsys_vstafs.o: fsys_vstafs.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-fsys_vstafs.o -MD -MP -MF "$(DEPDIR)/diskless_exec-fsys_vstafs.Tpo" -c -o diskless_exec-fsys_vstafs.o `test -f 'fsys_vstafs.c' || echo '$(srcdir)/'`fsys_vstafs.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-fsys_vstafs.Tpo" "$(DEPDIR)/diskless_exec-fsys_vstafs.Po"; else rm -f "$(DEPDIR)/diskless_exec-fsys_vstafs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_vstafs.c' object='diskless_exec-fsys_vstafs.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/diskless_exec-fsys_vstafs.Po' tmpdepfile='$(DEPDIR)/diskless_exec-fsys_vstafs.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-fsys_vstafs.o `test -f 'fsys_vstafs.c' || echo '$(srcdir)/'`fsys_vstafs.c - -diskless_exec-fsys_vstafs.obj: fsys_vstafs.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-fsys_vstafs.obj -MD -MP -MF "$(DEPDIR)/diskless_exec-fsys_vstafs.Tpo" -c -o diskless_exec-fsys_vstafs.obj `if test -f 'fsys_vstafs.c'; then $(CYGPATH_W) 'fsys_vstafs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_vstafs.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-fsys_vstafs.Tpo" "$(DEPDIR)/diskless_exec-fsys_vstafs.Po"; else rm -f "$(DEPDIR)/diskless_exec-fsys_vstafs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_vstafs.c' object='diskless_exec-fsys_vstafs.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/diskless_exec-fsys_vstafs.Po' tmpdepfile='$(DEPDIR)/diskless_exec-fsys_vstafs.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-fsys_vstafs.obj `if test -f 'fsys_vstafs.c'; then $(CYGPATH_W) 'fsys_vstafs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_vstafs.c'; fi` - -diskless_exec-fsys_xfs.o: fsys_xfs.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-fsys_xfs.o -MD -MP -MF "$(DEPDIR)/diskless_exec-fsys_xfs.Tpo" -c -o diskless_exec-fsys_xfs.o `test -f 'fsys_xfs.c' || echo '$(srcdir)/'`fsys_xfs.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-fsys_xfs.Tpo" "$(DEPDIR)/diskless_exec-fsys_xfs.Po"; else rm -f "$(DEPDIR)/diskless_exec-fsys_xfs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_xfs.c' object='diskless_exec-fsys_xfs.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/diskless_exec-fsys_xfs.Po' tmpdepfile='$(DEPDIR)/diskless_exec-fsys_xfs.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-fsys_xfs.o `test -f 'fsys_xfs.c' || echo '$(srcdir)/'`fsys_xfs.c - -diskless_exec-fsys_xfs.obj: fsys_xfs.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-fsys_xfs.obj -MD -MP -MF "$(DEPDIR)/diskless_exec-fsys_xfs.Tpo" -c -o diskless_exec-fsys_xfs.obj `if test -f 'fsys_xfs.c'; then $(CYGPATH_W) 'fsys_xfs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_xfs.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-fsys_xfs.Tpo" "$(DEPDIR)/diskless_exec-fsys_xfs.Po"; else rm -f "$(DEPDIR)/diskless_exec-fsys_xfs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_xfs.c' object='diskless_exec-fsys_xfs.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/diskless_exec-fsys_xfs.Po' tmpdepfile='$(DEPDIR)/diskless_exec-fsys_xfs.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-fsys_xfs.obj `if test -f 'fsys_xfs.c'; then $(CYGPATH_W) 'fsys_xfs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_xfs.c'; fi` - -diskless_exec-gunzip.o: gunzip.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-gunzip.o -MD -MP -MF "$(DEPDIR)/diskless_exec-gunzip.Tpo" -c -o diskless_exec-gunzip.o `test -f 'gunzip.c' || echo '$(srcdir)/'`gunzip.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-gunzip.Tpo" "$(DEPDIR)/diskless_exec-gunzip.Po"; else rm -f "$(DEPDIR)/diskless_exec-gunzip.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gunzip.c' object='diskless_exec-gunzip.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/diskless_exec-gunzip.Po' tmpdepfile='$(DEPDIR)/diskless_exec-gunzip.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-gunzip.o `test -f 'gunzip.c' || echo '$(srcdir)/'`gunzip.c - -diskless_exec-gunzip.obj: gunzip.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-gunzip.obj -MD -MP -MF "$(DEPDIR)/diskless_exec-gunzip.Tpo" -c -o diskless_exec-gunzip.obj `if test -f 'gunzip.c'; then $(CYGPATH_W) 'gunzip.c'; else $(CYGPATH_W) '$(srcdir)/gunzip.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-gunzip.Tpo" "$(DEPDIR)/diskless_exec-gunzip.Po"; else rm -f "$(DEPDIR)/diskless_exec-gunzip.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gunzip.c' object='diskless_exec-gunzip.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/diskless_exec-gunzip.Po' tmpdepfile='$(DEPDIR)/diskless_exec-gunzip.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-gunzip.obj `if test -f 'gunzip.c'; then $(CYGPATH_W) 'gunzip.c'; else $(CYGPATH_W) '$(srcdir)/gunzip.c'; fi` - -diskless_exec-hercules.o: hercules.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-hercules.o -MD -MP -MF "$(DEPDIR)/diskless_exec-hercules.Tpo" -c -o diskless_exec-hercules.o `test -f 'hercules.c' || echo '$(srcdir)/'`hercules.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-hercules.Tpo" "$(DEPDIR)/diskless_exec-hercules.Po"; else rm -f "$(DEPDIR)/diskless_exec-hercules.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='hercules.c' object='diskless_exec-hercules.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/diskless_exec-hercules.Po' tmpdepfile='$(DEPDIR)/diskless_exec-hercules.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-hercules.o `test -f 'hercules.c' || echo '$(srcdir)/'`hercules.c - -diskless_exec-hercules.obj: hercules.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-hercules.obj -MD -MP -MF "$(DEPDIR)/diskless_exec-hercules.Tpo" -c -o diskless_exec-hercules.obj `if test -f 'hercules.c'; then $(CYGPATH_W) 'hercules.c'; else $(CYGPATH_W) '$(srcdir)/hercules.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-hercules.Tpo" "$(DEPDIR)/diskless_exec-hercules.Po"; else rm -f "$(DEPDIR)/diskless_exec-hercules.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='hercules.c' object='diskless_exec-hercules.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/diskless_exec-hercules.Po' tmpdepfile='$(DEPDIR)/diskless_exec-hercules.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-hercules.obj `if test -f 'hercules.c'; then $(CYGPATH_W) 'hercules.c'; else $(CYGPATH_W) '$(srcdir)/hercules.c'; fi` - -diskless_exec-md5.o: md5.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-md5.o -MD -MP -MF "$(DEPDIR)/diskless_exec-md5.Tpo" -c -o diskless_exec-md5.o `test -f 'md5.c' || echo '$(srcdir)/'`md5.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-md5.Tpo" "$(DEPDIR)/diskless_exec-md5.Po"; else rm -f "$(DEPDIR)/diskless_exec-md5.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='md5.c' object='diskless_exec-md5.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/diskless_exec-md5.Po' tmpdepfile='$(DEPDIR)/diskless_exec-md5.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-md5.o `test -f 'md5.c' || echo '$(srcdir)/'`md5.c - -diskless_exec-md5.obj: md5.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-md5.obj -MD -MP -MF "$(DEPDIR)/diskless_exec-md5.Tpo" -c -o diskless_exec-md5.obj `if test -f 'md5.c'; then $(CYGPATH_W) 'md5.c'; else $(CYGPATH_W) '$(srcdir)/md5.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-md5.Tpo" "$(DEPDIR)/diskless_exec-md5.Po"; else rm -f "$(DEPDIR)/diskless_exec-md5.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='md5.c' object='diskless_exec-md5.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/diskless_exec-md5.Po' tmpdepfile='$(DEPDIR)/diskless_exec-md5.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-md5.obj `if test -f 'md5.c'; then $(CYGPATH_W) 'md5.c'; else $(CYGPATH_W) '$(srcdir)/md5.c'; fi` - -diskless_exec-serial.o: serial.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-serial.o -MD -MP -MF "$(DEPDIR)/diskless_exec-serial.Tpo" -c -o diskless_exec-serial.o `test -f 'serial.c' || echo '$(srcdir)/'`serial.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-serial.Tpo" "$(DEPDIR)/diskless_exec-serial.Po"; else rm -f "$(DEPDIR)/diskless_exec-serial.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='serial.c' object='diskless_exec-serial.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/diskless_exec-serial.Po' tmpdepfile='$(DEPDIR)/diskless_exec-serial.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-serial.o `test -f 'serial.c' || echo '$(srcdir)/'`serial.c - -diskless_exec-serial.obj: serial.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-serial.obj -MD -MP -MF "$(DEPDIR)/diskless_exec-serial.Tpo" -c -o diskless_exec-serial.obj `if test -f 'serial.c'; then $(CYGPATH_W) 'serial.c'; else $(CYGPATH_W) '$(srcdir)/serial.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-serial.Tpo" "$(DEPDIR)/diskless_exec-serial.Po"; else rm -f "$(DEPDIR)/diskless_exec-serial.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='serial.c' object='diskless_exec-serial.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/diskless_exec-serial.Po' tmpdepfile='$(DEPDIR)/diskless_exec-serial.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-serial.obj `if test -f 'serial.c'; then $(CYGPATH_W) 'serial.c'; else $(CYGPATH_W) '$(srcdir)/serial.c'; fi` - -diskless_exec-smp-imps.o: smp-imps.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-smp-imps.o -MD -MP -MF "$(DEPDIR)/diskless_exec-smp-imps.Tpo" -c -o diskless_exec-smp-imps.o `test -f 'smp-imps.c' || echo '$(srcdir)/'`smp-imps.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-smp-imps.Tpo" "$(DEPDIR)/diskless_exec-smp-imps.Po"; else rm -f "$(DEPDIR)/diskless_exec-smp-imps.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='smp-imps.c' object='diskless_exec-smp-imps.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/diskless_exec-smp-imps.Po' tmpdepfile='$(DEPDIR)/diskless_exec-smp-imps.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-smp-imps.o `test -f 'smp-imps.c' || echo '$(srcdir)/'`smp-imps.c - -diskless_exec-smp-imps.obj: smp-imps.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-smp-imps.obj -MD -MP -MF "$(DEPDIR)/diskless_exec-smp-imps.Tpo" -c -o diskless_exec-smp-imps.obj `if test -f 'smp-imps.c'; then $(CYGPATH_W) 'smp-imps.c'; else $(CYGPATH_W) '$(srcdir)/smp-imps.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-smp-imps.Tpo" "$(DEPDIR)/diskless_exec-smp-imps.Po"; else rm -f "$(DEPDIR)/diskless_exec-smp-imps.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='smp-imps.c' object='diskless_exec-smp-imps.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/diskless_exec-smp-imps.Po' tmpdepfile='$(DEPDIR)/diskless_exec-smp-imps.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-smp-imps.obj `if test -f 'smp-imps.c'; then $(CYGPATH_W) 'smp-imps.c'; else $(CYGPATH_W) '$(srcdir)/smp-imps.c'; fi` - -diskless_exec-stage2.o: stage2.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-stage2.o -MD -MP -MF "$(DEPDIR)/diskless_exec-stage2.Tpo" -c -o diskless_exec-stage2.o `test -f 'stage2.c' || echo '$(srcdir)/'`stage2.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-stage2.Tpo" "$(DEPDIR)/diskless_exec-stage2.Po"; else rm -f "$(DEPDIR)/diskless_exec-stage2.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='stage2.c' object='diskless_exec-stage2.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/diskless_exec-stage2.Po' tmpdepfile='$(DEPDIR)/diskless_exec-stage2.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-stage2.o `test -f 'stage2.c' || echo '$(srcdir)/'`stage2.c - -diskless_exec-stage2.obj: stage2.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-stage2.obj -MD -MP -MF "$(DEPDIR)/diskless_exec-stage2.Tpo" -c -o diskless_exec-stage2.obj `if test -f 'stage2.c'; then $(CYGPATH_W) 'stage2.c'; else $(CYGPATH_W) '$(srcdir)/stage2.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-stage2.Tpo" "$(DEPDIR)/diskless_exec-stage2.Po"; else rm -f "$(DEPDIR)/diskless_exec-stage2.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='stage2.c' object='diskless_exec-stage2.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/diskless_exec-stage2.Po' tmpdepfile='$(DEPDIR)/diskless_exec-stage2.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-stage2.obj `if test -f 'stage2.c'; then $(CYGPATH_W) 'stage2.c'; else $(CYGPATH_W) '$(srcdir)/stage2.c'; fi` - -diskless_exec-terminfo.o: terminfo.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-terminfo.o -MD -MP -MF "$(DEPDIR)/diskless_exec-terminfo.Tpo" -c -o diskless_exec-terminfo.o `test -f 'terminfo.c' || echo '$(srcdir)/'`terminfo.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-terminfo.Tpo" "$(DEPDIR)/diskless_exec-terminfo.Po"; else rm -f "$(DEPDIR)/diskless_exec-terminfo.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='terminfo.c' object='diskless_exec-terminfo.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/diskless_exec-terminfo.Po' tmpdepfile='$(DEPDIR)/diskless_exec-terminfo.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-terminfo.o `test -f 'terminfo.c' || echo '$(srcdir)/'`terminfo.c - -diskless_exec-terminfo.obj: terminfo.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-terminfo.obj -MD -MP -MF "$(DEPDIR)/diskless_exec-terminfo.Tpo" -c -o diskless_exec-terminfo.obj `if test -f 'terminfo.c'; then $(CYGPATH_W) 'terminfo.c'; else $(CYGPATH_W) '$(srcdir)/terminfo.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-terminfo.Tpo" "$(DEPDIR)/diskless_exec-terminfo.Po"; else rm -f "$(DEPDIR)/diskless_exec-terminfo.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='terminfo.c' object='diskless_exec-terminfo.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/diskless_exec-terminfo.Po' tmpdepfile='$(DEPDIR)/diskless_exec-terminfo.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-terminfo.obj `if test -f 'terminfo.c'; then $(CYGPATH_W) 'terminfo.c'; else $(CYGPATH_W) '$(srcdir)/terminfo.c'; fi` - -diskless_exec-tparm.o: tparm.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-tparm.o -MD -MP -MF "$(DEPDIR)/diskless_exec-tparm.Tpo" -c -o diskless_exec-tparm.o `test -f 'tparm.c' || echo '$(srcdir)/'`tparm.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-tparm.Tpo" "$(DEPDIR)/diskless_exec-tparm.Po"; else rm -f "$(DEPDIR)/diskless_exec-tparm.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tparm.c' object='diskless_exec-tparm.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/diskless_exec-tparm.Po' tmpdepfile='$(DEPDIR)/diskless_exec-tparm.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-tparm.o `test -f 'tparm.c' || echo '$(srcdir)/'`tparm.c - -diskless_exec-tparm.obj: tparm.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-tparm.obj -MD -MP -MF "$(DEPDIR)/diskless_exec-tparm.Tpo" -c -o diskless_exec-tparm.obj `if test -f 'tparm.c'; then $(CYGPATH_W) 'tparm.c'; else $(CYGPATH_W) '$(srcdir)/tparm.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-tparm.Tpo" "$(DEPDIR)/diskless_exec-tparm.Po"; else rm -f "$(DEPDIR)/diskless_exec-tparm.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tparm.c' object='diskless_exec-tparm.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/diskless_exec-tparm.Po' tmpdepfile='$(DEPDIR)/diskless_exec-tparm.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-tparm.obj `if test -f 'tparm.c'; then $(CYGPATH_W) 'tparm.c'; else $(CYGPATH_W) '$(srcdir)/tparm.c'; fi` - -diskless_exec-graphics.o: graphics.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-graphics.o -MD -MP -MF "$(DEPDIR)/diskless_exec-graphics.Tpo" -c -o diskless_exec-graphics.o `test -f 'graphics.c' || echo '$(srcdir)/'`graphics.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-graphics.Tpo" "$(DEPDIR)/diskless_exec-graphics.Po"; else rm -f "$(DEPDIR)/diskless_exec-graphics.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='graphics.c' object='diskless_exec-graphics.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/diskless_exec-graphics.Po' tmpdepfile='$(DEPDIR)/diskless_exec-graphics.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-graphics.o `test -f 'graphics.c' || echo '$(srcdir)/'`graphics.c - -diskless_exec-graphics.obj: graphics.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-graphics.obj -MD -MP -MF "$(DEPDIR)/diskless_exec-graphics.Tpo" -c -o diskless_exec-graphics.obj `if test -f 'graphics.c'; then $(CYGPATH_W) 'graphics.c'; else $(CYGPATH_W) '$(srcdir)/graphics.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-graphics.Tpo" "$(DEPDIR)/diskless_exec-graphics.Po"; else rm -f "$(DEPDIR)/diskless_exec-graphics.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='graphics.c' object='diskless_exec-graphics.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/diskless_exec-graphics.Po' tmpdepfile='$(DEPDIR)/diskless_exec-graphics.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-graphics.obj `if test -f 'graphics.c'; then $(CYGPATH_W) 'graphics.c'; else $(CYGPATH_W) '$(srcdir)/graphics.c'; fi` - -e2fs_stage1_5_exec-common.o: common.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(e2fs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT e2fs_stage1_5_exec-common.o -MD -MP -MF "$(DEPDIR)/e2fs_stage1_5_exec-common.Tpo" -c -o e2fs_stage1_5_exec-common.o `test -f 'common.c' || echo '$(srcdir)/'`common.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/e2fs_stage1_5_exec-common.Tpo" "$(DEPDIR)/e2fs_stage1_5_exec-common.Po"; else rm -f "$(DEPDIR)/e2fs_stage1_5_exec-common.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='common.c' object='e2fs_stage1_5_exec-common.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/e2fs_stage1_5_exec-common.Po' tmpdepfile='$(DEPDIR)/e2fs_stage1_5_exec-common.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(e2fs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o e2fs_stage1_5_exec-common.o `test -f 'common.c' || echo '$(srcdir)/'`common.c - -e2fs_stage1_5_exec-common.obj: common.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(e2fs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT e2fs_stage1_5_exec-common.obj -MD -MP -MF "$(DEPDIR)/e2fs_stage1_5_exec-common.Tpo" -c -o e2fs_stage1_5_exec-common.obj `if test -f 'common.c'; then $(CYGPATH_W) 'common.c'; else $(CYGPATH_W) '$(srcdir)/common.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/e2fs_stage1_5_exec-common.Tpo" "$(DEPDIR)/e2fs_stage1_5_exec-common.Po"; else rm -f "$(DEPDIR)/e2fs_stage1_5_exec-common.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='common.c' object='e2fs_stage1_5_exec-common.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/e2fs_stage1_5_exec-common.Po' tmpdepfile='$(DEPDIR)/e2fs_stage1_5_exec-common.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(e2fs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o e2fs_stage1_5_exec-common.obj `if test -f 'common.c'; then $(CYGPATH_W) 'common.c'; else $(CYGPATH_W) '$(srcdir)/common.c'; fi` - -e2fs_stage1_5_exec-char_io.o: char_io.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(e2fs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT e2fs_stage1_5_exec-char_io.o -MD -MP -MF "$(DEPDIR)/e2fs_stage1_5_exec-char_io.Tpo" -c -o e2fs_stage1_5_exec-char_io.o `test -f 'char_io.c' || echo '$(srcdir)/'`char_io.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/e2fs_stage1_5_exec-char_io.Tpo" "$(DEPDIR)/e2fs_stage1_5_exec-char_io.Po"; else rm -f "$(DEPDIR)/e2fs_stage1_5_exec-char_io.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='char_io.c' object='e2fs_stage1_5_exec-char_io.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/e2fs_stage1_5_exec-char_io.Po' tmpdepfile='$(DEPDIR)/e2fs_stage1_5_exec-char_io.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(e2fs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o e2fs_stage1_5_exec-char_io.o `test -f 'char_io.c' || echo '$(srcdir)/'`char_io.c - -e2fs_stage1_5_exec-char_io.obj: char_io.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(e2fs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT e2fs_stage1_5_exec-char_io.obj -MD -MP -MF "$(DEPDIR)/e2fs_stage1_5_exec-char_io.Tpo" -c -o e2fs_stage1_5_exec-char_io.obj `if test -f 'char_io.c'; then $(CYGPATH_W) 'char_io.c'; else $(CYGPATH_W) '$(srcdir)/char_io.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/e2fs_stage1_5_exec-char_io.Tpo" "$(DEPDIR)/e2fs_stage1_5_exec-char_io.Po"; else rm -f "$(DEPDIR)/e2fs_stage1_5_exec-char_io.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='char_io.c' object='e2fs_stage1_5_exec-char_io.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/e2fs_stage1_5_exec-char_io.Po' tmpdepfile='$(DEPDIR)/e2fs_stage1_5_exec-char_io.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(e2fs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o e2fs_stage1_5_exec-char_io.obj `if test -f 'char_io.c'; then $(CYGPATH_W) 'char_io.c'; else $(CYGPATH_W) '$(srcdir)/char_io.c'; fi` - -e2fs_stage1_5_exec-disk_io.o: disk_io.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(e2fs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT e2fs_stage1_5_exec-disk_io.o -MD -MP -MF "$(DEPDIR)/e2fs_stage1_5_exec-disk_io.Tpo" -c -o e2fs_stage1_5_exec-disk_io.o `test -f 'disk_io.c' || echo '$(srcdir)/'`disk_io.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/e2fs_stage1_5_exec-disk_io.Tpo" "$(DEPDIR)/e2fs_stage1_5_exec-disk_io.Po"; else rm -f "$(DEPDIR)/e2fs_stage1_5_exec-disk_io.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='disk_io.c' object='e2fs_stage1_5_exec-disk_io.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/e2fs_stage1_5_exec-disk_io.Po' tmpdepfile='$(DEPDIR)/e2fs_stage1_5_exec-disk_io.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(e2fs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o e2fs_stage1_5_exec-disk_io.o `test -f 'disk_io.c' || echo '$(srcdir)/'`disk_io.c - -e2fs_stage1_5_exec-disk_io.obj: disk_io.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(e2fs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT e2fs_stage1_5_exec-disk_io.obj -MD -MP -MF "$(DEPDIR)/e2fs_stage1_5_exec-disk_io.Tpo" -c -o e2fs_stage1_5_exec-disk_io.obj `if test -f 'disk_io.c'; then $(CYGPATH_W) 'disk_io.c'; else $(CYGPATH_W) '$(srcdir)/disk_io.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/e2fs_stage1_5_exec-disk_io.Tpo" "$(DEPDIR)/e2fs_stage1_5_exec-disk_io.Po"; else rm -f "$(DEPDIR)/e2fs_stage1_5_exec-disk_io.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='disk_io.c' object='e2fs_stage1_5_exec-disk_io.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/e2fs_stage1_5_exec-disk_io.Po' tmpdepfile='$(DEPDIR)/e2fs_stage1_5_exec-disk_io.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(e2fs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o e2fs_stage1_5_exec-disk_io.obj `if test -f 'disk_io.c'; then $(CYGPATH_W) 'disk_io.c'; else $(CYGPATH_W) '$(srcdir)/disk_io.c'; fi` - -e2fs_stage1_5_exec-stage1_5.o: stage1_5.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(e2fs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT e2fs_stage1_5_exec-stage1_5.o -MD -MP -MF "$(DEPDIR)/e2fs_stage1_5_exec-stage1_5.Tpo" -c -o e2fs_stage1_5_exec-stage1_5.o `test -f 'stage1_5.c' || echo '$(srcdir)/'`stage1_5.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/e2fs_stage1_5_exec-stage1_5.Tpo" "$(DEPDIR)/e2fs_stage1_5_exec-stage1_5.Po"; else rm -f "$(DEPDIR)/e2fs_stage1_5_exec-stage1_5.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='stage1_5.c' object='e2fs_stage1_5_exec-stage1_5.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/e2fs_stage1_5_exec-stage1_5.Po' tmpdepfile='$(DEPDIR)/e2fs_stage1_5_exec-stage1_5.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(e2fs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o e2fs_stage1_5_exec-stage1_5.o `test -f 'stage1_5.c' || echo '$(srcdir)/'`stage1_5.c - -e2fs_stage1_5_exec-stage1_5.obj: stage1_5.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(e2fs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT e2fs_stage1_5_exec-stage1_5.obj -MD -MP -MF "$(DEPDIR)/e2fs_stage1_5_exec-stage1_5.Tpo" -c -o e2fs_stage1_5_exec-stage1_5.obj `if test -f 'stage1_5.c'; then $(CYGPATH_W) 'stage1_5.c'; else $(CYGPATH_W) '$(srcdir)/stage1_5.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/e2fs_stage1_5_exec-stage1_5.Tpo" "$(DEPDIR)/e2fs_stage1_5_exec-stage1_5.Po"; else rm -f "$(DEPDIR)/e2fs_stage1_5_exec-stage1_5.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='stage1_5.c' object='e2fs_stage1_5_exec-stage1_5.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/e2fs_stage1_5_exec-stage1_5.Po' tmpdepfile='$(DEPDIR)/e2fs_stage1_5_exec-stage1_5.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(e2fs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o e2fs_stage1_5_exec-stage1_5.obj `if test -f 'stage1_5.c'; then $(CYGPATH_W) 'stage1_5.c'; else $(CYGPATH_W) '$(srcdir)/stage1_5.c'; fi` - -e2fs_stage1_5_exec-fsys_ext2fs.o: fsys_ext2fs.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(e2fs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT e2fs_stage1_5_exec-fsys_ext2fs.o -MD -MP -MF "$(DEPDIR)/e2fs_stage1_5_exec-fsys_ext2fs.Tpo" -c -o e2fs_stage1_5_exec-fsys_ext2fs.o `test -f 'fsys_ext2fs.c' || echo '$(srcdir)/'`fsys_ext2fs.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/e2fs_stage1_5_exec-fsys_ext2fs.Tpo" "$(DEPDIR)/e2fs_stage1_5_exec-fsys_ext2fs.Po"; else rm -f "$(DEPDIR)/e2fs_stage1_5_exec-fsys_ext2fs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_ext2fs.c' object='e2fs_stage1_5_exec-fsys_ext2fs.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/e2fs_stage1_5_exec-fsys_ext2fs.Po' tmpdepfile='$(DEPDIR)/e2fs_stage1_5_exec-fsys_ext2fs.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(e2fs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o e2fs_stage1_5_exec-fsys_ext2fs.o `test -f 'fsys_ext2fs.c' || echo '$(srcdir)/'`fsys_ext2fs.c - -e2fs_stage1_5_exec-fsys_ext2fs.obj: fsys_ext2fs.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(e2fs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT e2fs_stage1_5_exec-fsys_ext2fs.obj -MD -MP -MF "$(DEPDIR)/e2fs_stage1_5_exec-fsys_ext2fs.Tpo" -c -o e2fs_stage1_5_exec-fsys_ext2fs.obj `if test -f 'fsys_ext2fs.c'; then $(CYGPATH_W) 'fsys_ext2fs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_ext2fs.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/e2fs_stage1_5_exec-fsys_ext2fs.Tpo" "$(DEPDIR)/e2fs_stage1_5_exec-fsys_ext2fs.Po"; else rm -f "$(DEPDIR)/e2fs_stage1_5_exec-fsys_ext2fs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_ext2fs.c' object='e2fs_stage1_5_exec-fsys_ext2fs.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/e2fs_stage1_5_exec-fsys_ext2fs.Po' tmpdepfile='$(DEPDIR)/e2fs_stage1_5_exec-fsys_ext2fs.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(e2fs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o e2fs_stage1_5_exec-fsys_ext2fs.obj `if test -f 'fsys_ext2fs.c'; then $(CYGPATH_W) 'fsys_ext2fs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_ext2fs.c'; fi` - -e2fs_stage1_5_exec-bios.o: bios.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(e2fs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT e2fs_stage1_5_exec-bios.o -MD -MP -MF "$(DEPDIR)/e2fs_stage1_5_exec-bios.Tpo" -c -o e2fs_stage1_5_exec-bios.o `test -f 'bios.c' || echo '$(srcdir)/'`bios.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/e2fs_stage1_5_exec-bios.Tpo" "$(DEPDIR)/e2fs_stage1_5_exec-bios.Po"; else rm -f "$(DEPDIR)/e2fs_stage1_5_exec-bios.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bios.c' object='e2fs_stage1_5_exec-bios.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/e2fs_stage1_5_exec-bios.Po' tmpdepfile='$(DEPDIR)/e2fs_stage1_5_exec-bios.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(e2fs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o e2fs_stage1_5_exec-bios.o `test -f 'bios.c' || echo '$(srcdir)/'`bios.c - -e2fs_stage1_5_exec-bios.obj: bios.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(e2fs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT e2fs_stage1_5_exec-bios.obj -MD -MP -MF "$(DEPDIR)/e2fs_stage1_5_exec-bios.Tpo" -c -o e2fs_stage1_5_exec-bios.obj `if test -f 'bios.c'; then $(CYGPATH_W) 'bios.c'; else $(CYGPATH_W) '$(srcdir)/bios.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/e2fs_stage1_5_exec-bios.Tpo" "$(DEPDIR)/e2fs_stage1_5_exec-bios.Po"; else rm -f "$(DEPDIR)/e2fs_stage1_5_exec-bios.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bios.c' object='e2fs_stage1_5_exec-bios.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/e2fs_stage1_5_exec-bios.Po' tmpdepfile='$(DEPDIR)/e2fs_stage1_5_exec-bios.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(e2fs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o e2fs_stage1_5_exec-bios.obj `if test -f 'bios.c'; then $(CYGPATH_W) 'bios.c'; else $(CYGPATH_W) '$(srcdir)/bios.c'; fi` - -fat_stage1_5_exec-common.o: common.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fat_stage1_5_exec_CFLAGS) $(CFLAGS) -MT fat_stage1_5_exec-common.o -MD -MP -MF "$(DEPDIR)/fat_stage1_5_exec-common.Tpo" -c -o fat_stage1_5_exec-common.o `test -f 'common.c' || echo '$(srcdir)/'`common.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/fat_stage1_5_exec-common.Tpo" "$(DEPDIR)/fat_stage1_5_exec-common.Po"; else rm -f "$(DEPDIR)/fat_stage1_5_exec-common.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='common.c' object='fat_stage1_5_exec-common.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/fat_stage1_5_exec-common.Po' tmpdepfile='$(DEPDIR)/fat_stage1_5_exec-common.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fat_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o fat_stage1_5_exec-common.o `test -f 'common.c' || echo '$(srcdir)/'`common.c - -fat_stage1_5_exec-common.obj: common.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fat_stage1_5_exec_CFLAGS) $(CFLAGS) -MT fat_stage1_5_exec-common.obj -MD -MP -MF "$(DEPDIR)/fat_stage1_5_exec-common.Tpo" -c -o fat_stage1_5_exec-common.obj `if test -f 'common.c'; then $(CYGPATH_W) 'common.c'; else $(CYGPATH_W) '$(srcdir)/common.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/fat_stage1_5_exec-common.Tpo" "$(DEPDIR)/fat_stage1_5_exec-common.Po"; else rm -f "$(DEPDIR)/fat_stage1_5_exec-common.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='common.c' object='fat_stage1_5_exec-common.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/fat_stage1_5_exec-common.Po' tmpdepfile='$(DEPDIR)/fat_stage1_5_exec-common.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fat_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o fat_stage1_5_exec-common.obj `if test -f 'common.c'; then $(CYGPATH_W) 'common.c'; else $(CYGPATH_W) '$(srcdir)/common.c'; fi` - -fat_stage1_5_exec-char_io.o: char_io.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fat_stage1_5_exec_CFLAGS) $(CFLAGS) -MT fat_stage1_5_exec-char_io.o -MD -MP -MF "$(DEPDIR)/fat_stage1_5_exec-char_io.Tpo" -c -o fat_stage1_5_exec-char_io.o `test -f 'char_io.c' || echo '$(srcdir)/'`char_io.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/fat_stage1_5_exec-char_io.Tpo" "$(DEPDIR)/fat_stage1_5_exec-char_io.Po"; else rm -f "$(DEPDIR)/fat_stage1_5_exec-char_io.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='char_io.c' object='fat_stage1_5_exec-char_io.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/fat_stage1_5_exec-char_io.Po' tmpdepfile='$(DEPDIR)/fat_stage1_5_exec-char_io.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fat_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o fat_stage1_5_exec-char_io.o `test -f 'char_io.c' || echo '$(srcdir)/'`char_io.c - -fat_stage1_5_exec-char_io.obj: char_io.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fat_stage1_5_exec_CFLAGS) $(CFLAGS) -MT fat_stage1_5_exec-char_io.obj -MD -MP -MF "$(DEPDIR)/fat_stage1_5_exec-char_io.Tpo" -c -o fat_stage1_5_exec-char_io.obj `if test -f 'char_io.c'; then $(CYGPATH_W) 'char_io.c'; else $(CYGPATH_W) '$(srcdir)/char_io.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/fat_stage1_5_exec-char_io.Tpo" "$(DEPDIR)/fat_stage1_5_exec-char_io.Po"; else rm -f "$(DEPDIR)/fat_stage1_5_exec-char_io.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='char_io.c' object='fat_stage1_5_exec-char_io.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/fat_stage1_5_exec-char_io.Po' tmpdepfile='$(DEPDIR)/fat_stage1_5_exec-char_io.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fat_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o fat_stage1_5_exec-char_io.obj `if test -f 'char_io.c'; then $(CYGPATH_W) 'char_io.c'; else $(CYGPATH_W) '$(srcdir)/char_io.c'; fi` - -fat_stage1_5_exec-disk_io.o: disk_io.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fat_stage1_5_exec_CFLAGS) $(CFLAGS) -MT fat_stage1_5_exec-disk_io.o -MD -MP -MF "$(DEPDIR)/fat_stage1_5_exec-disk_io.Tpo" -c -o fat_stage1_5_exec-disk_io.o `test -f 'disk_io.c' || echo '$(srcdir)/'`disk_io.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/fat_stage1_5_exec-disk_io.Tpo" "$(DEPDIR)/fat_stage1_5_exec-disk_io.Po"; else rm -f "$(DEPDIR)/fat_stage1_5_exec-disk_io.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='disk_io.c' object='fat_stage1_5_exec-disk_io.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/fat_stage1_5_exec-disk_io.Po' tmpdepfile='$(DEPDIR)/fat_stage1_5_exec-disk_io.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fat_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o fat_stage1_5_exec-disk_io.o `test -f 'disk_io.c' || echo '$(srcdir)/'`disk_io.c - -fat_stage1_5_exec-disk_io.obj: disk_io.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fat_stage1_5_exec_CFLAGS) $(CFLAGS) -MT fat_stage1_5_exec-disk_io.obj -MD -MP -MF "$(DEPDIR)/fat_stage1_5_exec-disk_io.Tpo" -c -o fat_stage1_5_exec-disk_io.obj `if test -f 'disk_io.c'; then $(CYGPATH_W) 'disk_io.c'; else $(CYGPATH_W) '$(srcdir)/disk_io.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/fat_stage1_5_exec-disk_io.Tpo" "$(DEPDIR)/fat_stage1_5_exec-disk_io.Po"; else rm -f "$(DEPDIR)/fat_stage1_5_exec-disk_io.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='disk_io.c' object='fat_stage1_5_exec-disk_io.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/fat_stage1_5_exec-disk_io.Po' tmpdepfile='$(DEPDIR)/fat_stage1_5_exec-disk_io.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fat_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o fat_stage1_5_exec-disk_io.obj `if test -f 'disk_io.c'; then $(CYGPATH_W) 'disk_io.c'; else $(CYGPATH_W) '$(srcdir)/disk_io.c'; fi` - -fat_stage1_5_exec-stage1_5.o: stage1_5.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fat_stage1_5_exec_CFLAGS) $(CFLAGS) -MT fat_stage1_5_exec-stage1_5.o -MD -MP -MF "$(DEPDIR)/fat_stage1_5_exec-stage1_5.Tpo" -c -o fat_stage1_5_exec-stage1_5.o `test -f 'stage1_5.c' || echo '$(srcdir)/'`stage1_5.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/fat_stage1_5_exec-stage1_5.Tpo" "$(DEPDIR)/fat_stage1_5_exec-stage1_5.Po"; else rm -f "$(DEPDIR)/fat_stage1_5_exec-stage1_5.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='stage1_5.c' object='fat_stage1_5_exec-stage1_5.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/fat_stage1_5_exec-stage1_5.Po' tmpdepfile='$(DEPDIR)/fat_stage1_5_exec-stage1_5.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fat_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o fat_stage1_5_exec-stage1_5.o `test -f 'stage1_5.c' || echo '$(srcdir)/'`stage1_5.c - -fat_stage1_5_exec-stage1_5.obj: stage1_5.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fat_stage1_5_exec_CFLAGS) $(CFLAGS) -MT fat_stage1_5_exec-stage1_5.obj -MD -MP -MF "$(DEPDIR)/fat_stage1_5_exec-stage1_5.Tpo" -c -o fat_stage1_5_exec-stage1_5.obj `if test -f 'stage1_5.c'; then $(CYGPATH_W) 'stage1_5.c'; else $(CYGPATH_W) '$(srcdir)/stage1_5.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/fat_stage1_5_exec-stage1_5.Tpo" "$(DEPDIR)/fat_stage1_5_exec-stage1_5.Po"; else rm -f "$(DEPDIR)/fat_stage1_5_exec-stage1_5.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='stage1_5.c' object='fat_stage1_5_exec-stage1_5.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/fat_stage1_5_exec-stage1_5.Po' tmpdepfile='$(DEPDIR)/fat_stage1_5_exec-stage1_5.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fat_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o fat_stage1_5_exec-stage1_5.obj `if test -f 'stage1_5.c'; then $(CYGPATH_W) 'stage1_5.c'; else $(CYGPATH_W) '$(srcdir)/stage1_5.c'; fi` - -fat_stage1_5_exec-fsys_fat.o: fsys_fat.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fat_stage1_5_exec_CFLAGS) $(CFLAGS) -MT fat_stage1_5_exec-fsys_fat.o -MD -MP -MF "$(DEPDIR)/fat_stage1_5_exec-fsys_fat.Tpo" -c -o fat_stage1_5_exec-fsys_fat.o `test -f 'fsys_fat.c' || echo '$(srcdir)/'`fsys_fat.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/fat_stage1_5_exec-fsys_fat.Tpo" "$(DEPDIR)/fat_stage1_5_exec-fsys_fat.Po"; else rm -f "$(DEPDIR)/fat_stage1_5_exec-fsys_fat.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_fat.c' object='fat_stage1_5_exec-fsys_fat.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/fat_stage1_5_exec-fsys_fat.Po' tmpdepfile='$(DEPDIR)/fat_stage1_5_exec-fsys_fat.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fat_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o fat_stage1_5_exec-fsys_fat.o `test -f 'fsys_fat.c' || echo '$(srcdir)/'`fsys_fat.c - -fat_stage1_5_exec-fsys_fat.obj: fsys_fat.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fat_stage1_5_exec_CFLAGS) $(CFLAGS) -MT fat_stage1_5_exec-fsys_fat.obj -MD -MP -MF "$(DEPDIR)/fat_stage1_5_exec-fsys_fat.Tpo" -c -o fat_stage1_5_exec-fsys_fat.obj `if test -f 'fsys_fat.c'; then $(CYGPATH_W) 'fsys_fat.c'; else $(CYGPATH_W) '$(srcdir)/fsys_fat.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/fat_stage1_5_exec-fsys_fat.Tpo" "$(DEPDIR)/fat_stage1_5_exec-fsys_fat.Po"; else rm -f "$(DEPDIR)/fat_stage1_5_exec-fsys_fat.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_fat.c' object='fat_stage1_5_exec-fsys_fat.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/fat_stage1_5_exec-fsys_fat.Po' tmpdepfile='$(DEPDIR)/fat_stage1_5_exec-fsys_fat.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fat_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o fat_stage1_5_exec-fsys_fat.obj `if test -f 'fsys_fat.c'; then $(CYGPATH_W) 'fsys_fat.c'; else $(CYGPATH_W) '$(srcdir)/fsys_fat.c'; fi` - -fat_stage1_5_exec-bios.o: bios.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fat_stage1_5_exec_CFLAGS) $(CFLAGS) -MT fat_stage1_5_exec-bios.o -MD -MP -MF "$(DEPDIR)/fat_stage1_5_exec-bios.Tpo" -c -o fat_stage1_5_exec-bios.o `test -f 'bios.c' || echo '$(srcdir)/'`bios.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/fat_stage1_5_exec-bios.Tpo" "$(DEPDIR)/fat_stage1_5_exec-bios.Po"; else rm -f "$(DEPDIR)/fat_stage1_5_exec-bios.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bios.c' object='fat_stage1_5_exec-bios.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/fat_stage1_5_exec-bios.Po' tmpdepfile='$(DEPDIR)/fat_stage1_5_exec-bios.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fat_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o fat_stage1_5_exec-bios.o `test -f 'bios.c' || echo '$(srcdir)/'`bios.c - -fat_stage1_5_exec-bios.obj: bios.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fat_stage1_5_exec_CFLAGS) $(CFLAGS) -MT fat_stage1_5_exec-bios.obj -MD -MP -MF "$(DEPDIR)/fat_stage1_5_exec-bios.Tpo" -c -o fat_stage1_5_exec-bios.obj `if test -f 'bios.c'; then $(CYGPATH_W) 'bios.c'; else $(CYGPATH_W) '$(srcdir)/bios.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/fat_stage1_5_exec-bios.Tpo" "$(DEPDIR)/fat_stage1_5_exec-bios.Po"; else rm -f "$(DEPDIR)/fat_stage1_5_exec-bios.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bios.c' object='fat_stage1_5_exec-bios.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/fat_stage1_5_exec-bios.Po' tmpdepfile='$(DEPDIR)/fat_stage1_5_exec-bios.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fat_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o fat_stage1_5_exec-bios.obj `if test -f 'bios.c'; then $(CYGPATH_W) 'bios.c'; else $(CYGPATH_W) '$(srcdir)/bios.c'; fi` - -ffs_stage1_5_exec-common.o: common.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ffs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT ffs_stage1_5_exec-common.o -MD -MP -MF "$(DEPDIR)/ffs_stage1_5_exec-common.Tpo" -c -o ffs_stage1_5_exec-common.o `test -f 'common.c' || echo '$(srcdir)/'`common.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ffs_stage1_5_exec-common.Tpo" "$(DEPDIR)/ffs_stage1_5_exec-common.Po"; else rm -f "$(DEPDIR)/ffs_stage1_5_exec-common.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='common.c' object='ffs_stage1_5_exec-common.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/ffs_stage1_5_exec-common.Po' tmpdepfile='$(DEPDIR)/ffs_stage1_5_exec-common.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ffs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ffs_stage1_5_exec-common.o `test -f 'common.c' || echo '$(srcdir)/'`common.c - -ffs_stage1_5_exec-common.obj: common.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ffs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT ffs_stage1_5_exec-common.obj -MD -MP -MF "$(DEPDIR)/ffs_stage1_5_exec-common.Tpo" -c -o ffs_stage1_5_exec-common.obj `if test -f 'common.c'; then $(CYGPATH_W) 'common.c'; else $(CYGPATH_W) '$(srcdir)/common.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ffs_stage1_5_exec-common.Tpo" "$(DEPDIR)/ffs_stage1_5_exec-common.Po"; else rm -f "$(DEPDIR)/ffs_stage1_5_exec-common.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='common.c' object='ffs_stage1_5_exec-common.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/ffs_stage1_5_exec-common.Po' tmpdepfile='$(DEPDIR)/ffs_stage1_5_exec-common.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ffs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ffs_stage1_5_exec-common.obj `if test -f 'common.c'; then $(CYGPATH_W) 'common.c'; else $(CYGPATH_W) '$(srcdir)/common.c'; fi` - -ffs_stage1_5_exec-char_io.o: char_io.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ffs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT ffs_stage1_5_exec-char_io.o -MD -MP -MF "$(DEPDIR)/ffs_stage1_5_exec-char_io.Tpo" -c -o ffs_stage1_5_exec-char_io.o `test -f 'char_io.c' || echo '$(srcdir)/'`char_io.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ffs_stage1_5_exec-char_io.Tpo" "$(DEPDIR)/ffs_stage1_5_exec-char_io.Po"; else rm -f "$(DEPDIR)/ffs_stage1_5_exec-char_io.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='char_io.c' object='ffs_stage1_5_exec-char_io.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/ffs_stage1_5_exec-char_io.Po' tmpdepfile='$(DEPDIR)/ffs_stage1_5_exec-char_io.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ffs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ffs_stage1_5_exec-char_io.o `test -f 'char_io.c' || echo '$(srcdir)/'`char_io.c - -ffs_stage1_5_exec-char_io.obj: char_io.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ffs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT ffs_stage1_5_exec-char_io.obj -MD -MP -MF "$(DEPDIR)/ffs_stage1_5_exec-char_io.Tpo" -c -o ffs_stage1_5_exec-char_io.obj `if test -f 'char_io.c'; then $(CYGPATH_W) 'char_io.c'; else $(CYGPATH_W) '$(srcdir)/char_io.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ffs_stage1_5_exec-char_io.Tpo" "$(DEPDIR)/ffs_stage1_5_exec-char_io.Po"; else rm -f "$(DEPDIR)/ffs_stage1_5_exec-char_io.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='char_io.c' object='ffs_stage1_5_exec-char_io.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/ffs_stage1_5_exec-char_io.Po' tmpdepfile='$(DEPDIR)/ffs_stage1_5_exec-char_io.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ffs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ffs_stage1_5_exec-char_io.obj `if test -f 'char_io.c'; then $(CYGPATH_W) 'char_io.c'; else $(CYGPATH_W) '$(srcdir)/char_io.c'; fi` - -ffs_stage1_5_exec-disk_io.o: disk_io.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ffs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT ffs_stage1_5_exec-disk_io.o -MD -MP -MF "$(DEPDIR)/ffs_stage1_5_exec-disk_io.Tpo" -c -o ffs_stage1_5_exec-disk_io.o `test -f 'disk_io.c' || echo '$(srcdir)/'`disk_io.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ffs_stage1_5_exec-disk_io.Tpo" "$(DEPDIR)/ffs_stage1_5_exec-disk_io.Po"; else rm -f "$(DEPDIR)/ffs_stage1_5_exec-disk_io.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='disk_io.c' object='ffs_stage1_5_exec-disk_io.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/ffs_stage1_5_exec-disk_io.Po' tmpdepfile='$(DEPDIR)/ffs_stage1_5_exec-disk_io.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ffs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ffs_stage1_5_exec-disk_io.o `test -f 'disk_io.c' || echo '$(srcdir)/'`disk_io.c - -ffs_stage1_5_exec-disk_io.obj: disk_io.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ffs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT ffs_stage1_5_exec-disk_io.obj -MD -MP -MF "$(DEPDIR)/ffs_stage1_5_exec-disk_io.Tpo" -c -o ffs_stage1_5_exec-disk_io.obj `if test -f 'disk_io.c'; then $(CYGPATH_W) 'disk_io.c'; else $(CYGPATH_W) '$(srcdir)/disk_io.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ffs_stage1_5_exec-disk_io.Tpo" "$(DEPDIR)/ffs_stage1_5_exec-disk_io.Po"; else rm -f "$(DEPDIR)/ffs_stage1_5_exec-disk_io.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='disk_io.c' object='ffs_stage1_5_exec-disk_io.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/ffs_stage1_5_exec-disk_io.Po' tmpdepfile='$(DEPDIR)/ffs_stage1_5_exec-disk_io.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ffs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ffs_stage1_5_exec-disk_io.obj `if test -f 'disk_io.c'; then $(CYGPATH_W) 'disk_io.c'; else $(CYGPATH_W) '$(srcdir)/disk_io.c'; fi` - -ffs_stage1_5_exec-stage1_5.o: stage1_5.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ffs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT ffs_stage1_5_exec-stage1_5.o -MD -MP -MF "$(DEPDIR)/ffs_stage1_5_exec-stage1_5.Tpo" -c -o ffs_stage1_5_exec-stage1_5.o `test -f 'stage1_5.c' || echo '$(srcdir)/'`stage1_5.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ffs_stage1_5_exec-stage1_5.Tpo" "$(DEPDIR)/ffs_stage1_5_exec-stage1_5.Po"; else rm -f "$(DEPDIR)/ffs_stage1_5_exec-stage1_5.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='stage1_5.c' object='ffs_stage1_5_exec-stage1_5.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/ffs_stage1_5_exec-stage1_5.Po' tmpdepfile='$(DEPDIR)/ffs_stage1_5_exec-stage1_5.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ffs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ffs_stage1_5_exec-stage1_5.o `test -f 'stage1_5.c' || echo '$(srcdir)/'`stage1_5.c - -ffs_stage1_5_exec-stage1_5.obj: stage1_5.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ffs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT ffs_stage1_5_exec-stage1_5.obj -MD -MP -MF "$(DEPDIR)/ffs_stage1_5_exec-stage1_5.Tpo" -c -o ffs_stage1_5_exec-stage1_5.obj `if test -f 'stage1_5.c'; then $(CYGPATH_W) 'stage1_5.c'; else $(CYGPATH_W) '$(srcdir)/stage1_5.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ffs_stage1_5_exec-stage1_5.Tpo" "$(DEPDIR)/ffs_stage1_5_exec-stage1_5.Po"; else rm -f "$(DEPDIR)/ffs_stage1_5_exec-stage1_5.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='stage1_5.c' object='ffs_stage1_5_exec-stage1_5.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/ffs_stage1_5_exec-stage1_5.Po' tmpdepfile='$(DEPDIR)/ffs_stage1_5_exec-stage1_5.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ffs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ffs_stage1_5_exec-stage1_5.obj `if test -f 'stage1_5.c'; then $(CYGPATH_W) 'stage1_5.c'; else $(CYGPATH_W) '$(srcdir)/stage1_5.c'; fi` - -ffs_stage1_5_exec-fsys_ffs.o: fsys_ffs.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ffs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT ffs_stage1_5_exec-fsys_ffs.o -MD -MP -MF "$(DEPDIR)/ffs_stage1_5_exec-fsys_ffs.Tpo" -c -o ffs_stage1_5_exec-fsys_ffs.o `test -f 'fsys_ffs.c' || echo '$(srcdir)/'`fsys_ffs.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ffs_stage1_5_exec-fsys_ffs.Tpo" "$(DEPDIR)/ffs_stage1_5_exec-fsys_ffs.Po"; else rm -f "$(DEPDIR)/ffs_stage1_5_exec-fsys_ffs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_ffs.c' object='ffs_stage1_5_exec-fsys_ffs.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/ffs_stage1_5_exec-fsys_ffs.Po' tmpdepfile='$(DEPDIR)/ffs_stage1_5_exec-fsys_ffs.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ffs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ffs_stage1_5_exec-fsys_ffs.o `test -f 'fsys_ffs.c' || echo '$(srcdir)/'`fsys_ffs.c - -ffs_stage1_5_exec-fsys_ffs.obj: fsys_ffs.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ffs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT ffs_stage1_5_exec-fsys_ffs.obj -MD -MP -MF "$(DEPDIR)/ffs_stage1_5_exec-fsys_ffs.Tpo" -c -o ffs_stage1_5_exec-fsys_ffs.obj `if test -f 'fsys_ffs.c'; then $(CYGPATH_W) 'fsys_ffs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_ffs.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ffs_stage1_5_exec-fsys_ffs.Tpo" "$(DEPDIR)/ffs_stage1_5_exec-fsys_ffs.Po"; else rm -f "$(DEPDIR)/ffs_stage1_5_exec-fsys_ffs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_ffs.c' object='ffs_stage1_5_exec-fsys_ffs.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/ffs_stage1_5_exec-fsys_ffs.Po' tmpdepfile='$(DEPDIR)/ffs_stage1_5_exec-fsys_ffs.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ffs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ffs_stage1_5_exec-fsys_ffs.obj `if test -f 'fsys_ffs.c'; then $(CYGPATH_W) 'fsys_ffs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_ffs.c'; fi` - -ffs_stage1_5_exec-bios.o: bios.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ffs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT ffs_stage1_5_exec-bios.o -MD -MP -MF "$(DEPDIR)/ffs_stage1_5_exec-bios.Tpo" -c -o ffs_stage1_5_exec-bios.o `test -f 'bios.c' || echo '$(srcdir)/'`bios.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ffs_stage1_5_exec-bios.Tpo" "$(DEPDIR)/ffs_stage1_5_exec-bios.Po"; else rm -f "$(DEPDIR)/ffs_stage1_5_exec-bios.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bios.c' object='ffs_stage1_5_exec-bios.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/ffs_stage1_5_exec-bios.Po' tmpdepfile='$(DEPDIR)/ffs_stage1_5_exec-bios.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ffs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ffs_stage1_5_exec-bios.o `test -f 'bios.c' || echo '$(srcdir)/'`bios.c - -ffs_stage1_5_exec-bios.obj: bios.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ffs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT ffs_stage1_5_exec-bios.obj -MD -MP -MF "$(DEPDIR)/ffs_stage1_5_exec-bios.Tpo" -c -o ffs_stage1_5_exec-bios.obj `if test -f 'bios.c'; then $(CYGPATH_W) 'bios.c'; else $(CYGPATH_W) '$(srcdir)/bios.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ffs_stage1_5_exec-bios.Tpo" "$(DEPDIR)/ffs_stage1_5_exec-bios.Po"; else rm -f "$(DEPDIR)/ffs_stage1_5_exec-bios.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bios.c' object='ffs_stage1_5_exec-bios.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/ffs_stage1_5_exec-bios.Po' tmpdepfile='$(DEPDIR)/ffs_stage1_5_exec-bios.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ffs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ffs_stage1_5_exec-bios.obj `if test -f 'bios.c'; then $(CYGPATH_W) 'bios.c'; else $(CYGPATH_W) '$(srcdir)/bios.c'; fi` - -iso9660_stage1_5_exec-common.o: common.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(iso9660_stage1_5_exec_CFLAGS) $(CFLAGS) -MT iso9660_stage1_5_exec-common.o -MD -MP -MF "$(DEPDIR)/iso9660_stage1_5_exec-common.Tpo" -c -o iso9660_stage1_5_exec-common.o `test -f 'common.c' || echo '$(srcdir)/'`common.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/iso9660_stage1_5_exec-common.Tpo" "$(DEPDIR)/iso9660_stage1_5_exec-common.Po"; else rm -f "$(DEPDIR)/iso9660_stage1_5_exec-common.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='common.c' object='iso9660_stage1_5_exec-common.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/iso9660_stage1_5_exec-common.Po' tmpdepfile='$(DEPDIR)/iso9660_stage1_5_exec-common.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(iso9660_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o iso9660_stage1_5_exec-common.o `test -f 'common.c' || echo '$(srcdir)/'`common.c - -iso9660_stage1_5_exec-common.obj: common.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(iso9660_stage1_5_exec_CFLAGS) $(CFLAGS) -MT iso9660_stage1_5_exec-common.obj -MD -MP -MF "$(DEPDIR)/iso9660_stage1_5_exec-common.Tpo" -c -o iso9660_stage1_5_exec-common.obj `if test -f 'common.c'; then $(CYGPATH_W) 'common.c'; else $(CYGPATH_W) '$(srcdir)/common.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/iso9660_stage1_5_exec-common.Tpo" "$(DEPDIR)/iso9660_stage1_5_exec-common.Po"; else rm -f "$(DEPDIR)/iso9660_stage1_5_exec-common.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='common.c' object='iso9660_stage1_5_exec-common.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/iso9660_stage1_5_exec-common.Po' tmpdepfile='$(DEPDIR)/iso9660_stage1_5_exec-common.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(iso9660_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o iso9660_stage1_5_exec-common.obj `if test -f 'common.c'; then $(CYGPATH_W) 'common.c'; else $(CYGPATH_W) '$(srcdir)/common.c'; fi` - -iso9660_stage1_5_exec-char_io.o: char_io.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(iso9660_stage1_5_exec_CFLAGS) $(CFLAGS) -MT iso9660_stage1_5_exec-char_io.o -MD -MP -MF "$(DEPDIR)/iso9660_stage1_5_exec-char_io.Tpo" -c -o iso9660_stage1_5_exec-char_io.o `test -f 'char_io.c' || echo '$(srcdir)/'`char_io.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/iso9660_stage1_5_exec-char_io.Tpo" "$(DEPDIR)/iso9660_stage1_5_exec-char_io.Po"; else rm -f "$(DEPDIR)/iso9660_stage1_5_exec-char_io.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='char_io.c' object='iso9660_stage1_5_exec-char_io.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/iso9660_stage1_5_exec-char_io.Po' tmpdepfile='$(DEPDIR)/iso9660_stage1_5_exec-char_io.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(iso9660_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o iso9660_stage1_5_exec-char_io.o `test -f 'char_io.c' || echo '$(srcdir)/'`char_io.c - -iso9660_stage1_5_exec-char_io.obj: char_io.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(iso9660_stage1_5_exec_CFLAGS) $(CFLAGS) -MT iso9660_stage1_5_exec-char_io.obj -MD -MP -MF "$(DEPDIR)/iso9660_stage1_5_exec-char_io.Tpo" -c -o iso9660_stage1_5_exec-char_io.obj `if test -f 'char_io.c'; then $(CYGPATH_W) 'char_io.c'; else $(CYGPATH_W) '$(srcdir)/char_io.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/iso9660_stage1_5_exec-char_io.Tpo" "$(DEPDIR)/iso9660_stage1_5_exec-char_io.Po"; else rm -f "$(DEPDIR)/iso9660_stage1_5_exec-char_io.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='char_io.c' object='iso9660_stage1_5_exec-char_io.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/iso9660_stage1_5_exec-char_io.Po' tmpdepfile='$(DEPDIR)/iso9660_stage1_5_exec-char_io.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(iso9660_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o iso9660_stage1_5_exec-char_io.obj `if test -f 'char_io.c'; then $(CYGPATH_W) 'char_io.c'; else $(CYGPATH_W) '$(srcdir)/char_io.c'; fi` - -iso9660_stage1_5_exec-disk_io.o: disk_io.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(iso9660_stage1_5_exec_CFLAGS) $(CFLAGS) -MT iso9660_stage1_5_exec-disk_io.o -MD -MP -MF "$(DEPDIR)/iso9660_stage1_5_exec-disk_io.Tpo" -c -o iso9660_stage1_5_exec-disk_io.o `test -f 'disk_io.c' || echo '$(srcdir)/'`disk_io.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/iso9660_stage1_5_exec-disk_io.Tpo" "$(DEPDIR)/iso9660_stage1_5_exec-disk_io.Po"; else rm -f "$(DEPDIR)/iso9660_stage1_5_exec-disk_io.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='disk_io.c' object='iso9660_stage1_5_exec-disk_io.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/iso9660_stage1_5_exec-disk_io.Po' tmpdepfile='$(DEPDIR)/iso9660_stage1_5_exec-disk_io.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(iso9660_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o iso9660_stage1_5_exec-disk_io.o `test -f 'disk_io.c' || echo '$(srcdir)/'`disk_io.c - -iso9660_stage1_5_exec-disk_io.obj: disk_io.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(iso9660_stage1_5_exec_CFLAGS) $(CFLAGS) -MT iso9660_stage1_5_exec-disk_io.obj -MD -MP -MF "$(DEPDIR)/iso9660_stage1_5_exec-disk_io.Tpo" -c -o iso9660_stage1_5_exec-disk_io.obj `if test -f 'disk_io.c'; then $(CYGPATH_W) 'disk_io.c'; else $(CYGPATH_W) '$(srcdir)/disk_io.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/iso9660_stage1_5_exec-disk_io.Tpo" "$(DEPDIR)/iso9660_stage1_5_exec-disk_io.Po"; else rm -f "$(DEPDIR)/iso9660_stage1_5_exec-disk_io.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='disk_io.c' object='iso9660_stage1_5_exec-disk_io.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/iso9660_stage1_5_exec-disk_io.Po' tmpdepfile='$(DEPDIR)/iso9660_stage1_5_exec-disk_io.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(iso9660_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o iso9660_stage1_5_exec-disk_io.obj `if test -f 'disk_io.c'; then $(CYGPATH_W) 'disk_io.c'; else $(CYGPATH_W) '$(srcdir)/disk_io.c'; fi` - -iso9660_stage1_5_exec-stage1_5.o: stage1_5.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(iso9660_stage1_5_exec_CFLAGS) $(CFLAGS) -MT iso9660_stage1_5_exec-stage1_5.o -MD -MP -MF "$(DEPDIR)/iso9660_stage1_5_exec-stage1_5.Tpo" -c -o iso9660_stage1_5_exec-stage1_5.o `test -f 'stage1_5.c' || echo '$(srcdir)/'`stage1_5.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/iso9660_stage1_5_exec-stage1_5.Tpo" "$(DEPDIR)/iso9660_stage1_5_exec-stage1_5.Po"; else rm -f "$(DEPDIR)/iso9660_stage1_5_exec-stage1_5.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='stage1_5.c' object='iso9660_stage1_5_exec-stage1_5.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/iso9660_stage1_5_exec-stage1_5.Po' tmpdepfile='$(DEPDIR)/iso9660_stage1_5_exec-stage1_5.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(iso9660_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o iso9660_stage1_5_exec-stage1_5.o `test -f 'stage1_5.c' || echo '$(srcdir)/'`stage1_5.c - -iso9660_stage1_5_exec-stage1_5.obj: stage1_5.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(iso9660_stage1_5_exec_CFLAGS) $(CFLAGS) -MT iso9660_stage1_5_exec-stage1_5.obj -MD -MP -MF "$(DEPDIR)/iso9660_stage1_5_exec-stage1_5.Tpo" -c -o iso9660_stage1_5_exec-stage1_5.obj `if test -f 'stage1_5.c'; then $(CYGPATH_W) 'stage1_5.c'; else $(CYGPATH_W) '$(srcdir)/stage1_5.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/iso9660_stage1_5_exec-stage1_5.Tpo" "$(DEPDIR)/iso9660_stage1_5_exec-stage1_5.Po"; else rm -f "$(DEPDIR)/iso9660_stage1_5_exec-stage1_5.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='stage1_5.c' object='iso9660_stage1_5_exec-stage1_5.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/iso9660_stage1_5_exec-stage1_5.Po' tmpdepfile='$(DEPDIR)/iso9660_stage1_5_exec-stage1_5.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(iso9660_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o iso9660_stage1_5_exec-stage1_5.obj `if test -f 'stage1_5.c'; then $(CYGPATH_W) 'stage1_5.c'; else $(CYGPATH_W) '$(srcdir)/stage1_5.c'; fi` - -iso9660_stage1_5_exec-fsys_iso9660.o: fsys_iso9660.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(iso9660_stage1_5_exec_CFLAGS) $(CFLAGS) -MT iso9660_stage1_5_exec-fsys_iso9660.o -MD -MP -MF "$(DEPDIR)/iso9660_stage1_5_exec-fsys_iso9660.Tpo" -c -o iso9660_stage1_5_exec-fsys_iso9660.o `test -f 'fsys_iso9660.c' || echo '$(srcdir)/'`fsys_iso9660.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/iso9660_stage1_5_exec-fsys_iso9660.Tpo" "$(DEPDIR)/iso9660_stage1_5_exec-fsys_iso9660.Po"; else rm -f "$(DEPDIR)/iso9660_stage1_5_exec-fsys_iso9660.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_iso9660.c' object='iso9660_stage1_5_exec-fsys_iso9660.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/iso9660_stage1_5_exec-fsys_iso9660.Po' tmpdepfile='$(DEPDIR)/iso9660_stage1_5_exec-fsys_iso9660.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(iso9660_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o iso9660_stage1_5_exec-fsys_iso9660.o `test -f 'fsys_iso9660.c' || echo '$(srcdir)/'`fsys_iso9660.c - -iso9660_stage1_5_exec-fsys_iso9660.obj: fsys_iso9660.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(iso9660_stage1_5_exec_CFLAGS) $(CFLAGS) -MT iso9660_stage1_5_exec-fsys_iso9660.obj -MD -MP -MF "$(DEPDIR)/iso9660_stage1_5_exec-fsys_iso9660.Tpo" -c -o iso9660_stage1_5_exec-fsys_iso9660.obj `if test -f 'fsys_iso9660.c'; then $(CYGPATH_W) 'fsys_iso9660.c'; else $(CYGPATH_W) '$(srcdir)/fsys_iso9660.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/iso9660_stage1_5_exec-fsys_iso9660.Tpo" "$(DEPDIR)/iso9660_stage1_5_exec-fsys_iso9660.Po"; else rm -f "$(DEPDIR)/iso9660_stage1_5_exec-fsys_iso9660.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_iso9660.c' object='iso9660_stage1_5_exec-fsys_iso9660.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/iso9660_stage1_5_exec-fsys_iso9660.Po' tmpdepfile='$(DEPDIR)/iso9660_stage1_5_exec-fsys_iso9660.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(iso9660_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o iso9660_stage1_5_exec-fsys_iso9660.obj `if test -f 'fsys_iso9660.c'; then $(CYGPATH_W) 'fsys_iso9660.c'; else $(CYGPATH_W) '$(srcdir)/fsys_iso9660.c'; fi` - -iso9660_stage1_5_exec-bios.o: bios.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(iso9660_stage1_5_exec_CFLAGS) $(CFLAGS) -MT iso9660_stage1_5_exec-bios.o -MD -MP -MF "$(DEPDIR)/iso9660_stage1_5_exec-bios.Tpo" -c -o iso9660_stage1_5_exec-bios.o `test -f 'bios.c' || echo '$(srcdir)/'`bios.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/iso9660_stage1_5_exec-bios.Tpo" "$(DEPDIR)/iso9660_stage1_5_exec-bios.Po"; else rm -f "$(DEPDIR)/iso9660_stage1_5_exec-bios.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bios.c' object='iso9660_stage1_5_exec-bios.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/iso9660_stage1_5_exec-bios.Po' tmpdepfile='$(DEPDIR)/iso9660_stage1_5_exec-bios.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(iso9660_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o iso9660_stage1_5_exec-bios.o `test -f 'bios.c' || echo '$(srcdir)/'`bios.c - -iso9660_stage1_5_exec-bios.obj: bios.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(iso9660_stage1_5_exec_CFLAGS) $(CFLAGS) -MT iso9660_stage1_5_exec-bios.obj -MD -MP -MF "$(DEPDIR)/iso9660_stage1_5_exec-bios.Tpo" -c -o iso9660_stage1_5_exec-bios.obj `if test -f 'bios.c'; then $(CYGPATH_W) 'bios.c'; else $(CYGPATH_W) '$(srcdir)/bios.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/iso9660_stage1_5_exec-bios.Tpo" "$(DEPDIR)/iso9660_stage1_5_exec-bios.Po"; else rm -f "$(DEPDIR)/iso9660_stage1_5_exec-bios.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bios.c' object='iso9660_stage1_5_exec-bios.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/iso9660_stage1_5_exec-bios.Po' tmpdepfile='$(DEPDIR)/iso9660_stage1_5_exec-bios.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(iso9660_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o iso9660_stage1_5_exec-bios.obj `if test -f 'bios.c'; then $(CYGPATH_W) 'bios.c'; else $(CYGPATH_W) '$(srcdir)/bios.c'; fi` - -jfs_stage1_5_exec-common.o: common.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(jfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT jfs_stage1_5_exec-common.o -MD -MP -MF "$(DEPDIR)/jfs_stage1_5_exec-common.Tpo" -c -o jfs_stage1_5_exec-common.o `test -f 'common.c' || echo '$(srcdir)/'`common.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/jfs_stage1_5_exec-common.Tpo" "$(DEPDIR)/jfs_stage1_5_exec-common.Po"; else rm -f "$(DEPDIR)/jfs_stage1_5_exec-common.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='common.c' object='jfs_stage1_5_exec-common.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/jfs_stage1_5_exec-common.Po' tmpdepfile='$(DEPDIR)/jfs_stage1_5_exec-common.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(jfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o jfs_stage1_5_exec-common.o `test -f 'common.c' || echo '$(srcdir)/'`common.c - -jfs_stage1_5_exec-common.obj: common.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(jfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT jfs_stage1_5_exec-common.obj -MD -MP -MF "$(DEPDIR)/jfs_stage1_5_exec-common.Tpo" -c -o jfs_stage1_5_exec-common.obj `if test -f 'common.c'; then $(CYGPATH_W) 'common.c'; else $(CYGPATH_W) '$(srcdir)/common.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/jfs_stage1_5_exec-common.Tpo" "$(DEPDIR)/jfs_stage1_5_exec-common.Po"; else rm -f "$(DEPDIR)/jfs_stage1_5_exec-common.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='common.c' object='jfs_stage1_5_exec-common.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/jfs_stage1_5_exec-common.Po' tmpdepfile='$(DEPDIR)/jfs_stage1_5_exec-common.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(jfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o jfs_stage1_5_exec-common.obj `if test -f 'common.c'; then $(CYGPATH_W) 'common.c'; else $(CYGPATH_W) '$(srcdir)/common.c'; fi` - -jfs_stage1_5_exec-char_io.o: char_io.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(jfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT jfs_stage1_5_exec-char_io.o -MD -MP -MF "$(DEPDIR)/jfs_stage1_5_exec-char_io.Tpo" -c -o jfs_stage1_5_exec-char_io.o `test -f 'char_io.c' || echo '$(srcdir)/'`char_io.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/jfs_stage1_5_exec-char_io.Tpo" "$(DEPDIR)/jfs_stage1_5_exec-char_io.Po"; else rm -f "$(DEPDIR)/jfs_stage1_5_exec-char_io.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='char_io.c' object='jfs_stage1_5_exec-char_io.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/jfs_stage1_5_exec-char_io.Po' tmpdepfile='$(DEPDIR)/jfs_stage1_5_exec-char_io.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(jfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o jfs_stage1_5_exec-char_io.o `test -f 'char_io.c' || echo '$(srcdir)/'`char_io.c - -jfs_stage1_5_exec-char_io.obj: char_io.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(jfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT jfs_stage1_5_exec-char_io.obj -MD -MP -MF "$(DEPDIR)/jfs_stage1_5_exec-char_io.Tpo" -c -o jfs_stage1_5_exec-char_io.obj `if test -f 'char_io.c'; then $(CYGPATH_W) 'char_io.c'; else $(CYGPATH_W) '$(srcdir)/char_io.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/jfs_stage1_5_exec-char_io.Tpo" "$(DEPDIR)/jfs_stage1_5_exec-char_io.Po"; else rm -f "$(DEPDIR)/jfs_stage1_5_exec-char_io.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='char_io.c' object='jfs_stage1_5_exec-char_io.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/jfs_stage1_5_exec-char_io.Po' tmpdepfile='$(DEPDIR)/jfs_stage1_5_exec-char_io.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(jfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o jfs_stage1_5_exec-char_io.obj `if test -f 'char_io.c'; then $(CYGPATH_W) 'char_io.c'; else $(CYGPATH_W) '$(srcdir)/char_io.c'; fi` - -jfs_stage1_5_exec-disk_io.o: disk_io.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(jfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT jfs_stage1_5_exec-disk_io.o -MD -MP -MF "$(DEPDIR)/jfs_stage1_5_exec-disk_io.Tpo" -c -o jfs_stage1_5_exec-disk_io.o `test -f 'disk_io.c' || echo '$(srcdir)/'`disk_io.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/jfs_stage1_5_exec-disk_io.Tpo" "$(DEPDIR)/jfs_stage1_5_exec-disk_io.Po"; else rm -f "$(DEPDIR)/jfs_stage1_5_exec-disk_io.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='disk_io.c' object='jfs_stage1_5_exec-disk_io.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/jfs_stage1_5_exec-disk_io.Po' tmpdepfile='$(DEPDIR)/jfs_stage1_5_exec-disk_io.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(jfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o jfs_stage1_5_exec-disk_io.o `test -f 'disk_io.c' || echo '$(srcdir)/'`disk_io.c - -jfs_stage1_5_exec-disk_io.obj: disk_io.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(jfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT jfs_stage1_5_exec-disk_io.obj -MD -MP -MF "$(DEPDIR)/jfs_stage1_5_exec-disk_io.Tpo" -c -o jfs_stage1_5_exec-disk_io.obj `if test -f 'disk_io.c'; then $(CYGPATH_W) 'disk_io.c'; else $(CYGPATH_W) '$(srcdir)/disk_io.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/jfs_stage1_5_exec-disk_io.Tpo" "$(DEPDIR)/jfs_stage1_5_exec-disk_io.Po"; else rm -f "$(DEPDIR)/jfs_stage1_5_exec-disk_io.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='disk_io.c' object='jfs_stage1_5_exec-disk_io.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/jfs_stage1_5_exec-disk_io.Po' tmpdepfile='$(DEPDIR)/jfs_stage1_5_exec-disk_io.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(jfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o jfs_stage1_5_exec-disk_io.obj `if test -f 'disk_io.c'; then $(CYGPATH_W) 'disk_io.c'; else $(CYGPATH_W) '$(srcdir)/disk_io.c'; fi` - -jfs_stage1_5_exec-stage1_5.o: stage1_5.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(jfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT jfs_stage1_5_exec-stage1_5.o -MD -MP -MF "$(DEPDIR)/jfs_stage1_5_exec-stage1_5.Tpo" -c -o jfs_stage1_5_exec-stage1_5.o `test -f 'stage1_5.c' || echo '$(srcdir)/'`stage1_5.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/jfs_stage1_5_exec-stage1_5.Tpo" "$(DEPDIR)/jfs_stage1_5_exec-stage1_5.Po"; else rm -f "$(DEPDIR)/jfs_stage1_5_exec-stage1_5.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='stage1_5.c' object='jfs_stage1_5_exec-stage1_5.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/jfs_stage1_5_exec-stage1_5.Po' tmpdepfile='$(DEPDIR)/jfs_stage1_5_exec-stage1_5.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(jfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o jfs_stage1_5_exec-stage1_5.o `test -f 'stage1_5.c' || echo '$(srcdir)/'`stage1_5.c - -jfs_stage1_5_exec-stage1_5.obj: stage1_5.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(jfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT jfs_stage1_5_exec-stage1_5.obj -MD -MP -MF "$(DEPDIR)/jfs_stage1_5_exec-stage1_5.Tpo" -c -o jfs_stage1_5_exec-stage1_5.obj `if test -f 'stage1_5.c'; then $(CYGPATH_W) 'stage1_5.c'; else $(CYGPATH_W) '$(srcdir)/stage1_5.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/jfs_stage1_5_exec-stage1_5.Tpo" "$(DEPDIR)/jfs_stage1_5_exec-stage1_5.Po"; else rm -f "$(DEPDIR)/jfs_stage1_5_exec-stage1_5.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='stage1_5.c' object='jfs_stage1_5_exec-stage1_5.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/jfs_stage1_5_exec-stage1_5.Po' tmpdepfile='$(DEPDIR)/jfs_stage1_5_exec-stage1_5.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(jfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o jfs_stage1_5_exec-stage1_5.obj `if test -f 'stage1_5.c'; then $(CYGPATH_W) 'stage1_5.c'; else $(CYGPATH_W) '$(srcdir)/stage1_5.c'; fi` - -jfs_stage1_5_exec-fsys_jfs.o: fsys_jfs.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(jfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT jfs_stage1_5_exec-fsys_jfs.o -MD -MP -MF "$(DEPDIR)/jfs_stage1_5_exec-fsys_jfs.Tpo" -c -o jfs_stage1_5_exec-fsys_jfs.o `test -f 'fsys_jfs.c' || echo '$(srcdir)/'`fsys_jfs.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/jfs_stage1_5_exec-fsys_jfs.Tpo" "$(DEPDIR)/jfs_stage1_5_exec-fsys_jfs.Po"; else rm -f "$(DEPDIR)/jfs_stage1_5_exec-fsys_jfs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_jfs.c' object='jfs_stage1_5_exec-fsys_jfs.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/jfs_stage1_5_exec-fsys_jfs.Po' tmpdepfile='$(DEPDIR)/jfs_stage1_5_exec-fsys_jfs.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(jfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o jfs_stage1_5_exec-fsys_jfs.o `test -f 'fsys_jfs.c' || echo '$(srcdir)/'`fsys_jfs.c - -jfs_stage1_5_exec-fsys_jfs.obj: fsys_jfs.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(jfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT jfs_stage1_5_exec-fsys_jfs.obj -MD -MP -MF "$(DEPDIR)/jfs_stage1_5_exec-fsys_jfs.Tpo" -c -o jfs_stage1_5_exec-fsys_jfs.obj `if test -f 'fsys_jfs.c'; then $(CYGPATH_W) 'fsys_jfs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_jfs.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/jfs_stage1_5_exec-fsys_jfs.Tpo" "$(DEPDIR)/jfs_stage1_5_exec-fsys_jfs.Po"; else rm -f "$(DEPDIR)/jfs_stage1_5_exec-fsys_jfs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_jfs.c' object='jfs_stage1_5_exec-fsys_jfs.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/jfs_stage1_5_exec-fsys_jfs.Po' tmpdepfile='$(DEPDIR)/jfs_stage1_5_exec-fsys_jfs.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(jfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o jfs_stage1_5_exec-fsys_jfs.obj `if test -f 'fsys_jfs.c'; then $(CYGPATH_W) 'fsys_jfs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_jfs.c'; fi` - -jfs_stage1_5_exec-bios.o: bios.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(jfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT jfs_stage1_5_exec-bios.o -MD -MP -MF "$(DEPDIR)/jfs_stage1_5_exec-bios.Tpo" -c -o jfs_stage1_5_exec-bios.o `test -f 'bios.c' || echo '$(srcdir)/'`bios.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/jfs_stage1_5_exec-bios.Tpo" "$(DEPDIR)/jfs_stage1_5_exec-bios.Po"; else rm -f "$(DEPDIR)/jfs_stage1_5_exec-bios.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bios.c' object='jfs_stage1_5_exec-bios.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/jfs_stage1_5_exec-bios.Po' tmpdepfile='$(DEPDIR)/jfs_stage1_5_exec-bios.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(jfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o jfs_stage1_5_exec-bios.o `test -f 'bios.c' || echo '$(srcdir)/'`bios.c - -jfs_stage1_5_exec-bios.obj: bios.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(jfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT jfs_stage1_5_exec-bios.obj -MD -MP -MF "$(DEPDIR)/jfs_stage1_5_exec-bios.Tpo" -c -o jfs_stage1_5_exec-bios.obj `if test -f 'bios.c'; then $(CYGPATH_W) 'bios.c'; else $(CYGPATH_W) '$(srcdir)/bios.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/jfs_stage1_5_exec-bios.Tpo" "$(DEPDIR)/jfs_stage1_5_exec-bios.Po"; else rm -f "$(DEPDIR)/jfs_stage1_5_exec-bios.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bios.c' object='jfs_stage1_5_exec-bios.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/jfs_stage1_5_exec-bios.Po' tmpdepfile='$(DEPDIR)/jfs_stage1_5_exec-bios.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(jfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o jfs_stage1_5_exec-bios.obj `if test -f 'bios.c'; then $(CYGPATH_W) 'bios.c'; else $(CYGPATH_W) '$(srcdir)/bios.c'; fi` - -minix_stage1_5_exec-common.o: common.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -MT minix_stage1_5_exec-common.o -MD -MP -MF "$(DEPDIR)/minix_stage1_5_exec-common.Tpo" -c -o minix_stage1_5_exec-common.o `test -f 'common.c' || echo '$(srcdir)/'`common.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/minix_stage1_5_exec-common.Tpo" "$(DEPDIR)/minix_stage1_5_exec-common.Po"; else rm -f "$(DEPDIR)/minix_stage1_5_exec-common.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='common.c' object='minix_stage1_5_exec-common.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/minix_stage1_5_exec-common.Po' tmpdepfile='$(DEPDIR)/minix_stage1_5_exec-common.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o minix_stage1_5_exec-common.o `test -f 'common.c' || echo '$(srcdir)/'`common.c - -minix_stage1_5_exec-common.obj: common.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -MT minix_stage1_5_exec-common.obj -MD -MP -MF "$(DEPDIR)/minix_stage1_5_exec-common.Tpo" -c -o minix_stage1_5_exec-common.obj `if test -f 'common.c'; then $(CYGPATH_W) 'common.c'; else $(CYGPATH_W) '$(srcdir)/common.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/minix_stage1_5_exec-common.Tpo" "$(DEPDIR)/minix_stage1_5_exec-common.Po"; else rm -f "$(DEPDIR)/minix_stage1_5_exec-common.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='common.c' object='minix_stage1_5_exec-common.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/minix_stage1_5_exec-common.Po' tmpdepfile='$(DEPDIR)/minix_stage1_5_exec-common.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o minix_stage1_5_exec-common.obj `if test -f 'common.c'; then $(CYGPATH_W) 'common.c'; else $(CYGPATH_W) '$(srcdir)/common.c'; fi` - -minix_stage1_5_exec-char_io.o: char_io.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -MT minix_stage1_5_exec-char_io.o -MD -MP -MF "$(DEPDIR)/minix_stage1_5_exec-char_io.Tpo" -c -o minix_stage1_5_exec-char_io.o `test -f 'char_io.c' || echo '$(srcdir)/'`char_io.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/minix_stage1_5_exec-char_io.Tpo" "$(DEPDIR)/minix_stage1_5_exec-char_io.Po"; else rm -f "$(DEPDIR)/minix_stage1_5_exec-char_io.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='char_io.c' object='minix_stage1_5_exec-char_io.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/minix_stage1_5_exec-char_io.Po' tmpdepfile='$(DEPDIR)/minix_stage1_5_exec-char_io.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o minix_stage1_5_exec-char_io.o `test -f 'char_io.c' || echo '$(srcdir)/'`char_io.c - -minix_stage1_5_exec-char_io.obj: char_io.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -MT minix_stage1_5_exec-char_io.obj -MD -MP -MF "$(DEPDIR)/minix_stage1_5_exec-char_io.Tpo" -c -o minix_stage1_5_exec-char_io.obj `if test -f 'char_io.c'; then $(CYGPATH_W) 'char_io.c'; else $(CYGPATH_W) '$(srcdir)/char_io.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/minix_stage1_5_exec-char_io.Tpo" "$(DEPDIR)/minix_stage1_5_exec-char_io.Po"; else rm -f "$(DEPDIR)/minix_stage1_5_exec-char_io.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='char_io.c' object='minix_stage1_5_exec-char_io.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/minix_stage1_5_exec-char_io.Po' tmpdepfile='$(DEPDIR)/minix_stage1_5_exec-char_io.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o minix_stage1_5_exec-char_io.obj `if test -f 'char_io.c'; then $(CYGPATH_W) 'char_io.c'; else $(CYGPATH_W) '$(srcdir)/char_io.c'; fi` - -minix_stage1_5_exec-disk_io.o: disk_io.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -MT minix_stage1_5_exec-disk_io.o -MD -MP -MF "$(DEPDIR)/minix_stage1_5_exec-disk_io.Tpo" -c -o minix_stage1_5_exec-disk_io.o `test -f 'disk_io.c' || echo '$(srcdir)/'`disk_io.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/minix_stage1_5_exec-disk_io.Tpo" "$(DEPDIR)/minix_stage1_5_exec-disk_io.Po"; else rm -f "$(DEPDIR)/minix_stage1_5_exec-disk_io.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='disk_io.c' object='minix_stage1_5_exec-disk_io.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/minix_stage1_5_exec-disk_io.Po' tmpdepfile='$(DEPDIR)/minix_stage1_5_exec-disk_io.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o minix_stage1_5_exec-disk_io.o `test -f 'disk_io.c' || echo '$(srcdir)/'`disk_io.c - -minix_stage1_5_exec-disk_io.obj: disk_io.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -MT minix_stage1_5_exec-disk_io.obj -MD -MP -MF "$(DEPDIR)/minix_stage1_5_exec-disk_io.Tpo" -c -o minix_stage1_5_exec-disk_io.obj `if test -f 'disk_io.c'; then $(CYGPATH_W) 'disk_io.c'; else $(CYGPATH_W) '$(srcdir)/disk_io.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/minix_stage1_5_exec-disk_io.Tpo" "$(DEPDIR)/minix_stage1_5_exec-disk_io.Po"; else rm -f "$(DEPDIR)/minix_stage1_5_exec-disk_io.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='disk_io.c' object='minix_stage1_5_exec-disk_io.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/minix_stage1_5_exec-disk_io.Po' tmpdepfile='$(DEPDIR)/minix_stage1_5_exec-disk_io.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o minix_stage1_5_exec-disk_io.obj `if test -f 'disk_io.c'; then $(CYGPATH_W) 'disk_io.c'; else $(CYGPATH_W) '$(srcdir)/disk_io.c'; fi` - -minix_stage1_5_exec-stage1_5.o: stage1_5.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -MT minix_stage1_5_exec-stage1_5.o -MD -MP -MF "$(DEPDIR)/minix_stage1_5_exec-stage1_5.Tpo" -c -o minix_stage1_5_exec-stage1_5.o `test -f 'stage1_5.c' || echo '$(srcdir)/'`stage1_5.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/minix_stage1_5_exec-stage1_5.Tpo" "$(DEPDIR)/minix_stage1_5_exec-stage1_5.Po"; else rm -f "$(DEPDIR)/minix_stage1_5_exec-stage1_5.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='stage1_5.c' object='minix_stage1_5_exec-stage1_5.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/minix_stage1_5_exec-stage1_5.Po' tmpdepfile='$(DEPDIR)/minix_stage1_5_exec-stage1_5.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o minix_stage1_5_exec-stage1_5.o `test -f 'stage1_5.c' || echo '$(srcdir)/'`stage1_5.c - -minix_stage1_5_exec-stage1_5.obj: stage1_5.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -MT minix_stage1_5_exec-stage1_5.obj -MD -MP -MF "$(DEPDIR)/minix_stage1_5_exec-stage1_5.Tpo" -c -o minix_stage1_5_exec-stage1_5.obj `if test -f 'stage1_5.c'; then $(CYGPATH_W) 'stage1_5.c'; else $(CYGPATH_W) '$(srcdir)/stage1_5.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/minix_stage1_5_exec-stage1_5.Tpo" "$(DEPDIR)/minix_stage1_5_exec-stage1_5.Po"; else rm -f "$(DEPDIR)/minix_stage1_5_exec-stage1_5.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='stage1_5.c' object='minix_stage1_5_exec-stage1_5.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/minix_stage1_5_exec-stage1_5.Po' tmpdepfile='$(DEPDIR)/minix_stage1_5_exec-stage1_5.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o minix_stage1_5_exec-stage1_5.obj `if test -f 'stage1_5.c'; then $(CYGPATH_W) 'stage1_5.c'; else $(CYGPATH_W) '$(srcdir)/stage1_5.c'; fi` - -minix_stage1_5_exec-fsys_minix.o: fsys_minix.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -MT minix_stage1_5_exec-fsys_minix.o -MD -MP -MF "$(DEPDIR)/minix_stage1_5_exec-fsys_minix.Tpo" -c -o minix_stage1_5_exec-fsys_minix.o `test -f 'fsys_minix.c' || echo '$(srcdir)/'`fsys_minix.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/minix_stage1_5_exec-fsys_minix.Tpo" "$(DEPDIR)/minix_stage1_5_exec-fsys_minix.Po"; else rm -f "$(DEPDIR)/minix_stage1_5_exec-fsys_minix.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_minix.c' object='minix_stage1_5_exec-fsys_minix.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/minix_stage1_5_exec-fsys_minix.Po' tmpdepfile='$(DEPDIR)/minix_stage1_5_exec-fsys_minix.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o minix_stage1_5_exec-fsys_minix.o `test -f 'fsys_minix.c' || echo '$(srcdir)/'`fsys_minix.c - -minix_stage1_5_exec-fsys_minix.obj: fsys_minix.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -MT minix_stage1_5_exec-fsys_minix.obj -MD -MP -MF "$(DEPDIR)/minix_stage1_5_exec-fsys_minix.Tpo" -c -o minix_stage1_5_exec-fsys_minix.obj `if test -f 'fsys_minix.c'; then $(CYGPATH_W) 'fsys_minix.c'; else $(CYGPATH_W) '$(srcdir)/fsys_minix.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/minix_stage1_5_exec-fsys_minix.Tpo" "$(DEPDIR)/minix_stage1_5_exec-fsys_minix.Po"; else rm -f "$(DEPDIR)/minix_stage1_5_exec-fsys_minix.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_minix.c' object='minix_stage1_5_exec-fsys_minix.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/minix_stage1_5_exec-fsys_minix.Po' tmpdepfile='$(DEPDIR)/minix_stage1_5_exec-fsys_minix.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o minix_stage1_5_exec-fsys_minix.obj `if test -f 'fsys_minix.c'; then $(CYGPATH_W) 'fsys_minix.c'; else $(CYGPATH_W) '$(srcdir)/fsys_minix.c'; fi` - -minix_stage1_5_exec-bios.o: bios.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -MT minix_stage1_5_exec-bios.o -MD -MP -MF "$(DEPDIR)/minix_stage1_5_exec-bios.Tpo" -c -o minix_stage1_5_exec-bios.o `test -f 'bios.c' || echo '$(srcdir)/'`bios.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/minix_stage1_5_exec-bios.Tpo" "$(DEPDIR)/minix_stage1_5_exec-bios.Po"; else rm -f "$(DEPDIR)/minix_stage1_5_exec-bios.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bios.c' object='minix_stage1_5_exec-bios.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/minix_stage1_5_exec-bios.Po' tmpdepfile='$(DEPDIR)/minix_stage1_5_exec-bios.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o minix_stage1_5_exec-bios.o `test -f 'bios.c' || echo '$(srcdir)/'`bios.c - -minix_stage1_5_exec-bios.obj: bios.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -MT minix_stage1_5_exec-bios.obj -MD -MP -MF "$(DEPDIR)/minix_stage1_5_exec-bios.Tpo" -c -o minix_stage1_5_exec-bios.obj `if test -f 'bios.c'; then $(CYGPATH_W) 'bios.c'; else $(CYGPATH_W) '$(srcdir)/bios.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/minix_stage1_5_exec-bios.Tpo" "$(DEPDIR)/minix_stage1_5_exec-bios.Po"; else rm -f "$(DEPDIR)/minix_stage1_5_exec-bios.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bios.c' object='minix_stage1_5_exec-bios.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/minix_stage1_5_exec-bios.Po' tmpdepfile='$(DEPDIR)/minix_stage1_5_exec-bios.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o minix_stage1_5_exec-bios.obj `if test -f 'bios.c'; then $(CYGPATH_W) 'bios.c'; else $(CYGPATH_W) '$(srcdir)/bios.c'; fi` - -pre_stage2_exec-bios.o: bios.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-bios.o -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-bios.Tpo" -c -o pre_stage2_exec-bios.o `test -f 'bios.c' || echo '$(srcdir)/'`bios.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-bios.Tpo" "$(DEPDIR)/pre_stage2_exec-bios.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-bios.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bios.c' object='pre_stage2_exec-bios.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/pre_stage2_exec-bios.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-bios.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-bios.o `test -f 'bios.c' || echo '$(srcdir)/'`bios.c - -pre_stage2_exec-bios.obj: bios.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-bios.obj -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-bios.Tpo" -c -o pre_stage2_exec-bios.obj `if test -f 'bios.c'; then $(CYGPATH_W) 'bios.c'; else $(CYGPATH_W) '$(srcdir)/bios.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-bios.Tpo" "$(DEPDIR)/pre_stage2_exec-bios.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-bios.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bios.c' object='pre_stage2_exec-bios.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/pre_stage2_exec-bios.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-bios.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-bios.obj `if test -f 'bios.c'; then $(CYGPATH_W) 'bios.c'; else $(CYGPATH_W) '$(srcdir)/bios.c'; fi` - -pre_stage2_exec-boot.o: boot.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-boot.o -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-boot.Tpo" -c -o pre_stage2_exec-boot.o `test -f 'boot.c' || echo '$(srcdir)/'`boot.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-boot.Tpo" "$(DEPDIR)/pre_stage2_exec-boot.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-boot.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='boot.c' object='pre_stage2_exec-boot.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/pre_stage2_exec-boot.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-boot.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-boot.o `test -f 'boot.c' || echo '$(srcdir)/'`boot.c - -pre_stage2_exec-boot.obj: boot.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-boot.obj -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-boot.Tpo" -c -o pre_stage2_exec-boot.obj `if test -f 'boot.c'; then $(CYGPATH_W) 'boot.c'; else $(CYGPATH_W) '$(srcdir)/boot.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-boot.Tpo" "$(DEPDIR)/pre_stage2_exec-boot.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-boot.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='boot.c' object='pre_stage2_exec-boot.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/pre_stage2_exec-boot.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-boot.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-boot.obj `if test -f 'boot.c'; then $(CYGPATH_W) 'boot.c'; else $(CYGPATH_W) '$(srcdir)/boot.c'; fi` - -pre_stage2_exec-builtins.o: builtins.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-builtins.o -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-builtins.Tpo" -c -o pre_stage2_exec-builtins.o `test -f 'builtins.c' || echo '$(srcdir)/'`builtins.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-builtins.Tpo" "$(DEPDIR)/pre_stage2_exec-builtins.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-builtins.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='builtins.c' object='pre_stage2_exec-builtins.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/pre_stage2_exec-builtins.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-builtins.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-builtins.o `test -f 'builtins.c' || echo '$(srcdir)/'`builtins.c - -pre_stage2_exec-builtins.obj: builtins.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-builtins.obj -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-builtins.Tpo" -c -o pre_stage2_exec-builtins.obj `if test -f 'builtins.c'; then $(CYGPATH_W) 'builtins.c'; else $(CYGPATH_W) '$(srcdir)/builtins.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-builtins.Tpo" "$(DEPDIR)/pre_stage2_exec-builtins.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-builtins.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='builtins.c' object='pre_stage2_exec-builtins.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/pre_stage2_exec-builtins.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-builtins.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-builtins.obj `if test -f 'builtins.c'; then $(CYGPATH_W) 'builtins.c'; else $(CYGPATH_W) '$(srcdir)/builtins.c'; fi` - -pre_stage2_exec-char_io.o: char_io.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-char_io.o -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-char_io.Tpo" -c -o pre_stage2_exec-char_io.o `test -f 'char_io.c' || echo '$(srcdir)/'`char_io.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-char_io.Tpo" "$(DEPDIR)/pre_stage2_exec-char_io.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-char_io.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='char_io.c' object='pre_stage2_exec-char_io.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/pre_stage2_exec-char_io.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-char_io.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-char_io.o `test -f 'char_io.c' || echo '$(srcdir)/'`char_io.c - -pre_stage2_exec-char_io.obj: char_io.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-char_io.obj -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-char_io.Tpo" -c -o pre_stage2_exec-char_io.obj `if test -f 'char_io.c'; then $(CYGPATH_W) 'char_io.c'; else $(CYGPATH_W) '$(srcdir)/char_io.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-char_io.Tpo" "$(DEPDIR)/pre_stage2_exec-char_io.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-char_io.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='char_io.c' object='pre_stage2_exec-char_io.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/pre_stage2_exec-char_io.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-char_io.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-char_io.obj `if test -f 'char_io.c'; then $(CYGPATH_W) 'char_io.c'; else $(CYGPATH_W) '$(srcdir)/char_io.c'; fi` - -pre_stage2_exec-cmdline.o: cmdline.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-cmdline.o -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-cmdline.Tpo" -c -o pre_stage2_exec-cmdline.o `test -f 'cmdline.c' || echo '$(srcdir)/'`cmdline.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-cmdline.Tpo" "$(DEPDIR)/pre_stage2_exec-cmdline.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-cmdline.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cmdline.c' object='pre_stage2_exec-cmdline.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/pre_stage2_exec-cmdline.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-cmdline.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-cmdline.o `test -f 'cmdline.c' || echo '$(srcdir)/'`cmdline.c - -pre_stage2_exec-cmdline.obj: cmdline.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-cmdline.obj -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-cmdline.Tpo" -c -o pre_stage2_exec-cmdline.obj `if test -f 'cmdline.c'; then $(CYGPATH_W) 'cmdline.c'; else $(CYGPATH_W) '$(srcdir)/cmdline.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-cmdline.Tpo" "$(DEPDIR)/pre_stage2_exec-cmdline.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-cmdline.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cmdline.c' object='pre_stage2_exec-cmdline.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/pre_stage2_exec-cmdline.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-cmdline.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-cmdline.obj `if test -f 'cmdline.c'; then $(CYGPATH_W) 'cmdline.c'; else $(CYGPATH_W) '$(srcdir)/cmdline.c'; fi` - -pre_stage2_exec-common.o: common.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-common.o -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-common.Tpo" -c -o pre_stage2_exec-common.o `test -f 'common.c' || echo '$(srcdir)/'`common.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-common.Tpo" "$(DEPDIR)/pre_stage2_exec-common.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-common.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='common.c' object='pre_stage2_exec-common.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/pre_stage2_exec-common.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-common.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-common.o `test -f 'common.c' || echo '$(srcdir)/'`common.c - -pre_stage2_exec-common.obj: common.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-common.obj -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-common.Tpo" -c -o pre_stage2_exec-common.obj `if test -f 'common.c'; then $(CYGPATH_W) 'common.c'; else $(CYGPATH_W) '$(srcdir)/common.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-common.Tpo" "$(DEPDIR)/pre_stage2_exec-common.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-common.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='common.c' object='pre_stage2_exec-common.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/pre_stage2_exec-common.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-common.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-common.obj `if test -f 'common.c'; then $(CYGPATH_W) 'common.c'; else $(CYGPATH_W) '$(srcdir)/common.c'; fi` - -pre_stage2_exec-console.o: console.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-console.o -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-console.Tpo" -c -o pre_stage2_exec-console.o `test -f 'console.c' || echo '$(srcdir)/'`console.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-console.Tpo" "$(DEPDIR)/pre_stage2_exec-console.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-console.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='console.c' object='pre_stage2_exec-console.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/pre_stage2_exec-console.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-console.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-console.o `test -f 'console.c' || echo '$(srcdir)/'`console.c - -pre_stage2_exec-console.obj: console.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-console.obj -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-console.Tpo" -c -o pre_stage2_exec-console.obj `if test -f 'console.c'; then $(CYGPATH_W) 'console.c'; else $(CYGPATH_W) '$(srcdir)/console.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-console.Tpo" "$(DEPDIR)/pre_stage2_exec-console.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-console.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='console.c' object='pre_stage2_exec-console.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/pre_stage2_exec-console.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-console.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-console.obj `if test -f 'console.c'; then $(CYGPATH_W) 'console.c'; else $(CYGPATH_W) '$(srcdir)/console.c'; fi` - -pre_stage2_exec-disk_io.o: disk_io.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-disk_io.o -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-disk_io.Tpo" -c -o pre_stage2_exec-disk_io.o `test -f 'disk_io.c' || echo '$(srcdir)/'`disk_io.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-disk_io.Tpo" "$(DEPDIR)/pre_stage2_exec-disk_io.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-disk_io.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='disk_io.c' object='pre_stage2_exec-disk_io.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/pre_stage2_exec-disk_io.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-disk_io.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-disk_io.o `test -f 'disk_io.c' || echo '$(srcdir)/'`disk_io.c - -pre_stage2_exec-disk_io.obj: disk_io.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-disk_io.obj -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-disk_io.Tpo" -c -o pre_stage2_exec-disk_io.obj `if test -f 'disk_io.c'; then $(CYGPATH_W) 'disk_io.c'; else $(CYGPATH_W) '$(srcdir)/disk_io.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-disk_io.Tpo" "$(DEPDIR)/pre_stage2_exec-disk_io.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-disk_io.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='disk_io.c' object='pre_stage2_exec-disk_io.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/pre_stage2_exec-disk_io.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-disk_io.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-disk_io.obj `if test -f 'disk_io.c'; then $(CYGPATH_W) 'disk_io.c'; else $(CYGPATH_W) '$(srcdir)/disk_io.c'; fi` - -pre_stage2_exec-fsys_ext2fs.o: fsys_ext2fs.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-fsys_ext2fs.o -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-fsys_ext2fs.Tpo" -c -o pre_stage2_exec-fsys_ext2fs.o `test -f 'fsys_ext2fs.c' || echo '$(srcdir)/'`fsys_ext2fs.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-fsys_ext2fs.Tpo" "$(DEPDIR)/pre_stage2_exec-fsys_ext2fs.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-fsys_ext2fs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_ext2fs.c' object='pre_stage2_exec-fsys_ext2fs.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/pre_stage2_exec-fsys_ext2fs.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-fsys_ext2fs.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-fsys_ext2fs.o `test -f 'fsys_ext2fs.c' || echo '$(srcdir)/'`fsys_ext2fs.c - -pre_stage2_exec-fsys_ext2fs.obj: fsys_ext2fs.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-fsys_ext2fs.obj -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-fsys_ext2fs.Tpo" -c -o pre_stage2_exec-fsys_ext2fs.obj `if test -f 'fsys_ext2fs.c'; then $(CYGPATH_W) 'fsys_ext2fs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_ext2fs.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-fsys_ext2fs.Tpo" "$(DEPDIR)/pre_stage2_exec-fsys_ext2fs.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-fsys_ext2fs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_ext2fs.c' object='pre_stage2_exec-fsys_ext2fs.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/pre_stage2_exec-fsys_ext2fs.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-fsys_ext2fs.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-fsys_ext2fs.obj `if test -f 'fsys_ext2fs.c'; then $(CYGPATH_W) 'fsys_ext2fs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_ext2fs.c'; fi` - -pre_stage2_exec-fsys_fat.o: fsys_fat.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-fsys_fat.o -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-fsys_fat.Tpo" -c -o pre_stage2_exec-fsys_fat.o `test -f 'fsys_fat.c' || echo '$(srcdir)/'`fsys_fat.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-fsys_fat.Tpo" "$(DEPDIR)/pre_stage2_exec-fsys_fat.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-fsys_fat.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_fat.c' object='pre_stage2_exec-fsys_fat.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/pre_stage2_exec-fsys_fat.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-fsys_fat.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-fsys_fat.o `test -f 'fsys_fat.c' || echo '$(srcdir)/'`fsys_fat.c - -pre_stage2_exec-fsys_fat.obj: fsys_fat.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-fsys_fat.obj -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-fsys_fat.Tpo" -c -o pre_stage2_exec-fsys_fat.obj `if test -f 'fsys_fat.c'; then $(CYGPATH_W) 'fsys_fat.c'; else $(CYGPATH_W) '$(srcdir)/fsys_fat.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-fsys_fat.Tpo" "$(DEPDIR)/pre_stage2_exec-fsys_fat.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-fsys_fat.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_fat.c' object='pre_stage2_exec-fsys_fat.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/pre_stage2_exec-fsys_fat.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-fsys_fat.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-fsys_fat.obj `if test -f 'fsys_fat.c'; then $(CYGPATH_W) 'fsys_fat.c'; else $(CYGPATH_W) '$(srcdir)/fsys_fat.c'; fi` - -pre_stage2_exec-fsys_ffs.o: fsys_ffs.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-fsys_ffs.o -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-fsys_ffs.Tpo" -c -o pre_stage2_exec-fsys_ffs.o `test -f 'fsys_ffs.c' || echo '$(srcdir)/'`fsys_ffs.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-fsys_ffs.Tpo" "$(DEPDIR)/pre_stage2_exec-fsys_ffs.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-fsys_ffs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_ffs.c' object='pre_stage2_exec-fsys_ffs.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/pre_stage2_exec-fsys_ffs.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-fsys_ffs.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-fsys_ffs.o `test -f 'fsys_ffs.c' || echo '$(srcdir)/'`fsys_ffs.c - -pre_stage2_exec-fsys_ffs.obj: fsys_ffs.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-fsys_ffs.obj -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-fsys_ffs.Tpo" -c -o pre_stage2_exec-fsys_ffs.obj `if test -f 'fsys_ffs.c'; then $(CYGPATH_W) 'fsys_ffs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_ffs.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-fsys_ffs.Tpo" "$(DEPDIR)/pre_stage2_exec-fsys_ffs.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-fsys_ffs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_ffs.c' object='pre_stage2_exec-fsys_ffs.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/pre_stage2_exec-fsys_ffs.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-fsys_ffs.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-fsys_ffs.obj `if test -f 'fsys_ffs.c'; then $(CYGPATH_W) 'fsys_ffs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_ffs.c'; fi` - -pre_stage2_exec-fsys_iso9660.o: fsys_iso9660.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-fsys_iso9660.o -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-fsys_iso9660.Tpo" -c -o pre_stage2_exec-fsys_iso9660.o `test -f 'fsys_iso9660.c' || echo '$(srcdir)/'`fsys_iso9660.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-fsys_iso9660.Tpo" "$(DEPDIR)/pre_stage2_exec-fsys_iso9660.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-fsys_iso9660.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_iso9660.c' object='pre_stage2_exec-fsys_iso9660.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/pre_stage2_exec-fsys_iso9660.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-fsys_iso9660.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-fsys_iso9660.o `test -f 'fsys_iso9660.c' || echo '$(srcdir)/'`fsys_iso9660.c - -pre_stage2_exec-fsys_iso9660.obj: fsys_iso9660.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-fsys_iso9660.obj -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-fsys_iso9660.Tpo" -c -o pre_stage2_exec-fsys_iso9660.obj `if test -f 'fsys_iso9660.c'; then $(CYGPATH_W) 'fsys_iso9660.c'; else $(CYGPATH_W) '$(srcdir)/fsys_iso9660.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-fsys_iso9660.Tpo" "$(DEPDIR)/pre_stage2_exec-fsys_iso9660.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-fsys_iso9660.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_iso9660.c' object='pre_stage2_exec-fsys_iso9660.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/pre_stage2_exec-fsys_iso9660.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-fsys_iso9660.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-fsys_iso9660.obj `if test -f 'fsys_iso9660.c'; then $(CYGPATH_W) 'fsys_iso9660.c'; else $(CYGPATH_W) '$(srcdir)/fsys_iso9660.c'; fi` - -pre_stage2_exec-fsys_jfs.o: fsys_jfs.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-fsys_jfs.o -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-fsys_jfs.Tpo" -c -o pre_stage2_exec-fsys_jfs.o `test -f 'fsys_jfs.c' || echo '$(srcdir)/'`fsys_jfs.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-fsys_jfs.Tpo" "$(DEPDIR)/pre_stage2_exec-fsys_jfs.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-fsys_jfs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_jfs.c' object='pre_stage2_exec-fsys_jfs.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/pre_stage2_exec-fsys_jfs.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-fsys_jfs.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-fsys_jfs.o `test -f 'fsys_jfs.c' || echo '$(srcdir)/'`fsys_jfs.c - -pre_stage2_exec-fsys_jfs.obj: fsys_jfs.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-fsys_jfs.obj -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-fsys_jfs.Tpo" -c -o pre_stage2_exec-fsys_jfs.obj `if test -f 'fsys_jfs.c'; then $(CYGPATH_W) 'fsys_jfs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_jfs.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-fsys_jfs.Tpo" "$(DEPDIR)/pre_stage2_exec-fsys_jfs.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-fsys_jfs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_jfs.c' object='pre_stage2_exec-fsys_jfs.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/pre_stage2_exec-fsys_jfs.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-fsys_jfs.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-fsys_jfs.obj `if test -f 'fsys_jfs.c'; then $(CYGPATH_W) 'fsys_jfs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_jfs.c'; fi` - -pre_stage2_exec-fsys_minix.o: fsys_minix.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-fsys_minix.o -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-fsys_minix.Tpo" -c -o pre_stage2_exec-fsys_minix.o `test -f 'fsys_minix.c' || echo '$(srcdir)/'`fsys_minix.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-fsys_minix.Tpo" "$(DEPDIR)/pre_stage2_exec-fsys_minix.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-fsys_minix.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_minix.c' object='pre_stage2_exec-fsys_minix.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/pre_stage2_exec-fsys_minix.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-fsys_minix.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-fsys_minix.o `test -f 'fsys_minix.c' || echo '$(srcdir)/'`fsys_minix.c - -pre_stage2_exec-fsys_minix.obj: fsys_minix.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-fsys_minix.obj -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-fsys_minix.Tpo" -c -o pre_stage2_exec-fsys_minix.obj `if test -f 'fsys_minix.c'; then $(CYGPATH_W) 'fsys_minix.c'; else $(CYGPATH_W) '$(srcdir)/fsys_minix.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-fsys_minix.Tpo" "$(DEPDIR)/pre_stage2_exec-fsys_minix.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-fsys_minix.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_minix.c' object='pre_stage2_exec-fsys_minix.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/pre_stage2_exec-fsys_minix.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-fsys_minix.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-fsys_minix.obj `if test -f 'fsys_minix.c'; then $(CYGPATH_W) 'fsys_minix.c'; else $(CYGPATH_W) '$(srcdir)/fsys_minix.c'; fi` - -pre_stage2_exec-fsys_reiserfs.o: fsys_reiserfs.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-fsys_reiserfs.o -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-fsys_reiserfs.Tpo" -c -o pre_stage2_exec-fsys_reiserfs.o `test -f 'fsys_reiserfs.c' || echo '$(srcdir)/'`fsys_reiserfs.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-fsys_reiserfs.Tpo" "$(DEPDIR)/pre_stage2_exec-fsys_reiserfs.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-fsys_reiserfs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_reiserfs.c' object='pre_stage2_exec-fsys_reiserfs.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/pre_stage2_exec-fsys_reiserfs.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-fsys_reiserfs.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-fsys_reiserfs.o `test -f 'fsys_reiserfs.c' || echo '$(srcdir)/'`fsys_reiserfs.c - -pre_stage2_exec-fsys_reiserfs.obj: fsys_reiserfs.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-fsys_reiserfs.obj -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-fsys_reiserfs.Tpo" -c -o pre_stage2_exec-fsys_reiserfs.obj `if test -f 'fsys_reiserfs.c'; then $(CYGPATH_W) 'fsys_reiserfs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_reiserfs.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-fsys_reiserfs.Tpo" "$(DEPDIR)/pre_stage2_exec-fsys_reiserfs.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-fsys_reiserfs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_reiserfs.c' object='pre_stage2_exec-fsys_reiserfs.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/pre_stage2_exec-fsys_reiserfs.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-fsys_reiserfs.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-fsys_reiserfs.obj `if test -f 'fsys_reiserfs.c'; then $(CYGPATH_W) 'fsys_reiserfs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_reiserfs.c'; fi` - -pre_stage2_exec-zfs_sha256.o: zfs_sha256.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-zfs_sha256.o -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-zfs_sha256.Tpo" -c -o pre_stage2_exec-zfs_sha256.o `test -f 'zfs_sha256.c' || echo '$(srcdir)/'`zfs_sha256.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-zfs_sha256.Tpo" "$(DEPDIR)/pre_stage2_exec-zfs_sha256.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-zfs_sha256.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='zfs_sha256.c' object='pre_stage2_exec-zfs_sha256.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/pre_stage2_exec-zfs_sha256.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-zfs_sha256.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-zfs_sha256.o `test -f 'zfs_sha256.c' || echo '$(srcdir)/'`zfs_sha256.c - -pre_stage2_exec-zfs_sha256.obj: zfs_sha256.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-zfs_sha256.obj -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-zfs_sha256.Tpo" -c -o pre_stage2_exec-zfs_sha256.obj `if test -f 'zfs_sha256.c'; then $(CYGPATH_W) 'zfs_sha256.c'; else $(CYGPATH_W) '$(srcdir)/zfs_sha256.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-zfs_sha256.Tpo" "$(DEPDIR)/pre_stage2_exec-zfs_sha256.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-zfs_sha256.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='zfs_sha256.c' object='pre_stage2_exec-zfs_sha256.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/pre_stage2_exec-zfs_sha256.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-zfs_sha256.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-zfs_sha256.obj `if test -f 'zfs_sha256.c'; then $(CYGPATH_W) 'zfs_sha256.c'; else $(CYGPATH_W) '$(srcdir)/zfs_sha256.c'; fi` - -pre_stage2_exec-zfs_lzjb.o: zfs_lzjb.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-zfs_lzjb.o -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-zfs_lzjb.Tpo" -c -o pre_stage2_exec-zfs_lzjb.o `test -f 'zfs_lzjb.c' || echo '$(srcdir)/'`zfs_lzjb.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-zfs_lzjb.Tpo" "$(DEPDIR)/pre_stage2_exec-zfs_lzjb.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-zfs_lzjb.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='zfs_lzjb.c' object='pre_stage2_exec-zfs_lzjb.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/pre_stage2_exec-zfs_lzjb.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-zfs_lzjb.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-zfs_lzjb.o `test -f 'zfs_lzjb.c' || echo '$(srcdir)/'`zfs_lzjb.c - -pre_stage2_exec-zfs_lzjb.obj: zfs_lzjb.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-zfs_lzjb.obj -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-zfs_lzjb.Tpo" -c -o pre_stage2_exec-zfs_lzjb.obj `if test -f 'zfs_lzjb.c'; then $(CYGPATH_W) 'zfs_lzjb.c'; else $(CYGPATH_W) '$(srcdir)/zfs_lzjb.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-zfs_lzjb.Tpo" "$(DEPDIR)/pre_stage2_exec-zfs_lzjb.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-zfs_lzjb.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='zfs_lzjb.c' object='pre_stage2_exec-zfs_lzjb.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/pre_stage2_exec-zfs_lzjb.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-zfs_lzjb.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-zfs_lzjb.obj `if test -f 'zfs_lzjb.c'; then $(CYGPATH_W) 'zfs_lzjb.c'; else $(CYGPATH_W) '$(srcdir)/zfs_lzjb.c'; fi` - -pre_stage2_exec-zfs_fletcher.o: zfs_fletcher.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-zfs_fletcher.o -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-zfs_fletcher.Tpo" -c -o pre_stage2_exec-zfs_fletcher.o `test -f 'zfs_fletcher.c' || echo '$(srcdir)/'`zfs_fletcher.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-zfs_fletcher.Tpo" "$(DEPDIR)/pre_stage2_exec-zfs_fletcher.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-zfs_fletcher.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='zfs_fletcher.c' object='pre_stage2_exec-zfs_fletcher.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/pre_stage2_exec-zfs_fletcher.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-zfs_fletcher.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-zfs_fletcher.o `test -f 'zfs_fletcher.c' || echo '$(srcdir)/'`zfs_fletcher.c - -pre_stage2_exec-zfs_fletcher.obj: zfs_fletcher.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-zfs_fletcher.obj -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-zfs_fletcher.Tpo" -c -o pre_stage2_exec-zfs_fletcher.obj `if test -f 'zfs_fletcher.c'; then $(CYGPATH_W) 'zfs_fletcher.c'; else $(CYGPATH_W) '$(srcdir)/zfs_fletcher.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-zfs_fletcher.Tpo" "$(DEPDIR)/pre_stage2_exec-zfs_fletcher.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-zfs_fletcher.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='zfs_fletcher.c' object='pre_stage2_exec-zfs_fletcher.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/pre_stage2_exec-zfs_fletcher.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-zfs_fletcher.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-zfs_fletcher.obj `if test -f 'zfs_fletcher.c'; then $(CYGPATH_W) 'zfs_fletcher.c'; else $(CYGPATH_W) '$(srcdir)/zfs_fletcher.c'; fi` - -pre_stage2_exec-fsys_zfs.o: fsys_zfs.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-fsys_zfs.o -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-fsys_zfs.Tpo" -c -o pre_stage2_exec-fsys_zfs.o `test -f 'fsys_zfs.c' || echo '$(srcdir)/'`fsys_zfs.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-fsys_zfs.Tpo" "$(DEPDIR)/pre_stage2_exec-fsys_zfs.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-fsys_zfs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_zfs.c' object='pre_stage2_exec-fsys_zfs.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/pre_stage2_exec-fsys_zfs.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-fsys_zfs.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-fsys_zfs.o `test -f 'fsys_zfs.c' || echo '$(srcdir)/'`fsys_zfs.c - -pre_stage2_exec-fsys_zfs.obj: fsys_zfs.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-fsys_zfs.obj -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-fsys_zfs.Tpo" -c -o pre_stage2_exec-fsys_zfs.obj `if test -f 'fsys_zfs.c'; then $(CYGPATH_W) 'fsys_zfs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_zfs.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-fsys_zfs.Tpo" "$(DEPDIR)/pre_stage2_exec-fsys_zfs.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-fsys_zfs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_zfs.c' object='pre_stage2_exec-fsys_zfs.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/pre_stage2_exec-fsys_zfs.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-fsys_zfs.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-fsys_zfs.obj `if test -f 'fsys_zfs.c'; then $(CYGPATH_W) 'fsys_zfs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_zfs.c'; fi` - -pre_stage2_exec-fsys_ufs.o: fsys_ufs.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-fsys_ufs.o -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-fsys_ufs.Tpo" -c -o pre_stage2_exec-fsys_ufs.o `test -f 'fsys_ufs.c' || echo '$(srcdir)/'`fsys_ufs.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-fsys_ufs.Tpo" "$(DEPDIR)/pre_stage2_exec-fsys_ufs.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-fsys_ufs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_ufs.c' object='pre_stage2_exec-fsys_ufs.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/pre_stage2_exec-fsys_ufs.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-fsys_ufs.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-fsys_ufs.o `test -f 'fsys_ufs.c' || echo '$(srcdir)/'`fsys_ufs.c - -pre_stage2_exec-fsys_ufs.obj: fsys_ufs.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-fsys_ufs.obj -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-fsys_ufs.Tpo" -c -o pre_stage2_exec-fsys_ufs.obj `if test -f 'fsys_ufs.c'; then $(CYGPATH_W) 'fsys_ufs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_ufs.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-fsys_ufs.Tpo" "$(DEPDIR)/pre_stage2_exec-fsys_ufs.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-fsys_ufs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_ufs.c' object='pre_stage2_exec-fsys_ufs.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/pre_stage2_exec-fsys_ufs.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-fsys_ufs.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-fsys_ufs.obj `if test -f 'fsys_ufs.c'; then $(CYGPATH_W) 'fsys_ufs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_ufs.c'; fi` - -pre_stage2_exec-fsys_ufs2.o: fsys_ufs2.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-fsys_ufs2.o -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-fsys_ufs2.Tpo" -c -o pre_stage2_exec-fsys_ufs2.o `test -f 'fsys_ufs2.c' || echo '$(srcdir)/'`fsys_ufs2.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-fsys_ufs2.Tpo" "$(DEPDIR)/pre_stage2_exec-fsys_ufs2.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-fsys_ufs2.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_ufs2.c' object='pre_stage2_exec-fsys_ufs2.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/pre_stage2_exec-fsys_ufs2.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-fsys_ufs2.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-fsys_ufs2.o `test -f 'fsys_ufs2.c' || echo '$(srcdir)/'`fsys_ufs2.c - -pre_stage2_exec-fsys_ufs2.obj: fsys_ufs2.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-fsys_ufs2.obj -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-fsys_ufs2.Tpo" -c -o pre_stage2_exec-fsys_ufs2.obj `if test -f 'fsys_ufs2.c'; then $(CYGPATH_W) 'fsys_ufs2.c'; else $(CYGPATH_W) '$(srcdir)/fsys_ufs2.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-fsys_ufs2.Tpo" "$(DEPDIR)/pre_stage2_exec-fsys_ufs2.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-fsys_ufs2.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_ufs2.c' object='pre_stage2_exec-fsys_ufs2.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/pre_stage2_exec-fsys_ufs2.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-fsys_ufs2.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-fsys_ufs2.obj `if test -f 'fsys_ufs2.c'; then $(CYGPATH_W) 'fsys_ufs2.c'; else $(CYGPATH_W) '$(srcdir)/fsys_ufs2.c'; fi` - -pre_stage2_exec-fsys_vstafs.o: fsys_vstafs.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-fsys_vstafs.o -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-fsys_vstafs.Tpo" -c -o pre_stage2_exec-fsys_vstafs.o `test -f 'fsys_vstafs.c' || echo '$(srcdir)/'`fsys_vstafs.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-fsys_vstafs.Tpo" "$(DEPDIR)/pre_stage2_exec-fsys_vstafs.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-fsys_vstafs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_vstafs.c' object='pre_stage2_exec-fsys_vstafs.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/pre_stage2_exec-fsys_vstafs.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-fsys_vstafs.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-fsys_vstafs.o `test -f 'fsys_vstafs.c' || echo '$(srcdir)/'`fsys_vstafs.c - -pre_stage2_exec-fsys_vstafs.obj: fsys_vstafs.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-fsys_vstafs.obj -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-fsys_vstafs.Tpo" -c -o pre_stage2_exec-fsys_vstafs.obj `if test -f 'fsys_vstafs.c'; then $(CYGPATH_W) 'fsys_vstafs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_vstafs.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-fsys_vstafs.Tpo" "$(DEPDIR)/pre_stage2_exec-fsys_vstafs.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-fsys_vstafs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_vstafs.c' object='pre_stage2_exec-fsys_vstafs.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/pre_stage2_exec-fsys_vstafs.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-fsys_vstafs.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-fsys_vstafs.obj `if test -f 'fsys_vstafs.c'; then $(CYGPATH_W) 'fsys_vstafs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_vstafs.c'; fi` - -pre_stage2_exec-fsys_xfs.o: fsys_xfs.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-fsys_xfs.o -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-fsys_xfs.Tpo" -c -o pre_stage2_exec-fsys_xfs.o `test -f 'fsys_xfs.c' || echo '$(srcdir)/'`fsys_xfs.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-fsys_xfs.Tpo" "$(DEPDIR)/pre_stage2_exec-fsys_xfs.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-fsys_xfs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_xfs.c' object='pre_stage2_exec-fsys_xfs.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/pre_stage2_exec-fsys_xfs.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-fsys_xfs.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-fsys_xfs.o `test -f 'fsys_xfs.c' || echo '$(srcdir)/'`fsys_xfs.c - -pre_stage2_exec-fsys_xfs.obj: fsys_xfs.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-fsys_xfs.obj -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-fsys_xfs.Tpo" -c -o pre_stage2_exec-fsys_xfs.obj `if test -f 'fsys_xfs.c'; then $(CYGPATH_W) 'fsys_xfs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_xfs.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-fsys_xfs.Tpo" "$(DEPDIR)/pre_stage2_exec-fsys_xfs.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-fsys_xfs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_xfs.c' object='pre_stage2_exec-fsys_xfs.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/pre_stage2_exec-fsys_xfs.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-fsys_xfs.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-fsys_xfs.obj `if test -f 'fsys_xfs.c'; then $(CYGPATH_W) 'fsys_xfs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_xfs.c'; fi` - -pre_stage2_exec-gunzip.o: gunzip.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-gunzip.o -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-gunzip.Tpo" -c -o pre_stage2_exec-gunzip.o `test -f 'gunzip.c' || echo '$(srcdir)/'`gunzip.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-gunzip.Tpo" "$(DEPDIR)/pre_stage2_exec-gunzip.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-gunzip.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gunzip.c' object='pre_stage2_exec-gunzip.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/pre_stage2_exec-gunzip.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-gunzip.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-gunzip.o `test -f 'gunzip.c' || echo '$(srcdir)/'`gunzip.c - -pre_stage2_exec-gunzip.obj: gunzip.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-gunzip.obj -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-gunzip.Tpo" -c -o pre_stage2_exec-gunzip.obj `if test -f 'gunzip.c'; then $(CYGPATH_W) 'gunzip.c'; else $(CYGPATH_W) '$(srcdir)/gunzip.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-gunzip.Tpo" "$(DEPDIR)/pre_stage2_exec-gunzip.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-gunzip.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gunzip.c' object='pre_stage2_exec-gunzip.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/pre_stage2_exec-gunzip.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-gunzip.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-gunzip.obj `if test -f 'gunzip.c'; then $(CYGPATH_W) 'gunzip.c'; else $(CYGPATH_W) '$(srcdir)/gunzip.c'; fi` - -pre_stage2_exec-hercules.o: hercules.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-hercules.o -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-hercules.Tpo" -c -o pre_stage2_exec-hercules.o `test -f 'hercules.c' || echo '$(srcdir)/'`hercules.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-hercules.Tpo" "$(DEPDIR)/pre_stage2_exec-hercules.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-hercules.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='hercules.c' object='pre_stage2_exec-hercules.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/pre_stage2_exec-hercules.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-hercules.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-hercules.o `test -f 'hercules.c' || echo '$(srcdir)/'`hercules.c - -pre_stage2_exec-hercules.obj: hercules.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-hercules.obj -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-hercules.Tpo" -c -o pre_stage2_exec-hercules.obj `if test -f 'hercules.c'; then $(CYGPATH_W) 'hercules.c'; else $(CYGPATH_W) '$(srcdir)/hercules.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-hercules.Tpo" "$(DEPDIR)/pre_stage2_exec-hercules.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-hercules.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='hercules.c' object='pre_stage2_exec-hercules.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/pre_stage2_exec-hercules.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-hercules.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-hercules.obj `if test -f 'hercules.c'; then $(CYGPATH_W) 'hercules.c'; else $(CYGPATH_W) '$(srcdir)/hercules.c'; fi` - -pre_stage2_exec-md5.o: md5.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-md5.o -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-md5.Tpo" -c -o pre_stage2_exec-md5.o `test -f 'md5.c' || echo '$(srcdir)/'`md5.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-md5.Tpo" "$(DEPDIR)/pre_stage2_exec-md5.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-md5.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='md5.c' object='pre_stage2_exec-md5.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/pre_stage2_exec-md5.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-md5.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-md5.o `test -f 'md5.c' || echo '$(srcdir)/'`md5.c - -pre_stage2_exec-md5.obj: md5.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-md5.obj -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-md5.Tpo" -c -o pre_stage2_exec-md5.obj `if test -f 'md5.c'; then $(CYGPATH_W) 'md5.c'; else $(CYGPATH_W) '$(srcdir)/md5.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-md5.Tpo" "$(DEPDIR)/pre_stage2_exec-md5.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-md5.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='md5.c' object='pre_stage2_exec-md5.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/pre_stage2_exec-md5.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-md5.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-md5.obj `if test -f 'md5.c'; then $(CYGPATH_W) 'md5.c'; else $(CYGPATH_W) '$(srcdir)/md5.c'; fi` - -pre_stage2_exec-serial.o: serial.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-serial.o -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-serial.Tpo" -c -o pre_stage2_exec-serial.o `test -f 'serial.c' || echo '$(srcdir)/'`serial.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-serial.Tpo" "$(DEPDIR)/pre_stage2_exec-serial.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-serial.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='serial.c' object='pre_stage2_exec-serial.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/pre_stage2_exec-serial.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-serial.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-serial.o `test -f 'serial.c' || echo '$(srcdir)/'`serial.c - -pre_stage2_exec-serial.obj: serial.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-serial.obj -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-serial.Tpo" -c -o pre_stage2_exec-serial.obj `if test -f 'serial.c'; then $(CYGPATH_W) 'serial.c'; else $(CYGPATH_W) '$(srcdir)/serial.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-serial.Tpo" "$(DEPDIR)/pre_stage2_exec-serial.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-serial.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='serial.c' object='pre_stage2_exec-serial.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/pre_stage2_exec-serial.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-serial.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-serial.obj `if test -f 'serial.c'; then $(CYGPATH_W) 'serial.c'; else $(CYGPATH_W) '$(srcdir)/serial.c'; fi` - -pre_stage2_exec-smp-imps.o: smp-imps.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-smp-imps.o -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-smp-imps.Tpo" -c -o pre_stage2_exec-smp-imps.o `test -f 'smp-imps.c' || echo '$(srcdir)/'`smp-imps.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-smp-imps.Tpo" "$(DEPDIR)/pre_stage2_exec-smp-imps.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-smp-imps.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='smp-imps.c' object='pre_stage2_exec-smp-imps.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/pre_stage2_exec-smp-imps.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-smp-imps.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-smp-imps.o `test -f 'smp-imps.c' || echo '$(srcdir)/'`smp-imps.c - -pre_stage2_exec-smp-imps.obj: smp-imps.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-smp-imps.obj -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-smp-imps.Tpo" -c -o pre_stage2_exec-smp-imps.obj `if test -f 'smp-imps.c'; then $(CYGPATH_W) 'smp-imps.c'; else $(CYGPATH_W) '$(srcdir)/smp-imps.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-smp-imps.Tpo" "$(DEPDIR)/pre_stage2_exec-smp-imps.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-smp-imps.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='smp-imps.c' object='pre_stage2_exec-smp-imps.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/pre_stage2_exec-smp-imps.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-smp-imps.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-smp-imps.obj `if test -f 'smp-imps.c'; then $(CYGPATH_W) 'smp-imps.c'; else $(CYGPATH_W) '$(srcdir)/smp-imps.c'; fi` - -pre_stage2_exec-stage2.o: stage2.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-stage2.o -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-stage2.Tpo" -c -o pre_stage2_exec-stage2.o `test -f 'stage2.c' || echo '$(srcdir)/'`stage2.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-stage2.Tpo" "$(DEPDIR)/pre_stage2_exec-stage2.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-stage2.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='stage2.c' object='pre_stage2_exec-stage2.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/pre_stage2_exec-stage2.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-stage2.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-stage2.o `test -f 'stage2.c' || echo '$(srcdir)/'`stage2.c - -pre_stage2_exec-stage2.obj: stage2.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-stage2.obj -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-stage2.Tpo" -c -o pre_stage2_exec-stage2.obj `if test -f 'stage2.c'; then $(CYGPATH_W) 'stage2.c'; else $(CYGPATH_W) '$(srcdir)/stage2.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-stage2.Tpo" "$(DEPDIR)/pre_stage2_exec-stage2.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-stage2.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='stage2.c' object='pre_stage2_exec-stage2.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/pre_stage2_exec-stage2.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-stage2.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-stage2.obj `if test -f 'stage2.c'; then $(CYGPATH_W) 'stage2.c'; else $(CYGPATH_W) '$(srcdir)/stage2.c'; fi` - -pre_stage2_exec-terminfo.o: terminfo.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-terminfo.o -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-terminfo.Tpo" -c -o pre_stage2_exec-terminfo.o `test -f 'terminfo.c' || echo '$(srcdir)/'`terminfo.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-terminfo.Tpo" "$(DEPDIR)/pre_stage2_exec-terminfo.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-terminfo.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='terminfo.c' object='pre_stage2_exec-terminfo.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/pre_stage2_exec-terminfo.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-terminfo.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-terminfo.o `test -f 'terminfo.c' || echo '$(srcdir)/'`terminfo.c - -pre_stage2_exec-terminfo.obj: terminfo.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-terminfo.obj -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-terminfo.Tpo" -c -o pre_stage2_exec-terminfo.obj `if test -f 'terminfo.c'; then $(CYGPATH_W) 'terminfo.c'; else $(CYGPATH_W) '$(srcdir)/terminfo.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-terminfo.Tpo" "$(DEPDIR)/pre_stage2_exec-terminfo.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-terminfo.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='terminfo.c' object='pre_stage2_exec-terminfo.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/pre_stage2_exec-terminfo.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-terminfo.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-terminfo.obj `if test -f 'terminfo.c'; then $(CYGPATH_W) 'terminfo.c'; else $(CYGPATH_W) '$(srcdir)/terminfo.c'; fi` - -pre_stage2_exec-tparm.o: tparm.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-tparm.o -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-tparm.Tpo" -c -o pre_stage2_exec-tparm.o `test -f 'tparm.c' || echo '$(srcdir)/'`tparm.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-tparm.Tpo" "$(DEPDIR)/pre_stage2_exec-tparm.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-tparm.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tparm.c' object='pre_stage2_exec-tparm.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/pre_stage2_exec-tparm.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-tparm.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-tparm.o `test -f 'tparm.c' || echo '$(srcdir)/'`tparm.c - -pre_stage2_exec-tparm.obj: tparm.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-tparm.obj -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-tparm.Tpo" -c -o pre_stage2_exec-tparm.obj `if test -f 'tparm.c'; then $(CYGPATH_W) 'tparm.c'; else $(CYGPATH_W) '$(srcdir)/tparm.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-tparm.Tpo" "$(DEPDIR)/pre_stage2_exec-tparm.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-tparm.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tparm.c' object='pre_stage2_exec-tparm.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/pre_stage2_exec-tparm.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-tparm.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-tparm.obj `if test -f 'tparm.c'; then $(CYGPATH_W) 'tparm.c'; else $(CYGPATH_W) '$(srcdir)/tparm.c'; fi` - -pre_stage2_exec-graphics.o: graphics.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-graphics.o -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-graphics.Tpo" -c -o pre_stage2_exec-graphics.o `test -f 'graphics.c' || echo '$(srcdir)/'`graphics.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-graphics.Tpo" "$(DEPDIR)/pre_stage2_exec-graphics.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-graphics.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='graphics.c' object='pre_stage2_exec-graphics.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/pre_stage2_exec-graphics.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-graphics.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-graphics.o `test -f 'graphics.c' || echo '$(srcdir)/'`graphics.c - -pre_stage2_exec-graphics.obj: graphics.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-graphics.obj -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-graphics.Tpo" -c -o pre_stage2_exec-graphics.obj `if test -f 'graphics.c'; then $(CYGPATH_W) 'graphics.c'; else $(CYGPATH_W) '$(srcdir)/graphics.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-graphics.Tpo" "$(DEPDIR)/pre_stage2_exec-graphics.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-graphics.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='graphics.c' object='pre_stage2_exec-graphics.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/pre_stage2_exec-graphics.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-graphics.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-graphics.obj `if test -f 'graphics.c'; then $(CYGPATH_W) 'graphics.c'; else $(CYGPATH_W) '$(srcdir)/graphics.c'; fi` - -reiserfs_stage1_5_exec-common.o: common.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(reiserfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT reiserfs_stage1_5_exec-common.o -MD -MP -MF "$(DEPDIR)/reiserfs_stage1_5_exec-common.Tpo" -c -o reiserfs_stage1_5_exec-common.o `test -f 'common.c' || echo '$(srcdir)/'`common.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/reiserfs_stage1_5_exec-common.Tpo" "$(DEPDIR)/reiserfs_stage1_5_exec-common.Po"; else rm -f "$(DEPDIR)/reiserfs_stage1_5_exec-common.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='common.c' object='reiserfs_stage1_5_exec-common.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/reiserfs_stage1_5_exec-common.Po' tmpdepfile='$(DEPDIR)/reiserfs_stage1_5_exec-common.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(reiserfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o reiserfs_stage1_5_exec-common.o `test -f 'common.c' || echo '$(srcdir)/'`common.c - -reiserfs_stage1_5_exec-common.obj: common.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(reiserfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT reiserfs_stage1_5_exec-common.obj -MD -MP -MF "$(DEPDIR)/reiserfs_stage1_5_exec-common.Tpo" -c -o reiserfs_stage1_5_exec-common.obj `if test -f 'common.c'; then $(CYGPATH_W) 'common.c'; else $(CYGPATH_W) '$(srcdir)/common.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/reiserfs_stage1_5_exec-common.Tpo" "$(DEPDIR)/reiserfs_stage1_5_exec-common.Po"; else rm -f "$(DEPDIR)/reiserfs_stage1_5_exec-common.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='common.c' object='reiserfs_stage1_5_exec-common.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/reiserfs_stage1_5_exec-common.Po' tmpdepfile='$(DEPDIR)/reiserfs_stage1_5_exec-common.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(reiserfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o reiserfs_stage1_5_exec-common.obj `if test -f 'common.c'; then $(CYGPATH_W) 'common.c'; else $(CYGPATH_W) '$(srcdir)/common.c'; fi` - -reiserfs_stage1_5_exec-char_io.o: char_io.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(reiserfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT reiserfs_stage1_5_exec-char_io.o -MD -MP -MF "$(DEPDIR)/reiserfs_stage1_5_exec-char_io.Tpo" -c -o reiserfs_stage1_5_exec-char_io.o `test -f 'char_io.c' || echo '$(srcdir)/'`char_io.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/reiserfs_stage1_5_exec-char_io.Tpo" "$(DEPDIR)/reiserfs_stage1_5_exec-char_io.Po"; else rm -f "$(DEPDIR)/reiserfs_stage1_5_exec-char_io.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='char_io.c' object='reiserfs_stage1_5_exec-char_io.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/reiserfs_stage1_5_exec-char_io.Po' tmpdepfile='$(DEPDIR)/reiserfs_stage1_5_exec-char_io.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(reiserfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o reiserfs_stage1_5_exec-char_io.o `test -f 'char_io.c' || echo '$(srcdir)/'`char_io.c - -reiserfs_stage1_5_exec-char_io.obj: char_io.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(reiserfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT reiserfs_stage1_5_exec-char_io.obj -MD -MP -MF "$(DEPDIR)/reiserfs_stage1_5_exec-char_io.Tpo" -c -o reiserfs_stage1_5_exec-char_io.obj `if test -f 'char_io.c'; then $(CYGPATH_W) 'char_io.c'; else $(CYGPATH_W) '$(srcdir)/char_io.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/reiserfs_stage1_5_exec-char_io.Tpo" "$(DEPDIR)/reiserfs_stage1_5_exec-char_io.Po"; else rm -f "$(DEPDIR)/reiserfs_stage1_5_exec-char_io.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='char_io.c' object='reiserfs_stage1_5_exec-char_io.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/reiserfs_stage1_5_exec-char_io.Po' tmpdepfile='$(DEPDIR)/reiserfs_stage1_5_exec-char_io.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(reiserfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o reiserfs_stage1_5_exec-char_io.obj `if test -f 'char_io.c'; then $(CYGPATH_W) 'char_io.c'; else $(CYGPATH_W) '$(srcdir)/char_io.c'; fi` - -reiserfs_stage1_5_exec-disk_io.o: disk_io.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(reiserfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT reiserfs_stage1_5_exec-disk_io.o -MD -MP -MF "$(DEPDIR)/reiserfs_stage1_5_exec-disk_io.Tpo" -c -o reiserfs_stage1_5_exec-disk_io.o `test -f 'disk_io.c' || echo '$(srcdir)/'`disk_io.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/reiserfs_stage1_5_exec-disk_io.Tpo" "$(DEPDIR)/reiserfs_stage1_5_exec-disk_io.Po"; else rm -f "$(DEPDIR)/reiserfs_stage1_5_exec-disk_io.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='disk_io.c' object='reiserfs_stage1_5_exec-disk_io.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/reiserfs_stage1_5_exec-disk_io.Po' tmpdepfile='$(DEPDIR)/reiserfs_stage1_5_exec-disk_io.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(reiserfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o reiserfs_stage1_5_exec-disk_io.o `test -f 'disk_io.c' || echo '$(srcdir)/'`disk_io.c - -reiserfs_stage1_5_exec-disk_io.obj: disk_io.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(reiserfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT reiserfs_stage1_5_exec-disk_io.obj -MD -MP -MF "$(DEPDIR)/reiserfs_stage1_5_exec-disk_io.Tpo" -c -o reiserfs_stage1_5_exec-disk_io.obj `if test -f 'disk_io.c'; then $(CYGPATH_W) 'disk_io.c'; else $(CYGPATH_W) '$(srcdir)/disk_io.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/reiserfs_stage1_5_exec-disk_io.Tpo" "$(DEPDIR)/reiserfs_stage1_5_exec-disk_io.Po"; else rm -f "$(DEPDIR)/reiserfs_stage1_5_exec-disk_io.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='disk_io.c' object='reiserfs_stage1_5_exec-disk_io.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/reiserfs_stage1_5_exec-disk_io.Po' tmpdepfile='$(DEPDIR)/reiserfs_stage1_5_exec-disk_io.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(reiserfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o reiserfs_stage1_5_exec-disk_io.obj `if test -f 'disk_io.c'; then $(CYGPATH_W) 'disk_io.c'; else $(CYGPATH_W) '$(srcdir)/disk_io.c'; fi` - -reiserfs_stage1_5_exec-stage1_5.o: stage1_5.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(reiserfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT reiserfs_stage1_5_exec-stage1_5.o -MD -MP -MF "$(DEPDIR)/reiserfs_stage1_5_exec-stage1_5.Tpo" -c -o reiserfs_stage1_5_exec-stage1_5.o `test -f 'stage1_5.c' || echo '$(srcdir)/'`stage1_5.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/reiserfs_stage1_5_exec-stage1_5.Tpo" "$(DEPDIR)/reiserfs_stage1_5_exec-stage1_5.Po"; else rm -f "$(DEPDIR)/reiserfs_stage1_5_exec-stage1_5.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='stage1_5.c' object='reiserfs_stage1_5_exec-stage1_5.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/reiserfs_stage1_5_exec-stage1_5.Po' tmpdepfile='$(DEPDIR)/reiserfs_stage1_5_exec-stage1_5.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(reiserfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o reiserfs_stage1_5_exec-stage1_5.o `test -f 'stage1_5.c' || echo '$(srcdir)/'`stage1_5.c - -reiserfs_stage1_5_exec-stage1_5.obj: stage1_5.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(reiserfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT reiserfs_stage1_5_exec-stage1_5.obj -MD -MP -MF "$(DEPDIR)/reiserfs_stage1_5_exec-stage1_5.Tpo" -c -o reiserfs_stage1_5_exec-stage1_5.obj `if test -f 'stage1_5.c'; then $(CYGPATH_W) 'stage1_5.c'; else $(CYGPATH_W) '$(srcdir)/stage1_5.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/reiserfs_stage1_5_exec-stage1_5.Tpo" "$(DEPDIR)/reiserfs_stage1_5_exec-stage1_5.Po"; else rm -f "$(DEPDIR)/reiserfs_stage1_5_exec-stage1_5.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='stage1_5.c' object='reiserfs_stage1_5_exec-stage1_5.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/reiserfs_stage1_5_exec-stage1_5.Po' tmpdepfile='$(DEPDIR)/reiserfs_stage1_5_exec-stage1_5.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(reiserfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o reiserfs_stage1_5_exec-stage1_5.obj `if test -f 'stage1_5.c'; then $(CYGPATH_W) 'stage1_5.c'; else $(CYGPATH_W) '$(srcdir)/stage1_5.c'; fi` - -reiserfs_stage1_5_exec-fsys_reiserfs.o: fsys_reiserfs.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(reiserfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT reiserfs_stage1_5_exec-fsys_reiserfs.o -MD -MP -MF "$(DEPDIR)/reiserfs_stage1_5_exec-fsys_reiserfs.Tpo" -c -o reiserfs_stage1_5_exec-fsys_reiserfs.o `test -f 'fsys_reiserfs.c' || echo '$(srcdir)/'`fsys_reiserfs.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/reiserfs_stage1_5_exec-fsys_reiserfs.Tpo" "$(DEPDIR)/reiserfs_stage1_5_exec-fsys_reiserfs.Po"; else rm -f "$(DEPDIR)/reiserfs_stage1_5_exec-fsys_reiserfs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_reiserfs.c' object='reiserfs_stage1_5_exec-fsys_reiserfs.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/reiserfs_stage1_5_exec-fsys_reiserfs.Po' tmpdepfile='$(DEPDIR)/reiserfs_stage1_5_exec-fsys_reiserfs.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(reiserfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o reiserfs_stage1_5_exec-fsys_reiserfs.o `test -f 'fsys_reiserfs.c' || echo '$(srcdir)/'`fsys_reiserfs.c - -reiserfs_stage1_5_exec-fsys_reiserfs.obj: fsys_reiserfs.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(reiserfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT reiserfs_stage1_5_exec-fsys_reiserfs.obj -MD -MP -MF "$(DEPDIR)/reiserfs_stage1_5_exec-fsys_reiserfs.Tpo" -c -o reiserfs_stage1_5_exec-fsys_reiserfs.obj `if test -f 'fsys_reiserfs.c'; then $(CYGPATH_W) 'fsys_reiserfs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_reiserfs.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/reiserfs_stage1_5_exec-fsys_reiserfs.Tpo" "$(DEPDIR)/reiserfs_stage1_5_exec-fsys_reiserfs.Po"; else rm -f "$(DEPDIR)/reiserfs_stage1_5_exec-fsys_reiserfs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_reiserfs.c' object='reiserfs_stage1_5_exec-fsys_reiserfs.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/reiserfs_stage1_5_exec-fsys_reiserfs.Po' tmpdepfile='$(DEPDIR)/reiserfs_stage1_5_exec-fsys_reiserfs.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(reiserfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o reiserfs_stage1_5_exec-fsys_reiserfs.obj `if test -f 'fsys_reiserfs.c'; then $(CYGPATH_W) 'fsys_reiserfs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_reiserfs.c'; fi` - -reiserfs_stage1_5_exec-bios.o: bios.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(reiserfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT reiserfs_stage1_5_exec-bios.o -MD -MP -MF "$(DEPDIR)/reiserfs_stage1_5_exec-bios.Tpo" -c -o reiserfs_stage1_5_exec-bios.o `test -f 'bios.c' || echo '$(srcdir)/'`bios.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/reiserfs_stage1_5_exec-bios.Tpo" "$(DEPDIR)/reiserfs_stage1_5_exec-bios.Po"; else rm -f "$(DEPDIR)/reiserfs_stage1_5_exec-bios.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bios.c' object='reiserfs_stage1_5_exec-bios.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/reiserfs_stage1_5_exec-bios.Po' tmpdepfile='$(DEPDIR)/reiserfs_stage1_5_exec-bios.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(reiserfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o reiserfs_stage1_5_exec-bios.o `test -f 'bios.c' || echo '$(srcdir)/'`bios.c - -reiserfs_stage1_5_exec-bios.obj: bios.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(reiserfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT reiserfs_stage1_5_exec-bios.obj -MD -MP -MF "$(DEPDIR)/reiserfs_stage1_5_exec-bios.Tpo" -c -o reiserfs_stage1_5_exec-bios.obj `if test -f 'bios.c'; then $(CYGPATH_W) 'bios.c'; else $(CYGPATH_W) '$(srcdir)/bios.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/reiserfs_stage1_5_exec-bios.Tpo" "$(DEPDIR)/reiserfs_stage1_5_exec-bios.Po"; else rm -f "$(DEPDIR)/reiserfs_stage1_5_exec-bios.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bios.c' object='reiserfs_stage1_5_exec-bios.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/reiserfs_stage1_5_exec-bios.Po' tmpdepfile='$(DEPDIR)/reiserfs_stage1_5_exec-bios.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(reiserfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o reiserfs_stage1_5_exec-bios.obj `if test -f 'bios.c'; then $(CYGPATH_W) 'bios.c'; else $(CYGPATH_W) '$(srcdir)/bios.c'; fi` - -ufs2_stage1_5_exec-common.o: common.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs2_stage1_5_exec_CFLAGS) $(CFLAGS) -MT ufs2_stage1_5_exec-common.o -MD -MP -MF "$(DEPDIR)/ufs2_stage1_5_exec-common.Tpo" -c -o ufs2_stage1_5_exec-common.o `test -f 'common.c' || echo '$(srcdir)/'`common.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ufs2_stage1_5_exec-common.Tpo" "$(DEPDIR)/ufs2_stage1_5_exec-common.Po"; else rm -f "$(DEPDIR)/ufs2_stage1_5_exec-common.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='common.c' object='ufs2_stage1_5_exec-common.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/ufs2_stage1_5_exec-common.Po' tmpdepfile='$(DEPDIR)/ufs2_stage1_5_exec-common.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs2_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ufs2_stage1_5_exec-common.o `test -f 'common.c' || echo '$(srcdir)/'`common.c - -ufs2_stage1_5_exec-common.obj: common.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs2_stage1_5_exec_CFLAGS) $(CFLAGS) -MT ufs2_stage1_5_exec-common.obj -MD -MP -MF "$(DEPDIR)/ufs2_stage1_5_exec-common.Tpo" -c -o ufs2_stage1_5_exec-common.obj `if test -f 'common.c'; then $(CYGPATH_W) 'common.c'; else $(CYGPATH_W) '$(srcdir)/common.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ufs2_stage1_5_exec-common.Tpo" "$(DEPDIR)/ufs2_stage1_5_exec-common.Po"; else rm -f "$(DEPDIR)/ufs2_stage1_5_exec-common.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='common.c' object='ufs2_stage1_5_exec-common.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/ufs2_stage1_5_exec-common.Po' tmpdepfile='$(DEPDIR)/ufs2_stage1_5_exec-common.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs2_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ufs2_stage1_5_exec-common.obj `if test -f 'common.c'; then $(CYGPATH_W) 'common.c'; else $(CYGPATH_W) '$(srcdir)/common.c'; fi` - -ufs2_stage1_5_exec-char_io.o: char_io.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs2_stage1_5_exec_CFLAGS) $(CFLAGS) -MT ufs2_stage1_5_exec-char_io.o -MD -MP -MF "$(DEPDIR)/ufs2_stage1_5_exec-char_io.Tpo" -c -o ufs2_stage1_5_exec-char_io.o `test -f 'char_io.c' || echo '$(srcdir)/'`char_io.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ufs2_stage1_5_exec-char_io.Tpo" "$(DEPDIR)/ufs2_stage1_5_exec-char_io.Po"; else rm -f "$(DEPDIR)/ufs2_stage1_5_exec-char_io.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='char_io.c' object='ufs2_stage1_5_exec-char_io.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/ufs2_stage1_5_exec-char_io.Po' tmpdepfile='$(DEPDIR)/ufs2_stage1_5_exec-char_io.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs2_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ufs2_stage1_5_exec-char_io.o `test -f 'char_io.c' || echo '$(srcdir)/'`char_io.c - -ufs2_stage1_5_exec-char_io.obj: char_io.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs2_stage1_5_exec_CFLAGS) $(CFLAGS) -MT ufs2_stage1_5_exec-char_io.obj -MD -MP -MF "$(DEPDIR)/ufs2_stage1_5_exec-char_io.Tpo" -c -o ufs2_stage1_5_exec-char_io.obj `if test -f 'char_io.c'; then $(CYGPATH_W) 'char_io.c'; else $(CYGPATH_W) '$(srcdir)/char_io.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ufs2_stage1_5_exec-char_io.Tpo" "$(DEPDIR)/ufs2_stage1_5_exec-char_io.Po"; else rm -f "$(DEPDIR)/ufs2_stage1_5_exec-char_io.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='char_io.c' object='ufs2_stage1_5_exec-char_io.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/ufs2_stage1_5_exec-char_io.Po' tmpdepfile='$(DEPDIR)/ufs2_stage1_5_exec-char_io.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs2_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ufs2_stage1_5_exec-char_io.obj `if test -f 'char_io.c'; then $(CYGPATH_W) 'char_io.c'; else $(CYGPATH_W) '$(srcdir)/char_io.c'; fi` - -ufs2_stage1_5_exec-disk_io.o: disk_io.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs2_stage1_5_exec_CFLAGS) $(CFLAGS) -MT ufs2_stage1_5_exec-disk_io.o -MD -MP -MF "$(DEPDIR)/ufs2_stage1_5_exec-disk_io.Tpo" -c -o ufs2_stage1_5_exec-disk_io.o `test -f 'disk_io.c' || echo '$(srcdir)/'`disk_io.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ufs2_stage1_5_exec-disk_io.Tpo" "$(DEPDIR)/ufs2_stage1_5_exec-disk_io.Po"; else rm -f "$(DEPDIR)/ufs2_stage1_5_exec-disk_io.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='disk_io.c' object='ufs2_stage1_5_exec-disk_io.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/ufs2_stage1_5_exec-disk_io.Po' tmpdepfile='$(DEPDIR)/ufs2_stage1_5_exec-disk_io.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs2_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ufs2_stage1_5_exec-disk_io.o `test -f 'disk_io.c' || echo '$(srcdir)/'`disk_io.c - -ufs2_stage1_5_exec-disk_io.obj: disk_io.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs2_stage1_5_exec_CFLAGS) $(CFLAGS) -MT ufs2_stage1_5_exec-disk_io.obj -MD -MP -MF "$(DEPDIR)/ufs2_stage1_5_exec-disk_io.Tpo" -c -o ufs2_stage1_5_exec-disk_io.obj `if test -f 'disk_io.c'; then $(CYGPATH_W) 'disk_io.c'; else $(CYGPATH_W) '$(srcdir)/disk_io.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ufs2_stage1_5_exec-disk_io.Tpo" "$(DEPDIR)/ufs2_stage1_5_exec-disk_io.Po"; else rm -f "$(DEPDIR)/ufs2_stage1_5_exec-disk_io.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='disk_io.c' object='ufs2_stage1_5_exec-disk_io.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/ufs2_stage1_5_exec-disk_io.Po' tmpdepfile='$(DEPDIR)/ufs2_stage1_5_exec-disk_io.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs2_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ufs2_stage1_5_exec-disk_io.obj `if test -f 'disk_io.c'; then $(CYGPATH_W) 'disk_io.c'; else $(CYGPATH_W) '$(srcdir)/disk_io.c'; fi` - -ufs2_stage1_5_exec-stage1_5.o: stage1_5.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs2_stage1_5_exec_CFLAGS) $(CFLAGS) -MT ufs2_stage1_5_exec-stage1_5.o -MD -MP -MF "$(DEPDIR)/ufs2_stage1_5_exec-stage1_5.Tpo" -c -o ufs2_stage1_5_exec-stage1_5.o `test -f 'stage1_5.c' || echo '$(srcdir)/'`stage1_5.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ufs2_stage1_5_exec-stage1_5.Tpo" "$(DEPDIR)/ufs2_stage1_5_exec-stage1_5.Po"; else rm -f "$(DEPDIR)/ufs2_stage1_5_exec-stage1_5.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='stage1_5.c' object='ufs2_stage1_5_exec-stage1_5.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/ufs2_stage1_5_exec-stage1_5.Po' tmpdepfile='$(DEPDIR)/ufs2_stage1_5_exec-stage1_5.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs2_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ufs2_stage1_5_exec-stage1_5.o `test -f 'stage1_5.c' || echo '$(srcdir)/'`stage1_5.c - -ufs2_stage1_5_exec-stage1_5.obj: stage1_5.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs2_stage1_5_exec_CFLAGS) $(CFLAGS) -MT ufs2_stage1_5_exec-stage1_5.obj -MD -MP -MF "$(DEPDIR)/ufs2_stage1_5_exec-stage1_5.Tpo" -c -o ufs2_stage1_5_exec-stage1_5.obj `if test -f 'stage1_5.c'; then $(CYGPATH_W) 'stage1_5.c'; else $(CYGPATH_W) '$(srcdir)/stage1_5.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ufs2_stage1_5_exec-stage1_5.Tpo" "$(DEPDIR)/ufs2_stage1_5_exec-stage1_5.Po"; else rm -f "$(DEPDIR)/ufs2_stage1_5_exec-stage1_5.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='stage1_5.c' object='ufs2_stage1_5_exec-stage1_5.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/ufs2_stage1_5_exec-stage1_5.Po' tmpdepfile='$(DEPDIR)/ufs2_stage1_5_exec-stage1_5.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs2_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ufs2_stage1_5_exec-stage1_5.obj `if test -f 'stage1_5.c'; then $(CYGPATH_W) 'stage1_5.c'; else $(CYGPATH_W) '$(srcdir)/stage1_5.c'; fi` - -ufs2_stage1_5_exec-fsys_ufs2.o: fsys_ufs2.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs2_stage1_5_exec_CFLAGS) $(CFLAGS) -MT ufs2_stage1_5_exec-fsys_ufs2.o -MD -MP -MF "$(DEPDIR)/ufs2_stage1_5_exec-fsys_ufs2.Tpo" -c -o ufs2_stage1_5_exec-fsys_ufs2.o `test -f 'fsys_ufs2.c' || echo '$(srcdir)/'`fsys_ufs2.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ufs2_stage1_5_exec-fsys_ufs2.Tpo" "$(DEPDIR)/ufs2_stage1_5_exec-fsys_ufs2.Po"; else rm -f "$(DEPDIR)/ufs2_stage1_5_exec-fsys_ufs2.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_ufs2.c' object='ufs2_stage1_5_exec-fsys_ufs2.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/ufs2_stage1_5_exec-fsys_ufs2.Po' tmpdepfile='$(DEPDIR)/ufs2_stage1_5_exec-fsys_ufs2.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs2_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ufs2_stage1_5_exec-fsys_ufs2.o `test -f 'fsys_ufs2.c' || echo '$(srcdir)/'`fsys_ufs2.c - -ufs2_stage1_5_exec-fsys_ufs2.obj: fsys_ufs2.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs2_stage1_5_exec_CFLAGS) $(CFLAGS) -MT ufs2_stage1_5_exec-fsys_ufs2.obj -MD -MP -MF "$(DEPDIR)/ufs2_stage1_5_exec-fsys_ufs2.Tpo" -c -o ufs2_stage1_5_exec-fsys_ufs2.obj `if test -f 'fsys_ufs2.c'; then $(CYGPATH_W) 'fsys_ufs2.c'; else $(CYGPATH_W) '$(srcdir)/fsys_ufs2.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ufs2_stage1_5_exec-fsys_ufs2.Tpo" "$(DEPDIR)/ufs2_stage1_5_exec-fsys_ufs2.Po"; else rm -f "$(DEPDIR)/ufs2_stage1_5_exec-fsys_ufs2.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_ufs2.c' object='ufs2_stage1_5_exec-fsys_ufs2.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/ufs2_stage1_5_exec-fsys_ufs2.Po' tmpdepfile='$(DEPDIR)/ufs2_stage1_5_exec-fsys_ufs2.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs2_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ufs2_stage1_5_exec-fsys_ufs2.obj `if test -f 'fsys_ufs2.c'; then $(CYGPATH_W) 'fsys_ufs2.c'; else $(CYGPATH_W) '$(srcdir)/fsys_ufs2.c'; fi` - -ufs2_stage1_5_exec-bios.o: bios.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs2_stage1_5_exec_CFLAGS) $(CFLAGS) -MT ufs2_stage1_5_exec-bios.o -MD -MP -MF "$(DEPDIR)/ufs2_stage1_5_exec-bios.Tpo" -c -o ufs2_stage1_5_exec-bios.o `test -f 'bios.c' || echo '$(srcdir)/'`bios.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ufs2_stage1_5_exec-bios.Tpo" "$(DEPDIR)/ufs2_stage1_5_exec-bios.Po"; else rm -f "$(DEPDIR)/ufs2_stage1_5_exec-bios.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bios.c' object='ufs2_stage1_5_exec-bios.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/ufs2_stage1_5_exec-bios.Po' tmpdepfile='$(DEPDIR)/ufs2_stage1_5_exec-bios.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs2_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ufs2_stage1_5_exec-bios.o `test -f 'bios.c' || echo '$(srcdir)/'`bios.c - -ufs2_stage1_5_exec-bios.obj: bios.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs2_stage1_5_exec_CFLAGS) $(CFLAGS) -MT ufs2_stage1_5_exec-bios.obj -MD -MP -MF "$(DEPDIR)/ufs2_stage1_5_exec-bios.Tpo" -c -o ufs2_stage1_5_exec-bios.obj `if test -f 'bios.c'; then $(CYGPATH_W) 'bios.c'; else $(CYGPATH_W) '$(srcdir)/bios.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ufs2_stage1_5_exec-bios.Tpo" "$(DEPDIR)/ufs2_stage1_5_exec-bios.Po"; else rm -f "$(DEPDIR)/ufs2_stage1_5_exec-bios.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bios.c' object='ufs2_stage1_5_exec-bios.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/ufs2_stage1_5_exec-bios.Po' tmpdepfile='$(DEPDIR)/ufs2_stage1_5_exec-bios.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs2_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ufs2_stage1_5_exec-bios.obj `if test -f 'bios.c'; then $(CYGPATH_W) 'bios.c'; else $(CYGPATH_W) '$(srcdir)/bios.c'; fi` - -ufs_stage1_5_exec-common.o: common.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT ufs_stage1_5_exec-common.o -MD -MP -MF "$(DEPDIR)/ufs_stage1_5_exec-common.Tpo" -c -o ufs_stage1_5_exec-common.o `test -f 'common.c' || echo '$(srcdir)/'`common.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ufs_stage1_5_exec-common.Tpo" "$(DEPDIR)/ufs_stage1_5_exec-common.Po"; else rm -f "$(DEPDIR)/ufs_stage1_5_exec-common.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='common.c' object='ufs_stage1_5_exec-common.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/ufs_stage1_5_exec-common.Po' tmpdepfile='$(DEPDIR)/ufs_stage1_5_exec-common.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ufs_stage1_5_exec-common.o `test -f 'common.c' || echo '$(srcdir)/'`common.c - -ufs_stage1_5_exec-common.obj: common.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT ufs_stage1_5_exec-common.obj -MD -MP -MF "$(DEPDIR)/ufs_stage1_5_exec-common.Tpo" -c -o ufs_stage1_5_exec-common.obj `if test -f 'common.c'; then $(CYGPATH_W) 'common.c'; else $(CYGPATH_W) '$(srcdir)/common.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ufs_stage1_5_exec-common.Tpo" "$(DEPDIR)/ufs_stage1_5_exec-common.Po"; else rm -f "$(DEPDIR)/ufs_stage1_5_exec-common.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='common.c' object='ufs_stage1_5_exec-common.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/ufs_stage1_5_exec-common.Po' tmpdepfile='$(DEPDIR)/ufs_stage1_5_exec-common.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ufs_stage1_5_exec-common.obj `if test -f 'common.c'; then $(CYGPATH_W) 'common.c'; else $(CYGPATH_W) '$(srcdir)/common.c'; fi` - -ufs_stage1_5_exec-char_io.o: char_io.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT ufs_stage1_5_exec-char_io.o -MD -MP -MF "$(DEPDIR)/ufs_stage1_5_exec-char_io.Tpo" -c -o ufs_stage1_5_exec-char_io.o `test -f 'char_io.c' || echo '$(srcdir)/'`char_io.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ufs_stage1_5_exec-char_io.Tpo" "$(DEPDIR)/ufs_stage1_5_exec-char_io.Po"; else rm -f "$(DEPDIR)/ufs_stage1_5_exec-char_io.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='char_io.c' object='ufs_stage1_5_exec-char_io.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/ufs_stage1_5_exec-char_io.Po' tmpdepfile='$(DEPDIR)/ufs_stage1_5_exec-char_io.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ufs_stage1_5_exec-char_io.o `test -f 'char_io.c' || echo '$(srcdir)/'`char_io.c - -ufs_stage1_5_exec-char_io.obj: char_io.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT ufs_stage1_5_exec-char_io.obj -MD -MP -MF "$(DEPDIR)/ufs_stage1_5_exec-char_io.Tpo" -c -o ufs_stage1_5_exec-char_io.obj `if test -f 'char_io.c'; then $(CYGPATH_W) 'char_io.c'; else $(CYGPATH_W) '$(srcdir)/char_io.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ufs_stage1_5_exec-char_io.Tpo" "$(DEPDIR)/ufs_stage1_5_exec-char_io.Po"; else rm -f "$(DEPDIR)/ufs_stage1_5_exec-char_io.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='char_io.c' object='ufs_stage1_5_exec-char_io.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/ufs_stage1_5_exec-char_io.Po' tmpdepfile='$(DEPDIR)/ufs_stage1_5_exec-char_io.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ufs_stage1_5_exec-char_io.obj `if test -f 'char_io.c'; then $(CYGPATH_W) 'char_io.c'; else $(CYGPATH_W) '$(srcdir)/char_io.c'; fi` - -ufs_stage1_5_exec-disk_io.o: disk_io.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT ufs_stage1_5_exec-disk_io.o -MD -MP -MF "$(DEPDIR)/ufs_stage1_5_exec-disk_io.Tpo" -c -o ufs_stage1_5_exec-disk_io.o `test -f 'disk_io.c' || echo '$(srcdir)/'`disk_io.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ufs_stage1_5_exec-disk_io.Tpo" "$(DEPDIR)/ufs_stage1_5_exec-disk_io.Po"; else rm -f "$(DEPDIR)/ufs_stage1_5_exec-disk_io.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='disk_io.c' object='ufs_stage1_5_exec-disk_io.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/ufs_stage1_5_exec-disk_io.Po' tmpdepfile='$(DEPDIR)/ufs_stage1_5_exec-disk_io.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ufs_stage1_5_exec-disk_io.o `test -f 'disk_io.c' || echo '$(srcdir)/'`disk_io.c - -ufs_stage1_5_exec-disk_io.obj: disk_io.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT ufs_stage1_5_exec-disk_io.obj -MD -MP -MF "$(DEPDIR)/ufs_stage1_5_exec-disk_io.Tpo" -c -o ufs_stage1_5_exec-disk_io.obj `if test -f 'disk_io.c'; then $(CYGPATH_W) 'disk_io.c'; else $(CYGPATH_W) '$(srcdir)/disk_io.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ufs_stage1_5_exec-disk_io.Tpo" "$(DEPDIR)/ufs_stage1_5_exec-disk_io.Po"; else rm -f "$(DEPDIR)/ufs_stage1_5_exec-disk_io.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='disk_io.c' object='ufs_stage1_5_exec-disk_io.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/ufs_stage1_5_exec-disk_io.Po' tmpdepfile='$(DEPDIR)/ufs_stage1_5_exec-disk_io.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ufs_stage1_5_exec-disk_io.obj `if test -f 'disk_io.c'; then $(CYGPATH_W) 'disk_io.c'; else $(CYGPATH_W) '$(srcdir)/disk_io.c'; fi` - -ufs_stage1_5_exec-stage1_5.o: stage1_5.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT ufs_stage1_5_exec-stage1_5.o -MD -MP -MF "$(DEPDIR)/ufs_stage1_5_exec-stage1_5.Tpo" -c -o ufs_stage1_5_exec-stage1_5.o `test -f 'stage1_5.c' || echo '$(srcdir)/'`stage1_5.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ufs_stage1_5_exec-stage1_5.Tpo" "$(DEPDIR)/ufs_stage1_5_exec-stage1_5.Po"; else rm -f "$(DEPDIR)/ufs_stage1_5_exec-stage1_5.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='stage1_5.c' object='ufs_stage1_5_exec-stage1_5.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/ufs_stage1_5_exec-stage1_5.Po' tmpdepfile='$(DEPDIR)/ufs_stage1_5_exec-stage1_5.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ufs_stage1_5_exec-stage1_5.o `test -f 'stage1_5.c' || echo '$(srcdir)/'`stage1_5.c - -ufs_stage1_5_exec-stage1_5.obj: stage1_5.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT ufs_stage1_5_exec-stage1_5.obj -MD -MP -MF "$(DEPDIR)/ufs_stage1_5_exec-stage1_5.Tpo" -c -o ufs_stage1_5_exec-stage1_5.obj `if test -f 'stage1_5.c'; then $(CYGPATH_W) 'stage1_5.c'; else $(CYGPATH_W) '$(srcdir)/stage1_5.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ufs_stage1_5_exec-stage1_5.Tpo" "$(DEPDIR)/ufs_stage1_5_exec-stage1_5.Po"; else rm -f "$(DEPDIR)/ufs_stage1_5_exec-stage1_5.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='stage1_5.c' object='ufs_stage1_5_exec-stage1_5.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/ufs_stage1_5_exec-stage1_5.Po' tmpdepfile='$(DEPDIR)/ufs_stage1_5_exec-stage1_5.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ufs_stage1_5_exec-stage1_5.obj `if test -f 'stage1_5.c'; then $(CYGPATH_W) 'stage1_5.c'; else $(CYGPATH_W) '$(srcdir)/stage1_5.c'; fi` - -ufs_stage1_5_exec-fsys_ufs.o: fsys_ufs.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT ufs_stage1_5_exec-fsys_ufs.o -MD -MP -MF "$(DEPDIR)/ufs_stage1_5_exec-fsys_ufs.Tpo" -c -o ufs_stage1_5_exec-fsys_ufs.o `test -f 'fsys_ufs.c' || echo '$(srcdir)/'`fsys_ufs.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ufs_stage1_5_exec-fsys_ufs.Tpo" "$(DEPDIR)/ufs_stage1_5_exec-fsys_ufs.Po"; else rm -f "$(DEPDIR)/ufs_stage1_5_exec-fsys_ufs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_ufs.c' object='ufs_stage1_5_exec-fsys_ufs.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/ufs_stage1_5_exec-fsys_ufs.Po' tmpdepfile='$(DEPDIR)/ufs_stage1_5_exec-fsys_ufs.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ufs_stage1_5_exec-fsys_ufs.o `test -f 'fsys_ufs.c' || echo '$(srcdir)/'`fsys_ufs.c - -ufs_stage1_5_exec-fsys_ufs.obj: fsys_ufs.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT ufs_stage1_5_exec-fsys_ufs.obj -MD -MP -MF "$(DEPDIR)/ufs_stage1_5_exec-fsys_ufs.Tpo" -c -o ufs_stage1_5_exec-fsys_ufs.obj `if test -f 'fsys_ufs.c'; then $(CYGPATH_W) 'fsys_ufs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_ufs.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ufs_stage1_5_exec-fsys_ufs.Tpo" "$(DEPDIR)/ufs_stage1_5_exec-fsys_ufs.Po"; else rm -f "$(DEPDIR)/ufs_stage1_5_exec-fsys_ufs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_ufs.c' object='ufs_stage1_5_exec-fsys_ufs.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/ufs_stage1_5_exec-fsys_ufs.Po' tmpdepfile='$(DEPDIR)/ufs_stage1_5_exec-fsys_ufs.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ufs_stage1_5_exec-fsys_ufs.obj `if test -f 'fsys_ufs.c'; then $(CYGPATH_W) 'fsys_ufs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_ufs.c'; fi` - -ufs_stage1_5_exec-bios.o: bios.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT ufs_stage1_5_exec-bios.o -MD -MP -MF "$(DEPDIR)/ufs_stage1_5_exec-bios.Tpo" -c -o ufs_stage1_5_exec-bios.o `test -f 'bios.c' || echo '$(srcdir)/'`bios.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ufs_stage1_5_exec-bios.Tpo" "$(DEPDIR)/ufs_stage1_5_exec-bios.Po"; else rm -f "$(DEPDIR)/ufs_stage1_5_exec-bios.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bios.c' object='ufs_stage1_5_exec-bios.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/ufs_stage1_5_exec-bios.Po' tmpdepfile='$(DEPDIR)/ufs_stage1_5_exec-bios.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ufs_stage1_5_exec-bios.o `test -f 'bios.c' || echo '$(srcdir)/'`bios.c - -ufs_stage1_5_exec-bios.obj: bios.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT ufs_stage1_5_exec-bios.obj -MD -MP -MF "$(DEPDIR)/ufs_stage1_5_exec-bios.Tpo" -c -o ufs_stage1_5_exec-bios.obj `if test -f 'bios.c'; then $(CYGPATH_W) 'bios.c'; else $(CYGPATH_W) '$(srcdir)/bios.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ufs_stage1_5_exec-bios.Tpo" "$(DEPDIR)/ufs_stage1_5_exec-bios.Po"; else rm -f "$(DEPDIR)/ufs_stage1_5_exec-bios.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bios.c' object='ufs_stage1_5_exec-bios.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/ufs_stage1_5_exec-bios.Po' tmpdepfile='$(DEPDIR)/ufs_stage1_5_exec-bios.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ufs_stage1_5_exec-bios.obj `if test -f 'bios.c'; then $(CYGPATH_W) 'bios.c'; else $(CYGPATH_W) '$(srcdir)/bios.c'; fi` - -zfs_stage1_5_exec-common.o: common.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT zfs_stage1_5_exec-common.o -MD -MP -MF "$(DEPDIR)/zfs_stage1_5_exec-common.Tpo" -c -o zfs_stage1_5_exec-common.o `test -f 'common.c' || echo '$(srcdir)/'`common.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/zfs_stage1_5_exec-common.Tpo" "$(DEPDIR)/zfs_stage1_5_exec-common.Po"; else rm -f "$(DEPDIR)/zfs_stage1_5_exec-common.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='common.c' object='zfs_stage1_5_exec-common.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/zfs_stage1_5_exec-common.Po' tmpdepfile='$(DEPDIR)/zfs_stage1_5_exec-common.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o zfs_stage1_5_exec-common.o `test -f 'common.c' || echo '$(srcdir)/'`common.c - -zfs_stage1_5_exec-common.obj: common.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT zfs_stage1_5_exec-common.obj -MD -MP -MF "$(DEPDIR)/zfs_stage1_5_exec-common.Tpo" -c -o zfs_stage1_5_exec-common.obj `if test -f 'common.c'; then $(CYGPATH_W) 'common.c'; else $(CYGPATH_W) '$(srcdir)/common.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/zfs_stage1_5_exec-common.Tpo" "$(DEPDIR)/zfs_stage1_5_exec-common.Po"; else rm -f "$(DEPDIR)/zfs_stage1_5_exec-common.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='common.c' object='zfs_stage1_5_exec-common.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/zfs_stage1_5_exec-common.Po' tmpdepfile='$(DEPDIR)/zfs_stage1_5_exec-common.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o zfs_stage1_5_exec-common.obj `if test -f 'common.c'; then $(CYGPATH_W) 'common.c'; else $(CYGPATH_W) '$(srcdir)/common.c'; fi` - -zfs_stage1_5_exec-char_io.o: char_io.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT zfs_stage1_5_exec-char_io.o -MD -MP -MF "$(DEPDIR)/zfs_stage1_5_exec-char_io.Tpo" -c -o zfs_stage1_5_exec-char_io.o `test -f 'char_io.c' || echo '$(srcdir)/'`char_io.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/zfs_stage1_5_exec-char_io.Tpo" "$(DEPDIR)/zfs_stage1_5_exec-char_io.Po"; else rm -f "$(DEPDIR)/zfs_stage1_5_exec-char_io.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='char_io.c' object='zfs_stage1_5_exec-char_io.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/zfs_stage1_5_exec-char_io.Po' tmpdepfile='$(DEPDIR)/zfs_stage1_5_exec-char_io.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o zfs_stage1_5_exec-char_io.o `test -f 'char_io.c' || echo '$(srcdir)/'`char_io.c - -zfs_stage1_5_exec-char_io.obj: char_io.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT zfs_stage1_5_exec-char_io.obj -MD -MP -MF "$(DEPDIR)/zfs_stage1_5_exec-char_io.Tpo" -c -o zfs_stage1_5_exec-char_io.obj `if test -f 'char_io.c'; then $(CYGPATH_W) 'char_io.c'; else $(CYGPATH_W) '$(srcdir)/char_io.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/zfs_stage1_5_exec-char_io.Tpo" "$(DEPDIR)/zfs_stage1_5_exec-char_io.Po"; else rm -f "$(DEPDIR)/zfs_stage1_5_exec-char_io.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='char_io.c' object='zfs_stage1_5_exec-char_io.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/zfs_stage1_5_exec-char_io.Po' tmpdepfile='$(DEPDIR)/zfs_stage1_5_exec-char_io.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o zfs_stage1_5_exec-char_io.obj `if test -f 'char_io.c'; then $(CYGPATH_W) 'char_io.c'; else $(CYGPATH_W) '$(srcdir)/char_io.c'; fi` - -zfs_stage1_5_exec-disk_io.o: disk_io.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT zfs_stage1_5_exec-disk_io.o -MD -MP -MF "$(DEPDIR)/zfs_stage1_5_exec-disk_io.Tpo" -c -o zfs_stage1_5_exec-disk_io.o `test -f 'disk_io.c' || echo '$(srcdir)/'`disk_io.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/zfs_stage1_5_exec-disk_io.Tpo" "$(DEPDIR)/zfs_stage1_5_exec-disk_io.Po"; else rm -f "$(DEPDIR)/zfs_stage1_5_exec-disk_io.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='disk_io.c' object='zfs_stage1_5_exec-disk_io.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/zfs_stage1_5_exec-disk_io.Po' tmpdepfile='$(DEPDIR)/zfs_stage1_5_exec-disk_io.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o zfs_stage1_5_exec-disk_io.o `test -f 'disk_io.c' || echo '$(srcdir)/'`disk_io.c - -zfs_stage1_5_exec-disk_io.obj: disk_io.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT zfs_stage1_5_exec-disk_io.obj -MD -MP -MF "$(DEPDIR)/zfs_stage1_5_exec-disk_io.Tpo" -c -o zfs_stage1_5_exec-disk_io.obj `if test -f 'disk_io.c'; then $(CYGPATH_W) 'disk_io.c'; else $(CYGPATH_W) '$(srcdir)/disk_io.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/zfs_stage1_5_exec-disk_io.Tpo" "$(DEPDIR)/zfs_stage1_5_exec-disk_io.Po"; else rm -f "$(DEPDIR)/zfs_stage1_5_exec-disk_io.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='disk_io.c' object='zfs_stage1_5_exec-disk_io.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/zfs_stage1_5_exec-disk_io.Po' tmpdepfile='$(DEPDIR)/zfs_stage1_5_exec-disk_io.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o zfs_stage1_5_exec-disk_io.obj `if test -f 'disk_io.c'; then $(CYGPATH_W) 'disk_io.c'; else $(CYGPATH_W) '$(srcdir)/disk_io.c'; fi` - -zfs_stage1_5_exec-stage1_5.o: stage1_5.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT zfs_stage1_5_exec-stage1_5.o -MD -MP -MF "$(DEPDIR)/zfs_stage1_5_exec-stage1_5.Tpo" -c -o zfs_stage1_5_exec-stage1_5.o `test -f 'stage1_5.c' || echo '$(srcdir)/'`stage1_5.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/zfs_stage1_5_exec-stage1_5.Tpo" "$(DEPDIR)/zfs_stage1_5_exec-stage1_5.Po"; else rm -f "$(DEPDIR)/zfs_stage1_5_exec-stage1_5.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='stage1_5.c' object='zfs_stage1_5_exec-stage1_5.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/zfs_stage1_5_exec-stage1_5.Po' tmpdepfile='$(DEPDIR)/zfs_stage1_5_exec-stage1_5.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o zfs_stage1_5_exec-stage1_5.o `test -f 'stage1_5.c' || echo '$(srcdir)/'`stage1_5.c - -zfs_stage1_5_exec-stage1_5.obj: stage1_5.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT zfs_stage1_5_exec-stage1_5.obj -MD -MP -MF "$(DEPDIR)/zfs_stage1_5_exec-stage1_5.Tpo" -c -o zfs_stage1_5_exec-stage1_5.obj `if test -f 'stage1_5.c'; then $(CYGPATH_W) 'stage1_5.c'; else $(CYGPATH_W) '$(srcdir)/stage1_5.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/zfs_stage1_5_exec-stage1_5.Tpo" "$(DEPDIR)/zfs_stage1_5_exec-stage1_5.Po"; else rm -f "$(DEPDIR)/zfs_stage1_5_exec-stage1_5.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='stage1_5.c' object='zfs_stage1_5_exec-stage1_5.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/zfs_stage1_5_exec-stage1_5.Po' tmpdepfile='$(DEPDIR)/zfs_stage1_5_exec-stage1_5.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o zfs_stage1_5_exec-stage1_5.obj `if test -f 'stage1_5.c'; then $(CYGPATH_W) 'stage1_5.c'; else $(CYGPATH_W) '$(srcdir)/stage1_5.c'; fi` - -zfs_stage1_5_exec-zfs_sha256.o: zfs_sha256.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT zfs_stage1_5_exec-zfs_sha256.o -MD -MP -MF "$(DEPDIR)/zfs_stage1_5_exec-zfs_sha256.Tpo" -c -o zfs_stage1_5_exec-zfs_sha256.o `test -f 'zfs_sha256.c' || echo '$(srcdir)/'`zfs_sha256.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/zfs_stage1_5_exec-zfs_sha256.Tpo" "$(DEPDIR)/zfs_stage1_5_exec-zfs_sha256.Po"; else rm -f "$(DEPDIR)/zfs_stage1_5_exec-zfs_sha256.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='zfs_sha256.c' object='zfs_stage1_5_exec-zfs_sha256.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/zfs_stage1_5_exec-zfs_sha256.Po' tmpdepfile='$(DEPDIR)/zfs_stage1_5_exec-zfs_sha256.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o zfs_stage1_5_exec-zfs_sha256.o `test -f 'zfs_sha256.c' || echo '$(srcdir)/'`zfs_sha256.c - -zfs_stage1_5_exec-zfs_sha256.obj: zfs_sha256.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT zfs_stage1_5_exec-zfs_sha256.obj -MD -MP -MF "$(DEPDIR)/zfs_stage1_5_exec-zfs_sha256.Tpo" -c -o zfs_stage1_5_exec-zfs_sha256.obj `if test -f 'zfs_sha256.c'; then $(CYGPATH_W) 'zfs_sha256.c'; else $(CYGPATH_W) '$(srcdir)/zfs_sha256.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/zfs_stage1_5_exec-zfs_sha256.Tpo" "$(DEPDIR)/zfs_stage1_5_exec-zfs_sha256.Po"; else rm -f "$(DEPDIR)/zfs_stage1_5_exec-zfs_sha256.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='zfs_sha256.c' object='zfs_stage1_5_exec-zfs_sha256.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/zfs_stage1_5_exec-zfs_sha256.Po' tmpdepfile='$(DEPDIR)/zfs_stage1_5_exec-zfs_sha256.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o zfs_stage1_5_exec-zfs_sha256.obj `if test -f 'zfs_sha256.c'; then $(CYGPATH_W) 'zfs_sha256.c'; else $(CYGPATH_W) '$(srcdir)/zfs_sha256.c'; fi` - -zfs_stage1_5_exec-zfs_lzjb.o: zfs_lzjb.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT zfs_stage1_5_exec-zfs_lzjb.o -MD -MP -MF "$(DEPDIR)/zfs_stage1_5_exec-zfs_lzjb.Tpo" -c -o zfs_stage1_5_exec-zfs_lzjb.o `test -f 'zfs_lzjb.c' || echo '$(srcdir)/'`zfs_lzjb.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/zfs_stage1_5_exec-zfs_lzjb.Tpo" "$(DEPDIR)/zfs_stage1_5_exec-zfs_lzjb.Po"; else rm -f "$(DEPDIR)/zfs_stage1_5_exec-zfs_lzjb.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='zfs_lzjb.c' object='zfs_stage1_5_exec-zfs_lzjb.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/zfs_stage1_5_exec-zfs_lzjb.Po' tmpdepfile='$(DEPDIR)/zfs_stage1_5_exec-zfs_lzjb.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o zfs_stage1_5_exec-zfs_lzjb.o `test -f 'zfs_lzjb.c' || echo '$(srcdir)/'`zfs_lzjb.c - -zfs_stage1_5_exec-zfs_lzjb.obj: zfs_lzjb.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT zfs_stage1_5_exec-zfs_lzjb.obj -MD -MP -MF "$(DEPDIR)/zfs_stage1_5_exec-zfs_lzjb.Tpo" -c -o zfs_stage1_5_exec-zfs_lzjb.obj `if test -f 'zfs_lzjb.c'; then $(CYGPATH_W) 'zfs_lzjb.c'; else $(CYGPATH_W) '$(srcdir)/zfs_lzjb.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/zfs_stage1_5_exec-zfs_lzjb.Tpo" "$(DEPDIR)/zfs_stage1_5_exec-zfs_lzjb.Po"; else rm -f "$(DEPDIR)/zfs_stage1_5_exec-zfs_lzjb.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='zfs_lzjb.c' object='zfs_stage1_5_exec-zfs_lzjb.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/zfs_stage1_5_exec-zfs_lzjb.Po' tmpdepfile='$(DEPDIR)/zfs_stage1_5_exec-zfs_lzjb.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o zfs_stage1_5_exec-zfs_lzjb.obj `if test -f 'zfs_lzjb.c'; then $(CYGPATH_W) 'zfs_lzjb.c'; else $(CYGPATH_W) '$(srcdir)/zfs_lzjb.c'; fi` - -zfs_stage1_5_exec-zfs_fletcher.o: zfs_fletcher.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT zfs_stage1_5_exec-zfs_fletcher.o -MD -MP -MF "$(DEPDIR)/zfs_stage1_5_exec-zfs_fletcher.Tpo" -c -o zfs_stage1_5_exec-zfs_fletcher.o `test -f 'zfs_fletcher.c' || echo '$(srcdir)/'`zfs_fletcher.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/zfs_stage1_5_exec-zfs_fletcher.Tpo" "$(DEPDIR)/zfs_stage1_5_exec-zfs_fletcher.Po"; else rm -f "$(DEPDIR)/zfs_stage1_5_exec-zfs_fletcher.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='zfs_fletcher.c' object='zfs_stage1_5_exec-zfs_fletcher.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/zfs_stage1_5_exec-zfs_fletcher.Po' tmpdepfile='$(DEPDIR)/zfs_stage1_5_exec-zfs_fletcher.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o zfs_stage1_5_exec-zfs_fletcher.o `test -f 'zfs_fletcher.c' || echo '$(srcdir)/'`zfs_fletcher.c - -zfs_stage1_5_exec-zfs_fletcher.obj: zfs_fletcher.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT zfs_stage1_5_exec-zfs_fletcher.obj -MD -MP -MF "$(DEPDIR)/zfs_stage1_5_exec-zfs_fletcher.Tpo" -c -o zfs_stage1_5_exec-zfs_fletcher.obj `if test -f 'zfs_fletcher.c'; then $(CYGPATH_W) 'zfs_fletcher.c'; else $(CYGPATH_W) '$(srcdir)/zfs_fletcher.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/zfs_stage1_5_exec-zfs_fletcher.Tpo" "$(DEPDIR)/zfs_stage1_5_exec-zfs_fletcher.Po"; else rm -f "$(DEPDIR)/zfs_stage1_5_exec-zfs_fletcher.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='zfs_fletcher.c' object='zfs_stage1_5_exec-zfs_fletcher.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/zfs_stage1_5_exec-zfs_fletcher.Po' tmpdepfile='$(DEPDIR)/zfs_stage1_5_exec-zfs_fletcher.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o zfs_stage1_5_exec-zfs_fletcher.obj `if test -f 'zfs_fletcher.c'; then $(CYGPATH_W) 'zfs_fletcher.c'; else $(CYGPATH_W) '$(srcdir)/zfs_fletcher.c'; fi` - -zfs_stage1_5_exec-fsys_zfs.o: fsys_zfs.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT zfs_stage1_5_exec-fsys_zfs.o -MD -MP -MF "$(DEPDIR)/zfs_stage1_5_exec-fsys_zfs.Tpo" -c -o zfs_stage1_5_exec-fsys_zfs.o `test -f 'fsys_zfs.c' || echo '$(srcdir)/'`fsys_zfs.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/zfs_stage1_5_exec-fsys_zfs.Tpo" "$(DEPDIR)/zfs_stage1_5_exec-fsys_zfs.Po"; else rm -f "$(DEPDIR)/zfs_stage1_5_exec-fsys_zfs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_zfs.c' object='zfs_stage1_5_exec-fsys_zfs.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/zfs_stage1_5_exec-fsys_zfs.Po' tmpdepfile='$(DEPDIR)/zfs_stage1_5_exec-fsys_zfs.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o zfs_stage1_5_exec-fsys_zfs.o `test -f 'fsys_zfs.c' || echo '$(srcdir)/'`fsys_zfs.c - -zfs_stage1_5_exec-fsys_zfs.obj: fsys_zfs.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT zfs_stage1_5_exec-fsys_zfs.obj -MD -MP -MF "$(DEPDIR)/zfs_stage1_5_exec-fsys_zfs.Tpo" -c -o zfs_stage1_5_exec-fsys_zfs.obj `if test -f 'fsys_zfs.c'; then $(CYGPATH_W) 'fsys_zfs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_zfs.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/zfs_stage1_5_exec-fsys_zfs.Tpo" "$(DEPDIR)/zfs_stage1_5_exec-fsys_zfs.Po"; else rm -f "$(DEPDIR)/zfs_stage1_5_exec-fsys_zfs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_zfs.c' object='zfs_stage1_5_exec-fsys_zfs.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/zfs_stage1_5_exec-fsys_zfs.Po' tmpdepfile='$(DEPDIR)/zfs_stage1_5_exec-fsys_zfs.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o zfs_stage1_5_exec-fsys_zfs.obj `if test -f 'fsys_zfs.c'; then $(CYGPATH_W) 'fsys_zfs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_zfs.c'; fi` - -zfs_stage1_5_exec-bios.o: bios.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT zfs_stage1_5_exec-bios.o -MD -MP -MF "$(DEPDIR)/zfs_stage1_5_exec-bios.Tpo" -c -o zfs_stage1_5_exec-bios.o `test -f 'bios.c' || echo '$(srcdir)/'`bios.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/zfs_stage1_5_exec-bios.Tpo" "$(DEPDIR)/zfs_stage1_5_exec-bios.Po"; else rm -f "$(DEPDIR)/zfs_stage1_5_exec-bios.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bios.c' object='zfs_stage1_5_exec-bios.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/zfs_stage1_5_exec-bios.Po' tmpdepfile='$(DEPDIR)/zfs_stage1_5_exec-bios.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o zfs_stage1_5_exec-bios.o `test -f 'bios.c' || echo '$(srcdir)/'`bios.c - -zfs_stage1_5_exec-bios.obj: bios.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT zfs_stage1_5_exec-bios.obj -MD -MP -MF "$(DEPDIR)/zfs_stage1_5_exec-bios.Tpo" -c -o zfs_stage1_5_exec-bios.obj `if test -f 'bios.c'; then $(CYGPATH_W) 'bios.c'; else $(CYGPATH_W) '$(srcdir)/bios.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/zfs_stage1_5_exec-bios.Tpo" "$(DEPDIR)/zfs_stage1_5_exec-bios.Po"; else rm -f "$(DEPDIR)/zfs_stage1_5_exec-bios.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bios.c' object='zfs_stage1_5_exec-bios.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/zfs_stage1_5_exec-bios.Po' tmpdepfile='$(DEPDIR)/zfs_stage1_5_exec-bios.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o zfs_stage1_5_exec-bios.obj `if test -f 'bios.c'; then $(CYGPATH_W) 'bios.c'; else $(CYGPATH_W) '$(srcdir)/bios.c'; fi` - -vstafs_stage1_5_exec-common.o: common.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vstafs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT vstafs_stage1_5_exec-common.o -MD -MP -MF "$(DEPDIR)/vstafs_stage1_5_exec-common.Tpo" -c -o vstafs_stage1_5_exec-common.o `test -f 'common.c' || echo '$(srcdir)/'`common.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/vstafs_stage1_5_exec-common.Tpo" "$(DEPDIR)/vstafs_stage1_5_exec-common.Po"; else rm -f "$(DEPDIR)/vstafs_stage1_5_exec-common.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='common.c' object='vstafs_stage1_5_exec-common.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/vstafs_stage1_5_exec-common.Po' tmpdepfile='$(DEPDIR)/vstafs_stage1_5_exec-common.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vstafs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o vstafs_stage1_5_exec-common.o `test -f 'common.c' || echo '$(srcdir)/'`common.c - -vstafs_stage1_5_exec-common.obj: common.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vstafs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT vstafs_stage1_5_exec-common.obj -MD -MP -MF "$(DEPDIR)/vstafs_stage1_5_exec-common.Tpo" -c -o vstafs_stage1_5_exec-common.obj `if test -f 'common.c'; then $(CYGPATH_W) 'common.c'; else $(CYGPATH_W) '$(srcdir)/common.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/vstafs_stage1_5_exec-common.Tpo" "$(DEPDIR)/vstafs_stage1_5_exec-common.Po"; else rm -f "$(DEPDIR)/vstafs_stage1_5_exec-common.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='common.c' object='vstafs_stage1_5_exec-common.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/vstafs_stage1_5_exec-common.Po' tmpdepfile='$(DEPDIR)/vstafs_stage1_5_exec-common.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vstafs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o vstafs_stage1_5_exec-common.obj `if test -f 'common.c'; then $(CYGPATH_W) 'common.c'; else $(CYGPATH_W) '$(srcdir)/common.c'; fi` - -vstafs_stage1_5_exec-char_io.o: char_io.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vstafs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT vstafs_stage1_5_exec-char_io.o -MD -MP -MF "$(DEPDIR)/vstafs_stage1_5_exec-char_io.Tpo" -c -o vstafs_stage1_5_exec-char_io.o `test -f 'char_io.c' || echo '$(srcdir)/'`char_io.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/vstafs_stage1_5_exec-char_io.Tpo" "$(DEPDIR)/vstafs_stage1_5_exec-char_io.Po"; else rm -f "$(DEPDIR)/vstafs_stage1_5_exec-char_io.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='char_io.c' object='vstafs_stage1_5_exec-char_io.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/vstafs_stage1_5_exec-char_io.Po' tmpdepfile='$(DEPDIR)/vstafs_stage1_5_exec-char_io.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vstafs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o vstafs_stage1_5_exec-char_io.o `test -f 'char_io.c' || echo '$(srcdir)/'`char_io.c - -vstafs_stage1_5_exec-char_io.obj: char_io.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vstafs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT vstafs_stage1_5_exec-char_io.obj -MD -MP -MF "$(DEPDIR)/vstafs_stage1_5_exec-char_io.Tpo" -c -o vstafs_stage1_5_exec-char_io.obj `if test -f 'char_io.c'; then $(CYGPATH_W) 'char_io.c'; else $(CYGPATH_W) '$(srcdir)/char_io.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/vstafs_stage1_5_exec-char_io.Tpo" "$(DEPDIR)/vstafs_stage1_5_exec-char_io.Po"; else rm -f "$(DEPDIR)/vstafs_stage1_5_exec-char_io.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='char_io.c' object='vstafs_stage1_5_exec-char_io.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/vstafs_stage1_5_exec-char_io.Po' tmpdepfile='$(DEPDIR)/vstafs_stage1_5_exec-char_io.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vstafs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o vstafs_stage1_5_exec-char_io.obj `if test -f 'char_io.c'; then $(CYGPATH_W) 'char_io.c'; else $(CYGPATH_W) '$(srcdir)/char_io.c'; fi` - -vstafs_stage1_5_exec-disk_io.o: disk_io.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vstafs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT vstafs_stage1_5_exec-disk_io.o -MD -MP -MF "$(DEPDIR)/vstafs_stage1_5_exec-disk_io.Tpo" -c -o vstafs_stage1_5_exec-disk_io.o `test -f 'disk_io.c' || echo '$(srcdir)/'`disk_io.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/vstafs_stage1_5_exec-disk_io.Tpo" "$(DEPDIR)/vstafs_stage1_5_exec-disk_io.Po"; else rm -f "$(DEPDIR)/vstafs_stage1_5_exec-disk_io.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='disk_io.c' object='vstafs_stage1_5_exec-disk_io.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/vstafs_stage1_5_exec-disk_io.Po' tmpdepfile='$(DEPDIR)/vstafs_stage1_5_exec-disk_io.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vstafs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o vstafs_stage1_5_exec-disk_io.o `test -f 'disk_io.c' || echo '$(srcdir)/'`disk_io.c - -vstafs_stage1_5_exec-disk_io.obj: disk_io.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vstafs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT vstafs_stage1_5_exec-disk_io.obj -MD -MP -MF "$(DEPDIR)/vstafs_stage1_5_exec-disk_io.Tpo" -c -o vstafs_stage1_5_exec-disk_io.obj `if test -f 'disk_io.c'; then $(CYGPATH_W) 'disk_io.c'; else $(CYGPATH_W) '$(srcdir)/disk_io.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/vstafs_stage1_5_exec-disk_io.Tpo" "$(DEPDIR)/vstafs_stage1_5_exec-disk_io.Po"; else rm -f "$(DEPDIR)/vstafs_stage1_5_exec-disk_io.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='disk_io.c' object='vstafs_stage1_5_exec-disk_io.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/vstafs_stage1_5_exec-disk_io.Po' tmpdepfile='$(DEPDIR)/vstafs_stage1_5_exec-disk_io.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vstafs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o vstafs_stage1_5_exec-disk_io.obj `if test -f 'disk_io.c'; then $(CYGPATH_W) 'disk_io.c'; else $(CYGPATH_W) '$(srcdir)/disk_io.c'; fi` - -vstafs_stage1_5_exec-stage1_5.o: stage1_5.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vstafs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT vstafs_stage1_5_exec-stage1_5.o -MD -MP -MF "$(DEPDIR)/vstafs_stage1_5_exec-stage1_5.Tpo" -c -o vstafs_stage1_5_exec-stage1_5.o `test -f 'stage1_5.c' || echo '$(srcdir)/'`stage1_5.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/vstafs_stage1_5_exec-stage1_5.Tpo" "$(DEPDIR)/vstafs_stage1_5_exec-stage1_5.Po"; else rm -f "$(DEPDIR)/vstafs_stage1_5_exec-stage1_5.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='stage1_5.c' object='vstafs_stage1_5_exec-stage1_5.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/vstafs_stage1_5_exec-stage1_5.Po' tmpdepfile='$(DEPDIR)/vstafs_stage1_5_exec-stage1_5.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vstafs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o vstafs_stage1_5_exec-stage1_5.o `test -f 'stage1_5.c' || echo '$(srcdir)/'`stage1_5.c - -vstafs_stage1_5_exec-stage1_5.obj: stage1_5.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vstafs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT vstafs_stage1_5_exec-stage1_5.obj -MD -MP -MF "$(DEPDIR)/vstafs_stage1_5_exec-stage1_5.Tpo" -c -o vstafs_stage1_5_exec-stage1_5.obj `if test -f 'stage1_5.c'; then $(CYGPATH_W) 'stage1_5.c'; else $(CYGPATH_W) '$(srcdir)/stage1_5.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/vstafs_stage1_5_exec-stage1_5.Tpo" "$(DEPDIR)/vstafs_stage1_5_exec-stage1_5.Po"; else rm -f "$(DEPDIR)/vstafs_stage1_5_exec-stage1_5.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='stage1_5.c' object='vstafs_stage1_5_exec-stage1_5.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/vstafs_stage1_5_exec-stage1_5.Po' tmpdepfile='$(DEPDIR)/vstafs_stage1_5_exec-stage1_5.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vstafs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o vstafs_stage1_5_exec-stage1_5.obj `if test -f 'stage1_5.c'; then $(CYGPATH_W) 'stage1_5.c'; else $(CYGPATH_W) '$(srcdir)/stage1_5.c'; fi` - -vstafs_stage1_5_exec-fsys_vstafs.o: fsys_vstafs.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vstafs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT vstafs_stage1_5_exec-fsys_vstafs.o -MD -MP -MF "$(DEPDIR)/vstafs_stage1_5_exec-fsys_vstafs.Tpo" -c -o vstafs_stage1_5_exec-fsys_vstafs.o `test -f 'fsys_vstafs.c' || echo '$(srcdir)/'`fsys_vstafs.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/vstafs_stage1_5_exec-fsys_vstafs.Tpo" "$(DEPDIR)/vstafs_stage1_5_exec-fsys_vstafs.Po"; else rm -f "$(DEPDIR)/vstafs_stage1_5_exec-fsys_vstafs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_vstafs.c' object='vstafs_stage1_5_exec-fsys_vstafs.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/vstafs_stage1_5_exec-fsys_vstafs.Po' tmpdepfile='$(DEPDIR)/vstafs_stage1_5_exec-fsys_vstafs.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vstafs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o vstafs_stage1_5_exec-fsys_vstafs.o `test -f 'fsys_vstafs.c' || echo '$(srcdir)/'`fsys_vstafs.c - -vstafs_stage1_5_exec-fsys_vstafs.obj: fsys_vstafs.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vstafs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT vstafs_stage1_5_exec-fsys_vstafs.obj -MD -MP -MF "$(DEPDIR)/vstafs_stage1_5_exec-fsys_vstafs.Tpo" -c -o vstafs_stage1_5_exec-fsys_vstafs.obj `if test -f 'fsys_vstafs.c'; then $(CYGPATH_W) 'fsys_vstafs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_vstafs.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/vstafs_stage1_5_exec-fsys_vstafs.Tpo" "$(DEPDIR)/vstafs_stage1_5_exec-fsys_vstafs.Po"; else rm -f "$(DEPDIR)/vstafs_stage1_5_exec-fsys_vstafs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_vstafs.c' object='vstafs_stage1_5_exec-fsys_vstafs.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/vstafs_stage1_5_exec-fsys_vstafs.Po' tmpdepfile='$(DEPDIR)/vstafs_stage1_5_exec-fsys_vstafs.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vstafs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o vstafs_stage1_5_exec-fsys_vstafs.obj `if test -f 'fsys_vstafs.c'; then $(CYGPATH_W) 'fsys_vstafs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_vstafs.c'; fi` - -vstafs_stage1_5_exec-bios.o: bios.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vstafs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT vstafs_stage1_5_exec-bios.o -MD -MP -MF "$(DEPDIR)/vstafs_stage1_5_exec-bios.Tpo" -c -o vstafs_stage1_5_exec-bios.o `test -f 'bios.c' || echo '$(srcdir)/'`bios.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/vstafs_stage1_5_exec-bios.Tpo" "$(DEPDIR)/vstafs_stage1_5_exec-bios.Po"; else rm -f "$(DEPDIR)/vstafs_stage1_5_exec-bios.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bios.c' object='vstafs_stage1_5_exec-bios.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/vstafs_stage1_5_exec-bios.Po' tmpdepfile='$(DEPDIR)/vstafs_stage1_5_exec-bios.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vstafs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o vstafs_stage1_5_exec-bios.o `test -f 'bios.c' || echo '$(srcdir)/'`bios.c - -vstafs_stage1_5_exec-bios.obj: bios.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vstafs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT vstafs_stage1_5_exec-bios.obj -MD -MP -MF "$(DEPDIR)/vstafs_stage1_5_exec-bios.Tpo" -c -o vstafs_stage1_5_exec-bios.obj `if test -f 'bios.c'; then $(CYGPATH_W) 'bios.c'; else $(CYGPATH_W) '$(srcdir)/bios.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/vstafs_stage1_5_exec-bios.Tpo" "$(DEPDIR)/vstafs_stage1_5_exec-bios.Po"; else rm -f "$(DEPDIR)/vstafs_stage1_5_exec-bios.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bios.c' object='vstafs_stage1_5_exec-bios.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/vstafs_stage1_5_exec-bios.Po' tmpdepfile='$(DEPDIR)/vstafs_stage1_5_exec-bios.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vstafs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o vstafs_stage1_5_exec-bios.obj `if test -f 'bios.c'; then $(CYGPATH_W) 'bios.c'; else $(CYGPATH_W) '$(srcdir)/bios.c'; fi` - -xfs_stage1_5_exec-common.o: common.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT xfs_stage1_5_exec-common.o -MD -MP -MF "$(DEPDIR)/xfs_stage1_5_exec-common.Tpo" -c -o xfs_stage1_5_exec-common.o `test -f 'common.c' || echo '$(srcdir)/'`common.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/xfs_stage1_5_exec-common.Tpo" "$(DEPDIR)/xfs_stage1_5_exec-common.Po"; else rm -f "$(DEPDIR)/xfs_stage1_5_exec-common.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='common.c' object='xfs_stage1_5_exec-common.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/xfs_stage1_5_exec-common.Po' tmpdepfile='$(DEPDIR)/xfs_stage1_5_exec-common.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o xfs_stage1_5_exec-common.o `test -f 'common.c' || echo '$(srcdir)/'`common.c - -xfs_stage1_5_exec-common.obj: common.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT xfs_stage1_5_exec-common.obj -MD -MP -MF "$(DEPDIR)/xfs_stage1_5_exec-common.Tpo" -c -o xfs_stage1_5_exec-common.obj `if test -f 'common.c'; then $(CYGPATH_W) 'common.c'; else $(CYGPATH_W) '$(srcdir)/common.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/xfs_stage1_5_exec-common.Tpo" "$(DEPDIR)/xfs_stage1_5_exec-common.Po"; else rm -f "$(DEPDIR)/xfs_stage1_5_exec-common.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='common.c' object='xfs_stage1_5_exec-common.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/xfs_stage1_5_exec-common.Po' tmpdepfile='$(DEPDIR)/xfs_stage1_5_exec-common.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o xfs_stage1_5_exec-common.obj `if test -f 'common.c'; then $(CYGPATH_W) 'common.c'; else $(CYGPATH_W) '$(srcdir)/common.c'; fi` - -xfs_stage1_5_exec-char_io.o: char_io.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT xfs_stage1_5_exec-char_io.o -MD -MP -MF "$(DEPDIR)/xfs_stage1_5_exec-char_io.Tpo" -c -o xfs_stage1_5_exec-char_io.o `test -f 'char_io.c' || echo '$(srcdir)/'`char_io.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/xfs_stage1_5_exec-char_io.Tpo" "$(DEPDIR)/xfs_stage1_5_exec-char_io.Po"; else rm -f "$(DEPDIR)/xfs_stage1_5_exec-char_io.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='char_io.c' object='xfs_stage1_5_exec-char_io.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/xfs_stage1_5_exec-char_io.Po' tmpdepfile='$(DEPDIR)/xfs_stage1_5_exec-char_io.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o xfs_stage1_5_exec-char_io.o `test -f 'char_io.c' || echo '$(srcdir)/'`char_io.c - -xfs_stage1_5_exec-char_io.obj: char_io.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT xfs_stage1_5_exec-char_io.obj -MD -MP -MF "$(DEPDIR)/xfs_stage1_5_exec-char_io.Tpo" -c -o xfs_stage1_5_exec-char_io.obj `if test -f 'char_io.c'; then $(CYGPATH_W) 'char_io.c'; else $(CYGPATH_W) '$(srcdir)/char_io.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/xfs_stage1_5_exec-char_io.Tpo" "$(DEPDIR)/xfs_stage1_5_exec-char_io.Po"; else rm -f "$(DEPDIR)/xfs_stage1_5_exec-char_io.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='char_io.c' object='xfs_stage1_5_exec-char_io.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/xfs_stage1_5_exec-char_io.Po' tmpdepfile='$(DEPDIR)/xfs_stage1_5_exec-char_io.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o xfs_stage1_5_exec-char_io.obj `if test -f 'char_io.c'; then $(CYGPATH_W) 'char_io.c'; else $(CYGPATH_W) '$(srcdir)/char_io.c'; fi` - -xfs_stage1_5_exec-disk_io.o: disk_io.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT xfs_stage1_5_exec-disk_io.o -MD -MP -MF "$(DEPDIR)/xfs_stage1_5_exec-disk_io.Tpo" -c -o xfs_stage1_5_exec-disk_io.o `test -f 'disk_io.c' || echo '$(srcdir)/'`disk_io.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/xfs_stage1_5_exec-disk_io.Tpo" "$(DEPDIR)/xfs_stage1_5_exec-disk_io.Po"; else rm -f "$(DEPDIR)/xfs_stage1_5_exec-disk_io.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='disk_io.c' object='xfs_stage1_5_exec-disk_io.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/xfs_stage1_5_exec-disk_io.Po' tmpdepfile='$(DEPDIR)/xfs_stage1_5_exec-disk_io.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o xfs_stage1_5_exec-disk_io.o `test -f 'disk_io.c' || echo '$(srcdir)/'`disk_io.c - -xfs_stage1_5_exec-disk_io.obj: disk_io.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT xfs_stage1_5_exec-disk_io.obj -MD -MP -MF "$(DEPDIR)/xfs_stage1_5_exec-disk_io.Tpo" -c -o xfs_stage1_5_exec-disk_io.obj `if test -f 'disk_io.c'; then $(CYGPATH_W) 'disk_io.c'; else $(CYGPATH_W) '$(srcdir)/disk_io.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/xfs_stage1_5_exec-disk_io.Tpo" "$(DEPDIR)/xfs_stage1_5_exec-disk_io.Po"; else rm -f "$(DEPDIR)/xfs_stage1_5_exec-disk_io.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='disk_io.c' object='xfs_stage1_5_exec-disk_io.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/xfs_stage1_5_exec-disk_io.Po' tmpdepfile='$(DEPDIR)/xfs_stage1_5_exec-disk_io.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o xfs_stage1_5_exec-disk_io.obj `if test -f 'disk_io.c'; then $(CYGPATH_W) 'disk_io.c'; else $(CYGPATH_W) '$(srcdir)/disk_io.c'; fi` - -xfs_stage1_5_exec-stage1_5.o: stage1_5.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT xfs_stage1_5_exec-stage1_5.o -MD -MP -MF "$(DEPDIR)/xfs_stage1_5_exec-stage1_5.Tpo" -c -o xfs_stage1_5_exec-stage1_5.o `test -f 'stage1_5.c' || echo '$(srcdir)/'`stage1_5.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/xfs_stage1_5_exec-stage1_5.Tpo" "$(DEPDIR)/xfs_stage1_5_exec-stage1_5.Po"; else rm -f "$(DEPDIR)/xfs_stage1_5_exec-stage1_5.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='stage1_5.c' object='xfs_stage1_5_exec-stage1_5.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/xfs_stage1_5_exec-stage1_5.Po' tmpdepfile='$(DEPDIR)/xfs_stage1_5_exec-stage1_5.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o xfs_stage1_5_exec-stage1_5.o `test -f 'stage1_5.c' || echo '$(srcdir)/'`stage1_5.c - -xfs_stage1_5_exec-stage1_5.obj: stage1_5.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT xfs_stage1_5_exec-stage1_5.obj -MD -MP -MF "$(DEPDIR)/xfs_stage1_5_exec-stage1_5.Tpo" -c -o xfs_stage1_5_exec-stage1_5.obj `if test -f 'stage1_5.c'; then $(CYGPATH_W) 'stage1_5.c'; else $(CYGPATH_W) '$(srcdir)/stage1_5.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/xfs_stage1_5_exec-stage1_5.Tpo" "$(DEPDIR)/xfs_stage1_5_exec-stage1_5.Po"; else rm -f "$(DEPDIR)/xfs_stage1_5_exec-stage1_5.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='stage1_5.c' object='xfs_stage1_5_exec-stage1_5.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/xfs_stage1_5_exec-stage1_5.Po' tmpdepfile='$(DEPDIR)/xfs_stage1_5_exec-stage1_5.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o xfs_stage1_5_exec-stage1_5.obj `if test -f 'stage1_5.c'; then $(CYGPATH_W) 'stage1_5.c'; else $(CYGPATH_W) '$(srcdir)/stage1_5.c'; fi` - -xfs_stage1_5_exec-fsys_xfs.o: fsys_xfs.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT xfs_stage1_5_exec-fsys_xfs.o -MD -MP -MF "$(DEPDIR)/xfs_stage1_5_exec-fsys_xfs.Tpo" -c -o xfs_stage1_5_exec-fsys_xfs.o `test -f 'fsys_xfs.c' || echo '$(srcdir)/'`fsys_xfs.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/xfs_stage1_5_exec-fsys_xfs.Tpo" "$(DEPDIR)/xfs_stage1_5_exec-fsys_xfs.Po"; else rm -f "$(DEPDIR)/xfs_stage1_5_exec-fsys_xfs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_xfs.c' object='xfs_stage1_5_exec-fsys_xfs.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/xfs_stage1_5_exec-fsys_xfs.Po' tmpdepfile='$(DEPDIR)/xfs_stage1_5_exec-fsys_xfs.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o xfs_stage1_5_exec-fsys_xfs.o `test -f 'fsys_xfs.c' || echo '$(srcdir)/'`fsys_xfs.c - -xfs_stage1_5_exec-fsys_xfs.obj: fsys_xfs.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT xfs_stage1_5_exec-fsys_xfs.obj -MD -MP -MF "$(DEPDIR)/xfs_stage1_5_exec-fsys_xfs.Tpo" -c -o xfs_stage1_5_exec-fsys_xfs.obj `if test -f 'fsys_xfs.c'; then $(CYGPATH_W) 'fsys_xfs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_xfs.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/xfs_stage1_5_exec-fsys_xfs.Tpo" "$(DEPDIR)/xfs_stage1_5_exec-fsys_xfs.Po"; else rm -f "$(DEPDIR)/xfs_stage1_5_exec-fsys_xfs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_xfs.c' object='xfs_stage1_5_exec-fsys_xfs.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/xfs_stage1_5_exec-fsys_xfs.Po' tmpdepfile='$(DEPDIR)/xfs_stage1_5_exec-fsys_xfs.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o xfs_stage1_5_exec-fsys_xfs.obj `if test -f 'fsys_xfs.c'; then $(CYGPATH_W) 'fsys_xfs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_xfs.c'; fi` - -xfs_stage1_5_exec-bios.o: bios.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT xfs_stage1_5_exec-bios.o -MD -MP -MF "$(DEPDIR)/xfs_stage1_5_exec-bios.Tpo" -c -o xfs_stage1_5_exec-bios.o `test -f 'bios.c' || echo '$(srcdir)/'`bios.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/xfs_stage1_5_exec-bios.Tpo" "$(DEPDIR)/xfs_stage1_5_exec-bios.Po"; else rm -f "$(DEPDIR)/xfs_stage1_5_exec-bios.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bios.c' object='xfs_stage1_5_exec-bios.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/xfs_stage1_5_exec-bios.Po' tmpdepfile='$(DEPDIR)/xfs_stage1_5_exec-bios.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o xfs_stage1_5_exec-bios.o `test -f 'bios.c' || echo '$(srcdir)/'`bios.c - -xfs_stage1_5_exec-bios.obj: bios.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT xfs_stage1_5_exec-bios.obj -MD -MP -MF "$(DEPDIR)/xfs_stage1_5_exec-bios.Tpo" -c -o xfs_stage1_5_exec-bios.obj `if test -f 'bios.c'; then $(CYGPATH_W) 'bios.c'; else $(CYGPATH_W) '$(srcdir)/bios.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/xfs_stage1_5_exec-bios.Tpo" "$(DEPDIR)/xfs_stage1_5_exec-bios.Po"; else rm -f "$(DEPDIR)/xfs_stage1_5_exec-bios.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bios.c' object='xfs_stage1_5_exec-bios.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/xfs_stage1_5_exec-bios.Po' tmpdepfile='$(DEPDIR)/xfs_stage1_5_exec-bios.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o xfs_stage1_5_exec-bios.obj `if test -f 'bios.c'; then $(CYGPATH_W) 'bios.c'; else $(CYGPATH_W) '$(srcdir)/bios.c'; fi` -uninstall-info-am: -install-pkglibDATA: $(pkglib_DATA) - @$(NORMAL_INSTALL) - test -z "$(pkglibdir)" || $(mkdir_p) "$(DESTDIR)$(pkglibdir)" - @list='$(pkglib_DATA)'; for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - f="`echo $$p | sed -e 's|^.*/||'`"; \ - echo " $(pkglibDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(pkglibdir)/$$f'"; \ - $(pkglibDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(pkglibdir)/$$f"; \ - done - -uninstall-pkglibDATA: - @$(NORMAL_UNINSTALL) - @list='$(pkglib_DATA)'; for p in $$list; do \ - f="`echo $$p | sed -e 's|^.*/||'`"; \ - echo " rm -f '$(DESTDIR)$(pkglibdir)/$$f'"; \ - rm -f "$(DESTDIR)$(pkglibdir)/$$f"; \ - done - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -check-TESTS: $(TESTS) - @failed=0; all=0; xfail=0; xpass=0; skip=0; \ - srcdir=$(srcdir); export srcdir; \ - list='$(TESTS)'; \ - if test -n "$$list"; then \ - for tst in $$list; do \ - if test -f ./$$tst; then dir=./; \ - elif test -f $$tst; then dir=; \ - else dir="$(srcdir)/"; fi; \ - if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ - all=`expr $$all + 1`; \ - case " $(XFAIL_TESTS) " in \ - *" $$tst "*) \ - xpass=`expr $$xpass + 1`; \ - failed=`expr $$failed + 1`; \ - echo "XPASS: $$tst"; \ - ;; \ - *) \ - echo "PASS: $$tst"; \ - ;; \ - esac; \ - elif test $$? -ne 77; then \ - all=`expr $$all + 1`; \ - case " $(XFAIL_TESTS) " in \ - *" $$tst "*) \ - xfail=`expr $$xfail + 1`; \ - echo "XFAIL: $$tst"; \ - ;; \ - *) \ - failed=`expr $$failed + 1`; \ - echo "FAIL: $$tst"; \ - ;; \ - esac; \ - else \ - skip=`expr $$skip + 1`; \ - echo "SKIP: $$tst"; \ - fi; \ - done; \ - if test "$$failed" -eq 0; then \ - if test "$$xfail" -eq 0; then \ - banner="All $$all tests passed"; \ - else \ - banner="All $$all tests behaved as expected ($$xfail expected failures)"; \ - fi; \ - else \ - if test "$$xpass" -eq 0; then \ - banner="$$failed of $$all tests failed"; \ - else \ - banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \ - fi; \ - fi; \ - dashes="$$banner"; \ - skipped=""; \ - if test "$$skip" -ne 0; then \ - skipped="($$skip tests were not run)"; \ - test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ - dashes="$$skipped"; \ - fi; \ - report=""; \ - if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ - report="Please report to $(PACKAGE_BUGREPORT)"; \ - test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ - dashes="$$report"; \ - fi; \ - dashes=`echo "$$dashes" | sed s/./=/g`; \ - echo "$$dashes"; \ - echo "$$banner"; \ - test -z "$$skipped" || echo "$$skipped"; \ - test -z "$$report" || echo "$$report"; \ - echo "$$dashes"; \ - test "$$failed" -eq 0; \ - else :; fi - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am - $(MAKE) $(AM_MAKEFLAGS) check-TESTS -check: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) check-am -all-am: Makefile $(LIBRARIES) $(PROGRAMS) $(SCRIPTS) $(DATA) \ - $(HEADERS) -installdirs: - for dir in "$(DESTDIR)$(pkglibdir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -install: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES) - -clean-generic: - -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) - -distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." - -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) -clean: clean-am - -clean-am: clean-generic clean-noinstLIBRARIES clean-noinstPROGRAMS \ - mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: - -install-exec-am: install-pkglibDATA - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am uninstall-pkglibDATA - -.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \ - clean-generic clean-noinstLIBRARIES clean-noinstPROGRAMS ctags \ - distclean distclean-compile distclean-generic distclean-tags \ - distdir dvi dvi-am html html-am info info-am install \ - install-am install-data install-data-am install-exec \ - install-exec-am install-info install-info-am install-man \ - install-pkglibDATA install-strip installcheck installcheck-am \ - installdirs maintainer-clean maintainer-clean-generic \ - mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \ - ps ps-am tags uninstall uninstall-am uninstall-info-am \ - uninstall-pkglibDATA - - -stage2_size.h: pre_stage2 - -rm -f stage2_size.h - set dummy `ls -l pre_stage2`; \ - echo "#define STAGE2_SIZE $$6" > stage2_size.h - -# XXX: automake doesn't provide a way to specify dependencies for object -# files explicitly, so we must write this by a general Makefile scheme. -# If automake change the naming scheme for per-executable objects, this -# will be broken. -start_exec-start.$(OBJEXT): stage2_size.h - -stage2: pre_stage2 start - -rm -f stage2 - cat start pre_stage2 > stage2 - -start_eltorito_exec-start.$(OBJEXT): stage2_size.h - -stage2_eltorito: pre_stage2 start_eltorito - -rm -f stage2_eltorito - cat start_eltorito pre_stage2 > stage2_eltorito - -diskless_size.h: diskless - -rm -f $@ - set dummy `ls -l $^`; \ - echo "#define DISKLESS_SIZE $$6" > $@ - -# XXX: See the comment for start_exec-start.o. -nbloader_exec-nbloader.$(OBJEXT): diskless_size.h - -# For nbgrub target. -nbgrub: nbloader diskless - -rm -f $@ - cat $^ > $@ - -# XXX: See the comment for start_exec-start.o. -pxeloader_exec-pxeloader.$(OBJEXT): diskless_size.h - -# For pxegrub target. -pxegrub: pxeloader diskless - -rm -f $@ - cat $^ > $@ -.exec: - $(OBJCOPY) -O binary $< $@ -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/usr/src/grub/grub-0.95/stage2/Makefile.solaris b/usr/src/grub/grub-0.95/stage2/Makefile.solaris deleted file mode 100644 index e0c125a5c7..0000000000 --- a/usr/src/grub/grub-0.95/stage2/Makefile.solaris +++ /dev/null @@ -1,941 +0,0 @@ -# -# Copyright 2005 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# ident "%Z%%M% %I% %E% SMI" -# -include ../../Makefile.grub -include ../Makefile.solaris.defs - -.SUFFIXES: -.SUFFIXES: .exec $(SUFFIXES) - -.exec: - $(OBJCOPY) -O binary $< $@ - - -INCLUDES = -I. -I.. -I../stage1 -I../netboot -LIBS = - -FSYS_CFLAGS = -DFSYS_EXT2FS=1 -DFSYS_FAT=1 -DFSYS_FFS=1 -DFSYS_UFS=1 \ - -DFSYS_ZFS=1 \ - -DFSYS_UFS2=1 -DFSYS_REISERFS=1 -DFSYS_ISO9660=1 \ - -DUSE_MD5_PASSWORDS=1 -$(STAGE2_NETBOOT)TFTP_CFLAGS = -DFSYS_TFTP=1 -$(OPTION_FS)FSYS_CFLAGS += -DFSYS_MINIX=1 -DFSYS_JFS=1 -DFSYS_XFS=1 \ - -DSYS_VSTAFS=1 - -GRAPHICS_CFLAGS = -DSUPPORT_GRAPHICS=1 -# HERCULES_CFLAGS = -DSUPPORT_HERCULES=1 -NETBOOT_CFLAGS = -DSUPPORT_NETBOOT=1 -SERIAL_CFLAGS = -DSUPPORT_SERIAL=1 -GRUB_CFLAGS = -O2 -I../lib -DGRUB_UTIL=1 \ - -DFSYS_EXT2FS=1 -DFSYS_FAT=1 -DFSYS_FFS=1 -DFSYS_ISO9660=1 \ - -DFSYS_ZFS=1 \ - -DFSYS_REISERFS=1 -DFSYS_UFS=1 -DFSYS_UFS2=1 \ - -DUSE_MD5_PASSWORDS=1 -DSUPPORT_SERIAL=1 -$(OPTION_FS)GRUB_CFLAGS += -DFSYS_MINIX=1 -DFSYS_JFS=1 -DFSYS_XFS=1 \ - -DSYS_VSTAFS=1 -# GRUB_CFLAGS += -DSUPPORT_HERCULES=1 -STAGE1_5_CFLAGS = $(STAGE2_CFLAGS) -DNO_DECOMPRESSION=1 -DSTAGE1_5=1 -STAGE2_CFLAGS = -Os -fno-builtin -nostdinc \ - $(SERIAL_CFLAGS) $(GRAPHICS_CFLAGS) -$(STAGE2_NETBOOT)STAGE2_CFLAGS += $(NETBOOT_CFLAGS) -#STAGE2_CFLAGS += $(HERCULES_CFLAGS) - -NBLOADER_LINK = -nostdlib -N -Ttext 0 -PRE_STAGE2_LINK = -nostdlib -N -Ttext 8200 -PXELOADER_LINK = -nostdlib -N -Ttext 7C00 -STAGE1_5_LINK = -nostdlib -N -Ttext 2000 -START_ELTORITO_LINK = -nostdlib -N -Ttext 7C00 -START_LINK = -nostdlib -N -Ttext 8000 - -LIBDRIVERS = ../netboot/libdrivers.a - - -BUILT_SOURCES = stage2_size.h -BUILT_SOURCES += diskless_size.h - - -LIBRARIES = $(LIBGRUB) - -LIBGRUB = libgrub.a -LIBGRUB_OBJS = libgrub_a-boot.o \ - libgrub_a-builtins.o \ - libgrub_a-char_io.o \ - libgrub_a-cmdline.o \ - libgrub_a-common.o \ - libgrub_a-disk_io.o \ - libgrub_a-fsys_ext2fs.o \ - libgrub_a-fsys_fat.o \ - libgrub_a-fsys_ffs.o \ - libgrub_a-fsys_iso9660.o \ - libgrub_a-fsys_jfs.o \ - libgrub_a-fsys_minix.o \ - libgrub_a-fsys_reiserfs.o \ - libgrub_a-zfs_sha256.o \ - libgrub_a-zfs_lzjb.o \ - libgrub_a-zfs_fletcher.o \ - libgrub_a-fsys_zfs.o \ - libgrub_a-fsys_ufs.o \ - libgrub_a-fsys_ufs2.o \ - libgrub_a-fsys_vstafs.o \ - libgrub_a-fsys_xfs.o \ - libgrub_a-graphics.o \ - libgrub_a-gunzip.o \ - libgrub_a-md5.o \ - libgrub_a-serial.o \ - libgrub_a-stage2.o \ - libgrub_a-terminfo.o \ - libgrub_a-tparm.o -$(LIBGRUB_OBJS) := CFLAGS = $(BASE_CFLAGS) $(GRUB_CFLAGS) - - -# Will be installed in $(ROOT_BOOT_GRUB). -INSTALL_DATA = $(E2FS_STAGE1_5_DATA) \ - $(FAT_STAGE1_5_DATA) \ - $(FFS_STAGE1_5_DATA) \ - $(ISO9660_STAGE1_5_DATA) \ - $(JFS_STAGE1_5_DATA) \ - $(MINIX_STAGE1_5_DATA) \ - $(NBGRUB_DATA) \ - $(PXEGRUB_DATA) \ - $(REISERFS_STAGE1_5_DATA) \ - $(STAGE2_DATA) \ - $(STAGE2_ELTORITO_DATA) \ - $(UFS2_STAGE1_5_DATA) \ - $(UFS_STAGE1_5_DATA) \ - $(ZFS_STAGE1_5_DATA) \ - $(VSTAFS_STAGE1_5_DATA) \ - $(XFS_STAGE1_5_DATA) - -# Won't be installed. -NOINSTALL_DATA = $(DISKLESS_DATA) \ - $(NBLOADER_DATA) \ - $(PRE_STAGE2_DATA) \ - $(PXELOADER_DATA) \ - $(START_DATA) \ - $(START_ELTORITO_DATA) - -DATA = $(INSTALL_DATA) $(NOINSTALL_DATA) - - -PROGRAMS = $(DISKLESS_EXEC) \ - $(E2FS_STAGE1_5_EXEC) \ - $(FAT_STAGE1_5_EXEC) \ - $(FFS_STAGE1_5_EXEC) \ - $(ISO9660_STAGE1_5_EXEC) \ - $(JFS_STAGE1_5_EXEC) \ - $(MINIX_STAGE1_5_EXEC) \ - $(NBLOADER_EXEC) \ - $(PRE_STAGE2_EXEC) \ - $(PXELOADER_EXEC) \ - $(REISERFS_STAGE1_5_EXEC) \ - $(START_EXEC) \ - $(START_ELTORITO_EXEC) \ - $(UFS2_STAGE1_5_EXEC) \ - $(UFS_STAGE1_5_EXEC) \ - $(ZFS_STAGE1_5_EXEC) \ - $(VSTAFS_STAGE1_5_EXEC) \ - $(XFS_STAGE1_5_EXEC) - - -# -# diskless -# -DISKLESS_DATA = diskless -DISKLESS_EXEC = diskless.exec -DISKLESS_ASMOBJS = diskless_exec-asm.o - -DISKLESS_OBJS = diskless_exec-bios.o \ - diskless_exec-boot.o \ - diskless_exec-builtins.o \ - diskless_exec-char_io.o \ - diskless_exec-cmdline.o \ - diskless_exec-common.o \ - diskless_exec-console.o \ - diskless_exec-disk_io.o \ - diskless_exec-fsys_ext2fs.o \ - diskless_exec-fsys_fat.o \ - diskless_exec-fsys_ffs.o \ - diskless_exec-fsys_iso9660.o \ - diskless_exec-fsys_jfs.o \ - diskless_exec-fsys_minix.o \ - diskless_exec-fsys_reiserfs.o \ - diskless_exec-zfs_sha256.o \ - diskless_exec-zfs_lzjb.o \ - diskless_exec-zfs_fletcher.o \ - diskless_exec-fsys_zfs.o \ - diskless_exec-fsys_ufs.o \ - diskless_exec-fsys_ufs2.o \ - diskless_exec-fsys_vstafs.o \ - diskless_exec-fsys_xfs.o \ - diskless_exec-graphics.o \ - diskless_exec-gunzip.o \ - diskless_exec-hercules.o \ - diskless_exec-md5.o \ - diskless_exec-serial.o \ - diskless_exec-smp-imps.o \ - diskless_exec-stage2.o \ - diskless_exec-terminfo.o \ - diskless_exec-tparm.o - -$(DISKLESS_EXEC) := LDFLAGS = $(BASE_LDFLAGS) $(PRE_STAGE2_LINK) -$(DISKLESS_EXEC) := LIBS = $(LIBDRIVERS) - -$(DISKLESS_ASMOBJS) := CCASFLAGS = $(BASE_CCASFLAGS) $(STAGE2_CFLAGS) \ - $(FSYS_CFLAGS) -DFSYS_TFTP=1 \ - -DSUPPORT_DISKLESS=1 - -$(DISKLESS_OBJS) := CFLAGS = $(BASE_CFLAGS) $(STAGE2_CFLAGS) \ - $(FSYS_CFLAGS) -DFSYS_TFTP=1 \ - -DSUPPORT_DISKLESS=1 - -# -# ext2fs stage 1.5 -# -E2FS_STAGE1_5_DATA = e2fs_stage1_5 -E2FS_STAGE1_5_EXEC = e2fs_stage1_5.exec - -E2FS_STAGE1_5_ASMOBJS = e2fs_stage1_5_exec-asm.o \ - e2fs_stage1_5_exec-start.o - -E2FS_STAGE1_5_OBJS = e2fs_stage1_5_exec-bios.o \ - e2fs_stage1_5_exec-char_io.o \ - e2fs_stage1_5_exec-common.o \ - e2fs_stage1_5_exec-disk_io.o \ - e2fs_stage1_5_exec-fsys_ext2fs.o \ - e2fs_stage1_5_exec-stage1_5.o - -$(E2FS_STAGE1_5_EXEC) := LDFLAGS = $(BASE_LDFLAGS) $(STAGE1_5_LINK) - -$(E2FS_STAGE1_5_ASMOBJS) := CCASFLAGS = $(BASE_CCASFLAGS) $(STAGE1_5_CFLAGS) \ - -DFSYS_EXT2FS=1 -DNO_BLOCK_FILES=1 - -$(E2FS_STAGE1_5_OBJS) := CFLAGS = $(BASE_CFLAGS) $(STAGE1_5_CFLAGS) \ - -DFSYS_EXT2FS=1 -DNO_BLOCK_FILES=1 - -# -# FAT stage 1.5 -# -FAT_STAGE1_5_DATA = fat_stage1_5 -FAT_STAGE1_5_EXEC = fat_stage1_5.exec - -FAT_STAGE1_5_ASMOBJS = fat_stage1_5_exec-asm.o \ - fat_stage1_5_exec-start.o - -FAT_STAGE1_5_OBJS = fat_stage1_5_exec-bios.o \ - fat_stage1_5_exec-char_io.o \ - fat_stage1_5_exec-common.o \ - fat_stage1_5_exec-disk_io.o \ - fat_stage1_5_exec-fsys_fat.o \ - fat_stage1_5_exec-stage1_5.o - -$(FAT_STAGE1_5_EXEC) := LDFLAGS = $(BASE_LDFLAGS) $(STAGE1_5_LINK) - -$(FAT_STAGE1_5_ASMOBJS) := CCASFLAGS = $(BASE_CCASFLAGS) $(STAGE1_5_CFLAGS) \ - -DFSYS_FAT=1 -DNO_BLOCK_FILES=1 - -$(FAT_STAGE1_5_OBJS) := CFLAGS = $(BASE_CFLAGS) $(STAGE1_5_CFLAGS) \ - -DFSYS_FAT=1 -DNO_BLOCK_FILES=1 - -# -# FFS stage 1.5 -# -FFS_STAGE1_5_DATA = ffs_stage1_5 -FFS_STAGE1_5_EXEC = ffs_stage1_5.exec - -FFS_STAGE1_5_ASMOBJS = ffs_stage1_5_exec-asm.o \ - ffs_stage1_5_exec-start.o - -FFS_STAGE1_5_OBJS = ffs_stage1_5_exec-bios.o \ - ffs_stage1_5_exec-char_io.o \ - ffs_stage1_5_exec-common.o \ - ffs_stage1_5_exec-disk_io.o \ - ffs_stage1_5_exec-fsys_ffs.o \ - ffs_stage1_5_exec-stage1_5.o - -$(FFS_STAGE1_5_EXEC) := LDFLAGS = $(BASE_LDFLAGS) $(STAGE1_5_LINK) - -$(FFS_STAGE1_5_ASMOBJS) := CCASFLAGS = $(BASE_CCASFLAGS) $(STAGE1_5_CFLAGS) \ - -DFSYS_FFS=1 -DNO_BLOCK_FILES=1 - -$(FFS_STAGE1_5_OBJS) := CFLAGS = $(BASE_CFLAGS) $(STAGE1_5_CFLAGS) \ - -DFSYS_FFS=1 -DNO_BLOCK_FILES=1 - -# -# ISO9660 stage 1.5 -# -ISO9660_STAGE1_5_DATA = iso9660_stage1_5 -ISO9660_STAGE1_5_EXEC = iso9660_stage1_5.exec - -ISO9660_STAGE1_5_ASMOBJS = iso9660_stage1_5_exec-asm.o \ - iso9660_stage1_5_exec-start_eltorito.o - -ISO9660_STAGE1_5_OBJS = iso9660_stage1_5_exec-bios.o \ - iso9660_stage1_5_exec-char_io.o \ - iso9660_stage1_5_exec-common.o \ - iso9660_stage1_5_exec-disk_io.o \ - iso9660_stage1_5_exec-fsys_iso9660.o \ - iso9660_stage1_5_exec-stage1_5.o - -$(ISO9660_STAGE1_5_EXEC) := LDFLAGS = $(BASE_LDFLAGS) $(STAGE1_5_LINK) - -$(ISO9660_STAGE1_5_ASMOBJS) := CCASFLAGS = $(BASE_CCASFLAGS) \ - $(STAGE1_5_CFLAGS) \ - -DFSYS_ISO9660=1 -DNO_BLOCK_FILES=1 - -$(ISO9660_STAGE1_5_OBJS) := CFLAGS = $(BASE_CFLAGS) $(STAGE1_5_CFLAGS) \ - -DFSYS_ISO9660=1 -DNO_BLOCK_FILES=1 - -# -# IBM JFS stage 1.5 -# -JFS_STAGE1_5_DATA = jfs_stage1_5 -JFS_STAGE1_5_EXEC = jfs_stage1_5.exec - -JFS_STAGE1_5_ASMOBJS = jfs_stage1_5_exec-asm.o \ - jfs_stage1_5_exec-start.o - -JFS_STAGE1_5_OBJS = jfs_stage1_5_exec-bios.o \ - jfs_stage1_5_exec-char_io.o \ - jfs_stage1_5_exec-common.o \ - jfs_stage1_5_exec-disk_io.o \ - jfs_stage1_5_exec-fsys_jfs.o \ - jfs_stage1_5_exec-stage1_5.o - -$(JFS_STAGE1_5_EXEC) := LDFLAGS = $(BASE_LDFLAGS) $(STAGE1_5_LINK) - -$(JFS_STAGE1_5_ASMOBJS) := CCASFLAGS = $(BASE_CCASFLAGS) $(STAGE1_5_CFLAGS) \ - -DFSYS_JFS=1 -DNO_BLOCK_FILES=1 - -$(JFS_STAGE1_5_OBJS) := CFLAGS = $(BASE_CFLAGS) $(STAGE1_5_CFLAGS) \ - -DFSYS_JFS=1 -DNO_BLOCK_FILES=1 - -# -# Minix fs stage 1.5 -# -MINIX_STAGE1_5_DATA = minix_stage1_5 -MINIX_STAGE1_5_EXEC = minix_stage1_5.exec - -MINIX_STAGE1_5_ASMOBJS = minix_stage1_5_exec-asm.o \ - minix_stage1_5_exec-start.o - -MINIX_STAGE1_5_OBJS = minix_stage1_5_exec-bios.o \ - minix_stage1_5_exec-char_io.o \ - minix_stage1_5_exec-common.o \ - minix_stage1_5_exec-disk_io.o \ - minix_stage1_5_exec-fsys_minix.o \ - minix_stage1_5_exec-stage1_5.o - -$(MINIX_STAGE1_5_EXEC) := LDFLAGS = $(BASE_LDFLAGS) $(STAGE1_5_LINK) - -$(MINIX_STAGE1_5_ASMOBJS) := CCASFLAGS = $(BASE_CCASFLAGS) $(STAGE1_5_CFLAGS) \ - -DFSYS_MINIX=1 -DNO_BLOCK_FILES=1 - -$(MINIX_STAGE1_5_OBJS) := CFLAGS = $(BASE_CFLAGS) $(STAGE1_5_CFLAGS) \ - -DFSYS_MINIX=1 -DNO_BLOCK_FILES=1 - -# -# nbgrub -# -NBGRUB_DATA = nbgrub - -# -# nbloader -# -NBLOADER_DATA = nbloader -NBLOADER_EXEC = nbloader.exec -NBLOADER_ASMOBJS = nbloader_exec-nbloader.o -NBLOADER_OBJS = -$(NBLOADER_EXEC) := LDFLAGS = $(BASE_LDFLAGS) $(NBLOADER_LINK) -$(NBLOADER_ASMOBJS) := CCASFLAGS = $(BASE_CCASFLAGS) $(STAGE2_CFLAGS) - -# -# Pre-stage2 -# -PRE_STAGE2_DATA = pre_stage2 -PRE_STAGE2_EXEC = pre_stage2.exec -PRE_STAGE2_ASMOBJS = pre_stage2_exec-asm.o - -PRE_STAGE2_OBJS = pre_stage2_exec-bios.o \ - pre_stage2_exec-boot.o \ - pre_stage2_exec-builtins.o \ - pre_stage2_exec-char_io.o \ - pre_stage2_exec-cmdline.o \ - pre_stage2_exec-common.o \ - pre_stage2_exec-console.o \ - pre_stage2_exec-disk_io.o \ - pre_stage2_exec-fsys_ext2fs.o \ - pre_stage2_exec-fsys_fat.o \ - pre_stage2_exec-fsys_ffs.o \ - pre_stage2_exec-fsys_iso9660.o \ - pre_stage2_exec-fsys_jfs.o \ - pre_stage2_exec-fsys_minix.o \ - pre_stage2_exec-fsys_reiserfs.o \ - pre_stage2_exec-zfs_sha256.o \ - pre_stage2_exec-zfs_lzjb.o \ - pre_stage2_exec-zfs_fletcher.o \ - pre_stage2_exec-fsys_zfs.o \ - pre_stage2_exec-fsys_ufs.o \ - pre_stage2_exec-fsys_ufs2.o \ - pre_stage2_exec-fsys_vstafs.o \ - pre_stage2_exec-fsys_xfs.o \ - pre_stage2_exec-graphics.o \ - pre_stage2_exec-gunzip.o \ - pre_stage2_exec-hercules.o \ - pre_stage2_exec-md5.o \ - pre_stage2_exec-serial.o \ - pre_stage2_exec-smp-imps.o \ - pre_stage2_exec-stage2.o \ - pre_stage2_exec-terminfo.o \ - pre_stage2_exec-tparm.o - -$(PRE_STAGE2_EXEC) := LDFLAGS = $(BASE_LDFLAGS) $(PRE_STAGE2_LINK) -$(STAGE2_NETBOOT)$(PRE_STAGE2_EXEC) := LIBS = $(LIBDRIVERS) - -$(PRE_STAGE2_ASMOBJS) := CCASFLAGS = $(BASE_CCASFLAGS) $(STAGE2_CFLAGS) \ - $(FSYS_CFLAGS) $(TFTP_CFLAGS) - -$(PRE_STAGE2_OBJS) := CFLAGS = $(BASE_CFLAGS) $(STAGE2_CFLAGS) \ - $(FSYS_CFLAGS) $(TFTP_CFLAGS) - -# -# pxegrub -# -PXEGRUB_DATA = pxegrub - -# -# pxeloader -# -PXELOADER_DATA = pxeloader -PXELOADER_EXEC = pxeloader.exec -PXELOADER_ASMOBJS = pxeloader_exec-pxeloader.o -PXELOADER_OBJS = -$(PXELOADER_EXEC) := LDFLAGS = $(BASE_LDFLAGS) $(PXELOADER_LINK) -$(PXELOADER_ASMOBJS) := CCASFLAGS = $(BASE_CCASFLAGS) $(STAGE2_CFLAGS) - -# -# ReiserFS stage 1.5 -# -REISERFS_STAGE1_5_DATA = reiserfs_stage1_5 -REISERFS_STAGE1_5_EXEC = reiserfs_stage1_5.exec - -REISERFS_STAGE1_5_ASMOBJS = reiserfs_stage1_5_exec-asm.o \ - reiserfs_stage1_5_exec-start.o - -REISERFS_STAGE1_5_OBJS = reiserfs_stage1_5_exec-bios.o \ - reiserfs_stage1_5_exec-char_io.o \ - reiserfs_stage1_5_exec-common.o \ - reiserfs_stage1_5_exec-disk_io.o \ - reiserfs_stage1_5_exec-fsys_reiserfs.o \ - reiserfs_stage1_5_exec-stage1_5.o - -$(REISERFS_STAGE1_5_EXEC) := LDFLAGS = $(BASE_LDFLAGS) $(STAGE1_5_LINK) - -$(REISERFS_STAGE1_5_ASMOBJS) := CCASFLAGS = $(BASE_CCASFLAGS) \ - $(STAGE1_5_CFLAGS) \ - -DFSYS_REISERFS=1 -DNO_BLOCK_FILES=1 - -$(REISERFS_STAGE1_5_OBJS) := CFLAGS = $(BASE_CFLAGS) $(STAGE1_5_CFLAGS) \ - -DFSYS_REISERFS=1 -DNO_BLOCK_FILES=1 - -# -# stage2 -# -STAGE2_DATA = stage2 - -# -# Eltorito stage2 -# -STAGE2_ELTORITO_DATA = stage2_eltorito - -# -# start -# -START_DATA = start -START_EXEC = start.exec -START_ASMOBJS = start_exec-start.o -START_OBJS = -$(START_EXEC) := LDFLAGS = $(BASE_LDFLAGS) $(START_LINK) -$(START_ASMOBJS) := CCASFLAGS = $(BASE_CCASFLAGS) $(STAGE2_CFLAGS) - -# -# Eltorito start -# -START_ELTORITO_DATA = start_eltorito -START_ELTORITO_EXEC = start_eltorito.exec -START_ELTORITO_ASMOBJS = start_eltorito_exec-start_eltorito.o -START_ELTORITO_OBJS = -$(START_ELTORITO_EXEC) := LDFLAGS = $(BASE_LDFLAGS) $(START_ELTORITO_LINK) -$(START_ELTORITO_ASMOBJS) := CCASFLAGS = $(BASE_CCASFLAGS) $(STAGE2_CFLAGS) - -# -# UFS2 stage 1.5 -# -UFS2_STAGE1_5_DATA = ufs2_stage1_5 -UFS2_STAGE1_5_EXEC = ufs2_stage1_5.exec - -UFS2_STAGE1_5_ASMOBJS = ufs2_stage1_5_exec-asm.o \ - ufs2_stage1_5_exec-start.o - -UFS2_STAGE1_5_OBJS = ufs2_stage1_5_exec-bios.o \ - ufs2_stage1_5_exec-char_io.o \ - ufs2_stage1_5_exec-common.o \ - ufs2_stage1_5_exec-disk_io.o \ - ufs2_stage1_5_exec-fsys_ufs2.o \ - ufs2_stage1_5_exec-stage1_5.o - -$(UFS2_STAGE1_5_EXEC) := LDFLAGS = $(BASE_LDFLAGS) $(STAGE1_5_LINK) - -$(UFS2_STAGE1_5_ASMOBJS) := CCASFLAGS = $(BASE_CCASFLAGS) $(STAGE1_5_CFLAGS) \ - -DFSYS_UFS2=1 -DNO_BLOCK_FILES=1 - -$(UFS2_STAGE1_5_OBJS) := CFLAGS = $(BASE_CFLAGS) $(STAGE1_5_CFLAGS) \ - -DFSYS_UFS2=1 -DNO_BLOCK_FILES=1 - -# -# UFS stage 1.5 -# -UFS_STAGE1_5_DATA = ufs_stage1_5 -UFS_STAGE1_5_EXEC = ufs_stage1_5.exec - -UFS_STAGE1_5_ASMOBJS = ufs_stage1_5_exec-asm.o \ - ufs_stage1_5_exec-start.o - -UFS_STAGE1_5_OBJS = ufs_stage1_5_exec-bios.o \ - ufs_stage1_5_exec-char_io.o \ - ufs_stage1_5_exec-common.o \ - ufs_stage1_5_exec-disk_io.o \ - ufs_stage1_5_exec-fsys_ufs.o \ - ufs_stage1_5_exec-stage1_5.o - -$(UFS_STAGE1_5_EXEC) := LDFLAGS = $(BASE_LDFLAGS) $(STAGE1_5_LINK) - -$(UFS_STAGE1_5_ASMOBJS) := CCASFLAGS = $(BASE_CCASFLAGS) $(STAGE1_5_CFLAGS) \ - -DFSYS_UFS=1 -DNO_BLOCK_FILES=1 - -$(UFS_STAGE1_5_OBJS) := CFLAGS = $(BASE_CFLAGS) $(STAGE1_5_CFLAGS) \ - -DFSYS_UFS=1 -DNO_BLOCK_FILES=1 - -# -# ZFS stage 1.5 -# -ZFS_STAGE1_5_DATA = zfs_stage1_5 -ZFS_STAGE1_5_EXEC = zfs_stage1_5.exec - -ZFS_STAGE1_5_ASMOBJS = zfs_stage1_5_exec-asm.o \ - zfs_stage1_5_exec-start.o - -ZFS_STAGE1_5_OBJS = zfs_stage1_5_exec-bios.o \ - zfs_stage1_5_exec-char_io.o \ - zfs_stage1_5_exec-common.o \ - zfs_stage1_5_exec-disk_io.o \ - zfs_stage1_5_exec-zfs_sha256.o \ - zfs_stage1_5_exec-zfs_lzjb.o \ - zfs_stage1_5_exec-zfs_fletcher.o \ - zfs_stage1_5_exec-fsys_zfs.o \ - zfs_stage1_5_exec-stage1_5.o - -$(ZFS_STAGE1_5_EXEC) := LDFLAGS = $(BASE_LDFLAGS) $(STAGE1_5_LINK) - -$(ZFS_STAGE1_5_ASMOBJS) := CCASFLAGS = $(BASE_CCASFLAGS) $(STAGE1_5_CFLAGS) \ - -DFSYS_ZFS=1 -DNO_BLOCK_FILES=1 - -$(ZFS_STAGE1_5_OBJS) := CFLAGS = $(BASE_CFLAGS) $(STAGE1_5_CFLAGS) \ - -DFSYS_ZFS=1 -DNO_BLOCK_FILES=1 - -# -# VSTa FS -# -VSTAFS_STAGE1_5_DATA = vstafs_stage1_5 -VSTAFS_STAGE1_5_EXEC = vstafs_stage1_5.exec - -VSTAFS_STAGE1_5_ASMOBJS = vstafs_stage1_5_exec-asm.o \ - vstafs_stage1_5_exec-start.o - -VSTAFS_STAGE1_5_OBJS = vstafs_stage1_5_exec-bios.o \ - vstafs_stage1_5_exec-char_io.o \ - vstafs_stage1_5_exec-common.o \ - vstafs_stage1_5_exec-disk_io.o \ - vstafs_stage1_5_exec-fsys_vstafs.o \ - vstafs_stage1_5_exec-stage1_5.o - -$(VSTAFS_STAGE1_5_EXEC) := LDFLAGS = $(BASE_LDFLAGS) $(STAGE1_5_LINK) - -$(VSTAFS_STAGE1_5_ASMOBJS) := CCASFLAGS = $(BASE_CCASFLAGS) $(STAGE1_5_CFLAGS) \ - -DFSYS_VSTAFS=1 -DNO_BLOCK_FILES=1 - -$(VSTAFS_STAGE1_5_OBJS) := CFLAGS = $(BASE_CFLAGS) $(STAGE1_5_CFLAGS) \ - -DFSYS_VSTAFS=1 -DNO_BLOCK_FILES=1 - -# -# SGI XFS stage 1.5 -# -XFS_STAGE1_5_DATA = xfs_stage1_5 -XFS_STAGE1_5_EXEC = xfs_stage1_5.exec - -XFS_STAGE1_5_ASMOBJS = xfs_stage1_5_exec-asm.o \ - xfs_stage1_5_exec-start.o - -XFS_STAGE1_5_OBJS = xfs_stage1_5_exec-bios.o \ - xfs_stage1_5_exec-char_io.o \ - xfs_stage1_5_exec-common.o \ - xfs_stage1_5_exec-disk_io.o \ - xfs_stage1_5_exec-fsys_xfs.o \ - xfs_stage1_5_exec-stage1_5.o - -$(XFS_STAGE1_5_EXEC) := LDFLAGS = $(BASE_LDFLAGS) $(STAGE1_5_LINK) - -$(XFS_STAGE1_5_ASMOBJS) := CCASFLAGS = $(BASE_CCASFLAGS) $(STAGE1_5_CFLAGS) \ - -DFSYS_XFS=1 -DNO_BLOCK_FILES=1 - -$(XFS_STAGE1_5_OBJS) := CFLAGS = $(BASE_CFLAGS) $(STAGE1_5_CFLAGS) \ - -DFSYS_XFS=1 -DNO_BLOCK_FILES=1 - - -INSTALL_TARGETS = $(INSTALL_DATA:%=$(ROOT_BOOT_GRUB)/%) \ - $(SRC_ZFSINC_DIR) - -# -# Source files to be installed in $(ROOT_SRC). -# -SRC_DIR = $(ROOT_SRC)/stage2 -SRC_ZFSINC_DIR = $(SRC_DIR)/zfs-include -SRC_FILES = Makefile.am Makefile.in apic.h apm.S asm.S bios.c boot.c \ - builtins.c char_io.c cmdline.c common.c console.c defs.h \ - dir.h disk_inode.h disk_inode_ffs.h disk_io.c fat.h \ - filesys.h freebsd.h fs.h fsys_ext2fs.c fsys_fat.c \ - fsys_ffs.c fsys_iso9660.c fsys_jfs.c fsys_minix.c \ - zfs_sha256.c zfs_lzjb.c zfs_fletcher.c fsys_zfs.c \ - fsys_reiserfs.c fsys_ufs.c fsys_ufs2.c fsys_vstafs.c \ - fsys_xfs.c graphics.c graphics.h gunzip.c hercules.c \ - hercules.h i386-elf.h imgact_aout.h iso9660.h jfs.h \ - mb_header.h mb_info.h md5.c md5.h nbi.h nbloader.S \ - pc_slice.h pxeloader.S serial.c serial.h setjmp.S shared.h \ - size_test smp-imps.c smp-imps.h stage1_5.c stage2.c \ - start.S start_eltorito.S term.h terminfo.c terminfo.h \ - tparm.c tparm.h fsys_zfs.h ufs.h ufs2.h vstafs.h xfs.h -SRC_ZFSINC_FILES = dmu.h dmu_objset.h dnode.h dsl_dataset.h dsl_dir.h spa.h \ - uberblock_impl.h vdev_impl.h zap_impl.h zap_leaf.h zfs.h \ - zfs_acl.h zfs_znode.h zil.h zio.h zio_checksum.h - -INSTALL_TARGETS += $(SRC_FILES:%=$(SRC_DIR)/%) \ - $(SRC_ZFSINC_FILES:%=$(SRC_ZFSINC_DIR)/%) - - -############################################################################### -all: $(BUILT_SOURCES) .WAIT $(LIBRARIES) $(PROGRAMS) $(DATA) - -# -# BUILT_SOURCES -# -stage2_size.h: $(PRE_STAGE2_DATA) - $(RM) $@ - set dummy `ls -l $(PRE_STAGE2_DATA)`; \ - echo "#define STAGE2_SIZE $$6" > $@ - -diskless_size.h: $(DISKLESS_DATA) - $(RM) $@ - set dummy `ls -l $(DISKLESS_DATA)`; \ - echo "#define DISKLESS_SIZE $$6" > $@ - -# -# LIBRARIES -# -$(LIBGRUB): $(LIBGRUB_OBJS) - $(RM) $@ - $(AR) cru $@ $(LIBGRUB_OBJS) - $(RANLIB) $@ - -$(LIBGRUB_OBJS): $$(@:libgrub_a-%.o=%.c) - $(CC) $(CFLAGS) -c -o $@ $(@:libgrub_a-%.o=%.c) - - -# -# Diskless -# -$(DISKLESS_EXEC): $(DISKLESS_ASMOBJS) $(DISKLESS_OBJS) - $(RM) $@ - $(LINK) -o $@ $(DISKLESS_ASMOBJS) $(DISKLESS_OBJS) $(LIBS) - -$(DISKLESS_ASMOBJS): $$(@:diskless_exec-%.o=%.S) - $(CCAS) $(CCASFLAGS) -c -o $@ $(@:diskless_exec-%.o=%.S) - -$(DISKLESS_OBJS): $$(@:diskless_exec-%.o=%.c) - $(CC) $(CFLAGS) -c -o $@ $(@:diskless_exec-%.o=%.c) - -# -# ext2fs stage 1.5 -# -$(E2FS_STAGE1_5_EXEC): $(E2FS_STAGE1_5_ASMOBJS) $(E2FS_STAGE1_5_OBJS) - $(RM) $@ - $(LINK) -o $@ $(E2FS_STAGE1_5_ASMOBJS) $(E2FS_STAGE1_5_OBJS) $(LIBS) - -$(E2FS_STAGE1_5_ASMOBJS): $$(@:e2fs_stage1_5_exec-%.o=%.S) - $(CCAS) $(CCASFLAGS) -c -o $@ $(@:e2fs_stage1_5_exec-%.o=%.S) - -$(E2FS_STAGE1_5_OBJS): $$(@:e2fs_stage1_5_exec-%.o=%.c) - $(CC) $(CFLAGS) -c -o $@ $(@:e2fs_stage1_5_exec-%.o=%.c) - -# -# FAT stage 1.5 -# -$(FAT_STAGE1_5_EXEC): $(FAT_STAGE1_5_ASMOBJS) $(FAT_STAGE1_5_OBJS) - $(RM) $@ - $(LINK) -o $@ $(FAT_STAGE1_5_ASMOBJS) $(FAT_STAGE1_5_OBJS) $(LIBS) - -$(FAT_STAGE1_5_ASMOBJS): $$(@:fat_stage1_5_exec-%.o=%.S) - $(CCAS) $(CCASFLAGS) -c -o $@ $(@:fat_stage1_5_exec-%.o=%.S) - -$(FAT_STAGE1_5_OBJS): $$(@:fat_stage1_5_exec-%.o=%.c) - $(CC) $(CFLAGS) -c -o $@ $(@:fat_stage1_5_exec-%.o=%.c) - -# -# FFS stage 1.5 -# -$(FFS_STAGE1_5_EXEC): $(FFS_STAGE1_5_ASMOBJS) $(FFS_STAGE1_5_OBJS) - $(RM) $@ - $(LINK) -o $@ $(FFS_STAGE1_5_ASMOBJS) $(FFS_STAGE1_5_OBJS) $(LIBS) - -$(FFS_STAGE1_5_ASMOBJS): $$(@:ffs_stage1_5_exec-%.o=%.S) - $(CCAS) $(CCASFLAGS) -c -o $@ $(@:ffs_stage1_5_exec-%.o=%.S) - -$(FFS_STAGE1_5_OBJS): $$(@:ffs_stage1_5_exec-%.o=%.c) - $(CC) $(CFLAGS) -c -o $@ $(@:ffs_stage1_5_exec-%.o=%.c) - -# -# ISO9660 stage 1.5 -# -$(ISO9660_STAGE1_5_EXEC): $(ISO9660_STAGE1_5_ASMOBJS) $(ISO9660_STAGE1_5_OBJS) - $(RM) $@ - $(LINK) -o $@ $(ISO9660_STAGE1_5_ASMOBJS) $(ISO9660_STAGE1_5_OBJS) \ - $(LIBS) - -$(ISO9660_STAGE1_5_ASMOBJS): $$(@:iso9660_stage1_5_exec-%.o=%.S) - $(CCAS) $(CCASFLAGS) -c -o $@ $(@:iso9660_stage1_5_exec-%.o=%.S) - -$(ISO9660_STAGE1_5_OBJS): $$(@:iso9660_stage1_5_exec-%.o=%.c) - $(CC) $(CFLAGS) -c -o $@ $(@:iso9660_stage1_5_exec-%.o=%.c) - -# -# JFS stage 1.5 -# -$(JFS_STAGE1_5_EXEC): $(JFS_STAGE1_5_ASMOBJS) $(JFS_STAGE1_5_OBJS) - $(RM) $@ - $(LINK) -o $@ $(JFS_STAGE1_5_ASMOBJS) $(JFS_STAGE1_5_OBJS) $(LIBS) - -$(JFS_STAGE1_5_ASMOBJS): $$(@:jfs_stage1_5_exec-%.o=%.S) - $(CCAS) $(CCASFLAGS) -c -o $@ $(@:jfs_stage1_5_exec-%.o=%.S) - -$(JFS_STAGE1_5_OBJS): $$(@:jfs_stage1_5_exec-%.o=%.c) - $(CC) $(CFLAGS) -c -o $@ $(@:jfs_stage1_5_exec-%.o=%.c) - -# -# Minix stage 1.5 -# -$(MINIX_STAGE1_5_EXEC): $(MINIX_STAGE1_5_ASMOBJS) $(MINIX_STAGE1_5_OBJS) - $(RM) $@ - $(LINK) -o $@ $(MINIX_STAGE1_5_ASMOBJS) $(MINIX_STAGE1_5_OBJS) $(LIBS) - -$(MINIX_STAGE1_5_ASMOBJS): $$(@:minix_stage1_5_exec-%.o=%.S) - $(CCAS) $(CCASFLAGS) -c -o $@ $(@:minix_stage1_5_exec-%.o=%.S) - -$(MINIX_STAGE1_5_OBJS): $$(@:minix_stage1_5_exec-%.o=%.c) - $(CC) $(CFLAGS) -c -o $@ $(@:minix_stage1_5_exec-%.o=%.c) - -# -# nbgrub -# -$(NBGRUB_DATA): $(NBLOADER_DATA) $(DISKLESS_DATA) - $(RM) $@ - cat $(NBLOADER_DATA) $(DISKLESS_DATA) > $@ - -# -# nbloader -# -$(NBLOADER_EXEC): $(NBLOADER_ASMOBJS) $(NBLOADER_OBJS) - $(RM) $@ - $(LINK) -o $@ $(NBLOADER_ASMOBJS) $(NBLOADER_OBJS) $(LIBS) - -$(NBLOADER_ASMOBJS): $$(@:nbloader_exec-%.o=%.S) diskless_size.h - $(CCAS) $(CCASFLAGS) -c -o $@ $(@:nbloader_exec-%.o=%.S) - -$(NBLOADER_OBJS): $$(@:nbloader_exec-%.o=%.c) - $(CC) $(CFLAGS) -c -o $@ $(@:nbloader_exec-%.o=%.c) - -# -# Pre-stage2 -# -$(PRE_STAGE2_EXEC): $(PRE_STAGE2_ASMOBJS) $(PRE_STAGE2_OBJS) - $(RM) $@ - $(LINK) -o $@ $(PRE_STAGE2_ASMOBJS) $(PRE_STAGE2_OBJS) $(LIBS) - -$(PRE_STAGE2_ASMOBJS): $$(@:pre_stage2_exec-%.o=%.S) - $(CCAS) $(CCASFLAGS) -c -o $@ $(@:pre_stage2_exec-%.o=%.S) - -$(PRE_STAGE2_OBJS): $$(@:pre_stage2_exec-%.o=%.c) - $(CC) $(CFLAGS) -c -o $@ $(@:pre_stage2_exec-%.o=%.c) - -# -# pxegrub -# -$(PXEGRUB_DATA): $(PXELOADER_DATA) $(DISKLESS_DATA) - $(RM) $@ - cat $(PXELOADER_DATA) $(DISKLESS_DATA) > $@ - -# -# pxeloader -# -$(PXELOADER_EXEC): $(PXELOADER_ASMOBJS) $(PXELOADER_OBJS) - $(RM) $@ - $(LINK) -o $@ $(PXELOADER_ASMOBJS) $(PXELOADER_OBJS) $(LIBS) - -$(PXELOADER_ASMOBJS): $$(@:pxeloader_exec-%.o=%.S) diskless_size.h - $(CCAS) $(CCASFLAGS) -c -o $@ $(@:pxeloader_exec-%.o=%.S) - -$(PXELOADER_OBJS): $$(@:pxeloader_exec-%.o=%.c) - $(CC) $(CFLAGS) -c -o $@ $(@:pxeloader_exec-%.o=%.c) - -# -# ReiserFS stage 1.5 -# -$(REISERFS_STAGE1_5_EXEC): $(REISERFS_STAGE1_5_ASMOBJS) \ - $(REISERFS_STAGE1_5_OBJS) - $(RM) $@ - $(LINK) -o $@ $(REISERFS_STAGE1_5_ASMOBJS) $(REISERFS_STAGE1_5_OBJS) \ - $(LIBS) - -$(REISERFS_STAGE1_5_ASMOBJS): $$(@:reiserfs_stage1_5_exec-%.o=%.S) - $(CCAS) $(CCASFLAGS) -c -o $@ $(@:reiserfs_stage1_5_exec-%.o=%.S) - -$(REISERFS_STAGE1_5_OBJS): $$(@:reiserfs_stage1_5_exec-%.o=%.c) - $(CC) $(CFLAGS) -c -o $@ $(@:reiserfs_stage1_5_exec-%.o=%.c) - -# -# stage2 -# -$(STAGE2_DATA): $(START_DATA) $(PRE_STAGE2_DATA) - $(RM) $@ - cat $(START_DATA) $(PRE_STAGE2_DATA) > $@ -# -# Eltorito stage2 -# -$(STAGE2_ELTORITO_DATA): $(START_ELTORITO_DATA) $(PRE_STAGE2_DATA) - $(RM) $@ - cat $(START_ELTORITO_DATA) $(PRE_STAGE2_DATA) > $@ - -# -# start -# -$(START_EXEC): $(START_ASMOBJS) $(START_OBJS) - $(RM) $@ - $(LINK) -o $@ $(START_ASMOBJS) $(START_OBJS) $(LIBS) - -$(START_ASMOBJS): $$(@:start_exec-%.o=%.S) stage2_size.h - $(CCAS) $(CCASFLAGS) -c -o $@ $(@:start_exec-%.o=%.S) - -$(START_OBJS): $$(@:start_exec-%.o=%.c) - $(CC) $(CFLAGS) -c -o $@ $(@:start_exec-%.o=%.c) - -# -# Eltorito start -# -$(START_ELTORITO_EXEC): $(START_ELTORITO_ASMOBJS) $(START_ELTORITO_OBJS) - $(RM) $@ - $(LINK) -o $@ $(START_ELTORITO_ASMOBJS) $(START_ELTORITO_OBJS) $(LIBS) - -$(START_ELTORITO_ASMOBJS): $$(@:start_eltorito_exec-%.o=%.S) stage2_size.h - $(CCAS) $(CCASFLAGS) -c -o $@ $(@:start_eltorito_exec-%.o=%.S) - -$(START_ELTORITO_OBJS): $$(@:start_eltorito_exec-%.o=%.c) - $(CC) $(CFLAGS) -c -o $@ $(@:start_eltorito_exec-%.o=%.c) - -# -# UFS2 stage 1.5 -# -$(UFS2_STAGE1_5_EXEC): $(UFS2_STAGE1_5_ASMOBJS) $(UFS2_STAGE1_5_OBJS) - $(RM) $@ - $(LINK) -o $@ $(UFS2_STAGE1_5_ASMOBJS) $(UFS2_STAGE1_5_OBJS) $(LIBS) - -$(UFS2_STAGE1_5_ASMOBJS): $$(@:ufs2_stage1_5_exec-%.o=%.S) - $(CCAS) $(CCASFLAGS) -c -o $@ $(@:ufs2_stage1_5_exec-%.o=%.S) - -$(UFS2_STAGE1_5_OBJS): $$(@:ufs2_stage1_5_exec-%.o=%.c) - $(CC) $(CFLAGS) -c -o $@ $(@:ufs2_stage1_5_exec-%.o=%.c) - -# -# UFS stage 1.5 -# -$(UFS_STAGE1_5_EXEC): $(UFS_STAGE1_5_ASMOBJS) $(UFS_STAGE1_5_OBJS) - $(RM) $@ - $(LINK) -o $@ $(UFS_STAGE1_5_ASMOBJS) $(UFS_STAGE1_5_OBJS) $(LIBS) - -$(UFS_STAGE1_5_ASMOBJS): $$(@:ufs_stage1_5_exec-%.o=%.S) - $(CCAS) $(CCASFLAGS) -c -o $@ $(@:ufs_stage1_5_exec-%.o=%.S) - -$(UFS_STAGE1_5_OBJS): $$(@:ufs_stage1_5_exec-%.o=%.c) - $(CC) $(CFLAGS) -c -o $@ $(@:ufs_stage1_5_exec-%.o=%.c) - -# -# ZFS stage 1.5 -# -$(ZFS_STAGE1_5_EXEC): $(ZFS_STAGE1_5_ASMOBJS) $(ZFS_STAGE1_5_OBJS) - $(RM) $@ - $(LINK) -o $@ $(ZFS_STAGE1_5_ASMOBJS) $(ZFS_STAGE1_5_OBJS) $(LIBS) - -$(ZFS_STAGE1_5_ASMOBJS): $$(@:zfs_stage1_5_exec-%.o=%.S) - $(CCAS) $(CCASFLAGS) -c -o $@ $(@:zfs_stage1_5_exec-%.o=%.S) - -$(ZFS_STAGE1_5_OBJS): $$(@:zfs_stage1_5_exec-%.o=%.c) - $(CC) $(CFLAGS) -c -o $@ $(@:zfs_stage1_5_exec-%.o=%.c) - -# -# VSTa stage 1.5 -# -$(VSTAFS_STAGE1_5_EXEC): $(VSTAFS_STAGE1_5_ASMOBJS) $(VSTAFS_STAGE1_5_OBJS) - $(RM) $@ - $(LINK) -o $@ $(VSTAFS_STAGE1_5_ASMOBJS) $(VSTAFS_STAGE1_5_OBJS) $(LIBS) - -$(VSTAFS_STAGE1_5_ASMOBJS): $$(@:vstafs_stage1_5_exec-%.o=%.S) - $(CCAS) $(CCASFLAGS) -c -o $@ $(@:vstafs_stage1_5_exec-%.o=%.S) - -$(VSTAFS_STAGE1_5_OBJS): $$(@:vstafs_stage1_5_exec-%.o=%.c) - $(CC) $(CFLAGS) -c -o $@ $(@:vstafs_stage1_5_exec-%.o=%.c) - -# -# SGI XFS stage 1.5 -# -$(XFS_STAGE1_5_EXEC): $(XFS_STAGE1_5_ASMOBJS) $(XFS_STAGE1_5_OBJS) - $(RM) $@ - $(LINK) -o $@ $(XFS_STAGE1_5_ASMOBJS) $(XFS_STAGE1_5_OBJS) $(LIBS) - -$(XFS_STAGE1_5_ASMOBJS): $$(@:xfs_stage1_5_exec-%.o=%.S) - $(CCAS) $(CCASFLAGS) -c -o $@ $(@:xfs_stage1_5_exec-%.o=%.S) - -$(XFS_STAGE1_5_OBJS): $$(@:xfs_stage1_5_exec-%.o=%.c) - $(CC) $(CFLAGS) -c -o $@ $(@:xfs_stage1_5_exec-%.o=%.c) - - - -install: all $(INSTALL_TARGETS) - -$(ROOT_BOOT_GRUB)/%: $(ROOT_BOOT_GRUB) % - $(INS.file) - -$(SRC_DIR)/%: $(SRC_DIR) % - $(INS.file) - -$(SRC_ZFSINC_DIR)/%: $(SRC_ZFSINC_DIR) % - $(INS.file) - -$(ROOT_BOOT_GRUB) $(SRC_DIR) $(SRC_ZFSINC_DIR): - $(INS.dir) - -clean: _FORCE - $(RM) *.o $(BUILT_SOURCES) $(LIBRARIES) $(PROGRAMS) $(NOINSTALL_DATA) - -clobber: clean - $(RM) $(INSTALL_DATA) - -_FORCE: diff --git a/usr/src/grub/grub-0.95/stage2/apic.h b/usr/src/grub/grub-0.95/stage2/apic.h deleted file mode 100644 index 9241329c73..0000000000 --- a/usr/src/grub/grub-0.95/stage2/apic.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * - * - * Author: Erich Boleyn http://www.uruk.org/~erich/ - * - * Header file for Intel Architecture local and I/O APIC definitions. - * - * This file was created from information in the Intel Pentium Pro - * Family Developer's Manual, Volume 3: Operating System Writer's - * Manual, order number 242692-001, which can be ordered from the - * Intel literature center. - */ - -#ifndef _APIC_H -#define _APIC_H - -/* - * APIC Defines. - */ - -#define APIC_BROADCAST_ID 0xFF - -/* - * APIC register definitions - */ - -/* - * Shared defines for I/O and local APIC definitions - */ -/* APIC version register */ -#define APIC_VERSION(x) ((x) & 0xFF) -/* if the APIC version is equal or greater than APIC_VER_NEW, it - is a "new" APIC */ -#define APIC_VER_NEW 0x10 -/* this next one is used in all cases but an old local APIC, which has - 2 entries in it's LVT */ -#define APIC_MAXREDIR(x) (((x) >> 16) & 0xFF) -/* APIC id register */ -#define APIC_OLD_ID(x) ((x) >> 24) -#define APIC_NEW_ID(x) (((x) >> 24) & 0xF) - -#define IOAPIC_REGSEL 0 -#define IOAPIC_RW 0x10 -#define IOAPIC_ID 0 -#define IOAPIC_VER 1 -#define IOAPIC_REDIR 0x10 -#define LAPIC_ID 0x20 -#define LAPIC_VER 0x30 -#define LAPIC_TPR 0x80 -#define LAPIC_APR 0x90 -#define LAPIC_PPR 0xA0 -#define LAPIC_EOI 0xB0 -#define LAPIC_LDR 0xD0 -#define LAPIC_DFR 0xE0 -#define LAPIC_SPIV 0xF0 -#define LAPIC_SPIV_ENABLE_APIC 0x100 -#define LAPIC_ISR 0x100 -#define LAPIC_TMR 0x180 -#define LAPIC_IRR 0x200 -#define LAPIC_ESR 0x280 -#define LAPIC_ICR 0x300 -#define LAPIC_DEST_MASK 0xFFFFFF -#define LAPIC_LVTT 0x320 -#define LAPIC_LVTPC 0x340 -#define LAPIC_LVT0 0x350 -#define LAPIC_LVT1 0x360 -#define LAPIC_LVTE 0x370 -#define LAPIC_TICR 0x380 -#define LAPIC_TCCR 0x390 -#define LAPIC_TDCR 0x3E0 - -#endif /* _APIC_H */ diff --git a/usr/src/grub/grub-0.95/stage2/apm.S b/usr/src/grub/grub-0.95/stage2/apm.S deleted file mode 100644 index abf5e271c2..0000000000 --- a/usr/src/grub/grub-0.95/stage2/apm.S +++ /dev/null @@ -1,125 +0,0 @@ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 2000, 2001 Free Software Foundation, 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 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. - */ - -/* This is stolen from arch/i386/boot/setup.S in Linux 2.2.17 */ -/* -! setup.S Copyright (C) 1991, 1992 Linus Torvalds -*/ - -ENTRY(get_apm_info) - pushl %ebp - pushl %ebx - pushl %edi - pushl %esi - - call EXT_C(prot_to_real) - .code16 - - /* APM BIOS installation check */ - movw $0x5300, %ax - xorw %bx, %bx - int $0x15 - /* error -> no APM BIOS */ - jc done_apm_bios - - /* check for "PM" signature */ - cmpw $0x504d, %bx - /* no signature -> no APM BIOS */ - jne done_apm_bios - - /* Is 32 bit supported? */ - andw $0x0002, %cx - /* no ... */ - je done_apm_bios - - /* Disconnect first just in case */ - movw $0x5304, %ax - xorw %bx, %bx - /* ignore return code */ - int $0x15 - - /* 32 bit connect */ - movw $0x5303, %ax - xorl %ebx, %ebx - /* paranoia */ - xorw %cx, %cx - xorw %dx, %dx - xorl %esi, %esi - xorw %di, %di - int $0x15 - /* error */ - jc no_32_apm_bios - - /* BIOS code segment */ - movw %ax, ABS(EXT_C(apm_bios_info)) + 2 - /* BIOS entry point offset */ - movl %ebx, ABS(EXT_C(apm_bios_info)) + 4 - /* BIOS 16 bit code segment */ - movw %cx, ABS(EXT_C(apm_bios_info)) + 8 - /* BIOS data segment */ - movw %dx, ABS(EXT_C(apm_bios_info)) + 10 - /* BIOS code segment length */ - movl %esi, ABS(EXT_C(apm_bios_info)) + 14 - /* BIOS data segment length */ - movw %di, ABS(EXT_C(apm_bios_info)) + 18 - - /* - * Redo the installation check as the 32 bit connect - * modifies the flags returned on some BIOSs - */ - - /* APM BIOS installation check */ - movw $0x5300, %ax - xorw %bx, %bx - /* paranoia */ - xorw %cx, %cx - int $0x15 - /* error -> should not happen, tidy up */ - jc done_apm_bios - - /* check for "PM" signature */ - cmpw $0x504d, %bx - /* no signature -> should not happen, tidy up */ - jne done_apm_bios - - /* record the APM BIOS version */ - movw %ax, ABS(EXT_C(apm_bios_info)) - /* and flags */ - movw %cx, ABS(EXT_C(apm_bios_info)) + 12 - jmp done_apm_bios - -no_32_apm_bios: - /* remove 32 bit support bit */ - andw $0xfffd, ABS(EXT_C(apm_bios_info)) + 12 - -done_apm_bios: - /* Some paranoia here: Always Disconnect from APM */ - movw $0x5304, %ax - xorw %bx, %bx - /* ignore return code */ - int $0x15 - - DATA32 call EXT_C(real_to_prot) - .code32 - - popl %esi - popl %edi - popl %ebx - popl %ebp - ret diff --git a/usr/src/grub/grub-0.95/stage2/asm.S b/usr/src/grub/grub-0.95/stage2/asm.S deleted file mode 100644 index 1952421725..0000000000 --- a/usr/src/grub/grub-0.95/stage2/asm.S +++ /dev/null @@ -1,2755 +0,0 @@ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 1999,2000,2001,2002,2004 Free Software Foundation, 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 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. - */ - - -/* - * Note: These functions defined in this file may be called from C. - * Be careful of that you must not modify some registers. Quote - * from gcc-2.95.2/gcc/config/i386/i386.h: - - 1 for registers not available across function calls. - These must include the FIXED_REGISTERS and also any - registers that can be used without being saved. - The latter must include the registers where values are returned - and the register where structure-value addresses are passed. - Aside from that, you can include as many other registers as you like. - - ax,dx,cx,bx,si,di,bp,sp,st,st1,st2,st3,st4,st5,st6,st7,arg -{ 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } - */ - -#define ASM_FILE - -#include "shared.h" - -#ifdef STAGE1_5 -# define ABS(x) ((x) - EXT_C(main) + 0x2200) -#else -# define ABS(x) ((x) - EXT_C(main) + 0x8200) -#endif - - .file "asm.S" - - .text - - /* Tell GAS to generate 16-bit instructions so that this code works - in real mode. */ - .code16 - -#ifndef STAGE1_5 - /* - * In stage2, do not link start.S with the rest of the source - * files directly, so define the start symbols here just to - * force ld quiet. These are not referred anyway. - */ - .globl start, _start -start: -_start: -#endif /* ! STAGE1_5 */ - -ENTRY(main) - /* - * Guarantee that "main" is loaded at 0x0:0x8200 in stage2 and - * at 0x0:0x2200 in stage1.5. - */ - ljmp $0, $ABS(codestart) - - /* - * Compatibility version number - * - * These MUST be at byte offset 6 and 7 of the executable - * DO NOT MOVE !!! - */ - . = EXT_C(main) + 0x6 - .byte COMPAT_VERSION_MAJOR, COMPAT_VERSION_MINOR - - /* - * This is a special data area 8 bytes from the beginning. - */ - - . = EXT_C(main) + 0x8 - -VARIABLE(install_partition) - .long 0xFFFFFF -/* This variable is here only because of a historical reason. */ -VARIABLE(saved_entryno) - .long 0 -VARIABLE(stage2_id) - .byte STAGE2_ID -VARIABLE(force_lba) - .byte 0 -VARIABLE(version_string) - .string VERSION -VARIABLE(config_file) -#ifndef STAGE1_5 - .string "/boot/grub/menu.lst" -#else /* STAGE1_5 */ - .long 0xffffffff - .string "/boot/grub/stage2" -#endif /* STAGE1_5 */ - - /* - * Leave some breathing room for the config file name. - */ - - . = EXT_C(main) + 0x70 - -/* the real mode code continues... */ -codestart: - cli /* we're not safe here! */ - - /* set up %ds, %ss, and %es */ - xorw %ax, %ax - movw %ax, %ds - movw %ax, %ss - movw %ax, %es - -#ifndef SUPPORT_DISKLESS - /* - * Save the sector number of the second sector (i.e. this sector) - * in INSTALL_SECOND_SECTOR. See also "stage2/start.S". - */ - ADDR32 movl %ebp, EXT_C(install_second_sector) -#endif - - /* set up the real mode/BIOS stack */ - movl $STACKOFF, %ebp - movl %ebp, %esp - - sti /* we're safe again */ - -#ifndef SUPPORT_DISKLESS - /* save boot drive reference */ - ADDR32 movb %dl, EXT_C(boot_drive) - - /* reset disk system (%ah = 0) */ - int $0x13 -#endif - - /* transition to protected mode */ - DATA32 call EXT_C(real_to_prot) - - /* The ".code32" directive takes GAS out of 16-bit mode. */ - .code32 - - /* clean out the bss */ - - /* set %edi to the bss starting address */ -#if defined(HAVE_USCORE_USCORE_BSS_START_SYMBOL) - movl $__bss_start, %edi -#elif defined(HAVE_USCORE_EDATA_SYMBOL) - movl $_edata, %edi -#elif defined(HAVE_EDATA_SYMBOL) - movl $edata, %edi -#endif - - /* set %ecx to the bss end */ -#if defined(HAVE_END_SYMBOL) - movl $end, %ecx -#elif defined(HAVE_USCORE_END_SYMBOL) - movl $_end, %ecx -#endif - - /* compute the bss length */ - subl %edi, %ecx - - /* zero %al */ - xorb %al, %al - - /* set the direction */ - cld - - /* clean out */ - rep - stosb - - /* - * Call the start of main body of C code, which does some - * of it's own initialization before transferring to "cmain". - */ - call EXT_C(init_bios_info) - - -/* - * This call is special... it never returns... in fact it should simply - * hang at this point! - */ - -ENTRY(stop) - call EXT_C(prot_to_real) - - /* - * This next part is sort of evil. It takes advantage of the - * byte ordering on the x86 to work in either 16-bit or 32-bit - * mode, so think about it before changing it. - */ - -ENTRY(hard_stop) - hlt - jmp EXT_C(hard_stop) - -#ifndef STAGE1_5 - -/************************************************************************** -UNDI_CALL - wrapper around real-mode UNDI API calls -**************************************************************************/ -ENTRY(__undi_call) - pushl %ebp - movl %esp,%ebp - pushl %esi - pushl %edi - pushl %ebx - - movw 8(%ebp),%cx /* Seg:off addr of undi_call_info_t struct */ - movw 12(%ebp),%dx /* Pass to 16-bit code in %cx:%dx */ - - call EXT_C(prot_to_real) - .code16 - - movw %cx,%es /* Seg:off addr of undi_call_info_t struct */ - movw %dx,%bx /* into %es:%bx */ - - movw %es:8(%bx),%ax /* Transfer contents of undi_call_info_t */ - pushw %ax /* structure to the real-mode stack */ - movw %es:6(%bx),%ax - pushw %ax - movw %es:4(%bx),%ax - pushw %ax - - lcall *%es:0(%bx) /* Do the UNDI call */ - cld /* Don't know whether or not we need this */ - /* but pxelinux includes it for some reason, */ - /* so we put it in just in case. */ - - popw %cx /* Tidy up the stack */ - popw %cx - popw %cx - movw %ax,%cx /* Return %ax via %cx */ - - DATA32 call EXT_C(real_to_prot) - .code32 - - xorl %eax,%eax /* %ax is returned via %cx */ - movw %cx,%ax - - popl %ebx - popl %edi - popl %esi - popl %ebp - ret - -/************************************************************************** -UNDI_IRQ_HANDLER - UNDI IRQ handler: calls PXENV_UNDI_ISR and send EOI -NOTE: For some reason, this handler needs to be aligned. Else, the - undi driver won't get the trigger count on some platforms. -**************************************************************************/ - .align 4 -ENTRY(_undi_irq_handler) - .code16 - pushw %ax - pushw %bx - pushw %cx - call 1f /* Position-independent access to */ -1: popw %bx /* various locations. */ - pushw %bx /* save for after UNDI call */ - - /* set funcflag to PXENV_UNDI_ISR_IN_START */ - movw $1,%cs:(pxenv_undi_isr-1b+2)(%bx) - - /* push pxenv_undi_isr struct on stack */ - movl $(ABS(pxenv_undi_isr)),%eax - movw %ax,%cx - shrl $4,%eax /* get segment */ - pushw %ax - andw $0xf,%cx /* get offset */ - pushw %cx - movw $0x14,%ax /* opcode PXENV_UNDI_ISR */ - pushw %ax - - lcall *%cs:(pxenv_entrypointsp-1b)(%bx) /* Do the UNDI call */ - cld /* Don't know whether or not we need this */ - /* but pxelinux includes it for some reason, */ - /* so we put it in just in case. */ - popw %cx /* Tidy up the stack */ - popw %cx - popw %cx - - popw %bx /* restore old position reg */ - - cmpw $0,%ax /* did the UNDI call succeed? */ - jne 3f - movw %cs:(pxenv_undi_isr-1b+2)(%bx),%ax - cmpw $0,%ax /* is this our interrupt? */ - jne 3f - - /* send EOI -- non specific for now */ - movw $0x20,%ax /* ICR_EOI_NON_SPECIFIC */ - movb %cs:(pxenv_undi_irq-1b),%cl - cmpb $8,%cl - jg 2f - outb $0xa0 /* PIC2_ICR */ -2: outb $0x20 /* PIC1_ICR */ - - /* increment trigger count */ - incw %cs:(EXT_C(_undi_irq_trigger_count)-1b)(%bx) - - /* restore other registers */ -3: popw %cx - popw %bx - popw %ax - iret -ENTRY(_undi_irq_trigger_count) -undi_irq_trigger_count: - .word 0 -ENTRY(_undi_irq_chain_to) - .long 0 -ENTRY(_undi_irq_chain) - .byte 0 -ENTRY(_pxenv_undi_irq) -pxenv_undi_irq: - .byte 0 -ENTRY(_pxenv_undi_entrypointsp) -pxenv_entrypointsp: - .word 0 /* offset */ - .word 0 /* segment */ -pxenv_undi_isr: - .word 0 /* status */ - .word 0 /* funcflag */ - .long 0 /* struct padding not used by ISR */ - .long 0 - .long 0 - - .code32 - -/* - * stop_floppy() - * - * Stops the floppy drive from spinning, so that other software is - * jumped to with a known state. - */ -ENTRY(stop_floppy) - pusha - call EXT_C(prot_to_real) - .code16 - xorb %dl, %dl - int $0x13 - DATA32 call EXT_C(real_to_prot) - .code32 - popa - ret - -/* - * grub_reboot() - * - * Reboot the system. At the moment, rely on BIOS. - */ -ENTRY(grub_reboot) - call EXT_C(prot_to_real) - .code16 - /* cold boot */ - movw $0x0472, %di - movw %ax, (%di) - ljmp $0xFFFF, $0x0000 - .code32 - -/* - * grub_halt(int no_apm) - * - * Halt the system, using APM if possible. If NO_APM is true, don't use - * APM even if it is available. - */ -ENTRY(grub_halt) - /* get the argument */ - movl 4(%esp), %eax - - /* see if zero */ - testl %eax, %eax - jnz EXT_C(stop) - - call EXT_C(prot_to_real) - .code16 - - /* detect APM */ - movw $0x5300, %ax - xorw %bx, %bx - int $0x15 - jc EXT_C(hard_stop) - /* don't check %bx for buggy BIOSes... */ - - /* disconnect APM first */ - movw $0x5304, %ax - xorw %bx, %bx - int $0x15 - - /* connect APM */ - movw $0x5301, %ax - xorw %bx, %bx - int $0x15 - jc EXT_C(hard_stop) - - /* set APM protocol level - 1.1 or bust. (this covers APM 1.2 also) */ - movw $0x530E, %ax - xorw %bx, %bx - movw $0x0101, %cx - int $0x15 - jc EXT_C(hard_stop) - - /* set the power state to off */ - movw $0x5307, %ax - movw $1, %bx - movw $3, %cx - int $0x15 - - /* shouldn't reach here */ - jmp EXT_C(hard_stop) - .code32 - -/* - * track_int13(int drive) - * - * Track the int13 handler to probe I/O address space. - */ -ENTRY(track_int13) - pushl %ebp - movl %esp, %ebp - - pushl %ebx - pushl %edi - - /* copy the original int13 handler segment:offset */ - movl $0x4c, %edi - movl (%edi), %eax - movl %eax, track_int13_addr - - /* replace the int1 handler */ - movl $0x4, %edi - pushl (%edi) - movl $ABS(int1_handler), %eax - movl %eax, (%edi) - - /* read the MBR to call int13 successfully */ - movb 8(%ebp), %dl - - call EXT_C(prot_to_real) - .code16 - - movw $SCRATCHSEG, %ax - movw %ax, %es - xorw %bx, %bx - movw $1, %cx - xorb %dh, %dh - - /* save FLAGS on the stack to emulate int13 */ - pushfw - - /* set the TF flag */ - /* FIXME: this can be simplified not to use AX */ - pushfw - popw %ax - orw $0x100, %ax - pushw %ax - popfw - - movw $0x0201, %ax - - .byte 0x9a /* lcall */ -track_int13_addr: - .word 0 /* offset */ - .word 0 /* segment */ - - /* TF is cleared here automatically */ - - DATA32 call EXT_C(real_to_prot) - .code32 - - /* restore the int1 handler */ - movl $0x4, %edi - popl (%edi) - - popl %edi - popl %ebx - popl %ebp - - ret - - -/* - * Check if the next instruction is I/O, and if this is true, add the - * port into the io map. - * - * Note: Probably this will make the execution of int13 very slow. - * - * Note2: In this implementation, all we can know is I/O-mapped I/O. It - * is impossible to detect memory-mapped I/O. - */ -int1_handler: - .code16 - - pushw %bp - movw %sp, %bp - pushw %ds - pushw %ax - pushw %si - pushw %dx - - /* IP */ - movw 2(%bp), %si - /* CS */ - movw 4(%bp), %ax - movw %ax, %ds - - /* examine the next instruction */ -1: lodsb (%si), %al - /* skip this code if it is a prefix */ - cmpb $0x2E, %al - je 1b - cmpb $0x36, %al - je 1b - cmpb $0x3E, %al - je 1b - cmpb $0x26, %al - je 1b - cmpb $0x64, %al - jl 2f - cmpb $0x67, %al - jle 1b -2: cmpb $0xF0, %al - jl 3f - cmpb $0xF3, %al - jle 1b - -3: /* check if this code is out* or in* */ - - /* ins? or outs? */ - cmpb $0x6C, %al - jl 4f - cmpb $0x6F, %al - jle 5f - -4: /* in? or out? (register operand version) */ - cmpb $0xEC, %al - jl 6f - cmpb $0xEF, %al - jle 5f - -6: /* in? or out? (immediate operand version) */ - cmpb $0xE4, %al - jl 8f - cmpb $0xE7, %al - jg 8f - -7: /* immediate has a port */ - lodsb (%si), %al - movzbw %al, %dx - -5: /* %dx has a port */ - - /* set %ds to zero */ - xorw %ax, %ax - movw %ax, %ds - - /* set %si to the io map */ - movw $ABS(EXT_C(io_map)), %si - - -9: /* check if the io map already has the port */ - lodsw (%si), %ax - /* check if this is the end */ - testw %ax, %ax - jz 1f - /* check if this matches the port */ - cmpw %ax, %dx - jne 9b - /* if so, leave from this handler */ - jmp 8f - -1: /* check for the buffer overrun */ - cmpw $(ABS(EXT_C(io_map)) + (IO_MAP_SIZE + 1) * 2), %si - je 8f - /* add the port into the io map */ - movw %dx, -2(%si) - -8: /* restore registers */ - popw %dx - popw %si - popw %ax - popw %ds - popw %bp - - iret - - .code32 - -ENTRY(io_map) - .space (IO_MAP_SIZE + 1) * 2 - - -/* - * set_int15_handler(void) - * - * Set up int15_handler. - */ -ENTRY(set_int15_handler) - pushl %edi - - /* save the original int15 handler */ - movl $0x54, %edi - movw (%edi), %ax - movw %ax, ABS(int15_offset) - movw 2(%edi), %ax - movw %ax, ABS(int15_segment) - - /* save the new int15 handler */ - movw $ABS(int15_handler), %ax - movw %ax, (%edi) - xorw %ax, %ax - movw %ax, 2(%edi) - - popl %edi - ret - - -/* - * unset_int15_handler(void) - * - * Restore the original int15 handler - */ -ENTRY(unset_int15_handler) - pushl %edi - - /* check if int15_handler is set */ - movl $0x54, %edi - movw $ABS(int15_handler), %ax - cmpw %ax, (%edi) - jne 1f - xorw %ax, %ax - cmpw %ax, 2(%edi) - jne 1f - - /* restore the original */ - movw ABS(int15_offset), %ax - movw %ax, (%edi) - movw ABS(int15_segment), %ax - movw %ax, 2(%edi) - -1: - popl %edi - ret - - -/* - * Translate a key code to another. - * - * Note: This implementation cannot handle more than one length - * scancodes (such as Right Ctrl). - */ - .code16 -int15_handler: - /* if non-carrier, ignore it */ - jnc 1f - /* check if AH=4F */ - cmpb $0x4F, %ah - jne 1f - - /* E0 and E1 are special */ - cmpb $0xE1, %al - je 4f - cmpb $0xE0, %al - /* this flag is actually the machine code (je or jmp) */ -int15_skip_flag: - je 4f - - pushw %bp - movw %sp, %bp - - pushw %bx - pushw %dx - pushw %ds - pushw %si - - /* save bits 0-6 of %al in %dl */ - movw %ax, %dx - andb $0x7f, %dl - /* save the highest bit in %bl */ - movb %al, %bl - xorb %dl, %bl - /* set %ds to 0 */ - xorw %ax, %ax - movw %ax, %ds - /* set %si to the key map */ - movw $ABS(EXT_C(bios_key_map)), %si - - /* find the key code from the key map */ -2: - lodsw - /* check if this is the end */ - testw %ax, %ax - jz 3f - /* check if this matches the key code */ - cmpb %al, %dl - jne 2b - /* if so, perform the mapping */ - movb %ah, %dl -3: - /* restore %ax */ - movw %dx, %ax - orb %bl, %al - /* make sure that CF is set */ - orw $1, 6(%bp) - /* restore other registers */ - popw %si - popw %ds - popw %dx - popw %bx - popw %bp - iret - -4: - /* tricky: jmp (0x74) <-> je (0xeb) */ - xorb $(0x74 ^ 0xeb), ABS(int15_skip_flag) -1: - /* just cascade to the original */ - /* ljmp */ - .byte 0xea -int15_offset: .word 0 -int15_segment: .word 0 - - .code32 - - .align 4 -ENTRY(bios_key_map) - .space (KEY_MAP_SIZE + 1) * 2 - - -/* - * set_int13_handler(map) - * - * Copy MAP to the drive map and set up int13_handler. - */ -ENTRY(set_int13_handler) - pushl %ebp - movl %esp, %ebp - - pushl %edi - pushl %esi - - /* copy MAP to the drive map */ - movl $(DRIVE_MAP_SIZE * 2), %ecx - movl $ABS(drive_map), %edi - movl 8(%ebp), %esi - cld - rep - movsb - - /* save the original int13 handler */ - movl $0x4c, %edi - movw (%edi), %ax - movw %ax, ABS(int13_offset) - movw 2(%edi), %ax - movw %ax, ABS(int13_segment) - - /* decrease the lower memory size and set it to the BIOS memory */ - movl $0x413, %edi - decw (%edi) - xorl %eax, %eax - movw (%edi), %ax - - /* compute the segment */ - shll $6, %eax - - /* save the new int13 handler */ - movl $0x4c, %edi - movw %ax, 2(%edi) - xorw %cx, %cx - movw %cx, (%edi) - - /* copy int13_handler to the reserved area */ - shll $4, %eax - movl %eax, %edi - movl $ABS(int13_handler), %esi - movl $(int13_handler_end - int13_handler), %ecx - rep - movsb - - popl %esi - popl %edi - popl %ebp - ret - - -/* - * Map a drive to another drive. - */ - - .code16 - -int13_handler: - pushw %ax - pushw %bp - movw %sp, %bp - - pushw %si - - /* set %si to the drive map */ - movw $(drive_map - int13_handler), %si - /* find the drive number from the drive map */ - cld -1: - lodsw %cs:(%si), %ax - /* check if this is the end */ - testw %ax, %ax - jz 2f - /* check if this matches the drive number */ - cmpb %al, %dl - jne 1b - /* if so, perform the mapping */ - movb %ah, %dl -2: - /* restore %si */ - popw %si - /* save %ax in the stack */ - pushw %ax - /* simulate the interrupt call */ - pushw 8(%bp) - /* set %ax and %bp to the original values */ - movw 2(%bp), %ax - movw (%bp), %bp - /* lcall */ - .byte 0x9a -int13_offset: .word 0 -int13_segment: .word 0 - /* save flags */ - pushf - /* restore %bp */ - movw %sp, %bp - /* save %ax */ - pushw %ax - /* set the flags in the stack to the value returned by int13 */ - movw (%bp), %ax - movw %ax, 0xc(%bp) - /* check if should map the drive number */ - movw 6(%bp), %ax - cmpw $0x8, %ax - jne 3f - cmpw $0x15, %ax - jne 3f - /* check if the mapping was performed */ - movw 2(%bp), %ax - testw %ax, %ax - jz 3f - /* perform the mapping */ - movb %al, %dl -3: - popw %ax - movw 4(%bp), %bp - addw $8, %sp - iret - - .align 4 -drive_map: .space (DRIVE_MAP_SIZE + 1) * 2 -int13_handler_end: - - .code32 - - -/* - * chain_stage1(segment, offset, part_table_addr) - * - * This starts another stage1 loader, at segment:offset. - */ - -ENTRY(chain_stage1) - /* no need to save anything, just use %esp */ - - /* store %ESI, presuming %ES is 0 */ - movl 0xc(%esp), %esi - - /* store new offset */ - movl 0x8(%esp), %eax - movl %eax, offset - - /* store new segment */ - movw 0x4(%esp), %ax - movw %ax, segment - - /* set up to pass boot drive */ - movb EXT_C(boot_drive), %dl - - call EXT_C(prot_to_real) - .code16 - -#ifdef ABSOLUTE_WITHOUT_ASTERISK - DATA32 ADDR32 ljmp (offset) -#else - DATA32 ADDR32 ljmp *(offset) -#endif - .code32 -#endif /* STAGE1_5 */ - - -#ifdef STAGE1_5 -/* - * chain_stage2(segment, offset, second_sector) - * - * This starts another stage2 loader, at segment:offset. It presumes - * that the other one starts with this same "asm.S" file, and passes - * parameters by writing the embedded install variables. - */ - -ENTRY(chain_stage2) - /* no need to save anything, just use %esp */ - - /* store new offset */ - movl 0x8(%esp), %eax - movl %eax, offset - movl %eax, %ebx - - /* store new segment */ - movw 0x4(%esp), %ax - movw %ax, segment - shll $4, %eax - - /* generate linear address */ - addl %eax, %ebx - - /* set up to pass the partition where stage2 is located in */ - movl EXT_C(current_partition), %eax - movl %eax, (EXT_C(install_partition)-EXT_C(main))(%ebx) - - /* set up to pass the drive where stage2 is located in */ - movb EXT_C(current_drive), %dl - - /* set up to pass the second sector of stage2 */ - movl 0xc(%esp), %ecx - - call EXT_C(prot_to_real) - .code16 - - movl %ecx, %ebp - -#ifdef ABSOLUTE_WITHOUT_ASTERISK - DATA32 ADDR32 ljmp (offset) -#else - DATA32 ADDR32 ljmp *(offset) -#endif - - .code32 -#endif /* STAGE1_5 */ - -/* - * These next two routines, "real_to_prot" and "prot_to_real" are structured - * in a very specific way. Be very careful when changing them. - * - * NOTE: Use of either one messes up %eax and %ebp. - */ - -ENTRY(real_to_prot) - .code16 - cli - - /* load the GDT register */ - DATA32 ADDR32 lgdt gdtdesc - - /* turn on protected mode */ - movl %cr0, %eax - orl $CR0_PE_ON, %eax - movl %eax, %cr0 - - /* jump to relocation, flush prefetch queue, and reload %cs */ - DATA32 ljmp $PROT_MODE_CSEG, $protcseg - - /* - * The ".code32" directive only works in GAS, the GNU assembler! - * This gets out of "16-bit" mode. - */ - .code32 - -protcseg: - /* reload other segment registers */ - movw $PROT_MODE_DSEG, %ax - movw %ax, %ds - movw %ax, %es - movw %ax, %fs - movw %ax, %gs - movw %ax, %ss - - /* put the return address in a known safe location */ - movl (%esp), %eax - movl %eax, STACKOFF - - /* get protected mode stack */ - movl protstack, %eax - movl %eax, %esp - movl %eax, %ebp - - /* get return address onto the right stack */ - movl STACKOFF, %eax - movl %eax, (%esp) - - /* zero %eax */ - xorl %eax, %eax - - /* return on the old (or initialized) stack! */ - ret - - -ENTRY(prot_to_real) - /* just in case, set GDT */ - lgdt gdtdesc - - /* save the protected mode stack */ - movl %esp, %eax - movl %eax, protstack - - /* get the return address */ - movl (%esp), %eax - movl %eax, STACKOFF - - /* set up new stack */ - movl $STACKOFF, %eax - movl %eax, %esp - movl %eax, %ebp - - /* set up segment limits */ - movw $PSEUDO_RM_DSEG, %ax - movw %ax, %ds - movw %ax, %es - movw %ax, %fs - movw %ax, %gs - movw %ax, %ss - - /* this might be an extra step */ - ljmp $PSEUDO_RM_CSEG, $tmpcseg /* jump to a 16 bit segment */ - -tmpcseg: - .code16 - - /* clear the PE bit of CR0 */ - movl %cr0, %eax - andl $CR0_PE_OFF, %eax - movl %eax, %cr0 - - /* flush prefetch queue, reload %cs */ - DATA32 ljmp $0, $realcseg - -realcseg: - /* we are in real mode now - * set up the real mode segment registers : DS, SS, ES - */ - /* zero %eax */ - xorl %eax, %eax - - movw %ax, %ds - movw %ax, %es - movw %ax, %fs - movw %ax, %gs - movw %ax, %ss - - /* restore interrupts */ - sti - - /* return on new stack! */ - DATA32 ret - - .code32 - - -/* - * int biosdisk_int13_extensions (int ax, int drive, void *dap) - * - * Call IBM/MS INT13 Extensions (int 13 %ax=AX) for DRIVE. DAP - * is passed for disk address packet. If an error occurs, return - * non-zero, otherwise zero. - */ - -ENTRY(biosdisk_int13_extensions) - pushl %ebp - movl %esp, %ebp - - pushl %esi - pushl %ebx - - /* compute the address of disk_address_packet */ - movl 0x10(%ebp), %eax - movw %ax, %si - xorw %ax, %ax - shrl $4, %eax - movw %ax, %cx /* save the segment to cx */ - - /* drive */ - movb 0xc(%ebp), %dl - /* ax */ - movw 0x8(%ebp), %bx - /* enter real mode */ - call EXT_C(prot_to_real) - - .code16 - movw %bx, %ax - movw %cx, %ds - int $0x13 /* do the operation */ - movb %ah, %dl /* save return value */ - /* clear the data segment */ - xorw %ax, %ax - movw %ax, %ds - /* back to protected mode */ - DATA32 call EXT_C(real_to_prot) - .code32 - - movb %dl, %al /* return value in %eax */ - - popl %ebx - popl %esi - popl %ebp - - ret - -/* - * int biosdisk_standard (int ah, int drive, int coff, int hoff, int soff, - * int nsec, int segment) - * - * Call standard and old INT13 (int 13 %ah=AH) for DRIVE. Read/write - * NSEC sectors from COFF/HOFF/SOFF into SEGMENT. If an error occurs, - * return non-zero, otherwise zero. - */ - -ENTRY(biosdisk_standard) - pushl %ebp - movl %esp, %ebp - - pushl %ebx - pushl %edi - pushl %esi - - /* set up CHS information */ - movl 0x10(%ebp), %eax - movb %al, %ch - movb 0x18(%ebp), %al - shlb $2, %al - shrw $2, %ax - movb %al, %cl - movb 0x14(%ebp), %dh - /* drive */ - movb 0xc(%ebp), %dl - /* segment */ - movw 0x20(%ebp), %bx - /* save nsec and ah to %di */ - movb 0x8(%ebp), %ah - movb 0x1c(%ebp), %al - movw %ax, %di - /* enter real mode */ - call EXT_C(prot_to_real) - - .code16 - movw %bx, %es - xorw %bx, %bx - movw $3, %si /* attempt at least three times */ - -1: - movw %di, %ax - int $0x13 /* do the operation */ - jnc 2f /* check if successful */ - - movb %ah, %bl /* save return value */ - /* if fail, reset the disk system */ - xorw %ax, %ax - int $0x13 - - decw %si - cmpw $0, %si - je 2f - xorb %bl, %bl - jmp 1b /* retry */ -2: - /* back to protected mode */ - DATA32 call EXT_C(real_to_prot) - .code32 - - movb %bl, %al /* return value in %eax */ - - popl %esi - popl %edi - popl %ebx - popl %ebp - - ret - - -/* - * int check_int13_extensions (int drive) - * - * Check if LBA is supported for DRIVE. If it is supported, then return - * the major version of extensions, otherwise zero. - */ - -ENTRY(check_int13_extensions) - pushl %ebp - movl %esp, %ebp - - pushl %ebx - - /* drive */ - movb 0x8(%ebp), %dl - /* enter real mode */ - call EXT_C(prot_to_real) - - .code16 - movb $0x41, %ah - movw $0x55aa, %bx - int $0x13 /* do the operation */ - - /* check the result */ - jc 1f - cmpw $0xaa55, %bx - jne 1f - - movb %ah, %bl /* save the major version into %bl */ - - /* check if AH=0x42 is supported if FORCE_LBA is zero */ - movb EXT_C(force_lba), %al - testb %al, %al - jnz 2f - andw $1, %cx - jnz 2f - -1: - xorb %bl, %bl -2: - /* back to protected mode */ - DATA32 call EXT_C(real_to_prot) - .code32 - - movb %bl, %al /* return value in %eax */ - - popl %ebx - popl %ebp - - ret - - -/* - * int get_diskinfo_standard (int drive, unsigned long *cylinders, - * unsigned long *heads, unsigned long *sectors) - * - * Return the geometry of DRIVE in CYLINDERS, HEADS and SECTORS. If an - * error occurs, then return non-zero, otherwise zero. - */ - -ENTRY(get_diskinfo_standard) - pushl %ebp - movl %esp, %ebp - - pushl %ebx - pushl %edi - - /* drive */ - movb 0x8(%ebp), %dl - /* enter real mode */ - call EXT_C(prot_to_real) - - .code16 - movb $0x8, %ah - int $0x13 /* do the operation */ - /* check if successful */ - testb %ah, %ah - jnz 1f - /* bogus BIOSes may not return an error number */ - testb $0x3f, %cl /* 0 sectors means no disk */ - jnz 1f /* if non-zero, then succeed */ - /* XXX 0x60 is one of the unused error numbers */ - movb $0x60, %ah -1: - movb %ah, %bl /* save return value in %bl */ - /* back to protected mode */ - DATA32 call EXT_C(real_to_prot) - .code32 - - /* restore %ebp */ - leal 0x8(%esp), %ebp - - /* heads */ - movb %dh, %al - incl %eax /* the number of heads is counted from zero */ - movl 0x10(%ebp), %edi - movl %eax, (%edi) - - /* sectors */ - xorl %eax, %eax - movb %cl, %al - andb $0x3f, %al - movl 0x14(%ebp), %edi - movl %eax, (%edi) - - /* cylinders */ - shrb $6, %cl - movb %cl, %ah - movb %ch, %al - incl %eax /* the number of cylinders is - counted from zero */ - movl 0xc(%ebp), %edi - movl %eax, (%edi) - - xorl %eax, %eax - movb %bl, %al /* return value in %eax */ - - popl %edi - popl %ebx - popl %ebp - - ret - - -#if 0 -/* - * int get_diskinfo_floppy (int drive, unsigned long *cylinders, - * unsigned long *heads, unsigned long *sectors) - * - * Return the geometry of DRIVE in CYLINDERS, HEADS and SECTORS. If an - * error occurs, then return non-zero, otherwise zero. - */ - -ENTRY(get_diskinfo_floppy) - pushl %ebp - movl %esp, %ebp - - pushl %ebx - pushl %esi - - /* drive */ - movb 0x8(%ebp), %dl - /* enter real mode */ - call EXT_C(prot_to_real) - - .code16 - /* init probe value */ - movl $probe_values-1, %esi -1: - xorw %ax, %ax - int $0x13 /* reset floppy controller */ - - incw %si - movb (%si), %cl - cmpb $0, %cl /* probe failed if zero */ - je 2f - - /* perform read */ - movw $SCRATCHSEG, %ax - movw %ax, %es - xorw %bx, %bx - movw $0x0201, %ax - movb $0, %ch - movb $0, %dh - int $0x13 - - /* FIXME: Read from floppy may fail even if the geometry is correct. - So should retry at least three times. */ - jc 1b /* next value */ - - /* succeed */ - jmp 2f - -probe_values: - .byte 36, 18, 15, 9, 0 - -2: - /* back to protected mode */ - DATA32 call EXT_C(real_to_prot) - .code32 - - /* restore %ebp */ - leal 0x8(%esp), %ebp - - /* cylinders */ - movl 0xc(%ebp), %eax - movl $80, %ebx - movl %ebx, (%eax) - /* heads */ - movl 0x10(%ebp), %eax - movl $2, %ebx - movl %ebx, (%eax) - /* sectors */ - movl 0x14(%ebp), %eax - movzbl %cl, %ebx - movl %ebx, (%eax) - - /* return value in %eax */ - xorl %eax, %eax - cmpb $0, %cl - jne 3f - incl %eax /* %eax = 1 (non-zero) */ -3: - popl %esi - popl %ebx - popl %ebp - - ret -#endif - - -/* Source files are splitted, as they have different copyrights. */ -#ifndef STAGE1_5 -# include "setjmp.S" -# include "apm.S" -#endif /* ! STAGE1_5 */ - - - -#ifndef STAGE1_5 -/* get_code_end() : return the address of the end of the code - * This is here so that it can be replaced by asmstub.c. - */ -ENTRY(get_code_end) - /* will be the end of the bss */ -# if defined(HAVE_END_SYMBOL) - movl $end, %eax -# elif defined(HAVE_USCORE_END_SYMBOL) - movl $_end, %eax -# endif - shrl $2, %eax /* Round up to the next word. */ - incl %eax - shll $2, %eax - ret -#endif /* ! STAGE1_5 */ - -/* - * - * get_memsize(i) : return the memory size in KB. i == 0 for conventional - * memory, i == 1 for extended memory - * BIOS call "INT 12H" to get conventional memory size - * BIOS call "INT 15H, AH=88H" to get extended memory size - * Both have the return value in AX. - * - */ - -ENTRY(get_memsize) - push %ebp - push %ebx - - mov 0xc(%esp), %ebx - - call EXT_C(prot_to_real) /* enter real mode */ - .code16 - - cmpb $0x1, %bl - DATA32 je xext - - int $0x12 - DATA32 jmp xdone - -xext: - movb $0x88, %ah - int $0x15 - -xdone: - movw %ax, %bx - - DATA32 call EXT_C(real_to_prot) - .code32 - - movw %bx, %ax - pop %ebx - pop %ebp - ret - - -#ifndef STAGE1_5 - -/* - * - * get_eisamemsize() : return packed EISA memory map, lower 16 bits is - * memory between 1M and 16M in 1K parts, upper 16 bits is - * memory above 16M in 64K parts. If error, return -1. - * BIOS call "INT 15H, AH=E801H" to get EISA memory map, - * AX = memory between 1M and 16M in 1K parts. - * BX = memory above 16M in 64K parts. - * - */ - -ENTRY(get_eisamemsize) - push %ebp - push %ebx - - call EXT_C(prot_to_real) /* enter real mode */ - .code16 - - movw $0xe801, %ax - int $0x15 - - shll $16, %ebx - movw %ax, %bx - - DATA32 call EXT_C(real_to_prot) - .code32 - - movl $0xFFFFFFFF, %eax - cmpb $0x86, %bh - je xnoteisa - - movl %ebx, %eax - -xnoteisa: - pop %ebx - pop %ebp - ret - -/* - * - * get_mmap_entry(addr, cont) : address and old continuation value (zero to - * start), for the Query System Address Map BIOS call. - * - * Sets the first 4-byte int value of "addr" to the size returned by - * the call. If the call fails, sets it to zero. - * - * Returns: new (non-zero) continuation value, 0 if done. - * - * NOTE: Currently hard-coded for a maximum buffer length of 1024. - */ - -ENTRY(get_mmap_entry) - push %ebp - push %ebx - push %edi - push %esi - - /* place address (+4) in ES:DI */ - movl 0x14(%esp), %eax - addl $4, %eax - movl %eax, %edi - andl $0xf, %edi - shrl $4, %eax - movl %eax, %esi - - /* set continuation value */ - movl 0x18(%esp), %ebx - - /* set default maximum buffer size */ - movl $0x14, %ecx - - /* set EDX to 'SMAP' */ - movl $0x534d4150, %edx - - call EXT_C(prot_to_real) /* enter real mode */ - .code16 - - movw %si, %es - movl $0xe820, %eax - int $0x15 - - DATA32 jc xnosmap - - cmpl $0x534d4150, %eax - DATA32 jne xnosmap - - cmpl $0x14, %ecx - DATA32 jl xnosmap - - cmpl $0x400, %ecx - DATA32 jg xnosmap - - DATA32 jmp xsmap - -xnosmap: - movl $0, %ecx - -xsmap: - DATA32 call EXT_C(real_to_prot) - .code32 - - /* write length of buffer (zero if error) into "addr" */ - movl 0x14(%esp), %eax - movl %ecx, (%eax) - - /* set return value to continuation */ - movl %ebx, %eax - - pop %esi - pop %edi - pop %ebx - pop %ebp - ret - -/* - * get_rom_config_table() - * - * Get the linear address of a ROM configuration table. Return zero, - * if fails. - */ - -ENTRY(get_rom_config_table) - pushl %ebp - pushl %ebx - - /* zero %ebx for simplicity */ - xorl %ebx, %ebx - - call EXT_C(prot_to_real) - .code16 - - movw $0xc0, %ax - int $0x15 - - jc no_rom_table - testb %ah, %ah - jnz no_rom_table - - movw %es, %dx - jmp found_rom_table - -no_rom_table: - xorw %dx, %dx - xorw %bx, %bx - -found_rom_table: - DATA32 call EXT_C(real_to_prot) - .code32 - - /* compute the linear address */ - movw %dx, %ax - shll $4, %eax - addl %ebx, %eax - - popl %ebx - popl %ebp - ret - - -/* - * int get_vbe_controller_info (struct vbe_controller *controller_ptr) - * - * Get VBE controller information. - */ - -ENTRY(get_vbe_controller_info) - pushl %ebp - movl %esp, %ebp - - pushl %edi - pushl %ebx - - /* Convert the linear address to segment:offset */ - movl 8(%ebp), %eax - movl %eax, %edi - andl $0x0000000f, %edi - shrl $4, %eax - movl %eax, %ebx - - call EXT_C(prot_to_real) - .code16 - - movw %bx, %es - movw $0x4F00, %ax - int $0x10 - - movw %ax, %bx - DATA32 call EXT_C(real_to_prot) - .code32 - - movzwl %bx, %eax - - popl %ebx - popl %edi - popl %ebp - ret - - -/* - * int get_vbe_mode_info (int mode_number, struct vbe_mode *mode_ptr) - * - * Get VBE mode information. - */ - -ENTRY(get_vbe_mode_info) - pushl %ebp - movl %esp, %ebp - - pushl %edi - pushl %ebx - - /* Convert the linear address to segment:offset */ - movl 0xc(%ebp), %eax - movl %eax, %edi - andl $0x0000000f, %edi - shrl $4, %eax - movl %eax, %ebx - - /* Save the mode number in %cx */ - movl 0x8(%ebp), %ecx - - call EXT_C(prot_to_real) - .code16 - - movw %bx, %es - movw $0x4F01, %ax - int $0x10 - - movw %ax, %bx - DATA32 call EXT_C(real_to_prot) - .code32 - - movzwl %bx, %eax - - popl %ebx - popl %edi - popl %ebp - ret - - -/* - * int set_vbe_mode (int mode_number) - * - * Set VBE mode. Don't support user-specified CRTC information. - */ - -ENTRY(set_vbe_mode) - pushl %ebp - movl %esp, %ebp - - pushl %ebx - - /* Save the mode number in %bx */ - movl 0x8(%ebp), %ebx - /* Clear bit D11 */ - andl $0xF7FF, %ebx - - call EXT_C(prot_to_real) - .code16 - - movw $0x4F02, %ax - int $0x10 - - movw %ax, %bx - DATA32 call EXT_C(real_to_prot) - .code32 - - movzwl %bx, %eax - - popl %ebx - popl %ebp - ret - - -/* - * gateA20(int linear) - * - * Gate address-line 20 for high memory. - * - * This routine is probably overconservative in what it does, but so what? - * - * It also eats any keystrokes in the keyboard buffer. :-( - */ - -ENTRY(gateA20) - /* first, try a BIOS call */ - pushl %ebp - movl 8(%esp), %edx - - call EXT_C(prot_to_real) - - .code16 - movw $0x2400, %ax - testw %dx, %dx - jz 1f - incw %ax -1: stc - int $0x15 - jnc 2f - - /* set non-zero if failed */ - movb $1, %ah - - /* save the status */ -2: movb %ah, %dl - - DATA32 call EXT_C(real_to_prot) - .code32 - - popl %ebp - testb %dl, %dl - jnz 3f - ret - -3: /* - * try to switch gateA20 using PORT92, the "Fast A20 and Init" - * register - */ - mov $0x92, %dx - inb %dx, %al - /* skip the port92 code if it's unimplemented (read returns 0xff) */ - cmpb $0xff, %al - jz 6f - - /* set or clear bit1, the ALT_A20_GATE bit */ - movb 4(%esp), %ah - testb %ah, %ah - jz 4f - orb $2, %al - jmp 5f -4: and $0xfd, %al - - /* clear the INIT_NOW bit; don't accidently reset the machine */ -5: and $0xfe, %al - outb %al, %dx - -6: /* use keyboard controller */ - pushl %eax - - call gloop1 - - movb $KC_CMD_WOUT, %al - outb $K_CMD - -gloopint1: - inb $K_STATUS - cmpb $0xff, %al - jz gloopint1_done - andb $K_IBUF_FUL, %al - jnz gloopint1 - -gloopint1_done: - movb $KB_OUTPUT_MASK, %al - cmpb $0, 0x8(%esp) - jz gdoit - - orb $KB_A20_ENABLE, %al -gdoit: - outb $K_RDWR - - call gloop1 - - /* output a dummy command (USB keyboard hack) */ - movb $0xff, %al - outb $K_CMD - call gloop1 - - popl %eax - ret - -gloop1: - inb $K_STATUS - cmpb $0xff, %al - jz gloop2ret - andb $K_IBUF_FUL, %al - jnz gloop1 - -gloop2: - inb $K_STATUS - andb $K_OBUF_FUL, %al - jz gloop2ret - inb $K_RDWR - jmp gloop2 - -gloop2ret: - ret - - -ENTRY(patch_code) /* labels start with "pc_" */ - .code16 - - mov %cs, %ax - mov %ax, %ds - mov %ax, %es - mov %ax, %fs - mov %ax, %gs - ADDR32 movl $0, 0 -pc_stop: - hlt - DATA32 jmp pc_stop -ENTRY(patch_code_end) - - .code32 - - -/* - * linux_boot() - * - * Does some funky things (including on the stack!), then jumps to the - * entry point of the Linux setup code. - */ - -VARIABLE(linux_text_len) - .long 0 - -VARIABLE(linux_data_tmp_addr) - .long 0 - -VARIABLE(linux_data_real_addr) - .long 0 - -ENTRY(linux_boot) - /* don't worry about saving anything, we're committed at this point */ - cld /* forward copying */ - - /* copy kernel */ - movl EXT_C(linux_text_len), %ecx - addl $3, %ecx - shrl $2, %ecx - movl $LINUX_BZIMAGE_ADDR, %esi - movl $LINUX_ZIMAGE_ADDR, %edi - - rep - movsl - -ENTRY(big_linux_boot) - movl EXT_C(linux_data_real_addr), %ebx - - /* copy the real mode part */ - movl EXT_C(linux_data_tmp_addr), %esi - movl %ebx, %edi - movl $LINUX_SETUP_MOVE_SIZE, %ecx - cld - rep - movsb - - /* change %ebx to the segment address */ - shrl $4, %ebx - movl %ebx, %eax - addl $0x20, %eax - movl %eax, linux_setup_seg - - /* XXX new stack pointer in safe area for calling functions */ - movl $0x4000, %esp - call EXT_C(stop_floppy) - - /* final setup for linux boot */ - - call EXT_C(prot_to_real) - .code16 - - /* final setup for linux boot */ - cli - movw %bx, %ss - movw $LINUX_SETUP_STACK, %sp - - movw %bx, %ds - movw %bx, %es - movw %bx, %fs - movw %bx, %gs - - /* jump to start */ - /* ljmp */ - .byte 0xea - .word 0 -linux_setup_seg: - .word 0 - .code32 - - -/* - * multi_boot(int start, int mb_info) - * - * This starts a kernel in the manner expected of the multiboot standard. - */ - -ENTRY(multi_boot) - /* no need to save anything */ - call EXT_C(stop_floppy) - - movl $0x2BADB002, %eax - movl 0x8(%esp), %ebx - - /* boot kernel here (absolute address call) */ - call *0x4(%esp) - - /* error */ - call EXT_C(stop) - -#endif /* ! STAGE1_5 */ - -/* - * void console_putchar (int c) - * - * Put the character C on the console. Because GRUB wants to write a - * character with an attribute, this implementation is a bit tricky. - * If C is a control character (CR, LF, BEL, BS), use INT 10, AH = 0Eh - * (TELETYPE OUTPUT). Otherwise, save the original position, put a space, - * save the current position, restore the original position, write the - * character and the attribute, and restore the current position. - * - * The reason why this is so complicated is that there is no easy way to - * get the height of the screen, and the TELETYPE OUPUT BIOS call doesn't - * support setting a background attribute. - */ -ENTRY(console_putchar) - movl 0x4(%esp), %edx - pusha -#ifdef STAGE1_5 - movb $0x07, %bl -#else - movl EXT_C(console_current_color), %ebx -#endif - - call EXT_C(prot_to_real) - .code16 - movb %dl, %al - xorb %bh, %bh - -#ifndef STAGE1_5 - /* use teletype output if control character */ - cmpb $0x7, %al - je 1f - cmpb $0x8, %al - je 1f - cmpb $0xa, %al - je 1f - cmpb $0xd, %al - je 1f - - /* save the character and the attribute on the stack */ - pushw %ax - pushw %bx - - /* get the current position */ - movb $0x3, %ah - int $0x10 - - /* check the column with the width */ - cmpb $79, %dl - jl 2f - - /* print CR and LF, if next write will exceed the width */ - movw $0x0e0d, %ax - int $0x10 - movb $0x0a, %al - int $0x10 - - /* get the current position */ - movb $0x3, %ah - int $0x10 - -2: - /* restore the character and the attribute */ - popw %bx - popw %ax - - /* write the character with the attribute */ - movb $0x9, %ah - movw $1, %cx - int $0x10 - - /* move the cursor forward */ - incb %dl - movb $0x2, %ah - int $0x10 - - jmp 3f -#endif /* ! STAGE1_5 */ - -1: movb $0xe, %ah - int $0x10 - -3: DATA32 call EXT_C(real_to_prot) - .code32 - - popa - ret - - -#ifndef STAGE1_5 - -/* this table is used in translate_keycode below */ -translation_table: - .word KEY_LEFT, 2 - .word KEY_RIGHT, 6 - .word KEY_UP, 16 - .word KEY_DOWN, 14 - .word KEY_HOME, 1 - .word KEY_END, 5 - .word KEY_DC, 4 - .word KEY_BACKSPACE, 8 - .word KEY_PPAGE, 7 - .word KEY_NPAGE, 3 - .word 0 - -/* - * translate_keycode translates the key code %dx to an ascii code. - */ - .code16 - -translate_keycode: - pushw %bx - pushw %si - - movw $ABS(translation_table), %si - -1: lodsw - /* check if this is the end */ - testw %ax, %ax - jz 2f - /* load the ascii code into %ax */ - movw %ax, %bx - lodsw - /* check if this matches the key code */ - cmpw %bx, %dx - jne 1b - /* translate %dx, if successful */ - movw %ax, %dx - -2: popw %si - popw %bx - ret - - .code32 - - -/* - * remap_ascii_char remaps the ascii code %dl to another if the code is - * contained in ASCII_KEY_MAP. - */ - .code16 - -remap_ascii_char: - pushw %si - - movw $ABS(EXT_C(ascii_key_map)), %si -1: - lodsw - /* check if this is the end */ - testw %ax, %ax - jz 2f - /* check if this matches the ascii code */ - cmpb %al, %dl - jne 1b - /* if so, perform the mapping */ - movb %ah, %dl -2: - /* restore %si */ - popw %si - - ret - - .code32 - - .align 4 -ENTRY(ascii_key_map) - .space (KEY_MAP_SIZE + 1) * 2 - - -/* - * int console_getkey (void) - * BIOS call "INT 16H Function 00H" to read character from keyboard - * Call with %ah = 0x0 - * Return: %ah = keyboard scan code - * %al = ASCII character - */ - -ENTRY(console_getkey) - push %ebp - -wait_for_key: - call EXT_C(console_checkkey) - incl %eax - jz wait_for_key - - call EXT_C(prot_to_real) - .code16 - - int $0x16 - - movw %ax, %dx /* real_to_prot uses %eax */ - call translate_keycode - call remap_ascii_char - - DATA32 call EXT_C(real_to_prot) - .code32 - - movw %dx, %ax - - pop %ebp - ret - - -/* - * int console_checkkey (void) - * if there is a character pending, return it; otherwise return -1 - * BIOS call "INT 16H Function 01H" to check whether a character is pending - * Call with %ah = 0x1 - * Return: - * If key waiting to be input: - * %ah = keyboard scan code - * %al = ASCII character - * Zero flag = clear - * else - * Zero flag = set - */ -ENTRY(console_checkkey) - push %ebp - xorl %edx, %edx - - call EXT_C(prot_to_real) /* enter real mode */ - .code16 - - movb $0x1, %ah - int $0x16 - - DATA32 jz notpending - - movw %ax, %dx - call translate_keycode - call remap_ascii_char - DATA32 jmp pending - -notpending: - movl $0xFFFFFFFF, %edx - -pending: - DATA32 call EXT_C(real_to_prot) - .code32 - - mov %edx, %eax - - pop %ebp - ret - - -/* - * int console_getxy (void) - * BIOS call "INT 10H Function 03h" to get cursor position - * Call with %ah = 0x03 - * %bh = page - * Returns %ch = starting scan line - * %cl = ending scan line - * %dh = row (0 is top) - * %dl = column (0 is left) - */ - - -ENTRY(console_getxy) - push %ebp - push %ebx /* save EBX */ - - call EXT_C(prot_to_real) - .code16 - - xorb %bh, %bh /* set page to 0 */ - movb $0x3, %ah - int $0x10 /* get cursor position */ - - DATA32 call EXT_C(real_to_prot) - .code32 - - movb %dl, %ah - movb %dh, %al - - pop %ebx - pop %ebp - ret - - -/* - * void console_gotoxy(int x, int y) - * BIOS call "INT 10H Function 02h" to set cursor position - * Call with %ah = 0x02 - * %bh = page - * %dh = row (0 is top) - * %dl = column (0 is left) - */ - - -ENTRY(console_gotoxy) - push %ebp - push %ebx /* save EBX */ - - movb 0xc(%esp), %dl /* %dl = x */ - movb 0x10(%esp), %dh /* %dh = y */ - - call EXT_C(prot_to_real) - .code16 - - xorb %bh, %bh /* set page to 0 */ - movb $0x2, %ah - int $0x10 /* set cursor position */ - - DATA32 call EXT_C(real_to_prot) - .code32 - - pop %ebx - pop %ebp - ret - - -/* - * void console_cls (void) - * BIOS call "INT 10H Function 09h" to write character and attribute - * Call with %ah = 0x09 - * %al = (character) - * %bh = (page number) - * %bl = (attribute) - * %cx = (number of times) - */ - - -ENTRY(console_cls) - push %ebp - push %ebx /* save EBX */ - - call EXT_C(prot_to_real) - .code16 - - /* move the cursor to the beginning */ - movb $0x02, %ah - xorb %bh, %bh - xorw %dx, %dx - int $0x10 - - /* write spaces to the entire screen */ - movw $0x0920, %ax - movw $0x07, %bx - movw $(80 * 25), %cx - int $0x10 - - /* move back the cursor */ - movb $0x02, %ah - int $0x10 - - DATA32 call EXT_C(real_to_prot) - .code32 - - pop %ebx - pop %ebp - ret - - -/* - * int console_setcursor (int on) - * BIOS call "INT 10H Function 01h" to set cursor type - * Call with %ah = 0x01 - * %ch = cursor starting scanline - * %cl = cursor ending scanline - */ - -console_cursor_state: - .byte 1 -console_cursor_shape: - .word 0 - -ENTRY(console_setcursor) - push %ebp - push %ebx - - /* check if the standard cursor shape has already been saved */ - movw console_cursor_shape, %ax - testw %ax, %ax - jne 1f - - call EXT_C(prot_to_real) - .code16 - - movb $0x03, %ah - xorb %bh, %bh - int $0x10 - - DATA32 call EXT_C(real_to_prot) - .code32 - - movw %cx, console_cursor_shape -1: - /* set %cx to the designated cursor shape */ - movw $0x2000, %cx - movl 0xc(%esp), %ebx - testl %ebx, %ebx - jz 2f - movw console_cursor_shape, %cx -2: - call EXT_C(prot_to_real) - .code16 - - movb $0x1, %ah - int $0x10 - - DATA32 call EXT_C(real_to_prot) - .code32 - - movzbl console_cursor_state, %eax - movb %bl, console_cursor_state - - pop %ebx - pop %ebp - ret - -/* graphics mode functions */ -#ifdef SUPPORT_GRAPHICS -VARIABLE(cursorX) -.word 0 -VARIABLE(cursorY) -.word 0 -VARIABLE(cursorCount) -.word 0 -VARIABLE(cursorBuf) -.byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - - -/* - * int set_videomode(mode) - * BIOS call "INT 10H Function 0h" to set video mode - * Call with %ah = 0x0 - * %al = video mode - * Returns old videomode. - */ -ENTRY(set_videomode) - push %ebp - push %ebx - push %ecx - - movb 0x10(%esp), %cl - - call EXT_C(prot_to_real) - .code16 - - xorw %bx, %bx - movb $0xf, %ah - int $0x10 /* Get Current Video mode */ - movb %al, %ch - xorb %ah, %ah - movb %cl, %al - int $0x10 /* Set Video mode */ - - DATA32 call EXT_C(real_to_prot) - .code32 - - xorb %ah, %ah - movb %ch, %al - - pop %ecx - pop %ebx - pop %ebp - ret - - -/* - * unsigned char * graphics_get_font() - * BIOS call "INT 10H Function 11h" to set font - * Call with %ah = 0x11 - */ -ENTRY(graphics_get_font) - push %ebp - push %ebx - push %ecx - push %edx - - call EXT_C(prot_to_real) - .code16 - - movw $0x1130, %ax - movb $6, %bh /* font 8x16 */ - int $0x10 - movw %bp, %dx - movw %es, %cx - - DATA32 call EXT_C(real_to_prot) - .code32 - - xorl %eax, %eax - movw %cx, %ax - shll $4, %eax - movw %dx, %ax - - pop %edx - pop %ecx - pop %ebx - pop %ebp - ret - - - -/* - * graphics_set_palette(index, red, green, blue) - * BIOS call "INT 10H Function 10h" to set individual dac register - * Call with %ah = 0x10 - * %bx = register number - * %ch = new value for green (0-63) - * %cl = new value for blue (0-63) - * %dh = new value for red (0-63) - */ - -ENTRY(graphics_set_palette) - push %ebp - push %eax - push %ebx - push %ecx - push %edx - - movw $0x3c8, %bx /* address write mode register */ - - /* wait vertical retrace */ - - movw $0x3da, %dx -l1b: inb %dx, %al /* wait vertical active display */ - test $8, %al - jnz l1b - -l2b: inb %dx, %al /* wait vertical retrace */ - test $8, %al - jnz l2b - - mov %bx, %dx - movb 0x18(%esp), %al /* index */ - outb %al, %dx - inc %dx - - movb 0x1c(%esp), %al /* red */ - outb %al, %dx - - movb 0x20(%esp), %al /* green */ - outb %al, %dx - - movb 0x24(%esp), %al /* blue */ - outb %al, %dx - - movw 0x18(%esp), %bx - - call EXT_C(prot_to_real) - .code16 - - movb %bl, %bh - movw $0x1000, %ax - int $0x10 - - DATA32 call EXT_C(real_to_prot) - .code32 - - pop %edx - pop %ecx - pop %ebx - pop %eax - pop %ebp - ret - -#endif /* SUPPORT_GRAPHICS */ - -/* - * getrtsecs() - * if a seconds value can be read, read it and return it (BCD), - * otherwise return 0xFF - * BIOS call "INT 1AH Function 02H" to check whether a character is pending - * Call with %ah = 0x2 - * Return: - * If RT Clock can give correct values - * %ch = hour (BCD) - * %cl = minutes (BCD) - * %dh = seconds (BCD) - * %dl = daylight savings time (00h std, 01h daylight) - * Carry flag = clear - * else - * Carry flag = set - * (this indicates that the clock is updating, or - * that it isn't running) - */ -ENTRY(getrtsecs) - push %ebp - - call EXT_C(prot_to_real) /* enter real mode */ - .code16 - - movb $0x2, %ah - int $0x1a - - DATA32 jnc gottime - movb $0xff, %dh - -gottime: - DATA32 call EXT_C(real_to_prot) - .code32 - - movb %dh, %al - - pop %ebp - ret - - -/* - * currticks() - * return the real time in ticks, of which there are about - * 18-20 per second - */ -ENTRY(currticks) - pushl %ebp - - call EXT_C(prot_to_real) /* enter real mode */ - .code16 - - /* %ax is already zero */ - int $0x1a - - DATA32 call EXT_C(real_to_prot) - .code32 - - movl %ecx, %eax - shll $16, %eax - movw %dx, %ax - - popl %ebp - ret - -ENTRY(amd64_rdmsr) - movl 4(%esp), %ecx - rdmsr - movl 8(%esp), %ecx - movl %eax, (%ecx) - movl %edx, 4(%ecx) - ret - -ENTRY(amd64_wrmsr) - movl 8(%esp), %ecx - movl (%ecx), %eax - movl 4(%ecx), %edx - movl 4(%esp), %ecx - wrmsr - ret - -ENTRY(amd64_cpuid_insn) - pushl %ebp - movl %esp, %ebp - pushl %ebx - pushl %esi - movl 0x8(%ebp), %eax - movl 0xc(%ebp), %esi - cpuid - movl %eax, 0x0(%esi) - movl %ebx, 0x4(%esi) - movl %ecx, 0x8(%esi) - movl %edx, 0xc(%esi) - popl %esi - popl %ebx - popl %ebp - ret - - /* - * Based on code from AMD64 Volume 3 - */ -ENTRY(amd64_cpuid_supported) - pushf - popl %eax - mov %eax, %edx /* save %eax for later */ - xorl %eax, 0x200000 /* toggle bit 21 */ - pushl %eax - popf /* save new %eax to EFLAGS */ - pushf /* save new EFLAGS */ - popl %ecx /* copy EFLAGS to %eax */ - xorl %eax, %eax - cmpl %ecx, %edx /* see if bit 21 has changes */ - jne 1f - incl %eax -1: - ret - -ENTRY(get_target_operating_mode) - pusha - - call EXT_C(prot_to_real) - .code16 - - movw $0xec00, %ax - movw $0x03, %bx - int $0x15 -/* XXX still need to pass back return */ - - movw %ax, %cx - - DATA32 call EXT_C(real_to_prot) - .code32 - - xorl %eax, %eax - movw %cx, %ax - - popa - ret - -#endif /* ! STAGE1_5 */ - -/* - * This is the area for all of the special variables. - */ - - .p2align 2 /* force 4-byte alignment */ - -protstack: - .long PROTSTACKINIT - -VARIABLE(boot_drive) -#ifdef SUPPORT_DISKLESS - .long NETWORK_DRIVE -#else - .long 0 -#endif - -VARIABLE(install_second_sector) - .long 0 - - /* an address can only be long-jumped to if it is in memory, this - is used by multiple routines */ -offset: - .long 0x8000 -segment: - .word 0 - -VARIABLE(apm_bios_info) - .word 0 /* version */ - .word 0 /* cseg */ - .long 0 /* offset */ - .word 0 /* cseg_16 */ - .word 0 /* dseg_16 */ - .word 0 /* cseg_len */ - .word 0 /* cseg_16_len */ - .word 0 /* dseg_16_len */ - -/* - * This is the Global Descriptor Table - * - * An entry, a "Segment Descriptor", looks like this: - * - * 31 24 19 16 7 0 - * ------------------------------------------------------------ - * | | |B| |A| | | |1|0|E|W|A| | - * | BASE 31..24 |G|/|0|V| LIMIT |P|DPL| TYPE | BASE 23:16 | - * | | |D| |L| 19..16| | |1|1|C|R|A| | - * ------------------------------------------------------------ - * | | | - * | BASE 15..0 | LIMIT 15..0 | - * | | | - * ------------------------------------------------------------ - * - * Note the ordering of the data items is reversed from the above - * description. - */ - - .p2align 2 /* force 4-byte alignment */ -gdt: - .word 0, 0 - .byte 0, 0, 0, 0 - - /* code segment */ - .word 0xFFFF, 0 - .byte 0, 0x9A, 0xCF, 0 - - /* data segment */ - .word 0xFFFF, 0 - .byte 0, 0x92, 0xCF, 0 - - /* 16 bit real mode CS */ - .word 0xFFFF, 0 - .byte 0, 0x9E, 0, 0 - - /* 16 bit real mode DS */ - .word 0xFFFF, 0 - .byte 0, 0x92, 0, 0 - - -/* this is the GDT descriptor */ -gdtdesc: - .word 0x27 /* limit */ - .long gdt /* addr */ diff --git a/usr/src/grub/grub-0.95/stage2/bios.c b/usr/src/grub/grub-0.95/stage2/bios.c deleted file mode 100644 index 9756caa869..0000000000 --- a/usr/src/grub/grub-0.95/stage2/bios.c +++ /dev/null @@ -1,341 +0,0 @@ -/* bios.c - implement C part of low-level BIOS disk input and output */ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 1999,2000,2003,2004 Free Software Foundation, 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 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 "shared.h" - - -/* These are defined in asm.S, and never be used elsewhere, so declare the - prototypes here. */ -extern int biosdisk_int13_extensions (int ax, int drive, void *dap); -extern int biosdisk_standard (int ah, int drive, - int coff, int hoff, int soff, - int nsec, int segment); -extern int check_int13_extensions (int drive); -extern int get_diskinfo_standard (int drive, - unsigned long *cylinders, - unsigned long *heads, - unsigned long *sectors); -#if 0 -extern int get_diskinfo_floppy (int drive, - unsigned long *cylinders, - unsigned long *heads, - unsigned long *sectors); -#endif - - -/* Read/write NSEC sectors starting from SECTOR in DRIVE disk with GEOMETRY - from/into SEGMENT segment. If READ is BIOSDISK_READ, then read it, - else if READ is BIOSDISK_WRITE, then write it. If an geometry error - occurs, return BIOSDISK_ERROR_GEOMETRY, and if other error occurs, then - return the error number. Otherwise, return 0. */ -int -biosdisk (int read, int drive, struct geometry *geometry, - unsigned int sector, int nsec, int segment) -{ - - int err; - - if (geometry->flags & BIOSDISK_FLAG_LBA_EXTENSION) - { - struct disk_address_packet - { - unsigned char length; - unsigned char reserved; - unsigned short blocks; - unsigned long buffer; - unsigned long long block; - } __attribute__ ((packed)) dap; - - /* XXX: Don't check the geometry by default, because some buggy - BIOSes don't return the number of total sectors correctly, - even if they have working LBA support. Hell. */ -#ifdef NO_BUGGY_BIOS_IN_THE_WORLD - if (sector >= geometry->total_sectors) - return BIOSDISK_ERROR_GEOMETRY; -#endif /* NO_BUGGY_BIOS_IN_THE_WORLD */ - - /* FIXME: sizeof (DAP) must be 0x10. Should assert that the compiler - can't add any padding. */ - dap.length = sizeof (dap); - dap.block = sector; - dap.blocks = nsec; - dap.reserved = 0; - /* This is undocumented part. The address is formated in - SEGMENT:ADDRESS. */ - dap.buffer = segment << 16; - err = biosdisk_int13_extensions ((read + 0x42) << 8, drive, &dap); - /* - * Try to report errors upwards when the bios has read only part of - * the requested buffer, but didn't return an error code. - */ - if (err == 0 && dap.blocks != nsec) - err = BIOSDISK_ERROR_SHORT_IO; - -/* #undef NO_INT13_FALLBACK */ -#ifndef NO_INT13_FALLBACK - if (err) - { - if (geometry->flags & BIOSDISK_FLAG_CDROM) - return err; - - geometry->flags &= ~BIOSDISK_FLAG_LBA_EXTENSION; - geometry->total_sectors = (geometry->cylinders - * geometry->heads - * geometry->sectors); - return biosdisk (read, drive, geometry, sector, nsec, segment); - } -#endif /* ! NO_INT13_FALLBACK */ - - } - else - { - int cylinder_offset, head_offset, sector_offset; - int head; - /* SECTOR_OFFSET is counted from one, while HEAD_OFFSET and - CYLINDER_OFFSET are counted from zero. */ - sector_offset = sector % geometry->sectors + 1; - head = sector / geometry->sectors; - head_offset = head % geometry->heads; - cylinder_offset = head / geometry->heads; - - if (cylinder_offset >= geometry->cylinders) - return BIOSDISK_ERROR_GEOMETRY; - - err = biosdisk_standard (read + 0x02, drive, - cylinder_offset, head_offset, sector_offset, - nsec, segment); - } - - return err; -} - -/* Check bootable CD-ROM emulation status. */ -static int -get_cdinfo (int drive, struct geometry *geometry) -{ - int err; - struct iso_spec_packet - { - unsigned char size; - unsigned char media_type; - unsigned char drive_no; - unsigned char controller_no; - unsigned long image_lba; - unsigned short device_spec; - unsigned short cache_seg; - unsigned short load_seg; - unsigned short length_sec512; - unsigned char cylinders; - unsigned char sectors; - unsigned char heads; - - unsigned char dummy[16]; - } __attribute__ ((packed)) cdrp; - - grub_memset (&cdrp, 0, sizeof (cdrp)); - cdrp.size = sizeof (cdrp) - sizeof (cdrp.dummy); - err = biosdisk_int13_extensions (0x4B01, drive, &cdrp); - if (! err && cdrp.drive_no == drive) - { - if ((cdrp.media_type & 0x0F) == 0) - { - /* No emulation bootable CD-ROM */ - geometry->flags = BIOSDISK_FLAG_LBA_EXTENSION | BIOSDISK_FLAG_CDROM; - geometry->cylinders = 0; - geometry->heads = 1; - geometry->sectors = 15; - geometry->sector_size = 2048; - geometry->total_sectors = MAXINT; - return 1; - } - else - { - /* Floppy or hard-disk emulation */ - geometry->cylinders - = ((unsigned int) cdrp.cylinders - + (((unsigned int) (cdrp.sectors & 0xC0)) << 2)); - geometry->heads = cdrp.heads; - geometry->sectors = cdrp.sectors & 0x3F; - geometry->sector_size = SECTOR_SIZE; - geometry->total_sectors = (geometry->cylinders - * geometry->heads - * geometry->sectors); - return -1; - } - } - - /* - * If this is the boot_drive, default to non-emulation bootable CD-ROM. - * - * Some BIOS (Tecra S1) fails the int13 call above. If we return - * failure here, GRUB will run, but cannot see the boot drive, - * not a very good situation. Defaulting to non-emulation mode - * is a last-ditch effort. - */ - if (drive >= 0x88 && drive == boot_drive) - { - geometry->flags = BIOSDISK_FLAG_LBA_EXTENSION | BIOSDISK_FLAG_CDROM; - geometry->cylinders = 0; - geometry->heads = 1; - geometry->sectors = 15; - geometry->sector_size = 2048; - geometry->total_sectors = MAXINT; - return 1; - } - return 0; -} - -/* Return the geometry of DRIVE in GEOMETRY. If an error occurs, return - non-zero, otherwise zero. */ -int -get_diskinfo (int drive, struct geometry *geometry) -{ - int err; - - /* Clear the flags. */ - geometry->flags = 0; - - if (drive & 0x80) - { - /* hard disk or CD-ROM */ - int version; - unsigned long total_sectors = 0; - - version = check_int13_extensions (drive); - - if (drive >= 0x88 || version) - { - /* Possible CD-ROM - check the status. */ - if (get_cdinfo (drive, geometry)) - return 0; - } - - if (version) - { - struct drive_parameters - { - unsigned short size; - unsigned short flags; - unsigned long cylinders; - unsigned long heads; - unsigned long sectors; - unsigned long long total_sectors; - unsigned short bytes_per_sector; - /* ver 2.0 or higher */ - unsigned long EDD_configuration_parameters; - /* ver 3.0 or higher */ - unsigned short signature_dpi; - unsigned char length_dpi; - unsigned char reserved[3]; - unsigned char name_of_host_bus[4]; - unsigned char name_of_interface_type[8]; - unsigned char interface_path[8]; - unsigned char device_path[8]; - unsigned char reserved2; - unsigned char checksum; - - /* XXX: This is necessary, because the BIOS of Thinkpad X20 - writes a garbage to the tail of drive parameters, - regardless of a size specified in a caller. */ - unsigned char dummy[16]; - } __attribute__ ((packed)) drp; - - /* It is safe to clear out DRP. */ - grub_memset (&drp, 0, sizeof (drp)); - - /* PhoenixBIOS 4.0 Revision 6.0 for ZF Micro might understand - the greater buffer size for the "get drive parameters" int - 0x13 call in its own way. Supposedly the BIOS assumes even - bigger space is available and thus corrupts the stack. - This is why we specify the exactly necessary size of 0x42 - bytes. */ - drp.size = sizeof (drp) - sizeof (drp.dummy); - - err = biosdisk_int13_extensions (0x4800, drive, &drp); - if (! err) - { - /* Set the LBA flag. */ - geometry->flags = BIOSDISK_FLAG_LBA_EXTENSION; - - /* I'm not sure if GRUB should check the bit 1 of DRP.FLAGS, - so I omit the check for now. - okuji */ - /* if (drp.flags & (1 << 1)) */ - - /* FIXME: when the 2TB limit becomes critical, we must - change the type of TOTAL_SECTORS to unsigned long - long. */ - if (drp.total_sectors) - total_sectors = drp.total_sectors & ~0L; - else - /* Some buggy BIOSes doesn't return the total sectors - correctly but returns zero. So if it is zero, compute - it by C/H/S returned by the LBA BIOS call. */ - total_sectors = drp.cylinders * drp.heads * drp.sectors; - } - } - - /* Don't pass GEOMETRY directly, but pass each element instead, - so that we can change the structure easily. */ - err = get_diskinfo_standard (drive, - &geometry->cylinders, - &geometry->heads, - &geometry->sectors); - if (err) - return err; - - if (! total_sectors) - { - total_sectors = (geometry->cylinders - * geometry->heads - * geometry->sectors); - } - geometry->total_sectors = total_sectors; - geometry->sector_size = SECTOR_SIZE; - } - else - { - /* floppy disk */ - - /* First, try INT 13 AH=8h call. */ - err = get_diskinfo_standard (drive, - &geometry->cylinders, - &geometry->heads, - &geometry->sectors); - -#if 0 - /* If fails, then try floppy-specific probe routine. */ - if (err) - err = get_diskinfo_floppy (drive, - &geometry->cylinders, - &geometry->heads, - &geometry->sectors); -#endif - - if (err) - return err; - - geometry->total_sectors = (geometry->cylinders - * geometry->heads - * geometry->sectors); - geometry->sector_size = SECTOR_SIZE; - } - - return 0; -} diff --git a/usr/src/grub/grub-0.95/stage2/boot.c b/usr/src/grub/grub-0.95/stage2/boot.c deleted file mode 100644 index cfc2336a4c..0000000000 --- a/usr/src/grub/grub-0.95/stage2/boot.c +++ /dev/null @@ -1,1030 +0,0 @@ -/* boot.c - load and bootstrap a kernel */ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, 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 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 "shared.h" - -#include "freebsd.h" -#include "imgact_aout.h" -#include "i386-elf.h" - -static int cur_addr; -entry_func entry_addr; -static struct mod_list mll[99]; -static int linux_mem_size; - -/* - * The next two functions, 'load_image' and 'load_module', are the building - * blocks of the multiboot loader component. They handle essentially all - * of the gory details of loading in a bootable image and the modules. - */ - -kernel_t -load_image (char *kernel, char *arg, kernel_t suggested_type, - unsigned long load_flags) -{ - int len, i, exec_type = 0, align_4k = 1; - entry_func real_entry_addr = 0; - kernel_t type = KERNEL_TYPE_NONE; - unsigned long flags = 0, text_len = 0, data_len = 0, bss_len = 0; - char *str = 0, *str2 = 0; - struct linux_kernel_header *lh; - union - { - struct multiboot_header *mb; - struct exec *aout; - Elf32_Ehdr *elf; - } - pu; - /* presuming that MULTIBOOT_SEARCH is large enough to encompass an - executable header */ - unsigned char buffer[MULTIBOOT_SEARCH]; - - /* sets the header pointer to point to the beginning of the - buffer by default */ - pu.aout = (struct exec *) buffer; - - if (!grub_open (kernel)) - return KERNEL_TYPE_NONE; - - if (!(len = grub_read (buffer, MULTIBOOT_SEARCH)) || len < 32) - { - grub_close (); - - if (!errnum) - errnum = ERR_EXEC_FORMAT; - - return KERNEL_TYPE_NONE; - } - - for (i = 0; i < len; i++) - { - if (MULTIBOOT_FOUND ((int) (buffer + i), len - i)) - { - flags = ((struct multiboot_header *) (buffer + i))->flags; - if (flags & MULTIBOOT_UNSUPPORTED) - { - grub_close (); - errnum = ERR_BOOT_FEATURES; - return KERNEL_TYPE_NONE; - } - type = KERNEL_TYPE_MULTIBOOT; - str2 = "Multiboot"; - break; - } - } - - /* Use BUFFER as a linux kernel header, if the image is Linux zImage - or bzImage. */ - lh = (struct linux_kernel_header *) buffer; - - /* ELF loading supported if multiboot, FreeBSD and NetBSD. */ - if ((type == KERNEL_TYPE_MULTIBOOT - || pu.elf->e_ident[EI_OSABI] == ELFOSABI_FREEBSD - || grub_strcmp (pu.elf->e_ident + EI_BRAND, "FreeBSD") == 0 - || suggested_type == KERNEL_TYPE_NETBSD) - && len > sizeof (Elf32_Ehdr) - && BOOTABLE_I386_ELF ((*((Elf32_Ehdr *) buffer)))) - { - if (type == KERNEL_TYPE_MULTIBOOT) - entry_addr = (entry_func) pu.elf->e_entry; - else - entry_addr = (entry_func) (pu.elf->e_entry & 0xFFFFFF); - - if (entry_addr < (entry_func) 0x100000) - errnum = ERR_BELOW_1MB; - - /* don't want to deal with ELF program header at some random - place in the file -- this generally won't happen */ - if (pu.elf->e_phoff == 0 || pu.elf->e_phnum == 0 - || ((pu.elf->e_phoff + (pu.elf->e_phentsize * pu.elf->e_phnum)) - >= len)) - errnum = ERR_EXEC_FORMAT; - str = "elf"; - - if (type == KERNEL_TYPE_NONE) - { - /* At the moment, there is no way to identify a NetBSD ELF - kernel, so rely on the suggested type by the user. */ - if (suggested_type == KERNEL_TYPE_NETBSD) - { - str2 = "NetBSD"; - type = suggested_type; - } - else - { - str2 = "FreeBSD"; - type = KERNEL_TYPE_FREEBSD; - } - } - } - else if (flags & MULTIBOOT_AOUT_KLUDGE) - { - pu.mb = (struct multiboot_header *) (buffer + i); - entry_addr = (entry_func) pu.mb->entry_addr; - cur_addr = pu.mb->load_addr; - /* first offset into file */ - grub_seek (i - (pu.mb->header_addr - cur_addr)); - - /* If the load end address is zero, load the whole contents. */ - if (! pu.mb->load_end_addr) - pu.mb->load_end_addr = cur_addr + filemax; - - text_len = pu.mb->load_end_addr - cur_addr; - data_len = 0; - - /* If the bss end address is zero, assume that there is no bss area. */ - if (! pu.mb->bss_end_addr) - pu.mb->bss_end_addr = pu.mb->load_end_addr; - - bss_len = pu.mb->bss_end_addr - pu.mb->load_end_addr; - - if (pu.mb->header_addr < pu.mb->load_addr - || pu.mb->load_end_addr <= pu.mb->load_addr - || pu.mb->bss_end_addr < pu.mb->load_end_addr - || (pu.mb->header_addr - pu.mb->load_addr) > i) - errnum = ERR_EXEC_FORMAT; - - if (cur_addr < 0x100000) - errnum = ERR_BELOW_1MB; - - pu.aout = (struct exec *) buffer; - exec_type = 2; - str = "kludge"; - } - else if (len > sizeof (struct exec) && !N_BADMAG ((*(pu.aout)))) - { - entry_addr = (entry_func) pu.aout->a_entry; - - if (type == KERNEL_TYPE_NONE) - { - /* - * If it doesn't have a Multiboot header, then presume - * it is either a FreeBSD or NetBSD executable. If so, - * then use a magic number of normal ordering, ZMAGIC to - * determine if it is FreeBSD. - * - * This is all because freebsd and netbsd seem to require - * masking out some address bits... differently for each - * one... plus of course we need to know which booting - * method to use. - */ - entry_addr = (entry_func) ((int) entry_addr & 0xFFFFFF); - - if (buffer[0] == 0xb && buffer[1] == 1) - { - type = KERNEL_TYPE_FREEBSD; - cur_addr = (int) entry_addr; - str2 = "FreeBSD"; - } - else - { - type = KERNEL_TYPE_NETBSD; - cur_addr = (int) entry_addr & 0xF00000; - if (N_GETMAGIC ((*(pu.aout))) != NMAGIC) - align_4k = 0; - str2 = "NetBSD"; - } - } - - /* first offset into file */ - grub_seek (N_TXTOFF (*(pu.aout))); - text_len = pu.aout->a_text; - data_len = pu.aout->a_data; - bss_len = pu.aout->a_bss; - - if (cur_addr < 0x100000) - errnum = ERR_BELOW_1MB; - - exec_type = 1; - str = "a.out"; - } - else if (lh->boot_flag == BOOTSEC_SIGNATURE - && lh->setup_sects <= LINUX_MAX_SETUP_SECTS) - { - int big_linux = 0; - int setup_sects = lh->setup_sects; - - if (lh->header == LINUX_MAGIC_SIGNATURE && lh->version >= 0x0200) - { - big_linux = (lh->loadflags & LINUX_FLAG_BIG_KERNEL); - lh->type_of_loader = LINUX_BOOT_LOADER_TYPE; - - /* Put the real mode part at as a high location as possible. */ - linux_data_real_addr - = (char *) ((mbi.mem_lower << 10) - LINUX_SETUP_MOVE_SIZE); - /* But it must not exceed the traditional area. */ - if (linux_data_real_addr > (char *) LINUX_OLD_REAL_MODE_ADDR) - linux_data_real_addr = (char *) LINUX_OLD_REAL_MODE_ADDR; - - if (lh->version >= 0x0201) - { - lh->heap_end_ptr = LINUX_HEAP_END_OFFSET; - lh->loadflags |= LINUX_FLAG_CAN_USE_HEAP; - } - - if (lh->version >= 0x0202) - lh->cmd_line_ptr = linux_data_real_addr + LINUX_CL_OFFSET; - else - { - lh->cl_magic = LINUX_CL_MAGIC; - lh->cl_offset = LINUX_CL_OFFSET; - lh->setup_move_size = LINUX_SETUP_MOVE_SIZE; - } - } - else - { - /* Your kernel is quite old... */ - lh->cl_magic = LINUX_CL_MAGIC; - lh->cl_offset = LINUX_CL_OFFSET; - - setup_sects = LINUX_DEFAULT_SETUP_SECTS; - - linux_data_real_addr = (char *) LINUX_OLD_REAL_MODE_ADDR; - } - - /* If SETUP_SECTS is not set, set it to the default (4). */ - if (! setup_sects) - setup_sects = LINUX_DEFAULT_SETUP_SECTS; - - data_len = setup_sects << 9; - text_len = filemax - data_len - SECTOR_SIZE; - - linux_data_tmp_addr = (char *) LINUX_BZIMAGE_ADDR + text_len; - - if (! big_linux - && text_len > linux_data_real_addr - (char *) LINUX_ZIMAGE_ADDR) - { - grub_printf (" linux 'zImage' kernel too big, try 'make bzImage'\n"); - errnum = ERR_WONT_FIT; - } - else if (linux_data_real_addr + LINUX_SETUP_MOVE_SIZE - > RAW_ADDR ((char *) (mbi.mem_lower << 10))) - errnum = ERR_WONT_FIT; - else - { - grub_printf (" [Linux-%s, setup=0x%x, size=0x%x]\n", - (big_linux ? "bzImage" : "zImage"), data_len, text_len); - - /* Video mode selection support. What a mess! */ - /* NOTE: Even the word "mess" is not still enough to - represent how wrong and bad the Linux video support is, - but I don't want to hear complaints from Linux fanatics - any more. -okuji */ - { - char *vga; - - /* Find the substring "vga=". */ - vga = grub_strstr (arg, "vga="); - if (vga) - { - char *value = vga + 4; - int vid_mode; - - /* Handle special strings. */ - if (substring ("normal", value) < 1) - vid_mode = LINUX_VID_MODE_NORMAL; - else if (substring ("ext", value) < 1) - vid_mode = LINUX_VID_MODE_EXTENDED; - else if (substring ("ask", value) < 1) - vid_mode = LINUX_VID_MODE_ASK; - else if (safe_parse_maxint (&value, &vid_mode)) - ; - else - { - /* ERRNUM is already set inside the function - safe_parse_maxint. */ - grub_close (); - return KERNEL_TYPE_NONE; - } - - lh->vid_mode = vid_mode; - } - } - - /* Check the mem= option to limit memory used for initrd. */ - { - char *mem; - - mem = grub_strstr (arg, "mem="); - if (mem) - { - char *value = mem + 4; - - safe_parse_maxint (&value, &linux_mem_size); - switch (errnum) - { - case ERR_NUMBER_OVERFLOW: - /* If an overflow occurs, use the maximum address for - initrd instead. This is good, because MAXINT is - greater than LINUX_INITRD_MAX_ADDRESS. */ - linux_mem_size = LINUX_INITRD_MAX_ADDRESS; - errnum = ERR_NONE; - break; - - case ERR_NONE: - { - int shift = 0; - - switch (grub_tolower (*value)) - { - case 'g': - shift += 10; - case 'm': - shift += 10; - case 'k': - shift += 10; - default: - break; - } - - /* Check an overflow. */ - if (linux_mem_size > (MAXINT >> shift)) - linux_mem_size = LINUX_INITRD_MAX_ADDRESS; - else - linux_mem_size <<= shift; - } - break; - - default: - linux_mem_size = 0; - errnum = ERR_NONE; - break; - } - } - else - linux_mem_size = 0; - } - - /* It is possible that DATA_LEN + SECTOR_SIZE is greater than - MULTIBOOT_SEARCH, so the data may have been read partially. */ - if (data_len + SECTOR_SIZE <= MULTIBOOT_SEARCH) - grub_memmove (linux_data_tmp_addr, buffer, - data_len + SECTOR_SIZE); - else - { - grub_memmove (linux_data_tmp_addr, buffer, MULTIBOOT_SEARCH); - grub_read (linux_data_tmp_addr + MULTIBOOT_SEARCH, - data_len + SECTOR_SIZE - MULTIBOOT_SEARCH); - } - - if (lh->header != LINUX_MAGIC_SIGNATURE || - lh->version < 0x0200) - /* Clear the heap space. */ - grub_memset (linux_data_tmp_addr + ((setup_sects + 1) << 9), - 0, - (64 - setup_sects - 1) << 9); - - /* Copy command-line plus memory hack to staging area. - NOTE: Linux has a bug that it doesn't handle multiple spaces - between two options and a space after a "mem=" option isn't - removed correctly so the arguments to init could be like - {"init", "", "", NULL}. This affects some not-very-clever - shells. Thus, the code below does a trick to avoid the bug. - That is, copy "mem=XXX" to the end of the command-line, and - avoid to copy spaces unnecessarily. Hell. */ - { - char *src = skip_to (0, arg); - char *dest = linux_data_tmp_addr + LINUX_CL_OFFSET; - - while (dest < linux_data_tmp_addr + LINUX_CL_END_OFFSET && *src) - *(dest++) = *(src++); - - /* Old Linux kernels have problems determining the amount of - the available memory. To work around this problem, we add - the "mem" option to the kernel command line. This has its - own drawbacks because newer kernels can determine the - memory map more accurately. Boot protocol 2.03, which - appeared in Linux 2.4.18, provides a pointer to the kernel - version string, so we could check it. But since kernel - 2.4.18 and newer are known to detect memory reliably, boot - protocol 2.03 already implies that the kernel is new - enough. The "mem" option is added if neither of the - following conditions is met: - 1) The "mem" option is already present. - 2) The "kernel" command is used with "--no-mem-option". - 3) GNU GRUB is configured not to pass the "mem" option. - 4) The kernel supports boot protocol 2.03 or newer. */ - if (! grub_strstr (arg, "mem=") - && ! (load_flags & KERNEL_LOAD_NO_MEM_OPTION) - && lh->version < 0x0203 /* kernel version < 2.4.18 */ - && dest + 15 < linux_data_tmp_addr + LINUX_CL_END_OFFSET) - { - *dest++ = ' '; - *dest++ = 'm'; - *dest++ = 'e'; - *dest++ = 'm'; - *dest++ = '='; - - dest = convert_to_ascii (dest, 'u', (extended_memory + 0x400)); - *dest++ = 'K'; - } - - *dest = 0; - } - - /* offset into file */ - grub_seek (data_len + SECTOR_SIZE); - - cur_addr = (int) linux_data_tmp_addr + LINUX_SETUP_MOVE_SIZE; - grub_read ((char *) LINUX_BZIMAGE_ADDR, text_len); - - if (errnum == ERR_NONE) - { - grub_close (); - - /* Sanity check. */ - if (suggested_type != KERNEL_TYPE_NONE - && ((big_linux && suggested_type != KERNEL_TYPE_BIG_LINUX) - || (! big_linux && suggested_type != KERNEL_TYPE_LINUX))) - { - errnum = ERR_EXEC_FORMAT; - return KERNEL_TYPE_NONE; - } - - /* Ugly hack. */ - linux_text_len = text_len; - - return big_linux ? KERNEL_TYPE_BIG_LINUX : KERNEL_TYPE_LINUX; - } - } - } - else /* no recognizable format */ - errnum = ERR_EXEC_FORMAT; - - /* return if error */ - if (errnum) - { - grub_close (); - return KERNEL_TYPE_NONE; - } - - /* fill the multiboot info structure */ - mbi.cmdline = (int) arg; - mbi.mods_count = 0; - mbi.mods_addr = 0; - mbi.boot_device = (current_drive << 24) | current_partition; - mbi.flags &= ~(MB_INFO_MODS | MB_INFO_AOUT_SYMS | MB_INFO_ELF_SHDR); - mbi.syms.a.tabsize = 0; - mbi.syms.a.strsize = 0; - mbi.syms.a.addr = 0; - mbi.syms.a.pad = 0; - - printf (" [%s-%s", str2, str); - - str = ""; - - if (exec_type) /* can be loaded like a.out */ - { - if (flags & MULTIBOOT_AOUT_KLUDGE) - str = "-and-data"; - - printf (", loadaddr=0x%x, text%s=0x%x", cur_addr, str, text_len); - - /* read text, then read data */ - if (grub_read ((char *) RAW_ADDR (cur_addr), text_len) == text_len) - { - cur_addr += text_len; - - if (!(flags & MULTIBOOT_AOUT_KLUDGE)) - { - /* we have to align to a 4K boundary */ - if (align_4k) - cur_addr = (cur_addr + 0xFFF) & 0xFFFFF000; - else - printf (", C"); - - printf (", data=0x%x", data_len); - - if ((grub_read ((char *) RAW_ADDR (cur_addr), data_len) - != data_len) - && !errnum) - errnum = ERR_EXEC_FORMAT; - cur_addr += data_len; - } - - if (!errnum) - { - memset ((char *) RAW_ADDR (cur_addr), 0, bss_len); - cur_addr += bss_len; - - printf (", bss=0x%x", bss_len); - } - } - else if (!errnum) - errnum = ERR_EXEC_FORMAT; - - if (!errnum && pu.aout->a_syms - && pu.aout->a_syms < (filemax - filepos)) - { - int symtab_err, orig_addr = cur_addr; - - /* we should align to a 4K boundary here for good measure */ - if (align_4k) - cur_addr = (cur_addr + 0xFFF) & 0xFFFFF000; - - mbi.syms.a.addr = cur_addr; - - *((int *) RAW_ADDR (cur_addr)) = pu.aout->a_syms; - cur_addr += sizeof (int); - - printf (", symtab=0x%x", pu.aout->a_syms); - - if (grub_read ((char *) RAW_ADDR (cur_addr), pu.aout->a_syms) - == pu.aout->a_syms) - { - cur_addr += pu.aout->a_syms; - mbi.syms.a.tabsize = pu.aout->a_syms; - - if (grub_read ((char *) &i, sizeof (int)) == sizeof (int)) - { - *((int *) RAW_ADDR (cur_addr)) = i; - cur_addr += sizeof (int); - - mbi.syms.a.strsize = i; - - i -= sizeof (int); - - printf (", strtab=0x%x", i); - - symtab_err = (grub_read ((char *) RAW_ADDR (cur_addr), i) - != i); - cur_addr += i; - } - else - symtab_err = 1; - } - else - symtab_err = 1; - - if (symtab_err) - { - printf ("(bad)"); - cur_addr = orig_addr; - mbi.syms.a.tabsize = 0; - mbi.syms.a.strsize = 0; - mbi.syms.a.addr = 0; - } - else - mbi.flags |= MB_INFO_AOUT_SYMS; - } - } - else - /* ELF executable */ - { - unsigned loaded = 0, memaddr, memsiz, filesiz; - Elf32_Phdr *phdr; - - /* reset this to zero for now */ - cur_addr = 0; - - /* scan for program segments */ - for (i = 0; i < pu.elf->e_phnum; i++) - { - phdr = (Elf32_Phdr *) - (pu.elf->e_phoff + ((int) buffer) - + (pu.elf->e_phentsize * i)); - if (phdr->p_type == PT_LOAD) - { - /* offset into file */ - grub_seek (phdr->p_offset); - filesiz = phdr->p_filesz; - - if (type == KERNEL_TYPE_FREEBSD || type == KERNEL_TYPE_NETBSD) - memaddr = RAW_ADDR (phdr->p_paddr & 0xFFFFFF); - else - memaddr = RAW_ADDR (phdr->p_paddr); - - memsiz = phdr->p_memsz; - if (memaddr < RAW_ADDR (0x100000)) - errnum = ERR_BELOW_1MB; - - /* If the memory range contains the entry address, get the - physical address here. */ - if (type == KERNEL_TYPE_MULTIBOOT - && (unsigned) entry_addr >= phdr->p_vaddr - && (unsigned) entry_addr < phdr->p_vaddr + memsiz) - real_entry_addr = (entry_func) ((unsigned) entry_addr - + memaddr - phdr->p_vaddr); - - /* make sure we only load what we're supposed to! */ - if (filesiz > memsiz) - filesiz = memsiz; - /* mark memory as used */ - if (cur_addr < memaddr + memsiz) - cur_addr = memaddr + memsiz; - printf (", <0x%x:0x%x:0x%x>", memaddr, filesiz, - memsiz - filesiz); - /* increment number of segments */ - loaded++; - - /* load the segment */ - if (memcheck (memaddr, memsiz) - && grub_read ((char *) memaddr, filesiz) == filesiz) - { - if (memsiz > filesiz) - memset ((char *) (memaddr + filesiz), 0, memsiz - filesiz); - } - else - break; - } - } - - if (! errnum) - { - if (! loaded) - errnum = ERR_EXEC_FORMAT; - else - { - /* Load ELF symbols. */ - Elf32_Shdr *shdr = NULL; - int tab_size, sec_size; - int symtab_err = 0; - - mbi.syms.e.num = pu.elf->e_shnum; - mbi.syms.e.size = pu.elf->e_shentsize; - mbi.syms.e.shndx = pu.elf->e_shstrndx; - - /* We should align to a 4K boundary here for good measure. */ - if (align_4k) - cur_addr = (cur_addr + 0xFFF) & 0xFFFFF000; - - tab_size = pu.elf->e_shentsize * pu.elf->e_shnum; - - grub_seek (pu.elf->e_shoff); - /* - * Should not need to call RAW_ADDR; cur_addr is already - * adjusted to account for grub_scratch_mem. - * XXX Linux might calculate cur_addr differently. - */ - if (grub_read ((char *) (cur_addr), tab_size) - == tab_size) - { - mbi.syms.e.addr = cur_addr; - shdr = (Elf32_Shdr *) mbi.syms.e.addr; - cur_addr += tab_size; - - printf (", shtab=0x%x", cur_addr); - - for (i = 0; i < mbi.syms.e.num; i++) - { - /* This section is a loaded section, - so we don't care. */ - if (shdr[i].sh_addr != 0) - continue; - - /* This section is empty, so we don't care. */ - if (shdr[i].sh_size == 0) - continue; - - /* Align the section to a sh_addralign bits boundary. */ - cur_addr = ((cur_addr + shdr[i].sh_addralign) & - - (int) shdr[i].sh_addralign); - - grub_seek (shdr[i].sh_offset); - - sec_size = shdr[i].sh_size; - - /* - * Should not need to call RAW_ADDR; cur_addr is already - * adjusted to account for grub_scratch_mem. - * XXX Linux might calculate cur_addr differently. - */ - if (! (memcheck (cur_addr, sec_size) - && (grub_read ((char *) (cur_addr), - sec_size) - == sec_size))) - { - symtab_err = 1; - break; - } - - shdr[i].sh_addr = cur_addr; - cur_addr += sec_size; - } - } - else - symtab_err = 1; - - if (mbi.syms.e.addr < RAW_ADDR(0x10000)) - symtab_err = 1; - - if (symtab_err) - { - printf ("(bad)"); - mbi.syms.e.num = 0; - mbi.syms.e.size = 0; - mbi.syms.e.addr = 0; - mbi.syms.e.shndx = 0; - cur_addr = 0; - } - else - mbi.flags |= MB_INFO_ELF_SHDR; - } - } - } - - if (! errnum) - { - grub_printf (", entry=0x%x]\n", (unsigned) entry_addr); - - /* If the entry address is physically different from that of the ELF - header, correct it here. */ - if (real_entry_addr) - entry_addr = real_entry_addr; - } - else - { - putchar ('\n'); - type = KERNEL_TYPE_NONE; - } - - grub_close (); - - /* Sanity check. */ - if (suggested_type != KERNEL_TYPE_NONE && suggested_type != type) - { - errnum = ERR_EXEC_FORMAT; - return KERNEL_TYPE_NONE; - } - - return type; -} - -int -load_module (char *module, char *arg) -{ - int len; - - /* if we are supposed to load on 4K boundaries */ - cur_addr = (cur_addr + 0xFFF) & 0xFFFFF000; - - if (!grub_open (module)) - return 0; - - len = grub_read ((char *) cur_addr, -1); - if (! len) - { - grub_close (); - return 0; - } - - printf (" [Multiboot-module @ 0x%x, 0x%x bytes]\n", cur_addr, len); - - /* these two simply need to be set if any modules are loaded at all */ - mbi.flags |= MB_INFO_MODS; - mbi.mods_addr = (int) mll; - - mll[mbi.mods_count].cmdline = (int) arg; - mll[mbi.mods_count].mod_start = cur_addr; - cur_addr += len; - mll[mbi.mods_count].mod_end = cur_addr; - mll[mbi.mods_count].pad = 0; - - /* increment number of modules included */ - mbi.mods_count++; - - grub_close (); - return 1; -} - -int -load_initrd (char *initrd) -{ - int len; - unsigned long moveto; - unsigned long max_addr; - struct linux_kernel_header *lh - = (struct linux_kernel_header *) (cur_addr - LINUX_SETUP_MOVE_SIZE); - -#ifndef NO_DECOMPRESSION - no_decompression = 1; -#endif - - if (! grub_open (initrd)) - goto fail; - - len = grub_read ((char *) cur_addr, -1); - if (! len) - { - grub_close (); - goto fail; - } - - if (linux_mem_size) - moveto = linux_mem_size; - else - moveto = (mbi.mem_upper + 0x400) << 10; - - moveto = (moveto - len) & 0xfffff000; - max_addr = (lh->header == LINUX_MAGIC_SIGNATURE && lh->version >= 0x0203 - ? lh->initrd_addr_max : LINUX_INITRD_MAX_ADDRESS); - if (moveto + len >= max_addr) - moveto = (max_addr - len) & 0xfffff000; - - /* XXX: Linux 2.3.xx has a bug in the memory range check, so avoid - the last page. - XXX: Linux 2.2.xx has a bug in the memory range check, which is - worse than that of Linux 2.3.xx, so avoid the last 64kb. *sigh* */ - moveto -= 0x10000; - memmove ((void *) RAW_ADDR (moveto), (void *) cur_addr, len); - - printf (" [Linux-initrd @ 0x%x, 0x%x bytes]\n", moveto, len); - - /* FIXME: Should check if the kernel supports INITRD. */ - lh->ramdisk_image = RAW_ADDR (moveto); - lh->ramdisk_size = len; - - grub_close (); - - fail: - -#ifndef NO_DECOMPRESSION - no_decompression = 0; -#endif - - return ! errnum; -} - - -#ifdef GRUB_UTIL -/* Dummy function to fake the *BSD boot. */ -static void -bsd_boot_entry (int flags, int bootdev, int sym_start, int sym_end, - int mem_upper, int mem_lower) -{ - stop (); -} -#endif - - -/* - * All "*_boot" commands depend on the images being loaded into memory - * correctly, the variables in this file being set up correctly, and - * the root partition being set in the 'saved_drive' and 'saved_partition' - * variables. - */ - - -void -bsd_boot (kernel_t type, int bootdev, char *arg) -{ - char *str; - int clval = 0, i; - struct bootinfo bi; - -#ifdef GRUB_UTIL - entry_addr = (entry_func) bsd_boot_entry; -#else - stop_floppy (); -#endif - - while (*(++arg) && *arg != ' '); - str = arg; - while (*str) - { - if (*str == '-') - { - while (*str && *str != ' ') - { - if (*str == 'C') - clval |= RB_CDROM; - if (*str == 'a') - clval |= RB_ASKNAME; - if (*str == 'b') - clval |= RB_HALT; - if (*str == 'c') - clval |= RB_CONFIG; - if (*str == 'd') - clval |= RB_KDB; - if (*str == 'D') - clval |= RB_MULTIPLE; - if (*str == 'g') - clval |= RB_GDB; - if (*str == 'h') - clval |= RB_SERIAL; - if (*str == 'm') - clval |= RB_MUTE; - if (*str == 'r') - clval |= RB_DFLTROOT; - if (*str == 's') - clval |= RB_SINGLE; - if (*str == 'v') - clval |= RB_VERBOSE; - str++; - } - continue; - } - str++; - } - - if (type == KERNEL_TYPE_FREEBSD) - { - clval |= RB_BOOTINFO; - - bi.bi_version = BOOTINFO_VERSION; - - *arg = 0; - while ((--arg) > (char *) MB_CMDLINE_BUF && *arg != '/'); - if (*arg == '/') - bi.bi_kernelname = arg + 1; - else - bi.bi_kernelname = 0; - - bi.bi_nfs_diskless = 0; - bi.bi_n_bios_used = 0; /* this field is apparently unused */ - - for (i = 0; i < N_BIOS_GEOM; i++) - { - struct geometry geom; - - /* XXX Should check the return value. */ - get_diskinfo (i + 0x80, &geom); - /* FIXME: If HEADS or SECTORS is greater than 255, then this will - break the geometry information. That is a drawback of BSD - but not of GRUB. */ - bi.bi_bios_geom[i] = (((geom.cylinders - 1) << 16) - + (((geom.heads - 1) & 0xff) << 8) - + (geom.sectors & 0xff)); - } - - bi.bi_size = sizeof (struct bootinfo); - bi.bi_memsizes_valid = 1; - bi.bi_bios_dev = saved_drive; - bi.bi_basemem = mbi.mem_lower; - bi.bi_extmem = extended_memory; - - if (mbi.flags & MB_INFO_AOUT_SYMS) - { - bi.bi_symtab = mbi.syms.a.addr; - bi.bi_esymtab = mbi.syms.a.addr + 4 - + mbi.syms.a.tabsize + mbi.syms.a.strsize; - } -#if 0 - else if (mbi.flags & MB_INFO_ELF_SHDR) - { - /* FIXME: Should check if a symbol table exists and, if exists, - pass the table to BI. */ - } -#endif - else - { - bi.bi_symtab = 0; - bi.bi_esymtab = 0; - } - - /* call entry point */ - (*entry_addr) (clval, bootdev, 0, 0, 0, ((int) (&bi))); - } - else - { - /* - * We now pass the various bootstrap parameters to the loaded - * image via the argument list. - * - * This is the official list: - * - * arg0 = 8 (magic) - * arg1 = boot flags - * arg2 = boot device - * arg3 = start of symbol table (0 if not loaded) - * arg4 = end of symbol table (0 if not loaded) - * arg5 = transfer address from image - * arg6 = transfer address for next image pointer - * arg7 = conventional memory size (640) - * arg8 = extended memory size (8196) - * - * ...in actuality, we just pass the parameters used by the kernel. - */ - - /* call entry point */ - unsigned long end_mark; - - if (mbi.flags & MB_INFO_AOUT_SYMS) - end_mark = (mbi.syms.a.addr + 4 - + mbi.syms.a.tabsize + mbi.syms.a.strsize); - else - /* FIXME: it should be mbi.syms.e.size. */ - end_mark = 0; - - (*entry_addr) (clval, bootdev, 0, end_mark, - extended_memory, mbi.mem_lower); - } -} diff --git a/usr/src/grub/grub-0.95/stage2/builtins.c b/usr/src/grub/grub-0.95/stage2/builtins.c deleted file mode 100644 index 1af0d8dfa3..0000000000 --- a/usr/src/grub/grub-0.95/stage2/builtins.c +++ /dev/null @@ -1,5860 +0,0 @@ -/* builtins.c - the GRUB builtin commands */ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, 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 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. - */ - -/* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Include stdio.h before shared.h, because we can't define - WITHOUT_LIBC_STUBS here. */ -#ifdef GRUB_UTIL -# include -#endif - -#include -#include -#include - -#ifdef SUPPORT_NETBOOT -# include -#endif - -#ifdef SUPPORT_SERIAL -# include -# include -#endif - -#ifdef GRUB_UTIL -# include -#else /* ! GRUB_UTIL */ -# include -# include -#endif /* ! GRUB_UTIL */ - -#ifdef USE_MD5_PASSWORDS -# include -#endif - -#include - -/* The type of kernel loaded. */ -kernel_t kernel_type; -/* The boot device. */ -static int bootdev; -/* True when the debug mode is turned on, and false - when it is turned off. */ -int debug = 0; -/* The default entry. */ -int default_entry = 0; -/* The fallback entry. */ -int fallback_entryno; -int fallback_entries[MAX_FALLBACK_ENTRIES]; -/* The number of current entry. */ -int current_entryno; -/* The address for Multiboot command-line buffer. */ -static char *mb_cmdline; -/* The password. */ -char *password; -/* The password type. */ -password_t password_type; -/* The flag for indicating that the user is authoritative. */ -int auth = 0; -/* The timeout. */ -int grub_timeout = -1; -/* Whether to show the menu or not. */ -int show_menu = 1; -/* The BIOS drive map. */ -static unsigned short bios_drive_map[DRIVE_MAP_SIZE + 1]; - -/* Prototypes for allowing straightfoward calling of builtins functions - inside other functions. */ -static int configfile_func (char *arg, int flags); -#ifdef SUPPORT_NETBOOT -static void solaris_config_file (void); -#endif - -static unsigned int min_mem64 = 0; - -#if defined(__sun) && !defined(GRUB_UTIL) -extern void __enable_execute_stack (void *); -void -__enable_execute_stack (void *addr) -{ -} -#endif /* __sun && !GRUB_UTIL */ - -/* Initialize the data for builtins. */ -void -init_builtins (void) -{ - kernel_type = KERNEL_TYPE_NONE; - /* BSD and chainloading evil hacks! */ - bootdev = set_bootdev (0); - mb_cmdline = (char *) MB_CMDLINE_BUF; -} - -/* Initialize the data for the configuration file. */ -void -init_config (void) -{ - default_entry = 0; - password = 0; - fallback_entryno = -1; - fallback_entries[0] = -1; - grub_timeout = -1; - current_rootpool[0] = '\0'; - current_bootfs[0] = '\0'; - current_bootpath[0] = '\0'; - current_bootfs_obj = 0; - current_devid[0] = '\0'; - is_zfs_mount = 0; -} - -/* Check a password for correctness. Returns 0 if password was - correct, and a value != 0 for error, similarly to strcmp. */ -int -check_password (char *entered, char* expected, password_t type) -{ - switch (type) - { - case PASSWORD_PLAIN: - return strcmp (entered, expected); - -#ifdef USE_MD5_PASSWORDS - case PASSWORD_MD5: - return check_md5_password (entered, expected); -#endif - default: - /* unsupported password type: be secure */ - return 1; - } -} - -/* Print which sector is read when loading a file. */ -static void -disk_read_print_func(unsigned int sector, int offset, int length) -{ - grub_printf ("[%u,%d,%d]", sector, offset, length); -} - - -/* blocklist */ -static int -blocklist_func (char *arg, int flags) -{ - char *dummy = (char *) RAW_ADDR (0x100000); - int start_sector; - int num_sectors = 0; - int num_entries = 0; - int last_length = 0; - - /* Collect contiguous blocks into one entry as many as possible, - and print the blocklist notation on the screen. */ - static void disk_read_blocklist_func(unsigned int sector, int offset, - int length) - { - if (num_sectors > 0) - { - if (start_sector + num_sectors == sector - && offset == 0 && last_length == SECTOR_SIZE) - { - num_sectors++; - last_length = length; - return; - } - else - { - if (last_length == SECTOR_SIZE) - grub_printf ("%s%d+%d", num_entries ? "," : "", - start_sector - part_start, num_sectors); - else if (num_sectors > 1) - grub_printf ("%s%d+%d,%d[0-%d]", num_entries ? "," : "", - start_sector - part_start, num_sectors-1, - start_sector + num_sectors-1 - part_start, - last_length); - else - grub_printf ("%s%d[0-%d]", num_entries ? "," : "", - start_sector - part_start, last_length); - num_entries++; - num_sectors = 0; - } - } - - if (offset > 0) - { - grub_printf("%s%d[%d-%d]", num_entries ? "," : "", - sector-part_start, offset, offset+length); - num_entries++; - } - else - { - start_sector = sector; - num_sectors = 1; - last_length = length; - } - } - - /* Open the file. */ - if (! grub_open (arg)) - return 1; - - /* Print the device name. */ - grub_printf ("(%cd%d", - (current_drive & 0x80) ? 'h' : 'f', - current_drive & ~0x80); - - if ((current_partition & 0xFF0000) != 0xFF0000) - grub_printf (",%d", (current_partition >> 16) & 0xFF); - - if ((current_partition & 0x00FF00) != 0x00FF00) - grub_printf (",%c", 'a' + ((current_partition >> 8) & 0xFF)); - - grub_printf (")"); - - /* Read in the whole file to DUMMY. */ - disk_read_hook = disk_read_blocklist_func; - if (! grub_read (dummy, -1)) - goto fail; - - /* The last entry may not be printed yet. Don't check if it is a - * full sector, since it doesn't matter if we read too much. */ - if (num_sectors > 0) - grub_printf ("%s%d+%d", num_entries ? "," : "", - start_sector - part_start, num_sectors); - - grub_printf ("\n"); - - fail: - disk_read_hook = 0; - grub_close (); - return errnum; -} - -static struct builtin builtin_blocklist = -{ - "blocklist", - blocklist_func, - BUILTIN_CMDLINE | BUILTIN_HELP_LIST, - "blocklist FILE", - "Print the blocklist notation of the file FILE." -}; - -/* boot */ -static int -boot_func (char *arg, int flags) -{ - /* Clear the int15 handler if we can boot the kernel successfully. - This assumes that the boot code never fails only if KERNEL_TYPE is - not KERNEL_TYPE_NONE. Is this assumption is bad? */ - if (kernel_type != KERNEL_TYPE_NONE) - unset_int15_handler (); - -#ifdef SUPPORT_NETBOOT - /* Shut down the networking. */ - cleanup_net (); -#endif - - switch (kernel_type) - { - case KERNEL_TYPE_FREEBSD: - case KERNEL_TYPE_NETBSD: - /* *BSD */ - bsd_boot (kernel_type, bootdev, (char *) mbi.cmdline); - break; - - case KERNEL_TYPE_LINUX: - /* Linux */ - linux_boot (); - break; - - case KERNEL_TYPE_BIG_LINUX: - /* Big Linux */ - big_linux_boot (); - break; - - case KERNEL_TYPE_CHAINLOADER: - /* Chainloader */ - - /* Check if we should set the int13 handler. */ - if (bios_drive_map[0] != 0) - { - int i; - - /* Search for SAVED_DRIVE. */ - for (i = 0; i < DRIVE_MAP_SIZE; i++) - { - if (! bios_drive_map[i]) - break; - else if ((bios_drive_map[i] & 0xFF) == saved_drive) - { - /* Exchage SAVED_DRIVE with the mapped drive. */ - saved_drive = (bios_drive_map[i] >> 8) & 0xFF; - break; - } - } - - /* Set the handler. This is somewhat dangerous. */ - set_int13_handler (bios_drive_map); - } - - gateA20 (0); - boot_drive = saved_drive; - chain_stage1 (0, BOOTSEC_LOCATION, boot_part_addr); - break; - - case KERNEL_TYPE_MULTIBOOT: - /* Multiboot */ -#ifdef SUPPORT_NETBOOT -#ifdef SOLARIS_NETBOOT - if (current_drive == NETWORK_DRIVE) { - /* - * XXX Solaris hack: use drive_info to pass network information - * Turn off the flag bit to the loader is technically - * multiboot compliant. - */ - mbi.flags &= ~MB_INFO_DRIVE_INFO; - mbi.drives_length = dhcpack_length; - mbi.drives_addr = dhcpack_buf; - } -#endif /* SOLARIS_NETBOOT */ -#endif - multi_boot ((int) entry_addr, (int) &mbi); - break; - - default: - errnum = ERR_BOOT_COMMAND; - return 1; - } - - return 0; -} - -static struct builtin builtin_boot = -{ - "boot", - boot_func, - BUILTIN_CMDLINE | BUILTIN_HELP_LIST, - "boot", - "Boot the OS/chain-loader which has been loaded." -}; - - -#ifdef SUPPORT_NETBOOT -/* bootp */ -static int -bootp_func (char *arg, int flags) -{ - int with_configfile = 0; - - if (grub_memcmp (arg, "--with-configfile", sizeof ("--with-configfile") - 1) - == 0) - { - with_configfile = 1; - arg = skip_to (0, arg); - } - - if (! bootp ()) - { - if (errnum == ERR_NONE) - errnum = ERR_DEV_VALUES; - - return 1; - } - - /* Notify the configuration. */ - print_network_configuration (); - - /* XXX: this can cause an endless loop, but there is no easy way to - detect such a loop unfortunately. */ - if (with_configfile) - configfile_func (config_file, flags); - - return 0; -} - -static struct builtin builtin_bootp = -{ - "bootp", - bootp_func, - BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_HELP_LIST, - "bootp [--with-configfile]", - "Initialize a network device via BOOTP. If the option `--with-configfile'" - " is given, try to load a configuration file specified by the 150 vendor" - " tag." -}; -#endif /* SUPPORT_NETBOOT */ - - -/* cat */ -static int -cat_func (char *arg, int flags) -{ - char c; - - if (! grub_open (arg)) - return 1; - - while (grub_read (&c, 1)) - { - /* Because running "cat" with a binary file can confuse the terminal, - print only some characters as they are. */ - if (grub_isspace (c) || (c >= ' ' && c <= '~')) - grub_putchar (c); - else - grub_putchar ('?'); - } - - grub_close (); - return 0; -} - -static struct builtin builtin_cat = -{ - "cat", - cat_func, - BUILTIN_CMDLINE | BUILTIN_HELP_LIST, - "cat FILE", - "Print the contents of the file FILE." -}; - - -/* chainloader */ -static int -chainloader_func (char *arg, int flags) -{ - int force = 0; - char *file = arg; - - /* If the option `--force' is specified? */ - if (substring ("--force", arg) <= 0) - { - force = 1; - file = skip_to (0, arg); - } - - /* Open the file. */ - if (! grub_open (file)) - { - kernel_type = KERNEL_TYPE_NONE; - return 1; - } - - /* Read the first block. */ - if (grub_read ((char *) BOOTSEC_LOCATION, SECTOR_SIZE) != SECTOR_SIZE) - { - grub_close (); - kernel_type = KERNEL_TYPE_NONE; - - /* This below happens, if a file whose size is less than 512 bytes - is loaded. */ - if (errnum == ERR_NONE) - errnum = ERR_EXEC_FORMAT; - - return 1; - } - - /* If not loading it forcibly, check for the signature. */ - if (! force - && (*((unsigned short *) (BOOTSEC_LOCATION + BOOTSEC_SIG_OFFSET)) - != BOOTSEC_SIGNATURE)) - { - grub_close (); - errnum = ERR_EXEC_FORMAT; - kernel_type = KERNEL_TYPE_NONE; - return 1; - } - - grub_close (); - kernel_type = KERNEL_TYPE_CHAINLOADER; - - /* XXX: Windows evil hack. For now, only the first five letters are - checked. */ - if (IS_PC_SLICE_TYPE_FAT (current_slice) - && ! grub_memcmp ((char *) BOOTSEC_LOCATION + BOOTSEC_BPB_SYSTEM_ID, - "MSWIN", 5)) - *((unsigned long *) (BOOTSEC_LOCATION + BOOTSEC_BPB_HIDDEN_SECTORS)) - = part_start; - - errnum = ERR_NONE; - - return 0; -} - -static struct builtin builtin_chainloader = -{ - "chainloader", - chainloader_func, - BUILTIN_CMDLINE | BUILTIN_HELP_LIST, - "chainloader [--force] FILE", - "Load the chain-loader FILE. If --force is specified, then load it" - " forcibly, whether the boot loader signature is present or not." -}; - - -/* This function could be used to debug new filesystem code. Put a file - in the new filesystem and the same file in a well-tested filesystem. - Then, run "cmp" with the files. If no output is obtained, probably - the code is good, otherwise investigate what's wrong... */ -/* cmp FILE1 FILE2 */ -static int -cmp_func (char *arg, int flags) -{ - /* The filenames. */ - char *file1, *file2; - /* The addresses. */ - char *addr1, *addr2; - int i; - /* The size of the file. */ - int size; - - /* Get the filenames from ARG. */ - file1 = arg; - file2 = skip_to (0, arg); - if (! *file1 || ! *file2) - { - errnum = ERR_BAD_ARGUMENT; - return 1; - } - - /* Terminate the filenames for convenience. */ - nul_terminate (file1); - nul_terminate (file2); - - /* Read the whole data from FILE1. */ - addr1 = (char *) RAW_ADDR (0x100000); - if (! grub_open (file1)) - return 1; - - /* Get the size. */ - size = filemax; - if (grub_read (addr1, -1) != size) - { - grub_close (); - return 1; - } - - grub_close (); - - /* Read the whole data from FILE2. */ - addr2 = addr1 + size; - if (! grub_open (file2)) - return 1; - - /* Check if the size of FILE2 is equal to the one of FILE2. */ - if (size != filemax) - { - grub_printf ("Differ in size: 0x%x [%s], 0x%x [%s]\n", - size, file1, filemax, file2); - grub_close (); - return 0; - } - - if (! grub_read (addr2, -1)) - { - grub_close (); - return 1; - } - - grub_close (); - - /* Now compare ADDR1 with ADDR2. */ - for (i = 0; i < size; i++) - { - if (addr1[i] != addr2[i]) - grub_printf ("Differ at the offset %d: 0x%x [%s], 0x%x [%s]\n", - i, (unsigned) addr1[i], file1, - (unsigned) addr2[i], file2); - } - - return 0; -} - -static struct builtin builtin_cmp = -{ - "cmp", - cmp_func, - BUILTIN_CMDLINE, - "cmp FILE1 FILE2", - "Compare the file FILE1 with the FILE2 and inform the different values" - " if any." -}; - - -/* color */ -/* Set new colors used for the menu interface. Support two methods to - specify a color name: a direct integer representation and a symbolic - color name. An example of the latter is "blink-light-gray/blue". */ -static int -color_func (char *arg, int flags) -{ - char *normal; - char *highlight; - int new_normal_color; - int new_highlight_color; - static char *color_list[16] = - { - "black", - "blue", - "green", - "cyan", - "red", - "magenta", - "brown", - "light-gray", - "dark-gray", - "light-blue", - "light-green", - "light-cyan", - "light-red", - "light-magenta", - "yellow", - "white" - }; - - /* Convert the color name STR into the magical number. */ - static int color_number (char *str) - { - char *ptr; - int i; - int color = 0; - - /* Find the separator. */ - for (ptr = str; *ptr && *ptr != '/'; ptr++) - ; - - /* If not found, return -1. */ - if (! *ptr) - return -1; - - /* Terminate the string STR. */ - *ptr++ = 0; - - /* If STR contains the prefix "blink-", then set the `blink' bit - in COLOR. */ - if (substring ("blink-", str) <= 0) - { - color = 0x80; - str += 6; - } - - /* Search for the color name. */ - for (i = 0; i < 16; i++) - if (grub_strcmp (color_list[i], str) == 0) - { - color |= i; - break; - } - - if (i == 16) - return -1; - - str = ptr; - nul_terminate (str); - - /* Search for the color name. */ - for (i = 0; i < 8; i++) - if (grub_strcmp (color_list[i], str) == 0) - { - color |= i << 4; - break; - } - - if (i == 8) - return -1; - - return color; - } - - normal = arg; - highlight = skip_to (0, arg); - - new_normal_color = color_number (normal); - if (new_normal_color < 0 && ! safe_parse_maxint (&normal, &new_normal_color)) - return 1; - - /* The second argument is optional, so set highlight_color - to inverted NORMAL_COLOR. */ - if (! *highlight) - new_highlight_color = ((new_normal_color >> 4) - | ((new_normal_color & 0xf) << 4)); - else - { - new_highlight_color = color_number (highlight); - if (new_highlight_color < 0 - && ! safe_parse_maxint (&highlight, &new_highlight_color)) - return 1; - } - - if (current_term->setcolor) - current_term->setcolor (new_normal_color, new_highlight_color); - - return 0; -} - -static struct builtin builtin_color = -{ - "color", - color_func, - BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_HELP_LIST, - "color NORMAL [HIGHLIGHT]", - "Change the menu colors. The color NORMAL is used for most" - " lines in the menu, and the color HIGHLIGHT is used to highlight the" - " line where the cursor points. If you omit HIGHLIGHT, then the" - " inverted color of NORMAL is used for the highlighted line." - " The format of a color is \"FG/BG\". FG and BG are symbolic color names." - " A symbolic color name must be one of these: black, blue, green," - " cyan, red, magenta, brown, light-gray, dark-gray, light-blue," - " light-green, light-cyan, light-red, light-magenta, yellow and white." - " But only the first eight names can be used for BG. You can prefix" - " \"blink-\" to FG if you want a blinking foreground color." -}; - - -/* configfile */ -static int -configfile_func (char *arg, int flags) -{ - char *new_config = config_file; - - /* Check if the file ARG is present. */ - if (! grub_open (arg)) - return 1; - - grub_close (); - - /* Copy ARG to CONFIG_FILE. */ - while ((*new_config++ = *arg++) != 0) - ; - -#ifdef GRUB_UTIL - /* Force to load the configuration file. */ - use_config_file = 1; -#endif - - /* Make sure that the user will not be authoritative. */ - auth = 0; - - /* Restart cmain. */ - grub_longjmp (restart_env, 0); - - /* Never reach here. */ - return 0; -} - -static struct builtin builtin_configfile = -{ - "configfile", - configfile_func, - BUILTIN_CMDLINE | BUILTIN_HELP_LIST, - "configfile FILE", - "Load FILE as the configuration file." -}; - - -/* debug */ -static int -debug_func (char *arg, int flags) -{ - if (debug) - { - debug = 0; - grub_printf (" Debug mode is turned off\n"); - } - else - { - debug = 1; - grub_printf (" Debug mode is turned on\n"); - } - - return 0; -} - -static struct builtin builtin_debug = -{ - "debug", - debug_func, - BUILTIN_CMDLINE, - "debug", - "Turn on/off the debug mode." -}; - - -/* default */ -static int -default_func (char *arg, int flags) -{ -#ifndef SUPPORT_DISKLESS - if (grub_strcmp (arg, "saved") == 0) - { - default_entry = saved_entryno; - return 0; - } -#endif /* SUPPORT_DISKLESS */ - - if (! safe_parse_maxint (&arg, &default_entry)) - return 1; - - return 0; -} - -static struct builtin builtin_default = -{ - "default", - default_func, - BUILTIN_MENU, -#if 0 - "default [NUM | `saved']", - "Set the default entry to entry number NUM (if not specified, it is" - " 0, the first entry) or the entry number saved by savedefault." -#endif -}; - - -#ifdef GRUB_UTIL -/* device */ -static int -device_func (char *arg, int flags) -{ - char *drive = arg; - char *device; - - /* Get the drive number from DRIVE. */ - if (! set_device (drive)) - return 1; - - /* Get the device argument. */ - device = skip_to (0, drive); - - /* Terminate DEVICE. */ - nul_terminate (device); - - if (! *device || ! check_device (device)) - { - errnum = ERR_FILE_NOT_FOUND; - return 1; - } - - assign_device_name (current_drive, device); - - return 0; -} - -static struct builtin builtin_device = -{ - "device", - device_func, - BUILTIN_MENU | BUILTIN_CMDLINE | BUILTIN_HELP_LIST, - "device DRIVE DEVICE", - "Specify DEVICE as the actual drive for a BIOS drive DRIVE. This command" - " can be used only in the grub shell." -}; -#endif /* GRUB_UTIL */ - -#ifdef SUPPORT_NETBOOT -/* Debug Function for RPC */ -#ifdef RPC_DEBUG -/* portmap */ -static int -portmap_func (char *arg, int flags) -{ - int port, prog, ver; - if (! grub_eth_probe ()){ - grub_printf ("No ethernet card found.\n"); - errnum = ERR_DEV_VALUES; - return 1; - } - if ((prog = getdec(&arg)) == -1){ - grub_printf("Error prog number\n"); - return 1; - } - arg = skip_to (0, arg); - if ((ver = getdec(&arg)) == -1){ - grub_printf("Error ver number\n"); - return 1; - } - port = __pmapudp_getport(ARP_SERVER, prog, ver); - printf("portmap getport %d", port); - return 0; -} - -static struct builtin builtin_portmap = -{ - "portmap", - portmap_func, - BUILTIN_CMDLINE | BUILTIN_HELP_LIST, - "portmap prog_number vers_number", - "Do portmap with the prog_number and vers_number" -}; -#endif /* RPC_DEBUG */ - -/* dhcp */ -static int -dhcp_func (char *arg, int flags) -{ - int with_configfile = 0; - - if (grub_memcmp (arg, "--with-configfile", sizeof ("--with-configfile") - 1) - == 0) - { - with_configfile = 1; - arg = skip_to (0, arg); - } - - if (! dhcp ()) - { - if (errnum == ERR_NONE) - errnum = ERR_DEV_VALUES; - - return 1; - } - - /* Notify the configuration. */ - print_network_configuration (); - - /* XXX: this can cause an endless loop, but there is no easy way to - detect such a loop unfortunately. */ - if (with_configfile) - configfile_func (config_file, flags); - else - solaris_config_file(); - - return 0; -} - -static void solaris_config_file (void) -{ - static char menufile[64]; - static char hexdigit[] = "0123456789ABCDEF"; - char *c = menufile; - int i; - int err; - - /* if config_file is from DHCP option 150, keep the setting */ - if (grub_strcmp(config_file, "/boot/grub/menu.lst") != 0) - return; - - /* default solaris configfile name menu.lst.01 */ - grub_strcpy(c, "menu.lst.01"); - c += grub_strlen(c); - for (i = 0; i < ETH_ALEN; i++) { - unsigned char b = arptable[ARP_CLIENT].node[i]; - *c++ = hexdigit[b >> 4]; - *c++ = hexdigit[b & 0xf]; - } - *c = 0; - - /* - * If the file exists, make it the default. Else, fallback - * to what it was. Make sure we don't change errnum in the - * process. - */ - err = errnum; - if (grub_open(menufile)) { - grub_strcpy(config_file, menufile); - grub_close(); - } else { - char *cp = config_file; - /* skip leading slashes for tftp */ - while (*cp == '/') - ++cp; - grub_memmove (config_file, cp, strlen(cp) + 1); - } - errnum = err; -} - -static struct builtin builtin_dhcp = -{ - "dhcp", - dhcp_func, - BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_HELP_LIST, - "dhcp", - "Initialize a network device via DHCP." -}; -#endif /* SUPPORT_NETBOOT */ - -static int terminal_func (char *arg, int flags); - -static int verbose_func(char *arg, int flags) { - - if (grub_strcmp(arg, "off") == 0) { - silent.status = DEFER_SILENT; - return; - } else - if (flags == BUILTIN_CMDLINE) { - silent.status = DEFER_VERBOSE; - return; - } - - silent.status = VERBOSE; - - /* get back to text console */ - if (current_term->shutdown) { - (*current_term->shutdown)(); - current_term = term_table; /* assumption: console is first */ - } - - /* dump the buffer */ - if (!silent.looped) { - /* if the buffer hasn't looped, just print it */ - printf("%s", silent.buffer); - } else { - /* - * If the buffer has looped, first print the oldest part of the buffer, - * which is one past the current null. Then print the newer part which - * starts at the beginning of the buffer. - */ - printf("%s", silent.buffer_start + 1); - printf("%s", silent.buffer); - } - - return 0; -} - -static struct builtin builtin_verbose = -{ - "verbose", - verbose_func, - BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_SCRIPT | BUILTIN_HELP_LIST, - "verbose", - "Verbose output during menu entry (script) execution." -}; - -#ifdef SUPPORT_GRAPHICS - -static int splashimage_func(char *arg, int flags) { - char splashimage[64]; - int i; - - /* filename can only be 64 characters due to our buffer size */ - if (strlen(arg) > 63) - return 1; - - if (flags == BUILTIN_SCRIPT) - flags = BUILTIN_CMDLINE; - - if (flags == BUILTIN_CMDLINE) { - if (!grub_open(arg)) - return 1; - grub_close(); - } - - strcpy(splashimage, arg); - - /* get rid of TERM_NEED_INIT from the graphics terminal. */ - for (i = 0; term_table[i].name; i++) { - if (grub_strcmp (term_table[i].name, "graphics") == 0) { - term_table[i].flags &= ~TERM_NEED_INIT; - break; - } - } - - graphics_set_splash(splashimage); - - if (flags == BUILTIN_CMDLINE && graphics_inited) { - /* - * calling graphics_end() here flickers the screen black. OTOH not - * calling it gets us odd plane interlacing / early palette switching ? - * ideally one should figure out how to double buffer and switch... - */ - graphics_end(); - graphics_init(); - graphics_cls(); - } - - /* FIXME: should we be explicitly switching the terminal as a - * side effect here? */ - terminal_func("graphics", flags); - - reset_term = 0; - - return 0; -} - -static struct builtin builtin_splashimage = -{ - "splashimage", - splashimage_func, - BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_SCRIPT | BUILTIN_HELP_LIST, - "splashimage FILE", - "Load FILE as the background image when in graphics mode." -}; - - -/* foreground */ -static int -foreground_func(char *arg, int flags) -{ - if (grub_strlen(arg) == 6) { - int r = ((hex(arg[0]) << 4) | hex(arg[1])) >> 2; - int g = ((hex(arg[2]) << 4) | hex(arg[3])) >> 2; - int b = ((hex(arg[4]) << 4) | hex(arg[5])) >> 2; - - foreground = (r << 16) | (g << 8) | b; - if (graphics_inited) - graphics_set_palette(15, r, g, b); - - return (0); - } - - return (1); -} - -static struct builtin builtin_foreground = -{ - "foreground", - foreground_func, - BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_HELP_LIST | BUILTIN_SCRIPT, - "foreground RRGGBB", - "Sets the foreground color when in graphics mode." - "RR is red, GG is green, and BB blue. Numbers must be in hexadecimal." -}; - - -/* background */ -static int -background_func(char *arg, int flags) -{ - if (grub_strlen(arg) == 6) { - int r = ((hex(arg[0]) << 4) | hex(arg[1])) >> 2; - int g = ((hex(arg[2]) << 4) | hex(arg[3])) >> 2; - int b = ((hex(arg[4]) << 4) | hex(arg[5])) >> 2; - - background = (r << 16) | (g << 8) | b; - if (graphics_inited) - graphics_set_palette(0, r, g, b); - return (0); - } - - return (1); -} - -static struct builtin builtin_background = -{ - "background", - background_func, - BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_HELP_LIST | BUILTIN_SCRIPT, - "background RRGGBB", - "Sets the background color when in graphics mode." - "RR is red, GG is green, and BB blue. Numbers must be in hexadecimal." -}; - -#endif /* SUPPORT_GRAPHICS */ - - -/* clear */ -static int -clear_func() -{ - if (current_term->cls) - current_term->cls(); - - return 0; -} - -static struct builtin builtin_clear = -{ - "clear", - clear_func, - BUILTIN_CMDLINE | BUILTIN_HELP_LIST, - "clear", - "Clear the screen" -}; - -/* displayapm */ -static int -displayapm_func (char *arg, int flags) -{ - if (mbi.flags & MB_INFO_APM_TABLE) - { - grub_printf ("APM BIOS information:\n" - " Version: 0x%x\n" - " 32-bit CS: 0x%x\n" - " Offset: 0x%x\n" - " 16-bit CS: 0x%x\n" - " 16-bit DS: 0x%x\n" - " 32-bit CS length: 0x%x\n" - " 16-bit CS length: 0x%x\n" - " 16-bit DS length: 0x%x\n", - (unsigned) apm_bios_info.version, - (unsigned) apm_bios_info.cseg, - apm_bios_info.offset, - (unsigned) apm_bios_info.cseg_16, - (unsigned) apm_bios_info.dseg_16, - (unsigned) apm_bios_info.cseg_len, - (unsigned) apm_bios_info.cseg_16_len, - (unsigned) apm_bios_info.dseg_16_len); - } - else - { - grub_printf ("No APM BIOS found or probe failed\n"); - } - - return 0; -} - -static struct builtin builtin_displayapm = -{ - "displayapm", - displayapm_func, - BUILTIN_CMDLINE | BUILTIN_HELP_LIST, - "displayapm", - "Display APM BIOS information." -}; - - -/* displaymem */ -static int -displaymem_func (char *arg, int flags) -{ - if (get_eisamemsize () != -1) - grub_printf (" EISA Memory BIOS Interface is present\n"); - if (get_mmap_entry ((void *) SCRATCHADDR, 0) != 0 - || *((int *) SCRATCHADDR) != 0) - grub_printf (" Address Map BIOS Interface is present\n"); - - grub_printf (" Lower memory: %uK, " - "Upper memory (to first chipset hole): %uK\n", - mbi.mem_lower, mbi.mem_upper); - - if (min_mem64 != 0) - grub_printf (" Memory limit for 64-bit ISADIR expansion: %uMB\n", - min_mem64); - - if (mbi.flags & MB_INFO_MEM_MAP) - { - struct AddrRangeDesc *map = (struct AddrRangeDesc *) mbi.mmap_addr; - int end_addr = mbi.mmap_addr + mbi.mmap_length; - - grub_printf (" [Address Range Descriptor entries " - "immediately follow (values are 64-bit)]\n"); - while (end_addr > (int) map) - { - char *str; - - if (map->Type == MB_ARD_MEMORY) - str = "Usable RAM"; - else - str = "Reserved"; - grub_printf (" %s: Base Address: 0x%x X 4GB + 0x%x,\n" - " Length: 0x%x X 4GB + 0x%x bytes\n", - str, - (unsigned long) (map->BaseAddr >> 32), - (unsigned long) (map->BaseAddr & 0xFFFFFFFF), - (unsigned long) (map->Length >> 32), - (unsigned long) (map->Length & 0xFFFFFFFF)); - - map = ((struct AddrRangeDesc *) (((int) map) + 4 + map->size)); - } - } - - return 0; -} - -static struct builtin builtin_displaymem = -{ - "displaymem", - displaymem_func, - BUILTIN_CMDLINE | BUILTIN_HELP_LIST, - "displaymem", - "Display what GRUB thinks the system address space map of the" - " machine is, including all regions of physical RAM installed." -}; - - -/* dump FROM TO */ -#ifdef GRUB_UTIL -static int -dump_func (char *arg, int flags) -{ - char *from, *to; - FILE *fp; - char c; - - from = arg; - to = skip_to (0, arg); - if (! *from || ! *to) - { - errnum = ERR_BAD_ARGUMENT; - return 1; - } - - nul_terminate (from); - nul_terminate (to); - - if (! grub_open (from)) - return 1; - - fp = fopen (to, "w"); - if (! fp) - { - errnum = ERR_WRITE; - return 1; - } - - while (grub_read (&c, 1)) - if (fputc (c, fp) == EOF) - { - errnum = ERR_WRITE; - fclose (fp); - return 1; - } - - if (fclose (fp) == EOF) - { - errnum = ERR_WRITE; - return 1; - } - - grub_close (); - return 0; -} - -static struct builtin builtin_dump = - { - "dump", - dump_func, - BUILTIN_CMDLINE, - "dump FROM TO", - "Dump the contents of the file FROM to the file TO. FROM must be" - " a GRUB file and TO must be an OS file." - }; -#endif /* GRUB_UTIL */ - - -static char embed_info[32]; -/* embed */ -/* Embed a Stage 1.5 in the first cylinder after MBR or in the - bootloader block in a FFS. */ -static int -embed_func (char *arg, int flags) -{ - char *stage1_5; - char *device; - char *stage1_5_buffer = (char *) RAW_ADDR (0x100000); - int len, size; - int sector; - - stage1_5 = arg; - device = skip_to (0, stage1_5); - - /* Open a Stage 1.5. */ - if (! grub_open (stage1_5)) - return 1; - - /* Read the whole of the Stage 1.5. */ - len = grub_read (stage1_5_buffer, -1); - grub_close (); - - if (errnum) - return 1; - - size = (len + SECTOR_SIZE - 1) / SECTOR_SIZE; - - /* Get the device where the Stage 1.5 will be embedded. */ - set_device (device); - if (errnum) - return 1; - - if (current_partition == 0xFFFFFF) - { - /* Embed it after the MBR. */ - - char mbr[SECTOR_SIZE]; - char ezbios_check[2*SECTOR_SIZE]; - int i; - - /* Open the partition. */ - if (! open_partition ()) - return 1; - - /* No floppy has MBR. */ - if (! (current_drive & 0x80)) - { - errnum = ERR_DEV_VALUES; - return 1; - } - - /* Read the MBR of CURRENT_DRIVE. */ - if (! rawread (current_drive, PC_MBR_SECTOR, 0, SECTOR_SIZE, mbr)) - return 1; - - /* Sanity check. */ - if (! PC_MBR_CHECK_SIG (mbr)) - { - errnum = ERR_BAD_PART_TABLE; - return 1; - } - - /* Check if the disk can store the Stage 1.5. */ - for (i = 0; i < 4; i++) - if (PC_SLICE_TYPE (mbr, i) && PC_SLICE_START (mbr, i) - 1 < size) - { - errnum = ERR_NO_DISK_SPACE; - return 1; - } - - /* Check for EZ-BIOS signature. It should be in the third - * sector, but due to remapping it can appear in the second, so - * load and check both. - */ - if (! rawread (current_drive, 1, 0, 2 * SECTOR_SIZE, ezbios_check)) - return 1; - - if (! memcmp (ezbios_check + 3, "AERMH", 5) - || ! memcmp (ezbios_check + 512 + 3, "AERMH", 5)) - { - /* The space after the MBR is used by EZ-BIOS which we must - * not overwrite. - */ - errnum = ERR_NO_DISK_SPACE; - return 1; - } - - sector = 1; - } - else - { - /* Embed it in the bootloader block in the filesystem. */ - int start_sector; - - /* Open the partition. */ - if (! open_device ()) - return 1; - - /* Check if the current slice supports embedding. */ - if (fsys_table[fsys_type].embed_func == 0 - || ! fsys_table[fsys_type].embed_func (&start_sector, size)) - { - errnum = ERR_DEV_VALUES; - return 1; - } - - sector = part_start + start_sector; - } - - /* Clear the cache. */ - buf_track = BUF_CACHE_INVALID; - - /* Now perform the embedding. */ - if (! devwrite (sector - part_start, size, stage1_5_buffer)) - return 1; - - grub_printf (" %d sectors are embedded.\n", size); - grub_sprintf (embed_info, "%d+%d", sector - part_start, size); - return 0; -} - -static struct builtin builtin_embed = -{ - "embed", - embed_func, - BUILTIN_CMDLINE, - "embed STAGE1_5 DEVICE", - "Embed the Stage 1.5 STAGE1_5 in the sectors after MBR if DEVICE" - " is a drive, or in the \"bootloader\" area if DEVICE is a FFS partition." - " Print the number of sectors which STAGE1_5 occupies if successful." -}; - - -/* fallback */ -static int -fallback_func (char *arg, int flags) -{ - int i = 0; - - while (*arg) - { - int entry; - int j; - - if (! safe_parse_maxint (&arg, &entry)) - return 1; - - /* Remove duplications to prevent infinite looping. */ - for (j = 0; j < i; j++) - if (entry == fallback_entries[j]) - break; - if (j != i) - continue; - - fallback_entries[i++] = entry; - if (i == MAX_FALLBACK_ENTRIES) - break; - - arg = skip_to (0, arg); - } - - if (i < MAX_FALLBACK_ENTRIES) - fallback_entries[i] = -1; - - fallback_entryno = (i == 0) ? -1 : 0; - - return 0; -} - -static struct builtin builtin_fallback = -{ - "fallback", - fallback_func, - BUILTIN_MENU, -#if 0 - "fallback NUM...", - "Go into unattended boot mode: if the default boot entry has any" - " errors, instead of waiting for the user to do anything, it" - " immediately starts over using the NUM entry (same numbering as the" - " `default' command). This obviously won't help if the machine" - " was rebooted by a kernel that GRUB loaded." -#endif -}; - - - -void -set_root (char *root, unsigned long drive, unsigned long part) -{ - int bsd_part = (part >> 8) & 0xFF; - int pc_slice = part >> 16; - - if (bsd_part == 0xFF) { - grub_sprintf (root, "(hd%d,%d)\n", drive - 0x80, pc_slice); - } else { - grub_sprintf (root, "(hd%d,%d,%c)\n", - drive - 0x80, pc_slice, bsd_part + 'a'); - } -} - -static int -find_common (char *arg, char *root, int for_root, int flags) -{ - char *filename = NULL; - static char argpart[32]; - static char device[32]; - char *tmp_argpart = NULL; - unsigned long drive; - unsigned long tmp_drive = saved_drive; - unsigned long tmp_partition = saved_partition; - int got_file = 0; - static char bootsign[BOOTSIGN_LEN]; - - /* - * If argument has partition information (findroot command only), then - * it can't be a floppy - */ - if (for_root && arg[0] == '(') { - tmp_argpart = grub_strchr(arg + 1, ','); - if (tmp_argpart == NULL) - goto out; - grub_strcpy(argpart, tmp_argpart); - *tmp_argpart = '\0'; - arg++; - grub_sprintf(bootsign, "%s/%s", BOOTSIGN_DIR, arg); - filename = bootsign; - goto harddisk; - } else if (for_root) { - /* Boot signature without partition/slice information */ - grub_sprintf(bootsign, "%s/%s", BOOTSIGN_DIR, arg); - filename = bootsign; - } else { - /* plain vanilla find cmd */ - filename = arg; - } - - /* Floppies. */ - for (drive = 0; drive < 8; drive++) - { - current_drive = drive; - current_partition = 0xFFFFFF; - - if (open_device ()) - { - saved_drive = current_drive; - saved_partition = current_partition; - if (grub_open (filename)) - { - grub_close (); - got_file = 1; - if (for_root) { - grub_sprintf(root, "(fd%d)", drive); - goto out; - } else - grub_printf (" (fd%d)\n", drive); - } - } - - errnum = ERR_NONE; - } - -harddisk: - /* Hard disks. */ - for (drive = 0x80; drive < 0x88; drive++) - { - unsigned long part = 0xFFFFFF; - unsigned long start, len, offset, ext_offset; - int type, entry; - char buf[SECTOR_SIZE]; - - if (for_root && tmp_argpart) { - grub_sprintf(device, "(hd%d%s", drive - 0x80, argpart); - set_device(device); - errnum = ERR_NONE; - part = current_partition; - if (open_device ()) { - saved_drive = current_drive; - saved_partition = current_partition; - errnum = ERR_NONE; - if (grub_open (filename)) { - grub_close (); - got_file = 1; - if (is_zfs_mount == 0) { - set_root(root, current_drive, current_partition); - goto out; - } else { - best_drive = current_drive; - best_part = current_partition; - } - } - } - errnum = ERR_NONE; - continue; - } - current_drive = drive; - while (next_partition (drive, 0xFFFFFF, &part, &type, - &start, &len, &offset, &entry, - &ext_offset, buf)) - { - if (type != PC_SLICE_TYPE_NONE - && ! IS_PC_SLICE_TYPE_BSD (type) - && ! IS_PC_SLICE_TYPE_EXTENDED (type)) - { - current_partition = part; - if (open_device ()) - { - saved_drive = current_drive; - saved_partition = current_partition; - if (grub_open (filename)) - { - char tmproot[32]; - - grub_close (); - got_file = 1; - set_root(tmproot, drive, part); - if (for_root) { - grub_memcpy(root, tmproot, sizeof(tmproot)); - if (is_zfs_mount == 0) { - goto out; - } else { - best_drive = current_drive; - best_part = current_partition; - } - } else { - grub_printf("%s", tmproot); - } - } - } - } - - /* We want to ignore any error here. */ - errnum = ERR_NONE; - } - - /* next_partition always sets ERRNUM in the last call, so clear - it. */ - errnum = ERR_NONE; - } - -out: - if (is_zfs_mount && for_root) { - set_root(root, best_drive, best_part); - buf_drive = -1; - } else { - saved_drive = tmp_drive; - saved_partition = tmp_partition; - } - if (tmp_argpart) - *tmp_argpart = ','; - - if (got_file) - { - errnum = ERR_NONE; - return 0; - } - - errnum = ERR_FILE_NOT_FOUND; - return 1; -} - -/* find */ -/* Search for the filename ARG in all of partitions. */ -static int -find_func (char *arg, int flags) -{ - return (find_common(arg, NULL, 0, flags)); -} - -static struct builtin builtin_find = -{ - "find", - find_func, - BUILTIN_CMDLINE | BUILTIN_HELP_LIST, - "find FILENAME", - "Search for the filename FILENAME in all of partitions and print the list of" - " the devices which contain the file." -}; - - -/* fstest */ -static int -fstest_func (char *arg, int flags) -{ - if (disk_read_hook) - { - disk_read_hook = NULL; - printf (" Filesystem tracing is now off\n"); - } - else - { - disk_read_hook = disk_read_print_func; - printf (" Filesystem tracing is now on\n"); - } - - return 0; -} - -static struct builtin builtin_fstest = -{ - "fstest", - fstest_func, - BUILTIN_CMDLINE, - "fstest", - "Toggle filesystem test mode." -}; - - -/* geometry */ -static int -geometry_func (char *arg, int flags) -{ - struct geometry geom; - char *msg; - char *device = arg; -#ifdef GRUB_UTIL - char *ptr; -#endif - - /* Get the device number. */ - set_device (device); - if (errnum) - return 1; - - /* Check for the geometry. */ - if (get_diskinfo (current_drive, &geom)) - { - errnum = ERR_NO_DISK; - return 1; - } - - /* Attempt to read the first sector, because some BIOSes turns out not - to support LBA even though they set the bit 0 in the support - bitmap, only after reading something actually. */ - if (biosdisk (BIOSDISK_READ, current_drive, &geom, 0, 1, SCRATCHSEG)) - { - errnum = ERR_READ; - return 1; - } - -#ifdef GRUB_UTIL - ptr = skip_to (0, device); - if (*ptr) - { - char *cylinder, *head, *sector, *total_sector; - int num_cylinder, num_head, num_sector, num_total_sector; - - cylinder = ptr; - head = skip_to (0, cylinder); - sector = skip_to (0, head); - total_sector = skip_to (0, sector); - if (! safe_parse_maxint (&cylinder, &num_cylinder) - || ! safe_parse_maxint (&head, &num_head) - || ! safe_parse_maxint (§or, &num_sector)) - return 1; - - disks[current_drive].cylinders = num_cylinder; - disks[current_drive].heads = num_head; - disks[current_drive].sectors = num_sector; - - if (safe_parse_maxint (&total_sector, &num_total_sector)) - disks[current_drive].total_sectors = num_total_sector; - else - disks[current_drive].total_sectors - = num_cylinder * num_head * num_sector; - errnum = 0; - - geom = disks[current_drive]; - buf_drive = -1; - } -#endif /* GRUB_UTIL */ - -#ifdef GRUB_UTIL - msg = device_map[current_drive]; -#else - if (geom.flags & BIOSDISK_FLAG_LBA_EXTENSION) - msg = "LBA"; - else - msg = "CHS"; -#endif - - grub_printf ("drive 0x%x: C/H/S = %d/%d/%d, " - "The number of sectors = %u, %s\n", - current_drive, - geom.cylinders, geom.heads, geom.sectors, - geom.total_sectors, msg); - real_open_partition (1); - - return 0; -} - -static struct builtin builtin_geometry = -{ - "geometry", - geometry_func, - BUILTIN_CMDLINE | BUILTIN_HELP_LIST, - "geometry DRIVE [CYLINDER HEAD SECTOR [TOTAL_SECTOR]]", - "Print the information for a drive DRIVE. In the grub shell, you can" - " set the geometry of the drive arbitrarily. The number of the cylinders," - " the one of the heads, the one of the sectors and the one of the total" - " sectors are set to CYLINDER, HEAD, SECTOR and TOTAL_SECTOR," - " respectively. If you omit TOTAL_SECTOR, then it will be calculated based" - " on the C/H/S values automatically." -}; - - -/* halt */ -static int -halt_func (char *arg, int flags) -{ - int no_apm; - - no_apm = (grub_memcmp (arg, "--no-apm", 8) == 0); - grub_halt (no_apm); - - /* Never reach here. */ - return 1; -} - -static struct builtin builtin_halt = -{ - "halt", - halt_func, - BUILTIN_CMDLINE | BUILTIN_HELP_LIST, - "halt [--no-apm]", - "Halt your system. If APM is avaiable on it, turn off the power using" - " the APM BIOS, unless you specify the option `--no-apm'." -}; - - -/* help */ -#define MAX_SHORT_DOC_LEN 39 -#define MAX_LONG_DOC_LEN 66 - -static int -help_func (char *arg, int flags) -{ - int all = 0; - - if (grub_memcmp (arg, "--all", sizeof ("--all") - 1) == 0) - { - all = 1; - arg = skip_to (0, arg); - } - - if (! *arg) - { - /* Invoked with no argument. Print the list of the short docs. */ - struct builtin **builtin; - int left = 1; - - for (builtin = builtin_table; *builtin != 0; builtin++) - { - int len; - int i; - - /* If this cannot be used in the command-line interface, - skip this. */ - if (! ((*builtin)->flags & BUILTIN_CMDLINE)) - continue; - - /* If this doesn't need to be listed automatically and "--all" - is not specified, skip this. */ - if (! all && ! ((*builtin)->flags & BUILTIN_HELP_LIST)) - continue; - - len = grub_strlen ((*builtin)->short_doc); - /* If the length of SHORT_DOC is too long, truncate it. */ - if (len > MAX_SHORT_DOC_LEN - 1) - len = MAX_SHORT_DOC_LEN - 1; - - for (i = 0; i < len; i++) - grub_putchar ((*builtin)->short_doc[i]); - - for (; i < MAX_SHORT_DOC_LEN; i++) - grub_putchar (' '); - - if (! left) - grub_putchar ('\n'); - - left = ! left; - } - - /* If the last entry was at the left column, no newline was printed - at the end. */ - if (! left) - grub_putchar ('\n'); - } - else - { - /* Invoked with one or more patterns. */ - do - { - struct builtin **builtin; - char *next_arg; - - /* Get the next argument. */ - next_arg = skip_to (0, arg); - - /* Terminate ARG. */ - nul_terminate (arg); - - for (builtin = builtin_table; *builtin; builtin++) - { - /* Skip this if this is only for the configuration file. */ - if (! ((*builtin)->flags & BUILTIN_CMDLINE)) - continue; - - if (substring (arg, (*builtin)->name) < 1) - { - char *doc = (*builtin)->long_doc; - - /* At first, print the name and the short doc. */ - grub_printf ("%s: %s\n", - (*builtin)->name, (*builtin)->short_doc); - - /* Print the long doc. */ - while (*doc) - { - int len = grub_strlen (doc); - int i; - - /* If LEN is too long, fold DOC. */ - if (len > MAX_LONG_DOC_LEN) - { - /* Fold this line at the position of a space. */ - for (len = MAX_LONG_DOC_LEN; len > 0; len--) - if (doc[len - 1] == ' ') - break; - } - - grub_printf (" "); - for (i = 0; i < len; i++) - grub_putchar (*doc++); - grub_putchar ('\n'); - } - } - } - - arg = next_arg; - } - while (*arg); - } - - return 0; -} - -static struct builtin builtin_help = -{ - "help", - help_func, - BUILTIN_CMDLINE | BUILTIN_HELP_LIST, - "help [--all] [PATTERN ...]", - "Display helpful information about builtin commands. Not all commands" - " aren't shown without the option `--all'." -}; - - -/* hiddenmenu */ -static int -hiddenmenu_func (char *arg, int flags) -{ - show_menu = 0; - return 0; -} - -static struct builtin builtin_hiddenmenu = -{ - "hiddenmenu", - hiddenmenu_func, - BUILTIN_MENU, -#if 0 - "hiddenmenu", - "Hide the menu." -#endif -}; - - -/* hide */ -static int -hide_func (char *arg, int flags) -{ - if (! set_device (arg)) - return 1; - - if (! set_partition_hidden_flag (1)) - return 1; - - return 0; -} - -static struct builtin builtin_hide = -{ - "hide", - hide_func, - BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_HELP_LIST, - "hide PARTITION", - "Hide PARTITION by setting the \"hidden\" bit in" - " its partition type code." -}; - - -#ifdef SUPPORT_NETBOOT -/* ifconfig */ -static int -ifconfig_func (char *arg, int flags) -{ - char *svr = 0, *ip = 0, *gw = 0, *sm = 0; - - if (! grub_eth_probe ()) - { - grub_printf ("No ethernet card found.\n"); - errnum = ERR_DEV_VALUES; - return 1; - } - - while (*arg) - { - if (! grub_memcmp ("--server=", arg, sizeof ("--server=") - 1)) - svr = arg + sizeof("--server=") - 1; - else if (! grub_memcmp ("--address=", arg, sizeof ("--address=") - 1)) - ip = arg + sizeof ("--address=") - 1; - else if (! grub_memcmp ("--gateway=", arg, sizeof ("--gateway=") - 1)) - gw = arg + sizeof ("--gateway=") - 1; - else if (! grub_memcmp ("--mask=", arg, sizeof("--mask=") - 1)) - sm = arg + sizeof ("--mask=") - 1; - else - { - errnum = ERR_BAD_ARGUMENT; - return 1; - } - - arg = skip_to (0, arg); - } - - if (! ifconfig (ip, sm, gw, svr)) - { - errnum = ERR_BAD_ARGUMENT; - return 1; - } - - print_network_configuration (); - return 0; -} - -static struct builtin builtin_ifconfig = -{ - "ifconfig", - ifconfig_func, - BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_HELP_LIST, - "ifconfig [--address=IP] [--gateway=IP] [--mask=MASK] [--server=IP]", - "Configure the IP address, the netmask, the gateway and the server" - " address or print current network configuration." -}; -#endif /* SUPPORT_NETBOOT */ - - -/* impsprobe */ -static int -impsprobe_func (char *arg, int flags) -{ -#ifdef GRUB_UTIL - /* In the grub shell, we cannot probe IMPS. */ - errnum = ERR_UNRECOGNIZED; - return 1; -#else /* ! GRUB_UTIL */ - if (!imps_probe ()) - printf (" No MPS information found or probe failed\n"); - - return 0; -#endif /* ! GRUB_UTIL */ -} - -static struct builtin builtin_impsprobe = -{ - "impsprobe", - impsprobe_func, - BUILTIN_CMDLINE, - "impsprobe", - "Probe the Intel Multiprocessor Specification 1.1 or 1.4" - " configuration table and boot the various CPUs which are found into" - " a tight loop." -}; - - -/* initrd */ -static int -initrd_func (char *arg, int flags) -{ - switch (kernel_type) - { - case KERNEL_TYPE_LINUX: - case KERNEL_TYPE_BIG_LINUX: - if (! load_initrd (arg)) - return 1; - break; - - default: - errnum = ERR_NEED_LX_KERNEL; - return 1; - } - - return 0; -} - -static struct builtin builtin_initrd = -{ - "initrd", - initrd_func, - BUILTIN_CMDLINE | BUILTIN_HELP_LIST, - "initrd FILE [ARG ...]", - "Load an initial ramdisk FILE for a Linux format boot image and set the" - " appropriate parameters in the Linux setup area in memory." -}; - - -/* install */ -static int -install_func (char *arg, int flags) -{ - char *stage1_file, *dest_dev, *file, *addr; - char *stage1_buffer = (char *) RAW_ADDR (0x100000); - char *stage2_buffer = stage1_buffer + SECTOR_SIZE; - char *old_sect = stage2_buffer + SECTOR_SIZE; - char *stage2_first_buffer = old_sect + SECTOR_SIZE; - char *stage2_second_buffer = stage2_first_buffer + SECTOR_SIZE; - /* XXX: Probably SECTOR_SIZE is reasonable. */ - char *config_filename = stage2_second_buffer + SECTOR_SIZE; - char *dummy = config_filename + SECTOR_SIZE; - int new_drive = GRUB_INVALID_DRIVE; - int dest_drive, dest_partition; - unsigned int dest_sector; - int src_drive, src_partition, src_part_start; - int i; - struct geometry dest_geom, src_geom; - unsigned int saved_sector; - unsigned int stage2_first_sector, stage2_second_sector; - char *ptr; - int installaddr, installlist; - /* Point to the location of the name of a configuration file in Stage 2. */ - char *config_file_location; - /* If FILE is a Stage 1.5? */ - int is_stage1_5 = 0; - /* Must call grub_close? */ - int is_open = 0; - /* If LBA is forced? */ - int is_force_lba = 0; - /* Was the last sector full? */ - int last_length = SECTOR_SIZE; - -#ifdef GRUB_UTIL - /* If the Stage 2 is in a partition mounted by an OS, this will store - the filename under the OS. */ - char *stage2_os_file = 0; -#endif /* GRUB_UTIL */ - - /* Save the first sector of Stage2 in STAGE2_SECT. */ - static void disk_read_savesect_func(unsigned int sector, int offset, - int length) - { - if (debug) - printf ("[%u]", sector); - - /* ReiserFS has files which sometimes contain data not aligned - on sector boundaries. Returning an error is better than - silently failing. */ - if (offset != 0 || length != SECTOR_SIZE) - errnum = ERR_UNALIGNED; - - saved_sector = sector; - } - - /* Write SECTOR to INSTALLLIST, and update INSTALLADDR and - INSTALLSECT. */ - static void disk_read_blocklist_func(unsigned int sector, int offset, - int length) - { - if (debug) - printf("[%u]", sector); - - if (offset != 0 || last_length != SECTOR_SIZE) - { - /* We found a non-sector-aligned data block. */ - errnum = ERR_UNALIGNED; - return; - } - - last_length = length; - - if (*((unsigned long *) (installlist - 4)) - + *((unsigned short *) installlist) != sector - || installlist == (int) stage2_first_buffer + SECTOR_SIZE + 4) - { - installlist -= 8; - - if (*((unsigned long *) (installlist - 8))) - errnum = ERR_WONT_FIT; - else - { - *((unsigned short *) (installlist + 2)) = (installaddr >> 4); - *((unsigned long *) (installlist - 4)) = sector; - } - } - - *((unsigned short *) installlist) += 1; - installaddr += 512; - } - - /* First, check the GNU-style long option. */ - while (1) - { - if (grub_memcmp ("--force-lba", arg, sizeof ("--force-lba") - 1) == 0) - { - is_force_lba = 1; - arg = skip_to (0, arg); - } -#ifdef GRUB_UTIL - else if (grub_memcmp ("--stage2=", arg, sizeof ("--stage2=") - 1) == 0) - { - stage2_os_file = arg + sizeof ("--stage2=") - 1; - arg = skip_to (0, arg); - nul_terminate (stage2_os_file); - } -#endif /* GRUB_UTIL */ - else - break; - } - - stage1_file = arg; - dest_dev = skip_to (0, stage1_file); - if (*dest_dev == 'd') - { - new_drive = 0; - dest_dev = skip_to (0, dest_dev); - } - file = skip_to (0, dest_dev); - addr = skip_to (0, file); - - /* Get the installation address. */ - if (! safe_parse_maxint (&addr, &installaddr)) - { - /* ADDR is not specified. */ - installaddr = 0; - ptr = addr; - errnum = 0; - } - else - ptr = skip_to (0, addr); - -#ifndef NO_DECOMPRESSION - /* Do not decompress Stage 1 or Stage 2. */ - no_decompression = 1; -#endif - - /* Read Stage 1. */ - is_open = grub_open (stage1_file); - if (! is_open - || ! grub_read (stage1_buffer, SECTOR_SIZE) == SECTOR_SIZE) - goto fail; - - /* Read the old sector from DEST_DEV. */ - if (! set_device (dest_dev) - || ! open_partition () - || ! devread (0, 0, SECTOR_SIZE, old_sect)) - goto fail; - - /* Store the information for the destination device. */ - dest_drive = current_drive; - dest_partition = current_partition; - dest_geom = buf_geom; - dest_sector = part_start; - - /* Copy the possible DOS BPB, 59 bytes at byte offset 3. */ - grub_memmove (stage1_buffer + BOOTSEC_BPB_OFFSET, - old_sect + BOOTSEC_BPB_OFFSET, - BOOTSEC_BPB_LENGTH); - - /* If for a hard disk, copy the possible MBR/extended part table. */ - if (dest_drive & 0x80) - grub_memmove (stage1_buffer + STAGE1_WINDOWS_NT_MAGIC, - old_sect + STAGE1_WINDOWS_NT_MAGIC, - STAGE1_PARTEND - STAGE1_WINDOWS_NT_MAGIC); - - /* Check for the version and the signature of Stage 1. */ - if (*((short *)(stage1_buffer + STAGE1_VER_MAJ_OFFS)) != COMPAT_VERSION - || (*((unsigned short *) (stage1_buffer + BOOTSEC_SIG_OFFSET)) - != BOOTSEC_SIGNATURE)) - { - errnum = ERR_BAD_VERSION; - goto fail; - } - - /* This below is not true any longer. But should we leave this alone? */ - - /* If DEST_DRIVE is a floppy, Stage 2 must have the iteration probe - routine. */ - if (! (dest_drive & 0x80) - && (*((unsigned char *) (stage1_buffer + BOOTSEC_PART_OFFSET)) == 0x80 - || stage1_buffer[BOOTSEC_PART_OFFSET] == 0)) - { - errnum = ERR_BAD_VERSION; - goto fail; - } - - grub_close (); - - /* Open Stage 2. */ - is_open = grub_open (file); - if (! is_open) - goto fail; - - src_drive = current_drive; - src_partition = current_partition; - src_part_start = part_start; - src_geom = buf_geom; - - if (! new_drive) - new_drive = src_drive; - else if (src_drive != dest_drive) - grub_printf ("Warning: the option `d' was not used, but the Stage 1 will" - " be installed on a\ndifferent drive than the drive where" - " the Stage 2 resides.\n"); - - /* Set the boot drive. */ - *((unsigned char *) (stage1_buffer + STAGE1_BOOT_DRIVE)) = new_drive; - - /* Set the "force LBA" flag. */ - *((unsigned char *) (stage1_buffer + STAGE1_FORCE_LBA)) = is_force_lba; - - /* Set the boot drive mask. This is a workaround for buggy BIOSes which - don't pass boot drive correctly. Instead, they pass 0x00 even when - booted from 0x80. */ - *((unsigned char *) (stage1_buffer + STAGE1_BOOT_DRIVE_MASK)) - = (dest_drive & BIOS_FLAG_FIXED_DISK); - - /* Read the first sector of Stage 2. */ - disk_read_hook = disk_read_savesect_func; - if (grub_read (stage2_first_buffer, SECTOR_SIZE) != SECTOR_SIZE) - goto fail; - - stage2_first_sector = saved_sector; - - /* Read the second sector of Stage 2. */ - if (grub_read (stage2_second_buffer, SECTOR_SIZE) != SECTOR_SIZE) - goto fail; - - stage2_second_sector = saved_sector; - - /* Check for the version of Stage 2. */ - if (*((short *) (stage2_second_buffer + STAGE2_VER_MAJ_OFFS)) - != COMPAT_VERSION) - { - errnum = ERR_BAD_VERSION; - goto fail; - } - - /* Check for the Stage 2 id. */ - if (stage2_second_buffer[STAGE2_STAGE2_ID] != STAGE2_ID_STAGE2) - is_stage1_5 = 1; - - /* If INSTALLADDR is not specified explicitly in the command-line, - determine it by the Stage 2 id. */ - if (! installaddr) - { - if (! is_stage1_5) - /* Stage 2. */ - installaddr = 0x8000; - else - /* Stage 1.5. */ - installaddr = 0x2000; - } - - *((unsigned long *) (stage1_buffer + STAGE1_STAGE2_SECTOR)) - = stage2_first_sector; - *((unsigned short *) (stage1_buffer + STAGE1_STAGE2_ADDRESS)) - = installaddr; - *((unsigned short *) (stage1_buffer + STAGE1_STAGE2_SEGMENT)) - = installaddr >> 4; - - i = (int) stage2_first_buffer + SECTOR_SIZE - 4; - while (*((unsigned long *) i)) - { - if (i < (int) stage2_first_buffer - || (*((int *) (i - 4)) & 0x80000000) - || *((unsigned short *) i) >= 0xA00 - || *((short *) (i + 2)) == 0) - { - errnum = ERR_BAD_VERSION; - goto fail; - } - - *((int *) i) = 0; - *((int *) (i - 4)) = 0; - i -= 8; - } - - installlist = (int) stage2_first_buffer + SECTOR_SIZE + 4; - installaddr += SECTOR_SIZE; - - /* Read the whole of Stage2 except for the first sector. */ - grub_seek (SECTOR_SIZE); - - disk_read_hook = disk_read_blocklist_func; - if (! grub_read (dummy, -1)) - goto fail; - - disk_read_hook = 0; - - /* Find a string for the configuration filename. */ - config_file_location = stage2_second_buffer + STAGE2_VER_STR_OFFS; - while (*(config_file_location++)) - ; - - /* Set the "force LBA" flag for Stage2. */ - *((unsigned char *) (stage2_second_buffer + STAGE2_FORCE_LBA)) - = is_force_lba; - - if (*ptr == 'p') - { - *((long *) (stage2_second_buffer + STAGE2_INSTALLPART)) - = src_partition; - if (is_stage1_5) - { - /* Reset the device information in FILE if it is a Stage 1.5. */ - unsigned long device = 0xFFFFFFFF; - - grub_memmove (config_file_location, (char *) &device, - sizeof (device)); - } - - ptr = skip_to (0, ptr); - } - - if (*ptr) - { - grub_strcpy (config_filename, ptr); - nul_terminate (config_filename); - - if (! is_stage1_5) - /* If it is a Stage 2, just copy PTR to CONFIG_FILE_LOCATION. */ - grub_strcpy (config_file_location, ptr); - else - { - char *real_config; - unsigned long device; - - /* Translate the external device syntax to the internal device - syntax. */ - if (! (real_config = set_device (ptr))) - { - /* The Stage 2 PTR does not contain the device name, so - use the root device instead. */ - errnum = ERR_NONE; - current_drive = saved_drive; - current_partition = saved_partition; - real_config = ptr; - } - - if (current_drive == src_drive) - { - /* If the drive where the Stage 2 resides is the same as - the one where the Stage 1.5 resides, do not embed the - drive number. */ - current_drive = GRUB_INVALID_DRIVE; - } - - device = (current_drive << 24) | current_partition; - grub_memmove (config_file_location, (char *) &device, - sizeof (device)); - grub_strcpy (config_file_location + sizeof (device), - real_config); - } - - /* If a Stage 1.5 is used, then we need to modify the Stage2. */ - if (is_stage1_5) - { - char *real_config_filename = skip_to (0, ptr); - - is_open = grub_open (config_filename); - if (! is_open) - goto fail; - - /* Skip the first sector. */ - grub_seek (SECTOR_SIZE); - - disk_read_hook = disk_read_savesect_func; - if (grub_read (stage2_buffer, SECTOR_SIZE) != SECTOR_SIZE) - goto fail; - - disk_read_hook = 0; - grub_close (); - is_open = 0; - - /* Sanity check. */ - if (*(stage2_buffer + STAGE2_STAGE2_ID) != STAGE2_ID_STAGE2) - { - errnum = ERR_BAD_VERSION; - goto fail; - } - - /* Set the "force LBA" flag for Stage2. */ - *(stage2_buffer + STAGE2_FORCE_LBA) = is_force_lba; - - /* If REAL_CONFIG_FILENAME is specified, copy it to the Stage2. */ - if (*real_config_filename) - { - /* Specified */ - char *location; - - /* Find a string for the configuration filename. */ - location = stage2_buffer + STAGE2_VER_STR_OFFS; - while (*(location++)) - ; - - /* Copy the name. */ - grub_strcpy (location, real_config_filename); - } - - /* Write it to the disk. */ - buf_track = BUF_CACHE_INVALID; - -#ifdef GRUB_UTIL - /* In the grub shell, access the Stage 2 via the OS filesystem - service, if possible. */ - if (stage2_os_file) - { - FILE *fp; - - fp = fopen (stage2_os_file, "r+"); - if (! fp) - { - errnum = ERR_FILE_NOT_FOUND; - goto fail; - } - - if (fseek (fp, SECTOR_SIZE, SEEK_SET) != 0) - { - fclose (fp); - errnum = ERR_BAD_VERSION; - goto fail; - } - - if (fwrite (stage2_buffer, 1, SECTOR_SIZE, fp) - != SECTOR_SIZE) - { - fclose (fp); - errnum = ERR_WRITE; - goto fail; - } - - fclose (fp); - } - else -#endif /* GRUB_UTIL */ - { - if (! devwrite (saved_sector - part_start, 1, stage2_buffer)) - goto fail; - } - } - } - - /* Clear the cache. */ - buf_track = BUF_CACHE_INVALID; - - /* Write the modified sectors of Stage2 to the disk. */ -#ifdef GRUB_UTIL - if (! is_stage1_5 && stage2_os_file) - { - FILE *fp; - - fp = fopen (stage2_os_file, "r+"); - if (! fp) - { - errnum = ERR_FILE_NOT_FOUND; - goto fail; - } - - if (fwrite (stage2_first_buffer, 1, SECTOR_SIZE, fp) != SECTOR_SIZE) - { - fclose (fp); - errnum = ERR_WRITE; - goto fail; - } - - if (fwrite (stage2_second_buffer, 1, SECTOR_SIZE, fp) != SECTOR_SIZE) - { - fclose (fp); - errnum = ERR_WRITE; - goto fail; - } - - fclose (fp); - } - else -#endif /* GRUB_UTIL */ - { - /* The first. */ - current_drive = src_drive; - current_partition = src_partition; - - if (! open_partition ()) - goto fail; - - if (! devwrite (stage2_first_sector - src_part_start, 1, - stage2_first_buffer)) - goto fail; - - if (! devwrite (stage2_second_sector - src_part_start, 1, - stage2_second_buffer)) - goto fail; - } - - /* Write the modified sector of Stage 1 to the disk. */ - current_drive = dest_drive; - current_partition = dest_partition; - if (! open_partition ()) - goto fail; - - devwrite (0, 1, stage1_buffer); - - fail: - if (is_open) - grub_close (); - - disk_read_hook = 0; - -#ifndef NO_DECOMPRESSION - no_decompression = 0; -#endif - - return errnum; -} - -static struct builtin builtin_install = -{ - "install", - install_func, - BUILTIN_CMDLINE, - "install [--stage2=STAGE2_FILE] [--force-lba] STAGE1 [d] DEVICE STAGE2 [ADDR] [p] [CONFIG_FILE] [REAL_CONFIG_FILE]", - "Install STAGE1 on DEVICE, and install a blocklist for loading STAGE2" - " as a Stage 2. If the option `d' is present, the Stage 1 will always" - " look for the disk where STAGE2 was installed, rather than using" - " the booting drive. The Stage 2 will be loaded at address ADDR, which" - " will be determined automatically if you don't specify it. If" - " the option `p' or CONFIG_FILE is present, then the first block" - " of Stage 2 is patched with new values of the partition and name" - " of the configuration file used by the true Stage 2 (for a Stage 1.5," - " this is the name of the true Stage 2) at boot time. If STAGE2 is a Stage" - " 1.5 and REAL_CONFIG_FILE is present, then the Stage 2 CONFIG_FILE is" - " patched with the configuration filename REAL_CONFIG_FILE." - " If the option `--force-lba' is specified, disable some sanity checks" - " for LBA mode. If the option `--stage2' is specified, rewrite the Stage" - " 2 via your OS's filesystem instead of the raw device." -}; - - -/* ioprobe */ -static int -ioprobe_func (char *arg, int flags) -{ -#ifdef GRUB_UTIL - - errnum = ERR_UNRECOGNIZED; - return 1; - -#else /* ! GRUB_UTIL */ - - unsigned short *port; - - /* Get the drive number. */ - set_device (arg); - if (errnum) - return 1; - - /* Clean out IO_MAP. */ - grub_memset ((char *) io_map, 0, IO_MAP_SIZE * sizeof (unsigned short)); - - /* Track the int13 handler. */ - track_int13 (current_drive); - - /* Print out the result. */ - for (port = io_map; *port != 0; port++) - grub_printf (" 0x%x", (unsigned int) *port); - - return 0; - -#endif /* ! GRUB_UTIL */ -} - -static struct builtin builtin_ioprobe = -{ - "ioprobe", - ioprobe_func, - BUILTIN_CMDLINE, - "ioprobe DRIVE", - "Probe I/O ports used for the drive DRIVE." -}; - - -/* - * To boot from a ZFS root filesystem, the kernel$ or module$ commands - * must include "-B $ZFS-BOOTFS" to pass to the kernel: - * - * e.g. - * kernel$ /platform/i86pc/kernel/$ISADIR/unix -B $ZFS-BOOTFS,console=ttya - * - * The expand_dollar_bootfs routine expands $ZFS-BOOTFS to - * "pool-name/zfs-rootfilesystem-object-num", e.g. "rootpool/85" - * so that in the kernel zfs_mountroot would know which zfs root - * filesystem to be mounted. - */ -static int -expand_dollar_bootfs(char *in, char *out) -{ - char *token, *tmpout = out; - int outlen, blen; - int postcomma = 0; - - outlen = strlen(in); - blen = current_bootfs_obj == 0 ? strlen(current_rootpool) : - strlen(current_rootpool) + 11; - - out[0] = '\0'; - while (token = strstr(in, "$ZFS-BOOTFS")) { - - if ((outlen += blen) > MAX_CMDLINE) { - errnum = ERR_WONT_FIT; - return (1); - } - - token[0] = '\0'; - grub_sprintf(tmpout, "%s", in); - token[0] = '$'; - in = token + 11; /* skip over $ZFS-BOOTFS */ - tmpout = out + strlen(out); - - /* Note: %u only fits 32 bit integer; */ - if (current_bootfs_obj > 0) - grub_sprintf(tmpout, "zfs-bootfs=%s/%u", - current_rootpool, current_bootfs_obj); - else - grub_sprintf(tmpout, "zfs-bootfs=%s", - current_rootpool); - tmpout = out + strlen(out); - } - - /* - * Check to see if 'zfs-bootfs' was explicitly specified on the command - * line so that we can insert the 'bootpath' property. - */ - if ((tmpout == out) && (token = strstr(in, "zfs-bootfs")) != NULL) { - token[0] = '\0'; - grub_strcpy(tmpout, in); - token[0] = 'z'; - in = token; - - tmpout = out + strlen(out); - postcomma = 1; - } - - /* - * Set the 'bootpath' property if a ZFS dataset was specified, either - * through '$ZFS-BOOTFS' or an explicit 'zfs-bootfs' setting. - */ - if (tmpout != out) { - if ((outlen += 12 + strlen(current_bootpath)) > MAX_CMDLINE) { - errnum = ERR_WONT_FIT; - return (1); - } - grub_sprintf(tmpout, - postcomma ? "bootpath=\"%s\"," : ",bootpath=\"%s\"", - current_bootpath); - tmpout = out + strlen(out); - } - if (strlen(current_devid)) { - if ((outlen += 13 + strlen(current_devid)) > MAX_CMDLINE) { - errnum = ERR_WONT_FIT; - return (1); - } - grub_sprintf(tmpout, - postcomma ? "diskdevid=\"%s\"," : ",diskdevid=\"%s\"", - current_devid); - } - - strncat(out, in, MAX_CMDLINE); - return (0); -} - -/* kernel */ -static int -kernel_func (char *arg, int flags) -{ - int len; - kernel_t suggested_type = KERNEL_TYPE_NONE; - unsigned long load_flags = 0; - -#ifndef AUTO_LINUX_MEM_OPT - load_flags |= KERNEL_LOAD_NO_MEM_OPTION; -#endif - - /* Deal with GNU-style long options. */ - while (1) - { - /* If the option `--type=TYPE' is specified, convert the string to - a kernel type. */ - if (grub_memcmp (arg, "--type=", 7) == 0) - { - arg += 7; - - if (grub_memcmp (arg, "netbsd", 6) == 0) - suggested_type = KERNEL_TYPE_NETBSD; - else if (grub_memcmp (arg, "freebsd", 7) == 0) - suggested_type = KERNEL_TYPE_FREEBSD; - else if (grub_memcmp (arg, "openbsd", 7) == 0) - /* XXX: For now, OpenBSD is identical to NetBSD, from GRUB's - point of view. */ - suggested_type = KERNEL_TYPE_NETBSD; - else if (grub_memcmp (arg, "linux", 5) == 0) - suggested_type = KERNEL_TYPE_LINUX; - else if (grub_memcmp (arg, "biglinux", 8) == 0) - suggested_type = KERNEL_TYPE_BIG_LINUX; - else if (grub_memcmp (arg, "multiboot", 9) == 0) - suggested_type = KERNEL_TYPE_MULTIBOOT; - else - { - errnum = ERR_BAD_ARGUMENT; - return 1; - } - } - /* If the `--no-mem-option' is specified, don't pass a Linux's mem - option automatically. If the kernel is another type, this flag - has no effect. */ - else if (grub_memcmp (arg, "--no-mem-option", 15) == 0) - load_flags |= KERNEL_LOAD_NO_MEM_OPTION; - else - break; - - /* Try the next. */ - arg = skip_to (0, arg); - } - - len = grub_strlen (arg); - - /* Reset MB_CMDLINE. */ - mb_cmdline = (char *) MB_CMDLINE_BUF; - if (len + 1 > MB_CMDLINE_BUFLEN) - { - errnum = ERR_WONT_FIT; - return 1; - } - - /* Copy the command-line to MB_CMDLINE. */ - grub_memmove (mb_cmdline, arg, len + 1); - kernel_type = load_image (arg, mb_cmdline, suggested_type, load_flags); - if (kernel_type == KERNEL_TYPE_NONE) - return 1; - - mb_cmdline += grub_strlen(mb_cmdline) + 1; - return 0; -} - -static struct builtin builtin_kernel = -{ - "kernel", - kernel_func, - BUILTIN_CMDLINE | BUILTIN_HELP_LIST, - "kernel [--no-mem-option] [--type=TYPE] FILE [ARG ...]", - "Attempt to load the primary boot image from FILE. The rest of the" - " line is passed verbatim as the \"kernel command line\". Any modules" - " must be reloaded after using this command. The option --type is used" - " to suggest what type of kernel to be loaded. TYPE must be either of" - " \"netbsd\", \"freebsd\", \"openbsd\", \"linux\", \"biglinux\" and" - " \"multiboot\". The option --no-mem-option tells GRUB not to pass a" - " Linux's mem option automatically." -}; - -int -min_mem64_func(char *arg, int flags) -{ - if (!safe_parse_maxint(&arg, &min_mem64)) - return (1); -} - -static struct builtin builtin_min_mem64 = -{ - "min_mem64", - min_mem64_func, - BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_SCRIPT | BUILTIN_HELP_LIST, - "min_mem64 ", - "Sets minimum memory (in MB) required for $ISADIR to expand to amd64, " - "even on 64-bit capable hardware." -}; - -int -check_min_mem64() -{ - if (min_mem64 == 0) - return (1); - - if ((mbi.mem_upper / 10240) * 11 >= min_mem64) - return (1); - - return (0); -} - -static int detect_target_operating_mode(); - -int -amd64_config_cpu(void) -{ - struct amd64_cpuid_regs __vcr, *vcr = &__vcr; - uint32_t maxeax; - uint32_t max_maxeax = 0x100; - char vendor[13]; - int isamd64 = 0; - uint32_t stdfeatures = 0, xtdfeatures = 0; - uint64_t efer; - - /* - * This check may seem silly, but if the C preprocesor symbol __amd64 - * is #defined during compilation, something that may outwardly seem - * like a good idea, uts/common/sys/isa_defs.h will #define _LP64, - * which will cause uts/common/sys/int_types.h to typedef uint64_t as - * an unsigned long - which is only 4 bytes in size when using a 32-bit - * compiler. - * - * If that happens, all the page table translation routines will fail - * horribly, so check the size of uint64_t just to insure some degree - * of sanity in future operations. - */ - /*LINTED [sizeof result is invarient]*/ - if (sizeof (uint64_t) != 8) - prom_panic("grub compiled improperly, unable to boot " - "64-bit AMD64 executables"); - - /* - * If the CPU doesn't support the CPUID instruction, it's definitely - * not an AMD64. - */ - if (amd64_cpuid_supported() == 0) - return (0); - - amd64_cpuid_insn(0, vcr); - - maxeax = vcr->r_eax; - { - /*LINTED [vendor string from cpuid data]*/ - uint32_t *iptr = (uint32_t *)vendor; - - *iptr++ = vcr->r_ebx; - *iptr++ = vcr->r_edx; - *iptr++ = vcr->r_ecx; - - vendor[12] = '\0'; - } - - if (maxeax > max_maxeax) { - grub_printf("cpu: warning, maxeax was 0x%x -> 0x%x\n", - maxeax, max_maxeax); - maxeax = max_maxeax; - } - - if (maxeax < 1) - return (0); /* no additional functions, not an AMD64 */ - else { - uint_t family, model, step; - - amd64_cpuid_insn(1, vcr); - - /* - * All AMD64/IA32e processors technically SHOULD report - * themselves as being in family 0xf, but for some reason - * Simics doesn't, and this may change in the future, so - * don't error out if it's not true. - */ - if ((family = BITX(vcr->r_eax, 11, 8)) == 0xf) - family += BITX(vcr->r_eax, 27, 20); - - if ((model = BITX(vcr->r_eax, 7, 4)) == 0xf) - model += BITX(vcr->r_eax, 19, 16) << 4; - step = BITX(vcr->r_eax, 3, 0); - - grub_printf("cpu: '%s' family %d model %d step %d\n", - vendor, family, model, step); - stdfeatures = vcr->r_edx; - } - - amd64_cpuid_insn(0x80000000, vcr); - - if (vcr->r_eax & 0x80000000) { - uint32_t xmaxeax = vcr->r_eax; - const uint32_t max_xmaxeax = 0x80000100; - - if (xmaxeax > max_xmaxeax) { - grub_printf("amd64: warning, xmaxeax was " - "0x%x -> 0x%x\n", xmaxeax, max_xmaxeax); - xmaxeax = max_xmaxeax; - } - - if (xmaxeax >= 0x80000001) { - amd64_cpuid_insn(0x80000001, vcr); - xtdfeatures = vcr->r_edx; - } - } - - if (BITX(xtdfeatures, 29, 29)) /* long mode */ - isamd64++; - else - grub_printf("amd64: CPU does NOT support long mode\n"); - - if (!BITX(stdfeatures, 0, 0)) { - grub_printf("amd64: CPU does NOT support FPU\n"); - isamd64--; - } - - if (!BITX(stdfeatures, 4, 4)) { - grub_printf("amd64: CPU does NOT support TSC\n"); - isamd64--; - } - - if (!BITX(stdfeatures, 5, 5)) { - grub_printf("amd64: CPU does NOT support MSRs\n"); - isamd64--; - } - - if (!BITX(stdfeatures, 6, 6)) { - grub_printf("amd64: CPU does NOT support PAE\n"); - isamd64--; - } - - if (!BITX(stdfeatures, 8, 8)) { - grub_printf("amd64: CPU does NOT support CX8\n"); - isamd64--; - } - - if (!BITX(stdfeatures, 13, 13)) { - grub_printf("amd64: CPU does NOT support PGE\n"); - isamd64--; - } - - if (!BITX(stdfeatures, 19, 19)) { - grub_printf("amd64: CPU does NOT support CLFSH\n"); - isamd64--; - } - - if (!BITX(stdfeatures, 23, 23)) { - grub_printf("amd64: CPU does NOT support MMX\n"); - isamd64--; - } - - if (!BITX(stdfeatures, 24, 24)) { - grub_printf("amd64: CPU does NOT support FXSR\n"); - isamd64--; - } - - if (!BITX(stdfeatures, 25, 25)) { - grub_printf("amd64: CPU does NOT support SSE\n"); - isamd64--; - } - - if (!BITX(stdfeatures, 26, 26)) { - grub_printf("amd64: CPU does NOT support SSE2\n"); - isamd64--; - } - - if (isamd64 < 1) { - grub_printf("amd64: CPU does not support amd64 executables.\n"); - return (0); - } - - amd64_rdmsr(MSR_AMD_EFER, &efer); - if (efer & AMD_EFER_SCE) - grub_printf("amd64: EFER_SCE (syscall/sysret) already " - "enabled\n"); - if (efer & AMD_EFER_NXE) - grub_printf("amd64: EFER_NXE (no-exec prot) already enabled\n"); - if (efer & AMD_EFER_LME) - grub_printf("amd64: EFER_LME (long mode) already enabled\n"); - - return (detect_target_operating_mode()); -} - -static int -detect_target_operating_mode() -{ - int ret, ah; - - ah = get_target_operating_mode(); - - ah = ah >> 8; - - /* XXX still need to pass back the return from the call */ - ret = 0; - - if (ah == 0x86 && (ret & CB) != 0) { - grub_printf("[BIOS 'Detect Target Operating Mode' " - "callback unsupported on this platform]\n"); - return (1); /* unsupported, ignore */ - } - - if (ah == 0x0 && (ret & CB) == 0) { - grub_printf("[BIOS accepted mixed-mode target setting!]\n"); - return (1); /* told the bios what we're up to */ - } - - if (ah == 0 && ret & CB) { - grub_printf("fatal: BIOS reports this machine CANNOT run in " - "mixed 32/64-bit mode!\n"); - return (0); - } - - grub_printf("warning: BIOS Detect Target Operating Mode callback " - "confused.\n %%ax >> 8 = 0x%x, carry = %d\n", ah, - ret & CB ? 1 : 0); - - return (1); -} - - -int -isamd64() -{ - static int ret = -1; - - if (ret == -1) - ret = amd64_config_cpu(); - - return (ret); -} - -static void -expand_arch (char *arg, char *newarg) -{ - char *index; - - newarg[0] = '\0'; - - while ((index = strstr(arg, "$ISADIR")) != NULL) { - - index[0] = '\0'; - strncat(newarg, arg, MAX_CMDLINE); - index[0] = '$'; - - if (isamd64() && check_min_mem64()) - strncat(newarg, "amd64", MAX_CMDLINE); - - arg = index + 7; - } - - strncat(newarg, arg, MAX_CMDLINE); - return; -} - -/* kernel$ */ -static int -kernel_dollar_func (char *arg, int flags) -{ - char newarg[MAX_CMDLINE]; /* everything boils down to MAX_CMDLINE */ - - grub_printf("loading '%s' ...\n", arg); - expand_arch(arg, newarg); - - if (kernel_func(newarg, flags)) - return (1); - - mb_cmdline = (char *)MB_CMDLINE_BUF; - if (expand_dollar_bootfs(newarg, mb_cmdline)) - return (1); - - grub_printf("'%s' is loaded\n", mb_cmdline); - mb_cmdline += grub_strlen(mb_cmdline) + 1; - - return (0); -} - -static struct builtin builtin_kernel_dollar = -{ - "kernel$", - kernel_dollar_func, - BUILTIN_CMDLINE | BUILTIN_HELP_LIST, - "kernel$ [--no-mem-option] [--type=TYPE] FILE [ARG ...]", - " Just like kernel, but with $ISADIR expansion." -}; - - -/* lock */ -static int -lock_func (char *arg, int flags) -{ - if (! auth && password) - { - errnum = ERR_PRIVILEGED; - return 1; - } - - return 0; -} - -static struct builtin builtin_lock = -{ - "lock", - lock_func, - BUILTIN_CMDLINE, - "lock", - "Break a command execution unless the user is authenticated." -}; - - -/* makeactive */ -static int -makeactive_func (char *arg, int flags) -{ - if (! make_saved_active ()) - return 1; - - return 0; -} - -static struct builtin builtin_makeactive = -{ - "makeactive", - makeactive_func, - BUILTIN_CMDLINE | BUILTIN_HELP_LIST, - "makeactive", - "Set the active partition on the root disk to GRUB's root device." - " This command is limited to _primary_ PC partitions on a hard disk." -}; - - -/* map */ -/* Map FROM_DRIVE to TO_DRIVE. */ -static int -map_func (char *arg, int flags) -{ - char *to_drive; - char *from_drive; - unsigned long to, from; - int i; - - to_drive = arg; - from_drive = skip_to (0, arg); - - /* Get the drive number for TO_DRIVE. */ - set_device (to_drive); - if (errnum) - return 1; - to = current_drive; - - /* Get the drive number for FROM_DRIVE. */ - set_device (from_drive); - if (errnum) - return 1; - from = current_drive; - - /* Search for an empty slot in BIOS_DRIVE_MAP. */ - for (i = 0; i < DRIVE_MAP_SIZE; i++) - { - /* Perhaps the user wants to override the map. */ - if ((bios_drive_map[i] & 0xff) == from) - break; - - if (! bios_drive_map[i]) - break; - } - - if (i == DRIVE_MAP_SIZE) - { - errnum = ERR_WONT_FIT; - return 1; - } - - if (to == from) - /* If TO is equal to FROM, delete the entry. */ - grub_memmove ((char *) &bios_drive_map[i], (char *) &bios_drive_map[i + 1], - sizeof (unsigned short) * (DRIVE_MAP_SIZE - i)); - else - bios_drive_map[i] = from | (to << 8); - - return 0; -} - -static struct builtin builtin_map = -{ - "map", - map_func, - BUILTIN_CMDLINE | BUILTIN_HELP_LIST, - "map TO_DRIVE FROM_DRIVE", - "Map the drive FROM_DRIVE to the drive TO_DRIVE. This is necessary" - " when you chain-load some operating systems, such as DOS, if such an" - " OS resides at a non-first drive." -}; - - -#ifdef USE_MD5_PASSWORDS -/* md5crypt */ -static int -md5crypt_func (char *arg, int flags) -{ - char crypted[36]; - char key[32]; - unsigned int seed; - int i; - const char *const seedchars = - "./0123456789ABCDEFGHIJKLMNOPQRST" - "UVWXYZabcdefghijklmnopqrstuvwxyz"; - - /* First create a salt. */ - - /* The magical prefix. */ - grub_memset (crypted, 0, sizeof (crypted)); - grub_memmove (crypted, "$1$", 3); - - /* Create the length of a salt. */ - seed = currticks (); - - /* Generate a salt. */ - for (i = 0; i < 8 && seed; i++) - { - /* FIXME: This should be more random. */ - crypted[3 + i] = seedchars[seed & 0x3f]; - seed >>= 6; - } - - /* A salt must be terminated with `$', if it is less than 8 chars. */ - crypted[3 + i] = '$'; - -#ifdef DEBUG_MD5CRYPT - grub_printf ("salt = %s\n", crypted); -#endif - - /* Get a password. */ - grub_memset (key, 0, sizeof (key)); - get_cmdline ("Password: ", key, sizeof (key) - 1, '*', 0); - - /* Crypt the key. */ - make_md5_password (key, crypted); - - grub_printf ("Encrypted: %s\n", crypted); - return 0; -} - -static struct builtin builtin_md5crypt = -{ - "md5crypt", - md5crypt_func, - BUILTIN_CMDLINE | BUILTIN_HELP_LIST, - "md5crypt", - "Generate a password in MD5 format." -}; -#endif /* USE_MD5_PASSWORDS */ - - -/* module */ -static int -module_func (char *arg, int flags) -{ - int len = grub_strlen (arg); - - switch (kernel_type) - { - case KERNEL_TYPE_MULTIBOOT: - if (mb_cmdline + len + 1 > (char *) MB_CMDLINE_BUF + MB_CMDLINE_BUFLEN) - { - errnum = ERR_WONT_FIT; - return 1; - } - grub_memmove (mb_cmdline, arg, len + 1); - if (! load_module (arg, mb_cmdline)) - return 1; - - mb_cmdline += grub_strlen(mb_cmdline) + 1; - break; - - case KERNEL_TYPE_LINUX: - case KERNEL_TYPE_BIG_LINUX: - if (! load_initrd (arg)) - return 1; - break; - - default: - errnum = ERR_NEED_MB_KERNEL; - return 1; - } - - return 0; -} - -static struct builtin builtin_module = -{ - "module", - module_func, - BUILTIN_CMDLINE | BUILTIN_HELP_LIST, - "module FILE [ARG ...]", - "Load a boot module FILE for a Multiboot format boot image (no" - " interpretation of the file contents is made, so users of this" - " command must know what the kernel in question expects). The" - " rest of the line is passed as the \"module command line\", like" - " the `kernel' command." -}; - -/* module$ */ -static int -module_dollar_func (char *arg, int flags) -{ - char newarg[MAX_CMDLINE]; /* everything boils down to MAX_CMDLINE */ - char *cmdline_sav; - - grub_printf("loading '%s' ...\n", arg); - expand_arch(arg, newarg); - - cmdline_sav = (char *)mb_cmdline; - if (module_func(newarg, flags)) - return (1); - - if (expand_dollar_bootfs(newarg, cmdline_sav)) - return (1); - - grub_printf("'%s' is loaded\n", (char *)cmdline_sav); - mb_cmdline += grub_strlen(cmdline_sav) + 1; - - return (0); -} - -static struct builtin builtin_module_dollar = -{ - "module$", - module_dollar_func, - BUILTIN_CMDLINE | BUILTIN_HELP_LIST, - "module FILE [ARG ...]", - " Just like module, but with $ISADIR expansion." -}; - - -/* modulenounzip */ -static int -modulenounzip_func (char *arg, int flags) -{ - int ret; - -#ifndef NO_DECOMPRESSION - no_decompression = 1; -#endif - - ret = module_func (arg, flags); - -#ifndef NO_DECOMPRESSION - no_decompression = 0; -#endif - - return ret; -} - -static struct builtin builtin_modulenounzip = -{ - "modulenounzip", - modulenounzip_func, - BUILTIN_CMDLINE | BUILTIN_HELP_LIST, - "modulenounzip FILE [ARG ...]", - "The same as `module', except that automatic decompression is" - " disabled." -}; - - -/* pager [on|off] */ -static int -pager_func (char *arg, int flags) -{ - /* If ARG is empty, toggle the flag. */ - if (! *arg) - use_pager = ! use_pager; - else if (grub_memcmp (arg, "on", 2) == 0) - use_pager = 1; - else if (grub_memcmp (arg, "off", 3) == 0) - use_pager = 0; - else - { - errnum = ERR_BAD_ARGUMENT; - return 1; - } - - grub_printf (" Internal pager is now %s\n", use_pager ? "on" : "off"); - return 0; -} - -static struct builtin builtin_pager = -{ - "pager", - pager_func, - BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_HELP_LIST, - "pager [FLAG]", - "Toggle pager mode with no argument. If FLAG is given and its value" - " is `on', turn on the mode. If FLAG is `off', turn off the mode." -}; - - -/* partnew PART TYPE START LEN */ -static int -partnew_func (char *arg, int flags) -{ - int new_type, new_start, new_len; - int start_cl, start_ch, start_dh; - int end_cl, end_ch, end_dh; - int entry; - char mbr[512]; - - /* Convert a LBA address to a CHS address in the INT 13 format. */ - auto void lba_to_chs (int lba, int *cl, int *ch, int *dh); - void lba_to_chs (int lba, int *cl, int *ch, int *dh) - { - int cylinder, head, sector; - - sector = lba % buf_geom.sectors + 1; - head = (lba / buf_geom.sectors) % buf_geom.heads; - cylinder = lba / (buf_geom.sectors * buf_geom.heads); - - if (cylinder >= buf_geom.cylinders) - cylinder = buf_geom.cylinders - 1; - - *cl = sector | ((cylinder & 0x300) >> 2); - *ch = cylinder & 0xFF; - *dh = head; - } - - /* Get the drive and the partition. */ - if (! set_device (arg)) - return 1; - - /* The drive must be a hard disk. */ - if (! (current_drive & 0x80)) - { - errnum = ERR_BAD_ARGUMENT; - return 1; - } - - /* The partition must a primary partition. */ - if ((current_partition >> 16) > 3 - || (current_partition & 0xFFFF) != 0xFFFF) - { - errnum = ERR_BAD_ARGUMENT; - return 1; - } - - entry = current_partition >> 16; - - /* Get the new partition type. */ - arg = skip_to (0, arg); - if (! safe_parse_maxint (&arg, &new_type)) - return 1; - - /* The partition type is unsigned char. */ - if (new_type > 0xFF) - { - errnum = ERR_BAD_ARGUMENT; - return 1; - } - - /* Get the new partition start. */ - arg = skip_to (0, arg); - if (! safe_parse_maxint (&arg, &new_start)) - return 1; - - /* Get the new partition length. */ - arg = skip_to (0, arg); - if (! safe_parse_maxint (&arg, &new_len)) - return 1; - - /* Read the MBR. */ - if (! rawread (current_drive, 0, 0, SECTOR_SIZE, mbr)) - return 1; - - /* Check if the new partition will fit in the disk. */ - if (new_start + new_len > buf_geom.total_sectors) - { - errnum = ERR_GEOM; - return 1; - } - - /* Store the partition information in the MBR. */ - lba_to_chs (new_start, &start_cl, &start_ch, &start_dh); - lba_to_chs (new_start + new_len - 1, &end_cl, &end_ch, &end_dh); - - PC_SLICE_FLAG (mbr, entry) = 0; - PC_SLICE_HEAD (mbr, entry) = start_dh; - PC_SLICE_SEC (mbr, entry) = start_cl; - PC_SLICE_CYL (mbr, entry) = start_ch; - PC_SLICE_TYPE (mbr, entry) = new_type; - PC_SLICE_EHEAD (mbr, entry) = end_dh; - PC_SLICE_ESEC (mbr, entry) = end_cl; - PC_SLICE_ECYL (mbr, entry) = end_ch; - PC_SLICE_START (mbr, entry) = new_start; - PC_SLICE_LENGTH (mbr, entry) = new_len; - - /* Make sure that the MBR has a valid signature. */ - PC_MBR_SIG (mbr) = PC_MBR_SIGNATURE; - - /* Write back the MBR to the disk. */ - buf_track = BUF_CACHE_INVALID; - if (! rawwrite (current_drive, 0, mbr)) - return 1; - - return 0; -} - -static struct builtin builtin_partnew = -{ - "partnew", - partnew_func, - BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_HELP_LIST, - "partnew PART TYPE START LEN", - "Create a primary partition at the starting address START with the" - " length LEN, with the type TYPE. START and LEN are in sector units." -}; - - -/* parttype PART TYPE */ -static int -parttype_func (char *arg, int flags) -{ - int new_type; - unsigned long part = 0xFFFFFF; - unsigned long start, len, offset, ext_offset; - int entry, type; - char mbr[512]; - - /* Get the drive and the partition. */ - if (! set_device (arg)) - return 1; - - /* The drive must be a hard disk. */ - if (! (current_drive & 0x80)) - { - errnum = ERR_BAD_ARGUMENT; - return 1; - } - - /* The partition must be a PC slice. */ - if ((current_partition >> 16) == 0xFF - || (current_partition & 0xFFFF) != 0xFFFF) - { - errnum = ERR_BAD_ARGUMENT; - return 1; - } - - /* Get the new partition type. */ - arg = skip_to (0, arg); - if (! safe_parse_maxint (&arg, &new_type)) - return 1; - - /* The partition type is unsigned char. */ - if (new_type > 0xFF) - { - errnum = ERR_BAD_ARGUMENT; - return 1; - } - - /* Look for the partition. */ - while (next_partition (current_drive, 0xFFFFFF, &part, &type, - &start, &len, &offset, &entry, - &ext_offset, mbr)) - { - if (part == current_partition) - { - /* Found. */ - - /* Set the type to NEW_TYPE. */ - PC_SLICE_TYPE (mbr, entry) = new_type; - - /* Write back the MBR to the disk. */ - buf_track = BUF_CACHE_INVALID; - if (! rawwrite (current_drive, offset, mbr)) - return 1; - - /* Succeed. */ - return 0; - } - } - - /* The partition was not found. ERRNUM was set by next_partition. */ - return 1; -} - -static struct builtin builtin_parttype = -{ - "parttype", - parttype_func, - BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_HELP_LIST, - "parttype PART TYPE", - "Change the type of the partition PART to TYPE." -}; - - -/* password */ -static int -password_func (char *arg, int flags) -{ - int len; - password_t type = PASSWORD_PLAIN; - -#ifdef USE_MD5_PASSWORDS - if (grub_memcmp (arg, "--md5", 5) == 0) - { - type = PASSWORD_MD5; - arg = skip_to (0, arg); - } -#endif - if (grub_memcmp (arg, "--", 2) == 0) - { - type = PASSWORD_UNSUPPORTED; - arg = skip_to (0, arg); - } - - if ((flags & (BUILTIN_CMDLINE | BUILTIN_SCRIPT)) != 0) - { - /* Do password check! */ - char entered[32]; - - /* Wipe out any previously entered password */ - entered[0] = 0; - get_cmdline ("Password: ", entered, 31, '*', 0); - - nul_terminate (arg); - if (check_password (entered, arg, type) != 0) - { - errnum = ERR_PRIVILEGED; - return 1; - } - } - else - { - len = grub_strlen (arg); - - /* PASSWORD NUL NUL ... */ - if (len + 2 > PASSWORD_BUFLEN) - { - errnum = ERR_WONT_FIT; - return 1; - } - - /* Copy the password and clear the rest of the buffer. */ - password = (char *) PASSWORD_BUF; - grub_memmove (password, arg, len); - grub_memset (password + len, 0, PASSWORD_BUFLEN - len); - password_type = type; - } - return 0; -} - -static struct builtin builtin_password = -{ - "password", - password_func, - BUILTIN_MENU | BUILTIN_CMDLINE | BUILTIN_NO_ECHO, - "password [--md5] PASSWD [FILE]", - "If used in the first section of a menu file, disable all" - " interactive editing control (menu entry editor and" - " command line). If the password PASSWD is entered, it loads the" - " FILE as a new config file and restarts the GRUB Stage 2. If you" - " omit the argument FILE, then GRUB just unlocks privileged" - " instructions. You can also use it in the script section, in" - " which case it will ask for the password, before continueing." - " The option --md5 tells GRUB that PASSWD is encrypted with" - " md5crypt." -}; - - -/* pause */ -static int -pause_func (char *arg, int flags) -{ - printf("%s\n", arg); - - /* If ESC is returned, then abort this entry. */ - if (ASCII_CHAR (getkey ()) == 27) - return 1; - - return 0; -} - -static struct builtin builtin_pause = -{ - "pause", - pause_func, - BUILTIN_CMDLINE | BUILTIN_NO_ECHO, - "pause [MESSAGE ...]", - "Print MESSAGE, then wait until a key is pressed." -}; - - -#ifdef GRUB_UTIL -/* quit */ -static int -quit_func (char *arg, int flags) -{ - stop (); - - /* Never reach here. */ - return 0; -} - -static struct builtin builtin_quit = -{ - "quit", - quit_func, - BUILTIN_CMDLINE | BUILTIN_HELP_LIST, - "quit", - "Exit from the GRUB shell." -}; -#endif /* GRUB_UTIL */ - - -#ifdef SUPPORT_NETBOOT -/* rarp */ -static int -rarp_func (char *arg, int flags) -{ - if (! rarp ()) - { - if (errnum == ERR_NONE) - errnum = ERR_DEV_VALUES; - - return 1; - } - - /* Notify the configuration. */ - print_network_configuration (); - return 0; -} - -static struct builtin builtin_rarp = -{ - "rarp", - rarp_func, - BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_HELP_LIST, - "rarp", - "Initialize a network device via RARP." -}; -#endif /* SUPPORT_NETBOOT */ - - -static int -read_func (char *arg, int flags) -{ - int addr; - - if (! safe_parse_maxint (&arg, &addr)) - return 1; - - grub_printf ("Address 0x%x: Value 0x%x\n", - addr, *((unsigned *) RAW_ADDR (addr))); - return 0; -} - -static struct builtin builtin_read = -{ - "read", - read_func, - BUILTIN_CMDLINE, - "read ADDR", - "Read a 32-bit value from memory at address ADDR and" - " display it in hex format." -}; - - -/* reboot */ -static int -reboot_func (char *arg, int flags) -{ - grub_reboot (); - - /* Never reach here. */ - return 1; -} - -static struct builtin builtin_reboot = -{ - "reboot", - reboot_func, - BUILTIN_CMDLINE | BUILTIN_HELP_LIST, - "reboot", - "Reboot your system." -}; - - -/* Print the root device information. */ -static void -print_root_device (void) -{ - if (saved_drive == NETWORK_DRIVE) - { - /* Network drive. */ - grub_printf (" (nd):"); - } - else if (saved_drive & 0x80) - { - /* Hard disk drive. */ - grub_printf (" (hd%d", saved_drive - 0x80); - - if ((saved_partition & 0xFF0000) != 0xFF0000) - grub_printf (",%d", saved_partition >> 16); - - if ((saved_partition & 0x00FF00) != 0x00FF00) - grub_printf (",%c", ((saved_partition >> 8) & 0xFF) + 'a'); - - grub_printf ("):"); - } - else - { - /* Floppy disk drive. */ - grub_printf (" (fd%d):", saved_drive); - } - - /* Print the filesystem information. */ - current_partition = saved_partition; - current_drive = saved_drive; - print_fsys_type (); -} - -static int -real_root_func (char *arg, int attempt_mount) -{ - int hdbias = 0; - char *biasptr; - char *next; - - /* If ARG is empty, just print the current root device. */ - if (! *arg) - { - print_root_device (); - return 0; - } - - /* Call set_device to get the drive and the partition in ARG. */ - next = set_device (arg); - if (! next) - return 1; - - /* Ignore ERR_FSYS_MOUNT. */ - if (attempt_mount) - { - if (! open_device () && errnum != ERR_FSYS_MOUNT) - return 1; - } - else - { - /* This is necessary, because the location of a partition table - must be set appropriately. */ - if (open_partition ()) - { - set_bootdev (0); - if (errnum) - return 1; - } - } - - /* Clear ERRNUM. */ - errnum = 0; - saved_partition = current_partition; - saved_drive = current_drive; - - if (attempt_mount) - { - /* BSD and chainloading evil hacks !! */ - biasptr = skip_to (0, next); - safe_parse_maxint (&biasptr, &hdbias); - errnum = 0; - bootdev = set_bootdev (hdbias); - if (errnum) - return 1; - - /* Print the type of the filesystem. */ - print_fsys_type (); - } - - return 0; -} - -static int -root_func (char *arg, int flags) -{ - is_zfs_mount = 0; - return real_root_func (arg, 1); -} - -static struct builtin builtin_root = -{ - "root", - root_func, - BUILTIN_CMDLINE | BUILTIN_HELP_LIST, - "root [DEVICE [HDBIAS]]", - "Set the current \"root device\" to the device DEVICE, then" - " attempt to mount it to get the partition size (for passing the" - " partition descriptor in `ES:ESI', used by some chain-loaded" - " bootloaders), the BSD drive-type (for booting BSD kernels using" - " their native boot format), and correctly determine " - " the PC partition where a BSD sub-partition is located. The" - " optional HDBIAS parameter is a number to tell a BSD kernel" - " how many BIOS drive numbers are on controllers before the current" - " one. For example, if there is an IDE disk and a SCSI disk, and your" - " FreeBSD root partition is on the SCSI disk, then use a `1' for HDBIAS." -}; - - -/* findroot */ -static int -findroot_func (char *arg, int flags) -{ - int ret; - char root[32]; - - if (grub_strlen(arg) >= BOOTSIGN_ARGLEN) { - errnum = ERR_BAD_ARGUMENT; - return 1; - } - - if (arg[0] == '\0') { - errnum = ERR_BAD_ARGUMENT; - return 1; - } - - if (grub_strchr(arg, '/')) { - errnum = ERR_BAD_ARGUMENT; - return 1; - } - - find_best_root = 1; - best_drive = 0; - best_part = 0; - ret = find_common(arg, root, 1, flags); - if (ret != 0) - return (ret); - find_best_root = 0; - - return real_root_func (root, 1); -} - -static struct builtin builtin_findroot = -{ - "findroot", - findroot_func, - BUILTIN_CMDLINE | BUILTIN_HELP_LIST, - "findroot ", - "Searches across all partitions for the file name SIGNATURE." - " GRUB looks only in the directory /boot/grub/bootsign for the" - " filename and it stops as soon as it finds the first instance of" - " the file - so to be useful the name of the signature file must be" - " unique across all partitions. Once the signature file is found," - " GRUB invokes the \"root\" command on that partition." - " An optional partition and slice may be specified to optimize the search." -}; - - -/* - * COMMAND to override the default root filesystem for ZFS - * bootfs pool/fs - */ -static int -bootfs_func (char *arg, int flags) -{ - int hdbias = 0; - char *biasptr; - char *next; - - if (! *arg) { - if (current_bootfs[0] != '\0') - grub_printf ("The zfs boot filesystem is set to '%s'.\n", - current_bootfs); - else if (current_rootpool[0] != 0 && current_bootfs_obj != 0) - grub_printf("The zfs boot filesystem is .", - current_rootpool, current_bootfs_obj); - else - grub_printf ("The zfs boot filesystem will be derived from " - "the default bootfs pool property.\n"); - - return (1); - } - - /* Verify the zfs filesystem name */ - if (arg[0] == '/' || arg[0] == '\0') { - errnum = ERR_BAD_ARGUMENT; - return 0; - } - if (current_rootpool[0] != 0 && grub_strncmp(arg, - current_rootpool, strlen(current_rootpool))) { - errnum = ERR_BAD_ARGUMENT; - return 0; - } - - if (set_bootfs(arg) == 0) { - errnum = ERR_BAD_ARGUMENT; - return 0; - } - - return (1); -} - -static struct builtin builtin_bootfs = -{ - "bootfs", - bootfs_func, - BUILTIN_CMDLINE | BUILTIN_HELP_LIST, - "bootfs [ZFSBOOTFS]", - "Set the current zfs boot filesystem to ZFSBOOTFS (rootpool/rootfs)." -}; - - -/* rootnoverify */ -static int -rootnoverify_func (char *arg, int flags) -{ - return real_root_func (arg, 0); -} - -static struct builtin builtin_rootnoverify = -{ - "rootnoverify", - rootnoverify_func, - BUILTIN_CMDLINE | BUILTIN_HELP_LIST, - "rootnoverify [DEVICE [HDBIAS]]", - "Similar to `root', but don't attempt to mount the partition. This" - " is useful for when an OS is outside of the area of the disk that" - " GRUB can read, but setting the correct root device is still" - " desired. Note that the items mentioned in `root' which" - " derived from attempting the mount will NOT work correctly." -}; - - -/* savedefault */ -static int -savedefault_func (char *arg, int flags) -{ -#if !defined(SUPPORT_DISKLESS) && !defined(GRUB_UTIL) - unsigned long tmp_drive = saved_drive; - unsigned long tmp_partition = saved_partition; - char *default_file = (char *) DEFAULT_FILE_BUF; - char buf[10]; - char sect[SECTOR_SIZE]; - int entryno; - int sector_count = 0; - unsigned int saved_sectors[2]; - int saved_offsets[2]; - int saved_lengths[2]; - - /* not supported for zfs root */ - if (is_zfs_mount == 1) { - return (0); /* no-op */ - } - - /* Save sector information about at most two sectors. */ - auto void disk_read_savesect_func(unsigned int sector, int offset, - int length); - void disk_read_savesect_func(unsigned int sector, int offset, int length) - { - if (sector_count < 2) - { - saved_sectors[sector_count] = sector; - saved_offsets[sector_count] = offset; - saved_lengths[sector_count] = length; - } - sector_count++; - } - - /* This command is only useful when you boot an entry from the menu - interface. */ - if (! (flags & BUILTIN_SCRIPT)) - { - errnum = ERR_UNRECOGNIZED; - return 1; - } - - /* Determine a saved entry number. */ - if (*arg) - { - if (grub_memcmp (arg, "fallback", sizeof ("fallback") - 1) == 0) - { - int i; - int index = 0; - - for (i = 0; i < MAX_FALLBACK_ENTRIES; i++) - { - if (fallback_entries[i] < 0) - break; - if (fallback_entries[i] == current_entryno) - { - index = i + 1; - break; - } - } - - if (index >= MAX_FALLBACK_ENTRIES || fallback_entries[index] < 0) - { - /* This is the last. */ - errnum = ERR_BAD_ARGUMENT; - return 1; - } - - entryno = fallback_entries[index]; - } - else if (! safe_parse_maxint (&arg, &entryno)) - return 1; - } - else - entryno = current_entryno; - - /* Open the default file. */ - saved_drive = boot_drive; - saved_partition = install_partition; - if (grub_open (default_file)) - { - int len; - - disk_read_hook = disk_read_savesect_func; - len = grub_read (buf, sizeof (buf)); - disk_read_hook = 0; - grub_close (); - - if (len != sizeof (buf)) - { - /* This is too small. Do not modify the file manually, please! */ - errnum = ERR_READ; - goto fail; - } - - if (sector_count > 2) - { - /* Is this possible?! Too fragmented! */ - errnum = ERR_FSYS_CORRUPT; - goto fail; - } - - /* Set up a string to be written. */ - grub_memset (buf, '\n', sizeof (buf)); - grub_sprintf (buf, "%d", entryno); - - if (saved_lengths[0] < sizeof (buf)) - { - /* The file is anchored to another file and the first few bytes - are spanned in two sectors. Uggh... */ - if (! rawread (current_drive, saved_sectors[0], 0, SECTOR_SIZE, - sect)) - goto fail; - grub_memmove (sect + saved_offsets[0], buf, saved_lengths[0]); - if (! rawwrite (current_drive, saved_sectors[0], sect)) - goto fail; - - if (! rawread (current_drive, saved_sectors[1], 0, SECTOR_SIZE, - sect)) - goto fail; - grub_memmove (sect + saved_offsets[1], - buf + saved_lengths[0], - sizeof (buf) - saved_lengths[0]); - if (! rawwrite (current_drive, saved_sectors[1], sect)) - goto fail; - } - else - { - /* This is a simple case. It fits into a single sector. */ - if (! rawread (current_drive, saved_sectors[0], 0, SECTOR_SIZE, - sect)) - goto fail; - grub_memmove (sect + saved_offsets[0], buf, sizeof (buf)); - if (! rawwrite (current_drive, saved_sectors[0], sect)) - goto fail; - } - - /* Clear the cache. */ - buf_track = BUF_CACHE_INVALID; - } - - fail: - saved_drive = tmp_drive; - saved_partition = tmp_partition; - return errnum; -#else /* ! SUPPORT_DISKLESS && ! GRUB_UTIL */ - errnum = ERR_UNRECOGNIZED; - return 1; -#endif /* ! SUPPORT_DISKLESS && ! GRUB_UTIL */ -} - -static struct builtin builtin_savedefault = -{ - "savedefault", - savedefault_func, - BUILTIN_CMDLINE, - "savedefault [NUM | `fallback']", - "Save the current entry as the default boot entry if no argument is" - " specified. If a number is specified, this number is saved. If" - " `fallback' is used, next fallback entry is saved." -}; - - -#ifdef SUPPORT_SERIAL -/* serial */ -static int -serial_func (char *arg, int flags) -{ - unsigned short port = serial_hw_get_port (0); - unsigned int speed = 9600; - int word_len = UART_8BITS_WORD; - int parity = UART_NO_PARITY; - int stop_bit_len = UART_1_STOP_BIT; - - /* Process GNU-style long options. - FIXME: We should implement a getopt-like function, to avoid - duplications. */ - while (1) - { - if (grub_memcmp (arg, "--unit=", sizeof ("--unit=") - 1) == 0) - { - char *p = arg + sizeof ("--unit=") - 1; - int unit; - - if (! safe_parse_maxint (&p, &unit)) - return 1; - - if (unit < 0 || unit > 3) - { - errnum = ERR_DEV_VALUES; - return 1; - } - - port = serial_hw_get_port (unit); - } - else if (grub_memcmp (arg, "--speed=", sizeof ("--speed=") - 1) == 0) - { - char *p = arg + sizeof ("--speed=") - 1; - int num; - - if (! safe_parse_maxint (&p, &num)) - return 1; - - speed = (unsigned int) num; - } - else if (grub_memcmp (arg, "--port=", sizeof ("--port=") - 1) == 0) - { - char *p = arg + sizeof ("--port=") - 1; - int num; - - if (! safe_parse_maxint (&p, &num)) - return 1; - - port = (unsigned short) num; - } - else if (grub_memcmp (arg, "--word=", sizeof ("--word=") - 1) == 0) - { - char *p = arg + sizeof ("--word=") - 1; - int len; - - if (! safe_parse_maxint (&p, &len)) - return 1; - - switch (len) - { - case 5: word_len = UART_5BITS_WORD; break; - case 6: word_len = UART_6BITS_WORD; break; - case 7: word_len = UART_7BITS_WORD; break; - case 8: word_len = UART_8BITS_WORD; break; - default: - errnum = ERR_BAD_ARGUMENT; - return 1; - } - } - else if (grub_memcmp (arg, "--stop=", sizeof ("--stop=") - 1) == 0) - { - char *p = arg + sizeof ("--stop=") - 1; - int len; - - if (! safe_parse_maxint (&p, &len)) - return 1; - - switch (len) - { - case 1: stop_bit_len = UART_1_STOP_BIT; break; - case 2: stop_bit_len = UART_2_STOP_BITS; break; - default: - errnum = ERR_BAD_ARGUMENT; - return 1; - } - } - else if (grub_memcmp (arg, "--parity=", sizeof ("--parity=") - 1) == 0) - { - char *p = arg + sizeof ("--parity=") - 1; - - if (grub_memcmp (p, "no", sizeof ("no") - 1) == 0) - parity = UART_NO_PARITY; - else if (grub_memcmp (p, "odd", sizeof ("odd") - 1) == 0) - parity = UART_ODD_PARITY; - else if (grub_memcmp (p, "even", sizeof ("even") - 1) == 0) - parity = UART_EVEN_PARITY; - else - { - errnum = ERR_BAD_ARGUMENT; - return 1; - } - } -# ifdef GRUB_UTIL - /* In the grub shell, don't use any port number but open a tty - device instead. */ - else if (grub_memcmp (arg, "--device=", sizeof ("--device=") - 1) == 0) - { - char *p = arg + sizeof ("--device=") - 1; - char dev[256]; /* XXX */ - char *q = dev; - - while (*p && ! grub_isspace (*p)) - *q++ = *p++; - - *q = 0; - serial_set_device (dev); - } -# endif /* GRUB_UTIL */ - else - break; - - arg = skip_to (0, arg); - } - - /* Initialize the serial unit. */ - if (! serial_hw_init (port, speed, word_len, parity, stop_bit_len)) - { - errnum = ERR_BAD_ARGUMENT; - return 1; - } - - return 0; -} - -static struct builtin builtin_serial = -{ - "serial", - serial_func, - BUILTIN_MENU | BUILTIN_CMDLINE | BUILTIN_HELP_LIST, - "serial [--unit=UNIT] [--port=PORT] [--speed=SPEED] [--word=WORD] [--parity=PARITY] [--stop=STOP] [--device=DEV]", - "Initialize a serial device. UNIT is a digit that specifies which serial" - " device is used (e.g. 0 == COM1). If you need to specify the port number," - " set it by --port. SPEED is the DTE-DTE speed. WORD is the word length," - " PARITY is the type of parity, which is one of `no', `odd' and `even'." - " STOP is the length of stop bit(s). The option --device can be used only" - " in the grub shell, which specifies the file name of a tty device. The" - " default values are COM1, 9600, 8N1." -}; -#endif /* SUPPORT_SERIAL */ - - -/* setkey */ -struct keysym -{ - char *unshifted_name; /* the name in unshifted state */ - char *shifted_name; /* the name in shifted state */ - unsigned char unshifted_ascii; /* the ascii code in unshifted state */ - unsigned char shifted_ascii; /* the ascii code in shifted state */ - unsigned char keycode; /* keyboard scancode */ -}; - -/* The table for key symbols. If the "shifted" member of an entry is - NULL, the entry does not have shifted state. */ -static struct keysym keysym_table[] = -{ - {"escape", 0, 0x1b, 0, 0x01}, - {"1", "exclam", '1', '!', 0x02}, - {"2", "at", '2', '@', 0x03}, - {"3", "numbersign", '3', '#', 0x04}, - {"4", "dollar", '4', '$', 0x05}, - {"5", "percent", '5', '%', 0x06}, - {"6", "caret", '6', '^', 0x07}, - {"7", "ampersand", '7', '&', 0x08}, - {"8", "asterisk", '8', '*', 0x09}, - {"9", "parenleft", '9', '(', 0x0a}, - {"0", "parenright", '0', ')', 0x0b}, - {"minus", "underscore", '-', '_', 0x0c}, - {"equal", "plus", '=', '+', 0x0d}, - {"backspace", 0, '\b', 0, 0x0e}, - {"tab", 0, '\t', 0, 0x0f}, - {"q", "Q", 'q', 'Q', 0x10}, - {"w", "W", 'w', 'W', 0x11}, - {"e", "E", 'e', 'E', 0x12}, - {"r", "R", 'r', 'R', 0x13}, - {"t", "T", 't', 'T', 0x14}, - {"y", "Y", 'y', 'Y', 0x15}, - {"u", "U", 'u', 'U', 0x16}, - {"i", "I", 'i', 'I', 0x17}, - {"o", "O", 'o', 'O', 0x18}, - {"p", "P", 'p', 'P', 0x19}, - {"bracketleft", "braceleft", '[', '{', 0x1a}, - {"bracketright", "braceright", ']', '}', 0x1b}, - {"enter", 0, '\n', 0, 0x1c}, - {"control", 0, 0, 0, 0x1d}, - {"a", "A", 'a', 'A', 0x1e}, - {"s", "S", 's', 'S', 0x1f}, - {"d", "D", 'd', 'D', 0x20}, - {"f", "F", 'f', 'F', 0x21}, - {"g", "G", 'g', 'G', 0x22}, - {"h", "H", 'h', 'H', 0x23}, - {"j", "J", 'j', 'J', 0x24}, - {"k", "K", 'k', 'K', 0x25}, - {"l", "L", 'l', 'L', 0x26}, - {"semicolon", "colon", ';', ':', 0x27}, - {"quote", "doublequote", '\'', '"', 0x28}, - {"backquote", "tilde", '`', '~', 0x29}, - {"shift", 0, 0, 0, 0x2a}, - {"backslash", "bar", '\\', '|', 0x2b}, - {"z", "Z", 'z', 'Z', 0x2c}, - {"x", "X", 'x', 'X', 0x2d}, - {"c", "C", 'c', 'C', 0x2e}, - {"v", "V", 'v', 'V', 0x2f}, - {"b", "B", 'b', 'B', 0x30}, - {"n", "N", 'n', 'N', 0x31}, - {"m", "M", 'm', 'M', 0x32}, - {"comma", "less", ',', '<', 0x33}, - {"period", "greater", '.', '>', 0x34}, - {"slash", "question", '/', '?', 0x35}, - {"alt", 0, 0, 0, 0x38}, - {"space", 0, ' ', 0, 0x39}, - {"capslock", 0, 0, 0, 0x3a}, - {"F1", 0, 0, 0, 0x3b}, - {"F2", 0, 0, 0, 0x3c}, - {"F3", 0, 0, 0, 0x3d}, - {"F4", 0, 0, 0, 0x3e}, - {"F5", 0, 0, 0, 0x3f}, - {"F6", 0, 0, 0, 0x40}, - {"F7", 0, 0, 0, 0x41}, - {"F8", 0, 0, 0, 0x42}, - {"F9", 0, 0, 0, 0x43}, - {"F10", 0, 0, 0, 0x44}, - /* Caution: do not add NumLock here! we cannot deal with it properly. */ - {"delete", 0, 0x7f, 0, 0x53} -}; - -static int -setkey_func (char *arg, int flags) -{ - char *to_key, *from_key; - int to_code, from_code; - int map_in_interrupt = 0; - - static int find_key_code (char *key) - { - int i; - - for (i = 0; i < sizeof (keysym_table) / sizeof (keysym_table[0]); i++) - { - if (keysym_table[i].unshifted_name && - grub_strcmp (key, keysym_table[i].unshifted_name) == 0) - return keysym_table[i].keycode; - else if (keysym_table[i].shifted_name && - grub_strcmp (key, keysym_table[i].shifted_name) == 0) - return keysym_table[i].keycode; - } - - return 0; - } - - static int find_ascii_code (char *key) - { - int i; - - for (i = 0; i < sizeof (keysym_table) / sizeof (keysym_table[0]); i++) - { - if (keysym_table[i].unshifted_name && - grub_strcmp (key, keysym_table[i].unshifted_name) == 0) - return keysym_table[i].unshifted_ascii; - else if (keysym_table[i].shifted_name && - grub_strcmp (key, keysym_table[i].shifted_name) == 0) - return keysym_table[i].shifted_ascii; - } - - return 0; - } - - to_key = arg; - from_key = skip_to (0, to_key); - - if (! *to_key) - { - /* If the user specifies no argument, reset the key mappings. */ - grub_memset (bios_key_map, 0, KEY_MAP_SIZE * sizeof (unsigned short)); - grub_memset (ascii_key_map, 0, KEY_MAP_SIZE * sizeof (unsigned short)); - - return 0; - } - else if (! *from_key) - { - /* The user must specify two arguments or zero argument. */ - errnum = ERR_BAD_ARGUMENT; - return 1; - } - - nul_terminate (to_key); - nul_terminate (from_key); - - to_code = find_ascii_code (to_key); - from_code = find_ascii_code (from_key); - if (! to_code || ! from_code) - { - map_in_interrupt = 1; - to_code = find_key_code (to_key); - from_code = find_key_code (from_key); - if (! to_code || ! from_code) - { - errnum = ERR_BAD_ARGUMENT; - return 1; - } - } - - if (map_in_interrupt) - { - int i; - - /* Find an empty slot. */ - for (i = 0; i < KEY_MAP_SIZE; i++) - { - if ((bios_key_map[i] & 0xff) == from_code) - /* Perhaps the user wants to overwrite the map. */ - break; - - if (! bios_key_map[i]) - break; - } - - if (i == KEY_MAP_SIZE) - { - errnum = ERR_WONT_FIT; - return 1; - } - - if (to_code == from_code) - /* If TO is equal to FROM, delete the entry. */ - grub_memmove ((char *) &bios_key_map[i], - (char *) &bios_key_map[i + 1], - sizeof (unsigned short) * (KEY_MAP_SIZE - i)); - else - bios_key_map[i] = (to_code << 8) | from_code; - - /* Ugly but should work. */ - unset_int15_handler (); - set_int15_handler (); - } - else - { - int i; - - /* Find an empty slot. */ - for (i = 0; i < KEY_MAP_SIZE; i++) - { - if ((ascii_key_map[i] & 0xff) == from_code) - /* Perhaps the user wants to overwrite the map. */ - break; - - if (! ascii_key_map[i]) - break; - } - - if (i == KEY_MAP_SIZE) - { - errnum = ERR_WONT_FIT; - return 1; - } - - if (to_code == from_code) - /* If TO is equal to FROM, delete the entry. */ - grub_memmove ((char *) &ascii_key_map[i], - (char *) &ascii_key_map[i + 1], - sizeof (unsigned short) * (KEY_MAP_SIZE - i)); - else - ascii_key_map[i] = (to_code << 8) | from_code; - } - - return 0; -} - -static struct builtin builtin_setkey = -{ - "setkey", - setkey_func, - BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_HELP_LIST, - "setkey [TO_KEY FROM_KEY]", - "Change the keyboard map. The key FROM_KEY is mapped to the key TO_KEY." - " A key must be an alphabet, a digit, or one of these: escape, exclam," - " at, numbersign, dollar, percent, caret, ampersand, asterisk, parenleft," - " parenright, minus, underscore, equal, plus, backspace, tab, bracketleft," - " braceleft, bracketright, braceright, enter, control, semicolon, colon," - " quote, doublequote, backquote, tilde, shift, backslash, bar, comma," - " less, period, greater, slash, question, alt, space, capslock, FX (X" - " is a digit), and delete. If no argument is specified, reset key" - " mappings." -}; - - -/* setup */ -static int -setup_func (char *arg, int flags) -{ - /* Point to the string of the installed drive/partition. */ - char *install_ptr; - /* Point to the string of the drive/parition where the GRUB images - reside. */ - char *image_ptr; - unsigned long installed_drive, installed_partition; - unsigned long image_drive, image_partition; - unsigned long tmp_drive, tmp_partition; - char stage1[64]; - char stage2[64]; - char config_filename[64]; - char real_config_filename[64]; - char cmd_arg[256]; - char device[16]; - char *buffer = (char *) RAW_ADDR (0x100000); - int is_force_lba = 0; - char *stage2_arg = 0; - char *prefix = 0; - - auto int check_file (char *file); - auto void sprint_device (int drive, int partition); - auto int embed_stage1_5 (char * stage1_5, int drive, int partition); - - /* Check if the file FILE exists like Autoconf. */ - int check_file (char *file) - { - int ret; - - grub_printf (" Checking if \"%s\" exists... ", file); - ret = grub_open (file); - if (ret) - { - grub_close (); - grub_printf ("yes\n"); - } - else - grub_printf ("no\n"); - - return ret; - } - - /* Construct a device name in DEVICE. */ - void sprint_device (int drive, int partition) - { - grub_sprintf (device, "(%cd%d", - (drive & 0x80) ? 'h' : 'f', - drive & ~0x80); - if ((partition & 0xFF0000) != 0xFF0000) - { - char tmp[16]; - grub_sprintf (tmp, ",%d", (partition >> 16) & 0xFF); - grub_strncat (device, tmp, 256); - } - if ((partition & 0x00FF00) != 0x00FF00) - { - char tmp[16]; - grub_sprintf (tmp, ",%c", 'a' + ((partition >> 8) & 0xFF)); - grub_strncat (device, tmp, 256); - } - grub_strncat (device, ")", 256); - } - - int embed_stage1_5 (char *stage1_5, int drive, int partition) - { - /* We install GRUB into the MBR, so try to embed the - Stage 1.5 in the sectors right after the MBR. */ - sprint_device (drive, partition); - grub_sprintf (cmd_arg, "%s %s", stage1_5, device); - - /* Notify what will be run. */ - grub_printf (" Running \"embed %s\"... ", cmd_arg); - - embed_func (cmd_arg, flags); - if (! errnum) - { - /* Construct the blocklist representation. */ - grub_sprintf (buffer, "%s%s", device, embed_info); - grub_printf ("succeeded\n"); - return 1; - } - else - { - grub_printf ("failed (this is not fatal)\n"); - return 0; - } - } - - struct stage1_5_map { - char *fsys; - char *name; - }; - struct stage1_5_map stage1_5_map[] = - { - {"ext2fs", "/e2fs_stage1_5"}, - {"fat", "/fat_stage1_5"}, - {"ufs2", "/ufs2_stage1_5"}, - {"ffs", "/ffs_stage1_5"}, - {"iso9660", "/iso9660_stage1_5"}, - {"jfs", "/jfs_stage1_5"}, - {"minix", "/minix_stage1_5"}, - {"reiserfs", "/reiserfs_stage1_5"}, - {"vstafs", "/vstafs_stage1_5"}, - {"xfs", "/xfs_stage1_5"}, - {"ufs", "/ufs_stage1_5"} - }; - - tmp_drive = saved_drive; - tmp_partition = saved_partition; - - /* Check if the user specifies --force-lba. */ - while (1) - { - if (grub_memcmp ("--force-lba", arg, sizeof ("--force-lba") - 1) == 0) - { - is_force_lba = 1; - arg = skip_to (0, arg); - } - else if (grub_memcmp ("--prefix=", arg, sizeof ("--prefix=") - 1) == 0) - { - prefix = arg + sizeof ("--prefix=") - 1; - arg = skip_to (0, arg); - nul_terminate (prefix); - } -#ifdef GRUB_UTIL - else if (grub_memcmp ("--stage2=", arg, sizeof ("--stage2=") - 1) == 0) - { - stage2_arg = arg; - arg = skip_to (0, arg); - nul_terminate (stage2_arg); - } -#endif /* GRUB_UTIL */ - else - break; - } - - install_ptr = arg; - image_ptr = skip_to (0, install_ptr); - - /* Make sure that INSTALL_PTR is valid. */ - set_device (install_ptr); - if (errnum) - return 1; - - installed_drive = current_drive; - installed_partition = current_partition; - - /* Mount the drive pointed by IMAGE_PTR. */ - if (*image_ptr) - { - /* If the drive/partition where the images reside is specified, - get the drive and the partition. */ - set_device (image_ptr); - if (errnum) - return 1; - } - else - { - /* If omitted, use SAVED_PARTITION and SAVED_DRIVE. */ - current_drive = saved_drive; - current_partition = saved_partition; - } - - image_drive = saved_drive = current_drive; - image_partition = saved_partition = current_partition; - - /* Open it. */ - if (! open_device ()) - goto fail; - - /* Check if stage1 exists. If the user doesn't specify the option - `--prefix', attempt /boot/grub and /grub. */ - /* NOTE: It is dangerous to run this command without `--prefix' in the - grub shell, since that affects `--stage2'. */ - if (! prefix) - { - prefix = "/boot/grub"; - grub_sprintf (stage1, "%s%s", prefix, "/stage1"); - if (! check_file (stage1)) - { - errnum = ERR_NONE; - prefix = "/grub"; - grub_sprintf (stage1, "%s%s", prefix, "/stage1"); - if (! check_file (stage1)) - goto fail; - } - } - else - { - grub_sprintf (stage1, "%s%s", prefix, "/stage1"); - if (! check_file (stage1)) - goto fail; - } - - /* The prefix was determined. */ - grub_sprintf (stage2, "%s%s", prefix, "/stage2"); - grub_sprintf (config_filename, "%s%s", prefix, "/menu.lst"); - *real_config_filename = 0; - - /* Check if stage2 exists. */ - if (! check_file (stage2)) - goto fail; - - { - char *fsys = fsys_table[fsys_type].name; - int i; - int size = sizeof (stage1_5_map) / sizeof (stage1_5_map[0]); - - /* Iterate finding the same filesystem name as FSYS. */ - for (i = 0; i < size; i++) - if (grub_strcmp (fsys, stage1_5_map[i].fsys) == 0) - { - /* OK, check if the Stage 1.5 exists. */ - char stage1_5[64]; - - grub_sprintf (stage1_5, "%s%s", prefix, stage1_5_map[i].name); - if (check_file (stage1_5)) - { - if (embed_stage1_5 (stage1_5, - installed_drive, installed_partition) - || embed_stage1_5 (stage1_5, - image_drive, image_partition)) - { - grub_strcpy (real_config_filename, config_filename); - sprint_device (image_drive, image_partition); - grub_sprintf (config_filename, "%s%s", device, stage2); - grub_strcpy (stage2, buffer); - } - } - errnum = 0; - break; - } - } - - /* Construct a string that is used by the command "install" as its - arguments. */ - sprint_device (installed_drive, installed_partition); - -#if 1 - /* Don't embed a drive number unnecessarily. */ - grub_sprintf (cmd_arg, "%s%s%s%s %s%s %s p %s %s", - is_force_lba? "--force-lba " : "", - stage2_arg? stage2_arg : "", - stage2_arg? " " : "", - stage1, - (installed_drive != image_drive) ? "d " : "", - device, - stage2, - config_filename, - real_config_filename); -#else /* NOT USED */ - /* This code was used, because we belived some BIOSes had a problem - that they didn't pass a booting drive correctly. It turned out, - however, stage1 could trash a booting drive when checking LBA support, - because some BIOSes modified the register %dx in INT 13H, AH=48H. - So it becamed unclear whether GRUB should use a pre-defined booting - drive or not. If the problem still exists, it would be necessary to - switch back to this code. */ - grub_sprintf (cmd_arg, "%s%s%s%s d %s %s p %s %s", - is_force_lba? "--force-lba " : "", - stage2_arg? stage2_arg : "", - stage2_arg? " " : "", - stage1, - device, - stage2, - config_filename, - real_config_filename); -#endif /* NOT USED */ - - /* Notify what will be run. */ - grub_printf (" Running \"install %s\"... ", cmd_arg); - - /* Make sure that SAVED_DRIVE and SAVED_PARTITION are identical - with IMAGE_DRIVE and IMAGE_PARTITION, respectively. */ - saved_drive = image_drive; - saved_partition = image_partition; - - /* Run the command. */ - if (! install_func (cmd_arg, flags)) - grub_printf ("succeeded\nDone.\n"); - else - grub_printf ("failed\n"); - - fail: - saved_drive = tmp_drive; - saved_partition = tmp_partition; - return errnum; -} - -static struct builtin builtin_setup = -{ - "setup", - setup_func, - BUILTIN_CMDLINE | BUILTIN_HELP_LIST, - "setup [--prefix=DIR] [--stage2=STAGE2_FILE] [--force-lba] INSTALL_DEVICE [IMAGE_DEVICE]", - "Set up the installation of GRUB automatically. This command uses" - " the more flexible command \"install\" in the backend and installs" - " GRUB into the device INSTALL_DEVICE. If IMAGE_DEVICE is specified," - " then find the GRUB images in the device IMAGE_DEVICE, otherwise" - " use the current \"root device\", which can be set by the command" - " \"root\". If you know that your BIOS should support LBA but GRUB" - " doesn't work in LBA mode, specify the option `--force-lba'." - " If you install GRUB under the grub shell and you cannot unmount the" - " partition where GRUB images reside, specify the option `--stage2'" - " to tell GRUB the file name under your OS." -}; - - -#if defined(SUPPORT_SERIAL) || defined(SUPPORT_HERCULES) || defined(SUPPORT_GRAPHICS) -/* terminal */ -static int -terminal_func (char *arg, int flags) -{ - /* The index of the default terminal in TERM_TABLE. */ - int default_term = -1; - struct term_entry *prev_term = current_term; - int to = -1; - int lines = 0; - int no_message = 0; - unsigned long term_flags = 0; - /* XXX: Assume less than 32 terminals. */ - unsigned long term_bitmap = 0; - - /* Get GNU-style long options. */ - while (1) - { - if (grub_memcmp (arg, "--dumb", sizeof ("--dumb") - 1) == 0) - term_flags |= TERM_DUMB; - else if (grub_memcmp (arg, "--no-echo", sizeof ("--no-echo") - 1) == 0) - /* ``--no-echo'' implies ``--no-edit''. */ - term_flags |= (TERM_NO_ECHO | TERM_NO_EDIT); - else if (grub_memcmp (arg, "--no-edit", sizeof ("--no-edit") - 1) == 0) - term_flags |= TERM_NO_EDIT; - else if (grub_memcmp (arg, "--timeout=", sizeof ("--timeout=") - 1) == 0) - { - char *val = arg + sizeof ("--timeout=") - 1; - - if (! safe_parse_maxint (&val, &to)) - return 1; - } - else if (grub_memcmp (arg, "--lines=", sizeof ("--lines=") - 1) == 0) - { - char *val = arg + sizeof ("--lines=") - 1; - - if (! safe_parse_maxint (&val, &lines)) - return 1; - - /* Probably less than four is meaningless.... */ - if (lines < 4) - { - errnum = ERR_BAD_ARGUMENT; - return 1; - } - } - else if (grub_memcmp (arg, "--silent", sizeof ("--silent") - 1) == 0) - no_message = 1; - else - break; - - arg = skip_to (0, arg); - } - - /* If no argument is specified, show current setting. */ - if (! *arg) - { - grub_printf ("%s%s%s%s\n", - current_term->name, - current_term->flags & TERM_DUMB ? " (dumb)" : "", - current_term->flags & TERM_NO_EDIT ? " (no edit)" : "", - current_term->flags & TERM_NO_ECHO ? " (no echo)" : ""); - return 0; - } - - while (*arg) - { - int i; - char *next = skip_to (0, arg); - - nul_terminate (arg); - - for (i = 0; term_table[i].name; i++) - { - if (grub_strcmp (arg, term_table[i].name) == 0) - { - if (term_table[i].flags & TERM_NEED_INIT) - { - errnum = ERR_DEV_NEED_INIT; - return 1; - } - - if (default_term < 0) - default_term = i; - - term_bitmap |= (1 << i); - break; - } - } - - if (! term_table[i].name) - { - errnum = ERR_BAD_ARGUMENT; - return 1; - } - - arg = next; - } - - /* If multiple terminals are specified, wait until the user pushes any - key on one of the terminals. */ - if (term_bitmap & ~(1 << default_term)) - { - int time1, time2 = -1; - - /* XXX: Disable the pager. */ - count_lines = -1; - - /* Get current time. */ - while ((time1 = getrtsecs ()) == 0xFF) - ; - - /* Wait for a key input. */ - while (to) - { - int i; - - for (i = 0; term_table[i].name; i++) - { - if (term_bitmap & (1 << i)) - { - if (term_table[i].checkkey () >= 0) - { - (void) term_table[i].getkey (); - default_term = i; - - goto end; - } - } - } - - /* Prompt the user, once per sec. */ - if ((time1 = getrtsecs ()) != time2 && time1 != 0xFF) - { - if (! no_message) - { - /* Need to set CURRENT_TERM to each of selected - terminals. */ - for (i = 0; term_table[i].name; i++) - if (term_bitmap & (1 << i)) - { - current_term = term_table + i; - grub_printf ("\rPress any key to continue.\n"); - } - - /* Restore CURRENT_TERM. */ - current_term = prev_term; - } - - time2 = time1; - if (to > 0) - to--; - } - } - } - - end: - current_term = term_table + default_term; - current_term->flags = term_flags; - - if (lines) - max_lines = lines; - else - max_lines = current_term->max_lines; - - /* If the interface is currently the command-line, - restart it to repaint the screen. */ - if ((current_term != prev_term) && (flags & BUILTIN_CMDLINE)){ - if (prev_term->shutdown) - prev_term->shutdown(); - if (current_term->startup) - current_term->startup(); - grub_longjmp (restart_cmdline_env, 0); - } - - return 0; -} - -static struct builtin builtin_terminal = -{ - "terminal", - terminal_func, - BUILTIN_MENU | BUILTIN_CMDLINE | BUILTIN_HELP_LIST, - "terminal [--dumb] [--no-echo] [--no-edit] [--timeout=SECS] [--lines=LINES] [--silent] [console] [serial] [hercules] [graphics]", - "Select a terminal. When multiple terminals are specified, wait until" - " you push any key to continue. If both console and serial are specified," - " the terminal to which you input a key first will be selected. If no" - " argument is specified, print current setting. The option --dumb" - " specifies that your terminal is dumb, otherwise, vt100-compatibility" - " is assumed. If you specify --no-echo, input characters won't be echoed." - " If you specify --no-edit, the BASH-like editing feature will be disabled." - " If --timeout is present, this command will wait at most for SECS" - " seconds. The option --lines specifies the maximum number of lines." - " The option --silent is used to suppress messages." -}; -#endif /* SUPPORT_SERIAL || SUPPORT_HERCULES || SUPPORT_GRAPHICS */ - - -#ifdef SUPPORT_SERIAL -static int -terminfo_func (char *arg, int flags) -{ - struct terminfo term; - - if (*arg) - { - struct - { - const char *name; - char *var; - } - options[] = - { - {"--name=", term.name}, - {"--cursor-address=", term.cursor_address}, - {"--clear-screen=", term.clear_screen}, - {"--enter-standout-mode=", term.enter_standout_mode}, - {"--exit-standout-mode=", term.exit_standout_mode} - }; - - grub_memset (&term, 0, sizeof (term)); - - while (*arg) - { - int i; - char *next = skip_to (0, arg); - - nul_terminate (arg); - - for (i = 0; i < sizeof (options) / sizeof (options[0]); i++) - { - const char *name = options[i].name; - int len = grub_strlen (name); - - if (! grub_memcmp (arg, name, len)) - { - grub_strcpy (options[i].var, ti_unescape_string (arg + len)); - break; - } - } - - if (i == sizeof (options) / sizeof (options[0])) - { - errnum = ERR_BAD_ARGUMENT; - return errnum; - } - - arg = next; - } - - if (term.name[0] == 0 || term.cursor_address[0] == 0) - { - errnum = ERR_BAD_ARGUMENT; - return errnum; - } - - ti_set_term (&term); - } - else - { - /* No option specifies printing out current settings. */ - ti_get_term (&term); - - grub_printf ("name=%s\n", - ti_escape_string (term.name)); - grub_printf ("cursor_address=%s\n", - ti_escape_string (term.cursor_address)); - grub_printf ("clear_screen=%s\n", - ti_escape_string (term.clear_screen)); - grub_printf ("enter_standout_mode=%s\n", - ti_escape_string (term.enter_standout_mode)); - grub_printf ("exit_standout_mode=%s\n", - ti_escape_string (term.exit_standout_mode)); - } - - return 0; -} - -static struct builtin builtin_terminfo = -{ - "terminfo", - terminfo_func, - BUILTIN_MENU | BUILTIN_CMDLINE | BUILTIN_HELP_LIST, - "terminfo [--name=NAME --cursor-address=SEQ [--clear-screen=SEQ]" - " [--enter-standout-mode=SEQ] [--exit-standout-mode=SEQ]]", - - "Define the capabilities of your terminal. Use this command to" - " define escape sequences, if it is not vt100-compatible." - " You may use \\e for ESC and ^X for a control character." - " If no option is specified, the current settings are printed." -}; -#endif /* SUPPORT_SERIAL */ - - -/* testload */ -static int -testload_func (char *arg, int flags) -{ - int i; - - kernel_type = KERNEL_TYPE_NONE; - - if (! grub_open (arg)) - return 1; - - disk_read_hook = disk_read_print_func; - - /* Perform filesystem test on the specified file. */ - /* Read whole file first. */ - grub_printf ("Whole file: "); - - grub_read ((char *) RAW_ADDR (0x100000), -1); - - /* Now compare two sections of the file read differently. */ - - for (i = 0; i < 0x10ac0; i++) - { - *((unsigned char *) RAW_ADDR (0x200000 + i)) = 0; - *((unsigned char *) RAW_ADDR (0x300000 + i)) = 1; - } - - /* First partial read. */ - grub_printf ("\nPartial read 1: "); - - grub_seek (0); - grub_read ((char *) RAW_ADDR (0x200000), 0x7); - grub_read ((char *) RAW_ADDR (0x200007), 0x100); - grub_read ((char *) RAW_ADDR (0x200107), 0x10); - grub_read ((char *) RAW_ADDR (0x200117), 0x999); - grub_read ((char *) RAW_ADDR (0x200ab0), 0x10); - grub_read ((char *) RAW_ADDR (0x200ac0), 0x10000); - - /* Second partial read. */ - grub_printf ("\nPartial read 2: "); - - grub_seek (0); - grub_read ((char *) RAW_ADDR (0x300000), 0x10000); - grub_read ((char *) RAW_ADDR (0x310000), 0x10); - grub_read ((char *) RAW_ADDR (0x310010), 0x7); - grub_read ((char *) RAW_ADDR (0x310017), 0x10); - grub_read ((char *) RAW_ADDR (0x310027), 0x999); - grub_read ((char *) RAW_ADDR (0x3109c0), 0x100); - - grub_printf ("\nHeader1 = 0x%x, next = 0x%x, next = 0x%x, next = 0x%x\n", - *((int *) RAW_ADDR (0x200000)), - *((int *) RAW_ADDR (0x200004)), - *((int *) RAW_ADDR (0x200008)), - *((int *) RAW_ADDR (0x20000c))); - - grub_printf ("Header2 = 0x%x, next = 0x%x, next = 0x%x, next = 0x%x\n", - *((int *) RAW_ADDR (0x300000)), - *((int *) RAW_ADDR (0x300004)), - *((int *) RAW_ADDR (0x300008)), - *((int *) RAW_ADDR (0x30000c))); - - for (i = 0; i < 0x10ac0; i++) - if (*((unsigned char *) RAW_ADDR (0x200000 + i)) - != *((unsigned char *) RAW_ADDR (0x300000 + i))) - break; - - grub_printf ("Max is 0x10ac0: i=0x%x, filepos=0x%x\n", i, filepos); - disk_read_hook = 0; - grub_close (); - return 0; -} - -static struct builtin builtin_testload = -{ - "testload", - testload_func, - BUILTIN_CMDLINE, - "testload FILE", - "Read the entire contents of FILE in several different ways and" - " compares them, to test the filesystem code. The output is somewhat" - " cryptic, but if no errors are reported and the final `i=X," - " filepos=Y' reading has X and Y equal, then it is definitely" - " consistent, and very likely works correctly subject to a" - " consistent offset error. If this test succeeds, then a good next" - " step is to try loading a kernel." -}; - - -/* testvbe MODE */ -static int -testvbe_func (char *arg, int flags) -{ - int mode_number; - struct vbe_controller controller; - struct vbe_mode mode; - - if (! *arg) - { - errnum = ERR_BAD_ARGUMENT; - return 1; - } - - if (! safe_parse_maxint (&arg, &mode_number)) - return 1; - - /* Preset `VBE2'. */ - grub_memmove (controller.signature, "VBE2", 4); - - /* Detect VBE BIOS. */ - if (get_vbe_controller_info (&controller) != 0x004F) - { - grub_printf (" VBE BIOS is not present.\n"); - return 0; - } - - if (controller.version < 0x0200) - { - grub_printf (" VBE version %d.%d is not supported.\n", - (int) (controller.version >> 8), - (int) (controller.version & 0xFF)); - return 0; - } - - if (get_vbe_mode_info (mode_number, &mode) != 0x004F - || (mode.mode_attributes & 0x0091) != 0x0091) - { - grub_printf (" Mode 0x%x is not supported.\n", mode_number); - return 0; - } - - /* Now trip to the graphics mode. */ - if (set_vbe_mode (mode_number | (1 << 14)) != 0x004F) - { - grub_printf (" Switching to Mode 0x%x failed.\n", mode_number); - return 0; - } - - /* Draw something on the screen... */ - { - unsigned char *base_buf = (unsigned char *) mode.phys_base; - int scanline = controller.version >= 0x0300 - ? mode.linear_bytes_per_scanline : mode.bytes_per_scanline; - /* FIXME: this assumes that any depth is a modulo of 8. */ - int bpp = mode.bits_per_pixel / 8; - int width = mode.x_resolution; - int height = mode.y_resolution; - int x, y; - unsigned color = 0; - - /* Iterate drawing on the screen, until the user hits any key. */ - while (checkkey () == -1) - { - for (y = 0; y < height; y++) - { - unsigned char *line_buf = base_buf + scanline * y; - - for (x = 0; x < width; x++) - { - unsigned char *buf = line_buf + bpp * x; - int i; - - for (i = 0; i < bpp; i++, buf++) - *buf = (color >> (i * 8)) & 0xff; - } - - color++; - } - } - - /* Discard the input. */ - getkey (); - } - - /* Back to the default text mode. */ - if (set_vbe_mode (0x03) != 0x004F) - { - /* Why?! */ - grub_reboot (); - } - - return 0; -} - -static struct builtin builtin_testvbe = -{ - "testvbe", - testvbe_func, - BUILTIN_CMDLINE | BUILTIN_HELP_LIST, - "testvbe MODE", - "Test the VBE mode MODE. Hit any key to return." -}; - - -#ifdef SUPPORT_NETBOOT -/* tftpserver */ -static int -tftpserver_func (char *arg, int flags) -{ - if (! *arg || ! ifconfig (0, 0, 0, arg)) - { - errnum = ERR_BAD_ARGUMENT; - return 1; - } - - print_network_configuration (); - return 0; -} - -static struct builtin builtin_tftpserver = -{ - "tftpserver", - tftpserver_func, - BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_HELP_LIST, - "tftpserver IPADDR", - "Override the TFTP server address." -}; -#endif /* SUPPORT_NETBOOT */ - - -/* timeout */ -static int -timeout_func (char *arg, int flags) -{ - if (! safe_parse_maxint (&arg, &grub_timeout)) - return 1; - - return 0; -} - -static struct builtin builtin_timeout = -{ - "timeout", - timeout_func, - BUILTIN_MENU, -#if 0 - "timeout SEC", - "Set a timeout, in SEC seconds, before automatically booting the" - " default entry (normally the first entry defined)." -#endif -}; - - -/* title */ -static int -title_func (char *arg, int flags) -{ - /* This function is not actually used at least currently. */ - return 0; -} - -static struct builtin builtin_title = -{ - "title", - title_func, - BUILTIN_TITLE, -#if 0 - "title [NAME ...]", - "Start a new boot entry, and set its name to the contents of the" - " rest of the line, starting with the first non-space character." -#endif -}; - - -/* unhide */ -static int -unhide_func (char *arg, int flags) -{ - if (! set_device (arg)) - return 1; - - if (! set_partition_hidden_flag (0)) - return 1; - - return 0; -} - -static struct builtin builtin_unhide = -{ - "unhide", - unhide_func, - BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_HELP_LIST, - "unhide PARTITION", - "Unhide PARTITION by clearing the \"hidden\" bit in its" - " partition type code." -}; - - -/* uppermem */ -static int -uppermem_func (char *arg, int flags) -{ - if (! safe_parse_maxint (&arg, (int *) &mbi.mem_upper)) - return 1; - - mbi.flags &= ~MB_INFO_MEM_MAP; - return 0; -} - -static struct builtin builtin_uppermem = -{ - "uppermem", - uppermem_func, - BUILTIN_CMDLINE | BUILTIN_HELP_LIST, - "uppermem KBYTES", - "Force GRUB to assume that only KBYTES kilobytes of upper memory are" - " installed. Any system address range maps are discarded." -}; - - -/* vbeprobe */ -static int -vbeprobe_func (char *arg, int flags) -{ - struct vbe_controller controller; - unsigned short *mode_list; - int mode_number = -1; - - auto unsigned long vbe_far_ptr_to_linear (unsigned long); - - unsigned long vbe_far_ptr_to_linear (unsigned long ptr) - { - unsigned short seg = (ptr >> 16); - unsigned short off = (ptr & 0xFFFF); - - return (seg << 4) + off; - } - - if (*arg) - { - if (! safe_parse_maxint (&arg, &mode_number)) - return 1; - } - - /* Set the signature to `VBE2', to obtain VBE 3.0 information. */ - grub_memmove (controller.signature, "VBE2", 4); - - if (get_vbe_controller_info (&controller) != 0x004F) - { - grub_printf (" VBE BIOS is not present.\n"); - return 0; - } - - /* Check the version. */ - if (controller.version < 0x0200) - { - grub_printf (" VBE version %d.%d is not supported.\n", - (int) (controller.version >> 8), - (int) (controller.version & 0xFF)); - return 0; - } - - /* Print some information. */ - grub_printf (" VBE version %d.%d\n", - (int) (controller.version >> 8), - (int) (controller.version & 0xFF)); - - /* Iterate probing modes. */ - for (mode_list - = (unsigned short *) vbe_far_ptr_to_linear (controller.video_mode); - *mode_list != 0xFFFF; - mode_list++) - { - struct vbe_mode mode; - - if (get_vbe_mode_info (*mode_list, &mode) != 0x004F) - continue; - - /* Skip this, if this is not supported or linear frame buffer - mode is not support. */ - if ((mode.mode_attributes & 0x0081) != 0x0081) - continue; - - if (mode_number == -1 || mode_number == *mode_list) - { - char *model; - switch (mode.memory_model) - { - case 0x00: model = "Text"; break; - case 0x01: model = "CGA graphics"; break; - case 0x02: model = "Hercules graphics"; break; - case 0x03: model = "Planar"; break; - case 0x04: model = "Packed pixel"; break; - case 0x05: model = "Non-chain 4, 256 color"; break; - case 0x06: model = "Direct Color"; break; - case 0x07: model = "YUV"; break; - default: model = "Unknown"; break; - } - - grub_printf (" 0x%x: %s, %ux%ux%u\n", - (unsigned) *mode_list, - model, - (unsigned) mode.x_resolution, - (unsigned) mode.y_resolution, - (unsigned) mode.bits_per_pixel); - - if (mode_number != -1) - break; - } - } - - if (mode_number != -1 && mode_number != *mode_list) - grub_printf (" Mode 0x%x is not found or supported.\n", mode_number); - - return 0; -} - -static struct builtin builtin_vbeprobe = -{ - "vbeprobe", - vbeprobe_func, - BUILTIN_CMDLINE | BUILTIN_HELP_LIST, - "vbeprobe [MODE]", - "Probe VBE information. If the mode number MODE is specified, show only" - " the information about only the mode." -}; - - -/* The table of builtin commands. Sorted in dictionary order. */ -struct builtin *builtin_table[] = -{ -#ifdef SUPPORT_GRAPHICS - &builtin_background, -#endif - &builtin_blocklist, - &builtin_boot, - &builtin_bootfs, -#ifdef SUPPORT_NETBOOT - &builtin_bootp, -#endif /* SUPPORT_NETBOOT */ - &builtin_cat, - &builtin_chainloader, - &builtin_clear, - &builtin_cmp, - &builtin_color, - &builtin_configfile, - &builtin_debug, - &builtin_default, -#ifdef GRUB_UTIL - &builtin_device, -#endif /* GRUB_UTIL */ -#ifdef SUPPORT_NETBOOT - &builtin_dhcp, -#endif /* SUPPORT_NETBOOT */ - &builtin_displayapm, - &builtin_displaymem, -#ifdef GRUB_UTIL - &builtin_dump, -#endif /* GRUB_UTIL */ - &builtin_embed, - &builtin_fallback, - &builtin_find, - &builtin_findroot, -#ifdef SUPPORT_GRAPHICS - &builtin_foreground, -#endif - &builtin_fstest, - &builtin_geometry, - &builtin_halt, - &builtin_help, - &builtin_hiddenmenu, - &builtin_hide, -#ifdef SUPPORT_NETBOOT - &builtin_ifconfig, -#endif /* SUPPORT_NETBOOT */ - &builtin_impsprobe, - &builtin_initrd, - &builtin_install, - &builtin_ioprobe, - &builtin_kernel, - &builtin_kernel_dollar, - &builtin_lock, - &builtin_makeactive, - &builtin_map, -#ifdef USE_MD5_PASSWORDS - &builtin_md5crypt, -#endif /* USE_MD5_PASSWORDS */ - &builtin_min_mem64, - &builtin_module, - &builtin_module_dollar, - &builtin_modulenounzip, - &builtin_pager, - &builtin_partnew, - &builtin_parttype, - &builtin_password, - &builtin_pause, -#if defined(RPC_DEBUG) && defined(SUPPORT_NETBOOT) - &builtin_portmap, -#endif /* RPC_DEBUG && SUPPORT_NETBOOT */ -#ifdef GRUB_UTIL - &builtin_quit, -#endif /* GRUB_UTIL */ -#ifdef SUPPORT_NETBOOT - &builtin_rarp, -#endif /* SUPPORT_NETBOOT */ - &builtin_read, - &builtin_reboot, - &builtin_root, - &builtin_rootnoverify, - &builtin_savedefault, -#ifdef SUPPORT_SERIAL - &builtin_serial, -#endif /* SUPPORT_SERIAL */ - &builtin_setkey, - &builtin_setup, -#ifdef SUPPORT_GRAPHICS - &builtin_splashimage, -#endif /* SUPPORT_GRAPHICS */ -#if defined(SUPPORT_SERIAL) || defined(SUPPORT_HERCULES) || defined(SUPPORT_GRAPHICS) - &builtin_terminal, -#endif /* SUPPORT_SERIAL || SUPPORT_HERCULES || SUPPORT_GRAPHICS */ -#ifdef SUPPORT_SERIAL - &builtin_terminfo, -#endif /* SUPPORT_SERIAL */ - &builtin_testload, - &builtin_testvbe, -#ifdef SUPPORT_NETBOOT - &builtin_tftpserver, -#endif /* SUPPORT_NETBOOT */ - &builtin_timeout, - &builtin_title, - &builtin_unhide, - &builtin_uppermem, - &builtin_vbeprobe, - &builtin_verbose, - 0 -}; diff --git a/usr/src/grub/grub-0.95/stage2/char_io.c b/usr/src/grub/grub-0.95/stage2/char_io.c deleted file mode 100644 index df52b3c72a..0000000000 --- a/usr/src/grub/grub-0.95/stage2/char_io.c +++ /dev/null @@ -1,1413 +0,0 @@ -/* char_io.c - basic console input and output */ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 1999,2000,2001,2002,2004 Free Software Foundation, 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 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. - */ -/* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ -#pragma ident "%Z%%M% %I% %E% SMI" - -#include -#include - -#ifdef SUPPORT_HERCULES -# include -#endif - -#ifdef SUPPORT_SERIAL -# include -#endif - -#ifndef STAGE1_5 -struct term_entry term_table[] = - { - { - "console", - 0, - 24, - console_putchar, - console_checkkey, - console_getkey, - console_getxy, - console_gotoxy, - console_cls, - console_setcolorstate, - console_setcolor, - console_setcursor, - 0, - 0 - }, -#ifdef SUPPORT_SERIAL - { - "serial", - /* A serial device must be initialized. */ - TERM_NEED_INIT, - 24, - serial_putchar, - serial_checkkey, - serial_getkey, - serial_getxy, - serial_gotoxy, - serial_cls, - serial_setcolorstate, - 0, - 0, - 0, - 0 - }, -#endif /* SUPPORT_SERIAL */ -#ifdef SUPPORT_HERCULES - { - "hercules", - 0, - 24, - hercules_putchar, - console_checkkey, - console_getkey, - hercules_getxy, - hercules_gotoxy, - hercules_cls, - hercules_setcolorstate, - hercules_setcolor, - hercules_setcursor, - 0, - 0 - }, -#endif /* SUPPORT_HERCULES */ -#ifdef SUPPORT_GRAPHICS - { "graphics", - TERM_NEED_INIT, /* flags */ - 30, /* number of lines */ - graphics_putchar, /* putchar */ - console_checkkey, /* checkkey */ - console_getkey, /* getkey */ - graphics_getxy, /* getxy */ - graphics_gotoxy, /* gotoxy */ - graphics_cls, /* cls */ - graphics_setcolorstate, /* setcolorstate */ - graphics_setcolor, /* setcolor */ - graphics_setcursor, /* nocursor */ - graphics_init, /* initialize */ - graphics_end /* shutdown */ - }, -#endif /* SUPPORT_GRAPHICS */ - /* This must be the last entry. */ - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } - }; - -/* This must be console. */ -struct term_entry *current_term = term_table; - -int max_lines = 24; -int count_lines = -1; -int use_pager = 1; -#endif - -void -print_error (void) -{ - if (errnum > ERR_NONE && errnum < MAX_ERR_NUM) -#ifndef STAGE1_5 - /* printf("\7\n %s\n", err_list[errnum]); */ - printf ("\nError %u: %s\n", errnum, err_list[errnum]); -#else /* STAGE1_5 */ - printf ("Error %u\n", errnum); -#endif /* STAGE1_5 */ -} - -char * -convert_to_ascii (char *buf, int c,...) -{ - unsigned long num = *((&c) + 1), mult = 10; - char *ptr = buf; - -#ifndef STAGE1_5 - if (c == 'x' || c == 'X') - mult = 16; - - if ((num & 0x80000000uL) && c == 'd') - { - num = (~num) + 1; - *(ptr++) = '-'; - buf++; - } -#endif - - do - { - int dig = num % mult; - *(ptr++) = ((dig > 9) ? dig + 'a' - 10 : '0' + dig); - } - while (num /= mult); - - /* reorder to correct direction!! */ - { - char *ptr1 = ptr - 1; - char *ptr2 = buf; - while (ptr1 > ptr2) - { - int tmp = *ptr1; - *ptr1 = *ptr2; - *ptr2 = tmp; - ptr1--; - ptr2++; - } - } - - return ptr; -} - -void -grub_putstr (const char *str) -{ - while (*str) - grub_putchar (*str++); -} - -static void -grub_vprintf (const char *format, int *dataptr) -{ - char c, str[16]; - - while ((c = *(format++)) != 0) - { - if (c != '%') - grub_putchar (c); - else - switch (c = *(format++)) - { -#ifndef STAGE1_5 - case 'd': - case 'x': - case 'X': -#endif - case 'u': - *convert_to_ascii (str, c, *((unsigned long *) dataptr++)) = 0; - grub_putstr (str); - break; - -#ifndef STAGE1_5 - case 'c': - grub_putchar ((*(dataptr++)) & 0xff); - break; - - case 's': - grub_putstr ((char *) *(dataptr++)); - break; -#endif - } - } -} - -#ifndef STAGE1_5 -void -init_page (void) -{ - cls (); - - grub_printf ("\n GNU GRUB version %s (%dK lower / %dK upper memory)\n\n", - version_string, mbi.mem_lower, mbi.mem_upper); -} - -/* The number of the history entries. */ -static int num_history = 0; - -/* Get the NOth history. If NO is less than zero or greater than or - equal to NUM_HISTORY, return NULL. Otherwise return a valid string. */ -static char * -get_history (int no) -{ - if (no < 0 || no >= num_history) - return 0; - - return (char *) HISTORY_BUF + MAX_CMDLINE * no; -} - -/* Add CMDLINE to the history buffer. */ -static void -add_history (const char *cmdline, int no) -{ - grub_memmove ((char *) HISTORY_BUF + MAX_CMDLINE * (no + 1), - (char *) HISTORY_BUF + MAX_CMDLINE * no, - MAX_CMDLINE * (num_history - no)); - grub_strcpy ((char *) HISTORY_BUF + MAX_CMDLINE * no, cmdline); - if (num_history < HISTORY_SIZE) - num_history++; -} - -static int -real_get_cmdline (char *prompt, char *cmdline, int maxlen, - int echo_char, int readline) -{ - /* This is a rather complicated function. So explain the concept. - - A command-line consists of ``section''s. A section is a part of the - line which may be displayed on the screen, but a section is never - displayed with another section simultaneously. - - Each section is basically 77 or less characters, but the exception - is the first section, which is 78 or less characters, because the - starting point is special. See below. - - The first section contains a prompt and a command-line (or the - first part of a command-line when it is too long to be fit in the - screen). So, in the first section, the number of command-line - characters displayed is 78 minus the length of the prompt (or - less). If the command-line has more characters, `>' is put at the - position 78 (zero-origin), to inform the user of the hidden - characters. - - Other sections always have `<' at the first position, since there - is absolutely a section before each section. If there is a section - after another section, this section consists of 77 characters and - `>' at the last position. The last section has 77 or less - characters and doesn't have `>'. - - Each section other than the last shares some characters with the - previous section. This region is called ``margin''. If the cursor - is put at the magin which is shared by the first section and the - second, the first section is displayed. Otherwise, a displayed - section is switched to another section, only if the cursor is put - outside that section. */ - - /* XXX: These should be defined in shared.h, but I leave these here, - until this code is freezed. */ -#define CMDLINE_WIDTH 78 -#define CMDLINE_MARGIN 10 - - int xpos, lpos, c, section; - /* The length of PROMPT. */ - int plen; - /* The length of the command-line. */ - int llen; - /* The index for the history. */ - int history = -1; - /* The working buffer for the command-line. */ - char *buf = (char *) CMDLINE_BUF; - /* The kill buffer. */ - char *kill_buf = (char *) KILL_BUF; - - /* Nested function definitions for code simplicity. */ - - /* The forward declarations of nested functions are prefixed - with `auto'. */ - auto void cl_refresh (int full, int len); - auto void cl_backward (int count); - auto void cl_forward (int count); - auto void cl_insert (const char *str); - auto void cl_delete (int count); - auto void cl_init (void); - - /* Move the cursor backward. */ - void cl_backward (int count) - { - lpos -= count; - - /* If the cursor is in the first section, display the first section - instead of the second. */ - if (section == 1 && plen + lpos < CMDLINE_WIDTH) - cl_refresh (1, 0); - else if (xpos - count < 1) - cl_refresh (1, 0); - else - { - xpos -= count; - - if (current_term->flags & TERM_DUMB) - { - int i; - - for (i = 0; i < count; i++) - grub_putchar ('\b'); - } - else - gotoxy (xpos, getxy () & 0xFF); - } - } - - /* Move the cursor forward. */ - void cl_forward (int count) - { - lpos += count; - - /* If the cursor goes outside, scroll the screen to the right. */ - if (xpos + count >= CMDLINE_WIDTH) - cl_refresh (1, 0); - else - { - xpos += count; - - if (current_term->flags & TERM_DUMB) - { - int i; - - for (i = lpos - count; i < lpos; i++) - { - if (! echo_char) - grub_putchar (buf[i]); - else - grub_putchar (echo_char); - } - } - else - gotoxy (xpos, getxy () & 0xFF); - } - } - - /* Refresh the screen. If FULL is true, redraw the full line, otherwise, - only LEN characters from LPOS. */ - void cl_refresh (int full, int len) - { - int i; - int start; - int pos = xpos; - - if (full) - { - /* Recompute the section number. */ - if (lpos + plen < CMDLINE_WIDTH) - section = 0; - else - section = ((lpos + plen - CMDLINE_WIDTH) - / (CMDLINE_WIDTH - 1 - CMDLINE_MARGIN) + 1); - - /* From the start to the end. */ - len = CMDLINE_WIDTH; - pos = 0; - grub_putchar ('\r'); - - /* If SECTION is the first section, print the prompt, otherwise, - print `<'. */ - if (section == 0) - { - grub_printf ("%s", prompt); - len -= plen; - pos += plen; - } - else - { - grub_putchar ('<'); - len--; - pos++; - } - } - - /* Compute the index to start writing BUF and the resulting position - on the screen. */ - if (section == 0) - { - int offset = 0; - - if (! full) - offset = xpos - plen; - - start = 0; - xpos = lpos + plen; - start += offset; - } - else - { - int offset = 0; - - if (! full) - offset = xpos - 1; - - start = ((section - 1) * (CMDLINE_WIDTH - 1 - CMDLINE_MARGIN) - + CMDLINE_WIDTH - plen - CMDLINE_MARGIN); - xpos = lpos + 1 - start; - start += offset; - } - - /* Print BUF. If ECHO_CHAR is not zero, put it instead. */ - for (i = start; i < start + len && i < llen; i++) - { - if (! echo_char) - grub_putchar (buf[i]); - else - grub_putchar (echo_char); - - pos++; - } - - /* Fill up the rest of the line with spaces. */ - for (; i < start + len; i++) - { - grub_putchar (' '); - pos++; - } - - /* If the cursor is at the last position, put `>' or a space, - depending on if there are more characters in BUF. */ - if (pos == CMDLINE_WIDTH) - { - if (start + len < llen) - grub_putchar ('>'); - else - grub_putchar (' '); - - pos++; - } - - /* Back to XPOS. */ - if (current_term->flags & TERM_DUMB) - { - for (i = 0; i < pos - xpos; i++) - grub_putchar ('\b'); - } - else - gotoxy (xpos, getxy () & 0xFF); - } - - /* Initialize the command-line. */ - void cl_init (void) - { - /* Distinguish us from other lines and error messages! */ - grub_putchar ('\n'); - - /* Print full line and set position here. */ - cl_refresh (1, 0); - } - - /* Insert STR to BUF. */ - void cl_insert (const char *str) - { - int l = grub_strlen (str); - - if (llen + l < maxlen) - { - if (lpos == llen) - grub_memmove (buf + lpos, str, l + 1); - else - { - grub_memmove (buf + lpos + l, buf + lpos, llen - lpos + 1); - grub_memmove (buf + lpos, str, l); - } - - llen += l; - lpos += l; - if (xpos + l >= CMDLINE_WIDTH) - cl_refresh (1, 0); - else if (xpos + l + llen - lpos > CMDLINE_WIDTH) - cl_refresh (0, CMDLINE_WIDTH - xpos); - else - cl_refresh (0, l + llen - lpos); - } - } - - /* Delete COUNT characters in BUF. */ - void cl_delete (int count) - { - grub_memmove (buf + lpos, buf + lpos + count, llen - count + 1); - llen -= count; - - if (xpos + llen + count - lpos > CMDLINE_WIDTH) - cl_refresh (0, CMDLINE_WIDTH - xpos); - else - cl_refresh (0, llen + count - lpos); - } - - plen = grub_strlen (prompt); - llen = grub_strlen (cmdline); - - if (maxlen > MAX_CMDLINE) - { - maxlen = MAX_CMDLINE; - if (llen >= MAX_CMDLINE) - { - llen = MAX_CMDLINE - 1; - cmdline[MAX_CMDLINE] = 0; - } - } - lpos = llen; - grub_strcpy (buf, cmdline); - - cl_init (); - - while ((c = ASCII_CHAR (getkey ())) != '\n' && c != '\r') - { - /* If READLINE is non-zero, handle readline-like key bindings. */ - if (readline) - { - switch (c) - { - case 9: /* TAB lists completions */ - { - int i; - /* POS points to the first space after a command. */ - int pos = 0; - int ret; - char *completion_buffer = (char *) COMPLETION_BUF; - int equal_pos = -1; - int is_filename; - - /* Find the first word. */ - while (buf[pos] == ' ') - pos++; - while (buf[pos] && buf[pos] != '=' && buf[pos] != ' ') - pos++; - - is_filename = (lpos > pos); - - /* Find the position of the equal character after a - command, and replace it with a space. */ - for (i = pos; buf[i] && buf[i] != ' '; i++) - if (buf[i] == '=') - { - equal_pos = i; - buf[i] = ' '; - break; - } - - /* Find the position of the first character in this - word. */ - for (i = lpos; i > 0 && buf[i - 1] != ' '; i--) - ; - - /* Invalidate the cache, because the user may exchange - removable disks. */ - buf_drive = -1; - - /* Copy this word to COMPLETION_BUFFER and do the - completion. */ - grub_memmove (completion_buffer, buf + i, lpos - i); - completion_buffer[lpos - i] = 0; - ret = print_completions (is_filename, 1); - errnum = ERR_NONE; - - if (ret >= 0) - { - /* Found, so insert COMPLETION_BUFFER. */ - cl_insert (completion_buffer + lpos - i); - - if (ret > 0) - { - /* There are more than one candidates, so print - the list. */ - grub_putchar ('\n'); - print_completions (is_filename, 0); - errnum = ERR_NONE; - } - } - - /* Restore the command-line. */ - if (equal_pos >= 0) - buf[equal_pos] = '='; - - if (ret) - cl_init (); - } - break; - case 1: /* C-a go to beginning of line */ - cl_backward (lpos); - break; - case 5: /* C-e go to end of line */ - cl_forward (llen - lpos); - break; - case 6: /* C-f forward one character */ - if (lpos < llen) - cl_forward (1); - break; - case 2: /* C-b backward one character */ - if (lpos > 0) - cl_backward (1); - break; - case 21: /* C-u kill to beginning of line */ - if (lpos == 0) - break; - /* Copy the string being deleted to KILL_BUF. */ - grub_memmove (kill_buf, buf, lpos); - kill_buf[lpos] = 0; - { - /* XXX: Not very clever. */ - - int count = lpos; - - cl_backward (lpos); - cl_delete (count); - } - break; - case 11: /* C-k kill to end of line */ - if (lpos == llen) - break; - /* Copy the string being deleted to KILL_BUF. */ - grub_memmove (kill_buf, buf + lpos, llen - lpos + 1); - cl_delete (llen - lpos); - break; - case 25: /* C-y yank the kill buffer */ - cl_insert (kill_buf); - break; - case 16: /* C-p fetch the previous command */ - { - char *p; - - if (history < 0) - /* Save the working buffer. */ - grub_strcpy (cmdline, buf); - else if (grub_strcmp (get_history (history), buf) != 0) - /* If BUF is modified, add it into the history list. */ - add_history (buf, history); - - history++; - p = get_history (history); - if (! p) - { - history--; - break; - } - - grub_strcpy (buf, p); - llen = grub_strlen (buf); - lpos = llen; - cl_refresh (1, 0); - } - break; - case 14: /* C-n fetch the next command */ - { - char *p; - - if (history < 0) - { - break; - } - else if (grub_strcmp (get_history (history), buf) != 0) - /* If BUF is modified, add it into the history list. */ - add_history (buf, history); - - history--; - p = get_history (history); - if (! p) - p = cmdline; - - grub_strcpy (buf, p); - llen = grub_strlen (buf); - lpos = llen; - cl_refresh (1, 0); - } - break; - } - } - - /* ESC, C-d and C-h are always handled. Actually C-d is not - functional if READLINE is zero, as the cursor cannot go - backward, but that's ok. */ - switch (c) - { - case 27: /* ESC immediately return 1 */ - return 1; - case 4: /* C-d delete character under cursor */ - if (lpos == llen) - break; - cl_delete (1); - break; - case 8: /* C-h backspace */ -# ifdef GRUB_UTIL - case 127: /* also backspace */ -# endif - if (lpos > 0) - { - cl_backward (1); - cl_delete (1); - } - break; - default: /* insert printable character into line */ - if (c >= ' ' && c <= '~') - { - char str[2]; - - str[0] = c; - str[1] = 0; - cl_insert (str); - } - } - } - - grub_putchar ('\n'); - - /* If ECHO_CHAR is NUL, remove the leading spaces. */ - lpos = 0; - if (! echo_char) - while (buf[lpos] == ' ') - lpos++; - - /* Copy the working buffer to CMDLINE. */ - grub_memmove (cmdline, buf + lpos, llen - lpos + 1); - - /* If the readline-like feature is turned on and CMDLINE is not - empty, add it into the history list. */ - if (readline && lpos < llen) - add_history (cmdline, 0); - - return 0; -} - -/* Don't use this with a MAXLEN greater than 1600 or so! The problem - is that GET_CMDLINE depends on the everything fitting on the screen - at once. So, the whole screen is about 2000 characters, minus the - PROMPT, and space for error and status lines, etc. MAXLEN must be - at least 1, and PROMPT and CMDLINE must be valid strings (not NULL - or zero-length). - - If ECHO_CHAR is nonzero, echo it instead of the typed character. */ -int -get_cmdline (char *prompt, char *cmdline, int maxlen, - int echo_char, int readline) -{ - int old_cursor; - int ret; - - old_cursor = setcursor (1); - - /* Because it is hard to deal with different conditions simultaneously, - less functional cases are handled here. Assume that TERM_NO_ECHO - implies TERM_NO_EDIT. */ - if (current_term->flags & (TERM_NO_ECHO | TERM_NO_EDIT)) - { - char *p = cmdline; - int c; - - /* Make sure that MAXLEN is not too large. */ - if (maxlen > MAX_CMDLINE) - maxlen = MAX_CMDLINE; - - /* Print only the prompt. The contents of CMDLINE is simply discarded, - even if it is not empty. */ - grub_printf ("%s", prompt); - - /* Gather characters until a newline is gotten. */ - while ((c = ASCII_CHAR (getkey ())) != '\n' && c != '\r') - { - /* Return immediately if ESC is pressed. */ - if (c == 27) - { - setcursor (old_cursor); - return 1; - } - - /* Printable characters are added into CMDLINE. */ - if (c >= ' ' && c <= '~') - { - if (! (current_term->flags & TERM_NO_ECHO)) - grub_putchar (c); - - /* Preceding space characters must be ignored. */ - if (c != ' ' || p != cmdline) - *p++ = c; - } - } - - *p = 0; - - if (! (current_term->flags & TERM_NO_ECHO)) - grub_putchar ('\n'); - - setcursor (old_cursor); - return 0; - } - - /* Complicated features are left to real_get_cmdline. */ - ret = real_get_cmdline (prompt, cmdline, maxlen, echo_char, readline); - setcursor (old_cursor); - return ret; -} - -int -safe_parse_maxint (char **str_ptr, int *myint_ptr) -{ - char *ptr = *str_ptr; - int myint = 0; - int mult = 10, found = 0; - - /* - * Is this a hex number? - */ - if (*ptr == '0' && tolower (*(ptr + 1)) == 'x') - { - ptr += 2; - mult = 16; - } - - while (1) - { - /* A bit tricky. This below makes use of the equivalence: - (A >= B && A <= C) <=> ((A - B) <= (C - B)) - when C > B and A is unsigned. */ - unsigned int digit; - - digit = tolower (*ptr) - '0'; - if (digit > 9) - { - digit -= 'a' - '0'; - if (mult == 10 || digit > 5) - break; - digit += 10; - } - - found = 1; - if (myint > ((MAXINT - digit) / mult)) - { - errnum = ERR_NUMBER_OVERFLOW; - return 0; - } - myint = (myint * mult) + digit; - ptr++; - } - - if (!found) - { - errnum = ERR_NUMBER_PARSING; - return 0; - } - - *str_ptr = ptr; - *myint_ptr = myint; - - return 1; -} -#endif /* STAGE1_5 */ - -#if !defined(STAGE1_5) || defined(FSYS_ZFS) -static int -grub_vsprintf (char *buffer, const char *format, int *dataptr) -{ - /* XXX hohmuth - ugly hack -- should unify with printf() */ - char c, *ptr, str[16]; - char *bp = buffer; - int len = 0; - - while ((c = *format++) != 0) - { - if (c != '%') { - if (buffer) - *bp++ = c; /* putchar(c); */ - len++; - } else { - switch (c = *(format++)) - { - case 'd': case 'u': case 'x': - *convert_to_ascii (str, c, *((unsigned long *) dataptr++)) = 0; - - ptr = str; - - while (*ptr) { - if (buffer) - *bp++ = *(ptr++); /* putchar(*(ptr++)); */ - else - ptr++; - len++; - } - break; - - case 'c': - if (buffer) - *bp++ = (*(dataptr++))&0xff; - else - dataptr++; - len++; - /* putchar((*(dataptr++))&0xff); */ - break; - - case 's': - ptr = (char *) (*(dataptr++)); - - while ((c = *ptr++) != 0) { - if (buffer) - *bp++ = c; /* putchar(c); */ - len++; - } - break; - } - } - } - - *bp = 0; - return (len); -} - -int -grub_sprintf (char *buffer, const char *format, ...) -{ - int *dataptr = (int *) &format; - dataptr++; - - return (grub_vsprintf (buffer, format, dataptr)); -} - -#endif /* !defined(STAGE1_5) || defined(FSYS_ZFS) */ - -void -noisy_printf (const char *format,...) -{ - int *dataptr = (int *) &format; - dataptr++; - - grub_vprintf(format, dataptr); -} - -/* - * print to a buffer, unless verbose mode is on - * if verbos mode is switched on, the buffer is dumped in verbose_func() - */ -void -grub_printf (const char *format,...) -{ - int len; - int *dataptr = (int *) &format; - dataptr++; - -#ifndef STAGE1_5 - if (silent.status != SILENT) -#endif - grub_vprintf(format, dataptr); -#ifndef STAGE1_5 - else { - len = grub_vsprintf(NULL, format, dataptr); - if (silent.buffer_start - silent.buffer + len + 1 >= - SCREENBUF) { - silent.buffer_start = silent.buffer; - silent.looped = 1; - } - if (len < SCREENBUF) /* all other cases loop safely */ - silent.buffer_start += - grub_vsprintf(silent.buffer_start, format, dataptr); - } -#endif -} - -#if !defined(STAGE1_5) || defined(FSYS_FAT) -int -grub_tolower (int c) -{ - if (c >= 'A' && c <= 'Z') - return (c + ('a' - 'A')); - - return c; -} -#endif /* ! STAGE1_5 || FSYS_FAT */ - -int -grub_isspace (int c) -{ - switch (c) - { - case ' ': - case '\t': - case '\r': - case '\n': - return 1; - default: - break; - } - - return 0; -} - -#if !defined(STAGE1_5) || defined(FSYS_ISO9660) -int -grub_memcmp (const char *s1, const char *s2, int n) -{ - while (n) - { - if (*s1 < *s2) - return -1; - else if (*s1 > *s2) - return 1; - s1++; - s2++; - n--; - } - - return 0; -} -#endif /* ! STAGE1_5 || FSYS_ISO9660 */ - -#ifndef STAGE1_5 -int -grub_strncat (char *s1, const char *s2, int n) -{ - int i = -1; - - while (++i < n && s1[i] != 0); - - while (i < n && (s1[i++] = *(s2++)) != 0); - - s1[n - 1] = 0; - - if (i >= n) - return 0; - - s1[i] = 0; - - return 1; -} -#endif /* ! STAGE1_5 */ - -/* XXX: This below is an evil hack. Certainly, we should change the - strategy to determine what should be defined and what shouldn't be - defined for each image. For example, it would be better to create - a static library supporting minimal standard C functions and link - each image with the library. Complicated things should be left to - computer, definitely. -okuji */ - -/* Make some grub_str* routines available to ZFS plug-in as well */ - -#if !defined(STAGE1_5) || defined(FSYS_VSTAFS) || defined(FSYS_ZFS) -int -grub_strcmp (const char *s1, const char *s2) -{ - while (*s1 || *s2) - { - if (*s1 < *s2) - return -1; - else if (*s1 > *s2) - return 1; - s1 ++; - s2 ++; - } - - return 0; -} - -int -grub_strncmp(const char *s1, const char *s2, int n) -{ - if (s1 == s2) - return (0); - n++; - while (--n != 0 && *s1 == *s2++) - if (*s1++ == '\0') - return (0); - return ((n == 0) ? 0 : *(unsigned char *)s1 - *(unsigned char *)--s2); -} - -#endif /* ! STAGE1_5 || FSYS_VSTAFS || defined(FSYS_ZFS) */ - -#ifndef STAGE1_5 -/* Wait for a keypress and return its code. */ -int -getkey (void) -{ - return current_term->getkey (); -} - -/* Check if a key code is available. */ -int -checkkey (void) -{ - return current_term->checkkey (); -} -#endif /* ! STAGE1_5 */ - -/* Display an ASCII character. */ -void -grub_putchar (int c) -{ - if (c == '\n') - grub_putchar ('\r'); -#ifndef STAGE1_5 - else if (c == '\t' && current_term->getxy) - { - int n; - - n = 8 - ((current_term->getxy () >> 8) & 3); - while (n--) - grub_putchar (' '); - - return; - } -#endif /* ! STAGE1_5 */ - -#ifdef STAGE1_5 - - /* In Stage 1.5, only the normal console is supported. */ - console_putchar (c); - -#else /* ! STAGE1_5 */ - - if (c == '\n') - { - /* Internal `more'-like feature. */ - if (count_lines >= 0) - { - count_lines++; - if (count_lines >= max_lines - 2) - { - int tmp; - - /* It's important to disable the feature temporarily, because - the following grub_printf call will print newlines. */ - count_lines = -1; - - grub_printf("\n"); - if (current_term->setcolorstate) - current_term->setcolorstate (COLOR_STATE_HIGHLIGHT); - - grub_printf ("[Hit return to continue]"); - - if (current_term->setcolorstate) - current_term->setcolorstate (COLOR_STATE_NORMAL); - - do - { - tmp = ASCII_CHAR (getkey ()); - } - while (tmp != '\n' && tmp != '\r'); - grub_printf ("\r \r"); - - /* Restart to count lines. */ - count_lines = 0; - return; - } - } - } - - current_term->putchar (c); - -#endif /* ! STAGE1_5 */ -} - -#ifndef STAGE1_5 -void -gotoxy (int x, int y) -{ - current_term->gotoxy (x, y); -} - -int -getxy (void) -{ - return current_term->getxy (); -} - -void -cls (void) -{ - /* If the terminal is dumb, there is no way to clean the terminal. */ - if (current_term->flags & TERM_DUMB) - grub_putchar ('\n'); - else - current_term->cls (); -} - -int -setcursor (int on) -{ - if (current_term->setcursor) - return current_term->setcursor (on); - - return 1; -} -#endif /* ! STAGE1_5 */ - -int -substring (const char *s1, const char *s2) -{ - while (*s1 == *s2) - { - /* The strings match exactly. */ - if (! *(s1++)) - return 0; - s2 ++; - } - - /* S1 is a substring of S2. */ - if (*s1 == 0) - return -1; - - /* S1 isn't a substring. */ - return 1; -} - -#if !defined(STAGE1_5) || defined(FSYS_ZFS) -char * -grub_strstr (const char *s1, const char *s2) -{ - while (*s1) - { - const char *ptr, *tmp; - - ptr = s1; - tmp = s2; - - while (*tmp && *ptr == *tmp) - ptr++, tmp++; - - if (tmp > s2 && ! *tmp) - return (char *) s1; - - s1++; - } - - return 0; -} - -int -grub_strlen (const char *str) -{ - int len = 0; - - while (*str++) - len++; - - return len; -} -#endif /* !defined(STAGE1_5) || defined(FSYS_ZFS) */ - -#ifndef STAGE1_5 -/* Terminate the string STR with NUL. */ -int -nul_terminate (char *str) -{ - int ch; - - while (*str && ! grub_isspace (*str)) - str++; - - ch = *str; - *str = 0; - return ch; -} - -char * -grub_strchr (char *str, char c) -{ - for (; *str && (*str != c); str++); - - return (*str ? str : NULL); -} -#endif /* ! STAGE1_5 */ - -int -memcheck (unsigned long addr, unsigned long len) -{ - int local_errnum = 0; -#ifdef GRUB_UTIL - static unsigned long start_addr (void) - { - int ret; -# if defined(HAVE_START_SYMBOL) - asm volatile ("movl $start, %0" : "=a" (ret)); -# elif defined(HAVE_USCORE_START_SYMBOL) - asm volatile ("movl $_start, %0" : "=a" (ret)); -# endif - return ret; - } - - static unsigned long end_addr (void) - { - int ret; -# if defined(HAVE_END_SYMBOL) - asm volatile ("movl $end, %0" : "=a" (ret)); -# elif defined(HAVE_USCORE_END_SYMBOL) - asm volatile ("movl $_end, %0" : "=a" (ret)); -# endif - return ret; - } - - if (start_addr () <= addr && end_addr () > addr + len) - return ! local_errnum; -#endif /* GRUB_UTIL */ - - if ((addr < RAW_ADDR (0x1000)) - || (addr < RAW_ADDR (0x100000) - && RAW_ADDR (mbi.mem_lower * 1024) < (addr + len)) - || (addr >= RAW_ADDR (0x100000) - && RAW_ADDR (mbi.mem_upper * 1024) < ((addr - 0x100000) + len))) - local_errnum = ERR_WONT_FIT; - - if (errnum == 0) /* preserve original errnum */ - errnum = local_errnum; - return ! local_errnum; -} - -void -grub_memcpy(void *dest, const void *src, int len) -{ - int i; - register char *d = (char*)dest, *s = (char*)src; - - for (i = 0; i < len; i++) - d[i] = s[i]; -} - -void * -grub_memmove (void *to, const void *from, int len) -{ - if (memcheck ((int) to, len)) - { - /* This assembly code is stolen from - linux-2.2.2/include/asm-i386/string.h. This is not very fast - but compact. */ - int d0, d1, d2; - - if (to < from) - { - asm volatile ("cld\n\t" - "rep\n\t" - "movsb" - : "=&c" (d0), "=&S" (d1), "=&D" (d2) - : "0" (len),"1" (from),"2" (to) - : "memory"); - } - else - { - asm volatile ("std\n\t" - "rep\n\t" - "movsb\n\t" - "cld" - : "=&c" (d0), "=&S" (d1), "=&D" (d2) - : "0" (len), - "1" (len - 1 + (const char *) from), - "2" (len - 1 + (char *) to) - : "memory"); - } - return to; - } - - return NULL; -} - -void * -grub_memset (void *start, int c, int len) -{ - char *p = start; - - if (memcheck ((int) start, len)) - { - while (len -- > 0) - *p ++ = c; - } - - return errnum ? NULL : start; -} - -#ifndef STAGE1_5 -char * -grub_strcpy (char *dest, const char *src) -{ - grub_memmove (dest, src, grub_strlen (src) + 1); - return dest; -} -#endif /* ! STAGE1_5 */ - -#ifndef GRUB_UTIL -# undef memcpy -/* GCC emits references to memcpy() for struct copies etc. */ -void *memcpy (void *dest, const void *src, int n) __attribute__ ((alias ("grub_memmove"))); -#endif diff --git a/usr/src/grub/grub-0.95/stage2/cmdline.c b/usr/src/grub/grub-0.95/stage2/cmdline.c deleted file mode 100644 index 46c5fda027..0000000000 --- a/usr/src/grub/grub-0.95/stage2/cmdline.c +++ /dev/null @@ -1,273 +0,0 @@ -/* cmdline.c - the device-independent GRUB text command line */ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 1999,2000,2001,2002,2004 Free Software Foundation, 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 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 -#include - -extern struct term_entry *current_term; - -#ifdef SUPPORT_DISKLESS -# include -#endif - -grub_jmp_buf restart_cmdline_env; - -/* Find the next word from CMDLINE and return the pointer. If - AFTER_EQUAL is non-zero, assume that the character `=' is treated as - a space. Caution: this assumption is for backward compatibility. */ -char * -skip_to (int after_equal, char *cmdline) -{ - /* Skip until we hit whitespace, or maybe an equal sign. */ - while (*cmdline && *cmdline != ' ' && *cmdline != '\t' && - ! (after_equal && *cmdline == '=')) - cmdline ++; - - /* Skip whitespace, and maybe equal signs. */ - while (*cmdline == ' ' || *cmdline == '\t' || - (after_equal && *cmdline == '=')) - cmdline ++; - - return cmdline; -} - -/* Print a helpful message for the command-line interface. */ -void -print_cmdline_message (int forever) -{ - printf (" [ Minimal BASH-like line editing is supported. For the first word, TAB\n" - " lists possible command completions. Anywhere else TAB lists the possible\n" - " completions of a device/filename.%s ]\n", - (forever ? "" : " ESC at any time exits.")); -} - -/* Find the builtin whose command name is COMMAND and return the - pointer. If not found, return 0. */ -struct builtin * -find_command (char *command) -{ - char *ptr; - char c; - struct builtin **builtin; - - /* Find the first space and terminate the command name. */ - ptr = command; - while (*ptr && *ptr != ' ' && *ptr != '\t' && *ptr != '=') - ptr ++; - - c = *ptr; - *ptr = 0; - - /* Seek out the builtin whose command name is COMMAND. */ - for (builtin = builtin_table; *builtin != 0; builtin++) - { - int ret = grub_strcmp (command, (*builtin)->name); - - if (ret == 0) - { - /* Find the builtin for COMMAND. */ - *ptr = c; - return *builtin; - } - else if (ret < 0) - break; - } - - /* Cannot find COMMAND. */ - errnum = ERR_UNRECOGNIZED; - *ptr = c; - return 0; -} - -/* Initialize the data for the command-line. */ -static void -init_cmdline (void) -{ - /* Initialization. */ - saved_drive = boot_drive; - saved_partition = install_partition; - current_drive = GRUB_INVALID_DRIVE; - errnum = 0; - count_lines = -1; - - /* Restore memory probe state. */ - mbi.mem_upper = saved_mem_upper; - if (mbi.mmap_length) - mbi.flags |= MB_INFO_MEM_MAP; - - /* Initialize the data for the builtin commands. */ - init_builtins (); -} - -/* Enter the command-line interface. HEAP is used for the command-line - buffer. Return only if FOREVER is nonzero and get_cmdline returns - nonzero (ESC is pushed). */ -void -enter_cmdline (char *heap, int forever) -{ - /* Initialize the data and print a message. */ - init_cmdline (); - grub_setjmp (restart_cmdline_env); - init_page (); -#ifdef SUPPORT_DISKLESS - print_network_configuration (); - grub_putchar ('\n'); -#endif - print_cmdline_message (forever); - - while (1) - { - struct builtin *builtin; - char *arg; - - *heap = 0; - print_error (); - errnum = ERR_NONE; - - /* Get the command-line with the minimal BASH-like interface. */ - if (get_cmdline (PACKAGE "> ", heap, 2048, 0, 1)) - return; - - /* If there was no command, grab a new one. */ - if (! heap[0]) - continue; - - /* Find a builtin. */ - builtin = find_command (heap); - if (! builtin) - continue; - - /* If BUILTIN cannot be run in the command-line, skip it. */ - if (! (builtin->flags & BUILTIN_CMDLINE)) - { - errnum = ERR_UNRECOGNIZED; - continue; - } - - /* Invalidate the cache, because the user may exchange removable - disks. */ - buf_drive = -1; - - /* Start to count lines, only if the internal pager is in use. */ - if (use_pager) - count_lines = 0; - - /* Run BUILTIN->FUNC. */ - arg = skip_to (1, heap); - (builtin->func) (arg, BUILTIN_CMDLINE); - - /* Finish the line count. */ - count_lines = -1; - } -} - -/* Run an entry from the script SCRIPT. HEAP is used for the - command-line buffer. If an error occurs, return non-zero, otherwise - return zero. */ -int -run_script (char *script, char *heap) -{ - char *old_entry; - char *cur_entry = script; - - /* Initialize the data. */ - init_cmdline (); - - while (1) - { - struct builtin *builtin; - char *arg; - - print_error (); - - if (errnum) - { - errnum = ERR_NONE; - - /* - * At this point something must have gone wrong, so dump the - * buffer and flip output back on. - */ - builtin = find_command("verbose"); - (builtin->func) ("on", BUILTIN_SCRIPT); - - /* If a fallback entry is defined, don't prompt a user's - intervention. */ - if (fallback_entryno < 0) - { - grub_printf ("\nPress any key to continue..."); - (void) getkey (); - } - - return 1; - } - - /* Copy the first string in CUR_ENTRY to HEAP. */ - old_entry = cur_entry; - while (*cur_entry++) - ; - - grub_memmove (heap, old_entry, (int) cur_entry - (int) old_entry); - if (! *heap) - { - /* If there is no more command in SCRIPT... */ - - /* If any kernel is not loaded, just exit successfully. */ - if (kernel_type == KERNEL_TYPE_NONE) - return 0; - - if (reset_term) - if (current_term->shutdown) { - (*current_term->shutdown)(); - current_term = term_table; /* assumption: console is first */ - } - - - /* Otherwise, the command boot is run implicitly. */ - grub_memmove (heap, "boot", 5); - } - - /* Find a builtin. */ - builtin = find_command (heap); - if (! builtin) - { - grub_printf ("%s\n", old_entry); - continue; - } - - if (! (builtin->flags & BUILTIN_NO_ECHO)) - grub_printf ("%s\n", old_entry); - - /* If BUILTIN cannot be run in the command-line, skip it. */ - if (! (builtin->flags & BUILTIN_CMDLINE)) - { - errnum = ERR_UNRECOGNIZED; - continue; - } - - /* Invalidate the cache, because the user may exchange removable - disks. */ - buf_drive = -1; - - /* Run BUILTIN->FUNC. */ - arg = skip_to (1, heap); - (builtin->func) (arg, BUILTIN_SCRIPT); - } -} diff --git a/usr/src/grub/grub-0.95/stage2/common.c b/usr/src/grub/grub-0.95/stage2/common.c deleted file mode 100644 index 878fdfc13c..0000000000 --- a/usr/src/grub/grub-0.95/stage2/common.c +++ /dev/null @@ -1,354 +0,0 @@ -/* common.c - miscellaneous shared variables and routines */ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 1999,2000,2001,2002,2004 Free Software Foundation, 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 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 - -#ifdef SUPPORT_NETBOOT -#include -#include -#endif - -/* - * Shared BIOS/boot data. - */ - -struct multiboot_info mbi; -unsigned long saved_drive; -unsigned long saved_partition; -unsigned long cdrom_drive; -#ifndef STAGE1_5 -#ifdef SOLARIS_NETBOOT -unsigned long dhcpack_length; -unsigned long dhcpack_buf; -#endif /* SOLARIS_NETBOOT */ -unsigned long saved_mem_upper; - -/* This saves the maximum size of extended memory (in KB). */ -unsigned long extended_memory; -#endif - -/* - * Error code stuff. - */ - -grub_error_t errnum = ERR_NONE; - -#ifndef STAGE1_5 - -char *err_list[] = -{ - [ERR_NONE] = 0, - [ERR_BAD_ARGUMENT] = "Invalid argument", - [ERR_BAD_FILENAME] = - "Filename must be either an absolute pathname or blocklist", - [ERR_BAD_FILETYPE] = "Bad file or directory type", - [ERR_BAD_GZIP_DATA] = "Bad or corrupt data while decompressing file", - [ERR_BAD_GZIP_HEADER] = "Bad or incompatible header in compressed file", - [ERR_BAD_PART_TABLE] = "Partition table invalid or corrupt", - [ERR_BAD_VERSION] = "Mismatched or corrupt version of stage1/stage2", - [ERR_BELOW_1MB] = "Loading below 1MB is not supported", - [ERR_BOOT_COMMAND] = "Kernel must be loaded before booting", - [ERR_BOOT_FAILURE] = "Unknown boot failure", - [ERR_BOOT_FEATURES] = "Unsupported Multiboot features requested", - [ERR_DEV_FORMAT] = "Unrecognized device string", - [ERR_DEV_NEED_INIT] = "Device not initialized yet", - [ERR_DEV_VALUES] = "Invalid device requested", - [ERR_EXEC_FORMAT] = "Invalid or unsupported executable format", - [ERR_FILELENGTH] = - "Filesystem compatibility error, cannot read whole file", - [ERR_FILE_NOT_FOUND] = "File not found", - [ERR_FSYS_CORRUPT] = "Inconsistent filesystem structure", - [ERR_FSYS_MOUNT] = "Cannot mount selected partition", - [ERR_GEOM] = "Selected cylinder exceeds maximum supported by BIOS", - [ERR_NEED_LX_KERNEL] = "Linux kernel must be loaded before initrd", - [ERR_NEED_MB_KERNEL] = "Multiboot kernel must be loaded before modules", - [ERR_NO_DISK] = "Selected disk does not exist", - [ERR_NO_DISK_SPACE] = "No spare sectors on the disk", - [ERR_NO_PART] = "No such partition", - [ERR_NUMBER_OVERFLOW] = "Overflow while parsing number", - [ERR_NUMBER_PARSING] = "Error while parsing number", - [ERR_OUTSIDE_PART] = "Attempt to access block outside partition", - [ERR_PRIVILEGED] = "Must be authenticated", - [ERR_READ] = "Disk read error", - [ERR_SYMLINK_LOOP] = "Too many symbolic links", - [ERR_UNALIGNED] = "File is not sector aligned", - [ERR_UNRECOGNIZED] = "Unrecognized command", - [ERR_WONT_FIT] = "Selected item cannot fit into memory", - [ERR_WRITE] = "Disk write error", - [ERR_BAD_GZIP_CRC] = "Incorrect gunzip CRC checksum", - [ERR_FILESYSTEM_NOT_FOUND] = "File System not found", - /* this zfs file system is not found in the pool of the device */ - [ERR_NO_BOOTPATH] = "No valid boot path found in the zfs label. This may be caused by attempting to boot from an off-lined device.", - [ERR_NEWER_VERSION] = "Newer on-disk pool version" -}; - - -/* static for BIOS memory map fakery */ -static struct AddrRangeDesc fakemap[3] = -{ - {20, 0, 0, MB_ARD_MEMORY}, - {20, 0x100000, 0, MB_ARD_MEMORY}, - {20, 0x1000000, 0, MB_ARD_MEMORY} -}; - -/* A big problem is that the memory areas aren't guaranteed to be: - (1) contiguous, (2) sorted in ascending order, or (3) non-overlapping. - Thus this kludge. */ -static unsigned long -mmap_avail_at (unsigned long bottom) -{ - unsigned long long top; - unsigned long addr; - int cont; - - top = bottom; - do - { - for (cont = 0, addr = mbi.mmap_addr; - addr < mbi.mmap_addr + mbi.mmap_length; - addr += *((unsigned long *) addr) + 4) - { - struct AddrRangeDesc *desc = (struct AddrRangeDesc *) addr; - - if (desc->Type == MB_ARD_MEMORY - && desc->BaseAddr <= top - && desc->BaseAddr + desc->Length > top) - { - top = desc->BaseAddr + desc->Length; - cont++; - } - } - } - while (cont); - - /* For now, GRUB assumes 32bits addresses, so... */ - if (top > 0xFFFFFFFF) - top = 0xFFFFFFFF; - - return (unsigned long) top - bottom; -} -#endif /* ! STAGE1_5 */ - -/* This queries for BIOS information. */ -void -init_bios_info (void) -{ -#ifndef STAGE1_5 - unsigned long cont, memtmp, addr; - int drive; -#endif - - /* - * Get information from BIOS on installed RAM. - */ - - mbi.mem_lower = get_memsize (0); - mbi.mem_upper = get_memsize (1); - -#ifndef STAGE1_5 - /* - * We need to call this somewhere before trying to put data - * above 1 MB, since without calling it, address line 20 will be wired - * to 0. Not too desirable. - */ - - gateA20 (1); - - /* Store the size of extended memory in EXTENDED_MEMORY, in order to - tell it to non-Multiboot OSes. */ - extended_memory = mbi.mem_upper; - - /* - * The "mbi.mem_upper" variable only recognizes upper memory in the - * first memory region. If there are multiple memory regions, - * the rest are reported to a Multiboot-compliant OS, but otherwise - * unused by GRUB. - */ - - addr = get_code_end (); - mbi.mmap_addr = addr; - mbi.mmap_length = 0; - cont = 0; - - do - { - cont = get_mmap_entry ((void *) addr, cont); - - /* If the returned buffer's length is zero, quit. */ - if (! *((unsigned long *) addr)) - break; - - mbi.mmap_length += *((unsigned long *) addr) + 4; - addr += *((unsigned long *) addr) + 4; - } - while (cont); - - if (mbi.mmap_length) - { - unsigned long long max_addr; - - /* - * This is to get the lower memory, and upper memory (up to the - * first memory hole), into the "mbi.mem_{lower,upper}" - * elements. This is for OS's that don't care about the memory - * map, but might care about total RAM available. - */ - mbi.mem_lower = mmap_avail_at (0) >> 10; - mbi.mem_upper = mmap_avail_at (0x100000) >> 10; - - /* Find the maximum available address. Ignore any memory holes. */ - for (max_addr = 0, addr = mbi.mmap_addr; - addr < mbi.mmap_addr + mbi.mmap_length; - addr += *((unsigned long *) addr) + 4) - { - struct AddrRangeDesc *desc = (struct AddrRangeDesc *) addr; - - if (desc->Type == MB_ARD_MEMORY && desc->Length > 0 - && desc->BaseAddr + desc->Length > max_addr) - max_addr = desc->BaseAddr + desc->Length; - } - - extended_memory = (max_addr - 0x100000) >> 10; - } - else if ((memtmp = get_eisamemsize ()) != -1) - { - cont = memtmp & ~0xFFFF; - memtmp = memtmp & 0xFFFF; - - if (cont != 0) - extended_memory = (cont >> 10) + 0x3c00; - else - extended_memory = memtmp; - - if (!cont || (memtmp == 0x3c00)) - memtmp += (cont >> 10); - else - { - /* XXX should I do this at all ??? */ - - mbi.mmap_addr = (unsigned long) fakemap; - mbi.mmap_length = sizeof (fakemap); - fakemap[0].Length = (mbi.mem_lower << 10); - fakemap[1].Length = (memtmp << 10); - fakemap[2].Length = cont; - } - - mbi.mem_upper = memtmp; - } - - saved_mem_upper = mbi.mem_upper; - -#ifdef SUPPORT_NETBOOT -#ifdef SOLARIS_NETBOOT - /* leave room for dhcpack_buf */ - dhcpack_buf = addr; - addr += sizeof (struct dhcp_t); -#endif -#endif - - /* Get the drive info. */ - /* FIXME: This should be postponed until a Multiboot kernel actually - requires it, because this could slow down the start-up - unreasonably. */ - mbi.drives_length = 0; - mbi.drives_addr = addr; - - /* For now, GRUB doesn't probe floppies, since it is trivial to map - floppy drives to BIOS drives. */ - for (drive = 0x80; drive < 0x88; drive++) - { - struct geometry geom; - struct drive_info *info = (struct drive_info *) addr; - unsigned short *port; - - /* Get the geometry. This ensures that the drive is present. */ - if (get_diskinfo (drive, &geom)) - break; - - /* Clean out the I/O map. */ - grub_memset ((char *) io_map, 0, - IO_MAP_SIZE * sizeof (unsigned short)); - - /* Disable to probe I/O ports temporarily, because this doesn't - work with some BIOSes (maybe they are too buggy). */ -#if 0 - /* Track the int13 handler. */ - track_int13 (drive); -#endif - - /* Set the information. */ - info->drive_number = drive; - info->drive_mode = ((geom.flags & BIOSDISK_FLAG_LBA_EXTENSION) - ? MB_DI_LBA_MODE : MB_DI_CHS_MODE); - info->drive_cylinders = geom.cylinders; - info->drive_heads = geom.heads; - info->drive_sectors = geom.sectors; - - addr += sizeof (struct drive_info); - for (port = io_map; *port; port++, addr += sizeof (unsigned short)) - *((unsigned short *) addr) = *port; - - info->size = addr - (unsigned long) info; - mbi.drives_length += info->size; - } - - /* Get the ROM configuration table by INT 15, AH=C0h. */ - mbi.config_table = get_rom_config_table (); - - /* Set the boot loader name. */ - mbi.boot_loader_name = (unsigned long) "GNU GRUB " VERSION; - - /* Get the APM BIOS table. */ - get_apm_info (); - if (apm_bios_info.version) - mbi.apm_table = (unsigned long) &apm_bios_info; - - /* - * Initialize other Multiboot Info flags. - */ - - mbi.flags = (MB_INFO_MEMORY | MB_INFO_CMDLINE | MB_INFO_BOOTDEV - | MB_INFO_DRIVE_INFO | MB_INFO_CONFIG_TABLE - | MB_INFO_BOOT_LOADER_NAME); - - if (apm_bios_info.version) - mbi.flags |= MB_INFO_APM_TABLE; - -#endif /* STAGE1_5 */ - - /* Set boot drive and partition. */ - saved_drive = boot_drive; - saved_partition = install_partition; - - /* Set cdrom drive. */ - { - struct geometry geom; - - /* Get the geometry. */ - if (get_diskinfo (boot_drive, &geom) - || ! (geom.flags & BIOSDISK_FLAG_CDROM)) - cdrom_drive = GRUB_INVALID_DRIVE; - else - cdrom_drive = boot_drive; - } - - /* Start main routine here. */ - cmain (); -} diff --git a/usr/src/grub/grub-0.95/stage2/console.c b/usr/src/grub/grub-0.95/stage2/console.c deleted file mode 100644 index fbe212e0d6..0000000000 --- a/usr/src/grub/grub-0.95/stage2/console.c +++ /dev/null @@ -1,62 +0,0 @@ -/* term_console.c - console input and output */ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 2002 Free Software Foundation, 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 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 -#include - -/* These functions are defined in asm.S instead of this file: - console_putchar, console_checkkey, console_getkey, console_getxy, - console_gotoxy, console_cls, and console_nocursor. */ - -int console_current_color = A_NORMAL; -static int console_standard_color = A_NORMAL; -static int console_normal_color = A_NORMAL; -static int console_highlight_color = A_REVERSE; -static color_state console_color_state = COLOR_STATE_STANDARD; - -void -console_setcolorstate (color_state state) -{ - switch (state) { - case COLOR_STATE_STANDARD: - console_current_color = console_standard_color; - break; - case COLOR_STATE_NORMAL: - console_current_color = console_normal_color; - break; - case COLOR_STATE_HIGHLIGHT: - console_current_color = console_highlight_color; - break; - default: - console_current_color = console_standard_color; - break; - } - - console_color_state = state; -} - -void -console_setcolor (int normal_color, int highlight_color) -{ - console_normal_color = normal_color; - console_highlight_color = highlight_color; - - console_setcolorstate (console_color_state); -} diff --git a/usr/src/grub/grub-0.95/stage2/controlregs.h b/usr/src/grub/grub-0.95/stage2/controlregs.h deleted file mode 100644 index dc675f603f..0000000000 --- a/usr/src/grub/grub-0.95/stage2/controlregs.h +++ /dev/null @@ -1,161 +0,0 @@ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 2006 Free Software Foundation, 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 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. - */ - -/* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _SYS_CONTROLREGS_H -#define _SYS_CONTROLREGS_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * This file describes the x86 architecture control registers which - * are part of the privileged architecture. - * - * Many of these definitions are shared between IA-32-style and - * AMD64-style processors. - */ - -/* CR0 Register */ - -#define CR0_PG 0x80000000 /* paging enabled */ -#define CR0_CD 0x40000000 /* cache disable */ -#define CR0_NW 0x20000000 /* not writethrough */ -#define CR0_AM 0x00040000 /* alignment mask */ -#define CR0_WP 0x00010000 /* write protect */ -#define CR0_NE 0x00000020 /* numeric error */ -#define CR0_ET 0x00000010 /* extension type */ -#define CR0_TS 0x00000008 /* task switch */ -#define CR0_EM 0x00000004 /* emulation */ -#define CR0_MP 0x00000002 /* monitor coprocessor */ -#define CR0_PE 0x00000001 /* protection enabled */ - -/* XX64 eliminate these compatibility defines */ - -#define CR0_CE CR0_CD -#define CR0_WT CR0_NW - -#define FMT_CR0 \ - "\20\40pg\37cd\36nw\35am\21wp\6ne\5et\4ts\3em\2mp\1pe" - -/* CR3 Register */ - -#define CR3_PCD 0x00000010 /* cache disable */ -#define CR3_PWT 0x00000008 /* write through */ - -#define FMT_CR3 "\20\5pcd\4pwt" - -/* CR4 Register */ - -#define CR4_VME 0x0001 /* virtual-8086 mode extensions */ -#define CR4_PVI 0x0002 /* protected-mode virtual interrupts */ -#define CR4_TSD 0x0004 /* time stamp disable */ -#define CR4_DE 0x0008 /* debugging extensions */ -#define CR4_PSE 0x0010 /* page size extensions */ -#define CR4_PAE 0x0020 /* physical address extension */ -#define CR4_MCE 0x0040 /* machine check enable */ -#define CR4_PGE 0x0080 /* page global enable */ -#define CR4_PCE 0x0100 /* perf-monitoring counter enable */ -#define CR4_OSFXSR 0x0200 /* OS fxsave/fxrstor support */ -#define CR4_OSXMMEXCPT 0x0400 /* OS unmasked exception support */ - -#define FMT_CR4 \ - "\20\13xmme\12fxsr\11pce\10pge\7mce\6pae\5pse\4de\3tsd\2pvi\1vme" - -/* Intel's SYSENTER configuration registers */ - -#define MSR_INTC_SEP_CS 0x174 /* kernel code selector MSR */ -#define MSR_INTC_SEP_ESP 0x175 /* kernel esp MSR */ -#define MSR_INTC_SEP_EIP 0x176 /* kernel eip MSR */ - -/* AMD's EFER register */ - -#define MSR_AMD_EFER 0xc0000080 /* extended feature enable MSR */ - -#define AMD_EFER_NXE 0x800 /* no-execute enable */ -#define AMD_EFER_LMA 0x400 /* long mode active (read-only) */ -#define AMD_EFER_LME 0x100 /* long mode enable */ -#define AMD_EFER_SCE 0x001 /* system call extensions */ - -#define FMT_AMD_EFER \ - "\20\14nxe\13lma\11lme\1sce" - -/* AMD's SYSCFG register */ - -#define MSR_AMD_SYSCFG 0xc0000010 /* system configuration MSR */ - -#define AMD_SYSCFG_TOM2 0x200000 /* MtrrTom2En */ -#define AMD_SYSCFG_MVDM 0x100000 /* MtrrVarDramEn */ -#define AMD_SYSCFG_MFDM 0x080000 /* MtrrFixDramModEn */ -#define AMD_SYSCFG_MFDE 0x040000 /* MtrrFixDramEn */ - -#define FMT_AMD_SYSCFG \ - "\20\26tom2\25mvdm\24mfdm\23mfde" - -/* AMD's syscall/sysret MSRs */ - -#define MSR_AMD_STAR 0xc0000081 /* %cs:%ss:%cs:%ss:%eip for syscall */ -#define MSR_AMD_LSTAR 0xc0000082 /* target %rip of 64-bit syscall */ -#define MSR_AMD_CSTAR 0xc0000083 /* target %rip of 32-bit syscall */ -#define MSR_AMD_SFMASK 0xc0000084 /* syscall flag mask */ - -/* AMD's FS.base and GS.base MSRs */ - -#define MSR_AMD_FSBASE 0xc0000100 /* 64-bit base address for %fs */ -#define MSR_AMD_GSBASE 0xc0000101 /* 64-bit base address for %gs */ -#define MSR_AMD_KGSBASE 0xc0000102 /* swapgs swaps this with gsbase */ - -/* AMD's configuration MSRs, weakly documented in the revision guide */ - -#define MSR_AMD_DC_CFG 0xc0011022 - -#define AMD_DC_CFG_DIS_CNV_WC_SSO (UINT64_C(1) << 3) -#define AMD_DC_CFG_DIS_SMC_CHK_BUF (UINT64_C(1) << 10) - -/* AMD's HWCR MSR */ - -#define MSR_AMD_HWCR 0xc0010015 - -#define AMD_HWCR_FFDIS 0x00040 /* disable TLB Flush Filter */ -#define AMD_HWCR_MCI_STATUS_WREN 0x40000 /* enable write of MCi_STATUS */ - -/* AMD's NorthBridge Config MSR, SHOULD ONLY BE WRITTEN TO BY BIOS */ - -#define MSR_AMD_NB_CFG 0xc001001f - -#define MSR_BU_CFG 0xc0011023 - -#define AMD_NB_CFG_SRQ_HEARTBEAT (UINT64_C(1) << 20) -#define AMD_NB_CFG_SRQ_SPR (UINT64_C(1) << 32) - -/* AMD */ -#define MSR_AMD_PATCHLEVEL 0x8b - -#ifdef __cplusplus -} -#endif - -#endif /* !_SYS_CONTROLREGS_H */ diff --git a/usr/src/grub/grub-0.95/stage2/cpu.h b/usr/src/grub/grub-0.95/stage2/cpu.h deleted file mode 100644 index 34180727d9..0000000000 --- a/usr/src/grub/grub-0.95/stage2/cpu.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 2006 Free Software Foundation, 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 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. - */ -/* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _AMD64_CPU -#define _AMD64_CPU - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef unsigned int uint_t; -typedef unsigned long ulong_t; - -#define BITX(u, h, l) (((u) >> (l)) & ((1lu << ((h) - (l) + 1lu)) - 1lu)) - -#include - -#define CB 0x0001 - -extern void amd64_flush_tlb(void); -extern void amd64_flush_tlbentry(caddr_t); - -extern ulong_t amd64_get_cr2(void); -extern ulong_t amd64_get_cr0(void); -extern ulong_t amd64_get_cr3(void); -extern ulong_t amd64_get_cr4(void); - -extern ulong_t amd64_get_eflags(void); - -struct amd64_cpuid_regs { - uint32_t r_eax; - uint32_t r_ebx; - uint32_t r_ecx; - uint32_t r_edx; -}; - -#define AMD64_Auth 0x68747541 -#define AMD64_enti 0x69746e65 -#define AMD64_cAMD 0x444d4163 - -extern uint32_t amd64_cpuid_supported(void); -extern void amd64_cpuid_insn(uint32_t, struct amd64_cpuid_regs *); -extern void amd64_rdmsr(uint32_t, uint64_t *); -extern void amd64_wrmsr(uint32_t, const uint64_t *); -extern int get_target_operating_mode(void); - -#ifdef __cplusplus -} -#endif - -#endif /* _AMD64_CPU */ diff --git a/usr/src/grub/grub-0.95/stage2/defs.h b/usr/src/grub/grub-0.95/stage2/defs.h deleted file mode 100644 index aac9207c08..0000000000 --- a/usr/src/grub/grub-0.95/stage2/defs.h +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Mach Operating System - * Copyright (c) 1991,1990 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. - * - * 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 FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie Mellon - * the rights to redistribute these changes. - */ -/* - * Common definitions for Berkeley Fast File System. - */ - -/* - * Compatibility definitions for disk IO. - */ - -/* - * Disk devices do all IO in 512-byte blocks. - */ -#define DEV_BSIZE 512 - -/* - * Conversion between bytes and disk blocks. - */ -#define btodb(byte_offset) ((byte_offset) >> 9) -#define dbtob(block_number) ((block_number) << 9) - -/* - * Compatibility definitions for old type names. - */ - -typedef unsigned char u_char; /* unsigned char */ -typedef unsigned short u_short; /* unsigned short */ -typedef unsigned int u_int; /* unsigned int */ - -#if !defined(__sun) || !defined(GRUB_UTIL) -typedef struct _quad_ - { - unsigned int val[2]; /* 2 int values make... */ - } -quad; /* an 8-byte item */ -#endif /* !__sun || !GRUB_UTIL */ - -typedef unsigned int mach_time_t; /* an unsigned int */ -typedef unsigned int mach_daddr_t; /* an unsigned int */ -typedef unsigned int mach_off_t; /* another unsigned int */ - -typedef unsigned short mach_uid_t; -typedef unsigned short mach_gid_t; -typedef unsigned int mach_ino_t; - -#ifndef NBBY -#define NBBY 8 -#endif - -/* - * The file system is made out of blocks of at most MAXBSIZE units, - * with smaller units (fragments) only in the last direct block. - * MAXBSIZE primarily determines the size of buffers in the buffer - * pool. It may be made larger without any effect on existing - * file systems; however, making it smaller may make some file - * systems unmountable. - * - * Note that the disk devices are assumed to have DEV_BSIZE "sectors" - * and that fragments must be some multiple of this size. - */ -#define MAXBSIZE 8192 -#define MAXFRAG 8 - -/* - * MAXPATHLEN defines the longest permissible path length - * after expanding symbolic links. - * - * MAXSYMLINKS defines the maximum number of symbolic links - * that may be expanded in a path name. It should be set - * high enough to allow all legitimate uses, but halt infinite - * loops reasonably quickly. - */ - -#define MAXPATHLEN 1024 -#define MAXSYMLINKS 8 diff --git a/usr/src/grub/grub-0.95/stage2/dir.h b/usr/src/grub/grub-0.95/stage2/dir.h deleted file mode 100644 index 287bf60298..0000000000 --- a/usr/src/grub/grub-0.95/stage2/dir.h +++ /dev/null @@ -1,147 +0,0 @@ - -/* - * Mach Operating System - * Copyright (c) 1991,1990 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. - * - * 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 FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie Mellon - * the rights to redistribute these changes. - */ -/* - * Copyright (c) 1982, 1986, 1989 The 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 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. - * - * @(#)dir.h 7.6 (Berkeley) 5/9/89 - */ - -#ifndef _BOOT_UFS_DIR_H_ -#define _BOOT_UFS_DIR_H_ - -/* - * A directory consists of some number of blocks of DIRBLKSIZ - * bytes, where DIRBLKSIZ is chosen such that it can be transferred - * to disk in a single atomic operation (e.g. 512 bytes on most machines). - * - * Each DIRBLKSIZ byte block contains some number of directory entry - * structures, which are of variable length. Each directory entry has - * a struct direct at the front of it, containing its inode number, - * the length of the entry, and the length of the name contained in - * the entry. These are followed by the name padded to a 4 byte boundary - * with null bytes. All names are guaranteed null terminated. - * The maximum length of a name in a directory is MAXNAMLEN. - * - * The macro DIRSIZ(dp) gives the amount of space required to represent - * a directory entry. Free space in a directory is represented by - * entries which have dp->d_reclen > DIRSIZ(dp). All DIRBLKSIZ bytes - * in a directory block are claimed by the directory entries. This - * usually results in the last entry in a directory having a large - * dp->d_reclen. When entries are deleted from a directory, the - * space is returned to the previous entry in the same directory - * block by increasing its dp->d_reclen. If the first entry of - * a directory block is free, then its dp->d_ino is set to 0. - * Entries other than the first in a directory do not normally have - * dp->d_ino set to 0. - */ -#define DIRBLKSIZ DEV_BSIZE -#define MAXNAMLEN 255 - -struct direct - { - u_int d_ino; /* inode number of entry */ - u_short d_reclen; /* length of this record */ - u_short d_namlen; /* length of string in d_name */ - char d_name[MAXNAMLEN + 1]; /* name with length <= MAXNAMLEN */ - }; - -/* - * The DIRSIZ macro gives the minimum record length which will hold - * the directory entry. This requires the amount of space in struct direct - * without the d_name field, plus enough space for the name with a terminating - * null byte (dp->d_namlen+1), rounded up to a 4 byte boundary. - */ -#undef DIRSIZ -#define DIRSIZ(dp) \ - ((sizeof (struct direct) - (MAXNAMLEN+1)) + (((dp)->d_namlen+1 + 3) &~ 3)) - -#ifdef KERNEL -/* - * Template for manipulating directories. - * Should use struct direct's, but the name field - * is MAXNAMLEN - 1, and this just won't do. - */ -struct dirtemplate - { - u_int dot_ino; - short dot_reclen; - short dot_namlen; - char dot_name[4]; /* must be multiple of 4 */ - u_int dotdot_ino; - short dotdot_reclen; - short dotdot_namlen; - char dotdot_name[4]; /* ditto */ - }; -#endif - -/* - * The following information should be obtained from - * and is provided solely (and temporarily) for backward compatibility. - */ -#ifndef KERNEL -#define d_fileno d_ino /* compatibility with POSIX */ -#ifndef DEV_BSIZE -#define DEV_BSIZE 512 -#endif -/* - * Definitions for library routines operating on directories. - */ -typedef struct _dirdesc - { - int dd_fd; - int dd_loc; - int dd_size; - char dd_buf[DIRBLKSIZ]; - } -DIR; - -#define dirfd(dirp) ((dirp)->dd_fd) - -#ifndef NULL -#define NULL 0 -#endif -extern DIR *opendir (); -extern struct direct *readdir (); -extern int telldir (); -extern void seekdir (); -#define rewinddir(dirp) seekdir((dirp), (long)0) -extern void closedir (); -#endif /* not KERNEL */ -#endif /* _BOOT_UFS_DIR_H_ */ diff --git a/usr/src/grub/grub-0.95/stage2/disk_inode.h b/usr/src/grub/grub-0.95/stage2/disk_inode.h deleted file mode 100644 index 2103cb86a4..0000000000 --- a/usr/src/grub/grub-0.95/stage2/disk_inode.h +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Mach Operating System - * Copyright (c) 1991,1990 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. - * - * 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 FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie Mellon - * the rights to redistribute these changes. - */ -/* - * Copyright (c) 1982, 1989 The 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 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. - * - * @(#)inode.h 7.5 (Berkeley) 7/3/89 - */ - -#ifndef _BOOT_UFS_DISK_INODE_H_ -#define _BOOT_UFS_DISK_INODE_H_ - -/* - * The I node is the focus of all file activity in the BSD Fast File System. - * There is a unique inode allocated for each active file, - * each current directory, each mounted-on file, text file, and the root. - * An inode is 'named' by its dev/inumber pair. (iget/iget.c) - * Data in icommon is read in from permanent inode on volume. - */ - -#define FFS_NDADDR 12 /* direct addresses in inode */ -#define FFS_NIADDR 3 /* indirect addresses in inode */ - -#define FFS_MAX_FASTLINK_SIZE ((FFS_NDADDR + FFS_NIADDR) \ - * sizeof (mach_daddr_t)) - -struct icommon - { - u_short ic_mode; /* 0: mode and type of file */ - short ic_nlink; /* 2: number of links to file */ - mach_uid_t ic_uid; /* 4: owner's user id */ - mach_gid_t ic_gid; /* 6: owner's group id */ - quad ic_size; /* 8: number of bytes in file */ - mach_time_t ic_atime; /* 16: time last accessed */ - int ic_atspare; - mach_time_t ic_mtime; /* 24: time last modified */ - int ic_mtspare; - mach_time_t ic_ctime; /* 32: last time inode changed */ - int ic_ctspare; - union - { - struct - { - mach_daddr_t Mb_db[FFS_NDADDR]; /* 40: disk block addresses */ - mach_daddr_t Mb_ib[FFS_NIADDR]; /* 88: indirect blocks */ - } - ic_Mb; - char ic_Msymlink[FFS_MAX_FASTLINK_SIZE]; - /* 40: symbolic link name */ - } - ic_Mun; -#define ic_db ic_Mun.ic_Mb.Mb_db -#define ic_ib ic_Mun.ic_Mb.Mb_ib -#define ic_symlink ic_Mun.ic_Msymlink - int ic_flags; /* 100: status, currently unused */ - int ic_blocks; /* 104: blocks actually held */ - int ic_gen; /* 108: generation number */ - int ic_spare[4]; /* 112: reserved, currently unused */ - }; - -/* - * Same structure, but on disk. - */ -struct dinode - { - union - { - struct icommon di_com; - char di_char[128]; - } - di_un; - }; -#define di_ic di_un.di_com - -#endif /* _BOOT_UFS_DISK_INODE_H_ */ diff --git a/usr/src/grub/grub-0.95/stage2/disk_inode_ffs.h b/usr/src/grub/grub-0.95/stage2/disk_inode_ffs.h deleted file mode 100644 index 1c8caa1588..0000000000 --- a/usr/src/grub/grub-0.95/stage2/disk_inode_ffs.h +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Mach Operating System - * Copyright (c) 1991,1990 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. - * - * 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 FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie Mellon - * the rights to redistribute these changes. - */ -/* - * Copyright (c) 1982, 1989 The 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 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. - * - * @(#)inode.h 7.5 (Berkeley) 7/3/89 - */ - -#ifndef _BOOT_UFS_DISK_INODE_FFS_H_ -#define _BOOT_UFS_DISK_INODE_FFS_H_ - -#define NDADDR FFS_NDADDR -#define NIADDR FFS_NIADDR - -#define MAX_FASTLINK_SIZE FFS_MAX_FASTLINK_SIZE - -#define IC_FASTLINK 0x0001 /* Symbolic link in inode */ - -#define i_mode ic_mode -#define i_nlink ic_nlink -#define i_uid ic_uid -#define i_gid ic_gid -#if defined(BYTE_MSF) && BYTE_MSF -#define i_size ic_size.val[1] -#else /* BYTE_LSF */ -#define i_size ic_size.val[0] -#endif -#define i_db ic_db -#define i_ib ic_ib -#define i_atime ic_atime -#define i_mtime ic_mtime -#define i_ctime ic_ctime -#define i_blocks ic_blocks -#define i_rdev ic_db[0] -#define i_symlink ic_symlink -#define i_flags ic_flags -#define i_gen ic_gen - -/* modes */ -#define IFMT 0xf000 /* type of file */ -#define IFCHR 0x2000 /* character special */ -#define IFDIR 0x4000 /* directory */ -#define IFBLK 0x6000 /* block special */ -#define IFREG 0x8000 /* regular */ -#define IFLNK 0xa000 /* symbolic link */ -#define IFSOCK 0xc000 /* socket */ - - -#define ISUID 0x0800 /* set user id on execution */ -#define ISGID 0x0400 /* set group id on execution */ -#define ISVTX 0x0200 /* save swapped text even after use */ -#define IREAD 0x0100 /* read, write, execute permissions */ -#define IWRITE 0x0080 -#define IEXEC 0x0040 - -#ifdef EEK -#define f_fs u.ffs.ffs_fs -#define i_ic u.ffs.ffs_ic -#define f_nindir u.ffs.ffs_nindir -#define f_blk u.ffs.ffs_blk -#define f_blksize u.ffs.ffs_blksize -#define f_blkno u.ffs.ffs_blkno -#endif /* EEK */ - -#endif /* _BOOT_UFS_DISK_INODE_FFS_H_ */ diff --git a/usr/src/grub/grub-0.95/stage2/disk_io.c b/usr/src/grub/grub-0.95/stage2/disk_io.c deleted file mode 100644 index c3497cc518..0000000000 --- a/usr/src/grub/grub-0.95/stage2/disk_io.c +++ /dev/null @@ -1,1876 +0,0 @@ -/* disk_io.c - implement abstract BIOS disk input and output */ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, 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 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 -#include - -#ifdef SUPPORT_NETBOOT -# include -#endif - -#ifdef GRUB_UTIL -# include -#endif - -/* instrumentation variables */ -void (*disk_read_hook) (unsigned int, int, int) = NULL; -void (*disk_read_func) (unsigned int, int, int) = NULL; - -#ifndef STAGE1_5 -int print_possibilities; - -static int do_completion; -static int unique; -static char *unique_string; - -#endif - -int fsmax; -struct fsys_entry fsys_table[NUM_FSYS + 1] = -{ - /* TFTP should come first because others don't handle net device. */ -# ifdef FSYS_TFTP - {"tftp", tftp_mount, tftp_read, tftp_dir, tftp_close, 0}, -# endif -# ifdef FSYS_FAT - {"fat", fat_mount, fat_read, fat_dir, 0, 0}, -# endif -# ifdef FSYS_EXT2FS - {"ext2fs", ext2fs_mount, ext2fs_read, ext2fs_dir, 0, 0}, -# endif -# ifdef FSYS_MINIX - {"minix", minix_mount, minix_read, minix_dir, 0, 0}, -# endif -# ifdef FSYS_REISERFS - {"reiserfs", reiserfs_mount, reiserfs_read, reiserfs_dir, 0, reiserfs_embed}, -# endif -# ifdef FSYS_VSTAFS - {"vstafs", vstafs_mount, vstafs_read, vstafs_dir, 0, 0}, -# endif -# ifdef FSYS_JFS - {"jfs", jfs_mount, jfs_read, jfs_dir, 0, jfs_embed}, -# endif -# ifdef FSYS_XFS - {"xfs", xfs_mount, xfs_read, xfs_dir, 0, 0}, -# endif -# ifdef FSYS_UFS - {"ufs", ufs_mount, ufs_read, ufs_dir, 0, ufs_embed}, -# endif -# ifdef FSYS_UFS2 - {"ufs2", ufs2_mount, ufs2_read, ufs2_dir, 0, ufs2_embed}, -# endif -# ifdef FSYS_ZFS - {"zfs", zfs_mount, zfs_read, zfs_open, 0, zfs_embed}, -# endif -# ifdef FSYS_ISO9660 - {"iso9660", iso9660_mount, iso9660_read, iso9660_dir, 0, 0}, -# endif - /* XX FFS should come last as it's superblock is commonly crossing tracks - on floppies from track 1 to 2, while others only use 1. */ -# ifdef FSYS_FFS - {"ffs", ffs_mount, ffs_read, ffs_dir, 0, ffs_embed}, -# endif - {0, 0, 0, 0, 0, 0} -}; - - -/* These have the same format as "boot_drive" and "install_partition", but - are meant to be working values. */ -unsigned long current_drive = GRUB_INVALID_DRIVE; -unsigned long current_partition; - -#ifndef STAGE1_5 -/* The register ESI should contain the address of the partition to be - used for loading a chain-loader when chain-loading the loader. */ -unsigned long boot_part_addr = 0; -#endif - -/* - * Global variables describing details of the filesystem - */ - -/* FIXME: BSD evil hack */ -#include "freebsd.h" -int bsd_evil_hack; - -/* filesystem type */ -int fsys_type = NUM_FSYS; -#ifndef NO_BLOCK_FILES -static int block_file = 0; -#endif /* NO_BLOCK_FILES */ - -/* these are the translated numbers for the open partition */ -unsigned long part_start; -unsigned long part_length; - -int current_slice; - -/* ZFS root filesystem for booting */ -char current_bootpath[MAXNAMELEN]; -char current_rootpool[MAXNAMELEN]; -char current_bootfs[MAXNAMELEN]; -uint64_t current_bootfs_obj; -char current_devid[MAXNAMELEN]; -int is_zfs_mount; -unsigned long best_drive; -unsigned long best_part; -int find_best_root; - -/* disk buffer parameters */ -int buf_drive = -1; -unsigned int buf_track; -struct geometry buf_geom; - -/* filesystem common variables */ -int filepos; -int filemax; - -static inline unsigned long -grub_log2 (unsigned long word) -{ - asm volatile ("bsfl %1,%0" - : "=r" (word) - : "r" (word)); - return word; -} -#define log2 grub_log2 - -int -rawread(int drive, unsigned int sector, int byte_offset, int byte_len, - char *buf) -{ - int slen, sectors_per_vtrack; - int sector_size_bits = log2 (buf_geom.sector_size); - - if (byte_len <= 0) - return 1; - - while (byte_len > 0 && !errnum) - { - int soff, num_sect, size = byte_len; - unsigned int track; - char *bufaddr; - - /* - * Check track buffer. If it isn't valid or it is from the - * wrong disk, then reset the disk geometry. - */ - if (buf_drive != drive) - { - if (get_diskinfo (drive, &buf_geom)) - { - errnum = ERR_NO_DISK; - return 0; - } - buf_drive = drive; - buf_track = BUF_CACHE_INVALID; - sector_size_bits = log2 (buf_geom.sector_size); - } - - /* Make sure that SECTOR is valid. */ - if (sector >= buf_geom.total_sectors) - { - errnum = ERR_GEOM; - return 0; - } - - slen = ((byte_offset + byte_len + buf_geom.sector_size - 1) - >> sector_size_bits); - - /* Eliminate a buffer overflow. */ - if ((buf_geom.sectors << sector_size_bits) > BUFFERLEN) - sectors_per_vtrack = (BUFFERLEN >> sector_size_bits); - else - sectors_per_vtrack = buf_geom.sectors; - - /* Get the first sector of track. */ - soff = sector % sectors_per_vtrack; - track = sector - soff; - num_sect = sectors_per_vtrack - soff; - bufaddr = ((char *) BUFFERADDR - + (soff << sector_size_bits) + byte_offset); - - if (track != buf_track) - { - int bios_err, read_len = sectors_per_vtrack; - unsigned int read_start = track; - - /* - * If there's more than one read in this entire loop, then - * only make the earlier reads for the portion needed. This - * saves filling the buffer with data that won't be used! - */ - if (slen > num_sect) - { - read_start = sector; - read_len = num_sect; - bufaddr = (char *) BUFFERADDR + byte_offset; - } - - bios_err = biosdisk (BIOSDISK_READ, drive, &buf_geom, - read_start, read_len, BUFFERSEG); - if (bios_err) - { - buf_track = BUF_CACHE_INVALID; - - if (bios_err == BIOSDISK_ERROR_GEOMETRY) - errnum = ERR_GEOM; - else - { - /* - * If there was an error, try to load only the - * required sector(s) rather than failing completely. - */ - if (slen > num_sect - || biosdisk (BIOSDISK_READ, drive, &buf_geom, - sector, slen, BUFFERSEG)) - errnum = ERR_READ; - - bufaddr = (char *) BUFFERADDR + byte_offset; - } - } - else - buf_track = track; - - if ((buf_track == 0 || sector == 0) - && (PC_SLICE_TYPE (BUFFERADDR, 0) == PC_SLICE_TYPE_EZD - || PC_SLICE_TYPE (BUFFERADDR, 1) == PC_SLICE_TYPE_EZD - || PC_SLICE_TYPE (BUFFERADDR, 2) == PC_SLICE_TYPE_EZD - || PC_SLICE_TYPE (BUFFERADDR, 3) == PC_SLICE_TYPE_EZD)) - { - /* This is a EZD disk map sector 0 to sector 1 */ - if (buf_track == 0 || slen >= 2) - { - /* We already read the sector 1, copy it to sector 0 */ - memmove ((char *) BUFFERADDR, - (char *) BUFFERADDR + buf_geom.sector_size, - buf_geom.sector_size); - } - else - { - if (biosdisk (BIOSDISK_READ, drive, &buf_geom, - 1, 1, BUFFERSEG)) - errnum = ERR_READ; - } - } - } - - if (size > ((num_sect << sector_size_bits) - byte_offset)) - size = (num_sect << sector_size_bits) - byte_offset; - - /* - * Instrumentation to tell which sectors were read and used. - */ - if (disk_read_func) - { - unsigned int sector_num = sector; - int length = buf_geom.sector_size - byte_offset; - if (length > size) - length = size; - (*disk_read_func) (sector_num++, byte_offset, length); - length = size - length; - if (length > 0) - { - while (length > buf_geom.sector_size) - { - (*disk_read_func) (sector_num++, 0, buf_geom.sector_size); - length -= buf_geom.sector_size; - } - (*disk_read_func) (sector_num, 0, length); - } - } - - grub_memmove (buf, bufaddr, size); - - buf += size; - byte_len -= size; - sector += num_sect; - byte_offset = 0; - } - - return (!errnum); -} - - -int -devread(unsigned int sector, int byte_offset, int byte_len, char *buf) -{ - /* - * Check partition boundaries - */ - if ((sector + ((byte_offset + byte_len - 1) >> SECTOR_BITS)) - >= part_length) - { - errnum = ERR_OUTSIDE_PART; - return 0; - } - - /* - * Get the read to the beginning of a partition. - */ - sector += byte_offset >> SECTOR_BITS; - byte_offset &= SECTOR_SIZE - 1; - -#if !defined(STAGE1_5) - if (disk_read_hook && debug) - printf ("<%u, %d, %d>", sector, byte_offset, byte_len); -#endif /* !STAGE1_5 */ - - /* - * Call RAWREAD, which is very similar, but: - * - * -- It takes an extra parameter, the drive number. - * -- It requires that "sector" is relative to the beginning - * of the disk. - * -- It doesn't handle offsets of more than 511 bytes into the - * sector. - */ - return rawread (current_drive, part_start + sector, byte_offset, - byte_len, buf); -} - -#ifndef STAGE1_5 -int -rawwrite(int drive, unsigned int sector, char *buf) -{ - if (sector == 0) - { - if (biosdisk (BIOSDISK_READ, drive, &buf_geom, 0, 1, SCRATCHSEG)) - { - errnum = ERR_WRITE; - return 0; - } - - if (PC_SLICE_TYPE (SCRATCHADDR, 0) == PC_SLICE_TYPE_EZD - || PC_SLICE_TYPE (SCRATCHADDR, 1) == PC_SLICE_TYPE_EZD - || PC_SLICE_TYPE (SCRATCHADDR, 2) == PC_SLICE_TYPE_EZD - || PC_SLICE_TYPE (SCRATCHADDR, 3) == PC_SLICE_TYPE_EZD) - sector = 1; - } - - memmove ((char *) SCRATCHADDR, buf, SECTOR_SIZE); - if (biosdisk (BIOSDISK_WRITE, drive, &buf_geom, - sector, 1, SCRATCHSEG)) - { - errnum = ERR_WRITE; - return 0; - } - - if (sector - sector % buf_geom.sectors == buf_track) - /* Clear the cache. */ - buf_track = BUF_CACHE_INVALID; - - return 1; -} - -int -devwrite(unsigned int sector, int sector_count, char *buf) -{ -#if defined(GRUB_UTIL) && defined(__linux__) - if (current_partition != 0xFFFFFF - && is_disk_device (device_map, current_drive)) - { - /* If the grub shell is running under Linux and the user wants to - embed a Stage 1.5 into a partition instead of a MBR, use system - calls directly instead of biosdisk, because of the bug in - Linux. *sigh* */ - return write_to_partition (device_map, current_drive, current_partition, - sector, sector_count, buf); - } - else -#endif /* GRUB_UTIL && __linux__ */ - { - int i; - - for (i = 0; i < sector_count; i++) - { - if (! rawwrite (current_drive, part_start + sector + i, - buf + (i << SECTOR_BITS))) - return 0; - - } - return 1; - } -} - -static int -sane_partition (void) -{ - /* network drive */ - if (current_drive == NETWORK_DRIVE) - return 1; - - if (!(current_partition & 0xFF000000uL) - && ((current_drive & 0xFFFFFF7F) < 8 - || current_drive == cdrom_drive) - && (current_partition & 0xFF) == 0xFF - && ((current_partition & 0xFF00) == 0xFF00 - || (current_partition & 0xFF00) < 0x1000) - && ((current_partition >> 16) == 0xFF - || (current_drive & 0x80))) - return 1; - - errnum = ERR_DEV_VALUES; - return 0; -} -#endif /* ! STAGE1_5 */ - -static void -attempt_mount (void) -{ -#ifndef STAGE1_5 - for (fsys_type = 0; fsys_type < NUM_FSYS; fsys_type++) - if ((fsys_table[fsys_type].mount_func) ()) - break; - - if (fsys_type == NUM_FSYS && errnum == ERR_NONE) - errnum = ERR_FSYS_MOUNT; -#else - fsys_type = 0; - if ((*(fsys_table[fsys_type].mount_func)) () != 1) - { - fsys_type = NUM_FSYS; - errnum = ERR_FSYS_MOUNT; - } -#endif -} - - -#ifndef STAGE1_5 -/* Turn on the active flag for the partition SAVED_PARTITION in the - drive SAVED_DRIVE. If an error occurs, return zero, otherwise return - non-zero. */ -int -make_saved_active (void) -{ - char mbr[512]; - - if (saved_drive & 0x80) - { - /* Hard disk */ - int part = saved_partition >> 16; - - /* If the partition is not a primary partition, the active flag is - meaningless. (XXX: Really?) */ - if (part > 3) - { - errnum = ERR_DEV_VALUES; - return 0; - } - - /* Read the MBR in the scratch space. */ - if (! rawread (saved_drive, 0, 0, SECTOR_SIZE, mbr)) - return 0; - - /* If the partition is an extended partition, setting the active - flag violates the specification by IBM. */ - if (IS_PC_SLICE_TYPE_EXTENDED (PC_SLICE_TYPE (mbr, part))) - { - errnum = ERR_DEV_VALUES; - return 0; - } - - /* Check if the active flag is disabled. */ - if (PC_SLICE_FLAG (mbr, part) != PC_SLICE_FLAG_BOOTABLE) - { - int i; - - /* Clear all the active flags in this table. */ - for (i = 0; i < 4; i++) - PC_SLICE_FLAG (mbr, i) = 0; - - /* Set the flag. */ - PC_SLICE_FLAG (mbr, part) = PC_SLICE_FLAG_BOOTABLE; - - /* Write back the MBR. */ - if (! rawwrite (saved_drive, 0, mbr)) - return 0; - } - } - else - { - /* If the drive is not a hard disk drive, you shouldn't call this - function. (XXX: Should I just ignore this error?) */ - errnum = ERR_DEV_VALUES; - return 0; - } - - return 1; -} - -/* Hide/Unhide CURRENT_PARTITION. */ -int -set_partition_hidden_flag (int hidden) -{ - unsigned long part = 0xFFFFFF; - unsigned long start, len, offset, ext_offset; - int entry, type; - char mbr[512]; - - /* The drive must be a hard disk. */ - if (! (current_drive & 0x80)) - { - errnum = ERR_BAD_ARGUMENT; - return 1; - } - - /* The partition must be a PC slice. */ - if ((current_partition >> 16) == 0xFF - || (current_partition & 0xFFFF) != 0xFFFF) - { - errnum = ERR_BAD_ARGUMENT; - return 1; - } - - /* Look for the partition. */ - while (next_partition (current_drive, 0xFFFFFF, &part, &type, - &start, &len, &offset, &entry, - &ext_offset, mbr)) - { - if (part == current_partition) - { - /* Found. */ - if (hidden) - PC_SLICE_TYPE (mbr, entry) |= PC_SLICE_TYPE_HIDDEN_FLAG; - else - PC_SLICE_TYPE (mbr, entry) &= ~PC_SLICE_TYPE_HIDDEN_FLAG; - - /* Write back the MBR to the disk. */ - buf_track = BUF_CACHE_INVALID; - if (! rawwrite (current_drive, offset, mbr)) - return 1; - - /* Succeed. */ - return 0; - } - } - - return 1; -} - - -static void -check_and_print_mount (void) -{ - attempt_mount (); - if (errnum == ERR_FSYS_MOUNT) - errnum = ERR_NONE; - if (!errnum) - print_fsys_type (); - print_error (); -} -#endif /* STAGE1_5 */ - - -/* Get the information on next partition on the drive DRIVE. - The caller must not modify the contents of the arguments when - iterating this function. The partition representation in GRUB will - be stored in *PARTITION. Likewise, the partition type in *TYPE, the - start sector in *START, the length in *LEN, the offset of the - partition table in *OFFSET, the entry number in the table in *ENTRY, - the offset of the extended partition in *EXT_OFFSET. - BUF is used to store a MBR, the boot sector of a partition, or - a BSD label sector, and it must be at least 512 bytes length. - When calling this function first, *PARTITION must be initialized to - 0xFFFFFF. The return value is zero if fails, otherwise non-zero. */ -int -next_partition (unsigned long drive, unsigned long dest, - unsigned long *partition, int *type, - unsigned long *start, unsigned long *len, - unsigned long *offset, int *entry, - unsigned long *ext_offset, char *buf) -{ - /* Forward declarations. */ - auto int next_bsd_partition (void); - auto int next_solaris_partition(void); - auto int next_pc_slice (void); - - /* Get next BSD partition in current PC slice. */ - int next_bsd_partition (void) - { - int i; - int bsd_part_no = (*partition & 0xFF00) >> 8; - - /* If this is the first time... */ - if (bsd_part_no == 0xFF) - { - /* Check if the BSD label is within current PC slice. */ - if (*len < BSD_LABEL_SECTOR + 1) - { - errnum = ERR_BAD_PART_TABLE; - return 0; - } - - /* Read the BSD label. */ - if (! rawread (drive, *start + BSD_LABEL_SECTOR, - 0, SECTOR_SIZE, buf)) - return 0; - - /* Check if it is valid. */ - if (! BSD_LABEL_CHECK_MAG (buf)) - { - errnum = ERR_BAD_PART_TABLE; - return 0; - } - - bsd_part_no = -1; - } - - /* Search next valid BSD partition. */ - for (i = bsd_part_no + 1; i < BSD_LABEL_NPARTS (buf); i++) - { - if (BSD_PART_TYPE (buf, i)) - { - /* Note that *TYPE and *PARTITION were set - for current PC slice. */ - *type = (BSD_PART_TYPE (buf, i) << 8) | (*type & 0xFF); - *start = BSD_PART_START (buf, i); - *len = BSD_PART_LENGTH (buf, i); - *partition = (*partition & 0xFF00FF) | (i << 8); - -#ifndef STAGE1_5 - /* XXX */ - if ((drive & 0x80) && BSD_LABEL_DTYPE (buf) == DTYPE_SCSI) - bsd_evil_hack = 4; -#endif /* ! STAGE1_5 */ - - return 1; - } - } - - errnum = ERR_NO_PART; - return 0; - } - - /* Get next Solaris partition in current PC slice. */ - int next_solaris_partition (void) - { - static unsigned long pcs_start; - int i; - int sol_part_no = (*partition & 0xFF00) >> 8; - - /* If this is the first time... */ - if (sol_part_no == 0xFF) - { - /* Check if the Solaris label is within current PC slice. */ - if (*len < SOL_LABEL_LOC + 1) - { - errnum = ERR_BAD_PART_TABLE; - return 0; - } - - /* Read the Solaris label. */ - if (! rawread (drive, *start + SOL_LABEL_LOC, 0, SECTOR_SIZE, buf)) - return 0; - - /* Check if it is valid. */ - if (! SOL_LABEL_CHECK_MAG (buf)) - { - errnum = ERR_BAD_PART_TABLE; - return 0; - } - - sol_part_no = -1; - pcs_start = *start; /* save the start of pc slice */ - } - - /* Search next valid Solaris partition. */ - for (i = sol_part_no + 1; i < SOL_LABEL_NPARTS; i++) - { - if (SOL_PART_EXISTS (buf, i)) - { - /* SOL_PART_START is relative to fdisk partition */ - *start = SOL_PART_START (buf, i) + pcs_start; - *len = SOL_PART_LENGTH (buf, i); - *partition = (*partition & 0xFF00FF) | (i << 8); - - return 1; - } - } - - errnum = ERR_NO_PART; - return 0; - } - - /* Get next PC slice. Be careful of that this function may return - an empty PC slice (i.e. a partition whose type is zero) as well. */ - int next_pc_slice (void) - { - int pc_slice_no = (*partition & 0xFF0000) >> 16; - - /* If this is the first time... */ - if (pc_slice_no == 0xFF) - { - *offset = 0; - *ext_offset = 0; - *entry = -1; - pc_slice_no = -1; - } - - /* Read the MBR or the boot sector of the extended partition. */ - if (! rawread (drive, *offset, 0, SECTOR_SIZE, buf)) - return 0; - - /* Check if it is valid. */ - if (! PC_MBR_CHECK_SIG (buf)) - { - errnum = ERR_BAD_PART_TABLE; - return 0; - } - - /* Increase the entry number. */ - (*entry)++; - - /* If this is out of current partition table... */ - if (*entry == PC_SLICE_MAX) - { - int i; - - /* Search the first extended partition in current table. */ - for (i = 0; i < PC_SLICE_MAX; i++) - { - if (IS_PC_SLICE_TYPE_EXTENDED (PC_SLICE_TYPE (buf, i))) - { - /* Found. Set the new offset and the entry number, - and restart this function. */ - *offset = *ext_offset + PC_SLICE_START (buf, i); - if (! *ext_offset) - *ext_offset = *offset; - *entry = -1; - return next_pc_slice (); - } - } - - errnum = ERR_NO_PART; - return 0; - } - - *type = PC_SLICE_TYPE (buf, *entry); - *start = *offset + PC_SLICE_START (buf, *entry); - *len = PC_SLICE_LENGTH (buf, *entry); - - /* The calculation of a PC slice number is complicated, because of - the rather odd definition of extended partitions. Even worse, - there is no guarantee that this is consistent with every - operating systems. Uggh. */ - if (pc_slice_no < PC_SLICE_MAX - || (! IS_PC_SLICE_TYPE_EXTENDED (*type) - && *type != PC_SLICE_TYPE_NONE)) - pc_slice_no++; - - *partition = (pc_slice_no << 16) | 0xFFFF; - return 1; - } - - /* Start the body of this function. */ - -#ifndef STAGE1_5 - if (current_drive == NETWORK_DRIVE) - return 0; -#endif - - /* check for Solaris partition */ - if (*partition != 0xFFFFFF && IS_PC_SLICE_TYPE_SOLARIS (*type & 0xff)) - { - if (next_solaris_partition ()) - return 1; - errnum = ERR_NONE; - } - - /* If previous partition is a BSD partition or a PC slice which - contains BSD partitions... */ - if ((*partition != 0xFFFFFF && IS_PC_SLICE_TYPE_BSD (*type & 0xff)) - || ! (drive & 0x80)) - { - if (*type == PC_SLICE_TYPE_NONE) - *type = PC_SLICE_TYPE_FREEBSD; - - /* Get next BSD partition, if any. */ - if (next_bsd_partition ()) - return 1; - - /* If the destination partition is a BSD partition and current - BSD partition has any error, abort the operation. */ - if ((dest & 0xFF00) != 0xFF00 - && ((dest & 0xFF0000) == 0xFF0000 - || (dest & 0xFF0000) == (*partition & 0xFF0000))) - return 0; - - /* Ignore the error. */ - errnum = ERR_NONE; - } - - return next_pc_slice (); -} - -#ifndef STAGE1_5 -static unsigned long cur_part_offset; -static unsigned long cur_part_addr; -#endif - -/* Open a partition. */ -int -real_open_partition (int flags) -{ - unsigned long dest_partition = current_partition; - unsigned long part_offset; - unsigned long ext_offset; - int entry; - char buf[SECTOR_SIZE]; - int unix_part, pc_slice; - - /* For simplicity. */ - auto int next (void); - int next (void) - { - int ret = next_partition (current_drive, dest_partition, - ¤t_partition, ¤t_slice, - &part_start, &part_length, - &part_offset, &entry, &ext_offset, buf); - unix_part = (current_partition >> 8) & 0xFF; - pc_slice = current_partition >> 16; - return ret; - } - -#ifndef STAGE1_5 - /* network drive */ - if (current_drive == NETWORK_DRIVE) - return 1; - - if (! sane_partition ()) - return 0; -#endif - - bsd_evil_hack = 0; - current_slice = 0; - part_start = 0; - - /* Make sure that buf_geom is valid. */ - if (buf_drive != current_drive) - { - if (get_diskinfo (current_drive, &buf_geom)) - { - errnum = ERR_NO_DISK; - return 0; - } - buf_drive = current_drive; - buf_track = BUF_CACHE_INVALID; - } - part_length = buf_geom.total_sectors; - - /* If this is the whole disk, return here. */ - if (! flags && current_partition == 0xFFFFFF) - return 1; - - if (flags) - dest_partition = 0xFFFFFF; - - /* Initialize CURRENT_PARTITION for next_partition. */ - current_partition = 0xFFFFFF; - - while (next ()) - { -#ifndef STAGE1_5 - loop_start: - - cur_part_offset = part_offset; - cur_part_addr = BOOT_PART_TABLE + (entry << 4); -#endif /* ! STAGE1_5 */ - - /* If this is a valid partition... */ - if (current_slice) - { -#ifndef STAGE1_5 - /* Display partition information. */ - if (flags && ! IS_PC_SLICE_TYPE_EXTENDED (current_slice)) - { - if (! do_completion) - { - if (current_drive & 0x80) - grub_printf (" Partition num: %d, ", - current_partition >> 16); - - if (! IS_PC_SLICE_TYPE_BSD (current_slice) && - ! IS_PC_SLICE_TYPE_SOLARIS (current_slice)) - check_and_print_mount (); - else - { - int got_part = 0; - int saved_slice = current_slice; - - while (next ()) - { - if (unix_part == 0xFF) - break; - - if (! got_part) - { - grub_printf ("[BSD/SOLARIS sub-partitions immediately follow]\n"); - got_part = 1; - } - - grub_printf (" BSD/SOLARIS Partition num: \'%c\', ", - unix_part + 'a'); - check_and_print_mount (); - } - - if (! got_part) - grub_printf (" No BSD/SOLARIS sub-partition found, partition type 0x%x\n", - saved_slice); - - if (errnum) - { - errnum = ERR_NONE; - break; - } - - goto loop_start; - } - } - else - { - if (unix_part != 0xFF) - { - char str[16]; - - if (! (current_drive & 0x80) - || (dest_partition >> 16) == pc_slice) - grub_sprintf (str, "%c)", unix_part + 'a'); - else - grub_sprintf (str, "%d,%c)", - pc_slice, unix_part + 'a'); - print_a_completion (str); - } - else if (! IS_PC_SLICE_TYPE_BSD (current_slice) && - ! IS_PC_SLICE_TYPE_SOLARIS (current_slice)) - { - char str[8]; - - grub_sprintf (str, "%d)", pc_slice); - print_a_completion (str); - } - } - } - - errnum = ERR_NONE; -#endif /* ! STAGE1_5 */ - - /* Check if this is the destination partition. */ - if (! flags - && (dest_partition == current_partition - || ((dest_partition >> 16) == 0xFF - && ((dest_partition >> 8) & 0xFF) == unix_part))) - return 1; - } - } - -#ifndef STAGE1_5 - if (flags) - { - if (! (current_drive & 0x80)) - { - current_partition = 0xFFFFFF; - check_and_print_mount (); - } - - errnum = ERR_NONE; - return 1; - } -#endif /* ! STAGE1_5 */ - - return 0; -} - - -int -open_partition (void) -{ - return real_open_partition (0); -} - - -#ifndef STAGE1_5 -/* XX used for device completion in 'set_device' and 'print_completions' */ -static int incomplete, disk_choice; -static enum -{ - PART_UNSPECIFIED = 0, - PART_DISK, - PART_CHOSEN, -} -part_choice; -#endif /* ! STAGE1_5 */ - -int -set_bootfs(char *fsname) -{ - grub_memmove(current_bootfs, fsname, MAXNAMELEN); -} - -char * -set_device (char *device) -{ -#ifdef STAGE1_5 - /* In Stage 1.5, the first 4 bytes of FILENAME has a device number. */ - unsigned long dev = *((unsigned long *) device); - int drive = (dev >> 24) & 0xFF; - int partition = dev & 0xFFFFFF; - - /* If DRIVE is disabled, use SAVED_DRIVE instead. */ - if (drive == GRUB_INVALID_DRIVE) - current_drive = saved_drive; - else - current_drive = drive; - - /* The `partition' part must always have a valid number. */ - current_partition = partition; - - return device + sizeof (unsigned long); - -#else /* ! STAGE1_5 */ - - int result = 0; - - incomplete = 0; - disk_choice = 1; - part_choice = PART_UNSPECIFIED; - current_drive = saved_drive; - current_partition = 0xFFFFFF; - - if (*device == '(' && !*(device + 1)) - /* user has given '(' only, let disk_choice handle what disks we have */ - return device + 1; - - if (*device == '(' && *(++device)) - { - if (*device != ',' && *device != ')') - { - char ch = *device; -#ifdef SUPPORT_NETBOOT - if (*device == 'f' || *device == 'h' - || (*device == 'n' && network_ready) - || (*device == 'c' && cdrom_drive != GRUB_INVALID_DRIVE)) -#else - if (*device == 'f' || *device == 'h' - || (*device == 'c' && cdrom_drive != GRUB_INVALID_DRIVE)) -#endif /* SUPPORT_NETBOOT */ - { - /* user has given '([fhn]', check for resp. add 'd' and - let disk_choice handle what disks we have */ - if (!*(device + 1)) - { - device++; - *device++ = 'd'; - *device = '\0'; - return device; - } - else if (*(device + 1) == 'd' && !*(device + 2)) - return device + 2; - } - - if ((*device == 'f' - || *device == 'h' -#ifdef SUPPORT_NETBOOT - || (*device == 'n' && network_ready) -#endif - || (*device == 'c' && cdrom_drive != GRUB_INVALID_DRIVE)) - && (device += 2, (*(device - 1) != 'd'))) - errnum = ERR_NUMBER_PARSING; - -#ifdef SUPPORT_NETBOOT - if (ch == 'n' && network_ready) - current_drive = NETWORK_DRIVE; - else -#endif /* SUPPORT_NETBOOT */ - { - if (ch == 'c' && cdrom_drive != GRUB_INVALID_DRIVE) - current_drive = cdrom_drive; - else - { - safe_parse_maxint (&device, (int *) ¤t_drive); - - disk_choice = 0; - if (ch == 'h') - current_drive += 0x80; - } - } - } - - if (errnum) - return 0; - - if (*device == ')') - { - part_choice = PART_CHOSEN; - result = 1; - } - else if (*device == ',') - { - /* Either an absolute PC, BSD, or Solaris partition. */ - disk_choice = 0; - part_choice ++; - device++; - - if (*device >= '0' && *device <= '9') - { - part_choice ++; - current_partition = 0; - - if (!(current_drive & 0x80) - || !safe_parse_maxint (&device, (int *) ¤t_partition) - || current_partition > 254) - { - errnum = ERR_DEV_FORMAT; - return 0; - } - - current_partition = (current_partition << 16) + 0xFFFF; - - if (*device == ',') - device++; - - if (*device >= 'a' && *device <= 'p') - { - current_partition = (((*(device++) - 'a') << 8) - | (current_partition & 0xFF00FF)); - } - } - else if (*device >= 'a' && *device <= 'p') - { - part_choice ++; - current_partition = ((*(device++) - 'a') << 8) | 0xFF00FF; - } - - if (*device == ')') - { - if (part_choice == PART_DISK) - { - current_partition = saved_partition; - part_choice ++; - } - - result = 1; - } - } - } - - if (! sane_partition ()) - return 0; - - if (result) - return device + 1; - else - { - if (!*device) - incomplete = 1; - errnum = ERR_DEV_FORMAT; - } - - return 0; - -#endif /* ! STAGE1_5 */ -} - -/* - * This performs a "mount" on the current device, both drive and partition - * number. - */ - -int -open_device (void) -{ - if (open_partition ()) - attempt_mount (); - - if (errnum != ERR_NONE) - return 0; - - return 1; -} - - -#ifndef STAGE1_5 -int -set_bootdev (int hdbias) -{ - int i, j; - - /* Copy the boot partition information to 0x7be-0x7fd for chain-loading. */ - if ((saved_drive & 0x80) && cur_part_addr) - { - if (rawread (saved_drive, cur_part_offset, - 0, SECTOR_SIZE, (char *) SCRATCHADDR)) - { - char *dst, *src; - - /* Need only the partition table. - XXX: We cannot use grub_memmove because BOOT_PART_TABLE - (0x07be) is less than 0x1000. */ - dst = (char *) BOOT_PART_TABLE; - src = (char *) SCRATCHADDR + BOOTSEC_PART_OFFSET; - while (dst < (char *) BOOT_PART_TABLE + BOOTSEC_PART_LENGTH) - *dst++ = *src++; - - /* Set the active flag of the booted partition. */ - for (i = 0; i < 4; i++) - PC_SLICE_FLAG (BOOT_PART_TABLE, i) = 0; - - *((unsigned char *) cur_part_addr) = PC_SLICE_FLAG_BOOTABLE; - boot_part_addr = cur_part_addr; - } - else - return 0; - } - - /* - * Set BSD boot device. - */ - i = (saved_partition >> 16) + 2; - if (saved_partition == 0xFFFFFF) - i = 1; - else if ((saved_partition >> 16) == 0xFF) - i = 0; - - /* FIXME: extremely evil hack!!! */ - j = 2; - if (saved_drive & 0x80) - j = bsd_evil_hack; - - return MAKEBOOTDEV (j, (i >> 4), (i & 0xF), - ((saved_drive - hdbias) & 0x7F), - ((saved_partition >> 8) & 0xFF)); -} -#endif /* STAGE1_5 */ - - -static char * -setup_part (char *filename) -{ -#ifdef STAGE1_5 - - if (! (filename = set_device (filename))) - { - current_drive = GRUB_INVALID_DRIVE; - return 0; - } - -# ifndef NO_BLOCK_FILES - if (*filename != '/') - open_partition (); - else -# endif /* ! NO_BLOCK_FILES */ - open_device (); - -#else /* ! STAGE1_5 */ - - if (*filename == '(') - { - if ((filename = set_device (filename)) == 0) - { - current_drive = GRUB_INVALID_DRIVE; - return 0; - } -# ifndef NO_BLOCK_FILES - if (*filename != '/' && current_drive != NETWORK_DRIVE) - open_partition (); - else -# endif /* ! NO_BLOCK_FILES */ - open_device (); - } - else if (saved_drive != current_drive - || saved_partition != current_partition - || (*filename == '/' && fsys_type == NUM_FSYS) - || buf_drive == -1) - { - current_drive = saved_drive; - current_partition = saved_partition; - /* allow for the error case of "no filesystem" after the partition - is found. This makes block files work fine on no filesystem */ -# ifndef NO_BLOCK_FILES - if (*filename != '/' && current_drive != NETWORK_DRIVE) - open_partition (); - else -# endif /* ! NO_BLOCK_FILES */ - open_device (); - } - -#endif /* ! STAGE1_5 */ - - if (errnum && (*filename == '/' || errnum != ERR_FSYS_MOUNT)) - return 0; - else - errnum = 0; - -#ifndef STAGE1_5 - if (!sane_partition ()) - return 0; -#endif - - return filename; -} - - -#ifndef STAGE1_5 -/* - * This prints the filesystem type or gives relevant information. - */ - -void -print_fsys_type (void) -{ - if (! do_completion) - { - grub_printf (" Filesystem type "); - - if (fsys_type != NUM_FSYS) - grub_printf ("is %s, ", fsys_table[fsys_type].name); - else - grub_printf ("unknown, "); - - if (current_partition == 0xFFFFFF) - grub_printf ("using whole disk\n"); - else - grub_printf ("partition type 0x%x\n", current_slice & 0xFF); - } -} -#endif /* STAGE1_5 */ - -#ifndef STAGE1_5 -/* If DO_COMPLETION is true, just print NAME. Otherwise save the unique - part into UNIQUE_STRING. */ -void -print_a_completion (char *name) -{ - /* If NAME is "." or "..", do not count it. */ - if (grub_strcmp (name, ".") == 0 || grub_strcmp (name, "..") == 0) - return; - - if (do_completion) - { - char *buf = unique_string; - - if (! unique) - while ((*buf++ = *name++)) - ; - else - { - while (*buf && (*buf == *name)) - { - buf++; - name++; - } - /* mismatch, strip it. */ - *buf = '\0'; - } - } - else - grub_printf (" %s", name); - - unique++; -} - -/* - * This lists the possible completions of a device string, filename, or - * any sane combination of the two. - */ - -int -print_completions (int is_filename, int is_completion) -{ - char *buf = (char *) COMPLETION_BUF; - char *ptr = buf; - - unique_string = (char *) UNIQUE_BUF; - *unique_string = 0; - unique = 0; - do_completion = is_completion; - - if (! is_filename) - { - /* Print the completions of builtin commands. */ - struct builtin **builtin; - - if (! is_completion) - grub_printf (" Possible commands are:"); - - for (builtin = builtin_table; (*builtin); builtin++) - { - /* If *BUILTIN cannot be run in the command-line, skip it. */ - if (! ((*builtin)->flags & BUILTIN_CMDLINE)) - continue; - - if (substring (buf, (*builtin)->name) <= 0) - print_a_completion ((*builtin)->name); - } - - if (is_completion && *unique_string) - { - if (unique == 1) - { - char *u = unique_string + grub_strlen (unique_string); - - *u++ = ' '; - *u = 0; - } - - grub_strcpy (buf, unique_string); - } - - if (! is_completion) - grub_putchar ('\n'); - - print_error (); - do_completion = 0; - if (errnum) - return -1; - else - return unique - 1; - } - - if (*buf == '/' || (ptr = set_device (buf)) || incomplete) - { - errnum = 0; - - if (*buf == '(' && (incomplete || ! *ptr)) - { - if (! part_choice) - { - /* disk completions */ - int disk_no, i, j; - struct geometry geom; - - if (! is_completion) - grub_printf (" Possible disks are: "); - - if (!ptr - || *(ptr-1) != 'd' -#ifdef SUPPORT_NETBOOT - || *(ptr-2) != 'n' -#endif /* SUPPORT_NETBOOT */ - || *(ptr-2) != 'c') - { - for (i = (ptr && (*(ptr-1) == 'd' && *(ptr-2) == 'h') ? 1:0); - i < (ptr && (*(ptr-1) == 'd' && *(ptr-2) == 'f') ? 1:2); - i++) - { - for (j = 0; j < 8; j++) - { - disk_no = (i * 0x80) + j; - if ((disk_choice || disk_no == current_drive) - && ! get_diskinfo (disk_no, &geom)) - { - char dev_name[8]; - - grub_sprintf (dev_name, "%cd%d", i ? 'h':'f', j); - print_a_completion (dev_name); - } - } - } - } - - if (cdrom_drive != GRUB_INVALID_DRIVE - && (disk_choice || cdrom_drive == current_drive) - && (!ptr - || *(ptr-1) == '(' - || (*(ptr-1) == 'd' && *(ptr-2) == 'c'))) - print_a_completion ("cd"); - -# ifdef SUPPORT_NETBOOT - if (network_ready - && (disk_choice || NETWORK_DRIVE == current_drive) - && (!ptr - || *(ptr-1) == '(' - || (*(ptr-1) == 'd' && *(ptr-2) == 'n'))) - print_a_completion ("nd"); -# endif /* SUPPORT_NETBOOT */ - - if (is_completion && *unique_string) - { - ptr = buf; - while (*ptr != '(') - ptr--; - ptr++; - grub_strcpy (ptr, unique_string); - if (unique == 1) - { - ptr += grub_strlen (ptr); - if (*unique_string == 'h') - { - *ptr++ = ','; - *ptr = 0; - } - else - { - *ptr++ = ')'; - *ptr = 0; - } - } - } - - if (! is_completion) - grub_putchar ('\n'); - } - else - { - /* partition completions */ - if (part_choice == PART_CHOSEN - && open_partition () - && ! IS_PC_SLICE_TYPE_BSD (current_slice)) - { - unique = 1; - ptr = buf + grub_strlen (buf); - if (*(ptr - 1) != ')') - { - *ptr++ = ')'; - *ptr = 0; - } - } - else - { - if (! is_completion) - grub_printf (" Possible partitions are:\n"); - real_open_partition (1); - - if (is_completion && *unique_string) - { - ptr = buf; - while (*ptr++ != ',') - ; - grub_strcpy (ptr, unique_string); - } - } - } - } - else if (ptr && *ptr == '/') - { - /* filename completions */ - if (! is_completion) - grub_printf (" Possible files are:"); - - dir (buf); - - if (is_completion && *unique_string) - { - ptr += grub_strlen (ptr); - while (*ptr != '/') - ptr--; - ptr++; - - grub_strcpy (ptr, unique_string); - - if (unique == 1) - { - ptr += grub_strlen (unique_string); - - /* Check if the file UNIQUE_STRING is a directory. */ - *ptr = '/'; - *(ptr + 1) = 0; - - dir (buf); - - /* Restore the original unique value. */ - unique = 1; - - if (errnum) - { - /* Regular file */ - errnum = 0; - *ptr = ' '; - *(ptr + 1) = 0; - } - } - } - - if (! is_completion) - grub_putchar ('\n'); - } - else - errnum = ERR_BAD_FILENAME; - } - - print_error (); - do_completion = 0; - if (errnum) - return -1; - else - return unique - 1; -} -#endif /* STAGE1_5 */ - - -/* - * This is the generic file open function. - */ - -int -grub_open (char *filename) -{ -#ifndef NO_DECOMPRESSION - compressed_file = 0; -#endif /* NO_DECOMPRESSION */ - - /* if any "dir" function uses/sets filepos, it must - set it to zero before returning if opening a file! */ - filepos = 0; - - if (!(filename = setup_part (filename))) - return 0; - -#ifndef NO_BLOCK_FILES - block_file = 0; -#endif /* NO_BLOCK_FILES */ - - /* This accounts for partial filesystem implementations. */ - fsmax = MAXINT; - - if (*filename != '/' && current_drive != NETWORK_DRIVE) - { -#ifndef NO_BLOCK_FILES - char *ptr = filename; - int tmp, list_addr = BLK_BLKLIST_START; - filemax = 0; - - while (list_addr < BLK_MAX_ADDR) - { - tmp = 0; - safe_parse_maxint (&ptr, &tmp); - errnum = 0; - - if (*ptr != '+') - { - if ((*ptr && *ptr != '/' && !isspace (*ptr)) - || tmp == 0 || tmp > filemax) - errnum = ERR_BAD_FILENAME; - else - filemax = tmp; - - break; - } - - /* since we use the same filesystem buffer, mark it to - be remounted */ - fsys_type = NUM_FSYS; - - BLK_BLKSTART (list_addr) = tmp; - ptr++; - - if (!safe_parse_maxint (&ptr, &tmp) - || tmp == 0 - || (*ptr && *ptr != ',' && *ptr != '/' && !isspace (*ptr))) - { - errnum = ERR_BAD_FILENAME; - break; - } - - BLK_BLKLENGTH (list_addr) = tmp; - - filemax += (tmp * SECTOR_SIZE); - list_addr += BLK_BLKLIST_INC_VAL; - - if (*ptr != ',') - break; - - ptr++; - } - - if (list_addr < BLK_MAX_ADDR && ptr != filename && !errnum) - { - block_file = 1; - BLK_CUR_FILEPOS = 0; - BLK_CUR_BLKLIST = BLK_BLKLIST_START; - BLK_CUR_BLKNUM = 0; - -#ifndef NO_DECOMPRESSION - return gunzip_test_header (); -#else /* NO_DECOMPRESSION */ - return 1; -#endif /* NO_DECOMPRESSION */ - } -#else /* NO_BLOCK_FILES */ - errnum = ERR_BAD_FILENAME; -#endif /* NO_BLOCK_FILES */ - } - - if (!errnum && fsys_type == NUM_FSYS) - errnum = ERR_FSYS_MOUNT; - -# ifndef STAGE1_5 - /* set "dir" function to open a file */ - print_possibilities = 0; -# endif - - if (!errnum && (*(fsys_table[fsys_type].dir_func)) (filename)) - { -#ifndef NO_DECOMPRESSION - return gunzip_test_header (); -#else /* NO_DECOMPRESSION */ - return 1; -#endif /* NO_DECOMPRESSION */ - } - - return 0; -} - - -int -grub_read (char *buf, int len) -{ - /* Make sure "filepos" is a sane value */ - if ((filepos < 0) || (filepos > filemax)) - filepos = filemax; - - /* Make sure "len" is a sane value */ - if ((len < 0) || (len > (filemax - filepos))) - len = filemax - filepos; - - /* if target file position is past the end of - the supported/configured filesize, then - there is an error */ - if (filepos + len > fsmax) - { - errnum = ERR_FILELENGTH; - return 0; - } - -#ifndef NO_DECOMPRESSION - if (compressed_file) - return gunzip_read (buf, len); -#endif /* NO_DECOMPRESSION */ - -#ifndef NO_BLOCK_FILES - if (block_file) - { - int size, off, ret = 0; - - while (len && !errnum) - { - /* we may need to look for the right block in the list(s) */ - if (filepos < BLK_CUR_FILEPOS) - { - BLK_CUR_FILEPOS = 0; - BLK_CUR_BLKLIST = BLK_BLKLIST_START; - BLK_CUR_BLKNUM = 0; - } - - /* run BLK_CUR_FILEPOS up to filepos */ - while (filepos > BLK_CUR_FILEPOS) - { - if ((filepos - (BLK_CUR_FILEPOS & ~(SECTOR_SIZE - 1))) - >= SECTOR_SIZE) - { - BLK_CUR_FILEPOS += SECTOR_SIZE; - BLK_CUR_BLKNUM++; - - if (BLK_CUR_BLKNUM >= BLK_BLKLENGTH (BLK_CUR_BLKLIST)) - { - BLK_CUR_BLKLIST += BLK_BLKLIST_INC_VAL; - BLK_CUR_BLKNUM = 0; - } - } - else - BLK_CUR_FILEPOS = filepos; - } - - off = filepos & (SECTOR_SIZE - 1); - size = ((BLK_BLKLENGTH (BLK_CUR_BLKLIST) - BLK_CUR_BLKNUM) - * SECTOR_SIZE) - off; - if (size > len) - size = len; - - disk_read_func = disk_read_hook; - - /* read current block and put it in the right place in memory */ - devread (BLK_BLKSTART (BLK_CUR_BLKLIST) + BLK_CUR_BLKNUM, - off, size, buf); - - disk_read_func = NULL; - - len -= size; - filepos += size; - ret += size; - buf += size; - } - - if (errnum) - ret = 0; - - return ret; - } -#endif /* NO_BLOCK_FILES */ - - if (fsys_type == NUM_FSYS) - { - errnum = ERR_FSYS_MOUNT; - return 0; - } - - return (*(fsys_table[fsys_type].read_func)) (buf, len); -} - -#ifndef STAGE1_5 -/* Reposition a file offset. */ -int -grub_seek (int offset) -{ - if (offset > filemax || offset < 0) - return -1; - - filepos = offset; - return offset; -} - -int -dir (char *dirname) -{ -#ifndef NO_DECOMPRESSION - compressed_file = 0; -#endif /* NO_DECOMPRESSION */ - - if (!(dirname = setup_part (dirname))) - return 0; - - if (*dirname != '/') - errnum = ERR_BAD_FILENAME; - - if (fsys_type == NUM_FSYS) - errnum = ERR_FSYS_MOUNT; - - if (errnum) - return 0; - - /* set "dir" function to list completions */ - print_possibilities = 1; - - return (*(fsys_table[fsys_type].dir_func)) (dirname); -} -#endif /* STAGE1_5 */ - -void -grub_close (void) -{ -#ifndef NO_BLOCK_FILES - if (block_file) - return; -#endif /* NO_BLOCK_FILES */ - - if (fsys_table[fsys_type].close_func != 0) - (*(fsys_table[fsys_type].close_func)) (); -} diff --git a/usr/src/grub/grub-0.95/stage2/fat.h b/usr/src/grub/grub-0.95/stage2/fat.h deleted file mode 100644 index 7fed6bacb3..0000000000 --- a/usr/src/grub/grub-0.95/stage2/fat.h +++ /dev/null @@ -1,100 +0,0 @@ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 2001 Free Software Foundation, 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 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. - */ - - -/* - * Defines for the FAT BIOS Parameter Block (embedded in the first block - * of the partition. - */ - -typedef __signed__ char __s8; -typedef unsigned char __u8; -typedef __signed__ short __s16; -typedef unsigned short __u16; -typedef __signed__ int __s32; -typedef unsigned int __u32; - -/* Note that some shorts are not aligned, and must therefore - * be declared as array of two bytes. - */ -struct fat_bpb { - __s8 ignored[3]; /* Boot strap short or near jump */ - __s8 system_id[8]; /* Name - can be used to special case - partition manager volumes */ - __u8 bytes_per_sect[2]; /* bytes per logical sector */ - __u8 sects_per_clust;/* sectors/cluster */ - __u8 reserved_sects[2]; /* reserved sectors */ - __u8 num_fats; /* number of FATs */ - __u8 dir_entries[2]; /* root directory entries */ - __u8 short_sectors[2]; /* number of sectors */ - __u8 media; /* media code (unused) */ - __u16 fat_length; /* sectors/FAT */ - __u16 secs_track; /* sectors per track */ - __u16 heads; /* number of heads */ - __u32 hidden; /* hidden sectors (unused) */ - __u32 long_sectors; /* number of sectors (if short_sectors == 0) */ - - /* The following fields are only used by FAT32 */ - __u32 fat32_length; /* sectors/FAT */ - __u16 flags; /* bit 8: fat mirroring, low 4: active fat */ - __u8 version[2]; /* major, minor filesystem version */ - __u32 root_cluster; /* first cluster in root directory */ - __u16 info_sector; /* filesystem info sector */ - __u16 backup_boot; /* backup boot sector */ - __u16 reserved2[6]; /* Unused */ -}; - -#define FAT_CVT_U16(bytarr) (* (__u16*)(bytarr)) - -/* - * Defines how to differentiate a 12-bit and 16-bit FAT. - */ - -#define FAT_MAX_12BIT_CLUST 4087 /* 4085 + 2 */ - -/* - * Defines for the file "attribute" byte - */ - -#define FAT_ATTRIB_OK_MASK 0x37 -#define FAT_ATTRIB_NOT_OK_MASK 0xC8 -#define FAT_ATTRIB_DIR 0x10 -#define FAT_ATTRIB_LONGNAME 0x0F - -/* - * Defines for FAT directory entries - */ - -#define FAT_DIRENTRY_LENGTH 32 - -#define FAT_DIRENTRY_ATTRIB(entry) \ - (*((unsigned char *) (entry+11))) -#define FAT_DIRENTRY_VALID(entry) \ - ( ((*((unsigned char *) entry)) != 0) \ - && ((*((unsigned char *) entry)) != 0xE5) \ - && !(FAT_DIRENTRY_ATTRIB(entry) & FAT_ATTRIB_NOT_OK_MASK) ) -#define FAT_DIRENTRY_FIRST_CLUSTER(entry) \ - ((*((unsigned short *) (entry+26)))+(*((unsigned short *) (entry+20)) << 16)) -#define FAT_DIRENTRY_FILELENGTH(entry) \ - (*((unsigned long *) (entry+28))) - -#define FAT_LONGDIR_ID(entry) \ - (*((unsigned char *) (entry))) -#define FAT_LONGDIR_ALIASCHECKSUM(entry) \ - (*((unsigned char *) (entry+13))) diff --git a/usr/src/grub/grub-0.95/stage2/filesys.h b/usr/src/grub/grub-0.95/stage2/filesys.h deleted file mode 100644 index 94c23bf5de..0000000000 --- a/usr/src/grub/grub-0.95/stage2/filesys.h +++ /dev/null @@ -1,186 +0,0 @@ -/* filesys.h - abstract filesystem interface */ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 1999,2000,2001,2004 Free Software Foundation, 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 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 "pc_slice.h" - -#ifdef FSYS_FFS -#define FSYS_FFS_NUM 1 -int ffs_mount (void); -int ffs_read (char *buf, int len); -int ffs_dir (char *dirname); -int ffs_embed (int *start_sector, int needed_sectors); -#else -#define FSYS_FFS_NUM 0 -#endif - -#ifdef FSYS_UFS -#define FSYS_UFS_NUM 1 -int ufs_mount (void); -int ufs_read (char *buf, int len); -int ufs_dir (char *dirname); -int ufs_embed (int *start_sector, int needed_sectors); -#else -#define FSYS_UFS_NUM 0 -#endif - -#ifdef FSYS_UFS2 -#define FSYS_UFS2_NUM 1 -int ufs2_mount (void); -int ufs2_read (char *buf, int len); -int ufs2_dir (char *dirname); -int ufs2_embed (int *start_sector, int needed_sectors); -#else -#define FSYS_UFS2_NUM 0 -#endif - -#ifdef FSYS_ZFS -#define FSYS_ZFS_NUM 1 -int zfs_mount (void); -int zfs_read (char *buf, int len); -int zfs_open (char *dirname); -int zfs_embed (int *start_sector, int needed_sectors); -#else -#define FSYS_ZFS_NUM 0 -#endif - -#ifdef FSYS_FAT -#define FSYS_FAT_NUM 1 -int fat_mount (void); -int fat_read (char *buf, int len); -int fat_dir (char *dirname); -#else -#define FSYS_FAT_NUM 0 -#endif - -#ifdef FSYS_EXT2FS -#define FSYS_EXT2FS_NUM 1 -int ext2fs_mount (void); -int ext2fs_read (char *buf, int len); -int ext2fs_dir (char *dirname); -#else -#define FSYS_EXT2FS_NUM 0 -#endif - -#ifdef FSYS_MINIX -#define FSYS_MINIX_NUM 1 -int minix_mount (void); -int minix_read (char *buf, int len); -int minix_dir (char *dirname); -#else -#define FSYS_MINIX_NUM 0 -#endif - -#ifdef FSYS_REISERFS -#define FSYS_REISERFS_NUM 1 -int reiserfs_mount (void); -int reiserfs_read (char *buf, int len); -int reiserfs_dir (char *dirname); -int reiserfs_embed (int *start_sector, int needed_sectors); -#else -#define FSYS_REISERFS_NUM 0 -#endif - -#ifdef FSYS_VSTAFS -#define FSYS_VSTAFS_NUM 1 -int vstafs_mount (void); -int vstafs_read (char *buf, int len); -int vstafs_dir (char *dirname); -#else -#define FSYS_VSTAFS_NUM 0 -#endif - -#ifdef FSYS_JFS -#define FSYS_JFS_NUM 1 -int jfs_mount (void); -int jfs_read (char *buf, int len); -int jfs_dir (char *dirname); -int jfs_embed (int *start_sector, int needed_sectors); -#else -#define FSYS_JFS_NUM 0 -#endif - -#ifdef FSYS_XFS -#define FSYS_XFS_NUM 1 -int xfs_mount (void); -int xfs_read (char *buf, int len); -int xfs_dir (char *dirname); -#else -#define FSYS_XFS_NUM 0 -#endif - -#ifdef FSYS_TFTP -#define FSYS_TFTP_NUM 1 -int tftp_mount (void); -int tftp_read (char *buf, int len); -int tftp_dir (char *dirname); -void tftp_close (void); -#else -#define FSYS_TFTP_NUM 0 -#endif - -#ifdef FSYS_ISO9660 -#define FSYS_ISO9660_NUM 1 -int iso9660_mount (void); -int iso9660_read (char *buf, int len); -int iso9660_dir (char *dirname); -#else -#define FSYS_ISO9660_NUM 0 -#endif - -#ifndef NUM_FSYS -#define NUM_FSYS \ - (FSYS_FFS_NUM + FSYS_FAT_NUM + FSYS_EXT2FS_NUM + FSYS_MINIX_NUM \ - + FSYS_REISERFS_NUM + FSYS_VSTAFS_NUM + FSYS_JFS_NUM + FSYS_XFS_NUM \ - + FSYS_TFTP_NUM + FSYS_ISO9660_NUM + FSYS_UFS_NUM + FSYS_UFS2_NUM \ - + FSYS_ZFS_NUM) -#endif - -/* defines for the block filesystem info area */ -#ifndef NO_BLOCK_FILES -#define BLK_CUR_FILEPOS (*((int*)FSYS_BUF)) -#define BLK_CUR_BLKLIST (*((int*)(FSYS_BUF+4))) -#define BLK_CUR_BLKNUM (*((int*)(FSYS_BUF+8))) -#define BLK_MAX_ADDR (FSYS_BUF+0x7FF9) -#define BLK_BLKSTART(l) (*((int*)l)) -#define BLK_BLKLENGTH(l) (*((int*)(l+4))) -#define BLK_BLKLIST_START (FSYS_BUF+12) -#define BLK_BLKLIST_INC_VAL 8 -#endif /* NO_BLOCK_FILES */ - -/* this next part is pretty ugly, but it keeps it in one place! */ - -struct fsys_entry -{ - char *name; - int (*mount_func) (void); - int (*read_func) (char *buf, int len); - int (*dir_func) (char *dirname); - void (*close_func) (void); - int (*embed_func) (int *start_sector, int needed_sectors); -}; - -#ifdef STAGE1_5 -# define print_possibilities 0 -#else -extern int print_possibilities; -#endif - -extern int fsmax; -extern struct fsys_entry fsys_table[NUM_FSYS + 1]; diff --git a/usr/src/grub/grub-0.95/stage2/freebsd.h b/usr/src/grub/grub-0.95/stage2/freebsd.h deleted file mode 100644 index ffbf602b53..0000000000 --- a/usr/src/grub/grub-0.95/stage2/freebsd.h +++ /dev/null @@ -1,95 +0,0 @@ - -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 2001 Free Software Foundation, 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 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. - */ - -/* command-line parameter defines */ -#define RB_ASKNAME 0x01 /* ask for file name to reboot from */ -#define RB_SINGLE 0x02 /* reboot to single user only */ -#define RB_NOSYNC 0x04 /* dont sync before reboot */ -#define RB_HALT 0x08 /* don't reboot, just halt */ -#define RB_INITNAME 0x10 /* name given for /etc/init (unused) */ -#define RB_DFLTROOT 0x20 /* use compiled-in rootdev */ -#define RB_KDB 0x40 /* give control to kernel debugger */ -#define RB_RDONLY 0x80 /* mount root fs read-only */ -#define RB_DUMP 0x100 /* dump kernel memory before reboot */ -#define RB_MINIROOT 0x200 /* mini-root present in memory at boot time */ -#define RB_CONFIG 0x400 /* invoke user configuration routing */ -#define RB_VERBOSE 0x800 /* print all potentially useful info */ -#define RB_SERIAL 0x1000 /* user serial port as console */ -#define RB_CDROM 0x2000 /* use cdrom as root */ -#define RB_GDB 0x8000 /* use GDB remote debugger instead of DDB */ -#define RB_MUTE 0x10000 /* Come up with the console muted */ -#define RB_MULTIPLE 0x20000000 /* Use multiple consoles */ - -#define RB_BOOTINFO 0x80000000 /* have `struct bootinfo *' arg */ - -/* - * Constants for converting boot-style device number to type, - * adaptor (uba, mba, etc), unit number and partition number. - * Type (== major device number) is in the low byte - * for backward compatibility. Except for that of the "magic - * number", each mask applies to the shifted value. - * Format: - * (4) (4) (4) (4) (8) (8) - * -------------------------------- - * |MA | AD| CT| UN| PART | TYPE | - * -------------------------------- - */ -#define B_ADAPTORSHIFT 24 -#define B_CONTROLLERSHIFT 20 -#define B_UNITSHIFT 16 -#define B_PARTITIONSHIFT 8 -#define B_TYPESHIFT 0 - -#define B_DEVMAGIC ((unsigned long)0xa0000000) - -#define MAKEBOOTDEV(type, adaptor, controller, unit, partition) \ - (((type) << B_TYPESHIFT) | ((adaptor) << B_ADAPTORSHIFT) | \ - ((controller) << B_CONTROLLERSHIFT) | ((unit) << B_UNITSHIFT) | \ - ((partition) << B_PARTITIONSHIFT) | B_DEVMAGIC) - - -/* Only change the version number if you break compatibility. */ -#define BOOTINFO_VERSION 1 - -#define N_BIOS_GEOM 8 - -/* - * A zero bootinfo field often means that there is no info available. - * Flags are used to indicate the validity of fields where zero is a - * normal value. - */ -struct bootinfo - { - unsigned int bi_version; - unsigned char *bi_kernelname; - struct nfs_diskless *bi_nfs_diskless; - /* End of fields that are always present. */ -#define bi_endcommon bi_n_bios_used - unsigned int bi_n_bios_used; - unsigned long bi_bios_geom[N_BIOS_GEOM]; - unsigned int bi_size; - unsigned char bi_memsizes_valid; - unsigned char bi_bios_dev; - unsigned char bi_pad[2]; - unsigned long bi_basemem; - unsigned long bi_extmem; - unsigned long bi_symtab; - unsigned long bi_esymtab; - }; diff --git a/usr/src/grub/grub-0.95/stage2/fs.h b/usr/src/grub/grub-0.95/stage2/fs.h deleted file mode 100644 index 8ed4fe0415..0000000000 --- a/usr/src/grub/grub-0.95/stage2/fs.h +++ /dev/null @@ -1,457 +0,0 @@ -/* - * Mach Operating System - * Copyright (c) 1991,1990 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. - * - * 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 FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie Mellon - * the rights to redistribute these changes. - */ -/* - * 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 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. - * - * @(#)fs.h 7.7 (Berkeley) 5/9/89 - */ - -/* - * Each disk drive contains some number of file systems. - * A file system consists of a number of cylinder groups. - * Each cylinder group has inodes and data. - * - * A file system is described by its super-block, which in turn - * describes the cylinder groups. The super-block is critical - * data and is replicated in each cylinder group to protect against - * catastrophic loss. This is done at `newfs' time and the critical - * super-block data does not change, so the copies need not be - * referenced further unless disaster strikes. - * - * For file system fs, the offsets of the various blocks of interest - * are given in the super block as: - * [fs->fs_sblkno] Super-block - * [fs->fs_cblkno] Cylinder group block - * [fs->fs_iblkno] Inode blocks - * [fs->fs_dblkno] Data blocks - * The beginning of cylinder group cg in fs, is given by - * the ``cgbase(fs, cg)'' macro. - * - * The first boot and super blocks are given in absolute disk addresses. - * The byte-offset forms are preferred, as they don't imply a sector size. - */ -#define BBSIZE 8192 -#define SBSIZE 8192 -#define BBOFF ((mach_off_t)(0)) -#define SBOFF ((mach_off_t)(BBOFF + BBSIZE)) -#define BBLOCK ((mach_daddr_t)(0)) -#define SBLOCK ((mach_daddr_t)(BBLOCK + BBSIZE / DEV_BSIZE)) - -/* - * Addresses stored in inodes are capable of addressing fragments - * of `blocks'. File system blocks of at most size MAXBSIZE can - * be optionally broken into 2, 4, or 8 pieces, each of which is - * addressible; these pieces may be DEV_BSIZE, or some multiple of - * a DEV_BSIZE unit. - * - * Large files consist of exclusively large data blocks. To avoid - * undue wasted disk space, the last data block of a small file may be - * allocated as only as many fragments of a large block as are - * necessary. The file system format retains only a single pointer - * to such a fragment, which is a piece of a single large block that - * has been divided. The size of such a fragment is determinable from - * information in the inode, using the ``blksize(fs, ip, lbn)'' macro. - * - * The file system records space availability at the fragment level; - * to determine block availability, aligned fragments are examined. - * - * The root inode is the root of the file system. - * Inode 0 can't be used for normal purposes and - * historically bad blocks were linked to inode 1, - * thus the root inode is 2. (inode 1 is no longer used for - * this purpose, however numerous dump tapes make this - * assumption, so we are stuck with it) - */ -#define ROOTINO ((mach_ino_t)2) /* i number of all roots */ - -/* - * MINBSIZE is the smallest allowable block size. - * In order to insure that it is possible to create files of size - * 2^32 with only two levels of indirection, MINBSIZE is set to 4096. - * MINBSIZE must be big enough to hold a cylinder group block, - * thus changes to (struct cg) must keep its size within MINBSIZE. - * Note that super blocks are always of size SBSIZE, - * and that both SBSIZE and MAXBSIZE must be >= MINBSIZE. - */ -#define MINBSIZE 4096 - -/* - * The path name on which the file system is mounted is maintained - * in fs_fsmnt. MAXMNTLEN defines the amount of space allocated in - * the super block for this name. - * The limit on the amount of summary information per file system - * is defined by MAXCSBUFS. It is currently parameterized for a - * maximum of two million cylinders. - */ -#define MAXMNTLEN 512 -#define MAXCSBUFS 32 - -/* - * Per cylinder group information; summarized in blocks allocated - * from first cylinder group data blocks. These blocks have to be - * read in from fs_csaddr (size fs_cssize) in addition to the - * super block. - * - * N.B. sizeof(struct csum) must be a power of two in order for - * the ``fs_cs'' macro to work (see below). - */ -struct csum - { - int cs_ndir; /* number of directories */ - int cs_nbfree; /* number of free blocks */ - int cs_nifree; /* number of free inodes */ - int cs_nffree; /* number of free frags */ - }; - -/* - * Super block for a file system. - */ -#define FS_MAGIC 0x011954 -struct fs - { - int xxx1; /* struct fs *fs_link; */ - int xxx2; /* struct fs *fs_rlink; */ - mach_daddr_t fs_sblkno; /* addr of super-block in filesys */ - mach_daddr_t fs_cblkno; /* offset of cyl-block in filesys */ - mach_daddr_t fs_iblkno; /* offset of inode-blocks in filesys */ - mach_daddr_t fs_dblkno; /* offset of first data after cg */ - int fs_cgoffset; /* cylinder group offset in cylinder */ - int fs_cgmask; /* used to calc mod fs_ntrak */ - mach_time_t fs_time; /* last time written */ - int fs_size; /* number of blocks in fs */ - int fs_dsize; /* number of data blocks in fs */ - int fs_ncg; /* number of cylinder groups */ - int fs_bsize; /* size of basic blocks in fs */ - int fs_fsize; /* size of frag blocks in fs */ - int fs_frag; /* number of frags in a block in fs */ -/* these are configuration parameters */ - int fs_minfree; /* minimum percentage of free blocks */ - int fs_rotdelay; /* num of ms for optimal next block */ - int fs_rps; /* disk revolutions per second */ -/* these fields can be computed from the others */ - int fs_bmask; /* ``blkoff'' calc of blk offsets */ - int fs_fmask; /* ``fragoff'' calc of frag offsets */ - int fs_bshift; /* ``lblkno'' calc of logical blkno */ - int fs_fshift; /* ``numfrags'' calc number of frags */ -/* these are configuration parameters */ - int fs_maxcontig; /* max number of contiguous blks */ - int fs_maxbpg; /* max number of blks per cyl group */ -/* these fields can be computed from the others */ - int fs_fragshift; /* block to frag shift */ - int fs_fsbtodb; /* fsbtodb and dbtofsb shift constant */ - int fs_sbsize; /* actual size of super block */ - int fs_csmask; /* csum block offset */ - int fs_csshift; /* csum block number */ - int fs_nindir; /* value of NINDIR */ - int fs_inopb; /* value of INOPB */ - int fs_nspf; /* value of NSPF */ -/* yet another configuration parameter */ - int fs_optim; /* optimization preference, see below */ -/* these fields are derived from the hardware */ - int fs_npsect; /* # sectors/track including spares */ - int fs_interleave; /* hardware sector interleave */ - int fs_trackskew; /* sector 0 skew, per track */ - int fs_headswitch; /* head switch time, usec */ - int fs_trkseek; /* track-to-track seek, usec */ -/* sizes determined by number of cylinder groups and their sizes */ - mach_daddr_t fs_csaddr; /* blk addr of cyl grp summary area */ - int fs_cssize; /* size of cyl grp summary area */ - int fs_cgsize; /* cylinder group size */ -/* these fields are derived from the hardware */ - int fs_ntrak; /* tracks per cylinder */ - int fs_nsect; /* sectors per track */ - int fs_spc; /* sectors per cylinder */ -/* this comes from the disk driver partitioning */ - int fs_ncyl; /* cylinders in file system */ -/* these fields can be computed from the others */ - int fs_cpg; /* cylinders per group */ - int fs_ipg; /* inodes per group */ - int fs_fpg; /* blocks per group * fs_frag */ -/* this data must be re-computed after crashes */ - struct csum fs_cstotal; /* cylinder summary information */ -/* these fields are cleared at mount time */ - char fs_fmod; /* super block modified flag */ - char fs_clean; /* file system is clean flag */ - char fs_ronly; /* mounted read-only flag */ - char fs_flags; /* currently unused flag */ - char fs_fsmnt[MAXMNTLEN]; /* name mounted on */ -/* these fields retain the current block allocation info */ - int fs_cgrotor; /* last cg searched */ -#if 1 - int was_fs_csp[MAXCSBUFS]; -#else - struct csum *fs_csp[MAXCSBUFS]; /* list of fs_cs info buffers */ -#endif - int fs_cpc; /* cyl per cycle in postbl */ - short fs_opostbl[16][8]; /* old rotation block list head */ - long fs_sparecon[50]; /* reserved for future constants */ - long fs_contigsumsize; /* size of cluster summary array */ - long fs_maxsymlinklen; /* max length of an internal symlink */ - long fs_inodefmt; /* format of on-disk inodes */ - quad fs_maxfilesize; /* maximum representable file size */ - quad fs_qbmask; /* ~fs_bmask - for use with quad size */ - quad fs_qfmask; /* ~fs_fmask - for use with quad size */ - long fs_state; /* validate fs_clean field */ - int fs_postblformat; /* format of positional layout tables */ - int fs_nrpos; /* number of rotaional positions */ - int fs_postbloff; /* (short) rotation block list head */ - int fs_rotbloff; /* (u_char) blocks for each rotation */ - int fs_magic; /* magic number */ - u_char fs_space[1]; /* list of blocks for each rotation */ -/* actually longer */ - }; -/* - * Preference for optimization. - */ -#define FS_OPTTIME 0 /* minimize allocation time */ -#define FS_OPTSPACE 1 /* minimize disk fragmentation */ - -/* - * Rotational layout table format types - */ -#define FS_42POSTBLFMT -1 /* 4.2BSD rotational table format */ -#define FS_DYNAMICPOSTBLFMT 1 /* dynamic rotational table format */ -/* - * Macros for access to superblock array structures - */ -#define fs_postbl(fs, cylno) \ - (((fs)->fs_postblformat == FS_42POSTBLFMT) \ - ? ((fs)->fs_opostbl[cylno]) \ - : ((short *)((char *)(fs) + (fs)->fs_postbloff) + (cylno) * (fs)->fs_nrpos)) -#define fs_rotbl(fs) \ - (((fs)->fs_postblformat == FS_42POSTBLFMT) \ - ? ((fs)->fs_space) \ - : ((u_char *)((char *)(fs) + (fs)->fs_rotbloff))) - -/* - * Convert cylinder group to base address of its global summary info. - * - * N.B. This macro assumes that sizeof(struct csum) is a power of two. - */ -#define fs_cs(fs, indx) \ - fs_csp[(indx) >> (fs)->fs_csshift][(indx) & ~(fs)->fs_csmask] - -/* - * Cylinder group block for a file system. - */ -#define CG_MAGIC 0x090255 -struct cg - { - int xxx1; /* struct cg *cg_link; */ - int cg_magic; /* magic number */ - mach_time_t cg_time; /* time last written */ - int cg_cgx; /* we are the cgx'th cylinder group */ - short cg_ncyl; /* number of cyl's this cg */ - short cg_niblk; /* number of inode blocks this cg */ - int cg_ndblk; /* number of data blocks this cg */ - struct csum cg_cs; /* cylinder summary information */ - int cg_rotor; /* position of last used block */ - int cg_frotor; /* position of last used frag */ - int cg_irotor; /* position of last used inode */ - int cg_frsum[MAXFRAG]; /* counts of available frags */ - int cg_btotoff; /* (long) block totals per cylinder */ - int cg_boff; /* (short) free block positions */ - int cg_iusedoff; /* (char) used inode map */ - int cg_freeoff; /* (u_char) free block map */ - int cg_nextfreeoff; /* (u_char) next available space */ - int cg_sparecon[16]; /* reserved for future use */ - u_char cg_space[1]; /* space for cylinder group maps */ -/* actually longer */ - }; -/* - * Macros for access to cylinder group array structures - */ -#define cg_blktot(cgp) \ - (((cgp)->cg_magic != CG_MAGIC) \ - ? (((struct ocg *)(cgp))->cg_btot) \ - : ((int *)((char *)(cgp) + (cgp)->cg_btotoff))) -#define cg_blks(fs, cgp, cylno) \ - (((cgp)->cg_magic != CG_MAGIC) \ - ? (((struct ocg *)(cgp))->cg_b[cylno]) \ - : ((short *)((char *)(cgp) + (cgp)->cg_boff) + (cylno) * (fs)->fs_nrpos)) -#define cg_inosused(cgp) \ - (((cgp)->cg_magic != CG_MAGIC) \ - ? (((struct ocg *)(cgp))->cg_iused) \ - : ((char *)((char *)(cgp) + (cgp)->cg_iusedoff))) -#define cg_blksfree(cgp) \ - (((cgp)->cg_magic != CG_MAGIC) \ - ? (((struct ocg *)(cgp))->cg_free) \ - : ((u_char *)((char *)(cgp) + (cgp)->cg_freeoff))) -#define cg_chkmagic(cgp) \ - ((cgp)->cg_magic == CG_MAGIC || ((struct ocg *)(cgp))->cg_magic == CG_MAGIC) - -/* - * The following structure is defined - * for compatibility with old file systems. - */ -struct ocg - { - int xxx1; /* struct ocg *cg_link; */ - int xxx2; /* struct ocg *cg_rlink; */ - mach_time_t cg_time; /* time last written */ - int cg_cgx; /* we are the cgx'th cylinder group */ - short cg_ncyl; /* number of cyl's this cg */ - short cg_niblk; /* number of inode blocks this cg */ - int cg_ndblk; /* number of data blocks this cg */ - struct csum cg_cs; /* cylinder summary information */ - int cg_rotor; /* position of last used block */ - int cg_frotor; /* position of last used frag */ - int cg_irotor; /* position of last used inode */ - int cg_frsum[8]; /* counts of available frags */ - int cg_btot[32]; /* block totals per cylinder */ - short cg_b[32][8]; /* positions of free blocks */ - char cg_iused[256]; /* used inode map */ - int cg_magic; /* magic number */ - u_char cg_free[1]; /* free block map */ -/* actually longer */ - }; - -/* - * Turn file system block numbers into disk block addresses. - * This maps file system blocks to device size blocks. - */ -#define fsbtodb(fs, b) ((b) << (fs)->fs_fsbtodb) -#define dbtofsb(fs, b) ((b) >> (fs)->fs_fsbtodb) - -/* - * Cylinder group macros to locate things in cylinder groups. - * They calc file system addresses of cylinder group data structures. - */ -#define cgbase(fs, c) ((mach_daddr_t)((fs)->fs_fpg * (c))) -#define cgstart(fs, c) \ - (cgbase(fs, c) + (fs)->fs_cgoffset * ((c) & ~((fs)->fs_cgmask))) -#define cgsblock(fs, c) (cgstart(fs, c) + (fs)->fs_sblkno) /* super blk */ -#define cgtod(fs, c) (cgstart(fs, c) + (fs)->fs_cblkno) /* cg block */ -#define cgimin(fs, c) (cgstart(fs, c) + (fs)->fs_iblkno) /* inode blk */ -#define cgdmin(fs, c) (cgstart(fs, c) + (fs)->fs_dblkno) /* 1st data */ - -/* - * Macros for handling inode numbers: - * inode number to file system block offset. - * inode number to cylinder group number. - * inode number to file system block address. - */ -#define itoo(fs, x) ((x) % INOPB(fs)) -#define itog(fs, x) ((x) / (fs)->fs_ipg) -#define itod(fs, x) \ - ((mach_daddr_t)(cgimin(fs, itog(fs, x)) + \ - (blkstofrags((fs), (((x) % (fs)->fs_ipg) / INOPB(fs)))))) - -/* - * Give cylinder group number for a file system block. - * Give cylinder group block number for a file system block. - */ -#define dtog(fs, d) ((d) / (fs)->fs_fpg) -#define dtogd(fs, d) ((d) % (fs)->fs_fpg) - -/* - * Extract the bits for a block from a map. - * Compute the cylinder and rotational position of a cyl block addr. - */ -#define blkmap(fs, map, loc) \ - (((map)[(loc) / NBBY] >> ((loc) % NBBY)) & (0xff >> (NBBY - (fs)->fs_frag))) -#define cbtocylno(fs, bno) \ - ((bno) * NSPF(fs) / (fs)->fs_spc) -#define cbtorpos(fs, bno) \ - (((bno) * NSPF(fs) % (fs)->fs_spc / (fs)->fs_nsect * (fs)->fs_trackskew + \ - (bno) * NSPF(fs) % (fs)->fs_spc % (fs)->fs_nsect * (fs)->fs_interleave) % \ - (fs)->fs_nsect * (fs)->fs_nrpos / (fs)->fs_npsect) - -/* - * The following macros optimize certain frequently calculated - * quantities by using shifts and masks in place of divisions - * modulos and multiplications. - */ -#define blkoff(fs, loc) /* calculates (loc % fs->fs_bsize) */ \ - ((loc) & ~(fs)->fs_bmask) -#define fragoff(fs, loc) /* calculates (loc % fs->fs_fsize) */ \ - ((loc) & ~(fs)->fs_fmask) -#define lblkno(fs, loc) /* calculates (loc / fs->fs_bsize) */ \ - ((loc) >> (fs)->fs_bshift) -#define numfrags(fs, loc) /* calculates (loc / fs->fs_fsize) */ \ - ((loc) >> (fs)->fs_fshift) -#define blkroundup(fs, size) /* calculates roundup(size, fs->fs_bsize) */ \ - (((size) + (fs)->fs_bsize - 1) & (fs)->fs_bmask) -#define fragroundup(fs, size) /* calculates roundup(size, fs->fs_fsize) */ \ - (((size) + (fs)->fs_fsize - 1) & (fs)->fs_fmask) -#define fragstoblks(fs, frags) /* calculates (frags / fs->fs_frag) */ \ - ((frags) >> (fs)->fs_fragshift) -#define blkstofrags(fs, blks) /* calculates (blks * fs->fs_frag) */ \ - ((blks) << (fs)->fs_fragshift) -#define fragnum(fs, fsb) /* calculates (fsb % fs->fs_frag) */ \ - ((fsb) & ((fs)->fs_frag - 1)) -#define blknum(fs, fsb) /* calculates rounddown(fsb, fs->fs_frag) */ \ - ((fsb) &~ ((fs)->fs_frag - 1)) - -/* - * Determine the number of available frags given a - * percentage to hold in reserve - */ -#define freespace(fs, percentreserved) \ - (blkstofrags((fs), (fs)->fs_cstotal.cs_nbfree) + \ - (fs)->fs_cstotal.cs_nffree - ((fs)->fs_dsize * (percentreserved) / 100)) - -/* - * Determining the size of a file block in the file system. - */ -#define blksize(fs, ip, lbn) \ - (((lbn) >= NDADDR || (ip)->i_size >= ((lbn) + 1) << (fs)->fs_bshift) \ - ? (fs)->fs_bsize \ - : (fragroundup(fs, blkoff(fs, (ip)->i_size)))) -#define dblksize(fs, dip, lbn) \ - (((lbn) >= NDADDR || (dip)->di_size >= ((lbn) + 1) << (fs)->fs_bshift) \ - ? (fs)->fs_bsize \ - : (fragroundup(fs, blkoff(fs, (dip)->di_size)))) - -/* - * Number of disk sectors per block; assumes DEV_BSIZE byte sector size. - */ -#define NSPB(fs) ((fs)->fs_nspf << (fs)->fs_fragshift) -#define NSPF(fs) ((fs)->fs_nspf) - -/* - * INOPB is the number of inodes in a secondary storage block. - */ -#define INOPB(fs) ((fs)->fs_inopb) -#define INOPF(fs) ((fs)->fs_inopb >> (fs)->fs_fragshift) - -/* - * NINDIR is the number of indirects in a file system block. - */ -#define NINDIR(fs) ((fs)->fs_nindir) diff --git a/usr/src/grub/grub-0.95/stage2/fsys_ext2fs.c b/usr/src/grub/grub-0.95/stage2/fsys_ext2fs.c deleted file mode 100644 index 560048f4c5..0000000000 --- a/usr/src/grub/grub-0.95/stage2/fsys_ext2fs.c +++ /dev/null @@ -1,789 +0,0 @@ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 1999, 2001, 2003 Free Software Foundation, 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 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. - */ - -#ifdef FSYS_EXT2FS - -#include "shared.h" -#include "filesys.h" - -static int mapblock1, mapblock2; - -/* sizes are always in bytes, BLOCK values are always in DEV_BSIZE (sectors) */ -#define DEV_BSIZE 512 - -/* include/linux/fs.h */ -#define BLOCK_SIZE 1024 /* initial block size for superblock read */ -/* made up, defaults to 1 but can be passed via mount_opts */ -#define WHICH_SUPER 1 -/* kind of from fs/ext2/super.c */ -#define SBLOCK (WHICH_SUPER * BLOCK_SIZE / DEV_BSIZE) /* = 2 */ - -/* include/asm-i386/types.h */ -typedef __signed__ char __s8; -typedef unsigned char __u8; -typedef __signed__ short __s16; -typedef unsigned short __u16; -typedef __signed__ int __s32; -typedef unsigned int __u32; - -/* - * Constants relative to the data blocks, from ext2_fs.h - */ -#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) - -/* include/linux/ext2_fs.h */ -struct ext2_super_block - { - __u32 s_inodes_count; /* Inodes count */ - __u32 s_blocks_count; /* Blocks count */ - __u32 s_r_blocks_count; /* Reserved blocks count */ - __u32 s_free_blocks_count; /* Free blocks count */ - __u32 s_free_inodes_count; /* Free inodes count */ - __u32 s_first_data_block; /* First Data Block */ - __u32 s_log_block_size; /* Block size */ - __s32 s_log_frag_size; /* Fragment size */ - __u32 s_blocks_per_group; /* # Blocks per group */ - __u32 s_frags_per_group; /* # Fragments per group */ - __u32 s_inodes_per_group; /* # Inodes per group */ - __u32 s_mtime; /* Mount time */ - __u32 s_wtime; /* Write time */ - __u16 s_mnt_count; /* Mount count */ - __s16 s_max_mnt_count; /* Maximal mount count */ - __u16 s_magic; /* Magic signature */ - __u16 s_state; /* File system state */ - __u16 s_errors; /* Behaviour when detecting errors */ - __u16 s_pad; - __u32 s_lastcheck; /* time of last check */ - __u32 s_checkinterval; /* max. time between checks */ - __u32 s_creator_os; /* OS */ - __u32 s_rev_level; /* Revision level */ - __u16 s_def_resuid; /* Default uid for reserved blocks */ - __u16 s_def_resgid; /* Default gid for reserved blocks */ - __u32 s_reserved[235]; /* Padding to the end of the block */ - }; - -struct ext2_group_desc - { - __u32 bg_block_bitmap; /* Blocks bitmap block */ - __u32 bg_inode_bitmap; /* Inodes bitmap block */ - __u32 bg_inode_table; /* Inodes table block */ - __u16 bg_free_blocks_count; /* Free blocks count */ - __u16 bg_free_inodes_count; /* Free inodes count */ - __u16 bg_used_dirs_count; /* Directories count */ - __u16 bg_pad; - __u32 bg_reserved[3]; - }; - -struct ext2_inode - { - __u16 i_mode; /* File mode */ - __u16 i_uid; /* Owner Uid */ - __u32 i_size; /* 4: Size in bytes */ - __u32 i_atime; /* Access time */ - __u32 i_ctime; /* 12: Creation time */ - __u32 i_mtime; /* Modification time */ - __u32 i_dtime; /* 20: Deletion Time */ - __u16 i_gid; /* Group Id */ - __u16 i_links_count; /* 24: Links count */ - __u32 i_blocks; /* Blocks count */ - __u32 i_flags; /* 32: File flags */ - union - { - struct - { - __u32 l_i_reserved1; - } - linux1; - struct - { - __u32 h_i_translator; - } - hurd1; - struct - { - __u32 m_i_reserved1; - } - masix1; - } - osd1; /* OS dependent 1 */ - __u32 i_block[EXT2_N_BLOCKS]; /* 40: Pointers to blocks */ - __u32 i_version; /* File version (for NFS) */ - __u32 i_file_acl; /* File ACL */ - __u32 i_dir_acl; /* Directory ACL */ - __u32 i_faddr; /* Fragment address */ - union - { - struct - { - __u8 l_i_frag; /* Fragment number */ - __u8 l_i_fsize; /* Fragment size */ - __u16 i_pad1; - __u32 l_i_reserved2[2]; - } - linux2; - struct - { - __u8 h_i_frag; /* Fragment number */ - __u8 h_i_fsize; /* Fragment size */ - __u16 h_i_mode_high; - __u16 h_i_uid_high; - __u16 h_i_gid_high; - __u32 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 */ - }; - -/* linux/limits.h */ -#define NAME_MAX 255 /* # chars in a file name */ - -/* linux/posix_type.h */ -typedef long linux_off_t; - -/* linux/ext2fs.h */ -#define EXT2_NAME_LEN 255 -struct ext2_dir_entry - { - __u32 inode; /* Inode number */ - __u16 rec_len; /* Directory entry length */ - __u8 name_len; /* Name length */ - __u8 file_type; - char name[EXT2_NAME_LEN]; /* File name */ - }; - -/* linux/ext2fs.h */ -/* - * 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) - - -/* ext2/super.c */ -#define log2(n) ffz(~(n)) - -#define EXT2_SUPER_MAGIC 0xEF53 /* include/linux/ext2_fs.h */ -#define EXT2_ROOT_INO 2 /* include/linux/ext2_fs.h */ -#define PATH_MAX 1024 /* include/linux/limits.h */ -#define MAX_LINK_COUNT 5 /* number of symbolic links to follow */ - -/* made up, these are pointers into FSYS_BUF */ -/* read once, always stays there: */ -#define SUPERBLOCK \ - ((struct ext2_super_block *)(FSYS_BUF)) -#define GROUP_DESC \ - ((struct ext2_group_desc *) \ - ((int)SUPERBLOCK + sizeof(struct ext2_super_block))) -#define INODE \ - ((struct ext2_inode *)((int)GROUP_DESC + EXT2_BLOCK_SIZE(SUPERBLOCK))) -#define DATABLOCK1 \ - ((int)((int)INODE + sizeof(struct ext2_inode))) -#define DATABLOCK2 \ - ((int)((int)DATABLOCK1 + EXT2_BLOCK_SIZE(SUPERBLOCK))) - -/* linux/ext2_fs.h */ -#define EXT2_ADDR_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof (__u32)) -#define EXT2_ADDR_PER_BLOCK_BITS(s) (log2(EXT2_ADDR_PER_BLOCK(s))) - -/* linux/ext2_fs.h */ -#define EXT2_BLOCK_SIZE_BITS(s) ((s)->s_log_block_size + 10) -/* kind of from ext2/super.c */ -#define EXT2_BLOCK_SIZE(s) (1 << EXT2_BLOCK_SIZE_BITS(s)) -/* linux/ext2fs.h */ -#define EXT2_DESC_PER_BLOCK(s) \ - (EXT2_BLOCK_SIZE(s) / sizeof (struct ext2_group_desc)) -/* linux/stat.h */ -#define S_IFMT 00170000 -#define S_IFLNK 0120000 -#define S_IFREG 0100000 -#define S_IFDIR 0040000 -#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) - -/* include/asm-i386/bitops.h */ -/* - * ffz = Find First Zero in word. Undefined if no zero exists, - * so code should check against ~0UL first.. - */ -static __inline__ unsigned long -ffz (unsigned long word) -{ - __asm__ ("bsfl %1,%0" -: "=r" (word) -: "r" (~word)); - return word; -} - -/* check filesystem types and read superblock into memory buffer */ -int -ext2fs_mount (void) -{ - int retval = 1; - - if ((((current_drive & 0x80) || (current_slice != 0)) - && (current_slice != PC_SLICE_TYPE_EXT2FS) - && (current_slice != PC_SLICE_TYPE_LINUX_RAID) - && (! IS_PC_SLICE_TYPE_BSD_WITH_FS (current_slice, FS_EXT2FS)) - && (! IS_PC_SLICE_TYPE_BSD_WITH_FS (current_slice, FS_OTHER))) - || part_length < (SBLOCK + (sizeof (struct ext2_super_block) / DEV_BSIZE)) - || !devread (SBLOCK, 0, sizeof (struct ext2_super_block), - (char *) SUPERBLOCK) - || SUPERBLOCK->s_magic != EXT2_SUPER_MAGIC) - retval = 0; - - return retval; -} - -/* Takes a file system block number and reads it into BUFFER. */ -static int -ext2_rdfsb (int fsblock, int buffer) -{ -#ifdef E2DEBUG - printf ("fsblock %d buffer %d\n", fsblock, buffer); -#endif /* E2DEBUG */ - return devread (fsblock * (EXT2_BLOCK_SIZE (SUPERBLOCK) / DEV_BSIZE), 0, - EXT2_BLOCK_SIZE (SUPERBLOCK), (char *) buffer); -} - -/* from - ext2/inode.c:ext2_bmap() -*/ -/* Maps LOGICAL_BLOCK (the file offset divided by the blocksize) into - a physical block (the location in the file system) via an inode. */ -static int -ext2fs_block_map (int logical_block) -{ - -#ifdef E2DEBUG - unsigned char *i; - for (i = (unsigned char *) INODE; - i < ((unsigned char *) INODE + sizeof (struct ext2_inode)); - i++) - { - printf ("%c", "0123456789abcdef"[*i >> 4]); - printf ("%c", "0123456789abcdef"[*i % 16]); - if (!((i + 1 - (unsigned char *) INODE) % 16)) - { - printf ("\n"); - } - else - { - printf (" "); - } - } - printf ("logical block %d\n", logical_block); -#endif /* E2DEBUG */ - - /* if it is directly pointed to by the inode, return that physical addr */ - if (logical_block < EXT2_NDIR_BLOCKS) - { -#ifdef E2DEBUG - printf ("returning %d\n", (unsigned char *) (INODE->i_block[logical_block])); - printf ("returning %d\n", INODE->i_block[logical_block]); -#endif /* E2DEBUG */ - return INODE->i_block[logical_block]; - } - /* else */ - logical_block -= EXT2_NDIR_BLOCKS; - /* try the indirect block */ - if (logical_block < EXT2_ADDR_PER_BLOCK (SUPERBLOCK)) - { - if (mapblock1 != 1 - && !ext2_rdfsb (INODE->i_block[EXT2_IND_BLOCK], DATABLOCK1)) - { - errnum = ERR_FSYS_CORRUPT; - return -1; - } - mapblock1 = 1; - return ((__u32 *) DATABLOCK1)[logical_block]; - } - /* else */ - logical_block -= EXT2_ADDR_PER_BLOCK (SUPERBLOCK); - /* now try the double indirect block */ - if (logical_block < (1 << (EXT2_ADDR_PER_BLOCK_BITS (SUPERBLOCK) * 2))) - { - int bnum; - if (mapblock1 != 2 - && !ext2_rdfsb (INODE->i_block[EXT2_DIND_BLOCK], DATABLOCK1)) - { - errnum = ERR_FSYS_CORRUPT; - return -1; - } - mapblock1 = 2; - if ((bnum = (((__u32 *) DATABLOCK1) - [logical_block >> EXT2_ADDR_PER_BLOCK_BITS (SUPERBLOCK)])) - != mapblock2 - && !ext2_rdfsb (bnum, DATABLOCK2)) - { - errnum = ERR_FSYS_CORRUPT; - return -1; - } - mapblock2 = bnum; - return ((__u32 *) DATABLOCK2) - [logical_block & (EXT2_ADDR_PER_BLOCK (SUPERBLOCK) - 1)]; - } - /* else */ - mapblock2 = -1; - logical_block -= (1 << (EXT2_ADDR_PER_BLOCK_BITS (SUPERBLOCK) * 2)); - if (mapblock1 != 3 - && !ext2_rdfsb (INODE->i_block[EXT2_TIND_BLOCK], DATABLOCK1)) - { - errnum = ERR_FSYS_CORRUPT; - return -1; - } - mapblock1 = 3; - if (!ext2_rdfsb (((__u32 *) DATABLOCK1) - [logical_block >> (EXT2_ADDR_PER_BLOCK_BITS (SUPERBLOCK) - * 2)], - DATABLOCK2)) - { - errnum = ERR_FSYS_CORRUPT; - return -1; - } - if (!ext2_rdfsb (((__u32 *) DATABLOCK2) - [(logical_block >> EXT2_ADDR_PER_BLOCK_BITS (SUPERBLOCK)) - & (EXT2_ADDR_PER_BLOCK (SUPERBLOCK) - 1)], - DATABLOCK2)) - { - errnum = ERR_FSYS_CORRUPT; - return -1; - } - return ((__u32 *) DATABLOCK2) - [logical_block & (EXT2_ADDR_PER_BLOCK (SUPERBLOCK) - 1)]; -} - -/* preconditions: all preconds of ext2fs_block_map */ -int -ext2fs_read (char *buf, int len) -{ - int logical_block; - int offset; - int map; - int ret = 0; - int size = 0; - -#ifdef E2DEBUG - static char hexdigit[] = "0123456789abcdef"; - unsigned char *i; - for (i = (unsigned char *) INODE; - i < ((unsigned char *) INODE + sizeof (struct ext2_inode)); - i++) - { - printf ("%c", hexdigit[*i >> 4]); - printf ("%c", hexdigit[*i % 16]); - if (!((i + 1 - (unsigned char *) INODE) % 16)) - { - printf ("\n"); - } - else - { - printf (" "); - } - } -#endif /* E2DEBUG */ - while (len > 0) - { - /* find the (logical) block component of our location */ - logical_block = filepos >> EXT2_BLOCK_SIZE_BITS (SUPERBLOCK); - offset = filepos & (EXT2_BLOCK_SIZE (SUPERBLOCK) - 1); - map = ext2fs_block_map (logical_block); -#ifdef E2DEBUG - printf ("map=%d\n", map); -#endif /* E2DEBUG */ - if (map < 0) - break; - - size = EXT2_BLOCK_SIZE (SUPERBLOCK); - size -= offset; - if (size > len) - size = len; - - if (map == 0) { - memset ((char *) buf, 0, size); - } else { - disk_read_func = disk_read_hook; - - devread (map * (EXT2_BLOCK_SIZE (SUPERBLOCK) / DEV_BSIZE), - offset, size, buf); - - disk_read_func = NULL; - } - - buf += size; - len -= size; - filepos += size; - ret += size; - } - - if (errnum) - ret = 0; - - return ret; -} - - -/* Based on: - def_blk_fops points to - blkdev_open, which calls (I think): - sys_open() - do_open() - open_namei() - dir_namei() which accesses current->fs->root - fs->root was set during original mount: - (something)... which calls (I think): - ext2_read_super() - iget() - __iget() - read_inode() - ext2_read_inode() - uses desc_per_block_bits, which is set in ext2_read_super() - also uses group descriptors loaded during ext2_read_super() - lookup() - ext2_lookup() - ext2_find_entry() - ext2_getblk() - -*/ - -static inline -int ext2_is_fast_symlink (void) -{ - int ea_blocks; - ea_blocks = INODE->i_file_acl ? EXT2_BLOCK_SIZE (SUPERBLOCK) / DEV_BSIZE : 0; - return INODE->i_blocks == ea_blocks; -} - -/* preconditions: ext2fs_mount already executed, therefore supblk in buffer - * known as SUPERBLOCK - * returns: 0 if error, nonzero iff we were able to find the file successfully - * postconditions: on a nonzero return, buffer known as INODE contains the - * inode of the file we were trying to look up - * side effects: messes up GROUP_DESC buffer area - */ -int -ext2fs_dir (char *dirname) -{ - int current_ino = EXT2_ROOT_INO; /* start at the root */ - int updir_ino = current_ino; /* the parent of the current directory */ - int group_id; /* which group the inode is in */ - int group_desc; /* fs pointer to that group */ - int desc; /* index within that group */ - int ino_blk; /* fs pointer of the inode's information */ - int str_chk = 0; /* used to hold the results of a string compare */ - struct ext2_group_desc *gdp; - struct ext2_inode *raw_inode; /* inode info corresponding to current_ino */ - - char linkbuf[PATH_MAX]; /* buffer for following symbolic links */ - int link_count = 0; - - char *rest; - char ch; /* temp char holder */ - - int off; /* offset within block of directory entry (off mod blocksize) */ - int loc; /* location within a directory */ - int blk; /* which data blk within dir entry (off div blocksize) */ - long map; /* fs pointer of a particular block from dir entry */ - struct ext2_dir_entry *dp; /* pointer to directory entry */ -#ifdef E2DEBUG - unsigned char *i; -#endif /* E2DEBUG */ - - /* loop invariants: - current_ino = inode to lookup - dirname = pointer to filename component we are cur looking up within - the directory known pointed to by current_ino (if any) - */ - - while (1) - { -#ifdef E2DEBUG - printf ("inode %d\n", current_ino); - printf ("dirname=%s\n", dirname); -#endif /* E2DEBUG */ - - /* look up an inode */ - group_id = (current_ino - 1) / (SUPERBLOCK->s_inodes_per_group); - group_desc = group_id >> log2 (EXT2_DESC_PER_BLOCK (SUPERBLOCK)); - desc = group_id & (EXT2_DESC_PER_BLOCK (SUPERBLOCK) - 1); -#ifdef E2DEBUG - printf ("ipg=%d, dpb=%d\n", SUPERBLOCK->s_inodes_per_group, - EXT2_DESC_PER_BLOCK (SUPERBLOCK)); - printf ("group_id=%d group_desc=%d desc=%d\n", group_id, group_desc, desc); -#endif /* E2DEBUG */ - if (!ext2_rdfsb ( - (WHICH_SUPER + group_desc + SUPERBLOCK->s_first_data_block), - (int) GROUP_DESC)) - { - return 0; - } - gdp = GROUP_DESC; - ino_blk = gdp[desc].bg_inode_table + - (((current_ino - 1) % (SUPERBLOCK->s_inodes_per_group)) - >> log2 (EXT2_BLOCK_SIZE (SUPERBLOCK) / sizeof (struct ext2_inode))); -#ifdef E2DEBUG - printf ("inode table fsblock=%d\n", ino_blk); -#endif /* E2DEBUG */ - if (!ext2_rdfsb (ino_blk, (int) INODE)) - { - return 0; - } - - /* reset indirect blocks! */ - mapblock2 = mapblock1 = -1; - - raw_inode = INODE + - ((current_ino - 1) - & (EXT2_BLOCK_SIZE (SUPERBLOCK) / sizeof (struct ext2_inode) - 1)); -#ifdef E2DEBUG - printf ("ipb=%d, sizeof(inode)=%d\n", - (EXT2_BLOCK_SIZE (SUPERBLOCK) / sizeof (struct ext2_inode)), - sizeof (struct ext2_inode)); - printf ("inode=%x, raw_inode=%x\n", INODE, raw_inode); - printf ("offset into inode table block=%d\n", (int) raw_inode - (int) INODE); - for (i = (unsigned char *) INODE; i <= (unsigned char *) raw_inode; - i++) - { - printf ("%c", "0123456789abcdef"[*i >> 4]); - printf ("%c", "0123456789abcdef"[*i % 16]); - if (!((i + 1 - (unsigned char *) INODE) % 16)) - { - printf ("\n"); - } - else - { - printf (" "); - } - } - printf ("first word=%x\n", *((int *) raw_inode)); -#endif /* E2DEBUG */ - - /* copy inode to fixed location */ - memmove ((void *) INODE, (void *) raw_inode, sizeof (struct ext2_inode)); - -#ifdef E2DEBUG - printf ("first word=%x\n", *((int *) INODE)); -#endif /* E2DEBUG */ - - /* If we've got a symbolic link, then chase it. */ - if (S_ISLNK (INODE->i_mode)) - { - int len; - if (++link_count > MAX_LINK_COUNT) - { - errnum = ERR_SYMLINK_LOOP; - return 0; - } - - /* Find out how long our remaining name is. */ - len = 0; - while (dirname[len] && !isspace (dirname[len])) - len++; - - /* Get the symlink size. */ - filemax = (INODE->i_size); - if (filemax + len > sizeof (linkbuf) - 2) - { - errnum = ERR_FILELENGTH; - return 0; - } - - if (len) - { - /* Copy the remaining name to the end of the symlink data. - Note that DIRNAME and LINKBUF may overlap! */ - memmove (linkbuf + filemax, dirname, len); - } - linkbuf[filemax + len] = '\0'; - - /* Read the symlink data. */ - if (! ext2_is_fast_symlink ()) - { - /* Read the necessary blocks, and reset the file pointer. */ - len = grub_read (linkbuf, filemax); - filepos = 0; - if (!len) - return 0; - } - else - { - /* Copy the data directly from the inode. */ - len = filemax; - memmove (linkbuf, (char *) INODE->i_block, len); - } - -#ifdef E2DEBUG - printf ("symlink=%s\n", linkbuf); -#endif - - dirname = linkbuf; - if (*dirname == '/') - { - /* It's an absolute link, so look it up in root. */ - current_ino = EXT2_ROOT_INO; - updir_ino = current_ino; - } - else - { - /* Relative, so look it up in our parent directory. */ - current_ino = updir_ino; - } - - /* Try again using the new name. */ - continue; - } - - /* if end of filename, INODE points to the file's inode */ - if (!*dirname || isspace (*dirname)) - { - if (!S_ISREG (INODE->i_mode)) - { - errnum = ERR_BAD_FILETYPE; - return 0; - } - - filemax = (INODE->i_size); - return 1; - } - - /* else we have to traverse a directory */ - updir_ino = current_ino; - - /* skip over slashes */ - while (*dirname == '/') - dirname++; - - /* if this isn't a directory of sufficient size to hold our file, abort */ - if (!(INODE->i_size) || !S_ISDIR (INODE->i_mode)) - { - errnum = ERR_BAD_FILETYPE; - return 0; - } - - /* skip to next slash or end of filename (space) */ - for (rest = dirname; (ch = *rest) && !isspace (ch) && ch != '/'; - rest++); - - /* look through this directory and find the next filename component */ - /* invariant: rest points to slash after the next filename component */ - *rest = 0; - loc = 0; - - do - { - -#ifdef E2DEBUG - printf ("dirname=%s, rest=%s, loc=%d\n", dirname, rest, loc); -#endif /* E2DEBUG */ - - /* if our location/byte offset into the directory exceeds the size, - give up */ - if (loc >= INODE->i_size) - { - if (print_possibilities < 0) - { -# if 0 - putchar ('\n'); -# endif - } - else - { - errnum = ERR_FILE_NOT_FOUND; - *rest = ch; - } - return (print_possibilities < 0); - } - - /* else, find the (logical) block component of our location */ - blk = loc >> EXT2_BLOCK_SIZE_BITS (SUPERBLOCK); - - /* we know which logical block of the directory entry we are looking - for, now we have to translate that to the physical (fs) block on - the disk */ - map = ext2fs_block_map (blk); -#ifdef E2DEBUG - printf ("fs block=%d\n", map); -#endif /* E2DEBUG */ - mapblock2 = -1; - if ((map < 0) || !ext2_rdfsb (map, DATABLOCK2)) - { - errnum = ERR_FSYS_CORRUPT; - *rest = ch; - return 0; - } - off = loc & (EXT2_BLOCK_SIZE (SUPERBLOCK) - 1); - dp = (struct ext2_dir_entry *) (DATABLOCK2 + off); - /* advance loc prematurely to next on-disk directory entry */ - loc += dp->rec_len; - - /* NOTE: ext2fs filenames are NOT null-terminated */ - -#ifdef E2DEBUG - printf ("directory entry ino=%d\n", dp->inode); - if (dp->inode) - printf ("entry=%s\n", dp->name); -#endif /* E2DEBUG */ - - if (dp->inode) - { - int saved_c = dp->name[dp->name_len]; - - dp->name[dp->name_len] = 0; - str_chk = substring (dirname, dp->name); - -# ifndef STAGE1_5 - if (print_possibilities && ch != '/' - && (!*dirname || str_chk <= 0)) - { - if (print_possibilities > 0) - print_possibilities = -print_possibilities; - print_a_completion (dp->name); - } -# endif - - dp->name[dp->name_len] = saved_c; - } - - } - while (!dp->inode || (str_chk || (print_possibilities && ch != '/'))); - - current_ino = dp->inode; - *(dirname = rest) = ch; - } - /* never get here */ -} - -#endif /* FSYS_EXT2_FS */ diff --git a/usr/src/grub/grub-0.95/stage2/fsys_fat.c b/usr/src/grub/grub-0.95/stage2/fsys_fat.c deleted file mode 100644 index 9b6a7a43d9..0000000000 --- a/usr/src/grub/grub-0.95/stage2/fsys_fat.c +++ /dev/null @@ -1,486 +0,0 @@ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 2000, 2001 Free Software Foundation, 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 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. - */ - -#ifdef FSYS_FAT - -#include "shared.h" -#include "filesys.h" -#include "fat.h" - -struct fat_superblock -{ - int fat_offset; - int fat_length; - int fat_size; - int root_offset; - int root_max; - int data_offset; - - int num_sectors; - int num_clust; - int clust_eof_marker; - int sects_per_clust; - int sectsize_bits; - int clustsize_bits; - int root_cluster; - - int cached_fat; - int file_cluster; - int current_cluster_num; - int current_cluster; -}; - -/* pointer(s) into filesystem info buffer for DOS stuff */ -#define FAT_SUPER ( (struct fat_superblock *) \ - ( FSYS_BUF + 32256) )/* 512 bytes long */ -#define FAT_BUF ( FSYS_BUF + 30208 ) /* 4 sector FAT buffer */ -#define NAME_BUF ( FSYS_BUF + 29184 ) /* Filename buffer (833 bytes) */ - -#define FAT_CACHE_SIZE 2048 - -static __inline__ unsigned long -grub_log2 (unsigned long word) -{ - __asm__ ("bsfl %1,%0" - : "=r" (word) - : "r" (word)); - return word; -} -#define log2 grub_log2 - -int -fat_mount (void) -{ - struct fat_bpb bpb; - __u32 magic, first_fat; - - /* Check partition type for harddisk */ - if (((current_drive & 0x80) || (current_slice != 0)) - && ! IS_PC_SLICE_TYPE_FAT (current_slice) - && (! IS_PC_SLICE_TYPE_BSD_WITH_FS (current_slice, FS_MSDOS))) - return 0; - - /* Read bpb */ - if (! devread (0, 0, sizeof (bpb), (char *) &bpb)) - return 0; - - /* Check if the number of sectors per cluster is zero here, to avoid - zero division. */ - if (bpb.sects_per_clust == 0) - return 0; - - FAT_SUPER->sectsize_bits = log2 (FAT_CVT_U16 (bpb.bytes_per_sect)); - FAT_SUPER->clustsize_bits - = FAT_SUPER->sectsize_bits + log2 (bpb.sects_per_clust); - - /* Fill in info about super block */ - FAT_SUPER->num_sectors = FAT_CVT_U16 (bpb.short_sectors) - ? FAT_CVT_U16 (bpb.short_sectors) : bpb.long_sectors; - - /* FAT offset and length */ - FAT_SUPER->fat_offset = FAT_CVT_U16 (bpb.reserved_sects); - FAT_SUPER->fat_length = - bpb.fat_length ? bpb.fat_length : bpb.fat32_length; - - /* Rootdir offset and length for FAT12/16 */ - FAT_SUPER->root_offset = - FAT_SUPER->fat_offset + bpb.num_fats * FAT_SUPER->fat_length; - FAT_SUPER->root_max = FAT_DIRENTRY_LENGTH * FAT_CVT_U16(bpb.dir_entries); - - /* Data offset and number of clusters */ - FAT_SUPER->data_offset = - FAT_SUPER->root_offset - + ((FAT_SUPER->root_max - 1) >> FAT_SUPER->sectsize_bits) + 1; - FAT_SUPER->num_clust = - 2 + ((FAT_SUPER->num_sectors - FAT_SUPER->data_offset) - / bpb.sects_per_clust); - FAT_SUPER->sects_per_clust = bpb.sects_per_clust; - - if (!bpb.fat_length) - { - /* This is a FAT32 */ - if (FAT_CVT_U16(bpb.dir_entries)) - return 0; - - if (bpb.flags & 0x0080) - { - /* FAT mirroring is disabled, get active FAT */ - int active_fat = bpb.flags & 0x000f; - if (active_fat >= bpb.num_fats) - return 0; - FAT_SUPER->fat_offset += active_fat * FAT_SUPER->fat_length; - } - - FAT_SUPER->fat_size = 8; - FAT_SUPER->root_cluster = bpb.root_cluster; - - /* Yes the following is correct. FAT32 should be called FAT28 :) */ - FAT_SUPER->clust_eof_marker = 0xffffff8; - } - else - { - if (!FAT_SUPER->root_max) - return 0; - - FAT_SUPER->root_cluster = -1; - if (FAT_SUPER->num_clust > FAT_MAX_12BIT_CLUST) - { - FAT_SUPER->fat_size = 4; - FAT_SUPER->clust_eof_marker = 0xfff8; - } - else - { - FAT_SUPER->fat_size = 3; - FAT_SUPER->clust_eof_marker = 0xff8; - } - } - - - /* Now do some sanity checks */ - - if (FAT_CVT_U16(bpb.bytes_per_sect) != (1 << FAT_SUPER->sectsize_bits) - || FAT_CVT_U16(bpb.bytes_per_sect) != SECTOR_SIZE - || bpb.sects_per_clust != (1 << (FAT_SUPER->clustsize_bits - - FAT_SUPER->sectsize_bits)) - || FAT_SUPER->num_clust <= 2 - || (FAT_SUPER->fat_size * FAT_SUPER->num_clust / (2 * SECTOR_SIZE) - > FAT_SUPER->fat_length)) - return 0; - - /* kbs: Media check on first FAT entry [ported from PUPA] */ - - if (!devread(FAT_SUPER->fat_offset, 0, - sizeof(first_fat), (char *)&first_fat)) - return 0; - - if (FAT_SUPER->fat_size == 8) - { - first_fat &= 0x0fffffff; - magic = 0x0fffff00; - } - else if (FAT_SUPER->fat_size == 4) - { - first_fat &= 0x0000ffff; - magic = 0xff00; - } - else - { - first_fat &= 0x00000fff; - magic = 0x0f00; - } - - if (first_fat != (magic | bpb.media)) - return 0; - - FAT_SUPER->cached_fat = - 2 * FAT_CACHE_SIZE; - return 1; -} - -int -fat_read (char *buf, int len) -{ - int logical_clust; - int offset; - int ret = 0; - int size; - - if (FAT_SUPER->file_cluster < 0) - { - /* root directory for fat16 */ - size = FAT_SUPER->root_max - filepos; - if (size > len) - size = len; - if (!devread(FAT_SUPER->root_offset, filepos, size, buf)) - return 0; - filepos += size; - return size; - } - - logical_clust = filepos >> FAT_SUPER->clustsize_bits; - offset = (filepos & ((1 << FAT_SUPER->clustsize_bits) - 1)); - if (logical_clust < FAT_SUPER->current_cluster_num) - { - FAT_SUPER->current_cluster_num = 0; - FAT_SUPER->current_cluster = FAT_SUPER->file_cluster; - } - - while (len > 0) - { - int sector; - while (logical_clust > FAT_SUPER->current_cluster_num) - { - /* calculate next cluster */ - int fat_entry = - FAT_SUPER->current_cluster * FAT_SUPER->fat_size; - int next_cluster; - int cached_pos = (fat_entry - FAT_SUPER->cached_fat); - - if (cached_pos < 0 || - (cached_pos + FAT_SUPER->fat_size) > 2*FAT_CACHE_SIZE) - { - FAT_SUPER->cached_fat = (fat_entry & ~(2*SECTOR_SIZE - 1)); - cached_pos = (fat_entry - FAT_SUPER->cached_fat); - sector = FAT_SUPER->fat_offset - + FAT_SUPER->cached_fat / (2*SECTOR_SIZE); - if (!devread (sector, 0, FAT_CACHE_SIZE, (char*) FAT_BUF)) - return 0; - } - next_cluster = * (unsigned long *) (FAT_BUF + (cached_pos >> 1)); - if (FAT_SUPER->fat_size == 3) - { - if (cached_pos & 1) - next_cluster >>= 4; - next_cluster &= 0xFFF; - } - else if (FAT_SUPER->fat_size == 4) - next_cluster &= 0xFFFF; - - if (next_cluster >= FAT_SUPER->clust_eof_marker) - return ret; - if (next_cluster < 2 || next_cluster >= FAT_SUPER->num_clust) - { - errnum = ERR_FSYS_CORRUPT; - return 0; - } - - FAT_SUPER->current_cluster = next_cluster; - FAT_SUPER->current_cluster_num++; - } - - sector = FAT_SUPER->data_offset + - ((FAT_SUPER->current_cluster - 2) << (FAT_SUPER->clustsize_bits - - FAT_SUPER->sectsize_bits)); - size = (1 << FAT_SUPER->clustsize_bits) - offset; - if (size > len) - size = len; - - disk_read_func = disk_read_hook; - - devread(sector, offset, size, buf); - - disk_read_func = NULL; - - len -= size; - buf += size; - ret += size; - filepos += size; - logical_clust++; - offset = 0; - } - return errnum ? 0 : ret; -} - -int -fat_dir (char *dirname) -{ - char *rest, ch, dir_buf[FAT_DIRENTRY_LENGTH]; - char *filename = (char *) NAME_BUF; - int attrib = FAT_ATTRIB_DIR; -#ifndef STAGE1_5 - int do_possibilities = 0; -#endif - - /* XXX I18N: - * the positions 2,4,6 etc are high bytes of a 16 bit unicode char - */ - static unsigned char longdir_pos[] = - { 1, 3, 5, 7, 9, 14, 16, 18, 20, 22, 24, 28, 30 }; - int slot = -2; - int alias_checksum = -1; - - FAT_SUPER->file_cluster = FAT_SUPER->root_cluster; - filepos = 0; - FAT_SUPER->current_cluster_num = MAXINT; - - /* main loop to find desired directory entry */ - loop: - - /* if we have a real file (and we're not just printing possibilities), - then this is where we want to exit */ - - if (!*dirname || isspace (*dirname)) - { - if (attrib & FAT_ATTRIB_DIR) - { - errnum = ERR_BAD_FILETYPE; - return 0; - } - - return 1; - } - - /* continue with the file/directory name interpretation */ - - while (*dirname == '/') - dirname++; - - if (!(attrib & FAT_ATTRIB_DIR)) - { - errnum = ERR_BAD_FILETYPE; - return 0; - } - /* Directories don't have a file size */ - filemax = MAXINT; - - for (rest = dirname; (ch = *rest) && !isspace (ch) && ch != '/'; rest++); - - *rest = 0; - -# ifndef STAGE1_5 - if (print_possibilities && ch != '/') - do_possibilities = 1; -# endif - - while (1) - { - if (fat_read (dir_buf, FAT_DIRENTRY_LENGTH) != FAT_DIRENTRY_LENGTH - || dir_buf[0] == 0) - { - if (!errnum) - { -# ifndef STAGE1_5 - if (print_possibilities < 0) - { -#if 0 - putchar ('\n'); -#endif - return 1; - } -# endif /* STAGE1_5 */ - - errnum = ERR_FILE_NOT_FOUND; - *rest = ch; - } - - return 0; - } - - if (FAT_DIRENTRY_ATTRIB (dir_buf) == FAT_ATTRIB_LONGNAME) - { - /* This is a long filename. The filename is build from back - * to front and may span multiple entries. To bind these - * entries together they all contain the same checksum over - * the short alias. - * - * The id field tells if this is the first entry (the last - * part) of the long filename, and also at which offset this - * belongs. - * - * We just write the part of the long filename this entry - * describes and continue with the next dir entry. - */ - int i, offset; - unsigned char id = FAT_LONGDIR_ID(dir_buf); - - if ((id & 0x40)) - { - id &= 0x3f; - slot = id; - filename[slot * 13] = 0; - alias_checksum = FAT_LONGDIR_ALIASCHECKSUM(dir_buf); - } - - if (id != slot || slot == 0 - || alias_checksum != FAT_LONGDIR_ALIASCHECKSUM(dir_buf)) - { - alias_checksum = -1; - continue; - } - - slot--; - offset = slot * 13; - - for (i=0; i < 13; i++) - filename[offset+i] = dir_buf[longdir_pos[i]]; - continue; - } - - if (!FAT_DIRENTRY_VALID (dir_buf)) - continue; - - if (alias_checksum != -1 && slot == 0) - { - int i; - unsigned char sum; - - slot = -2; - for (sum = 0, i = 0; i< 11; i++) - sum = ((sum >> 1) | (sum << 7)) + dir_buf[i]; - - if (sum == alias_checksum) - { -# ifndef STAGE1_5 - if (do_possibilities) - goto print_filename; -# endif /* STAGE1_5 */ - - if (substring (dirname, filename) == 0) - break; - } - } - - /* XXX convert to 8.3 filename format here */ - { - int i, j, c; - - for (i = 0; i < 8 && (c = filename[i] = tolower (dir_buf[i])) - && !isspace (c); i++); - - filename[i++] = '.'; - - for (j = 0; j < 3 && (c = filename[i + j] = tolower (dir_buf[8 + j])) - && !isspace (c); j++); - - if (j == 0) - i--; - - filename[i + j] = 0; - } - -# ifndef STAGE1_5 - if (do_possibilities) - { - print_filename: - if (substring (dirname, filename) <= 0) - { - if (print_possibilities > 0) - print_possibilities = -print_possibilities; - print_a_completion (filename); - } - continue; - } -# endif /* STAGE1_5 */ - - if (substring (dirname, filename) == 0) - break; - } - - *(dirname = rest) = ch; - - attrib = FAT_DIRENTRY_ATTRIB (dir_buf); - filemax = FAT_DIRENTRY_FILELENGTH (dir_buf); - filepos = 0; - FAT_SUPER->file_cluster = FAT_DIRENTRY_FIRST_CLUSTER (dir_buf); - FAT_SUPER->current_cluster_num = MAXINT; - - /* go back to main loop at top of function */ - goto loop; -} - -#endif /* FSYS_FAT */ diff --git a/usr/src/grub/grub-0.95/stage2/fsys_ffs.c b/usr/src/grub/grub-0.95/stage2/fsys_ffs.c deleted file mode 100644 index 2af53334f9..0000000000 --- a/usr/src/grub/grub-0.95/stage2/fsys_ffs.c +++ /dev/null @@ -1,310 +0,0 @@ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 2000, 2001 Free Software Foundation, 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 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. - */ - -/* - * Elements of this file were originally from the FreeBSD "biosboot" - * bootloader file "disk.c" dated 4/12/95. - * - * The license and header comments from that file are included here. - */ - -/* - * Mach Operating System - * Copyright (c) 1992, 1991 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. - * - * 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 FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie Mellon - * the rights to redistribute these changes. - * - * from: Mach, Revision 2.2 92/04/04 11:35:49 rpd - * $Id: fsys_ffs.c,v 1.1.1.1 2003/11/20 02:04:59 fengshuo Exp $ - */ - -#ifdef FSYS_FFS - -#include "shared.h" - -#include "filesys.h" - -#include "defs.h" -#include "disk_inode.h" -#include "disk_inode_ffs.h" -#include "dir.h" -#include "fs.h" - -/* used for filesystem map blocks */ -static int mapblock; -static int mapblock_offset; -static int mapblock_bsize; - -/* pointer to superblock */ -#define SUPERBLOCK ((struct fs *) ( FSYS_BUF + 8192 )) -#define INODE ((struct icommon *) ( FSYS_BUF + 16384 )) -#define MAPBUF ( FSYS_BUF + 24576 ) -#define MAPBUF_LEN 8192 - - -int -ffs_mount (void) -{ - int retval = 1; - - if ((((current_drive & 0x80) || (current_slice != 0)) - && ! IS_PC_SLICE_TYPE_BSD_WITH_FS (current_slice, FS_BSDFFS)) - || part_length < (SBLOCK + (SBSIZE / DEV_BSIZE)) - || !devread (SBLOCK, 0, SBSIZE, (char *) SUPERBLOCK) - || SUPERBLOCK->fs_magic != FS_MAGIC) - retval = 0; - - mapblock = -1; - mapblock_offset = -1; - - return retval; -} - -static int -block_map (int file_block) -{ - int bnum, offset, bsize; - - if (file_block < NDADDR) - return (INODE->i_db[file_block]); - - /* If the blockmap loaded does not include FILE_BLOCK, - load a new blockmap. */ - if ((bnum = fsbtodb (SUPERBLOCK, INODE->i_ib[0])) != mapblock - || (mapblock_offset <= bnum && bnum <= mapblock_offset + mapblock_bsize)) - { - if (MAPBUF_LEN < SUPERBLOCK->fs_bsize) - { - offset = ((file_block - NDADDR) % NINDIR (SUPERBLOCK)); - bsize = MAPBUF_LEN; - - if (offset + MAPBUF_LEN > SUPERBLOCK->fs_bsize) - offset = (SUPERBLOCK->fs_bsize - MAPBUF_LEN) / sizeof (int); - } - else - { - bsize = SUPERBLOCK->fs_bsize; - offset = 0; - } - - if (! devread (bnum, offset * sizeof (int), bsize, (char *) MAPBUF)) - { - mapblock = -1; - mapblock_bsize = -1; - mapblock_offset = -1; - errnum = ERR_FSYS_CORRUPT; - return -1; - } - - mapblock = bnum; - mapblock_bsize = bsize; - mapblock_offset = offset; - } - - return (((int *) MAPBUF)[((file_block - NDADDR) % NINDIR (SUPERBLOCK)) - - mapblock_offset]); -} - - -int -ffs_read (char *buf, int len) -{ - int logno, off, size, map, ret = 0; - - while (len && !errnum) - { - off = blkoff (SUPERBLOCK, filepos); - logno = lblkno (SUPERBLOCK, filepos); - size = blksize (SUPERBLOCK, INODE, logno); - - if ((map = block_map (logno)) < 0) - break; - - size -= off; - - if (size > len) - size = len; - - disk_read_func = disk_read_hook; - - devread (fsbtodb (SUPERBLOCK, map), off, size, buf); - - disk_read_func = NULL; - - buf += size; - len -= size; - filepos += size; - ret += size; - } - - if (errnum) - ret = 0; - - return ret; -} - - -int -ffs_dir (char *dirname) -{ - char *rest, ch; - int block, off, loc, map, ino = ROOTINO; - struct direct *dp; - -/* main loop to find destination inode */ -loop: - - /* load current inode (defaults to the root inode) */ - - if (!devread (fsbtodb (SUPERBLOCK, itod (SUPERBLOCK, ino)), - ino % (SUPERBLOCK->fs_inopb) * sizeof (struct dinode), - sizeof (struct dinode), (char *) INODE)) - return 0; /* XXX what return value? */ - - /* if we have a real file (and we're not just printing possibilities), - then this is where we want to exit */ - - if (!*dirname || isspace (*dirname)) - { - if ((INODE->i_mode & IFMT) != IFREG) - { - errnum = ERR_BAD_FILETYPE; - return 0; - } - - filemax = INODE->i_size; - - /* incomplete implementation requires this! */ - fsmax = (NDADDR + NINDIR (SUPERBLOCK)) * SUPERBLOCK->fs_bsize; - return 1; - } - - /* continue with file/directory name interpretation */ - - while (*dirname == '/') - dirname++; - - if (!(INODE->i_size) || ((INODE->i_mode & IFMT) != IFDIR)) - { - errnum = ERR_BAD_FILETYPE; - return 0; - } - - for (rest = dirname; (ch = *rest) && !isspace (ch) && ch != '/'; rest++); - - *rest = 0; - loc = 0; - - /* loop for reading a the entries in a directory */ - - do - { - if (loc >= INODE->i_size) - { -#if 0 - putchar ('\n'); -#endif - - if (print_possibilities < 0) - return 1; - - errnum = ERR_FILE_NOT_FOUND; - *rest = ch; - return 0; - } - - if (!(off = blkoff (SUPERBLOCK, loc))) - { - block = lblkno (SUPERBLOCK, loc); - - if ((map = block_map (block)) < 0 - || !devread (fsbtodb (SUPERBLOCK, map), 0, - blksize (SUPERBLOCK, INODE, block), - (char *) FSYS_BUF)) - { - errnum = ERR_FSYS_CORRUPT; - *rest = ch; - return 0; - } - } - - dp = (struct direct *) (FSYS_BUF + off); - loc += dp->d_reclen; - -#ifndef STAGE1_5 - if (dp->d_ino && print_possibilities && ch != '/' - && (!*dirname || substring (dirname, dp->d_name) <= 0)) - { - if (print_possibilities > 0) - print_possibilities = -print_possibilities; - - print_a_completion (dp->d_name); - } -#endif /* STAGE1_5 */ - } - while (!dp->d_ino || (substring (dirname, dp->d_name) != 0 - || (print_possibilities && ch != '/'))); - - /* only get here if we have a matching directory entry */ - - ino = dp->d_ino; - *(dirname = rest) = ch; - - /* go back to main loop at top of function */ - goto loop; -} - -int -ffs_embed (int *start_sector, int needed_sectors) -{ - /* XXX: I don't know if this is really correct. Someone who is - familiar with BSD should check for this. */ - if (needed_sectors > 14) - return 0; - - *start_sector = 1; -#if 1 - /* FIXME: Disable the embedding in FFS until someone checks if - the code above is correct. */ - return 0; -#else - return 1; -#endif -} - -#endif /* FSYS_FFS */ diff --git a/usr/src/grub/grub-0.95/stage2/fsys_iso9660.c b/usr/src/grub/grub-0.95/stage2/fsys_iso9660.c deleted file mode 100644 index 555ea1eb77..0000000000 --- a/usr/src/grub/grub-0.95/stage2/fsys_iso9660.c +++ /dev/null @@ -1,449 +0,0 @@ -/* - * ISO 9660 filesystem backend for GRUB (GRand Unified Bootloader) - * including Rock Ridge Extensions support - * - * Copyright (C) 1998, 1999 Kousuke Takai - * - * 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. - */ -/* - * References: - * linux/fs/isofs/rock.[ch] - * mkisofs-1.11.1/diag/isoinfo.c - * mkisofs-1.11.1/iso9660.h - * (all are written by Eric Youngdale) - * - * Modifications by: - * Leonid Lisovskiy 2003 - */ - -#ifdef FSYS_ISO9660 - -#include "shared.h" -#include "filesys.h" -#include "iso9660.h" - -/* iso9660 super-block data in memory */ -struct iso_sb_info { - unsigned long vol_sector; - -}; - -/* iso fs inode data in memory */ -struct iso_inode_info { - unsigned long file_start; -}; - -#define ISO_SUPER \ - ((struct iso_sb_info *)(FSYS_BUF)) -#define INODE \ - ((struct iso_inode_info *)(FSYS_BUF+sizeof(struct iso_sb_info))) -#define PRIMDESC ((struct iso_primary_descriptor *)(FSYS_BUF + 2048)) -#define DIRREC ((struct iso_directory_record *)(FSYS_BUF + 4096)) -#define RRCONT_BUF ((unsigned char *)(FSYS_BUF + 6144)) -#define NAME_BUF ((unsigned char *)(FSYS_BUF + 8192)) - - -static inline unsigned long -grub_log2 (unsigned long word) -{ - asm volatile ("bsfl %1,%0" - : "=r" (word) - : "r" (word)); - return word; -} -#define log2 grub_log2 - -static int -iso9660_devread (int sector, int byte_offset, int byte_len, char *buf) -{ - static int read_count = 0, threshold = 2; - unsigned short sector_size_lg2 = log2(buf_geom.sector_size); - - /* - * We have to use own devread() function since BIOS return wrong geometry - */ - if (sector < 0) - { - errnum = ERR_OUTSIDE_PART; - return 0; - } - if (byte_len <= 0) - return 1; - - sector += (byte_offset >> sector_size_lg2); - byte_offset &= (buf_geom.sector_size - 1); - asm volatile ("shl%L0 %1,%0" - : "=r"(sector) - : "Ic"((int8_t)(ISO_SECTOR_BITS - sector_size_lg2)), - "0"(sector)); - -#if !defined(STAGE1_5) - if (disk_read_hook && debug) - printf ("<%d, %d, %d>", sector, byte_offset, byte_len); -#endif /* !STAGE1_5 */ - - read_count += (byte_len >> 9); - if ((read_count >> 11) > threshold) { - noisy_printf("."); - threshold += 2; /* one dot every 2 MB */ - } - return rawread(current_drive, part_start + sector, byte_offset, byte_len, buf); -} - -int -iso9660_mount (void) -{ - unsigned int sector; - - /* - * Because there is no defined slice type ID for ISO-9660 filesystem, - * this test will pass only either (1) if entire disk is used, or - * (2) if current partition is BSD style sub-partition whose ID is - * ISO-9660. - */ - if ((current_partition != 0xFFFFFF) - && !IS_PC_SLICE_TYPE_BSD_WITH_FS(current_slice, FS_ISO9660)) - return 0; - - /* - * Currently, only FIRST session of MultiSession disks are supported !!! - */ - for (sector = 16 ; sector < 32 ; sector++) - { - if (!iso9660_devread(sector, 0, sizeof(*PRIMDESC), (char *)PRIMDESC)) - break; - /* check ISO_VD_PRIMARY and ISO_STANDARD_ID */ - if (PRIMDESC->type.l == ISO_VD_PRIMARY - && !memcmp(PRIMDESC->id, ISO_STANDARD_ID, sizeof(PRIMDESC->id))) - { - ISO_SUPER->vol_sector = sector; - INODE->file_start = 0; - fsmax = PRIMDESC->volume_space_size.l; - return 1; - } - } - - return 0; -} - -int -iso9660_dir (char *dirname) -{ - struct iso_directory_record *idr; - RR_ptr_t rr_ptr; - struct rock_ridge *ce_ptr; - unsigned int pathlen; - int size; - unsigned int extent; - unsigned char file_type; - unsigned int rr_len; - unsigned char rr_flag; - - idr = &PRIMDESC->root_directory_record; - INODE->file_start = 0; - - do - { - while (*dirname == '/') /* skip leading slashes */ - dirname++; - /* pathlen = strcspn(dirname, "/\n\t "); */ - for (pathlen = 0 ; - dirname[pathlen] - && !isspace(dirname[pathlen]) && dirname[pathlen] != '/' ; - pathlen++) - ; - - size = idr->size.l; - extent = idr->extent.l; - - while (size > 0) - { - if (!iso9660_devread(extent, 0, ISO_SECTOR_SIZE, (char *)DIRREC)) - { - errnum = ERR_FSYS_CORRUPT; - return 0; - } - extent++; - - idr = (struct iso_directory_record *)DIRREC; - for (; idr->length.l > 0; - idr = (struct iso_directory_record *)((char *)idr + idr->length.l) ) - { - const char *name = idr->name; - unsigned int name_len = idr->name_len.l; - - file_type = (idr->flags.l & 2) ? ISO_DIRECTORY : ISO_REGULAR; - if (name_len == 1) - { - if ((name[0] == 0) || /* self */ - (name[0] == 1)) /* parent */ - continue; - } - if (name_len > 2 && CHECK2(name + name_len - 2, ';', '1')) - { - name_len -= 2; /* truncate trailing file version */ - if (name_len > 1 && name[name_len - 1] == '.') - name_len--; /* truncate trailing dot */ - } - - /* - * Parse Rock-Ridge extension - */ - rr_len = (idr->length.l - idr->name_len.l - - sizeof(struct iso_directory_record) - + sizeof(idr->name)); - rr_ptr.ptr = ((unsigned char *)idr + idr->name_len.l - + sizeof(struct iso_directory_record) - - sizeof(idr->name)); - if (rr_ptr.i & 1) - rr_ptr.i++, rr_len--; - ce_ptr = NULL; - rr_flag = RR_FLAG_NM | RR_FLAG_PX /*| RR_FLAG_SL*/; - - while (rr_len >= 4) - { - if (rr_ptr.rr->version != 1) - { -#ifndef STAGE1_5 - if (debug) - printf( - "Non-supported version (%d) RockRidge chunk " - "`%c%c'\n", rr_ptr.rr->version, - rr_ptr.rr->signature & 0xFF, - rr_ptr.rr->signature >> 8); -#endif - } - else - { - switch (rr_ptr.rr->signature) - { - case RRMAGIC('R', 'R'): - if ( rr_ptr.rr->len >= (4+sizeof(struct RR))) - rr_flag &= rr_ptr.rr->u.rr.flags.l; - break; - case RRMAGIC('N', 'M'): - name = rr_ptr.rr->u.nm.name; - name_len = rr_ptr.rr->len - (4+sizeof(struct NM)); - rr_flag &= ~RR_FLAG_NM; - break; - case RRMAGIC('P', 'X'): - if (rr_ptr.rr->len >= (4+sizeof(struct PX))) - { - file_type = ((rr_ptr.rr->u.px.mode.l & POSIX_S_IFMT) - == POSIX_S_IFREG - ? ISO_REGULAR - : ((rr_ptr.rr->u.px.mode.l & POSIX_S_IFMT) - == POSIX_S_IFDIR - ? ISO_DIRECTORY : ISO_OTHER)); - rr_flag &= ~RR_FLAG_PX; - } - break; - case RRMAGIC('C', 'E'): - if (rr_ptr.rr->len >= (4+sizeof(struct CE))) - ce_ptr = rr_ptr.rr; - break; -#if 0 // RockRidge symlinks are not supported yet - case RRMAGIC('S', 'L'): - { - int slen; - unsigned char rootflag, prevflag; - char *rpnt = NAME_BUF+1024; - struct SL_component *slp; - - slen = rr_ptr.rr->len - (4+1); - slp = &rr_ptr.rr->u.sl.link; - while (slen > 1) - { - rootflag = 0; - switch (slp->flags.l) - { - case 0: - memcpy(rpnt, slp->text, slp->len); - rpnt += slp->len; - break; - case 4: - *rpnt++ = '.'; - /* fallthru */ - case 2: - *rpnt++ = '.'; - break; - case 8: - rootflag = 1; - *rpnt++ = '/'; - break; - default: - printf("Symlink component flag not implemented (%d)\n", - slp->flags.l); - slen = 0; - break; - } - slen -= slp->len + 2; - prevflag = slp->flags.l; - slp = (struct SL_component *) ((char *) slp + slp->len + 2); - - if (slen < 2) - { - /* - * If there is another SL record, and this component - * record isn't continued, then add a slash. - */ - if ((!rootflag) && (rr_ptr.rr->u.sl.flags.l & 1) && !(prevflag & 1)) - *rpnt++='/'; - break; - } - - /* - * If this component record isn't continued, then append a '/'. - */ - if (!rootflag && !(prevflag & 1)) - *rpnt++ = '/'; - } - *rpnt++ = '\0'; - grub_putstr(NAME_BUF+1024);// debug print! - } - rr_flag &= ~RR_FLAG_SL; - break; -#endif - default: - break; - } - } - if (!rr_flag) - /* - * There is no more extension we expects... - */ - break; - - rr_len -= rr_ptr.rr->len; - rr_ptr.ptr += rr_ptr.rr->len; - if (rr_len < 4 && ce_ptr != NULL) - { - /* preserve name before loading new extent. */ - if( RRCONT_BUF <= (unsigned char *)name - && (unsigned char *)name < RRCONT_BUF + ISO_SECTOR_SIZE ) - { - memcpy(NAME_BUF, name, name_len); - name = NAME_BUF; - } - rr_ptr.ptr = RRCONT_BUF + ce_ptr->u.ce.offset.l; - rr_len = ce_ptr->u.ce.size.l; - if (!iso9660_devread(ce_ptr->u.ce.extent.l, 0, ISO_SECTOR_SIZE, RRCONT_BUF)) - { - errnum = 0; /* this is not fatal. */ - break; - } - ce_ptr = NULL; - } - } /* rr_len >= 4 */ - - filemax = MAXINT; - if (name_len >= pathlen - && !memcmp(name, dirname, pathlen)) - { - if (dirname[pathlen] == '/' || !print_possibilities) - { - /* - * DIRNAME is directory component of pathname, - * or we are to open a file. - */ - if (pathlen == name_len) - { - if (dirname[pathlen] == '/') - { - if (file_type != ISO_DIRECTORY) - { - errnum = ERR_BAD_FILETYPE; - return 0; - } - goto next_dir_level; - } - if (file_type != ISO_REGULAR) - { - errnum = ERR_BAD_FILETYPE; - return 0; - } - INODE->file_start = idr->extent.l; - filepos = 0; - filemax = idr->size.l; - return 1; - } - } - else /* Completion */ - { -#ifndef STAGE1_5 - if (print_possibilities > 0) - print_possibilities = -print_possibilities; - memcpy(NAME_BUF, name, name_len); - NAME_BUF[name_len] = '\0'; - print_a_completion (NAME_BUF); -#endif - } - } - } /* for */ - - size -= ISO_SECTOR_SIZE; - } /* size>0 */ - - if (dirname[pathlen] == '/' || print_possibilities >= 0) - { - errnum = ERR_FILE_NOT_FOUND; - return 0; - } - - next_dir_level: - dirname += pathlen; - - } while (*dirname == '/'); - - return 1; -} - -int -iso9660_read (char *buf, int len) -{ - int sector, blkoffset, size, ret; - - if (INODE->file_start == 0) - return 0; - - ret = 0; - blkoffset = filepos & (ISO_SECTOR_SIZE - 1); - sector = filepos >> ISO_SECTOR_BITS; - while (len > 0) - { - size = ISO_SECTOR_SIZE - blkoffset; - if (size > len) - size = len; - - disk_read_func = disk_read_hook; - - if (!iso9660_devread(INODE->file_start + sector, blkoffset, size, buf)) - return 0; - - disk_read_func = NULL; - - len -= size; - buf += size; - ret += size; - filepos += size; - sector++; - blkoffset = 0; - } - - return ret; -} - -#endif /* FSYS_ISO9660 */ diff --git a/usr/src/grub/grub-0.95/stage2/fsys_jfs.c b/usr/src/grub/grub-0.95/stage2/fsys_jfs.c deleted file mode 100644 index 307f83633c..0000000000 --- a/usr/src/grub/grub-0.95/stage2/fsys_jfs.c +++ /dev/null @@ -1,403 +0,0 @@ -/* fsys_jfs.c - an implementation for the IBM JFS file system */ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 2001,2002 Free Software Foundation, 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 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. - */ - -#ifdef FSYS_JFS - -#include "shared.h" -#include "filesys.h" -#include "jfs.h" - -#define MAX_LINK_COUNT 8 - -#define DTTYPE_INLINE 0 -#define DTTYPE_PAGE 1 - -struct jfs_info -{ - int bsize; - int l2bsize; - int bdlog; - int xindex; - int xlastindex; - int sindex; - int slastindex; - int de_index; - int dttype; - xad_t *xad; - ldtentry_t *de; -}; - -static struct jfs_info jfs; - -#define xtpage ((xtpage_t *)FSYS_BUF) -#define dtpage ((dtpage_t *)((char *)FSYS_BUF + 4096)) -#define fileset ((dinode_t *)((char *)FSYS_BUF + 8192)) -#define inode ((dinode_t *)((char *)FSYS_BUF + 8192 + sizeof(dinode_t))) -#define dtroot ((dtroot_t *)(&inode->di_btroot)) - -static ldtentry_t de_always[2] = { - {1, -1, 2, {'.', '.'}}, - {1, -1, 1, {'.'}} -}; - -static int -isinxt (s64 key, s64 offset, s64 len) -{ - return (key >= offset) ? (key < offset + len ? 1 : 0) : 0; -} - -static xad_t * -first_extent (dinode_t *di) -{ - xtpage_t *xtp; - - jfs.xindex = 2; - xtp = (xtpage_t *)&di->di_btroot; - jfs.xad = &xtp->xad[2]; - if (xtp->header.flag & BT_LEAF) { - jfs.xlastindex = xtp->header.nextindex; - } else { - do { - devread (addressXAD (jfs.xad) << jfs.bdlog, 0, - sizeof(xtpage_t), (char *)xtpage); - jfs.xad = &xtpage->xad[2]; - } while (!(xtpage->header.flag & BT_LEAF)); - jfs.xlastindex = xtpage->header.nextindex; - } - - return jfs.xad; -} - -static xad_t * -next_extent (void) -{ - if (++jfs.xindex < jfs.xlastindex) { - } else if (xtpage->header.next) { - devread (xtpage->header.next << jfs.bdlog, 0, - sizeof(xtpage_t), (char *)xtpage); - jfs.xlastindex = xtpage->header.nextindex; - jfs.xindex = XTENTRYSTART; - jfs.xad = &xtpage->xad[XTENTRYSTART]; - } else { - return NULL; - } - return ++jfs.xad; -} - - -static void -di_read (u32 inum, dinode_t *di) -{ - s64 key; - u32 xd, ioffset; - s64 offset; - xad_t *xad; - pxd_t pxd; - - key = (((inum >> L2INOSPERIAG) << L2INOSPERIAG) + 4096) >> jfs.l2bsize; - xd = (inum & (INOSPERIAG - 1)) >> L2INOSPEREXT; - ioffset = ((inum & (INOSPERIAG - 1)) & (INOSPEREXT - 1)) << L2DISIZE; - xad = first_extent (fileset); - do { - offset = offsetXAD (xad); - if (isinxt (key, offset, lengthXAD (xad))) { - devread ((addressXAD (xad) + key - offset) << jfs.bdlog, - 3072 + xd*sizeof(pxd_t), sizeof(pxd_t), (char *)&pxd); - devread (addressPXD (&pxd) << jfs.bdlog, - ioffset, DISIZE, (char *)di); - break; - } - } while ((xad = next_extent ())); -} - -static ldtentry_t * -next_dentry (void) -{ - ldtentry_t *de; - s8 *stbl; - - if (jfs.dttype == DTTYPE_INLINE) { - if (jfs.sindex < jfs.slastindex) { - return (ldtentry_t *)&dtroot->slot[(int)dtroot->header.stbl[jfs.sindex++]]; - } - } else { - de = (ldtentry_t *)dtpage->slot; - stbl = (s8 *)&de[(int)dtpage->header.stblindex]; - if (jfs.sindex < jfs.slastindex) { - return &de[(int)stbl[jfs.sindex++]]; - } else if (dtpage->header.next) { - devread (dtpage->header.next << jfs.bdlog, 0, - sizeof(dtpage_t), (char *)dtpage); - jfs.slastindex = dtpage->header.nextindex; - jfs.sindex = 1; - return &de[(int)((s8 *)&de[(int)dtpage->header.stblindex])[0]]; - } - } - - return (jfs.de_index < 2) ? &de_always[jfs.de_index++] : NULL; -} - -static ldtentry_t * -first_dentry (void) -{ - dtroot_t *dtr; - pxd_t *xd; - idtentry_t *de; - - dtr = (dtroot_t *)&inode->di_btroot; - jfs.sindex = 0; - jfs.de_index = 0; - - de_always[0].inumber = inode->di_parent; - de_always[1].inumber = inode->di_number; - if (dtr->header.flag & BT_LEAF) { - jfs.dttype = DTTYPE_INLINE; - jfs.slastindex = dtr->header.nextindex; - } else { - de = (idtentry_t *)dtpage->slot; - jfs.dttype = DTTYPE_PAGE; - xd = &((idtentry_t *)dtr->slot)[(int)dtr->header.stbl[0]].xd; - for (;;) { - devread (addressPXD (xd) << jfs.bdlog, 0, - sizeof(dtpage_t), (char *)dtpage); - if (dtpage->header.flag & BT_LEAF) - break; - xd = &de[(int)((s8 *)&de[(int)dtpage->header.stblindex])[0]].xd; - } - jfs.slastindex = dtpage->header.nextindex; - } - - return next_dentry (); -} - - -static dtslot_t * -next_dslot (int next) -{ - return (jfs.dttype == DTTYPE_INLINE) - ? (dtslot_t *)&dtroot->slot[next] - : &((dtslot_t *)dtpage->slot)[next]; -} - -static void -uni2ansi (UniChar *uni, char *ansi, int len) -{ - for (; len; len--, uni++) - *ansi++ = (*uni & 0xff80) ? '?' : *(char *)uni; -} - -int -jfs_mount (void) -{ - struct jfs_superblock super; - - if (part_length < MINJFS >> SECTOR_BITS - || !devread (SUPER1_OFF >> SECTOR_BITS, 0, - sizeof(struct jfs_superblock), (char *)&super) - || (super.s_magic != JFS_MAGIC) - || !devread ((AITBL_OFF >> SECTOR_BITS) + FILESYSTEM_I, - 0, DISIZE, (char*)fileset)) { - return 0; - } - - jfs.bsize = super.s_bsize; - jfs.l2bsize = super.s_l2bsize; - jfs.bdlog = jfs.l2bsize - SECTOR_BITS; - - return 1; -} - -int -jfs_read (char *buf, int len) -{ - xad_t *xad; - s64 endofprev, endofcur; - s64 offset, xadlen; - int toread, startpos, endpos; - - startpos = filepos; - endpos = filepos + len; - endofprev = (1ULL << 62) - 1; - xad = first_extent (inode); - do { - offset = offsetXAD (xad); - xadlen = lengthXAD (xad); - if (isinxt (filepos >> jfs.l2bsize, offset, xadlen)) { - endofcur = (offset + xadlen) << jfs.l2bsize; - toread = (endofcur >= endpos) - ? len : (endofcur - filepos); - - disk_read_func = disk_read_hook; - devread (addressXAD (xad) << jfs.bdlog, - filepos - (offset << jfs.l2bsize), toread, buf); - disk_read_func = NULL; - - buf += toread; - len -= toread; - filepos += toread; - } else if (offset > endofprev) { - toread = ((offset << jfs.l2bsize) >= endpos) - ? len : ((offset - endofprev) << jfs.l2bsize); - len -= toread; - filepos += toread; - for (; toread; toread--) { - *buf++ = 0; - } - continue; - } - endofprev = offset + xadlen; - xad = next_extent (); - } while (len > 0 && xad); - - return filepos - startpos; -} - -int -jfs_dir (char *dirname) -{ - char *ptr, *rest, ch; - ldtentry_t *de; - dtslot_t *ds; - u32 inum, parent_inum; - s64 di_size; - u32 di_mode; - int namlen, cmp, n, link_count; - char namebuf[JFS_NAME_MAX + 1], linkbuf[JFS_PATH_MAX]; - - parent_inum = inum = ROOT_I; - link_count = 0; - for (;;) { - di_read (inum, inode); - di_size = inode->di_size; - di_mode = inode->di_mode; - - if ((di_mode & IFMT) == IFLNK) { - if (++link_count > MAX_LINK_COUNT) { - errnum = ERR_SYMLINK_LOOP; - return 0; - } - if (di_size < (di_mode & INLINEEA ? 256 : 128)) { - grub_memmove (linkbuf, inode->di_fastsymlink, di_size); - n = di_size; - } else if (di_size < JFS_PATH_MAX - 1) { - filepos = 0; - filemax = di_size; - n = jfs_read (linkbuf, filemax); - } else { - errnum = ERR_FILELENGTH; - return 0; - } - - inum = (linkbuf[0] == '/') ? ROOT_I : parent_inum; - while (n < (JFS_PATH_MAX - 1) && (linkbuf[n++] = *dirname++)); - linkbuf[n] = 0; - dirname = linkbuf; - continue; - } - - if (!*dirname || isspace (*dirname)) { - if ((di_mode & IFMT) != IFREG) { - errnum = ERR_BAD_FILETYPE; - return 0; - } - filepos = 0; - filemax = di_size; - return 1; - } - - if ((di_mode & IFMT) != IFDIR) { - errnum = ERR_BAD_FILETYPE; - return 0; - } - - for (; *dirname == '/'; dirname++); - - for (rest = dirname; (ch = *rest) && !isspace (ch) && ch != '/'; rest++); - *rest = 0; - - de = first_dentry (); - for (;;) { - namlen = de->namlen; - if (de->next == -1) { - uni2ansi (de->name, namebuf, namlen); - namebuf[namlen] = 0; - } else { - uni2ansi (de->name, namebuf, DTLHDRDATALEN); - ptr = namebuf; - ptr += DTLHDRDATALEN; - namlen -= DTLHDRDATALEN; - ds = next_dslot (de->next); - while (ds->next != -1) { - uni2ansi (ds->name, ptr, DTSLOTDATALEN); - ptr += DTSLOTDATALEN; - namlen -= DTSLOTDATALEN; - ds = next_dslot (ds->next); - } - uni2ansi (ds->name, ptr, namlen); - ptr += namlen; - *ptr = 0; - } - - cmp = (!*dirname) ? -1 : substring (dirname, namebuf); -#ifndef STAGE1_5 - if (print_possibilities && ch != '/' - && cmp <= 0) { - if (print_possibilities > 0) - print_possibilities = -print_possibilities; - print_a_completion (namebuf); - } else -#endif - if (cmp == 0) { - parent_inum = inum; - inum = de->inumber; - *(dirname = rest) = ch; - break; - } - de = next_dentry (); - if (de == NULL) { - if (print_possibilities < 0) - return 1; - - errnum = ERR_FILE_NOT_FOUND; - *rest = ch; - return 0; - } - } - } -} - -int -jfs_embed (int *start_sector, int needed_sectors) -{ - struct jfs_superblock super; - - if (needed_sectors > 63 - || !devread (SUPER1_OFF >> SECTOR_BITS, 0, - sizeof (struct jfs_superblock), - (char *)&super) - || (super.s_magic != JFS_MAGIC)) { - return 0; - } - - *start_sector = 1; - return 1; -} - -#endif /* FSYS_JFS */ diff --git a/usr/src/grub/grub-0.95/stage2/fsys_minix.c b/usr/src/grub/grub-0.95/stage2/fsys_minix.c deleted file mode 100644 index 5c76796a21..0000000000 --- a/usr/src/grub/grub-0.95/stage2/fsys_minix.c +++ /dev/null @@ -1,534 +0,0 @@ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 1999,2000,2001,2002 Free Software Foundation, 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 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. - */ - -/* Restrictions: - This is MINIX V1 only (yet) - Disk creation is like: - mkfs.minix -c DEVICE -*/ - -#ifdef FSYS_MINIX - -#include "shared.h" -#include "filesys.h" - -/* #define DEBUG_MINIX */ - -/* indirect blocks */ -static int mapblock1, mapblock2, namelen; - -/* sizes are always in bytes, BLOCK values are always in DEV_BSIZE (sectors) */ -#define DEV_BSIZE 512 - -/* include/linux/fs.h */ -#define BLOCK_SIZE_BITS 10 -#define BLOCK_SIZE (1<. 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_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 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))) -#define MINIX2_INODES_PER_BLOCK ((BLOCK_SIZE)/(sizeof (struct minix2_inode))) - -#define MINIX_V1 0x0001 /* original minix fs */ -#define MINIX_V2 0x0002 /* minix V2 fs */ - -/* originally this is : -#define INODE_VERSION(inode) inode->i_sb->u.minix_sb.s_version - here we have */ -#define INODE_VERSION(inode) (SUPERBLOCK->s_version) - -/* - * 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; -}; - -struct minix_dir_entry { - __u16 inode; - char name[0]; -}; - -/* made up, these are pointers into FSYS_BUF */ -/* read once, always stays there: */ -#define SUPERBLOCK \ - ((struct minix_super_block *)(FSYS_BUF)) -#define INODE \ - ((struct minix_inode *)((int) SUPERBLOCK + BLOCK_SIZE)) -#define DATABLOCK1 \ - ((int)((int)INODE + sizeof(struct minix_inode))) -#define DATABLOCK2 \ - ((int)((int)DATABLOCK1 + BLOCK_SIZE)) - -/* linux/stat.h */ -#define S_IFMT 00170000 -#define S_IFLNK 0120000 -#define S_IFREG 0100000 -#define S_IFDIR 0040000 -#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 PATH_MAX 1024 /* include/linux/limits.h */ -#define MAX_LINK_COUNT 5 /* number of symbolic links to follow */ - -/* check filesystem types and read superblock into memory buffer */ -int -minix_mount (void) -{ - if (((current_drive & 0x80) || current_slice != 0) - && ! IS_PC_SLICE_TYPE_MINIX (current_slice) - && ! IS_PC_SLICE_TYPE_BSD_WITH_FS (current_slice, FS_OTHER)) - return 0; /* The partition is not of MINIX type */ - - if (part_length < (SBLOCK + - (sizeof (struct minix_super_block) / DEV_BSIZE))) - return 0; /* The partition is too short */ - - if (!devread (SBLOCK, 0, sizeof (struct minix_super_block), - (char *) SUPERBLOCK)) - return 0; /* Cannot read superblock */ - - switch (SUPERBLOCK->s_magic) - { - case MINIX_SUPER_MAGIC: - namelen = 14; - break; - case MINIX_SUPER_MAGIC2: - namelen = 30; - break; - default: - return 0; /* Unsupported type */ - } - - return 1; -} - -/* Takes a file system block number and reads it into BUFFER. */ -static int -minix_rdfsb (int fsblock, int buffer) -{ - return devread (fsblock * (BLOCK_SIZE / DEV_BSIZE), 0, - BLOCK_SIZE, (char *) buffer); -} - -/* Maps LOGICAL_BLOCK (the file offset divided by the blocksize) into - a physical block (the location in the file system) via an inode. */ -static int -minix_block_map (int logical_block) -{ - int i; - - if (logical_block < 7) - return INODE->i_zone[logical_block]; - - logical_block -= 7; - if (logical_block < 512) - { - i = INODE->i_zone[7]; - - if (!i || ((mapblock1 != 1) - && !minix_rdfsb (i, DATABLOCK1))) - { - errnum = ERR_FSYS_CORRUPT; - return -1; - } - mapblock1 = 1; - return ((__u16 *) DATABLOCK1) [logical_block]; - } - - logical_block -= 512; - i = INODE->i_zone[8]; - if (!i || ((mapblock1 != 2) - && !minix_rdfsb (i, DATABLOCK1))) - { - errnum = ERR_FSYS_CORRUPT; - return -1; - } - mapblock1 = 2; - i = ((__u16 *) DATABLOCK1)[logical_block >> 9]; - if (!i || ((mapblock2 != i) - && !minix_rdfsb (i, DATABLOCK2))) - { - errnum = ERR_FSYS_CORRUPT; - return -1; - } - mapblock2 = i; - return ((__u16 *) DATABLOCK2)[logical_block & 511]; -} - -/* read from INODE into BUF */ -int -minix_read (char *buf, int len) -{ - int logical_block; - int offset; - int map; - int ret = 0; - int size = 0; - - while (len > 0) - { - /* find the (logical) block component of our location */ - logical_block = filepos >> BLOCK_SIZE_BITS; - offset = filepos & (BLOCK_SIZE - 1); - map = minix_block_map (logical_block); -#ifdef DEBUG_MINIX - printf ("map=%d\n", map); -#endif - if (map < 0) - break; - - size = BLOCK_SIZE; - size -= offset; - if (size > len) - size = len; - - disk_read_func = disk_read_hook; - - devread (map * (BLOCK_SIZE / DEV_BSIZE), - offset, size, buf); - - disk_read_func = NULL; - - buf += size; - len -= size; - filepos += size; - ret += size; - } - - if (errnum) - ret = 0; - - return ret; -} - -/* preconditions: minix_mount already executed, therefore supblk in buffer - known as SUPERBLOCK - returns: 0 if error, nonzero iff we were able to find the file successfully - postconditions: on a nonzero return, buffer known as INODE contains the - inode of the file we were trying to look up - side effects: none yet */ -int -minix_dir (char *dirname) -{ - int current_ino = MINIX_ROOT_INO; /* start at the root */ - int updir_ino = current_ino; /* the parent of the current directory */ - int ino_blk; /* fs pointer of the inode's info */ - - int str_chk = 0; /* used ot hold the results of a string - compare */ - - struct minix_inode * raw_inode; /* inode info for current_ino */ - - char linkbuf[PATH_MAX]; /* buffer for following sym-links */ - int link_count = 0; - - char * rest; - char ch; - - int off; /* offset within block of directory - entry */ - int loc; /* location within a directory */ - int blk; /* which data blk within dir entry */ - long map; /* fs pointer of a particular block from - dir entry */ - struct minix_dir_entry * dp; /* pointer to directory entry */ - - /* loop invariants: - current_ino = inode to lookup - dirname = pointer to filename component we are cur looking up within - the directory known pointed to by current_ino (if any) */ - -#ifdef DEBUG_MINIX - printf ("\n"); -#endif - - while (1) - { -#ifdef DEBUG_MINIX - printf ("inode %d, dirname %s\n", current_ino, dirname); -#endif - - ino_blk = (2 + SUPERBLOCK->s_imap_blocks + SUPERBLOCK->s_zmap_blocks - + (current_ino - 1) / MINIX_INODES_PER_BLOCK); - if (! minix_rdfsb (ino_blk, (int) INODE)) - return 0; - - /* reset indirect blocks! */ - mapblock2 = mapblock1 = -1; - - raw_inode = INODE + ((current_ino - 1) % MINIX_INODES_PER_BLOCK); - - /* copy inode to fixed location */ - memmove ((void *) INODE, (void *) raw_inode, - sizeof (struct minix_inode)); - - /* If we've got a symbolic link, then chase it. */ - if (S_ISLNK (INODE->i_mode)) - { - int len; - - if (++link_count > MAX_LINK_COUNT) - { - errnum = ERR_SYMLINK_LOOP; - return 0; - } -#ifdef DEBUG_MINIX - printf ("S_ISLNK (%s)\n", dirname); -#endif - - /* Find out how long our remaining name is. */ - len = 0; - while (dirname[len] && !isspace (dirname[len])) - len++; - - /* Get the symlink size. */ - filemax = (INODE->i_size); - if (filemax + len > sizeof (linkbuf) - 2) - { - errnum = ERR_FILELENGTH; - return 0; - } - - if (len) - { - /* Copy the remaining name to the end of the symlink data. - Note that DIRNAME and LINKBUF may overlap! */ - memmove (linkbuf + filemax, dirname, len); - } - linkbuf[filemax + len] = '\0'; - - /* Read the necessary blocks, and reset the file pointer. */ - len = grub_read (linkbuf, filemax); - filepos = 0; - if (!len) - return 0; - -#ifdef DEBUG_MINIX - printf ("symlink=%s\n", linkbuf); -#endif - - dirname = linkbuf; - if (*dirname == '/') - { - /* It's an absolute link, so look it up in root. */ - current_ino = MINIX_ROOT_INO; - updir_ino = current_ino; - } - else - { - /* Relative, so look it up in our parent directory. */ - current_ino = updir_ino; - } - - /* Try again using the new name. */ - continue; - } - - /* If end of filename, INODE points to the file's inode */ - if (!*dirname || isspace (*dirname)) - { - if (!S_ISREG (INODE->i_mode)) - { - errnum = ERR_BAD_FILETYPE; - return 0; - } - - filemax = (INODE->i_size); - return 1; - } - - /* else we have to traverse a directory */ - updir_ino = current_ino; - - /* skip over slashes */ - while (*dirname == '/') - dirname++; - - /* if this isn't a directory of sufficient size to hold our file, - abort */ - if (!(INODE->i_size) || !S_ISDIR (INODE->i_mode)) - { - errnum = ERR_BAD_FILETYPE; - return 0; - } - - /* skip to next slash or end of filename (space) */ - for (rest = dirname; (ch = *rest) && !isspace (ch) && ch != '/'; - rest++); - - /* look through this directory and find the next filename component */ - /* invariant: rest points to slash after the next filename component */ - *rest = 0; - loc = 0; - - do - { -#ifdef DEBUG_MINIX - printf ("dirname=`%s', rest=`%s', loc=%d\n", dirname, rest, loc); -#endif - - /* if our location/byte offset into the directory exceeds the size, - give up */ - if (loc >= INODE->i_size) - { - if (print_possibilities < 0) - { -#if 0 - putchar ('\n'); -#endif - } - else - { - errnum = ERR_FILE_NOT_FOUND; - *rest = ch; - } - return (print_possibilities < 0); - } - - /* else, find the (logical) block component of our location */ - blk = loc >> BLOCK_SIZE_BITS; - - /* we know which logical block of the directory entry we are looking - for, now we have to translate that to the physical (fs) block on - the disk */ - map = minix_block_map (blk); -#ifdef DEBUG_MINIX - printf ("fs block=%d\n", map); -#endif - mapblock2 = -1; - if ((map < 0) || !minix_rdfsb (map, DATABLOCK2)) - { - errnum = ERR_FSYS_CORRUPT; - *rest = ch; - return 0; - } - off = loc & (BLOCK_SIZE - 1); - dp = (struct minix_dir_entry *) (DATABLOCK2 + off); - /* advance loc prematurely to next on-disk directory entry */ - loc += sizeof (dp->inode) + namelen; - - /* NOTE: minix filenames are NULL terminated if < NAMELEN - else exact */ - -#ifdef DEBUG_MINIX - printf ("directory entry ino=%d\n", dp->inode); - if (dp->inode) - printf ("entry=%s\n", dp->name); -#endif - - if (dp->inode) - { - int saved_c = dp->name[namelen]; - - dp->name[namelen] = 0; - str_chk = substring (dirname, dp->name); - -# ifndef STAGE1_5 - if (print_possibilities && ch != '/' - && (!*dirname || str_chk <= 0)) - { - if (print_possibilities > 0) - print_possibilities = -print_possibilities; - print_a_completion (dp->name); - } -# endif - - dp->name[namelen] = saved_c; - } - - } - while (!dp->inode || (str_chk || (print_possibilities && ch != '/'))); - - current_ino = dp->inode; - *(dirname = rest) = ch; - } - /* never get here */ -} - -#endif /* FSYS_MINIX */ diff --git a/usr/src/grub/grub-0.95/stage2/fsys_reiserfs.c b/usr/src/grub/grub-0.95/stage2/fsys_reiserfs.c deleted file mode 100644 index d07ab2f675..0000000000 --- a/usr/src/grub/grub-0.95/stage2/fsys_reiserfs.c +++ /dev/null @@ -1,1239 +0,0 @@ -/* fsys_reiserfs.c - an implementation for the ReiserFS filesystem */ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 2000, 2001 Free Software Foundation, 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 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. - */ - -#ifdef FSYS_REISERFS -#include "shared.h" -#include "filesys.h" - -#undef REISERDEBUG - -/* Some parts of this code (mainly the structures and defines) are - * from the original reiser fs code, as found in the linux kernel. - */ - -/* include/asm-i386/types.h */ -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 unsigned long long __u64; - -/* linux/posix_type.h */ -typedef long linux_off_t; - -/* linux/little_endian.h */ -#define __cpu_to_le64(x) ((__u64) (x)) -#define __le64_to_cpu(x) ((__u64) (x)) -#define __cpu_to_le32(x) ((__u32) (x)) -#define __le32_to_cpu(x) ((__u32) (x)) -#define __cpu_to_le16(x) ((__u16) (x)) -#define __le16_to_cpu(x) ((__u16) (x)) - -/* include/linux/reiser_fs.h */ -/* This is the new super block of a journaling reiserfs system */ -struct reiserfs_super_block -{ - __u32 s_block_count; /* blocks count */ - __u32 s_free_blocks; /* free blocks count */ - __u32 s_root_block; /* root block number */ - __u32 s_journal_block; /* journal block number */ - __u32 s_journal_dev; /* journal device number */ - __u32 s_journal_size; /* size of the journal on FS creation. used to make sure they don't overflow it */ - __u32 s_journal_trans_max; /* max number of blocks in a transaction. */ - __u32 s_journal_magic; /* random value made on fs creation */ - __u32 s_journal_max_batch; /* max number of blocks to batch into a trans */ - __u32 s_journal_max_commit_age; /* in seconds, how old can an async commit be */ - __u32 s_journal_max_trans_age; /* in seconds, how old can a transaction be */ - __u16 s_blocksize; /* block size */ - __u16 s_oid_maxsize; /* max size of object id array */ - __u16 s_oid_cursize; /* current size of object id array */ - __u16 s_state; /* valid or error */ - char s_magic[16]; /* reiserfs magic string indicates that file system is reiserfs */ - __u16 s_tree_height; /* height of disk tree */ - __u16 s_bmap_nr; /* amount of bitmap blocks needed to address each block of file system */ - __u16 s_version; - char s_unused[128]; /* zero filled by mkreiserfs */ -}; - -#define REISERFS_MAX_SUPPORTED_VERSION 2 -#define REISERFS_SUPER_MAGIC_STRING "ReIsErFs" -#define REISER2FS_SUPER_MAGIC_STRING "ReIsEr2Fs" -#define REISER3FS_SUPER_MAGIC_STRING "ReIsEr3Fs" - -#define MAX_HEIGHT 7 - -/* must be correct to keep the desc and commit structs at 4k */ -#define JOURNAL_TRANS_HALF 1018 - -/* first block written in a commit. */ -struct reiserfs_journal_desc { - __u32 j_trans_id; /* id of commit */ - __u32 j_len; /* length of commit. len +1 is the commit block */ - __u32 j_mount_id; /* mount id of this trans*/ - __u32 j_realblock[JOURNAL_TRANS_HALF]; /* real locations for the first blocks */ - char j_magic[12]; -}; - -/* last block written in a commit */ -struct reiserfs_journal_commit { - __u32 j_trans_id; /* must match j_trans_id from the desc block */ - __u32 j_len; /* ditto */ - __u32 j_realblock[JOURNAL_TRANS_HALF]; /* real locations for the last blocks */ - char j_digest[16]; /* md5 sum of all the blocks involved, including desc and commit. not used, kill it */ -}; - -/* this header block gets written whenever a transaction is considered - fully flushed, and is more recent than the last fully flushed - transaction. - fully flushed means all the log blocks and all the real blocks are - on disk, and this transaction does not need to be replayed. -*/ -struct reiserfs_journal_header { - /* id of last fully flushed transaction */ - __u32 j_last_flush_trans_id; - /* offset in the log of where to start replay after a crash */ - __u32 j_first_unflushed_offset; - /* mount id to detect very old transactions */ - __u32 j_mount_id; -}; - -/* magic string to find desc blocks in the journal */ -#define JOURNAL_DESC_MAGIC "ReIsErLB" - - -/* - * directories use this key as well as old files - */ -struct offset_v1 -{ - /* - * for regular files this is the offset to the first byte of the - * body, contained in the object-item, as measured from the start of - * the entire body of the object. - * - * for directory entries, k_offset consists of hash derived from - * hashing the name and using few bits (23 or more) of the resulting - * hash, and generation number that allows distinguishing names with - * hash collisions. If number of collisions overflows generation - * number, we return EEXIST. High order bit is 0 always - */ - __u32 k_offset; - __u32 k_uniqueness; -}; - -struct offset_v2 -{ - /* - * for regular files this is the offset to the first byte of the - * body, contained in the object-item, as measured from the start of - * the entire body of the object. - * - * for directory entries, k_offset consists of hash derived from - * hashing the name and using few bits (23 or more) of the resulting - * hash, and generation number that allows distinguishing names with - * hash collisions. If number of collisions overflows generation - * number, we return EEXIST. High order bit is 0 always - */ - __u64 k_offset:60; - __u64 k_type: 4; -}; - - -struct key -{ - /* packing locality: by default parent directory object id */ - __u32 k_dir_id; - /* object identifier */ - __u32 k_objectid; - /* the offset and node type (old and new form) */ - union - { - struct offset_v1 v1; - struct offset_v2 v2; - } - u; -}; - -#define KEY_SIZE (sizeof (struct key)) - -/* Header of a disk block. More precisely, header of a formatted leaf - or internal node, and not the header of an unformatted node. */ -struct block_head -{ - __u16 blk_level; /* Level of a block in the tree. */ - __u16 blk_nr_item; /* Number of keys/items in a block. */ - __u16 blk_free_space; /* Block free space in bytes. */ - struct key blk_right_delim_key; /* Right delimiting key for this block (supported for leaf level nodes - only) */ -}; -#define BLKH_SIZE (sizeof (struct block_head)) -#define DISK_LEAF_NODE_LEVEL 1 /* Leaf node level. */ - -struct item_head -{ - struct key ih_key; /* Everything in the tree is found by searching for it based on its key.*/ - - union - { - __u16 ih_free_space; /* The free space in the last unformatted node of an indirect item if this - is an indirect item. This equals 0xFFFF iff this is a direct item or - stat data item. Note that the key, not this field, is used to determine - the item type, and thus which field this union contains. */ - __u16 ih_entry_count; /* Iff this is a directory item, this field equals the number of directory - entries in the directory item. */ - } - u; - __u16 ih_item_len; /* total size of the item body */ - __u16 ih_item_location; /* an offset to the item body within the block */ - __u16 ih_version; /* ITEM_VERSION_1 for all old items, - ITEM_VERSION_2 for new ones. - Highest bit is set by fsck - temporary, cleaned after all done */ -}; -/* size of item header */ -#define IH_SIZE (sizeof (struct item_head)) - -#define ITEM_VERSION_1 0 -#define ITEM_VERSION_2 1 -#define IH_KEY_OFFSET(ih) ((ih)->ih_version == ITEM_VERSION_1 \ - ? (ih)->ih_key.u.v1.k_offset \ - : (ih)->ih_key.u.v2.k_offset) - -#define IH_KEY_ISTYPE(ih, type) ((ih)->ih_version == ITEM_VERSION_1 \ - ? (ih)->ih_key.u.v1.k_uniqueness == V1_##type \ - : (ih)->ih_key.u.v2.k_type == V2_##type) - -struct disk_child -{ - unsigned long dc_block_number; /* Disk child's block number. */ - unsigned short dc_size; /* Disk child's used space. */ -}; - -#define DC_SIZE (sizeof (struct disk_child)) - -/* Stat Data on disk. - * - * Note that reiserfs has two different forms of stat data. Luckily - * the fields needed by grub are at the same position. - */ -struct stat_data -{ - __u16 sd_mode; /* file type, permissions */ - __u16 sd_notused1[3]; /* fields not needed by reiserfs */ - __u32 sd_size; /* file size */ - __u32 sd_size_hi; /* file size high 32 bits (since version 2) */ -}; - -struct reiserfs_de_head -{ - __u32 deh_offset; /* third component of the directory entry key */ - __u32 deh_dir_id; /* objectid of the parent directory of the - object, that is referenced by directory entry */ - __u32 deh_objectid;/* objectid of the object, that is referenced by - directory entry */ - __u16 deh_location;/* offset of name in the whole item */ - __u16 deh_state; /* whether 1) entry contains stat data (for - future), and 2) whether entry is hidden - (unlinked) */ -}; - -#define DEH_SIZE (sizeof (struct reiserfs_de_head)) - -#define DEH_Statdata (1 << 0) /* not used now */ -#define DEH_Visible (1 << 2) - -#define SD_OFFSET 0 -#define SD_UNIQUENESS 0 -#define DOT_OFFSET 1 -#define DOT_DOT_OFFSET 2 -#define DIRENTRY_UNIQUENESS 500 - -#define V1_TYPE_STAT_DATA 0x0 -#define V1_TYPE_DIRECT 0xffffffff -#define V1_TYPE_INDIRECT 0xfffffffe -#define V1_TYPE_DIRECTORY_MAX 0xfffffffd -#define V2_TYPE_STAT_DATA 0 -#define V2_TYPE_INDIRECT 1 -#define V2_TYPE_DIRECT 2 -#define V2_TYPE_DIRENTRY 3 - -#define REISERFS_ROOT_OBJECTID 2 -#define REISERFS_ROOT_PARENT_OBJECTID 1 -#define REISERFS_DISK_OFFSET_IN_BYTES (64 * 1024) -/* the spot for the super in versions 3.5 - 3.5.11 (inclusive) */ -#define REISERFS_OLD_DISK_OFFSET_IN_BYTES (8 * 1024) -#define REISERFS_OLD_BLOCKSIZE 4096 - -#define S_ISREG(mode) (((mode) & 0170000) == 0100000) -#define S_ISDIR(mode) (((mode) & 0170000) == 0040000) -#define S_ISLNK(mode) (((mode) & 0170000) == 0120000) - -#define PATH_MAX 1024 /* include/linux/limits.h */ -#define MAX_LINK_COUNT 5 /* number of symbolic links to follow */ - -/* The size of the node cache */ -#define FSYSREISER_CACHE_SIZE 24*1024 -#define FSYSREISER_MIN_BLOCKSIZE SECTOR_SIZE -#define FSYSREISER_MAX_BLOCKSIZE FSYSREISER_CACHE_SIZE / 3 - -/* Info about currently opened file */ -struct fsys_reiser_fileinfo -{ - __u32 k_dir_id; - __u32 k_objectid; -}; - -/* In memory info about the currently mounted filesystem */ -struct fsys_reiser_info -{ - /* The last read item head */ - struct item_head *current_ih; - /* The last read item */ - char *current_item; - /* The information for the currently opened file */ - struct fsys_reiser_fileinfo fileinfo; - /* The start of the journal */ - __u32 journal_block; - /* The size of the journal */ - __u32 journal_block_count; - /* The first valid descriptor block in journal - (relative to journal_block) */ - __u32 journal_first_desc; - - /* The ReiserFS version. */ - __u16 version; - /* The current depth of the reiser tree. */ - __u16 tree_depth; - /* SECTOR_SIZE << blocksize_shift == blocksize. */ - __u8 blocksize_shift; - /* 1 << full_blocksize_shift == blocksize. */ - __u8 fullblocksize_shift; - /* The reiserfs block size (must be a power of 2) */ - __u16 blocksize; - /* The number of cached tree nodes */ - __u16 cached_slots; - /* The number of valid transactions in journal */ - __u16 journal_transactions; - - unsigned int blocks[MAX_HEIGHT]; - unsigned int next_key_nr[MAX_HEIGHT]; -}; - -/* The cached s+tree blocks in FSYS_BUF, see below - * for a more detailed description. - */ -#define ROOT ((char *) ((int) FSYS_BUF)) -#define CACHE(i) (ROOT + ((i) << INFO->fullblocksize_shift)) -#define LEAF CACHE (DISK_LEAF_NODE_LEVEL) - -#define BLOCKHEAD(cache) ((struct block_head *) cache) -#define ITEMHEAD ((struct item_head *) ((int) LEAF + BLKH_SIZE)) -#define KEY(cache) ((struct key *) ((int) cache + BLKH_SIZE)) -#define DC(cache) ((struct disk_child *) \ - ((int) cache + BLKH_SIZE + KEY_SIZE * nr_item)) -/* The fsys_reiser_info block. - */ -#define INFO \ - ((struct fsys_reiser_info *) ((int) FSYS_BUF + FSYSREISER_CACHE_SIZE)) -/* - * The journal cache. For each transaction it contains the number of - * blocks followed by the real block numbers of this transaction. - * - * If the block numbers of some transaction won't fit in this space, - * this list is stopped with a 0xffffffff marker and the remaining - * uncommitted transactions aren't cached. - */ -#define JOURNAL_START ((__u32 *) (INFO + 1)) -#define JOURNAL_END ((__u32 *) (FSYS_BUF + FSYS_BUFLEN)) - - -static __inline__ unsigned long -grub_log2 (unsigned long word) -{ - __asm__ ("bsfl %1,%0" - : "=r" (word) - : "r" (word)); - return word; -} -#define log2 grub_log2 - -static __inline__ int -is_power_of_two (unsigned long word) -{ - return (word & -word) == word; -} - -static int -journal_read (int block, int len, char *buffer) -{ - return devread ((INFO->journal_block + block) << INFO->blocksize_shift, - 0, len, buffer); -} - -/* Read a block from ReiserFS file system, taking the journal into - * account. If the block nr is in the journal, the block from the - * journal taken. - */ -static int -block_read (int blockNr, int start, int len, char *buffer) -{ - int transactions = INFO->journal_transactions; - int desc_block = INFO->journal_first_desc; - int journal_mask = INFO->journal_block_count - 1; - int translatedNr = blockNr; - __u32 *journal_table = JOURNAL_START; - while (transactions-- > 0) - { - int i = 0; - int j_len; - if (*journal_table != 0xffffffff) - { - /* Search for the blockNr in cached journal */ - j_len = *journal_table++; - while (i++ < j_len) - { - if (*journal_table++ == blockNr) - { - journal_table += j_len - i; - goto found; - } - } - } - else - { - /* This is the end of cached journal marker. The remaining - * transactions are still on disk. - */ - struct reiserfs_journal_desc desc; - struct reiserfs_journal_commit commit; - - if (! journal_read (desc_block, sizeof (desc), (char *) &desc)) - return 0; - - j_len = desc.j_len; - while (i < j_len && i < JOURNAL_TRANS_HALF) - if (desc.j_realblock[i++] == blockNr) - goto found; - - if (j_len >= JOURNAL_TRANS_HALF) - { - int commit_block = (desc_block + 1 + j_len) & journal_mask; - if (! journal_read (commit_block, - sizeof (commit), (char *) &commit)) - return 0; - while (i < j_len) - if (commit.j_realblock[i++ - JOURNAL_TRANS_HALF] == blockNr) - goto found; - } - } - goto not_found; - - found: - translatedNr = INFO->journal_block + ((desc_block + i) & journal_mask); -#ifdef REISERDEBUG - printf ("block_read: block %d is mapped to journal block %d.\n", - blockNr, translatedNr - INFO->journal_block); -#endif - /* We must continue the search, as this block may be overwritten - * in later transactions. - */ - not_found: - desc_block = (desc_block + 2 + j_len) & journal_mask; - } - return devread (translatedNr << INFO->blocksize_shift, start, len, buffer); -} - -/* Init the journal data structure. We try to cache as much as - * possible in the JOURNAL_START-JOURNAL_END space, but if it is full - * we can still read the rest from the disk on demand. - * - * The first number of valid transactions and the descriptor block of the - * first valid transaction are held in INFO. The transactions are all - * adjacent, but we must take care of the journal wrap around. - */ -static int -journal_init (void) -{ - unsigned int block_count = INFO->journal_block_count; - unsigned int desc_block; - unsigned int commit_block; - unsigned int next_trans_id; - struct reiserfs_journal_header header; - struct reiserfs_journal_desc desc; - struct reiserfs_journal_commit commit; - __u32 *journal_table = JOURNAL_START; - - journal_read (block_count, sizeof (header), (char *) &header); - desc_block = header.j_first_unflushed_offset; - if (desc_block >= block_count) - return 0; - - INFO->journal_first_desc = desc_block; - next_trans_id = header.j_last_flush_trans_id + 1; - -#ifdef REISERDEBUG - printf ("journal_init: last flushed %d\n", - header.j_last_flush_trans_id); -#endif - - while (1) - { - journal_read (desc_block, sizeof (desc), (char *) &desc); - if (substring (JOURNAL_DESC_MAGIC, desc.j_magic) > 0 - || desc.j_trans_id != next_trans_id - || desc.j_mount_id != header.j_mount_id) - /* no more valid transactions */ - break; - - commit_block = (desc_block + desc.j_len + 1) & (block_count - 1); - journal_read (commit_block, sizeof (commit), (char *) &commit); - if (desc.j_trans_id != commit.j_trans_id - || desc.j_len != commit.j_len) - /* no more valid transactions */ - break; - -#ifdef REISERDEBUG - printf ("Found valid transaction %d/%d at %d.\n", - desc.j_trans_id, desc.j_mount_id, desc_block); -#endif - - next_trans_id++; - if (journal_table < JOURNAL_END) - { - if ((journal_table + 1 + desc.j_len) >= JOURNAL_END) - { - /* The table is almost full; mark the end of the cached - * journal.*/ - *journal_table = 0xffffffff; - journal_table = JOURNAL_END; - } - else - { - int i; - /* Cache the length and the realblock numbers in the table. - * The block number of descriptor can easily be computed. - * and need not to be stored here. - */ - *journal_table++ = desc.j_len; - for (i = 0; i < desc.j_len && i < JOURNAL_TRANS_HALF; i++) - { - *journal_table++ = desc.j_realblock[i]; -#ifdef REISERDEBUG - printf ("block %d is in journal %d.\n", - desc.j_realblock[i], desc_block); -#endif - } - for ( ; i < desc.j_len; i++) - { - *journal_table++ = commit.j_realblock[i-JOURNAL_TRANS_HALF]; -#ifdef REISERDEBUG - printf ("block %d is in journal %d.\n", - commit.j_realblock[i-JOURNAL_TRANS_HALF], - desc_block); -#endif - } - } - } - desc_block = (commit_block + 1) & (block_count - 1); - } -#ifdef REISERDEBUG - printf ("Transaction %d/%d at %d isn't valid.\n", - desc.j_trans_id, desc.j_mount_id, desc_block); -#endif - - INFO->journal_transactions - = next_trans_id - header.j_last_flush_trans_id - 1; - return errnum == 0; -} - -/* check filesystem types and read superblock into memory buffer */ -int -reiserfs_mount (void) -{ - struct reiserfs_super_block super; - int superblock = REISERFS_DISK_OFFSET_IN_BYTES >> SECTOR_BITS; - - if (part_length < superblock + (sizeof (super) >> SECTOR_BITS) - || ! devread (superblock, 0, sizeof (struct reiserfs_super_block), - (char *) &super) - || (substring (REISER3FS_SUPER_MAGIC_STRING, super.s_magic) > 0 - && substring (REISER2FS_SUPER_MAGIC_STRING, super.s_magic) > 0 - && substring (REISERFS_SUPER_MAGIC_STRING, super.s_magic) > 0) - || (/* check that this is not a copy inside the journal log */ - super.s_journal_block * super.s_blocksize - <= REISERFS_DISK_OFFSET_IN_BYTES)) - { - /* Try old super block position */ - superblock = REISERFS_OLD_DISK_OFFSET_IN_BYTES >> SECTOR_BITS; - if (part_length < superblock + (sizeof (super) >> SECTOR_BITS) - || ! devread (superblock, 0, sizeof (struct reiserfs_super_block), - (char *) &super)) - return 0; - - if (substring (REISER3FS_SUPER_MAGIC_STRING, super.s_magic) > 0 - && substring (REISER2FS_SUPER_MAGIC_STRING, super.s_magic) > 0 - && substring (REISERFS_SUPER_MAGIC_STRING, super.s_magic) > 0) - { - /* pre journaling super block ? */ - if (substring (REISERFS_SUPER_MAGIC_STRING, - (char*) ((int) &super + 20)) > 0) - return 0; - - super.s_blocksize = REISERFS_OLD_BLOCKSIZE; - super.s_journal_block = 0; - super.s_version = 0; - } - } - - /* check the version number. */ - if (super.s_version > REISERFS_MAX_SUPPORTED_VERSION) - return 0; - - INFO->version = super.s_version; - INFO->blocksize = super.s_blocksize; - INFO->fullblocksize_shift = log2 (super.s_blocksize); - INFO->blocksize_shift = INFO->fullblocksize_shift - SECTOR_BITS; - INFO->cached_slots = - (FSYSREISER_CACHE_SIZE >> INFO->fullblocksize_shift) - 1; - -#ifdef REISERDEBUG - printf ("reiserfs_mount: version=%d, blocksize=%d\n", - INFO->version, INFO->blocksize); -#endif /* REISERDEBUG */ - - /* Clear node cache. */ - memset (INFO->blocks, 0, sizeof (INFO->blocks)); - - if (super.s_blocksize < FSYSREISER_MIN_BLOCKSIZE - || super.s_blocksize > FSYSREISER_MAX_BLOCKSIZE - || (SECTOR_SIZE << INFO->blocksize_shift) != super.s_blocksize) - return 0; - - /* Initialize journal code. If something fails we end with zero - * journal_transactions, so we don't access the journal at all. - */ - INFO->journal_transactions = 0; - if (super.s_journal_block != 0 && super.s_journal_dev == 0) - { - INFO->journal_block = super.s_journal_block; - INFO->journal_block_count = super.s_journal_size; - if (is_power_of_two (INFO->journal_block_count)) - journal_init (); - - /* Read in super block again, maybe it is in the journal */ - block_read (superblock >> INFO->blocksize_shift, - 0, sizeof (struct reiserfs_super_block), (char *) &super); - } - - if (! block_read (super.s_root_block, 0, INFO->blocksize, (char*) ROOT)) - return 0; - - INFO->tree_depth = BLOCKHEAD (ROOT)->blk_level; - -#ifdef REISERDEBUG - printf ("root read_in: block=%d, depth=%d\n", - super.s_root_block, INFO->tree_depth); -#endif /* REISERDEBUG */ - - if (INFO->tree_depth >= MAX_HEIGHT) - return 0; - if (INFO->tree_depth == DISK_LEAF_NODE_LEVEL) - { - /* There is only one node in the whole filesystem, - * which is simultanously leaf and root */ - memcpy (LEAF, ROOT, INFO->blocksize); - } - return 1; -} - -/***************** TREE ACCESSING METHODS *****************************/ - -/* I assume you are familiar with the ReiserFS tree, if not go to - * http://www.namesys.com/content_table.html - * - * My tree node cache is organized as following - * 0 ROOT node - * 1 LEAF node (if the ROOT is also a LEAF it is copied here - * 2-n other nodes on current path from bottom to top. - * if there is not enough space in the cache, the top most are - * omitted. - * - * I have only two methods to find a key in the tree: - * search_stat(dir_id, objectid) searches for the stat entry (always - * the first entry) of an object. - * next_key() gets the next key in tree order. - * - * This means, that I can only sequential reads of files are - * efficient, but this really doesn't hurt for grub. - */ - -/* Read in the node at the current path and depth into the node cache. - * You must set INFO->blocks[depth] before. - */ -static char * -read_tree_node (unsigned int blockNr, int depth) -{ - char* cache = CACHE(depth); - int num_cached = INFO->cached_slots; - if (depth < num_cached) - { - /* This is the cached part of the path. Check if same block is - * needed. - */ - if (blockNr == INFO->blocks[depth]) - return cache; - } - else - cache = CACHE(num_cached); - -#ifdef REISERDEBUG - printf (" next read_in: block=%d (depth=%d)\n", - blockNr, depth); -#endif /* REISERDEBUG */ - if (! block_read (blockNr, 0, INFO->blocksize, cache)) - return 0; - /* Make sure it has the right node level */ - if (BLOCKHEAD (cache)->blk_level != depth) - { - errnum = ERR_FSYS_CORRUPT; - return 0; - } - - INFO->blocks[depth] = blockNr; - return cache; -} - -/* Get the next key, i.e. the key following the last retrieved key in - * tree order. INFO->current_ih and - * INFO->current_info are adapted accordingly. */ -static int -next_key (void) -{ - int depth; - struct item_head *ih = INFO->current_ih + 1; - char *cache; - -#ifdef REISERDEBUG - printf ("next_key:\n old ih: key %d:%d:%d:%d version:%d\n", - INFO->current_ih->ih_key.k_dir_id, - INFO->current_ih->ih_key.k_objectid, - INFO->current_ih->ih_key.u.v1.k_offset, - INFO->current_ih->ih_key.u.v1.k_uniqueness, - INFO->current_ih->ih_version); -#endif /* REISERDEBUG */ - - if (ih == &ITEMHEAD[BLOCKHEAD (LEAF)->blk_nr_item]) - { - depth = DISK_LEAF_NODE_LEVEL; - /* The last item, was the last in the leaf node. - * Read in the next block - */ - do - { - if (depth == INFO->tree_depth) - { - /* There are no more keys at all. - * Return a dummy item with MAX_KEY */ - ih = (struct item_head *) &BLOCKHEAD (LEAF)->blk_right_delim_key; - goto found; - } - depth++; -#ifdef REISERDEBUG - printf (" depth=%d, i=%d\n", depth, INFO->next_key_nr[depth]); -#endif /* REISERDEBUG */ - } - while (INFO->next_key_nr[depth] == 0); - - if (depth == INFO->tree_depth) - cache = ROOT; - else if (depth <= INFO->cached_slots) - cache = CACHE (depth); - else - { - cache = read_tree_node (INFO->blocks[depth], depth); - if (! cache) - return 0; - } - - do - { - int nr_item = BLOCKHEAD (cache)->blk_nr_item; - int key_nr = INFO->next_key_nr[depth]++; -#ifdef REISERDEBUG - printf (" depth=%d, i=%d/%d\n", depth, key_nr, nr_item); -#endif /* REISERDEBUG */ - if (key_nr == nr_item) - /* This is the last item in this block, set the next_key_nr to 0 */ - INFO->next_key_nr[depth] = 0; - - cache = read_tree_node (DC (cache)[key_nr].dc_block_number, --depth); - if (! cache) - return 0; - } - while (depth > DISK_LEAF_NODE_LEVEL); - - ih = ITEMHEAD; - } - found: - INFO->current_ih = ih; - INFO->current_item = &LEAF[ih->ih_item_location]; -#ifdef REISERDEBUG - printf (" new ih: key %d:%d:%d:%d version:%d\n", - INFO->current_ih->ih_key.k_dir_id, - INFO->current_ih->ih_key.k_objectid, - INFO->current_ih->ih_key.u.v1.k_offset, - INFO->current_ih->ih_key.u.v1.k_uniqueness, - INFO->current_ih->ih_version); -#endif /* REISERDEBUG */ - return 1; -} - -/* preconditions: reiserfs_mount already executed, therefore - * INFO block is valid - * returns: 0 if error (errnum is set), - * nonzero iff we were able to find the key successfully. - * postconditions: on a nonzero return, the current_ih and - * current_item fields describe the key that equals the - * searched key. INFO->next_key contains the next key after - * the searched key. - * side effects: messes around with the cache. - */ -static int -search_stat (__u32 dir_id, __u32 objectid) -{ - char *cache; - int depth; - int nr_item; - int i; - struct item_head *ih; -#ifdef REISERDEBUG - printf ("search_stat:\n key %d:%d:0:0\n", dir_id, objectid); -#endif /* REISERDEBUG */ - - depth = INFO->tree_depth; - cache = ROOT; - - while (depth > DISK_LEAF_NODE_LEVEL) - { - struct key *key; - nr_item = BLOCKHEAD (cache)->blk_nr_item; - - key = KEY (cache); - - for (i = 0; i < nr_item; i++) - { - if (key->k_dir_id > dir_id - || (key->k_dir_id == dir_id - && (key->k_objectid > objectid - || (key->k_objectid == objectid - && (key->u.v1.k_offset - | key->u.v1.k_uniqueness) > 0)))) - break; - key++; - } - -#ifdef REISERDEBUG - printf (" depth=%d, i=%d/%d\n", depth, i, nr_item); -#endif /* REISERDEBUG */ - INFO->next_key_nr[depth] = (i == nr_item) ? 0 : i+1; - cache = read_tree_node (DC (cache)[i].dc_block_number, --depth); - if (! cache) - return 0; - } - - /* cache == LEAF */ - nr_item = BLOCKHEAD (LEAF)->blk_nr_item; - ih = ITEMHEAD; - for (i = 0; i < nr_item; i++) - { - if (ih->ih_key.k_dir_id == dir_id - && ih->ih_key.k_objectid == objectid - && ih->ih_key.u.v1.k_offset == 0 - && ih->ih_key.u.v1.k_uniqueness == 0) - { -#ifdef REISERDEBUG - printf (" depth=%d, i=%d/%d\n", depth, i, nr_item); -#endif /* REISERDEBUG */ - INFO->current_ih = ih; - INFO->current_item = &LEAF[ih->ih_item_location]; - return 1; - } - ih++; - } - errnum = ERR_FSYS_CORRUPT; - return 0; -} - -int -reiserfs_read (char *buf, int len) -{ - unsigned int blocksize; - unsigned int offset; - unsigned int to_read; - char *prev_buf = buf; - -#ifdef REISERDEBUG - printf ("reiserfs_read: filepos=%d len=%d, offset=%x:%x\n", - filepos, len, (__u64) IH_KEY_OFFSET (INFO->current_ih) - 1); -#endif /* REISERDEBUG */ - - if (INFO->current_ih->ih_key.k_objectid != INFO->fileinfo.k_objectid - || IH_KEY_OFFSET (INFO->current_ih) > filepos + 1) - { - search_stat (INFO->fileinfo.k_dir_id, INFO->fileinfo.k_objectid); - goto get_next_key; - } - - while (! errnum) - { - if (INFO->current_ih->ih_key.k_objectid != INFO->fileinfo.k_objectid) - break; - - offset = filepos - IH_KEY_OFFSET (INFO->current_ih) + 1; - blocksize = INFO->current_ih->ih_item_len; - -#ifdef REISERDEBUG - printf (" loop: filepos=%d len=%d, offset=%d blocksize=%d\n", - filepos, len, offset, blocksize); -#endif /* REISERDEBUG */ - - if (IH_KEY_ISTYPE(INFO->current_ih, TYPE_DIRECT) - && offset < blocksize) - { -#ifdef REISERDEBUG - printf ("direct_read: offset=%d, blocksize=%d\n", - offset, blocksize); -#endif /* REISERDEBUG */ - to_read = blocksize - offset; - if (to_read > len) - to_read = len; - - if (disk_read_hook != NULL) - { - disk_read_func = disk_read_hook; - - block_read (INFO->blocks[DISK_LEAF_NODE_LEVEL], - (INFO->current_item - LEAF + offset), to_read, buf); - - disk_read_func = NULL; - } - else - memcpy (buf, INFO->current_item + offset, to_read); - goto update_buf_len; - } - else if (IH_KEY_ISTYPE(INFO->current_ih, TYPE_INDIRECT)) - { - blocksize = (blocksize >> 2) << INFO->fullblocksize_shift; -#ifdef REISERDEBUG - printf ("indirect_read: offset=%d, blocksize=%d\n", - offset, blocksize); -#endif /* REISERDEBUG */ - - while (offset < blocksize) - { - __u32 blocknr = ((__u32 *) INFO->current_item) - [offset >> INFO->fullblocksize_shift]; - int blk_offset = offset & (INFO->blocksize-1); - - to_read = INFO->blocksize - blk_offset; - if (to_read > len) - to_read = len; - - disk_read_func = disk_read_hook; - - /* Journal is only for meta data. Data blocks can be read - * directly without using block_read - */ - devread (blocknr << INFO->blocksize_shift, - blk_offset, to_read, buf); - - disk_read_func = NULL; - update_buf_len: - len -= to_read; - buf += to_read; - offset += to_read; - filepos += to_read; - if (len == 0) - goto done; - } - } - get_next_key: - next_key (); - } - done: - return errnum ? 0 : buf - prev_buf; -} - - -/* preconditions: reiserfs_mount already executed, therefore - * INFO block is valid - * returns: 0 if error, nonzero iff we were able to find the file successfully - * postconditions: on a nonzero return, INFO->fileinfo contains the info - * of the file we were trying to look up, filepos is 0 and filemax is - * the size of the file. - */ -int -reiserfs_dir (char *dirname) -{ - struct reiserfs_de_head *de_head; - char *rest, ch; - __u32 dir_id, objectid, parent_dir_id = 0, parent_objectid = 0; -#ifndef STAGE1_5 - int do_possibilities = 0; -#endif /* ! STAGE1_5 */ - char linkbuf[PATH_MAX]; /* buffer for following symbolic links */ - int link_count = 0; - int mode; - - dir_id = REISERFS_ROOT_PARENT_OBJECTID; - objectid = REISERFS_ROOT_OBJECTID; - - while (1) - { -#ifdef REISERDEBUG - printf ("dirname=%s\n", dirname); -#endif /* REISERDEBUG */ - - /* Search for the stat info first. */ - if (! search_stat (dir_id, objectid)) - return 0; - -#ifdef REISERDEBUG - printf ("sd_mode=%x sd_size=%d\n", - ((struct stat_data *) INFO->current_item)->sd_mode, - ((struct stat_data *) INFO->current_item)->sd_size); -#endif /* REISERDEBUG */ - - mode = ((struct stat_data *) INFO->current_item)->sd_mode; - - /* If we've got a symbolic link, then chase it. */ - if (S_ISLNK (mode)) - { - int len; - if (++link_count > MAX_LINK_COUNT) - { - errnum = ERR_SYMLINK_LOOP; - return 0; - } - - /* Get the symlink size. */ - filemax = ((struct stat_data *) INFO->current_item)->sd_size; - - /* Find out how long our remaining name is. */ - len = 0; - while (dirname[len] && !isspace (dirname[len])) - len++; - - if (filemax + len > sizeof (linkbuf) - 1) - { - errnum = ERR_FILELENGTH; - return 0; - } - - /* Copy the remaining name to the end of the symlink data. - Note that DIRNAME and LINKBUF may overlap! */ - grub_memmove (linkbuf + filemax, dirname, len+1); - - INFO->fileinfo.k_dir_id = dir_id; - INFO->fileinfo.k_objectid = objectid; - filepos = 0; - if (! next_key () - || reiserfs_read (linkbuf, filemax) != filemax) - { - if (! errnum) - errnum = ERR_FSYS_CORRUPT; - return 0; - } - -#ifdef REISERDEBUG - printf ("symlink=%s\n", linkbuf); -#endif /* REISERDEBUG */ - - dirname = linkbuf; - if (*dirname == '/') - { - /* It's an absolute link, so look it up in root. */ - dir_id = REISERFS_ROOT_PARENT_OBJECTID; - objectid = REISERFS_ROOT_OBJECTID; - } - else - { - /* Relative, so look it up in our parent directory. */ - dir_id = parent_dir_id; - objectid = parent_objectid; - } - - /* Now lookup the new name. */ - continue; - } - - /* if we have a real file (and we're not just printing possibilities), - then this is where we want to exit */ - - if (! *dirname || isspace (*dirname)) - { - if (! S_ISREG (mode)) - { - errnum = ERR_BAD_FILETYPE; - return 0; - } - - filepos = 0; - filemax = ((struct stat_data *) INFO->current_item)->sd_size; - - /* If this is a new stat data and size is > 4GB set filemax to - * maximum - */ - if (INFO->current_ih->ih_version == ITEM_VERSION_2 - && ((struct stat_data *) INFO->current_item)->sd_size_hi > 0) - filemax = 0xffffffff; - - INFO->fileinfo.k_dir_id = dir_id; - INFO->fileinfo.k_objectid = objectid; - return next_key (); - } - - /* continue with the file/directory name interpretation */ - while (*dirname == '/') - dirname++; - if (! S_ISDIR (mode)) - { - errnum = ERR_BAD_FILETYPE; - return 0; - } - for (rest = dirname; (ch = *rest) && ! isspace (ch) && ch != '/'; rest++); - *rest = 0; - -# ifndef STAGE1_5 - if (print_possibilities && ch != '/') - do_possibilities = 1; -# endif /* ! STAGE1_5 */ - - while (1) - { - char *name_end; - int num_entries; - - if (! next_key ()) - return 0; -#ifdef REISERDEBUG - printf ("ih: key %d:%d:%d:%d version:%d\n", - INFO->current_ih->ih_key.k_dir_id, - INFO->current_ih->ih_key.k_objectid, - INFO->current_ih->ih_key.u.v1.k_offset, - INFO->current_ih->ih_key.u.v1.k_uniqueness, - INFO->current_ih->ih_version); -#endif /* REISERDEBUG */ - - if (INFO->current_ih->ih_key.k_objectid != objectid) - break; - - name_end = INFO->current_item + INFO->current_ih->ih_item_len; - de_head = (struct reiserfs_de_head *) INFO->current_item; - num_entries = INFO->current_ih->u.ih_entry_count; - while (num_entries > 0) - { - char *filename = INFO->current_item + de_head->deh_location; - char tmp = *name_end; - if ((de_head->deh_state & DEH_Visible)) - { - int cmp; - /* Directory names in ReiserFS are not null - * terminated. We write a temporary 0 behind it. - * NOTE: that this may overwrite the first block in - * the tree cache. That doesn't hurt as long as we - * don't call next_key () in between. - */ - *name_end = 0; - cmp = substring (dirname, filename); - *name_end = tmp; -# ifndef STAGE1_5 - if (do_possibilities) - { - if (cmp <= 0) - { - if (print_possibilities > 0) - print_possibilities = -print_possibilities; - *name_end = 0; - print_a_completion (filename); - *name_end = tmp; - } - } - else -# endif /* ! STAGE1_5 */ - if (cmp == 0) - goto found; - } - /* The beginning of this name marks the end of the next name. - */ - name_end = filename; - de_head++; - num_entries--; - } - } - -# ifndef STAGE1_5 - if (print_possibilities < 0) - return 1; -# endif /* ! STAGE1_5 */ - - errnum = ERR_FILE_NOT_FOUND; - *rest = ch; - return 0; - - found: - - *rest = ch; - dirname = rest; - - parent_dir_id = dir_id; - parent_objectid = objectid; - dir_id = de_head->deh_dir_id; - objectid = de_head->deh_objectid; - } -} - -int -reiserfs_embed (int *start_sector, int needed_sectors) -{ - struct reiserfs_super_block super; - int num_sectors; - - if (! devread (REISERFS_DISK_OFFSET_IN_BYTES >> SECTOR_BITS, 0, - sizeof (struct reiserfs_super_block), (char *) &super)) - return 0; - - *start_sector = 1; /* reserve first sector for stage1 */ - if ((substring (REISERFS_SUPER_MAGIC_STRING, super.s_magic) <= 0 - || substring (REISER2FS_SUPER_MAGIC_STRING, super.s_magic) <= 0 - || substring (REISER3FS_SUPER_MAGIC_STRING, super.s_magic) <= 0) - && (/* check that this is not a super block copy inside - * the journal log */ - super.s_journal_block * super.s_blocksize - > REISERFS_DISK_OFFSET_IN_BYTES)) - num_sectors = (REISERFS_DISK_OFFSET_IN_BYTES >> SECTOR_BITS) - 1; - else - num_sectors = (REISERFS_OLD_DISK_OFFSET_IN_BYTES >> SECTOR_BITS) - 1; - - return (needed_sectors <= num_sectors); -} -#endif /* FSYS_REISERFS */ diff --git a/usr/src/grub/grub-0.95/stage2/fsys_ufs.c b/usr/src/grub/grub-0.95/stage2/fsys_ufs.c deleted file mode 100644 index 88db5f392c..0000000000 --- a/usr/src/grub/grub-0.95/stage2/fsys_ufs.c +++ /dev/null @@ -1,266 +0,0 @@ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 2006 Free Software Foundation, 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 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. - */ -/* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* From Solaris usr/src/stand/lib/fs/ufs/ufsops.c */ - -#ifdef FSYS_UFS - -#include "shared.h" -#include "filesys.h" - -#include "ufs.h" - -/* These are the pools of buffers, etc. */ - -#define SUPERBLOCK ((struct fs *)(FSYS_BUF + 0x2000)) -#define INODE ((struct icommon *)(FSYS_BUF + 0x1000)) -#define DIRENT (FSYS_BUF + 0x4000) -#define INDIRBLK1 ((grub_daddr32_t *)(FSYS_BUF + 0x4000)) /* 2+ indir blk */ -#define INDIRBLK0 ((grub_daddr32_t *)(FSYS_BUF+ 0x6000)) /* 1st indirect blk */ - -static int indirblk0, indirblk1; - -static int openi(grub_ino_t); -static grub_ino_t dlook(grub_ino_t, char *); -static grub_daddr32_t sbmap(grub_daddr32_t); - -/* read superblock and check fs magic */ -int -ufs_mount(void) -{ - if (! IS_PC_SLICE_TYPE_SOLARIS(current_slice) || - !devread(UFS_SBLOCK, 0, UFS_SBSIZE, (char *)SUPERBLOCK) || - SUPERBLOCK->fs_magic != UFS_MAGIC) - return 0; - - return 1; -} - - -/* - * searching for a file, if successful, inode will be loaded in INODE - * The entry point should really be named ufs_open(char *pathname). - * For now, keep it consistent with the rest of fsys modules. - */ -int -ufs_dir(char *dirname) -{ - grub_ino_t inode = ROOTINO; /* start from root */ - char *fname, ch; - - indirblk0 = indirblk1 = 0; - - /* skip leading slashes */ - while (*dirname == '/') - dirname++; - - while (inode && *dirname && !isspace(*dirname)) { - if (!openi(inode)) - return 0; - - /* parse for next path component */ - fname = dirname; - while (*dirname && !isspace(*dirname) && *dirname != '/') - dirname++; - ch = *dirname; - *dirname = 0; /* ensure null termination */ - - inode = dlook(inode, fname); - *dirname = ch; - while (*dirname == '/') - dirname++; - } - - /* return 1 only if inode exists and is a regular file */ - if (! openi(inode)) - return (0); - filepos = 0; - filemax = INODE->ic_sizelo; - return (inode && ((INODE->ic_smode & IFMT) == IFREG)); -} - -/* - * This is the high-level read function. - */ -int -ufs_read(char *buf, int len) -{ - int off, size, ret = 0, ok; - grub_daddr32_t lblk, dblk; - - while (len) { - off = blkoff(SUPERBLOCK, filepos); - lblk = lblkno(SUPERBLOCK, filepos); - size = SUPERBLOCK->fs_bsize; - size -= off; - if (size > len) - size = len; - - if ((dblk = sbmap(lblk)) <= 0) { - /* we are in a file hole, just zero the buf */ - grub_memset(buf, 0, size); - } else { - disk_read_func = disk_read_hook; - ok = devread(fsbtodb(SUPERBLOCK, dblk), off, size, buf); - disk_read_func = 0; - if (!ok) - return 0; - } - buf += size; - len -= size; - filepos += size; - ret += size; - } - - return (ret); -} - -int -ufs_embed (int *start_sector, int needed_sectors) -{ - if (needed_sectors > 14) - return 0; - - *start_sector = 2; - return 1; -} - -/* read inode and place content in INODE */ -static int -openi(grub_ino_t inode) -{ - grub_daddr32_t dblk; - int off; - - /* get block and byte offset into the block */ - dblk = fsbtodb(SUPERBLOCK, itod(SUPERBLOCK, inode)); - off = itoo(SUPERBLOCK, inode) * sizeof (struct icommon); - - return (devread(dblk, off, sizeof (struct icommon), (char *)INODE)); -} - -/* - * Performs fileblock mapping. Convert file block no. to disk block no. - * Returns 0 when block doesn't exist and <0 when block isn't initialized - * (i.e belongs to a hole in the file). - */ -grub_daddr32_t -sbmap(grub_daddr32_t bn) -{ - int level, bound, i, index; - grub_daddr32_t nb, blkno; - grub_daddr32_t *db = INODE->ic_db; - - /* blocks 0..UFS_NDADDR are direct blocks */ - if (bn < UFS_NDADDR) { - return db[bn]; - } - - /* determine how many levels of indirection. */ - level = 0; - bn -= UFS_NDADDR; - bound = UFS_NINDIR(SUPERBLOCK); - while (bn >= bound) { - level++; - bn -= bound; - bound *= UFS_NINDIR(SUPERBLOCK); - } - if (level >= UFS_NIADDR) /* bn too big */ - return ((grub_daddr32_t)0); - - /* fetch the first indirect block */ - nb = INODE->ic_ib[level]; - if (nb == 0) { - return ((grub_daddr32_t)0); - } - if (indirblk0 != nb) { - indirblk0 = 0; - blkno = fsbtodb(SUPERBLOCK, nb); - if (!devread(blkno, 0, SUPERBLOCK->fs_bsize, - (char *)INDIRBLK0)) - return (0); - indirblk0 = nb; - } - bound /= UFS_NINDIR(SUPERBLOCK); - index = (bn / bound) % UFS_NINDIR(SUPERBLOCK); - nb = INDIRBLK0[index]; - - /* fetch through the indirect blocks */ - for (i = 1; i <= level; i++) { - if (indirblk1 != nb) { - blkno = fsbtodb(SUPERBLOCK, nb); - if (!devread(blkno, 0, SUPERBLOCK->fs_bsize, - (char *)INDIRBLK1)) - return (0); - indirblk1 = nb; - } - bound /= UFS_NINDIR(SUPERBLOCK); - index = (bn / bound) % UFS_NINDIR(SUPERBLOCK); - nb = INDIRBLK1[index]; - if (nb == 0) - return ((grub_daddr32_t)0); - } - - return (nb); -} - -/* search directory content for name, return inode number */ -static grub_ino_t -dlook(grub_ino_t dir_ino, char *name) -{ - int loc, off; - grub_daddr32_t lbn, dbn, dblk; - struct direct *dp; - - if ((INODE->ic_smode & IFMT) != IFDIR) - return 0; - - loc = 0; - while (loc < INODE->ic_sizelo) { - /* offset into block */ - off = blkoff(SUPERBLOCK, loc); - if (off == 0) { /* need to read in a new block */ - - /* get logical block number */ - lbn = lblkno(SUPERBLOCK, loc); - /* resolve indrect blocks */ - dbn = sbmap(lbn); - if (dbn == 0) - return (0); - - dblk = fsbtodb(SUPERBLOCK, dbn); - if (!devread(dblk, 0, SUPERBLOCK->fs_bsize, - (char *)DIRENT)) { - return 0; - } - } - - dp = (struct direct *)(DIRENT + off); - if (dp->d_ino && substring(name, dp->d_name) == 0) - return (dp->d_ino); - loc += dp->d_reclen; - } - return (0); -} - -#endif /* FSYS_UFS */ diff --git a/usr/src/grub/grub-0.95/stage2/fsys_ufs2.c b/usr/src/grub/grub-0.95/stage2/fsys_ufs2.c deleted file mode 100644 index 698aca4e55..0000000000 --- a/usr/src/grub/grub-0.95/stage2/fsys_ufs2.c +++ /dev/null @@ -1,331 +0,0 @@ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 2000, 2001 Free Software Foundation, Inc. - * Copyright (c) 2004 Valery Hromov - * - * 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. - */ - -/* - * Elements of this file were originally from the FreeBSD "biosboot" - * bootloader file "disk.c" dated 4/12/95. - * - * The license and header comments from that file are included here. - */ - -/* - * Mach Operating System - * Copyright (c) 1992, 1991 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. - * - * 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 FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie Mellon - * the rights to redistribute these changes. - * - * from: Mach, Revision 2.2 92/04/04 11:35:49 rpd - * $Id: fsys_ufs2.c,v 1.2 2004/06/19 12:17:52 okuji Exp $ - */ - -#ifdef FSYS_UFS2 - -#include "shared.h" -#include "filesys.h" - -#include "ufs2.h" - -/* used for filesystem map blocks */ -static int mapblock; -static int mapblock_offset; -static int mapblock_bsize; - -static int sblock_try[] = SBLOCKSEARCH; -static ufs2_daddr_t sblockloc; -static int type; - -/* pointer to superblock */ -#define SUPERBLOCK ((struct fs *) ( FSYS_BUF + 8192 )) - -#define INODE_UFS2 ((struct ufs2_dinode *) ( FSYS_BUF + 16384 )) - -#define MAPBUF ( FSYS_BUF + 24576 ) -#define MAPBUF_LEN 8192 - -int -ufs2_mount (void) -{ - int retval = 0; - int i; - - sblockloc = -1; - type = 0; - - if (! (((current_drive & 0x80) || (current_slice != 0)) - && ! IS_PC_SLICE_TYPE_BSD_WITH_FS (current_slice, FS_BSDFFS))) - { - for (i = 0; sblock_try[i] != -1; ++i) - { - if (! (part_length < (sblock_try[i] + (SBLOCKSIZE / DEV_BSIZE)) - || ! devread (0, sblock_try[i], SBLOCKSIZE, (char *) SUPERBLOCK))) - { - if (SUPERBLOCK->fs_magic == FS_UFS2_MAGIC /* && - (SUPERBLOCK->fs_sblockloc == sblockloc || - (SUPERBLOCK->fs_old_flags & FS_FLAGS_UPDATED) == 0)*/) - { - type = 2; - } - else - { - continue; - } - - retval = 1; - sblockloc = sblock_try[i]; - break; - } - } - } - - mapblock = -1; - mapblock_offset = -1; - - return retval; -} - -static grub_int64_t -block_map (int file_block) -{ - int bnum, offset, bsize; - - if (file_block < NDADDR) - return (INODE_UFS2->di_db[file_block]); - - /* If the blockmap loaded does not include FILE_BLOCK, - load a new blockmap. */ - - if ((bnum = fsbtodb (SUPERBLOCK, INODE_UFS2->di_ib[0])) != mapblock - || (mapblock_offset <= bnum && bnum <= mapblock_offset + mapblock_bsize)) - { - if (MAPBUF_LEN < SUPERBLOCK->fs_bsize) - { - offset = ((file_block - NDADDR) % NINDIR (SUPERBLOCK)); - bsize = MAPBUF_LEN; - - if (offset + MAPBUF_LEN > SUPERBLOCK->fs_bsize) - offset = (SUPERBLOCK->fs_bsize - MAPBUF_LEN) / sizeof (int); - } - else - { - bsize = SUPERBLOCK->fs_bsize; - offset = 0; - } - - if (! devread (bnum, offset * sizeof (int), bsize, (char *) MAPBUF)) - { - mapblock = -1; - mapblock_bsize = -1; - mapblock_offset = -1; - errnum = ERR_FSYS_CORRUPT; - return -1; - } - - mapblock = bnum; - mapblock_bsize = bsize; - mapblock_offset = offset; - } - - return (((grub_int64_t *) MAPBUF)[((file_block - NDADDR) % NINDIR (SUPERBLOCK)) - - mapblock_offset]); -} - -int -ufs2_read (char *buf, int len) -{ - int logno, off, size, ret = 0; - grub_int64_t map; - - while (len && !errnum) - { - off = blkoff (SUPERBLOCK, filepos); - logno = lblkno (SUPERBLOCK, filepos); - size = blksize (SUPERBLOCK, INODE_UFS2, logno); - - if ((map = block_map (logno)) < 0) - break; - - size -= off; - - if (size > len) - size = len; - - disk_read_func = disk_read_hook; - - devread (fsbtodb (SUPERBLOCK, map), off, size, buf); - - disk_read_func = NULL; - - buf += size; - len -= size; - filepos += size; - ret += size; - } - - if (errnum) - ret = 0; - - return ret; -} - -int -ufs2_dir (char *dirname) -{ - char *rest, ch; - int block, off, loc, ino = ROOTINO; - grub_int64_t map; - struct direct *dp; - -/* main loop to find destination inode */ -loop: - - /* load current inode (defaults to the root inode) */ - - if (!devread (fsbtodb (SUPERBLOCK, ino_to_fsba (SUPERBLOCK, ino)), - ino % (SUPERBLOCK->fs_inopb) * sizeof (struct ufs2_dinode), - sizeof (struct ufs2_dinode), (char *) INODE_UFS2)) - return 0; /* XXX what return value? */ - - /* if we have a real file (and we're not just printing possibilities), - then this is where we want to exit */ - - if (!*dirname || isspace (*dirname)) - { - if ((INODE_UFS2->di_mode & IFMT) != IFREG) - { - errnum = ERR_BAD_FILETYPE; - return 0; - } - - filemax = INODE_UFS2->di_size; - - /* incomplete implementation requires this! */ - fsmax = (NDADDR + NINDIR (SUPERBLOCK)) * SUPERBLOCK->fs_bsize; - return 1; - } - - /* continue with file/directory name interpretation */ - - while (*dirname == '/') - dirname++; - - if (!(INODE_UFS2->di_size) || ((INODE_UFS2->di_mode & IFMT) != IFDIR)) - { - errnum = ERR_BAD_FILETYPE; - return 0; - } - - for (rest = dirname; (ch = *rest) && !isspace (ch) && ch != '/'; rest++); - - *rest = 0; - loc = 0; - - /* loop for reading a the entries in a directory */ - - do - { - if (loc >= INODE_UFS2->di_size) - { - if (print_possibilities < 0) - return 1; - - errnum = ERR_FILE_NOT_FOUND; - *rest = ch; - return 0; - } - - if (!(off = blkoff (SUPERBLOCK, loc))) - { - block = lblkno (SUPERBLOCK, loc); - - if ((map = block_map (block)) < 0 - || !devread (fsbtodb (SUPERBLOCK, map), 0, - blksize (SUPERBLOCK, INODE_UFS2, block), - (char *) FSYS_BUF)) - { - errnum = ERR_FSYS_CORRUPT; - *rest = ch; - return 0; - } - } - - dp = (struct direct *) (FSYS_BUF + off); - loc += dp->d_reclen; - -#ifndef STAGE1_5 - if (dp->d_ino && print_possibilities && ch != '/' - && (!*dirname || substring (dirname, dp->d_name) <= 0)) - { - if (print_possibilities > 0) - print_possibilities = -print_possibilities; - - print_a_completion (dp->d_name); - } -#endif /* STAGE1_5 */ - } - while (!dp->d_ino || (substring (dirname, dp->d_name) != 0 - || (print_possibilities && ch != '/'))); - - /* only get here if we have a matching directory entry */ - - ino = dp->d_ino; - *(dirname = rest) = ch; - - /* go back to main loop at top of function */ - goto loop; -} - -int -ufs2_embed (int *start_sector, int needed_sectors) -{ - /* XXX: I don't know if this is really correct. Someone who is - familiar with BSD should check for this. */ - if (needed_sectors > 14) - return 0; - - *start_sector = 1; -#if 1 - /* FIXME: Disable the embedding in FFS until someone checks if - the code above is correct. */ - return 0; -#else - return 1; -#endif -} - -#endif /* FSYS_UFS2 */ diff --git a/usr/src/grub/grub-0.95/stage2/fsys_vstafs.c b/usr/src/grub/grub-0.95/stage2/fsys_vstafs.c deleted file mode 100644 index a1167172b9..0000000000 --- a/usr/src/grub/grub-0.95/stage2/fsys_vstafs.c +++ /dev/null @@ -1,252 +0,0 @@ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 2001 Free Software Foundation, 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 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. - */ - -#ifdef FSYS_VSTAFS - -#include "shared.h" -#include "filesys.h" -#include "vstafs.h" - - -static void get_file_info (int sector); -static struct dir_entry *vstafs_readdir (long sector); -static struct dir_entry *vstafs_nextdir (void); - - -#define FIRST_SECTOR ((struct first_sector *) FSYS_BUF) -#define FILE_INFO ((struct fs_file *) (int) FIRST_SECTOR + 8192) -#define DIRECTORY_BUF ((struct dir_entry *) (int) FILE_INFO + 512) - -#define ROOT_SECTOR 1 - -/* - * In f_sector we store the sector number in which the information about - * the found file is. - */ -extern int filepos; -static int f_sector; - -int -vstafs_mount (void) -{ - int retval = 1; - - if( (((current_drive & 0x80) || (current_slice != 0)) - && current_slice != PC_SLICE_TYPE_VSTAFS) - || ! devread (0, 0, BLOCK_SIZE, (char *) FSYS_BUF) - || FIRST_SECTOR->fs_magic != 0xDEADFACE) - retval = 0; - - return retval; -} - -static void -get_file_info (int sector) -{ - devread (sector, 0, BLOCK_SIZE, (char *) FILE_INFO); -} - -static int curr_ext, current_direntry, current_blockpos; -static struct alloc *a; - -static struct dir_entry * -vstafs_readdir (long sector) -{ - /* - * Get some information from the current directory - */ - get_file_info (sector); - if (FILE_INFO->type != 2) - { - errnum = ERR_FILE_NOT_FOUND; - return 0; - } - - a = FILE_INFO->blocks; - curr_ext = 0; - devread (a[curr_ext].a_start, 0, 512, (char *) DIRECTORY_BUF); - current_direntry = 11; - current_blockpos = 0; - - return &DIRECTORY_BUF[10]; -} - -static struct dir_entry * -vstafs_nextdir (void) -{ - if (current_direntry > 15) - { - current_direntry = 0; - if (++current_blockpos > (a[curr_ext].a_len - 1)) - { - current_blockpos = 0; - curr_ext++; - } - - if (curr_ext < FILE_INFO->extents) - { - devread (a[curr_ext].a_start + current_blockpos, 0, - 512, (char *) DIRECTORY_BUF); - } - else - { - /* errnum =ERR_FILE_NOT_FOUND; */ - return 0; - } - } - - return &DIRECTORY_BUF[current_direntry++]; -} - -int -vstafs_dir (char *dirname) -{ - char *fn, ch; - struct dir_entry *d; - /* int l, i, s; */ - - /* - * Read in the entries of the current directory. - */ - f_sector = ROOT_SECTOR; - do - { - if (! (d = vstafs_readdir (f_sector))) - { - return 0; - } - - /* - * Find the file in the path - */ - while (*dirname == '/') dirname++; - fn = dirname; - while ((ch = *fn) && ch != '/' && ! isspace (ch)) fn++; - *fn = 0; - - do - { - if (d->name[0] == 0 || d->name[0] & 0x80) - continue; - -#ifndef STAGE1_5 - if (print_possibilities && ch != '/' - && (! *dirname || strcmp (dirname, d->name) <= 0)) - { - if (print_possibilities > 0) - print_possibilities = -print_possibilities; - - printf (" %s", d->name); - } -#endif - if (! grub_strcmp (dirname, d->name)) - { - f_sector = d->start; - get_file_info (f_sector); - filemax = FILE_INFO->len; - break; - } - } - while ((d =vstafs_nextdir ())); - - *(dirname = fn) = ch; - if (! d) - { - if (print_possibilities < 0) - { - putchar ('\n'); - return 1; - } - - errnum = ERR_FILE_NOT_FOUND; - return 0; - } - } - while (*dirname && ! isspace (ch)); - - return 1; -} - -int -vstafs_read (char *addr, int len) -{ - struct alloc *a; - int size, ret = 0, offset, curr_len = 0; - int curr_ext; - char extent; - int ext_size; - char *curr_pos; - - get_file_info (f_sector); - size = FILE_INFO->len-VSTAFS_START_DATA; - a = FILE_INFO->blocks; - - if (filepos > 0) - { - if (filepos < a[0].a_len * 512 - VSTAFS_START_DATA) - { - offset = filepos + VSTAFS_START_DATA; - extent = 0; - curr_len = a[0].a_len * 512 - offset - filepos; - } - else - { - ext_size = a[0].a_len * 512 - VSTAFS_START_DATA; - offset = filepos - ext_size; - extent = 1; - do - { - curr_len -= ext_size; - offset -= ext_size; - ext_size = a[extent+1].a_len * 512; - } - while (extent < FILE_INFO->extents && offset>ext_size); - } - } - else - { - offset = VSTAFS_START_DATA; - extent = 0; - curr_len = a[0].a_len * 512 - offset; - } - - curr_pos = addr; - if (curr_len > len) - curr_len = len; - - for (curr_ext=extent; - curr_ext < FILE_INFO->extents; - curr_len = a[curr_ext].a_len * 512, curr_pos += curr_len, curr_ext++) - { - ret += curr_len; - size -= curr_len; - if (size < 0) - { - ret += size; - curr_len += size; - } - - devread (a[curr_ext].a_start,offset, curr_len, curr_pos); - offset = 0; - } - - return ret; -} - -#endif /* FSYS_VSTAFS */ diff --git a/usr/src/grub/grub-0.95/stage2/fsys_xfs.c b/usr/src/grub/grub-0.95/stage2/fsys_xfs.c deleted file mode 100644 index 8ee31aeccd..0000000000 --- a/usr/src/grub/grub-0.95/stage2/fsys_xfs.c +++ /dev/null @@ -1,624 +0,0 @@ -/* fsys_xfs.c - an implementation for the SGI XFS file system */ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 2001,2002,2004 Free Software Foundation, 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 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. - */ - -#ifdef FSYS_XFS - -#include "shared.h" -#include "filesys.h" -#include "xfs.h" - -#define MAX_LINK_COUNT 8 - -typedef struct xad { - xfs_fileoff_t offset; - xfs_fsblock_t start; - xfs_filblks_t len; -} xad_t; - -struct xfs_info { - int bsize; - int dirbsize; - int isize; - unsigned int agblocks; - int bdlog; - int blklog; - int inopblog; - int agblklog; - int agnolog; - unsigned int nextents; - xfs_daddr_t next; - xfs_daddr_t daddr; - xfs_dablk_t forw; - xfs_dablk_t dablk; - xfs_bmbt_rec_32_t *xt; - xfs_bmbt_ptr_t ptr0; - int btnode_ptr0_off; - int i8param; - int dirpos; - int dirmax; - int blkoff; - int fpos; - xfs_ino_t rootino; -}; - -static struct xfs_info xfs; - -#define dirbuf ((char *)FSYS_BUF) -#define filebuf ((char *)FSYS_BUF + 4096) -#define inode ((xfs_dinode_t *)((char *)FSYS_BUF + 8192)) -#define icore (inode->di_core) - -#define mask32lo(n) (((xfs_uint32_t)1 << (n)) - 1) - -#define XFS_INO_MASK(k) ((xfs_uint32_t)((1ULL << (k)) - 1)) -#define XFS_INO_OFFSET_BITS xfs.inopblog -#define XFS_INO_AGBNO_BITS xfs.agblklog -#define XFS_INO_AGINO_BITS (xfs.agblklog + xfs.inopblog) -#define XFS_INO_AGNO_BITS xfs.agnolog - -static inline xfs_agblock_t -agino2agbno (xfs_agino_t agino) -{ - return agino >> XFS_INO_OFFSET_BITS; -} - -static inline xfs_agnumber_t -ino2agno (xfs_ino_t ino) -{ - return ino >> XFS_INO_AGINO_BITS; -} - -static inline xfs_agino_t -ino2agino (xfs_ino_t ino) -{ - return ino & XFS_INO_MASK(XFS_INO_AGINO_BITS); -} - -static inline int -ino2offset (xfs_ino_t ino) -{ - return ino & XFS_INO_MASK(XFS_INO_OFFSET_BITS); -} - -static inline __const__ xfs_uint16_t -le16 (xfs_uint16_t x) -{ - __asm__("xchgb %b0,%h0" \ - : "=q" (x) \ - : "0" (x)); \ - return x; -} - -static inline __const__ xfs_uint32_t -le32 (xfs_uint32_t x) -{ -#if 0 - /* 386 doesn't have bswap. */ - __asm__("bswap %0" : "=r" (x) : "0" (x)); -#else - /* This is slower but this works on all x86 architectures. */ - __asm__("xchgb %b0, %h0" \ - "\n\troll $16, %0" \ - "\n\txchgb %b0, %h0" \ - : "=q" (x) : "0" (x)); -#endif - return x; -} - -static inline __const__ xfs_uint64_t -le64 (xfs_uint64_t x) -{ - xfs_uint32_t h = x >> 32; - xfs_uint32_t l = x & ((1ULL<<32)-1); - return (((xfs_uint64_t)le32(l)) << 32) | ((xfs_uint64_t)(le32(h))); -} - - -static xfs_fsblock_t -xt_start (xfs_bmbt_rec_32_t *r) -{ - return (((xfs_fsblock_t)(le32 (r->l1) & mask32lo(9))) << 43) | - (((xfs_fsblock_t)le32 (r->l2)) << 11) | - (((xfs_fsblock_t)le32 (r->l3)) >> 21); -} - -static xfs_fileoff_t -xt_offset (xfs_bmbt_rec_32_t *r) -{ - return (((xfs_fileoff_t)le32 (r->l0) & - mask32lo(31)) << 23) | - (((xfs_fileoff_t)le32 (r->l1)) >> 9); -} - -static xfs_filblks_t -xt_len (xfs_bmbt_rec_32_t *r) -{ - return le32(r->l3) & mask32lo(21); -} - -static inline int -xfs_highbit32(xfs_uint32_t v) -{ - int i; - - if (--v) { - for (i = 0; i < 31; i++, v >>= 1) { - if (v == 0) - return i; - } - } - return 0; -} - -static int -isinxt (xfs_fileoff_t key, xfs_fileoff_t offset, xfs_filblks_t len) -{ - return (key >= offset) ? (key < offset + len ? 1 : 0) : 0; -} - -static xfs_daddr_t -agb2daddr (xfs_agnumber_t agno, xfs_agblock_t agbno) -{ - return ((xfs_fsblock_t)agno*xfs.agblocks + agbno) << xfs.bdlog; -} - -static xfs_daddr_t -fsb2daddr (xfs_fsblock_t fsbno) -{ - return agb2daddr ((xfs_agnumber_t)(fsbno >> xfs.agblklog), - (xfs_agblock_t)(fsbno & mask32lo(xfs.agblklog))); -} - -#undef offsetof -#define offsetof(t,m) ((int)&(((t *)0)->m)) - -static inline int -btroot_maxrecs (void) -{ - int tmp = icore.di_forkoff ? (icore.di_forkoff << 3) : xfs.isize; - - return (tmp - sizeof(xfs_bmdr_block_t) - offsetof(xfs_dinode_t, di_u)) / - (sizeof (xfs_bmbt_key_t) + sizeof (xfs_bmbt_ptr_t)); -} - -static int -di_read (xfs_ino_t ino) -{ - xfs_agino_t agino; - xfs_agnumber_t agno; - xfs_agblock_t agbno; - xfs_daddr_t daddr; - int offset; - - agno = ino2agno (ino); - agino = ino2agino (ino); - agbno = agino2agbno (agino); - offset = ino2offset (ino); - daddr = agb2daddr (agno, agbno); - - devread (daddr, offset*xfs.isize, xfs.isize, (char *)inode); - - xfs.ptr0 = *(xfs_bmbt_ptr_t *) - (inode->di_u.di_c + sizeof(xfs_bmdr_block_t) - + btroot_maxrecs ()*sizeof(xfs_bmbt_key_t)); - - return 1; -} - -static void -init_extents (void) -{ - xfs_bmbt_ptr_t ptr0; - xfs_btree_lblock_t h; - - switch (icore.di_format) { - case XFS_DINODE_FMT_EXTENTS: - xfs.xt = inode->di_u.di_bmx; - xfs.nextents = le32 (icore.di_nextents); - break; - case XFS_DINODE_FMT_BTREE: - ptr0 = xfs.ptr0; - for (;;) { - xfs.daddr = fsb2daddr (le64(ptr0)); - devread (xfs.daddr, 0, - sizeof(xfs_btree_lblock_t), (char *)&h); - if (!h.bb_level) { - xfs.nextents = le16(h.bb_numrecs); - xfs.next = fsb2daddr (le64(h.bb_rightsib)); - xfs.fpos = sizeof(xfs_btree_block_t); - return; - } - devread (xfs.daddr, xfs.btnode_ptr0_off, - sizeof(xfs_bmbt_ptr_t), (char *)&ptr0); - } - } -} - -static xad_t * -next_extent (void) -{ - static xad_t xad; - - switch (icore.di_format) { - case XFS_DINODE_FMT_EXTENTS: - if (xfs.nextents == 0) - return NULL; - break; - case XFS_DINODE_FMT_BTREE: - if (xfs.nextents == 0) { - xfs_btree_lblock_t h; - if (xfs.next == 0) - return NULL; - xfs.daddr = xfs.next; - devread (xfs.daddr, 0, sizeof(xfs_btree_lblock_t), (char *)&h); - xfs.nextents = le16(h.bb_numrecs); - xfs.next = fsb2daddr (le64(h.bb_rightsib)); - xfs.fpos = sizeof(xfs_btree_block_t); - } - /* Yeah, I know that's slow, but I really don't care */ - devread (xfs.daddr, xfs.fpos, sizeof(xfs_bmbt_rec_t), filebuf); - xfs.xt = (xfs_bmbt_rec_32_t *)filebuf; - xfs.fpos += sizeof(xfs_bmbt_rec_32_t); - } - xad.offset = xt_offset (xfs.xt); - xad.start = xt_start (xfs.xt); - xad.len = xt_len (xfs.xt); - ++xfs.xt; - --xfs.nextents; - - return &xad; -} - -/* - * Name lies - the function reads only first 100 bytes - */ -static void -xfs_dabread (void) -{ - xad_t *xad; - xfs_fileoff_t offset;; - - init_extents (); - while ((xad = next_extent ())) { - offset = xad->offset; - if (isinxt (xfs.dablk, offset, xad->len)) { - devread (fsb2daddr (xad->start + xfs.dablk - offset), - 0, 100, dirbuf); - break; - } - } -} - -static inline xfs_ino_t -sf_ino (char *sfe, int namelen) -{ - void *p = sfe + namelen + 3; - - return (xfs.i8param == 0) - ? le64(*(xfs_ino_t *)p) : le32(*(xfs_uint32_t *)p); -} - -static inline xfs_ino_t -sf_parent_ino (void) -{ - return (xfs.i8param == 0) - ? le64(*(xfs_ino_t *)(&inode->di_u.di_dir2sf.hdr.parent)) - : le32(*(xfs_uint32_t *)(&inode->di_u.di_dir2sf.hdr.parent)); -} - -static inline int -roundup8 (int n) -{ - return ((n+7)&~7); -} - -static char * -next_dentry (xfs_ino_t *ino) -{ - int namelen = 1; - int toread; - static char *usual[2] = {".", ".."}; - static xfs_dir2_sf_entry_t *sfe; - char *name = usual[0]; - - if (xfs.dirpos >= xfs.dirmax) { - if (xfs.forw == 0) - return NULL; - xfs.dablk = xfs.forw; - xfs_dabread (); -#define h ((xfs_dir2_leaf_hdr_t *)dirbuf) - xfs.dirmax = le16 (h->count) - le16 (h->stale); - xfs.forw = le32 (h->info.forw); -#undef h - xfs.dirpos = 0; - } - - switch (icore.di_format) { - case XFS_DINODE_FMT_LOCAL: - switch (xfs.dirpos) { - case -2: - *ino = 0; - break; - case -1: - *ino = sf_parent_ino (); - ++name; - ++namelen; - sfe = (xfs_dir2_sf_entry_t *) - (inode->di_u.di_c - + sizeof(xfs_dir2_sf_hdr_t) - - xfs.i8param); - break; - default: - namelen = sfe->namelen; - *ino = sf_ino ((char *)sfe, namelen); - name = sfe->name; - sfe = (xfs_dir2_sf_entry_t *) - ((char *)sfe + namelen + 11 - xfs.i8param); - } - break; - case XFS_DINODE_FMT_BTREE: - case XFS_DINODE_FMT_EXTENTS: -#define dau ((xfs_dir2_data_union_t *)dirbuf) - for (;;) { - if (xfs.blkoff >= xfs.dirbsize) { - xfs.blkoff = sizeof(xfs_dir2_data_hdr_t); - filepos &= ~(xfs.dirbsize - 1); - filepos |= xfs.blkoff; - } - xfs_read (dirbuf, 4); - xfs.blkoff += 4; - if (dau->unused.freetag == XFS_DIR2_DATA_FREE_TAG) { - toread = roundup8 (le16(dau->unused.length)) - 4; - xfs.blkoff += toread; - filepos += toread; - continue; - } - break; - } - xfs_read ((char *)dirbuf + 4, 5); - *ino = le64 (dau->entry.inumber); - namelen = dau->entry.namelen; -#undef dau - toread = roundup8 (namelen + 11) - 9; - xfs_read (dirbuf, toread); - name = (char *)dirbuf; - xfs.blkoff += toread + 5; - } - ++xfs.dirpos; - name[namelen] = 0; - - return name; -} - -static char * -first_dentry (xfs_ino_t *ino) -{ - xfs.forw = 0; - switch (icore.di_format) { - case XFS_DINODE_FMT_LOCAL: - xfs.dirmax = inode->di_u.di_dir2sf.hdr.count; - xfs.i8param = inode->di_u.di_dir2sf.hdr.i8count ? 0 : 4; - xfs.dirpos = -2; - break; - case XFS_DINODE_FMT_EXTENTS: - case XFS_DINODE_FMT_BTREE: - filepos = 0; - xfs_read (dirbuf, sizeof(xfs_dir2_data_hdr_t)); - if (((xfs_dir2_data_hdr_t *)dirbuf)->magic == le32(XFS_DIR2_BLOCK_MAGIC)) { -#define tail ((xfs_dir2_block_tail_t *)dirbuf) - filepos = xfs.dirbsize - sizeof(*tail); - xfs_read (dirbuf, sizeof(*tail)); - xfs.dirmax = le32 (tail->count) - le32 (tail->stale); -#undef tail - } else { - xfs.dablk = (1ULL << 35) >> xfs.blklog; -#define h ((xfs_dir2_leaf_hdr_t *)dirbuf) -#define n ((xfs_da_intnode_t *)dirbuf) - for (;;) { - xfs_dabread (); - if ((n->hdr.info.magic == le16(XFS_DIR2_LEAFN_MAGIC)) - || (n->hdr.info.magic == le16(XFS_DIR2_LEAF1_MAGIC))) { - xfs.dirmax = le16 (h->count) - le16 (h->stale); - xfs.forw = le32 (h->info.forw); - break; - } - xfs.dablk = le32 (n->btree[0].before); - } -#undef n -#undef h - } - xfs.blkoff = sizeof(xfs_dir2_data_hdr_t); - filepos = xfs.blkoff; - xfs.dirpos = 0; - } - return next_dentry (ino); -} - -int -xfs_mount (void) -{ - xfs_sb_t super; - - if (!devread (0, 0, sizeof(super), (char *)&super) - || (le32(super.sb_magicnum) != XFS_SB_MAGIC) - || ((le16(super.sb_versionnum) - & XFS_SB_VERSION_NUMBITS) != XFS_SB_VERSION_4) ) { - return 0; - } - - xfs.bsize = le32 (super.sb_blocksize); - xfs.blklog = super.sb_blocklog; - xfs.bdlog = xfs.blklog - SECTOR_BITS; - xfs.rootino = le64 (super.sb_rootino); - xfs.isize = le16 (super.sb_inodesize); - xfs.agblocks = le32 (super.sb_agblocks); - xfs.dirbsize = xfs.bsize << super.sb_dirblklog; - - xfs.inopblog = super.sb_inopblog; - xfs.agblklog = super.sb_agblklog; - xfs.agnolog = xfs_highbit32 (le32(super.sb_agcount)); - - xfs.btnode_ptr0_off = - ((xfs.bsize - sizeof(xfs_btree_block_t)) / - (sizeof (xfs_bmbt_key_t) + sizeof (xfs_bmbt_ptr_t))) - * sizeof(xfs_bmbt_key_t) + sizeof(xfs_btree_block_t); - - return 1; -} - -int -xfs_read (char *buf, int len) -{ - xad_t *xad; - xfs_fileoff_t endofprev, endofcur, offset; - xfs_filblks_t xadlen; - int toread, startpos, endpos; - - if (icore.di_format == XFS_DINODE_FMT_LOCAL) { - grub_memmove (buf, inode->di_u.di_c + filepos, len); - filepos += len; - return len; - } - - startpos = filepos; - endpos = filepos + len; - endofprev = (xfs_fileoff_t)-1; - init_extents (); - while (len > 0 && (xad = next_extent ())) { - offset = xad->offset; - xadlen = xad->len; - if (isinxt (filepos >> xfs.blklog, offset, xadlen)) { - endofcur = (offset + xadlen) << xfs.blklog; - toread = (endofcur >= endpos) - ? len : (endofcur - filepos); - - disk_read_func = disk_read_hook; - devread (fsb2daddr (xad->start), - filepos - (offset << xfs.blklog), toread, buf); - disk_read_func = NULL; - - buf += toread; - len -= toread; - filepos += toread; - } else if (offset > endofprev) { - toread = ((offset << xfs.blklog) >= endpos) - ? len : ((offset - endofprev) << xfs.blklog); - len -= toread; - filepos += toread; - for (; toread; toread--) { - *buf++ = 0; - } - continue; - } - endofprev = offset + xadlen; - } - - return filepos - startpos; -} - -int -xfs_dir (char *dirname) -{ - xfs_ino_t ino, parent_ino, new_ino; - xfs_fsize_t di_size; - int di_mode; - int cmp, n, link_count; - char linkbuf[xfs.bsize]; - char *rest, *name, ch; - - parent_ino = ino = xfs.rootino; - link_count = 0; - for (;;) { - di_read (ino); - di_size = le64 (icore.di_size); - di_mode = le16 (icore.di_mode); - - if ((di_mode & IFMT) == IFLNK) { - if (++link_count > MAX_LINK_COUNT) { - errnum = ERR_SYMLINK_LOOP; - return 0; - } - if (di_size < xfs.bsize - 1) { - filepos = 0; - filemax = di_size; - n = xfs_read (linkbuf, filemax); - } else { - errnum = ERR_FILELENGTH; - return 0; - } - - ino = (linkbuf[0] == '/') ? xfs.rootino : parent_ino; - while (n < (xfs.bsize - 1) && (linkbuf[n++] = *dirname++)); - linkbuf[n] = 0; - dirname = linkbuf; - continue; - } - - if (!*dirname || isspace (*dirname)) { - if ((di_mode & IFMT) != IFREG) { - errnum = ERR_BAD_FILETYPE; - return 0; - } - filepos = 0; - filemax = di_size; - return 1; - } - - if ((di_mode & IFMT) != IFDIR) { - errnum = ERR_BAD_FILETYPE; - return 0; - } - - for (; *dirname == '/'; dirname++); - - for (rest = dirname; (ch = *rest) && !isspace (ch) && ch != '/'; rest++); - *rest = 0; - - name = first_dentry (&new_ino); - for (;;) { - cmp = (!*dirname) ? -1 : substring (dirname, name); -#ifndef STAGE1_5 - if (print_possibilities && ch != '/' && cmp <= 0) { - if (print_possibilities > 0) - print_possibilities = -print_possibilities; - print_a_completion (name); - } else -#endif - if (cmp == 0) { - parent_ino = ino; - if (new_ino) - ino = new_ino; - *(dirname = rest) = ch; - break; - } - name = next_dentry (&new_ino); - if (name == NULL) { - if (print_possibilities < 0) - return 1; - - errnum = ERR_FILE_NOT_FOUND; - *rest = ch; - return 0; - } - } - } -} - -#endif /* FSYS_XFS */ diff --git a/usr/src/grub/grub-0.95/stage2/fsys_zfs.c b/usr/src/grub/grub-0.95/stage2/fsys_zfs.c deleted file mode 100644 index f0b09520a2..0000000000 --- a/usr/src/grub/grub-0.95/stage2/fsys_zfs.c +++ /dev/null @@ -1,1423 +0,0 @@ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, 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 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. - */ -/* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* - * The zfs plug-in routines for GRUB are: - * - * zfs_mount() - locates a valid uberblock of the root pool and reads - * in its MOS at the memory address MOS. - * - * zfs_open() - locates a plain file object by following the MOS - * and places its dnode at the memory address DNODE. - * - * zfs_read() - read in the data blocks pointed by the DNODE. - * - * ZFS_SCRATCH is used as a working area. - * - * (memory addr) MOS DNODE ZFS_SCRATCH - * | | | - * +-------V---------V----------V---------------+ - * memory | | dnode | dnode | scratch | - * | | 512B | 512B | area | - * +--------------------------------------------+ - */ - -#ifdef FSYS_ZFS - -#include "shared.h" -#include "filesys.h" -#include "fsys_zfs.h" - -/* cache for a file block of the currently zfs_open()-ed file */ -static void *file_buf = NULL; -static uint64_t file_start = 0; -static uint64_t file_end = 0; - -/* cache for a dnode block */ -static dnode_phys_t *dnode_buf = NULL; -static dnode_phys_t *dnode_mdn = NULL; -static uint64_t dnode_start = 0; -static uint64_t dnode_end = 0; - -static uberblock_t current_uberblock; - -static char *stackbase; - -decomp_entry_t decomp_table[ZIO_COMPRESS_FUNCTIONS] = -{ - {"inherit", 0}, /* ZIO_COMPRESS_INHERIT */ - {"on", lzjb_decompress}, /* ZIO_COMPRESS_ON */ - {"off", 0}, /* ZIO_COMPRESS_OFF */ - {"lzjb", lzjb_decompress}, /* ZIO_COMPRESS_LZJB */ - {"empty", 0} /* ZIO_COMPRESS_EMPTY */ -}; - -/* - * Our own version of bcmp(). - */ -static int -zfs_bcmp(const void *s1, const void *s2, size_t n) -{ - const uchar_t *ps1 = s1; - const uchar_t *ps2 = s2; - - if (s1 != s2 && n != 0) { - do { - if (*ps1++ != *ps2++) - return (1); - } while (--n != 0); - } - - return (0); -} - -/* - * Our own version of log2(). Same thing as highbit()-1. - */ -static int -zfs_log2(uint64_t num) -{ - int i = 0; - - while (num > 1) { - i++; - num = num >> 1; - } - - return (i); -} - -/* Checksum Functions */ -static void -zio_checksum_off(const void *buf, uint64_t size, zio_cksum_t *zcp) -{ - ZIO_SET_CHECKSUM(zcp, 0, 0, 0, 0); -} - -/* Checksum Table and Values */ -zio_checksum_info_t zio_checksum_table[ZIO_CHECKSUM_FUNCTIONS] = { - NULL, NULL, 0, 0, "inherit", - NULL, NULL, 0, 0, "on", - zio_checksum_off, zio_checksum_off, 0, 0, "off", - zio_checksum_SHA256, zio_checksum_SHA256, 1, 1, "label", - zio_checksum_SHA256, zio_checksum_SHA256, 1, 1, "gang_header", - fletcher_2_native, fletcher_2_byteswap, 0, 1, "zilog", - fletcher_2_native, fletcher_2_byteswap, 0, 0, "fletcher2", - fletcher_4_native, fletcher_4_byteswap, 1, 0, "fletcher4", - zio_checksum_SHA256, zio_checksum_SHA256, 1, 0, "SHA256", -}; - -/* - * zio_checksum_verify: Provides support for checksum verification. - * - * Fletcher2, Fletcher4, and SHA256 are supported. - * - * Return: - * -1 = Failure - * 0 = Success - */ -static int -zio_checksum_verify(blkptr_t *bp, char *data, int size) -{ - zio_cksum_t zc = bp->blk_cksum; - uint32_t checksum = BP_IS_GANG(bp) ? ZIO_CHECKSUM_GANG_HEADER : - BP_GET_CHECKSUM(bp); - int byteswap = BP_SHOULD_BYTESWAP(bp); - zio_block_tail_t *zbt = (zio_block_tail_t *)(data + size) - 1; - zio_checksum_info_t *ci = &zio_checksum_table[checksum]; - zio_cksum_t actual_cksum, expected_cksum; - - /* byteswap is not supported */ - if (byteswap) - return (-1); - - if (checksum >= ZIO_CHECKSUM_FUNCTIONS || ci->ci_func[0] == NULL) - return (-1); - - if (ci->ci_zbt) { - if (checksum == ZIO_CHECKSUM_GANG_HEADER) { - /* - * 'gang blocks' is not supported. - */ - return (-1); - } - - if (zbt->zbt_magic == BSWAP_64(ZBT_MAGIC)) { - /* byte swapping is not supported */ - return (-1); - } else { - expected_cksum = zbt->zbt_cksum; - zbt->zbt_cksum = zc; - ci->ci_func[0](data, size, &actual_cksum); - zbt->zbt_cksum = expected_cksum; - } - zc = expected_cksum; - - } else { - if (BP_IS_GANG(bp)) - return (-1); - ci->ci_func[byteswap](data, size, &actual_cksum); - } - - if ((actual_cksum.zc_word[0] - zc.zc_word[0]) | - (actual_cksum.zc_word[1] - zc.zc_word[1]) | - (actual_cksum.zc_word[2] - zc.zc_word[2]) | - (actual_cksum.zc_word[3] - zc.zc_word[3])) - return (-1); - - return (0); -} - -/* - * vdev_label_offset takes "offset" (the offset within a vdev_label) and - * returns its physical disk offset (starting from the beginning of the vdev). - * - * Input: - * psize : Physical size of this vdev - * l : Label Number (0-3) - * offset : The offset with a vdev_label in which we want the physical - * address - * Return: - * Success : physical disk offset - * Failure : errnum = ERR_BAD_ARGUMENT, return value is meaningless - */ -static uint64_t -vdev_label_offset(uint64_t psize, int l, uint64_t offset) -{ - /* XXX Need to add back label support! */ - if (l >= VDEV_LABELS/2 || offset > sizeof (vdev_label_t)) { - errnum = ERR_BAD_ARGUMENT; - return (0); - } - - return (offset + l * sizeof (vdev_label_t) + (l < VDEV_LABELS / 2 ? - 0 : psize - VDEV_LABELS * sizeof (vdev_label_t))); - -} - -/* - * vdev_uberblock_compare takes two uberblock structures and returns an integer - * indicating the more recent of the two. - * Return Value = 1 if ub2 is more recent - * Return Value = -1 if ub1 is more recent - * The most recent uberblock is determined using its transaction number and - * timestamp. The uberblock with the highest transaction number is - * considered "newer". If the transaction numbers of the two blocks match, the - * timestamps are compared to determine the "newer" of the two. - */ -static int -vdev_uberblock_compare(uberblock_t *ub1, uberblock_t *ub2) -{ - if (ub1->ub_txg < ub2->ub_txg) - return (-1); - if (ub1->ub_txg > ub2->ub_txg) - return (1); - - if (ub1->ub_timestamp < ub2->ub_timestamp) - return (-1); - if (ub1->ub_timestamp > ub2->ub_timestamp) - return (1); - - return (0); -} - -/* - * Three pieces of information are needed to verify an uberblock: the magic - * number, the version number, and the checksum. - * - * Currently Implemented: version number, magic number - * Need to Implement: checksum - * - * Return: - * 0 - Success - * -1 - Failure - */ -static int -uberblock_verify(uberblock_phys_t *ub, int offset) -{ - - uberblock_t *uber = &ub->ubp_uberblock; - blkptr_t bp; - - BP_ZERO(&bp); - BP_SET_CHECKSUM(&bp, ZIO_CHECKSUM_LABEL); - BP_SET_BYTEORDER(&bp, ZFS_HOST_BYTEORDER); - ZIO_SET_CHECKSUM(&bp.blk_cksum, offset, 0, 0, 0); - - if (zio_checksum_verify(&bp, (char *)ub, UBERBLOCK_SIZE) != 0) - return (-1); - - if (uber->ub_magic == UBERBLOCK_MAGIC && - uber->ub_version > 0 && uber->ub_version <= SPA_VERSION) - return (0); - - return (-1); -} - -/* - * Find the best uberblock. - * Return: - * Success - Pointer to the best uberblock. - * Failure - NULL - */ -static uberblock_phys_t * -find_bestub(uberblock_phys_t *ub_array, int label) -{ - uberblock_phys_t *ubbest = NULL; - int i, offset; - - for (i = 0; i < (VDEV_UBERBLOCK_RING >> VDEV_UBERBLOCK_SHIFT); i++) { - offset = vdev_label_offset(0, label, VDEV_UBERBLOCK_OFFSET(i)); - if (errnum == ERR_BAD_ARGUMENT) - return (NULL); - if (uberblock_verify(&ub_array[i], offset) == 0) { - if (ubbest == NULL) { - ubbest = &ub_array[i]; - } else if (vdev_uberblock_compare( - &(ub_array[i].ubp_uberblock), - &(ubbest->ubp_uberblock)) > 0) { - ubbest = &ub_array[i]; - } - } - } - - return (ubbest); -} - -/* - * Read in a block and put its uncompressed data in buf. - * - * Return: - * 0 - success - * errnum - failure - */ -static int -zio_read(blkptr_t *bp, void *buf, char *stack) -{ - uint64_t offset, sector; - int psize, lsize; - int i, comp, cksum; - - psize = BP_GET_PSIZE(bp); - lsize = BP_GET_LSIZE(bp); - comp = BP_GET_COMPRESS(bp); - cksum = BP_GET_CHECKSUM(bp); - - if ((unsigned int)comp >= ZIO_COMPRESS_FUNCTIONS || - comp != ZIO_COMPRESS_OFF && decomp_table[comp].decomp_func == NULL) - return (ERR_FSYS_CORRUPT); - - if ((char *)buf < stack && ((char *)buf) + lsize > stack) - return (ERR_FSYS_CORRUPT); - /* pick a good dva from the block pointer */ - for (i = 0; i < SPA_DVAS_PER_BP; i++) { - - if (bp->blk_dva[i].dva_word[0] == 0 && - bp->blk_dva[i].dva_word[1] == 0) - continue; - - /* read in a block */ - offset = DVA_GET_OFFSET(&bp->blk_dva[i]); - sector = DVA_OFFSET_TO_PHYS_SECTOR(offset); - - if (comp != ZIO_COMPRESS_OFF) { - - if (devread(sector, 0, psize, stack) == 0) - continue; - if (zio_checksum_verify(bp, stack, psize) != 0) - continue; - decomp_table[comp].decomp_func(stack, buf, psize, - lsize); - } else { - if (devread(sector, 0, psize, buf) == 0) - continue; - if (zio_checksum_verify(bp, buf, psize) != 0) - continue; - } - return (0); - } - - return (ERR_FSYS_CORRUPT); -} - -/* - * Get the block from a block id. - * push the block onto the stack. - * - * Return: - * 0 - success - * errnum - failure - */ -static int -dmu_read(dnode_phys_t *dn, uint64_t blkid, void *buf, char *stack) -{ - int idx, level; - blkptr_t *bp_array = dn->dn_blkptr; - int epbs = dn->dn_indblkshift - SPA_BLKPTRSHIFT; - blkptr_t *bp, *tmpbuf; - - bp = (blkptr_t *)stack; - stack += sizeof (blkptr_t); - - tmpbuf = (blkptr_t *)stack; - stack += 1<dn_indblkshift; - - for (level = dn->dn_nlevels - 1; level >= 0; level--) { - idx = (blkid >> (epbs * level)) & ((1<dn_datablkszsec << SPA_MINBLOCKSHIFT); - break; - } else if (errnum = zio_read(bp, tmpbuf, stack)) { - return (errnum); - } - - bp_array = tmpbuf; - } - - return (0); -} - -/* - * mzap_lookup: Looks up property described by "name" and returns the value - * in "value". - * - * Return: - * 0 - success - * errnum - failure - */ -static int -mzap_lookup(mzap_phys_t *zapobj, int objsize, char *name, - uint64_t *value) -{ - int i, chunks; - mzap_ent_phys_t *mzap_ent = zapobj->mz_chunk; - - chunks = objsize/MZAP_ENT_LEN - 1; - for (i = 0; i < chunks; i++) { - if (grub_strcmp(mzap_ent[i].mze_name, name) == 0) { - *value = mzap_ent[i].mze_value; - return (0); - } - } - - return (ERR_FSYS_CORRUPT); -} - -static uint64_t -zap_hash(uint64_t salt, const char *name) -{ - static uint64_t table[256]; - const uint8_t *cp; - uint8_t c; - uint64_t crc = salt; - - if (table[128] == 0) { - uint64_t *ct; - int i, j; - for (i = 0; i < 256; i++) { - for (ct = table + i, *ct = i, j = 8; j > 0; j--) - *ct = (*ct >> 1) ^ (-(*ct & 1) & - ZFS_CRC64_POLY); - } - } - - if (crc == 0 || table[128] != ZFS_CRC64_POLY) { - errnum = ERR_FSYS_CORRUPT; - return (0); - } - - for (cp = (const uint8_t *)name; (c = *cp) != '\0'; cp++) - crc = (crc >> 8) ^ table[(crc ^ c) & 0xFF]; - - /* - * Only use 28 bits, since we need 4 bits in the cookie for the - * collision differentiator. We MUST use the high bits, since - * those are the onces that we first pay attention to when - * chosing the bucket. - */ - crc &= ~((1ULL << (64 - ZAP_HASHBITS)) - 1); - - return (crc); -} - -/* - * Only to be used on 8-bit arrays. - * array_len is actual len in bytes (not encoded le_value_length). - * buf is null-terminated. - */ -static int -zap_leaf_array_equal(zap_leaf_phys_t *l, int blksft, int chunk, - int array_len, const char *buf) -{ - int bseen = 0; - - while (bseen < array_len) { - struct zap_leaf_array *la = - &ZAP_LEAF_CHUNK(l, blksft, chunk).l_array; - int toread = MIN(array_len - bseen, ZAP_LEAF_ARRAY_BYTES); - - if (chunk >= ZAP_LEAF_NUMCHUNKS(blksft)) - return (0); - - if (zfs_bcmp(la->la_array, buf + bseen, toread) != 0) - break; - chunk = la->la_next; - bseen += toread; - } - return (bseen == array_len); -} - -/* - * Given a zap_leaf_phys_t, walk thru the zap leaf chunks to get the - * value for the property "name". - * - * Return: - * 0 - success - * errnum - failure - */ -static int -zap_leaf_lookup(zap_leaf_phys_t *l, int blksft, uint64_t h, - const char *name, uint64_t *value) -{ - uint16_t chunk; - struct zap_leaf_entry *le; - - /* Verify if this is a valid leaf block */ - if (l->l_hdr.lh_block_type != ZBT_LEAF) - return (ERR_FSYS_CORRUPT); - if (l->l_hdr.lh_magic != ZAP_LEAF_MAGIC) - return (ERR_FSYS_CORRUPT); - - for (chunk = l->l_hash[LEAF_HASH(blksft, h)]; - chunk != CHAIN_END; chunk = le->le_next) { - - if (chunk >= ZAP_LEAF_NUMCHUNKS(blksft)) - return (ERR_FSYS_CORRUPT); - - le = ZAP_LEAF_ENTRY(l, blksft, chunk); - - /* Verify the chunk entry */ - if (le->le_type != ZAP_CHUNK_ENTRY) - return (ERR_FSYS_CORRUPT); - - if (le->le_hash != h) - continue; - - if (zap_leaf_array_equal(l, blksft, le->le_name_chunk, - le->le_name_length, name)) { - - struct zap_leaf_array *la; - uint8_t *ip; - - if (le->le_int_size != 8 || le->le_value_length != 1) - return (ERR_FSYS_CORRUPT); - - /* get the uint64_t property value */ - la = &ZAP_LEAF_CHUNK(l, blksft, - le->le_value_chunk).l_array; - ip = la->la_array; - - *value = (uint64_t)ip[0] << 56 | (uint64_t)ip[1] << 48 | - (uint64_t)ip[2] << 40 | (uint64_t)ip[3] << 32 | - (uint64_t)ip[4] << 24 | (uint64_t)ip[5] << 16 | - (uint64_t)ip[6] << 8 | (uint64_t)ip[7]; - - return (0); - } - } - - return (ERR_FSYS_CORRUPT); -} - -/* - * Fat ZAP lookup - * - * Return: - * 0 - success - * errnum - failure - */ -static int -fzap_lookup(dnode_phys_t *zap_dnode, zap_phys_t *zap, - char *name, uint64_t *value, char *stack) -{ - zap_leaf_phys_t *l; - uint64_t hash, idx, blkid; - int blksft = zfs_log2(zap_dnode->dn_datablkszsec << DNODE_SHIFT); - - /* Verify if this is a fat zap header block */ - if (zap->zap_magic != (uint64_t)ZAP_MAGIC) - return (ERR_FSYS_CORRUPT); - - hash = zap_hash(zap->zap_salt, name); - if (errnum) - return (errnum); - - /* get block id from index */ - if (zap->zap_ptrtbl.zt_numblks != 0) { - /* external pointer tables not supported */ - return (ERR_FSYS_CORRUPT); - } - idx = ZAP_HASH_IDX(hash, zap->zap_ptrtbl.zt_shift); - blkid = ((uint64_t *)zap)[idx + (1<<(blksft-3-1))]; - - /* Get the leaf block */ - l = (zap_leaf_phys_t *)stack; - stack += 1<dn_datablkszsec << SPA_MINBLOCKSHIFT; - stack += size; - if (errnum = dmu_read(zap_dnode, 0, zapbuf, stack)) - return (errnum); - - block_type = *((uint64_t *)zapbuf); - - if (block_type == ZBT_MICRO) { - return (mzap_lookup(zapbuf, size, name, val)); - } else if (block_type == ZBT_HEADER) { - /* this is a fat zap */ - return (fzap_lookup(zap_dnode, zapbuf, name, - val, stack)); - } - - return (ERR_FSYS_CORRUPT); -} - -/* - * Get the dnode of an object number from the metadnode of an object set. - * - * Input - * mdn - metadnode to get the object dnode - * objnum - object number for the object dnode - * buf - data buffer that holds the returning dnode - * stack - scratch area - * - * Return: - * 0 - success - * errnum - failure - */ -static int -dnode_get(dnode_phys_t *mdn, uint64_t objnum, uint8_t type, dnode_phys_t *buf, - char *stack) -{ - uint64_t blkid, blksz; /* the block id this object dnode is in */ - int epbs; /* shift of number of dnodes in a block */ - int idx; /* index within a block */ - dnode_phys_t *dnbuf; - - blksz = mdn->dn_datablkszsec << SPA_MINBLOCKSHIFT; - epbs = zfs_log2(blksz) - DNODE_SHIFT; - blkid = objnum >> epbs; - idx = objnum & ((1<= dnode_start && objnum < dnode_end) { - grub_memmove(buf, &dnode_buf[idx], DNODE_SIZE); - VERIFY_DN_TYPE(buf, type); - return (0); - } - - if (dnode_buf && blksz == 1< ZPL_VERSION) - return (-1); - - if (errnum = zap_lookup(dn, ZFS_ROOT_OBJ, &objnum, stack)) - return (errnum); - - if (errnum = dnode_get(mdn, objnum, DMU_OT_DIRECTORY_CONTENTS, - dn, stack)) - return (errnum); - - /* skip leading slashes */ - while (*path == '/') - path++; - - while (*path && !isspace(*path)) { - - /* get the next component name */ - cname = path; - while (*path && !isspace(*path) && *path != '/') - path++; - ch = *path; - *path = 0; /* ensure null termination */ - - if (errnum = zap_lookup(dn, cname, &objnum, stack)) - return (errnum); - - objnum = ZFS_DIRENT_OBJ(objnum); - if (errnum = dnode_get(mdn, objnum, 0, dn, stack)) - return (errnum); - - *path = ch; - while (*path == '/') - path++; - } - - /* We found the dnode for this file. Verify if it is a plain file. */ - VERIFY_DN_TYPE(dn, DMU_OT_PLAIN_FILE_CONTENTS); - - return (0); -} - -/* - * Get the default 'bootfs' property value from the rootpool. - * - * Return: - * 0 - success - * errnum -failure - */ -static int -get_default_bootfsobj(dnode_phys_t *mosmdn, uint64_t *obj, char *stack) -{ - uint64_t objnum = 0; - dnode_phys_t *dn = (dnode_phys_t *)stack; - stack += DNODE_SIZE; - - if (errnum = dnode_get(mosmdn, DMU_POOL_DIRECTORY_OBJECT, - DMU_OT_OBJECT_DIRECTORY, dn, stack)) - return (errnum); - - /* - * find the object number for 'pool_props', and get the dnode - * of the 'pool_props'. - */ - if (zap_lookup(dn, DMU_POOL_PROPS, &objnum, stack)) - return (ERR_FILESYSTEM_NOT_FOUND); - - if (errnum = dnode_get(mosmdn, objnum, DMU_OT_POOL_PROPS, dn, stack)) - return (errnum); - - if (zap_lookup(dn, ZPOOL_PROP_BOOTFS, &objnum, stack)) - return (ERR_FILESYSTEM_NOT_FOUND); - - if (!objnum) - return (ERR_FILESYSTEM_NOT_FOUND); - - *obj = objnum; - return (0); -} - -/* - * Given a MOS metadnode, get the metadnode of a given filesystem name (fsname), - * e.g. pool/rootfs, or a given object number (obj), e.g. the object number - * of pool/rootfs. - * - * If no fsname and no obj are given, return the DSL_DIR metadnode. - * If fsname is given, return its metadnode and its matching object number. - * If only obj is given, return the metadnode for this object number. - * - * Return: - * 0 - success - * errnum - failure - */ -static int -get_objset_mdn(dnode_phys_t *mosmdn, char *fsname, uint64_t *obj, - dnode_phys_t *mdn, char *stack) -{ - uint64_t objnum, headobj; - char *cname, ch; - blkptr_t *bp; - objset_phys_t *osp; - int issnapshot = 0; - char *snapname; - - if (fsname == NULL && obj) { - headobj = *obj; - goto skip; - } - - if (errnum = dnode_get(mosmdn, DMU_POOL_DIRECTORY_OBJECT, - DMU_OT_OBJECT_DIRECTORY, mdn, stack)) - return (errnum); - - if (errnum = zap_lookup(mdn, DMU_POOL_ROOT_DATASET, &objnum, - stack)) - return (errnum); - - if (errnum = dnode_get(mosmdn, objnum, DMU_OT_DSL_DIR, mdn, stack)) - return (errnum); - - if (fsname == NULL) { - headobj = - ((dsl_dir_phys_t *)DN_BONUS(mdn))->dd_head_dataset_obj; - goto skip; - } - - /* take out the pool name */ - while (*fsname && !isspace(*fsname) && *fsname != '/') - fsname++; - - while (*fsname && !isspace(*fsname)) { - uint64_t childobj; - - while (*fsname == '/') - fsname++; - - cname = fsname; - while (*fsname && !isspace(*fsname) && *fsname != '/') - fsname++; - ch = *fsname; - *fsname = 0; - - snapname = cname; - while (*snapname && !isspace(*snapname) && *snapname != '@') - snapname++; - if (*snapname == '@') { - issnapshot = 1; - *snapname = 0; - } - childobj = - ((dsl_dir_phys_t *)DN_BONUS(mdn))->dd_child_dir_zapobj; - if (errnum = dnode_get(mosmdn, childobj, - DMU_OT_DSL_DIR_CHILD_MAP, mdn, stack)) - return (errnum); - - if (zap_lookup(mdn, cname, &objnum, stack)) - return (ERR_FILESYSTEM_NOT_FOUND); - - if (errnum = dnode_get(mosmdn, objnum, DMU_OT_DSL_DIR, - mdn, stack)) - return (errnum); - - *fsname = ch; - if (issnapshot) - *snapname = '@'; - } - headobj = ((dsl_dir_phys_t *)DN_BONUS(mdn))->dd_head_dataset_obj; - if (obj) - *obj = headobj; - -skip: - if (errnum = dnode_get(mosmdn, headobj, DMU_OT_DSL_DATASET, mdn, stack)) - return (errnum); - if (issnapshot) { - uint64_t snapobj; - - snapobj = ((dsl_dataset_phys_t *)DN_BONUS(mdn))-> - ds_snapnames_zapobj; - - if (errnum = dnode_get(mosmdn, snapobj, - DMU_OT_DSL_DS_SNAP_MAP, mdn, stack)) - return (errnum); - if (zap_lookup(mdn, snapname + 1, &headobj, stack)) - return (ERR_FILESYSTEM_NOT_FOUND); - if (errnum = dnode_get(mosmdn, headobj, - DMU_OT_DSL_DATASET, mdn, stack)) - return (errnum); - if (obj) - *obj = headobj; - } - - bp = &((dsl_dataset_phys_t *)DN_BONUS(mdn))->ds_bp; - osp = (objset_phys_t *)stack; - stack += sizeof (objset_phys_t); - if (errnum = zio_read(bp, osp, stack)) - return (errnum); - - grub_memmove((char *)mdn, (char *)&osp->os_meta_dnode, DNODE_SIZE); - - return (0); -} - -/* - * For a given XDR packed nvlist, verify the first 4 bytes and move on. - * - * An XDR packed nvlist is encoded as (comments from nvs_xdr_create) : - * - * encoding method/host endian (4 bytes) - * nvl_version (4 bytes) - * nvl_nvflag (4 bytes) - * encoded nvpairs: - * encoded size of the nvpair (4 bytes) - * decoded size of the nvpair (4 bytes) - * name string size (4 bytes) - * name string data (sizeof(NV_ALIGN4(string)) - * data type (4 bytes) - * # of elements in the nvpair (4 bytes) - * data - * 2 zero's for the last nvpair - * (end of the entire list) (8 bytes) - * - * Return: - * 0 - success - * 1 - failure - */ -static int -nvlist_unpack(char *nvlist, char **out) -{ - /* Verify if the 1st and 2nd byte in the nvlist are valid. */ - if (nvlist[0] != NV_ENCODE_XDR || nvlist[1] != HOST_ENDIAN) - return (1); - - nvlist += 4; - *out = nvlist; - return (0); -} - -static char * -nvlist_array(char *nvlist, int index) -{ - int i, encode_size; - - for (i = 0; i < index; i++) { - /* skip the header, nvl_version, and nvl_nvflag */ - nvlist = nvlist + 4 * 2; - - while (encode_size = BSWAP_32(*(uint32_t *)nvlist)) - nvlist += encode_size; /* goto the next nvpair */ - - nvlist = nvlist + 4 * 2; /* skip the ending 2 zeros - 8 bytes */ - } - - return (nvlist); -} - -static int -nvlist_lookup_value(char *nvlist, char *name, void *val, int valtype, - int *nelmp) -{ - int name_len, type, slen, encode_size; - char *nvpair, *nvp_name, *strval = val; - uint64_t *intval = val; - - /* skip the header, nvl_version, and nvl_nvflag */ - nvlist = nvlist + 4 * 2; - - /* - * Loop thru the nvpair list - * The XDR representation of an integer is in big-endian byte order. - */ - while (encode_size = BSWAP_32(*(uint32_t *)nvlist)) { - - nvpair = nvlist + 4 * 2; /* skip the encode/decode size */ - - name_len = BSWAP_32(*(uint32_t *)nvpair); - nvpair += 4; - - nvp_name = nvpair; - nvpair = nvpair + ((name_len + 3) & ~3); /* align */ - - type = BSWAP_32(*(uint32_t *)nvpair); - nvpair += 4; - - if ((grub_strncmp(nvp_name, name, name_len) == 0) && - type == valtype) { - int nelm; - - if ((nelm = BSWAP_32(*(uint32_t *)nvpair)) < 1) - return (1); - nvpair += 4; - - switch (valtype) { - case DATA_TYPE_STRING: - slen = BSWAP_32(*(uint32_t *)nvpair); - nvpair += 4; - grub_memmove(strval, nvpair, slen); - strval[slen] = '\0'; - return (0); - - case DATA_TYPE_UINT64: - *intval = BSWAP_64(*(uint64_t *)nvpair); - return (0); - - case DATA_TYPE_NVLIST: - *(void **)val = (void *)nvpair; - return (0); - - case DATA_TYPE_NVLIST_ARRAY: - *(void **)val = (void *)nvpair; - if (nelmp) - *nelmp = nelm; - return (0); - } - } - - nvlist += encode_size; /* goto the next nvpair */ - } - - return (1); -} - -/* - * Check if this vdev is online and is in a good state. - */ -static int -vdev_validate(char *nv) -{ - uint64_t ival; - - if (nvlist_lookup_value(nv, ZPOOL_CONFIG_OFFLINE, &ival, - DATA_TYPE_UINT64, NULL) == 0 || - nvlist_lookup_value(nv, ZPOOL_CONFIG_FAULTED, &ival, - DATA_TYPE_UINT64, NULL) == 0 || - nvlist_lookup_value(nv, ZPOOL_CONFIG_REMOVED, &ival, - DATA_TYPE_UINT64, NULL) == 0) - return (ERR_DEV_VALUES); - - return (0); -} - -/* - * Get a list of valid vdev pathname from the boot device. - * The caller should already allocate MAXNAMELEN memory for bootpath. - */ -int -vdev_get_bootpath(char *nv, uint64_t inguid, char *devid, char *bootpath) -{ - char type[16]; - - bootpath[0] = '\0'; - if (nvlist_lookup_value(nv, ZPOOL_CONFIG_TYPE, &type, DATA_TYPE_STRING, - NULL)) - return (ERR_FSYS_CORRUPT); - - if (strcmp(type, VDEV_TYPE_DISK) == 0) { - if (vdev_validate(nv) != 0 || - (nvlist_lookup_value(nv, ZPOOL_CONFIG_PHYS_PATH, - bootpath, DATA_TYPE_STRING, NULL) != 0) || - (nvlist_lookup_value(nv, ZPOOL_CONFIG_DEVID, - devid, DATA_TYPE_STRING, NULL) != 0)) - return (ERR_NO_BOOTPATH); - - } else if (strcmp(type, VDEV_TYPE_MIRROR) == 0) { - int nelm, i; - char *child; - - if (nvlist_lookup_value(nv, ZPOOL_CONFIG_CHILDREN, &child, - DATA_TYPE_NVLIST_ARRAY, &nelm)) - return (ERR_FSYS_CORRUPT); - - for (i = 0; i < nelm; i++) { - char tmp_path[MAXNAMELEN]; - char tmp_devid[MAXNAMELEN]; - char *child_i; - uint64_t guid; - - child_i = nvlist_array(child, i); - if (vdev_validate(child_i) != 0) - continue; - - if (nvlist_lookup_value(child_i, ZPOOL_CONFIG_PHYS_PATH, - tmp_path, DATA_TYPE_STRING, NULL) != 0) - return (ERR_NO_BOOTPATH); - - if ((strlen(bootpath) + strlen(tmp_path)) > MAXNAMELEN) - return (ERR_WONT_FIT); - - if (nvlist_lookup_value(child_i, ZPOOL_CONFIG_GUID, - &guid, DATA_TYPE_UINT64, NULL) != 0) - return (ERR_NO_BOOTPATH); - if (nvlist_lookup_value(child_i, ZPOOL_CONFIG_DEVID, - tmp_devid, DATA_TYPE_STRING, NULL) != 0) - return (ERR_NO_BOOTPATH); - if (guid == inguid) { - sprintf(devid, "%s", tmp_devid); - sprintf(bootpath, "%s", tmp_path); - break; - } - } - } - - return (strlen(bootpath) > 0 ? 0 : ERR_NO_BOOTPATH); -} - -/* - * Check the disk label information and retrieve needed vdev name-value pairs. - * - * Return: - * 0 - success - * ERR_* - failure - */ -int -check_pool_label(int label, char *stack, char *outdevid, char *outpath) -{ - vdev_phys_t *vdev; - uint64_t sector, pool_state, txg = 0; - char *nvlist, *nv; - uint64_t diskguid; - uint64_t version; - - sector = (label * sizeof (vdev_label_t) + VDEV_SKIP_SIZE + - VDEV_BOOT_HEADER_SIZE) >> SPA_MINBLOCKSHIFT; - - /* Read in the vdev name-value pair list (112K). */ - if (devread(sector, 0, VDEV_PHYS_SIZE, stack) == 0) - return (ERR_READ); - - vdev = (vdev_phys_t *)stack; - stack += sizeof (vdev_phys_t); - - if (nvlist_unpack(vdev->vp_nvlist, &nvlist)) - return (ERR_FSYS_CORRUPT); - - if (nvlist_lookup_value(nvlist, ZPOOL_CONFIG_POOL_STATE, &pool_state, - DATA_TYPE_UINT64, NULL)) - return (ERR_FSYS_CORRUPT); - - if (pool_state == POOL_STATE_DESTROYED) - return (ERR_FILESYSTEM_NOT_FOUND); - - if (nvlist_lookup_value(nvlist, ZPOOL_CONFIG_POOL_NAME, - current_rootpool, DATA_TYPE_STRING, NULL)) - return (ERR_FSYS_CORRUPT); - - if (nvlist_lookup_value(nvlist, ZPOOL_CONFIG_POOL_TXG, &txg, - DATA_TYPE_UINT64, NULL)) - return (ERR_FSYS_CORRUPT); - - /* not an active device */ - if (txg == 0) - return (ERR_NO_BOOTPATH); - - if (nvlist_lookup_value(nvlist, ZPOOL_CONFIG_VERSION, &version, - DATA_TYPE_UINT64, NULL)) - return (ERR_FSYS_CORRUPT); - if (version > SPA_VERSION) - return (ERR_NEWER_VERSION); - if (nvlist_lookup_value(nvlist, ZPOOL_CONFIG_VDEV_TREE, &nv, - DATA_TYPE_NVLIST, NULL)) - return (ERR_FSYS_CORRUPT); - if (nvlist_lookup_value(nvlist, ZPOOL_CONFIG_GUID, &diskguid, - DATA_TYPE_UINT64, NULL)) - return (ERR_FSYS_CORRUPT); - if (vdev_get_bootpath(nv, diskguid, outdevid, outpath)) - return (ERR_NO_BOOTPATH); - return (0); -} - -/* - * zfs_mount() locates a valid uberblock of the root pool and read in its MOS - * to the memory address MOS. - * - * Return: - * 1 - success - * 0 - failure - */ -int -zfs_mount(void) -{ - char *stack; - int label = 0; - uberblock_phys_t *ub_array, *ubbest = NULL; - vdev_boot_header_t *bh; - objset_phys_t *osp; - char tmp_bootpath[MAXNAMELEN]; - char tmp_devid[MAXNAMELEN]; - - /* if it's our first time here, zero the best uberblock out */ - if (best_drive == 0 && best_part == 0 && find_best_root) - grub_memset(¤t_uberblock, 0, sizeof (uberblock_t)); - - stackbase = ZFS_SCRATCH; - stack = stackbase; - ub_array = (uberblock_phys_t *)stack; - stack += VDEV_UBERBLOCK_RING; - - bh = (vdev_boot_header_t *)stack; - stack += VDEV_BOOT_HEADER_SIZE; - - osp = (objset_phys_t *)stack; - stack += sizeof (objset_phys_t); - - /* XXX add back labels support? */ - for (label = 0; ubbest == NULL && label < (VDEV_LABELS/2); label++) { - uint64_t sector = (label * sizeof (vdev_label_t) + - VDEV_SKIP_SIZE) >> SPA_MINBLOCKSHIFT; - if (devread(sector, 0, VDEV_BOOT_HEADER_SIZE, - (char *)bh) == 0) - continue; - if ((bh->vb_magic != VDEV_BOOT_MAGIC) || - (bh->vb_version != VDEV_BOOT_VERSION)) { - continue; - } - sector += (VDEV_BOOT_HEADER_SIZE + - VDEV_PHYS_SIZE) >> SPA_MINBLOCKSHIFT; - - /* Read in the uberblock ring (128K). */ - if (devread(sector, 0, VDEV_UBERBLOCK_RING, - (char *)ub_array) == 0) - continue; - - if ((ubbest = find_bestub(ub_array, label)) != NULL && - zio_read(&ubbest->ubp_uberblock.ub_rootbp, osp, stack) - == 0) { - - VERIFY_OS_TYPE(osp, DMU_OST_META); - - if (check_pool_label(label, stack, tmp_devid, - tmp_bootpath)) - return (0); - - if (find_best_root && - vdev_uberblock_compare(&ubbest->ubp_uberblock, - &(current_uberblock)) <= 0) - continue; - /* Got the MOS. Save it at the memory addr MOS. */ - grub_memmove(MOS, &osp->os_meta_dnode, DNODE_SIZE); - grub_memmove(¤t_uberblock, - &ubbest->ubp_uberblock, - sizeof (uberblock_t)); - grub_memmove(current_bootpath, tmp_bootpath, - MAXNAMELEN); - grub_memmove(current_devid, tmp_devid, - grub_strlen(tmp_devid)); - is_zfs_mount = 1; - return (1); - } - } - - return (0); -} - -/* - * zfs_open() locates a file in the rootpool by following the - * MOS and places the dnode of the file in the memory address DNODE. - * - * Return: - * 1 - success - * 0 - failure - */ -int -zfs_open(char *filename) -{ - char *stack; - dnode_phys_t *mdn; - - file_buf = NULL; - stackbase = ZFS_SCRATCH; - stack = stackbase; - - mdn = (dnode_phys_t *)stack; - stack += sizeof (dnode_phys_t); - - dnode_mdn = NULL; - dnode_buf = (dnode_phys_t *)stack; - stack += 1<zp_size; - filepos = 0; - - dnode_buf = NULL; - return (1); -} - -/* - * zfs_read reads in the data blocks pointed by the DNODE. - * - * Return: - * len - the length successfully read in to the buffer - * 0 - failure - */ -int -zfs_read(char *buf, int len) -{ - char *stack; - char *tmpbuf; - int blksz, length, movesize; - - if (file_buf == NULL) { - file_buf = stackbase; - stackbase += SPA_MAXBLOCKSIZE; - file_start = file_end = 0; - } - stack = stackbase; - - /* - * If offset is in memory, move it into the buffer provided and return. - */ - if (filepos >= file_start && filepos+len <= file_end) { - grub_memmove(buf, file_buf + filepos - file_start, len); - filepos += len; - return (len); - } - - blksz = DNODE->dn_datablkszsec << SPA_MINBLOCKSHIFT; - - /* - * Entire Dnode is too big to fit into the space available. We - * will need to read it in chunks. This could be optimized to - * read in as large a chunk as there is space available, but for - * now, this only reads in one data block at a time. - */ - length = len; - while (length) { - /* - * Find requested blkid and the offset within that block. - */ - uint64_t blkid = filepos / blksz; - - if (errnum = dmu_read(DNODE, blkid, file_buf, stack)) - return (0); - - file_start = blkid * blksz; - file_end = file_start + blksz; - - movesize = MIN(length, file_end - filepos); - - grub_memmove(buf, file_buf + filepos - file_start, - movesize); - buf += movesize; - length -= movesize; - filepos += movesize; - } - - return (len); -} - -/* - * No-Op - */ -int -zfs_embed(int *start_sector, int needed_sectors) -{ - return (1); -} - -#endif /* FSYS_ZFS */ diff --git a/usr/src/grub/grub-0.95/stage2/fsys_zfs.h b/usr/src/grub/grub-0.95/stage2/fsys_zfs.h deleted file mode 100644 index 80d7e16890..0000000000 --- a/usr/src/grub/grub-0.95/stage2/fsys_zfs.h +++ /dev/null @@ -1,194 +0,0 @@ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, 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 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. - */ -/* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ -#ifndef _FSYS_ZFS_H -#define _FSYS_ZFS_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef FSYS_ZFS - -typedef unsigned long long uint64_t; -typedef unsigned int uint32_t; -typedef unsigned short uint16_t; -typedef unsigned char uint8_t; -typedef unsigned char uchar_t; - -#if defined(_LP64) || defined(_I32LPx) -typedef unsigned long size_t; -#else -typedef unsigned int size_t; -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* - * Global Memory addresses to store MOS and DNODE data - */ -#define MOS ((dnode_phys_t *)\ - (RAW_ADDR((mbi.mem_upper << 10) + 0x100000) - ZFS_SCRATCH_SIZE)) -#define DNODE (MOS+1) /* move sizeof(dnode_phys_t) bytes */ -#define ZFS_SCRATCH ((char *)(DNODE+1)) - -/* - * Verify dnode type. - * Can only be used in functions returning non-0 for failure. - */ -#define VERIFY_DN_TYPE(dnp, type) \ - if (type && (dnp)->dn_type != type) { \ - return (ERR_FSYS_CORRUPT); \ - } - -/* - * Verify object set type. - * Can only be used in functions returning 0 for failure. - */ -#define VERIFY_OS_TYPE(osp, type) \ - if (type && (osp)->os_type != type) { \ - errnum = ERR_FSYS_CORRUPT; \ - return (0); \ - } - -#define ZPOOL_PROP_BOOTFS "bootfs" - -/* General macros */ -#define BSWAP_8(x) ((x) & 0xff) -#define BSWAP_16(x) ((BSWAP_8(x) << 8) | BSWAP_8((x) >> 8)) -#define BSWAP_32(x) ((BSWAP_16(x) << 16) | BSWAP_16((x) >> 16)) -#define BSWAP_64(x) ((BSWAP_32(x) << 32) | BSWAP_32((x) >> 32)) -#define P2ROUNDUP(x, align) (-(-(x) & -(align))) - -/* - * XXX Match these macro up with real zfs once we have nvlist support so that we - * can support large sector disks. - */ -#define UBERBLOCK_SIZE (1ULL << UBERBLOCK_SHIFT) -#undef offsetof -#define offsetof(t, m) ((int)&(((t *)0)->m)) -#define VDEV_UBERBLOCK_SHIFT UBERBLOCK_SHIFT -#define VDEV_UBERBLOCK_OFFSET(n) \ -offsetof(vdev_label_t, vl_uberblock[(n) << VDEV_UBERBLOCK_SHIFT]) - -typedef struct uberblock uberblock_t; - -/* XXX Uberblock_phys_t is no longer in the kernel zfs */ -typedef struct uberblock_phys { - uberblock_t ubp_uberblock; - char ubp_pad[UBERBLOCK_SIZE - sizeof (uberblock_t) - - sizeof (zio_block_tail_t)]; - zio_block_tail_t ubp_zbt; -} uberblock_phys_t; - -/* - * Macros to get fields in a bp or DVA. - */ -#define P2PHASE(x, align) ((x) & ((align) - 1)) -#define DVA_OFFSET_TO_PHYS_SECTOR(offset) \ - ((offset + VDEV_LABEL_START_SIZE) >> SPA_MINBLOCKSHIFT) - -/* - * For nvlist manipulation. (from nvpair.h) - */ -#define NV_ENCODE_NATIVE 0 -#define NV_ENCODE_XDR 1 -#define HOST_ENDIAN 1 /* for x86 machine */ -#define DATA_TYPE_UINT64 8 -#define DATA_TYPE_STRING 9 -#define DATA_TYPE_NVLIST 19 -#define DATA_TYPE_NVLIST_ARRAY 20 - -/* - * Decompression Entry - lzjb - */ -#ifndef NBBY -#define NBBY 8 -#endif - -typedef int zfs_decomp_func_t(void *s_start, void *d_start, size_t s_len, - size_t d_len); -typedef struct decomp_entry { - char *name; - zfs_decomp_func_t *decomp_func; -} decomp_entry_t; - -/* - * FAT ZAP data structures - */ -#define ZFS_CRC64_POLY 0xC96C5795D7870F42ULL /* ECMA-182, reflected form */ -#define ZAP_HASH_IDX(hash, n) (((n) == 0) ? 0 : ((hash) >> (64 - (n)))) -#define CHAIN_END 0xffff /* end of the chunk chain */ - -/* - * The amount of space within the chunk available for the array is: - * chunk size - space for type (1) - space for next pointer (2) - */ -#define ZAP_LEAF_ARRAY_BYTES (ZAP_LEAF_CHUNKSIZE - 3) - -#define ZAP_LEAF_HASH_SHIFT(bs) (bs - 5) -#define ZAP_LEAF_HASH_NUMENTRIES(bs) (1 << ZAP_LEAF_HASH_SHIFT(bs)) -#define LEAF_HASH(bs, h) \ - ((ZAP_LEAF_HASH_NUMENTRIES(bs)-1) & \ - ((h) >> (64 - ZAP_LEAF_HASH_SHIFT(bs)-l->l_hdr.lh_prefix_len))) - -/* - * The amount of space available for chunks is: - * block size shift - hash entry size (2) * number of hash - * entries - header space (2*chunksize) - */ -#define ZAP_LEAF_NUMCHUNKS(bs) \ - (((1<l_hash + ZAP_LEAF_HASH_NUMENTRIES(bs)))[idx] -#define ZAP_LEAF_ENTRY(l, bs, idx) (&ZAP_LEAF_CHUNK(l, bs, idx).l_entry) - -extern void fletcher_2_native(const void *, uint64_t, zio_cksum_t *); -extern void fletcher_2_byteswap(const void *, uint64_t, zio_cksum_t *); -extern void fletcher_4_native(const void *, uint64_t, zio_cksum_t *); -extern void fletcher_4_byteswap(const void *, uint64_t, zio_cksum_t *); -extern void zio_checksum_SHA256(const void *, uint64_t, zio_cksum_t *); -extern int lzjb_decompress(void *, void *, size_t, size_t); - -#endif /* FSYS_ZFS */ - -#endif /* !_FSYS_ZFS_H */ diff --git a/usr/src/grub/grub-0.95/stage2/graphics.c b/usr/src/grub/grub-0.95/stage2/graphics.c deleted file mode 100644 index be4a71e0d8..0000000000 --- a/usr/src/grub/grub-0.95/stage2/graphics.c +++ /dev/null @@ -1,552 +0,0 @@ -/* graphics.c - graphics mode support for GRUB */ -/* Implemented as a terminal type by Jeremy Katz based - * on a patch by Paulo César Pereira de Andrade - */ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 2001,2002 Red Hat, Inc. - * Portions copyright (C) 2000 Conectiva, 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 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. - */ - - - -#ifdef SUPPORT_GRAPHICS - -#include -#include -#include - -int saved_videomode; -unsigned char *font8x16; - -int graphics_inited = 0; -static char splashimage[64]; - -#define VSHADOW VSHADOW1 -unsigned char VSHADOW1[38400]; -unsigned char VSHADOW2[38400]; -unsigned char VSHADOW4[38400]; -unsigned char VSHADOW8[38400]; - -/* constants to define the viewable area */ -const int x0 = 0; -const int x1 = 80; -const int y0 = 0; -const int y1 = 30; - -/* text buffer has to be kept around so that we can write things as we - * scroll and the like */ -unsigned short text[80 * 30]; - -/* why do these have to be kept here? */ -int foreground = (63 << 16) | (63 << 8) | (63), background = 0, border = 0; - -/* current position */ -static int fontx = 0; -static int fonty = 0; - -/* global state so that we don't try to recursively scroll or cursor */ -static int no_scroll = 0; - -/* color state */ -static int graphics_standard_color = A_NORMAL; -static int graphics_normal_color = A_NORMAL; -static int graphics_highlight_color = A_REVERSE; -static int graphics_current_color = A_NORMAL; -static color_state graphics_color_state = COLOR_STATE_STANDARD; - - -/* graphics local functions */ -static void graphics_setxy(int col, int row); -static void graphics_scroll(); - -/* FIXME: where do these really belong? */ -static inline void outb(unsigned short port, unsigned char val) -{ - __asm __volatile ("outb %0,%1"::"a" (val), "d" (port)); -} - -static void MapMask(int value) { - outb(0x3c4, 2); - outb(0x3c5, value); -} - -/* bit mask register */ -static void BitMask(int value) { - outb(0x3ce, 8); - outb(0x3cf, value); -} - - - -/* Set the splash image */ -void graphics_set_splash(char *splashfile) { - grub_strcpy(splashimage, splashfile); -} - -/* Get the current splash image */ -char *graphics_get_splash(void) { - return splashimage; -} - -/* Initialize a vga16 graphics display with the palette based off of - * the image in splashimage. If the image doesn't exist, leave graphics - * mode. */ -int graphics_init() -{ - if (!graphics_inited) { - saved_videomode = set_videomode(0x12); - } - - if (!read_image(splashimage)) { - set_videomode(saved_videomode); - grub_printf("failed to read image\n"); - return 0; - } - - font8x16 = (unsigned char*)graphics_get_font(); - - graphics_inited = 1; - - /* make sure that the highlight color is set correctly */ - graphics_highlight_color = ((graphics_normal_color >> 4) | - ((graphics_normal_color & 0xf) << 4)); - - return 1; -} - -/* Leave graphics mode */ -void graphics_end(void) -{ - if (graphics_inited) { - set_videomode(saved_videomode); - graphics_inited = 0; - } -} - -/* Print ch on the screen. Handle any needed scrolling or the like */ -void graphics_putchar(int ch) { - ch &= 0xff; - - graphics_cursor(0); - - if (ch == '\n') { - if (fonty + 1 < y1) - graphics_setxy(fontx, fonty + 1); - else - graphics_scroll(); - graphics_cursor(1); - return; - } else if (ch == '\r') { - graphics_setxy(x0, fonty); - graphics_cursor(1); - return; - } - - graphics_cursor(0); - - text[fonty * 80 + fontx] = ch; - text[fonty * 80 + fontx] &= 0x00ff; - if (graphics_current_color & 0xf0) - text[fonty * 80 + fontx] |= 0x100; - - graphics_cursor(0); - - if ((fontx + 1) >= x1) { - graphics_setxy(x0, fonty); - if (fonty + 1 < y1) - graphics_setxy(x0, fonty + 1); - else - graphics_scroll(); - } else { - graphics_setxy(fontx + 1, fonty); - } - - graphics_cursor(1); -} - -/* get the current location of the cursor */ -int graphics_getxy(void) { - return (fontx << 8) | fonty; -} - -void graphics_gotoxy(int x, int y) { - graphics_cursor(0); - - graphics_setxy(x, y); - - graphics_cursor(1); -} - -void graphics_cls(void) { - int i; - unsigned char *mem, *s1, *s2, *s4, *s8; - - graphics_cursor(0); - graphics_gotoxy(x0, y0); - - mem = (unsigned char*)VIDEOMEM; - s1 = (unsigned char*)VSHADOW1; - s2 = (unsigned char*)VSHADOW2; - s4 = (unsigned char*)VSHADOW4; - s8 = (unsigned char*)VSHADOW8; - - for (i = 0; i < 80 * 30; i++) - text[i] = ' '; - graphics_cursor(1); - - BitMask(0xff); - - /* plano 1 */ - MapMask(1); - grub_memcpy(mem, s1, 38400); - - /* plano 2 */ - MapMask(2); - grub_memcpy(mem, s2, 38400); - - /* plano 3 */ - MapMask(4); - grub_memcpy(mem, s4, 38400); - - /* plano 4 */ - MapMask(8); - grub_memcpy(mem, s8, 38400); - - MapMask(15); - -} - -void graphics_setcolorstate (color_state state) { - switch (state) { - case COLOR_STATE_STANDARD: - graphics_current_color = graphics_standard_color; - break; - case COLOR_STATE_NORMAL: - graphics_current_color = graphics_normal_color; - break; - case COLOR_STATE_HIGHLIGHT: - graphics_current_color = graphics_highlight_color; - break; - default: - graphics_current_color = graphics_standard_color; - break; - } - - graphics_color_state = state; -} - -void graphics_setcolor (int normal_color, int highlight_color) { - graphics_normal_color = normal_color; - graphics_highlight_color = highlight_color; - - graphics_setcolorstate (graphics_color_state); -} - -int graphics_setcursor (int on) { - /* FIXME: we don't have a cursor in graphics */ - return 1; -} - -/* Read in the splashscreen image and set the palette up appropriately. - * Format of splashscreen is an xpm (can be gzipped) with 16 colors and - * 640x480. */ -int read_image(char *s) -{ - char buf[32], pal[16]; - unsigned char c, base, mask, *s1, *s2, *s4, *s8; - unsigned i, len, idx, colors, x, y, width, height; - - if (!grub_open(s)) - return 0; - - /* read header */ - if (!grub_read((char*)&buf, 10) || grub_memcmp(buf, "/* XPM */\n", 10)) { - grub_close(); - return 0; - } - - /* parse info */ - while (grub_read(&c, 1)) { - if (c == '"') - break; - } - - while (grub_read(&c, 1) && (c == ' ' || c == '\t')) - ; - - i = 0; - width = c - '0'; - while (grub_read(&c, 1)) { - if (c >= '0' && c <= '9') - width = width * 10 + c - '0'; - else - break; - } - while (grub_read(&c, 1) && (c == ' ' || c == '\t')) - ; - - height = c - '0'; - while (grub_read(&c, 1)) { - if (c >= '0' && c <= '9') - height = height * 10 + c - '0'; - else - break; - } - while (grub_read(&c, 1) && (c == ' ' || c == '\t')) - ; - - colors = c - '0'; - while (grub_read(&c, 1)) { - if (c >= '0' && c <= '9') - colors = colors * 10 + c - '0'; - else - break; - } - - base = 0; - while (grub_read(&c, 1) && c != '"') - ; - - /* palette */ - for (i = 0, idx = 1; i < colors; i++) { - len = 0; - - while (grub_read(&c, 1) && c != '"') - ; - grub_read(&c, 1); /* char */ - base = c; - grub_read(buf, 4); /* \t c # */ - - while (grub_read(&c, 1) && c != '"') { - if (len < sizeof(buf)) - buf[len++] = c; - } - - if (len == 6 && idx < 15) { - int r = ((hex(buf[0]) << 4) | hex(buf[1])) >> 2; - int g = ((hex(buf[2]) << 4) | hex(buf[3])) >> 2; - int b = ((hex(buf[4]) << 4) | hex(buf[5])) >> 2; - - pal[idx] = base; - graphics_set_palette(idx, r, g, b); - ++idx; - } - } - - x = y = len = 0; - - s1 = (unsigned char*)VSHADOW1; - s2 = (unsigned char*)VSHADOW2; - s4 = (unsigned char*)VSHADOW4; - s8 = (unsigned char*)VSHADOW8; - - for (i = 0; i < 38400; i++) - s1[i] = s2[i] = s4[i] = s8[i] = 0; - - /* parse xpm data */ - while (y < height) { - while (1) { - if (!grub_read(&c, 1)) { - grub_close(); - return 0; - } - if (c == '"') - break; - } - - while (grub_read(&c, 1) && c != '"') { - for (i = 1; i < 15; i++) - if (pal[i] == c) { - c = i; - break; - } - - mask = 0x80 >> (x & 7); - if (c & 1) - s1[len + (x >> 3)] |= mask; - if (c & 2) - s2[len + (x >> 3)] |= mask; - if (c & 4) - s4[len + (x >> 3)] |= mask; - if (c & 8) - s8[len + (x >> 3)] |= mask; - - if (++x >= 640) { - x = 0; - - if (y < 480) - len += 80; - ++y; - } - } - } - - grub_close(); - - graphics_set_palette(0, (background >> 16), (background >> 8) & 63, - background & 63); - graphics_set_palette(15, (foreground >> 16), (foreground >> 8) & 63, - foreground & 63); - graphics_set_palette(0x11, (border >> 16), (border >> 8) & 63, - border & 63); - - return 1; -} - - -/* Convert a character which is a hex digit to the appropriate integer */ -int hex(int v) -{ - if (v >= 'A' && v <= 'F') - return (v - 'A' + 10); - if (v >= 'a' && v <= 'f') - return (v - 'a' + 10); - return (v - '0'); -} - - -/* move the graphics cursor location to col, row */ -static void graphics_setxy(int col, int row) { - if (col >= x0 && col < x1) { - fontx = col; - cursorX = col << 3; - } - if (row >= y0 && row < y1) { - fonty = row; - cursorY = row << 4; - } -} - -/* scroll the screen */ -static void graphics_scroll() { - int i, j; - - /* we don't want to scroll recursively... that would be bad */ - if (no_scroll) - return; - no_scroll = 1; - - /* move everything up a line */ - for (j = y0 + 1; j < y1; j++) { - graphics_gotoxy(x0, j - 1); - for (i = x0; i < x1; i++) { - graphics_putchar(text[j * 80 + i]); - } - } - - /* last line should be blank */ - graphics_gotoxy(x0, y1 - 1); - for (i = x0; i < x1; i++) - graphics_putchar(' '); - graphics_setxy(x0, y1 - 1); - - no_scroll = 0; -} - - -void graphics_cursor(int set) { - unsigned char *pat, *mem, *ptr, chr[16 << 2]; - int i, ch, invert, offset; - - if (set && no_scroll) - return; - - offset = cursorY * 80 + fontx; - ch = text[fonty * 80 + fontx] & 0xff; - invert = (text[fonty * 80 + fontx] & 0xff00) != 0; - pat = font8x16 + (ch << 4); - - mem = (unsigned char*)VIDEOMEM + offset; - - if (!set) { - for (i = 0; i < 16; i++) { - unsigned char mask = pat[i]; - - if (!invert) { - chr[i ] = ((unsigned char*)VSHADOW1)[offset]; - chr[16 + i] = ((unsigned char*)VSHADOW2)[offset]; - chr[32 + i] = ((unsigned char*)VSHADOW4)[offset]; - chr[48 + i] = ((unsigned char*)VSHADOW8)[offset]; - - /* FIXME: if (shade) */ - if (1) { - if (ch == DISP_VERT || ch == DISP_LL || - ch == DISP_UR || ch == DISP_LR) { - unsigned char pmask = ~(pat[i] >> 1); - - chr[i ] &= pmask; - chr[16 + i] &= pmask; - chr[32 + i] &= pmask; - chr[48 + i] &= pmask; - } - if (i > 0 && ch != DISP_VERT) { - unsigned char pmask = ~(pat[i - 1] >> 1); - - chr[i ] &= pmask; - chr[16 + i] &= pmask; - chr[32 + i] &= pmask; - chr[48 + i] &= pmask; - if (ch == DISP_HORIZ || ch == DISP_UR || ch == DISP_LR) { - pmask = ~pat[i - 1]; - - chr[i ] &= pmask; - chr[16 + i] &= pmask; - chr[32 + i] &= pmask; - chr[48 + i] &= pmask; - } - } - } - chr[i ] |= mask; - chr[16 + i] |= mask; - chr[32 + i] |= mask; - chr[48 + i] |= mask; - - offset += 80; - } - else { - chr[i ] = mask; - chr[16 + i] = mask; - chr[32 + i] = mask; - chr[48 + i] = mask; - } - } - } - else { - MapMask(15); - ptr = mem; - for (i = 0; i < 16; i++, ptr += 80) { - cursorBuf[i] = pat[i]; - *ptr = ~pat[i]; - } - return; - } - - offset = 0; - for (i = 1; i < 16; i <<= 1, offset += 16) { - int j; - - MapMask(i); - ptr = mem; - for (j = 0; j < 16; j++, ptr += 80) - *ptr = chr[j + offset]; - } - - MapMask(15); -} - -#endif /* SUPPORT_GRAPHICS */ diff --git a/usr/src/grub/grub-0.95/stage2/graphics.h b/usr/src/grub/grub-0.95/stage2/graphics.h deleted file mode 100644 index a4cd9e8b59..0000000000 --- a/usr/src/grub/grub-0.95/stage2/graphics.h +++ /dev/null @@ -1,42 +0,0 @@ -/* graphics.h - graphics console interface */ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 2002 Free Software Foundation, 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 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 GRAPHICS_H -#define GRAPHICS_H - -/* magic constant */ -#define VIDEOMEM 0xA0000 - -/* function prototypes */ -char *graphics_get_splash(void); - -int read_image(char *s); -void graphics_cursor(int set); - -/* function prototypes for asm functions */ -void * graphics_get_font(); -void graphics_set_palette(int idx, int red, int green, int blue); -void set_int1c_handler(); -void unset_int1c_handler(); - -extern short cursorX, cursorY; -extern char cursorBuf[16]; - -#endif /* GRAPHICS_H */ diff --git a/usr/src/grub/grub-0.95/stage2/gunzip.c b/usr/src/grub/grub-0.95/stage2/gunzip.c deleted file mode 100644 index 4a905a77c1..0000000000 --- a/usr/src/grub/grub-0.95/stage2/gunzip.c +++ /dev/null @@ -1,1362 +0,0 @@ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 1999 Free Software Foundation, 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 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. - */ - -/* - * Most of this file was originally the source file "inflate.c", written - * by Mark Adler. It has been very heavily modified. In particular, the - * original would run through the whole file at once, and this version can - * be stopped and restarted on any boundary during the decompression process. - * - * The license and header comments that file are included here. - */ - -/* inflate.c -- Not copyrighted 1992 by Mark Adler - version c10p1, 10 January 1993 */ - -/* You can do whatever you like with this source file, though I would - prefer that if you modify it and redistribute it that you include - comments to that effect with your name and the date. Thank you. - */ - -/* - Inflate deflated (PKZIP's method 8 compressed) data. The compression - method searches for as much of the current string of bytes (up to a - length of 258) in the previous 32K bytes. If it doesn't find any - matches (of at least length 3), it codes the next byte. Otherwise, it - codes the length of the matched string and its distance backwards from - the current position. There is a single Huffman code that codes both - single bytes (called "literals") and match lengths. A second Huffman - code codes the distance information, which follows a length code. Each - length or distance code actually represents a base value and a number - of "extra" (sometimes zero) bits to get to add to the base value. At - the end of each deflated block is a special end-of-block (EOB) literal/ - length code. The decoding process is basically: get a literal/length - code; if EOB then done; if a literal, emit the decoded byte; if a - length then get the distance and emit the referred-to bytes from the - sliding window of previously emitted data. - - There are (currently) three kinds of inflate blocks: stored, fixed, and - dynamic. The compressor deals with some chunk of data at a time, and - decides which method to use on a chunk-by-chunk basis. A chunk might - typically be 32K or 64K. If the chunk is uncompressible, then the - "stored" method is used. In this case, the bytes are simply stored as - is, eight bits per byte, with none of the above coding. The bytes are - preceded by a count, since there is no longer an EOB code. - - If the data is compressible, then either the fixed or dynamic methods - are used. In the dynamic method, the compressed data is preceded by - an encoding of the literal/length and distance Huffman codes that are - to be used to decode this block. The representation is itself Huffman - coded, and so is preceded by a description of that code. These code - descriptions take up a little space, and so for small blocks, there is - a predefined set of codes, called the fixed codes. The fixed method is - used if the block codes up smaller that way (usually for quite small - chunks), otherwise the dynamic method is used. In the latter case, the - codes are customized to the probabilities in the current block, and so - can code it much better than the pre-determined fixed codes. - - The Huffman codes themselves are decoded using a mutli-level table - lookup, in order to maximize the speed of decoding plus the speed of - building the decoding tables. See the comments below that precede the - lbits and dbits tuning parameters. - */ - - -/* - 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. Similarly, 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. - */ - -#ifndef NO_DECOMPRESSION - -#include "shared.h" - -#include "filesys.h" - -/* so we can disable decompression */ -int no_decompression = 0; - -/* used to tell if "read" should be redirected to "gunzip_read" */ -int compressed_file; - -/* internal variables only */ -static int gzip_data_offset; -static int gzip_filepos; -static int gzip_filemax; -static int gzip_fsmax; -static int saved_filepos; -static unsigned long gzip_crc; - -static unsigned long crc; - - -/* internal extra variables for use of inflate code */ -static int block_type; -static int block_len; -static int last_block; -static int code_state; - - -/* Function prototypes */ -static void initialize_tables (void); -static unsigned long updcrc(unsigned char *, unsigned); - -/* - * Linear allocator. - */ - -static unsigned long linalloc_topaddr; - -static void * -linalloc (int size) -{ - linalloc_topaddr = (linalloc_topaddr - size) & ~3; - return (void *) linalloc_topaddr; -} - -static void -reset_linalloc (void) -{ - linalloc_topaddr = RAW_ADDR ((mbi.mem_upper << 10) + 0x100000); - linalloc_topaddr -= ZFS_SCRATCH_SIZE; -} - - -/* internal variable swap function */ -static void -gunzip_swap_values (void) -{ - register int itmp; - - /* swap filepos */ - itmp = filepos; - filepos = gzip_filepos; - gzip_filepos = itmp; - - /* swap filemax */ - itmp = filemax; - filemax = gzip_filemax; - gzip_filemax = itmp; - - /* swap fsmax */ - itmp = fsmax; - fsmax = gzip_fsmax; - gzip_fsmax = itmp; -} - - -/* internal function for eating variable-length header fields */ -static int -bad_field (int len) -{ - char ch = 1; - int not_retval = 1; - - do - { - if (len >= 0) - { - if (!(len--)) - break; - } - else - { - if (!ch) - break; - } - } - while ((not_retval = grub_read (&ch, 1)) == 1); - - return (!not_retval); -} - - -/* Little-Endian defines for the 2-byte magic number for gzip files */ -#define GZIP_HDR_LE 0x8B1F -#define OLD_GZIP_HDR_LE 0x9E1F - -/* Compression methods (see algorithm.doc) */ -#define STORED 0 -#define COMPRESSED 1 -#define PACKED 2 -#define LZHED 3 -/* methods 4 to 7 reserved */ -#define DEFLATED 8 -#define MAX_METHODS 9 - -/* gzip flag byte */ -#define ASCII_FLAG 0x01 /* bit 0 set: file probably ascii text */ -#define CONTINUATION 0x02 /* bit 1 set: continuation of multi-part gzip file */ -#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 ENCRYPTED 0x20 /* bit 5 set: file is encrypted */ -#define RESERVED 0xC0 /* bit 6,7: reserved */ - -#define UNSUPP_FLAGS (CONTINUATION|ENCRYPTED|RESERVED) - -/* inflate block codes */ -#define INFLATE_STORED 0 -#define INFLATE_FIXED 1 -#define INFLATE_DYNAMIC 2 - -typedef unsigned char uch; -typedef unsigned short ush; -typedef unsigned long ulg; - -/* - * Window Size - * - * This must be a power of two, and at least 32K for zip's deflate method - */ - -#define WSIZE 0x8000 - - -int -gunzip_test_header (void) -{ - unsigned char buf[10]; - - /* "compressed_file" is already reset to zero by this point */ - - /* - * This checks if the file is gzipped. If a problem occurs here - * (other than a real error with the disk) then we don't think it - * is a compressed file, and simply mark it as such. - */ - if (no_decompression - || grub_read (buf, 10) != 10 - || ((*((unsigned short *) buf) != GZIP_HDR_LE) - && (*((unsigned short *) buf) != OLD_GZIP_HDR_LE))) - { - filepos = 0; - return ! errnum; - } - - /* - * This does consistency checking on the header data. If a - * problem occurs from here on, then we have corrupt or otherwise - * bad data, and the error should be reported to the user. - */ - if (buf[2] != DEFLATED - || (buf[3] & UNSUPP_FLAGS) - || ((buf[3] & EXTRA_FIELD) - && (grub_read (buf, 2) != 2 - || bad_field (*((unsigned short *) buf)))) - || ((buf[3] & ORIG_NAME) && bad_field (-1)) - || ((buf[3] & COMMENT) && bad_field (-1))) - { - if (! errnum) - errnum = ERR_BAD_GZIP_HEADER; - - return 0; - } - - gzip_data_offset = filepos; - - /* We could read the last 8 bytes of the file to get the uncompressed - * size. Doing so under tftp would cause the file to be downloaded - * twice, which can be problem with large files. So we set it to - * MAXINT and correct it later when we get to the end of the file - * in get_byte(). - */ - gzip_fsmax = gzip_filemax = MAXINT; - - initialize_tables (); - - compressed_file = 1; - gunzip_swap_values (); - /* - * Now "gzip_*" values refer to the compressed data. - */ - - filepos = 0; - - crc = (ulg)0xffffffffUL; - - return 1; -} - - -/* 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). - Valid extra bits are 0..13. e == 15 is EOB (end of block), e == 16 - means that v is a literal, 16 < e < 32 means that v is a pointer to - the next table, which codes e - 16 bits, and lastly e == 99 indicates - an unused code. If a code with e == 99 is looked up, this implies an - error in the data. */ -struct huft -{ - uch e; /* number of extra bits or operation */ - uch b; /* number of bits in this code or subcode */ - union - { - ush n; /* literal, length base, or distance base */ - struct huft *t; /* pointer to next level of table */ - } - v; -}; - - -/* The inflate algorithm uses a sliding 32K byte window on the uncompressed - stream to find repeated byte strings. This is implemented here as a - circular buffer. The index is updated simply by incrementing and then - and'ing with 0x7fff (32K-1). */ -/* It is left to other modules to supply the 32K area. It is assumed - to be usable as if it were declared "uch slide[32768];" or as just - "uch *slide;" and then malloc'ed in the latter case. The definition - must be in unzip.h, included above. */ - - -/* sliding window in uncompressed data */ -static uch slide[WSIZE]; - -/* current position in slide */ -static unsigned wp; - - -/* Tables for deflate from PKZIP's appnote.txt. */ -static unsigned bitorder[] = -{ /* 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}; -static ush cplens[] = -{ /* 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}; - /* note: see note #13 above about the 258 in this list. */ -static ush cplext[] = -{ /* 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, 99, 99}; /* 99==invalid */ -static ush cpdist[] = -{ /* 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}; -static ush cpdext[] = -{ /* 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. - */ - - -static int lbits = 9; /* bits in base literal/length lookup table */ -static int dbits = 6; /* bits in base distance lookup table */ - - -/* If BMAX needs to be larger than 16, then h and x[] should be ulg. */ -#define BMAX 16 /* maximum bit length of any code (16 for explode) */ -#define N_MAX 288 /* maximum number of codes in any set */ - - -static unsigned hufts; /* track memory usage */ - - -/* Macros for inflate() bit peeking and grabbing. - The usage is: - - NEEDBITS(j) - x = b & mask_bits[j]; - DUMPBITS(j) - - where NEEDBITS makes sure that b has at least j bits in it, and - DUMPBITS removes the bits from b. The macros use the variable k - for the number of bits in b. Normally, b and k are register - variables for speed, and are initialized at the beginning of a - routine that uses these macros from a global bit buffer and count. - - If we assume that EOB will be the longest code, then we will never - ask for bits with NEEDBITS that are beyond the end of the stream. - So, NEEDBITS should not read any more bytes than are needed to - meet the request. Then no bytes need to be "returned" to the buffer - at the end of the last block. - - However, this assumption is not true for fixed blocks--the EOB code - is 7 bits, but the other literal/length codes can be 8 or 9 bits. - (The EOB code is shorter than other codes because fixed blocks are - generally short. So, while a block always has an EOB, many other - literal/length codes have a significantly lower probability of - showing up at all.) However, by making the first table have a - lookup of seven bits, the EOB code will be found in that first - lookup, and so will not require that too many bits be pulled from - the stream. - */ - -static ulg bb; /* bit buffer */ -static unsigned bk; /* bits in bit buffer */ - -static ush mask_bits[] = -{ - 0x0000, - 0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff, - 0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff -}; - -#define NEEDBITS(n) do {while(k<(n)){b|=((ulg)get_byte())<>=(n);k-=(n);} while (0) - -#define INBUFSIZ 0x2000 - -static uch inbuf[INBUFSIZ]; -static int bufloc; -static uch endbuf[8]; - -static int -get_byte (void) -{ - if (filepos == gzip_data_offset || bufloc == INBUFSIZ) - { - int pos; - int old_filepos = filepos; - bufloc = 0; - grub_read (inbuf, INBUFSIZ); - /* If there are 8 bytes or less left, we have read in all the - * the file content. So get the last 8 bytes and get the crc - * and uncompressed size. This is important for the loop in - * gunzip_read() to terminate properly. - */ - if (filepos >= filemax - 8) { - uch *eb = endbuf; - for (pos = filemax - 8; pos < filepos; pos++) - *eb++ = inbuf[pos - old_filepos]; - if (filemax > filepos) - grub_read(eb, filemax - filepos); - gzip_crc = *((unsigned long *) endbuf); - gzip_filemax = *((unsigned long *) (endbuf + 4)); - } - } - - return inbuf[bufloc++]; -} - -/* decompression global pointers */ -static struct huft *tl; /* literal/length code table */ -static struct huft *td; /* distance code table */ -static int bl; /* lookup bits for tl */ -static int bd; /* lookup bits for td */ - - -/* more function prototypes */ -static int huft_build (unsigned *, unsigned, unsigned, ush *, ush *, - struct huft **, int *); -static int inflate_codes_in_window (void); - - -/* Given a list of code lengths and a maximum table size, make a set of - tables to decode that set of codes. Return zero on success, one if - the given code set is incomplete (the tables are still built in this - case), two if the input is invalid (all zero length codes or an - oversubscribed set of lengths), and three if not enough memory. */ - -static int -huft_build (unsigned *b, /* code lengths in bits (all assumed <= BMAX) */ - unsigned n, /* number of codes (assumed <= N_MAX) */ - unsigned s, /* number of simple-valued codes (0..s-1) */ - ush * d, /* list of base values for non-simple codes */ - ush * e, /* list of extra bits for non-simple codes */ - struct huft **t, /* result: starting table */ - int *m) /* maximum lookup bits, returns actual */ -{ - unsigned a; /* counter for codes of length k */ - unsigned c[BMAX + 1]; /* bit length count table */ - unsigned f; /* i repeats in table every f entries */ - int g; /* maximum code length */ - int h; /* table level */ - register unsigned i; /* counter, current code */ - register unsigned j; /* counter */ - register int k; /* number of bits in current code */ - int l; /* bits per table (returned in m) */ - register unsigned *p; /* pointer into c[], b[], or v[] */ - register struct huft *q; /* points to current table */ - struct huft r; /* table entry for structure assignment */ - struct huft *u[BMAX]; /* table stack */ - unsigned v[N_MAX]; /* values in order of bit length */ - register int w; /* bits before this table == (l * h) */ - unsigned x[BMAX + 1]; /* bit offsets, then code stack */ - unsigned *xp; /* pointer into x */ - int y; /* number of dummy codes added */ - unsigned z; /* number of entries in current table */ - - /* Generate counts for each bit length */ - memset ((char *) c, 0, sizeof (c)); - p = b; - i = n; - do - { - c[*p]++; /* assume all entries <= BMAX */ - p++; /* Can't combine with above line (Solaris bug) */ - } - while (--i); - if (c[0] == n) /* null input--all zero length codes */ - { - *t = (struct huft *) NULL; - *m = 0; - return 0; - } - - /* 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 ((unsigned) l < j) - l = j; - for (i = BMAX; i; i--) - if (c[i]) - break; - g = i; /* maximum code length */ - if ((unsigned) 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 2; /* bad input: more codes than bits */ - if ((y -= c[i]) < 0) - return 2; - 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); - - /* 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] = (struct huft *) NULL; /* just to keep compilers happy */ - q = (struct huft *) 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 = (z = g - w) > (unsigned) l ? l : z; /* upper limit on table size */ - 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; - 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 and link in new table */ - q = (struct huft *) linalloc ((z + 1) * sizeof (struct huft)); - - hufts += z + 1; /* track memory usage */ - *t = q + 1; /* link to list for huft_free() */ - *(t = &(q->v.t)) = (struct huft *) NULL; - u[h] = ++q; /* table starts after link */ - - /* connect to last table, if there is one */ - if (h) - { - x[h] = i; /* save pattern for backing up */ - r.b = (uch) l; /* bits to dump before this table */ - r.e = (uch) (16 + j); /* bits in this table */ - r.v.t = q; /* pointer to this table */ - j = i >> (w - l); /* (get around Turbo C bug) */ - u[h - 1][j] = r; /* connect to last table */ - } - } - - /* set up table entry in r */ - r.b = (uch) (k - w); - if (p >= v + n) - r.e = 99; /* out of values--invalid code */ - else if (*p < s) - { - r.e = (uch) (*p < 256 ? 16 : 15); /* 256 is end-of-block code */ - r.v.n = (ush) (*p); /* simple code is just the value */ - p++; /* one compiler does not like *p++ */ - } - else - { - r.e = (uch) e[*p - s]; /* non-simple--look up in lists */ - r.v.n = 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 */ - while ((i & ((1 << w) - 1)) != x[h]) - { - h--; /* don't need to update q */ - w -= l; - } - } - } - - /* Return true (1) if we were given an incomplete table */ - return y != 0 && g != 1; -} - - -/* - * inflate (decompress) the codes in a deflated (compressed) block. - * Return an error code or zero if it all goes ok. - */ - -static unsigned inflate_n, inflate_d; - -static int -inflate_codes_in_window (void) -{ - register unsigned e; /* table entry flag/number of extra bits */ - unsigned n, d; /* length and index for copy */ - unsigned w; /* current window position */ - struct huft *t; /* pointer to table entry */ - unsigned ml, md; /* masks for bl and bd bits */ - register ulg b; /* bit buffer */ - register unsigned k; /* number of bits in bit buffer */ - - /* make local copies of globals */ - d = inflate_d; - n = inflate_n; - b = bb; /* initialize bit buffer */ - k = bk; - w = wp; /* initialize window position */ - - /* inflate the coded data */ - ml = mask_bits[bl]; /* precompute masks for speed */ - md = mask_bits[bd]; - for (;;) /* do until end of block */ - { - if (!code_state) - { - NEEDBITS ((unsigned) bl); - if ((e = (t = tl + ((unsigned) b & ml))->e) > 16) - do - { - if (e == 99) - { - errnum = ERR_BAD_GZIP_DATA; - return 0; - } - DUMPBITS (t->b); - e -= 16; - NEEDBITS (e); - } - while ((e = (t = t->v.t + ((unsigned) b & mask_bits[e]))->e) > 16); - DUMPBITS (t->b); - - if (e == 16) /* then it's a literal */ - { - slide[w++] = (uch) t->v.n; - if (w == WSIZE) - break; - } - else - /* it's an EOB or a length */ - { - /* exit if end of block */ - if (e == 15) - { - block_len = 0; - break; - } - - /* get length of block to copy */ - NEEDBITS (e); - n = t->v.n + ((unsigned) b & mask_bits[e]); - DUMPBITS (e); - - /* decode distance of block to copy */ - NEEDBITS ((unsigned) bd); - if ((e = (t = td + ((unsigned) b & md))->e) > 16) - do - { - if (e == 99) - { - errnum = ERR_BAD_GZIP_DATA; - return 0; - } - DUMPBITS (t->b); - e -= 16; - NEEDBITS (e); - } - while ((e = (t = t->v.t + ((unsigned) b & mask_bits[e]))->e) - > 16); - DUMPBITS (t->b); - NEEDBITS (e); - d = w - t->v.n - ((unsigned) b & mask_bits[e]); - DUMPBITS (e); - code_state++; - } - } - - if (code_state) - { - /* do the copy */ - do - { - n -= (e = (e = WSIZE - ((d &= WSIZE - 1) > w ? d : w)) > n ? n - : e); - if (w - d >= e) - { - memmove (slide + w, slide + d, e); - w += e; - d += e; - } - else - /* purposefully use the overlap for extra copies here!! */ - { - while (e--) - slide[w++] = slide[d++]; - } - if (w == WSIZE) - break; - } - while (n); - - if (!n) - code_state--; - - /* did we break from the loop too soon? */ - if (w == WSIZE) - break; - } - } - - /* restore the globals from the locals */ - inflate_d = d; - inflate_n = n; - wp = w; /* restore global window pointer */ - bb = b; /* restore global bit buffer */ - bk = k; - - return !block_len; -} - - -/* get header for an inflated type 0 (stored) block. */ - -static void -init_stored_block (void) -{ - register ulg b; /* bit buffer */ - register unsigned k; /* number of bits in bit buffer */ - - /* make local copies of globals */ - b = bb; /* initialize bit buffer */ - k = bk; - - /* go to byte boundary */ - DUMPBITS (k & 7); - - /* get the length and its complement */ - NEEDBITS (16); - block_len = ((unsigned) b & 0xffff); - DUMPBITS (16); - NEEDBITS (16); - if (block_len != (unsigned) ((~b) & 0xffff)) - errnum = ERR_BAD_GZIP_DATA; - DUMPBITS (16); - - /* restore global variables */ - bb = b; - bk = k; -} - - -/* get header for an inflated type 1 (fixed Huffman codes) block. We should - either replace this with a custom decoder, or at least precompute the - Huffman tables. */ - -static void -init_fixed_block () -{ - int i; /* temporary variable */ - unsigned l[288]; /* length list for huft_build */ - - /* set up literal table */ - for (i = 0; i < 144; i++) - l[i] = 8; - for (; i < 256; i++) - l[i] = 9; - for (; i < 280; i++) - l[i] = 7; - for (; i < 288; i++) /* make a complete, but wrong code set */ - l[i] = 8; - bl = 7; - if ((i = huft_build (l, 288, 257, cplens, cplext, &tl, &bl)) != 0) - { - errnum = ERR_BAD_GZIP_DATA; - return; - } - - /* set up distance table */ - for (i = 0; i < 30; i++) /* make an incomplete code set */ - l[i] = 5; - bd = 5; - if ((i = huft_build (l, 30, 0, cpdist, cpdext, &td, &bd)) > 1) - { - errnum = ERR_BAD_GZIP_DATA; - return; - } - - /* indicate we're now working on a block */ - code_state = 0; - block_len++; -} - - -/* get header for an inflated type 2 (dynamic Huffman codes) block. */ - -static void -init_dynamic_block (void) -{ - int i; /* temporary variables */ - unsigned j; - unsigned l; /* last length */ - unsigned m; /* mask for bit lengths table */ - unsigned n; /* number of lengths to get */ - unsigned nb; /* number of bit length codes */ - unsigned nl; /* number of literal/length codes */ - unsigned nd; /* number of distance codes */ - unsigned ll[286 + 30]; /* literal/length and distance code lengths */ - register ulg b; /* bit buffer */ - register unsigned k; /* number of bits in bit buffer */ - - /* make local bit buffer */ - b = bb; - k = bk; - - /* read in table lengths */ - NEEDBITS (5); - nl = 257 + ((unsigned) b & 0x1f); /* number of literal/length codes */ - DUMPBITS (5); - NEEDBITS (5); - nd = 1 + ((unsigned) b & 0x1f); /* number of distance codes */ - DUMPBITS (5); - NEEDBITS (4); - nb = 4 + ((unsigned) b & 0xf); /* number of bit length codes */ - DUMPBITS (4); - if (nl > 286 || nd > 30) - { - errnum = ERR_BAD_GZIP_DATA; - return; - } - - /* read in bit-length-code lengths */ - for (j = 0; j < nb; j++) - { - NEEDBITS (3); - ll[bitorder[j]] = (unsigned) b & 7; - DUMPBITS (3); - } - for (; j < 19; j++) - ll[bitorder[j]] = 0; - - /* build decoding table for trees--single level, 7 bit lookup */ - bl = 7; - if ((i = huft_build (ll, 19, 19, NULL, NULL, &tl, &bl)) != 0) - { - errnum = ERR_BAD_GZIP_DATA; - return; - } - - /* read in literal and distance code lengths */ - n = nl + nd; - m = mask_bits[bl]; - i = l = 0; - while ((unsigned) i < n) - { - NEEDBITS ((unsigned) bl); - j = (td = tl + ((unsigned) b & m))->b; - DUMPBITS (j); - j = td->v.n; - if (j < 16) /* length of code in bits (0..15) */ - ll[i++] = l = j; /* save last length in l */ - else if (j == 16) /* repeat last length 3 to 6 times */ - { - NEEDBITS (2); - j = 3 + ((unsigned) b & 3); - DUMPBITS (2); - if ((unsigned) i + j > n) - { - errnum = ERR_BAD_GZIP_DATA; - return; - } - while (j--) - ll[i++] = l; - } - else if (j == 17) /* 3 to 10 zero length codes */ - { - NEEDBITS (3); - j = 3 + ((unsigned) b & 7); - DUMPBITS (3); - if ((unsigned) i + j > n) - { - errnum = ERR_BAD_GZIP_DATA; - return; - } - while (j--) - ll[i++] = 0; - l = 0; - } - else - /* j == 18: 11 to 138 zero length codes */ - { - NEEDBITS (7); - j = 11 + ((unsigned) b & 0x7f); - DUMPBITS (7); - if ((unsigned) i + j > n) - { - errnum = ERR_BAD_GZIP_DATA; - return; - } - while (j--) - ll[i++] = 0; - l = 0; - } - } - - /* free decoding table for trees */ - reset_linalloc (); - - /* restore the global bit buffer */ - bb = b; - bk = k; - - /* build the decoding tables for literal/length and distance codes */ - bl = lbits; - if ((i = huft_build (ll, nl, 257, cplens, cplext, &tl, &bl)) != 0) - { -#if 0 - if (i == 1) - printf ("gunzip: incomplete literal tree\n"); -#endif - - errnum = ERR_BAD_GZIP_DATA; - return; - } - bd = dbits; - if ((i = huft_build (ll + nl, nd, 0, cpdist, cpdext, &td, &bd)) != 0) - { -#if 0 - if (i == 1) - printf ("gunzip: incomplete distance tree\n"); -#endif - - errnum = ERR_BAD_GZIP_DATA; - return; - } - - /* indicate we're now working on a block */ - code_state = 0; - block_len++; -} - - -static void -get_new_block (void) -{ - register ulg b; /* bit buffer */ - register unsigned k; /* number of bits in bit buffer */ - - hufts = 0; - - /* make local bit buffer */ - b = bb; - k = bk; - - /* read in last block bit */ - NEEDBITS (1); - last_block = (int) b & 1; - DUMPBITS (1); - - /* read in block type */ - NEEDBITS (2); - block_type = (unsigned) b & 3; - DUMPBITS (2); - - /* restore the global bit buffer */ - bb = b; - bk = k; - - if (block_type == INFLATE_STORED) - init_stored_block (); - if (block_type == INFLATE_FIXED) - init_fixed_block (); - if (block_type == INFLATE_DYNAMIC) - init_dynamic_block (); -} - - -static void -inflate_window (void) -{ - /* initialize window */ - wp = 0; - - /* - * Main decompression loop. - */ - - while (wp < WSIZE && !errnum) - { - if (!block_len) - { - if (last_block) - break; - - get_new_block (); - } - - if (block_type > INFLATE_DYNAMIC) - errnum = ERR_BAD_GZIP_DATA; - - if (errnum) - return; - - /* - * Expand stored block here. - */ - if (block_type == INFLATE_STORED) - { - int w = wp; - - /* - * This is basically a glorified pass-through - */ - - while (block_len && w < WSIZE && !errnum) - { - slide[w++] = get_byte (); - block_len--; - } - - wp = w; - - continue; - } - - /* - * Expand other kind of block. - */ - - if (inflate_codes_in_window ()) - reset_linalloc (); - } - - saved_filepos += WSIZE; -} - - -static void -initialize_tables (void) -{ - saved_filepos = 0; - filepos = gzip_data_offset; - - /* initialize window, bit buffer */ - bk = 0; - bb = 0; - - /* reset partial decompression code */ - last_block = 0; - block_len = 0; - - /* reset memory allocation stuff */ - reset_linalloc (); -} - - -int -gunzip_read (char *buf, int len) -{ - int ret = 0; - int check_crc; - ulg crc_value = 0xffffffffUL; - - compressed_file = 0; - gunzip_swap_values (); - /* - * Now "gzip_*" values refer to the uncompressed data. - */ - - /* do we reset decompression to the beginning of the file? */ - if (saved_filepos > gzip_filepos + WSIZE) - initialize_tables (); - - /* perform CRC check only if reading the entire file */ - check_crc = (saved_filepos == 0 && len == MAXINT); - - /* - * This loop operates upon uncompressed data only. The only - * special thing it does is to make sure the decompression - * window is within the range of data it needs. - */ - - while (len > 0 && !errnum) - { - register int size; - register char *srcaddr; - - while (gzip_filepos >= saved_filepos && !errnum) - inflate_window (); - - if (errnum) - break; - - /* We could have started with an unknown gzip_filemax (MAXINT) - * which has been updated in get_byte(). If so, update len - * to avoid reading beyond the end. - */ - if (len > (gzip_filemax - gzip_filepos)) { - len = gzip_filemax - gzip_filepos; - if (len < 0) { - errnum = ERR_BAD_GZIP_DATA; - break; - } - } - - srcaddr = (char *) ((gzip_filepos & (WSIZE - 1)) + slide); - size = saved_filepos - gzip_filepos; - if (size > len) - size = len; - - memmove (buf, srcaddr, size); - - /* do CRC calculation here! */ - crc_value = updcrc(buf, (unsigned)size); - - buf += size; - len -= size; - gzip_filepos += size; - ret += size; - } - - /* check for CRC error if reading entire file */ - if (!errnum && check_crc && gzip_crc != crc_value) { -#if 0 - printf ("gunzip: crc value 0x%x, expected 0x%x\n", crc_value, gzip_crc); -#endif - errnum = ERR_BAD_GZIP_CRC; - } - - compressed_file = 1; - gunzip_swap_values (); - /* - * Now "gzip_*" values refer to the compressed data. - */ - - if (errnum) - ret = 0; - - return ret; -} - -/* The crc_23_tab and updcrc() are adapted from gzip 1.3.3 */ - -/* ======================================================================== - * Table of CRC-32's of all single-byte values (made by makecrc.c) - */ -static ulg crc_32_tab[] = { - 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 -}; - -/* =========================================================================== - * Run a set of bytes through the crc shift register. If s is a NULL - * pointer, then initialize the crc shift register contents instead. - * Return the current crc in either case. - */ -static ulg updcrc(s, n) - uch *s; /* pointer to bytes to pump through */ - unsigned n; /* number of bytes in s[] */ -{ - register ulg c; /* temporary variable */ - - c = crc; - if (n) do { - c = crc_32_tab[((int)c ^ (*s++)) & 0xff] ^ (c >> 8); - } while (--n); - crc = c; - return c ^ 0xffffffffL; /* (instead of ~c for 64-bit machines) */ -} - -#endif /* ! NO_DECOMPRESSION */ diff --git a/usr/src/grub/grub-0.95/stage2/hercules.c b/usr/src/grub/grub-0.95/stage2/hercules.c deleted file mode 100644 index 4c0280bafc..0000000000 --- a/usr/src/grub/grub-0.95/stage2/hercules.c +++ /dev/null @@ -1,186 +0,0 @@ -/* hercules.c - hercules console interface */ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 2001,2002 Free Software Foundation, 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 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. - */ - -#ifdef SUPPORT_HERCULES - -#include -#include -#include - -/* The position of the cursor. */ -static int herc_x; -static int herc_y; - -static int herc_standard_color = A_NORMAL; -static int herc_normal_color = A_NORMAL; -static int herc_highlight_color = A_REVERSE; -static int herc_current_color = A_NORMAL; -static color_state herc_color_state = COLOR_STATE_STANDARD; -static int herc_cursor_state = 1; - -/* Write a byte to a port. */ -static inline void -outb (unsigned short port, unsigned char value) -{ - asm volatile ("outb %b0, %w1" : : "a" (value), "Nd" (port)); -} - -static void -herc_set_cursor (void) -{ - unsigned offset = herc_y * HERCULES_WIDTH + herc_x; - - outb (HERCULES_INDEX_REG, 0x0f); - outb (0x80, 0); - outb (HERCULES_DATA_REG, offset & 0xFF); - outb (0x80, 0); - - outb (HERCULES_INDEX_REG, 0x0e); - outb (0x80, 0); - outb (HERCULES_DATA_REG, offset >> 8); - outb (0x80, 0); -} - -void -hercules_putchar (int c) -{ - switch (c) - { - case '\b': - if (herc_x > 0) - herc_x--; - break; - - case '\n': - herc_y++; - break; - - case '\r': - herc_x = 0; - break; - - case '\a': - break; - - default: - { - volatile unsigned short *video - = (unsigned short *) HERCULES_VIDEO_ADDR; - - video[herc_y * HERCULES_WIDTH + herc_x] - = (herc_current_color << 8) | c; - herc_x++; - if (herc_x >= HERCULES_WIDTH) - { - herc_x = 0; - herc_y++; - } - } - break; - } - - if (herc_y >= HERCULES_HEIGHT) - { - volatile unsigned long *video = (unsigned long *) HERCULES_VIDEO_ADDR; - int i; - - herc_y = HERCULES_HEIGHT - 1; - grub_memmove ((char *) HERCULES_VIDEO_ADDR, - (char *) HERCULES_VIDEO_ADDR + HERCULES_WIDTH * 2, - HERCULES_WIDTH * (HERCULES_HEIGHT - 1) * 2); - for (i = HERCULES_WIDTH * (HERCULES_HEIGHT - 1) / 2; - i < HERCULES_WIDTH * HERCULES_HEIGHT / 2; - i++) - video[i] = 0x07200720; - } -} - -void -hercules_cls (void) -{ - int i; - volatile unsigned long *video = (unsigned long *) HERCULES_VIDEO_ADDR; - - for (i = 0; i < HERCULES_WIDTH * HERCULES_HEIGHT / 2; i++) - video[i] = 0x07200720; - - herc_x = herc_y = 0; - herc_set_cursor (); -} - -int -hercules_getxy (void) -{ - return (herc_x << 8) | herc_y; -} - -void -hercules_gotoxy (int x, int y) -{ - herc_x = x; - herc_y = y; - herc_set_cursor (); -} - -void -hercules_setcolorstate (color_state state) -{ - switch (state) { - case COLOR_STATE_STANDARD: - herc_current_color = herc_standard_color; - break; - case COLOR_STATE_NORMAL: - herc_current_color = herc_normal_color; - break; - case COLOR_STATE_HIGHLIGHT: - herc_current_color = herc_highlight_color; - break; - default: - herc_current_color = herc_standard_color; - break; - } - - herc_color_state = state; -} - -void -hercules_setcolor (int normal_color, int highlight_color) -{ - herc_normal_color = normal_color; - herc_highlight_color = highlight_color; - - hercules_setcolorstate (herc_color_state); -} - -int -hercules_setcursor (int on) -{ - int old_state = herc_cursor_state; - - outb (HERCULES_INDEX_REG, 0x0a); - outb (0x80, 0); - outb (HERCULES_DATA_REG, on ? 0 : (1 << 5)); - outb (0x80, 0); - herc_cursor_state = on; - - return old_state; -} - -#endif /* SUPPORT_HERCULES */ diff --git a/usr/src/grub/grub-0.95/stage2/hercules.h b/usr/src/grub/grub-0.95/stage2/hercules.h deleted file mode 100644 index aaf794fa1e..0000000000 --- a/usr/src/grub/grub-0.95/stage2/hercules.h +++ /dev/null @@ -1,31 +0,0 @@ -/* hercules.h - hercules console interface */ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 2001 Free Software Foundation, 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 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 GRUB_HERCULES_HEADER -#define GRUB_HERCULES_HEADER 1 - -/* Macros. */ -#define HERCULES_VIDEO_ADDR RAW_ADDR (0xB0000) -#define HERCULES_WIDTH 80 -#define HERCULES_HEIGHT 25 -#define HERCULES_INDEX_REG 0x3b4 -#define HERCULES_DATA_REG 0x3b5 - -#endif /* ! GRUB_HERCULES_HEADER */ diff --git a/usr/src/grub/grub-0.95/stage2/i386-elf.h b/usr/src/grub/grub-0.95/stage2/i386-elf.h deleted file mode 100644 index 7162e3de8b..0000000000 --- a/usr/src/grub/grub-0.95/stage2/i386-elf.h +++ /dev/null @@ -1,237 +0,0 @@ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 2001,2002 Free Software Foundation, 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 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. - */ - -/* 32-bit data types */ - -typedef unsigned long Elf32_Addr; -typedef unsigned short Elf32_Half; -typedef unsigned long Elf32_Off; -typedef signed long Elf32_Sword; -typedef unsigned long Elf32_Word; -/* "unsigned char" already exists */ - -/* ELF header */ -typedef struct -{ - -#define EI_NIDENT 16 - - /* first four characters are defined below */ -#define EI_MAG0 0 -#define ELFMAG0 0x7f -#define EI_MAG1 1 -#define ELFMAG1 'E' -#define EI_MAG2 2 -#define ELFMAG2 'L' -#define EI_MAG3 3 -#define ELFMAG3 'F' - -#define EI_CLASS 4 /* data sizes */ -#define ELFCLASS32 1 /* i386 -- up to 32-bit data sizes present */ - -#define EI_DATA 5 /* data type and ordering */ -#define ELFDATA2LSB 1 /* i386 -- LSB 2's complement */ - -#define EI_VERSION 6 /* version number. "e_version" must be the same */ -#define EV_CURRENT 1 /* current version number */ - -#define EI_OSABI 7 /* operating system/ABI indication */ -#define ELFOSABI_FREEBSD 9 - -#define EI_ABIVERSION 8 /* ABI version */ - -#define EI_PAD 9 /* from here in is just padding */ - -#define EI_BRAND 8 /* start of OS branding (This is - obviously illegal against the ELF - standard.) */ - - unsigned char e_ident[EI_NIDENT]; /* basic identification block */ - -#define ET_EXEC 2 /* we only care about executable types */ - Elf32_Half e_type; /* file types */ - -#define EM_386 3 /* i386 -- obviously use this one */ - Elf32_Half e_machine; /* machine types */ - Elf32_Word e_version; /* use same as "EI_VERSION" above */ - Elf32_Addr e_entry; /* entry point of the program */ - Elf32_Off e_phoff; /* program header table file offset */ - Elf32_Off e_shoff; /* section header table file offset */ - Elf32_Word e_flags; /* flags */ - Elf32_Half e_ehsize; /* elf header size in bytes */ - Elf32_Half e_phentsize; /* program header entry size */ - Elf32_Half e_phnum; /* number of entries in program header */ - Elf32_Half e_shentsize; /* section header entry size */ - Elf32_Half e_shnum; /* number of entries in section header */ - -#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 - Elf32_Half e_shstrndx; /* section header table index */ -} -Elf32_Ehdr; - - -#define BOOTABLE_I386_ELF(h) \ - ((h.e_ident[EI_MAG0] == ELFMAG0) & (h.e_ident[EI_MAG1] == ELFMAG1) \ - & (h.e_ident[EI_MAG2] == ELFMAG2) & (h.e_ident[EI_MAG3] == ELFMAG3) \ - & (h.e_ident[EI_CLASS] == ELFCLASS32) & (h.e_ident[EI_DATA] == ELFDATA2LSB) \ - & (h.e_ident[EI_VERSION] == EV_CURRENT) & (h.e_type == ET_EXEC) \ - & (h.e_machine == EM_386) & (h.e_version == EV_CURRENT)) - -/* section table - ? */ -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; - -/* symbol table - page 4-25, figure 4-15 */ -typedef struct -{ - 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; - -/* symbol type and binding attributes - page 4-26 */ - -#define ELF32_ST_BIND(i) ((i) >> 4) -#define ELF32_ST_TYPE(i) ((i) & 0xf) -#define ELF32_ST_INFO(b,t) (((b)<<4)+((t)&0xf)) - -/* symbol binding - page 4-26, figure 4-16 */ - -#define STB_LOCAL 0 -#define STB_GLOBAL 1 -#define STB_WEAK 2 -#define STB_LOPROC 13 -#define STB_HIPROC 15 - -/* symbol types - page 4-28, figure 4-17 */ - -#define STT_NOTYPE 0 -#define STT_OBJECT 1 -#define STT_FUNC 2 -#define STT_SECTION 3 -#define STT_FILE 4 -#define STT_LOPROC 13 -#define STT_HIPROC 15 - - -/* Macros to split/combine relocation type and symbol page 4-32 */ - -#define ELF32_R_SYM(__i) ((__i)>>8) -#define ELF32_R_TYPE(__i) ((unsigned char) (__i)) -#define ELF32_R_INFO(__s, __t) (((__s)<<8) + (unsigned char) (__t)) - - -/* program header - page 5-2, figure 5-1 */ - -typedef struct -{ - 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; - -/* segment types - page 5-3, figure 5-2 */ - -#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_LOPROC 0x70000000 -#define PT_HIPROC 0x7fffffff - -/* segment permissions - page 5-6 */ - -#define PF_X 0x1 -#define PF_W 0x2 -#define PF_R 0x4 -#define PF_MASKPROC 0xf0000000 - - -/* dynamic structure - page 5-15, figure 5-9 */ - -typedef struct -{ - Elf32_Sword d_tag; - union - { - Elf32_Word d_val; - Elf32_Addr d_ptr; - } - d_un; -} -Elf32_Dyn; - -/* Dynamic array tags - page 5-16, figure 5-10. */ - -#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 diff --git a/usr/src/grub/grub-0.95/stage2/imgact_aout.h b/usr/src/grub/grub-0.95/stage2/imgact_aout.h deleted file mode 100644 index 8b10379372..0000000000 --- a/usr/src/grub/grub-0.95/stage2/imgact_aout.h +++ /dev/null @@ -1,158 +0,0 @@ - -/*- - * Copyright (c) 1992, 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. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 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: @(#)exec.h 8.1 (Berkeley) 6/11/93 - * $Id: imgact_aout.h,v 1.1.1.1 2003/11/20 02:04:59 fengshuo Exp $ - */ -/* - * 11/23/95 - Kludge to get "ntohl" null macro added. -- ESB - * - and for __LDPGSZ - */ - -#ifndef _IMGACT_AOUT_H_ -#define _IMGACT_AOUT_H_ - -/* XXX ESB */ -#define ntohl(x) ((x << 24) | ((x & 0xFF00) << 8) \ - | ((x >> 8) & 0xFF00) | (x >> 24)) -#define htonl(x) ntohl(x) -#define __LDPGSZ 0x1000 - -#define N_GETMAGIC(ex) \ - ( (ex).a_midmag & 0xffff ) -#define N_GETMID(ex) \ - ( (N_GETMAGIC_NET(ex) == ZMAGIC) ? N_GETMID_NET(ex) : \ - ((ex).a_midmag >> 16) & 0x03ff ) -#define N_GETFLAG(ex) \ - ( (N_GETMAGIC_NET(ex) == ZMAGIC) ? N_GETFLAG_NET(ex) : \ - ((ex).a_midmag >> 26) & 0x3f ) -#define N_SETMAGIC(ex,mag,mid,flag) \ - ( (ex).a_midmag = (((flag) & 0x3f) <<26) | (((mid) & 0x03ff) << 16) | \ - ((mag) & 0xffff) ) - -#define N_GETMAGIC_NET(ex) \ - (ntohl((ex).a_midmag) & 0xffff) -#define N_GETMID_NET(ex) \ - ((ntohl((ex).a_midmag) >> 16) & 0x03ff) -#define N_GETFLAG_NET(ex) \ - ((ntohl((ex).a_midmag) >> 26) & 0x3f) -#define N_SETMAGIC_NET(ex,mag,mid,flag) \ - ( (ex).a_midmag = htonl( (((flag)&0x3f)<<26) | (((mid)&0x03ff)<<16) | \ - (((mag)&0xffff)) ) ) - -#define N_ALIGN(ex,x) \ - (N_GETMAGIC(ex) == ZMAGIC || N_GETMAGIC(ex) == QMAGIC || \ - N_GETMAGIC_NET(ex) == ZMAGIC || N_GETMAGIC_NET(ex) == QMAGIC ? \ - ((x) + __LDPGSZ - 1) & ~(unsigned long)(__LDPGSZ - 1) : (x)) - -/* Valid magic number check. */ -#define N_BADMAG(ex) \ - (N_GETMAGIC(ex) != OMAGIC && N_GETMAGIC(ex) != NMAGIC && \ - N_GETMAGIC(ex) != ZMAGIC && N_GETMAGIC(ex) != QMAGIC && \ - N_GETMAGIC_NET(ex) != OMAGIC && N_GETMAGIC_NET(ex) != NMAGIC && \ - N_GETMAGIC_NET(ex) != ZMAGIC && N_GETMAGIC_NET(ex) != QMAGIC) - - -/* Address of the bottom of the text segment. */ -#define N_TXTADDR(ex) \ - ((N_GETMAGIC(ex) == OMAGIC || N_GETMAGIC(ex) == NMAGIC || \ - N_GETMAGIC(ex) == ZMAGIC) ? 0 : __LDPGSZ) - -/* Address of the bottom of the data segment. */ -#define N_DATADDR(ex) \ - N_ALIGN(ex, N_TXTADDR(ex) + (ex).a_text) - -/* Text segment offset. */ -#define N_TXTOFF(ex) \ - (N_GETMAGIC(ex) == ZMAGIC ? __LDPGSZ : (N_GETMAGIC(ex) == QMAGIC || \ - N_GETMAGIC_NET(ex) == ZMAGIC) ? 0 : sizeof(struct exec)) - -/* Data segment offset. */ -#define N_DATOFF(ex) \ - N_ALIGN(ex, N_TXTOFF(ex) + (ex).a_text) - -/* Relocation table offset. */ -#define N_RELOFF(ex) \ - N_ALIGN(ex, N_DATOFF(ex) + (ex).a_data) - -/* Symbol table offset. */ -#define N_SYMOFF(ex) \ - (N_RELOFF(ex) + (ex).a_trsize + (ex).a_drsize) - -/* String table offset. */ -#define N_STROFF(ex) (N_SYMOFF(ex) + (ex).a_syms) - -/* - * Header prepended to each a.out file. - * only manipulate the a_midmag field via the - * N_SETMAGIC/N_GET{MAGIC,MID,FLAG} macros in a.out.h - */ - -struct exec - { - unsigned long a_midmag; /* htonl(flags<<26 | mid<<16 | magic) */ - unsigned long a_text; /* text segment size */ - unsigned long a_data; /* initialized data size */ - unsigned long a_bss; /* uninitialized data size */ - unsigned long a_syms; /* symbol table size */ - unsigned long a_entry; /* entry point */ - unsigned long a_trsize; /* text relocation size */ - unsigned long a_drsize; /* data relocation size */ - }; -#define a_magic a_midmag /* XXX Hack to work with current kern_execve.c */ - -/* a_magic */ -#define OMAGIC 0x107 /* 0407 old impure format */ -#define NMAGIC 0x108 /* 0410 read-only text */ -#define ZMAGIC 0x10b /* 0413 demand load format */ -#define QMAGIC 0xcc /* 0314 "compact" demand load format */ - -/* a_mid */ -#define MID_ZERO 0 /* unknown - implementation dependent */ -#define MID_SUN010 1 /* sun 68010/68020 binary */ -#define MID_SUN020 2 /* sun 68020-only binary */ -#define MID_I386 134 /* i386 BSD binary */ -#define MID_SPARC 138 /* sparc */ -#define MID_HP200 200 /* hp200 (68010) BSD binary */ -#define MID_HP300 300 /* hp300 (68020+68881) BSD binary */ -#define MID_HPUX 0x20C /* hp200/300 HP-UX binary */ -#define MID_HPUX800 0x20B /* hp800 HP-UX binary */ - -/* - * a_flags - */ -#define EX_PIC 0x10 /* contains position independant code */ -#define EX_DYNAMIC 0x20 /* contains run-time link-edit info */ -#define EX_DPMASK 0x30 /* mask for the above */ - -#endif /* !_IMGACT_AOUT_H_ */ diff --git a/usr/src/grub/grub-0.95/stage2/iso9660.h b/usr/src/grub/grub-0.95/stage2/iso9660.h deleted file mode 100644 index 83d0019775..0000000000 --- a/usr/src/grub/grub-0.95/stage2/iso9660.h +++ /dev/null @@ -1,219 +0,0 @@ -/* - * ISO 9660 filesystem backend for GRUB (GRand Unified Bootloader) - * including Rock Ridge Extensions support - * - * Copyright (C) 1998, 1999 Kousuke Takai - * - * 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. - */ -/* - * References: - * linux/fs/isofs/rock.[ch] - * mkisofs-1.11.1/diag/isoinfo.c - * mkisofs-1.11.1/iso9660.h - * (all are written by Eric Youngdale) - */ - -#ifndef _ISO9660_H_ -#define _ISO9660_H_ - -#define ISO_SECTOR_BITS (11) -#define ISO_SECTOR_SIZE (1<= file system block size >= PBSIZE >= DISIZE - */ -#define PBSIZE 512 /* physical block size (in byte) */ -#define DISIZE 512 /* on-disk inode size (in byte) */ -#define L2DISIZE 9 -#define INOSPERIAG 4096 /* number of disk inodes per iag */ -#define L2INOSPERIAG 12 -#define INOSPEREXT 32 /* number of disk inode per extent */ -#define L2INOSPEREXT 5 - -/* Minimum number of bytes supported for a JFS partition */ -#define MINJFS (0x1000000) - -/* - * fixed byte offset address - */ -#define SUPER1_OFF 0x8000 /* primary superblock */ - -#define AITBL_OFF (SUPER1_OFF + PSIZE + (PSIZE << 1)) - -/* - * fixed reserved inode number - */ -/* aggregate inode */ -#define AGGREGATE_I 1 /* aggregate inode map inode */ -#define FILESYSTEM_I 16 /* 1st/only fileset inode in ait: - * fileset inode map inode - */ - -/* per fileset inode */ -#define ROOT_I 2 /* fileset root inode */ - -/* - * directory configuration - */ -#define JFS_NAME_MAX 255 -#define JFS_PATH_MAX PSIZE - -typedef unsigned char u8; -typedef char s8; -typedef unsigned short u16; -typedef short s16; -typedef unsigned int u32; -typedef int s32; -typedef unsigned long long u64; -typedef long long s64; - -typedef u16 UniChar; - -/* these from jfs_btree.h */ - -/* btpaget_t flag */ -#define BT_TYPE 0x07 /* B+-tree index */ -#define BT_ROOT 0x01 /* root page */ -#define BT_LEAF 0x02 /* leaf page */ -#define BT_INTERNAL 0x04 /* internal page */ -#define BT_RIGHTMOST 0x10 /* rightmost page */ -#define BT_LEFTMOST 0x20 /* leftmost page */ - -/* those are from jfs_types.h */ - -struct timestruc_t { - u32 tv_sec; - u32 tv_nsec; -}; - -/* - * physical xd (pxd) - */ -typedef struct { - unsigned len:24; - unsigned addr1:8; - u32 addr2; -} pxd_t; - -/* xd_t field extraction */ -#define lengthPXD(pxd) ((pxd)->len) -#define addressPXD(pxd) (((s64)((pxd)->addr1)) << 32 | ((pxd)->addr2)) - -/* - * data extent descriptor (dxd) - */ -typedef struct { - unsigned flag:8; /* 1: flags */ - unsigned rsrvd:24; /* 3: */ - u32 size; /* 4: size in byte */ - unsigned len:24; /* 3: length in unit of fsblksize */ - unsigned addr1:8; /* 1: address in unit of fsblksize */ - u32 addr2; /* 4: address in unit of fsblksize */ -} dxd_t; /* - 16 - */ - -/* - * DASD limit information - stored in directory inode - */ -typedef struct dasd { - u8 thresh; /* Alert Threshold (in percent) */ - u8 delta; /* Alert Threshold delta (in percent) */ - u8 rsrvd1; - u8 limit_hi; /* DASD limit (in logical blocks) */ - u32 limit_lo; /* DASD limit (in logical blocks) */ - u8 rsrvd2[3]; - u8 used_hi; /* DASD usage (in logical blocks) */ - u32 used_lo; /* DASD usage (in logical blocks) */ -} dasd_t; - - -/* from jfs_superblock.h */ - -#define JFS_MAGIC 0x3153464A /* "JFS1" */ - -struct jfs_superblock -{ - u32 s_magic; /* 4: magic number */ - u32 s_version; /* 4: version number */ - - s64 s_size; /* 8: aggregate size in hardware/LVM blocks; - * VFS: number of blocks - */ - s32 s_bsize; /* 4: aggregate block size in bytes; - * VFS: fragment size - */ - s16 s_l2bsize; /* 2: log2 of s_bsize */ - s16 s_l2bfactor; /* 2: log2(s_bsize/hardware block size) */ - s32 s_pbsize; /* 4: hardware/LVM block size in bytes */ - s16 s_l2pbsize; /* 2: log2 of s_pbsize */ - s16 pad; /* 2: padding necessary for alignment */ - - u32 s_agsize; /* 4: allocation group size in aggr. blocks */ - - u32 s_flag; /* 4: aggregate attributes: - * see jfs_filsys.h - */ - u32 s_state; /* 4: mount/unmount/recovery state: - * see jfs_filsys.h - */ - s32 s_compress; /* 4: > 0 if data compression */ - - pxd_t s_ait2; /* 8: first extent of secondary - * aggregate inode table - */ - - pxd_t s_aim2; /* 8: first extent of secondary - * aggregate inode map - */ - u32 s_logdev; /* 4: device address of log */ - s32 s_logserial; /* 4: log serial number at aggregate mount */ - pxd_t s_logpxd; /* 8: inline log extent */ - - pxd_t s_fsckpxd; /* 8: inline fsck work space extent */ - - struct timestruc_t s_time; /* 8: time last updated */ - - s32 s_fsckloglen; /* 4: Number of filesystem blocks reserved for - * the fsck service log. - * N.B. These blocks are divided among the - * versions kept. This is not a per - * version size. - * N.B. These blocks are included in the - * length field of s_fsckpxd. - */ - s8 s_fscklog; /* 1: which fsck service log is most recent - * 0 => no service log data yet - * 1 => the first one - * 2 => the 2nd one - */ - char s_fpack[11]; /* 11: file system volume name - * N.B. This must be 11 bytes to - * conform with the OS/2 BootSector - * requirements - */ - - /* extendfs() parameter under s_state & FM_EXTENDFS */ - s64 s_xsize; /* 8: extendfs s_size */ - pxd_t s_xfsckpxd; /* 8: extendfs fsckpxd */ - pxd_t s_xlogpxd; /* 8: extendfs logpxd */ - /* - 128 byte boundary - */ - - /* - * DFS VFS support (preliminary) - */ - char s_attach; /* 1: VFS: flag: set when aggregate is attached - */ - u8 rsrvd4[7]; /* 7: reserved - set to 0 */ - - u64 totalUsable; /* 8: VFS: total of 1K blocks which are - * available to "normal" (non-root) users. - */ - u64 minFree; /* 8: VFS: # of 1K blocks held in reserve for - * exclusive use of root. This value can be 0, - * and if it is then totalUsable will be equal - * to # of blocks in aggregate. I believe this - * means that minFree + totalUsable = # blocks. - * In that case, we don't need to store both - * totalUsable and minFree since we can compute - * one from the other. I would guess minFree - * would be the one we should store, and - * totalUsable would be the one we should - * compute. (Just a guess...) - */ - - u64 realFree; /* 8: VFS: # of free 1K blocks can be used by - * "normal" users. It may be this is something - * we should compute when asked for instead of - * storing in the superblock. I don't know how - * often this information is needed. - */ - /* - * graffiti area - */ -}; - -/* from jfs_dtree.h */ - -/* - * entry segment/slot - * - * an entry consists of type dependent head/only segment/slot and - * additional segments/slots linked vi next field; - * N.B. last/only segment of entry is terminated by next = -1; - */ -/* - * directory page slot - */ -typedef struct { - s8 next; /* 1: */ - s8 cnt; /* 1: */ - UniChar name[15]; /* 30: */ -} dtslot_t; /* (32) */ - -#define DTSLOTDATALEN 15 - -/* - * internal node entry head/only segment - */ -typedef struct { - pxd_t xd; /* 8: child extent descriptor */ - - s8 next; /* 1: */ - u8 namlen; /* 1: */ - UniChar name[11]; /* 22: 2-byte aligned */ -} idtentry_t; /* (32) */ - -/* - * leaf node entry head/only segment - * - * For legacy filesystems, name contains 13 unichars -- no index field - */ -typedef struct { - u32 inumber; /* 4: 4-byte aligned */ - s8 next; /* 1: */ - u8 namlen; /* 1: */ - UniChar name[11]; /* 22: 2-byte aligned */ - u32 index; /* 4: index into dir_table */ -} ldtentry_t; /* (32) */ - -#define DTLHDRDATALEN 11 - -/* - * dir_table used for directory traversal during readdir -*/ - -/* - * Maximum entry in inline directory table - */ - -typedef struct dir_table_slot { - u8 rsrvd; /* 1: */ - u8 flag; /* 1: 0 if free */ - u8 slot; /* 1: slot within leaf page of entry */ - u8 addr1; /* 1: upper 8 bits of leaf page address */ - u32 addr2; /* 4: lower 32 bits of leaf page address -OR- - index of next entry when this entry was deleted */ -} dir_table_slot_t; /* (8) */ - -/* - * directory root page (in-line in on-disk inode): - * - * cf. dtpage_t below. - */ -typedef union { - struct { - dasd_t DASD; /* 16: DASD limit/usage info F226941 */ - - u8 flag; /* 1: */ - s8 nextindex; /* 1: next free entry in stbl */ - s8 freecnt; /* 1: free count */ - s8 freelist; /* 1: freelist header */ - - u32 idotdot; /* 4: parent inode number */ - - s8 stbl[8]; /* 8: sorted entry index table */ - } header; /* (32) */ - - dtslot_t slot[9]; -} dtroot_t; - -/* - * directory regular page: - * - * entry slot array of 32 byte slot - * - * sorted entry slot index table (stbl): - * contiguous slots at slot specified by stblindex, - * 1-byte per entry - * 512 byte block: 16 entry tbl (1 slot) - * 1024 byte block: 32 entry tbl (1 slot) - * 2048 byte block: 64 entry tbl (2 slot) - * 4096 byte block: 128 entry tbl (4 slot) - * - * data area: - * 512 byte block: 16 - 2 = 14 slot - * 1024 byte block: 32 - 2 = 30 slot - * 2048 byte block: 64 - 3 = 61 slot - * 4096 byte block: 128 - 5 = 123 slot - * - * N.B. index is 0-based; index fields refer to slot index - * except nextindex which refers to entry index in stbl; - * end of entry stot list or freelist is marked with -1. - */ -typedef union { - struct { - s64 next; /* 8: next sibling */ - s64 prev; /* 8: previous sibling */ - - u8 flag; /* 1: */ - s8 nextindex; /* 1: next entry index in stbl */ - s8 freecnt; /* 1: */ - s8 freelist; /* 1: slot index of head of freelist */ - - u8 maxslot; /* 1: number of slots in page slot[] */ - s8 stblindex; /* 1: slot index of start of stbl */ - u8 rsrvd[2]; /* 2: */ - - pxd_t self; /* 8: self pxd */ - } header; /* (32) */ - - dtslot_t slot[128]; -} dtpage_t; - -/* from jfs_xtree.h */ - -/* - * extent allocation descriptor (xad) - */ -typedef struct xad { - unsigned flag:8; /* 1: flag */ - unsigned rsvrd:16; /* 2: reserved */ - unsigned off1:8; /* 1: offset in unit of fsblksize */ - u32 off2; /* 4: offset in unit of fsblksize */ - unsigned len:24; /* 3: length in unit of fsblksize */ - unsigned addr1:8; /* 1: address in unit of fsblksize */ - u32 addr2; /* 4: address in unit of fsblksize */ -} xad_t; /* (16) */ - -/* xad_t field extraction */ -#define offsetXAD(xad) (((s64)((xad)->off1)) << 32 | ((xad)->off2)) -#define addressXAD(xad) (((s64)((xad)->addr1)) << 32 | ((xad)->addr2)) -#define lengthXAD(xad) ((xad)->len) - -/* possible values for maxentry */ -#define XTPAGEMAXSLOT 256 -#define XTENTRYSTART 2 - -/* - * xtree page: - */ -typedef union { - struct xtheader { - s64 next; /* 8: */ - s64 prev; /* 8: */ - - u8 flag; /* 1: */ - u8 rsrvd1; /* 1: */ - s16 nextindex; /* 2: next index = number of entries */ - s16 maxentry; /* 2: max number of entries */ - s16 rsrvd2; /* 2: */ - - pxd_t self; /* 8: self */ - } header; /* (32) */ - - xad_t xad[XTPAGEMAXSLOT]; /* 16 * maxentry: xad array */ -} xtpage_t; - -/* from jfs_dinode.h */ - -struct dinode { - /* - * I. base area (128 bytes) - * ------------------------ - * - * define generic/POSIX attributes - */ - u32 di_inostamp; /* 4: stamp to show inode belongs to fileset */ - s32 di_fileset; /* 4: fileset number */ - u32 di_number; /* 4: inode number, aka file serial number */ - u32 di_gen; /* 4: inode generation number */ - - pxd_t di_ixpxd; /* 8: inode extent descriptor */ - - s64 di_size; /* 8: size */ - s64 di_nblocks; /* 8: number of blocks allocated */ - - u32 di_nlink; /* 4: number of links to the object */ - - u32 di_uid; /* 4: user id of owner */ - u32 di_gid; /* 4: group id of owner */ - - u32 di_mode; /* 4: attribute, format and permission */ - - struct timestruc_t di_atime; /* 8: time last data accessed */ - struct timestruc_t di_ctime; /* 8: time last status changed */ - struct timestruc_t di_mtime; /* 8: time last data modified */ - struct timestruc_t di_otime; /* 8: time created */ - - dxd_t di_acl; /* 16: acl descriptor */ - - dxd_t di_ea; /* 16: ea descriptor */ - - s32 di_next_index; /* 4: Next available dir_table index */ - - s32 di_acltype; /* 4: Type of ACL */ - - /* - * Extension Areas. - * - * Historically, the inode was partitioned into 4 128-byte areas, - * the last 3 being defined as unions which could have multiple - * uses. The first 96 bytes had been completely unused until - * an index table was added to the directory. It is now more - * useful to describe the last 3/4 of the inode as a single - * union. We would probably be better off redesigning the - * entire structure from scratch, but we don't want to break - * commonality with OS/2's JFS at this time. - */ - union { - struct { - /* - * This table contains the information needed to - * find a directory entry from a 32-bit index. - * If the index is small enough, the table is inline, - * otherwise, an x-tree root overlays this table - */ - dir_table_slot_t _table[12]; /* 96: inline */ - - dtroot_t _dtroot; /* 288: dtree root */ - } _dir; /* (384) */ -#define di_dirtable u._dir._table -#define di_dtroot u._dir._dtroot -#define di_parent di_dtroot.header.idotdot -#define di_DASD di_dtroot.header.DASD - - struct { - union { - u8 _data[96]; /* 96: unused */ - struct { - void *_imap; /* 4: unused */ - u32 _gengen; /* 4: generator */ - } _imap; - } _u1; /* 96: */ -#define di_gengen u._file._u1._imap._gengen - - union { - xtpage_t _xtroot; - struct { - u8 unused[16]; /* 16: */ - dxd_t _dxd; /* 16: */ - union { - u32 _rdev; /* 4: */ - u8 _fastsymlink[128]; - } _u; - u8 _inlineea[128]; - } _special; - } _u2; - } _file; -#define di_xtroot u._file._u2._xtroot -#define di_dxd u._file._u2._special._dxd -#define di_btroot di_xtroot -#define di_inlinedata u._file._u2._special._u -#define di_rdev u._file._u2._special._u._rdev -#define di_fastsymlink u._file._u2._special._u._fastsymlink -#define di_inlineea u._file._u2._special._inlineea - } u; -}; - -typedef struct dinode dinode_t; - -/* di_mode */ -#define IFMT 0xF000 /* S_IFMT - mask of file type */ -#define IFDIR 0x4000 /* S_IFDIR - directory */ -#define IFREG 0x8000 /* S_IFREG - regular file */ -#define IFLNK 0xA000 /* S_IFLNK - symbolic link */ - -/* extended mode bits (on-disk inode di_mode) */ -#define INLINEEA 0x00040000 /* inline EA area free */ - -/* from jfs_imap.h */ - -#define EXTSPERIAG 128 /* number of disk inode extent per iag */ -#define SMAPSZ 4 /* number of words per summary map */ -#define MAXAG 128 /* maximum number of allocation groups */ - -/* - * inode allocation map: - * - * inode allocation map consists of - * . the inode map control page and - * . inode allocation group pages (per 4096 inodes) - * which are addressed by standard JFS xtree. - */ -/* - * inode allocation group page (per 4096 inodes of an AG) - */ -typedef struct { - s64 agstart; /* 8: starting block of ag */ - s32 iagnum; /* 4: inode allocation group number */ - s32 inofreefwd; /* 4: ag inode free list forward */ - s32 inofreeback; /* 4: ag inode free list back */ - s32 extfreefwd; /* 4: ag inode extent free list forward */ - s32 extfreeback; /* 4: ag inode extent free list back */ - s32 iagfree; /* 4: iag free list */ - - /* summary map: 1 bit per inode extent */ - s32 inosmap[SMAPSZ]; /* 16: sum map of mapwords w/ free inodes; - * note: this indicates free and backed - * inodes, if the extent is not backed the - * value will be 1. if the extent is - * backed but all inodes are being used the - * value will be 1. if the extent is - * backed but at least one of the inodes is - * free the value will be 0. - */ - s32 extsmap[SMAPSZ]; /* 16: sum map of mapwords w/ free extents */ - s32 nfreeinos; /* 4: number of free inodes */ - s32 nfreeexts; /* 4: number of free extents */ - /* (72) */ - u8 pad[1976]; /* 1976: pad to 2048 bytes */ - /* allocation bit map: 1 bit per inode (0 - free, 1 - allocated) */ - u32 wmap[EXTSPERIAG]; /* 512: working allocation map */ - u32 pmap[EXTSPERIAG]; /* 512: persistent allocation map */ - pxd_t inoext[EXTSPERIAG]; /* 1024: inode extent addresses */ -} iag_t; /* (4096) */ - -#endif /* _JFS_H_ */ diff --git a/usr/src/grub/grub-0.95/stage2/mb_header.h b/usr/src/grub/grub-0.95/stage2/mb_header.h deleted file mode 100644 index 21934574f3..0000000000 --- a/usr/src/grub/grub-0.95/stage2/mb_header.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 2000 Free Software Foundation, 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 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. - */ - -/* - * MultiBoot Header description - */ - -struct multiboot_header -{ - /* Must be MULTIBOOT_MAGIC - see below. */ - unsigned magic; - - /* Feature flags - see below. */ - unsigned flags; - - /* - * Checksum - * - * The above fields plus this one must equal 0 mod 2^32. - */ - unsigned checksum; - - /* These are only valid if MULTIBOOT_AOUT_KLUDGE is set. */ - unsigned header_addr; - unsigned load_addr; - unsigned load_end_addr; - unsigned bss_end_addr; - unsigned entry_addr; - - /* These are only valid if MULTIBOOT_VIDEO_MODE is set. */ - unsigned mode_type; - unsigned width; - unsigned height; - unsigned depth; -}; - -/* - * The entire multiboot_header must be contained - * within the first MULTIBOOT_SEARCH bytes of the kernel image. - */ -#define MULTIBOOT_SEARCH 8192 -#define MULTIBOOT_FOUND(addr, len) \ - (! ((addr) & 0x3) \ - && (len) >= 12 \ - && *((int *) (addr)) == MULTIBOOT_MAGIC \ - && ! (*((unsigned *) (addr)) + *((unsigned *) (addr + 4)) \ - + *((unsigned *) (addr + 8))) \ - && (! (MULTIBOOT_AOUT_KLUDGE & *((int *) (addr + 4))) || (len) >= 32) \ - && (! (MULTIBOOT_VIDEO_MODE & *((int *) (addr + 4))) || (len) >= 48)) - -/* Magic value identifying the multiboot_header. */ -#define MULTIBOOT_MAGIC 0x1BADB002 - -/* - * Features flags for 'flags'. - * If a boot loader sees a flag in MULTIBOOT_MUSTKNOW set - * and it doesn't understand it, it must fail. - */ -#define MULTIBOOT_MUSTKNOW 0x0000FFFF - -/* currently unsupported flags... this is a kind of version number. */ -#define MULTIBOOT_UNSUPPORTED 0x0000FFF8 - -/* Align all boot modules on i386 page (4KB) boundaries. */ -#define MULTIBOOT_PAGE_ALIGN 0x00000001 - -/* Must pass memory information to OS. */ -#define MULTIBOOT_MEMORY_INFO 0x00000002 - -/* Must pass video information to OS. */ -#define MULTIBOOT_VIDEO_MODE 0x00000004 - -/* This flag indicates the use of the address fields in the header. */ -#define MULTIBOOT_AOUT_KLUDGE 0x00010000 diff --git a/usr/src/grub/grub-0.95/stage2/mb_info.h b/usr/src/grub/grub-0.95/stage2/mb_info.h deleted file mode 100644 index 1e1e63bae6..0000000000 --- a/usr/src/grub/grub-0.95/stage2/mb_info.h +++ /dev/null @@ -1,217 +0,0 @@ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 2000,2003 Free Software Foundation, 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 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. - */ - -/* - * The structure type "mod_list" is used by the "multiboot_info" structure. - */ - -struct mod_list -{ - /* the memory used goes from bytes 'mod_start' to 'mod_end-1' inclusive */ - unsigned long mod_start; - unsigned long mod_end; - - /* Module command line */ - unsigned long cmdline; - - /* padding to take it to 16 bytes (must be zero) */ - unsigned long pad; -}; - - -/* - * INT-15, AX=E820 style "AddressRangeDescriptor" - * ...with a "size" parameter on the front which is the structure size - 4, - * pointing to the next one, up until the full buffer length of the memory - * map has been reached. - */ - -struct AddrRangeDesc -{ - unsigned long size; - unsigned long long BaseAddr; - unsigned long long Length; - unsigned long Type; - - /* unspecified optional padding... */ -} __attribute__ ((packed)); - -/* usable memory "Type", all others are reserved. */ -#define MB_ARD_MEMORY 1 - - -/* Drive Info structure. */ -struct drive_info -{ - /* The size of this structure. */ - unsigned long size; - - /* The BIOS drive number. */ - unsigned char drive_number; - - /* The access mode (see below). */ - unsigned char drive_mode; - - /* The BIOS geometry. */ - unsigned short drive_cylinders; - unsigned char drive_heads; - unsigned char drive_sectors; - - /* The array of I/O ports used for the drive. */ - unsigned short drive_ports[0]; -}; - -/* Drive Mode. */ -#define MB_DI_CHS_MODE 0 -#define MB_DI_LBA_MODE 1 - - -/* APM BIOS info. */ -struct apm_info -{ - unsigned short version; - unsigned short cseg; - unsigned long offset; - unsigned short cseg_16; - unsigned short dseg_16; - unsigned short cseg_len; - unsigned short cseg_16_len; - unsigned short dseg_16_len; -}; - - -/* - * MultiBoot Info description - * - * This is the struct passed to the boot image. This is done by placing - * its address in the EAX register. - */ - -struct multiboot_info -{ - /* MultiBoot info version number */ - unsigned long flags; - - /* Available memory from BIOS */ - unsigned long mem_lower; - unsigned long mem_upper; - - /* "root" partition */ - unsigned long boot_device; - - /* Kernel command line */ - unsigned long cmdline; - - /* Boot-Module list */ - unsigned long mods_count; - unsigned long mods_addr; - - union - { - struct - { - /* (a.out) Kernel symbol table info */ - unsigned long tabsize; - unsigned long strsize; - unsigned long addr; - unsigned long pad; - } - a; - - struct - { - /* (ELF) Kernel section header table */ - unsigned long num; - unsigned long size; - unsigned long addr; - unsigned long shndx; - } - e; - } - syms; - - /* Memory Mapping buffer */ - unsigned long mmap_length; - unsigned long mmap_addr; - - /* Drive Info buffer */ - unsigned long drives_length; - unsigned long drives_addr; - - /* ROM configuration table */ - unsigned long config_table; - - /* Boot Loader Name */ - unsigned long boot_loader_name; - - /* APM table */ - unsigned long apm_table; - - /* Video */ - unsigned long vbe_control_info; - unsigned long vbe_mode_info; - unsigned short vbe_mode; - unsigned short vbe_interface_seg; - unsigned short vbe_interface_off; - unsigned short vbe_interface_len; -}; - -/* - * Flags to be set in the 'flags' parameter above - */ - -/* is there basic lower/upper memory information? */ -#define MB_INFO_MEMORY 0x00000001 -/* is there a boot device set? */ -#define MB_INFO_BOOTDEV 0x00000002 -/* is the command-line defined? */ -#define MB_INFO_CMDLINE 0x00000004 -/* are there modules to do something with? */ -#define MB_INFO_MODS 0x00000008 - -/* These next two are mutually exclusive */ - -/* is there a symbol table loaded? */ -#define MB_INFO_AOUT_SYMS 0x00000010 -/* is there an ELF section header table? */ -#define MB_INFO_ELF_SHDR 0x00000020 - -/* is there a full memory map? */ -#define MB_INFO_MEM_MAP 0x00000040 - -/* Is there drive info? */ -#define MB_INFO_DRIVE_INFO 0x00000080 - -/* Is there a config table? */ -#define MB_INFO_CONFIG_TABLE 0x00000100 - -/* Is there a boot loader name? */ -#define MB_INFO_BOOT_LOADER_NAME 0x00000200 - -/* Is there a APM table? */ -#define MB_INFO_APM_TABLE 0x00000400 - -/* Is there video information? */ -#define MB_INFO_VIDEO_INFO 0x00000800 - -/* - * The following value must be present in the EAX register. - */ - -#define MULTIBOOT_VALID 0x2BADB002 diff --git a/usr/src/grub/grub-0.95/stage2/md5.c b/usr/src/grub/grub-0.95/stage2/md5.c deleted file mode 100644 index 21205bad70..0000000000 --- a/usr/src/grub/grub-0.95/stage2/md5.c +++ /dev/null @@ -1,383 +0,0 @@ -/* md5.c - an implementation of the MD5 algorithm and MD5 crypt */ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 2000, 2001 Free Software Foundation, 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 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. - */ - -/* See RFC 1321 for a description of the MD5 algorithm. - */ - -#include -#ifndef TEST -# include -#endif - -#ifdef TEST -# include -# define USE_MD5_PASSWORDS -# define USE_MD5 -#endif - -#ifdef USE_MD5_PASSWORDS -# define USE_MD5 -#endif - -#ifdef USE_MD5 - -#define cpu_to_le32(x) (x) -#define le32_to_cpu(x) cpu_to_le32(x) -typedef unsigned int UINT4; - -/* F, G, H and I are basic MD5 functions. - */ -#define F(x, y, z) (((x) & (y)) | ((~x) & (z))) -#define G(x, y, z) (((x) & (z)) | ((y) & (~z))) -#define H(x, y, z) ((x) ^ (y) ^ (z)) -#define I(x, y, z) ((y) ^ ((x) | (~z))) - -/* ROTATE_LEFT rotates x left n bits. - */ -#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x >> (32 - (n))))) - -static UINT4 initstate[4] = -{ - 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476 -}; - -static char s1[4] = { 7, 12, 17, 22 }; -static char s2[4] = { 5, 9, 14, 20 }; -static char s3[4] = { 4, 11, 16, 23 }; -static char s4[4] = { 6, 10, 15, 21 }; - -static UINT4 T[64] = -{ - 0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee, - 0xf57c0faf, 0x4787c62a, 0xa8304613, 0xfd469501, - 0x698098d8, 0x8b44f7af, 0xffff5bb1, 0x895cd7be, - 0x6b901122, 0xfd987193, 0xa679438e, 0x49b40821, - 0xf61e2562, 0xc040b340, 0x265e5a51, 0xe9b6c7aa, - 0xd62f105d, 0x02441453, 0xd8a1e681, 0xe7d3fbc8, - 0x21e1cde6, 0xc33707d6, 0xf4d50d87, 0x455a14ed, - 0xa9e3e905, 0xfcefa3f8, 0x676f02d9, 0x8d2a4c8a, - 0xfffa3942, 0x8771f681, 0x6d9d6122, 0xfde5380c, - 0xa4beea44, 0x4bdecfa9, 0xf6bb4b60, 0xbebfbc70, - 0x289b7ec6, 0xeaa127fa, 0xd4ef3085, 0x04881d05, - 0xd9d4d039, 0xe6db99e5, 0x1fa27cf8, 0xc4ac5665, - 0xf4292244, 0x432aff97, 0xab9423a7, 0xfc93a039, - 0x655b59c3, 0x8f0ccc92, 0xffeff47d, 0x85845dd1, - 0x6fa87e4f, 0xfe2ce6e0, 0xa3014314, 0x4e0811a1, - 0xf7537e82, 0xbd3af235, 0x2ad7d2bb, 0xeb86d391 -}; - -static const char *b64t = -"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; - -static UINT4 state[4]; -static unsigned int length; -static unsigned char buffer[64]; - -static void -md5_transform (const unsigned char block[64]) -{ - int i, j; - UINT4 a,b,c,d,tmp; - const UINT4 *x = (UINT4 *) block; - - a = state[0]; - b = state[1]; - c = state[2]; - d = state[3]; - - /* Round 1 */ - for (i = 0; i < 16; i++) - { - tmp = a + F (b, c, d) + le32_to_cpu (x[i]) + T[i]; - tmp = ROTATE_LEFT (tmp, s1[i & 3]); - tmp += b; - a = d; d = c; c = b; b = tmp; - } - /* Round 2 */ - for (i = 0, j = 1; i < 16; i++, j += 5) - { - tmp = a + G (b, c, d) + le32_to_cpu (x[j & 15]) + T[i+16]; - tmp = ROTATE_LEFT (tmp, s2[i & 3]); - tmp += b; - a = d; d = c; c = b; b = tmp; - } - /* Round 3 */ - for (i = 0, j = 5; i < 16; i++, j += 3) - { - tmp = a + H (b, c, d) + le32_to_cpu (x[j & 15]) + T[i+32]; - tmp = ROTATE_LEFT (tmp, s3[i & 3]); - tmp += b; - a = d; d = c; c = b; b = tmp; - } - /* Round 4 */ - for (i = 0, j = 0; i < 16; i++, j += 7) - { - tmp = a + I (b, c, d) + le32_to_cpu (x[j & 15]) + T[i+48]; - tmp = ROTATE_LEFT (tmp, s4[i & 3]); - tmp += b; - a = d; d = c; c = b; b = tmp; - } - - state[0] += a; - state[1] += b; - state[2] += c; - state[3] += d; -} - -static void -md5_init(void) -{ - memcpy ((char *) state, (char *) initstate, sizeof (initstate)); - length = 0; -} - -static void -md5_update (const char *input, int inputlen) -{ - int buflen = length & 63; - length += inputlen; - if (buflen + inputlen < 64) - { - memcpy (buffer + buflen, input, inputlen); - buflen += inputlen; - return; - } - - memcpy (buffer + buflen, input, 64 - buflen); - md5_transform (buffer); - input += 64 - buflen; - inputlen -= 64 - buflen; - while (inputlen >= 64) - { - md5_transform (input); - input += 64; - inputlen -= 64; - } - memcpy (buffer, input, inputlen); - buflen = inputlen; -} - -static unsigned char * -md5_final() -{ - int i, buflen = length & 63; - - buffer[buflen++] = 0x80; - memset (buffer+buflen, 0, 64 - buflen); - if (buflen > 56) - { - md5_transform (buffer); - memset (buffer, 0, 64); - buflen = 0; - } - - *(UINT4 *) (buffer + 56) = cpu_to_le32 (8 * length); - *(UINT4 *) (buffer + 60) = 0; - md5_transform (buffer); - - for (i = 0; i < 4; i++) - state[i] = cpu_to_le32 (state[i]); - return (unsigned char *) state; -} - -#ifdef USE_MD5_PASSWORDS -/* If CHECK is true, check a password for correctness. Returns 0 - if password was correct, and a value != 0 for error, similarly - to strcmp. - If CHECK is false, crypt KEY and save the result in CRYPTED. - CRYPTED must have a salt. */ -int -md5_password (const char *key, char *crypted, int check) -{ - int keylen = strlen (key); - char *salt = crypted + 3; /* skip $1$ header */ - char *p; - int saltlen; - int i, n; - unsigned char alt_result[16]; - unsigned char *digest; - - if (check) - { - /* If our crypted password isn't 3 chars, then it can't be md5 - crypted. So, they don't match. */ - if (strlen(crypted) <= 3) - return 1; - - saltlen = strstr (salt, "$") - salt; - } - else - { - char *end = strstr (salt, "$"); - if (end && end - salt < 8) - saltlen = end - salt; - else - saltlen = 8; - - salt[saltlen] = '$'; - } - - md5_init (); - md5_update (key, keylen); - md5_update (salt, saltlen); - md5_update (key, keylen); - digest = md5_final (); - memcpy (alt_result, digest, 16); - - memcpy ((char *) state, (char *) initstate, sizeof (initstate)); - length = 0; - md5_update (key, keylen); - md5_update (crypted, 3 + saltlen); /* include the $1$ header */ - for (i = keylen; i > 16; i -= 16) - md5_update (alt_result, 16); - md5_update (alt_result, i); - - for (i = keylen; i > 0; i >>= 1) - md5_update (key + ((i & 1) ? keylen : 0), 1); - digest = md5_final (); - - for (i = 0; i < 1000; i++) - { - memcpy (alt_result, digest, 16); - - memcpy ((char *) state, (char *) initstate, sizeof (initstate)); - length = 0; - if ((i & 1) != 0) - md5_update (key, keylen); - else - md5_update (alt_result, 16); - - if (i % 3 != 0) - md5_update (salt, saltlen); - - if (i % 7 != 0) - md5_update (key, keylen); - - if ((i & 1) != 0) - md5_update (alt_result, 16); - else - md5_update (key, keylen); - digest = md5_final (); - } - - p = salt + saltlen + 1; - for (i = 0; i < 5; i++) - { - unsigned int w = - digest[i == 4 ? 5 : 12+i] | (digest[6+i] << 8) | (digest[i] << 16); - for (n = 4; n-- > 0;) - { - if (check) - { - if (*p++ != b64t[w & 0x3f]) - return 1; - } - else - { - *p++ = b64t[w & 0x3f]; - } - - w >>= 6; - } - } - { - unsigned int w = digest[11]; - for (n = 2; n-- > 0;) - { - if (check) - { - if (*p++ != b64t[w & 0x3f]) - return 1; - } - else - { - *p++ = b64t[w & 0x3f]; - } - - w >>= 6; - } - } - - if (! check) - *p = '\0'; - - return *p; -} -#endif - -#ifdef TEST -static char * -md5 (const char *input) -{ - memcpy ((char *) state, (char *) initstate, sizeof (initstate)); - length = 0; - md5_update (input, strlen (input)); - return md5_final (); -} - -static void -test (char *buffer, char *expected) -{ - char result[16 * 3 +1]; - unsigned char* digest = md5 (buffer); - int i; - - for (i=0; i < 16; i++) - sprintf (result+2*i, "%02x", digest[i]); - - if (strcmp (result, expected)) - printf ("MD5(%s) failed: %s\n", buffer, result); - else - printf ("MD5(%s) OK\n", buffer); -} - -int -main (void) -{ - test ("", "d41d8cd98f00b204e9800998ecf8427e"); - test ("a", "0cc175b9c0f1b6a831c399e269772661"); - test ("abc", "900150983cd24fb0d6963f7d28e17f72"); - test ("message digest", "f96b697d7cb7938d525a2f31aaf161d0"); - test ("abcdefghijklmnopqrstuvwxyz", "c3fcd3d76192e4007dfb496cca67e13b"); - test ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", - "d174ab98d277d9f5a5611c2c9f419d9f"); - test ("12345678901234567890123456789012345678901234567890123456789012345678901234567890", - "57edf4a22be3c955ac49da2e2107b67a"); - test ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz3456", - "6831fa90115bb9a54fbcd4f9fee0b5c4"); - test ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz345", - "bc40505cc94a43b7ff3e2ac027325233"); - test ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz34567", - "fa94b73a6f072a0239b52acacfbcf9fa"); - test ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz345678901234", - "bd201eae17f29568927414fa326f1267"); - test ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz34567890123", - "80063db1e6b70a2e91eac903f0e46b85"); - - if (check_md5_password ("Hello world!", - "$1$saltstri$YMyguxXMBpd2TEZ.vS/3q1")) - printf ("Password differs\n"); - else - printf ("Password OK\n"); - return 0; -} -#endif - -#endif diff --git a/usr/src/grub/grub-0.95/stage2/md5.h b/usr/src/grub/grub-0.95/stage2/md5.h deleted file mode 100644 index c1dbd06074..0000000000 --- a/usr/src/grub/grub-0.95/stage2/md5.h +++ /dev/null @@ -1,30 +0,0 @@ -/* md5.h - an implementation of the MD5 algorithm and MD5 crypt */ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 2000 Free Software Foundation, 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 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. - */ - -/* If CHECK is true, check a password for correctness. Returns 0 - if password was correct, and a value != 0 for error, similarly - to strcmp. - If CHECK is false, crypt KEY and save the result in CRYPTED. - CRYPTED must have a salt. */ -extern int md5_password (const char *key, char *crypted, int check); - -/* For convenience. */ -#define check_md5_password(key,crypted) md5_password((key), (crypted), 1) -#define make_md5_password(key,crypted) md5_password((key), (crypted), 0) diff --git a/usr/src/grub/grub-0.95/stage2/nbi.h b/usr/src/grub/grub-0.95/stage2/nbi.h deleted file mode 100644 index 3f70e21caf..0000000000 --- a/usr/src/grub/grub-0.95/stage2/nbi.h +++ /dev/null @@ -1,33 +0,0 @@ -/* nbi.h - definitions for Net Boot Image */ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 2000 Free Software Foundation, 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 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 GRUB_NBI_HEADER -#define GRUB_NBI_HEADER - -#define NBI_MAGIC 0x1B031336 -#define NBI_DEST_ADDR 0x10000 -#define NBI_DEST_SEG 0x1000 -#define NBI_DEST_OFF 0x0000 -#define RELOCATED_ADDR 0x8000 -#define RELOCATED_SEG 0x0800 -#define RELOCATED_OFF 0x0000 -#define STAGE2_START_ADDR 0x8200 - -#endif /* ! GRUB_NBI_HEADER */ diff --git a/usr/src/grub/grub-0.95/stage2/nbloader.S b/usr/src/grub/grub-0.95/stage2/nbloader.S deleted file mode 100644 index 57ad936551..0000000000 --- a/usr/src/grub/grub-0.95/stage2/nbloader.S +++ /dev/null @@ -1,121 +0,0 @@ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 2000 Free Software Foundation, 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 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 -#include - - .file "nbloader.S" - .text - .code16 - - /* Just a dummy entry */ -.globl _start; _start: - - /* - * netboot image header - */ - - .long NBI_MAGIC - .long 0x00000004 - /* load address of the first block */ - .word NBI_DEST_OFF - .word NBI_DEST_SEG - /* start addr of the relocation code */ - .word NBI_DEST_OFF + (relocate - _start) - .word NBI_DEST_SEG - - .long 0x04000004 - .long NBI_DEST_ADDR + 0x0200 - .long DISKLESS_SIZE - .long DISKLESS_SIZE - -relocate: - /* - * This code is for now located at 0x10000. - * Relocate the code in two steps: - * 1. Copy the first 32k to 0x8000 and jump to the relocated area. - * 2. Copy the rest to 0x10000 (0x8000 + 32k). - */ - - /* Copy the first 32k */ - movw $NBI_DEST_SEG, %ax - movw %ax, %ds - movw $RELOCATED_SEG, %ax - movw %ax, %es - xorw %si, %si - xorw %di, %di - /* Always copy 32k bytes */ - movw $0x4000, %cx - - cld - rep - movsw - - /* Jump to the relocated address */ - ljmp $0, $(RELOCATED_ADDR + copy_rest - _start) - - /* Copy the rest */ -copy_rest: - /* Set %edx to the number of bytes */ - movl $(DISKLESS_SIZE + 0x200 - 0x8000), %edx - -copy_loop: - /* Check the rest */ - orl %edx, %edx - jz boot_stage2 - - /* Copy by 32k, as that is easy to implement */ - movl $0x8000, %ecx - cmpl %ecx, %edx - jg copy - movl %edx, %ecx - -copy: - /* Update the number of rest bytes */ - subl %ecx, %edx - - /* Add 0x0800 (32k >> 4) into %es and %ds */ - movw %es, %ax - addw $0x0800, %ax - movw %ax, %es - movw %ds, %ax - addw $0x800, %ax - movw %ax, %ds - - /* Zero the offsets */ - xorw %si, %si - xorw %di, %di - - /* Use word-size copy */ - addw $1, %cx - shrw $1, %cx - - /* The direction is already correct */ - rep - movsw - - jmp copy_loop - - /* Jump to the stage2 */ -boot_stage2: - ljmp $0, $STAGE2_START_ADDR - - /* This ensures that the length of this image will be 1 sector */ - . = _start + 0x200 - 1 - .byte 0 diff --git a/usr/src/grub/grub-0.95/stage2/pc_slice.h b/usr/src/grub/grub-0.95/stage2/pc_slice.h deleted file mode 100644 index a237f88a26..0000000000 --- a/usr/src/grub/grub-0.95/stage2/pc_slice.h +++ /dev/null @@ -1,283 +0,0 @@ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 1999,2000,2001,2003 Free Software Foundation, 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 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 _PC_SLICE_H -#define _PC_SLICE_H - -/* - * These define the basic PC MBR sector characteristics - */ - -#define PC_MBR_SECTOR 0 - -#define PC_MBR_SIG_OFFSET 510 -#define PC_MBR_SIGNATURE 0xaa55 - -#define PC_SLICE_OFFSET 446 -#define PC_SLICE_MAX 4 - - -/* - * Defines to guarantee structural alignment. - */ - -#define PC_MBR_CHECK_SIG(mbr_ptr) \ - ( *( (unsigned short *) (((int) mbr_ptr) + PC_MBR_SIG_OFFSET) ) \ - == PC_MBR_SIGNATURE ) - -#define PC_MBR_SIG(mbr_ptr) \ - ( *( (unsigned short *) (((int) mbr_ptr) + PC_MBR_SIG_OFFSET) ) ) - -#define PC_SLICE_FLAG(mbr_ptr, part) \ - ( *( (unsigned char *) (((int) mbr_ptr) + PC_SLICE_OFFSET \ - + (part << 4)) ) ) - -#define PC_SLICE_HEAD(mbr_ptr, part) \ - ( *( (unsigned char *) (((int) mbr_ptr) + PC_SLICE_OFFSET + 1 \ - + (part << 4)) ) ) - -#define PC_SLICE_SEC(mbr_ptr, part) \ - ( *( (unsigned char *) (((int) mbr_ptr) + PC_SLICE_OFFSET + 2 \ - + (part << 4)) ) ) - -#define PC_SLICE_CYL(mbr_ptr, part) \ - ( *( (unsigned char *) (((int) mbr_ptr) + PC_SLICE_OFFSET + 3 \ - + (part << 4)) ) ) - -#define PC_SLICE_TYPE(mbr_ptr, part) \ - ( *( (unsigned char *) (((int) mbr_ptr) + PC_SLICE_OFFSET + 4 \ - + (part << 4)) ) ) - -#define PC_SLICE_EHEAD(mbr_ptr, part) \ - ( *( (unsigned char *) (((int) mbr_ptr) + PC_SLICE_OFFSET + 5 \ - + (part << 4)) ) ) - -#define PC_SLICE_ESEC(mbr_ptr, part) \ - ( *( (unsigned char *) (((int) mbr_ptr) + PC_SLICE_OFFSET + 6 \ - + (part << 4)) ) ) - -#define PC_SLICE_ECYL(mbr_ptr, part) \ - ( *( (unsigned char *) (((int) mbr_ptr) + PC_SLICE_OFFSET + 7 \ - + (part << 4)) ) ) - -#define PC_SLICE_START(mbr_ptr, part) \ - ( *( (unsigned long *) (((int) mbr_ptr) + PC_SLICE_OFFSET + 8 \ - + (part << 4)) ) ) - -#define PC_SLICE_LENGTH(mbr_ptr, part) \ - ( *( (unsigned long *) (((int) mbr_ptr) + PC_SLICE_OFFSET + 12 \ - + (part << 4)) ) ) - - -/* - * PC flag types are defined here. - */ - -#define PC_SLICE_FLAG_NONE 0 -#define PC_SLICE_FLAG_BOOTABLE 0x80 - -/* - * Known PC partition types are defined here. - */ - -/* This is not a flag actually, but used as if it were a flag. */ -#define PC_SLICE_TYPE_HIDDEN_FLAG 0x10 - -#define PC_SLICE_TYPE_NONE 0 -#define PC_SLICE_TYPE_FAT12 1 -#define PC_SLICE_TYPE_FAT16_LT32M 4 -#define PC_SLICE_TYPE_EXTENDED 5 -#define PC_SLICE_TYPE_FAT16_GT32M 6 -#define PC_SLICE_TYPE_FAT32 0xb -#define PC_SLICE_TYPE_FAT32_LBA 0xc -#define PC_SLICE_TYPE_FAT16_LBA 0xe -#define PC_SLICE_TYPE_WIN95_EXTENDED 0xf -#define PC_SLICE_TYPE_EZD 0x55 -#define PC_SLICE_TYPE_MINIX 0x80 -#define PC_SLICE_TYPE_LINUX_MINIX 0x81 -#define PC_SLICE_TYPE_SOLARIS 0x82 /* also Linux swap! */ -#define PC_SLICE_TYPE_EXT2FS 0x83 -#define PC_SLICE_TYPE_LINUX_EXTENDED 0x85 -#define PC_SLICE_TYPE_VSTAFS 0x9e -#define PC_SLICE_TYPE_SOLARIS_BOOT 0xbe /* Solaris boot (fat) */ -#define PC_SLICE_TYPE_SOLARIS2 0xbf /* new Solaris type */ -#define PC_SLICE_TYPE_DELL_UTIL 0xde -#define PC_SLICE_TYPE_LINUX_RAID 0xfd - - -/* For convinience. */ -/* Check if TYPE is a FAT partition type. Clear the hidden flag before - the check, to allow the user to mount a hidden partition in GRUB. */ -#define IS_PC_SLICE_TYPE_FAT(type) \ - ({ int _type = (type) & ~PC_SLICE_TYPE_HIDDEN_FLAG; \ - _type == PC_SLICE_TYPE_FAT12 \ - || _type == PC_SLICE_TYPE_FAT16_LT32M \ - || _type == PC_SLICE_TYPE_FAT16_GT32M \ - || _type == PC_SLICE_TYPE_FAT16_LBA \ - || _type == PC_SLICE_TYPE_FAT32 \ - || _type == PC_SLICE_TYPE_FAT32_LBA \ - || type == PC_SLICE_TYPE_SOLARIS_BOOT \ - || type == PC_SLICE_TYPE_DELL_UTIL; }) - -#define IS_PC_SLICE_TYPE_EXTENDED(type) \ - (((type) == PC_SLICE_TYPE_EXTENDED) \ - || ((type) == PC_SLICE_TYPE_WIN95_EXTENDED) \ - || ((type) == PC_SLICE_TYPE_LINUX_EXTENDED)) - -#define IS_PC_SLICE_TYPE_MINIX(type) \ - (((type) == PC_SLICE_TYPE_MINIX) \ - || ((type) == PC_SLICE_TYPE_LINUX_MINIX)) - -/* these ones are special, as they use their own partitioning scheme - to subdivide the PC partitions from there. */ -#define PC_SLICE_TYPE_FREEBSD 0xa5 -#define PC_SLICE_TYPE_OPENBSD 0xa6 -#define PC_SLICE_TYPE_NETBSD 0xa9 - -/* For convenience. */ -#define IS_PC_SLICE_TYPE_BSD_WITH_FS(type,fs) \ - ((type) == (PC_SLICE_TYPE_FREEBSD | ((fs) << 8)) \ - || (type) == (PC_SLICE_TYPE_OPENBSD | ((fs) << 8)) \ - || (type) == (PC_SLICE_TYPE_NETBSD | (fs) << 8)) - -#define IS_PC_SLICE_TYPE_BSD(type) IS_PC_SLICE_TYPE_BSD_WITH_FS(type,0) - -#define IS_PC_SLICE_TYPE_SOLARIS(type) \ - (((type) == PC_SLICE_TYPE_SOLARIS) || ((type) == PC_SLICE_TYPE_SOLARIS2)) - -/* - * *BSD-style disklabel & partition definitions. - * - * This is a subdivided slice of type 'PC_SLICE_TYPE_BSD', so all of - * these, except where noted, are relative to the slice in question. - */ - -#define BSD_LABEL_SECTOR 1 -#define BSD_LABEL_MAGIC 0x82564557 - -#define BSD_LABEL_MAG_OFFSET 0 -#define BSD_LABEL_MAG2_OFFSET 132 -#define BSD_LABEL_NPARTS_OFFSET 138 -#define BSD_LABEL_NPARTS_MAX 8 - -#define BSD_PART_OFFSET 148 - - -/* - * Defines to guarantee structural alignment. - */ - -#define BSD_LABEL_CHECK_MAG(l_ptr) \ - ( *( (unsigned long *) (((int) l_ptr) + BSD_LABEL_MAG_OFFSET) ) \ - == ( (unsigned long) BSD_LABEL_MAGIC ) ) - -#define BSD_LABEL_MAG(l_ptr) \ - ( *( (unsigned long *) (((int) l_ptr) + BSD_LABEL_MAG_OFFSET) ) ) - -#define BSD_LABEL_DTYPE(l_ptr) \ - ( *( (unsigned short *) (((int) l_ptr) + BSD_LABEL_MAG_OFFSET + 4) ) ) - -#define BSD_LABEL_NPARTS(l_ptr) \ - ( *( (unsigned short *) (((int) l_ptr) + BSD_LABEL_NPARTS_OFFSET) ) ) - -#define BSD_PART_LENGTH(l_ptr, part) \ - ( *( (unsigned long *) (((int) l_ptr) + BSD_PART_OFFSET \ - + (part << 4)) ) ) - -#define BSD_PART_START(l_ptr, part) \ - ( *( (unsigned long *) (((int) l_ptr) + BSD_PART_OFFSET + 4 \ - + (part << 4)) ) ) - -#define BSD_PART_FRAG_SIZE(l_ptr, part) \ - ( *( (unsigned long *) (((int) l_ptr) + BSD_PART_OFFSET + 8 \ - + (part << 4)) ) ) - -#define BSD_PART_TYPE(l_ptr, part) \ - ( *( (unsigned char *) (((int) l_ptr) + BSD_PART_OFFSET + 12 \ - + (part << 4)) ) ) - -#define BSD_PART_FRAGS_PER_BLOCK(l_ptr, part) \ - ( *( (unsigned char *) (((int) l_ptr) + BSD_PART_OFFSET + 13 \ - + (part << 4)) ) ) - -#define BSD_PART_EXTRA(l_ptr, part) \ - ( *( (unsigned short *) (((int) l_ptr) + BSD_PART_OFFSET + 14 \ - + (part << 4)) ) ) - - -/* possible values for the "DISKTYPE"... all essentially irrelevant - except for DTYPE_SCSI */ -#define DTYPE_SMD 1 /* SMD, XSMD; VAX hp/up */ -#define DTYPE_MSCP 2 /* MSCP */ -#define DTYPE_DEC 3 /* other DEC (rk, rl) */ -#define DTYPE_SCSI 4 /* SCSI */ -#define DTYPE_ESDI 5 /* ESDI interface */ -#define DTYPE_ST506 6 /* ST506 etc. */ -#define DTYPE_HPIB 7 /* CS/80 on HP-IB */ -#define DTYPE_HPFL 8 /* HP Fiber-link */ -#define DTYPE_FLOPPY 10 /* floppy */ - - -/* possible values for the *BSD-style partition type */ -#define FS_UNUSED 0 /* unused */ -#define FS_SWAP 1 /* swap */ -#define FS_V6 2 /* Sixth Edition */ -#define FS_V7 3 /* Seventh Edition */ -#define FS_SYSV 4 /* System V */ -#define FS_V71K 5 /* V7 with 1K blocks (4.1, 2.9) */ -#define FS_V8 6 /* Eighth Edition, 4K blocks */ -#define FS_BSDFFS 7 /* 4.2BSD fast file system */ -#define FS_MSDOS 8 /* MSDOS file system */ -#define FS_BSDLFS 9 /* 4.4BSD log-structured file system */ -#define FS_OTHER 10 /* in use, but unknown/unsupported */ -#define FS_HPFS 11 /* OS/2 high-performance file system */ -#define FS_ISO9660 12 /* ISO 9660, normally CD-ROM */ -#define FS_BOOT 13 /* partition contains bootstrap */ -#define FS_ADOS 14 /* AmigaDOS fast file system */ -#define FS_HFS 15 /* Macintosh HFS */ -#define FS_FILECORE 16 /* Acorn Filecore Filing System */ -#define FS_EXT2FS 17 /* Linux Extended 2 file system */ - - -/* - * Solaris LABEL definitions. All definitions are relative to the - * current PC_SLICE. - */ -#define SOL_LABEL_LOC 1 -#define SOL_LABEL_SIZE 512 -#define SOL_LABEL_MAGIC 0xdabe -#define SOL_LABEL_MAGIC_OFFSET 0x1fc -#define SOL_LABEL_NPARTS 0x10 - -#define SOL_PART_OFFSET 0x48 - -#define SOL_LABEL_CHECK_MAG(l_ptr) \ - (*((unsigned short *) (((int) l_ptr) + SOL_LABEL_MAGIC_OFFSET)) \ - == ((unsigned short) SOL_LABEL_MAGIC )) - -#define SOL_PART_START(l_ptr, p) \ - (*((unsigned long *) (((int) l_ptr) + SOL_PART_OFFSET + (p) * 0xc + 4))) - -#define SOL_PART_LENGTH(l_ptr, p) \ - (*((unsigned long *) (((int) l_ptr) + SOL_PART_OFFSET + (p) * 0xc + 8))) - -#define SOL_PART_EXISTS(l_ptr, p) (SOL_PART_LENGTH(l_ptr, p) != 0) - - -#endif /* _PC_SLICE_H */ diff --git a/usr/src/grub/grub-0.95/stage2/pxeloader.S b/usr/src/grub/grub-0.95/stage2/pxeloader.S deleted file mode 100644 index 9270f81273..0000000000 --- a/usr/src/grub/grub-0.95/stage2/pxeloader.S +++ /dev/null @@ -1,54 +0,0 @@ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 2000 Free Software Foundation, 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 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. - */ - - .file "pxeloader.S" - .text - - /* Start with the prehistoric environment... */ - .code16 - - /* Let's go */ -.globl _start; _start: - movw %sp, %bp - movw %ss:4(%bp), %ax - pushw %ax - movw %ss:6(%bp), %ax - pushw %ax - call 1f -1: popw %bx - - /* Save !PXE address */ - popw %ax - movw %ax, %cs:(pxeseg-1b)(%bx) - popw %ax - movw %ax, %cs:(pxeoff-1b)(%bx) - movw %ax, %bx - - /* Jump to the real world */ - ljmp $0, $0x8200 - - . = _start + 0x7C80 - 0x7C00 -pxeseg: .word 0 -pxeoff: .word 0 - - /* This region is a junk. Do you say that this is wasteful? - But I like that the memory layout of the body is consistent - among different stage2s rather than scamping just for 1.5KB. */ - . = _start + 0x8200 - 0x7C00 - 1 - .byte 0 diff --git a/usr/src/grub/grub-0.95/stage2/serial.c b/usr/src/grub/grub-0.95/stage2/serial.c deleted file mode 100644 index 16c376fa7d..0000000000 --- a/usr/src/grub/grub-0.95/stage2/serial.c +++ /dev/null @@ -1,434 +0,0 @@ -/* serial.c - serial device interface */ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 2000,2001,2002 Free Software Foundation, 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 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. - */ - -#ifdef SUPPORT_SERIAL - -#include -#include -#include -#include - -/* An input buffer. */ -static char input_buf[8]; -static int npending = 0; - -static int serial_x; -static int serial_y; - -static int keep_track = 1; - - -/* Hardware-dependent definitions. */ - -#ifndef GRUB_UTIL -/* The structure for speed vs. divisor. */ -struct divisor -{ - int speed; - unsigned short div; -}; - -/* Store the port number of a serial unit. */ -static unsigned short serial_hw_port = 0; - -/* The table which lists common configurations. */ -static struct divisor divisor_tab[] = - { - { 2400, 0x0030 }, - { 4800, 0x0018 }, - { 9600, 0x000C }, - { 19200, 0x0006 }, - { 38400, 0x0003 }, - { 57600, 0x0002 }, - { 115200, 0x0001 } - }; - -/* Read a byte from a port. */ -static inline unsigned char -inb (unsigned short port) -{ - unsigned char value; - - asm volatile ("inb %w1, %0" : "=a" (value) : "Nd" (port)); - asm volatile ("outb %%al, $0x80" : : ); - - return value; -} - -/* Write a byte to a port. */ -static inline void -outb (unsigned short port, unsigned char value) -{ - asm volatile ("outb %b0, %w1" : : "a" (value), "Nd" (port)); - asm volatile ("outb %%al, $0x80" : : ); -} - -/* Fetch a key. */ -int -serial_hw_fetch (void) -{ - if (inb (serial_hw_port + UART_LSR) & UART_DATA_READY) - return inb (serial_hw_port + UART_RX); - - return -1; -} - -/* Put a chararacter. */ -void -serial_hw_put (int c) -{ - int timeout = 100000; - - /* Wait until the transmitter holding register is empty. */ - while ((inb (serial_hw_port + UART_LSR) & UART_EMPTY_TRANSMITTER) == 0) - { - if (--timeout == 0) - /* There is something wrong. But what can I do? */ - return; - } - - outb (serial_hw_port + UART_TX, c); -} - -void -serial_hw_delay (void) -{ - outb (0x80, 0); -} - -/* Return the port number for the UNITth serial device. */ -unsigned short -serial_hw_get_port (int unit) -{ - /* The BIOS data area. */ - const unsigned short *addr = (const unsigned short *) 0x0400; - - return addr[unit]; -} - -/* Initialize a serial device. PORT is the port number for a serial device. - SPEED is a DTE-DTE speed which must be one of these: 2400, 4800, 9600, - 19200, 38400, 57600 and 115200. WORD_LEN is the word length to be used - for the device. Likewise, PARITY is the type of the parity and - STOP_BIT_LEN is the length of the stop bit. The possible values for - WORD_LEN, PARITY and STOP_BIT_LEN are defined in the header file as - macros. */ -int -serial_hw_init (unsigned short port, unsigned int speed, - int word_len, int parity, int stop_bit_len) -{ - int i; - unsigned short div = 0; - unsigned char status = 0; - - /* Turn off the interrupt. */ - outb (port + UART_IER, 0); - - /* Set DLAB. */ - outb (port + UART_LCR, UART_DLAB); - - /* Set the baud rate. */ - for (i = 0; i < sizeof (divisor_tab) / sizeof (divisor_tab[0]); i++) - if (divisor_tab[i].speed == speed) - { - div = divisor_tab[i].div; - break; - } - - if (div == 0) - return 0; - - outb (port + UART_DLL, div & 0xFF); - outb (port + UART_DLH, div >> 8); - - /* Set the line status. */ - status |= parity | word_len | stop_bit_len; - outb (port + UART_LCR, status); - - /* Enable the FIFO. */ - outb (port + UART_FCR, UART_ENABLE_FIFO); - - /* Turn on DTR, RTS, and OUT2. */ - outb (port + UART_MCR, UART_ENABLE_MODEM); - - /* Store the port number. */ - serial_hw_port = port; - - /* Drain the input buffer. */ - while (serial_checkkey () != -1) - (void) serial_getkey (); - - /* Get rid of TERM_NEED_INIT from the serial terminal. */ - for (i = 0; term_table[i].name; i++) - if (grub_strcmp (term_table[i].name, "serial") == 0) - { - term_table[i].flags &= ~TERM_NEED_INIT; - break; - } - - /* FIXME: should check if the serial terminal was found. */ - - return 1; -} -#endif /* ! GRUB_UTIL */ - - -/* Generic definitions. */ - -static void -serial_translate_key_sequence (void) -{ - const struct - { - char key; - char ascii; - } - three_code_table[] = - { - {'A', 16}, - {'B', 14}, - {'C', 6}, - {'D', 2}, - {'F', 5}, - {'H', 1}, - {'4', 4} - }; - - const struct - { - short key; - char ascii; - } - four_code_table[] = - { - {('1' | ('~' << 8)), 1}, - {('3' | ('~' << 8)), 4}, - {('5' | ('~' << 8)), 7}, - {('6' | ('~' << 8)), 3}, - }; - - /* The buffer must start with ``ESC [''. */ - if (*((unsigned short *) input_buf) != ('\e' | ('[' << 8))) - return; - - if (npending >= 3) - { - int i; - - for (i = 0; - i < sizeof (three_code_table) / sizeof (three_code_table[0]); - i++) - if (three_code_table[i].key == input_buf[2]) - { - input_buf[0] = three_code_table[i].ascii; - npending -= 2; - grub_memmove (input_buf + 1, input_buf + 3, npending - 1); - return; - } - } - - if (npending >= 4) - { - int i; - short key = *((short *) (input_buf + 2)); - - for (i = 0; - i < sizeof (four_code_table) / sizeof (four_code_table[0]); - i++) - if (four_code_table[i].key == key) - { - input_buf[0] = four_code_table[i].ascii; - npending -= 3; - grub_memmove (input_buf + 1, input_buf + 4, npending - 1); - return; - } - } -} - -static -int fill_input_buf (int nowait) -{ - int i; - - for (i = 0; i < 10000 && npending < sizeof (input_buf); i++) - { - int c; - - c = serial_hw_fetch (); - if (c >= 0) - { - input_buf[npending++] = c; - - /* Reset the counter to zero, to wait for the same interval. */ - i = 0; - } - - if (nowait) - break; - } - - /* Translate some key sequences. */ - serial_translate_key_sequence (); - - return npending; -} - -/* The serial version of getkey. */ -int -serial_getkey (void) -{ - int c; - - while (! fill_input_buf (0)) - ; - - c = input_buf[0]; - npending--; - grub_memmove (input_buf, input_buf + 1, npending); - - return c; -} - -/* The serial version of checkkey. */ -int -serial_checkkey (void) -{ - if (fill_input_buf (1)) - return input_buf[0]; - - return -1; -} - -/* The serial version of grub_putchar. */ -void -serial_putchar (int c) -{ - /* Keep track of the cursor. */ - if (keep_track) - { - /* The serial terminal doesn't have VGA fonts. */ - switch (c) - { - case DISP_UL: - c = ACS_ULCORNER; - break; - case DISP_UR: - c = ACS_URCORNER; - break; - case DISP_LL: - c = ACS_LLCORNER; - break; - case DISP_LR: - c = ACS_LRCORNER; - break; - case DISP_HORIZ: - c = ACS_HLINE; - break; - case DISP_VERT: - c = ACS_VLINE; - break; - case DISP_LEFT: - c = ACS_LARROW; - break; - case DISP_RIGHT: - c = ACS_RARROW; - break; - case DISP_UP: - c = ACS_UARROW; - break; - case DISP_DOWN: - c = ACS_DARROW; - break; - default: - break; - } - - switch (c) - { - case '\r': - serial_x = 0; - break; - - case '\n': - serial_y++; - break; - - case '\b': - case 127: - if (serial_x > 0) - serial_x--; - break; - - case '\a': - break; - - default: - if (serial_x >= 79) - { - serial_putchar ('\r'); - serial_putchar ('\n'); - } - serial_x++; - break; - } - } - - serial_hw_put (c); -} - -int -serial_getxy (void) -{ - return (serial_x << 8) | serial_y; -} - -void -serial_gotoxy (int x, int y) -{ - keep_track = 0; - ti_cursor_address (x, y); - keep_track = 1; - - serial_x = x; - serial_y = y; -} - -void -serial_cls (void) -{ - keep_track = 0; - ti_clear_screen (); - keep_track = 1; - - serial_x = serial_y = 0; -} - -void -serial_setcolorstate (color_state state) -{ - keep_track = 0; - if (state == COLOR_STATE_HIGHLIGHT) - ti_enter_standout_mode (); - else - ti_exit_standout_mode (); - keep_track = 1; -} - -#endif /* SUPPORT_SERIAL */ diff --git a/usr/src/grub/grub-0.95/stage2/serial.h b/usr/src/grub/grub-0.95/stage2/serial.h deleted file mode 100644 index 76c222720d..0000000000 --- a/usr/src/grub/grub-0.95/stage2/serial.h +++ /dev/null @@ -1,93 +0,0 @@ -/* serial.h - serial device interface */ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 2000,2001,2002 Free Software Foundation, 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 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 GRUB_SERIAL_HEADER -#define GRUB_SERIAL_HEADER 1 - -/* Macros. */ - -/* The offsets of UART registers. */ -#define UART_TX 0 -#define UART_RX 0 -#define UART_DLL 0 -#define UART_IER 1 -#define UART_DLH 1 -#define UART_IIR 2 -#define UART_FCR 2 -#define UART_LCR 3 -#define UART_MCR 4 -#define UART_LSR 5 -#define UART_MSR 6 -#define UART_SR 7 - -/* For LSR bits. */ -#define UART_DATA_READY 0x01 -#define UART_EMPTY_TRANSMITTER 0x20 - -/* The type of parity. */ -#define UART_NO_PARITY 0x00 -#define UART_ODD_PARITY 0x08 -#define UART_EVEN_PARITY 0x18 - -/* The type of word length. */ -#define UART_5BITS_WORD 0x00 -#define UART_6BITS_WORD 0x01 -#define UART_7BITS_WORD 0x02 -#define UART_8BITS_WORD 0x03 - -/* The type of the length of stop bit. */ -#define UART_1_STOP_BIT 0x00 -#define UART_2_STOP_BITS 0x04 - -/* the switch of DLAB. */ -#define UART_DLAB 0x80 - -/* Enable the FIFO. */ -#define UART_ENABLE_FIFO 0xC7 - -/* Turn on DTR, RTS, and OUT2. */ -#define UART_ENABLE_MODEM 0x0B - - -/* Function prototypes. */ - -/* Fetch a key. */ -int serial_hw_fetch (void); - -/* Put a character. */ -void serial_hw_put (int c); - -/* Insert a delay. */ -void serial_hw_delay (void); - -/* Return the port number for the UNITth serial device. */ -unsigned short serial_hw_get_port (int unit); - -/* Initialize a serial device. */ -int serial_hw_init (unsigned short port, unsigned int speed, - int word_len, int parity, int stop_bit_len); - -#ifdef GRUB_UTIL -/* Set the file name of a serial device (or a pty device). This is a - function specific to the grub shell. */ -void serial_set_device (const char *device); -#endif /* GRUB_UTIL */ - -#endif /* ! GRUB_SERIAL_HEADER */ diff --git a/usr/src/grub/grub-0.95/stage2/setjmp.S b/usr/src/grub/grub-0.95/stage2/setjmp.S deleted file mode 100644 index 59161fef0c..0000000000 --- a/usr/src/grub/grub-0.95/stage2/setjmp.S +++ /dev/null @@ -1,81 +0,0 @@ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 2000 Free Software Foundation, 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 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. - */ - -/* This is stolen from libc/x86/setjmp.S in the OSKit */ -/* - * Mach Operating System - * Copyright (c) 1991,1990,1989 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. - * - * 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 FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie Mellon - * the rights to redistribute these changes. - */ -/* - * C library -- _setjmp, _longjmp - * - * _longjmp(a,v) - * will generate a "return(v)" from - * the last call to - * _setjmp(a) - * by restoring registers from the stack, - * The previous signal state is NOT restored. - * - */ - -ENTRY(grub_setjmp) - movl 4(%esp), %ecx /* fetch buffer */ - movl %ebx, 0(%ecx) - movl %esi, 4(%ecx) - movl %edi, 8(%ecx) - movl %ebp, 12(%ecx) /* save frame pointer of caller */ - popl %edx - movl %esp, 16(%ecx) /* save stack pointer of caller */ - movl %edx, 20(%ecx) /* save pc of caller */ - xorl %eax, %eax - jmp *%edx - -ENTRY(grub_longjmp) - movl 8(%esp), %eax /* return(v) */ - movl 4(%esp), %ecx /* fetch buffer */ - movl 0(%ecx), %ebx - movl 4(%ecx), %esi - movl 8(%ecx), %edi - movl 12(%ecx), %ebp - movl 16(%ecx), %esp - orl %eax, %eax - jnz 0f - incl %eax -0: jmp *20(%ecx) /* done, return.... */ diff --git a/usr/src/grub/grub-0.95/stage2/shared.h b/usr/src/grub/grub-0.95/stage2/shared.h deleted file mode 100644 index 8d2f556e02..0000000000 --- a/usr/src/grub/grub-0.95/stage2/shared.h +++ /dev/null @@ -1,1068 +0,0 @@ -/* shared.h - definitions used in all GRUB-specific code */ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, 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 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. - */ -/* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* - * Generic defines to use anywhere - */ - -#ifndef GRUB_SHARED_HEADER -#define GRUB_SHARED_HEADER 1 - -#include - -/* Add an underscore to a C symbol in assembler code if needed. */ -#ifdef HAVE_ASM_USCORE -# define EXT_C(sym) _ ## sym -#else -# define EXT_C(sym) sym -#endif - -/* Maybe redirect memory requests through grub_scratch_mem. */ -#ifdef GRUB_UTIL -extern char *grub_scratch_mem; -# define RAW_ADDR(x) ((x) + (int) grub_scratch_mem) -# define RAW_SEG(x) (RAW_ADDR ((x) << 4) >> 4) -#else -# define RAW_ADDR(x) (x) -# define RAW_SEG(x) (x) -#endif - -/* ZFS will use the top 4 Meg of physical memory (below 4Gig) for sratch */ -#define ZFS_SCRATCH_SIZE 0x400000 - -#define MAXNAMELEN 256 -#define MIN(x, y) ((x) < (y) ? (x) : (y)) - -/* Boot signature related defines for the findroot command */ -#define BOOTSIGN_DIR "/boot/grub/bootsign" -#define BOOTSIGN_ARGLEN (MAXNAMELEN + 10) /* (,0,d) */ -#define BOOTSIGN_LEN (sizeof (BOOTSIGN_DIR) + 1 + BOOTSIGN_ARGLEN) -#define BOOTSIGN_BACKUP "/etc/bootsign" - -/* - * Integer sizes - */ - -#define MAXINT 0x7FFFFFFF - -/* Maximum command line size. Before you blindly increase this value, - see the comment in char_io.c (get_cmdline). */ -#define MAX_CMDLINE 1600 -#define NEW_HEAPSIZE 1500 - -/* 512-byte scratch area */ -#define SCRATCHADDR RAW_ADDR (0x77e00) -#define SCRATCHSEG RAW_SEG (0x77e0) - -/* - * This is the location of the raw device buffer. It is 31.5K - * in size. - */ - -#define BUFFERLEN 0x7e00 -#define BUFFERADDR RAW_ADDR (0x70000) -#define BUFFERSEG RAW_SEG (0x7000) - -#define BOOT_PART_TABLE RAW_ADDR (0x07be) - -/* - * BIOS disk defines - */ -#define BIOSDISK_READ 0x0 -#define BIOSDISK_WRITE 0x1 -#define BIOSDISK_ERROR_GEOMETRY 0x100 -#define BIOSDISK_ERROR_SHORT_IO 0x101 -#define BIOSDISK_FLAG_LBA_EXTENSION 0x1 -#define BIOSDISK_FLAG_CDROM 0x2 - -/* - * This is the filesystem (not raw device) buffer. - * It is 32K in size, do not overrun! - */ - -#define FSYS_BUFLEN 0x8000 -#define FSYS_BUF RAW_ADDR (0x68000) - -/* Command-line buffer for Multiboot kernels and modules. This area - includes the area into which Stage 1.5 and Stage 1 are loaded, but - that's no problem. */ -#define MB_CMDLINE_BUF RAW_ADDR (0x2000) -#define MB_CMDLINE_BUFLEN 0x6000 - -/* The buffer for the password. */ -#define PASSWORD_BUF RAW_ADDR (0x78000) -#define PASSWORD_BUFLEN 0x200 - -/* THe buffer for the filename of "/boot/grub/default". */ -#define DEFAULT_FILE_BUF (PASSWORD_BUF + PASSWORD_BUFLEN) -#define DEFAULT_FILE_BUFLEN 0x60 - -/* The buffer for the command-line. */ -#define CMDLINE_BUF (DEFAULT_FILE_BUF + DEFAULT_FILE_BUFLEN) -#define CMDLINE_BUFLEN MAX_CMDLINE - -/* The kill buffer for the command-line. */ -#define KILL_BUF (CMDLINE_BUF + CMDLINE_BUFLEN) -#define KILL_BUFLEN MAX_CMDLINE - -/* The history buffer for the command-line. */ -#define HISTORY_BUF (KILL_BUF + KILL_BUFLEN) -#define HISTORY_SIZE 5 -#define HISTORY_BUFLEN (MAX_CMDLINE * HISTORY_SIZE) - -/* The buffer for the completion. */ -#define COMPLETION_BUF (HISTORY_BUF + HISTORY_BUFLEN) -#define COMPLETION_BUFLEN MAX_CMDLINE - -/* The buffer for the unique string. */ -#define UNIQUE_BUF (COMPLETION_BUF + COMPLETION_BUFLEN) -#define UNIQUE_BUFLEN MAX_CMDLINE - -/* The buffer for the menu entries. */ -#define MENU_BUF (UNIQUE_BUF + UNIQUE_BUFLEN) -#define MENU_BUFLEN (0x8000 + PASSWORD_BUF - MENU_BUF) - -/* The size of the drive map. */ -#define DRIVE_MAP_SIZE 8 - -/* The size of the key map. */ -#define KEY_MAP_SIZE 128 - -/* The size of the io map. */ -#define IO_MAP_SIZE 128 - -/* - * Linux setup parameters - */ - -#define LINUX_MAGIC_SIGNATURE 0x53726448 /* "HdrS" */ -#define LINUX_DEFAULT_SETUP_SECTS 4 -#define LINUX_FLAG_CAN_USE_HEAP 0x80 -#define LINUX_INITRD_MAX_ADDRESS 0x38000000 -#define LINUX_MAX_SETUP_SECTS 64 -#define LINUX_BOOT_LOADER_TYPE 0x71 -#define LINUX_HEAP_END_OFFSET (0x9000 - 0x200) - -#define LINUX_BZIMAGE_ADDR RAW_ADDR (0x100000) -#define LINUX_ZIMAGE_ADDR RAW_ADDR (0x10000) -#define LINUX_OLD_REAL_MODE_ADDR RAW_ADDR (0x90000) -#define LINUX_SETUP_STACK 0x9000 - -#define LINUX_FLAG_BIG_KERNEL 0x1 - -/* Linux's video mode selection support. Actually I hate it! */ -#define LINUX_VID_MODE_NORMAL 0xFFFF -#define LINUX_VID_MODE_EXTENDED 0xFFFE -#define LINUX_VID_MODE_ASK 0xFFFD - -#define LINUX_CL_OFFSET 0x9000 -#define LINUX_CL_END_OFFSET 0x90FF -#define LINUX_SETUP_MOVE_SIZE 0x9100 -#define LINUX_CL_MAGIC 0xA33F - -/* - * General disk stuff - */ - -#define SECTOR_SIZE 0x200 -#define SECTOR_BITS 9 -#define BIOS_FLAG_FIXED_DISK 0x80 - -#define BOOTSEC_LOCATION RAW_ADDR (0x7C00) -#define BOOTSEC_SIGNATURE 0xAA55 -#define BOOTSEC_BPB_OFFSET 0x3 -#define BOOTSEC_BPB_LENGTH 0x3B -#define BOOTSEC_BPB_SYSTEM_ID 0x3 -#define BOOTSEC_BPB_HIDDEN_SECTORS 0x1C -#define BOOTSEC_PART_OFFSET 0x1BE -#define BOOTSEC_PART_LENGTH 0x40 -#define BOOTSEC_SIG_OFFSET 0x1FE -#define BOOTSEC_LISTSIZE 8 - -/* Not bad, perhaps. */ -#define NETWORK_DRIVE 0x20 - -/* - * GRUB specific information - * (in LSB order) - */ - -#include - -#define STAGE2_VER_MAJ_OFFS 0x6 -#define STAGE2_INSTALLPART 0x8 -#define STAGE2_SAVED_ENTRYNO 0xc -#define STAGE2_STAGE2_ID 0x10 -#define STAGE2_FORCE_LBA 0x11 -#define STAGE2_VER_STR_OFFS 0x12 - -/* Stage 2 identifiers */ -#define STAGE2_ID_STAGE2 0 -#define STAGE2_ID_FFS_STAGE1_5 1 -#define STAGE2_ID_E2FS_STAGE1_5 2 -#define STAGE2_ID_FAT_STAGE1_5 3 -#define STAGE2_ID_MINIX_STAGE1_5 4 -#define STAGE2_ID_REISERFS_STAGE1_5 5 -#define STAGE2_ID_VSTAFS_STAGE1_5 6 -#define STAGE2_ID_JFS_STAGE1_5 7 -#define STAGE2_ID_XFS_STAGE1_5 8 -#define STAGE2_ID_ISO9660_STAGE1_5 9 -#define STAGE2_ID_UFS2_STAGE1_5 10 -#define STAGE2_ID_UFS_STAGE1_5 11 -#define STAGE2_ID_ZFS_STAGE1_5 12 - -#ifndef STAGE1_5 -# define STAGE2_ID STAGE2_ID_STAGE2 -#else -# if defined(FSYS_FFS) -# define STAGE2_ID STAGE2_ID_FFS_STAGE1_5 -# elif defined(FSYS_EXT2FS) -# define STAGE2_ID STAGE2_ID_E2FS_STAGE1_5 -# elif defined(FSYS_FAT) -# define STAGE2_ID STAGE2_ID_FAT_STAGE1_5 -# elif defined(FSYS_MINIX) -# define STAGE2_ID STAGE2_ID_MINIX_STAGE1_5 -# elif defined(FSYS_REISERFS) -# define STAGE2_ID STAGE2_ID_REISERFS_STAGE1_5 -# elif defined(FSYS_VSTAFS) -# define STAGE2_ID STAGE2_ID_VSTAFS_STAGE1_5 -# elif defined(FSYS_JFS) -# define STAGE2_ID STAGE2_ID_JFS_STAGE1_5 -# elif defined(FSYS_XFS) -# define STAGE2_ID STAGE2_ID_XFS_STAGE1_5 -# elif defined(FSYS_ISO9660) -# define STAGE2_ID STAGE2_ID_ISO9660_STAGE1_5 -# elif defined(FSYS_UFS2) -# define STAGE2_ID STAGE2_ID_UFS2_STAGE1_5 -# elif defined(FSYS_UFS) -# define STAGE2_ID STAGE2_ID_UFS_STAGE1_5 -# elif defined(FSYS_ZFS) -# define STAGE2_ID STAGE2_ID_ZFS_STAGE1_5 -# else -# error "unknown Stage 2" -# endif -#endif - -/* - * defines for use when switching between real and protected mode - */ - -#define CR0_PE_ON 0x1 -#define CR0_PE_OFF 0xfffffffe -#define PROT_MODE_CSEG 0x8 -#define PROT_MODE_DSEG 0x10 -#define PSEUDO_RM_CSEG 0x18 -#define PSEUDO_RM_DSEG 0x20 -#define STACKOFF (0x2000 - 0x10) -#define PROTSTACKINIT (FSYS_BUF - 0x10) - - -/* - * Assembly code defines - * - * "EXT_C" is assumed to be defined in the Makefile by the configure - * command. - */ - -#define ENTRY(x) .globl EXT_C(x) ; EXT_C(x): -#define VARIABLE(x) ENTRY(x) - - -#define K_RDWR 0x60 /* keyboard data & cmds (read/write) */ -#define K_STATUS 0x64 /* keyboard status */ -#define K_CMD 0x64 /* keybd ctlr command (write-only) */ - -#define K_OBUF_FUL 0x01 /* output buffer full */ -#define K_IBUF_FUL 0x02 /* input buffer full */ - -#define KC_CMD_WIN 0xd0 /* read output port */ -#define KC_CMD_WOUT 0xd1 /* write output port */ -#define KB_OUTPUT_MASK 0xdd /* enable output buffer full interrupt - enable data line - enable clock line */ -#define KB_A20_ENABLE 0x02 - -/* Codes for getchar. */ -#define ASCII_CHAR(x) ((x) & 0xFF) -#if !defined(GRUB_UTIL) || !defined(HAVE_LIBCURSES) -# define KEY_LEFT 0x4B00 -# define KEY_RIGHT 0x4D00 -# define KEY_UP 0x4800 -# define KEY_DOWN 0x5000 -# define KEY_IC 0x5200 /* insert char */ -# define KEY_DC 0x5300 /* delete char */ -# define KEY_BACKSPACE 0x0008 -# define KEY_HOME 0x4700 -# define KEY_END 0x4F00 -# define KEY_NPAGE 0x5100 -# define KEY_PPAGE 0x4900 -# define A_NORMAL 0x7 -# define A_REVERSE 0x70 -#elif defined(HAVE_NCURSES_CURSES_H) -# include -#elif defined(HAVE_NCURSES_H) -# include -#elif defined(HAVE_CURSES_H) -# include -#endif - -/* In old BSD curses, A_NORMAL and A_REVERSE are not defined, so we - define them here if they are undefined. */ -#ifndef A_NORMAL -# define A_NORMAL 0 -#endif /* ! A_NORMAL */ -#ifndef A_REVERSE -# ifdef A_STANDOUT -# define A_REVERSE A_STANDOUT -# else /* ! A_STANDOUT */ -# define A_REVERSE 0 -# endif /* ! A_STANDOUT */ -#endif /* ! A_REVERSE */ - -/* Define ACS_* ourselves, since the definitions are not consistent among - various curses implementations. */ -#undef ACS_ULCORNER -#undef ACS_URCORNER -#undef ACS_LLCORNER -#undef ACS_LRCORNER -#undef ACS_HLINE -#undef ACS_VLINE -#undef ACS_LARROW -#undef ACS_RARROW -#undef ACS_UARROW -#undef ACS_DARROW - -#define ACS_ULCORNER '+' -#define ACS_URCORNER '+' -#define ACS_LLCORNER '+' -#define ACS_LRCORNER '+' -#define ACS_HLINE '-' -#define ACS_VLINE '|' -#define ACS_LARROW '<' -#define ACS_RARROW '>' -#define ACS_UARROW '^' -#define ACS_DARROW 'v' - -/* Special graphics characters for IBM displays. */ -#define DISP_UL 218 -#define DISP_UR 191 -#define DISP_LL 192 -#define DISP_LR 217 -#define DISP_HORIZ 196 -#define DISP_VERT 179 -#define DISP_LEFT 0x1b -#define DISP_RIGHT 0x1a -#define DISP_UP 0x18 -#define DISP_DOWN 0x19 - -/* Remap some libc-API-compatible function names so that we prevent - circularararity. */ -#ifndef WITHOUT_LIBC_STUBS -#define memmove grub_memmove -#define memcpy grub_memmove /* we don't need a separate memcpy */ -#define memset grub_memset -#undef isspace -#define isspace grub_isspace -#define printf grub_printf -#define sprintf grub_sprintf -#undef putchar -#define putchar grub_putchar -#define strncat grub_strncat -#define strstr grub_strstr -#define memcmp grub_memcmp -#define strcmp grub_strcmp -#define tolower grub_tolower -#define strlen grub_strlen -#define strcpy grub_strcpy -#endif /* WITHOUT_LIBC_STUBS */ - -#define UNDI_STACK (512 + 64) << 10 -#define UNDI_STACK_SEG (UNDI_STACK >> 4) /* PXE load GRUB here */ -#define UNDI_STACK_OFF (0x10000 - 0x10) - -#ifndef ASM_FILE -/* - * Below this should be ONLY defines and other constructs for C code. - */ - -/* multiboot stuff */ - -#include "mb_header.h" -#include "mb_info.h" - -/* For the Linux/i386 boot protocol version 2.03. */ -struct linux_kernel_header -{ - char code1[0x0020]; - unsigned short cl_magic; /* Magic number 0xA33F */ - unsigned short cl_offset; /* The offset of command line */ - char code2[0x01F1 - 0x0020 - 2 - 2]; - unsigned char setup_sects; /* The size of the setup in sectors */ - unsigned short root_flags; /* If the root is mounted readonly */ - unsigned short syssize; /* obsolete */ - unsigned short swap_dev; /* obsolete */ - unsigned short ram_size; /* obsolete */ - unsigned short vid_mode; /* Video mode control */ - unsigned short root_dev; /* Default root device number */ - unsigned short boot_flag; /* 0xAA55 magic number */ - unsigned short jump; /* Jump instruction */ - unsigned long header; /* Magic signature "HdrS" */ - unsigned short version; /* Boot protocol version supported */ - unsigned long realmode_swtch; /* Boot loader hook */ - unsigned long start_sys; /* Points to kernel version string */ - unsigned char type_of_loader; /* Boot loader identifier */ - unsigned char loadflags; /* Boot protocol option flags */ - unsigned short setup_move_size; /* Move to high memory size */ - unsigned long code32_start; /* Boot loader hook */ - unsigned long ramdisk_image; /* initrd load address */ - unsigned long ramdisk_size; /* initrd size */ - unsigned long bootsect_kludge; /* obsolete */ - unsigned short heap_end_ptr; /* Free memory after setup end */ - unsigned short pad1; /* Unused */ - char *cmd_line_ptr; /* Points to the kernel command line */ - unsigned long initrd_addr_max; /* The highest address of initrd */ -} __attribute__ ((packed)); - -/* Memory map address range descriptor used by GET_MMAP_ENTRY. */ -struct mmar_desc -{ - unsigned long desc_len; /* Size of this descriptor. */ - unsigned long long addr; /* Base address. */ - unsigned long long length; /* Length in bytes. */ - unsigned long type; /* Type of address range. */ -} __attribute__ ((packed)); - -/* VBE controller information. */ -struct vbe_controller -{ - unsigned char signature[4]; - unsigned short version; - unsigned long oem_string; - unsigned long capabilities; - unsigned long video_mode; - unsigned short total_memory; - unsigned short oem_software_rev; - unsigned long oem_vendor_name; - unsigned long oem_product_name; - unsigned long oem_product_rev; - unsigned char reserved[222]; - unsigned char oem_data[256]; -} __attribute__ ((packed)); - -/* VBE mode information. */ -struct vbe_mode -{ - unsigned short mode_attributes; - unsigned char win_a_attributes; - unsigned char win_b_attributes; - unsigned short win_granularity; - unsigned short win_size; - unsigned short win_a_segment; - unsigned short win_b_segment; - unsigned long win_func; - unsigned short bytes_per_scanline; - - /* >=1.2 */ - unsigned short x_resolution; - unsigned short y_resolution; - unsigned char x_char_size; - unsigned char y_char_size; - unsigned char number_of_planes; - unsigned char bits_per_pixel; - unsigned char number_of_banks; - unsigned char memory_model; - unsigned char bank_size; - unsigned char number_of_image_pages; - unsigned char reserved0; - - /* direct color */ - unsigned char red_mask_size; - unsigned char red_field_position; - unsigned char green_mask_size; - unsigned char green_field_position; - unsigned char blue_mask_size; - unsigned char blue_field_position; - unsigned char reserved_mask_size; - unsigned char reserved_field_position; - unsigned char direct_color_mode_info; - - /* >=2.0 */ - unsigned long phys_base; - unsigned long reserved1; - unsigned short reversed2; - - /* >=3.0 */ - unsigned short linear_bytes_per_scanline; - unsigned char banked_number_of_image_pages; - unsigned char linear_number_of_image_pages; - unsigned char linear_red_mask_size; - unsigned char linear_red_field_position; - unsigned char linear_green_mask_size; - unsigned char linear_green_field_position; - unsigned char linear_blue_mask_size; - unsigned char linear_blue_field_position; - unsigned char linear_reserved_mask_size; - unsigned char linear_reserved_field_position; - unsigned long max_pixel_clock; - - unsigned char reserved3[189]; -} __attribute__ ((packed)); - - -#undef NULL -#define NULL ((void *) 0) - -/* Error codes (descriptions are in common.c) */ -typedef enum -{ - ERR_NONE = 0, - ERR_BAD_FILENAME, - ERR_BAD_FILETYPE, - ERR_BAD_GZIP_DATA, - ERR_BAD_GZIP_HEADER, - ERR_BAD_PART_TABLE, - ERR_BAD_VERSION, - ERR_BELOW_1MB, - ERR_BOOT_COMMAND, - ERR_BOOT_FAILURE, - ERR_BOOT_FEATURES, - ERR_DEV_FORMAT, - ERR_DEV_VALUES, - ERR_EXEC_FORMAT, - ERR_FILELENGTH, - ERR_FILE_NOT_FOUND, - ERR_FSYS_CORRUPT, - ERR_FSYS_MOUNT, - ERR_GEOM, - ERR_NEED_LX_KERNEL, - ERR_NEED_MB_KERNEL, - ERR_NO_DISK, - ERR_NO_PART, - ERR_NUMBER_PARSING, - ERR_OUTSIDE_PART, - ERR_READ, - ERR_SYMLINK_LOOP, - ERR_UNRECOGNIZED, - ERR_WONT_FIT, - ERR_WRITE, - ERR_BAD_ARGUMENT, - ERR_UNALIGNED, - ERR_PRIVILEGED, - ERR_DEV_NEED_INIT, - ERR_NO_DISK_SPACE, - ERR_NUMBER_OVERFLOW, - ERR_BAD_GZIP_CRC, - ERR_FILESYSTEM_NOT_FOUND, - ERR_NO_BOOTPATH, - ERR_NEWER_VERSION, - - MAX_ERR_NUM -} grub_error_t; - -extern unsigned long install_partition; -extern unsigned long boot_drive; -extern unsigned long install_second_sector; -extern struct apm_info apm_bios_info; -extern unsigned long boot_part_addr; -extern int saved_entryno; -extern unsigned char force_lba; -extern char version_string[]; -extern char config_file[]; -extern unsigned long linux_text_len; -extern char *linux_data_tmp_addr; -extern char *linux_data_real_addr; - -#ifdef GRUB_UTIL -/* If not using config file, this variable is set to zero, - otherwise non-zero. */ -extern int use_config_file; -/* If using the preset menu, this variable is set to non-zero, - otherwise zero. */ -extern int use_preset_menu; -/* If not using curses, this variable is set to zero, otherwise non-zero. */ -extern int use_curses; -/* The flag for verbose messages. */ -extern int verbose; -/* The flag for read-only. */ -extern int read_only; -/* The number of floppies to be probed. */ -extern int floppy_disks; -/* The map between BIOS drives and UNIX device file names. */ -extern char **device_map; -/* The filename which stores the information about a device map. */ -extern char *device_map_file; -/* The array of geometries. */ -extern struct geometry *disks; -/* Assign DRIVE to a device name DEVICE. */ -extern void assign_device_name (int drive, const char *device); -#endif - -#ifndef STAGE1_5 -/* GUI interface variables. */ -# define MAX_FALLBACK_ENTRIES 8 -extern int fallback_entries[MAX_FALLBACK_ENTRIES]; -extern int fallback_entryno; -extern int default_entry; -extern int current_entryno; - -/* The constants for password types. */ -typedef enum -{ - PASSWORD_PLAIN, - PASSWORD_MD5, - PASSWORD_UNSUPPORTED -} -password_t; - -extern char *password; -extern password_t password_type; -extern int auth; -extern char commands[]; - -/* For `more'-like feature. */ -extern int max_lines; -extern int count_lines; -extern int use_pager; -#endif - -#ifndef NO_DECOMPRESSION -extern int no_decompression; -extern int compressed_file; -#endif - -/* instrumentation variables */ -extern void (*disk_read_hook) (unsigned int, int, int); -extern void (*disk_read_func) (unsigned int, int, int); - -#ifndef STAGE1_5 -/* The flag for debug mode. */ -extern int debug; -#endif /* STAGE1_5 */ - -extern unsigned long current_drive; -extern unsigned long current_partition; -extern char current_rootpool[MAXNAMELEN]; -extern char current_bootfs[MAXNAMELEN]; -extern char current_bootpath[MAXNAMELEN]; -extern unsigned long long current_bootfs_obj; -extern char current_devid[MAXNAMELEN]; -extern int is_zfs_mount; -extern unsigned long best_drive; -extern unsigned long best_part; -extern int find_best_root; - -extern int fsys_type; - -/* The information for a disk geometry. The CHS information is only for - DOS/Partition table compatibility, and the real number of sectors is - stored in TOTAL_SECTORS. */ -struct geometry -{ - /* The number of cylinders */ - unsigned long cylinders; - /* The number of heads */ - unsigned long heads; - /* The number of sectors */ - unsigned long sectors; - /* The total number of sectors */ - unsigned long total_sectors; - /* Device sector size */ - unsigned long sector_size; - /* Flags */ - unsigned long flags; -}; - -extern unsigned long part_start; -extern unsigned long part_length; - -extern int current_slice; - -extern int buf_drive; -#define BUF_CACHE_INVALID 0xffffffff -extern unsigned int buf_track; -extern struct geometry buf_geom; - -/* these are the current file position and maximum file position */ -extern int filepos; -extern int filemax; - -/* - * Common BIOS/boot data. - */ - -extern struct multiboot_info mbi; -extern unsigned long saved_drive; -extern unsigned long saved_partition; -extern unsigned long cdrom_drive; -#ifndef STAGE1_5 -#ifdef SOLARIS_NETBOOT -extern unsigned long dhcpack_length; -extern unsigned long dhcpack_buf; -#endif -extern unsigned long saved_mem_upper; -extern unsigned long extended_memory; -#endif - -/* - * Error variables. - */ - -extern grub_error_t errnum; -extern char *err_list[]; - -/* don't print geeky noise */ -typedef enum -{ - SILENT, - VERBOSE, - DEFER_SILENT, - DEFER_VERBOSE -} silent_status; - -/* one screen worth of messages 80x24 = 1920 chars -- more with newlines */ -#define SCREENBUF 2000 - -struct silentbuf { - silent_status status; - int looped; - char buffer[SCREENBUF]; - char *buffer_start; -}; - -extern struct silentbuf silent; -extern int reset_term; - -/* Simplify declaration of entry_addr. */ -typedef void (*entry_func) (int, int, int, int, int, int) - __attribute__ ((noreturn)); - -extern entry_func entry_addr; - -/* Enter the stage1.5/stage2 C code after the stack is set up. */ -void cmain (void); - -/* Halt the processor (called after an unrecoverable error). */ -void stop (void) __attribute__ ((noreturn)); - -/* Reboot the system. */ -void grub_reboot (void) __attribute__ ((noreturn)); - -/* Halt the system, using APM if possible. If NO_APM is true, don't use - APM even if it is available. */ -void grub_halt (int no_apm) __attribute__ ((noreturn)); - -/* Copy MAP to the drive map and set up int13_handler. */ -void set_int13_handler (unsigned short *map); - -/* Set up int15_handler. */ -void set_int15_handler (void); - -/* Restore the original int15 handler. */ -void unset_int15_handler (void); - -/* Track the int13 handler to probe I/O address space. */ -void track_int13 (int drive); - -/* The key map. */ -extern unsigned short bios_key_map[]; -extern unsigned short ascii_key_map[]; -extern unsigned short io_map[]; - -/* calls for direct boot-loader chaining */ -void chain_stage1 (unsigned long segment, unsigned long offset, - unsigned long part_table_addr) - __attribute__ ((noreturn)); -void chain_stage2 (unsigned long segment, unsigned long offset, - int second_sector) - __attribute__ ((noreturn)); - -/* do some funky stuff, then boot linux */ -void linux_boot (void) __attribute__ ((noreturn)); - -/* do some funky stuff, then boot bzImage linux */ -void big_linux_boot (void) __attribute__ ((noreturn)); - -/* booting a multiboot executable */ -void multi_boot (int start, int mb_info) __attribute__ ((noreturn)); - -/* If LINEAR is nonzero, then set the Intel processor to linear mode. - Otherwise, bit 20 of all memory accesses is always forced to zero, - causing a wraparound effect for bugwards compatibility with the - 8086 CPU. */ -void gateA20 (int linear); - -/* memory probe routines */ -int get_memsize (int type); -int get_eisamemsize (void); - -/* Fetch the next entry in the memory map and return the continuation - value. DESC is a pointer to the descriptor buffer, and CONT is the - previous continuation value (0 to get the first entry in the - map). */ -int get_mmap_entry (struct mmar_desc *desc, int cont); - -/* Get the linear address of a ROM configuration table. Return zero, - if fails. */ -unsigned long get_rom_config_table (void); - -/* Get APM BIOS information. */ -void get_apm_info (void); - -/* Get VBE controller information. */ -int get_vbe_controller_info (struct vbe_controller *controller); - -/* Get VBE mode information. */ -int get_vbe_mode_info (int mode_number, struct vbe_mode *mode); - -/* Set VBE mode. */ -int set_vbe_mode (int mode_number); - -/* Return the data area immediately following our code. */ -int get_code_end (void); - -/* low-level timing info */ -int getrtsecs (void); -int currticks (void); - -/* Clear the screen. */ -void cls (void); - -/* Turn on/off cursor. */ -int setcursor (int on); - -/* Get the current cursor position (where 0,0 is the top left hand - corner of the screen). Returns packed values, (RET >> 8) is x, - (RET & 0xff) is y. */ -int getxy (void); - -/* Set the cursor position. */ -void gotoxy (int x, int y); - -/* Displays an ASCII character. IBM displays will translate some - characters to special graphical ones (see the DISP_* constants). */ -void grub_putchar (int c); - -/* Wait for a keypress, and return its packed BIOS/ASCII key code. - Use ASCII_CHAR(ret) to extract the ASCII code. */ -int getkey (void); - -/* Like GETKEY, but doesn't block, and returns -1 if no keystroke is - available. */ -int checkkey (void); - -/* Low-level disk I/O */ -int get_diskinfo (int drive, struct geometry *geometry); -int biosdisk (int subfunc, int drive, struct geometry *geometry, - unsigned int sector, int nsec, int segment); -void stop_floppy (void); - -/* Command-line interface functions. */ -#ifndef STAGE1_5 - -/* The flags for the builtins. */ -#define BUILTIN_CMDLINE 0x1 /* Run in the command-line. */ -#define BUILTIN_MENU 0x2 /* Run in the menu. */ -#define BUILTIN_TITLE 0x4 /* Only for the command title. */ -#define BUILTIN_SCRIPT 0x8 /* Run in the script. */ -#define BUILTIN_NO_ECHO 0x10 /* Don't print command on booting. */ -#define BUILTIN_HELP_LIST 0x20 /* Show help in listing. */ - -/* The table for a builtin. */ -struct builtin -{ - /* The command name. */ - char *name; - /* The callback function. */ - int (*func) (char *, int); - /* The combination of the flags defined above. */ - int flags; - /* The short version of the documentation. */ - char *short_doc; - /* The long version of the documentation. */ - char *long_doc; -}; - -/* All the builtins are registered in this. */ -extern struct builtin *builtin_table[]; - -/* The constants for kernel types. */ -typedef enum -{ - KERNEL_TYPE_NONE, /* None is loaded. */ - KERNEL_TYPE_MULTIBOOT, /* Multiboot. */ - KERNEL_TYPE_LINUX, /* Linux. */ - KERNEL_TYPE_BIG_LINUX, /* Big Linux. */ - KERNEL_TYPE_FREEBSD, /* FreeBSD. */ - KERNEL_TYPE_NETBSD, /* NetBSD. */ - KERNEL_TYPE_CHAINLOADER /* Chainloader. */ -} -kernel_t; - -extern kernel_t kernel_type; -extern int show_menu; -extern int grub_timeout; - -void init_builtins (void); -void init_config (void); -char *skip_to (int after_equal, char *cmdline); -struct builtin *find_command (char *command); -void print_cmdline_message (int forever); -void enter_cmdline (char *heap, int forever); -int run_script (char *script, char *heap); -#endif - -/* C library replacement functions with identical semantics. */ -void grub_printf (const char *format,...); -int grub_sprintf (char *buffer, const char *format, ...); -int grub_tolower (int c); -int grub_isspace (int c); -int grub_strncat (char *s1, const char *s2, int n); -void grub_memcpy(void *dest, const void *src, int len); -void *grub_memmove (void *to, const void *from, int len); -void *grub_memset (void *start, int c, int len); -int grub_strncat (char *s1, const char *s2, int n); -char *grub_strstr (const char *s1, const char *s2); -int grub_memcmp (const char *s1, const char *s2, int n); -int grub_strcmp (const char *s1, const char *s2); -int grub_strlen (const char *str); -char *grub_strcpy (char *dest, const char *src); -char *grub_strchr (char *str, char c); - -void noisy_printf (const char *format,...); - -#ifndef GRUB_UTIL -typedef unsigned long grub_jmp_buf[6]; -#else -/* In the grub shell, use the libc jmp_buf instead. */ -# include -# define grub_jmp_buf jmp_buf -#endif - -#ifdef GRUB_UTIL -# define grub_setjmp setjmp -# define grub_longjmp longjmp -#else /* ! GRUB_UTIL */ -int grub_setjmp (grub_jmp_buf env); -void grub_longjmp (grub_jmp_buf env, int val); -#endif /* ! GRUB_UTIL */ - -/* The environment for restarting Stage 2. */ -extern grub_jmp_buf restart_env; -/* The environment for restarting the command-line interface. */ -extern grub_jmp_buf restart_cmdline_env; - -/* misc */ -void init_page (void); -void print_error (void); -char *convert_to_ascii (char *buf, int c, ...); -int get_cmdline (char *prompt, char *cmdline, int maxlen, - int echo_char, int history); -int substring (const char *s1, const char *s2); -int nul_terminate (char *str); -int get_based_digit (int c, int base); -int safe_parse_maxint (char **str_ptr, int *myint_ptr); -int memcheck (unsigned long start, unsigned long len); -void grub_putstr (const char *str); - -#ifndef NO_DECOMPRESSION -/* Compression support. */ -int gunzip_test_header (void); -int gunzip_read (char *buf, int len); -#endif /* NO_DECOMPRESSION */ - -int rawread (int drive, unsigned int sector, int byte_offset, int byte_len, - char *buf); -int devread (unsigned int sector, int byte_offset, int byte_len, char *buf); -int rawwrite (int drive, unsigned int sector, char *buf); -int devwrite (unsigned int sector, int sector_len, char *buf); - -/* Parse a device string and initialize the global parameters. */ -char *set_device (char *device); -int open_device (void); -int real_open_partition (int flags); -int open_partition (void); -int next_partition (unsigned long drive, unsigned long dest, - unsigned long *partition, int *type, - unsigned long *start, unsigned long *len, - unsigned long *offset, int *entry, - unsigned long *ext_offset, char *buf); - -/* Sets device to the one represented by the SAVED_* parameters. */ -int make_saved_active (void); - -/* Set or clear the current root partition's hidden flag. */ -int set_partition_hidden_flag (int hidden); - -/* Open a file or directory on the active device, using GRUB's - internal filesystem support. */ -int grub_open (char *filename); - -/* Read LEN bytes into BUF from the file that was opened with - GRUB_OPEN. If LEN is -1, read all the remaining data in the file. */ -int grub_read (char *buf, int len); - -/* Reposition a file offset. */ -int grub_seek (int offset); - -/* Close a file. */ -void grub_close (void); - -/* List the contents of the directory that was opened with GRUB_OPEN, - printing all completions. */ -int dir (char *dirname); - -int set_bootdev (int hdbias); - -/* Display statistics on the current active device. */ -void print_fsys_type (void); - -/* Display device and filename completions. */ -void print_a_completion (char *filename); -int print_completions (int is_filename, int is_completion); - -/* Copies the current partition data to the desired address. */ -void copy_current_part_entry (char *buf); - -#ifndef STAGE1_5 -void bsd_boot (kernel_t type, int bootdev, char *arg) - __attribute__ ((noreturn)); - -/* Define flags for load_image here. */ -/* Don't pass a Linux's mem option automatically. */ -#define KERNEL_LOAD_NO_MEM_OPTION (1 << 0) - -kernel_t load_image (char *kernel, char *arg, kernel_t suggested_type, - unsigned long load_flags); - -int load_module (char *module, char *arg); -int load_initrd (char *initrd); - -int check_password(char *entered, char* expected, password_t type); -#endif - -void init_bios_info (void); - -#endif /* ASM_FILE */ - -#endif /* ! GRUB_SHARED_HEADER */ diff --git a/usr/src/grub/grub-0.95/stage2/size_test b/usr/src/grub/grub-0.95/stage2/size_test deleted file mode 100644 index f2b8c945ca..0000000000 --- a/usr/src/grub/grub-0.95/stage2/size_test +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/sh - -# Check the sizes of Stage 2 and Stage 1.5's. -# Copyright (C) 1999,2004 Free Software Foundation, 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, 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 OKUJI Yoshinori - - -# This function checks if the size of the first argument (filename) is -# greater than the second argument (limit). If so, then exit with the -# status 1, otherwise do nothing. -check () -{ - file=$1 - limit=$2 - set dummy `ls -l $file` - size=$6 - if test $size -gt $limit; then - echo "$file is too big ($size > $limit)." - exit 1 - fi -} - -# The bootloader area of a FFS partition is 14 sectors. -check ffs_stage1_5 7168 - -check ufs2_stage1_5 7168 - -# Stage 1.5 can be installed in the sectors immediately after MBR in the -# first cylinder, so the size is (63 - 1) sectors. -check fat_stage1_5 31744 - -# Likewise. -check e2fs_stage1_5 31744 - -# Likewise. -check minix_stage1_5 31744 - -# Success. -exit 0 diff --git a/usr/src/grub/grub-0.95/stage2/smp-imps.c b/usr/src/grub/grub-0.95/stage2/smp-imps.c deleted file mode 100644 index 2fb6caeb94..0000000000 --- a/usr/src/grub/grub-0.95/stage2/smp-imps.c +++ /dev/null @@ -1,738 +0,0 @@ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 1999 Free Software Foundation, 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 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. - */ - -/* - * - * - * Author: Erich Boleyn http://www.uruk.org/~erich/ - * - * Source file implementing Intel MultiProcessor Specification (MPS) - * version 1.1 and 1.4 SMP hardware control for Intel Architecture CPUs, - * with hooks for running correctly on a standard PC without the hardware. - * - * This file was created from information in the Intel MPS version 1.4 - * document, order number 242016-004, which can be ordered from the - * Intel literature center. - * - * General limitations of this code: - * - * (1) : This code has never been tested on an MPS-compatible system with - * 486 CPUs, but is expected to work. - * (2) : Presumes "int", "long", and "unsigned" are 32 bits in size, and - * that 32-bit pointers and memory addressing is used uniformly. - */ - -#define _SMP_IMPS_C - - -/* - * XXXXX The following absolutely must be defined!!! - * - * The "KERNEL_PRINT" could be made a null macro with no danger, of - * course, but pretty much nothing would work without the other - * ones defined. - */ - -#if 0 -#define KERNEL_PRINT(x) /* some kind of print function */ -#define CMOS_WRITE_BYTE(x,y) /* write unsigned char "y" at CMOS loc "x" */ -#define CMOS_READ_BYTE(x) /* read unsigned char at CMOS loc "x" */ -#define PHYS_TO_VIRTUAL(x) /* convert physical address "x" to virtual */ -#define VIRTUAL_TO_PHYS(x) /* convert virtual address "x" to physical */ -#endif - - -/* - * This is the Intel MultiProcessor Spec debugging/display code. - */ - -#define IMPS_DEBUG -#define KERNEL_PRINT(x) printf x -#define CMOS_WRITE_BYTE(x, y) cmos_write_byte(x, y) -#define CMOS_READ_BYTE(x) cmos_read_byte(x) -#define PHYS_TO_VIRTUAL(x) (x) -#define VIRTUAL_TO_PHYS(x) (x) - -static inline unsigned char -inb (unsigned short port) -{ - unsigned char data; - - __asm __volatile ("inb %1,%0" :"=a" (data):"d" (port)); - return data; -} - -static inline void -outb (unsigned short port, unsigned char val) -{ - __asm __volatile ("outb %0,%1"::"a" (val), "d" (port)); -} - - -static inline void -cmos_write_byte (int loc, int val) -{ - outb (0x70, loc); - outb (0x71, val); -} - -static inline unsigned -cmos_read_byte (int loc) -{ - outb (0x70, loc); - return inb (0x71); -} - - -/* - * Includes here - */ - -#include "shared.h" -#include "apic.h" -#include "smp-imps.h" - - -/* - * Defines that are here so as not to be in the global header file. - */ -#define EBDA_SEG_ADDR 0x40E -#define BIOS_RESET_VECTOR 0x467 -#define LAPIC_ADDR_DEFAULT 0xFEE00000uL -#define IOAPIC_ADDR_DEFAULT 0xFEC00000uL -#define CMOS_RESET_CODE 0xF -#define CMOS_RESET_JUMP 0xa -#define CMOS_BASE_MEMORY 0x15 - - -/* - * Static defines here for SMP use. - */ - -#define DEF_ENTRIES 23 - -static int lapic_dummy = 0; -static struct - { - imps_processor proc[2]; - imps_bus bus[2]; - imps_ioapic ioapic; - imps_interrupt intin[16]; - imps_interrupt lintin[2]; - } -defconfig = -{ - { - { - IMPS_BCT_PROCESSOR, 0, 0, 0, 0, 0 - } - , - { - IMPS_BCT_PROCESSOR, 1, 0, 0, 0, 0 - } - } - , - { - { - IMPS_BCT_BUS, 0, - { - 'E', 'I', 'S', 'A', ' ', ' ' - } - } - , - { - 255, 1, - { - 'P', 'C', 'I', ' ', ' ', ' ' - } - } - } - , - { - IMPS_BCT_IOAPIC, 0, 0, IMPS_FLAG_ENABLED, IOAPIC_ADDR_DEFAULT - } - , - { - { - IMPS_BCT_IO_INTERRUPT, IMPS_INT_EXTINT, 0, 0, 0, 0xFF, 0 - } - , - { - IMPS_BCT_IO_INTERRUPT, IMPS_INT_INT, 0, 0, 1, 0xFF, 1 - } - , - { - IMPS_BCT_IO_INTERRUPT, IMPS_INT_INT, 0, 0, 0, 0xFF, 2 - } - , - { - IMPS_BCT_IO_INTERRUPT, IMPS_INT_INT, 0, 0, 3, 0xFF, 3 - } - , - { - IMPS_BCT_IO_INTERRUPT, IMPS_INT_INT, 0, 0, 4, 0xFF, 4 - } - , - { - IMPS_BCT_IO_INTERRUPT, IMPS_INT_INT, 0, 0, 5, 0xFF, 5 - } - , - { - IMPS_BCT_IO_INTERRUPT, IMPS_INT_INT, 0, 0, 6, 0xFF, 6 - } - , - { - IMPS_BCT_IO_INTERRUPT, IMPS_INT_INT, 0, 0, 7, 0xFF, 7 - } - , - { - IMPS_BCT_IO_INTERRUPT, IMPS_INT_INT, 0, 0, 8, 0xFF, 8 - } - , - { - IMPS_BCT_IO_INTERRUPT, IMPS_INT_INT, 0, 0, 9, 0xFF, 9 - } - , - { - IMPS_BCT_IO_INTERRUPT, IMPS_INT_INT, 0, 0, 10, 0xFF, 10 - } - , - { - IMPS_BCT_IO_INTERRUPT, IMPS_INT_INT, 0, 0, 11, 0xFF, 11 - } - , - { - IMPS_BCT_IO_INTERRUPT, IMPS_INT_INT, 0, 0, 12, 0xFF, 12 - } - , - { - IMPS_BCT_IO_INTERRUPT, IMPS_INT_INT, 0, 0, 13, 0xFF, 13 - } - , - { - IMPS_BCT_IO_INTERRUPT, IMPS_INT_INT, 0, 0, 14, 0xFF, 14 - } - , - { - IMPS_BCT_IO_INTERRUPT, IMPS_INT_INT, 0, 0, 15, 0xFF, 15 - } - } - , - { - { - IMPS_BCT_LOCAL_INTERRUPT, IMPS_INT_EXTINT, 0, 0, 15, 0xFF, 0 - } - , - { - IMPS_BCT_LOCAL_INTERRUPT, IMPS_INT_NMI, 0, 0, 15, 0xFF, 1 - } - } -}; - -/* - * Exported globals here. - */ - -static int imps_any_new_apics = 0; -#if 0 -volatile int imps_release_cpus = 0; -#endif -static int imps_enabled = 0; -static int imps_num_cpus = 1; -static unsigned imps_lapic_addr = ((unsigned) (&lapic_dummy)) - LAPIC_ID; -static unsigned char imps_cpu_apic_map[IMPS_MAX_CPUS]; -static unsigned char imps_apic_cpu_map[IMPS_MAX_CPUS]; - - -/* - * MPS checksum function - * - * Function finished. - */ - -static int -get_checksum (unsigned start, int length) -{ - unsigned sum = 0; - - while (length-- > 0) - { - sum += *((unsigned char *) (start++)); - } - - return (sum & 0xFF); -} - - -/* - * Primary function for booting individual CPUs. - * - * This must be modified to perform whatever OS-specific initialization - * that is required. - */ - -static int -boot_cpu (imps_processor * proc) -{ - unsigned bootaddr, accept_status; - unsigned bios_reset_vector = PHYS_TO_VIRTUAL (BIOS_RESET_VECTOR); - - /* %%%%% ESB */ - extern char patch_code[]; - bootaddr = 256 * 1024; - memmove ((char *) bootaddr, patch_code, 32); - - /* - * Generic CPU startup sequence starts here. - */ - - /* set BIOS reset vector */ - CMOS_WRITE_BYTE (CMOS_RESET_CODE, CMOS_RESET_JUMP); - *((volatile unsigned *) bios_reset_vector) = bootaddr << 12; - - /* clear the error register */ - if (proc->apic_ver & 0x10) - { - IMPS_LAPIC_WRITE (LAPIC_ESR, 0); - accept_status = IMPS_LAPIC_READ (LAPIC_ESR); - } - -#if 0 - /* assert INIT IPI */ - cfg = IMPS_LAPIC_READ (LAPIC_ICR + 1); - cfg &= LAPIC_DEST_MASK; - IMPS_LAPIC_WRITE (LAPIC_ICR + 1, cfg); - cfg = IMPS_LAPIC_READ (LAPIC_ACR); - cfg &=; - - /* %%%%% ESB finish adding startup sequence */ -#endif - - /* clean up BIOS reset vector */ - CMOS_WRITE_BYTE (CMOS_RESET_CODE, 0); - *((volatile unsigned *) bios_reset_vector) = 0; - - /* - * Generic CPU startup sequence ends here. - */ - - KERNEL_PRINT (("\n")); - - return 1; - - /* XXXXX add OS-specific initialization here! */ -} - - -/* - * read bios stuff and fill tables - */ - -static void -add_processor (imps_processor * proc) -{ - int apicid = proc->apic_id; - - KERNEL_PRINT ((" Processor [APIC id %d ver %d]: ", - apicid, proc->apic_ver)); - if (!(proc->flags & IMPS_FLAG_ENABLED)) - { - KERNEL_PRINT (("DISABLED\n")); - return; - } - if (proc->apic_ver > 0xF) - { - imps_any_new_apics = 1; - } - if (proc->flags & (IMPS_CPUFLAG_BOOT)) - { - KERNEL_PRINT (("#0 Bootstrap Processor (BSP)\n")); - return; - } - imps_cpu_apic_map[imps_num_cpus] = apicid; - imps_apic_cpu_map[apicid] = imps_num_cpus; - if (boot_cpu (proc)) - { - - /* XXXXX add OS-specific setup for secondary CPUs here */ - - imps_num_cpus++; - } -} - - -static void -add_bus (imps_bus * bus) -{ - char str[8]; - - memmove (str, bus->bus_type, 6); - str[6] = 0; - KERNEL_PRINT ((" Bus id %d is %s\n", bus->id, str)); - - /* XXXXX add OS-specific code here */ -} - - -static void -add_ioapic (imps_ioapic * ioapic) -{ - KERNEL_PRINT ((" I/O APIC id %d ver %d, address: 0x%x ", - ioapic->id, ioapic->ver, ioapic->addr)); - if (!(ioapic->flags & IMPS_FLAG_ENABLED)) - { - KERNEL_PRINT (("DISABLED\n")); - return; - } - KERNEL_PRINT (("\n")); - - /* XXXXX add OS-specific code here */ -} - - -static void -imps_read_config_table (unsigned start, int count) -{ - while (count-- > 0) - { - switch (*((unsigned char *) start)) - { - case IMPS_BCT_PROCESSOR: - add_processor ((imps_processor *) start); - start += 12; /* 20 total */ - break; - case IMPS_BCT_BUS: - add_bus ((imps_bus *) start); - break; - case IMPS_BCT_IOAPIC: - add_ioapic ((imps_ioapic *) start); - break; -#if 0 /* XXXXX uncomment this if "add_io_interrupt" is implemented */ - case IMPS_BCT_IO_INTERRUPT: - add_io_interrupt ((imps_interrupt *) start); - break; -#endif -#if 0 /* XXXXX uncomment this if "add_local_interrupt" is implemented */ - case IMPS_BCT_LOCAL_INTERRUPT: - add_local_interupt ((imps_interrupt *) start); - break; -#endif - default: - break; - } - start += 8; - } -} - - -static int -imps_bad_bios (imps_fps * fps_ptr) -{ - int sum; - imps_cth *local_cth_ptr - = (imps_cth *) PHYS_TO_VIRTUAL (fps_ptr->cth_ptr); - - if (fps_ptr->feature_info[0] > IMPS_FPS_DEFAULT_MAX) - { - KERNEL_PRINT ((" Invalid MP System Configuration type %d\n", - fps_ptr->feature_info[0])); - return 1; - } - - if (fps_ptr->cth_ptr) - { - sum = get_checksum ((unsigned) local_cth_ptr, - local_cth_ptr->base_length); - if (local_cth_ptr->sig != IMPS_CTH_SIGNATURE || sum) - { - KERNEL_PRINT - ((" Bad MP Config Table sig 0x%x and/or checksum 0x%x\n", - (unsigned) (fps_ptr->cth_ptr), sum)); - return 1; - } - if (local_cth_ptr->spec_rev != fps_ptr->spec_rev) - { - KERNEL_PRINT ((" Bad MP Config Table sub-revision # %d\n", local_cth_ptr->spec_rev)); - return 1; - } - if (local_cth_ptr->extended_length) - { - sum = (get_checksum (((unsigned) local_cth_ptr) - + local_cth_ptr->base_length, - local_cth_ptr->extended_length) - + local_cth_ptr->extended_checksum) & 0xFF; - if (sum) - { - KERNEL_PRINT - ((" Bad Extended MP Config Table checksum 0x%x\n", sum)); - return 1; - } - } - } - else if (!fps_ptr->feature_info[0]) - { - KERNEL_PRINT ((" Missing configuration information\n")); - return 1; - } - - return 0; -} - - -static void -imps_read_bios (imps_fps * fps_ptr) -{ - int apicid; - unsigned cth_start, cth_count; - imps_cth *local_cth_ptr - = (imps_cth *) PHYS_TO_VIRTUAL (fps_ptr->cth_ptr); - char *str_ptr; - - KERNEL_PRINT (("Intel MultiProcessor Spec 1.%d BIOS support detected\n", - fps_ptr->spec_rev)); - - /* - * Do all checking of errors which would definitely - * lead to failure of the SMP boot here. - */ - - if (imps_bad_bios (fps_ptr)) - { - KERNEL_PRINT ((" Disabling MPS support\n")); - return; - } - - if (fps_ptr->feature_info[1] & IMPS_FPS_IMCRP_BIT) - { - str_ptr = "IMCR and PIC"; - } - else - { - str_ptr = "Virtual Wire"; - } - if (fps_ptr->cth_ptr) - { - imps_lapic_addr = local_cth_ptr->lapic_addr; - } - else - { - imps_lapic_addr = LAPIC_ADDR_DEFAULT; - } - KERNEL_PRINT - ((" APIC config: \"%s mode\" Local APIC address: 0x%x\n", - str_ptr, imps_lapic_addr)); - imps_lapic_addr = PHYS_TO_VIRTUAL (imps_lapic_addr); - - /* - * Setup primary CPU. - */ - apicid = IMPS_LAPIC_READ (LAPIC_SPIV); - IMPS_LAPIC_WRITE (LAPIC_SPIV, apicid | LAPIC_SPIV_ENABLE_APIC); - imps_any_new_apics = IMPS_LAPIC_READ (LAPIC_VER) & 0xF0; - apicid = IMPS_APIC_ID (IMPS_LAPIC_READ (LAPIC_ID)); - imps_cpu_apic_map[0] = apicid; - imps_apic_cpu_map[apicid] = 0; - - if (fps_ptr->cth_ptr) - { - char str1[16], str2[16]; - memcpy (str1, local_cth_ptr->oem_id, 8); - str1[8] = 0; - memcpy (str2, local_cth_ptr->prod_id, 12); - str2[12] = 0; - KERNEL_PRINT ((" OEM id: %s Product id: %s\n", str1, str2)); - cth_start = ((unsigned) local_cth_ptr) + sizeof (imps_cth); - cth_count = local_cth_ptr->entry_count; - } - else - { - *((volatile unsigned *) IOAPIC_ADDR_DEFAULT) = IOAPIC_ID; - defconfig.ioapic.id - = IMPS_APIC_ID (*((volatile unsigned *) - (IOAPIC_ADDR_DEFAULT + IOAPIC_RW))); - *((volatile unsigned *) IOAPIC_ADDR_DEFAULT) = IOAPIC_VER; - defconfig.ioapic.ver - = APIC_VERSION (*((volatile unsigned *) - (IOAPIC_ADDR_DEFAULT + IOAPIC_RW))); - defconfig.proc[apicid].flags - = IMPS_FLAG_ENABLED | IMPS_CPUFLAG_BOOT; - defconfig.proc[!apicid].flags = IMPS_FLAG_ENABLED; - imps_num_cpus = 2; - if (fps_ptr->feature_info[0] == 1 - || fps_ptr->feature_info[0] == 5) - { - memcpy (defconfig.bus[0].bus_type, "ISA ", 6); - } - if (fps_ptr->feature_info[0] == 4 - || fps_ptr->feature_info[0] == 7) - { - memcpy (defconfig.bus[0].bus_type, "MCA ", 6); - } - if (fps_ptr->feature_info[0] > 4) - { - defconfig.proc[0].apic_ver = 0x10; - defconfig.proc[1].apic_ver = 0x10; - defconfig.bus[1].type = IMPS_BCT_BUS; - } - if (fps_ptr->feature_info[0] == 2) - { - defconfig.intin[2].type = 255; - defconfig.intin[13].type = 255; - } - if (fps_ptr->feature_info[0] == 7) - { - defconfig.intin[0].type = 255; - } - cth_start = (unsigned) &defconfig; - cth_count = DEF_ENTRIES; - } - imps_read_config_table (cth_start, cth_count); - - /* %%%%% ESB read extended entries here */ - - imps_enabled = 1; -} - - -/* - * Given a region to check, this actually looks for the "MP Floating - * Pointer Structure". The return value indicates if the correct - * signature and checksum for a floating pointer structure of the - * appropriate spec revision was found. If so, then do not search - * further. - * - * NOTE: The memory scan will always be in the bottom 1 MB. - * - * This function presumes that "start" will always be aligned to a 16-bit - * boundary. - * - * Function finished. - */ - -static int -imps_scan (unsigned start, unsigned length) -{ - IMPS_DEBUG_PRINT (("Scanning from 0x%x for %d bytes\n", - start, length)); - - while (length > 0) - { - imps_fps *fps_ptr = (imps_fps *) PHYS_TO_VIRTUAL (start); - - if (fps_ptr->sig == IMPS_FPS_SIGNATURE - && fps_ptr->length == 1 - && (fps_ptr->spec_rev == 1 || fps_ptr->spec_rev == 4) - && !get_checksum (start, 16)) - { - IMPS_DEBUG_PRINT (("Found MP Floating Structure Pointer at %x\n", start)); - imps_read_bios (fps_ptr); - return 1; - } - - length -= 16; - start += 16; - } - - return 0; -} - - -/* - * This is the primary function for probing for MPS compatible hardware - * and BIOS information. Call this during the early stages of OS startup, - * before memory can be messed up. - * - * The probe looks for the "MP Floating Pointer Structure" at locations - * listed at the top of page 4-2 of the spec. - * - * Environment requirements from the OS to run: - * - * (1) : A non-linear virtual to physical memory mapping is probably OK, - * as (I think) the structures all fall within page boundaries, - * but a linear mapping is recommended. Currently assumes that - * the mapping will remain identical over time (which should be - * OK since it only accesses memory which shouldn't be munged - * by the OS anyway). - * (2) : The OS only consumes memory which the BIOS says is OK to use, - * and not any of the BIOS standard areas (the areas 0x400 to - * 0x600, the EBDA, 0xE0000 to 0xFFFFF, and unreported physical - * RAM). Sometimes a small amount of physical RAM is not - * reported by the BIOS, to be used to store MPS and other - * information. - * (3) : It must be possible to read the CMOS. - * (4) : There must be between 512K and 640K of lower memory (this is a - * sanity check). - * - * Function finished. - */ - -int -imps_probe (void) -{ - /* - * Determine possible address of the EBDA - */ - unsigned ebda_addr = *((unsigned short *) - PHYS_TO_VIRTUAL (EBDA_SEG_ADDR)) << 4; - - /* - * Determine amount of installed lower memory (not *available* - * lower memory). - * - * NOTE: This should work reliably as long as we verify the - * machine is at least a system that could possibly have - * MPS compatibility to begin with. - */ - unsigned mem_lower = ((CMOS_READ_BYTE (CMOS_BASE_MEMORY + 1) << 8) - | CMOS_READ_BYTE (CMOS_BASE_MEMORY)) << 10; - -#ifdef IMPS_DEBUG - imps_enabled = 0; - imps_num_cpus = 1; -#endif - - /* - * Sanity check : if this isn't reasonable, it is almost impossibly - * unlikely to be an MPS compatible machine, so return failure. - */ - if (mem_lower < 512 * 1024 || mem_lower > 640 * 1024) - { - return 0; - } - - if (ebda_addr > mem_lower - 1024 - || ebda_addr + *((unsigned char *) PHYS_TO_VIRTUAL (ebda_addr)) - * 1024 > mem_lower) - { - ebda_addr = 0; - } - - if (((ebda_addr && imps_scan (ebda_addr, 1024)) - || (!ebda_addr && imps_scan (mem_lower - 1024, 1024)) - || imps_scan (0xF0000, 0x10000)) && imps_enabled) - { - return 1; - } - - /* - * If no BIOS info on MPS hardware is found, then return failure. - */ - - return 0; -} diff --git a/usr/src/grub/grub-0.95/stage2/smp-imps.h b/usr/src/grub/grub-0.95/stage2/smp-imps.h deleted file mode 100644 index dc239942e0..0000000000 --- a/usr/src/grub/grub-0.95/stage2/smp-imps.h +++ /dev/null @@ -1,238 +0,0 @@ -/* - * - * - * Author: Erich Boleyn http://www.uruk.org/~erich/ - * - * Header file implementing Intel MultiProcessor Specification (MPS) - * version 1.1 and 1.4 SMP hardware control for Intel Architecture CPUs, - * with hooks for running correctly on a standard PC without the hardware. - * - * This file was created from information in the Intel MPS version 1.4 - * document, order number 242016-004, which can be ordered from the - * Intel literature center. - */ - -#ifndef _SMP_IMPS_H -#define _SMP_IMPS_H - -/* make sure "apic.h" is included */ -#ifndef _APIC_H -#error Must include "apic.h" before "smp-imps.h" -#endif /* !_APIC_H */ - -/* - * Defines used. - */ - -#ifdef IMPS_DEBUG -#define IMPS_DEBUG_PRINT(x) KERNEL_PRINT(x) -#else /* !IMPS_DEBUG */ -#define IMPS_DEBUG_PRINT(x) -#endif /* !IMPS_DEBUG */ - -#define IMPS_MAX_CPUS APIC_BROADCAST_ID - -/* - * Defines representing limitations on values usable in different - * situations. This mostly depends on whether the APICs are old - * (82489DX) or new (SIO or Pentium/Pentium Pro integrated APICs). - * - * NOTE: It appears that the APICs must either be all old or all new, - * or broadcasts won't work right. - * NOTE #2: Given that, the maximum ID which can be sent to predictably - * is 14 for new APICs and 254 for old APICs. So, this all implies that - * a maximum of 15 processors is supported with the new APICs, and a - * maximum of 255 processors with the old APICs. - */ - -#define IMPS_APIC_ID(x) \ - ( imps_any_new_apics ? APIC_NEW_ID(x) : APIC_OLD_ID(x) ) - -/* - * This is the value that must be in the "sig" member of the MP - * Floating Pointer Structure. - */ -#define IMPS_FPS_SIGNATURE ('_' | ('M'<<8) | ('P'<<16) | ('_'<<24)) -#define IMPS_FPS_IMCRP_BIT 0x80 -#define IMPS_FPS_DEFAULT_MAX 7 - -/* - * This is the value that must be in the "sig" member of the MP - * Configuration Table Header. - */ -#define IMPS_CTH_SIGNATURE ('P' | ('C'<<8) | ('M'<<16) | ('P'<<24)) - -/* - * These are the "type" values for Base MP Configuration Table entries. - */ -#define IMPS_FLAG_ENABLED 1 -#define IMPS_BCT_PROCESSOR 0 -#define IMPS_CPUFLAG_BOOT 2 -#define IMPS_BCT_BUS 1 -#define IMPS_BCT_IOAPIC 2 -#define IMPS_BCT_IO_INTERRUPT 3 -#define IMPS_BCT_LOCAL_INTERRUPT 4 -#define IMPS_INT_INT 0 -#define IMPS_INT_NMI 1 -#define IMPS_INT_SMI 2 -#define IMPS_INT_EXTINT 3 - - -/* - * Typedefs and data item definitions done here. - */ - -typedef struct imps_fps imps_fps; /* MP floating pointer structure */ -typedef struct imps_cth imps_cth; /* MP configuration table header */ -typedef struct imps_processor imps_processor; -typedef struct imps_bus imps_bus; -typedef struct imps_ioapic imps_ioapic; -typedef struct imps_interrupt imps_interrupt; - - -/* - * Data structures defined here - */ - -/* - * MP Floating Pointer Structure (fps) - * - * Look at page 4-3 of the MP spec for the starting definitions of - * this structure. - */ -struct imps_fps - { - unsigned sig; - imps_cth *cth_ptr; - unsigned char length; - unsigned char spec_rev; - unsigned char checksum; - unsigned char feature_info[5]; - }; - -/* - * MP Configuration Table Header (cth) - * - * Look at page 4-5 of the MP spec for the starting definitions of - * this structure. - */ -struct imps_cth - { - unsigned sig; - unsigned short base_length; - unsigned char spec_rev; - unsigned char checksum; - char oem_id[8]; - char prod_id[12]; - unsigned oem_table_ptr; - unsigned short oem_table_size; - unsigned short entry_count; - unsigned lapic_addr; - unsigned short extended_length; - unsigned char extended_checksum; - char reserved[1]; - }; - -/* - * Base MP Configuration Table Types. They are sorted according to - * type (i.e. all of type 0 come first, etc.). Look on page 4-6 for - * the start of the descriptions. - */ - -struct imps_processor - { - unsigned char type; /* must be 0 */ - unsigned char apic_id; - unsigned char apic_ver; - unsigned char flags; - unsigned signature; - unsigned features; - char reserved[8]; - }; - -struct imps_bus - { - unsigned char type; /* must be 1 */ - unsigned char id; - char bus_type[6]; - }; - -struct imps_ioapic - { - unsigned char type; /* must be 2 */ - unsigned char id; - unsigned char ver; - unsigned char flags; - unsigned addr; - }; - -struct imps_interrupt - { - unsigned char type; /* must be 3 or 4 */ - unsigned char int_type; - unsigned short flags; - unsigned char source_bus_id; - unsigned char source_bus_irq; - unsigned char dest_apic_id; - unsigned char dest_apic_intin; - }; - - -/* - * Exported globals here. - */ - -/* - * "imps_any_new_apics" is non-zero if any of the APICS (local or I/O) - * are *not* an 82489DX. This is useful to determine if more than 15 - * CPUs can be supported (true if zero). - */ -extern int imps_any_new_apics; - -/* - * "imps_enabled" is non-zero if the probe sequence found IMPS - * information and was successful. - */ -extern int imps_enabled; - -/* - * This contains the local APIC hardware address. - */ -extern unsigned imps_lapic_addr; - -/* - * This represents the number of CPUs found. - */ -extern int imps_num_cpus; - -/* - * These map from virtual cpu numbers to APIC id's and back. - */ -extern unsigned char imps_cpu_apic_map[IMPS_MAX_CPUS]; -extern unsigned char imps_apic_cpu_map[IMPS_MAX_CPUS]; - - -/* - * This is the primary function for probing for Intel MPS 1.1/1.4 - * compatible hardware and BIOS information. While probing the CPUs - * information returned from the BIOS, this also starts up each CPU - * and gets it ready for use. - * - * Call this during the early stages of OS startup, before memory can - * be messed up. - * - * Returns 1 if IMPS information was found and is valid, else 0. - */ - -int imps_probe (void); - - -/* - * Defines that use variables - */ - -#define IMPS_LAPIC_READ(x) (*((volatile unsigned *) (imps_lapic_addr+(x)))) -#define IMPS_LAPIC_WRITE(x, y) \ - (*((volatile unsigned *) (imps_lapic_addr+(x))) = (y)) - -#endif /* !_SMP_IMPS_H */ diff --git a/usr/src/grub/grub-0.95/stage2/stage1_5.c b/usr/src/grub/grub-0.95/stage2/stage1_5.c deleted file mode 100644 index f04a3371d9..0000000000 --- a/usr/src/grub/grub-0.95/stage2/stage1_5.c +++ /dev/null @@ -1,69 +0,0 @@ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 2001,2002 Free Software Foundation, 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 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 "shared.h" - -static unsigned int saved_sector = (unsigned int)-1; - -static void -disk_read_savesect_func (unsigned int sector, int offset, int length) -{ - saved_sector = sector; -} - -void -cmain (void) -{ - grub_printf ("\n\nGRUB loading, please wait...\n"); - - /* - * Here load the true second-stage boot-loader. - */ - - if (grub_open (config_file)) - { - int ret; - - disk_read_hook = disk_read_savesect_func; - grub_read ((char *) 0x8000, SECTOR_SIZE * 2); - disk_read_hook = NULL; - - /* Sanity check: catch an internal error. */ - if (saved_sector == (unsigned int)-1) - { - grub_printf ("internal error: the second sector of Stage 2 is unknown."); - stop (); - } - - ret = grub_read ((char *) 0x8000 + SECTOR_SIZE * 2, -1); - - grub_close (); - - if (ret) - chain_stage2 (0, 0x8200, saved_sector); - } - - /* - * If not, then print error message and die. - */ - - print_error (); - - stop (); -} diff --git a/usr/src/grub/grub-0.95/stage2/stage2.c b/usr/src/grub/grub-0.95/stage2/stage2.c deleted file mode 100644 index 3027a470cc..0000000000 --- a/usr/src/grub/grub-0.95/stage2/stage2.c +++ /dev/null @@ -1,1104 +0,0 @@ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 2000,2001,2002,2004 Free Software Foundation, 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 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 -#include - -grub_jmp_buf restart_env; - -struct silentbuf silent; -int reset_term; - -#if defined(PRESET_MENU_STRING) || defined(SUPPORT_DISKLESS) - -# if defined(PRESET_MENU_STRING) -static const char *preset_menu = PRESET_MENU_STRING; -# elif defined(SUPPORT_DISKLESS) -/* Execute the command "bootp" automatically. */ -static const char *preset_menu = "dhcp\n"; -# endif /* SUPPORT_DISKLESS */ - -static int preset_menu_offset; - -static int -open_preset_menu (void) -{ -#ifdef GRUB_UTIL - /* Unless the user explicitly requests to use the preset menu, - always opening the preset menu fails in the grub shell. */ - if (! use_preset_menu) - return 0; -#endif /* GRUB_UTIL */ - - preset_menu_offset = 0; - return preset_menu != 0; -} - -static int -read_from_preset_menu (char *buf, int maxlen) -{ - int len = grub_strlen (preset_menu + preset_menu_offset); - - if (len > maxlen) - len = maxlen; - - grub_memmove (buf, preset_menu + preset_menu_offset, len); - preset_menu_offset += len; - - return len; -} - -static void -close_preset_menu (void) -{ - /* Disable the preset menu. */ - preset_menu = 0; -} - -#else /* ! PRESET_MENU_STRING && ! SUPPORT_DISKLESS */ - -#define open_preset_menu() 0 -#define read_from_preset_menu(buf, maxlen) 0 -#define close_preset_menu() - -#endif /* ! PRESET_MENU_STRING && ! SUPPORT_DISKLESS */ - -static char * -get_entry (char *list, int num, int nested) -{ - int i; - - for (i = 0; i < num; i++) - { - do - { - while (*(list++)); - } - while (nested && *(list++)); - } - - return list; -} - -/* Print an entry in a line of the menu box. */ -static void -print_entry (int y, int highlight, char *entry) -{ - int x; - - if (current_term->setcolorstate) - current_term->setcolorstate (COLOR_STATE_NORMAL); - - if (highlight && current_term->setcolorstate) - current_term->setcolorstate (COLOR_STATE_HIGHLIGHT); - - gotoxy (2, y); - grub_putchar (' '); - for (x = 3; x < 75; x++) - { - if (*entry && x <= 72) - { - if (x == 72) - grub_putchar (DISP_RIGHT); - else - grub_putchar (*entry++); - } - else - grub_putchar (' '); - } - gotoxy (74, y); - - if (current_term->setcolorstate) - current_term->setcolorstate (COLOR_STATE_STANDARD); -} - -/* Print entries in the menu box. */ -static void -print_entries (int y, int size, int first, int entryno, char *menu_entries) -{ - int i; - - gotoxy (77, y + 1); - - if (first) - grub_putchar (DISP_UP); - else - grub_putchar (' '); - - menu_entries = get_entry (menu_entries, first, 0); - - for (i = 0; i < size; i++) - { - print_entry (y + i + 1, entryno == i, menu_entries); - - while (*menu_entries) - menu_entries++; - - if (*(menu_entries - 1)) - menu_entries++; - } - - gotoxy (77, y + size); - - if (*menu_entries) - grub_putchar (DISP_DOWN); - else - grub_putchar (' '); - - gotoxy (74, y + entryno + 1); -} - -static void -print_entries_raw (int size, int first, char *menu_entries) -{ - int i; - -#define LINE_LENGTH 67 - - for (i = 0; i < LINE_LENGTH; i++) - grub_putchar ('-'); - grub_putchar ('\n'); - - for (i = first; i < size; i++) - { - /* grub's printf can't %02d so ... */ - if (i < 10) - grub_putchar (' '); - grub_printf ("%d: %s\n", i, get_entry (menu_entries, i, 0)); - } - - for (i = 0; i < LINE_LENGTH; i++) - grub_putchar ('-'); - grub_putchar ('\n'); - -#undef LINE_LENGTH -} - - -static void -print_border (int y, int size) -{ - int i; - - if (current_term->setcolorstate) - current_term->setcolorstate (COLOR_STATE_NORMAL); - - gotoxy (1, y); - - grub_putchar (DISP_UL); - for (i = 0; i < 73; i++) - grub_putchar (DISP_HORIZ); - grub_putchar (DISP_UR); - - i = 1; - while (1) - { - gotoxy (1, y + i); - - if (i > size) - break; - - grub_putchar (DISP_VERT); - gotoxy (75, y + i); - grub_putchar (DISP_VERT); - - i++; - } - - grub_putchar (DISP_LL); - for (i = 0; i < 73; i++) - grub_putchar (DISP_HORIZ); - grub_putchar (DISP_LR); - - if (current_term->setcolorstate) - current_term->setcolorstate (COLOR_STATE_STANDARD); -} - -static void -run_menu (char *menu_entries, char *config_entries, int num_entries, - char *heap, int entryno) -{ - int c, time1, time2 = -1, first_entry = 0; - char *cur_entry = 0; - struct term_entry *prev_term = NULL; - - /* - * Main loop for menu UI. - */ - -restart: - /* Dumb terminal always use all entries for display - invariant for TERM_DUMB: first_entry == 0 */ - if (! (current_term->flags & TERM_DUMB)) - { - while (entryno > 11) - { - first_entry++; - entryno--; - } - } - - /* If the timeout was expired or wasn't set, force to show the menu - interface. */ - if (grub_timeout < 0) - show_menu = 1; - - /* If SHOW_MENU is false, don't display the menu until ESC is pressed. */ - if (! show_menu) - { - /* Get current time. */ - while ((time1 = getrtsecs ()) == 0xFF) - ; - - while (1) - { - /* Check if ESC is pressed. */ - if (checkkey () != -1 && ASCII_CHAR (getkey ()) == '\e') - { - grub_timeout = -1; - show_menu = 1; - break; - } - - /* If GRUB_TIMEOUT is expired, boot the default entry. */ - if (grub_timeout >=0 - && (time1 = getrtsecs ()) != time2 - && time1 != 0xFF) - { - if (grub_timeout <= 0) - { - grub_timeout = -1; - goto boot_entry; - } - - time2 = time1; - grub_timeout--; - - /* Print a message. */ - grub_printf ("\rPress `ESC' to enter the menu... %d ", - grub_timeout); - } - } - } - - /* Only display the menu if the user wants to see it. */ - if (show_menu) - { - init_page (); - setcursor (0); - - if (current_term->flags & TERM_DUMB) - print_entries_raw (num_entries, first_entry, menu_entries); - else - print_border (3, 12); - - grub_printf ("\n\ - Use the %c and %c keys to select which entry is highlighted.\n", - DISP_UP, DISP_DOWN); - - if (! auth && password) - { - printf ("\ - Press enter to boot the selected OS or \'p\' to enter a\n\ - password to unlock the next set of features."); - } - else - { - if (config_entries) - printf ("\ - Press enter to boot the selected OS, \'e\' to edit the\n\ - commands before booting, or \'c\' for a command-line."); - else - printf ("\ - Press \'b\' to boot, \'e\' to edit the selected command in the\n\ - boot sequence, \'c\' for a command-line, \'o\' to open a new line\n\ - after (\'O\' for before) the selected line, \'d\' to remove the\n\ - selected line, or escape to go back to the main menu."); - } - - if (current_term->flags & TERM_DUMB) - grub_printf ("\n\nThe selected entry is %d ", entryno); - else - print_entries (3, 12, first_entry, entryno, menu_entries); - } - - /* XX using RT clock now, need to initialize value */ - while ((time1 = getrtsecs()) == 0xFF); - - while (1) - { - /* Initialize to NULL just in case... */ - cur_entry = NULL; - - if (grub_timeout >= 0 && (time1 = getrtsecs()) != time2 && time1 != 0xFF) - { - if (grub_timeout <= 0) - { - grub_timeout = -1; - break; - } - - /* else not booting yet! */ - time2 = time1; - - if (current_term->flags & TERM_DUMB) - grub_printf ("\r Entry %d will be booted automatically in %d seconds. ", - entryno, grub_timeout); - else - { - gotoxy (3, 22); - grub_printf ("The highlighted entry will be booted automatically in %d seconds. ", - grub_timeout); - gotoxy (74, 4 + entryno); - } - - grub_timeout--; - } - - /* Check for a keypress, however if TIMEOUT has been expired - (GRUB_TIMEOUT == -1) relax in GETKEY even if no key has been - pressed. - This avoids polling (relevant in the grub-shell and later on - in grub if interrupt driven I/O is done). */ - if (checkkey () >= 0 || grub_timeout < 0) - { - /* Key was pressed, show which entry is selected before GETKEY, - since we're comming in here also on GRUB_TIMEOUT == -1 and - hang in GETKEY */ - if (current_term->flags & TERM_DUMB) - grub_printf ("\r Highlighted entry is %d: ", entryno); - - c = ASCII_CHAR (getkey ()); - - if (grub_timeout >= 0) - { - if (current_term->flags & TERM_DUMB) - grub_putchar ('\r'); - else - gotoxy (3, 22); - printf (" "); - grub_timeout = -1; - fallback_entryno = -1; - if (! (current_term->flags & TERM_DUMB)) - gotoxy (74, 4 + entryno); - } - - /* We told them above (at least in SUPPORT_SERIAL) to use - '^' or 'v' so accept these keys. */ - if (c == 16 || c == '^') - { - if (current_term->flags & TERM_DUMB) - { - if (entryno > 0) - entryno--; - } - else - { - if (entryno > 0) - { - print_entry (4 + entryno, 0, - get_entry (menu_entries, - first_entry + entryno, - 0)); - entryno--; - print_entry (4 + entryno, 1, - get_entry (menu_entries, - first_entry + entryno, - 0)); - } - else if (first_entry > 0) - { - first_entry--; - print_entries (3, 12, first_entry, entryno, - menu_entries); - } - } - } - else if ((c == 14 || c == 'v') - && first_entry + entryno + 1 < num_entries) - { - if (current_term->flags & TERM_DUMB) - entryno++; - else - { - if (entryno < 11) - { - print_entry (4 + entryno, 0, - get_entry (menu_entries, - first_entry + entryno, - 0)); - entryno++; - print_entry (4 + entryno, 1, - get_entry (menu_entries, - first_entry + entryno, - 0)); - } - else if (num_entries > 12 + first_entry) - { - first_entry++; - print_entries (3, 12, first_entry, entryno, menu_entries); - } - } - } - else if (c == 7) - { - /* Page Up */ - first_entry -= 12; - if (first_entry < 0) - { - entryno += first_entry; - first_entry = 0; - if (entryno < 0) - entryno = 0; - } - print_entries (3, 12, first_entry, entryno, menu_entries); - } - else if (c == 3) - { - /* Page Down */ - first_entry += 12; - if (first_entry + entryno + 1 >= num_entries) - { - first_entry = num_entries - 12; - if (first_entry < 0) - first_entry = 0; - entryno = num_entries - first_entry - 1; - } - print_entries (3, 12, first_entry, entryno, menu_entries); - } - - if (config_entries) - { - if ((c == '\n') || (c == '\r') || (c == 6)) - break; - } - else - { - if ((c == 'd') || (c == 'o') || (c == 'O')) - { - if (! (current_term->flags & TERM_DUMB)) - print_entry (4 + entryno, 0, - get_entry (menu_entries, - first_entry + entryno, - 0)); - - /* insert after is almost exactly like insert before */ - if (c == 'o') - { - /* But `o' differs from `O', since it may causes - the menu screen to scroll up. */ - if (entryno < 11 || (current_term->flags & TERM_DUMB)) - entryno++; - else - first_entry++; - - c = 'O'; - } - - cur_entry = get_entry (menu_entries, - first_entry + entryno, - 0); - - if (c == 'O') - { - grub_memmove (cur_entry + 2, cur_entry, - ((int) heap) - ((int) cur_entry)); - - cur_entry[0] = ' '; - cur_entry[1] = 0; - - heap += 2; - - num_entries++; - } - else if (num_entries > 0) - { - char *ptr = get_entry(menu_entries, - first_entry + entryno + 1, - 0); - - grub_memmove (cur_entry, ptr, - ((int) heap) - ((int) ptr)); - heap -= (((int) ptr) - ((int) cur_entry)); - - num_entries--; - - if (entryno >= num_entries) - entryno--; - if (first_entry && num_entries < 12 + first_entry) - first_entry--; - } - - if (current_term->flags & TERM_DUMB) - { - grub_printf ("\n\n"); - print_entries_raw (num_entries, first_entry, - menu_entries); - grub_printf ("\n"); - } - else - print_entries (3, 12, first_entry, entryno, menu_entries); - } - - cur_entry = menu_entries; - if (c == 27) - return; - if (c == 'b') - break; - } - - if (! auth && password) - { - if (c == 'p') - { - /* Do password check here! */ - char entered[32]; - char *pptr = password; - - if (current_term->flags & TERM_DUMB) - grub_printf ("\r "); - else - gotoxy (1, 21); - - /* Wipe out the previously entered password */ - grub_memset (entered, 0, sizeof (entered)); - get_cmdline (" Password: ", entered, 31, '*', 0); - - while (! isspace (*pptr) && *pptr) - pptr++; - - /* Make sure that PASSWORD is NUL-terminated. */ - *pptr++ = 0; - - if (! check_password (entered, password, password_type)) - { - char *new_file = config_file; - while (isspace (*pptr)) - pptr++; - - /* If *PPTR is NUL, then allow the user to use - privileged instructions, otherwise, load - another configuration file. */ - if (*pptr != 0) - { - while ((*(new_file++) = *(pptr++)) != 0) - ; - - /* Make sure that the user will not have - authority in the next configuration. */ - auth = 0; - return; - } - else - { - /* Now the user is superhuman. */ - auth = 1; - goto restart; - } - } - else - { - grub_printf ("Failed!\n Press any key to continue..."); - getkey (); - goto restart; - } - } - } - else - { - if (c == 'e') - { - int new_num_entries = 0, i = 0; - char *new_heap; - - if (config_entries) - { - new_heap = heap; - cur_entry = get_entry (config_entries, - first_entry + entryno, - 1); - } - else - { - /* safe area! */ - new_heap = heap + NEW_HEAPSIZE + 1; - cur_entry = get_entry (menu_entries, - first_entry + entryno, - 0); - } - - do - { - while ((*(new_heap++) = cur_entry[i++]) != 0); - new_num_entries++; - } - while (config_entries && cur_entry[i]); - - /* this only needs to be done if config_entries is non-NULL, - but it doesn't hurt to do it always */ - *(new_heap++) = 0; - - if (config_entries) - run_menu (heap, NULL, new_num_entries, new_heap, 0); - else - { - cls (); - print_cmdline_message (0); - - new_heap = heap + NEW_HEAPSIZE + 1; - - saved_drive = boot_drive; - saved_partition = install_partition; - current_drive = GRUB_INVALID_DRIVE; - - if (! get_cmdline (PACKAGE " edit> ", new_heap, - NEW_HEAPSIZE + 1, 0, 1)) - { - int j = 0; - - /* get length of new command */ - while (new_heap[j++]) - ; - - if (j < 2) - { - j = 2; - new_heap[0] = ' '; - new_heap[1] = 0; - } - - /* align rest of commands properly */ - grub_memmove (cur_entry + j, cur_entry + i, - (int) heap - ((int) cur_entry + i)); - - /* copy command to correct area */ - grub_memmove (cur_entry, new_heap, j); - - heap += (j - i); - } - } - - goto restart; - } - if (c == 'c') - { - enter_cmdline (heap, 0); - goto restart; - } -#ifdef GRUB_UTIL - if (c == 'q') - { - /* The same as ``quit''. */ - stop (); - } -#endif - } - } - } - - /* Attempt to boot an entry. */ - - boot_entry: - - if (silent.status != DEFER_VERBOSE) - silent.status = SILENT; - - reset_term = 1; - - cls (); - setcursor (1); - - /* if our terminal needed initialization, we should shut it down - * before booting the kernel, but we want to save what it was so - * we can come back if needed */ - prev_term = current_term; - - if (silent.status != SILENT) - if (current_term->shutdown) { - (*current_term->shutdown)(); - current_term = term_table; /* assumption: console is first */ - } - - while (1) - { - if (config_entries) - printf (" Booting \'%s\'\n\n", - get_entry (menu_entries, first_entry + entryno, 0)); - else - printf (" Booting command-list\n\n"); - - if (! cur_entry) - cur_entry = get_entry (config_entries, first_entry + entryno, 1); - - /* Set CURRENT_ENTRYNO for the command "savedefault". */ - current_entryno = first_entry + entryno; - - if (run_script (cur_entry, heap)) - { - if (fallback_entryno >= 0) - { - cur_entry = NULL; - first_entry = 0; - entryno = fallback_entries[fallback_entryno]; - fallback_entryno++; - if (fallback_entryno >= MAX_FALLBACK_ENTRIES - || fallback_entries[fallback_entryno] < 0) - fallback_entryno = -1; - } - else - break; - } - else - break; - } - - if (silent.status != SILENT) { /* don't reset if we never changed terms */ - /* if we get back here, we should go back to what our term was before */ - current_term = prev_term; - if (current_term->startup) - /* if our terminal fails to initialize, fall back to console since - * it should always work */ - if ((*current_term->startup)() == 0) - current_term = term_table; /* we know that console is first */ - } - - show_menu = 1; - goto restart; -} - - -static int -get_line_from_config (char *cmdline, int maxlen, int read_from_file) -{ - int pos = 0, literal = 0, comment = 0; - char c; /* since we're loading it a byte at a time! */ - - while (1) - { - if (read_from_file) - { - if (! grub_read (&c, 1)) - break; - } - else - { - if (! read_from_preset_menu (&c, 1)) - break; - } - - /* Skip all carriage returns. */ - if (c == '\r') - continue; - - /* Replace tabs with spaces. */ - if (c == '\t') - c = ' '; - - /* The previous is a backslash, then... */ - if (literal) - { - /* If it is a newline, replace it with a space and continue. */ - if (c == '\n') - { - c = ' '; - - /* Go back to overwrite a backslash. */ - if (pos > 0) - pos--; - } - - literal = 0; - } - - /* translate characters first! */ - if (c == '\\' && ! literal) - literal = 1; - - if (comment) - { - if (c == '\n') - comment = 0; - } - else if (! pos) - { - if (c == '#') - comment = 1; - else if ((c != ' ') && (c != '\n')) - cmdline[pos++] = c; - } - else - { - if (c == '\n') - break; - - if (pos < maxlen) - cmdline[pos++] = c; - } - } - - cmdline[pos] = 0; - - return pos; -} - - -/* This is the starting function in C. */ -void -cmain (void) -{ - int config_len, menu_len, num_entries; - char *config_entries, *menu_entries; - char *kill_buf = (char *) KILL_BUF; - - silent.status = DEFER_SILENT; - silent.looped = 0; - silent.buffer_start = silent.buffer; - - auto void reset (void); - void reset (void) - { - count_lines = -1; - config_len = 0; - menu_len = 0; - num_entries = 0; - config_entries = (char *) mbi.drives_addr + mbi.drives_length; - menu_entries = (char *) MENU_BUF; - init_config (); - } - - /* Initialize the environment for restarting Stage 2. */ - grub_setjmp (restart_env); - - /* Initialize the kill buffer. */ - *kill_buf = 0; - - /* Never return. */ - for (;;) - { - int is_opened, is_preset; - - reset (); - - /* Here load the configuration file. */ - -#ifdef GRUB_UTIL - if (use_config_file) -#endif /* GRUB_UTIL */ - { - char *default_file = (char *) DEFAULT_FILE_BUF; - int i; - - /* Get a saved default entry if possible. */ - saved_entryno = 0; - grub_strcpy (default_file, config_file); - for (i = grub_strlen(default_file); i >= 0; i--) - if (default_file[i] == '/') - { - i++; - break; - } - default_file[i] = 0; - grub_strncat (default_file + i, "default", DEFAULT_FILE_BUFLEN - i); - if (grub_open (default_file)) - { - char buf[10]; /* This is good enough. */ - char *p = buf; - int len; - - len = grub_read (buf, sizeof (buf)); - if (len > 0) - { - buf[sizeof (buf) - 1] = 0; - safe_parse_maxint (&p, &saved_entryno); - } - - grub_close (); - } - errnum = ERR_NONE; - - do - { - /* STATE 0: Before any title command. - STATE 1: In a title command. - STATE >1: In a entry after a title command. */ - int state = 0, prev_config_len = 0, prev_menu_len = 0; - char *cmdline; - - /* Try the preset menu first. This will succeed at most once, - because close_preset_menu disables the preset menu. */ - is_opened = is_preset = open_preset_menu (); - if (! is_opened) - { - is_opened = grub_open (config_file); - errnum = ERR_NONE; - } - - if (! is_opened) - break; - - /* This is necessary, because the menu must be overrided. */ - reset (); - - cmdline = (char *) CMDLINE_BUF; - while (get_line_from_config (cmdline, NEW_HEAPSIZE, - ! is_preset)) - { - struct builtin *builtin; - - /* Get the pointer to the builtin structure. */ - builtin = find_command (cmdline); - errnum = 0; - if (! builtin) - /* Unknown command. Just skip now. */ - continue; - - if (builtin->flags & BUILTIN_TITLE) - { - char *ptr; - - /* the command "title" is specially treated. */ - if (state > 1) - { - /* The next title is found. */ - num_entries++; - config_entries[config_len++] = 0; - prev_menu_len = menu_len; - prev_config_len = config_len; - } - else - { - /* The first title is found. */ - menu_len = prev_menu_len; - config_len = prev_config_len; - } - - /* Reset the state. */ - state = 1; - - /* Copy title into menu area. */ - ptr = skip_to (1, cmdline); - while ((menu_entries[menu_len++] = *(ptr++)) != 0) - ; - } - else if (! state) - { - /* Run a command found is possible. */ - if (builtin->flags & BUILTIN_MENU) - { - char *arg = skip_to (1, cmdline); - (builtin->func) (arg, BUILTIN_MENU); - errnum = 0; - } - else - /* Ignored. */ - continue; - } - else - { - char *ptr = cmdline; - - state++; - /* Copy config file data to config area. */ - while ((config_entries[config_len++] = *ptr++) != 0) - ; - } - } - - if (state > 1) - { - /* Finish the last entry. */ - num_entries++; - config_entries[config_len++] = 0; - } - else - { - menu_len = prev_menu_len; - config_len = prev_config_len; - } - - menu_entries[menu_len++] = 0; - config_entries[config_len++] = 0; - grub_memmove (config_entries + config_len, menu_entries, - menu_len); - menu_entries = config_entries + config_len; - - /* Make sure that all fallback entries are valid. */ - if (fallback_entryno >= 0) - { - for (i = 0; i < MAX_FALLBACK_ENTRIES; i++) - { - if (fallback_entries[i] < 0) - break; - if (fallback_entries[i] >= num_entries) - { - grub_memmove (fallback_entries + i, - fallback_entries + i + 1, - ((MAX_FALLBACK_ENTRIES - i - 1) - * sizeof (int))); - i--; - } - } - - if (fallback_entries[0] < 0) - fallback_entryno = -1; - } - /* Check if the default entry is present. Otherwise reset - it to fallback if fallback is valid, or to DEFAULT_ENTRY - if not. */ - if (default_entry >= num_entries) - { - if (fallback_entryno >= 0) - { - default_entry = fallback_entries[0]; - fallback_entryno++; - if (fallback_entryno >= MAX_FALLBACK_ENTRIES - || fallback_entries[fallback_entryno] < 0) - fallback_entryno = -1; - } - else - default_entry = 0; - } - - if (is_preset) - close_preset_menu (); - else - grub_close (); - } - while (is_preset); - } - - /* go ahead and make sure the terminal is setup */ - if (current_term->startup) - (*current_term->startup)(); - - if (! num_entries) - { - /* If no acceptable config file, goto command-line, starting - heap from where the config entries would have been stored - if there were any. */ - enter_cmdline (config_entries, 1); - } - else - { - /* Run menu interface. */ - run_menu (menu_entries, config_entries, num_entries, - menu_entries + menu_len, default_entry); - } - } -} diff --git a/usr/src/grub/grub-0.95/stage2/start.S b/usr/src/grub/grub-0.95/stage2/start.S deleted file mode 100644 index 9a7d5048fd..0000000000 --- a/usr/src/grub/grub-0.95/stage2/start.S +++ /dev/null @@ -1,409 +0,0 @@ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 1999,2000,2001 Free Software Foundation, 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 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. - */ - -#define ASM_FILE -#include - -#ifndef STAGE1_5 -#include -#endif - -/* - * defines for the code go here - */ - - /* Absolute addresses - This makes the assembler generate the address without support - from the linker. (ELF can't relocate 16-bit addresses!) */ -#ifdef STAGE1_5 -# define ABS(x) (x-_start+0x2000) -#else -# define ABS(x) (x-_start+0x8000) -#endif /* STAGE1_5 */ - - /* Print message string */ -#define MSG(x) movw $ABS(x), %si; call message - - .file "start.S" - - .text - - /* Tell GAS to generate 16-bit instructions so that this code works - in real mode. */ - .code16 - - .globl start, _start -start: -_start: - /* - * _start is loaded at 0x8000 and is jumped to with - * CS:IP 0:0x8000 in stage2. - */ - - /* - * we continue to use the stack for stage1 and assume that - * some registers are set to correct values. See stage1.S - * for more information. - */ - - /* save drive reference first thing! */ - pushw %dx - - /* print a notification message on the screen */ - pushw %si - MSG(notification_string) - popw %si - - /* this sets up for the first run through "bootloop" */ - movw $ABS(firstlist - BOOTSEC_LISTSIZE), %di - - /* save the sector number of the second sector in %ebp */ - movl (%di), %ebp - - /* this is the loop for reading the secondary boot-loader in */ -bootloop: - - /* check the number of sectors to read */ - cmpw $0, 4(%di) - - /* if zero, go to the start function */ - je bootit - -setup_sectors: - /* check if we use LBA or CHS */ - cmpb $0, -1(%si) - - /* jump to chs_mode if zero */ - je chs_mode - -lba_mode: - /* load logical sector start */ - movl (%di), %ebx - - /* the maximum is limited to 0x7f because of Phoenix EDD */ - xorl %eax, %eax - movb $0x7f, %al - - /* how many do we really want to read? */ - cmpw %ax, 4(%di) /* compare against total number of sectors */ - - /* which is greater? */ - jg 1f - - /* if less than, set to total */ - movw 4(%di), %ax - -1: - /* subtract from total */ - subw %ax, 4(%di) - - /* add into logical sector start */ - addl %eax, (%di) - - /* set up disk address packet */ - - /* the size and the reserved byte */ - movw $0x0010, (%si) - - /* the number of sectors */ - movw %ax, 2(%si) - - /* the absolute address (low 32 bits) */ - movl %ebx, 8(%si) - - /* the segment of buffer address */ - movw $BUFFERSEG, 6(%si) - - /* save %ax from destruction! */ - pushw %ax - - /* zero %eax */ - xorl %eax, %eax - - /* the offset of buffer address */ - movw %ax, 4(%si) - - /* the absolute address (high 32 bits) */ - movl %eax, 12(%si) - - -/* - * BIOS call "INT 0x13 Function 0x42" to read sectors from disk into memory - * Call with %ah = 0x42 - * %dl = drive number - * %ds:%si = segment:offset of disk address packet - * Return: - * %al = 0x0 on success; err code on failure - */ - - movb $0x42, %ah - int $0x13 - - jc read_error - - movw $BUFFERSEG, %bx - jmp copy_buffer - -chs_mode: - /* load logical sector start (bottom half) */ - movl (%di), %eax - - /* zero %edx */ - xorl %edx, %edx - - /* divide by number of sectors */ - divl (%si) - - /* save sector start */ - movb %dl, 10(%si) - - xorl %edx, %edx /* zero %edx */ - divl 4(%si) /* divide by number of heads */ - - /* save head start */ - movb %dl, 11(%si) - - /* save cylinder start */ - movw %ax, 12(%si) - - /* do we need too many cylinders? */ - cmpw 8(%si), %ax - jge geometry_error - - /* determine the maximum sector length of this read */ - movw (%si), %ax /* get number of sectors per track/head */ - - /* subtract sector start */ - subb 10(%si), %al - - /* how many do we really want to read? */ - cmpw %ax, 4(%di) /* compare against total number of sectors */ - - - /* which is greater? */ - jg 2f - - /* if less than, set to total */ - movw 4(%di), %ax - -2: - /* subtract from total */ - subw %ax, 4(%di) - - /* add into logical sector start */ - addl %eax, (%di) - -/* - * This is the loop for taking care of BIOS geometry translation (ugh!) - */ - - /* get high bits of cylinder */ - movb 13(%si), %dl - - shlb $6, %dl /* shift left by 6 bits */ - movb 10(%si), %cl /* get sector */ - - incb %cl /* normalize sector (sectors go - from 1-N, not 0-(N-1) ) */ - orb %dl, %cl /* composite together */ - movb 12(%si), %ch /* sector+hcyl in cl, cylinder in ch */ - - /* restore %dx */ - popw %dx - pushw %dx - - /* head number */ - movb 11(%si), %dh - - pushw %ax /* save %ax from destruction! */ - -/* - * BIOS call "INT 0x13 Function 0x2" to read sectors from disk into memory - * Call with %ah = 0x2 - * %al = number of sectors - * %ch = cylinder - * %cl = sector (bits 6-7 are high bits of "cylinder") - * %dh = head - * %dl = drive (0x80 for hard disk, 0x0 for floppy disk) - * %es:%bx = segment:offset of buffer - * Return: - * %al = 0x0 on success; err code on failure - */ - - movw $BUFFERSEG, %bx - movw %bx, %es /* load %es segment with disk buffer */ - - xorw %bx, %bx /* %bx = 0, put it at 0 in the segment */ - movb $0x2, %ah /* function 2 */ - int $0x13 - - jc read_error - - /* save source segment */ - movw %es, %bx - -copy_buffer: - - /* load addresses for copy from disk buffer to destination */ - movw 6(%di), %es /* load destination segment */ - - /* restore %ax */ - popw %ax - - /* determine the next possible destination address (presuming - 512 byte sectors!) */ - shlw $5, %ax /* shift %ax five bits to the left */ - addw %ax, 6(%di) /* add the corrected value to the destination - address for next time */ - - /* save addressing regs */ - pusha - pushw %ds - - /* get the copy length */ - shlw $4, %ax - movw %ax, %cx - - xorw %di, %di /* zero offset of destination addresses */ - xorw %si, %si /* zero offset of source addresses */ - movw %bx, %ds /* restore the source segment */ - - cld /* sets the copy direction to forward */ - - /* perform copy */ - rep /* sets a repeat */ - movsb /* this runs the actual copy */ - - /* restore addressing regs and print a dot with correct DS - (MSG modifies SI, which is saved, and unused AX and BX) */ - popw %ds - MSG(notification_step) - popa - - /* check if finished with this dataset */ - cmpw $0, 4(%di) - jne setup_sectors - - /* update position to load from */ - subw $BOOTSEC_LISTSIZE, %di - - /* jump to bootloop */ - jmp bootloop - -/* END OF MAIN LOOP */ - -bootit: - /* print a newline */ - MSG(notification_done) - popw %dx /* this makes sure %dl is our "boot" drive */ -#ifdef STAGE1_5 - ljmp $0, $0x2200 -#else /* ! STAGE1_5 */ - ljmp $0, $0x8200 -#endif /* ! STAGE1_5 */ - - -/* - * BIOS Geometry translation error (past the end of the disk geometry!). - */ -geometry_error: - MSG(geometry_error_string) - jmp general_error - -/* - * Read error on the disk. - */ -read_error: - MSG(read_error_string) - -general_error: - MSG(general_error_string) - -/* go here when you need to stop the machine hard after an error condition */ -stop: jmp stop - -#ifdef STAGE1_5 -notification_string: .string "Loading stage1.5" -#else -notification_string: .string "Loading stage2" -#endif - -notification_step: .string "." -notification_done: .string "\r\n" - -geometry_error_string: .string "Geom" -read_error_string: .string "Read" -general_error_string: .string " Error" - -/* - * message: write the string pointed to by %si - * - * WARNING: trashes %si, %ax, and %bx - */ - - /* - * Use BIOS "int 10H Function 0Eh" to write character in teletype mode - * %ah = 0xe %al = character - * %bh = page %bl = foreground color (graphics modes) - */ -1: - movw $0x0001, %bx - movb $0xe, %ah - int $0x10 /* display a byte */ - - incw %si -message: - movb (%si), %al - cmpb $0, %al - jne 1b /* if not end of string, jmp to display */ - ret -lastlist: - -/* - * This area is an empty space between the main body of code below which - * grows up (fixed after compilation, but between releases it may change - * in size easily), and the lists of sectors to read, which grows down - * from a fixed top location. - */ - - .word 0 - .word 0 - - . = _start + 0x200 - BOOTSEC_LISTSIZE - - /* fill the first data listing with the default */ -blocklist_default_start: - .long 2 /* this is the sector start parameter, in logical - sectors from the start of the disk, sector 0 */ -blocklist_default_len: - /* this is the number of sectors to read */ -#ifdef STAGE1_5 - .word 0 /* the command "install" will fill this up */ -#else - .word (STAGE2_SIZE + 511) >> 9 -#endif -blocklist_default_seg: -#ifdef STAGE1_5 - .word 0x220 -#else - .word 0x820 /* this is the segment of the starting address - to load the data into */ -#endif - -firstlist: /* this label has to be after the list data!!! */ diff --git a/usr/src/grub/grub-0.95/stage2/start_eltorito.S b/usr/src/grub/grub-0.95/stage2/start_eltorito.S deleted file mode 100644 index ed47ef03b3..0000000000 --- a/usr/src/grub/grub-0.95/stage2/start_eltorito.S +++ /dev/null @@ -1,326 +0,0 @@ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 1994-2002 H. Peter Anvin - * Copyright (C) 1999,2000,2001,2004 Free Software Foundation, 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 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. - * - */ - -/* - Most of this file was originally "isolinux.asm" from SYSLINUX package. - It has been very heavily modified. -*/ - -#define ASM_FILE -#include "stage1.h" -#include "shared.h" -#include "iso9660.h" - -#ifndef STAGE1_5 -#include "stage2_size.h" -#endif - - - /* Absolute addresses - This makes the assembler generate the address without support - from the linker. (ELF can't relocate 16-bit addresses!) */ -#define ABS(x) (x-_start+BOOTSEC_LOCATION) - -#ifdef STAGE1_5 -# define STAGE_ADDR 0x2000 -#else -# define STAGE_ADDR 0x8000 -#endif /* STAGE1_5 */ - - /* Print message string */ -#define MSG(x) mov $ABS(x), %si; call message; - - .file "start_eltorito.S" - - .text - - /* Tell GAS to generate 16-bit instructions so that this code works - in real mode. */ - .code16 - - .globl start, _start - -/* - * Primary entry point. Because BIOSes are buggy, we only load the first - * CD-ROM sector (2K) of the file, so the number one priority is actually - * loading the rest. - */ -start: -_start: - cli - ljmp $0, $ABS(real_start) - - . = _start + 8 /* Pad to file offset 8 */ - - /* This table gets filled in by mkisofs using the - -boot-info-table option */ -bi_pvd: .long 0xDEADBEEF /* LBA of primary volume descript */ -bi_file: .long 0xDEADBEEF /* LBA of boot file */ -bi_length: .long 0xDEADBEEF /* Length of boot file */ -bi_csum: .long 0xDEADBEEF /* Checksum of boot file */ -bi_reserved: .space (10*4) /* Reserved */ - -real_start: - xor %ax, %ax - mov %ax, %ss - mov %ax, %ds - mov %ax, %es - mov %ax, %fs - mov %ax, %gs - mov $STAGE1_STACKSEG, %sp /* set up the REAL stack */ - sti - cld - - /* save drive reference first thing! */ - mov %dl, ABS(BootDrive) - - /* print a notification message on the screen */ - MSG(notification_string) - -load_image: - /* Set up boot file sector, size, load address */ - mov ABS(bi_length), %eax - add $(ISO_SECTOR_SIZE-1), %eax - shr $ISO_SECTOR_BITS, %eax /* dwords->sectors */ - mov %ax, %bp /* boot file sectors */ - mov $(STAGE_ADDR >> 4), %bx - mov %bx, %es - xor %bx, %bx - mov ABS(bi_file), %eax - call getlinsec - mov %ds, %ax - mov %ax, %es - - MSG(notification_done) -bootit: - /* save the sector number of the second sector in %ebp */ - mov $ABS(firstlist - BOOTSEC_LISTSIZE), %si - mov (%si), %ebp - mov ABS(BootDrive), %dl /* this makes sure %dl is our "boot" drive */ - ljmp $0, $(STAGE_ADDR+SECTOR_SIZE) /* jump to main() in asm.S */ - -/* go here when you need to stop the machine hard after an error condition */ -stop: jmp stop - - -/* - * Get linear sectors - EBIOS LBA addressing, 2048-byte sectors. - * - * Note that we can't always do this as a single request, because at least - * Phoenix BIOSes has a 127-sector limit. To be on the safe side, stick - * to 16 sectors (32K) per request. - * - * Input: - * EAX - Linear sector number - * ES:BX - Target buffer - * BP - Sector count - */ -getlinsec: - mov $ABS(dapa), %si /* Load up the DAPA */ - mov %bx, 4(%si) - mov %es, %bx - mov %bx, 6(%si) - mov %eax, 8(%si) -1: - push %bp - push %si - cmp ABS(MaxTransfer), %bp - jbe 2f - mov ABS(MaxTransfer), %bp -2: - mov %bp, 2(%si) - mov ABS(BootDrive), %dl - mov $0x42, %ah /* Extended Read */ - call xint13 - pop %si - pop %bp - movzwl 2(%si), %eax /* Sectors we read */ - add %eax, 8(%si) /* Advance sector pointer */ - sub %ax, %bp /* Sectors left */ - shl $(ISO_SECTOR_BITS-4), %ax /* 2048-byte sectors -> segment */ - add %ax, 6(%si) /* Advance buffer pointer */ - - pushal - MSG(notification_step) - popal - cmp $0, %bp - ja 1b - mov 8(%si), %eax /* Return next sector */ - ret - -/* - * INT 13h with retry - */ -xint13: - movb $6, ABS(RetryCount) -.try: - pushal - int $0x13 - jc 1f - add $(8*4), %sp /* Clean up stack */ - ret -1: - mov %ah, %dl /* Save error code */ - decb ABS(RetryCount) - jz .real_error - mov ABS(RetryCount), %al - mov ABS(dapa+2), %ah /* Sector transfer count */ - cmp $2, %al /* Only 2 attempts left */ - ja 2f - mov $1, %ah /* Drop transfer size to 1 */ - jmp .setmaxtr -2: - cmp $3, %al - ja 3f /* First time, just try again */ - shr $1, %ah /* Otherwise, try to reduce */ - adc $0, %ah /* the max transfer size, but not */ -.setmaxtr: - mov %ah, ABS(MaxTransfer) - mov %ah, ABS(dapa+2) -3: - popal - jmp .try - -.real_error: - MSG(read_error_string) - mov %dl, %al - call printhex2 - popal - jmp stop - - - -/* - * message: write the string pointed to by %si - * - * WARNING: trashes %si, %ax, and %bx - */ - - /* - * Use BIOS "int 10H Function 0Eh" to write character in teletype mode - * %ah = 0xe %al = character - * %bh = page %bl = foreground color (graphics modes) - */ -1: - mov $0x0001, %bx - mov $0x0E, %ah - int $0x10 /* display a byte */ - -message: - lodsb - or %al, %al - jne 1b /* if not end of string, jmp to display */ - ret - -/* - * printhex[248]: Write a hex number in (AL, AX, EAX) to the console - */ -printhex2: - pushal - rol $24, %eax - mov $2, %cx - jmp 1f -printhex4: - pushal - rol $16, %eax - mov $4, %cx - jmp 1f -printhex8: - pushal - mov $8, %cx -1: - rol $4, %eax - push %eax - and $0x0F, %al - cmp $10, %al - jae .high -.low: add $('0'), %al - jmp 2f -.high: add $('A'-10), %al -2: - mov $0x0001, %bx - mov $0x0E, %ah - int $0x10 /* display a char */ - pop %eax - loop 1b - popal - ret - -/**************************************************************************/ -#ifdef STAGE1_5 -notification_string: .string "Loading stage1.5 " -#else -notification_string: .string "Loading stage2 " -#endif - -notification_step: .string "." -notification_done: .string "\r\n" - -read_error_string: .string "Read error 0x" - -/* - * EBIOS disk address packet - */ - .align 8 -dapa: .byte 16 /* Packet size */ - .byte 0 /* reserved */ - .word 0 /* +2 Block count */ - .word 0 /* +4 Offset of buffer */ - .word 0 /* +6 Segment of buffer */ - .long 0 /* +8 LBA (LSW) */ - .long 0 /* +C LBA (MSW) */ - -VARIABLE(BootDrive) - .byte 0xFF -VARIABLE(MaxTransfer) - .word 16 /* Max sectors per transfer (32Kb) */ -VARIABLE(RetryCount) - .byte 0 - - -/* - * This area is an empty space between the main body of code below which - * grows up (fixed after compilation, but between releases it may change - * in size easily), and the lists of sectors to read, which grows down - * from a fixed top location. - */ - - .word 0 - .word 0 - - . = _start + SECTOR_SIZE - BOOTSEC_LISTSIZE - - /* fill the first data listing with the default */ -blocklist_default_start:/* this is the sector start parameter, in logical - sectors from the start of the disk, sector 0 */ - .long 0 - -blocklist_default_len: /* this is the number of sectors to read */ -#ifdef STAGE1_5 - .word 0 -#else - .word (STAGE2_SIZE + ISO_SECTOR_SIZE - 1) >> ISO_SECTOR_BITS -#endif -blocklist_default_seg: /* this is the segment of the starting address - to load the data into */ - .word (STAGE_ADDR + SECTOR_SIZE) >> 4 - -firstlist: /* this label has to be after the list data!!! */ diff --git a/usr/src/grub/grub-0.95/stage2/term.h b/usr/src/grub/grub-0.95/stage2/term.h deleted file mode 100644 index 8ed8b9dc86..0000000000 --- a/usr/src/grub/grub-0.95/stage2/term.h +++ /dev/null @@ -1,153 +0,0 @@ -/* term.h - definitions for terminal handling */ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 2002 Free Software Foundation, 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 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 GRUB_TERM_HEADER -#define GRUB_TERM_HEADER 1 - -/* These are used to represent the various color states we use */ -typedef enum -{ - /* represents the color used to display all text that does not use the user - * defined colors below - */ - COLOR_STATE_STANDARD, - /* represents the user defined colors for normal text */ - COLOR_STATE_NORMAL, - /* represents the user defined colors for highlighted text */ - COLOR_STATE_HIGHLIGHT -} color_state; - -#ifndef STAGE1_5 - -/* Flags for representing the capabilities of a terminal. */ -/* Some notes about the flags: - - These flags are used by higher-level functions but not terminals - themselves. - - If a terminal is dumb, you may assume that only putchar, getkey and - checkkey are called. - - Some fancy features (nocursor, setcolor, and highlight) can be set to - NULL. */ - -/* Set when input characters shouldn't be echoed back. */ -#define TERM_NO_ECHO (1 << 0) -/* Set when the editing feature should be disabled. */ -#define TERM_NO_EDIT (1 << 1) -/* Set when the terminal cannot do fancy things. */ -#define TERM_DUMB (1 << 2) -/* Set when the terminal needs to be initialized. */ -#define TERM_NEED_INIT (1 << 16) - -struct term_entry -{ - /* The name of a terminal. */ - const char *name; - /* The feature flags defined above. */ - unsigned long flags; - /* Default for maximum number of lines if not specified */ - unsigned short max_lines; - /* Put a character. */ - void (*putchar) (int c); - /* Check if any input character is available. */ - int (*checkkey) (void); - /* Get a character. */ - int (*getkey) (void); - /* Get the cursor position. The return value is ((X << 8) | Y). */ - int (*getxy) (void); - /* Go to the position (X, Y). */ - void (*gotoxy) (int x, int y); - /* Clear the screen. */ - void (*cls) (void); - /* Set the current color to be used */ - void (*setcolorstate) (color_state state); - /* Set the normal color and the highlight color. The format of each - color is VGA's. */ - void (*setcolor) (int normal_color, int highlight_color); - /* Turn on/off the cursor. */ - int (*setcursor) (int on); - - /* function to start a terminal */ - int (*startup) (void); - /* function to use to shutdown a terminal */ - void (*shutdown) (void); -}; - -/* This lists up available terminals. */ -extern struct term_entry term_table[]; -/* This points to the current terminal. This is useful, because only - a single terminal is enabled normally. */ -extern struct term_entry *current_term; - -#endif /* ! STAGE1_5 */ - -/* The console stuff. */ -extern int console_current_color; -void console_putchar (int c); - -#ifndef STAGE1_5 -int console_checkkey (void); -int console_getkey (void); -int console_getxy (void); -void console_gotoxy (int x, int y); -void console_cls (void); -void console_setcolorstate (color_state state); -void console_setcolor (int normal_color, int highlight_color); -int console_setcursor (int on); -#endif - -#ifdef SUPPORT_SERIAL -void serial_putchar (int c); -int serial_checkkey (void); -int serial_getkey (void); -int serial_getxy (void); -void serial_gotoxy (int x, int y); -void serial_cls (void); -void serial_setcolorstate (color_state state); -#endif - -#ifdef SUPPORT_HERCULES -void hercules_putchar (int c); -int hercules_getxy (void); -void hercules_gotoxy (int x, int y); -void hercules_cls (void); -void hercules_setcolorstate (color_state state); -void hercules_setcolor (int normal_color, int highlight_color); -int hercules_setcursor (int on); -#endif - -#ifdef SUPPORT_GRAPHICS -extern int foreground, background, border, graphics_inited; - -void graphics_set_splash(char *splashfile); -int set_videomode (int mode); -void graphics_putchar (int c); -int graphics_getxy(void); -void graphics_gotoxy(int x, int y); -void graphics_cls(void); -void graphics_setcolorstate (color_state state); -void graphics_setcolor (int normal_color, int highlight_color); -int graphics_setcursor (int on); -int graphics_init(void); -void graphics_end(void); - -int hex(int v); -void graphics_set_palette(int idx, int red, int green, int blue); -#endif /* SUPPORT_GRAPHICS */ - -#endif /* ! GRUB_TERM_HEADER */ diff --git a/usr/src/grub/grub-0.95/stage2/terminfo.c b/usr/src/grub/grub-0.95/stage2/terminfo.c deleted file mode 100644 index c1c1575fcb..0000000000 --- a/usr/src/grub/grub-0.95/stage2/terminfo.c +++ /dev/null @@ -1,258 +0,0 @@ -/* terminfo.c - read a terminfo entry from the command line */ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 2002,2004 Free Software Foundation, 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 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. - * - * ###################################################################### - * - * This file contains various functions dealing with different - * terminal capabilities. It knows the difference between a vt52 and vt100 - * terminal (and much more) and is mainly used the terminal emulation - * in the serial driver. - */ - -#include -#include "terminfo.h" -#include "tparm.h" -#include "serial.h" - -/* Current terminal capabilities. Default is "vt100". */ -struct terminfo term = - { - .name = "vt100", - .cursor_address = "\e[%i%p1%d;%p2%dH", - .clear_screen = "\e[H\e[J", - .enter_standout_mode = "\e[7m", - .exit_standout_mode = "\e[m" - }; - -/* A number of escape sequences are provided in the string valued - capabilities for easy encoding of characters there. Both \E and \e - map to an ESCAPE character, ^x maps to a control-x for any - appropriate x, and the sequences \n \l \r \t \b \f \s give a - newline, line-feed, return, tab, backspace, form-feed, and space. - Other escapes include \^ for ^, \\ for \, \, for comma, \: for :, - and \0 for null. (\0 will produce \200, which does not terminate a - string but behaves as a null character on most terminals, provid­ - ing CS7 is specified. See stty(1).) Finally, characters may be - given as three octal digits after a \. */ - -char * -ti_unescape_memory (const char *in, const char *end) -{ - static char out_buffer[256]; - char c; - char *out; - - out = out_buffer; - do - { - c = *(in++); - switch (c) - { - case '^': - if (*in >= 'A' && *in <= 'Z') - { - *out = (*in) - 'A'; - in++; - } - else - { - *out = '^'; - } - break; - case '\\': - c = *(in++); - if (c >= '0' && c <= '9') - { - // octal number - int n = 0; - do - { - n = (n << 4) | (c - '0'); - c = *(in++); - } - while (c >= '0' && c <= '9'); - - *out++ = (char)(n & 0xff); - - // redo last character - in--; - - break; - } - - switch (c) - { - case 'e': - case 'E': - *out++ = '\e'; - break; - case 'n': - *out++ = '\n'; - break; - case 'r': - *out++ = '\r'; - break; - case 't': - *out++ = '\t'; - break; - case 'b': - *out++ = '\b'; - break; - case 'f': - *out++ = '\f'; - break; - case 's': - *out++ = ' '; - break; - case '\\': - *out++ = '\\'; - break; - case '^': - *out++ = '^'; - break; - case ',': - *out++ = ','; - break; - case ':': - *out++ = ':'; - break; - case '0': - *out++ = '\200'; - break; - } - break; - default: - *out++ = c; - break; - } - } - while (in <= end); - - return out_buffer; -} - -char * -ti_unescape_string (const char *in) -{ - return ti_unescape_memory (in, in + grub_strlen (in)); -} - -/* convert a memory region containing binary character into an external - * ascii representation. The binary characters will be replaced by an - * "ecsape notation". E.g. "033" will become "\e". */ -char * -ti_escape_memory (const char *in, const char *end) -{ - static char out_buffer[256]; - char c; - char *out; - - out = out_buffer; - do - { - c = *(in++); - switch (c) - { - case '\e': - *out++ = '\\'; *out++ = 'e'; break; - case ' ': - *out++ = '\\'; *out++ = 's'; break; - case '\\': - *out++ = '\\'; *out++ = '\\'; break; - case '0' ... '9': - case 'a' ... 'z': - case 'A' ... 'Z': - case '%': - case '+': - case '-': - case '*': - case '/': - case ';': - case ':': - case '{': - case '}': - case '[': - case ']': - *out++ = c; break; - case 0 ... 25: - *out++ = '^'; *out++ = 'A' + c; break; - default: - *out++ = '\\'; - *out++ = ((c >> 8) & 7) + '0'; - *out++ = ((c >> 4) & 7) + '0'; - *out++ = ((c >> 0) & 7) + '0'; - break; - } - } - while (in < end); - - *out++ = 0; - - return out_buffer; -} - -/* convert a string containing binary character into an external ascii - * representation. */ -char * -ti_escape_string (const char *in) -{ - return ti_escape_memory (in, in + grub_strlen (in)); -} - -/* move the cursor to the given position starting with "0". */ -void -ti_cursor_address (int x, int y) -{ - grub_putstr (grub_tparm (term.cursor_address, y, x)); -} - -/* clear the screen. */ -void -ti_clear_screen (void) -{ - grub_putstr (grub_tparm (term.clear_screen)); -} - -/* enter reverse video */ -void -ti_enter_standout_mode (void) -{ - grub_putstr (grub_tparm (term.enter_standout_mode)); -} - -/* exit reverse video */ -void -ti_exit_standout_mode (void) -{ - grub_putstr (grub_tparm (term.exit_standout_mode)); -} - -/* set the current terminal emulation to use */ -void -ti_set_term (const struct terminfo *new) -{ - grub_memmove (&term, new, sizeof (struct terminfo)); -} - -/* get the current terminal emulation */ -void -ti_get_term(struct terminfo *copy) -{ - grub_memmove (copy, &term, sizeof (struct terminfo)); -} diff --git a/usr/src/grub/grub-0.95/stage2/terminfo.h b/usr/src/grub/grub-0.95/stage2/terminfo.h deleted file mode 100644 index 2e59761ea7..0000000000 --- a/usr/src/grub/grub-0.95/stage2/terminfo.h +++ /dev/null @@ -1,51 +0,0 @@ -/* terminfo.h - read a terminfo entry from the command line */ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 2002,2003,2004 Free Software Foundation, 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 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 GRUB_TERMCAP_HEADER -#define GRUB_TERMCAP_HEADER 1 - -#define TERMINFO_LEN 40 - -typedef struct terminfo -{ - char name[TERMINFO_LEN]; - char cursor_address[TERMINFO_LEN]; - char clear_screen[TERMINFO_LEN]; - char enter_standout_mode[TERMINFO_LEN]; - char exit_standout_mode[TERMINFO_LEN]; -} -terminfo; - - -/* Function prototypes. */ -char *ti_escape_memory (const char *in, const char *end); -char *ti_escape_string (const char *in); -char *ti_unescape_memory (const char *in, const char *end); -char *ti_unescape_string (const char *in); - -void ti_set_term (const struct terminfo *new); -void ti_get_term (struct terminfo *copy); - -void ti_cursor_address (int x, int y); -void ti_clear_screen (void); -void ti_enter_standout_mode (void); -void ti_exit_standout_mode (void); - -#endif /* ! GRUB_TERMCAP_HEADER */ diff --git a/usr/src/grub/grub-0.95/stage2/tparm.c b/usr/src/grub/grub-0.95/stage2/tparm.c deleted file mode 100644 index 6e35002a42..0000000000 --- a/usr/src/grub/grub-0.95/stage2/tparm.c +++ /dev/null @@ -1,727 +0,0 @@ -/**************************************************************************** - * Copyright (c) 1998,2000,2002 Free Software Foundation, 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, distribute with modifications, 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 ABOVE 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. * - * * - * Except as contained in this notice, the name(s) of the above copyright * - * holders shall not be used in advertising or otherwise to promote the * - * sale, use or other dealings in this Software without prior written * - * authorization. * - ****************************************************************************/ - -/********************************************************************** - * This code is a modification of lib_tparm.c found in ncurses-5.2. The - * modification are for use in grub by replacing all libc function through - * special grub functions. This also meant to delete all dynamic memory - * allocation and replace it by a number of fixed buffers. - * - * Modifications by Tilmann Bubeck 2002 - **********************************************************************/ - -/**************************************************************************** - * Author: Zeyd M. Ben-Halim 1992,1995 * - * and: Eric S. Raymond * - ****************************************************************************/ - -/* - * tparm.c - * - */ - -#include "shared.h" - -#include "tparm.h" - -/* - * Common/troublesome character definitions - */ -typedef char grub_bool; -#undef isdigit -#define isdigit(c) ((c) >= '0' && (c) <= '9') -#ifndef FALSE -# define FALSE (0) -#endif -#ifndef TRUE -# define TRUE (!FALSE) -#endif -#define MAX_FORMAT_LEN 256 -#define max(a,b) ((a) > (b) ? (a) : (b)) - -//MODULE_ID("$Id: tparm.c,v 1.1.1.1 2003/11/20 02:04:59 fengshuo Exp $") - -/* - * char * - * tparm(string, ...) - * - * Substitute the given parameters into the given string by the following - * rules (taken from terminfo(5)): - * - * Cursor addressing and other strings requiring parame- - * ters in the terminal are described by a parameterized string - * capability, with like escapes %x in it. For example, to - * address the cursor, the cup capability is given, using two - * parameters: the row and column to address to. (Rows and - * columns are numbered from zero and refer to the physical - * screen visible to the user, not to any unseen memory.) If - * the terminal has memory relative cursor addressing, that can - * be indicated by - * - * The parameter mechanism uses a stack and special % - * codes to manipulate it. Typically a sequence will push one - * of the parameters onto the stack and then print it in some - * format. Often more complex operations are necessary. - * - * The % encodings have the following meanings: - * - * %% outputs `%' - * %c print pop() like %c in printf() - * %s print pop() like %s in printf() - * %[[:]flags][width[.precision]][doxXs] - * as in printf, flags are [-+#] and space - * The ':' is used to avoid making %+ or %- - * patterns (see below). - * - * %p[1-9] push ith parm - * %P[a-z] set dynamic variable [a-z] to pop() - * %g[a-z] get dynamic variable [a-z] and push it - * %P[A-Z] set static variable [A-Z] to pop() - * %g[A-Z] get static variable [A-Z] and push it - * %l push strlen(pop) - * %'c' push char constant c - * %{nn} push integer constant nn - * - * %+ %- %* %/ %m - * arithmetic (%m is mod): push(pop() op pop()) - * %& %| %^ bit operations: push(pop() op pop()) - * %= %> %< logical operations: push(pop() op pop()) - * %A %O logical and & or operations for conditionals - * %! %~ unary operations push(op pop()) - * %i add 1 to first two parms (for ANSI terminals) - * - * %? expr %t thenpart %e elsepart %; - * if-then-else, %e elsepart is optional. - * else-if's are possible ala Algol 68: - * %? c1 %t b1 %e c2 %t b2 %e c3 %t b3 %e c4 %t b4 %e b5 %; - * - * For those of the above operators which are binary and not commutative, - * the stack works in the usual way, with - * %gx %gy %m - * resulting in x mod y, not the reverse. - */ - -#define STACKSIZE 20 - -typedef struct { - union { - unsigned int num; - char *str; - } data; - grub_bool num_type; -} stack_frame; - -static stack_frame stack[STACKSIZE]; -static int stack_ptr; - -static char out_buff[256]; -static int out_size = 256; -static int out_used; - -static inline void -get_space(int need) -{ - need += out_used; - if (need > out_size) { - // FIX ME! buffer full, what now? - ; - } -} - -static inline void -save_text(const char *fmt, const char *s, int len) -{ - int s_len = grub_strlen(s); - if (len > (int) s_len) - s_len = len; - - get_space(s_len + 1); - - (void) grub_sprintf(out_buff + out_used, fmt, s); - out_used += grub_strlen(out_buff + out_used); -} - -static inline void -save_number(const char *fmt, int number, int len) -{ - if (len < 30) - len = 30; /* actually log10(MAX_INT)+1 */ - - get_space(len + 1); - - (void) grub_sprintf(out_buff + out_used, fmt, number); - out_used += grub_strlen(out_buff + out_used); -} - -static inline void -save_char(int c) -{ - if (c == 0) - c = 0200; - get_space(1); - out_buff[out_used++] = c; -} - -static inline void -npush(int x) -{ - if (stack_ptr < STACKSIZE) { - stack[stack_ptr].num_type = TRUE; - stack[stack_ptr].data.num = x; - stack_ptr++; - } -} - -static inline int -npop(void) -{ - int result = 0; - if (stack_ptr > 0) { - stack_ptr--; - if (stack[stack_ptr].num_type) - result = stack[stack_ptr].data.num; - } - return result; -} - -static inline void -spush(char *x) -{ - if (stack_ptr < STACKSIZE) { - stack[stack_ptr].num_type = FALSE; - stack[stack_ptr].data.str = x; - stack_ptr++; - } -} - -static inline char * -spop(void) -{ - static char dummy[] = ""; /* avoid const-cast */ - char *result = dummy; - if (stack_ptr > 0) { - stack_ptr--; - if (!stack[stack_ptr].num_type && stack[stack_ptr].data.str != 0) - result = stack[stack_ptr].data.str; - } - return result; -} - -static inline const char * -parse_format(const char *s, char *format, int *len) -{ - grub_bool done = FALSE; - grub_bool allowminus = FALSE; - grub_bool dot = FALSE; - grub_bool err = FALSE; - char *fmt = format; - int prec = 0; - int width = 0; - int value = 0; - - *len = 0; - *format++ = '%'; - while (*s != '\0' && !done) { - switch (*s) { - case 'c': /* FALLTHRU */ - case 'd': /* FALLTHRU */ - case 'o': /* FALLTHRU */ - case 'x': /* FALLTHRU */ - case 'X': /* FALLTHRU */ - case 's': - *format++ = *s; - done = TRUE; - break; - case '.': - *format++ = *s++; - if (dot) { - err = TRUE; - } else { - dot = TRUE; - prec = value; - } - value = 0; - break; - case '#': - *format++ = *s++; - break; - case ' ': - *format++ = *s++; - break; - case ':': - s++; - allowminus = TRUE; - break; - case '-': - if (allowminus) { - *format++ = *s++; - } else { - done = TRUE; - } - break; - default: - if (isdigit(*s)) { - value = (value * 10) + (*s - '0'); - if (value > 10000) - err = TRUE; - *format++ = *s++; - } else { - done = TRUE; - } - } - } - - /* - * If we found an error, ignore (and remove) the flags. - */ - if (err) { - prec = width = value = 0; - format = fmt; - *format++ = '%'; - *format++ = *s; - } - - if (dot) - width = value; - else - prec = value; - - *format = '\0'; - /* return maximum string length in print */ - *len = (prec > width) ? prec : width; - return s; -} - -#define isUPPER(c) ((c) >= 'A' && (c) <= 'Z') -#define isLOWER(c) ((c) >= 'a' && (c) <= 'z') - -static inline char * -tparam_internal(const char *string, int *dataptr) -{ -#define NUM_VARS 26 - char *p_is_s[9]; - int param[9]; - int lastpop; - int popcount; - int number; - int len; - int level; - int x, y; - int i; - int len2; - register const char *cp; - static int len_fmt = MAX_FORMAT_LEN; - static char dummy[] = ""; - static char format[MAX_FORMAT_LEN]; - static int dynamic_var[NUM_VARS]; - static int static_vars[NUM_VARS]; - - out_used = 0; - if (string == NULL) - return NULL; - - if ((len2 = grub_strlen(string)) > len_fmt) { - return NULL; - } - - /* - * Find the highest parameter-number referred to in the format string. - * Use this value to limit the number of arguments copied from the - * variable-length argument list. - */ - - number = 0; - lastpop = -1; - popcount = 0; - grub_memset(p_is_s, 0, sizeof(p_is_s)); - - /* - * Analyze the string to see how many parameters we need from the varargs - * list, and what their types are. We will only accept string parameters - * if they appear as a %l or %s format following an explicit parameter - * reference (e.g., %p2%s). All other parameters are numbers. - * - * 'number' counts coarsely the number of pop's we see in the string, and - * 'popcount' shows the highest parameter number in the string. We would - * like to simply use the latter count, but if we are reading termcap - * strings, there may be cases that we cannot see the explicit parameter - * numbers. - */ - for (cp = string; (cp - string) < (int) len2;) { - if (*cp == '%') { - cp++; - cp = parse_format(cp, format, &len); - switch (*cp) { - default: - break; - - case 'd': /* FALLTHRU */ - case 'o': /* FALLTHRU */ - case 'x': /* FALLTHRU */ - case 'X': /* FALLTHRU */ - case 'c': /* FALLTHRU */ - number++; - lastpop = -1; - break; - - case 'l': - case 's': - if (lastpop > 0) - p_is_s[lastpop - 1] = dummy; - ++number; - break; - - case 'p': - cp++; - i = (*cp - '0'); - if (i >= 0 && i <= 9) { - lastpop = i; - if (lastpop > popcount) - popcount = lastpop; - } - break; - - case 'P': - case 'g': - cp++; - break; - - case '\'': - cp += 2; - lastpop = -1; - break; - - case '{': - cp++; - while (*cp >= '0' && *cp <= '9') { - cp++; - } - break; - - case '+': - case '-': - case '*': - case '/': - case 'm': - case 'A': - case 'O': - case '&': - case '|': - case '^': - case '=': - case '<': - case '>': - case '!': - case '~': - lastpop = -1; - number += 2; - break; - - case 'i': - lastpop = -1; - if (popcount < 2) - popcount = 2; - break; - } - } - if (*cp != '\0') - cp++; - } - - if (number > 9) - number = 9; - for (i = 0; i < max(popcount, number); i++) { - /* - * A few caps (such as plab_norm) have string-valued parms. - * We'll have to assume that the caller knows the difference, since - * a char* and an int may not be the same size on the stack. - */ - if (p_is_s[i] != 0) { - p_is_s[i] = (char *)(*(dataptr++)); - } else { - param[i] = (int)(*(dataptr++)); - } - } - - /* - * This is a termcap compatibility hack. If there are no explicit pop - * operations in the string, load the stack in such a way that - * successive pops will grab successive parameters. That will make - * the expansion of (for example) \E[%d;%dH work correctly in termcap - * style, which means tparam() will expand termcap strings OK. - */ - stack_ptr = 0; - if (popcount == 0) { - popcount = number; - for (i = number - 1; i >= 0; i--) - npush(param[i]); - } - - while (*string) { - /* skip delay timings */ - if (*string == '$' && *(string + 1) == '<') { - while( *string && *string != '>') - string++; - if ( *string == '>' ) string++; - } else if ( *string == '%') { - string++; - string = parse_format(string, format, &len); - switch (*string) { - default: - break; - case '%': - save_char('%'); - break; - - case 'd': /* FALLTHRU */ - case 'o': /* FALLTHRU */ - case 'x': /* FALLTHRU */ - case 'X': /* FALLTHRU */ - case 'c': /* FALLTHRU */ - save_number(format, npop(), len); - break; - - case 'l': - save_number("%d", strlen(spop()), 0); - break; - - case 's': - save_text(format, spop(), len); - break; - - case 'p': - string++; - i = (*string - '1'); - if (i >= 0 && i < 9) { - if (p_is_s[i]) - spush(p_is_s[i]); - else - npush(param[i]); - } - break; - - case 'P': - string++; - if (isUPPER(*string)) { - i = (*string - 'A'); - static_vars[i] = npop(); - } else if (isLOWER(*string)) { - i = (*string - 'a'); - dynamic_var[i] = npop(); - } - break; - - case 'g': - string++; - if (isUPPER(*string)) { - i = (*string - 'A'); - npush(static_vars[i]); - } else if (isLOWER(*string)) { - i = (*string - 'a'); - npush(dynamic_var[i]); - } - break; - - case '\'': - string++; - npush(*string); - string++; - break; - - case '{': - number = 0; - string++; - while (*string >= '0' && *string <= '9') { - number = number * 10 + *string - '0'; - string++; - } - npush(number); - break; - - case '+': - npush(npop() + npop()); - break; - - case '-': - y = npop(); - x = npop(); - npush(x - y); - break; - - case '*': - npush(npop() * npop()); - break; - - case '/': - y = npop(); - x = npop(); - npush(y ? (x / y) : 0); - break; - - case 'm': - y = npop(); - x = npop(); - npush(y ? (x % y) : 0); - break; - - case 'A': - npush(npop() && npop()); - break; - - case 'O': - npush(npop() || npop()); - break; - - case '&': - npush(npop() & npop()); - break; - - case '|': - npush(npop() | npop()); - break; - - case '^': - npush(npop() ^ npop()); - break; - - case '=': - y = npop(); - x = npop(); - npush(x == y); - break; - - case '<': - y = npop(); - x = npop(); - npush(x < y); - break; - - case '>': - y = npop(); - x = npop(); - npush(x > y); - break; - - case '!': - npush(!npop()); - break; - - case '~': - npush(~npop()); - break; - - case 'i': - if (p_is_s[0] == 0) - param[0]++; - if (p_is_s[1] == 0) - param[1]++; - break; - - case '?': - break; - - case 't': - x = npop(); - if (!x) { - /* scan forward for %e or %; at level zero */ - string++; - level = 0; - while (*string) { - if (*string == '%') { - string++; - if (*string == '?') - level++; - else if (*string == ';') { - if (level > 0) - level--; - else - break; - } else if (*string == 'e' && level == 0) - break; - } - - if (*string) - string++; - } - } - break; - - case 'e': - /* scan forward for a %; at level zero */ - string++; - level = 0; - while (*string) { - if (*string == '%') { - string++; - if (*string == '?') - level++; - else if (*string == ';') { - if (level > 0) - level--; - else - break; - } - } - - if (*string) - string++; - } - break; - - case ';': - break; - - } /* endswitch (*string) */ - } else { /* endelse (*string == '%') */ - save_char(*string); - } - - if (*string == '\0') - break; - - string++; - } /* endwhile (*string) */ - - get_space(1); - out_buff[out_used] = '\0'; - - return (out_buff); -} - -char * -grub_tparm(const char *string,...) -{ - char *result; - int *dataptr = (int *) &string; - - dataptr++; - - result = tparam_internal(string, dataptr); - - return result; -} diff --git a/usr/src/grub/grub-0.95/stage2/tparm.h b/usr/src/grub/grub-0.95/stage2/tparm.h deleted file mode 100644 index e2c1b68e68..0000000000 --- a/usr/src/grub/grub-0.95/stage2/tparm.h +++ /dev/null @@ -1,28 +0,0 @@ -/* tparm.h - parameter formatting of terminfo */ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 2002 Free Software Foundation, 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 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 GRUB_TPARM_HEADER -#define GRUB_TPARM_HEADER 1 - - -/* Function prototypes. */ -char *grub_tparm (const char *string, ...); - -#endif /* ! GRUB_TERMCAP_HEADER */ diff --git a/usr/src/grub/grub-0.95/stage2/ufs.h b/usr/src/grub/grub-0.95/stage2/ufs.h deleted file mode 100644 index 29f2f1485f..0000000000 --- a/usr/src/grub/grub-0.95/stage2/ufs.h +++ /dev/null @@ -1,231 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _GRUB_UFS_H -#define _GRUB_UFS_H_ - -#ifdef FSYS_UFS - -/* ufs specific constants */ -#define UFS_SBLOCK 16 -#define UFS_SBSIZE 8192 -#define UFS_MAGIC 0x011954 -#define ROOTINO 2 /* i number of all roots */ -#define UFS_NDADDR 12 /* direct blocks */ -#define UFS_NIADDR 3 /* indirect blocks */ -#define MAXMNTLEN 512 -#define MAXCSBUFS 32 - -/* file types */ -#define IFMT 0xf000 -#define IFREG 0x8000 -#define IFDIR 0x4000 - -typedef unsigned char grub_uchar_t; -typedef unsigned short grub_ushort_t; -typedef unsigned short grub_o_mode_t; -typedef unsigned short grub_o_uid_t; -typedef unsigned short grub_o_gid_t; -typedef long grub_ino_t; -typedef long grub_int32_t; -typedef long grub_uid_t; -typedef long grub_gid_t; -typedef unsigned long grub_uint32_t; -typedef unsigned long grub_daddr32_t; -typedef unsigned long grub_time32_t; -typedef struct { int val[2]; } grub_quad_t; - -struct timeval32 { - grub_time32_t tv_sec; - grub_int32_t tv_usec; -}; - -/* - * Per cylinder group information; summarized in blocks allocated - * from first cylinder group data blocks. These blocks have to be - * read in from fs_csaddr (size fs_cssize) in addition to the - * super block. - * - * N.B. sizeof (struct csum) must be a power of two in order for - * the ``fs_cs'' macro to work (see below). - */ -struct csum { - grub_int32_t cs_ndir; /* number of directories */ - grub_int32_t cs_nbfree; /* number of free blocks */ - grub_int32_t cs_nifree; /* number of free inodes */ - grub_int32_t cs_nffree; /* number of free frags */ -}; - -/* Ufs super block */ -struct fs { - grub_uint32_t fs_link; /* linked list of file systems */ - grub_uint32_t fs_rolled; /* logging only: fs fully rolled */ - grub_daddr32_t fs_sblkno; /* addr of super-block in filesys */ - grub_daddr32_t fs_cblkno; /* offset of cyl-block in filesys */ - grub_daddr32_t fs_iblkno; /* offset of inode-blocks in filesys */ - grub_daddr32_t fs_dblkno; /* offset of first data after cg */ - grub_int32_t fs_cgoffset; /* cylinder group offset in cylinder */ - grub_int32_t fs_cgmask; /* used to calc mod fs_ntrak */ - grub_time32_t fs_time; /* last time written */ - grub_int32_t fs_size; /* number of blocks in fs */ - grub_int32_t fs_dsize; /* number of data blocks in fs */ - grub_int32_t fs_ncg; /* number of cylinder groups */ - grub_int32_t fs_bsize; /* size of basic blocks in fs */ - grub_int32_t fs_fsize; /* size of frag blocks in fs */ - grub_int32_t fs_frag; /* number of frags in a block in fs */ - /* these are configuration parameters */ - grub_int32_t fs_minfree; /* minimum percentage of free blocks */ - grub_int32_t fs_rotdelay; /* num of ms for optimal next block */ - grub_int32_t fs_rps; /* disk revolutions per second */ - /* these fields can be computed from the others */ - grub_int32_t fs_bmask; /* ``blkoff'' calc of blk offsets */ - grub_int32_t fs_fmask; /* ``fragoff'' calc of frag offsets */ - grub_int32_t fs_bshift; /* ``lblkno'' calc of logical blkno */ - grub_int32_t fs_fshift; /* ``numfrags'' calc number of frags */ - /* these are configuration parameters */ - grub_int32_t fs_maxcontig; /* max number of contiguous blks */ - grub_int32_t fs_maxbpg; /* max number of blks per cyl group */ - /* these fields can be computed from the others */ - grub_int32_t fs_fragshift; /* block to frag shift */ - grub_int32_t fs_fsbtodb; /* fsbtodb and dbtofsb shift constant */ - grub_int32_t fs_sbsize; /* actual size of super block */ - grub_int32_t fs_csmask; /* csum block offset */ - grub_int32_t fs_csshift; /* csum block number */ - grub_int32_t fs_nindir; /* value of NINDIR */ - grub_int32_t fs_inopb; /* value of INOPB */ - grub_int32_t fs_nspf; /* value of NSPF */ - /* yet another configuration parameter */ - grub_int32_t fs_optim; /* optimization preference, see below */ - /* these fields are derived from the hardware */ - /* USL SVR4 compatibility */ - /* - * * USL SVR4 compatibility - * - * There was a significant divergence here between Solaris and - * SVR4 for x86. By swapping these two members in the superblock, - * we get read-only compatibility of SVR4 filesystems. Otherwise - * there would be no compatibility. This change was introduced - * during bootstrapping of Solaris on x86. By making this ifdef'ed - * on byte order, we provide ongoing compatibility across all - * platforms with the same byte order, the highest compatibility - * that can be achieved. - */ - grub_int32_t fs_state; /* file system state time stamp */ - grub_int32_t fs_si; /* summary info state - lufs only */ - grub_int32_t fs_trackskew; /* sector 0 skew, per track */ - /* unique id for this filesystem (currently unused and unmaintained) */ - /* In 4.3 Tahoe this space is used by fs_headswitch and fs_trkseek */ - /* Neither of those fields is used in the Tahoe code right now but */ - /* there could be problems if they are. */ - grub_int32_t fs_id[2]; /* file system id */ - /* sizes determined by number of cylinder groups and their sizes */ - grub_daddr32_t fs_csaddr; /* blk addr of cyl grp summary area */ - grub_int32_t fs_cssize; /* size of cyl grp summary area */ - grub_int32_t fs_cgsize; /* cylinder group size */ - /* these fields are derived from the hardware */ - grub_int32_t fs_ntrak; /* tracks per cylinder */ - grub_int32_t fs_nsect; /* sectors per track */ - grub_int32_t fs_spc; /* sectors per cylinder */ - /* this comes from the disk driver partitioning */ - grub_int32_t fs_ncyl; /* cylinders in file system */ - /* these fields can be computed from the others */ - grub_int32_t fs_cpg; /* cylinders per group */ - grub_int32_t fs_ipg; /* inodes per group */ - grub_int32_t fs_fpg; /* blocks per group * fs_frag */ - /* this data must be re-computed after crashes */ - struct csum fs_cstotal; /* cylinder summary information */ - /* these fields are cleared at mount time */ - char fs_fmod; /* super block modified flag */ - char fs_clean; /* file system state flag */ - char fs_ronly; /* mounted read-only flag */ - char fs_flags; /* largefiles flag, etc. */ - char fs_fsmnt[MAXMNTLEN]; /* name mounted on */ - /* these fields retain the current block allocation info */ - grub_int32_t fs_cgrotor; /* last cg searched */ - /* - * The following used to be fs_csp[MAXCSBUFS]. It was not - * used anywhere except in old utilities. We removed this - * in 5.6 and expect fs_u.fs_csp to be used instead. - * We no longer limit fs_cssize based on MAXCSBUFS. - */ - union { /* fs_cs (csum) info */ - grub_uint32_t fs_csp_pad[MAXCSBUFS]; - struct csum *fs_csp; - } fs_u; - grub_int32_t fs_cpc; /* cyl per cycle in postbl */ - short fs_opostbl[16][8]; /* old rotation block list head */ - grub_int32_t fs_sparecon[51]; /* reserved for future constants */ - grub_int32_t fs_version; /* minor version of MTB ufs */ - grub_int32_t fs_logbno; /* block # of embedded log */ - grub_int32_t fs_reclaim; /* reclaim open, deleted files */ - grub_int32_t fs_sparecon2; /* reserved for future constant */ - /* USL SVR4 compatibility */ - grub_int32_t fs_npsect; /* # sectors/track including spares */ - grub_quad_t fs_qbmask; /* ~fs_bmask - for use with quad size */ - grub_quad_t fs_qfmask; /* ~fs_fmask - for use with quad size */ - grub_int32_t fs_postblformat; /* fmt of positional layout tables */ - grub_int32_t fs_nrpos; /* number of rotaional positions */ - grub_int32_t fs_postbloff; /* (short) rotation block list head */ - grub_int32_t fs_rotbloff; /* (grub_uchar_t) blocks for each */ - /* rotation */ - grub_int32_t fs_magic; /* magic number */ - grub_uchar_t fs_space[1]; /* list of blocks for each rotation */ - /* actually longer */ -}; - -struct icommon { - grub_o_mode_t ic_smode; /* 0: mode and type of file */ - short ic_nlink; /* 2: number of links to file */ - grub_o_uid_t ic_suid; /* 4: owner's user id */ - grub_o_gid_t ic_sgid; /* 6: owner's group id */ - grub_uint32_t ic_sizelo; /* 8: number of bytes in file */ - grub_uint32_t ic_sizehi; /* 12: number of bytes in file */ - struct timeval32 ic_atime; /* 16: time last accessed */ - struct timeval32 ic_mtime; /* 24: time last modified */ - struct timeval32 ic_ctime; /* 32: last time inode changed */ - grub_daddr32_t ic_db[UFS_NDADDR]; /* 40: disk block addresses */ - grub_daddr32_t ic_ib[UFS_NIADDR]; /* 88: indirect blocks */ - grub_int32_t ic_flags; /* 100: cflags */ - grub_int32_t ic_blocks; /* 104: 512 byte blocks actually held */ - grub_int32_t ic_gen; /* 108: generation number */ - grub_int32_t ic_shadow; /* 112: shadow inode */ - grub_uid_t ic_uid; /* 116: long EFT version of uid */ - grub_gid_t ic_gid; /* 120: long EFT version of gid */ - grub_uint32_t ic_oeftflag; /* 124: extended attr directory ino, */ - /* 0 = none */ -}; - -struct direct { - grub_ino_t d_ino; - grub_ushort_t d_reclen; - grub_ushort_t d_namelen; - char d_name[MAXNAMELEN + 1]; -}; - -/* inode macros */ -#define INOPB(fs) ((fs)->fs_inopb) -#define itoo(fs, x) ((x) % (grub_uint32_t)INOPB(fs)) -#define itog(fs, x) ((x) / (grub_uint32_t)(fs)->fs_ipg) -#define itod(fs, x) ((grub_daddr32_t)(cgimin(fs, itog(fs, x)) + \ - (blkstofrags((fs), \ - ((x) % (grub_uint32_t)(fs)->fs_ipg / (grub_uint32_t)INOPB(fs)))))) - -/* block conversion macros */ -#define UFS_NINDIR(fs) ((fs)->fs_nindir) /* # of indirects */ -#define blkoff(fs, loc) ((int)((loc & ~(fs)->fs_bmask))) -#define lblkno(fs, loc) ((grub_int32_t)((loc) >> (fs)->fs_bshift)) -/* frag to blk */ -#define fsbtodb(fs, b) (((grub_daddr32_t)(b)) << (fs)->fs_fsbtodb) -#define blkstofrags(fs, b) ((b) << (fs)->fs_fragshift) - -/* cynlinder group macros */ -#define cgbase(fs, c) ((grub_daddr32_t)((fs)->fs_fpg * (c))) -#define cgimin(fs, c) (cgstart(fs, c) + (fs)->fs_iblkno) /* inode block */ -#define cgstart(fs, c) \ - (cgbase(fs, c) + (fs)->fs_cgoffset * ((c) & ~((fs)->fs_cgmask))) - -#endif /* FSYS_UFS */ - -#endif /* !_GRUB_UFS_H */ diff --git a/usr/src/grub/grub-0.95/stage2/ufs2.h b/usr/src/grub/grub-0.95/stage2/ufs2.h deleted file mode 100644 index ba2ef30a94..0000000000 --- a/usr/src/grub/grub-0.95/stage2/ufs2.h +++ /dev/null @@ -1,439 +0,0 @@ -/* - * Copyright (C) 2004 Free Software Foundation, Inc. - * Copyright (c) 2002 Networks Associates Technology, Inc. - * All rights reserved. - * - * This software was developed for the FreeBSD Project by Marshall - * Kirk McKusick and Network Associates Laboratories, the Security - * Research Division of Network Associates, Inc. under DARPA/SPAWAR - * contract N66001-01-C-8035 ("CBOSS"), as part of the DARPA CHATS - * research program - * - * Copyright (c) 1982, 1989, 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. - * 3. The names of the authors 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 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. - * - * @(#)dinode.h 8.3 (Berkeley) 1/21/94 - * $FreeBSD: src/sys/ufs/ufs/dinode.h,v 1.11 2002/07/16 22:36:00 mckusick Exp $ - */ - -#ifndef _GRUB_UFS2_H_ -#define _GRUB_UFS2_H_ - -typedef signed char grub_int8_t; -typedef signed short grub_int16_t; -typedef signed int grub_int32_t; -typedef signed long long int grub_int64_t; -typedef unsigned char grub_uint8_t; -typedef unsigned short grub_uint16_t; -typedef unsigned int grub_uint32_t; -typedef unsigned long long int grub_uint64_t; - -typedef grub_uint8_t grub_u_char; -typedef grub_uint32_t grub_u_int; - -typedef grub_uint8_t grub_u_int8_t; -typedef grub_uint16_t grub_u_int16_t; -typedef grub_uint32_t grub_u_int32_t; -typedef grub_uint64_t grub_u_int64_t; - -#define i_size di_size - - -#define DEV_BSIZE 512 - -/* - * The root inode is the root of the filesystem. Inode 0 can't be used for - * normal purposes and historically bad blocks were linked to inode 1, thus - * the root inode is 2. (Inode 1 is no longer used for this purpose, however - * numerous dump tapes make this assumption, so we are stuck with it). - */ -#define ROOTINO ((grub_ino_t)2) - -/* - * The size of physical and logical block numbers and time fields in UFS. - */ -typedef grub_int32_t ufs1_daddr_t; -typedef grub_int64_t ufs2_daddr_t; -typedef grub_int64_t ufs_lbn_t; -typedef grub_int64_t ufs_time_t; - -/* inode number */ -typedef grub_uint32_t grub_ino_t; - -/* File permissions. */ -#define IEXEC 0000100 /* Executable. */ -#define IWRITE 0000200 /* Writeable. */ -#define IREAD 0000400 /* Readable. */ -#define ISVTX 0001000 /* Sticky bit. */ -#define ISGID 0002000 /* Set-gid. */ -#define ISUID 0004000 /* Set-uid. */ - -/* File types. */ -#define IFMT 0170000 /* Mask of file type. */ -#define IFIFO 0010000 /* Named pipe (fifo). */ -#define IFCHR 0020000 /* Character device. */ -#define IFDIR 0040000 /* Directory file. */ -#define IFBLK 0060000 /* Block device. */ -#define IFREG 0100000 /* Regular file. */ -#define IFLNK 0120000 /* Symbolic link. */ -#define IFSOCK 0140000 /* UNIX domain socket. */ -#define IFWHT 0160000 /* Whiteout. */ - -/* - * A dinode contains all the meta-data associated with a UFS2 file. - * This structure defines the on-disk format of a dinode. Since - * this structure describes an on-disk structure, all its fields - * are defined by types with precise widths. - */ - -#define NXADDR 2 /* External addresses in inode. */ -#define NDADDR 12 /* Direct addresses in inode. */ -#define NIADDR 3 /* Indirect addresses in inode. */ - -struct ufs1_dinode { - grub_u_int16_t di_mode; /* 0: IFMT, permissions; see below. */ - grub_int16_t di_nlink; /* 2: File link count. */ - union { - grub_u_int16_t oldids[2]; /* 4: Ffs: old user and group ids. */ - } di_u; - grub_u_int64_t di_size; /* 8: File byte count. */ - grub_int32_t di_atime; /* 16: Last access time. */ - grub_int32_t di_atimensec; /* 20: Last access time. */ - grub_int32_t di_mtime; /* 24: Last modified time. */ - grub_int32_t di_mtimensec; /* 28: Last modified time. */ - grub_int32_t di_ctime; /* 32: Last inode change time. */ - grub_int32_t di_ctimensec; /* 36: Last inode change time. */ - ufs1_daddr_t di_db[NDADDR]; /* 40: Direct disk blocks. */ - ufs1_daddr_t di_ib[NIADDR]; /* 88: Indirect disk blocks. */ - grub_u_int32_t di_flags; /* 100: Status flags (chflags). */ - grub_int32_t di_blocks; /* 104: Blocks actually held. */ - grub_int32_t di_gen; /* 108: Generation number. */ - grub_u_int32_t di_uid; /* 112: File owner. */ - grub_u_int32_t di_gid; /* 116: File group. */ - grub_int32_t di_spare[2]; /* 120: Reserved; currently unused */ -}; - -struct ufs2_dinode { - grub_u_int16_t di_mode; /* 0: IFMT, permissions; see below. */ - grub_int16_t di_nlink; /* 2: File link count. */ - grub_u_int32_t di_uid; /* 4: File owner. */ - grub_u_int32_t di_gid; /* 8: File group. */ - grub_u_int32_t di_blksize; /* 12: Inode blocksize. */ - grub_u_int64_t di_size; /* 16: File byte count. */ - grub_u_int64_t di_blocks; /* 24: Bytes actually held. */ - ufs_time_t di_atime; /* 32: Last access time. */ - ufs_time_t di_mtime; /* 40: Last modified time. */ - ufs_time_t di_ctime; /* 48: Last inode change time. */ - ufs_time_t di_birthtime; /* 56: Inode creation time. */ - grub_int32_t di_mtimensec; /* 64: Last modified time. */ - grub_int32_t di_atimensec; /* 68: Last access time. */ - grub_int32_t di_ctimensec; /* 72: Last inode change time. */ - grub_int32_t di_birthnsec; /* 76: Inode creation time. */ - grub_int32_t di_gen; /* 80: Generation number. */ - grub_u_int32_t di_kernflags; /* 84: Kernel flags. */ - grub_u_int32_t di_flags; /* 88: Status flags (chflags). */ - grub_int32_t di_extsize; /* 92: External attributes block. */ - ufs2_daddr_t di_extb[NXADDR];/* 96: External attributes block. */ - ufs2_daddr_t di_db[NDADDR]; /* 112: Direct disk blocks. */ - ufs2_daddr_t di_ib[NIADDR]; /* 208: Indirect disk blocks. */ - grub_int64_t di_spare[3]; /* 232: Reserved; currently unused */ -}; - -#define MAXNAMLEN 255 - -struct direct { - grub_u_int32_t d_ino; /* inode number of entry */ - grub_u_int16_t d_reclen; /* length of this record */ - grub_u_int8_t d_type; /* file type, see below */ - grub_u_int8_t d_namlen; /* length of string in d_name */ - char d_name[MAXNAMLEN + 1];/* name with length <= MAXNAMLEN */ -}; - -/* - * File types - */ -#define DT_UNKNOWN 0 -#define DT_FIFO 1 -#define DT_CHR 2 -#define DT_DIR 4 -#define DT_BLK 6 -#define DT_REG 8 -#define DT_LNK 10 -#define DT_SOCK 12 -#define DT_WHT 14 - -/* - * Superblock offsets - */ -#define SBLOCK_FLOPPY 0 -#define SBLOCK_UFS1 8192 -#define SBLOCK_UFS2 65536 -#define SBLOCK_PIGGY 262144 -#define SBLOCKSIZE 8192 -#define SBLOCKSEARCH \ - { SBLOCK_UFS2, SBLOCK_UFS1, SBLOCK_FLOPPY, SBLOCK_PIGGY, -1 } - -#define MAXMNTLEN 512 - -#define NOCSPTRS ((128 / sizeof(void *)) - 4) - -/* - * The maximum number of snapshot nodes that can be associated - * with each filesystem. This limit affects only the number of - * snapshot files that can be recorded within the superblock so - * that they can be found when the filesystem is mounted. However, - * maintaining too many will slow the filesystem performance, so - * having this limit is a good idea. - */ -#define FSMAXSNAP 20 - -/* - * Per cylinder group information; summarized in blocks allocated - * from first cylinder group data blocks. These blocks have to be - * read in from fs_csaddr (size fs_cssize) in addition to the - * super block. - */ -struct csum { - grub_int32_t cs_ndir; /* number of directories */ - grub_int32_t cs_nbfree; /* number of free blocks */ - grub_int32_t cs_nifree; /* number of free inodes */ - grub_int32_t cs_nffree; /* number of free frags */ -}; - -struct csum_total { - grub_int64_t cs_ndir; /* number of directories */ - grub_int64_t cs_nbfree; /* number of free blocks */ - grub_int64_t cs_nifree; /* number of free inodes */ - grub_int64_t cs_nffree; /* number of free frags */ - grub_int64_t cs_numclusters; /* number of free clusters */ - grub_int64_t cs_spare[3]; /* future expansion */ -}; - -/* - * Super block for an FFS filesystem. - */ -struct fs { - grub_int32_t fs_firstfield; /* historic filesystem linked list, */ - grub_int32_t fs_unused_1; /* used for incore super blocks */ - grub_int32_t fs_sblkno; /* offset of super-block in filesys */ - grub_int32_t fs_cblkno; /* offset of cyl-block in filesys */ - grub_int32_t fs_iblkno; /* offset of inode-blocks in filesys */ - grub_int32_t fs_dblkno; /* offset of first data after cg */ - grub_int32_t fs_old_cgoffset; /* cylinder group offset in cylinder */ - grub_int32_t fs_old_cgmask; /* used to calc mod fs_ntrak */ - grub_int32_t fs_old_time; /* last time written */ - grub_int32_t fs_old_size; /* number of blocks in fs */ - grub_int32_t fs_old_dsize; /* number of data blocks in fs */ - grub_int32_t fs_ncg; /* number of cylinder groups */ - grub_int32_t fs_bsize; /* size of basic blocks in fs */ - grub_int32_t fs_fsize; /* size of frag blocks in fs */ - grub_int32_t fs_frag; /* number of frags in a block in fs */ -/* these are configuration parameters */ - grub_int32_t fs_minfree; /* minimum percentage of free blocks */ - grub_int32_t fs_old_rotdelay; /* num of ms for optimal next block */ - grub_int32_t fs_old_rps; /* disk revolutions per second */ -/* these fields can be computed from the others */ - grub_int32_t fs_bmask; /* ``blkoff'' calc of blk offsets */ - grub_int32_t fs_fmask; /* ``fragoff'' calc of frag offsets */ - grub_int32_t fs_bshift; /* ``lblkno'' calc of logical blkno */ - grub_int32_t fs_fshift; /* ``numfrags'' calc number of frags */ -/* these are configuration parameters */ - grub_int32_t fs_maxcontig; /* max number of contiguous blks */ - grub_int32_t fs_maxbpg; /* max number of blks per cyl group */ -/* these fields can be computed from the others */ - grub_int32_t fs_fragshift; /* block to frag shift */ - grub_int32_t fs_fsbtodb; /* fsbtodb and dbtofsb shift constant */ - grub_int32_t fs_sbsize; /* actual size of super block */ - grub_int32_t fs_spare1[2]; /* old fs_csmask */ - /* old fs_csshift */ - grub_int32_t fs_nindir; /* value of NINDIR */ - grub_int32_t fs_inopb; /* value of INOPB */ - grub_int32_t fs_old_nspf; /* value of NSPF */ -/* yet another configuration parameter */ - grub_int32_t fs_optim; /* optimization preference, see below */ - grub_int32_t fs_old_npsect; /* # sectors/track including spares */ - grub_int32_t fs_old_interleave; /* hardware sector interleave */ - grub_int32_t fs_old_trackskew; /* sector 0 skew, per track */ - grub_int32_t fs_id[2]; /* unique filesystem id */ -/* sizes determined by number of cylinder groups and their sizes */ - grub_int32_t fs_old_csaddr; /* blk addr of cyl grp summary area */ - grub_int32_t fs_cssize; /* size of cyl grp summary area */ - grub_int32_t fs_cgsize; /* cylinder group size */ - grub_int32_t fs_spare2; /* old fs_ntrak */ - grub_int32_t fs_old_nsect; /* sectors per track */ - grub_int32_t fs_old_spc; /* sectors per cylinder */ - grub_int32_t fs_old_ncyl; /* cylinders in filesystem */ - grub_int32_t fs_old_cpg; /* cylinders per group */ - grub_int32_t fs_ipg; /* inodes per group */ - grub_int32_t fs_fpg; /* blocks per group * fs_frag */ -/* this data must be re-computed after crashes */ - struct csum fs_old_cstotal; /* cylinder summary information */ -/* these fields are cleared at mount time */ - grub_int8_t fs_fmod; /* super block modified flag */ - grub_int8_t fs_clean; /* filesystem is clean flag */ - grub_int8_t fs_ronly; /* mounted read-only flag */ - grub_int8_t fs_old_flags; /* old FS_ flags */ - grub_u_char fs_fsmnt[MAXMNTLEN]; /* name mounted on */ -/* these fields retain the current block allocation info */ - grub_int32_t fs_cgrotor; /* last cg searched */ - void *fs_ocsp[NOCSPTRS]; /* padding; was list of fs_cs buffers */ - grub_u_int8_t *fs_contigdirs; /* # of contiguously allocated dirs */ - struct csum *fs_csp; /* cg summary info buffer for fs_cs */ - grub_int32_t *fs_maxcluster; /* max cluster in each cyl group */ - grub_u_int *fs_active; /* used by snapshots to track fs */ - grub_int32_t fs_old_cpc; /* cyl per cycle in postbl */ - grub_int32_t fs_maxbsize; /* maximum blocking factor permitted */ - grub_int64_t fs_sparecon64[17]; /* old rotation block list head */ - grub_int64_t fs_sblockloc; /* byte offset of standard superblock */ - struct csum_total fs_cstotal; /* cylinder summary information */ - ufs_time_t fs_time; /* last time written */ - grub_int64_t fs_size; /* number of blocks in fs */ - grub_int64_t fs_dsize; /* number of data blocks in fs */ - ufs2_daddr_t fs_csaddr; /* blk addr of cyl grp summary area */ - grub_int64_t fs_pendingblocks; /* blocks in process of being freed */ - grub_int32_t fs_pendinginodes; /* inodes in process of being freed */ - grub_int32_t fs_snapinum[FSMAXSNAP];/* list of snapshot inode numbers */ - grub_int32_t fs_avgfilesize; /* expected average file size */ - grub_int32_t fs_avgfpdir; /* expected # of files per directory */ - grub_int32_t fs_save_cgsize; /* save real cg size to use fs_bsize */ - grub_int32_t fs_sparecon32[26]; /* reserved for future constants */ - grub_int32_t fs_flags; /* see FS_ flags below */ - grub_int32_t fs_contigsumsize; /* size of cluster summary array */ - grub_int32_t fs_maxsymlinklen; /* max length of an internal symlink */ - grub_int32_t fs_old_inodefmt; /* format of on-disk inodes */ - grub_u_int64_t fs_maxfilesize; /* maximum representable file size */ - grub_int64_t fs_qbmask; /* ~fs_bmask for use with 64-bit size */ - grub_int64_t fs_qfmask; /* ~fs_fmask for use with 64-bit size */ - grub_int32_t fs_state; /* validate fs_clean field */ - grub_int32_t fs_old_postblformat; /* format of positional layout tables */ - grub_int32_t fs_old_nrpos; /* number of rotational positions */ - grub_int32_t fs_spare5[2]; /* old fs_postbloff */ - /* old fs_rotbloff */ - grub_int32_t fs_magic; /* magic number */ -}; - -/* - * Filesystem identification - */ -#define FS_UFS1_MAGIC 0x011954 /* UFS1 fast filesystem magic number */ -#define FS_UFS2_MAGIC 0x19540119 /* UFS2 fast filesystem magic number */ - -/* - * Turn filesystem block numbers into disk block addresses. - * This maps filesystem blocks to device size blocks. - */ -#define fsbtodb(fs, b) ((b) << (fs)->fs_fsbtodb) -#define dbtofsb(fs, b) ((b) >> (fs)->fs_fsbtodb) - -/* - * Cylinder group macros to locate things in cylinder groups. - * They calc filesystem addresses of cylinder group data structures. - */ -#define cgbase(fs, c) ((ufs2_daddr_t)((fs)->fs_fpg * (c))) -#define cgimin(fs, c) (cgstart(fs, c) + (fs)->fs_iblkno) /* inode blk */ -#define cgstart(fs, c) \ - ((fs)->fs_magic == FS_UFS2_MAGIC ? cgbase(fs, c) : \ - (cgbase(fs, c) + (fs)->fs_old_cgoffset * ((c) & ~((fs)->fs_old_cgmask)))) - -/* - * Macros for handling inode numbers: - * inode number to filesystem block offset. - * inode number to cylinder group number. - * inode number to filesystem block address. - */ -#define ino_to_cg(fs, x) ((x) / (fs)->fs_ipg) -#define ino_to_fsba(fs, x) \ - ((ufs2_daddr_t)(cgimin(fs, ino_to_cg(fs, x)) + \ - (blkstofrags((fs), (((x) % (fs)->fs_ipg) / INOPB(fs)))))) -#define ino_to_fsbo(fs, x) ((x) % INOPB(fs)) - -/* - * The following macros optimize certain frequently calculated - * quantities by using shifts and masks in place of divisions - * modulos and multiplications. - */ -#define blkoff(fs, loc) /* calculates (loc % fs->fs_bsize) */ \ - ((loc) & (fs)->fs_qbmask) - -/* Use this only when `blk' is known to be small, e.g., < NDADDR. */ -#define smalllblktosize(fs, blk) /* calculates (blk * fs->fs_bsize) */ \ - ((blk) << (fs)->fs_bshift) - - -#define lblkno(fs, loc) /* calculates (loc / fs->fs_bsize) */ \ - ((loc) >> (fs)->fs_bshift) - -#define fragroundup(fs, size) /* calculates roundup(size, fs->fs_fsize) */ \ - (((size) + (fs)->fs_qfmask) & (fs)->fs_fmask) - -#define fragstoblks(fs, frags) /* calculates (frags / fs->fs_frag) */ \ - ((frags) >> (fs)->fs_fragshift) -#define blkstofrags(fs, blks) /* calculates (blks * fs->fs_frag) */ \ - ((blks) << (fs)->fs_fragshift) -#define fragnum(fs, fsb) /* calculates (fsb % fs->fs_frag) */ \ - ((fsb) & ((fs)->fs_frag - 1)) -#define blknum(fs, fsb) /* calculates rounddown(fsb, fs->fs_frag) */ \ - ((fsb) &~ ((fs)->fs_frag - 1)) - -/* - * Determining the size of a file block in the filesystem. - */ -#define blksize(fs, ip, lbn) \ - (((lbn) >= NDADDR || (ip)->i_size >= smalllblktosize(fs, (lbn) + 1)) \ - ? (fs)->fs_bsize \ - : (fragroundup(fs, blkoff(fs, (ip)->i_size)))) -#define sblksize(fs, size, lbn) \ - (((lbn) >= NDADDR || (size) >= ((lbn) + 1) << (fs)->fs_bshift) \ - ? (fs)->fs_bsize \ - : (fragroundup(fs, blkoff(fs, (size))))) - - -/* - * Number of inodes in a secondary storage block/fragment. - */ -#define INOPB(fs) ((fs)->fs_inopb) -#define INOPF(fs) ((fs)->fs_inopb >> (fs)->fs_fragshift) - -/* - * Number of indirects in a filesystem block. - */ -#define NINDIR(fs) ((fs)->fs_nindir) - -#define FS_UNCLEAN 0x01 /* filesystem not clean at mount */ -#define FS_DOSOFTDEP 0x02 /* filesystem using soft dependencies */ -#define FS_NEEDSFSCK 0x04 /* filesystem needs sync fsck before mount */ -#define FS_INDEXDIRS 0x08 /* kernel supports indexed directories */ -#define FS_ACLS 0x10 /* file system has ACLs enabled */ -#define FS_MULTILABEL 0x20 /* file system is MAC multi-label */ -#define FS_FLAGS_UPDATED 0x80 /* flags have been moved to new location */ - -#endif /* _GRUB_UFS2_H_ */ diff --git a/usr/src/grub/grub-0.95/stage2/vstafs.h b/usr/src/grub/grub-0.95/stage2/vstafs.h deleted file mode 100644 index cc7820cbca..0000000000 --- a/usr/src/grub/grub-0.95/stage2/vstafs.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 2001 Free Software Foundation, 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 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 VSTAFS_H -#define VSTAFS_H 1 - - -#define LINE 16 -#define BLOCK_SIZE 512 -#define VSTAFS_START_DATA 320 - -struct bootrecord -{ - unsigned char flag; - unsigned char s_sector; - unsigned char s_head; - unsigned char s_cylinder; - unsigned char p_type; - unsigned char e_sector; - unsigned char e_head; - unsigned char e_cylinder; - unsigned long start_lba; - unsigned long nr_sector_lba; -}; - -struct alloc -{ - unsigned long a_start; - unsigned long a_len; -}; - -struct first_sector -{ - unsigned long fs_magic; - unsigned long fs_size; - unsigned long fs_extsize; - unsigned long fs_free; - struct alloc fs_freesecs[0]; -}; - -struct prot -{ - unsigned char len; - unsigned char pdefault; - unsigned char id[7]; - unsigned char bits[7]; -}; - -struct fs_file -{ - unsigned long prev; - unsigned long rev; - unsigned long len; - unsigned short type; - unsigned short nlink; - struct prot pprot; - unsigned int owner; - unsigned int extents; - struct alloc blocks[32]; - long fs_ctime, fs_mtime; /* it is not lon but time_t */ - char pad[16]; - char data[0]; -}; - -struct dir_entry -{ - char name[28]; - unsigned long start; -}; - -#endif /* ! VSTAFS_H */ diff --git a/usr/src/grub/grub-0.95/stage2/xfs.h b/usr/src/grub/grub-0.95/stage2/xfs.h deleted file mode 100644 index 02f8dcd1a2..0000000000 --- a/usr/src/grub/grub-0.95/stage2/xfs.h +++ /dev/null @@ -1,544 +0,0 @@ -/* xfs.h - an extraction from xfsprogs-1.3.5/include/xfs* into one file */ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 2000 Silicon Graphics, Inc. All Rights Reserved. - * Copyright (C) 2001,2004 Free Software Foundation, Inc. - * - * 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. - * - * 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. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ - */ - -typedef signed char xfs_int8_t; -typedef unsigned char xfs_uint8_t; -typedef short xfs_int16_t; -typedef unsigned short xfs_uint16_t; -typedef int xfs_int32_t; -typedef unsigned int xfs_uint32_t; -typedef long long xfs_int64_t; -typedef unsigned long long xfs_uint64_t; - -typedef xfs_uint64_t xfs_ino_t; -typedef xfs_uint32_t xfs_agino_t; -typedef xfs_int64_t xfs_daddr_t; -typedef xfs_int64_t xfs_off_t; -typedef xfs_uint8_t uuid_t[16]; - - -/* those are from xfs_types.h */ - -typedef xfs_uint32_t xfs_agblock_t; /* blockno in alloc. group */ -typedef xfs_uint32_t xfs_extlen_t; /* extent length in blocks */ -typedef xfs_uint32_t xfs_agnumber_t; /* allocation group number */ -typedef xfs_int32_t xfs_extnum_t; /* # of extents in a file */ -typedef xfs_int16_t xfs_aextnum_t; /* # extents in an attribute fork */ -typedef xfs_int64_t xfs_fsize_t; /* bytes in a file */ - -typedef xfs_uint32_t xfs_dablk_t; /* dir/attr block number (in file) */ -typedef xfs_uint32_t xfs_dahash_t; /* dir/attr hash value */ - -/* - * Disk based types: - */ -typedef xfs_uint64_t xfs_dfsbno_t; /* blockno in filesystem (agno|agbno) */ -typedef xfs_uint64_t xfs_drfsbno_t; /* blockno in filesystem (raw) */ -typedef xfs_uint64_t xfs_drtbno_t; /* extent (block) in realtime area */ -typedef xfs_uint64_t xfs_dfiloff_t; /* block number in a file */ - -typedef xfs_uint64_t xfs_fsblock_t; /* blockno in filesystem (agno|agbno) */ -typedef xfs_uint64_t xfs_fileoff_t; /* block number in a file */ -typedef xfs_uint64_t xfs_filblks_t; /* number of blocks in a file */ - - -/* those are from xfs_sb.h */ - -#define XFS_SB_MAGIC 0x58465342 /* 'XFSB'*/ -#define XFS_SB_VERSION_4 4 /* 6.2+ - bitmask version */ -#define XFS_SB_VERSION_NUMBITS 0x000f - -typedef struct xfs_sb -{ - xfs_uint32_t sb_magicnum; /* magic number == XFS_SB_MAGIC */ - xfs_uint32_t sb_blocksize; /* logical block size, bytes */ - xfs_drfsbno_t sb_dblocks; /* number of data blocks */ - xfs_drfsbno_t sb_rblocks; /* number of realtime blocks */ - xfs_drtbno_t sb_rextents; /* number of realtime extents */ - uuid_t sb_uuid; /* file system unique id */ - xfs_dfsbno_t sb_logstart; /* starting block of log if internal */ - xfs_ino_t sb_rootino; /* root inode number */ - xfs_ino_t sb_rbmino; /* bitmap inode for realtime extents */ - xfs_ino_t sb_rsumino; /* summary inode for rt bitmap */ - xfs_agblock_t sb_rextsize; /* realtime extent size, blocks */ - xfs_agblock_t sb_agblocks; /* size of an allocation group */ - xfs_agnumber_t sb_agcount; /* number of allocation groups */ - xfs_extlen_t sb_rbmblocks; /* number of rt bitmap blocks */ - xfs_extlen_t sb_logblocks; /* number of log blocks */ - xfs_uint16_t sb_versionnum; /* header version == XFS_SB_VERSION */ - xfs_uint16_t sb_sectsize; /* volume sector size, bytes */ - xfs_uint16_t sb_inodesize; /* inode size, bytes */ - xfs_uint16_t sb_inopblock; /* inodes per block */ - char sb_fname[12]; /* file system name */ - xfs_uint8_t sb_blocklog; /* log2 of sb_blocksize */ - xfs_uint8_t sb_sectlog; /* log2 of sb_sectsize */ - xfs_uint8_t sb_inodelog; /* log2 of sb_inodesize */ - xfs_uint8_t sb_inopblog; /* log2 of sb_inopblock */ - xfs_uint8_t sb_agblklog; /* log2 of sb_agblocks (rounded up) */ - xfs_uint8_t sb_rextslog; /* log2 of sb_rextents */ - xfs_uint8_t sb_inprogress; /* mkfs is in progress, don't mount */ - xfs_uint8_t sb_imax_pct; /* max % of fs for inode space */ - /* statistics */ - /* - * These fields must remain contiguous. If you really - * want to change their layout, make sure you fix the - * code in xfs_trans_apply_sb_deltas(). - */ - xfs_uint64_t sb_icount; /* allocated inodes */ - xfs_uint64_t sb_ifree; /* free inodes */ - xfs_uint64_t sb_fdblocks; /* free data blocks */ - xfs_uint64_t sb_frextents; /* free realtime extents */ - /* - * End contiguous fields. - */ - xfs_ino_t sb_uquotino; /* user quota inode */ - xfs_ino_t sb_gquotino; /* group quota inode */ - xfs_uint16_t sb_qflags; /* quota flags */ - xfs_uint8_t sb_flags; /* misc. flags */ - xfs_uint8_t sb_shared_vn; /* shared version number */ - xfs_extlen_t sb_inoalignmt; /* inode chunk alignment, fsblocks */ - xfs_uint32_t sb_unit; /* stripe or raid unit */ - xfs_uint32_t sb_width; /* stripe or raid width */ - xfs_uint8_t sb_dirblklog; /* log2 of dir block size (fsbs) */ - xfs_uint8_t sb_dummy[7]; /* padding */ -} xfs_sb_t; - - -/* those are from xfs_btree.h */ - -/* - * Long form header: bmap btrees. - */ -typedef struct xfs_btree_lblock -{ - xfs_uint32_t bb_magic; /* magic number for block type */ - xfs_uint16_t bb_level; /* 0 is a leaf */ - xfs_uint16_t bb_numrecs; /* current # of data records */ - xfs_dfsbno_t bb_leftsib; /* left sibling block or NULLDFSBNO */ - xfs_dfsbno_t bb_rightsib; /* right sibling block or NULLDFSBNO */ -} xfs_btree_lblock_t; - -/* - * Combined header and structure, used by common code. - */ -typedef struct xfs_btree_hdr -{ - xfs_uint32_t bb_magic; /* magic number for block type */ - xfs_uint16_t bb_level; /* 0 is a leaf */ - xfs_uint16_t bb_numrecs; /* current # of data records */ -} xfs_btree_hdr_t; - -typedef struct xfs_btree_block -{ - xfs_btree_hdr_t bb_h; /* header */ - union { - struct { - xfs_agblock_t bb_leftsib; - xfs_agblock_t bb_rightsib; - } s; /* short form pointers */ - struct { - xfs_dfsbno_t bb_leftsib; - xfs_dfsbno_t bb_rightsib; - } l; /* long form pointers */ - } bb_u; /* rest */ -} xfs_btree_block_t; - -/* those are from xfs_bmap_btree.h */ - -/* - * Bmap root header, on-disk form only. - */ -typedef struct xfs_bmdr_block -{ - xfs_uint16_t bb_level; /* 0 is a leaf */ - xfs_uint16_t bb_numrecs; /* current # of data records */ -} xfs_bmdr_block_t; - -/* - * Bmap btree record and extent descriptor. - * For 32-bit kernels, - * l0:31 is an extent flag (value 1 indicates non-normal). - * l0:0-30 and l1:9-31 are startoff. - * l1:0-8, l2:0-31, and l3:21-31 are startblock. - * l3:0-20 are blockcount. - * For 64-bit kernels, - * l0:63 is an extent flag (value 1 indicates non-normal). - * l0:9-62 are startoff. - * l0:0-8 and l1:21-63 are startblock. - * l1:0-20 are blockcount. - */ - -#define BMBT_USE_64 1 - -typedef struct xfs_bmbt_rec_32 -{ - xfs_uint32_t l0, l1, l2, l3; -} xfs_bmbt_rec_32_t; -typedef struct xfs_bmbt_rec_64 -{ - xfs_uint64_t l0, l1; -} xfs_bmbt_rec_64_t; - -#if BMBT_USE_64 -typedef xfs_uint64_t xfs_bmbt_rec_base_t; /* use this for casts */ -typedef xfs_bmbt_rec_64_t xfs_bmbt_rec_t, xfs_bmdr_rec_t; -#else /* !BMBT_USE_64 */ -typedef xfs_uint32_t xfs_bmbt_rec_base_t; /* use this for casts */ -typedef xfs_bmbt_rec_32_t xfs_bmbt_rec_t, xfs_bmdr_rec_t; -#endif /* BMBT_USE_64 */ - -/* - * Key structure for non-leaf levels of the tree. - */ -typedef struct xfs_bmbt_key -{ - xfs_dfiloff_t br_startoff; /* starting file offset */ -} xfs_bmbt_key_t, xfs_bmdr_key_t; - -typedef xfs_dfsbno_t xfs_bmbt_ptr_t, xfs_bmdr_ptr_t; /* btree pointer type */ - /* btree block header type */ -typedef struct xfs_btree_lblock xfs_bmbt_block_t; - - -/* those are from xfs_dir2.h */ -/* - * Directory version 2. - * There are 4 possible formats: - * shortform - * single block - data with embedded leaf at the end - * multiple data blocks, single leaf+freeindex block - * data blocks, node&leaf blocks (btree), freeindex blocks - * - * The shortform format is in xfs_dir2_sf.h. - * The single block format is in xfs_dir2_block.h. - * The data block format is in xfs_dir2_data.h. - * The leaf and freeindex block formats are in xfs_dir2_leaf.h. - * Node blocks are the same as the other version, in xfs_da_btree.h. - */ - -/* - * Byte offset in data block and shortform entry. - */ -typedef xfs_uint16_t xfs_dir2_data_off_t; - -/* - * Byte offset in a directory. - */ -typedef xfs_off_t xfs_dir2_off_t; - -/* those are from xfs_da_btree.h */ -/*======================================================================== - * Directory Structure when greater than XFS_LBSIZE(mp) bytes. - *========================================================================*/ - -/* - * This structure is common to both leaf nodes and non-leaf nodes in the Btree. - * - * Is is used to manage a doubly linked list of all blocks at the same - * level in the Btree, and to identify which type of block this is. - */ -#define XFS_DIR2_LEAF1_MAGIC 0xd2f1 /* magic number: v2 dirlf single blks */ -#define XFS_DIR2_LEAFN_MAGIC 0xd2ff /* magic number: v2 dirlf multi blks */ - -typedef struct xfs_da_blkinfo { - xfs_dablk_t forw; /* previous block in list */ - xfs_dablk_t back; /* following block in list */ - xfs_uint16_t magic; /* validity check on block */ - xfs_uint16_t pad; /* unused */ -} xfs_da_blkinfo_t; - -/* - * This is the structure of the root and intermediate nodes in the Btree. - * The leaf nodes are defined above. - * - * Entries are not packed. - * - * Since we have duplicate keys, use a binary search but always follow - * all match in the block, not just the first match found. - */ - -typedef struct xfs_da_intnode { - struct xfs_da_node_hdr { /* constant-structure header block */ - xfs_da_blkinfo_t info; /* block type, links, etc. */ - xfs_uint16_t count; /* count of active entries */ - xfs_uint16_t level; /* level above leaves (leaf == 0) */ - } hdr; - struct xfs_da_node_entry { - xfs_dahash_t hashval; /* hash value for this descendant */ - xfs_dablk_t before; /* Btree block before this key */ - } btree[1]; /* variable sized array of keys */ -} xfs_da_intnode_t; - - -/* those are from xfs_dir2_data.h */ -/* - * Directory format 2, data block structures. - */ - -/* - * Constants. - */ -#define XFS_DIR2_DATA_FREE_TAG 0xffff -#define XFS_DIR2_DATA_FD_COUNT 3 - -/* - * Structures. - */ - -/* - * Describe a free area in the data block. - * The freespace will be formatted as a xfs_dir2_data_unused_t. - */ -typedef struct xfs_dir2_data_free { - xfs_dir2_data_off_t offset; /* start of freespace */ - xfs_dir2_data_off_t length; /* length of freespace */ -} xfs_dir2_data_free_t; - -/* - * Header for the data blocks. - * Always at the beginning of a directory-sized block. - * The code knows that XFS_DIR2_DATA_FD_COUNT is 3. - */ -typedef struct xfs_dir2_data_hdr { - xfs_uint32_t magic; /* XFS_DIR2_DATA_MAGIC */ - /* or XFS_DIR2_BLOCK_MAGIC */ - xfs_dir2_data_free_t bestfree[XFS_DIR2_DATA_FD_COUNT]; -} xfs_dir2_data_hdr_t; - -/* - * Active entry in a data block. Aligned to 8 bytes. - * Tag appears as the last 2 bytes. - */ -typedef struct xfs_dir2_data_entry { - xfs_ino_t inumber; /* inode number */ - xfs_uint8_t namelen; /* name length */ - xfs_uint8_t name[1]; /* name bytes, no null */ - /* variable offset */ - xfs_dir2_data_off_t tag; /* starting offset of us */ -} xfs_dir2_data_entry_t; - -/* - * Unused entry in a data block. Aligned to 8 bytes. - * Tag appears as the last 2 bytes. - */ -typedef struct xfs_dir2_data_unused { - xfs_uint16_t freetag; /* XFS_DIR2_DATA_FREE_TAG */ - xfs_dir2_data_off_t length; /* total free length */ - /* variable offset */ - xfs_dir2_data_off_t tag; /* starting offset of us */ -} xfs_dir2_data_unused_t; - -typedef union { - xfs_dir2_data_entry_t entry; - xfs_dir2_data_unused_t unused; -} xfs_dir2_data_union_t; - - -/* those are from xfs_dir2_leaf.h */ -/* - * Directory version 2, leaf block structures. - */ - -/* - * Leaf block header. - */ -typedef struct xfs_dir2_leaf_hdr { - xfs_da_blkinfo_t info; /* header for da routines */ - xfs_uint16_t count; /* count of entries */ - xfs_uint16_t stale; /* count of stale entries */ -} xfs_dir2_leaf_hdr_t; - - -/* those are from xfs_dir2_block.h */ -/* - * xfs_dir2_block.h - * Directory version 2, single block format structures - */ - -/* - * The single block format is as follows: - * xfs_dir2_data_hdr_t structure - * xfs_dir2_data_entry_t and xfs_dir2_data_unused_t structures - * xfs_dir2_leaf_entry_t structures - * xfs_dir2_block_tail_t structure - */ - -#define XFS_DIR2_BLOCK_MAGIC 0x58443242 /* XD2B: for one block dirs */ - -typedef struct xfs_dir2_block_tail { - xfs_uint32_t count; /* count of leaf entries */ - xfs_uint32_t stale; /* count of stale lf entries */ -} xfs_dir2_block_tail_t; - - -/* those are from xfs_dir2_sf.h */ - -/* - * Directory layout when stored internal to an inode. - * - * Small directories are packed as tightly as possible so as to - * fit into the literal area of the inode. - */ - -/* - * Inode number stored as 8 8-bit values. - */ -typedef struct { xfs_uint8_t i[8]; } xfs_dir2_ino8_t; - -/* - * Inode number stored as 4 8-bit values. - * Works a lot of the time, when all the inode numbers in a directory - * fit in 32 bits. - */ -typedef struct { xfs_uint8_t i[4]; } xfs_dir2_ino4_t; - -typedef union { - xfs_dir2_ino8_t i8; - xfs_dir2_ino4_t i4; -} xfs_dir2_inou_t; - -/* - * Normalized offset (in a data block) of the entry, really xfs_dir2_data_off_t. - * Only need 16 bits, this is the byte offset into the single block form. - */ -typedef struct { xfs_uint8_t i[2]; } xfs_dir2_sf_off_t; - -/* - * The parent directory has a dedicated field, and the self-pointer must - * be calculated on the fly. - * - * Entries are packed toward the top as tightly as possible. The header - * and the elements must be bcopy()'d out into a work area to get correct - * alignment for the inode number fields. - */ -typedef struct xfs_dir2_sf_hdr { - xfs_uint8_t count; /* count of entries */ - xfs_uint8_t i8count; /* count of 8-byte inode #s */ - xfs_dir2_inou_t parent; /* parent dir inode number */ -} xfs_dir2_sf_hdr_t; - -typedef struct xfs_dir2_sf_entry { - xfs_uint8_t namelen; /* actual name length */ - xfs_dir2_sf_off_t offset; /* saved offset */ - xfs_uint8_t name[1]; /* name, variable size */ - xfs_dir2_inou_t inumber; /* inode number, var. offset */ -} xfs_dir2_sf_entry_t; - -typedef struct xfs_dir2_sf { - xfs_dir2_sf_hdr_t hdr; /* shortform header */ - xfs_dir2_sf_entry_t list[1]; /* shortform entries */ -} xfs_dir2_sf_t; - -/* those are from xfs_dinode.h */ - -#define XFS_DINODE_VERSION_1 1 -#define XFS_DINODE_VERSION_2 2 -#define XFS_DINODE_MAGIC 0x494e /* 'IN' */ - -/* - * Disk inode structure. - * This is just the header; the inode is expanded to fill a variable size - * with the last field expanding. It is split into the core and "other" - * because we only need the core part in the in-core inode. - */ -typedef struct xfs_timestamp { - xfs_int32_t t_sec; /* timestamp seconds */ - xfs_int32_t t_nsec; /* timestamp nanoseconds */ -} xfs_timestamp_t; - -/* - * Note: Coordinate changes to this structure with the XFS_DI_* #defines - * below and the offsets table in xfs_ialloc_log_di(). - */ -typedef struct xfs_dinode_core -{ - xfs_uint16_t di_magic; /* inode magic # = XFS_DINODE_MAGIC */ - xfs_uint16_t di_mode; /* mode and type of file */ - xfs_int8_t di_version; /* inode version */ - xfs_int8_t di_format; /* format of di_c data */ - xfs_uint16_t di_onlink; /* old number of links to file */ - xfs_uint32_t di_uid; /* owner's user id */ - xfs_uint32_t di_gid; /* owner's group id */ - xfs_uint32_t di_nlink; /* number of links to file */ - xfs_uint16_t di_projid; /* owner's project id */ - xfs_uint8_t di_pad[10]; /* unused, zeroed space */ - xfs_timestamp_t di_atime; /* time last accessed */ - xfs_timestamp_t di_mtime; /* time last modified */ - xfs_timestamp_t di_ctime; /* time created/inode modified */ - xfs_fsize_t di_size; /* number of bytes in file */ - xfs_drfsbno_t di_nblocks; /* # of direct & btree blocks used */ - xfs_extlen_t di_extsize; /* basic/minimum extent size for file */ - xfs_extnum_t di_nextents; /* number of extents in data fork */ - xfs_aextnum_t di_anextents; /* number of extents in attribute fork*/ - xfs_uint8_t di_forkoff; /* attr fork offs, <<3 for 64b align */ - xfs_int8_t di_aformat; /* format of attr fork's data */ - xfs_uint32_t di_dmevmask; /* DMIG event mask */ - xfs_uint16_t di_dmstate; /* DMIG state info */ - xfs_uint16_t di_flags; /* random flags, XFS_DIFLAG_... */ - xfs_uint32_t di_gen; /* generation number */ -} xfs_dinode_core_t; - -typedef struct xfs_dinode -{ - xfs_dinode_core_t di_core; - xfs_agino_t di_next_unlinked;/* agi unlinked list ptr */ - union { - xfs_bmdr_block_t di_bmbt; /* btree root block */ - xfs_bmbt_rec_32_t di_bmx[1]; /* extent list */ - xfs_dir2_sf_t di_dir2sf; /* shortform directory v2 */ - char di_c[1]; /* local contents */ - } di_u; -} xfs_dinode_t; - -/* - * Values for di_format - */ -typedef enum xfs_dinode_fmt -{ - XFS_DINODE_FMT_DEV, /* CHR, BLK: di_dev */ - XFS_DINODE_FMT_LOCAL, /* DIR, REG: di_c */ - /* LNK: di_symlink */ - XFS_DINODE_FMT_EXTENTS, /* DIR, REG, LNK: di_bmx */ - XFS_DINODE_FMT_BTREE, /* DIR, REG, LNK: di_bmbt */ - XFS_DINODE_FMT_UUID /* MNT: di_uuid */ -} xfs_dinode_fmt_t; - -/* - * File types (mode field) - */ -#define IFMT 0170000 /* type of file */ -#define IFDIR 0040000 /* directory */ -#define IFREG 0100000 /* regular */ -#define IFLNK 0120000 /* symbolic link */ diff --git a/usr/src/grub/grub-0.95/stage2/zfs-include/dmu.h b/usr/src/grub/grub-0.95/stage2/zfs-include/dmu.h deleted file mode 100644 index 3b18d8ada5..0000000000 --- a/usr/src/grub/grub-0.95/stage2/zfs-include/dmu.h +++ /dev/null @@ -1,107 +0,0 @@ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, 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 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. - */ -/* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _SYS_DMU_H -#define _SYS_DMU_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * This file describes the interface that the DMU provides for its - * consumers. - * - * The DMU also interacts with the SPA. That interface is described in - * dmu_spa.h. - */ -typedef enum dmu_object_type { - DMU_OT_NONE, - /* general: */ - DMU_OT_OBJECT_DIRECTORY, /* ZAP */ - DMU_OT_OBJECT_ARRAY, /* UINT64 */ - DMU_OT_PACKED_NVLIST, /* UINT8 (XDR by nvlist_pack/unpack) */ - DMU_OT_PACKED_NVLIST_SIZE, /* UINT64 */ - DMU_OT_BPLIST, /* UINT64 */ - DMU_OT_BPLIST_HDR, /* UINT64 */ - /* spa: */ - DMU_OT_SPACE_MAP_HEADER, /* UINT64 */ - DMU_OT_SPACE_MAP, /* UINT64 */ - /* zil: */ - DMU_OT_INTENT_LOG, /* UINT64 */ - /* dmu: */ - DMU_OT_DNODE, /* DNODE */ - DMU_OT_OBJSET, /* OBJSET */ - /* dsl: */ - DMU_OT_DSL_DIR, /* UINT64 */ - DMU_OT_DSL_DIR_CHILD_MAP, /* ZAP */ - DMU_OT_DSL_DS_SNAP_MAP, /* ZAP */ - DMU_OT_DSL_PROPS, /* ZAP */ - DMU_OT_DSL_DATASET, /* UINT64 */ - /* zpl: */ - DMU_OT_ZNODE, /* ZNODE */ - DMU_OT_ACL, /* ACL */ - DMU_OT_PLAIN_FILE_CONTENTS, /* UINT8 */ - DMU_OT_DIRECTORY_CONTENTS, /* ZAP */ - DMU_OT_MASTER_NODE, /* ZAP */ - DMU_OT_UNLINKED_SET, /* ZAP */ - /* zvol: */ - DMU_OT_ZVOL, /* UINT8 */ - DMU_OT_ZVOL_PROP, /* ZAP */ - /* other; for testing only! */ - DMU_OT_PLAIN_OTHER, /* UINT8 */ - DMU_OT_UINT64_OTHER, /* UINT64 */ - DMU_OT_ZAP_OTHER, /* ZAP */ - /* new object types: */ - DMU_OT_ERROR_LOG, /* ZAP */ - DMU_OT_SPA_HISTORY, /* UINT8 */ - DMU_OT_SPA_HISTORY_OFFSETS, /* spa_his_phys_t */ - DMU_OT_POOL_PROPS, /* ZAP */ - - DMU_OT_NUMTYPES -} dmu_object_type_t; - -typedef enum dmu_objset_type { - DMU_OST_NONE, - DMU_OST_META, - DMU_OST_ZFS, - DMU_OST_ZVOL, - DMU_OST_OTHER, /* For testing only! */ - DMU_OST_ANY, /* Be careful! */ - DMU_OST_NUMTYPES -} dmu_objset_type_t; - -/* - * The names of zap entries in the DIRECTORY_OBJECT of the MOS. - */ -#define DMU_POOL_DIRECTORY_OBJECT 1 -#define DMU_POOL_CONFIG "config" -#define DMU_POOL_ROOT_DATASET "root_dataset" -#define DMU_POOL_SYNC_BPLIST "sync_bplist" -#define DMU_POOL_ERRLOG_SCRUB "errlog_scrub" -#define DMU_POOL_ERRLOG_LAST "errlog_last" -#define DMU_POOL_SPARES "spares" -#define DMU_POOL_DEFLATE "deflate" -#define DMU_POOL_HISTORY "history" -#define DMU_POOL_PROPS "pool_props" -#define DMU_POOL_L2CACHE "l2cache" - -#endif /* _SYS_DMU_H */ diff --git a/usr/src/grub/grub-0.95/stage2/zfs-include/dmu_objset.h b/usr/src/grub/grub-0.95/stage2/zfs-include/dmu_objset.h deleted file mode 100644 index 6345c13988..0000000000 --- a/usr/src/grub/grub-0.95/stage2/zfs-include/dmu_objset.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, 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 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. - */ -/* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _SYS_DMU_OBJSET_H -#define _SYS_DMU_OBJSET_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -typedef struct objset_phys { - dnode_phys_t os_meta_dnode; - zil_header_t os_zil_header; - uint64_t os_type; - char os_pad[1024 - sizeof (dnode_phys_t) - sizeof (zil_header_t) - - sizeof (uint64_t)]; -} objset_phys_t; - -#endif /* _SYS_DMU_OBJSET_H */ diff --git a/usr/src/grub/grub-0.95/stage2/zfs-include/dnode.h b/usr/src/grub/grub-0.95/stage2/zfs-include/dnode.h deleted file mode 100644 index 80f08fa2ca..0000000000 --- a/usr/src/grub/grub-0.95/stage2/zfs-include/dnode.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, 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 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. - */ -/* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _SYS_DNODE_H -#define _SYS_DNODE_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Fixed constants. - */ -#define DNODE_SHIFT 9 /* 512 bytes */ -#define DN_MIN_INDBLKSHIFT 10 /* 1k */ -#define DN_MAX_INDBLKSHIFT 14 /* 16k */ -#define DNODE_BLOCK_SHIFT 14 /* 16k */ -#define DNODE_CORE_SIZE 64 /* 64 bytes for dnode sans blkptrs */ -#define DN_MAX_OBJECT_SHIFT 48 /* 256 trillion (zfs_fid_t limit) */ -#define DN_MAX_OFFSET_SHIFT 64 /* 2^64 bytes in a dnode */ - -/* - * Derived constants. - */ -#define DNODE_SIZE (1 << DNODE_SHIFT) -#define DN_MAX_NBLKPTR ((DNODE_SIZE - DNODE_CORE_SIZE) >> SPA_BLKPTRSHIFT) -#define DN_MAX_BONUSLEN (DNODE_SIZE - DNODE_CORE_SIZE - (1 << SPA_BLKPTRSHIFT)) -#define DN_MAX_OBJECT (1ULL << DN_MAX_OBJECT_SHIFT) - -#define DNODES_PER_BLOCK_SHIFT (DNODE_BLOCK_SHIFT - DNODE_SHIFT) -#define DNODES_PER_BLOCK (1ULL << DNODES_PER_BLOCK_SHIFT) -#define DNODES_PER_LEVEL_SHIFT (DN_MAX_INDBLKSHIFT - SPA_BLKPTRSHIFT) - -#define DN_BONUS(dnp) ((void*)((dnp)->dn_bonus + \ - (((dnp)->dn_nblkptr - 1) * sizeof (blkptr_t)))) - -typedef struct dnode_phys { - uint8_t dn_type; /* dmu_object_type_t */ - uint8_t dn_indblkshift; /* ln2(indirect block size) */ - uint8_t dn_nlevels; /* 1=dn_blkptr->data blocks */ - uint8_t dn_nblkptr; /* length of dn_blkptr */ - uint8_t dn_bonustype; /* type of data in bonus buffer */ - uint8_t dn_checksum; /* ZIO_CHECKSUM type */ - uint8_t dn_compress; /* ZIO_COMPRESS type */ - uint8_t dn_flags; /* DNODE_FLAG_* */ - uint16_t dn_datablkszsec; /* data block size in 512b sectors */ - uint16_t dn_bonuslen; /* length of dn_bonus */ - uint8_t dn_pad2[4]; - - /* accounting is protected by dn_dirty_mtx */ - uint64_t dn_maxblkid; /* largest allocated block ID */ - uint64_t dn_used; /* bytes (or sectors) of disk space */ - - uint64_t dn_pad3[4]; - - blkptr_t dn_blkptr[1]; - uint8_t dn_bonus[DN_MAX_BONUSLEN]; -} dnode_phys_t; - -#endif /* _SYS_DNODE_H */ diff --git a/usr/src/grub/grub-0.95/stage2/zfs-include/dsl_dataset.h b/usr/src/grub/grub-0.95/stage2/zfs-include/dsl_dataset.h deleted file mode 100644 index a8c60c4fcc..0000000000 --- a/usr/src/grub/grub-0.95/stage2/zfs-include/dsl_dataset.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, 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 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. - */ -/* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _SYS_DSL_DATASET_H -#define _SYS_DSL_DATASET_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -typedef struct dsl_dataset_phys { - uint64_t ds_dir_obj; - uint64_t ds_prev_snap_obj; - uint64_t ds_prev_snap_txg; - uint64_t ds_next_snap_obj; - uint64_t ds_snapnames_zapobj; /* zap obj of snaps; ==0 for snaps */ - uint64_t ds_num_children; /* clone/snap children; ==0 for head */ - uint64_t ds_creation_time; /* seconds since 1970 */ - uint64_t ds_creation_txg; - uint64_t ds_deadlist_obj; - uint64_t ds_used_bytes; - uint64_t ds_compressed_bytes; - uint64_t ds_uncompressed_bytes; - uint64_t ds_unique_bytes; /* only relevant to snapshots */ - /* - * The ds_fsid_guid is a 56-bit ID that can change to avoid - * collisions. The ds_guid is a 64-bit ID that will never - * change, so there is a small probability that it will collide. - */ - uint64_t ds_fsid_guid; - uint64_t ds_guid; - uint64_t ds_flags; - blkptr_t ds_bp; - uint64_t ds_pad[8]; /* pad out to 320 bytes for good measure */ -} dsl_dataset_phys_t; - -#endif /* _SYS_DSL_DATASET_H */ diff --git a/usr/src/grub/grub-0.95/stage2/zfs-include/dsl_dir.h b/usr/src/grub/grub-0.95/stage2/zfs-include/dsl_dir.h deleted file mode 100644 index 591e1978c9..0000000000 --- a/usr/src/grub/grub-0.95/stage2/zfs-include/dsl_dir.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, 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 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. - */ -/* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _SYS_DSL_DIR_H -#define _SYS_DSL_DIR_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -typedef struct dsl_dir_phys { - uint64_t dd_creation_time; /* not actually used */ - uint64_t dd_head_dataset_obj; - uint64_t dd_parent_obj; - uint64_t dd_clone_parent_obj; - uint64_t dd_child_dir_zapobj; - /* - * how much space our children are accounting for; for leaf - * datasets, == physical space used by fs + snaps - */ - uint64_t dd_used_bytes; - uint64_t dd_compressed_bytes; - uint64_t dd_uncompressed_bytes; - /* Administrative quota setting */ - uint64_t dd_quota; - /* Administrative reservation setting */ - uint64_t dd_reserved; - uint64_t dd_props_zapobj; - uint64_t dd_deleg_zapobj; /* dataset permissions */ - uint64_t dd_pad[20]; /* pad out to 256 bytes for good measure */ -} dsl_dir_phys_t; - -#endif /* _SYS_DSL_DIR_H */ diff --git a/usr/src/grub/grub-0.95/stage2/zfs-include/spa.h b/usr/src/grub/grub-0.95/stage2/zfs-include/spa.h deleted file mode 100644 index a034e01da4..0000000000 --- a/usr/src/grub/grub-0.95/stage2/zfs-include/spa.h +++ /dev/null @@ -1,285 +0,0 @@ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, 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 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. - */ -/* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _SYS_SPA_H -#define _SYS_SPA_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * General-purpose 32-bit and 64-bit bitfield encodings. - */ -#define BF32_DECODE(x, low, len) P2PHASE((x) >> (low), 1U << (len)) -#define BF64_DECODE(x, low, len) P2PHASE((x) >> (low), 1ULL << (len)) -#define BF32_ENCODE(x, low, len) (P2PHASE((x), 1U << (len)) << (low)) -#define BF64_ENCODE(x, low, len) (P2PHASE((x), 1ULL << (len)) << (low)) - -#define BF32_GET(x, low, len) BF32_DECODE(x, low, len) -#define BF64_GET(x, low, len) BF64_DECODE(x, low, len) - -#define BF32_SET(x, low, len, val) \ - ((x) ^= BF32_ENCODE((x >> low) ^ (val), low, len)) -#define BF64_SET(x, low, len, val) \ - ((x) ^= BF64_ENCODE((x >> low) ^ (val), low, len)) - -#define BF32_GET_SB(x, low, len, shift, bias) \ - ((BF32_GET(x, low, len) + (bias)) << (shift)) -#define BF64_GET_SB(x, low, len, shift, bias) \ - ((BF64_GET(x, low, len) + (bias)) << (shift)) - -#define BF32_SET_SB(x, low, len, shift, bias, val) \ - BF32_SET(x, low, len, ((val) >> (shift)) - (bias)) -#define BF64_SET_SB(x, low, len, shift, bias, val) \ - BF64_SET(x, low, len, ((val) >> (shift)) - (bias)) - -/* - * We currently support nine block sizes, from 512 bytes to 128K. - * We could go higher, but the benefits are near-zero and the cost - * of COWing a giant block to modify one byte would become excessive. - */ -#define SPA_MINBLOCKSHIFT 9 -#define SPA_MAXBLOCKSHIFT 17 -#define SPA_MINBLOCKSIZE (1ULL << SPA_MINBLOCKSHIFT) -#define SPA_MAXBLOCKSIZE (1ULL << SPA_MAXBLOCKSHIFT) - -#define SPA_BLOCKSIZES (SPA_MAXBLOCKSHIFT - SPA_MINBLOCKSHIFT + 1) - -/* - * The DVA size encodings for LSIZE and PSIZE support blocks up to 32MB. - * The ASIZE encoding should be at least 64 times larger (6 more bits) - * to support up to 4-way RAID-Z mirror mode with worst-case gang block - * overhead, three DVAs per bp, plus one more bit in case we do anything - * else that expands the ASIZE. - */ -#define SPA_LSIZEBITS 16 /* LSIZE up to 32M (2^16 * 512) */ -#define SPA_PSIZEBITS 16 /* PSIZE up to 32M (2^16 * 512) */ -#define SPA_ASIZEBITS 24 /* ASIZE up to 64 times larger */ - -/* - * All SPA data is represented by 128-bit data virtual addresses (DVAs). - * The members of the dva_t should be considered opaque outside the SPA. - */ -typedef struct dva { - uint64_t dva_word[2]; -} dva_t; - -/* - * Each block has a 256-bit checksum -- strong enough for cryptographic hashes. - */ -typedef struct zio_cksum { - uint64_t zc_word[4]; -} zio_cksum_t; - -/* - * Each block is described by its DVAs, time of birth, checksum, etc. - * The word-by-word, bit-by-bit layout of the blkptr is as follows: - * - * 64 56 48 40 32 24 16 8 0 - * +-------+-------+-------+-------+-------+-------+-------+-------+ - * 0 | vdev1 | GRID | ASIZE | - * +-------+-------+-------+-------+-------+-------+-------+-------+ - * 1 |G| offset1 | - * +-------+-------+-------+-------+-------+-------+-------+-------+ - * 2 | vdev2 | GRID | ASIZE | - * +-------+-------+-------+-------+-------+-------+-------+-------+ - * 3 |G| offset2 | - * +-------+-------+-------+-------+-------+-------+-------+-------+ - * 4 | vdev3 | GRID | ASIZE | - * +-------+-------+-------+-------+-------+-------+-------+-------+ - * 5 |G| offset3 | - * +-------+-------+-------+-------+-------+-------+-------+-------+ - * 6 |E| lvl | type | cksum | comp | PSIZE | LSIZE | - * +-------+-------+-------+-------+-------+-------+-------+-------+ - * 7 | padding | - * +-------+-------+-------+-------+-------+-------+-------+-------+ - * 8 | padding | - * +-------+-------+-------+-------+-------+-------+-------+-------+ - * 9 | padding | - * +-------+-------+-------+-------+-------+-------+-------+-------+ - * a | birth txg | - * +-------+-------+-------+-------+-------+-------+-------+-------+ - * b | fill count | - * +-------+-------+-------+-------+-------+-------+-------+-------+ - * c | checksum[0] | - * +-------+-------+-------+-------+-------+-------+-------+-------+ - * d | checksum[1] | - * +-------+-------+-------+-------+-------+-------+-------+-------+ - * e | checksum[2] | - * +-------+-------+-------+-------+-------+-------+-------+-------+ - * f | checksum[3] | - * +-------+-------+-------+-------+-------+-------+-------+-------+ - * - * Legend: - * - * vdev virtual device ID - * offset offset into virtual device - * LSIZE logical size - * PSIZE physical size (after compression) - * ASIZE allocated size (including RAID-Z parity and gang block headers) - * GRID RAID-Z layout information (reserved for future use) - * cksum checksum function - * comp compression function - * G gang block indicator - * E endianness - * type DMU object type - * lvl level of indirection - * birth txg transaction group in which the block was born - * fill count number of non-zero blocks under this bp - * checksum[4] 256-bit checksum of the data this bp describes - */ -typedef struct blkptr { - dva_t blk_dva[3]; /* 128-bit Data Virtual Address */ - uint64_t blk_prop; /* size, compression, type, etc */ - uint64_t blk_pad[3]; /* Extra space for the future */ - uint64_t blk_birth; /* transaction group at birth */ - uint64_t blk_fill; /* fill count */ - zio_cksum_t blk_cksum; /* 256-bit checksum */ -} blkptr_t; - -#define SPA_BLKPTRSHIFT 7 /* blkptr_t is 128 bytes */ -#define SPA_DVAS_PER_BP 3 /* Number of DVAs in a bp */ - -/* - * Macros to get and set fields in a bp or DVA. - */ -#define DVA_GET_ASIZE(dva) \ - BF64_GET_SB((dva)->dva_word[0], 0, 24, SPA_MINBLOCKSHIFT, 0) -#define DVA_SET_ASIZE(dva, x) \ - BF64_SET_SB((dva)->dva_word[0], 0, 24, SPA_MINBLOCKSHIFT, 0, x) - -#define DVA_GET_GRID(dva) BF64_GET((dva)->dva_word[0], 24, 8) -#define DVA_SET_GRID(dva, x) BF64_SET((dva)->dva_word[0], 24, 8, x) - -#define DVA_GET_VDEV(dva) BF64_GET((dva)->dva_word[0], 32, 32) -#define DVA_SET_VDEV(dva, x) BF64_SET((dva)->dva_word[0], 32, 32, x) - -#define DVA_GET_OFFSET(dva) \ - BF64_GET_SB((dva)->dva_word[1], 0, 63, SPA_MINBLOCKSHIFT, 0) -#define DVA_SET_OFFSET(dva, x) \ - BF64_SET_SB((dva)->dva_word[1], 0, 63, SPA_MINBLOCKSHIFT, 0, x) - -#define DVA_GET_GANG(dva) BF64_GET((dva)->dva_word[1], 63, 1) -#define DVA_SET_GANG(dva, x) BF64_SET((dva)->dva_word[1], 63, 1, x) - -#define BP_GET_LSIZE(bp) \ - (BP_IS_HOLE(bp) ? 0 : \ - BF64_GET_SB((bp)->blk_prop, 0, 16, SPA_MINBLOCKSHIFT, 1)) -#define BP_SET_LSIZE(bp, x) \ - BF64_SET_SB((bp)->blk_prop, 0, 16, SPA_MINBLOCKSHIFT, 1, x) - -#define BP_GET_PSIZE(bp) \ - BF64_GET_SB((bp)->blk_prop, 16, 16, SPA_MINBLOCKSHIFT, 1) -#define BP_SET_PSIZE(bp, x) \ - BF64_SET_SB((bp)->blk_prop, 16, 16, SPA_MINBLOCKSHIFT, 1, x) - -#define BP_GET_COMPRESS(bp) BF64_GET((bp)->blk_prop, 32, 8) -#define BP_SET_COMPRESS(bp, x) BF64_SET((bp)->blk_prop, 32, 8, x) - -#define BP_GET_CHECKSUM(bp) BF64_GET((bp)->blk_prop, 40, 8) -#define BP_SET_CHECKSUM(bp, x) BF64_SET((bp)->blk_prop, 40, 8, x) - -#define BP_GET_TYPE(bp) BF64_GET((bp)->blk_prop, 48, 8) -#define BP_SET_TYPE(bp, x) BF64_SET((bp)->blk_prop, 48, 8, x) - -#define BP_GET_LEVEL(bp) BF64_GET((bp)->blk_prop, 56, 5) -#define BP_SET_LEVEL(bp, x) BF64_SET((bp)->blk_prop, 56, 5, x) - -#define BP_GET_BYTEORDER(bp) (0 - BF64_GET((bp)->blk_prop, 63, 1)) -#define BP_SET_BYTEORDER(bp, x) BF64_SET((bp)->blk_prop, 63, 1, x) - -#define BP_GET_ASIZE(bp) \ - (DVA_GET_ASIZE(&(bp)->blk_dva[0]) + DVA_GET_ASIZE(&(bp)->blk_dva[1]) + \ - DVA_GET_ASIZE(&(bp)->blk_dva[2])) - -#define BP_GET_UCSIZE(bp) \ - ((BP_GET_LEVEL(bp) > 0 || dmu_ot[BP_GET_TYPE(bp)].ot_metadata) ? \ - BP_GET_PSIZE(bp) : BP_GET_LSIZE(bp)); - -#define BP_GET_NDVAS(bp) \ - (!!DVA_GET_ASIZE(&(bp)->blk_dva[0]) + \ - !!DVA_GET_ASIZE(&(bp)->blk_dva[1]) + \ - !!DVA_GET_ASIZE(&(bp)->blk_dva[2])) - -#define BP_COUNT_GANG(bp) \ - (DVA_GET_GANG(&(bp)->blk_dva[0]) + \ - DVA_GET_GANG(&(bp)->blk_dva[1]) + \ - DVA_GET_GANG(&(bp)->blk_dva[2])) - -#define DVA_EQUAL(dva1, dva2) \ - ((dva1)->dva_word[1] == (dva2)->dva_word[1] && \ - (dva1)->dva_word[0] == (dva2)->dva_word[0]) - -#define ZIO_CHECKSUM_EQUAL(zc1, zc2) \ - (0 == (((zc1).zc_word[0] - (zc2).zc_word[0]) | \ - ((zc1).zc_word[1] - (zc2).zc_word[1]) | \ - ((zc1).zc_word[2] - (zc2).zc_word[2]) | \ - ((zc1).zc_word[3] - (zc2).zc_word[3]))) - - -#define DVA_IS_VALID(dva) (DVA_GET_ASIZE(dva) != 0) - -#define ZIO_SET_CHECKSUM(zcp, w0, w1, w2, w3) \ -{ \ - (zcp)->zc_word[0] = w0; \ - (zcp)->zc_word[1] = w1; \ - (zcp)->zc_word[2] = w2; \ - (zcp)->zc_word[3] = w3; \ -} - -#define BP_IDENTITY(bp) (&(bp)->blk_dva[0]) -#define BP_IS_GANG(bp) DVA_GET_GANG(BP_IDENTITY(bp)) -#define BP_IS_HOLE(bp) ((bp)->blk_birth == 0) -#define BP_IS_OLDER(bp, txg) (!BP_IS_HOLE(bp) && (bp)->blk_birth < (txg)) - -#define BP_ZERO(bp) \ -{ \ - (bp)->blk_dva[0].dva_word[0] = 0; \ - (bp)->blk_dva[0].dva_word[1] = 0; \ - (bp)->blk_dva[1].dva_word[0] = 0; \ - (bp)->blk_dva[1].dva_word[1] = 0; \ - (bp)->blk_dva[2].dva_word[0] = 0; \ - (bp)->blk_dva[2].dva_word[1] = 0; \ - (bp)->blk_prop = 0; \ - (bp)->blk_pad[0] = 0; \ - (bp)->blk_pad[1] = 0; \ - (bp)->blk_pad[2] = 0; \ - (bp)->blk_birth = 0; \ - (bp)->blk_fill = 0; \ - ZIO_SET_CHECKSUM(&(bp)->blk_cksum, 0, 0, 0, 0); \ -} - -/* - * Note: the byteorder is either 0 or -1, both of which are palindromes. - * This simplifies the endianness handling a bit. - */ -#ifdef _BIG_ENDIAN -#define ZFS_HOST_BYTEORDER (0ULL) -#else -#define ZFS_HOST_BYTEORDER (-1ULL) -#endif - -#define BP_SHOULD_BYTESWAP(bp) (BP_GET_BYTEORDER(bp) != ZFS_HOST_BYTEORDER) - -#define BP_SPRINTF_LEN 320 - -#endif /* _SYS_SPA_H */ diff --git a/usr/src/grub/grub-0.95/stage2/zfs-include/uberblock_impl.h b/usr/src/grub/grub-0.95/stage2/zfs-include/uberblock_impl.h deleted file mode 100644 index 9e70ac0a71..0000000000 --- a/usr/src/grub/grub-0.95/stage2/zfs-include/uberblock_impl.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, 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 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. - */ -/* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _SYS_UBERBLOCK_IMPL_H -#define _SYS_UBERBLOCK_IMPL_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * The uberblock version is incremented whenever an incompatible on-disk - * format change is made to the SPA, DMU, or ZAP. - * - * Note: the first two fields should never be moved. When a storage pool - * is opened, the uberblock must be read off the disk before the version - * can be checked. If the ub_version field is moved, we may not detect - * version mismatch. If the ub_magic field is moved, applications that - * expect the magic number in the first word won't work. - */ -#define UBERBLOCK_MAGIC 0x00bab10c /* oo-ba-bloc! */ -#define UBERBLOCK_SHIFT 10 /* up to 1K */ - -struct uberblock { - uint64_t ub_magic; /* UBERBLOCK_MAGIC */ - uint64_t ub_version; /* ZFS_VERSION */ - uint64_t ub_txg; /* txg of last sync */ - uint64_t ub_guid_sum; /* sum of all vdev guids */ - uint64_t ub_timestamp; /* UTC time of last sync */ - blkptr_t ub_rootbp; /* MOS objset_phys_t */ -}; - -#endif /* _SYS_UBERBLOCK_IMPL_H */ diff --git a/usr/src/grub/grub-0.95/stage2/zfs-include/vdev_impl.h b/usr/src/grub/grub-0.95/stage2/zfs-include/vdev_impl.h deleted file mode 100644 index 93c3689acb..0000000000 --- a/usr/src/grub/grub-0.95/stage2/zfs-include/vdev_impl.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, 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 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. - */ -/* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _SYS_VDEV_IMPL_H -#define _SYS_VDEV_IMPL_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#define VDEV_SKIP_SIZE (8 << 10) -#define VDEV_BOOT_HEADER_SIZE (8 << 10) -#define VDEV_PHYS_SIZE (112 << 10) -#define VDEV_UBERBLOCK_RING (128 << 10) - -/* ZFS boot block */ -#define VDEV_BOOT_MAGIC 0x2f5b007b10cULL -#define VDEV_BOOT_VERSION 1 /* version number */ - -typedef struct vdev_boot_header { - uint64_t vb_magic; /* VDEV_BOOT_MAGIC */ - uint64_t vb_version; /* VDEV_BOOT_VERSION */ - uint64_t vb_offset; /* start offset (bytes) */ - uint64_t vb_size; /* size (bytes) */ - char vb_pad[VDEV_BOOT_HEADER_SIZE - 4 * sizeof (uint64_t)]; -} vdev_boot_header_t; - -typedef struct vdev_phys { - char vp_nvlist[VDEV_PHYS_SIZE - sizeof (zio_block_tail_t)]; - zio_block_tail_t vp_zbt; -} vdev_phys_t; - -typedef struct vdev_label { - char vl_pad[VDEV_SKIP_SIZE]; /* 8K */ - vdev_boot_header_t vl_boot_header; /* 8K */ - vdev_phys_t vl_vdev_phys; /* 112K */ - char vl_uberblock[VDEV_UBERBLOCK_RING]; /* 128K */ -} vdev_label_t; /* 256K total */ - -/* - * Size and offset of embedded boot loader region on each label. - * The total size of the first two labels plus the boot area is 4MB. - */ -#define VDEV_BOOT_OFFSET (2 * sizeof (vdev_label_t)) -#define VDEV_BOOT_SIZE (7ULL << 19) /* 3.5M */ - -/* - * Size of label regions at the start and end of each leaf device. - */ -#define VDEV_LABEL_START_SIZE (2 * sizeof (vdev_label_t) + VDEV_BOOT_SIZE) -#define VDEV_LABEL_END_SIZE (2 * sizeof (vdev_label_t)) -#define VDEV_LABELS 4 - -#endif /* _SYS_VDEV_IMPL_H */ diff --git a/usr/src/grub/grub-0.95/stage2/zfs-include/zap_impl.h b/usr/src/grub/grub-0.95/stage2/zfs-include/zap_impl.h deleted file mode 100644 index 8ffd8c670d..0000000000 --- a/usr/src/grub/grub-0.95/stage2/zfs-include/zap_impl.h +++ /dev/null @@ -1,112 +0,0 @@ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, 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 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. - */ -/* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _SYS_ZAP_IMPL_H -#define _SYS_ZAP_IMPL_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#define ZAP_MAGIC 0x2F52AB2ABULL - -#define ZAP_HASHBITS 28 -#define MZAP_ENT_LEN 64 -#define MZAP_NAME_LEN (MZAP_ENT_LEN - 8 - 4 - 2) -#define MZAP_MAX_BLKSHIFT SPA_MAXBLOCKSHIFT -#define MZAP_MAX_BLKSZ (1 << MZAP_MAX_BLKSHIFT) - -typedef struct mzap_ent_phys { - uint64_t mze_value; - uint32_t mze_cd; - uint16_t mze_pad; /* in case we want to chain them someday */ - char mze_name[MZAP_NAME_LEN]; -} mzap_ent_phys_t; - -typedef struct mzap_phys { - uint64_t mz_block_type; /* ZBT_MICRO */ - uint64_t mz_salt; - uint64_t mz_pad[6]; - mzap_ent_phys_t mz_chunk[1]; - /* actually variable size depending on block size */ -} mzap_phys_t; - -/* - * The (fat) zap is stored in one object. It is an array of - * 1<= 6] [zap_leaf_t] [ptrtbl] ... - * - */ - -#define ZBT_LEAF ((1ULL << 63) + 0) -#define ZBT_HEADER ((1ULL << 63) + 1) -#define ZBT_MICRO ((1ULL << 63) + 3) -/* any other values are ptrtbl blocks */ - -/* - * the embedded pointer table takes up half a block: - * block size / entry size (2^3) / 2 - */ -#define ZAP_EMBEDDED_PTRTBL_SHIFT(zap) (FZAP_BLOCK_SHIFT(zap) - 3 - 1) - -/* - * The embedded pointer table starts half-way through the block. Since - * the pointer table itself is half the block, it starts at (64-bit) - * word number (1<zap_f.zap_phys) \ - [(idx) + (1<| - * |<-- dnode (192) --->|<----------- "bonus" buffer (320) ---------->| - * |<---- znode (264) ---->|<---- data (56) ---->| - * - * At present, we only use this space to store symbolic links. - */ -} znode_phys_t; - -#endif /* _SYS_FS_ZFS_ZNODE_H */ diff --git a/usr/src/grub/grub-0.95/stage2/zfs-include/zil.h b/usr/src/grub/grub-0.95/stage2/zfs-include/zil.h deleted file mode 100644 index 11ab4b5a3a..0000000000 --- a/usr/src/grub/grub-0.95/stage2/zfs-include/zil.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, 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 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. - */ -/* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _SYS_ZIL_H -#define _SYS_ZIL_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Intent log format: - * - * Each objset has its own intent log. The log header (zil_header_t) - * for objset N's intent log is kept in the Nth object of the SPA's - * intent_log objset. The log header points to a chain of log blocks, - * each of which contains log records (i.e., transactions) followed by - * a log block trailer (zil_trailer_t). The format of a log record - * depends on the record (or transaction) type, but all records begin - * with a common structure that defines the type, length, and txg. - */ - -/* - * Intent log header - this on disk structure holds fields to manage - * the log. All fields are 64 bit to easily handle cross architectures. - */ -typedef struct zil_header { - uint64_t zh_claim_txg; /* txg in which log blocks were claimed */ - uint64_t zh_replay_seq; /* highest replayed sequence number */ - blkptr_t zh_log; /* log chain */ - uint64_t zh_claim_seq; /* highest claimed sequence number */ - uint64_t zh_pad[5]; -} zil_header_t; - -#endif /* _SYS_ZIL_H */ diff --git a/usr/src/grub/grub-0.95/stage2/zfs-include/zio.h b/usr/src/grub/grub-0.95/stage2/zfs-include/zio.h deleted file mode 100644 index feb030b476..0000000000 --- a/usr/src/grub/grub-0.95/stage2/zfs-include/zio.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, 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 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. - */ -/* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _ZIO_H -#define _ZIO_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#define ZBT_MAGIC 0x210da7ab10c7a11ULL /* zio data bloc tail */ - -typedef struct zio_block_tail { - uint64_t zbt_magic; /* for validation, endianness */ - zio_cksum_t zbt_cksum; /* 256-bit checksum */ -} zio_block_tail_t; - -/* - * Gang block headers are self-checksumming and contain an array - * of block pointers. - */ -#define SPA_GANGBLOCKSIZE SPA_MINBLOCKSIZE -#define SPA_GBH_NBLKPTRS ((SPA_GANGBLOCKSIZE - \ - sizeof (zio_block_tail_t)) / sizeof (blkptr_t)) -#define SPA_GBH_FILLER ((SPA_GANGBLOCKSIZE - \ - sizeof (zio_block_tail_t) - \ - (SPA_GBH_NBLKPTRS * sizeof (blkptr_t))) /\ - sizeof (uint64_t)) - -#define ZIO_GET_IOSIZE(zio) \ - (BP_IS_GANG((zio)->io_bp) ? \ - SPA_GANGBLOCKSIZE : BP_GET_PSIZE((zio)->io_bp)) - -typedef struct zio_gbh { - blkptr_t zg_blkptr[SPA_GBH_NBLKPTRS]; - uint64_t zg_filler[SPA_GBH_FILLER]; - zio_block_tail_t zg_tail; -} zio_gbh_phys_t; - -enum zio_checksum { - ZIO_CHECKSUM_INHERIT = 0, - ZIO_CHECKSUM_ON, - ZIO_CHECKSUM_OFF, - ZIO_CHECKSUM_LABEL, - ZIO_CHECKSUM_GANG_HEADER, - ZIO_CHECKSUM_ZILOG, - ZIO_CHECKSUM_FLETCHER_2, - ZIO_CHECKSUM_FLETCHER_4, - ZIO_CHECKSUM_SHA256, - ZIO_CHECKSUM_FUNCTIONS -}; - -#define ZIO_CHECKSUM_ON_VALUE ZIO_CHECKSUM_FLETCHER_2 -#define ZIO_CHECKSUM_DEFAULT ZIO_CHECKSUM_ON - -enum zio_compress { - ZIO_COMPRESS_INHERIT = 0, - ZIO_COMPRESS_ON, - ZIO_COMPRESS_OFF, - ZIO_COMPRESS_LZJB, - ZIO_COMPRESS_EMPTY, - ZIO_COMPRESS_FUNCTIONS -}; - -#endif /* _ZIO_H */ diff --git a/usr/src/grub/grub-0.95/stage2/zfs-include/zio_checksum.h b/usr/src/grub/grub-0.95/stage2/zfs-include/zio_checksum.h deleted file mode 100644 index a8376d58e3..0000000000 --- a/usr/src/grub/grub-0.95/stage2/zfs-include/zio_checksum.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, 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 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. - */ -/* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _SYS_ZIO_CHECKSUM_H -#define _SYS_ZIO_CHECKSUM_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Signature for checksum functions. - */ -typedef void zio_checksum_t(const void *data, uint64_t size, zio_cksum_t *zcp); - -/* - * Information about each checksum function. - */ -typedef struct zio_checksum_info { - zio_checksum_t *ci_func[2]; /* checksum function for each byteorder */ - int ci_correctable; /* number of correctable bits */ - int ci_zbt; /* uses zio block tail? */ - char *ci_name; /* descriptive name */ -} zio_checksum_info_t; - -#endif /* _SYS_ZIO_CHECKSUM_H */ diff --git a/usr/src/grub/grub-0.95/stage2/zfs_fletcher.c b/usr/src/grub/grub-0.95/stage2/zfs_fletcher.c deleted file mode 100644 index 34a034efad..0000000000 --- a/usr/src/grub/grub-0.95/stage2/zfs_fletcher.c +++ /dev/null @@ -1,95 +0,0 @@ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, 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 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. - */ -/* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include "fsys_zfs.h" - - -void -fletcher_2_native(const void *buf, uint64_t size, zio_cksum_t *zcp) -{ - const uint64_t *ip = buf; - const uint64_t *ipend = ip + (size / sizeof (uint64_t)); - uint64_t a0, b0, a1, b1; - - for (a0 = b0 = a1 = b1 = 0; ip < ipend; ip += 2) { - a0 += ip[0]; - a1 += ip[1]; - b0 += a0; - b1 += a1; - } - - ZIO_SET_CHECKSUM(zcp, a0, a1, b0, b1); -} - -void -fletcher_2_byteswap(const void *buf, uint64_t size, zio_cksum_t *zcp) -{ - const uint64_t *ip = buf; - const uint64_t *ipend = ip + (size / sizeof (uint64_t)); - uint64_t a0, b0, a1, b1; - - for (a0 = b0 = a1 = b1 = 0; ip < ipend; ip += 2) { - a0 += BSWAP_64(ip[0]); - a1 += BSWAP_64(ip[1]); - b0 += a0; - b1 += a1; - } - - ZIO_SET_CHECKSUM(zcp, a0, a1, b0, b1); -} - -void -fletcher_4_native(const void *buf, uint64_t size, zio_cksum_t *zcp) -{ - const uint32_t *ip = buf; - const uint32_t *ipend = ip + (size / sizeof (uint32_t)); - uint64_t a, b, c, d; - - for (a = b = c = d = 0; ip < ipend; ip++) { - a += ip[0]; - b += a; - c += b; - d += c; - } - - ZIO_SET_CHECKSUM(zcp, a, b, c, d); -} - -void -fletcher_4_byteswap(const void *buf, uint64_t size, zio_cksum_t *zcp) -{ - const uint32_t *ip = buf; - const uint32_t *ipend = ip + (size / sizeof (uint32_t)); - uint64_t a, b, c, d; - - for (a = b = c = d = 0; ip < ipend; ip++) { - a += BSWAP_32(ip[0]); - b += a; - c += b; - d += c; - } - - ZIO_SET_CHECKSUM(zcp, a, b, c, d); -} diff --git a/usr/src/grub/grub-0.95/stage2/zfs_lzjb.c b/usr/src/grub/grub-0.95/stage2/zfs_lzjb.c deleted file mode 100644 index 22df6b2e39..0000000000 --- a/usr/src/grub/grub-0.95/stage2/zfs_lzjb.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, 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 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. - */ -/* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include "fsys_zfs.h" - -#define MATCH_BITS 6 -#define MATCH_MIN 3 -#define OFFSET_MASK ((1 << (16 - MATCH_BITS)) - 1) - - -/*ARGSUSED*/ -int -lzjb_decompress(void *s_start, void *d_start, size_t s_len, size_t d_len) -{ - uchar_t *src = s_start; - uchar_t *dst = d_start; - uchar_t *d_end = (uchar_t *)d_start + d_len; - uchar_t *cpy, copymap; - int copymask = 1 << (NBBY - 1); - - while (dst < d_end) { - if ((copymask <<= 1) == (1 << NBBY)) { - copymask = 1; - copymap = *src++; - } - if (copymap & copymask) { - int mlen = (src[0] >> (NBBY - MATCH_BITS)) + MATCH_MIN; - int offset = ((src[0] << NBBY) | src[1]) & OFFSET_MASK; - src += 2; - if ((cpy = dst - offset) < (uchar_t *)d_start) - return (-1); - while (--mlen >= 0 && dst < d_end) - *dst++ = *cpy++; - } else { - *dst++ = *src++; - } - } - return (0); -} diff --git a/usr/src/grub/grub-0.95/stage2/zfs_sha256.c b/usr/src/grub/grub-0.95/stage2/zfs_sha256.c deleted file mode 100644 index 393eaee05b..0000000000 --- a/usr/src/grub/grub-0.95/stage2/zfs_sha256.c +++ /dev/null @@ -1,126 +0,0 @@ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, 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 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. - */ -/* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include "fsys_zfs.h" - -/* - * SHA-256 checksum, as specified in FIPS 180-2, available at: - * http://csrc.nist.gov/cryptval - * - * This is a very compact implementation of SHA-256. - * It is designed to be simple and portable, not to be fast. - */ - -/* - * The literal definitions according to FIPS180-2 would be: - * - * Ch(x, y, z) (((x) & (y)) ^ ((~(x)) & (z))) - * Maj(x, y, z) (((x) & (y)) | ((x) & (z)) | ((y) & (z))) - * - * We use logical equivalents which require one less op. - */ -#define Ch(x, y, z) ((z) ^ ((x) & ((y) ^ (z)))) -#define Maj(x, y, z) (((x) & (y)) ^ ((z) & ((x) ^ (y)))) -#define Rot32(x, s) (((x) >> s) | ((x) << (32 - s))) -#define SIGMA0(x) (Rot32(x, 2) ^ Rot32(x, 13) ^ Rot32(x, 22)) -#define SIGMA1(x) (Rot32(x, 6) ^ Rot32(x, 11) ^ Rot32(x, 25)) -#define sigma0(x) (Rot32(x, 7) ^ Rot32(x, 18) ^ ((x) >> 3)) -#define sigma1(x) (Rot32(x, 17) ^ Rot32(x, 19) ^ ((x) >> 10)) - -static const uint32_t SHA256_K[64] = { - 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, - 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, - 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, - 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, - 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, - 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, - 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, - 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, - 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, - 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, - 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, - 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, - 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, - 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, - 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, - 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 -}; - -static void -SHA256Transform(uint32_t *H, const uint8_t *cp) -{ - uint32_t a, b, c, d, e, f, g, h, t, T1, T2, W[64]; - - for (t = 0; t < 16; t++, cp += 4) - W[t] = (cp[0] << 24) | (cp[1] << 16) | (cp[2] << 8) | cp[3]; - - for (t = 16; t < 64; t++) - W[t] = sigma1(W[t - 2]) + W[t - 7] + - sigma0(W[t - 15]) + W[t - 16]; - - a = H[0]; b = H[1]; c = H[2]; d = H[3]; - e = H[4]; f = H[5]; g = H[6]; h = H[7]; - - for (t = 0; t < 64; t++) { - T1 = h + SIGMA1(e) + Ch(e, f, g) + SHA256_K[t] + W[t]; - T2 = SIGMA0(a) + Maj(a, b, c); - h = g; g = f; f = e; e = d + T1; - d = c; c = b; b = a; a = T1 + T2; - } - - H[0] += a; H[1] += b; H[2] += c; H[3] += d; - H[4] += e; H[5] += f; H[6] += g; H[7] += h; -} - -void -zio_checksum_SHA256(const void *buf, uint64_t size, zio_cksum_t *zcp) -{ - uint32_t H[8] = { 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, - 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19 }; - uint8_t pad[128]; - int padsize = size & 63; - int i; - - for (i = 0; i < size - padsize; i += 64) - SHA256Transform(H, (uint8_t *)buf + i); - - for (i = 0; i < padsize; i++) - pad[i] = ((uint8_t *)buf)[i]; - - for (pad[padsize++] = 0x80; (padsize & 63) != 56; padsize++) - pad[padsize] = 0; - - for (i = 0; i < 8; i++) - pad[padsize++] = (size << 3) >> (56 - 8 * i); - - for (i = 0; i < padsize; i += 64) - SHA256Transform(H, pad + i); - - ZIO_SET_CHECKSUM(zcp, - (uint64_t)H[0] << 32 | H[1], - (uint64_t)H[2] << 32 | H[3], - (uint64_t)H[4] << 32 | H[5], - (uint64_t)H[6] << 32 | H[7]); -} diff --git a/usr/src/grub/grub-0.95/stamp-h.in b/usr/src/grub/grub-0.95/stamp-h.in deleted file mode 100644 index 9788f70238..0000000000 --- a/usr/src/grub/grub-0.95/stamp-h.in +++ /dev/null @@ -1 +0,0 @@ -timestamp diff --git a/usr/src/grub/grub-0.95/util/Makefile.am b/usr/src/grub/grub-0.95/util/Makefile.am deleted file mode 100644 index 2e04711357..0000000000 --- a/usr/src/grub/grub-0.95/util/Makefile.am +++ /dev/null @@ -1,12 +0,0 @@ -bin_PROGRAMS = mbchk -sbin_SCRIPTS = grub-install grub-md5-crypt grub-terminfo \ - grub-set-default -noinst_SCRIPTS = grub-image mkbimage - -EXTRA_DIST = mkbimage - -# XXX: Need to search for a header file in docs, because of multiboot.h. -AM_CFLAGS = -I$(top_srcdir)/lib -I$(top_srcdir)/docs - -mbchk_SOURCES = mbchk.c -mbchk_LDADD = ../lib/libcommon.a diff --git a/usr/src/grub/grub-0.95/util/Makefile.in b/usr/src/grub/grub-0.95/util/Makefile.in deleted file mode 100644 index 6beedf7759..0000000000 --- a/usr/src/grub/grub-0.95/util/Makefile.in +++ /dev/null @@ -1,478 +0,0 @@ -# Makefile.in generated by automake 1.8.5 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - - -SOURCES = $(mbchk_SOURCES) - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = .. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -host_triplet = @host@ -bin_PROGRAMS = mbchk$(EXEEXT) -subdir = util -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ - $(srcdir)/grub-image.in $(srcdir)/grub-install.in \ - $(srcdir)/grub-md5-crypt.in $(srcdir)/grub-set-default.in \ - $(srcdir)/grub-terminfo.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = grub-image grub-install grub-md5-crypt \ - grub-terminfo grub-set-default -am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(sbindir)" -binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) -PROGRAMS = $(bin_PROGRAMS) -am_mbchk_OBJECTS = mbchk.$(OBJEXT) -mbchk_OBJECTS = $(am_mbchk_OBJECTS) -mbchk_DEPENDENCIES = ../lib/libcommon.a -sbinSCRIPT_INSTALL = $(INSTALL_SCRIPT) -SCRIPTS = $(noinst_SCRIPTS) $(sbin_SCRIPTS) -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/mbchk.Po -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(mbchk_SOURCES) -DIST_SOURCES = $(mbchk_SOURCES) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BUILD_EXAMPLE_KERNEL_FALSE = @BUILD_EXAMPLE_KERNEL_FALSE@ -BUILD_EXAMPLE_KERNEL_TRUE = @BUILD_EXAMPLE_KERNEL_TRUE@ -CC = @CC@ -CCAS = @CCAS@ -CCASFLAGS = @CCASFLAGS@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DISKLESS_SUPPORT_FALSE = @DISKLESS_SUPPORT_FALSE@ -DISKLESS_SUPPORT_TRUE = @DISKLESS_SUPPORT_TRUE@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FSYS_CFLAGS = @FSYS_CFLAGS@ -GRUB_CFLAGS = @GRUB_CFLAGS@ -GRUB_LIBS = @GRUB_LIBS@ -HERCULES_SUPPORT_FALSE = @HERCULES_SUPPORT_FALSE@ -HERCULES_SUPPORT_TRUE = @HERCULES_SUPPORT_TRUE@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LTLIBOBJS = @LTLIBOBJS@ -MAINT = @MAINT@ -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ -MAKEINFO = @MAKEINFO@ -NETBOOT_DRIVERS = @NETBOOT_DRIVERS@ -NETBOOT_SUPPORT_FALSE = @NETBOOT_SUPPORT_FALSE@ -NETBOOT_SUPPORT_TRUE = @NETBOOT_SUPPORT_TRUE@ -NET_CFLAGS = @NET_CFLAGS@ -NET_EXTRAFLAGS = @NET_EXTRAFLAGS@ -OBJCOPY = @OBJCOPY@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -RANLIB = @RANLIB@ -SERIAL_SPEED_SIMULATION_FALSE = @SERIAL_SPEED_SIMULATION_FALSE@ -SERIAL_SPEED_SIMULATION_TRUE = @SERIAL_SPEED_SIMULATION_TRUE@ -SERIAL_SUPPORT_FALSE = @SERIAL_SUPPORT_FALSE@ -SERIAL_SUPPORT_TRUE = @SERIAL_SUPPORT_TRUE@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STAGE1_CFLAGS = @STAGE1_CFLAGS@ -STAGE2_CFLAGS = @STAGE2_CFLAGS@ -STRIP = @STRIP@ -VERSION = @VERSION@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_OBJCOPY = @ac_ct_OBJCOPY@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -sbin_SCRIPTS = grub-install grub-md5-crypt grub-terminfo \ - grub-set-default - -noinst_SCRIPTS = grub-image mkbimage -EXTRA_DIST = mkbimage - -# XXX: Need to search for a header file in docs, because of multiboot.h. -AM_CFLAGS = -I$(top_srcdir)/lib -I$(top_srcdir)/docs -mbchk_SOURCES = mbchk.c -mbchk_LDADD = ../lib/libcommon.a -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .o .obj -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu util/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu util/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -grub-image: $(top_builddir)/config.status $(srcdir)/grub-image.in - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ -grub-install: $(top_builddir)/config.status $(srcdir)/grub-install.in - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ -grub-md5-crypt: $(top_builddir)/config.status $(srcdir)/grub-md5-crypt.in - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ -grub-terminfo: $(top_builddir)/config.status $(srcdir)/grub-terminfo.in - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ -grub-set-default: $(top_builddir)/config.status $(srcdir)/grub-set-default.in - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ -install-binPROGRAMS: $(bin_PROGRAMS) - @$(NORMAL_INSTALL) - test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" - @list='$(bin_PROGRAMS)'; for p in $$list; do \ - p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ - if test -f $$p \ - ; then \ - f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ - echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ - $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ - else :; fi; \ - done - -uninstall-binPROGRAMS: - @$(NORMAL_UNINSTALL) - @list='$(bin_PROGRAMS)'; for p in $$list; do \ - f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ - echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ - rm -f "$(DESTDIR)$(bindir)/$$f"; \ - done - -clean-binPROGRAMS: - -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) -mbchk$(EXEEXT): $(mbchk_OBJECTS) $(mbchk_DEPENDENCIES) - @rm -f mbchk$(EXEEXT) - $(LINK) $(mbchk_LDFLAGS) $(mbchk_OBJECTS) $(mbchk_LDADD) $(LIBS) -install-sbinSCRIPTS: $(sbin_SCRIPTS) - @$(NORMAL_INSTALL) - test -z "$(sbindir)" || $(mkdir_p) "$(DESTDIR)$(sbindir)" - @list='$(sbin_SCRIPTS)'; for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - if test -f $$d$$p; then \ - f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \ - echo " $(sbinSCRIPT_INSTALL) '$$d$$p' '$(DESTDIR)$(sbindir)/$$f'"; \ - $(sbinSCRIPT_INSTALL) "$$d$$p" "$(DESTDIR)$(sbindir)/$$f"; \ - else :; fi; \ - done - -uninstall-sbinSCRIPTS: - @$(NORMAL_UNINSTALL) - @list='$(sbin_SCRIPTS)'; for p in $$list; do \ - f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \ - echo " rm -f '$(DESTDIR)$(sbindir)/$$f'"; \ - rm -f "$(DESTDIR)$(sbindir)/$$f"; \ - done - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mbchk.Po@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` -uninstall-info-am: - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(PROGRAMS) $(SCRIPTS) -installdirs: - for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(sbindir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-binPROGRAMS clean-generic mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: - -install-exec-am: install-binPROGRAMS install-sbinSCRIPTS - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-binPROGRAMS uninstall-info-am \ - uninstall-sbinSCRIPTS - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ - clean-generic ctags distclean distclean-compile \ - distclean-generic distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-binPROGRAMS \ - install-data install-data-am install-exec install-exec-am \ - install-info install-info-am install-man install-sbinSCRIPTS \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \ - tags uninstall uninstall-am uninstall-binPROGRAMS \ - uninstall-info-am uninstall-sbinSCRIPTS - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/usr/src/grub/grub-0.95/util/Makefile.solaris b/usr/src/grub/grub-0.95/util/Makefile.solaris deleted file mode 100644 index 4691dbfc55..0000000000 --- a/usr/src/grub/grub-0.95/util/Makefile.solaris +++ /dev/null @@ -1,81 +0,0 @@ -# -# Copyright 2005 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# ident "%Z%%M% %I% %E% SMI" -# -include ../../Makefile.grub -include ../Makefile.solaris.defs - - -INCLUDES = -I. -I.. -I../lib -I../docs -LIBCOMMON = ../lib/libcommon.a - -# Build these only if the OPTION_UTILS on is on (blank). -$(OPTION_UTILS)PROGRAMS = mbchk - - -# Build these only if the OPTION_UTILS on is on (blank). -# Will be installed. -$(OPTION_UTILS)INSTALL_SCRIPTS = grub-install \ - grub-md5-crypt \ - grub-set-default \ - grub-terminfo -# Won't be installed. -$(OPTION_UTILS)NOINSTALL_SCRIPTS = grub-image - -SCRIPTS = $(INSTALL_SCRIPTS) $(NOINSTALL_SCRIPTS) - - -INSTALL_BINDIR = $(ROOT_PLAT_GRUB)/bin -INSTALL_SBINDIR = $(ROOT_PLAT_GRUB)/sbin - -INSTALL_TARGETS = $(PROGRAMS:%=$(INSTALL_BINDIR)/%) \ - $(INSTALL_SCRIPTS:%=$(INSTALL_SBINDIR)/%) - -$(INSTALL_BINDIR)/% := FILEMODE = 0555 -$(INSTALL_SBINDIR)/% := FILEMODE = 0555 - -# -# Source files to be installed in $(SRC_DIR). -# -SRC_DIR = $(ROOT_SRC)/util -SRC_FILES = Makefile.am Makefile.in grub-image.in grub-install.in \ - grub-md5-crypt.in grub-set-default.in grub-terminfo.in \ - mbchk.c mkbimage - -INSTALL_TARGETS += $(SRC_FILES:%=$(SRC_DIR)/%) - - -all: $(PROGRAMS) $(SCRIPTS) - -$(PROGRAMS): $$@.o - $(RM) $@ - $(LINK) -o $@ $@.o $(LIBCOMMON) - -$(SCRIPTS): $$@.in ../config.status.solaris - cd .. && ./config.status.solaris util/$@ - - -install: all $(INSTALL_TARGETS) - -$(INSTALL_BINDIR)/%: $(INSTALL_BINDIR) % - $(INS.file) - -$(INSTALL_SBINDIR)/%: $(INSTALL_SBINDIR) % - $(INS.file) - -$(SRC_DIR)/%: $(SRC_DIR) % - $(INS.file) - -$(INSTALL_BINDIR) $(INSTALL_SBINDIR) $(SRC_DIR): - $(INS.dir) - - -clean: _FORCE - $(RM) *.o $(NOINSTALL_SCRIPTS) - -clobber: clean - $(RM) $(PROGRAMS) $(INSTALL_SCRIPTS) - -_FORCE: diff --git a/usr/src/grub/grub-0.95/util/grub-image.in b/usr/src/grub/grub-0.95/util/grub-image.in deleted file mode 100644 index ea632505fb..0000000000 --- a/usr/src/grub/grub-0.95/util/grub-image.in +++ /dev/null @@ -1,138 +0,0 @@ -#! /bin/sh -# grub-image - Create a GRUB boot filesystem image and tarball -# Gordon Matzigkeit , 2000-07-25 -# -# Copyright (C) 2000, 2002 Free Software Foundation, Inc. -# -# This file 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. - -prefix=@prefix@ -exec_prefix=@exec_prefix@ -sbindir=@sbindir@ -libdir=@libdir@ -PACKAGE=@PACKAGE@ -host_cpu=@host_cpu@ -host_os=@host_os@ -host_vendor=@host_vendor@ -context=${host_cpu}-${host_vendor} -pkglibdir=${libdir}/${PACKAGE}/${context} - -mke2fs=`which mke2fs` - -progname=`echo "$0" | sed 's%^.*/%%'` -thisdir=`echo "$0" | sed 's%/[^/]*$%%'` -test "X$thisdir" = "X$0" && thisdir=. - -# See if we were invoked from within the build directory, and if so, -# use the built files rather than the installed ones. -if test -f $thisdir/../stage2/stage2; then - grub_shell="$thisdir/../grub/grub" - stage1dir="$thisdir/../stage1" - stage2dir="$thisdir/../stage2" -else - grub_shell=${sbindir}/grub - stage1dir="$pkglibdir" - stage2dir="$pkglibdir" -fi - -# Exit on any error. -set -e - -# Get GRUB's version from the Grub shell, since we use the -# installed files. -VERSION=`$grub_shell --version | sed -e 's/^.* \([0-9.]*\).*$/\1/'` -test "X$VERSION" != X - -bootdir=${PACKAGE}-${VERSION}-${context} -image=$bootdir.ext2fs - -# Create the tarball. -if test ! -f $bootdir.tar.gz; then - echo "# Creating \`$bootdir.tar.gz'" - mkdir -p $bootdir/boot/grub - cp -p $stage1dir/stage1 $stage2dir/*_stage1_5 $stage2dir/stage2 \ - $bootdir/boot/grub - test ! -f menu.lst || cp -p menu.lst $bootdir/boot/grub - trap "rm -f $bootdir.tar.gz" 0 - GZIP=-9 tar -zcf $bootdir.tar.gz $bootdir - trap '' 0 - rm -rf $bootdir -fi - -# Create a new filesystem image of the specified size. -if test ! -f $image; then - tarsize=`zcat $bootdir.tar.gz | wc -c` - - # Add about 30% (20% overhead plus 10% breathing room), and convert - # to kilobytes. This factor was determined empirically. - SIZE=`expr $tarsize \* 130 / 100 / 1024`k - echo "# Creating $SIZE disk image \`$image'" - trap "rm -f $image" 0 - dd if=/dev/zero of=$image bs=$SIZE count=1 >/dev/null - $mke2fs -F $image - trap '' 0 -fi - - -# Attempt to mount the image. -echo "# Mounting \`$image'" -test -d $bootdir || mkdir $bootdir -case "$host_os" in -gnu*) - settrans -a $bootdir /hurd/ext2fs $image - umount="settrans -a $bootdir" - ;; - -linux*) - # This requires running as root, and using the loop device. - i=0 - while test -e /dev/loop$i; do - if /sbin/losetup /dev/loop$i $image; then - break - fi - i=`expr $i + 1` - done - - # Silly losetup doesn't report an error! - mount /dev/loop$i $bootdir - umount="umount $bootdir && /sbin/losetup -d /dev/loop$i && trap '' 0" - ;; - -*) - echo "$progname: Mounting \`$image' under \`$host_os' is not supported" 1>&2 - exit 1 - ;; -esac -trap "$umount" 0 - -# Extract our tarball into the image, then unmount it. -echo "# Copying files into \`$image':" -tar -zxvf $bootdir.tar.gz - -echo "# \`$image' usage:" -df $bootdir -eval $umount -rmdir $bootdir || : - -# Use the GRUB shell to properly set up GRUB on the image. -echo "# Installing GRUB in \`$image'" -cat <. -EOF -} - -# Usage: convert os_device -# Convert an OS device to the corresponding GRUB drive. -# This part is OS-specific. -convert () { - # First, check if the device file exists. - if test -e "$1"; then - : - else - echo "$1: Not found or not a block device." 1>&2 - exit 1 - fi - - # Break the device name into the disk part and the partition part. - case "$host_os" in - linux*) - tmp_disk=`echo "$1" | sed -e 's%\([sh]d[a-z]\)[0-9]*$%\1%' \ - -e 's%\(d[0-9]*\)p[0-9]*$%\1%' \ - -e 's%\(fd[0-9]*\)$%\1%' \ - -e 's%/part[0-9]*$%/disc%' \ - -e 's%\(c[0-7]d[0-9]*\).*$%\1%'` - tmp_part=`echo "$1" | sed -e 's%.*/[sh]d[a-z]\([0-9]*\)$%\1%' \ - -e 's%.*d[0-9]*p%%' \ - -e 's%.*/fd[0-9]*$%%' \ - -e 's%.*/floppy/[0-9]*$%%' \ - -e 's%.*/\(disc\|part\([0-9]*\)\)$%\2%' \ - -e 's%.*c[0-7]d[0-9]*p%%'` - ;; - gnu*) - tmp_disk=`echo "$1" | sed 's%\([sh]d[0-9]*\).*%\1%'` - tmp_part=`echo "$1" | sed "s%$tmp_disk%%"` ;; - freebsd* | kfreebsd*-gnu) - tmp_disk=`echo "$1" | sed 's%r\{0,1\}\([saw]d[0-9]*\).*$%r\1%' \ - | sed 's%r\{0,1\}\(da[0-9]*\).*$%r\1%'` - tmp_part=`echo "$1" \ - | sed "s%.*/r\{0,1\}[saw]d[0-9]\(s[0-9]*[a-h]\)%\1%" \ - | sed "s%.*/r\{0,1\}da[0-9]\(s[0-9]*[a-h]\)%\1%"` - ;; - netbsd* | knetbsd*-gnu) - tmp_disk=`echo "$1" | sed 's%r\{0,1\}\([sw]d[0-9]*\).*$%r\1d%' \ - | sed 's%r\{0,1\}\(fd[0-9]*\).*$%r\1a%'` - tmp_part=`echo "$1" \ - | sed "s%.*/r\{0,1\}[sw]d[0-9]\([abe-p]\)%\1%"` - ;; - *) - echo "grub-install does not support your OS yet." 1>&2 - exit 1 ;; - esac - - # Get the drive name. - tmp_drive=`grep -v '^#' $device_map | grep "$tmp_disk *$" \ - | sed 's%.*\(([hf]d[0-9][a-g0-9,]*)\).*%\1%'` - - # If not found, print an error message and exit. - if test "x$tmp_drive" = x; then - echo "$1 does not have any corresponding BIOS drive." 1>&2 - exit 1 - fi - - if test "x$tmp_part" != x; then - # If a partition is specified, we need to translate it into the - # GRUB's syntax. - case "$host_os" in - linux*) - echo "$tmp_drive" | sed "s%)$%,`expr $tmp_part - 1`)%" ;; - gnu*) - if echo $tmp_part | grep "^s" >/dev/null; then - tmp_pc_slice=`echo $tmp_part \ - | sed "s%s\([0-9]*\)[a-g]*$%\1%"` - tmp_drive=`echo "$tmp_drive" \ - | sed "s%)%,\`expr "$tmp_pc_slice" - 1\`)%"` - fi - if echo $tmp_part | grep "[a-g]$" >/dev/null; then - tmp_bsd_partition=`echo "$tmp_part" \ - | sed "s%[^a-g]*\([a-g]\)$%\1%"` - tmp_drive=`echo "$tmp_drive" \ - | sed "s%)%,$tmp_bsd_partition)%"` - fi - echo "$tmp_drive" ;; - freebsd* | kfreebsd*-gnu) - if echo $tmp_part | grep "^s" >/dev/null; then - tmp_pc_slice=`echo $tmp_part \ - | sed "s%s\([0-9]*\)[a-h]*$%\1%"` - tmp_drive=`echo "$tmp_drive" \ - | sed "s%)%,\`expr "$tmp_pc_slice" - 1\`)%"` - fi - if echo $tmp_part | grep "[a-h]$" >/dev/null; then - tmp_bsd_partition=`echo "$tmp_part" \ - | sed "s%s\{0,1\}[0-9]*\([a-h]\)$%\1%"` - tmp_drive=`echo "$tmp_drive" \ - | sed "s%)%,$tmp_bsd_partition)%"` - fi - echo "$tmp_drive" ;; - netbsd* | knetbsd*-gnu) - if echo $tmp_part | grep "^[abe-p]$" >/dev/null; then - tmp_bsd_partition=`echo "$tmp_part" \ - | sed "s%\([a-p]\)$%\1%"` - tmp_drive=`echo "$tmp_drive" \ - | sed "s%)%,$tmp_bsd_partition)%"` - fi - echo "$tmp_drive" ;; - esac - else - # If no partition is specified, just print the drive name. - echo "$tmp_drive" - fi -} - -# Usage: resolve_symlink file -# Find the real file/device that file points at -resolve_symlink () { - tmp_fname=$1 - # Resolve symlinks - while test -L $tmp_fname; do - tmp_new_fname=`ls -al $tmp_fname | sed -n 's%.*-> \(.*\)%\1%p'` - if test -z "$tmp_new_fname"; then - echo "Unrecognized ls output" 2>&1 - exit 1 - fi - - # Convert relative symlinks - case $tmp_new_fname in - /*) tmp_fname="$tmp_new_fname" - ;; - *) tmp_fname="`echo $tmp_fname | sed 's%/[^/]*$%%'`/$tmp_new_fname" - ;; - esac - done - echo "$tmp_fname" -} - -# Usage: find_device file -# Find block device on which the file resides. -find_device () { - # For now, this uses the program `df' to get the device name, but is - # this really portable? - tmp_fname=`df $1/ | sed -n 's%.*\(/dev/[^ ]*\).*%\1%p'` - - if test -z "$tmp_fname"; then - echo "Could not find device for $1" 2>&1 - exit 1 - fi - - tmp_fname=`resolve_symlink $tmp_fname` - - echo "$tmp_fname" -} - -# Check the arguments. -for option in "$@"; do - case "$option" in - -h | --help) - usage - exit 0 ;; - -v | --version) - echo "grub-install (GNU GRUB ${VERSION})" - exit 0 ;; - --root-directory=*) - rootdir=`echo "$option" | sed 's/--root-directory=//'` ;; - --grub-shell=*) - grub_shell=`echo "$option" | sed 's/--grub-shell=//'` ;; - --no-floppy) - no_floppy="--no-floppy" ;; - --force-lba) - force_lba="--force-lba" ;; - --recheck) - recheck=yes ;; - # This is an undocumented feature... - --debug) - debug=yes ;; - -*) - echo "Unrecognized option \`$option'" 1>&2 - usage - exit 1 - ;; - *) - if test "x$install_device" != x; then - echo "More than one install_devices?" 1>&2 - usage - exit 1 - fi - install_device="${option}" ;; - esac -done - -if test "x$install_device" = x; then - echo "install_device not specified." 1>&2 - usage - exit 1 -fi - -# If the debugging feature is enabled, print commands. -if test $debug = yes; then - set -x -fi - -# Initialize these directories here, since ROOTDIR was initialized. -case "$host_os" in -netbsd* | openbsd*) - # Because /boot is used for the boot block in NetBSD and OpenBSD, use /grub - # instead of /boot/grub. - grub_prefix=/grub - bootdir=${rootdir} - ;; -*) - # Use /boot/grub by default. - bootdir=${rootdir}/boot - ;; -esac - -grubdir=${bootdir}/grub -device_map=${grubdir}/device.map - -# Check if GRUB is installed. -# This is necessary, because the user can specify "grub --read-only". -set $grub_shell dummy -if test -f "$1"; then - : -else - echo "$1: Not found." 1>&2 - exit 1 -fi - -if test -f "$pkglibdir/stage1"; then - : -else - echo "${pkglibdir}/stage1: Not found." 1>&2 - exit 1 -fi - -if test -f "$pkglibdir/stage2"; then - : -else - echo "${pkglibdir}/stage2: Not found." 1>&2 - exit 1 -fi - -# Don't check for *stage1_5, because it is not fatal even if any -# Stage 1.5 does not exist. - -# Create the GRUB directory if it is not present. -test -d "$bootdir" || mkdir "$bootdir" || exit 1 -test -d "$grubdir" || mkdir "$grubdir" || exit 1 - -# If --recheck is specified, remove the device map, if present. -if test $recheck = yes; then - rm -f $device_map -fi - -# Create the device map file if it is not present. -if test -f "$device_map"; then - : -else - # Create a safe temporary file. - test -n "$mklog" && log_file=`$mklog` - - $grub_shell --batch $no_floppy --device-map=$device_map <$log_file -quit -EOF - if grep "Error [0-9]*: " $log_file >/dev/null; then - cat $log_file 1>&2 - exit 1 - fi - - rm -f $log_file -fi - -# Make sure that there is no duplicated entry. -tmp=`sed -n '/^([fh]d[0-9]*)/s/\(^(.*)\).*/\1/p' $device_map \ - | sort | uniq -d | sed -n 1p` -if test -n "$tmp"; then - echo "The drive $tmp is defined multiple times in the device map $device_map" 1>&2 - exit 1 -fi - -# Check for INSTALL_DEVICE. -case "$install_device" in -/dev/*) - install_device=`resolve_symlink "$install_device"` - install_drive=`convert "$install_device"` - # I don't know why, but some shells wouldn't die if exit is - # called in a function. - if test "x$install_drive" = x; then - exit 1 - fi ;; -\([hf]d[0-9]*\)) - install_drive="$install_device" ;; -[hf]d[0-9]*) - # The GRUB format with no parenthesis. - install_drive="($install_device)" ;; -*) - echo "Format of install_device not recognized." 1>&2 - usage - exit 1 ;; -esac - -# Get the root drive. -root_device=`find_device ${rootdir}` -bootdir_device=`find_device ${bootdir}` - -# Check if the boot directory is in the same device as the root directory. -if test "x$root_device" != "x$bootdir_device"; then - # Perhaps the user has a separate boot partition. - root_device=$bootdir_device - grub_prefix="/grub" -fi - -# Convert the root device to a GRUB drive. -root_drive=`convert "$root_device"` -if test "x$root_drive" = x; then - exit 1 -fi - -# Check if the root directory exists in the same device as the grub -# directory. -grubdir_device=`find_device ${grubdir}` - -if test "x$grubdir_device" != "x$root_device"; then - # For now, cannot deal with this situation. - cat <&2 -You must set the root directory by the option --root-directory, because -$grubdir does not exist in the root device $root_device. -EOF - exit 1 -fi - -# Copy the GRUB images to the GRUB directory. -for file in ${grubdir}/stage1 ${grubdir}/stage2 ${grubdir}/*stage1_5; do - rm -f $file || exit 1 -done -for file in \ - ${pkglibdir}/stage1 ${pkglibdir}/stage2 ${pkglibdir}/*stage1_5; do - cp -f $file ${grubdir} || exit 1 -done - -# Make a default file. -${grub_set_default} --root-directory=${rootdir} default - -# Make sure that GRUB reads the same images as the host OS. -test -n "$mkimg" && img_file=`$mkimg` -test -n "$mklog" && log_file=`$mklog` - -for file in ${grubdir}/stage1 ${grubdir}/stage2 ${grubdir}/*stage1_5; do - count=5 - tmp=`echo $file | sed "s|^${grubdir}|${grub_prefix}|"` - while test $count -gt 0; do - $grub_shell --batch $no_floppy --device-map=$device_map <$log_file -dump ${root_drive}${tmp} ${img_file} -quit -EOF - if grep "Error [0-9]*: " $log_file >/dev/null; then - : - elif cmp $file $img_file >/dev/null; then - break - fi - sleep 1 - count=`expr $count - 1` - done - if test $count -eq 0; then - echo "The file $file not read correctly." 1>&2 - exit 1 - fi -done - -rm -f $img_file -rm -f $log_file - -# Create a safe temporary file. -test -n "$mklog" && log_file=`$mklog` - -# Now perform the installation. -$grub_shell --batch $no_floppy --device-map=$device_map <$log_file -root $root_drive -setup $force_lba --stage2=$grubdir/stage2 --prefix=$grub_prefix $install_drive -quit -EOF - -if grep "Error [0-9]*: " $log_file >/dev/null || test $debug = yes; then - cat $log_file 1>&2 - exit 1 -fi - -rm -f $log_file - -# Prompt the user to check if the device map is correct. -echo "Installation finished. No error reported." -echo "This is the contents of the device map $device_map." -echo "Check if this is correct or not. If any of the lines is incorrect," -echo "fix it and re-run the script \`grub-install'." -echo - -cat $device_map - -# Bye. -exit 0 diff --git a/usr/src/grub/grub-0.95/util/grub-md5-crypt.in b/usr/src/grub/grub-0.95/util/grub-md5-crypt.in deleted file mode 100644 index c030c87930..0000000000 --- a/usr/src/grub/grub-0.95/util/grub-md5-crypt.in +++ /dev/null @@ -1,99 +0,0 @@ -#! /bin/sh - -# Encrypt a password in MD5 format -# Copyright (C) 2000,2002 Free Software Foundation, Inc. -# -# This file 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. - -# Replaced by the configure script. -prefix=@prefix@ -exec_prefix=@exec_prefix@ -sbindir=@sbindir@ - -# Initialize some variables. -grub_shell=${sbindir}/grub -progname="grub-md5-crypt" - -# Check the arguments. -for option in "$@"; do - case "$option" in - -h | --help) - cat <. -EOF - exit 0 - ;; - - -v | --version) - echo "$progname (GNU GRUB ${VERSION})" - exit 0 - ;; - - --grub-shell=*) - grub_shell=`echo "$option" | sed 's/--grub-shell=//'` - ;; - - *) - echo "$progname: unrecognized option \`$option'" - echo "Usage: $progname [OPTION]" - echo "Try \`$progname --help' for more information." - exit 1 - ;; - esac -done - -# Suppress echo backs. I don't know if this is really portable. -okuji -stty -echo - -# Prompt to enter a password. -echo -n "Password: " -read -r password -echo - -# One more time. -echo -n "Retype password: " -read -r password2 -echo - -# Resume echo backs. -stty echo - -if test "x$password" = x; then - echo "Empty password is not permitted." - exit 1 -fi - -if test "x$password" != "x$password2"; then - echo "Sorry, passwords do not match." - exit 1 -fi - -# Run the grub shell. -$grub_shell --batch --device-map=/dev/null <. -EOF -} - -# Check the arguments. -for option in "$@"; do - case "$option" in - -h | --help) - usage - exit 0 ;; - -v | --version) - echo "grub-set-default (GNU GRUB ${VERSION})" - exit 0 ;; - --root-directory=*) - rootdir=`echo "$option" | sed 's/--root-directory=//'` ;; - -*) - echo "Unrecognized option \`$option'" 1>&2 - usage - exit 1 - ;; - *) - if test "x$entry" != x; then - echo "More than one entries?" 1>&2 - usage - exit 1 - fi - # We don't care about what the user specified actually. - entry="${option}" ;; - esac -done - -if test "x$entry" = x; then - echo "entry not specified." 1>&2 - usage - exit 1 -fi - -# Determine the GRUB directory. This is different among OSes. -grubdir=${rootdir}/boot/grub -if test -d ${grubdir}; then - : -else - grubdir=${rootdir}/grub - if test -d ${grubdir}; then - : - else - echo "No GRUB directory found under ${rootdir}/" 1>&2 - exit 1 - fi -fi - -file=${grubdir}/default -if test -f ${file}; then - chmod 0600 ${file} - rm -f ${file} -fi -cat < $file -$entry -# -# -# -# -# -# -# -# -# -# -# WARNING: If you want to edit this file directly, do not remove any line -# from this file, including this warning. Using \`grub-set-default\' is -# strongly recommended. -EOF - -# Bye. -exit 0 diff --git a/usr/src/grub/grub-0.95/util/grub-terminfo.in b/usr/src/grub/grub-0.95/util/grub-terminfo.in deleted file mode 100644 index e41b41836c..0000000000 --- a/usr/src/grub/grub-0.95/util/grub-terminfo.in +++ /dev/null @@ -1,95 +0,0 @@ -#! /bin/sh -# Generate a terminfo command from a terminfo name. -# -# Copyright (C) 2002 Free Software Foundation, Inc. -# -# This file 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. - -VERSION=@VERSION@ - -usage () { - cat <. -EOF -} - -error () { - echo "grub-terminfo: error: $1" 1>&2 -} - -termname= - -for option in "$@"; do - case "$option" in - -h | --help) - usage - exit 0 ;; - -v | --version) - echo "grub-terminfo (GNU GRUB ${VERSION})" - exit 0 ;; - -*) - error "Unrecognized option \`$option'" - usage - exit 1 ;; - *) - if test "x$termname" != x; then - error "More than one terminfo names?" - usage - exit 1 - fi - termname="$option" ;; - esac -done - -if test "x$termname" = x; then - error "termname not specified" - usage - exit 1 -fi - -get_seq () { - infocmp -L -1 -g $termname | sed -n -e "/$1/s/^[^=]*=\\(.*\\),\$/\\1/p" -} - -cursor_address="`get_seq cursor_address`" -if test "x$cursor_address" = x; then - error "cursor_address not found" - exit 1 -fi -cursor_address="--cursor-address=$cursor_address" - -clear_screen="`get_seq clear_screen`" -if test "x$clear_screen" != x; then - clear_screen="--clear-screen=$clear_screen" -fi - -enter_standout_mode="`get_seq enter_standout_mode`" -if test "x$enter_standout_mode" != x; then - enter_standout_mode="--enter-standout-mode=$enter_standout_mode" -fi - -exit_standout_mode="`get_seq exit_standout_mode`" -if test "x$exit_standout_mode" != x; then - exit_standout_mode="--exit-standout-mode=$exit_standout_mode" -fi - -echo "terminfo --name=$termname" $cursor_address $clear_screen \ - $enter_standout_mode $exit_standout_mode diff --git a/usr/src/grub/grub-0.95/util/mbchk.c b/usr/src/grub/grub-0.95/util/mbchk.c deleted file mode 100644 index fd71858279..0000000000 --- a/usr/src/grub/grub-0.95/util/mbchk.c +++ /dev/null @@ -1,244 +0,0 @@ -/* mbchk - a simple checker for the format of a Multiboot kernel */ -/* - * Copyright (C) 1999,2001,2002 Free Software Foundation, 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 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 - -#include -#include -#include -#include - -static int quiet = 0; -static char *optstring = "hvq"; -static struct option longopts[] = -{ - {"help", no_argument, 0, 'h'}, - {"version", no_argument, 0, 'v'}, - {"quiet", no_argument, 0, 'q'}, - {0} -}; - -static void -usage (int status) -{ - if (status) - fprintf (stderr, "Try ``mbchk --help'' for more information.\n"); - else - printf ("Usage: mbchk [OPTION]... [FILE]...\n" - "Check if the format of FILE complies with the Multiboot Specification.\n" - "\n" - "-q, --quiet suppress all normal output\n" - "-h, --help display this help and exit\n" - "-v, --version output version information and exit.\n" - "\n" - "Report bugs to .\n"); - - exit (status); -} - -static int -check_multiboot (const char *filename, FILE *fp) -{ - multiboot_header_t *mbh = 0; - int i; - char buf[8192]; - - if (fread (buf, 1, 8192, fp) < 0) - { - fprintf (stderr, "%s: Read error.\n", filename); - return 0; - } - - for (i = 0; i < 8192 - sizeof (multiboot_header_t); i++) - { - unsigned long magic = *((unsigned long *) (buf + i)); - - if (magic == MULTIBOOT_HEADER_MAGIC) - { - mbh = (multiboot_header_t *) (buf + i); - break; - } - } - - if (! mbh) - { - fprintf (stderr, "%s: No Multiboot header.\n", filename); - return 0; - } - - if (! quiet) - printf ("%s: The Multiboot header is found at the offset %d.\n", - filename, i); - - /* Check for the checksum. */ - if (mbh->magic + mbh->flags + mbh->checksum != 0) - { - fprintf (stderr, - "%s: Bad checksum (0x%lx).\n", - filename, mbh->checksum); - return 0; - } - - /* Reserved flags must be zero. */ - if (mbh->flags & ~0x00010003) - { - fprintf (stderr, - "%s: Non-zero is found in reserved flags (0x%lx).\n", - filename, mbh->flags); - return 0; - } - - if (! quiet) - { - printf ("%s: Page alignment is turned %s.\n", - filename, (mbh->flags & 0x1)? "on" : "off"); - printf ("%s: Memory information is turned %s.\n", - filename, (mbh->flags & 0x2)? "on" : "off"); - printf ("%s: Address fields is turned %s.\n", - filename, (mbh->flags & 0x10000)? "on" : "off"); - } - - /* Check for the address fields. */ - if (mbh->flags & 0x10000) - { - if (mbh->header_addr < mbh->load_addr) - { - fprintf (stderr, - "%s: header_addr is less than " - "load_addr (0x%lx > 0x%lx).\n", - filename, mbh->header_addr, mbh->load_addr); - return 0; - } - - if (mbh->load_end_addr && mbh->load_addr >= mbh->load_end_addr) - { - fprintf (stderr, - "%s: load_addr is not less than load_end_addr" - " (0x%lx >= 0x%lx).\n", - filename, mbh->load_addr, mbh->load_end_addr); - return 0; - } - - if (mbh->bss_end_addr && mbh->load_end_addr > mbh->bss_end_addr) - { - fprintf (stderr, - "%s: load_end_addr is greater than bss_end_addr" - " (0x%lx > 0x%lx).\n", - filename, mbh->load_end_addr, mbh->bss_end_addr); - return 0; - } - - if (mbh->load_addr > mbh->entry_addr) - { - fprintf (stderr, - "%s: load_addr is greater than entry_addr" - " (0x%lx > 0x%lx).\n", - filename, mbh->load_addr, mbh->entry_addr); - return 0; - } - - /* FIXME: It is better to check if the entry address is within the - file, especially when the load end address is zero. */ - if (mbh->load_end_addr && mbh->load_end_addr <= mbh->entry_addr) - { - fprintf (stderr, - "%s: load_end_addr is not greater than entry_addr" - " (0x%lx <= 0x%lx).\n", - filename, mbh->load_end_addr, mbh->entry_addr); - return 0; - } - - /* This is a GRUB-specific limitation. */ - if (mbh->load_addr < 0x100000) - { - fprintf (stderr, - "%s: Cannot be loaded at less than 1MB by GRUB" - " (0x%lx).\n", - filename, mbh->load_addr); - return 0; - } - } - - if (! quiet) - printf ("%s: All checks passed.\n", filename); - - return 1; -} - -int -main (int argc, char *argv[]) -{ - int c; - - do - { - c = getopt_long (argc, argv, optstring, longopts, 0); - switch (c) - { - case EOF: - break; - - case 'h': - usage (0); - break; - - case 'v': - printf ("mbchk (GNU GRUB " VERSION ")\n"); - exit (0); - break; - - case 'q': - quiet = 1; - break; - - default: - usage (1); - break; - } - } - while (c != EOF); - - if (optind < argc) - { - while (optind < argc) - { - FILE *fp; - - fp = fopen (argv[optind], "r"); - if (! fp) - { - fprintf (stderr, "%s: No such file.\n", argv[optind]); - exit (1); - } - - if (! check_multiboot (argv[optind], fp)) - exit (1); - - fclose (fp); - optind++; - } - } - else - { - if (! check_multiboot ("", stdin)) - exit (1); - } - - return 0; -} diff --git a/usr/src/grub/grub-0.95/util/mkbimage b/usr/src/grub/grub-0.95/util/mkbimage deleted file mode 100644 index 689f694abf..0000000000 --- a/usr/src/grub/grub-0.95/util/mkbimage +++ /dev/null @@ -1,417 +0,0 @@ -#!/bin/sh -# MaKe a Bootable IMAGE --- 1.44, 2.88 and El Torito no-emulation mode -# C) 2001,2002,2003 Thierry Laronde -# C) 2001,2002,2003 Robert Millan - - -# 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. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, you can either send email to this -# program's maintainer or write to: The Free Software Foundation, -# Inc.; 59 Temple Place, Suite 330; Boston, MA 02111-1307, USA. - -# $Id: mkbimage,v 1.19 2004/07/21 14:43:04 robertmh Exp $ - -# Global variables -tarfile= -dir= -fs= #file system type -decompress= -image_type= -uname=`uname -s` -PATH=/sbin:$PATH - -# You can set GRUB_PATH if you need to use a specially located GRUB. -# This MUST end by a '/'! - - -#----------------------------DON'T CHANGE: INTERNALS - -block_size=512 -cylinders= -heads= -sectors= -cyl_size= -type_option= -geo_option= -image= -bk_120=$((2 * 15 * 80)) -bk_144=$((2 * 18 * 80)) -bk_288=$((2 * 36 * 80)) -bk_160=$((2 * 20 * 80)) -bk_168=$((2 * 21 * 80)) -bk_174=$((2 * 21 * 83)) -lo_options= -device_map= -mkfs_options= -debug= -stage2_os_name= - -# Name by which this script was invoked. -program=`echo "$0" | sed -e 's/[^\/]*\///g'` -version_number='$Revision: 1.19 $' - -usage=" -Usage: $program [-hVF] [-t TYPE] [-d DIRECTORY] [-s FS_TYPE] -f TAR_FILE -Make a Bootable IMAGE using GRUB as a bootloader - -Options: - Actions: - -d DIRECTORY [default CWD] - Directory where the boot.image and the partition subdirectories - are/will be created - -f TAR_FILE - Name of the tar file containing the filesystem to install. Can - be a pure tar file [.tar] or a compressed tar file - [.tar.gz|.tar.bz2] - -s FS_TYPE - Type of the file system to create on the virtual disk. Choices - are: - ext2 on GNU [default is ext2] - ext2, minix or msdos on GNU/Linux [default is ext2] - - -t TYPE - Type of the image to create. Choices are '1.20', '1.44', '1.60', - '1.68', '1.74', '2.88' or 'hd' [default is hd] - -F - Force to set the set_dpt flag (unnecessary 99% of the time! Be - careful! - Informations: - -D - turn Debugging on [xtrace] - -h|--help - display this Help and exit - -V|--version - display Version information and exit - -Copyright (c) 2001,2002,2003 Thierry Laronde . -Copyright (c) 2001,2002 Robert Millan . -GPLed." - -version="mkbimage $version_number - -Written by Thierry Laronde and Robert Millan. - -Copyright (c) 2001,2002,2003 Thierry Laronde . -Copyright (c) 2001,2002,2003 Robert Millan . - -This is free software under the GPL version 2 or later; see the source for -copying conditions. There is NO warranty, not even for MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE." - -# Functions - -error () -{ - case $1 in - bug) echo "This is a bug!"; - echo "$usage";; - option) echo "Unknow option"; echo "$usage";; - missing_argument) echo "You must give an argument to the option!"; - echo "$usage";; - missing_option) echo "You must indicate at least one option!"; - echo "$usage";; - must_be_root) echo "You must be root! (or install e2tools/mtools)";; - unknown_fs) if [ $uname = Linux ]; - then echo "The GNU/Linux supported fs are: ext2, minix or msdos!"; - elif [ $uname = GNU ]; - then echo "The GNU supported fs is ext2!"; - fi;; - unknown_format) echo "The tar file must be .tar|.tar.gz|.tar.bz2!";; - wont_fit) echo "The files won't fit on the selected type of media!";; - wrong_directory) echo "Directory inexistant or not given!"; - echo "$usage";; - wrong_file) echo "File inexistant or empty!"; - echo "$usage";; - wrong_type) echo "The type specified is not a valid one!"; - echo "$usage";; - esac - exit 1 -} - -# create a filesystem of type $fs in $image with offset $offset -mkbimage_mkfs () -{ - case $offset in - 0) lo_options="";; - *) lo_options="-o $offset";; - esac - - if [ "$offset" = "0" ] ; then - mkfs.$fs -F $image - elif [ `id -u` = "0" ] ; then - losetup $lo_options /dev/loop1 $image - mkfs.$fs /dev/loop1 - losetup -d /dev/loop1 - else - error must_be_root - fi -} - -# copy ${image}1/* to ${image}:/, assuming ${image} contains a filesystem -# of type $fs in offset $offset -mkbimage_cp () -{ - case $offset in - 0) lo_options="";; - *) lo_options="-o $offset";; - esac - case $fs in - ext2) - cp="e2cp"; - mkdir="e2mkdir";; - vfat) - cp="mcopy"; - mkdir="mmd";; - *) - cp=""; - mkdir="";; - esac - - if [ "$offset" = 0 ] && which $cp > /dev/null ; then - for dir in $(cd ${image}1 && find -type d) ; do - $mkdir ${image}:$dir - done - for file in $(cd ${image}1 && find -type f) ; do - $cp ${image}1/$file ${image}:$file - done - elif [ "`id -u`" = "0" ] ; then - losetup $lo_options /dev/loop1 $image - mkdir ${image}.mnt - mount -t $fs /dev/loop1 ${image}.mnt - cp -a ${image}1/* ${image}.mnt/ && sync - umount ${image}.mnt - rmdir ${image}.mnt - losetup -d /dev/loop1 - else - error must_be_root - fi -} - -#********************************************************************** -# MAIN PROGRAM * -#********************************************************************** - -#---------------------- Getting the options - -[ $# -eq 0 ] && error missing_option; - -while [ $# -gt 0 ]; do - case "$1" in - -d) shift; - dir="$1"; - [ ! -d "$1" ] && error wrong_directory;; - -f) shift; - tarfile="$1"; - [ -z "$tarfile" ] && error missing_argument;; - -s) shift; - fs="$1";; - -t) shift; - image_type="$1";; - -F) geo_option="-F";; - -D) debug="-v"; - set -x;; - -h|--help) echo "$usage"; exit 0;; - -V|--version) echo "$version"; exit 0;; - *) error option ;; - esac -shift -done -#---------------------- Sanity checks -[ ! "$tarfile" ] && error missing_argument; -[ ! -s "$tarfile" ] && error wrong_file; - -if [ ! "$image_type" ]; then - image_type=hd; -elif [ "$image_type" != "1.20" ] && [ "$image_type" != "1.44" ] \ - && [ "$image_type" != "1.60" ] && [ "$image_type" != "1.68" ] \ - && [ "$image_type" != "2.88" ] && [ "$image_type" != "1.74" ] \ - && [ "$image_type" != "hd" ] && [ "$image_type" != "1.60" ] ; then - error wrong_type ; -fi - -[ ! "$fs" ] && fs=ext2 - -# Carlo Contavalli reported that I [TL] have forgotten to specify the -# partition ID for sfdisk to correctly fill the partition table (ext2 is the -# default on Linux, so this worked in this case...). This is fixed below. -case "$fs" in - ext2) mkfs_options="-m 0"; - part_id="83";; # This is the default -# ufs) if [ $uname = Linux ]; -# then error unknown_fs; -# fi;; - minix) if [ $uname = GNU ]; - then error unknown_fs; - else - mkfs_options="-v"; # Minix version 2 - part_id="81"; - fi;; - msdos) if [ $uname = GNU ]; - then error unknown_fs; - else - mkfs_options="-f 1 -F 12"; # the smallest... - part_id="1"; - fi;; - *) error unknown_fs;; -esac - -# What type of tar file has been given ? - -suffix=`echo "$tarfile" | sed -n 's/^.*\.\([targbz2]\{2,3\}\)$/\1/p'` -case "$suffix" in - tar) decompress="cat";; - gz) decompress="gunzip -c";; - bz2) decompress="bunzip2 -c";; - *) error unknown_format;; -esac -#---------------------- Initializations - -[ ! "$dir" ] && dir=`pwd` - -image=$dir/$image_type.image -device_map=$dir/device.map - -# First, find the size of the tar file in block_size. -file_size=`$decompress $tarfile | wc -c | tr -d ' '` -file_size=$(($file_size / $block_size + 1)) - -# Increase in order to be sure that with a fs there will be enough -# room (trying 110%) -file_size=$(($file_size + $file_size / 10)) - -case "$image_type" in - hd) heads=16; - sectors=63; - cyl_size=$((16 * 63)); - # Create the minimum number of cylinders. At the moment, we leave - # some space by rounding everything up by adding 1 cylinder, plus - # another one for MBR + reserved track. - cylinders=$(($file_size / $cyl_size + 2));; - 1.20) [ $file_size -ge $bk_120 ] && error wont_fit; - heads=2; - sectors=15; - cyl_size=$((2 * 15)); - cylinders=80;; - 1.44) [ $file_size -ge $bk_144 ] && error wont_fit; - heads=2; - sectors=18; - cyl_size=$((2 * 18)); - cylinders=80;; - 1.60) [ $file_size -ge $bk_160 ] && error wont_fit; - heads=2; - sectors=20; - cyl_size=$((2 * 20)); - cylinders=80; - geo_option="-F";; - 1.68) [ $file_size -ge $bk_168 ] && error wont_fit; - heads=2; - sectors=21; - cyl_size=$((2 * 21)); - cylinders=80;; - 1.74) [ $file_size -ge $bk_174 ] && error wont_fit; - heads=2; - sectors=21; - cyl_size=$((2 * 21)); - cylinders=83;; - 2.88) [ $file_size -ge $bk_288 ] && error wont_fit; - heads=2; - sectors=36; - cyl_size=$((2 * 36)); - cylinders=80;; - *) error bug;; -esac - -type_option="-t $image_type" - -# We start by creating a virtual disk which size is the number of -# cylinders of $cyl_size mandatory to put the files stocked in the $tarfile -# Create the empty virtual disk -dd if=/dev/zero of=$image bs=$block_size count=$(($cyl_size * $cylinders)) - -# We then format the virtual disk -# NOTE: the El Torito specification wants only one partition. So we -# create the first, and the remaining 3 entries are empty. - -if [ "$image_type" = "hd" ]; then - sfdisk -C $cylinders -H $heads -S $sectors -D $image<$device_map -$device ${image} -EOT - -${GRUB_PATH}grub --device-map=$device_map --batch<.image of=/dev/fd0[u] bs=512 - -will be more than enough... if you have formated the floppy correctly -using \`superformat' to be found in \`fdutils' package. - -For El Torito floppy emulation : - -mkisofs -b -c boot.catalog -o raw.iso

- -And for El Torito Hard Disk emulation: - -mkisofs -b -hard-disk-boot -c boot.catalog -o raw.iso - -Enjoy! -EOF - -rm -rf ${image}1 - -exit 0 diff --git a/usr/src/grub/grub-0.97/AUTHORS b/usr/src/grub/grub-0.97/AUTHORS new file mode 100644 index 0000000000..e319d15ef6 --- /dev/null +++ b/usr/src/grub/grub-0.97/AUTHORS @@ -0,0 +1,63 @@ + +ZFS support added by Sun Microsystems. +Copyright 2007 Sun Microsystems, Inc. All rights reserved. +Use is subject to license terms. + +VaX#n8 (real name unknown) wrote shared_src/fsys_ext2fs.c. + +Heiko Schroeder rewrote shared_src/stage1.S to be more readable. + +Solaris VTOC and UFS support added by Sun Microsystems. +Copyright 2005 Sun Microsystems, Inc. All rights reserved. +Use is subject to license terms. + +The following authors assigned copyright on their work to the Free +Software Foundation: + +Erich Stefan Boleyn originally designed and implemented GRUB. + +Gordon Matzigkeit adopted GRUB into the GNU Project. He fixed several +bugs, added symbolic link support to shared_src/fsys_ext2fs.c, and +began the implementation of /sbin/grub. He was an official maintainer. + +Yoshinori K. Okuji contributed many bugfixes and new features, such as +working LBA support, /sbin/grub support for configuration files, the +script /sbin/grub-install, the utility /bin/mbchk, the new engine for +builtin commands, disk swapping support, keyboard configuration support, +network support, online help support, command-line history support, +hidden menu support, the new Linux loader, serial terminal support, +single-line editing support, the utility /sbin/grub-md5-crypt, the new +GRUB manual, and several new commands. He is the current official +maintainer. + +Peter Astrand added support for a color menu. + +Pavel Roskin contributed many bugfixes and new features, such as FreeBSD +support for the grub shell, and configure process cleanups. + +Klaus Reichl wrote stage2/fsys_minix.c. + +Per Lundberg added graphics support to the Multiboot Specification. + +Jochen Hoenicke rewrote stage2/fsys_fat.c and wrote +stage2/fsys_reiserfs.c and stage2/md5.c. + +Christoph Plattner added support for Net Boot Image Proposal. + +Frank Mehnert added support for hercules console. + +Kristoffer Branemyr added VSTa filesystem support. + +Serguei Tzukanov added JFS and XFS support. + +Jason Thomas added Linux DAC960 support and support for hiding/unhiding +logical partitions, and did a significant bugfix for the terminal stuff. + +Tilmann Bubeck added support for vt100-incompatible terminals. + +KB Sriram added a better detection of FAT filesystem and fixed a +network device completion. + +Eric Kvaalen fixed a lot of problems in the GRUB manual. + +Leonid Lisovskiy added El Torito support. diff --git a/usr/src/grub/grub-0.97/BUGS b/usr/src/grub/grub-0.97/BUGS new file mode 100644 index 0000000000..14c1f72eae --- /dev/null +++ b/usr/src/grub/grub-0.97/BUGS @@ -0,0 +1,7 @@ +See the Bug Tracking System for GNU GRUB on Savannah. The URL is: + +http://savannah.gnu.org/bugs/?group_id=68 (without SSL) + +or + +https://savannah.gnu.org/bugs/?group_id=68 (with SSL) diff --git a/usr/src/grub/grub-0.97/COPYING b/usr/src/grub/grub-0.97/COPYING new file mode 100644 index 0000000000..eeb586b392 --- /dev/null +++ b/usr/src/grub/grub-0.97/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program 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. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public 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. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) 19yy + + 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 + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/usr/src/grub/grub-0.97/COPYING.descrip b/usr/src/grub/grub-0.97/COPYING.descrip new file mode 100644 index 0000000000..f54810961d --- /dev/null +++ b/usr/src/grub/grub-0.97/COPYING.descrip @@ -0,0 +1 @@ +GRUB SOFTWARE diff --git a/usr/src/grub/grub-0.97/ChangeLog b/usr/src/grub/grub-0.97/ChangeLog new file mode 100644 index 0000000000..7659cfaae8 --- /dev/null +++ b/usr/src/grub/grub-0.97/ChangeLog @@ -0,0 +1,9234 @@ +2004-10-11 Jason Thomas + Patch from Stefanus Du Toit + * docs/kernel.c.texi (cmain): Incremement mod by one, instead of + sizeof(module_t), since it's already a pointer of type module_t. + * docs/kernel.c (cmain): Do the same. + +2004-09-20 Yoshinori K. Okuji + + * docs/internals.texi (Internals): Changed to an appendix. + + * docs/grub.texi (@setchapternewpage): Changed to odd from off. + (@contents): Moved to the beginning. + (Future): Changed to an appendix. + +2004-08-17 Yoshinori K. Okuji + + * stage2/cmdline.c (run_script): Fix a reversed conditional. + Reported by Alban Crequy . + +2004-08-07 Jason Thomas + + From Michael Hohnbaum : + * stage2/fsys_ext2fs.c (ext2fs_read): Handle sparse files. + +2004-07-24 Yoshinori K. Okuji + + * stage2/stage2.c (cmain): Terminate DEFAULT_FILE with NUL + correctly. Reported by Alban Crequy . + +2004-07-21 Robert Millan + + Patch from David Weinehall + * util/mkbimage: Fix XSI-isms (for supporting POSIX-only shells). + +2004-07-20 Robert Millan + + * util/grub-install.in: Detect GNU/k*BSD systems as well. + +2004-07-16 Yoshinori K. Okuji + + * util/grub-install.in (convert): Fix the sed statement for + Linux. The expression was ambigious in some cases. + +2004-06-29 Robert Millan + + * util/grub-set-default.in: Fix minor syntax error (non-escaped + characters). + +2004-06-24 Robert Millan + + Fixes for FHS compliance. (/usr/share is for arch-independant data) + * stage1/Makefile.am: Move stage files to pkglibdir. + * stage2/Makefile.am: Likewise. + * docs/grub.texi: s,/usr/share,/usr/lib,g. + * util/grub-image.in: Look for stage files in pkglibdir. + * util/grub-install.in: Likewise. + + * util/grub-install.in: Improve usage message. + +2004-06-20 Yoshinori K. Okuji + + This is a big change on saving a default entry. This change + makes it possible to set up a quite robust system using GRUB. + Now we do not use the second sector of Stage 2 to store an + entry number but use the file /boot/grub/default. This file + must be generated by grub-set-default, although this file is + plain-text. + + * util/grub-set-default.in: New file. + + * util/grub-install.in (grub_set_default): New variable. + Use /grub instead of /boot/grub on OpenBSD as well as NetBSD. + Run grub-set-default to make a default file. + + * util/Makefile.am (sbin_SCRIPTS): Added grub-set-default. + + * stage2/stage2.c (run_menu): Change the fallback handling to + support multiple fallback entries. + (cmain): Likewise. Also, get a saved entry from a default file + if possible, before reading a config file. + + * stage2/shared.h (DEFAULT_FILE_BUF): New macro. + (DEFAULT_FILE_BUFLEN): Likewise. + (CMDLINE_BUF): Set to DEFAULT_FILE_BUF + DEFAULT_FILE_BUFLEN. + (MENU_BUFLEN): Set to 0x8000 + PASSWORD_BUF - MENU_BUF. + (fallback_entry): Removed. + (fallback_entries): Declared. + (fallback_entryno): Likewise. + (MAX_FALLBACK_ENTRIES): New macro. + + * stage2/cmdline.c (run_script): Use FALLBACK_ENTRYNO instead of + FALLBACK_ENTRY. + + * stage2/builtins.c (fallback_entry): Removed. + (fallback_entryno): New variable. + (fallback_entries): Likewise. + (init_config): Initialize FALLBACK_ENTRYNO and FALLBACK_ENTRIES. + (fallback_func): Rewritten completely. + (savedefault_func): Likewise. + + * docs/grub.texi (grub-set-default): New direntry. + (Installation): Describe grub-set-default for manual + installations. + (Making your system robust): New section. + (Booting once-only): New subsection. + (Booting fallback systems): Likewise. + (fallback): Describe multiple fallback entries. + (savedefault): Describe an optional argument. + (Invoking grub-set-default): New chapter. + (Future): Replaced with a description about GRUB 2. + + * configure.ac (AC_CONFIG_FILES): Added util/grub-set-default. + +2004-06-19 Yoshinori K. Okuji + + * stage2/ufs2.h (int8_t): Renamed to ... + (grub_uint8_t): ... this. + (int16_t): Renamed to ... + (grub_int16_t): ... this. + (int32_t): Renamed to ... + (grub_int32_t): ... this. + (int64_t): Renamed to ... + (grub_int64_t): ... this. + (uint8_t): Renamed to ... + (grub_uint8_t): ... this. + (uint16_t): Renamed to ... + (grub_uint16_t): ... this. + (uint32_t): Renamed to ... + (grub_uint32_t): ... this. + (uint64_t): Renamed to ... + (grub_uint64_t): ... this. + (u_char): Renamed to ... + (grub_u_char): ... this. + (u_int): Renamed to ... + (grub_u_int): ... this. + (u_int8_t): Renamed to ... + (grub_u_int8_t): ... this. + (u_int16_t): Renamed to ... + (grub_u_int16_t): ... this. + (u_int32_t): Renamed to ... + (grub_u_int32_t): ... this. + (u_int64_t): Renamed to ... + (grub_u_int64_t): ... this. + (ino_t): Renamed to ... + (grub_ino_t): ... this. + All callers are changed. + +2004-06-14 Jeroen Dekkers + + * stage2/ufs2.h (__uint8_t): Remove. + (__uint16_t): Likewise. + (__uint32_t): Likewise. + (__uint64_t): Likewise. + (ino_t): Typedef to uint32_t. + +2004-06-13 Yoshinori K. Okuji + + * stage2/Makefile.am (noinst_HEADERS): Added ufs2.h. + +2005-05-08 Yoshinori K. Okuji + + * configure.ac (AC_INIT): Upgraded to 0.97. + + * compile: Copied from Automake 1.9.4. + * config.guess: Likewise. + * config.sub: Likewise. + * depcomp: Likewise. + * install-sh: Likewise. + * missing: Likewise. + * mkinstalldirs: Likewise. + * mdate-sh: Likewise. + * docs/texinfo.tex: Likewise. + +2005-05-08 Yoshinori K. Okuji + + * stage2/fsys_xfs.c (next_dentry): Use arrays of arrays instead of + arrays of pointers for USUAL, to avoid read-only strings. Reported + by Sven Wegener . + +2005-03-28 Yoshinori K. Okuji + + * lib/device.c (get_drive_geometry): Use ST.ST_SIZE instead of + ST.ST_BLOCKS to get the total number of sectors, because st_blocks + is not the same if it is a sparse file. + +2005-03-19 Yoshinori K. Okuji + + * stage2/stage2.c (cmain): Initialize DEFAULT_FILE to an empty + string. Reported by NATORI Shin . + +2005-03-15 Yoshinori K. Okuji + + * stage2/fsys_fat.c (fat_mount): Ignore the 3rd bit of a media + descriptor, because some BIOSes overwrite this value, according + to the storage mode (e.g. USB Floppy or USB HDD). + +2005-02-16 Yoshinori K. Okuji + + * grub/asmstub.c (grub_stage2): Remove the attribute `volatile' + from doit. I hope this change is safe for all compilers. + +2005-02-15 Yoshinori K. Okuji + + * stage2/builtins.c (install_func): If DEST_DRIVE is a hard + disk, enable the workaround in Stage 1 by replacing the jmp + with double nop's. + + * stage1/stage1.h (STAGE1_BOOT_DRIVE_CHECK): New macro. + (STAGE1_BOOT_DRIVE_MASK): Removed. + + * stage1/stage1.S (boot_drive_check): New label. This implements + a different workaround for buggy BIOSes which don't pass boot + drive correctly. This is effective for BIOSes which pass a value + without the seventh bit (0x80). + (boot_drive_mask): Removed. + +2005-02-03 Yoshinori K. Okuji + + * grub/asmstub.c (console_current_color): Make it global as + declared. + (grub_stage2): Tweak the declaration and the definition of the + nested function doit. + +2005-02-02 Yoshinori K. Okuji + + * stage2/smp-imps.h (imps_any_new_apics): Removed. + (imps_enabled): Likewise. + (imps_lapic_addr): Likewise. + (imps_num_cpus): Likewise. + (imps_cpu_apic_map): Likewise. + (imps_apic_cpu_map): Likewise. + + * stage2/Makefile.am (libgrub_a_CFLAGS): Remove + -fwritable-strings. Not required for the grub shell actually. + + * grub/Makefile.am (AM_CFLAGS): Likewise. + +2005-02-01 Yoshinori K. Okuji + + * grub/asmstub.c (grub_stage2): Use auto instead of static for + nested functions. + + * stage2/char_io.c (memcheck) [GRUB_UTIL]: Likewise. + + * stage2/builtins.c (blocklist_func): Likewise. + (color_func): Likewise. + (install_func): Likewise. + (setkey_func): Likewise. + + * lib/device.c (read_device_map): Likewise. + +2005-01-30 Yoshinori K. Okuji + + * configure.ac (AC_INIT): Upgraded to 0.96. + +2004-10-11 Jason Thomas + + Patch from Stefanus Du Toit + * docs/kernel.c.texi (cmain): Incremement mod by one, instead of + sizeof(module_t), since it's already a pointer of type module_t. + * docs/kernel.c (cmain): Do the same. + +2004-09-20 Yoshinori K. Okuji + + * docs/internals.texi (Internals): Changed to an appendix. + + * docs/grub.texi (@setchapternewpage): Changed to odd from off. + (@contents): Moved to the beginning. + (Future): Changed to an appendix. + +2004-08-17 Yoshinori K. Okuji + + * stage2/cmdline.c (run_script): Fix a reversed conditional. + Reported by Alban Crequy . + +2004-08-07 Jason Thomas + + From Michael Hohnbaum : + * stage2/fsys_ext2fs.c (ext2fs_read): Handle sparse files. + +2004-07-24 Yoshinori K. Okuji + + * stage2/stage2.c (cmain): Terminate DEFAULT_FILE with NUL + correctly. Reported by Alban Crequy . + +2004-07-21 Robert Millan + + Patch from David Weinehall + * util/mkbimage: Fix XSI-isms (for supporting POSIX-only shells). + +2004-07-20 Robert Millan + + * util/grub-install.in: Detect GNU/k*BSD systems as well. + +2004-07-16 Yoshinori K. Okuji + + * util/grub-install.in (convert): Fix the sed statement for + Linux. The expression was ambigious in some cases. + +2004-06-29 Robert Millan + + * util/grub-set-default.in: Fix minor syntax error (non-escaped + characters). + +2004-06-24 Robert Millan + + Fixes for FHS compliance. (/usr/share is for arch-independant data) + * stage1/Makefile.am: Move stage files to pkglibdir. + * stage2/Makefile.am: Likewise. + * docs/grub.texi: s,/usr/share,/usr/lib,g. + * util/grub-image.in: Look for stage files in pkglibdir. + * util/grub-install.in: Likewise. + + * util/grub-install.in: Improve usage message. + +2004-06-20 Yoshinori K. Okuji + + This is a big change on saving a default entry. This change + makes it possible to set up a quite robust system using GRUB. + Now we do not use the second sector of Stage 2 to store an + entry number but use the file /boot/grub/default. This file + must be generated by grub-set-default, although this file is + plain-text. + + * util/grub-set-default.in: New file. + + * util/grub-install.in (grub_set_default): New variable. + Use /grub instead of /boot/grub on OpenBSD as well as NetBSD. + Run grub-set-default to make a default file. + + * util/Makefile.am (sbin_SCRIPTS): Added grub-set-default. + + * stage2/stage2.c (run_menu): Change the fallback handling to + support multiple fallback entries. + (cmain): Likewise. Also, get a saved entry from a default file + if possible, before reading a config file. + + * stage2/shared.h (DEFAULT_FILE_BUF): New macro. + (DEFAULT_FILE_BUFLEN): Likewise. + (CMDLINE_BUF): Set to DEFAULT_FILE_BUF + DEFAULT_FILE_BUFLEN. + (MENU_BUFLEN): Set to 0x8000 + PASSWORD_BUF - MENU_BUF. + (fallback_entry): Removed. + (fallback_entries): Declared. + (fallback_entryno): Likewise. + (MAX_FALLBACK_ENTRIES): New macro. + + * stage2/cmdline.c (run_script): Use FALLBACK_ENTRYNO instead of + FALLBACK_ENTRY. + + * stage2/builtins.c (fallback_entry): Removed. + (fallback_entryno): New variable. + (fallback_entries): Likewise. + (init_config): Initialize FALLBACK_ENTRYNO and FALLBACK_ENTRIES. + (fallback_func): Rewritten completely. + (savedefault_func): Likewise. + + * docs/grub.texi (grub-set-default): New direntry. + (Installation): Describe grub-set-default for manual + installations. + (Making your system robust): New section. + (Booting once-only): New subsection. + (Booting fallback systems): Likewise. + (fallback): Describe multiple fallback entries. + (savedefault): Describe an optional argument. + (Invoking grub-set-default): New chapter. + (Future): Replaced with a description about GRUB 2. + + * configure.ac (AC_CONFIG_FILES): Added util/grub-set-default. + +2004-06-19 Yoshinori K. Okuji + + * stage2/ufs2.h (int8_t): Renamed to ... + (grub_uint8_t): ... this. + (int16_t): Renamed to ... + (grub_int16_t): ... this. + (int32_t): Renamed to ... + (grub_int32_t): ... this. + (int64_t): Renamed to ... + (grub_int64_t): ... this. + (uint8_t): Renamed to ... + (grub_uint8_t): ... this. + (uint16_t): Renamed to ... + (grub_uint16_t): ... this. + (uint32_t): Renamed to ... + (grub_uint32_t): ... this. + (uint64_t): Renamed to ... + (grub_uint64_t): ... this. + (u_char): Renamed to ... + (grub_u_char): ... this. + (u_int): Renamed to ... + (grub_u_int): ... this. + (u_int8_t): Renamed to ... + (grub_u_int8_t): ... this. + (u_int16_t): Renamed to ... + (grub_u_int16_t): ... this. + (u_int32_t): Renamed to ... + (grub_u_int32_t): ... this. + (u_int64_t): Renamed to ... + (grub_u_int64_t): ... this. + (ino_t): Renamed to ... + (grub_ino_t): ... this. + All callers are changed. + +2004-06-14 Jeroen Dekkers + + * stage2/ufs2.h (__uint8_t): Remove. + (__uint16_t): Likewise. + (__uint32_t): Likewise. + (__uint64_t): Likewise. + (ino_t): Typedef to uint32_t. + +2004-06-13 Yoshinori K. Okuji + + * stage2/Makefile.am (noinst_HEADERS): Added ufs2.h. + +2004-06-13 Yoshinori K. Okuji + + * configure.ac (AC_INIT): Upgraded to 0.95. + +2004-05-23 Yoshinori K. Okuji + + * stage2/char_io.c (grub_isspace): Use a switch sentense instead + of an if sentense, because that reduces the size. + + * lib/device.c (read_device_map): Change the max number of DRIVE + to 127 from 8. This was too strict. + + * stage2/asm.S (stop_floppy): Call pusha and popa outside the + block of real mode code. Reported by Guillem Jover + . + +2004-05-20 Damian Ivereigh + + * netboot/main.c: Fixed bootp only code so that options + work properly. This fix is obvious when compared with the + DHCP code. + +2004-05-17 Pavel Roskin + + * stage2/char_io.c (safe_parse_maxint): Disable for stage 1.5. + (grub_tolower): Disable for stage 1.5 except fat_stage1_5. + (grub_memcmp): Disable for stage 1.5 except iso9660_stage1_5. + +2004-05-14 Yoshinori K. Okuji + + From Sergey Matveychuk : + * stage2/size_test: Added a check for ufs2_stage1_5. + + * stage2/shared.h (STAGE2_ID_UFS2_STAGE1_5): New macro. + [FSYS_UFS2] (STAGE2_ID): Set to STAGE2_ID_UFS2_STAGE1_5. + + * stage2/filesys.h (FSYS_UFS2_NUM): New macro. + [FSYS_UFS2] (ufs2_mount): New prototype. + [FSYS_UFS2] (ufs2_read): Likewise. + [FSYS_UFS2] (ufs2_dir): Likewise. + [FSYS_UFS2] (ufs2_embed): Likewise. + (NUM_FSYS): Added FSYS_UFS2_NUM. + + * stage2/disk_io.c (fsys_table): Added an ufs2 entry. + + * stage2/builtins.c (setup_func): Added ufs2 into the + STAGE1_5_MAP. + + * stage2/Makefile.am (libgrub_a_SOURCES): Added fsys_ufs2.c. + (libgrub_a_CFLAGS): Added -DFSYS_UFS2=1. + (pkgdata_DATA): Added ufs2_stage1_5. + (noinst_PROGRAMS): Added ufs2_stage1_5.exec. + (ufs2_stage1_5_exec_SOURCES): New variable. + (ufs2_stage1_5_exec_CFLAGS): Likewise. + (ufs2_stage1_5_exec_CCASFLAGS): Likewise. + (ufs2_stage1_5_exec_LDFLAGS): Likewise. + + * grub/Makefile.am (AM_CPPFLAGS): Added -DFSYS_ISO9660=1, + -DFSYS_JFS=1, -DFSYS_REISERFS=1, -DFSYS_UFS2=1, -DFSYS_VSTAFS=1, + -DFSYS_XFS=1, and -DUSE_MD5_PASSWORDS=1. + + * configure.ac (--disable-ufs2): New option. + + * stage2/fsys_ufs2.c: New file. + * stage2/ufs2.h: Likewise. + +2004-05-10 Robert Millan + + * lib/device.c: Mangle __FreeBSD_* macro usage to support + kFreeBSD-based non-FreeBSD systems (i.e. GNU/kFreeBSD). + + Implement runtime detection of version of kFreeBSD. Now if + we build against kFreeBSD 5.x headers the GRUB shell will work on + both 4.x and 5.x. + + Replace `u_int_t' types with portable `unsigned int' and old + reference to `geometry' structure to new `geom' one. + + * docs/menu.lst: Split GNU/kFreeBSD and GNU/kNetBSD as separate + options than FreeBSD and NetBSD, respectively. There are minor + differences now (different paths). + +2004-05-03 Pavel Roskin + + * stage2/char_io.c (convert_to_ascii): Remove "%b" support. + It's non-standard and is not used anymore. + (grub_printf): Likewise. + +2004-04-29 Robert Millan + + From Yann Dirson : + * util/mkbimage: Misc syntax fixes. + +2004-04-29 Jeroen Dekkers + + * stage2/char_io.c (grub_memcmp): Define for stage1.5 too. + + * stage2/fsys_iso9660.c (iso9660_mount): Use memcmp() instead of + __builtin_memcmp(). + (iso9660_dir): Likewise. + +2004-04-26 Christian Jones + + * docs/grub.texi (Making a GRUB bootable CD-ROM): minor edits, + including a few compatibility notes and a change to + -boot-load-size 4 for the mkisofs command. + +2004-04-22 Jeroen Dekkers + + * Makefile.am (AUTOMAKE_OPTIONS): Add "gnu". + * configure.ac: Update to work with automake 1.8, quote all + AC_DEFUN's correctly and provide descriptions for AC_DEFINE's. + * acinclude.m4: Likewise. + * acconfig.h: Removed. + + * stage1/Makefile.am (.exec): Use suffix rules instead of pattern + rules. + * stage2/Makefile.am (.exec): Likewise. + +2004-04-18 Yoshinori K. Okuji + + * docs/grub.texi (Making a GRUB bootable CD-ROM): New section. + + * stage2/disk_io.c (set_device): Use CH instead of *DEVICE to + test the first character of DEVICE, because DEVICE is + incremented. + Reported by Bernhard Treutwein. + +2004-04-15 Yoshinori K. Okuji + + * netboot/fsys_tftp.c (buf_fill): Cast 1 to unsigned short + explicitly so that the constant doesn't extend unsigned short + to int automatically. + Reported by Eduard Guzovsky . + + * docs/grub.texi (Invoking grub-md5-crypt): Fixed the chapter + name. + Reported by Martin Pool . + +2004-04-04 Yoshinori K. Okuji + + * configure.ac (STAGE2_CFLAGS): Check if -fno-stack-protector is + supported by GCC. If yes, added the option. This is necessary + for OpenBSD, because the stack protector defines additional + symbols. Reported by uc.sheda . + +2004-03-28 Pavel Roskin + + * stage2/boot.c: Imply --no-mem-option for Linux kernels with + protocol version 2.03 and above (Linux 2.4.18 and newer). + +2004-03-27 Yoshinori K. Okuji + + * stage2/char_io.c [!GRUB_UTIL] (memcpy): New function. It is + defined as an alias of grub_memmove. This is copied from GRUB 2. + + * stage2/disk_io.c (print_completions): Simplified conditionals + to make it easier to edit the file with Emacs. + Added support for (cd). + (set_device): Likewise. + + * stage2/common.c (init_bios_info): Check if BOOT_DRIVE is a + CDROM drive. If it is true, set CDROM_DRIVE to BOOT_DRIVE. + (cdrom_drive): New variable. + + From Leonid Lisovskiy : + * stage2/start_eltorito.S: New file. + + * stage2/stage2.c (run_menu): Use GRUB_INVALID_DRIVE instead of + 0xFF. + + * stage2/shared.h (STAGE2_ID_ISO9660_STAGE1_5): New macro. + [FSYS_ISO9660] (STAGE2_ID): Set to STAGE2_ID_ISO9660_STAGE1_5. + (struct geometry): Added a new member ``sector_size''. + (BIOSDISK_FLAG_CDROM): New macro. + (cdrom_drive): Declared. + + * stage2/fsys_iso9660.c: New file. + * stage2/iso9660.h: Likewise. + + * stage2/filesys.h (FSYS_ISO9660_NUM): New macro. + [FSYS_ISO9660] (iso9660_mount): Declared. + [FSYS_ISO9660] (iso9660_read): Likewise. + [FSYS_ISO9660] (iso9660_dir): Likewise. + (NUM_FSYS): Added FSYS_ISO9660_NUM. + + * stage2/disk_io.c (fsys_table) [FSYS_ISO9660]: Added iso9660. + (current_drive): Use GRUB_INVALID_DRIVE. + (log2): New function. + (rawread): Use BUF_GEOM.SECTOR_SIZE instead of SECTOR_SIZE. + Change the type of BUFADDR from int to char *. + Use a virtual track to make sure that one track fits in the + buffer. + (sane_partition): Allow CURRENT_DRIVE to be CDROM_DRIVE, because + a bios drive for a CD-ROM is often assigned to greater than + 0x88. + (set_device): Use GRUB_INVALID_DRIVE instead of 0xFF. + (setup_part): Likewise. + + * stage2/cmdline.c (init_cmdline): Use GRUB_INVALID_DRIVE. + + * stage2/builtins.c (install_func): Use GRUB_INVALID_DRIVE. + (setup_func): Added iso9660_stage1_5. + + * stage2/bios.c (biosdisk): Don't fall back to the CHS mode + if the drive is a CDROM. + (get_cdinfo): New function. + (get_diskinfo): Call get_cdinfo if the drive is greater than or + equal to 0x88 or the drive supports LBA. + Set the sector size to SECTOR_SIZE if it is not a CD-ROM. + + * stage2/asm.S (biosdisk_int13_extensions): Take a word + argument AX instead of a byte argument AH. + (get_diskinfo_int13_extensions): Removed. + + * stage2/Makefile.am (noinst_HEADERS): Added iso9660.h. + (libgrub_a_SOURCES): Added fsys_iso9660.c. + (libgrub_a_CFLAGS): Added -DFSYS_ISO9660=1. + (pkgdata_DATA): Added iso9660_stage1_5 and stage2_eltorito. + (noinst_PROGRAMS): Added iso9660_stage1_5.exec and + start_eltorito.exec. + (noinst_DATA): Added start_eltorito. + (pre_stage2_exec_SOURCES): Added fsys_iso9660.c. + (START_ELTORITO_LINK): New variable. + (start_eltorito_exec_SOURCES): Likewise. + (start_eltorito_exec_CCASFLAGS): Likewise. + (start_eltorito_exec_LDFLAGS): Likewise. + (start_eltorito_exec-start.$(OBJEXT)): New dependency. + (stage2_eltorito): New target. + (iso9660_stage1_5_exec_SOURCES): New variable. + (iso9660_stage1_5_exec_CFLAGS): Likewise. + (iso9660_stage1_5_exec_CCASFLAGS): Likewise. + (iso9660_stage1_5_exec_LDFLAGS): Likewise. + + * stage1/stage1.h (GRUB_INVALID_DRIVE): New macro. + + * stage1/stage1.S (boot_drive): Use the macro GRUB_INVALID_DRIVE. + (real_start): Likewise. + + * lib/device.c (get_drive_geometry): Set GEOM->SECTOR_SIZE to + SECTOR_SIZE by default. + + * configure.ac (--disable-iso9660): New option. + +2004-03-13 Yoshinori K. Okuji + + From Daniele Zelante : + * stage2/asm.S (stop_floppy): Use INT 13, AH=00h to stop the + floppy controller instead of a direct I/O. + +2004-03-12 Yoshinori K. Okuji + + * stage2/serial.c (serial_putchar): Handle the character code + 127 as a backspace. Reported by Florian Engelhardt + . + +2004-03-12 Yoshinori K. Okuji + + From Boji Tony Kannanthanam : + * util/grub-install.in (convert): Add support for ATARAID + device names. + * lib/device.c (get_ataraid_disk_name) [__linux__]: New + function. + (init_device_map) [__linux__]: Probe ATARAID disks. + + * stage2/size_test (check): Don't use the local statement any + longer. It was unneeded actually. Reported by Paul Jarc. + +2004-03-12 Yoshinori K. Okuji + + From Sergey Matveychuk : + * lib/device.c (get_drive_geometry): Do not open the same device + more than once unnecessarily. + (get_drive_geometry) [__FreeBSD_version >= 500040]: Use new + ioctl methods. + (get_floppy_disk_name) [__FreeBSD__ >= 4]: Use /dev/fd%d rather + than /dev/rfd%d. + (get_ide_disk_name) [__FreeBSD__ >= 4]: Use /dev/ad%d rather + than /dev/rad%d. + (get_scsi_disk_name) [__FreeBSD__ >= 4]: Use /dev/da%d rather + than /dev/rda%d. + * grub/asmstub.c (get_diskinfo): Check if ERRNO is EPERM as + well. + +2004-02-28 Jeroen Dekkers + + * docs/grub.texi (partnew): Change @var{to} to @var{len}. + +2004-02-18 Yoshinori K. Okuji + + From Yury V. Umanets : + * stage2/fsys_reiserfs.c (REISER3FS_SUPER_MAGIC_STRING): New + macro. + (reiserfs_mount): Added checks for ReiserFS 3. + (reiserfs_embed): Likewise. + +2004-01-25 Yoshinori K. Okuji + + * docs/grub.texi (Obtaining and Building GRUB): Instead of + describing how to use the anoncvs method, specify the URL of + the description page on Savannah. + Reported by Bernhard Treutwein. + +2004-01-18 Yoshinori K. Okuji + + From Thomas Schwinge : + * grub/Makefile.am (AM_CPPFLAGS): New variable. + (AM_CFLAGS): Removed all cpp flags. + + * stage2/xfs.h (__int8_t): Renamed to ... + (xfs_int8_t): ... this. + (__uint8_t): Renamed to ... + (xfs_uint8_t): ... this. + (__int16_t): Renamed to ... + (xfs_int16_t): ... this. + (__uint16_t): Renamed to ... + (xfs_uint16_t): ... this. + (__int32_t): Renamed to ... + (xfs_int32_t): ... this. + (__uint32_t): Renamed to ... + (xfs_uint32_t): ... this. + (__int64_t): Renamed to ... + (xfs_int64_t): ... this. + (__uint64_t): Renamed to ... + (xfs_uint64_t): ... this. + All callers are changed.x + + From Egmont Koblinger : + * util/grub-install.in: Support an install devices in GRUB's + notation without parentheses. + + * docs/grub.texi (Installing GRUB using grub-install): Added an + example of using grub-install without parentheses. + +2004-01-18 Yoshinori K. Okuji + + * util/grub-install.in: Use the first word of GRUB_SHELL when + checking if the grub shell is present. This is necessary to + support options to the grub shell (e.g. grub --read-only). + + From Eric Kvaalen : + * docs/grub.texi: Many bug fixes. + +2004-01-17 Yoshinori K. Okuji + + * lib/device.c [__linux__] (MAJOR): Support 32 bit and 64 bit + dev_t. This code is stolen from glibc. + Suggested by Shen Feng . + +2004-01-11 Yoshinori K. Okuji + + * stage2/terminfo.c (ti_set_term): Use a pointer to struct + terminfo instead to avoid GCC's bug, which inserts a reference + to memcpy implicitly. + (ti_get_term): Likewise. + All callers are fixed. + + * stage2/terminfo.h (ti_set_term): Updated. + (ti_get_term): Likewise. + + * stage2/shared.h (struct linux_kernel_header): New member, + initrd_max_address. Defined in the boot protocol 2.03 or higher. + + * stage2/boot.c (load_initrd): If the boot protocol is greater + than or equal to 2.03, use the field ``initrd_max_address'' + instead of LINUX_INITRD_MAX_ADDRESS. + +2003-12-30 Yoshinori K. Okuji + + * stage2/fsys_ext2fs.c (ext2_is_fast_symlink): New function. + (ext2fs_dir): Use ext2_is_fast_symlink to check if the current + inode is a fast or slow symlink. This change was required + because Linux now uses acl seriously (i.e. incompatibility). + Reported by Chris PeBenito and Seemant + Kulleen + +2003-11-30 Yoshinori K. Okuji + + * lib/device.c (read_device_map) (sho_warning): New internal + function. + (read_device_map): If DRIVE is greater than 8, emit a warning + and ignore the drive, rather than exiting abnormally. + Reported by Greg Newby . + +2003-10-19 Yoshinori K. Okuji + + Migrated to newer autotools. Also, don't install mkbimage + because its name is too general and it does not conform to the + GNU Coding Standards in some points. + + * util/Makefile.am (EXTRA_DIST): New variable. + (sbin_SCRIPTS): Removed mkbimage. + (noinst_SCRIPTS): Added mkbimage. + + * stage1/Makefile.am (AM_ASFLAGS): Renamed to ... + (AM_CCASFLAGS): ... this. + + * stage2/Makefile.am (pre_stage2_exec_ASFLAGS): Renamed to ... + (pre_stage2_exec_CCASFLAGS): ... this. + (start_exec_ASFLAGS): Renamed to ... + (start_exec_CCASFLAGS): ... this. + (e2fs_stage1_5_exec_ASFLAGS): Renamed to ... + (e2fs_stage1_5_exec_CCASFLAGS): ... this. + (fat_stage1_5_exec_ASFLAGS): Renamed to ... + (fat_stage1_5_exec_CCASFLAGS): ... this. + (ffs_stage1_5_exec_ASFLAGS): Renamed to ... + (ffs_stage1_5_exec_CCASFLAGS): ... this. + (minix_stage1_5_exec_ASFLAGS): Renamed to ... + (minix_stage1_5_exec_CCASFLAGS): ... this. + (reiserfs_stage1_5_exec_ASFLAGS): Renamed to ... + (reiserfs_stage1_5_exec_CCASFLAGS): ... this. + (vstafs_stage1_5_exec_ASFLAGS): Renamed to ... + (vstafs_stage1_5_exec_CCASFLAGS): ... this. + (jfs_stage1_5_exec_ASFLAGS): Renamed to ... + (jfs_stage1_5_exec_CCASFLAGS): ... this. + (xfs_stage1_5_exec_ASFLAGS): Renamed to ... + (xfs_stage1_5_exec_CCASFLAGS): ... this. + (diskless_exec_ASFLAGS): Renamed to ... + (diskless_exec_CCASFLAGS): ... this. + (nbloader_exec_ASFLAGS): Renamed to ... + (nbloader_exec_CCASFLAGS): ... this. + (pxeloader_exec_ASFLAGS): Renamed to ... + (pxeloader_exec_CCASFLAGS): ... this. + + * configure.in: Removed. + * configure.ac: New file. Mostly derived from configure.in. + +2003-10-19 Yoshinori OKUJI + + From KB Sriram : + * stage2/disk_io.c (set_device) [SUPPORT_NETBOOT]: Added support + for a completion of a network device. + (print_completions): Likewise. + +2003-10-10 Robert Millan + + * config.guess: Update from official source (CVS). + * config.sub: Likewise. + +2003-09-18 Robert Millan + + * docs/texinfo.tex: Update from ftp.gnu.org. + +2003-09-05 KB Sriram + + * stage2/fsys_fat.c: Fix missdetection of ext2fs as fatfs. + +2003-09-05 Robert Millan + + * docs/menu.lst (GNU/Linux): Add commented initrd command, which + is consistent with documentation. + +2003-09-01 Robert Millan + + * docs/menu.lst: Add NetBSD, OpenBSD, GNU/KFreeBSD and + GNU/KNetBSD. + +2003-08-13 Jason Thomas + + * util/grub-install.in (resolve_symlink): New function to + resolve symlinks. + (find_device): Moved symlink code to new function. + Before we convert the install_device we attempt to resolve it if + its a symlink using the new function. + * util/mbchk.c (check_multiboot): The sense of an error message + was inverted. + Reported by Timothy Baldwin . + +2003-08-12 Jochen Hoenicke + + * stage2/fsys_reiserfs.c (read_tree_node): Fixed a typo; only + matters for very large fs when tree doesn't fit in cache. + (IH_KEY_OFFSET): Don't check for INFO->version. There are + actually old version file systems that use new version items. + (IH_KEY_ISTYPE): Likewise. + (reiserfs_dir): Likewise. + +2003-08-09 Thierry Laronde + + * util/mkbimage: New File. `mkbimage' depends on GRUB and + existed elsewhere. It is now part of GRUB so that people can + fix/contribute. + * util/Makefile.am (sbin_SCRIPTS): Added script `mkbimage' + +2003-08-01 Jason Thomas + + * util/grub-install.in: support --no-floppy + This allow users to specify the --no-floppy option which + is passed onto the grub shell, so it does not probe the floppy + drive. + Patch from kesha@diedas.soften.ktu.lt + +2003-06-17 Jochen Hoenicke + + * stage2/fsys_reiserfs.c (reiserfs_mount): Clear the node cache. + This fixes a problem where files from other partitions appear at + the wrong partition. Problem reported by Johan Regin. + +2003-05-04 Yoshinori K. Okuji + + * docs/grub.texi (partnew): Fixed the inconsistency between the + implementation and the documentation. The last argument is the + length instead of the ending address. + Reported by Daniel Farrell . + +2003-03-19 Yoshinori K. Okuji + + From Adam Lackorzynski : + * stage2/shared.h (KEY_NPAGE): Changed to 0x5100. + (KEY_PPAGE): Changed to 0x4900. + +2003-03-19 Yoshinori K. Okuji + + * stage2/boot.c (load_image): Check if DATA_LEN plus SECTOR_SIZE + is less than or equal to MULTIBOOT_SEARCH, instead of if + DATA_LEN is less than or equal to MULTIBOOT_SEARCH. + Reported by Neelkanth Natu . + +2003-03-10 Yoshinori K. Okuji + + From Andrew Walrond : + * stage2/fsys_reiserfs.c (struct reiserfs_journal_header): + Remove an unnecessary ``long''. + +2003-03-10 Yoshinori K. Okuji + + From Tilmann Bubeck: + * stage2/builtins.c [SUPPORT_SERIAL] (terminfo_func): Unescape + arguments before copying them, and escape sequences before + printing them. + * stage2/terminfo.h (TERMINFO_LEN): Changed to 40. + +2003-02-20 Yoshinori K. Okuji + + * util/grub-install.in (find_device): Fix the sed script. + +2003-02-17 Yoshinori K. Okuji + + * lib/device.c (check_device): If DEVICE is empty, just return + 1. + (get_scsi_disk_name) [__QNXNTO__]: Make NAME empty, because SCSI + disks are detected as IDE disks on QNX RTP. + + From Taketo Kabe : + * lib/device.c (get_ide_disk_name) [__QNXNTO__]: Set NAME to + "/dev/hdX". + (get_floppy_disk_name) [__QNXNTO__]: Set NAME to "/dev/fdX". + * stage2/mb_info.h (struct AddrRangeDesc): Specified with the + attribute packed. + * stage2/shared.h (struct mmar_desc): Likewise. + +2003-01-29 Yoshinori K. Okuji + + From Ilguiz Latypov: + * configure.in: Fix a syntax error in a sed script. + * stage2/bios.c (get_diskinfo): PhoenixBIOS 4.0 Revision 6.0 + for ZF Micro might understand the greater buffer size for the + "get drive parameters" int 0x13 call in its own way. + Supposedly the BIOS assumes even bigger space is available and + thus corrupts the stack. This is why we specify the exactly + necessary size of 0x42 bytes. + +2003-01-25 Yoshinori K. Okuji + + From Steven Dick : + * stage2/pc_slice.h (PC_SLICE_TYPE_DELL_UTIL): New macro. + (IS_PC_SLICE_TYPE_FAT): Recognize PC_SLIDE_TYPE_DELL_UTIL as + well. + +2003-01-25 Yoshinori K. Okuji + + From Karsten Scheibler : + * stage2/terminfo.c (term): Don't use a C99-style initializer. + +2003-01-16 Yoshinori K. Okuji + + From H.J. Lu : + * stage2/disk_io.c (part_start): Use unsigned long to support + large disks. + (part_length): Likewise. + * stage2/shared.h (part_start): Likewise. + (part_length): Likewise. + +2003-01-05 Yoshinori K. Okuji + + * configure.in (CFLAGS): When the default CFLAGS is used, + eliminate -O2 and -g from CFLAGS, because Autoconf may + automatically set CFLAGS to them. + +2003-01-02 Yoshinori K. Okuji + + From Jeremy Katz: + * configure.in: Support building on x86_64 with gcc -m32. + +2003-01-02 Yoshinori K. Okuji + + From Jeremy Katz: + * stage2/fsys_ext2fs.c (ext2fs_dir): Initialize STR_CHK to shut + up GCC. + * stage2/fsys_minix.c (minix_dir): Likewise. + +2002-12-21 Yoshinori K. Okuji + + * stage2/asm.S (gateA20): First, try a BIOS call (INT 15H, + AX=2400/2401). Use the keyboard controller, only if that failed. + +2002-12-11 Yoshinori K. Okuji + + Add a workaround for buggy BIOSes which don't pass boot drive + correctly. The idea is that GRUB forces the fixed disk flag + when booted from a hard disk. When BIOS loads GRUB directly, + the boot drive must be either of 0x00 and 0x80, so this should + work, if those BIOSes always pass zero to %dl. AFAIK, this + assumption is always correct. + + * stage2/builtins.c (install_func): Store the fixed disk flag of + the destination drive in BOOT_DRIVE_MASK in Stage 1. + + * stage1/stage1.h (STAGE1_BOOT_DRIVE_MASK): New macro. + + * stage1/stage1.S (boot_drive_mask): New variable. It is or'ed + to %dl. + +2002-12-09 Yoshinori K. Okuji + + * stage2/char_io.c (init_page): Change the software name from + "GRUB" to "GNU GRUB". This was inaccurate. Reported by Ciaran + O'Riordan . + +2002-12-04 Yoshinori K. Okuji + + * stage2/builtins.c (embed_func): When checking if the disk can + store Stage 1.5, check every partition, if it isn't empty. + +2002-12-04 Yoshinori K. Okuji + + * stage2/stage2.c (print_entry): Put a right arrow, if the entry + is longer than 71 characters. Reported by Pavel Roskin. + +2002-12-04 Yoshinori K. Okuji + + * stage2/disk_io.c (set_device): If '(n' is given, add 'd' into + DEVICE. Reported by Pavel Roskin. + +2002-12-03 Yoshinori K. Okuji + + Change the terminal structure a bit, to turn the cursor state + explicitly. Suggested by Pavel Roskin. + + * stage2/term.h (struct term_entry): Remove the member + `nocursor' and add `setcursor'. + [!STAGE1_5] (console_setcursor): New prototype. + [SUPPORT_HERCULES] (hercules_setcursor): Likewise. + [!STAGE1_5] (console_nocursor): Removed. + [SUPPORT_HERCULES] (hercules_nocursor): Likewise. + + * stage2/stage2.c (run_menu): Call setcursor instead of + nocursor. + Call setcursor with 1 before starting a boot entry. + + * stage2/shared.h (nocursor): Removed. + (setcursor): New prototype. + + * stage2/hercules.c (herc_cursor_state): New variable. + (herc_turn_cursor): Removed. + (hercules_nocursor): Likewise. + (hercules_setcursor): New function. + + * stage2/char_io.c (get_cmdline): Turn on the cursor at the + beginning, and restore it before returning. + (nocursor): Removed. + (setcursor): New function. + + * stage2/asm.S (console_cursor_state): New variable. + (console_cursor_shape): Likewise. + (console_setcursor): New function. + (console_nocursor): Removed. + + * grub/asmstub.c (console_setcursor): New function. + (hercules_setcursor): Likewise. + (console_nocursor): Removed. + (hercules_nocursor): Likewise. + +2002-12-03 Yoshinori K. Okuji + + * docs/grub.texi (terminfo): Fix a misleading English sentence. + Reported by Pavel Roskin. + * stage2/builtins.c (builtin_terminfo): Likewise. + +2002-12-01 Yoshinori K. Okuji + + From Alexander Langer : + * stage2/freebsd.h (RB_GDB): New macro. + (RB_MUTE): Likewise. + (RB_MULTIPLE): Likewise. + + * stage2/boot.c (bsd_boot): Set the bits of RB_MULTIPLE, RB_GDB + and RB_MUTE when "-D", "-g" and "-m" are specified, + respectively. + +2002-12-01 Yoshinori K. Okuji + + * docs/grub.texi (Reporting bugs): Specify the project page of + the BTS instead of the BTS itself. + +2002-11-30 Yoshinori K. Okuji + + * docs/Makefile.am (man_MANS): Added grub-terminfo.8. + ($(srcdir)/grub_terminfo.8): New target. + * utils/grub-terminfo.in: New file. + * util/Makefile.am (sbin_SCRIPTS): Added grub-terminfo. + * configure.in (AC_OUTPUT): Added util/grub-terminfo. + + * docs/grub.texi (terminfo): New subsection. + (Invoking grub-terminfo): New chapter. + + From Tilmann Bubeck : + * stage2/Makefile.am (noinst_HEADERS): Added terminfo.h and + tparm.h. + (libgrub_a_SOURCES): Added terminfo.c and tparm.c. + (pre_stage2_exe_SOURCES): Likewise. + * stage2/terminfo.c: New file. + * stage2/terminfo.h: Likewise. + * stage2/tparm.c: Likewise. + * stage2/tparm.h: Likewise. + * stage2/stage2.c (get_line_from_config): Fix handling of + backslashes. + * stage2/char_io.c (grub_putstr): New function. + (grub_printf): Use grub_putstr. + (substring): Add const into both arguments. + * stage2/builtins.c [SUPPORT_SERIAL]: Include terminfo.h. + [SUPPORT_SERIAL] (terminfo_func): New function. + [SUPPORT_SERIAL] (builtin_terminfo): New variable. + (builtin_table) [SUPPORT_SERIAL]: Added a pointer to + BUILTIN_TERMINFO. + * stage2/serial.c (serial_gotoxy): Use ti_cursor_address. + (serial_cls): Use ti_clear_screen. + (serial_highlight): use ti_enter_standout_mode and + ti_exit_standout_mode. + +2002-11-30 Yoshinori K. Okuji + + * stage2/disk_io.c (rawread): Make sure that SECTOR is valid. + If not, set ERRNUM to ERR_GEOM and return zero. This check is + critical when a partition table is corrupted. + +2002-11-28 Yoshinori K. Okuji + + * stage2/asm.S (console_cls): Write spaces to the entire screen + instead of getting/setting the video mode, because this flickers + the screen and is quite annoying, if using a LCD. + +2002-11-15 Yoshinori K. Okuji + + * docs/grub.texi (QNX): New subsection. Reported by + Marian-Nicolae V. ION . + +2002-10-28 Yoshinori K. Okuji + + * grub/asmstub.c (console_translate_key): Deal with KEY_PPAGE + and KEY_NPAGE. + * stage2/serial.c (serial_translate_key_sequence): Added two new + codes for Page Up and Page Down. + * stage2/asm.S (translation_table): Added entries for KEY_PPAGE + and KEY_NPAGE. + * stage2/stage2.c (run_menu): Deal with Page Up and Page Down. + Also recognize the right key for the selection of a boot entry. + Suggested by Adam Lackorzynski . + +2002-10-10 Jason Thomas + + * stage2/builtins.c (setup_func): Added missing space to --force-lba + option. Reported by Kenneth Crudup + +2002-10-06 Yoshinori K. Okuji + + * stage2/asm.S (gateA20): Output a dummy command (0xff), as a + workaround for USB keyboard hanging problem. Suggested by + Hidetoshi Nishimaki . + +2002-10-06 Yoshinori K. Okuji + + * configure.in (falign_loop_flag): New variable. Set to if GCC + supports `-falign-*'. If true, use `-falign-jumps', + `-falign-loops' and `-falign-functions' instead of + `-malign-jumps', `-malign-loops' and `-malign-functions', + because `-malign-*' are obsolete in GCC 3.x. Reported by Jeremy + Katz. + +2002-09-13 Yoshinori K. Okuji + + * stage2/serial.c (fill_input_buf): Take a new argument NOWAIT. + If NOWAIT is true, don't loop. + All callers are changed. + +2002-09-08 Yoshinori K. Okuji + + * configure.in (--disable-serial): Fix a typo in the + description. + +2002-08-20 Jason Thomas + + Changed highlight state code for hercules, console and serial. + The state was 0 - normal or 1 - highlight. + The state is now defined using an enum called color_state. + + * stage2/term.h (color_state): New enum. + (COLOR_STATE_STANDARD): Standard color to use when not using + user defined. + (COLOR_STATE_NORMAL): User defined normal color. + (COLOR_STATE_HIGHLIGHT): User defined highlight color. + (console_highlight): Renamed to console_setcolorstate. + (serial_highlight): Renamed to serial_setcolorstate. + (hercules_highlight): Renamed to hercules_setcolorstate. + * stage2/hercules.c (herc_highlight_state): Removed. + (herc_standard_color): New variable. + (herc_color_state): Likewise. + (herc_highlight): Renamed to herc_setcolorstate. + (herc_setcolorstate): Added switch to handle new states. + * stage2/console.c (console_highlight_state): Removed. + (console_standard_color): New variable. + (console_color_state): Likewise. + (console_highlight): Renamed to console_setcolorstate. + (console_setcolorstate): Added switch to handle new states. + * stage2/serial.c (serial_highlight): Renamed to + serial_setcolorstate. + (serial_setcolorstate): Adjusted 'if' to suit new states. + * grub/asmstub.c (console_highlight): Renamed to + console_setcolorstate. + (console_setcolorstate): Adjusted 'if' to suit new states. + * stage2/stage2.c (print_entry): Set color states using new + states. + (print_border): Likewise. + * stage2/stage2.c (run_menu): Reverse if (!) to if () for + uniformitty. + +2002-07-12 Yoshinori K. Okuji + + * stage2/boot.c (load_image): Rewrite the Linux booting support + radically. Now it should work even on a machine having, say, + only 128KB, theoretically. Of course, GRUB itself doesn't work + on such a system, though. + (load_initrd): Initialize LH based on CUR_ADDR, because the + location becomes dynamic. + * stage2/shared.h (LINUX_MAX_SETUP_SECTS): Set to 64. + (LINUX_HEAP_END_OFFSET): Set to (0x9000 - 0x200). + (LINUX_STAGING_AREA): Removed. + (LINUX_SETUP): Likewise. + (LINUX_KERNEL): Likewise. + (LINUX_KERNEL_MAXLEN): Likewise. + (LINUX_SETUP_SEG): Likewise. + (LINUX_INIT_SEG): Likewise. + (LINUX_SETUP_STACK): Set to 0x9000. + (LINUX_BZIMAGE_ADDR): New macro. + (LINUX_ZIMAGE_ADDR): Likewise. + (LINUX_OLD_REAL_MODE_ADDR): Likewise. + (CL_MY_LOCATION): Removed. + (CL_MY_END_ADDR): Likewise. + (CL_BASE_ADDR): Likewise. + (CL_MAGIC): Renamed to ... + (LINUX_CL_MAGIC): ... this. + (LINUX_CL_OFFSET): New macro. + (LINUX_CL_END_OFFSET): Likewise. + (LINUX_SETUP_MOVE_SIZE): Likewise. + (struct linux_kernel_header): Change the type of the member + "cmd_line_ptr" to char *. + (linux_data_tmp_addr): Declared. + (linux_data_real_addr): Likewise. + * stage2/asm.S [!STAGE1_5] (linux_data_tmp_addr): New variable. + [!STAGE1_5] (linux_data_real_addr): Likewise. + [!STAGE1_5] (big_linux_boot): Copy the real mode part from + LINUX_DATA_TMP_ADDR to LINUX_DATA_REAL_ADDR. + * grub/asmstub.c (linux_data_tmp_addr): New variable. + (linux_data_real_addr): Likewise. + +2002-07-09 Yoshinori K. Okuji + + From Mark Kettenis : + * stage2/boot.c (load_image): Recognize newer FreeBSD kernels. + * stage2/i386-elf.h (EI_OSABI): New macro. + (EI_ABIVERSION): Likewise. + (ELFOSABI_FREEBSD): Likewise. + (EI_PAD): Set to 9. + +2002-07-06 Yoshinori K. Okuji + + * stage2/shared.h (boot_part_offset): Removed. + + * stage2/disk_io.c (set_bootdev): Copy the partition information + here. Now this function can call rawread, so it can fail. + (boot_part_offset): Removed. + + * stage2/builtins.c (boot_func): Don't copy the partition + information here. + (real_root_func): Check ERRNUM after calling set_bootdev. + +2002-07-04 Yoshinori K. Okuji + + * docs/grub.texi (Reporting bugs): Use the group name (i.e. + grub) instead of the group id (i.e. 68) for the URL of the BTS. + +2002-07-03 Yoshinori K. Okuji + + * stage2/serial.c [!GRUB_UTIL] (inb): Added a delay into this + function itself. + [!GRUB_UTIL] (outb): Likewise. + [!GRUB_UTIL] (serial_hw_put): Increase the timeout value, and + don't call serial_hw_delay explicitly any longer. + (fill_input_buf): Increase the maximum number of retries, reset + the counter to zero after getting a valid character, and don't + call serial_hw_delay explicitly any longer. + +2002-07-03 Yoshinori K. Okuji + + * stage2/serial.c [!GRUB_UTIL] (serial_hw_fetch): Fixed a typo. + Reported by Ilguiz Latypov. + +2002-07-01 Yoshinori K. Okuji + + * Makefile.am (AUTOMAKE_OPTIONS): New variable. Specify the + required Automake version explicitly. + +2002-06-30 Yoshinori K. Okuji + + * stage2/builtins.c [SUPPORT_SERIAL || SUPPORT_HERCULES] + (terminal_func): Set CURRENT_TERM to each of selected terminals + before calling grub_printf, and restore CURRENT_TERM after it. + Reported by Ilguiz Latypov. + Prepend a carriage return to the prompting message, because it + is ugly that the same messages fulfill the whole screen. + +2002-06-30 Yoshinori K. Okuji + + * stage2/serial.c [!GRUB_UTIL] (serial_hw_fetch): Fixed the + conditional statement. Reported by Ilguiz Latypov. + +2002-06-24 Yoshinori K. Okuji + + * MAINTENANCE: New file. + +2002-06-15 Yoshinori K. Okuji + + * stage2/disk_io.c [SUPPORT_NETBOOT] (GRUB): Defined. + [SUPPORT_NETBOOT]: Include etherboot.h. + [!STAGE1_5] (print_completions) [SUPPORT_NETBOOT]: When + completing a disk name, if NETWORK_READY is true, add "nd" as a + completion. + +2002-06-15 Yoshinori K. Okuji + + * stage2/fsys_xfs.c (le32): Don't use bswap, but use xchgb and + roll, because 386 doesn't have bswap. Reported by Frode Vatvedt + Fjeld . + +2002-06-12 Yoshinori K. Okuji + + * netboot/main.c (ifconfig): If GW is specified, clear out the + ARP entry for the gateway. If SVR is specified, clear out the + ARP entry for the server. Reported by Uwe Dannowski + . + +2002-06-12 Yoshinori K. Okuji + + * util/grub-md5-crypt.in: Prompt to retype a password, and check + if the passwords matches. Suggested by Matt Perry + . + Also, don't use Perl any longer, because *BSD's sh and GNU + support ``read -r'', and GRUB doesn't support any other + operating system anyway. + +2002-06-12 Yoshinori K. Okuji + + The terminal handling code is rewritten radically. + + * stage2/console.c: New file. + * stage2/term.h: Likewise. + + * stage2/Makefile.am (noinst_HEADERS): Added term.h. + (libgrub_a_SOURCES): Added serial.c. + (pre_stage2_exec_SOURCES): Added console.c. + + * stage2/asm.S (console_putchar): Rewritten from scratch. + [!STAGE1_5] (translation_table): New variable. + [!STAGE1_5] (translate_keycode): New function. + [!STAGE1_5] (console_getkey): Call translate_keycode. + [!STAGE1_5] (console_checkkey): Likewise. + [!STAGE1_5] (nocursor): Renamed to ... + [!STAGE1_5] (console_nocursor): ... this. + [!STAGE1_5] (console_set_attrib): Removed. + + * stage2/builtins.c: Include term.h. + (terminal): Removed. + (normal_color): Likewise. + (highlight_color): Likewise. + (cat_func): Display a question mark when a non-printable + character was read. + (terminal_func): Rewritten almost from scratch. + + * stage2/char_io.c: Include term.h. + [!STAGE1_5] (auto_fill): Removed. + [!STAGE1_5] (term_table): New variable. + [!STAGE1_5] (current_term): Likewise. + [!STAGE1_5] (real_get_cmdline): New function. The code was + stolen from the previous version of get_cmdline. + [!STAGE1_5] (get_cmdline): Rewritten from scratch. + [!STAGE1_5] (translate_keycode): Removed. + [!STAGE1_5] (getkey): Rewritten from scratch. + [!STAGE1_5] (checkkey): Likewise. + (grub_putchar): Likewise. + [!STAGE1_5] (gotoxy): Likewise. + [!STAGE1_5] (getxy): Likewise. + [!STAGE1_5] (cls): Likewise. + [!STAGE1_5] (nocursor): New function. + [SUPPORT_SERIAL] (serial_getxy): Removed. + [SUPPORT_SERIAL] (serial_gotoxy): Likewise. + [SUPPORT_SERIAL] (serial_cls): Likewise. + [SUPPORT_SERIAL] (serial_getxy): Likewise. + [!STAGE1_5] (set_attrib): Likewise. + + * stage2/cmdline.c (init_cmdline): Set COUNT_LINES to -1. + + * stage2/common.c [!STAGE1_5] (err_list): Removed + ERR_NEED_SERIAL and added ERR_DEV_NEED_INIT. + + * stage2/hercules.c: Rewritten almost from scratch. + * stage2/hercules.h (herc_putchar): Removed. + (herc_cls): Likewise. + (herc_getxy): Likewise. + (herc_gotoxy): Likewise. + (herc_set_attrib): Likewise. + + * stage2/serial.c: Rewritten almost from scratch. + * stage2/serial.h: Likewise. + + * stage2/shared.h [GRUB_UTIL] (DISP_UL): Set to the same value + as VGA's. + [GRUB_UTIL] (DISP_UR): Likewise. + [GRUB_UTIL] (DISP_LL): Likewise. + [GRUB_UTIL] (DISP_LR): Likewise. + [GRUB_UTIL] (DISP_HORIZ): Likewise. + [GRUB_UTIL] (DISP_VERT): Likewise. + [GRUB_UTIL] (DISP_LEFT): Likewise. + [GRUB_UTIL] (DISP_RIGHT): Likewise. + [GRUB_UTIL] (DISP_UP): Likewise. + [GRUB_UTIL] (DISP_DOWN): Likewise. + (grub_error_t): Removed ERR_NEED_SERIAL. + Added ERR_DEV_NEED_INIT. + (normal_color): Removed. + (highlight_color): Likewise. + (console_cls): Removed, because this is declared in term.h. + (console_getxy): Likewise. + (console_gotoxy): Likewise. + (console_putchar): Likewise. + (console_getkey): Likewise. + (console_checkkey): Likewise. + (console_set_attrib): Removed. + (set_attrib): Likewise. + [GRUB_UTIL] (nocursor): Declared. + (auto_fill): Removed. + (terminal): Likewise. + (TERMINAL_CONSOLE): Likewise. + (TERMINAL_SERIAL): Likewise. + (TERMINAL_HERCULES): Likewise. + (TERMINAL_DUMB): Likewise. + (translate_keycode): Likewise. + + * stage2/stage2.c: Include term.h. + (print_entry): Rewritten from scratch. + (print_entries): Likewise. + (print_border): Likewise. + (set_line): Removed. + (set_line_normal): Likewise. + (set_line_highlight): Likewise. + + * grub/Makefile.am (AM_CFLAGS): Added -DSUPPORT_HERCULES=1. + + * grub/asmstub.c: Don't include hercules.h. Include term.h. + (console_current_color): New variable. + (console_translate_key): New function. + (console_checkkey): Rewritten from scratch. + (console_getkey): Likewise. + (console_putchar): Likewise. + (console_set_attrib): Removed. + (console_highlight): New function. + (console_setcolor): Likewise. + (console_nocursor): Likewise. + (serial_getkey): Removed. + (serial_checkkey): Likewise. + (serial_putchar): Likewise. + (serial_exists): Likewise. + (serial_get_port): Likewise. + (serial_init): Likewise. + (serial_hw_fetch): New function. + (serial_hw_put): Likewise. + (serial_hw_delay): Likewise. + (serial_hw_get_port): Likewise. + (serial_hw_init): Likewise. + (set_serial_device): Renamed to ... + (serial_set_device): ... this. + (herc_putchar): Renamed to ... + (hercules_putchar): ... this. + (herc_cls): Renamed to ... + (hercules_cls): ... this. + (herc_getxy): Renamed to ... + (hercules_getxy): ... this. + (herc_gotoxy): Renamed to ... + (hercules_gotoxy): ... this. + (hercules_highlight): New function. + (hercules_setcolor): Likewise. + (hercules_nocursor): Likewise. + (herc_set_attrib): Removed. + + * grub/main.c: Include term.h. + (main): If USE_CURSES is false, set CURRENT_TERM->FLAGS to + TERM_NO_EDIT | TERM_DUMB. TERMINAL is not used any longer. + +2002-06-01 Yoshinori K. Okuji + + * docs/grub.texi (FAQ): Removed. See the GNU GRUB FAQ on the web + instead. + +2002-05-31 Yoshinori K. Okuji + + * docs/grub.texi (Reporting bugs): Recommend using the BTS on + Savannah rather than the list bug-grub. + +2002-05-25 Yoshinori K. Okuji + + * stage2/builtins.c (boot_func): Load the boot partition + information, only if the address of the boot partition entry is + set appropriately. + (real_root_func): If ATTEMPT_MOUNT is false, call open_partition + and if successful, call set_bootdev, to set the offset of the + boot partition and the address of the boot paetition entry. + IF ATTEMPT_MOUNT is false, don't set BOOTDEV. The BSD evil hack + is useless with the command "rootnoverify" anyway. + * stage2/disk_io.c (boot_part_addr): Initialized with zero + explicitly, to emphasize that it is invalid. + +2002-05-24 Yoshinori K. Okuji + + * stage2/builtins.c (real_root_func): New function. + (root_func): Just call real_root_func. + (rootnoverify_func): Likewise. + +2002-05-23 Yoshinori K. Okuji + + * configure.in (AM_INIT_AUTOMAKE): Changed the version number to + 0.93. + +2002-05-23 Yoshinori K. Okuji + + Define the behavior of the boot loader when the load end address + and the bss end address are zero in the Multiboot Specification, + and add the support into GRUB. I've modified a patch from Yuri + Zaporogets . + + * stage2/boot.c (load_image): In the case of Multiboot a.out + kludge, set the load end address to the load address plus the + size of the OS image file, if it is zero. Similarly, set the bss + end address to the load end address, if it is zero. + + * util/mbchk.c (check_multiboot): Don't check if the load + address is greater than or equal to the load end address, if the + load end address is zero. Don't check if the load end address is + greater than the bss end address, if the bss end address is + zero. And, don't check if the load end address is less than or + equal to the entry address, if the load end address is zero. + + * docs/multiboot.texi (The address fields of Multiboot header): + Added descriptions about the behavior of the boot loader when + LOAD_END_ADDR is zero and BSS_END_ADDR is zero. + +2002-05-22 Yoshinori K. Okuji + + * stage2/builtins.c (boot_func): If DEBUG is true, print + BOOT_DRIVE and BOOT_PART_OFFSET. + Don't set ERRNUM after rawread failed, because rawread should + set ERRNUM itself. + +2002-05-20 Yoshinori K. Okuji + + * lib/device.c (read_device_map): Show an error message and exit + abnormally, if MAP[DRIVE] has already been filled. + * util/grub-install.in: If there is any dulicated entry, print + an error message and exit abnormally. + +2002-05-20 Yoshinori K. Okuji + + * lib/device.c: Don't include linux/hdreg.h, linux/major.h, + or linux/kdev_t.h. + [__linux__] (HDIO_GETGEO): Defined. + [__linux__] (hd_geometry): Likewise. + [__linux__] (FLOPPY_MAJOR): Likewise. + [__linux__] (MINORBITS): Likewise. + [__linux__] (MAJOR): Likewise. + +2002-05-08 Yoshinori K. Okuji + + * netboot/fsys_tftp.c (tftp_read): Don't call buf_fill unless + SIZE is positive. + +2002-05-08 Yoshinori K. Okuji + + * netboot/etherboot.h (ETH_MAX_MTU): Because some DHCP/BOOTP + servers don't treat the maximum length the same as Etherboot, + subtract the size of an IP header and that of an UDP header. + +2002-04-30 Yoshinori K. Okuji + + From Jean-Jacques Michel : + * stage2/boot.c (load_image): For Linux, check if DATA_LEN is + greater than MULTIBOOT_SEARCH. If that's true, read the rest + after copying data already read in BUFFER. + +2002-04-30 Yoshinori K. Okuji + + * stage2/boot.c (load_image): For Linux, don't check if the + length of protected mode code is greater than or equal to the + expected length minus 16. Instead, just check if no error + occurred. That was problematic, because memdisk has no protected + mode code. Also, I don't see what the magic number 16 was for. + +2002-04-29 Yoshinori K. Okuji + + * stage2/builtins.c [SUPPORT_SERIAL] (terminal_func): Added a + new option ``--silent''. This suppresses messages, if specified. + +2002-04-29 Yoshinori K. Okuji + + * config.guess: New upstream version. + * config.sub: Likewise. + +2002-04-20 Yoshinori K. Okuji + + * netboot/config.c (PCI_NIC) [INCLUDE_DAVICOM]: Fix typos. + Reported by Julien Perrot . + +2002-04-17 Yoshinori K. Okuji + + * stage2/builtins.c [SUPPORT_SERIAL] (terminal_func): Set + COUNT_LINES to -1, to disable the pager. + +2002-04-16 Yoshinori K. Okuji + + * docs/grub.texi (Obtaining and Building GRUB): Update the link + to the binutils site. + +2002-04-06 Pavel Roskin + + * util/grub-install.in: Fix hardcoded /dev/hda1. + +2002-04-06 Yoshinori K. Okuji + + * stage2/builtins.c [GRUB_UTIL] (dump_func): New function. + [GRUB_UTIL] (builtin_dump): New variable. + (builtin_table) [GRUB_UTIL]: Added a pointer to BUILTIN_DUMP. + * util/grub-install.in: Make sure that GRUB reads the same + images as the host operating system by comparing the result of + running the command "dump" with the contents of the OS file. + +2002-04-04 Yoshinori K. Okuji + + * stage2/builtins.c (setup_func): Don't embed a drive number, if + unnecessary. + +2002-03-29 Yoshinori K. Okuji + + * docs/grub.texi (General commands): Added ``pager'' into the + menu. + (pager): New subsection. + (terminal): Added a description about the option + ``--lines=LINES''. + + * configure.in (AC_INIT_AUTOMAKE): Set the version number to + 0.92. + +2002-03-26 Yoshinori K. Okuji + + * netboot/eepro100.c (eepro100_probe): Increase the delay at the + initialization. + +2002-03-26 Yoshinori K. Okuji + + * stage2/boot.c (linux_mem_size): New variable. + (load_image): Check a mem= option and set LINUX_MEM_SIZE to the + specified memory size, if any. Otherwise, to zero. When an + overflow is detected, use LINUX_INITRD_MAX_ADDRESS instead. + (load_initrd): If LINUX_MEM_SIZE is non-zero, use it instead of + the actual memory size. + * stage2/char_io.c (safe_parse_maxint): Use ERR_NUMBER_OVERFLOW + instead of ERR_NUMBER_PARSING, when an overflow occurs. + * stage2/common.c [!STAGE1_5] (err_list): Added + ERR_NUMBER_OVERFLOW. + * stage2/shared.h (ERR_NUMBER_OVERFLOW): New constant. + +2002-03-24 Yoshinori K. Okuji + + * stage2/stage2.c (run_menu): Call cls outside the loop to run + scripts. + * stage2/cmdline.c (run_script): Prompt a user's intervention, + only when FALLBACK_ENTRY is negative. + +2002-02-11 Pavel Roskin + + * util/grub-install.in (find_device): New function - find block + device for given file or directory. Resolve symlinks to fix + problem on Linux with devfs and old device names in /etc/fstab. + Use find_device() for root_device, bootdir_device and + grubdir_device. + +2002-02-08 Yoshinori K. Okuji + + * grub/main.c (OPT_NO_PAGER): New macro. + (longopts): Added an entry for "--no-pager". + (usage): Added a description about "--no-pager". + (main): In case of OPT_NO_PAGER, set USE_PAGER to zero. The same + thing is done with OPT_BATCH, because the pager is just harmful + in batch mode. + +2002-02-08 Yoshinori K. Okuji + + * stage2/builtins.c (help_func): Show all the commands runnable + with the command-line interface, if "--all" is specified. + +2002-02-08 Yoshinori K. Okuji + + An internal pager is implemented. + + * stage2/builtins.c (pager_func): New function. + (builtin_pager): New variable. + (terminal_func): New option, "--lines=LINES" is added. If this + option is specified, set MAX_LINES to the value. Otherwise, set + MAX_LINES to 24. + (vbeprobe_func): Remove the pager code specific to this + function. + (builtin_table): Added a pointer to BUILTIN_PAGER. + * stage2/char_io.c (max_lines) [!STAGE1_5]: New variable. + (count_lines) [!STAGE1_5]: Likewise. + (use_pager) [!STAGE1_5]: Likewise. + (grub_putchar) [!STAGE1_5]: if C is a newline and COUNT_LINES is + not -1, count up the number of lines. If it exceeds the maximum + number of lines minus 2, show a message and wait for input of + return key. "minus 2" is to reserve space for the message + printed by this internal pager. + * stage2/cmdline.c (enter_cmdline): If USE_PAGER is true, set + COUNT_LINES to zero, before running a command, and reset + COUNT_LINES to -1 after that. + * stage2/shared.h (max_lines) [!STAGE1_5]: Declared. + (count_lines) [!STAGE1_5]: Likewise. + (use_pager) [!STAGE1_5]: Likewise. + +2002-02-08 Yoshinori K. Okuji + + * stage2/fsys_jfs.c (jfs_read) [STAGE1_5]: Set and reset + DISK_READ_FUNC even in Stage 1.5. + * stage2/fsys_xfs.c (xfs_read) [STAGE1_5]: Likewise. + + * stage2/stage1_5.c (saved_sector): Initialized with -1. + (cmain): Check if SAVED_SECTOR was set appropriately after + reading the second sector of Stage 2. If SAVED_SECTOR is not + set (i.e. it is equal to -1), print an error and stop. + +2002-02-05 Yoshinori K. Okuji + + * stage2/builtins.c (setup_func): Add a VSTa fs entry into + STAGE1_5_MAP. + +2002-02-05 Yoshinori K. Okuji + + * stage2/shared.h (BUILTIN_HELP_LIST): New macro. Used for + commands whose help messages are listed when no argument is + specified to the command "help". + * stage2/builtins.c (builtin_blocklist): Added the attribute + BUILTIN_HELP_LIST. + (builtin_boot): Likewise. + (builtin_bootp): Likewise. + (builtin_cat): Likewise. + (builtin_chainloader): Likewise. + (builtin_color): Likewise. + (builtin_configfile): Likewise. + (builtin_device): Likewise. + (builtin_dhcp): Likewise. + (builtin_displayapm): Likewise. + (builtin_displaymem): Likewise. + (builtin_find): Likewise. + (builtin_geometry): Likewise. + (builtin_halt): Likewise. + (builtin_help): Likewise. + (builtin_hide): Likewise. + (builtin_ifconfig): Likewise. + (builtin_initrd): Likewise. + (builtin_kernel): Likewise. + (builtin_makeactive): Likewise. + (builtin_map): Likewise. + (builtin_md5crypt): Likewise. + (builtin_module): Likewise. + (builtin_modulenounzip): Likewise. + (builtin_partnew): Likewise. + (builtin_parttype): Likewise. + (builtin_quit): Likewise. + (builtin_rarp): Likewise. + (builtin_reboot): Likewise. + (builtin_root): Likewise. + (builtin_rootnoverify): Likewise. + (builtin_serial): Likewise. + (builtin_setkey): Likewise. + (builtin_setup): Likewise. + (builtin_terminal): Likewise. + (builtin_testvbe): Likewise. + (builtin_tftpserver): Likewise. + (builtin_unhide): Likewise. + (builtin_uppermem): Likewise. + (builtin_vbeprobe): Likewise. + + (help_func): When no argument is specified, if the last entry + was at the left column, print an extra newline. + +2002-02-05 Yoshinori K. Okuji + + * stage2/shared.h (BUILTIN_HIDDEN): Renamed to ... + (BUILTIN_NO_ECHO): ... this. The old name was too difficult to + see _what_ was hidden. + +2002-02-05 Yoshinori K. Okuji + + * netboot/misc.c (twiddle): Go back to the bar progress, copied + from etherboot-5.0.5/src/misc.c. Execute the code only if DEBUG + is true. + +2002-02-05 Yoshinori K. Okuji + + * stage2/builtins.c (displaymem_func): Use hex digits to display + for consistency. + +2002-02-04 Jason Thomas + + From Denis Kitzman : + * stage2/Makefile.am (libgrub_a_CFLAGS): Fixed a typo. + FSYS_XFS, USE_MD5_PASSWORDS, SUPPORT_SERIAL, and + SUPPORT_HERCULES did not get defined. + +2002-01-20 Yoshinori K. Okuji + + * util/grub-image.in: Check stage2 instead of stage2.c to + determine where the script is invoked, because srcdir may not + be used for the compilation. + +2002-01-20 Yoshinori K. Okuji + + * grub/asmstub.c (console_putchar): When not using curses, + ignore a carriage return, because a newline in Unix is only a + line feed. + +2002-01-18 Klaus Reichl + + * stage2/fsys_minix.c (minix_dir): Fixed bug getting filenames + with MAXNAMELEN right. + + * stage2/char_io.c (get_cmdline, cl_refresh): If TERMINAL_DUMB + section is always 0. + Line is only cleared if !TERMINAL_DUMB. + + * grub/main.c (use_curses): Initialize to 0 if !HAVE_LIBCURSES + (main): Check for curses use and set terminal to dumb if we + don't use it (helps for --batch and variants of non-curses + setup). + +2002-01-15 Yoshinori K. Okuji + + * configure.in (AM_INIT_AUTOMAKE): The version number is + upgraded to 0.91. + +2002-01-15 Yoshinori K. Okuji + + * docs/grub.texi (Preset Menu): New chapter. + +2002-01-15 Yoshinori K. Okuji + + * docs/grub.texi: Added some text about JFS and XFS. + +2002-01-08 Yoshinori K. Okuji + + * grub/main.c (use_preset_menu): New variable. + (OPT_PRESET_MENU): New macro. + (longopts): Added an entry for "--preset-menu". + (usage): Added a description for "--preset-menu". Also, change + the first character of the description for "--device-map" to + lower case for consistency. + (main): Set USE_PRESET_MENU to 1 in the case of OPT_PRESET_MENU. + * stage2/shared.h (use_preset_menu): Declared. + * stage2/stage2.c [PRESET_MENU_STRING || SUPPORT_DISKLESS] + (open_preset_menu) [GRUB_UTIL]: If USE_PRESET_MENU is false, + return zero immediately. + +2002-01-08 Yoshinori K. Okuji + + * stage2/common.c [SUPPORT_DISKLESS] + (setup_diskless_environment): Removed. The feature is moved to + the preset menu. + * stage2/stage2.c [SUPPORT_DISKLESS] (preset_menu): Set to the + string "bootp\n". + [SUPPORT_DISKLESS] (preset_menu_offset): Defined, as if + PRESET_MENU_STRING is defined. + [SUPPORT_DISKLESS] (open_preset_menu): Likewise. + [SUPPORT_DISKLESS] (read_from_preset_menu): Likewise. + [SUPPORT_DISKLESS] (close_preset_menu): Likewise. + +2002-01-06 Yoshinori K. Okuji + + The preset menu has a priority over the configuration file. + Suggested by Christoph Plattner. + + * stage2/stage2.c [PRESET_MENU_STRING] (open_preset_menu): + Check if PRESET_MENU is not NULL. + [PRESET_MENU_STRING] (close_preset_menu): Set PRESET_MENU to + NULL. + (cmain): New internal function, reset. This function resets + AUTO_FILL, CONFIG_LEN, MENU_LEN, NUM_ENTRIES, CONFIG_ENTRIES, + MENU_ENTRIES and call init_config. + Try to open the preset menu first, and try to open the + configuration file, only if that failed. + Even if the preset menu was read, try to open the configuration + file. This time, opening the preset menu never succeed, because + close_preset_menu ensures that the preset menu is available at + most once. + +2002-01-06 Yoshinori K. Okuji + + * netboot/misc.c (inet_aton): Don't check if *P is an asterisk, + if I is 3. Reported by Rick (his real name and address are + unknown). + +2002-01-03 Yoshinori K. Okuji + + Update the netboot stuff to Etherboot-5.0.5. + + * configure.in (--enable-3c590): Removed. This was a mistake. + (--enable-davicom): New option. + (--enable-eepro): Likewise. + (--enable-natsemi): Likewise. + (--enable-ni5010): Likewise. + (--enable-sis900): Likewise. + (--enable-w89c840): Likewise. + (--enable-3c509-hack): Removed. + (--enable-ns8390-force-16bit): Likewise. + + * netboot/Makefile.am (libdrivers_a_SOURCES): Added timer.c and + timer.h. + (EXTRA_libdrivers_a_SOURCES): Added davicom.c, eepro.c, fa311.c, + natsemi.c, ni5010.c, sis900.c, sis900.h, tlan.c and w89c840.c. + (EXTRA_DIST): Added sis900.txt. + (3c595_drivers): Remove 3c590.o from this. + (davicom_drivers): New variable. + (eepro_drivers): Likewise. + (natsemi_drivers): Likewise. + (ni5010_drivers): Likewise. + (sis900_drivers): Likewise. + (w89c840_drivers): Likewise. + (3c590_o_CFLAGS): Removed. + (davicom_o_CFLAGS): New variable. + (eepro_o_CFLAGS): Likewise. + (natsemi_o_CFLAGS): Likewise. + (ni5010_o_CFLAGS): Likewise. + (sis900_o_CFLAGS): Likewise. + (w89c840_o_CFLAGS): Likewise. + + * netboot/davicom.c: New file, from Etherboot-5.0.5. + * netboot/eepro.c: Likewise. + * netboot/natsemi.c: Likewise. + * netboot/ni5010.c: Likewise. + * netboot/sis900.c: Likewise. + * netboot/sis900.h: Likewise. + * netboot/sis900.txt: Likewise. + * netboot/timer.c: Likewise. + * netboot/timer.h: Likewise. + * netboot/w89c840.c: Likewise. + * netboot/fa311.c: Likewise. + * netboot/tlan.c: Likewise. + + * netboot/3c509.c: Copied from Etherboot-5.0.5. + * netboot/3c509.h: Likewise. + * netboot/3c595.c: Likewise. + * netboot/3c90x.c: Likewise. + * netboot/3c90x.txt: Likewise. + * netboot/cards.h: Likewise. + * netboot/cs89x0.c: Likewise. + * netboot/depca.c: Likewise. + * netboot/eepro100.c: Likewise. + * netboot/epic100.c: Likewise. + * netboot/i82586.c: Likewise. + * netboot/lance.c: Likewise. + * netboot/linux-asm-string.h: Likewise. + * netboot/nic.h: Likewise. + * netboot/ns8390.c: Likewise. + * netboot/ns8390.h: Likewise. + * netboot/otulip.c: Likewise. + * netboot/pci.h: Likewise. + * netboot/rtl8139.c: Likewise. + * netboot/sk_g16.c: Likewise. + * netboot/smc9000.c: Likewise. + * netboot/tiara.c: Likewise. + * netboot/tulip.c: Likewise. + * netboot/via-rhine.c: Likewise. + + * netboot/config.c: Applied a diff between Etherboot-4.6.4 and + Etherboot-5.0.5 manually. + * netboot/main.c: Likewise. + * netboot/pci.c: Likewise. + * netboot/etherboot.h: Rewritten mostly from scratch, based on + the same file in Etherboot-5.0.5. + * netboot/misc.c: Likewise. + * netboot/osdep.h: Likewise. + * netboot/fsys_tftp.c (GRUB): Defined. + (buf_fill): Use rfc2131_sleep_interval instead of rfc951_sleep. + + * stage2/builtins.c [SUPPORT_NETBOOT] (GRUB): Defined. + (boot_func) [SUPPORT_NETBOOT]: Call cleanup_net. + * stage2/cmdline.c [SUPPORT_DISKLESS] (GRUB): Defined. + * stage2/common.c [SUPPORT_DISKLESS] (GRUB): Likewise. + +2002-01-02 Jeremy Katz + + * util/grub-install.in: Support using mktemp as well as tempfile + for secure temporary file creation. + +2002-01-02 Jeremy Katz + + * stage2/md5.c (md5_password): Ensure the password exists before + trying to check against the md5 crypted version. + +2001-12-30 Yoshinori K. Okuji + + * stage1/stage1.S: Don't call INT 13, AH=48H, because it is + difficult to call this function with the workaround implemented + in the previous change due to the size limit of Stage 1. + + (lba_mode) [NO_BUGGY_BIOS_IN_THE_WORLD]: Don't check the + geometry explicitly. This shouldn't be harmful, as INT 13, + AH=42H should take care of it, and if you cannot read Stage 2 + even with LBA because of a geometry problem, you can never read + it. + + * stage2/start.S (lba_mode) [NO_BUGGY_BIOS_IN_THE_WORLD]: + Likewise. + +2001-12-30 Yoshinori K. Okuji + + * stage2/bios.c (get_diskinfo): Clear out the structure DRP + before calling get_diskinfo_int13_extensions, because the Ralf + Brown's Interrupt List says that Dell machines using PhoenixBIOS + 4.0 Release 6.0 fail, if DRP.FLAGS is not zero. Setting the + entire structure to zero may be overkill, but it should be safe. + + * stage2/char_io.c [STAGE1_5] (grub_memset): Defined. + +2001-12-30 Yoshinori K. Okuji + + From John Goerzen : + * util/grub-install.in (convert): Added NetBSD support. + +2001-12-30 Yoshinori K. Okuji + + * util/grub-install.in: Set GRUB_PREFIX and BOOTDIR to "/grub" + and "${rootdir}" respectively in NetBSD. + +2001-12-30 Yoshinori K. Okuji + + * stage2/builtins.c (builtin_geometry): Add extra space + characters into the long description. + (builtin_kernel): Likewise. + (builtin_vbeprobe): Likewise. + +2001-12-19 Yoshinori K. Okuji + + From Michael Sullivan : + * stage1/stage1.S (real_start): Added a workaround for AST BIOS, + because it clobbers %dl with INT 13, AH=41H. + +2001-12-19 Yoshinori K. Okuji + + * stage2/fsys_fat.c (fat_read): Fix the contradictory comment. + Reported by Filip Van Raemdonck . + +2001-12-11 Yoshinori K. Okuji + + * stage2/builtins.c (displayapm_func): Don't use multi-line + string literals but string concatenation instead, to suppress + warnings from gcc-3.0.x. + * stage2/cmdline.c (print_cmdline_message): Likewise. + * util/mbchk.c (usage): Likewise. + + * stage2/smp-imps.c (imps_read_config_table): Add a break + statement after the label ``default''. + + * util/mbchk.c: Include for the prototype of exit. + + * stage2/serial.c (serial_port): Initialize with 0 instead of + -1, as an invalid value, because SERIAL_PORT is unsigned. This + change shouldn't affect anything. + (serial_exists): For the above change, check SERIAL_PORT with 0 + instead of -1. + +2001-12-10 Yoshinori K. Okuji + + * stage2/shared.h (ERR_NO_DISK_SPACE): New constant. + * stage2/common.c (err_list): Added an entry for + ERR_NO_DISK_SPACE. + * docs/grub.texi (Stage2 errors): Added the description. + * stage2/builtins.c (embed_func): Use ERR_NO_DISK_SPACE instead + of ERR_DEV_VALUES when the spare space is too small. Suggested + by Eric Mumpower . + +2001-12-10 Yoshinori K. Okuji + + * grub/asmstub.c: Include . + (grub_stage2) [HAVE_LIBCURSES]: If USE_CURSES is true, ignore + the signal SIGWINCH. Reported by Christian Hudon + . + +2001-11-29 Yoshinori K. Okuji + + From Jason Thomas: + * stage2/disk_io.c (set_partition_hidden_flag): Complete rewrite + of this function which now supports logical partitions. + +2001-11-12 Yoshinori K. Okuji + + * docs/grub.texi: The copyright of this file is only held by + Free Software Foundation, Inc., as Erich Boleyn has assigned his + copyright to the FSF. + * stage1/stage1.S: Likewise. + * stage2/asm.S: Likewise. + * stage2/boot.c: Likewise. + * stage2/builtins.c: Likewise. + * stage2/char_io.c: Likewise. + * stage2/cmdline.c: Likewise. + * stage2/common.c: Likewise. + * stage2/disk_io.c: Likewise. + * stage2/fat.h: Likewise. + * stage2/filesys.h: Likewise. + * stage2/freebsd.h: Likewise. + * stage2/fsys_ext2fs.c: Likewise. + * stage2/fsys_fat.c: Likewise. + * stage2/fsys_ffs.c: Likewise. + * stage2/gunzip.c: Likewise. + * stage2/i386-elf.h: Likewise. + * stage2/mb_header.h: Likewise. + * stage2/mb_info.h: Likewise. + * stage2/pc_slice.h: Likewise. + * stage2/shared.h: Likewise. + * stage2/stage1_5.c: Likewise. + * stage2/stage2.c: Likewise. + * stage2/start.S: Likewise. + +2001-11-07 Yoshinori K. Okuji + + * stage2/builtins.c (terminal_func) [!SUPPORT_SERIAL]: Disable + the wait code, as it is usable only when serial support is on. + Reported by Karl Hammar . + +2001-10-27 Yoshinori K. Okuji + + JFS and XFS support is added. + + From Serguei Tzukanov : + * configure.in (--disable-jfs): New option. + (--disable-xfs): Likewise. + * stage2/Makefile.am (noinst_HEADERS): Added jfs.h and xfs.h. + (libgrub_a_SOURCES): Added fsys_jfs.c and fsys_xfs.c. + (libgrub_a_CFLAGS): Added -DFSYS_JFS=1 and -DFSYS_XFS=1. + (pkgdata_DATA): Added jfs_stage1_5 and xfs_stage1_5. + (noinst_PROGRAMS): Added jfs_stage1_5.exec and + xfs_stage1_5.exec. + (pre_stage2_exec_SOURCES): Added fsys_jfs.c and fsys_xfs.c. + (jfs_stage1_5_exec_SOURCES): New variable. + (jfs_stage1_5_exec_CFLAGS): Likewise. + (jfs_stage1_5_exec_ASFLAGS): Likewise. + (jfs_stage1_5_exec_LDFLAGS): Likewise. + (xfs_stage1_5_exec_SOURCES): Likewise. + (xfs_stage1_5_exec_CFLAGS): Likewise. + (xfs_stage1_5_exec_ASFLAGS): Likewise. + (xfs_stage1_5_exec_LDFLAGS): Likewise. + * stage2/builtins.c (setup_func): Add items for JFS and XFS into + STAGE1_5_MAP. + * stage2/disk_io.c (fsys_table): Added entries for JFS and XFS. + * stage2/filesys.h [FSYS_JFS] (FSYS_JFS_NUM): Set to 1. + [FSYS_JFS] (jfs_mount): Declared. + [FSYS_JFS] (jfs_read): Likewise. + [FSYS_JFS] (jfs_dir): Likewise. + [FSYS_JFS] (jfs_embed): Likewise. + [!FSYS_JFS] (FSYS_JFS_NUM): Set to 0. + [FSYS_XFS] (FSYS_XFS_NUM): Set to 1. + [FSYS_XFS] (xfs_mount): Declared. + [FSYS_XFS] (xfs_read): Likewise. + [FSYS_XFS] (xfs_dir): Likewise. + (NUM_FSYS): Added FSYS_JFS_NUM and FSYS_XFS_NUM. + * stage2/shared.h (STAGE2_ID_JFS_STAGE1_5): New macro. + (STAGE2_ID_XFS_STAGE1_5): Likewise. + [FSYS_JFS] (STAGE2_ID): Set to STAGE2_ID_JFS_STAGE1_5. + [FSYS_XFS] (STAGE2_ID): Set to STAGE2_ID_XFS_STAGE1_5. + * stage2/fsys_jfs.c: New file. + * stage2/fsys_xfs.c: Likewise. + * stage2/jfs.h: Likewise. + * stage2/xfs.h: Likewise. + +2001-10-27 Yoshinori K. Okuji + + * stage2/apm.S: Always disconnect from APM. Written by Erich + Stefan Boleyn. + + * util/Makefile.am (noinst_DATA): Removed. + (EXTRA_DIST): Likewise. + +2001-10-14 Gordon Matzigkeit + + * configure.in: Explicitly call _AM_DEPENDENCIES(CC) for the + benefit of older Autoconfs. + +2001-10-13 Yoshinori K. Okuji + + * netboot/fsys_tftp.c (tftp_read): Move the unused data + forwards, only if AMT is more than zero. If AMT is not positive, + subtract BUF_READ from SAVED_FILEPOS and set BUF_READ to zero, + to skip the whole buffer. Reported by Frank Mehnert. + +2001-10-13 Yoshinori K. Okuji + + Don't use get_diskinfo_floppy. Reported by Ben Liblit + . + + * stage2/asm.S (get_diskinfo_floppy): Removed (by cpp). + * stage2/bios.c (get_diskinfo_floppy): Removed. + (get_diskinfo): Don't call get_diskinfo_floppy any longer. + +2001-10-13 Yoshinori K. Okuji + + Based on a patch from Jeremy Katz : + * docs/grub.texi (Stage2 errors): Added documentation on the + error number 33 (Serial device not configured). + * grub/asmstub.c (serial_exists): New function. + * stage2/serial.c (serial_exists): Likewise. + * stage2/serial.h (serial_exists): New prototype. + * stage2/shared.h (grub_error_t): ERR_NEED_SERIAL is added. + * stage2/builtins.c (terminal_func) [SUPPORT_SERIAL]: If a + serial device is not configured yet, restore the terminal and + set ERRNUM to ERR_NEED_SERIAL. + * stage2/common.c (err_list): Added an item for ERR_NEED_SERIAL. + +2001-10-13 Yoshinori K. Okuji + + From Jason Thomas : + * util/grub-install.in (convert): Add support for DAC960. + + From Adrian Phillips : + * lib/device.c (get_dac960_disk_name): New function. + (init_device_map) [__linux__]: Add support for DAC960. + +2001-10-11 Jochen Hoenicke + + * stage2/fsys_reiserfs.c (reiserfs_super_block): Updated + to better match recent reiserfs versions. + (reiserfs_mount): Handle cases where journal can't be found, + e.g. journal on another disk or unexpected journal parameters. + In that case the journal isn't used. + +2001-10-10 Jochen Hoenicke + + * stage2/fsys_reiserfs.c (reiserfs_mount): Don't look at + the superblock field s_journal_block_count anymore. It used + to contain 0, it never contained a valid value, and now I + have a report that it can contain an invalid value. + Bug reported by Jim Caley . + +2001-09-24 Jochen Hoenicke + + * stage2/fsys_reiserfs.c (reiserfs_dir): Set errnum to + ERR_FSYS_CORRUPT if a symlink can't be read for some reason, + but no error is set by read. + +2001-08-08 OKUJI Yoshinori + + From Derrik Pates : + * stage2/asm.S [!STAGE1_5] (grub_halt): Set the level of APM + support to 1.1, before turning off the power state. + +2001-08-08 OKUJI Yoshinori + + * util/grub-md5-crypt.in: Prefix backquotes with backslashes in + strings. From Fernando Silveira. + +2001-08-02 Gordon Matzigkeit + + * stage2/common.c (init_bios_info): Ignore zero-length memory + ranges. From Derrik Pates . + +2001-07-26 Jochen Hoenicke + + * stage2/Makefile.am (libgrub_a_CFLAGS): Enable USE_MD5_PASSWORDS + for libgrub. Previously that was implicitly done by configure.in + until the patch from 2001-07-04, which moved that flag from CFLAGS + to FSYS_CFLAGS. Reported by YAMAGUCHI Shingo + + +2001-07-13 OKUJI Yoshinori + + * util/grub-install.in (convert): Recognize the naming scheme + for Linux devfs floppy devices. Reported by Jason Thomas + . + +2001-07-07 OKUJI Yoshinori + + * netboot/compile: New file. This was also missing... How many + ``compile''s does automake want? + +2001-07-07 OKUJI Yoshinori + + From Jan Zerebecki : + * acinclude.m4 (grub_DEFINE_FILE): Escape double-quotations as + well. + +2001-07-05 OKUJI Yoshinori + + * configure.in (AM_INIT_AUTOMAKE): Set the version number to + 0.90. + +2001-07-05 OKUJI Yoshinori + + Ughh! I forgot to add this file to the CVS. + + * docs/compile: New file. + +2001-07-05 OKUJI Yoshinori + + * docs/grub.texi: Updated. + +2001-07-05 OKUJI Yoshinori + + * stage2/boot.c (load_initrd) [!NO_DECOMPRESSION]: Set + NO_DECOMPRESSION to one before opening INITRD, so that GRUB + doesn't decompress an initrd automatically. Reported by + Thierry Laronde. + +2001-07-04 OKUJI Yoshinori + + * stage2/compile: New file. + * docs/mdate-sh: Likewise. + * docs/texinfo.tex: Likewise. + * compile: Removed. + * mdate-sh: Likewise. + * texinfo.tex: Likewise. + * config.guess: Updated from automake-1.4h. + * config.sub: Likewise. + * depcomp: Likewise. + * install-sh: Likewise. + * missing: Likewise. + * mkinstalldirs: Likewise. + * configure.in (AS): New variable. + (ASFLAGS): Likewise. + (--disable-md5-password): Use FSYS_CFLAGS instead of CFLAGS. + * stage1/Makefile.am (AM_CFLAGS): Renamed to ... + (AM_ASFLAGS): ... this. + * stage2/Makefile.am (pre_stage2_exec_ASFLAGS): New variable. + (start_exec_CFLAGS): Renamed to ... + (start_exec_ASFLAGS): ... this. + (start_exec-start.o): Renamed to ... + (start_exec-start.$(OBJEXT)): ... this. + (e2fs_stage1_5_exec_ASFLAGS): New variable. + (fat_stage1_5_exec_ASFLAGS): Likewise. + (ffs_stage1_5_exec_ASFLAGS): Likewise. + (minix_stage1_5_exec_ASFLAGS): Likewise. + (reiserfs_stage1_5_exec_ASFLAGS): Likewise. + (vstafs_stage1_5_exec_ASFLAGS): Likewise. + (diskless_exec_ASFLAGS): Likewise. + (nbloader_exec_CFLAGS): Renamed to ... + (nbloader_exec_ASFLAGS): ... this. + (nbloader_exec-nbloader.o): Renamed to ... + (nbloader_exec-nbloader.$(OBJEXT)): ... this. + (pxeloader_exec_CFLAGS): Renamed to ... + (pxeloader_exec_ASFLAGS): ... this. + (pxeloader_exec-pxeloader.$(OBJEXT)): New target. + +2001-07-03 OKUJI Yoshinori + + From Julien Bordet : + * stage2/i386-elf.h (Elf32_Shdr): New type. + * stage2/boot.c (load_image): Added ELF symbol loading support. + +2001-06-22 OKUJI Yoshinori + + * stage2/char_io.c [STAGE1_5] (grub_strcmp): Defined, even + for Stage 1.5. See thecomment, for a possible future strategy. + * stage2/fsys_vstafs.c [!FSYS_VSTAFS]: Don't define anything. + [STAGE1_5] (grub_strcmp): Removed. + (get_file_info): Made static. + (vstafs_readdir): Likewise. + (vstafs_nextdir): Likewise. + (curr_ext): Likewise. + (current_direntry): Likewise. + (current_blockpos): Likewise. + (a): Likewise. + +2001-06-22 OKUJI Yoshinori + + VSTa filesystem support is added. + + From Kristoffer Brånemyr : + * stage2/configure.in (--disable-vstafs): New option. + * stage2/Makefile.am (noinst_HEADERS): Added vstafs.h. + (libgrub_a_SOURCES): Added fsys_vstafs.c. + (libgrub_a_CFLAGS): Added -DFSYS_VSTAFS=1. + (pkgdata_DATA): Added vstafs_stage1_5. + (noinst_PROGRAMS): Added vstafs_stage1_5.exec. + (pre_stage2_exec_SOURCES): Added fsys_vstafs.c. + (vstafs_stage1_5_exec_SOURCES): New variable. + (vstafs_stage1_5_exec_CFLAGS): Likewise. + (vstafs_stage1_5_exec_LDFLAGS): Likewise. + * stage2/disk_io.c (fsys_table): Added an entry for vstafs. + * stage2/filesys.h [FSYS_VSTAFS] (FSYS_VSTAFS_NUM): Defined as + 1. + [FSYS_VSTAFS] (vstafs_mount): New prototype. + [FSYS_VSTAFS] (vstafs_read): Likewise. + [FSYS_VSTAFS] (vstafs_dir): Likewise. + [!FSYS_VSTAFS] (FSYS_VSTAFS_NUM): Defined as 0. + (NUM_FSYS): Added FSYS_VSTAFS_NUM. + * stage2/pc_slice.h (PC_SLICE_TYPE_VSTAFS): New macro. + * stage2/shared.h (STAGE2_ID_VSTAFS_STAGE1_5): Likewise. + [STAGE1_5 && FSYS_VSTAFS] (STAGE2_ID): Defined as + STAGE2_ID_VSTAFS_STAGE1_5. + * stage2/vstafs.h: New file. + * stage2/fsys_vstafs.c: Likewise. + +2001-06-22 OKUJI Yoshinori + + From Thierry Laronde : + * stage2/builtins.c (configfile_func): Added a prototype. + (bootp_func): If `--with-configfile' is given, set + WITH_CONFIGFILE to one, and call configfile_func with + CONFIG_FILE. + +2001-06-21 OKUJI Yoshinori + + * docs/grub.texi: Update the location of the CVS repository + [/home/cvs -> /cvsroot/grub]. + * README: Likewise. + +2001-06-19 OKUJI Yoshinori + + * stage2/boot.c (load_image): If the image is a Multiboot ELF OS + image, get the physical entry address, when a loaded memory + segment contains it. And, set ENTRY_ADDR to it, after printing + out the virtual one. Suggested by Rogelio M. Serrano Jr. + . + +2001-05-30 OKUJI Yoshinori + + * docs/grub.texi: Fix some typos. Reported by Florian Hatat + . + +2001-05-29 Pavel Roskin + + * configure.in (AC_OUTPUT): Remove debian/Makefile. + +2001-05-28 Gordon Matzigkeit + + * Makefile.am (SUBDIRS): Remove reference to debian directory. + Packaging is no longer done by the GRUB team. + +2001-05-03 Gordon Matzigkeit + + * stage1/stage1.S (nt_magic): Explicitly reserve space for the NT + magic number. + +2001-05-25 Klaus Reichl + + * stage2/stage2.c (print_entries_raw): New function. + (run_menu): Use it to implement menu & command-list if on dumb + terminals. + Changes are: + Adjust FIRST_ENTRY only on non-dumb terminals. + Setting of SHOW_MENU is honoured also on dumb + terminals. + Likely if SHOW_MENU is false, ESC brings her to the + menu - not to the command-line as before. + PRINT_BORDER, GOTOXY, SET_LINE_xxx are only called if + not on dumb terminals. + Show entry number when timeout is running if terminal is dumb. + Prompt with entry number when waiting for keys. + +2001-05-14 Pavel Roskin + + * stage2/shared.h (ENTRY): Remove unnecessary `##'. + +2001-05-03 Jochen Hoenicke + + * grub/asmstub.c (biosdisk): Work around a bug in linux's ez + remapping. Problem reported by Ben Byer . + +2001-03-28 Gordon Matzigkeit + + * stage2/boot.c (load_image): Don't cast entry_addr to an int, or + the top bit will be interpreted as the sign. + +2001-03-16 OKUJI Yoshinori + + From Bodo Rueskamp : + * stage2/boot.c (load_initrd): Avoid the last 64kb for + Linux 2.2.x bug. + +2001-03-03 OKUJI Yoshinori + + * docs/multiboot.texi (History): Written. + +2001-02-28 OKUJI Yoshinori + + From HASEGAWA Tomoki : + * lib/device.c (get_ide_disk_name) [__FreeBSD__]: Add support + for FreeBSD-4.0 or later. Use "/dev/rad0". + * util/grub-install.in (convert): Add code for FreeBSD + disklabels. + +2001-02-28 OKUJI Yoshinori + + From Thierry Laronde : + * stage2/stage2.c (cmain): If the default entry is wrong, set it + to FALLBACK_ENTRY if FALLBACK_ENTRY is valid, otherwise set it + to zero. Suggested by Nicolas Boos . + +2001-02-28 OKUJI Yoshinori + + * acconfig.h (AUTO_LINUX_MEM_OPT): New entry. + * configure.in (--disable-auto-linux-mem-opt): New option. + * stage2/builtins.c (kernel_func) [!AUTO_LINUX_MEM_OPT]: Add + KERNEL_LOAD_NO_MEM_OPTION into LOAD_FLAGS, whether the user + specifies --no-mem-option or not. + +2001-02-27 OKUJI Yoshinori + + * stage2/builtins.c (chainloader_func): Don't check if the + current partition is FAT, but check if it has a FAT partition + type and the BPB has a system id starting with "MSWIN". + +2001-02-27 OKUJI Yoshinori + + Added hercules support based on a patch by Frank Mehnert + . I translated his assembly code into + C, and separated hercules from the normal console. + + * configure.in (--disable-hercules): New option. + + * grub/asmstub.c: Include . + (set_attrib): Renamed to ... + (console_set_attrib): ... this. + (herc_cls): New function. + (herc_getxy): Likewise. + (herc_gotoxy): Likewise. + (herc_putchar): Likewise. + (herc_set_attrib): Likewise. + + * stage2/Makefile.am (noinst_HEADERS): Added hercules.h. + (libgrub_a_CFLAGS): Added -DSUPPORT_HERCULES=1. + (HERCULES_FLAGS): New variable. + (STAGE2_COMPILE): Added $(HERCULES_FLAGS). + (pre_stage2_exec_SOURCES): Added hercules.c. + * stage2/asm.S [!STAGE1_5] (set_attrib) Renamed to ... + [!STAGE1_5] (console_set_attrib): ... this. + * stage2/builtins.c [SUPPORT_HERCULES] (terminal_func): Added + hercules support. + (builtin_table) [SUPPORT_HERCULES]: Added a pointer to + BUILTIN_TERMINAL. + * stage2/char_io.c [SUPPORT_HERCULES]: Include . + [!STAGE1_5] (get_cmdline) [SUPPORT_HERCULES]: Added hercules + support. + [!STAGE1_5] (getkey) [SUPPORT_HERCULES]: Likewise. + [!STAGE1_5] (checkkey) [SUPPORT_HERCULES]: Likewise. + (grub_putchar) [SUPPORT_HERCULES]: Likewise. + [!STAGE1_5] (gotoxy) [SUPPORT_HERCULES]: Likewise. + [!STAGE1_5] (getxy) [SUPPORT_HERCULES]: Likewise. + [!STAGE1_5] (cls) [SUPPORT_HERCULES]: Likewise. + (set_attrib): New function. + * stage2/shared.h (console_set_attrib): Declared. + (TERMINAL_HERCULES): New macro. + * stage2/stage2.c (run_menu) [SUPPORT_HERCULES]: Added hercules + support. + * stage2/hercules.h: New file. + * stage2/hercules.c: Likewise. + +2001-02-17 OKUJI Yoshinori + + From "Treutwein; Bernhard" + : + * docs/grub.texi (DOS/Windows): Improved the readability. + +2001-02-11 OKUJI Yoshinori + + * docs/grub.texi (Command-line and menu commands): Renamed to ... + (General commands): ... this. + +2001-02-08 OKUJI Yoshinori + + * stage2/asm.S [STAGE1_5] (chain_stage2): Save the second sector + of stage2 in %ecx temporarily, and set %ebp to %ecx after + switching to protected mode. I forgot that %ebp is broken by + rot_to_real. Reported by Torvald Riegel + . + +2001-02-08 OKUJI Yoshinori + + * docs/grub-new.texi: Moved to ... + * docs/grub.texi: ... here. And, include internals.texi. + * docs/internals.texi: New file. + * docs/prog-ref.texi: Removed. + * docs/user-ref.texi: Likewise. + * docs/tutorial.texi: Likewise. + * docs/appendices.texi: Likewise. + * docs/Makefile.am (grub_TEXINFOS): Removed prog-ref.texi, + user-ref.texi, tutorial.texi, and appendices.texi. Added + internals.texi. + +2001-02-03 OKUJI Yoshinori + + From Erik Schoenfelder : + * stage2/shared.h (LINUX_INITRD_MAX_ADDRESS): Changed from + 0x3C000000 to 0x38000000. + +2001-02-03 OKUJI Yoshinori + + * stage2/builtins.c (savedefault_func) + [!SUPPORT_DISKLESS && !GRUB_UTIL]: Check if the version + contained in the buffer matches to current one as well. + +2001-02-02 OKUJI Yoshinori + + * stage2/builtins.c (savedefault_func) + [!SUPPORT_DISKLESS && !GRUB_UTIL]: Check if the stage2 id is + STAGE2_ID_STAGE2. Suggested by Jochen Hoenicke. + + * stage2/stage2.c (cmain): If DEFAULT_ENTRY is out of entries, + reset DEFAULT_ENTRY to zero. + +2001-02-02 OKUJI Yoshinori + + Make savedefault workable even with Stage 1.5. Reported by + Thierry Laronde . + + * grub/asmstub.c (chain_stage2): Added an additional argument, + SECOND_SECTOR. + * stage2/asm.S [STAGE1_5] (chain_stage2): Set %ebp to + SECOND_SECTOR. + * stage2/disk_io.c [STAGE1_5] (disk_read_hook): Defined. + [STAGE1_5] (disk_read_func): Likewise. + (rawread) [STAGE1_5]: Handle DISK_READ_FUNC. + (grub_read) [STAGE1_5]: Likewise. + * stage2/fsys_ext2fs.c (ext2fs_read) [STAGE1_5]: Likewise. + * stage2/fsys_fat.c (fat_read) [STAGE1_5]: Likewise. + * stage2/fsys_ffs.c (ffs_read) [STAGE1_5]: Likewise. + * stage2/fsys_minix.c (minix_read) [STAGE1_5]: Likewise. + * stage2/fsys_reiserfs.c (reiserfs_read) [STAGE1_5]: Likewise. + +2001-02-02 OKUJI Yoshinori + + * netboot/config.c [GRUB && INCLUDE_PCI] (pci_dispatch_table): + New structure. + [GRUB && INCLUDE_PCI] (PCI_NIC): New variable. + (eth_probe) [GRUB && INCLUDE_PCI]: If a PCI NIC candidate is + present, probe it first. + +2001-01-27 OKUJI Yoshinori + + From Danilo Godec : + * stage2/pc_slice.h (PC_SLICE_TYPE_LINUX_RAID): New macro. + * stage2/fsys_ext2fs.c (ext2fs_mount): Add a check for + PC_SLICE_LINUX_RAID. + +2001-01-27 OKUJI Yoshinori + + From Bernhard Treutwein + : + * docs/grub-new.texi (DOS/Windows): Made more readable. + +2001-01-27 OKUJI Yoshinori + + * docs/multiboot.texi: Start reorganizing Multiboot + Specification. + +2001-01-15 OKUJI Yoshinori + + From Thierry Laronde : + * docs/user-ref.texi (Command-line and menu commands): Update + the description about setkey. + * stage2/builtins.c (setkey_func): When checking if TO_KEY and + FROM_KEY are specified, see *TO_KEY and *FROM_KEY instead of + TO_KEY and FROM_KEY, respectively. + +2001-01-13 OKUJI Yoshinori + + From Thierry Laronde : + * util/grub-md5-crypt.in (prefix): New variable. + (exec_prefix): Likewise. + (sbindir): Likewise. + +2001-01-12 OKUJI Yoshinori + + * docs/multiboot.h [__ELF__] (MULTIBOOT_HEADER_FLAGS): Defined + as 0x00000003 instead of 0x00010003. + * docs/boot.S (multiboot_header) [__ELF__]: Don't define a.out + kludge information. + + * docs/Makefile.am (EXTRA_PROGRAMS): New variable. + [BUILD_EXAMPLE_KERNEL] (noinst_DATA): Removed. + [BUILD_EXAMPLE_KERNEL] (noinst_PROGRAMS): Changed to kernel. + [BUILD_EXAMPLE_KERNEL] (kernel_exec_SOURCES): Renamed to ... + [BUILD_EXAMPLE_KERNEL] (kernel_SOURCES): ... this. + [BUILD_EXAMPLE_KERNEL] (kernel_exec_CFLAGS): Renamed to ... + [BUILD_EXAMPLE_KERNEL] (kernel_CFLAGS): ... this. + [BUILD_EXAMPLE_KERNEL] (kernel_exec_LDFLAGS): Renamed to ... + [BUILD_EXAMPLE_KERNEL] (kernel_LDFLAGS): ... this. + [BUILD_EXAMPLE_KERNEL] (kernel): Removed. + [BUILD_EXAMPLE_KERNEL] (boot.o): New dependency. + (CLEANFILES): New variable. + +2001-01-11 OKUJI Yoshinori + + * stage2/builtins.c [SUPPORT_NETBOOT] (ifconfig_func): Always + print current network configuration. + [SUPPORT_NETBOOT] (tftpserver_func): Use ifconfig instead of + arp_server_override. + * netboot/main.c (arp_server_override): Removed. + * netboot/etherboot.h (arp_server_override): Likewise. + +2001-01-11 Eugene Doudine + + * stage2/builtins.c [SUPPORT_NETBOOT] (ifconfig_func): New + function to configure network interface from command line. + [SUPPORT_NETBOOT] (builtin_ifconfig): New variable. + [SUPPORT_NETBOOT] (builtin_table): Added a pointer to + BUILTIN_IFCONFIG. + * netboot/main.c (ifconfig): New function. + * netboot/etherboot.h (ifconfig): Added the prototype. + +2001-01-11 OKUJI Yoshinori + + * docs/Makefile.am [BUILD_EXAMPLE_KERNEL] (noinst_DATA): New + variable. + [BUILD_EXAMPLE_KERNEL] (noinst_PROGRAMS): Likewise. + [BUILD_EXAMPLE_KERNEL] (kernel_exec_SOURCES): Likewise. + [BUILD_EXAMPLE_KERNEL] (kernel_exec_CFLAGS): Likewise. + [BUILD_EXAMPLE_KERNEL] (kernel_exec_LDFLAGS): Likewise. + [BUILD_EXAMPLE_KERNEL] (kernel): New target. + * configure.in (--enable-example-kernel): New option. + + * docs/kernel.c (cmain): Cast unsigned long variables to + unsigned explicitly, to suppress GCC warnings. + +2001-01-08 OKUJI Yoshinori + + * stage2/shared.h (BOOTSEC_BPB_HIDDEN_SECTORS): New macro. + + * stage2/builtins.c (chainloader_func): If CURRENT_PARTITION is + FAT, set the hidden sectors field of the BPB to PART_START, to + avoid a Windows bug which affects only when Windows is booted + from a logical partition. And, clear ERRNUM after testing if a + partition is FAT, because open_partition or fat_mount may set + ERRNUM. Reported by Ingo Korb . + +2001-01-07 OKUJI Yoshinori + + * stage2/builtins.c (boot_func): In the chain-loading mode, + clear the active flag of each of the loaded partition entries, + and then set the active flag of the booted partition image. + +2001-01-04 Jochen Hoenicke + + * stage2/builtins.c (embed_func): Call open_partition() even for + MBR, so that part_start is correct. This fixes a bug reported by + Matthias Granberry . + +2000-12-22 OKUJI Yoshinori + + * stage2/disk_io.c (make_saved_active): Change the variable name + ``MBR'' to lower case. + (set_partition_hidden_flag): Likewise. + +2000-12-20 Jochen Hoenicke + + From Cedric Ware : + * stage2/fsys_ext2.c (ext2fs_mount): Detect ext2 partitions in + a OpenBSD/NetBSD FS_EXT2FS slice. + * stage2/pc_slice.h (FS_ADOS): New Macro from OpenBSD/NetBSD. + (FS_HFS): Likewise. + (FS_FILECORE): Likewise. + (FS_EXT2FS): Likewise. + +2000-12-17 Jochen Hoenicke + + * stage2/disk_io.c (rawread): Check if there is a EZD partition + and remap sector 0 to sector 1 like EZ-BIOS does. + (rawwrite): New function to write to disk. Also does EZD + remapping. + (devwrite): New function. Does the special remapping to + partitions needed for linux. This contains the code that was + previously duplicated in embed_func and install_func at several + places. + (make_saved_active): Use rawwrite. Don't use SCRATCHSEG, as it is + needed by devwrite. + (set_partition_hidden_flag): Likewise. + * stage2/disk_io.h (rawwrite): New function. + (devwrite): Likewise. + * stage2/pc_slice.h (PC_SLICE_TYPE_EZD): New macro. + * stage2/builtins.c (embed_info): New variable to store the + position of the embedded stage1_5 for setup_func. + (embed_func): Don't embed after the MBR if an EZ-BIOS is detected + there. Use the new devwrite method. If embedding is successful + store position in embed_info. + (install_func): Use devwrite. Don't use SCRATCHSEG. + (partnew_func): Use rawwrite. Don't use SCRATCHSEG. + (parttype_func): Likewise. + (savedefault_func): Likewise. + (setup_func): New nested function embed_stage1_5. Stage1_5 is now + also be embedded into filesystems which supports that. + +2000-12-17 OKUJI Yoshinori + + * stage2/builtins.c (chainloader_func): Set ERRNUM to + ERR_EXEC_FORMAT, when ERRNUM is ERR_NONE, even if grub_read + fails in reading one sector. + +2000-12-14 OKUJI Yoshinori + + * docs/prog-ref.texi (Partition types): Rewrite the footnotes. + Suggested by Ralf.Medow@t-online.de (Ralf Medow). + +2000-12-14 OKUJI Yoshinori + + From Erik Schoenfelder : + * util/grub-install.in (convert): Revised the fix for floppy + device handling. + +2000-12-14 OKUJI Yoshinori + + From HORIKAWA Kazunori : + * stage2/bios.c (get_diskinfo): Append 16 bytes dummy data to + DRP, because the BIOS of Thinkpad X20 write a garbage beyond the + size of the structure. + +2000-12-09 Jochen Hoenicke + + * stage2/disk_io.c (next_partition): Mask out bsd partition sub + type when checking if last partition was a bsd partition. + Reported by Heikki Vatiainen . + +2000-12-09 OKUJI Yoshinori + + From Leendert Meyer : + * util/grub-install.in (convert): If a floppy device is + specified, remove everything from $tmp_part. + +2000-12-09 OKUJI Yoshinori + + * lib/device.c [__linux__] (write_to_partition): Use strcpy + instead of strcat, to overwrite "/disc". Reported by Thiago + Macieira . + +2000-12-05 Jochen Hoenicke + + * stage2/fsys_minix.c (minix_mount): Corrected the check for + IS_PC_SLICE_TYPE_MINIX; minix was only working if slice type was + wrong! Reported by Ralf Medow . + +2000-11-27 Jochen Hoenicke + + * stage2/fsys_reiserfs.c: Handle items with old version key on + new version reiserfs partition. + (K_OFFSET): Removed. + (IH_KEY_OFFSET): New Macro, which checks item head version. + (IH_KEY_ISOFFSET): Likewise. + (reiserfs_read): Use new macros. + (reiserfs_dir): Fixed version check for >4GB stat entries. + +2000-11-27 OKUJI Yoshinori + + * stage2/common.c (init_bios_info) [!STAGE1_5]: Don't call + track_int13, because the current implementation hangs up in some + environments. + +2000-11-27 OKUJI Yoshinori + + * grub/asmstub.c (serial_init) [!O_SYNC]: Don't specify O_SYNC + to open SERIAL_DEVICE. + (serial_init) [O_FSYNC]: Specify O_FSYNC to open SERIAL_DEVICE. + Reported by Farid Hajji . + +2000-11-22 OKUJI Yoshinori + + From Vesa Jaaskelainen : + * stage2/builtins.c (testvbe_func): Don't set the bit 14 of a + VBE mode number explicitly when calling get_vbe_mode_info. + (vbeprobe_func): Likewise. + +2000-11-22 OKUJI Yoshinori + + The code for the "INT 13H tracking technique" is somewhat + simplified. + + * stage2/asm.S [!STAGE1_5] (track_int13): Don't replace an int13 + handler with set_tf_int13_handler. Instead, track_int13 itself + emulates an int13 interrupt. + [!STAGE1_5] (set_tf_int13_handler): Removed. + [!STAGE1_5] (int1_handler): Use movzbw instead of xorb and movb. + +2000-11-15 OKUJI Yoshinori + + * acconfig.h (PRESET_MENU_STRING): New entry. + * acinclude.m4 (grub_DEFINE_FILE): New M4 macro. + * configure.in (--enable-preset-menu): New option. + * stage2/stage2.c [PRESET_MENU_STRING] (preset_menu): New + variable. + [PRESET_MENU_STRING] (preset_menu_offset): Likewise. + [PRESET_MENU_STRING] (open_preset_menu): New function. + [PRESET_MENU_STRING] (read_from_preset_menu): Likewise. + [PRESET_MENU_STRING] (close_preset_menu): Likewise. + [!PRESET_MENU_STRING] (open_preset_menu): New macro. + [!PRESET_MENU_STRING] (read_from_preset_menu): Likewise. + [!PRESET_MENU_STRING] (close_preset_menu): Likewise. + (get_line_from_config): Accept a new argument READ_FROM_FILE. + If it is false, read data from the preset menu instead. + (cmain): If grub_open fails in opening the configuration file, + then try to open the preset menu. + +2000-11-11 OKUJI Yoshinori + + From Jan Fricke : + * stage2/asm.S [!STAGE1_5] (set_vbe_mode): Add a missing `$' + prefix. + +2000-11-11 OKUJI Yoshinori + + * stage2/bios.c (get_diskinfo): If BIOS supports LBA but doesn't + return the correct total number of sectors, compute this by + C/H/S returned by get_diskinfo_int13_extensions instead of + get_diskinfo_standard. + +2000-11-09 OKUJI Yoshinori + + * stage2/disk_io.c (make_saved_active): Set ERRNUM to + ERR_DEV_VALUES instead of ERR_NO_PART, when the save partition + is not a primary partition. + +2000-11-05 OKUJI Yoshinori + + * docs/user-ref.texi (Features): Update the URL of grub/98. + +2000-11-03 OKUJI Yoshinori + + VBE support is _partially_ implemented. + + * stage2/mb_header.h (multiboot_header): Added new fields, + mode_type, width, height, and depth. + (MULTIBOOT_FOUND): Check if MULTIBOOT_VIDEO_MODE is set, and + check if LEN is greater than or equal to 48, if set. + (MULTIBOOT_UNSUPPORTED): Set to 0x0000FFF8. + (MULTIBOOT_VIDEO_MODE): New macro. + * stage2/mb_info.h (multiboot_info): Added new fields, + vbe_control_info, vbe_mode_info, vbe_mode, vbe_interface_seg, + vbe_interface_off, and vbe_interface_len. + (MB_INFO_VIDEO_INFO): New macro. + + * stage2/shared.h (vbe_controller): New structure. + (vbe_mode): Likewise. + (get_vbe_controller_info): Declared. + (get_vbe_mode_info): Likewise. + (set_vbe_mode): Likewise. + * stage2/asm.S [!STAGE1_5] (get_vbe_controller_info): New + function. + [!STAGE1_5] (get_vbe_mode_info): Likewise. + [!STAGE1_5] (set_vbe_mode): Likewise. + * grub/asmstub.c (get_vbe_controller_info): Likewise. + (get_vbe_mode_info): Likewise. + (set_vbe_mode): Likewise. + + * stage2/builtins.c (testvbe_func): New function. + (builtin_testvbe): New variable. + (vbeprobe_func): New function. + (builtin_vbeprobe): New variable. + (builtin_table): Added pointers to BUILTIN_TESTVBE and + BUILTIN_VBEPROBE. + +2000-11-01 OKUJI Yoshinori + + * docs/help2man: Copied from help2man-1.23. + +2000-10-29 OKUJI Yoshinori + + * stage2/asm.S [STAGE1_5]: Don't include setjmp.S or apm.S. + +2000-10-27 OKUJI Yoshinori + + * lib/device.c (read_device_map): Don't parse a line, if it is + empty. Reported by Holger Bauer . + +2000-10-25 Jochen Hoenicke + + * stage2/builtins.c (md5crypt_func): Use all bits of currticks () + to generate the salt. The old code would often produce the same + one character salt. + +2000-10-25 OKUJI Yoshinori + + * stage2/apm.S (get_apm_info): Fix a serious typo: prot_to_real + -> real_to_prot. Umm, I can't understand why it worked for me! + +2000-10-24 Jochen Hoenicke + + * stage2/builtins.c (setup_func): When invoking install with an + embedded stage1_5 give the path to menu.lst as real_config_file. + +2000-10-23 OKUJI Yoshinori + + * docs/multiboot.texi: Upgraded to 0.6.92. + (Boot information format): Re-designed the graphics table. + +2000-10-22 OKUJI Yoshinori + + * docs/tutorial.texi: Miscellaneous updates. + * docs/user-ref.texi: Likewise. + * docs/appendices.texi: Likewise. + +2000-10-22 OKUJI Yoshinori + + * util/grub-install.in (usage): Removed unnecessary commas. + + * util/grub-md5-crypt.in: New file. + * util/Makefile.am (sbin_SCRIPTS): Added grub-md5-crypt. + * configure.in (AC_OUTPUT): Added util/grub-md5-crypt. + * docs/Makefile.am (man_MANS): Added grub-md5-crypt.8. + [MAINTAINER_MODE] ($(srcdir)/grub-md5-crypt.8): New target. + * docs/grub-md5-crypt.8: New file. Generated by help2man. + + * docs/grub.texi (grub-md5-crypt): New direntry. + (Invoking grub-md5-crypt): New entry. + * docs/user-ref.texi (Invoking grub-md5-crypt): New chapter. + +2000-10-22 OKUJI Yoshinori + + From Matthias Granberry : + * util/grub-install.in (convert): Added backslashes into + continuous lines. + +2000-10-21 OKUJI Yoshinori + + * stage2/md5.c (check_md5_password): Removed. + (md5_password): New function. Mostly copied from + check_md5_password. + (md5_init): Made static. + (md5_update): Likewise. + (md5_final): Likewise. + * stage2/md5.h (check_md5_password): Changed to just a macro. + (md5_password): Declared. + (make_md5_password): New macro. + * stage2/char_io.c [!STAGE1_5] (grub_strstr): Rewriten, because + it was too buggy. + * stage2/builtins.c [USE_MD5_PASSWORDS] (md5crypt_func): New + function. + [USE_MD5_PASSWORDS] (builtin_md5crypt): New variable. + (builtin_table) [USE_MD5_PASSWORDS]: Added a pointer to + BUILTIN_MD5CRYPT. + * docs/tutorial.texi (Security): Added a paragraph about + md5crypt. + +2000-10-21 OKUJI Yoshinori + + * docs/user-ref.texi: Fixed several typos and some inappropriate + texinfo commands, and update the descriptions about some + commands. + +2000-10-20 OKUJI Yoshinori + + * stage2/builtins.c (displayapm_func): New function. + (builtin_displayapm): New variable. + (builtin_table): Added a pointer to BUILTIN_DISPLAYAPM. + +2000-10-20 OKUJI Yoshinori + + APM BIOS table support is added, based on a patch by Matt Yourst + . + + * docs/multiboot.texi (Boot information format): Added the + definition of APM table format. + + * stage2/mb_info.h (apm_info): New structure. + (multiboot_info): Added a new element, apm_table. + (MB_INFO_APM_TABLE): New macro. + * stage2/asm.S (apm_bios_info): New variable. + Include "apm.S". + * stage2/apm.S: New file. + * stage2/common.c (init_bios_info) [!STAGE1_5]: Added APM BIOS + table support. + * stage2/shared.h (apm_bios_info): Declared. + (get_apm_info): Likewise. + * stage2/Makefile.am (EXTRA_DIST): Added apm.S. + * grub/asmstub.c (apm_bios_info): New variable. + (get_apm_info): New function. + +2000-10-19 OKUJI Yoshinori + + Segregate functions which are copyrighted differently. + + * stage2/setjmp.S: New file. + * stage2/Makefile.am (EXTRA_DIST): Added setjmp.S. + * stage2/asm.S: Include "setjmp.S". + (grub_setjmp): Moved to ... + * stage2/setjmp.S (grub_setjmp): ... here. + * stage2/asm.S (grub_longjmp): Moved to ... + * stage2/setjmp.S (grub_longjmp): ... here. + +2000-10-18 OKUJI Yoshinori + + * stage2/Makefile.am (noinst_HEADERS): Added md5.h. Reported by + Volker Augustin . + +2000-10-17 OKUJI Yoshinori + + * configure.in (--disable-md5password): Renamed to ... + (--disable-md5-password): ... this. Just for my preference. + +2000-10-17 Jochen Hoenicke + + Added MD5 passwords and extended password command: + + * configure.in (--disable-md5password): New option. + * stage2/Makefile.am (libgrub_a_SOURCES): Added md5.c. + (pre_stage2_exec_SOURCES): Likewise. + * stage2/md5.c: New file. + * stage2/shared.h (password_t): New type. + (password_type): New variable. + (BUILTIN_HIDDEN): New flag, describing that a command should not + be printed when booting the entry. + (check_password): New function. + * stage2/cmdline.c (run_script): Don't show commands that have + the hidden attribute. + * stage2/builtins.c (password_type): New variable. + (check_password): New function. + (password_func): Handle the --md5 option and set password_type. + Check if in CMDLINE or SCRIPT mode and ask password immediately. + (builtin_password): Also allow passwords in CMDLINE mode, make + it hidden, so the user wont see the password he should enter. + Changed command description. + (builtin_pause): Make the command hidden. + (pause_func): Print argument, since the command is now hidden. + * stage2/stage2.c (run_menu): Call check_password to check password. + * docs/tutorial.texi (Security): Describe the new features of the + password commands. + * docs/user-ref.texi (Menu-specific commands): password command + moved ... + (Command-line and menu commands): ... to here. New features + doumented. + +2000-10-17 OKUJI Yoshinori + + * stage2/builtins.c (setkey_func): Clear the all elements of + BIOS_KEY_MAP and ASCII_KEY_MAP instead of only the first + elements, when TO_KEY is NULL. + +2000-10-16 OKUJI Yoshinori + + * stage2/boot.c (load_image): When handling Linux cmdline, don't + copy a null character from SRC to DEST, because this inserted an + extra null character into the cmdline. Reported by Robert + Bihlmeyer . + +2000-10-16 OKUJI Yoshinori + + Some of the new Multiboot features are supported. APM support + and VESA support are not strictly defined or implemented yet. + + * docs/multiboot.texi (Top): Increase the version number. + (Boot information format): Changed the drive information format, + because it was not straightforward. + + * grub/asmstub.c (io_map): New variable. + (track_int13): New function. + (get_rom_config_table): Likewise. + * stage2/stage2.c (cmain): Set CONFIG_ENTRIES to MBI.DRIVES_ADDR + + MBI.DRIVES.LENGTH instead of MBI.MMAP_ADDR + MBI.MMAP_LENGTH. + * stage2/common.c (init_bios_info) [!STAGE1_5]: Added support + for drive info, ROM config table, and boot loader name features + of the Multiboot Specification. + * stage2/mb_info.h (drive_info): New structure. + (MB_DI_CHS_MODE): New macro. + (MB_DI_LBA_MODE): Likewise. + (multiboot_info): Added drives_length, drives_addr, + config_table, and boot_loader_name. + (MB_INFO_DRIVE_INFO): New macro. + (MB_INFO_CONFIG_TABLE): Likewise. + (MB_INFO_BOOT_LOADER_NAME): Likewise. + * stage2/asm.S (get_rom_config_table): New function. + * stage2/shared.h (get_rom_config_table): Declared. + +2000-10-16 OKUJI Yoshinori + + * util/grub-install.in (convert): Check only if the file exists, + instead of checking if the file is a block device as well. + Because, in a sane operating system, it should be a char device + but not a block device (unlike Linux), and it may be a symbolic + link (this can happen if you use Linux's devfs without devfsd). + (recheck): New variable. Set to "no" by default, and set to + "yes", if you specify the new option ``--recheck''. If $recheck + is "yes", remove the device map file, if present. + +2000-10-16 OKUJI Yoshinori + + From Roderich Schupp: + * lib/device.c: Include . + [__linux__] (have_devfs): New function. + (get_floppy_disk_name) [__linux__]: If devfs is supported, use + the name "/dev/floppy/N" instead. + (init_device_map) [__linux__]: If devfs is supported, use + "/dev/discs/discN" instead. + [__linux__] (write_to_partition): Change the size of DEV to + PATH_MAX instead of 64. + If devfs is supported, replace "/disc" in the device name with + "/part". + +2000-10-15 OKUJI Yoshinori + + From Roderich Schupp : + * util/grub-install.in (convert): Added support for "native" + devfs device names. + +2000-10-14 OKUJI Yoshinori + + * docs/tutorial.texi (Serial terminal): Fixed a typo. + * docs/user-ref.texi (GRUB images): New chapter. + * docs/grub.texi: Added an entry for the chapter "GRUB images". + +2000-10-14 OKUJI Yoshinori + + * stage2/builtins.c (setkey_func): If TO_KEY is NULL (i.e. the + user specifies no argument), clear BIOS_KEY_MAP and + ASCII_KEY_MAP. + If TO_KEY is non-NULL but FROM_KEY is NULL, set ERRNUM to + ERR_BAD_ARGUMENT and return one. + +2000-10-13 OKUJI Yoshinori + + * docs/grub.texi: Added an entry for the new chapter "Security", + and the order of the chapters in the Tutorial Manual was + changed. + * docs/tutorial.texi (Configuration): Moved to right after the + chapter "Booting". + (Security): New chapter. + +2000-10-10 OKUJI Yoshinori + + From Alessandro Rubini: + * util/grub-install.in (root_device): Use the regular expression + 's%.*\(/dev/[^ ]*\).*%\1%' instead of + 's%.*\(/dev/[a-z0-9]*\).*%\1%'. + (bootdir_device): Likewise. + (grubdir_device): Likewise. + +2000-10-10 OKUJI Yoshinori + + * stage2/start.S (copy_buffer): Use pusha and popa instead of + pushing and poping %di and %si individually, to reduce the code + size and save %cx as well. Reported by Herbert Nachtnebel + . + +2000-10-10 OKUJI Yoshinori + + From Daniel Pittman : + * stage2/builtins.c (setkey_func): Check if + KEYSYM_TABLE[I].UNSHIFTED_NAME and KEYSYM_TABLE[I].SHIFTED_NAME + are not NULLs, before calling grub_strcmp. + +2000-10-08 OKUJI Yoshinori + + * util/grub-install.in (grub_prefix): New variable. The default + is "/boot/grub". + If the user has a separate boot partition, set grub_prefix + instead of grubdir to "/grub". + When running the command "setup", specify $grub_prefix instead + of $grubdir to the option "--prefix". + Report by Thierry Laronde. + +2000-10-08 OKUJI Yoshinori + + * stage2/builtins.c (find_func): Clear ERRNUM after the last + call of next_partition, because it always sets ERRNUM. Reported + by Thierry Laronde . + +2000-10-07 OKUJI Yoshinori + + * lib/device.c [__linux__] (write_to_partition): Open DEV with + O_RDWR instead of O_ORONLY. + +2000-10-06 Alessandro Rubini + + * docs/user-ref.texi (Commands): Added missing commands and + reworded part of the text. + + * stage2/builtins.c (serial_func): Unswap the setting of "speed" + and "port". + +2000-10-06 OKUJI Yoshinori + + * stage2/builtins.c (setup_func): Append "... " to the + messages when calling embed_func and install_func, and print + the result. + Don't jump to the label "fail", even when embed_func failed. + +2000-10-05 Gordon Matzigkeit + + * stage2/disk_io.c (real_open_partition): Make sure that buf_geom + corresponds to the current drive before using it. + + * lib/device.c (get_drive_geometry): Use fstat if the native + geometry methods fail, such as when the drive is mapped to a + regular file. + + * docs/tutorial.texi: Add `@kbd{...}' to examples in order to + differentiate between command output and characters the user + should type. + * docs/user-ref.texi: Likewise. + +2000-10-05 OKUJI Yoshinori + + * docs/grub.texi: Added an entry for the chapter "Serial + terminal". + * docs/tutorial.texi (Serial terminal): New chapter. + +2000-10-04 Gordon Matzigkeit + + * util/grub-image (VERSION): Fix version calculation to tolerate + `(GNU GRUB 0.5.96)'-style versions. + + * docs/grub.texi: Remove braces from `@unnumbered' sections so + that texi2html doesn't complain. + + * debian/rules: Build HTML documentation to appease the Debian + masses. + +2000-10-04 OKUJI Yoshinori + + * stage2/fsys_reiserfs.c (reiserfs_mount): Compare PART_LENGTH + with SUPERBLOCK + (sizeof(super) >> SECTOR_BITS) instead of + sizeof(struct reiserfs_super_block). Reported by Jochen + Hoenicke. + +2000-10-05 OKUJI Yoshinori + + * configure.in (AM_INIT_AUTOMAKE): The version number is set to + 0.5.97. This version number is a dummy, as we will never release + 0.5.97 actually. + +2000-10-01 OKUJI Yoshinori + + * lib/device.c [__linux__]: Don't include . + [__linux__ && !CDROM_GET_CAPABILITY] (CDROM_GET_CAPABILITY): + Defined as 0x5331. + +2000-10-01 OKUJI Yoshinori + + * lib/device.c (get_drive_geometry) [__GNU__]: Get the number of + total sectors by fstat. The rest are filled with arbitrary + values. + +2000-09-30 OKUJI Yoshinori + + * util/grub-install.in (convert): The code for gnu* (i.e. + GNU/Hurd) was rewritten, since it didn't work for BSD + partitions. + Use "$tmp_disk *$" instead of "$tmp_disk" to get the drive name. + +2000-09-30 OKUJI Yoshinori + + * stage2/fsys_reiserfs.c (reiserfs_mount): Check if the length + of the partition is less than the size of a super block, before + attempting to read the super block. + + * grub/asmstub.c (console_putchar) + [HAVE_LIBCURSES_H && REFRESH_IMMEDIATELY]: Call refresh, to ease + debugging. + +2000-09-30 OKUJI Yoshinori + + Added two new commands, "partnew" and "parttype", based on the + patch by Stefan Ondrejicka : + * stage2/builtins.c (partnew_func): New function. + (builtin_partnew): New variable. + (parttype_func): New function. + (builtin_parttype): New variable. + (builtin_table): Added pointers to BUILTIN_PARTNEW and to + BUILTIN_PARTTYPE. + +2000-09-29 OKUJI Yoshinori + + * stage2/builtins.c (find_func): New variable GOT_FILE is set to + one if FILENAME is found. Otherwise, it is set to zero. + Clear ERRNUM at the end in the loop for floppies, to ensure that + ERRNUM is cleared before examining hard disks. + Rewrite the loop for hard disks using next_partitions, so this + function now checks all partitions you have certainly. + If GOT_FILE is non-zero, set ERRNUM to ERR_FILE_NOT_FOUND and + return one. + +2000-09-29 OKUJI Yoshinori + + * stage2/disk_io.c (check_BSD_parts): Removed. + (next_partition): New function. + (real_open_partition): Rewritten using next_partition. + (set_device) [!STAGE1_5]: Skip a comma in DEVICE, even when the + BSD partition is not specified. + [!STAGE1_5] (print_completions): Don't append ')' if the + partition is a PC slice which may have BSD partitions. Instead, + try to complete the command-line with possible partitions. + * stage2/shared.h (next_partition): Declared. + +2000-09-27 OKUJI Yoshinori + + * configure.in (--enable-serial): Changed to ... + (--disable-serial): ... this. Now the serial support is enabled + by default. + +2000-09-27 OKUJI Yoshinori + + * stage2/char_io.c [!STAGE1_5] (get_cmdline) [!SUPPORT_SERIAL]: + Don't check if the terminal is dumb. If the terminal is console, + always use console functions. + * stage2/builtins.c [!SUPPORT_NETBOOT] (bootp_func): Undefined. + [!SUPPORT_NETBOOT] (builtin_bootp): Likewise. + [!GRUB_UTIL] (device_func): Likewise. + [!GRUB_UTIL] (builtin_device): Likewise. + [!SUPPORT_NETBOOT] (dhcp_func): Likewise. + [!SUPPORT_NETBOOT] (builtin_dhcp): Likewise. + [!GRUB_UTIL] (quit_func): Likewise. + [!GRUB_UTIL] (builtin_quit): Likewise. + [!SUPPORT_NETBOOT] (rarp_func): Likewise. + [!SUPPORT_NETBOOT] (builtin_rarp): Likewise. + [!SUPPORT_SERIAL] (serial_func): Likewise. + [!SUPPORT_SERIAL] (builtin_serial): Likewise. + [!SUPPORT_SERIAL] (terminal_func): Likewise. + [!SUPPORT_SERIAL] (builtin_terminal): Likewise. + [!SUPPORT_NETBOOT] (tftpserver_func): Likewise. + [!SUPPORT_NETBOOT] (builtin_tftpserver): Likewise. + (builtin_table) [!SUPPORT_NETBOOT]: Removed the pointers to + BUILTIN_BOOTP, BUILTIN_DHCP, BUILTIN_RARP, and + BUILTIN_TFTPSERVER. + (builtin_table) [!SUPPORT_SERIAL]: Removed the pointers to + BUILTIN_SERIAL and BUILTIN_TERMINAL. + (builtin_table) [!GRUB_UTIL]: Removed the pointers to + BUILTIN_DEVICE and BUILTIN_QUIT. + +2000-09-26 OKUJI Yoshinori + + * util/grub-install.in (bootdir_device): New variable. If + $bootdir_device is not the same as $root_device, set root_device + and grubdir to $bootdir_device and "/grub", respectively. + Add --prefix=$grubdir into the command "setup". + +2000-09-26 OKUJI Yoshinori + + Add --prefix=DIR to the command "setup". + + * stage2/builtins.c (setup_func): New nested function, + check_file checks if the file FILE exists. + Remove the prefix "/boot/grub" in STAGE1_5_MAP. + Don't hardcode "/boot/grub/stage1", "/boot/grub/stage2", or + "/boot/grub/menu.lst". Instead, check if ARG contains + "--prefix=", and if specified, set PREFIX to the value. + If not specified, check "/boot/grub/stage1" and, if not found, + check "/grub/stage1". If a stage1 was found, set PREFIX to the + directory which contains the stage1. + +2000-09-12 OKUJI Yoshinori + + Add additional magic to avoid a bug in Linux. *sigh* + + * stage2/boot.c (load_image): Copy SRC to DEST first, and append + a "mem=" option to DEST instead of prepending. + +2000-09-11 OKUJI Yoshinori + + Reported by Alessandro Rubini: + * stage2/fsys_minix.c (minix_mount): Check if CURRENT_SLICE is a + partition type for minix fs, using the macro + IS_PC_SLICE_TYPE_MINIX. + * stage2/pc_slice.h (PC_SLICE_TYPE_LINUX_MINIX): New macro. + (IS_PC_SLICE_TYPE_MINIX): Likewise. + +2000-09-09 Alessandro Rubini + + * stage1/stage1.S (notification_string): Print "GRUB " instead + of "stage1 ". + * stage2/start.S [STAGE1_5] (notification_string): Print + "Loading stage1.5" instead of "stage1.5 ". + [!STAGE1_5] (notification_string): Print "Loading stage2" + instead of "stage2 ". + (notification_step): New label, followed by a string ".". + (notification_done): New label, followed by a string "\r\n". + (copy_buffer): Print NOTIFICATION_STEP after copying the buffer. + (bootit): Print NOTIFICATION_DONE before restoring %dx. + +2000-09-09 OKUJI Yoshinori + + From Alessandro Rubini: + * configure.in (CPPFLAGS): Added -malign-jumps=1, + -malign-loops=1 and -malign-functions=1. + +2000-09-07 OKUJI Yoshinori + + From Hal Snyder : + * lib/device.c (get_drive_geometry) [__FreeBSD__ || __NetBSD__ + || __OpenBSD__]: Call ioctl for FD instead of + DISKS[DRIVE].FLAGS. This was a mistake when I segregated this + function from asmstub.c. + +2000-09-07 Alessandro Rubini + + * docs/tutorial.texi: Fixed a few typos and minor imprecisions. + * docs/prog-ref.texi: Likewise. + * docs/user-ref.texi: Likewise. + +2000-09-07 OKUJI Yoshinori + + From Alessandro Rubini: + * stage2/builtins.c (terminal_func): Rename TIMEOUT to TO, to + suppress GCC warnings. + * grub/asmstub.c (serial_checkkey): Likewise. + +2000-09-06 OKUJI Yoshinori + + * stage2/char_io.c [!STAGE1_5] (auto_fill): New variable. + [!STAGE1_5] (get_cmdline): Save AUTO_FILL in SAVED_AUTO_FILL in + the beginning and restore AUTO_FILL before return. + Set AUTO_FILL to one and zero before and after calling + print_completions, respectively. + (grub_putchar) [!STAGE1_5]: Use a static variable COL to track + the position of the cursor. If C is a carriage return, clear + COL. If C is a backspace and COL is positive, decrease COL. If C + is a printable character, increase COL. In this case, if + AUTO_FILL is non-zero and COL is greater than or equal to 79, + put a newline automatically. + * stage2/shared.h (auto_fill): Declared. + * stage2/stage2.c (run_menu): In the menu interface, disable the + auto fill mode (i.e. set AUTO_FILL to zero), and enable it again + when booting an entry. + (cmain): Initialize AUTO_FILL (i.e. set it to one) in the + beginning of the loop. + +2000-09-06 OKUJI Yoshinori + + Add support for "boot previously booted entry by default", based + on the patch by Mike Meyer , but I've modified + his patch thoroughly. + + * grub/asmstub.c (saved_entryno): New variable. This is a dummy. + * stage1/stage1.h (COMPAT_VERSION_MINOR): Incremented. + * stage2/asm.S (saved_entryno): New variable. + (codestart) [!SUPPORT_DISKLESS]: Set INSTALL_SECOND_SECTOR to + %ebp. %ebp is set in start.S. + (install_second_sector): New variable. + * stage2/builtins.c (current_entryno): New variable. + (default_func) [!SUPPORT_DISKLESS]: If ARG is "saved", set + DEFAULT_ENTRY to SAVED_ENTRYNO. + (savedefault_func): New function. + (builtin_savedefault): New variable. + (builtin_table): Added a pointer to BUILTIN_SAVEDEFAULT. + * stage2/shared.h (STAGE2_SAVED_ENTRYNO): New macro. + (STAGE2_STAGE2_ID): Changed to 0x10. + (STAGE2_FORCE_LBA): Chaged to 0x11. + (STAGE2_VER_STR_OFFS): Changed to 0x12. + (install_second_sector): Declared. + (saved_entryno): Likewise. + (current_entryno): Likewise. + * stage2/stage2.c (run_menu): Set CURRENT_ENTRYNO to FIRST_ENTRY + + ENTRYNO, right before calling run_script. + * stage2/start.S (start): Save the sector number of the second + sector in %ebp. + +2000-09-05 OKUJI Yoshinori + + * stage1/stage1.S (lba_mode) [!NO_BUGGY_BIOS_IN_THE_WORLD]: + Don't check for the geometry, since some BIOSes don't return the + number of total sectors correctly, even if they have working LBA + support. + * stage2/start.S (lba_mode) [!NO_BUGGY_BIOS_IN_THE_WORLD]: + Likewise. + * stage2/bios.c (biosdisk) [!NO_BUGGY_BIOS_IN_THE_WORLD]: + Likewise. + Reported by Jan Fricke and Pixel + . + +2000-09-05 OKUJI Yoshinori + + From Alessandro Rubini : + * stage2/char_io.c (print_error) [!STAGE1_5]: Print ERRNUM like + "Error 9: Unknown boot failure". + (print_error) [STAGE1_5]: Don't print a colon. + * util/grub-install.in: When checking if an error occurred, use + the expression "Error [0-9]*: " instead of "Error: ". + * docs/user-ref.texi (Stage1.5 errors): Updated, since the error + form changed. + +2000-09-04 OKUJI Yoshinori + + * stage2/stage2.c (run_menu) [GRUB_UTIL]: Set DISP_UP and + DISP_DOWN to ACS_UARROW and ACS_DARROW, respectively. Don't call + grub_printf here. + (run_menu) [!GRUB_UTIL]: Don't call grub_printf here. Instead, + call it... + (run_menu): ... here. + * stage2/shared.h (ACS_ULCORNER): Always define this ourselves, + whether your curses library has the definition. + (ACS_URCORNER): Likewise. + (ACS_LLCORNER): Likewise. + (ACS_LRCORNER): Likewise. + (ACS_HLINE): Likewise. + (ACS_VLINE): Likewise. + (ACS_LARROW): Likewise. + (ACS_RARROW): Likewise. + (ACS_UARROW): Likewise. + (ACS_DARROW): Likewise. + + * stage2/char_io.c [SUPPORT_SERIAL] (serial_cls): If the + terminal is dumb, just put a newline. + * stage2/builtins.c (terminal_func) [SUPPORT_SERIAL]: When + choosing a terminal, don't set TERMINAL to the type of the + terminal. Instead, apply a logical AND operation with + TERMINAL_DUMB, since previous code brushed off the dumb + attribute. + +2000-09-04 OKUJI Yoshinori + + * stage2/stage2.c (run_menu): If SHOW_MENU is zero, print a + message with the timeout per second. + If GRUB_TIMEOUT is negative, set SHOW_MENU to one, since the + condition "no timeout and no interface" is nonsense. + If GRUB_TIMEOUT is equal to or greater than zero and the + terminal is dumb, set SHOW_MENU to zero. + If SHOW_MENU is non-zero and the terminal is dumb, enter the + command-line interface instead. If AUTH is false and PASSWORD is + non-NULL, prompt the user to enter a password until the entered + password is identical to PASSWORD. + +2000-09-03 OKUJI Yoshinori + + * util/grub-install.in: Fix a typo: grub_dir -> grubdir. + * stage2/builtins.c (install_func) [GRUB_UTIL]: Open a Stage 2 + with "r+" instead of "r", as GRUB needs to overwrite it. + +2000-09-02 OKUJI Yoshinori + + * stage2/stage2.c (run_menu): Don't use either `p' or `n' to + move the cursor, because `p' is already used for another + purpose (password). + (run_menu) [SUPPORT_SERIAL]: Don't set the variables DISP_UP and + DISP_DOWN at the start time. Instead, set them just before using + them actually, because TERMINAL may change when running a menu. + +2000-09-01 Klaus Reichl + + * stage2/stage2.c (run_menu): Setup and use disp_up, disp_down + depending on the terminal mode. + (run_menu): Allow '^' (resp. 'p') and 'v' (resp 'n') keys we + described in our help above (resp. authors preferences). + +2000-08-31 Klaus Reichl + + * stage2/stage2.c (set_line): Go back one char, which is + consistent with the original situation, when a timeout was + running. + (run_menu): If GRUB_TIMEOUT is stopped don't loop busy over + CHECKKEY, just relax in GETKEY. + + * stage2/builtins.c (serial_func): --speed handling: corrected + typo: set SPEED instead of PORT. + +2000-08-31 OKUJI Yoshinori + + * stage2/builtins.c (terminal_func): Added two new options, + --dumb and --timeout=SECS. + * stage2/char_io.c [!STAGE1_5] (getkey): Use logical AND + operations, when checking if the terminal is a console or a + serial terminal. + [!STAGE1_5] (getkey) [SUPPORT_SERIAL]: Don't check if both + TERMINAL_CONSOLE and TERMINAL_SERIAL are set in TERMINAL. + +2000-08-31 OKUJI Yoshinori + + * stage1/stage1.S (MOV_MEM_TO_AL): New macro. + (real_start): Use the macro MOV_MEM_TO_AL instead of using movb + directly, because binutils-2.9.1.0.x doesn't produce a short + opcode for it automatically. Reported by Alessandro Rubini + . + +2000-08-30 OKUJI Yoshinori + + * configure.in (CPPFLAGS): Remove -Wundef by default. Add the + option only if the C compiler supports it, because GCC 2.7.x + doesn't support it. + * grub/main.c (longopts): The type of the argument for "hold" is + changed to OPTIONAL_ARGUMENT. + (main): If --hold is specified, check if OPTARG is zero. If so, + set HOLD to -1, otherwise, set it to the digit OPTARG. + If HOLD is greater than zero, decrease it once per loop. + +2000-08-30 OKUJI Yoshinori + + The command-line interface is switched to single-line editing + mode. + + * stage2/char_io.c [!STAGE1_5] (get_cmdline): Extensively + rewritten. The nested functions cl_print and cl_kill_to_end are + removed, cl_refresh, cl_backward, cl_forward and cl_delete are + added, and, cl_init and cl_insert are rewritten from scratch. + See the source code, for more information. I don't think this + kind of changes can be represented in ChangeLog. + [!STAGE1_5] (CMDLINE_WIDTH): New macro. + [!STAGE1_5] (CMDLINE_MARGIN): Likewise. + * stage2/shared.h (TERMINAL_DUMB): Likewise. + +2000-08-28 OKUJI Yoshinori + + * grub/asmstub.c (console_putchar) [HAVE_LIBCURSES]: If + USE_CURSES is true, emulate a new line like a ordinary terminal, + because ncurses treats it badly. If current position on y-axis + is the bottom of the screen, call scroll. Otherwise, call move + with the arguments, Y + 1 and X, where X and Y are current + position of the cursor. + +2000-08-28 OKUJI Yoshinori + + * stage2/asm.S (console_putchar): Don't print a carriage return + when C is a newline. + * stage2/char_io.c (grub_putchar): Call grub_putchar with the + arugment set to a carriage return, if C is a newline. + [!STAGE1_5 && SUPPORT_SERIAL]: Don't print a carriage return + when C is a newline. + +2000-08-27 OKUJI Yoshinori + + * lib/device.c [__linux__]: Don't include linux/fs.h. + [!BLKGETSIZE] (BLKGETSIZE): Defined as _IO(0x12,96). + * grub/asmstub.c [__linux__]: Don't include linux/fs.h. + +2000-08-27 OKUJI Yoshinori + + Preserve a magic number used by Windows NT in a MBR. Shit! + Reported by Khimenko Victor. + + * stage1/stage1.h (STAGE1_WINDOWS_NT_MAGIC): New macro. + * stage1/stage1.S (copy_buffer): Use pusha and popa, instead of + pushing/poping %cx and %si separately, to reduce the code size. + (nt_magic): New label. Set the offset to _start plus + STAGE1_WINDOWS_NT_MAGIC + (part_start): New label. + * stage2/builtins.c (install_func): If DEST_DRIVE is a hard + disk, copy the possible partition table and Windows NT magic to + STAGE1_BUFFER from OLD_SECT. + +2000-08-26 OKUJI Yoshinori + + * stage2/char_io.c (translate_keycode) [SUPPORT_SERIAL]: Don't + drain the input buffer, since that was irritating. + +2000-08-26 OKUJI Yoshinori + + Don't save/restore fragile registers unnecessarily. + + * stage2/asm.S [!STAGE1_5] (track_int13): Don't save/restore + %ecx, %edx, or %eax. + [!STAGE1_5] (set_int13_handler): Likewise. + (biosdisk_int13_extensions): Likewise. + (biosdisk_standard): Likewise. + (check_int13_extensions): Likewise. + (get_diskinfo_int13_extensions): Likewise. + (get_diskinfo_standard): Likewise. + (get_diskinfo_floppy): Likewise. + [!STAGE1_5] (get_eisamemsize): Likewise. + [!STAGE1_5] (get_mmap_entry): Likewise. + [!STAGE1_5] (console_cls): Likewise. + [!STAGE1_5] (nocursor): Likewise. + [!STAGE1_5] (console_getxy): Likewise. + [!STAGE1_5] (console_gotoxy): Likewise. + [!STAGE1_5] (set_attrib): Likewise. + [!STAGE1_5] (getrtsecs): Likewise. + [!STAGE1_5] (currticks): Likewise, and don't zero %eax + explicitly, since prot_to_real does that. + +2000-08-25 OKUJI Yoshinori + + * stage2/char_io.c [!STAGE1_5] (translate_keycode): New + function. The serial part is stolen from the patch by Christoph + Plattner. + [!STAGE1_5] (get_cmdline): Call translate_keycode instead of + translating special key codes into ASCII characters by itself. + * stage2/stage2.c (run_menu): Wrap getkey with the macro + ASCII_CHAR, when checking if ESC is pressed. + Call translate_keycode as well as getkey, unless checkkey + returns -1. So don't check if C is KEY_DOWN or KEY_UP. And don't + use the macro ASCII_CHAR for C explicitly. + * stage2/shared.h (translate_keycode): Declared. + +2000-08-24 OKUJI Yoshinori + + * stage2/builtins.c [GRUB_UTIL]: Include stdio.h before + shared.h. Reported by Mathieu Chouquet-Stringer + . + +2000-08-21 OKUJI Yoshinori + + * configure.in (--enable-serial-speed-emulation): New option. + (SERIAL_SPEED_SIMULATION): New conditional. + * grub/Makefile.am (SERIAL_FLAGS): New variable. Set + -DSUPPORT_SERIAL=1 and -DSIMULATE_SLOWNESS_OF_SERIAL=1, if + SERIAL_SPEED_SIMULATION is defined, otherwise, set it to + only -DSUPPORT_SERIAL=1. + (AM_CFLAGS): Removed -DSUPPORT_SERIAL=1 and added + $(SERIAL_FLAGS). + * grub/asmstub.c [SIMULATE_SLOWNESS_OF_SERIAL] (serial_speed): + New variable. + (grub_setjmp): Removed. + (grub_longjmp): Likewise. + (serial_getkey) [SIMULATE_SLOWNESS_OF_SERIAL]: Wait for + 1000000 / (SERIAL_SPEED >> 3) microseconds using gettimeofday. + (serial_putchar) [SIMULATE_SLOWNESS_OF_SERIAL]: Likewise. + (serial_init) [SIMULATE_SLOWNESS_OF_SERIAL]: Set SERIAL_SPEED to + SPEED. + * stage2/builtins.c (serial_func) [SUPPORT_SERIAL]: Added + a new option, `--speed'. + (builtin_serial): Added a description about --speed. + (terminal_func): When get a key from a serial device, if GRUB is + in the command-line interface, call grub_longjmp with + RESTART_CMDLINE_ENV, instead of init_page. + * stage2/cmdline.c (restart_cmdline_env): New variable. + (enter_cmdline): Call grub_setjmp with RESTART_CMDLINE_ENV after + calling init_cmdline. + (run_script): Run BUILTIN->FUNC with BUILTIN_SCRIPT instead of + BUILTIN_CMDLINE. + * stage2/shared.h (BUILTIN_SCRIPT): New macro. + [GRUB_UTIL] (grub_setjmp): Defined as setjmp. + [GRUB_UTIL] (grub_longjmp): Defined as longjmp. + (restart_cmdline_env): Declared. + +2000-08-20 OKUJI Yoshinori + + * configure.in (--enable-serial): New option. Serial terminal + support will be enabled by default, once it is stabilized. + (SERIAL_SUPPORT): New conditional. + * grub/Makefile.am (AM_CFLAGS): Added -DSUPPORT_SERIAL=1. + * grub/asmstub.c (cls): Renamed to ... + (console_cls): ... this. + (getxy): Renamed to ... + (console_getxy): ... this. + (gotoxy): Renamed to ... + (console_gotoxy): ... this. + * stage2/Makefile.am (libgrub_a_CFLAGS): Added + -DSUPPORT_SERIAL=1. + (NETBOOT_FLAGS): New variable. + (SERIAL_FLAGS): Likewise. + (STAGE2_COMPILE): Added $(NETBOOT_FLAGS) and $(SERIAL_FLAGS). + * stage2/asm.S [!STAGE1_5] (cls): Renamed to ... + [!STAGE1_5] (console_cls): ... this. + [!STAGE1_5] (getxy): Renamed to ... + [!STAGE1_5] (console_getxy): ... this. + [!STAGE1_5] (gotoxy): Renamed to ... + [!STAGE1_5] (console_gotoxy): ... this. + * stage2/builtins.c (terminal_func): If the bit flag + BUILTIN_CMDLINE in FLAGS is set, call init_page. But this should + be fixed so that it restarts enter_cmdline instead. + * stage2/char_io.c [!STAGE1_5] (gotoxy): New function. + [!STAGE1_5] (serial_gotoxy): Likewise. + [!STAGE1_5] (getxy): Likewise. + [!STAGE1_5] (serial_getxy): Likewise. + [!STAGE1_5] (cls): Likewise. + [!STAGE1_5] (serial_cls): Likewise. + * stage2/serial.h (serial_cls): Declared. + (serial_getxy): Likewise. + (serial_gotoxy): Likewise. + * stage2/shared.h (console_cls): Likewise. + (console_getxy): Likewise. + (console_gotoxy): Likewise. + * stage2/stage2.c (print_entries): If serial terminal is + enabled, print ACS_UARROW and ACS_DARROW instead of DISP_UP and + DISP_DOWN, respectively. + (print_border): If serial terminal is enabled, print + ACS_ULCORNER, ACS_URCORNER, ACS_LLCORNER, ACS_LRCORNER, + ACS_HLINE and ACS_VLINE instead of DISP_UL, DISP_UR, DISP_LL, + DISP_LR, DISP_HORIZ and DISP_VERT, respectively. + (print_border) [SUPPORT_SERIAL]: Color the menu only if console + is used. + (set_line): Take two more arguments, ENTRYNO and MENU_ENTRIES. + (set_line_normal): Likewise. + (set_line_highlight): Likewise. + (set_line) [SUPPORT_SERIAL]: If serial terminal is enabled, get + the menu entry whose attributes are being changed and redraw the + line. + (set_line_highlight) [SUPPORT_SERIAL]: If serial terminal is + enabled, print `ESC [ 7 m' and `ESC [ 0 m' before and after + calling set_line, respectively. + (run_menu) [SUPPORT_SERIAL]: Call nocursor only if console is + used. + +2000-08-20 OKUJI Yoshinori + + Now the serial console support is partially working. + + * grub/asmstub.c (serial_checkkey): Specify a pointer to TIMEOUT + as the fifth argument to select. + (serial_get_port): New function. Just a dummy. + (serial_init): If a serial device is opened, close SERIAL_FD + before opeing a new serial device. + Don't specify O_NDELAY to open. + * stage2/builtins.c [SUPPORT_SERIAL]: Include serial.h. + (serial_func): New function. + (builtin_serial): New variable. + (terminal_func): New function. + (builtin_terminal): New variable. + (builtin_table): Add pointers to BUILTIN_SERIAL and + BUILTIN_TERMINAL. + * stage2/char_io.c [SUPPORT_SERIAL]: Include serial.h. + (getkey) [SUPPORT_SERIAL]: If both TERMINAL_CONSOLE and + TERMINAL_SERIAL are set in TERMINAL simultaneously, print a + warning and force the console terminal. + (checkkey) [SUPPORT_SERIAL]: If TERMINAL_SERIAL is set in + TERMINAL, call serial_checkkey. + (grub_putchar) [SUPPORT_SERIAL]: If TERMINAL_SERIAL is set in + TERMINAL, call serial_putchar. If C is a newline, print a + carriage return, before printing a newline. + +2000-08-15 OKUJI Yoshinori + + The image `nbgrub' now relocates itself from 0x10000 to 0x8000, + since the Network Boot Image Proposal doesn't permit a second + loader to be loaded below 0x10000. Reported by Matthias + Kretschmer . + + * Makefile.am (NBLOADER_LINK): New variable. + (nbloader_exec_LDFLAGS): Set to $(NBLOADER_LINK) instead of + $(START_LINK). + * stage2/nbi.h (NBI_DEST_ADDR): Changed to 0x10000. + (NBI_DEST_SEG): New macro. + (NBI_DEST_OFF): Likewise. + (RELOCATED_ADDR): Likewise. + (RELOCATED_SEG): Likewise. + (RELOCATED_OFF): Likewise. + (STAGE2_START_ADDR): Likewise. + * stage2/nbloader.S: Added .code16 directive at the start of the + code. + Set the segment and the offset of the load address to + NBI_DEST_SEG and NBI_DEST_OFF, respectively. + Set the segment and the offset of the start address to + NBI_DEST_SEG and NBI_DEST_OFF + relocate - _start, respectively. + Added a routine for relocating itself. + (relocate): New label. + (copy_rest): Likewise. + (copy_loop): Likewise. + (copy): Likewise. + (boot_stage2): Likewise. + +2000-08-13 OKUJI Yoshinori + + * grub/main.c (main): Move the version number inside the + parentheses, since the grub shell is merely one of the programs + included in GNU GRUB. + +2000-08-13 OKUJI Yoshinori + + Add a serial device emulation into the grub shell. + + * grub/asmstub.c: Include sys/time.h and termios.h. + (serial_fd): New variable. + (serial_device): Likewise. + (serial_getkey): New function. + (serial_checkkey): Likewise. + (serial_putchar): Likewise. + (get_termios_speed): Likewise. + (serial_init): Likewise. + (set_serial_device): Likewise. + (grub_stage2): Restore SERIAL_DEVICE and SERIAL_FD, if they were + allocated. + * stage2/serial.h [GRUB_UTIL] (set_serial_device): Declared. + +2000-08-13 OKUJI Yoshinori + + * stage2/asm.S (codestart) [SUPPORT_DISKLESS]: Don't reset a + disk system. That is not only uncessary but also harmful. + +2000-08-12 OKUJI Yoshinori + + Add a serial device driver (but only the driver). + + * stage2/serial.c: New file. + * stage2/serial.h: Likewise. + * stage2/shared.h (serial_getkey): Moved to stage2/serial.h. + (serial_checkkey): Likewise. + (serial_putchar): Likewise. + * stage2/Makefile.am (noinst_HEADERS): Added serial.h. + (pre_stage2_exec_SOURCES): Added serial.c. + +2000-08-10 Pavel Roskin + + * docs/tutorial.texi: Minor fixes. + +2000-08-10 OKUJI Yoshinori + + * docs/tutorial.texi (Installation): Divided into three sections + instead of two sections. Don't describe the usage of the the + grub shell any longer. Instead, how to use grub-install is + documented. + +2000-08-09 OKUJI Yoshinori + + * stage2/builtins.c [GRUB_UTIL]: Include stdio.h. + (embed_func) [GRUB_UTIL && __linux__]: When embedding a Stage + 1.5 into a partition, call write_to_partition instead of + biosdisk. + (install_func): Set DEST_PARTITION to the partition where Stage + 1 resides. + Set SRC_PART_START to the starting address of the partition + where Stage 2 resides. + (install_func) [GRUB_UTIL]: Set STAGE2_OS_FILE to the file name + of Stage 2 under an OS, if the new option "--stage2" is + specified. Otherwise, set it to null. + If STAGE2_OS_FILE is not null, modify the Stage 2 via the + filesystem serviced by the OS. + (install_func) [GRUB_UTIL && __linux__]: If STAGE2_OS_FILE is + null but the Stage2 resides in a partition, use + write_to_partition. + If DEST_PARTITION is not 0xFFFFFF, use write_to_partition, to + embed Stage 1. + (setup_func) [GRUB_UTIL]: If --stage2 is specified, set + STAGE2_ARG to the string pointing to the option. Otherwise, set + it to null. + (setup_func) [!GRUB_UTIL]: Set STAGE2_ARG to null. + (setup_func): If STAGE2_ARG is not null, add STAGE2_ARG and a + space character into CMD_ARG. + * lib/device.c (_LARGEFILE_SOURCE): Defined. + (_FILE_OFFSET_BITS): Likewise. + [__linux__] (write_to_partition): New function. + * lib/device.h [__linux__] (write_to_partition): Declared. + * util/grub-install.in: Specify the option "--stage2" for the + command "setup". + +2000-08-04 Jochen Hoenicke + + * stage2/fsys_fat.c (fat_superblock): clust_eof_marker added. + (fat_mount): Initialize clust_eof_marker to 0xff8, 0xfff8, or + 0xffffff8, depending on fat size. Support for single active FAT + added (FAT32 extension). Changed the boundary between FAT12 and + FAT16, again. The Microsoft KB article Q65541 seems to be wrong + here, I go with mtools and the previous behaviour of grub: FAT12 + iff number of clusters (without counting the two nonexisting + clusters) is less or equal 4095. + (fat_read): Report error if cluster number is too big, but not + greater or equal clust_eof_marker. + * stage2/fsys_reiserfs.c (journal_init): Fixed calculation of + journal_transaction. + +2000-08-01 Jochen Hoenicke + + * stage2/fsys_reiserfs.c: Symlink support added. + (S_ISLNK): New macro. + (PATH_MAX): Likewise. + (MAX_LINK_COUNT): Likewise. + (reiserfs_dir): Check for symlink and handle them. + (read_tree_node): Take a block number and check if tree node was + already read in. If not update the INFO->blocks field. + (next_key): Changed call of read_tree_node. + (search_stat): Likewise. + (journal_init): Fixed a small bug. Some debugging messages added. + +2000-07-31 Pavel Roskin + + * grub/asmstub.c (biosdisk) [__linux__]: The first argument for + _llseek renamed from "seeked_fd" to "filedes". + +2000-07-30 OKUJI Yoshinori + + * docs/appendices.texi (FAQ): Added the answer for the separate + boot partition problem. + +2000-07-30 OKUJI Yoshinori + + Update the network support to Etherboot-4.6.4. + + From Daniel Wagner : + * netboot/3c509.c: Copied from Etherboot-4.6.4. + * netboot/3c509.h: Likewise. + * netboot/cards.h: Likewise. + * netboot/ns8390.c: Likewise. + * netboot/sk_g16.c: Likewise. + * netboot/sk_g16.h: Likewise. + * netboot/tulip.c: Likewise. + * netboot/pci.h: Likewise. + * netboot/main.c (dhcpdiscover): Updated. + (dhcprequest): Likewise. + (bootp): Likewise. + * netboot/README.netboot: Added the information about the new + option --enable-ns8390-force-16bit. + * configure.in (--enable-ns8390-force-16bit): New option. + + * netboot/config.c: Updated. + +2000-07-29 OKUJI Yoshinori + + The Linux zImage support is working now. + + * stage2/asm.S (linux_boot): Add 3 into %ecx and shift %ecx to + the right by 2 bits, instead of shift %ecx to the left by 2 + bits. + +2000-07-29 Jochen Hoenicke + + * stage2/fsys_reiserfs.c (block_read): Changed the variable "len" + to "j_len" (it shadowed a parameter). + +2000-07-29 OKUJI Yoshinori + + * configure.in (CPPFLAGS): Added -Wshadow, -Wpointer-arith and + -Wundef, as GCC sometimes more clever than me. :) + * stage2/shared.h [!ASM_FILE] (multi_boot): Change the name of + the second argument from "mbi" to "mb_info". + [!ASM_FILE] (biosdisk): Rename the first argument "read" to + "subfunc". + * lib/device.h (init_device_map): Change the name of the third + argument from "floppy_disks" to "no_floppies". + * lib/device.c (read_device_map): Rename the internal function + "print_error" to "show_error". + * stage2/builtins.c (install_func): Rename CONFIG_FILE to + REAL_CONFIG. + (setup_func): Rename INSTALL_DRIVE, INSTALL_PARTITION and + CONFIG_FILE to INSTALLED_DRIVE, INSTALLED_PARTITION and + CONFIG_FILENAME, respectively. + * stage2/char_io.c (convert_to_ascii): Rename the internal + variable C to TMP. + (get_cmdline): Rename KILL to KILL_BUF. + Rename the second argument for cl_print to REAL_ECHO_CHAR from + ECHO_CHAR. + * stage2/stage2.c (run_menu): Rename the internal variable + NUM_ENTRIES to NEW_NUM_ENTRIES. + (cmain): Rename KILL to KILL_BUF. + * stage2/disk_inode_ffs.h: Check if BYTE_MSF is defined before + checking the value. + * stage2/fsys_ext2fs.c (ext2fs_dir): Check if E2DEBUG is + defined, instead of if the value is non-zero. + * grub/asmstub.c: Check if __GLIBC__ is defined before checking + the value. + (biosdisk) [__linux__]: Likewise. + Rename the first argument for _llseek to "seeked_fd" from "fd". + (multi_boot): Rename the second argument to "mb_info" from + "mbi". + +2000-07-27 Gordon Matzigkeit + + * util/grub-image.in: Initial cut at a script for creating GRUB + boot images. + * util/Makefile.am (noinst_SCRIPTS): Added grub-image. + * configure.in (AC_OUTPUT): Added util/grub-image. + +2000-07-27 Jochen Hoenicke + + * stage2/asm.S (check_int13_extensions): Fixed the effect of + the --force-lba switch in stage2/stage1_5. + +2000-07-25 Jochen Hoenicke + + * stage2/fsys_fat.c (fat_mount): Fixed calculation of num_clust. + It was off by two, since the two non existing clusters 0 and 1 + were not taken into account. Also fixed the boundary between + FAT12 and FAT16. + +2000-07-25 OKUJI Yoshinori + + * stage2/asm.S [!STAGE1_5] (linux_text_len): New variable. + [!STAGE1_5] (linux_boot): Don't set %eax to LINUX_SETUP + meaninglessly. + Set %ecx to LINUX_TEXT_LEN instead of LINUX_KERNEL_MAXLEN. + [!STAGE1_5] (big_linux_boot): Disable interrupts before changing + the stack pointer. + Change %ss right before %sp. + Reverse the arguments for ljmp. A segment must be after an + offset. *sigh* + * stage2/boot.c (load_image): Set LINUX_TEXT_LEN to TEXT_LEN, + if a Linux kernel is loaded successfully. + * stage2/shared.h (LINUX_VID_MODE_OFFSET): Removed. + [!ASM_FILE] (linux_kernel_header): Change the type of the member + `heap_end_ptr' to unsigned short. + [!ASM_FILE] (linux_text_len): Declared. + +2000-07-24 OKUJI Yoshinori + + Comply with the Linux/i386 boot protocol version 2.02. + + * stage2/asm.S [!STAGE1_5] (linux_boot): Set the length of moved + bytes to LINUX_KERNEL_MAXLEN instead of + LINUX_KERNEL_LEN_OFFSET(%eax), since the field is obsolete. + [!STAGE1_5] (big_linux_boot): Don't use SEGMENT or OFFSET. + Instead, embed the segment and the offset in the code itself. + Set %ds, %es, %fs and %gs to %ax (LINUX_INIT_SEG). + * stage2/boot.c (load_image): Rewrite the Linux support code + heavily. Use a structure instead of a batch of macros, to access + a Linux kernel header. + (load_initrd): If MOVETO plus LEN is greater than or equal to + LINUX_INITRD_MAX_ADDRESS, set MOVETO to LINUX_INITRD_MAX_ADDRESS + minus LEN with page aligned. + * stage2/shared.h (LINUX_MAGIC_SIGNATURE): New macro. + (LINUX_DEFAULT_SETUP_SECTS): Likewise. + (LINUX_FLAG_CAN_USE_HEAP): Likewise. + (LINUX_INITRD_MAX_ADDRESS): Likewise. + (LINUX_MAX_SETUP_SECTS): Likewise. + (LINUX_BOOT_LOADER_TYPE): Likewise. + (LINUX_HEAP_END_OFFSET): Likewise. + (LINUX_SETUP_MAXLEN): Removed. + (LINUX_KERNEL_LEN_OFFSET): Likewise. + (LINUX_SETUP_LEN_OFFSET): Likewise. + (LINUX_SETUP_STACK): Set to 0x7F00 instead of 0x3FF4 (why was it + this value?). + (LINUX_SETUP_LOADER): Removed. + (LINUX_SETUP_LOAD_FLAGS): Likewise. + (LINUX_SETUP_CODE_START): Likewise. + (LINUX_SETUP_INITRD): Likewise. + (CL_MY_LOCATION): Set to RAW_ADDR(0x97F00) instead of + RAW_ADDR(0x92000). + (CL_MY_END_ADDR): Set to RAW_addr(0x97FFF) instead of + RAW_ADDR(0x920FF). + (CL_MAGIC_ADDR): Removed. + (CL_OFFSET): Likewise. + [!ASM_FILE] (struct linux_kernel_header): New structure tag. + +2000-07-23 OKUJI Yoshinori + + * docs/tutorial.texi: Fix some syntax errors and ambiguous + sentences. Suggested by M. Meiarashi . + +2000-07-14 Khimenko Victor + + * stage2/boot.c (load_image): When getting the text length of a + Linux kernel, use unsigned long instead of unsigned short. + +2000-07-13 OKUJI Yoshinori + + * lib/device.c: Include errno.h. Reported by Thierry DELHAISE + . + +2000-07-12 OKUJI Yoshinori + + Just to start implementing serial console support... + + * stage2/asm.S (grub_putchar): Renamed to ... + (console_putchar): ... this. + [!STAGE1_5] (getkey): Renamed to ... + [!STAGE1_5] (console_getkey): ... this. + [!STAGE1_5] (checkkey): Renamed to ... + [!STAGE1_5] (console_checkkey): ... this. + * stage2/char_io.c [!STAGE1_5] (getkey): New function. + [!STAGE1_5] (checkkey): Likewise. + (grub_putchar): Likewise. + * stage2/shared.h [!STAGE1_5] (terminal): Declared. + [!STAGE1_5] (TERMINAL_CONSOLE): New macro. + [!STAGE1_5] (TERMINAL_SERIAL): Likewise. + (console_putchar): Declared. + (serial_putchar): Likewise. + (console_getkey): Likewise. + (serial_getkey): Likewise. + (console_checkkey): Likewise. + (serial_checkkey): Likewise. + * stage2/builtins.c (terminal): New global variable. The default + is TERMINAL_CONSOLE. + * grub/asmstub.c (grub_putchar): Renamed to ... + (console_putchar): ... this. + (getkey): Renamed to ... + (console_getkey): ... this. + (checkkey): Renamed to ... + (console_checkkey): ... this. + +2000-07-12 OKUJI Yoshinori + + * stage2/Makefile.am (libgrub_a_CFLAGS): Added + -I$(top_srcdir)/lib. + * stage2/builtins.c [GRUB_UTIL]: Include device.h. + +2000-07-12 OKUJI Yoshinori + + Segreate OS-specific helper functions from asmstub.c. + + * grub/asmstub.c [__linux__]: Don't include linux/hdreg.h, + linux/major.h, linux/kdev_t.h, or linux/cdrom.h. + [__FreeBSD__ || __NetBSD__ || __OpenBSD__]: Don't include + sys/ioctl.h, sys/disklabel.h, or sys/ioctl.h. + [HAVE_OPENDISK]: Don't include util.h. + Include device.h. + (DEFAULT_FD_CYLINDERS): Removed. + (DEFAULT_FD_HEADS): Likewise. + (DEFAULT_FD_SECTORS): Likewise. + (DEFAULT_HD_CYLINDERS): Likewise. + (DEFAULT_HD_HEADS): Likewise. + (DEFAULT_HD_SECTORS): Likewise. + (NUM_DISKS): Likewise. + (init_device_map): Likewise. + (get_floppy_disk_name): Likewise. + (get_ide_disk_name): Likewise. + (get_scsi_disk_name): Likewise. + (check_device): Likewise. + (get_drive_geometry): Likewise. + * grub/main.c (no_floppy): Removed. + (probe_second_floppy): Likewise. + (floppy_disks): New global variable. + (main): Set FLOPPY_DISKS to zero, if OPT_NO_FLOPPY. Set + FLOPPY_DISKS to two, if OPT_PROBE_SECOND_FLOPPY. + * lib/Makefile.am (AM_CFLAGS): New variable. + * lib/device.h: New file. + * lib/device.c: Likewise. + * stage2/shared.h (no_floppy): Removed. + (probe_second_floppy): Likewise. + (check_device): Likewise. + (floppy_disks): Declared. + +2000-07-02 OKUJI Yoshinori + + * grub/main.c (usage): Enclose the mail address with parentheses + and add a period into the end of the line. That's just a + cosmetic change. + +2000-07-02 OKUJI Yoshinori + + * docs/appendices.texi (Obtaining and Building GRUB): Indicate + the Cygnus's binutils webpage instead of the hjl's site, since + you can now use a public release (i.e. 2.10). + +2000-06-23 OKUJI Yoshinori + + * stage2/boot.c (load_image): Take an additional argument + LOAD_FLAGS. + If the kernel type is Linux and the bit + KERNEL_LOAD_NO_MEM_OPTION in LOAD_FLAGS is set, don't pass a + Linux's mem option automatically. + * stage2/shared.h (load_image): Added the new argument. + * stage2/builtins.c (kernel_func): If `--no-mem-option' is + specified, set the bit KERNEL_LOAD_NO_MEM_OPTION in LOAD_FLAGS, + otherwise, LOAD_FLAGS is zero. + +2000-06-22 OKUJI Yoshinori + + * docs/tutorial.texi: Fixed some typos and syntax errors. + * docs/user-ref.texi: Likewise. + +2000-06-21 OKUJI Yoshinori + + * stage2/stage2.c (run_menu): Initialize CUR_ENTRY at the + definition. + If SHOW_MENU is zero, don't display the menu interface. Instead, + wait until the timeout is expired and then boot the default + entry. If the user presses `ESC' during the timeout, set + SHOW_MENU to one and break the loop. + Display the menu if SHOW_MENU is true, instead of if + GRUB_TIMEOUT is non-zero. + Set SHOW_MENU to one before go to the label `restart'. + * stage2/builtins.c (show_menu): New global variable. + (hiddenmenu_func): New function. + (builtin_hiddenmenu): New variable. + (builtin_table): Added a pointer to BUILTIN_HIDDENMENU. + * stage2/shared.h (show_menu): Declared. + +2000-06-19 OKUJI Yoshinori + + * docs/mdate-sh: Moved to ... + * mdate-sh: ... here. + * docs/texinfo.tex: Moved to ... + * texinfo.tex: ... here. + +2000-06-09 OKUJI Yoshinori + + * stage2/mb_info.h (AddrRangeDesc): Use one 64bits field instead + of two 32bits fields for BaseAddr and Length, respectively. + BaseAddrLow + BaseAddrHigh -> BaseAddr, LengthLow + LengthHigh + -> Length. + * stage2/builtins.c (displaymem_func): Print BaseAddr >> 32, + BaseAddr & 0xFFFFFFFF, Length >> 32 and Length & 0xFFFFFFFF, + instead of BaseAddrLow, BaseAddrHigh, LengthLow and LengthHigh, + for MAP. + * stage2/common.c (fakemap): Adjusted to the new definition of + AddrRangeDesc. + (mmap_avail_at): Change the type of TOP to unsigned long long. + If TOP is greater than 0xFFFFFFFF, set it to 0xFFFFFFFF, since + GRUB itself cannot deal with 64bits addresses at the moment. + (init_bios_info): When getting a maximum available address from + the memory map, use a new unsigned long long variable MAX_ADDR + as the temporary variable instead of MEMTMP. This should allow + GRUB to detect at most 4TB. + +2000-06-18 OKUJI Yoshinori + + * docs/appendices.texi (FAQ): Added an question about Linux's + `mem=' option and the answer. + +2000-06-17 OKUJI Yoshinori + + * stage2/boot.c (load_image): Pass a mem option to Linux, only + if SRC has no substring "mem=". + +2000-06-17 OKUJI Yoshinori + + * stage2/compile: Removed. + * netboot/compile: Likewise. + * compile: New file. Copied from Automake. + +2000-06-16 OKUJI Yoshinori + + * stage2/boot.c (load_image): Don't remove the vga option after + parsing it. Suggested by Tim Riker. + +2000-06-15 OKUJI Yoshinori + + * stage2/asm.S (grub_halt): Use jmp instead of jc, if INT 15 + AX=5307h fails. + +2000-06-15 OKUJI Yoshinori + + * configure.in (AM_INIT_AUTOMAKE): Increase the version number. + I wish that 0.5.96 will not be released actually... + + * stage2/builtins.c (halt_func): New function. + (builtin_halt): New variable. + (reboot_func): New function. + (builtin_reboot): New variable. + (builtin_table): Added pointers to BUILTIN_HALT and + BUILTIN_REBOOT. + * stage2/asm.S (grub_halt): New function. + (grub_reboot): Likewise. + * stage2/shared.h (grub_halt): Declared. + (grub_reboot): Likewise. + * grub/asmstub.c (grub_reboot): New function. + (grub_halt): Likewise. + +2000-06-12 Gordon Matzigkeit + + * stage2/stage2.c (run_menu): Don't display the menu if the + timeout is zero. This makes for cleaner use as a noninteractive + bootloader. + +2000-06-11 OKUJI Yoshinori + + * docs/tutorial.texi (GNU/Linux): Added a caution about the + "mem=" option. + +2000-06-11 OKUJI Yoshinori + + * util/grub-install.in (convert): When $host_os is linux*, use + the expression 's%\([sh]d[a-z]\)[0-9]*$%\1%' instead of + 's%[0-9]*$%%', to get rid of the partition part. This fixes the + bug "/dev/fd0" -> "/dev/fd". (But don't you think the naming is + quite inconsistent with hard disks? Why not /dev/fd[a-z]?) + Report by Pavel Roskin. + +2000-06-08 OKUJI Yoshinori + + * docs/tutorial.texi (Network): The body is moved to ... + (General usage of network support): ... this new section. + (Diskless): New section. + * docs/user-ref.texi (General commands): Added a description + about the command "tftpserver". + +2000-06-08 OKUJI Yoshinori + + * netboot/main.c (decode_rfc1533) [GRUB]: Eliminate trailing + NULs in the NVT string for a configuration file name, if any. + (decode_rfc1533): Likewise, if Extensions Path is present, + eliminate the trailing NULs, if any. + Also, check the length carefully to ensure that EXTPATH can fit + in FNAME. + +2000-06-06 Jochen Hoenicke + + * stage2/fsys_reiserfs.c: Added journaling to reiser. + (reiserfs_journal_desc): new structure. + (reiserfs_journal_commit): likewise. + (reiserfs_journal_header): likewise. + (fsys_reiser_info): Added fields for journaling. + (journal_read): new function. + (journal_init) likewise. + (block_read): New function to read reiserfs blocks, which reads + from the journal if it contains newer versions. All relevant + devread calls are replaced with calls to this method. + (reiserfs_mount): Check for journaling super block and call + journal_init. + +2000-06-06 OKUJI Yoshinori + + * netboot/main.c (dhcprequest) [GRUB]: Set the length of the + Parameter Request List to (4 + 2). + Set the list to RFC1533_VENDOR_MAGIC and + RFC1533_VENDOR_CONFIGFILE in addition to the standard + parameters. + (decode_rfc1533) [GRUB]: If C is equal to + RFC1533_VENDOR_CONFIGFILE, copy the contents of the tag to + CONFIG_FILE. + If C is equal to RFC1533_VENDOR_MAGIC, increment + VENDOREXT_ISVALID. + * netboot/etherboot.h [GRUB] (RFC1533_VENDOR_CONFIGFILE): New + macro. Defined as 150. + +2000-06-03 OKUJI Yoshinori + + * stage2/asm.S (check_int13_extensions): Check the bitmap only + if FORCE_LBA is zero. + * stage2/bios.c (get_diskinfo): Get rid of the wrong check for + the bit 0 of DRP.FLAGS. Now the bitmap check is correctly + performed in the function check_int13_extensions. + +2000-06-02 OKUJI Yoshinori + + * docs/user-ref.texi (Invoking the grub shell): Added a caution. + Why don't so many people still understand that BIOS drive + numbering are different from OS device naming? How many cautions + and warnings should we write in the documentation? Sigh. + +2000-06-01 OKUJI Yoshinori + + From Chip Salzenberg: + * stage2/cmdline.c (enter_cmdline) [SUPPORT_DISKLESS]: Redisplay + network configuration after clearing screen, before first prompt. + + * stage2/cmdline.c: Include instead of "shared.h". + [SUPPORT_DISKLESS]: Include . + +2000-06-01 OKUJI Yoshinori + + * stage2/builtins.c (setup_func): Check if INSTALL_DRIVE is a + hard disk as well as IMAGE_DRIVE, before trying to install a + Stage 1.5. Reported by Pavel Roskin. + +2000-05-31 OKUJI Yoshinori + + * acinclude.m4 (grub_ASM_ABSOLUTE_WITHOUT_ASTERISK): New + function. Check if GAS requires absolute indirect calls/jumps + with NO asterisk. + * configure.in: Call grub_ASM_ABSOLUTE_WITHOUT_ASTERISK. + * acconfig.h (ABSOLUTE_WITHOUT_ASTERISK): New macro entry. + * netboot/pci.c (bios32_service) [!ABSOLUTE_WITHOUT_ASTERISK]: + Prefix the operand to "lcall" with `*'. + (pcibios_read_config_byte) [!ABSOLUTE_WITHOUT_ASTERISK]: + Likewise. + (pcibios_read_config_word) [!ABSOLUTE_WITHOUT_ASTERISK]: + Likewise. + (pcibios_read_config_dword) [!ABSOLUTE_WITHOUT_ASTERISK]: + Likewise. + (pcibios_write_config_byte) [!ABSOLUTE_WITHOUT_ASTERISK]: + Likewise. + (pcibios_write_config_word) [!ABSOLUTE_WITHOUT_ASTERISK]: + Likewise. + (pcibios_write_config_dword) [!ABSOLUTE_WITHOUT_ASTERISK]: + Likewise. + (check_pcibios) [!ABSOLUTE_WITHOUT_ASTERISK]: Likewise. + * stage2/asm.S (chain_stage1) [!ABSOLUTE_WITHOUT_ASTERISK]: + Prefix the operand to "ljmp" with `*'. + (chain_stage2) [!ABSOLUTE_WITHOUT_ASTERISK]: Likewise. + (big_linux_boot) [!ABSOLUTE_WITHOUT_ASTERISK]: Likewise. + +2000-05-29 Chip Salzenberg + + * stage2/shared.h (grub_memmove): Prototype to use void *. + * stage2/char_io.c (grub_memmove): Define likewise. + +2000-05-30 Gordon Matzigkeit + + * docs/user-ref.texi (Stage2 errors): Update error messages. + +2000-05-29 Pavel Roskin + + * util/grub-install.in: Fix a typo that prevented error messages + from appearing. + Copy and remove files individually and exit with an error as + soon as it fails. + Show $log_file if --debug was given on the command line. + +2000-04-19 Gordon Matzigkeit + + * stage2/cmdline.c (enter_cmdline): Don't give errors on empty + command lines. + + * stage2/common.c (err_list): Clean up wordings slightly. + +2000-05-29 OKUJI Yoshinori + + Based on a patch by Neal H Walfield : + * netboot/misc.c [GRUB] (inet_aton): Defined. + * netboot/main.c (arp_server_override): New function. + * netboot/etherboot.h [GRUB] (arp_server_override): Declared. + (inet_aton): Likewise. + * stage2/builtins.c (tftpserver_func): New function. + (builtin_tftpserver): New variable. + (builtin_table): Added a pointer to BUILTIN_TFTPSERVER. + +2000-05-28 OKUJI Yoshinori + + * stage2/asm.S (codestart): Fix a typo: DISKLESS_SUPPORT -> + SUPPORT_DISKLESS. + * stage2/nbloader.S: Fix the image length and the memory length + fields. They shouldn't contain the first sector for a tag. + Mmh..., that is unclear as far as I see the Net Boot Image + Proposal... + * stage2/shared.h (STACKOFF): Enclosed with parentheses. + (PROTSTACKINIT): Likewise. + +2000-05-27 OKUJI Yoshinori + + Add diskless support, mostly based on patches by Christoph + Plattner , but also based on a patch + by Chip Salzenberg for PXE. Of course, I've + modified both the patches thoroughly to adapt them to my + preference. + + * configure.in (--enable-diskless): New option. Set a + conditional DISKLESS_SUPPORT. + * stage2/Makefile.am (noinst_HEADERS): Added nbi.h. + (EXTRA_PROGRAMS): New variable. + (pkgdata_DATA) [DISKLESS_SUPPORT]: Added + nbgrub and pxegrub. + (noinst_DATA) [DISKLESS_SUPPORT]: Added nbloader, pxeloader and + diskless. + (noinst_PROGRAMS) [DISKLESS_SUPPORT]: Added nbloader.exec, + pxeloader.exec and diskless.exec. + (PXELOADER_LINK): New variable. + (BUILT_SOURCES) [DISKLESS_SUPPORT]: Added diskless_size.h. + (diskless_exec_SOURCES): New variable. + (diskless_exec_CFLAGS): Likewise. + (diskless_exec_LDFLAGS): Likewise. + (diskless_exec_LDADD): Likewise. + (diskless_size.h): New target. + (nbloader_exec_SOURCES): New variable. + (nbloader_exec_CFLAGS): Likewise. + (nbloader_exec_LDFLAGS): Likewise. + (nbloader_exec-nbloader.o): New dependency. + (nbgrub): New target. + (pxeloader_exec_SOURCES): new variable. + (pxeloader_exec_CFLAGS): Likewise. + (pxeloader_exec_LDFLAGS): Likewise. + (pxegrub): New target. + * stage2/asm.S (install_partition): Set to 0xFFFFFF instead of + 0x020000. What was the benefit from the previous setting? + (codestart) [SUPPORT_DISKLESS]: Don't move %dl to BOOT_DRIVE. + (boot_drive) [SUPPORT_DISKLESS]: Set to NETWORK_DRIVE instead of + zero. + * stage2/common.c: Include instead of "shared.h", + just for a cosmetic reason. + [SUPPORT_DISKLESS]: Include etherboot.h. + [SUPPORT_DISKLESS] (setup_diskless_environment): New internal + function. + (init_bios_info) [SUPPORT_DISKLESS]: Call + setup_diskless_environment after the memory initialization is + finished. Return if fails. + * stage2/nbloader.S: New file. + * stage2/pxeloader.S: Likewise. + * stage2/nbi.h: Likewise. + +2000-05-25 OKUJI Yoshinori + + * netboot/fsys_tftp.c (buf_fill): Warn when amazing things + happen. + (tftp_dir): Revert previous change. Don't use TFTP_MIN_PACKET + but calculate the appropriate length. + +2000-05-23 OKUJI Yoshinori + + * netboot/fsys_tftp.c (tftp_dir): Append "0\0" to the request + string, because the "tsize" option must be followed by zero, + according to RFC 2349. + +2000-05-22 OKUJI Yoshinori + + Synchronize the documentation with the code. + + * docs/user-ref.texi: Added ReiserFS as a supported filesystem. + Updated the descriptions about `password', `install', `kernel', + and `setup'. + Added a description about `lock'. + Added descriptions about ERR_UNALIGNED and ERR_PRIVILEGED. + Added a description about the option `--force-lba' of + the program `grub-install'. + * docs/tutorial.texi: Updated the subsection for NetBSD. + +2000-05-21 OKUJI Yoshinori + + * stage2/asm.S (set_int13_handler): Don't use MBI to get the + lower memory size. Instead, decrease it in the BIOS memory + directly and set %eax to it, since MBI.MEM_LOWER may not be the + same as [0x413] any longer due to the previous change. + + * grub/asmstub.c (CONVENTIONAL_MEMSIZE): Changed to 640 * 1024 + from 640. You didn't like the inconsistency between + EXTENDED_MEMSIZE and CONVENTIONAL_MEMSIZE, did you? + (get_memsize): Return CONVENTIONAL_MEMSIZE >> 10 instead of + CONVENTIONAL_MEMSIZE, if TYPE is zero. + (get_eisamemsize): Return EXTENDED_MEMSIZE >> 10 instead of + EXTENDED_MEMSIZE / 1024. Just a cosmetic change. + (MMAR_DESC_LENGTH): New macro. Defined as 20. + (get_mmap_entry): Define a new variable DESC_TABLE statically, + and copy the CONTth entry to *DESC if CONT is a correct index. + +2000-05-21 Chip Salzenberg + + * stage2/common.c (mmap_avail_at): New function, abstracted out + of init_bios_info, to scan E820 memory map. + (init_bios_info): Use mmap_avail_at for _both_ MBI.MEM_UPPER and + MBI.MEM_LOWER. + +2000-05-17 OKUJI Yoshinori + + Update the network support to Etherboot-4.6.1. + + * netboot/config.c (pci_nic_list) [INCLUDE_TULIP]: Added an + entry for Davicom 9102. + * netboot/epic100.c: Just copied. + * netboot/pci.h: Likewise. + * netboot/tulip.c: Likewise. + * netboot/etherboot.h (tftp): Change the type of the first + argument to const char * from char *. + * netboot/main.c (tftp): Likewise. + +2000-05-13 OKUJI Yoshinori + + * util/grub-install.in: If the program `cp' fails, exit with the + status code 1. Suggested by Pavel Roskin. + +2000-05-13 OKUJI Yoshinori + + From Pixel : + * stage2/pc_slice.h (PC_SLICE_TYPE_LINUX_EXTENDED): New macro. + (IS_PC_SLICE_TYPE_EXTENDED): Added a check for + PC_SLICE_TYPE_LINUX_EXTENDED. + +2000-05-05 OKUJI Yoshinori + + * stage2/common.c (init_bios_info) [!STAGE1_5]: When the memory + map is present, search the maximum for MEMTMP in bytes instead + of kilobytes and set EXTENDED_MEMORY to MEMTMP minus 1MB in + kilobytes. + +2000-05-05 OKUJI Yoshinori + + Ignore any memory holes when passing the maximum memory address + to non-Multiboot kernels (i.e. Linux and *BSD). + + * stage2/common.c [!STAGE1_5] (extended_memory): New global + variable. + (init_bios_info) [!STAGE1_5]: Change the type of CONT, MEMTMP + and ADDR to unsigned long from int. + Set EXTENDED_MEMORY to MBI.MEM_UPPER by default. + If MBI.MMAP_LENGTH is not zero, set EXTENDED_MEMORY to the + maximum available address, ignoring any memory holes. + If MBI.MMAP_LENGTH is zero but get_eisamemsize returns other + than -1, set EXTENDED_MEMORY to (CONT >> 10) + 0x3c00 if CONT is + non-zero, otherwise, set it to MEMTMP. + * stage2/shared.h [!STAGE1_5] (extended_memory): Declared. + * stage2/boot.c (load_image): Always pass the "mem=" option to a + Linux kernel, using EXTENDED_MEMORY instead of MBI.MEM_UPPER. + (bsd_boot): Use EXTENDED_MEMORY instead of MBI.MEM_UPPER. + +2000-04-30 OKUJI Yoshinori + + * stage1/stage1.S (message): Use lodsb instead of incw and movb. + From Andrew Clausen . + + * stage1/stage1.S (copy_buffer): Set %cx to 0x100 and use movsw + instead of movsb, since it is guaranteed that the region is + properly aligned. + +2000-04-29 OKUJI Yoshinori + + * stage2/builtins.c (setup_func): Use SECTOR_BITS instead of + SECTOR_SIZE to compute BLOCKSIZE. + +2000-04-26 OKUJI Yoshinori + + * netboot/depca.c: Copied from Etherboot-4.6.0. + +2000-04-23 OKUJI Yoshinori + + More security-related features. + + * stage2/builtins.c (auth): New global variable. + (configfile_func): Clear AUTH before jumping to cmain. + (lock_func): New function. + (builtin_lock): New variable. + (password_func): Make sure that LEN + 2 is less than or equal to + PASSWORD_BUFLEN, because now the password must be terminated + with double NULs, in order to permit an empty configuration file + name. + Copy LEN bytes from ARG to PASSWORD, instead of LEN + 1 bytes. + Clear the rest of the buffer PASSWORD. + (builtin_table): Added a pointer to BUILTIN_LOCK. + * stage2/common.c (err_list): Added an entry for ERR_PRIVILEGED. + * stage2/stage2.c (run_menu): If AUTH is true, show the messages + for a non-password configuration, even if PASSWORD is not NULL. + Likewise, if AUTH is true, allow the user to use privileged + instructions (such as `c'). + If a correct password is entered, check if *PPTR is NUL or not. + If it is NUL, set AUTH to 1 and go to the label restart, + otherwise, copy PPTR to NEW_FILE, clear AUTH, and return. + * stage2/shared.h (grub_error_t): Added a new constant + ERR_PRIVILEGED. + (auth): Declared. + +2000-04-23 OKUJI Yoshinori + + * docs/user-ref.texi (Command-line-specific commands): Don't use + the command @var for the argument "file" to the command + "configfile" on the definition. + +2000-04-22 OKUJI Yoshinori + + Update the network support to Etherboot 4.5.8. + + * configure.in (--enable-3c590): New option. + (--enable-3c595): Likewise. + (--enable-depca): Likewise. + (--enable-lance): Likewise. + (--enable-ns8390): Likewise. + (--enable-ntulip): Likewise. + (--enable-lancepci): Removed. + (--enable-nepci): Likewise. + (--enable-otulip): Likewise. + (--enable-smc9000): The duplicated one is named to ... + (--enable-smc9000-scan): ... this. This was a typo, perhaps. + + * netboot/Makefile.am (libdrivers_a_SOURCES): Removed + byteorder.h, if.h, netboot_config.h and netdevice.h, and added + cards.h. + (EXTRA_libdrivers_a_SOURCES): Removed ntulip.c and tulip.h, and + added 3c595.c, 3c595.h, depca.c, otulip.c and otulip.h. + (libdrivers_a_CFLAGS): Define FSYS_TFTP as 1 instead of empty. + (EXTRA_DIST): Removed ntulip.txt, and added cs89x0.txt and + tulip.txt. + (3c595_drivers): New variable. + (depca_drivers): Likewise. + (lance_drivers): Removed lancepci.o and added lance.o. + (ns8390_drivers): Removed nepci.o and added ns8390.o. + (ntulip_drivers): Deleted. + (otulip_drivers): New variable. + ($(3c595_drivers)): New target. + ($(depca_drivers)): Likewise. + ($(ntulip_drivers)): Deleted. + ($(otulip_drivers)): New target. + (3c590_o_CFLAGS): New variable. + (3c595_o_CFLAGS): Likewise. + (depca_o_CFLAGS): Likewise. + (lancepci_o_CFLAGS): Deleted. + (lance_o_CFLAGS): New variable. + (nepci_o_CFLAGS): Deleted. + (ns8390_o_CFLAGS): New variable. + (ntulip_o_CFLAGS): Deleted. + (otulip_o_CFLAGS): New variable. + + * netboot/3c90x.c: Updated to Etherboot-4.5.8. + * netboot/3c90x.txt: Likewise. + * netboot/cs89x0.c: Likewise. + * netboot/cs89x0.h: Likewise. + * netboot/eepro100.c: Likewise. + * netboot/epic100.c: Likewise. + * netboot/epic100.h: Likewise. + * netboot/i82586.c: Likewise. + * netboot/lance.c: Likewise. + * netboot/linux-asm-io.h: Likewise. + * netboot/linux-asm-string.h: Likewise. + * netboot/nic.h: Likewise. + * netboot/ns8390.c: Likewise. + * netboot/ns8390.h: Likewise. + * netboot/pci.c: Likewise. + * netboot/pci.h: Likewise. + * netboot/rtl8139.c: Likewise. + * netboot/sk_g16.c: Likewise. + * netboot/sk_g16.h: Likewise. + * netboot/smc9000.c: Likewise. + * netboot/smc9000.h: Likewise. + * netboot/tiara.c: Likewise. + * netboot/tulip.c: Likewise. + * netboot/via-rhine.c: Likewise. + + * netboot/config.c: Updated to Etherboot-4.5.8 and modified (see + below). + [GRUB] (print_config): Undefined. + (eth_probe) [GRUB]: If PROBED is true, do nothing. Otherwise, + clear NETWORK_READY and ARPTABLE, set ROM to ROM_INFO_LOCATION, + and set PROBED to 1 if succeeds. + * netboot/etherboot.h: Likewise, + (GRUB): New macro. + [GRUB]: Include . + [GRUB] (NO_DHCP_SUPPORT): Undefined. + [GRUB] (RELOC): Defined as zero. + [GRUB] (INTERNAL_BOOTP_DATA): Defined as one. + [GRUB] (USE_INTERNAL_BUFFER): Likewise. + [GRUB] (BACKOFF_LIMIT): Defined as 7. + [GRUB] (CTRL_C): New macro. + [GRUB] (print_network_configuration): Declared. + [GRUB] (ip_abort): Likewise. + [GRUB] (network_ready): Likewise. + * netboot/fsys_tftp.c: Don't include . + (isocket): Renamed to ... + (iport): ... this. + (osocket): Renamed to ... + (oport): ... this. + (bcounter): New variable. + (buf_fill): When checking the block order, see BCOUNTER as well + as BLOCK. + Don't process a packet, if BLOCK minus PREVBLOCK is not 1, + instead of if BLOCK is less than or equal to PREVBLOCK. + Increment BCOUNTER after reseting RETRY. + (send_rrq): Clear BCOUNTER. + Call await_reply with AWAIT_QDRAIN. + * netboot/main.c: Don't include . + (dhcpdiscover): Made const. + (dhcprequest): Likewise. Updated the contents. + (broadcast): Made const. + (udp_transmit): Copied. + (tftp): Likewise. + (bootp): Likewise. + (rarp): Likewise. + (await_reply): Likewise. + (decode_rfc1533): Likewise. + (rfc951_sleep): Likewise. + (cleanup_net): Likewise. + * netboot/misc.c (sleep): Copied. + (twiddle): Likewise. + (getdec): Likewise. + * netboot/osdep.h: Copied and modified (see below). + [GRUB] (ETHERBOOT32): Used the same definition as Linux and + FreeBSD. + [GRUB] (ntohl): Likewise. + [GRUB] (htonl): Likewise. + [GRUB] (ntohs): Likewise. + [GRUB] (htons): Likewise. + [GRUB] (swap32): Likewise. + [GRUB] (swap16): Likewise. + [GRUB]: Include "linux-asm-io.h". + + * netboot/byteorder.h: Removed. + * netboot/if.h: Likewise. + * netboot/netboot_config.h: Likewise. + * netboot/netdevice.h: Likewise. + * netboot/ntulip.c: Likewise. + * netboot/ntulip.txt: Likewise. + * netboot/tulip.h: Likewise. + + * netboot/3c595.c: New file. Copied from Etherboot-4.5.8. + * netboot/3c595.h: Likewise. + * netboot/cards.h: Likewise. + * netboot/cs89x0.txt: Likewise. + * netboot/depca.c: Likewise. + * netboot/otulip.c: Likewise. + * netboot/otulip.h: Likewise. + * netboot/tulip.txt: Likewise. + +2000-02-29 Jochen Hoenicke + + * stage2/common.c (err_list): Added message for ERR_UNALIGNED. + * stage2/shared.h [!STAGE1_5] (disk_read_hook,disk_read_func): New + parameters offset and length. + (ERR_UNALIGNED): New error code. + * stage2/disk_io.c (rawread) [!STAGE1_5]: Call disk_read_func with + offset and length. + * stage2/builtin.c (disk_read_print_func): Print offset and length. + (blocklist_func): Print detailed byte ranges for partial sectors. + (install_func): Detect partial sectors and print error message. + +2000-04-18 Pavel Roskin + + * util/grub-install.in: Don't use `!' in `test' for more + portability. + Don't use `for' without `in' for compatability with ash. + Check install_device before running grub if possible. Added + error messages if install_device is not set or not unique. + Exit if mkdir fails. + Add a message about successful installation. + Remove unneeded backslash in the final message. + (convert): use `test -b' instead of `test -e' because ash + doesn't understand the later. Correct error message accordingly. + +2000-04-17 OKUJI Yoshinori + + The user doesn't have to recompile GRUB for his/her buggy BIOS + any longer. It is configurable to ignore the LBA support bitmap + at the installation time. + + * stage1/stage1.S (force_lba): New variable. + (stage2_address): Moved forwards, to align some variables in + natural boundaries. + (real_start): Check if FORCE_LBA is non-zero, if so, jump to + skip_lba_bitmap_check, otherwise, check if bit 0 of the support + bitmap is non-zero. + Don't use #ifdef for CHECK_LBA_SUPPORT_BITMAP. + (skip_lba_bitmap_check): New label. + * stage1/stage1.h (COMPAT_VERSION_MINOR): Set to 1. + (STAGE1_FORCE_LBA): New macro. + (STAGE1_STAGE2_ADDRESS): Set to 0x42. + (STAGE1_STAGE2_SECTOR): Set to 0x44. + (STAGE1_STAGE2_SEGMENT): Set to 0x48. + * stage2/asm.S (force_lba): New variable. + * stage2/bios.c (get_diskinfo): Don't use #ifdef for + CHECK_LBA_SUPPORT_BITMAP. Instead, check if FORCE_LBA is + non-zero. If so, don't check the bit 0 of DRP.FLAG. + * stage2/builtins.c (install_func): Check if a new option + `--force-lba' is specified. If specified, set IS_FORCE_LBA to 1 + and set ARG to a value returned by skip_to. Otherwise, + IS_FORCE_LBA is zero. + Set the "force LBA" flag in STAGE1_BUFFER (the offset is + STAGE1_FORCE_LBA) to IS_FORCE_LBA. + Likewise, set the "force LBA" flag in STAGE2_SECOND_BUFFER + (the offset is STAGE2_FORCE_LBA) to IS_FORCE_LBA. + If IS_STAGE1_5 is true, then modify the Stage2, regardless of + the presence of the option REAL_CONFIG_FILE. Set the "force LBA" + flag in SCRATCHADDR (the offset is STAGE2_FORCE_LBA) to + IS_FORCE_LBA. + (builtin_install): Added description about `--force-lba' into + the docs. + (setup_func): Check if `--force-lba' is specified in ARG. If + specified, set IS_FORCE_LBA to 1 and set ARG to a value returned + by skip_to. Otherwise, IS_FORCE_LBA is zero. + If IS_FORCE_LBA is true, prepend "--force-lba " to CMD_ARG. + (builtin_setup): Added descriptions about `--force-lba' into the + docs. + * stage2/shared.h (STAGE2_FORCE_LBA): New macro. + (STAGE2_VER_STR_OFFS): Set to 0xe. + (force_lba): Declared. + * util/grub-install.in (force_lba): New variable. Set to an + empty sting by default. + (usage): Added a description about `--force-lba'. + (--force-lba): Checked in the option handling code. If + specified, set FORCE_LBA to "--force-lba". + Run the command "setup" with $force_lba added before + $install_drive. + * configure.in (--disable-lba-support-bitmap): Removed. + +2000-04-15 OKUJI Yoshinori + + * util/grub-install.in (root_device): Append `/' to ${rootdir}, + since ROOTDIR may be empty. Reported by Satoshi Nagayasu + . + +2000-04-15 Jochen Hoenicke + + * configure.in: Added --disable-reiserfs option. + * stage2/Makefile.am (libgrub_a_SOURCES): Added fsys_reiserfs.c. + (libgrub_a_CFLAGS): Added -DFSYS_REISERFS=1. + (pkgdata_DATA): Added reiserfs_stage1_5. + (noinst_PROGRAMS): Added reiserfs_stage1_5.exec. + (pre_stage2_exec_SOURCES): Added fsys_reiserfs.c. + (reiserfs_stage1_5_exec_SOURCES): New variable. + (reiserfs_stage1_5_exec_CFLAGS): Likewise. + (reiserfs_stage1_5_exec_LDFLAGS): Likewise. + * stage2/disk_io.c (fsys_table): Added reiserfs entry. + * stage2/filesys.h (FSYS_REISERFS_NUM): New macro. + [FSYS_REISERFS] (reiserfs_mount, reiserfs_read, reiserfs_dir, + reiserfs_embed): Declare external function from fsys_reiserfs.c. + [!NUM_FSYS] (NUM_FSYS): Added FSYS_REISERFS_NUM. + * stage2/builtins.c (setup_func): Added reiserfs to + STAGE1_5_MAP. + * stage2/shared.h (STAGE2_ID_REISERFS_STAGE1_5): New macro. + [STAGE1_5] [FSYS_REISERFS] (STAGE2_ID): Defined to + STAGE2_ID_REISERFS_STAGE1_5. + * stage2/fsys_reiserfs.c: New file. + + * stage2/builtins.c (embed_func): Call open_device instead of + open_partition. + Don't check if the filesystem is FFS. Instead, check if + FSYS_TABLE[FSYS_TYPE].EMBED_FUNC is NULL and, if not, call it. + (find_func): When CURRENT_SLICE is not a BSD slice, check if the + file can be opened, only if open_device succeeds. + * stage2/filesys.h (fsys_table): New entry embed_func. + (ffs_embed): Declared. + * stage2/disk_io.c (fsys_table): Fill embed_func entries. The + entry for FFS is ffs_embed and the others are NULLs. + * stage2/fsys_ffs.c (ffs_embed): New function. + + * stage2/shared.h (SECTOR_SHIFT): New constant with + (1 << SECTOR_SHIFT) == SECTOR_SIZE. + * stage2/shared.h [!NO_BLOCK_FILES] (block_files): No longer + extern. + * stage2/disk_io.c [!NO_BLOCK_FILES] (block_files): Likewise. + (rawread, devread): Use SECTOR_BITS. + (rawread): Fixed calculation of BUFADDR if an error occured. Set + it to BUFFERADDR + BYTE_OFFSET instead of BUFFERSEG + + BYTE_OFFSET. + (grub_close) [!NO_BLOCK_FILES]: If BLOCK_FILE is non-zero, + return immediately. + (grub_close): Don't check if FSYS_TYPE is NUM_FSYS. + * stage2/fsys_fat.c (log2): New inline function. + (fat_mount): Use log2 instead of calculating the size/bit by a + loop. + +2000-04-12 OKUJI Yoshinori + + * configure.in: Use AC_PATH_PROG instead of AC_PATH_TOOL, + because I don't want to use the CVS version. Now you can use + autoconf 2.13. + +2000-04-10 OKUJI Yoshinori + + * stage2/stage2.c (run_menu): In the case where C is `o', check + if ENTRYNO is less than 11. If not, increase FIRST_ENTRY instead + of ENTRYNO. Reported by Pixel . + +2000-04-09 OKUJI Yoshinori + + * stage1/depcomp: Removed, because it makes `make dist' + unworkable. + + For developers: Don't run automake with --add-missing. Instead, + you should specify --force-missing. If you really want to add a + script from automake, copy it at hand. *sigh* + +2000-04-05 OKUJI Yoshinori + + * stage2/builtins.c (kernel_func): Added missing ``size'' + arguments into `grub_memcmp's. Reported by Christoph Plattner + . + + From Torsten Duwe : + * stage2/boot.c (load_initrd): Mask the address with 0x3FFFFFFF + instead of 0xFFFFFFFF to place the initrd below 1GB. + (load_image): In Linux boot, add the option "mem=" only if more + than 64MB are present. + * grub/asmstub.c [__linux__]: Include for + CDROM_GET_CAPABILITY. + [__FreeBSD__ || __NetBSD__ || __OpenBSD__]: Include + for CDIOCCLRDEBUG. + (check_device) [__linux__] [CDROM_GET_CAPABILITY]: If ioctl for + CDROM_GET_CAPAIBILITY succeeds, return zero. + [__FreeBSD__ || __NetBSD__ || __OpenBSD__] [CDIOCCLRDEBUG]: If + ioctl for CDIOCCLRDEBUG succeeds, return zero. + + * stage2/boot.c (load_initrd): Subtract 0x1000 (one page size) + from MOVETO, to avoid a Linux 2.3.xx's bug. + +2000-04-03 OKUJI Yoshinori + + Add a dirty hack into the kernel loader so that the user can + force GRUB to load NetBSD ELF kernels. The support code is + mostly stolen from a patch by Pavel Roskin. + + * stage2/boot.c (load_image): Added an optional argument + SUGGESTED_TYPE. + If BUFFER is a bootable ELF image and SUGGESTED_TYPE is + KERNEL_TYPE_NETBSD, then load it as an ELF image and set STR2 to + "NetBSD" and TYPE to SUGGESTED_TYPE. + If the image is a Linux kernel and SUGGESTED_TYPE is not + KERNEL_TYPE_NONE, make sure that SUGGESTED_TYPE matches up to + the Linux kernel type. + If TYPE is KERNEL_TYPE_NETBSD, set MEMADDR to + RAW_ADDR (phdr->paddr & 0xFFFFFF) like FreeBSD. + If SUGGESTED_TYPE is not KERNEL_TYPE_NONE, make sure that + SUGGESTED_TYPE is equal to TYPE. + (bsd_boot): If TYPE is not KERNEL_TYPE_FREEBSD (i.e. NetBSD or + OpenBSD) and the bit MB_INFO_AOUT_SYMS is set, set END_MARK to + MBI.SYMS.A.ADDR + 4 + MBI.SYMS.A.TABSIZE + MBI.SYMS.A.STRSIZE. + If the bit is clear, set END_MARK to 0. + Pass END_MARK to *ENTRY_ADDR instead of directly calculating the + end of symbols. + * stage2/shared.h (load_image): Added the argument + SUGGESTED_TYPE to the prototype. + * stage2/builtins.c (kernel_func): Added a new option, + `--type=TYPE'. Check if ARG is started with "--type=". + If so, set SUGGESTED_TYPE to KERNEL_TYPE_NETBSD, + KERNEL_TYPE_FREEBSD, KERNEL_TYPE_NETBSD, KERNEL_TYPE_LINUX, + KERNEL_TYPE_BIG_LINUX, KERNEL_TYPE_MULTIBOOT if ARG is "netbsd", + "freebsd", "openbsd", "linux", "biglinux", "multiboot", + respectively. Otherwise, set ERRNUM to ERR_BAD_ARGUMENT and + return 1. Set KERNEL_ARG to a string after the option. + (builtin_kernel): Added a description about the new option. + +2000-04-03 OKUJI Yoshinori + + * stage2/stage2.c (run_menu) [GRUB_UTIL]: Removed a nested + "#ifdef GRUB_UTIL" ... "#endif". + * stage2/builtins.c (unhide_func): Don't modify SAVED_DRIVE or + SAVED_PARTITION. + (hide_func): Likewise. + * stage2/disk_io.c (set_partition_hidden_flag): Use + CURRENT_DRIVE and CURRENT_PARTITION instead of SAVED_DRIVE and + SAVED_PARTITION. Check if bit 7 in CURRENT_DRIVE is non-zero + instead of if CURRENT_DRIVE is non-zero. + + * grub/asmstub.c (init_device_map): Change the message + "Probe devices..." to "Probing devices...". Suggested by Neal H + Walfield. + + * stage2/pc_slice.h (PC_SLICE_TYPE_HIDDEN_FLAG): Move the + definition before the PC partition type definitions. + (IS_PC_SLICE_TYPE_FAT): Clear the hidden flag in TYPE before + checking if TYPE is either of the FAT partition types. Reported + by Thomas Schweikle . + +2000-04-02 OKUJI Yoshinori + + * stage2/builtins.c (setup_func): Don't read a stage 1.5 to get + the size. Use FILEMAX instead. + If embed_func fails (i.e. ERRNUM is non-zero), goto fail. + +2000-04-02 OKUJI Yoshinori + + Suggested by Neal H Walfield : + * stage2/common.c (init_bios_info): Removed a nested + "#ifndef STAGE1_5" ... "#endif". + * util/grub-install.in: Quote most of the references to + shell variables by double quotation marks. + (usage): Added a description about the argument. + * stage2/builtins.c (setup_func): Change each of the messages + when running embed_func and install_func. "Run" -> "Running". + If install_func succeeds, print a message ("Done."). + + From Frank Mehnert : + * stage2/char_io.c (convert_to_ascii) [!STAGE1_5]: Accept 'X' + and 'b' as well. If C is 'X' or 'b', then set MULT to 16. + (grub_printf): Set a new variable MASK to 0xFFFFFFFF by default. + Mask *DATAPTR with MASK when calling convert_to_ascii. + (grub_printf) [!STAGE1_5]: Added 'b' and 'X'. If C is 'b', set + MASK to 0xFF and fall through to the case 'u'. 'X' is the same + as 'x'. + + From Josip Rodin : + * grub.texi: Several awkward English sentences are fixed. + * tutorial.texi: Likewise. + * user-ref.texi: Likewise. + * appendices.texi: Likewise. + +2000-03-27 OKUJI Yoshinori + + * stage1/depcomp: New file. Automake forces to install it. This + is a known bug, so I will remove this when Tom fixes it. + * configure.in (AM_INIT_AUTOMAKE): Don't get the package name + and the version from debian/changelog. This is a workaround. + +2000-03-20 OKUJI Yoshinori + + * stage2/Makefile.am (nodist_pkgdata_DATA): Renamed to ... + (pkgdata_DATA): ... this. DATA is not distributed by default. + (CLEANFILES): Delete the first one. I don't know why this + variable was duplicated. + Set to $(pkgdata_DATA) instead of $(nodist_pkgdata_DATA). + (start_exec_DEPENDENCIES): Removed. This doesn't make sense. + (start_exec-start.o): New rule. + * depcomp: New file. Copied from automake. + * missing: Updated from automake. + +2000-03-15 OKUJI Yoshinori + + * netboot/Makefile.am (EXTRA_libdrivers_a_SOURCES): 3c89x0.h -> + cs89x0.h. Just a typo. + +2000-03-10 Gordon Matzigkeit + + * debian/rules: Strip mbchk. + + * debian/postinst: Fix up /usr/doc symlink creation. + +2000-03-01 OKUJI Yoshinori + + * netboot/fsys_tftp.c (tftp_dir): Add BUF_READ into FILEMAX + after BUF_EOF becomes non-zero. Reported by Per Lundberg. + +2000-03-01 OKUJI Yoshinori + + * stage2/builtins.c (color_func): Return 1 if safe_parse_maxint + returns zero instead of non-zero. Reported by Magnus Holmberg + . + +2000-02-29 OKUJI Yoshinori + + * grub/asmstub.c [__linux__]: Include for the + macro MAJOR. From Kalle Olavi Niemitalo . + +2000-02-27 OKUJI Yoshinori + + * docs/tutorial.texi (Network): New chapter. + +2000-02-26 OKUJI Yoshinori + + * docs/help2man: Upgraded to 1.020. + * docs/grub.8: Regenerated. + * docs/grub-install.8: Likewise. + * docs/mbchk.1: Likewise. + + * docs/tutorial.texi (Boot): Rewritten heavily. Added the notes + on FreeBSD, NetBSD, OpenBSD, DOS/Windows and SCO UnixWare. + * docs/menu.lst: Load "/boot/loader" instead of "/kernel" in the + FreeBSD entry. This is consistent with the documentation. + +2000-02-25 OKUJI Yoshinori + + * netboot/fsys_tftp.c (tftp_read): Set BUF_READ to zero if + FILEPOS is less than SAVED_FILEPOS, before calling buf_fill. + Don't discard all of the copied data so that we can move FILEPOS + backwards cheaply. Now SAVED_FILEPOS indicates the file position + corresponding to the first byte of BUF. If (FILEPOS - + SAVED_FILEPOS) is greater than (FSYS_BUFLEN / 2), move the data + forwards and add (FSYS_BUFLEN / 2) into SAVED_FILEPOS and + subtract the same value from BUF_READ. + +2000-02-24 OKUJI Yoshinori + + * stage2/disk_io.c [!STAGE1_5] (print_fsys_type): Mask + CURRENT_SLICE with 0xFF when printing the partition type. + + * grub/asmstub.c [__linux__]: Include for the + definition FLOPPY_MAJOR. + (check_device) [__linux__]: Skip the HDIO_GETGEO ioctl if the + major number of ST.ST_RDEV is FLOPPY_MAJOR. + +2000-02-21 OKUJI Yoshinori + + * stage2/disk_io.c (check_BSD_parts) [!STAGE1_5]: Use the term + "BSD sub-partition" instead of "BSD slice" for consistency. + + * stage2/builtins.c (boot_func): Copy the partition table to + BOOT_PART_TABLE instead of (BOOTSEC_LOCATION + + BOOTSEC_PART_OFFSET). Don't use grub_memmove, but copy it + directly, since memcheck is too strict. + * stage2/disk_io.c (real_open_partition) [!STAGE1_5]: Set + CUR_PART_ADDR to (BOOT_PART_TABLE + (i << 4)). + * stage2/shared.h (BOOT_PART_TABLE): New macro. + (chain_stage1): Change the types of all the arguments to + unsigned long. + (chain_stage2): Likewise. + * grub/asmstub.c (chain_stage1): Adjusted to the prototype. + (chain_stage2): Likewise. + +2000-02-21 OKUJI Yoshinori + + * stage2/disk_io.c (check_BSD_parts) [!STAGE1_5]: If the BSD + label is invalid, print a message with the partition type in the + case where FLAGS is non-zero and DO_COMPLETION is zero. + +2000-02-20 OKUJI Yoshinori + + * docs/user-ref.texi (Command-line-specific commands): Added a + description about "cmp". + * docs/appendices.texi (Reporting bugs): Rewritten. + +2000-02-20 OKUJI Yoshinori + + Update the netboot code to Etherboot 4.4.3. + + * netboot/netboot_config.h: Copied from etherboot-4.4.3. + * netboot/cs89x0.h: Likewise. + * netboot/cs89x0.c: Likewise. + * netboot/i82586.c: Likewise. + * netboot/lance.c: Likewise. + * netboot/linux-asm-string.h: Likewise. + * netboot/nic.h: Likewise. + * netboot/ntulip.c: Likewise. + * netboot/osdep.h: Likewise. + * netboot/pci.h: Likewise. + * netboot/pci.c: Likewise. + * netboot/rtl8139.c: Likewise. + * netboot/tiara.c: Likewise. + +2000-02-19 OKUJI Yoshinori + + * stage2/builtins.c (cmp_func): New function. + (builtin_cmp): New variable. + (builtin_table): Added a pointer to BUILTIN_CMP. + + * stage2/fsys_fat.c (fat_mount): Check if BPB.SECTS_PER_CLUST is + zero after reading the BPB to avoid zero division. + +2000-02-18 OKUJI Yoshinori + + * stage2/disk_io.c [!STAGE1_5] (make_saved_active): Make sure + that SAVED_PARTITION is not an extended partition. + If SAVED_DRIVE is not a hard disk drive, set ERRNUM to + ERR_DEV_VALUES and return zero. + + * netboot/3c59x.c: Removed. + * netboot/Makefile.am (EXTRA_libdrivers_a_SOURCES): Deleted + 3c59x.c. + (3c59x_drivers): Deleted. + (3c59x_o_CFLAGS): Likewise. + * configure.in (--enable-3c59x): Likewise. + +2000-02-17 OKUJI Yoshinori + + * configure.in (--enable-3c90x): Add -DINCLUDE_3C90X=1 instead + of -DINCLUDE_3C90x=1. This was just a typo. Reported by Per + Lundberg. + +2000-02-17 Jochen Hoenicke + + * stage2/fsys_fat.c (fat_read): Forgot to increase BUF. + (fat_dir): Use fat_read instead of grub_read; this makes + setting the FSMAX unnecessary. + (fat_mount): FSMAX is no longer set. + +2000-02-16 Jochen Hoenicke + + * stage2/char_io.c (grub_isspace): Make carriage return a white + space. + + * stage2/fsys_fat.c (fat_dir): Long filename support. + (NAME_BUF): New macro. + * stage2/fat.h (FAT_LONGDIR_ID, FAT_LONGDIR_ALIASCHECKSUM, + FAT_ATTRIB_LONGNAME): New Macros. + + * stage2/fsys_fat.c (fat_create_blocklist): Deleted, instead + fat_read is implemented. + (fat_read): new function. + * stage2/disk_io.c (fsys_table): Use fat_read. + * stage2/filesys.h: Declare fat_read, remove NO_BLOCK_FILES + hack. + * stage2/Makefile.am: Compile fat_stage1_5 with + -DNO_BLOCK_FILES=1. + + * stage2/fat.h (fat_bpb): New structure describing bpb. + (FAT_CVT_U16): New macro. + (FAT_BPB_CHECK_SIG, FAT_BPB_NUM_SECTORS, + FAT_BPB_BYTES_PER_SECTOR, FAT_BPB_SECT_PER_CLUS, FAT_BPB_NUMFAT, + FAT_BPB_RESERVED_SECTORS, FAT_BPB_FAT_SECTORS_16, + FAT_BPB_FAT_SECTORS_32, FAT_BPB_IS_FAT32, FAT_BPB_FAT_SECTORS, + FAT_BPB_FAT_START, FAT_BPB_ROOT_DIR_CLUSTER, + FAT_BPB_HIDDEN_SECTORS, FAT_BPB_ROOT_DIR_START, + FAT_BPB_ROOT_DIR_LENGTH, FAT_BPB_DATA_OFFSET, + FAT_BPB_NUM_CLUST): Macros removed. + * stage2/fsys_fat.c (fat_superblock): New structure containing + all info about currently mounted filesystem. + (FAT_SUPER): New Macro. + (BPB): Macro removod. + (fat_mount): Use fat_bpb structure, fill FAT_SUPER. + (fat_read, fat_dir): Use FAT_SUPER info. + +2000-02-16 OKUJI Yoshinori + + Pass the boot partition information to a chain-loader, in the + partition table area of the loader, instead of right before the + loaded address. Reported by takehiro@coral.ocn.ne.jp (Takehiro + Suzuki). + + * stage2/builtins.c (chainloader_func): Embed the partition + table of the boot drive in the partition table area of the + chain-loader, if the boot drive is a hard disk drive. + Pass BOOT_PART_ADDR instead of (BOOTSEC_LOCATION - 16) as the + third argument for the function chain_stage1. + * stage2/disk_io.c [!STAGE1_5] (boot_part_addr): New variable. + [!STAGE1_5] (boot_part_offset): Likewise. + [!STAGE1_5] (cur_part_offset): Likewise. + [!STAGE1_5] (cur_part_addr): Likewise. + [!STAGE1_5] (cur_part_desc): Removed. + (real_open_partition) [!STAGE1_5]: Set CUR_PART_OFFSET and + CUR_PART_ADDR to PART_OFFSET and (BOOTSEC_LOCATION + + PC_SLICE_OFFSET + (i << 4)), respectively. + [!STAGE1_5] (set_bootdev): Set BOOT_PART_OFFSET and + BOOT_PART_ADDR to CUR_PART_OFFSET and CUR_PART_ADDR, + respectively. + * stage2/shared.h (boot_part_addr): Declared. + (boot_part_offset): Likewise. + +2000-02-12 OKUJI Yoshinori + + * stage2/builtins.c (geometry_func): Attempt to read the first + sector to examine if LBA mode is really supported. + + * netboot/fsys_tftp.c (buf_fill) [TFTP_DEBUG]: Added some debug + messages. + (send_rrq) [TFTP_DEBUG]: Likewise. + (tftp_read) [TFTP_DEBUG]: Likewise. + (tftp_dir) [TFTP_DEBUG]: Likewise. + (tftp_close) [TFTP_DEBUG]: Likewise. + (tftp_read): Call buf_fill with the argument 1 first, if FILEPOS + has been moved backwards, and use grub_memmove for copying + SAVED_TP to TP instead of a direct assignment. + If send_rrq fails, set ERRNUM to ERR_WRITE instead of ERR_READ. + Check if BUF_READ is zero instead of if BUF_EOF is non-zero at + the end of the loop. + (tftp_dir): Set ERRNUM to ERR_WRITE instead of ERR_READ, if + send_rrq fails. + Save TP and LEN in SAVED_TP and SAVED_LEN respectively before + buf_fill instead of after it, because it destroys the contents + of TP. + * netboot/main.c (print_network_configuration): The order of the + arguments for grub_sprintf in the local function sprint_ip_addr + is reversed. + + * configure.in (--enable-packet_retransmission): Renamed to ... + (--disable-packet-retransmission): ... this. Assume that a + network is congested by default. + +2000-02-11 OKUJI Yoshinori + + From Pavel Roskin: + * stage2/shared.h [!GRUB_SHARED_HEADER] (GRUB_SHARED_HEADER): + Defined. + [GRUB_SHARED_HEADER]: Don't declare or define anything. + + * netboot/main.c (print_network_configuration): New function. + (await_reply): Check for Control-C instead of ESC, because GRUB + already uses ESC for another purpose. + (rfc951_sleep): Check for the key input in the loop. If + Control-C is pushed, return immediately. + * netboot/etherboot (print_network_configuration): Declared. + (CTRL_C): New macro. + (ESC): Undefined. + * netboot/config.c (eth_probe): Clear ARPTABLE after clearing + NETWORK_READY. + * stage2/builtins.c (bootp_func): Call + print_network_configuration if bootp succeeds. + (rarp_func): Call print_network_configuration if rarp succeeds. + +2000-02-11 OKUJI Yoshinori + + From Per Lundberg : + * docs/multiboot.texi: Added graphics support. + +2000-02-10 OKUJI Yoshinori + + * docs/multiboot.texi (Top): Downgrade the version to 0.6.90, + since we need more work to release it as 0.7. + +2000-02-10 OKUJI Yoshinori + + * stage2/Makefile.am [NETBOOT_SUPPORT] (STAGE2_COMPILE): Added + -I$(top_srcdir)/netboot and -DSUPPORT_NETBOOT=1. + * stage2/builtins.c (bootp_func): New function. + (dhcp_func): Likewise. + (rarp_func): Likewise. + (builtin_bootp): New variable. + (builtin_dhcp): Likewise. + (builtin_rarp): Likewise. + (builtin_table): Added pointers to BUILTIN_BOOTP, BUILTIN_DHCP + and BUILTIN_RARP. + * docs/user-ref.texi (General Commands): Added descriptions + about "bootp", "dhcp" and "rarp". + + * netboot/main.c (bootp) [!NO_DHCP_SUPPORT]: Added casts to + suppress gcc warnings. + (decode_rfc1533) [!NO_DHCP_SUPPORT]: Likewise. + * netboot/3c90x.c: Include the local "pci.h" instead of + even if __FreeBSD__ is undefined. + +2000-02-09 OKUJI Yoshinori + + From Jochen Hoenicke: + * stage2/fsys_fat.c (fat_create_blocklist): The previous change + is reversed. Set FIRST_FAT_ENTRY to a unsigned long value in + FAT_BUF + (NEW_MAPBLOCK - MAPBLOCK) instead of a unsigned short + value. Mask FIRST_FAT_ENTRY with 0xFFF if FAT_SIZE is equal to + 3, whether the bit 0 of LAST_FAT_ENTRY is set or not. + + * netboot/config.c (eth_probe): If PROBED is set to non-zero, + return 1 without probing ethernet cards. Clear NETWORK_READY. If + *T->ETH_PROBE return sucessfully, set PROBED to 1. + * netboot/main.c (rarp): Call eth_probe and return zero if + fails. Clear NETWORK_READY at first, and set NETWORK_READY to 1 + if RETRY is less than MAX_ARP_RETRIES. If IP_ABORT is non-zero, + return zero instead of one. + (bootp): Call eth_probe and return zero if fails. Clear + NETWORK_READY at first, and set NETWORK_READY to 1 if + await_reply returns successfully. + (bootp) [T509HACK]: If FLAG is non-zero, skip calling + await_reply. Don't call await_reply here any more. + (bootp) [!NO_DHCP_SUPPORT]: If any ack packet is not reached + within MAX_BOOTP_RETRIES times, return zero. If DHCP_REPLY isn't + DHCPOFFER, set NETWORK_READY to one and return one. + * netboot/etherboot.h (NO_DHCP_SUPPORT): Undefined. + + * stage2/builtins.c (print_root_device): Use the macro + NETWORK_DRIVE instead of 0x20. + * stage2/disk_io.c [!STAGE1_5] (sane_partition): Likewise. + (real_open_partition) [!STAGE1_5]: Likewise. + (set_device) [!STAGE1_5]: Likewise. + +2000-02-08 OKUJI Yoshinori + + * grub/asmstub.c (biosdisk) [__linux__]: Use _llseek when + __GLIBC_MINOR__ is less than 1 even if __GLIBC__ is 2. Reported + by Goran Koruga . + + * configure.in (--disable-lba-support-bitmap-check): New option. + Don't define CHECK_LBA_SUPPORT_BITMAP if specified. + * stage1/stage1.S (real_start): Check if AH=0x42 is supported if + CHECK_LBA_SUPPORT_BITMAP instead of NO_BUGGY_BIOS_IN_THE_WORLD + is defined. + * stage2/bios.c (get_diskinfo): Check if LBA read/write + functions are supported iff CHECK_LBA_SUPPORT_BITMAP is defined, + instead of NO_BUGGY_BIOS_IN_THE_WORLD. + +2000-02-07 OKUJI Yoshinori + + The netboot support is heavily rewritten, based on + Etherboot-4.4.2. The current one doesn't work yet, so check out + GRUB with the tag "dresden_netboot_code" if you need working + one. + + * configure.in (--enable-tftp): Deleted. + (FSYS_CFLAGS): `AC_SUBST'ed right before AC_OUTPUT. + (NETBOOT_DRIVERS): New variable. AC_SUBST this after examining + the driver options. + (--enable-packet-retransmission): New option. + (--enable-pci-direct): Likewise. + (--enable-3c509): Likewise. + (--enable-3c529): Likewise. + (--enable-3c90x): Likewise. + (--enable-cs89x0): Likewise. + (--enable-epic100): Likewise. + (--enable-3c507): Likewise. + (--enable-exos205): Likewise. + (--enable-ni5210): Likewise. + (--enable-lancepci): Likewise. + (--enable-ne2100): Likewise. + (--enable-ni6510): Likewise. + (--enable-3c503): Likewise. + (--enable-ntulip): Likewise. + (--enable-rtl8139): Likewise. + (--enable-sk-g16): Likewise. + (--enable-smc9000): Likewise. + (--enable-tiara): Likewise. + (--enable-tulip): Likewise. + (--enable-via-rhine): Likewise. + (--enable-3c503-shmem): Likewise. + (--enable-3c503-aui): Likewise. + (--enable-3c509-hack): Likewise. + (--enable-compex-rl2000-fix): Likewise. + (--enable-smc9000-scan): Likewise. + (--enable-t503): Deleted. + (--enable-lance): Likewise. + (--enable-cs): Likewise. + + * netboot/main.c: New file. Copied and modified. + * netboot/linux-asm-io.h: Likewise. + * netboot/etherboot.h: Likewise. + * netboot/misc.c: Likewise. + * netboot/via-rhine.c: Likewise. + * netboot/3c90x.c: Likewise. + * netboot/3c90x.txt: Likewise. + * netboot/epic100.c: Likewise. + * netboot/epic100.h: Likewise. + * netboot/i82586.c: Likewise. + * netboot/linux-asm-string.h: Likewise. + * netboot/ntulip.c: Likewise. + * netboot/ntulip.txt: Likewise. + * netboot/osdep.h: Likewise. + * netboot/rtl8139.c: Likewise. + * netboot/sk_g16.c: Likewise. + * netboot/sk_g16.h: Likewise. + * netboot/smc9000.c: Likewise. + * netboot/smc9000.h: Likewise. + * netboot/tiara.c: Likewise. + * netboot/tulip.c: Likewise. + * netboot/tulip.h: Likewise. + * netboot/README.netboot: New file. Most information is stolen + from Makefile and Config.32 in Etherboot. + * netboot/3c509.c: Copied from Etherboot. The original is + removed. + * netboot/3c509.h: Likewise. + * netboot/cs89x0.c: Likewise. + * netboot/eepro100.c: Likewise. + * netboot/lance.c: Likewise. + * netboot/ns8390.c: Likewise. + * netboot/ns8390.h: Likewise. + * netboot/pci.c: Likewise. + + * netboot/3c59x.c: Include etherboot.h instead netboot.h. + * netboot/config.c: Copied from Etherboot and added the 3c59x + entries. + * netboot/pci.h: Likewise. + * netboot/fsys_tftp.c: Entirely rewritten based on main.c in + Etherboot. + + * netboot/io.h: Removed. + * netboot/ip.h: Likewise. + * netboot/ip.c: Likewise. + * netboot/netboot.h: Likewise. + + * netboot/Makefile.am (INCLUDES): Added -I$(top_srcdir)/stage2. + (DRIVERS): Removed. + (libdrivers_a_SOURCES): Added etherboot.h, linux-asm-io.h, + linux-asm-string.h, main.c, misc.c and osdep.h. Deleted io.h, + ip.h, ip.c, netboot.h and $(DRIVERS). + (EXTRA_libdrivers_a_SOURCES): New variable. + (libdrivers_a_LIBADD): Set to @NETBOOT_DRIVERS@. + (libdrivers_a_DEPENDENCIES): New variable. + (EXTRA_DIST): Likewise. + (3c509_drivers): New variable. Define a new rule for the value. + (3c59x_drivers): Likewise. + (3c90x_drivers): Likewise. + (cs89x0_drivers): Likewise. + (eepro100_drivers): Likewise. + (epic100_drivers): Likewise. + (i82586_drivers): Likewise. + (lance_drivers): Likewise. + (ns8390_drivers): Likewise. + (ntulip_drivers): Likewise. + (rtl8139_drivers): Likewise. + (sk_g16_drivers): Likewise. + (smc9000_drivers): Likewise. + (tiara_drivers): Likewise. + (tulip_drivers): Likewise. + (via_rhine_drivers): Likewise. + (t503_o_CFLAGS): Removed. + (nepci_o_CFLAGS): Set to -DINCLUDE_NEPCI=1. + (ne_o_CFLAGS): Set to -DINCLUDE_NE=1. + (wd_o_CFLAGS): Set to -DINCLUDE_WD=1. + (3c509_o_CFLAGS): Likewise. + (3c529_o_CFLAGS): Likewise. + (3c59x_o_CFLAGS): Likewise. + (3c90x_o_CFLAGS): Likewise. + (cs89x0_o_CFLAGS): Likewise. + (eepro100_o_CFLAGS): Likewise. + (epic100_o_CFLAGS): Likewise. + (3c507_o_CFLAGS): Likewise. + (exos205_o_CFLAGS): Likewise. + (ni5210_o_CFLAGS): Likewise. + (lancepci_o_CFLAGS): Likewise. + (ne2100_o_CFLAGS): Likewise. + (ni6510_o_CFLAGS): Likewise. + (3c503_o_CFLAGS): Likewise. + (ntulip_o_CFLAGS): Likewise. + (rtl8139_o_CFLAGS): Likewise. + (sk_g16_o_CFLAGS): Likewise. + (smc9000_o_CFLAGS): Likewise. + (tiara_o_CFLAGS): Likewise. + (tulip_o_CFLAGS): Likewise. + (via_rhine_o_CFLAGS): Likewise. + + * stage2/char_io.c (nul_terminate): Changed the type of the + return value to int. Return the original character changed to + NUL. + * stage2/shared.h (NETWORK_DRIVE): New macro. + (nul_terminate): Adjusted to the definition. + * stage2/gunzip.c (gunzip_test_header): Removed the TFTP check + entirely. It is no longer necessary because we now can obtain + the correct size of a file even for TFTP. + +2000-02-07 OKUJI Yoshinori + + * stage2/asm.S: Undo the previous changes. Is + binutils-2.9.5.0.25 too strict to retain the compatibility? + Reported by Kalle Olavi Niemitalo . + +2000-02-03 OKUJI Yoshinori + + * stage2/cmdline.c (enter_cmdline): Set BUF_DRIVE to -1 before + running a command to invalidate the cache. + (run_script): Likewise. + * stage2/char_io.c (get_cmdline): Set BUF_DRIVE to -1 before the + completion to invalidate the cache. + Reported by Jeff Sheinberg . + + * configure.in: Use AC_PATH_TOOL instead of AC_PATH_PROG. + * stage2/asm.S (chain_stage1): Prepend `*' to the argument for + ljmp. + (chain_stage2): Likewise. + (big_linux_boot): Likewise. + +2000-01-19 OKUJI Yoshinori + + * util/grub-install.in (--root): Renamed to ... + (--root-directory): ... this, since "root" is vague. + * docs/user-ref.texi (Invoking grub-install): Adjusted to the + change above, and added an example how to use --root-directory. + * docs/grub-install.8: Regenerated. + + * docs/appendices.texi (FAQ): Added an item about the sucked + SCSI problem. + +2000-01-15 OKUJI Yoshinori + + * stage2/builtins.c (chainloader_func): If --force is specified + in ARG, don't check for the signature. + * docs/tutorial.texi (Chain-loading): Added a caution about some + defective boot loaders and --force. + * docs/user-ref.texi (Command-line-specific commands): Added a + description about --force. + +2000-01-11 OKUJI Yoshinori + + * docs/prog-ref.texi (LBA mode disk I/O): Added a footnote about + a buggy BIOS. + +2000-01-11 OKUJI Yoshinori + + * stage1/stage1.S [!NO_BUGGY_BIOS_IN_THE_WORLD]: Don't check if + LBA read is supported. Anyway, fallback to the CHS mode if + fails. + +2000-01-10 OKUJI Yoshinori + + * stage2/bios.c (NO_INT13_FALLBACK): Undefined. + (get_diskinfo) [!NO_BUGGY_BIOS_IN_THE_WORLD]: Do not check if + bit 0 in DRP.FLAGS is set, because at least one BIOS does not + set it correctly. Reported by "Forever shall I be." + . + + * util/grub-install.in: Handle the new options `--root' and + `--grub-shell'. + (rootdir): New variable. + (usage): Print the help messages about the options --root and + --grub-shell. + (bootdir): Initialized after the option analysis. + (grubdir): Likewise. + (device_map): Likewise. + (root_device): Set to the result for the directory ROOTDIR + instead of "/". + * docs/user-ref.texi (Invoking grub-install): Added the + descriptions about --root and --grub-shell. + * docs/grub-install.8: Regenerated. + +2000-01-08 OKUJI Yoshinori + + * util/grub-install.in (grubdir_device): New variable. + If GRUBDIR_DEVICE is not equal to ROOT_DEVICE, print an error + message and exit. + * README: Added a caution about Automake. + * TODO: Updated. Only the things that should be done until 0.6 + have one or more exclamations. Things with zero exclamation + will be done after 0.6 unless someone sends a patch for it. + +2000-01-05 OKUJI Yoshinori + + * grub/asmstub.c: Include the header shared.h after including + all the system headers, but not before. + (EXTENDED_MEMSIZE): Reduced to 3MB. + (grub_setjmp): New function. + (grub_longjmp): Likewise. + * grub/main.c: Include setjmp.h. + * stage2/asm.S (grub_setjmp): New function. Stolen from the + OSKit (which stole it from Mach). + (grub_longjmp): Likewise. + * stage2/shared.h [GRUB_UTIL] (grub_jmp_buf): New type. + [!GRUB_UTIL] (grub_jmp_buf): New macro. Defined as jmp_buf. + (grub_setjmp): Declared. + (grub_longjmp): Likewise. + (restart_env): Likewise. + * stage2/builtins.c (configfile_func): Use grub_longjmp instead + of invoking cmain again. + * stage2/stage2.c (restart_env): New variable. + (cmain): Call grub_setjmp first to initialize RESTART_ENV. + +2000-01-03 OKUJI Yoshinori + + * docs/multiboot.texi (Boot information format): Added the + descriptions about the fields "config_table" and + "boot_loader_name". + +1999-12-31 OKUJI Yoshinori + + * stage2/builtins.c (setup_func) [!NO_BUGGY_BIOS_IN_THE_WORLD]: + Specify the option `d', whether INSTALL_DRIVE is identical with + IMAGE_DRIVE or not. + * docs/user-ref.texi (Command-line-specific commands): Added a + caution about buggy BIOSes which don't pass a booting drive + properly. + + * docs/src2texi: Added an extra space into the first line, for + the portability issue. + + * docs/appendices.texi (Obtaining and Building GRUB): Update the + information on the ftp site and the CVS repository. + +1999-12-30 OKUJI Yoshinori + + * stage2/builtins.c (blocklist_func): New function. + (builtin_blocklist): New variable. + (builtin_table): Added a pointer to BUILTIN_BLOCKLIST. + * docs/user-ref.texi (Command-line-specific commands): Added a + description about the command "blocklist". + +1999-12-30 OKUJI Yoshinori + + * stage2/disk_io.c (grub_seek): New function. + * stage2/shared.h (grub_seek): Declared. + * stage2/boot.c (load_image): Use grub_seek instead of setting + FILEPOS to a new value directly. + * stage2/builtins.c (install_func): Likewise. + (testload_func): Likewise. + + * docs/grub.texi: Use a single direntry command for all the + entries instead of one per entry. + +1999-12-29 OKUJI Yoshinori + + * grub/asmstub.c (check_device) [__linux__]: Check if DEVICE is + a CD-ROM drive by the HDIO_GETGEO ioctl. If so, then return + zero. Reported by Pavel Roskin. + + * stage2/Makefile.am (nodist_noinst_DATA): Renamed to ... + (noinst_DATA): ... this. The primary DATA is `nodist' by + default, at least theoretically. Reported by Klaus Reichl. + + * stage2/bios.c (get_diskinfo): Set the LBA flag in GEOMETRY + only if bit 0 in DRP.FLAGS is set. Reported by Zack Weinberg + . + + From Pavel Roskin: + * grub/asmstub.c (init_device_map): Increase the number of + devices to be probed to 8 for IDE disks and 16 for SCSI + disks. Reported by Anton Anisimov . + +1999-12-06 Gordon Matzigkeit + + * README (DEVELOPERS): Change CVS location to subversions. + +1999-11-30 OKUJI Yoshinori + + * stage2/disk_io.c (real_open_partition): If SLICE_NO is greater + than or equal to PC_SLICE_MAX, skip any extended partition, when + searching for the right partition. Reported by Weil, Stefan 3732 + EPE-24 . + +1999-11-19 Gordon Matzigkeit + + * grub/asmstub.c (getkey): Stop immediately if we get an EOF. + + * stage2/stage2.c (cmain): Tell enter_cmdline to run forever. + (run_menu): Tell print_cmdline_message and enter_cmdline that we + won't run forever. + * stage2/cmdline.c (enter_cmdline): New argument, FOREVER, for + when ESC shouldn't allow an exit. Pass it to + print_cmdline_message. + (print_cmdline_message): Use new argument, FOREVER, to decide + whether to tell the user that ESC exits. + +1999-11-18 Gordon Matzigkeit + + * debian/rules (binary-arch): Don't strip or generate shared + library dependencies for /usr/sbin/grub-install, since it's a + script. + + * util/grub-install.in: Create safe temporary log files using + /bin/tempfile if it is executable. + +1999-11-17 Gordon Matzigkeit + + * stage1/Makefile.am (LDFLAGS): Consolidate multiple -Wl flags. + * stage2/Makefile.am (PRE_STAGE2_LINK): Likewise. + (START_LINK): Likewise. + (STAGE1_5_LINK): Likewise. + +1999-11-19 OKUJI Yoshinori + + * util/grub-install.in (debug): New variable. + (convert): If the device file does not exist, then emit an + error. Get the GRUB drive instead of the OS device. + If --debug is specified, then set $debug to yes. + If $debug is yes, run "set -x". + Make sure that stage1 and stage2 exist. + When checking for INSTALL_DEVICE, use "case" instead of "elif"s. + Make sure that $install_drive is not empty. + Likewise, make sure that $root_drive is not empty. + Any error message is redirected to the standard error. + +1999-11-19 Pavel Roskin + + * stage2/Makefile.am (noinst_DATA): Renamed to ... + (nodist_noinst_DATA): ... this. + * util/Makefile.am: sbin_SCRIPS -> sbin_SCRIPTS. + * util/grub-install.in: grub_dir -> grubdir. + Check if $grub_shell exists before running it. + (convert): Added a missing "test" after "if". + +1999-11-18 OKUJI Yoshinori + + * configure.in: Output grub-install. + * util/Makefile.am (sbin_SCRIPTS): New variable. + * util/grub-install.in: New file. + * docs/Makefile.am (man_MANS): Added grub-install.8. + [MAINTAINER_MODE] ($(srcdir)/grub-install.8): New target. + * docs/grub-install.8: New file. Generated by help2man. + * docs/user-ref.texi (Invoking grub-install): New chapter. + +1999-11-16 OKUJI Yoshinori + + From Pavel Roskin: + * stage1/stage1.S: Check for the API subset support bitmap + returned by INT 13 AH=48h, and jump to chs_mode if AH=42h is not + supported. + +1999-11-13 OKUJI Yoshinori + + * stage2/builtins.c (install_func): When using a Stage 1.5, set + CURRENT_DRIVE to SAVED_DRIVE and CURRENT_PARTITION to + SAVED_PARTITION if set_device fails. If CURRENT_DRIVE is equal + to SRC_DRIVE, then set CURRENT_DRIVE to 0xFF. We don't want to + embed any drive number whenever possible. + * stage2/disk_io.c (set_device) [STAGE1_5]: Always set + CURRENT_PARTITION to PARTITION. + +1999-11-13 OKUJI Yoshinori + + From Pavel Roskin: + * stage1/stage1.S (lba_mode): Jump to chs_mode if INT 13 AH=42h + fails. + +1999-11-12 OKUJI Yoshinori + + Do not use the device map file unless --device-map is specified. + + * grub/main.c (device_map_file): Set to 0. + (default_device_map_file): Removed. + (usage): Do not print DEFAULT_DEVICE_MAP_FILE. + * grub/asmstub.c (init_device_map): If DEVICE_MAP_FILE is NULL, + do not try to open the device map file. + Set FP to NULL by default. + * docs/grub.8: Regenerated. + +1999-11-11 Michael Hohmuth + + * stage2/boot.c (load_image): grub_close was called after + return, so exchange the order. + * stage2/stage1_5.c (cmain): Call grub_close after grub_read. + Set RET to the value returned by grub_read, and if RET is + non-zero, call chain_stage2. + * stage1/Makefile.am (BUILT_SOURCES): Removed. + (CLEANFILES): Set to $(nodist_pkgdata_DATA). + +1999-11-11 OKUJI Yoshinori + + Suggested by Klaus Reichl: + * stage2/builtins.c (print_root_device): New function. + (root_func): If no argument is specified, call the function + print_root_device and return. + (rootnoverify_func): Likewise. + * stage2/disk_io.c [!STAGE1_5] (print_completions): Call + print_error even if IS_FILENAME is zero. + If ERRNUM is non-zero, then return -1. + * stage2/char_io.c [!STAGE1_5] (get_cmdline): Clear ERRNUM after + calling print_completions to print the list as well. + + * stage2/asm.S [!STAGE1_5] (currticks): Set %eax to %cx:%dx + correctly. Reported by Michael Hohmuth. + +1999-11-06 Klaus Reichl + + * grub/asmstub.c (get_diskinfo) [__linux__]: After opening the + drive, flush the cache, other progs may have left over something + in the cache. + +1999-11-03 Gordon Matzigkeit + + * debian/rules: Add variables for cross-compilation. + + * debian/control (Standards-Version): Update to version 3.1.0. + * debian/rules (build): Install manpages into /usr/share/man, and + info into /usr/share/info in accordance with FHS. + (binary-arch): Likewise, and put docs into /usr/share/doc. + * debian/postinst: Use /usr/share/info, and manage compatibility + /usr/doc/grub -> /usr/share/doc/grub symlink. + * debian/prerm: Likewise. + + * stage2/Makefile.am (CLEANFILES): Change to + $(nodist_pkgdata_DATA) so that the raw binary files are deleted. + * stage1/Makefile.am (CLEANFILES): Likewise. + +1999-11-06 OKUJI Yoshinori + + * grub/asmstub.c (grub_putchar) [HAVE_LIBCURSES]: Do not call + wrefresh. This was just an accident. Sorry. + + Reported by Alan McLean : + * stage2/builtins.c (embed_func): The sector argument for the + function biosdisk is changed from SECTOR + I * SECTOR_SIZE to + SECTOR + I. + (find_func): Clear ERRNUM before each of the attempts. + +1999-11-05 OKUJI Yoshinori + + * docs/multiboot.texi (Boot information format): Add the members + `drives_addr' and `drives_count' into the Multiboot information + structure, and added the descriptions. + +1999-11-03 Gordon Matzigkeit + + * util/mbchk.c (main): Move the version number inside the + parentheses since it is the GRUB package version, not just an + mbchk-specific version. + +1999-10-30 Gordon Matzigkeit + + * debian/rules (binary-arch): Compress man pages. + Strip the grub shell. + Install examples. + +1999-11-03 OKUJI Yoshinori + + * docs/tutorial.texi: Fix typos by ispell. + * docs/user-ref.texi: Likewise. + * docs/prog-ref.texi: Likewise. + * docs/appendices.texi: Likewise. + +1999-11-03 OKUJI Yoshinori + + * stage2/fsys_ext2fs.c (struct ext2_dir_entry): Changed the type + of `name_len' to __u8 and added the new member `file_type' after + it. This is stolen from linux/ext2_fs.h in Linux 2.2.13. + Reported by Ben Harris . + + * stage2/builtins.c (device_func) [GRUB_UTIL]: Call + nul_terminate before calling check_device. + +1999-11-02 OKUJI Yoshinori + + * stage2/disk_io.c (real_open_partition): Check for the right + partition for any extended partition as well. Set EXT to I after + the check is done. Reported by Jeff Scheinberg + . + + * stage2/builtins.c (color_func): Use the function + nul_terminate. + (device_func) [GRUB_UTIL]: Likewise. + (help_func): Likewise. + (install_func): Save CURRENT_DRIVE, CURRENT_PARTITION and + BUG_GEOM in SRC_DRIVE, SRC_PARTITION and SRC_GEOM respectively, + and use them when patching the Stage 2. + NUL-terminate the configuration filename CONFIG_FILENAME. + If IS_STAGE1_5 is true, then check if the "real config file" + option is present, and, if so, patch the Stage 2 CONFIG_FILENAME + with the configuration filename REAL_CONFIG_FILENAME. + (setkey_func): Use nul_terminate instead of the local function + null_terminate. + * stage2/char_io.c [!STAGE1_5] (nul_terminate): New function. + * stage2/shared.h (nul_terminate): Declared. + +1999-11-01 OKUJI Yoshinori + + * docs/grub.texi: Add "I/O ports detection" into the menu. + * docs/user-ref.texi: Added a description about the command + "ioprobe". + * docs/prog-ref.texi (I/O ports detection): New chapter. + +1999-11-01 OKUJI Yoshinori + + From Pavel Roskin: + * stage2/asm.S (int1_handler): Use EXT_C(io_map) instead of + io_map. + (int1_handler): Use EXT_C(bios_key_map) instead of bios_key_map. + * grub/asmstub.c [__OpenBSD__]: Include and + . + [__OpenBSD__] (get_floppy_disk_name): Added support for OpenBSD. + [__OpenBSD__] (get_ide_disk_name): Likewise. + [__OpenBSD__] (get_scsi_disk_name): Likewise. + (get_drive_geometry) [__OpenBSD__]: Use for OpenBSD the same + ioctl as for NetBSD and FreeBSD. + +1999-10-31 OKUJI Yoshinori + + * grub/asmstub.c (init_device_map): Add a floppy device name + into the device map file even if check_device fails. + * stage2/char_io.c [!STAGE1_5] (get_cmdline): Clear ERRNUM after + calling print_completions. + +1999-10-29 OKUJI Yoshinori + + * stage2/asm.S (track_int13): Defined unconditionally. Do not + use int3 any more, but replace the int13 handler with + set_tf_int13_handler. + (int1_handler): Defined unconditionally. Do not check for 0x0F. + Add missing `$'s. If the code is 0xEC-0xEF, use %dx instead of + immediate. If the code is 0xE4-0xE7, use immediate instead of + %dx. Set %ds to zero before scanning IO_MAP. Check for the + buffer overrun of IO_MAP before adding a port. + [!DEFINE_TRACK_INT13] (int13_first_instruction): Removed. + [!DEFINE_TRACK_INT13] (int3_handler): Likewise. + (set_tf_int13_handler): New interrupt handler. + (set_tf_int13_offset): New variable. + (set_tf_int13_segment): Likewise. + * stage2/builtins.c (ioprobe_func): New function. + (builtin_ioprobe): New variable. + (builtin_table): Added a pointer to BUILTIN_IOPROBE. + * stage2/shared.h (IO_MAP_SIZE): New macro. + (track_int13): Declared. + (io_map): Likewise. + +1999-10-29 OKUJI Yoshinori + + * stage2/char_io.c (print_error) [!STAGE1_5]: Print "Error:" + before print the error message. + (print_error): Do not clear ERRNUM. + * stage2/cmdline.c (run_script): If ERRNUM is non-zero, set + ERRNUM to ERR_NONE. + (enter_cmdline): Clear ERRNUM after print_error. + +1999-10-28 OKUJI Yoshinori + + From Pavel Roskin: + * stage2/stage2.c (run_menu) [GRUB_UTIL]: Do not use IBM special + characters in the message, but use ascii names instead. + (run_menu) [!GRUB_UTIL]: Use DISP_UP and DISP_DOWN instead of + the ascii codes. + * stage2/shared.h [!ACS_ULCORNER] (ACS_ULCORNER): New macro. + [!ACS_ULCORNER] (ACS_URCORNER): Likewise. + [!ACS_ULCORNER] (ACS_LLCORNER): Likewise. + [!ACS_ULCORNER] (ACS_LRCORNER): Likewise. + [!ACS_ULCORNER] (ACS_HLINE): Likewise. + [!ACS_ULCORNER] (ACS_VLINE): Likewise. + [!ACS_ULCORNER] (ACS_LARROW): Likewise. + [!ACS_ULCORNER] (ACS_RARROW): Likewise. + [!ACS_ULCORNER] (ACS_UARROW): Likewise. + [!ACS_ULCORNER] (ACS_DARROW): Likewise. + [GRUB_UTIL] (DISP_UL): Set to ACS_ULCORNER. + [GRUB_UTIL] (DISP_UR): Set to ACS_URCORNER. + [GRUB_UTIL] (DISP_LL): Set to ACS_LLCORNER. + [GRUB_UTIL] (DISP_LR): Set to ACS_LRCORNER. + [GRUB_UTIL] (DISP_HORIZ): Set to ACS_HLINE. + [GRUB_UTIL] (DISP_VERT): Set to ACS_VLINE. + [GRUB_UTIL] (DISP_LEFT): Set to ACS_LARROW. + [GRUB_UTIL] (DISP_RIGHT): Set to ACS_RARROW. + [GRUB_UTIL] (DISP_UP): Set to ACS_UARROW. + [GRUB_UTIL] (DISP_DOWN): Set to ACS_DARROW. + +1999-10-28 OKUJI Yoshinori + + * stage2/builtins.c (keycode_func): Removed. + (builtin_keycode): Likewise. + (struct keysym): New structure. + (keysym_table): New variable. + (setkey_func): New function. + (builtin_setkey): New variable. + (builtin_table): Removed the pointer to BUILTIN_KEYCODE, and + added a pointer to BUILTIN_SETKEY. + * stage2/common.c [!STAGE1_5] (err_list): Added + ERR_BAD_ARGUMENT. + * stage2/shared.h (grub_error_t): Added ERR_BAD_ARGUMENT. + (KEY_MAP_SIZE): Set to 128. + (ascii_key_map): Declared. + * stage2/asm.S [!STAGE1_5] (remap_ascii_char): New function. + [!STAGE1_5] (ascii_key_map): New variable. + [!STAGE1_5] (getkey): Call remap_ascii_char after int16. + [!STAGE1_5] (checkkey): Likewise. + * grub/asmstub.c (ascii_key_map): New variable. + * docs/user-ref.texi (General commands): Added a description + about the command "setkey". + (Stage2 errors): Added a description about ERR_BAD_ARGUMENT. + +1999-10-27 OKUJI Yoshinori + + * stage2/disk_io.c (set_device) [!STAGE1_5]: Remove the + preliminary Mach-style device name support. I've decided that + the support is not necessary. + (setup_part) [!STAGE1_5]: Do not strip the leading "/dev/". + * docs/help2man: Upgraded to 1.016. + * docs/mbchk.1: Regenerated. + * docs/grub.8: Likewise. + * grub/asmstub.c: Rename KEY_MAP to BIOS_KEY_MAP. + + * stage2/asm.S [!STAGE1_5] (set_int15_handler): Use 0 instead of + the maximum number for the segment. + [!STAGE1_5] (unset_int15_handler): Likewise. + [!STAGE1_5] (int15_handler): Almost rewritten. If non-carrier, + ignore the scancode. If the scancode is E1 or E0, then set + INT15_SKIP_FLAG to 0x74, and if the previous scancode is E1 or + E0, set INT15_SKIP_FLAG to 0xea. Clear bit 7 in %dl. Save bit 7 + of %al in %bl. Do not lcall. Use ljmp instead. + [!STAGE1_5] (key_map): Renamed to ... + [!STAGE1_5] (bios_key_map): ... this. + * stage2/builtins.c (keycode_func): Check if FROM is greater + than 0xff instead of double-checking for TO. Use BIOS_KEY_MAP + instead of KEY_MAP. + * stage2/shared.h (KEY_MAP_SIZE): Set to 32. + (key_map): Removed. + (bios_key_map): Declared. + +1999-10-26 OKUJI Yoshinori + + Now the BIOS drive remapping is functional. + + * stage2/asm.S [DEFINE_TRACK_INT13] (track_int13): Use %edi + instead of direct addresses. + Prefix DATA32 to the calls for real_to_prot and prot_to_real. + Fix the address of DRIVE: 4(%ebp) -> 8(%ebp). + (set_int15_handler): Use %edi instead of direct addresses. + (unset_int15_handler): Likewise. + (set_int13_handler): Copy DRIVE_MAP_SIZE * 2 bytes instead of + DRIVE_MAP_SIZE bytes of MAP. + Fix the address of MAP: 4(%ebp) -> 8(%ebp). + Use %edi instead of direct addresses. + (int13_handler): Do not set %ds to %cs. Use the segment override + prefix of %cs instead. + Push the flags pushed by the callee instead of the current. + Set the flags in the stack to the flags returned by the original + int13 call. + (drive_map): 4bytes-aligned. + * stage2/disk_io.c (grub_close): Do not set ERRNUM even if + FSYS_TYPE is NUM_FSYS. + +1999-10-25 OKUJI Yoshinori + + * stage1/stage1.S: Long jump to real_start, because some bogus + BIOSes jump to 07C0:0000 instead of 0000:7C00. + (real_start): New label. + * docs/Makefile.am (grub.info): Removed. Use the default rule + instead. + +1999-10-25 OKUJI Yoshinori + + * stage2/asm.S [DEFINE_TRACK_INT13] (int3_handler): Save the + modified FLAGS in 6(%bp) instead of 4(%bp). + Decrease %bx before restoring the first instruction. + [DEFINE_TRACK_INT13] (track_int13): Go to the real mode before + setting up the registers for the int13 call. + +1999-10-24 OKUJI Yoshinori + + Add the prototype of a function to probe I/O ports used for a + BIOS drive. + + * stage2/asm.S [DEFINE_TRACK_INT13] (track_int13): New function. + [DEFINE_TRACK_INT13] (int1_handler): New interrupt handler for + the real mode. + [DEFINE_TRACK_INT13] (int3_handler): Likewise. + [DEFINE_TRACK_INT13] (io_map): New variable. + + * stage2/builtins.c (quit_func) [!GRUB_UTIL]: Fix a typo. + +1999-10-24 OKUJI Yoshinori + + The new GRUB manual becomes official. + + * docs/grub.texi: Replaced with new-grub.texi. + * docs/new-grub.texi: Removed. + * docs/Makefile.am (grub_TEXINFOS): New variable. + (UNFINISHED_MANUALS): Removed. + (EXTRA_DIST): Deleted $(UNFINISHED_MANUALS). + +1999-10-24 OKUJI Yoshinori + + * stage2/builtins.c (device_func) [!GRUB_UTIL]: Set ERRNUM to + ERR_UNRECOGINIZED and return 1. + (impsprobe_func) [GRUB_UTIL]: Likewise. + (quit_func) [!GRUB_UTIL]: Likewise. + * docs/tutorial.texi: Rename "Device Syntax" to "Filename". + Added many cross-references. + * docs/new-grub.texi: "Device Syntax" -> "Filename". + * docs/user-ref.texi: Fix typos and added some cross-references. + * docs/prog-ref.texi: Likewise. + * docs/appendices.texi: Likewise. + +1999-10-23 OKUJI Yoshinori + + * stage2/builtins.c (map_func): If BIOS_DRIVE_MAP already + contains FROM, override the existsing entry. + If TO is equal to FROM, delete the existing entry if any. + (keycode_func): Likewise. + * docs/user-ref.texi (Command): Use the list of `@deffn's + instead of @table. + (Basic usage): Use @option instead of @code. + (Invoking mbchk): Likewise. + +1999-10-23 OKUJI Yoshinori + + * stage2/asm.S [!STAGE1_5] (set_int15_handler): New function. + [!STAGE1_5] (unset_int15_handler): Likewise. + [!STAGE1_5] (int15_handler): New interrupt handler for the real + mode. + [!STAGE1_5] (int15_offset): New variable. + [!STAGE1_5] (int15_segment): Likewise. + [!STAGE1_5] (key_map): Likewise. + [!STAGE1_5] (set_int13_handler): Use the macro ABS for + INT13_OFFSET and INT13_SEGMENT. + * stage2/shared.h (KEY_MAP_SIZE): New macro. + (set_int15_handler): Declared. + (unset_int15_handler): Likewise. + * stage2/builtins.c (boot_func): Do not allow I to be equal to + DRIVE_MAP_SIZE. + Call unset_int15_handler unless KERNEL_TYPE is KERNEL_TYPE_NONE. + (map_func): Search for an empty slot till I is less than + DRIVE_MAP_SIZE. + Check if I is equal to DRIVE_MAP_SIZE instead of if I is greater + than DRIVE_MAP_SIZE. + (keycode_func): New function. + (builtin_keycode): New variable. + (builtin_table): Added a pointer to BUILTIN_KEYCODE. + * grub/asmstub.c (set_int15_handler): New function. + (unset_int15_handler): Likewise. + (key_map): New variable. + +1999-10-23 OKUJI Yoshinori + + From Michael Hohmuth : + * acconfig.h (HAVE_USCORE_USCORE_BSS_START_SYMBOL): Added the + `undef' entry. + (HAVE_EDATA_SYMBOL): Likewise. + (HAVE_USCORE_EDATA_SYMBOL): Likewise. + * acinclude.m4 (grub_CHECK_USCORE_USCORE_BSS_START_SYMBOL): New + function. + (grub_CHECK_EDATA_SYMBOL): Likewise. + (grub_CHECK_USCORE_EDATA_SYMBOL): Likewise. + * configure.in: Check for __bss, edata and _edata. + * netboot/Makefile.am (DRIVERS): Deleted ns8390.c and ns8390.h. + (libdrivers_a_LIBADD): New variable. + ($(libdrivers_a_LIBADD)): New target. + (nepci_o_CFLAGS): New variable. + (ne_o_CFLAGS): Likewise. + (wd_o_CFLAGS): Likewise. + (t503_o_CFLAGS): Likewise. + * netboot/fsys_tftp.c (tftp_close): New function. + * stage2/boot.c (load_image): Call grub_close before return. + (load_initrd): Likewise. + (load_module): Likewise. + * stage2/builtins.c (cat_func): Likewise. + (chainloader_func): Likewise. + (configfile_func): Likewise. + (embed_func): Likewise. + (find_func): Likewise. + (install_func): Set IS_OPEN to the value returned by grub_open. + If IS_OPEN is non-zero, call grub_close before return. + (setup_func): Call grub_close after grub_open. + (testload): Call grub_close before return. + * stage2/disk_io.c (fsys_table): Add the `close' member into + each of the entries. For TFTP, tftp_close is added, and for the + rest, NULL is added. + (grub_read): "|" -> "||". + (grub_close): New function. + * stage2/filesys.h [FSYS_TFTP] (tftp_close): Declared. + (struct fsys_entry): Added close_func. + * stage2/shared.h (grub_close): Declared. + * stage2/stage1_5.c (cmain): Call grub_close after grub_open. + * stage2/stage2.c (cmain): Clear ERRNUM after calling + find_command to just ignore the error code. + Call grub_close after loading the configuration file. + + * stage2/asm.S (main): Clean out the bss. + +1999-10-23 OKUJI Yoshinori + + * docs/new-grub.texi: Updated. + * docs/user-ref.texi: Likewise. + * docs/tutorial.texi: Likewise. + * docs/prog-ref.texi: Likewise. + * docs/appendices.texi: Likewise. + +1999-10-22 OKUJI Yoshinori + + * docs/prog-ref.texi: New file. + * docs/appendices.texi: Likewise. + * docs/Makefile.am (UNFINISHED_MANUALS): Added prog-ref.texi and + appendices.texi. + +1999-10-22 OKUJI Yoshinori + + * docs/user-ref.texi: New file. + * docs/Makefile.am (UNFINISHED_MANUALS): Added user-red.texi. + +1999-10-21 OKUJI Yoshinori + + Add BIOS drive remapping support for chain-loading some foolish + operating systems. + + * stage2/builtins.c (bios_drive_map): New variable. + (boot_func): If KERNEL_TYPE is KERNEL_TYPE_CHAINLOADER, check + if BIOS_DRIVE_MAP contains meaningful values. If so, search for + SAVED_DRIVE in BIOS_DRIVE_MAP and exchange SAVED_DRIVE with the + mapped drive if found. And then call set_int13_handler. + (map_func): New function. + (builtin_map): New variable. + (builtin_table): Added a pointer to BUILTIN_MAP. + * stage2/asm.S (ABS): New macro. + [!STAGE1_5] (set_int13_handler): New function. + [!STAGE1_5] (int13_handler): New interrupt handler for the real + mode. + [!STAGE1_5] (drive_map): New variable. + [!STAGE1_5] (int13_handler_end): New label used for just + computing the end address of int13_handler. + * stage2/shared.h (DRIVE_MAP_SIZE): New macro. + (set_int13_handler): Declared. + * grub/asmstub.c (set_int13_handler): New function. Do nothing. + +1999-10-20 OKUJI Yoshinori + + * stage2/builtins.c (find_func): Print only the device names. + * docs/tutorial.texi: New file. + * docs/Makefile.am (UNFINISHED_MANUALS): Added tutorial.texi. + (%.c.texi): Use $(SHELL) instead of /bin/sh. + (%.h.texi): Likewise. + (%.S.texi): Likewise. + +1999-10-20 OKUJI Yoshinori + + * stage2/char_io.c (memcheck): Fix the checks: "<=" -> "<". + Reported by Mike Hicks . + +1999-10-19 OKUJI Yoshinori + + * stage2/builtins.c (find_func): New function. + (builtin_find): New variable. + (hide_func): Save SAVED_DRIVE and SAVED_PARTITION to TMP_DRIVE + and TMP_PARTITION, respectively, and resotre them before return. + (unhide_func): Likewise. + (setup_func): Likewise. And set SAVED_DRIVE and SAVED_PARTITION + instead of CURRENT_DRIVE and CURRENT_PARTITION to IMAGE_DRIVE + and IMAGE_PARTITION before running install_func. + (builtin_table): Added a pointer to BUILTIN_FIND. + +1999-10-19 OKUJI Yoshinori + + * docs/Makefile.am (UNFINISHED_MANUALS): New variable. + (EXTRA_DIST): Added $(UNFINISHED_MANUALS). + * docs/new-grub.texi: New file. + +1999-10-19 OKUJI Yoshinori + + * docs/Makefile.am (man_MANS): Added mbchk.1. + [MAINTAINER_MODE] (mbchk.1): New target. + * docs/mbchk.1: New file. Generated by help2man. + +1999-10-18 OKUJI Yoshinori + + * Makefile.am (SUBDIRS): Added util. + * configure.in: Output util/Makefile. + * util/Makefile.am: New file. + * util/mbchk.c: Likewise. + * util/Makefile.in: Likewise. Generated by automake. + +1999-10-17 OKUJI Yoshinori + + * docs/Makefile.am (.texi): Canceled because the dependecies can + be circulated. + * stage2/builtins.c (embed_func): Set BUF_TRACK to -1 before + writing the Stage 1.5 to the disk to clear the cache. + +1999-10-17 OKUJI Yoshinori + + * stage2/boot.c (load_initrd): Change types of *RAMDISK and + MOVETO to unsigned long. + Apply the macro RAW_ADDR to MOVETO. + +1999-10-16 OKUJI Yoshinori + + * docs/multiboot.texi: Include the example source files of a + Multiboot kernel. + * docs/src2texi: New file. + * docs/boot.S: Likewise. + * docs/multiboot.h: Likewise. + * docs/kernel.c: Likewise. + * docs/boot.S.texi: Likewise. + * docs/multiboot.h.texi: Likewise. + * docs/kernel.c.texi: Likewise. + * docs/Makefile.am (EXAMPLES): New varilable. + (multiboot_TEXINFOS): Likewise. + (SRC2TEXI): Likewise. + (noinst_SCRIPTS): Added $(SRC2TEXI). + (EXTRA_DIST): Added $(EXAMPLES) and $(multiboot_TEXINFOS). + (%.c.texi): New target. + (%.h.texi): Likewise. + (%.S.texi): Likewise. + +1999-09-22 OKUJI Yoshinori + + * multiboot.texi (BIOS device mapping techniques): New section. + Stolen from bios_mapping.txt in grub-0.5. + (Data comparison technique): New subsection. + (I/O restriction technique): Likewise. + (Example OS code): Rewrited from scratch. + +1999-09-21 OKUJI Yoshinori + + * multiboot.texi: Rename Multiboot Standard to Multiboot + Specification and upgrade the version to 0.7. Many cleanups + are done. + +1999-10-15 OKUJI Yoshinori + + * stage2/builtins.c (setup_func): Save CURRENT_DRIVE and + CURRENT_PARTITION into IMAGE_DRIVE and IMAGE_PARTITION + respectively, and restore them before running install_func. + Use DEVICE instead of BUFFER to store the device name. + Change each type of STAGE1, STAGE2 and CONFIG_FILE to an array + of char. + If installing the Stage 1 into a MBR, embed the Stage 1.5 in the + sectors right after it. + Return the result of install_func instead of zero. + +1999-10-14 Pavel Roskin + + * configure.in: Check for opendisk in libutil. + * grub/asmstub.c [__FreeBSD__ || __NetBSD__]: Include + . + [HAVE_OPENDISK]: Include . + [__NetBSD__] (get_floppy_disk_name): Added support for NetBSD. + [__NetBSD__ && HAVE_OPENDISK] (get_ide_disk_name): Likewise. + [__NetBSD__ && HAVE_OPENDISK] (get_scsi_disk_name): Likewise. + (get_drive_geometry) [__NetBSD__]: Use for NetBSD the same ioctl + as for FreeBSD. + +1999-10-13 OKUJI Yoshinori + + * grub/asmstub.c (assign_device_name): If DEVICE is NULL, set + DEVICE_MAP[DRIVE] to NULL. + (get_diskinfo): If open or read fails, call assign_device_name + to disable accessing the drive DRIVE. + (grub_stage2): The device mapping routine is moved to ... + (init_device_map): ... here. This new function also reads/writes + a device map file. If DEVICE_MAP_FILE already exists, then use + the data in it instead of probing devices. Otherwise, guess the + map between BIOS drives and OS devices, and write it to the file + DEVICE_MAP_FILE if it can be opened. + * grub/main.c (device_map_file): New variable. + (default_device_map_file): Likewise. + (OPT_DEVICE_MAP): New macro. + (longopts): Added an entry for "device-map". + (usage): Print the usage about --device-map as well. + (main): Set DEFAULT_DEVICE_MAP_FILE to DEVICE_MAP_FILE. If + OPT_DEVICE_MAP is found, set DEVICE_MAP_FILE to a duplicated + string of OPTARG. + * stage2/shared.h [GRUB_UTIL] (device_map_file): Declared. + * docs/grub.8: Regenerated. + +1999-10-13 OKUJI Yoshinori + + * stage2/builtins.c (color_func): Do not set NORMAL_COLOR or + HIGHLIGHT_COLOR directly, but use NEW_NORMAL_COLOR and + NEW_HIGHLIGHT_COLOR as temporary storages instead. + New internal function `color_number' is used to convert a + symbolic color representation into a color number. + Try color_number at first, and if fails, then try + safe_parse_maxint for each of NORMAL and HIGHLIGHT. + (builtin_color): The long doc does not describe the raw number + syntax but the symbolic color name syntax. + * docs/grub.texi (Commands): Adjusted to the long doc of + BUILTIN_COLOR. + * docs/menu.lst: Add examples of "fallback" and "color". + +1999-10-13 OKUJI Yoshinori + + * stage2/char_io.c [!STAGE1_5] (get_cmdline): If C is a newline + or a return, then set LPOS to LLEN and call the function + cl_setcpos. + [!STAGE1_5] (grub_strncat): New function. + * stage2/builtins.c (embed_func): New function. + (builtin_embed): New varilable. + (setup_func): New function. + (builtin_setup): New varilable. + (builtin_table): Added a pointer to BUILTIN_EMBED and a pointer + to BUILTIN_SETUP. + * stage2/shared.h (grub_strncat): Declared. + + * stage2/Makefile.am (stage2_size.h): ../stage2/stage2 -> + pre_stage2. Reported by Pavel Roskin. + +1999-10-12 OKUJI Yoshinori + + From Pavel Roskin: + * acinclude.m4 (grub_PROG_OBJCOPY_ABSOLUTE): main -> cmain. + * stage2/boot.c (load_image): Only CUR_ADDR, not ENTRY_ADDR + should be 1M-aligned for NetBSD. Don't align symbol table on 4k + boundaries if the kernel doesn't require it. + +1999-10-10 OKUJI Yoshinori + + * stage2/asm.S [!STAGE1_5] (start): New label to force ld quiet. + [!STAGE1_5] (_start): Likewise. + * stage2/builtins.c (install_func): Rewritten heavily almost + from scratch. As the blocklist was moved to the first sector of + Stage 2, always write sectors of Stage 2 to the disk. + * stage1/stage1.h (STAGE1_STAGE2_SECTOR): 0x40 -> 0x41. + (STAGE1_STAGE2_ADDRESS): 0x44 -> 0x45. + (STAGE1_STAGE2_SEGMENT): 0x46 -> 0x47. + (STAGE1_BOOT_DRIVE): 0x3f -> 0x40. + +1999-10-09 OKUJI Yoshinori + + Stage1 supports both the CHS mode and the LBA mode. + + * stage1/Makefile.am (nodist_pkgdata_DATA): Removed stage1_lba. + (BUILT_SOURCES): Deleted. + (CLEANFILES): Likewise. + (noinst_PROGRAMS): Removed stage1_lba.exec. + (stage1_exec_SOURCES): Removed stage2_size.h. + (stage2_size.h): Deleted. + (stage1_lba_exec_SOURCES): Likewise. + * stage1/stage1.S: Rewritten from scratch. + * stage1/stage1_lba.S: Deleted. + * stage1/stage1.h (COMPAT_VERSION_MAJOR): Set to 3. + (COMPAT_VERSION_MINOR): Set to 0. + (STAGE1_VER_MAJ_OFFS): Set to 0x3e. + (STAGE1_FIRSTLIST): Deleted. + (STAGE1_INSTALLSEG): Likewise. + (STAGE1_INSTALLADDR): Likewise. + (STAGE1_MINPARAMSIZE): Likewise. + (STAGE1_LISTSIZE): Likewise. + (STAGE1_ID_OFFSET): Likewise. + (STAGE1_ID_CHS): Likewise. + (STAGE1_ID_LBA): Likewise. + (STAGE1_STAGE2_SECTOR): New macro. + (STAGE1_STAGE2_ADDRESS): Likewise. + (STAGE1_STAGE2_SEGMENT): Likewise. + (STAGE1_BOOT_DRIVE): Likewise. + * stage2/start.S: New file. + * stage2/Makefile.am (noinst_DATA): New variable. + (CLEANFILES): Set to "$(nodist_pkgdata_DATA) $(noinst_DATA) + $(BUILT_SOURCES)". + (noinst_PROGRAMS): Removed stage2.exec, and added start.exec and + pre_stage2.exec. + (STAGE2_LINK): Deleted. + (PRE_STAGE2_LINK): New variable. + (START_LINK): Likewise. + (stage2_exec_SOURCES): Deleted. + (stage2_exec_CFLAGS): Likewise. + (stage2_exec_LDFLAGS): Likewise. + [NETBOOT_SUPPORT] (stage2_exec_LDADD): Likewise. + (pre_stage2_exec_SOURCES): New variable. + (pre_stage2_exec_CFLAGS): Likewise. + (pre_stage2_exec_LDFLAGS): Likewise. + [NETBOOT_SUPPORT] (pre_stage2_exec_LDADD): Likewise. + (BUILT_SOURCES): Likewise. + (start_exec_SOURCES): Likewise. + (start_exec_CFLAGS): Likewise. + (start_exec_LDFLAGS): Likewise. + (start_exec_DEPENDENCIES): Likewise. + (stage2_size.h): New rule. + (stage2): Likewise. + (e2fs_stage1_5_exec_SOURCES): Added start.S. + (fat_stage1_5_exec_SOURCES): Likewise. + (ffs_stage1_5_exec_SOURCES): Likewise. + (minix_stage1_5_exec_SOURCES): Likewise. + * stage2/asm.S (start): Renamed to ... + (main): ... this. + [STAGE1_5] (main): Jump to (codestart - EXT_C(main) + 0x2200) + instead of (codestart - EXT_C(start) + 0x2000). + [!STAGE1_5] (main): Jump to (codestart - EXT_C(main) + 0x8200) + instead of (codestart - EXT_C(start) + 0x8000). + [STAGE1_5] (chain_stage2): Use main instead of start. + * stage2/shared.h (BOOTSEC_LISTSIZE): New macro. + * stage2/stage1_5.c: Change the second argument for chain_stage2 + to 0x8200. + +1999-10-08 OKUJI Yoshinori + + * configure.in (--with-binutils): New option to specify a + directory to find binutils. + (CFLAGS): If WITH_BINUTILS is not empty, added the option `-B'. + (LD): Do not check for this. We don't use ld directly anyway. + (RANLIB): If WITH_BINUTILS is not empty, search the directory + WITH_BINUTILS first. + (OBJCOPY): Likewise. + * acinclude.m4 (grub_ASM_USCORE): Add CFLAGS into + AC_TRY_COMMAND. + (grub_ASM_ADDR32): Likewise. + (grub_ASM_PREFIX_REQUIREMENT): Likewise. + (grub_PROG_OBJCOPY_ABSOLUTE): Use CC instead of LD. + +1999-10-04 Pavel Roskin + + * stage2/freebsd.h (struct bootinfo): New member, bi_bios_dev. + * stage2/boot.c (bsd_boot): Set BI.BI_BIOS_DEV to SAVED_DRIVE. + +1999-10-04 OKUJI Yoshinori + + From Pavel Roskin: + * docs/grub.texi: Fix typos. + * stage2/builtins.c (install_func): Reformat the warning message + about the option `d'. + +1999-10-03 Gordon Matzigkeit + + * stage2/builtins.c (install_func): Fix check for the Stage 2 id. + From Pavel Roskin. + + * debian/Makefile.am (EXTRA_DIST): Add postinst and prerm. + +1999-10-03 OKUJI Yoshinori + + * stage2/builtins.c (boot_func): Pass MBI.CMDLINE instead of ARG + to bsd_boot. + +1999-10-03 OKUJI Yoshinori + + * stage2/gunzip.c (gunzip_test_header): Check if CURRENT_DRIVE + is 0x20 instead of if the fs type is TFTP, because GRUB does not + mount CURRENT_DRIVE when using a block file. Reported by Pavel + Roskin. + +1999-10-02 OKUJI Yoshinori + + * stage2/builtins.c (cat_func): Do not read the whole of a file + at one time. Instead, repeat reading one byte and print it on + the screen. + * docs/grub.texi (Command line): List the available key + bindings. + (Commands): Added descriptions about "geometry", "device" and + "cat". + +1999-10-02 OKUJI Yoshinori + + Now it is possible to build the grub shell with old BSD curses. + + * stage2/shared.h [!A_NORMAL] (A_NORMAL): Set to zero. + [!A_REVERSE && A_STANDOUT] (A_REVERSE): Set to A_STANDOUT. + [!A_REVERSE && !A_STANDOUT] (A_REVERSE): Set to zero. + +1999-09-30 Pavel Roskin + + * stage2/disk_io.c (set_bootdev): Mask 0x7F instead of 0x79 of + the device number. + +1999-10-01 OKUJI Yoshinori + + * configure.in (--without-curses): New option. If WITH_CURSES is + no, do not check for curses. + + * stage2/disk_io.c (set_device) [STAGE1_5]: Change the type of + DEV to unsigned long. + * stage2/builtins.c (install_func): Always check for the Stage 2 + id in FILE. + Reported by Pavel Roskin. + +1999-09-30 Gordon Matzigkeit + + * debian/postinst: New file to call install-info. + * debian/prerm: Likewise. + * debian/rules (binary-arch): Add postinst and prerm, compress the + info files, and call dpkg-shlibdeps. + + * stage2/cmdline.c (skip_to): Restructure, and count tabs as + whitespace. + (find_command): Likewise. + +1999-09-30 OKUJI Yoshinori + + * grub/getopt.c: Moved to ... + * lib/getopt.c: ... here. + * grub/getopt1.c: Moved to ... + * lib/getopt1.c: ... here. + * grub/getopt.h: Moved to ... + * lib/getopt.h: ... here. + * grub/Makefile.am (AM_CFLAGS): Added -I$(top_srcdir)/lib. + (grub_LDADD): Added ../lib/libcommon.a. + * lib/Makefile.am: New file. + * Makefile.am (SUBDIRS): Added lib. + * configure.in: lib/Makefile is added into the arguments for + AC_OUTPUT. + +1999-09-30 OKUJI Yoshinori + + From Pavel Roskin: + * stage2/defs.h (time_t): Renamed to ... + (mach_time_t): ... this. + (daddr_t): Renamed to ... + (mach_daddr_t): ... this. + (uid_t): Renamed to ... + (mach_uid_t): ... this. + (gid_t): Renamed to ... + (mach_gid_t): ... this. + (ino_t): Renamed to ... + (mach_ino_t): ... this. + * stage2/disk_inode.h (FFS_MAX_FASTLINK_SIZE): Use mach_daddr_t + instead of daddr_t. + (struct icommon): Use mach_uid_t, mach_gid_t, mach_time_t and + mach_daddr_t, instead of uid_t, gid_t, time_t and daddr_t. + * stage2/fs.h (BBLOCK): Use mach_daddr_t instead of addr_t. + (SBLOCK): Likewise. + (ROOTINO): Use mach_ino_t instead of ino_t. + (struct fs): Use mach_daddr_t and mach_time_t instead of daddr_t + and time_t. + (struct cg): Use mach_time_t instead of time_t. + (struct ocg): Likewise. + (cgbase): Use mach_daddr_t instead of daddr_t. + (itod): Likewise. + +1999-09-30 OKUJI Yoshinori + + * acinclude.m4 (grub_CHECK_START_SYMBOL): Use AC_TRY_LINK + instead of AC_TRY_COMMAND. + (grub_CHECK_USCORE_START_SYMBOL): Likewise. + (grub_CHECK_END_SYMBOL): Likewise. + (grub_CHECK_USCORE_END_SYMBOL): Likewise. + + * stage2/disk_io.c (set_device) [!STAGE1_5]: Use RESULT instead + of RETVAL to check if the analysis succeeds. + +1999-09-29 OKUJI Yoshinori + + * stage2/builtins.c (install_func): If the Stage 2 id in FILE is + not STAGE2_ID_STAGE2, set IS_STAGE1_5 to 1, otherwise to 0. + Use CONFIG_FILE_LOCATION to point to the location of the name of + a configuration file in Stage 2. + If the option `p' is present and IS_STAGE1_5 is non-zero, reset + the device information in CONFIG_FILE_LOCATION. + (cat_func): New function. + (builtin_cat): New variable. + (builtin_table): Added a pointer to BUILTIN_CAT. + (geometry_func): Call real_open_partition with the argument 1 + after printing out the drive information. + * stage2/disk_io.c (real_open_partition): Made global. + [!STAGE1_5] (print_completions): In the command completion and + the filename completion, print a newline at the last if + IS_COMPLETION is zero. + * stage2/shared.h (real_open_partition): Declared. + * stage2/fsys_ext2fs.c (ext2fs_dir): Do not print a newline even + if PRINT_POSSIBILITIES is less than zero. + * stage2/fsys_ffs.c (ffs_dir): Likewise. + * stage2/fsys_fat.c (fat_dir): Likewise. + * stage2/fsys_minix.c (minix_dir): Likewise. + +1999-09-29 OKUJI Yoshinori + + * stage1/stage1.S [!FFS_STAGE1_5] (blocklist_default_len): Do + not divide the size by 512, but shift the size to the right by + 9 instead, because of a binutils-2.9.1.0.x bug. + * stage1/stage1_lba.S [!FFS_STAGE1_5] (blocklist_default_len): + Likewise. + * stage2/builtins.c (install_func): When installing Stage 1.5, + if set_device returns NULL, then set CURRENT_DRIVE to 0xFF and + CONFIG_FILE to PTR. + +1999-09-26 OKUJI Yoshinori + + * stage2/char_io.c [!STAGE1_5] (get_cmdline): In cl_insert, call + cl_setcpos before printing BUF, even if LPOS is equal to LLEN. + In the completion, if RET is zero, do not call cl_init. + * stage2/disk_io.c [!STAGE1_5] (print_completions): In the + filename completion, if UNIQUE is 1, check if UNIQUE_STRING is a + directory or not. If so, append '/' to BUF. + In the partition completion, if IS_COMPLETION is non-zero and + *UNIQUE_STRING is not NUL, copy UNIQUE_STRING to PTR. Do not + append '/'. + (real_open_partition) [!STAGE1_5]: If DO_COMPRESSION is non-zero, + call print_a_completion. + (check_BSD_parts) [!STAGE1_5]: Likewise. + [!STAGE1_5] (print_a_completion): Ignore NAME if it is "." or + "..". + +1999-09-25 OKUJI Yoshinori + + * acinclude.m4 (grub_CHECK_USCORE_END_SYMBOL): Do not call + AC_DEFINE within AC_CACHE_VAL. Call it after AC_CACHE_VAL. + * stage2/Makefile.am (STAGE1_5_COMPILE): Do not define + CONFIG_FILE_ASM. + * stage2/asm.S (config_file) [STAGE1_5]: Set the first 4 bytes + to 0xffffffff and the following to "/boot/grub/stage2". + (config_file) [!STAGE1_5]: Set to "/boot/grub/menu.lst". + * stage2/builtins.c (install_func): Read a Stage 2 before + handling the `p' option. + If the `configfile' option is present and FILE is a Stage 2, + translate the device name to the internal device representation + and copy the result to STR. + * stage2/disk_io.c [STAGE1_5] (sane_partition): Eliminated. + [STAGE1_5] (incomplete): Likewise. + [STAGE1_5] (disk_choice): Likewise. + [STAGE1_5] (part_choice): Likewise. + (set_device) [STAGE1_5]: Assume that the first 4 bytes of DEVICE + is a device number. Set DRIVE to the forth byte of DEV and + PARTITION to the first 3 bytes of DEV. If DRIVE is 0xFF, set + CURRENT_DRIVE and CURRENT_PARTITION to SAVED_DRIVE and + SAVED_PARTITION, respectively. Otherwise set to DRIVE and + PARTITION, respectively. + (setup_part) [STAGE1_5]: Always call set_device. + +1999-09-24 OKUJI Yoshinori + + * acinclude.m4 (grub_CHECK_END_SYMBOL): Add a missing + double-quote. Reported by Johannes Kroeger + . + +1999-09-14 Gordon Matzigkeit + + * stage1/stage1.S (blocklist_default_start): New label for default + blocklist start sector. + (blocklist_default_len): New label for default blocklist length. + (blocklist_default_seg): New label for default blocklist segment. + * stage1/stage1_lba.S (blocklist_default_start): Likewise. + (blocklist_default_len): Likewise. + (blocklist_default_seg): Likewise. + +1999-09-23 OKUJI Yoshinori + + * acinclude.m4 (grub_ASM_ADDR32): First, create a template + source file "conftest.s.in", and then, replace @ADDR32@ with + "addr32" if GRUB_CV_ASM_PREFIX_REQUIREMENT is yes, otherwise, + replace it with "addr32;". Reported by John Tobey + . + +1999-09-23 OKUJI Yoshinori + + * stage2/builtins.c (debug_fs_print_func): Renamed to ... + (disk_read_print_func): ... this. + (fstest_func): Use DISK_READ_HOOK instead of DEBUG_FS. + (install_func): Rename debug_fs_savesect_func to + disk_read_savesect_func. + Rename debug_fs_blocklist_func to disk_read_blocklist_func. + Use DISK_READ_HOOK instead of DEBUG_FS. + (testload_func): Use DISK_READ_HOOK instead of DEBUG_FS. + * stage2/disk_io.c [!STAGE1_5] (debug_fs): Renamed to ... + [!STAGE1_5] (disk_read_hook): ... this. + [!STAGE1_5] (debug_fs_func): Renamed to ... + [!STAGE1_5] (disk_read_func): ... this. + (rawread) [!STAGE1_5]: Use DISK_READ_HOOK and DISK_READ_FUNC + instead of DEBUG_FS and DEBUG_FS_FUNC. + (grub_read) [!STAGE1_5]: Likewise. + (devread) [!STAGE1_5]: Use DISK_READ_HOOK instead of DEBUG_FS. + * stage2/fsys_ext2fs.c (ext2fs_read) [!STAGE1_5]: Use + DISK_READ_HOOK and DISK_READ_FUNC instead of DEBUG_FS and + DEBUG_FS_FUNC. + * stage2/fsys_ffs.c (ffs_read) [!STAGE1_5]: Likewise. + * stage2/fsys_minix.c (minix_read) [!STAGE1_5]: Likewise. + * stage2/shared.h [!STAGE1_5] (debug_fs): Renamed to ... + [!STAGE1_5] (disk_read_hook): ... this. + [!STAGE1_5] (debug_fs_func): Renamed to ... + [!STAGE1_5] (disk_read_func): ... this. + * docs/grub.texi: Likewise, replace debug_fs and debug_fs_func + with disk_read_hook and disk_read_func, respectively. + +1999-09-23 Pavel Roskin + + * stage2/builtins.c (install_func): New local function, + debug_fs_savesect_func. Use debug_fs_savesect_func to determine + the first sector of Stage2. Write Stage 1 after patching Stage + 2. + +1999-09-22 OKUJI Yoshinori + + * acinclude.m4 (grub_ASM_USCORE): Do not define HAVE_ASM_USCORE + within AC_CACHE_VAL. Define it after AC_CACHE_VAL if + GRUB_CV_ASM_USCORE is yes. + +1999-09-20 Edmund GRIMLEY EVANS + + * netboot/3c59x.c: INCLUDE_3c59x is replaced by INCLUDE_3C59X + throughout. + * netboot/config.c: Likewise. + * netboot/io.h (__INS): New macro. + (__OUTS): Likewise. + (outl): Likewise. + (inl): Likewise. + (outl_p): Likewise. + (inl_p): Likewise. + Call __INS with the argument `b', with `w' and with `l' to + define insb, insw and insl, respectively. Likewise, Call __OUTS + with `b', with `w' and with `l' to define outsb, outw and outl, + respectively. + * netboot/pci.h (PCI_VENDOR_ID_VORTEX): New macro. + (PCI_DEVICE_ID_VORTEX_3c595): Likewise. Defined as a random + value. + +1999-09-20 Edward Killips + + * stage2/disk_io.c (set_partition_hidden_flag): Set/clear the + hidden flag, whether the hidden flag is set or not. + +1999-09-21 OKUJI Yoshinori + + * stage2/builtins.c (install_func): Do not set DEBUG_FS at the + first read. Set it to DEBUG_FS_BLOCKLIST_FUNC when reading the + whole of Stage 2. Set FILEPOS to zero at the same time to read + from the beginning of Stage 2. Reported by Pavel Roskin. + +1999-09-20 OKUJI Yoshinori + + The argument ADDR for the command install is now optional. + + * stage2/builtins.c (install_func): If parsing ADDR fails, set + INSTALLADDR to zero and set PTR to ADDR. + If INSTALLADDR is zero after parsing the command-line, check if + the Stage 2 id is STAGE2_ID_STAGE2. If so, set INSTALLADDR to + 0x8000, otherwise set it to 0x2000. + Set the install address in the Stage 1 after the automatic + determination is completed. + (builtin_install): Say that ADDR is optional in the help + message. + * docs/grub.texi: Synchronize the description about install to + builtins.c. Remove explicit address arguments from all the + examples. Add a description about help. + * docs/menu.lst: Do not specify the address argument for + install. + +1999-09-19 OKUJI Yoshinori + + The completion code is heavily modified. + + * stage2/char_io.c [!STAGE1_5] (get_cmdline): In the completion + code, use COMPLETION_BUFFER to get the completion instead of + writing to BUF directly. + Save the position of a possible equal character after a command + in EQUAL_POS and replace the equal character with a space + temporarily for the code simplicity. + At first, just get completions, and, if there is more than one + completions, then print the list of the completions. + * stage2/disk_io.c [!STAGE1_5] (do_completion): New variable. + [!STAGE1_5] (unique): Moved the definition near the beginning. + [!STAGE1_5] (unique_string): Likewise. And changed the type to + char *. + (check_BSD_parts) [!STAGE1_5]: If DO_COMPLETION is non-zero, do + not print anything. + (real_open_partition) [!STAGE1_5]: Likewise. + [!STAGE1_5] (print_fsys_type): Likewise. + [!STAGE1_5] (print_a_completion): The argument FILENAME is + renamed to NAME. + If DO_COMPLETION is non-zero, get the unique part from NAME and + set UNIQUE_STRING to it. + If DO_COMPLETION is zero, just print NAME. + Do not call printf unconditionally. + [!STAGE1_5] (print_completions): Accept two arguements + IS_FILENAME and IS_COMPLETION instead of FILENAME. + Set UNIQUE_STRING to UNIQUE_BUF. + Set DO_COMPLETION to IS_COMPLETION and set it to zero before + returning. + If IS_FILENAME is zero, then complete builtin commands and + return UNIQUE - 1. + Use BUF instead of FILENAME. + If IS_COMPLETION is non-zero, do not print anything. + Copy UNIQUE_STRING to PTR only if IS_COMPLETION and + *UNIQUE_STRING are non-zero. + * stage2/shared.h (COMPLETION_BUF): New macro. + (COMPLETION_BUFLEN): Likewise. + (UNIQUE_BUF): Likewise. + (UNIQUE_BUFLEN): Likewise. + (MENU_BUF): Set to UNIQUE_BUF + UNIQUE_BUFLEN. + (MENU_BUFLEN): Set to 0x8000 + PASSWORD_BUF - UNIQUE_BUF. + (print_completions): Adjusted to the definition. + +1999-09-19 OKUJI Yoshinori + + * acinclude.m4 (grub_ASM_PREFIX_REQUIREMENT): Do not call + AC_DEFINE_UNQUOTEs within AC_CACHE_VAL. Define ADDR32 and DATA32 + after it. + (grub_CHECK_START_SYMBOL): Do not call AC_DEFINE within + AC_CACHE_VAL. Define HAVE_START_SYMBOL after it. + (grub_CHECK_USCORE_START_SYMBOL): Do not call AC_DEFINE within + AC_CACHE_VAL. Define HAVE_USCORE_START_SYMBOL after it. + (grub_CHECK_END_SYMBOL): Do not call AC_DEFINE within + AC_CACHE_VAL. Define HAVE_END_SYMBOL after it. + (grub_CHECK_USCORE_END_SYMBOL): Do not call AC_DEFINE within + AC_CACHE_VAL. Define HAVE_USCORE_END_SYMBOL after it. + +1999-09-17 Pavel Roskin + + * acconfig.h (ADDR32): Removed. This entry is automatically + created by autoheader. + (DATA32): Likewise. + * acinclude.m4 (grub_ASM_ADD32): Use ADDR32 instead of addr32. + Require grub_ASM_PREFIX_REQUIREMENT. + (grub_ASM_PREFIX_REQUIREMENT): Define ADDR32 and DATA32. + * configure.in: Call grub_ASM_PREFIX_REQUIREMENT before + grub_ASM_ADDR32. Do not define ADDR32 and DATA32. + * stage1/stage1.S (after_BPB): Use ABS(firstlist) instead of + firstlist. + (MSG): Use ABS(x) instead of x. + (probe_loop): Use the macro MSG for fd_probe_error_string. + * stage1/stage1_lba.S (after_BPB): Use ABS(firstlist) instead of + firstlist. + (MSG): Use ABS(x) instead of x. + * stage2/asm.S (putchar): Renamed to ... + (grub_putchar): ... this. + +1999-09-18 OKUJI Yoshinori + + * stage2/gunzip.c (reset_linalloc): Use the macro RAW_ADDR + before setting LINALLOC_TOPADDR. + * stage2/shared.h [!GRUB_UTIL] (RAW_ADDR): Added parenthesises + to avoid a gcc warning. + [!GRUB_UTIL] (RAW_SEG): Likewise. + +1999-09-18 OKUJI Yoshinori + + * acinclude.m4 (grub_CHECK_START_SYMBOL): New function. + (grub_CHECK_USCORE_START_SYMBOL): Likewise. + (grub_CHECK_END_SYMBOL): Likewise. + (grub_CHECK_USCORE_SYMBOL): Likewise. + * configure.in: Call grub_CHECK_START_SYMBOL and + grub_CHECK_USCORE_START_SYMBOL, and if neither start nor _start + is defined, print an error message and exit. + Likewise, call grub_CHECK_END_SYMBOL and + grub_CHECK_USCORE_END_SYMBOL, and if neither end nor _end is + defined, print an error message and exit. + * acconfig.h (HAVE_START_SYMBOL): Added the "undef" entry. + (HAVE_USCORE_START_SYMBOL): Likewise. + (HAVE_END_SYMBOL): Likewise. + (HAVE_USCORE_END_SYMBOL): Likewise. + * stage2/char_io.c (memcheck): Rename the argument START to + ADDR. Added two missing equal characters. + [GRUB_UTIL]: Define new local functions start_addr and end_addr. + [GRUB_UTIL && HAVE_START_SYMBOL]: The function start_addr + returns START. + [GRUB_UTIL && HAVE_USCORE_START_SYMBOL]: The function start_addr + returns _START. + [GRUB_UTIL && HAVE_END_SYMBOL]: The function end_addr returns + END. + [GRUB_UTIL && HAVE_USCORE_END_SYMBOL]: The function end_addr + returns _END. + [GRUB_UTIL]: If ADDR is equal to or greater than the address + returned by start_addr, and ADDR plus LEN is less than the + address returned by end_addr, return ! ERRNUM. + * stage2/asm.S (get_code_end) [HAVE_END_SYMBOL]: Use $end as the + end of the bss. + [HAVE_USCORE_END_SYMBOL]: Use $_end as the end of the bss. + * stage2/disk_io.c [!STAGE1_5] (cur_part_desc): Made static. + Need not to be global any longer. + +1999-09-17 OKUJI Yoshinori + + * stage2/char_io.c [!STAGE1_5] (get_cmdline): The argument + COMPLETION is renamed to READLINE. + Do not initialize KILL here. + TAB, C-a, C-e, C-f, C-b, C-u, C-k, C-y, C-p and C-n are handled + only if READLINE is non-zero. + If ECHO_CHAR is not NUL, do not remove the leading spaces in BUF. + Add CMDLINE into the history list only if READLINE is non-zero. + * stage2/stage2.c (cmain): Initialize the kill buffer. + +1999-09-17 OKUJI Yoshinori + + Killing, yanking and manipulating the history are supported. + + * stage2/shared.h (cur_cmdline): Removed. + (MAX_CMDLINE): Moved near the beginning of the file. + (NEW_HEAPSIZE): Likewise. + (CMDLINE_BUFLEN): Set to MAX_CMDLINE. + (KILL_BUF): New macro. + (KILL_BUFLEN): Likewise. + (HISTORY_BUF): Likewise. + (HISTORY_SIZE): Likewise. + (HISTORY_BUFLEN): Likewise. + (MENU_BUF): Set to HISTORY_BUF + HISTORY_BUFLEN. + (MENU_BUFLEN): Set to 0x8000 + PASSWORD_BUF - HISTORY_BUF. + (strcpy): New macro. + (grub_strcpy): Delared. + * stage2/boot.c (cur_cmdline): Removed. + * stage2/char_io.c [!STAGE1_5] (grub_strcpy): New function. + [!STAGE1_5] (get_history): Likewise. + [!STAGE1_5] (add_history): Likewise. + [!STAGE1_5] (get_cmdline): Use BUF instead of CMDLINE for the + working buffer for the command-line. + A new function cl_insert is used to insert a string to the + command-line. + In the case where C-u or C-k is pressed, copy the string being + deleted to KILL. + If C-y is pressed, insert KILL to the command-line. + If C-p is pressed, fetch the previous command from the history + list HISTORY, and if C-n is pressed, fetch the next command from + it. + If LPOS is less than LLEN, add CMDLINE into the history list. + If C is equal to KEY_UP, set C to 16, and if C is equal to + KEY_DOWN, set C to 14. + [!STAGE1_5] (num_history): New variable. + +1999-09-15 OKUJI Yoshinori + + * stage2/size_test: Do not check for the size of Stage 2. + * stage1/Makefile.am (stage2_size.h): Use `set' and `echo' + instead of awk, since we cannot expect awk is present. Remove + stage2_size.h before creating it. + +1999-09-15 Pavel Roskin + + * Makefile.am (SUBDIRS): Put stage1 after stage2 so that stage2 + is built before stage1. + * stage1/Makefile.am (BUILT_SOURCES): New varilable. + (CLEANFILES): Added BUILT_SOURCES. + (stage1_exec_SOURCES): Added stage2_size.h. + (stage1_lba_exec_SOURCES): Likewise. + (stage2_size.h): New rule. + * stage1/stage1.S: Include and use STAGE2_SIZE + to determine how much number of sectors to be read when loading + Stage 2. + * stage1/stage1_lba.S: Likewise. + +1999-09-15 OKUJI Yoshinori + + * netboot/config.h: Moved to ... + * netboot/netboot_config.h: ... here. + * netboot/config.c: Include netboot_config.h instead of config.h. + * netboot/fsys_tftp.c: Likewise. + * netboot/ip.c: Likewise. + * netboot/Makefile.am (libdrivers_a_SOURCES): Removed config.h + and added netboot_config.h. + +1999-09-14 Pavel Roskin + + * grub/asmstub.c [__linux__]: On GLibc 2.0 and newer use lseek, + don't include and define BLKFLSBUF if needed. + +1999-09-14 OKUJI Yoshinori + + Now the grub shell works fine on FreeBSD. A patch by Pavel + Roskin is modified and applied. + + * grub/asmstub.c (get_drive_geometry): New function. + (get_diskinfo): Use get_drive_geometry to set the geometry of + DRIVE. + +1999-09-14 OKUJI Yoshinori + + * configure.in (--enable-ne): Made the description more clear. + (--enable-nepci): Likewise. + (--enable-wd): Likewise. + (--enable-t503): Likewise. + (--enable-t509): Likewise. + (--enable-3c59x): Likewise. + (--enable-lance): Likewise. + (--enable-cs): Likewise. + (--enable-eepro100): Likewise. + (--enable-wd-default_mem): Renamed to ... + (--enable-wd-default-mem): ... this. + (--enable-cs-scan): Corrected the description. + (NETBOOT_SUPPORT): Defined if NET_CFLAGS is not empty. + * stage2/Makefile.am (stage2_exec_LDADD): Defined only if + NETBOOT_SUPPORT is true. + * netboot/Makefile.am (LIBDRIVERS): New variable. If + NETBOOT_SUPPORT is true, set to libdriver.a, otherwise set to an + empty string. + (noinst_LIBRARIES): Set to LIBDRIVERS. + (DRIVERS): Added 3c509.h, cs89x0.h and ns8390.h. + (libdrivers_a_SOURCES): Added byteorder.h, config.h, if.h, io.h, + ip.h, netboot.h, netdevice.h, nic.h and pic.h. + (libdrivers_a_CFLAGS): Added -fno-builtin and -nostdinc and + removed -O2. + * stage2/char_io.c (grub_sprintf): Added parenthesises to avoid + gcc warnings. + * stage2/gunzip.c (gunzip_test_header): Check if FSYS_TYPE is + TFTP. If so, set IS_TFTP to non-zero, otherwise to zero. And, + use IS_TFTP to check if we have GZIP_CRC instead of the equation + "FILEMAX == 16 * 1024 * 1024". + +1999-09-13 Edmund GRIMLEY EVANS + + The netboot support in the Dresden version of GRUB is integrated. + + * Makefile.am (SUBDIRS): Added netboot. + * configure.in (--enable-tftp): New option. + (--enable-ne): Likewise. + (--enable-nepci): Likewise. + (--enable-wd): Likewise. + (--enable-t503): Likewise. + (--enable-t509): Likewise. + (--enable-3c59x): Likewise. + (--enable-lance): Likewise. + (--enable-cs): Likewise. + (--enable-eepro100): Likewise. + (--enable-ne-scan): Likewise. + (--enable-wd-default_mem): Likewise. + (--enable-cs-scan): Likewise. + (NET_CFLAGS): New variable. + (NET_EXTRAFLAGS): Likewise. + Do AC_OUTPUT for netboot/Makefile as well. + * stage1/stage1.S: Set the number of sectors for Stage 2 to 130. + * stage1/stage1_lba.S: Likewise. + * stage2/Makefile.am (stage2_exec_LDADD): Added + ../netboot/libdrivers.a. + * stage2/asm.S [!STAGE1_5] (currticks): New function. + * stage2/char_io.c [!STAGE1_5] (grub_sprintf): Likewise. + [!STAGE1_5] (grub_memcmp): Likewise. + * stage2/disk_io.c (fsys_table) [FSYS_TFTP]: Added an entry for + tftp. + (sane_partition) [!STAGE1_5]: If CURRENT_DRIVE is a network + drive, return 1. + (real_open_partition) [!STAGE1_5]: Likewise. + (set_device): If DEVICE contains a network drive, set + CURRENT_DRIVE to 0x20. + * stage2/filesys.h [FSYS_TFTP] (FSYS_TFTP_NUM): Defined as 1. + [!FSYS_TFTP] (FSYS_TFTP_NUM): Defined as 0. + (NUM_FSYS): Added FSYS_TFTP_NUM. + * stage2/gunzip.c (gunzip_test_header): If FILEMAX >= 16MB, do + not try to examine the last 8 bytes of the file. This is + required for compressed files by TFTP. + * stage2/shared.h (sprintf): New macro. + (memcmp): Likewise. + (currticks): Declared. + (grub_sprintf): Likewise. + (grub_memcmp): Likewise. + * stage2/size_test: Set the maximum size of Stage 2 to 66560. + * netboot/3c509.c: New file. + * netboot/3c509.h: Likewise. + * netboot/3c59x.c: Likewise. + * netboot/Makefile.am: Likewise. + * netboot/Makefile.in: Likewise. + * netboot/byteorder.h: Likewise. + * netboot/compile: Likewise. + * netboot/config.c: Likewise. + * netboot/config.h: Likewise. + * netboot/cs89x0.c: Likewise. + * netboot/cs89x0.h: Likewise. + * netboot/eepro100.c: Likewise. + * netboot/fsys_tftp.c: Likewise. + * netboot/if.h: Likewise. + * netboot/io.h: Likewise. + * netboot/ip.c: Likewise. + * netboot/ip.h: Likewise. + * netboot/lance.c: Likewise. + * netboot/netboot.h: Likewise. + * netboot/netdevice.h: Likewise. + * netboot/nic.h: Likewise. + * netboot/ns8390.c: Likewise. + * netboot/ns8390.h: Likewise. + * netboot/pci.c: Likewise. + * netboot/pci.h: Likewise. + +1999-09-13 OKUJI Yoshinori + + * configure.in (--enable-maintainer-mode): Do not use our own + rule, but use AM_MAINTAINER_MODE instead. If the maintainer mode + is enabled, then check for perl, and if it is not found, print + an error message and abort. + * docs/Makefile.am (grub.8): Regenerated if MAINTAINER_MODE is + defined, instead of GRUB_MAINT. Use the variable PERL rather + than running help2man directly. + +1999-09-13 Pavel Roskin + + * stage2/pc_slice.h (IS_PC_SLICE_TYPE_EXTENDED): New macro. + * stage2/disk_io.c (real_open_partition): Use + IS_PC_SLICE_TYPE_EXTENDED instead of comparing CURRENT_SLICE + with the extended partition types. + +1999-09-11 Pavel Roskin + + * acconfig.h: New file for autoheader support. + * acinclude.m4 (grub_ASM_EXT_C) Renamed to ... + (grub_ASM_USCORE): ... this. Define HAVE_ASM_USCORE if a C + symbol gets an underscore after compiling to assembler. + * configure.in: Added AM_CONFIG_HEADER. Autoconf 2.13 is now + required. Test for wgetch(), not getch() in -l[n]curses. + * stage2/shared.h (EXT_C): Defined. + Include the best existing header for [n]curses. + +1999-09-12 OKUJI Yoshinori + + * stage2/boot.c (load_image): Use CURRENT_DRIVE and + CURRENT_PARTITION instead of SAVED_DRIVE and SAVED_PARTITION for + the boot device in the Multiboot information. Reported by + Stephen Early . + +1999-09-12 OKUJI Yoshinori + + * stage2/disk_io.c (sane_partition) [STAGE1_5]: Defined. + (set_device): Use sane_partition to make sure that CURRENT_DRIVE + has a valid value. Reported by Pavel Roskin. + +1999-09-11 OKUJI Yoshinori + + From Pavel Roskin: + * stage2/builtins.c (device_func) [GRUB_UTIL]: Use check_device + in order to make sure that DEVICE exists. + * grub/asmstub.c (check_device): New function. + (grub_stage2): Use check_device to probe a device. + + * stage2/builtins.c (geometry_func) [GRUB_UTIL]: Copy the + modified geometry to GEOM and reset BUF_DRIVE. Reported by Pavel + Roskin. + + * grub/main.c (no_floppy): New variable. + (probe_second_floppy): Likewise. + (OPT_NO_FLOPPY): New macro. + (OPT_PROBE_SECOND_FLOPPY): Likewise. + (longopts): Added no-floppy and probe-second-floppy. + (usage): Added the descriptions about --no-floppy and + --probe-second-floppy. + (main): Handle OPT_PROBE_SECOND_FLOPPY and OPT_NO_FLOPPY. + * grub/asmstub.c (grub_stage2): Print a message before the probe + routine. If NO_FLOPPY is non-zero, do not probe any floppy drive. + If PROBE_SECOND_FLOPPY is zero, skip the probe of the second + floppy drive. + (get_floppy_disk_name): New function. + (get_ide_disk_name): Likewise. + (get_scsi_disk_name): Likewise. + +1999-09-10 OKUJI Yoshinori + + * stage2/builtins.c (device_func): New function. + (builtin_device): New variable. + (builtin_table): Added the pointer to BUILTIN_DEVICE. + (builtin_geometry) [GRUB_UTIL]: Accept extra arguments, + CYLINDER, HEAD, SECTOR and TOTAL_SECTOR, and, if they are found, + set the geometry of a drive specified to them. + * grub/asmstub.c (disks): Made global. + (assign_device_name): New function. + +1999-09-09 Gordon Matzigkeit + + * docs/grub.texi (Commands): Synchronize descriptions with + builtins.c. + + * stage2/builtins.c (hide_func): Use set_partition_hidden_flag. + (unhide_func): Likewise. + Many help message cleanups. From Pavel Roskin. + + * stage2/shared.h (set_partition_hidden_flag): Declare. + + * stage2/disk_io.c (set_partition_hidden_flag): New function + merged from hide_partition and unhide_partition. Make sure we OR + with the inverse of the flag bit rather than XORing to unhide the + partition. + +1999-09-10 OKUJI Yoshinori + + * grub/asmstub.c (_FILE_OFFSET_BITS): Defined. + (biosdisk) [!__linux__]: Pass the offset argument as off_t + instead of int to lseek, and compare the return value with + OFFSET. Reported by Pavel Roskin. + (grub_stage2) [!__linux__ && !__GNU__]: Print a warning message. + +1999-09-08 OKUJI Yoshinori + + * stage2/stage2.c (run_menu): If run_script is successfully + finished, break the loop. Reported by Pavel Roskin. + Do not wait an input character when FALLBACK_ENTRY is less than + zero. + * stage2/cmdline.c (run_script): If ERRNUM is non-zero, wait an + input character, whether FALLBACK is less than zero or not. + +1999-09-06 OKUJI Yoshinori + + * stage2/builtins.c (configfile_func): New function. + (builtin_configfile): New variable. + (builtin_table): Added the pointer to BUILTIN_CONFIGFILE. + +1999-09-06 OKUJI Yoshinori + + From Pavel Roskin: + * stage2/asm.S [!STAGE1_5] (chain_stage2): Deleted. + [STAGE1_5] (get_code_end): Likewise. + * stage2/char_io.c (grub_strncat): Likewise. + * stage2/common.c [STAGE1_5] (saved_mem_upper): Likewise. + * stage2/smp-imps.c (imps_release_cpus): Likewise. + (imps_any_new_apics): Made static. + (imps_enabled): Likewise. + (imps_num_cpus): Likewise. + (imps_lapic_addr): Likewise. + (imps_cpu_apic_map): Likewise. + (imps_apic_cpu_map): Likewise. + +1999-09-06 OKUJI Yoshinori + + * stage2/builtins.c (testload_func): Fix the typos: 0x2000000 -> + 0x200000 and 0x3000000 -> 0x300000. + +1999-09-06 OKUJI Yoshinori + + From Hisazumi Kenji : + * stage2/fsys_ffs.c (mapblock_offset): New variable. + (mapblock_bsize): Likewise. + (MAPBUF): New macro. + (MAPBUF_LEN): Likewise. + (ffs_mount): Set MAPBLOCK_OFFSET to -1. + (block_map): Added partial read support. + +1999-09-06 OKUJI Yoshinori + + * stage2/cmdline.c (find_command): If COMMAND is less than + (*BUILTIN)->NAME in dictionary order, break the loop. + * stage2/builtins.c (builtin_chainloader): Capitalize the + variable name in the short doc. + (builtin_color): Likewise. + (builtin_geometry): Likewise. + (builtin_help): Likewise. + (builtin_hide): Likewise. + (builtin_initrd): Likewise. + (builtin_install): Likewise. + (builtin_kernel): Likewise. + (builtin_module): Likewise. + (builtin_modulenounzip): Likewise. + (builtin_pause): Likewise. + (builtin_read): Likewise. + (builtin_root): Likewise. + (builtin_testload): Likewise. + (builtin_unhide): Likewise. + (builtin_uppermem): Likewise. + +1999-09-05 OKUJI Yoshinori + + The internal of the command handling is heavily modified, and + a new command "help" is added. + + * stage1/stage1.S: Set the number of sectors for Stage 2 to 110. + * stage1/stage1_lba.S: Likewise. + * stage2/builtins.c: New file. + * stage2/Makefile.am (libgrub_a_SOURCES): Added builtins.c. + (stage2_exec_SOURCES): Likewise. + * stage2/boot.c (load_image): Return kernel_t instead int. + (bsd_boot): Change the type of the first argument to kernel_t. + * stage2/char_io.c (get_cmdline): Do not accept the argument + COMMANDS and accept the argument COMPLETION. + Print completions only if COMPLETION is non-zero. + Print the list of short docs when the command is completed. + * stage2/cmdline.c [GRUB_UTIL]: Do not include apic.h and + smp-imps.h. + (fallback): Deleted. + (password): Likewise. + (debug): Likewise. + (normal_color): Likewise. + (highlight_color): Likewise. + (print_cmdline_message): New function. + (commands): Deleted. + (debug_fs_print_func): Likewise. + (installaddr): Likewise. + (installlist): Likewise. + (installsect): Likewise. + (debug_fs_blocklist_func): Likewise. + (find_command): New function. + (init_cmdline): Initialize the data for the command-line + interface. The function to print the message is moved to + print_cmdline_message. + (enter_cmdline): Rewritten from scratch. Now deal with only the + pure command-line and the function to deal with a menu entry is + moved to run_script. + (run_script): New function. + * stage2/shared.h (PASSWORD_BUF): New macro. + (PASSWORD_BUFLEN): Likewise. + (CMDLINE_BUF): Likewise. + (CMDLINE_BUFLEN): Likewise. + (MENU_BUF): Likewise. + (MENU_BUFLEN): Likewise. + (fallback): Deleted. + (fallback_entry): Declared. + (default_entry): Likewise. + (BUILTIN_CMDLINE): New macro. + (BUILTIN_MENU): Likewise. + (BUILTIN_TITLE): Likewise. + (struct builtin): New tag. + (builtin_table): Declared. + (cmdline_t): Deleted. + (kernel_t): New type. + (kernel_type): Declared. + (grub_timeout): Likewise. + (init_builtins): Likewise. + (init_config): Likewise. + (find_command): Likewise. + (print_cmdline_message): Likewise. + (run_script): Likewise. + [!STAGE1_5] (bsd_boot): Deleted. + [!STAGE1_5] (load_image): Likewise. + [!STAGE1_5] (load_module): Likewise. + [!STAGE1_5] (load_initrd): Likewise. + * stage2/size_test: Set the maximum size of Stage 2 to 56320. + * stage2/stage2.c (grub_timeout): Deleted. + (menu_t): Likewise. + (run_menu): Changed the return type to void. + Use FALLBACK_ENTRY instead of FALLBACK. + Do not check the return value of enter_cmdline. + (run_menu) [GRUB_UTIL]: Call stop instead of returning + MENU_ABORT. + (cmain): Set MENU_ENTRIES to MENU_BUF. + Call init_config instead of clearing the variables directly. + Use CMDLINE_BUF for the command-line buffer instead of the + stack. + Adapted the analysis routine for the configuration file to the + new builtin commands interface. + Run enter_cmdline forever. + If run_menu returns, restart the loop. + +1999-09-04 Pavel Roskin + + * docs/menu.lst: More meaningful examples. Not using (0x80,0) + notation anymore. + * stage2/stage2.c (run_menu): Erase the entered password before + get_cmdline(). Help on TAB disabled when entering the password. + * stage2/char_io.c (get_cmdline): Restore command-line even if + there is no help string. + * configure.in: --disable-gunzip disables decompression in + stage2. + * stage2/gunzip.c [NO_DECOMPRESSION]: Disable all code if + decompression is disabled. + +1999-09-03 OKUJI Yoshinori + + * stage2/boot.c (load_image): Use PHDR->P_PADDR instead of + PHDR->P_VADDR. Reported by Ramon van Handel . + +1999-09-03 OKUJI Yoshinori + + * docs/help2man: Upgraded to 1.013. + * docs/grub.8: Regenerated. + +1999-09-02 Pavel Roskin + + * stage2/cmdline.c (enter_cmdline) [GRUB_UTIL]: Add a space in + the LBA warning message. + +1999-09-02 OKUJI Yoshinori + + The character `=' after a command is now optional. + + * stage2/char_io.c (get_cmdline): Search for a space or a equal + character after the first word in CMDLINE when TAB lists + completions, instead of just searching for a eqaul character. + * stage2/cmdline.c (skip_to): Treat the character `=' as a space + if AFTER_EQUAL is non-zero. + (commands): Delete all the equal characters. + * docs/menu.lst: Likewise. + * docs/grub.texi: Likewise. + +1999-09-01 OKUJI Yoshinori + + * grub/asmstub.c (env_for_exit): New variable. + (grub_stage2): Do a setjmp in doit, and when it returns + non-zero, set STATUS to 1 if ERRNUM is non-zero. + (stop): Call longjmp instead of exit. + +1999-08-31 Pavel Roskin + + * stage2/boot.c [GRUB_UTIL] (bsd_boot_entry): New function. + (bsd_boot) [GRUB_UTIL]: Set ENTRY_ADDR to BSD_BOOT_ENTRY to fake + the *BSD boot. + +1999-08-31 OKUJI Yoshinori + + * stage2/fsys_fat.c (fat_create_blocklist): Cast FAT_BUF to + unsigned short * instead of unsigned long *. Suggested by Pavel + Roskin. + +1999-08-30 OKUJI Yoshinori + + From Edward Killips : + * stage2/cmdline.c (commands): Added hide and unhide. + (enter_cmdline): Likewise. + * stage2/disk_io.c (unhide_partition): New function. + (hide_partition): Likewise. + * stage2/pc_slice.h (PC_SLICE_TYPE_HIDDEN_FLAG): New macro. + +1999-08-29 OKUJI Yoshinori + + From Pavel Roskin : + * stage2/fsys_minix.c (namelen): New variable. + (MINIX_NAME_LEN): Deleted. + (minix_mount): Set NAMELEN to 14 if SUPRTBLOCK->S_MAGIC is + MINIX_SUPER_MAGIC, and set NAMELEN to 30 if it is + MINIX_SUPER_MAGIC2. + (minix_dir): Use NAMELEN instead of MINIX_NAME_LEN. + +1999-08-29 Pavel Roskin + + * grub/Makefile.am, stage1/Makefile.am, stage2/Makefile.am: + Avoid using variables inclosed in '@' because they cannot be + overridden at the make time. + +1999-08-29 Pavel Roskin + + * stage2/fsys_fat.c (fat_create_blocklist): Return 1 for the + root directory on FAT12 and FAT16. + +1999-08-27 OKUJI Yoshinori + + * stage2/boot.c (load_image): Accept two arguments, KERNEL and + ARG. And use them instead of CUR_CMDLINE. + (load_module): Accept two arguments, MODULE and ARG. And use + them instead of CUR_CMDLINE. + (load_initrd): Accept one argument, INITRD. And use it instead + of CUR_CMDLINE. + (bsd_boot): Accept one additional argument, ARG. And use it + instead of CUR_CMDLINE. + * stage2/cmdline.c (enter_cmdline): Use MB_CMDLINE instead of + HEAP for the Multiboot command-line buffer. + * stage2/shared.h (MB_CMDLINE_BUF): New macro. + (MB_CMDLINE_BUFLEN): Likewise. + +1999-08-26 OKUJI Yoshinori + + * docs/Makefile.am [GRUB_MAINT] (grub.8): The argument for the + option --name is changed to "the grub shell". + * docs/grub.8: Regenerated. + * docs/grub.texi: Do not use the name "the Stage 2 emulator" any + more. Use the name "the grub shell" instead. + +1999-08-26 OKUJI Yoshinori + + From Klaus Reichl : + * stage2/fsys_minix.c: New file. + * stage2/size_test: Added a check for the size of minix_stage1_5. + * stage2/Makefile.am (libgrub_a_SOURCES): Added fsys_minix.c. + (libgrub_a_CFLAGS): Added -DFSYS_MINIX=1. + (nodist_pkgdata_DATA): Added minix_stage1_5. + (noinst_PROGRAMS): Added minix_stage1_5.exec. + (stage2_exec_SOURCES): Added fsys_minix.c. + (minix_stage1_5_exec_SOURCES): New variable. + (minix_stage1_5_exec_CFLAGS): Likewise. + (minix_stage1_5_exec_LDFLAGS): Likewise. + * stage2/pc_slice.h (PC_SLICE_TYPE_MINIX): New macro. + * stage2/disk_io.c (fsys_table) [FSYS_MINIX]: Added minix entry. + * stage2/filesys.h [FSYS_MINIX] (FSYS_MINIX_NUM): Set to 1. + [!FSYS_MINIX] (FSYS_MINIX_NUM): Set to 0. + [!NUM_FSYS] (NUM_FSYS): Added FSYS_MINIX_NUM. + * stage2/shared.h (STAGE2_ID_MINIX_STAGE1_5): New macro. + [STAGE1_5 && FSYS_MINIX] (STAGE2_ID): Set to + STAGE2_ID_MINIX_STAGE1_5. + * grub/Makefile.am (AM_CFLAGS): Added -DFSYS_MINIX=1. + * configure.in (--disable-minix): New option. + +1999-08-25 OKUJI Yoshinori + + From Jochen Hoenicke : + * stage2/fat.h (FAT_BPB_FAT_SECTORS_16): New macro. + (FAT_BPB_FAT_SECTORS_32): Likewise. + (FAT_BPB_IS_FAT32): Likewise. + (FAT_BPB_ROOT_DIR_CLUSTER): Likewise. + (FAT_BPB_FAT_SECTORS): If FAT_BPB_FAT_SECTORS_16 returns + a non-zero value, return it. Otherwise return + FAT_BPB_FAT_SECTORS_32. + (FAT_DIRENTRY_FIRST_CLUSTER): Corrected. + * stage2/fsys_fat.c (root_dir): New variable. + (fat_mount): Use the macro IS_PC_SLICE_TYPE_FAT instead of + checking for each fs types directly. + Omit the >64 sectors check. + If the current fs type is FAT32, then set FAT_SIZE to 8 and + get the root from BPB. + (fat_create_blocklist): Use the macro SECTOR_SIZE instead of a + magic number. + (fat_dir): Set MAP to ROOT_DIR instead of -1. + * stage2/pc_slice.h (PC_SLICE_TYPE_FAT32): New macro. + (PC_SLICE_TYPE_FAT32_LBA): Likewise. + (PC_SLICE_TYPE_FAT16_LBA): Likewise. + (IS_PC_SLICE_TYPE_FAT): Likewise. + +1999-08-25 OKUJI Yoshinori + + * stage2/fsys_ffs.c (ffs_mount): Do not shift the fs type + FS_BSDFFS. Reported by Takehiro Suzuki + . + * stage2/fsys_fat.c (fat_mount): Do not shift the fs type + FS_MSDOS. + +1999-08-13 OKUJI Yoshinori + + Pavel Roskin's patch that adds new options to disable arbitrary + filesystems is heavily modified and applied. + + * configure.in (--disable-ext2fs): New option. + (--disable-fat): Likewise. + (--disable-ffs): Likewise. + (FSYS_CFLAGS): New variable. Set to filesystems the user choose. + * grub/Makefile.am (AM_CFLAGS): Added -DFSYS_EXT2FS=1, + -DFSYS_FAT=1 and -DFSYS_FFS=1. + * stage2/Makefile.am (libgrub_a_CFLAGS): Likewise. + (stage2_exec_CFLAGS): Added @FSYS_CFLAGS@. + * stage2/filesys.h + [!(FSYS_FFS || FSYS_FAT || FSYS_EXT2FS)] (FSYS_FFS): Deleted. + [!(FSYS_FFS || FSYS_FAT || FSYS_EXT2FS)] (FSYS_FAT): Likewise. + [!(FSYS_FFS || FSYS_FAT || FSYS_EXT2FS)] (FSYS_EXT2FS): Likewise. + * stage2/fsys_ext2fs.c [!FSYS_EXT2FS]: Do not define anything. + * stage2/fsys_fat.c [!FSYS_FAT]: Likewise. + * stage2/fsys_ffs.c [!FSYS_FFS]: Likewise. + +1999-08-12 OKUJI Yoshinori + + * stage1/stage1_lba.S: Use STAGE1_DRP_ADDR for the address of + drive parameters instead of DRIVE_PARAMETER. + (drive_parameter): Deleted. + * stage1/stage1.h (STAGE1_DRP_ADDR): New macro. + (STAGE1_DRP_SIZE): Likewise. + +1999-08-11 OKUJI Yoshinori + + * stage2/bios.c (get_diskinfo): In LBA mode, set TOTAL_SECTORS + to the low 32bits of DRP.TOTAL_SECTORS instead of the multiple + of CHS. + * stage2/cmdline.c (enter_cmdline) [GRUB_UTIL]: In the command + "geometry", print the device file name instead of CHS/LBA + information. + * stage2/shared.h (device_map): Declared. + * grub/asmstub.c (device_map): Defined as a global variable + instead of a local variable. + +1999-08-10 OKUJI Yoshinori + + Support the NetBSD and OpenBSD partition slices. + + * stage2/pc_slice.h (PC_SLICE_TYPE_BSD): Deleted. + (PC_SLICE_TYPE_FREEBSD): New macro. + (PC_SLICE_TYPE_OPENBSD): Likewise. + (PC_SLICE_TYPE_NETBSD): Likewise. + (IS_PC_SLICE_TYPE_BSD_WITH_FS): Likewise. + (IS_PC_SLICE_TYPE_BSD): Likewise. + * stage2/fsys_ffs.c (ffs_mount): Use the macro + IS_PC_SLICE_TYPE_BSD_WITH_FS instead of checking if + CURRECT_SLICE is equal to the BSD partition type directly. + * stage2/fsys_ext2fs.c (ext2fs_mount): Likewise. + * stage2/fsys_fat.c (fat_mount): Likewise. + * stage2/disk_io.c (check_BSD_parts): Set the low bits of + CURRENT_SLICE to PC_SLICE_TYPE_FREEBSD instead of + PC_SLICE_TYPE_BSD. + (real_open_partition): Use the macro IS_PC_SLICE_TYPE_BSD instead + of checking if CURRENT_SLICE is equal to the BSD partition type + directly. + +1999-08-09 OKUJI Yoshinori + + * stage2/cmdline.c (commands): Added geometry. + (enter_cmdline): If CUR_HEAP has the string "geometry", print + out the information about a drive that the argument represents. + +1999-08-09 OKUJI Yoshinori + + * stage2/stage2.c (run_menu): Terminate the string PASSWORD + before checking if ENTERED is identical to PASSWORD. Reported + by Mark Lundeberg . + +1999-08-08 OKUJI Yoshinori + + * stage2/stage2.c (set_line_normal): New function. + (set_line_highlight): Likewise. + (run_menu): Do not call the function set_line directly any + longer, call set_line_normal and set_line_highlight instead. + + From Pavel Roskin: + * stage2/stage2.c (run_menu) [GRUB_UTIL]: Quit when pushing the + key `q'. + +1999-08-05 OKUJI Yoshinori + + * acinclude.m4 (grub_ASM_PREFIX_REQUIREMENT): New function. + * configure.in: Call grub_ASM_PREFIX_REQUIREMENT, and define + ADDR32 and DATA32 based on the result. + * stage2/asm.S: Replace addr32 and data32 prefixes with ADDR32 + and DATA32 respectively. + +1999-08-05 Pavel Roskin + + * stage2/boot.c (load_image): Use RAW_ADDR macro when loading + an a.out kernel. + +1999-08-04 OKUJI Yoshinori + + * stage2/asm.S: Make each of the addr32 and data32 prefixes + appear in the same line as it modifies, as the gas manual in + binutils-2.9.5.0.4 says "it must be in the same line". + +1999-08-04 OKUJI Yoshinori + + * boot.c (load_image): Fix a strcmp test. Reported by Pavel + Roskin . + +1999-08-03 OKUJI Yoshinori + + From "Dan J. Walters" : + * stage2/i386-elf.h (EI_BRAND): New macro. + * stage2/boot.c (load_image): If the kernel is ELF, check if it + is a FreeBSD kernel as well as a Multiboot kernel, and if it is + a FreeBSD kernel, then mask ENTRY_ADDR since FreeBSD requires + that. Likewise, mask MEMADDR. + (bsd_boot): Set the bi_symtab and the bi_esymtab members of BI + only if MBI.FLAGS has the flag MB_INFO_AOUT_SYMS. Otherwise, + clear them. + +1999-07-30 OKUJI Yoshinori + + From Pavel Roskin : + * grub/getopt.c: New file. Copied from texinfo-3.12n. + * grub/getopt1.c: Likewise. + * grub/getopt.h: Likewise. + * grub/Makefile.am (grub_SOURCES): Added getopt.c, getopt1.c and + getopt.h. + * configure.in: Check for string.h and strings.h. + * grub/asmstub.c (grub_stage2): Fix a misordering in the output + format of the inline assembly. + +1999-07-30 OKUJI Yoshinori + + From Pavel Roskin : + * stage2/asm.S (get_diskinfo_standard): If the number of sectors + returned is zero, then return an error code, even if non-carrier. + +1999-07-15 Gordon Matzigkeit + + * docs/Makefile.am (grub.info): Use an ugly hack to downgrade + grub.texi so that it works with Debian's version of texinfo. + +1999-07-26 OKUJI Yoshinori + + * stage2/bios.c (get_diskinfo): When DRIVE is a floppy drive, + try standard probe routine at first. Reported by Peter Astrand + . + + * grub/main.c (main): Call printf instead of grub_printf. + Reported by Klaus Reichl . + +1999-07-15 OKUJI Yoshinori + + * stage2/cmdline.c (skip_to): Don't increase CMDLINE if the + character to which CMDLINE points is NUL. + + * stage2/Makefile.am (EXTRA_DIST): Removed smp-imps.c. + (stage2_exec_SOURCES): Added smp-imps.c. + * stage2/cmdline.c [!GRUB_UTIL] (IMPS_DEBUG) (KERNEL_PRINT) + (CMOS_WRITE_BYTE) (CMOS_READ_BYTE) (PHYS_TO_VIRTUAL) + (VIRTUAL_TO_PHYS) (inb) (outb) (cmos_write_byte) + (cmos_read_byte): These are now defined in ... + * stage2/smp-imps.c (IMPS_DEBUG) (KERNEL_PRINT) + (CMOS_WRITE_BYTE) (CMOS_READ_BYTE) (PHYS_TO_VIRTUAL) + (VIRTUAL_TO_PHYS) (inb) (outb) (cmos_write_byte) + (cmos_read_byte): ... here. + * stage2/cmdline.c [!GRUB_UTIL]: Include apic.h and smp-imps.h. + +1999-07-14 OKUJI Yoshinori + + The function ungetch is simulated so that the user can use a + buggy curses. + + * grub/asmstub.c [HAVE_LIBCURSES] (save_char): New variable. + (getkey) [HAVE_LIBCURSES]: If SAVE_CHAR is not ERR, return + SAVE_CHAR and clear it. + (checkkey) [HAVE_LIBCURSES]: If SAVE_CHAR is not ERR, return + SAVE_CHAR. If C is not ERR, set SAVE_CHAR to C. + +1999-07-14 Pavel Roskin + + * stage2/char_io.c (get_cmdline) [GRUB_UTIL]: Recognize + backspace when ncurses fails to do this. + + * grub/asmstub.c (grub_stage2) [HAVE_LIBCURSES]: Call wtimeout + instead of nodelay. + (getkey) [HAVE_LIBCURSES]: Likewise. + +1999-07-14 OKUJI Yoshinori + + * stage1/stage1_lba.S (probe_values): New variable. This is not + used actually, but prevents `install' command from failing + bogusly. + +1999-07-14 OKUJI Yoshinori + + All constants in stage1s are moved to stage1.h and renamed + appropriately, and include stage1.h instead. + + * grub/Makefile.am (AM_CFLAGS): Added the include path to stage1. + * stage2/Makefile.am (INCLUDES): New variable. + * stage1/Makefile.am (stage1_exec_SOURCES): Added stage1.h + (stage1_lba_exec_SOURCES): Likewise. + * stage1/stage1.h: New file. + * stage1/stage1.S (SIGNATURE): Renamed to ... + * stage1/stage1.h (STAGE1_SIGNATURE): ... this. + * stage1/stage1.S (BPBEND): Renamed to ... + * stage1/stage1.h (STAGE1_BPBEND): ... this. + * stage1/stage1.S (PARTSTART): Renamed to ... + * stage1/stage1.h (STAGE1_PARTSTART): ... this. + * stage1/stage1.S (MINPARMSIZ): Renamed to ... + * stage1/stage1.h (STAGE1_MINPARMSIZE): ... this. + * stage1/stage1.S (LISTSIZ): Renamed to ... + * stage1/stage1.h (STAGE1_LISTSIZE): ... this. + * stage1/stage1.S (REALSTACK): Renamed to ... + * stage1/stage1.h (STAGE1_STACKSEG): ... this. + * stage1/stage1.S (BUFFERSEG): Renamed to ... + * stage1/stage1.h (STAGE1_BUFFERSEG): ... this. + * stage1/stage1.S (BIOS_HD_FLAG): Renamed to ... + * stage1/stage1.h (STAGE1_BIOS_HD_FLAG): ... this. + * stage1/stage1_lba.S (SIGNATURE): Removed. + * stage1/stage1_lba.S (BPBEND): Likewise. + * stage1/stage1_lba.S (PARTSTART): Likewise. + * stage1/stage1_lba.S (MINPARMSIZ): Likewise. + * stage1/stage1_lba.S (LISTSIZ): Likewise. + * stage1/stage1_lba.S (REALSTACK): Likewise. + * stage1/stage1_lba.S (BUFFERSEG): Likewise. + * stage1/stage1_lba.S (BIOS_HD_FLAG): Likewise. + + * stage1/stage1.S (stage1_id): New variable. + * stage1/stage1_lba.S (stage1_id): Likewise. + * stage1/stage1.h (COMPAT_VERSION_MINOR): Set to 2. + (STAGE1_ID_OFFSET): New macro. + (STAGE1_ID_CHS): Likewise. + (STAGE1_ID_LBA): Likewise. + * stage2/cmdline.c (enter_cmdline) [!GRUB_UTIL]: When running + the command `install' and STAGE1_FILE is stage1_lba, check if + LBA is supported. + (enter_cmdline) [GRUB_UTIL]: In the same case above, check only + if CURRENT_DRIVE is a hard disk and, if so, print a warning + message, because /sbin/grub cannot detect if LBA is supported or + not. + + * stage1/stage1_lba.S: Fix a bug that incorrectly assigns the + segment of buffer address. + +1999-07-13 OKUJI Yoshinori + + * stage2/boot.c (load_image): When removing "vga=...", memmove + the length of VGA_END plus one. + +1999-07-12 OKUJI Yoshinori + + * stage2/bios.c (get_diskinfo): In LBA mode, compute + TOTAL_SECTORS from DRP instead of GEOMETRY. + Clear GEOMETRY->FLAGS first. + + * stage2/boot.c (load_image): Fix inverted lines. + +1999-07-12 OKUJI Yoshinori + + Support Linux video mode selection. + + * stage2/shared.h (LINUX_VID_MODE_OFFSET): New macro. + (LINUX_VID_MODE_NORMAL): Likewise. + (LINUX_VID_MODE_EXTENDED): Likewise. + (LINUX_VID_MODE_ASK): Likewise. + [!WITHOUT_LIBC_STUBS] (strlen): Likewise. + (grub_strlen): Declared. + * stage2/boot.c (load_image): Added Linux video mode selection. + * stage2/char_io.c [!STAGE1_5] (grub_strlen): New function. + +1999-07-12 OKUJI Yoshinori + + * stage2/char_io.c (print_error): Print ERRNUM in the format of + %u instead of %d. + (convert_to_ascii) [STAGE1_5]: Eliminate the `x' and `d' + handling code. + (grub_printf): Declare FORMAT as `const char *'. + (grub_printf) [STAGE1_5]: Eliminate the `x' and `d' handling + code. + (get_based_digit): Removed. + (safe_parse_maxint): Remove unnecessary `register' prefixes, + because GCC does better optimization. + Declare DIGIT as `unsigned int' and calculate the value by more + compact instructions. + [!STAGE1_5] (grub_strncat): Declare S2 as `const char *'. + [!STAGE1_5] (grub_strcmp): Declare S1 and S2 as `const char *'. + [!STAGE1_5] (grub_strstr): Likewise. + (grub_memmove): Declare FROM as `const char *'. + The copy code is replaced with inline assembly code stolen from + Linux-2.2.2. + + * stage2/shared.h (grub_printf) : Corrected. + (grub_strncat): Likewise. + (grub_memmove): Likewise. + (grub_strstr): Likewise. + (grub_strcmp): Likewise. + +1999-07-11 OKUJI Yoshinori + + * stage1/stage1.S (sectors): Change the size to long. + (heads): Likewise. + (sector_start): New variable. + (head_start): Likewise. + (cylinder_start): Likewise. + (final_init): Set %si to SECTORS first, and use %si for memory + references. + Zero %eax so that the high 16 bits are always zero. + Set %di to FIRSTLIST - LISTSIZ instead of FIRSTLIST. + (bootloop): Omit the complex CHS recomputation, and always + compute them from LBA address instead. + Call 32bits div instructions instead of 16bits div instructions. + Update the position where to load data from at the end of this + loop, instead of the beginning. + + * stage1/stage1_lba.S: New file. + * stage1/Makefile.am (nodist_pkgdata_DATA): Added stage1_lba. + (LDFLAGS): New variable. + (noinst_PROGRAMS): Added stage1_lba.exec. + (stage1_lba_exec_SOURCES): New variable. + (%: %.exec): New rule. + +1999-06-28 OKUJI Yoshinori + + * grub/main.c (main): The third argument for strtoul is changed + to 0 in the case where an option is OPT_INSTALL_PARTIION. + Reported by Pavel Roskin . + +1999-06-27 OKUJI Yoshinori + + * stage2/shared.h (STAGE2_STAGE2_ID): New macro. + (STAGE2_VER_STR_OFFS): Set to 0xd. + (STAGE2_ID_STAGE2): New macro. + (STAGE2_ID_FFS_STAGE1_5): Likewise. + (STAGE2_ID_E2FS_STAGE1_5): Likewise. + (STAGE2_ID_FAT_STAGE1_5): Likewise. + (STAGE2_ID) [!STAGE1_5]: Defined as STAGE2_ID_STAGE2. + (STAGE2_ID) [STAGE1_5] [FSYS_FFS]: Defined as + STAGE2_ID_FFS_STAGE1_5. + (STAGE2_ID) [STAGE1_5] [FSYS_EXT2FS]: Defined as + STAGE2_ID_STAGE1_5. + (STAGE2_ID) [STAGE1_5] [FSYS_FAT]: Defined as + STAGE2_ID_FAT_STAGE1_5. + (COMPAT_VERSION_MINOR): Set to 1. + * stage2/asm.S (stage2_id): New variable. + * stage1/stage1.S: Change the minor version to 1. + +1999-06-27 OKUJI Yoshinori + + * configure.in (CFLAGS): Set to "-g", since only this flag is + always sharable. + (STAGE1_CFLAGS): Set to "-O2", and AC_SUBST this. + (GRUB_CFLAGS): Likewise. + (saved_CFLAGS): New variable for temporarily saving CFLAGS. + (STAGE2_CFLAGS): Set to "-Os" if this option is available, + otherwise set to "-fno-strength-reduce -fno-unroll-loops", + and then AC_SUBST this. + * grub/Makefile.am (AM_CFLAGS): Prepended @GRUB_CFLAGS@. + * stage1/Makefile.am (AM_CFLAGS): Prepended @STAGE1_CFLAGS@. + * stage2/Makefile.am (libgrub_a_CFLAGS): Prepened @GRUB_CFLAGS@. + (STAGE2_COMPILE): Prepended @STAGE2_CFLAGS@. + + * stage2/asm.S (chain_stage2): Pass CURRENT_PARTITION and + CURRENT_DRIVE, instead of INSTALL_PARTITION and BOOT_DRIVE. + +1999-06-27 Pavel Roskin + + * configure.in: set CFLAGS to "-Os -g" for compilers which + understand "-Os" if CFLAGS is not already set. Use + "-O2 -fno-strength-reduce -fno-unroll-loops -g" for older gcc + versions. + +1999-06-25 OKUJI Yoshinori + + * stage2/disk_io.c (attempt_mount) [STAGE1_5]: Set FSYS_TYPE to + 0, and set it to NUM_FSYS if mount fails. + (real_open_partition): Call rawread in Stage 1.5 as well. + +1999-06-24 OKUJI Yoshinori + + * Makefile.am (SUBDIRS): Change the order of the directories so + that a directory will be made after the dependent directories + are made. `grub' depends on `stage2', and `docs' depends on + `grub'. Do not make in parallel. + * docs/help2man: Copied from help2man-1.012, which contains my + previous change. + * docs/grub.8: Regenerated. + +1999-06-24 OKUJI Yoshinori + + Build process is cleaned up. Stage 2 and Stage 1.5's are all + built in the directory stage2. + + From Pavel Roskin : + * Makefile.am (SUBDIRS): e2fs_stage1_5, ffs_stage1_5, + fat_stage1_5 and shared_src are removed. + (DISTCLEANFILES): Deleted. + * configure.in: Call AC_PROG_RANLIB. + (AC_INIT): Change the argument to stage2/stage2.c. + (LIBS): Renamed to ... + (GRUB_LIBS): ... this, and call AC_SUBST for this. + Our own rules are removed. + (AC_OUTPUT): e2fs_stage1_5/Makefile, ffs_stage1_5/Makefile, + fat_stage1_5/Makefile and shared_src/Makefile are removed. + * docs/Makefile.am (HELP2MAN): The prefix $(srcdir) is removed. + [GRUB_MAINT]: Prepend $(srcdir) to $(HELP2MAN). + * e2fs_stage1_5/Makefile.am: Deleted. + * e2fs_stage1_5/Makefile.in: Likewise. + * fat_stage1_5/Makefile.am: Likewise. + * fat_stage1_5/Makefile.in: Likewise. + * ffs_stage1_5/Makefile.am: Likewise. + * ffs_stage1_5/Makefile.in: Likewise. + * grub/Makefile.am (CLEANFILES): Likewise. + (COMPILE): Likewise. + (INCLUDES): Likewise. + (DEP_FILES): Likewise. + (@SHARED_SRC_RULES@): Likewise. + (AM_CFLAGS): New variable. + (grub_LDADD): Set to the library libgrub.a and @GRUB_LIBS@. + * shared_src/Makefile.am: Deleted. + * shared_src/Makefile.in: Likewise. + * shared_src/apic.h: Moved to ... + * stage2/apic.h: ... here. + * shared_src/asm.S: Moved to ... + * stage2/asm.S: ... here. + * shared_src/bios.c: Moved to ... + * stage2/bios.c: ... here. + * shared_src/boot.c: Moved to ... + * stage2/boot.c: ... here. + * shared_src/char_io.c: Moved to ... + * stage2/char_io.c: ... here. + * shared_src/cmdline.c: Moved to ... + * stage2/cmdline.c: ... here. + * shared_src/common.c: Moved to ... + * stage2/common.c: ... here. + * shared_src/defs.h: Moved to ... + * stage2/defs.h: ... here. + * shared_src/dir.h: Moved to ... + * stage2/dir.h: ... here. + * shared_src/disk_inode.h: Moved to ... + * stage2/disk_inode.h: ... here. + * shared_src/disk_inode_ffs.h: Moved to ... + * stage2/disk_inode_ffs.h: ... here. + * shared_src/disk_io.c: Moved to ... + * stage2/disk_io.c: ... here. + * shared_src/fat.h: Moved to ... + * stage2/fat.h: ... here. + * shared_src/filesys.h: Moved to ... + * stage2/filesys.h: ... here. + * shared_src/freebsd.h: Moved to ... + * stage2/freebsd.h: ... here. + * shared_src/fs.h: Moved to ... + * stage2/fs.h: ... here. + * shared_src/fsys_ext2fs.c: Moved to ... + * stage2/fsys_ext2fs.c: ... here. + * shared_src/fsys_fat.c: Moved to ... + * stage2/fsys_fat.c: ... here. + * shared_src/fsys_ffs.c: Moved to ... + * stage2/fsys_ffs.c: ... here. + * shared_src/gunzip.c: Moved to ... + * stage2/gunzip.c: ... here. + * shared_src/i386-elf.h: Moved to ... + * stage2/i386-elf.h: ... here. + * shared_src/imgact_aout.h: Moved to ... + * stage2/imgact_aout.h: ... here. + * shared_src/mb_header.h: Moved to ... + * stage2/mb_header.h: ... here. + * shared_src/mb_info.h: Moved to ... + * stage2/mb_info.h: ... here. + * shared_src/pc_slice.h: Moved to ... + * stage2/pc_slice.h: ... here. + * shared_src/shared.h: Moved to ... + * stage2/shared.h: ... here. + * shared_src/smp-imps.c: Moved to ... + * stage2/smp-imps.c: ... here. + * shared_src/smp-imps.h: Moved to ... + * stage2/smp-imps.h: ... here. + * shared_src/stage1_5.c: Moved to ... + * stage2/stage1_5.c: ... here. + * shared_src/stage2.c: Moved to ... + * stage2/stage2.c: ... here. + * stage1/Makefile.am (pkgdata_DATA): Renamed to ... + (nodist_pkgdata_DATA): ... this. + (COMPILE): Deleted. + (AM_CFLAGS): New variable. + * stage2/Makefile.am: Completely rewritten from scratch. + (TESTS): New variable. + (noinst_SCRIPTS): Likewise. + (noinst_HEADERS): Likewise. + (EXTRA_DIST): Set to smp-imps.c and $(noinst_SCRIPTS). + (noinst_LIBRARIES): New variable. + (libgrub_a_SOURCES): Likewise. + (libgrub_a_CFLAGS): Likewise. + (pkgdata_DATA): Deleted. + (nodist_pkgdata_DATA): New variable. + (MOSTLYCLEANFILES): Set to $(noinst_PROGRAMS). + (COMPILE): Deleted. + (INCLUDES): Likewise. + (stage2_exec_LDADD): Likewise. + (DEP_FILES): Likewise. + (stage2_exec_SOURCES): Set to the actual source files instead of + dummy. + (DISTFILES): Deleted. + (stage2.exec): Likewise. + (stage2): Likewise. + (@SHARED_SRC_RULES@): Likewise. + (noinst_PROGRAMS): Set to executable formats of Stage 2 and + Stage 1.5's. + (STAGE2_LINK): New variable. + (STAGE2_COMPILE): Likewise. + (STAGE1_5_LINK): Likewise. + (STAGE1_5_COMPILE): Likewise. + (stage2_exec_CFLAGS): Likewise. + (stage2_exec_LDFLAGS): Likewise. + (e2fs_stage1_5_exec_SOURCES): Likewise. + (e2fs_stage1_5_exec_CFLAGS): Likewise. + (e2fs_stage1_5_exec_LDFLAGS): Likewise. + (fat_stage1_5_exec_SOURCES): Likewise. + (fat_stage1_5_exec_CFLAGS): Likewise. + (fat_stage1_5_exec_LDFLAGS): Likewise. + (ffs_stage1_5_exec_SOURCES): Likewise. + (ffs_stage1_5_exec_CFLAGS): Likewise. + (ffs_stage1_5_exec_LDFLAGS): Likewise. + (% : %.exec): New rule. + + * stage2/size_test: New file, for checking for the sizes of + Stage 2 and Stage 1.5's. + +1999-06-24 OKUJI Yoshinori + + * stage1/stage1.S: Call testb instead of andb when checking if + the drive is a floppy. + +1999-06-23 OKUJI Yoshinori + + * grub/asmstub.c [__linux__]: Include linux/fs.h for BLKFLSBUF. + (grub_stage2): Call sync before and after calling doit. + (gurb_stage2) [__linux__]: Invalidate buffer caches by BLKFLSBUF + ioctl. + * grub/main.c (main): Call sync first. Suggested by Pavel Roskin + . + + * configure.in: Curses libraries are always checked. + (--enable-sbin-grub): Deleted. Now /sbin/grub is always built. + (--enable-maintainer-mode): New option. + * grub/Makefile.am (EXTRA_PROGRAMS): Deleted. + (sbin_PROGRAMS): Just set to grub. + * docs/Makefile.am (man_MANS): New variable. + (HELP2MAN): Likewise. + (noinst_SCRIPTS): Likewise. + (EXTRA_DIST): Add $(man_MANS) and $(noinst_SCRIPTS). + [GRUB_MAINT]: Define the rule for the /sbin/grub manual. + * docs/help2man: Copied from texinfo-3.12i. + (--section): New option to specify which section a manual + belongs to. + (opt_section): New variable. + (section): Likewise. + * docs/grub.8: Produced by help2man automatically. + +1999-06-22 OKUJI Yoshinori + + * shared_src/char_io.c (get_cmdline): Add two missing `break's. + + * shared_src/cmdline.c (commands): Add quit. + (enter_cmdline): Change the return type to cmdline_t, and return + CMDLINE_OK if successful, otherwise CMDLINE_ERROR if fail. + (enter_cmdline) [GRUB_UTIL]: Return CMDLINE_ABORT if CUR_HEAP + contains "quit". + [!GRUB_UTIL]: Just print an annotation message. + * shared_src/shared.h (cmdline_t): New enum type. + (enter_cmdline): Change the return type to cmdline_t. + (cmain): Remove ``noreturn'' attribute. + * shared_src/stage2.c (menu_t): New enum type. + (run_menu): Change the return type to menu_t. + If enter_cmdline returns CMDLINE_ABORT, then return MENU_ABORT, + otherwise return MENU_OK. + (cmain): If enter_cmdline aborts, then break the command-line + loop and return. If run_menu aborts, then return. + +1999-06-22 OKUJI Yoshinori + + * shared_src/Makefile.am (EXTRA_DIST): Add bios.c. Reported by + Pavel Roskin . + +1999-06-21 OKUJI Yoshinori + + * docs/Makefile.am (html): Deleted. + (txt): Likewise. + (EXTRA_DIST): $(txt) and $(html) are removed. + * docs/boot-proposal.html: Removed. + * docs/errors.html: Likewise. + * docs/faq.html: Likewise. + * docs/grub.html: Likewise. + * docs/install.html: Likewise. + * docs/mem64mb.html: Likewise. + * docs/technical.html: Likewise. + * docs/using.html: Likewise. + * docs/PC_partitioning.txt: Likewise. + * docs/bios_mapping.txt: Likewise. + * docs/commands.txt: Likewise. + * docs/embedded_data.txt: Likewise. + * docs/filesystem.txt: Likewise. + +1999-06-21 OKUJI Yoshinori + + From Alexander K. Hudek : + * shared_src/disk_io.c (real_open_partition): Check if + CURRENT_SLICE is equal to PC_SLICE_TYPE_WIN95_EXTENDED as well. + * shared_src/pc_slice.c (PC_SLICE_TYPE_WIN95_EXTENDED): New + macro. + * shared_src/bios.c (biosdisk): Clear the reserved member of DAP. + +1999-06-08 OKUJI Yoshinori + + Color-menu support based on Peter Astrand + 's patch. + + * shared_src/asm.S (nocursor): New function. + * shared_src/cmdline.c (normal_color): New variable. + (highlight_color): Likewise. + (commands): Added "color" command. + (enter_cmdline): Handle the color command. + * shared_src/shared.h (normal_color): Declared. + (highlight_color): Likewise. + [!GRUB_UTIL] (nocursor): Likewise. + * shared_src/stage2.c (print_border) [!GRUB_UTIL]: Color the + menu. + (run_menu) [!GRUB_UTIL]: Call nocursor, and call set_line with + the second argument HIGHLIGHT_COLOR when highlighting a line, + and NORMAL_COLOR when drawing a normal line. + (cmain): Initialize normal_color and highlight_color. Handle + the color command in the same way as the command-line + interface. + +1999-06-07 OKUJI Yoshinori + + * e2fs_stage1_5/Makefile.am (IMPORTANT_SIZE_LIMIT): Set to 31744. + * fat_stage1_5/Makefile.am (IMPORTANT_SIZE_LIMIT): Likewise. + +1999-06-06 OKUJI Yoshinori + + The debug version of Stage 2 is removed. + + * shared_src/cmdline.c: The imps code is now defined if GRUB_UTIL + is not defined, but not if DEBUG. + (debug): New global variable. + (commands): All commands are always enabled, and added "debug". + (debug_fs_print_func): Defined unconditionally. + (debug_fs_blocklist_func): If DEBUG is true, then call printf. + (enter_cmdline): Handle "testload", "read", "fstest", + "impsprobe" and "displaymem" unconditionally, and added "debug" + handling. + [GRUB_UTIL]: If a command is impsprobe, just fails. + * shared_src/disk_io.c (devread) [!STAGE1_5]: If DEBUG_FS and + DEBUG are true, then call printf. + * shared_src/asm.S (patch_code): Defined unconditionally. + (patch_code_end): Likewise. + * stage1/stage1.S (firstlist) [!FFS_STAGE1_5]: Increase the + number of sectors to 90, because Stage 2 is larger than 80 + sectors. + * configure.in: The option --enable-debug is removed, and do + not output "stage2_debug/Makefile". + * Makefile.am (SUBDIRS): stage2_debug is removed. + * stage2_debug/Makefile.am: Deleted. + * stage2_debug/Makefile.in: Likewise. + +1999-06-02 OKUJI Yoshinori + + * grub/main.c (verbose): New variable. + (read_only): Likewise. + (OPT_VERBOSE): New macro. + (OPT_READ_ONLY): Likewise. + (longopts): Add --read-only and --verbose options. + (usage): Add the descriptions about --read-only and --verbose. + (main): Handle OPT_VERBOSE and OPT_READ_ONLY. + If HOLD and VERBOSE are non-zero, then display the message + about how to restart /sbin/grub. + + * shared_src/shared.h (verbose) [GRUB_UTIL]: Declared. + (read_only) [GRUB_UTIL]: Likewise. + + * grub/asmstub.c (hex_dump): New function. + (biosdisk): In the case where SUBFUNC is + BIOSDISK_WRITE, check for READ_ONLY and call nwrite if + READ_ONLY is zero. If VERBOSE is non-zero, display what GRUB + will try to do. + (get_diskinfo): Open DEVNAME with the mode O_RDWR if READ_ONLY + is zero, and attempt to open DEVNAME with the mode O_RDONLY + regardless of ERRNO if READ_ONLY is non-zero. If VERBOSE is + non-zero, then display the drive DRIVE and the file DEVNAME. + + * shared_src/disk_io.c (set_device) [STAGE1_5]: Eliminate + completion code. + +1999-06-01 OKUJI Yoshinori + + * grub/asmstub.c: Do not use I_AM_VERY_BRAVE any more. + (grub_stage2): Delete first_scsi_disk and add a variable + num_hd, which is used for counting how many drives are + detected. + Initialize the flags member of each element of disks to -1 + instead of 0, and check if it is equal to -1 instead of 0 when + close it. + (get_diskinfo): Treat -1 as non-caching state instead of 0. + +1999-06-01 OKUJI Yoshinori + + Reported from Klaus Reichl : + * docs/.cvsignore: New file. + * shared_src/disk_io.c (print_a_completion): New function + which saves what has been printed to UNIQUE_STRING and printf + it. + (unique) [!STAGE1_5]: New variable. + (unique_string): Likewise. + (print_completions): Use print_a_completion, and improve the + completion facility. + * shared_src/fsys_ext2fs.c (ext2fs_dir) [!STAGE1_5]: Use + print_a_completion instead of just printf. + * shared_src/fsys_ffs.c (ffs_dir) [!STAGE1_5]: Likewise. + * shared_src/fsys_fat.c (fat_dir) [!STAGE1_5]: Likewise. + * shared_src/shared.h (print_a_completion): Declared. + * shared_src/cmdline.c (enter_cmdline): Explicitly cast + int to pointer to char for grub_read. + * grub/asmstub.c (grub_stage2) [__linux__]: Don't use /dev/fd1. + Probe 4 IDE drives instead of 2. + (biosdisk) [__linux__]: Add a prototype for _llseek. + * shared_src/char_io.c (get_cmdline): Update LPOS and LLEN_OLD + when the functon print_completion modifies CMDLINE. + * shared_src/stage2.c (get_line_from_config): Fix LITERAL + handling. + +1999-05-25 OKUJI Yoshinori + + * grub/asmstub.c (grub_stage2): Fix a memory leak that FP is + not closed. + +1999-05-25 OKUJI Yoshinori + + * grub/main.c: Replace OPT_DISABLE_CONFIG_FILE and + OPT_DISABLE_CURSES with OPT_NO_CONFIG_FILE and OPT_NO_CURSES + respectively. + (longopts): Rename from "disable-config-file" to + "no-config-file", and from "disable-curses" to "no-curses". + (usage): Use "grub" instead of ARGV[0], read the standards. + Change the help message according to the changes above. + (main): Handle OPT_NO_CONFIG_FILE and OPT_NO_CURSES, instead + of OPT_DISABLE_CONFIG_FILE and OPT_DISABLE_CURSES. + +1999-05-21 OKUJI Yoshinori + + * docs/TODO: Moved to ... + * TODO: ... here. + * docs/BUGS: Moved to ... + * BUGS: ... here. + * docs/COPYING: Removed. + * docs/Makefile.am (EXTRA_DIST): Get rid of BUGS. + * Makefile.am (EXTRA_DIST): Set to BUGS. + +1999-05-17 OKUJI Yoshinori + + * acinclude.m4 (grub_ASM_EXT_C): Do not overrun the command + shift. Reported by Pavel Roskin . + +1999-05-14 OKUJI Yoshinori + + * docs/Makefile.am (info_TEXINFOS): Added multiboot.texi. + * docs/multiboot.texi: New file. From Kunihiro Ishiguro. + +1999-05-12 OKUJI Yoshinori + + * grub/asmstub.c: Include . Reported by Kunihiro + Ishiguro . + +1999-05-11 OKUJI Yoshinori + + Reported by Brian Brunswick : + * shared_src/asm.S (start) [STAGE1_5]: Jump to 0x0:0x2000. + * shared_src/cmdline.c (enter_cmdline): Doesn't check for the jump + address in stage2. We are not paranoid. + Add a missing RAW_ADDR macro. + * shared_src/diskio.c (grub_open): Call setup_part even in stage1.5. + And, include necessary functions that were eliminated incorrectly. + * shared_src/char_io.c [STAGE1_5]: Eliminate unnecessary functions + for stage1.5. + + * grub/asmstub.c (nread): New function. Handle EINTR. + (nwrite): Likewise. + (biosdisk) [I_AM_VERY_BRAVE]: When SUBFUNC is BIOSDISK_WRITE, call + nwrite. + + Reported by Pavel Roskin : + * shared_src/fsys_ext2fs.c (off_t): Renamed to ... + (linux_off_t): ... this. + * shared_src/defs.h (off_t): Renamed to ... + (mach_off_t): ... this. + * shared_src/fs.h (BBOFF): Use mach_off_t instead of off_t. + (SBOFF): Likewise. + + * e2fs_stage1_5/Makefile.am (IMPORTANT_SIZE_LIMIT): Set to 81920. + * fat_stage1_5/Makefile.am (IMPORTANT_SIZE_LIMIT): Likewise. + * ffs_stage1_5/Makefile.am (IMPORTANT_SIZE_LIMIT): Set to 7168. + +1999-05-03 Gordon Matzigkeit + + From Pavel Roskin: + * shared_src/shared.h: Redeclare. + + * grub/main.c (main): Use strncpy rather than pointer assignment + to set the config file name. + + * grub/asmstub.c: Make config_file a static array, not a pointer. + Correct the value of VERSION_STRING. + +1999-04-10 Gordon Matzigkeit + + * debian/rules (build): Install into /lib instead of /share. + +1999-05-03 OKUJI Yoshinori + + Preliminary non-interactive use support. + + * grub/main.c (use_config_file): New variable. + (use_curses): Likewise. + (OPT_DISABLE_CONFIG_FILE): New constant. + (OPT_DISABLE_CURSES): Likewise. + (OPT_BATCH): Likewise. + (longopts): Add new options, --disable-config-file, --disable-curses, + and --batch. + (usage): Print the help messages about these new options. + (main): Handle them. + + * grub/asmstub.c (grub_stage2) [HAVE_LIBCURSES]: If ! USE_CURSES, + fallback non-curses code. + (stop) [HAVE_LIBCURSES]: Likewise. + (cls) [HAVE_LIBCURSES]: Likewise. + (getxy) [HAVE_LIBCURSES]: Likewise. + (gotoxy) [HAVE_LIBCURSES]: Likewise. + (grub_putchar) [HAVE_LIBCURSES]: Likewise. + (getkey) [HAVE_LIBCURSES]: Likewise. + (checkkey) [HAVE_LIBCURSES]: Likewise. + (set_attrib) [HAVE_LIBCURSES]: Likewise. + + * shared_src/cmdline.c (enter_cmdline): Do not use getc, but use + getkey. + + * shared_src/stage2.c (cmain) [GRUB_UTIL]: Check if USE_CONFIG_FILE + is non-zero or not. + + * shared_src/shared.h (getc): Removed. + (use_config_file) [GRUB_UTIL]: Add the declaration. + (use_curses) [GRUB_UTIL]: Likewise. + +1999-05-02 OKUJI Yoshinori + + * shared_src/asm.S (biosdisk_standard): Pop %ebp correctly, reported + by Pavel Roskin . + +1999-04-25 OKUJI Yoshinori + + * docs/menu.lst: Rewritten, so that it contains up-to-date + information and FAQish configuration examples. + +1999-04-09 OKUJI Yoshinori + + * shared_src/asm.S (get_diskinfo_floppy): Correct the number of heads + and the one of cylinders. + +1999-04-06 OKUJI Yoshinori + + * grub/asmstub.c (get_diskinfo): Compute the total number of sectors + for DRIVE. + + * shared_src/asm.S (get_diskinfo_standard): Clear the data segment + after calling int 0x13. Restore the base pointer after returning + to protected mode. + (get_diskinfo_floppy): Likewise. + + * shared_src/bios.c (get_diskinfo): Always set the size of DRP to + the max size of DRP, regardless of the major version of extensions. + +1999-04-03 OKUJI Yoshinori + + * shared_src/shared.h (struct geometry): Declare total_sectors as + unsigned long instead of unsigned long long, because GRUB represents + a sector number by 4bytes integer, so it doesn't make sense. + + * shared_src/bios.c (biosdisk) [!NO_INT13_FALLBACK]: Recompute + TOTAL_SECTORS according to CHS information. + (get_diskinfo) [DEBUG]: Print the geometry of DRIVE. + + * shared_src/disk_io.c (real_open_partition): Set PART_LENGTH to + BUF_GEOM.TOTAL_SECTORS. + +1999-04-01 OKUJI Yoshinori + + * docs/texinfo.tex: Copied from automake-1.4a. + + * configure.in (SHARED_SRC_RULES): Add bios into shared sources. + + * e2fs_stage1_5/Makefile.am (e2fs_stage1_5_exec_LDADD): Added bios.o. + * fat_stage1_5/Makefile.am (fat_stage1_5_exec_LDADD): Likewise. + * ffs_stage1_5/Makefile.am (ffs_stage1_5_exec_LDADD): Likewise. + * stage2/Makefile.am (stage2_exec_LDADD): Likewise. + * stage2_debug/Makefile.am (stage2_debug_exec_LDADD): Likewise. + + * shared_src/Makefile.am (EXTRA_DIST): Added bios.c. + + * shared_src/asm.S (biosdisk): Deleted. Now defined in bios.c. + (get_diskinfo): Likewise. + (biosdisk_int13_extensions): New function. + (biosdisk_standard): Likewise. + (check_int13_extensions): Likewise. + (get_diskinfo_int13_extensions): Likewise. + (get_diskinfo_standard): Likewise. + (get_diskinfo_floppy): Likewise. + + * shared_src/bios.c: New file. + + * shared_src/shared.h (struct geometry): Added new member, + total_sectors. + +1999-03-28 OKUJI Yoshinori + + * shared_src/stage2.c (print_entries): Correctly assign MENU_ENTRIES + the entries starting from FIRST. + +1999-03-27 Gordon Matzigkeit + + * Change everything to use memset and memmove instead of bzero and + bcopy. GNB's Not BSD. + + * shared_src/shared.h (grub_memset): Adapted from grub_bzero. + (grub_memmove): Adapted from grub_bcopy. + + * grub/asmstub.c (checkkey): Fix unterminated comment. + + * shared_src/char_io.c (grub_printf): Renamed from printf. + (grub_tolower): Renamed from tolower. + (grub_isspace): Renamed from isspace. + (grub_strncat): Renamed from strncat. + (grub_strstr): Renamed from strstr. + (grub_bcopy): Renamed from bcopy. + (grub_bzero): Renamed from bzero. + + From Bradford Hovinen: + * shared_src/char_io.c (get_cmdline): Add new argument to hide + password entry. + (grub_strcmp): New function. + * shared_src/shared.h (get_cmdline): Fix declaration. + (grub_strcmp): Declare. + * shared_src/stage2.c (run_menu): Use get_cmdline with an + ECHO_CHAR of `*'. This protects against both brute-force and + sidelong-glance password cracking attempts. + + * grub/main.c (usage): Display defaults for stage2 options. + + * grub/asmstub.c [WITHOUT_LIBC_STUBS]: Renamed from + NO_REMAPPING_LIBC_FUNCTIONS. + * grub/main.c: Likewise. + * shared_src/shared.h: Likewise. + +1999-03-27 OKUJI Yoshinori + + * grub/asmstub.c (set_attrib): Use inch and addch, instead of + chgat, because chgat doesn't work as expected. + +1999-03-26 OKUJI Yoshinori + + * grub/asmstub.c (grub_stage2) [HAVE_LIBCURSES]: Call nodelay. + (checkkey) [HAVE_LIBCURSES]: If getting an input character, then + ungetch it, because checkkey shouldn't modify the input queue. + + Use file descriptors instead of file pointers to support + >4GB disks in Linux. + + * grub/asmstub.c (grub_stage2): Call close instead of fclose. + (get_diskinfo): Call open instead of fopen. + (biosdisk) [__linux__]: Use _llseek instead of lseek. + (biosdisk): Call read instead of fread. + + Add options so that the user can specify the config file. + + * grub/Makefile.am (CPPFLAGS): Use -fwritable-strings, because + grub assumes that all strings resides at the data section. + + * grub/main.c: Define NO_REMAPPING_LIBC_FUNCTIONS before including + shared.h. + (OPT_CONFIG_FILE): New macro. + (OPT_INSTALL_PARTITION): Likewise. + (OPT_BOOT_DRIVE): Likewise. + (longopts): Add new options, config-file, install-partition and + boot-drive. + (usage): Add the documentation for them. + (main): Add handling code for OPT_CONFIG_FILE, OPT_INSTALL_PARTITION + and OPT_BOOT_DRIVE. + + * grub/asmstub.c: Define NO_REMAPPING_LIBC_FUNCTIONS before including + shared.h. + (config_file): Make it char * instead of char []. + (getrtsecs): Return current time instead of 0xff. + + * shared_src/shared.h [NO_REMAPPING_LIBC_FUNCTIONS]: Don't define + libc-API-compatible function names. + (config_file): Change the prototype from char [] to char *. + (grub_putchar): Renamed from putchar. + +1999-03-25 OKUJI Yoshinori + + * char_io.c (get_cmdline): Call cl_setcpos even if lpos == llen, + because ncurses won't update the cursor position. + + * grub/main.c (OPT_HOLD): New macro. + (longopts): New option --hold. + (usage): Add the documentation about --hold. + (main): Set hold if --hold is specified. Wait until cleared. + +1999-03-22 Gordon Matzigkeit + + * shared_src/cmdline.c (enter_cmdline): Check the return value of + set_device in the `root' command. + + * shared_src/char_io.c (memcheck): Special-case cur_part_desc and + reenable memory checking. + +1999-03-21 Gordon Matzigkeit + + * shared_src/boot.c (load_image): Make sure we use the mapped + address before actually writing data to memaddr. + + * shared_src/char_io.c (get_cmdline): Only zero-terminate if there + were leading blanks. This prevents accidental truncation of + commands. + + * grub/asmstub.c (get_diskinfo): Cache device geometries as well + as file handles. + Use the Linux HDIO_GETGEO ioctl to make a better guess at hard + disk geometries. + +1999-03-16 Gordon Matzigkeit + + * shared_src/shared.h (geometry_t): Delete typedef, until we + actually use it. + +1999-03-16 OKUJI Yoshinori + + * shared_src/asm.S (biosdisk): Use a structure for geometry + instead of a integer. + (get_diskinfo): Take a pointer to a geometry structure as the + second argument, and fill a geometry in it. Return 1 if an error + occurs, otherwise return 0. + * shared_src/boot.c (bsd_boot): Compute BIOS geometries for BSD. + * shared_src/cmdline.c (enter_cmdline): Declare dest_geom as + struct geometry. + * shared_src/disk_io.c (buf_geom): Declare as struct geometry. + * shared_src/filesys.h (SECTORS): Deleted. + (HEADS): Likewise. + (CYLINDERS): Likewise. + * shared_src/shared.h (BIOSDISK_FLAG_LBA_EXTENSION): New macro. + (struct geometry): New structure. + (buf_geom): Correct the prototype. + (get_diskinfo): Likewise. + (biosdisk): Likewise. + +1999-03-15 Gordon Matzigkeit + + * grub/asmstub.c (doit): Nested function to get a clean stack + frame while in grub_stage2. + Use different assembler magic. From OKUJI Yoshinori. + +1999-03-14 Gordon Matzigkeit + + * shared_src/stage2.c (run_menu): Use A_REVERSE and A_NORMAL + constants instead of magic numbers. + + * shared_src/shared.h (A_REVERSE): Renamed from ATTR_INVERSE for + compatibility with curses. + (A_NORMAL): Renamed from ATTR_NORMAL. + + * shared_src/cmdline.c (enter_cmdline): Change prompt to "grub> ". + (enter_cmdline): Only abort the boot if we are in a script. + + * shared_src/stage2.c (run_menu): Change prompts to "grub edit> ". + + * shared_src/char_io.c (memcheck): Use RAW_ADDR to compute memory + locations. + (get_cmdline): Change the `goto next line' code to account for + newlines deleting to end of line under curses. + + * Innumerable cleanups to fix warnings. There are still too many + typecasts in the wrong places (int variables used to hold + pointers, then casted to a pointer type), but things look better. + + * configure.in (CPPFLAGS): Bump up GCC warnings to -Wall + -Wmissing-prototypes -Wunused. + + * shared_src/shared.h: Delete stupid declarations, and totally + rearrange for clarity. + (inb, outb): Move to cmdline.c, since it's only used there. + (print_possibilities, fsmax, fsys_table): Move definitions to + disk_io.c. + + * grub/asmstub.c: Fill in more stubs. + +1999-03-13 Gordon Matzigkeit + + * shared_src/gunzip.c (border): Rename to bitorder, to resolve + clash with curses. + * shared_src/stage2.c (timeout): Rename to grub_timeout. + + * configure.in: Check for curses libraries for use with + /sbin/grub. + + * shared_src/shared.h (KEY_DELETE): Rename to KEY_DC, for + compatibility with curses. + (KEY_INSERT): Rename to KEY_IC. + (KEY_PGDN): Rename to KEY_NPAGE. + (KEY_PGUP): Rename to KEY_PPAGE. + + * shared_src/asm.S (asm_getkey): Renamed to getkey. + + * shared_src/char_io.c (getkey): Delete, because it's useless. + + * shared_src/shared.h: Resolve name clashes with libc by renaming + overlapping functions to have grub_ prefixes, then defining + macros. + + * grub/asmstub.c (start_stage2): Make some assertions about our + scratch memory area. + + * shared_src/shared.h (end): Delete declaration. + (RAW_ADDR, RAW_SEG): Macros to redirect /sbin/grub memory requests + through grub_scratch_mem. + + * grub/asmstub.c (get_mem_map): Implement, simulating 4MB + contiguous memory. + (get_code_end): Implement, simulating with a malloced area. + grub/asmstub.c (start_stage2): Initialize grub_scratch_mem. + + * shared_src/asm.S (get_mem_map): Some BIOSes expect the high word + of %eax to be zero. + (get_code_end): Move this from common.c so that we can stub it out + in the simulator. + + * debian/rules: Make sure info files end up in /usr/info, not + /info. + +1999-03-10 Gordon Matzigkeit + + * shared_src/asm.S (biosdisk): Make LBA mode work correctly. From + OKUJI Yoshinori. + Unconditionally define NO_INT13_FALLBACK until we release GRUB + 0.6. This will help debug any problems with the LBA support until + then. + +1999-03-09 Gordon Matzigkeit + + * shared_src/asm.S (biosdisk): Compute location of + disk_address_packet correctly. From OKUJI Yoshinori. + +1999-03-08 Gordon Matzigkeit + + * docs/grub.texi: New Texinfo documentation. + + * shared_src/disk_io.c (set_device): First stab at interpreting + Mach-style partition naming. + + * shared_src/stage2.c (run_menu): Don't say it was a failure if + enter_cmdline returns nonzero... just wait for a key. + + * shared_src/cmdline.c (enter_cmdline): Return nonzero, and avoid + the fallback command if we did an install. + + * shared_src/asm.S (_start): New explicit symbol to supress + warnings. + + * e2fs_stage1_5/Makefile.am (NO_FANCY_STUFF): Renamed to STAGE1_5, + since that describes this conditional more accurately. + * fat_stage1_5/Makefile.am: Likewise. + * ffs_stage1_5/Makefile.am: Likewise. + * shared_src/asm.S: Likewise. + * shared_src/char_io.c: Likewise. + * shared_src/common.c: Likewise. + * shared_src/disk_io.c: Likewise. + * shared_src/fsys_ext2fs.c: Likewise. + * shared_src/fsys_ffs.c: Likewise. + * shared_src/shared.h: Likewise. + +1999-03-07 Gordon Matzigkeit + + * configure.in (SHARED_SRC_RULES): Automatically generate + Makefile dependencies for files in shared_src. + e2fs_stage1_5/Makefile.am: Use them. + fat_stage1_5/Makefile.am: Likewise. + ffs_stage1_5/Makefile.am: Likewise. + grub/Makefile.am: Likewise. + stage2/Makefile.am: Likewise. + stage2_debug/Makefile.am: Likewise. + + * shared_src/disk_inode.h: Fix typo: i_ic shouldn't be defined. + + * shared_src/fsys_ffs.c (block_map): Make static, since this + function isn't used outside of its defining file. + + * shared_src/disk_io.c [NO_FANCY_STUFF]: Eliminate a whole bunch + more functions from the stage1.5. From OKUJI Yoshinori. + * shared_src/fsys_ffs.c: Likewise. + * shared_src/char_io.c: Likewise. + +1999-03-05 Gordon Matzigkeit + + * shared_src/char_io.c (getkey): Don't set BUF_DRIVE to -1. + BUF_DRIVE has nothing at all to do with getkey. + + * shared_src/common.c (err_list): Change description of ERR_GEOM + to be more informative. + + * Makefile.am (configure): Depend on debian/changelog. + + * configure.in (host_cpu): Make all fully i386-compatible CPUs be + identified as i386. + (AM_INIT_AUTOMAKE): Fetch values for PACKAGE and VERSION from + debian/changelog, so that we only have one file to update. + + * shared_src/asm.S (get_diskinfo): Fix a few bit-twiddling bugs in + the BIOS extension detection code. + (biosdisk) [AWARD_INT13_EXTENSIONS]: Preliminary implementation + of Award's encoding of cylinder bits 10 and 11. + (biosdisk) [NO_INT13_FALLBACK]: If defined, don't use the standard + disk interface if the extended interface fails. + + * configure.in: Make sure $(host_cpu) and $(host_vendor) are + substituted into the Makefile. + + * e2fs_stage1_5/Makefile.am (pkgdatadir): Install files in + $(datadir)/grub/$(host_cpu)-$(host_vendor). + * fat_stage1_5/Makefile.am: Likewise. + * ffs_stage1_5/Makefile.am: Likewise. + * stage1/Makefile.am: Likewise. + * stage2/Makefile.am: Likewise. + * stage2_debug/Makefile.am: Likewise. + +1999-03-03 Gordon Matzigkeit + + * shared_src/asm.S (biosdisk): Use LBA mode if high nibble of + GEOMETRY is nonzero. + (get_diskinfo): Set high nibble of GEOMETRY (0xf0000000) to 1 if + LBA mode is detected. + +1999-03-02 Gordon Matzigkeit + + * shared_src/disk_io.c (make_saved_active): Use BIOSDISK_READ and + BIOSDISK_WRITE. + + * shared_src/cmdline.c (enter_cmdline): Use BIOSDISK_WRITE. + + * shared_src/shared.h (BIOSDISK_SUBFUNC_READ, + BIOSDISK_SUBFUNC_WRITE): Delete constants. + + * shared_src/asm.S (biosdisk): Change subfunc argument to be + read=0, write=1. + + * configure.in: Drop redundant AC_PROG_INSTALL. From OKUJI + Yoshinori. + +1999-03-01 Gordon Matzigkeit + + * debian/rules (binary-arch): Properly install README.debian. + + * acinclude.m4 (grub_OBJCOPY_ABSOLUTE): Don't forget to move the + old binary out of the way before reentering the loop. + (grub_ASM_ADDR32): Delete conftest files after running the test. + + * debian/rules (binary-arch): Remove empty /sbin directory until + /sbin/grub is installed. Use $(DESTDIR) instead of $(prefix) to + install files. + + * shared_src/asm.S (version_string): Set the version string from + the VERSION specified in configure.in. + + * Change all Makefiles into Makefile.ams. Many major build + environment changes to get Automake/Autoconf working nicely. + +1999-02-28 Gordon Matzigkeit + + * NEWS: Moved from docs/NEWS. + + * configure.in, acinclude.m4: New files for Autoconf. From OKUJI + Yoshinori. + + * AUTHORS, INSTALL: New files. + +1999-02-24 Gordon Matzigkeit + + * stage1/stage1.S (after_BPB): Do a hard disk probe first, so that + we can work with IDE floppies (like the LS-120). + + * Run GNU Indent on */*.[ch]. + +1999-02-21 Gordon Matzigkeit + + * debian: Add to the distribution, since we maintain the GRUB + Debian package ourselves. + + * grub/asmstub.c: New file to implement stubbed assembly functions + under Unix. + + * stage1/Makefile: Delete spurious dependencies on Makefile. + * stage2/Makefile: Likewise. + * stage2_debug/Makefile: Likewise. + * grub/Makefile: Likewise. + + * shared_src/fsys_ext2fs.c (ext2fs_dir): Follow symbolic links + rather than giving an error. + + * shared_src/common.c (err_list): Use labeled elements to + associate messages with error codes. + * shared_src/shared.h: Make error codes into an enumerated type. + + * shared_src/common.c (err_list): Add ERR_SYMLINK_LOOP. + * shared_src/shared.h: Likewise. + + * shared_src/char_io.c (bcopy): Don't make any assumptions about + the length of an unsigned long. + + * grub/Makefile: Treat CFLAGS, CPPFLAGS, LDFLAGS according to + GNU standards. + * stage2/Makefile: Likewise. + * e2fs_stage1_5/Makefile: Likewise. + * fat_stage1_5/Makefile: Likewise. + * ffs_stage1_5/Makefile: Likewise. + +1999-02-20 Gordon Matzigkeit + + * docs/index.html: Rename to grub.html, so that we don't hide + files in this directory from a web browser. + +1999-02-15 Gordon Matzigkeit + + * Makefile.end (PROGS): Add grub. + + * grub/main.c: New file. + + * grub/Makefile: New directory to contain the stage2 Unix program. + + * shared_src/cmdline.c: Use substring. + * shared_src/fsys_ext2fs.c: Likewise. + * shared_src/fsys_fat.c: Likewise. + * shared_src/fsys_ffs.c: Likewise. + * shared_src/stage2.c: Likewise. + + * shared_src/shared.h: Delete strcmp, declare substring. + + * shared_src/char_io.c (strcmp): Rename to `substring', because + this function doesn't behave the same as libc's strcmp. + +1999-02-14 Gordon Matzigkeit + + * shared_src/shared.h: (addr32, data32): Delete definitions. + + * stage1/stage1.S: Modify to use GAS's new .code16 semantics. + shared_src/asm.S: Likewise. + + * configure: Test to see if the `addr32' instruction is supported. + Ian Lance Taylor says that GAS's interpretation of `.code16' has + changed. Older versions always generated 32-bit code, but + implicitly inserted addr32 and data32 when .code16 was given. + Newer versions generate 16-bit code, and require manual addr32 and + data32 overrides. + + * shared_src/shared.h: Add some assertions to check that buffer + addresses are properly defined. + +1999-02-12 Gordon Matzigkeit + + * shared_src/stage2.c (run_menu): Pause if we failed to boot both + the default and fallback entries. + + * configure: Check to make sure that GAS actually honors .code16 + directives. + +1999-02-02 Gordon Matzigkeit + + * shared_src/asm.S: Fix typo that called interrupt 0xd (decimal + 13) instead of 0x13. + +1999-01-31 Gordon Matzigkeit + + * e2fs_stage1_5/Makefile: Avoid gratuitous dependencies on + Makefile. + * fat_stage1_5/Makefile: Likewise. + * ffs_stage1_5/Makefile: Likewise. + + * Makefile.end (PROGS): Add e2fs_stage1_5, fat_stage1_5, and + grubinst. + (distclean): New GNU standard rule. + +1998-10-23 Gordon Matzigkeit + + * configure: Accept `--host' as a synonym for `--target', and + accept a non-optional argument as the target name. Join the + prefix to the tool name with a hyphen. + + * shared_src/disk_io.c (print_fsys_type): Always print the + partition type. + + * shared_src/stage2.c (run_menu): Check to make sure that the + fallback entry is nonnegative. + (run_menu): For consistency, use `e' rather than enter to edit the + command entry. diff --git a/usr/src/grub/grub-0.97/INSTALL b/usr/src/grub/grub-0.97/INSTALL new file mode 100644 index 0000000000..1ba68a6905 --- /dev/null +++ b/usr/src/grub/grub-0.97/INSTALL @@ -0,0 +1,266 @@ +-*- Text -*- + +This is the GRUB. Welcome. + +This file contains instructions for compiling and installing the GRUB. + +The Requirements +================ + +GRUB depends on some software packages installed into your system. If +you don't have any of them, please obtain and install them before +configuring the GRUB. + +* GCC + + Probably every recent GCC should work, but we recommend GCC 2.95 and + later, since you can create smaller binary images. See the web page + . + +* GNU Make + + For now, the Makefiles produced by Automake depends on GNU Make. See + the web page . + +* GNU binutils 2.9.1.0.23 or later + + Binutils has changed the behavior of 16bit assembler between 2.9.1 + and 2.9.1.0.x, and we support only 2.9.1.0.x and higher. In + particular, we recommend using binutils 2.10, since it is the only + public release that supports real 16bit mode. Please take a look at + the web page , for more + information. Note that you don't have to install it into any system + directory. See the section "Operation Controls", if you want to + install binutils into your own directory. + +If you'd like to develop GRUB, these below are also required. Don't +forget to specify the option `--enable-maintainer-mode' when running the +configure script. + +* Texinfo 4.0 or later + + We use some new macros in the documents, so you need a recent + Texinfo release. See the web page + . + +* Developers: GNU Autoconf 2.5x and GNU Automake 1.7 or later + + You should not need Automake just to compile GRUB, but you will need + it if you edit any of the build files (Makefile.am, configure.in, + etc). We use the new "per-executable flags" feature found in the + latest release of automake. See the web page + . + + +Configuring the GRUB +==================== + +The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, a +file `config.cache' that saves the results of its tests to speed up +reconfiguring, and a file `config.log' containing compiler output +(useful mainly for debugging `configure'). + +If you need to do unusual things to compile the package, please try to +figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If at some point `config.cache' +contains results you don't want to keep, you may remove or edit it. + +The file `configure.in' is used to create `configure' by a program +called `autoconf'. You only need `configure.in' if you want to change +it or regenerate `configure' using a newer version of `autoconf'. + + +Building the GRUB +================= + +The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and + type `./configure' to configure the package for your system. If + you're using `csh' on an old version of System V, you might need + to type `sh ./configure' instead to prevent `csh' from trying to + execute `configure' itself. + + Running `configure' takes awhile. While running, it prints some + messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Optionally, type `make check' to run any self-tests that come with + the package. + + 4. Type `make install' to install the programs and any data files and + documentation. + + 5. You can remove the program binaries and object files from the + source code directory by typing `make clean'. To also remove the + files that `configure' created (so you can compile the package for + a different kind of computer), type `make distclean'. There is + also a `make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + + +Compiling For Multiple Architectures +==================================== + +You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. `cd' to the directory where you want the object files +and executables to go and run the `configure' script. `configure' +automatically checks for the source code in the directory that +`configure' is in and in `..'. + + +Installation Names +================== + +By default, `make install' will install the package's files in +`/usr/local/bin', `/usr/local/man', etc. You can specify an +installation prefix by giving `configure' the option `--prefix=PATH'. + +You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If +you give `configure' the option `--exec-prefix=PATH', the package will +use PATH as the prefix for installing programs and libraries. +Documentation and other data files will still use the regular prefix. + +In addition, if you use an unusual directory layout you can give +options like `--bindir=PATH' to specify different values for +particular kinds of files. Run `configure --help' for a list of the +directories you can set and what kinds of files go in them. + +If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' +the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + +Please note, however, that the GRUB knows where it is located in the +filesystem. If you have installed it in an unusual location, the +system might not work properly, or at all. The chief utility of these +options for the GRUB is to allow you to "install" in some alternate +location, and then copy these to the actual root filesystem later. + + +Sharing Defaults +================ + +If you want to set default values for `configure' scripts to share, +you can create a site shell script called `config.site' that gives +default values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + + +Operation Controls +================== + + `configure' recognizes the following options to control how it +operates. + +`--cache-file=FILE' + Use and save the results of the tests in FILE instead of + `./config.cache'. Set FILE to `/dev/null' to disable caching, for + debugging `configure'. + +`--help' + Print a summary of the options to `configure', and exit. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`--version' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`--enable-maintainer-mode' + Enable make rules and dependencies not useful (and sometimes + confusing) to the casual installer. If you are a GRUB developer, + it is a good idea to specify this option. + +`--disable-ext2fs' + Omit the ext2fs support in Stage 2. + +`--disable-fat' + Omit the FAT support in Stage 2. + +`--disable-ffs' + Omit the FFS support in Stage 2. + +`--disable-minix' + Omit the Minix fs support in Stage 2. + +`--disable-reiserfs' + Omit the ReiserFS support in Stage 2. + +`--disable-vstafs' + Omit the VSTa filesystem support in Stage 2. + +`--disable-jfs' + Omit the JFS support in Stage 2. + +`--disable-xfs' + Omit the XFS support in Stage 2. + +`--disable-ufs2' + Omit the UFS2 support in Stage 2. + +`--disable-iso9660' + Omit the ISO9660 support in Stage 2. + +`--disable-gunzip' + Omit the decompression support in Stage 2. + +`--disable-md5-password' + Omit the MD5 password support in Stage2. + +`--with-binutils=PATH' + Search the path PATH to find binutils. If you have installed your + binutils executables into an unusual location where GCC doesn't + search by default, use this option. + +`--without-curses' + Don't use the curses library. + +`--disable-hercules' + Omit the hercules console support in Stage 2. + +`--disable-serial' + Omit the serial terminal support in Stage 2. + +`--enable-serial-speed-simulation' + Simulate the slowness of a serial device in the grub shell. This + option is useful for GRUB developers, as you can test the + performance of a terminal emulation even on pseudo terminals. + +`--enable-preset-menu=FILE' + Preset a menu file FILE in Stage 2. This is useful, if you cannot + put a configuration file on a filesystem for some reason (e.g. when + you need to set the default terminal to a serial terminal in an + embedded system). + +`--enable-example-kernel' + Build the example Multiboot kernel in the directory "docs". You + will be able to boot the image "kernel" with GRUB. + +`--disable-auto-linux-mem-opt' + Don't pass the "mem=" option automatically, when booting Linux. + You can also disable the feature at run time. + + +`configure' also accepts several options for the network support. See +the file `netboot/README.netboot', for more information. diff --git a/usr/src/grub/grub-0.97/MAINTENANCE b/usr/src/grub/grub-0.97/MAINTENANCE new file mode 100644 index 0000000000..3ce7b3fcf2 --- /dev/null +++ b/usr/src/grub/grub-0.97/MAINTENANCE @@ -0,0 +1,60 @@ +-*- text -*- + +This is a list of random notes for GRUB maintainers. If you are not a +maintainer, you need to ask maintainers to do these instead of doing +these yourself. + +How to update the online manual: (FIXME: this is obsoelete) +1. Copy docs/*.texi (excluding "multiboot.texi") to fencepost.gnu.org. +2. Make a symbolic link from ~mohit/gnudoc/gnudoc_template to the + directory under which *.texi were copied, if the link isn't present. +3. Run ``~mohit/gnudoc/gendocs.sh grub "GNU GRUB Manual"''. +4. Copy the contents of the directory ``manual'' to + gnudist.gnu.org:~ftp/gnu/Manuals/grub-VERSION (VERSION is, for + example, 1.0). +5. Run ``ln -sf grub-VERSION grub'' in gnudist.gnu.org:~ftp/gnu/Manuals. +6. Run ``cd grub; ln -s grub.html index.html''. +7. Verify the new online manual with a WWW browser. +8. Update manual.html by hand. + +How to release a version: +1. Check out the source tree from the CVS from scratch. +2. Check if ``make distcheck'' succeeds. +3. Run ``util/grub-image''. +4. Check the resulted images, for example, using bochs. +5. Copy grub-VERSION.tar.gz, grub-VERSION-i386-pc.tar.gz and + grub-VERSION-i386-pc.ext2fs to fencepost.gnu.org:~ftp/gnu/grub. +6. Move older files in that directory above to the directory ``old'', + if you think they are eyesores. +7. Post an announcement to bug-grub@gnu.org. It would be a good idea to + send a carbon copy to bug-hurd@gnu.org and + debian-hurd@lists.debian.org. If the announcement is for a stable + version, you can inform info-gnu@gnu.org as well. +8. Optionally, post an announcement to Freshmeat.net. + +Legal issues: +1. If a patch is not significant (in size), you don't have to care about + the copyright. +2. If a patch is significant, you shouldn't apply the patch to the CVS. + Before doing that, you must ask the contributor to assign or disclaim + the copyright. Send ``/gd/gnuorg/request-assign.changes'' or + ``/gd/gnuorg/request-assign.future'' to the contributor, and wait + until the FSF finishes the legal work. +3. You can check if a contributor has already assigned his/her copyright + to the FSF by looking at ``/gd/gnuorg/copyright.list''. + +What you should have in your mind: +1. Don't add features unnecessarily! You may think it is a Good Thing to + have more features, but you must be prepared for more burdens. + DO THAT ONLY IF YOU BELIEVE THAT THE FEATURE IS ESSENTIAL. +2. Don't break backward-compatibility! Don't apply any patch which could + break existing features. Otherwise you would receive a lot of + complaints. DO THAT ONLY IF YOU BELIEVE THAT THE INCOMPATIBILITY IS + INEVITABLE. +3. Write good code. Be not satisfied with ad hoc workarounds or quick + hacks. NEVER WRITE BAD CODE. + +Resources: +* http://www.gnu.org/prep/maintain_toc.html +* http://www.gnu.org/prep/standards_toc.html +* http://www.gnu.org/server/fsf-html-style-sheet.html diff --git a/usr/src/grub/grub-0.97/Makefile.am b/usr/src/grub/grub-0.97/Makefile.am new file mode 100644 index 0000000000..63a9a4f602 --- /dev/null +++ b/usr/src/grub/grub-0.97/Makefile.am @@ -0,0 +1,4 @@ +# Do not change this order if you don't know what you are doing. +AUTOMAKE_OPTIONS = 1.7 gnu +SUBDIRS = netboot stage2 stage1 lib grub util docs +EXTRA_DIST = BUGS MAINTENANCE diff --git a/usr/src/grub/grub-0.97/Makefile.in b/usr/src/grub/grub-0.97/Makefile.in new file mode 100644 index 0000000000..ffe7bf9061 --- /dev/null +++ b/usr/src/grub/grub-0.97/Makefile.in @@ -0,0 +1,605 @@ +# Makefile.in generated by automake 1.9.4 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = . +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in $(srcdir)/config.h.in \ + $(top_srcdir)/configure AUTHORS COPYING ChangeLog INSTALL NEWS \ + THANKS TODO compile config.guess config.sub depcomp install-sh \ + missing mkinstalldirs +subdir = . +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ + configure.lineno configure.status.lineno +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = config.h +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-exec-recursive install-info-recursive \ + install-recursive installcheck-recursive installdirs-recursive \ + pdf-recursive ps-recursive uninstall-info-recursive \ + uninstall-recursive +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) +am__remove_distdir = \ + { test ! -d $(distdir) \ + || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -fr $(distdir); }; } +DIST_ARCHIVES = $(distdir).tar.gz +GZIP_ENV = --best +distuninstallcheck_listfiles = find . -type f -print +distcleancheck_listfiles = find . -type f -print +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BUILD_EXAMPLE_KERNEL_FALSE = @BUILD_EXAMPLE_KERNEL_FALSE@ +BUILD_EXAMPLE_KERNEL_TRUE = @BUILD_EXAMPLE_KERNEL_TRUE@ +CC = @CC@ +CCAS = @CCAS@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DISKLESS_SUPPORT_FALSE = @DISKLESS_SUPPORT_FALSE@ +DISKLESS_SUPPORT_TRUE = @DISKLESS_SUPPORT_TRUE@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FSYS_CFLAGS = @FSYS_CFLAGS@ +GRUB_CFLAGS = @GRUB_CFLAGS@ +GRUB_LIBS = @GRUB_LIBS@ +HERCULES_SUPPORT_FALSE = @HERCULES_SUPPORT_FALSE@ +HERCULES_SUPPORT_TRUE = @HERCULES_SUPPORT_TRUE@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +NETBOOT_DRIVERS = @NETBOOT_DRIVERS@ +NETBOOT_SUPPORT_FALSE = @NETBOOT_SUPPORT_FALSE@ +NETBOOT_SUPPORT_TRUE = @NETBOOT_SUPPORT_TRUE@ +NET_CFLAGS = @NET_CFLAGS@ +NET_EXTRAFLAGS = @NET_EXTRAFLAGS@ +OBJCOPY = @OBJCOPY@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PERL = @PERL@ +RANLIB = @RANLIB@ +SERIAL_SPEED_SIMULATION_FALSE = @SERIAL_SPEED_SIMULATION_FALSE@ +SERIAL_SPEED_SIMULATION_TRUE = @SERIAL_SPEED_SIMULATION_TRUE@ +SERIAL_SUPPORT_FALSE = @SERIAL_SUPPORT_FALSE@ +SERIAL_SUPPORT_TRUE = @SERIAL_SUPPORT_TRUE@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STAGE1_CFLAGS = @STAGE1_CFLAGS@ +STAGE2_CFLAGS = @STAGE2_CFLAGS@ +STRIP = @STRIP@ +VERSION = @VERSION@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_OBJCOPY = @ac_ct_OBJCOPY@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ + +# Do not change this order if you don't know what you are doing. +AUTOMAKE_OPTIONS = 1.7 gnu +SUBDIRS = netboot stage2 stage1 lib grub util docs +EXTRA_DIST = BUGS MAINTENANCE +all: config.h + $(MAKE) $(AM_MAKEFLAGS) all-recursive + +.SUFFIXES: +am--refresh: + @: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \ + cd $(srcdir) && $(AUTOMAKE) --gnu \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + echo ' $(SHELL) ./config.status'; \ + $(SHELL) ./config.status;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(srcdir) && $(AUTOCONF) +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) + +config.h: stamp-h1 + @if test ! -f $@; then \ + rm -f stamp-h1; \ + $(MAKE) stamp-h1; \ + else :; fi + +stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status + @rm -f stamp-h1 + cd $(top_builddir) && $(SHELL) ./config.status config.h +$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_srcdir) && $(AUTOHEADER) + rm -f stamp-h1 + touch $@ + +distclean-hdr: + -rm -f config.h stamp-h1 +uninstall-info-am: + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @set fnord $$MAKEFLAGS; amf=$$2; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @set fnord $$MAKEFLAGS; amf=$$2; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + $(am__remove_distdir) + mkdir $(distdir) + $(mkdir_p) $(distdir)/util + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(mkdir_p) "$(distdir)/$$subdir" \ + || exit 1; \ + distdir=`$(am__cd) $(distdir) && pwd`; \ + top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$top_distdir" \ + distdir="$$distdir/$$subdir" \ + distdir) \ + || exit 1; \ + fi; \ + done + -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ + ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ + || chmod -R a+r $(distdir) +dist-gzip: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) + +dist-bzip2: distdir + tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 + $(am__remove_distdir) + +dist-tarZ: distdir + tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z + $(am__remove_distdir) + +dist-shar: distdir + shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz + $(am__remove_distdir) + +dist-zip: distdir + -rm -f $(distdir).zip + zip -rq $(distdir).zip $(distdir) + $(am__remove_distdir) + +dist dist-all: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) + +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + case '$(DIST_ARCHIVES)' in \ + *.tar.gz*) \ + GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf - ;;\ + *.tar.bz2*) \ + bunzip2 -c $(distdir).tar.bz2 | $(AMTAR) xf - ;;\ + *.tar.Z*) \ + uncompress -c $(distdir).tar.Z | $(AMTAR) xf - ;;\ + *.shar.gz*) \ + GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ + *.zip*) \ + unzip $(distdir).zip ;;\ + esac + chmod -R a-w $(distdir); chmod a+w $(distdir) + mkdir $(distdir)/_build + mkdir $(distdir)/_inst + chmod a-w $(distdir) + dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ + && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ + && cd $(distdir)/_build \ + && ../configure --srcdir=.. --prefix="$$dc_install_base" \ + $(DISTCHECK_CONFIGURE_FLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ + distuninstallcheck \ + && chmod -R a-w "$$dc_install_base" \ + && ({ \ + (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ + distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ + } || { rm -rf "$$dc_destdir"; exit 1; }) \ + && rm -rf "$$dc_destdir" \ + && $(MAKE) $(AM_MAKEFLAGS) dist \ + && rm -rf $(DIST_ARCHIVES) \ + && $(MAKE) $(AM_MAKEFLAGS) distcleancheck + $(am__remove_distdir) + @(echo "$(distdir) archives ready for distribution: "; \ + list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ + sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}' +distuninstallcheck: + @cd $(distuninstallcheck_dir) \ + && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ + || { echo "ERROR: files left after uninstall:" ; \ + if test -n "$(DESTDIR)"; then \ + echo " (check DESTDIR support)"; \ + fi ; \ + $(distuninstallcheck_listfiles) ; \ + exit 1; } >&2 +distcleancheck: distclean + @if test '$(srcdir)' = . ; then \ + echo "ERROR: distcleancheck can only run from a VPATH build" ; \ + exit 1 ; \ + fi + @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ + || { echo "ERROR: files left in build directory after distclean:" ; \ + $(distcleancheck_listfiles) ; \ + exit 1; } >&2 +check-am: all-am +check: check-recursive +all-am: Makefile config.h +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic mostlyclean-am + +distclean: distclean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-hdr distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +info: info-recursive + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-recursive + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf $(top_srcdir)/autom4te.cache + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-info-am + +uninstall-info: uninstall-info-recursive + +.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \ + check-am clean clean-generic clean-recursive ctags \ + ctags-recursive dist dist-all dist-bzip2 dist-gzip dist-shar \ + dist-tarZ dist-zip distcheck distclean distclean-generic \ + distclean-hdr distclean-recursive distclean-tags \ + distcleancheck distdir distuninstallcheck dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-man install-strip installcheck \ + installcheck-am installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic maintainer-clean-recursive \ + mostlyclean mostlyclean-generic mostlyclean-recursive pdf \ + pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \ + uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/usr/src/grub/grub-0.97/Makefile.solaris b/usr/src/grub/grub-0.97/Makefile.solaris new file mode 100644 index 0000000000..ddf5cc9503 --- /dev/null +++ b/usr/src/grub/grub-0.97/Makefile.solaris @@ -0,0 +1,55 @@ +# +# Copyright 2005 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# ident "%Z%%M% %I% %E% SMI" +# +include ../Makefile.grub +include Makefile.solaris.defs + +.KEEP_STATE: + +SUBDIRS = netboot stage2 stage1 lib grub util docs + +# +# Source files to be installed in $(SRC_DIR). +# NOTE: although it's under SCCS, config.h is not included here because +# it's automatically generated when configure is run. +# +SRC_DIR = $(ROOT_SRC) + +SRC_FILES = AUTHORS BUGS COPYING ChangeLog INSTALL MAINTENANCE \ + Makefile.am Makefile.in NEWS README THANKS TODO \ + acinclude.m4 aclocal.m4 config.h.in configure.ac stamp-h.in +INST_FILES = $(SRC_FILES:%=$(SRC_DIR)/%) + +SRC_EXECS = compile config.guess config.sub configure depcomp \ + install-sh missing mkinstalldirs +INST_EXECS = $(SRC_EXECS:%=$(SRC_DIR)/%) +$(INST_EXECS) := FILEMODE = 755 + + +INSTALL_TARGETS = $(INST_FILES) $(INST_EXECS) + +all := TARGET = all +install := TARGET = install +clean := TARGET = clean +clobber := TARGET = clobber + + +all install clean clobber: $(SUBDIRS) + +$(SUBDIRS): _FORCE + @cd $@; pwd; $(MAKE) -f Makefile.solaris $(TARGET) + + +install: $(INSTALL_TARGETS) + +$(SRC_DIR)/%: $(SRC_DIR) % + $(INS.file) + +$(SRC_DIR): + $(INS.dir) + + +_FORCE: diff --git a/usr/src/grub/grub-0.97/Makefile.solaris.defs b/usr/src/grub/grub-0.97/Makefile.solaris.defs new file mode 100644 index 0000000000..ddca919245 --- /dev/null +++ b/usr/src/grub/grub-0.97/Makefile.solaris.defs @@ -0,0 +1,88 @@ +# +# Copyright 2005 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# ident "%Z%%M% %I% %E% SMI" +# +include $(SRC)/Makefile.master + +.KEEP_STATE: + +VERSION = 0.95 + +# $(POUND_SIGN) is just a #. Used to turn a feature off. +# The $(POUND_SIGN)POUND_SIGN:sh construct is just so make doesn't have to +# spawn a shell and redefine POUND_SIGN if it is already defined (e.g. +# $(SRC)/Makefile.master was already included). +$(POUND_SIGN)POUND_SIGN:sh = echo '\043' + + +# +# Optional features (set to $(POUND_SIGN) to turn off): +# +# OPTION_UTILS: +# Build the userland utilities. +# NOTE: these utilities will be installed in +# /platform/$(PLATFORM)/boot/grub, not /boot/grub. +# +# OPTION_DOCS: +# Build and install some GRUB documentations, e.g. man and info files. +# NOTE: these docs will be installed in +# /platform/$(PLATFORM)/boot/grub, not /boot/grub. +# +# OPTION_FS: +# Build additional filesystem support into GRUB. This will increase +# the sizes of stage2 and pxegrub and may cause malfunction. +# +# STAGE2_NETBOOT: +# Include netboot support in stage2 (on by default). +# This only affects stage2, not pxegrub (diskless support). +# +# STAGE2_NETBOOT = $(POUND_SIGN) +OPTION_UTILS = $(POUND_SIGN) +OPTION_DOCS = $(POUND_SIGN) +OPTION_FS = $(POUND_SIGN) + + +BASE_CFLAGS = -B$(GNU_ROOT)/bin/ -g $(CPPFLAGS) $(OPTFLAGS) +BASE_CCASFLAGS = -B$(GNU_ROOT)/bin/ -g $(CPPFLAGS) $(OPTFLAGS) +BASE_LDFLAGS = + +CC = $(GNU_ROOT)/bin/gcc +CFLAGS = $(BASE_CFLAGS) +CCDEPMODE = depmode=none + +CCAS = $(CC) +CCASFLAGS = $(BASE_CCASFLAGS) + +CPP = $(CC) -E + +# $(ENVCPPFLAGS4), if defined, should be something like "-Y I,somepath". +# We want to get rid of the "-Y I," part but make's pattern replacement +# macro reference doesn't allow spaces in it, e.g. $(ENVCPPFLAGS4:-Y I,%=%). +# So we'll get rid of the "-Y" now and then the "I," later. By the way, this +# should also work in case $(ENVCPPFLAGS4) is "-YI,somepath" (no space). +t.ENVCPPFLAGS4 = $(ENVCPPFLAGS4:-Y%=%) + +CPPFLAGS = $(DEFS) $(INCLUDES) $(WARNFLAGS) \ + $(ENVCPPFLAGS1:-I%=-isystem %) \ + $(ENVCPPFLAGS2:-I%=-isystem %) \ + $(ENVCPPFLAGS3:-I%=-isystem %) \ + $(t.ENVCPPFLAGS4:I,%=-nostdinc -isystem %) + +CCLD = $(GNU_ROOT)/bin/gld +LDFLAGS = $(BASE_LDFLAGS) +LINKFLAGS = -g +LINK = $(CCLD) $(LINKFLAGS) $(LDFLAGS) + +DEFS = -DHAVE_CONFIG_H -DSOLARIS_NETBOOT +OPTFLAGS = -falign-jumps=1 -falign-loops=1 -falign-functions=1 +#WARNFLAGS = -Wall -Wmissing-prototypes -Wunused -Wshadow \ +# -Wpointer-arith -Wundef + +OBJCOPY = $(GNU_ROOT)/bin/gobjcopy + +AR = /usr/ccs/bin/ar +RANLIB = : + +MKDIR = mkdir -p diff --git a/usr/src/grub/grub-0.97/NEWS b/usr/src/grub/grub-0.97/NEWS new file mode 100644 index 0000000000..ad72179490 --- /dev/null +++ b/usr/src/grub/grub-0.97/NEWS @@ -0,0 +1,565 @@ +NEWS - list of user-visible changes between releases of GRUB + +New: +* The command "fallback" supports mutiple fallback entries. +* The command "savedefault" supports an optional argument which + is the number of next boot entry or the special keyword `fallback'. +* New utility "grub-set-default". +* New section "Making your system robust" in the manual. + +New in 0.97 - 2005-05-08: +* Fix the prototypes and the definitions of nested functions. This was + required for gcc-4. +* Implement a more robust workaround for buggy BIOSes which don't pass + boot drive correctly (notably for HP Vectra). + +New in 0.96 - 2005-01-30: +* The command "fallback" supports mutiple fallback entries. +* The command "savedefault" supports an optional argument which + is the number of next boot entry or the special keyword `fallback'. +* New utility "grub-set-default". +* New section "Making your system robust" in the manual. + +New in 0.95 - 2004-06-13: +* Add support for ReiserFS 3. +* Fix support for FreeBSD 5. +* Support ATARAID for Linux in the grub shell and grub-install. +* Add CDROM support for El Torito with no emulation mode. You can use + (cd) as a CDROM drive in the config file. +* Option --no-mem-option is implied for Linux 2.4.18 and newer. +* Add support for UFS2. + +New in 0.94 - 2004-01-25: +* Support building on x86-64 with gcc -m32. +* Use a BIOS call to turn on/off Gate A20. This should solve various + problems related to Gate A20 in modern BIOSes. +* Add a workaround for buggy BIOSes (notably HP Vectra series) which + don't pass the boot drive correctly. +* Display "GNU GRUB" instead of "GRUB" in the menu. +* Add support for QNX RTP into the grub shell. +* Add support for the initrd max address of a kernel header in Linux. +* Support 32 bit and 64 bit dev_t. +* Add support for an install device in GRUB's notation with no + parenthesis (e.g. grub-install hd0). +* Improve the manual a lot. + +New in 0.93 - 2002-12-08: +* Define the behavior of the boot loader when the load end address is + zero and the bss end address is zero in the Multiboot Specification. + Also, add the support into GRUB. +* Finally, we have a Bug Tracking System! Now the preferable way to + report bugs is to use the BTS rather than sending e-mail to bug-grub. + See , for more + details. +* The appendix "FAQ" in the manual is removed. See the GNU GRUB FAQ on + the web instead. +* The terminal handling code is rewritten radically, and many bugfixes + are made at the same time. +* The command "color" is effective even in the command-line. +* The command "terminal" takes two new options, ``--no-echo'' and + ``--no-edit''. If you specify ``--no-echo'', GRUB won't echo back + input characters. If you specify ``--no-edit'', GRUB will disable the + BASH-like editing feature. These options are useful when using an + intelligent terminal (such as the comint mode in GNU Emacs). +* The utility ``grub-md5-crypt'' prompts to retype a password and checks + if the passwords match. +* Support for booting Linux is rewritten, so GRUB now supports + large-EBDA systems. +* The menu interfaces supports Page Up, Page Down, and Right Key. +* New command "terminfo", for vt100-incompatible terminals. +* New options, ``-D'', ``-g'' and ``-m'' are supported for FreeBSD. + +New in 0.92 - 2002-04-30: +* The command "displaymem" uses only hex digits for consistency. +* The netboot code goes back to the progress bars instead of dots, for + the notation of data transfers. And, that is displayed only in debug + mode, that is to say, nothing is displayed by default. Remember that + you can turn on debug mode via the command "debug". +* The command "help" doesn't show all the available commands by default, + when no argument is specified. Rarely used commands (such as + "testload") and useless commands in interactive use (such as + "savedefault") are hidden. If you want to see help messages for those + commands, specify the new option "--all". +* A built-in, `more'-like pager is added. When a command prints too many + lines to fit the screen, GRUB waits until you hit return key. This + feature can be turned off by the new command "pager". +* The command "terminal" accepts a new option, "--lines=LINES". You can + set the maximum number of lines arbitrarily with this option. If you + don't specify it, the maximum number will be 24. +* The command "terminal" accepts another new option, "--silent". You can + suppress the "Press any key to continue" message with this option. +* The mem= option for Linux is recognized and used to limit the maximum + address of initrd. +* A fallback entry is executed immediately after a default entry, + without prompting a user's intervention, as the manual has ever been + saying. +* The utility ``grub-install'' makes sure that GRUB images have been + written to a physical disk completely. To assist this feature, a new + command "dump" is added. + +New in 0.91 - 2002-01-21: +* Support for Linux DAC960 is added. +* JFS and XFS support is added. +* The commands "hide" and "unhide" support logical partitions. +* The utility ``grub-install'' supports NetBSD. +* The network support is updated to Etherboot-5.0.5. +* The manner of handling the preset menu changes. In the previous + implementation, the preset menu is used only when opening the + configuration file failed. Now try to use the preset menu first. And, + if the configuration file is available, it is read after readoing the + preset menu. In this case, menu entries in the preset menu (if any) + are overrided by the configuration file. +* Diskless support is a bit changed. In the previous, GRUB set up a + network automatically via a special function. In the current, the + function is gone and the preset menu feature is used (i.e. just + execute the command "bootp" as if you specified it in the preset + menu). This has no impact against most users, but you should take care + if using the preset menu for your own purpose, because GRUB doesn't + call "bootp" implicitly when the preset menu is used explicitly. In + this case, you would probably need to insert commands to initialize a + network into your preset menu. +* Important bugfixes are made for ReiserFS, APM, TFTP, LBA, etc. + +New in 0.90 - 2001-07-11: +* The command "setkey" resets key mappings, when no argument is + specified. +* Linux devfs support is added. +* The utility ``grub-install'' accepts a new option, `--recheck'. If + this option is specified, probe a device map, even if it already + exists. You should use this option whenever you add/remove a disk. +* The command "password" supports a md5 password if the option `--md5' + is given. This command can now also be used to protect specific menu + items with their own passwords. +* New command, "displayapm". +* New command, "md5crypt". +* The new utility ``grub-md5-crypt'' is a frontend of the grub shell. It + encrypts a password in MD5 format. +* New commands, "testvbe" and "vbeprobe". +* The configure script accepts a new option, `--enable-preset-menu'. You + can embed an arbitrary configuration which will be used when Stage 2 + cannot open a real configuration file, with this option. The argument + must be an existing file. +* EZ-BIOS support is added. +* Booting Windows from a logical partition is supported. +* The example Multiboot kernel in the directory "docs" is built, if you + specify the option `--enable-example-kernel' to the configure script. +* New command, "ifconfig". +* Linux software RAID support is added (only for RAID-1). +* Hercules support is added. +* The configure script now accepts `--disable-auto-linux-mem-opt', which + has the same meaning as you specify the option `--no-mem-option' to the + command "kernel". +* Jump to the physical entry address of a Multiboot kernel when booting + it up. The old behavior was to use the virtual one, regardless of the + setting of the physical address. +* The commands "bootp" and "dhcp" accepts a new option + `--with-configfile', so that you can load a remotely specified + configuration file automatically, like the network boot images. +* VSTa filesystem support is added. +* ELF symbol loading support is added. + +New in 0.5.96 - 2000-10-04: +* New commands, "reboot" and "halt". +* New command, "hiddenmenu". You can hide the menu interface by default + with this command. +* You can specify `--no-mem-option' to the command "kernel", if you want + GRUB not to pass a Linux's mem option automatically. +* Now GRUB is compliant with the Linux/i386 boot protocol version 2.02. +* The network support is updated to Etherboot-4.6.4. +* Symlinks in ReiserFS are supported. +* Add a workaround into the grub shell, so that it works fine even under + Linux 2.4. +* Add a new option `--stage2' into the commands "install" and "setup", + to let the grub shell know what the file name of Stage 2 is under your + operating system. You must specify the option correctly, if you cannot + unmount the partition where GRUB images reside. We'd recommend _not_ + using those commands directly, but using the utility "grub-install" + instead, because this is safer. +* One violation against the Network Boot Image Proposal was found and + fixed. So now the image `nbgrub' can work fine even with a card such + as rtl8139. +* Serial terminal support is added. The configure script accepts + a new option `--disable-serial'. Unless it is specified, you can use + two new commands, "serial" and "terminal" in the command-line and the + menu. See the manual, for more details. +* Preserve the possible magic number used by Windows NT in a MBR. +* The command-line interface is switched to single-line editing mode. +* Only for developers: the configure script accepts + `--enable-serial-speed-simulation', which is useful when you want to + simulate the speed of a serial device on a psuedo terminal. +* Also only for developers: you can specify an optional argument to the + option `--hold' for the grub shell. The argument means how many + seconds the grub shell should wait until diving into the main routine. +* New command, "savedefault". Now you can save current entry number to + your disk with this command and then you can set the default boot + entry to it by the command "default saved". +* Add a new option `--prefix' into the command "setup", so that you can + specify the name of a directory which contains GRUB images. And, the + behavior of this command changed slightly, that is, this command now + searchs stage1 automatically under "/boot/grub" and "/grub", unless + you specify the option `--prefix'. +* The utility `grub-install' recognizes a separate boot partition + automatically. +* New commands, "partnew" and "parttype". You can modify partition + tables with these commands. + +New in 0.5.95 - 2000-06-27: +* NetBSD ELF kernel support is added. You have to specify the new option + to the command "kernel". See below. +* Added a new option `--type=TYPE' into the command "kernel". This + option suggests what type of kernel you want to load. TYPE must be + either of "netbsd", "freebsd", "openbsd", "linux", "biglinux" and + "multiboot". Actually, this option will be necessary only if you want + to load a NetBSD ELF kernel, because GRUB can automatically determine + a kernel type in the other cases. +* ReiserFS support is added. +* Added a new option `--force-lba' into the command "install". This + option disables some sanity checks for LBA mode (but not all). If you + are sure that your machine supports LBA mode but GRUB doesn't work in + LBA mode, you should specify it. It is necessary if your BIOS is too + buggy. In the previous version, it was a compile-time option, but you + don't have to recompile GRUB any longer. +* Likewise, now the command "setup" and the script "grub-install" also + accept `--force-lba' option. Specifying this option to "setup" or + "grub-install" has the same effect as to the command "install". +* The configure script doesn't accept the option + `--disable-lba-support-bitmap-check' any longer. Use the option above. +* The network support is updated to Etherboot-4.6.1. So now we have + 3Com59x and DEPCA drivers. +* Now you can omit the configuration file argument to the command + "password". If you omit it, then GRUB will just unlock privileged + instructions (such as `c') when you enter a correct password. +* The new command "lock" can be used to prevent end-users from executing + arbitrary menu entries. This command will emit an error until the user + enters a correct password. +* Recognize the Linux extended partition type. +* Pass a correct memory size to Linux and *BSD. +* Diskless support is added. Now configure accepts --enable-diskless, + and "make" will produce two additional images, ``nbgrub'' for Net Boot + Image Proposal and ``pxegrub'' for Preboot Execution Environment. See + the documentation, for more details. +* The command "tftpserver" overrides a TFTP server address returned by a + BOOTP server, a DHCP server or a RARP server. +* Fix a serious bug about LBA support. It is possible that you don't + disable the LBA support bitmap check any longer. Please send a report, + if you must still disable it. We need to know if we should get rid of + the option. + +New in 0.5.94 - 2000-03-06: +* Stage 1 supports both the LBA mode and the CHS mode. +* The NetBSD and OpenBSD boot bug is fixed. +* The more automatic installation command "setup" is added. +* The command "embed" embeds a Stage 1.5 in the sectors after a MBR. +* Support symbolic color name syntax in the command "color". +* The grub shell loads the BIOS drive mapping information from a device + map file if it is specified and can be opened. If not found, try to + create it based on the guessed information. +* NetBSD support in the grub shell is improved. +* A simple checker for the format of a Multiboot kernel, ``mbchk'', is + added. +* The command "find" searches for a filename in all devices and print + the list of the devices which contain the file. +* The command "map" maps a drive to another drive so that we can + chain-load some foolish operating systems (such as DOS) even if such + an operating system resides at a non-first drive. +* The command "setkey" maps a key to another. +* The GRUB manual is rewritten, and now consists of three parts and + appendices. +* The command "ioprobe" detects what I/O ports are used for a BIOS + drive. +* OpenBSD support in the grub shell is improved. +* The command "install" can now patch a Stage 2 with a different + filename from "/boot/grub/menu.lst" even if a Stage 1.5 is used. +* New program, ``grub-install''. +* The command "blocklist" prints the blocklist notation of a file. +* The command "chainloader" now accepts an option "--force", which is + required if you want to chain-load a boot loader defective in the + signature, such as SCO Unixware 7.1. +* The netboot support is heavily rewritten, based on Etherboot-4.4.3. + Most of the device drivers are stolen from it, so we now have many + network drivers. See netboot/README.netboot for more details. +* Now configure accepts the option `--disable-lba-support-bitmap-check' + to ignore an incorrect LBA support bitmap returned by a buggy BIOS. If + you are sure that your BIOS does support LBA mode but GRUB doesn't + work in LBA mode, recompile GRUB with this option specified. You can + check if GRUB accesses a drive in LBA mode by the command "geometry". +* New commands "bootp", "dhcp" and "rarp" can be used to initialize a + network device and get IP addresses from a network. +* Long filename support in the FAT filesystem is added. +* The command "cmp" compares each bytes in two files. + +New in 0.5.93 - 1999-10-30: +* ELF format of FreeBSD kernel is supported. +* Support the partition ids for NetBSD and OpenBSD. +* Exit from the grub shell just by pushing the key `q' in the menu. +* New options for configure can disable some functions in Stage 2. See + the output from `configure --help' for more information. +* FAT32 support is added. +* Minix fs support is added. +* New commands "hide" and "unhide". +* The character `=' after a command is not necessary any longer, but it + is supported for backward compatibility. +* The command "help" displays helpful information about builtin + commands. +* The command "geometry" displays the information of a drive specified + and set the geometry to arbitrary C/H/S values if the optional + arguments are used. +* The command "configfile" loads a configuration file interactively. +* The command "device" assigns a BIOS drive to an arbitrary filename in + the grub shell. +* The option `--no-floppy' force the grub shell to assume that there is + no floppy, and the option `--probe-second-floppy' enables the probe of + the second floppy drive. +* Integrated the netboot support in the Dresden version of GRUB. +* FreeBSD support in the grub shell is improved. +* Killing (C-u and C-k), yanking (C-y) and manipulating the history + (C-p and C-n) are supported. +* The address argument for the command "install" is now optional. +* Better completion support. +* The command "cat" displays the contents of a file. + +New in 0.5.92 - 1999-07-26: +* Bug fixes (i.e. Stage 1.5 can work fine again). +* The /sbin/grub stage2 simulator now works at least on GNU/Linux, and + uses the Linux HDIO_GETGEO ioctl to determine hard disk geometry. +* TAB not only lists filenames, but also completes a filename when the + filename is unique. +* Password is not echoed back, put an asterisk for each of input + characters. +* stage2_debug is removed, and the debugging features are added into + stage2. +* Color menu support. +* New command "quit". +* The man page for /sbin/grub. +* All documents become Texinfo. +* Linux video mode selection is supported. +* The new Stage 1 `stage1_lba' supports LBA addressing mode. + +New in 0.5.91 - 1999-03-14, Gordon Matzigkeit: +* LBA and preliminary AWARD BIOS disk extension support. +* Started docs/grub.texi. +* /sbin/grub GUI now works (but it doesn't yet access disks properly). + Run `configure --enable-sbin-grub' to build this program in the grub + subdirectory. + +New in 0.5.90 - 1999-03-01, Gordon Matzigkeit: +* Bug fixes. +* GRUB understands symlinks on ext2fs (but still not ffs). +* Many source code and build cleanups to comply with GNU standards. + +New in 0.5 - 1998-08-20, Erich Boleyn: + +* Improved error messages in the stage1 to be strings (easier to read + than the previous case of single characters), and removed any + display in the case of no error (less confusing). + +* New document describing error conditions and messages. + +* Improved configure/build process. + +* Made the early bootup interrupt-safe. Wasn't doing cli/sti when + necessary sometimes. + +* GRUB now shuts off the floppy before transferring control to any + other programs/modules/loaders. (chain-loading doesn't matter here, + just loading 32-bit modules/kernels) + +* Fixed a few stupid bugs, including a several in the ext2fs code. + +* Linux boot format support extended from just "zImage" to include + "bzImage" and initial ramdisk (also called "initrd") support for + both. "initrd" support is untested, but the critical parts were + taken from a supplied patch and seem OK. + +* Several new command features. See the command-listing for details. + +New in 0.4 - 1998-03-19, Erich Boleyn: + +* GRUB now correctly points ES:SI at a partition descriptor when + chain-loading. + +* Many minor bugs fixed (some in the build scripts). + +* Intel MPS 1.4 config/check code is totally new, and the "syscmd=" + command is completely removed. Check command-listing for details. + +Version 0.4-pre, Erich Boleyn: + +* Reorganized docs, moved most "NOTE" items to a FAQ (with new entries + as well). + +* Now supports automatic decompression of any files loaded via the + GRUB stage2 filesystem code. Simply compress the file using GNU + gzip normally, then when loading, the GRUB internals will see the + contents in the decompressed state... i.e. all GRUB functions + operate normally as if it is the uncompressed file. An extra + version of the "module" loading function has been added which + disables this functionality if desired (in all the other cases, not + decompressing doesn't make sense). + +* Changed device strings used in filesystem code to more logical + format. Added "relative" disk and partition capability, see + command-listing and filesystem syntax description for details. + +* "install=" command vastly improved. Also moved to non-debug area. + Check command-listing and install documentation for details. + +* Added several new commands: "rootnoverify=", "uppermem=", and a new + debug command "displaymem". Check command-listing for details. + +* Added versioning numbers (and subsequently broke compatibility with + some of the previous code, so GRUB should be re-installed!). + +* Added unattended booting support via new "fallback=" command. + +* During debug probe of SMP configuration table compatible with Intel + MPS 1.4 standard, GRUB now checks for a pointer in the EBDA. + +* Using a "default=" entry greater than 11 caused the UI to do funny + things (it didn't pre-scroll the list to the appropriate place). + +* Reading files on FAT floppies had yet more problems related by many + users of version 0.3 6/17/96. Again, all known problems fixed. + +* "Extended" partitions now work (still cannot make an extended + partition active with "makeactive" command). + +* The build environment is greatly simplified, now using an + autoconf-like "configure" script. + +New in 0.3-19960617 - 1996-06-17, Erich Boleyn: + +* Yet more documentation improvements. + +* Known bugs in floppy operation fixed (12-bit FAT didn't work for + most cases, and inserting other floppies didn't flush the filesystem + cache). + +* NASTY uninitialized pointer bug causing "raw" floppy operation to + crash on several PCs is now fixed. This seems to have been the root + cause of all of the compatibility problems that have currently been + observed. + +* debug-mode command added to automate most difficult step of + installation for common cases (new install method #4). + +* Testing "mini-debugger" now merged with command-line when "DEBUG" + defined in compile (no SYSDEBUG option anymore). See description of + commands in the command-line for details. + +New in 0.3-19960602 - 1996-06-02, Erich Boleyn: + +* Completed initial licenses. + +* Initial filesystem documentation written. + +* Block-list and FAT filesystems now work as documented (in + particular, for the blocklist filesystem, shortcuts like "+1" for + "0+1,512" now work correctly). + +* Fixed several problems (old and new) in the various filesystems (for + example, the ext2fs filesystem code is now much faster, as it caches + some mapping blocks where it didn't at all before). Filesystem + semantics are much more uniform as well (symbolic links and reading + a directory as a file now return errors where it would silently fail + before). + +* "makeactive" now works for standard PC partitions on hard disks (not + extended partitions... so any PC partition number above 3 will give + a "no such partition" error). If a BSD sub-partition is is used, it + will ignore it, and only use the primary PC partition number. + +New in 0.3-19960520 - 1996-05-20, Erich Boleyn: + +* Updated instructions (though still very sparse). + +* New floppy probe (works much like the Linux floppy boot probe) + attempts to find the size of a floppy in a drive. Might still need + work! Please try on various floppy drives with various media! + +* New floppy handler will claim a non-existent drive if the floppy + disk isn't present in the drive. (for example, it won't be on the + list of installed drives unless a floppy is present) + +* Stage1 now compatible with both a hard disk MBR and the DOS BIOS + parameter block (see "install/README" for more details on how this + can be used). + +* Block-list filesystem partially works, as described in the file + "NOTES". Loading an a.out or elf kernel won't work with it, but all + other filetypes pretty much should. (certainly chain-loading works + OK) + + NOTE: you must use the full format "0+1,512" for just he first + block... no parameters can be implicit in this version.. THis is + being fixed too. + +* Linux ext2 filesystem works. (it's very slow for big files, but + this is being fixed) + +* Linux boot type now supported. Use a standard piggybacked image as + with LILO. Put in hack to support >64MB via GRUB placing the RAM + size as the first item on the command-line automatically. Must pass + root partition on command-line using normal Linux syntax... if not, + it uses it's builtin root partition. + +* Supports chain-loading. For details, see "COMMANDS" and the + examples directory. (was able to boot DOS and Windows NT on my test + box). NOTE that the "root partition" must be set to work right. + "makeactive" is currently a no-op. + +* Several weird bugs fixed. One important note: If you recompile, it + will warn about a clash with builtin "strcmp". This is normal... + do NOT remove the strcmp definition, as then GCC will possibly put + inline code from it's own builtin function in some places. (my + strcmp has slightly different functionality, hence the problem) + +* Mini-debugger is currently broken. + +New in 0.2 - 1996-04-12, Erich Boleyn: + +* Completely new menu-based UI. See "COMMANDS" and the examples + directory for details. NOTE that the argument to a command must be + preceded by a space between it and the '=', in both the config file + and the command-line. This will be fixed. + +New in 0.1 - 1996-03-31, Erich Boleyn: + +* Newer version of Multiboot Standard (version 0.6) supported. + +* Autodetects kernel types. Supports Multiboot, FreeBSD, NetBSD + (Linux isn't finished). + +* Stage 1.5 works now. Default setup is now for working with a BSD + FFS floppy loading "/grub/stage2" as the main bootloader. + +* Filesystem support improved. It didn't work on many floppies before + (problem with the partition-detection code). + +* Memory probe now supports arbitrary amounts of RAM (some technical + limitations exist, see Multiboot standard version 0.6 for details). + +* A mini-debugger is included by default, activated by hitting '~' on + the command-line (it might interfere with things, but it seems OK + for my alpha-testing). The commands are in the function + "enter_sysdebug" defined in "common.c". If you have an Intel MPS- + compatible machine, there are extra commands enabled for SMP cpu + testing. 'q' exits and goes back to what you were doing before. + +New in 0.0-19960206 - 1996-02-06, Erich Boleyn: + +* Newer version of Multiboot Standard (version 0.4) supported. + +New in 0.0-19951210 - 1995-12-10, Erich Boleyn: + +* You can now perform TAB-based completion listing of any valid + partially completed disk/partition/file-name combination. Try it + out to see what you like, examples are in the NOTES file under + "Device completion". + +* Fixed a bug causing the memory size routine to sometimes report + ridiculous values. + +* Fixed some documentation (what little there is :-/ and a few + assembly bugs in the BIOS access routines that nobody reported yet, + so I won't detail it here. diff --git a/usr/src/grub/grub-0.97/README b/usr/src/grub/grub-0.97/README new file mode 100644 index 0000000000..10233f729e --- /dev/null +++ b/usr/src/grub/grub-0.97/README @@ -0,0 +1,23 @@ +This is GNU GRUB, the GRand Unified Bootloader. GRUB is intended to +provide important bootloader features that are missing from typical +personal computer BIOSes: + + - provides fully-featured command line and graphical interfaces + - recognizes fdisk partitions and BSD disklabels + - can dynamically read Linux ext2fs, ReiserFS, JFS and XFS, BSD ufs, + MS-DOS FAT16 and FAT32, Minix fs, and VSTa fs filesystems, plus + hardcoded blocklists + - can boot Multiboot-compliant kernels (such as GNU Mach), as well + as standard Linux and *BSD kernels + +See the file NEWS for a description of recent changes to GRUB. + +If you are interested in the network support, see the file +README.netboot under the directory netboot. + +See the file INSTALL for instructions on how to build and install the +GRUB data and program files. See the GRUB manual for details about +using GRUB as your boot loader. Type "info grub" in the shell prompt. + +Please visit the official web page of GNU GRUB, for more information. +The URL is . diff --git a/usr/src/grub/grub-0.97/THANKS b/usr/src/grub/grub-0.97/THANKS new file mode 100644 index 0000000000..853da1a5ec --- /dev/null +++ b/usr/src/grub/grub-0.97/THANKS @@ -0,0 +1,123 @@ +GRUB would not be what it is today without the invaluable help of +everybody who was kind enough to spend time testing it and reporting +bugs. + +The following people made especially gracious contributions of their +time and energy in helping to track down bugs, add new features, and +generally assist in the GRUB maintainership process: + +Adam Lackorzynski +Adrian Phillips +Alban Crequy +Alessandro Rubini +Alexander K. Hudek +Alexander Langer +Alfred M. Szmidt +Andrew Clausen +Andrew Walrond +Ben Liblit +Bernhard Treutwein +Bodo Rueskamp . +Boji Tony Kannanthanam +Bradford Hovinen +Brian Brunswick +Bryan Ford +Cedric Ware +Chip Salzenberg +Christian Jones +Christoph Plattner +Damian Ivereigh +David Weinehall +Dan J. Walters +Daniel Farrell +Daniel Pittman +Daniel Wagner +Danilo Godec +Dennis Kitzman +Derrik Pates +Edmund GRIMLEY EVANS +Eduard Guzovsky +Edward Killips +Egmont Koblinger +Eric Hanchrow +Erik Schoenfelder +Eugene Doudine +Florian Hatat +Frank Mehnert +Gary Poppitz +Goran Koruga +Hal Snyder +HASEGAWA Tomoki +Heikki Vatiainen +Heiko Schroeder +Henrik Nordstrom +Herbert Nachtnebel +Hidetoshi Nishimaki +Hisazumi Kenji +HORIKAWA Kazunori +Ilguiz Latypov +Jan Fricke +Jan Zerebecki +Jason Thomas +Jean-Jacques Michel +Jeremy Katz +Jochen Hoenicke +Johannes Kroeger +John Goerzen +John Tobey +Josip Rodin +Julien Bordet +Julien Perrot +Kalle Olavi Niemitalo +Karsten Scheibler +KB Sriram +Khimenko Victor +Klaus Reichl +Kristoffer Branemyr +Kunihiro Ishiguro +Leendert Meyer +Leonid Lisovskiy +M. Meiarashi +Mark Kettenis +Mark Lundeberg +Matt Perry +Matt Yourst +Matthias Granberry +Matthias Kretschmer +Michael Hohmuth +Michael Sullivan +Mike Meyer +Miles Bader +NATORI Shin +Neal H Walfield +Neelkanth Natu +OKUJI Yoshinori +Pavel Roskin +Per Lundberg +Peter Astrand +Ralf Medow +Ramon van Handel +Robert Millan +Roderich Schupp +Rogelio M. Serrano Jr. +Sergey Matveychuk +Serguei Tzukanov +Stefan Ondrejicka +Stephen Early +Steven Dick +Sven Wegener +Takehiro Suzuki +Taketo Kabe +Thierry DELHAISE +Thierry Laronde +Thomas Schweikle +Thomas Schwinge +Tilmann Bubeck +Timothy Baldwin +Torsten Duwe +Uwe Dannowski +VaX#n8 +Vesa Jaaskelainen +Yedidyah Bar-David +Yury V. Umanets +Yuri Zaporogets diff --git a/usr/src/grub/grub-0.97/TODO b/usr/src/grub/grub-0.97/TODO new file mode 100644 index 0000000000..adbc8d0937 --- /dev/null +++ b/usr/src/grub/grub-0.97/TODO @@ -0,0 +1,102 @@ +-*- Mode: Outline -*- + +Before working on anything in this file, it's very important that you +make contact with the core GRUB developers. Things herein might be +slightly out of date or otherwise not easy to understand at first +glance. So write to first. + +Priorities: + Reported bugs generally have top priority. + Non-reported and non-encountered bugs (things we know don't work, + but don't really impede things) have lower priority. + Things in this file are ranked with one to three !; the more, the + higher priority. + + +Things that should be done before 1.0: + +* Finish the Multiboot Speicification 0.7. !!! + +* Add more --disable-FOO options to configure, so that you can create a + minimum GRUB image. This is useful for boot floppies because of the size + restriction. ! + +* Implement a new version of track_int13, using Virtual 8086 Mode. !!! + +* Add missing features of graphics support. !! + +Things that should _not_ be done before 1.0: + +* Add configuration inclusion support by adding a command "include". ! + +* Add automatic configuration support. + +* Add bunzip2 support. + +* Define the module system. + +* Add BSD syntax support, using results of ioprobe to map drives. ! + (0x1f0-0x1f7 = primary IDE, 0x170-0x176 = secondary, + 0x1e8-0x1ef = tertiary, 0x168-0x16f = quaternary). + +* Add a real scripting language, possibly retaining backward + compatibility so that old config files can be used. + +* Add internationalization support, emulating gettext as much as is + feasible. + +* Support other architectures than i386-pc. + +* Add real memory management. + + +Things that may be done anytime: + +* Port the script ``grub-install'' to OpenBSD. At least you will have to + modify the function `convert' so that it can translate a native device + name into the corresponding GRUB drive representation. ! + +* Add a command to run a GRUB script file. !! + +* Add commands to manipulate the menu from the command-line interface. ! + +* Make symbolic links work for BSD FFS. + +* Add indirect block support to the BSD FFS filesystem code, so files + larger than 16MB can be read. + +* Fix-up FreeBSD, NetBSD (and OpenBSD ?) command-line boot + parameters. + +* Support embedding a Stage 1.5 in the "bootloader" area of a FFS + partition. (We already have the code, but need an approval by an + expert before turning on the support. Any volunteers?) + +* Support embedding a Stage 1.5 in the EXT2_BOOT_LOADER_INO of an ext2fs + partition, so that it won't be accidentally erased or modified by + the kernel. + +* Add ISA PnP support. + +* Add more filesystems support (NTFS, etc.) + +* Add more remote console support (parallel and net). + +* Add (real) RAID support. + +? Add a partition naming syntax that means ``the first partition of + this type''. We need this for clean Hurd install floppies. + Nope. Improving the `find' command would solve this problem. + +* Add CDROM-chainloading support. It would be enough to support only + BIOSes which have bootable-CDROM support (so you may use the "Bootable + CDROM" BIOS calls). It is not trivial to support BIOSes without the + capability to boot CDROM. + +? Divide pxegrub into two parts, so the initial image doesn't exceed + the 32KB limit. I'm not sure if this is really necessary, because the + PXE standard just says that it is _recommended_ to improve the + modularity of a boot image. Obviously, this reason doesn't apply to + GRUB, as pxegrub is merely a secondary boot loader. So whether this + task should be done depends on if existing PXE ROMs support >32KB + images or not, after all. diff --git a/usr/src/grub/grub-0.97/acinclude.m4 b/usr/src/grub/grub-0.97/acinclude.m4 new file mode 100644 index 0000000000..368839cdf9 --- /dev/null +++ b/usr/src/grub/grub-0.97/acinclude.m4 @@ -0,0 +1,366 @@ +dnl grub_ASM_USCORE checks if C symbols get an underscore after +dnl compiling to assembler. +dnl Written by Pavel Roskin. Based on grub_ASM_EXT_C written by +dnl Erich Boleyn and modified by OKUJI Yoshinori +AC_DEFUN([grub_ASM_USCORE], +[AC_REQUIRE([AC_PROG_CC]) +AC_MSG_CHECKING([if C symbols get an underscore after compilation]) +AC_CACHE_VAL(grub_cv_asm_uscore, +[cat > conftest.c <<\EOF +int +func (int *list) +{ + *list = 0; + return *list; +} +EOF + +if AC_TRY_COMMAND([${CC-cc} ${CFLAGS} -S conftest.c]) && test -s conftest.s; then + true +else + AC_MSG_ERROR([${CC-cc} failed to produce assembly code]) +fi + +if grep _func conftest.s >/dev/null 2>&1; then + grub_cv_asm_uscore=yes +else + grub_cv_asm_uscore=no +fi + +rm -f conftest*]) + +if test "x$grub_cv_asm_uscore" = xyes; then + AC_DEFINE_UNQUOTED([HAVE_ASM_USCORE], $grub_cv_asm_uscore, + [Define if C symbols get an underscore after compilation]) +fi + +AC_MSG_RESULT([$grub_cv_asm_uscore]) +]) + + +dnl Some versions of `objcopy -O binary' vary their output depending +dnl on the link address. +AC_DEFUN([grub_PROG_OBJCOPY_ABSOLUTE], +[AC_MSG_CHECKING([whether ${OBJCOPY} works for absolute addresses]) +AC_CACHE_VAL(grub_cv_prog_objcopy_absolute, +[cat > conftest.c <<\EOF +void +cmain (void) +{ + *((int *) 0x1000) = 2; +} +EOF + +if AC_TRY_EVAL(ac_compile) && test -s conftest.o; then : +else + AC_MSG_ERROR([${CC-cc} cannot compile C source code]) +fi +grub_cv_prog_objcopy_absolute=yes +for link_addr in 2000 8000 7C00; do + if AC_TRY_COMMAND([${CC-cc} ${CFLAGS} -nostdlib -Wl,-N -Wl,-Ttext -Wl,$link_addr conftest.o -o conftest.exec]); then : + else + AC_MSG_ERROR([${CC-cc} cannot link at address $link_addr]) + fi + if AC_TRY_COMMAND([${OBJCOPY-objcopy} -O binary conftest.exec conftest]); then : + else + AC_MSG_ERROR([${OBJCOPY-objcopy} cannot create binary files]) + fi + if test ! -f conftest.old || AC_TRY_COMMAND([cmp -s conftest.old conftest]); then + mv -f conftest conftest.old + else + grub_cv_prog_objcopy_absolute=no + break + fi +done +rm -f conftest*]) +AC_MSG_RESULT([$grub_cv_prog_objcopy_absolute])]) + +dnl Mass confusion! +dnl Older versions of GAS interpret `.code16' to mean ``generate 32-bit +dnl instructions, but implicitly insert addr32 and data32 bytes so +dnl that the code works in real mode''. +dnl +dnl Newer versions of GAS interpret `.code16' to mean ``generate 16-bit +dnl instructions,'' which seems right. This requires the programmer +dnl to explicitly insert addr32 and data32 instructions when they want +dnl them. +dnl +dnl We only support the newer versions, because the old versions cause +dnl major pain, by requiring manual assembly to get 16-bit instructions into +dnl stage1/stage1.S. +AC_DEFUN([grub_ASM_ADDR32], +[AC_REQUIRE([AC_PROG_CC]) +AC_REQUIRE([grub_ASM_PREFIX_REQUIREMENT]) +AC_MSG_CHECKING([for .code16 addr32 assembler support]) +AC_CACHE_VAL(grub_cv_asm_addr32, +[cat > conftest.s.in <<\EOF + .code16 +l1: @ADDR32@ movb %al, l1 +EOF + +if test "x$grub_cv_asm_prefix_requirement" = xyes; then + sed -e s/@ADDR32@/addr32/ < conftest.s.in > conftest.s +else + sed -e s/@ADDR32@/addr32\;/ < conftest.s.in > conftest.s +fi + +if AC_TRY_COMMAND([${CC-cc} ${CFLAGS} -c conftest.s]) && test -s conftest.o; then + grub_cv_asm_addr32=yes +else + grub_cv_asm_addr32=no +fi + +rm -f conftest*]) + +AC_MSG_RESULT([$grub_cv_asm_addr32])]) + +dnl +dnl Later versions of GAS requires that addr32 and data32 prefixes +dnl appear in the same lines as the instructions they modify, while +dnl earlier versions requires that they appear in separate lines. +AC_DEFUN([grub_ASM_PREFIX_REQUIREMENT], +[AC_REQUIRE([AC_PROG_CC]) +AC_MSG_CHECKING(dnl +[whether addr32 must be in the same line as the instruction]) +AC_CACHE_VAL(grub_cv_asm_prefix_requirement, +[cat > conftest.s <<\EOF + .code16 +l1: addr32 movb %al, l1 +EOF + +if AC_TRY_COMMAND([${CC-cc} ${CFLAGS} -c conftest.s]) && test -s conftest.o; then + grub_cv_asm_prefix_requirement=yes +else + grub_cv_asm_prefix_requirement=no +fi + +rm -f conftest*]) + +if test "x$grub_cv_asm_prefix_requirement" = xyes; then + grub_tmp_addr32="addr32" + grub_tmp_data32="data32" +else + grub_tmp_addr32="addr32;" + grub_tmp_data32="data32;" +fi + +AC_DEFINE_UNQUOTED([ADDR32], $grub_tmp_addr32, + [Define it to \"addr32\" or \"addr32;\" to make GAS happy]) +AC_DEFINE_UNQUOTED([DATA32], $grub_tmp_data32, + [Define it to \"data32\" or \"data32;\" to make GAS happy]) + +AC_MSG_RESULT([$grub_cv_asm_prefix_requirement])]) + +dnl +dnl Older versions of GAS require that absolute indirect calls/jumps are +dnl not prefixed with `*', while later versions warn if not prefixed. +AC_DEFUN([grub_ASM_ABSOLUTE_WITHOUT_ASTERISK], +[AC_REQUIRE([AC_PROG_CC]) +AC_MSG_CHECKING(dnl +[whether an absolute indirect call/jump must not be prefixed with an asterisk]) +AC_CACHE_VAL(grub_cv_asm_absolute_without_asterisk, +[cat > conftest.s <<\EOF + lcall *(offset) +offset: + .long 0 + .word 0 +EOF + +if AC_TRY_COMMAND([${CC-cc} ${CFLAGS} -c conftest.s]) && test -s conftest.o; then + grub_cv_asm_absolute_without_asterisk=no +else + grub_cv_asm_absolute_without_asterisk=yes +fi + +rm -f conftest*]) + +if test "x$grub_cv_asm_absolute_without_asterisk" = xyes; then + AC_DEFINE(ABSOLUTE_WITHOUT_ASTERISK, 1, [Define if an absolute indirect call/jump must NOT be prefixed with `*']) +fi + +AC_MSG_RESULT([$grub_cv_asm_absolute_without_asterisk])]) + +dnl +dnl grub_CHECK_START_SYMBOL checks if start is automatically defined by +dnl the compiler. +dnl Written by OKUJI Yoshinori +AC_DEFUN([grub_CHECK_START_SYMBOL], +[AC_REQUIRE([AC_PROG_CC]) +AC_MSG_CHECKING([if start is defined by the compiler]) +AC_CACHE_VAL(grub_cv_check_start_symbol, +[AC_TRY_LINK([], [asm ("incl start")], + grub_cv_check_start_symbol=yes, + grub_cv_check_start_symbol=no)]) + +if test "x$grub_cv_check_start_symbol" = xyes; then + AC_DEFINE(HAVE_START_SYMBOL, 1, [Define if start is defined]) +fi + +AC_MSG_RESULT([$grub_cv_check_start_symbol]) +]) + +dnl +dnl grub_CHECK_USCORE_START_SYMBOL checks if _start is automatically +dnl defined by the compiler. +dnl Written by OKUJI Yoshinori +AC_DEFUN([grub_CHECK_USCORE_START_SYMBOL], +[AC_REQUIRE([AC_PROG_CC]) +AC_MSG_CHECKING([if _start is defined by the compiler]) +AC_CACHE_VAL(grub_cv_check_uscore_start_symbol, +[AC_TRY_LINK([], [asm ("incl _start")], + grub_cv_check_uscore_start_symbol=yes, + grub_cv_check_uscore_start_symbol=no)]) + +if test "x$grub_cv_check_uscore_start_symbol" = xyes; then + AC_DEFINE(HAVE_USCORE_START_SYMBOL, 1, [Define if _start is defined]) +fi + +AC_MSG_RESULT([$grub_cv_check_uscore_start_symbol]) +]) + +dnl +dnl grub_CHECK_USCORE_USCORE_BSS_START_SYMBOL checks if __bss_start is +dnl automatically defined by the compiler. +dnl Written by Michael Hohmoth. +AC_DEFUN([grub_CHECK_USCORE_USCORE_BSS_START_SYMBOL], +[AC_REQUIRE([AC_PROG_CC]) +AC_MSG_CHECKING([if __bss_start is defined by the compiler]) +AC_CACHE_VAL(grub_cv_check_uscore_uscore_bss_start_symbol, +[AC_TRY_LINK([], [asm ("incl __bss_start")], + grub_cv_check_uscore_uscore_bss_start_symbol=yes, + grub_cv_check_uscore_uscore_bss_start_symbol=no)]) + +if test "x$grub_cv_check_uscore_uscore_bss_start_symbol" = xyes; then + AC_DEFINE(HAVE_USCORE_USCORE_BSS_START_SYMBOL, 1, [Define if __bss_start is defined]) +fi + +AC_MSG_RESULT([$grub_cv_check_uscore_uscore_bss_start_symbol]) +]) + +dnl +dnl grub_CHECK_EDATA_SYMBOL checks if edata is automatically defined by the +dnl compiler. +dnl Written by Michael Hohmuth. +AC_DEFUN([grub_CHECK_EDATA_SYMBOL], +[AC_REQUIRE([AC_PROG_CC]) +AC_MSG_CHECKING([if edata is defined by the compiler]) +AC_CACHE_VAL(grub_cv_check_edata_symbol, +[AC_TRY_LINK([], [asm ("incl edata")], + grub_cv_check_edata_symbol=yes, + grub_cv_check_edata_symbol=no)]) + +if test "x$grub_cv_check_edata_symbol" = xyes; then + AC_DEFINE(HAVE_EDATA_SYMBOL, 1, [Define if edata is defined]) +fi + +AC_MSG_RESULT([$grub_cv_check_edata_symbol]) +]) + +dnl +dnl grub_CHECK_USCORE_EDATA_SYMBOL checks if _edata is automatically +dnl defined by the compiler. +dnl Written by Michael Hohmuth. +AC_DEFUN([grub_CHECK_USCORE_EDATA_SYMBOL], +[AC_REQUIRE([AC_PROG_CC]) +AC_MSG_CHECKING([if _edata is defined by the compiler]) +AC_CACHE_VAL(grub_cv_check_uscore_edata_symbol, +[AC_TRY_LINK([], [asm ("incl _edata")], + grub_cv_check_uscore_edata_symbol=yes, + grub_cv_check_uscore_edata_symbol=no)]) + +if test "x$grub_cv_check_uscore_edata_symbol" = xyes; then + AC_DEFINE(HAVE_USCORE_EDATA_SYMBOL, 1, [Define if _edata is defined]) +fi + +AC_MSG_RESULT([$grub_cv_check_uscore_edata_symbol]) +]) + +dnl +dnl grub_CHECK_END_SYMBOL checks if end is automatically defined by the +dnl compiler. +dnl Written by OKUJI Yoshinori +AC_DEFUN([grub_CHECK_END_SYMBOL], +[AC_REQUIRE([AC_PROG_CC]) +AC_MSG_CHECKING([if end is defined by the compiler]) +AC_CACHE_VAL(grub_cv_check_end_symbol, +[AC_TRY_LINK([], [asm ("incl end")], + grub_cv_check_end_symbol=yes, + grub_cv_check_end_symbol=no)]) + +if test "x$grub_cv_check_end_symbol" = xyes; then + AC_DEFINE(HAVE_END_SYMBOL, 1, [Define if end is defined]) +fi + +AC_MSG_RESULT([$grub_cv_check_end_symbol]) +]) + +dnl +dnl grub_CHECK_USCORE_END_SYMBOL checks if _end is automatically defined +dnl by the compiler. +dnl Written by OKUJI Yoshinori +AC_DEFUN([grub_CHECK_USCORE_END_SYMBOL], +[AC_REQUIRE([AC_PROG_CC]) +AC_MSG_CHECKING([if _end is defined by the compiler]) +AC_CACHE_VAL(grub_cv_check_uscore_end_symbol, +[AC_TRY_LINK([], [asm ("incl _end")], + grub_cv_check_uscore_end_symbol=yes, + grub_cv_check_uscore_end_symbol=no)]) + +if test "x$grub_cv_check_uscore_end_symbol" = xyes; then + AC_DEFINE(HAVE_USCORE_END_SYMBOL, 1, [Define if end is defined]) +fi + +AC_MSG_RESULT([$grub_cv_check_uscore_end_symbol]) +]) + +dnl grub_DEFINE_FILE(MACRO_NAME, FILE_NAME, DESCRIPTION) +dnl grub_DEFINE_FILE defines a macro as the contents of a file safely. +dnl Replace some escape sequences, because autoconf doesn't handle them +dnl gracefully. +dnl Written by OKUJI Yoshinori. +AC_DEFUN([grub_DEFINE_FILE], +[AC_REQUIRE([AC_PROG_CC]) +# Because early versions of GNU sed 3.x are too buggy, use a C program +# instead of shell commands. *sigh* +cat >conftest.c <<\EOF +#include + +int +main (void) +{ + int c; + + while ((c = getchar ()) != EOF) + { + switch (c) + { + case '\n': + fputs ("\\n", stdout); + break; + case '\r': + fputs ("\\r", stdout); + break; + case '\\': + fputs ("\\\\", stdout); + break; + case '"': + fputs ("\\\"", stdout); + break; + default: + putchar (c); + } + } + + return 0; +} +EOF + +if AC_TRY_COMMAND([${CC-cc} ${CFLAGS} conftest.c -o conftest]) && test -s conftest; then + grub_tmp_value=`./conftest < "[$2]"` +else + AC_MSG_ERROR([${CC-cc} failed to produce an executable file]) +fi + +AC_DEFINE_UNQUOTED([$1], "$grub_tmp_value", [$3]) +rm -f conftest* +]) diff --git a/usr/src/grub/grub-0.97/aclocal.m4 b/usr/src/grub/grub-0.97/aclocal.m4 new file mode 100644 index 0000000000..aa691f6183 --- /dev/null +++ b/usr/src/grub/grub-0.97/aclocal.m4 @@ -0,0 +1,1061 @@ +# generated automatically by aclocal 1.9.4 -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 +# Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +# -*- Autoconf -*- +# Copyright (C) 2002, 2003 Free Software Foundation, Inc. +# Generated from amversion.in; do not edit by hand. + +# 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. + +# 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 + +# AM_AUTOMAKE_VERSION(VERSION) +# ---------------------------- +# Automake X.Y traces this macro to ensure aclocal.m4 has been +# generated from the m4 files accompanying Automake X.Y. +AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"]) + +# AM_SET_CURRENT_AUTOMAKE_VERSION +# ------------------------------- +# Call AM_AUTOMAKE_VERSION so it can be traced. +# This function is AC_REQUIREd by AC_INIT_AUTOMAKE. +AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], + [AM_AUTOMAKE_VERSION([1.9.4])]) + +# AM_AUX_DIR_EXPAND + +# Copyright (C) 2001, 2003 Free Software Foundation, 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, 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. + +# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets +# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to +# `$srcdir', `$srcdir/..', or `$srcdir/../..'. +# +# Of course, Automake must honor this variable whenever it calls a +# tool from the auxiliary directory. The problem is that $srcdir (and +# therefore $ac_aux_dir as well) can be either absolute or relative, +# depending on how configure is run. This is pretty annoying, since +# it makes $ac_aux_dir quite unusable in subdirectories: in the top +# source directory, any form will work fine, but in subdirectories a +# relative path needs to be adjusted first. +# +# $ac_aux_dir/missing +# fails when called from a subdirectory if $ac_aux_dir is relative +# $top_srcdir/$ac_aux_dir/missing +# fails if $ac_aux_dir is absolute, +# fails when called from a subdirectory in a VPATH build with +# a relative $ac_aux_dir +# +# The reason of the latter failure is that $top_srcdir and $ac_aux_dir +# are both prefixed by $srcdir. In an in-source build this is usually +# harmless because $srcdir is `.', but things will broke when you +# start a VPATH build or use an absolute $srcdir. +# +# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, +# iff we strip the leading $srcdir from $ac_aux_dir. That would be: +# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` +# and then we would define $MISSING as +# MISSING="\${SHELL} $am_aux_dir/missing" +# This will work as long as MISSING is not called from configure, because +# unfortunately $(top_srcdir) has no meaning in configure. +# However there are other variables, like CC, which are often used in +# configure, and could therefore not use this "fixed" $ac_aux_dir. +# +# Another solution, used here, is to always expand $ac_aux_dir to an +# absolute PATH. The drawback is that using absolute paths prevent a +# configured tree to be moved without reconfiguration. + +AC_DEFUN([AM_AUX_DIR_EXPAND], +[dnl Rely on autoconf to set up CDPATH properly. +AC_PREREQ([2.50])dnl +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` +]) + +# AM_CONDITIONAL -*- Autoconf -*- + +# Copyright (C) 1997, 2000, 2001, 2003, 2004 Free Software Foundation, 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, 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. + +# serial 6 + +# AM_CONDITIONAL(NAME, SHELL-CONDITION) +# ------------------------------------- +# Define a conditional. +AC_DEFUN([AM_CONDITIONAL], +[AC_PREREQ(2.52)dnl + ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], + [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl +AC_SUBST([$1_TRUE]) +AC_SUBST([$1_FALSE]) +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi +AC_CONFIG_COMMANDS_PRE( +[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then + AC_MSG_ERROR([[conditional "$1" was never defined. +Usually this means the macro was only invoked conditionally.]]) +fi])]) + +# serial 7 -*- Autoconf -*- + +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 +# Free Software Foundation, 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, 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. + + +# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be +# written in clear, in which case automake, when reading aclocal.m4, +# will think it sees a *use*, and therefore will trigger all it's +# C support machinery. Also note that it means that autoscan, seeing +# CC etc. in the Makefile, will ask for an AC_PROG_CC use... + + + +# _AM_DEPENDENCIES(NAME) +# ---------------------- +# See how the compiler implements dependency checking. +# NAME is "CC", "CXX", "GCJ", or "OBJC". +# We try a few techniques and use that to set a single cache variable. +# +# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was +# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular +# dependency, and given that the user is not expected to run this macro, +# just rely on AC_PROG_CC. +AC_DEFUN([_AM_DEPENDENCIES], +[AC_REQUIRE([AM_SET_DEPDIR])dnl +AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl +AC_REQUIRE([AM_MAKE_INCLUDE])dnl +AC_REQUIRE([AM_DEP_TRACK])dnl + +ifelse([$1], CC, [depcc="$CC" am_compiler_list=], + [$1], CXX, [depcc="$CXX" am_compiler_list=], + [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], + [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], + [depcc="$$1" am_compiler_list=]) + +AC_CACHE_CHECK([dependency style of $depcc], + [am_cv_$1_dependencies_compiler_type], +[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_$1_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` + fi + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_$1_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_$1_dependencies_compiler_type=none +fi +]) +AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) +AM_CONDITIONAL([am__fastdep$1], [ + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) +]) + + +# AM_SET_DEPDIR +# ------------- +# Choose a directory name for dependency files. +# This macro is AC_REQUIREd in _AM_DEPENDENCIES +AC_DEFUN([AM_SET_DEPDIR], +[AC_REQUIRE([AM_SET_LEADING_DOT])dnl +AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl +]) + + +# AM_DEP_TRACK +# ------------ +AC_DEFUN([AM_DEP_TRACK], +[AC_ARG_ENABLE(dependency-tracking, +[ --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors]) +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' +fi +AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) +AC_SUBST([AMDEPBACKSLASH]) +]) + +# Generate code to set up dependency tracking. -*- Autoconf -*- + +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 +# Free Software Foundation, 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, 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. + +#serial 2 + +# _AM_OUTPUT_DEPENDENCY_COMMANDS +# ------------------------------ +AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], +[for mf in $CONFIG_FILES; do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # So let's grep whole file. + if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then + dirpart=`AS_DIRNAME("$mf")` + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n 's/^U = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`AS_DIRNAME(["$file"])` + AS_MKDIR_P([$dirpart/$fdir]) + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done +done +])# _AM_OUTPUT_DEPENDENCY_COMMANDS + + +# AM_OUTPUT_DEPENDENCY_COMMANDS +# ----------------------------- +# This macro should only be invoked once -- use via AC_REQUIRE. +# +# This code is only required when automatic dependency tracking +# is enabled. FIXME. This creates each `.P' file that we will +# need in order to bootstrap the dependency handling code. +AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], +[AC_CONFIG_COMMANDS([depfiles], + [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], + [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) +]) + +# Do all the work for Automake. -*- Autoconf -*- + +# This macro actually does too much some checks are only needed if +# your package does certain things. But this isn't really a big deal. + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 +# Free Software Foundation, 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, 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. + +# serial 11 + +# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) +# AM_INIT_AUTOMAKE([OPTIONS]) +# ----------------------------------------------- +# The call with PACKAGE and VERSION arguments is the old style +# call (pre autoconf-2.50), which is being phased out. PACKAGE +# and VERSION should now be passed to AC_INIT and removed from +# the call to AM_INIT_AUTOMAKE. +# We support both call styles for the transition. After +# the next Automake release, Autoconf can make the AC_INIT +# arguments mandatory, and then we can depend on a new Autoconf +# release and drop the old call support. +AC_DEFUN([AM_INIT_AUTOMAKE], +[AC_PREREQ([2.58])dnl +dnl Autoconf wants to disallow AM_ names. We explicitly allow +dnl the ones we care about. +m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl +AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl +AC_REQUIRE([AC_PROG_INSTALL])dnl +# test to see if srcdir already configured +if test "`cd $srcdir && pwd`" != "`pwd`" && + test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi +AC_SUBST([CYGPATH_W]) + +# Define the identity of the package. +dnl Distinguish between old-style and new-style calls. +m4_ifval([$2], +[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl + AC_SUBST([PACKAGE], [$1])dnl + AC_SUBST([VERSION], [$2])], +[_AM_SET_OPTIONS([$1])dnl + AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl + AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl + +_AM_IF_OPTION([no-define],, +[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) + AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl + +# Some tools Automake needs. +AC_REQUIRE([AM_SANITY_CHECK])dnl +AC_REQUIRE([AC_ARG_PROGRAM])dnl +AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) +AM_MISSING_PROG(AUTOCONF, autoconf) +AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) +AM_MISSING_PROG(AUTOHEADER, autoheader) +AM_MISSING_PROG(MAKEINFO, makeinfo) +AM_PROG_INSTALL_SH +AM_PROG_INSTALL_STRIP +AC_REQUIRE([AM_PROG_MKDIR_P])dnl +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +AC_REQUIRE([AC_PROG_AWK])dnl +AC_REQUIRE([AC_PROG_MAKE_SET])dnl +AC_REQUIRE([AM_SET_LEADING_DOT])dnl +_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], + [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], + [_AM_PROG_TAR([v7])])]) +_AM_IF_OPTION([no-dependencies],, +[AC_PROVIDE_IFELSE([AC_PROG_CC], + [_AM_DEPENDENCIES(CC)], + [define([AC_PROG_CC], + defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl +AC_PROVIDE_IFELSE([AC_PROG_CXX], + [_AM_DEPENDENCIES(CXX)], + [define([AC_PROG_CXX], + defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl +]) +]) + + +# When config.status generates a header, we must update the stamp-h file. +# This file resides in the same directory as the config header +# that is generated. The stamp files are numbered to have different names. + +# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the +# loop where config.status creates the headers, so we can generate +# our stamp files there. +AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], +[# Compute $1's index in $config_headers. +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $1 | $1:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count]) + +# AM_PROG_INSTALL_SH +# ------------------ +# Define $install_sh. + +# Copyright (C) 2001, 2003 Free Software Foundation, 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, 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. + +AC_DEFUN([AM_PROG_INSTALL_SH], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +install_sh=${install_sh-"$am_aux_dir/install-sh"} +AC_SUBST(install_sh)]) + +# -*- Autoconf -*- +# Copyright (C) 2003 Free Software Foundation, 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, 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. + +# serial 1 + +# Check whether the underlying file-system supports filenames +# with a leading dot. For instance MS-DOS doesn't. +AC_DEFUN([AM_SET_LEADING_DOT], +[rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null +AC_SUBST([am__leading_dot])]) + +# Add --enable-maintainer-mode option to configure. +# From Jim Meyering + +# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004 +# Free Software Foundation, 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, 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. + +# serial 3 + +AC_DEFUN([AM_MAINTAINER_MODE], +[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) + dnl maintainer-mode is disabled by default + AC_ARG_ENABLE(maintainer-mode, +[ --enable-maintainer-mode enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer], + USE_MAINTAINER_MODE=$enableval, + USE_MAINTAINER_MODE=no) + AC_MSG_RESULT([$USE_MAINTAINER_MODE]) + AM_CONDITIONAL(MAINTAINER_MODE, [test $USE_MAINTAINER_MODE = yes]) + MAINT=$MAINTAINER_MODE_TRUE + AC_SUBST(MAINT)dnl +] +) + +AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE]) + +# Check to see how 'make' treats includes. -*- Autoconf -*- + +# Copyright (C) 2001, 2002, 2003 Free Software Foundation, 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, 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. + +# serial 2 + +# AM_MAKE_INCLUDE() +# ----------------- +# Check to see how make treats includes. +AC_DEFUN([AM_MAKE_INCLUDE], +[am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo done +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +AC_MSG_CHECKING([for style of include used by $am_make]) +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# We grep out `Entering directory' and `Leaving directory' +# messages which can occur if `w' ends up in MAKEFLAGS. +# In particular we don't look at `^make:' because GNU make might +# be invoked under some other name (usually "gmake"), in which +# case it prints its new name instead of `make'. +if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then + am__include=include + am__quote= + _am_result=GNU +fi +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then + am__include=.include + am__quote="\"" + _am_result=BSD + fi +fi +AC_SUBST([am__include]) +AC_SUBST([am__quote]) +AC_MSG_RESULT([$_am_result]) +rm -f confinc confmf +]) + +# -*- Autoconf -*- + + +# Copyright (C) 1997, 1999, 2000, 2001, 2003 Free Software Foundation, 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, 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. + +# serial 3 + +# AM_MISSING_PROG(NAME, PROGRAM) +# ------------------------------ +AC_DEFUN([AM_MISSING_PROG], +[AC_REQUIRE([AM_MISSING_HAS_RUN]) +$1=${$1-"${am_missing_run}$2"} +AC_SUBST($1)]) + + +# AM_MISSING_HAS_RUN +# ------------------ +# Define MISSING if not defined so far and test if it supports --run. +# If it does, set am_missing_run to use it, otherwise, to nothing. +AC_DEFUN([AM_MISSING_HAS_RUN], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + AC_MSG_WARN([`missing' script is too old or missing]) +fi +]) + +# AM_PROG_MKDIR_P +# --------------- +# Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise. + +# Copyright (C) 2003, 2004 Free Software Foundation, 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, 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. + +# Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories +# created by `make install' are always world readable, even if the +# installer happens to have an overly restrictive umask (e.g. 077). +# This was a mistake. There are at least two reasons why we must not +# use `-m 0755': +# - it causes special bits like SGID to be ignored, +# - it may be too restrictive (some setups expect 775 directories). +# +# Do not use -m 0755 and let people choose whatever they expect by +# setting umask. +# +# We cannot accept any implementation of `mkdir' that recognizes `-p'. +# Some implementations (such as Solaris 8's) are not thread-safe: if a +# parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c' +# concurrently, both version can detect that a/ is missing, but only +# one can create it and the other will error out. Consequently we +# restrict ourselves to GNU make (using the --version option ensures +# this.) +AC_DEFUN([AM_PROG_MKDIR_P], +[if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then + # We used to keeping the `.' as first argument, in order to + # allow $(mkdir_p) to be used without argument. As in + # $(mkdir_p) $(somedir) + # where $(somedir) is conditionally defined. However this is wrong + # for two reasons: + # 1. if the package is installed by a user who cannot write `.' + # make install will fail, + # 2. the above comment should most certainly read + # $(mkdir_p) $(DESTDIR)$(somedir) + # so it does not work when $(somedir) is undefined and + # $(DESTDIR) is not. + # To support the latter case, we have to write + # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), + # so the `.' trick is pointless. + mkdir_p='mkdir -p --' +else + # On NextStep and OpenStep, the `mkdir' command does not + # recognize any option. It will interpret all options as + # directories to create, and then abort because `.' already + # exists. + for d in ./-p ./--version; + do + test -d $d && rmdir $d + done + # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. + if test -f "$ac_aux_dir/mkinstalldirs"; then + mkdir_p='$(mkinstalldirs)' + else + mkdir_p='$(install_sh) -d' + fi +fi +AC_SUBST([mkdir_p])]) + +# Helper functions for option handling. -*- Autoconf -*- + +# Copyright (C) 2001, 2002, 2003 Free Software Foundation, 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, 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. + +# serial 2 + +# _AM_MANGLE_OPTION(NAME) +# ----------------------- +AC_DEFUN([_AM_MANGLE_OPTION], +[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) + +# _AM_SET_OPTION(NAME) +# ------------------------------ +# Set option NAME. Presently that only means defining a flag for this option. +AC_DEFUN([_AM_SET_OPTION], +[m4_define(_AM_MANGLE_OPTION([$1]), 1)]) + +# _AM_SET_OPTIONS(OPTIONS) +# ---------------------------------- +# OPTIONS is a space-separated list of Automake options. +AC_DEFUN([_AM_SET_OPTIONS], +[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) + +# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) +# ------------------------------------------- +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. +AC_DEFUN([_AM_IF_OPTION], +[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) + +# +# Check to make sure that the build environment is sane. +# + +# Copyright (C) 1996, 1997, 2000, 2001, 2003 Free Software Foundation, 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, 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. + +# serial 3 + +# AM_SANITY_CHECK +# --------------- +AC_DEFUN([AM_SANITY_CHECK], +[AC_MSG_CHECKING([whether build environment is sane]) +# Just in case +sleep 1 +echo timestamp > conftest.file +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` + if test "$[*]" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftest.file` + fi + rm -f conftest.file + if test "$[*]" != "X $srcdir/configure conftest.file" \ + && test "$[*]" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken +alias in your environment]) + fi + + test "$[2]" = conftest.file + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +AC_MSG_RESULT(yes)]) + +# AM_PROG_INSTALL_STRIP + +# Copyright (C) 2001, 2003 Free Software Foundation, 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, 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. + +# One issue with vendor `install' (even GNU) is that you can't +# specify the program used to strip binaries. This is especially +# annoying in cross-compiling environments, where the build's strip +# is unlikely to handle the host's binaries. +# Fortunately install-sh will honor a STRIPPROG variable, so we +# always use install-sh in `make install-strip', and initialize +# STRIPPROG with the value of the STRIP variable (set by the user). +AC_DEFUN([AM_PROG_INSTALL_STRIP], +[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +dnl Don't test for $cross_compiling = yes, because it might be `maybe'. +if test "$cross_compiling" != no; then + AC_CHECK_TOOL([STRIP], [strip], :) +fi +INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" +AC_SUBST([INSTALL_STRIP_PROGRAM])]) + +# Check how to create a tarball. -*- Autoconf -*- + +# Copyright (C) 2004 Free Software Foundation, 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, 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. + +# serial 1 + + +# _AM_PROG_TAR(FORMAT) +# -------------------- +# Check how to create a tarball in format FORMAT. +# FORMAT should be one of `v7', `ustar', or `pax'. +# +# Substitute a variable $(am__tar) that is a command +# writing to stdout a FORMAT-tarball containing the directory +# $tardir. +# tardir=directory && $(am__tar) > result.tar +# +# Substitute a variable $(am__untar) that extract such +# a tarball read from stdin. +# $(am__untar) < result.tar +AC_DEFUN([_AM_PROG_TAR], +[# Always define AMTAR for backward compatibility. +AM_MISSING_PROG([AMTAR], [tar]) +m4_if([$1], [v7], + [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], + [m4_case([$1], [ustar],, [pax],, + [m4_fatal([Unknown tar format])]) +AC_MSG_CHECKING([how to create a $1 tar archive]) +# Loop over all known methods to create a tar archive until one works. +_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' +_am_tools=${am_cv_prog_tar_$1-$_am_tools} +# Do not fold the above two line into one, because Tru64 sh and +# Solaris sh will not grok spaces in the rhs of `-'. +for _am_tool in $_am_tools +do + case $_am_tool in + gnutar) + for _am_tar in tar gnutar gtar; + do + AM_RUN_LOG([$_am_tar --version]) && break + done + am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' + am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' + am__untar="$_am_tar -xf -" + ;; + plaintar) + # Must skip GNU tar: if it does not support --format= it doesn't create + # ustar tarball either. + (tar --version) >/dev/null 2>&1 && continue + am__tar='tar chf - "$$tardir"' + am__tar_='tar chf - "$tardir"' + am__untar='tar xf -' + ;; + pax) + am__tar='pax -L -x $1 -w "$$tardir"' + am__tar_='pax -L -x $1 -w "$tardir"' + am__untar='pax -r' + ;; + cpio) + am__tar='find "$$tardir" -print | cpio -o -H $1 -L' + am__tar_='find "$tardir" -print | cpio -o -H $1 -L' + am__untar='cpio -i -H $1 -d' + ;; + none) + am__tar=false + am__tar_=false + am__untar=false + ;; + esac + + # If the value was cached, stop now. We just wanted to have am__tar + # and am__untar set. + test -n "${am_cv_prog_tar_$1}" && break + + # tar/untar a dummy directory, and stop if the command works + rm -rf conftest.dir + mkdir conftest.dir + echo GrepMe > conftest.dir/file + AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) + rm -rf conftest.dir + if test -s conftest.tar; then + AM_RUN_LOG([$am__untar /dev/null 2>&1 && break + fi +done +rm -rf conftest.dir + +AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) +AC_MSG_RESULT([$am_cv_prog_tar_$1])]) +AC_SUBST([am__tar]) +AC_SUBST([am__untar]) +]) # _AM_PROG_TAR + +m4_include([acinclude.m4]) diff --git a/usr/src/grub/grub-0.97/compile b/usr/src/grub/grub-0.97/compile new file mode 100755 index 0000000000..3d2170320e --- /dev/null +++ b/usr/src/grub/grub-0.97/compile @@ -0,0 +1,142 @@ +#! /bin/sh +# Wrapper for compilers which do not understand `-c -o'. + +scriptversion=2004-10-12.08 + +# Copyright (C) 1999, 2000, 2003, 2004 Free Software Foundation, Inc. +# Written by Tom Tromey . +# +# 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. +# +# 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. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# This file is maintained in Automake, please report +# bugs to or send patches to +# . + +case $1 in + '') + echo "$0: No command. Try \`$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: compile [--help] [--version] PROGRAM [ARGS] + +Wrapper for compilers which do not understand `-c -o'. +Remove `-o dest.o' from ARGS, run PROGRAM with the remaining +arguments, and rename the output as expected. + +If you are trying to build a whole package this is not the +right script to run: please start by reading the file `INSTALL'. + +Report bugs to . +EOF + exit 0 + ;; + -v | --v*) + echo "compile $scriptversion" + exit 0 + ;; +esac + +ofile= +cfile= +eat= + +for arg +do + if test -n "$eat"; then + eat= + else + case $1 in + -o) + # configure might choose to run compile as `compile cc -o foo foo.c'. + # So we strip `-o arg' only if arg is an object. + eat=1 + case $2 in + *.o | *.obj) + ofile=$2 + ;; + *) + set x "$@" -o "$2" + shift + ;; + esac + ;; + *.c) + cfile=$1 + set x "$@" "$1" + shift + ;; + *) + set x "$@" "$1" + shift + ;; + esac + fi + shift +done + +if test -z "$ofile" || test -z "$cfile"; then + # If no `-o' option was seen then we might have been invoked from a + # pattern rule where we don't need one. That is ok -- this is a + # normal compilation that the losing compiler can handle. If no + # `.c' file was seen then we are probably linking. That is also + # ok. + exec "$@" +fi + +# Name of file we expect compiler to create. +cofile=`echo "$cfile" | sed -e 's|^.*/||' -e 's/\.c$/.o/'` + +# Create the lock directory. +# Note: use `[/.-]' here to ensure that we don't use the same name +# that we are using for the .o file. Also, base the name on the expected +# object file name, since that is what matters with a parallel build. +lockdir=`echo "$cofile" | sed -e 's|[/.-]|_|g'`.d +while true; do + if mkdir "$lockdir" >/dev/null 2>&1; then + break + fi + sleep 1 +done +# FIXME: race condition here if user kills between mkdir and trap. +trap "rmdir '$lockdir'; exit 1" 1 2 15 + +# Run the compile. +"$@" +ret=$? + +if test -f "$cofile"; then + mv "$cofile" "$ofile" +elif test -f "${cofile}bj"; then + mv "${cofile}bj" "$ofile" +fi + +rmdir "$lockdir" +exit $ret + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/usr/src/grub/grub-0.97/config.guess b/usr/src/grub/grub-0.97/config.guess new file mode 100755 index 0000000000..8229471326 --- /dev/null +++ b/usr/src/grub/grub-0.97/config.guess @@ -0,0 +1,1453 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. + +timestamp='2004-11-12' + +# This file 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. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Originally written by Per Bothner . +# Please send patches to . Submit a context +# diff and a properly formatted ChangeLog entry. +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# The plan is that this can be called by configure scripts if you +# don't specify an explicit build system type. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) + echo "$version" ; exit 0 ;; + --help | --h* | -h ) + echo "$usage"; exit 0 ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + +trap 'exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. Note that the use of a +# compiler to aid in system detection is discouraged as it requires +# temporary files to be created and, as you can see below, it is a +# headache to deal with in a portable fashion. + +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +# Portable tmp directory creation inspired by the Autoconf team. + +set_cc_for_build=' +trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; +trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; +: ${TMPDIR=/tmp} ; + { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; +dummy=$tmp/dummy ; +tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; +case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int x;" > $dummy.c ; + for c in cc gcc c89 c99 ; do + if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then + CC_FOR_BUILD="$c"; break ; + fi ; + done ; + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found ; + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac ;' + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 1994-08-24) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # NetBSD (nbsd) targets should (where applicable) match one or + # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # + # Note: NetBSD doesn't particularly care about the vendor + # portion of the name. We always set it to "unknown". + sysctl="sysctl -n hw.machine_arch" + UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + case "${UNAME_MACHINE_ARCH}" in + armeb) machine=armeb-unknown ;; + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + *) machine=${UNAME_MACHINE_ARCH}-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE_ARCH}" in + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep __ELF__ >/dev/null + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # The OS release + # Debian GNU/NetBSD machines have a different userland, and + # thus, need a distinct triplet. However, they do not need + # kernel version information, so it can be replaced with a + # suitable tag, in the style of linux-gnu. + case "${UNAME_VERSION}" in + Debian*) + release='-gnu' + ;; + *) + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + ;; + esac + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit 0 ;; + amd64:OpenBSD:*:*) + echo x86_64-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + amiga:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + cats:OpenBSD:*:*) + echo arm-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + hp300:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + luna88k:OpenBSD:*:*) + echo m88k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mac68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + macppc:OpenBSD:*:*) + echo powerpc-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme88k:OpenBSD:*:*) + echo m88k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvmeppc:OpenBSD:*:*) + echo powerpc-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sgi:OpenBSD:*:*) + echo mips64-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sun3:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + *:OpenBSD:*:*) + echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + *:ekkoBSD:*:*) + echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} + exit 0 ;; + macppc:MirBSD:*:*) + echo powerppc-unknown-mirbsd${UNAME_RELEASE} + exit 0 ;; + *:MirBSD:*:*) + echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} + exit 0 ;; + alpha:OSF1:*:*) + case $UNAME_RELEASE in + *4.0) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + ;; + *5.*) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + ;; + esac + # According to Compaq, /usr/sbin/psrinfo has been available on + # OSF/1 and Tru64 systems produced since 1995. I hope that + # covers most systems running today. This code pipes the CPU + # types through head -n 1, so we only detect the type of CPU 0. + ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` + case "$ALPHA_CPU_TYPE" in + "EV4 (21064)") + UNAME_MACHINE="alpha" ;; + "EV4.5 (21064)") + UNAME_MACHINE="alpha" ;; + "LCA4 (21066/21068)") + UNAME_MACHINE="alpha" ;; + "EV5 (21164)") + UNAME_MACHINE="alphaev5" ;; + "EV5.6 (21164A)") + UNAME_MACHINE="alphaev56" ;; + "EV5.6 (21164PC)") + UNAME_MACHINE="alphapca56" ;; + "EV5.7 (21164PC)") + UNAME_MACHINE="alphapca57" ;; + "EV6 (21264)") + UNAME_MACHINE="alphaev6" ;; + "EV6.7 (21264A)") + UNAME_MACHINE="alphaev67" ;; + "EV6.8CB (21264C)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8AL (21264B)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8CX (21264D)") + UNAME_MACHINE="alphaev68" ;; + "EV6.9A (21264/EV69A)") + UNAME_MACHINE="alphaev69" ;; + "EV7 (21364)") + UNAME_MACHINE="alphaev7" ;; + "EV7.9 (21364A)") + UNAME_MACHINE="alphaev79" ;; + esac + # A Pn.n version is a patched version. + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit 0 ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix + exit 0 ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit 0 ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit 0;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit 0 ;; + *:[Mm]orph[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-morphos + exit 0 ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit 0 ;; + *:z/VM:*:*) + echo s390-ibm-zvmoe + exit 0 ;; + *:OS400:*:*) + echo powerpc-ibm-os400 + exit 0 ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit 0;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit 0;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit 0 ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit 0 ;; + DRS?6000:unix:4.0:6*) + echo sparc-icl-nx6 + exit 0 ;; + DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) + case `/usr/bin/uname -p` in + sparc) echo sparc-icl-nx7 && exit 0 ;; + esac ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + i86pc:SunOS:5.*:*) + echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit 0 ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit 0 ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos${UNAME_RELEASE} + ;; + sun4) + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac + exit 0 ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit 0 ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit 0 ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit 0 ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit 0 ;; + m68k:machten:*:*) + echo m68k-apple-machten${UNAME_RELEASE} + exit 0 ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit 0 ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit 0 ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit 0 ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c \ + && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ + && exit 0 + echo mips-mips-riscos${UNAME_RELEASE} + exit 0 ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit 0 ;; + Motorola:*:4.3:PL8-*) + echo powerpc-harris-powermax + exit 0 ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + echo powerpc-harris-powermax + exit 0 ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit 0 ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit 0 ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit 0 ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit 0 ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} + fi + exit 0 ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit 0 ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit 0 ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit 0 ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit 0 ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit 0 ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix + exit 0 ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit 0 ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 + echo rs6000-ibm-aix3.2.5 + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit 0 ;; + *:AIX:*:[45]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit 0 ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit 0 ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit 0 ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit 0 ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit 0 ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit 0 ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit 0 ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit 0 ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 + esac ;; + esac + fi + if [ "${HP_ARCH}" = "" ]; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE + #include + #include + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + test -z "$HP_ARCH" && HP_ARCH=hppa + fi ;; + esac + if [ ${HP_ARCH} = "hppa2.0w" ] + then + # avoid double evaluation of $set_cc_for_build + test -n "$CC_FOR_BUILD" || eval $set_cc_for_build + if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null + then + HP_ARCH="hppa2.0w" + else + HP_ARCH="hppa64" + fi + fi + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit 0 ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit 0 ;; + 3050*:HI-UX:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 + echo unknown-hitachi-hiuxwe2 + exit 0 ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit 0 ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit 0 ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit 0 ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit 0 ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit 0 ;; + i*86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit 0 ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit 0 ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit 0 ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit 0 ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit 0 ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit 0 ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + *:UNICOS/mp:*:*) + echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit 0 ;; + 5000:UNIX_System_V:4.*:*) + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` + echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit 0 ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit 0 ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + *:FreeBSD:*:*) + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit 0 ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit 0 ;; + i*:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit 0 ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit 0 ;; + x86:Interix*:[34]*) + echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//' + exit 0 ;; + [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) + echo i${UNAME_MACHINE}-pc-mks + exit 0 ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i586-pc-interix + exit 0 ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit 0 ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit 0 ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + *:GNU:*:*) + # the GNU system + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit 0 ;; + *:GNU/*:*:*) + # other systems with GNU libc and userland + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu + exit 0 ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit 0 ;; + arm*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + cris:Linux:*:*) + echo cris-axis-linux-gnu + exit 0 ;; + crisv32:Linux:*:*) + echo crisv32-axis-linux-gnu + exit 0 ;; + frv:Linux:*:*) + echo frv-unknown-linux-gnu + exit 0 ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + m32r*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + mips:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips + #undef mipsel + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mipsel + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips + #else + CPU= + #endif + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` + test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 + ;; + mips64:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips64 + #undef mips64el + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mips64el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips64 + #else + CPU= + #endif + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` + test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 + ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-gnu + exit 0 ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-gnu + exit 0 ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit 0 ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; + esac + exit 0 ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit 0 ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit 0 ;; + sh64*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + x86_64:Linux:*:*) + echo x86_64-unknown-linux-gnu + exit 0 ;; + i*86:Linux:*:*) + # The BFD linker knows what the default object file format is, so + # first see if it will tell us. cd to the root directory to prevent + # problems with other programs or directories called `ld' in the path. + # Set LC_ALL=C to ensure ld outputs messages in English. + ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ + | sed -ne '/supported targets:/!d + s/[ ][ ]*/ /g + s/.*supported targets: *// + s/ .*// + p'` + case "$ld_supported_targets" in + elf32-i386) + TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" + ;; + a.out-i386-linux) + echo "${UNAME_MACHINE}-pc-linux-gnuaout" + exit 0 ;; + coff-i386) + echo "${UNAME_MACHINE}-pc-linux-gnucoff" + exit 0 ;; + "") + # Either a pre-BFD a.out linker (linux-gnuoldld) or + # one that does not give us useful --help. + echo "${UNAME_MACHINE}-pc-linux-gnuoldld" + exit 0 ;; + esac + # Determine whether the default compiler is a.out or elf + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + #ifdef __ELF__ + # ifdef __GLIBC__ + # if __GLIBC__ >= 2 + LIBC=gnu + # else + LIBC=gnulibc1 + # endif + # else + LIBC=gnulibc1 + # endif + #else + #ifdef __INTEL_COMPILER + LIBC=gnu + #else + LIBC=gnuaout + #endif + #endif + #ifdef __dietlibc__ + LIBC=dietlibc + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` + test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 + test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 + ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + echo i386-sequent-sysv4 + exit 0 ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit 0 ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit 0 ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit 0 ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit 0 ;; + i*86:syllable:*:*) + echo ${UNAME_MACHINE}-pc-syllable + exit 0 ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit 0 ;; + i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi + exit 0 ;; + i*86:*:5:[78]*) + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + exit 0 ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` + (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit 0 ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i386. + echo i386-pc-msdosdjgpp + exit 0 ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit 0 ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit 0 ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit 0 ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit 0 ;; + mc68k:UNIX:SYSTEM5:3.51m) + echo m68k-convergent-sysv + exit 0 ;; + M680?0:D-NIX:5.3:*) + echo m68k-diab-dnix + exit 0 ;; + M68*:*:R3V[5678]*:*) + test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; + 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4.3${OS_REL} && exit 0 + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4 && exit 0 ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit 0 ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit 0 ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit 0 ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit 0 ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit 0 ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit 0 ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos + exit 0 ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit 0 ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 + exit 0 ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit 0 ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit 0 ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit 0 ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit 0 ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit 0 ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit 0 ;; + SX-6:SUPER-UX:*:*) + echo sx6-nec-superux${UNAME_RELEASE} + exit 0 ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Darwin:*:*) + UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown + case $UNAME_PROCESSOR in + *86) UNAME_PROCESSOR=i686 ;; + unknown) UNAME_PROCESSOR=powerpc ;; + esac + echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} + exit 0 ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = "x86"; then + UNAME_PROCESSOR=i386 + UNAME_MACHINE=pc + fi + echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} + exit 0 ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit 0 ;; + NSR-?:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit 0 ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit 0 ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit 0 ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit 0 ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "$cputype" = "386"; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit 0 ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit 0 ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit 0 ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit 0 ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit 0 ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit 0 ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit 0 ;; + SEI:*:*:SEIUX) + echo mips-sei-seiux${UNAME_RELEASE} + exit 0 ;; + *:DragonFly:*:*) + echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit 0 ;; + *:*VMS:*:*) + UNAME_MACHINE=`(uname -p) 2>/dev/null` + case "${UNAME_MACHINE}" in + A*) echo alpha-dec-vms && exit 0 ;; + I*) echo ia64-dec-vms && exit 0 ;; + V*) echo vax-dec-vms && exit 0 ;; + esac ;; + *:XENIX:*:SysV) + echo i386-pc-xenix + exit 0 ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +eval $set_cc_for_build +cat >$dummy.c < +# include +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +# if !defined (ultrix) +# include +# if defined (BSD) +# if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +# else +# if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# endif +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# else + printf ("vax-dec-ultrix\n"); exit (0); +# endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0 + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit 0 ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + c34*) + echo c34-convex-bsd + exit 0 ;; + c38*) + echo c38-convex-bsd + exit 0 ;; + c4*) + echo c4-convex-bsd + exit 0 ;; + esac +fi + +cat >&2 < in order to provide the needed +information to handle your system. + +config.guess timestamp = $timestamp + +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = ${UNAME_MACHINE} +UNAME_RELEASE = ${UNAME_RELEASE} +UNAME_SYSTEM = ${UNAME_SYSTEM} +UNAME_VERSION = ${UNAME_VERSION} +EOF + +exit 1 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/usr/src/grub/grub-0.97/config.h b/usr/src/grub/grub-0.97/config.h new file mode 100644 index 0000000000..2a0423b3ef --- /dev/null +++ b/usr/src/grub/grub-0.97/config.h @@ -0,0 +1,107 @@ +/* config.h. Generated by configure. */ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Define if an absolute indirect call/jump must NOT be prefixed with `*' */ +/* #undef ABSOLUTE_WITHOUT_ASTERISK */ + +/* Define it to \"addr32\" or \"addr32;\" to make GAS happy */ +#define ADDR32 addr32 + +/* Define if you don't want to pass the mem= option to Linux */ +#define AUTO_LINUX_MEM_OPT 1 + +/* Define it to \"data32\" or \"data32;\" to make GAS happy */ +#define DATA32 data32 + +/* Define if C symbols get an underscore after compilation */ +/* #undef HAVE_ASM_USCORE */ + +/* Define to 1 if you have the header file. */ +#define HAVE_CURSES_H 1 + +/* Define if edata is defined */ +#define HAVE_EDATA_SYMBOL 1 + +/* Define if end is defined */ +#define HAVE_END_SYMBOL 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define if you have a curses library */ +#define HAVE_LIBCURSES 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_NCURSES_CURSES_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_NCURSES_H */ + +/* Define if opendisk() in -lutil can be used */ +/* #undef HAVE_OPENDISK */ + +/* Define if start is defined */ +/* #undef HAVE_START_SYMBOL */ + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define if _edata is defined */ +#define HAVE_USCORE_EDATA_SYMBOL 1 + +/* Define if end is defined */ +#define HAVE_USCORE_END_SYMBOL 1 + +/* Define if _start is defined */ +#define HAVE_USCORE_START_SYMBOL 1 + +/* Define if __bss_start is defined */ +#define HAVE_USCORE_USCORE_BSS_START_SYMBOL 1 + +/* Name of package */ +#define PACKAGE "grub" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "bug-grub@gnu.org" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "GRUB" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "GRUB 0.97" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "grub" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "0.97" + +/* Define if there is user specified preset menu string */ +/* #undef PRESET_MENU_STRING */ + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Version number of package */ +#define VERSION "0.97" diff --git a/usr/src/grub/grub-0.97/config.h.in b/usr/src/grub/grub-0.97/config.h.in new file mode 100644 index 0000000000..68d7c8ce19 --- /dev/null +++ b/usr/src/grub/grub-0.97/config.h.in @@ -0,0 +1,106 @@ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Define if an absolute indirect call/jump must NOT be prefixed with `*' */ +#undef ABSOLUTE_WITHOUT_ASTERISK + +/* Define it to \"addr32\" or \"addr32;\" to make GAS happy */ +#undef ADDR32 + +/* Define if you don't want to pass the mem= option to Linux */ +#undef AUTO_LINUX_MEM_OPT + +/* Define it to \"data32\" or \"data32;\" to make GAS happy */ +#undef DATA32 + +/* Define if C symbols get an underscore after compilation */ +#undef HAVE_ASM_USCORE + +/* Define to 1 if you have the header file. */ +#undef HAVE_CURSES_H + +/* Define if edata is defined */ +#undef HAVE_EDATA_SYMBOL + +/* Define if end is defined */ +#undef HAVE_END_SYMBOL + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define if you have a curses library */ +#undef HAVE_LIBCURSES + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NCURSES_CURSES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NCURSES_H + +/* Define if opendisk() in -lutil can be used */ +#undef HAVE_OPENDISK + +/* Define if start is defined */ +#undef HAVE_START_SYMBOL + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define if _edata is defined */ +#undef HAVE_USCORE_EDATA_SYMBOL + +/* Define if end is defined */ +#undef HAVE_USCORE_END_SYMBOL + +/* Define if _start is defined */ +#undef HAVE_USCORE_START_SYMBOL + +/* Define if __bss_start is defined */ +#undef HAVE_USCORE_USCORE_BSS_START_SYMBOL + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define if there is user specified preset menu string */ +#undef PRESET_MENU_STRING + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Version number of package */ +#undef VERSION diff --git a/usr/src/grub/grub-0.97/config.status.solaris b/usr/src/grub/grub-0.97/config.status.solaris new file mode 100755 index 0000000000..f18f22778c --- /dev/null +++ b/usr/src/grub/grub-0.97/config.status.solaris @@ -0,0 +1,1252 @@ +#! /bin/bash +# Generated by configure. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false +SHELL=${CONFIG_SHELL-/bin/bash} +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi +DUALCASE=1; export DUALCASE # for MKS sh + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# Work around bugs in pre-3.0 UWIN ksh. +$as_unset ENV MAIL MAILPATH +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + + +# PATH needs CR, and LINENO needs CR and PATH. +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done + + ;; + esac + # We did not find ourselves, most probably we were run as `sh COMMAND' + # in which case we are not to be found in the path. + if test "x$as_myself" = x; then + as_myself=$0 + fi + if test ! -f "$as_myself"; then + { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 +echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, and appends trailing '-' during + # substitution so that $LINENO is not a special case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 +echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_executable_p="test -f" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH + +exec 6>&1 + +# Open the log real soon, to keep \$[0] and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. Logging --version etc. is OK. +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX +} >&5 +cat >&5 <<_CSEOF + +This file was extended by GRUB $as_me 0.95, which was +generated by GNU Autoconf 2.59. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +_CSEOF +echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 +echo >&5 +config_files=" Makefile stage1/Makefile stage2/Makefile docs/Makefile lib/Makefile util/Makefile grub/Makefile netboot/Makefile util/grub-image util/grub-install util/grub-md5-crypt util/grub-terminfo util/grub-set-default" +config_headers=" config.h" +config_commands=" depfiles" + +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number, then exit + -q, --quiet do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Configuration commands: +$config_commands + +Report bugs to ." +ac_cs_version="\ +GRUB config.status 0.95 +configured by ./configure, generated by GNU Autoconf 2.59, + with options \"'--prefix=/platform/i86pc/boot/grub' '--with-binutils=/opt/grubbld/bin' '--disable-dependency-tracking' 'CC=/opt/grubbld/bin/gcc'\" + +Copyright (C) 2003 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." +srcdir=. +INSTALL="/usr/ucb/install" +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "x$1" : 'x\([^=]*\)='` + ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` + ac_shift=: + ;; + -*) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + *) # This is not an option, so the user has probably given explicit + # arguments. + ac_option=$1 + ac_need_defaults=false;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --vers* | -V ) + echo "$ac_cs_version"; exit 0 ;; + --he | --h) + # Conflict between --help and --header + { { echo "$as_me:$LINENO: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; };; + --help | --hel | -h ) + echo "$ac_cs_usage"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + CONFIG_FILES="$CONFIG_FILES $ac_optarg" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" + ac_need_defaults=false;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; } ;; + + *) ac_config_targets="$ac_config_targets $1" ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +if $ac_cs_recheck; then + echo "running /bin/bash ./configure " '--prefix=/platform/i86pc/boot/grub' '--with-binutils=/opt/grubbld/bin' '--disable-dependency-tracking' 'CC=/opt/grubbld/bin/gcc' $ac_configure_extra_args " --no-create --no-recursion" >&6 + exec /bin/bash ./configure '--prefix=/platform/i86pc/boot/grub' '--with-binutils=/opt/grubbld/bin' '--disable-dependency-tracking' 'CC=/opt/grubbld/bin/gcc' $ac_configure_extra_args --no-create --no-recursion +fi + +# +# INIT-COMMANDS section. +# + +AMDEP_TRUE="#" ac_aux_dir="." + +for ac_config_target in $ac_config_targets +do + case "$ac_config_target" in + # Handling of arguments. + "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "stage1/Makefile" ) CONFIG_FILES="$CONFIG_FILES stage1/Makefile" ;; + "stage2/Makefile" ) CONFIG_FILES="$CONFIG_FILES stage2/Makefile" ;; + "docs/Makefile" ) CONFIG_FILES="$CONFIG_FILES docs/Makefile" ;; + "lib/Makefile" ) CONFIG_FILES="$CONFIG_FILES lib/Makefile" ;; + "util/Makefile" ) CONFIG_FILES="$CONFIG_FILES util/Makefile" ;; + "grub/Makefile" ) CONFIG_FILES="$CONFIG_FILES grub/Makefile" ;; + "netboot/Makefile" ) CONFIG_FILES="$CONFIG_FILES netboot/Makefile" ;; + "util/grub-image" ) CONFIG_FILES="$CONFIG_FILES util/grub-image" ;; + "util/grub-install" ) CONFIG_FILES="$CONFIG_FILES util/grub-install" ;; + "util/grub-md5-crypt" ) CONFIG_FILES="$CONFIG_FILES util/grub-md5-crypt" ;; + "util/grub-terminfo" ) CONFIG_FILES="$CONFIG_FILES util/grub-terminfo" ;; + "util/grub-set-default" ) CONFIG_FILES="$CONFIG_FILES util/grub-set-default" ;; + "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; + *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 +echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; + esac +done + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers + test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason to put it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Create a temporary directory, and hook for its removal unless debugging. +$debug || +{ + trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} + +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=./confstat$$-$RANDOM + (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in ." >&2 + { (exit 1); exit 1; } +} + + +# +# CONFIG_FILES section. +# + +# No need to generate the scripts if there are no CONFIG_FILES. +# This happens for instance when ./config.status config.h +if test -n "$CONFIG_FILES"; then + # Protect against being on the right side of a sed subst in config.status. + sed 's/,@/@@/; s/@,/@@/; s/,;t t$/@;t t/; /@;t t$/s/[\\&,]/\\&/g; + s/@@/,@/; s/@@/@,/; s/@;t t$/,;t t/' >$tmp/subs.sed <<\CEOF +s,@SHELL@,/bin/bash,;t t +s,@PATH_SEPARATOR@,:,;t t +s,@PACKAGE_NAME@,GRUB,;t t +s,@PACKAGE_TARNAME@,grub,;t t +s,@PACKAGE_VERSION@,0.95,;t t +s,@PACKAGE_STRING@,GRUB 0.95,;t t +s,@PACKAGE_BUGREPORT@,bug-grub@gnu.org,;t t +s,@exec_prefix@,${prefix},;t t +s,@prefix@,/platform/i86pc/boot/grub,;t t +s,@program_transform_name@,s,x,x,,;t t +s,@bindir@,${exec_prefix}/bin,;t t +s,@sbindir@,${exec_prefix}/sbin,;t t +s,@libexecdir@,${exec_prefix}/libexec,;t t +s,@datadir@,${prefix}/share,;t t +s,@sysconfdir@,${prefix}/etc,;t t +s,@sharedstatedir@,${prefix}/com,;t t +s,@localstatedir@,${prefix}/var,;t t +s,@libdir@,${exec_prefix}/lib,;t t +s,@includedir@,${prefix}/include,;t t +s,@oldincludedir@,/usr/include,;t t +s,@infodir@,${prefix}/info,;t t +s,@mandir@,${prefix}/man,;t t +s,@build_alias@,,;t t +s,@host_alias@,,;t t +s,@target_alias@,,;t t +s,@DEFS@,-DHAVE_CONFIG_H,;t t +s,@ECHO_C@,,;t t +s,@ECHO_N@,-n,;t t +s,@ECHO_T@,,;t t +s,@LIBS@,,;t t +s,@INSTALL_PROGRAM@,${INSTALL},;t t +s,@INSTALL_SCRIPT@,${INSTALL},;t t +s,@INSTALL_DATA@,${INSTALL} -m 644,;t t +s,@CYGPATH_W@,echo,;t t +s,@PACKAGE@,grub,;t t +s,@VERSION@,0.95,;t t +s,@ACLOCAL@,${SHELL} /net/zwicky/export5/jongkis/w/boot/usr/src/grub/grub-0.95/missing --run aclocal-1.8,;t t +s,@AUTOCONF@,${SHELL} /net/zwicky/export5/jongkis/w/boot/usr/src/grub/grub-0.95/missing --run autoconf,;t t +s,@AUTOMAKE@,${SHELL} /net/zwicky/export5/jongkis/w/boot/usr/src/grub/grub-0.95/missing --run automake-1.8,;t t +s,@AUTOHEADER@,${SHELL} /net/zwicky/export5/jongkis/w/boot/usr/src/grub/grub-0.95/missing --run autoheader,;t t +s,@MAKEINFO@,${SHELL} /net/zwicky/export5/jongkis/w/boot/usr/src/grub/grub-0.95/missing --run makeinfo,;t t +s,@AMTAR@,${SHELL} /net/zwicky/export5/jongkis/w/boot/usr/src/grub/grub-0.95/missing --run tar,;t t +s,@install_sh@,/net/zwicky/export5/jongkis/w/boot/usr/src/grub/grub-0.95/install-sh,;t t +s,@STRIP@,,;t t +s,@ac_ct_STRIP@,,;t t +s,@INSTALL_STRIP_PROGRAM@,${SHELL} $(install_sh) -c -s,;t t +s,@mkdir_p@,mkdir -p -- .,;t t +s,@AWK@,gawk,;t t +s,@SET_MAKE@,,;t t +s,@am__leading_dot@,.,;t t +s,@build@,i386-pc-solaris2.10,;t t +s,@build_cpu@,i386,;t t +s,@build_vendor@,pc,;t t +s,@build_os@,solaris2.10,;t t +s,@host@,i386-pc-solaris2.10,;t t +s,@host_cpu@,i386,;t t +s,@host_vendor@,pc,;t t +s,@host_os@,solaris2.10,;t t +s,@MAINTAINER_MODE_TRUE@,#,;t t +s,@MAINTAINER_MODE_FALSE@,,;t t +s,@MAINT@,#,;t t +s,@PERL@,,;t t +s,@CC@,/opt/grubbld/bin/gcc,;t t +s,@ac_ct_CC@,/opt/grubbld/bin/gcc,;t t +s,@CFLAGS@,-B/opt/grubbld/bin/ -g,;t t +s,@LDFLAGS@,,;t t +s,@CPPFLAGS@, -Wall -Wmissing-prototypes -Wunused -Wshadow -Wpointer-arith -falign-jumps=1 -falign-loops=1 -falign-functions=1 -Wundef,;t t +s,@EXEEXT@,,;t t +s,@OBJEXT@,o,;t t +s,@DEPDIR@,.deps,;t t +s,@am__include@,include,;t t +s,@am__quote@,,;t t +s,@AMDEP_TRUE@,#,;t t +s,@AMDEP_FALSE@,,;t t +s,@AMDEPBACKSLASH@,,;t t +s,@CCDEPMODE@,depmode=none,;t t +s,@am__fastdepCC_TRUE@,#,;t t +s,@am__fastdepCC_FALSE@,,;t t +s,@CCAS@,/opt/grubbld/bin/gcc,;t t +s,@RANLIB@,/opt/grubbld/bin/ranlib,;t t +s,@ac_ct_RANLIB@,,;t t +s,@STAGE1_CFLAGS@,-O2,;t t +s,@STAGE2_CFLAGS@,-Os,;t t +s,@GRUB_CFLAGS@,-O2,;t t +s,@OBJCOPY@,/opt/grubbld/bin/objcopy,;t t +s,@ac_ct_OBJCOPY@,,;t t +s,@GRUB_LIBS@, -lcurses,;t t +s,@CPP@,/opt/grubbld/bin/gcc -E,;t t +s,@EGREP@,egrep,;t t +s,@NETBOOT_SUPPORT_TRUE@,#,;t t +s,@NETBOOT_SUPPORT_FALSE@,,;t t +s,@DISKLESS_SUPPORT_TRUE@,#,;t t +s,@DISKLESS_SUPPORT_FALSE@,,;t t +s,@GRAPHICS_SUPPORT_TRUE@,,;t t +s,@GRAPHICS_SUPPORT_FALSE@,#,;t t +s,@HERCULES_SUPPORT_TRUE@,,;t t +s,@HERCULES_SUPPORT_FALSE@,#,;t t +s,@SERIAL_SUPPORT_TRUE@,,;t t +s,@SERIAL_SUPPORT_FALSE@,#,;t t +s,@SERIAL_SPEED_SIMULATION_TRUE@,#,;t t +s,@SERIAL_SPEED_SIMULATION_FALSE@,,;t t +s,@BUILD_EXAMPLE_KERNEL_TRUE@,#,;t t +s,@BUILD_EXAMPLE_KERNEL_FALSE@,,;t t +s,@FSYS_CFLAGS@, -DFSYS_EXT2FS=1 -DFSYS_FAT=1 -DFSYS_FFS=1 -DFSYS_UFS=1 -DFSYS_UFS2=1 -DFSYS_MINIX=1 -DFSYS_REISERFS=1 -DFSYS_VSTAFS=1 -DFSYS_JFS=1 -DFSYS_XFS=1 -DFSYS_ISO9660=1 -DUSE_MD5_PASSWORDS=1,;t t +s,@NET_CFLAGS@,,;t t +s,@NET_EXTRAFLAGS@, -DCONGESTED=1 -DNE_SCAN=0x280,0x300,0x320,0x340 -DWD_DEFAULT_MEM=0xCC000,;t t +s,@NETBOOT_DRIVERS@,,;t t +s,@CCASFLAGS@,$(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(CPPFLAGS) $(CFLAGS),;t t +s,@LIBOBJS@,,;t t +s,@LTLIBOBJS@,,;t t +CEOF + + # Split the substitutions into bite-sized pieces for seds with + # small command number limits, like on Digital OSF/1 and HP-UX. + ac_max_sed_lines=48 + ac_sed_frag=1 # Number of current file. + ac_beg=1 # First line for current file. + ac_end=$ac_max_sed_lines # Line after last line for current file. + ac_more_lines=: + ac_sed_cmds= + while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + else + sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + fi + if test ! -s $tmp/subs.frag; then + ac_more_lines=false + else + # The purpose of the label and of the branching condition is to + # speed up the sed processing (if there are no `@' at all, there + # is no need to browse any of the substitutions). + # These are the two extra sed commands mentioned above. + (echo ':t + /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" + else + ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" + fi + ac_sed_frag=`expr $ac_sed_frag + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_lines` + fi + done + if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat + fi +fi # test -n "$CONFIG_FILES" + +for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. + ac_dir=`(dirname "$ac_file") 2>/dev/null || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac + + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_builddir$INSTALL ;; + esac + + if test x"$ac_file" != x-; then + { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + rm -f "$ac_file" + fi + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + if test x"$ac_file" = x-; then + configure_input= + else + configure_input="$ac_file. " + fi + configure_input=$configure_input"Generated from `echo $ac_file_in | + sed 's,.*/,,'` by configure." + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo "$f";; + *) # Relative + if test -f "$f"; then + # Build tree + echo "$f" + elif test -f "$srcdir/$f"; then + # Source tree + echo "$srcdir/$f" + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } + sed "/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/; +s/:*\${srcdir}:*/:/; +s/:*@srcdir@:*/:/; +s/^\([^=]*=[ ]*\):*/\1/; +s/:*$//; +s/^[^=]*=[ ]*$//; +} + +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s,@configure_input@,$configure_input,;t t +s,@srcdir@,$ac_srcdir,;t t +s,@abs_srcdir@,$ac_abs_srcdir,;t t +s,@top_srcdir@,$ac_top_srcdir,;t t +s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t +s,@builddir@,$ac_builddir,;t t +s,@abs_builddir@,$ac_abs_builddir,;t t +s,@top_builddir@,$ac_top_builddir,;t t +s,@abs_top_builddir@,$ac_abs_top_builddir,;t t +s,@INSTALL@,$ac_INSTALL,;t t +" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out + rm -f $tmp/stdin + if test x"$ac_file" != x-; then + mv $tmp/out $ac_file + else + cat $tmp/out + rm -f $tmp/out + fi + +done + +# +# CONFIG_HEADER section. +# + +# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where +# NAME is the cpp macro being defined and VALUE is the value it is being given. +# +# ac_d sets the value in "#define NAME VALUE" lines. +ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='[ ].*$,\1#\2' +ac_dC=' ' +ac_dD=',;t' +# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='$,\1#\2define\3' +ac_uC=' ' +ac_uD=',;t' + +for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + # Do quote $f, to prevent DOS paths from being IFS'd. + echo "$f";; + *) # Relative + if test -f "$f"; then + # Build tree + echo "$f" + elif test -f "$srcdir/$f"; then + # Source tree + echo "$srcdir/$f" + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } + # Remove the trailing spaces. + sed 's/[ ]*$//' $ac_file_inputs >$tmp/in + + # Handle all the #define templates only if necessary. + if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then + # If there are no defines, we may have an empty if/fi + : + cat >$tmp/defines.sed <$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in + + fi # grep + + # Handle all the #undef templates + cat >$tmp/undefs.sed <$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + if test x"$ac_file" = x-; then + echo "/* Generated by configure. */" >$tmp/config.h + else + echo "/* $ac_file. Generated by configure. */" >$tmp/config.h + fi + cat $tmp/in >>$tmp/config.h + rm -f $tmp/in + if test x"$ac_file" != x-; then + if diff $ac_file $tmp/config.h >/dev/null 2>&1; then + { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 +echo "$as_me: $ac_file is unchanged" >&6;} + else + ac_dir=`(dirname "$ac_file") 2>/dev/null || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + + rm -f $ac_file + mv $tmp/config.h $ac_file + fi + else + cat $tmp/config.h + rm -f $tmp/config.h + fi +# Compute $ac_file's index in $config_headers. +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $ac_file | $ac_file:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $ac_file" >`(dirname $ac_file) 2>/dev/null || +$as_expr X$ac_file : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X$ac_file : 'X\(//\)[^/]' \| \ + X$ac_file : 'X\(//\)$' \| \ + X$ac_file : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X$ac_file | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'`/stamp-h$_am_stamp_count +done + +# +# CONFIG_COMMANDS section. +# +for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue + ac_dest=`echo "$ac_file" | sed 's,:.*,,'` + ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_dir=`(dirname "$ac_dest") 2>/dev/null || +$as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_dest" : 'X\(//\)[^/]' \| \ + X"$ac_dest" : 'X\(//\)$' \| \ + X"$ac_dest" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_dest" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac + + + { echo "$as_me:$LINENO: executing $ac_dest commands" >&5 +echo "$as_me: executing $ac_dest commands" >&6;} + case $ac_dest in + depfiles ) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # So let's grep whole file. + if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then + dirpart=`(dirname "$mf") 2>/dev/null || +$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$mf" : 'X\(//\)[^/]' \| \ + X"$mf" : 'X\(//\)$' \| \ + X"$mf" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$mf" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + else + continue + fi + grep '^DEP_FILES *= *[^ #]' < "$mf" > /dev/null || continue + # Extract the definition of DEP_FILES from the Makefile without + # running `make'. + DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"` + test -z "$DEPDIR" && continue + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n -e '/^U = / s///p' < "$mf"` + test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR" + # We invoke sed twice because it is the simplest approach to + # changing $(DEPDIR) to its actual value in the expansion. + for file in `sed -n -e ' + /^DEP_FILES = .*\\\\$/ { + s/^DEP_FILES = // + :loop + s/\\\\$// + p + n + /\\\\$/ b loop + p + } + /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`(dirname "$file") 2>/dev/null || +$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$file" : 'X\(//\)[^/]' \| \ + X"$file" : 'X\(//\)$' \| \ + X"$file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p $dirpart/$fdir + else + as_dir=$dirpart/$fdir + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory $dirpart/$fdir" >&5 +echo "$as_me: error: cannot create directory $dirpart/$fdir" >&2;} + { (exit 1); exit 1; }; }; } + + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done +done + ;; + esac +done + +{ (exit 0); exit 0; } diff --git a/usr/src/grub/grub-0.97/config.sub b/usr/src/grub/grub-0.97/config.sub new file mode 100755 index 0000000000..987b17d814 --- /dev/null +++ b/usr/src/grub/grub-0.97/config.sub @@ -0,0 +1,1566 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. + +timestamp='2004-11-30' + +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine. It does not imply ALL GNU software can. +# +# This file 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. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Please send patches to . Submit a context +# diff and a properly formatted ChangeLog entry. +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS + $0 [OPTION] ALIAS + +Canonicalize a configuration name. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.sub ($timestamp) + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) + echo "$version" ; exit 0 ;; + --help | --h* | -h ) + echo "$usage"; exit 0 ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo $1 + exit 0;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \ + kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple | -axis | -knuth | -cray) + os= + basic_machine=$1 + ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -chorusos*) + os=-chorusos + basic_machine=$1 + ;; + -chorusrdb) + os=-chorusrdb + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + 1750a | 580 \ + | a29k \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | am33_2.0 \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ + | c4x | clipper \ + | d10v | d30v | dlx | dsp16xx \ + | fr30 | frv \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | i370 | i860 | i960 | ia64 \ + | ip2k | iq2000 \ + | m32r | m32rle | m68000 | m68k | m88k | maxq | mcore \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64el \ + | mips64vr | mips64vrel \ + | mips64orion | mips64orionel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mipsisa32 | mipsisa32el \ + | mipsisa32r2 | mipsisa32r2el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipstx39 | mipstx39el \ + | mn10200 | mn10300 \ + | msp430 \ + | ns16k | ns32k \ + | openrisc | or32 \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | pyramid \ + | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ + | sh64 | sh64le \ + | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv8 | sparcv9 | sparcv9b \ + | strongarm \ + | tahoe | thumb | tic4x | tic80 | tron \ + | v850 | v850e \ + | we32k \ + | x86 | xscale | xscalee[bl] | xstormy16 | xtensa \ + | z8k) + basic_machine=$basic_machine-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12) + # Motorola 68HC11/12. + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; + + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i*86 | x86_64) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + 580-* \ + | a29k-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ + | avr-* \ + | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ + | clipper-* | craynv-* | cydra-* \ + | d10v-* | d30v-* | dlx-* \ + | elxsi-* \ + | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | ip2k-* | iq2000-* \ + | m32r-* | m32rle-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | maxq-* | mcore-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ + | mips64vr-* | mips64vrel-* \ + | mips64orion-* | mips64orionel-* \ + | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* \ + | mips64vr5000-* | mips64vr5000el-* \ + | mipsisa32-* | mipsisa32el-* \ + | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa64-* | mipsisa64el-* \ + | mipsisa64r2-* | mipsisa64r2el-* \ + | mipsisa64sb1-* | mipsisa64sb1el-* \ + | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipstx39-* | mipstx39el-* \ + | mmix-* \ + | msp430-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | pyramid-* \ + | romp-* | rs6000-* \ + | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \ + | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ + | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ + | tahoe-* | thumb-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ + | tron-* \ + | v850-* | v850e-* | vax-* \ + | we32k-* \ + | x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \ + | xstormy16-* | xtensa-* \ + | ymp-* \ + | z8k-*) + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + abacus) + basic_machine=abacus-unknown + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amd64) + basic_machine=x86_64-pc + ;; + amd64-*) + basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-unknown + ;; + amigaos | amigados) + basic_machine=m68k-unknown + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + c90) + basic_machine=c90-cray + os=-unicos + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | j90) + basic_machine=j90-cray + os=-unicos + ;; + craynv) + basic_machine=craynv-cray + os=-unicosmp + ;; + cr16c) + basic_machine=cr16c-unknown + os=-elf + ;; + crds | unos) + basic_machine=m68k-crds + ;; + crisv32 | crisv32-* | etraxfs*) + basic_machine=crisv32-axis + ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; + crx) + basic_machine=crx-unknown + os=-elf + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + decsystem10* | dec10*) + basic_machine=pdp10-dec + os=-tops10 + ;; + decsystem20* | dec20*) + basic_machine=pdp10-dec + os=-tops20 + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + djgpp) + basic_machine=i586-pc + os=-msdosdjgpp + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; +# I'm not sure what "Sysv32" means. Should this be sysv3.2? + i*86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i*86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i*86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i*86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 + ;; + miniframe) + basic_machine=m68000-convergent + ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + morphos) + basic_machine=powerpc-unknown + os=-morphos + ;; + msdos) + basic_machine=i386-pc + os=-msdos + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; + np1) + basic_machine=np1-gould + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + or32 | or32-*) + basic_machine=or32-unknown + os=-coff + ;; + os400) + basic_machine=powerpc-ibm + os=-os400 + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pentium | p5 | k5 | k6 | nexgen | viac3) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86 | athlon | athlon_*) + basic_machine=i686-pc + ;; + pentiumii | pentium2 | pentiumiii | pentium3) + basic_machine=i686-pc + ;; + pentium4) + basic_machine=i786-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium4-*) + basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=power-ibm + ;; + ppc) basic_machine=powerpc-unknown + ;; + ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64) basic_machine=powerpc64-unknown + ;; + ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64le | powerpc64little | ppc64-le | powerpc64-little) + basic_machine=powerpc64le-unknown + ;; + ppc64le-* | powerpc64little-*) + basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + s390 | s390-*) + basic_machine=s390-ibm + ;; + s390x | s390x-*) + basic_machine=s390x-ibm + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; + sb1) + basic_machine=mipsisa64sb1-unknown + ;; + sb1el) + basic_machine=mipsisa64sb1el-unknown + ;; + sei) + basic_machine=mips-sei + os=-seiux + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sh64) + basic_machine=sh64-unknown + ;; + sparclite-wrs | simso-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3e) + basic_machine=alphaev5-cray + os=-unicos + ;; + t90) + basic_machine=t90-cray + os=-unicos + ;; + tic54x | c54x*) + basic_machine=tic54x-unknown + os=-coff + ;; + tic55x | c55x*) + basic_machine=tic55x-unknown + os=-coff + ;; + tic6x | c6x*) + basic_machine=tic6x-unknown + os=-coff + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + toad1) + basic_machine=pdp10-xkl + os=-tops20 + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + tpf) + basic_machine=s390x-ibm + os=-tpf + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; + xbox) + basic_machine=i686-pc + os=-mingw32 + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + ymp) + basic_machine=ymp-cray + os=-unicos + ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; + romp) + basic_machine=romp-ibm + ;; + mmix) + basic_machine=mmix-knuth + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele) + basic_machine=sh-unknown + ;; + sh64) + basic_machine=sh64-unknown + ;; + sparc | sparcv8 | sparcv9 | sparcv9b) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + *-unknown) + # Make sure to match an already-canonicalized machine name. + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \ + | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ + | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ + | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ + | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ + | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) + case $basic_machine in + x86-* | i*86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto-qnx*) + ;; + -nto*) + os=`echo $os | sed -e 's|nto|nto-qnx|'` + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; + -linux-dietlibc) + os=-linux-dietlibc + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -opened*) + os=-openedition + ;; + -os400*) + os=-os400 + ;; + -wince*) + os=-wince + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -atheos*) + os=-atheos + ;; + -syllable*) + os=-syllable + ;; + -386bsd) + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; + -nova*) + os=-rtmk-nova + ;; + -ns2 ) + os=-nextstep2 + ;; + -nsk*) + os=-nsk + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -tpf*) + os=-tpf + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -ose*) + os=-ose + ;; + -es1800*) + os=-ose + ;; + -xenix) + os=-xenix + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; + -aros*) + os=-aros + ;; + -kaos*) + os=-kaos + ;; + -zvmoe) + os=-zvmoe + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + c4x-* | tic4x-*) + os=-coff + ;; + # This must come before the *-dec entry. + pdp10-*) + os=-tops20 + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + m68*-cisco) + os=-aout + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; + or32-*) + os=-coff + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-be) + os=-beos + ;; + *-ibm) + os=-aix + ;; + *-knuth) + os=-mmixware + ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f30[01]-fujitsu | f700-fujitsu) + os=-uxpv + ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -aix*) + vendor=ibm + ;; + -beos*) + vendor=be + ;; + -hpux*) + vendor=hp + ;; + -mpeix*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs* | -opened*) + vendor=ibm + ;; + -os400*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -tpf*) + vendor=ibm + ;; + -vxsim* | -vxworks* | -windiss*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + vendor=atari + ;; + -vos*) + vendor=stratus + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os +exit 0 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/usr/src/grub/grub-0.97/configure b/usr/src/grub/grub-0.97/configure new file mode 100755 index 0000000000..b1ffd8e37b --- /dev/null +++ b/usr/src/grub/grub-0.97/configure @@ -0,0 +1,7553 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.59 for GRUB 0.97. +# +# Report bugs to . +# +# Copyright (C) 2003 Free Software Foundation, Inc. +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi +DUALCASE=1; export DUALCASE # for MKS sh + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# Work around bugs in pre-3.0 UWIN ksh. +$as_unset ENV MAIL MAILPATH +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + + +# PATH needs CR, and LINENO needs CR and PATH. +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done + + ;; + esac + # We did not find ourselves, most probably we were run as `sh COMMAND' + # in which case we are not to be found in the path. + if test "x$as_myself" = x; then + as_myself=$0 + fi + if test ! -f "$as_myself"; then + { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, and appends trailing '-' during + # substitution so that $LINENO is not a special case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_executable_p="test -f" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH + + +# Name of the host. +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +exec 6>&1 + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_config_libobj_dir=. +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} + +# Maximum number of lines to put in a shell here document. +# This variable seems obsolete. It should probably be removed, and +# only ac_max_sed_lines should be used. +: ${ac_max_here_lines=38} + +# Identity of this package. +PACKAGE_NAME='GRUB' +PACKAGE_TARNAME='grub' +PACKAGE_VERSION='0.97' +PACKAGE_STRING='GRUB 0.97' +PACKAGE_BUGREPORT='bug-grub@gnu.org' + +ac_unique_file="stage2/stage2.c" +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_SYS_STAT_H +# include +#endif +#if STDC_HEADERS +# include +# include +#else +# if HAVE_STDLIB_H +# include +# endif +#endif +#if HAVE_STRING_H +# if !STDC_HEADERS && HAVE_MEMORY_H +# include +# endif +# include +#endif +#if HAVE_STRINGS_H +# include +#endif +#if HAVE_INTTYPES_H +# include +#else +# if HAVE_STDINT_H +# include +# endif +#endif +#if HAVE_UNISTD_H +# include +#endif" + +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar build build_cpu build_vendor build_os host host_cpu host_vendor host_os MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT PERL CC ac_ct_CC CFLAGS LDFLAGS CPPFLAGS EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CCAS RANLIB ac_ct_RANLIB STAGE1_CFLAGS STAGE2_CFLAGS GRUB_CFLAGS OBJCOPY ac_ct_OBJCOPY GRUB_LIBS CPP EGREP NETBOOT_SUPPORT_TRUE NETBOOT_SUPPORT_FALSE DISKLESS_SUPPORT_TRUE DISKLESS_SUPPORT_FALSE HERCULES_SUPPORT_TRUE HERCULES_SUPPORT_FALSE SERIAL_SUPPORT_TRUE SERIAL_SUPPORT_FALSE SERIAL_SPEED_SIMULATION_TRUE SERIAL_SPEED_SIMULATION_FALSE BUILD_EXAMPLE_KERNEL_TRUE BUILD_EXAMPLE_KERNEL_FALSE FSYS_CFLAGS NET_CFLAGS NET_EXTRAFLAGS NETBOOT_DRIVERS CCASFLAGS LIBOBJS LTLIBOBJS' +ac_subst_files='' + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +ac_prev= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_option in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + eval "enable_$ac_feature=no" ;; + + -enable-* | --enable-*) + ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "enable_$ac_feature='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package| sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "with_$ac_package='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package | sed 's/-/_/g'` + eval "with_$ac_package=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) { echo "$as_me: error: unrecognized option: $ac_option +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 + { (exit 1); exit 1; }; } + ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` + eval "$ac_envvar='$ac_optarg'" + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + { echo "$as_me: error: missing argument to $ac_option" >&2 + { (exit 1); exit 1; }; } +fi + +# Be sure to have absolute paths. +for ac_var in exec_prefix prefix +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* | NONE | '' ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# Be sure to have absolute paths. +for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ + localstatedir libdir includedir oldincludedir infodir mandir +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used." >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_confdir=`(dirname "$0") 2>/dev/null || +$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$0" : 'X\(//\)[^/]' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$0" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 + { (exit 1); exit 1; }; } + else + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 + { (exit 1); exit 1; }; } + fi +fi +(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || + { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 + { (exit 1); exit 1; }; } +srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` +ac_env_build_alias_set=${build_alias+set} +ac_env_build_alias_value=$build_alias +ac_cv_env_build_alias_set=${build_alias+set} +ac_cv_env_build_alias_value=$build_alias +ac_env_host_alias_set=${host_alias+set} +ac_env_host_alias_value=$host_alias +ac_cv_env_host_alias_set=${host_alias+set} +ac_cv_env_host_alias_value=$host_alias +ac_env_target_alias_set=${target_alias+set} +ac_env_target_alias_value=$target_alias +ac_cv_env_target_alias_set=${target_alias+set} +ac_cv_env_target_alias_value=$target_alias +ac_env_CC_set=${CC+set} +ac_env_CC_value=$CC +ac_cv_env_CC_set=${CC+set} +ac_cv_env_CC_value=$CC +ac_env_CFLAGS_set=${CFLAGS+set} +ac_env_CFLAGS_value=$CFLAGS +ac_cv_env_CFLAGS_set=${CFLAGS+set} +ac_cv_env_CFLAGS_value=$CFLAGS +ac_env_LDFLAGS_set=${LDFLAGS+set} +ac_env_LDFLAGS_value=$LDFLAGS +ac_cv_env_LDFLAGS_set=${LDFLAGS+set} +ac_cv_env_LDFLAGS_value=$LDFLAGS +ac_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_env_CPPFLAGS_value=$CPPFLAGS +ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_cv_env_CPPFLAGS_value=$CPPFLAGS +ac_env_CPP_set=${CPP+set} +ac_env_CPP_value=$CPP +ac_cv_env_CPP_set=${CPP+set} +ac_cv_env_CPP_value=$CPP + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures GRUB 0.97 to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +_ACEOF + + cat <<_ACEOF +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data [PREFIX/share] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --infodir=DIR info documentation [PREFIX/info] + --mandir=DIR man documentation [PREFIX/man] +_ACEOF + + cat <<\_ACEOF + +Program names: + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM run sed PROGRAM on installed program names + +System types: + --build=BUILD configure for building on BUILD [guessed] + --host=HOST cross-compile to build programs to run on HOST [BUILD] +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of GRUB 0.97:";; + esac + cat <<\_ACEOF + +Optional Features: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-maintainer-mode enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer + --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors + --disable-ext2fs disable ext2fs support in Stage 2 + --disable-fat disable FAT support in Stage 2 + --disable-ffs disable FFS support in Stage 2 + --disable-ufs disable UFS support in Stage 2 + --disable-ufs2 disable UFS2 support in Stage 2 + --disable-minix disable Minix fs support in Stage 2 + --disable-reiserfs disable ReiserFS support in Stage 2 + --disable-vstafs disable VSTa FS support in Stage 2 + --disable-jfs disable IBM JFS support in Stage 2 + --disable-xfs disable SGI XFS support in Stage 2 + --disable-zfs disable ZFS support in Stage 2 + --disable-iso9660 disable ISO9660 support in Stage 2 + --disable-gunzip disable decompression in Stage 2 + --disable-md5-password disable MD5 password support in Stage 2 + --disable-packet-retransmission + turn off packet retransmission + --enable-pci-direct access PCI directly instead of using BIOS + --enable-3c595 enable 3Com595 driver + --enable-3c90x enable 3Com90x driver + --enable-davicom enable Davicom driver + --enable-e1000 enable Etherexpress Pro/1000 driver + --enable-eepro100 enable Etherexpress Pro/100 driver + --enable-epic100 enable SMC 83c170 EPIC/100 driver + --enable-forcedeth enable Nvidia Geforce driver + --enable-natsemi enable NatSemi DP8381x driver + --enable-ns83820 enable NS83820 driver + --enable-ns8390 enable NE2000 PCI driver + --enable-pcnet32 enable AMD Lance/PCI PCNet/32 driver + --enable-pnic enable Bochs Pseudo Nic driver + --enable-rtl8139 enable Realtek 8139 driver + --enable-r8169 enable Realtek 8169 driver + --enable-sis900 enable SIS 900 and SIS 7016 driver + --enable-sundance enable Sundance ST201 driver + --enable-tg3 enable Broadcom Tigon3 driver + --enable-tulip enable Tulip driver + --enable-tlan enable TI ThunderLAN driver + --enable-undi enable PXE UNDI driver + --enable-via-rhine enable Rhine-I/II driver + --enable-w89c840 enable Winbond W89c840 driver + --enable-compex-rl2000-fix + specify this if you have a Compex RL2000 PCI + --enable-ne-scan=LIST probe for NE base address using LIST + --enable-wd-default-mem=MEM + set the default memory location for WD/SMC + --enable-diskless enable diskless support + --disable-graphics disable graphics terminal support + --disable-hercules disable hercules terminal support + --disable-serial disable serial terminal support + --enable-serial-speed-simulation + simulate the slowness of a serial device + --enable-preset-menu=FILE + preset a menu file FILE in Stage 2 + --enable-example-kernel + build the example Multiboot kernel + --disable-auto-linux-mem-opt + don't pass Linux mem= option automatically + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-binutils=DIR search the directory DIR to find binutils + --without-curses do not use curses + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have + headers in a nonstandard directory + CPP C preprocessor + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +Report bugs to . +_ACEOF +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + ac_popdir=`pwd` + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d $ac_dir || continue + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac + + cd $ac_dir + # Check for guested configure; otherwise get Cygnus style configure. + if test -f $ac_srcdir/configure.gnu; then + echo + $SHELL $ac_srcdir/configure.gnu --help=recursive + elif test -f $ac_srcdir/configure; then + echo + $SHELL $ac_srcdir/configure --help=recursive + elif test -f $ac_srcdir/configure.ac || + test -f $ac_srcdir/configure.in; then + echo + $ac_configure --help + else + echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi + cd $ac_popdir + done +fi + +test -n "$ac_init_help" && exit 0 +if $ac_init_version; then + cat <<\_ACEOF +GRUB configure 0.97 +generated by GNU Autoconf 2.59 + +Copyright (C) 2003 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit 0 +fi +exec 5>config.log +cat >&5 <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by GRUB $as_me 0.97, which was +generated by GNU Autoconf 2.59. Invocation command line was + + $ $0 $@ + +_ACEOF +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +hostinfo = `(hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + echo "PATH: $as_dir" +done + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_sep= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; + 2) + ac_configure_args1="$ac_configure_args1 '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" + # Get rid of the leading space. + ac_sep=" " + ;; + esac + done +done +$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } +$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Be sure not to use single quotes in there, as some shells, +# such as our DU 5.0 friend, will then `close' the trap. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + cat <<\_ASBOX +## ---------------- ## +## Cache variables. ## +## ---------------- ## +_ASBOX + echo + # The following way of writing the cache mishandles newlines in values, +{ + (set) 2>&1 | + case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in + *ac_space=\ *) + sed -n \ + "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" + ;; + *) + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} + echo + + cat <<\_ASBOX +## ----------------- ## +## Output variables. ## +## ----------------- ## +_ASBOX + echo + for ac_var in $ac_subst_vars + do + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" + done | sort + echo + + if test -n "$ac_subst_files"; then + cat <<\_ASBOX +## ------------- ## +## Output files. ## +## ------------- ## +_ASBOX + echo + for ac_var in $ac_subst_files + do + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" + done | sort + echo + fi + + if test -s confdefs.h; then + cat <<\_ASBOX +## ----------- ## +## confdefs.h. ## +## ----------- ## +_ASBOX + echo + sed "/^$/d" confdefs.h | sort + echo + fi + test "$ac_signal" != 0 && + echo "$as_me: caught signal $ac_signal" + echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core && + rm -rf conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status + ' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo >confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 +echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special + # files actually), so we avoid doing that. + if test -f "$cache_file"; then + { echo "$as_me:$LINENO: loading cache $cache_file" >&5 +echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . $cache_file;; + *) . ./$cache_file;; + esac + fi +else + { echo "$as_me:$LINENO: creating cache $cache_file" >&5 +echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in `(set) 2>&1 | + sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val="\$ac_cv_env_${ac_var}_value" + eval ac_new_val="\$ac_env_${ac_var}_value" + case $ac_old_set,$ac_new_set in + set,) + { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 +echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 +echo "$as_me: former value: $ac_old_val" >&2;} + { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 +echo "$as_me: current value: $ac_new_val" >&2;} + ac_cache_corrupted=: + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 +echo "$as_me: error: changes in the environment can compromise the build" >&2;} + { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 +echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ac_config_headers="$ac_config_headers config.h" + +am__api_version="1.9" +ac_aux_dir= +for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f $ac_dir/shtool; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 +echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} + { (exit 1); exit 1; }; } +fi +ac_config_guess="$SHELL $ac_aux_dir/config.guess" +ac_config_sub="$SHELL $ac_aux_dir/config.sub" +ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 +echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in + ./ | .// | /cC/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + done + done + ;; +esac +done + + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL=$ac_install_sh + fi +fi +echo "$as_me:$LINENO: result: $INSTALL" >&5 +echo "${ECHO_T}$INSTALL" >&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +echo "$as_me:$LINENO: checking whether build environment is sane" >&5 +echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6 +# Just in case +sleep 1 +echo timestamp > conftest.file +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftest.file` + fi + rm -f conftest.file + if test "$*" != "X $srcdir/configure conftest.file" \ + && test "$*" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&5 +echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&2;} + { (exit 1); exit 1; }; } + fi + + test "$2" = conftest.file + ) +then + # Ok. + : +else + { { echo "$as_me:$LINENO: error: newly created file is older than distributed files! +Check your system clock" >&5 +echo "$as_me: error: newly created file is older than distributed files! +Check your system clock" >&2;} + { (exit 1); exit 1; }; } +fi +echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +test "$program_prefix" != NONE && + program_transform_name="s,^,$program_prefix,;$program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s,\$,$program_suffix,;$program_transform_name" +# Double any \ or $. echo might interpret backslashes. +# By default was `s,x,x', remove it if useless. +cat <<\_ACEOF >conftest.sed +s/[\\$]/&&/g;s/;s,x,x,$// +_ACEOF +program_transform_name=`echo $program_transform_name | sed -f conftest.sed` +rm conftest.sed + +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` + +test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 +echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} +fi + +if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then + # We used to keeping the `.' as first argument, in order to + # allow $(mkdir_p) to be used without argument. As in + # $(mkdir_p) $(somedir) + # where $(somedir) is conditionally defined. However this is wrong + # for two reasons: + # 1. if the package is installed by a user who cannot write `.' + # make install will fail, + # 2. the above comment should most certainly read + # $(mkdir_p) $(DESTDIR)$(somedir) + # so it does not work when $(somedir) is undefined and + # $(DESTDIR) is not. + # To support the latter case, we have to write + # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), + # so the `.' trick is pointless. + mkdir_p='mkdir -p --' +else + # On NextStep and OpenStep, the `mkdir' command does not + # recognize any option. It will interpret all options as + # directories to create, and then abort because `.' already + # exists. + for d in ./-p ./--version; + do + test -d $d && rmdir $d + done + # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. + if test -f "$ac_aux_dir/mkinstalldirs"; then + mkdir_p='$(mkinstalldirs)' + else + mkdir_p='$(install_sh) -d' + fi +fi + +for ac_prog in gawk mawk nawk awk +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_AWK+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$AWK"; then + ac_cv_prog_AWK="$AWK" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AWK="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +AWK=$ac_cv_prog_AWK +if test -n "$AWK"; then + echo "$as_me:$LINENO: result: $AWK" >&5 +echo "${ECHO_T}$AWK" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$AWK" && break +done + +echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'` +if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.make <<\_ACEOF +all: + @echo 'ac_maketemp="$(MAKE)"' +_ACEOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no +fi +rm -f conftest.make +fi +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + SET_MAKE= +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + SET_MAKE="MAKE=${MAKE-make}" +fi + +rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null + +# test to see if srcdir already configured +if test "`cd $srcdir && pwd`" != "`pwd`" && + test -f $srcdir/config.status; then + { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 +echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} + { (exit 1); exit 1; }; } +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi + + +# Define the identity of the package. + PACKAGE='grub' + VERSION='0.97' + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE "$PACKAGE" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define VERSION "$VERSION" +_ACEOF + +# Some tools Automake needs. + +ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} + + +AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} + + +AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} + + +AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} + + +MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} + +install_sh=${install_sh-"$am_aux_dir/install-sh"} + +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +if test "$cross_compiling" != no; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + echo "$as_me:$LINENO: result: $STRIP" >&5 +echo "${ECHO_T}$STRIP" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_STRIP="strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":" +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 +echo "${ECHO_T}$ac_ct_STRIP" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + STRIP=$ac_ct_STRIP +else + STRIP="$ac_cv_prog_STRIP" +fi + +fi +INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" + +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +# Always define AMTAR for backward compatibility. + +AMTAR=${AMTAR-"${am_missing_run}tar"} + +am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' + + + + + + +# Make sure we can run config.sub. +$ac_config_sub sun4 >/dev/null 2>&1 || + { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5 +echo "$as_me: error: cannot run $ac_config_sub" >&2;} + { (exit 1); exit 1; }; } + +echo "$as_me:$LINENO: checking build system type" >&5 +echo $ECHO_N "checking build system type... $ECHO_C" >&6 +if test "${ac_cv_build+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_build_alias=$build_alias +test -z "$ac_cv_build_alias" && + ac_cv_build_alias=`$ac_config_guess` +test -z "$ac_cv_build_alias" && + { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 +echo "$as_me: error: cannot guess build type; you must specify one" >&2;} + { (exit 1); exit 1; }; } +ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || + { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +echo "$as_me:$LINENO: result: $ac_cv_build" >&5 +echo "${ECHO_T}$ac_cv_build" >&6 +build=$ac_cv_build +build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + + +echo "$as_me:$LINENO: checking host system type" >&5 +echo $ECHO_N "checking host system type... $ECHO_C" >&6 +if test "${ac_cv_host+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_host_alias=$host_alias +test -z "$ac_cv_host_alias" && + ac_cv_host_alias=$ac_cv_build_alias +ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || + { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +echo "$as_me:$LINENO: result: $ac_cv_host" >&5 +echo "${ECHO_T}$ac_cv_host" >&6 +host=$ac_cv_host +host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + + + +case "$host_cpu" in +i[3456]86) host_cpu=i386 ;; +x86_64) host_cpu=x86_64 ;; +*) { { echo "$as_me:$LINENO: error: unsupported CPU type" >&5 +echo "$as_me: error: unsupported CPU type" >&2;} + { (exit 1); exit 1; }; } ;; +esac + + + + +# +# Options +# + +echo "$as_me:$LINENO: checking whether to enable maintainer-specific portions of Makefiles" >&5 +echo $ECHO_N "checking whether to enable maintainer-specific portions of Makefiles... $ECHO_C" >&6 + # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. +if test "${enable_maintainer_mode+set}" = set; then + enableval="$enable_maintainer_mode" + USE_MAINTAINER_MODE=$enableval +else + USE_MAINTAINER_MODE=no +fi; + echo "$as_me:$LINENO: result: $USE_MAINTAINER_MODE" >&5 +echo "${ECHO_T}$USE_MAINTAINER_MODE" >&6 + + +if test $USE_MAINTAINER_MODE = yes; then + MAINTAINER_MODE_TRUE= + MAINTAINER_MODE_FALSE='#' +else + MAINTAINER_MODE_TRUE='#' + MAINTAINER_MODE_FALSE= +fi + + MAINT=$MAINTAINER_MODE_TRUE + + +if test "x$enable_maintainer_mode" = xyes; then + # Extract the first word of "perl", so it can be a program name with args. +set dummy perl; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_PERL+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $PERL in + [\\/]* | ?:[\\/]*) + ac_cv_path_PERL="$PERL" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_PERL="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + ;; +esac +fi +PERL=$ac_cv_path_PERL + +if test -n "$PERL"; then + echo "$as_me:$LINENO: result: $PERL" >&5 +echo "${ECHO_T}$PERL" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + if test -z "$PERL"; then + { { echo "$as_me:$LINENO: error: perl not found" >&5 +echo "$as_me: error: perl not found" >&2;} + { (exit 1); exit 1; }; } + fi +fi + +# This should be checked before AC_PROG_CC +if test "x$CFLAGS" = x; then + default_CFLAGS=yes +fi + +if test "x$host_cpu" = xx86_64; then + CFLAGS="-m32 $CFLAGS" +fi + +# +# Programs +# + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ac_ct_CC" && break +done + + CC=$ac_ct_CC +fi + +fi + + +test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&5 +echo "$as_me: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + +# Provide some information about the compiler. +echo "$as_me:$LINENO:" \ + "checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 + (eval $ac_compiler --version &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 + (eval $ac_compiler -v &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 + (eval $ac_compiler -V &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 +echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6 +ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 + (eval $ac_link_default) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Find the output, starting from the most likely. This scheme is +# not robust to junk in `.', hence go to wildcards (a.*) only as a last +# resort. + +# Be careful to initialize this variable, since it used to be cached. +# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. +ac_cv_exeext= +# b.out is created by i960 compilers. +for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) + ;; + conftest.$ac_ext ) + # This is the source file. + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + # FIXME: I believe we export ac_cv_exeext for Libtool, + # but it would be cool to find out if it's true. Does anybody + # maintain Libtool? --akim. + export ac_cv_exeext + break;; + * ) + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: C compiler cannot create executables +See \`config.log' for more details." >&5 +echo "$as_me: error: C compiler cannot create executables +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } +fi + +ac_exeext=$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6 + +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:$LINENO: checking whether the C compiler works" >&5 +echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 +# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 +# If not cross compiling, check that we can run a simple program. +if test "$cross_compiling" != yes; then + if { ac_try='./$ac_file' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { echo "$as_me:$LINENO: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + fi + fi +fi +echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +rm -f a.out a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 +echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 +echo "$as_me:$LINENO: result: $cross_compiling" >&5 +echo "${ECHO_T}$cross_compiling" >&6 + +echo "$as_me:$LINENO: checking for suffix of executables" >&5 +echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + export ac_cv_exeext + break;; + * ) break;; + esac +done +else + { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 +echo "${ECHO_T}$ac_cv_exeext" >&6 + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +echo "$as_me:$LINENO: checking for suffix of object files" >&5 +echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 +if test "${ac_cv_objext+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 +echo "${ECHO_T}$ac_cv_objext" >&6 +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 +if test "${ac_cv_c_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_compiler_gnu=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +CFLAGS="-g" +echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_prog_cc_g=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 +echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_prog_cc_stdc=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std1 is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std1. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi +# Ultrix and OSF/1 -std1 +# HP-UX 10.20 and later -Ae +# HP-UX older versions -Aa -D_HPUX_SOURCE +# SVR4 -Xc -D__EXTENSIONS__ +for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_stdc=$ac_arg +break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext +done +rm -f conftest.$ac_ext conftest.$ac_objext +CC=$ac_save_CC + +fi + +case "x$ac_cv_prog_cc_stdc" in + x|xno) + echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6 ;; + *) + echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 + CC="$CC $ac_cv_prog_cc_stdc" ;; +esac + +# Some people use a C++ compiler to compile C. Since we use `exit', +# in C++ we need to declare it. In case someone uses the same compiler +# for both compiling C and C++ we need to have the C++ compiler decide +# the declaration of exit, since it's the most demanding environment. +cat >conftest.$ac_ext <<_ACEOF +#ifndef __cplusplus + choke me +#endif +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + for ac_declaration in \ + '' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +#include +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +continue +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +done +rm -f conftest* +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +fi + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +DEPDIR="${am__leading_dot}deps" + + ac_config_commands="$ac_config_commands depfiles" + + +am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo done +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5 +echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6 +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# We grep out `Entering directory' and `Leaving directory' +# messages which can occur if `w' ends up in MAKEFLAGS. +# In particular we don't look at `^make:' because GNU make might +# be invoked under some other name (usually "gmake"), in which +# case it prints its new name instead of `make'. +if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then + am__include=include + am__quote= + _am_result=GNU +fi +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then + am__include=.include + am__quote="\"" + _am_result=BSD + fi +fi + + +echo "$as_me:$LINENO: result: $_am_result" >&5 +echo "${ECHO_T}$_am_result" >&6 +rm -f confinc confmf + +# Check whether --enable-dependency-tracking or --disable-dependency-tracking was given. +if test "${enable_dependency_tracking+set}" = set; then + enableval="$enable_dependency_tracking" + +fi; +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' +fi + + +if test "x$enable_dependency_tracking" != xno; then + AMDEP_TRUE= + AMDEP_FALSE='#' +else + AMDEP_TRUE='#' + AMDEP_FALSE= +fi + + + + +depcc="$CC" am_compiler_list= + +echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 +echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6 +if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CC_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CC_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CC_dependencies_compiler_type=none +fi + +fi +echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 +echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6 +CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type + + + +if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then + am__fastdepCC_TRUE= + am__fastdepCC_FALSE='#' +else + am__fastdepCC_TRUE='#' + am__fastdepCC_FALSE= +fi + + +# We need this for older versions of Autoconf. + +depcc="$CC" am_compiler_list= + +echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 +echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6 +if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CC_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CC_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CC_dependencies_compiler_type=none +fi + +fi +echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 +echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6 +CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type + + + +if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then + am__fastdepCC_TRUE= + am__fastdepCC_FALSE='#' +else + am__fastdepCC_TRUE='#' + am__fastdepCC_FALSE= +fi + + + +CCAS="$CC" + + + +# Check whether --with-binutils or --without-binutils was given. +if test "${with_binutils+set}" = set; then + withval="$with_binutils" + +fi; + +if test "x$with_binutils" != x; then + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $RANLIB in + [\\/]* | ?:[\\/]*) + ac_cv_path_RANLIB="$RANLIB" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_dummy=""$with_binutils:$PATH"" +for as_dir in $as_dummy +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_RANLIB="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_path_RANLIB" && ac_cv_path_RANLIB=":" + ;; +esac +fi +RANLIB=$ac_cv_path_RANLIB + +if test -n "$RANLIB"; then + echo "$as_me:$LINENO: result: $RANLIB" >&5 +echo "${ECHO_T}$RANLIB" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +else + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + echo "$as_me:$LINENO: result: $RANLIB" >&5 +echo "${ECHO_T}$RANLIB" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 +echo "${ECHO_T}$ac_ct_RANLIB" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + RANLIB=$ac_ct_RANLIB +else + RANLIB="$ac_cv_prog_RANLIB" +fi + +fi + +# optimization flags +if test "x$ac_cv_c_compiler_gnu" = xyes; then + if test "x$default_CFLAGS" = xyes; then + # Autoconf may set CFLAGS to -O2 and/or -g. So eliminate them. + CFLAGS="`echo $CFLAGS | sed -e 's/-g//g' -e 's/-O[0-9]//g'` -g" + # If the user specify the directory for binutils, add the option `-B'. + if test "x$with_binutils" != x; then + CFLAGS="-B$with_binutils/ $CFLAGS" + fi + STAGE1_CFLAGS="-O2" + GRUB_CFLAGS="-O2" + +echo "$as_me:$LINENO: checking whether optimization for size works" >&5 +echo $ECHO_N "checking whether optimization for size works... $ECHO_C" >&6 +if test "${size_flag+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + saved_CFLAGS=$CFLAGS + CFLAGS="-Os -g" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + size_flag=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +size_flag=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS=$saved_CFLAGS + +fi +echo "$as_me:$LINENO: result: $size_flag" >&5 +echo "${ECHO_T}$size_flag" >&6 + if test "x$size_flag" = xyes; then + STAGE2_CFLAGS="-Os" + else + STAGE2_CFLAGS="-O2 -fno-strength-reduce -fno-unroll-loops" + fi + # OpenBSD has a GCC extension for protecting applications from + # stack smashing attacks, but GRUB doesn't want this feature. + echo "$as_me:$LINENO: checking whether gcc has -fno-stack-protector" >&5 +echo $ECHO_N "checking whether gcc has -fno-stack-protector... $ECHO_C" >&6 +if test "${no_stack_protector_flag+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + saved_CFLAGS=$CFLAGS + CFLAGS="-fno-stack-protector" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + no_stack_protector_flag=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +no_stack_protector_flag=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS=$saved_CFLAGS + +fi +echo "$as_me:$LINENO: result: $no_stack_protector_flag" >&5 +echo "${ECHO_T}$no_stack_protector_flag" >&6 + if test "x$no_stack_protector_flag" = xyes; then + STAGE2_CFLAGS="$STAGE2_CFLAGS -fno-stack-protector" + fi + fi +fi + + + + + +# Enforce coding standards. +CPPFLAGS="$CPPFLAGS -Wall -Wmissing-prototypes -Wunused -Wshadow" +CPPFLAGS="$CPPFLAGS -Wpointer-arith" + +echo "$as_me:$LINENO: checking whether -Wundef works" >&5 +echo $ECHO_N "checking whether -Wundef works... $ECHO_C" >&6 +if test "${undef_flag+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + saved_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="-Wundef" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + undef_flag=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +undef_flag=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + CPPFLAGS="$saved_CPPFLAGS" + +fi +echo "$as_me:$LINENO: result: $undef_flag" >&5 +echo "${ECHO_T}$undef_flag" >&6 + +# The options `-falign-*' are supported by gcc 3.0 or later. +# Probably it is sufficient to only check for -falign-loops. +echo "$as_me:$LINENO: checking whether -falign-loops works" >&5 +echo $ECHO_N "checking whether -falign-loops works... $ECHO_C" >&6 +if test "${falign_loop_flag+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + saved_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="-falign-loops=1" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + falign_loop_flag=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +falign_loop_flag=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + CPPFLAGS="$saved_CPPFLAGS" + +fi +echo "$as_me:$LINENO: result: $falign_loop_flag" >&5 +echo "${ECHO_T}$falign_loop_flag" >&6 + +# Force no alignment to save space. +if test "x$falign_loop_flag" = xyes; then + CPPFLAGS="$CPPFLAGS -falign-jumps=1 -falign-loops=1 -falign-functions=1" +else + CPPFLAGS="$CPPFLAGS -malign-jumps=1 -malign-loops=1 -malign-functions=1" +fi + +if test "x$undef_flag" = xyes; then + CPPFLAGS="$CPPFLAGS -Wundef" +fi + +if test "x$with_binutils" != x; then + # Extract the first word of "objcopy", so it can be a program name with args. +set dummy objcopy; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_OBJCOPY+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $OBJCOPY in + [\\/]* | ?:[\\/]*) + ac_cv_path_OBJCOPY="$OBJCOPY" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_dummy=""$with_binutils:$PATH"" +for as_dir in $as_dummy +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_OBJCOPY="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + ;; +esac +fi +OBJCOPY=$ac_cv_path_OBJCOPY + +if test -n "$OBJCOPY"; then + echo "$as_me:$LINENO: result: $OBJCOPY" >&5 +echo "${ECHO_T}$OBJCOPY" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +else + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}objcopy", so it can be a program name with args. +set dummy ${ac_tool_prefix}objcopy; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_OBJCOPY+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$OBJCOPY"; then + ac_cv_prog_OBJCOPY="$OBJCOPY" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_OBJCOPY="${ac_tool_prefix}objcopy" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +OBJCOPY=$ac_cv_prog_OBJCOPY +if test -n "$OBJCOPY"; then + echo "$as_me:$LINENO: result: $OBJCOPY" >&5 +echo "${ECHO_T}$OBJCOPY" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_OBJCOPY"; then + ac_ct_OBJCOPY=$OBJCOPY + # Extract the first word of "objcopy", so it can be a program name with args. +set dummy objcopy; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_OBJCOPY+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_OBJCOPY"; then + ac_cv_prog_ac_ct_OBJCOPY="$ac_ct_OBJCOPY" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_OBJCOPY="objcopy" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_OBJCOPY=$ac_cv_prog_ac_ct_OBJCOPY +if test -n "$ac_ct_OBJCOPY"; then + echo "$as_me:$LINENO: result: $ac_ct_OBJCOPY" >&5 +echo "${ECHO_T}$ac_ct_OBJCOPY" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + OBJCOPY=$ac_ct_OBJCOPY +else + OBJCOPY="$ac_cv_prog_OBJCOPY" +fi + +fi + +# Defined in acinclude.m4. + +echo "$as_me:$LINENO: checking if C symbols get an underscore after compilation" >&5 +echo $ECHO_N "checking if C symbols get an underscore after compilation... $ECHO_C" >&6 +if test "${grub_cv_asm_uscore+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat > conftest.c <<\EOF +int +func (int *list) +{ + *list = 0; + return *list; +} +EOF + +if { ac_try='${CC-cc} ${CFLAGS} -S conftest.c' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && test -s conftest.s; then + true +else + { { echo "$as_me:$LINENO: error: ${CC-cc} failed to produce assembly code" >&5 +echo "$as_me: error: ${CC-cc} failed to produce assembly code" >&2;} + { (exit 1); exit 1; }; } +fi + +if grep _func conftest.s >/dev/null 2>&1; then + grub_cv_asm_uscore=yes +else + grub_cv_asm_uscore=no +fi + +rm -f conftest* +fi + + +if test "x$grub_cv_asm_uscore" = xyes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_ASM_USCORE $grub_cv_asm_uscore +_ACEOF + +fi + +echo "$as_me:$LINENO: result: $grub_cv_asm_uscore" >&5 +echo "${ECHO_T}$grub_cv_asm_uscore" >&6 + +echo "$as_me:$LINENO: checking whether ${OBJCOPY} works for absolute addresses" >&5 +echo $ECHO_N "checking whether ${OBJCOPY} works for absolute addresses... $ECHO_C" >&6 +if test "${grub_cv_prog_objcopy_absolute+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat > conftest.c <<\EOF +void +cmain (void) +{ + *((int *) 0x1000) = 2; +} +EOF + +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && test -s conftest.o; then : +else + { { echo "$as_me:$LINENO: error: ${CC-cc} cannot compile C source code" >&5 +echo "$as_me: error: ${CC-cc} cannot compile C source code" >&2;} + { (exit 1); exit 1; }; } +fi +grub_cv_prog_objcopy_absolute=yes +for link_addr in 2000 8000 7C00; do + if { ac_try='${CC-cc} ${CFLAGS} -nostdlib -Wl,-N -Wl,-Ttext -Wl,$link_addr conftest.o -o conftest.exec' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then : + else + { { echo "$as_me:$LINENO: error: ${CC-cc} cannot link at address $link_addr" >&5 +echo "$as_me: error: ${CC-cc} cannot link at address $link_addr" >&2;} + { (exit 1); exit 1; }; } + fi + if { ac_try='${OBJCOPY-objcopy} -O binary conftest.exec conftest' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then : + else + { { echo "$as_me:$LINENO: error: ${OBJCOPY-objcopy} cannot create binary files" >&5 +echo "$as_me: error: ${OBJCOPY-objcopy} cannot create binary files" >&2;} + { (exit 1); exit 1; }; } + fi + if test ! -f conftest.old || { ac_try='cmp -s conftest.old conftest' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + mv -f conftest conftest.old + else + grub_cv_prog_objcopy_absolute=no + break + fi +done +rm -f conftest* +fi + +echo "$as_me:$LINENO: result: $grub_cv_prog_objcopy_absolute" >&5 +echo "${ECHO_T}$grub_cv_prog_objcopy_absolute" >&6 +if test "x$grub_cv_prog_objcopy_absolute" != xyes; then + { { echo "$as_me:$LINENO: error: GRUB requires a working absolute objcopy; upgrade your binutils" >&5 +echo "$as_me: error: GRUB requires a working absolute objcopy; upgrade your binutils" >&2;} + { (exit 1); exit 1; }; } +fi + + +echo "$as_me:$LINENO: checking whether addr32 must be in the same line as the instruction" >&5 +echo $ECHO_N "checking whether addr32 must be in the same line as the instruction... $ECHO_C" >&6 +if test "${grub_cv_asm_prefix_requirement+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat > conftest.s <<\EOF + .code16 +l1: addr32 movb %al, l1 +EOF + +if { ac_try='${CC-cc} ${CFLAGS} -c conftest.s' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && test -s conftest.o; then + grub_cv_asm_prefix_requirement=yes +else + grub_cv_asm_prefix_requirement=no +fi + +rm -f conftest* +fi + + +if test "x$grub_cv_asm_prefix_requirement" = xyes; then + grub_tmp_addr32="addr32" + grub_tmp_data32="data32" +else + grub_tmp_addr32="addr32;" + grub_tmp_data32="data32;" +fi + + +cat >>confdefs.h <<_ACEOF +#define ADDR32 $grub_tmp_addr32 +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define DATA32 $grub_tmp_data32 +_ACEOF + + +echo "$as_me:$LINENO: result: $grub_cv_asm_prefix_requirement" >&5 +echo "${ECHO_T}$grub_cv_asm_prefix_requirement" >&6 + + + +echo "$as_me:$LINENO: checking for .code16 addr32 assembler support" >&5 +echo $ECHO_N "checking for .code16 addr32 assembler support... $ECHO_C" >&6 +if test "${grub_cv_asm_addr32+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat > conftest.s.in <<\EOF + .code16 +l1: @ADDR32@ movb %al, l1 +EOF + +if test "x$grub_cv_asm_prefix_requirement" = xyes; then + sed -e s/@ADDR32@/addr32/ < conftest.s.in > conftest.s +else + sed -e s/@ADDR32@/addr32\;/ < conftest.s.in > conftest.s +fi + +if { ac_try='${CC-cc} ${CFLAGS} -c conftest.s' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && test -s conftest.o; then + grub_cv_asm_addr32=yes +else + grub_cv_asm_addr32=no +fi + +rm -f conftest* +fi + + +echo "$as_me:$LINENO: result: $grub_cv_asm_addr32" >&5 +echo "${ECHO_T}$grub_cv_asm_addr32" >&6 +if test "x$grub_cv_asm_addr32" != xyes; then + { { echo "$as_me:$LINENO: error: GRUB requires GAS .code16 addr32 support; upgrade your binutils" >&5 +echo "$as_me: error: GRUB requires GAS .code16 addr32 support; upgrade your binutils" >&2;} + { (exit 1); exit 1; }; } +fi + + +echo "$as_me:$LINENO: checking whether an absolute indirect call/jump must not be prefixed with an asterisk" >&5 +echo $ECHO_N "checking whether an absolute indirect call/jump must not be prefixed with an asterisk... $ECHO_C" >&6 +if test "${grub_cv_asm_absolute_without_asterisk+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat > conftest.s <<\EOF + lcall *(offset) +offset: + .long 0 + .word 0 +EOF + +if { ac_try='${CC-cc} ${CFLAGS} -c conftest.s' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && test -s conftest.o; then + grub_cv_asm_absolute_without_asterisk=no +else + grub_cv_asm_absolute_without_asterisk=yes +fi + +rm -f conftest* +fi + + +if test "x$grub_cv_asm_absolute_without_asterisk" = xyes; then + +cat >>confdefs.h <<\_ACEOF +#define ABSOLUTE_WITHOUT_ASTERISK 1 +_ACEOF + +fi + +echo "$as_me:$LINENO: result: $grub_cv_asm_absolute_without_asterisk" >&5 +echo "${ECHO_T}$grub_cv_asm_absolute_without_asterisk" >&6 + + +echo "$as_me:$LINENO: checking if start is defined by the compiler" >&5 +echo $ECHO_N "checking if start is defined by the compiler... $ECHO_C" >&6 +if test "${grub_cv_check_start_symbol+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +asm ("incl start") + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + grub_cv_check_start_symbol=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +grub_cv_check_start_symbol=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + + +if test "x$grub_cv_check_start_symbol" = xyes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_START_SYMBOL 1 +_ACEOF + +fi + +echo "$as_me:$LINENO: result: $grub_cv_check_start_symbol" >&5 +echo "${ECHO_T}$grub_cv_check_start_symbol" >&6 + + +echo "$as_me:$LINENO: checking if _start is defined by the compiler" >&5 +echo $ECHO_N "checking if _start is defined by the compiler... $ECHO_C" >&6 +if test "${grub_cv_check_uscore_start_symbol+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +asm ("incl _start") + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + grub_cv_check_uscore_start_symbol=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +grub_cv_check_uscore_start_symbol=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + + +if test "x$grub_cv_check_uscore_start_symbol" = xyes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_USCORE_START_SYMBOL 1 +_ACEOF + +fi + +echo "$as_me:$LINENO: result: $grub_cv_check_uscore_start_symbol" >&5 +echo "${ECHO_T}$grub_cv_check_uscore_start_symbol" >&6 + +if test "x$grub_cv_check_start_symbol" != "xyes" \ + -a "x$grub_cv_check_uscore_start_symbol" != "xyes"; then + { { echo "$as_me:$LINENO: error: Neither start nor _start is defined" >&5 +echo "$as_me: error: Neither start nor _start is defined" >&2;} + { (exit 1); exit 1; }; } +fi + + +echo "$as_me:$LINENO: checking if __bss_start is defined by the compiler" >&5 +echo $ECHO_N "checking if __bss_start is defined by the compiler... $ECHO_C" >&6 +if test "${grub_cv_check_uscore_uscore_bss_start_symbol+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +asm ("incl __bss_start") + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + grub_cv_check_uscore_uscore_bss_start_symbol=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +grub_cv_check_uscore_uscore_bss_start_symbol=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + + +if test "x$grub_cv_check_uscore_uscore_bss_start_symbol" = xyes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_USCORE_USCORE_BSS_START_SYMBOL 1 +_ACEOF + +fi + +echo "$as_me:$LINENO: result: $grub_cv_check_uscore_uscore_bss_start_symbol" >&5 +echo "${ECHO_T}$grub_cv_check_uscore_uscore_bss_start_symbol" >&6 + + +echo "$as_me:$LINENO: checking if _edata is defined by the compiler" >&5 +echo $ECHO_N "checking if _edata is defined by the compiler... $ECHO_C" >&6 +if test "${grub_cv_check_uscore_edata_symbol+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +asm ("incl _edata") + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + grub_cv_check_uscore_edata_symbol=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +grub_cv_check_uscore_edata_symbol=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + + +if test "x$grub_cv_check_uscore_edata_symbol" = xyes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_USCORE_EDATA_SYMBOL 1 +_ACEOF + +fi + +echo "$as_me:$LINENO: result: $grub_cv_check_uscore_edata_symbol" >&5 +echo "${ECHO_T}$grub_cv_check_uscore_edata_symbol" >&6 + + +echo "$as_me:$LINENO: checking if edata is defined by the compiler" >&5 +echo $ECHO_N "checking if edata is defined by the compiler... $ECHO_C" >&6 +if test "${grub_cv_check_edata_symbol+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +asm ("incl edata") + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + grub_cv_check_edata_symbol=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +grub_cv_check_edata_symbol=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + + +if test "x$grub_cv_check_edata_symbol" = xyes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_EDATA_SYMBOL 1 +_ACEOF + +fi + +echo "$as_me:$LINENO: result: $grub_cv_check_edata_symbol" >&5 +echo "${ECHO_T}$grub_cv_check_edata_symbol" >&6 + +if test "x$grub_cv_check_uscore_uscore_bss_start_symbol" != "xyes" \ + -a "x$grub_cv_check_uscore_edata_symbol" != "xyes" \ + -a "x$grub_cv_check_edata_symbol" != "xyes"; then + { { echo "$as_me:$LINENO: error: None of __bss_start, _edata, edata defined" >&5 +echo "$as_me: error: None of __bss_start, _edata, edata defined" >&2;} + { (exit 1); exit 1; }; } +fi + + +echo "$as_me:$LINENO: checking if end is defined by the compiler" >&5 +echo $ECHO_N "checking if end is defined by the compiler... $ECHO_C" >&6 +if test "${grub_cv_check_end_symbol+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +asm ("incl end") + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + grub_cv_check_end_symbol=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +grub_cv_check_end_symbol=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + + +if test "x$grub_cv_check_end_symbol" = xyes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_END_SYMBOL 1 +_ACEOF + +fi + +echo "$as_me:$LINENO: result: $grub_cv_check_end_symbol" >&5 +echo "${ECHO_T}$grub_cv_check_end_symbol" >&6 + + +echo "$as_me:$LINENO: checking if _end is defined by the compiler" >&5 +echo $ECHO_N "checking if _end is defined by the compiler... $ECHO_C" >&6 +if test "${grub_cv_check_uscore_end_symbol+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +asm ("incl _end") + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + grub_cv_check_uscore_end_symbol=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +grub_cv_check_uscore_end_symbol=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + + +if test "x$grub_cv_check_uscore_end_symbol" = xyes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_USCORE_END_SYMBOL 1 +_ACEOF + +fi + +echo "$as_me:$LINENO: result: $grub_cv_check_uscore_end_symbol" >&5 +echo "${ECHO_T}$grub_cv_check_uscore_end_symbol" >&6 + +if test "x$grub_cv_check_end_symbol" != "xyes" \ + -a "x$grub_cv_check_uscore_end_symbol" != "xyes"; then + { { echo "$as_me:$LINENO: error: Neither end nor _end is defined" >&5 +echo "$as_me: error: Neither end nor _end is defined" >&2;} + { (exit 1); exit 1; }; } +fi + +# Check for curses libraries. + +# Check whether --with-curses or --without-curses was given. +if test "${with_curses+set}" = set; then + withval="$with_curses" + +fi; + +# Get the filename or the whole disk and open it. +# Known to work on NetBSD. +echo "$as_me:$LINENO: checking for opendisk in -lutil" >&5 +echo $ECHO_N "checking for opendisk in -lutil... $ECHO_C" >&6 +if test "${ac_cv_lib_util_opendisk+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lutil $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char opendisk (); +int +main () +{ +opendisk (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_util_opendisk=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_util_opendisk=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_util_opendisk" >&5 +echo "${ECHO_T}$ac_cv_lib_util_opendisk" >&6 +if test $ac_cv_lib_util_opendisk = yes; then + GRUB_LIBS="$GRUB_LIBS -lutil" + +cat >>confdefs.h <<\_ACEOF +#define HAVE_OPENDISK 1 +_ACEOF + +fi + + +# Unless the user specify --without-curses, check for curses. +if test "x$with_curses" != "xno"; then + echo "$as_me:$LINENO: checking for wgetch in -lncurses" >&5 +echo $ECHO_N "checking for wgetch in -lncurses... $ECHO_C" >&6 +if test "${ac_cv_lib_ncurses_wgetch+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lncurses $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char wgetch (); +int +main () +{ +wgetch (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_ncurses_wgetch=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_ncurses_wgetch=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_ncurses_wgetch" >&5 +echo "${ECHO_T}$ac_cv_lib_ncurses_wgetch" >&6 +if test $ac_cv_lib_ncurses_wgetch = yes; then + GRUB_LIBS="$GRUB_LIBS -lncurses" + +cat >>confdefs.h <<\_ACEOF +#define HAVE_LIBCURSES 1 +_ACEOF + +else + echo "$as_me:$LINENO: checking for wgetch in -lcurses" >&5 +echo $ECHO_N "checking for wgetch in -lcurses... $ECHO_C" >&6 +if test "${ac_cv_lib_curses_wgetch+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lcurses $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char wgetch (); +int +main () +{ +wgetch (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_curses_wgetch=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_curses_wgetch=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_curses_wgetch" >&5 +echo "${ECHO_T}$ac_cv_lib_curses_wgetch" >&6 +if test $ac_cv_lib_curses_wgetch = yes; then + GRUB_LIBS="$GRUB_LIBS -lcurses" + +cat >>confdefs.h <<\_ACEOF +#define HAVE_LIBCURSES 1 +_ACEOF + +fi + +fi + +fi + + + +# Check for headers. +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 +echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test "${ac_cv_prog_CPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +echo "$as_me:$LINENO: result: $CPP" >&5 +echo "${ECHO_T}$CPP" >&6 +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : +else + { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +echo "$as_me:$LINENO: checking for egrep" >&5 +echo $ECHO_N "checking for egrep... $ECHO_C" >&6 +if test "${ac_cv_prog_egrep+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if echo a | (grep -E '(a|b)') >/dev/null 2>&1 + then ac_cv_prog_egrep='grep -E' + else ac_cv_prog_egrep='egrep' + fi +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 +echo "${ECHO_T}$ac_cv_prog_egrep" >&6 + EGREP=$ac_cv_prog_egrep + + +echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 +if test "${ac_cv_header_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_header_stdc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_header_stdc=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then + : +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + exit(2); + exit (0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_header_stdc=no +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6 +if test $ac_cv_header_stdc = yes; then + +cat >>confdefs.h <<\_ACEOF +#define STDC_HEADERS 1 +_ACEOF + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. + + + + + + + + + +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + + + + +for ac_header in string.h strings.h ncurses/curses.h ncurses.h curses.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------- ## +## Report this to bug-grub@gnu.org ## +## ------------------------------- ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +# Check for user options. + +# filesystems support. +# Check whether --enable-ext2fs or --disable-ext2fs was given. +if test "${enable_ext2fs+set}" = set; then + enableval="$enable_ext2fs" + +fi; + +if test x"$enable_ext2fs" != xno; then + FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_EXT2FS=1" +fi + +# Check whether --enable-fat or --disable-fat was given. +if test "${enable_fat+set}" = set; then + enableval="$enable_fat" + +fi; + +if test x"$enable_fat" != xno; then + FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_FAT=1" +fi + +# Check whether --enable-ffs or --disable-ffs was given. +if test "${enable_ffs+set}" = set; then + enableval="$enable_ffs" + +fi; + +if test x"$enable_ffs" != xno; then + FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_FFS=1" +fi + +# Check whether --enable-ufs or --disable-ufs was given. +if test "${enable_ufs+set}" = set; then + enableval="$enable_ufs" + +fi; + +if test x"$enable_ufs" != xno; then + FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_UFS=1" +fi + +# Check whether --enable-ufs2 or --disable-ufs2 was given. +if test "${enable_ufs2+set}" = set; then + enableval="$enable_ufs2" + +fi; + +if test x"$enable_ufs2" != xno; then + FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_UFS2=1" +fi + +# Check whether --enable-minix or --disable-minix was given. +if test "${enable_minix+set}" = set; then + enableval="$enable_minix" + +fi; + +if test x"$enable_minix" != xno; then + FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_MINIX=1" +fi + +# Check whether --enable-reiserfs or --disable-reiserfs was given. +if test "${enable_reiserfs+set}" = set; then + enableval="$enable_reiserfs" + +fi; + +if test x"$enable_reiserfs" != xno; then + FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_REISERFS=1" +fi + +# Check whether --enable-vstafs or --disable-vstafs was given. +if test "${enable_vstafs+set}" = set; then + enableval="$enable_vstafs" + +fi; + +if test x"$enable_vstafs" != xno; then + FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_VSTAFS=1" +fi + +# Check whether --enable-jfs or --disable-jfs was given. +if test "${enable_jfs+set}" = set; then + enableval="$enable_jfs" + +fi; + +if test x"$enable_jfs" != xno; then + FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_JFS=1" +fi + +# Check whether --enable-xfs or --disable-xfs was given. +if test "${enable_xfs+set}" = set; then + enableval="$enable_xfs" + +fi; + +if test x"$enable_xfs" != xno; then + FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_XFS=1" +fi + +# Check whether --enable-zfs or --disable-zfs was given. +if test "${enable_zfs+set}" = set; then + enableval="$enable_zfs" + +fi; + +if test x"$enable_zfs" != xno; then + FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_ZFS=1" +fi + +# Check whether --enable-iso9660 or --disable-iso9660 was given. +if test "${enable_iso9660+set}" = set; then + enableval="$enable_iso9660" + +fi; + +if test x"$enable_iso9660" != xno; then + FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_ISO9660=1" +fi + + +# Check whether --enable-gunzip or --disable-gunzip was given. +if test "${enable_gunzip+set}" = set; then + enableval="$enable_gunzip" + +fi; + +if test x"$enable_gunzip" = xno; then + FSYS_CFLAGS="$FSYS_CFLAGS -DNO_DECOMPRESSION=1" +fi + +# Check whether --enable-md5-password or --disable-md5-password was given. +if test "${enable_md5_password+set}" = set; then + enableval="$enable_md5_password" + +fi; +if test "x$enable_md5_password" != xno; then + FSYS_CFLAGS="$FSYS_CFLAGS -DUSE_MD5_PASSWORDS=1" +fi + +# Check whether --enable-packet-retransmission or --disable-packet-retransmission was given. +if test "${enable_packet_retransmission+set}" = set; then + enableval="$enable_packet_retransmission" + +fi; +if test "x$enable_packet_retransmission" != xno; then + NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DCONGESTED=1 -DCONFIG_PCI" +fi + +# Check whether --enable-pci-direct or --disable-pci-direct was given. +if test "${enable_pci_direct+set}" = set; then + enableval="$enable_pci_direct" + +fi; +if test "x$enable_pci_direct" = xyes; then + NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DCONFIG_PCI_DIRECT=1" +fi + +# Check whether --enable-3c595 or --disable-3c595 was given. +if test "${enable_3c595+set}" = set; then + enableval="$enable_3c595" + +fi; +if test "x$enable_3c595" = xyes; then + NET_CFLAGS="$NET_CFLAGS -DINCLUDE_3C595=1" + NETBOOT_DRIVERS="$NETBOOT_DRIVERS 3c595.o" +fi + +# Check whether --enable-3c90x or --disable-3c90x was given. +if test "${enable_3c90x+set}" = set; then + enableval="$enable_3c90x" + +fi; +if test "x$enable_3c90x" = xyes; then + NET_CFLAGS="$NET_CFLAGS -DINCLUDE_3C90X=1" + NETBOOT_DRIVERS="$NETBOOT_DRIVERS 3c90x.o" +fi + +# Check whether --enable-davicom or --disable-davicom was given. +if test "${enable_davicom+set}" = set; then + enableval="$enable_davicom" + +fi; +if test "x$enable_davicom" = xyes; then + NET_CFLAGS="$NET_CFLAGS -DINCLUDE_DAVICOM=1" + NETBOOT_DRIVERS="$NETBOOT_DRIVERS davicom.o" +fi + +# Check whether --enable-e1000 or --disable-e1000 was given. +if test "${enable_e1000+set}" = set; then + enableval="$enable_e1000" + +fi; +if test "x$enable_e1000" = xyes; then + NET_CFLAGS="$NET_CFLAGS -DINCLUDE_E1000=1" + NETBOOT_DRIVERS="$NETBOOT_DRIVERS e1000.o" +fi + +# Check whether --enable-eepro100 or --disable-eepro100 was given. +if test "${enable_eepro100+set}" = set; then + enableval="$enable_eepro100" + +fi; +if test "x$enable_eepro100" = xyes; then + NET_CFLAGS="$NET_CFLAGS -DINCLUDE_EEPRO100=1" + NETBOOT_DRIVERS="$NETBOOT_DRIVERS eepro100.o" +fi + +# Check whether --enable-epic100 or --disable-epic100 was given. +if test "${enable_epic100+set}" = set; then + enableval="$enable_epic100" + +fi; +if test "x$enable_epic100" = xyes; then + NET_CFLAGS="$NET_CFLAGS -DINCLUDE_EPIC100=1" + NETBOOT_DRIVERS="$NETBOOT_DRIVERS epic100.o" +fi + +# Check whether --enable-forcedeth or --disable-forcedeth was given. +if test "${enable_forcedeth+set}" = set; then + enableval="$enable_forcedeth" + +fi; +if test "x$enable_forcedeth" = xyes; then + NET_CFLAGS="$NET_CFLAGS -DINCLUDE_FORCEDETH=1" + NETBOOT_DRIVERS="$NETBOOT_DRIVERS forcedeth.o" +fi + +# Check whether --enable-natsemi or --disable-natsemi was given. +if test "${enable_natsemi+set}" = set; then + enableval="$enable_natsemi" + +fi; +if test "x$enable_natsemi" = xyes; then + NET_CFLAGS="$NET_CFLAGS -DINCLUDE_NATSEMI=1" + NETBOOT_DRIVERS="$NETBOOT_DRIVERS natsemi.o" +fi + +# Check whether --enable-ns83820 or --disable-ns83820 was given. +if test "${enable_ns83820+set}" = set; then + enableval="$enable_ns83820" + +fi; +if test "x$enable_ns83820" = xyes; then + NET_CFLAGS="$NET_CFLAGS -DINCLUDE_NS83820=1" + NETBOOT_DRIVERS="$NETBOOT_DRIVERS ns83820.o" +fi + +# Check whether --enable-ns8390 or --disable-ns8390 was given. +if test "${enable_ns8390+set}" = set; then + enableval="$enable_ns8390" + +fi; +if test "x$enable_ns8390" = xyes; then + NET_CFLAGS="$NET_CFLAGS -DINCLUDE_NS8390=1" + NETBOOT_DRIVERS="$NETBOOT_DRIVERS ns8390.o" +fi + +# Check whether --enable-pcnet32 or --disable-pcnet32 was given. +if test "${enable_pcnet32+set}" = set; then + enableval="$enable_pcnet32" + +fi; +if test "x$enable_pcnet32" = xyes; then + NET_CFLAGS="$NET_CFLAGS -DINCLUDE_PCNET32=1" + NETBOOT_DRIVERS="$NETBOOT_DRIVERS pcnet32.o" +fi + +# Check whether --enable-pnic or --disable-pnic was given. +if test "${enable_pnic+set}" = set; then + enableval="$enable_pnic" + +fi; +if test "x$enable_pnic" = xyes; then + NET_CFLAGS="$NET_CFLAGS -DINCLUDE_PNIC=1" + NETBOOT_DRIVERS="$NETBOOT_DRIVERS pnic.o" +fi + +# Check whether --enable-rtl8139 or --disable-rtl8139 was given. +if test "${enable_rtl8139+set}" = set; then + enableval="$enable_rtl8139" + +fi; +if test "x$enable_rtl8139" = xyes; then + NET_CFLAGS="$NET_CFLAGS -DINCLUDE_RTL8139=1" + NETBOOT_DRIVERS="$NETBOOT_DRIVERS rtl8139.o" +fi + +# Check whether --enable-r8169 or --disable-r8169 was given. +if test "${enable_r8169+set}" = set; then + enableval="$enable_r8169" + +fi; +if test "x$enable_r8169" = xyes; then + NET_CFLAGS="$NET_CFLAGS -DINCLUDE_R8169=1" + NETBOOT_DRIVERS="$NETBOOT_DRIVERS r8169.o" +fi + +# Check whether --enable-sis900 or --disable-sis900 was given. +if test "${enable_sis900+set}" = set; then + enableval="$enable_sis900" + +fi; +if test "x$enable_sis900" = xyes; then + NET_CFLAGS="$NET_CFLAGS -DINCLUDE_SIS900=1" + NETBOOT_DRIVERS="$NETBOOT_DRIVERS sis900.o" +fi + +# Check whether --enable-sundance or --disable-sundance was given. +if test "${enable_sundance+set}" = set; then + enableval="$enable_sundance" + +fi; +if test "x$enable_sundance" = xyes; then + NET_CFLAGS="$NET_CFLAGS -DINCLUDE_SUNDANCE=1" + NETBOOT_DRIVERS="$NETBOOT_DRIVERS sundance.o" +fi + +# Check whether --enable-tg3 or --disable-tg3 was given. +if test "${enable_tg3+set}" = set; then + enableval="$enable_tg3" + +fi; +if test "x$enable_tg3" = xyes; then + NET_CFLAGS="$NET_CFLAGS -DINCLUDE_TG3=1" + NETBOOT_DRIVERS="$NETBOOT_DRIVERS tg3.o" +fi + +# Check whether --enable-tulip or --disable-tulip was given. +if test "${enable_tulip+set}" = set; then + enableval="$enable_tulip" + +fi; +if test "x$enable_tulip" = xyes; then + NET_CFLAGS="$NET_CFLAGS -DINCLUDE_TULIP=1" + NETBOOT_DRIVERS="$NETBOOT_DRIVERS tulip.o" +fi + +# Check whether --enable-tlan or --disable-tlan was given. +if test "${enable_tlan+set}" = set; then + enableval="$enable_tlan" + +fi; +if test "x$enable_tlan" = xyes; then + NET_CFLAGS="$NET_CFLAGS -DINCLUDE_TLAN=1" + NETBOOT_DRIVERS="$NETBOOT_DRIVERS tlan.o" +fi + +# Check whether --enable-undi or --disable-undi was given. +if test "${enable_undi+set}" = set; then + enableval="$enable_undi" + +fi; +if test "x$enable_undi" = xyes; then + NET_CFLAGS="$NET_CFLAGS -DINCLUDE_UNDI=1" + NETBOOT_DRIVERS="$NETBOOT_DRIVERS undi.o" +fi + +# Check whether --enable-via-rhine or --disable-via-rhine was given. +if test "${enable_via_rhine+set}" = set; then + enableval="$enable_via_rhine" + +fi; +if test "x$enable_via_rhine" = xyes; then + NET_CFLAGS="$NET_CFLAGS -DINCLUDE_VIA_RHINE=1" + NETBOOT_DRIVERS="$NETBOOT_DRIVERS via_rhine.o" +fi + +# Check whether --enable-w89c840 or --disable-w89c840 was given. +if test "${enable_w89c840+set}" = set; then + enableval="$enable_w89c840" + +fi; +if test "x$enable_w89c840" = xyes; then + NET_CFLAGS="$NET_CFLAGS -DINCLUDE_W89C840=1" + NETBOOT_DRIVERS="$NETBOOT_DRIVERS w89c840.o" +fi + + + +if test "x$NET_CFLAGS" != x; then + NETBOOT_SUPPORT_TRUE= + NETBOOT_SUPPORT_FALSE='#' +else + NETBOOT_SUPPORT_TRUE='#' + NETBOOT_SUPPORT_FALSE= +fi + +if test "x$NET_CFLAGS" != x; then + FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_TFTP=1" +fi + +# Check whether --enable-compex-rl2000-fix or --disable-compex-rl2000-fix was given. +if test "${enable_compex_rl2000_fix+set}" = set; then + enableval="$enable_compex_rl2000_fix" + +fi; +if test "x$enable_compex_rl2000_fix" = xyes; then + NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DCOMPEX_RL2000_FIX=1" +fi + +# Check whether --enable-ne-scan or --disable-ne-scan was given. +if test "${enable_ne_scan+set}" = set; then + enableval="$enable_ne_scan" + NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DNE_SCAN=$enable_ne_scan" +else + NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DNE_SCAN=0x280,0x300,0x320,0x340" +fi; + +# Check whether --enable-wd-default-mem or --disable-wd-default-mem was given. +if test "${enable_wd_default_mem+set}" = set; then + enableval="$enable_wd_default_mem" + NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DWD_DEFAULT_MEM=$enable_wd_default_mem" +else + NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DWD_DEFAULT_MEM=0xCC000" +fi; + +# Check whether --enable-diskless or --disable-diskless was given. +if test "${enable_diskless+set}" = set; then + enableval="$enable_diskless" + +fi; + + +if test "x$enable_diskless" = xyes; then + DISKLESS_SUPPORT_TRUE= + DISKLESS_SUPPORT_FALSE='#' +else + DISKLESS_SUPPORT_TRUE='#' + DISKLESS_SUPPORT_FALSE= +fi + + +# Check whether --enable-graphics or --disable-graphics was given. +if test "${enable_graphics+set}" = set; then + enableval="$enable_graphics" + +fi; + + +if test "x$enable_graphics" != xno; then + GRAPHICS_SUPPORT_TRUE= + GRAPHICS_SUPPORT_FALSE='#' +else + GRAPHICS_SUPPORT_TRUE='#' + GRAPHICS_SUPPORT_FALSE= +fi + + +# Check whether --enable-hercules or --disable-hercules was given. +if test "${enable_hercules+set}" = set; then + enableval="$enable_hercules" + +fi; + + +if test "x$enable_hercules" != xno; then + HERCULES_SUPPORT_TRUE= + HERCULES_SUPPORT_FALSE='#' +else + HERCULES_SUPPORT_TRUE='#' + HERCULES_SUPPORT_FALSE= +fi + + +# Check whether --enable-serial or --disable-serial was given. +if test "${enable_serial+set}" = set; then + enableval="$enable_serial" + +fi; + + +if test "x$enable_serial" != xno; then + SERIAL_SUPPORT_TRUE= + SERIAL_SUPPORT_FALSE='#' +else + SERIAL_SUPPORT_TRUE='#' + SERIAL_SUPPORT_FALSE= +fi + + +# Check whether --enable-serial-speed-simulation or --disable-serial-speed-simulation was given. +if test "${enable_serial_speed_simulation+set}" = set; then + enableval="$enable_serial_speed_simulation" + +fi; + + +if test "x$enable_serial_speed_simulation" = xyes; then + SERIAL_SPEED_SIMULATION_TRUE= + SERIAL_SPEED_SIMULATION_FALSE='#' +else + SERIAL_SPEED_SIMULATION_TRUE='#' + SERIAL_SPEED_SIMULATION_FALSE= +fi + + +# Sanity check. +if test "x$enable_diskless" = xyes; then + if test "x$NET_CFLAGS" = x; then + { { echo "$as_me:$LINENO: error: You must enable at least one network driver" >&5 +echo "$as_me: error: You must enable at least one network driver" >&2;} + { (exit 1); exit 1; }; } + fi +fi + +# Check whether --enable-preset-menu or --disable-preset-menu was given. +if test "${enable_preset_menu+set}" = set; then + enableval="$enable_preset_menu" + +fi; +if test "x$enable_preset_menu" = x; then + : +else + if test -r $enable_preset_menu; then + +# Because early versions of GNU sed 3.x are too buggy, use a C program +# instead of shell commands. *sigh* +cat >conftest.c <<\EOF +#include + +int +main (void) +{ + int c; + + while ((c = getchar ()) != EOF) + { + switch (c) + { + case '\n': + fputs ("\\n", stdout); + break; + case '\r': + fputs ("\\r", stdout); + break; + case '\\': + fputs ("\\\\", stdout); + break; + case '"': + fputs ("\\\"", stdout); + break; + default: + putchar (c); + } + } + + return 0; +} +EOF + +if { ac_try='${CC-cc} ${CFLAGS} conftest.c -o conftest' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && test -s conftest; then + grub_tmp_value=`./conftest < "$enable_preset_menu"` +else + { { echo "$as_me:$LINENO: error: ${CC-cc} failed to produce an executable file" >&5 +echo "$as_me: error: ${CC-cc} failed to produce an executable file" >&2;} + { (exit 1); exit 1; }; } +fi + + +cat >>confdefs.h <<_ACEOF +#define PRESET_MENU_STRING "$grub_tmp_value" +_ACEOF + +rm -f conftest* + + else + { { echo "$as_me:$LINENO: error: Cannot read the preset menu file $enable_preset_menu" >&5 +echo "$as_me: error: Cannot read the preset menu file $enable_preset_menu" >&2;} + { (exit 1); exit 1; }; } + fi +fi + +# Check whether --enable-example-kernel or --disable-example-kernel was given. +if test "${enable_example_kernel+set}" = set; then + enableval="$enable_example_kernel" + +fi; + + +if test "x$enable_example_kernel" = xyes; then + BUILD_EXAMPLE_KERNEL_TRUE= + BUILD_EXAMPLE_KERNEL_FALSE='#' +else + BUILD_EXAMPLE_KERNEL_TRUE='#' + BUILD_EXAMPLE_KERNEL_FALSE= +fi + + +# Check whether --enable-auto-linux-mem-opt or --disable-auto-linux-mem-opt was given. +if test "${enable_auto_linux_mem_opt+set}" = set; then + enableval="$enable_auto_linux_mem_opt" + +fi; +if test "x$enable_auto_linux_mem_opt" = xno; then + : +else + +cat >>confdefs.h <<\_ACEOF +#define AUTO_LINUX_MEM_OPT 1 +_ACEOF + +fi + + + + + + +CCASFLAGS='$(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)' + + + + ac_config_files="$ac_config_files Makefile stage1/Makefile stage2/Makefile docs/Makefile lib/Makefile util/Makefile grub/Makefile netboot/Makefile util/grub-image util/grub-install util/grub-md5-crypt util/grub-terminfo util/grub-set-default" + +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +{ + (set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} | + sed ' + t clear + : clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + : end' >>confcache +if diff $cache_file confcache >/dev/null 2>&1; then :; else + if test -w $cache_file; then + test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" + cat confcache >$cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/; +s/:*\${srcdir}:*/:/; +s/:*@srcdir@:*/:/; +s/^\([^=]*=[ ]*\):*/\1/; +s/:*$//; +s/^[^=]*=[ ]*$//; +}' +fi + +DEFS=-DHAVE_CONFIG_H + +ac_libobjs= +ac_ltlibobjs= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_i=`echo "$ac_i" | + sed 's/\$U\././;s/\.o$//;s/\.obj$//'` + # 2. Add them. + ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" + ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + +if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"MAINTAINER_MODE\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"MAINTAINER_MODE\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${NETBOOT_SUPPORT_TRUE}" && test -z "${NETBOOT_SUPPORT_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"NETBOOT_SUPPORT\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"NETBOOT_SUPPORT\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${DISKLESS_SUPPORT_TRUE}" && test -z "${DISKLESS_SUPPORT_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"DISKLESS_SUPPORT\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"DISKLESS_SUPPORT\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${GRAPHICS_SUPPORT_TRUE}" && test -z "${GRAPHICS_SUPPORT_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"GRAPHICS_SUPPORT\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"GRAPHICS_SUPPORT\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${HERCULES_SUPPORT_TRUE}" && test -z "${HERCULES_SUPPORT_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"HERCULES_SUPPORT\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"HERCULES_SUPPORT\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${SERIAL_SUPPORT_TRUE}" && test -z "${SERIAL_SUPPORT_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"SERIAL_SUPPORT\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"SERIAL_SUPPORT\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${SERIAL_SPEED_SIMULATION_TRUE}" && test -z "${SERIAL_SPEED_SIMULATION_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"SERIAL_SPEED_SIMULATION\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"SERIAL_SPEED_SIMULATION\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${BUILD_EXAMPLE_KERNEL_TRUE}" && test -z "${BUILD_EXAMPLE_KERNEL_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"BUILD_EXAMPLE_KERNEL\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"BUILD_EXAMPLE_KERNEL\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi + +: ${CONFIG_STATUS=./config.status} +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 +echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false +SHELL=\${CONFIG_SHELL-$SHELL} +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi +DUALCASE=1; export DUALCASE # for MKS sh + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# Work around bugs in pre-3.0 UWIN ksh. +$as_unset ENV MAIL MAILPATH +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + + +# PATH needs CR, and LINENO needs CR and PATH. +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done + + ;; + esac + # We did not find ourselves, most probably we were run as `sh COMMAND' + # in which case we are not to be found in the path. + if test "x$as_myself" = x; then + as_myself=$0 + fi + if test ! -f "$as_myself"; then + { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 +echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, and appends trailing '-' during + # substitution so that $LINENO is not a special case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 +echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_executable_p="test -f" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH + +exec 6>&1 + +# Open the log real soon, to keep \$[0] and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. Logging --version etc. is OK. +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX +} >&5 +cat >&5 <<_CSEOF + +This file was extended by GRUB $as_me 0.97, which was +generated by GNU Autoconf 2.59. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +_CSEOF +echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 +echo >&5 +_ACEOF + +# Files that config.status was made for. +if test -n "$ac_config_files"; then + echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_headers"; then + echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_links"; then + echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_commands"; then + echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS +fi + +cat >>$CONFIG_STATUS <<\_ACEOF + +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number, then exit + -q, --quiet do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Configuration commands: +$config_commands + +Report bugs to ." +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +ac_cs_version="\\ +GRUB config.status 0.97 +configured by $0, generated by GNU Autoconf 2.59, + with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" + +Copyright (C) 2003 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." +srcdir=$srcdir +INSTALL="$INSTALL" +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "x$1" : 'x\([^=]*\)='` + ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` + ac_shift=: + ;; + -*) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + *) # This is not an option, so the user has probably given explicit + # arguments. + ac_option=$1 + ac_need_defaults=false;; + esac + + case $ac_option in + # Handling of the options. +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --vers* | -V ) + echo "$ac_cs_version"; exit 0 ;; + --he | --h) + # Conflict between --help and --header + { { echo "$as_me:$LINENO: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; };; + --help | --hel | -h ) + echo "$ac_cs_usage"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + CONFIG_FILES="$CONFIG_FILES $ac_optarg" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" + ac_need_defaults=false;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; } ;; + + *) ac_config_targets="$ac_config_targets $1" ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +if \$ac_cs_recheck; then + echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 + exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion +fi + +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +# +# INIT-COMMANDS section. +# + +AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" + +_ACEOF + + + +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_config_target in $ac_config_targets +do + case "$ac_config_target" in + # Handling of arguments. + "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "stage1/Makefile" ) CONFIG_FILES="$CONFIG_FILES stage1/Makefile" ;; + "stage2/Makefile" ) CONFIG_FILES="$CONFIG_FILES stage2/Makefile" ;; + "docs/Makefile" ) CONFIG_FILES="$CONFIG_FILES docs/Makefile" ;; + "lib/Makefile" ) CONFIG_FILES="$CONFIG_FILES lib/Makefile" ;; + "util/Makefile" ) CONFIG_FILES="$CONFIG_FILES util/Makefile" ;; + "grub/Makefile" ) CONFIG_FILES="$CONFIG_FILES grub/Makefile" ;; + "netboot/Makefile" ) CONFIG_FILES="$CONFIG_FILES netboot/Makefile" ;; + "util/grub-image" ) CONFIG_FILES="$CONFIG_FILES util/grub-image" ;; + "util/grub-install" ) CONFIG_FILES="$CONFIG_FILES util/grub-install" ;; + "util/grub-md5-crypt" ) CONFIG_FILES="$CONFIG_FILES util/grub-md5-crypt" ;; + "util/grub-terminfo" ) CONFIG_FILES="$CONFIG_FILES util/grub-terminfo" ;; + "util/grub-set-default" ) CONFIG_FILES="$CONFIG_FILES util/grub-set-default" ;; + "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; + *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 +echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; + esac +done + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers + test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason to put it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Create a temporary directory, and hook for its removal unless debugging. +$debug || +{ + trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} + +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=./confstat$$-$RANDOM + (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in ." >&2 + { (exit 1); exit 1; } +} + +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF + +# +# CONFIG_FILES section. +# + +# No need to generate the scripts if there are no CONFIG_FILES. +# This happens for instance when ./config.status config.h +if test -n "\$CONFIG_FILES"; then + # Protect against being on the right side of a sed subst in config.status. + sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; + s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF +s,@SHELL@,$SHELL,;t t +s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t +s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t +s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t +s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t +s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t +s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t +s,@exec_prefix@,$exec_prefix,;t t +s,@prefix@,$prefix,;t t +s,@program_transform_name@,$program_transform_name,;t t +s,@bindir@,$bindir,;t t +s,@sbindir@,$sbindir,;t t +s,@libexecdir@,$libexecdir,;t t +s,@datadir@,$datadir,;t t +s,@sysconfdir@,$sysconfdir,;t t +s,@sharedstatedir@,$sharedstatedir,;t t +s,@localstatedir@,$localstatedir,;t t +s,@libdir@,$libdir,;t t +s,@includedir@,$includedir,;t t +s,@oldincludedir@,$oldincludedir,;t t +s,@infodir@,$infodir,;t t +s,@mandir@,$mandir,;t t +s,@build_alias@,$build_alias,;t t +s,@host_alias@,$host_alias,;t t +s,@target_alias@,$target_alias,;t t +s,@DEFS@,$DEFS,;t t +s,@ECHO_C@,$ECHO_C,;t t +s,@ECHO_N@,$ECHO_N,;t t +s,@ECHO_T@,$ECHO_T,;t t +s,@LIBS@,$LIBS,;t t +s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t +s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t +s,@INSTALL_DATA@,$INSTALL_DATA,;t t +s,@CYGPATH_W@,$CYGPATH_W,;t t +s,@PACKAGE@,$PACKAGE,;t t +s,@VERSION@,$VERSION,;t t +s,@ACLOCAL@,$ACLOCAL,;t t +s,@AUTOCONF@,$AUTOCONF,;t t +s,@AUTOMAKE@,$AUTOMAKE,;t t +s,@AUTOHEADER@,$AUTOHEADER,;t t +s,@MAKEINFO@,$MAKEINFO,;t t +s,@install_sh@,$install_sh,;t t +s,@STRIP@,$STRIP,;t t +s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t +s,@INSTALL_STRIP_PROGRAM@,$INSTALL_STRIP_PROGRAM,;t t +s,@mkdir_p@,$mkdir_p,;t t +s,@AWK@,$AWK,;t t +s,@SET_MAKE@,$SET_MAKE,;t t +s,@am__leading_dot@,$am__leading_dot,;t t +s,@AMTAR@,$AMTAR,;t t +s,@am__tar@,$am__tar,;t t +s,@am__untar@,$am__untar,;t t +s,@build@,$build,;t t +s,@build_cpu@,$build_cpu,;t t +s,@build_vendor@,$build_vendor,;t t +s,@build_os@,$build_os,;t t +s,@host@,$host,;t t +s,@host_cpu@,$host_cpu,;t t +s,@host_vendor@,$host_vendor,;t t +s,@host_os@,$host_os,;t t +s,@MAINTAINER_MODE_TRUE@,$MAINTAINER_MODE_TRUE,;t t +s,@MAINTAINER_MODE_FALSE@,$MAINTAINER_MODE_FALSE,;t t +s,@MAINT@,$MAINT,;t t +s,@PERL@,$PERL,;t t +s,@CC@,$CC,;t t +s,@ac_ct_CC@,$ac_ct_CC,;t t +s,@CFLAGS@,$CFLAGS,;t t +s,@LDFLAGS@,$LDFLAGS,;t t +s,@CPPFLAGS@,$CPPFLAGS,;t t +s,@EXEEXT@,$EXEEXT,;t t +s,@OBJEXT@,$OBJEXT,;t t +s,@DEPDIR@,$DEPDIR,;t t +s,@am__include@,$am__include,;t t +s,@am__quote@,$am__quote,;t t +s,@AMDEP_TRUE@,$AMDEP_TRUE,;t t +s,@AMDEP_FALSE@,$AMDEP_FALSE,;t t +s,@AMDEPBACKSLASH@,$AMDEPBACKSLASH,;t t +s,@CCDEPMODE@,$CCDEPMODE,;t t +s,@am__fastdepCC_TRUE@,$am__fastdepCC_TRUE,;t t +s,@am__fastdepCC_FALSE@,$am__fastdepCC_FALSE,;t t +s,@CCAS@,$CCAS,;t t +s,@RANLIB@,$RANLIB,;t t +s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t +s,@STAGE1_CFLAGS@,$STAGE1_CFLAGS,;t t +s,@STAGE2_CFLAGS@,$STAGE2_CFLAGS,;t t +s,@GRUB_CFLAGS@,$GRUB_CFLAGS,;t t +s,@OBJCOPY@,$OBJCOPY,;t t +s,@ac_ct_OBJCOPY@,$ac_ct_OBJCOPY,;t t +s,@GRUB_LIBS@,$GRUB_LIBS,;t t +s,@CPP@,$CPP,;t t +s,@EGREP@,$EGREP,;t t +s,@NETBOOT_SUPPORT_TRUE@,$NETBOOT_SUPPORT_TRUE,;t t +s,@NETBOOT_SUPPORT_FALSE@,$NETBOOT_SUPPORT_FALSE,;t t +s,@DISKLESS_SUPPORT_TRUE@,$DISKLESS_SUPPORT_TRUE,;t t +s,@DISKLESS_SUPPORT_FALSE@,$DISKLESS_SUPPORT_FALSE,;t t +s,@GRAPHICS_SUPPORT_TRUE@,$GRAPHICS_SUPPORT_TRUE,;t t +s,@GRAPHICS_SUPPORT_FALSE@,$GRAPHICS_SUPPORT_FALSE,;t t +s,@HERCULES_SUPPORT_TRUE@,$HERCULES_SUPPORT_TRUE,;t t +s,@HERCULES_SUPPORT_FALSE@,$HERCULES_SUPPORT_FALSE,;t t +s,@SERIAL_SUPPORT_TRUE@,$SERIAL_SUPPORT_TRUE,;t t +s,@SERIAL_SUPPORT_FALSE@,$SERIAL_SUPPORT_FALSE,;t t +s,@SERIAL_SPEED_SIMULATION_TRUE@,$SERIAL_SPEED_SIMULATION_TRUE,;t t +s,@SERIAL_SPEED_SIMULATION_FALSE@,$SERIAL_SPEED_SIMULATION_FALSE,;t t +s,@BUILD_EXAMPLE_KERNEL_TRUE@,$BUILD_EXAMPLE_KERNEL_TRUE,;t t +s,@BUILD_EXAMPLE_KERNEL_FALSE@,$BUILD_EXAMPLE_KERNEL_FALSE,;t t +s,@FSYS_CFLAGS@,$FSYS_CFLAGS,;t t +s,@NET_CFLAGS@,$NET_CFLAGS,;t t +s,@NET_EXTRAFLAGS@,$NET_EXTRAFLAGS,;t t +s,@NETBOOT_DRIVERS@,$NETBOOT_DRIVERS,;t t +s,@CCASFLAGS@,$CCASFLAGS,;t t +s,@LIBOBJS@,$LIBOBJS,;t t +s,@LTLIBOBJS@,$LTLIBOBJS,;t t +CEOF + +_ACEOF + + cat >>$CONFIG_STATUS <<\_ACEOF + # Split the substitutions into bite-sized pieces for seds with + # small command number limits, like on Digital OSF/1 and HP-UX. + ac_max_sed_lines=48 + ac_sed_frag=1 # Number of current file. + ac_beg=1 # First line for current file. + ac_end=$ac_max_sed_lines # Line after last line for current file. + ac_more_lines=: + ac_sed_cmds= + while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + else + sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + fi + if test ! -s $tmp/subs.frag; then + ac_more_lines=false + else + # The purpose of the label and of the branching condition is to + # speed up the sed processing (if there are no `@' at all, there + # is no need to browse any of the substitutions). + # These are the two extra sed commands mentioned above. + (echo ':t + /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" + else + ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" + fi + ac_sed_frag=`expr $ac_sed_frag + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_lines` + fi + done + if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat + fi +fi # test -n "$CONFIG_FILES" + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. + ac_dir=`(dirname "$ac_file") 2>/dev/null || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac + + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_builddir$INSTALL ;; + esac + + if test x"$ac_file" != x-; then + { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + rm -f "$ac_file" + fi + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + if test x"$ac_file" = x-; then + configure_input= + else + configure_input="$ac_file. " + fi + configure_input=$configure_input"Generated from `echo $ac_file_in | + sed 's,.*/,,'` by configure." + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo "$f";; + *) # Relative + if test -f "$f"; then + # Build tree + echo "$f" + elif test -f "$srcdir/$f"; then + # Source tree + echo "$srcdir/$f" + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF + sed "$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s,@configure_input@,$configure_input,;t t +s,@srcdir@,$ac_srcdir,;t t +s,@abs_srcdir@,$ac_abs_srcdir,;t t +s,@top_srcdir@,$ac_top_srcdir,;t t +s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t +s,@builddir@,$ac_builddir,;t t +s,@abs_builddir@,$ac_abs_builddir,;t t +s,@top_builddir@,$ac_top_builddir,;t t +s,@abs_top_builddir@,$ac_abs_top_builddir,;t t +s,@INSTALL@,$ac_INSTALL,;t t +" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out + rm -f $tmp/stdin + if test x"$ac_file" != x-; then + mv $tmp/out $ac_file + else + cat $tmp/out + rm -f $tmp/out + fi + +done +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + +# +# CONFIG_HEADER section. +# + +# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where +# NAME is the cpp macro being defined and VALUE is the value it is being given. +# +# ac_d sets the value in "#define NAME VALUE" lines. +ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='[ ].*$,\1#\2' +ac_dC=' ' +ac_dD=',;t' +# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='$,\1#\2define\3' +ac_uC=' ' +ac_uD=',;t' + +for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + # Do quote $f, to prevent DOS paths from being IFS'd. + echo "$f";; + *) # Relative + if test -f "$f"; then + # Build tree + echo "$f" + elif test -f "$srcdir/$f"; then + # Source tree + echo "$srcdir/$f" + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } + # Remove the trailing spaces. + sed 's/[ ]*$//' $ac_file_inputs >$tmp/in + +_ACEOF + +# Transform confdefs.h into two sed scripts, `conftest.defines' and +# `conftest.undefs', that substitutes the proper values into +# config.h.in to produce config.h. The first handles `#define' +# templates, and the second `#undef' templates. +# And first: Protect against being on the right side of a sed subst in +# config.status. Protect against being in an unquoted here document +# in config.status. +rm -f conftest.defines conftest.undefs +# Using a here document instead of a string reduces the quoting nightmare. +# Putting comments in sed scripts is not portable. +# +# `end' is used to avoid that the second main sed command (meant for +# 0-ary CPP macros) applies to n-ary macro definitions. +# See the Autoconf documentation for `clear'. +cat >confdef2sed.sed <<\_ACEOF +s/[\\&,]/\\&/g +s,[\\$`],\\&,g +t clear +: clear +s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp +t end +s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp +: end +_ACEOF +# If some macros were called several times there might be several times +# the same #defines, which is useless. Nevertheless, we may not want to +# sort them, since we want the *last* AC-DEFINE to be honored. +uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines +sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs +rm -f confdef2sed.sed + +# This sed command replaces #undef with comments. This is necessary, for +# example, in the case of _POSIX_SOURCE, which is predefined and required +# on some systems where configure will not decide to define it. +cat >>conftest.undefs <<\_ACEOF +s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, +_ACEOF + +# Break up conftest.defines because some shells have a limit on the size +# of here documents, and old seds have small limits too (100 cmds). +echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS +echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS +echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS +echo ' :' >>$CONFIG_STATUS +rm -f conftest.tail +while grep . conftest.defines >/dev/null +do + # Write a limited-size here document to $tmp/defines.sed. + echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS + # Speed up: don't consider the non `#define' lines. + echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS + # Work around the forget-to-reset-the-flag bug. + echo 't clr' >>$CONFIG_STATUS + echo ': clr' >>$CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS + echo 'CEOF + sed -f $tmp/defines.sed $tmp/in >$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in +' >>$CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail + rm -f conftest.defines + mv conftest.tail conftest.defines +done +rm -f conftest.defines +echo ' fi # grep' >>$CONFIG_STATUS +echo >>$CONFIG_STATUS + +# Break up conftest.undefs because some shells have a limit on the size +# of here documents, and old seds have small limits too (100 cmds). +echo ' # Handle all the #undef templates' >>$CONFIG_STATUS +rm -f conftest.tail +while grep . conftest.undefs >/dev/null +do + # Write a limited-size here document to $tmp/undefs.sed. + echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS + # Speed up: don't consider the non `#undef' + echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS + # Work around the forget-to-reset-the-flag bug. + echo 't clr' >>$CONFIG_STATUS + echo ': clr' >>$CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS + echo 'CEOF + sed -f $tmp/undefs.sed $tmp/in >$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in +' >>$CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail + rm -f conftest.undefs + mv conftest.tail conftest.undefs +done +rm -f conftest.undefs + +cat >>$CONFIG_STATUS <<\_ACEOF + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + if test x"$ac_file" = x-; then + echo "/* Generated by configure. */" >$tmp/config.h + else + echo "/* $ac_file. Generated by configure. */" >$tmp/config.h + fi + cat $tmp/in >>$tmp/config.h + rm -f $tmp/in + if test x"$ac_file" != x-; then + if diff $ac_file $tmp/config.h >/dev/null 2>&1; then + { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 +echo "$as_me: $ac_file is unchanged" >&6;} + else + ac_dir=`(dirname "$ac_file") 2>/dev/null || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + + rm -f $ac_file + mv $tmp/config.h $ac_file + fi + else + cat $tmp/config.h + rm -f $tmp/config.h + fi +# Compute $ac_file's index in $config_headers. +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $ac_file | $ac_file:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $ac_file" >`(dirname $ac_file) 2>/dev/null || +$as_expr X$ac_file : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X$ac_file : 'X\(//\)[^/]' \| \ + X$ac_file : 'X\(//\)$' \| \ + X$ac_file : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X$ac_file | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'`/stamp-h$_am_stamp_count +done +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + +# +# CONFIG_COMMANDS section. +# +for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue + ac_dest=`echo "$ac_file" | sed 's,:.*,,'` + ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_dir=`(dirname "$ac_dest") 2>/dev/null || +$as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_dest" : 'X\(//\)[^/]' \| \ + X"$ac_dest" : 'X\(//\)$' \| \ + X"$ac_dest" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_dest" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac + + + { echo "$as_me:$LINENO: executing $ac_dest commands" >&5 +echo "$as_me: executing $ac_dest commands" >&6;} + case $ac_dest in + depfiles ) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # So let's grep whole file. + if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then + dirpart=`(dirname "$mf") 2>/dev/null || +$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$mf" : 'X\(//\)[^/]' \| \ + X"$mf" : 'X\(//\)$' \| \ + X"$mf" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$mf" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n 's/^U = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`(dirname "$file") 2>/dev/null || +$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$file" : 'X\(//\)[^/]' \| \ + X"$file" : 'X\(//\)$' \| \ + X"$file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p $dirpart/$fdir + else + as_dir=$dirpart/$fdir + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory $dirpart/$fdir" >&5 +echo "$as_me: error: cannot create directory $dirpart/$fdir" >&2;} + { (exit 1); exit 1; }; }; } + + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done +done + ;; + esac +done +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF + +{ (exit 0); exit 0; } +_ACEOF +chmod +x $CONFIG_STATUS +ac_clean_files=$ac_clean_files_save + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || { (exit 1); exit 1; } +fi + diff --git a/usr/src/grub/grub-0.97/configure.ac b/usr/src/grub/grub-0.97/configure.ac new file mode 100644 index 0000000000..59fe93f760 --- /dev/null +++ b/usr/src/grub/grub-0.97/configure.ac @@ -0,0 +1,605 @@ +dnl Configure script for GRUB. +dnl Copyright 1999,2000,2001,2002,2003,2004,2005 Free Software Foundation, Inc. + +dnl Permission to use, copy, modify and distribute this software and its +dnl documentation is hereby granted, provided that both the copyright +dnl notice and this permission notice appear in all copies of the +dnl software, derivative works or modified versions, and any portions +dnl thereof, and that both notices appear in supporting documentation. +dnl +dnl THE FREE SOFTWARE FOUNDATION ALLOWS FREE USE OF THIS SOFTWARE IN ITS +dnl "AS IS" CONDITION. THE FREE SOFTWARE FOUNDATION DISCLAIMS ANY +dnl LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE +dnl USE OF THIS SOFTWARE. + +AC_PREREQ(2.57) +AC_INIT([GRUB], [0.97], [bug-grub@gnu.org]) +AC_CONFIG_SRCDIR([stage2/stage2.c]) +AC_CONFIG_HEADER([config.h]) +AM_INIT_AUTOMAKE + +AC_CANONICAL_HOST + +case "$host_cpu" in +i[[3456]]86) host_cpu=i386 ;; +x86_64) host_cpu=x86_64 ;; +*) AC_MSG_ERROR([unsupported CPU type]) ;; +esac + +AC_SUBST(host_cpu) +AC_SUBST(host_vendor) + +# +# Options +# + +AM_MAINTAINER_MODE +if test "x$enable_maintainer_mode" = xyes; then + AC_PATH_PROG(PERL,perl) + if test -z "$PERL"; then + AC_MSG_ERROR([perl not found]) + fi +fi + +# This should be checked before AC_PROG_CC +if test "x$CFLAGS" = x; then + default_CFLAGS=yes +fi + +if test "x$host_cpu" = xx86_64; then + CFLAGS="-m32 $CFLAGS" +fi + +# +# Programs +# + +AC_CHECK_TOOL(CC, gcc) +AC_PROG_CC +# We need this for older versions of Autoconf. +_AM_DEPENDENCIES(CC) + +dnl Because recent automake complains about AS, set it here. +CCAS="$CC" +AC_SUBST(CCAS) + +AC_ARG_WITH(binutils, + [ --with-binutils=DIR search the directory DIR to find binutils]) + +if test "x$with_binutils" != x; then +dnl AC_PATH_TOOL is not seen in autoconf 2.13, so use AC_PATH_PROG +dnl instead for now. It is preferable when you cross-compile GRUB. +dnl AC_PATH_TOOL(RANLIB, ranlib, :, "$with_binutils:$PATH") + AC_PATH_PROG(RANLIB, ranlib, :, "$with_binutils:$PATH") +else + AC_PROG_RANLIB +fi + +# optimization flags +if test "x$ac_cv_prog_gcc" = xyes; then + if test "x$default_CFLAGS" = xyes; then + # Autoconf may set CFLAGS to -O2 and/or -g. So eliminate them. + CFLAGS="`echo $CFLAGS | sed -e 's/-g//g' -e 's/-O[[0-9]]//g'` -g" + # If the user specify the directory for binutils, add the option `-B'. + if test "x$with_binutils" != x; then + CFLAGS="-B$with_binutils/ $CFLAGS" + fi + STAGE1_CFLAGS="-O2" + GRUB_CFLAGS="-O2" + AC_CACHE_CHECK([whether optimization for size works], size_flag, [ + saved_CFLAGS=$CFLAGS + CFLAGS="-Os -g" + AC_TRY_COMPILE(, , size_flag=yes, size_flag=no) + CFLAGS=$saved_CFLAGS + ]) + if test "x$size_flag" = xyes; then + STAGE2_CFLAGS="-Os" + else + STAGE2_CFLAGS="-O2 -fno-strength-reduce -fno-unroll-loops" + fi + # OpenBSD has a GCC extension for protecting applications from + # stack smashing attacks, but GRUB doesn't want this feature. + AC_CACHE_CHECK([whether gcc has -fno-stack-protector], + no_stack_protector_flag, [ + saved_CFLAGS=$CFLAGS + CFLAGS="-fno-stack-protector" + AC_TRY_COMPILE(, + , + no_stack_protector_flag=yes, + no_stack_protector_flag=no) + CFLAGS=$saved_CFLAGS + ]) + if test "x$no_stack_protector_flag" = xyes; then + STAGE2_CFLAGS="$STAGE2_CFLAGS -fno-stack-protector" + fi + fi +fi + +AC_SUBST(STAGE1_CFLAGS) +AC_SUBST(STAGE2_CFLAGS) +AC_SUBST(GRUB_CFLAGS) + +# Enforce coding standards. +CPPFLAGS="$CPPFLAGS -Wall -Wmissing-prototypes -Wunused -Wshadow" +CPPFLAGS="$CPPFLAGS -Wpointer-arith" + +AC_CACHE_CHECK([whether -Wundef works], undef_flag, [ + saved_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="-Wundef" + AC_TRY_COMPILE(, , undef_flag=yes, undef_flag=no) + CPPFLAGS="$saved_CPPFLAGS" +]) + +# The options `-falign-*' are supported by gcc 3.0 or later. +# Probably it is sufficient to only check for -falign-loops. +AC_CACHE_CHECK([whether -falign-loops works], [falign_loop_flag], [ + saved_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="-falign-loops=1" + AC_TRY_COMPILE(, , [falign_loop_flag=yes], [falign_loop_flag=no]) + CPPFLAGS="$saved_CPPFLAGS" +]) + +# Force no alignment to save space. +if test "x$falign_loop_flag" = xyes; then + CPPFLAGS="$CPPFLAGS -falign-jumps=1 -falign-loops=1 -falign-functions=1" +else + CPPFLAGS="$CPPFLAGS -malign-jumps=1 -malign-loops=1 -malign-functions=1" +fi + +if test "x$undef_flag" = xyes; then + CPPFLAGS="$CPPFLAGS -Wundef" +fi + +if test "x$with_binutils" != x; then +dnl AC_PATH_TOOL(OBJCOPY, objcopy, , "$with_binutils:$PATH") + AC_PATH_PROG(OBJCOPY, objcopy, , "$with_binutils:$PATH") +else + AC_CHECK_TOOL(OBJCOPY, objcopy) +fi + +# Defined in acinclude.m4. +grub_ASM_USCORE +grub_PROG_OBJCOPY_ABSOLUTE +if test "x$grub_cv_prog_objcopy_absolute" != xyes; then + AC_MSG_ERROR([GRUB requires a working absolute objcopy; upgrade your binutils]) +fi + +grub_ASM_PREFIX_REQUIREMENT + +grub_ASM_ADDR32 +if test "x$grub_cv_asm_addr32" != xyes; then + AC_MSG_ERROR([GRUB requires GAS .code16 addr32 support; upgrade your binutils]) +fi + +grub_ASM_ABSOLUTE_WITHOUT_ASTERISK + +grub_CHECK_START_SYMBOL +grub_CHECK_USCORE_START_SYMBOL +if test "x$grub_cv_check_start_symbol" != "xyes" \ + -a "x$grub_cv_check_uscore_start_symbol" != "xyes"; then + AC_MSG_ERROR([Neither start nor _start is defined]) +fi + +grub_CHECK_USCORE_USCORE_BSS_START_SYMBOL +grub_CHECK_USCORE_EDATA_SYMBOL +grub_CHECK_EDATA_SYMBOL +if test "x$grub_cv_check_uscore_uscore_bss_start_symbol" != "xyes" \ + -a "x$grub_cv_check_uscore_edata_symbol" != "xyes" \ + -a "x$grub_cv_check_edata_symbol" != "xyes"; then + AC_MSG_ERROR([None of __bss_start, _edata, edata defined]) +fi + +grub_CHECK_END_SYMBOL +grub_CHECK_USCORE_END_SYMBOL +if test "x$grub_cv_check_end_symbol" != "xyes" \ + -a "x$grub_cv_check_uscore_end_symbol" != "xyes"; then + AC_MSG_ERROR([Neither end nor _end is defined]) +fi + +# Check for curses libraries. +AC_ARG_WITH(curses, + [ --without-curses do not use curses]) + +# Get the filename or the whole disk and open it. +# Known to work on NetBSD. +AC_CHECK_LIB(util, opendisk, [GRUB_LIBS="$GRUB_LIBS -lutil" + AC_DEFINE(HAVE_OPENDISK, 1, [Define if opendisk() in -lutil can be used])]) + +# Unless the user specify --without-curses, check for curses. +if test "x$with_curses" != "xno"; then + AC_CHECK_LIB(ncurses, wgetch, [GRUB_LIBS="$GRUB_LIBS -lncurses" + AC_DEFINE(HAVE_LIBCURSES, 1, [Define if you have a curses library])], + [AC_CHECK_LIB(curses, wgetch, [GRUB_LIBS="$GRUB_LIBS -lcurses" + AC_DEFINE(HAVE_LIBCURSES, 1, [Define if you have a curses library])])]) +fi + +AC_SUBST(GRUB_LIBS) + +# Check for headers. +AC_CHECK_HEADERS(string.h strings.h ncurses/curses.h ncurses.h curses.h) + +# Check for user options. + +# filesystems support. +AC_ARG_ENABLE(ext2fs, + [ --disable-ext2fs disable ext2fs support in Stage 2]) + +if test x"$enable_ext2fs" != xno; then + FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_EXT2FS=1" +fi + +AC_ARG_ENABLE(fat, + [ --disable-fat disable FAT support in Stage 2]) + +if test x"$enable_fat" != xno; then + FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_FAT=1" +fi + +AC_ARG_ENABLE(ffs, + [ --disable-ffs disable FFS support in Stage 2]) + +if test x"$enable_ffs" != xno; then + FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_FFS=1" +fi + +AC_ARG_ENABLE(ufs, + [ --disable-ufs disable UFS support in Stage 2]) + +if test x"$enable_ufs" != xno; then + FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_UFS=1" +fi + +AC_ARG_ENABLE(ufs2, + [ --disable-ufs2 disable UFS2 support in Stage 2]) + +if test x"$enable_ufs2" != xno; then + FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_UFS2=1" +fi + +AC_ARG_ENABLE(minix, + [ --disable-minix disable Minix fs support in Stage 2]) + +if test x"$enable_minix" != xno; then + FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_MINIX=1" +fi + +AC_ARG_ENABLE(reiserfs, + [ --disable-reiserfs disable ReiserFS support in Stage 2]) + +if test x"$enable_reiserfs" != xno; then + FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_REISERFS=1" +fi + +AC_ARG_ENABLE(vstafs, + [ --disable-vstafs disable VSTa FS support in Stage 2]) + +if test x"$enable_vstafs" != xno; then + FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_VSTAFS=1" +fi + +AC_ARG_ENABLE(jfs, + [ --disable-jfs disable IBM JFS support in Stage 2]) + +if test x"$enable_jfs" != xno; then + FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_JFS=1" +fi + +AC_ARG_ENABLE(xfs, + [ --disable-xfs disable SGI XFS support in Stage 2]) + +if test x"$enable_xfs" != xno; then + FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_XFS=1" +fi + +AC_ARG_ENABLE(zfs, + [ --disable-zfs disable ZFS support in Stage 2]) + +if test x"$enable_zfs" != xno; then + FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_ZFS=1" +fi + +AC_ARG_ENABLE(iso9660, + [ --disable-iso9660 disable ISO9660 support in Stage 2]) + +if test x"$enable_iso9660" != xno; then + FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_ISO9660=1" +fi + +dnl AC_ARG_ENABLE(tftp, +dnl [ --enable-tftp enable TFTP support in Stage 2]) +dnl +dnl #if test x"$enable_tftp" = xyes; then +dnl FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_TFTP=1" +dnl fi + +AC_ARG_ENABLE(gunzip, + [ --disable-gunzip disable decompression in Stage 2]) + +if test x"$enable_gunzip" = xno; then + FSYS_CFLAGS="$FSYS_CFLAGS -DNO_DECOMPRESSION=1" +fi + +AC_ARG_ENABLE(md5-password, + [ --disable-md5-password disable MD5 password support in Stage 2]) +if test "x$enable_md5_password" != xno; then + FSYS_CFLAGS="$FSYS_CFLAGS -DUSE_MD5_PASSWORDS=1" +fi + +dnl The netboot support. +dnl General options. +AC_ARG_ENABLE(packet-retransmission, + [ --disable-packet-retransmission + turn off packet retransmission]) +if test "x$enable_packet_retransmission" != xno; then + NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DCONGESTED=1 -DCONFIG_PCI" +fi + +AC_ARG_ENABLE(pci-direct, + [ --enable-pci-direct access PCI directly instead of using BIOS]) +if test "x$enable_pci_direct" = xyes; then + NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DCONFIG_PCI_DIRECT=1" +fi + +dnl Device drivers. +AC_ARG_ENABLE(3c595, + [ --enable-3c595 enable 3Com595 driver]) +if test "x$enable_3c595" = xyes; then + NET_CFLAGS="$NET_CFLAGS -DINCLUDE_3C595=1" + NETBOOT_DRIVERS="$NETBOOT_DRIVERS 3c595.o" +fi + +AC_ARG_ENABLE(3c90x, + [ --enable-3c90x enable 3Com90x driver]) +if test "x$enable_3c90x" = xyes; then + NET_CFLAGS="$NET_CFLAGS -DINCLUDE_3C90X=1" + NETBOOT_DRIVERS="$NETBOOT_DRIVERS 3c90x.o" +fi + +AC_ARG_ENABLE(davicom, + [ --enable-davicom enable Davicom driver]) +if test "x$enable_davicom" = xyes; then + NET_CFLAGS="$NET_CFLAGS -DINCLUDE_DAVICOM=1" + NETBOOT_DRIVERS="$NETBOOT_DRIVERS davicom.o" +fi + +AC_ARG_ENABLE(e1000, + [ --enable-e1000 enable Etherexpress Pro/1000 driver]) +if test "x$enable_e1000" = xyes; then + NET_CFLAGS="$NET_CFLAGS -DINCLUDE_E1000=1" + NETBOOT_DRIVERS="$NETBOOT_DRIVERS e1000.o" +fi + +AC_ARG_ENABLE(eepro100, + [ --enable-eepro100 enable Etherexpress Pro/100 driver]) +if test "x$enable_eepro100" = xyes; then + NET_CFLAGS="$NET_CFLAGS -DINCLUDE_EEPRO100=1" + NETBOOT_DRIVERS="$NETBOOT_DRIVERS eepro100.o" +fi + +AC_ARG_ENABLE(epic100, + [ --enable-epic100 enable SMC 83c170 EPIC/100 driver]) +if test "x$enable_epic100" = xyes; then + NET_CFLAGS="$NET_CFLAGS -DINCLUDE_EPIC100=1" + NETBOOT_DRIVERS="$NETBOOT_DRIVERS epic100.o" +fi + +AC_ARG_ENABLE(forcedeth, + [ --enable-forcedeth enable Nvidia Geforce driver]) +if test "x$enable_forcedeth" = xyes; then + NET_CFLAGS="$NET_CFLAGS -DINCLUDE_FORCEDETH=1" + NETBOOT_DRIVERS="$NETBOOT_DRIVERS forcedeth.o" +fi + +AC_ARG_ENABLE(natsemi, + [ --enable-natsemi enable NatSemi DP8381x driver]) +if test "x$enable_natsemi" = xyes; then + NET_CFLAGS="$NET_CFLAGS -DINCLUDE_NATSEMI=1" + NETBOOT_DRIVERS="$NETBOOT_DRIVERS natsemi.o" +fi + +AC_ARG_ENABLE(ns83820, + [ --enable-ns83820 enable NS83820 driver]) +if test "x$enable_ns83820" = xyes; then + NET_CFLAGS="$NET_CFLAGS -DINCLUDE_NS83820=1" + NETBOOT_DRIVERS="$NETBOOT_DRIVERS ns83820.o" +fi + +AC_ARG_ENABLE(ns8390, + [ --enable-ns8390 enable NE2000 PCI driver]) +if test "x$enable_ns8390" = xyes; then + NET_CFLAGS="$NET_CFLAGS -DINCLUDE_NS8390=1" + NETBOOT_DRIVERS="$NETBOOT_DRIVERS ns8390.o" +fi + +AC_ARG_ENABLE(pcnet32, + [ --enable-pcnet32 enable AMD Lance/PCI PCNet/32 driver]) +if test "x$enable_pcnet32" = xyes; then + NET_CFLAGS="$NET_CFLAGS -DINCLUDE_PCNET32=1" + NETBOOT_DRIVERS="$NETBOOT_DRIVERS pcnet32.o" +fi + +AC_ARG_ENABLE(pnic, + [ --enable-pnic enable Bochs Pseudo Nic driver]) +if test "x$enable_pnic" = xyes; then + NET_CFLAGS="$NET_CFLAGS -DINCLUDE_PNIC=1" + NETBOOT_DRIVERS="$NETBOOT_DRIVERS pnic.o" +fi + +AC_ARG_ENABLE(rtl8139, + [ --enable-rtl8139 enable Realtek 8139 driver]) +if test "x$enable_rtl8139" = xyes; then + NET_CFLAGS="$NET_CFLAGS -DINCLUDE_RTL8139=1" + NETBOOT_DRIVERS="$NETBOOT_DRIVERS rtl8139.o" +fi + +AC_ARG_ENABLE(r8169, + [ --enable-r8169 enable Realtek 8169 driver]) +if test "x$enable_r8169" = xyes; then + NET_CFLAGS="$NET_CFLAGS -DINCLUDE_R8169=1" + NETBOOT_DRIVERS="$NETBOOT_DRIVERS r8169.o" +fi + +AC_ARG_ENABLE(sis900, + [ --enable-sis900 enable SIS 900 and SIS 7016 driver]) +if test "x$enable_sis900" = xyes; then + NET_CFLAGS="$NET_CFLAGS -DINCLUDE_SIS900=1" + NETBOOT_DRIVERS="$NETBOOT_DRIVERS sis900.o" +fi + +AC_ARG_ENABLE(sundance, + [ --enable-sundance enable Sundance ST201 driver]) +if test "x$enable_sundance" = xyes; then + NET_CFLAGS="$NET_CFLAGS -DINCLUDE_SUNDANCE=1" + NETBOOT_DRIVERS="$NETBOOT_DRIVERS sundance.o" +fi + +AC_ARG_ENABLE(tg3, + [ --enable-tg3 enable Broadcom Tigon3 driver]) +if test "x$enable_tg3" = xyes; then + NET_CFLAGS="$NET_CFLAGS -DINCLUDE_TG3=1" + NETBOOT_DRIVERS="$NETBOOT_DRIVERS tg3.o" +fi + +AC_ARG_ENABLE(tulip, + [ --enable-tulip enable Tulip driver]) +if test "x$enable_tulip" = xyes; then + NET_CFLAGS="$NET_CFLAGS -DINCLUDE_TULIP=1" + NETBOOT_DRIVERS="$NETBOOT_DRIVERS tulip.o" +fi + +AC_ARG_ENABLE(tlan, + [ --enable-tlan enable TI ThunderLAN driver]) +if test "x$enable_tlan" = xyes; then + NET_CFLAGS="$NET_CFLAGS -DINCLUDE_TLAN=1" + NETBOOT_DRIVERS="$NETBOOT_DRIVERS tlan.o" +fi + +AC_ARG_ENABLE(undi, + [ --enable-undi enable PXE UNDI driver]) +if test "x$enable_undi" = xyes; then + NET_CFLAGS="$NET_CFLAGS -DINCLUDE_UNDI=1" + NETBOOT_DRIVERS="$NETBOOT_DRIVERS undi.o" +fi + +AC_ARG_ENABLE(via-rhine, + [ --enable-via-rhine enable Rhine-I/II driver]) +if test "x$enable_via_rhine" = xyes; then + NET_CFLAGS="$NET_CFLAGS -DINCLUDE_VIA_RHINE=1" + NETBOOT_DRIVERS="$NETBOOT_DRIVERS via_rhine.o" +fi + +AC_ARG_ENABLE(w89c840, + [ --enable-w89c840 enable Winbond W89c840 driver]) +if test "x$enable_w89c840" = xyes; then + NET_CFLAGS="$NET_CFLAGS -DINCLUDE_W89C840=1" + NETBOOT_DRIVERS="$NETBOOT_DRIVERS w89c840.o" +fi + +dnl Check if the netboot support is turned on. +AM_CONDITIONAL(NETBOOT_SUPPORT, test "x$NET_CFLAGS" != x) +if test "x$NET_CFLAGS" != x; then + FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_TFTP=1" +fi + +dnl extra flag for ns8390.c +AC_ARG_ENABLE(compex-rl2000-fix, + [ --enable-compex-rl2000-fix + specify this if you have a Compex RL2000 PCI]) +if test "x$enable_compex_rl2000_fix" = xyes; then + NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DCOMPEX_RL2000_FIX=1" +fi + +AC_ARG_ENABLE(ne-scan, + [ --enable-ne-scan=LIST probe for NE base address using LIST], + [NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DNE_SCAN=$enable_ne_scan"], + [NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DNE_SCAN=0x280,0x300,0x320,0x340"]) + +AC_ARG_ENABLE(wd-default-mem, + [ --enable-wd-default-mem=MEM + set the default memory location for WD/SMC], + [NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DWD_DEFAULT_MEM=$enable_wd_default_mem"], + [NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DWD_DEFAULT_MEM=0xCC000"]) + +dnl Diskless +AC_ARG_ENABLE(diskless, + [ --enable-diskless enable diskless support]) +AM_CONDITIONAL(DISKLESS_SUPPORT, test "x$enable_diskless" = xyes) + +dnl Graphical splashscreen support +AC_ARG_ENABLE(graphics, + [ --disable-graphics disable graphics terminal support]) +AM_CONDITIONAL(GRAPHICS_SUPPORT, test "x$enable_graphics" != xno) + +dnl Hercules terminal +AC_ARG_ENABLE(hercules, + [ --disable-hercules disable hercules terminal support]) +AM_CONDITIONAL(HERCULES_SUPPORT, test "x$enable_hercules" != xno) + +dnl Serial terminal +AC_ARG_ENABLE(serial, + [ --disable-serial disable serial terminal support]) +AM_CONDITIONAL(SERIAL_SUPPORT, test "x$enable_serial" != xno) + +dnl Simulation of the slowness of a serial device. +AC_ARG_ENABLE(serial-speed-simulation, + [ --enable-serial-speed-simulation + simulate the slowness of a serial device]) +AM_CONDITIONAL(SERIAL_SPEED_SIMULATION, + test "x$enable_serial_speed_simulation" = xyes) + +# Sanity check. +if test "x$enable_diskless" = xyes; then + if test "x$NET_CFLAGS" = x; then + AC_MSG_ERROR([You must enable at least one network driver]) + fi +fi + +dnl Embed a menu string in GRUB itself. +AC_ARG_ENABLE(preset-menu, + [ --enable-preset-menu=FILE + preset a menu file FILE in Stage 2]) +if test "x$enable_preset_menu" = x; then + : +else + if test -r $enable_preset_menu; then + grub_DEFINE_FILE(PRESET_MENU_STRING, [$enable_preset_menu], + [Define if there is user specified preset menu string]) + else + AC_MSG_ERROR([Cannot read the preset menu file $enable_preset_menu]) + fi +fi + +dnl Build the example Multiboot kernel. +AC_ARG_ENABLE(example-kernel, + [ --enable-example-kernel + build the example Multiboot kernel]) +AM_CONDITIONAL(BUILD_EXAMPLE_KERNEL, test "x$enable_example_kernel" = xyes) + +dnl Automatic Linux mem= option. +AC_ARG_ENABLE(auto-linux-mem-opt, + [ --disable-auto-linux-mem-opt + don't pass Linux mem= option automatically]) +if test "x$enable_auto_linux_mem_opt" = xno; then + : +else + AC_DEFINE(AUTO_LINUX_MEM_OPT, 1, [Define if you don't want to pass the mem= option to Linux]) +fi + +dnl Now substitute the variables. +AC_SUBST(FSYS_CFLAGS) +AC_SUBST(NET_CFLAGS) +AC_SUBST(NET_EXTRAFLAGS) +AC_SUBST(NETBOOT_DRIVERS) + +dnl Because recent automake complains about CCASFLAGS, set it here. +CCASFLAGS='$(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)' +AC_SUBST(CCASFLAGS) + + +dnl Output. +AC_CONFIG_FILES([Makefile stage1/Makefile stage2/Makefile \ + docs/Makefile lib/Makefile util/Makefile \ + grub/Makefile netboot/Makefile util/grub-image \ + util/grub-install util/grub-md5-crypt \ + util/grub-terminfo util/grub-set-default]) +AC_OUTPUT diff --git a/usr/src/grub/grub-0.97/depcomp b/usr/src/grub/grub-0.97/depcomp new file mode 100755 index 0000000000..11e2d3bfe1 --- /dev/null +++ b/usr/src/grub/grub-0.97/depcomp @@ -0,0 +1,522 @@ +#! /bin/sh +# depcomp - compile a program generating dependencies as side-effects + +scriptversion=2004-05-31.23 + +# Copyright (C) 1999, 2000, 2003, 2004 Free Software Foundation, 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, 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. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Originally written by Alexandre Oliva . + +case $1 in + '') + echo "$0: No command. Try \`$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: depcomp [--help] [--version] PROGRAM [ARGS] + +Run PROGRAMS ARGS to compile a file, generating dependencies +as side-effects. + +Environment variables: + depmode Dependency tracking mode. + source Source file read by `PROGRAMS ARGS'. + object Object file output by `PROGRAMS ARGS'. + DEPDIR directory where to store dependencies. + depfile Dependency file to output. + tmpdepfile Temporary file to use when outputing dependencies. + libtool Whether libtool is used (yes/no). + +Report bugs to . +EOF + exit 0 + ;; + -v | --v*) + echo "depcomp $scriptversion" + exit 0 + ;; +esac + +if test -z "$depmode" || test -z "$source" || test -z "$object"; then + echo "depcomp: Variables source, object and depmode must be set" 1>&2 + exit 1 +fi + +# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. +depfile=${depfile-`echo "$object" | + sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} +tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} + +rm -f "$tmpdepfile" + +# Some modes work just like other modes, but use different flags. We +# parameterize here, but still list the modes in the big case below, +# to make depend.m4 easier to write. Note that we *cannot* use a case +# here, because this file can only contain one case statement. +if test "$depmode" = hp; then + # HP compiler uses -M and no extra arg. + gccflag=-M + depmode=gcc +fi + +if test "$depmode" = dashXmstdout; then + # This is just like dashmstdout with a different argument. + dashmflag=-xM + depmode=dashmstdout +fi + +case "$depmode" in +gcc3) +## gcc 3 implements dependency tracking that does exactly what +## we want. Yay! Note: for some reason libtool 1.4 doesn't like +## it if -MD -MP comes after the -MF stuff. Hmm. + "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + mv "$tmpdepfile" "$depfile" + ;; + +gcc) +## There are various ways to get dependency output from gcc. Here's +## why we pick this rather obscure method: +## - Don't want to use -MD because we'd like the dependencies to end +## up in a subdir. Having to rename by hand is ugly. +## (We might end up doing this anyway to support other compilers.) +## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like +## -MM, not -M (despite what the docs say). +## - Using -M directly means running the compiler twice (even worse +## than renaming). + if test -z "$gccflag"; then + gccflag=-MD, + fi + "$@" -Wp,"$gccflag$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + echo "$object : \\" > "$depfile" + alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz +## The second -e expression handles DOS-style file names with drive letters. + sed -e 's/^[^:]*: / /' \ + -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" +## This next piece of magic avoids the `deleted header file' problem. +## The problem is that when a header file which appears in a .P file +## is deleted, the dependency causes make to die (because there is +## typically no way to rebuild the header). We avoid this by adding +## dummy dependencies for each header file. Too bad gcc doesn't do +## this for us directly. + tr ' ' ' +' < "$tmpdepfile" | +## Some versions of gcc put a space before the `:'. On the theory +## that the space means something, we add a space to the output as +## well. +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +hp) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +sgi) + if test "$libtool" = yes; then + "$@" "-Wp,-MDupdate,$tmpdepfile" + else + "$@" -MDupdate "$tmpdepfile" + fi + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + + if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files + echo "$object : \\" > "$depfile" + + # Clip off the initial element (the dependent). Don't try to be + # clever and replace this with sed code, as IRIX sed won't handle + # lines with more than a fixed number of characters (4096 in + # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; + # the IRIX cc adds comments like `#:fec' to the end of the + # dependency line. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ + tr ' +' ' ' >> $depfile + echo >> $depfile + + # The second pass generates a dummy entry for each header file. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ + >> $depfile + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +aix) + # The C for AIX Compiler uses -M and outputs the dependencies + # in a .u file. In older versions, this file always lives in the + # current directory. Also, the AIX compiler puts `$object:' at the + # start of each line; $object doesn't have directory information. + # Version 6 uses the directory in both cases. + stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'` + tmpdepfile="$stripped.u" + if test "$libtool" = yes; then + "$@" -Wc,-M + else + "$@" -M + fi + stat=$? + + if test -f "$tmpdepfile"; then : + else + stripped=`echo "$stripped" | sed 's,^.*/,,'` + tmpdepfile="$stripped.u" + fi + + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + + if test -f "$tmpdepfile"; then + outname="$stripped.o" + # Each line is of the form `foo.o: dependent.h'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" + sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +icc) + # Intel's C compiler understands `-MD -MF file'. However on + # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c + # ICC 7.0 will fill foo.d with something like + # foo.o: sub/foo.c + # foo.o: sub/foo.h + # which is wrong. We want: + # sub/foo.o: sub/foo.c + # sub/foo.o: sub/foo.h + # sub/foo.c: + # sub/foo.h: + # ICC 7.1 will output + # foo.o: sub/foo.c sub/foo.h + # and will wrap long lines using \ : + # foo.o: sub/foo.c ... \ + # sub/foo.h ... \ + # ... + + "$@" -MD -MF "$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + # Each line is of the form `foo.o: dependent.h', + # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" + # Some versions of the HPUX 10.20 sed can't process this invocation + # correctly. Breaking it into two sed invocations is a workaround. + sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | + sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +tru64) + # The Tru64 compiler uses -MD to generate dependencies as a side + # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. + # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put + # dependencies in `foo.d' instead, so we check for that too. + # Subdirectories are respected. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + + if test "$libtool" = yes; then + # Dependencies are output in .lo.d with libtool 1.4. + # With libtool 1.5 they are output both in $dir.libs/$base.o.d + # and in $dir.libs/$base.o.d and $dir$base.o.d. We process the + # latter, because the former will be cleaned when $dir.libs is + # erased. + tmpdepfile1="$dir.libs/$base.lo.d" + tmpdepfile2="$dir$base.o.d" + tmpdepfile3="$dir.libs/$base.d" + "$@" -Wc,-MD + else + tmpdepfile1="$dir$base.o.d" + tmpdepfile2="$dir$base.d" + tmpdepfile3="$dir$base.d" + "$@" -MD + fi + + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + exit $stat + fi + + if test -f "$tmpdepfile1"; then + tmpdepfile="$tmpdepfile1" + elif test -f "$tmpdepfile2"; then + tmpdepfile="$tmpdepfile2" + else + tmpdepfile="$tmpdepfile3" + fi + if test -f "$tmpdepfile"; then + sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" + # That's a tab and a space in the []. + sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" + else + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +#nosideeffect) + # This comment above is used by automake to tell side-effect + # dependency tracking mechanisms from slower ones. + +dashmstdout) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout, regardless of -o. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + + # Remove `-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + test -z "$dashmflag" && dashmflag=-M + # Require at least two characters before searching for `:' + # in the target name. This is to cope with DOS-style filenames: + # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. + "$@" $dashmflag | + sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + tr ' ' ' +' < "$tmpdepfile" | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +dashXmstdout) + # This case only exists to satisfy depend.m4. It is never actually + # run, as this mode is specially recognized in the preamble. + exit 1 + ;; + +makedepend) + "$@" || exit $? + # Remove any Libtool call + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + # X makedepend + shift + cleared=no + for arg in "$@"; do + case $cleared in + no) + set ""; shift + cleared=yes ;; + esac + case "$arg" in + -D*|-I*) + set fnord "$@" "$arg"; shift ;; + # Strip any option that makedepend may not understand. Remove + # the object too, otherwise makedepend will parse it as a source file. + -*|$object) + ;; + *) + set fnord "$@" "$arg"; shift ;; + esac + done + obj_suffix="`echo $object | sed 's/^.*\././'`" + touch "$tmpdepfile" + ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + sed '1,2d' "$tmpdepfile" | tr ' ' ' +' | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" "$tmpdepfile".bak + ;; + +cpp) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + + # Remove `-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + "$@" -E | + sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | + sed '$ s: \\$::' > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + cat < "$tmpdepfile" >> "$depfile" + sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +msvisualcpp) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout, regardless of -o, + # because we must use -o when running libtool. + "$@" || exit $? + IFS=" " + for arg + do + case "$arg" in + "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") + set fnord "$@" + shift + shift + ;; + *) + set fnord "$@" "$arg" + shift + shift + ;; + esac + done + "$@" -E | + sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" + echo " " >> "$depfile" + . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +none) + exec "$@" + ;; + +*) + echo "Unknown depmode $depmode" 1>&2 + exit 1 + ;; +esac + +exit 0 + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/usr/src/grub/grub-0.97/docs/Makefile.am b/usr/src/grub/grub-0.97/docs/Makefile.am new file mode 100644 index 0000000000..db99e2d87c --- /dev/null +++ b/usr/src/grub/grub-0.97/docs/Makefile.am @@ -0,0 +1,65 @@ +info_TEXINFOS = grub.texi multiboot.texi +grub_TEXINFOS = internals.texi +EXAMPLES = boot.S kernel.c multiboot.h +multiboot_TEXINFOS = boot.S.texi kernel.c.texi multiboot.h.texi +man_MANS = grub.8 mbchk.1 grub-install.8 grub-md5-crypt.8 grub-terminfo.8 +HELP2MAN = help2man +SRC2TEXI = src2texi +noinst_SCRIPTS = $(HELP2MAN) $(SRC2TEXI) +EXTRA_PROGRAMS = kernel + +# The example kernel is built if you specify --enable-example-kernel. +if BUILD_EXAMPLE_KERNEL +noinst_PROGRAMS = kernel +kernel_SOURCES = $(EXAMPLES) +kernel_CFLAGS = -fno-builtin -nostdinc -O -g -Wall \ + -imacros $(top_builddir)/config.h +kernel_LDFLAGS = -nostdlib -Wl,-N -Wl,-Ttext -Wl,100000 + +boot.o: multiboot.h +endif + +EXTRA_DIST = menu.lst $(man_MANS) $(noinst_SCRIPTS) \ + $(EXAMPLES) $(multiboot_TEXINFOS) +CLEANFILES = $(noinst_PROGRAMS) + +# Cancel the rule %.texi -> %. This rule may confuse make to determine +# the dependecies. +.texi: + +%.c.texi: %.c $(srcdir)/$(SRC2TEXI) + $(SHELL) $(srcdir)/$(SRC2TEXI) $(srcdir) $< $@ + +%.h.texi: %.h $(srcdir)/$(SRC2TEXI) + $(SHELL) $(srcdir)/$(SRC2TEXI) $(srcdir) $< $@ + +%.S.texi: %.S $(srcdir)/$(SRC2TEXI) + $(SHELL) $(srcdir)/$(SRC2TEXI) $(srcdir) $< $@ + +if MAINTAINER_MODE +$(srcdir)/grub.8: ../grub/grub $(srcdir)/$(HELP2MAN) + $(PERL) $(srcdir)/$(HELP2MAN) --name="the grub shell" \ + --section=8 --output=$@ $< + +$(srcdir)/grub-install.8: ../util/grub-install $(srcdir)/$(HELP2MAN) + chmod 755 $< + $(PERL) $(srcdir)/$(HELP2MAN) --name="install GRUB on your drive" \ + --section=8 --output=$@ $< + +$(srcdir)/mbchk.1: ../util/mbchk $(srcdir)/$(HELP2MAN) + $(PERL) $(srcdir)/$(HELP2MAN) \ + --name="check the format of a Multiboot kernel" \ + --section=1 --output=$@ $< + +$(srcdir)/grub-md5-crypt.8: ../util/grub-md5-crypt $(srcdir)/$(HELP2MAN) + chmod 755 $< + $(PERL) $(srcdir)/$(HELP2MAN) \ + --name="Encrypt a password in MD5 format" \ + --section=8 --output=$@ $< + +$(srcdir)/grub-terminfo.8: ../util/grub-terminfo $(srcdir)/$(HELP2MAN) + chmod 755 $< + $(PERL) $(srcdir)/$(HELP2MAN) \ + --name="Generate a terminfo command from a terminfo name" \ + --section=8 --output=$@ $< +endif diff --git a/usr/src/grub/grub-0.97/docs/Makefile.in b/usr/src/grub/grub-0.97/docs/Makefile.in new file mode 100644 index 0000000000..08e3d5d6b8 --- /dev/null +++ b/usr/src/grub/grub-0.97/docs/Makefile.in @@ -0,0 +1,769 @@ +# Makefile.in generated by automake 1.9.4 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +SOURCES = $(kernel_SOURCES) + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +EXTRA_PROGRAMS = kernel$(EXEEXT) +@BUILD_EXAMPLE_KERNEL_TRUE@noinst_PROGRAMS = kernel$(EXEEXT) +subdir = docs +DIST_COMMON = $(grub_TEXINFOS) $(multiboot_TEXINFOS) \ + $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(srcdir)/stamp-vti $(srcdir)/version.texi mdate-sh \ + texinfo.tex +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +PROGRAMS = $(noinst_PROGRAMS) +am__kernel_SOURCES_DIST = boot.S kernel.c multiboot.h +am__objects_1 = boot.$(OBJEXT) kernel-kernel.$(OBJEXT) +@BUILD_EXAMPLE_KERNEL_TRUE@am_kernel_OBJECTS = $(am__objects_1) +kernel_OBJECTS = $(am_kernel_OBJECTS) +kernel_LDADD = $(LDADD) +SCRIPTS = $(noinst_SCRIPTS) +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +CCASCOMPILE = $(CCAS) $(AM_CCASFLAGS) $(CCASFLAGS) +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(kernel_SOURCES) +DIST_SOURCES = $(am__kernel_SOURCES_DIST) +INFO_DEPS = $(srcdir)/grub.info $(srcdir)/multiboot.info +am__TEXINFO_TEX_DIR = $(srcdir) +DVIS = grub.dvi multiboot.dvi +PDFS = grub.pdf multiboot.pdf +PSS = grub.ps multiboot.ps +HTMLS = grub.html multiboot.html +TEXINFOS = grub.texi multiboot.texi +TEXI2DVI = texi2dvi +TEXI2PDF = $(TEXI2DVI) --pdf --batch +MAKEINFOHTML = $(MAKEINFO) --html +AM_MAKEINFOHTMLFLAGS = $(AM_MAKEINFOFLAGS) +DVIPS = dvips +am__installdirs = "$(DESTDIR)$(infodir)" "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man8dir)" +man1dir = $(mandir)/man1 +man8dir = $(mandir)/man8 +NROFF = nroff +MANS = $(man_MANS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BUILD_EXAMPLE_KERNEL_FALSE = @BUILD_EXAMPLE_KERNEL_FALSE@ +BUILD_EXAMPLE_KERNEL_TRUE = @BUILD_EXAMPLE_KERNEL_TRUE@ +CC = @CC@ +CCAS = @CCAS@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DISKLESS_SUPPORT_FALSE = @DISKLESS_SUPPORT_FALSE@ +DISKLESS_SUPPORT_TRUE = @DISKLESS_SUPPORT_TRUE@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FSYS_CFLAGS = @FSYS_CFLAGS@ +GRUB_CFLAGS = @GRUB_CFLAGS@ +GRUB_LIBS = @GRUB_LIBS@ +HERCULES_SUPPORT_FALSE = @HERCULES_SUPPORT_FALSE@ +HERCULES_SUPPORT_TRUE = @HERCULES_SUPPORT_TRUE@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +NETBOOT_DRIVERS = @NETBOOT_DRIVERS@ +NETBOOT_SUPPORT_FALSE = @NETBOOT_SUPPORT_FALSE@ +NETBOOT_SUPPORT_TRUE = @NETBOOT_SUPPORT_TRUE@ +NET_CFLAGS = @NET_CFLAGS@ +NET_EXTRAFLAGS = @NET_EXTRAFLAGS@ +OBJCOPY = @OBJCOPY@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PERL = @PERL@ +RANLIB = @RANLIB@ +SERIAL_SPEED_SIMULATION_FALSE = @SERIAL_SPEED_SIMULATION_FALSE@ +SERIAL_SPEED_SIMULATION_TRUE = @SERIAL_SPEED_SIMULATION_TRUE@ +SERIAL_SUPPORT_FALSE = @SERIAL_SUPPORT_FALSE@ +SERIAL_SUPPORT_TRUE = @SERIAL_SUPPORT_TRUE@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STAGE1_CFLAGS = @STAGE1_CFLAGS@ +STAGE2_CFLAGS = @STAGE2_CFLAGS@ +STRIP = @STRIP@ +VERSION = @VERSION@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_OBJCOPY = @ac_ct_OBJCOPY@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +info_TEXINFOS = grub.texi multiboot.texi +grub_TEXINFOS = internals.texi +EXAMPLES = boot.S kernel.c multiboot.h +multiboot_TEXINFOS = boot.S.texi kernel.c.texi multiboot.h.texi +man_MANS = grub.8 mbchk.1 grub-install.8 grub-md5-crypt.8 grub-terminfo.8 +HELP2MAN = help2man +SRC2TEXI = src2texi +noinst_SCRIPTS = $(HELP2MAN) $(SRC2TEXI) +@BUILD_EXAMPLE_KERNEL_TRUE@kernel_SOURCES = $(EXAMPLES) +@BUILD_EXAMPLE_KERNEL_TRUE@kernel_CFLAGS = -fno-builtin -nostdinc -O -g -Wall \ +@BUILD_EXAMPLE_KERNEL_TRUE@ -imacros $(top_builddir)/config.h + +@BUILD_EXAMPLE_KERNEL_TRUE@kernel_LDFLAGS = -nostdlib -Wl,-N -Wl,-Ttext -Wl,100000 +EXTRA_DIST = menu.lst $(man_MANS) $(noinst_SCRIPTS) \ + $(EXAMPLES) $(multiboot_TEXINFOS) + +CLEANFILES = $(noinst_PROGRAMS) +all: all-am + +.SUFFIXES: +.SUFFIXES: .S .c .dvi .html .info .o .obj .pdf .ps .texi +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu docs/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu docs/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +clean-noinstPROGRAMS: + -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) +kernel$(EXEEXT): $(kernel_OBJECTS) $(kernel_DEPENDENCIES) + @rm -f kernel$(EXEEXT) + $(LINK) $(kernel_LDFLAGS) $(kernel_OBJECTS) $(kernel_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kernel-kernel.Po@am__quote@ + +.S.o: + $(CCASCOMPILE) -c $< + +.S.obj: + $(CCASCOMPILE) -c `$(CYGPATH_W) '$<'` + +.c.o: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +kernel-kernel.o: kernel.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(kernel_CFLAGS) $(CFLAGS) -MT kernel-kernel.o -MD -MP -MF "$(DEPDIR)/kernel-kernel.Tpo" -c -o kernel-kernel.o `test -f 'kernel.c' || echo '$(srcdir)/'`kernel.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/kernel-kernel.Tpo" "$(DEPDIR)/kernel-kernel.Po"; else rm -f "$(DEPDIR)/kernel-kernel.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='kernel.c' object='kernel-kernel.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(kernel_CFLAGS) $(CFLAGS) -c -o kernel-kernel.o `test -f 'kernel.c' || echo '$(srcdir)/'`kernel.c + +kernel-kernel.obj: kernel.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(kernel_CFLAGS) $(CFLAGS) -MT kernel-kernel.obj -MD -MP -MF "$(DEPDIR)/kernel-kernel.Tpo" -c -o kernel-kernel.obj `if test -f 'kernel.c'; then $(CYGPATH_W) 'kernel.c'; else $(CYGPATH_W) '$(srcdir)/kernel.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/kernel-kernel.Tpo" "$(DEPDIR)/kernel-kernel.Po"; else rm -f "$(DEPDIR)/kernel-kernel.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='kernel.c' object='kernel-kernel.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(kernel_CFLAGS) $(CFLAGS) -c -o kernel-kernel.obj `if test -f 'kernel.c'; then $(CYGPATH_W) 'kernel.c'; else $(CYGPATH_W) '$(srcdir)/kernel.c'; fi` + +.texi.info: + restore=: && backupdir="$(am__leading_dot)am$$$$" && \ + am__cwd=`pwd` && cd $(srcdir) && \ + rm -rf $$backupdir && mkdir $$backupdir && \ + for f in $@ $@-[0-9] $@-[0-9][0-9] $(@:.info=).i[0-9] $(@:.info=).i[0-9][0-9]; do \ + if test -f $$f; then mv $$f $$backupdir; restore=mv; else :; fi; \ + done; \ + cd "$$am__cwd"; \ + if $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \ + -o $@ $<; \ + then \ + rc=0; \ + cd $(srcdir); \ + else \ + rc=$$?; \ + cd $(srcdir) && \ + $$restore $$backupdir/* `echo "./$@" | sed 's|[^/]*$$||'`; \ + fi; \ + rm -rf $$backupdir; exit $$rc + +.texi.dvi: + TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ + MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)' \ + $(TEXI2DVI) $< + +.texi.pdf: + TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ + MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)' \ + $(TEXI2PDF) $< + +.texi.html: + rm -rf $(@:.html=.htp) + if $(MAKEINFOHTML) $(AM_MAKEINFOHTMLFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \ + -o $(@:.html=.htp) $<; \ + then \ + rm -rf $@; \ + if test ! -d $(@:.html=.htp) && test -d $(@:.html=); then \ + mv $(@:.html=) $@; else mv $(@:.html=.htp) $@; fi; \ + else \ + if test ! -d $(@:.html=.htp) && test -d $(@:.html=); then \ + rm -rf $(@:.html=); else rm -Rf $(@:.html=.htp) $@; fi; \ + exit 1; \ + fi +$(srcdir)/grub.info: grub.texi $(srcdir)/version.texi $(grub_TEXINFOS) +grub.dvi: grub.texi $(srcdir)/version.texi $(grub_TEXINFOS) +grub.pdf: grub.texi $(srcdir)/version.texi $(grub_TEXINFOS) +grub.html: grub.texi $(srcdir)/version.texi $(grub_TEXINFOS) +$(srcdir)/version.texi: @MAINTAINER_MODE_TRUE@ $(srcdir)/stamp-vti +$(srcdir)/stamp-vti: grub.texi $(top_srcdir)/configure + @(dir=.; test -f ./grub.texi || dir=$(srcdir); \ + set `$(SHELL) $(srcdir)/mdate-sh $$dir/grub.texi`; \ + echo "@set UPDATED $$1 $$2 $$3"; \ + echo "@set UPDATED-MONTH $$2 $$3"; \ + echo "@set EDITION $(VERSION)"; \ + echo "@set VERSION $(VERSION)") > vti.tmp + @cmp -s vti.tmp $(srcdir)/version.texi \ + || (echo "Updating $(srcdir)/version.texi"; \ + cp vti.tmp $(srcdir)/version.texi) + -@rm -f vti.tmp + @cp $(srcdir)/version.texi $@ + +mostlyclean-vti: + -rm -f vti.tmp + +maintainer-clean-vti: +@MAINTAINER_MODE_TRUE@ -rm -f $(srcdir)/stamp-vti $(srcdir)/version.texi +$(srcdir)/multiboot.info: multiboot.texi $(multiboot_TEXINFOS) +multiboot.dvi: multiboot.texi $(multiboot_TEXINFOS) +multiboot.pdf: multiboot.texi $(multiboot_TEXINFOS) +multiboot.html: multiboot.texi $(multiboot_TEXINFOS) +.dvi.ps: + $(DVIPS) -o $@ $< + +uninstall-info-am: + $(PRE_UNINSTALL) + @if (install-info --version && \ + install-info --version 2>&1 | sed 1q | grep -i -v debian) >/dev/null 2>&1; then \ + list='$(INFO_DEPS)'; \ + for file in $$list; do \ + relfile=`echo "$$file" | sed 's|^.*/||'`; \ + echo " install-info --info-dir='$(DESTDIR)$(infodir)' --remove '$(DESTDIR)$(infodir)/$$relfile'"; \ + install-info --info-dir="$(DESTDIR)$(infodir)" --remove "$(DESTDIR)$(infodir)/$$relfile"; \ + done; \ + else :; fi + @$(NORMAL_UNINSTALL) + @list='$(INFO_DEPS)'; \ + for file in $$list; do \ + relfile=`echo "$$file" | sed 's|^.*/||'`; \ + relfile_i=`echo "$$relfile" | sed 's|\.info$$||;s|$$|.i|'`; \ + (if cd "$(DESTDIR)$(infodir)"; then \ + echo " rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9])"; \ + rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]; \ + else :; fi); \ + done + +dist-info: $(INFO_DEPS) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + list='$(INFO_DEPS)'; \ + for base in $$list; do \ + case $$base in \ + $(srcdir)/*) base=`echo "$$base" | sed "s|^$$srcdirstrip/||"`;; \ + esac; \ + if test -f $$base; then d=.; else d=$(srcdir); fi; \ + for file in $$d/$$base*; do \ + relfile=`expr "$$file" : "$$d/\(.*\)"`; \ + test -f $(distdir)/$$relfile || \ + cp -p $$file $(distdir)/$$relfile; \ + done; \ + done + +mostlyclean-aminfo: + -rm -rf grub.aux grub.cp grub.cps grub.fn grub.ky grub.log grub.pg grub.tmp \ + grub.toc grub.tp grub.vr grub.dvi grub.pdf grub.ps grub.html \ + multiboot.aux multiboot.cp multiboot.cps multiboot.fn \ + multiboot.ky multiboot.log multiboot.pg multiboot.tmp \ + multiboot.toc multiboot.tp multiboot.vr multiboot.dvi \ + multiboot.pdf multiboot.ps multiboot.html + +maintainer-clean-aminfo: + @list='$(INFO_DEPS)'; for i in $$list; do \ + i_i=`echo "$$i" | sed 's|\.info$$||;s|$$|.i|'`; \ + echo " rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]"; \ + rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]; \ + done +install-man1: $(man1_MANS) $(man_MANS) + @$(NORMAL_INSTALL) + test -z "$(man1dir)" || $(mkdir_p) "$(DESTDIR)$(man1dir)" + @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \ + l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ + for i in $$l2; do \ + case "$$i" in \ + *.1*) list="$$list $$i" ;; \ + esac; \ + done; \ + for i in $$list; do \ + if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ + else file=$$i; fi; \ + ext=`echo $$i | sed -e 's/^.*\\.//'`; \ + case "$$ext" in \ + 1*) ;; \ + *) ext='1' ;; \ + esac; \ + inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ + inst=`echo $$inst | sed -e 's/^.*\///'`; \ + inst=`echo $$inst | sed '$(transform)'`.$$ext; \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst"; \ + done +uninstall-man1: + @$(NORMAL_UNINSTALL) + @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \ + l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ + for i in $$l2; do \ + case "$$i" in \ + *.1*) list="$$list $$i" ;; \ + esac; \ + done; \ + for i in $$list; do \ + ext=`echo $$i | sed -e 's/^.*\\.//'`; \ + case "$$ext" in \ + 1*) ;; \ + *) ext='1' ;; \ + esac; \ + inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ + inst=`echo $$inst | sed -e 's/^.*\///'`; \ + inst=`echo $$inst | sed '$(transform)'`.$$ext; \ + echo " rm -f '$(DESTDIR)$(man1dir)/$$inst'"; \ + rm -f "$(DESTDIR)$(man1dir)/$$inst"; \ + done +install-man8: $(man8_MANS) $(man_MANS) + @$(NORMAL_INSTALL) + test -z "$(man8dir)" || $(mkdir_p) "$(DESTDIR)$(man8dir)" + @list='$(man8_MANS) $(dist_man8_MANS) $(nodist_man8_MANS)'; \ + l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ + for i in $$l2; do \ + case "$$i" in \ + *.8*) list="$$list $$i" ;; \ + esac; \ + done; \ + for i in $$list; do \ + if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ + else file=$$i; fi; \ + ext=`echo $$i | sed -e 's/^.*\\.//'`; \ + case "$$ext" in \ + 8*) ;; \ + *) ext='8' ;; \ + esac; \ + inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ + inst=`echo $$inst | sed -e 's/^.*\///'`; \ + inst=`echo $$inst | sed '$(transform)'`.$$ext; \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man8dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man8dir)/$$inst"; \ + done +uninstall-man8: + @$(NORMAL_UNINSTALL) + @list='$(man8_MANS) $(dist_man8_MANS) $(nodist_man8_MANS)'; \ + l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ + for i in $$l2; do \ + case "$$i" in \ + *.8*) list="$$list $$i" ;; \ + esac; \ + done; \ + for i in $$list; do \ + ext=`echo $$i | sed -e 's/^.*\\.//'`; \ + case "$$ext" in \ + 8*) ;; \ + *) ext='8' ;; \ + esac; \ + inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ + inst=`echo $$inst | sed -e 's/^.*\///'`; \ + inst=`echo $$inst | sed '$(transform)'`.$$ext; \ + echo " rm -f '$(DESTDIR)$(man8dir)/$$inst'"; \ + rm -f "$(DESTDIR)$(man8dir)/$$inst"; \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$(top_distdir)" distdir="$(distdir)" \ + dist-info +check-am: all-am +check: check-am +all-am: Makefile $(INFO_DEPS) $(PROGRAMS) $(SCRIPTS) $(MANS) +installdirs: + for dir in "$(DESTDIR)$(infodir)" "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man8dir)"; do \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-noinstPROGRAMS mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: $(DVIS) + +html: html-am + +html-am: $(HTMLS) + +info: info-am + +info-am: $(INFO_DEPS) + +install-data-am: install-info-am install-man + +install-exec-am: + +install-info: install-info-am + +install-info-am: $(INFO_DEPS) + @$(NORMAL_INSTALL) + test -z "$(infodir)" || $(mkdir_p) "$(DESTDIR)$(infodir)" + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + list='$(INFO_DEPS)'; \ + for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + esac; \ + if test -f $$file; then d=.; else d=$(srcdir); fi; \ + file_i=`echo "$$file" | sed 's|\.info$$||;s|$$|.i|'`; \ + for ifile in $$d/$$file $$d/$$file-[0-9] $$d/$$file-[0-9][0-9] \ + $$d/$$file_i[0-9] $$d/$$file_i[0-9][0-9] ; do \ + if test -f $$ifile; then \ + relfile=`echo "$$ifile" | sed 's|^.*/||'`; \ + echo " $(INSTALL_DATA) '$$ifile' '$(DESTDIR)$(infodir)/$$relfile'"; \ + $(INSTALL_DATA) "$$ifile" "$(DESTDIR)$(infodir)/$$relfile"; \ + else : ; fi; \ + done; \ + done + @$(POST_INSTALL) + @if (install-info --version && \ + install-info --version 2>&1 | sed 1q | grep -i -v debian) >/dev/null 2>&1; then \ + list='$(INFO_DEPS)'; \ + for file in $$list; do \ + relfile=`echo "$$file" | sed 's|^.*/||'`; \ + echo " install-info --info-dir='$(DESTDIR)$(infodir)' '$(DESTDIR)$(infodir)/$$relfile'";\ + install-info --info-dir="$(DESTDIR)$(infodir)" "$(DESTDIR)$(infodir)/$$relfile" || :;\ + done; \ + else : ; fi +install-man: install-man1 install-man8 + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-aminfo \ + maintainer-clean-generic maintainer-clean-vti + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-aminfo mostlyclean-compile \ + mostlyclean-generic mostlyclean-vti + +pdf: pdf-am + +pdf-am: $(PDFS) + +ps: ps-am + +ps-am: $(PSS) + +uninstall-am: uninstall-info-am uninstall-man + +uninstall-man: uninstall-man1 uninstall-man8 + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-noinstPROGRAMS ctags dist-info distclean \ + distclean-compile distclean-generic distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-exec install-exec-am \ + install-info install-info-am install-man install-man1 \ + install-man8 install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-aminfo \ + maintainer-clean-generic maintainer-clean-vti mostlyclean \ + mostlyclean-aminfo mostlyclean-compile mostlyclean-generic \ + mostlyclean-vti pdf pdf-am ps ps-am tags uninstall \ + uninstall-am uninstall-info-am uninstall-man uninstall-man1 \ + uninstall-man8 + + +@BUILD_EXAMPLE_KERNEL_TRUE@boot.o: multiboot.h + +# Cancel the rule %.texi -> %. This rule may confuse make to determine +# the dependecies. +.texi: + +%.c.texi: %.c $(srcdir)/$(SRC2TEXI) + $(SHELL) $(srcdir)/$(SRC2TEXI) $(srcdir) $< $@ + +%.h.texi: %.h $(srcdir)/$(SRC2TEXI) + $(SHELL) $(srcdir)/$(SRC2TEXI) $(srcdir) $< $@ + +%.S.texi: %.S $(srcdir)/$(SRC2TEXI) + $(SHELL) $(srcdir)/$(SRC2TEXI) $(srcdir) $< $@ + +@MAINTAINER_MODE_TRUE@$(srcdir)/grub.8: ../grub/grub $(srcdir)/$(HELP2MAN) +@MAINTAINER_MODE_TRUE@ $(PERL) $(srcdir)/$(HELP2MAN) --name="the grub shell" \ +@MAINTAINER_MODE_TRUE@ --section=8 --output=$@ $< + +@MAINTAINER_MODE_TRUE@$(srcdir)/grub-install.8: ../util/grub-install $(srcdir)/$(HELP2MAN) +@MAINTAINER_MODE_TRUE@ chmod 755 $< +@MAINTAINER_MODE_TRUE@ $(PERL) $(srcdir)/$(HELP2MAN) --name="install GRUB on your drive" \ +@MAINTAINER_MODE_TRUE@ --section=8 --output=$@ $< + +@MAINTAINER_MODE_TRUE@$(srcdir)/mbchk.1: ../util/mbchk $(srcdir)/$(HELP2MAN) +@MAINTAINER_MODE_TRUE@ $(PERL) $(srcdir)/$(HELP2MAN) \ +@MAINTAINER_MODE_TRUE@ --name="check the format of a Multiboot kernel" \ +@MAINTAINER_MODE_TRUE@ --section=1 --output=$@ $< + +@MAINTAINER_MODE_TRUE@$(srcdir)/grub-md5-crypt.8: ../util/grub-md5-crypt $(srcdir)/$(HELP2MAN) +@MAINTAINER_MODE_TRUE@ chmod 755 $< +@MAINTAINER_MODE_TRUE@ $(PERL) $(srcdir)/$(HELP2MAN) \ +@MAINTAINER_MODE_TRUE@ --name="Encrypt a password in MD5 format" \ +@MAINTAINER_MODE_TRUE@ --section=8 --output=$@ $< + +@MAINTAINER_MODE_TRUE@$(srcdir)/grub-terminfo.8: ../util/grub-terminfo $(srcdir)/$(HELP2MAN) +@MAINTAINER_MODE_TRUE@ chmod 755 $< +@MAINTAINER_MODE_TRUE@ $(PERL) $(srcdir)/$(HELP2MAN) \ +@MAINTAINER_MODE_TRUE@ --name="Generate a terminfo command from a terminfo name" \ +@MAINTAINER_MODE_TRUE@ --section=8 --output=$@ $< +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/usr/src/grub/grub-0.97/docs/Makefile.solaris b/usr/src/grub/grub-0.97/docs/Makefile.solaris new file mode 100644 index 0000000000..5914f863af --- /dev/null +++ b/usr/src/grub/grub-0.97/docs/Makefile.solaris @@ -0,0 +1,68 @@ +# +# Copyright 2005 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# ident "%Z%%M% %I% %E% SMI" +# +include ../../Makefile.grub +include ../Makefile.solaris.defs + + +# Install these only if the OPTION_DOCS option is on (blank). +$(OPTION_DOCS)MAN1_FILES = mbchk.1 + +$(OPTION_DOCS)MAN8_FILES = grub-install.8 \ + grub-md5-crypt.8 \ + grub-terminfo.8 \ + grub.8 + +$(OPTION_DOCS)INFO_FILES = grub.info \ + grub.info-1 \ + grub.info-2 \ + grub.info-3 \ + grub.info-4 \ + multiboot.info + + +INSTALL_MAN1_DIR = $(ROOT_PLAT_GRUB)/man/man1 +INSTALL_MAN8_DIR = $(ROOT_PLAT_GRUB)/man/man8 +INSTALL_INFO_DIR = $(ROOT_PLAT_GRUB)/info + +INSTALL_TARGETS = $(MAN1_FILES:%=$(INSTALL_MAN1_DIR)/%) \ + $(MAN8_FILES:%=$(INSTALL_MAN8_DIR)/%) \ + $(INFO_FILES:%=$(INSTALL_INFO_DIR)/%) + +# +# Source files to be installed in $(SRC_DIR). +# +SRC_DIR = $(ROOT_SRC)/docs +SRC_FILES = Makefile.am Makefile.in boot.S boot.S.texi \ + grub-install.8 grub-md5-crypt.8 grub-terminfo.8 grub.8 \ + grub.info grub.info-1 grub.info-2 grub.info-3 grub.info-4 \ + grub.texi help2man internals.texi kernel.c kernel.c.texi \ + mbchk.1 mdate-sh menu.lst multiboot.h multiboot.h.texi \ + multiboot.info multiboot.texi src2texi stamp-vti \ + texinfo.tex version.texi + +INSTALL_TARGETS += $(SRC_FILES:%=$(SRC_DIR)/%) + + +all clean clobber: + + +install: all $(INSTALL_TARGETS) + +$(INSTALL_MAN1_DIR)/%: $(INSTALL_MAN1_DIR) % + $(INS.file) + +$(INSTALL_MAN8_DIR)/%: $(INSTALL_MAN8_DIR) % + $(INS.file) + +$(INSTALL_INFO_DIR)/%: $(INSTALL_INFO_DIR) % + $(INS.file) + +$(SRC_DIR)/%: $(SRC_DIR) % + $(INS.file) + +$(INSTALL_MAN1_DIR) $(INSTALL_MAN8_DIR) $(INSTALL_INFO_DIR) $(SRC_DIR): + $(INS.dir) diff --git a/usr/src/grub/grub-0.97/docs/boot.S b/usr/src/grub/grub-0.97/docs/boot.S new file mode 100644 index 0000000000..b0e167f83c --- /dev/null +++ b/usr/src/grub/grub-0.97/docs/boot.S @@ -0,0 +1,80 @@ +/* boot.S - bootstrap the kernel */ +/* Copyright (C) 1999, 2001 Free Software Foundation, 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 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. */ + +#define ASM 1 +#include + + .text + + .globl start, _start +start: +_start: + jmp multiboot_entry + + /* Align 32 bits boundary. */ + .align 4 + + /* Multiboot header. */ +multiboot_header: + /* magic */ + .long MULTIBOOT_HEADER_MAGIC + /* flags */ + .long MULTIBOOT_HEADER_FLAGS + /* checksum */ + .long -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS) +#ifndef __ELF__ + /* header_addr */ + .long multiboot_header + /* load_addr */ + .long _start + /* load_end_addr */ + .long _edata + /* bss_end_addr */ + .long _end + /* entry_addr */ + .long multiboot_entry +#endif /* ! __ELF__ */ + +multiboot_entry: + /* Initialize the stack pointer. */ + movl $(stack + STACK_SIZE), %esp + + /* Reset EFLAGS. */ + pushl $0 + popf + + /* Push the pointer to the Multiboot information structure. */ + pushl %ebx + /* Push the magic value. */ + pushl %eax + + /* Now enter the C main function... */ + call EXT_C(cmain) + + /* Halt. */ + pushl $halt_message + call EXT_C(printf) + +loop: hlt + jmp loop + +halt_message: + .asciz "Halted." + + /* Our stack area. */ + .comm stack, STACK_SIZE + \ No newline at end of file diff --git a/usr/src/grub/grub-0.97/docs/boot.S.texi b/usr/src/grub/grub-0.97/docs/boot.S.texi new file mode 100644 index 0000000000..afca9f71cf --- /dev/null +++ b/usr/src/grub/grub-0.97/docs/boot.S.texi @@ -0,0 +1,80 @@ +/* @r{boot.S - bootstrap the kernel} */ +/* @r{Copyright (C) 1999, 2001 Free Software Foundation, 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 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.} */ + +#define ASM 1 +#include + + .text + + .globl start, _start +start: +_start: + jmp multiboot_entry + + /* @r{Align 32 bits boundary.} */ + .align 4 + + /* @r{Multiboot header.} */ +multiboot_header: + /* @r{magic} */ + .long MULTIBOOT_HEADER_MAGIC + /* @r{flags} */ + .long MULTIBOOT_HEADER_FLAGS + /* @r{checksum} */ + .long -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS) +#ifndef __ELF__ + /* @r{header_addr} */ + .long multiboot_header + /* @r{load_addr} */ + .long _start + /* @r{load_end_addr} */ + .long _edata + /* @r{bss_end_addr} */ + .long _end + /* @r{entry_addr} */ + .long multiboot_entry +#endif /* @r{! __ELF__} */ + +multiboot_entry: + /* @r{Initialize the stack pointer.} */ + movl $(stack + STACK_SIZE), %esp + + /* @r{Reset EFLAGS.} */ + pushl $0 + popf + + /* @r{Push the pointer to the Multiboot information structure.} */ + pushl %ebx + /* @r{Push the magic value.} */ + pushl %eax + + /* @r{Now enter the C main function...} */ + call EXT_C(cmain) + + /* @r{Halt.} */ + pushl $halt_message + call EXT_C(printf) + +loop: hlt + jmp loop + +halt_message: + .asciz "Halted." + + /* @r{Our stack area.} */ + .comm stack, STACK_SIZE + \ No newline at end of file diff --git a/usr/src/grub/grub-0.97/docs/grub-install.8 b/usr/src/grub/grub-0.97/docs/grub-install.8 new file mode 100644 index 0000000000..ac588a333e --- /dev/null +++ b/usr/src/grub/grub-0.97/docs/grub-install.8 @@ -0,0 +1,52 @@ +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.23. +.TH GRUB-INSTALL "8" "May 2005" "grub-install (GNU GRUB 0.97)" FSF +.SH NAME +grub-install \- install GRUB on your drive +.SH SYNOPSIS +.B grub-install +[\fIOPTION\fR] \fIinstall_device\fR +.SH DESCRIPTION +Install GRUB on your drive. +.TP +\fB\-h\fR, \fB\-\-help\fR +print this message and exit +.TP +\fB\-v\fR, \fB\-\-version\fR +print the version information and exit +.TP +\fB\-\-root\-directory\fR=\fIDIR\fR +install GRUB images under the directory DIR +instead of the root directory +.TP +\fB\-\-grub\-shell\fR=\fIFILE\fR +use FILE as the grub shell +.TP +\fB\-\-no\-floppy\fR +do not probe any floppy drive +.TP +\fB\-\-force\-lba\fR +force GRUB to use LBA mode even for a buggy +BIOS +.TP +\fB\-\-recheck\fR +probe a device map even if it already exists +.PP +INSTALL_DEVICE can be a GRUB device name or a system device filename. +.PP +grub-install copies GRUB images into the DIR/boot directory specfied by +\fB\-\-root\-directory\fR, and uses the grub shell to install grub into the boot +sector. +.SH "REPORTING BUGS" +Report bugs to . +.SH "SEE ALSO" +The full documentation for +.B grub-install +is maintained as a Texinfo manual. If the +.B info +and +.B grub-install +programs are properly installed at your site, the command +.IP +.B info grub-install +.PP +should give you access to the complete manual. diff --git a/usr/src/grub/grub-0.97/docs/grub-md5-crypt.8 b/usr/src/grub/grub-0.97/docs/grub-md5-crypt.8 new file mode 100644 index 0000000000..07db5319c6 --- /dev/null +++ b/usr/src/grub/grub-0.97/docs/grub-md5-crypt.8 @@ -0,0 +1,32 @@ +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.23. +.TH GRUB-MD5-CRYPT "8" "May 2005" "grub-md5-crypt (GNU GRUB )" FSF +.SH NAME +grub-md5-crypt \- Encrypt a password in MD5 format +.SH SYNOPSIS +.B grub-md5-crypt +[\fIOPTION\fR] +.SH DESCRIPTION +Encrypt a password in MD5 format. +.TP +\fB\-h\fR, \fB\-\-help\fR +print this message and exit +.TP +\fB\-v\fR, \fB\-\-version\fR +print the version information and exit +.TP +\fB\-\-grub\-shell\fR=\fIFILE\fR +use FILE as the grub shell +.SH "REPORTING BUGS" +Report bugs to . +.SH "SEE ALSO" +The full documentation for +.B grub-md5-crypt +is maintained as a Texinfo manual. If the +.B info +and +.B grub-md5-crypt +programs are properly installed at your site, the command +.IP +.B info grub-md5-crypt +.PP +should give you access to the complete manual. diff --git a/usr/src/grub/grub-0.97/docs/grub-terminfo.8 b/usr/src/grub/grub-0.97/docs/grub-terminfo.8 new file mode 100644 index 0000000000..ac9f19c30b --- /dev/null +++ b/usr/src/grub/grub-0.97/docs/grub-terminfo.8 @@ -0,0 +1,29 @@ +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.23. +.TH GRUB-TERMINFO "8" "May 2005" "grub-terminfo (GNU GRUB 0.97)" FSF +.SH NAME +grub-terminfo \- Generate a terminfo command from a terminfo name +.SH SYNOPSIS +.B grub-terminfo +\fITERMNAME\fR +.SH DESCRIPTION +Generate a terminfo command from a terminfo name. +.TP +\fB\-h\fR, \fB\-\-help\fR +print this message and exit +.TP +\fB\-v\fR, \fB\-\-version\fR +print the version information and exit +.SH "REPORTING BUGS" +Report bugs to . +.SH "SEE ALSO" +The full documentation for +.B grub-terminfo +is maintained as a Texinfo manual. If the +.B info +and +.B grub-terminfo +programs are properly installed at your site, the command +.IP +.B info grub-terminfo +.PP +should give you access to the complete manual. diff --git a/usr/src/grub/grub-0.97/docs/grub.8 b/usr/src/grub/grub-0.97/docs/grub.8 new file mode 100644 index 0000000000..92149f7118 --- /dev/null +++ b/usr/src/grub/grub-0.97/docs/grub.8 @@ -0,0 +1,71 @@ +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.23. +.TH GRUB "8" "May 2005" "grub (GNU GRUB 0.97)" FSF +.SH NAME +grub \- the grub shell +.SH SYNOPSIS +.B grub +[\fIOPTION\fR]... +.SH DESCRIPTION +Enter the GRand Unified Bootloader command shell. +.TP +\fB\-\-batch\fR +turn on batch mode for non-interactive use +.TP +\fB\-\-boot\-drive\fR=\fIDRIVE\fR +specify stage2 boot_drive [default=0x0] +.TP +\fB\-\-config\-file\fR=\fIFILE\fR +specify stage2 config_file [default=/boot/grub/menu.lst] +.TP +\fB\-\-device\-map\fR=\fIFILE\fR +use the device map file FILE +.TP +\fB\-\-help\fR +display this message and exit +.TP +\fB\-\-hold\fR +wait until a debugger will attach +.TP +\fB\-\-install\-partition\fR=\fIPAR\fR +specify stage2 install_partition [default=0x20000] +.TP +\fB\-\-no\-config\-file\fR +do not use the config file +.TP +\fB\-\-no\-curses\fR +do not use curses +.TP +\fB\-\-no\-floppy\fR +do not probe any floppy drive +.TP +\fB\-\-no\-pager\fR +do not use internal pager +.TP +\fB\-\-preset\-menu\fR +use the preset menu +.TP +\fB\-\-probe\-second\-floppy\fR +probe the second floppy drive +.TP +\fB\-\-read\-only\fR +do not write anything to devices +.TP +\fB\-\-verbose\fR +print verbose messages +.TP +\fB\-\-version\fR +print version information and exit +.SH "REPORTING BUGS" +Report bugs to . +.SH "SEE ALSO" +The full documentation for +.B grub +is maintained as a Texinfo manual. If the +.B info +and +.B grub +programs are properly installed at your site, the command +.IP +.B info grub +.PP +should give you access to the complete manual. diff --git a/usr/src/grub/grub-0.97/docs/grub.info b/usr/src/grub/grub-0.97/docs/grub.info new file mode 100644 index 0000000000..f18e0a3449 --- /dev/null +++ b/usr/src/grub/grub-0.97/docs/grub.info @@ -0,0 +1,4455 @@ +This is ../../docs/grub.info, produced by makeinfo version 4.8 from +../../docs/grub.texi. + +INFO-DIR-SECTION Kernel +START-INFO-DIR-ENTRY +* GRUB: (grub). The GRand Unified Bootloader +* grub-install: (grub)Invoking grub-install. Install GRUB on your drive +* grub-md5-crypt: (grub)Invoking grub-md5-crypt. Encrypt a password + in MD5 format +* grub-terminfo: (grub)Invoking grub-terminfo. Generate a terminfo + command from a + terminfo name +* grub-set-default: (grub)Invoking grub-set-default. Set a default boot + entry +* mbchk: (grub)Invoking mbchk. Check for the format of a Multiboot kernel +END-INFO-DIR-ENTRY + + Copyright (C) 1999,2000,2001,2002,2004 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: grub.info, Node: Top, Next: Introduction, Up: (dir) + +GRUB manual +*********** + +This is the documentation of GNU GRUB, the GRand Unified Bootloader, a +flexible and powerful boot loader program for PCs. + + This edition documents version 0.97. + +* Menu: + +* Introduction:: Capturing the spirit of GRUB +* Naming convention:: Names of your drives in GRUB +* Installation:: Installing GRUB on your drive +* Booting:: How to boot different operating systems +* Configuration:: Writing your own configuration file +* Network:: Downloading OS images from a network +* Serial terminal:: Using GRUB via a serial line +* Preset Menu:: Embedding a configuration file into GRUB +* Security:: Improving the security +* Images:: GRUB image files +* Filesystem:: Filesystem syntax and semantics +* Interface:: The menu and the command-line +* Commands:: The list of available builtin commands +* Troubleshooting:: Error messages produced by GRUB +* Invoking the grub shell:: How to use the grub shell +* Invoking grub-install:: How to use the GRUB installer +* Invoking grub-md5-crypt:: How to generate a cryptic password +* Invoking grub-terminfo:: How to generate a terminfo command +* Invoking grub-set-default:: How to set a default boot entry +* Invoking mbchk:: How to use the Multiboot checker +* Obtaining and Building GRUB:: How to obtain and build GRUB +* Reporting bugs:: Where you should send a bug report +* Future:: Some future plans on GRUB +* Internals:: Hacking GRUB +* Index:: + + +File: grub.info, Node: Introduction, Next: Naming convention, Prev: Top, Up: Top + +1 Introduction to GRUB +********************** + +* Menu: + +* Overview:: What exactly GRUB is and how to use it +* History:: From maggot to house fly +* Features:: GRUB features +* Role of a boot loader:: The role of a boot loader + + +File: grub.info, Node: Overview, Next: History, Up: Introduction + +1.1 Overview +============ + +Briefly, a "boot loader" is the first software program that runs when a +computer starts. It is responsible for loading and transferring +control to an operating system "kernel" software (such as Linux or GNU +Mach). The kernel, in turn, initializes the rest of the operating +system (e.g. a GNU system). + + GNU GRUB is a very powerful boot loader, which can load a wide +variety of free operating systems, as well as proprietary operating +systems with chain-loading(1) (*note Overview-Footnote-1::). GRUB is +designed to address the complexity of booting a personal computer; both +the program and this manual are tightly bound to that computer platform, +although porting to other platforms may be addressed in the future. + + One of the important features in GRUB is flexibility; GRUB +understands filesystems and kernel executable formats, so you can load +an arbitrary operating system the way you like, without recording the +physical position of your kernel on the disk. Thus you can load the +kernel just by specifying its file name and the drive and partition +where the kernel resides. + + When booting with GRUB, you can use either a command-line interface +(*note Command-line interface::), or a menu interface (*note Menu +interface::). Using the command-line interface, you type the drive +specification and file name of the kernel manually. In the menu +interface, you just select an OS using the arrow keys. The menu is +based on a configuration file which you prepare beforehand (*note +Configuration::). While in the menu, you can switch to the command-line +mode, and vice-versa. You can even edit menu entries before using them. + + In the following chapters, you will learn how to specify a drive, a +partition, and a file name (*note Naming convention::) to GRUB, how to +install GRUB on your drive (*note Installation::), and how to boot your +OSes (*note Booting::), step by step. + + Besides the GRUB boot loader itself, there is a "grub shell" `grub' +(*note Invoking the grub shell::) which can be run when you are in your +operating system. It emulates the boot loader and can be used for +installing the boot loader. + + +File: grub.info, Node: Overview-Footnotes, Up: Overview + + (1) "chain-load" is the mechanism for loading unsupported operating +systems by loading another boot loader. It is typically used for +loading DOS or Windows. + + +File: grub.info, Node: History, Next: Features, Prev: Overview, Up: Introduction + +1.2 History of GRUB +=================== + +GRUB originated in 1995 when Erich Boleyn was trying to boot the GNU +Hurd with the University of Utah's Mach 4 microkernel (now known as GNU +Mach). Erich and Brian Ford designed the Multiboot Specification +(*note Multiboot Specification: (multiboot)Top.), because they were +determined not to add to the large number of mutually-incompatible PC +boot methods. + + Erich then began modifying the FreeBSD boot loader so that it would +understand Multiboot. He soon realized that it would be a lot easier to +write his own boot loader from scratch than to keep working on the +FreeBSD boot loader, and so GRUB was born. + + Erich added many features to GRUB, but other priorities prevented him +from keeping up with the demands of its quickly-expanding user base. In +1999, Gordon Matzigkeit and Yoshinori K. Okuji adopted GRUB as an +official GNU package, and opened its development by making the latest +sources available via anonymous CVS. *Note Obtaining and Building +GRUB::, for more information. + + +File: grub.info, Node: Features, Next: Role of a boot loader, Prev: History, Up: Introduction + +1.3 GRUB features +================= + +The primary requirement for GRUB is that it be compliant with the +"Multiboot Specification", which is described in *Note Multiboot +Specification: (multiboot)Top. + + The other goals, listed in approximate order of importance, are: + + * Basic functions must be straightforward for end-users. + + * Rich functionality to support kernel experts and designers. + + * Backward compatibility for booting FreeBSD, NetBSD, OpenBSD, and + Linux. Proprietary kernels (such as DOS, Windows NT, and OS/2) are + supported via a chain-loading function. + + Except for specific compatibility modes (chain-loading and the Linux +"piggyback" format), all kernels will be started in much the same state +as in the Multiboot Specification. Only kernels loaded at 1 megabyte or +above are presently supported. Any attempt to load below that boundary +will simply result in immediate failure and an error message reporting +the problem. + + In addition to the requirements above, GRUB has the following +features (note that the Multiboot Specification doesn't require all the +features that GRUB supports): + +Recognize multiple executable formats + Support many of the "a.out" variants plus "ELF". Symbol tables are + also loaded. + +Support non-Multiboot kernels + Support many of the various free 32-bit kernels that lack Multiboot + compliance (primarily FreeBSD, NetBSD, OpenBSD, and Linux). + Chain-loading of other boot loaders is also supported. + +Load multiples modules + Fully support the Multiboot feature of loading multiple modules. + +Load a configuration file + Support a human-readable text configuration file with preset boot + commands. You can also load another configuration file dynamically + and embed a preset configuration file in a GRUB image file. The + list of commands (*note Commands::) are a superset of those + supported on the command-line. An example configuration file is + provided in *Note Configuration::. + +Provide a menu interface + A menu interface listing preset boot commands, with a programmable + timeout, is available. There is no fixed limit on the number of + boot entries, and the current implementation has space for several + hundred. + +Have a flexible command-line interface + A fairly flexible command-line interface, accessible from the menu, + is available to edit any preset commands, or write a new boot + command set from scratch. If no configuration file is present, + GRUB drops to the command-line. + + The list of commands (*note Commands::) are a subset of those + supported for configuration files. Editing commands closely + resembles the Bash command-line (*note Bash: (features)Command + Line Editing.), with -completion of commands, devices, + partitions, and files in a directory depending on context. + +Support multiple filesystem types + Support multiple filesystem types transparently, plus a useful + explicit blocklist notation. The currently supported filesystem + types are "BSD FFS", "DOS FAT16 and FAT32", "Minix fs", "Linux + ext2fs", "ReiserFS", "JFS", "XFS", and "VSTa fs". *Note + Filesystem::, for more information. + +Support automatic decompression + Can decompress files which were compressed by `gzip'. This + function is both automatic and transparent to the user (i.e. all + functions operate upon the uncompressed contents of the specified + files). This greatly reduces a file size and loading time, a + particularly great benefit for floppies.(1) (*note + Features-Footnote-1::) + + It is conceivable that some kernel modules should be loaded in a + compressed state, so a different module-loading command can be + specified to avoid uncompressing the modules. + +Access data on any installed device + Support reading data from any or all floppies or hard disk(s) + recognized by the BIOS, independent of the setting of the root + device. + +Be independent of drive geometry translations + Unlike many other boot loaders, GRUB makes the particular drive + translation irrelevant. A drive installed and running with one + translation may be converted to another translation without any + adverse effects or changes in GRUB's configuration. + +Detect all installed RAM + GRUB can generally find all the installed RAM on a PC-compatible + machine. It uses an advanced BIOS query technique for finding all + memory regions. As described on the Multiboot Specification (*note + Multiboot Specification: (multiboot)Top.), not all kernels make + use of this information, but GRUB provides it for those who do. + +Support Logical Block Address mode + In traditional disk calls (called "CHS mode"), there is a geometry + translation problem, that is, the BIOS cannot access over 1024 + cylinders, so the accessible space is limited to at least 508 MB + and to at most 8GB. GRUB can't universally solve this problem, as + there is no standard interface used in all machines. However, + several newer machines have the new interface, Logical Block + Address ("LBA") mode. GRUB automatically detects if LBA mode is + available and uses it if available. In LBA mode, GRUB can access + the entire disk. + +Support network booting + GRUB is basically a disk-based boot loader but also has network + support. You can load OS images from a network by using the "TFTP" + protocol. + +Support remote terminals + To support computers with no console, GRUB provides remote terminal + support, so that you can control GRUB from a remote host. Only + serial terminal support is implemented at the moment. + + +File: grub.info, Node: Features-Footnotes, Up: Features + + (1) There are a few pathological cases where loading a very badly +organized ELF kernel might take longer, but in practice this never +happen. + + +File: grub.info, Node: Role of a boot loader, Prev: Features, Up: Introduction + +1.4 The role of a boot loader +============================= + +The following is a quotation from Gordon Matzigkeit, a GRUB fanatic: + + Some people like to acknowledge both the operating system and + kernel when they talk about their computers, so they might say + they use "GNU/Linux" or "GNU/Hurd". Other people seem to think + that the kernel is the most important part of the system, so they + like to call their GNU operating systems "Linux systems." + + I, personally, believe that this is a grave injustice, because the + _boot loader_ is the most important software of all. I used to + refer to the above systems as either "LILO"(1) (*note Role of a + boot loader-Footnote-1::) or "GRUB" systems. + + Unfortunately, nobody ever understood what I was talking about; + now I just use the word "GNU" as a pseudonym for GRUB. + + So, if you ever hear people talking about their alleged "GNU" + systems, remember that they are actually paying homage to the best + boot loader around... GRUB! + + We, the GRUB maintainers, do not (usually) encourage Gordon's level +of fanaticism, but it helps to remember that boot loaders deserve +recognition. We hope that you enjoy using GNU GRUB as much as we did +writing it. + + +File: grub.info, Node: Role of a boot loader-Footnotes, Up: Role of a boot loader + + (1) The LInux LOader, a boot loader that everybody uses, but nobody +likes. + + +File: grub.info, Node: Naming convention, Next: Installation, Prev: Introduction, Up: Top + +2 Naming convention +******************* + +The device syntax used in GRUB is a wee bit different from what you may +have seen before in your operating system(s), and you need to know it so +that you can specify a drive/partition. + + Look at the following examples and explanations: + + (fd0) + + First of all, GRUB requires that the device name be enclosed with +`(' and `)'. The `fd' part means that it is a floppy disk. The number +`0' is the drive number, which is counted from _zero_. This expression +means that GRUB will use the whole floppy disk. + + (hd0,1) + + Here, `hd' means it is a hard disk drive. The first integer `0' +indicates the drive number, that is, the first hard disk, while the +second integer, `1', indicates the partition number (or the PC slice +number in the BSD terminology). Once again, please note that the +partition numbers are counted from _zero_, not from one. This +expression means the second partition of the first hard disk drive. In +this case, GRUB uses one partition of the disk, instead of the whole +disk. + + (hd0,4) + + This specifies the first "extended partition" of the first hard disk +drive. Note that the partition numbers for extended partitions are +counted from `4', regardless of the actual number of primary partitions +on your hard disk. + + (hd1,a) + + This means the BSD `a' partition of the second hard disk. If you +need to specify which PC slice number should be used, use something +like this: `(hd1,0,a)'. If the PC slice number is omitted, GRUB +searches for the first PC slice which has a BSD `a' partition. + + Of course, to actually access the disks or partitions with GRUB, you +need to use the device specification in a command, like `root (fd0)' or +`unhide (hd0,2)'. To help you find out which number specifies a +partition you want, the GRUB command-line (*note Command-line +interface::) options have argument completion. This means that, for +example, you only need to type + + root ( + + followed by a , and GRUB will display the list of drives, +partitions, or file names. So it should be quite easy to determine the +name of your target partition, even with minimal knowledge of the +syntax. + + Note that GRUB does _not_ distinguish IDE from SCSI - it simply +counts the drive numbers from zero, regardless of their type. Normally, +any IDE drive number is less than any SCSI drive number, although that +is not true if you change the boot sequence by swapping IDE and SCSI +drives in your BIOS. + + Now the question is, how to specify a file? Again, consider an +example: + + (hd0,0)/vmlinuz + + This specifies the file named `vmlinuz', found on the first +partition of the first hard disk drive. Note that the argument +completion works with file names, too. + + That was easy, admit it. Now read the next chapter, to find out how +to actually install GRUB on your drive. + + +File: grub.info, Node: Installation, Next: Booting, Prev: Naming convention, Up: Top + +3 Installation +************** + +In order to install GRUB as your boot loader, you need to first install +the GRUB system and utilities under your UNIX-like operating system +(*note Obtaining and Building GRUB::). You can do this either from the +source tarball, or as a package for your OS. + + After you have done that, you need to install the boot loader on a +drive (floppy or hard disk). There are two ways of doing that - either +using the utility `grub-install' (*note Invoking grub-install::) on a +UNIX-like OS, or by running GRUB itself from a floppy. These are quite +similar, however the utility might probe a wrong BIOS drive, so you +should be careful. + + Also, if you install GRUB on a UNIX-like OS, please make sure that +you have an emergency boot disk ready, so that you can rescue your +computer if, by any chance, your hard drive becomes unusable +(unbootable). + + GRUB comes with boot images, which are normally put in the directory +`/usr/lib/grub/i386-pc'. If you do not use grub-install, then you need +to copy the files `stage1', `stage2', and `*stage1_5' to the directory +`/boot/grub', and run the `grub-set-default' (*note Invoking +grub-set-default::) if you intend to use `default saved' (*note +default::) in your configuration file. Hereafter, the directory where +GRUB images are initially placed (normally `/usr/lib/grub/i386-pc') +will be called the "image directory", and the directory where the boot +loader needs to find them (usually `/boot/grub') will be called the +"boot directory". + +* Menu: + +* Creating a GRUB boot floppy:: +* Installing GRUB natively:: +* Installing GRUB using grub-install:: +* Making a GRUB bootable CD-ROM:: + + +File: grub.info, Node: Creating a GRUB boot floppy, Next: Installing GRUB natively, Up: Installation + +3.1 Creating a GRUB boot floppy +=============================== + +To create a GRUB boot floppy, you need to take the files `stage1' and +`stage2' from the image directory, and write them to the first and the +second block of the floppy disk, respectively. + + *Caution:* This procedure will destroy any data currently stored on +the floppy. + + On a UNIX-like operating system, that is done with the following +commands: + + # cd /usr/lib/grub/i386-pc + # dd if=stage1 of=/dev/fd0 bs=512 count=1 + 1+0 records in + 1+0 records out + # dd if=stage2 of=/dev/fd0 bs=512 seek=1 + 153+1 records in + 153+1 records out + # + + The device file name may be different. Consult the manual for your +OS. + + +File: grub.info, Node: Installing GRUB natively, Next: Installing GRUB using grub-install, Prev: Creating a GRUB boot floppy, Up: Installation + +3.2 Installing GRUB natively +============================ + +*Caution:* Installing GRUB's stage1 in this manner will erase the +normal boot-sector used by an OS. + + GRUB can currently boot GNU Mach, Linux, FreeBSD, NetBSD, and OpenBSD +directly, so using it on a boot sector (the first sector of a +partition) should be okay. But generally, it would be a good idea to +back up the first sector of the partition on which you are installing +GRUB's stage1. This isn't as important if you are installing GRUB on +the first sector of a hard disk, since it's easy to reinitialize it +(e.g. by running `FDISK /MBR' from DOS). + + If you decide to install GRUB in the native environment, which is +definitely desirable, you'll need to create a GRUB boot disk, and +reboot your computer with it. Otherwise, see *Note Installing GRUB +using grub-install::. + + Once started, GRUB will show the command-line interface (*note +Command-line interface::). First, set the GRUB's "root device"(1) +(*note Installing GRUB natively-Footnote-1::) to the partition +containing the boot directory, like this: + + grub> root (hd0,0) + + If you are not sure which partition actually holds this directory, +use the command `find' (*note find::), like this: + + grub> find /boot/grub/stage1 + + This will search for the file name `/boot/grub/stage1' and show the +devices which contain the file. + + Once you've set the root device correctly, run the command `setup' +(*note setup::): + + grub> setup (hd0) + + This command will install the GRUB boot loader on the Master Boot +Record (MBR) of the first drive. If you want to put GRUB into the boot +sector of a partition instead of putting it in the MBR, specify the +partition into which you want to install GRUB: + + grub> setup (hd0,0) + + If you install GRUB into a partition or a drive other than the first +one, you must chain-load GRUB from another boot loader. Refer to the +manual for the boot loader to know how to chain-load GRUB. + + After using the setup command, you will boot into GRUB without the +GRUB floppy. See the chapter *Note Booting:: to find out how to boot +your operating systems from GRUB. + + +File: grub.info, Node: Installing GRUB natively-Footnotes, Up: Installing GRUB natively + + (1) Note that GRUB's root device doesn't necessarily mean your OS's +root partition; if you need to specify a root partition for your OS, +add the argument into the command `kernel'. + + +File: grub.info, Node: Installing GRUB using grub-install, Next: Making a GRUB bootable CD-ROM, Prev: Installing GRUB natively, Up: Installation + +3.3 Installing GRUB using grub-install +====================================== + +*Caution:* This procedure is definitely less safe, because there are +several ways in which your computer can become unbootable. For example, +most operating systems don't tell GRUB how to map BIOS drives to OS +devices correctly--GRUB merely "guesses" the mapping. This will succeed +in most cases, but not always. Therefore, GRUB provides you with a map +file called the "device map", which you must fix if it is wrong. *Note +Device map::, for more details. + + If you still do want to install GRUB under a UNIX-like OS (such as +GNU), invoke the program `grub-install' (*note Invoking grub-install::) +as the superuser ("root"). + + The usage is basically very simple. You only need to specify one +argument to the program, namely, where to install the boot loader. The +argument can be either a device file (like `/dev/hda') or a partition +specified in GRUB's notation. For example, under Linux the following +will install GRUB into the MBR of the first IDE disk: + + # grub-install /dev/hda + + Likewise, under GNU/Hurd, this has the same effect: + + # grub-install /dev/hd0 + + If it is the first BIOS drive, this is the same as well: + + # grub-install '(hd0)' + + Or you can omit the parentheses: + + # grub-install hd0 + + But all the above examples assume that GRUB should use images under +the root directory. If you want GRUB to use images under a directory +other than the root directory, you need to specify the option +`--root-directory'. The typical usage is that you create a GRUB boot +floppy with a filesystem. Here is an example: + + # mke2fs /dev/fd0 + # mount -t ext2 /dev/fd0 /mnt + # grub-install --root-directory=/mnt fd0 + # umount /mnt + + Another example is when you have a separate boot partition which is +mounted at `/boot'. Since GRUB is a boot loader, it doesn't know +anything about mountpoints at all. Thus, you need to run `grub-install' +like this: + + # grub-install --root-directory=/boot /dev/hda + + By the way, as noted above, it is quite difficult to guess BIOS +drives correctly under a UNIX-like OS. Thus, `grub-install' will prompt +you to check if it could really guess the correct mappings, after the +installation. The format is defined in *Note Device map::. Please be +quite careful. If the output is wrong, it is unlikely that your +computer will be able to boot with no problem. + + Note that `grub-install' is actually just a shell script and the +real task is done by the grub shell `grub' (*note Invoking the grub +shell::). Therefore, you may run `grub' directly to install GRUB, +without using `grub-install'. Don't do that, however, unless you are +very familiar with the internals of GRUB. Installing a boot loader on a +running OS may be extremely dangerous. + + +File: grub.info, Node: Making a GRUB bootable CD-ROM, Prev: Installing GRUB using grub-install, Up: Installation + +3.4 Making a GRUB bootable CD-ROM +================================= + +GRUB supports the "no emulation mode" in the El Torito specification(1) +(*note Making a GRUB bootable CD-ROM-Footnote-1::). This means that you +can use the whole CD-ROM from GRUB and you don't have to make a floppy +or hard disk image file, which can cause compatibility problems. + + For booting from a CD-ROM, GRUB uses a special Stage 2 called +`stage2_eltorito'. The only GRUB files you need to have in your +bootable CD-ROM are this `stage2_eltorito' and optionally a config file +`menu.lst'. You don't need to use `stage1' or `stage2', because El +Torito is quite different from the standard boot process. + + Here is an example of procedures to make a bootable CD-ROM image. +First, make a top directory for the bootable image, say, `iso': + + $ mkdir iso + + Make a directory for GRUB: + + $ mkdir -p iso/boot/grub + + Copy the file `stage2_eltorito': + + $ cp /usr/lib/grub/i386-pc/stage2_eltorito iso/boot/grub + + If desired, make the config file `menu.lst' under `iso/boot/grub' +(*note Configuration::), and copy any files and directories for the +disc to the directory `iso/'. + + Finally, make a ISO9660 image file like this: + + $ mkisofs -R -b boot/grub/stage2_eltorito -no-emul-boot \ + -boot-load-size 4 -boot-info-table -o grub.iso iso + + This produces a file named `grub.iso', which then can be burned into +a CD (or a DVD). `mkisofs' has already set up the disc to boot from +the `boot/grub/stage2_eltorito' file, so there is no need to setup GRUB +on the disc. (Note that the `-boot-load-size 4' bit is required for +compatibility with the BIOS on many older machines.) + + You can use the device `(cd)' to access a CD-ROM in your config +file. This is not required; GRUB automatically sets the root device to +`(cd)' when booted from a CD-ROM. It is only necessary to refer to +`(cd)' if you want to access other drives as well. + + +File: grub.info, Node: Making a GRUB bootable CD-ROM-Footnotes, Up: Making a GRUB bootable CD-ROM + + (1) El Torito is a specification for bootable CD using BIOS +functions. + + +File: grub.info, Node: Booting, Next: Configuration, Prev: Installation, Up: Top + +4 Booting +********* + +GRUB can load Multiboot-compliant kernels in a consistent way, but for +some free operating systems you need to use some OS-specific magic. + +* Menu: + +* General boot methods:: How to boot OSes with GRUB generally +* OS-specific notes:: Notes on some operating systems +* Making your system robust:: How to make your system robust + + +File: grub.info, Node: General boot methods, Next: OS-specific notes, Up: Booting + +4.1 How to boot operating systems +================================= + +GRUB has two distinct boot methods. One of the two is to load an +operating system directly, and the other is to chain-load another boot +loader which then will load an operating system actually. Generally +speaking, the former is more desirable, because you don't need to +install or maintain other boot loaders and GRUB is flexible enough to +load an operating system from an arbitrary disk/partition. However, the +latter is sometimes required, since GRUB doesn't support all the +existing operating systems natively. + +* Menu: + +* Loading an operating system directly:: +* Chain-loading:: + + +File: grub.info, Node: Loading an operating system directly, Next: Chain-loading, Up: General boot methods + +4.1.1 How to boot an OS directly with GRUB +------------------------------------------ + +Multiboot (*note Multiboot Specification: (multiboot)Top.) is the +native format supported by GRUB. For the sake of convenience, there is +also support for Linux, FreeBSD, NetBSD and OpenBSD. If you want to +boot other operating systems, you will have to chain-load them (*note +Chain-loading::). + + Generally, GRUB can boot any Multiboot-compliant OS in the following +steps: + + 1. Set GRUB's root device to the drive where the OS images are stored + with the command `root' (*note root::). + + 2. Load the kernel image with the command `kernel' (*note kernel::). + + 3. If you need modules, load them with the command `module' (*note + module::) or `modulenounzip' (*note modulenounzip::). + + 4. Run the command `boot' (*note boot::). + + Linux, FreeBSD, NetBSD and OpenBSD can be booted in a similar +manner. You load a kernel image with the command `kernel' and then run +the command `boot'. If the kernel requires some parameters, just append +the parameters to `kernel', after the file name of the kernel. Also, +please refer to *Note OS-specific notes::, for information on your +OS-specific issues. + + +File: grub.info, Node: Chain-loading, Prev: Loading an operating system directly, Up: General boot methods + +4.1.2 Load another boot loader to boot unsupported operating systems +-------------------------------------------------------------------- + +If you want to boot an unsupported operating system (e.g. Windows 95), +chain-load a boot loader for the operating system. Normally, the boot +loader is embedded in the "boot sector" of the partition on which the +operating system is installed. + + 1. Set GRUB's root device to the partition by the command + `rootnoverify' (*note rootnoverify::): + + grub> rootnoverify (hd0,0) + + 2. Set the "active" flag in the partition using the command + `makeactive'(1) (*note Chain-loading-Footnote-1::) (*note + makeactive::): + + grub> makeactive + + 3. Load the boot loader with the command `chainloader' (*note + chainloader::): + + grub> chainloader +1 + + `+1' indicates that GRUB should read one sector from the start of + the partition. The complete description about this syntax can be + found in *Note Block list syntax::. + + 4. Run the command `boot' (*note boot::). + + However, DOS and Windows have some deficiencies, so you might have to +use more complicated instructions. *Note DOS/Windows::, for more +information. + + +File: grub.info, Node: Chain-loading-Footnotes, Up: Chain-loading + + (1) This is not necessary for most of the modern operating systems. + + +File: grub.info, Node: OS-specific notes, Next: Making your system robust, Prev: General boot methods, Up: Booting + +4.2 Some caveats on OS-specific issues +====================================== + +Here, we describe some caveats on several operating systems. + +* Menu: + +* GNU/Hurd:: +* GNU/Linux:: +* FreeBSD:: +* NetBSD:: +* OpenBSD:: +* DOS/Windows:: +* SCO UnixWare:: +* QNX:: + + +File: grub.info, Node: GNU/Hurd, Next: GNU/Linux, Up: OS-specific notes + +4.2.1 GNU/Hurd +-------------- + +Since GNU/Hurd is Multiboot-compliant, it is easy to boot it; there is +nothing special about it. But do not forget that you have to specify a +root partition to the kernel. + + 1. Set GRUB's root device to the same drive as GNU/Hurd's. Probably + the command `find /boot/gnumach' or similar can help you (*note + find::). + + 2. Load the kernel and the module, like this: + + grub> kernel /boot/gnumach root=hd0s1 + grub> module /boot/serverboot + + 3. Run the command `boot' (*note boot::). + + +File: grub.info, Node: GNU/Linux, Next: FreeBSD, Prev: GNU/Hurd, Up: OS-specific notes + +4.2.2 GNU/Linux +--------------- + +It is relatively easy to boot GNU/Linux from GRUB, because it somewhat +resembles to boot a Multiboot-compliant OS. + + 1. Set GRUB's root device to the same drive as GNU/Linux's. Probably + the command `find /vmlinuz' or similar can help you (*note find::). + + 2. Load the kernel: + + grub> kernel /vmlinuz root=/dev/hda1 + + If you need to specify some kernel parameters, just append them to + the command. For example, to set `vga' to `ext', do this: + + grub> kernel /vmlinuz root=/dev/hda1 vga=ext + + See the documentation in the Linux source tree for complete + information on the available options. + + 3. If you use an initrd, execute the command `initrd' (*note + initrd::) after `kernel': + + grub> initrd /initrd + + 4. Finally, run the command `boot' (*note boot::). + + *Caution:* If you use an initrd and specify the `mem=' option to the +kernel to let it use less than actual memory size, you will also have +to specify the same memory size to GRUB. To let GRUB know the size, run +the command `uppermem' _before_ loading the kernel. *Note uppermem::, +for more information. + + +File: grub.info, Node: FreeBSD, Next: NetBSD, Prev: GNU/Linux, Up: OS-specific notes + +4.2.3 FreeBSD +------------- + +GRUB can load the kernel directly, either in ELF or a.out format. But +this is not recommended, since FreeBSD's bootstrap interface sometimes +changes heavily, so GRUB can't guarantee to pass kernel parameters +correctly. + + Thus, we'd recommend loading the very flexible loader `/boot/loader' +instead. See this example: + + grub> root (hd0,a) + grub> kernel /boot/loader + grub> boot + + +File: grub.info, Node: NetBSD, Next: OpenBSD, Prev: FreeBSD, Up: OS-specific notes + +4.2.4 NetBSD +------------ + +GRUB can load NetBSD a.out and ELF directly, follow these steps: + + 1. Set GRUB's root device with `root' (*note root::). + + 2. Load the kernel with `kernel' (*note kernel::). You should append + the ugly option `--type=netbsd', if you want to load an ELF + kernel, like this: + + grub> kernel --type=netbsd /netbsd-elf + + 3. Run `boot' (*note boot::). + + For now, however, GRUB doesn't allow you to pass kernel parameters, +so it may be better to chain-load it instead. For more information, +please see *Note Chain-loading::. + + +File: grub.info, Node: OpenBSD, Next: DOS/Windows, Prev: NetBSD, Up: OS-specific notes + +4.2.5 OpenBSD +------------- + +The booting instruction is exactly the same as for NetBSD (*note +NetBSD::). + + +File: grub.info, Node: DOS/Windows, Next: SCO UnixWare, Prev: OpenBSD, Up: OS-specific notes + +4.2.6 DOS/Windows +----------------- + +GRUB cannot boot DOS or Windows directly, so you must chain-load them +(*note Chain-loading::). However, their boot loaders have some critical +deficiencies, so it may not work to just chain-load them. To overcome +the problems, GRUB provides you with two helper functions. + + If you have installed DOS (or Windows) on a non-first hard disk, you +have to use the disk swapping technique, because that OS cannot boot +from any disks but the first one. The workaround used in GRUB is the +command `map' (*note map::), like this: + + grub> map (hd0) (hd1) + grub> map (hd1) (hd0) + + This performs a "virtual" swap between your first and second hard +drive. + + *Caution:* This is effective only if DOS (or Windows) uses BIOS to +access the swapped disks. If that OS uses a special driver for the +disks, this probably won't work. + + Another problem arises if you installed more than one set of +DOS/Windows onto one disk, because they could be confused if there are +more than one primary partitions for DOS/Windows. Certainly you should +avoid doing this, but there is a solution if you do want to do so. Use +the partition hiding/unhiding technique. + + If GRUB "hide"s a DOS (or Windows) partition (*note hide::), DOS (or +Windows) will ignore the partition. If GRUB "unhide"s a DOS (or +Windows) partition (*note unhide::), DOS (or Windows) will detect the +partition. Thus, if you have installed DOS (or Windows) on the first +and the second partition of the first hard disk, and you want to boot +the copy on the first partition, do the following: + + grub> unhide (hd0,0) + grub> hide (hd0,1) + grub> rootnoverify (hd0,0) + grub> chainloader +1 + grub> makeactive + grub> boot + + +File: grub.info, Node: SCO UnixWare, Next: QNX, Prev: DOS/Windows, Up: OS-specific notes + +4.2.7 SCO UnixWare +------------------ + +It is known that the signature in the boot loader for SCO UnixWare is +wrong, so you will have to specify the option `--force' to +`chainloader' (*note chainloader::), like this: + + grub> rootnoverify (hd1,0) + grub> chainloader --force +1 + grub> makeactive + grub> boot + + +File: grub.info, Node: QNX, Prev: SCO UnixWare, Up: OS-specific notes + +4.2.8 QNX +--------- + +QNX seems to use a bigger boot loader, so you need to boot it up, like +this: + + grub> rootnoverify (hd1,1) + grub> chainloader +4 + grub> boot + + +File: grub.info, Node: Making your system robust, Prev: OS-specific notes, Up: Booting + +4.3 How to make your system robust +================================== + +When you test a new kernel or a new OS, it is important to make sure +that your computer can boot even if the new system is unbootable. This +is crucial especially if you maintain servers or remote systems. To +accomplish this goal, you need to set up two things: + + 1. You must maintain a system which is always bootable. For instance, + if you test a new kernel, you need to keep a working kernel in a + different place. And, it would sometimes be very nice to even have + a complete copy of a working system in a different partition or + disk. + + 2. You must direct GRUB to boot a working system when the new system + fails. This is possible with the "fallback" system in GRUB. + + The former requirement is very specific to each OS, so this +documentation does not cover that topic. It is better to consult some +backup tools. + + So let's see the GRUB part. There are two possibilities: one of them +is quite simple but not very robust, and the other is a bit complex to +set up but probably the best solution to make sure that your system can +start as long as GRUB itself is bootable. + +* Menu: + +* Booting once-only:: +* Booting fallback systems:: + + +File: grub.info, Node: Booting once-only, Next: Booting fallback systems, Up: Making your system robust + +4.3.1 Booting once-only +----------------------- + +You can teach GRUB to boot an entry only at next boot time. Suppose +that your have an old kernel `old_kernel' and a new kernel +`new_kernel'. You know that `old_kernel' can boot your system +correctly, and you want to test `new_kernel'. + + To ensure that your system will go back to the old kernel even if the +new kernel fails (e.g. it panics), you can specify that GRUB should try +the new kernel only once and boot the old kernel after that. + + First, modify your configuration file. Here is an example: + + default saved # This is important!!! + timeout 10 + + title the old kernel + root (hd0,0) + kernel /old_kernel + savedefault + + title the new kernel + root (hd0,0) + kernel /new_kernel + savedefault 0 # This is important!!! + + Note that this configuration file uses `default saved' (*note +default::) at the head and `savedefault 0' (*note savedefault::) in the +entry for the new kernel. This means that GRUB boots a saved entry by +default, and booting the entry for the new kernel saves `0' as the +saved entry. + + With this configuration file, after all, GRUB always tries to boot +the old kernel after it booted the new one, because `0' is the entry of +`the old kernel'. + + The next step is to tell GRUB to boot the new kernel at next boot +time. For this, execute `grub-set-default' (*note Invoking +grub-set-default::): + + # grub-set-default 1 + + This command sets the saved entry to `1', that is, to the new kernel. + + This method is useful, but still not very robust, because GRUB stops +booting, if there is any error in the boot entry, such that the new +kernel has an invalid executable format. Thus, it it even better to use +the "fallback" mechanism of GRUB. Look at next subsection for this +feature. + + +File: grub.info, Node: Booting fallback systems, Prev: Booting once-only, Up: Making your system robust + +4.3.2 Booting fallback systems +------------------------------ + +GRUB supports a fallback mechanism of booting one or more other entries +if a default boot entry fails. You can specify multiple fallback +entries if you wish. + + Suppose that you have three systems, `A', `B' and `C'. `A' is a +system which you want to boot by default. `B' is a backup system which +is supposed to boot safely. `C' is another backup system which is used +in case where `B' is broken. + + Then you may want GRUB to boot the first system which is bootable +among `A', `B' and `C'. A configuration file can be written in this way: + + default saved # This is important!!! + timeout 10 + fallback 1 2 # This is important!!! + + title A + root (hd0,0) + kernel /kernel + savedefault fallback # This is important!!! + + title B + root (hd1,0) + kernel /kernel + savedefault fallback # This is important!!! + + title C + root (hd2,0) + kernel /kernel + savedefault + + Note that `default saved' (*note default::), `fallback 1 2' and +`savedefault fallback' are used. GRUB will boot a saved entry by +default and save a fallback entry as next boot entry with this +configuration. + + When GRUB tries to boot `A', GRUB saves `1' as next boot entry, +because the command `fallback' specifies that `1' is the first fallback +entry. The entry `1' is `B', so GRUB will try to boot `B' at next boot +time. + + Likewise, when GRUB tries to boot `B', GRUB saves `2' as next boot +entry, because `fallback' specifies `2' as next fallback entry. This +makes sure that GRUB will boot `C' after booting `B'. + + It is noteworthy that GRUB uses fallback entries both when GRUB +itself fails in booting an entry and when `A' or `B' fails in starting +up your system. So this solution ensures that your system is started +even if GRUB cannot find your kernel or if your kernel panics. + + However, you need to run `grub-set-default' (*note Invoking +grub-set-default::) when `A' starts correctly or you fix `A' after it +crashes, since GRUB always sets next boot entry to a fallback entry. +You should run this command in a startup script such as `rc.local' to +boot `A' by default: + + # grub-set-default 0 + + where `0' is the number of the boot entry for the system `A'. + + If you want to see what is current default entry, you can look at the +file `/boot/grub/default' (or `/grub/default' in some systems). Because +this file is plain-text, you can just `cat' this file. But it is +strongly recommended *not to modify this file directly*, because GRUB +may fail in saving a default entry in this file, if you change this +file in an unintended manner. Therefore, you should use +`grub-set-default' when you need to change the default entry. + + +File: grub.info, Node: Configuration, Next: Network, Prev: Booting, Up: Top + +5 Configuration +*************** + +You've probably noticed that you need to type several commands to boot +your OS. There's a solution to that - GRUB provides a menu interface +(*note Menu interface::) from which you can select an item (using arrow +keys) that will do everything to boot an OS. + + To enable the menu, you need a configuration file, `menu.lst' under +the boot directory. We'll analyze an example file. + + The file first contains some general settings, the menu interface +related options. You can put these commands (*note Menu-specific +commands::) before any of the items (starting with `title' (*note +title::)). + + # + # Sample boot menu configuration file + # + + As you may have guessed, these lines are comments. Lines starting +with a hash character (`#'), and blank lines, are ignored by GRUB. + + # By default, boot the first entry. + default 0 + + The first entry (here, counting starts with number zero, not one!) +will be the default choice. + + # Boot automatically after 30 secs. + timeout 30 + + As the comment says, GRUB will boot automatically in 30 seconds, +unless interrupted with a keypress. + + # Fallback to the second entry. + fallback 1 + + If, for any reason, the default entry doesn't work, fall back to the +second one (this is rarely used, for obvious reasons). + + Note that the complete descriptions of these commands, which are menu +interface specific, can be found in *Note Menu-specific commands::. +Other descriptions can be found in *Note Commands::. + + Now, on to the actual OS definitions. You will see that each entry +begins with a special command, `title' (*note title::), and the action +is described after it. Note that there is no command `boot' (*note +boot::) at the end of each item. That is because GRUB automatically +executes `boot' if it loads other commands successfully. + + The argument for the command `title' is used to display a short +title/description of the entry in the menu. Since `title' displays the +argument as is, you can write basically anything there. + + # For booting GNU/Hurd + title GNU/Hurd + root (hd0,0) + kernel /boot/gnumach.gz root=hd0s1 + module /boot/serverboot.gz + + This boots GNU/Hurd from the first hard disk. + + # For booting GNU/Linux + title GNU/Linux + kernel (hd1,0)/vmlinuz root=/dev/hdb1 + + This boots GNU/Linux, but from the second hard disk. + + # For booting Mach (getting kernel from floppy) + title Utah Mach4 multiboot + root (hd0,2) + pause Insert the diskette now^G!! + kernel (fd0)/boot/kernel root=hd0s3 + module (fd0)/boot/bootstrap + + This boots Mach with a kernel on a floppy, but the root filesystem at +hd0s3. It also contains a `pause' line (*note pause::), which will +cause GRUB to display a prompt and delay, before actually executing the +rest of the commands and booting. + + # For booting FreeBSD + title FreeBSD + root (hd0,2,a) + kernel /boot/loader + + This item will boot FreeBSD kernel loaded from the `a' partition of +the third PC slice of the first hard disk. + + # For booting OS/2 + title OS/2 + root (hd0,1) + makeactive + # chainload OS/2 bootloader from the first sector + chainloader +1 + # This is similar to "chainload", but loads a specific file + #chainloader /boot/chain.os2 + + This will boot OS/2, using a chain-loader (*note Chain-loading::). + + # For booting Windows NT or Windows95 + title Windows NT / Windows 95 boot menu + root (hd0,0) + makeactive + chainloader +1 + # For loading DOS if Windows NT is installed + # chainload /bootsect.dos + + The same as the above, but for Windows. + + # For installing GRUB into the hard disk + title Install GRUB into the hard disk + root (hd0,0) + setup (hd0) + + This will just (re)install GRUB onto the hard disk. + + # Change the colors. + title Change the colors + color light-green/brown blink-red/blue + + In the last entry, the command `color' is used (*note color::), to +change the menu colors (try it!). This command is somewhat special, +because it can be used both in the command-line and in the menu. GRUB +has several such commands, see *Note General commands::. + + We hope that you now understand how to use the basic features of +GRUB. To learn more about GRUB, see the following chapters. + + +File: grub.info, Node: Network, Next: Serial terminal, Prev: Configuration, Up: Top + +6 Downloading OS images from a network +************************************** + +Although GRUB is a disk-based boot loader, it does provide network +support. To use the network support, you need to enable at least one +network driver in the GRUB build process. For more information please +see `netboot/README.netboot' in the source distribution. + +* Menu: + +* General usage of network support:: +* Diskless:: + + +File: grub.info, Node: General usage of network support, Next: Diskless, Up: Network + +6.1 How to set up your network +============================== + +GRUB requires a file server and optionally a server that will assign an +IP address to the machine on which GRUB is running. For the former, only +TFTP is supported at the moment. The latter is either BOOTP, DHCP or a +RARP server(1) (*note General usage of network support-Footnote-1::). +It is not necessary to run both the servers on one computer. How to +configure these servers is beyond the scope of this document, so please +refer to the manuals specific to those protocols/servers. + + If you decided to use a server to assign an IP address, set up the +server and run `bootp' (*note bootp::), `dhcp' (*note dhcp::) or `rarp' +(*note rarp::) for BOOTP, DHCP or RARP, respectively. Each command will +show an assigned IP address, a netmask, an IP address for your TFTP +server and a gateway. If any of the addresses is wrong or it causes an +error, probably the configuration of your servers isn't set up properly. + + Otherwise, run `ifconfig', like this: + + grub> ifconfig --address=192.168.110.23 --server=192.168.110.14 + + You can also use `ifconfig' in conjuction with `bootp', `dhcp' or +`rarp' (e.g. to reassign the server address manually). *Note +ifconfig::, for more details. + + Finally, download your OS images from your network. The network can +be accessed using the network drive `(nd)'. Everything else is very +similar to the normal instructions (*note Booting::). + + Here is an example: + + grub> bootp + Probing... [NE*000] + NE2000 base ... + Address: 192.168.110.23 Netmask: 255.255.255.0 + Server: 192.168.110.14 Gateway: 192.168.110.1 + + grub> root (nd) + grub> kernel /tftproot/gnumach.gz root=sd0s1 + grub> module /tftproot/serverboot.gz + grub> boot + + +File: grub.info, Node: General usage of network support-Footnotes, Up: General usage of network support + + (1) RARP is not advised, since it cannot serve much information + + +File: grub.info, Node: Diskless, Prev: General usage of network support, Up: Network + +6.2 Booting from a network +========================== + +It is sometimes very useful to boot from a network, especially when you +use a machine which has no local disk. In this case, you need to obtain +a kind of Net Boot ROM, such as a PXE ROM or a free software package +like Etherboot. Such a Boot ROM first boots the machine, sets up the +network card installed into the machine, and downloads a second stage +boot image from the network. Then, the second image will try to boot an +operating system actually from the network. + + GRUB provides two second stage images, `nbgrub' and `pxegrub' (*note +Images::). These images are the same as the normal Stage 2, except that +they set up a network automatically, and try to load a configuration +file from the network, if specified. The usage is very simple: If the +machine has a PXE ROM, use `pxegrub'. If the machine has an NBI loader +such as Etherboot, use `nbgrub'. There is no difference between them +except their formats. Since the way to load a second stage image you +want to use should be described in the manual on your Net Boot ROM, +please refer to the manual, for more information. + + However, there is one thing specific to GRUB. Namely, how to specify +a configuration file in a BOOTP/DHCP server. For now, GRUB uses the tag +`150', to get the name of a configuration file. The following is an +example with a BOOTP configuration: + + .allhost:hd=/tmp:bf=null:\ + :ds=145.71.35.1 145.71.32.1:\ + :sm=255.255.254.0:\ + :gw=145.71.35.1:\ + :sa=145.71.35.5: + + foo:ht=1:ha=63655d0334a7:ip=145.71.35.127:\ + :bf=/nbgrub:\ + :tc=.allhost:\ + :T150="(nd)/tftpboot/menu.lst.foo": + + Note that you should specify the drive name `(nd)' in the name of +the configuration file. This is because you might change the root drive +before downloading the configuration from the TFTP server when the +preset menu feature is used (*note Preset Menu::). + + See the manual of your BOOTP/DHCP server for more information. The +exact syntax should differ a little from the example. + + +File: grub.info, Node: Serial terminal, Next: Preset Menu, Prev: Network, Up: Top + +7 Using GRUB via a serial line +****************************** + +This chapter describes how to use the serial terminal support in GRUB. + + If you have many computers or computers with no display/keyboard, it +could be very useful to control the computers through serial +communications. To connect one computer with another via a serial line, +you need to prepare a null-modem (cross) serial cable, and you may need +to have multiport serial boards, if your computer doesn't have extra +serial ports. In addition, a terminal emulator is also required, such as +minicom. Refer to a manual of your operating system, for more +information. + + As for GRUB, the instruction to set up a serial terminal is quite +simple. First of all, make sure that you haven't specified the option +`--disable-serial' to the configure script when you built your GRUB +images. If you get them in binary form, probably they have serial +terminal support already. + + Then, initialize your serial terminal after GRUB starts up. Here is +an example: + + grub> serial --unit=0 --speed=9600 + grub> terminal serial + + The command `serial' initializes the serial unit 0 with the speed +9600bps. The serial unit 0 is usually called `COM1', so, if you want to +use COM2, you must specify `--unit=1' instead. This command accepts +many other options, so please refer to *Note serial::, for more details. + + The command `terminal' (*note terminal::) chooses which type of +terminal you want to use. In the case above, the terminal will be a +serial terminal, but you can also pass `console' to the command, as +`terminal serial console'. In this case, a terminal in which you press +any key will be selected as a GRUB terminal. + + However, note that GRUB assumes that your terminal emulator is +compatible with VT100 by default. This is true for most terminal +emulators nowadays, but you should pass the option `--dumb' to the +command if your terminal emulator is not VT100-compatible or implements +few VT100 escape sequences. If you specify this option then GRUB +provides you with an alternative menu interface, because the normal +menu requires several fancy features of your terminal. + + +File: grub.info, Node: Preset Menu, Next: Security, Prev: Serial terminal, Up: Top + +8 Embedding a configuration file into GRUB +****************************************** + +GRUB supports a "preset menu" which is to be always loaded before +starting. The preset menu feature is useful, for example, when your +computer has no console but a serial cable. In this case, it is +critical to set up the serial terminal as soon as possible, since you +cannot see any message until the serial terminal begins to work. So it +is good to run the commands `serial' (*note serial::) and `terminal' +(*note terminal::) before anything else at the start-up time. + + How the preset menu works is slightly complicated: + + 1. GRUB checks if the preset menu feature is used, and loads the + preset menu, if available. This includes running commands and + reading boot entries, like an ordinary configuration file. + + 2. GRUB checks if the configuration file is available. Note that this + check is performed *regardless of the existence of the preset + menu*. The configuration file is loaded even if the preset menu was + loaded. + + 3. If the preset menu includes any boot entries, they are cleared when + the configuration file is loaded. It doesn't matter whether the + configuration file has any entries or no entry. The boot entries + in the preset menu are used only when GRUB fails in loading the + configuration file. + + To enable the preset menu feature, you must rebuild GRUB specifying a +file to the configure script with the option `--enable-preset-menu'. +The file has the same semantics as normal configuration files (*note +Configuration::). + + Another point you should take care is that the diskless support +(*note Diskless::) diverts the preset menu. Diskless images embed a +preset menu to execute the command `bootp' (*note bootp::) +automatically, unless you specify your own preset menu to the configure +script. This means that you must put commands to initialize a network in +the preset menu yourself, because diskless images don't set it up +implicitly, when you use the preset menu explicitly. + + Therefore, a typical preset menu used with diskless support would be +like this: + + # Set up the serial terminal, first of all. + serial --unit=0 --speed=19200 + terminal --timeout=0 serial + + # Initialize the network. + dhcp + + +File: grub.info, Node: Security, Next: Images, Prev: Preset Menu, Up: Top + +9 Protecting your computer from cracking +**************************************** + +You may be interested in how to prevent ordinary users from doing +whatever they like, if you share your computer with other people. So +this chapter describes how to improve the security of GRUB. + + One thing which could be a security hole is that the user can do too +many things with GRUB, because GRUB allows one to modify its +configuration and run arbitrary commands at run-time. For example, the +user can even read `/etc/passwd' in the command-line interface by the +command `cat' (*note cat::). So it is necessary to disable all the +interactive operations. + + Thus, GRUB provides a "password" feature, so that only administrators +can start the interactive operations (i.e. editing menu entries and +entering the command-line interface). To use this feature, you need to +run the command `password' in your configuration file (*note +password::), like this: + + password --md5 PASSWORD + + If this is specified, GRUB disallows any interactive control, until +you press the key

and enter a correct password. The option `--md5' +tells GRUB that `PASSWORD' is in MD5 format. If it is omitted, GRUB +assumes the `PASSWORD' is in clear text. + + You can encrypt your password with the command `md5crypt' (*note +md5crypt::). For example, run the grub shell (*note Invoking the grub +shell::), and enter your password: + + grub> md5crypt + Password: ********** + Encrypted: $1$U$JK7xFegdxWH6VuppCUSIb. + + Then, cut and paste the encrypted password to your configuration +file. + + Also, you can specify an optional argument to `password'. See this +example: + + password PASSWORD /boot/grub/menu-admin.lst + + In this case, GRUB will load `/boot/grub/menu-admin.lst' as a +configuration file when you enter the valid password. + + Another thing which may be dangerous is that any user can choose any +menu entry. Usually, this wouldn't be problematic, but you might want to +permit only administrators to run some of your menu entries, such as an +entry for booting an insecure OS like DOS. + + GRUB provides the command `lock' (*note lock::). This command always +fails until you enter the valid password, so you can use it, like this: + + title Boot DOS + lock + rootnoverify (hd0,1) + makeactive + chainload +1 + + You should insert `lock' right after `title', because any user can +execute commands in an entry until GRUB encounters `lock'. + + You can also use the command `password' instead of `lock'. In this +case the boot process will ask for the password and stop if it was +entered incorrectly. Since the `password' takes its own PASSWORD +argument this is useful if you want different passwords for different +entries. + + +File: grub.info, Node: Images, Next: Filesystem, Prev: Security, Up: Top + +10 GRUB image files +******************* + +GRUB consists of several images: two essential stages, optional stages +called "Stage 1.5", one image for bootable CD-ROM, and two network boot +images. Here is a short overview of them. *Note Internals::, for more +details. + +`stage1' + This is an essential image used for booting up GRUB. Usually, this + is embedded in an MBR or the boot sector of a partition. Because a + PC boot sector is 512 bytes, the size of this image is exactly 512 + bytes. + + All `stage1' must do is to load Stage 2 or Stage 1.5 from a local + disk. Because of the size restriction, `stage1' encodes the + location of Stage 2 (or Stage 1.5) in a block list format, so it + never understand any filesystem structure. + +`stage2' + This is the core image of GRUB. It does everything but booting up + itself. Usually, this is put in a filesystem, but that is not + required. + +`e2fs_stage1_5' +`fat_stage1_5' +`ffs_stage1_5' +`jfs_stage1_5' +`minix_stage1_5' +`reiserfs_stage1_5' +`vstafs_stage1_5' +`xfs_stage1_5' + These are called "Stage 1.5", because they serve as a bridge + between `stage1' and `stage2', that is to say, Stage 1.5 is loaded + by Stage 1 and Stage 1.5 loads Stage 2. The difference between + `stage1' and `*_stage1_5' is that the former doesn't understand + any filesystem while the latter understands one filesystem (e.g. + `e2fs_stage1_5' understands ext2fs). So you can move the Stage 2 + image to another location safely, even after GRUB has been + installed. + + While Stage 2 cannot generally be embedded in a fixed area as the + size is so large, Stage 1.5 can be installed into the area right + after an MBR, or the boot loader area of a ReiserFS or a FFS. + +`stage2_eltorito' + This is a boot image for CD-ROMs using the "no emulation mode" in + El Torito specification. This is identical to Stage 2, except that + this boots up without Stage 1 and sets up a special drive `(cd)'. + +`nbgrub' + This is a network boot image for the Network Image Proposal used + by some network boot loaders, such as Etherboot. This is mostly + the same as Stage 2, but it also sets up a network and loads a + configuration file from the network. + +`pxegrub' + This is another network boot image for the Preboot Execution + Environment used by several Netboot ROMs. This is identical to + `nbgrub', except for the format. + + +File: grub.info, Node: Filesystem, Next: Interface, Prev: Images, Up: Top + +11 Filesystem syntax and semantics +********************************** + +GRUB uses a special syntax for specifying disk drives which can be +accessed by BIOS. Because of BIOS limitations, GRUB cannot distinguish +between IDE, ESDI, SCSI, or others. You must know yourself which BIOS +device is equivalent to which OS device. Normally, that will be clear if +you see the files in a device or use the command `find' (*note find::). + +* Menu: + +* Device syntax:: How to specify devices +* File name syntax:: How to specify files +* Block list syntax:: How to specify block lists + + +File: grub.info, Node: Device syntax, Next: File name syntax, Up: Filesystem + +11.1 How to specify devices +=========================== + +The device syntax is like this: + + `(DEVICE[,PART-NUM][,BSD-SUBPART-LETTER])' + + `[]' means the parameter is optional. DEVICE should be either `fd' +or `hd' followed by a digit, like `fd0'. But you can also set DEVICE +to a hexadecimal or a decimal number which is a BIOS drive number, so +the following are equivalent: + + (hd0) + (0x80) + (128) + + PART-NUM represents the partition number of DEVICE, starting from +zero for primary partitions and from four for extended partitions, and +BSD-SUBPART-LETTER represents the BSD disklabel subpartition, such as +`a' or `e'. + + A shortcut for specifying BSD subpartitions is +`(DEVICE,BSD-SUBPART-LETTER)', in this case, GRUB searches for the +first PC partition containing a BSD disklabel, then finds the +subpartition BSD-SUBPART-LETTER. Here is an example: + + (hd0,a) + + The syntax `(hd0)' represents using the entire disk (or the MBR when +installing GRUB), while the syntax `(hd0,0)' represents using the first +partition of the disk (or the boot sector of the partition when +installing GRUB). + + If you enabled the network support, the special drive, `(nd)', is +also available. Before using the network drive, you must initialize the +network. *Note Network::, for more information. + + If you boot GRUB from a CD-ROM, `(cd)' is available. *Note Making a +GRUB bootable CD-ROM::, for details. + + +File: grub.info, Node: File name syntax, Next: Block list syntax, Prev: Device syntax, Up: Filesystem + +11.2 How to specify files +========================= + +There are two ways to specify files, by "absolute file name" and by +"block list". + + An absolute file name resembles a Unix absolute file name, using `/' +for the directory separator (not `\' as in DOS). One example is +`(hd0,0)/boot/grub/menu.lst'. This means the file `/boot/grub/menu.lst' +in the first partition of the first hard disk. If you omit the device +name in an absolute file name, GRUB uses GRUB's "root device" +implicitly. So if you set the root device to, say, `(hd1,0)' by the +command `root' (*note root::), then `/boot/kernel' is the same as +`(hd1,0)/boot/kernel'. + + +File: grub.info, Node: Block list syntax, Prev: File name syntax, Up: Filesystem + +11.3 How to specify block lists +=============================== + +A block list is used for specifying a file that doesn't appear in the +filesystem, like a chainloader. The syntax is +`[OFFSET]+LENGTH[,[OFFSET]+LENGTH]...'. Here is an example: + + `0+100,200+1,300+300' + + This represents that GRUB should read blocks 0 through 99, block 200, +and blocks 300 through 599. If you omit an offset, then GRUB assumes +the offset is zero. + + Like the file name syntax (*note File name syntax::), if a blocklist +does not contain a device name, then GRUB uses GRUB's "root device". So +`(hd0,1)+1' is the same as `+1' when the root device is `(hd0,1)'. + + +File: grub.info, Node: Interface, Next: Commands, Prev: Filesystem, Up: Top + +12 GRUB's user interface +************************ + +GRUB has both a simple menu interface for choosing preset entries from a +configuration file, and a highly flexible command-line for performing +any desired combination of boot commands. + + GRUB looks for its configuration file as soon as it is loaded. If one +is found, then the full menu interface is activated using whatever +entries were found in the file. If you choose the "command-line" menu +option, or if the configuration file was not found, then GRUB drops to +the command-line interface. + +* Menu: + +* Command-line interface:: The flexible command-line interface +* Menu interface:: The simple menu interface +* Menu entry editor:: Editing a menu entry +* Hidden menu interface:: The hidden menu interface + + +File: grub.info, Node: Command-line interface, Next: Menu interface, Up: Interface + +12.1 The flexible command-line interface +======================================== + +The command-line interface provides a prompt and after it an editable +text area much like a command-line in Unix or DOS. Each command is +immediately executed after it is entered(1) (*note Command-line +interface-Footnote-1::). The commands (*note Command-line and menu +entry commands::) are a subset of those available in the configuration +file, used with exactly the same syntax. + + Cursor movement and editing of the text on the line can be done via a +subset of the functions available in the Bash shell: + + + + Move forward one character. + + + + Move back one character. + + + + Move to the start of the line. + + + + Move the the end of the line. + + + + Delete the character underneath the cursor. + + + + Delete the character to the left of the cursor. + + + Kill the text from the current cursor position to the end of the + line. + + + Kill backward from the cursor to the beginning of the line. + + + Yank the killed text back into the buffer at the cursor. + + + + Move up through the history list. + + + + Move down through the history list. + + When typing commands interactively, if the cursor is within or before +the first word in the command-line, pressing the key (or ) +will display a listing of the available commands, and if the cursor is +after the first word, the `' will provide a completion listing of +disks, partitions, and file names depending on the context. Note that +to obtain a list of drives, one must open a parenthesis, as `root ('. + + Note that you cannot use the completion functionality in the TFTP +filesystem. This is because TFTP doesn't support file name listing for +the security. + + +File: grub.info, Node: Command-line interface-Footnotes, Up: Command-line interface + + (1) However, this behavior will be changed in the future version, in +a user-invisible way. + + +File: grub.info, Node: Menu interface, Next: Menu entry editor, Prev: Command-line interface, Up: Interface + +12.2 The simple menu interface +============================== + +The menu interface is quite easy to use. Its commands are both +reasonably intuitive and described on screen. + + Basically, the menu interface provides a list of "boot entries" to +the user to choose from. Use the arrow keys to select the entry of +choice, then press to run it. An optional timeout is available +to boot the default entry (the first one if not set), which is aborted +by pressing any key. + + Commands are available to enter a bare command-line by pressing +(which operates exactly like the non-config-file version of GRUB, but +allows one to return to the menu if desired by pressing ) or to +edit any of the "boot entries" by pressing . + + If you protect the menu interface with a password (*note Security::), +all you can do is choose an entry by pressing , or press

to +enter the password. + + +File: grub.info, Node: Menu entry editor, Next: Hidden menu interface, Prev: Menu interface, Up: Interface + +12.3 Editing a menu entry +========================= + +The menu entry editor looks much like the main menu interface, but the +lines in the menu are individual commands in the selected entry instead +of entry names. + + If an is pressed in the editor, it aborts all the changes made +to the configuration entry and returns to the main menu interface. + + When a particular line is selected, the editor places the user in a +special version of the GRUB command-line to edit that line. When the +user hits , GRUB replaces the line in question in the boot entry +with the changes (unless it was aborted via , in which case the +changes are thrown away). + + If you want to add a new line to the menu entry, press if adding +a line after the current line or press if before the current line. + + To delete a line, hit the key . Although GRUB unfortunately does +not support "undo", you can do almost the same thing by just returning +to the main menu. + + +File: grub.info, Node: Hidden menu interface, Prev: Menu entry editor, Up: Interface + +12.4 The hidden menu interface +============================== + +When your terminal is dumb or you request GRUB to hide the menu +interface explicitly with the command `hiddenmenu' (*note +hiddenmenu::), GRUB doesn't show the menu interface (*note Menu +interface::) and automatically boots the default entry, unless +interrupted by pressing . + + When you interrupt the timeout and your terminal is dumb, GRUB falls +back to the command-line interface (*note Command-line interface::). + + +File: grub.info, Node: Commands, Next: Troubleshooting, Prev: Interface, Up: Top + +13 The list of available commands +********************************* + +In this chapter, we list all commands that are available in GRUB. + + Commands belong to different groups. A few can only be used in the +global section of the configuration file (or "menu"); most of them can +be entered on the command-line and can be used either anywhere in the +menu or specifically in the menu entries. + +* Menu: + +* Menu-specific commands:: +* General commands:: +* Command-line and menu entry commands:: + + +File: grub.info, Node: Menu-specific commands, Next: General commands, Up: Commands + +13.1 The list of commands for the menu only +=========================================== + +The semantics used in parsing the configuration file are the following: + + * The menu-specific commands have to be used before any others. + + * The files _must_ be in plain-text format. + + * `#' at the beginning of a line in a configuration file means it is + only a comment. + + * Options are separated by spaces. + + * All numbers can be either decimal or hexadecimal. A hexadecimal + number must be preceded by `0x', and is case-insensitive. + + * Extra options or text at the end of the line are ignored unless + otherwise specified. + + * Unrecognized commands are added to the current entry, except + before entries start, where they are ignored. + + These commands can only be used in the menu: + +* Menu: + +* default:: Set the default entry +* fallback:: Set the fallback entry +* hiddenmenu:: Hide the menu interface +* timeout:: Set the timeout +* title:: Start a menu entry + + +File: grub.info, Node: default, Next: fallback, Up: Menu-specific commands + +13.1.1 default +-------------- + + -- Command: default num + Set the default entry to the entry number NUM. Numbering starts + from 0, and the entry number 0 is the default if the command is not + used. + + You can specify `saved' instead of a number. In this case, the + default entry is the entry saved with the command `savedefault'. + *Note savedefault::, for more information. + + +File: grub.info, Node: fallback, Next: hiddenmenu, Prev: default, Up: Menu-specific commands + +13.1.2 fallback +--------------- + + -- Command: fallback num... + Go into unattended boot mode: if the default boot entry has any + errors, instead of waiting for the user to do something, + immediately start over using the NUM entry (same numbering as the + `default' command (*note default::)). This obviously won't help if + the machine was rebooted by a kernel that GRUB loaded. You can + specify multiple fallback entry numbers. + + +File: grub.info, Node: hiddenmenu, Next: timeout, Prev: fallback, Up: Menu-specific commands + +13.1.3 hiddenmenu +----------------- + + -- Command: hiddenmenu + Don't display the menu. If the command is used, no menu will be + displayed on the control terminal, and the default entry will be + booted after the timeout expired. The user can still request the + menu to be displayed by pressing before the timeout expires. + See also *Note Hidden menu interface::. + + +File: grub.info, Node: timeout, Next: title, Prev: hiddenmenu, Up: Menu-specific commands + +13.1.4 timeout +-------------- + + -- Command: timeout sec + Set a timeout, in SEC seconds, before automatically booting the + default entry (normally the first entry defined). + + +File: grub.info, Node: title, Prev: timeout, Up: Menu-specific commands + +13.1.5 title +------------ + + -- Command: title name ... + Start a new boot entry, and set its name to the contents of the + rest of the line, starting with the first non-space character. + + +File: grub.info, Node: General commands, Next: Command-line and menu entry commands, Prev: Menu-specific commands, Up: Commands + +13.2 The list of general commands +================================= + +Commands usable anywhere in the menu and in the command-line. + +* Menu: + +* bootp:: Initialize a network device via BOOTP +* color:: Color the menu interface +* device:: Specify a file as a drive +* dhcp:: Initialize a network device via DHCP +* hide:: Hide a partition +* ifconfig:: Configure a network device manually +* pager:: Change the state of the internal pager +* partnew:: Make a primary partition +* parttype:: Change the type of a partition +* password:: Set a password for the menu interface +* rarp:: Initialize a network device via RARP +* serial:: Set up a serial device +* setkey:: Configure the key map +* terminal:: Choose a terminal +* terminfo:: Define escape sequences for a terminal +* tftpserver:: Specify a TFTP server +* unhide:: Unhide a partition + + +File: grub.info, Node: bootp, Next: color, Up: General commands + +13.2.1 bootp +------------ + + -- Command: bootp [`--with-configfile'] + Initialize a network device via the "BOOTP" protocol. This command + is only available if GRUB is compiled with netboot support. See + also *Note Network::. + + If you specify `--with-configfile' to this command, GRUB will + fetch and load a configuration file specified by your BOOTP server + with the vendor tag `150'. + + +File: grub.info, Node: color, Next: device, Prev: bootp, Up: General commands + +13.2.2 color +------------ + + -- Command: color normal [highlight] + Change the menu colors. The color NORMAL is used for most lines in + the menu (*note Menu interface::), and the color HIGHLIGHT is used + to highlight the line where the cursor points. If you omit + HIGHLIGHT, then the inverted color of NORMAL is used for the + highlighted line. The format of a color is + `FOREGROUND/BACKGROUND'. FOREGROUND and BACKGROUND are symbolic + color names. A symbolic color name must be one of these: + + * black + + * blue + + * green + + * cyan + + * red + + * magenta + + * brown + + * light-gray + + *These below can be specified only for the foreground.* + + * dark-gray + + * light-blue + + * light-green + + * light-cyan + + * light-red + + * light-magenta + + * yellow + + * white + + But only the first eight names can be used for BACKGROUND. You can + prefix `blink-' to FOREGROUND if you want a blinking foreground + color. + + This command can be used in the configuration file and on the + command line, so you may write something like this in your + configuration file: + + # Set default colors. + color light-gray/blue black/light-gray + + # Change the colors. + title OS-BS like + color magenta/blue black/magenta + + +File: grub.info, Node: device, Next: dhcp, Prev: color, Up: General commands + +13.2.3 device +------------- + + -- Command: device drive file + In the grub shell, specify the file FILE as the actual drive for a + BIOS drive DRIVE. You can use this command to create a disk image, + and/or to fix the drives guessed by GRUB when GRUB fails to + determine them correctly, like this: + + grub> device (fd0) /floppy-image + grub> device (hd0) /dev/sd0 + + This command can be used only in the grub shell (*note Invoking + the grub shell::). + + +File: grub.info, Node: dhcp, Next: hide, Prev: device, Up: General commands + +13.2.4 dhcp +----------- + + -- Command: dhcp [-with-configfile] + Initialize a network device via the "DHCP" protocol. Currently, + this command is just an alias for `bootp', since the two protocols + are very similar. This command is only available if GRUB is + compiled with netboot support. See also *Note Network::. + + If you specify `--with-configfile' to this command, GRUB will + fetch and load a configuration file specified by your DHCP server + with the vendor tag `150'. + + +File: grub.info, Node: hide, Next: ifconfig, Prev: dhcp, Up: General commands + +13.2.5 hide +----------- + + -- Command: hide partition + Hide the partition PARTITION by setting the "hidden" bit in its + partition type code. This is useful only when booting DOS or + Windows and multiple primary FAT partitions exist in one disk. See + also *Note DOS/Windows::. + + +File: grub.info, Node: ifconfig, Next: pager, Prev: hide, Up: General commands + +13.2.6 ifconfig +--------------- + + -- Command: ifconfig [`--server=server'] [`--gateway=gateway'] + [`--mask=mask'] [`--address=address'] + Configure the IP address, the netmask, the gateway, and the server + address of a network device manually. The values must be in dotted + decimal format, like `192.168.11.178'. The order of the options is + not important. This command shows current network configuration, + if no option is specified. See also *Note Network::. + + +File: grub.info, Node: pager, Next: partnew, Prev: ifconfig, Up: General commands + +13.2.7 pager +------------ + + -- Command: pager [flag] + Toggle or set the state of the internal pager. If FLAG is `on', + the internal pager is enabled. If FLAG is `off', it is disabled. + If no argument is given, the state is toggled. + + +File: grub.info, Node: partnew, Next: parttype, Prev: pager, Up: General commands + +13.2.8 partnew +-------------- + + -- Command: partnew part type from len + Create a new primary partition. PART is a partition specification + in GRUB syntax (*note Naming convention::); TYPE is the partition + type and must be a number in the range `0-0xff'; FROM is the + starting address and LEN is the length, both in sector units. + + +File: grub.info, Node: parttype, Next: password, Prev: partnew, Up: General commands + +13.2.9 parttype +--------------- + + -- Command: parttype part type + Change the type of an existing partition. PART is a partition + specification in GRUB syntax (*note Naming convention::); TYPE is + the new partition type and must be a number in the range 0-0xff. + + +File: grub.info, Node: password, Next: rarp, Prev: parttype, Up: General commands + +13.2.10 password +---------------- + + -- Command: password [`--md5'] passwd [new-config-file] + If used in the first section of a menu file, disable all + interactive editing control (menu entry editor and command-line) + and entries protected by the command `lock'. If the password + PASSWD is entered, it loads the NEW-CONFIG-FILE as a new config + file and restarts the GRUB Stage 2, if NEW-CONFIG-FILE is + specified. Otherwise, GRUB will just unlock the privileged + instructions. You can also use this command in the script + section, in which case it will ask for the password, before + continuing. The option `--md5' tells GRUB that PASSWD is + encrypted with `md5crypt' (*note md5crypt::). + + +File: grub.info, Node: rarp, Next: serial, Prev: password, Up: General commands + +13.2.11 rarp +------------ + + -- Command: rarp + Initialize a network device via the "RARP" protocol. This command + is only available if GRUB is compiled with netboot support. See + also *Note Network::. + + +File: grub.info, Node: serial, Next: setkey, Prev: rarp, Up: General commands + +13.2.12 serial +-------------- + + -- Command: serial [`--unit=unit'] [`--port=port'] [`--speed=speed'] + [`--word=word'] [`--parity=parity'] [`--stop=stop'] + [`--device=dev'] + Initialize a serial device. UNIT is a number in the range 0-3 + specifying which serial port to use; default is 0, which + corresponds to the port often called COM1. PORT is the I/O port + where the UART is to be found; if specified it takes precedence + over UNIT. SPEED is the transmission speed; default is 9600. WORD + and STOP are the number of data bits and stop bits. Data bits must + be in the range 5-8 and stop bits must be 1 or 2. Default is 8 data + bits and one stop bit. PARITY is one of `no', `odd', `even' and + defaults to `no'. The option `--device' can only be used in the + grub shell and is used to specify the tty device to be used in the + host operating system (*note Invoking the grub shell::). + + The serial port is not used as a communication channel unless the + `terminal' command is used (*note terminal::). + + This command is only available if GRUB is compiled with serial + support. See also *Note Serial terminal::. + + +File: grub.info, Node: setkey, Next: terminal, Prev: serial, Up: General commands + +13.2.13 setkey +-------------- + + -- Command: setkey [to_key from_key] + Change the keyboard map. The key FROM_KEY is mapped to the key + TO_KEY. If no argument is specified, reset key mappings. Note that + this command _does not_ exchange the keys. If you want to exchange + the keys, run this command again with the arguments exchanged, + like this: + + grub> setkey capslock control + grub> setkey control capslock + + A key must be an alphabet letter, a digit, or one of these symbols: + `escape', `exclam', `at', `numbersign', `dollar', `percent', + `caret', `ampersand', `asterisk', `parenleft', `parenright', + `minus', `underscore', `equal', `plus', `backspace', `tab', + `bracketleft', `braceleft', `bracketright', `braceright', `enter', + `control', `semicolon', `colon', `quote', `doublequote', + `backquote', `tilde', `shift', `backslash', `bar', `comma', + `less', `period', `greater', `slash', `question', `alt', `space', + `capslock', `FX' (`X' is a digit), and `delete'. This table + describes to which character each of the symbols corresponds: + + `exclam' + `!' + + `at' + `@' + + `numbersign' + `#' + + `dollar' + `$' + + `percent' + `%' + + `caret' + `^' + + `ampersand' + `&' + + `asterisk' + `*' + + `parenleft' + `(' + + `parenright' + `)' + + `minus' + `-' + + `underscore' + `_' + + `equal' + `=' + + `plus' + `+' + + `bracketleft' + `[' + + `braceleft' + `{' + + `bracketright' + `]' + + `braceright' + `}' + + `semicolon' + `;' + + `colon' + `:' + + `quote' + `'' + + `doublequote' + `"' + + `backquote' + ``' + + `tilde' + `~' + + `backslash' + `\' + + `bar' + `|' + + `comma' + `,' + + `less' + `<' + + `period' + `.' + + `greater' + `>' + + `slash' + `/' + + `question' + `?' + + `space' + ` ' + + +File: grub.info, Node: terminal, Next: terminfo, Prev: setkey, Up: General commands + +13.2.14 terminal +---------------- + + -- Command: terminal [`--dumb'] [`--no-echo'] [`--no-edit'] + [`--timeout=secs'] [`--lines=lines'] [`--silent'] [`console'] + [`serial'] [`hercules'] + Select a terminal for user interaction. The terminal is assumed to + be VT100-compatible unless `--dumb' is specified. If both + `console' and `serial' are specified, then GRUB will use the one + where a key is entered first or the first when the timeout + expires. If neither are specified, the current setting is + reported. This command is only available if GRUB is compiled with + serial support. See also *Note Serial terminal::. + + This may not make sense for most users, but GRUB supports Hercules + console as well. Hercules console is usable like the ordinary + console, and the usage is quite similar to that for serial + terminals: specify `hercules' as the argument. + + The option `--lines' defines the number of lines in your terminal, + and it is used for the internal pager function. If you don't + specify this option, the number is assumed as 24. + + The option `--silent' suppresses the message to prompt you to hit + any key. This might be useful if your system has no terminal + device. + + The option `--no-echo' has GRUB not to echo back input characters. + This implies the option `--no-edit'. + + The option `--no-edit' disables the BASH-like editing feature. + + +File: grub.info, Node: terminfo, Next: tftpserver, Prev: terminal, Up: General commands + +13.2.15 terminfo +---------------- + + -- Command: terminfo `--name=name' `--cursor-address=seq' + [`--clear-screen=seq'] [`--enter-standout-mode=seq'] + [`--exit-standout-mode=seq'] + Define the capabilities of your terminal. Use this command to + define escape sequences, if it is not vt100-compatible. You may + use `\e' for and `^X' for a control character. + + You can use the utility `grub-terminfo' to generate appropriate + arguments to this command. *Note Invoking grub-terminfo::. + + If no option is specified, the current settings are printed. + + +File: grub.info, Node: tftpserver, Next: unhide, Prev: terminfo, Up: General commands + +13.2.16 tftpserver +------------------ + + -- Command: tftpserver ipaddr + *Caution:* This command exists only for backward compatibility. + Use `ifconfig' (*note ifconfig::) instead. + + Override a TFTP server address returned by a BOOTP/DHCP/RARP + server. The argument IPADDR must be in dotted decimal format, like + `192.168.0.15'. This command is only available if GRUB is compiled + with netboot support. See also *Note Network::. + + +File: grub.info, Node: unhide, Prev: tftpserver, Up: General commands + +13.2.17 unhide +-------------- + + -- Command: unhide partition + Unhide the partition PARTITION by clearing the "hidden" bit in its + partition type code. This is useful only when booting DOS or + Windows and multiple primary partitions exist on one disk. See also + *Note DOS/Windows::. + + +File: grub.info, Node: Command-line and menu entry commands, Prev: General commands, Up: Commands + +13.3 The list of command-line and menu entry commands +===================================================== + +These commands are usable in the command-line and in menu entries. If +you forget a command, you can run the command `help' (*note help::). + +* Menu: + +* blocklist:: Get the block list notation of a file +* boot:: Start up your operating system +* cat:: Show the contents of a file +* chainloader:: Chain-load another boot loader +* cmp:: Compare two files +* configfile:: Load a configuration file +* debug:: Toggle the debug flag +* displayapm:: Display APM information +* displaymem:: Display memory configuration +* embed:: Embed Stage 1.5 +* find:: Find a file +* fstest:: Test a filesystem +* geometry:: Manipulate the geometry of a drive +* halt:: Shut down your computer +* help:: Show help messages +* impsprobe:: Probe SMP +* initrd:: Load an initrd +* install:: Install GRUB +* ioprobe:: Probe I/O ports used for a drive +* kernel:: Load a kernel +* lock:: Lock a menu entry +* makeactive:: Make a partition active +* map:: Map a drive to another +* md5crypt:: Encrypt a password in MD5 format +* module:: Load a module +* modulenounzip:: Load a module without decompression +* pause:: Wait for a key press +* quit:: Exit from the grub shell +* reboot:: Reboot your computer +* read:: Read data from memory +* root:: Set GRUB's root device +* rootnoverify:: Set GRUB's root device without mounting +* savedefault:: Save current entry as the default entry +* setup:: Set up GRUB's installation automatically +* testload:: Load a file for testing a filesystem +* testvbe:: Test VESA BIOS EXTENSION +* uppermem:: Set the upper memory size +* vbeprobe:: Probe VESA BIOS EXTENSION + + +File: grub.info, Node: blocklist, Next: boot, Up: Command-line and menu entry commands + +13.3.1 blocklist +---------------- + + -- Command: blocklist file + Print the block list notation of the file FILE. *Note Block list + syntax::. + + +File: grub.info, Node: boot, Next: cat, Prev: blocklist, Up: Command-line and menu entry commands + +13.3.2 boot +----------- + + -- Command: boot + Boot the OS or chain-loader which has been loaded. Only necessary + if running the fully interactive command-line (it is implicit at + the end of a menu entry). + + +File: grub.info, Node: cat, Next: chainloader, Prev: boot, Up: Command-line and menu entry commands + +13.3.3 cat +---------- + + -- Command: cat file + Display the contents of the file FILE. This command may be useful + to remind you of your OS's root partition: + + grub> cat /etc/fstab + + +File: grub.info, Node: chainloader, Next: cmp, Prev: cat, Up: Command-line and menu entry commands + +13.3.4 chainloader +------------------ + + -- Command: chainloader [`--force'] file + Load FILE as a chain-loader. Like any other file loaded by the + filesystem code, it can use the blocklist notation to grab the + first sector of the current partition with `+1'. If you specify the + option `--force', then load FILE forcibly, whether it has a + correct signature or not. This is required when you want to load a + defective boot loader, such as SCO UnixWare 7.1 (*note SCO + UnixWare::). + + +File: grub.info, Node: cmp, Next: configfile, Prev: chainloader, Up: Command-line and menu entry commands + +13.3.5 cmp +---------- + + -- Command: cmp file1 file2 + Compare the file FILE1 with the file FILE2. If they differ in + size, print the sizes like this: + + Differ in size: 0x1234 [foo], 0x4321 [bar] + + If the sizes are equal but the bytes at an offset differ, then + print the bytes like this: + + Differ at the offset 777: 0xbe [foo], 0xef [bar] + + If they are completely identical, nothing will be printed. + + +File: grub.info, Node: configfile, Next: debug, Prev: cmp, Up: Command-line and menu entry commands + +13.3.6 configfile +----------------- + + -- Command: configfile file + Load FILE as a configuration file. + + +File: grub.info, Node: debug, Next: displayapm, Prev: configfile, Up: Command-line and menu entry commands + +13.3.7 debug +------------ + + -- Command: debug + Toggle debug mode (by default it is off). When debug mode is on, + some extra messages are printed to show disk activity. This global + debug flag is mainly useful for GRUB developers when testing new + code. + + +File: grub.info, Node: displayapm, Next: displaymem, Prev: debug, Up: Command-line and menu entry commands + +13.3.8 displayapm +----------------- + + -- Command: displayapm + Display APM BIOS information. + + +File: grub.info, Node: displaymem, Next: embed, Prev: displayapm, Up: Command-line and menu entry commands + +13.3.9 displaymem +----------------- + + -- Command: displaymem + Display what GRUB thinks the system address space map of the + machine is, including all regions of physical RAM installed. GRUB's + "upper/lower memory" display uses the standard BIOS interface for + the available memory in the first megabyte, or "lower memory", and + a synthesized number from various BIOS interfaces of the memory + starting at 1MB and going up to the first chipset hole for "upper + memory" (the standard PC "upper memory" interface is limited to + reporting a maximum of 64MB). + + +File: grub.info, Node: embed, Next: find, Prev: displaymem, Up: Command-line and menu entry commands + +13.3.10 embed +------------- + + -- Command: embed stage1_5 device + Embed the Stage 1.5 STAGE1_5 in the sectors after the MBR if + DEVICE is a drive, or in the "boot loader" area if DEVICE is a FFS + partition or a ReiserFS partition.(1) (*note embed-Footnote-1::) + Print the number of sectors which STAGE1_5 occupies, if successful. + + Usually, you don't need to run this command directly. *Note + setup::. + + +File: grub.info, Node: embed-Footnotes, Up: embed + + (1) The latter feature has not been implemented yet. + + +File: grub.info, Node: find, Next: fstest, Prev: embed, Up: Command-line and menu entry commands + +13.3.11 find +------------ + + -- Command: find filename + Search for the file name FILENAME in all mountable partitions and + print the list of the devices which contain the file. The file + name FILENAME should be an absolute file name like + `/boot/grub/stage1'. + + +File: grub.info, Node: fstest, Next: geometry, Prev: find, Up: Command-line and menu entry commands + +13.3.12 fstest +-------------- + + -- Command: fstest + Toggle filesystem test mode. Filesystem test mode, when turned + on, prints out data corresponding to all the device reads and what + values are being sent to the low-level routines. The format is + `' for + high-level reads inside a partition, and `[DISK-OFFSET-SECTOR]' + for low-level sector requests from the disk. Filesystem test mode + is turned off by any use of the `install' (*note install::) or + `testload' (*note testload::) commands. + + +File: grub.info, Node: geometry, Next: halt, Prev: fstest, Up: Command-line and menu entry commands + +13.3.13 geometry +---------------- + + -- Command: geometry drive [cylinder head sector [total_sector]] + Print the information for the drive DRIVE. In the grub shell, you + can set the geometry of the drive arbitrarily. The number of + cylinders, the number of heads, the number of sectors and the + number of total sectors are set to CYLINDER, HEAD, SECTOR and + TOTAL_SECTOR, respectively. If you omit TOTAL_SECTOR, then it will + be calculated based on the C/H/S values automatically. + + +File: grub.info, Node: halt, Next: help, Prev: geometry, Up: Command-line and menu entry commands + +13.3.14 halt +------------ + + -- Command: halt `--no-apm' + The command halts the computer. If the `--no-apm' option is + specified, no APM BIOS call is performed. Otherwise, the computer + is shut down using APM. + + +File: grub.info, Node: help, Next: impsprobe, Prev: halt, Up: Command-line and menu entry commands + +13.3.15 help +------------ + + -- Command: help `--all' [pattern ...] + Display helpful information about builtin commands. If you do not + specify PATTERN, this command shows short descriptions of most of + available commands. If you specify the option `--all' to this + command, short descriptions of rarely used commands (such as *Note + testload::) are displayed as well. + + If you specify any PATTERNS, it displays longer information about + each of the commands which match those PATTERNS. + + +File: grub.info, Node: impsprobe, Next: initrd, Prev: help, Up: Command-line and menu entry commands + +13.3.16 impsprobe +----------------- + + -- Command: impsprobe + Probe the Intel Multiprocessor Specification 1.1 or 1.4 + configuration table and boot the various CPUs which are found into + a tight loop. This command can be used only in the Stage 2, but + not in the grub shell. + + +File: grub.info, Node: initrd, Next: install, Prev: impsprobe, Up: Command-line and menu entry commands + +13.3.17 initrd +-------------- + + -- Command: initrd file ... + Load an initial ramdisk for a Linux format boot image and set the + appropriate parameters in the Linux setup area in memory. See also + *Note GNU/Linux::. + + +File: grub.info, Node: install, Next: ioprobe, Prev: initrd, Up: Command-line and menu entry commands + +13.3.18 install +--------------- + + -- Command: install [`--force-lba'] [`--stage2=os_stage2_file'] + stage1_file [`d'] dest_dev stage2_file [addr] [`p'] + [config_file] [real_config_file] + This command is fairly complex, and you should not use this command + unless you are familiar with GRUB. Use `setup' (*note setup::) + instead. + + In short, it will perform a full install presuming the Stage 2 or + Stage 1.5(1) (*note install-Footnote-1::) is in its final install + location. + + In slightly more detail, it will load STAGE1_FILE, validate that + it is a GRUB Stage 1 of the right version number, install in it a + blocklist for loading STAGE2_FILE as a Stage 2. If the option `d' + is present, the Stage 1 will always look for the actual disk + STAGE2_FILE was installed on, rather than using the booting drive. + The Stage 2 will be loaded at address ADDR, which must be `0x8000' + for a true Stage 2, and `0x2000' for a Stage 1.5. If ADDR is not + present, GRUB will determine the address automatically. It then + writes the completed Stage 1 to the first block of the device + DEST_DEV. If the options `p' or CONFIG_FILE are present, then it + reads the first block of stage2, modifies it with the values of + the partition STAGE2_FILE was found on (for `p') or places the + string CONFIG_FILE into the area telling the stage2 where to look + for a configuration file at boot time. Likewise, if + REAL_CONFIG_FILE is present and STAGE2_FILE is a Stage 1.5, then + the Stage 2 CONFIG_FILE is patched with the configuration file + name REAL_CONFIG_FILE. This command preserves the DOS BPB (and for + hard disks, the partition table) of the sector the Stage 1 is to + be installed into. + + *Caution:* Several buggy BIOSes don't pass a booting drive + properly when booting from a hard disk drive. Therefore, you will + unfortunately have to specify the option `d', whether your Stage2 + resides at the booting drive or not, if you have such a BIOS. We + know these are defective in this way: + + + Fujitsu LifeBook 400 BIOS version 31J0103A + + + HP Vectra XU 6/200 BIOS version GG.06.11 + + *Caution2:* A number of BIOSes don't return a correct LBA support + bitmap even if they do have the support. So GRUB provides a + solution to ignore the wrong bitmap, that is, the option + `--force-lba'. Don't use this option if you know that your BIOS + doesn't have LBA support. + + *Caution3:* You must specify the option `--stage2' in the grub + shell, if you cannot unmount the filesystem where your stage2 file + resides. The argument should be the file name in your operating + system. + + +File: grub.info, Node: install-Footnotes, Up: install + + (1) They're loaded the same way, so we will refer to the Stage 1.5 +as a Stage 2 from now on. + + +File: grub.info, Node: ioprobe, Next: kernel, Prev: install, Up: Command-line and menu entry commands + +13.3.19 ioprobe +--------------- + + -- Command: ioprobe drive + Probe I/O ports used for the drive DRIVE. This command will list + the I/O ports on the screen. For technical information, *Note + Internals::. + + +File: grub.info, Node: kernel, Next: lock, Prev: ioprobe, Up: Command-line and menu entry commands + +13.3.20 kernel +-------------- + + -- Command: kernel [`--type=type'] [`--no-mem-option'] file ... + Attempt to load the primary boot image (Multiboot a.out or ELF, + Linux zImage or bzImage, FreeBSD a.out, NetBSD a.out, etc.) from + FILE. The rest of the line is passed verbatim as the "kernel + command-line". Any modules must be reloaded after using this + command. + + This command also accepts the option `--type' so that you can + specify the kernel type of FILE explicitly. The argument TYPE must + be one of these: `netbsd', `freebsd', `openbsd', `linux', + `biglinux', and `multiboot'. However, you need to specify it only + if you want to load a NetBSD ELF kernel, because GRUB can + automatically determine a kernel type in the other cases, quite + safely. + + The option `--no-mem-option' is effective only for Linux. If the + option is specified, GRUB doesn't pass the option `mem=' to the + kernel. This option is implied for Linux kernels 2.4.18 and newer. + + +File: grub.info, Node: lock, Next: makeactive, Prev: kernel, Up: Command-line and menu entry commands + +13.3.21 lock +------------ + + -- Command: lock + Prevent normal users from executing arbitrary menu entries. You + must use the command `password' if you really want this command to + be useful (*note password::). + + This command is used in a menu, as shown in this example: + + title This entry is too dangerous to be executed by normal users + lock + root (hd0,a) + kernel /no-security-os + + See also *Note Security::. + + +File: grub.info, Node: makeactive, Next: map, Prev: lock, Up: Command-line and menu entry commands + +13.3.22 makeactive +------------------ + + -- Command: makeactive + Set the active partition on the root disk to GRUB's root device. + This command is limited to _primary_ PC partitions on a hard disk. + + +File: grub.info, Node: map, Next: md5crypt, Prev: makeactive, Up: Command-line and menu entry commands + +13.3.23 map +----------- + + -- Command: map to_drive from_drive + Map the drive FROM_DRIVE to the drive TO_DRIVE. This is necessary + when you chain-load some operating systems, such as DOS, if such + an OS resides at a non-first drive. Here is an example: + + grub> map (hd0) (hd1) + grub> map (hd1) (hd0) + + The example exchanges the order between the first hard disk and the + second hard disk. See also *Note DOS/Windows::. + + +File: grub.info, Node: md5crypt, Next: module, Prev: map, Up: Command-line and menu entry commands + +13.3.24 md5crypt +---------------- + + -- Command: md5crypt + Prompt to enter a password, and encrypt it in MD5 format. The + encrypted password can be used with the command `password' (*note + password::). See also *Note Security::. + + +File: grub.info, Node: module, Next: modulenounzip, Prev: md5crypt, Up: Command-line and menu entry commands + +13.3.25 module +-------------- + + -- Command: module file ... + Load a boot module FILE for a Multiboot format boot image (no + interpretation of the file contents are made, so the user of this + command must know what the kernel in question expects). The rest + of the line is passed as the "module command-line", like the + `kernel' command. You must load a Multiboot kernel image before + loading any module. See also *Note modulenounzip::. + + +File: grub.info, Node: modulenounzip, Next: pause, Prev: module, Up: Command-line and menu entry commands + +13.3.26 modulenounzip +--------------------- + + -- Command: modulenounzip file ... + The same as `module' (*note module::), except that automatic + decompression is disabled. + + +File: grub.info, Node: pause, Next: quit, Prev: modulenounzip, Up: Command-line and menu entry commands + +13.3.27 pause +------------- + + -- Command: pause message ... + Print the MESSAGE, then wait until a key is pressed. Note that + placing <^G> (ASCII code 7) in the message will cause the speaker + to emit the standard beep sound, which is useful when prompting + the user to change floppies. + + +File: grub.info, Node: quit, Next: reboot, Prev: pause, Up: Command-line and menu entry commands + +13.3.28 quit +------------ + + -- Command: quit + Exit from the grub shell `grub' (*note Invoking the grub shell::). + This command can be used only in the grub shell. + + +File: grub.info, Node: reboot, Next: read, Prev: quit, Up: Command-line and menu entry commands + +13.3.29 reboot +-------------- + + -- Command: reboot + Reboot the computer. + + +File: grub.info, Node: read, Next: root, Prev: reboot, Up: Command-line and menu entry commands + +13.3.30 read +------------ + + -- Command: read addr + Read a 32-bit value from memory at address ADDR and display it in + hex format. + + +File: grub.info, Node: root, Next: rootnoverify, Prev: read, Up: Command-line and menu entry commands + +13.3.31 root +------------ + + -- Command: root device [hdbias] + Set the current "root device" to the device DEVICE, then attempt + to mount it to get the partition size (for passing the partition + descriptor in `ES:ESI', used by some chain-loaded boot loaders), + the BSD drive-type (for booting BSD kernels using their native + boot format), and correctly determine the PC partition where a BSD + sub-partition is located. The optional HDBIAS parameter is a + number to tell a BSD kernel how many BIOS drive numbers are on + controllers before the current one. For example, if there is an + IDE disk and a SCSI disk, and your FreeBSD root partition is on + the SCSI disk, then use a `1' for HDBIAS. + + See also *Note rootnoverify::. + + +File: grub.info, Node: rootnoverify, Next: savedefault, Prev: root, Up: Command-line and menu entry commands + +13.3.32 rootnoverify +-------------------- + + -- Command: rootnoverify device [hdbias] + Similar to `root' (*note root::), but don't attempt to mount the + partition. This is useful for when an OS is outside of the area of + the disk that GRUB can read, but setting the correct root device + is still desired. Note that the items mentioned in `root' above + which derived from attempting the mount will _not_ work correctly. + + +File: grub.info, Node: savedefault, Next: setup, Prev: rootnoverify, Up: Command-line and menu entry commands + +13.3.33 savedefault +------------------- + + -- Command: savedefault num + Save the current menu entry or NUM if specified as a default + entry. Here is an example: + + default saved + timeout 10 + + title GNU/Linux + root (hd0,0) + kernel /boot/vmlinuz root=/dev/sda1 vga=ext + initrd /boot/initrd + savedefault + + title FreeBSD + root (hd0,a) + kernel /boot/loader + savedefault + + With this configuration, GRUB will choose the entry booted + previously as the default entry. + + You can specify `fallback' instead of a number. Then, next + fallback entry is saved. Next fallback entry is chosen from + fallback entries. Normally, this will be the first entry in + fallback ones. + + See also *Note default:: and *Note Invoking grub-set-default::. + + +File: grub.info, Node: setup, Next: testload, Prev: savedefault, Up: Command-line and menu entry commands + +13.3.34 setup +------------- + + -- Command: setup [`--force-lba'] [`--stage2=os_stage2_file'] + [`--prefix=dir'] install_device [image_device] + Set up the installation of GRUB automatically. This command uses + the more flexible command `install' (*note install::) in the + backend and installs GRUB into the device INSTALL_DEVICE. If + IMAGE_DEVICE is specified, then find the GRUB images (*note + Images::) in the device IMAGE_DEVICE, otherwise use the current + "root device", which can be set by the command `root'. If + INSTALL_DEVICE is a hard disk, then embed a Stage 1.5 in the disk + if possible. + + The option `--prefix' specifies the directory under which GRUB + images are put. If it is not specified, GRUB automatically + searches them in `/boot/grub' and `/grub'. + + The options `--force-lba' and `--stage2' are just passed to + `install' if specified. *Note install::, for more information. + + +File: grub.info, Node: testload, Next: testvbe, Prev: setup, Up: Command-line and menu entry commands + +13.3.35 testload +---------------- + + -- Command: testload file + Read the entire contents of FILE in several different ways and + compare them, to test the filesystem code. The output is somewhat + cryptic, but if no errors are reported and the final `i=X, + filepos=Y' reading has X and Y equal, then it is definitely + consistent, and very likely works correctly subject to a + consistent offset error. If this test succeeds, then a good next + step is to try loading a kernel. + + +File: grub.info, Node: testvbe, Next: uppermem, Prev: testload, Up: Command-line and menu entry commands + +13.3.36 testvbe +--------------- + + -- Command: testvbe mode + Test the VESA BIOS EXTENSION mode MODE. This command will switch + your video card to the graphics mode, and show an endless + animation. Hit any key to return. See also *Note vbeprobe::. + + +File: grub.info, Node: uppermem, Next: vbeprobe, Prev: testvbe, Up: Command-line and menu entry commands + +13.3.37 uppermem +---------------- + + -- Command: uppermem kbytes + Force GRUB to assume that only KBYTES kilobytes of upper memory + are installed. Any system address range maps are discarded. + + *Caution:* This should be used with great caution, and should only + be necessary on some old machines. GRUB's BIOS probe can pick up + all RAM on all new machines the author has ever heard of. It can + also be used for debugging purposes to lie to an OS. + + +File: grub.info, Node: vbeprobe, Prev: uppermem, Up: Command-line and menu entry commands + +13.3.38 vbeprobe +---------------- + + -- Command: vbeprobe [mode] + Probe VESA BIOS EXTENSION information. If the mode MODE is + specified, show only the information about MODE. Otherwise, this + command lists up available VBE modes on the screen. See also *Note + testvbe::. + + +File: grub.info, Node: Troubleshooting, Next: Invoking the grub shell, Prev: Commands, Up: Top + +14 Error messages reported by GRUB +********************************** + +This chapter describes error messages reported by GRUB when you +encounter trouble. *Note Invoking the grub shell::, if your problem is +specific to the grub shell. + +* Menu: + +* Stage1 errors:: Errors reported by the Stage 1 +* Stage1.5 errors:: Errors reported by the Stage 1.5 +* Stage2 errors:: Errors reported by the Stage 2 + + +File: grub.info, Node: Stage1 errors, Next: Stage1.5 errors, Up: Troubleshooting + +14.1 Errors reported by the Stage 1 +=================================== + +The general way that the Stage 1 handles errors is to print an error +string and then halt. Pressing `--' will reboot. + + The following is a comprehensive list of error messages for the +Stage 1: + +Hard Disk Error + The stage2 or stage1.5 is being read from a hard disk, and the + attempt to determine the size and geometry of the hard disk failed. + +Floppy Error + The stage2 or stage1.5 is being read from a floppy disk, and the + attempt to determine the size and geometry of the floppy disk + failed. It's listed as a separate error since the probe sequence + is different than for hard disks. + +Read Error + A disk read error happened while trying to read the stage2 or + stage1.5. + +Geom Error + The location of the stage2 or stage1.5 is not in the portion of + the disk supported directly by the BIOS read calls. This could + occur because the BIOS translated geometry has been changed by the + user or the disk is moved to another machine or controller after + installation, or GRUB was not installed using itself (if it was, + the Stage 2 version of this error would have been seen during that + process and it would not have completed the install). + + +File: grub.info, Node: Stage1.5 errors, Next: Stage2 errors, Prev: Stage1 errors, Up: Troubleshooting + +14.2 Errors reported by the Stage 1.5 +===================================== + +The general way that the Stage 1.5 handles errors is to print an error +number in the form `Error NUM' and then halt. Pressing +`--' will reboot. + + The error numbers correspond to the errors reported by Stage 2. +*Note Stage2 errors::. + + +File: grub.info, Node: Stage2 errors, Prev: Stage1.5 errors, Up: Troubleshooting + +14.3 Errors reported by the Stage 2 +=================================== + +The general way that the Stage 2 handles errors is to abort the +operation in question, print an error string, then (if possible) either +continue based on the fact that an error occurred or wait for the user +to deal with the error. + + The following is a comprehensive list of error messages for the +Stage 2 (error numbers for the Stage 1.5 are listed before the colon in +each description): + +1 : Filename must be either an absolute filename or blocklist + This error is returned if a file name is requested which doesn't + fit the syntax/rules listed in the *Note Filesystem::. + +2 : Bad file or directory type + This error is returned if a file requested is not a regular file, + but something like a symbolic link, directory, or FIFO. + +3 : Bad or corrupt data while decompressing file + This error is returned if the run-length decompression code gets an + internal error. This is usually from a corrupt file. + +4 : Bad or incompatible header in compressed file + This error is returned if the file header for a supposedly + compressed file is bad. + +5 : Partition table invalid or corrupt + This error is returned if the sanity checks on the integrity of the + partition table fail. This is a bad sign. + +6 : Mismatched or corrupt version of stage1/stage2 + This error is returned if the install command points to + incompatible or corrupt versions of the stage1 or stage2. It can't + detect corruption in general, but this is a sanity check on the + version numbers, which should be correct. + +7 : Loading below 1MB is not supported + This error is returned if the lowest address in a kernel is below + the 1MB boundary. The Linux zImage format is a special case and + can be handled since it has a fixed loading address and maximum + size. + +8 : Kernel must be loaded before booting + This error is returned if GRUB is told to execute the boot sequence + without having a kernel to start. + +9 : Unknown boot failure + This error is returned if the boot attempt did not succeed for + reasons which are unknown. + +10 : Unsupported Multiboot features requested + This error is returned when the Multiboot features word in the + Multiboot header requires a feature that is not recognized. The + point of this is that the kernel requires special handling which + GRUB is probably unable to provide. + +11 : Unrecognized device string + This error is returned if a device string was expected, and the + string encountered didn't fit the syntax/rules listed in the *Note + Filesystem::. + +12 : Invalid device requested + This error is returned if a device string is recognizable but does + not fall under the other device errors. + +13 : Invalid or unsupported executable format + This error is returned if the kernel image being loaded is not + recognized as Multiboot or one of the supported native formats + (Linux zImage or bzImage, FreeBSD, or NetBSD). + +14 : Filesystem compatibility error, cannot read whole file + Some of the filesystem reading code in GRUB has limits on the + length of the files it can read. This error is returned when the + user runs into such a limit. + +15 : File not found + This error is returned if the specified file name cannot be found, + but everything else (like the disk/partition info) is OK. + +16 : Inconsistent filesystem structure + This error is returned by the filesystem code to denote an internal + error caused by the sanity checks of the filesystem structure on + disk not matching what it expects. This is usually caused by a + corrupt filesystem or bugs in the code handling it in GRUB. + +17 : Cannot mount selected partition + This error is returned if the partition requested exists, but the + filesystem type cannot be recognized by GRUB. + +18 : Selected cylinder exceeds maximum supported by BIOS + This error is returned when a read is attempted at a linear block + address beyond the end of the BIOS translated area. This generally + happens if your disk is larger than the BIOS can handle (512MB for + (E)IDE disks on older machines or larger than 8GB in general). + +19 : Linux kernel must be loaded before initrd + This error is returned if the initrd command is used before + loading a Linux kernel. + +20 : Multiboot kernel must be loaded before modules + This error is returned if the module load command is used before + loading a Multiboot kernel. It only makes sense in this case + anyway, as GRUB has no idea how to communicate the presence of + such modules to a non-Multiboot-aware kernel. + +21 : Selected disk does not exist + This error is returned if the device part of a device- or full + file name refers to a disk or BIOS device that is not present or + not recognized by the BIOS in the system. + +22 : No such partition + This error is returned if a partition is requested in the device + part of a device- or full file name which isn't on the selected + disk. + +23 : Error while parsing number + This error is returned if GRUB was expecting to read a number and + encountered bad data. + +24 : Attempt to access block outside partition + This error is returned if a linear block address is outside of the + disk partition. This generally happens because of a corrupt + filesystem on the disk or a bug in the code handling it in GRUB + (it's a great debugging tool). + +25 : Disk read error + This error is returned if there is a disk read error when trying to + probe or read data from a particular disk. + +26 : Too many symbolic links + This error is returned if the link count is beyond the maximum + (currently 5), possibly the symbolic links are looped. + +27 : Unrecognized command + This error is returned if an unrecognized command is entered on the + command-line or in a boot sequence section of a configuration file + and that entry is selected. + +28 : Selected item cannot fit into memory + This error is returned if a kernel, module, or raw file load + command is either trying to load its data such that it won't fit + into memory or it is simply too big. + +29 : Disk write error + This error is returned if there is a disk write error when trying + to write to a particular disk. This would generally only occur + during an install of set active partition command. + +30 : Invalid argument + This error is returned if an argument specified to a command is + invalid. + +31 : File is not sector aligned + This error may occur only when you access a ReiserFS partition by + block-lists (e.g. the command `install'). In this case, you should + mount the partition with the `-o notail' option. + +32 : Must be authenticated + This error is returned if you try to run a locked entry. You should + enter a correct password before running such an entry. + +33 : Serial device not configured + This error is returned if you try to change your terminal to a + serial one before initializing any serial device. + +34 : No spare sectors on the disk + This error is returned if a disk doesn't have enough spare space. + This happens when you try to embed Stage 1.5 into the unused + sectors after the MBR, but the first partition starts right after + the MBR or they are used by EZ-BIOS. + + +File: grub.info, Node: Invoking the grub shell, Next: Invoking grub-install, Prev: Troubleshooting, Up: Top + +15 Invoking the grub shell +************************** + +This chapter documents the grub shell `grub'. Note that the grub shell +is an emulator; it doesn't run under the native environment, so it +sometimes does something wrong. Therefore, you shouldn't trust it too +much. If there is anything wrong with it, don't hesitate to try the +native GRUB environment, especially when it guesses a wrong map between +BIOS drives and OS devices. + +* Menu: + +* Basic usage:: How to use the grub shell +* Installation under UNIX:: How to install GRUB via `grub' +* Device map:: The map between BIOS drives and OS devices + + +File: grub.info, Node: Basic usage, Next: Installation under UNIX, Up: Invoking the grub shell + +15.1 Introduction into the grub shell +===================================== + +You can use the command `grub' for installing GRUB under your operating +systems and for a testbed when you add a new feature into GRUB or when +fixing a bug. `grub' is almost the same as the Stage 2, and, in fact, +it shares the source code with the Stage 2 and you can use the same +commands (*note Commands::) in `grub'. It is emulated by replacing BIOS +calls with UNIX system calls and libc functions. + + The command `grub' accepts the following options: + +`--help' + Print a summary of the command-line options and exit. + +`--version' + Print the version number of GRUB and exit. + +`--verbose' + Print some verbose messages for debugging purpose. + +`--device-map=FILE' + Use the device map file FILE. The format is described in *Note + Device map::. + +`--no-floppy' + Do not probe any floppy drive. This option has no effect if the + option `--device-map' is specified (*note Device map::). + +`--probe-second-floppy' + Probe the second floppy drive. If this option is not specified, + the grub shell does not probe it, as that sometimes takes a long + time. If you specify the device map file (*note Device map::), the + grub shell just ignores this option. + +`--config-file=FILE' + Read the configuration file FILE instead of `/boot/grub/menu.lst'. + The format is the same as the normal GRUB syntax. See *Note + Filesystem::, for more information. + +`--boot-drive=DRIVE' + Set the stage2 BOOT_DRIVE to DRIVE. This argument should be an + integer (decimal, octal or hexadecimal). + +`--install-partition=PAR' + Set the stage2 INSTALL_PARTITION to PAR. This argument should be + an integer (decimal, octal or hexadecimal). + +`--no-config-file' + Do not use the configuration file even if it can be read. + +`--no-curses' + Do not use the screen handling interface by the curses even if it + is available. + +`--batch' + This option has the same meaning as `--no-config-file --no-curses'. + +`--read-only' + Disable writing to any disk. + +`--hold' + Wait until a debugger will attach. This option is useful when you + want to debug the startup code. + + +File: grub.info, Node: Installation under UNIX, Next: Device map, Prev: Basic usage, Up: Invoking the grub shell + +15.2 How to install GRUB via `grub' +=================================== + +The installation procedure is the same as under the "native" Stage 2. +*Note Installation::, for more information. The command `grub'-specific +information is described here. + + What you should be careful about is "buffer cache". `grub' makes use +of raw devices instead of filesystems that your operating systems +serve, so there exists a potential problem that some cache +inconsistency may corrupt your filesystems. What we recommend is: + + * If you can unmount drives to which GRUB may write any amount of + data, unmount them before running `grub'. + + * If a drive cannot be unmounted but can be mounted with the + read-only flag, mount it in read-only mode. That should be secure. + + * If a drive must be mounted with the read-write flag, make sure + that no activity is being done on it while the command `grub' is + running. + + * Reboot your operating system as soon as possible. This is probably + not required if you follow the rules above, but reboot is the most + secure way. + + In addition, enter the command `quit' when you finish the +installation. That is _very important_ because `quit' makes the buffer +cache consistent. Do not push . + + If you want to install GRUB non-interactively, specify `--batch' +option in the command-line. This is a simple example: + + #!/bin/sh + + # Use /usr/sbin/grub if you are on an older system. + /sbin/grub --batch </dev/null 2>/dev/null + root (hd0,0) + setup (hd0) + quit + EOT + + +File: grub.info, Node: Device map, Prev: Installation under UNIX, Up: Invoking the grub shell + +15.3 The map between BIOS drives and OS devices +=============================================== + +When you specify the option `--device-map' (*note Basic usage::), the +grub shell creates the "device map file" automatically unless it +already exists. The file name `/boot/grub/device.map' is preferred. + + If the device map file exists, the grub shell reads it to map BIOS +drives to OS devices. This file consists of lines like this: + + DEVICE FILE + + DEVICE is a drive specified in the GRUB syntax (*note Device +syntax::), and FILE is an OS file, which is normally a device file. + + The reason why the grub shell gives you the device map file is that +it cannot guess the map between BIOS drives and OS devices correctly in +some environments. For example, if you exchange the boot sequence +between IDE and SCSI in your BIOS, it gets the order wrong. + + Thus, edit the file if the grub shell makes a mistake. You can put +any comments in the file if needed, as the grub shell assumes that a +line is just a comment if the first character is `#'. + + +File: grub.info, Node: Invoking grub-install, Next: Invoking grub-md5-crypt, Prev: Invoking the grub shell, Up: Top + +16 Invoking grub-install +************************ + +The program `grub-install' installs GRUB on your drive using the grub +shell (*note Invoking the grub shell::). You must specify the device +name on which you want to install GRUB, like this: + + grub-install INSTALL_DEVICE + + The device name INSTALL_DEVICE is an OS device name or a GRUB device +name. + + `grub-install' accepts the following options: + +`--help' + Print a summary of the command-line options and exit. + +`--version' + Print the version number of GRUB and exit. + +`--force-lba' + Force GRUB to use LBA mode even for a buggy BIOS. Use this option + only if your BIOS doesn't work properly in LBA mode even though it + supports LBA mode. + +`--root-directory=DIR' + Install GRUB images under the directory DIR instead of the root + directory. This option is useful when you want to install GRUB + into a separate partition or a removable disk. Here is an example + in which you have a separate "boot" partition which is mounted on + `/boot': + + grub-install --root-directory=/boot hd0 + +`--grub-shell=FILE' + Use FILE as the grub shell. You can append arbitrary options to + FILE after the file name, like this: + + grub-install --grub-shell="grub --read-only" /dev/fd0 + +`--recheck' + Recheck the device map, even if `/boot/grub/device.map' already + exists. You should use this option whenever you add/remove a disk + into/from your computer. + + +File: grub.info, Node: Invoking grub-md5-crypt, Next: Invoking grub-terminfo, Prev: Invoking grub-install, Up: Top + +17 Invoking grub-md5-crypt +************************** + +The program `grub-md5-crypt' encrypts a password in MD5 format. This +is just a frontend of the grub shell (*note Invoking the grub shell::). +Passwords encrypted by this program can be used with the command +`password' (*note password::). + + `grub-md5-crypt' accepts the following options: + +`--help' + Print a summary of the command-line options and exit. + +`--version' + Print the version information and exit. + +`--grub-shell=FILE' + Use FILE as the grub shell. + + +File: grub.info, Node: Invoking grub-terminfo, Next: Invoking grub-set-default, Prev: Invoking grub-md5-crypt, Up: Top + +18 Invoking grub-terminfo +************************* + +The program `grub-terminfo' generates a terminfo command from a +terminfo name (*note terminfo::). The result can be used in the +configuration file, to define escape sequences. Because GRUB assumes +that your terminal is vt100-compatible by default, this would be useful +only if your terminal is uncommon (such as vt52). + + `grub-terminfo' accepts the following options: + +`--help' + Print a summary of the command-line options and exit. + +`--version' + Print the version information and exit. + + You must specify one argument to this command. For example: + + grub-terminfo vt52 + + +File: grub.info, Node: Invoking grub-set-default, Next: Invoking mbchk, Prev: Invoking grub-terminfo, Up: Top + +19 Invoking grub-set-default +**************************** + +The program `grub-set-default' sets the default boot entry for GRUB. +This automatically creates a file named `default' under your GRUB +directory (i.e. `/boot/grub'), if it is not present. This file is used +to determine the default boot entry when GRUB boots up your system when +you use `default saved' in your configuration file (*note default::), +and to save next default boot entry when you use `savedefault' in a +boot entry (*note savedefault::). + + `grub-set-default' accepts the following options: + +`--help' + Print a summary of the command-line options and exit. + +`--version' + Print the version information and exit. + +`--root-directory=DIR' + Use the directory DIR instead of the root directory (i.e. `/') to + define the location of the default file. This is useful when you + mount a disk which is used for another system. + + You must specify a single argument to `grub-set-default'. This +argument is normally the number of a default boot entry. For example, +if you have this configuration file: + + default saved + timeout 10 + + title GNU/Hurd + root (hd0,0) + ... + + title GNU/Linux + root (hd0,1) + ... + + and if you want to set the next default boot entry to GNU/Linux, you +may execute this command: + + grub-set-default 1 + + Because the entry for GNU/Linux is `1'. Note that entries are +counted from zero. So, if you want to specify GNU/Hurd here, then you +should specify `0'. + + This feature is very useful if you want to test a new kernel or to +make your system quite robust. *Note Making your system robust::, for +more hints about how to set up a robust system. + + +File: grub.info, Node: Invoking mbchk, Next: Obtaining and Building GRUB, Prev: Invoking grub-set-default, Up: Top + +20 Invoking mbchk +***************** + +The program `mbchk' checks for the format of a Multiboot kernel. We +recommend using this program before booting your own kernel by GRUB. + + `mbchk' accepts the following options: + +`--help' + Print a summary of the command-line options and exit. + +`--version' + Print the version number of GRUB and exit. + +`--quiet' + Suppress all normal output. + + +File: grub.info, Node: Obtaining and Building GRUB, Next: Reporting bugs, Prev: Invoking mbchk, Up: Top + +Appendix A How to obtain and build GRUB +*************************************** + + *Caution:* GRUB requires binutils-2.9.1.0.23 or later because the + GNU assembler has been changed so that it can produce real 16bits + machine code between 2.9.1 and 2.9.1.0.x. See + `http://sources.redhat.com/binutils/', to obtain information on + how to get the latest version. + + GRUB is available from the GNU alpha archive site +`ftp://alpha.gnu.org/gnu/grub' or any of its mirrors. The file will be +named grub-version.tar.gz. The current version is 0.97, so the file you +should grab is: + + `ftp://alpha.gnu.org/gnu/grub/grub-0.97.tar.gz' + + To unbundle GRUB use the instruction: + + zcat grub-0.97.tar.gz | tar xvf - + + which will create a directory called `grub-0.97' with all the +sources. You can look at the file `INSTALL' for detailed instructions +on how to build and install GRUB, but you should be able to just do: + + cd grub-0.97 + ./configure + make install + + This will install the grub shell `grub' (*note Invoking the grub +shell::), the Multiboot checker `mbchk' (*note Invoking mbchk::), and +the GRUB images. This will also install the GRUB manual. + + Also, the latest version is available from the CVS. See +`http://savannah.gnu.org/cvs/?group=grub' for more information. + + +File: grub.info, Node: Reporting bugs, Next: Future, Prev: Obtaining and Building GRUB, Up: Top + +Appendix B Reporting bugs +************************* + +These are the guideline for how to report bugs. Take a look at this +list below before you submit bugs: + + 1. Before getting unsettled, read this manual through and through. + Also, see the GNU GRUB FAQ + (http://www.gnu.org/software/grub/grub-faq.html). + + 2. Always mention the information on your GRUB. The version number + and the configuration are quite important. If you build it + yourself, write the options specified to the configure script and + your operating system, including the versions of gcc and binutils. + + 3. If you have trouble with the installation, inform us of how you + installed GRUB. Don't omit error messages, if any. Just `GRUB hangs + up when it boots' is not enough. + + The information on your hardware is also essential. These are + especially important: the geometries and the partition tables of + your hard disk drives and your BIOS. + + 4. If GRUB cannot boot your operating system, write down _everything_ + you see on the screen. Don't paraphrase them, like `The foo OS + crashes with GRUB, even though it can boot with the bar boot + loader just fine'. Mention the commands you executed, the messages + printed by them, and information on your operating system + including the version number. + + 5. Explain what you wanted to do. It is very useful to know your + purpose and your wish, and how GRUB didn't satisfy you. + + 6. If you can investigate the problem yourself, please do. That will + give you and us much more information on the problem. Attaching a + patch is even better. + + When you attach a patch, make the patch in unified diff format, and + write ChangeLog entries. But, even when you make a patch, don't + forget to explain the problem, so that we can understand what your + patch is for. + + 7. Write down anything that you think might be related. Please + understand that we often need to reproduce the same problem you + encounterred in our environment. So your information should be + sufficient for us to do the same thing--Don't forget that we + cannot see your computer directly. If you are not sure whether to + state a fact or leave it out, state it! Reporting too many things + is much better than omitting something important. + + If you follow the guideline above, submit a report to the Bug +Tracking System (http://savannah.gnu.org/bugs/?group=grub). +Alternatively, you can submit a report via electronic mail to +, but we strongly recommend that you use the Bug +Tracking System, because e-mail can be passed over easily. + + Once we get your report, we will try to fix the bugs. + + +File: grub.info, Node: Future, Next: Internals, Prev: Reporting bugs, Up: Top + +Appendix C Where GRUB will go +***************************** + +We started the next generation of GRUB, GRUB 2. This will include +internationalization, dynamic module loading, real memory management, +multiple architecture support, a scripting language, and many other +nice feature. If you are interested in the development of GRUB 2, take +a look at the homepage (http://www.gnu.org/software/grub/grub.html). + + +File: grub.info, Node: Internals, Next: Index, Prev: Future, Up: Top + +Appendix D Hacking GRUB +*********************** + +This chapter documents the user-invisible aspect of GRUB. + + As a general rule of software development, it is impossible to keep +the descriptions of the internals up-to-date, and it is quite hard to +document everything. So refer to the source code, whenever you are not +satisfied with this documentation. Please assume that this gives just +hints to you. + +* Menu: + +* Memory map:: The memory map of various components +* Embedded data:: Embedded variables in GRUB +* Filesystem interface:: The generic interface for filesystems +* Command interface:: The generic interface for built-ins +* Bootstrap tricks:: The bootstrap mechanism used in GRUB +* I/O ports detection:: How to probe I/O ports used by INT 13H +* Memory detection:: How to detect all installed RAM +* Low-level disk I/O:: INT 13H disk I/O interrupts +* MBR:: The structure of Master Boot Record +* Partition table:: The format of partition tables +* Submitting patches:: Where and how you should send patches + + +File: grub.info, Node: Memory map, Next: Embedded data, Up: Internals + +D.1 The memory map of various components +======================================== + +GRUB consists of two distinct components, called "stages", which are +loaded at different times in the boot process. Because they run +mutual-exclusively, sometimes a memory area overlaps with another +memory area. And, even in one stage, a single memory area can be used +for various purposes, because their usages are mutually exclusive. + + Here is the memory map of the various components: + +0 to 4K-1 + BIOS and real mode interrupts + +0x07BE to 0x07FF + Partition table passed to another boot loader + +down from 8K-1 + Real mode stack + +0x2000 to ? + The optional Stage 1.5 is loaded here + +0x2000 to 0x7FFF + Command-line buffer for Multiboot kernels and modules + +0x7C00 to 0x7DFF + Stage 1 is loaded here by BIOS or another boot loader + +0x7F00 to 0x7F42 + LBA drive parameters + +0x8000 to ? + Stage2 is loaded here + +The end of Stage 2 to 416K-1 + Heap, in particular used for the menu + +down from 416K-1 + Protected mode stack + +416K to 448K-1 + Filesystem buffer + +448K to 479.5K-1 + Raw device buffer + +479.5K to 480K-1 + 512-byte scratch area + +480K to 512K-1 + Buffers for various functions, such as password, command-line, cut + and paste, and completion. + +The last 1K of lower memory + Disk swapping code and data + + See the file `stage2/shared.h', for more information. + + +File: grub.info, Node: Embedded data, Next: Filesystem interface, Prev: Memory map, Up: Internals + +D.2 Embedded variables in GRUB +============================== + +Stage 1 and Stage 2 have embedded variables whose locations are +well-defined, so that the installation can patch the binary file +directly without recompilation of the stages. + + In Stage 1, these are defined: + +`0x3E' + The version number (not GRUB's, but the installation mechanism's). + +`0x40' + The boot drive. If it is 0xFF, use a drive passed by BIOS. + +`0x41' + The flag for if forcing LBA. + +`0x42' + The starting address of Stage 2. + +`0x44' + The first sector of Stage 2. + +`0x48' + The starting segment of Stage 2. + +`0x1FE' + The signature (`0xAA55'). + + See the file `stage1/stage1.S', for more information. + + In the first sector of Stage 1.5 and Stage 2, the block lists are +recorded between `firstlist' and `lastlist'. The address of `lastlist' +is determined when assembling the file `stage2/start.S'. + + The trick here is that it is actually read backward, and the first +8-byte block list is not read here, but after the pointer is decremented +8 bytes, then after reading it, it decrements again, reads, and so on, +until it is finished. The terminating condition is when the number of +sectors to be read in the next block list is zero. + + The format of a block list can be seen from the example in the code +just before the `firstlist' label. Note that it is always from the +beginning of the disk, but _not_ relative to the partition boundaries. + + In the second sector of Stage 1.5 and Stage 2, these are defined: + +`0x6' + The version number (likewise, the installation mechanism's). + +`0x8' + The installed partition. + +`0xC' + The saved entry number. + +`0x10' + The identifier. + +`0x11' + The flag for if forcing LBA. + +`0x12' + The version string (GRUB's). + +`0x12' + "the length of the version string" + The name of a configuration file. + + See the file `stage2/asm.S', for more information. + + +File: grub.info, Node: Filesystem interface, Next: Command interface, Prev: Embedded data, Up: Internals + +D.3 The generic interface for filesystems +========================================= + +For any particular partition, it is presumed that only one of the +"normal" filesystems such as FAT, FFS, or ext2fs can be used, so there +is a switch table managed by the functions in `disk_io.c'. The notation +is that you can only "mount" one at a time. + + The block list filesystem has a special place in the system. In +addition to the "normal" filesystem (or even without one mounted), you +can access disk blocks directly (in the indicated partition) via the +block list notation. Using the block list filesystem doesn't effect any +other filesystem mounts. + + The variables which can be read by the filesystem backend are: + +`current_drive' + The current BIOS drive number (numbered from 0, if a floppy, and + numbered from 0x80, if a hard disk). + +`current_partition' + The current partition number. + +`current_slice' + The current partition type. + +`saved_drive' + The "drive" part of the root device. + +`saved_partition' + The "partition" part of the root device. + +`part_start' + The current partition starting address, in sectors. + +`part_length' + The current partition length, in sectors. + +`print_possibilities' + True when the `dir' function should print the possible completions + of a file, and false when it should try to actually open a file of + that name. + +`FSYS_BUF' + Filesystem buffer which is 32K in size, to use in any way which the + filesystem backend desires. + + The variables which need to be written by a filesystem backend are: + +`filepos' + The current position in the file, in sectors. + + *Caution:* the value of FILEPOS can be changed out from under the + filesystem code in the current implementation. Don't depend on it + being the same for later calls into the backend code! + +`filemax' + The length of the file. + +`disk_read_func' + The value of DISK_READ_HOOK _only_ during reading of data for the + file, not any other fs data, inodes, FAT tables, whatever, then + set to `NULL' at all other times (it will be `NULL' by default). + If this isn't done correctly, then the `testload' and `install' + commands won't work correctly. + + The functions expected to be used by the filesystem backend are: + +`devread' + Only read sectors from within a partition. Sector 0 is the first + sector in the partition. + +`grub_read' + If the backend uses the block list code, then `grub_read' can be + used, after setting BLOCK_FILE to 1. + +`print_a_completion' + If PRINT_POSSIBILITIES is true, call `print_a_completion' for each + possible file name. Otherwise, the file name completion won't work. + + The functions expected to be defined by the filesystem backend are +described at least moderately in the file `filesys.h'. Their usage is +fairly evident from their use in the functions in `disk_io.c', look for +the use of the FSYS_TABLE array. + + *Caution:* The semantics are such that then `mount'ing the +filesystem, presume the filesystem buffer `FSYS_BUF' is corrupted, and +(re-)load all important contents. When opening and reading a file, +presume that the data from the `mount' is available, and doesn't get +corrupted by the open/read (i.e. multiple opens and/or reads will be +done with only one mount if in the same filesystem). + + +File: grub.info, Node: Command interface, Next: Bootstrap tricks, Prev: Filesystem interface, Up: Internals + +D.4 The generic interface for built-ins +======================================= + +GRUB built-in commands are defined in a uniformal interface, whether +they are menu-specific or can be used anywhere. The definition of a +builtin command consists of two parts: the code itself and the table of +the information. + + The code must be a function which takes two arguments, a command-line +string and flags, and returns an `int' value. The "flags" argument +specifies how the function is called, using a bit mask. The return +value must be zero if successful, otherwise non-zero. So it is normally +enough to return ERRNUM. + + The table of the information is represented by the structure `struct +builtin', which contains the name of the command, a pointer to the +function, flags, a short description of the command and a long +description of the command. Since the descriptions are used only for +help messages interactively, you don't have to define them, if the +command may not be called interactively (such as `title'). + + The table is finally registered in the table BUILTIN_TABLE, so that +`run_script' and `enter_cmdline' can find the command. See the files +`cmdline.c' and `builtins.c', for more details. + + +File: grub.info, Node: Bootstrap tricks, Next: I/O ports detection, Prev: Command interface, Up: Internals + +D.5 The bootstrap mechanism used in GRUB +======================================== + +The disk space can be used in a boot loader is very restricted because +a MBR (*note MBR::) is only 512 bytes but it also contains a partition +table (*note Partition table::) and a BPB. So the question is how to +make a boot loader code enough small to be fit in a MBR. + + However, GRUB is a very large program, so we break GRUB into 2 (or 3) +distinct components, "Stage 1" and "Stage 2" (and optionally "Stage +1.5"). *Note Memory map::, for more information. + + We embed Stage 1 in a MBR or in the boot sector of a partition, and +place Stage 2 in a filesystem. The optional Stage 1.5 can be installed +in a filesystem, in the "boot loader" area in a FFS or a ReiserFS, and +in the sectors right after a MBR, because Stage 1.5 is enough small and +the sectors right after a MBR is normally an unused region. The size of +this region is the number of sectors per head minus 1. + + Thus, all Stage1 must do is just load Stage2 or Stage1.5. But even if +Stage 1 needs not to support the user interface or the filesystem +interface, it is impossible to make Stage 1 less than 400 bytes, because +GRUB should support both the CHS mode and the LBA mode (*note Low-level +disk I/O::). + + The solution used by GRUB is that Stage 1 loads only the first +sector of Stage 2 (or Stage 1.5) and Stage 2 itself loads the rest. The +flow of Stage 1 is: + + 1. Initialize the system briefly. + + 2. Detect the geometry and the accessing mode of the "loading drive". + + 3. Load the first sector of Stage 2. + + 4. Jump to the starting address of the Stage 2. + + The flow of Stage 2 (and Stage 1.5) is: + + 1. Load the rest of itself to the real starting address, that is, the + starting address plus 512 bytes. The block lists are stored in the + last part of the first sector. + + 2. Long jump to the real starting address. + + Note that Stage 2 (or Stage 1.5) does not probe the geometry or the +accessing mode of the "loading drive", since Stage 1 has already probed +them. + + +File: grub.info, Node: I/O ports detection, Next: Memory detection, Prev: Bootstrap tricks, Up: Internals + +D.6 How to probe I/O ports used by INT 13H +========================================== + +FIXME: I will write this chapter after implementing the new technique. + + +File: grub.info, Node: Memory detection, Next: Low-level disk I/O, Prev: I/O ports detection, Up: Internals + +D.7 How to detect all installed RAM +=================================== + +FIXME: I doubt if Erich didn't write this chapter only himself wholly, +so I will rewrite this chapter. + + +File: grub.info, Node: Low-level disk I/O, Next: MBR, Prev: Memory detection, Up: Internals + +D.8 INT 13H disk I/O interrupts +=============================== + +FIXME: I'm not sure where some part of the original chapter is derived, +so I will rewrite this chapter. + + +File: grub.info, Node: MBR, Next: Partition table, Prev: Low-level disk I/O, Up: Internals + +D.9 The structure of Master Boot Record +======================================= + +FIXME: Likewise. + + +File: grub.info, Node: Partition table, Next: Submitting patches, Prev: MBR, Up: Internals + +D.10 The format of partition tables +=================================== + +FIXME: Probably the original chapter is derived from "How It Works", so +I will rewrite this chapter. + + +File: grub.info, Node: Submitting patches, Prev: Partition table, Up: Internals + +D.11 Where and how you should send patches +========================================== + +When you write patches for GRUB, please send them to the mailing list +. Here is the list of items of which you should take +care: + + * Please make your patch as small as possible. Generally, it is not + a good thing to make one big patch which changes many things. + Instead, segregate features and produce many patches. + + * Use as late code as possible, for the original code. The CVS + repository always has the current version (*note Obtaining and + Building GRUB::). + + * Write ChangeLog entries. *Note Change Logs: (standards)Change + Logs, if you don't know how to write ChangeLog. + + * Make patches in unified diff format. `diff -urN' is appropriate in + most cases. + + * Don't make patches reversely. Reverse patches are difficult to + read and use. + + * Be careful enough of the license term and the copyright. Because + GRUB is under GNU General Public License, you may not steal code + from software whose license is incompatible against GPL. And, if + you copy code written by others, you must not ignore their + copyrights. Feel free to ask GRUB maintainers, whenever you are + not sure what you should do. + + * If your patch is too large to send in e-mail, put it at somewhere + we can see. Usually, you shouldn't send e-mail over 20K. + + +File: grub.info, Node: Index, Prev: Internals, Up: Top + +Index +***** + +[index] +* Menu: + +* blocklist: blocklist. (line 7) +* boot: boot. (line 7) +* bootp: bootp. (line 7) +* cat: cat. (line 7) +* chainloader: chainloader. (line 7) +* cmp: cmp. (line 7) +* color: color. (line 7) +* configfile: configfile. (line 7) +* current_drive: Filesystem interface. (line 19) +* current_partition: Filesystem interface. (line 23) +* current_slice: Filesystem interface. (line 26) +* debug: debug. (line 7) +* default: default. (line 7) +* device: device. (line 7) +* devread: Filesystem interface. (line 71) +* dhcp: dhcp. (line 7) +* disk_read_func: Filesystem interface. (line 62) +* displayapm: displayapm. (line 7) +* displaymem: displaymem. (line 7) +* embed: embed. (line 7) +* fallback: fallback. (line 7) +* filemax: Filesystem interface. (line 59) +* filepos: Filesystem interface. (line 52) +* find: find. (line 7) +* fstest: fstest. (line 7) +* FSYS_BUF: Filesystem interface. (line 46) +* geometry: geometry. (line 7) +* grub_read: Filesystem interface. (line 75) +* halt: halt. (line 7) +* help: help. (line 7) +* hiddenmenu: hiddenmenu. (line 7) +* hide: hide. (line 7) +* ifconfig: ifconfig. (line 8) +* impsprobe: impsprobe. (line 7) +* initrd: initrd. (line 7) +* install: install. (line 9) +* ioprobe: ioprobe. (line 7) +* kernel: kernel. (line 7) +* lock: lock. (line 7) +* makeactive: makeactive. (line 7) +* map: map. (line 7) +* md5crypt: md5crypt. (line 7) +* module: module. (line 7) +* modulenounzip: modulenounzip. (line 7) +* pager: pager. (line 7) +* part_length: Filesystem interface. (line 38) +* part_start: Filesystem interface. (line 35) +* partnew: partnew. (line 7) +* parttype: parttype. (line 7) +* password: password. (line 7) +* pause: pause. (line 7) +* print_a_completion: Filesystem interface. (line 79) +* print_possibilities: Filesystem interface. (line 41) +* quit: quit. (line 7) +* rarp: rarp. (line 7) +* read: read. (line 7) +* reboot: reboot. (line 7) +* root: root. (line 7) +* rootnoverify: rootnoverify. (line 7) +* saved_drive: Filesystem interface. (line 29) +* saved_partition: Filesystem interface. (line 32) +* savedefault: savedefault. (line 7) +* serial: serial. (line 9) +* setkey: setkey. (line 7) +* setup: setup. (line 8) +* terminal: terminal. (line 9) +* terminfo: terminfo. (line 9) +* testload: testload. (line 7) +* testvbe: testvbe. (line 7) +* tftpserver: tftpserver. (line 7) +* timeout: timeout. (line 7) +* title: title. (line 7) +* unhide: unhide. (line 7) +* uppermem: uppermem. (line 7) +* vbeprobe: vbeprobe. (line 7) + + + +Tag Table: +Node: Top1487 +Node: Introduction3266 +Node: Overview3643 +Node: Overview-Footnotes5865 +Ref: Overview-Footnote-15926 +Node: History6087 +Node: Features7208 +Node: Features-Footnotes12976 +Ref: Features-Footnote-113037 +Node: Role of a boot loader13182 +Node: Role of a boot loader-Footnotes14520 +Ref: Role of a boot loader-Footnote-114607 +Node: Naming convention14686 +Node: Installation17621 +Node: Creating a GRUB boot floppy19363 +Node: Installing GRUB natively20181 +Node: Installing GRUB natively-Footnotes22461 +Ref: Installing GRUB natively-Footnote-122554 +Node: Installing GRUB using grub-install22739 +Node: Making a GRUB bootable CD-ROM25685 +Node: Making a GRUB bootable CD-ROM-Footnotes27730 +Ref: Making a GRUB bootable CD-ROM-Footnote-127833 +Node: Booting27908 +Node: General boot methods28363 +Node: Loading an operating system directly29104 +Node: Chain-loading30408 +Node: Chain-loading-Footnotes31718 +Ref: Chain-loading-Footnote-131789 +Node: OS-specific notes31861 +Node: GNU/Hurd32237 +Node: GNU/Linux32856 +Node: FreeBSD34104 +Node: NetBSD34617 +Node: OpenBSD35275 +Node: DOS/Windows35475 +Node: SCO UnixWare37301 +Node: QNX37719 +Node: Making your system robust37969 +Node: Booting once-only39294 +Node: Booting fallback systems41219 +Node: Configuration44066 +Node: Network48495 +Node: General usage of network support48989 +Node: General usage of network support-Footnotes50850 +Ref: General usage of network support-Footnote-150959 +Node: Diskless51027 +Node: Serial terminal53211 +Node: Preset Menu55444 +Node: Security57812 +Node: Images60620 +Node: Filesystem63131 +Node: Device syntax63814 +Node: File name syntax65308 +Node: Block list syntax66051 +Node: Interface66784 +Node: Command-line interface67661 +Node: Command-line interface-Footnotes69602 +Ref: Command-line interface-Footnote-169691 +Node: Menu interface69786 +Node: Menu entry editor70796 +Node: Hidden menu interface71875 +Node: Commands72452 +Node: Menu-specific commands73029 +Node: default74200 +Node: fallback74678 +Node: hiddenmenu75229 +Node: timeout75717 +Node: title75995 +Node: General commands76266 +Node: bootp77579 +Node: color78058 +Node: device79532 +Node: dhcp80104 +Node: hide80689 +Node: ifconfig81066 +Node: pager81642 +Node: partnew81976 +Node: parttype82412 +Node: password82779 +Node: rarp83598 +Node: serial83899 +Node: setkey85172 +Node: terminal87341 +Node: terminfo88878 +Node: tftpserver89565 +Node: unhide90111 +Node: Command-line and menu entry commands90486 +Node: blocklist93017 +Node: boot93259 +Node: cat93580 +Node: chainloader93884 +Node: cmp94500 +Node: configfile95051 +Node: debug95265 +Node: displayapm95649 +Node: displaymem95860 +Node: embed96562 +Node: embed-Footnotes97096 +Ref: embed-Footnote-197151 +Node: find97208 +Node: fstest97588 +Node: geometry98273 +Node: halt98885 +Node: help99212 +Node: impsprobe99833 +Node: initrd100232 +Node: install100571 +Node: install-Footnotes103415 +Ref: install-Footnote-1103474 +Node: ioprobe103571 +Node: kernel103896 +Node: lock105016 +Node: makeactive105591 +Node: map105903 +Node: md5crypt106470 +Node: module106817 +Node: modulenounzip107394 +Node: pause107687 +Node: quit108101 +Node: reboot108377 +Node: read108558 +Node: root108800 +Node: rootnoverify109677 +Node: savedefault110232 +Node: setup111208 +Node: testload112274 +Node: testvbe112884 +Node: uppermem113255 +Node: vbeprobe113837 +Node: Troubleshooting114220 +Node: Stage1 errors114758 +Node: Stage1.5 errors116135 +Node: Stage2 errors116573 +Node: Invoking the grub shell124033 +Node: Basic usage124786 +Node: Installation under UNIX127073 +Node: Device map128748 +Node: Invoking grub-install129896 +Node: Invoking grub-md5-crypt131484 +Node: Invoking grub-terminfo132133 +Node: Invoking grub-set-default132899 +Node: Invoking mbchk134700 +Node: Obtaining and Building GRUB135214 +Node: Reporting bugs136631 +Node: Future139435 +Node: Internals139926 +Node: Memory map141149 +Node: Embedded data142627 +Node: Filesystem interface144644 +Node: Command interface148077 +Node: Bootstrap tricks149392 +Node: I/O ports detection151541 +Node: Memory detection151813 +Node: Low-level disk I/O152105 +Node: MBR152374 +Node: Partition table152571 +Node: Submitting patches152844 +Node: Index154332 + +End Tag Table diff --git a/usr/src/grub/grub-0.97/docs/grub.info-1 b/usr/src/grub/grub-0.97/docs/grub.info-1 new file mode 100644 index 0000000000..23811f395a --- /dev/null +++ b/usr/src/grub/grub-0.97/docs/grub.info-1 @@ -0,0 +1,1338 @@ +This is grub.info, produced by makeinfo version 4.0 from grub.texi. + +INFO-DIR-SECTION Kernel +START-INFO-DIR-ENTRY +* GRUB: (grub). The GRand Unified Bootloader +* grub-install: (grub)Invoking grub-install. Install GRUB on your drive +* grub-md5-crypt: (grub)Invoking grub-md5-crypt. Encrypt a password + in MD5 format +* grub-terminfo: (grub)Invoking grub-terminfo. Generate a terminfo + command from a + terminfo name +* grub-set-default: (grub)Invoking grub-set-default. Set a default boot + entry +* mbchk: (grub)Invoking mbchk. Check for the format of a Multiboot kernel +END-INFO-DIR-ENTRY + + Copyright (C) 1999,2000,2001,2002,2004 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: grub.info, Node: Top, Next: Introduction, Up: (dir) + +GRUB manual +*********** + + This is the documentation of GNU GRUB, the GRand Unified Bootloader, +a flexible and powerful boot loader program for PCs. + + This edition documents version 0.95. + +* Menu: + +* Introduction:: Capturing the spirit of GRUB +* Naming convention:: Names of your drives in GRUB +* Installation:: Installing GRUB on your drive +* Booting:: How to boot different operating systems +* Configuration:: Writing your own configuration file +* Network:: Downloading OS images from a network +* Serial terminal:: Using GRUB via a serial line +* Preset Menu:: Embedding a configuration file into GRUB +* Security:: Improving the security +* Images:: GRUB image files +* Filesystem:: Filesystem syntax and semantics +* Interface:: The menu and the command-line +* Commands:: The list of available builtin commands +* Troubleshooting:: Error messages produced by GRUB +* Invoking the grub shell:: How to use the grub shell +* Invoking grub-install:: How to use the GRUB installer +* Invoking grub-md5-crypt:: How to generate a cryptic password +* Invoking grub-terminfo:: How to generate a terminfo command +* Invoking grub-set-default:: How to set a default boot entry +* Invoking mbchk:: How to use the Multiboot checker +* Obtaining and Building GRUB:: How to obtain and build GRUB +* Reporting bugs:: Where you should send a bug report +* Future:: Some future plans on GRUB +* Internals:: Hacking GRUB +* Index:: + + +File: grub.info, Node: Introduction, Next: Naming convention, Prev: Top, Up: Top + +Introduction to GRUB +******************** + +* Menu: + +* Overview:: What exactly GRUB is and how to use it +* History:: From maggot to house fly +* Features:: GRUB features +* Role of a boot loader:: The role of a boot loader + + +File: grub.info, Node: Overview, Next: History, Up: Introduction + +Overview +======== + + Briefly, a "boot loader" is the first software program that runs when +a computer starts. It is responsible for loading and transferring +control to an operating system "kernel" software (such as Linux or GNU +Mach). The kernel, in turn, initializes the rest of the operating +system (e.g. a GNU system). + + GNU GRUB is a very powerful boot loader, which can load a wide +variety of free operating systems, as well as proprietary operating +systems with chain-loading(1) (*note Overview-Footnote-1::). GRUB is +designed to address the complexity of booting a personal computer; both +the program and this manual are tightly bound to that computer platform, +although porting to other platforms may be addressed in the future. + + One of the important features in GRUB is flexibility; GRUB +understands filesystems and kernel executable formats, so you can load +an arbitrary operating system the way you like, without recording the +physical position of your kernel on the disk. Thus you can load the +kernel just by specifying its file name and the drive and partition +where the kernel resides. + + When booting with GRUB, you can use either a command-line interface +(*note Command-line interface::), or a menu interface (*note Menu +interface::). Using the command-line interface, you type the drive +specification and file name of the kernel manually. In the menu +interface, you just select an OS using the arrow keys. The menu is +based on a configuration file which you prepare beforehand (*note +Configuration::). While in the menu, you can switch to the command-line +mode, and vice-versa. You can even edit menu entries before using them. + + In the following chapters, you will learn how to specify a drive, a +partition, and a file name (*note Naming convention::) to GRUB, how to +install GRUB on your drive (*note Installation::), and how to boot your +OSes (*note Booting::), step by step. + + Besides the GRUB boot loader itself, there is a "grub shell" `grub' +(*note Invoking the grub shell::) which can be run when you are in your +operating system. It emulates the boot loader and can be used for +installing the boot loader. + + +File: grub.info, Node: Overview-Footnotes, Up: Overview + + (1) "chain-load" is the mechanism for loading unsupported operating +systems by loading another boot loader. It is typically used for +loading DOS or Windows. + + +File: grub.info, Node: History, Next: Features, Prev: Overview, Up: Introduction + +History of GRUB +=============== + + GRUB originated in 1995 when Erich Boleyn was trying to boot the GNU +Hurd with the University of Utah's Mach 4 microkernel (now known as GNU +Mach). Erich and Brian Ford designed the Multiboot Specification +(*note Multiboot Specification: (multiboot)Top.), because they were +determined not to add to the large number of mutually-incompatible PC +boot methods. + + Erich then began modifying the FreeBSD boot loader so that it would +understand Multiboot. He soon realized that it would be a lot easier to +write his own boot loader from scratch than to keep working on the +FreeBSD boot loader, and so GRUB was born. + + Erich added many features to GRUB, but other priorities prevented him +from keeping up with the demands of its quickly-expanding user base. In +1999, Gordon Matzigkeit and Yoshinori K. Okuji adopted GRUB as an +official GNU package, and opened its development by making the latest +sources available via anonymous CVS. *Note Obtaining and Building +GRUB::, for more information. + + +File: grub.info, Node: Features, Next: Role of a boot loader, Prev: History, Up: Introduction + +GRUB features +============= + + The primary requirement for GRUB is that it be compliant with the +"Multiboot Specification", which is described in *Note Multiboot +Specification: (multiboot)Top. + + The other goals, listed in approximate order of importance, are: + + * Basic functions must be straightforward for end-users. + + * Rich functionality to support kernel experts and designers. + + * Backward compatibility for booting FreeBSD, NetBSD, OpenBSD, and + Linux. Proprietary kernels (such as DOS, Windows NT, and OS/2) are + supported via a chain-loading function. + + Except for specific compatibility modes (chain-loading and the Linux +"piggyback" format), all kernels will be started in much the same state +as in the Multiboot Specification. Only kernels loaded at 1 megabyte or +above are presently supported. Any attempt to load below that boundary +will simply result in immediate failure and an error message reporting +the problem. + + In addition to the requirements above, GRUB has the following +features (note that the Multiboot Specification doesn't require all the +features that GRUB supports): + +Recognize multiple executable formats + Support many of the "a.out" variants plus "ELF". Symbol tables are + also loaded. + +Support non-Multiboot kernels + Support many of the various free 32-bit kernels that lack Multiboot + compliance (primarily FreeBSD, NetBSD, OpenBSD, and Linux). + Chain-loading of other boot loaders is also supported. + +Load multiples modules + Fully support the Multiboot feature of loading multiple modules. + +Load a configuration file + Support a human-readable text configuration file with preset boot + commands. You can also load another configuration file dynamically + and embed a preset configuration file in a GRUB image file. The + list of commands (*note Commands::) are a superset of those + supported on the command-line. An example configuration file is + provided in *Note Configuration::. + +Provide a menu interface + A menu interface listing preset boot commands, with a programmable + timeout, is available. There is no fixed limit on the number of + boot entries, and the current implementation has space for several + hundred. + +Have a flexible command-line interface + A fairly flexible command-line interface, accessible from the menu, + is available to edit any preset commands, or write a new boot + command set from scratch. If no configuration file is present, + GRUB drops to the command-line. + + The list of commands (*note Commands::) are a subset of those + supported for configuration files. Editing commands closely + resembles the Bash command-line (*note Bash: (features)Command + Line Editing.), with -completion of commands, devices, + partitions, and files in a directory depending on context. + +Support multiple filesystem types + Support multiple filesystem types transparently, plus a useful + explicit blocklist notation. The currently supported filesystem + types are "BSD FFS", "DOS FAT16 and FAT32", "Minix fs", "Linux + ext2fs", "ReiserFS", "JFS", "XFS", and "VSTa fs". *Note + Filesystem::, for more information. + +Support automatic decompression + Can decompress files which were compressed by `gzip'. This + function is both automatic and transparent to the user (i.e. all + functions operate upon the uncompressed contents of the specified + files). This greatly reduces a file size and loading time, a + particularly great benefit for floppies.(1) (*note + Features-Footnote-1::) + + It is conceivable that some kernel modules should be loaded in a + compressed state, so a different module-loading command can be + specified to avoid uncompressing the modules. + +Access data on any installed device + Support reading data from any or all floppies or hard disk(s) + recognized by the BIOS, independent of the setting of the root + device. + +Be independent of drive geometry translations + Unlike many other boot loaders, GRUB makes the particular drive + translation irrelevant. A drive installed and running with one + translation may be converted to another translation without any + adverse effects or changes in GRUB's configuration. + +Detect all installed RAM + GRUB can generally find all the installed RAM on a PC-compatible + machine. It uses an advanced BIOS query technique for finding all + memory regions. As described on the Multiboot Specification (*note + Multiboot Specification: (multiboot)Top.), not all kernels make + use of this information, but GRUB provides it for those who do. + +Support Logical Block Address mode + In traditional disk calls (called "CHS mode"), there is a geometry + translation problem, that is, the BIOS cannot access over 1024 + cylinders, so the accessible space is limited to at least 508 MB + and to at most 8GB. GRUB can't universally solve this problem, as + there is no standard interface used in all machines. However, + several newer machines have the new interface, Logical Block + Address ("LBA") mode. GRUB automatically detects if LBA mode is + available and uses it if available. In LBA mode, GRUB can access + the entire disk. + +Support network booting + GRUB is basically a disk-based boot loader but also has network + support. You can load OS images from a network by using the "TFTP" + protocol. + +Support remote terminals + To support computers with no console, GRUB provides remote terminal + support, so that you can control GRUB from a remote host. Only + serial terminal support is implemented at the moment. + + +File: grub.info, Node: Features-Footnotes, Up: Features + + (1) There are a few pathological cases where loading a very badly +organized ELF kernel might take longer, but in practice this never +happen. + + +File: grub.info, Node: Role of a boot loader, Prev: Features, Up: Introduction + +The role of a boot loader +========================= + + The following is a quotation from Gordon Matzigkeit, a GRUB fanatic: + + Some people like to acknowledge both the operating system and + kernel when they talk about their computers, so they might say + they use "GNU/Linux" or "GNU/Hurd". Other people seem to think + that the kernel is the most important part of the system, so they + like to call their GNU operating systems "Linux systems." + + I, personally, believe that this is a grave injustice, because the + _boot loader_ is the most important software of all. I used to + refer to the above systems as either "LILO"(1) (*note Role of a + boot loader-Footnote-1::) or "GRUB" systems. + + Unfortunately, nobody ever understood what I was talking about; + now I just use the word "GNU" as a pseudonym for GRUB. + + So, if you ever hear people talking about their alleged "GNU" + systems, remember that they are actually paying homage to the best + boot loader around... GRUB! + + We, the GRUB maintainers, do not (usually) encourage Gordon's level +of fanaticism, but it helps to remember that boot loaders deserve +recognition. We hope that you enjoy using GNU GRUB as much as we did +writing it. + + +File: grub.info, Node: Role of a boot loader-Footnotes, Up: Role of a boot loader + + (1) The LInux LOader, a boot loader that everybody uses, but nobody +likes. + + +File: grub.info, Node: Naming convention, Next: Installation, Prev: Introduction, Up: Top + +Naming convention +***************** + + The device syntax used in GRUB is a wee bit different from what you +may have seen before in your operating system(s), and you need to know +it so that you can specify a drive/partition. + + Look at the following examples and explanations: + + (fd0) + + First of all, GRUB requires that the device name be enclosed with +`(' and `)'. The `fd' part means that it is a floppy disk. The number +`0' is the drive number, which is counted from _zero_. This expression +means that GRUB will use the whole floppy disk. + + (hd0,1) + + Here, `hd' means it is a hard disk drive. The first integer `0' +indicates the drive number, that is, the first hard disk, while the +second integer, `1', indicates the partition number (or the PC slice +number in the BSD terminology). Once again, please note that the +partition numbers are counted from _zero_, not from one. This +expression means the second partition of the first hard disk drive. In +this case, GRUB uses one partition of the disk, instead of the whole +disk. + + (hd0,4) + + This specifies the first "extended partition" of the first hard disk +drive. Note that the partition numbers for extended partitions are +counted from `4', regardless of the actual number of primary partitions +on your hard disk. + + (hd1,a) + + This means the BSD `a' partition of the second hard disk. If you +need to specify which PC slice number should be used, use something +like this: `(hd1,0,a)'. If the PC slice number is omitted, GRUB +searches for the first PC slice which has a BSD `a' partition. + + Of course, to actually access the disks or partitions with GRUB, you +need to use the device specification in a command, like `root (fd0)' or +`unhide (hd0,2)'. To help you find out which number specifies a +partition you want, the GRUB command-line (*note Command-line +interface::) options have argument completion. This means that, for +example, you only need to type + + root ( + + followed by a , and GRUB will display the list of drives, +partitions, or file names. So it should be quite easy to determine the +name of your target partition, even with minimal knowledge of the +syntax. + + Note that GRUB does _not_ distinguish IDE from SCSI - it simply +counts the drive numbers from zero, regardless of their type. Normally, +any IDE drive number is less than any SCSI drive number, although that +is not true if you change the boot sequence by swapping IDE and SCSI +drives in your BIOS. + + Now the question is, how to specify a file? Again, consider an +example: + + (hd0,0)/vmlinuz + + This specifies the file named `vmlinuz', found on the first +partition of the first hard disk drive. Note that the argument +completion works with file names, too. + + That was easy, admit it. Now read the next chapter, to find out how +to actually install GRUB on your drive. + + +File: grub.info, Node: Installation, Next: Booting, Prev: Naming convention, Up: Top + +Installation +************ + + In order to install GRUB as your boot loader, you need to first +install the GRUB system and utilities under your UNIX-like operating +system (*note Obtaining and Building GRUB::). You can do this either +from the source tarball, or as a package for your OS. + + After you have done that, you need to install the boot loader on a +drive (floppy or hard disk). There are two ways of doing that - either +using the utility `grub-install' (*note Invoking grub-install::) on a +UNIX-like OS, or by running GRUB itself from a floppy. These are quite +similar, however the utility might probe a wrong BIOS drive, so you +should be careful. + + Also, if you install GRUB on a UNIX-like OS, please make sure that +you have an emergency boot disk ready, so that you can rescue your +computer if, by any chance, your hard drive becomes unusable +(unbootable). + + GRUB comes with boot images, which are normally put in the directory +`/usr/lib/grub/i386-pc'. If you do not use grub-install, then you need +to copy the files `stage1', `stage2', and `*stage1_5' to the directory +`/boot/grub', and run the `grub-set-default' (*note Invoking +grub-set-default::) if you intend to use `default saved' (*note +default::) in your configuration file. Hereafter, the directory where +GRUB images are initially placed (normally `/usr/lib/grub/i386-pc') +will be called the "image directory", and the directory where the boot +loader needs to find them (usually `/boot/grub') will be called the +"boot directory". + +* Menu: + +* Creating a GRUB boot floppy:: +* Installing GRUB natively:: +* Installing GRUB using grub-install:: +* Making a GRUB bootable CD-ROM:: + + +File: grub.info, Node: Creating a GRUB boot floppy, Next: Installing GRUB natively, Up: Installation + +Creating a GRUB boot floppy +=========================== + + To create a GRUB boot floppy, you need to take the files `stage1' +and `stage2' from the image directory, and write them to the first and +the second block of the floppy disk, respectively. + + *Caution:* This procedure will destroy any data currently stored on +the floppy. + + On a UNIX-like operating system, that is done with the following +commands: + + # cd /usr/lib/grub/i386-pc + # dd if=stage1 of=/dev/fd0 bs=512 count=1 + 1+0 records in + 1+0 records out + # dd if=stage2 of=/dev/fd0 bs=512 seek=1 + 153+1 records in + 153+1 records out + # + + The device file name may be different. Consult the manual for your +OS. + + +File: grub.info, Node: Installing GRUB natively, Next: Installing GRUB using grub-install, Prev: Creating a GRUB boot floppy, Up: Installation + +Installing GRUB natively +======================== + + *Caution:* Installing GRUB's stage1 in this manner will erase the +normal boot-sector used by an OS. + + GRUB can currently boot GNU Mach, Linux, FreeBSD, NetBSD, and OpenBSD +directly, so using it on a boot sector (the first sector of a +partition) should be okay. But generally, it would be a good idea to +back up the first sector of the partition on which you are installing +GRUB's stage1. This isn't as important if you are installing GRUB on +the first sector of a hard disk, since it's easy to reinitialize it +(e.g. by running `FDISK /MBR' from DOS). + + If you decide to install GRUB in the native environment, which is +definitely desirable, you'll need to create a GRUB boot disk, and +reboot your computer with it. Otherwise, see *Note Installing GRUB +using grub-install::. + + Once started, GRUB will show the command-line interface (*note +Command-line interface::). First, set the GRUB's "root device"(1) +(*note Installing GRUB natively-Footnote-1::) to the partition +containing the boot directory, like this: + + grub> root (hd0,0) + + If you are not sure which partition actually holds this directory, +use the command `find' (*note find::), like this: + + grub> find /boot/grub/stage1 + + This will search for the file name `/boot/grub/stage1' and show the +devices which contain the file. + + Once you've set the root device correctly, run the command `setup' +(*note setup::): + + grub> setup (hd0) + + This command will install the GRUB boot loader on the Master Boot +Record (MBR) of the first drive. If you want to put GRUB into the boot +sector of a partition instead of putting it in the MBR, specify the +partition into which you want to install GRUB: + + grub> setup (hd0,0) + + If you install GRUB into a partition or a drive other than the first +one, you must chain-load GRUB from another boot loader. Refer to the +manual for the boot loader to know how to chain-load GRUB. + + After using the setup command, you will boot into GRUB without the +GRUB floppy. See the chapter *Note Booting:: to find out how to boot +your operating systems from GRUB. + + +File: grub.info, Node: Installing GRUB natively-Footnotes, Up: Installing GRUB natively + + (1) Note that GRUB's root device doesn't necessarily mean your OS's +root partition; if you need to specify a root partition for your OS, +add the argument into the command `kernel'. + + +File: grub.info, Node: Installing GRUB using grub-install, Next: Making a GRUB bootable CD-ROM, Prev: Installing GRUB natively, Up: Installation + +Installing GRUB using grub-install +================================== + + *Caution:* This procedure is definitely less safe, because there are +several ways in which your computer can become unbootable. For example, +most operating systems don't tell GRUB how to map BIOS drives to OS +devices correctly--GRUB merely "guesses" the mapping. This will succeed +in most cases, but not always. Therefore, GRUB provides you with a map +file called the "device map", which you must fix if it is wrong. *Note +Device map::, for more details. + + If you still do want to install GRUB under a UNIX-like OS (such as +GNU), invoke the program `grub-install' (*note Invoking grub-install::) +as the superuser ("root"). + + The usage is basically very simple. You only need to specify one +argument to the program, namely, where to install the boot loader. The +argument can be either a device file (like `/dev/hda') or a partition +specified in GRUB's notation. For example, under Linux the following +will install GRUB into the MBR of the first IDE disk: + + # grub-install /dev/hda + + Likewise, under GNU/Hurd, this has the same effect: + + # grub-install /dev/hd0 + + If it is the first BIOS drive, this is the same as well: + + # grub-install '(hd0)' + + Or you can omit the parentheses: + + # grub-install hd0 + + But all the above examples assume that GRUB should use images under +the root directory. If you want GRUB to use images under a directory +other than the root directory, you need to specify the option +`--root-directory'. The typical usage is that you create a GRUB boot +floppy with a filesystem. Here is an example: + + # mke2fs /dev/fd0 + # mount -t ext2 /dev/fd0 /mnt + # grub-install --root-directory=/mnt fd0 + # umount /mnt + + Another example is when you have a separate boot partition which is +mounted at `/boot'. Since GRUB is a boot loader, it doesn't know +anything about mountpoints at all. Thus, you need to run `grub-install' +like this: + + # grub-install --root-directory=/boot /dev/hda + + By the way, as noted above, it is quite difficult to guess BIOS +drives correctly under a UNIX-like OS. Thus, `grub-install' will prompt +you to check if it could really guess the correct mappings, after the +installation. The format is defined in *Note Device map::. Please be +quite careful. If the output is wrong, it is unlikely that your +computer will be able to boot with no problem. + + Note that `grub-install' is actually just a shell script and the +real task is done by the grub shell `grub' (*note Invoking the grub +shell::). Therefore, you may run `grub' directly to install GRUB, +without using `grub-install'. Don't do that, however, unless you are +very familiar with the internals of GRUB. Installing a boot loader on a +running OS may be extremely dangerous. + + +File: grub.info, Node: Making a GRUB bootable CD-ROM, Prev: Installing GRUB using grub-install, Up: Installation + +Making a GRUB bootable CD-ROM +============================= + + GRUB supports the "no emulation mode" in the El Torito +specification(1) (*note Making a GRUB bootable CD-ROM-Footnote-1::). +This means that you can use the whole CD-ROM from GRUB and you don't +have to make a floppy or hard disk image file, which can cause +compatibility problems. + + For booting from a CD-ROM, GRUB uses a special Stage 2 called +`stage2_eltorito'. The only GRUB files you need to have in your +bootable CD-ROM are this `stage2_eltorito' and optionally a config file +`menu.lst'. You don't need to use `stage1' or `stage2', because El +Torito is quite different from the standard boot process. + + Here is an example of procedures to make a bootable CD-ROM image. +First, make a top directory for the bootable image, say, `iso': + + $ mkdir iso + + Make a directory for GRUB: + + $ mkdir -p iso/boot/grub + + Copy the file `stage2_eltorito': + + $ cp /usr/lib/grub/i386-pc/stage2_eltorito iso/boot/grub + + If desired, make the config file `menu.lst' under `iso/boot/grub' +(*note Configuration::), and copy any files and directories for the +disc to the directory `iso/'. + + Finally, make a ISO9660 image file like this: + + $ mkisofs -R -b boot/grub/stage2_eltorito -no-emul-boot \ + -boot-load-size 4 -boot-info-table -o grub.iso iso + + This produces a file named `grub.iso', which then can be burned into +a CD (or a DVD). `mkisofs' has already set up the disc to boot from +the `boot/grub/stage2_eltorito' file, so there is no need to setup GRUB +on the disc. (Note that the `-boot-load-size 4' bit is required for +compatibility with the BIOS on many older machines.) + + You can use the device `(cd)' to access a CD-ROM in your config +file. This is not required; GRUB automatically sets the root device to +`(cd)' when booted from a CD-ROM. It is only necessary to refer to +`(cd)' if you want to access other drives as well. + + +File: grub.info, Node: Making a GRUB bootable CD-ROM-Footnotes, Up: Making a GRUB bootable CD-ROM + + (1) El Torito is a specification for bootable CD using BIOS +functions. + + +File: grub.info, Node: Booting, Next: Configuration, Prev: Installation, Up: Top + +Booting +******* + + GRUB can load Multiboot-compliant kernels in a consistent way, but +for some free operating systems you need to use some OS-specific magic. + +* Menu: + +* General boot methods:: How to boot OSes with GRUB generally +* OS-specific notes:: Notes on some operating systems +* Making your system robust:: How to make your system robust + + +File: grub.info, Node: General boot methods, Next: OS-specific notes, Up: Booting + +How to boot operating systems +============================= + + GRUB has two distinct boot methods. One of the two is to load an +operating system directly, and the other is to chain-load another boot +loader which then will load an operating system actually. Generally +speaking, the former is more desirable, because you don't need to +install or maintain other boot loaders and GRUB is flexible enough to +load an operating system from an arbitrary disk/partition. However, the +latter is sometimes required, since GRUB doesn't support all the +existing operating systems natively. + +* Menu: + +* Loading an operating system directly:: +* Chain-loading:: + + +File: grub.info, Node: Loading an operating system directly, Next: Chain-loading, Up: General boot methods + +How to boot an OS directly with GRUB +------------------------------------ + + Multiboot (*note Multiboot Specification: (multiboot)Top.) is the +native format supported by GRUB. For the sake of convenience, there is +also support for Linux, FreeBSD, NetBSD and OpenBSD. If you want to +boot other operating systems, you will have to chain-load them (*note +Chain-loading::). + + Generally, GRUB can boot any Multiboot-compliant OS in the following +steps: + + 1. Set GRUB's root device to the drive where the OS images are stored + with the command `root' (*note root::). + + 2. Load the kernel image with the command `kernel' (*note kernel::). + + 3. If you need modules, load them with the command `module' (*note + module::) or `modulenounzip' (*note modulenounzip::). + + 4. Run the command `boot' (*note boot::). + + Linux, FreeBSD, NetBSD and OpenBSD can be booted in a similar +manner. You load a kernel image with the command `kernel' and then run +the command `boot'. If the kernel requires some parameters, just append +the parameters to `kernel', after the file name of the kernel. Also, +please refer to *Note OS-specific notes::, for information on your +OS-specific issues. + + +File: grub.info, Node: Chain-loading, Prev: Loading an operating system directly, Up: General boot methods + +Load another boot loader to boot unsupported operating systems +-------------------------------------------------------------- + + If you want to boot an unsupported operating system (e.g. Windows +95), chain-load a boot loader for the operating system. Normally, the +boot loader is embedded in the "boot sector" of the partition on which +the operating system is installed. + + 1. Set GRUB's root device to the partition by the command + `rootnoverify' (*note rootnoverify::): + + grub> rootnoverify (hd0,0) + + 2. Set the "active" flag in the partition using the command + `makeactive'(1) (*note Chain-loading-Footnote-1::) (*note + makeactive::): + + grub> makeactive + + 3. Load the boot loader with the command `chainloader' (*note + chainloader::): + + grub> chainloader +1 + + `+1' indicates that GRUB should read one sector from the start of + the partition. The complete description about this syntax can be + found in *Note Block list syntax::. + + 4. Run the command `boot' (*note boot::). + + However, DOS and Windows have some deficiencies, so you might have to +use more complicated instructions. *Note DOS/Windows::, for more +information. + + +File: grub.info, Node: Chain-loading-Footnotes, Up: Chain-loading + + (1) This is not necessary for most of the modern operating systems. + + +File: grub.info, Node: OS-specific notes, Next: Making your system robust, Prev: General boot methods, Up: Booting + +Some caveats on OS-specific issues +================================== + + Here, we describe some caveats on several operating systems. + +* Menu: + +* GNU/Hurd:: +* GNU/Linux:: +* FreeBSD:: +* NetBSD:: +* OpenBSD:: +* DOS/Windows:: +* SCO UnixWare:: +* QNX:: + + +File: grub.info, Node: GNU/Hurd, Next: GNU/Linux, Up: OS-specific notes + +GNU/Hurd +-------- + + Since GNU/Hurd is Multiboot-compliant, it is easy to boot it; there +is nothing special about it. But do not forget that you have to specify +a root partition to the kernel. + + 1. Set GRUB's root device to the same drive as GNU/Hurd's. Probably + the command `find /boot/gnumach' or similar can help you (*note + find::). + + 2. Load the kernel and the module, like this: + + grub> kernel /boot/gnumach root=hd0s1 + grub> module /boot/serverboot + + 3. Run the command `boot' (*note boot::). + + +File: grub.info, Node: GNU/Linux, Next: FreeBSD, Prev: GNU/Hurd, Up: OS-specific notes + +GNU/Linux +--------- + + It is relatively easy to boot GNU/Linux from GRUB, because it +somewhat resembles to boot a Multiboot-compliant OS. + + 1. Set GRUB's root device to the same drive as GNU/Linux's. Probably + the command `find /vmlinuz' or similar can help you (*note find::). + + 2. Load the kernel: + + grub> kernel /vmlinuz root=/dev/hda1 + + If you need to specify some kernel parameters, just append them to + the command. For example, to set `vga' to `ext', do this: + + grub> kernel /vmlinuz root=/dev/hda1 vga=ext + + See the documentation in the Linux source tree for complete + information on the available options. + + 3. If you use an initrd, execute the command `initrd' (*note + initrd::) after `kernel': + + grub> initrd /initrd + + 4. Finally, run the command `boot' (*note boot::). + + *Caution:* If you use an initrd and specify the `mem=' option to the +kernel to let it use less than actual memory size, you will also have +to specify the same memory size to GRUB. To let GRUB know the size, run +the command `uppermem' _before_ loading the kernel. *Note uppermem::, +for more information. + + +File: grub.info, Node: FreeBSD, Next: NetBSD, Prev: GNU/Linux, Up: OS-specific notes + +FreeBSD +------- + + GRUB can load the kernel directly, either in ELF or a.out format. But +this is not recommended, since FreeBSD's bootstrap interface sometimes +changes heavily, so GRUB can't guarantee to pass kernel parameters +correctly. + + Thus, we'd recommend loading the very flexible loader `/boot/loader' +instead. See this example: + + grub> root (hd0,a) + grub> kernel /boot/loader + grub> boot + + +File: grub.info, Node: NetBSD, Next: OpenBSD, Prev: FreeBSD, Up: OS-specific notes + +NetBSD +------ + + GRUB can load NetBSD a.out and ELF directly, follow these steps: + + 1. Set GRUB's root device with `root' (*note root::). + + 2. Load the kernel with `kernel' (*note kernel::). You should append + the ugly option `--type=netbsd', if you want to load an ELF + kernel, like this: + + grub> kernel --type=netbsd /netbsd-elf + + 3. Run `boot' (*note boot::). + + For now, however, GRUB doesn't allow you to pass kernel parameters, +so it may be better to chain-load it instead. For more information, +please see *Note Chain-loading::. + + +File: grub.info, Node: OpenBSD, Next: DOS/Windows, Prev: NetBSD, Up: OS-specific notes + +OpenBSD +------- + + The booting instruction is exactly the same as for NetBSD (*note +NetBSD::). + + +File: grub.info, Node: DOS/Windows, Next: SCO UnixWare, Prev: OpenBSD, Up: OS-specific notes + +DOS/Windows +----------- + + GRUB cannot boot DOS or Windows directly, so you must chain-load them +(*note Chain-loading::). However, their boot loaders have some critical +deficiencies, so it may not work to just chain-load them. To overcome +the problems, GRUB provides you with two helper functions. + + If you have installed DOS (or Windows) on a non-first hard disk, you +have to use the disk swapping technique, because that OS cannot boot +from any disks but the first one. The workaround used in GRUB is the +command `map' (*note map::), like this: + + grub> map (hd0) (hd1) + grub> map (hd1) (hd0) + + This performs a "virtual" swap between your first and second hard +drive. + + *Caution:* This is effective only if DOS (or Windows) uses BIOS to +access the swapped disks. If that OS uses a special driver for the +disks, this probably won't work. + + Another problem arises if you installed more than one set of +DOS/Windows onto one disk, because they could be confused if there are +more than one primary partitions for DOS/Windows. Certainly you should +avoid doing this, but there is a solution if you do want to do so. Use +the partition hiding/unhiding technique. + + If GRUB "hide"s a DOS (or Windows) partition (*note hide::), DOS (or +Windows) will ignore the partition. If GRUB "unhide"s a DOS (or +Windows) partition (*note unhide::), DOS (or Windows) will detect the +partition. Thus, if you have installed DOS (or Windows) on the first +and the second partition of the first hard disk, and you want to boot +the copy on the first partition, do the following: + + grub> unhide (hd0,0) + grub> hide (hd0,1) + grub> rootnoverify (hd0,0) + grub> chainloader +1 + grub> makeactive + grub> boot + + +File: grub.info, Node: SCO UnixWare, Next: QNX, Prev: DOS/Windows, Up: OS-specific notes + +SCO UnixWare +------------ + + It is known that the signature in the boot loader for SCO UnixWare is +wrong, so you will have to specify the option `--force' to +`chainloader' (*note chainloader::), like this: + + grub> rootnoverify (hd1,0) + grub> chainloader --force +1 + grub> makeactive + grub> boot + + +File: grub.info, Node: QNX, Prev: SCO UnixWare, Up: OS-specific notes + +QNX +--- + + QNX seems to use a bigger boot loader, so you need to boot it up, +like this: + + grub> rootnoverify (hd1,1) + grub> chainloader +4 + grub> boot + + +File: grub.info, Node: Making your system robust, Prev: OS-specific notes, Up: Booting + +How to make your system robust +============================== + + When you test a new kernel or a new OS, it is important to make sure +that your computer can boot even if the new system is unbootable. This +is crucial especially if you maintain servers or remote systems. To +accomplish this goal, you need to set up two things: + + 1. You must maintain a system which is always bootable. For instance, + if you test a new kernel, you need to keep a working kernel in a + different place. And, it would sometimes be very nice to even have + a complete copy of a working system in a different partition or + disk. + + 2. You must direct GRUB to boot a working system when the new system + fails. This is possible with the "fallback" system in GRUB. + + The former requirement is very specific to each OS, so this +documentation does not cover that topic. It is better to consult some +backup tools. + + So let's see the GRUB part. There are two possibilities: one of them +is quite simple but not very robust, and the other is a bit complex to +set up but probably the best solution to make sure that your system can +start as long as GRUB itself is bootable. + +* Menu: + +* Booting once-only:: +* Booting fallback systems:: + + +File: grub.info, Node: Booting once-only, Next: Booting fallback systems, Up: Making your system robust + +Booting once-only +----------------- + + You can teach GRUB to boot an entry only at next boot time. Suppose +that your have an old kernel `old_kernel' and a new kernel +`new_kernel'. You know that `old_kernel' can boot your system +correctly, and you want to test `new_kernel'. + + To ensure that your system will go back to the old kernel even if the +new kernel fails (e.g. it panics), you can specify that GRUB should try +the new kernel only once and boot the old kernel after that. + + First, modify your configuration file. Here is an example: + + default saved # This is important!!! + timeout 10 + + title the old kernel + root (hd0,0) + kernel /old_kernel + savedefault + + title the new kernel + root (hd0,0) + kernel /new_kernel + savedefault 0 # This is important!!! + + Note that this configuration file uses `default saved' (*note +default::) at the head and `savedefault 0' (*note savedefault::) in the +entry for the new kernel. This means that GRUB boots a saved entry by +default, and booting the entry for the new kernel saves `0' as the +saved entry. + + With this configuration file, after all, GRUB always tries to boot +the old kernel after it booted the new one, because `0' is the entry of +`the old kernel'. + + The next step is to tell GRUB to boot the new kernel at next boot +time. For this, execute `grub-set-default' (*note Invoking +grub-set-default::): + + # grub-set-default 1 + + This command sets the saved entry to `1', that is, to the new kernel. + + This method is useful, but still not very robust, because GRUB stops +booting, if there is any error in the boot entry, such that the new +kernel has an invalid executable format. Thus, it it even better to use +the "fallback" mechanism of GRUB. Look at next subsection for this +feature. + + +File: grub.info, Node: Booting fallback systems, Prev: Booting once-only, Up: Making your system robust + +Booting fallback systems +------------------------ + + GRUB supports a fallback mechanism of booting one or more other +entries if a default boot entry fails. You can specify multiple +fallback entries if you wish. + + Suppose that you have three systems, `A', `B' and `C'. `A' is a +system which you want to boot by default. `B' is a backup system which +is supposed to boot safely. `C' is another backup system which is used +in case where `B' is broken. + + Then you may want GRUB to boot the first system which is bootable +among `A', `B' and `C'. A configuration file can be written in this way: + + default saved # This is important!!! + timeout 10 + fallback 1 2 # This is important!!! + + title A + root (hd0,0) + kernel /kernel + savedefault fallback # This is important!!! + + title B + root (hd1,0) + kernel /kernel + savedefault fallback # This is important!!! + + title C + root (hd2,0) + kernel /kernel + savedefault + + Note that `default saved' (*note default::), `fallback 1 2' and +`savedefault fallback' are used. GRUB will boot a saved entry by +default and save a fallback entry as next boot entry with this +configuration. + + When GRUB tries to boot `A', GRUB saves `1' as next boot entry, +because the command `fallback' specifies that `1' is the first fallback +entry. The entry `1' is `B', so GRUB will try to boot `B' at next boot +time. + + Likewise, when GRUB tries to boot `B', GRUB saves `2' as next boot +entry, because `fallback' specifies `2' as next fallback entry. This +makes sure that GRUB will boot `C' after booting `B'. + + It is noteworthy that GRUB uses fallback entries both when GRUB +itself fails in booting an entry and when `A' or `B' fails in starting +up your system. So this solution ensures that your system is started +even if GRUB cannot find your kernel or if your kernel panics. + + However, you need to run `grub-set-default' (*note Invoking +grub-set-default::) when `A' starts correctly or you fix `A' after it +crashes, since GRUB always sets next boot entry to a fallback entry. +You should run this command in a startup script such as `rc.local' to +boot `A' by default: + + # grub-set-default 0 + + where `0' is the number of the boot entry for the system `A'. + + If you want to see what is current default entry, you can look at the +file `/boot/grub/default' (or `/grub/default' in some systems). Because +this file is plain-text, you can just `cat' this file. But it is +strongly recommended *not to modify this file directly*, because GRUB +may fail in saving a default entry in this file, if you change this +file in an unintended manner. Therefore, you should use +`grub-set-default' when you need to change the default entry. + + +File: grub.info, Node: Configuration, Next: Network, Prev: Booting, Up: Top + +Configuration +************* + + You've probably noticed that you need to type several commands to +boot your OS. There's a solution to that - GRUB provides a menu +interface (*note Menu interface::) from which you can select an item +(using arrow keys) that will do everything to boot an OS. + + To enable the menu, you need a configuration file, `menu.lst' under +the boot directory. We'll analyze an example file. + + The file first contains some general settings, the menu interface +related options. You can put these commands (*note Menu-specific +commands::) before any of the items (starting with `title' (*note +title::)). + + # + # Sample boot menu configuration file + # + + As you may have guessed, these lines are comments. Lines starting +with a hash character (`#'), and blank lines, are ignored by GRUB. + + # By default, boot the first entry. + default 0 + + The first entry (here, counting starts with number zero, not one!) +will be the default choice. + + # Boot automatically after 30 secs. + timeout 30 + + As the comment says, GRUB will boot automatically in 30 seconds, +unless interrupted with a keypress. + + # Fallback to the second entry. + fallback 1 + + If, for any reason, the default entry doesn't work, fall back to the +second one (this is rarely used, for obvious reasons). + + Note that the complete descriptions of these commands, which are menu +interface specific, can be found in *Note Menu-specific commands::. +Other descriptions can be found in *Note Commands::. + + Now, on to the actual OS definitions. You will see that each entry +begins with a special command, `title' (*note title::), and the action +is described after it. Note that there is no command `boot' (*note +boot::) at the end of each item. That is because GRUB automatically +executes `boot' if it loads other commands successfully. + + The argument for the command `title' is used to display a short +title/description of the entry in the menu. Since `title' displays the +argument as is, you can write basically anything there. + + # For booting GNU/Hurd + title GNU/Hurd + root (hd0,0) + kernel /boot/gnumach.gz root=hd0s1 + module /boot/serverboot.gz + + This boots GNU/Hurd from the first hard disk. + + # For booting GNU/Linux + title GNU/Linux + kernel (hd1,0)/vmlinuz root=/dev/hdb1 + + This boots GNU/Linux, but from the second hard disk. + + # For booting Mach (getting kernel from floppy) + title Utah Mach4 multiboot + root (hd0,2) + pause Insert the diskette now^G!! + kernel (fd0)/boot/kernel root=hd0s3 + module (fd0)/boot/bootstrap + + This boots Mach with a kernel on a floppy, but the root filesystem at +hd0s3. It also contains a `pause' line (*note pause::), which will +cause GRUB to display a prompt and delay, before actually executing the +rest of the commands and booting. + + # For booting FreeBSD + title FreeBSD + root (hd0,2,a) + kernel /boot/loader + + This item will boot FreeBSD kernel loaded from the `a' partition of +the third PC slice of the first hard disk. + + # For booting OS/2 + title OS/2 + root (hd0,1) + makeactive + # chainload OS/2 bootloader from the first sector + chainloader +1 + # This is similar to "chainload", but loads a specific file + #chainloader /boot/chain.os2 + + This will boot OS/2, using a chain-loader (*note Chain-loading::). + + # For booting Windows NT or Windows95 + title Windows NT / Windows 95 boot menu + root (hd0,0) + makeactive + chainloader +1 + # For loading DOS if Windows NT is installed + # chainload /bootsect.dos + + The same as the above, but for Windows. + + # For installing GRUB into the hard disk + title Install GRUB into the hard disk + root (hd0,0) + setup (hd0) + + This will just (re)install GRUB onto the hard disk. + + # Change the colors. + title Change the colors + color light-green/brown blink-red/blue + + In the last entry, the command `color' is used (*note color::), to +change the menu colors (try it!). This command is somewhat special, +because it can be used both in the command-line and in the menu. GRUB +has several such commands, see *Note General commands::. + + We hope that you now understand how to use the basic features of +GRUB. To learn more about GRUB, see the following chapters. + + +File: grub.info, Node: Network, Next: Serial terminal, Prev: Configuration, Up: Top + +Downloading OS images from a network +************************************ + + Although GRUB is a disk-based boot loader, it does provide network +support. To use the network support, you need to enable at least one +network driver in the GRUB build process. For more information please +see `netboot/README.netboot' in the source distribution. + +* Menu: + +* General usage of network support:: +* Diskless:: + + +File: grub.info, Node: General usage of network support, Next: Diskless, Up: Network + +How to set up your network +========================== + + GRUB requires a file server and optionally a server that will assign +an IP address to the machine on which GRUB is running. For the former, +only TFTP is supported at the moment. The latter is either BOOTP, DHCP +or a RARP server(1) (*note General usage of network +support-Footnote-1::). It is not necessary to run both the servers on +one computer. How to configure these servers is beyond the scope of this +document, so please refer to the manuals specific to those +protocols/servers. + + If you decided to use a server to assign an IP address, set up the +server and run `bootp' (*note bootp::), `dhcp' (*note dhcp::) or `rarp' +(*note rarp::) for BOOTP, DHCP or RARP, respectively. Each command will +show an assigned IP address, a netmask, an IP address for your TFTP +server and a gateway. If any of the addresses is wrong or it causes an +error, probably the configuration of your servers isn't set up properly. + + Otherwise, run `ifconfig', like this: + + grub> ifconfig --address=192.168.110.23 --server=192.168.110.14 + + You can also use `ifconfig' in conjuction with `bootp', `dhcp' or +`rarp' (e.g. to reassign the server address manually). *Note +ifconfig::, for more details. + + Finally, download your OS images from your network. The network can +be accessed using the network drive `(nd)'. Everything else is very +similar to the normal instructions (*note Booting::). + + Here is an example: + + grub> bootp + Probing... [NE*000] + NE2000 base ... + Address: 192.168.110.23 Netmask: 255.255.255.0 + Server: 192.168.110.14 Gateway: 192.168.110.1 + + grub> root (nd) + grub> kernel /tftproot/gnumach.gz root=sd0s1 + grub> module /tftproot/serverboot.gz + grub> boot + + +File: grub.info, Node: General usage of network support-Footnotes, Up: General usage of network support + + (1) RARP is not advised, since it cannot serve much information + diff --git a/usr/src/grub/grub-0.97/docs/grub.info-2 b/usr/src/grub/grub-0.97/docs/grub.info-2 new file mode 100644 index 0000000000..d6262affb1 --- /dev/null +++ b/usr/src/grub/grub-0.97/docs/grub.info-2 @@ -0,0 +1,1436 @@ +This is grub.info, produced by makeinfo version 4.0 from grub.texi. + +INFO-DIR-SECTION Kernel +START-INFO-DIR-ENTRY +* GRUB: (grub). The GRand Unified Bootloader +* grub-install: (grub)Invoking grub-install. Install GRUB on your drive +* grub-md5-crypt: (grub)Invoking grub-md5-crypt. Encrypt a password + in MD5 format +* grub-terminfo: (grub)Invoking grub-terminfo. Generate a terminfo + command from a + terminfo name +* grub-set-default: (grub)Invoking grub-set-default. Set a default boot + entry +* mbchk: (grub)Invoking mbchk. Check for the format of a Multiboot kernel +END-INFO-DIR-ENTRY + + Copyright (C) 1999,2000,2001,2002,2004 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: grub.info, Node: Diskless, Prev: General usage of network support, Up: Network + +Booting from a network +====================== + + It is sometimes very useful to boot from a network, especially when +you use a machine which has no local disk. In this case, you need to +obtain a kind of Net Boot ROM, such as a PXE ROM or a free software +package like Etherboot. Such a Boot ROM first boots the machine, sets +up the network card installed into the machine, and downloads a second +stage boot image from the network. Then, the second image will try to +boot an operating system actually from the network. + + GRUB provides two second stage images, `nbgrub' and `pxegrub' (*note +Images::). These images are the same as the normal Stage 2, except that +they set up a network automatically, and try to load a configuration +file from the network, if specified. The usage is very simple: If the +machine has a PXE ROM, use `pxegrub'. If the machine has an NBI loader +such as Etherboot, use `nbgrub'. There is no difference between them +except their formats. Since the way to load a second stage image you +want to use should be described in the manual on your Net Boot ROM, +please refer to the manual, for more information. + + However, there is one thing specific to GRUB. Namely, how to specify +a configuration file in a BOOTP/DHCP server. For now, GRUB uses the tag +`150', to get the name of a configuration file. The following is an +example with a BOOTP configuration: + + .allhost:hd=/tmp:bf=null:\ + :ds=145.71.35.1 145.71.32.1:\ + :sm=255.255.254.0:\ + :gw=145.71.35.1:\ + :sa=145.71.35.5: + + foo:ht=1:ha=63655d0334a7:ip=145.71.35.127:\ + :bf=/nbgrub:\ + :tc=.allhost:\ + :T150="(nd)/tftpboot/menu.lst.foo": + + Note that you should specify the drive name `(nd)' in the name of +the configuration file. This is because you might change the root drive +before downloading the configuration from the TFTP server when the +preset menu feature is used (*note Preset Menu::). + + See the manual of your BOOTP/DHCP server for more information. The +exact syntax should differ a little from the example. + + +File: grub.info, Node: Serial terminal, Next: Preset Menu, Prev: Network, Up: Top + +Using GRUB via a serial line +**************************** + + This chapter describes how to use the serial terminal support in +GRUB. + + If you have many computers or computers with no display/keyboard, it +could be very useful to control the computers through serial +communications. To connect one computer with another via a serial line, +you need to prepare a null-modem (cross) serial cable, and you may need +to have multiport serial boards, if your computer doesn't have extra +serial ports. In addition, a terminal emulator is also required, such as +minicom. Refer to a manual of your operating system, for more +information. + + As for GRUB, the instruction to set up a serial terminal is quite +simple. First of all, make sure that you haven't specified the option +`--disable-serial' to the configure script when you built your GRUB +images. If you get them in binary form, probably they have serial +terminal support already. + + Then, initialize your serial terminal after GRUB starts up. Here is +an example: + + grub> serial --unit=0 --speed=9600 + grub> terminal serial + + The command `serial' initializes the serial unit 0 with the speed +9600bps. The serial unit 0 is usually called `COM1', so, if you want to +use COM2, you must specify `--unit=1' instead. This command accepts +many other options, so please refer to *Note serial::, for more details. + + The command `terminal' (*note terminal::) chooses which type of +terminal you want to use. In the case above, the terminal will be a +serial terminal, but you can also pass `console' to the command, as +`terminal serial console'. In this case, a terminal in which you press +any key will be selected as a GRUB terminal. + + However, note that GRUB assumes that your terminal emulator is +compatible with VT100 by default. This is true for most terminal +emulators nowadays, but you should pass the option `--dumb' to the +command if your terminal emulator is not VT100-compatible or implements +few VT100 escape sequences. If you specify this option then GRUB +provides you with an alternative menu interface, because the normal +menu requires several fancy features of your terminal. + + +File: grub.info, Node: Preset Menu, Next: Security, Prev: Serial terminal, Up: Top + +Embedding a configuration file into GRUB +**************************************** + + GRUB supports a "preset menu" which is to be always loaded before +starting. The preset menu feature is useful, for example, when your +computer has no console but a serial cable. In this case, it is +critical to set up the serial terminal as soon as possible, since you +cannot see any message until the serial terminal begins to work. So it +is good to run the commands `serial' (*note serial::) and `terminal' +(*note terminal::) before anything else at the start-up time. + + How the preset menu works is slightly complicated: + + 1. GRUB checks if the preset menu feature is used, and loads the + preset menu, if available. This includes running commands and + reading boot entries, like an ordinary configuration file. + + 2. GRUB checks if the configuration file is available. Note that this + check is performed *regardless of the existence of the preset + menu*. The configuration file is loaded even if the preset menu was + loaded. + + 3. If the preset menu includes any boot entries, they are cleared when + the configuration file is loaded. It doesn't matter whether the + configuration file has any entries or no entry. The boot entries + in the preset menu are used only when GRUB fails in loading the + configuration file. + + To enable the preset menu feature, you must rebuild GRUB specifying a +file to the configure script with the option `--enable-preset-menu'. +The file has the same semantics as normal configuration files (*note +Configuration::). + + Another point you should take care is that the diskless support +(*note Diskless::) diverts the preset menu. Diskless images embed a +preset menu to execute the command `bootp' (*note bootp::) +automatically, unless you specify your own preset menu to the configure +script. This means that you must put commands to initialize a network in +the preset menu yourself, because diskless images don't set it up +implicitly, when you use the preset menu explicitly. + + Therefore, a typical preset menu used with diskless support would be +like this: + + # Set up the serial terminal, first of all. + serial --unit=0 --speed=19200 + terminal --timeout=0 serial + + # Initialize the network. + dhcp + + +File: grub.info, Node: Security, Next: Images, Prev: Preset Menu, Up: Top + +Protecting your computer from cracking +************************************** + + You may be interested in how to prevent ordinary users from doing +whatever they like, if you share your computer with other people. So +this chapter describes how to improve the security of GRUB. + + One thing which could be a security hole is that the user can do too +many things with GRUB, because GRUB allows one to modify its +configuration and run arbitrary commands at run-time. For example, the +user can even read `/etc/passwd' in the command-line interface by the +command `cat' (*note cat::). So it is necessary to disable all the +interactive operations. + + Thus, GRUB provides a "password" feature, so that only administrators +can start the interactive operations (i.e. editing menu entries and +entering the command-line interface). To use this feature, you need to +run the command `password' in your configuration file (*note +password::), like this: + + password --md5 PASSWORD + + If this is specified, GRUB disallows any interactive control, until +you press the key

and enter a correct password. The option `--md5' +tells GRUB that `PASSWORD' is in MD5 format. If it is omitted, GRUB +assumes the `PASSWORD' is in clear text. + + You can encrypt your password with the command `md5crypt' (*note +md5crypt::). For example, run the grub shell (*note Invoking the grub +shell::), and enter your password: + + grub> md5crypt + Password: ********** + Encrypted: $1$U$JK7xFegdxWH6VuppCUSIb. + + Then, cut and paste the encrypted password to your configuration +file. + + Also, you can specify an optional argument to `password'. See this +example: + + password PASSWORD /boot/grub/menu-admin.lst + + In this case, GRUB will load `/boot/grub/menu-admin.lst' as a +configuration file when you enter the valid password. + + Another thing which may be dangerous is that any user can choose any +menu entry. Usually, this wouldn't be problematic, but you might want to +permit only administrators to run some of your menu entries, such as an +entry for booting an insecure OS like DOS. + + GRUB provides the command `lock' (*note lock::). This command always +fails until you enter the valid password, so you can use it, like this: + + title Boot DOS + lock + rootnoverify (hd0,1) + makeactive + chainload +1 + + You should insert `lock' right after `title', because any user can +execute commands in an entry until GRUB encounters `lock'. + + You can also use the command `password' instead of `lock'. In this +case the boot process will ask for the password and stop if it was +entered incorrectly. Since the `password' takes its own PASSWORD +argument this is useful if you want different passwords for different +entries. + + +File: grub.info, Node: Images, Next: Filesystem, Prev: Security, Up: Top + +GRUB image files +**************** + + GRUB consists of several images: two essential stages, optional +stages called "Stage 1.5", one image for bootable CD-ROM, and two +network boot images. Here is a short overview of them. *Note +Internals::, for more details. + +`stage1' + This is an essential image used for booting up GRUB. Usually, this + is embedded in an MBR or the boot sector of a partition. Because a + PC boot sector is 512 bytes, the size of this image is exactly 512 + bytes. + + All `stage1' must do is to load Stage 2 or Stage 1.5 from a local + disk. Because of the size restriction, `stage1' encodes the + location of Stage 2 (or Stage 1.5) in a block list format, so it + never understand any filesystem structure. + +`stage2' + This is the core image of GRUB. It does everything but booting up + itself. Usually, this is put in a filesystem, but that is not + required. + +`e2fs_stage1_5' +`fat_stage1_5' +`ffs_stage1_5' +`jfs_stage1_5' +`minix_stage1_5' +`reiserfs_stage1_5' +`vstafs_stage1_5' +`xfs_stage1_5' + These are called "Stage 1.5", because they serve as a bridge + between `stage1' and `stage2', that is to say, Stage 1.5 is loaded + by Stage 1 and Stage 1.5 loads Stage 2. The difference between + `stage1' and `*_stage1_5' is that the former doesn't understand + any filesystem while the latter understands one filesystem (e.g. + `e2fs_stage1_5' understands ext2fs). So you can move the Stage 2 + image to another location safely, even after GRUB has been + installed. + + While Stage 2 cannot generally be embedded in a fixed area as the + size is so large, Stage 1.5 can be installed into the area right + after an MBR, or the boot loader area of a ReiserFS or a FFS. + +`stage2_eltorito' + This is a boot image for CD-ROMs using the "no emulation mode" in + El Torito specification. This is identical to Stage 2, except that + this boots up without Stage 1 and sets up a special drive `(cd)'. + +`nbgrub' + This is a network boot image for the Network Image Proposal used + by some network boot loaders, such as Etherboot. This is mostly + the same as Stage 2, but it also sets up a network and loads a + configuration file from the network. + +`pxegrub' + This is another network boot image for the Preboot Execution + Environment used by several Netboot ROMs. This is identical to + `nbgrub', except for the format. + + +File: grub.info, Node: Filesystem, Next: Interface, Prev: Images, Up: Top + +Filesystem syntax and semantics +******************************* + + GRUB uses a special syntax for specifying disk drives which can be +accessed by BIOS. Because of BIOS limitations, GRUB cannot distinguish +between IDE, ESDI, SCSI, or others. You must know yourself which BIOS +device is equivalent to which OS device. Normally, that will be clear if +you see the files in a device or use the command `find' (*note find::). + +* Menu: + +* Device syntax:: How to specify devices +* File name syntax:: How to specify files +* Block list syntax:: How to specify block lists + + +File: grub.info, Node: Device syntax, Next: File name syntax, Up: Filesystem + +How to specify devices +====================== + + The device syntax is like this: + + `(DEVICE[,PART-NUM][,BSD-SUBPART-LETTER])' + + `[]' means the parameter is optional. DEVICE should be either `fd' +or `hd' followed by a digit, like `fd0'. But you can also set DEVICE +to a hexadecimal or a decimal number which is a BIOS drive number, so +the following are equivalent: + + (hd0) + (0x80) + (128) + + PART-NUM represents the partition number of DEVICE, starting from +zero for primary partitions and from four for extended partitions, and +BSD-SUBPART-LETTER represents the BSD disklabel subpartition, such as +`a' or `e'. + + A shortcut for specifying BSD subpartitions is +`(DEVICE,BSD-SUBPART-LETTER)', in this case, GRUB searches for the +first PC partition containing a BSD disklabel, then finds the +subpartition BSD-SUBPART-LETTER. Here is an example: + + (hd0,a) + + The syntax `(hd0)' represents using the entire disk (or the MBR when +installing GRUB), while the syntax `(hd0,0)' represents using the first +partition of the disk (or the boot sector of the partition when +installing GRUB). + + If you enabled the network support, the special drive, `(nd)', is +also available. Before using the network drive, you must initialize the +network. *Note Network::, for more information. + + If you boot GRUB from a CD-ROM, `(cd)' is available. *Note Making a +GRUB bootable CD-ROM::, for details. + + +File: grub.info, Node: File name syntax, Next: Block list syntax, Prev: Device syntax, Up: Filesystem + +How to specify files +==================== + + There are two ways to specify files, by "absolute file name" and by +"block list". + + An absolute file name resembles a Unix absolute file name, using `/' +for the directory separator (not `\' as in DOS). One example is +`(hd0,0)/boot/grub/menu.lst'. This means the file `/boot/grub/menu.lst' +in the first partition of the first hard disk. If you omit the device +name in an absolute file name, GRUB uses GRUB's "root device" +implicitly. So if you set the root device to, say, `(hd1,0)' by the +command `root' (*note root::), then `/boot/kernel' is the same as +`(hd1,0)/boot/kernel'. + + +File: grub.info, Node: Block list syntax, Prev: File name syntax, Up: Filesystem + +How to specify block lists +========================== + + A block list is used for specifying a file that doesn't appear in the +filesystem, like a chainloader. The syntax is +`[OFFSET]+LENGTH[,[OFFSET]+LENGTH]...'. Here is an example: + + `0+100,200+1,300+300' + + This represents that GRUB should read blocks 0 through 99, block 200, +and blocks 300 through 599. If you omit an offset, then GRUB assumes +the offset is zero. + + Like the file name syntax (*note File name syntax::), if a blocklist +does not contain a device name, then GRUB uses GRUB's "root device". So +`(hd0,1)+1' is the same as `+1' when the root device is `(hd0,1)'. + + +File: grub.info, Node: Interface, Next: Commands, Prev: Filesystem, Up: Top + +GRUB's user interface +********************* + + GRUB has both a simple menu interface for choosing preset entries +from a configuration file, and a highly flexible command-line for +performing any desired combination of boot commands. + + GRUB looks for its configuration file as soon as it is loaded. If one +is found, then the full menu interface is activated using whatever +entries were found in the file. If you choose the "command-line" menu +option, or if the configuration file was not found, then GRUB drops to +the command-line interface. + +* Menu: + +* Command-line interface:: The flexible command-line interface +* Menu interface:: The simple menu interface +* Menu entry editor:: Editing a menu entry +* Hidden menu interface:: The hidden menu interface + + +File: grub.info, Node: Command-line interface, Next: Menu interface, Up: Interface + +The flexible command-line interface +=================================== + + The command-line interface provides a prompt and after it an editable +text area much like a command-line in Unix or DOS. Each command is +immediately executed after it is entered(1) (*note Command-line +interface-Footnote-1::). The commands (*note Command-line and menu +entry commands::) are a subset of those available in the configuration +file, used with exactly the same syntax. + + Cursor movement and editing of the text on the line can be done via a +subset of the functions available in the Bash shell: + + + + Move forward one character. + + + + Move back one character. + + + + Move to the start of the line. + + + + Move the the end of the line. + + + + Delete the character underneath the cursor. + + + + Delete the character to the left of the cursor. + + + Kill the text from the current cursor position to the end of the + line. + + + Kill backward from the cursor to the beginning of the line. + + + Yank the killed text back into the buffer at the cursor. + + + + Move up through the history list. + + + + Move down through the history list. + + When typing commands interactively, if the cursor is within or before +the first word in the command-line, pressing the key (or ) +will display a listing of the available commands, and if the cursor is +after the first word, the `' will provide a completion listing of +disks, partitions, and file names depending on the context. Note that +to obtain a list of drives, one must open a parenthesis, as `root ('. + + Note that you cannot use the completion functionality in the TFTP +filesystem. This is because TFTP doesn't support file name listing for +the security. + + +File: grub.info, Node: Command-line interface-Footnotes, Up: Command-line interface + + (1) However, this behavior will be changed in the future version, in +a user-invisible way. + + +File: grub.info, Node: Menu interface, Next: Menu entry editor, Prev: Command-line interface, Up: Interface + +The simple menu interface +========================= + + The menu interface is quite easy to use. Its commands are both +reasonably intuitive and described on screen. + + Basically, the menu interface provides a list of "boot entries" to +the user to choose from. Use the arrow keys to select the entry of +choice, then press to run it. An optional timeout is available +to boot the default entry (the first one if not set), which is aborted +by pressing any key. + + Commands are available to enter a bare command-line by pressing +(which operates exactly like the non-config-file version of GRUB, but +allows one to return to the menu if desired by pressing ) or to +edit any of the "boot entries" by pressing . + + If you protect the menu interface with a password (*note Security::), +all you can do is choose an entry by pressing , or press

to +enter the password. + + +File: grub.info, Node: Menu entry editor, Next: Hidden menu interface, Prev: Menu interface, Up: Interface + +Editing a menu entry +==================== + + The menu entry editor looks much like the main menu interface, but +the lines in the menu are individual commands in the selected entry +instead of entry names. + + If an is pressed in the editor, it aborts all the changes made +to the configuration entry and returns to the main menu interface. + + When a particular line is selected, the editor places the user in a +special version of the GRUB command-line to edit that line. When the +user hits , GRUB replaces the line in question in the boot entry +with the changes (unless it was aborted via , in which case the +changes are thrown away). + + If you want to add a new line to the menu entry, press if adding +a line after the current line or press if before the current line. + + To delete a line, hit the key . Although GRUB unfortunately does +not support "undo", you can do almost the same thing by just returning +to the main menu. + + +File: grub.info, Node: Hidden menu interface, Prev: Menu entry editor, Up: Interface + +The hidden menu interface +========================= + + When your terminal is dumb or you request GRUB to hide the menu +interface explicitly with the command `hiddenmenu' (*note +hiddenmenu::), GRUB doesn't show the menu interface (*note Menu +interface::) and automatically boots the default entry, unless +interrupted by pressing . + + When you interrupt the timeout and your terminal is dumb, GRUB falls +back to the command-line interface (*note Command-line interface::). + + +File: grub.info, Node: Commands, Next: Troubleshooting, Prev: Interface, Up: Top + +The list of available commands +****************************** + + In this chapter, we list all commands that are available in GRUB. + + Commands belong to different groups. A few can only be used in the +global section of the configuration file (or "menu"); most of them can +be entered on the command-line and can be used either anywhere in the +menu or specifically in the menu entries. + +* Menu: + +* Menu-specific commands:: +* General commands:: +* Command-line and menu entry commands:: + + +File: grub.info, Node: Menu-specific commands, Next: General commands, Up: Commands + +The list of commands for the menu only +====================================== + + The semantics used in parsing the configuration file are the +following: + + * The menu-specific commands have to be used before any others. + + * The files _must_ be in plain-text format. + + * `#' at the beginning of a line in a configuration file means it is + only a comment. + + * Options are separated by spaces. + + * All numbers can be either decimal or hexadecimal. A hexadecimal + number must be preceded by `0x', and is case-insensitive. + + * Extra options or text at the end of the line are ignored unless + otherwise specified. + + * Unrecognized commands are added to the current entry, except + before entries start, where they are ignored. + + These commands can only be used in the menu: + +* Menu: + +* default:: Set the default entry +* fallback:: Set the fallback entry +* hiddenmenu:: Hide the menu interface +* timeout:: Set the timeout +* title:: Start a menu entry + + +File: grub.info, Node: default, Next: fallback, Up: Menu-specific commands + +default +------- + + - Command: default num + Set the default entry to the entry number NUM. Numbering starts + from 0, and the entry number 0 is the default if the command is not + used. + + You can specify `saved' instead of a number. In this case, the + default entry is the entry saved with the command `savedefault'. + *Note savedefault::, for more information. + + +File: grub.info, Node: fallback, Next: hiddenmenu, Prev: default, Up: Menu-specific commands + +fallback +-------- + + - Command: fallback num... + Go into unattended boot mode: if the default boot entry has any + errors, instead of waiting for the user to do something, + immediately start over using the NUM entry (same numbering as the + `default' command (*note default::)). This obviously won't help if + the machine was rebooted by a kernel that GRUB loaded. You can + specify multiple fallback entry numbers. + + +File: grub.info, Node: hiddenmenu, Next: timeout, Prev: fallback, Up: Menu-specific commands + +hiddenmenu +---------- + + - Command: hiddenmenu + Don't display the menu. If the command is used, no menu will be + displayed on the control terminal, and the default entry will be + booted after the timeout expired. The user can still request the + menu to be displayed by pressing before the timeout expires. + See also *Note Hidden menu interface::. + + +File: grub.info, Node: timeout, Next: title, Prev: hiddenmenu, Up: Menu-specific commands + +timeout +------- + + - Command: timeout sec + Set a timeout, in SEC seconds, before automatically booting the + default entry (normally the first entry defined). + + +File: grub.info, Node: title, Prev: timeout, Up: Menu-specific commands + +title +----- + + - Command: title name ... + Start a new boot entry, and set its name to the contents of the + rest of the line, starting with the first non-space character. + + +File: grub.info, Node: General commands, Next: Command-line and menu entry commands, Prev: Menu-specific commands, Up: Commands + +The list of general commands +============================ + + Commands usable anywhere in the menu and in the command-line. + +* Menu: + +* bootp:: Initialize a network device via BOOTP +* color:: Color the menu interface +* device:: Specify a file as a drive +* dhcp:: Initialize a network device via DHCP +* hide:: Hide a partition +* ifconfig:: Configure a network device manually +* pager:: Change the state of the internal pager +* partnew:: Make a primary partition +* parttype:: Change the type of a partition +* password:: Set a password for the menu interface +* rarp:: Initialize a network device via RARP +* serial:: Set up a serial device +* setkey:: Configure the key map +* terminal:: Choose a terminal +* terminfo:: Define escape sequences for a terminal +* tftpserver:: Specify a TFTP server +* unhide:: Unhide a partition + + +File: grub.info, Node: bootp, Next: color, Up: General commands + +bootp +----- + + - Command: bootp [`--with-configfile'] + Initialize a network device via the "BOOTP" protocol. This command + is only available if GRUB is compiled with netboot support. See + also *Note Network::. + + If you specify `--with-configfile' to this command, GRUB will + fetch and load a configuration file specified by your BOOTP server + with the vendor tag `150'. + + +File: grub.info, Node: color, Next: device, Prev: bootp, Up: General commands + +color +----- + + - Command: color normal [highlight] + Change the menu colors. The color NORMAL is used for most lines in + the menu (*note Menu interface::), and the color HIGHLIGHT is used + to highlight the line where the cursor points. If you omit + HIGHLIGHT, then the inverted color of NORMAL is used for the + highlighted line. The format of a color is + `FOREGROUND/BACKGROUND'. FOREGROUND and BACKGROUND are symbolic + color names. A symbolic color name must be one of these: + + * black + + * blue + + * green + + * cyan + + * red + + * magenta + + * brown + + * light-gray + + *These below can be specified only for the foreground.* + + * dark-gray + + * light-blue + + * light-green + + * light-cyan + + * light-red + + * light-magenta + + * yellow + + * white + + But only the first eight names can be used for BACKGROUND. You can + prefix `blink-' to FOREGROUND if you want a blinking foreground + color. + + This command can be used in the configuration file and on the + command line, so you may write something like this in your + configuration file: + + # Set default colors. + color light-gray/blue black/light-gray + + # Change the colors. + title OS-BS like + color magenta/blue black/magenta + + +File: grub.info, Node: device, Next: dhcp, Prev: color, Up: General commands + +device +------ + + - Command: device drive file + In the grub shell, specify the file FILE as the actual drive for a + BIOS drive DRIVE. You can use this command to create a disk image, + and/or to fix the drives guessed by GRUB when GRUB fails to + determine them correctly, like this: + + grub> device (fd0) /floppy-image + grub> device (hd0) /dev/sd0 + + This command can be used only in the grub shell (*note Invoking + the grub shell::). + + +File: grub.info, Node: dhcp, Next: hide, Prev: device, Up: General commands + +dhcp +---- + + - Command: dhcp [--with-configfile] + Initialize a network device via the "DHCP" protocol. Currently, + this command is just an alias for `bootp', since the two protocols + are very similar. This command is only available if GRUB is + compiled with netboot support. See also *Note Network::. + + If you specify `--with-configfile' to this command, GRUB will + fetch and load a configuration file specified by your DHCP server + with the vendor tag `150'. + + +File: grub.info, Node: hide, Next: ifconfig, Prev: dhcp, Up: General commands + +hide +---- + + - Command: hide partition + Hide the partition PARTITION by setting the "hidden" bit in its + partition type code. This is useful only when booting DOS or + Windows and multiple primary FAT partitions exist in one disk. See + also *Note DOS/Windows::. + + +File: grub.info, Node: ifconfig, Next: pager, Prev: hide, Up: General commands + +ifconfig +-------- + + - Command: ifconfig [`--server=server'] [`--gateway=gateway'] + [`--mask=mask'] [`--address=address'] + Configure the IP address, the netmask, the gateway, and the server + address of a network device manually. The values must be in dotted + decimal format, like `192.168.11.178'. The order of the options is + not important. This command shows current network configuration, + if no option is specified. See also *Note Network::. + + +File: grub.info, Node: pager, Next: partnew, Prev: ifconfig, Up: General commands + +pager +----- + + - Command: pager [flag] + Toggle or set the state of the internal pager. If FLAG is `on', + the internal pager is enabled. If FLAG is `off', it is disabled. + If no argument is given, the state is toggled. + + +File: grub.info, Node: partnew, Next: parttype, Prev: pager, Up: General commands + +partnew +------- + + - Command: partnew part type from len + Create a new primary partition. PART is a partition specification + in GRUB syntax (*note Naming convention::); TYPE is the partition + type and must be a number in the range `0-0xff'; FROM is the + starting address and LEN is the length, both in sector units. + + +File: grub.info, Node: parttype, Next: password, Prev: partnew, Up: General commands + +parttype +-------- + + - Command: parttype part type + Change the type of an existing partition. PART is a partition + specification in GRUB syntax (*note Naming convention::); TYPE is + the new partition type and must be a number in the range 0-0xff. + + +File: grub.info, Node: password, Next: rarp, Prev: parttype, Up: General commands + +password +-------- + + - Command: password [`--md5'] passwd [new-config-file] + If used in the first section of a menu file, disable all + interactive editing control (menu entry editor and command-line) + and entries protected by the command `lock'. If the password + PASSWD is entered, it loads the NEW-CONFIG-FILE as a new config + file and restarts the GRUB Stage 2, if NEW-CONFIG-FILE is + specified. Otherwise, GRUB will just unlock the privileged + instructions. You can also use this command in the script + section, in which case it will ask for the password, before + continuing. The option `--md5' tells GRUB that PASSWD is + encrypted with `md5crypt' (*note md5crypt::). + + +File: grub.info, Node: rarp, Next: serial, Prev: password, Up: General commands + +rarp +---- + + - Command: rarp + Initialize a network device via the "RARP" protocol. This command + is only available if GRUB is compiled with netboot support. See + also *Note Network::. + + +File: grub.info, Node: serial, Next: setkey, Prev: rarp, Up: General commands + +serial +------ + + - Command: serial [`--unit=unit'] [`--port=port'] [`--speed=speed'] + [`--word=word'] [`--parity=parity'] [`--stop=stop'] + [`--device=dev'] + Initialize a serial device. UNIT is a number in the range 0-3 + specifying which serial port to use; default is 0, which + corresponds to the port often called COM1. PORT is the I/O port + where the UART is to be found; if specified it takes precedence + over UNIT. SPEED is the transmission speed; default is 9600. WORD + and STOP are the number of data bits and stop bits. Data bits must + be in the range 5-8 and stop bits must be 1 or 2. Default is 8 data + bits and one stop bit. PARITY is one of `no', `odd', `even' and + defaults to `no'. The option `--device' can only be used in the + grub shell and is used to specify the tty device to be used in the + host operating system (*note Invoking the grub shell::). + + The serial port is not used as a communication channel unless the + `terminal' command is used (*note terminal::). + + This command is only available if GRUB is compiled with serial + support. See also *Note Serial terminal::. + + +File: grub.info, Node: setkey, Next: terminal, Prev: serial, Up: General commands + +setkey +------ + + - Command: setkey [to_key from_key] + Change the keyboard map. The key FROM_KEY is mapped to the key + TO_KEY. If no argument is specified, reset key mappings. Note that + this command _does not_ exchange the keys. If you want to exchange + the keys, run this command again with the arguments exchanged, + like this: + + grub> setkey capslock control + grub> setkey control capslock + + A key must be an alphabet letter, a digit, or one of these symbols: + `escape', `exclam', `at', `numbersign', `dollar', `percent', + `caret', `ampersand', `asterisk', `parenleft', `parenright', + `minus', `underscore', `equal', `plus', `backspace', `tab', + `bracketleft', `braceleft', `bracketright', `braceright', `enter', + `control', `semicolon', `colon', `quote', `doublequote', + `backquote', `tilde', `shift', `backslash', `bar', `comma', + `less', `period', `greater', `slash', `question', `alt', `space', + `capslock', `FX' (`X' is a digit), and `delete'. This table + describes to which character each of the symbols corresponds: + + `exclam' + `!' + + `at' + `@' + + `numbersign' + `#' + + `dollar' + `$' + + `percent' + `%' + + `caret' + `^' + + `ampersand' + `&' + + `asterisk' + `*' + + `parenleft' + `(' + + `parenright' + `)' + + `minus' + `-' + + `underscore' + `_' + + `equal' + `=' + + `plus' + `+' + + `bracketleft' + `[' + + `braceleft' + `{' + + `bracketright' + `]' + + `braceright' + `}' + + `semicolon' + `;' + + `colon' + `:' + + `quote' + `'' + + `doublequote' + `"' + + `backquote' + ``' + + `tilde' + `~' + + `backslash' + `\' + + `bar' + `|' + + `comma' + `,' + + `less' + `<' + + `period' + `.' + + `greater' + `>' + + `slash' + `/' + + `question' + `?' + + `space' + ` ' + + +File: grub.info, Node: terminal, Next: terminfo, Prev: setkey, Up: General commands + +terminal +-------- + + - Command: terminal [`--dumb'] [`--no-echo'] [`--no-edit'] + [`--timeout=secs'] [`--lines=lines'] [`--silent'] [`console'] + [`serial'] [`hercules'] + Select a terminal for user interaction. The terminal is assumed to + be VT100-compatible unless `--dumb' is specified. If both + `console' and `serial' are specified, then GRUB will use the one + where a key is entered first or the first when the timeout + expires. If neither are specified, the current setting is + reported. This command is only available if GRUB is compiled with + serial support. See also *Note Serial terminal::. + + This may not make sense for most users, but GRUB supports Hercules + console as well. Hercules console is usable like the ordinary + console, and the usage is quite similar to that for serial + terminals: specify `hercules' as the argument. + + The option `--lines' defines the number of lines in your terminal, + and it is used for the internal pager function. If you don't + specify this option, the number is assumed as 24. + + The option `--silent' suppresses the message to prompt you to hit + any key. This might be useful if your system has no terminal + device. + + The option `--no-echo' has GRUB not to echo back input characters. + This implies the option `--no-edit'. + + The option `--no-edit' disables the BASH-like editing feature. + + +File: grub.info, Node: terminfo, Next: tftpserver, Prev: terminal, Up: General commands + +terminfo +-------- + + - Command: terminfo `--name=name' `--cursor-address=seq' + [`--clear-screen=seq'] [`--enter-standout-mode=seq'] + [`--exit-standout-mode=seq'] + Define the capabilities of your terminal. Use this command to + define escape sequences, if it is not vt100-compatible. You may + use `\e' for and `^X' for a control character. + + You can use the utility `grub-terminfo' to generate appropriate + arguments to this command. *Note Invoking grub-terminfo::. + + If no option is specified, the current settings are printed. + + +File: grub.info, Node: tftpserver, Next: unhide, Prev: terminfo, Up: General commands + +tftpserver +---------- + + - Command: tftpserver ipaddr + *Caution:* This command exists only for backward compatibility. + Use `ifconfig' (*note ifconfig::) instead. + + Override a TFTP server address returned by a BOOTP/DHCP/RARP + server. The argument IPADDR must be in dotted decimal format, like + `192.168.0.15'. This command is only available if GRUB is compiled + with netboot support. See also *Note Network::. + + +File: grub.info, Node: unhide, Prev: tftpserver, Up: General commands + +unhide +------ + + - Command: unhide partition + Unhide the partition PARTITION by clearing the "hidden" bit in its + partition type code. This is useful only when booting DOS or + Windows and multiple primary partitions exist on one disk. See also + *Note DOS/Windows::. + + +File: grub.info, Node: Command-line and menu entry commands, Prev: General commands, Up: Commands + +The list of command-line and menu entry commands +================================================ + + These commands are usable in the command-line and in menu entries. +If you forget a command, you can run the command `help' (*note help::). + +* Menu: + +* blocklist:: Get the block list notation of a file +* boot:: Start up your operating system +* cat:: Show the contents of a file +* chainloader:: Chain-load another boot loader +* cmp:: Compare two files +* configfile:: Load a configuration file +* debug:: Toggle the debug flag +* displayapm:: Display APM information +* displaymem:: Display memory configuration +* embed:: Embed Stage 1.5 +* find:: Find a file +* fstest:: Test a filesystem +* geometry:: Manipulate the geometry of a drive +* halt:: Shut down your computer +* help:: Show help messages +* impsprobe:: Probe SMP +* initrd:: Load an initrd +* install:: Install GRUB +* ioprobe:: Probe I/O ports used for a drive +* kernel:: Load a kernel +* lock:: Lock a menu entry +* makeactive:: Make a partition active +* map:: Map a drive to another +* md5crypt:: Encrypt a password in MD5 format +* module:: Load a module +* modulenounzip:: Load a module without decompression +* pause:: Wait for a key press +* quit:: Exit from the grub shell +* reboot:: Reboot your computer +* read:: Read data from memory +* root:: Set GRUB's root device +* rootnoverify:: Set GRUB's root device without mounting +* savedefault:: Save current entry as the default entry +* setup:: Set up GRUB's installation automatically +* testload:: Load a file for testing a filesystem +* testvbe:: Test VESA BIOS EXTENSION +* uppermem:: Set the upper memory size +* vbeprobe:: Probe VESA BIOS EXTENSION + + +File: grub.info, Node: blocklist, Next: boot, Up: Command-line and menu entry commands + +blocklist +--------- + + - Command: blocklist file + Print the block list notation of the file FILE. *Note Block list + syntax::. + + +File: grub.info, Node: boot, Next: cat, Prev: blocklist, Up: Command-line and menu entry commands + +boot +---- + + - Command: boot + Boot the OS or chain-loader which has been loaded. Only necessary + if running the fully interactive command-line (it is implicit at + the end of a menu entry). + + +File: grub.info, Node: cat, Next: chainloader, Prev: boot, Up: Command-line and menu entry commands + +cat +--- + + - Command: cat file + Display the contents of the file FILE. This command may be useful + to remind you of your OS's root partition: + + grub> cat /etc/fstab + + +File: grub.info, Node: chainloader, Next: cmp, Prev: cat, Up: Command-line and menu entry commands + +chainloader +----------- + + - Command: chainloader [`--force'] file + Load FILE as a chain-loader. Like any other file loaded by the + filesystem code, it can use the blocklist notation to grab the + first sector of the current partition with `+1'. If you specify the + option `--force', then load FILE forcibly, whether it has a + correct signature or not. This is required when you want to load a + defective boot loader, such as SCO UnixWare 7.1 (*note SCO + UnixWare::). + + +File: grub.info, Node: cmp, Next: configfile, Prev: chainloader, Up: Command-line and menu entry commands + +cmp +--- + + - Command: cmp file1 file2 + Compare the file FILE1 with the file FILE2. If they differ in + size, print the sizes like this: + + Differ in size: 0x1234 [foo], 0x4321 [bar] + + If the sizes are equal but the bytes at an offset differ, then + print the bytes like this: + + Differ at the offset 777: 0xbe [foo], 0xef [bar] + + If they are completely identical, nothing will be printed. + + +File: grub.info, Node: configfile, Next: debug, Prev: cmp, Up: Command-line and menu entry commands + +configfile +---------- + + - Command: configfile file + Load FILE as a configuration file. + + +File: grub.info, Node: debug, Next: displayapm, Prev: configfile, Up: Command-line and menu entry commands + +debug +----- + + - Command: debug + Toggle debug mode (by default it is off). When debug mode is on, + some extra messages are printed to show disk activity. This global + debug flag is mainly useful for GRUB developers when testing new + code. + + +File: grub.info, Node: displayapm, Next: displaymem, Prev: debug, Up: Command-line and menu entry commands + +displayapm +---------- + + - Command: displayapm + Display APM BIOS information. + + +File: grub.info, Node: displaymem, Next: embed, Prev: displayapm, Up: Command-line and menu entry commands + +displaymem +---------- + + - Command: displaymem + Display what GRUB thinks the system address space map of the + machine is, including all regions of physical RAM installed. GRUB's + "upper/lower memory" display uses the standard BIOS interface for + the available memory in the first megabyte, or "lower memory", and + a synthesized number from various BIOS interfaces of the memory + starting at 1MB and going up to the first chipset hole for "upper + memory" (the standard PC "upper memory" interface is limited to + reporting a maximum of 64MB). + + +File: grub.info, Node: embed, Next: find, Prev: displaymem, Up: Command-line and menu entry commands + +embed +----- + + - Command: embed stage1_5 device + Embed the Stage 1.5 STAGE1_5 in the sectors after the MBR if + DEVICE is a drive, or in the "boot loader" area if DEVICE is a FFS + partition or a ReiserFS partition.(1) (*note embed-Footnote-1::) + Print the number of sectors which STAGE1_5 occupies, if successful. + + Usually, you don't need to run this command directly. *Note + setup::. + + +File: grub.info, Node: embed-Footnotes, Up: embed + + (1) The latter feature has not been implemented yet. + + +File: grub.info, Node: find, Next: fstest, Prev: embed, Up: Command-line and menu entry commands + +find +---- + + - Command: find filename + Search for the file name FILENAME in all mountable partitions and + print the list of the devices which contain the file. The file + name FILENAME should be an absolute file name like + `/boot/grub/stage1'. + + +File: grub.info, Node: fstest, Next: geometry, Prev: find, Up: Command-line and menu entry commands + +fstest +------ + + - Command: fstest + Toggle filesystem test mode. Filesystem test mode, when turned + on, prints out data corresponding to all the device reads and what + values are being sent to the low-level routines. The format is + `' for + high-level reads inside a partition, and `[DISK-OFFSET-SECTOR]' + for low-level sector requests from the disk. Filesystem test mode + is turned off by any use of the `install' (*note install::) or + `testload' (*note testload::) commands. + + +File: grub.info, Node: geometry, Next: halt, Prev: fstest, Up: Command-line and menu entry commands + +geometry +-------- + + - Command: geometry drive [cylinder head sector [total_sector]] + Print the information for the drive DRIVE. In the grub shell, you + can set the geometry of the drive arbitrarily. The number of + cylinders, the number of heads, the number of sectors and the + number of total sectors are set to CYLINDER, HEAD, SECTOR and + TOTAL_SECTOR, respectively. If you omit TOTAL_SECTOR, then it will + be calculated based on the C/H/S values automatically. + + +File: grub.info, Node: halt, Next: help, Prev: geometry, Up: Command-line and menu entry commands + +halt +---- + + - Command: halt `--no-apm' + The command halts the computer. If the `--no-apm' option is + specified, no APM BIOS call is performed. Otherwise, the computer + is shut down using APM. + + +File: grub.info, Node: help, Next: impsprobe, Prev: halt, Up: Command-line and menu entry commands + +help +---- + + - Command: help `--all' [pattern ...] + Display helpful information about builtin commands. If you do not + specify PATTERN, this command shows short descriptions of most of + available commands. If you specify the option `--all' to this + command, short descriptions of rarely used commands (such as *Note + testload::) are displayed as well. + + If you specify any PATTERNS, it displays longer information about + each of the commands which match those PATTERNS. + + +File: grub.info, Node: impsprobe, Next: initrd, Prev: help, Up: Command-line and menu entry commands + +impsprobe +--------- + + - Command: impsprobe + Probe the Intel Multiprocessor Specification 1.1 or 1.4 + configuration table and boot the various CPUs which are found into + a tight loop. This command can be used only in the Stage 2, but + not in the grub shell. + + +File: grub.info, Node: initrd, Next: install, Prev: impsprobe, Up: Command-line and menu entry commands + +initrd +------ + + - Command: initrd file ... + Load an initial ramdisk for a Linux format boot image and set the + appropriate parameters in the Linux setup area in memory. See also + *Note GNU/Linux::. + diff --git a/usr/src/grub/grub-0.97/docs/grub.info-3 b/usr/src/grub/grub-0.97/docs/grub.info-3 new file mode 100644 index 0000000000..10e4cad2fe --- /dev/null +++ b/usr/src/grub/grub-0.97/docs/grub.info-3 @@ -0,0 +1,1366 @@ +This is grub.info, produced by makeinfo version 4.0 from grub.texi. + +INFO-DIR-SECTION Kernel +START-INFO-DIR-ENTRY +* GRUB: (grub). The GRand Unified Bootloader +* grub-install: (grub)Invoking grub-install. Install GRUB on your drive +* grub-md5-crypt: (grub)Invoking grub-md5-crypt. Encrypt a password + in MD5 format +* grub-terminfo: (grub)Invoking grub-terminfo. Generate a terminfo + command from a + terminfo name +* grub-set-default: (grub)Invoking grub-set-default. Set a default boot + entry +* mbchk: (grub)Invoking mbchk. Check for the format of a Multiboot kernel +END-INFO-DIR-ENTRY + + Copyright (C) 1999,2000,2001,2002,2004 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: grub.info, Node: install, Next: ioprobe, Prev: initrd, Up: Command-line and menu entry commands + +install +------- + + - Command: install [`--force-lba'] [`--stage2=os_stage2_file'] + stage1_file [`d'] dest_dev stage2_file [addr] [`p'] + [config_file] [real_config_file] + This command is fairly complex, and you should not use this command + unless you are familiar with GRUB. Use `setup' (*note setup::) + instead. + + In short, it will perform a full install presuming the Stage 2 or + Stage 1.5(1) (*note install-Footnote-1::) is in its final install + location. + + In slightly more detail, it will load STAGE1_FILE, validate that + it is a GRUB Stage 1 of the right version number, install in it a + blocklist for loading STAGE2_FILE as a Stage 2. If the option `d' + is present, the Stage 1 will always look for the actual disk + STAGE2_FILE was installed on, rather than using the booting drive. + The Stage 2 will be loaded at address ADDR, which must be `0x8000' + for a true Stage 2, and `0x2000' for a Stage 1.5. If ADDR is not + present, GRUB will determine the address automatically. It then + writes the completed Stage 1 to the first block of the device + DEST_DEV. If the options `p' or CONFIG_FILE are present, then it + reads the first block of stage2, modifies it with the values of + the partition STAGE2_FILE was found on (for `p') or places the + string CONFIG_FILE into the area telling the stage2 where to look + for a configuration file at boot time. Likewise, if + REAL_CONFIG_FILE is present and STAGE2_FILE is a Stage 1.5, then + the Stage 2 CONFIG_FILE is patched with the configuration file + name REAL_CONFIG_FILE. This command preserves the DOS BPB (and for + hard disks, the partition table) of the sector the Stage 1 is to + be installed into. + + *Caution:* Several buggy BIOSes don't pass a booting drive + properly when booting from a hard disk drive. Therefore, you will + unfortunately have to specify the option `d', whether your Stage2 + resides at the booting drive or not, if you have such a BIOS. We + know these are defective in this way: + + + Fujitsu LifeBook 400 BIOS version 31J0103A + + + HP Vectra XU 6/200 BIOS version GG.06.11 + + *Caution2:* A number of BIOSes don't return a correct LBA support + bitmap even if they do have the support. So GRUB provides a + solution to ignore the wrong bitmap, that is, the option + `--force-lba'. Don't use this option if you know that your BIOS + doesn't have LBA support. + + *Caution3:* You must specify the option `--stage2' in the grub + shell, if you cannot unmount the filesystem where your stage2 file + resides. The argument should be the file name in your operating + system. + + +File: grub.info, Node: install-Footnotes, Up: install + + (1) They're loaded the same way, so we will refer to the Stage 1.5 +as a Stage 2 from now on. + + +File: grub.info, Node: ioprobe, Next: kernel, Prev: install, Up: Command-line and menu entry commands + +ioprobe +------- + + - Command: ioprobe drive + Probe I/O ports used for the drive DRIVE. This command will list + the I/O ports on the screen. For technical information, *Note + Internals::. + + +File: grub.info, Node: kernel, Next: lock, Prev: ioprobe, Up: Command-line and menu entry commands + +kernel +------ + + - Command: kernel [`--type=type'] [`--no-mem-option'] file ... + Attempt to load the primary boot image (Multiboot a.out or ELF, + Linux zImage or bzImage, FreeBSD a.out, NetBSD a.out, etc.) from + FILE. The rest of the line is passed verbatim as the "kernel + command-line". Any modules must be reloaded after using this + command. + + This command also accepts the option `--type' so that you can + specify the kernel type of FILE explicitly. The argument TYPE must + be one of these: `netbsd', `freebsd', `openbsd', `linux', + `biglinux', and `multiboot'. However, you need to specify it only + if you want to load a NetBSD ELF kernel, because GRUB can + automatically determine a kernel type in the other cases, quite + safely. + + The option `--no-mem-option' is effective only for Linux. If the + option is specified, GRUB doesn't pass the option `mem=' to the + kernel. This option is implied for Linux kernels 2.4.18 and newer. + + +File: grub.info, Node: lock, Next: makeactive, Prev: kernel, Up: Command-line and menu entry commands + +lock +---- + + - Command: lock + Prevent normal users from executing arbitrary menu entries. You + must use the command `password' if you really want this command to + be useful (*note password::). + + This command is used in a menu, as shown in this example: + + title This entry is too dangerous to be executed by normal users + lock + root (hd0,a) + kernel /no-security-os + + See also *Note Security::. + + +File: grub.info, Node: makeactive, Next: map, Prev: lock, Up: Command-line and menu entry commands + +makeactive +---------- + + - Command: makeactive + Set the active partition on the root disk to GRUB's root device. + This command is limited to _primary_ PC partitions on a hard disk. + + +File: grub.info, Node: map, Next: md5crypt, Prev: makeactive, Up: Command-line and menu entry commands + +map +--- + + - Command: map to_drive from_drive + Map the drive FROM_DRIVE to the drive TO_DRIVE. This is necessary + when you chain-load some operating systems, such as DOS, if such + an OS resides at a non-first drive. Here is an example: + + grub> map (hd0) (hd1) + grub> map (hd1) (hd0) + + The example exchanges the order between the first hard disk and the + second hard disk. See also *Note DOS/Windows::. + + +File: grub.info, Node: md5crypt, Next: module, Prev: map, Up: Command-line and menu entry commands + +md5crypt +-------- + + - Command: md5crypt + Prompt to enter a password, and encrypt it in MD5 format. The + encrypted password can be used with the command `password' (*note + password::). See also *Note Security::. + + +File: grub.info, Node: module, Next: modulenounzip, Prev: md5crypt, Up: Command-line and menu entry commands + +module +------ + + - Command: module file ... + Load a boot module FILE for a Multiboot format boot image (no + interpretation of the file contents are made, so the user of this + command must know what the kernel in question expects). The rest + of the line is passed as the "module command-line", like the + `kernel' command. You must load a Multiboot kernel image before + loading any module. See also *Note modulenounzip::. + + +File: grub.info, Node: modulenounzip, Next: pause, Prev: module, Up: Command-line and menu entry commands + +modulenounzip +------------- + + - Command: modulenounzip file ... + The same as `module' (*note module::), except that automatic + decompression is disabled. + + +File: grub.info, Node: pause, Next: quit, Prev: modulenounzip, Up: Command-line and menu entry commands + +pause +----- + + - Command: pause message ... + Print the MESSAGE, then wait until a key is pressed. Note that + placing <^G> (ASCII code 7) in the message will cause the speaker + to emit the standard beep sound, which is useful when prompting + the user to change floppies. + + +File: grub.info, Node: quit, Next: reboot, Prev: pause, Up: Command-line and menu entry commands + +quit +---- + + - Command: quit + Exit from the grub shell `grub' (*note Invoking the grub shell::). + This command can be used only in the grub shell. + + +File: grub.info, Node: reboot, Next: read, Prev: quit, Up: Command-line and menu entry commands + +reboot +------ + + - Command: reboot + Reboot the computer. + + +File: grub.info, Node: read, Next: root, Prev: reboot, Up: Command-line and menu entry commands + +read +---- + + - Command: read addr + Read a 32-bit value from memory at address ADDR and display it in + hex format. + + +File: grub.info, Node: root, Next: rootnoverify, Prev: read, Up: Command-line and menu entry commands + +root +---- + + - Command: root device [hdbias] + Set the current "root device" to the device DEVICE, then attempt + to mount it to get the partition size (for passing the partition + descriptor in `ES:ESI', used by some chain-loaded boot loaders), + the BSD drive-type (for booting BSD kernels using their native + boot format), and correctly determine the PC partition where a BSD + sub-partition is located. The optional HDBIAS parameter is a + number to tell a BSD kernel how many BIOS drive numbers are on + controllers before the current one. For example, if there is an + IDE disk and a SCSI disk, and your FreeBSD root partition is on + the SCSI disk, then use a `1' for HDBIAS. + + See also *Note rootnoverify::. + + +File: grub.info, Node: rootnoverify, Next: savedefault, Prev: root, Up: Command-line and menu entry commands + +rootnoverify +------------ + + - Command: rootnoverify device [hdbias] + Similar to `root' (*note root::), but don't attempt to mount the + partition. This is useful for when an OS is outside of the area of + the disk that GRUB can read, but setting the correct root device + is still desired. Note that the items mentioned in `root' above + which derived from attempting the mount will _not_ work correctly. + + +File: grub.info, Node: savedefault, Next: setup, Prev: rootnoverify, Up: Command-line and menu entry commands + +savedefault +----------- + + - Command: savedefault num + Save the current menu entry or NUM if specified as a default + entry. Here is an example: + + default saved + timeout 10 + + title GNU/Linux + root (hd0,0) + kernel /boot/vmlinuz root=/dev/sda1 vga=ext + initrd /boot/initrd + savedefault + + title FreeBSD + root (hd0,a) + kernel /boot/loader + savedefault + + With this configuration, GRUB will choose the entry booted + previously as the default entry. + + You can specify `fallback' instead of a number. Then, next + fallback entry is saved. Next fallback entry is chosen from + fallback entries. Normally, this will be the first entry in + fallback ones. + + See also *Note default:: and *Note Invoking grub-set-default::. + + +File: grub.info, Node: setup, Next: testload, Prev: savedefault, Up: Command-line and menu entry commands + +setup +----- + + - Command: setup [`--force-lba'] [`--stage2=os_stage2_file'] + [`--prefix=dir'] install_device [image_device] + Set up the installation of GRUB automatically. This command uses + the more flexible command `install' (*note install::) in the + backend and installs GRUB into the device INSTALL_DEVICE. If + IMAGE_DEVICE is specified, then find the GRUB images (*note + Images::) in the device IMAGE_DEVICE, otherwise use the current + "root device", which can be set by the command `root'. If + INSTALL_DEVICE is a hard disk, then embed a Stage 1.5 in the disk + if possible. + + The option `--prefix' specifies the directory under which GRUB + images are put. If it is not specified, GRUB automatically + searches them in `/boot/grub' and `/grub'. + + The options `--force-lba' and `--stage2' are just passed to + `install' if specified. *Note install::, for more information. + + +File: grub.info, Node: testload, Next: testvbe, Prev: setup, Up: Command-line and menu entry commands + +testload +-------- + + - Command: testload file + Read the entire contents of FILE in several different ways and + compare them, to test the filesystem code. The output is somewhat + cryptic, but if no errors are reported and the final `i=X, + filepos=Y' reading has X and Y equal, then it is definitely + consistent, and very likely works correctly subject to a + consistent offset error. If this test succeeds, then a good next + step is to try loading a kernel. + + +File: grub.info, Node: testvbe, Next: uppermem, Prev: testload, Up: Command-line and menu entry commands + +testvbe +------- + + - Command: testvbe mode + Test the VESA BIOS EXTENSION mode MODE. This command will switch + your video card to the graphics mode, and show an endless + animation. Hit any key to return. See also *Note vbeprobe::. + + +File: grub.info, Node: uppermem, Next: vbeprobe, Prev: testvbe, Up: Command-line and menu entry commands + +uppermem +-------- + + - Command: uppermem kbytes + Force GRUB to assume that only KBYTES kilobytes of upper memory + are installed. Any system address range maps are discarded. + + *Caution:* This should be used with great caution, and should only + be necessary on some old machines. GRUB's BIOS probe can pick up + all RAM on all new machines the author has ever heard of. It can + also be used for debugging purposes to lie to an OS. + + +File: grub.info, Node: vbeprobe, Prev: uppermem, Up: Command-line and menu entry commands + +vbeprobe +-------- + + - Command: vbeprobe [mode] + Probe VESA BIOS EXTENSION information. If the mode MODE is + specified, show only the information about MODE. Otherwise, this + command lists up available VBE modes on the screen. See also *Note + testvbe::. + + +File: grub.info, Node: Troubleshooting, Next: Invoking the grub shell, Prev: Commands, Up: Top + +Error messages reported by GRUB +******************************* + + This chapter describes error messages reported by GRUB when you +encounter trouble. *Note Invoking the grub shell::, if your problem is +specific to the grub shell. + +* Menu: + +* Stage1 errors:: Errors reported by the Stage 1 +* Stage1.5 errors:: Errors reported by the Stage 1.5 +* Stage2 errors:: Errors reported by the Stage 2 + + +File: grub.info, Node: Stage1 errors, Next: Stage1.5 errors, Up: Troubleshooting + +Errors reported by the Stage 1 +============================== + + The general way that the Stage 1 handles errors is to print an error +string and then halt. Pressing `--' will reboot. + + The following is a comprehensive list of error messages for the +Stage 1: + +Hard Disk Error + The stage2 or stage1.5 is being read from a hard disk, and the + attempt to determine the size and geometry of the hard disk failed. + +Floppy Error + The stage2 or stage1.5 is being read from a floppy disk, and the + attempt to determine the size and geometry of the floppy disk + failed. It's listed as a separate error since the probe sequence + is different than for hard disks. + +Read Error + A disk read error happened while trying to read the stage2 or + stage1.5. + +Geom Error + The location of the stage2 or stage1.5 is not in the portion of + the disk supported directly by the BIOS read calls. This could + occur because the BIOS translated geometry has been changed by the + user or the disk is moved to another machine or controller after + installation, or GRUB was not installed using itself (if it was, + the Stage 2 version of this error would have been seen during that + process and it would not have completed the install). + + +File: grub.info, Node: Stage1.5 errors, Next: Stage2 errors, Prev: Stage1 errors, Up: Troubleshooting + +Errors reported by the Stage 1.5 +================================ + + The general way that the Stage 1.5 handles errors is to print an +error number in the form `Error NUM' and then halt. Pressing +`--' will reboot. + + The error numbers correspond to the errors reported by Stage 2. +*Note Stage2 errors::. + + +File: grub.info, Node: Stage2 errors, Prev: Stage1.5 errors, Up: Troubleshooting + +Errors reported by the Stage 2 +============================== + + The general way that the Stage 2 handles errors is to abort the +operation in question, print an error string, then (if possible) either +continue based on the fact that an error occurred or wait for the user +to deal with the error. + + The following is a comprehensive list of error messages for the +Stage 2 (error numbers for the Stage 1.5 are listed before the colon in +each description): + +1 : Filename must be either an absolute filename or blocklist + This error is returned if a file name is requested which doesn't + fit the syntax/rules listed in the *Note Filesystem::. + +2 : Bad file or directory type + This error is returned if a file requested is not a regular file, + but something like a symbolic link, directory, or FIFO. + +3 : Bad or corrupt data while decompressing file + This error is returned if the run-length decompression code gets an + internal error. This is usually from a corrupt file. + +4 : Bad or incompatible header in compressed file + This error is returned if the file header for a supposedly + compressed file is bad. + +5 : Partition table invalid or corrupt + This error is returned if the sanity checks on the integrity of the + partition table fail. This is a bad sign. + +6 : Mismatched or corrupt version of stage1/stage2 + This error is returned if the install command points to + incompatible or corrupt versions of the stage1 or stage2. It can't + detect corruption in general, but this is a sanity check on the + version numbers, which should be correct. + +7 : Loading below 1MB is not supported + This error is returned if the lowest address in a kernel is below + the 1MB boundary. The Linux zImage format is a special case and + can be handled since it has a fixed loading address and maximum + size. + +8 : Kernel must be loaded before booting + This error is returned if GRUB is told to execute the boot sequence + without having a kernel to start. + +9 : Unknown boot failure + This error is returned if the boot attempt did not succeed for + reasons which are unknown. + +10 : Unsupported Multiboot features requested + This error is returned when the Multiboot features word in the + Multiboot header requires a feature that is not recognized. The + point of this is that the kernel requires special handling which + GRUB is probably unable to provide. + +11 : Unrecognized device string + This error is returned if a device string was expected, and the + string encountered didn't fit the syntax/rules listed in the *Note + Filesystem::. + +12 : Invalid device requested + This error is returned if a device string is recognizable but does + not fall under the other device errors. + +13 : Invalid or unsupported executable format + This error is returned if the kernel image being loaded is not + recognized as Multiboot or one of the supported native formats + (Linux zImage or bzImage, FreeBSD, or NetBSD). + +14 : Filesystem compatibility error, cannot read whole file + Some of the filesystem reading code in GRUB has limits on the + length of the files it can read. This error is returned when the + user runs into such a limit. + +15 : File not found + This error is returned if the specified file name cannot be found, + but everything else (like the disk/partition info) is OK. + +16 : Inconsistent filesystem structure + This error is returned by the filesystem code to denote an internal + error caused by the sanity checks of the filesystem structure on + disk not matching what it expects. This is usually caused by a + corrupt filesystem or bugs in the code handling it in GRUB. + +17 : Cannot mount selected partition + This error is returned if the partition requested exists, but the + filesystem type cannot be recognized by GRUB. + +18 : Selected cylinder exceeds maximum supported by BIOS + This error is returned when a read is attempted at a linear block + address beyond the end of the BIOS translated area. This generally + happens if your disk is larger than the BIOS can handle (512MB for + (E)IDE disks on older machines or larger than 8GB in general). + +19 : Linux kernel must be loaded before initrd + This error is returned if the initrd command is used before + loading a Linux kernel. + +20 : Multiboot kernel must be loaded before modules + This error is returned if the module load command is used before + loading a Multiboot kernel. It only makes sense in this case + anyway, as GRUB has no idea how to communicate the presence of + such modules to a non-Multiboot-aware kernel. + +21 : Selected disk does not exist + This error is returned if the device part of a device- or full + file name refers to a disk or BIOS device that is not present or + not recognized by the BIOS in the system. + +22 : No such partition + This error is returned if a partition is requested in the device + part of a device- or full file name which isn't on the selected + disk. + +23 : Error while parsing number + This error is returned if GRUB was expecting to read a number and + encountered bad data. + +24 : Attempt to access block outside partition + This error is returned if a linear block address is outside of the + disk partition. This generally happens because of a corrupt + filesystem on the disk or a bug in the code handling it in GRUB + (it's a great debugging tool). + +25 : Disk read error + This error is returned if there is a disk read error when trying to + probe or read data from a particular disk. + +26 : Too many symbolic links + This error is returned if the link count is beyond the maximum + (currently 5), possibly the symbolic links are looped. + +27 : Unrecognized command + This error is returned if an unrecognized command is entered on the + command-line or in a boot sequence section of a configuration file + and that entry is selected. + +28 : Selected item cannot fit into memory + This error is returned if a kernel, module, or raw file load + command is either trying to load its data such that it won't fit + into memory or it is simply too big. + +29 : Disk write error + This error is returned if there is a disk write error when trying + to write to a particular disk. This would generally only occur + during an install of set active partition command. + +30 : Invalid argument + This error is returned if an argument specified to a command is + invalid. + +31 : File is not sector aligned + This error may occur only when you access a ReiserFS partition by + block-lists (e.g. the command `install'). In this case, you should + mount the partition with the `-o notail' option. + +32 : Must be authenticated + This error is returned if you try to run a locked entry. You should + enter a correct password before running such an entry. + +33 : Serial device not configured + This error is returned if you try to change your terminal to a + serial one before initializing any serial device. + +34 : No spare sectors on the disk + This error is returned if a disk doesn't have enough spare space. + This happens when you try to embed Stage 1.5 into the unused + sectors after the MBR, but the first partition starts right after + the MBR or they are used by EZ-BIOS. + + +File: grub.info, Node: Invoking the grub shell, Next: Invoking grub-install, Prev: Troubleshooting, Up: Top + +Invoking the grub shell +*********************** + + This chapter documents the grub shell `grub'. Note that the grub +shell is an emulator; it doesn't run under the native environment, so it +sometimes does something wrong. Therefore, you shouldn't trust it too +much. If there is anything wrong with it, don't hesitate to try the +native GRUB environment, especially when it guesses a wrong map between +BIOS drives and OS devices. + +* Menu: + +* Basic usage:: How to use the grub shell +* Installation under UNIX:: How to install GRUB via `grub' +* Device map:: The map between BIOS drives and OS devices + + +File: grub.info, Node: Basic usage, Next: Installation under UNIX, Up: Invoking the grub shell + +Introduction into the grub shell +================================ + + You can use the command `grub' for installing GRUB under your +operating systems and for a testbed when you add a new feature into GRUB +or when fixing a bug. `grub' is almost the same as the Stage 2, and, in +fact, it shares the source code with the Stage 2 and you can use the +same commands (*note Commands::) in `grub'. It is emulated by replacing +BIOS calls with UNIX system calls and libc functions. + + The command `grub' accepts the following options: + +`--help' + Print a summary of the command-line options and exit. + +`--version' + Print the version number of GRUB and exit. + +`--verbose' + Print some verbose messages for debugging purpose. + +`--device-map=FILE' + Use the device map file FILE. The format is described in *Note + Device map::. + +`--no-floppy' + Do not probe any floppy drive. This option has no effect if the + option `--device-map' is specified (*note Device map::). + +`--probe-second-floppy' + Probe the second floppy drive. If this option is not specified, + the grub shell does not probe it, as that sometimes takes a long + time. If you specify the device map file (*note Device map::), the + grub shell just ignores this option. + +`--config-file=FILE' + Read the configuration file FILE instead of `/boot/grub/menu.lst'. + The format is the same as the normal GRUB syntax. See *Note + Filesystem::, for more information. + +`--boot-drive=DRIVE' + Set the stage2 BOOT_DRIVE to DRIVE. This argument should be an + integer (decimal, octal or hexadecimal). + +`--install-partition=PAR' + Set the stage2 INSTALL_PARTITION to PAR. This argument should be + an integer (decimal, octal or hexadecimal). + +`--no-config-file' + Do not use the configuration file even if it can be read. + +`--no-curses' + Do not use the screen handling interface by the curses even if it + is available. + +`--batch' + This option has the same meaning as `--no-config-file --no-curses'. + +`--read-only' + Disable writing to any disk. + +`--hold' + Wait until a debugger will attach. This option is useful when you + want to debug the startup code. + + +File: grub.info, Node: Installation under UNIX, Next: Device map, Prev: Basic usage, Up: Invoking the grub shell + +How to install GRUB via `grub' +============================== + + The installation procedure is the same as under the "native" Stage +2. *Note Installation::, for more information. The command +`grub'-specific information is described here. + + What you should be careful about is "buffer cache". `grub' makes use +of raw devices instead of filesystems that your operating systems +serve, so there exists a potential problem that some cache +inconsistency may corrupt your filesystems. What we recommend is: + + * If you can unmount drives to which GRUB may write any amount of + data, unmount them before running `grub'. + + * If a drive cannot be unmounted but can be mounted with the + read-only flag, mount it in read-only mode. That should be secure. + + * If a drive must be mounted with the read-write flag, make sure + that no activity is being done on it while the command `grub' is + running. + + * Reboot your operating system as soon as possible. This is probably + not required if you follow the rules above, but reboot is the most + secure way. + + In addition, enter the command `quit' when you finish the +installation. That is _very important_ because `quit' makes the buffer +cache consistent. Do not push . + + If you want to install GRUB non-interactively, specify `--batch' +option in the command-line. This is a simple example: + + #!/bin/sh + + # Use /usr/sbin/grub if you are on an older system. + /sbin/grub --batch </dev/null 2>/dev/null + root (hd0,0) + setup (hd0) + quit + EOT + + +File: grub.info, Node: Device map, Prev: Installation under UNIX, Up: Invoking the grub shell + +The map between BIOS drives and OS devices +========================================== + + When you specify the option `--device-map' (*note Basic usage::), +the grub shell creates the "device map file" automatically unless it +already exists. The file name `/boot/grub/device.map' is preferred. + + If the device map file exists, the grub shell reads it to map BIOS +drives to OS devices. This file consists of lines like this: + + DEVICE FILE + + DEVICE is a drive specified in the GRUB syntax (*note Device +syntax::), and FILE is an OS file, which is normally a device file. + + The reason why the grub shell gives you the device map file is that +it cannot guess the map between BIOS drives and OS devices correctly in +some environments. For example, if you exchange the boot sequence +between IDE and SCSI in your BIOS, it gets the order wrong. + + Thus, edit the file if the grub shell makes a mistake. You can put +any comments in the file if needed, as the grub shell assumes that a +line is just a comment if the first character is `#'. + + +File: grub.info, Node: Invoking grub-install, Next: Invoking grub-md5-crypt, Prev: Invoking the grub shell, Up: Top + +Invoking grub-install +********************* + + The program `grub-install' installs GRUB on your drive using the +grub shell (*note Invoking the grub shell::). You must specify the +device name on which you want to install GRUB, like this: + + grub-install INSTALL_DEVICE + + The device name INSTALL_DEVICE is an OS device name or a GRUB device +name. + + `grub-install' accepts the following options: + +`--help' + Print a summary of the command-line options and exit. + +`--version' + Print the version number of GRUB and exit. + +`--force-lba' + Force GRUB to use LBA mode even for a buggy BIOS. Use this option + only if your BIOS doesn't work properly in LBA mode even though it + supports LBA mode. + +`--root-directory=DIR' + Install GRUB images under the directory DIR instead of the root + directory. This option is useful when you want to install GRUB + into a separate partition or a removable disk. Here is an example + in which you have a separate "boot" partition which is mounted on + `/boot': + + grub-install --root-directory=/boot hd0 + +`--grub-shell=FILE' + Use FILE as the grub shell. You can append arbitrary options to + FILE after the file name, like this: + + grub-install --grub-shell="grub --read-only" /dev/fd0 + +`--recheck' + Recheck the device map, even if `/boot/grub/device.map' already + exists. You should use this option whenever you add/remove a disk + into/from your computer. + + +File: grub.info, Node: Invoking grub-md5-crypt, Next: Invoking grub-terminfo, Prev: Invoking grub-install, Up: Top + +Invoking grub-md5-crypt +*********************** + + The program `grub-md5-crypt' encrypts a password in MD5 format. +This is just a frontend of the grub shell (*note Invoking the grub +shell::). Passwords encrypted by this program can be used with the +command `password' (*note password::). + + `grub-md5-crypt' accepts the following options: + +`--help' + Print a summary of the command-line options and exit. + +`--version' + Print the version information and exit. + +`--grub-shell=FILE' + Use FILE as the grub shell. + + +File: grub.info, Node: Invoking grub-terminfo, Next: Invoking grub-set-default, Prev: Invoking grub-md5-crypt, Up: Top + +Invoking grub-terminfo +********************** + + The program `grub-terminfo' generates a terminfo command from a +terminfo name (*note terminfo::). The result can be used in the +configuration file, to define escape sequences. Because GRUB assumes +that your terminal is vt100-compatible by default, this would be useful +only if your terminal is uncommon (such as vt52). + + `grub-terminfo' accepts the following options: + +`--help' + Print a summary of the command-line options and exit. + +`--version' + Print the version information and exit. + + You must specify one argument to this command. For example: + + grub-terminfo vt52 + + +File: grub.info, Node: Invoking grub-set-default, Next: Invoking mbchk, Prev: Invoking grub-terminfo, Up: Top + +Invoking grub-set-default +************************* + + The program `grub-set-default' sets the default boot entry for GRUB. +This automatically creates a file named `default' under your GRUB +directory (i.e. `/boot/grub'), if it is not present. This file is used +to determine the default boot entry when GRUB boots up your system when +you use `default saved' in your configuration file (*note default::), +and to save next default boot entry when you use `savedefault' in a +boot entry (*note savedefault::). + + `grub-set-default' accepts the following options: + +`--help' + Print a summary of the command-line options and exit. + +`--version' + Print the version information and exit. + +`--root-directory=DIR' + Use the directory DIR instead of the root directory (i.e. `/') to + define the location of the default file. This is useful when you + mount a disk which is used for another system. + + You must specify a single argument to `grub-set-default'. This +argument is normally the number of a default boot entry. For example, +if you have this configuration file: + + default saved + timeout 10 + + title GNU/Hurd + root (hd0,0) + ... + + title GNU/Linux + root (hd0,1) + ... + + and if you want to set the next default boot entry to GNU/Linux, you +may execute this command: + + grub-set-default 1 + + Because the entry for GNU/Linux is `1'. Note that entries are +counted from zero. So, if you want to specify GNU/Hurd here, then you +should specify `0'. + + This feature is very useful if you want to test a new kernel or to +make your system quite robust. *Note Making your system robust::, for +more hints about how to set up a robust system. + + +File: grub.info, Node: Invoking mbchk, Next: Obtaining and Building GRUB, Prev: Invoking grub-set-default, Up: Top + +Invoking mbchk +************** + + The program `mbchk' checks for the format of a Multiboot kernel. We +recommend using this program before booting your own kernel by GRUB. + + `mbchk' accepts the following options: + +`--help' + Print a summary of the command-line options and exit. + +`--version' + Print the version number of GRUB and exit. + +`--quiet' + Suppress all normal output. + + +File: grub.info, Node: Obtaining and Building GRUB, Next: Reporting bugs, Prev: Invoking mbchk, Up: Top + +How to obtain and build GRUB +**************************** + + *Caution:* GRUB requires binutils-2.9.1.0.23 or later because the + GNU assembler has been changed so that it can produce real 16bits + machine code between 2.9.1 and 2.9.1.0.x. See + `http://sources.redhat.com/binutils/', to obtain information on + how to get the latest version. + + GRUB is available from the GNU alpha archive site +`ftp://alpha.gnu.org/gnu/grub' or any of its mirrors. The file will be +named grub-version.tar.gz. The current version is 0.95, so the file you +should grab is: + + `ftp://alpha.gnu.org/gnu/grub/grub-0.95.tar.gz' + + To unbundle GRUB use the instruction: + + zcat grub-0.95.tar.gz | tar xvf - + + which will create a directory called `grub-0.95' with all the +sources. You can look at the file `INSTALL' for detailed instructions +on how to build and install GRUB, but you should be able to just do: + + cd grub-0.95 + ./configure + make install + + This will install the grub shell `grub' (*note Invoking the grub +shell::), the Multiboot checker `mbchk' (*note Invoking mbchk::), and +the GRUB images. This will also install the GRUB manual. + + Also, the latest version is available from the CVS. See +`http://savannah.gnu.org/cvs/?group=grub' for more information. + + +File: grub.info, Node: Reporting bugs, Next: Future, Prev: Obtaining and Building GRUB, Up: Top + +Reporting bugs +************** + + These are the guideline for how to report bugs. Take a look at this +list below before you submit bugs: + + 1. Before getting unsettled, read this manual through and through. + Also, see the GNU GRUB FAQ + (http://www.gnu.org/software/grub/grub-faq.html). + + 2. Always mention the information on your GRUB. The version number + and the configuration are quite important. If you build it + yourself, write the options specified to the configure script and + your operating system, including the versions of gcc and binutils. + + 3. If you have trouble with the installation, inform us of how you + installed GRUB. Don't omit error messages, if any. Just `GRUB hangs + up when it boots' is not enough. + + The information on your hardware is also essential. These are + especially important: the geometries and the partition tables of + your hard disk drives and your BIOS. + + 4. If GRUB cannot boot your operating system, write down _everything_ + you see on the screen. Don't paraphrase them, like `The foo OS + crashes with GRUB, even though it can boot with the bar boot + loader just fine'. Mention the commands you executed, the messages + printed by them, and information on your operating system + including the version number. + + 5. Explain what you wanted to do. It is very useful to know your + purpose and your wish, and how GRUB didn't satisfy you. + + 6. If you can investigate the problem yourself, please do. That will + give you and us much more information on the problem. Attaching a + patch is even better. + + When you attach a patch, make the patch in unified diff format, and + write ChangeLog entries. But, even when you make a patch, don't + forget to explain the problem, so that we can understand what your + patch is for. + + 7. Write down anything that you think might be related. Please + understand that we often need to reproduce the same problem you + encounterred in our environment. So your information should be + sufficient for us to do the same thing--Don't forget that we + cannot see your computer directly. If you are not sure whether to + state a fact or leave it out, state it! Reporting too many things + is much better than omitting something important. + + If you follow the guideline above, submit a report to the Bug +Tracking System (http://savannah.gnu.org/bugs/?group=grub). +Alternatively, you can submit a report via electronic mail to +, but we strongly recommend that you use the Bug +Tracking System, because e-mail can be passed over easily. + + Once we get your report, we will try to fix the bugs. + + +File: grub.info, Node: Future, Next: Internals, Prev: Reporting bugs, Up: Top + +Where GRUB will go +****************** + + We started the next generation of GRUB, GRUB 2. This will include +internationalization, dynamic module loading, real memory management, +multiple architecture support, a scripting language, and many other +nice feature. If you are interested in the development of GRUB 2, take +a look at the homepage (http://www.gnu.org/software/grub/grub.html). + + +File: grub.info, Node: Internals, Next: Index, Prev: Future, Up: Top + +Hacking GRUB +************ + + This chapter documents the user-invisible aspect of GRUB. + + As a general rule of software development, it is impossible to keep +the descriptions of the internals up-to-date, and it is quite hard to +document everything. So refer to the source code, whenever you are not +satisfied with this documentation. Please assume that this gives just +hints to you. + +* Menu: + +* Memory map:: The memory map of various components +* Embedded data:: Embedded variables in GRUB +* Filesystem interface:: The generic interface for filesystems +* Command interface:: The generic interface for built-ins +* Bootstrap tricks:: The bootstrap mechanism used in GRUB +* I/O ports detection:: How to probe I/O ports used by INT 13H +* Memory detection:: How to detect all installed RAM +* Low-level disk I/O:: INT 13H disk I/O interrupts +* MBR:: The structure of Master Boot Record +* Partition table:: The format of partition tables +* Submitting patches:: Where and how you should send patches + + +File: grub.info, Node: Memory map, Next: Embedded data, Up: Internals + +The memory map of various components +==================================== + + GRUB consists of two distinct components, called "stages", which are +loaded at different times in the boot process. Because they run +mutual-exclusively, sometimes a memory area overlaps with another +memory area. And, even in one stage, a single memory area can be used +for various purposes, because their usages are mutually exclusive. + + Here is the memory map of the various components: + +0 to 4K-1 + BIOS and real mode interrupts + +0x07BE to 0x07FF + Partition table passed to another boot loader + +down from 8K-1 + Real mode stack + +0x2000 to ? + The optional Stage 1.5 is loaded here + +0x2000 to 0x7FFF + Command-line buffer for Multiboot kernels and modules + +0x7C00 to 0x7DFF + Stage 1 is loaded here by BIOS or another boot loader + +0x7F00 to 0x7F42 + LBA drive parameters + +0x8000 to ? + Stage2 is loaded here + +The end of Stage 2 to 416K-1 + Heap, in particular used for the menu + +down from 416K-1 + Protected mode stack + +416K to 448K-1 + Filesystem buffer + +448K to 479.5K-1 + Raw device buffer + +479.5K to 480K-1 + 512-byte scratch area + +480K to 512K-1 + Buffers for various functions, such as password, command-line, cut + and paste, and completion. + +The last 1K of lower memory + Disk swapping code and data + + See the file `stage2/shared.h', for more information. + + +File: grub.info, Node: Embedded data, Next: Filesystem interface, Prev: Memory map, Up: Internals + +Embedded variables in GRUB +========================== + + Stage 1 and Stage 2 have embedded variables whose locations are +well-defined, so that the installation can patch the binary file +directly without recompilation of the stages. + + In Stage 1, these are defined: + +`0x3E' + The version number (not GRUB's, but the installation mechanism's). + +`0x40' + The boot drive. If it is 0xFF, use a drive passed by BIOS. + +`0x41' + The flag for if forcing LBA. + +`0x42' + The starting address of Stage 2. + +`0x44' + The first sector of Stage 2. + +`0x48' + The starting segment of Stage 2. + +`0x1FE' + The signature (`0xAA55'). + + See the file `stage1/stage1.S', for more information. + + In the first sector of Stage 1.5 and Stage 2, the block lists are +recorded between `firstlist' and `lastlist'. The address of `lastlist' +is determined when assembling the file `stage2/start.S'. + + The trick here is that it is actually read backward, and the first +8-byte block list is not read here, but after the pointer is decremented +8 bytes, then after reading it, it decrements again, reads, and so on, +until it is finished. The terminating condition is when the number of +sectors to be read in the next block list is zero. + + The format of a block list can be seen from the example in the code +just before the `firstlist' label. Note that it is always from the +beginning of the disk, but _not_ relative to the partition boundaries. + + In the second sector of Stage 1.5 and Stage 2, these are defined: + +`0x6' + The version number (likewise, the installation mechanism's). + +`0x8' + The installed partition. + +`0xC' + The saved entry number. + +`0x10' + The identifier. + +`0x11' + The flag for if forcing LBA. + +`0x12' + The version string (GRUB's). + +`0x12' + "the length of the version string" + The name of a configuration file. + + See the file `stage2/asm.S', for more information. + + +File: grub.info, Node: Filesystem interface, Next: Command interface, Prev: Embedded data, Up: Internals + +The generic interface for filesystems +===================================== + + For any particular partition, it is presumed that only one of the +"normal" filesystems such as FAT, FFS, or ext2fs can be used, so there +is a switch table managed by the functions in `disk_io.c'. The notation +is that you can only "mount" one at a time. + + The block list filesystem has a special place in the system. In +addition to the "normal" filesystem (or even without one mounted), you +can access disk blocks directly (in the indicated partition) via the +block list notation. Using the block list filesystem doesn't effect any +other filesystem mounts. + + The variables which can be read by the filesystem backend are: + +`current_drive' + The current BIOS drive number (numbered from 0, if a floppy, and + numbered from 0x80, if a hard disk). + +`current_partition' + The current partition number. + +`current_slice' + The current partition type. + +`saved_drive' + The "drive" part of the root device. + +`saved_partition' + The "partition" part of the root device. + +`part_start' + The current partition starting address, in sectors. + +`part_length' + The current partition length, in sectors. + +`print_possibilities' + True when the `dir' function should print the possible completions + of a file, and false when it should try to actually open a file of + that name. + +`FSYS_BUF' + Filesystem buffer which is 32K in size, to use in any way which the + filesystem backend desires. + + The variables which need to be written by a filesystem backend are: + +`filepos' + The current position in the file, in sectors. + + *Caution:* the value of FILEPOS can be changed out from under the + filesystem code in the current implementation. Don't depend on it + being the same for later calls into the backend code! + +`filemax' + The length of the file. + +`disk_read_func' + The value of DISK_READ_HOOK _only_ during reading of data for the + file, not any other fs data, inodes, FAT tables, whatever, then + set to `NULL' at all other times (it will be `NULL' by default). + If this isn't done correctly, then the `testload' and `install' + commands won't work correctly. + + The functions expected to be used by the filesystem backend are: + +`devread' + Only read sectors from within a partition. Sector 0 is the first + sector in the partition. + +`grub_read' + If the backend uses the block list code, then `grub_read' can be + used, after setting BLOCK_FILE to 1. + +`print_a_completion' + If PRINT_POSSIBILITIES is true, call `print_a_completion' for each + possible file name. Otherwise, the file name completion won't work. + + The functions expected to be defined by the filesystem backend are +described at least moderately in the file `filesys.h'. Their usage is +fairly evident from their use in the functions in `disk_io.c', look for +the use of the FSYS_TABLE array. + + *Caution:* The semantics are such that then `mount'ing the +filesystem, presume the filesystem buffer `FSYS_BUF' is corrupted, and +(re-)load all important contents. When opening and reading a file, +presume that the data from the `mount' is available, and doesn't get +corrupted by the open/read (i.e. multiple opens and/or reads will be +done with only one mount if in the same filesystem). + + +File: grub.info, Node: Command interface, Next: Bootstrap tricks, Prev: Filesystem interface, Up: Internals + +The generic interface for built-ins +=================================== + + GRUB built-in commands are defined in a uniformal interface, whether +they are menu-specific or can be used anywhere. The definition of a +builtin command consists of two parts: the code itself and the table of +the information. + + The code must be a function which takes two arguments, a command-line +string and flags, and returns an `int' value. The "flags" argument +specifies how the function is called, using a bit mask. The return +value must be zero if successful, otherwise non-zero. So it is normally +enough to return ERRNUM. + + The table of the information is represented by the structure `struct +builtin', which contains the name of the command, a pointer to the +function, flags, a short description of the command and a long +description of the command. Since the descriptions are used only for +help messages interactively, you don't have to define them, if the +command may not be called interactively (such as `title'). + + The table is finally registered in the table BUILTIN_TABLE, so that +`run_script' and `enter_cmdline' can find the command. See the files +`cmdline.c' and `builtins.c', for more details. + diff --git a/usr/src/grub/grub-0.97/docs/grub.info-4 b/usr/src/grub/grub-0.97/docs/grub.info-4 new file mode 100644 index 0000000000..c1e76ab144 --- /dev/null +++ b/usr/src/grub/grub-0.97/docs/grub.info-4 @@ -0,0 +1,249 @@ +This is grub.info, produced by makeinfo version 4.0 from grub.texi. + +INFO-DIR-SECTION Kernel +START-INFO-DIR-ENTRY +* GRUB: (grub). The GRand Unified Bootloader +* grub-install: (grub)Invoking grub-install. Install GRUB on your drive +* grub-md5-crypt: (grub)Invoking grub-md5-crypt. Encrypt a password + in MD5 format +* grub-terminfo: (grub)Invoking grub-terminfo. Generate a terminfo + command from a + terminfo name +* grub-set-default: (grub)Invoking grub-set-default. Set a default boot + entry +* mbchk: (grub)Invoking mbchk. Check for the format of a Multiboot kernel +END-INFO-DIR-ENTRY + + Copyright (C) 1999,2000,2001,2002,2004 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: grub.info, Node: Bootstrap tricks, Next: I/O ports detection, Prev: Command interface, Up: Internals + +The bootstrap mechanism used in GRUB +==================================== + + The disk space can be used in a boot loader is very restricted +because a MBR (*note MBR::) is only 512 bytes but it also contains a +partition table (*note Partition table::) and a BPB. So the question is +how to make a boot loader code enough small to be fit in a MBR. + + However, GRUB is a very large program, so we break GRUB into 2 (or 3) +distinct components, "Stage 1" and "Stage 2" (and optionally "Stage +1.5"). *Note Memory map::, for more information. + + We embed Stage 1 in a MBR or in the boot sector of a partition, and +place Stage 2 in a filesystem. The optional Stage 1.5 can be installed +in a filesystem, in the "boot loader" area in a FFS or a ReiserFS, and +in the sectors right after a MBR, because Stage 1.5 is enough small and +the sectors right after a MBR is normally an unused region. The size of +this region is the number of sectors per head minus 1. + + Thus, all Stage1 must do is just load Stage2 or Stage1.5. But even if +Stage 1 needs not to support the user interface or the filesystem +interface, it is impossible to make Stage 1 less than 400 bytes, because +GRUB should support both the CHS mode and the LBA mode (*note Low-level +disk I/O::). + + The solution used by GRUB is that Stage 1 loads only the first +sector of Stage 2 (or Stage 1.5) and Stage 2 itself loads the rest. The +flow of Stage 1 is: + + 1. Initialize the system briefly. + + 2. Detect the geometry and the accessing mode of the "loading drive". + + 3. Load the first sector of Stage 2. + + 4. Jump to the starting address of the Stage 2. + + The flow of Stage 2 (and Stage 1.5) is: + + 1. Load the rest of itself to the real starting address, that is, the + starting address plus 512 bytes. The block lists are stored in the + last part of the first sector. + + 2. Long jump to the real starting address. + + Note that Stage 2 (or Stage 1.5) does not probe the geometry or the +accessing mode of the "loading drive", since Stage 1 has already probed +them. + + +File: grub.info, Node: I/O ports detection, Next: Memory detection, Prev: Bootstrap tricks, Up: Internals + +How to probe I/O ports used by INT 13H +====================================== + + FIXME: I will write this chapter after implementing the new +technique. + + +File: grub.info, Node: Memory detection, Next: Low-level disk I/O, Prev: I/O ports detection, Up: Internals + +How to detect all installed RAM +=============================== + + FIXME: I doubt if Erich didn't write this chapter only himself +wholly, so I will rewrite this chapter. + + +File: grub.info, Node: Low-level disk I/O, Next: MBR, Prev: Memory detection, Up: Internals + +INT 13H disk I/O interrupts +=========================== + + FIXME: I'm not sure where some part of the original chapter is +derived, so I will rewrite this chapter. + + +File: grub.info, Node: MBR, Next: Partition table, Prev: Low-level disk I/O, Up: Internals + +The structure of Master Boot Record +=================================== + + FIXME: Likewise. + + +File: grub.info, Node: Partition table, Next: Submitting patches, Prev: MBR, Up: Internals + +The format of partition tables +============================== + + FIXME: Probably the original chapter is derived from "How It Works", +so I will rewrite this chapter. + + +File: grub.info, Node: Submitting patches, Prev: Partition table, Up: Internals + +Where and how you should send patches +===================================== + + When you write patches for GRUB, please send them to the mailing list +. Here is the list of items of which you should take +care: + + * Please make your patch as small as possible. Generally, it is not + a good thing to make one big patch which changes many things. + Instead, segregate features and produce many patches. + + * Use as late code as possible, for the original code. The CVS + repository always has the current version (*note Obtaining and + Building GRUB::). + + * Write ChangeLog entries. *Note Change Logs: (standards)Change + Logs, if you don't know how to write ChangeLog. + + * Make patches in unified diff format. `diff -urN' is appropriate in + most cases. + + * Don't make patches reversely. Reverse patches are difficult to + read and use. + + * Be careful enough of the license term and the copyright. Because + GRUB is under GNU General Public License, you may not steal code + from software whose license is incompatible against GPL. And, if + you copy code written by others, you must not ignore their + copyrights. Feel free to ask GRUB maintainers, whenever you are + not sure what you should do. + + * If your patch is too large to send in e-mail, put it at somewhere + we can see. Usually, you shouldn't send e-mail over 20K. + + +File: grub.info, Node: Index, Prev: Internals, Up: Top + +Index +***** + +* Menu: + +* blocklist: blocklist. +* boot: boot. +* bootp: bootp. +* cat: cat. +* chainloader: chainloader. +* cmp: cmp. +* color: color. +* configfile: configfile. +* current_drive: Filesystem interface. +* current_partition: Filesystem interface. +* current_slice: Filesystem interface. +* debug: debug. +* default: default. +* device: device. +* devread: Filesystem interface. +* dhcp: dhcp. +* disk_read_func: Filesystem interface. +* displayapm: displayapm. +* displaymem: displaymem. +* embed: embed. +* fallback: fallback. +* filemax: Filesystem interface. +* filepos: Filesystem interface. +* find: find. +* fstest: fstest. +* FSYS_BUF: Filesystem interface. +* geometry: geometry. +* grub_read: Filesystem interface. +* halt: halt. +* help: help. +* hiddenmenu: hiddenmenu. +* hide: hide. +* ifconfig: ifconfig. +* impsprobe: impsprobe. +* initrd: initrd. +* install: install. +* ioprobe: ioprobe. +* kernel: kernel. +* lock: lock. +* makeactive: makeactive. +* map: map. +* md5crypt: md5crypt. +* module: module. +* modulenounzip: modulenounzip. +* pager: pager. +* part_length: Filesystem interface. +* part_start: Filesystem interface. +* partnew: partnew. +* parttype: parttype. +* password: password. +* pause: pause. +* print_a_completion: Filesystem interface. +* print_possibilities: Filesystem interface. +* quit: quit. +* rarp: rarp. +* read: read. +* reboot: reboot. +* root: root. +* rootnoverify: rootnoverify. +* saved_drive: Filesystem interface. +* saved_partition: Filesystem interface. +* savedefault: savedefault. +* serial: serial. +* setkey: setkey. +* setup: setup. +* terminal: terminal. +* terminfo: terminfo. +* testload: testload. +* testvbe: testvbe. +* tftpserver: tftpserver. +* timeout: timeout. +* title: title. +* unhide: unhide. +* uppermem: uppermem. +* vbeprobe: vbeprobe. + + diff --git a/usr/src/grub/grub-0.97/docs/grub.texi b/usr/src/grub/grub-0.97/docs/grub.texi new file mode 100644 index 0000000000..c5f694ffbf --- /dev/null +++ b/usr/src/grub/grub-0.97/docs/grub.texi @@ -0,0 +1,3987 @@ +\input texinfo +@c -*-texinfo-*- +@c %**start of header +@setfilename grub.info +@settitle GRUB Manual +@c %**end of header + +@include version.texi + +@c Unify all our little indices for now. +@syncodeindex fn cp +@syncodeindex vr cp +@syncodeindex ky cp +@syncodeindex pg cp +@syncodeindex tp cp + +@footnotestyle separate +@paragraphindent 3 +@finalout + +@dircategory Kernel +@direntry +* GRUB: (grub). The GRand Unified Bootloader +* grub-install: (grub)Invoking grub-install. Install GRUB on your drive +* grub-md5-crypt: (grub)Invoking grub-md5-crypt. Encrypt a password + in MD5 format +* grub-terminfo: (grub)Invoking grub-terminfo. Generate a terminfo + command from a + terminfo name +* grub-set-default: (grub)Invoking grub-set-default. Set a default boot + entry +* mbchk: (grub)Invoking mbchk. Check for the format of a Multiboot kernel +@end direntry + +@setchapternewpage odd + +@ifinfo +Copyright @copyright{} 1999,2000,2001,2002,2004 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. + +@ignore +Permission is granted to process this file through TeX and print the +results, provided the printed document carries a copying permission +notice identical to this one except for the removal of this paragraph +(this paragraph not being relevant to the printed manual). + +@end ignore + +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. +@end ifinfo + +@titlepage +@sp 10 +@title the GRUB manual +@subtitle The GRand Unified Bootloader, version @value{VERSION}, @value{UPDATED}. +@author Gordon Matzigkeit +@author Yoshinori K. Okuji +@c The following two commands start the copyright page. +@page +@vskip 0pt plus 1filll +Copyright @copyright{} 1999,2000,2001,2002,2004 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 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, +except that this permission notice may be stated in a translation approved +by Free Software Foundation. +@end titlepage + +@c Output the table of contents at the beginning. +@contents + +@finalout +@headings double + +@ifnottex +@node Top +@top GRUB manual + +This is the documentation of GNU GRUB, the GRand Unified Bootloader, +a flexible and powerful boot loader program for @sc{pc}s. + +This edition documents version @value{VERSION}. +@end ifnottex + +@menu +* Introduction:: Capturing the spirit of GRUB +* Naming convention:: Names of your drives in GRUB +* Installation:: Installing GRUB on your drive +* Booting:: How to boot different operating systems +* Configuration:: Writing your own configuration file +* Network:: Downloading OS images from a network +* Serial terminal:: Using GRUB via a serial line +* Preset Menu:: Embedding a configuration file into GRUB +* Security:: Improving the security +* Images:: GRUB image files +* Filesystem:: Filesystem syntax and semantics +* Interface:: The menu and the command-line +* Commands:: The list of available builtin commands +* Troubleshooting:: Error messages produced by GRUB +* Invoking the grub shell:: How to use the grub shell +* Invoking grub-install:: How to use the GRUB installer +* Invoking grub-md5-crypt:: How to generate a cryptic password +* Invoking grub-terminfo:: How to generate a terminfo command +* Invoking grub-set-default:: How to set a default boot entry +* Invoking mbchk:: How to use the Multiboot checker +* Obtaining and Building GRUB:: How to obtain and build GRUB +* Reporting bugs:: Where you should send a bug report +* Future:: Some future plans on GRUB +* Internals:: Hacking GRUB +* Index:: +@end menu + + +@node Introduction +@chapter Introduction to GRUB + +@menu +* Overview:: What exactly GRUB is and how to use it +* History:: From maggot to house fly +* Features:: GRUB features +* Role of a boot loader:: The role of a boot loader +@end menu + + +@node Overview +@section Overview + +Briefly, a @dfn{boot loader} is the first software program that runs when +a computer starts. It is responsible for loading and transferring +control to an operating system @dfn{kernel} software (such as Linux or +GNU Mach). The kernel, in turn, initializes the rest of the operating +system (e.g. a GNU system). + +GNU GRUB is a very powerful boot loader, which can load a wide variety +of free operating systems, as well as proprietary operating systems with +chain-loading@footnote{@dfn{chain-load} is the mechanism for loading +unsupported operating systems by loading another boot loader. It is +typically used for loading DOS or Windows.}. GRUB is designed to +address the complexity of booting a personal computer; both the +program and this manual are tightly bound to that computer platform, +although porting to other platforms may be addressed in the future. + +One of the important features in GRUB is flexibility; GRUB understands +filesystems and kernel executable formats, so you can load an arbitrary +operating system the way you like, without recording the physical +position of your kernel on the disk. Thus you can load the kernel +just by specifying its file name and the drive and partition where the +kernel resides. + +When booting with GRUB, you can use either a command-line interface +(@pxref{Command-line interface}), or a menu interface (@pxref{Menu +interface}). Using the command-line interface, you type the drive +specification and file name of the kernel manually. In the menu +interface, you just select an OS using the arrow keys. The menu is +based on a configuration file which you prepare beforehand +(@pxref{Configuration}). While in the menu, you can switch to the +command-line mode, and vice-versa. You can even edit menu entries +before using them. + +In the following chapters, you will learn how to specify a drive, a +partition, and a file name (@pxref{Naming convention}) to GRUB, how to +install GRUB on your drive (@pxref{Installation}), and how to boot your +OSes (@pxref{Booting}), step by step. + +Besides the GRUB boot loader itself, there is a @dfn{grub shell} +@command{grub} (@pxref{Invoking the grub shell}) which can be run when +you are in your operating system. It emulates the boot loader and can +be used for installing the boot loader. + + +@node History +@section History of GRUB + +GRUB originated in 1995 when Erich Boleyn was trying to boot the GNU +Hurd with the University of Utah's Mach 4 microkernel (now known as GNU +Mach). Erich and Brian Ford designed the Multiboot Specification +(@pxref{Top, Multiboot Specification, Motivation, multiboot, The Multiboot +Specification}), because they were determined not to add to the large +number of mutually-incompatible PC boot methods. + +Erich then began modifying the FreeBSD boot loader so that it would +understand Multiboot. He soon realized that it would be a lot easier +to write his own boot loader from scratch than to keep working on the +FreeBSD boot loader, and so GRUB was born. + +Erich added many features to GRUB, but other priorities prevented him +from keeping up with the demands of its quickly-expanding user base. In +1999, Gordon Matzigkeit and Yoshinori K. Okuji adopted GRUB as an +official GNU package, and opened its development by making the latest +sources available via anonymous CVS. @xref{Obtaining and Building +GRUB}, for more information. + + +@node Features +@section GRUB features + +The primary requirement for GRUB is that it be compliant with the +@dfn{Multiboot Specification}, which is described in @ref{Top, Multiboot +Specification, Motivation, multiboot, The Multiboot Specification}. + +The other goals, listed in approximate order of importance, are: + +@itemize @bullet{} +@item +Basic functions must be straightforward for end-users. + +@item +Rich functionality to support kernel experts and designers. + +@item +Backward compatibility for booting FreeBSD, NetBSD, OpenBSD, and +Linux. Proprietary kernels (such as DOS, Windows NT, and OS/2) are +supported via a chain-loading function. +@end itemize + +Except for specific compatibility modes (chain-loading and the Linux +@dfn{piggyback} format), all kernels will be started in much the same +state as in the Multiboot Specification. Only kernels loaded at 1 megabyte +or above are presently supported. Any attempt to load below that +boundary will simply result in immediate failure and an error message +reporting the problem. + +In addition to the requirements above, GRUB has the following features +(note that the Multiboot Specification doesn't require all the features +that GRUB supports): + +@table @asis +@item Recognize multiple executable formats +Support many of the @dfn{a.out} variants plus @dfn{ELF}. Symbol +tables are also loaded. + +@item Support non-Multiboot kernels +Support many of the various free 32-bit kernels that lack Multiboot +compliance (primarily FreeBSD, NetBSD, OpenBSD, and +Linux). Chain-loading of other boot loaders is also supported. + +@item Load multiples modules +Fully support the Multiboot feature of loading multiple modules. + +@item Load a configuration file +Support a human-readable text configuration file with preset boot +commands. You can also load another configuration file dynamically and +embed a preset configuration file in a GRUB image file. The list of +commands (@pxref{Commands}) are a superset of those supported on the +command-line. An example configuration file is provided in +@ref{Configuration}. + +@item Provide a menu interface +A menu interface listing preset boot commands, with a programmable +timeout, is available. There is no fixed limit on the number of boot +entries, and the current implementation has space for several hundred. + +@item Have a flexible command-line interface +A fairly flexible command-line interface, accessible from the menu, +is available to edit any preset commands, or write a new boot command +set from scratch. If no configuration file is present, GRUB drops to +the command-line. + +The list of commands (@pxref{Commands}) are a subset of those supported +for configuration files. Editing commands closely resembles the Bash +command-line (@pxref{Command Line Editing, Bash, Command Line Editing, +features, Bash Features}), with @key{TAB}-completion of commands, +devices, partitions, and files in a directory depending on context. + +@item Support multiple filesystem types +Support multiple filesystem types transparently, plus a useful explicit +blocklist notation. The currently supported filesystem types are +@dfn{BSD FFS}, @dfn{DOS FAT16 and FAT32}, @dfn{Minix fs}, @dfn{Linux +ext2fs}, @dfn{ReiserFS}, @dfn{JFS}, @dfn{XFS}, and @dfn{VSTa +fs}. @xref{Filesystem}, for more information. + +@item Support automatic decompression +Can decompress files which were compressed by @command{gzip}. This +function is both automatic and transparent to the user (i.e. all +functions operate upon the uncompressed contents of the specified +files). This greatly reduces a file size and loading time, a +particularly great benefit for floppies.@footnote{There are a few +pathological cases where loading a very badly organized ELF kernel might +take longer, but in practice this never happen.} + +It is conceivable that some kernel modules should be loaded in a +compressed state, so a different module-loading command can be specified +to avoid uncompressing the modules. + +@item Access data on any installed device +Support reading data from any or all floppies or hard disk(s) recognized +by the BIOS, independent of the setting of the root device. + +@item Be independent of drive geometry translations +Unlike many other boot loaders, GRUB makes the particular drive +translation irrelevant. A drive installed and running with one +translation may be converted to another translation without any adverse +effects or changes in GRUB's configuration. + +@item Detect all installed @sc{ram} +GRUB can generally find all the installed @sc{ram} on a PC-compatible +machine. It uses an advanced BIOS query technique for finding all +memory regions. As described on the Multiboot Specification (@pxref{Top, +Multiboot Specification, Motivation, multiboot, The Multiboot +Specification}), not all kernels make use of this information, but GRUB +provides it for those who do. + +@item Support Logical Block Address mode +In traditional disk calls (called @dfn{CHS mode}), there is a geometry +translation problem, that is, the BIOS cannot access over 1024 +cylinders, so the accessible space is limited to at least 508 MB and to +at most 8GB. GRUB can't universally solve this problem, as there is no +standard interface used in all machines. However, several newer machines +have the new interface, Logical Block Address (@dfn{LBA}) mode. GRUB +automatically detects if LBA mode is available and uses it if +available. In LBA mode, GRUB can access the entire disk. + +@item Support network booting +GRUB is basically a disk-based boot loader but also has network +support. You can load OS images from a network by using the @dfn{TFTP} +protocol. + +@item Support remote terminals +To support computers with no console, GRUB provides remote terminal +support, so that you can control GRUB from a remote host. Only serial +terminal support is implemented at the moment. +@end table + + +@node Role of a boot loader +@section The role of a boot loader + +The following is a quotation from Gordon Matzigkeit, a GRUB fanatic: + +@quotation +Some people like to acknowledge both the operating system and kernel when +they talk about their computers, so they might say they use +``GNU/Linux'' or ``GNU/Hurd''. Other people seem to think that the +kernel is the most important part of the system, so they like to call +their GNU operating systems ``Linux systems.'' + +I, personally, believe that this is a grave injustice, because the +@emph{boot loader} is the most important software of all. I used to +refer to the above systems as either ``LILO''@footnote{The LInux LOader, +a boot loader that everybody uses, but nobody likes.} or ``GRUB'' +systems. + +Unfortunately, nobody ever understood what I was talking about; now I +just use the word ``GNU'' as a pseudonym for GRUB. + +So, if you ever hear people talking about their alleged ``GNU'' systems, +remember that they are actually paying homage to the best boot loader +around@dots{} GRUB! +@end quotation + +We, the GRUB maintainers, do not (usually) encourage Gordon's level of +fanaticism, but it helps to remember that boot loaders deserve +recognition. We hope that you enjoy using GNU GRUB as much as we did +writing it. + + +@node Naming convention +@chapter Naming convention + +The device syntax used in GRUB is a wee bit different from what you may +have seen before in your operating system(s), and you need to know it so +that you can specify a drive/partition. + +Look at the following examples and explanations: + +@example +(fd0) +@end example + +First of all, GRUB requires that the device name be enclosed with +@samp{(} and @samp{)}. The @samp{fd} part means that it is a floppy +disk. The number @samp{0} is the drive number, which is counted from +@emph{zero}. This expression means that GRUB will use the whole floppy +disk. + +@example +(hd0,1) +@end example + +Here, @samp{hd} means it is a hard disk drive. The first integer +@samp{0} indicates the drive number, that is, the first hard disk, while +the second integer, @samp{1}, indicates the partition number (or the +@sc{pc} slice number in the BSD terminology). Once again, please note +that the partition numbers are counted from @emph{zero}, not from +one. This expression means the second partition of the first hard disk +drive. In this case, GRUB uses one partition of the disk, instead of the +whole disk. + +@example +(hd0,4) +@end example + +This specifies the first @dfn{extended partition} of the first hard disk +drive. Note that the partition numbers for extended partitions are +counted from @samp{4}, regardless of the actual number of primary +partitions on your hard disk. + +@example +(hd1,a) +@end example + +This means the BSD @samp{a} partition of the second hard disk. If you +need to specify which @sc{pc} slice number should be used, use something +like this: @samp{(hd1,0,a)}. If the @sc{pc} slice number is omitted, +GRUB searches for the first @sc{pc} slice which has a BSD @samp{a} +partition. + +Of course, to actually access the disks or partitions with GRUB, you +need to use the device specification in a command, like @samp{root +(fd0)} or @samp{unhide (hd0,2)}. To help you find out which number +specifies a partition you want, the GRUB command-line +(@pxref{Command-line interface}) options have argument +completion. This means that, for example, you only need to type + +@example +root ( +@end example + +followed by a @key{TAB}, and GRUB will display the list of drives, +partitions, or file names. So it should be quite easy to determine the +name of your target partition, even with minimal knowledge of the +syntax. + +Note that GRUB does @emph{not} distinguish IDE from SCSI - it simply +counts the drive numbers from zero, regardless of their type. Normally, +any IDE drive number is less than any SCSI drive number, although that +is not true if you change the boot sequence by swapping IDE and SCSI +drives in your BIOS. + +Now the question is, how to specify a file? Again, consider an +example: + +@example +(hd0,0)/vmlinuz +@end example + +This specifies the file named @samp{vmlinuz}, found on the first +partition of the first hard disk drive. Note that the argument +completion works with file names, too. + +That was easy, admit it. Now read the next chapter, to find out how to +actually install GRUB on your drive. + + +@node Installation +@chapter Installation + +In order to install GRUB as your boot loader, you need to first +install the GRUB system and utilities under your UNIX-like operating +system (@pxref{Obtaining and Building GRUB}). You can do this either +from the source tarball, or as a package for your OS. + +After you have done that, you need to install the boot loader on a +drive (floppy or hard disk). There are two ways of doing that - either +using the utility @command{grub-install} (@pxref{Invoking +grub-install}) on a UNIX-like OS, or by running GRUB itself from a +floppy. These are quite similar, however the utility might probe a +wrong BIOS drive, so you should be careful. + +Also, if you install GRUB on a UNIX-like OS, please make sure that you +have an emergency boot disk ready, so that you can rescue your computer +if, by any chance, your hard drive becomes unusable (unbootable). + +GRUB comes with boot images, which are normally put in the directory +@file{/usr/lib/grub/i386-pc}. If you do not use grub-install, then +you need to copy the files @file{stage1}, @file{stage2}, and +@file{*stage1_5} to the directory @file{/boot/grub}, and run the +@command{grub-set-default} (@pxref{Invoking grub-set-default}) if you +intend to use @samp{default saved} (@pxref{default}) in your +configuration file. Hereafter, the directory where GRUB images are +initially placed (normally @file{/usr/lib/grub/i386-pc}) will be +called the @dfn{image directory}, and the directory where the boot +loader needs to find them (usually @file{/boot/grub}) will be called +the @dfn{boot directory}. + +@menu +* Creating a GRUB boot floppy:: +* Installing GRUB natively:: +* Installing GRUB using grub-install:: +* Making a GRUB bootable CD-ROM:: +@end menu + + +@node Creating a GRUB boot floppy +@section Creating a GRUB boot floppy + +To create a GRUB boot floppy, you need to take the files @file{stage1} +and @file{stage2} from the image directory, and write them to the first +and the second block of the floppy disk, respectively. + +@strong{Caution:} This procedure will destroy any data currently stored +on the floppy. + +On a UNIX-like operating system, that is done with the following +commands: + +@example +@group +# @kbd{cd /usr/lib/grub/i386-pc} +# @kbd{dd if=stage1 of=/dev/fd0 bs=512 count=1} +1+0 records in +1+0 records out +# @kbd{dd if=stage2 of=/dev/fd0 bs=512 seek=1} +153+1 records in +153+1 records out +# +@end group +@end example + +The device file name may be different. Consult the manual for your OS. + + +@node Installing GRUB natively +@section Installing GRUB natively + +@strong{Caution:} Installing GRUB's stage1 in this manner will erase the +normal boot-sector used by an OS. + +GRUB can currently boot GNU Mach, Linux, FreeBSD, NetBSD, and OpenBSD +directly, so using it on a boot sector (the first sector of a +partition) should be okay. But generally, it would be a good idea to +back up the first sector of the partition on which you are installing +GRUB's stage1. This isn't as important if you are installing GRUB on +the first sector of a hard disk, since it's easy to reinitialize it +(e.g. by running @samp{FDISK /MBR} from DOS). + +If you decide to install GRUB in the native environment, which is +definitely desirable, you'll need to create a GRUB boot disk, and +reboot your computer with it. Otherwise, see @ref{Installing GRUB using +grub-install}. + +Once started, GRUB will show the command-line interface +(@pxref{Command-line interface}). First, set the GRUB's @dfn{root +device}@footnote{Note that GRUB's root device doesn't necessarily mean +your OS's root partition; if you need to specify a root partition for +your OS, add the argument into the command @command{kernel}.} to the +partition containing the boot directory, like this: + +@example +grub> @kbd{root (hd0,0)} +@end example + +If you are not sure which partition actually holds this directory, use the +command @command{find} (@pxref{find}), like this: + +@example +grub> @kbd{find /boot/grub/stage1} +@end example + +This will search for the file name @file{/boot/grub/stage1} and show the +devices which contain the file. + +Once you've set the root device correctly, run the command +@command{setup} (@pxref{setup}): + +@example +grub> @kbd{setup (hd0)} +@end example + +This command will install the GRUB boot loader on the Master Boot +Record (MBR) of the first drive. If you want to put GRUB into the boot +sector of a partition instead of putting it in the MBR, specify the +partition into which you want to install GRUB: + +@example +grub> @kbd{setup (hd0,0)} +@end example + +If you install GRUB into a partition or a drive other than the first +one, you must chain-load GRUB from another boot loader. Refer to the +manual for the boot loader to know how to chain-load GRUB. + +After using the setup command, you will boot into GRUB without the +GRUB floppy. See the chapter @ref{Booting} to find out how to boot +your operating systems from GRUB. + + +@node Installing GRUB using grub-install +@section Installing GRUB using grub-install + +@strong{Caution:} This procedure is definitely less safe, because +there are several ways in which your computer can become +unbootable. For example, most operating systems don't tell GRUB how to +map BIOS drives to OS devices correctly---GRUB merely @dfn{guesses} +the mapping. This will succeed in most cases, but not +always. Therefore, GRUB provides you with a map file called the +@dfn{device map}, which you must fix if it is wrong. @xref{Device +map}, for more details. + +If you still do want to install GRUB under a UNIX-like OS (such +as @sc{gnu}), invoke the program @command{grub-install} (@pxref{Invoking +grub-install}) as the superuser (@dfn{root}). + +The usage is basically very simple. You only need to specify one +argument to the program, namely, where to install the boot loader. The +argument can be either a device file (like @samp{/dev/hda}) or a +partition specified in GRUB's notation. For example, under Linux the +following will install GRUB into the MBR of the first IDE disk: + +@example +# @kbd{grub-install /dev/hda} +@end example + +Likewise, under GNU/Hurd, this has the same effect: + +@example +# @kbd{grub-install /dev/hd0} +@end example + +If it is the first BIOS drive, this is the same as well: + +@example +# @kbd{grub-install '(hd0)'} +@end example + +Or you can omit the parentheses: + +@example +# @kbd{grub-install hd0} +@end example + +But all the above examples assume that GRUB should use images under +the root directory. If you want GRUB to use images under a directory +other than the root directory, you need to specify the option +@option{--root-directory}. The typical usage is that you create a GRUB +boot floppy with a filesystem. Here is an example: + +@example +@group +# @kbd{mke2fs /dev/fd0} +# @kbd{mount -t ext2 /dev/fd0 /mnt} +# @kbd{grub-install --root-directory=/mnt fd0} +# @kbd{umount /mnt} +@end group +@end example + +Another example is when you have a separate boot partition +which is mounted at @file{/boot}. Since GRUB is a boot loader, it +doesn't know anything about mountpoints at all. Thus, you need to run +@command{grub-install} like this: + +@example +# @kbd{grub-install --root-directory=/boot /dev/hda} +@end example + +By the way, as noted above, it is quite difficult to guess BIOS drives +correctly under a UNIX-like OS. Thus, @command{grub-install} will prompt +you to check if it could really guess the correct mappings, after the +installation. The format is defined in @ref{Device map}. Please be +quite careful. If the output is wrong, it is unlikely that your +computer will be able to boot with no problem. + +Note that @command{grub-install} is actually just a shell script and the +real task is done by the grub shell @command{grub} (@pxref{Invoking the +grub shell}). Therefore, you may run @command{grub} directly to install +GRUB, without using @command{grub-install}. Don't do that, however, +unless you are very familiar with the internals of GRUB. Installing a +boot loader on a running OS may be extremely dangerous. + + +@node Making a GRUB bootable CD-ROM +@section Making a GRUB bootable CD-ROM + +GRUB supports the @dfn{no emulation mode} in the El Torito +specification@footnote{El Torito is a specification for bootable CD +using BIOS functions.}. This means that you can use the whole CD-ROM +from GRUB and you don't have to make a floppy or hard disk image file, +which can cause compatibility problems. + +For booting from a CD-ROM, GRUB uses a special Stage 2 called +@file{stage2_eltorito}. The only GRUB files you need to have in your +bootable CD-ROM are this @file{stage2_eltorito} and optionally a config file +@file{menu.lst}. You don't need to use @file{stage1} or @file{stage2}, +because El Torito is quite different from the standard boot process. + +Here is an example of procedures to make a bootable CD-ROM +image. First, make a top directory for the bootable image, say, +@samp{iso}: + +@example +$ @kbd{mkdir iso} +@end example + +Make a directory for GRUB: + +@example +$ @kbd{mkdir -p iso/boot/grub} +@end example + +Copy the file @file{stage2_eltorito}: + +@example +$ @kbd{cp /usr/lib/grub/i386-pc/stage2_eltorito iso/boot/grub} +@end example + +If desired, make the config file @file{menu.lst} under @file{iso/boot/grub} +(@pxref{Configuration}), and copy any files and directories for the disc to the +directory @file{iso/}. + +Finally, make a ISO9660 image file like this: + +@example +$ @kbd{mkisofs -R -b boot/grub/stage2_eltorito -no-emul-boot \ + -boot-load-size 4 -boot-info-table -o grub.iso iso} +@end example + +This produces a file named @file{grub.iso}, which then can be burned +into a CD (or a DVD). @kbd{mkisofs} has already set up the disc to boot +from the @kbd{boot/grub/stage2_eltorito} file, so there is no need to +setup GRUB on the disc. (Note that the @kbd{-boot-load-size 4} bit is +required for compatibility with the BIOS on many older machines.) + +You can use the device @samp{(cd)} to access a CD-ROM in your +config file. This is not required; GRUB automatically sets the root device +to @samp{(cd)} when booted from a CD-ROM. It is only necessary to refer to +@samp{(cd)} if you want to access other drives as well. + + +@node Booting +@chapter Booting + +GRUB can load Multiboot-compliant kernels in a consistent way, +but for some free operating systems you need to use some OS-specific +magic. + +@menu +* General boot methods:: How to boot OSes with GRUB generally +* OS-specific notes:: Notes on some operating systems +* Making your system robust:: How to make your system robust +@end menu + + +@node General boot methods +@section How to boot operating systems + +GRUB has two distinct boot methods. One of the two is to load an +operating system directly, and the other is to chain-load another boot +loader which then will load an operating system actually. Generally +speaking, the former is more desirable, because you don't need to +install or maintain other boot loaders and GRUB is flexible enough to +load an operating system from an arbitrary disk/partition. However, +the latter is sometimes required, since GRUB doesn't support all the +existing operating systems natively. + +@menu +* Loading an operating system directly:: +* Chain-loading:: +@end menu + + +@node Loading an operating system directly +@subsection How to boot an OS directly with GRUB + +Multiboot (@pxref{Top, Multiboot Specification, Motivation, multiboot, +The Multiboot Specification}) is the native format supported by GRUB. +For the sake of convenience, there is also support for Linux, FreeBSD, +NetBSD and OpenBSD. If you want to boot other operating systems, you +will have to chain-load them (@pxref{Chain-loading}). + +Generally, GRUB can boot any Multiboot-compliant OS in the following +steps: + +@enumerate +@item +Set GRUB's root device to the drive where the OS images are stored with +the command @command{root} (@pxref{root}). + +@item +Load the kernel image with the command @command{kernel} (@pxref{kernel}). + +@item +If you need modules, load them with the command @command{module} +(@pxref{module}) or @command{modulenounzip} (@pxref{modulenounzip}). + +@item +Run the command @command{boot} (@pxref{boot}). +@end enumerate + +Linux, FreeBSD, NetBSD and OpenBSD can be booted in a similar +manner. You load a kernel image with the command @command{kernel} and +then run the command @command{boot}. If the kernel requires some +parameters, just append the parameters to @command{kernel}, after the +file name of the kernel. Also, please refer to @ref{OS-specific notes}, +for information on your OS-specific issues. + + +@node Chain-loading +@subsection Load another boot loader to boot unsupported operating systems + +If you want to boot an unsupported operating system (e.g. Windows 95), +chain-load a boot loader for the operating system. Normally, the boot +loader is embedded in the @dfn{boot sector} of the partition on which +the operating system is installed. + +@enumerate +@item +Set GRUB's root device to the partition by the command +@command{rootnoverify} (@pxref{rootnoverify}): + +@example +grub> @kbd{rootnoverify (hd0,0)} +@end example + +@item +Set the @dfn{active} flag in the partition using the command +@command{makeactive}@footnote{This is not necessary for most of the +modern operating systems.} (@pxref{makeactive}): + +@example +grub> @kbd{makeactive} +@end example + +@item +Load the boot loader with the command @command{chainloader} +(@pxref{chainloader}): + +@example +grub> @kbd{chainloader +1} +@end example + +@samp{+1} indicates that GRUB should read one sector from the start of +the partition. The complete description about this syntax can be found +in @ref{Block list syntax}. + +@item +Run the command @command{boot} (@pxref{boot}). +@end enumerate + +However, DOS and Windows have some deficiencies, so you might have to +use more complicated instructions. @xref{DOS/Windows}, for more +information. + + +@node OS-specific notes +@section Some caveats on OS-specific issues + +Here, we describe some caveats on several operating systems. + +@menu +* GNU/Hurd:: +* GNU/Linux:: +* FreeBSD:: +* NetBSD:: +* OpenBSD:: +* DOS/Windows:: +* SCO UnixWare:: +* QNX:: +@end menu + + +@node GNU/Hurd +@subsection GNU/Hurd + +Since GNU/Hurd is Multiboot-compliant, it is easy to boot it; there is +nothing special about it. But do not forget that you have to specify a +root partition to the kernel. + +@enumerate +@item +Set GRUB's root device to the same drive as GNU/Hurd's. Probably the +command @code{find /boot/gnumach} or similar can help you +(@pxref{find}). + +@item +Load the kernel and the module, like this: + +@example +@group +grub> @kbd{kernel /boot/gnumach root=hd0s1} +grub> @kbd{module /boot/serverboot} +@end group +@end example + +@item +Run the command @command{boot} (@pxref{boot}). +@end enumerate + + +@node GNU/Linux +@subsection GNU/Linux + +It is relatively easy to boot GNU/Linux from GRUB, because it somewhat +resembles to boot a Multiboot-compliant OS. + +@enumerate +@item +Set GRUB's root device to the same drive as GNU/Linux's. Probably the +command @code{find /vmlinuz} or similar can help you (@pxref{find}). + +@item +Load the kernel: + +@example +grub> @kbd{kernel /vmlinuz root=/dev/hda1} +@end example + +If you need to specify some kernel parameters, just append them to the +command. For example, to set @option{vga} to @samp{ext}, do this: + +@example +grub> @kbd{kernel /vmlinuz root=/dev/hda1 vga=ext} +@end example + +See the documentation in the Linux source tree for complete +information on the available options. + +@item +If you use an initrd, execute the command @command{initrd} +(@pxref{initrd}) after @command{kernel}: + +@example +grub> @kbd{initrd /initrd} +@end example + +@item +Finally, run the command @command{boot} (@pxref{boot}). +@end enumerate + +@strong{Caution:} If you use an initrd and specify the @samp{mem=} +option to the kernel to let it use less than actual memory size, you +will also have to specify the same memory size to GRUB. To let GRUB know +the size, run the command @command{uppermem} @emph{before} loading the +kernel. @xref{uppermem}, for more information. + + +@node FreeBSD +@subsection FreeBSD + +GRUB can load the kernel directly, either in ELF or a.out format. But +this is not recommended, since FreeBSD's bootstrap interface sometimes +changes heavily, so GRUB can't guarantee to pass kernel parameters +correctly. + +Thus, we'd recommend loading the very flexible loader +@file{/boot/loader} instead. See this example: + +@example +@group +grub> @kbd{root (hd0,a)} +grub> @kbd{kernel /boot/loader} +grub> @kbd{boot} +@end group +@end example + + +@node NetBSD +@subsection NetBSD + +GRUB can load NetBSD a.out and ELF directly, follow these steps: + +@enumerate +@item +Set GRUB's root device with @command{root} (@pxref{root}). + +@item +Load the kernel with @command{kernel} (@pxref{kernel}). You should +append the ugly option @option{--type=netbsd}, if you want to load an +ELF kernel, like this: + +@example +grub> @kbd{kernel --type=netbsd /netbsd-elf} +@end example + +@item +Run @command{boot} (@pxref{boot}). +@end enumerate + +For now, however, GRUB doesn't allow you to pass kernel parameters, so +it may be better to chain-load it instead. For more information, please +see @ref{Chain-loading}. + + +@node OpenBSD +@subsection OpenBSD + +The booting instruction is exactly the same as for NetBSD +(@pxref{NetBSD}). + + +@node DOS/Windows +@subsection DOS/Windows + +GRUB cannot boot DOS or Windows directly, so you must chain-load them +(@pxref{Chain-loading}). However, their boot loaders have some critical +deficiencies, so it may not work to just chain-load them. To overcome +the problems, GRUB provides you with two helper functions. + +If you have installed DOS (or Windows) on a non-first hard disk, you +have to use the disk swapping technique, because that OS cannot boot +from any disks but the first one. The workaround used in GRUB is the +command @command{map} (@pxref{map}), like this: + +@example +@group +grub> @kbd{map (hd0) (hd1)} +grub> @kbd{map (hd1) (hd0)} +@end group +@end example + +This performs a @dfn{virtual} swap between your first and second hard +drive. + +@strong{Caution:} This is effective only if DOS (or Windows) uses BIOS +to access the swapped disks. If that OS uses a special driver for the +disks, this probably won't work. + +Another problem arises if you installed more than one set of DOS/Windows +onto one disk, because they could be confused if there are more than one +primary partitions for DOS/Windows. Certainly you should avoid doing +this, but there is a solution if you do want to do so. Use the partition +hiding/unhiding technique. + +If GRUB @dfn{hide}s a DOS (or Windows) partition (@pxref{hide}), DOS (or +Windows) will ignore the partition. If GRUB @dfn{unhide}s a DOS (or +Windows) partition (@pxref{unhide}), DOS (or Windows) will detect the +partition. Thus, if you have installed DOS (or Windows) on the first +and the second partition of the first hard disk, and you want to boot +the copy on the first partition, do the following: + +@example +@group +grub> @kbd{unhide (hd0,0)} +grub> @kbd{hide (hd0,1)} +grub> @kbd{rootnoverify (hd0,0)} +grub> @kbd{chainloader +1} +grub> @kbd{makeactive} +grub> @kbd{boot} +@end group +@end example + + +@node SCO UnixWare +@subsection SCO UnixWare + +It is known that the signature in the boot loader for SCO UnixWare is +wrong, so you will have to specify the option @option{--force} to +@command{chainloader} (@pxref{chainloader}), like this: + +@example +@group +grub> @kbd{rootnoverify (hd1,0)} +grub> @kbd{chainloader --force +1} +grub> @kbd{makeactive} +grub> @kbd{boot} +@end group +@end example + + +@node QNX +@subsection QNX + +QNX seems to use a bigger boot loader, so you need to boot it up, like +this: + +@example +@group +grub> @kbd{rootnoverify (hd1,1)} +grub> @kbd{chainloader +4} +grub> @kbd{boot} +@end group +@end example + + +@node Making your system robust +@section How to make your system robust + +When you test a new kernel or a new OS, it is important to make sure +that your computer can boot even if the new system is unbootable. This +is crucial especially if you maintain servers or remote systems. To +accomplish this goal, you need to set up two things: + +@enumerate +@item +You must maintain a system which is always bootable. For instance, if +you test a new kernel, you need to keep a working kernel in a +different place. And, it would sometimes be very nice to even have a +complete copy of a working system in a different partition or disk. + +@item +You must direct GRUB to boot a working system when the new system +fails. This is possible with the @dfn{fallback} system in GRUB. +@end enumerate + +The former requirement is very specific to each OS, so this +documentation does not cover that topic. It is better to consult some +backup tools. + +So let's see the GRUB part. There are two possibilities: one of them +is quite simple but not very robust, and the other is a bit complex to +set up but probably the best solution to make sure that your system +can start as long as GRUB itself is bootable. + +@menu +* Booting once-only:: +* Booting fallback systems:: +@end menu + + +@node Booting once-only +@subsection Booting once-only + +You can teach GRUB to boot an entry only at next boot time. Suppose +that your have an old kernel @file{old_kernel} and a new kernel +@file{new_kernel}. You know that @file{old_kernel} can boot +your system correctly, and you want to test @file{new_kernel}. + +To ensure that your system will go back to the old kernel even if the +new kernel fails (e.g. it panics), you can specify that GRUB should +try the new kernel only once and boot the old kernel after that. + +First, modify your configuration file. Here is an example: + +@example +@group +default saved # This is important!!! +timeout 10 + +title the old kernel +root (hd0,0) +kernel /old_kernel +savedefault + +title the new kernel +root (hd0,0) +kernel /new_kernel +savedefault 0 # This is important!!! +@end group +@end example + +Note that this configuration file uses @samp{default saved} +(@pxref{default}) at the head and @samp{savedefault 0} +(@pxref{savedefault}) in the entry for the new kernel. This means +that GRUB boots a saved entry by default, and booting the entry for the +new kernel saves @samp{0} as the saved entry. + +With this configuration file, after all, GRUB always tries to boot the +old kernel after it booted the new one, because @samp{0} is the entry +of @code{the old kernel}. + +The next step is to tell GRUB to boot the new kernel at next boot +time. For this, execute @command{grub-set-default} (@pxref{Invoking +grub-set-default}): + +@example +# @kbd{grub-set-default 1} +@end example + +This command sets the saved entry to @samp{1}, that is, to the new +kernel. + +This method is useful, but still not very robust, because GRUB stops +booting, if there is any error in the boot entry, such that the new +kernel has an invalid executable format. Thus, it it even better to +use the @dfn{fallback} mechanism of GRUB. Look at next subsection for +this feature. + + +@node Booting fallback systems +@subsection Booting fallback systems + +GRUB supports a fallback mechanism of booting one or more other +entries if a default boot entry fails. You can specify multiple +fallback entries if you wish. + +Suppose that you have three systems, @samp{A}, @samp{B} and +@samp{C}. @samp{A} is a system which you want to boot by +default. @samp{B} is a backup system which is supposed to boot +safely. @samp{C} is another backup system which is used in case where +@samp{B} is broken. + +Then you may want GRUB to boot the first system which is bootable +among @samp{A}, @samp{B} and @samp{C}. A configuration file can be +written in this way: + +@example +@group +default saved # This is important!!! +timeout 10 +fallback 1 2 # This is important!!! + +title A +root (hd0,0) +kernel /kernel +savedefault fallback # This is important!!! + +title B +root (hd1,0) +kernel /kernel +savedefault fallback # This is important!!! + +title C +root (hd2,0) +kernel /kernel +savedefault +@end group +@end example + +Note that @samp{default saved} (@pxref{default}), @samp{fallback 1 2} +and @samp{savedefault fallback} are used. GRUB will boot a saved entry +by default and save a fallback entry as next boot entry with this +configuration. + +When GRUB tries to boot @samp{A}, GRUB saves @samp{1} as next boot +entry, because the command @command{fallback} specifies that @samp{1} +is the first fallback entry. The entry @samp{1} is @samp{B}, so GRUB +will try to boot @samp{B} at next boot time. + +Likewise, when GRUB tries to boot @samp{B}, GRUB saves @samp{2} as +next boot entry, because @command{fallback} specifies @samp{2} as next +fallback entry. This makes sure that GRUB will boot @samp{C} after +booting @samp{B}. + +It is noteworthy that GRUB uses fallback entries both when GRUB +itself fails in booting an entry and when @samp{A} or @samp{B} fails +in starting up your system. So this solution ensures that your system +is started even if GRUB cannot find your kernel or if your kernel +panics. + +However, you need to run @command{grub-set-default} (@pxref{Invoking +grub-set-default}) when @samp{A} starts correctly or you fix @samp{A} +after it crashes, since GRUB always sets next boot entry to a fallback +entry. You should run this command in a startup script such as +@file{rc.local} to boot @samp{A} by default: + +@example +# @kbd{grub-set-default 0} +@end example + +where @samp{0} is the number of the boot entry for the system +@samp{A}. + +If you want to see what is current default entry, you can look at the +file @file{/boot/grub/default} (or @file{/grub/default} in +some systems). Because this file is plain-text, you can just +@command{cat} this file. But it is strongly recommended @strong{not to +modify this file directly}, because GRUB may fail in saving a default +entry in this file, if you change this file in an unintended +manner. Therefore, you should use @command{grub-set-default} when you +need to change the default entry. + + +@node Configuration +@chapter Configuration + +You've probably noticed that you need to type several commands to boot your +OS. There's a solution to that - GRUB provides a menu interface +(@pxref{Menu interface}) from which you can select an item (using arrow +keys) that will do everything to boot an OS. + +To enable the menu, you need a configuration file, +@file{menu.lst} under the boot directory. We'll analyze an example +file. + +The file first contains some general settings, the menu interface +related options. You can put these commands (@pxref{Menu-specific +commands}) before any of the items (starting with @command{title} +(@pxref{title})). + +@example +@group +# +# Sample boot menu configuration file +# +@end group +@end example + +As you may have guessed, these lines are comments. Lines starting with a +hash character (@samp{#}), and blank lines, are ignored by GRUB. + +@example +@group +# By default, boot the first entry. +default 0 +@end group +@end example + +The first entry (here, counting starts with number zero, not one!) will +be the default choice. + +@example +@group +# Boot automatically after 30 secs. +timeout 30 +@end group +@end example + +As the comment says, GRUB will boot automatically in 30 seconds, unless +interrupted with a keypress. + +@example +@group +# Fallback to the second entry. +fallback 1 +@end group +@end example + +If, for any reason, the default entry doesn't work, fall back to the +second one (this is rarely used, for obvious reasons). + +Note that the complete descriptions of these commands, which are menu +interface specific, can be found in @ref{Menu-specific +commands}. Other descriptions can be found in @ref{Commands}. + +Now, on to the actual OS definitions. You will see that each entry +begins with a special command, @command{title} (@pxref{title}), and the +action is described after it. Note that there is no command +@command{boot} (@pxref{boot}) at the end of each item. That is because +GRUB automatically executes @command{boot} if it loads other commands +successfully. + +The argument for the command @command{title} is used to display a short +title/description of the entry in the menu. Since @command{title} +displays the argument as is, you can write basically anything there. + +@example +@group +# For booting GNU/Hurd +title GNU/Hurd +root (hd0,0) +kernel /boot/gnumach.gz root=hd0s1 +module /boot/serverboot.gz +@end group +@end example + +This boots GNU/Hurd from the first hard disk. + +@example +@group +# For booting GNU/Linux +title GNU/Linux +kernel (hd1,0)/vmlinuz root=/dev/hdb1 +@end group +@end example + +This boots GNU/Linux, but from the second hard disk. + +@example +@group +# For booting Mach (getting kernel from floppy) +title Utah Mach4 multiboot +root (hd0,2) +pause Insert the diskette now^G!! +kernel (fd0)/boot/kernel root=hd0s3 +module (fd0)/boot/bootstrap +@end group +@end example + +This boots Mach with a kernel on a floppy, but the root filesystem at +hd0s3. It also contains a @command{pause} line (@pxref{pause}), which +will cause GRUB to display a prompt and delay, before actually executing +the rest of the commands and booting. + +@example +@group +# For booting FreeBSD +title FreeBSD +root (hd0,2,a) +kernel /boot/loader +@end group +@end example + +This item will boot FreeBSD kernel loaded from the @samp{a} partition of +the third @sc{pc} slice of the first hard disk. + +@example +@group +# For booting OS/2 +title OS/2 +root (hd0,1) +makeactive +# chainload OS/2 bootloader from the first sector +chainloader +1 +# This is similar to "chainload", but loads a specific file +#chainloader /boot/chain.os2 +@end group +@end example + +This will boot OS/2, using a chain-loader (@pxref{Chain-loading}). + +@example +@group +# For booting Windows NT or Windows95 +title Windows NT / Windows 95 boot menu +root (hd0,0) +makeactive +chainloader +1 +# For loading DOS if Windows NT is installed +# chainload /bootsect.dos +@end group +@end example + +The same as the above, but for Windows. + +@example +@group +# For installing GRUB into the hard disk +title Install GRUB into the hard disk +root (hd0,0) +setup (hd0) +@end group +@end example + +This will just (re)install GRUB onto the hard disk. + +@example +# Change the colors. +title Change the colors +color light-green/brown blink-red/blue +@end example + +In the last entry, the command @command{color} is used (@pxref{color}), +to change the menu colors (try it!). This command is somewhat special, +because it can be used both in the command-line and in the menu. GRUB +has several such commands, see @ref{General commands}. + +We hope that you now understand how to use the basic features of +GRUB. To learn more about GRUB, see the following chapters. + + +@node Network +@chapter Downloading OS images from a network + +Although GRUB is a disk-based boot loader, it does provide network +support. To use the network support, you need to enable at least one +network driver in the GRUB build process. For more information please +see @file{netboot/README.netboot} in the source distribution. + +@menu +* General usage of network support:: +* Diskless:: +@end menu + + +@node General usage of network support +@section How to set up your network + +GRUB requires a file server and optionally a server that will assign an +IP address to the machine on which GRUB is running. For the former, only +TFTP is supported at the moment. The latter is either BOOTP, DHCP or a +RARP server@footnote{RARP is not advised, since it cannot serve much +information}. It is not necessary to run both the servers on one +computer. How to configure these servers is beyond the scope of this +document, so please refer to the manuals specific to those +protocols/servers. + +If you decided to use a server to assign an IP address, set up the +server and run @command{bootp} (@pxref{bootp}), @command{dhcp} +(@pxref{dhcp}) or @command{rarp} (@pxref{rarp}) for BOOTP, DHCP or RARP, +respectively. Each command will show an assigned IP address, a netmask, +an IP address for your TFTP server and a gateway. If any of the +addresses is wrong or it causes an error, probably the configuration of +your servers isn't set up properly. + +Otherwise, run @command{ifconfig}, like this: + +@example +grub> @kbd{ifconfig --address=192.168.110.23 --server=192.168.110.14} +@end example + +You can also use @command{ifconfig} in conjuction with @command{bootp}, +@command{dhcp} or @command{rarp} (e.g. to reassign the server address +manually). @xref{ifconfig}, for more details. + +Finally, download your OS images from your network. The network can be +accessed using the network drive @samp{(nd)}. Everything else is very +similar to the normal instructions (@pxref{Booting}). + +Here is an example: + +@example +@group +grub> @kbd{bootp} +Probing... [NE*000] +NE2000 base ... +Address: 192.168.110.23 Netmask: 255.255.255.0 +Server: 192.168.110.14 Gateway: 192.168.110.1 + +grub> @kbd{root (nd)} +grub> @kbd{kernel /tftproot/gnumach.gz root=sd0s1} +grub> @kbd{module /tftproot/serverboot.gz} +grub> @kbd{boot} +@end group +@end example + + +@node Diskless +@section Booting from a network + +It is sometimes very useful to boot from a network, especially when you +use a machine which has no local disk. In this case, you need to obtain +a kind of Net Boot @sc{rom}, such as a PXE @sc{rom} or a free software +package like Etherboot. Such a Boot @sc{rom} first boots the machine, +sets up the network card installed into the machine, and downloads a +second stage boot image from the network. Then, the second image will +try to boot an operating system actually from the network. + +GRUB provides two second stage images, @file{nbgrub} and +@file{pxegrub} (@pxref{Images}). These images are the same as the +normal Stage 2, except that they set up a network automatically, and try +to load a configuration file from the network, if specified. The usage +is very simple: If the machine has a PXE @sc{rom}, use +@file{pxegrub}. If the machine has an NBI loader such as Etherboot, use +@file{nbgrub}. There is no difference between them except their +formats. Since the way to load a second stage image you want to use +should be described in the manual on your Net Boot @sc{rom}, please +refer to the manual, for more information. + +However, there is one thing specific to GRUB. Namely, how to specify a +configuration file in a BOOTP/DHCP server. For now, GRUB uses the tag +@samp{150}, to get the name of a configuration file. The following is an +example with a BOOTP configuration: + +@example +@group +.allhost:hd=/tmp:bf=null:\ + :ds=145.71.35.1 145.71.32.1:\ + :sm=255.255.254.0:\ + :gw=145.71.35.1:\ + :sa=145.71.35.5: + +foo:ht=1:ha=63655d0334a7:ip=145.71.35.127:\ + :bf=/nbgrub:\ + :tc=.allhost:\ + :T150="(nd)/tftpboot/menu.lst.foo": +@end group +@end example + +Note that you should specify the drive name @code{(nd)} in the name of +the configuration file. This is because you might change the root drive +before downloading the configuration from the TFTP server when the +preset menu feature is used (@pxref{Preset Menu}). + +GRUB sends the string "GRUBClient" as its vendor class identifier to +the BOOTP/DHCP server. This can be used to generate answers specific +to GRUB clients on your network. + +See the manual of your BOOTP/DHCP server for more information. The +exact syntax should differ a little from the example. + +@node Serial terminal +@chapter Using GRUB via a serial line + +This chapter describes how to use the serial terminal support in GRUB. + +If you have many computers or computers with no display/keyboard, it +could be very useful to control the computers through serial +communications. To connect one computer with another via a serial line, +you need to prepare a null-modem (cross) serial cable, and you may need +to have multiport serial boards, if your computer doesn't have extra +serial ports. In addition, a terminal emulator is also required, such as +minicom. Refer to a manual of your operating system, for more +information. + +As for GRUB, the instruction to set up a serial terminal is quite +simple. First of all, make sure that you haven't specified the option +@option{--disable-serial} to the configure script when you built your +GRUB images. If you get them in binary form, probably they have serial +terminal support already. + +Then, initialize your serial terminal after GRUB starts up. Here is an +example: + +@example +@group +grub> @kbd{serial --unit=0 --speed=9600} +grub> @kbd{terminal serial} +@end group +@end example + +The command @command{serial} initializes the serial unit 0 with the +speed 9600bps. The serial unit 0 is usually called @samp{COM1}, so, if +you want to use COM2, you must specify @samp{--unit=1} instead. This +command accepts many other options, so please refer to @ref{serial}, +for more details. + +The command @command{terminal} (@pxref{terminal}) chooses which type of +terminal you want to use. In the case above, the terminal will be a +serial terminal, but you can also pass @code{console} to the command, +as @samp{terminal serial console}. In this case, a terminal in which +you press any key will be selected as a GRUB terminal. + +However, note that GRUB assumes that your terminal emulator is +compatible with VT100 by default. This is true for most terminal +emulators nowadays, but you should pass the option @option{--dumb} to +the command if your terminal emulator is not VT100-compatible or +implements few VT100 escape sequences. If you specify this option then +GRUB provides you with an alternative menu interface, because the normal +menu requires several fancy features of your terminal. + + +@node Preset Menu +@chapter Embedding a configuration file into GRUB + +GRUB supports a @dfn{preset menu} which is to be always loaded before +starting. The preset menu feature is useful, for example, when your +computer has no console but a serial cable. In this case, it is +critical to set up the serial terminal as soon as possible, since you +cannot see any message until the serial terminal begins to work. So it +is good to run the commands @command{serial} (@pxref{serial}) and +@command{terminal} (@pxref{terminal}) before anything else at the +start-up time. + +How the preset menu works is slightly complicated: + +@enumerate +@item +GRUB checks if the preset menu feature is used, and loads the preset +menu, if available. This includes running commands and reading boot +entries, like an ordinary configuration file. + +@item +GRUB checks if the configuration file is available. Note that this check +is performed @strong{regardless of the existence of the preset +menu}. The configuration file is loaded even if the preset menu was +loaded. + +@item +If the preset menu includes any boot entries, they are cleared when +the configuration file is loaded. It doesn't matter whether the +configuration file has any entries or no entry. The boot entries in the +preset menu are used only when GRUB fails in loading the configuration +file. +@end enumerate + +To enable the preset menu feature, you must rebuild GRUB specifying a +file to the configure script with the option +@option{--enable-preset-menu}. The file has the same semantics as +normal configuration files (@pxref{Configuration}). + +Another point you should take care is that the diskless support +(@pxref{Diskless}) diverts the preset menu. Diskless images embed a +preset menu to execute the command @command{bootp} (@pxref{bootp}) +automatically, unless you specify your own preset menu to the configure +script. This means that you must put commands to initialize a network in +the preset menu yourself, because diskless images don't set it up +implicitly, when you use the preset menu explicitly. + +Therefore, a typical preset menu used with diskless support would be +like this: + +@example +@group +# Set up the serial terminal, first of all. +serial --unit=0 --speed=19200 +terminal --timeout=0 serial + +# Initialize the network. +dhcp +@end group +@end example + + +@node Security +@chapter Protecting your computer from cracking + +You may be interested in how to prevent ordinary users from doing +whatever they like, if you share your computer with other people. So +this chapter describes how to improve the security of GRUB. + +One thing which could be a security hole is that the user can do too +many things with GRUB, because GRUB allows one to modify its configuration +and run arbitrary commands at run-time. For example, the user can even +read @file{/etc/passwd} in the command-line interface by the command +@command{cat} (@pxref{cat}). So it is necessary to disable all the +interactive operations. + +Thus, GRUB provides a @dfn{password} feature, so that only administrators +can start the interactive operations (i.e. editing menu entries and +entering the command-line interface). To use this feature, you need to +run the command @command{password} in your configuration file +(@pxref{password}), like this: + +@example +password --md5 PASSWORD +@end example + +If this is specified, GRUB disallows any interactive control, until you +press the key @key{p} and enter a correct password. The option +@option{--md5} tells GRUB that @samp{PASSWORD} is in MD5 format. If it +is omitted, GRUB assumes the @samp{PASSWORD} is in clear text. + +You can encrypt your password with the command @command{md5crypt} +(@pxref{md5crypt}). For example, run the grub shell (@pxref{Invoking the +grub shell}), and enter your password: + +@example +@group +grub> md5crypt +Password: ********** +Encrypted: $1$U$JK7xFegdxWH6VuppCUSIb. +@end group +@end example + +Then, cut and paste the encrypted password to your configuration file. + +Also, you can specify an optional argument to @command{password}. See +this example: + +@example +password PASSWORD /boot/grub/menu-admin.lst +@end example + +In this case, GRUB will load @file{/boot/grub/menu-admin.lst} as a +configuration file when you enter the valid password. + +Another thing which may be dangerous is that any user can choose any +menu entry. Usually, this wouldn't be problematic, but you might want to +permit only administrators to run some of your menu entries, such as an +entry for booting an insecure OS like DOS. + +GRUB provides the command @command{lock} (@pxref{lock}). This command +always fails until you enter the valid password, so you can use it, like +this: + +@example +@group +title Boot DOS +lock +rootnoverify (hd0,1) +makeactive +chainload +1 +@end group +@end example + +You should insert @command{lock} right after @command{title}, because +any user can execute commands in an entry until GRUB encounters +@command{lock}. + +You can also use the command @command{password} instead of +@command{lock}. In this case the boot process will ask for the password +and stop if it was entered incorrectly. Since the @command{password} +takes its own @var{PASSWORD} argument this is useful if you want +different passwords for different entries. + + +@node Images +@chapter GRUB image files + +GRUB consists of several images: two essential stages, optional stages +called @dfn{Stage 1.5}, one image for bootable CD-ROM, and two network +boot images. Here is a short overview of them. @xref{Internals}, for +more details. + +@table @file +@item stage1 +This is an essential image used for booting up GRUB. Usually, this is +embedded in an MBR or the boot sector of a partition. Because a PC boot +sector is 512 bytes, the size of this image is exactly 512 bytes. + +All @file{stage1} must do is to load Stage 2 or Stage 1.5 from a local +disk. Because of the size restriction, @file{stage1} encodes the +location of Stage 2 (or Stage 1.5) in a block list format, so it never +understand any filesystem structure. + +@item stage2 +This is the core image of GRUB. It does everything but booting up +itself. Usually, this is put in a filesystem, but that is not required. + +@item e2fs_stage1_5 +@itemx fat_stage1_5 +@itemx ffs_stage1_5 +@itemx jfs_stage1_5 +@itemx minix_stage1_5 +@itemx reiserfs_stage1_5 +@itemx vstafs_stage1_5 +@itemx xfs_stage1_5 + +These are called @dfn{Stage 1.5}, because they serve as a bridge +between @file{stage1} and @file{stage2}, that is to say, Stage 1.5 is +loaded by Stage 1 and Stage 1.5 loads Stage 2. The difference between +@file{stage1} and @file{*_stage1_5} is that the former doesn't +understand any filesystem while the latter understands one filesystem +(e.g. @file{e2fs_stage1_5} understands ext2fs). So you can move the +Stage 2 image to another location safely, even after GRUB has been +installed. + +While Stage 2 cannot generally be embedded in a fixed area as the size +is so large, Stage 1.5 can be installed into the area right after an MBR, +or the boot loader area of a ReiserFS or a FFS. + +@item stage2_eltorito +This is a boot image for CD-ROMs using the @dfn{no emulation mode} in +El Torito specification. This is identical to Stage 2, except that +this boots up without Stage 1 and sets up a special drive @samp{(cd)}. + +@item nbgrub +This is a network boot image for the Network Image Proposal used by some +network boot loaders, such as Etherboot. This is mostly the same as +Stage 2, but it also sets up a network and loads a configuration file +from the network. + +@item pxegrub +This is another network boot image for the Preboot Execution Environment +used by several Netboot ROMs. This is identical to @file{nbgrub}, except +for the format. +@end table + + +@node Filesystem +@chapter Filesystem syntax and semantics + +GRUB uses a special syntax for specifying disk drives which can be +accessed by BIOS. Because of BIOS limitations, GRUB cannot distinguish +between IDE, ESDI, SCSI, or others. You must know yourself which BIOS +device is equivalent to which OS device. Normally, that will be clear if +you see the files in a device or use the command @command{find} +(@pxref{find}). + +@menu +* Device syntax:: How to specify devices +* File name syntax:: How to specify files +* Block list syntax:: How to specify block lists +@end menu + + +@node Device syntax +@section How to specify devices + +The device syntax is like this: + +@example +@code{(@var{device}[,@var{part-num}][,@var{bsd-subpart-letter}])} +@end example + +@samp{[]} means the parameter is optional. @var{device} should be +either @samp{fd} or @samp{hd} followed by a digit, like @samp{fd0}. +But you can also set @var{device} to a hexadecimal or a decimal number +which is a BIOS drive number, so the following are equivalent: + +@example +(hd0) +(0x80) +(128) +@end example + +@var{part-num} represents the partition number of @var{device}, starting +from zero for primary partitions and from four for extended partitions, +and @var{bsd-subpart-letter} represents the BSD disklabel subpartition, +such as @samp{a} or @samp{e}. + +A shortcut for specifying BSD subpartitions is +@code{(@var{device},@var{bsd-subpart-letter})}, in this case, GRUB +searches for the first PC partition containing a BSD disklabel, then +finds the subpartition @var{bsd-subpart-letter}. Here is an example: + +@example +(hd0,a) +@end example + +The syntax @samp{(hd0)} represents using the entire disk (or the +MBR when installing GRUB), while the syntax @samp{(hd0,0)} +represents using the first partition of the disk (or the boot sector +of the partition when installing GRUB). + +If you enabled the network support, the special drive, @samp{(nd)}, is +also available. Before using the network drive, you must initialize the +network. @xref{Network}, for more information. + +If you boot GRUB from a CD-ROM, @samp{(cd)} is available. @xref{Making +a GRUB bootable CD-ROM}, for details. + + +@node File name syntax +@section How to specify files + +There are two ways to specify files, by @dfn{absolute file name} and by +@dfn{block list}. + +An absolute file name resembles a Unix absolute file name, using +@samp{/} for the directory separator (not @samp{\} as in DOS). One +example is @samp{(hd0,0)/boot/grub/menu.lst}. This means the file +@file{/boot/grub/menu.lst} in the first partition of the first hard +disk. If you omit the device name in an absolute file name, GRUB uses +GRUB's @dfn{root device} implicitly. So if you set the root device to, +say, @samp{(hd1,0)} by the command @command{root} (@pxref{root}), then +@code{/boot/kernel} is the same as @code{(hd1,0)/boot/kernel}. + + +@node Block list syntax +@section How to specify block lists + +A block list is used for specifying a file that doesn't appear in the +filesystem, like a chainloader. The syntax is +@code{[@var{offset}]+@var{length}[,[@var{offset}]+@var{length}]@dots{}}. +Here is an example: + +@example +@code{0+100,200+1,300+300} +@end example + +This represents that GRUB should read blocks 0 through 99, block 200, +and blocks 300 through 599. If you omit an offset, then GRUB assumes +the offset is zero. + +Like the file name syntax (@pxref{File name syntax}), if a blocklist +does not contain a device name, then GRUB uses GRUB's @dfn{root +device}. So @code{(hd0,1)+1} is the same as @code{+1} when the root +device is @samp{(hd0,1)}. + + +@node Interface +@chapter GRUB's user interface + +GRUB has both a simple menu interface for choosing preset entries from a +configuration file, and a highly flexible command-line for performing +any desired combination of boot commands. + +GRUB looks for its configuration file as soon as it is loaded. If one +is found, then the full menu interface is activated using whatever +entries were found in the file. If you choose the @dfn{command-line} menu +option, or if the configuration file was not found, then GRUB drops to +the command-line interface. + +@menu +* Command-line interface:: The flexible command-line interface +* Menu interface:: The simple menu interface +* Menu entry editor:: Editing a menu entry +* Hidden menu interface:: The hidden menu interface +@end menu + + +@node Command-line interface +@section The flexible command-line interface + +The command-line interface provides a prompt and after it an editable +text area much like a command-line in Unix or DOS. Each command is +immediately executed after it is entered@footnote{However, this +behavior will be changed in the future version, in a user-invisible +way.}. The commands (@pxref{Command-line and menu entry commands}) are a +subset of those available in the configuration file, used with exactly +the same syntax. + +Cursor movement and editing of the text on the line can be done via a +subset of the functions available in the Bash shell: + +@table @key +@item C-f +@itemx PC right key +Move forward one character. + +@item C-b +@itemx PC left key +Move back one character. + +@item C-a +@itemx HOME +Move to the start of the line. + +@item C-e +@itemx END +Move the the end of the line. + +@item C-d +@itemx DEL +Delete the character underneath the cursor. + +@item C-h +@itemx BS +Delete the character to the left of the cursor. + +@item C-k +Kill the text from the current cursor position to the end of the line. + +@item C-u +Kill backward from the cursor to the beginning of the line. + +@item C-y +Yank the killed text back into the buffer at the cursor. + +@item C-p +@itemx PC up key +Move up through the history list. + +@item C-n +@itemx PC down key +Move down through the history list. +@end table + +When typing commands interactively, if the cursor is within or before +the first word in the command-line, pressing the @key{TAB} key (or +@key{C-i}) will display a listing of the available commands, and if the +cursor is after the first word, the @kbd{@key{TAB}} will provide a +completion listing of disks, partitions, and file names depending on the +context. Note that to obtain a list of drives, one must open a +parenthesis, as @command{root (}. + +Note that you cannot use the completion functionality in the TFTP +filesystem. This is because TFTP doesn't support file name listing for +the security. + + +@node Menu interface +@section The simple menu interface + +The menu interface is quite easy to use. Its commands are both +reasonably intuitive and described on screen. + +Basically, the menu interface provides a list of @dfn{boot entries} to +the user to choose from. Use the arrow keys to select the entry of +choice, then press @key{RET} to run it. An optional timeout is +available to boot the default entry (the first one if not set), which is +aborted by pressing any key. + +Commands are available to enter a bare command-line by pressing @key{c} +(which operates exactly like the non-config-file version of GRUB, but +allows one to return to the menu if desired by pressing @key{ESC}) or to +edit any of the @dfn{boot entries} by pressing @key{e}. + +If you protect the menu interface with a password (@pxref{Security}), +all you can do is choose an entry by pressing @key{RET}, or press +@key{p} to enter the password. + + +@node Menu entry editor +@section Editing a menu entry + +The menu entry editor looks much like the main menu interface, but the +lines in the menu are individual commands in the selected entry instead +of entry names. + +If an @key{ESC} is pressed in the editor, it aborts all the changes made +to the configuration entry and returns to the main menu interface. + +When a particular line is selected, the editor places the user in a +special version of the GRUB command-line to edit that line. When the +user hits @key{RET}, GRUB replaces the line in question in the boot +entry with the changes (unless it was aborted via @key{ESC}, +in which case the changes are thrown away). + +If you want to add a new line to the menu entry, press @key{o} if adding +a line after the current line or press @key{O} if before the current +line. + +To delete a line, hit the key @key{d}. Although GRUB unfortunately +does not support @dfn{undo}, you can do almost the same thing by just +returning to the main menu. + + +@node Hidden menu interface +@section The hidden menu interface + +When your terminal is dumb or you request GRUB to hide the menu +interface explicitly with the command @command{hiddenmenu} +(@pxref{hiddenmenu}), GRUB doesn't show the menu interface (@pxref{Menu +interface}) and automatically boots the default entry, unless +interrupted by pressing @key{ESC}. + +When you interrupt the timeout and your terminal is dumb, GRUB falls +back to the command-line interface (@pxref{Command-line interface}). + + +@node Commands +@chapter The list of available commands + +In this chapter, we list all commands that are available in GRUB. + +Commands belong to different groups. A few can only be used in +the global section of the configuration file (or ``menu''); most +of them can be entered on the command-line and can be used either +anywhere in the menu or specifically in the menu entries. + +@menu +* Menu-specific commands:: +* General commands:: +* Command-line and menu entry commands:: +@end menu + + +@node Menu-specific commands +@section The list of commands for the menu only + +The semantics used in parsing the configuration file are the following: + +@itemize @bullet +@item +The menu-specific commands have to be used before any others. + +@item +The files @emph{must} be in plain-text format. + +@item +@samp{#} at the beginning of a line in a configuration file means it is +only a comment. + +@item +Options are separated by spaces. + +@item +All numbers can be either decimal or hexadecimal. A hexadecimal number +must be preceded by @samp{0x}, and is case-insensitive. + +@item +Extra options or text at the end of the line are ignored unless otherwise +specified. + +@item +Unrecognized commands are added to the current entry, except before entries +start, where they are ignored. +@end itemize + +These commands can only be used in the menu: + +@menu +* default:: Set the default entry +* fallback:: Set the fallback entry +* hiddenmenu:: Hide the menu interface +* timeout:: Set the timeout +* title:: Start a menu entry +@end menu + + +@node default +@subsection default + +@deffn Command default num +Set the default entry to the entry number @var{num}. Numbering starts +from 0, and the entry number 0 is the default if the command is not +used. + +You can specify @samp{saved} instead of a number. In this case, the +default entry is the entry saved with the command +@command{savedefault}. @xref{savedefault}, for more information. +@end deffn + + +@node fallback +@subsection fallback + +@deffn Command fallback num... +Go into unattended boot mode: if the default boot entry has any errors, +instead of waiting for the user to do something, immediately start +over using the @var{num} entry (same numbering as the @code{default} +command (@pxref{default})). This obviously won't help if the machine was +rebooted by a kernel that GRUB loaded. You can specify multiple +fallback entry numbers. +@end deffn + + +@node hiddenmenu +@subsection hiddenmenu + +@deffn Command hiddenmenu +Don't display the menu. If the command is used, no menu will be +displayed on the control terminal, and the default entry will be +booted after the timeout expired. The user can still request the +menu to be displayed by pressing @key{ESC} before the timeout +expires. See also @ref{Hidden menu interface}. +@end deffn + + +@node timeout +@subsection timeout + +@deffn Command timeout sec +Set a timeout, in @var{sec} seconds, before automatically booting the +default entry (normally the first entry defined). +@end deffn + + +@node title +@subsection title + +@deffn Command title name @dots{} +Start a new boot entry, and set its name to the contents of the rest of +the line, starting with the first non-space character. +@end deffn + + +@node General commands +@section The list of general commands + +Commands usable anywhere in the menu and in the command-line. + +@menu +* bootp:: Initialize a network device via BOOTP +* color:: Color the menu interface +* device:: Specify a file as a drive +* dhcp:: Initialize a network device via DHCP +* hide:: Hide a partition +* ifconfig:: Configure a network device manually +* pager:: Change the state of the internal pager +* partnew:: Make a primary partition +* parttype:: Change the type of a partition +* password:: Set a password for the menu interface +* rarp:: Initialize a network device via RARP +* serial:: Set up a serial device +* setkey:: Configure the key map +* terminal:: Choose a terminal +* terminfo:: Define escape sequences for a terminal +* tftpserver:: Specify a TFTP server +* unhide:: Unhide a partition +@end menu + + +@node bootp +@subsection bootp + +@deffn Command bootp [@option{--with-configfile}] +Initialize a network device via the @dfn{BOOTP} protocol. This command +is only available if GRUB is compiled with netboot support. See also +@ref{Network}. + +If you specify @option{--with-configfile} to this command, GRUB will +fetch and load a configuration file specified by your BOOTP server +with the vendor tag @samp{150}. +@end deffn + + +@node color +@subsection color + +@deffn Command color normal [highlight] +Change the menu colors. The color @var{normal} is used for most +lines in the menu (@pxref{Menu interface}), and the color +@var{highlight} is used to highlight the line where the cursor +points. If you omit @var{highlight}, then the inverted color of +@var{normal} is used for the highlighted line. The format of a color is +@code{@var{foreground}/@var{background}}. @var{foreground} and +@var{background} are symbolic color names. A symbolic color name must be +one of these: + +@itemize @bullet +@item +black + +@item +blue + +@item +green + +@item +cyan + +@item +red + +@item +magenta + +@item +brown + +@item +light-gray + +@strong{These below can be specified only for the foreground.} + +@item +dark-gray + +@item +light-blue + +@item +light-green + +@item +light-cyan + +@item +light-red + +@item +light-magenta + +@item +yellow + +@item +white +@end itemize + +But only the first eight names can be used for @var{background}. You can +prefix @code{blink-} to @var{foreground} if you want a blinking +foreground color. + +This command can be used in the configuration file and on the command +line, so you may write something like this in your configuration file: + +@example +@group +# Set default colors. +color light-gray/blue black/light-gray + +# Change the colors. +title OS-BS like +color magenta/blue black/magenta +@end group +@end example +@end deffn + + +@node device +@subsection device + +@deffn Command device drive file +In the grub shell, specify the file @var{file} as the actual drive for a +@sc{bios} drive @var{drive}. You can use this command to create a disk +image, and/or to fix the drives guessed by GRUB when GRUB fails to +determine them correctly, like this: + +@example +@group +grub> @kbd{device (fd0) /floppy-image} +grub> @kbd{device (hd0) /dev/sd0} +@end group +@end example + +This command can be used only in the grub shell (@pxref{Invoking the +grub shell}). +@end deffn + + +@node dhcp +@subsection dhcp + +@deffn Command dhcp [--with-configfile] +Initialize a network device via the @dfn{DHCP} protocol. Currently, +this command is just an alias for @command{bootp}, since the two +protocols are very similar. This command is only available if GRUB is +compiled with netboot support. See also @ref{Network}. + +If you specify @option{--with-configfile} to this command, GRUB will +fetch and load a configuration file specified by your DHCP server +with the vendor tag @samp{150}. +@end deffn + + +@node hide +@subsection hide + +@deffn Command hide partition +Hide the partition @var{partition} by setting the @dfn{hidden} bit in +its partition type code. This is useful only when booting DOS or Windows +and multiple primary FAT partitions exist in one disk. See also +@ref{DOS/Windows}. +@end deffn + + +@node ifconfig +@subsection ifconfig + +@deffn Command ifconfig [@option{--server=server}] [@option{--gateway=gateway}] [@option{--mask=mask}] [@option{--address=address}] +Configure the IP address, the netmask, the gateway, and the server +address of a network device manually. The values must be in dotted +decimal format, like @samp{192.168.11.178}. The order of the options is +not important. This command shows current network configuration, if no +option is specified. See also @ref{Network}. +@end deffn + + +@node pager +@subsection pager + +@deffn Command pager [flag] +Toggle or set the state of the internal pager. If @var{flag} is +@samp{on}, the internal pager is enabled. If @var{flag} is @samp{off}, +it is disabled. If no argument is given, the state is toggled. +@end deffn + + +@node partnew +@subsection partnew + +@deffn Command partnew part type from len +Create a new primary partition. @var{part} is a partition specification +in GRUB syntax (@pxref{Naming convention}); @var{type} is the partition +type and must be a number in the range @code{0-0xff}; @var{from} is +the starting address and @var{len} is the length, both in sector units. +@end deffn + + +@node parttype +@subsection parttype + +@deffn Command parttype part type +Change the type of an existing partition. @var{part} is a partition +specification in GRUB syntax (@pxref{Naming convention}); @var{type} +is the new partition type and must be a number in the range 0-0xff. +@end deffn + + +@node password +@subsection password + +@deffn Command password [@option{--md5}] passwd [new-config-file] +If used in the first section of a menu file, disable all interactive +editing control (menu entry editor and command-line) and entries +protected by the command @command{lock}. If the password @var{passwd} is +entered, it loads the @var{new-config-file} as a new config file and +restarts the GRUB Stage 2, if @var{new-config-file} is +specified. Otherwise, GRUB will just unlock the privileged instructions. +You can also use this command in the script section, in which case it +will ask for the password, before continuing. The option +@option{--md5} tells GRUB that @var{passwd} is encrypted with +@command{md5crypt} (@pxref{md5crypt}). +@end deffn + + +@node rarp +@subsection rarp + +@deffn Command rarp +Initialize a network device via the @dfn{RARP} protocol. This command +is only available if GRUB is compiled with netboot support. See also +@ref{Network}. +@end deffn + + +@node serial +@subsection serial + +@deffn Command serial [@option{--unit=unit}] [@option{--port=port}] [@option{--speed=speed}] [@option{--word=word}] [@option{--parity=parity}] [@option{--stop=stop}] [@option{--device=dev}] +Initialize a serial device. @var{unit} is a number in the range 0-3 +specifying which serial port to use; default is 0, which corresponds to +the port often called COM1. @var{port} is the I/O port where the UART +is to be found; if specified it takes precedence over @var{unit}. +@var{speed} is the transmission speed; default is 9600. @var{word} and +@var{stop} are the number of data bits and stop bits. Data bits must +be in the range 5-8 and stop bits must be 1 or 2. Default is 8 data +bits and one stop bit. @var{parity} is one of @samp{no}, @samp{odd}, +@samp{even} and defaults to @samp{no}. The option @option{--device} +can only be used in the grub shell and is used to specify the +tty device to be used in the host operating system (@pxref{Invoking the +grub shell}). + +The serial port is not used as a communication channel unless the +@command{terminal} command is used (@pxref{terminal}). + +This command is only available if GRUB is compiled with serial +support. See also @ref{Serial terminal}. +@end deffn + + +@node setkey +@subsection setkey + +@deffn Command setkey [to_key from_key] +Change the keyboard map. The key @var{from_key} is mapped to the key +@var{to_key}. If no argument is specified, reset key mappings. Note that +this command @emph{does not} exchange the keys. If you want to exchange +the keys, run this command again with the arguments exchanged, like this: + +@example +grub> @kbd{setkey capslock control} +grub> @kbd{setkey control capslock} +@end example + +A key must be an alphabet letter, a digit, or one of these symbols: +@samp{escape}, @samp{exclam}, @samp{at}, @samp{numbersign}, +@samp{dollar}, @samp{percent}, @samp{caret}, @samp{ampersand}, +@samp{asterisk}, @samp{parenleft}, @samp{parenright}, @samp{minus}, +@samp{underscore}, @samp{equal}, @samp{plus}, @samp{backspace}, +@samp{tab}, @samp{bracketleft}, @samp{braceleft}, @samp{bracketright}, +@samp{braceright}, @samp{enter}, @samp{control}, @samp{semicolon}, +@samp{colon}, @samp{quote}, @samp{doublequote}, @samp{backquote}, +@samp{tilde}, @samp{shift}, @samp{backslash}, @samp{bar}, @samp{comma}, +@samp{less}, @samp{period}, @samp{greater}, @samp{slash}, +@samp{question}, @samp{alt}, @samp{space}, @samp{capslock}, @samp{FX} +(@samp{X} is a digit), and @samp{delete}. This table describes to which +character each of the symbols corresponds: + +@table @samp +@item exclam +@samp{!} + +@item at +@samp{@@} + +@item numbersign +@samp{#} + +@item dollar +@samp{$} + +@item percent +@samp{%} + +@item caret +@samp{^} + +@item ampersand +@samp{&} + +@item asterisk +@samp{*} + +@item parenleft +@samp{(} + +@item parenright +@samp{)} + +@item minus +@samp{-} + +@item underscore +@samp{_} + +@item equal +@samp{=} + +@item plus +@samp{+} + +@item bracketleft +@samp{[} + +@item braceleft +@samp{@{} + +@item bracketright +@samp{]} + +@item braceright +@samp{@}} + +@item semicolon +@samp{;} + +@item colon +@samp{:} + +@item quote +@samp{'} + +@item doublequote +@samp{"} + +@item backquote +@samp{`} + +@item tilde +@samp{~} + +@item backslash +@samp{\} + +@item bar +@samp{|} + +@item comma +@samp{,} + +@item less +@samp{<} + +@item period +@samp{.} + +@item greater +@samp{>} + +@item slash +@samp{/} + +@item question +@samp{?} + +@item space +@samp{ } +@end table +@end deffn + + +@node terminal +@subsection terminal + +@deffn Command terminal [@option{--dumb}] [@option{--no-echo}] [@option{--no-edit}] [@option{--timeout=secs}] [@option{--lines=lines}] [@option{--silent}] [@option{console}] [@option{serial}] [@option{hercules}] +Select a terminal for user interaction. The terminal is assumed to be +VT100-compatible unless @option{--dumb} is specified. If both +@option{console} and @option{serial} are specified, then GRUB will use +the one where a key is entered first or the first when the timeout +expires. If neither are specified, the current setting is +reported. This command is only available if GRUB is compiled with serial +support. See also @ref{Serial terminal}. + +This may not make sense for most users, but GRUB supports Hercules +console as well. Hercules console is usable like the ordinary console, +and the usage is quite similar to that for serial terminals: specify +@option{hercules} as the argument. + +The option @option{--lines} defines the number of lines in your +terminal, and it is used for the internal pager function. If you don't +specify this option, the number is assumed as 24. + +The option @option{--silent} suppresses the message to prompt you to +hit any key. This might be useful if your system has no terminal +device. + +The option @option{--no-echo} has GRUB not to echo back input +characters. This implies the option @option{--no-edit}. + +The option @option{--no-edit} disables the BASH-like editing feature. +@end deffn + + +@node terminfo +@subsection terminfo + +@deffn Command terminfo @option{--name=name} @option{--cursor-address=seq} [@option{--clear-screen=seq}] [@option{--enter-standout-mode=seq}] [@option{--exit-standout-mode=seq}] +Define the capabilities of your terminal. Use this command to define +escape sequences, if it is not vt100-compatible. You may use @samp{\e} +for @key{ESC} and @samp{^X} for a control character. + +You can use the utility @command{grub-terminfo} to generate +appropriate arguments to this command. @xref{Invoking grub-terminfo}. + +If no option is specified, the current settings are printed. +@end deffn + + +@node tftpserver +@subsection tftpserver + +@deffn Command tftpserver ipaddr +@strong{Caution:} This command exists only for backward +compatibility. Use @command{ifconfig} (@pxref{ifconfig}) instead. + +Override a TFTP server address returned by a BOOTP/DHCP/RARP server. The +argument @var{ipaddr} must be in dotted decimal format, like +@samp{192.168.0.15}. This command is only available if GRUB is compiled +with netboot support. See also @ref{Network}. +@end deffn + + +@node unhide +@subsection unhide + +@deffn Command unhide partition +Unhide the partition @var{partition} by clearing the @dfn{hidden} bit in +its partition type code. This is useful only when booting DOS or Windows +and multiple primary partitions exist on one disk. See also +@ref{DOS/Windows}. +@end deffn + + +@node Command-line and menu entry commands +@section The list of command-line and menu entry commands + +These commands are usable in the command-line and in menu entries. If +you forget a command, you can run the command @command{help} +(@pxref{help}). + +@menu +* blocklist:: Get the block list notation of a file +* boot:: Start up your operating system +* cat:: Show the contents of a file +* chainloader:: Chain-load another boot loader +* cmp:: Compare two files +* configfile:: Load a configuration file +* debug:: Toggle the debug flag +* displayapm:: Display APM information +* displaymem:: Display memory configuration +* embed:: Embed Stage 1.5 +* find:: Find a file +* fstest:: Test a filesystem +* geometry:: Manipulate the geometry of a drive +* halt:: Shut down your computer +* help:: Show help messages +* impsprobe:: Probe SMP +* initrd:: Load an initrd +* install:: Install GRUB +* ioprobe:: Probe I/O ports used for a drive +* kernel:: Load a kernel +* lock:: Lock a menu entry +* makeactive:: Make a partition active +* map:: Map a drive to another +* md5crypt:: Encrypt a password in MD5 format +* module:: Load a module +* modulenounzip:: Load a module without decompression +* pause:: Wait for a key press +* quit:: Exit from the grub shell +* reboot:: Reboot your computer +* read:: Read data from memory +* root:: Set GRUB's root device +* rootnoverify:: Set GRUB's root device without mounting +* savedefault:: Save current entry as the default entry +* setup:: Set up GRUB's installation automatically +* testload:: Load a file for testing a filesystem +* testvbe:: Test VESA BIOS EXTENSION +* uppermem:: Set the upper memory size +* vbeprobe:: Probe VESA BIOS EXTENSION +@end menu + + +@node blocklist +@subsection blocklist + +@deffn Command blocklist file +Print the block list notation of the file @var{file}. @xref{Block list +syntax}. +@end deffn + + +@node boot +@subsection boot + +@deffn Command boot +Boot the OS or chain-loader which has been loaded. Only necessary if +running the fully interactive command-line (it is implicit at the end of +a menu entry). +@end deffn + + +@node cat +@subsection cat + +@deffn Command cat file +Display the contents of the file @var{file}. This command may be useful +to remind you of your OS's root partition: + +@example +grub> @kbd{cat /etc/fstab} +@end example +@end deffn + + +@node chainloader +@subsection chainloader + +@deffn Command chainloader [@option{--force}] file +Load @var{file} as a chain-loader. Like any other file loaded by the +filesystem code, it can use the blocklist notation to grab the first +sector of the current partition with @samp{+1}. If you specify the +option @option{--force}, then load @var{file} forcibly, whether it has a +correct signature or not. This is required when you want to load a +defective boot loader, such as SCO UnixWare 7.1 (@pxref{SCO UnixWare}). +@end deffn + + +@node cmp +@subsection cmp + +@deffn Command cmp file1 file2 +Compare the file @var{file1} with the file @var{file2}. If they differ +in size, print the sizes like this: + +@example +Differ in size: 0x1234 [foo], 0x4321 [bar] +@end example + +If the sizes are equal but the bytes at an offset differ, then print the +bytes like this: + +@example +Differ at the offset 777: 0xbe [foo], 0xef [bar] +@end example + +If they are completely identical, nothing will be printed. +@end deffn + + +@node configfile +@subsection configfile + +@deffn Command configfile file +Load @var{file} as a configuration file. +@end deffn + + +@node debug +@subsection debug + +@deffn Command debug +Toggle debug mode (by default it is off). When debug mode is on, some +extra messages are printed to show disk activity. This global debug flag +is mainly useful for GRUB developers when testing new code. +@end deffn + + +@node displayapm +@subsection displayapm + +@deffn Command displayapm +Display APM BIOS information. +@end deffn + + +@node displaymem +@subsection displaymem + +@deffn Command displaymem +Display what GRUB thinks the system address space map of the machine is, +including all regions of physical @sc{ram} installed. GRUB's +@dfn{upper/lower memory} display uses the standard BIOS interface for +the available memory in the first megabyte, or @dfn{lower memory}, and a +synthesized number from various BIOS interfaces of the memory starting +at 1MB and going up to the first chipset hole for @dfn{upper memory} +(the standard PC @dfn{upper memory} interface is limited to reporting a +maximum of 64MB). +@end deffn + + +@node embed +@subsection embed + +@deffn Command embed stage1_5 device +Embed the Stage 1.5 @var{stage1_5} in the sectors after the MBR if +@var{device} is a drive, or in the @dfn{boot loader} area if @var{device} +is a FFS partition or a ReiserFS partition.@footnote{The latter feature +has not been implemented yet.} Print the number of sectors which +@var{stage1_5} occupies, if successful. + +Usually, you don't need to run this command directly. @xref{setup}. +@end deffn + + +@node find +@subsection find + +@deffn Command find filename +Search for the file name @var{filename} in all mountable partitions +and print the list of the devices which contain the file. The file +name @var{filename} should be an absolute file name like +@code{/boot/grub/stage1}. +@end deffn + + +@node fstest +@subsection fstest + +@deffn Command fstest +Toggle filesystem test mode. +Filesystem test mode, when turned on, prints out data corresponding to +all the device reads and what values are being sent to the low-level +routines. The format is @samp{<@var{partition-offset-sector}, +@var{byte-offset}, @var{byte-length}>} for high-level reads inside a +partition, and @samp{[@var{disk-offset-sector}]} for low-level sector +requests from the disk. +Filesystem test mode is turned off by any use of the @command{install} +(@pxref{install}) or @command{testload} (@pxref{testload}) commands. +@end deffn + + +@node geometry +@subsection geometry + +@deffn Command geometry drive [cylinder head sector [total_sector]] +Print the information for the drive @var{drive}. In the grub shell, you +can set the geometry of the drive arbitrarily. The number of +cylinders, the number of heads, the number of sectors and the number of +total sectors are set to CYLINDER, HEAD, SECTOR and TOTAL_SECTOR, +respectively. If you omit TOTAL_SECTOR, then it will be calculated +based on the C/H/S values automatically. +@end deffn + + +@node halt +@subsection halt + +@deffn Command halt @option{--no-apm} +The command halts the computer. If the @option{--no-apm} option +is specified, no APM BIOS call is performed. Otherwise, the computer +is shut down using APM. +@end deffn + + +@node help +@subsection help + +@deffn Command help @option{--all} [pattern @dots{}] +Display helpful information about builtin commands. If you do not +specify @var{pattern}, this command shows short descriptions of most of +available commands. If you specify the option @option{--all} to this +command, short descriptions of rarely used commands (such as +@ref{testload}) are displayed as well. + +If you specify any @var{patterns}, it displays longer information +about each of the commands which match those @var{patterns}. +@end deffn + + +@node impsprobe +@subsection impsprobe + +@deffn Command impsprobe +Probe the Intel Multiprocessor Specification 1.1 or 1.4 configuration +table and boot the various CPUs which are found into a tight loop. This +command can be used only in the Stage 2, but not in the grub shell. +@end deffn + + +@node initrd +@subsection initrd + +@deffn Command initrd file @dots{} +Load an initial ramdisk for a Linux format boot image and set the +appropriate parameters in the Linux setup area in memory. See also +@ref{GNU/Linux}. +@end deffn + + +@node install +@subsection install + +@deffn Command install [@option{--force-lba}] [@option{--stage2=os_stage2_file}] stage1_file [@option{d}] dest_dev stage2_file [addr] [@option{p}] [config_file] [real_config_file] +This command is fairly complex, and you should not use this command +unless you are familiar with GRUB. Use @command{setup} (@pxref{setup}) +instead. + +In short, it will perform a full install presuming the Stage 2 or Stage +1.5@footnote{They're loaded the same way, so we will refer to the Stage +1.5 as a Stage 2 from now on.} is in its final install location. + +In slightly more detail, it will load @var{stage1_file}, validate that +it is a GRUB Stage 1 of the right version number, install in it a +blocklist for loading @var{stage2_file} as a Stage 2. If the option +@option{d} is present, the Stage 1 will always look for the actual +disk @var{stage2_file} was installed on, rather than using the booting +drive. The Stage 2 will be loaded at address @var{addr}, which must be +@samp{0x8000} for a true Stage 2, and @samp{0x2000} for a Stage 1.5. If +@var{addr} is not present, GRUB will determine the address +automatically. It then writes the completed Stage 1 to the first block +of the device @var{dest_dev}. If the options @option{p} or +@var{config_file} are present, then it reads the first block of stage2, +modifies it with the values of the partition @var{stage2_file} was found +on (for @option{p}) or places the string @var{config_file} into the area +telling the stage2 where to look for a configuration file at boot +time. Likewise, if @var{real_config_file} is present and +@var{stage2_file} is a Stage 1.5, then the Stage 2 @var{config_file} is +patched with the configuration file name @var{real_config_file}. This +command preserves the DOS BPB (and for hard disks, the partition table) +of the sector the Stage 1 is to be installed into. + +@strong{Caution:} Several buggy BIOSes don't pass a booting drive +properly when booting from a hard disk drive. Therefore, you will +unfortunately have to specify the option @option{d}, whether your +Stage2 resides at the booting drive or not, if you have such a +BIOS. We know these are defective in this way: + +@table @asis +@item +Fujitsu LifeBook 400 BIOS version 31J0103A + +@item +HP Vectra XU 6/200 BIOS version GG.06.11 +@end table + +@strong{Caution2:} A number of BIOSes don't return a correct LBA support +bitmap even if they do have the support. So GRUB provides a solution to +ignore the wrong bitmap, that is, the option @option{--force-lba}. Don't +use this option if you know that your BIOS doesn't have LBA support. + +@strong{Caution3:} You must specify the option @option{--stage2} in the +grub shell, if you cannot unmount the filesystem where your stage2 file +resides. The argument should be the file name in your operating system. +@end deffn + + +@node ioprobe +@subsection ioprobe + +@deffn Command ioprobe drive +Probe I/O ports used for the drive @var{drive}. This command will list +the I/O ports on the screen. For technical information, +@xref{Internals}. +@end deffn + + +@node kernel +@subsection kernel + +@deffn Command kernel [@option{--type=type}] [@option{--no-mem-option}] file @dots{} +Attempt to load the primary boot image (Multiboot a.out or @sc{elf}, +Linux zImage or bzImage, FreeBSD a.out, NetBSD a.out, etc.) from +@var{file}. The rest of the line is passed verbatim as the @dfn{kernel +command-line}. Any modules must be reloaded after using this command. + +This command also accepts the option @option{--type} so that you can +specify the kernel type of @var{file} explicitly. The argument +@var{type} must be one of these: @samp{netbsd}, @samp{freebsd}, +@samp{openbsd}, @samp{linux}, @samp{biglinux}, and +@samp{multiboot}. However, you need to specify it only if you want to +load a NetBSD @sc{elf} kernel, because GRUB can automatically determine +a kernel type in the other cases, quite safely. + +The option @option{--no-mem-option} is effective only for Linux. If the +option is specified, GRUB doesn't pass the option @option{mem=} to the +kernel. This option is implied for Linux kernels 2.4.18 and newer. +@end deffn + + +@node lock +@subsection lock + +@deffn Command lock +Prevent normal users from executing arbitrary menu entries. You must use +the command @command{password} if you really want this command to be +useful (@pxref{password}). + +This command is used in a menu, as shown in this example: + +@example +@group +title This entry is too dangerous to be executed by normal users +lock +root (hd0,a) +kernel /no-security-os +@end group +@end example + +See also @ref{Security}. +@end deffn + + +@node makeactive +@subsection makeactive + +@deffn Command makeactive +Set the active partition on the root disk to GRUB's root device. +This command is limited to @emph{primary} PC partitions on a hard disk. +@end deffn + + +@node map +@subsection map + +@deffn Command map to_drive from_drive +Map the drive @var{from_drive} to the drive @var{to_drive}. This is +necessary when you chain-load some operating systems, such as DOS, if +such an OS resides at a non-first drive. Here is an example: + +@example +@group +grub> @kbd{map (hd0) (hd1)} +grub> @kbd{map (hd1) (hd0)} +@end group +@end example + +The example exchanges the order between the first hard disk and the +second hard disk. See also @ref{DOS/Windows}. +@end deffn + + +@node md5crypt +@subsection md5crypt + +@deffn Command md5crypt +Prompt to enter a password, and encrypt it in MD5 format. The encrypted +password can be used with the command @command{password} +(@pxref{password}). See also @ref{Security}. +@end deffn + + +@node module +@subsection module + +@deffn Command module file @dots{} +Load a boot module @var{file} for a Multiboot format boot image (no +interpretation of the file contents are made, so the user of this +command must know what the kernel in question expects). The rest of the +line is passed as the @dfn{module command-line}, like the +@command{kernel} command. You must load a Multiboot kernel image before +loading any module. See also @ref{modulenounzip}. +@end deffn + + +@node modulenounzip +@subsection modulenounzip + +@deffn Command modulenounzip file @dots{} +The same as @command{module} (@pxref{module}), except that automatic +decompression is disabled. +@end deffn + + +@node pause +@subsection pause + +@deffn Command pause message @dots{} +Print the @var{message}, then wait until a key is pressed. Note that +placing @key{^G} (ASCII code 7) in the message will cause the speaker to +emit the standard beep sound, which is useful when prompting the user to +change floppies. +@end deffn + + +@node quit +@subsection quit + +@deffn Command quit +Exit from the grub shell @command{grub} (@pxref{Invoking the grub +shell}). This command can be used only in the grub shell. +@end deffn + + +@node reboot +@subsection reboot + +@deffn Command reboot +Reboot the computer. +@end deffn + + +@node read +@subsection read + +@deffn Command read addr +Read a 32-bit value from memory at address @var{addr} and display it in +hex format. +@end deffn + + +@node root +@subsection root + +@deffn Command root device [hdbias] +Set the current @dfn{root device} to the device @var{device}, then +attempt to mount it to get the partition size (for passing the partition +descriptor in @code{ES:ESI}, used by some chain-loaded boot loaders), the +BSD drive-type (for booting BSD kernels using their native boot format), +and correctly determine the PC partition where a BSD sub-partition is +located. The optional @var{hdbias} parameter is a number to tell a BSD +kernel how many BIOS drive numbers are on controllers before the current +one. For example, if there is an IDE disk and a SCSI disk, and your +FreeBSD root partition is on the SCSI disk, then use a @samp{1} for +@var{hdbias}. + +See also @ref{rootnoverify}. +@end deffn + + +@node rootnoverify +@subsection rootnoverify + +@deffn Command rootnoverify device [hdbias] +Similar to @command{root} (@pxref{root}), but don't attempt to mount the +partition. This is useful for when an OS is outside of the area of the +disk that GRUB can read, but setting the correct root device is still +desired. Note that the items mentioned in @command{root} above which +derived from attempting the mount will @emph{not} work correctly. +@end deffn + + +@node savedefault +@subsection savedefault + +@deffn Command savedefault num +Save the current menu entry or @var{num} if specified as a default +entry. Here is an example: + +@example +@group +default saved +timeout 10 + +title GNU/Linux +root (hd0,0) +kernel /boot/vmlinuz root=/dev/sda1 vga=ext +initrd /boot/initrd +savedefault + +title FreeBSD +root (hd0,a) +kernel /boot/loader +savedefault +@end group +@end example + +With this configuration, GRUB will choose the entry booted previously as +the default entry. + +You can specify @samp{fallback} instead of a number. Then, next +fallback entry is saved. Next fallback entry is chosen from fallback +entries. Normally, this will be the first entry in fallback ones. + +See also @ref{default} and @ref{Invoking grub-set-default}. +@end deffn + + +@node setup +@subsection setup + +@deffn Command setup [@option{--force-lba}] [@option{--stage2=os_stage2_file}] [@option{--prefix=dir}] install_device [image_device] +Set up the installation of GRUB automatically. This command uses the +more flexible command @command{install} (@pxref{install}) in the backend +and installs GRUB into the device @var{install_device}. If +@var{image_device} is specified, then find the GRUB images +(@pxref{Images}) in the device @var{image_device}, otherwise use the +current @dfn{root device}, which can be set by the command +@command{root}. If @var{install_device} is a hard disk, then embed a +Stage 1.5 in the disk if possible. + +The option @option{--prefix} specifies the directory under which GRUB +images are put. If it is not specified, GRUB automatically searches them +in @file{/boot/grub} and @file{/grub}. + +The options @option{--force-lba} and @option{--stage2} are just passed +to @command{install} if specified. @xref{install}, for more +information. +@end deffn + + +@node testload +@subsection testload + +@deffn Command testload file +Read the entire contents of @var{file} in several different ways and +compare them, to test the filesystem code. The output is somewhat +cryptic, but if no errors are reported and the final @samp{i=@var{X}, +filepos=@var{Y}} reading has @var{X} and @var{Y} equal, then it is +definitely consistent, and very likely works correctly subject to a +consistent offset error. If this test succeeds, then a good next step is +to try loading a kernel. +@end deffn + + +@node testvbe +@subsection testvbe + +@deffn Command testvbe mode +Test the VESA BIOS EXTENSION mode @var{mode}. This command will switch +your video card to the graphics mode, and show an endless animation. Hit +any key to return. See also @ref{vbeprobe}. +@end deffn + + +@node uppermem +@subsection uppermem + +@deffn Command uppermem kbytes +Force GRUB to assume that only @var{kbytes} kilobytes of upper memory +are installed. Any system address range maps are discarded. + +@strong{Caution:} This should be used with great caution, and should +only be necessary on some old machines. GRUB's BIOS probe can pick up +all @sc{ram} on all new machines the author has ever heard of. It can +also be used for debugging purposes to lie to an OS. +@end deffn + + +@node vbeprobe +@subsection vbeprobe + +@deffn Command vbeprobe [mode] +Probe VESA BIOS EXTENSION information. If the mode @var{mode} is +specified, show only the information about @var{mode}. Otherwise, this +command lists up available VBE modes on the screen. See also +@ref{testvbe}. +@end deffn + + +@node Troubleshooting +@chapter Error messages reported by GRUB + +This chapter describes error messages reported by GRUB when you +encounter trouble. @xref{Invoking the grub shell}, if your problem is +specific to the grub shell. + +@menu +* Stage1 errors:: Errors reported by the Stage 1 +* Stage1.5 errors:: Errors reported by the Stage 1.5 +* Stage2 errors:: Errors reported by the Stage 2 +@end menu + + +@node Stage1 errors +@section Errors reported by the Stage 1 + +The general way that the Stage 1 handles errors is to print an error +string and then halt. Pressing @kbd{@key{CTRL}-@key{ALT}-@key{DEL}} will +reboot. + +The following is a comprehensive list of error messages for the Stage 1: + +@table @asis +@item Hard Disk Error +The stage2 or stage1.5 is being read from a hard disk, and the attempt +to determine the size and geometry of the hard disk failed. + +@item Floppy Error +The stage2 or stage1.5 is being read from a floppy disk, and the attempt +to determine the size and geometry of the floppy disk failed. It's listed +as a separate error since the probe sequence is different than for hard +disks. + +@item Read Error +A disk read error happened while trying to read the stage2 or stage1.5. + +@item Geom Error +The location of the stage2 or stage1.5 is not in the portion of the disk +supported directly by the BIOS read calls. This could occur because the +BIOS translated geometry has been changed by the user or the disk is +moved to another machine or controller after installation, or GRUB was +not installed using itself (if it was, the Stage 2 version of this error +would have been seen during that process and it would not have completed +the install). +@end table + + +@node Stage1.5 errors +@section Errors reported by the Stage 1.5 + +The general way that the Stage 1.5 handles errors is to print an error +number in the form @code{Error @var{num}} and then halt. Pressing +@kbd{@key{CTRL}-@key{ALT}-@key{DEL}} will reboot. + +The error numbers correspond to the errors reported by Stage +2. @xref{Stage2 errors}. + + +@node Stage2 errors +@section Errors reported by the Stage 2 + +The general way that the Stage 2 handles errors is to abort the +operation in question, print an error string, then (if possible) either +continue based on the fact that an error occurred or wait for the user to +deal with the error. + +The following is a comprehensive list of error messages for the Stage 2 +(error numbers for the Stage 1.5 are listed before the colon in each +description): + +@table @asis +@item 1 : Filename must be either an absolute filename or blocklist +This error is returned if a file name is requested which doesn't fit the +syntax/rules listed in the @ref{Filesystem}. + +@item 2 : Bad file or directory type +This error is returned if a file requested is not a regular file, but +something like a symbolic link, directory, or FIFO. + +@item 3 : Bad or corrupt data while decompressing file +This error is returned if the run-length decompression code gets an +internal error. This is usually from a corrupt file. + +@item 4 : Bad or incompatible header in compressed file +This error is returned if the file header for a supposedly compressed +file is bad. + +@item 5 : Partition table invalid or corrupt +This error is returned if the sanity checks on the integrity of the +partition table fail. This is a bad sign. + +@item 6 : Mismatched or corrupt version of stage1/stage2 +This error is returned if the install command points to incompatible +or corrupt versions of the stage1 or stage2. It can't detect corruption +in general, but this is a sanity check on the version numbers, which +should be correct. + +@item 7 : Loading below 1MB is not supported +This error is returned if the lowest address in a kernel is below the +1MB boundary. The Linux zImage format is a special case and can be +handled since it has a fixed loading address and maximum size. + +@item 8 : Kernel must be loaded before booting +This error is returned if GRUB is told to execute the boot sequence +without having a kernel to start. + +@item 9 : Unknown boot failure +This error is returned if the boot attempt did not succeed for reasons +which are unknown. + +@item 10 : Unsupported Multiboot features requested +This error is returned when the Multiboot features word in the Multiboot +header requires a feature that is not recognized. The point of this is +that the kernel requires special handling which GRUB is probably +unable to provide. + +@item 11 : Unrecognized device string +This error is returned if a device string was expected, and the string +encountered didn't fit the syntax/rules listed in the @ref{Filesystem}. + +@item 12 : Invalid device requested +This error is returned if a device string is recognizable but does not +fall under the other device errors. + +@item 13 : Invalid or unsupported executable format +This error is returned if the kernel image being loaded is not +recognized as Multiboot or one of the supported native formats (Linux +zImage or bzImage, FreeBSD, or NetBSD). + +@item 14 : Filesystem compatibility error, cannot read whole file +Some of the filesystem reading code in GRUB has limits on the length of +the files it can read. This error is returned when the user runs into +such a limit. + +@item 15 : File not found +This error is returned if the specified file name cannot be found, but +everything else (like the disk/partition info) is OK. + +@item 16 : Inconsistent filesystem structure +This error is returned by the filesystem code to denote an internal +error caused by the sanity checks of the filesystem structure on disk +not matching what it expects. This is usually caused by a corrupt +filesystem or bugs in the code handling it in GRUB. + +@item 17 : Cannot mount selected partition +This error is returned if the partition requested exists, but the +filesystem type cannot be recognized by GRUB. + +@item 18 : Selected cylinder exceeds maximum supported by BIOS +This error is returned when a read is attempted at a linear block +address beyond the end of the BIOS translated area. This generally +happens if your disk is larger than the BIOS can handle (512MB for +(E)IDE disks on older machines or larger than 8GB in general). + +@item 19 : Linux kernel must be loaded before initrd +This error is returned if the initrd command is used before loading a +Linux kernel. + +@item 20 : Multiboot kernel must be loaded before modules +This error is returned if the module load command is used before loading +a Multiboot kernel. It only makes sense in this case anyway, as GRUB has +no idea how to communicate the presence of such modules to a +non-Multiboot-aware kernel. + +@item 21 : Selected disk does not exist +This error is returned if the device part of a device- or full file name +refers to a disk or BIOS device that is not present or not recognized by +the BIOS in the system. + +@item 22 : No such partition +This error is returned if a partition is requested in the device part of +a device- or full file name which isn't on the selected disk. + +@item 23 : Error while parsing number +This error is returned if GRUB was expecting to read a number and +encountered bad data. + +@item 24 : Attempt to access block outside partition +This error is returned if a linear block address is outside of the disk +partition. This generally happens because of a corrupt filesystem on the +disk or a bug in the code handling it in GRUB (it's a great debugging +tool). + +@item 25 : Disk read error +This error is returned if there is a disk read error when trying to +probe or read data from a particular disk. + +@item 26 : Too many symbolic links +This error is returned if the link count is beyond the maximum +(currently 5), possibly the symbolic links are looped. + +@item 27 : Unrecognized command +This error is returned if an unrecognized command is entered on the +command-line or in a boot sequence section of a configuration file and +that entry is selected. + +@item 28 : Selected item cannot fit into memory +This error is returned if a kernel, module, or raw file load command is +either trying to load its data such that it won't fit into memory or it +is simply too big. + +@item 29 : Disk write error +This error is returned if there is a disk write error when trying to +write to a particular disk. This would generally only occur during an +install of set active partition command. + +@item 30 : Invalid argument +This error is returned if an argument specified to a command is invalid. + +@item 31 : File is not sector aligned +This error may occur only when you access a ReiserFS partition by +block-lists (e.g. the command @command{install}). In this case, you +should mount the partition with the @samp{-o notail} option. + +@item 32 : Must be authenticated +This error is returned if you try to run a locked entry. You should +enter a correct password before running such an entry. + +@item 33 : Serial device not configured +This error is returned if you try to change your terminal to a serial +one before initializing any serial device. + +@item 34 : No spare sectors on the disk +This error is returned if a disk doesn't have enough spare space. This +happens when you try to embed Stage 1.5 into the unused sectors after +the MBR, but the first partition starts right after the MBR or they are +used by EZ-BIOS. +@end table + + +@node Invoking the grub shell +@chapter Invoking the grub shell + +This chapter documents the grub shell @command{grub}. Note that the grub +shell is an emulator; it doesn't run under the native environment, so it +sometimes does something wrong. Therefore, you shouldn't trust it too +much. If there is anything wrong with it, don't hesitate to try the +native GRUB environment, especially when it guesses a wrong map between +BIOS drives and OS devices. + +@menu +* Basic usage:: How to use the grub shell +* Installation under UNIX:: How to install GRUB via @command{grub} +* Device map:: The map between BIOS drives and OS devices +@end menu + + +@node Basic usage +@section Introduction into the grub shell + +You can use the command @command{grub} for installing GRUB under your +operating systems and for a testbed when you add a new feature into GRUB +or when fixing a bug. @command{grub} is almost the same as the Stage 2, +and, in fact, it shares the source code with the Stage 2 and you can use +the same commands (@pxref{Commands}) in @command{grub}. It is emulated by +replacing BIOS calls with UNIX system calls and libc functions. + +The command @command{grub} accepts the following options: + +@table @option +@item --help +Print a summary of the command-line options and exit. + +@item --version +Print the version number of GRUB and exit. + +@item --verbose +Print some verbose messages for debugging purpose. + +@item --device-map=@var{file} +Use the device map file @var{file}. The format is described in +@ref{Device map}. + +@item --no-floppy +Do not probe any floppy drive. This option has no effect if the option +@option{--device-map} is specified (@pxref{Device map}). + +@item --probe-second-floppy +Probe the second floppy drive. If this option is not specified, the grub +shell does not probe it, as that sometimes takes a long time. If you +specify the device map file (@pxref{Device map}), the grub shell just +ignores this option. + +@item --config-file=@var{file} +Read the configuration file @var{file} instead of +@file{/boot/grub/menu.lst}. The format is the same as the normal GRUB +syntax. See @ref{Filesystem}, for more information. + +@item --boot-drive=@var{drive} +Set the stage2 @var{boot_drive} to @var{drive}. This argument should be +an integer (decimal, octal or hexadecimal). + +@item --install-partition=@var{par} +Set the stage2 @var{install_partition} to @var{par}. This argument +should be an integer (decimal, octal or hexadecimal). + +@item --no-config-file +Do not use the configuration file even if it can be read. + +@item --no-curses +Do not use the screen handling interface by the curses even if it is +available. + +@item --batch +This option has the same meaning as @samp{--no-config-file --no-curses}. + +@item --read-only +Disable writing to any disk. + +@item --hold +Wait until a debugger will attach. This option is useful when you want +to debug the startup code. +@end table + + +@node Installation under UNIX +@section How to install GRUB via @command{grub} + +The installation procedure is the same as under the @dfn{native} Stage +2. @xref{Installation}, for more information. The command +@command{grub}-specific information is described here. + +What you should be careful about is @dfn{buffer cache}. @command{grub} +makes use of raw devices instead of filesystems that your operating +systems serve, so there exists a potential problem that some cache +inconsistency may corrupt your filesystems. What we recommend is: + +@itemize @bullet +@item +If you can unmount drives to which GRUB may write any amount of data, +unmount them before running @command{grub}. + +@item +If a drive cannot be unmounted but can be mounted with the read-only +flag, mount it in read-only mode. That should be secure. + +@item +If a drive must be mounted with the read-write flag, make sure that no +activity is being done on it while the command @command{grub} is +running. + +@item +Reboot your operating system as soon as possible. This is probably not +required if you follow the rules above, but reboot is the most secure +way. +@end itemize + +In addition, enter the command @command{quit} when you finish the +installation. That is @emph{very important} because @command{quit} makes +the buffer cache consistent. Do not push @key{C-c}. + +If you want to install GRUB non-interactively, specify @samp{--batch} +option in the command-line. This is a simple example: + +@example +@group +#!/bin/sh + +# Use /usr/sbin/grub if you are on an older system. +/sbin/grub --batch </dev/null 2>/dev/null +root (hd0,0) +setup (hd0) +quit +EOT +@end group +@end example + + +@node Device map +@section The map between BIOS drives and OS devices + +When you specify the option @option{--device-map} (@pxref{Basic usage}), +the grub shell creates the @dfn{device map file} automatically unless it +already exists. The file name @file{/boot/grub/device.map} is preferred. + +If the device map file exists, the grub shell reads it to map BIOS +drives to OS devices. This file consists of lines like this: + +@example +@var{device} @var{file} +@end example + +@var{device} is a drive specified in the GRUB syntax (@pxref{Device +syntax}), and @var{file} is an OS file, which is normally a device +file. + +The reason why the grub shell gives you the device map file is that it +cannot guess the map between BIOS drives and OS devices correctly in +some environments. For example, if you exchange the boot sequence +between IDE and SCSI in your BIOS, it gets the order wrong. + +Thus, edit the file if the grub shell makes a mistake. You can put any +comments in the file if needed, as the grub shell assumes that a line is +just a comment if the first character is @samp{#}. + + +@node Invoking grub-install +@chapter Invoking grub-install + +The program @command{grub-install} installs GRUB on your drive using the +grub shell (@pxref{Invoking the grub shell}). You must specify the +device name on which you want to install GRUB, like this: + +@example +grub-install @var{install_device} +@end example + +The device name @var{install_device} is an OS device name or a GRUB +device name. + +@command{grub-install} accepts the following options: + +@table @option +@item --help +Print a summary of the command-line options and exit. + +@item --version +Print the version number of GRUB and exit. + +@item --force-lba +Force GRUB to use LBA mode even for a buggy BIOS. Use this option only +if your BIOS doesn't work properly in LBA mode even though it supports +LBA mode. + +@item --root-directory=@var{dir} +Install GRUB images under the directory @var{dir} instead of the root +directory. This option is useful when you want to install GRUB into a +separate partition or a removable disk. Here is an example in which +you have a separate @dfn{boot} partition which is mounted on +@file{/boot}: + +@example +@kbd{grub-install --root-directory=/boot hd0} +@end example + +@item --grub-shell=@var{file} +Use @var{file} as the grub shell. You can append arbitrary options to +@var{file} after the file name, like this: + +@example +@kbd{grub-install --grub-shell="grub --read-only" /dev/fd0} +@end example + +@item --recheck +Recheck the device map, even if @file{/boot/grub/device.map} already +exists. You should use this option whenever you add/remove a disk +into/from your computer. +@end table + + +@node Invoking grub-md5-crypt +@chapter Invoking grub-md5-crypt + +The program @command{grub-md5-crypt} encrypts a password in MD5 format. +This is just a frontend of the grub shell (@pxref{Invoking the grub +shell}). Passwords encrypted by this program can be used with the +command @command{password} (@pxref{password}). + +@command{grub-md5-crypt} accepts the following options: + +@table @option +@item --help +Print a summary of the command-line options and exit. + +@item --version +Print the version information and exit. + +@item --grub-shell=@var{file} +Use @var{file} as the grub shell. +@end table + + +@node Invoking grub-terminfo +@chapter Invoking grub-terminfo + +The program @command{grub-terminfo} generates a terminfo command from +a terminfo name (@pxref{terminfo}). The result can be used in the +configuration file, to define escape sequences. Because GRUB assumes +that your terminal is vt100-compatible by default, this would be +useful only if your terminal is uncommon (such as vt52). + +@command{grub-terminfo} accepts the following options: + +@table @option +@item --help +Print a summary of the command-line options and exit. + +@item --version +Print the version information and exit. +@end table + +You must specify one argument to this command. For example: + +@example +@kbd{grub-terminfo vt52} +@end example + + +@node Invoking grub-set-default +@chapter Invoking grub-set-default + +The program @command{grub-set-default} sets the default boot entry for +GRUB. This automatically creates a file named @file{default} under +your GRUB directory (i.e. @file{/boot/grub}), if it is not +present. This file is used to determine the default boot entry when +GRUB boots up your system when you use @samp{default saved} in your +configuration file (@pxref{default}), and to save next default boot +entry when you use @samp{savedefault} in a boot entry +(@pxref{savedefault}). + +@command{grub-set-default} accepts the following options: + +@table @option +@item --help +Print a summary of the command-line options and exit. + +@item --version +Print the version information and exit. + +@item --root-directory=@var{dir} +Use the directory @var{dir} instead of the root directory +(i.e. @file{/}) to define the location of the default file. This +is useful when you mount a disk which is used for another system. +@end table + +You must specify a single argument to @command{grub-set-default}. This +argument is normally the number of a default boot entry. For example, +if you have this configuration file: + +@example +@group +default saved +timeout 10 + +title GNU/Hurd +root (hd0,0) +... + +title GNU/Linux +root (hd0,1) +... +@end group +@end example + +and if you want to set the next default boot entry to GNU/Linux, you +may execute this command: + +@example +@kbd{grub-set-default 1} +@end example + +Because the entry for GNU/Linux is @samp{1}. Note that entries are +counted from zero. So, if you want to specify GNU/Hurd here, then you +should specify @samp{0}. + +This feature is very useful if you want to test a new kernel or to +make your system quite robust. @xref{Making your system robust}, for +more hints about how to set up a robust system. + + +@node Invoking mbchk +@chapter Invoking mbchk + +The program @command{mbchk} checks for the format of a Multiboot +kernel. We recommend using this program before booting your own kernel +by GRUB. + +@command{mbchk} accepts the following options: + +@table @option +@item --help +Print a summary of the command-line options and exit. + +@item --version +Print the version number of GRUB and exit. + +@item --quiet +Suppress all normal output. +@end table + + +@node Obtaining and Building GRUB +@appendix How to obtain and build GRUB + +@quotation +@strong{Caution:} GRUB requires binutils-2.9.1.0.23 or later because the +GNU assembler has been changed so that it can produce real 16bits +machine code between 2.9.1 and 2.9.1.0.x. See +@uref{http://sources.redhat.com/binutils/}, to obtain information on +how to get the latest version. +@end quotation + +GRUB is available from the GNU alpha archive site +@uref{ftp://alpha.gnu.org/gnu/grub} or any of its mirrors. The file +will be named grub-version.tar.gz. The current version is +@value{VERSION}, so the file you should grab is: + +@uref{ftp://alpha.gnu.org/gnu/grub/grub-@value{VERSION}.tar.gz} + +To unbundle GRUB use the instruction: + +@example +@kbd{zcat grub-@value{VERSION}.tar.gz | tar xvf -} +@end example + +which will create a directory called @file{grub-@value{VERSION}} with +all the sources. You can look at the file @file{INSTALL} for detailed +instructions on how to build and install GRUB, but you should be able to +just do: + +@example +@group +@kbd{cd grub-@value{VERSION}} +@kbd{./configure} +@kbd{make install} +@end group +@end example + +This will install the grub shell @file{grub} (@pxref{Invoking the grub +shell}), the Multiboot checker @file{mbchk} (@pxref{Invoking mbchk}), +and the GRUB images. This will also install the GRUB manual. + +Also, the latest version is available from the CVS. See +@uref{http://savannah.gnu.org/cvs/?group=grub} for more information. + + +@node Reporting bugs +@appendix Reporting bugs + +These are the guideline for how to report bugs. Take a look at this +list below before you submit bugs: + +@enumerate +@item +Before getting unsettled, read this manual through and through. Also, +see the @uref{http://www.gnu.org/software/grub/grub-faq.html, GNU GRUB FAQ}. + +@item +Always mention the information on your GRUB. The version number and the +configuration are quite important. If you build it yourself, write the +options specified to the configure script and your operating system, +including the versions of gcc and binutils. + +@item +If you have trouble with the installation, inform us of how you +installed GRUB. Don't omit error messages, if any. Just @samp{GRUB hangs +up when it boots} is not enough. + +The information on your hardware is also essential. These are especially +important: the geometries and the partition tables of your hard disk +drives and your BIOS. + +@item +If GRUB cannot boot your operating system, write down +@emph{everything} you see on the screen. Don't paraphrase them, like +@samp{The foo OS crashes with GRUB, even though it can boot with the +bar boot loader just fine}. Mention the commands you executed, the +messages printed by them, and information on your operating system +including the version number. + +@item +Explain what you wanted to do. It is very useful to know your purpose +and your wish, and how GRUB didn't satisfy you. + +@item +If you can investigate the problem yourself, please do. That will give +you and us much more information on the problem. Attaching a patch is +even better. + +When you attach a patch, make the patch in unified diff format, and +write ChangeLog entries. But, even when you make a patch, don't forget +to explain the problem, so that we can understand what your patch is +for. + +@item +Write down anything that you think might be related. Please understand +that we often need to reproduce the same problem you encounterred in our +environment. So your information should be sufficient for us to do the +same thing---Don't forget that we cannot see your computer directly. If +you are not sure whether to state a fact or leave it out, state it! +Reporting too many things is much better than omitting something +important. +@end enumerate + +If you follow the guideline above, submit a report to the +@uref{http://savannah.gnu.org/bugs/?group=grub, Bug Tracking System}. +Alternatively, you can submit a report via electronic mail to +@email{bug-grub@@gnu.org}, but we strongly recommend that you use the +Bug Tracking System, because e-mail can be passed over easily. + +Once we get your report, we will try to fix the bugs. + + +@node Future +@appendix Where GRUB will go + +We started the next generation of GRUB, GRUB 2. This will include +internationalization, dynamic module loading, real memory management, +multiple architecture support, a scripting language, and many other +nice feature. If you are interested in the development of GRUB 2, take +a look at @uref{http://www.gnu.org/software/grub/grub.html, the +homepage}. + + +@c Separate the programming guide. +@include internals.texi + + +@node Index +@unnumbered Index + +@c Currently, we use only the Concept Index. +@printindex cp + + +@bye + +Some notes: + + This is the second attempt to rewrite the manual. The status is +mostly complete, but I need to check the spelling by ispell, and add +more indices. Perhaps I also have to let some English native speakers +proofread this manual through. My English is syntactically almost +perfect, but sometimes (often?) awful in the nuance. Hehe, I can't be an +English poet for now. diff --git a/usr/src/grub/grub-0.97/docs/help2man b/usr/src/grub/grub-0.97/docs/help2man new file mode 100644 index 0000000000..506fcb853d --- /dev/null +++ b/usr/src/grub/grub-0.97/docs/help2man @@ -0,0 +1,517 @@ +#!/usr/bin/perl -w + +# Generate a short man page from --help and --version output. +# Copyright © 1997, 1998, 1999, 2000 Free Software Foundation, 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, 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 Brendan O'Dea +# Available from ftp://ftp.gnu.org/gnu/help2man/ + +use 5.004; +use strict; +use Getopt::Long; +use Text::Tabs qw(expand); +use POSIX qw(strftime setlocale LC_TIME); + +my $this_program = 'help2man'; +my $this_version = '1.23'; +my $version_info = < +EOT + +my $help_info = <. +EOT + +my $section = 1; +my ($opt_name, @opt_include, $opt_output, $opt_no_info); + +# Parse options. +Getopt::Long::config('bundling'); +GetOptions ( + 'n|name=s' => \$opt_name, + 's|section=s' => \$section, + 'i|include=s' => sub { push @opt_include, [ pop, 1 ] }, + 'I|opt-include=s' => sub { push @opt_include, [ pop, 0 ] }, + 'o|output=s' => \$opt_output, + 'N|no-info' => \$opt_no_info, + help => sub { print $help_info; exit }, + version => sub { print $version_info; exit }, +) or die $help_info; + +die $help_info unless @ARGV == 1; + +my %include = (); +my %append = (); +my @include = (); # retain order given in include file + +# Provide replacement `quote-regex' operator for pre-5.005. +BEGIN { eval q(sub qr { '' =~ $_[0]; $_[0] }) if $] < 5.005 } + +# Process include file (if given). Format is: +# +# [section name] +# verbatim text +# +# or +# +# /pattern/ +# verbatim text +# + +for (@opt_include) +{ + my ($inc, $required) = @$_; + + next unless -f $inc or $required; + die "$this_program: can't open `$inc' ($!)\n" + unless open INC, $inc; + + my $key; + my $hash = \%include; + + while () + { + # [section] + if (/^\[([^]]+)\]/) + { + $key = uc $1; + $key =~ s/^\s+//; + $key =~ s/\s+$//; + $hash = \%include; + push @include, $key unless $include{$key}; + next; + } + + # /pattern/ + if (m!^/(.*)/([ims]*)!) + { + my $pat = $2 ? "(?$2)$1" : $1; + + # Check pattern. + eval { $key = qr($pat) }; + if ($@) + { + $@ =~ s/ at .*? line \d.*//; + die "$inc:$.:$@"; + } + + $hash = \%append; + next; + } + + # Silently ignore anything before the first + # section--allows for comments and revision info. + next unless $key; + + $hash->{$key} ||= ''; + $hash->{$key} .= $_; + } + + close INC; + + die "$this_program: no valid information found in `$inc'\n" + unless $key; +} + +# Compress trailing blank lines. +for my $hash (\(%include, %append)) +{ + for (keys %$hash) { $hash->{$_} =~ s/\n+$/\n/ } +} + +# Turn off localisation of executable's ouput. +@ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3; + +# Turn off localisation of date (for strftime). +setlocale LC_TIME, 'C'; + +# Grab help and version info from executable. +my ($help_text, $version_text) = map { + join '', map { s/ +$//; expand $_ } `$ARGV[0] --$_ 2>/dev/null` + or die "$this_program: can't get `--$_' info from $ARGV[0]\n" +} qw(help version); + +my $date = strftime "%B %Y", localtime; +(my $program = $ARGV[0]) =~ s!.*/!!; +my $package = $program; +my $version; + +if ($opt_output) +{ + unlink $opt_output + or die "$this_program: can't unlink $opt_output ($!)\n" + if -e $opt_output; + + open STDOUT, ">$opt_output" + or die "$this_program: can't create $opt_output ($!)\n"; +} + +# The first line of the --version information is assumed to be in one +# of the following formats: +# +# +# +# {GNU,Free} +# ({GNU,Free} ) +# - {GNU,Free} +# +# and seperated from any copyright/author details by a blank line. + +($_, $version_text) = split /\n+/, $version_text, 2; + +if (/^(\S+) +\(((?:GNU|Free) +[^)]+)\) +(.*)/ or + /^(\S+) +- *((?:GNU|Free) +\S+) +(.*)/) +{ + $program = $1; + $package = $2; + $version = $3; +} +elsif (/^((?:GNU|Free) +)?(\S+) +(.*)/) +{ + $program = $2; + $package = $1 ? "$1$2" : $2; + $version = $3; +} +else +{ + $version = $_; +} + +$program =~ s!.*/!!; + +# No info for `info' itself. +$opt_no_info = 1 if $program eq 'info'; + +# --name overrides --include contents. +$include{NAME} = "$program \\- $opt_name\n" if $opt_name; + +# Default (useless) NAME paragraph. +$include{NAME} ||= "$program \\- manual page for $program $version\n"; + +# Man pages traditionally have the page title in caps. +my $PROGRAM = uc $program; + +# Extract usage clause(s) [if any] for SYNOPSIS. +if ($help_text =~ s/^Usage:( +(\S+))(.*)((?:\n(?: {6}\1| *or: +\S).*)*)//m) +{ + my @syn = $2 . $3; + + if ($_ = $4) + { + s/^\n//; + for (split /\n/) { s/^ *(or: +)?//; push @syn, $_ } + } + + my $synopsis = ''; + for (@syn) + { + $synopsis .= ".br\n" if $synopsis; + s!^\S*/!!; + s/^(\S+) *//; + $synopsis .= ".B $1\n"; + s/\s+$//; + s/(([][]|\.\.+)+)/\\fR$1\\fI/g; + s/^/\\fI/ unless s/^\\fR//; + $_ .= '\fR'; + s/(\\fI)( *)/$2$1/g; + s/\\fI\\fR//g; + s/^\\fR//; + s/\\fI$//; + s/^\./\\&./; + + $synopsis .= "$_\n"; + } + + $include{SYNOPSIS} ||= $synopsis; +} + +# Process text, initial section is DESCRIPTION. +my $sect = 'DESCRIPTION'; +$_ = "$help_text\n\n$version_text"; + +# Normalise paragraph breaks. +s/^\n+//; +s/\n*$/\n/; +s/\n\n+/\n\n/g; + +# Temporarily exchange leading dots, apostrophes and backslashes for +# tokens. +s/^\./\x80/mg; +s/^'/\x81/mg; +s/\\/\x82/g; + +# Start a new paragraph (if required) for these. +s/([^\n])\n(Report +bugs|Email +bug +reports +to|Written +by)/$1\n\n$2/g; + +sub convert_option; + +while (length) +{ + # Convert some standard paragraph names. + if (s/^(Options|Examples): *\n//) + { + $sect = uc $1; + next; + } + + # Copyright section + if (/^Copyright +[(\xa9]/) + { + $sect = 'COPYRIGHT'; + $include{$sect} ||= ''; + $include{$sect} .= ".PP\n" if $include{$sect}; + + my $copy; + ($copy, $_) = split /\n\n/, $_, 2; + + for ($copy) + { + # Add back newline + s/\n*$/\n/; + + # Convert iso9959-1 copyright symbol or (c) to nroff + # character. + s/^Copyright +(?:\xa9|\([Cc]\))/Copyright \\(co/mg; + + # Insert line breaks before additional copyright messages + # and the disclaimer. + s/(.)\n(Copyright |This +is +free +software)/$1\n.br\n$2/g; + + # Join hyphenated lines. + s/([A-Za-z])-\n */$1/g; + } + + $include{$sect} .= $copy; + $_ ||= ''; + next; + } + + # Catch bug report text. + if (/^(Report +bugs|Email +bug +reports +to) /) + { + $sect = 'REPORTING BUGS'; + } + + # Author section. + elsif (/^Written +by/) + { + $sect = 'AUTHOR'; + } + + # Examples, indicated by an indented leading $, % or > are + # rendered in a constant width font. + if (/^( +)([\$\%>] )\S/) + { + my $indent = $1; + my $prefix = $2; + my $break = '.IP'; + $include{$sect} ||= ''; + while (s/^$indent\Q$prefix\E(\S.*)\n*//) + { + $include{$sect} .= "$break\n\\f(CW$prefix$1\\fR\n"; + $break = '.br'; + } + + next; + } + + my $matched = ''; + $include{$sect} ||= ''; + + # Sub-sections have a trailing colon and the second line indented. + if (s/^(\S.*:) *\n / /) + { + $matched .= $& if %append; + $include{$sect} .= qq(.SS "$1"\n); + } + + my $indent = 0; + my $content = ''; + + # Option with description. + if (s/^( {1,10}([+-]\S.*?))(?:( +)|\n( {20,}))(\S.*)\n//) + { + $matched .= $& if %append; + $indent = length ($4 || "$1$3"); + $content = ".TP\n\x83$2\n\x83$5\n"; + unless ($4) + { + # Indent may be different on second line. + $indent = length $& if /^ {20,}/; + } + } + + # Option without description. + elsif (s/^ {1,10}([+-]\S.*)\n//) + { + $matched .= $& if %append; + $content = ".HP\n\x83$1\n"; + $indent = 80; # not continued + } + + # Indented paragraph with tag. + elsif (s/^( +(\S.*?) +)(\S.*)\n//) + { + $matched .= $& if %append; + $indent = length $1; + $content = ".TP\n\x83$2\n\x83$3\n"; + } + + # Indented paragraph. + elsif (s/^( +)(\S.*)\n//) + { + $matched .= $& if %append; + $indent = length $1; + $content = ".IP\n\x83$2\n"; + } + + # Left justified paragraph. + else + { + s/(.*)\n//; + $matched .= $& if %append; + $content = ".PP\n" if $include{$sect}; + $content .= "$1\n"; + } + + # Append continuations. + while (s/^ {$indent}(\S.*)\n//) + { + $matched .= $& if %append; + $content .= "\x83$1\n" + } + + # Move to next paragraph. + s/^\n+//; + + for ($content) + { + # Leading dot and apostrophe protection. + s/\x83\./\x80/g; + s/\x83'/\x81/g; + s/\x83//g; + + # Convert options. + s/(^| )(-[][\w=-]+)/$1 . convert_option $2/mge; + } + + # Check if matched paragraph contains /pat/. + if (%append) + { + for my $pat (keys %append) + { + if ($matched =~ $pat) + { + $content .= ".PP\n" unless $append{$pat} =~ /^\./; + $content .= $append{$pat}; + } + } + } + + $include{$sect} .= $content; +} + +# Refer to the real documentation. +unless ($opt_no_info) +{ + $sect = 'SEE ALSO'; + $include{$sect} ||= ''; + $include{$sect} .= ".PP\n" if $include{$sect}; + $include{$sect} .= < + +/* Macros. */ + +/* Check if the bit BIT in FLAGS is set. */ +#define CHECK_FLAG(flags,bit) ((flags) & (1 << (bit))) + +/* Some screen stuff. */ +/* The number of columns. */ +#define COLUMNS 80 +/* The number of lines. */ +#define LINES 24 +/* The attribute of an character. */ +#define ATTRIBUTE 7 +/* The video memory address. */ +#define VIDEO 0xB8000 + +/* Variables. */ +/* Save the X position. */ +static int xpos; +/* Save the Y position. */ +static int ypos; +/* Point to the video memory. */ +static volatile unsigned char *video; + +/* Forward declarations. */ +void cmain (unsigned long magic, unsigned long addr); +static void cls (void); +static void itoa (char *buf, int base, int d); +static void putchar (int c); +void printf (const char *format, ...); + +/* Check if MAGIC is valid and print the Multiboot information structure + pointed by ADDR. */ +void +cmain (unsigned long magic, unsigned long addr) +{ + multiboot_info_t *mbi; + + /* Clear the screen. */ + cls (); + + /* Am I booted by a Multiboot-compliant boot loader? */ + if (magic != MULTIBOOT_BOOTLOADER_MAGIC) + { + printf ("Invalid magic number: 0x%x\n", (unsigned) magic); + return; + } + + /* Set MBI to the address of the Multiboot information structure. */ + mbi = (multiboot_info_t *) addr; + + /* Print out the flags. */ + printf ("flags = 0x%x\n", (unsigned) mbi->flags); + + /* Are mem_* valid? */ + if (CHECK_FLAG (mbi->flags, 0)) + printf ("mem_lower = %uKB, mem_upper = %uKB\n", + (unsigned) mbi->mem_lower, (unsigned) mbi->mem_upper); + + /* Is boot_device valid? */ + if (CHECK_FLAG (mbi->flags, 1)) + printf ("boot_device = 0x%x\n", (unsigned) mbi->boot_device); + + /* Is the command line passed? */ + if (CHECK_FLAG (mbi->flags, 2)) + printf ("cmdline = %s\n", (char *) mbi->cmdline); + + /* Are mods_* valid? */ + if (CHECK_FLAG (mbi->flags, 3)) + { + module_t *mod; + int i; + + printf ("mods_count = %d, mods_addr = 0x%x\n", + (int) mbi->mods_count, (int) mbi->mods_addr); + for (i = 0, mod = (module_t *) mbi->mods_addr; + i < mbi->mods_count; + i++, mod++) + printf (" mod_start = 0x%x, mod_end = 0x%x, string = %s\n", + (unsigned) mod->mod_start, + (unsigned) mod->mod_end, + (char *) mod->string); + } + + /* Bits 4 and 5 are mutually exclusive! */ + if (CHECK_FLAG (mbi->flags, 4) && CHECK_FLAG (mbi->flags, 5)) + { + printf ("Both bits 4 and 5 are set.\n"); + return; + } + + /* Is the symbol table of a.out valid? */ + if (CHECK_FLAG (mbi->flags, 4)) + { + aout_symbol_table_t *aout_sym = &(mbi->u.aout_sym); + + printf ("aout_symbol_table: tabsize = 0x%0x, " + "strsize = 0x%x, addr = 0x%x\n", + (unsigned) aout_sym->tabsize, + (unsigned) aout_sym->strsize, + (unsigned) aout_sym->addr); + } + + /* Is the section header table of ELF valid? */ + if (CHECK_FLAG (mbi->flags, 5)) + { + elf_section_header_table_t *elf_sec = &(mbi->u.elf_sec); + + printf ("elf_sec: num = %u, size = 0x%x," + " addr = 0x%x, shndx = 0x%x\n", + (unsigned) elf_sec->num, (unsigned) elf_sec->size, + (unsigned) elf_sec->addr, (unsigned) elf_sec->shndx); + } + + /* Are mmap_* valid? */ + if (CHECK_FLAG (mbi->flags, 6)) + { + memory_map_t *mmap; + + printf ("mmap_addr = 0x%x, mmap_length = 0x%x\n", + (unsigned) mbi->mmap_addr, (unsigned) mbi->mmap_length); + for (mmap = (memory_map_t *) mbi->mmap_addr; + (unsigned long) mmap < mbi->mmap_addr + mbi->mmap_length; + mmap = (memory_map_t *) ((unsigned long) mmap + + mmap->size + sizeof (mmap->size))) + printf (" size = 0x%x, base_addr = 0x%x%x," + " length = 0x%x%x, type = 0x%x\n", + (unsigned) mmap->size, + (unsigned) mmap->base_addr_high, + (unsigned) mmap->base_addr_low, + (unsigned) mmap->length_high, + (unsigned) mmap->length_low, + (unsigned) mmap->type); + } +} + +/* Clear the screen and initialize VIDEO, XPOS and YPOS. */ +static void +cls (void) +{ + int i; + + video = (unsigned char *) VIDEO; + + for (i = 0; i < COLUMNS * LINES * 2; i++) + *(video + i) = 0; + + xpos = 0; + ypos = 0; +} + +/* Convert the integer D to a string and save the string in BUF. If + BASE is equal to 'd', interpret that D is decimal, and if BASE is + equal to 'x', interpret that D is hexadecimal. */ +static void +itoa (char *buf, int base, int d) +{ + char *p = buf; + char *p1, *p2; + unsigned long ud = d; + int divisor = 10; + + /* If %d is specified and D is minus, put `-' in the head. */ + if (base == 'd' && d < 0) + { + *p++ = '-'; + buf++; + ud = -d; + } + else if (base == 'x') + divisor = 16; + + /* Divide UD by DIVISOR until UD == 0. */ + do + { + int remainder = ud % divisor; + + *p++ = (remainder < 10) ? remainder + '0' : remainder + 'a' - 10; + } + while (ud /= divisor); + + /* Terminate BUF. */ + *p = 0; + + /* Reverse BUF. */ + p1 = buf; + p2 = p - 1; + while (p1 < p2) + { + char tmp = *p1; + *p1 = *p2; + *p2 = tmp; + p1++; + p2--; + } +} + +/* Put the character C on the screen. */ +static void +putchar (int c) +{ + if (c == '\n' || c == '\r') + { + newline: + xpos = 0; + ypos++; + if (ypos >= LINES) + ypos = 0; + return; + } + + *(video + (xpos + ypos * COLUMNS) * 2) = c & 0xFF; + *(video + (xpos + ypos * COLUMNS) * 2 + 1) = ATTRIBUTE; + + xpos++; + if (xpos >= COLUMNS) + goto newline; +} + +/* Format a string and print it on the screen, just like the libc + function printf. */ +void +printf (const char *format, ...) +{ + char **arg = (char **) &format; + int c; + char buf[20]; + + arg++; + + while ((c = *format++) != 0) + { + if (c != '%') + putchar (c); + else + { + char *p; + + c = *format++; + switch (c) + { + case 'd': + case 'u': + case 'x': + itoa (buf, c, *((int *) arg++)); + p = buf; + goto string; + break; + + case 's': + p = *arg++; + if (! p) + p = "(null)"; + + string: + while (*p) + putchar (*p++); + break; + + default: + putchar (*((int *) arg++)); + break; + } + } + } +} diff --git a/usr/src/grub/grub-0.97/docs/kernel.c.texi b/usr/src/grub/grub-0.97/docs/kernel.c.texi new file mode 100644 index 0000000000..bd61bd58e0 --- /dev/null +++ b/usr/src/grub/grub-0.97/docs/kernel.c.texi @@ -0,0 +1,284 @@ +/* @r{kernel.c - the C part of the kernel} */ +/* @r{Copyright (C) 1999 Free Software Foundation, 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 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 + +/* @r{Macros.} */ + +/* @r{Check if the bit BIT in FLAGS is set.} */ +#define CHECK_FLAG(flags,bit) ((flags) & (1 << (bit))) + +/* @r{Some screen stuff.} */ +/* @r{The number of columns.} */ +#define COLUMNS 80 +/* @r{The number of lines.} */ +#define LINES 24 +/* @r{The attribute of an character.} */ +#define ATTRIBUTE 7 +/* @r{The video memory address.} */ +#define VIDEO 0xB8000 + +/* @r{Variables.} */ +/* @r{Save the X position.} */ +static int xpos; +/* @r{Save the Y position.} */ +static int ypos; +/* @r{Point to the video memory.} */ +static volatile unsigned char *video; + +/* @r{Forward declarations.} */ +void cmain (unsigned long magic, unsigned long addr); +static void cls (void); +static void itoa (char *buf, int base, int d); +static void putchar (int c); +void printf (const char *format, ...); + +/* @r{Check if MAGIC is valid and print the Multiboot information structure + pointed by ADDR.} */ +void +cmain (unsigned long magic, unsigned long addr) +@{ + multiboot_info_t *mbi; + + /* @r{Clear the screen.} */ + cls (); + + /* @r{Am I booted by a Multiboot-compliant boot loader?} */ + if (magic != MULTIBOOT_BOOTLOADER_MAGIC) + @{ + printf ("Invalid magic number: 0x%x\n", (unsigned) magic); + return; + @} + + /* @r{Set MBI to the address of the Multiboot information structure.} */ + mbi = (multiboot_info_t *) addr; + + /* @r{Print out the flags.} */ + printf ("flags = 0x%x\n", (unsigned) mbi->flags); + + /* @r{Are mem_* valid?} */ + if (CHECK_FLAG (mbi->flags, 0)) + printf ("mem_lower = %uKB, mem_upper = %uKB\n", + (unsigned) mbi->mem_lower, (unsigned) mbi->mem_upper); + + /* @r{Is boot_device valid?} */ + if (CHECK_FLAG (mbi->flags, 1)) + printf ("boot_device = 0x%x\n", (unsigned) mbi->boot_device); + + /* @r{Is the command line passed?} */ + if (CHECK_FLAG (mbi->flags, 2)) + printf ("cmdline = %s\n", (char *) mbi->cmdline); + + /* @r{Are mods_* valid?} */ + if (CHECK_FLAG (mbi->flags, 3)) + @{ + module_t *mod; + int i; + + printf ("mods_count = %d, mods_addr = 0x%x\n", + (int) mbi->mods_count, (int) mbi->mods_addr); + for (i = 0, mod = (module_t *) mbi->mods_addr; + i < mbi->mods_count; + i++, mod++) + printf (" mod_start = 0x%x, mod_end = 0x%x, string = %s\n", + (unsigned) mod->mod_start, + (unsigned) mod->mod_end, + (char *) mod->string); + @} + + /* @r{Bits 4 and 5 are mutually exclusive!} */ + if (CHECK_FLAG (mbi->flags, 4) && CHECK_FLAG (mbi->flags, 5)) + @{ + printf ("Both bits 4 and 5 are set.\n"); + return; + @} + + /* @r{Is the symbol table of a.out valid?} */ + if (CHECK_FLAG (mbi->flags, 4)) + @{ + aout_symbol_table_t *aout_sym = &(mbi->u.aout_sym); + + printf ("aout_symbol_table: tabsize = 0x%0x, " + "strsize = 0x%x, addr = 0x%x\n", + (unsigned) aout_sym->tabsize, + (unsigned) aout_sym->strsize, + (unsigned) aout_sym->addr); + @} + + /* @r{Is the section header table of ELF valid?} */ + if (CHECK_FLAG (mbi->flags, 5)) + @{ + elf_section_header_table_t *elf_sec = &(mbi->u.elf_sec); + + printf ("elf_sec: num = %u, size = 0x%x," + " addr = 0x%x, shndx = 0x%x\n", + (unsigned) elf_sec->num, (unsigned) elf_sec->size, + (unsigned) elf_sec->addr, (unsigned) elf_sec->shndx); + @} + + /* @r{Are mmap_* valid?} */ + if (CHECK_FLAG (mbi->flags, 6)) + @{ + memory_map_t *mmap; + + printf ("mmap_addr = 0x%x, mmap_length = 0x%x\n", + (unsigned) mbi->mmap_addr, (unsigned) mbi->mmap_length); + for (mmap = (memory_map_t *) mbi->mmap_addr; + (unsigned long) mmap < mbi->mmap_addr + mbi->mmap_length; + mmap = (memory_map_t *) ((unsigned long) mmap + + mmap->size + sizeof (mmap->size))) + printf (" size = 0x%x, base_addr = 0x%x%x," + " length = 0x%x%x, type = 0x%x\n", + (unsigned) mmap->size, + (unsigned) mmap->base_addr_high, + (unsigned) mmap->base_addr_low, + (unsigned) mmap->length_high, + (unsigned) mmap->length_low, + (unsigned) mmap->type); + @} +@} + +/* @r{Clear the screen and initialize VIDEO, XPOS and YPOS.} */ +static void +cls (void) +@{ + int i; + + video = (unsigned char *) VIDEO; + + for (i = 0; i < COLUMNS * LINES * 2; i++) + *(video + i) = 0; + + xpos = 0; + ypos = 0; +@} + +/* @r{Convert the integer D to a string and save the string in BUF. If + BASE is equal to 'd', interpret that D is decimal, and if BASE is + equal to 'x', interpret that D is hexadecimal.} */ +static void +itoa (char *buf, int base, int d) +@{ + char *p = buf; + char *p1, *p2; + unsigned long ud = d; + int divisor = 10; + + /* @r{If %d is specified and D is minus, put `-' in the head.} */ + if (base == 'd' && d < 0) + @{ + *p++ = '-'; + buf++; + ud = -d; + @} + else if (base == 'x') + divisor = 16; + + /* @r{Divide UD by DIVISOR until UD == 0.} */ + do + @{ + int remainder = ud % divisor; + + *p++ = (remainder < 10) ? remainder + '0' : remainder + 'a' - 10; + @} + while (ud /= divisor); + + /* @r{Terminate BUF.} */ + *p = 0; + + /* @r{Reverse BUF.} */ + p1 = buf; + p2 = p - 1; + while (p1 < p2) + @{ + char tmp = *p1; + *p1 = *p2; + *p2 = tmp; + p1++; + p2--; + @} +@} + +/* @r{Put the character C on the screen.} */ +static void +putchar (int c) +@{ + if (c == '\n' || c == '\r') + @{ + newline: + xpos = 0; + ypos++; + if (ypos >= LINES) + ypos = 0; + return; + @} + + *(video + (xpos + ypos * COLUMNS) * 2) = c & 0xFF; + *(video + (xpos + ypos * COLUMNS) * 2 + 1) = ATTRIBUTE; + + xpos++; + if (xpos >= COLUMNS) + goto newline; +@} + +/* @r{Format a string and print it on the screen, just like the libc + function printf.} */ +void +printf (const char *format, ...) +@{ + char **arg = (char **) &format; + int c; + char buf[20]; + + arg++; + + while ((c = *format++) != 0) + @{ + if (c != '%') + putchar (c); + else + @{ + char *p; + + c = *format++; + switch (c) + @{ + case 'd': + case 'u': + case 'x': + itoa (buf, c, *((int *) arg++)); + p = buf; + goto string; + break; + + case 's': + p = *arg++; + if (! p) + p = "(null)"; + + string: + while (*p) + putchar (*p++); + break; + + default: + putchar (*((int *) arg++)); + break; + @} + @} + @} +@} diff --git a/usr/src/grub/grub-0.97/docs/mbchk.1 b/usr/src/grub/grub-0.97/docs/mbchk.1 new file mode 100644 index 0000000000..3ff3fbd9be --- /dev/null +++ b/usr/src/grub/grub-0.97/docs/mbchk.1 @@ -0,0 +1,27 @@ +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.23. +.TH MBCHK "1" "May 2005" "mbchk (GNU GRUB 0.97)" FSF +.SH NAME +mbchk \- check the format of a Multiboot kernel +.SH SYNOPSIS +.B mbchk +[\fIOPTION\fR]... [\fIFILE\fR]... +.SH DESCRIPTION +Check if the format of FILE complies with the Multiboot Specification. +.PP +\fB\-q\fR, \fB\-\-quiet\fR suppress all normal output +\fB\-h\fR, \fB\-\-help\fR display this help and exit +\fB\-v\fR, \fB\-\-version\fR output version information and exit. +.SH "REPORTING BUGS" +Report bugs to . +.SH "SEE ALSO" +The full documentation for +.B mbchk +is maintained as a Texinfo manual. If the +.B info +and +.B mbchk +programs are properly installed at your site, the command +.IP +.B info mbchk +.PP +should give you access to the complete manual. diff --git a/usr/src/grub/grub-0.97/docs/mdate-sh b/usr/src/grub/grub-0.97/docs/mdate-sh new file mode 100644 index 0000000000..881782eb55 --- /dev/null +++ b/usr/src/grub/grub-0.97/docs/mdate-sh @@ -0,0 +1,170 @@ +#!/bin/sh +# Get modification time of a file or directory and pretty-print it. + +scriptversion=2004-12-08.12 + +# Copyright (C) 1995, 1996, 1997, 2003, 2004 Free Software Foundation, Inc. +# written by Ulrich Drepper , June 1995 +# +# 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. +# +# 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. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# This file is maintained in Automake, please report +# bugs to or send patches to +# . + +case $1 in + '') + echo "$0: No file. Try \`$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: mdate-sh [--help] [--version] FILE + +Pretty-print the modification time of FILE. + +Report bugs to . +EOF + exit 0 + ;; + -v | --v*) + echo "mdate-sh $scriptversion" + exit 0 + ;; +esac + +# Prevent date giving response in another language. +LANG=C +export LANG +LC_ALL=C +export LC_ALL +LC_TIME=C +export LC_TIME + +save_arg1="$1" + +# Find out how to get the extended ls output of a file or directory. +if ls -L /dev/null 1>/dev/null 2>&1; then + ls_command='ls -L -l -d' +else + ls_command='ls -l -d' +fi + +# A `ls -l' line looks as follows on OS/2. +# drwxrwx--- 0 Aug 11 2001 foo +# This differs from Unix, which adds ownership information. +# drwxrwx--- 2 root root 4096 Aug 11 2001 foo +# +# To find the date, we split the line on spaces and iterate on words +# until we find a month. This cannot work with files whose owner is a +# user named `Jan', or `Feb', etc. However, it's unlikely that `/' +# will be owned by a user whose name is a month. So we first look at +# the extended ls output of the root directory to decide how many +# words should be skipped to get the date. + +# On HPUX /bin/sh, "set" interprets "-rw-r--r--" as options, so the "x" below. +set x`ls -l -d /` + +# Find which argument is the month. +month= +command= +until test $month +do + shift + # Add another shift to the command. + command="$command shift;" + case $1 in + Jan) month=January; nummonth=1;; + Feb) month=February; nummonth=2;; + Mar) month=March; nummonth=3;; + Apr) month=April; nummonth=4;; + May) month=May; nummonth=5;; + Jun) month=June; nummonth=6;; + Jul) month=July; nummonth=7;; + Aug) month=August; nummonth=8;; + Sep) month=September; nummonth=9;; + Oct) month=October; nummonth=10;; + Nov) month=November; nummonth=11;; + Dec) month=December; nummonth=12;; + esac +done + +# Get the extended ls output of the file or directory. +set x`eval "$ls_command \"\$save_arg1\""` + +# Remove all preceding arguments +eval $command + +# Get the month. Next argument is day, followed by the year or time. +case $1 in + Jan) month=January; nummonth=1;; + Feb) month=February; nummonth=2;; + Mar) month=March; nummonth=3;; + Apr) month=April; nummonth=4;; + May) month=May; nummonth=5;; + Jun) month=June; nummonth=6;; + Jul) month=July; nummonth=7;; + Aug) month=August; nummonth=8;; + Sep) month=September; nummonth=9;; + Oct) month=October; nummonth=10;; + Nov) month=November; nummonth=11;; + Dec) month=December; nummonth=12;; +esac + +day=$2 + +# Here we have to deal with the problem that the ls output gives either +# the time of day or the year. +case $3 in + *:*) set `date`; eval year=\$$# + case $2 in + Jan) nummonthtod=1;; + Feb) nummonthtod=2;; + Mar) nummonthtod=3;; + Apr) nummonthtod=4;; + May) nummonthtod=5;; + Jun) nummonthtod=6;; + Jul) nummonthtod=7;; + Aug) nummonthtod=8;; + Sep) nummonthtod=9;; + Oct) nummonthtod=10;; + Nov) nummonthtod=11;; + Dec) nummonthtod=12;; + esac + # For the first six month of the year the time notation can also + # be used for files modified in the last year. + if (expr $nummonth \> $nummonthtod) > /dev/null; + then + year=`expr $year - 1` + fi;; + *) year=$3;; +esac + +# The result. +echo $day $month $year + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/usr/src/grub/grub-0.97/docs/menu.lst b/usr/src/grub/grub-0.97/docs/menu.lst new file mode 100644 index 0000000000..ae58aee7ce --- /dev/null +++ b/usr/src/grub/grub-0.97/docs/menu.lst @@ -0,0 +1,82 @@ +# +# Sample boot menu configuration file +# + +# Boot automatically after 30 secs. +timeout 30 + +# By default, boot the first entry. +default 0 + +# Fallback to the second entry. +fallback 1 + +# For booting GNU/Hurd +title GNU/Hurd +root (hd0,0) +kernel /boot/gnumach.gz root=hd0s1 +module /boot/serverboot.gz + +# For booting GNU/Linux +title GNU/Linux +root (hd1,0) +kernel /vmlinuz root=/dev/hdb1 +#initrd /initrd.img + +# For booting GNU/kFreeBSD +title GNU/kFreeBSD +root (hd0,2,a) +kernel /boot/loader.gz + +# For booting GNU/kNetBSD +title GNU/kNetBSD +root (hd0,2,a) +kernel --type=netbsd /boot/knetbsd.gz + +# For booting Mach (getting kernel from floppy) +title Utah Mach4 multiboot +root (hd0,2) +pause Insert the diskette now!! +kernel (fd0)/boot/kernel root=hd0s3 +module (fd0)/boot/bootstrap + +# For booting FreeBSD +title FreeBSD +root (hd0,2,a) +kernel /boot/loader + +# For booting NetBSD +title NetBSD +root (hd0,2,a) +kernel --type=netbsd /netbsd + +# For booting OpenBSD +title OpenBSD +root (hd0,2,a) +kernel --type=netbsd /bsd + +# For booting OS/2 +title OS/2 +root (hd0,1) +makeactive +# chainload OS/2 bootloader from the first sector +chainloader +1 +# This is similar to "chainload", but loads a specific file +#chainloader /boot/chain.os2 + +# For booting Windows NT or Windows95 +title Windows NT / Windows 95 boot menu +rootnoverify (hd0,0) +makeactive +chainloader +1 +# For loading DOS if Windows NT is installed +# chainload /bootsect.dos + +# For installing GRUB into the hard disk +title Install GRUB into the hard disk +root (hd0,0) +setup (hd0) + +# Change the colors. +title Change the colors +color light-green/brown blink-red/blue diff --git a/usr/src/grub/grub-0.97/docs/multiboot.h b/usr/src/grub/grub-0.97/docs/multiboot.h new file mode 100644 index 0000000000..df79225aa9 --- /dev/null +++ b/usr/src/grub/grub-0.97/docs/multiboot.h @@ -0,0 +1,119 @@ +/* multiboot.h - the header for Multiboot */ +/* Copyright (C) 1999, 2001 Free Software Foundation, 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 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. */ + +/* Macros. */ + +/* The magic number for the Multiboot header. */ +#define MULTIBOOT_HEADER_MAGIC 0x1BADB002 + +/* The flags for the Multiboot header. */ +#ifdef __ELF__ +# define MULTIBOOT_HEADER_FLAGS 0x00000003 +#else +# define MULTIBOOT_HEADER_FLAGS 0x00010003 +#endif + +/* The magic number passed by a Multiboot-compliant boot loader. */ +#define MULTIBOOT_BOOTLOADER_MAGIC 0x2BADB002 + +/* The size of our stack (16KB). */ +#define STACK_SIZE 0x4000 + +/* C symbol format. HAVE_ASM_USCORE is defined by configure. */ +#ifdef HAVE_ASM_USCORE +# define EXT_C(sym) _ ## sym +#else +# define EXT_C(sym) sym +#endif + +#ifndef ASM +/* Do not include here in boot.S. */ + +/* Types. */ + +/* The Multiboot header. */ +typedef struct multiboot_header +{ + unsigned long magic; + unsigned long flags; + unsigned long checksum; + unsigned long header_addr; + unsigned long load_addr; + unsigned long load_end_addr; + unsigned long bss_end_addr; + unsigned long entry_addr; +} multiboot_header_t; + +/* The symbol table for a.out. */ +typedef struct aout_symbol_table +{ + unsigned long tabsize; + unsigned long strsize; + unsigned long addr; + unsigned long reserved; +} aout_symbol_table_t; + +/* The section header table for ELF. */ +typedef struct elf_section_header_table +{ + unsigned long num; + unsigned long size; + unsigned long addr; + unsigned long shndx; +} elf_section_header_table_t; + +/* The Multiboot information. */ +typedef struct multiboot_info +{ + unsigned long flags; + unsigned long mem_lower; + unsigned long mem_upper; + unsigned long boot_device; + unsigned long cmdline; + unsigned long mods_count; + unsigned long mods_addr; + union + { + aout_symbol_table_t aout_sym; + elf_section_header_table_t elf_sec; + } u; + unsigned long mmap_length; + unsigned long mmap_addr; +} multiboot_info_t; + +/* The module structure. */ +typedef struct module +{ + unsigned long mod_start; + unsigned long mod_end; + unsigned long string; + unsigned long reserved; +} module_t; + +/* The memory map. Be careful that the offset 0 is base_addr_low + but no size. */ +typedef struct memory_map +{ + unsigned long size; + unsigned long base_addr_low; + unsigned long base_addr_high; + unsigned long length_low; + unsigned long length_high; + unsigned long type; +} memory_map_t; + +#endif /* ! ASM */ diff --git a/usr/src/grub/grub-0.97/docs/multiboot.h.texi b/usr/src/grub/grub-0.97/docs/multiboot.h.texi new file mode 100644 index 0000000000..3fa8c0b7cd --- /dev/null +++ b/usr/src/grub/grub-0.97/docs/multiboot.h.texi @@ -0,0 +1,119 @@ +/* @r{multiboot.h - the header for Multiboot} */ +/* @r{Copyright (C) 1999, 2001 Free Software Foundation, 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 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.} */ + +/* @r{Macros.} */ + +/* @r{The magic number for the Multiboot header.} */ +#define MULTIBOOT_HEADER_MAGIC 0x1BADB002 + +/* @r{The flags for the Multiboot header.} */ +#ifdef __ELF__ +# define MULTIBOOT_HEADER_FLAGS 0x00000003 +#else +# define MULTIBOOT_HEADER_FLAGS 0x00010003 +#endif + +/* @r{The magic number passed by a Multiboot-compliant boot loader.} */ +#define MULTIBOOT_BOOTLOADER_MAGIC 0x2BADB002 + +/* @r{The size of our stack (16KB).} */ +#define STACK_SIZE 0x4000 + +/* @r{C symbol format. HAVE_ASM_USCORE is defined by configure.} */ +#ifdef HAVE_ASM_USCORE +# define EXT_C(sym) _ ## sym +#else +# define EXT_C(sym) sym +#endif + +#ifndef ASM +/* @r{Do not include here in boot.S.} */ + +/* @r{Types.} */ + +/* @r{The Multiboot header.} */ +typedef struct multiboot_header +@{ + unsigned long magic; + unsigned long flags; + unsigned long checksum; + unsigned long header_addr; + unsigned long load_addr; + unsigned long load_end_addr; + unsigned long bss_end_addr; + unsigned long entry_addr; +@} multiboot_header_t; + +/* @r{The symbol table for a.out.} */ +typedef struct aout_symbol_table +@{ + unsigned long tabsize; + unsigned long strsize; + unsigned long addr; + unsigned long reserved; +@} aout_symbol_table_t; + +/* @r{The section header table for ELF.} */ +typedef struct elf_section_header_table +@{ + unsigned long num; + unsigned long size; + unsigned long addr; + unsigned long shndx; +@} elf_section_header_table_t; + +/* @r{The Multiboot information.} */ +typedef struct multiboot_info +@{ + unsigned long flags; + unsigned long mem_lower; + unsigned long mem_upper; + unsigned long boot_device; + unsigned long cmdline; + unsigned long mods_count; + unsigned long mods_addr; + union + @{ + aout_symbol_table_t aout_sym; + elf_section_header_table_t elf_sec; + @} u; + unsigned long mmap_length; + unsigned long mmap_addr; +@} multiboot_info_t; + +/* @r{The module structure.} */ +typedef struct module +@{ + unsigned long mod_start; + unsigned long mod_end; + unsigned long string; + unsigned long reserved; +@} module_t; + +/* @r{The memory map. Be careful that the offset 0 is base_addr_low + but no size.} */ +typedef struct memory_map +@{ + unsigned long size; + unsigned long base_addr_low; + unsigned long base_addr_high; + unsigned long length_low; + unsigned long length_high; + unsigned long type; +@} memory_map_t; + +#endif /* @r{! ASM} */ diff --git a/usr/src/grub/grub-0.97/docs/multiboot.info b/usr/src/grub/grub-0.97/docs/multiboot.info new file mode 100644 index 0000000000..cb6009c09b --- /dev/null +++ b/usr/src/grub/grub-0.97/docs/multiboot.info @@ -0,0 +1,1662 @@ +This is ../../docs/multiboot.info, produced by makeinfo version 4.7 +from ../../docs/multiboot.texi. + +INFO-DIR-SECTION Kernel +START-INFO-DIR-ENTRY +* Multiboot Specification: (multiboot). Multiboot Specification. +END-INFO-DIR-ENTRY + + Copyright (C) 1995, 96 Bryan Ford Copyright (C) +1995, 96 Erich Stefan Boleyn Copyright (C) 1999, 2000, +2001, 2002 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: multiboot.info, Node: Top, Next: Overview, Up: (dir) + +Multiboot Specification +*********************** + +This file documents Multiboot Specification, the proposal for the boot +sequence standard. This edition documents version 0.6.93. + +* Menu: + +* Overview:: +* Terminology:: +* Specification:: +* Examples:: +* History:: +* Index:: + + +File: multiboot.info, Node: Overview, Next: Terminology, Prev: Top, Up: Top + +1 Introduction to Multiboot Specification +***************************************** + +This chapter describes some rough information on the Multiboot +Specification. Note that this is not a part of the specification itself. + +* Menu: + +* Motivation:: +* Architecture:: +* Operating systems:: +* Boot sources:: +* Boot-time configuration:: +* Convenience to operating systems:: +* Boot modules:: + + +File: multiboot.info, Node: Motivation, Next: Architecture, Up: Overview + +1.1 The background of Multiboot Specification +============================================= + +Every operating system ever created tends to have its own boot loader. +Installing a new operating system on a machine generally involves +installing a whole new set of boot mechanisms, each with completely +different install-time and boot-time user interfaces. Getting multiple +operating systems to coexist reliably on one machine through typical +"chaining" mechanisms can be a nightmare. There is little or no choice +of boot loaders for a particular operating system -- if the one that +comes with the operating system doesn't do exactly what you want, or +doesn't work on your machine, you're screwed. + + While we may not be able to fix this problem in existing commercial +operating systems, it shouldn't be too difficult for a few people in the +free operating system communities to put their heads together and solve +this problem for the popular free operating systems. That's what this +specification aims for. Basically, it specifies an interface between a +boot loader and a operating system, such that any complying boot loader +should be able to load any complying operating system. This +specification does _not_ specify how boot loaders should work -- only +how they must interface with the operating system being loaded. + + +File: multiboot.info, Node: Architecture, Next: Operating systems, Prev: Motivation, Up: Overview + +1.2 The target architecture +=========================== + +This specification is primarily targeted at PC, since they are the most +common and have the largest variety of operating systems and boot +loaders. However, to the extent that certain other architectures may +need a boot specification and do not have one already, a variation of +this specification, stripped of the x86-specific details, could be +adopted for them as well. + + +File: multiboot.info, Node: Operating systems, Next: Boot sources, Prev: Architecture, Up: Overview + +1.3 The target operating systems +================================ + +This specification is targeted toward free 32-bit operating systems +that can be fairly easily modified to support the specification without +going through lots of bureaucratic rigmarole. The particular free +operating systems that this specification is being primarily designed +for are Linux, FreeBSD, NetBSD, Mach, and VSTa. It is hoped that other +emerging free operating systems will adopt it from the start, and thus +immediately be able to take advantage of existing boot loaders. It would +be nice if commercial operating system vendors eventually adopted this +specification as well, but that's probably a pipe dream. + + +File: multiboot.info, Node: Boot sources, Next: Boot-time configuration, Prev: Operating systems, Up: Overview + +1.4 Boot sources +================ + +It should be possible to write compliant boot loaders that load the OS +image from a variety of sources, including floppy disk, hard disk, and +across a network. + + Disk-based boot loaders may use a variety of techniques to find the +relevant OS image and boot module data on disk, such as by +interpretation of specific file systems (e.g. the BSD/Mach boot loader), +using precalculated "block lists" (e.g. LILO), loading from a special +"boot partition" (e.g. OS/2), or even loading from within another +operating system (e.g. the VSTa boot code, which loads from DOS). +Similarly, network-based boot loaders could use a variety of network +hardware and protocols. + + It is hoped that boot loaders will be created that support multiple +loading mechanisms, increasing their portability, robustness, and +user-friendliness. + + +File: multiboot.info, Node: Boot-time configuration, Next: Convenience to operating systems, Prev: Boot sources, Up: Overview + +1.5 Configure an operating system at boot-time +============================================== + +It is often necessary for one reason or another for the user to be able +to provide some configuration information to an operating system +dynamically at boot time. While this specification should not dictate +how this configuration information is obtained by the boot loader, it +should provide a standard means for the boot loader to pass such +information to the operating system. + + +File: multiboot.info, Node: Convenience to operating systems, Next: Boot modules, Prev: Boot-time configuration, Up: Overview + +1.6 How to make OS development easier +===================================== + +OS images should be easy to generate. Ideally, an OS image should simply +be an ordinary 32-bit executable file in whatever file format the +operating system normally uses. It should be possible to `nm' or +disassemble OS images just like normal executables. Specialized tools +should not be required to create OS images in a _special_ file format. +If this means shifting some work from the operating system to a boot +loader, that is probably appropriate, because all the memory consumed +by the boot loader will typically be made available again after the +boot process is created, whereas every bit of code in the OS image +typically has to remain in memory forever. The operating system should +not have to worry about getting into 32-bit mode initially, because mode +switching code generally needs to be in the boot loader anyway in order +to load operating system data above the 1MB boundary, and forcing the +operating system to do this makes creation of OS images much more +difficult. + + Unfortunately, there is a horrendous variety of executable file +formats even among free Unix-like PC-based operating systems -- +generally a different format for each operating system. Most of the +relevant free operating systems use some variant of a.out format, but +some are moving to ELF. It is highly desirable for boot loaders not to +have to be able to interpret all the different types of executable file +formats in existence in order to load the OS image -- otherwise the +boot loader effectively becomes operating system specific again. + + This specification adopts a compromise solution to this problem. +Multiboot-compliant OS images always contain a magic "Multiboot header" +(*note OS image format::), which allows the boot loader to load the +image without having to understand numerous a.out variants or other +executable formats. This magic header does not need to be at the very +beginning of the executable file, so kernel images can still conform to +the local a.out format variant in addition to being Multiboot-compliant. + + +File: multiboot.info, Node: Boot modules, Prev: Convenience to operating systems, Up: Overview + +1.7 Boot modules +================ + +Many modern operating system kernels, such as those of VSTa and Mach, do +not by themselves contain enough mechanism to get the system fully +operational: they require the presence of additional software modules at +boot time in order to access devices, mount file systems, etc. While +these additional modules could be embedded in the main OS image along +with the kernel itself, and the resulting image be split apart manually +by the operating system when it receives control, it is often more +flexible, more space-efficient, and more convenient to the operating +system and user if the boot loader can load these additional modules +independently in the first place. + + Thus, this specification should provide a standard method for a boot +loader to indicate to the operating system what auxiliary boot modules +were loaded, and where they can be found. Boot loaders don't have to +support multiple boot modules, but they are strongly encouraged to, +because some operating systems will be unable to boot without them. + + +File: multiboot.info, Node: Terminology, Next: Specification, Prev: Overview, Up: Top + +2 The definitions of terms used through the specification +********************************************************* + +"must" + We use the term "must", when any boot loader or OS image needs to + follow a rule -- otherwise, the boot loader or OS image is _not_ + Multiboot-compliant. + +"should" + We use the term "should", when any boot loader or OS image is + recommended to follow a rule, but it doesn't need to follow the + rule. + +"may" + We use the term "may", when any boot loader or OS image is allowed + to follow a rule. + +"boot loader" + Whatever program or set of programs loads the image of the final + operating system to be run on the machine. The boot loader may + itself consist of several stages, but that is an implementation + detail not relevant to this specification. Only the _final_ stage + of the boot loader -- the stage that eventually transfers control + to an operating system -- must follow the rules specified in this + document in order to be "Multiboot-compliant"; earlier boot loader + stages may be designed in whatever way is most convenient. + +"OS image" + The initial binary image that a boot loader loads into memory and + transfers control to start an operating system. The OS image is + typically an executable containing the operating system kernel. + +"boot module" + Other auxiliary files that a boot loader loads into memory along + with an OS image, but does not interpret in any way other than + passing their locations to the operating system when it is invoked. + +"Multiboot-compliant" + A boot loader or an OS image which follows the rules defined as + "must" is Multiboot-compliant. When this specification specifies a + rule as "should" or "may", a Multiboot-complaint boot loader/OS + image doesn't need to follow the rule. + +"u8" + The type of unsigned 8-bit data. + +"u16" + The type of unsigned 16-bit data. Because the target architecture + is little-endian, u16 is coded in little-endian. + +"u32" + The type of unsigned 32-bit data. Because the target architecture + is little-endian, u32 is coded in little-endian. + +"u64" + The type of unsigned 64-bit data. Because the target architecture + is little-endian, u64 is coded in little-endian. + + +File: multiboot.info, Node: Specification, Next: Examples, Prev: Terminology, Up: Top + +3 The exact definitions of Multiboot Specification +************************************************** + +There are three main aspects of a boot loader/OS image interface: + + 1. The format of an OS image as seen by a boot loader. + + 2. The state of a machine when a boot loader starts an operating + system. + + 3. The format of information passed by a boot loader to an operating + system. + +* Menu: + +* OS image format:: +* Machine state:: +* Boot information format:: + + +File: multiboot.info, Node: OS image format, Next: Machine state, Up: Specification + +3.1 OS image format +=================== + +An OS image may be an ordinary 32-bit executable file in the standard +format for that particular operating system, except that it may be +linked at a non-default load address to avoid loading on top of the +PC's I/O region or other reserved areas, and of course it should not +use shared libraries or other fancy features. + + An OS image must contain an additional header called "Multiboot +header", besides the headers of the format used by the OS image. The +Multiboot header must be contained completely within the first 8192 +bytes of the OS image, and must be longword (32-bit) aligned. In +general, it should come _as early as possible_, and may be embedded in +the beginning of the text segment after the _real_ executable header. + +* Menu: + +* Header layout:: The layout of Multiboot header +* Header magic fields:: The magic fields of Multiboot header +* Header address fields:: +* Header graphics fields:: + + +File: multiboot.info, Node: Header layout, Next: Header magic fields, Up: OS image format + +3.1.1 The layout of Multiboot header +------------------------------------ + +The layout of the Multiboot header must be as follows: + +Offset Type Field Name Note +0 u32 magic required +4 u32 flags required +8 u32 checksum required +12 u32 header_addr if flags[16] is set +16 u32 load_addr if flags[16] is set +20 u32 load_end_addr if flags[16] is set +24 u32 bss_end_addr if flags[16] is set +28 u32 entry_addr if flags[16] is set +32 u32 mode_type if flags[2] is set +36 u32 width if flags[2] is set +40 u32 height if flags[2] is set +44 u32 depth if flags[2] is set + + The fields `magic', `flags' and `checksum' are defined in *Note +Header magic fields::, the fields `header_addr', `load_addr', +`load_end_addr', `bss_end_addr' and `entry_addr' are defined in *Note +Header address fields::, and the fields `mode_type', `width', `height' +and `depth' are defind in *Note Header graphics fields::. + + +File: multiboot.info, Node: Header magic fields, Next: Header address fields, Prev: Header layout, Up: OS image format + +3.1.2 The magic fields of Multiboot header +------------------------------------------ + +`magic' + The field `magic' is the magic number identifying the header, + which must be the hexadecimal value `0x1BADB002'. + +`flags' + The field `flags' specifies features that the OS image requests or + requires of an boot loader. Bits 0-15 indicate requirements; if the + boot loader sees any of these bits set but doesn't understand the + flag or can't fulfill the requirements it indicates for some + reason, it must notify the user and fail to load the OS image. + Bits 16-31 indicate optional features; if any bits in this range + are set but the boot loader doesn't understand them, it may simply + ignore them and proceed as usual. Naturally, all as-yet-undefined + bits in the `flags' word must be set to zero in OS images. This + way, the `flags' fields serves for version control as well as + simple feature selection. + + If bit 0 in the `flags' word is set, then all boot modules loaded + along with the operating system must be aligned on page (4KB) + boundaries. Some operating systems expect to be able to map the + pages containing boot modules directly into a paged address space + during startup, and thus need the boot modules to be page-aligned. + + If bit 1 in the `flags' word is set, then information on available + memory via at least the `mem_*' fields of the Multiboot information + structure (*note Boot information format::) must be included. If + the boot loader is capable of passing a memory map (the `mmap_*' + fields) and one exists, then it may be included as well. + + If bit 2 in the `flags' word is set, information about the video + mode table (*note Boot information format::) must be available to + the kernel. + + If bit 16 in the `flags' word is set, then the fields at offsets + 8-24 in the Multiboot header are valid, and the boot loader should + use them instead of the fields in the actual executable header to + calculate where to load the OS image. This information does not + need to be provided if the kernel image is in ELF format, but it + _must_ be provided if the images is in a.out format or in some + other format. Compliant boot loaders must be able to load images + that either are in ELF format or contain the load address + information embedded in the Multiboot header; they may also + directly support other executable formats, such as particular + a.out variants, but are not required to. + +`checksum' + The field `checksum' is a 32-bit unsigned value which, when added + to the other magic fields (i.e. `magic' and `flags'), must have a + 32-bit unsigned sum of zero. + + +File: multiboot.info, Node: Header address fields, Next: Header graphics fields, Prev: Header magic fields, Up: OS image format + +3.1.3 The address fields of Multiboot header +-------------------------------------------- + +All of the address fields enabled by flag bit 16 are physical addresses. +The meaning of each is as follows: + +`header_addr' + Contains the address corresponding to the beginning of the + Multiboot header -- the physical memory location at which the + magic value is supposed to be loaded. This field serves to + "synchronize" the mapping between OS image offsets and physical + memory addresses. + +`load_addr' + Contains the physical address of the beginning of the text + segment. The offset in the OS image file at which to start loading + is defined by the offset at which the header was found, minus + (header_addr - load_addr). load_addr must be less than or equal to + header_addr. + +`load_end_addr' + Contains the physical address of the end of the data segment. + (load_end_addr - load_addr) specifies how much data to load. This + implies that the text and data segments must be consecutive in the + OS image; this is true for existing a.out executable formats. If + this field is zero, the boot loader assumes that the text and data + segments occupy the whole OS image file. + +`bss_end_addr' + Contains the physical address of the end of the bss segment. The + boot loader initializes this area to zero, and reserves the memory + it occupies to avoid placing boot modules and other data relevant + to the operating system in that area. If this field is zero, the + boot loader assumes that no bss segment is present. + +`entry_addr' + The physical address to which the boot loader should jump in order + to start running the operating system. + + +File: multiboot.info, Node: Header graphics fields, Prev: Header address fields, Up: OS image format + +3.1.4 The graphics fields of Multiboot header +--------------------------------------------- + +All of the graphics fields are enabled by flag bit 2. They specify the +preferred graphics mode. Note that that is only a _recommended_ mode by +the OS image. If the mode exists, the boot loader should set it, when +the user doesn't specify a mode explicitly. Otherwise, the boot loader +should fall back to a similar mode, if available. + + The meaning of each is as follows: + +`mode_type' + Contains `0' for linear graphics mode or `1' for EGA-standard text + mode. Everything else is reserved for future expansion. Note that + the boot loader may set a text mode, even if this field contains + `0'. + +`width' + Contains the number of the columns. This is specified in pixels in + a graphics mode, and in characters in a text mode. The value zero + indicates that the OS image has no preference. + +`height' + Contains the number of the lines. This is specified in pixels in a + graphics mode, and in characters in a text mode. The value zero + indicates that the OS image has no preference. + +`depth' + Contains the number of bits per pixel in a graphics mode, and zero + in a text mode. The value zero indicates that the OS image has no + preference. + + +File: multiboot.info, Node: Machine state, Next: Boot information format, Prev: OS image format, Up: Specification + +3.2 Machine state +================= + +When the boot loader invokes the 32-bit operating system, the machine +must have the following state: + +`EAX' + Must contain the magic value `0x2BADB002'; the presence of this + value indicates to the operating system that it was loaded by a + Multiboot-compliant boot loader (e.g. as opposed to another type of + boot loader that the operating system can also be loaded from). + +`EBX' + Must contain the 32-bit physical address of the Multiboot + information structure provided by the boot loader (*note Boot + information format::). + +`CS' + Must be a 32-bit read/execute code segment with an offset of `0' + and a limit of `0xFFFFFFFF'. The exact value is undefined. + +`DS' +`ES' +`FS' +`GS' +`SS' + Must be a 32-bit read/write data segment with an offset of `0' and + a limit of `0xFFFFFFFF'. The exact values are all undefined. + +`A20 gate' + Must be enabled. + +`CR0' + Bit 31 (PG) must be cleared. Bit 0 (PE) must be set. Other bits are + all undefined. + +`EFLAGS' + Bit 17 (VM) must be cleared. Bit 9 (IF) must be cleared. Other bits + are all undefined. + + All other processor registers and flag bits are undefined. This +includes, in particular: + +`ESP' + The OS image must create its own stack as soon as it needs one. + +`GDTR' + Even though the segment registers are set up as described above, + the `GDTR' may be invalid, so the OS image must not load any + segment registers (even just reloading the same values!) until it + sets up its own `GDT'. + +`IDTR' + The OS image must leave interrupts disabled until it sets up its + own `IDT'. + + However, other machine state should be left by the boot loader in +"normal working order", i.e. as initialized by the BIOS (or DOS, if +that's what the boot loader runs from). In other words, the operating +system should be able to make BIOS calls and such after being loaded, +as long as it does not overwrite the BIOS data structures before doing +so. Also, the boot loader must leave the PIC programmed with the normal +BIOS/DOS values, even if it changed them during the switch to 32-bit +mode. + + +File: multiboot.info, Node: Boot information format, Prev: Machine state, Up: Specification + +3.3 Boot information format +=========================== + +FIXME: Split this chapter like the chapter "OS image format". + + Upon entry to the operating system, the `EBX' register contains the +physical address of a "Multiboot information" data structure, through +which the boot loader communicates vital information to the operating +system. The operating system can use or ignore any parts of the +structure as it chooses; all information passed by the boot loader is +advisory only. + + The Multiboot information structure and its related substructures +may be placed anywhere in memory by the boot loader (with the exception +of the memory reserved for the kernel and boot modules, of course). It +is the operating system's responsibility to avoid overwriting this +memory until it is done using it. + + The format of the Multiboot information structure (as defined so far) +follows: + + +-------------------+ + 0 | flags | (required) + +-------------------+ + 4 | mem_lower | (present if flags[0] is set) + 8 | mem_upper | (present if flags[0] is set) + +-------------------+ + 12 | boot_device | (present if flags[1] is set) + +-------------------+ + 16 | cmdline | (present if flags[2] is set) + +-------------------+ + 20 | mods_count | (present if flags[3] is set) + 24 | mods_addr | (present if flags[3] is set) + +-------------------+ + 28 - 40 | syms | (present if flags[4] or + | | flags[5] is set) + +-------------------+ + 44 | mmap_length | (present if flags[6] is set) + 48 | mmap_addr | (present if flags[6] is set) + +-------------------+ + 52 | drives_length | (present if flags[7] is set) + 56 | drives_addr | (present if flags[7] is set) + +-------------------+ + 60 | config_table | (present if flags[8] is set) + +-------------------+ + 64 | boot_loader_name | (present if flags[9] is set) + +-------------------+ + 68 | apm_table | (present if flags[10] is set) + +-------------------+ + 72 | vbe_control_info | (present if flags[11] is set) + 76 | vbe_mode_info | + 80 | vbe_mode | + 82 | vbe_interface_seg | + 84 | vbe_interface_off | + 86 | vbe_interface_len | + +-------------------+ + + The first longword indicates the presence and validity of other +fields in the Multiboot information structure. All as-yet-undefined +bits must be set to zero by the boot loader. Any set bits that the +operating system does not understand should be ignored. Thus, the +`flags' field also functions as a version indicator, allowing the +Multiboot information structure to be expanded in the future without +breaking anything. + + If bit 0 in the `flags' word is set, then the `mem_*' fields are +valid. `mem_lower' and `mem_upper' indicate the amount of lower and +upper memory, respectively, in kilobytes. Lower memory starts at +address 0, and upper memory starts at address 1 megabyte. The maximum +possible value for lower memory is 640 kilobytes. The value returned for +upper memory is maximally the address of the first upper memory hole +minus 1 megabyte. It is not guaranteed to be this value. + + If bit 1 in the `flags' word is set, then the `boot_device' field is +valid, and indicates which BIOS disk device the boot loader loaded the +OS image from. If the OS image was not loaded from a BIOS disk, then +this field must not be present (bit 3 must be clear). The operating +system may use this field as a hint for determining its own "root" +device, but is not required to. The `boot_device' field is laid out in +four one-byte subfields as follows: + + +-------+-------+-------+-------+ + | drive | part1 | part2 | part3 | + +-------+-------+-------+-------+ + + The first byte contains the BIOS drive number as understood by the +BIOS INT 0x13 low-level disk interface: e.g. 0x00 for the first floppy +disk or 0x80 for the first hard disk. + + The three remaining bytes specify the boot partition. `part1' +specifies the "top-level" partition number, `part2' specifies a +"sub-partition" in the top-level partition, etc. Partition numbers +always start from zero. Unused partition bytes must be set to 0xFF. For +example, if the disk is partitioned using a simple one-level DOS +partitioning scheme, then `part1' contains the DOS partition number, +and `part2' and `part3' are both 0xFF. As another example, if a disk is +partitioned first into DOS partitions, and then one of those DOS +partitions is subdivided into several BSD partitions using BSD's +"disklabel" strategy, then `part1' contains the DOS partition number, +`part2' contains the BSD sub-partition within that DOS partition, and +`part3' is 0xFF. + + DOS extended partitions are indicated as partition numbers starting +from 4 and increasing, rather than as nested sub-partitions, even +though the underlying disk layout of extended partitions is +hierarchical in nature. For example, if the boot loader boots from the +second extended partition on a disk partitioned in conventional DOS +style, then `part1' will be 5, and `part2' and `part3' will both be +0xFF. + + If bit 2 of the `flags' longword is set, the `cmdline' field is +valid, and contains the physical address of the command line to be +passed to the kernel. The command line is a normal C-style +zero-terminated string. + + If bit 3 of the `flags' is set, then the `mods' fields indicate to +the kernel what boot modules were loaded along with the kernel image, +and where they can be found. `mods_count' contains the number of +modules loaded; `mods_addr' contains the physical address of the first +module structure. `mods_count' may be zero, indicating no boot modules +were loaded, even if bit 1 of `flags' is set. Each module structure is +formatted as follows: + + +-------------------+ + 0 | mod_start | + 4 | mod_end | + +-------------------+ + 8 | string | + +-------------------+ + 12 | reserved (0) | + +-------------------+ + + The first two fields contain the start and end addresses of the boot +module itself. The `string' field provides an arbitrary string to be +associated with that particular boot module; it is a zero-terminated +ASCII string, just like the kernel command line. The `string' field may +be 0 if there is no string associated with the module. Typically the +string might be a command line (e.g. if the operating system treats boot +modules as executable programs), or a pathname (e.g. if the operating +system treats boot modules as files in a file system), but its exact use +is specific to the operating system. The `reserved' field must be set +to 0 by the boot loader and ignored by the operating system. + + *Caution:* Bits 4 & 5 are mutually exclusive. + + If bit 4 in the `flags' word is set, then the following fields in +the Multiboot information structure starting at byte 28 are valid: + + +-------------------+ + 28 | tabsize | + 32 | strsize | + 36 | addr | + 40 | reserved (0) | + +-------------------+ + + These indicate where the symbol table from an a.out kernel image can +be found. `addr' is the physical address of the size (4-byte unsigned +long) of an array of a.out format "nlist" structures, followed +immediately by the array itself, then the size (4-byte unsigned long) of +a set of zero-terminated ASCII strings (plus sizeof(unsigned long) in +this case), and finally the set of strings itself. `tabsize' is equal +to its size parameter (found at the beginning of the symbol section), +and `strsize' is equal to its size parameter (found at the beginning of +the string section) of the following string table to which the symbol +table refers. Note that `tabsize' may be 0, indicating no symbols, even +if bit 4 in the `flags' word is set. + + If bit 5 in the `flags' word is set, then the following fields in +the Multiboot information structure starting at byte 28 are valid: + + +-------------------+ + 28 | num | + 32 | size | + 36 | addr | + 40 | shndx | + +-------------------+ + + These indicate where the section header table from an ELF kernel is, +the size of each entry, number of entries, and the string table used as +the index of names. They correspond to the `shdr_*' entries +(`shdr_num', etc.) in the Executable and Linkable Format (ELF) +specification in the program header. All sections are loaded, and the +physical address fields of the ELF section header then refer to where +the sections are in memory (refer to the i386 ELF documentation for +details as to how to read the section header(s)). Note that `shdr_num' +may be 0, indicating no symbols, even if bit 5 in the `flags' word is +set. + + If bit 6 in the `flags' word is set, then the `mmap_*' fields are +valid, and indicate the address and length of a buffer containing a +memory map of the machine provided by the BIOS. `mmap_addr' is the +address, and `mmap_length' is the total size of the buffer. The buffer +consists of one or more of the following size/structure pairs (`size' +is really used for skipping to the next pair): + + +-------------------+ + -4 | size | + +-------------------+ + 0 | base_addr_low | + 4 | base_addr_high | + 8 | length_low | + 12 | length_high | + 16 | type | + +-------------------+ + + where `size' is the size of the associated structure in bytes, which +can be greater than the minimum of 20 bytes. `base_addr_low' is the +lower 32 bits of the starting address, and `base_addr_high' is the +upper 32 bits, for a total of a 64-bit starting address. `length_low' +is the lower 32 bits of the size of the memory region in bytes, and +`length_high' is the upper 32 bits, for a total of a 64-bit length. +`type' is the variety of address range represented, where a value of 1 +indicates available RAM, and all other values currently indicated a +reserved area. + + The map provided is guaranteed to list all standard RAM that should +be available for normal use. + + If bit 7 in the `flags' is set, then the `drives_*' fields are +valid, and indicate the address of the physical address of the first +drive structure and the size of drive structures. `drives_addr' is the +address, and `drives_length' is the total size of drive structures. +Note that `drives_length' may be zero. Each drive structure is +formatted as follows: + + +-------------------+ + 0 | size | + +-------------------+ + 4 | drive_number | + +-------------------+ + 5 | drive_mode | + +-------------------+ + 6 | drive_cylinders | + 8 | drive_heads | + 9 | drive_sectors | + +-------------------+ + 10 - xx | drive_ports | + +-------------------+ + + The `size' field specifies the size of this structure. The size +varies, depending on the number of ports. Note that the size may not be +equal to (10 + 2 * the number of ports), because of an alignment. + + The `drive_number' field contains the BIOS drive number. The +`drive_mode' field represents the access mode used by the boot loader. +Currently, the following modes are defined: + +`0' + CHS mode (traditional cylinder/head/sector addressing mode). + +`1' + LBA mode (Logical Block Addressing mode). + + The three fields, `drive_cylinders', `drive_heads' and +`drive_sectors', indicate the geometry of the drive detected by the +BIOS. `drive_cylinders' contains the number of the cylinders. +`drive_heads' contains the number of the heads. `drive_sectors' +contains the number of the sectors per track. + + The `drive_ports' field contains the array of the I/O ports used for +the drive in the BIOS code. The array consists of zero or more unsigned +two-bytes integers, and is terminated with zero. Note that the array +may contain any number of I/O ports that are not related to the drive +actually (such as DMA controller's ports). + + If bit 8 in the `flags' is set, then the `config_table' field is +valid, and indicates the address of the ROM configuration table +returned by the "GET CONFIGURATION" BIOS call. If the BIOS call fails, +then the size of the table must be _zero_. + + If bit 9 in the `flags' is set, the `boot_loader_name' field is +valid, and contains the physical address of the name of a boot loader +booting the kernel. The name is a normal C-style zero-terminated string. + + If bit 10 in the `flags' is set, the `apm_table' field is valid, and +contains the physical address of an APM table defined as below: + + +----------------------+ + 0 | version | + 2 | cseg | + 4 | offset | + 8 | cseg_16 | + 10 | dseg | + 12 | flags | + 14 | cseg_len | + 16 | cseg_16_len | + 18 | dseg_len | + +----------------------+ + + The fields `version', `cseg', `offset', `cseg_16', `dseg', `flags', +`cseg_len', `cseg_16_len', `dseg_len' indicate the version number, the +protected mode 32-bit code segment, the offset of the entry point, the +protected mode 16-bit code segment, the protected mode 16-bit data +segment, the flags, the length of the protected mode 32-bit code +segment, the length of the protected mode 16-bit code segment, and the +length of the protected mode 16-bit data segment, respectively. Only +the field `offset' is 4 bytes, and the others are 2 bytes. See Advanced +Power Management (APM) BIOS Interface Specification +(http://www.microsoft.com/hwdev/busbios/amp_12.htm), for more +information. + + If bit 11 in the `flags' is set, the graphics table is available. +This must only be done if the kernel has indicated in the `Multiboot +Header' that it accepts a graphics mode. + + The fields `vbe_control_info' and `vbe_mode_info' contain the +physical addresses of VBE control information returned by the VBE +Function 00h and VBE mode information returned by the VBE Function 01h, +respectively. + + The field `vbe_mode' indicates current video mode in the format +specified in VBE 3.0. + + The rest fields `vbe_interface_seg', `vbe_interface_off', and +`vbe_interface_len' contain the table of a protected mode interface +defined in VBE 2.0+. If this information is not available, those fields +contain zero. Note that VBE 3.0 defines another protected mode +interface which is incompatible with the old one. If you want to use +the new protected mode interface, you will have to find the table +yourself. + + The fields for the graphics table are designed for VBE, but +Multiboot boot loaders may simulate VBE on non-VBE modes, as if they +were VBE modes. + + +File: multiboot.info, Node: Examples, Next: History, Prev: Specification, Up: Top + +4 Examples +********** + +*Caution:* The following items are not part of the specification +document, but are included for prospective operating system and boot +loader writers. + +* Menu: + +* Notes on PC:: +* BIOS device mapping techniques:: +* Example OS code:: +* Example boot loader code:: + + +File: multiboot.info, Node: Notes on PC, Next: BIOS device mapping techniques, Up: Examples + +4.1 Notes on PC +=============== + +In reference to bit 0 of the `flags' parameter in the Multiboot +information structure, if the bootloader in question uses older BIOS +interfaces, or the newest ones are not available (see description about +bit 6), then a maximum of either 15 or 63 megabytes of memory may be +reported. It is _highly_ recommended that boot loaders perform a +thorough memory probe. + + In reference to bit 1 of the `flags' parameter in the Multiboot +information structure, it is recognized that determination of which +BIOS drive maps to which device driver in an operating system is +non-trivial, at best. Many kludges have been made to various operating +systems instead of solving this problem, most of them breaking under +many conditions. To encourage the use of general-purpose solutions to +this problem, there are 2 BIOS device mapping techniques (*note BIOS +device mapping techniques::). + + In reference to bit 6 of the `flags' parameter in the Multiboot +information structure, it is important to note that the data structure +used there (starting with `BaseAddrLow') is the data returned by the +INT 15h, AX=E820h -- Query System Address Map call. See *Note Query +System Address Map: (grub.info)Query System Address Map, for more +information. The interface here is meant to allow a boot loader to work +unmodified with any reasonable extensions of the BIOS interface, +passing along any extra data to be interpreted by the operating system +as desired. + + +File: multiboot.info, Node: BIOS device mapping techniques, Next: Example OS code, Prev: Notes on PC, Up: Examples + +4.2 BIOS device mapping techniques +================================== + +Both of these techniques should be usable from any PC operating system, +and neither require any special support in the drivers themselves. This +section will be flushed out into detailed explanations, particularly for +the I/O restriction technique. + + The general rule is that the data comparison technique is the quick +and dirty solution. It works most of the time, but doesn't cover all the +bases, and is relatively simple. + + The I/O restriction technique is much more complex, but it has +potential to solve the problem under all conditions, plus allow access +of the remaining BIOS devices when not all of them have operating system +drivers. + +* Menu: + +* Data comparison technique:: +* I/O restriction technique:: + + +File: multiboot.info, Node: Data comparison technique, Next: I/O restriction technique, Up: BIOS device mapping techniques + +4.2.1 Data comparison technique +------------------------------- + +Before activating _any_ of the device drivers, gather enough data from +similar sectors on each of the disks such that each one can be uniquely +identified. + + After activating the device drivers, compare data from the drives +using the operating system drivers. This should hopefully be sufficient +to provide such a mapping. + + Problems: + + 1. The data on some BIOS devices might be identical (so the part + reading the drives from the BIOS should have some mechanism to give + up). + + 2. There might be extra drives not accessible from the BIOS which are + identical to some drive used by the BIOS (so it should be capable + of giving up there as well). + + +File: multiboot.info, Node: I/O restriction technique, Prev: Data comparison technique, Up: BIOS device mapping techniques + +4.2.2 I/O restriction technique +------------------------------- + +This first step may be unnecessary, but first create copy-on-write +mappings for the device drivers writing into PC RAM. Keep the original +copies for the "clean BIOS virtual machine" to be created later. + + For each device driver brought online, determine which BIOS devices +become inaccessible by: + + 1. Create a "clean BIOS virtual machine". + + 2. Set the I/O permission map for the I/O area claimed by the device + driver to no permissions (neither read nor write). + + 3. Access each device. + + 4. Record which devices succeed, and those which try to access the + "restricted" I/O areas (hopefully, this will be an "xor" + situation). + + For each device driver, given how many of the BIOS devices were +subsumed by it (there should be no gaps in this list), it should be easy +to determine which devices on the controller these are. + + In general, you have at most 2 disks from each controller given BIOS +numbers, but they pretty much always count from the lowest logically +numbered devices on the controller. + + +File: multiboot.info, Node: Example OS code, Next: Example boot loader code, Prev: BIOS device mapping techniques, Up: Examples + +4.3 Example OS code +=================== + +In this distribution, the example Multiboot kernel `kernel' is +included. The kernel just prints out the Multiboot information structure +on the screen, so you can make use of the kernel to test a +Multiboot-compliant boot loader and for reference to how to implement a +Multiboot kernel. The source files can be found under the directory +`docs' in the GRUB distribution. + + The kernel `kernel' consists of only three files: `boot.S', +`kernel.c' and `multiboot.h'. The assembly source `boot.S' is written +in GAS (*note GNU assembler: (as.info)Top.), and contains the Multiboot +information structure to comply with the specification. When a +Multiboot-compliant boot loader loads and execute it, it initialize the +stack pointer and `EFLAGS', and then call the function `cmain' defined +in `kernel.c'. If `cmain' returns to the callee, then it shows a +message to inform the user of the halt state and stops forever until +you push the reset key. The file `kernel.c' contains the function +`cmain', which checks if the magic number passed by the boot loader is +valid and so on, and some functions to print messages on the screen. +The file `multiboot.h' defines some macros, such as the magic number +for the Multiboot header, the Multiboot header structure and the +Multiboot information structure. + +* Menu: + +* multiboot.h:: +* boot.S:: +* kernel.c:: +* Other Multiboot kernels:: + + +File: multiboot.info, Node: multiboot.h, Next: boot.S, Up: Example OS code + +4.3.1 multiboot.h +----------------- + +This is the source code in the file `multiboot.h': + + /* multiboot.h - the header for Multiboot */ + /* Copyright (C) 1999, 2001 Free Software Foundation, 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 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. */ + + /* Macros. */ + + /* The magic number for the Multiboot header. */ + #define MULTIBOOT_HEADER_MAGIC 0x1BADB002 + + /* The flags for the Multiboot header. */ + #ifdef __ELF__ + # define MULTIBOOT_HEADER_FLAGS 0x00000003 + #else + # define MULTIBOOT_HEADER_FLAGS 0x00010003 + #endif + + /* The magic number passed by a Multiboot-compliant boot loader. */ + #define MULTIBOOT_BOOTLOADER_MAGIC 0x2BADB002 + + /* The size of our stack (16KB). */ + #define STACK_SIZE 0x4000 + + /* C symbol format. HAVE_ASM_USCORE is defined by configure. */ + #ifdef HAVE_ASM_USCORE + # define EXT_C(sym) _ ## sym + #else + # define EXT_C(sym) sym + #endif + + #ifndef ASM + /* Do not include here in boot.S. */ + + /* Types. */ + + /* The Multiboot header. */ + typedef struct multiboot_header + { + unsigned long magic; + unsigned long flags; + unsigned long checksum; + unsigned long header_addr; + unsigned long load_addr; + unsigned long load_end_addr; + unsigned long bss_end_addr; + unsigned long entry_addr; + } multiboot_header_t; + + /* The symbol table for a.out. */ + typedef struct aout_symbol_table + { + unsigned long tabsize; + unsigned long strsize; + unsigned long addr; + unsigned long reserved; + } aout_symbol_table_t; + + /* The section header table for ELF. */ + typedef struct elf_section_header_table + { + unsigned long num; + unsigned long size; + unsigned long addr; + unsigned long shndx; + } elf_section_header_table_t; + + /* The Multiboot information. */ + typedef struct multiboot_info + { + unsigned long flags; + unsigned long mem_lower; + unsigned long mem_upper; + unsigned long boot_device; + unsigned long cmdline; + unsigned long mods_count; + unsigned long mods_addr; + union + { + aout_symbol_table_t aout_sym; + elf_section_header_table_t elf_sec; + } u; + unsigned long mmap_length; + unsigned long mmap_addr; + } multiboot_info_t; + + /* The module structure. */ + typedef struct module + { + unsigned long mod_start; + unsigned long mod_end; + unsigned long string; + unsigned long reserved; + } module_t; + + /* The memory map. Be careful that the offset 0 is base_addr_low + but no size. */ + typedef struct memory_map + { + unsigned long size; + unsigned long base_addr_low; + unsigned long base_addr_high; + unsigned long length_low; + unsigned long length_high; + unsigned long type; + } memory_map_t; + + #endif /* ! ASM */ + + +File: multiboot.info, Node: boot.S, Next: kernel.c, Prev: multiboot.h, Up: Example OS code + +4.3.2 boot.S +------------ + +In the file `boot.S': + + /* boot.S - bootstrap the kernel */ + /* Copyright (C) 1999, 2001 Free Software Foundation, 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 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. */ + + #define ASM 1 + #include + + .text + + .globl start, _start + start: + _start: + jmp multiboot_entry + + /* Align 32 bits boundary. */ + .align 4 + + /* Multiboot header. */ + multiboot_header: + /* magic */ + .long MULTIBOOT_HEADER_MAGIC + /* flags */ + .long MULTIBOOT_HEADER_FLAGS + /* checksum */ + .long -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS) + #ifndef __ELF__ + /* header_addr */ + .long multiboot_header + /* load_addr */ + .long _start + /* load_end_addr */ + .long _edata + /* bss_end_addr */ + .long _end + /* entry_addr */ + .long multiboot_entry + #endif /* ! __ELF__ */ + + multiboot_entry: + /* Initialize the stack pointer. */ + movl $(stack + STACK_SIZE), %esp + + /* Reset EFLAGS. */ + pushl $0 + popf + + /* Push the pointer to the Multiboot information structure. */ + pushl %ebx + /* Push the magic value. */ + pushl %eax + + /* Now enter the C main function... */ + call EXT_C(cmain) + + /* Halt. */ + pushl $halt_message + call EXT_C(printf) + + loop: hlt + jmp loop + + halt_message: + .asciz "Halted." + + /* Our stack area. */ + .comm stack, STACK_SIZE + + +File: multiboot.info, Node: kernel.c, Next: Other Multiboot kernels, Prev: boot.S, Up: Example OS code + +4.3.3 kernel.c +-------------- + +And, in the file `kernel.c': + + /* kernel.c - the C part of the kernel */ + /* Copyright (C) 1999 Free Software Foundation, 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 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 + + /* Macros. */ + + /* Check if the bit BIT in FLAGS is set. */ + #define CHECK_FLAG(flags,bit) ((flags) & (1 << (bit))) + + /* Some screen stuff. */ + /* The number of columns. */ + #define COLUMNS 80 + /* The number of lines. */ + #define LINES 24 + /* The attribute of an character. */ + #define ATTRIBUTE 7 + /* The video memory address. */ + #define VIDEO 0xB8000 + + /* Variables. */ + /* Save the X position. */ + static int xpos; + /* Save the Y position. */ + static int ypos; + /* Point to the video memory. */ + static volatile unsigned char *video; + + /* Forward declarations. */ + void cmain (unsigned long magic, unsigned long addr); + static void cls (void); + static void itoa (char *buf, int base, int d); + static void putchar (int c); + void printf (const char *format, ...); + + /* Check if MAGIC is valid and print the Multiboot information structure + pointed by ADDR. */ + void + cmain (unsigned long magic, unsigned long addr) + { + multiboot_info_t *mbi; + + /* Clear the screen. */ + cls (); + + /* Am I booted by a Multiboot-compliant boot loader? */ + if (magic != MULTIBOOT_BOOTLOADER_MAGIC) + { + printf ("Invalid magic number: 0x%x\n", (unsigned) magic); + return; + } + + /* Set MBI to the address of the Multiboot information structure. */ + mbi = (multiboot_info_t *) addr; + + /* Print out the flags. */ + printf ("flags = 0x%x\n", (unsigned) mbi->flags); + + /* Are mem_* valid? */ + if (CHECK_FLAG (mbi->flags, 0)) + printf ("mem_lower = %uKB, mem_upper = %uKB\n", + (unsigned) mbi->mem_lower, (unsigned) mbi->mem_upper); + + /* Is boot_device valid? */ + if (CHECK_FLAG (mbi->flags, 1)) + printf ("boot_device = 0x%x\n", (unsigned) mbi->boot_device); + + /* Is the command line passed? */ + if (CHECK_FLAG (mbi->flags, 2)) + printf ("cmdline = %s\n", (char *) mbi->cmdline); + + /* Are mods_* valid? */ + if (CHECK_FLAG (mbi->flags, 3)) + { + module_t *mod; + int i; + + printf ("mods_count = %d, mods_addr = 0x%x\n", + (int) mbi->mods_count, (int) mbi->mods_addr); + for (i = 0, mod = (module_t *) mbi->mods_addr; + i < mbi->mods_count; + i++, mod++) + printf (" mod_start = 0x%x, mod_end = 0x%x, string = %s\n", + (unsigned) mod->mod_start, + (unsigned) mod->mod_end, + (char *) mod->string); + } + + /* Bits 4 and 5 are mutually exclusive! */ + if (CHECK_FLAG (mbi->flags, 4) && CHECK_FLAG (mbi->flags, 5)) + { + printf ("Both bits 4 and 5 are set.\n"); + return; + } + + /* Is the symbol table of a.out valid? */ + if (CHECK_FLAG (mbi->flags, 4)) + { + aout_symbol_table_t *aout_sym = &(mbi->u.aout_sym); + + printf ("aout_symbol_table: tabsize = 0x%0x, " + "strsize = 0x%x, addr = 0x%x\n", + (unsigned) aout_sym->tabsize, + (unsigned) aout_sym->strsize, + (unsigned) aout_sym->addr); + } + + /* Is the section header table of ELF valid? */ + if (CHECK_FLAG (mbi->flags, 5)) + { + elf_section_header_table_t *elf_sec = &(mbi->u.elf_sec); + + printf ("elf_sec: num = %u, size = 0x%x," + " addr = 0x%x, shndx = 0x%x\n", + (unsigned) elf_sec->num, (unsigned) elf_sec->size, + (unsigned) elf_sec->addr, (unsigned) elf_sec->shndx); + } + + /* Are mmap_* valid? */ + if (CHECK_FLAG (mbi->flags, 6)) + { + memory_map_t *mmap; + + printf ("mmap_addr = 0x%x, mmap_length = 0x%x\n", + (unsigned) mbi->mmap_addr, (unsigned) mbi->mmap_length); + for (mmap = (memory_map_t *) mbi->mmap_addr; + (unsigned long) mmap < mbi->mmap_addr + mbi->mmap_length; + mmap = (memory_map_t *) ((unsigned long) mmap + + mmap->size + sizeof (mmap->size))) + printf (" size = 0x%x, base_addr = 0x%x%x," + " length = 0x%x%x, type = 0x%x\n", + (unsigned) mmap->size, + (unsigned) mmap->base_addr_high, + (unsigned) mmap->base_addr_low, + (unsigned) mmap->length_high, + (unsigned) mmap->length_low, + (unsigned) mmap->type); + } + } + + /* Clear the screen and initialize VIDEO, XPOS and YPOS. */ + static void + cls (void) + { + int i; + + video = (unsigned char *) VIDEO; + + for (i = 0; i < COLUMNS * LINES * 2; i++) + *(video + i) = 0; + + xpos = 0; + ypos = 0; + } + + /* Convert the integer D to a string and save the string in BUF. If + BASE is equal to 'd', interpret that D is decimal, and if BASE is + equal to 'x', interpret that D is hexadecimal. */ + static void + itoa (char *buf, int base, int d) + { + char *p = buf; + char *p1, *p2; + unsigned long ud = d; + int divisor = 10; + + /* If %d is specified and D is minus, put `-' in the head. */ + if (base == 'd' && d < 0) + { + *p++ = '-'; + buf++; + ud = -d; + } + else if (base == 'x') + divisor = 16; + + /* Divide UD by DIVISOR until UD == 0. */ + do + { + int remainder = ud % divisor; + + *p++ = (remainder < 10) ? remainder + '0' : remainder + 'a' - 10; + } + while (ud /= divisor); + + /* Terminate BUF. */ + *p = 0; + + /* Reverse BUF. */ + p1 = buf; + p2 = p - 1; + while (p1 < p2) + { + char tmp = *p1; + *p1 = *p2; + *p2 = tmp; + p1++; + p2--; + } + } + + /* Put the character C on the screen. */ + static void + putchar (int c) + { + if (c == '\n' || c == '\r') + { + newline: + xpos = 0; + ypos++; + if (ypos >= LINES) + ypos = 0; + return; + } + + *(video + (xpos + ypos * COLUMNS) * 2) = c & 0xFF; + *(video + (xpos + ypos * COLUMNS) * 2 + 1) = ATTRIBUTE; + + xpos++; + if (xpos >= COLUMNS) + goto newline; + } + + /* Format a string and print it on the screen, just like the libc + function printf. */ + void + printf (const char *format, ...) + { + char **arg = (char **) &format; + int c; + char buf[20]; + + arg++; + + while ((c = *format++) != 0) + { + if (c != '%') + putchar (c); + else + { + char *p; + + c = *format++; + switch (c) + { + case 'd': + case 'u': + case 'x': + itoa (buf, c, *((int *) arg++)); + p = buf; + goto string; + break; + + case 's': + p = *arg++; + if (! p) + p = "(null)"; + + string: + while (*p) + putchar (*p++); + break; + + default: + putchar (*((int *) arg++)); + break; + } + } + } + } + + +File: multiboot.info, Node: Other Multiboot kernels, Prev: kernel.c, Up: Example OS code + +4.3.4 Other Multiboot kernels +----------------------------- + +Other useful information should be available in Multiboot kernels, such +as GNU Mach and Fiasco `http://os.inf.tu-dresden.de/fiasco/'. And, it +is worth mentioning the OSKit +`http://www.cs.utah.edu/projects/flux/oskit/', which provides a library +supporting the specification. + + +File: multiboot.info, Node: Example boot loader code, Prev: Example OS code, Up: Examples + +4.4 Example boot loader code +============================ + +The GNU GRUB (*note GRUB: (grub.info)Top.) project is a full +Multiboot-compliant boot loader, supporting all required and optional +features present in this specification. A public release has not been +made, but the test release is available from: + + `ftp://alpha.gnu.org/gnu/grub' + + See the webpage `http://www.gnu.org/software/grub/grub.html', for +more information. + + +File: multiboot.info, Node: History, Next: Index, Prev: Examples, Up: Top + +5 The change log of this specification +************************************** + +0.7 + * "Multiboot Standard" is renamed to "Multiboot Specification". + + * Graphics fields are added to Multiboot header. + + * BIOS drive information, BIOS configuration table, the name of + a boot loader, APM information, and graphics information are + added to Multiboot information. + + * Rewritten in Texinfo format. + + * Rewritten, using more strict words. + + * The maintainer changes to the GNU GRUB maintainer team + , from Bryan Ford and Erich Stefan Boleyn. + +0.6 + * A few wording changes. + + * Header checksum. + + * Clasification of machine state passed to an operating system. + +0.5 + * Name change. + +0.4 + * Major changes plus HTMLification. + + +File: multiboot.info, Node: Index, Prev: History, Up: Top + +Index +***** + +[Index] +* Menu: + + +Tag Table: +Node: Top990 +Node: Overview1326 +Node: Motivation1794 +Node: Architecture3191 +Node: Operating systems3724 +Node: Boot sources4518 +Node: Boot-time configuration5488 +Node: Convenience to operating systems6096 +Node: Boot modules8327 +Node: Terminology9476 +Node: Specification11855 +Node: OS image format12418 +Node: Header layout13476 +Node: Header magic fields14644 +Node: Header address fields17505 +Node: Header graphics fields19351 +Node: Machine state20737 +Node: Boot information format22997 +Node: Examples38368 +Node: Notes on PC38741 +Node: BIOS device mapping techniques40307 +Node: Data comparison technique41217 +Node: I/O restriction technique42079 +Node: Example OS code43296 +Node: multiboot.h44838 +Node: boot.S48662 +Node: kernel.c51286 +Node: Other Multiboot kernels60013 +Node: Example boot loader code60444 +Node: History60970 +Node: Index61891 + +End Tag Table diff --git a/usr/src/grub/grub-0.97/docs/multiboot.texi b/usr/src/grub/grub-0.97/docs/multiboot.texi new file mode 100644 index 0000000000..eded05c4c2 --- /dev/null +++ b/usr/src/grub/grub-0.97/docs/multiboot.texi @@ -0,0 +1,1234 @@ +\input texinfo @c -*-texinfo-*- +@c -*-texinfo-*- +@c %**start of header +@setfilename multiboot.info +@settitle Multiboot Specification +@c %**end of header + +@c Unify all our little indices for now. +@syncodeindex fn cp +@syncodeindex vr cp +@syncodeindex ky cp +@syncodeindex pg cp +@syncodeindex tp cp + +@footnotestyle separate +@paragraphindent 3 +@finalout + + +@dircategory Kernel +@direntry +* Multiboot Specification: (multiboot). Multiboot Specification. +@end direntry + +@ifinfo +Copyright @copyright{} 1995, 96 Bryan Ford +Copyright @copyright{} 1995, 96 Erich Stefan Boleyn +Copyright @copyright{} 1999, 2000, 2001, 2002 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. + +@ignore +Permission is granted to process this file through TeX and print the +results, provided the printed document carries a copying permission +notice identical to this one except for the removal of this paragraph +(this paragraph not being relevant to the printed manual). + +@end ignore + +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. +@end ifinfo + +@titlepage +@sp 10 +@title The Multiboot Specification +@author Yoshinori K. Okuji, Bryan Ford, Erich Stefan Boleyn, Kunihiro Ishiguro +@page + +@vskip 0pt plus 1filll +Copyright @copyright{} 1995, 96 Bryan Ford +Copyright @copyright{} 1995, 96 Erich Stefan Boleyn +Copyright @copyright{} 1999, 2000, 2001, 2002 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. +@end titlepage + +@finalout +@headings double + +@ifnottex +@node Top +@top Multiboot Specification + +This file documents Multiboot Specification, the proposal for the boot +sequence standard. This edition documents version 0.6.93. +@end ifnottex + +@menu +* Overview:: +* Terminology:: +* Specification:: +* Examples:: +* History:: +* Index:: +@end menu + + +@node Overview +@chapter Introduction to Multiboot Specification + +This chapter describes some rough information on the Multiboot +Specification. Note that this is not a part of the specification itself. + +@menu +* Motivation:: +* Architecture:: +* Operating systems:: +* Boot sources:: +* Boot-time configuration:: +* Convenience to operating systems:: +* Boot modules:: +@end menu + + +@node Motivation +@section The background of Multiboot Specification + +Every operating system ever created tends to have its own boot loader. +Installing a new operating system on a machine generally involves +installing a whole new set of boot mechanisms, each with completely +different install-time and boot-time user interfaces. Getting multiple +operating systems to coexist reliably on one machine through typical +@dfn{chaining} mechanisms can be a nightmare. There is little or no +choice of boot loaders for a particular operating system --- if the one +that comes with the operating system doesn't do exactly what you want, +or doesn't work on your machine, you're screwed. + +While we may not be able to fix this problem in existing commercial +operating systems, it shouldn't be too difficult for a few people in the +free operating system communities to put their heads together and solve +this problem for the popular free operating systems. That's what this +specification aims for. Basically, it specifies an interface between a +boot loader and a operating system, such that any complying boot loader +should be able to load any complying operating system. This +specification does @emph{not} specify how boot loaders should work --- +only how they must interface with the operating system being loaded. + + +@node Architecture +@section The target architecture + +This specification is primarily targeted at @sc{pc}, since they are the +most common and have the largest variety of operating systems and boot +loaders. However, to the extent that certain other architectures may +need a boot specification and do not have one already, a variation of +this specification, stripped of the x86-specific details, could be +adopted for them as well. + + +@node Operating systems +@section The target operating systems + +This specification is targeted toward free 32-bit operating systems +that can be fairly easily modified to support the specification without +going through lots of bureaucratic rigmarole. The particular free +operating systems that this specification is being primarily designed +for are Linux, FreeBSD, NetBSD, Mach, and VSTa. It is hoped that other +emerging free operating systems will adopt it from the start, and thus +immediately be able to take advantage of existing boot loaders. It would +be nice if commercial operating system vendors eventually adopted this +specification as well, but that's probably a pipe dream. + + +@node Boot sources +@section Boot sources + +It should be possible to write compliant boot loaders that load the OS +image from a variety of sources, including floppy disk, hard disk, and +across a network. + +Disk-based boot loaders may use a variety of techniques to find the +relevant OS image and boot module data on disk, such as by +interpretation of specific file systems (e.g. the BSD/Mach boot loader), +using precalculated @dfn{block lists} (e.g. LILO), loading from a +special @dfn{boot partition} (e.g. OS/2), or even loading from within +another operating system (e.g. the VSTa boot code, which loads from +DOS). Similarly, network-based boot loaders could use a variety of +network hardware and protocols. + +It is hoped that boot loaders will be created that support multiple +loading mechanisms, increasing their portability, robustness, and +user-friendliness. + + +@node Boot-time configuration +@section Configure an operating system at boot-time + +It is often necessary for one reason or another for the user to be able +to provide some configuration information to an operating system +dynamically at boot time. While this specification should not dictate +how this configuration information is obtained by the boot loader, it +should provide a standard means for the boot loader to pass such +information to the operating system. + + +@node Convenience to operating systems +@section How to make OS development easier + +OS images should be easy to generate. Ideally, an OS image should simply +be an ordinary 32-bit executable file in whatever file format the +operating system normally uses. It should be possible to @code{nm} or +disassemble OS images just like normal executables. Specialized tools +should not be required to create OS images in a @emph{special} file +format. If this means shifting some work from the operating system to +a boot loader, that is probably appropriate, because all the memory +consumed by the boot loader will typically be made available again after +the boot process is created, whereas every bit of code in the OS image +typically has to remain in memory forever. The operating system should +not have to worry about getting into 32-bit mode initially, because mode +switching code generally needs to be in the boot loader anyway in order +to load operating system data above the 1MB boundary, and forcing the +operating system to do this makes creation of OS images much more +difficult. + +Unfortunately, there is a horrendous variety of executable file formats +even among free Unix-like @sc{pc}-based operating systems --- generally +a different format for each operating system. Most of the relevant free +operating systems use some variant of a.out format, but some are moving +to @sc{elf}. It is highly desirable for boot loaders not to have to be +able to interpret all the different types of executable file formats in +existence in order to load the OS image --- otherwise the boot loader +effectively becomes operating system specific again. + +This specification adopts a compromise solution to this +problem. Multiboot-compliant OS images always contain a magic +@dfn{Multiboot header} (@pxref{OS image format}), which allows the boot +loader to load the image without having to understand numerous a.out +variants or other executable formats. This magic header does not need to +be at the very beginning of the executable file, so kernel images can +still conform to the local a.out format variant in addition to being +Multiboot-compliant. + + +@node Boot modules +@section Boot modules + +Many modern operating system kernels, such as those of VSTa and Mach, do +not by themselves contain enough mechanism to get the system fully +operational: they require the presence of additional software modules at +boot time in order to access devices, mount file systems, etc. While +these additional modules could be embedded in the main OS image along +with the kernel itself, and the resulting image be split apart manually +by the operating system when it receives control, it is often more +flexible, more space-efficient, and more convenient to the operating +system and user if the boot loader can load these additional modules +independently in the first place. + +Thus, this specification should provide a standard method for a boot +loader to indicate to the operating system what auxiliary boot modules +were loaded, and where they can be found. Boot loaders don't have to +support multiple boot modules, but they are strongly encouraged to, +because some operating systems will be unable to boot without them. + + +@node Terminology +@chapter The definitions of terms used through the specification + +@table @dfn +@item must +We use the term @dfn{must}, when any boot loader or OS image needs to +follow a rule --- otherwise, the boot loader or OS image is @emph{not} +Multiboot-compliant. + +@item should +We use the term @dfn{should}, when any boot loader or OS image is +recommended to follow a rule, but it doesn't need to follow the rule. + +@item may +We use the term @dfn{may}, when any boot loader or OS image is allowed +to follow a rule. + +@item boot loader +Whatever program or set of programs loads the image of the final +operating system to be run on the machine. The boot loader may itself +consist of several stages, but that is an implementation detail not +relevant to this specification. Only the @emph{final} stage of the boot +loader --- the stage that eventually transfers control to an operating +system --- must follow the rules specified in this document in order +to be @dfn{Multiboot-compliant}; earlier boot loader stages may be +designed in whatever way is most convenient. + +@item OS image +The initial binary image that a boot loader loads into memory and +transfers control to start an operating system. The OS image is +typically an executable containing the operating system kernel. + +@item boot module +Other auxiliary files that a boot loader loads into memory along with +an OS image, but does not interpret in any way other than passing their +locations to the operating system when it is invoked. + +@item Multiboot-compliant +A boot loader or an OS image which follows the rules defined as +@dfn{must} is Multiboot-compliant. When this specification specifies a +rule as @dfn{should} or @dfn{may}, a Multiboot-complaint boot loader/OS +image doesn't need to follow the rule. + +@item u8 +The type of unsigned 8-bit data. + +@item u16 +The type of unsigned 16-bit data. Because the target architecture is +little-endian, u16 is coded in little-endian. + +@item u32 +The type of unsigned 32-bit data. Because the target architecture is +little-endian, u32 is coded in little-endian. + +@item u64 +The type of unsigned 64-bit data. Because the target architecture is +little-endian, u64 is coded in little-endian. +@end table + + +@node Specification +@chapter The exact definitions of Multiboot Specification + +There are three main aspects of a boot loader/OS image interface: + +@enumerate +@item +The format of an OS image as seen by a boot loader. + +@item +The state of a machine when a boot loader starts an operating +system. + +@item +The format of information passed by a boot loader to an operating +system. +@end enumerate + +@menu +* OS image format:: +* Machine state:: +* Boot information format:: +@end menu + + +@node OS image format +@section OS image format + +An OS image may be an ordinary 32-bit executable file in the standard +format for that particular operating system, except that it may be +linked at a non-default load address to avoid loading on top of the +@sc{pc}'s I/O region or other reserved areas, and of course it should +not use shared libraries or other fancy features. + +An OS image must contain an additional header called @dfn{Multiboot +header}, besides the headers of the format used by the OS image. The +Multiboot header must be contained completely within the first 8192 +bytes of the OS image, and must be longword (32-bit) aligned. In +general, it should come @emph{as early as possible}, and may be +embedded in the beginning of the text segment after the @emph{real} +executable header. + +@menu +* Header layout:: The layout of Multiboot header +* Header magic fields:: The magic fields of Multiboot header +* Header address fields:: +* Header graphics fields:: +@end menu + + +@node Header layout +@subsection The layout of Multiboot header + +The layout of the Multiboot header must be as follows: + +@multitable @columnfractions .1 .1 .2 .5 +@item Offset @tab Type @tab Field Name @tab Note +@item 0 @tab u32 @tab magic @tab required +@item 4 @tab u32 @tab flags @tab required +@item 8 @tab u32 @tab checksum @tab required +@item 12 @tab u32 @tab header_addr @tab if flags[16] is set +@item 16 @tab u32 @tab load_addr @tab if flags[16] is set +@item 20 @tab u32 @tab load_end_addr @tab if flags[16] is set +@item 24 @tab u32 @tab bss_end_addr @tab if flags[16] is set +@item 28 @tab u32 @tab entry_addr @tab if flags[16] is set +@item 32 @tab u32 @tab mode_type @tab if flags[2] is set +@item 36 @tab u32 @tab width @tab if flags[2] is set +@item 40 @tab u32 @tab height @tab if flags[2] is set +@item 44 @tab u32 @tab depth @tab if flags[2] is set +@end multitable + +The fields @samp{magic}, @samp{flags} and @samp{checksum} are defined in +@ref{Header magic fields}, the fields @samp{header_addr}, +@samp{load_addr}, @samp{load_end_addr}, @samp{bss_end_addr} and +@samp{entry_addr} are defined in @ref{Header address fields}, and the +fields @samp{mode_type}, @samp{width}, @samp{height} and @samp{depth} are +defind in @ref{Header graphics fields}. + + +@node Header magic fields +@subsection The magic fields of Multiboot header + +@table @samp +@item magic +The field @samp{magic} is the magic number identifying the header, +which must be the hexadecimal value @code{0x1BADB002}. + +@item flags +The field @samp{flags} specifies features that the OS image requests or +requires of an boot loader. Bits 0-15 indicate requirements; if the +boot loader sees any of these bits set but doesn't understand the flag +or can't fulfill the requirements it indicates for some reason, it must +notify the user and fail to load the OS image. Bits 16-31 indicate +optional features; if any bits in this range are set but the boot loader +doesn't understand them, it may simply ignore them and proceed as +usual. Naturally, all as-yet-undefined bits in the @samp{flags} word +must be set to zero in OS images. This way, the @samp{flags} fields +serves for version control as well as simple feature selection. + +If bit 0 in the @samp{flags} word is set, then all boot modules loaded +along with the operating system must be aligned on page (4KB) +boundaries. Some operating systems expect to be able to map the pages +containing boot modules directly into a paged address space during +startup, and thus need the boot modules to be page-aligned. + +If bit 1 in the @samp{flags} word is set, then information on available +memory via at least the @samp{mem_*} fields of the Multiboot information +structure (@pxref{Boot information format}) must be included. If the +boot loader is capable of passing a memory map (the @samp{mmap_*} fields) +and one exists, then it may be included as well. + +If bit 2 in the @samp{flags} word is set, information about the video +mode table (@pxref{Boot information format}) must be available to the +kernel. + +If bit 16 in the @samp{flags} word is set, then the fields at offsets +8-24 in the Multiboot header are valid, and the boot loader should use +them instead of the fields in the actual executable header to calculate +where to load the OS image. This information does not need to be +provided if the kernel image is in @sc{elf} format, but it @emph{must} +be provided if the images is in a.out format or in some other +format. Compliant boot loaders must be able to load images that either +are in @sc{elf} format or contain the load address information embedded +in the Multiboot header; they may also directly support other executable +formats, such as particular a.out variants, but are not required to. + +@item checksum +The field @samp{checksum} is a 32-bit unsigned value which, when added +to the other magic fields (i.e. @samp{magic} and @samp{flags}), must +have a 32-bit unsigned sum of zero. +@end table + + +@node Header address fields +@subsection The address fields of Multiboot header + +All of the address fields enabled by flag bit 16 are physical addresses. +The meaning of each is as follows: + +@table @code +@item header_addr +Contains the address corresponding to the beginning of the Multiboot +header --- the physical memory location at which the magic value is +supposed to be loaded. This field serves to @dfn{synchronize} the +mapping between OS image offsets and physical memory addresses. + +@item load_addr +Contains the physical address of the beginning of the text segment. The +offset in the OS image file at which to start loading is defined by the +offset at which the header was found, minus (header_addr - +load_addr). load_addr must be less than or equal to header_addr. + +@item load_end_addr +Contains the physical address of the end of the data +segment. (load_end_addr - load_addr) specifies how much data to load. +This implies that the text and data segments must be consecutive in the +OS image; this is true for existing a.out executable formats. +If this field is zero, the boot loader assumes that the text and data +segments occupy the whole OS image file. + +@item bss_end_addr +Contains the physical address of the end of the bss segment. The boot +loader initializes this area to zero, and reserves the memory it +occupies to avoid placing boot modules and other data relevant to the +operating system in that area. If this field is zero, the boot loader +assumes that no bss segment is present. + +@item entry_addr +The physical address to which the boot loader should jump in order to +start running the operating system. +@end table + + +@node Header graphics fields +@subsection The graphics fields of Multiboot header + +All of the graphics fields are enabled by flag bit 2. They specify the +preferred graphics mode. Note that that is only a @emph{recommended} +mode by the OS image. If the mode exists, the boot loader should set +it, when the user doesn't specify a mode explicitly. Otherwise, the +boot loader should fall back to a similar mode, if available. + +The meaning of each is as follows: + +@table @code +@item mode_type +Contains @samp{0} for linear graphics mode or @samp{1} for +EGA-standard text mode. Everything else is reserved for future +expansion. Note that the boot loader may set a text mode, even if this +field contains @samp{0}. + +@item width +Contains the number of the columns. This is specified in pixels in a +graphics mode, and in characters in a text mode. The value zero +indicates that the OS image has no preference. + +@item height +Contains the number of the lines. This is specified in pixels in a +graphics mode, and in characters in a text mode. The value zero +indicates that the OS image has no preference. + +@item depth +Contains the number of bits per pixel in a graphics mode, and zero in +a text mode. The value zero indicates that the OS image has no +preference. +@end table + + +@node Machine state +@section Machine state + +When the boot loader invokes the 32-bit operating system, the machine +must have the following state: + +@table @samp +@item EAX +Must contain the magic value @samp{0x2BADB002}; the presence of this +value indicates to the operating system that it was loaded by a +Multiboot-compliant boot loader (e.g. as opposed to another type of +boot loader that the operating system can also be loaded from). + +@item EBX +Must contain the 32-bit physical address of the Multiboot +information structure provided by the boot loader (@pxref{Boot +information format}). + +@item CS +Must be a 32-bit read/execute code segment with an offset of @samp{0} +and a limit of @samp{0xFFFFFFFF}. The exact value is undefined. + +@item DS +@itemx ES +@itemx FS +@itemx GS +@itemx SS +Must be a 32-bit read/write data segment with an offset of @samp{0} +and a limit of @samp{0xFFFFFFFF}. The exact values are all undefined. + +@item A20 gate +Must be enabled. + +@item CR0 +Bit 31 (PG) must be cleared. Bit 0 (PE) must be set. Other bits are +all undefined. + +@item EFLAGS +Bit 17 (VM) must be cleared. Bit 9 (IF) must be cleared. Other bits +are all undefined. +@end table + +All other processor registers and flag bits are undefined. This +includes, in particular: + +@table @samp +@item ESP +The OS image must create its own stack as soon as it needs one. + +@item GDTR +Even though the segment registers are set up as described above, the +@samp{GDTR} may be invalid, so the OS image must not load any segment +registers (even just reloading the same values!) until it sets up its +own @samp{GDT}. + +@item IDTR +The OS image must leave interrupts disabled until it sets up its own +@code{IDT}. +@end table + +However, other machine state should be left by the boot loader in +@dfn{normal working order}, i.e. as initialized by the @sc{bios} (or +DOS, if that's what the boot loader runs from). In other words, the +operating system should be able to make @sc{bios} calls and such after +being loaded, as long as it does not overwrite the @sc{bios} data +structures before doing so. Also, the boot loader must leave the +@sc{pic} programmed with the normal @sc{bios}/DOS values, even if it +changed them during the switch to 32-bit mode. + + +@node Boot information format +@section Boot information format + +FIXME: Split this chapter like the chapter ``OS image format''. + +Upon entry to the operating system, the @code{EBX} register contains the +physical address of a @dfn{Multiboot information} data structure, +through which the boot loader communicates vital information to the +operating system. The operating system can use or ignore any parts of +the structure as it chooses; all information passed by the boot loader +is advisory only. + +The Multiboot information structure and its related substructures may be +placed anywhere in memory by the boot loader (with the exception of the +memory reserved for the kernel and boot modules, of course). It is the +operating system's responsibility to avoid overwriting this memory until +it is done using it. + +The format of the Multiboot information structure (as defined so far) +follows: + +@example +@group + +-------------------+ +0 | flags | (required) + +-------------------+ +4 | mem_lower | (present if flags[0] is set) +8 | mem_upper | (present if flags[0] is set) + +-------------------+ +12 | boot_device | (present if flags[1] is set) + +-------------------+ +16 | cmdline | (present if flags[2] is set) + +-------------------+ +20 | mods_count | (present if flags[3] is set) +24 | mods_addr | (present if flags[3] is set) + +-------------------+ +28 - 40 | syms | (present if flags[4] or + | | flags[5] is set) + +-------------------+ +44 | mmap_length | (present if flags[6] is set) +48 | mmap_addr | (present if flags[6] is set) + +-------------------+ +52 | drives_length | (present if flags[7] is set) +56 | drives_addr | (present if flags[7] is set) + +-------------------+ +60 | config_table | (present if flags[8] is set) + +-------------------+ +64 | boot_loader_name | (present if flags[9] is set) + +-------------------+ +68 | apm_table | (present if flags[10] is set) + +-------------------+ +72 | vbe_control_info | (present if flags[11] is set) +76 | vbe_mode_info | +80 | vbe_mode | +82 | vbe_interface_seg | +84 | vbe_interface_off | +86 | vbe_interface_len | + +-------------------+ +@end group +@end example + +The first longword indicates the presence and validity of other fields +in the Multiboot information structure. All as-yet-undefined bits must +be set to zero by the boot loader. Any set bits that the operating +system does not understand should be ignored. Thus, the @samp{flags} +field also functions as a version indicator, allowing the Multiboot +information structure to be expanded in the future without breaking +anything. + +If bit 0 in the @samp{flags} word is set, then the @samp{mem_*} fields +are valid. @samp{mem_lower} and @samp{mem_upper} indicate the amount of +lower and upper memory, respectively, in kilobytes. Lower memory starts +at address 0, and upper memory starts at address 1 megabyte. The maximum +possible value for lower memory is 640 kilobytes. The value returned for +upper memory is maximally the address of the first upper memory hole +minus 1 megabyte. It is not guaranteed to be this value. + +If bit 1 in the @samp{flags} word is set, then the @samp{boot_device} +field is valid, and indicates which @sc{bios} disk device the boot +loader loaded the OS image from. If the OS image was not loaded from a +@sc{bios} disk, then this field must not be present (bit 3 must be +clear). The operating system may use this field as a hint for +determining its own @dfn{root} device, but is not required to. The +@samp{boot_device} field is laid out in four one-byte subfields as +follows: + +@example +@group ++-------+-------+-------+-------+ +| drive | part1 | part2 | part3 | ++-------+-------+-------+-------+ +@end group +@end example + +The first byte contains the @sc{bios} drive number as understood by the +@sc{bios} INT 0x13 low-level disk interface: e.g. 0x00 for the first +floppy disk or 0x80 for the first hard disk. + +The three remaining bytes specify the boot partition. @samp{part1} +specifies the @dfn{top-level} partition number, @samp{part2} specifies a +@dfn{sub-partition} in the top-level partition, etc. Partition numbers +always start from zero. Unused partition bytes must be set to 0xFF. For +example, if the disk is partitioned using a simple one-level DOS +partitioning scheme, then @samp{part1} contains the DOS partition +number, and @samp{part2} and @samp{part3} are both 0xFF. As another +example, if a disk is partitioned first into DOS partitions, and then +one of those DOS partitions is subdivided into several BSD partitions +using BSD's @dfn{disklabel} strategy, then @samp{part1} contains the DOS +partition number, @samp{part2} contains the BSD sub-partition within +that DOS partition, and @samp{part3} is 0xFF. + +DOS extended partitions are indicated as partition numbers starting from +4 and increasing, rather than as nested sub-partitions, even though the +underlying disk layout of extended partitions is hierarchical in +nature. For example, if the boot loader boots from the second extended +partition on a disk partitioned in conventional DOS style, then +@samp{part1} will be 5, and @samp{part2} and @samp{part3} will both be +0xFF. + +If bit 2 of the @samp{flags} longword is set, the @samp{cmdline} field +is valid, and contains the physical address of the command line to +be passed to the kernel. The command line is a normal C-style +zero-terminated string. + +If bit 3 of the @samp{flags} is set, then the @samp{mods} fields +indicate to the kernel what boot modules were loaded along with the +kernel image, and where they can be found. @samp{mods_count} contains +the number of modules loaded; @samp{mods_addr} contains the physical +address of the first module structure. @samp{mods_count} may be zero, +indicating no boot modules were loaded, even if bit 1 of @samp{flags} is +set. Each module structure is formatted as follows: + +@example +@group + +-------------------+ +0 | mod_start | +4 | mod_end | + +-------------------+ +8 | string | + +-------------------+ +12 | reserved (0) | + +-------------------+ +@end group +@end example + +The first two fields contain the start and end addresses of the boot +module itself. The @samp{string} field provides an arbitrary string to +be associated with that particular boot module; it is a zero-terminated +ASCII string, just like the kernel command line. The @samp{string} field +may be 0 if there is no string associated with the module. Typically the +string might be a command line (e.g. if the operating system treats boot +modules as executable programs), or a pathname (e.g. if the operating +system treats boot modules as files in a file system), but its exact use +is specific to the operating system. The @samp{reserved} field must be +set to 0 by the boot loader and ignored by the operating system. + +@strong{Caution:} Bits 4 & 5 are mutually exclusive. + +If bit 4 in the @samp{flags} word is set, then the following fields in +the Multiboot information structure starting at byte 28 are valid: + +@example +@group + +-------------------+ +28 | tabsize | +32 | strsize | +36 | addr | +40 | reserved (0) | + +-------------------+ +@end group +@end example + +These indicate where the symbol table from an a.out kernel image can be +found. @samp{addr} is the physical address of the size (4-byte unsigned +long) of an array of a.out format @dfn{nlist} structures, followed +immediately by the array itself, then the size (4-byte unsigned long) of +a set of zero-terminated @sc{ascii} strings (plus sizeof(unsigned long) in +this case), and finally the set of strings itself. @samp{tabsize} is +equal to its size parameter (found at the beginning of the symbol +section), and @samp{strsize} is equal to its size parameter (found at +the beginning of the string section) of the following string table to +which the symbol table refers. Note that @samp{tabsize} may be 0, +indicating no symbols, even if bit 4 in the @samp{flags} word is set. + +If bit 5 in the @samp{flags} word is set, then the following fields in +the Multiboot information structure starting at byte 28 are valid: + +@example +@group + +-------------------+ +28 | num | +32 | size | +36 | addr | +40 | shndx | + +-------------------+ +@end group +@end example + +These indicate where the section header table from an ELF kernel is, the +size of each entry, number of entries, and the string table used as the +index of names. They correspond to the @samp{shdr_*} entries +(@samp{shdr_num}, etc.) in the Executable and Linkable Format (@sc{elf}) +specification in the program header. All sections are loaded, and the +physical address fields of the @sc{elf} section header then refer to where +the sections are in memory (refer to the i386 @sc{elf} documentation for +details as to how to read the section header(s)). Note that +@samp{shdr_num} may be 0, indicating no symbols, even if bit 5 in the +@samp{flags} word is set. + +If bit 6 in the @samp{flags} word is set, then the @samp{mmap_*} fields +are valid, and indicate the address and length of a buffer containing a +memory map of the machine provided by the @sc{bios}. @samp{mmap_addr} is +the address, and @samp{mmap_length} is the total size of the buffer. The +buffer consists of one or more of the following size/structure pairs +(@samp{size} is really used for skipping to the next pair): + +@example +@group + +-------------------+ +-4 | size | + +-------------------+ +0 | base_addr_low | +4 | base_addr_high | +8 | length_low | +12 | length_high | +16 | type | + +-------------------+ +@end group +@end example + +where @samp{size} is the size of the associated structure in bytes, which +can be greater than the minimum of 20 bytes. @samp{base_addr_low} is the +lower 32 bits of the starting address, and @samp{base_addr_high} is the +upper 32 bits, for a total of a 64-bit starting address. @samp{length_low} +is the lower 32 bits of the size of the memory region in bytes, and +@samp{length_high} is the upper 32 bits, for a total of a 64-bit +length. @samp{type} is the variety of address range represented, where a +value of 1 indicates available @sc{ram}, and all other values currently +indicated a reserved area. + +The map provided is guaranteed to list all standard @sc{ram} that should +be available for normal use. + +If bit 7 in the @samp{flags} is set, then the @samp{drives_*} fields +are valid, and indicate the address of the physical address of the first +drive structure and the size of drive structures. @samp{drives_addr} +is the address, and @samp{drives_length} is the total size of drive +structures. Note that @samp{drives_length} may be zero. Each drive +structure is formatted as follows: + +@example +@group + +-------------------+ +0 | size | + +-------------------+ +4 | drive_number | + +-------------------+ +5 | drive_mode | + +-------------------+ +6 | drive_cylinders | +8 | drive_heads | +9 | drive_sectors | + +-------------------+ +10 - xx | drive_ports | + +-------------------+ +@end group +@end example + +The @samp{size} field specifies the size of this structure. The size +varies, depending on the number of ports. Note that the size may not be +equal to (10 + 2 * the number of ports), because of an alignment. + +The @samp{drive_number} field contains the BIOS drive number. The +@samp{drive_mode} field represents the access mode used by the boot +loader. Currently, the following modes are defined: + +@table @samp +@item 0 +CHS mode (traditional cylinder/head/sector addressing mode). + +@item 1 +LBA mode (Logical Block Addressing mode). +@end table + +The three fields, @samp{drive_cylinders}, @samp{drive_heads} and +@samp{drive_sectors}, indicate the geometry of the drive detected by the +@sc{bios}. @samp{drive_cylinders} contains the number of the +cylinders. @samp{drive_heads} contains the number of the +heads. @samp{drive_sectors} contains the number of the sectors per +track. + +The @samp{drive_ports} field contains the array of the I/O ports used +for the drive in the @sc{bios} code. The array consists of zero or more +unsigned two-bytes integers, and is terminated with zero. Note that the +array may contain any number of I/O ports that are not related to the +drive actually (such as @sc{dma} controller's ports). + +If bit 8 in the @samp{flags} is set, then the @samp{config_table} field +is valid, and indicates the address of the @sc{rom} configuration table +returned by the @dfn{GET CONFIGURATION} @sc{bios} call. If the @sc{bios} +call fails, then the size of the table must be @emph{zero}. + +If bit 9 in the @samp{flags} is set, the @samp{boot_loader_name} field +is valid, and contains the physical address of the name of a boot +loader booting the kernel. The name is a normal C-style zero-terminated +string. + +If bit 10 in the @samp{flags} is set, the @samp{apm_table} field is +valid, and contains the physical address of an @sc{apm} table defined as +below: + +@example +@group + +----------------------+ +0 | version | +2 | cseg | +4 | offset | +8 | cseg_16 | +10 | dseg | +12 | flags | +14 | cseg_len | +16 | cseg_16_len | +18 | dseg_len | + +----------------------+ +@end group +@end example + +The fields @samp{version}, @samp{cseg}, @samp{offset}, @samp{cseg_16}, +@samp{dseg}, @samp{flags}, @samp{cseg_len}, @samp{cseg_16_len}, +@samp{dseg_len} indicate the version number, the protected mode 32-bit +code segment, the offset of the entry point, the protected mode 16-bit +code segment, the protected mode 16-bit data segment, the flags, the +length of the protected mode 32-bit code segment, the length of the +protected mode 16-bit code segment, and the length of the protected mode +16-bit data segment, respectively. Only the field @samp{offset} is 4 +bytes, and the others are 2 bytes. See +@uref{http://www.microsoft.com/hwdev/busbios/amp_12.htm, Advanced Power +Management (APM) BIOS Interface Specification}, for more information. + +If bit 11 in the @samp{flags} is set, the graphics table is available. +This must only be done if the kernel has indicated in the +@samp{Multiboot Header} that it accepts a graphics mode. + +The fields @samp{vbe_control_info} and @samp{vbe_mode_info} contain +the physical addresses of @sc{vbe} control information returned by the +@sc{vbe} Function 00h and @sc{vbe} mode information returned by the +@sc{vbe} Function 01h, respectively. + +The field @samp{vbe_mode} indicates current video mode in the format +specified in @sc{vbe} 3.0. + +The rest fields @samp{vbe_interface_seg}, @samp{vbe_interface_off}, and +@samp{vbe_interface_len} contain the table of a protected mode interface +defined in @sc{vbe} 2.0+. If this information is not available, those +fields contain zero. Note that @sc{vbe} 3.0 defines another protected +mode interface which is incompatible with the old one. If you want to +use the new protected mode interface, you will have to find the table +yourself. + +The fields for the graphics table are designed for @sc{vbe}, but +Multiboot boot loaders may simulate @sc{vbe} on non-@sc{vbe} modes, as +if they were @sc{vbe} modes. + + +@node Examples +@chapter Examples + +@strong{Caution:} The following items are not part of the specification +document, but are included for prospective operating system and boot +loader writers. + +@menu +* Notes on PC:: +* BIOS device mapping techniques:: +* Example OS code:: +* Example boot loader code:: +@end menu + + +@node Notes on PC +@section Notes on PC + +In reference to bit 0 of the @samp{flags} parameter in the Multiboot +information structure, if the bootloader in question uses older +@sc{bios} interfaces, or the newest ones are not available (see +description about bit 6), then a maximum of either 15 or 63 megabytes of +memory may be reported. It is @emph{highly} recommended that boot +loaders perform a thorough memory probe. + +In reference to bit 1 of the @samp{flags} parameter in the Multiboot +information structure, it is recognized that determination of which +@sc{bios} drive maps to which device driver in an operating system is +non-trivial, at best. Many kludges have been made to various operating +systems instead of solving this problem, most of them breaking under +many conditions. To encourage the use of general-purpose solutions to +this problem, there are 2 @sc{bios} device mapping techniques +(@pxref{BIOS device mapping techniques}). + +In reference to bit 6 of the @samp{flags} parameter in the Multiboot +information structure, it is important to note that the data structure +used there (starting with @samp{BaseAddrLow}) is the data returned by +the INT 15h, AX=E820h --- Query System Address Map call. See @xref{Query +System Address Map, , Query System Address Map, grub.info, The GRUB +Manual}, for more information. The interface here is meant to allow a +boot loader to work unmodified with any reasonable extensions of the +@sc{bios} interface, passing along any extra data to be interpreted by +the operating system as desired. + + +@node BIOS device mapping techniques +@section BIOS device mapping techniques + +Both of these techniques should be usable from any PC operating system, +and neither require any special support in the drivers themselves. This +section will be flushed out into detailed explanations, particularly for +the I/O restriction technique. + +The general rule is that the data comparison technique is the quick and +dirty solution. It works most of the time, but doesn't cover all the +bases, and is relatively simple. + +The I/O restriction technique is much more complex, but it has potential +to solve the problem under all conditions, plus allow access of the +remaining @sc{bios} devices when not all of them have operating system +drivers. + +@menu +* Data comparison technique:: +* I/O restriction technique:: +@end menu + + +@node Data comparison technique +@subsection Data comparison technique + +Before activating @emph{any} of the device drivers, gather enough data +from similar sectors on each of the disks such that each one can be +uniquely identified. + +After activating the device drivers, compare data from the drives using +the operating system drivers. This should hopefully be sufficient to +provide such a mapping. + +Problems: + +@enumerate +@item +The data on some @sc{bios} devices might be identical (so the part +reading the drives from the @sc{bios} should have some mechanism to give +up). + +@item +There might be extra drives not accessible from the @sc{bios} which are +identical to some drive used by the @sc{bios} (so it should be capable +of giving up there as well). +@end enumerate + + +@node I/O restriction technique +@subsection I/O restriction technique + +This first step may be unnecessary, but first create copy-on-write +mappings for the device drivers writing into @sc{pc} @sc{ram}. Keep the +original copies for the @dfn{clean @sc{bios} virtual machine} to be +created later. + +For each device driver brought online, determine which @sc{bios} devices +become inaccessible by: + +@enumerate +@item +Create a @dfn{clean @sc{bios} virtual machine}. + +@item +Set the I/O permission map for the I/O area claimed by the device driver +to no permissions (neither read nor write). + +@item +Access each device. + +@item +Record which devices succeed, and those which try to access the +@dfn{restricted} I/O areas (hopefully, this will be an @dfn{xor} +situation). +@end enumerate + +For each device driver, given how many of the @sc{bios} devices were +subsumed by it (there should be no gaps in this list), it should be easy +to determine which devices on the controller these are. + +In general, you have at most 2 disks from each controller given +@sc{bios} numbers, but they pretty much always count from the lowest +logically numbered devices on the controller. + + +@node Example OS code +@section Example OS code + +In this distribution, the example Multiboot kernel @file{kernel} is +included. The kernel just prints out the Multiboot information structure +on the screen, so you can make use of the kernel to test a +Multiboot-compliant boot loader and for reference to how to implement a +Multiboot kernel. The source files can be found under the directory +@file{docs} in the GRUB distribution. + +The kernel @file{kernel} consists of only three files: @file{boot.S}, +@file{kernel.c} and @file{multiboot.h}. The assembly source +@file{boot.S} is written in GAS (@pxref{Top, , GNU assembler, as.info, +The GNU assembler}), and contains the Multiboot information structure to +comply with the specification. When a Multiboot-compliant boot loader +loads and execute it, it initialize the stack pointer and @code{EFLAGS}, +and then call the function @code{cmain} defined in @file{kernel.c}. If +@code{cmain} returns to the callee, then it shows a message to inform +the user of the halt state and stops forever until you push the reset +key. The file @file{kernel.c} contains the function @code{cmain}, +which checks if the magic number passed by the boot loader is valid and +so on, and some functions to print messages on the screen. The file +@file{multiboot.h} defines some macros, such as the magic number for the +Multiboot header, the Multiboot header structure and the Multiboot +information structure. + +@menu +* multiboot.h:: +* boot.S:: +* kernel.c:: +* Other Multiboot kernels:: +@end menu + + +@node multiboot.h +@subsection multiboot.h + +This is the source code in the file @file{multiboot.h}: + +@example +@include multiboot.h.texi +@end example + + +@node boot.S +@subsection boot.S + +In the file @file{boot.S}: + +@example +@include boot.S.texi +@end example + + +@node kernel.c +@subsection kernel.c + +And, in the file @file{kernel.c}: + +@example +@include kernel.c.texi +@end example + + +@node Other Multiboot kernels +@subsection Other Multiboot kernels + +Other useful information should be available in Multiboot kernels, such +as GNU Mach and Fiasco @url{http://os.inf.tu-dresden.de/fiasco/}. And, +it is worth mentioning the OSKit +@url{http://www.cs.utah.edu/projects/flux/oskit/}, which provides a +library supporting the specification. + + +@node Example boot loader code +@section Example boot loader code + +The GNU GRUB (@pxref{Top, , GRUB, grub.info, The GRUB manual}) project +is a full Multiboot-compliant boot loader, supporting all required and +optional features present in this specification. A public release has +not been made, but the test release is available from: + +@url{ftp://alpha.gnu.org/gnu/grub} + +See the webpage @url{http://www.gnu.org/software/grub/grub.html}, for +more information. + + +@node History +@chapter The change log of this specification + +@table @asis +@item 0.7 +@itemize @bullet +@item +@dfn{Multiboot Standard} is renamed to @dfn{Multiboot Specification}. + +@item +Graphics fields are added to Multiboot header. + +@item +BIOS drive information, BIOS configuration table, the name of a boot +loader, APM information, and graphics information are added to Multiboot +information. + +@item +Rewritten in Texinfo format. + +@item +Rewritten, using more strict words. + +@item +The maintainer changes to the GNU GRUB maintainer team +@email{bug-grub@@gnu.org}, from Bryan Ford and Erich Stefan Boleyn. +@end itemize + +@item 0.6 +@itemize @bullet +@item +A few wording changes. + +@item +Header checksum. + +@item +Clasification of machine state passed to an operating system. +@end itemize + +@item 0.5 +@itemize @bullet +@item +Name change. +@end itemize + +@item 0.4 +@itemize @bullet +@item +Major changes plus HTMLification. +@end itemize +@end table + + +@node Index +@unnumbered Index + +@printindex cp + +@contents +@bye diff --git a/usr/src/grub/grub-0.97/docs/src2texi b/usr/src/grub/grub-0.97/docs/src2texi new file mode 100644 index 0000000000..10786d9716 --- /dev/null +++ b/usr/src/grub/grub-0.97/docs/src2texi @@ -0,0 +1,16 @@ +#! /bin/sh +# +# Convert a source file to a TeXinfo file. Stolen from glibc. +# +# Usage: src2texi SRCDIR SRC TEXI + +dir=$1 +src=`basename $2` +texi=`basename $3` + +sed -e 's,[{}],@&,g' \ + -e 's,/\*\(@.*\)\*/,\1,g' \ + -e 's,/\* *,/* @r{,g' -e 's, *\*/,} */,' \ + -e 's/\(@[a-z][a-z]*\)@{\([^}]*\)@}/\1{\2}/g' \ + ${dir}/${src} | expand > ${texi}.new +mv -f ${texi}.new ${dir}/${texi} diff --git a/usr/src/grub/grub-0.97/docs/stamp-vti b/usr/src/grub/grub-0.97/docs/stamp-vti new file mode 100644 index 0000000000..b97de24c8a --- /dev/null +++ b/usr/src/grub/grub-0.97/docs/stamp-vti @@ -0,0 +1,4 @@ +@set UPDATED 8 May 2005 +@set UPDATED-MONTH May 2005 +@set EDITION 0.97 +@set VERSION 0.97 diff --git a/usr/src/grub/grub-0.97/docs/texinfo.tex b/usr/src/grub/grub-0.97/docs/texinfo.tex new file mode 100644 index 0000000000..c93912a055 --- /dev/null +++ b/usr/src/grub/grub-0.97/docs/texinfo.tex @@ -0,0 +1,7086 @@ +% texinfo.tex -- TeX macros to handle Texinfo files. +% +% Load plain if necessary, i.e., if running under initex. +\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi +% +\def\texinfoversion{2004-11-25.16} +% +% Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, +% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software +% Foundation, Inc. +% +% This texinfo.tex file 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 texinfo.tex file is distributed in the hope that 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 texinfo.tex file; see the file COPYING. If not, write +% to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +% Boston, MA 02111-1307, USA. +% +% As a special exception, when this file is read by TeX when processing +% a Texinfo source document, you may use the result without +% restriction. (This has been our intent since Texinfo was invented.) +% +% Please try the latest version of texinfo.tex before submitting bug +% reports; you can get the latest version from: +% http://www.gnu.org/software/texinfo/ (the Texinfo home page), or +% ftp://tug.org/tex/texinfo.tex +% (and all CTAN mirrors, see http://www.ctan.org). +% The texinfo.tex in any given distribution could well be out +% of date, so if that's what you're using, please check. +% +% Send bug reports to bug-texinfo@gnu.org. Please include including a +% complete document in each bug report with which we can reproduce the +% problem. Patches are, of course, greatly appreciated. +% +% To process a Texinfo manual with TeX, it's most reliable to use the +% texi2dvi shell script that comes with the distribution. For a simple +% manual foo.texi, however, you can get away with this: +% tex foo.texi +% texindex foo.?? +% tex foo.texi +% tex foo.texi +% dvips foo.dvi -o # or whatever; this makes foo.ps. +% The extra TeX runs get the cross-reference information correct. +% Sometimes one run after texindex suffices, and sometimes you need more +% than two; texi2dvi does it as many times as necessary. +% +% It is possible to adapt texinfo.tex for other languages, to some +% extent. You can get the existing language-specific files from the +% full Texinfo distribution. +% +% The GNU Texinfo home page is http://www.gnu.org/software/texinfo. + + +\message{Loading texinfo [version \texinfoversion]:} + +% If in a .fmt file, print the version number +% and turn on active characters that we couldn't do earlier because +% they might have appeared in the input file name. +\everyjob{\message{[Texinfo version \texinfoversion]}% + \catcode`+=\active \catcode`\_=\active} + +\message{Basics,} +\chardef\other=12 + +% We never want plain's \outer definition of \+ in Texinfo. +% For @tex, we can use \tabalign. +\let\+ = \relax + +% Save some plain tex macros whose names we will redefine. +\let\ptexb=\b +\let\ptexbullet=\bullet +\let\ptexc=\c +\let\ptexcomma=\, +\let\ptexdot=\. +\let\ptexdots=\dots +\let\ptexend=\end +\let\ptexequiv=\equiv +\let\ptexexclam=\! +\let\ptexfootnote=\footnote +\let\ptexgtr=> +\let\ptexhat=^ +\let\ptexi=\i +\let\ptexindent=\indent +\let\ptexinsert=\insert +\let\ptexlbrace=\{ +\let\ptexless=< +\let\ptexnewwrite\newwrite +\let\ptexnoindent=\noindent +\let\ptexplus=+ +\let\ptexrbrace=\} +\let\ptexslash=\/ +\let\ptexstar=\* +\let\ptext=\t + +% If this character appears in an error message or help string, it +% starts a new line in the output. +\newlinechar = `^^J + +% Use TeX 3.0's \inputlineno to get the line number, for better error +% messages, but if we're using an old version of TeX, don't do anything. +% +\ifx\inputlineno\thisisundefined + \let\linenumber = \empty % Pre-3.0. +\else + \def\linenumber{l.\the\inputlineno:\space} +\fi + +% Set up fixed words for English if not already set. +\ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi +\ifx\putwordChapter\undefined \gdef\putwordChapter{Chapter}\fi +\ifx\putwordfile\undefined \gdef\putwordfile{file}\fi +\ifx\putwordin\undefined \gdef\putwordin{in}\fi +\ifx\putwordIndexIsEmpty\undefined \gdef\putwordIndexIsEmpty{(Index is empty)}\fi +\ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi +\ifx\putwordInfo\undefined \gdef\putwordInfo{Info}\fi +\ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi +\ifx\putwordMethodon\undefined \gdef\putwordMethodon{Method on}\fi +\ifx\putwordNoTitle\undefined \gdef\putwordNoTitle{No Title}\fi +\ifx\putwordof\undefined \gdef\putwordof{of}\fi +\ifx\putwordon\undefined \gdef\putwordon{on}\fi +\ifx\putwordpage\undefined \gdef\putwordpage{page}\fi +\ifx\putwordsection\undefined \gdef\putwordsection{section}\fi +\ifx\putwordSection\undefined \gdef\putwordSection{Section}\fi +\ifx\putwordsee\undefined \gdef\putwordsee{see}\fi +\ifx\putwordSee\undefined \gdef\putwordSee{See}\fi +\ifx\putwordShortTOC\undefined \gdef\putwordShortTOC{Short Contents}\fi +\ifx\putwordTOC\undefined \gdef\putwordTOC{Table of Contents}\fi +% +\ifx\putwordMJan\undefined \gdef\putwordMJan{January}\fi +\ifx\putwordMFeb\undefined \gdef\putwordMFeb{February}\fi +\ifx\putwordMMar\undefined \gdef\putwordMMar{March}\fi +\ifx\putwordMApr\undefined \gdef\putwordMApr{April}\fi +\ifx\putwordMMay\undefined \gdef\putwordMMay{May}\fi +\ifx\putwordMJun\undefined \gdef\putwordMJun{June}\fi +\ifx\putwordMJul\undefined \gdef\putwordMJul{July}\fi +\ifx\putwordMAug\undefined \gdef\putwordMAug{August}\fi +\ifx\putwordMSep\undefined \gdef\putwordMSep{September}\fi +\ifx\putwordMOct\undefined \gdef\putwordMOct{October}\fi +\ifx\putwordMNov\undefined \gdef\putwordMNov{November}\fi +\ifx\putwordMDec\undefined \gdef\putwordMDec{December}\fi +% +\ifx\putwordDefmac\undefined \gdef\putwordDefmac{Macro}\fi +\ifx\putwordDefspec\undefined \gdef\putwordDefspec{Special Form}\fi +\ifx\putwordDefvar\undefined \gdef\putwordDefvar{Variable}\fi +\ifx\putwordDefopt\undefined \gdef\putwordDefopt{User Option}\fi +\ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi + +% In some macros, we cannot use the `\? notation---the left quote is +% in some cases the escape char. +\chardef\colonChar = `\: +\chardef\commaChar = `\, +\chardef\dotChar = `\. +\chardef\exclamChar= `\! +\chardef\questChar = `\? +\chardef\semiChar = `\; +\chardef\underChar = `\_ + +\chardef\spaceChar = `\ % +\chardef\spacecat = 10 +\def\spaceisspace{\catcode\spaceChar=\spacecat} + +% Ignore a token. +% +\def\gobble#1{} + +% The following is used inside several \edef's. +\def\makecsname#1{\expandafter\noexpand\csname#1\endcsname} + +% Hyphenation fixes. +\hyphenation{ + Flor-i-da Ghost-script Ghost-view Mac-OS Post-Script + ap-pen-dix bit-map bit-maps + data-base data-bases eshell fall-ing half-way long-est man-u-script + man-u-scripts mini-buf-fer mini-buf-fers over-view par-a-digm + par-a-digms rath-er rec-tan-gu-lar ro-bot-ics se-vere-ly set-up spa-ces + spell-ing spell-ings + stand-alone strong-est time-stamp time-stamps which-ever white-space + wide-spread wrap-around +} + +% Margin to add to right of even pages, to left of odd pages. +\newdimen\bindingoffset +\newdimen\normaloffset +\newdimen\pagewidth \newdimen\pageheight + +% For a final copy, take out the rectangles +% that mark overfull boxes (in case you have decided +% that the text looks ok even though it passes the margin). +% +\def\finalout{\overfullrule=0pt} + +% @| inserts a changebar to the left of the current line. It should +% surround any changed text. This approach does *not* work if the +% change spans more than two lines of output. To handle that, we would +% have adopt a much more difficult approach (putting marks into the main +% vertical list for the beginning and end of each change). +% +\def\|{% + % \vadjust can only be used in horizontal mode. + \leavevmode + % + % Append this vertical mode material after the current line in the output. + \vadjust{% + % We want to insert a rule with the height and depth of the current + % leading; that is exactly what \strutbox is supposed to record. + \vskip-\baselineskip + % + % \vadjust-items are inserted at the left edge of the type. So + % the \llap here moves out into the left-hand margin. + \llap{% + % + % For a thicker or thinner bar, change the `1pt'. + \vrule height\baselineskip width1pt + % + % This is the space between the bar and the text. + \hskip 12pt + }% + }% +} + +% Sometimes it is convenient to have everything in the transcript file +% and nothing on the terminal. We don't just call \tracingall here, +% since that produces some useless output on the terminal. We also make +% some effort to order the tracing commands to reduce output in the log +% file; cf. trace.sty in LaTeX. +% +\def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}% +\def\loggingall{% + \tracingstats2 + \tracingpages1 + \tracinglostchars2 % 2 gives us more in etex + \tracingparagraphs1 + \tracingoutput1 + \tracingmacros2 + \tracingrestores1 + \showboxbreadth\maxdimen \showboxdepth\maxdimen + \ifx\eTeXversion\undefined\else % etex gives us more logging + \tracingscantokens1 + \tracingifs1 + \tracinggroups1 + \tracingnesting2 + \tracingassigns1 + \fi + \tracingcommands3 % 3 gives us more in etex + \errorcontextlines16 +}% + +% add check for \lastpenalty to plain's definitions. If the last thing +% we did was a \nobreak, we don't want to insert more space. +% +\def\smallbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\smallskipamount + \removelastskip\penalty-50\smallskip\fi\fi} +\def\medbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\medskipamount + \removelastskip\penalty-100\medskip\fi\fi} +\def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount + \removelastskip\penalty-200\bigskip\fi\fi} + +% For @cropmarks command. +% Do @cropmarks to get crop marks. +% +\newif\ifcropmarks +\let\cropmarks = \cropmarkstrue +% +% Dimensions to add cropmarks at corners. +% Added by P. A. MacKay, 12 Nov. 1986 +% +\newdimen\outerhsize \newdimen\outervsize % set by the paper size routines +\newdimen\cornerlong \cornerlong=1pc +\newdimen\cornerthick \cornerthick=.3pt +\newdimen\topandbottommargin \topandbottommargin=.75in + +% Main output routine. +\chardef\PAGE = 255 +\output = {\onepageout{\pagecontents\PAGE}} + +\newbox\headlinebox +\newbox\footlinebox + +% \onepageout takes a vbox as an argument. Note that \pagecontents +% does insertions, but you have to call it yourself. +\def\onepageout#1{% + \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi + % + \ifodd\pageno \advance\hoffset by \bindingoffset + \else \advance\hoffset by -\bindingoffset\fi + % + % Do this outside of the \shipout so @code etc. will be expanded in + % the headline as they should be, not taken literally (outputting ''code). + \setbox\headlinebox = \vbox{\let\hsize=\pagewidth \makeheadline}% + \setbox\footlinebox = \vbox{\let\hsize=\pagewidth \makefootline}% + % + {% + % Have to do this stuff outside the \shipout because we want it to + % take effect in \write's, yet the group defined by the \vbox ends + % before the \shipout runs. + % + \escapechar = `\\ % use backslash in output files. + \indexdummies % don't expand commands in the output. + \normalturnoffactive % \ in index entries must not stay \, e.g., if + % the page break happens to be in the middle of an example. + \shipout\vbox{% + % Do this early so pdf references go to the beginning of the page. + \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi + % + \ifcropmarks \vbox to \outervsize\bgroup + \hsize = \outerhsize + \vskip-\topandbottommargin + \vtop to0pt{% + \line{\ewtop\hfil\ewtop}% + \nointerlineskip + \line{% + \vbox{\moveleft\cornerthick\nstop}% + \hfill + \vbox{\moveright\cornerthick\nstop}% + }% + \vss}% + \vskip\topandbottommargin + \line\bgroup + \hfil % center the page within the outer (page) hsize. + \ifodd\pageno\hskip\bindingoffset\fi + \vbox\bgroup + \fi + % + \unvbox\headlinebox + \pagebody{#1}% + \ifdim\ht\footlinebox > 0pt + % Only leave this space if the footline is nonempty. + % (We lessened \vsize for it in \oddfootingxxx.) + % The \baselineskip=24pt in plain's \makefootline has no effect. + \vskip 2\baselineskip + \unvbox\footlinebox + \fi + % + \ifcropmarks + \egroup % end of \vbox\bgroup + \hfil\egroup % end of (centering) \line\bgroup + \vskip\topandbottommargin plus1fill minus1fill + \boxmaxdepth = \cornerthick + \vbox to0pt{\vss + \line{% + \vbox{\moveleft\cornerthick\nsbot}% + \hfill + \vbox{\moveright\cornerthick\nsbot}% + }% + \nointerlineskip + \line{\ewbot\hfil\ewbot}% + }% + \egroup % \vbox from first cropmarks clause + \fi + }% end of \shipout\vbox + }% end of group with \normalturnoffactive + \advancepageno + \ifnum\outputpenalty>-20000 \else\dosupereject\fi +} + +\newinsert\margin \dimen\margin=\maxdimen + +\def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}} +{\catcode`\@ =11 +\gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi +% marginal hacks, juha@viisa.uucp (Juha Takala) +\ifvoid\margin\else % marginal info is present + \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi +\dimen@=\dp#1 \unvbox#1 +\ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi +\ifr@ggedbottom \kern-\dimen@ \vfil \fi} +} + +% Here are the rules for the cropmarks. Note that they are +% offset so that the space between them is truly \outerhsize or \outervsize +% (P. A. MacKay, 12 November, 1986) +% +\def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong} +\def\nstop{\vbox + {\hrule height\cornerthick depth\cornerlong width\cornerthick}} +\def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong} +\def\nsbot{\vbox + {\hrule height\cornerlong depth\cornerthick width\cornerthick}} + +% Parse an argument, then pass it to #1. The argument is the rest of +% the input line (except we remove a trailing comment). #1 should be a +% macro which expects an ordinary undelimited TeX argument. +% +\def\parsearg{\parseargusing{}} +\def\parseargusing#1#2{% + \def\next{#2}% + \begingroup + \obeylines + \spaceisspace + #1% + \parseargline\empty% Insert the \empty token, see \finishparsearg below. +} + +{\obeylines % + \gdef\parseargline#1^^M{% + \endgroup % End of the group started in \parsearg. + \argremovecomment #1\comment\ArgTerm% + }% +} + +% First remove any @comment, then any @c comment. +\def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm} +\def\argremovec#1\c#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm} + +% Each occurence of `\^^M' or `\^^M' is replaced by a single space. +% +% \argremovec might leave us with trailing space, e.g., +% @end itemize @c foo +% This space token undergoes the same procedure and is eventually removed +% by \finishparsearg. +% +\def\argcheckspaces#1\^^M{\argcheckspacesX#1\^^M \^^M} +\def\argcheckspacesX#1 \^^M{\argcheckspacesY#1\^^M} +\def\argcheckspacesY#1\^^M#2\^^M#3\ArgTerm{% + \def\temp{#3}% + \ifx\temp\empty + % We cannot use \next here, as it holds the macro to run; + % thus we reuse \temp. + \let\temp\finishparsearg + \else + \let\temp\argcheckspaces + \fi + % Put the space token in: + \temp#1 #3\ArgTerm +} + +% If a _delimited_ argument is enclosed in braces, they get stripped; so +% to get _exactly_ the rest of the line, we had to prevent such situation. +% We prepended an \empty token at the very beginning and we expand it now, +% just before passing the control to \next. +% (Similarily, we have to think about #3 of \argcheckspacesY above: it is +% either the null string, or it ends with \^^M---thus there is no danger +% that a pair of braces would be stripped. +% +% But first, we have to remove the trailing space token. +% +\def\finishparsearg#1 \ArgTerm{\expandafter\next\expandafter{#1}} + +% \parseargdef\foo{...} +% is roughly equivalent to +% \def\foo{\parsearg\Xfoo} +% \def\Xfoo#1{...} +% +% Actually, I use \csname\string\foo\endcsname, ie. \\foo, as it is my +% favourite TeX trick. --kasal, 16nov03 + +\def\parseargdef#1{% + \expandafter \doparseargdef \csname\string#1\endcsname #1% +} +\def\doparseargdef#1#2{% + \def#2{\parsearg#1}% + \def#1##1% +} + +% Several utility definitions with active space: +{ + \obeyspaces + \gdef\obeyedspace{ } + + % Make each space character in the input produce a normal interword + % space in the output. Don't allow a line break at this space, as this + % is used only in environments like @example, where each line of input + % should produce a line of output anyway. + % + \gdef\sepspaces{\obeyspaces\let =\tie} + + % If an index command is used in an @example environment, any spaces + % therein should become regular spaces in the raw index file, not the + % expansion of \tie (\leavevmode \penalty \@M \ ). + \gdef\unsepspaces{\let =\space} +} + + +\def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next} + +% Define the framework for environments in texinfo.tex. It's used like this: +% +% \envdef\foo{...} +% \def\Efoo{...} +% +% It's the responsibility of \envdef to insert \begingroup before the +% actual body; @end closes the group after calling \Efoo. \envdef also +% defines \thisenv, so the current environment is known; @end checks +% whether the environment name matches. The \checkenv macro can also be +% used to check whether the current environment is the one expected. +% +% Non-false conditionals (@iftex, @ifset) don't fit into this, so they +% are not treated as enviroments; they don't open a group. (The +% implementation of @end takes care not to call \endgroup in this +% special case.) + + +% At runtime, environments start with this: +\def\startenvironment#1{\begingroup\def\thisenv{#1}} +% initialize +\let\thisenv\empty + +% ... but they get defined via ``\envdef\foo{...}'': +\long\def\envdef#1#2{\def#1{\startenvironment#1#2}} +\def\envparseargdef#1#2{\parseargdef#1{\startenvironment#1#2}} + +% Check whether we're in the right environment: +\def\checkenv#1{% + \def\temp{#1}% + \ifx\thisenv\temp + \else + \badenverr + \fi +} + +% Evironment mismatch, #1 expected: +\def\badenverr{% + \errhelp = \EMsimple + \errmessage{This command can appear only \inenvironment\temp, + not \inenvironment\thisenv}% +} +\def\inenvironment#1{% + \ifx#1\empty + out of any environment% + \else + in environment \expandafter\string#1% + \fi +} + +% @end foo executes the definition of \Efoo. +% But first, it executes a specialized version of \checkenv +% +\parseargdef\end{% + \if 1\csname iscond.#1\endcsname + \else + % The general wording of \badenverr may not be ideal, but... --kasal, 06nov03 + \expandafter\checkenv\csname#1\endcsname + \csname E#1\endcsname + \endgroup + \fi +} + +\newhelp\EMsimple{Press RETURN to continue.} + + +%% Simple single-character @ commands + +% @@ prints an @ +% Kludge this until the fonts are right (grr). +\def\@{{\tt\char64}} + +% This is turned off because it was never documented +% and you can use @w{...} around a quote to suppress ligatures. +%% Define @` and @' to be the same as ` and ' +%% but suppressing ligatures. +%\def\`{{`}} +%\def\'{{'}} + +% Used to generate quoted braces. +\def\mylbrace {{\tt\char123}} +\def\myrbrace {{\tt\char125}} +\let\{=\mylbrace +\let\}=\myrbrace +\begingroup + % Definitions to produce \{ and \} commands for indices, + % and @{ and @} for the aux file. + \catcode`\{ = \other \catcode`\} = \other + \catcode`\[ = 1 \catcode`\] = 2 + \catcode`\! = 0 \catcode`\\ = \other + !gdef!lbracecmd[\{]% + !gdef!rbracecmd[\}]% + !gdef!lbraceatcmd[@{]% + !gdef!rbraceatcmd[@}]% +!endgroup + +% @comma{} to avoid , parsing problems. +\let\comma = , + +% Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent +% Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H. +\let\, = \c +\let\dotaccent = \. +\def\ringaccent#1{{\accent23 #1}} +\let\tieaccent = \t +\let\ubaraccent = \b +\let\udotaccent = \d + +% Other special characters: @questiondown @exclamdown @ordf @ordm +% Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss. +\def\questiondown{?`} +\def\exclamdown{!`} +\def\ordf{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{a}}} +\def\ordm{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{o}}} + +% Dotless i and dotless j, used for accents. +\def\imacro{i} +\def\jmacro{j} +\def\dotless#1{% + \def\temp{#1}% + \ifx\temp\imacro \ptexi + \else\ifx\temp\jmacro \j + \else \errmessage{@dotless can be used only with i or j}% + \fi\fi +} + +% The \TeX{} logo, as in plain, but resetting the spacing so that a +% period following counts as ending a sentence. (Idea found in latex.) +% +\edef\TeX{\TeX \spacefactor=1000 } + +% @LaTeX{} logo. Not quite the same results as the definition in +% latex.ltx, since we use a different font for the raised A; it's most +% convenient for us to use an explicitly smaller font, rather than using +% the \scriptstyle font (since we don't reset \scriptstyle and +% \scriptscriptstyle). +% +\def\LaTeX{% + L\kern-.36em + {\setbox0=\hbox{T}% + \vbox to \ht0{\hbox{\selectfonts\lllsize A}\vss}}% + \kern-.15em + \TeX +} + +% Be sure we're in horizontal mode when doing a tie, since we make space +% equivalent to this in @example-like environments. Otherwise, a space +% at the beginning of a line will start with \penalty -- and +% since \penalty is valid in vertical mode, we'd end up putting the +% penalty on the vertical list instead of in the new paragraph. +{\catcode`@ = 11 + % Avoid using \@M directly, because that causes trouble + % if the definition is written into an index file. + \global\let\tiepenalty = \@M + \gdef\tie{\leavevmode\penalty\tiepenalty\ } +} + +% @: forces normal size whitespace following. +\def\:{\spacefactor=1000 } + +% @* forces a line break. +\def\*{\hfil\break\hbox{}\ignorespaces} + +% @/ allows a line break. +\let\/=\allowbreak + +% @. is an end-of-sentence period. +\def\.{.\spacefactor=3000 } + +% @! is an end-of-sentence bang. +\def\!{!\spacefactor=3000 } + +% @? is an end-of-sentence query. +\def\?{?\spacefactor=3000 } + +% @w prevents a word break. Without the \leavevmode, @w at the +% beginning of a paragraph, when TeX is still in vertical mode, would +% produce a whole line of output instead of starting the paragraph. +\def\w#1{\leavevmode\hbox{#1}} + +% @group ... @end group forces ... to be all on one page, by enclosing +% it in a TeX vbox. We use \vtop instead of \vbox to construct the box +% to keep its height that of a normal line. According to the rules for +% \topskip (p.114 of the TeXbook), the glue inserted is +% max (\topskip - \ht (first item), 0). If that height is large, +% therefore, no glue is inserted, and the space between the headline and +% the text is small, which looks bad. +% +% Another complication is that the group might be very large. This can +% cause the glue on the previous page to be unduly stretched, because it +% does not have much material. In this case, it's better to add an +% explicit \vfill so that the extra space is at the bottom. The +% threshold for doing this is if the group is more than \vfilllimit +% percent of a page (\vfilllimit can be changed inside of @tex). +% +\newbox\groupbox +\def\vfilllimit{0.7} +% +\envdef\group{% + \ifnum\catcode`\^^M=\active \else + \errhelp = \groupinvalidhelp + \errmessage{@group invalid in context where filling is enabled}% + \fi + \startsavinginserts + % + \setbox\groupbox = \vtop\bgroup + % Do @comment since we are called inside an environment such as + % @example, where each end-of-line in the input causes an + % end-of-line in the output. We don't want the end-of-line after + % the `@group' to put extra space in the output. Since @group + % should appear on a line by itself (according to the Texinfo + % manual), we don't worry about eating any user text. + \comment +} +% +% The \vtop produces a box with normal height and large depth; thus, TeX puts +% \baselineskip glue before it, and (when the next line of text is done) +% \lineskip glue after it. Thus, space below is not quite equal to space +% above. But it's pretty close. +\def\Egroup{% + % To get correct interline space between the last line of the group + % and the first line afterwards, we have to propagate \prevdepth. + \endgraf % Not \par, as it may have been set to \lisppar. + \global\dimen1 = \prevdepth + \egroup % End the \vtop. + % \dimen0 is the vertical size of the group's box. + \dimen0 = \ht\groupbox \advance\dimen0 by \dp\groupbox + % \dimen2 is how much space is left on the page (more or less). + \dimen2 = \pageheight \advance\dimen2 by -\pagetotal + % if the group doesn't fit on the current page, and it's a big big + % group, force a page break. + \ifdim \dimen0 > \dimen2 + \ifdim \pagetotal < \vfilllimit\pageheight + \page + \fi + \fi + \box\groupbox + \prevdepth = \dimen1 + \checkinserts +} +% +% TeX puts in an \escapechar (i.e., `@') at the beginning of the help +% message, so this ends up printing `@group can only ...'. +% +\newhelp\groupinvalidhelp{% +group can only be used in environments such as @example,^^J% +where each line of input produces a line of output.} + +% @need space-in-mils +% forces a page break if there is not space-in-mils remaining. + +\newdimen\mil \mil=0.001in + +% Old definition--didn't work. +%\parseargdef\need{\par % +%% This method tries to make TeX break the page naturally +%% if the depth of the box does not fit. +%{\baselineskip=0pt% +%\vtop to #1\mil{\vfil}\kern -#1\mil\nobreak +%\prevdepth=-1000pt +%}} + +\parseargdef\need{% + % Ensure vertical mode, so we don't make a big box in the middle of a + % paragraph. + \par + % + % If the @need value is less than one line space, it's useless. + \dimen0 = #1\mil + \dimen2 = \ht\strutbox + \advance\dimen2 by \dp\strutbox + \ifdim\dimen0 > \dimen2 + % + % Do a \strut just to make the height of this box be normal, so the + % normal leading is inserted relative to the preceding line. + % And a page break here is fine. + \vtop to #1\mil{\strut\vfil}% + % + % TeX does not even consider page breaks if a penalty added to the + % main vertical list is 10000 or more. But in order to see if the + % empty box we just added fits on the page, we must make it consider + % page breaks. On the other hand, we don't want to actually break the + % page after the empty box. So we use a penalty of 9999. + % + % There is an extremely small chance that TeX will actually break the + % page at this \penalty, if there are no other feasible breakpoints in + % sight. (If the user is using lots of big @group commands, which + % almost-but-not-quite fill up a page, TeX will have a hard time doing + % good page breaking, for example.) However, I could not construct an + % example where a page broke at this \penalty; if it happens in a real + % document, then we can reconsider our strategy. + \penalty9999 + % + % Back up by the size of the box, whether we did a page break or not. + \kern -#1\mil + % + % Do not allow a page break right after this kern. + \nobreak + \fi +} + +% @br forces paragraph break (and is undocumented). + +\let\br = \par + +% @page forces the start of a new page. +% +\def\page{\par\vfill\supereject} + +% @exdent text.... +% outputs text on separate line in roman font, starting at standard page margin + +% This records the amount of indent in the innermost environment. +% That's how much \exdent should take out. +\newskip\exdentamount + +% This defn is used inside fill environments such as @defun. +\parseargdef\exdent{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break} + +% This defn is used inside nofill environments such as @example. +\parseargdef\nofillexdent{{\advance \leftskip by -\exdentamount + \leftline{\hskip\leftskip{\rm#1}}}} + +% @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current +% paragraph. For more general purposes, use the \margin insertion +% class. WHICH is `l' or `r'. +% +\newskip\inmarginspacing \inmarginspacing=1cm +\def\strutdepth{\dp\strutbox} +% +\def\doinmargin#1#2{\strut\vadjust{% + \nobreak + \kern-\strutdepth + \vtop to \strutdepth{% + \baselineskip=\strutdepth + \vss + % if you have multiple lines of stuff to put here, you'll need to + % make the vbox yourself of the appropriate size. + \ifx#1l% + \llap{\ignorespaces #2\hskip\inmarginspacing}% + \else + \rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}% + \fi + \null + }% +}} +\def\inleftmargin{\doinmargin l} +\def\inrightmargin{\doinmargin r} +% +% @inmargin{TEXT [, RIGHT-TEXT]} +% (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right; +% else use TEXT for both). +% +\def\inmargin#1{\parseinmargin #1,,\finish} +\def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing. + \setbox0 = \hbox{\ignorespaces #2}% + \ifdim\wd0 > 0pt + \def\lefttext{#1}% have both texts + \def\righttext{#2}% + \else + \def\lefttext{#1}% have only one text + \def\righttext{#1}% + \fi + % + \ifodd\pageno + \def\temp{\inrightmargin\righttext}% odd page -> outside is right margin + \else + \def\temp{\inleftmargin\lefttext}% + \fi + \temp +} + +% @include file insert text of that file as input. +% +\def\include{\parseargusing\filenamecatcodes\includezzz} +\def\includezzz#1{% + \pushthisfilestack + \def\thisfile{#1}% + {% + \makevalueexpandable + \def\temp{\input #1 }% + \expandafter + }\temp + \popthisfilestack +} +\def\filenamecatcodes{% + \catcode`\\=\other + \catcode`~=\other + \catcode`^=\other + \catcode`_=\other + \catcode`|=\other + \catcode`<=\other + \catcode`>=\other + \catcode`+=\other + \catcode`-=\other +} + +\def\pushthisfilestack{% + \expandafter\pushthisfilestackX\popthisfilestack\StackTerm +} +\def\pushthisfilestackX{% + \expandafter\pushthisfilestackY\thisfile\StackTerm +} +\def\pushthisfilestackY #1\StackTerm #2\StackTerm {% + \gdef\popthisfilestack{\gdef\thisfile{#1}\gdef\popthisfilestack{#2}}% +} + +\def\popthisfilestack{\errthisfilestackempty} +\def\errthisfilestackempty{\errmessage{Internal error: + the stack of filenames is empty.}} + +\def\thisfile{} + +% @center line +% outputs that line, centered. +% +\parseargdef\center{% + \ifhmode + \let\next\centerH + \else + \let\next\centerV + \fi + \next{\hfil \ignorespaces#1\unskip \hfil}% +} +\def\centerH#1{% + {% + \hfil\break + \advance\hsize by -\leftskip + \advance\hsize by -\rightskip + \line{#1}% + \break + }% +} +\def\centerV#1{\line{\kern\leftskip #1\kern\rightskip}} + +% @sp n outputs n lines of vertical space + +\parseargdef\sp{\vskip #1\baselineskip} + +% @comment ...line which is ignored... +% @c is the same as @comment +% @ignore ... @end ignore is another way to write a comment + +\def\comment{\begingroup \catcode`\^^M=\other% +\catcode`\@=\other \catcode`\{=\other \catcode`\}=\other% +\commentxxx} +{\catcode`\^^M=\other \gdef\commentxxx#1^^M{\endgroup}} + +\let\c=\comment + +% @paragraphindent NCHARS +% We'll use ems for NCHARS, close enough. +% NCHARS can also be the word `asis' or `none'. +% We cannot feasibly implement @paragraphindent asis, though. +% +\def\asisword{asis} % no translation, these are keywords +\def\noneword{none} +% +\parseargdef\paragraphindent{% + \def\temp{#1}% + \ifx\temp\asisword + \else + \ifx\temp\noneword + \defaultparindent = 0pt + \else + \defaultparindent = #1em + \fi + \fi + \parindent = \defaultparindent +} + +% @exampleindent NCHARS +% We'll use ems for NCHARS like @paragraphindent. +% It seems @exampleindent asis isn't necessary, but +% I preserve it to make it similar to @paragraphindent. +\parseargdef\exampleindent{% + \def\temp{#1}% + \ifx\temp\asisword + \else + \ifx\temp\noneword + \lispnarrowing = 0pt + \else + \lispnarrowing = #1em + \fi + \fi +} + +% @firstparagraphindent WORD +% If WORD is `none', then suppress indentation of the first paragraph +% after a section heading. If WORD is `insert', then do indent at such +% paragraphs. +% +% The paragraph indentation is suppressed or not by calling +% \suppressfirstparagraphindent, which the sectioning commands do. +% We switch the definition of this back and forth according to WORD. +% By default, we suppress indentation. +% +\def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent} +\def\insertword{insert} +% +\parseargdef\firstparagraphindent{% + \def\temp{#1}% + \ifx\temp\noneword + \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent + \else\ifx\temp\insertword + \let\suppressfirstparagraphindent = \relax + \else + \errhelp = \EMsimple + \errmessage{Unknown @firstparagraphindent option `\temp'}% + \fi\fi +} + +% Here is how we actually suppress indentation. Redefine \everypar to +% \kern backwards by \parindent, and then reset itself to empty. +% +% We also make \indent itself not actually do anything until the next +% paragraph. +% +\gdef\dosuppressfirstparagraphindent{% + \gdef\indent{% + \restorefirstparagraphindent + \indent + }% + \gdef\noindent{% + \restorefirstparagraphindent + \noindent + }% + \global\everypar = {% + \kern -\parindent + \restorefirstparagraphindent + }% +} + +\gdef\restorefirstparagraphindent{% + \global \let \indent = \ptexindent + \global \let \noindent = \ptexnoindent + \global \everypar = {}% +} + + +% @asis just yields its argument. Used with @table, for example. +% +\def\asis#1{#1} + +% @math outputs its argument in math mode. +% +% One complication: _ usually means subscripts, but it could also mean +% an actual _ character, as in @math{@var{some_variable} + 1}. So make +% _ active, and distinguish by seeing if the current family is \slfam, +% which is what @var uses. +{ + \catcode\underChar = \active + \gdef\mathunderscore{% + \catcode\underChar=\active + \def_{\ifnum\fam=\slfam \_\else\sb\fi}% + } +} +% Another complication: we want \\ (and @\) to output a \ character. +% FYI, plain.tex uses \\ as a temporary control sequence (why?), but +% this is not advertised and we don't care. Texinfo does not +% otherwise define @\. +% +% The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\. +\def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi} +% +\def\math{% + \tex + \mathunderscore + \let\\ = \mathbackslash + \mathactive + $\finishmath +} +\def\finishmath#1{#1$\endgroup} % Close the group opened by \tex. + +% Some active characters (such as <) are spaced differently in math. +% We have to reset their definitions in case the @math was an argument +% to a command which sets the catcodes (such as @item or @section). +% +{ + \catcode`^ = \active + \catcode`< = \active + \catcode`> = \active + \catcode`+ = \active + \gdef\mathactive{% + \let^ = \ptexhat + \let< = \ptexless + \let> = \ptexgtr + \let+ = \ptexplus + } +} + +% @bullet and @minus need the same treatment as @math, just above. +\def\bullet{$\ptexbullet$} +\def\minus{$-$} + +% @dots{} outputs an ellipsis using the current font. +% We do .5em per period so that it has the same spacing in a typewriter +% font as three actual period characters. +% +\def\dots{% + \leavevmode + \hbox to 1.5em{% + \hskip 0pt plus 0.25fil + .\hfil.\hfil.% + \hskip 0pt plus 0.5fil + }% +} + +% @enddots{} is an end-of-sentence ellipsis. +% +\def\enddots{% + \dots + \spacefactor=3000 +} + +% @comma{} is so commas can be inserted into text without messing up +% Texinfo's parsing. +% +\let\comma = , + +% @refill is a no-op. +\let\refill=\relax + +% If working on a large document in chapters, it is convenient to +% be able to disable indexing, cross-referencing, and contents, for test runs. +% This is done with @novalidate (before @setfilename). +% +\newif\iflinks \linkstrue % by default we want the aux files. +\let\novalidate = \linksfalse + +% @setfilename is done at the beginning of every texinfo file. +% So open here the files we need to have open while reading the input. +% This makes it possible to make a .fmt file for texinfo. +\def\setfilename{% + \fixbackslash % Turn off hack to swallow `\input texinfo'. + \iflinks + \tryauxfile + % Open the new aux file. TeX will close it automatically at exit. + \immediate\openout\auxfile=\jobname.aux + \fi % \openindices needs to do some work in any case. + \openindices + \let\setfilename=\comment % Ignore extra @setfilename cmds. + % + % If texinfo.cnf is present on the system, read it. + % Useful for site-wide @afourpaper, etc. + \openin 1 texinfo.cnf + \ifeof 1 \else \input texinfo.cnf \fi + \closein 1 + % + \comment % Ignore the actual filename. +} + +% Called from \setfilename. +% +\def\openindices{% + \newindex{cp}% + \newcodeindex{fn}% + \newcodeindex{vr}% + \newcodeindex{tp}% + \newcodeindex{ky}% + \newcodeindex{pg}% +} + +% @bye. +\outer\def\bye{\pagealignmacro\tracingstats=1\ptexend} + + +\message{pdf,} +% adobe `portable' document format +\newcount\tempnum +\newcount\lnkcount +\newtoks\filename +\newcount\filenamelength +\newcount\pgn +\newtoks\toksA +\newtoks\toksB +\newtoks\toksC +\newtoks\toksD +\newbox\boxA +\newcount\countA +\newif\ifpdf +\newif\ifpdfmakepagedest + +% when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1 +% can be set). So we test for \relax and 0 as well as \undefined, +% borrowed from ifpdf.sty. +\ifx\pdfoutput\undefined +\else + \ifx\pdfoutput\relax + \else + \ifcase\pdfoutput + \else + \pdftrue + \fi + \fi +\fi +% +\ifpdf + \input pdfcolor + \pdfcatalog{/PageMode /UseOutlines}% + \def\dopdfimage#1#2#3{% + \def\imagewidth{#2}% + \def\imageheight{#3}% + % without \immediate, pdftex seg faults when the same image is + % included twice. (Version 3.14159-pre-1.0-unofficial-20010704.) + \ifnum\pdftexversion < 14 + \immediate\pdfimage + \else + \immediate\pdfximage + \fi + \ifx\empty\imagewidth\else width \imagewidth \fi + \ifx\empty\imageheight\else height \imageheight \fi + \ifnum\pdftexversion<13 + #1.pdf% + \else + {#1.pdf}% + \fi + \ifnum\pdftexversion < 14 \else + \pdfrefximage \pdflastximage + \fi} + \def\pdfmkdest#1{{% + % We have to set dummies so commands such as @code in a section title + % aren't expanded. + \atdummies + \normalturnoffactive + \pdfdest name{#1} xyz% + }} + \def\pdfmkpgn#1{#1} + \let\linkcolor = \Blue % was Cyan, but that seems light? + \def\endlink{\Black\pdfendlink} + % Adding outlines to PDF; macros for calculating structure of outlines + % come from Petr Olsak + \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0% + \else \csname#1\endcsname \fi} + \def\advancenumber#1{\tempnum=\expnumber{#1}\relax + \advance\tempnum by 1 + \expandafter\xdef\csname#1\endcsname{\the\tempnum}} + % + % #1 is the section text. #2 is the pdf expression for the number + % of subentries (or empty, for subsubsections). #3 is the node + % text, which might be empty if this toc entry had no + % corresponding node. #4 is the page number. + % + \def\dopdfoutline#1#2#3#4{% + % Generate a link to the node text if that exists; else, use the + % page number. We could generate a destination for the section + % text in the case where a section has no node, but it doesn't + % seem worthwhile, since most documents are normally structured. + \def\pdfoutlinedest{#3}% + \ifx\pdfoutlinedest\empty \def\pdfoutlinedest{#4}\fi + % + \pdfoutline goto name{\pdfmkpgn{\pdfoutlinedest}}#2{#1}% + } + % + \def\pdfmakeoutlines{% + \begingroup + % Thanh's hack / proper braces in bookmarks + \edef\mylbrace{\iftrue \string{\else}\fi}\let\{=\mylbrace + \edef\myrbrace{\iffalse{\else\string}\fi}\let\}=\myrbrace + % + % Read toc silently, to get counts of subentries for \pdfoutline. + \def\numchapentry##1##2##3##4{% + \def\thischapnum{##2}% + \def\thissecnum{0}% + \def\thissubsecnum{0}% + }% + \def\numsecentry##1##2##3##4{% + \advancenumber{chap\thischapnum}% + \def\thissecnum{##2}% + \def\thissubsecnum{0}% + }% + \def\numsubsecentry##1##2##3##4{% + \advancenumber{sec\thissecnum}% + \def\thissubsecnum{##2}% + }% + \def\numsubsubsecentry##1##2##3##4{% + \advancenumber{subsec\thissubsecnum}% + }% + \def\thischapnum{0}% + \def\thissecnum{0}% + \def\thissubsecnum{0}% + % + % use \def rather than \let here because we redefine \chapentry et + % al. a second time, below. + \def\appentry{\numchapentry}% + \def\appsecentry{\numsecentry}% + \def\appsubsecentry{\numsubsecentry}% + \def\appsubsubsecentry{\numsubsubsecentry}% + \def\unnchapentry{\numchapentry}% + \def\unnsecentry{\numsecentry}% + \def\unnsubsecentry{\numsubsecentry}% + \def\unnsubsubsecentry{\numsubsubsecentry}% + \input \jobname.toc + % + % Read toc second time, this time actually producing the outlines. + % The `-' means take the \expnumber as the absolute number of + % subentries, which we calculated on our first read of the .toc above. + % + % We use the node names as the destinations. + \def\numchapentry##1##2##3##4{% + \dopdfoutline{##1}{count-\expnumber{chap##2}}{##3}{##4}}% + \def\numsecentry##1##2##3##4{% + \dopdfoutline{##1}{count-\expnumber{sec##2}}{##3}{##4}}% + \def\numsubsecentry##1##2##3##4{% + \dopdfoutline{##1}{count-\expnumber{subsec##2}}{##3}{##4}}% + \def\numsubsubsecentry##1##2##3##4{% count is always zero + \dopdfoutline{##1}{}{##3}{##4}}% + % + % PDF outlines are displayed using system fonts, instead of + % document fonts. Therefore we cannot use special characters, + % since the encoding is unknown. For example, the eogonek from + % Latin 2 (0xea) gets translated to a | character. Info from + % Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100. + % + % xx to do this right, we have to translate 8-bit characters to + % their "best" equivalent, based on the @documentencoding. Right + % now, I guess we'll just let the pdf reader have its way. + \indexnofonts + \turnoffactive + \input \jobname.toc + \endgroup + } + % + \def\makelinks #1,{% + \def\params{#1}\def\E{END}% + \ifx\params\E + \let\nextmakelinks=\relax + \else + \let\nextmakelinks=\makelinks + \ifnum\lnkcount>0,\fi + \picknum{#1}% + \startlink attr{/Border [0 0 0]} + goto name{\pdfmkpgn{\the\pgn}}% + \linkcolor #1% + \advance\lnkcount by 1% + \endlink + \fi + \nextmakelinks + } + \def\picknum#1{\expandafter\pn#1} + \def\pn#1{% + \def\p{#1}% + \ifx\p\lbrace + \let\nextpn=\ppn + \else + \let\nextpn=\ppnn + \def\first{#1} + \fi + \nextpn + } + \def\ppn#1{\pgn=#1\gobble} + \def\ppnn{\pgn=\first} + \def\pdfmklnk#1{\lnkcount=0\makelinks #1,END,} + \def\skipspaces#1{\def\PP{#1}\def\D{|}% + \ifx\PP\D\let\nextsp\relax + \else\let\nextsp\skipspaces + \ifx\p\space\else\addtokens{\filename}{\PP}% + \advance\filenamelength by 1 + \fi + \fi + \nextsp} + \def\getfilename#1{\filenamelength=0\expandafter\skipspaces#1|\relax} + \ifnum\pdftexversion < 14 + \let \startlink \pdfannotlink + \else + \let \startlink \pdfstartlink + \fi + \def\pdfurl#1{% + \begingroup + \normalturnoffactive\def\@{@}% + \makevalueexpandable + \leavevmode\Red + \startlink attr{/Border [0 0 0]}% + user{/Subtype /Link /A << /S /URI /URI (#1) >>}% + \endgroup} + \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}} + \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks} + \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks} + \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}} + \def\maketoks{% + \expandafter\poptoks\the\toksA|ENDTOKS|\relax + \ifx\first0\adn0 + \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3 + \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6 + \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9 + \else + \ifnum0=\countA\else\makelink\fi + \ifx\first.\let\next=\done\else + \let\next=\maketoks + \addtokens{\toksB}{\the\toksD} + \ifx\first,\addtokens{\toksB}{\space}\fi + \fi + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi + \next} + \def\makelink{\addtokens{\toksB}% + {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0} + \def\pdflink#1{% + \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}} + \linkcolor #1\endlink} + \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st} +\else + \let\pdfmkdest = \gobble + \let\pdfurl = \gobble + \let\endlink = \relax + \let\linkcolor = \relax + \let\pdfmakeoutlines = \relax +\fi % \ifx\pdfoutput + + +\message{fonts,} + +% Change the current font style to #1, remembering it in \curfontstyle. +% For now, we do not accumulate font styles: @b{@i{foo}} prints foo in +% italics, not bold italics. +% +\def\setfontstyle#1{% + \def\curfontstyle{#1}% not as a control sequence, because we are \edef'd. + \csname ten#1\endcsname % change the current font +} + +% Select #1 fonts with the current style. +% +\def\selectfonts#1{\csname #1fonts\endcsname \csname\curfontstyle\endcsname} + +\def\rm{\fam=0 \setfontstyle{rm}} +\def\it{\fam=\itfam \setfontstyle{it}} +\def\sl{\fam=\slfam \setfontstyle{sl}} +\def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf} +\def\tt{\fam=\ttfam \setfontstyle{tt}} + +% Texinfo sort of supports the sans serif font style, which plain TeX does not. +% So we set up a \sf. +\newfam\sffam +\def\sf{\fam=\sffam \setfontstyle{sf}} +\let\li = \sf % Sometimes we call it \li, not \sf. + +% We don't need math for this font style. +\def\ttsl{\setfontstyle{ttsl}} + +% Default leading. +\newdimen\textleading \textleading = 13.2pt + +% Set the baselineskip to #1, and the lineskip and strut size +% correspondingly. There is no deep meaning behind these magic numbers +% used as factors; they just match (closely enough) what Knuth defined. +% +\def\lineskipfactor{.08333} +\def\strutheightpercent{.70833} +\def\strutdepthpercent {.29167} +% +\def\setleading#1{% + \normalbaselineskip = #1\relax + \normallineskip = \lineskipfactor\normalbaselineskip + \normalbaselines + \setbox\strutbox =\hbox{% + \vrule width0pt height\strutheightpercent\baselineskip + depth \strutdepthpercent \baselineskip + }% +} + +% Set the font macro #1 to the font named #2, adding on the +% specified font prefix (normally `cm'). +% #3 is the font's design size, #4 is a scale factor +\def\setfont#1#2#3#4{\font#1=\fontprefix#2#3 scaled #4} + +% Use cm as the default font prefix. +% To specify the font prefix, you must define \fontprefix +% before you read in texinfo.tex. +\ifx\fontprefix\undefined +\def\fontprefix{cm} +\fi +% Support font families that don't use the same naming scheme as CM. +\def\rmshape{r} +\def\rmbshape{bx} %where the normal face is bold +\def\bfshape{b} +\def\bxshape{bx} +\def\ttshape{tt} +\def\ttbshape{tt} +\def\ttslshape{sltt} +\def\itshape{ti} +\def\itbshape{bxti} +\def\slshape{sl} +\def\slbshape{bxsl} +\def\sfshape{ss} +\def\sfbshape{ss} +\def\scshape{csc} +\def\scbshape{csc} + +% Text fonts (11.2pt, magstep1). +\def\textnominalsize{11pt} +\edef\mainmagstep{\magstephalf} +\setfont\textrm\rmshape{10}{\mainmagstep} +\setfont\texttt\ttshape{10}{\mainmagstep} +\setfont\textbf\bfshape{10}{\mainmagstep} +\setfont\textit\itshape{10}{\mainmagstep} +\setfont\textsl\slshape{10}{\mainmagstep} +\setfont\textsf\sfshape{10}{\mainmagstep} +\setfont\textsc\scshape{10}{\mainmagstep} +\setfont\textttsl\ttslshape{10}{\mainmagstep} +\font\texti=cmmi10 scaled \mainmagstep +\font\textsy=cmsy10 scaled \mainmagstep + +% A few fonts for @defun names and args. +\setfont\defbf\bfshape{10}{\magstep1} +\setfont\deftt\ttshape{10}{\magstep1} +\setfont\defttsl\ttslshape{10}{\magstep1} +\def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf} + +% Fonts for indices, footnotes, small examples (9pt). +\def\smallnominalsize{9pt} +\setfont\smallrm\rmshape{9}{1000} +\setfont\smalltt\ttshape{9}{1000} +\setfont\smallbf\bfshape{10}{900} +\setfont\smallit\itshape{9}{1000} +\setfont\smallsl\slshape{9}{1000} +\setfont\smallsf\sfshape{9}{1000} +\setfont\smallsc\scshape{10}{900} +\setfont\smallttsl\ttslshape{10}{900} +\font\smalli=cmmi9 +\font\smallsy=cmsy9 + +% Fonts for small examples (8pt). +\def\smallernominalsize{8pt} +\setfont\smallerrm\rmshape{8}{1000} +\setfont\smallertt\ttshape{8}{1000} +\setfont\smallerbf\bfshape{10}{800} +\setfont\smallerit\itshape{8}{1000} +\setfont\smallersl\slshape{8}{1000} +\setfont\smallersf\sfshape{8}{1000} +\setfont\smallersc\scshape{10}{800} +\setfont\smallerttsl\ttslshape{10}{800} +\font\smalleri=cmmi8 +\font\smallersy=cmsy8 + +% Fonts for title page (20.4pt): +\def\titlenominalsize{20pt} +\setfont\titlerm\rmbshape{12}{\magstep3} +\setfont\titleit\itbshape{10}{\magstep4} +\setfont\titlesl\slbshape{10}{\magstep4} +\setfont\titlett\ttbshape{12}{\magstep3} +\setfont\titlettsl\ttslshape{10}{\magstep4} +\setfont\titlesf\sfbshape{17}{\magstep1} +\let\titlebf=\titlerm +\setfont\titlesc\scbshape{10}{\magstep4} +\font\titlei=cmmi12 scaled \magstep3 +\font\titlesy=cmsy10 scaled \magstep4 +\def\authorrm{\secrm} +\def\authortt{\sectt} + +% Chapter (and unnumbered) fonts (17.28pt). +\def\chapnominalsize{17pt} +\setfont\chaprm\rmbshape{12}{\magstep2} +\setfont\chapit\itbshape{10}{\magstep3} +\setfont\chapsl\slbshape{10}{\magstep3} +\setfont\chaptt\ttbshape{12}{\magstep2} +\setfont\chapttsl\ttslshape{10}{\magstep3} +\setfont\chapsf\sfbshape{17}{1000} +\let\chapbf=\chaprm +\setfont\chapsc\scbshape{10}{\magstep3} +\font\chapi=cmmi12 scaled \magstep2 +\font\chapsy=cmsy10 scaled \magstep3 + +% Section fonts (14.4pt). +\def\secnominalsize{14pt} +\setfont\secrm\rmbshape{12}{\magstep1} +\setfont\secit\itbshape{10}{\magstep2} +\setfont\secsl\slbshape{10}{\magstep2} +\setfont\sectt\ttbshape{12}{\magstep1} +\setfont\secttsl\ttslshape{10}{\magstep2} +\setfont\secsf\sfbshape{12}{\magstep1} +\let\secbf\secrm +\setfont\secsc\scbshape{10}{\magstep2} +\font\seci=cmmi12 scaled \magstep1 +\font\secsy=cmsy10 scaled \magstep2 + +% Subsection fonts (13.15pt). +\def\ssecnominalsize{13pt} +\setfont\ssecrm\rmbshape{12}{\magstephalf} +\setfont\ssecit\itbshape{10}{1315} +\setfont\ssecsl\slbshape{10}{1315} +\setfont\ssectt\ttbshape{12}{\magstephalf} +\setfont\ssecttsl\ttslshape{10}{1315} +\setfont\ssecsf\sfbshape{12}{\magstephalf} +\let\ssecbf\ssecrm +\setfont\ssecsc\scbshape{10}{1315} +\font\sseci=cmmi12 scaled \magstephalf +\font\ssecsy=cmsy10 scaled 1315 + +% Reduced fonts for @acro in text (10pt). +\def\reducednominalsize{10pt} +\setfont\reducedrm\rmshape{10}{1000} +\setfont\reducedtt\ttshape{10}{1000} +\setfont\reducedbf\bfshape{10}{1000} +\setfont\reducedit\itshape{10}{1000} +\setfont\reducedsl\slshape{10}{1000} +\setfont\reducedsf\sfshape{10}{1000} +\setfont\reducedsc\scshape{10}{1000} +\setfont\reducedttsl\ttslshape{10}{1000} +\font\reducedi=cmmi10 +\font\reducedsy=cmsy10 + +% In order for the font changes to affect most math symbols and letters, +% we have to define the \textfont of the standard families. Since +% texinfo doesn't allow for producing subscripts and superscripts except +% in the main text, we don't bother to reset \scriptfont and +% \scriptscriptfont (which would also require loading a lot more fonts). +% +\def\resetmathfonts{% + \textfont0=\tenrm \textfont1=\teni \textfont2=\tensy + \textfont\itfam=\tenit \textfont\slfam=\tensl \textfont\bffam=\tenbf + \textfont\ttfam=\tentt \textfont\sffam=\tensf +} + +% The font-changing commands redefine the meanings of \tenSTYLE, instead +% of just \STYLE. We do this because \STYLE needs to also set the +% current \fam for math mode. Our \STYLE (e.g., \rm) commands hardwire +% \tenSTYLE to set the current font. +% +% Each font-changing command also sets the names \lsize (one size lower) +% and \lllsize (three sizes lower). These relative commands are used in +% the LaTeX logo and acronyms. +% +% This all needs generalizing, badly. +% +\def\textfonts{% + \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl + \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc + \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy + \let\tenttsl=\textttsl + \def\curfontsize{text}% + \def\lsize{reduced}\def\lllsize{smaller}% + \resetmathfonts \setleading{\textleading}} +\def\titlefonts{% + \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl + \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc + \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy + \let\tenttsl=\titlettsl + \def\curfontsize{title}% + \def\lsize{chap}\def\lllsize{subsec}% + \resetmathfonts \setleading{25pt}} +\def\titlefont#1{{\titlefonts\rm #1}} +\def\chapfonts{% + \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl + \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc + \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy + \let\tenttsl=\chapttsl + \def\curfontsize{chap}% + \def\lsize{sec}\def\lllsize{text}% + \resetmathfonts \setleading{19pt}} +\def\secfonts{% + \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl + \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc + \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy + \let\tenttsl=\secttsl + \def\curfontsize{sec}% + \def\lsize{subsec}\def\lllsize{reduced}% + \resetmathfonts \setleading{16pt}} +\def\subsecfonts{% + \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl + \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc + \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy + \let\tenttsl=\ssecttsl + \def\curfontsize{ssec}% + \def\lsize{text}\def\lllsize{small}% + \resetmathfonts \setleading{15pt}} +\let\subsubsecfonts = \subsecfonts +\def\reducedfonts{% + \let\tenrm=\reducedrm \let\tenit=\reducedit \let\tensl=\reducedsl + \let\tenbf=\reducedbf \let\tentt=\reducedtt \let\reducedcaps=\reducedsc + \let\tensf=\reducedsf \let\teni=\reducedi \let\tensy=\reducedsy + \let\tenttsl=\reducedttsl + \def\curfontsize{reduced}% + \def\lsize{small}\def\lllsize{smaller}% + \resetmathfonts \setleading{10.5pt}} +\def\smallfonts{% + \let\tenrm=\smallrm \let\tenit=\smallit \let\tensl=\smallsl + \let\tenbf=\smallbf \let\tentt=\smalltt \let\smallcaps=\smallsc + \let\tensf=\smallsf \let\teni=\smalli \let\tensy=\smallsy + \let\tenttsl=\smallttsl + \def\curfontsize{small}% + \def\lsize{smaller}\def\lllsize{smaller}% + \resetmathfonts \setleading{10.5pt}} +\def\smallerfonts{% + \let\tenrm=\smallerrm \let\tenit=\smallerit \let\tensl=\smallersl + \let\tenbf=\smallerbf \let\tentt=\smallertt \let\smallcaps=\smallersc + \let\tensf=\smallersf \let\teni=\smalleri \let\tensy=\smallersy + \let\tenttsl=\smallerttsl + \def\curfontsize{smaller}% + \def\lsize{smaller}\def\lllsize{smaller}% + \resetmathfonts \setleading{9.5pt}} + +% Set the fonts to use with the @small... environments. +\let\smallexamplefonts = \smallfonts + +% About \smallexamplefonts. If we use \smallfonts (9pt), @smallexample +% can fit this many characters: +% 8.5x11=86 smallbook=72 a4=90 a5=69 +% If we use \scriptfonts (8pt), then we can fit this many characters: +% 8.5x11=90+ smallbook=80 a4=90+ a5=77 +% For me, subjectively, the few extra characters that fit aren't worth +% the additional smallness of 8pt. So I'm making the default 9pt. +% +% By the way, for comparison, here's what fits with @example (10pt): +% 8.5x11=71 smallbook=60 a4=75 a5=58 +% +% I wish the USA used A4 paper. +% --karl, 24jan03. + + +% Set up the default fonts, so we can use them for creating boxes. +% +\textfonts \rm + +% Define these so they can be easily changed for other fonts. +\def\angleleft{$\langle$} +\def\angleright{$\rangle$} + +% Count depth in font-changes, for error checks +\newcount\fontdepth \fontdepth=0 + +% Fonts for short table of contents. +\setfont\shortcontrm\rmshape{12}{1000} +\setfont\shortcontbf\bfshape{10}{\magstep1} % no cmb12 +\setfont\shortcontsl\slshape{12}{1000} +\setfont\shortconttt\ttshape{12}{1000} + +%% Add scribe-like font environments, plus @l for inline lisp (usually sans +%% serif) and @ii for TeX italic + +% \smartitalic{ARG} outputs arg in italics, followed by an italic correction +% unless the following character is such as not to need one. +\def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else + \ptexslash\fi\fi\fi} +\def\smartslanted#1{{\ifusingtt\ttsl\sl #1}\futurelet\next\smartitalicx} +\def\smartitalic#1{{\ifusingtt\ttsl\it #1}\futurelet\next\smartitalicx} + +% like \smartslanted except unconditionally uses \ttsl. +% @var is set to this for defun arguments. +\def\ttslanted#1{{\ttsl #1}\futurelet\next\smartitalicx} + +% like \smartslanted except unconditionally use \sl. We never want +% ttsl for book titles, do we? +\def\cite#1{{\sl #1}\futurelet\next\smartitalicx} + +\let\i=\smartitalic +\let\slanted=\smartslanted +\let\var=\smartslanted +\let\dfn=\smartslanted +\let\emph=\smartitalic + +% @b, explicit bold. +\def\b#1{{\bf #1}} +\let\strong=\b + +% @sansserif, explicit sans. +\def\sansserif#1{{\sf #1}} + +% We can't just use \exhyphenpenalty, because that only has effect at +% the end of a paragraph. Restore normal hyphenation at the end of the +% group within which \nohyphenation is presumably called. +% +\def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation} +\def\restorehyphenation{\hyphenchar\font = `- } + +% Set sfcode to normal for the chars that usually have another value. +% Can't use plain's \frenchspacing because it uses the `\x notation, and +% sometimes \x has an active definition that messes things up. +% +\catcode`@=11 + \def\frenchspacing{% + \sfcode\dotChar =\@m \sfcode\questChar=\@m \sfcode\exclamChar=\@m + \sfcode\colonChar=\@m \sfcode\semiChar =\@m \sfcode\commaChar =\@m + } +\catcode`@=\other + +\def\t#1{% + {\tt \rawbackslash \frenchspacing #1}% + \null +} +\def\samp#1{`\tclose{#1}'\null} +\setfont\keyrm\rmshape{8}{1000} +\font\keysy=cmsy9 +\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{% + \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{% + \vbox{\hrule\kern-0.4pt + \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}% + \kern-0.4pt\hrule}% + \kern-.06em\raise0.4pt\hbox{\angleright}}}} +% The old definition, with no lozenge: +%\def\key #1{{\ttsl \nohyphenation \uppercase{#1}}\null} +\def\ctrl #1{{\tt \rawbackslash \hat}#1} + +% @file, @option are the same as @samp. +\let\file=\samp +\let\option=\samp + +% @code is a modification of @t, +% which makes spaces the same size as normal in the surrounding text. +\def\tclose#1{% + {% + % Change normal interword space to be same as for the current font. + \spaceskip = \fontdimen2\font + % + % Switch to typewriter. + \tt + % + % But `\ ' produces the large typewriter interword space. + \def\ {{\spaceskip = 0pt{} }}% + % + % Turn off hyphenation. + \nohyphenation + % + \rawbackslash + \frenchspacing + #1% + }% + \null +} + +% We *must* turn on hyphenation at `-' and `_' in @code. +% Otherwise, it is too hard to avoid overfull hboxes +% in the Emacs manual, the Library manual, etc. + +% Unfortunately, TeX uses one parameter (\hyphenchar) to control +% both hyphenation at - and hyphenation within words. +% We must therefore turn them both off (\tclose does that) +% and arrange explicitly to hyphenate at a dash. +% -- rms. +{ + \catcode`\-=\active + \catcode`\_=\active + % + \global\def\code{\begingroup + \catcode`\-=\active \let-\codedash + \catcode`\_=\active \let_\codeunder + \codex + } +} + +\def\realdash{-} +\def\codedash{-\discretionary{}{}{}} +\def\codeunder{% + % this is all so @math{@code{var_name}+1} can work. In math mode, _ + % is "active" (mathcode"8000) and \normalunderscore (or \char95, etc.) + % will therefore expand the active definition of _, which is us + % (inside @code that is), therefore an endless loop. + \ifusingtt{\ifmmode + \mathchar"075F % class 0=ordinary, family 7=ttfam, pos 0x5F=_. + \else\normalunderscore \fi + \discretionary{}{}{}}% + {\_}% +} +\def\codex #1{\tclose{#1}\endgroup} + +% @kbd is like @code, except that if the argument is just one @key command, +% then @kbd has no effect. + +% @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always), +% `example' (@kbd uses ttsl only inside of @example and friends), +% or `code' (@kbd uses normal tty font always). +\parseargdef\kbdinputstyle{% + \def\arg{#1}% + \ifx\arg\worddistinct + \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}% + \else\ifx\arg\wordexample + \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}% + \else\ifx\arg\wordcode + \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}% + \else + \errhelp = \EMsimple + \errmessage{Unknown @kbdinputstyle option `\arg'}% + \fi\fi\fi +} +\def\worddistinct{distinct} +\def\wordexample{example} +\def\wordcode{code} + +% Default is `distinct.' +\kbdinputstyle distinct + +\def\xkey{\key} +\def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}% +\ifx\one\xkey\ifx\threex\three \key{#2}% +\else{\tclose{\kbdfont\look}}\fi +\else{\tclose{\kbdfont\look}}\fi} + +% For @indicateurl, @env, @command quotes seem unnecessary, so use \code. +\let\indicateurl=\code +\let\env=\code +\let\command=\code + +% @uref (abbreviation for `urlref') takes an optional (comma-separated) +% second argument specifying the text to display and an optional third +% arg as text to display instead of (rather than in addition to) the url +% itself. First (mandatory) arg is the url. Perhaps eventually put in +% a hypertex \special here. +% +\def\uref#1{\douref #1,,,\finish} +\def\douref#1,#2,#3,#4\finish{\begingroup + \unsepspaces + \pdfurl{#1}% + \setbox0 = \hbox{\ignorespaces #3}% + \ifdim\wd0 > 0pt + \unhbox0 % third arg given, show only that + \else + \setbox0 = \hbox{\ignorespaces #2}% + \ifdim\wd0 > 0pt + \ifpdf + \unhbox0 % PDF: 2nd arg given, show only it + \else + \unhbox0\ (\code{#1})% DVI: 2nd arg given, show both it and url + \fi + \else + \code{#1}% only url given, so show it + \fi + \fi + \endlink +\endgroup} + +% @url synonym for @uref, since that's how everyone uses it. +% +\let\url=\uref + +% rms does not like angle brackets --karl, 17may97. +% So now @email is just like @uref, unless we are pdf. +% +%\def\email#1{\angleleft{\tt #1}\angleright} +\ifpdf + \def\email#1{\doemail#1,,\finish} + \def\doemail#1,#2,#3\finish{\begingroup + \unsepspaces + \pdfurl{mailto:#1}% + \setbox0 = \hbox{\ignorespaces #2}% + \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi + \endlink + \endgroup} +\else + \let\email=\uref +\fi + +% Check if we are currently using a typewriter font. Since all the +% Computer Modern typewriter fonts have zero interword stretch (and +% shrink), and it is reasonable to expect all typewriter fonts to have +% this property, we can check that font parameter. +% +\def\ifmonospace{\ifdim\fontdimen3\font=0pt } + +% Typeset a dimension, e.g., `in' or `pt'. The only reason for the +% argument is to make the input look right: @dmn{pt} instead of @dmn{}pt. +% +\def\dmn#1{\thinspace #1} + +\def\kbd#1{\def\look{#1}\expandafter\kbdfoo\look??\par} + +% @l was never documented to mean ``switch to the Lisp font'', +% and it is not used as such in any manual I can find. We need it for +% Polish suppressed-l. --karl, 22sep96. +%\def\l#1{{\li #1}\null} + +% Explicit font changes: @r, @sc, undocumented @ii. +\def\r#1{{\rm #1}} % roman font +\def\sc#1{{\smallcaps#1}} % smallcaps font +\def\ii#1{{\it #1}} % italic font + +% @acronym for "FBI", "NATO", and the like. +% We print this one point size smaller, since it's intended for +% all-uppercase. +% +\def\acronym#1{\doacronym #1,,\finish} +\def\doacronym#1,#2,#3\finish{% + {\selectfonts\lsize #1}% + \def\temp{#2}% + \ifx\temp\empty \else + \space ({\unsepspaces \ignorespaces \temp \unskip})% + \fi +} + +% @abbr for "Comput. J." and the like. +% No font change, but don't do end-of-sentence spacing. +% +\def\abbr#1{\doabbr #1,,\finish} +\def\doabbr#1,#2,#3\finish{% + {\frenchspacing #1}% + \def\temp{#2}% + \ifx\temp\empty \else + \space ({\unsepspaces \ignorespaces \temp \unskip})% + \fi +} + +% @pounds{} is a sterling sign, which Knuth put in the CM italic font. +% +\def\pounds{{\it\$}} + +% @euro{} comes from a separate font, depending on the current style. +% We use the free feym* fonts from the eurosym package by Henrik +% Theiling, which support regular, slanted, bold and bold slanted (and +% "outlined" (blackboard board, sort of) versions, which we don't need). +% It is available from http://www.ctan.org/tex-archive/fonts/eurosym. +% +% Although only regular is the truly official Euro symbol, we ignore +% that. The Euro is designed to be slightly taller than the regular +% font height. +% +% feymr - regular +% feymo - slanted +% feybr - bold +% feybo - bold slanted +% +% There is no good (free) typewriter version, to my knowledge. +% A feymr10 euro is ~7.3pt wide, while a normal cmtt10 char is ~5.25pt wide. +% Hmm. +% +% Also doesn't work in math. Do we need to do math with euro symbols? +% Hope not. +% +% +\def\euro{{\eurofont e}} +\def\eurofont{% + % We set the font at each command, rather than predefining it in + % \textfonts and the other font-switching commands, so that + % installations which never need the symbold don't have to have the + % font installed. + % + % There is only one designed size (nominal 10pt), so we always scale + % that to the current nominal size. + % + % By the way, simply using "at 1em" works for cmr10 and the like, but + % does not work for cmbx10 and other extended/shrunken fonts. + % + \def\eurosize{\csname\curfontsize nominalsize\endcsname}% + % + \ifx\curfontstyle\bfstylename + % bold: + \font\thiseurofont = \ifusingit{feybo10}{feybr10} at \eurosize + \else + % regular: + \font\thiseurofont = \ifusingit{feymo10}{feymr10} at \eurosize + \fi + \thiseurofont +} + +% @registeredsymbol - R in a circle. The font for the R should really +% be smaller yet, but lllsize is the best we can do for now. +% Adapted from the plain.tex definition of \copyright. +% +\def\registeredsymbol{% + $^{{\ooalign{\hfil\raise.07ex\hbox{\selectfonts\lllsize R}% + \hfil\crcr\Orb}}% + }$% +} + +% Laurent Siebenmann reports \Orb undefined with: +% Textures 1.7.7 (preloaded format=plain 93.10.14) (68K) 16 APR 2004 02:38 +% so we'll define it if necessary. +% +\ifx\Orb\undefined +\def\Orb{\mathhexbox20D} +\fi + + +\message{page headings,} + +\newskip\titlepagetopglue \titlepagetopglue = 1.5in +\newskip\titlepagebottomglue \titlepagebottomglue = 2pc + +% First the title page. Must do @settitle before @titlepage. +\newif\ifseenauthor +\newif\iffinishedtitlepage + +% Do an implicit @contents or @shortcontents after @end titlepage if the +% user says @setcontentsaftertitlepage or @setshortcontentsaftertitlepage. +% +\newif\ifsetcontentsaftertitlepage + \let\setcontentsaftertitlepage = \setcontentsaftertitlepagetrue +\newif\ifsetshortcontentsaftertitlepage + \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue + +\parseargdef\shorttitlepage{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}% + \endgroup\page\hbox{}\page} + +\envdef\titlepage{% + % Open one extra group, as we want to close it in the middle of \Etitlepage. + \begingroup + \parindent=0pt \textfonts + % Leave some space at the very top of the page. + \vglue\titlepagetopglue + % No rule at page bottom unless we print one at the top with @title. + \finishedtitlepagetrue + % + % Most title ``pages'' are actually two pages long, with space + % at the top of the second. We don't want the ragged left on the second. + \let\oldpage = \page + \def\page{% + \iffinishedtitlepage\else + \finishtitlepage + \fi + \let\page = \oldpage + \page + \null + }% +} + +\def\Etitlepage{% + \iffinishedtitlepage\else + \finishtitlepage + \fi + % It is important to do the page break before ending the group, + % because the headline and footline are only empty inside the group. + % If we use the new definition of \page, we always get a blank page + % after the title page, which we certainly don't want. + \oldpage + \endgroup + % + % Need this before the \...aftertitlepage checks so that if they are + % in effect the toc pages will come out with page numbers. + \HEADINGSon + % + % If they want short, they certainly want long too. + \ifsetshortcontentsaftertitlepage + \shortcontents + \contents + \global\let\shortcontents = \relax + \global\let\contents = \relax + \fi + % + \ifsetcontentsaftertitlepage + \contents + \global\let\contents = \relax + \global\let\shortcontents = \relax + \fi +} + +\def\finishtitlepage{% + \vskip4pt \hrule height 2pt width \hsize + \vskip\titlepagebottomglue + \finishedtitlepagetrue +} + +%%% Macros to be used within @titlepage: + +\let\subtitlerm=\tenrm +\def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines} + +\def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines + \let\tt=\authortt} + +\parseargdef\title{% + \checkenv\titlepage + \leftline{\titlefonts\rm #1} + % print a rule at the page bottom also. + \finishedtitlepagefalse + \vskip4pt \hrule height 4pt width \hsize \vskip4pt +} + +\parseargdef\subtitle{% + \checkenv\titlepage + {\subtitlefont \rightline{#1}}% +} + +% @author should come last, but may come many times. +% It can also be used inside @quotation. +% +\parseargdef\author{% + \def\temp{\quotation}% + \ifx\thisenv\temp + \def\quotationauthor{#1}% printed in \Equotation. + \else + \checkenv\titlepage + \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi + {\authorfont \leftline{#1}}% + \fi +} + + +%%% Set up page headings and footings. + +\let\thispage=\folio + +\newtoks\evenheadline % headline on even pages +\newtoks\oddheadline % headline on odd pages +\newtoks\evenfootline % footline on even pages +\newtoks\oddfootline % footline on odd pages + +% Now make TeX use those variables +\headline={{\textfonts\rm \ifodd\pageno \the\oddheadline + \else \the\evenheadline \fi}} +\footline={{\textfonts\rm \ifodd\pageno \the\oddfootline + \else \the\evenfootline \fi}\HEADINGShook} +\let\HEADINGShook=\relax + +% Commands to set those variables. +% For example, this is what @headings on does +% @evenheading @thistitle|@thispage|@thischapter +% @oddheading @thischapter|@thispage|@thistitle +% @evenfooting @thisfile|| +% @oddfooting ||@thisfile + + +\def\evenheading{\parsearg\evenheadingxxx} +\def\evenheadingxxx #1{\evenheadingyyy #1\|\|\|\|\finish} +\def\evenheadingyyy #1\|#2\|#3\|#4\finish{% +\global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} + +\def\oddheading{\parsearg\oddheadingxxx} +\def\oddheadingxxx #1{\oddheadingyyy #1\|\|\|\|\finish} +\def\oddheadingyyy #1\|#2\|#3\|#4\finish{% +\global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} + +\parseargdef\everyheading{\oddheadingxxx{#1}\evenheadingxxx{#1}}% + +\def\evenfooting{\parsearg\evenfootingxxx} +\def\evenfootingxxx #1{\evenfootingyyy #1\|\|\|\|\finish} +\def\evenfootingyyy #1\|#2\|#3\|#4\finish{% +\global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} + +\def\oddfooting{\parsearg\oddfootingxxx} +\def\oddfootingxxx #1{\oddfootingyyy #1\|\|\|\|\finish} +\def\oddfootingyyy #1\|#2\|#3\|#4\finish{% + \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}% + % + % Leave some space for the footline. Hopefully ok to assume + % @evenfooting will not be used by itself. + \global\advance\pageheight by -\baselineskip + \global\advance\vsize by -\baselineskip +} + +\parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}} + + +% @headings double turns headings on for double-sided printing. +% @headings single turns headings on for single-sided printing. +% @headings off turns them off. +% @headings on same as @headings double, retained for compatibility. +% @headings after turns on double-sided headings after this page. +% @headings doubleafter turns on double-sided headings after this page. +% @headings singleafter turns on single-sided headings after this page. +% By default, they are off at the start of a document, +% and turned `on' after @end titlepage. + +\def\headings #1 {\csname HEADINGS#1\endcsname} + +\def\HEADINGSoff{% +\global\evenheadline={\hfil} \global\evenfootline={\hfil} +\global\oddheadline={\hfil} \global\oddfootline={\hfil}} +\HEADINGSoff +% When we turn headings on, set the page number to 1. +% For double-sided printing, put current file name in lower left corner, +% chapter name on inside top of right hand pages, document +% title on inside top of left hand pages, and page numbers on outside top +% edge of all pages. +\def\HEADINGSdouble{% +\global\pageno=1 +\global\evenfootline={\hfil} +\global\oddfootline={\hfil} +\global\evenheadline={\line{\folio\hfil\thistitle}} +\global\oddheadline={\line{\thischapter\hfil\folio}} +\global\let\contentsalignmacro = \chapoddpage +} +\let\contentsalignmacro = \chappager + +% For single-sided printing, chapter title goes across top left of page, +% page number on top right. +\def\HEADINGSsingle{% +\global\pageno=1 +\global\evenfootline={\hfil} +\global\oddfootline={\hfil} +\global\evenheadline={\line{\thischapter\hfil\folio}} +\global\oddheadline={\line{\thischapter\hfil\folio}} +\global\let\contentsalignmacro = \chappager +} +\def\HEADINGSon{\HEADINGSdouble} + +\def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex} +\let\HEADINGSdoubleafter=\HEADINGSafter +\def\HEADINGSdoublex{% +\global\evenfootline={\hfil} +\global\oddfootline={\hfil} +\global\evenheadline={\line{\folio\hfil\thistitle}} +\global\oddheadline={\line{\thischapter\hfil\folio}} +\global\let\contentsalignmacro = \chapoddpage +} + +\def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex} +\def\HEADINGSsinglex{% +\global\evenfootline={\hfil} +\global\oddfootline={\hfil} +\global\evenheadline={\line{\thischapter\hfil\folio}} +\global\oddheadline={\line{\thischapter\hfil\folio}} +\global\let\contentsalignmacro = \chappager +} + +% Subroutines used in generating headings +% This produces Day Month Year style of output. +% Only define if not already defined, in case a txi-??.tex file has set +% up a different format (e.g., txi-cs.tex does this). +\ifx\today\undefined +\def\today{% + \number\day\space + \ifcase\month + \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr + \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug + \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec + \fi + \space\number\year} +\fi + +% @settitle line... specifies the title of the document, for headings. +% It generates no output of its own. +\def\thistitle{\putwordNoTitle} +\def\settitle{\parsearg{\gdef\thistitle}} + + +\message{tables,} +% Tables -- @table, @ftable, @vtable, @item(x). + +% default indentation of table text +\newdimen\tableindent \tableindent=.8in +% default indentation of @itemize and @enumerate text +\newdimen\itemindent \itemindent=.3in +% margin between end of table item and start of table text. +\newdimen\itemmargin \itemmargin=.1in + +% used internally for \itemindent minus \itemmargin +\newdimen\itemmax + +% Note @table, @ftable, and @vtable define @item, @itemx, etc., with +% these defs. +% They also define \itemindex +% to index the item name in whatever manner is desired (perhaps none). + +\newif\ifitemxneedsnegativevskip + +\def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi} + +\def\internalBitem{\smallbreak \parsearg\itemzzz} +\def\internalBitemx{\itemxpar \parsearg\itemzzz} + +\def\itemzzz #1{\begingroup % + \advance\hsize by -\rightskip + \advance\hsize by -\tableindent + \setbox0=\hbox{\itemindicate{#1}}% + \itemindex{#1}% + \nobreak % This prevents a break before @itemx. + % + % If the item text does not fit in the space we have, put it on a line + % by itself, and do not allow a page break either before or after that + % line. We do not start a paragraph here because then if the next + % command is, e.g., @kindex, the whatsit would get put into the + % horizontal list on a line by itself, resulting in extra blank space. + \ifdim \wd0>\itemmax + % + % Make this a paragraph so we get the \parskip glue and wrapping, + % but leave it ragged-right. + \begingroup + \advance\leftskip by-\tableindent + \advance\hsize by\tableindent + \advance\rightskip by0pt plus1fil + \leavevmode\unhbox0\par + \endgroup + % + % We're going to be starting a paragraph, but we don't want the + % \parskip glue -- logically it's part of the @item we just started. + \nobreak \vskip-\parskip + % + % Stop a page break at the \parskip glue coming up. However, if + % what follows is an environment such as @example, there will be no + % \parskip glue; then the negative vskip we just inserted would + % cause the example and the item to crash together. So we use this + % bizarre value of 10001 as a signal to \aboveenvbreak to insert + % \parskip glue after all. Section titles are handled this way also. + % + \penalty 10001 + \endgroup + \itemxneedsnegativevskipfalse + \else + % The item text fits into the space. Start a paragraph, so that the + % following text (if any) will end up on the same line. + \noindent + % Do this with kerns and \unhbox so that if there is a footnote in + % the item text, it can migrate to the main vertical list and + % eventually be printed. + \nobreak\kern-\tableindent + \dimen0 = \itemmax \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0 + \unhbox0 + \nobreak\kern\dimen0 + \endgroup + \itemxneedsnegativevskiptrue + \fi +} + +\def\item{\errmessage{@item while not in a list environment}} +\def\itemx{\errmessage{@itemx while not in a list environment}} + +% @table, @ftable, @vtable. +\envdef\table{% + \let\itemindex\gobble + \tablecheck{table}% +} +\envdef\ftable{% + \def\itemindex ##1{\doind {fn}{\code{##1}}}% + \tablecheck{ftable}% +} +\envdef\vtable{% + \def\itemindex ##1{\doind {vr}{\code{##1}}}% + \tablecheck{vtable}% +} +\def\tablecheck#1{% + \ifnum \the\catcode`\^^M=\active + \endgroup + \errmessage{This command won't work in this context; perhaps the problem is + that we are \inenvironment\thisenv}% + \def\next{\doignore{#1}}% + \else + \let\next\tablex + \fi + \next +} +\def\tablex#1{% + \def\itemindicate{#1}% + \parsearg\tabley +} +\def\tabley#1{% + {% + \makevalueexpandable + \edef\temp{\noexpand\tablez #1\space\space\space}% + \expandafter + }\temp \endtablez +} +\def\tablez #1 #2 #3 #4\endtablez{% + \aboveenvbreak + \ifnum 0#1>0 \advance \leftskip by #1\mil \fi + \ifnum 0#2>0 \tableindent=#2\mil \fi + \ifnum 0#3>0 \advance \rightskip by #3\mil \fi + \itemmax=\tableindent + \advance \itemmax by -\itemmargin + \advance \leftskip by \tableindent + \exdentamount=\tableindent + \parindent = 0pt + \parskip = \smallskipamount + \ifdim \parskip=0pt \parskip=2pt \fi + \let\item = \internalBitem + \let\itemx = \internalBitemx +} +\def\Etable{\endgraf\afterenvbreak} +\let\Eftable\Etable +\let\Evtable\Etable +\let\Eitemize\Etable +\let\Eenumerate\Etable + +% This is the counter used by @enumerate, which is really @itemize + +\newcount \itemno + +\envdef\itemize{\parsearg\doitemize} + +\def\doitemize#1{% + \aboveenvbreak + \itemmax=\itemindent + \advance\itemmax by -\itemmargin + \advance\leftskip by \itemindent + \exdentamount=\itemindent + \parindent=0pt + \parskip=\smallskipamount + \ifdim\parskip=0pt \parskip=2pt \fi + \def\itemcontents{#1}% + % @itemize with no arg is equivalent to @itemize @bullet. + \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi + \let\item=\itemizeitem +} + +% Definition of @item while inside @itemize and @enumerate. +% +\def\itemizeitem{% + \advance\itemno by 1 % for enumerations + {\let\par=\endgraf \smallbreak}% reasonable place to break + {% + % If the document has an @itemize directly after a section title, a + % \nobreak will be last on the list, and \sectionheading will have + % done a \vskip-\parskip. In that case, we don't want to zero + % parskip, or the item text will crash with the heading. On the + % other hand, when there is normal text preceding the item (as there + % usually is), we do want to zero parskip, or there would be too much + % space. In that case, we won't have a \nobreak before. At least + % that's the theory. + \ifnum\lastpenalty<10000 \parskip=0in \fi + \noindent + \hbox to 0pt{\hss \itemcontents \kern\itemmargin}% + \vadjust{\penalty 1200}}% not good to break after first line of item. + \flushcr +} + +% \splitoff TOKENS\endmark defines \first to be the first token in +% TOKENS, and \rest to be the remainder. +% +\def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}% + +% Allow an optional argument of an uppercase letter, lowercase letter, +% or number, to specify the first label in the enumerated list. No +% argument is the same as `1'. +% +\envparseargdef\enumerate{\enumeratey #1 \endenumeratey} +\def\enumeratey #1 #2\endenumeratey{% + % If we were given no argument, pretend we were given `1'. + \def\thearg{#1}% + \ifx\thearg\empty \def\thearg{1}\fi + % + % Detect if the argument is a single token. If so, it might be a + % letter. Otherwise, the only valid thing it can be is a number. + % (We will always have one token, because of the test we just made. + % This is a good thing, since \splitoff doesn't work given nothing at + % all -- the first parameter is undelimited.) + \expandafter\splitoff\thearg\endmark + \ifx\rest\empty + % Only one token in the argument. It could still be anything. + % A ``lowercase letter'' is one whose \lccode is nonzero. + % An ``uppercase letter'' is one whose \lccode is both nonzero, and + % not equal to itself. + % Otherwise, we assume it's a number. + % + % We need the \relax at the end of the \ifnum lines to stop TeX from + % continuing to look for a . + % + \ifnum\lccode\expandafter`\thearg=0\relax + \numericenumerate % a number (we hope) + \else + % It's a letter. + \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax + \lowercaseenumerate % lowercase letter + \else + \uppercaseenumerate % uppercase letter + \fi + \fi + \else + % Multiple tokens in the argument. We hope it's a number. + \numericenumerate + \fi +} + +% An @enumerate whose labels are integers. The starting integer is +% given in \thearg. +% +\def\numericenumerate{% + \itemno = \thearg + \startenumeration{\the\itemno}% +} + +% The starting (lowercase) letter is in \thearg. +\def\lowercaseenumerate{% + \itemno = \expandafter`\thearg + \startenumeration{% + % Be sure we're not beyond the end of the alphabet. + \ifnum\itemno=0 + \errmessage{No more lowercase letters in @enumerate; get a bigger + alphabet}% + \fi + \char\lccode\itemno + }% +} + +% The starting (uppercase) letter is in \thearg. +\def\uppercaseenumerate{% + \itemno = \expandafter`\thearg + \startenumeration{% + % Be sure we're not beyond the end of the alphabet. + \ifnum\itemno=0 + \errmessage{No more uppercase letters in @enumerate; get a bigger + alphabet} + \fi + \char\uccode\itemno + }% +} + +% Call \doitemize, adding a period to the first argument and supplying the +% common last two arguments. Also subtract one from the initial value in +% \itemno, since @item increments \itemno. +% +\def\startenumeration#1{% + \advance\itemno by -1 + \doitemize{#1.}\flushcr +} + +% @alphaenumerate and @capsenumerate are abbreviations for giving an arg +% to @enumerate. +% +\def\alphaenumerate{\enumerate{a}} +\def\capsenumerate{\enumerate{A}} +\def\Ealphaenumerate{\Eenumerate} +\def\Ecapsenumerate{\Eenumerate} + + +% @multitable macros +% Amy Hendrickson, 8/18/94, 3/6/96 +% +% @multitable ... @end multitable will make as many columns as desired. +% Contents of each column will wrap at width given in preamble. Width +% can be specified either with sample text given in a template line, +% or in percent of \hsize, the current width of text on page. + +% Table can continue over pages but will only break between lines. + +% To make preamble: +% +% Either define widths of columns in terms of percent of \hsize: +% @multitable @columnfractions .25 .3 .45 +% @item ... +% +% Numbers following @columnfractions are the percent of the total +% current hsize to be used for each column. You may use as many +% columns as desired. + + +% Or use a template: +% @multitable {Column 1 template} {Column 2 template} {Column 3 template} +% @item ... +% using the widest term desired in each column. + +% Each new table line starts with @item, each subsequent new column +% starts with @tab. Empty columns may be produced by supplying @tab's +% with nothing between them for as many times as empty columns are needed, +% ie, @tab@tab@tab will produce two empty columns. + +% @item, @tab do not need to be on their own lines, but it will not hurt +% if they are. + +% Sample multitable: + +% @multitable {Column 1 template} {Column 2 template} {Column 3 template} +% @item first col stuff @tab second col stuff @tab third col +% @item +% first col stuff +% @tab +% second col stuff +% @tab +% third col +% @item first col stuff @tab second col stuff +% @tab Many paragraphs of text may be used in any column. +% +% They will wrap at the width determined by the template. +% @item@tab@tab This will be in third column. +% @end multitable + +% Default dimensions may be reset by user. +% @multitableparskip is vertical space between paragraphs in table. +% @multitableparindent is paragraph indent in table. +% @multitablecolmargin is horizontal space to be left between columns. +% @multitablelinespace is space to leave between table items, baseline +% to baseline. +% 0pt means it depends on current normal line spacing. +% +\newskip\multitableparskip +\newskip\multitableparindent +\newdimen\multitablecolspace +\newskip\multitablelinespace +\multitableparskip=0pt +\multitableparindent=6pt +\multitablecolspace=12pt +\multitablelinespace=0pt + +% Macros used to set up halign preamble: +% +\let\endsetuptable\relax +\def\xendsetuptable{\endsetuptable} +\let\columnfractions\relax +\def\xcolumnfractions{\columnfractions} +\newif\ifsetpercent + +% #1 is the @columnfraction, usually a decimal number like .5, but might +% be just 1. We just use it, whatever it is. +% +\def\pickupwholefraction#1 {% + \global\advance\colcount by 1 + \expandafter\xdef\csname col\the\colcount\endcsname{#1\hsize}% + \setuptable +} + +\newcount\colcount +\def\setuptable#1{% + \def\firstarg{#1}% + \ifx\firstarg\xendsetuptable + \let\go = \relax + \else + \ifx\firstarg\xcolumnfractions + \global\setpercenttrue + \else + \ifsetpercent + \let\go\pickupwholefraction + \else + \global\advance\colcount by 1 + \setbox0=\hbox{#1\unskip\space}% Add a normal word space as a + % separator; typically that is always in the input, anyway. + \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}% + \fi + \fi + \ifx\go\pickupwholefraction + % Put the argument back for the \pickupwholefraction call, so + % we'll always have a period there to be parsed. + \def\go{\pickupwholefraction#1}% + \else + \let\go = \setuptable + \fi% + \fi + \go +} + +% multitable-only commands. +% +% @headitem starts a heading row, which we typeset in bold. +% Assignments have to be global since we are inside the implicit group +% of an alignment entry. Note that \everycr resets \everytab. +\def\headitem{\checkenv\multitable \crcr \global\everytab={\bf}\the\everytab}% +% +% A \tab used to include \hskip1sp. But then the space in a template +% line is not enough. That is bad. So let's go back to just `&' until +% we encounter the problem it was intended to solve again. +% --karl, nathan@acm.org, 20apr99. +\def\tab{\checkenv\multitable &\the\everytab}% + +% @multitable ... @end multitable definitions: +% +\newtoks\everytab % insert after every tab. +% +\envdef\multitable{% + \vskip\parskip + \startsavinginserts + % + % @item within a multitable starts a normal row. + % We use \def instead of \let so that if one of the multitable entries + % contains an @itemize, we don't choke on the \item (seen as \crcr aka + % \endtemplate) expanding \doitemize. + \def\item{\crcr}% + % + \tolerance=9500 + \hbadness=9500 + \setmultitablespacing + \parskip=\multitableparskip + \parindent=\multitableparindent + \overfullrule=0pt + \global\colcount=0 + % + \everycr = {% + \noalign{% + \global\everytab={}% + \global\colcount=0 % Reset the column counter. + % Check for saved footnotes, etc. + \checkinserts + % Keeps underfull box messages off when table breaks over pages. + %\filbreak + % Maybe so, but it also creates really weird page breaks when the + % table breaks over pages. Wouldn't \vfil be better? Wait until the + % problem manifests itself, so it can be fixed for real --karl. + }% + }% + % + \parsearg\domultitable +} +\def\domultitable#1{% + % To parse everything between @multitable and @item: + \setuptable#1 \endsetuptable + % + % This preamble sets up a generic column definition, which will + % be used as many times as user calls for columns. + % \vtop will set a single line and will also let text wrap and + % continue for many paragraphs if desired. + \halign\bgroup &% + \global\advance\colcount by 1 + \multistrut + \vtop{% + % Use the current \colcount to find the correct column width: + \hsize=\expandafter\csname col\the\colcount\endcsname + % + % In order to keep entries from bumping into each other + % we will add a \leftskip of \multitablecolspace to all columns after + % the first one. + % + % If a template has been used, we will add \multitablecolspace + % to the width of each template entry. + % + % If the user has set preamble in terms of percent of \hsize we will + % use that dimension as the width of the column, and the \leftskip + % will keep entries from bumping into each other. Table will start at + % left margin and final column will justify at right margin. + % + % Make sure we don't inherit \rightskip from the outer environment. + \rightskip=0pt + \ifnum\colcount=1 + % The first column will be indented with the surrounding text. + \advance\hsize by\leftskip + \else + \ifsetpercent \else + % If user has not set preamble in terms of percent of \hsize + % we will advance \hsize by \multitablecolspace. + \advance\hsize by \multitablecolspace + \fi + % In either case we will make \leftskip=\multitablecolspace: + \leftskip=\multitablecolspace + \fi + % Ignoring space at the beginning and end avoids an occasional spurious + % blank line, when TeX decides to break the line at the space before the + % box from the multistrut, so the strut ends up on a line by itself. + % For example: + % @multitable @columnfractions .11 .89 + % @item @code{#} + % @tab Legal holiday which is valid in major parts of the whole country. + % Is automatically provided with highlighting sequences respectively + % marking characters. + \noindent\ignorespaces##\unskip\multistrut + }\cr +} +\def\Emultitable{% + \crcr + \egroup % end the \halign + \global\setpercentfalse +} + +\def\setmultitablespacing{% + \def\multistrut{\strut}% just use the standard line spacing + % + % Compute \multitablelinespace (if not defined by user) for use in + % \multitableparskip calculation. We used define \multistrut based on + % this, but (ironically) that caused the spacing to be off. + % See bug-texinfo report from Werner Lemberg, 31 Oct 2004 12:52:20 +0100. +\ifdim\multitablelinespace=0pt +\setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip +\global\advance\multitablelinespace by-\ht0 +\fi +%% Test to see if parskip is larger than space between lines of +%% table. If not, do nothing. +%% If so, set to same dimension as multitablelinespace. +\ifdim\multitableparskip>\multitablelinespace +\global\multitableparskip=\multitablelinespace +\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller + %% than skip between lines in the table. +\fi% +\ifdim\multitableparskip=0pt +\global\multitableparskip=\multitablelinespace +\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller + %% than skip between lines in the table. +\fi} + + +\message{conditionals,} + +% @iftex, @ifnotdocbook, @ifnothtml, @ifnotinfo, @ifnotplaintext, +% @ifnotxml always succeed. They currently do nothing; we don't +% attempt to check whether the conditionals are properly nested. But we +% have to remember that they are conditionals, so that @end doesn't +% attempt to close an environment group. +% +\def\makecond#1{% + \expandafter\let\csname #1\endcsname = \relax + \expandafter\let\csname iscond.#1\endcsname = 1 +} +\makecond{iftex} +\makecond{ifnotdocbook} +\makecond{ifnothtml} +\makecond{ifnotinfo} +\makecond{ifnotplaintext} +\makecond{ifnotxml} + +% Ignore @ignore, @ifhtml, @ifinfo, and the like. +% +\def\direntry{\doignore{direntry}} +\def\documentdescription{\doignore{documentdescription}} +\def\docbook{\doignore{docbook}} +\def\html{\doignore{html}} +\def\ifdocbook{\doignore{ifdocbook}} +\def\ifhtml{\doignore{ifhtml}} +\def\ifinfo{\doignore{ifinfo}} +\def\ifnottex{\doignore{ifnottex}} +\def\ifplaintext{\doignore{ifplaintext}} +\def\ifxml{\doignore{ifxml}} +\def\ignore{\doignore{ignore}} +\def\menu{\doignore{menu}} +\def\xml{\doignore{xml}} + +% Ignore text until a line `@end #1', keeping track of nested conditionals. +% +% A count to remember the depth of nesting. +\newcount\doignorecount + +\def\doignore#1{\begingroup + % Scan in ``verbatim'' mode: + \catcode`\@ = \other + \catcode`\{ = \other + \catcode`\} = \other + % + % Make sure that spaces turn into tokens that match what \doignoretext wants. + \spaceisspace + % + % Count number of #1's that we've seen. + \doignorecount = 0 + % + % Swallow text until we reach the matching `@end #1'. + \dodoignore{#1}% +} + +{ \catcode`_=11 % We want to use \_STOP_ which cannot appear in texinfo source. + \obeylines % + % + \gdef\dodoignore#1{% + % #1 contains the command name as a string, e.g., `ifinfo'. + % + % Define a command to find the next `@end #1', which must be on a line + % by itself. + \long\def\doignoretext##1^^M@end #1{\doignoretextyyy##1^^M@#1\_STOP_}% + % And this command to find another #1 command, at the beginning of a + % line. (Otherwise, we would consider a line `@c @ifset', for + % example, to count as an @ifset for nesting.) + \long\def\doignoretextyyy##1^^M@#1##2\_STOP_{\doignoreyyy{##2}\_STOP_}% + % + % And now expand that command. + \obeylines % + \doignoretext ^^M% + }% +} + +\def\doignoreyyy#1{% + \def\temp{#1}% + \ifx\temp\empty % Nothing found. + \let\next\doignoretextzzz + \else % Found a nested condition, ... + \advance\doignorecount by 1 + \let\next\doignoretextyyy % ..., look for another. + % If we're here, #1 ends with ^^M\ifinfo (for example). + \fi + \next #1% the token \_STOP_ is present just after this macro. +} + +% We have to swallow the remaining "\_STOP_". +% +\def\doignoretextzzz#1{% + \ifnum\doignorecount = 0 % We have just found the outermost @end. + \let\next\enddoignore + \else % Still inside a nested condition. + \advance\doignorecount by -1 + \let\next\doignoretext % Look for the next @end. + \fi + \next +} + +% Finish off ignored text. +\def\enddoignore{\endgroup\ignorespaces} + + +% @set VAR sets the variable VAR to an empty value. +% @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE. +% +% Since we want to separate VAR from REST-OF-LINE (which might be +% empty), we can't just use \parsearg; we have to insert a space of our +% own to delimit the rest of the line, and then take it out again if we +% didn't need it. +% We rely on the fact that \parsearg sets \catcode`\ =10. +% +\parseargdef\set{\setyyy#1 \endsetyyy} +\def\setyyy#1 #2\endsetyyy{% + {% + \makevalueexpandable + \def\temp{#2}% + \edef\next{\gdef\makecsname{SET#1}}% + \ifx\temp\empty + \next{}% + \else + \setzzz#2\endsetzzz + \fi + }% +} +% Remove the trailing space \setxxx inserted. +\def\setzzz#1 \endsetzzz{\next{#1}} + +% @clear VAR clears (i.e., unsets) the variable VAR. +% +\parseargdef\clear{% + {% + \makevalueexpandable + \global\expandafter\let\csname SET#1\endcsname=\relax + }% +} + +% @value{foo} gets the text saved in variable foo. +\def\value{\begingroup\makevalueexpandable\valuexxx} +\def\valuexxx#1{\expandablevalue{#1}\endgroup} +{ + \catcode`\- = \active \catcode`\_ = \active + % + \gdef\makevalueexpandable{% + \let\value = \expandablevalue + % We don't want these characters active, ... + \catcode`\-=\other \catcode`\_=\other + % ..., but we might end up with active ones in the argument if + % we're called from @code, as @code{@value{foo-bar_}}, though. + % So \let them to their normal equivalents. + \let-\realdash \let_\normalunderscore + } +} + +% We have this subroutine so that we can handle at least some @value's +% properly in indexes (we call \makevalueexpandable in \indexdummies). +% The command has to be fully expandable (if the variable is set), since +% the result winds up in the index file. This means that if the +% variable's value contains other Texinfo commands, it's almost certain +% it will fail (although perhaps we could fix that with sufficient work +% to do a one-level expansion on the result, instead of complete). +% +\def\expandablevalue#1{% + \expandafter\ifx\csname SET#1\endcsname\relax + {[No value for ``#1'']}% + \message{Variable `#1', used in @value, is not set.}% + \else + \csname SET#1\endcsname + \fi +} + +% @ifset VAR ... @end ifset reads the `...' iff VAR has been defined +% with @set. +% +% To get special treatment of `@end ifset,' call \makeond and the redefine. +% +\makecond{ifset} +\def\ifset{\parsearg{\doifset{\let\next=\ifsetfail}}} +\def\doifset#1#2{% + {% + \makevalueexpandable + \let\next=\empty + \expandafter\ifx\csname SET#2\endcsname\relax + #1% If not set, redefine \next. + \fi + \expandafter + }\next +} +\def\ifsetfail{\doignore{ifset}} + +% @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been +% defined with @set, or has been undefined with @clear. +% +% The `\else' inside the `\doifset' parameter is a trick to reuse the +% above code: if the variable is not set, do nothing, if it is set, +% then redefine \next to \ifclearfail. +% +\makecond{ifclear} +\def\ifclear{\parsearg{\doifset{\else \let\next=\ifclearfail}}} +\def\ifclearfail{\doignore{ifclear}} + +% @dircategory CATEGORY -- specify a category of the dir file +% which this file should belong to. Ignore this in TeX. +\let\dircategory=\comment + +% @defininfoenclose. +\let\definfoenclose=\comment + + +\message{indexing,} +% Index generation facilities + +% Define \newwrite to be identical to plain tex's \newwrite +% except not \outer, so it can be used within macros and \if's. +\edef\newwrite{\makecsname{ptexnewwrite}} + +% \newindex {foo} defines an index named foo. +% It automatically defines \fooindex such that +% \fooindex ...rest of line... puts an entry in the index foo. +% It also defines \fooindfile to be the number of the output channel for +% the file that accumulates this index. The file's extension is foo. +% The name of an index should be no more than 2 characters long +% for the sake of vms. +% +\def\newindex#1{% + \iflinks + \expandafter\newwrite \csname#1indfile\endcsname + \openout \csname#1indfile\endcsname \jobname.#1 % Open the file + \fi + \expandafter\xdef\csname#1index\endcsname{% % Define @#1index + \noexpand\doindex{#1}} +} + +% @defindex foo == \newindex{foo} +% +\def\defindex{\parsearg\newindex} + +% Define @defcodeindex, like @defindex except put all entries in @code. +% +\def\defcodeindex{\parsearg\newcodeindex} +% +\def\newcodeindex#1{% + \iflinks + \expandafter\newwrite \csname#1indfile\endcsname + \openout \csname#1indfile\endcsname \jobname.#1 + \fi + \expandafter\xdef\csname#1index\endcsname{% + \noexpand\docodeindex{#1}}% +} + + +% @synindex foo bar makes index foo feed into index bar. +% Do this instead of @defindex foo if you don't want it as a separate index. +% +% @syncodeindex foo bar similar, but put all entries made for index foo +% inside @code. +% +\def\synindex#1 #2 {\dosynindex\doindex{#1}{#2}} +\def\syncodeindex#1 #2 {\dosynindex\docodeindex{#1}{#2}} + +% #1 is \doindex or \docodeindex, #2 the index getting redefined (foo), +% #3 the target index (bar). +\def\dosynindex#1#2#3{% + % Only do \closeout if we haven't already done it, else we'll end up + % closing the target index. + \expandafter \ifx\csname donesynindex#2\endcsname \undefined + % The \closeout helps reduce unnecessary open files; the limit on the + % Acorn RISC OS is a mere 16 files. + \expandafter\closeout\csname#2indfile\endcsname + \expandafter\let\csname\donesynindex#2\endcsname = 1 + \fi + % redefine \fooindfile: + \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname + \expandafter\let\csname#2indfile\endcsname=\temp + % redefine \fooindex: + \expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}% +} + +% Define \doindex, the driver for all \fooindex macros. +% Argument #1 is generated by the calling \fooindex macro, +% and it is "foo", the name of the index. + +% \doindex just uses \parsearg; it calls \doind for the actual work. +% This is because \doind is more useful to call from other macros. + +% There is also \dosubind {index}{topic}{subtopic} +% which makes an entry in a two-level index such as the operation index. + +\def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer} +\def\singleindexer #1{\doind{\indexname}{#1}} + +% like the previous two, but they put @code around the argument. +\def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer} +\def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}} + +% Take care of Texinfo commands that can appear in an index entry. +% Since there are some commands we want to expand, and others we don't, +% we have to laboriously prevent expansion for those that we don't. +% +\def\indexdummies{% + \def\@{@}% change to @@ when we switch to @ as escape char in index files. + \def\ {\realbackslash\space }% + % Need these in case \tex is in effect and \{ is a \delimiter again. + % But can't use \lbracecmd and \rbracecmd because texindex assumes + % braces and backslashes are used only as delimiters. + \let\{ = \mylbrace + \let\} = \myrbrace + % + % \definedummyword defines \#1 as \realbackslash #1\space, thus + % effectively preventing its expansion. This is used only for control + % words, not control letters, because the \space would be incorrect + % for control characters, but is needed to separate the control word + % from whatever follows. + % + % For control letters, we have \definedummyletter, which omits the + % space. + % + % These can be used both for control words that take an argument and + % those that do not. If it is followed by {arg} in the input, then + % that will dutifully get written to the index (or wherever). + % + \def\definedummyword##1{% + \expandafter\def\csname ##1\endcsname{\realbackslash ##1\space}% + }% + \def\definedummyletter##1{% + \expandafter\def\csname ##1\endcsname{\realbackslash ##1}% + }% + \let\definedummyaccent\definedummyletter + % + % Do the redefinitions. + \commondummies +} + +% For the aux file, @ is the escape character. So we want to redefine +% everything using @ instead of \realbackslash. When everything uses +% @, this will be simpler. +% +\def\atdummies{% + \def\@{@@}% + \def\ {@ }% + \let\{ = \lbraceatcmd + \let\} = \rbraceatcmd + % + % (See comments in \indexdummies.) + \def\definedummyword##1{% + \expandafter\def\csname ##1\endcsname{@##1\space}% + }% + \def\definedummyletter##1{% + \expandafter\def\csname ##1\endcsname{@##1}% + }% + \let\definedummyaccent\definedummyletter + % + % Do the redefinitions. + \commondummies +} + +% Called from \indexdummies and \atdummies. \definedummyword and +% \definedummyletter must be defined first. +% +\def\commondummies{% + % + \normalturnoffactive + % + \commondummiesnofonts + % + \definedummyletter{_}% + % + % Non-English letters. + \definedummyword{AA}% + \definedummyword{AE}% + \definedummyword{L}% + \definedummyword{OE}% + \definedummyword{O}% + \definedummyword{aa}% + \definedummyword{ae}% + \definedummyword{l}% + \definedummyword{oe}% + \definedummyword{o}% + \definedummyword{ss}% + \definedummyword{exclamdown}% + \definedummyword{questiondown}% + \definedummyword{ordf}% + \definedummyword{ordm}% + % + % Although these internal commands shouldn't show up, sometimes they do. + \definedummyword{bf}% + \definedummyword{gtr}% + \definedummyword{hat}% + \definedummyword{less}% + \definedummyword{sf}% + \definedummyword{sl}% + \definedummyword{tclose}% + \definedummyword{tt}% + % + \definedummyword{LaTeX}% + \definedummyword{TeX}% + % + % Assorted special characters. + \definedummyword{bullet}% + \definedummyword{comma}% + \definedummyword{copyright}% + \definedummyword{registeredsymbol}% + \definedummyword{dots}% + \definedummyword{enddots}% + \definedummyword{equiv}% + \definedummyword{error}% + \definedummyword{euro}% + \definedummyword{expansion}% + \definedummyword{minus}% + \definedummyword{pounds}% + \definedummyword{point}% + \definedummyword{print}% + \definedummyword{result}% + % + % Handle some cases of @value -- where it does not contain any + % (non-fully-expandable) commands. + \makevalueexpandable + % + % Normal spaces, not active ones. + \unsepspaces + % + % No macro expansion. + \turnoffmacros +} + +% \commondummiesnofonts: common to \commondummies and \indexnofonts. +% +% Better have this without active chars. +{ + \catcode`\~=\other + \gdef\commondummiesnofonts{% + % Control letters and accents. + \definedummyletter{!}% + \definedummyaccent{"}% + \definedummyaccent{'}% + \definedummyletter{*}% + \definedummyaccent{,}% + \definedummyletter{.}% + \definedummyletter{/}% + \definedummyletter{:}% + \definedummyaccent{=}% + \definedummyletter{?}% + \definedummyaccent{^}% + \definedummyaccent{`}% + \definedummyaccent{~}% + \definedummyword{u}% + \definedummyword{v}% + \definedummyword{H}% + \definedummyword{dotaccent}% + \definedummyword{ringaccent}% + \definedummyword{tieaccent}% + \definedummyword{ubaraccent}% + \definedummyword{udotaccent}% + \definedummyword{dotless}% + % + % Texinfo font commands. + \definedummyword{b}% + \definedummyword{i}% + \definedummyword{r}% + \definedummyword{sc}% + \definedummyword{t}% + % + % Commands that take arguments. + \definedummyword{acronym}% + \definedummyword{cite}% + \definedummyword{code}% + \definedummyword{command}% + \definedummyword{dfn}% + \definedummyword{emph}% + \definedummyword{env}% + \definedummyword{file}% + \definedummyword{kbd}% + \definedummyword{key}% + \definedummyword{math}% + \definedummyword{option}% + \definedummyword{samp}% + \definedummyword{strong}% + \definedummyword{tie}% + \definedummyword{uref}% + \definedummyword{url}% + \definedummyword{var}% + \definedummyword{verb}% + \definedummyword{w}% + } +} + +% \indexnofonts is used when outputting the strings to sort the index +% by, and when constructing control sequence names. It eliminates all +% control sequences and just writes whatever the best ASCII sort string +% would be for a given command (usually its argument). +% +\def\indexnofonts{% + % Accent commands should become @asis. + \def\definedummyaccent##1{% + \expandafter\let\csname ##1\endcsname\asis + }% + % We can just ignore other control letters. + \def\definedummyletter##1{% + \expandafter\def\csname ##1\endcsname{}% + }% + % Hopefully, all control words can become @asis. + \let\definedummyword\definedummyaccent + % + \commondummiesnofonts + % + % Don't no-op \tt, since it isn't a user-level command + % and is used in the definitions of the active chars like <, >, |, etc. + % Likewise with the other plain tex font commands. + %\let\tt=\asis + % + \def\ { }% + \def\@{@}% + % how to handle braces? + \def\_{\normalunderscore}% + % + % Non-English letters. + \def\AA{AA}% + \def\AE{AE}% + \def\L{L}% + \def\OE{OE}% + \def\O{O}% + \def\aa{aa}% + \def\ae{ae}% + \def\l{l}% + \def\oe{oe}% + \def\o{o}% + \def\ss{ss}% + \def\exclamdown{!}% + \def\questiondown{?}% + \def\ordf{a}% + \def\ordm{o}% + % + \def\LaTeX{LaTeX}% + \def\TeX{TeX}% + % + % Assorted special characters. + % (The following {} will end up in the sort string, but that's ok.) + \def\bullet{bullet}% + \def\comma{,}% + \def\copyright{copyright}% + \def\registeredsymbol{R}% + \def\dots{...}% + \def\enddots{...}% + \def\equiv{==}% + \def\error{error}% + \def\euro{euro}% + \def\expansion{==>}% + \def\minus{-}% + \def\pounds{pounds}% + \def\point{.}% + \def\print{-|}% + \def\result{=>}% + % + % Don't write macro names. + \emptyusermacros +} + +\let\indexbackslash=0 %overridden during \printindex. +\let\SETmarginindex=\relax % put index entries in margin (undocumented)? + +% Most index entries go through here, but \dosubind is the general case. +% #1 is the index name, #2 is the entry text. +\def\doind#1#2{\dosubind{#1}{#2}{}} + +% Workhorse for all \fooindexes. +% #1 is name of index, #2 is stuff to put there, #3 is subentry -- +% empty if called from \doind, as we usually are (the main exception +% is with most defuns, which call us directly). +% +\def\dosubind#1#2#3{% + \iflinks + {% + % Store the main index entry text (including the third arg). + \toks0 = {#2}% + % If third arg is present, precede it with a space. + \def\thirdarg{#3}% + \ifx\thirdarg\empty \else + \toks0 = \expandafter{\the\toks0 \space #3}% + \fi + % + \edef\writeto{\csname#1indfile\endcsname}% + % + \ifvmode + \dosubindsanitize + \else + \dosubindwrite + \fi + }% + \fi +} + +% Write the entry in \toks0 to the index file: +% +\def\dosubindwrite{% + % Put the index entry in the margin if desired. + \ifx\SETmarginindex\relax\else + \insert\margin{\hbox{\vrule height8pt depth3pt width0pt \the\toks0}}% + \fi + % + % Remember, we are within a group. + \indexdummies % Must do this here, since \bf, etc expand at this stage + \escapechar=`\\ + \def\backslashcurfont{\indexbackslash}% \indexbackslash isn't defined now + % so it will be output as is; and it will print as backslash. + % + % Process the index entry with all font commands turned off, to + % get the string to sort by. + {\indexnofonts + \edef\temp{\the\toks0}% need full expansion + \xdef\indexsorttmp{\temp}% + }% + % + % Set up the complete index entry, with both the sort key and + % the original text, including any font commands. We write + % three arguments to \entry to the .?? file (four in the + % subentry case), texindex reduces to two when writing the .??s + % sorted result. + \edef\temp{% + \write\writeto{% + \string\entry{\indexsorttmp}{\noexpand\folio}{\the\toks0}}% + }% + \temp +} + +% Take care of unwanted page breaks: +% +% If a skip is the last thing on the list now, preserve it +% by backing up by \lastskip, doing the \write, then inserting +% the skip again. Otherwise, the whatsit generated by the +% \write will make \lastskip zero. The result is that sequences +% like this: +% @end defun +% @tindex whatever +% @defun ... +% will have extra space inserted, because the \medbreak in the +% start of the @defun won't see the skip inserted by the @end of +% the previous defun. +% +% But don't do any of this if we're not in vertical mode. We +% don't want to do a \vskip and prematurely end a paragraph. +% +% Avoid page breaks due to these extra skips, too. +% +% But wait, there is a catch there: +% We'll have to check whether \lastskip is zero skip. \ifdim is not +% sufficient for this purpose, as it ignores stretch and shrink parts +% of the skip. The only way seems to be to check the textual +% representation of the skip. +% +% The following is almost like \def\zeroskipmacro{0.0pt} except that +% the ``p'' and ``t'' characters have catcode \other, not 11 (letter). +% +\edef\zeroskipmacro{\expandafter\the\csname z@skip\endcsname} +% +% ..., ready, GO: +% +\def\dosubindsanitize{% + % \lastskip and \lastpenalty cannot both be nonzero simultaneously. + \skip0 = \lastskip + \edef\lastskipmacro{\the\lastskip}% + \count255 = \lastpenalty + % + % If \lastskip is nonzero, that means the last item was a + % skip. And since a skip is discardable, that means this + % -\skip0 glue we're inserting is preceded by a + % non-discardable item, therefore it is not a potential + % breakpoint, therefore no \nobreak needed. + \ifx\lastskipmacro\zeroskipmacro + \else + \vskip-\skip0 + \fi + % + \dosubindwrite + % + \ifx\lastskipmacro\zeroskipmacro + % If \lastskip was zero, perhaps the last item was a penalty, and + % perhaps it was >=10000, e.g., a \nobreak. In that case, we want + % to re-insert the same penalty (values >10000 are used for various + % signals); since we just inserted a non-discardable item, any + % following glue (such as a \parskip) would be a breakpoint. For example: + % + % @deffn deffn-whatever + % @vindex index-whatever + % Description. + % would allow a break between the index-whatever whatsit + % and the "Description." paragraph. + \ifnum\count255>9999 \penalty\count255 \fi + \else + % On the other hand, if we had a nonzero \lastskip, + % this make-up glue would be preceded by a non-discardable item + % (the whatsit from the \write), so we must insert a \nobreak. + \nobreak\vskip\skip0 + \fi +} + +% The index entry written in the file actually looks like +% \entry {sortstring}{page}{topic} +% or +% \entry {sortstring}{page}{topic}{subtopic} +% The texindex program reads in these files and writes files +% containing these kinds of lines: +% \initial {c} +% before the first topic whose initial is c +% \entry {topic}{pagelist} +% for a topic that is used without subtopics +% \primary {topic} +% for the beginning of a topic that is used with subtopics +% \secondary {subtopic}{pagelist} +% for each subtopic. + +% Define the user-accessible indexing commands +% @findex, @vindex, @kindex, @cindex. + +\def\findex {\fnindex} +\def\kindex {\kyindex} +\def\cindex {\cpindex} +\def\vindex {\vrindex} +\def\tindex {\tpindex} +\def\pindex {\pgindex} + +\def\cindexsub {\begingroup\obeylines\cindexsub} +{\obeylines % +\gdef\cindexsub "#1" #2^^M{\endgroup % +\dosubind{cp}{#2}{#1}}} + +% Define the macros used in formatting output of the sorted index material. + +% @printindex causes a particular index (the ??s file) to get printed. +% It does not print any chapter heading (usually an @unnumbered). +% +\parseargdef\printindex{\begingroup + \dobreak \chapheadingskip{10000}% + % + \smallfonts \rm + \tolerance = 9500 + \everypar = {}% don't want the \kern\-parindent from indentation suppression. + % + % See if the index file exists and is nonempty. + % Change catcode of @ here so that if the index file contains + % \initial {@} + % as its first line, TeX doesn't complain about mismatched braces + % (because it thinks @} is a control sequence). + \catcode`\@ = 11 + \openin 1 \jobname.#1s + \ifeof 1 + % \enddoublecolumns gets confused if there is no text in the index, + % and it loses the chapter title and the aux file entries for the + % index. The easiest way to prevent this problem is to make sure + % there is some text. + \putwordIndexNonexistent + \else + % + % If the index file exists but is empty, then \openin leaves \ifeof + % false. We have to make TeX try to read something from the file, so + % it can discover if there is anything in it. + \read 1 to \temp + \ifeof 1 + \putwordIndexIsEmpty + \else + % Index files are almost Texinfo source, but we use \ as the escape + % character. It would be better to use @, but that's too big a change + % to make right now. + \def\indexbackslash{\backslashcurfont}% + \catcode`\\ = 0 + \escapechar = `\\ + \begindoublecolumns + \input \jobname.#1s + \enddoublecolumns + \fi + \fi + \closein 1 +\endgroup} + +% These macros are used by the sorted index file itself. +% Change them to control the appearance of the index. + +\def\initial#1{{% + % Some minor font changes for the special characters. + \let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt + % + % Remove any glue we may have, we'll be inserting our own. + \removelastskip + % + % We like breaks before the index initials, so insert a bonus. + \nobreak + \vskip 0pt plus 3\baselineskip + \penalty 0 + \vskip 0pt plus -3\baselineskip + % + % Typeset the initial. Making this add up to a whole number of + % baselineskips increases the chance of the dots lining up from column + % to column. It still won't often be perfect, because of the stretch + % we need before each entry, but it's better. + % + % No shrink because it confuses \balancecolumns. + \vskip 1.67\baselineskip plus .5\baselineskip + \leftline{\secbf #1}% + % Do our best not to break after the initial. + \nobreak + \vskip .33\baselineskip plus .1\baselineskip +}} + +% \entry typesets a paragraph consisting of the text (#1), dot leaders, and +% then page number (#2) flushed to the right margin. It is used for index +% and table of contents entries. The paragraph is indented by \leftskip. +% +% A straightforward implementation would start like this: +% \def\entry#1#2{... +% But this frozes the catcodes in the argument, and can cause problems to +% @code, which sets - active. This problem was fixed by a kludge--- +% ``-'' was active throughout whole index, but this isn't really right. +% +% The right solution is to prevent \entry from swallowing the whole text. +% --kasal, 21nov03 +\def\entry{% + \begingroup + % + % Start a new paragraph if necessary, so our assignments below can't + % affect previous text. + \par + % + % Do not fill out the last line with white space. + \parfillskip = 0in + % + % No extra space above this paragraph. + \parskip = 0in + % + % Do not prefer a separate line ending with a hyphen to fewer lines. + \finalhyphendemerits = 0 + % + % \hangindent is only relevant when the entry text and page number + % don't both fit on one line. In that case, bob suggests starting the + % dots pretty far over on the line. Unfortunately, a large + % indentation looks wrong when the entry text itself is broken across + % lines. So we use a small indentation and put up with long leaders. + % + % \hangafter is reset to 1 (which is the value we want) at the start + % of each paragraph, so we need not do anything with that. + \hangindent = 2em + % + % When the entry text needs to be broken, just fill out the first line + % with blank space. + \rightskip = 0pt plus1fil + % + % A bit of stretch before each entry for the benefit of balancing + % columns. + \vskip 0pt plus1pt + % + % Swallow the left brace of the text (first parameter): + \afterassignment\doentry + \let\temp = +} +\def\doentry{% + \bgroup % Instead of the swallowed brace. + \noindent + \aftergroup\finishentry + % And now comes the text of the entry. +} +\def\finishentry#1{% + % #1 is the page number. + % + % The following is kludged to not output a line of dots in the index if + % there are no page numbers. The next person who breaks this will be + % cursed by a Unix daemon. + \def\tempa{{\rm }}% + \def\tempb{#1}% + \edef\tempc{\tempa}% + \edef\tempd{\tempb}% + \ifx\tempc\tempd + \ % + \else + % + % If we must, put the page number on a line of its own, and fill out + % this line with blank space. (The \hfil is overwhelmed with the + % fill leaders glue in \indexdotfill if the page number does fit.) + \hfil\penalty50 + \null\nobreak\indexdotfill % Have leaders before the page number. + % + % The `\ ' here is removed by the implicit \unskip that TeX does as + % part of (the primitive) \par. Without it, a spurious underfull + % \hbox ensues. + \ifpdf + \pdfgettoks#1.% + \ \the\toksA + \else + \ #1% + \fi + \fi + \par + \endgroup +} + +% Like \dotfill except takes at least 1 em. +\def\indexdotfill{\cleaders + \hbox{$\mathsurround=0pt \mkern1.5mu ${\it .}$ \mkern1.5mu$}\hskip 1em plus 1fill} + +\def\primary #1{\line{#1\hfil}} + +\newskip\secondaryindent \secondaryindent=0.5cm +\def\secondary#1#2{{% + \parfillskip=0in + \parskip=0in + \hangindent=1in + \hangafter=1 + \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill + \ifpdf + \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph. + \else + #2 + \fi + \par +}} + +% Define two-column mode, which we use to typeset indexes. +% Adapted from the TeXbook, page 416, which is to say, +% the manmac.tex format used to print the TeXbook itself. +\catcode`\@=11 + +\newbox\partialpage +\newdimen\doublecolumnhsize + +\def\begindoublecolumns{\begingroup % ended by \enddoublecolumns + % Grab any single-column material above us. + \output = {% + % + % Here is a possibility not foreseen in manmac: if we accumulate a + % whole lot of material, we might end up calling this \output + % routine twice in a row (see the doublecol-lose test, which is + % essentially a couple of indexes with @setchapternewpage off). In + % that case we just ship out what is in \partialpage with the normal + % output routine. Generally, \partialpage will be empty when this + % runs and this will be a no-op. See the indexspread.tex test case. + \ifvoid\partialpage \else + \onepageout{\pagecontents\partialpage}% + \fi + % + \global\setbox\partialpage = \vbox{% + % Unvbox the main output page. + \unvbox\PAGE + \kern-\topskip \kern\baselineskip + }% + }% + \eject % run that output routine to set \partialpage + % + % Use the double-column output routine for subsequent pages. + \output = {\doublecolumnout}% + % + % Change the page size parameters. We could do this once outside this + % routine, in each of @smallbook, @afourpaper, and the default 8.5x11 + % format, but then we repeat the same computation. Repeating a couple + % of assignments once per index is clearly meaningless for the + % execution time, so we may as well do it in one place. + % + % First we halve the line length, less a little for the gutter between + % the columns. We compute the gutter based on the line length, so it + % changes automatically with the paper format. The magic constant + % below is chosen so that the gutter has the same value (well, +-<1pt) + % as it did when we hard-coded it. + % + % We put the result in a separate register, \doublecolumhsize, so we + % can restore it in \pagesofar, after \hsize itself has (potentially) + % been clobbered. + % + \doublecolumnhsize = \hsize + \advance\doublecolumnhsize by -.04154\hsize + \divide\doublecolumnhsize by 2 + \hsize = \doublecolumnhsize + % + % Double the \vsize as well. (We don't need a separate register here, + % since nobody clobbers \vsize.) + \vsize = 2\vsize +} + +% The double-column output routine for all double-column pages except +% the last. +% +\def\doublecolumnout{% + \splittopskip=\topskip \splitmaxdepth=\maxdepth + % Get the available space for the double columns -- the normal + % (undoubled) page height minus any material left over from the + % previous page. + \dimen@ = \vsize + \divide\dimen@ by 2 + \advance\dimen@ by -\ht\partialpage + % + % box0 will be the left-hand column, box2 the right. + \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@ + \onepageout\pagesofar + \unvbox255 + \penalty\outputpenalty +} +% +% Re-output the contents of the output page -- any previous material, +% followed by the two boxes we just split, in box0 and box2. +\def\pagesofar{% + \unvbox\partialpage + % + \hsize = \doublecolumnhsize + \wd0=\hsize \wd2=\hsize + \hbox to\pagewidth{\box0\hfil\box2}% +} +% +% All done with double columns. +\def\enddoublecolumns{% + \output = {% + % Split the last of the double-column material. Leave it on the + % current page, no automatic page break. + \balancecolumns + % + % If we end up splitting too much material for the current page, + % though, there will be another page break right after this \output + % invocation ends. Having called \balancecolumns once, we do not + % want to call it again. Therefore, reset \output to its normal + % definition right away. (We hope \balancecolumns will never be + % called on to balance too much material, but if it is, this makes + % the output somewhat more palatable.) + \global\output = {\onepageout{\pagecontents\PAGE}}% + }% + \eject + \endgroup % started in \begindoublecolumns + % + % \pagegoal was set to the doubled \vsize above, since we restarted + % the current page. We're now back to normal single-column + % typesetting, so reset \pagegoal to the normal \vsize (after the + % \endgroup where \vsize got restored). + \pagegoal = \vsize +} +% +% Called at the end of the double column material. +\def\balancecolumns{% + \setbox0 = \vbox{\unvbox255}% like \box255 but more efficient, see p.120. + \dimen@ = \ht0 + \advance\dimen@ by \topskip + \advance\dimen@ by-\baselineskip + \divide\dimen@ by 2 % target to split to + %debug\message{final 2-column material height=\the\ht0, target=\the\dimen@.}% + \splittopskip = \topskip + % Loop until we get a decent breakpoint. + {% + \vbadness = 10000 + \loop + \global\setbox3 = \copy0 + \global\setbox1 = \vsplit3 to \dimen@ + \ifdim\ht3>\dimen@ + \global\advance\dimen@ by 1pt + \repeat + }% + %debug\message{split to \the\dimen@, column heights: \the\ht1, \the\ht3.}% + \setbox0=\vbox to\dimen@{\unvbox1}% + \setbox2=\vbox to\dimen@{\unvbox3}% + % + \pagesofar +} +\catcode`\@ = \other + + +\message{sectioning,} +% Chapters, sections, etc. + +% \unnumberedno is an oxymoron, of course. But we count the unnumbered +% sections so that we can refer to them unambiguously in the pdf +% outlines by their "section number". We avoid collisions with chapter +% numbers by starting them at 10000. (If a document ever has 10000 +% chapters, we're in trouble anyway, I'm sure.) +\newcount\unnumberedno \unnumberedno = 10000 +\newcount\chapno +\newcount\secno \secno=0 +\newcount\subsecno \subsecno=0 +\newcount\subsubsecno \subsubsecno=0 + +% This counter is funny since it counts through charcodes of letters A, B, ... +\newcount\appendixno \appendixno = `\@ +% +% \def\appendixletter{\char\the\appendixno} +% We do the following ugly conditional instead of the above simple +% construct for the sake of pdftex, which needs the actual +% letter in the expansion, not just typeset. +% +\def\appendixletter{% + \ifnum\appendixno=`A A% + \else\ifnum\appendixno=`B B% + \else\ifnum\appendixno=`C C% + \else\ifnum\appendixno=`D D% + \else\ifnum\appendixno=`E E% + \else\ifnum\appendixno=`F F% + \else\ifnum\appendixno=`G G% + \else\ifnum\appendixno=`H H% + \else\ifnum\appendixno=`I I% + \else\ifnum\appendixno=`J J% + \else\ifnum\appendixno=`K K% + \else\ifnum\appendixno=`L L% + \else\ifnum\appendixno=`M M% + \else\ifnum\appendixno=`N N% + \else\ifnum\appendixno=`O O% + \else\ifnum\appendixno=`P P% + \else\ifnum\appendixno=`Q Q% + \else\ifnum\appendixno=`R R% + \else\ifnum\appendixno=`S S% + \else\ifnum\appendixno=`T T% + \else\ifnum\appendixno=`U U% + \else\ifnum\appendixno=`V V% + \else\ifnum\appendixno=`W W% + \else\ifnum\appendixno=`X X% + \else\ifnum\appendixno=`Y Y% + \else\ifnum\appendixno=`Z Z% + % The \the is necessary, despite appearances, because \appendixletter is + % expanded while writing the .toc file. \char\appendixno is not + % expandable, thus it is written literally, thus all appendixes come out + % with the same letter (or @) in the toc without it. + \else\char\the\appendixno + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi} + +% Each @chapter defines this as the name of the chapter. +% page headings and footings can use it. @section does likewise. +% However, they are not reliable, because we don't use marks. +\def\thischapter{} +\def\thissection{} + +\newcount\absseclevel % used to calculate proper heading level +\newcount\secbase\secbase=0 % @raisesections/@lowersections modify this count + +% @raisesections: treat @section as chapter, @subsection as section, etc. +\def\raisesections{\global\advance\secbase by -1} +\let\up=\raisesections % original BFox name + +% @lowersections: treat @chapter as section, @section as subsection, etc. +\def\lowersections{\global\advance\secbase by 1} +\let\down=\lowersections % original BFox name + +% we only have subsub. +\chardef\maxseclevel = 3 +% +% A numbered section within an unnumbered changes to unnumbered too. +% To achive this, remember the "biggest" unnum. sec. we are currently in: +\chardef\unmlevel = \maxseclevel +% +% Trace whether the current chapter is an appendix or not: +% \chapheadtype is "N" or "A", unnumbered chapters are ignored. +\def\chapheadtype{N} + +% Choose a heading macro +% #1 is heading type +% #2 is heading level +% #3 is text for heading +\def\genhead#1#2#3{% + % Compute the abs. sec. level: + \absseclevel=#2 + \advance\absseclevel by \secbase + % Make sure \absseclevel doesn't fall outside the range: + \ifnum \absseclevel < 0 + \absseclevel = 0 + \else + \ifnum \absseclevel > 3 + \absseclevel = 3 + \fi + \fi + % The heading type: + \def\headtype{#1}% + \if \headtype U% + \ifnum \absseclevel < \unmlevel + \chardef\unmlevel = \absseclevel + \fi + \else + % Check for appendix sections: + \ifnum \absseclevel = 0 + \edef\chapheadtype{\headtype}% + \else + \if \headtype A\if \chapheadtype N% + \errmessage{@appendix... within a non-appendix chapter}% + \fi\fi + \fi + % Check for numbered within unnumbered: + \ifnum \absseclevel > \unmlevel + \def\headtype{U}% + \else + \chardef\unmlevel = 3 + \fi + \fi + % Now print the heading: + \if \headtype U% + \ifcase\absseclevel + \unnumberedzzz{#3}% + \or \unnumberedseczzz{#3}% + \or \unnumberedsubseczzz{#3}% + \or \unnumberedsubsubseczzz{#3}% + \fi + \else + \if \headtype A% + \ifcase\absseclevel + \appendixzzz{#3}% + \or \appendixsectionzzz{#3}% + \or \appendixsubseczzz{#3}% + \or \appendixsubsubseczzz{#3}% + \fi + \else + \ifcase\absseclevel + \chapterzzz{#3}% + \or \seczzz{#3}% + \or \numberedsubseczzz{#3}% + \or \numberedsubsubseczzz{#3}% + \fi + \fi + \fi + \suppressfirstparagraphindent +} + +% an interface: +\def\numhead{\genhead N} +\def\apphead{\genhead A} +\def\unnmhead{\genhead U} + +% @chapter, @appendix, @unnumbered. Increment top-level counter, reset +% all lower-level sectioning counters to zero. +% +% Also set \chaplevelprefix, which we prepend to @float sequence numbers +% (e.g., figures), q.v. By default (before any chapter), that is empty. +\let\chaplevelprefix = \empty +% +\outer\parseargdef\chapter{\numhead0{#1}} % normally numhead0 calls chapterzzz +\def\chapterzzz#1{% + % section resetting is \global in case the chapter is in a group, such + % as an @include file. + \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 + \global\advance\chapno by 1 + % + % Used for \float. + \gdef\chaplevelprefix{\the\chapno.}% + \resetallfloatnos + % + \message{\putwordChapter\space \the\chapno}% + % + % Write the actual heading. + \chapmacro{#1}{Ynumbered}{\the\chapno}% + % + % So @section and the like are numbered underneath this chapter. + \global\let\section = \numberedsec + \global\let\subsection = \numberedsubsec + \global\let\subsubsection = \numberedsubsubsec +} + +\outer\parseargdef\appendix{\apphead0{#1}} % normally apphead0 calls appendixzzz +\def\appendixzzz#1{% + \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 + \global\advance\appendixno by 1 + \gdef\chaplevelprefix{\appendixletter.}% + \resetallfloatnos + % + \def\appendixnum{\putwordAppendix\space \appendixletter}% + \message{\appendixnum}% + % + \chapmacro{#1}{Yappendix}{\appendixletter}% + % + \global\let\section = \appendixsec + \global\let\subsection = \appendixsubsec + \global\let\subsubsection = \appendixsubsubsec +} + +\outer\parseargdef\unnumbered{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz +\def\unnumberedzzz#1{% + \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 + \global\advance\unnumberedno by 1 + % + % Since an unnumbered has no number, no prefix for figures. + \global\let\chaplevelprefix = \empty + \resetallfloatnos + % + % This used to be simply \message{#1}, but TeX fully expands the + % argument to \message. Therefore, if #1 contained @-commands, TeX + % expanded them. For example, in `@unnumbered The @cite{Book}', TeX + % expanded @cite (which turns out to cause errors because \cite is meant + % to be executed, not expanded). + % + % Anyway, we don't want the fully-expanded definition of @cite to appear + % as a result of the \message, we just want `@cite' itself. We use + % \the to achieve this: TeX expands \the only once, + % simply yielding the contents of . (We also do this for + % the toc entries.) + \toks0 = {#1}% + \message{(\the\toks0)}% + % + \chapmacro{#1}{Ynothing}{\the\unnumberedno}% + % + \global\let\section = \unnumberedsec + \global\let\subsection = \unnumberedsubsec + \global\let\subsubsection = \unnumberedsubsubsec +} + +% @centerchap is like @unnumbered, but the heading is centered. +\outer\parseargdef\centerchap{% + % Well, we could do the following in a group, but that would break + % an assumption that \chapmacro is called at the outermost level. + % Thus we are safer this way: --kasal, 24feb04 + \let\centerparametersmaybe = \centerparameters + \unnmhead0{#1}% + \let\centerparametersmaybe = \relax +} + +% @top is like @unnumbered. +\let\top\unnumbered + +% Sections. +\outer\parseargdef\numberedsec{\numhead1{#1}} % normally calls seczzz +\def\seczzz#1{% + \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 + \sectionheading{#1}{sec}{Ynumbered}{\the\chapno.\the\secno}% +} + +\outer\parseargdef\appendixsection{\apphead1{#1}} % normally calls appendixsectionzzz +\def\appendixsectionzzz#1{% + \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 + \sectionheading{#1}{sec}{Yappendix}{\appendixletter.\the\secno}% +} +\let\appendixsec\appendixsection + +\outer\parseargdef\unnumberedsec{\unnmhead1{#1}} % normally calls unnumberedseczzz +\def\unnumberedseczzz#1{% + \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 + \sectionheading{#1}{sec}{Ynothing}{\the\unnumberedno.\the\secno}% +} + +% Subsections. +\outer\parseargdef\numberedsubsec{\numhead2{#1}} % normally calls numberedsubseczzz +\def\numberedsubseczzz#1{% + \global\subsubsecno=0 \global\advance\subsecno by 1 + \sectionheading{#1}{subsec}{Ynumbered}{\the\chapno.\the\secno.\the\subsecno}% +} + +\outer\parseargdef\appendixsubsec{\apphead2{#1}} % normally calls appendixsubseczzz +\def\appendixsubseczzz#1{% + \global\subsubsecno=0 \global\advance\subsecno by 1 + \sectionheading{#1}{subsec}{Yappendix}% + {\appendixletter.\the\secno.\the\subsecno}% +} + +\outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}} %normally calls unnumberedsubseczzz +\def\unnumberedsubseczzz#1{% + \global\subsubsecno=0 \global\advance\subsecno by 1 + \sectionheading{#1}{subsec}{Ynothing}% + {\the\unnumberedno.\the\secno.\the\subsecno}% +} + +% Subsubsections. +\outer\parseargdef\numberedsubsubsec{\numhead3{#1}} % normally numberedsubsubseczzz +\def\numberedsubsubseczzz#1{% + \global\advance\subsubsecno by 1 + \sectionheading{#1}{subsubsec}{Ynumbered}% + {\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno}% +} + +\outer\parseargdef\appendixsubsubsec{\apphead3{#1}} % normally appendixsubsubseczzz +\def\appendixsubsubseczzz#1{% + \global\advance\subsubsecno by 1 + \sectionheading{#1}{subsubsec}{Yappendix}% + {\appendixletter.\the\secno.\the\subsecno.\the\subsubsecno}% +} + +\outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}} %normally unnumberedsubsubseczzz +\def\unnumberedsubsubseczzz#1{% + \global\advance\subsubsecno by 1 + \sectionheading{#1}{subsubsec}{Ynothing}% + {\the\unnumberedno.\the\secno.\the\subsecno.\the\subsubsecno}% +} + +% These macros control what the section commands do, according +% to what kind of chapter we are in (ordinary, appendix, or unnumbered). +% Define them by default for a numbered chapter. +\let\section = \numberedsec +\let\subsection = \numberedsubsec +\let\subsubsection = \numberedsubsubsec + +% Define @majorheading, @heading and @subheading + +% NOTE on use of \vbox for chapter headings, section headings, and such: +% 1) We use \vbox rather than the earlier \line to permit +% overlong headings to fold. +% 2) \hyphenpenalty is set to 10000 because hyphenation in a +% heading is obnoxious; this forbids it. +% 3) Likewise, headings look best if no \parindent is used, and +% if justification is not attempted. Hence \raggedright. + + +\def\majorheading{% + {\advance\chapheadingskip by 10pt \chapbreak }% + \parsearg\chapheadingzzz +} + +\def\chapheading{\chapbreak \parsearg\chapheadingzzz} +\def\chapheadingzzz#1{% + {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 + \parindent=0pt\raggedright + \rm #1\hfill}}% + \bigskip \par\penalty 200\relax + \suppressfirstparagraphindent +} + +% @heading, @subheading, @subsubheading. +\parseargdef\heading{\sectionheading{#1}{sec}{Yomitfromtoc}{} + \suppressfirstparagraphindent} +\parseargdef\subheading{\sectionheading{#1}{subsec}{Yomitfromtoc}{} + \suppressfirstparagraphindent} +\parseargdef\subsubheading{\sectionheading{#1}{subsubsec}{Yomitfromtoc}{} + \suppressfirstparagraphindent} + +% These macros generate a chapter, section, etc. heading only +% (including whitespace, linebreaking, etc. around it), +% given all the information in convenient, parsed form. + +%%% Args are the skip and penalty (usually negative) +\def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi} + +%%% Define plain chapter starts, and page on/off switching for it +% Parameter controlling skip before chapter headings (if needed) + +\newskip\chapheadingskip + +\def\chapbreak{\dobreak \chapheadingskip {-4000}} +\def\chappager{\par\vfill\supereject} +\def\chapoddpage{\chappager \ifodd\pageno \else \hbox to 0pt{} \chappager\fi} + +\def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname} + +\def\CHAPPAGoff{% +\global\let\contentsalignmacro = \chappager +\global\let\pchapsepmacro=\chapbreak +\global\let\pagealignmacro=\chappager} + +\def\CHAPPAGon{% +\global\let\contentsalignmacro = \chappager +\global\let\pchapsepmacro=\chappager +\global\let\pagealignmacro=\chappager +\global\def\HEADINGSon{\HEADINGSsingle}} + +\def\CHAPPAGodd{% +\global\let\contentsalignmacro = \chapoddpage +\global\let\pchapsepmacro=\chapoddpage +\global\let\pagealignmacro=\chapoddpage +\global\def\HEADINGSon{\HEADINGSdouble}} + +\CHAPPAGon + +% Chapter opening. +% +% #1 is the text, #2 is the section type (Ynumbered, Ynothing, +% Yappendix, Yomitfromtoc), #3 the chapter number. +% +% To test against our argument. +\def\Ynothingkeyword{Ynothing} +\def\Yomitfromtockeyword{Yomitfromtoc} +\def\Yappendixkeyword{Yappendix} +% +\def\chapmacro#1#2#3{% + \pchapsepmacro + {% + \chapfonts \rm + % + % Have to define \thissection before calling \donoderef, because the + % xref code eventually uses it. On the other hand, it has to be called + % after \pchapsepmacro, or the headline will change too soon. + \gdef\thissection{#1}% + \gdef\thischaptername{#1}% + % + % Only insert the separating space if we have a chapter/appendix + % number, and don't print the unnumbered ``number''. + \def\temptype{#2}% + \ifx\temptype\Ynothingkeyword + \setbox0 = \hbox{}% + \def\toctype{unnchap}% + \def\thischapter{#1}% + \else\ifx\temptype\Yomitfromtockeyword + \setbox0 = \hbox{}% contents like unnumbered, but no toc entry + \def\toctype{omit}% + \xdef\thischapter{}% + \else\ifx\temptype\Yappendixkeyword + \setbox0 = \hbox{\putwordAppendix{} #3\enspace}% + \def\toctype{app}% + % We don't substitute the actual chapter name into \thischapter + % because we don't want its macros evaluated now. And we don't + % use \thissection because that changes with each section. + % + \xdef\thischapter{\putwordAppendix{} \appendixletter: + \noexpand\thischaptername}% + \else + \setbox0 = \hbox{#3\enspace}% + \def\toctype{numchap}% + \xdef\thischapter{\putwordChapter{} \the\chapno: + \noexpand\thischaptername}% + \fi\fi\fi + % + % Write the toc entry for this chapter. Must come before the + % \donoderef, because we include the current node name in the toc + % entry, and \donoderef resets it to empty. + \writetocentry{\toctype}{#1}{#3}% + % + % For pdftex, we have to write out the node definition (aka, make + % the pdfdest) after any page break, but before the actual text has + % been typeset. If the destination for the pdf outline is after the + % text, then jumping from the outline may wind up with the text not + % being visible, for instance under high magnification. + \donoderef{#2}% + % + % Typeset the actual heading. + \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright + \hangindent=\wd0 \centerparametersmaybe + \unhbox0 #1\par}% + }% + \nobreak\bigskip % no page break after a chapter title + \nobreak +} + +% @centerchap -- centered and unnumbered. +\let\centerparametersmaybe = \relax +\def\centerparameters{% + \advance\rightskip by 3\rightskip + \leftskip = \rightskip + \parfillskip = 0pt +} + + +% I don't think this chapter style is supported any more, so I'm not +% updating it with the new noderef stuff. We'll see. --karl, 11aug03. +% +\def\setchapterstyle #1 {\csname CHAPF#1\endcsname} +% +\def\unnchfopen #1{% +\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 + \parindent=0pt\raggedright + \rm #1\hfill}}\bigskip \par\nobreak +} +\def\chfopen #1#2{\chapoddpage {\chapfonts +\vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}% +\par\penalty 5000 % +} +\def\centerchfopen #1{% +\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 + \parindent=0pt + \hfill {\rm #1}\hfill}}\bigskip \par\nobreak +} +\def\CHAPFopen{% + \global\let\chapmacro=\chfopen + \global\let\centerchapmacro=\centerchfopen} + + +% Section titles. These macros combine the section number parts and +% call the generic \sectionheading to do the printing. +% +\newskip\secheadingskip +\def\secheadingbreak{\dobreak \secheadingskip{-1000}} + +% Subsection titles. +\newskip\subsecheadingskip +\def\subsecheadingbreak{\dobreak \subsecheadingskip{-500}} + +% Subsubsection titles. +\def\subsubsecheadingskip{\subsecheadingskip} +\def\subsubsecheadingbreak{\subsecheadingbreak} + + +% Print any size, any type, section title. +% +% #1 is the text, #2 is the section level (sec/subsec/subsubsec), #3 is +% the section type for xrefs (Ynumbered, Ynothing, Yappendix), #4 is the +% section number. +% +\def\sectionheading#1#2#3#4{% + {% + % Switch to the right set of fonts. + \csname #2fonts\endcsname \rm + % + % Insert space above the heading. + \csname #2headingbreak\endcsname + % + % Only insert the space after the number if we have a section number. + \def\sectionlevel{#2}% + \def\temptype{#3}% + % + \ifx\temptype\Ynothingkeyword + \setbox0 = \hbox{}% + \def\toctype{unn}% + \gdef\thissection{#1}% + \else\ifx\temptype\Yomitfromtockeyword + % for @headings -- no section number, don't include in toc, + % and don't redefine \thissection. + \setbox0 = \hbox{}% + \def\toctype{omit}% + \let\sectionlevel=\empty + \else\ifx\temptype\Yappendixkeyword + \setbox0 = \hbox{#4\enspace}% + \def\toctype{app}% + \gdef\thissection{#1}% + \else + \setbox0 = \hbox{#4\enspace}% + \def\toctype{num}% + \gdef\thissection{#1}% + \fi\fi\fi + % + % Write the toc entry (before \donoderef). See comments in \chfplain. + \writetocentry{\toctype\sectionlevel}{#1}{#4}% + % + % Write the node reference (= pdf destination for pdftex). + % Again, see comments in \chfplain. + \donoderef{#3}% + % + % Output the actual section heading. + \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright + \hangindent=\wd0 % zero if no section number + \unhbox0 #1}% + }% + % Add extra space after the heading -- half of whatever came above it. + % Don't allow stretch, though. + \kern .5 \csname #2headingskip\endcsname + % + % Do not let the kern be a potential breakpoint, as it would be if it + % was followed by glue. + \nobreak + % + % We'll almost certainly start a paragraph next, so don't let that + % glue accumulate. (Not a breakpoint because it's preceded by a + % discardable item.) + \vskip-\parskip + % + % This is purely so the last item on the list is a known \penalty > + % 10000. This is so \startdefun can avoid allowing breakpoints after + % section headings. Otherwise, it would insert a valid breakpoint between: + % + % @section sec-whatever + % @deffn def-whatever + \penalty 10001 +} + + +\message{toc,} +% Table of contents. +\newwrite\tocfile + +% Write an entry to the toc file, opening it if necessary. +% Called from @chapter, etc. +% +% Example usage: \writetocentry{sec}{Section Name}{\the\chapno.\the\secno} +% We append the current node name (if any) and page number as additional +% arguments for the \{chap,sec,...}entry macros which will eventually +% read this. The node name is used in the pdf outlines as the +% destination to jump to. +% +% We open the .toc file for writing here instead of at @setfilename (or +% any other fixed time) so that @contents can be anywhere in the document. +% But if #1 is `omit', then we don't do anything. This is used for the +% table of contents chapter openings themselves. +% +\newif\iftocfileopened +\def\omitkeyword{omit}% +% +\def\writetocentry#1#2#3{% + \edef\writetoctype{#1}% + \ifx\writetoctype\omitkeyword \else + \iftocfileopened\else + \immediate\openout\tocfile = \jobname.toc + \global\tocfileopenedtrue + \fi + % + \iflinks + \toks0 = {#2}% + \toks2 = \expandafter{\lastnode}% + \edef\temp{\write\tocfile{\realbackslash #1entry{\the\toks0}{#3}% + {\the\toks2}{\noexpand\folio}}}% + \temp + \fi + \fi + % + % Tell \shipout to create a pdf destination on each page, if we're + % writing pdf. These are used in the table of contents. We can't + % just write one on every page because the title pages are numbered + % 1 and 2 (the page numbers aren't printed), and so are the first + % two pages of the document. Thus, we'd have two destinations named + % `1', and two named `2'. + \ifpdf \global\pdfmakepagedesttrue \fi +} + +\newskip\contentsrightmargin \contentsrightmargin=1in +\newcount\savepageno +\newcount\lastnegativepageno \lastnegativepageno = -1 + +% Prepare to read what we've written to \tocfile. +% +\def\startcontents#1{% + % If @setchapternewpage on, and @headings double, the contents should + % start on an odd page, unlike chapters. Thus, we maintain + % \contentsalignmacro in parallel with \pagealignmacro. + % From: Torbjorn Granlund + \contentsalignmacro + \immediate\closeout\tocfile + % + % Don't need to put `Contents' or `Short Contents' in the headline. + % It is abundantly clear what they are. + \def\thischapter{}% + \chapmacro{#1}{Yomitfromtoc}{}% + % + \savepageno = \pageno + \begingroup % Set up to handle contents files properly. + \catcode`\\=0 \catcode`\{=1 \catcode`\}=2 \catcode`\@=11 + % We can't do this, because then an actual ^ in a section + % title fails, e.g., @chapter ^ -- exponentiation. --karl, 9jul97. + %\catcode`\^=7 % to see ^^e4 as \"a etc. juha@piuha.ydi.vtt.fi + \raggedbottom % Worry more about breakpoints than the bottom. + \advance\hsize by -\contentsrightmargin % Don't use the full line length. + % + % Roman numerals for page numbers. + \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi +} + + +% Normal (long) toc. +\def\contents{% + \startcontents{\putwordTOC}% + \openin 1 \jobname.toc + \ifeof 1 \else + \input \jobname.toc + \fi + \vfill \eject + \contentsalignmacro % in case @setchapternewpage odd is in effect + \ifeof 1 \else + \pdfmakeoutlines + \fi + \closein 1 + \endgroup + \lastnegativepageno = \pageno + \global\pageno = \savepageno +} + +% And just the chapters. +\def\summarycontents{% + \startcontents{\putwordShortTOC}% + % + \let\numchapentry = \shortchapentry + \let\appentry = \shortchapentry + \let\unnchapentry = \shortunnchapentry + % We want a true roman here for the page numbers. + \secfonts + \let\rm=\shortcontrm \let\bf=\shortcontbf + \let\sl=\shortcontsl \let\tt=\shortconttt + \rm + \hyphenpenalty = 10000 + \advance\baselineskip by 1pt % Open it up a little. + \def\numsecentry##1##2##3##4{} + \let\appsecentry = \numsecentry + \let\unnsecentry = \numsecentry + \let\numsubsecentry = \numsecentry + \let\appsubsecentry = \numsecentry + \let\unnsubsecentry = \numsecentry + \let\numsubsubsecentry = \numsecentry + \let\appsubsubsecentry = \numsecentry + \let\unnsubsubsecentry = \numsecentry + \openin 1 \jobname.toc + \ifeof 1 \else + \input \jobname.toc + \fi + \closein 1 + \vfill \eject + \contentsalignmacro % in case @setchapternewpage odd is in effect + \endgroup + \lastnegativepageno = \pageno + \global\pageno = \savepageno +} +\let\shortcontents = \summarycontents + +% Typeset the label for a chapter or appendix for the short contents. +% The arg is, e.g., `A' for an appendix, or `3' for a chapter. +% +\def\shortchaplabel#1{% + % This space should be enough, since a single number is .5em, and the + % widest letter (M) is 1em, at least in the Computer Modern fonts. + % But use \hss just in case. + % (This space doesn't include the extra space that gets added after + % the label; that gets put in by \shortchapentry above.) + % + % We'd like to right-justify chapter numbers, but that looks strange + % with appendix letters. And right-justifying numbers and + % left-justifying letters looks strange when there is less than 10 + % chapters. Have to read the whole toc once to know how many chapters + % there are before deciding ... + \hbox to 1em{#1\hss}% +} + +% These macros generate individual entries in the table of contents. +% The first argument is the chapter or section name. +% The last argument is the page number. +% The arguments in between are the chapter number, section number, ... + +% Chapters, in the main contents. +\def\numchapentry#1#2#3#4{\dochapentry{#2\labelspace#1}{#4}} +% +% Chapters, in the short toc. +% See comments in \dochapentry re vbox and related settings. +\def\shortchapentry#1#2#3#4{% + \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#4\egroup}% +} + +% Appendices, in the main contents. +% Need the word Appendix, and a fixed-size box. +% +\def\appendixbox#1{% + % We use M since it's probably the widest letter. + \setbox0 = \hbox{\putwordAppendix{} M}% + \hbox to \wd0{\putwordAppendix{} #1\hss}} +% +\def\appentry#1#2#3#4{\dochapentry{\appendixbox{#2}\labelspace#1}{#4}} + +% Unnumbered chapters. +\def\unnchapentry#1#2#3#4{\dochapentry{#1}{#4}} +\def\shortunnchapentry#1#2#3#4{\tocentry{#1}{\doshortpageno\bgroup#4\egroup}} + +% Sections. +\def\numsecentry#1#2#3#4{\dosecentry{#2\labelspace#1}{#4}} +\let\appsecentry=\numsecentry +\def\unnsecentry#1#2#3#4{\dosecentry{#1}{#4}} + +% Subsections. +\def\numsubsecentry#1#2#3#4{\dosubsecentry{#2\labelspace#1}{#4}} +\let\appsubsecentry=\numsubsecentry +\def\unnsubsecentry#1#2#3#4{\dosubsecentry{#1}{#4}} + +% And subsubsections. +\def\numsubsubsecentry#1#2#3#4{\dosubsubsecentry{#2\labelspace#1}{#4}} +\let\appsubsubsecentry=\numsubsubsecentry +\def\unnsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{#4}} + +% This parameter controls the indentation of the various levels. +% Same as \defaultparindent. +\newdimen\tocindent \tocindent = 15pt + +% Now for the actual typesetting. In all these, #1 is the text and #2 is the +% page number. +% +% If the toc has to be broken over pages, we want it to be at chapters +% if at all possible; hence the \penalty. +\def\dochapentry#1#2{% + \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip + \begingroup + \chapentryfonts + \tocentry{#1}{\dopageno\bgroup#2\egroup}% + \endgroup + \nobreak\vskip .25\baselineskip plus.1\baselineskip +} + +\def\dosecentry#1#2{\begingroup + \secentryfonts \leftskip=\tocindent + \tocentry{#1}{\dopageno\bgroup#2\egroup}% +\endgroup} + +\def\dosubsecentry#1#2{\begingroup + \subsecentryfonts \leftskip=2\tocindent + \tocentry{#1}{\dopageno\bgroup#2\egroup}% +\endgroup} + +\def\dosubsubsecentry#1#2{\begingroup + \subsubsecentryfonts \leftskip=3\tocindent + \tocentry{#1}{\dopageno\bgroup#2\egroup}% +\endgroup} + +% We use the same \entry macro as for the index entries. +\let\tocentry = \entry + +% Space between chapter (or whatever) number and the title. +\def\labelspace{\hskip1em \relax} + +\def\dopageno#1{{\rm #1}} +\def\doshortpageno#1{{\rm #1}} + +\def\chapentryfonts{\secfonts \rm} +\def\secentryfonts{\textfonts} +\def\subsecentryfonts{\textfonts} +\def\subsubsecentryfonts{\textfonts} + + +\message{environments,} +% @foo ... @end foo. + +% @point{}, @result{}, @expansion{}, @print{}, @equiv{}. +% +% Since these characters are used in examples, it should be an even number of +% \tt widths. Each \tt character is 1en, so two makes it 1em. +% +\def\point{$\star$} +\def\result{\leavevmode\raise.15ex\hbox to 1em{\hfil$\Rightarrow$\hfil}} +\def\expansion{\leavevmode\raise.1ex\hbox to 1em{\hfil$\mapsto$\hfil}} +\def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}} +\def\equiv{\leavevmode\lower.1ex\hbox to 1em{\hfil$\ptexequiv$\hfil}} + +% The @error{} command. +% Adapted from the TeXbook's \boxit. +% +\newbox\errorbox +% +{\tentt \global\dimen0 = 3em}% Width of the box. +\dimen2 = .55pt % Thickness of rules +% The text. (`r' is open on the right, `e' somewhat less so on the left.) +\setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt} +% +\setbox\errorbox=\hbox to \dimen0{\hfil + \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right. + \advance\hsize by -2\dimen2 % Rules. + \vbox{% + \hrule height\dimen2 + \hbox{\vrule width\dimen2 \kern3pt % Space to left of text. + \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below. + \kern3pt\vrule width\dimen2}% Space to right. + \hrule height\dimen2} + \hfil} +% +\def\error{\leavevmode\lower.7ex\copy\errorbox} + +% @tex ... @end tex escapes into raw Tex temporarily. +% One exception: @ is still an escape character, so that @end tex works. +% But \@ or @@ will get a plain tex @ character. + +\envdef\tex{% + \catcode `\\=0 \catcode `\{=1 \catcode `\}=2 + \catcode `\$=3 \catcode `\&=4 \catcode `\#=6 + \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie + \catcode `\%=14 + \catcode `\+=\other + \catcode `\"=\other + \catcode `\|=\other + \catcode `\<=\other + \catcode `\>=\other + \escapechar=`\\ + % + \let\b=\ptexb + \let\bullet=\ptexbullet + \let\c=\ptexc + \let\,=\ptexcomma + \let\.=\ptexdot + \let\dots=\ptexdots + \let\equiv=\ptexequiv + \let\!=\ptexexclam + \let\i=\ptexi + \let\indent=\ptexindent + \let\noindent=\ptexnoindent + \let\{=\ptexlbrace + \let\+=\tabalign + \let\}=\ptexrbrace + \let\/=\ptexslash + \let\*=\ptexstar + \let\t=\ptext + % + \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}% + \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}% + \def\@{@}% +} +% There is no need to define \Etex. + +% Define @lisp ... @end lisp. +% @lisp environment forms a group so it can rebind things, +% including the definition of @end lisp (which normally is erroneous). + +% Amount to narrow the margins by for @lisp. +\newskip\lispnarrowing \lispnarrowing=0.4in + +% This is the definition that ^^M gets inside @lisp, @example, and other +% such environments. \null is better than a space, since it doesn't +% have any width. +\def\lisppar{\null\endgraf} + +% This space is always present above and below environments. +\newskip\envskipamount \envskipamount = 0pt + +% Make spacing and below environment symmetrical. We use \parskip here +% to help in doing that, since in @example-like environments \parskip +% is reset to zero; thus the \afterenvbreak inserts no space -- but the +% start of the next paragraph will insert \parskip. +% +\def\aboveenvbreak{{% + % =10000 instead of <10000 because of a special case in \itemzzz and + % \sectionheading, q.v. + \ifnum \lastpenalty=10000 \else + \advance\envskipamount by \parskip + \endgraf + \ifdim\lastskip<\envskipamount + \removelastskip + % it's not a good place to break if the last penalty was \nobreak + % or better ... + \ifnum\lastpenalty<10000 \penalty-50 \fi + \vskip\envskipamount + \fi + \fi +}} + +\let\afterenvbreak = \aboveenvbreak + +% \nonarrowing is a flag. If "set", @lisp etc don't narrow margins. +\let\nonarrowing=\relax + +% @cartouche ... @end cartouche: draw rectangle w/rounded corners around +% environment contents. +\font\circle=lcircle10 +\newdimen\circthick +\newdimen\cartouter\newdimen\cartinner +\newskip\normbskip\newskip\normpskip\newskip\normlskip +\circthick=\fontdimen8\circle +% +\def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth +\def\ctr{{\hskip 6pt\circle\char'010}} +\def\cbl{{\circle\char'012\hskip -6pt}} +\def\cbr{{\hskip 6pt\circle\char'011}} +\def\carttop{\hbox to \cartouter{\hskip\lskip + \ctl\leaders\hrule height\circthick\hfil\ctr + \hskip\rskip}} +\def\cartbot{\hbox to \cartouter{\hskip\lskip + \cbl\leaders\hrule height\circthick\hfil\cbr + \hskip\rskip}} +% +\newskip\lskip\newskip\rskip + +\envdef\cartouche{% + \ifhmode\par\fi % can't be in the midst of a paragraph. + \startsavinginserts + \lskip=\leftskip \rskip=\rightskip + \leftskip=0pt\rightskip=0pt % we want these *outside*. + \cartinner=\hsize \advance\cartinner by-\lskip + \advance\cartinner by-\rskip + \cartouter=\hsize + \advance\cartouter by 18.4pt % allow for 3pt kerns on either + % side, and for 6pt waste from + % each corner char, and rule thickness + \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip + % Flag to tell @lisp, etc., not to narrow margin. + \let\nonarrowing=\comment + \vbox\bgroup + \baselineskip=0pt\parskip=0pt\lineskip=0pt + \carttop + \hbox\bgroup + \hskip\lskip + \vrule\kern3pt + \vbox\bgroup + \kern3pt + \hsize=\cartinner + \baselineskip=\normbskip + \lineskip=\normlskip + \parskip=\normpskip + \vskip -\parskip + \comment % For explanation, see the end of \def\group. +} +\def\Ecartouche{% + \ifhmode\par\fi + \kern3pt + \egroup + \kern3pt\vrule + \hskip\rskip + \egroup + \cartbot + \egroup + \checkinserts +} + + +% This macro is called at the beginning of all the @example variants, +% inside a group. +\def\nonfillstart{% + \aboveenvbreak + \hfuzz = 12pt % Don't be fussy + \sepspaces % Make spaces be word-separators rather than space tokens. + \let\par = \lisppar % don't ignore blank lines + \obeylines % each line of input is a line of output + \parskip = 0pt + \parindent = 0pt + \emergencystretch = 0pt % don't try to avoid overfull boxes + % @cartouche defines \nonarrowing to inhibit narrowing + % at next level down. + \ifx\nonarrowing\relax + \advance \leftskip by \lispnarrowing + \exdentamount=\lispnarrowing + \fi + \let\exdent=\nofillexdent +} + +% If you want all examples etc. small: @set dispenvsize small. +% If you want even small examples the full size: @set dispenvsize nosmall. +% This affects the following displayed environments: +% @example, @display, @format, @lisp +% +\def\smallword{small} +\def\nosmallword{nosmall} +\let\SETdispenvsize\relax +\def\setnormaldispenv{% + \ifx\SETdispenvsize\smallword + \smallexamplefonts \rm + \fi +} +\def\setsmalldispenv{% + \ifx\SETdispenvsize\nosmallword + \else + \smallexamplefonts \rm + \fi +} + +% We often define two environments, @foo and @smallfoo. +% Let's do it by one command: +\def\makedispenv #1#2{ + \expandafter\envdef\csname#1\endcsname {\setnormaldispenv #2} + \expandafter\envdef\csname small#1\endcsname {\setsmalldispenv #2} + \expandafter\let\csname E#1\endcsname \afterenvbreak + \expandafter\let\csname Esmall#1\endcsname \afterenvbreak +} + +% Define two synonyms: +\def\maketwodispenvs #1#2#3{ + \makedispenv{#1}{#3} + \makedispenv{#2}{#3} +} + +% @lisp: indented, narrowed, typewriter font; @example: same as @lisp. +% +% @smallexample and @smalllisp: use smaller fonts. +% Originally contributed by Pavel@xerox. +% +\maketwodispenvs {lisp}{example}{% + \nonfillstart + \tt + \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special. + \gobble % eat return +} + +% @display/@smalldisplay: same as @lisp except keep current font. +% +\makedispenv {display}{% + \nonfillstart + \gobble +} + +% @format/@smallformat: same as @display except don't narrow margins. +% +\makedispenv{format}{% + \let\nonarrowing = t% + \nonfillstart + \gobble +} + +% @flushleft: same as @format, but doesn't obey \SETdispenvsize. +\envdef\flushleft{% + \let\nonarrowing = t% + \nonfillstart + \gobble +} +\let\Eflushleft = \afterenvbreak + +% @flushright. +% +\envdef\flushright{% + \let\nonarrowing = t% + \nonfillstart + \advance\leftskip by 0pt plus 1fill + \gobble +} +\let\Eflushright = \afterenvbreak + + +% @quotation does normal linebreaking (hence we can't use \nonfillstart) +% and narrows the margins. We keep \parskip nonzero in general, since +% we're doing normal filling. So, when using \aboveenvbreak and +% \afterenvbreak, temporarily make \parskip 0. +% +\envdef\quotation{% + {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip + \parindent=0pt + % + % @cartouche defines \nonarrowing to inhibit narrowing at next level down. + \ifx\nonarrowing\relax + \advance\leftskip by \lispnarrowing + \advance\rightskip by \lispnarrowing + \exdentamount = \lispnarrowing + \let\nonarrowing = \relax + \fi + \parsearg\quotationlabel +} + +% We have retained a nonzero parskip for the environment, since we're +% doing normal filling. +% +\def\Equotation{% + \par + \ifx\quotationauthor\undefined\else + % indent a bit. + \leftline{\kern 2\leftskip \sl ---\quotationauthor}% + \fi + {\parskip=0pt \afterenvbreak}% +} + +% If we're given an argument, typeset it in bold with a colon after. +\def\quotationlabel#1{% + \def\temp{#1}% + \ifx\temp\empty \else + {\bf #1: }% + \fi +} + + +% LaTeX-like @verbatim...@end verbatim and @verb{...} +% If we want to allow any as delimiter, +% we need the curly braces so that makeinfo sees the @verb command, eg: +% `@verbx...x' would look like the '@verbx' command. --janneke@gnu.org +% +% [Knuth]: Donald Ervin Knuth, 1996. The TeXbook. +% +% [Knuth] p.344; only we need to do the other characters Texinfo sets +% active too. Otherwise, they get lost as the first character on a +% verbatim line. +\def\dospecials{% + \do\ \do\\\do\{\do\}\do\$\do\&% + \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~% + \do\<\do\>\do\|\do\@\do+\do\"% +} +% +% [Knuth] p. 380 +\def\uncatcodespecials{% + \def\do##1{\catcode`##1=\other}\dospecials} +% +% [Knuth] pp. 380,381,391 +% Disable Spanish ligatures ?` and !` of \tt font +\begingroup + \catcode`\`=\active\gdef`{\relax\lq} +\endgroup +% +% Setup for the @verb command. +% +% Eight spaces for a tab +\begingroup + \catcode`\^^I=\active + \gdef\tabeightspaces{\catcode`\^^I=\active\def^^I{\ \ \ \ \ \ \ \ }} +\endgroup +% +\def\setupverb{% + \tt % easiest (and conventionally used) font for verbatim + \def\par{\leavevmode\endgraf}% + \catcode`\`=\active + \tabeightspaces + % Respect line breaks, + % print special symbols as themselves, and + % make each space count + % must do in this order: + \obeylines \uncatcodespecials \sepspaces +} + +% Setup for the @verbatim environment +% +% Real tab expansion +\newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount +% +\def\starttabbox{\setbox0=\hbox\bgroup} +\begingroup + \catcode`\^^I=\active + \gdef\tabexpand{% + \catcode`\^^I=\active + \def^^I{\leavevmode\egroup + \dimen0=\wd0 % the width so far, or since the previous tab + \divide\dimen0 by\tabw + \multiply\dimen0 by\tabw % compute previous multiple of \tabw + \advance\dimen0 by\tabw % advance to next multiple of \tabw + \wd0=\dimen0 \box0 \starttabbox + }% + } +\endgroup +\def\setupverbatim{% + \nonfillstart + \advance\leftskip by -\defbodyindent + % Easiest (and conventionally used) font for verbatim + \tt + \def\par{\leavevmode\egroup\box0\endgraf}% + \catcode`\`=\active + \tabexpand + % Respect line breaks, + % print special symbols as themselves, and + % make each space count + % must do in this order: + \obeylines \uncatcodespecials \sepspaces + \everypar{\starttabbox}% +} + +% Do the @verb magic: verbatim text is quoted by unique +% delimiter characters. Before first delimiter expect a +% right brace, after last delimiter expect closing brace: +% +% \def\doverb'{'#1'}'{#1} +% +% [Knuth] p. 382; only eat outer {} +\begingroup + \catcode`[=1\catcode`]=2\catcode`\{=\other\catcode`\}=\other + \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next] +\endgroup +% +\def\verb{\begingroup\setupverb\doverb} +% +% +% Do the @verbatim magic: define the macro \doverbatim so that +% the (first) argument ends when '@end verbatim' is reached, ie: +% +% \def\doverbatim#1@end verbatim{#1} +% +% For Texinfo it's a lot easier than for LaTeX, +% because texinfo's \verbatim doesn't stop at '\end{verbatim}': +% we need not redefine '\', '{' and '}'. +% +% Inspired by LaTeX's verbatim command set [latex.ltx] +% +\begingroup + \catcode`\ =\active + \obeylines % + % ignore everything up to the first ^^M, that's the newline at the end + % of the @verbatim input line itself. Otherwise we get an extra blank + % line in the output. + \xdef\doverbatim#1^^M#2@end verbatim{#2\noexpand\end\gobble verbatim}% + % We really want {...\end verbatim} in the body of the macro, but + % without the active space; thus we have to use \xdef and \gobble. +\endgroup +% +\envdef\verbatim{% + \setupverbatim\doverbatim +} +\let\Everbatim = \afterenvbreak + + +% @verbatiminclude FILE - insert text of file in verbatim environment. +% +\def\verbatiminclude{\parseargusing\filenamecatcodes\doverbatiminclude} +% +\def\doverbatiminclude#1{% + {% + \makevalueexpandable + \setupverbatim + \input #1 + \afterenvbreak + }% +} + +% @copying ... @end copying. +% Save the text away for @insertcopying later. +% +% We save the uninterpreted tokens, rather than creating a box. +% Saving the text in a box would be much easier, but then all the +% typesetting commands (@smallbook, font changes, etc.) have to be done +% beforehand -- and a) we want @copying to be done first in the source +% file; b) letting users define the frontmatter in as flexible order as +% possible is very desirable. +% +\def\copying{\checkenv{}\begingroup\scanargctxt\docopying} +\def\docopying#1@end copying{\endgroup\def\copyingtext{#1}} +% +\def\insertcopying{% + \begingroup + \parindent = 0pt % paragraph indentation looks wrong on title page + \scanexp\copyingtext + \endgroup +} + +\message{defuns,} +% @defun etc. + +\newskip\defbodyindent \defbodyindent=.4in +\newskip\defargsindent \defargsindent=50pt +\newskip\deflastargmargin \deflastargmargin=18pt + +% Start the processing of @deffn: +\def\startdefun{% + \ifnum\lastpenalty<10000 + \medbreak + \else + % If there are two @def commands in a row, we'll have a \nobreak, + % which is there to keep the function description together with its + % header. But if there's nothing but headers, we need to allow a + % break somewhere. Check specifically for penalty 10002, inserted + % by \defargscommonending, instead of 10000, since the sectioning + % commands also insert a nobreak penalty, and we don't want to allow + % a break between a section heading and a defun. + % + \ifnum\lastpenalty=10002 \penalty2000 \fi + % + % Similarly, after a section heading, do not allow a break. + % But do insert the glue. + \medskip % preceded by discardable penalty, so not a breakpoint + \fi + % + \parindent=0in + \advance\leftskip by \defbodyindent + \exdentamount=\defbodyindent +} + +\def\dodefunx#1{% + % First, check whether we are in the right environment: + \checkenv#1% + % + % As above, allow line break if we have multiple x headers in a row. + % It's not a great place, though. + \ifnum\lastpenalty=10002 \penalty3000 \fi + % + % And now, it's time to reuse the body of the original defun: + \expandafter\gobbledefun#1% +} +\def\gobbledefun#1\startdefun{} + +% \printdefunline \deffnheader{text} +% +\def\printdefunline#1#2{% + \begingroup + % call \deffnheader: + #1#2 \endheader + % common ending: + \interlinepenalty = 10000 + \advance\rightskip by 0pt plus 1fil + \endgraf + \nobreak\vskip -\parskip + \penalty 10002 % signal to \startdefun and \dodefunx + % Some of the @defun-type tags do not enable magic parentheses, + % rendering the following check redundant. But we don't optimize. + \checkparencounts + \endgroup +} + +\def\Edefun{\endgraf\medbreak} + +% \makedefun{deffn} creates \deffn, \deffnx and \Edeffn; +% the only thing remainnig is to define \deffnheader. +% +\def\makedefun#1{% + \expandafter\let\csname E#1\endcsname = \Edefun + \edef\temp{\noexpand\domakedefun + \makecsname{#1}\makecsname{#1x}\makecsname{#1header}}% + \temp +} + +% \domakedefun \deffn \deffnx \deffnheader +% +% Define \deffn and \deffnx, without parameters. +% \deffnheader has to be defined explicitly. +% +\def\domakedefun#1#2#3{% + \envdef#1{% + \startdefun + \parseargusing\activeparens{\printdefunline#3}% + }% + \def#2{\dodefunx#1}% + \def#3% +} + +%%% Untyped functions: + +% @deffn category name args +\makedefun{deffn}{\deffngeneral{}} + +% @deffn category class name args +\makedefun{defop}#1 {\defopon{#1\ \putwordon}} + +% \defopon {category on}class name args +\def\defopon#1#2 {\deffngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} } + +% \deffngeneral {subind}category name args +% +\def\deffngeneral#1#2 #3 #4\endheader{% + % Remember that \dosubind{fn}{foo}{} is equivalent to \doind{fn}{foo}. + \dosubind{fn}{\code{#3}}{#1}% + \defname{#2}{}{#3}\magicamp\defunargs{#4\unskip}% +} + +%%% Typed functions: + +% @deftypefn category type name args +\makedefun{deftypefn}{\deftypefngeneral{}} + +% @deftypeop category class type name args +\makedefun{deftypeop}#1 {\deftypeopon{#1\ \putwordon}} + +% \deftypeopon {category on}class type name args +\def\deftypeopon#1#2 {\deftypefngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} } + +% \deftypefngeneral {subind}category type name args +% +\def\deftypefngeneral#1#2 #3 #4 #5\endheader{% + \dosubind{fn}{\code{#4}}{#1}% + \defname{#2}{#3}{#4}\defunargs{#5\unskip}% +} + +%%% Typed variables: + +% @deftypevr category type var args +\makedefun{deftypevr}{\deftypecvgeneral{}} + +% @deftypecv category class type var args +\makedefun{deftypecv}#1 {\deftypecvof{#1\ \putwordof}} + +% \deftypecvof {category of}class type var args +\def\deftypecvof#1#2 {\deftypecvgeneral{\putwordof\ \code{#2}}{#1\ \code{#2}} } + +% \deftypecvgeneral {subind}category type var args +% +\def\deftypecvgeneral#1#2 #3 #4 #5\endheader{% + \dosubind{vr}{\code{#4}}{#1}% + \defname{#2}{#3}{#4}\defunargs{#5\unskip}% +} + +%%% Untyped variables: + +% @defvr category var args +\makedefun{defvr}#1 {\deftypevrheader{#1} {} } + +% @defcv category class var args +\makedefun{defcv}#1 {\defcvof{#1\ \putwordof}} + +% \defcvof {category of}class var args +\def\defcvof#1#2 {\deftypecvof{#1}#2 {} } + +%%% Type: +% @deftp category name args +\makedefun{deftp}#1 #2 #3\endheader{% + \doind{tp}{\code{#2}}% + \defname{#1}{}{#2}\defunargs{#3\unskip}% +} + +% Remaining @defun-like shortcuts: +\makedefun{defun}{\deffnheader{\putwordDeffunc} } +\makedefun{defmac}{\deffnheader{\putwordDefmac} } +\makedefun{defspec}{\deffnheader{\putwordDefspec} } +\makedefun{deftypefun}{\deftypefnheader{\putwordDeffunc} } +\makedefun{defvar}{\defvrheader{\putwordDefvar} } +\makedefun{defopt}{\defvrheader{\putwordDefopt} } +\makedefun{deftypevar}{\deftypevrheader{\putwordDefvar} } +\makedefun{defmethod}{\defopon\putwordMethodon} +\makedefun{deftypemethod}{\deftypeopon\putwordMethodon} +\makedefun{defivar}{\defcvof\putwordInstanceVariableof} +\makedefun{deftypeivar}{\deftypecvof\putwordInstanceVariableof} + +% \defname, which formats the name of the @def (not the args). +% #1 is the category, such as "Function". +% #2 is the return type, if any. +% #3 is the function name. +% +% We are followed by (but not passed) the arguments, if any. +% +\def\defname#1#2#3{% + % Get the values of \leftskip and \rightskip as they were outside the @def... + \advance\leftskip by -\defbodyindent + % + % How we'll format the type name. Putting it in brackets helps + % distinguish it from the body text that may end up on the next line + % just below it. + \def\temp{#1}% + \setbox0=\hbox{\kern\deflastargmargin \ifx\temp\empty\else [\rm\temp]\fi} + % + % Figure out line sizes for the paragraph shape. + % The first line needs space for \box0; but if \rightskip is nonzero, + % we need only space for the part of \box0 which exceeds it: + \dimen0=\hsize \advance\dimen0 by -\wd0 \advance\dimen0 by \rightskip + % The continuations: + \dimen2=\hsize \advance\dimen2 by -\defargsindent + % (plain.tex says that \dimen1 should be used only as global.) + \parshape 2 0in \dimen0 \defargsindent \dimen2 + % + % Put the type name to the right margin. + \noindent + \hbox to 0pt{% + \hfil\box0 \kern-\hsize + % \hsize has to be shortened this way: + \kern\leftskip + % Intentionally do not respect \rightskip, since we need the space. + }% + % + % Allow all lines to be underfull without complaint: + \tolerance=10000 \hbadness=10000 + \exdentamount=\defbodyindent + {% + % defun fonts. We use typewriter by default (used to be bold) because: + % . we're printing identifiers, they should be in tt in principle. + % . in languages with many accents, such as Czech or French, it's + % common to leave accents off identifiers. The result looks ok in + % tt, but exceedingly strange in rm. + % . we don't want -- and --- to be treated as ligatures. + % . this still does not fix the ?` and !` ligatures, but so far no + % one has made identifiers using them :). + \df \tt + \def\temp{#2}% return value type + \ifx\temp\empty\else \tclose{\temp} \fi + #3% output function name + }% + {\rm\enskip}% hskip 0.5 em of \tenrm + % + \boldbrax + % arguments will be output next, if any. +} + +% Print arguments in slanted roman (not ttsl), inconsistently with using +% tt for the name. This is because literal text is sometimes needed in +% the argument list (groff manual), and ttsl and tt are not very +% distinguishable. Prevent hyphenation at `-' chars. +% +\def\defunargs#1{% + % use sl by default (not ttsl), + % tt for the names. + \df \sl \hyphenchar\font=0 + % + % On the other hand, if an argument has two dashes (for instance), we + % want a way to get ttsl. Let's try @var for that. + \let\var=\ttslanted + #1% + \sl\hyphenchar\font=45 +} + +% We want ()&[] to print specially on the defun line. +% +\def\activeparens{% + \catcode`\(=\active \catcode`\)=\active + \catcode`\[=\active \catcode`\]=\active + \catcode`\&=\active +} + +% Make control sequences which act like normal parenthesis chars. +\let\lparen = ( \let\rparen = ) + +% Be sure that we always have a definition for `(', etc. For example, +% if the fn name has parens in it, \boldbrax will not be in effect yet, +% so TeX would otherwise complain about undefined control sequence. +{ + \activeparens + \global\let(=\lparen \global\let)=\rparen + \global\let[=\lbrack \global\let]=\rbrack + \global\let& = \& + + \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb} + \gdef\magicamp{\let&=\amprm} +} + +\newcount\parencount + +% If we encounter &foo, then turn on ()-hacking afterwards +\newif\ifampseen +\def\amprm#1 {\ampseentrue{\bf\ }} + +\def\parenfont{% + \ifampseen + % At the first level, print parens in roman, + % otherwise use the default font. + \ifnum \parencount=1 \rm \fi + \else + % The \sf parens (in \boldbrax) actually are a little bolder than + % the contained text. This is especially needed for [ and ] . + \sf + \fi +} +\def\infirstlevel#1{% + \ifampseen + \ifnum\parencount=1 + #1% + \fi + \fi +} +\def\bfafterword#1 {#1 \bf} + +\def\opnr{% + \global\advance\parencount by 1 + {\parenfont(}% + \infirstlevel \bfafterword +} +\def\clnr{% + {\parenfont)}% + \infirstlevel \sl + \global\advance\parencount by -1 +} + +\newcount\brackcount +\def\lbrb{% + \global\advance\brackcount by 1 + {\bf[}% +} +\def\rbrb{% + {\bf]}% + \global\advance\brackcount by -1 +} + +\def\checkparencounts{% + \ifnum\parencount=0 \else \badparencount \fi + \ifnum\brackcount=0 \else \badbrackcount \fi +} +\def\badparencount{% + \errmessage{Unbalanced parentheses in @def}% + \global\parencount=0 +} +\def\badbrackcount{% + \errmessage{Unbalanced square braces in @def}% + \global\brackcount=0 +} + + +\message{macros,} +% @macro. + +% To do this right we need a feature of e-TeX, \scantokens, +% which we arrange to emulate with a temporary file in ordinary TeX. +\ifx\eTeXversion\undefined + \newwrite\macscribble + \def\scantokens#1{% + \toks0={#1}% + \immediate\openout\macscribble=\jobname.tmp + \immediate\write\macscribble{\the\toks0}% + \immediate\closeout\macscribble + \input \jobname.tmp + } +\fi + +\def\scanmacro#1{% + \begingroup + \newlinechar`\^^M + \let\xeatspaces\eatspaces + % Undo catcode changes of \startcontents and \doprintindex + % When called from @insertcopying or (short)caption, we need active + % backslash to get it printed correctly. Previously, we had + % \catcode`\\=\other instead. We'll see whether a problem appears + % with macro expansion. --kasal, 19aug04 + \catcode`\@=0 \catcode`\\=\active \escapechar=`\@ + % ... and \example + \spaceisspace + % + % Append \endinput to make sure that TeX does not see the ending newline. + % + % I've verified that it is necessary both for e-TeX and for ordinary TeX + % --kasal, 29nov03 + \scantokens{#1\endinput}% + \endgroup +} + +\def\scanexp#1{% + \edef\temp{\noexpand\scanmacro{#1}}% + \temp +} + +\newcount\paramno % Count of parameters +\newtoks\macname % Macro name +\newif\ifrecursive % Is it recursive? +\def\macrolist{} % List of all defined macros in the form + % \do\macro1\do\macro2... + +% Utility routines. +% This does \let #1 = #2, with \csnames; that is, +% \let \csname#1\endcsname = \csname#2\endcsname +% (except of course we have to play expansion games). +% +\def\cslet#1#2{% + \expandafter\let + \csname#1\expandafter\endcsname + \csname#2\endcsname +} + +% Trim leading and trailing spaces off a string. +% Concepts from aro-bend problem 15 (see CTAN). +{\catcode`\@=11 +\gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }} +\gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@} +\gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @} +\def\unbrace#1{#1} +\unbrace{\gdef\trim@@@ #1 } #2@{#1} +} + +% Trim a single trailing ^^M off a string. +{\catcode`\^^M=\other \catcode`\Q=3% +\gdef\eatcr #1{\eatcra #1Q^^MQ}% +\gdef\eatcra#1^^MQ{\eatcrb#1Q}% +\gdef\eatcrb#1Q#2Q{#1}% +} + +% Macro bodies are absorbed as an argument in a context where +% all characters are catcode 10, 11 or 12, except \ which is active +% (as in normal texinfo). It is necessary to change the definition of \. + +% It's necessary to have hard CRs when the macro is executed. This is +% done by making ^^M (\endlinechar) catcode 12 when reading the macro +% body, and then making it the \newlinechar in \scanmacro. + +\def\scanctxt{% + \catcode`\"=\other + \catcode`\+=\other + \catcode`\<=\other + \catcode`\>=\other + \catcode`\@=\other + \catcode`\^=\other + \catcode`\_=\other + \catcode`\|=\other + \catcode`\~=\other +} + +\def\scanargctxt{% + \scanctxt + \catcode`\\=\other + \catcode`\^^M=\other +} + +\def\macrobodyctxt{% + \scanctxt + \catcode`\{=\other + \catcode`\}=\other + \catcode`\^^M=\other + \usembodybackslash +} + +\def\macroargctxt{% + \scanctxt + \catcode`\\=\other +} + +% \mbodybackslash is the definition of \ in @macro bodies. +% It maps \foo\ => \csname macarg.foo\endcsname => #N +% where N is the macro parameter number. +% We define \csname macarg.\endcsname to be \realbackslash, so +% \\ in macro replacement text gets you a backslash. + +{\catcode`@=0 @catcode`@\=@active + @gdef@usembodybackslash{@let\=@mbodybackslash} + @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname} +} +\expandafter\def\csname macarg.\endcsname{\realbackslash} + +\def\macro{\recursivefalse\parsearg\macroxxx} +\def\rmacro{\recursivetrue\parsearg\macroxxx} + +\def\macroxxx#1{% + \getargs{#1}% now \macname is the macname and \argl the arglist + \ifx\argl\empty % no arguments + \paramno=0% + \else + \expandafter\parsemargdef \argl;% + \fi + \if1\csname ismacro.\the\macname\endcsname + \message{Warning: redefining \the\macname}% + \else + \expandafter\ifx\csname \the\macname\endcsname \relax + \else \errmessage{Macro name \the\macname\space already defined}\fi + \global\cslet{macsave.\the\macname}{\the\macname}% + \global\expandafter\let\csname ismacro.\the\macname\endcsname=1% + % Add the macroname to \macrolist + \toks0 = \expandafter{\macrolist\do}% + \xdef\macrolist{\the\toks0 + \expandafter\noexpand\csname\the\macname\endcsname}% + \fi + \begingroup \macrobodyctxt + \ifrecursive \expandafter\parsermacbody + \else \expandafter\parsemacbody + \fi} + +\parseargdef\unmacro{% + \if1\csname ismacro.#1\endcsname + \global\cslet{#1}{macsave.#1}% + \global\expandafter\let \csname ismacro.#1\endcsname=0% + % Remove the macro name from \macrolist: + \begingroup + \expandafter\let\csname#1\endcsname \relax + \let\do\unmacrodo + \xdef\macrolist{\macrolist}% + \endgroup + \else + \errmessage{Macro #1 not defined}% + \fi +} + +% Called by \do from \dounmacro on each macro. The idea is to omit any +% macro definitions that have been changed to \relax. +% +\def\unmacrodo#1{% + \ifx#1\relax + % remove this + \else + \noexpand\do \noexpand #1% + \fi +} + +% This makes use of the obscure feature that if the last token of a +% is #, then the preceding argument is delimited by +% an opening brace, and that opening brace is not consumed. +\def\getargs#1{\getargsxxx#1{}} +\def\getargsxxx#1#{\getmacname #1 \relax\getmacargs} +\def\getmacname #1 #2\relax{\macname={#1}} +\def\getmacargs#1{\def\argl{#1}} + +% Parse the optional {params} list. Set up \paramno and \paramlist +% so \defmacro knows what to do. Define \macarg.blah for each blah +% in the params list, to be ##N where N is the position in that list. +% That gets used by \mbodybackslash (above). + +% We need to get `macro parameter char #' into several definitions. +% The technique used is stolen from LaTeX: let \hash be something +% unexpandable, insert that wherever you need a #, and then redefine +% it to # just before using the token list produced. +% +% The same technique is used to protect \eatspaces till just before +% the macro is used. + +\def\parsemargdef#1;{\paramno=0\def\paramlist{}% + \let\hash\relax\let\xeatspaces\relax\parsemargdefxxx#1,;,} +\def\parsemargdefxxx#1,{% + \if#1;\let\next=\relax + \else \let\next=\parsemargdefxxx + \advance\paramno by 1% + \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname + {\xeatspaces{\hash\the\paramno}}% + \edef\paramlist{\paramlist\hash\the\paramno,}% + \fi\next} + +% These two commands read recursive and nonrecursive macro bodies. +% (They're different since rec and nonrec macros end differently.) + +\long\def\parsemacbody#1@end macro% +{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}% +\long\def\parsermacbody#1@end rmacro% +{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}% + +% This defines the macro itself. There are six cases: recursive and +% nonrecursive macros of zero, one, and many arguments. +% Much magic with \expandafter here. +% \xdef is used so that macro definitions will survive the file +% they're defined in; @include reads the file inside a group. +\def\defmacro{% + \let\hash=##% convert placeholders to macro parameter chars + \ifrecursive + \ifcase\paramno + % 0 + \expandafter\xdef\csname\the\macname\endcsname{% + \noexpand\scanmacro{\temp}}% + \or % 1 + \expandafter\xdef\csname\the\macname\endcsname{% + \bgroup\noexpand\macroargctxt + \noexpand\braceorline + \expandafter\noexpand\csname\the\macname xxx\endcsname}% + \expandafter\xdef\csname\the\macname xxx\endcsname##1{% + \egroup\noexpand\scanmacro{\temp}}% + \else % many + \expandafter\xdef\csname\the\macname\endcsname{% + \bgroup\noexpand\macroargctxt + \noexpand\csname\the\macname xx\endcsname}% + \expandafter\xdef\csname\the\macname xx\endcsname##1{% + \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% + \expandafter\expandafter + \expandafter\xdef + \expandafter\expandafter + \csname\the\macname xxx\endcsname + \paramlist{\egroup\noexpand\scanmacro{\temp}}% + \fi + \else + \ifcase\paramno + % 0 + \expandafter\xdef\csname\the\macname\endcsname{% + \noexpand\norecurse{\the\macname}% + \noexpand\scanmacro{\temp}\egroup}% + \or % 1 + \expandafter\xdef\csname\the\macname\endcsname{% + \bgroup\noexpand\macroargctxt + \noexpand\braceorline + \expandafter\noexpand\csname\the\macname xxx\endcsname}% + \expandafter\xdef\csname\the\macname xxx\endcsname##1{% + \egroup + \noexpand\norecurse{\the\macname}% + \noexpand\scanmacro{\temp}\egroup}% + \else % many + \expandafter\xdef\csname\the\macname\endcsname{% + \bgroup\noexpand\macroargctxt + \expandafter\noexpand\csname\the\macname xx\endcsname}% + \expandafter\xdef\csname\the\macname xx\endcsname##1{% + \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% + \expandafter\expandafter + \expandafter\xdef + \expandafter\expandafter + \csname\the\macname xxx\endcsname + \paramlist{% + \egroup + \noexpand\norecurse{\the\macname}% + \noexpand\scanmacro{\temp}\egroup}% + \fi + \fi} + +\def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}} + +% \braceorline decides whether the next nonwhitespace character is a +% {. If so it reads up to the closing }, if not, it reads the whole +% line. Whatever was read is then fed to the next control sequence +% as an argument (by \parsebrace or \parsearg) +\def\braceorline#1{\let\next=#1\futurelet\nchar\braceorlinexxx} +\def\braceorlinexxx{% + \ifx\nchar\bgroup\else + \expandafter\parsearg + \fi \next} + +% We want to disable all macros during \shipout so that they are not +% expanded by \write. +\def\turnoffmacros{\begingroup \def\do##1{\let\noexpand##1=\relax}% + \edef\next{\macrolist}\expandafter\endgroup\next} + +% For \indexnofonts, we need to get rid of all macros, leaving only the +% arguments (if present). Of course this is not nearly correct, but it +% is the best we can do for now. makeinfo does not expand macros in the +% argument to @deffn, which ends up writing an index entry, and texindex +% isn't prepared for an index sort entry that starts with \. +% +% Since macro invocations are followed by braces, we can just redefine them +% to take a single TeX argument. The case of a macro invocation that +% goes to end-of-line is not handled. +% +\def\emptyusermacros{\begingroup + \def\do##1{\let\noexpand##1=\noexpand\asis}% + \edef\next{\macrolist}\expandafter\endgroup\next} + + +% @alias. +% We need some trickery to remove the optional spaces around the equal +% sign. Just make them active and then expand them all to nothing. +\def\alias{\parseargusing\obeyspaces\aliasxxx} +\def\aliasxxx #1{\aliasyyy#1\relax} +\def\aliasyyy #1=#2\relax{% + {% + \expandafter\let\obeyedspace=\empty + \xdef\next{\global\let\makecsname{#1}=\makecsname{#2}}% + }% + \next +} + + +\message{cross references,} + +\newwrite\auxfile + +\newif\ifhavexrefs % True if xref values are known. +\newif\ifwarnedxrefs % True if we warned once that they aren't known. + +% @inforef is relatively simple. +\def\inforef #1{\inforefzzz #1,,,,**} +\def\inforefzzz #1,#2,#3,#4**{\putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}}, + node \samp{\ignorespaces#1{}}} + +% @node's only job in TeX is to define \lastnode, which is used in +% cross-references. The @node line might or might not have commas, and +% might or might not have spaces before the first comma, like: +% @node foo , bar , ... +% We don't want such trailing spaces in the node name. +% +\parseargdef\node{\checkenv{}\donode #1 ,\finishnodeparse} +% +% also remove a trailing comma, in case of something like this: +% @node Help-Cross, , , Cross-refs +\def\donode#1 ,#2\finishnodeparse{\dodonode #1,\finishnodeparse} +\def\dodonode#1,#2\finishnodeparse{\gdef\lastnode{#1}} + +\let\nwnode=\node +\let\lastnode=\empty + +% Write a cross-reference definition for the current node. #1 is the +% type (Ynumbered, Yappendix, Ynothing). +% +\def\donoderef#1{% + \ifx\lastnode\empty\else + \setref{\lastnode}{#1}% + \global\let\lastnode=\empty + \fi +} + +% @anchor{NAME} -- define xref target at arbitrary point. +% +\newcount\savesfregister +% +\def\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi} +\def\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi} +\def\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces} + +% \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an +% anchor), which consists of three parts: +% 1) NAME-title - the current sectioning name taken from \thissection, +% or the anchor name. +% 2) NAME-snt - section number and type, passed as the SNT arg, or +% empty for anchors. +% 3) NAME-pg - the page number. +% +% This is called from \donoderef, \anchor, and \dofloat. In the case of +% floats, there is an additional part, which is not written here: +% 4) NAME-lof - the text as it should appear in a @listoffloats. +% +\def\setref#1#2{% + \pdfmkdest{#1}% + \iflinks + {% + \atdummies % preserve commands, but don't expand them + \turnoffactive + \otherbackslash + \edef\writexrdef##1##2{% + \write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef + ##1}{##2}}% these are parameters of \writexrdef + }% + \toks0 = \expandafter{\thissection}% + \immediate \writexrdef{title}{\the\toks0 }% + \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc. + \writexrdef{pg}{\folio}% will be written later, during \shipout + }% + \fi +} + +% @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is +% the node name, #2 the name of the Info cross-reference, #3 the printed +% node name, #4 the name of the Info file, #5 the name of the printed +% manual. All but the node name can be omitted. +% +\def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]} +\def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]} +\def\ref#1{\xrefX[#1,,,,,,,]} +\def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup + \unsepspaces + \def\printedmanual{\ignorespaces #5}% + \def\printedrefname{\ignorespaces #3}% + \setbox1=\hbox{\printedmanual\unskip}% + \setbox0=\hbox{\printedrefname\unskip}% + \ifdim \wd0 = 0pt + % No printed node name was explicitly given. + \expandafter\ifx\csname SETxref-automatic-section-title\endcsname\relax + % Use the node name inside the square brackets. + \def\printedrefname{\ignorespaces #1}% + \else + % Use the actual chapter/section title appear inside + % the square brackets. Use the real section title if we have it. + \ifdim \wd1 > 0pt + % It is in another manual, so we don't have it. + \def\printedrefname{\ignorespaces #1}% + \else + \ifhavexrefs + % We know the real title if we have the xref values. + \def\printedrefname{\refx{#1-title}{}}% + \else + % Otherwise just copy the Info node name. + \def\printedrefname{\ignorespaces #1}% + \fi% + \fi + \fi + \fi + % + % Make link in pdf output. + \ifpdf + \leavevmode + \getfilename{#4}% + {\turnoffactive \otherbackslash + \ifnum\filenamelength>0 + \startlink attr{/Border [0 0 0]}% + goto file{\the\filename.pdf} name{#1}% + \else + \startlink attr{/Border [0 0 0]}% + goto name{\pdfmkpgn{#1}}% + \fi + }% + \linkcolor + \fi + % + % Float references are printed completely differently: "Figure 1.2" + % instead of "[somenode], p.3". We distinguish them by the + % LABEL-title being set to a magic string. + {% + % Have to otherify everything special to allow the \csname to + % include an _ in the xref name, etc. + \indexnofonts + \turnoffactive + \otherbackslash + \expandafter\global\expandafter\let\expandafter\Xthisreftitle + \csname XR#1-title\endcsname + }% + \iffloat\Xthisreftitle + % If the user specified the print name (third arg) to the ref, + % print it instead of our usual "Figure 1.2". + \ifdim\wd0 = 0pt + \refx{#1-snt}% + \else + \printedrefname + \fi + % + % if the user also gave the printed manual name (fifth arg), append + % "in MANUALNAME". + \ifdim \wd1 > 0pt + \space \putwordin{} \cite{\printedmanual}% + \fi + \else + % node/anchor (non-float) references. + % + % If we use \unhbox0 and \unhbox1 to print the node names, TeX does not + % insert empty discretionaries after hyphens, which means that it will + % not find a line break at a hyphen in a node names. Since some manuals + % are best written with fairly long node names, containing hyphens, this + % is a loss. Therefore, we give the text of the node name again, so it + % is as if TeX is seeing it for the first time. + \ifdim \wd1 > 0pt + \putwordsection{} ``\printedrefname'' \putwordin{} \cite{\printedmanual}% + \else + % _ (for example) has to be the character _ for the purposes of the + % control sequence corresponding to the node, but it has to expand + % into the usual \leavevmode...\vrule stuff for purposes of + % printing. So we \turnoffactive for the \refx-snt, back on for the + % printing, back off for the \refx-pg. + {\turnoffactive \otherbackslash + % Only output a following space if the -snt ref is nonempty; for + % @unnumbered and @anchor, it won't be. + \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}% + \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi + }% + % output the `[mynode]' via a macro so it can be overridden. + \xrefprintnodename\printedrefname + % + % But we always want a comma and a space: + ,\space + % + % output the `page 3'. + \turnoffactive \otherbackslash \putwordpage\tie\refx{#1-pg}{}% + \fi + \fi + \endlink +\endgroup} + +% This macro is called from \xrefX for the `[nodename]' part of xref +% output. It's a separate macro only so it can be changed more easily, +% since square brackets don't work well in some documents. Particularly +% one that Bob is working on :). +% +\def\xrefprintnodename#1{[#1]} + +% Things referred to by \setref. +% +\def\Ynothing{} +\def\Yomitfromtoc{} +\def\Ynumbered{% + \ifnum\secno=0 + \putwordChapter@tie \the\chapno + \else \ifnum\subsecno=0 + \putwordSection@tie \the\chapno.\the\secno + \else \ifnum\subsubsecno=0 + \putwordSection@tie \the\chapno.\the\secno.\the\subsecno + \else + \putwordSection@tie \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno + \fi\fi\fi +} +\def\Yappendix{% + \ifnum\secno=0 + \putwordAppendix@tie @char\the\appendixno{}% + \else \ifnum\subsecno=0 + \putwordSection@tie @char\the\appendixno.\the\secno + \else \ifnum\subsubsecno=0 + \putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno + \else + \putwordSection@tie + @char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno + \fi\fi\fi +} + +% Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME. +% If its value is nonempty, SUFFIX is output afterward. +% +\def\refx#1#2{% + {% + \indexnofonts + \otherbackslash + \expandafter\global\expandafter\let\expandafter\thisrefX + \csname XR#1\endcsname + }% + \ifx\thisrefX\relax + % If not defined, say something at least. + \angleleft un\-de\-fined\angleright + \iflinks + \ifhavexrefs + \message{\linenumber Undefined cross reference `#1'.}% + \else + \ifwarnedxrefs\else + \global\warnedxrefstrue + \message{Cross reference values unknown; you must run TeX again.}% + \fi + \fi + \fi + \else + % It's defined, so just use it. + \thisrefX + \fi + #2% Output the suffix in any case. +} + +% This is the macro invoked by entries in the aux file. Usually it's +% just a \def (we prepend XR to the control sequence name to avoid +% collisions). But if this is a float type, we have more work to do. +% +\def\xrdef#1#2{% + \expandafter\gdef\csname XR#1\endcsname{#2}% remember this xref value. + % + % Was that xref control sequence that we just defined for a float? + \expandafter\iffloat\csname XR#1\endcsname + % it was a float, and we have the (safe) float type in \iffloattype. + \expandafter\let\expandafter\floatlist + \csname floatlist\iffloattype\endcsname + % + % Is this the first time we've seen this float type? + \expandafter\ifx\floatlist\relax + \toks0 = {\do}% yes, so just \do + \else + % had it before, so preserve previous elements in list. + \toks0 = \expandafter{\floatlist\do}% + \fi + % + % Remember this xref in the control sequence \floatlistFLOATTYPE, + % for later use in \listoffloats. + \expandafter\xdef\csname floatlist\iffloattype\endcsname{\the\toks0{#1}}% + \fi +} + +% Read the last existing aux file, if any. No error if none exists. +% +\def\tryauxfile{% + \openin 1 \jobname.aux + \ifeof 1 \else + \readauxfile + \global\havexrefstrue + \fi + \closein 1 +} + +\def\readauxfile{\begingroup + \catcode`\^^@=\other + \catcode`\^^A=\other + \catcode`\^^B=\other + \catcode`\^^C=\other + \catcode`\^^D=\other + \catcode`\^^E=\other + \catcode`\^^F=\other + \catcode`\^^G=\other + \catcode`\^^H=\other + \catcode`\^^K=\other + \catcode`\^^L=\other + \catcode`\^^N=\other + \catcode`\^^P=\other + \catcode`\^^Q=\other + \catcode`\^^R=\other + \catcode`\^^S=\other + \catcode`\^^T=\other + \catcode`\^^U=\other + \catcode`\^^V=\other + \catcode`\^^W=\other + \catcode`\^^X=\other + \catcode`\^^Z=\other + \catcode`\^^[=\other + \catcode`\^^\=\other + \catcode`\^^]=\other + \catcode`\^^^=\other + \catcode`\^^_=\other + % It was suggested to set the catcode of ^ to 7, which would allow ^^e4 etc. + % in xref tags, i.e., node names. But since ^^e4 notation isn't + % supported in the main text, it doesn't seem desirable. Furthermore, + % that is not enough: for node names that actually contain a ^ + % character, we would end up writing a line like this: 'xrdef {'hat + % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first + % argument, and \hat is not an expandable control sequence. It could + % all be worked out, but why? Either we support ^^ or we don't. + % + % The other change necessary for this was to define \auxhat: + % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter + % and then to call \auxhat in \setq. + % + \catcode`\^=\other + % + % Special characters. Should be turned off anyway, but... + \catcode`\~=\other + \catcode`\[=\other + \catcode`\]=\other + \catcode`\"=\other + \catcode`\_=\other + \catcode`\|=\other + \catcode`\<=\other + \catcode`\>=\other + \catcode`\$=\other + \catcode`\#=\other + \catcode`\&=\other + \catcode`\%=\other + \catcode`+=\other % avoid \+ for paranoia even though we've turned it off + % + % This is to support \ in node names and titles, since the \ + % characters end up in a \csname. It's easier than + % leaving it active and making its active definition an actual \ + % character. What I don't understand is why it works in the *value* + % of the xrdef. Seems like it should be a catcode12 \, and that + % should not typeset properly. But it works, so I'm moving on for + % now. --karl, 15jan04. + \catcode`\\=\other + % + % Make the characters 128-255 be printing characters. + {% + \count 1=128 + \def\loop{% + \catcode\count 1=\other + \advance\count 1 by 1 + \ifnum \count 1<256 \loop \fi + }% + }% + % + % @ is our escape character in .aux files, and we need braces. + \catcode`\{=1 + \catcode`\}=2 + \catcode`\@=0 + % + \input \jobname.aux +\endgroup} + + +\message{insertions,} +% including footnotes. + +\newcount \footnoteno + +% The trailing space in the following definition for supereject is +% vital for proper filling; pages come out unaligned when you do a +% pagealignmacro call if that space before the closing brace is +% removed. (Generally, numeric constants should always be followed by a +% space to prevent strange expansion errors.) +\def\supereject{\par\penalty -20000\footnoteno =0 } + +% @footnotestyle is meaningful for info output only. +\let\footnotestyle=\comment + +{\catcode `\@=11 +% +% Auto-number footnotes. Otherwise like plain. +\gdef\footnote{% + \let\indent=\ptexindent + \let\noindent=\ptexnoindent + \global\advance\footnoteno by \@ne + \edef\thisfootno{$^{\the\footnoteno}$}% + % + % In case the footnote comes at the end of a sentence, preserve the + % extra spacing after we do the footnote number. + \let\@sf\empty + \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\ptexslash\fi + % + % Remove inadvertent blank space before typesetting the footnote number. + \unskip + \thisfootno\@sf + \dofootnote +}% + +% Don't bother with the trickery in plain.tex to not require the +% footnote text as a parameter. Our footnotes don't need to be so general. +% +% Oh yes, they do; otherwise, @ifset (and anything else that uses +% \parseargline) fails inside footnotes because the tokens are fixed when +% the footnote is read. --karl, 16nov96. +% +\gdef\dofootnote{% + \insert\footins\bgroup + % We want to typeset this text as a normal paragraph, even if the + % footnote reference occurs in (for example) a display environment. + % So reset some parameters. + \hsize=\pagewidth + \interlinepenalty\interfootnotelinepenalty + \splittopskip\ht\strutbox % top baseline for broken footnotes + \splitmaxdepth\dp\strutbox + \floatingpenalty\@MM + \leftskip\z@skip + \rightskip\z@skip + \spaceskip\z@skip + \xspaceskip\z@skip + \parindent\defaultparindent + % + \smallfonts \rm + % + % Because we use hanging indentation in footnotes, a @noindent appears + % to exdent this text, so make it be a no-op. makeinfo does not use + % hanging indentation so @noindent can still be needed within footnote + % text after an @example or the like (not that this is good style). + \let\noindent = \relax + % + % Hang the footnote text off the number. Use \everypar in case the + % footnote extends for more than one paragraph. + \everypar = {\hang}% + \textindent{\thisfootno}% + % + % Don't crash into the line above the footnote text. Since this + % expands into a box, it must come within the paragraph, lest it + % provide a place where TeX can split the footnote. + \footstrut + \futurelet\next\fo@t +} +}%end \catcode `\@=11 + +% In case a @footnote appears in a vbox, save the footnote text and create +% the real \insert just after the vbox finished. Otherwise, the insertion +% would be lost. +% Similarily, if a @footnote appears inside an alignment, save the footnote +% text to a box and make the \insert when a row of the table is finished. +% And the same can be done for other insert classes. --kasal, 16nov03. + +% Replace the \insert primitive by a cheating macro. +% Deeper inside, just make sure that the saved insertions are not spilled +% out prematurely. +% +\def\startsavinginserts{% + \ifx \insert\ptexinsert + \let\insert\saveinsert + \else + \let\checkinserts\relax + \fi +} + +% This \insert replacement works for both \insert\footins{foo} and +% \insert\footins\bgroup foo\egroup, but it doesn't work for \insert27{foo}. +% +\def\saveinsert#1{% + \edef\next{\noexpand\savetobox \makeSAVEname#1}% + \afterassignment\next + % swallow the left brace + \let\temp = +} +\def\makeSAVEname#1{\makecsname{SAVE\expandafter\gobble\string#1}} +\def\savetobox#1{\global\setbox#1 = \vbox\bgroup \unvbox#1} + +\def\checksaveins#1{\ifvoid#1\else \placesaveins#1\fi} + +\def\placesaveins#1{% + \ptexinsert \csname\expandafter\gobblesave\string#1\endcsname + {\box#1}% +} + +% eat @SAVE -- beware, all of them have catcode \other: +{ + \def\dospecials{\do S\do A\do V\do E} \uncatcodespecials % ;-) + \gdef\gobblesave @SAVE{} +} + +% initialization: +\def\newsaveins #1{% + \edef\next{\noexpand\newsaveinsX \makeSAVEname#1}% + \next +} +\def\newsaveinsX #1{% + \csname newbox\endcsname #1% + \expandafter\def\expandafter\checkinserts\expandafter{\checkinserts + \checksaveins #1}% +} + +% initialize: +\let\checkinserts\empty +\newsaveins\footins +\newsaveins\margin + + +% @image. We use the macros from epsf.tex to support this. +% If epsf.tex is not installed and @image is used, we complain. +% +% Check for and read epsf.tex up front. If we read it only at @image +% time, we might be inside a group, and then its definitions would get +% undone and the next image would fail. +\openin 1 = epsf.tex +\ifeof 1 \else + % Do not bother showing banner with epsf.tex v2.7k (available in + % doc/epsf.tex and on ctan). + \def\epsfannounce{\toks0 = }% + \input epsf.tex +\fi +\closein 1 +% +% We will only complain once about lack of epsf.tex. +\newif\ifwarnednoepsf +\newhelp\noepsfhelp{epsf.tex must be installed for images to + work. It is also included in the Texinfo distribution, or you can get + it from ftp://tug.org/tex/epsf.tex.} +% +\def\image#1{% + \ifx\epsfbox\undefined + \ifwarnednoepsf \else + \errhelp = \noepsfhelp + \errmessage{epsf.tex not found, images will be ignored}% + \global\warnednoepsftrue + \fi + \else + \imagexxx #1,,,,,\finish + \fi +} +% +% Arguments to @image: +% #1 is (mandatory) image filename; we tack on .eps extension. +% #2 is (optional) width, #3 is (optional) height. +% #4 is (ignored optional) html alt text. +% #5 is (ignored optional) extension. +% #6 is just the usual extra ignored arg for parsing this stuff. +\newif\ifimagevmode +\def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup + \catcode`\^^M = 5 % in case we're inside an example + \normalturnoffactive % allow _ et al. in names + % If the image is by itself, center it. + \ifvmode + \imagevmodetrue + \nobreak\bigskip + % Usually we'll have text after the image which will insert + % \parskip glue, so insert it here too to equalize the space + % above and below. + \nobreak\vskip\parskip + \nobreak + \line\bgroup\hss + \fi + % + % Output the image. + \ifpdf + \dopdfimage{#1}{#2}{#3}% + \else + % \epsfbox itself resets \epsf?size at each figure. + \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi + \setbox0 = \hbox{\ignorespaces #3}\ifdim\wd0 > 0pt \epsfysize=#3\relax \fi + \epsfbox{#1.eps}% + \fi + % + \ifimagevmode \hss \egroup \bigbreak \fi % space after the image +\endgroup} + + +% @float FLOATTYPE,LABEL,LOC ... @end float for displayed figures, tables, +% etc. We don't actually implement floating yet, we always include the +% float "here". But it seemed the best name for the future. +% +\envparseargdef\float{\eatcommaspace\eatcommaspace\dofloat#1, , ,\finish} + +% There may be a space before second and/or third parameter; delete it. +\def\eatcommaspace#1, {#1,} + +% #1 is the optional FLOATTYPE, the text label for this float, typically +% "Figure", "Table", "Example", etc. Can't contain commas. If omitted, +% this float will not be numbered and cannot be referred to. +% +% #2 is the optional xref label. Also must be present for the float to +% be referable. +% +% #3 is the optional positioning argument; for now, it is ignored. It +% will somehow specify the positions allowed to float to (here, top, bottom). +% +% We keep a separate counter for each FLOATTYPE, which we reset at each +% chapter-level command. +\let\resetallfloatnos=\empty +% +\def\dofloat#1,#2,#3,#4\finish{% + \let\thiscaption=\empty + \let\thisshortcaption=\empty + % + % don't lose footnotes inside @float. + % + % BEWARE: when the floats start float, we have to issue warning whenever an + % insert appears inside a float which could possibly float. --kasal, 26may04 + % + \startsavinginserts + % + % We can't be used inside a paragraph. + \par + % + \vtop\bgroup + \def\floattype{#1}% + \def\floatlabel{#2}% + \def\floatloc{#3}% we do nothing with this yet. + % + \ifx\floattype\empty + \let\safefloattype=\empty + \else + {% + % the floattype might have accents or other special characters, + % but we need to use it in a control sequence name. + \indexnofonts + \turnoffactive + \xdef\safefloattype{\floattype}% + }% + \fi + % + % If label is given but no type, we handle that as the empty type. + \ifx\floatlabel\empty \else + % We want each FLOATTYPE to be numbered separately (Figure 1, + % Table 1, Figure 2, ...). (And if no label, no number.) + % + \expandafter\getfloatno\csname\safefloattype floatno\endcsname + \global\advance\floatno by 1 + % + {% + % This magic value for \thissection is output by \setref as the + % XREFLABEL-title value. \xrefX uses it to distinguish float + % labels (which have a completely different output format) from + % node and anchor labels. And \xrdef uses it to construct the + % lists of floats. + % + \edef\thissection{\floatmagic=\safefloattype}% + \setref{\floatlabel}{Yfloat}% + }% + \fi + % + % start with \parskip glue, I guess. + \vskip\parskip + % + % Don't suppress indentation if a float happens to start a section. + \restorefirstparagraphindent +} + +% we have these possibilities: +% @float Foo,lbl & @caption{Cap}: Foo 1.1: Cap +% @float Foo,lbl & no caption: Foo 1.1 +% @float Foo & @caption{Cap}: Foo: Cap +% @float Foo & no caption: Foo +% @float ,lbl & Caption{Cap}: 1.1: Cap +% @float ,lbl & no caption: 1.1 +% @float & @caption{Cap}: Cap +% @float & no caption: +% +\def\Efloat{% + \let\floatident = \empty + % + % In all cases, if we have a float type, it comes first. + \ifx\floattype\empty \else \def\floatident{\floattype}\fi + % + % If we have an xref label, the number comes next. + \ifx\floatlabel\empty \else + \ifx\floattype\empty \else % if also had float type, need tie first. + \appendtomacro\floatident{\tie}% + \fi + % the number. + \appendtomacro\floatident{\chaplevelprefix\the\floatno}% + \fi + % + % Start the printed caption with what we've constructed in + % \floatident, but keep it separate; we need \floatident again. + \let\captionline = \floatident + % + \ifx\thiscaption\empty \else + \ifx\floatident\empty \else + \appendtomacro\captionline{: }% had ident, so need a colon between + \fi + % + % caption text. + \appendtomacro\captionline{\scanexp\thiscaption}% + \fi + % + % If we have anything to print, print it, with space before. + % Eventually this needs to become an \insert. + \ifx\captionline\empty \else + \vskip.5\parskip + \captionline + % + % Space below caption. + \vskip\parskip + \fi + % + % If have an xref label, write the list of floats info. Do this + % after the caption, to avoid chance of it being a breakpoint. + \ifx\floatlabel\empty \else + % Write the text that goes in the lof to the aux file as + % \floatlabel-lof. Besides \floatident, we include the short + % caption if specified, else the full caption if specified, else nothing. + {% + \atdummies \turnoffactive \otherbackslash + % since we read the caption text in the macro world, where ^^M + % is turned into a normal character, we have to scan it back, so + % we don't write the literal three characters "^^M" into the aux file. + \scanexp{% + \xdef\noexpand\gtemp{% + \ifx\thisshortcaption\empty + \thiscaption + \else + \thisshortcaption + \fi + }% + }% + \immediate\write\auxfile{@xrdef{\floatlabel-lof}{\floatident + \ifx\gtemp\empty \else : \gtemp \fi}}% + }% + \fi + \egroup % end of \vtop + % + % place the captured inserts + % + % BEWARE: when the floats start float, we have to issue warning whenever an + % insert appears inside a float which could possibly float. --kasal, 26may04 + % + \checkinserts +} + +% Append the tokens #2 to the definition of macro #1, not expanding either. +% +\def\appendtomacro#1#2{% + \expandafter\def\expandafter#1\expandafter{#1#2}% +} + +% @caption, @shortcaption +% +\def\caption{\docaption\thiscaption} +\def\shortcaption{\docaption\thisshortcaption} +\def\docaption{\checkenv\float \bgroup\scanargctxt\defcaption} +\def\defcaption#1#2{\egroup \def#1{#2}} + +% The parameter is the control sequence identifying the counter we are +% going to use. Create it if it doesn't exist and assign it to \floatno. +\def\getfloatno#1{% + \ifx#1\relax + % Haven't seen this figure type before. + \csname newcount\endcsname #1% + % + % Remember to reset this floatno at the next chap. + \expandafter\gdef\expandafter\resetallfloatnos + \expandafter{\resetallfloatnos #1=0 }% + \fi + \let\floatno#1% +} + +% \setref calls this to get the XREFLABEL-snt value. We want an @xref +% to the FLOATLABEL to expand to "Figure 3.1". We call \setref when we +% first read the @float command. +% +\def\Yfloat{\floattype@tie \chaplevelprefix\the\floatno}% + +% Magic string used for the XREFLABEL-title value, so \xrefX can +% distinguish floats from other xref types. +\def\floatmagic{!!float!!} + +% #1 is the control sequence we are passed; we expand into a conditional +% which is true if #1 represents a float ref. That is, the magic +% \thissection value which we \setref above. +% +\def\iffloat#1{\expandafter\doiffloat#1==\finish} +% +% #1 is (maybe) the \floatmagic string. If so, #2 will be the +% (safe) float type for this float. We set \iffloattype to #2. +% +\def\doiffloat#1=#2=#3\finish{% + \def\temp{#1}% + \def\iffloattype{#2}% + \ifx\temp\floatmagic +} + +% @listoffloats FLOATTYPE - print a list of floats like a table of contents. +% +\parseargdef\listoffloats{% + \def\floattype{#1}% floattype + {% + % the floattype might have accents or other special characters, + % but we need to use it in a control sequence name. + \indexnofonts + \turnoffactive + \xdef\safefloattype{\floattype}% + }% + % + % \xrdef saves the floats as a \do-list in \floatlistSAFEFLOATTYPE. + \expandafter\ifx\csname floatlist\safefloattype\endcsname \relax + \ifhavexrefs + % if the user said @listoffloats foo but never @float foo. + \message{\linenumber No `\safefloattype' floats to list.}% + \fi + \else + \begingroup + \leftskip=\tocindent % indent these entries like a toc + \let\do=\listoffloatsdo + \csname floatlist\safefloattype\endcsname + \endgroup + \fi +} + +% This is called on each entry in a list of floats. We're passed the +% xref label, in the form LABEL-title, which is how we save it in the +% aux file. We strip off the -title and look up \XRLABEL-lof, which +% has the text we're supposed to typeset here. +% +% Figures without xref labels will not be included in the list (since +% they won't appear in the aux file). +% +\def\listoffloatsdo#1{\listoffloatsdoentry#1\finish} +\def\listoffloatsdoentry#1-title\finish{{% + % Can't fully expand XR#1-lof because it can contain anything. Just + % pass the control sequence. On the other hand, XR#1-pg is just the + % page number, and we want to fully expand that so we can get a link + % in pdf output. + \toksA = \expandafter{\csname XR#1-lof\endcsname}% + % + % use the same \entry macro we use to generate the TOC and index. + \edef\writeentry{\noexpand\entry{\the\toksA}{\csname XR#1-pg\endcsname}}% + \writeentry +}} + +\message{localization,} +% and i18n. + +% @documentlanguage is usually given very early, just after +% @setfilename. If done too late, it may not override everything +% properly. Single argument is the language abbreviation. +% It would be nice if we could set up a hyphenation file here. +% +\parseargdef\documentlanguage{% + \tex % read txi-??.tex file in plain TeX. + % Read the file if it exists. + \openin 1 txi-#1.tex + \ifeof 1 + \errhelp = \nolanghelp + \errmessage{Cannot read language file txi-#1.tex}% + \else + \input txi-#1.tex + \fi + \closein 1 + \endgroup +} +\newhelp\nolanghelp{The given language definition file cannot be found or +is empty. Maybe you need to install it? In the current directory +should work if nowhere else does.} + + +% @documentencoding should change something in TeX eventually, most +% likely, but for now just recognize it. +\let\documentencoding = \comment + + +% Page size parameters. +% +\newdimen\defaultparindent \defaultparindent = 15pt + +\chapheadingskip = 15pt plus 4pt minus 2pt +\secheadingskip = 12pt plus 3pt minus 2pt +\subsecheadingskip = 9pt plus 2pt minus 2pt + +% Prevent underfull vbox error messages. +\vbadness = 10000 + +% Don't be so finicky about underfull hboxes, either. +\hbadness = 2000 + +% Following George Bush, just get rid of widows and orphans. +\widowpenalty=10000 +\clubpenalty=10000 + +% Use TeX 3.0's \emergencystretch to help line breaking, but if we're +% using an old version of TeX, don't do anything. We want the amount of +% stretch added to depend on the line length, hence the dependence on +% \hsize. We call this whenever the paper size is set. +% +\def\setemergencystretch{% + \ifx\emergencystretch\thisisundefined + % Allow us to assign to \emergencystretch anyway. + \def\emergencystretch{\dimen0}% + \else + \emergencystretch = .15\hsize + \fi +} + +% Parameters in order: 1) textheight; 2) textwidth; 3) voffset; +% 4) hoffset; 5) binding offset; 6) topskip; 7) physical page height; 8) +% physical page width. +% +% We also call \setleading{\textleading}, so the caller should define +% \textleading. The caller should also set \parskip. +% +\def\internalpagesizes#1#2#3#4#5#6#7#8{% + \voffset = #3\relax + \topskip = #6\relax + \splittopskip = \topskip + % + \vsize = #1\relax + \advance\vsize by \topskip + \outervsize = \vsize + \advance\outervsize by 2\topandbottommargin + \pageheight = \vsize + % + \hsize = #2\relax + \outerhsize = \hsize + \advance\outerhsize by 0.5in + \pagewidth = \hsize + % + \normaloffset = #4\relax + \bindingoffset = #5\relax + % + \ifpdf + \pdfpageheight #7\relax + \pdfpagewidth #8\relax + \fi + % + \setleading{\textleading} + % + \parindent = \defaultparindent + \setemergencystretch +} + +% @letterpaper (the default). +\def\letterpaper{{\globaldefs = 1 + \parskip = 3pt plus 2pt minus 1pt + \textleading = 13.2pt + % + % If page is nothing but text, make it come out even. + \internalpagesizes{46\baselineskip}{6in}% + {\voffset}{.25in}% + {\bindingoffset}{36pt}% + {11in}{8.5in}% +}} + +% Use @smallbook to reset parameters for 7x9.5 (or so) format. +\def\smallbook{{\globaldefs = 1 + \parskip = 2pt plus 1pt + \textleading = 12pt + % + \internalpagesizes{7.5in}{5in}% + {\voffset}{.25in}% + {\bindingoffset}{16pt}% + {9.25in}{7in}% + % + \lispnarrowing = 0.3in + \tolerance = 700 + \hfuzz = 1pt + \contentsrightmargin = 0pt + \defbodyindent = .5cm +}} + +% Use @afourpaper to print on European A4 paper. +\def\afourpaper{{\globaldefs = 1 + \parskip = 3pt plus 2pt minus 1pt + \textleading = 13.2pt + % + % Double-side printing via postscript on Laserjet 4050 + % prints double-sided nicely when \bindingoffset=10mm and \hoffset=-6mm. + % To change the settings for a different printer or situation, adjust + % \normaloffset until the front-side and back-side texts align. Then + % do the same for \bindingoffset. You can set these for testing in + % your texinfo source file like this: + % @tex + % \global\normaloffset = -6mm + % \global\bindingoffset = 10mm + % @end tex + \internalpagesizes{51\baselineskip}{160mm} + {\voffset}{\hoffset}% + {\bindingoffset}{44pt}% + {297mm}{210mm}% + % + \tolerance = 700 + \hfuzz = 1pt + \contentsrightmargin = 0pt + \defbodyindent = 5mm +}} + +% Use @afivepaper to print on European A5 paper. +% From romildo@urano.iceb.ufop.br, 2 July 2000. +% He also recommends making @example and @lisp be small. +\def\afivepaper{{\globaldefs = 1 + \parskip = 2pt plus 1pt minus 0.1pt + \textleading = 12.5pt + % + \internalpagesizes{160mm}{120mm}% + {\voffset}{\hoffset}% + {\bindingoffset}{8pt}% + {210mm}{148mm}% + % + \lispnarrowing = 0.2in + \tolerance = 800 + \hfuzz = 1.2pt + \contentsrightmargin = 0pt + \defbodyindent = 2mm + \tableindent = 12mm +}} + +% A specific text layout, 24x15cm overall, intended for A4 paper. +\def\afourlatex{{\globaldefs = 1 + \afourpaper + \internalpagesizes{237mm}{150mm}% + {\voffset}{4.6mm}% + {\bindingoffset}{7mm}% + {297mm}{210mm}% + % + % Must explicitly reset to 0 because we call \afourpaper. + \globaldefs = 0 +}} + +% Use @afourwide to print on A4 paper in landscape format. +\def\afourwide{{\globaldefs = 1 + \afourpaper + \internalpagesizes{241mm}{165mm}% + {\voffset}{-2.95mm}% + {\bindingoffset}{7mm}% + {297mm}{210mm}% + \globaldefs = 0 +}} + +% @pagesizes TEXTHEIGHT[,TEXTWIDTH] +% Perhaps we should allow setting the margins, \topskip, \parskip, +% and/or leading, also. Or perhaps we should compute them somehow. +% +\parseargdef\pagesizes{\pagesizesyyy #1,,\finish} +\def\pagesizesyyy#1,#2,#3\finish{{% + \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi + \globaldefs = 1 + % + \parskip = 3pt plus 2pt minus 1pt + \setleading{\textleading}% + % + \dimen0 = #1 + \advance\dimen0 by \voffset + % + \dimen2 = \hsize + \advance\dimen2 by \normaloffset + % + \internalpagesizes{#1}{\hsize}% + {\voffset}{\normaloffset}% + {\bindingoffset}{44pt}% + {\dimen0}{\dimen2}% +}} + +% Set default to letter. +% +\letterpaper + + +\message{and turning on texinfo input format.} + +% Define macros to output various characters with catcode for normal text. +\catcode`\"=\other +\catcode`\~=\other +\catcode`\^=\other +\catcode`\_=\other +\catcode`\|=\other +\catcode`\<=\other +\catcode`\>=\other +\catcode`\+=\other +\catcode`\$=\other +\def\normaldoublequote{"} +\def\normaltilde{~} +\def\normalcaret{^} +\def\normalunderscore{_} +\def\normalverticalbar{|} +\def\normalless{<} +\def\normalgreater{>} +\def\normalplus{+} +\def\normaldollar{$}%$ font-lock fix + +% This macro is used to make a character print one way in \tt +% (where it can probably be output as-is), and another way in other fonts, +% where something hairier probably needs to be done. +% +% #1 is what to print if we are indeed using \tt; #2 is what to print +% otherwise. Since all the Computer Modern typewriter fonts have zero +% interword stretch (and shrink), and it is reasonable to expect all +% typewriter fonts to have this, we can check that font parameter. +% +\def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi} + +% Same as above, but check for italic font. Actually this also catches +% non-italic slanted fonts since it is impossible to distinguish them from +% italic fonts. But since this is only used by $ and it uses \sl anyway +% this is not a problem. +\def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi} + +% Turn off all special characters except @ +% (and those which the user can use as if they were ordinary). +% Most of these we simply print from the \tt font, but for some, we can +% use math or other variants that look better in normal text. + +\catcode`\"=\active +\def\activedoublequote{{\tt\char34}} +\let"=\activedoublequote +\catcode`\~=\active +\def~{{\tt\char126}} +\chardef\hat=`\^ +\catcode`\^=\active +\def^{{\tt \hat}} + +\catcode`\_=\active +\def_{\ifusingtt\normalunderscore\_} +% Subroutine for the previous macro. +\def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em } + +\catcode`\|=\active +\def|{{\tt\char124}} +\chardef \less=`\< +\catcode`\<=\active +\def<{{\tt \less}} +\chardef \gtr=`\> +\catcode`\>=\active +\def>{{\tt \gtr}} +\catcode`\+=\active +\def+{{\tt \char 43}} +\catcode`\$=\active +\def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix + +% If a .fmt file is being used, characters that might appear in a file +% name cannot be active until we have parsed the command line. +% So turn them off again, and have \everyjob (or @setfilename) turn them on. +% \otherifyactive is called near the end of this file. +\def\otherifyactive{\catcode`+=\other \catcode`\_=\other} + +\catcode`\@=0 + +% \backslashcurfont outputs one backslash character in current font, +% as in \char`\\. +\global\chardef\backslashcurfont=`\\ +\global\let\rawbackslashxx=\backslashcurfont % let existing .??s files work + +% \rawbackslash defines an active \ to do \backslashcurfont. +% \otherbackslash defines an active \ to be a literal `\' character with +% catcode other. +{\catcode`\\=\active + @gdef@rawbackslash{@let\=@backslashcurfont} + @gdef@otherbackslash{@let\=@realbackslash} +} + +% \realbackslash is an actual character `\' with catcode other. +{\catcode`\\=\other @gdef@realbackslash{\}} + +% \normalbackslash outputs one backslash in fixed width font. +\def\normalbackslash{{\tt\backslashcurfont}} + +\catcode`\\=\active + +% Used sometimes to turn off (effectively) the active characters +% even after parsing them. +@def@turnoffactive{% + @let"=@normaldoublequote + @let\=@realbackslash + @let~=@normaltilde + @let^=@normalcaret + @let_=@normalunderscore + @let|=@normalverticalbar + @let<=@normalless + @let>=@normalgreater + @let+=@normalplus + @let$=@normaldollar %$ font-lock fix + @unsepspaces +} + +% Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of +% the literal character `\'. (Thus, \ is not expandable when this is in +% effect.) +% +@def@normalturnoffactive{@turnoffactive @let\=@normalbackslash} + +% Make _ and + \other characters, temporarily. +% This is canceled by @fixbackslash. +@otherifyactive + +% If a .fmt file is being used, we don't want the `\input texinfo' to show up. +% That is what \eatinput is for; after that, the `\' should revert to printing +% a backslash. +% +@gdef@eatinput input texinfo{@fixbackslash} +@global@let\ = @eatinput + +% On the other hand, perhaps the file did not have a `\input texinfo'. Then +% the first `\{ in the file would cause an error. This macro tries to fix +% that, assuming it is called before the first `\' could plausibly occur. +% Also back turn on active characters that might appear in the input +% file name, in case not using a pre-dumped format. +% +@gdef@fixbackslash{% + @ifx\@eatinput @let\ = @normalbackslash @fi + @catcode`+=@active + @catcode`@_=@active +} + +% Say @foo, not \foo, in error messages. +@escapechar = `@@ + +% These look ok in all fonts, so just make them not special. +@catcode`@& = @other +@catcode`@# = @other +@catcode`@% = @other + + +@c Local variables: +@c eval: (add-hook 'write-file-hooks 'time-stamp) +@c page-delimiter: "^\\\\message" +@c time-stamp-start: "def\\\\texinfoversion{" +@c time-stamp-format: "%:y-%02m-%02d.%02H" +@c time-stamp-end: "}" +@c End: + +@c vim:sw=2: + +@ignore + arch-tag: e1b36e32-c96e-4135-a41a-0b2efa2ea115 +@end ignore diff --git a/usr/src/grub/grub-0.97/docs/version.texi b/usr/src/grub/grub-0.97/docs/version.texi new file mode 100644 index 0000000000..b97de24c8a --- /dev/null +++ b/usr/src/grub/grub-0.97/docs/version.texi @@ -0,0 +1,4 @@ +@set UPDATED 8 May 2005 +@set UPDATED-MONTH May 2005 +@set EDITION 0.97 +@set VERSION 0.97 diff --git a/usr/src/grub/grub-0.97/grub/Makefile.am b/usr/src/grub/grub-0.97/grub/Makefile.am new file mode 100644 index 0000000000..ed9646fbaa --- /dev/null +++ b/usr/src/grub/grub-0.97/grub/Makefile.am @@ -0,0 +1,19 @@ +sbin_PROGRAMS = grub + +if SERIAL_SPEED_SIMULATION +SERIAL_FLAGS = -DSUPPORT_SERIAL=1 -DSIMULATE_SLOWNESS_OF_SERIAL=1 +else +SERIAL_FLAGS = -DSUPPORT_SERIAL=1 +endif + +AM_CPPFLAGS = -DGRUB_UTIL=1 -DFSYS_EXT2FS=1 -DFSYS_FAT=1 -DFSYS_FFS=1 \ + -DFSYS_ISO9660=1 -DFSYS_JFS=1 -DFSYS_MINIX=1 -DFSYS_REISERFS=1 \ + -DFSYS_ZFS=1 -DFSYS_UFS2=1 -DFSYS_VSTAFS=1 -DFSYS_XFS=1 \ + -DUSE_MD5_PASSWORDS=1 -DSUPPORT_HERCULES=1 \ + $(SERIAL_FLAGS) -I$(top_srcdir)/stage2 \ + -I$(top_srcdir)/stage1 -I$(top_srcdir)/lib + +AM_CFLAGS = $(GRUB_CFLAGS) + +grub_SOURCES = main.c asmstub.c +grub_LDADD = ../stage2/libgrub.a ../lib/libcommon.a $(GRUB_LIBS) diff --git a/usr/src/grub/grub-0.97/grub/Makefile.in b/usr/src/grub/grub-0.97/grub/Makefile.in new file mode 100644 index 0000000000..367d6f231c --- /dev/null +++ b/usr/src/grub/grub-0.97/grub/Makefile.in @@ -0,0 +1,445 @@ +# Makefile.in generated by automake 1.9.4 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +SOURCES = $(grub_SOURCES) + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +sbin_PROGRAMS = grub$(EXEEXT) +subdir = grub +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +am__installdirs = "$(DESTDIR)$(sbindir)" +sbinPROGRAMS_INSTALL = $(INSTALL_PROGRAM) +PROGRAMS = $(sbin_PROGRAMS) +am_grub_OBJECTS = main.$(OBJEXT) asmstub.$(OBJEXT) +grub_OBJECTS = $(am_grub_OBJECTS) +am__DEPENDENCIES_1 = +grub_DEPENDENCIES = ../stage2/libgrub.a ../lib/libcommon.a \ + $(am__DEPENDENCIES_1) +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(grub_SOURCES) +DIST_SOURCES = $(grub_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BUILD_EXAMPLE_KERNEL_FALSE = @BUILD_EXAMPLE_KERNEL_FALSE@ +BUILD_EXAMPLE_KERNEL_TRUE = @BUILD_EXAMPLE_KERNEL_TRUE@ +CC = @CC@ +CCAS = @CCAS@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DISKLESS_SUPPORT_FALSE = @DISKLESS_SUPPORT_FALSE@ +DISKLESS_SUPPORT_TRUE = @DISKLESS_SUPPORT_TRUE@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FSYS_CFLAGS = @FSYS_CFLAGS@ +GRUB_CFLAGS = @GRUB_CFLAGS@ +GRUB_LIBS = @GRUB_LIBS@ +HERCULES_SUPPORT_FALSE = @HERCULES_SUPPORT_FALSE@ +HERCULES_SUPPORT_TRUE = @HERCULES_SUPPORT_TRUE@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +NETBOOT_DRIVERS = @NETBOOT_DRIVERS@ +NETBOOT_SUPPORT_FALSE = @NETBOOT_SUPPORT_FALSE@ +NETBOOT_SUPPORT_TRUE = @NETBOOT_SUPPORT_TRUE@ +NET_CFLAGS = @NET_CFLAGS@ +NET_EXTRAFLAGS = @NET_EXTRAFLAGS@ +OBJCOPY = @OBJCOPY@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PERL = @PERL@ +RANLIB = @RANLIB@ +SERIAL_SPEED_SIMULATION_FALSE = @SERIAL_SPEED_SIMULATION_FALSE@ +SERIAL_SPEED_SIMULATION_TRUE = @SERIAL_SPEED_SIMULATION_TRUE@ +SERIAL_SUPPORT_FALSE = @SERIAL_SUPPORT_FALSE@ +SERIAL_SUPPORT_TRUE = @SERIAL_SUPPORT_TRUE@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STAGE1_CFLAGS = @STAGE1_CFLAGS@ +STAGE2_CFLAGS = @STAGE2_CFLAGS@ +STRIP = @STRIP@ +VERSION = @VERSION@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_OBJCOPY = @ac_ct_OBJCOPY@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +@SERIAL_SPEED_SIMULATION_FALSE@SERIAL_FLAGS = -DSUPPORT_SERIAL=1 +@SERIAL_SPEED_SIMULATION_TRUE@SERIAL_FLAGS = -DSUPPORT_SERIAL=1 -DSIMULATE_SLOWNESS_OF_SERIAL=1 +AM_CPPFLAGS = -DGRUB_UTIL=1 -DFSYS_EXT2FS=1 -DFSYS_FAT=1 -DFSYS_FFS=1 \ + -DFSYS_ISO9660=1 -DFSYS_JFS=1 -DFSYS_MINIX=1 -DFSYS_REISERFS=1 \ + -DFSYS_ZFS=1 -DFSYS_UFS2=1 -DFSYS_VSTAFS=1 -DFSYS_XFS=1 \ + -DUSE_MD5_PASSWORDS=1 -DSUPPORT_HERCULES=1 \ + $(SERIAL_FLAGS) -I$(top_srcdir)/stage2 \ + -I$(top_srcdir)/stage1 -I$(top_srcdir)/lib + +AM_CFLAGS = $(GRUB_CFLAGS) +grub_SOURCES = main.c asmstub.c +grub_LDADD = ../stage2/libgrub.a ../lib/libcommon.a $(GRUB_LIBS) +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu grub/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu grub/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +install-sbinPROGRAMS: $(sbin_PROGRAMS) + @$(NORMAL_INSTALL) + test -z "$(sbindir)" || $(mkdir_p) "$(DESTDIR)$(sbindir)" + @list='$(sbin_PROGRAMS)'; for p in $$list; do \ + p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + if test -f $$p \ + ; then \ + f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " $(INSTALL_PROGRAM_ENV) $(sbinPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(sbindir)/$$f'"; \ + $(INSTALL_PROGRAM_ENV) $(sbinPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(sbindir)/$$f" || exit 1; \ + else :; fi; \ + done + +uninstall-sbinPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(sbin_PROGRAMS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " rm -f '$(DESTDIR)$(sbindir)/$$f'"; \ + rm -f "$(DESTDIR)$(sbindir)/$$f"; \ + done + +clean-sbinPROGRAMS: + -test -z "$(sbin_PROGRAMS)" || rm -f $(sbin_PROGRAMS) +grub$(EXEEXT): $(grub_OBJECTS) $(grub_DEPENDENCIES) + @rm -f grub$(EXEEXT) + $(LINK) $(grub_LDFLAGS) $(grub_OBJECTS) $(grub_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asmstub.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` +uninstall-info-am: + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) +installdirs: + for dir in "$(DESTDIR)$(sbindir)"; do \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-sbinPROGRAMS mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: install-sbinPROGRAMS + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am uninstall-sbinPROGRAMS + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-sbinPROGRAMS ctags distclean distclean-compile \ + distclean-generic distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-man install-sbinPROGRAMS install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ + uninstall-am uninstall-info-am uninstall-sbinPROGRAMS + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/usr/src/grub/grub-0.97/grub/Makefile.solaris b/usr/src/grub/grub-0.97/grub/Makefile.solaris new file mode 100644 index 0000000000..9d2b2e40ba --- /dev/null +++ b/usr/src/grub/grub-0.97/grub/Makefile.solaris @@ -0,0 +1,77 @@ +# +# Copyright 2007 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# ident "%Z%%M% %I% %E% SMI" +# +include ../../Makefile.grub +include ../Makefile.solaris.defs + + +GRUB = grub +GRUB_OBJS = asmstub.o main.o +$(GRUB) := LIBS = ../stage2/libgrub.a ../lib/libcommon.a -lcurses +$(GRUB) := LDFLAGS += $(LDLIBS.cmd) +$(GRUB) := CCLD = $(CC) + +# +# The grub shell interposes on the getopt() family. Should direct bindings be +# enabled, these interfaces should be explicitly defined as interposes. Use a +# mapfile to associate the necessary interposer definitions. +# +MAPFILES = $(MAPFILE.INT) + +INCLUDES = -I. -I.. -I../stage1 -I../stage2 -I../lib +CFLAGS += -O2 +LINKFLAGS += -O2 $(MAPFILES:%=-Wl,-M%) +CPPFLAGS += -DGRUB_UTIL=1 -DFSYS_EXT2FS=1 -DFSYS_FAT=1 -DFSYS_FFS=1 \ + -DFSYS_ISO9660=1 -DFSYS_JFS=1 -DFSYS_MINIX=1 \ + -DFSYS_REISERFS=1 -DFSYS_ZFS=1 -DFSYS_UFS2=1 -DFSYS_VSTAFS=1 \ + -DFSYS_XFS=1 -DUSE_MD5_PASSWORDS=1 -DSUPPORT_HERCULES=1 \ + -DSUPPORT_SERIAL=1 + +PROGRAMS = $(GRUB) + +INSTALL_DIR = $(ROOT_BOOT_GRUB)/bin +INSTALL_TARGETS = $(PROGRAMS:%=$(INSTALL_DIR)/%) + +$(INSTALL_DIR)/% := FILEMODE = 0555 + +# +# Source files to be installed in $(SRC_DIR). +# +SRC_DIR = $(ROOT_SRC)/grub +SRC_FILES = Makefile.am Makefile.in asmstub.c main.c + +INSTALL_TARGETS += $(SRC_FILES:%=$(SRC_DIR)/%) + + +all: $(PROGRAMS) + +$(GRUB): $(GRUB_OBJS) $(MAPFILES) + $(LINK) -o $@ $(GRUB_OBJS) $(LIBS) + $(POST_PROCESS) + +$(GRUB_OBJS): $$(@:.o=.c) + $(CC) $(CFLAGS) -c -o $@ $(@:.o=.c) + + +install: all $(INSTALL_TARGETS) + +$(INSTALL_DIR)/%: $(INSTALL_DIR) % + $(INS.file) + +$(SRC_DIR)/%: $(SRC_DIR) % + $(INS.file) + +$(INSTALL_DIR) $(SRC_DIR): + $(INS.dir) + + +clean: _FORCE + $(RM) *.o + +clobber: clean + $(RM) $(PROGRAMS) + +_FORCE: diff --git a/usr/src/grub/grub-0.97/grub/asmstub.c b/usr/src/grub/grub-0.97/grub/asmstub.c new file mode 100644 index 0000000000..c32823b0f1 --- /dev/null +++ b/usr/src/grub/grub-0.97/grub/asmstub.c @@ -0,0 +1,1312 @@ +/* asmstub.c - a version of shared_src/asm.S that works under Unix */ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2004 Free Software Foundation, 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 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. + */ + +/* Try to use glibc's transparant LFS support. */ +#define _LARGEFILE_SOURCE 1 +/* lseek becomes synonymous with lseek64. */ +#define _FILE_OFFSET_BITS 64 + +/* Simulator entry point. */ +int grub_stage2 (void); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef __linux__ +# include /* ioctl */ +# if !defined(__GLIBC__) || \ + ((__GLIBC__ < 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ < 1))) +/* Maybe libc doesn't have large file support. */ +# include /* _llseek */ +# endif /* (GLIBC < 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR < 1)) */ +# ifndef BLKFLSBUF +# define BLKFLSBUF _IO (0x12,97) /* flush buffer cache */ +# endif /* ! BLKFLSBUF */ +#endif /* __linux__ */ + +/* We want to prevent any circularararity in our stubs, as well as + libc name clashes. */ +#define WITHOUT_LIBC_STUBS 1 +#include +#include +#include +#include + +/* Simulated memory sizes. */ +#define EXTENDED_MEMSIZE (64 * 1024 * 1024) /* 64MB */ +#define CONVENTIONAL_MEMSIZE (640 * 1024) /* 640kB */ + +unsigned long install_partition = 0x20000; +unsigned long boot_drive = 0; +int saved_entryno = 0; +char version_string[] = VERSION; +char config_file[128] = "/boot/grub/menu.lst"; /* FIXME: arbitrary */ +unsigned long linux_text_len = 0; +char *linux_data_tmp_addr = 0; +char *linux_data_real_addr = 0; +unsigned short io_map[IO_MAP_SIZE]; +struct apm_info apm_bios_info; + +/* Emulation requirements. */ +char *grub_scratch_mem = 0; + +struct geometry *disks = 0; + +/* The map between BIOS drives and UNIX device file names. */ +char **device_map = 0; + +/* The jump buffer for exiting correctly. */ +static jmp_buf env_for_exit; + +/* The current color for console. */ +int console_current_color = A_NORMAL; + +/* The file descriptor for a serial device. */ +static int serial_fd = -1; + +/* The file name of a serial device. */ +static char *serial_device = 0; + +#ifdef SIMULATE_SLOWNESS_OF_SERIAL +/* The speed of a serial device. */ +static unsigned int serial_speed; +#endif /* SIMULATE_SLOWNESS_OF_SERIAL */ + +/* The main entry point into this mess. */ +int +grub_stage2 (void) +{ + /* These need to be static, because they survive our stack transitions. */ + static int status = 0; + static char *realstack; + char *scratch, *simstack; + int i; + + auto void doit (void); + + /* We need a nested function so that we get a clean stack frame, + regardless of how the code is optimized. */ + void doit () + { + /* Make sure our stack lives in the simulated memory area. */ + asm volatile ("movl %%esp, %0\n\tmovl %1, %%esp\n" + : "=&r" (realstack) : "r" (simstack)); + + /* Do a setjmp here for the stop command. */ + if (! setjmp (env_for_exit)) + { + /* Actually enter the generic stage2 code. */ + status = 0; + init_bios_info (); + } + else + { + /* If ERRNUM is non-zero, then set STATUS to non-zero. */ + if (errnum) + status = 1; + } + + /* Replace our stack before we use any local variables. */ + asm volatile ("movl %0, %%esp\n" : : "r" (realstack)); + } + + assert (grub_scratch_mem == 0); + scratch = malloc (0x100000 + EXTENDED_MEMSIZE + 15); + assert (scratch); + grub_scratch_mem = (char *) ((((int) scratch) >> 4) << 4); + + /* FIXME: simulate the memory holes using mprot, if available. */ + + assert (disks == 0); + disks = malloc (NUM_DISKS * sizeof (*disks)); + assert (disks); + /* Initialize DISKS. */ + for (i = 0; i < NUM_DISKS; i++) + disks[i].flags = -1; + + if (! init_device_map (&device_map, device_map_file, floppy_disks)) + return 1; + + /* Check some invariants. */ + assert ((SCRATCHSEG << 4) == SCRATCHADDR); + assert ((BUFFERSEG << 4) == BUFFERADDR); + assert (BUFFERADDR + BUFFERLEN == SCRATCHADDR); + assert (FSYS_BUF % 16 == 0); + assert (FSYS_BUF + FSYS_BUFLEN == BUFFERADDR); + +#ifdef HAVE_LIBCURSES + /* Get into char-at-a-time mode. */ + if (use_curses) + { + initscr (); + cbreak (); + noecho (); + nonl (); + scrollok (stdscr, TRUE); + keypad (stdscr, TRUE); + wtimeout (stdscr, 100); + signal (SIGWINCH, SIG_IGN); + } +#endif + + /* Make sure that actual writing is done. */ + sync (); + + /* Set our stack, and go for it. */ + simstack = (char *) PROTSTACKINIT; + doit (); + + /* I don't know if this is necessary really. */ + sync (); + +#ifdef HAVE_LIBCURSES + if (use_curses) + endwin (); +#endif + + /* Close off the file descriptors we used. */ + for (i = 0; i < NUM_DISKS; i ++) + if (disks[i].flags != -1) + { +#ifdef __linux__ + /* In Linux, invalidate the buffer cache. In other OSes, reboot + is one of the solutions... */ + ioctl (disks[i].flags, BLKFLSBUF, 0); +#elif defined(__sun) + /* FIXME */ +#else +# warning "In your operating system, the buffer cache will not be flushed." +#endif + close (disks[i].flags); + } + + if (serial_fd >= 0) + close (serial_fd); + + /* Release memory. */ + restore_device_map (device_map); + device_map = 0; + free (disks); + disks = 0; + free (scratch); + grub_scratch_mem = 0; + + if (serial_device) + free (serial_device); + serial_device = 0; + + /* Ahh... at last we're ready to return to caller. */ + return status; +} + +/* Assign DRIVE to a device name DEVICE. */ +void +assign_device_name (int drive, const char *device) +{ + /* If DRIVE is already assigned, free it. */ + if (device_map[drive]) + free (device_map[drive]); + + /* If the old one is already opened, close it. */ + if (disks[drive].flags != -1) + { + close (disks[drive].flags); + disks[drive].flags = -1; + } + + /* Assign DRIVE to DEVICE. */ + if (! device) + device_map[drive] = 0; + else + device_map[drive] = strdup (device); +} + +void +stop (void) +{ +#ifdef HAVE_LIBCURSES + if (use_curses) + endwin (); +#endif + + /* Jump to doit. */ + longjmp (env_for_exit, 1); +} + +void +grub_reboot (void) +{ + stop (); +} + +void +grub_halt (int no_apm) +{ + stop (); +} + +/* calls for direct boot-loader chaining */ +void +chain_stage1 (unsigned long segment, unsigned long offset, + unsigned long part_table_addr) +{ + stop (); +} + + +void +chain_stage2 (unsigned long segment, unsigned long offset, int second_sector) +{ + stop (); +} + + +/* do some funky stuff, then boot linux */ +void +linux_boot (void) +{ + stop (); +} + + +/* For bzImage kernels. */ +void +big_linux_boot (void) +{ + stop (); +} + + +/* booting a multiboot executable */ +void +multi_boot (int start, int mb_info) +{ + stop (); +} + +/* sets it to linear or wired A20 operation */ +void +gateA20 (int linear) +{ + /* Nothing to do in the simulator. */ +} + +/* Set up the int15 handler. */ +void +set_int15_handler (void) +{ + /* Nothing to do in the simulator. */ +} + +/* Restore the original int15 handler. */ +void +unset_int15_handler (void) +{ + /* Nothing to do in the simulator. */ +} + +/* The key map. */ +unsigned short bios_key_map[KEY_MAP_SIZE + 1]; +unsigned short ascii_key_map[KEY_MAP_SIZE + 1]; + +/* Copy MAP to the drive map and set up the int13 handler. */ +void +set_int13_handler (unsigned short *map) +{ + /* Nothing to do in the simulator. */ +} + +int +get_code_end (void) +{ + /* Just return a little area for simulation. */ + return BOOTSEC_LOCATION + (60 * 1024); +} + + +/* memory probe routines */ +int +get_memsize (int type) +{ + if (! type) + return CONVENTIONAL_MEMSIZE >> 10; + else + return EXTENDED_MEMSIZE >> 10; +} + + +/* get_eisamemsize() : return packed EISA memory map, lower 16 bits is + * memory between 1M and 16M in 1K parts, upper 16 bits is + * memory above 16M in 64K parts. If error, return -1. + */ +int +get_eisamemsize (void) +{ + return (EXTENDED_MEMSIZE >> 10); +} + + +#define MMAR_DESC_TYPE_AVAILABLE 1 /* available to OS */ +#define MMAR_DESC_TYPE_RESERVED 2 /* not available */ +#define MMAR_DESC_TYPE_ACPI_RECLAIM 3 /* usable by OS after reading ACPI */ +#define MMAR_DESC_TYPE_ACPI_NVS 4 /* required to save between NVS sessions */ + +#define MMAR_DESC_LENGTH 20 + +/* Fetch the next entry in the memory map and return the continuation + value. DESC is a pointer to the descriptor buffer, and CONT is the + previous continuation value (0 to get the first entry in the + map). */ +int +get_mmap_entry (struct mmar_desc *desc, int cont) +{ + /* Record the memory map statically. */ + static struct mmar_desc desc_table[] = + { + /* The conventional memory. */ + { + MMAR_DESC_LENGTH, + 0, + CONVENTIONAL_MEMSIZE, + MMAR_DESC_TYPE_AVAILABLE + }, + /* BIOS RAM and ROM (such as video memory). */ + { + MMAR_DESC_LENGTH, + CONVENTIONAL_MEMSIZE, + 0x100000 - CONVENTIONAL_MEMSIZE, + MMAR_DESC_TYPE_RESERVED + }, + /* The extended memory. */ + { + MMAR_DESC_LENGTH, + 0x100000, + EXTENDED_MEMSIZE, + MMAR_DESC_TYPE_AVAILABLE + } + }; + + int num = sizeof (desc_table) / sizeof (*desc_table); + + if (cont < 0 || cont >= num) + { + /* Should not happen. */ + desc->desc_len = 0; + } + else + { + /* Copy the entry. */ + *desc = desc_table[cont++]; + + /* If the next entry exists, return the index. */ + if (cont < num) + return cont; + } + + return 0; +} + +/* Track the int13 handler. */ +void +track_int13 (int drive) +{ + /* Nothing to do in the simulator. */ +} + +/* Get the ROM configuration table. */ +unsigned long +get_rom_config_table (void) +{ + return 0; +} + +/* Get APM BIOS information. */ +void +get_apm_info (void) +{ + /* Nothing to do in the simulator. */ +} + +/* Get VBE controller information. */ +int +get_vbe_controller_info (struct vbe_controller *controller) +{ + /* Always fails. */ + return 0; +} + +/* Get VBE mode information. */ +int +get_vbe_mode_info (int mode_number, struct vbe_mode *mode) +{ + /* Always fails. */ + return 0; +} + +/* Set VBE mode. */ +int +set_vbe_mode (int mode_number) +{ + /* Always fails. */ + return 0; +} + +/* low-level timing info */ +int +getrtsecs (void) +{ + /* FIXME: exact value is not important, so just return time_t for now. */ + return time (0); +} + +int +currticks (void) +{ + struct timeval tv; + long csecs; + int ticks_per_csec, ticks_per_usec; + + /* Note: 18.2 ticks/sec. */ + + /* Get current time. */ + gettimeofday (&tv, 0); + + /* Compute centiseconds. */ + csecs = tv.tv_sec / 10; + + /* Ticks per centisecond. */ + ticks_per_csec = csecs * 182; + + /* Ticks per microsecond. */ + ticks_per_usec = (((tv.tv_sec - csecs * 10) * 1000000 + tv.tv_usec) + * 182 / 10000000); + + /* Sum them. */ + return ticks_per_csec + ticks_per_usec; +} + +/* displays an ASCII character. IBM displays will translate some + characters to special graphical ones */ +void +console_putchar (int c) +{ + /* Curses doesn't have VGA fonts. */ + switch (c) + { + case DISP_UL: + c = ACS_ULCORNER; + break; + case DISP_UR: + c = ACS_URCORNER; + break; + case DISP_LL: + c = ACS_LLCORNER; + break; + case DISP_LR: + c = ACS_LRCORNER; + break; + case DISP_HORIZ: + c = ACS_HLINE; + break; + case DISP_VERT: + c = ACS_VLINE; + break; + case DISP_LEFT: + c = ACS_LARROW; + break; + case DISP_RIGHT: + c = ACS_RARROW; + break; + case DISP_UP: + c = ACS_UARROW; + break; + case DISP_DOWN: + c = ACS_DARROW; + break; + default: + break; + } + +#ifdef HAVE_LIBCURSES + if (use_curses) + { + /* In ncurses, a newline is treated badly, so we emulate it in our + own way. */ + if (c == '\n') + { + int x, y; + + getyx (stdscr, y, x); + if (y + 1 == LINES) + scroll (stdscr); + else + move (y + 1, x); + } + else if (isprint (c)) + { + int x, y; + + getyx (stdscr, y, x); + if (x + 1 == COLS) + { + console_putchar ('\r'); + console_putchar ('\n'); + } + addch (c | console_current_color); + } + else + { + addch (c); + } + +#ifdef REFRESH_IMMEDIATELY + refresh (); +#endif + } + else +#endif + { + /* CR is not used in Unix. */ + if (c != '\r') + putchar (c); + } +} + +/* The store for ungetch simulation. This is necessary, because + ncurses-1.9.9g is still used in the world and its ungetch is + completely broken. */ +#ifdef HAVE_LIBCURSES +static int save_char = ERR; +#endif + +static int +console_translate_key (int c) +{ + switch (c) + { + case KEY_LEFT: + return 2; + case KEY_RIGHT: + return 6; + case KEY_UP: + return 16; + case KEY_DOWN: + return 14; + case KEY_DC: + return 4; + case KEY_BACKSPACE: + return 8; + case KEY_HOME: + return 1; + case KEY_END: + return 5; + case KEY_PPAGE: + return 7; + case KEY_NPAGE: + return 3; + default: + break; + } + + return c; +} + +/* like 'getkey', but doesn't wait, returns -1 if nothing available */ +int +console_checkkey (void) +{ +#ifdef HAVE_LIBCURSES + if (use_curses) + { + int c; + + /* Check for SAVE_CHAR. This should not be true, because this + means checkkey is called twice continuously. */ + if (save_char != ERR) + return save_char; + + c = getch (); + /* If C is not ERR, then put it back in the input queue. */ + if (c != ERR) + save_char = c; + return console_translate_key (c); + } +#endif + + /* Just pretend they hit the space bar, then read the real key when + they call getkey. */ + return ' '; +} + +/* returns packed BIOS/ASCII code */ +int +console_getkey (void) +{ + int c; + +#ifdef HAVE_LIBCURSES + if (use_curses) + { + /* If checkkey has already got a character, then return it. */ + if (save_char != ERR) + { + c = save_char; + save_char = ERR; + return console_translate_key (c); + } + + wtimeout (stdscr, -1); + c = getch (); + wtimeout (stdscr, 100); + } + else +#endif + c = getchar (); + + /* Quit if we get EOF. */ + if (c == -1) + stop (); + + return console_translate_key (c); +} + +/* returns packed values, LSB+1 is x, LSB is y */ +int +console_getxy (void) +{ + int y, x; +#ifdef HAVE_LIBCURSES + if (use_curses) + getyx (stdscr, y, x); + else +#endif + y = x = 0; + return (x << 8) | (y & 0xff); +} + +void +console_gotoxy (int x, int y) +{ +#ifdef HAVE_LIBCURSES + if (use_curses) + move (y, x); +#endif +} + +/* low-level character I/O */ +void +console_cls (void) +{ +#ifdef HAVE_LIBCURSES + if (use_curses) + clear (); +#endif +} + +void +console_setcolorstate (color_state state) +{ + console_current_color = + (state == COLOR_STATE_HIGHLIGHT) ? A_REVERSE : A_NORMAL; +} + +void +console_setcolor (int normal_color, int highlight_color) +{ + /* Nothing to do. */ +} + +int +console_setcursor (int on) +{ + return 1; +} + +/* Low-level disk I/O. Our stubbed version just returns a file + descriptor, not the actual geometry. */ +int +get_diskinfo (int drive, struct geometry *geometry) +{ + /* FIXME: this function is truly horrid. We try opening the device, + then severely abuse the GEOMETRY->flags field to pass a file + descriptor to biosdisk. Thank God nobody's looking at this comment, + or my reputation would be ruined. --Gord */ + + /* See if we have a cached device. */ + if (disks[drive].flags == -1) + { + /* The unpartitioned device name: /dev/XdX */ + char *devname = device_map[drive]; + char buf[512]; + + if (! devname) + return -1; + + if (verbose) + grub_printf ("Attempt to open drive 0x%x (%s)\n", + drive, devname); + + /* Open read/write, or read-only if that failed. */ + if (! read_only) + disks[drive].flags = open (devname, O_RDWR); + + if (disks[drive].flags == -1) + { + if (read_only || errno == EACCES || errno == EROFS || errno == EPERM) + { + disks[drive].flags = open (devname, O_RDONLY); + if (disks[drive].flags == -1) + { + assign_device_name (drive, 0); + return -1; + } + } + else + { + assign_device_name (drive, 0); + return -1; + } + } + + /* Attempt to read the first sector. */ + if (read (disks[drive].flags, buf, 512) != 512) + { + close (disks[drive].flags); + disks[drive].flags = -1; + assign_device_name (drive, 0); + return -1; + } + + if (disks[drive].flags != -1) + get_drive_geometry (&disks[drive], device_map, drive); + } + + if (disks[drive].flags == -1) + return -1; + +#ifdef __linux__ + /* In Linux, invalidate the buffer cache, so that left overs + from other program in the cache are flushed and seen by us */ + ioctl (disks[drive].flags, BLKFLSBUF, 0); +#endif + + *geometry = disks[drive]; + return 0; +} + +/* Read LEN bytes from FD in BUF. Return less than or equal to zero if an + error occurs, otherwise return LEN. */ +static int +nread (int fd, char *buf, size_t len) +{ + int size = len; + + while (len) + { + int ret = read (fd, buf, len); + + if (ret <= 0) + { + if (errno == EINTR) + continue; + else + return ret; + } + + len -= ret; + buf += ret; + } + + return size; +} + +/* Write LEN bytes from BUF to FD. Return less than or equal to zero if an + error occurs, otherwise return LEN. */ +static int +nwrite (int fd, char *buf, size_t len) +{ + int size = len; + + while (len) + { + int ret = write (fd, buf, len); + + if (ret <= 0) + { + if (errno == EINTR) + continue; + else + return ret; + } + + len -= ret; + buf += ret; + } + + return size; +} + +/* Dump BUF in the format of hexadecimal numbers. */ +static void +hex_dump (void *buf, size_t size) +{ + /* FIXME: How to determine which length is readable? */ +#define MAX_COLUMN 70 + + /* use unsigned char for numerical computations */ + unsigned char *ptr = buf; + /* count the width of the line */ + int column = 0; + /* how many bytes written */ + int count = 0; + + while (size > 0) + { + /* high 4 bits */ + int hi = *ptr >> 4; + /* low 4 bits */ + int low = *ptr & 0xf; + + /* grub_printf does not handle prefix number, such as %2x, so + format the number by hand... */ + grub_printf ("%x%x", hi, low); + column += 2; + count++; + ptr++; + size--; + + /* Insert space or newline with the interval 4 bytes. */ + if (size != 0 && (count % 4) == 0) + { + if (column < MAX_COLUMN) + { + grub_printf (" "); + column++; + } + else + { + grub_printf ("\n"); + column = 0; + } + } + } + + /* Add a newline at the end for readability. */ + grub_printf ("\n"); +} + +int +biosdisk (int subfunc, int drive, struct geometry *geometry, + unsigned int sector, int nsec, int segment) +{ + char *buf; + int fd = geometry->flags; + + /* Get the file pointer from the geometry, and make sure it matches. */ + if (fd == -1 || fd != disks[drive].flags) + return BIOSDISK_ERROR_GEOMETRY; + + /* Seek to the specified location. */ +#if defined(__linux__) && (!defined(__GLIBC__) || \ + ((__GLIBC__ < 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ < 1)))) + /* Maybe libc doesn't have large file support. */ + { + loff_t offset, result; + static int _llseek (uint filedes, ulong hi, ulong lo, + loff_t *res, uint wh); + _syscall5 (int, _llseek, uint, filedes, ulong, hi, ulong, lo, + loff_t *, res, uint, wh); + + offset = (loff_t) sector * (loff_t) SECTOR_SIZE; + if (_llseek (fd, offset >> 32, offset & 0xffffffff, &result, SEEK_SET)) + return -1; + } +#else + { + off_t offset = (off_t) sector * (off_t) SECTOR_SIZE; + + if (lseek (fd, offset, SEEK_SET) != offset) + return -1; + } +#endif + + buf = (char *) (segment << 4); + + switch (subfunc) + { + case BIOSDISK_READ: +#ifdef __linux__ + if (sector == 0 && nsec > 1) + { + /* Work around a bug in linux's ez remapping. Linux remaps all + sectors that are read together with the MBR in one read. It + should only remap the MBR, so we split the read in two + parts. -jochen */ + if (nread (fd, buf, SECTOR_SIZE) != SECTOR_SIZE) + return -1; + buf += SECTOR_SIZE; + nsec--; + } +#endif + if (nread (fd, buf, nsec * SECTOR_SIZE) != nsec * SECTOR_SIZE) + return -1; + break; + + case BIOSDISK_WRITE: + if (verbose) + { + grub_printf ("Write %d sectors starting from %u sector" + " to drive 0x%x (%s)\n", + nsec, sector, drive, device_map[drive]); + hex_dump (buf, nsec * SECTOR_SIZE); + } + if (! read_only) + if (nwrite (fd, buf, nsec * SECTOR_SIZE) != nsec * SECTOR_SIZE) + return -1; + break; + + default: + grub_printf ("unknown subfunc %d\n", subfunc); + break; + } + + return 0; +} + + +void +stop_floppy (void) +{ + /* NOTUSED */ +} + +/* Fetch a key from a serial device. */ +int +serial_hw_fetch (void) +{ + fd_set fds; + struct timeval to; + char c; + + /* Wait only for the serial device. */ + FD_ZERO (&fds); + FD_SET (serial_fd, &fds); + + to.tv_sec = 0; + to.tv_usec = 0; + + if (select (serial_fd + 1, &fds, 0, 0, &to) > 0) + { + if (nread (serial_fd, &c, 1) != 1) + stop (); + + return c; + } + + return -1; +} + +/* Put a character to a serial device. */ +void +serial_hw_put (int c) +{ + char ch = (char) c; + + if (nwrite (serial_fd, &ch, 1) != 1) + stop (); +} + +void +serial_hw_delay (void) +{ +#ifdef SIMULATE_SLOWNESS_OF_SERIAL + struct timeval otv, tv; + + gettimeofday (&otv, 0); + + while (1) + { + long delta; + + gettimeofday (&tv, 0); + delta = tv.tv_usec - otv.tv_usec; + if (delta < 0) + delta += 1000000; + + if (delta >= 1000000 / (serial_speed >> 3)) + break; + } +#endif /* SIMULATE_SLOWNESS_OF_SERIAL */ +} + +static speed_t +get_termios_speed (int speed) +{ + switch (speed) + { + case 2400: return B2400; + case 4800: return B4800; + case 9600: return B9600; + case 19200: return B19200; + case 38400: return B38400; +#ifdef B57600 + case 57600: return B57600; +#endif +#ifdef B115200 + case 115200: return B115200; +#endif + } + + return B0; +} + +/* Get the port number of the unit UNIT. In the grub shell, this doesn't + make sense. */ +unsigned short +serial_hw_get_port (int unit) +{ + return 0; +} + +/* Initialize a serial device. In the grub shell, PORT is unused. */ +int +serial_hw_init (unsigned short port, unsigned int speed, + int word_len, int parity, int stop_bit_len) +{ + struct termios termios; + speed_t termios_speed; + int i; + + /* Check if the file name is specified. */ + if (! serial_device) + return 0; + + /* If a serial device is already opened, close it first. */ + if (serial_fd >= 0) + close (serial_fd); + + /* Open the device file. */ + serial_fd = open (serial_device, + O_RDWR | O_NOCTTY +#if defined(O_SYNC) + /* O_SYNC is used in Linux (and some others?). */ + | O_SYNC +#elif defined(O_FSYNC) + /* O_FSYNC is used in FreeBSD. */ + | O_FSYNC +#endif + ); + if (serial_fd < 0) + return 0; + + /* Get the termios parameters. */ + if (tcgetattr (serial_fd, &termios)) + goto fail; + + /* Raw mode. */ +#if defined(__sun) + termios.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON); + termios.c_oflag &= ~OPOST; + termios.c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN); + termios.c_cflag &= ~(CSIZE|PARENB); + termios.c_cflag |= CS8; +#else + cfmakeraw (&termios); +#endif + + /* Set the speed. */ + termios_speed = get_termios_speed (speed); + if (termios_speed == B0) + goto fail; + + cfsetispeed (&termios, termios_speed); + cfsetospeed (&termios, termios_speed); + + /* Set the word length. */ + termios.c_cflag &= ~CSIZE; + switch (word_len) + { + case UART_5BITS_WORD: + termios.c_cflag |= CS5; + break; + case UART_6BITS_WORD: + termios.c_cflag |= CS6; + break; + case UART_7BITS_WORD: + termios.c_cflag |= CS7; + break; + case UART_8BITS_WORD: + termios.c_cflag |= CS8; + break; + default: + goto fail; + } + + /* Set the parity. */ + switch (parity) + { + case UART_NO_PARITY: + termios.c_cflag &= ~PARENB; + break; + case UART_ODD_PARITY: + termios.c_cflag |= PARENB; + termios.c_cflag |= PARODD; + break; + case UART_EVEN_PARITY: + termios.c_cflag |= PARENB; + termios.c_cflag &= ~PARODD; + break; + default: + goto fail; + } + + /* Set the length of stop bit. */ + switch (stop_bit_len) + { + case UART_1_STOP_BIT: + termios.c_cflag &= ~CSTOPB; + break; + case UART_2_STOP_BITS: + termios.c_cflag |= CSTOPB; + break; + default: + goto fail; + } + + /* Set the parameters. */ + if (tcsetattr (serial_fd, TCSANOW, &termios)) + goto fail; + +#ifdef SIMULATE_SLOWNESS_OF_SERIAL + serial_speed = speed; +#endif /* SIMUATE_SLOWNESS_OF_SERIAL */ + + /* Get rid of the flag TERM_NEED_INIT from the serial terminal. */ + for (i = 0; term_table[i].name; i++) + { + if (strcmp (term_table[i].name, "serial") == 0) + { + term_table[i].flags &= ~(TERM_NEED_INIT); + break; + } + } + + return 1; + + fail: + close (serial_fd); + serial_fd = -1; + return 0; +} + +/* Set the file name of a serial device (or a pty device). This is a + function specific to the grub shell. */ +void +serial_set_device (const char *device) +{ + if (serial_device) + free (serial_device); + + serial_device = strdup (device); +} + +/* There is no difference between console and hercules in the grub shell. */ +void +hercules_putchar (int c) +{ + console_putchar (c); +} + +int +hercules_getxy (void) +{ + return console_getxy (); +} + +void +hercules_gotoxy (int x, int y) +{ + console_gotoxy (x, y); +} + +void +hercules_cls (void) +{ + console_cls (); +} + +void +hercules_setcolorstate (color_state state) +{ + console_setcolorstate (state); +} + +void +hercules_setcolor (int normal_color, int highlight_color) +{ + console_setcolor (normal_color, highlight_color); +} + +int +hercules_setcursor (int on) +{ + return 1; +} + +uint32_t amd64_cpuid_supported(void) +{ + /* Nothing to do in the simulator. */ + return (1); +} + +void amd64_cpuid_insn(uint32_t i, void * r) +{ + /* Nothing to do in the simulator. */ +} + +void amd64_rdmsr(uint32_t i, uint64_t * p) +{ + /* Nothing to do in the simulator. */ +} + +void amd64_wrmsr(uint32_t i, const uint64_t * p) +{ + /* Nothing to do in the simulator. */ +} + +int get_target_operating_mode(void) +{ + /* Nothing to do in the simulator. */ + return (1); +} diff --git a/usr/src/grub/grub-0.97/grub/main.c b/usr/src/grub/grub-0.97/grub/main.c new file mode 100644 index 0000000000..dfe847e98a --- /dev/null +++ b/usr/src/grub/grub-0.97/grub/main.c @@ -0,0 +1,265 @@ +/* main.c - experimental GRUB stage2 that runs under Unix */ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002 Free Software Foundation, 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 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. + */ + +/* Simulator entry point. */ +int grub_stage2 (void); + +#include +#include +#include +#include +#include +#include +#include + +#define WITHOUT_LIBC_STUBS 1 +#include +#include + +char *program_name = 0; +int use_config_file = 1; +int use_preset_menu = 0; +#ifdef HAVE_LIBCURSES +int use_curses = 1; +#else +int use_curses = 0; +#endif +int verbose = 0; +int read_only = 0; +int floppy_disks = 1; +char *device_map_file = 0; +static int default_boot_drive; +static int default_install_partition; +static char *default_config_file; + +#define OPT_HELP -2 +#define OPT_VERSION -3 +#define OPT_HOLD -4 +#define OPT_CONFIG_FILE -5 +#define OPT_INSTALL_PARTITION -6 +#define OPT_BOOT_DRIVE -7 +#define OPT_NO_CONFIG_FILE -8 +#define OPT_NO_CURSES -9 +#define OPT_BATCH -10 +#define OPT_VERBOSE -11 +#define OPT_READ_ONLY -12 +#define OPT_PROBE_SECOND_FLOPPY -13 +#define OPT_NO_FLOPPY -14 +#define OPT_DEVICE_MAP -15 +#define OPT_PRESET_MENU -16 +#define OPT_NO_PAGER -17 +#define OPTSTRING "" + +static struct option longopts[] = +{ + {"batch", no_argument, 0, OPT_BATCH}, + {"boot-drive", required_argument, 0, OPT_BOOT_DRIVE}, + {"config-file", required_argument, 0, OPT_CONFIG_FILE}, + {"device-map", required_argument, 0, OPT_DEVICE_MAP}, + {"help", no_argument, 0, OPT_HELP}, + {"hold", optional_argument, 0, OPT_HOLD}, + {"install-partition", required_argument, 0, OPT_INSTALL_PARTITION}, + {"no-config-file", no_argument, 0, OPT_NO_CONFIG_FILE}, + {"no-curses", no_argument, 0, OPT_NO_CURSES}, + {"no-floppy", no_argument, 0, OPT_NO_FLOPPY}, + {"no-pager", no_argument, 0, OPT_NO_PAGER}, + {"preset-menu", no_argument, 0, OPT_PRESET_MENU}, + {"probe-second-floppy", no_argument, 0, OPT_PROBE_SECOND_FLOPPY}, + {"read-only", no_argument, 0, OPT_READ_ONLY}, + {"verbose", no_argument, 0, OPT_VERBOSE}, + {"version", no_argument, 0, OPT_VERSION}, + {0}, +}; + + +static void +usage (int status) +{ + if (status) + fprintf (stderr, "Try ``grub --help'' for more information.\n"); + else + printf ("\ +Usage: grub [OPTION]...\n\ +\n\ +Enter the GRand Unified Bootloader command shell.\n\ +\n\ + --batch turn on batch mode for non-interactive use\n\ + --boot-drive=DRIVE specify stage2 boot_drive [default=0x%x]\n\ + --config-file=FILE specify stage2 config_file [default=%s]\n\ + --device-map=FILE use the device map file FILE\n\ + --help display this message and exit\n\ + --hold wait until a debugger will attach\n\ + --install-partition=PAR specify stage2 install_partition [default=0x%x]\n\ + --no-config-file do not use the config file\n\ + --no-curses do not use curses\n\ + --no-floppy do not probe any floppy drive\n\ + --no-pager do not use internal pager\n\ + --preset-menu use the preset menu\n\ + --probe-second-floppy probe the second floppy drive\n\ + --read-only do not write anything to devices\n\ + --verbose print verbose messages\n\ + --version print version information and exit\n\ +\n\ +Report bugs to .\n\ +", + default_boot_drive, default_config_file, + default_install_partition); + + exit (status); +} + + +int +main (int argc, char **argv) +{ + int c; + int hold = 0; + + /* First of all, call sync so that all in-core data is scheduled to be + actually written to disks. This is very important because GRUB does + not use ordinary stdio interface but raw devices. */ + sync (); + + program_name = argv[0]; + default_boot_drive = boot_drive; + default_install_partition = install_partition; + if (config_file) + default_config_file = config_file; + else + default_config_file = "NONE"; + + /* Parse command-line options. */ + do + { + c = getopt_long (argc, argv, OPTSTRING, longopts, 0); + switch (c) + { + case EOF: + /* Fall through the bottom of the loop. */ + break; + + case OPT_HELP: + usage (0); + break; + + case OPT_VERSION: + printf ("grub (GNU GRUB " VERSION ")\n"); + exit (0); + break; + + case OPT_HOLD: + if (! optarg) + hold = -1; + else + hold = atoi (optarg); + break; + + case OPT_CONFIG_FILE: + strncpy (config_file, optarg, 127); /* FIXME: arbitrary */ + config_file[127] = '\0'; + break; + + case OPT_INSTALL_PARTITION: + install_partition = strtoul (optarg, 0, 0); + if (install_partition == ULONG_MAX) + { + perror ("strtoul"); + exit (1); + } + break; + + case OPT_BOOT_DRIVE: + boot_drive = strtoul (optarg, 0, 0); + if (boot_drive == ULONG_MAX) + { + perror ("strtoul"); + exit (1); + } + break; + + case OPT_NO_CONFIG_FILE: + use_config_file = 0; + break; + + case OPT_NO_CURSES: + use_curses = 0; + break; + + case OPT_NO_PAGER: + use_pager = 0; + break; + + case OPT_BATCH: + /* This is the same as "--no-config-file --no-curses --no-pager". */ + use_config_file = 0; + use_curses = 0; + use_pager = 0; + break; + + case OPT_READ_ONLY: + read_only = 1; + break; + + case OPT_VERBOSE: + verbose = 1; + break; + + case OPT_NO_FLOPPY: + floppy_disks = 0; + break; + + case OPT_PROBE_SECOND_FLOPPY: + floppy_disks = 2; + break; + + case OPT_DEVICE_MAP: + device_map_file = strdup (optarg); + break; + + case OPT_PRESET_MENU: + use_preset_menu = 1; + break; + + default: + usage (1); + } + } + while (c != EOF); + + /* Wait until the HOLD variable is cleared by an attached debugger. */ + if (hold && verbose) + printf ("Run \"gdb %s %d\", and set HOLD to zero.\n", + program_name, (int) getpid ()); + while (hold) + { + if (hold > 0) + hold--; + + sleep (1); + } + + /* If we don't have curses (!HAVE_LIBCURSES or --no-curses or + --batch) put terminal to dumb for better handling of line i/o */ + if (! use_curses) + current_term->flags = TERM_NO_EDIT | TERM_DUMB; + + /* Transfer control to the stage2 simulator. */ + exit (grub_stage2 ()); +} diff --git a/usr/src/grub/grub-0.97/grub/mapfile-intf b/usr/src/grub/grub-0.97/grub/mapfile-intf new file mode 100644 index 0000000000..d265fe30d7 --- /dev/null +++ b/usr/src/grub/grub-0.97/grub/mapfile-intf @@ -0,0 +1,43 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# + +# +# Copyright 2007 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# ident "%Z%%M% %I% %E% SMI" +# + +# The grub shell interposes on the getopt() family - this reimplementation is +# required for the real grub loader which can't depend on libc. The grub shell +# is built from the same source as the grub loader. +{ + global: + getopt = INTERPOSE; + getopt_long = INTERPOSE; + getopt_long_only = INTERPOSE; + optarg = INTERPOSE; + opterr = INTERPOSE; + optind = INTERPOSE; + optopt = INTERPOSE; + local: + *; +}; diff --git a/usr/src/grub/grub-0.97/install-sh b/usr/src/grub/grub-0.97/install-sh new file mode 100755 index 0000000000..6ebe46de6c --- /dev/null +++ b/usr/src/grub/grub-0.97/install-sh @@ -0,0 +1,323 @@ +#!/bin/sh +# install - install a program, script, or datafile + +scriptversion=2004-12-17.09 + +# This originates from X11R5 (mit/util/scripts/install.sh), which was +# later released in X11R6 (xc/config/util/install.sh) with the +# following copyright and license. +# +# Copyright (C) 1994 X Consortium +# +# 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 +# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- +# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name of the X Consortium shall not +# be used in advertising or otherwise to promote the sale, use or other deal- +# ings in this Software without prior written authorization from the X Consor- +# tium. +# +# +# FSF changes to this file are in the public domain. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. It can only install one file at a time, a restriction +# shared with many OS's install programs. + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +chmodcmd="$chmodprog 0755" +chowncmd= +chgrpcmd= +stripcmd= +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src= +dst= +dir_arg= +dstarg= +no_target_directory= + +usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE + or: $0 [OPTION]... SRCFILES... DIRECTORY + or: $0 [OPTION]... -t DIRECTORY SRCFILES... + or: $0 [OPTION]... -d DIRECTORIES... + +In the 1st form, copy SRCFILE to DSTFILE. +In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. +In the 4th, create DIRECTORIES. + +Options: +-c (ignored) +-d create directories instead of installing files. +-g GROUP $chgrpprog installed files to GROUP. +-m MODE $chmodprog installed files to MODE. +-o USER $chownprog installed files to USER. +-s $stripprog installed files. +-t DIRECTORY install into DIRECTORY. +-T report an error if DSTFILE is a directory. +--help display this help and exit. +--version display version info and exit. + +Environment variables override the default commands: + CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG +" + +while test -n "$1"; do + case $1 in + -c) shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + --help) echo "$usage"; exit 0;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -s) stripcmd=$stripprog + shift + continue;; + + -t) dstarg=$2 + shift + shift + continue;; + + -T) no_target_directory=true + shift + continue;; + + --version) echo "$0 $scriptversion"; exit 0;; + + *) # When -d is used, all remaining arguments are directories to create. + # When -t is used, the destination is already specified. + test -n "$dir_arg$dstarg" && break + # Otherwise, the last argument is the destination. Remove it from $@. + for arg + do + if test -n "$dstarg"; then + # $@ is not empty: it contains at least $arg. + set fnord "$@" "$dstarg" + shift # fnord + fi + shift # arg + dstarg=$arg + done + break;; + esac +done + +if test -z "$1"; then + if test -z "$dir_arg"; then + echo "$0: no input file specified." >&2 + exit 1 + fi + # It's OK to call `install-sh -d' without argument. + # This can happen when creating conditional directories. + exit 0 +fi + +for src +do + # Protect names starting with `-'. + case $src in + -*) src=./$src ;; + esac + + if test -n "$dir_arg"; then + dst=$src + src= + + if test -d "$dst"; then + mkdircmd=: + chmodcmd= + else + mkdircmd=$mkdirprog + fi + else + # Waiting for this to be detected by the "$cpprog $src $dsttmp" command + # might cause directories to be created, which would be especially bad + # if $src (and thus $dsttmp) contains '*'. + if test ! -f "$src" && test ! -d "$src"; then + echo "$0: $src does not exist." >&2 + exit 1 + fi + + if test -z "$dstarg"; then + echo "$0: no destination specified." >&2 + exit 1 + fi + + dst=$dstarg + # Protect names starting with `-'. + case $dst in + -*) dst=./$dst ;; + esac + + # If destination is a directory, append the input filename; won't work + # if double slashes aren't ignored. + if test -d "$dst"; then + if test -n "$no_target_directory"; then + echo "$0: $dstarg: Is a directory" >&2 + exit 1 + fi + dst=$dst/`basename "$src"` + fi + fi + + # This sed command emulates the dirname command. + dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'` + + # Make sure that the destination directory exists. + + # Skip lots of stat calls in the usual case. + if test ! -d "$dstdir"; then + defaultIFS=' + ' + IFS="${IFS-$defaultIFS}" + + oIFS=$IFS + # Some sh's can't handle IFS=/ for some reason. + IFS='%' + set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` + shift + IFS=$oIFS + + pathcomp= + + while test $# -ne 0 ; do + pathcomp=$pathcomp$1 + shift + if test ! -d "$pathcomp"; then + $mkdirprog "$pathcomp" + # mkdir can fail with a `File exist' error in case several + # install-sh are creating the directory concurrently. This + # is OK. + test -d "$pathcomp" || exit + fi + pathcomp=$pathcomp/ + done + fi + + if test -n "$dir_arg"; then + $doit $mkdircmd "$dst" \ + && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \ + && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \ + && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \ + && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; } + + else + dstfile=`basename "$dst"` + + # Make a couple of temp file names in the proper directory. + dsttmp=$dstdir/_inst.$$_ + rmtmp=$dstdir/_rm.$$_ + + # Trap to clean up those temp files at exit. + trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 + trap '(exit $?); exit' 1 2 13 15 + + # Copy the file name to the temp name. + $doit $cpprog "$src" "$dsttmp" && + + # and set any options; do chmod last to preserve setuid bits. + # + # If any of these fail, we abort the whole thing. If we want to + # ignore errors from any of these, just make sure not to ignore + # errors from the above "$doit $cpprog $src $dsttmp" command. + # + { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ + && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ + && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ + && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } && + + # Now rename the file to the real destination. + { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \ + || { + # The rename failed, perhaps because mv can't rename something else + # to itself, or perhaps because mv is so ancient that it does not + # support -f. + + # Now remove or move aside any old file at destination location. + # We try this two ways since rm can't unlink itself on some + # systems and the destination file might be busy for other + # reasons. In this case, the final cleanup might fail but the new + # file should still install successfully. + { + if test -f "$dstdir/$dstfile"; then + $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \ + || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ + || { + echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 + (exit 1); exit 1 + } + else + : + fi + } && + + # Now rename the file to the real destination. + $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" + } + } + fi || { (exit 1); exit 1; } +done + +# The final little trick to "correctly" pass the exit status to the exit trap. +{ + (exit 0); exit 0 +} + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/usr/src/grub/grub-0.97/lib/Makefile.am b/usr/src/grub/grub-0.97/lib/Makefile.am new file mode 100644 index 0000000000..645a03f468 --- /dev/null +++ b/usr/src/grub/grub-0.97/lib/Makefile.am @@ -0,0 +1,6 @@ +noinst_LIBRARIES = libcommon.a + +AM_CFLAGS = $(GRUB_CFLAGS) -I$(top_srcdir)/stage2 \ + -I$(top_srcdir)/stage1 + +libcommon_a_SOURCES = getopt.c getopt1.c getopt.h device.c device.h diff --git a/usr/src/grub/grub-0.97/lib/Makefile.in b/usr/src/grub/grub-0.97/lib/Makefile.in new file mode 100644 index 0000000000..3dae206c2f --- /dev/null +++ b/usr/src/grub/grub-0.97/lib/Makefile.in @@ -0,0 +1,416 @@ +# Makefile.in generated by automake 1.9.4 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +SOURCES = $(libcommon_a_SOURCES) + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = lib +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +LIBRARIES = $(noinst_LIBRARIES) +AR = ar +ARFLAGS = cru +libcommon_a_AR = $(AR) $(ARFLAGS) +libcommon_a_LIBADD = +am_libcommon_a_OBJECTS = getopt.$(OBJEXT) getopt1.$(OBJEXT) \ + device.$(OBJEXT) +libcommon_a_OBJECTS = $(am_libcommon_a_OBJECTS) +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(libcommon_a_SOURCES) +DIST_SOURCES = $(libcommon_a_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BUILD_EXAMPLE_KERNEL_FALSE = @BUILD_EXAMPLE_KERNEL_FALSE@ +BUILD_EXAMPLE_KERNEL_TRUE = @BUILD_EXAMPLE_KERNEL_TRUE@ +CC = @CC@ +CCAS = @CCAS@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DISKLESS_SUPPORT_FALSE = @DISKLESS_SUPPORT_FALSE@ +DISKLESS_SUPPORT_TRUE = @DISKLESS_SUPPORT_TRUE@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FSYS_CFLAGS = @FSYS_CFLAGS@ +GRUB_CFLAGS = @GRUB_CFLAGS@ +GRUB_LIBS = @GRUB_LIBS@ +HERCULES_SUPPORT_FALSE = @HERCULES_SUPPORT_FALSE@ +HERCULES_SUPPORT_TRUE = @HERCULES_SUPPORT_TRUE@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +NETBOOT_DRIVERS = @NETBOOT_DRIVERS@ +NETBOOT_SUPPORT_FALSE = @NETBOOT_SUPPORT_FALSE@ +NETBOOT_SUPPORT_TRUE = @NETBOOT_SUPPORT_TRUE@ +NET_CFLAGS = @NET_CFLAGS@ +NET_EXTRAFLAGS = @NET_EXTRAFLAGS@ +OBJCOPY = @OBJCOPY@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PERL = @PERL@ +RANLIB = @RANLIB@ +SERIAL_SPEED_SIMULATION_FALSE = @SERIAL_SPEED_SIMULATION_FALSE@ +SERIAL_SPEED_SIMULATION_TRUE = @SERIAL_SPEED_SIMULATION_TRUE@ +SERIAL_SUPPORT_FALSE = @SERIAL_SUPPORT_FALSE@ +SERIAL_SUPPORT_TRUE = @SERIAL_SUPPORT_TRUE@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STAGE1_CFLAGS = @STAGE1_CFLAGS@ +STAGE2_CFLAGS = @STAGE2_CFLAGS@ +STRIP = @STRIP@ +VERSION = @VERSION@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_OBJCOPY = @ac_ct_OBJCOPY@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +noinst_LIBRARIES = libcommon.a +AM_CFLAGS = $(GRUB_CFLAGS) -I$(top_srcdir)/stage2 \ + -I$(top_srcdir)/stage1 + +libcommon_a_SOURCES = getopt.c getopt1.c getopt.h device.c device.h +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu lib/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu lib/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +clean-noinstLIBRARIES: + -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) +libcommon.a: $(libcommon_a_OBJECTS) $(libcommon_a_DEPENDENCIES) + -rm -f libcommon.a + $(libcommon_a_AR) libcommon.a $(libcommon_a_OBJECTS) $(libcommon_a_LIBADD) + $(RANLIB) libcommon.a + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/device.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt1.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` +uninstall-info-am: + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LIBRARIES) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-noinstLIBRARIES ctags distclean distclean-compile \ + distclean-generic distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-man install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ + uninstall-am uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/usr/src/grub/grub-0.97/lib/Makefile.solaris b/usr/src/grub/grub-0.97/lib/Makefile.solaris new file mode 100644 index 0000000000..189133d80d --- /dev/null +++ b/usr/src/grub/grub-0.97/lib/Makefile.solaris @@ -0,0 +1,56 @@ +# +# Copyright 2005 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# ident "%Z%%M% %I% %E% SMI" +# +include ../../Makefile.grub +include ../Makefile.solaris.defs + +INCLUDES = -I. -I.. -I../stage1 -I../stage2 +CFLAGS += -O2 + + +LIBCOMMON = libcommon.a +LIBCOMMON_OBJS = device.o \ + getopt.o \ + getopt1.o + +LIBRARIES = $(LIBCOMMON) + +# +# Source files to be installed in $(SRC_DIR). +# +SRC_DIR = $(ROOT_SRC)/lib +SRC_FILES = Makefile.am Makefile.in device.c device.h \ + getopt.c getopt.h getopt1.c + +INSTALL_TARGETS = $(SRC_FILES:%=$(SRC_DIR)/%) + + +all: $(LIBRARIES) + +$(LIBCOMMON): $(LIBCOMMON_OBJS) + $(RM) $@ + $(AR) cru $@ $(LIBCOMMON_OBJS) + $(RANLIB) $@ + +$(LIBCOMMON_OBJS): $$(@:.o=.c) + $(CC) $(CFLAGS) -c -o $@ $(@:.o=.c) + + +install: all $(INSTALL_TARGETS) + +$(SRC_DIR)/%: $(SRC_DIR) % + $(INS.file) + +$(SRC_DIR): + $(INS.dir) + + +clean: _FORCE + $(RM) *.o $(LIBRARIES) + +clobber: clean + +_FORCE: diff --git a/usr/src/grub/grub-0.97/lib/device.c b/usr/src/grub/grub-0.97/lib/device.c new file mode 100644 index 0000000000..03d3e08372 --- /dev/null +++ b/usr/src/grub/grub-0.97/lib/device.c @@ -0,0 +1,941 @@ +/* device.c - Some helper functions for OS devices and BIOS drives */ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2003,2004,2005 Free Software Foundation, 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 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. + */ + +/* Try to use glibc's transparant LFS support. */ +#define _LARGEFILE_SOURCE 1 +/* lseek becomes synonymous with lseek64. */ +#define _FILE_OFFSET_BITS 64 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef __linux__ +# if !defined(__GLIBC__) || \ + ((__GLIBC__ < 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ < 1))) +/* Maybe libc doesn't have large file support. */ +# include /* _llseek */ +# endif /* (GLIBC < 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR < 1)) */ +# include /* ioctl */ +# ifndef HDIO_GETGEO +# define HDIO_GETGEO 0x0301 /* get device geometry */ +/* If HDIO_GETGEO is not defined, it is unlikely that hd_geometry is + defined. */ +struct hd_geometry +{ + unsigned char heads; + unsigned char sectors; + unsigned short cylinders; + unsigned long start; +}; +# endif /* ! HDIO_GETGEO */ +# ifndef FLOPPY_MAJOR +# define FLOPPY_MAJOR 2 /* the major number for floppy */ +# endif /* ! FLOPPY_MAJOR */ +# ifndef MAJOR +# define MAJOR(dev) \ + ({ \ + unsigned long long __dev = (dev); \ + (unsigned) ((__dev >> 8) & 0xfff) \ + | ((unsigned int) (__dev >> 32) & ~0xfff); \ + }) +# endif /* ! MAJOR */ +# ifndef CDROM_GET_CAPABILITY +# define CDROM_GET_CAPABILITY 0x5331 /* get capabilities */ +# endif /* ! CDROM_GET_CAPABILITY */ +# ifndef BLKGETSIZE +# define BLKGETSIZE _IO(0x12,96) /* return device size */ +# endif /* ! BLKGETSIZE */ +#endif /* __linux__ */ + +/* Use __FreeBSD_kernel__ instead of __FreeBSD__ for compatibility with + kFreeBSD-based non-FreeBSD systems (e.g. GNU/kFreeBSD) */ +#if defined(__FreeBSD__) && ! defined(__FreeBSD_kernel__) +# define __FreeBSD_kernel__ +#endif +#ifdef __FreeBSD_kernel__ + /* Obtain version of kFreeBSD headers */ +# include +# ifndef __FreeBSD_kernel_version +# define __FreeBSD_kernel_version __FreeBSD_version +# endif + + /* Runtime detection of kernel */ +# include +int +get_kfreebsd_version () +{ + struct utsname uts; + int major; int minor, v[2]; + + uname (&uts); + sscanf (uts.release, "%d.%d", &major, &minor); + + if (major >= 9) + major = 9; + if (major >= 5) + { + v[0] = minor/10; v[1] = minor%10; + } + else + { + v[0] = minor%10; v[1] = minor/10; + } + return major*100000+v[0]*10000+v[1]*1000; +} +#endif /* __FreeBSD_kernel__ */ + +#if defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) +# include /* ioctl */ +# include +# include /* CDIOCCLRDEBUG */ +# if defined(__FreeBSD_kernel__) +# include +# if __FreeBSD_kernel_version >= 500040 +# include +# endif +# endif /* __FreeBSD_kernel__ */ +#endif /* __FreeBSD_kernel__ || __NetBSD__ || __OpenBSD__ */ + +#if defined(__sun) +# include +#endif /* __sun */ + +#ifdef HAVE_OPENDISK +# include +#endif /* HAVE_OPENDISK */ + +#define WITHOUT_LIBC_STUBS 1 +#include +#include + +/* Get the geometry of a drive DRIVE. */ +void +get_drive_geometry (struct geometry *geom, char **map, int drive) +{ + int fd; + + if (geom->flags == -1) + { + fd = open (map[drive], O_RDONLY); + assert (fd >= 0); + } + else + fd = geom->flags; + + /* XXX This is the default size. */ + geom->sector_size = SECTOR_SIZE; + +#if defined(__linux__) + /* Linux */ + { + struct hd_geometry hdg; + unsigned long nr; + + if (ioctl (fd, HDIO_GETGEO, &hdg)) + goto fail; + + if (ioctl (fd, BLKGETSIZE, &nr)) + goto fail; + + /* Got the geometry, so save it. */ + geom->cylinders = hdg.cylinders; + geom->heads = hdg.heads; + geom->sectors = hdg.sectors; + geom->total_sectors = nr; + + goto success; + } + +#elif defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) +# if defined(__FreeBSD_kernel__) && __FreeBSD_kernel_version >= 500040 + /* kFreeBSD version 5 or later */ + if (get_kfreebsd_version () >= 500040) + { + unsigned int sector_size; + off_t media_size; + unsigned int tmp; + + if(ioctl (fd, DIOCGSECTORSIZE, §or_size) != 0) + sector_size = 512; + + if (ioctl (fd, DIOCGMEDIASIZE, &media_size) != 0) + goto fail; + + geom->total_sectors = media_size / sector_size; + + if (ioctl (fd, DIOCGFWSECTORS, &tmp) == 0) + geom->sectors = tmp; + else + geom->sectors = 63; + if (ioctl (fd, DIOCGFWHEADS, &tmp) == 0) + geom->heads = tmp; + else if (geom->total_sectors <= 63 * 1 * 1024) + geom->heads = 1; + else if (geom->total_sectors <= 63 * 16 * 1024) + geom->heads = 16; + else + geom->heads = 255; + + geom->cylinders = (geom->total_sectors + / geom->heads + / geom->sectors); + + goto success; + } + else +#endif /* defined(__FreeBSD_kernel__) && __FreeBSD_kernel_version >= 500040 */ + + /* kFreeBSD < 5, NetBSD or OpenBSD */ + { + struct disklabel hdg; + if (ioctl (fd, DIOCGDINFO, &hdg)) + goto fail; + + geom->cylinders = hdg.d_ncylinders; + geom->heads = hdg.d_ntracks; + geom->sectors = hdg.d_nsectors; + geom->total_sectors = hdg.d_secperunit; + + goto success; + } + +#elif defined(__sun) + /* Solaris */ + { + struct dk_geom dkg; + + if (ioctl(fd, DKIOCG_PHYGEOM, &dkg)) + goto fail; + geom->cylinders = dkg.dkg_ncyl; + geom->heads = dkg.dkg_nhead; + geom->sectors = dkg.dkg_nsect; + geom->total_sectors = dkg.dkg_ncyl * dkg.dkg_nhead * dkg.dkg_nsect; + + goto success; + } + +#else + /* Notably, defined(__GNU__) */ +# warning "Automatic detection of geometries will be performed only \ +partially. This is not fatal." +#endif + + fail: + { + struct stat st; + + /* FIXME: It would be nice to somehow compute fake C/H/S settings, + given a proper st_blocks size. */ + if (drive & 0x80) + { + geom->cylinders = DEFAULT_HD_CYLINDERS; + geom->heads = DEFAULT_HD_HEADS; + geom->sectors = DEFAULT_HD_SECTORS; + } + else + { + geom->cylinders = DEFAULT_FD_CYLINDERS; + geom->heads = DEFAULT_FD_HEADS; + geom->sectors = DEFAULT_FD_SECTORS; + } + + /* Set the total sectors properly, if we can. */ + if (! fstat (fd, &st) && st.st_blocks) + geom->total_sectors = st.st_blocks >> SECTOR_BITS; + else + geom->total_sectors = geom->cylinders * geom->heads * geom->sectors; + } + + success: + if (geom->flags == -1) + close (fd); +} + +#ifdef __linux__ +/* Check if we have devfs support. */ +static int +have_devfs (void) +{ + static int dev_devfsd_exists = -1; + + if (dev_devfsd_exists < 0) + { + struct stat st; + + dev_devfsd_exists = stat ("/dev/.devfsd", &st) == 0; + } + + return dev_devfsd_exists; +} +#endif /* __linux__ */ + +/* These three functions are quite different among OSes. */ +static void +get_floppy_disk_name (char *name, int unit) +{ +#if defined(__linux__) + /* GNU/Linux */ + if (have_devfs ()) + sprintf (name, "/dev/floppy/%d", unit); + else + sprintf (name, "/dev/fd%d", unit); +#elif defined(__GNU__) + /* GNU/Hurd */ + sprintf (name, "/dev/fd%d", unit); +#elif defined(__FreeBSD_kernel__) + /* kFreeBSD */ + if (get_kfreebsd_version () >= 400000) + sprintf (name, "/dev/fd%d", unit); + else + sprintf (name, "/dev/rfd%d", unit); +#elif defined(__NetBSD__) + /* NetBSD */ + /* opendisk() doesn't work for floppies. */ + sprintf (name, "/dev/rfd%da", unit); +#elif defined(__OpenBSD__) + /* OpenBSD */ + sprintf (name, "/dev/rfd%dc", unit); +#elif defined(__QNXNTO__) + /* QNX RTP */ + sprintf (name, "/dev/fd%d", unit); +#elif defined(__sun) + /* Solaris */ + sprintf (name, "/dev/rdiskette%d", unit); +#else +# warning "BIOS floppy drives cannot be guessed in your operating system." + /* Set NAME to a bogus string. */ + *name = 0; +#endif +} + +static void +get_ide_disk_name (char *name, int unit) +{ +#if defined(__linux__) + /* GNU/Linux */ + sprintf (name, "/dev/hd%c", unit + 'a'); +#elif defined(__GNU__) + /* GNU/Hurd */ + sprintf (name, "/dev/hd%d", unit); +#elif defined(__FreeBSD_kernel__) + /* kFreeBSD */ + if (get_kfreebsd_version () >= 400000) + sprintf (name, "/dev/ad%d", unit); + else + sprintf (name, "/dev/rwd%d", unit); +#elif defined(__NetBSD__) && defined(HAVE_OPENDISK) + /* NetBSD */ + char shortname[16]; + int fd; + + sprintf (shortname, "wd%d", unit); + fd = opendisk (shortname, O_RDONLY, name, + 16, /* length of NAME */ + 0 /* char device */ + ); + close (fd); +#elif defined(__OpenBSD__) + /* OpenBSD */ + sprintf (name, "/dev/rwd%dc", unit); +#elif defined(__QNXNTO__) + /* QNX RTP */ + /* Actually, QNX RTP doesn't distinguish IDE from SCSI, so this could + contain SCSI disks. */ + sprintf (name, "/dev/hd%d", unit); +#elif defined(__sun) + *name = 0; /* FIXME */ +#else +# warning "BIOS IDE drives cannot be guessed in your operating system." + /* Set NAME to a bogus string. */ + *name = 0; +#endif +} + +static void +get_scsi_disk_name (char *name, int unit) +{ +#if defined(__linux__) + /* GNU/Linux */ + sprintf (name, "/dev/sd%c", unit + 'a'); +#elif defined(__GNU__) + /* GNU/Hurd */ + sprintf (name, "/dev/sd%d", unit); +#elif defined(__FreeBSD_kernel__) + /* kFreeBSD */ + if (get_kfreebsd_version () >= 400000) + sprintf (name, "/dev/da%d", unit); + else + sprintf (name, "/dev/rda%d", unit); +#elif defined(__NetBSD__) && defined(HAVE_OPENDISK) + /* NetBSD */ + char shortname[16]; + int fd; + + sprintf (shortname, "sd%d", unit); + fd = opendisk (shortname, O_RDONLY, name, + 16, /* length of NAME */ + 0 /* char device */ + ); + close (fd); +#elif defined(__OpenBSD__) + /* OpenBSD */ + sprintf (name, "/dev/rsd%dc", unit); +#elif defined(__QNXNTO__) + /* QNX RTP */ + /* QNX RTP doesn't distinguish SCSI from IDE, so it is better to + disable the detection of SCSI disks here. */ + *name = 0; +#elif defined(__sun) + *name = 0; /* FIXME */ +#else +# warning "BIOS SCSI drives cannot be guessed in your operating system." + /* Set NAME to a bogus string. */ + *name = 0; +#endif +} + +#ifdef __linux__ +static void +get_dac960_disk_name (char *name, int controller, int drive) +{ + sprintf (name, "/dev/rd/c%dd%d", controller, drive); +} + +static void +get_ataraid_disk_name (char *name, int unit) +{ + sprintf (name, "/dev/ataraid/d%c", unit + '0'); +} +#endif + +/* Check if DEVICE can be read. If an error occurs, return zero, + otherwise return non-zero. */ +int +check_device (const char *device) +{ + char buf[512]; + FILE *fp; + + /* If DEVICE is empty, just return 1. */ + if (*device == 0) + return 1; + + fp = fopen (device, "r"); + if (! fp) + { + switch (errno) + { +#ifdef ENOMEDIUM + case ENOMEDIUM: +# if 0 + /* At the moment, this finds only CDROMs, which can't be + read anyway, so leave it out. Code should be + reactivated if `removable disks' and CDROMs are + supported. */ + /* Accept it, it may be inserted. */ + return 1; +# endif + break; +#endif /* ENOMEDIUM */ + default: + /* Break case and leave. */ + break; + } + /* Error opening the device. */ + return 0; + } + + /* Make sure CD-ROMs don't get assigned a BIOS disk number + before SCSI disks! */ +#ifdef __linux__ +# ifdef CDROM_GET_CAPABILITY + if (ioctl (fileno (fp), CDROM_GET_CAPABILITY, 0) >= 0) + return 0; +# else /* ! CDROM_GET_CAPABILITY */ + /* Check if DEVICE is a CD-ROM drive by the HDIO_GETGEO ioctl. */ + { + struct hd_geometry hdg; + struct stat st; + + if (fstat (fileno (fp), &st)) + return 0; + + /* If it is a block device and isn't a floppy, check if HDIO_GETGEO + succeeds. */ + if (S_ISBLK (st.st_mode) + && MAJOR (st.st_rdev) != FLOPPY_MAJOR + && ioctl (fileno (fp), HDIO_GETGEO, &hdg)) + return 0; + } +# endif /* ! CDROM_GET_CAPABILITY */ +#endif /* __linux__ */ + +#if defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) +# ifdef CDIOCCLRDEBUG + if (ioctl (fileno (fp), CDIOCCLRDEBUG, 0) >= 0) + return 0; +# endif /* CDIOCCLRDEBUG */ +#endif /* __FreeBSD_kernel__ || __NetBSD__ || __OpenBSD__ */ + + /* Attempt to read the first sector. */ + if (fread (buf, 1, 512, fp) != 512) + { + fclose (fp); + return 0; + } + + fclose (fp); + return 1; +} + +/* Read mapping information from FP, and write it to MAP. */ +static int +read_device_map (FILE *fp, char **map, const char *map_file) +{ + auto void show_error (int no, const char *msg); + auto void show_warning (int no, const char *msg, ...); + + auto void show_error (int no, const char *msg) + { + fprintf (stderr, "%s:%d: error: %s\n", map_file, no, msg); + } + + auto void show_warning (int no, const char *msg, ...) + { + va_list ap; + + va_start (ap, msg); + fprintf (stderr, "%s:%d: warning: ", map_file, no); + vfprintf (stderr, msg, ap); + va_end (ap); + } + + /* If there is the device map file, use the data in it instead of + probing devices. */ + char buf[1024]; /* XXX */ + int line_number = 0; + + while (fgets (buf, sizeof (buf), fp)) + { + char *ptr, *eptr; + int drive; + int is_floppy = 0; + + /* Increase the number of lines. */ + line_number++; + + /* If the first character is '#', skip it. */ + if (buf[0] == '#') + continue; + + ptr = buf; + /* Skip leading spaces. */ + while (*ptr && isspace (*ptr)) + ptr++; + + /* Skip empty lines. */ + if (! *ptr) + continue; + + if (*ptr != '(') + { + show_error (line_number, "No open parenthesis found"); + return 0; + } + + ptr++; + if ((*ptr != 'f' && *ptr != 'h') || *(ptr + 1) != 'd') + { + show_error (line_number, "Bad drive name"); + return 0; + } + + if (*ptr == 'f') + is_floppy = 1; + + ptr += 2; + drive = strtoul (ptr, &ptr, 10); + if (drive < 0) + { + show_error (line_number, "Bad device number"); + return 0; + } + else if (drive > 127) + { + show_warning (line_number, + "Ignoring %cd%d due to a BIOS limitation", + is_floppy ? 'f' : 'h', drive); + continue; + } + + if (! is_floppy) + drive += 0x80; + + if (*ptr != ')') + { + show_error (line_number, "No close parenthesis found"); + return 0; + } + + ptr++; + /* Skip spaces. */ + while (*ptr && isspace (*ptr)) + ptr++; + + if (! *ptr) + { + show_error (line_number, "No filename found"); + return 0; + } + + /* Terminate the filename. */ + eptr = ptr; + while (*eptr && ! isspace (*eptr)) + eptr++; + *eptr = 0; + + /* Multiple entries for a given drive is not allowed. */ + if (map[drive]) + { + show_error (line_number, "Duplicated entry found"); + return 0; + } + + map[drive] = strdup (ptr); + assert (map[drive]); + } + + return 1; +} + +/* Initialize the device map MAP. *MAP will be allocated from the heap + space. If MAP_FILE is not NULL, then read mappings from the file + MAP_FILE if it exists, otherwise, write guessed mappings to the file. + FLOPPY_DISKS is the number of floppy disk drives which will be probed. + If it is zero, don't probe any floppy at all. If it is one, probe one + floppy. If it is two, probe two floppies. And so on. */ +int +init_device_map (char ***map, const char *map_file, int floppy_disks) +{ + int i; + int num_hd = 0; + FILE *fp = 0; + + assert (map); + assert (*map == 0); + *map = malloc (NUM_DISKS * sizeof (char *)); + assert (*map); + + /* Probe devices for creating the device map. */ + + /* Initialize DEVICE_MAP. */ + for (i = 0; i < NUM_DISKS; i++) + (*map)[i] = 0; + + if (map_file) + { + /* Open the device map file. */ + fp = fopen (map_file, "r"); + if (fp) + { + int ret; + + ret = read_device_map (fp, *map, map_file); + fclose (fp); + return ret; + } + } + + /* Print something so that the user does not think GRUB has been + crashed. */ + fprintf (stderr, + "Probing devices to guess BIOS drives. " + "This may take a long time.\n"); + + if (map_file) + /* Try to open the device map file to write the probed data. */ + fp = fopen (map_file, "w"); + + /* Floppies. */ + for (i = 0; i < floppy_disks; i++) + { + char name[16]; + + get_floppy_disk_name (name, i); + /* In floppies, write the map, whether check_device succeeds + or not, because the user just does not insert floppies. */ + if (fp) + fprintf (fp, "(fd%d)\t%s\n", i, name); + + if (check_device (name)) + { + (*map)[i] = strdup (name); + assert ((*map)[i]); + } + } + +#ifdef __linux__ + if (have_devfs ()) + { + while (1) + { + char discn[32]; + char name[PATH_MAX]; + struct stat st; + + /* Linux creates symlinks "/dev/discs/discN" for convenience. + The way to number disks is the same as GRUB's. */ + sprintf (discn, "/dev/discs/disc%d", num_hd); + if (stat (discn, &st) < 0) + break; + + if (realpath (discn, name)) + { + strcat (name, "/disc"); + (*map)[num_hd + 0x80] = strdup (name); + assert ((*map)[num_hd + 0x80]); + + /* If the device map file is opened, write the map. */ + if (fp) + fprintf (fp, "(hd%d)\t%s\n", num_hd, name); + } + + num_hd++; + } + + /* OK, close the device map file if opened. */ + if (fp) + fclose (fp); + + return 1; + } +#endif /* __linux__ */ + + /* IDE disks. */ + for (i = 0; i < 8; i++) + { + char name[16]; + + get_ide_disk_name (name, i); + if (check_device (name)) + { + (*map)[num_hd + 0x80] = strdup (name); + assert ((*map)[num_hd + 0x80]); + + /* If the device map file is opened, write the map. */ + if (fp) + fprintf (fp, "(hd%d)\t%s\n", num_hd, name); + + num_hd++; + } + } + +#ifdef __linux__ + /* ATARAID disks. */ + for (i = 0; i < 8; i++) + { + char name[20]; + + get_ataraid_disk_name (name, i); + if (check_device (name)) + { + (*map)[num_hd + 0x80] = strdup (name); + assert ((*map)[num_hd + 0x80]); + + /* If the device map file is opened, write the map. */ + if (fp) + fprintf (fp, "(hd%d)\t%s\n", num_hd, name); + + num_hd++; + } + } +#endif /* __linux__ */ + + /* The rest is SCSI disks. */ + for (i = 0; i < 16; i++) + { + char name[16]; + + get_scsi_disk_name (name, i); + if (check_device (name)) + { + (*map)[num_hd + 0x80] = strdup (name); + assert ((*map)[num_hd + 0x80]); + + /* If the device map file is opened, write the map. */ + if (fp) + fprintf (fp, "(hd%d)\t%s\n", num_hd, name); + + num_hd++; + } + } + +#ifdef __linux__ + /* This is for DAC960 - we have + /dev/rd/cdp. + + DAC960 driver currently supports up to 8 controllers, 32 logical + drives, and 7 partitions. */ + { + int controller, drive; + + for (controller = 0; controller < 8; controller++) + { + for (drive = 0; drive < 15; drive++) + { + char name[24]; + + get_dac960_disk_name (name, controller, drive); + if (check_device (name)) + { + (*map)[num_hd + 0x80] = strdup (name); + assert ((*map)[num_hd + 0x80]); + + /* If the device map file is opened, write the map. */ + if (fp) + fprintf (fp, "(hd%d)\t%s\n", num_hd, name); + + num_hd++; + } + } + } + } +#endif /* __linux__ */ + + /* OK, close the device map file if opened. */ + if (fp) + fclose (fp); + + return 1; +} + +/* Restore the memory consumed for MAP. */ +void +restore_device_map (char **map) +{ + int i; + + for (i = 0; i < NUM_DISKS; i++) + if (map[i]) + free (map[i]); + + free (map); +} + +#ifdef __linux__ +/* Linux-only functions, because Linux has a bug that the disk cache for + a whole disk is not consistent with the one for a partition of the + disk. */ +int +is_disk_device (char **map, int drive) +{ + struct stat st; + + assert (map[drive] != 0); + assert (stat (map[drive], &st) == 0); + /* For now, disk devices under Linux are all block devices. */ + return S_ISBLK (st.st_mode); +} + +int +write_to_partition (char **map, int drive, int partition, + int sector, int size, const char *buf) +{ + char dev[PATH_MAX]; /* XXX */ + int fd; + + if ((partition & 0x00FF00) != 0x00FF00) + { + /* If the partition is a BSD partition, it is difficult to + obtain the representation in Linux. So don't support that. */ + errnum = ERR_DEV_VALUES; + return 1; + } + + assert (map[drive] != 0); + + strcpy (dev, map[drive]); + if (have_devfs ()) + { + if (strcmp (dev + strlen(dev) - 5, "/disc") == 0) + strcpy (dev + strlen(dev) - 5, "/part"); + } + sprintf (dev + strlen(dev), "%d", ((partition >> 16) & 0xFF) + 1); + + /* Open the partition. */ + fd = open (dev, O_RDWR); + if (fd < 0) + { + errnum = ERR_NO_PART; + return 0; + } + +#if defined(__linux__) && (!defined(__GLIBC__) || \ + ((__GLIBC__ < 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ < 1)))) + /* Maybe libc doesn't have large file support. */ + { + loff_t offset, result; + static int _llseek (uint filedes, ulong hi, ulong lo, + loff_t *res, uint wh); + _syscall5 (int, _llseek, uint, filedes, ulong, hi, ulong, lo, + loff_t *, res, uint, wh); + + offset = (loff_t) sector * (loff_t) SECTOR_SIZE; + if (_llseek (fd, offset >> 32, offset & 0xffffffff, &result, SEEK_SET)) + { + errnum = ERR_DEV_VALUES; + return 0; + } + } +#else + { + off_t offset = (off_t) sector * (off_t) SECTOR_SIZE; + + if (lseek (fd, offset, SEEK_SET) != offset) + { + errnum = ERR_DEV_VALUES; + return 0; + } + } +#endif + + if (write (fd, buf, size * SECTOR_SIZE) != (size * SECTOR_SIZE)) + { + close (fd); + errnum = ERR_WRITE; + return 0; + } + + sync (); /* Paranoia. */ + close (fd); + + return 1; +} +#endif /* __linux__ */ diff --git a/usr/src/grub/grub-0.97/lib/device.h b/usr/src/grub/grub-0.97/lib/device.h new file mode 100644 index 0000000000..02ffce8e8b --- /dev/null +++ b/usr/src/grub/grub-0.97/lib/device.h @@ -0,0 +1,48 @@ +/* device.h - Define macros and declare prototypes for device.c */ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2004 Free Software Foundation, 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 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 DEVICE_MAP_HEADER +#define DEVICE_MAP_HEADER 1 + +/* The maximum number of BIOS disks. */ +#define NUM_DISKS 256 + +/* Simulated disk sizes. */ +#define DEFAULT_FD_CYLINDERS 80 +#define DEFAULT_FD_HEADS 2 +#define DEFAULT_FD_SECTORS 18 +#define DEFAULT_HD_CYLINDERS 620 +#define DEFAULT_HD_HEADS 128 +#define DEFAULT_HD_SECTORS 63 + +/* Function prototypes. */ +extern void get_drive_geometry (struct geometry *geom, char **map, int drive); +extern int check_device (const char *device); +extern int init_device_map (char ***map, const char *map_file, + int no_floppies); +extern void restore_device_map (char **map); + +#ifdef __linux__ +extern int is_disk_device (char **map, int drive); +extern int write_to_partition (char **map, int drive, int partition, + int offset, int size, const char *buf); +#endif /* __linux__ */ + +#endif /* DEVICE_MAP_HEADER */ diff --git a/usr/src/grub/grub-0.97/lib/getopt.c b/usr/src/grub/grub-0.97/lib/getopt.c new file mode 100644 index 0000000000..04905fd356 --- /dev/null +++ b/usr/src/grub/grub-0.97/lib/getopt.c @@ -0,0 +1,1053 @@ +/* Getopt for GNU. + NOTE: getopt is now part of the C library, so if you don't know what + "Keep this file name-space clean" means, talk to drepper@gnu.org + before changing it! + + Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98 + Free Software Foundation, Inc. + + NOTE: The canonical source of this file is maintained with the GNU C Library. + Bugs can be reported to bug-glibc@gnu.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, 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. */ + +/* This tells Alpha OSF/1 not to define a getopt prototype in . + Ditto for AIX 3.2 and . */ +#ifndef _NO_PROTO +# define _NO_PROTO +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#if !defined __STDC__ || !__STDC__ +/* This is a separate conditional since some stdc systems + reject `defined (const)'. */ +# ifndef const +# define const +# endif +#endif + +#include + +/* Comment out all this code if we are using the GNU C Library, and are not + actually compiling the library itself. This code is part of the GNU C + Library, but also included in many other GNU distributions. Compiling + and linking in this code is a waste when using the GNU C library + (especially if it is a shared library). Rather than having every GNU + program understand `configure --with-gnu-libc' and omit the object files, + it is simpler to just do this in the source for each such file. */ + +#define GETOPT_INTERFACE_VERSION 2 +#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2 +# include +# if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION +# define ELIDE_CODE +# endif +#endif + +#ifndef ELIDE_CODE + + +/* This needs to come after some library #include + to get __GNU_LIBRARY__ defined. */ +#ifdef __GNU_LIBRARY__ +/* Don't include stdlib.h for non-GNU C libraries because some of them + contain conflicting prototypes for getopt. */ +# include +# include +#endif /* GNU C library. */ + +#ifdef VMS +# include +# if HAVE_STRING_H - 0 +# include +# endif +#endif + +#ifndef _ +/* This is for other GNU distributions with internationalized messages. + When compiling libc, the _ macro is predefined. */ +# ifdef HAVE_LIBINTL_H +# include +# define _(msgid) gettext (msgid) +# else +# define _(msgid) (msgid) +# endif +#endif + +/* This version of `getopt' appears to the caller like standard Unix `getopt' + but it behaves differently for the user, since it allows the user + to intersperse the options with the other arguments. + + As `getopt' works, it permutes the elements of ARGV so that, + when it is done, all the options precede everything else. Thus + all application programs are extended to handle flexible argument order. + + Setting the environment variable POSIXLY_CORRECT disables permutation. + Then the behavior is completely standard. + + GNU application programs can use a third alternative mode in which + they can distinguish the relative order of options and other arguments. */ + +#include "getopt.h" + +/* 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. */ + +char *optarg = NULL; + +/* 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. */ + +/* 1003.2 says this must be 1 before any call. */ +int optind = 1; + +/* Formerly, initialization of getopt depended on optind==0, which + causes problems with re-calling getopt as programs generally don't + know that. */ + +int __getopt_initialized = 0; + +/* The next char to be scanned in the option-element + in which the last option character we returned was found. + This allows us to pick up the scan where we left off. + + If this is zero, or a null string, it means resume the scan + by advancing to the next ARGV-element. */ + +static char *nextchar; + +/* Callers store zero here to inhibit the error message + for unrecognized options. */ + +int opterr = 1; + +/* Set to an option character which was unrecognized. + This must be initialized on some systems to avoid linking in the + system's own getopt implementation. */ + +int optopt = '?'; + +/* Describe how to deal with options that follow non-option ARGV-elements. + + If the caller did not specify anything, + the default is REQUIRE_ORDER if the environment variable + POSIXLY_CORRECT is defined, PERMUTE otherwise. + + REQUIRE_ORDER means don't recognize them as options; + stop option processing when the first non-option is seen. + This is what Unix does. + This mode of operation is selected by either setting the environment + variable POSIXLY_CORRECT, or using `+' as the first character + of the list of option characters. + + PERMUTE is the default. We permute the contents of ARGV as we scan, + so that eventually all the non-options are at the end. This allows options + to be given in any order, even with programs that were not written to + expect this. + + RETURN_IN_ORDER is an option available to programs that were written + to expect options and other ARGV-elements in any order and that care about + the ordering of the two. We describe each non-option ARGV-element + as if it were the argument of an option with character code 1. + Using `-' as the first character of the list of option characters + selects this mode of operation. + + The special argument `--' forces an end of option-scanning regardless + of the value of `ordering'. In the case of RETURN_IN_ORDER, only + `--' can cause `getopt' to return -1 with `optind' != ARGC. */ + +static enum +{ + REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER +} ordering; + +/* Value of POSIXLY_CORRECT environment variable. */ +static char *posixly_correct; + +#ifdef __GNU_LIBRARY__ +/* We want to avoid inclusion of string.h with non-GNU libraries + because there are many ways it can cause trouble. + On some systems, it contains special magic macros that don't work + in GCC. */ +# include +# define my_index strchr +#else + +# if HAVE_STRING_H +# include +# else +# include +# endif + +/* Avoid depending on library functions or files + whose names are inconsistent. */ + +#ifndef getenv +extern char *getenv (); +#endif + +static char * +my_index (str, chr) + const char *str; + int chr; +{ + while (*str) + { + if (*str == chr) + return (char *) str; + str++; + } + return 0; +} + +/* If using GCC, we can safely declare strlen this way. + If not using GCC, it is ok not to declare it. */ +#ifdef __GNUC__ +/* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h. + That was relevant to code that was here before. */ +# if (!defined __STDC__ || !__STDC__) && !defined strlen +/* gcc with -traditional declares the built-in strlen to return int, + and has done so at least since version 2.4.5. -- rms. */ +extern int strlen (const char *); +# endif /* not __STDC__ */ +#endif /* __GNUC__ */ + +#endif /* not __GNU_LIBRARY__ */ + +/* Handle permutation of arguments. */ + +/* Describe the part of ARGV that contains non-options that have + been skipped. `first_nonopt' is the index in ARGV of the first of them; + `last_nonopt' is the index after the last of them. */ + +static int first_nonopt; +static int last_nonopt; + +#ifdef _LIBC +/* Bash 2.0 gives us an environment variable containing flags + indicating ARGV elements that should not be considered arguments. */ + +/* Defined in getopt_init.c */ +extern char *__getopt_nonoption_flags; + +static int nonoption_flags_max_len; +static int nonoption_flags_len; + +static int original_argc; +static char *const *original_argv; + +/* Make sure the environment variable bash 2.0 puts in the environment + is valid for the getopt call we must make sure that the ARGV passed + to getopt is that one passed to the process. */ +static void +__attribute__ ((unused)) +store_args_and_env (int argc, char *const *argv) +{ + /* XXX This is no good solution. We should rather copy the args so + that we can compare them later. But we must not use malloc(3). */ + original_argc = argc; + original_argv = argv; +} +# ifdef text_set_element +text_set_element (__libc_subinit, store_args_and_env); +# endif /* text_set_element */ + +# define SWAP_FLAGS(ch1, ch2) \ + if (nonoption_flags_len > 0) \ + { \ + char __tmp = __getopt_nonoption_flags[ch1]; \ + __getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2]; \ + __getopt_nonoption_flags[ch2] = __tmp; \ + } +#else /* !_LIBC */ +# define SWAP_FLAGS(ch1, ch2) +#endif /* _LIBC */ + +/* Exchange two adjacent subsequences of ARGV. + One subsequence is elements [first_nonopt,last_nonopt) + which contains all the non-options that have been skipped so far. + The other is elements [last_nonopt,optind), which contains all + the options processed since those non-options were skipped. + + `first_nonopt' and `last_nonopt' are relocated so that they describe + the new indices of the non-options in ARGV after they are moved. */ + +#if defined __STDC__ && __STDC__ +static void exchange (char **); +#endif + +static void +exchange (argv) + char **argv; +{ + int bottom = first_nonopt; + int middle = last_nonopt; + int top = optind; + char *tem; + + /* Exchange the shorter segment with the far end of the longer segment. + That puts the shorter segment into the right place. + It leaves the longer segment in the right place overall, + but it consists of two parts that need to be swapped next. */ + +#ifdef _LIBC + /* First make sure the handling of the `__getopt_nonoption_flags' + string can work normally. Our top argument must be in the range + of the string. */ + if (nonoption_flags_len > 0 && top >= nonoption_flags_max_len) + { + /* We must extend the array. The user plays games with us and + presents new arguments. */ + char *new_str = malloc (top + 1); + if (new_str == NULL) + nonoption_flags_len = nonoption_flags_max_len = 0; + else + { + memset (__mempcpy (new_str, __getopt_nonoption_flags, + nonoption_flags_max_len), + '\0', top + 1 - nonoption_flags_max_len); + nonoption_flags_max_len = top + 1; + __getopt_nonoption_flags = new_str; + } + } +#endif + + while (top > middle && middle > bottom) + { + if (top - middle > middle - bottom) + { + /* Bottom segment is the short one. */ + int len = middle - bottom; + register int i; + + /* Swap it with the top part of the top segment. */ + for (i = 0; i < len; i++) + { + tem = argv[bottom + i]; + argv[bottom + i] = argv[top - (middle - bottom) + i]; + argv[top - (middle - bottom) + i] = tem; + SWAP_FLAGS (bottom + i, top - (middle - bottom) + i); + } + /* Exclude the moved bottom segment from further swapping. */ + top -= len; + } + else + { + /* Top segment is the short one. */ + int len = top - middle; + register int i; + + /* Swap it with the bottom part of the bottom segment. */ + for (i = 0; i < len; i++) + { + tem = argv[bottom + i]; + argv[bottom + i] = argv[middle + i]; + argv[middle + i] = tem; + SWAP_FLAGS (bottom + i, middle + i); + } + /* Exclude the moved top segment from further swapping. */ + bottom += len; + } + } + + /* Update records for the slots the non-options now occupy. */ + + first_nonopt += (optind - last_nonopt); + last_nonopt = optind; +} + +/* Initialize the internal data when the first call is made. */ + +#if defined __STDC__ && __STDC__ +static const char *_getopt_initialize (int, char *const *, const char *); +#endif +static const char * +_getopt_initialize (argc, argv, optstring) + int argc; + char *const *argv; + const char *optstring; +{ + /* Start processing options with ARGV-element 1 (since ARGV-element 0 + is the program name); the sequence of previously skipped + non-option ARGV-elements is empty. */ + + first_nonopt = last_nonopt = optind; + + nextchar = NULL; + + posixly_correct = getenv ("POSIXLY_CORRECT"); + + /* Determine how to handle the ordering of options and nonoptions. */ + + if (optstring[0] == '-') + { + ordering = RETURN_IN_ORDER; + ++optstring; + } + else if (optstring[0] == '+') + { + ordering = REQUIRE_ORDER; + ++optstring; + } + else if (posixly_correct != NULL) + ordering = REQUIRE_ORDER; + else + ordering = PERMUTE; + +#ifdef _LIBC + if (posixly_correct == NULL + && argc == original_argc && argv == original_argv) + { + if (nonoption_flags_max_len == 0) + { + if (__getopt_nonoption_flags == NULL + || __getopt_nonoption_flags[0] == '\0') + nonoption_flags_max_len = -1; + else + { + const char *orig_str = __getopt_nonoption_flags; + int len = nonoption_flags_max_len = strlen (orig_str); + if (nonoption_flags_max_len < argc) + nonoption_flags_max_len = argc; + __getopt_nonoption_flags = + (char *) malloc (nonoption_flags_max_len); + if (__getopt_nonoption_flags == NULL) + nonoption_flags_max_len = -1; + else + memset (__mempcpy (__getopt_nonoption_flags, orig_str, len), + '\0', nonoption_flags_max_len - len); + } + } + nonoption_flags_len = nonoption_flags_max_len; + } + else + nonoption_flags_len = 0; +#endif + + return optstring; +} + +/* Scan elements of ARGV (whose length is ARGC) for option characters + given in OPTSTRING. + + If an element of ARGV starts with '-', and is not exactly "-" or "--", + then it is an option element. The characters of this element + (aside from the initial '-') are option characters. If `getopt' + is called repeatedly, it returns successively each of the option characters + from each of the option elements. + + If `getopt' finds another option character, it returns that character, + updating `optind' and `nextchar' so that the next call to `getopt' can + resume the scan with the following option character or ARGV-element. + + If there are no more option characters, `getopt' returns -1. + Then `optind' is the index in ARGV of the first ARGV-element + that is not an option. (The ARGV-elements have been permuted + so that those that are not options now come last.) + + OPTSTRING is a string containing the legitimate option characters. + If an option character is seen that is not listed in OPTSTRING, + return '?' after printing an error message. If you set `opterr' to + zero, the error message is suppressed but we still return '?'. + + If a char in OPTSTRING is followed by a colon, that means it wants an arg, + so the following text in the same ARGV-element, or the text of the following + ARGV-element, is returned in `optarg'. Two colons mean an option that + wants an optional arg; if there is text in the current ARGV-element, + it is returned in `optarg', otherwise `optarg' is set to zero. + + If OPTSTRING starts with `-' or `+', it requests different methods of + handling the non-option ARGV-elements. + See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above. + + Long-named options begin with `--' instead of `-'. + Their names may be abbreviated as long as the abbreviation is unique + or is an exact match for some defined option. If they have an + argument, it follows the option name in the same ARGV-element, separated + from the option name by a `=', or else the in next ARGV-element. + When `getopt' finds a long-named option, it returns 0 if that option's + `flag' field is nonzero, the value of the option's `val' field + if the `flag' field is zero. + + The elements of ARGV aren't really const, because we permute them. + But we pretend they're const in the prototype to be compatible + with other systems. + + LONGOPTS is a vector of `struct option' terminated by an + element containing a name which is zero. + + LONGIND returns the index in LONGOPT of the long-named option found. + It is only valid when a long-named option has been found by the most + recent call. + + If LONG_ONLY is nonzero, '-' as well as '--' can introduce + long-named options. */ + +int +_getopt_internal (argc, argv, optstring, longopts, longind, long_only) + int argc; + char *const *argv; + const char *optstring; + const struct option *longopts; + int *longind; + int long_only; +{ + optarg = NULL; + + if (optind == 0 || !__getopt_initialized) + { + if (optind == 0) + optind = 1; /* Don't scan ARGV[0], the program name. */ + optstring = _getopt_initialize (argc, argv, optstring); + __getopt_initialized = 1; + } + + /* Test whether ARGV[optind] points to a non-option argument. + Either it does not have option syntax, or there is an environment flag + from the shell indicating it is not an option. The later information + is only used when the used in the GNU libc. */ +#ifdef _LIBC +# define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0' \ + || (optind < nonoption_flags_len \ + && __getopt_nonoption_flags[optind] == '1')) +#else +# define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0') +#endif + + if (nextchar == NULL || *nextchar == '\0') + { + /* Advance to the next ARGV-element. */ + + /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been + moved back by the user (who may also have changed the arguments). */ + if (last_nonopt > optind) + last_nonopt = optind; + if (first_nonopt > optind) + first_nonopt = optind; + + if (ordering == PERMUTE) + { + /* If we have just processed some options following some non-options, + exchange them so that the options come first. */ + + if (first_nonopt != last_nonopt && last_nonopt != optind) + exchange ((char **) argv); + else if (last_nonopt != optind) + first_nonopt = optind; + + /* Skip any additional non-options + and extend the range of non-options previously skipped. */ + + while (optind < argc && NONOPTION_P) + optind++; + last_nonopt = optind; + } + + /* The special ARGV-element `--' means premature end of options. + Skip it like a null option, + then exchange with previous non-options as if it were an option, + then skip everything else like a non-option. */ + + if (optind != argc && !strcmp (argv[optind], "--")) + { + optind++; + + if (first_nonopt != last_nonopt && last_nonopt != optind) + exchange ((char **) argv); + else if (first_nonopt == last_nonopt) + first_nonopt = optind; + last_nonopt = argc; + + optind = argc; + } + + /* If we have done all the ARGV-elements, stop the scan + and back over any non-options that we skipped and permuted. */ + + if (optind == argc) + { + /* Set the next-arg-index to point at the non-options + that we previously skipped, so the caller will digest them. */ + if (first_nonopt != last_nonopt) + optind = first_nonopt; + return -1; + } + + /* If we have come to a non-option and did not permute it, + either stop the scan or describe it to the caller and pass it by. */ + + if (NONOPTION_P) + { + if (ordering == REQUIRE_ORDER) + return -1; + optarg = argv[optind++]; + return 1; + } + + /* We have found another option-ARGV-element. + Skip the initial punctuation. */ + + nextchar = (argv[optind] + 1 + + (longopts != NULL && argv[optind][1] == '-')); + } + + /* Decode the current option-ARGV-element. */ + + /* Check whether the ARGV-element is a long option. + + If long_only and the ARGV-element has the form "-f", where f is + a valid short option, don't consider it an abbreviated form of + a long option that starts with f. Otherwise there would be no + way to give the -f short option. + + On the other hand, if there's a long option "fubar" and + the ARGV-element is "-fu", do consider that an abbreviation of + the long option, just like "--fu", and not "-f" with arg "u". + + This distinction seems to be the most useful approach. */ + + if (longopts != NULL + && (argv[optind][1] == '-' + || (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1]))))) + { + char *nameend; + const struct option *p; + const struct option *pfound = NULL; + int exact = 0; + int ambig = 0; + int indfound = -1; + int option_index; + + for (nameend = nextchar; *nameend && *nameend != '='; nameend++) + /* Do nothing. */ ; + + /* Test all long options for either exact match + or abbreviated matches. */ + for (p = longopts, option_index = 0; p->name; p++, option_index++) + if (!strncmp (p->name, nextchar, nameend - nextchar)) + { + if ((unsigned int) (nameend - nextchar) + == (unsigned int) strlen (p->name)) + { + /* Exact match found. */ + pfound = p; + indfound = option_index; + exact = 1; + break; + } + else if (pfound == NULL) + { + /* First nonexact match found. */ + pfound = p; + indfound = option_index; + } + else + /* Second or later nonexact match found. */ + ambig = 1; + } + + if (ambig && !exact) + { + if (opterr) + fprintf (stderr, _("%s: option `%s' is ambiguous\n"), + argv[0], argv[optind]); + nextchar += strlen (nextchar); + optind++; + optopt = 0; + return '?'; + } + + if (pfound != NULL) + { + option_index = indfound; + optind++; + if (*nameend) + { + /* Don't test has_arg with >, because some C compilers don't + allow it to be used on enums. */ + if (pfound->has_arg) + optarg = nameend + 1; + else + { + if (opterr) + { + if (argv[optind - 1][1] == '-') + /* --option */ + fprintf (stderr, + _("%s: option `--%s' doesn't allow an argument\n"), + argv[0], pfound->name); + else + /* +option or -option */ + fprintf (stderr, + _("%s: option `%c%s' doesn't allow an argument\n"), + argv[0], argv[optind - 1][0], pfound->name); + } + nextchar += strlen (nextchar); + + optopt = pfound->val; + return '?'; + } + } + else if (pfound->has_arg == 1) + { + if (optind < argc) + optarg = argv[optind++]; + else + { + if (opterr) + fprintf (stderr, + _("%s: option `%s' requires an argument\n"), + argv[0], argv[optind - 1]); + nextchar += strlen (nextchar); + optopt = pfound->val; + return optstring[0] == ':' ? ':' : '?'; + } + } + nextchar += strlen (nextchar); + if (longind != NULL) + *longind = option_index; + if (pfound->flag) + { + *(pfound->flag) = pfound->val; + return 0; + } + return pfound->val; + } + + /* Can't find it as a long option. If this is not getopt_long_only, + or the option starts with '--' or is not a valid short + option, then it's an error. + Otherwise interpret it as a short option. */ + if (!long_only || argv[optind][1] == '-' + || my_index (optstring, *nextchar) == NULL) + { + if (opterr) + { + if (argv[optind][1] == '-') + /* --option */ + fprintf (stderr, _("%s: unrecognized option `--%s'\n"), + argv[0], nextchar); + else + /* +option or -option */ + fprintf (stderr, _("%s: unrecognized option `%c%s'\n"), + argv[0], argv[optind][0], nextchar); + } + nextchar = (char *) ""; + optind++; + optopt = 0; + return '?'; + } + } + + /* Look at and handle the next short option-character. */ + + { + char c = *nextchar++; + char *temp = my_index (optstring, c); + + /* Increment `optind' when we start to process its last character. */ + if (*nextchar == '\0') + ++optind; + + if (temp == NULL || c == ':') + { + if (opterr) + { + if (posixly_correct) + /* 1003.2 specifies the format of this message. */ + fprintf (stderr, _("%s: illegal option -- %c\n"), + argv[0], c); + else + fprintf (stderr, _("%s: invalid option -- %c\n"), + argv[0], c); + } + optopt = c; + return '?'; + } + /* Convenience. Treat POSIX -W foo same as long option --foo */ + if (temp[0] == 'W' && temp[1] == ';') + { + char *nameend; + const struct option *p; + const struct option *pfound = NULL; + int exact = 0; + int ambig = 0; + int indfound = 0; + int option_index; + + /* This is an option that requires an argument. */ + if (*nextchar != '\0') + { + optarg = nextchar; + /* If we end this ARGV-element by taking the rest as an arg, + we must advance to the next element now. */ + optind++; + } + else if (optind == argc) + { + if (opterr) + { + /* 1003.2 specifies the format of this message. */ + fprintf (stderr, _("%s: option requires an argument -- %c\n"), + argv[0], c); + } + optopt = c; + if (optstring[0] == ':') + c = ':'; + else + c = '?'; + return c; + } + else + /* We already incremented `optind' once; + increment it again when taking next ARGV-elt as argument. */ + optarg = argv[optind++]; + + /* optarg is now the argument, see if it's in the + table of longopts. */ + + for (nextchar = nameend = optarg; *nameend && *nameend != '='; nameend++) + /* Do nothing. */ ; + + /* Test all long options for either exact match + or abbreviated matches. */ + for (p = longopts, option_index = 0; p->name; p++, option_index++) + if (!strncmp (p->name, nextchar, nameend - nextchar)) + { + if ((unsigned int) (nameend - nextchar) == strlen (p->name)) + { + /* Exact match found. */ + pfound = p; + indfound = option_index; + exact = 1; + break; + } + else if (pfound == NULL) + { + /* First nonexact match found. */ + pfound = p; + indfound = option_index; + } + else + /* Second or later nonexact match found. */ + ambig = 1; + } + if (ambig && !exact) + { + if (opterr) + fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"), + argv[0], argv[optind]); + nextchar += strlen (nextchar); + optind++; + return '?'; + } + if (pfound != NULL) + { + option_index = indfound; + if (*nameend) + { + /* Don't test has_arg with >, because some C compilers don't + allow it to be used on enums. */ + if (pfound->has_arg) + optarg = nameend + 1; + else + { + if (opterr) + fprintf (stderr, _("\ +%s: option `-W %s' doesn't allow an argument\n"), + argv[0], pfound->name); + + nextchar += strlen (nextchar); + return '?'; + } + } + else if (pfound->has_arg == 1) + { + if (optind < argc) + optarg = argv[optind++]; + else + { + if (opterr) + fprintf (stderr, + _("%s: option `%s' requires an argument\n"), + argv[0], argv[optind - 1]); + nextchar += strlen (nextchar); + return optstring[0] == ':' ? ':' : '?'; + } + } + nextchar += strlen (nextchar); + if (longind != NULL) + *longind = option_index; + if (pfound->flag) + { + *(pfound->flag) = pfound->val; + return 0; + } + return pfound->val; + } + nextchar = NULL; + return 'W'; /* Let the application handle it. */ + } + if (temp[1] == ':') + { + if (temp[2] == ':') + { + /* This is an option that accepts an argument optionally. */ + if (*nextchar != '\0') + { + optarg = nextchar; + optind++; + } + else + optarg = NULL; + nextchar = NULL; + } + else + { + /* This is an option that requires an argument. */ + if (*nextchar != '\0') + { + optarg = nextchar; + /* If we end this ARGV-element by taking the rest as an arg, + we must advance to the next element now. */ + optind++; + } + else if (optind == argc) + { + if (opterr) + { + /* 1003.2 specifies the format of this message. */ + fprintf (stderr, + _("%s: option requires an argument -- %c\n"), + argv[0], c); + } + optopt = c; + if (optstring[0] == ':') + c = ':'; + else + c = '?'; + } + else + /* We already incremented `optind' once; + increment it again when taking next ARGV-elt as argument. */ + optarg = argv[optind++]; + nextchar = NULL; + } + } + return c; + } +} + +int +getopt (argc, argv, optstring) + int argc; + char *const *argv; + const char *optstring; +{ + return _getopt_internal (argc, argv, optstring, + (const struct option *) 0, + (int *) 0, + 0); +} + +#endif /* Not ELIDE_CODE. */ + +#ifdef TEST + +/* Compile with -DTEST to make an executable for use in testing + the above definition of `getopt'. */ + +int +main (argc, argv) + int argc; + char **argv; +{ + int c; + int digit_optind = 0; + + while (1) + { + int this_option_optind = optind ? optind : 1; + + c = getopt (argc, argv, "abc:d:0123456789"); + if (c == -1) + break; + + switch (c) + { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + if (digit_optind != 0 && digit_optind != this_option_optind) + printf ("digits occur in two different argv-elements.\n"); + digit_optind = this_option_optind; + printf ("option %c\n", c); + break; + + case 'a': + printf ("option a\n"); + break; + + case 'b': + printf ("option b\n"); + break; + + case 'c': + printf ("option c with value `%s'\n", optarg); + break; + + case '?': + break; + + default: + printf ("?? getopt returned character code 0%o ??\n", c); + } + } + + if (optind < argc) + { + printf ("non-option ARGV-elements: "); + while (optind < argc) + printf ("%s ", argv[optind++]); + printf ("\n"); + } + + exit (0); +} + +#endif /* TEST */ diff --git a/usr/src/grub/grub-0.97/lib/getopt.h b/usr/src/grub/grub-0.97/lib/getopt.h new file mode 100644 index 0000000000..fb30719a86 --- /dev/null +++ b/usr/src/grub/grub-0.97/lib/getopt.h @@ -0,0 +1,133 @@ +/* Declarations for getopt. + Copyright (C) 1989,90,91,92,93,94,96,97 Free Software Foundation, Inc. + + NOTE: The canonical source of this file is maintained with the GNU C Library. + Bugs can be reported to bug-glibc@gnu.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, 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 _GETOPT_H +#define _GETOPT_H 1 + +#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; + +/* 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 +{ +#if defined (__STDC__) && __STDC__ + const char *name; +#else + char *name; +#endif + /* 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 + +#if defined (__STDC__) && __STDC__ +#ifdef __GNU_LIBRARY__ +/* 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); +#else /* not __GNU_LIBRARY__ */ +extern int getopt (); +#endif /* __GNU_LIBRARY__ */ +extern int getopt_long (int argc, char *const *argv, const char *shortopts, + const struct option *longopts, int *longind); +extern int getopt_long_only (int argc, char *const *argv, + const char *shortopts, + const struct option *longopts, int *longind); + +/* Internal only. Users should not call this directly. */ +extern int _getopt_internal (int argc, char *const *argv, + const char *shortopts, + const struct option *longopts, int *longind, + int long_only); +#else /* not __STDC__ */ +extern int getopt (); +extern int getopt_long (); +extern int getopt_long_only (); + +extern int _getopt_internal (); +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* getopt.h */ diff --git a/usr/src/grub/grub-0.97/lib/getopt1.c b/usr/src/grub/grub-0.97/lib/getopt1.c new file mode 100644 index 0000000000..ff257374c3 --- /dev/null +++ b/usr/src/grub/grub-0.97/lib/getopt1.c @@ -0,0 +1,190 @@ +/* getopt_long and getopt_long_only entry points for GNU getopt. + Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98 + Free Software Foundation, Inc. + + NOTE: The canonical source of this file is maintained with the GNU C Library. + Bugs can be reported to bug-glibc@gnu.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, 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. */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "getopt.h" + +#if !defined __STDC__ || !__STDC__ +/* This is a separate conditional since some stdc systems + reject `defined (const)'. */ +#ifndef const +#define const +#endif +#endif + +#include + +/* Comment out all this code if we are using the GNU C Library, and are not + actually compiling the library itself. This code is part of the GNU C + Library, but also included in many other GNU distributions. Compiling + and linking in this code is a waste when using the GNU C library + (especially if it is a shared library). Rather than having every GNU + program understand `configure --with-gnu-libc' and omit the object files, + it is simpler to just do this in the source for each such file. */ + +#define GETOPT_INTERFACE_VERSION 2 +#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2 +#include +#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION +#define ELIDE_CODE +#endif +#endif + +#ifndef ELIDE_CODE + + +/* This needs to come after some library #include + to get __GNU_LIBRARY__ defined. */ +#ifdef __GNU_LIBRARY__ +#include +#endif + +#ifndef NULL +#define NULL 0 +#endif + +int +getopt_long (argc, argv, options, long_options, opt_index) + int argc; + char *const *argv; + const char *options; + const struct option *long_options; + int *opt_index; +{ + return _getopt_internal (argc, argv, options, long_options, opt_index, 0); +} + +/* Like getopt_long, but '-' as well as '--' can indicate a long option. + If an option that starts with '-' (not '--') doesn't match a long option, + but does match a short option, it is parsed as a short option + instead. */ + +int +getopt_long_only (argc, argv, options, long_options, opt_index) + int argc; + char *const *argv; + const char *options; + const struct option *long_options; + int *opt_index; +{ + return _getopt_internal (argc, argv, options, long_options, opt_index, 1); +} + + +#endif /* Not ELIDE_CODE. */ + +#ifdef TEST + +#include + +int +main (argc, argv) + int argc; + char **argv; +{ + int c; + int digit_optind = 0; + + while (1) + { + int this_option_optind = optind ? optind : 1; + int option_index = 0; + static struct option long_options[] = + { + {"add", 1, 0, 0}, + {"append", 0, 0, 0}, + {"delete", 1, 0, 0}, + {"verbose", 0, 0, 0}, + {"create", 0, 0, 0}, + {"file", 1, 0, 0}, + {0, 0, 0, 0} + }; + + c = getopt_long (argc, argv, "abc:d:0123456789", + long_options, &option_index); + if (c == -1) + break; + + switch (c) + { + case 0: + printf ("option %s", long_options[option_index].name); + if (optarg) + printf (" with arg %s", optarg); + printf ("\n"); + break; + + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + if (digit_optind != 0 && digit_optind != this_option_optind) + printf ("digits occur in two different argv-elements.\n"); + digit_optind = this_option_optind; + printf ("option %c\n", c); + break; + + case 'a': + printf ("option a\n"); + break; + + case 'b': + printf ("option b\n"); + break; + + case 'c': + printf ("option c with value `%s'\n", optarg); + break; + + case 'd': + printf ("option d with value `%s'\n", optarg); + break; + + case '?': + break; + + default: + printf ("?? getopt returned character code 0%o ??\n", c); + } + } + + if (optind < argc) + { + printf ("non-option ARGV-elements: "); + while (optind < argc) + printf ("%s ", argv[optind++]); + printf ("\n"); + } + + exit (0); +} + +#endif /* TEST */ diff --git a/usr/src/grub/grub-0.97/missing b/usr/src/grub/grub-0.97/missing new file mode 100755 index 0000000000..64b5f901dd --- /dev/null +++ b/usr/src/grub/grub-0.97/missing @@ -0,0 +1,353 @@ +#! /bin/sh +# Common stub for a few missing GNU programs while installing. + +scriptversion=2004-09-07.08 + +# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004 +# Free Software Foundation, Inc. +# Originally by Fran,cois Pinard , 1996. + +# 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. + +# 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. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +if test $# -eq 0; then + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 +fi + +run=: + +# In the cases where this matters, `missing' is being run in the +# srcdir already. +if test -f configure.ac; then + configure_ac=configure.ac +else + configure_ac=configure.in +fi + +msg="missing on your system" + +case "$1" in +--run) + # Try to run requested program, and just exit if it succeeds. + run= + shift + "$@" && exit 0 + # Exit code 63 means version mismatch. This often happens + # when the user try to use an ancient version of a tool on + # a file that requires a minimum version. In this case we + # we should proceed has if the program had been absent, or + # if --run hadn't been passed. + if test $? = 63; then + run=: + msg="probably too old" + fi + ;; + + -h|--h|--he|--hel|--help) + echo "\ +$0 [OPTION]... PROGRAM [ARGUMENT]... + +Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an +error status if there is no known handling for PROGRAM. + +Options: + -h, --help display this help and exit + -v, --version output version information and exit + --run try to run the given command, and emulate it if it fails + +Supported PROGRAM values: + aclocal touch file \`aclocal.m4' + autoconf touch file \`configure' + autoheader touch file \`config.h.in' + automake touch all \`Makefile.in' files + bison create \`y.tab.[ch]', if possible, from existing .[ch] + flex create \`lex.yy.c', if possible, from existing .c + help2man touch the output file + lex create \`lex.yy.c', if possible, from existing .c + makeinfo touch the output file + tar try tar, gnutar, gtar, then tar without non-portable flags + yacc create \`y.tab.[ch]', if possible, from existing .[ch] + +Send bug reports to ." + exit 0 + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing $scriptversion (GNU Automake)" + exit 0 + ;; + + -*) + echo 1>&2 "$0: Unknown \`$1' option" + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 + ;; + +esac + +# Now exit if we have it, but it failed. Also exit now if we +# don't have it and --version was passed (most likely to detect +# the program). +case "$1" in + lex|yacc) + # Not GNU programs, they don't have --version. + ;; + + tar) + if test -n "$run"; then + echo 1>&2 "ERROR: \`tar' requires --run" + exit 1 + elif test "x$2" = "x--version" || test "x$2" = "x--help"; then + exit 1 + fi + ;; + + *) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + elif test "x$2" = "x--version" || test "x$2" = "x--help"; then + # Could not run --version or --help. This is probably someone + # running `$TOOL --version' or `$TOOL --help' to check whether + # $TOOL exists and not knowing $TOOL uses missing. + exit 1 + fi + ;; +esac + +# If it does not exist, or fails to run (possibly an outdated version), +# try to emulate it. +case "$1" in + aclocal*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`acinclude.m4' or \`${configure_ac}'. You might want + to install the \`Automake' and \`Perl' packages. Grab them from + any GNU archive site." + touch aclocal.m4 + ;; + + autoconf) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`${configure_ac}'. You might want to install the + \`Autoconf' and \`GNU m4' packages. Grab them from any GNU + archive site." + touch configure + ;; + + autoheader) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`acconfig.h' or \`${configure_ac}'. You might want + to install the \`Autoconf' and \`GNU m4' packages. Grab them + from any GNU archive site." + files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` + test -z "$files" && files="config.h" + touch_files= + for f in $files; do + case "$f" in + *:*) touch_files="$touch_files "`echo "$f" | + sed -e 's/^[^:]*://' -e 's/:.*//'`;; + *) touch_files="$touch_files $f.in";; + esac + done + touch $touch_files + ;; + + automake*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. + You might want to install the \`Automake' and \`Perl' packages. + Grab them from any GNU archive site." + find . -type f -name Makefile.am -print | + sed 's/\.am$/.in/' | + while read f; do touch "$f"; done + ;; + + autom4te) + echo 1>&2 "\ +WARNING: \`$1' is needed, but is $msg. + You might have modified some files without having the + proper tools for further handling them. + You can get \`$1' as part of \`Autoconf' from any GNU + archive site." + + file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` + test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` + if test -f "$file"; then + touch $file + else + test -z "$file" || exec >$file + echo "#! /bin/sh" + echo "# Created by GNU Automake missing as a replacement of" + echo "# $ $@" + echo "exit 0" + chmod +x $file + exit 1 + fi + ;; + + bison|yacc) + echo 1>&2 "\ +WARNING: \`$1' $msg. You should only need it if + you modified a \`.y' file. You may need the \`Bison' package + in order for those modifications to take effect. You can get + \`Bison' from any GNU archive site." + rm -f y.tab.c y.tab.h + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.y) + SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.c + fi + SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.h + fi + ;; + esac + fi + if [ ! -f y.tab.h ]; then + echo >y.tab.h + fi + if [ ! -f y.tab.c ]; then + echo 'main() { return 0; }' >y.tab.c + fi + ;; + + lex|flex) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a \`.l' file. You may need the \`Flex' package + in order for those modifications to take effect. You can get + \`Flex' from any GNU archive site." + rm -f lex.yy.c + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.l) + SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" lex.yy.c + fi + ;; + esac + fi + if [ ! -f lex.yy.c ]; then + echo 'main() { return 0; }' >lex.yy.c + fi + ;; + + help2man) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a dependency of a manual page. You may need the + \`Help2man' package in order for those modifications to take + effect. You can get \`Help2man' from any GNU archive site." + + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` + fi + if [ -f "$file" ]; then + touch $file + else + test -z "$file" || exec >$file + echo ".ab help2man is required to generate this page" + exit 1 + fi + ;; + + makeinfo) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a \`.texi' or \`.texinfo' file, or any other file + indirectly affecting the aspect of the manual. The spurious + call might also be the consequence of using a buggy \`make' (AIX, + DU, IRIX). You might want to install the \`Texinfo' package or + the \`GNU make' package. Grab either from any GNU archive site." + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` + fi + touch $file + ;; + + tar) + shift + + # We have already tried tar in the generic part. + # Look for gnutar/gtar before invocation to avoid ugly error + # messages. + if (gnutar --version > /dev/null 2>&1); then + gnutar "$@" && exit 0 + fi + if (gtar --version > /dev/null 2>&1); then + gtar "$@" && exit 0 + fi + firstarg="$1" + if shift; then + case "$firstarg" in + *o*) + firstarg=`echo "$firstarg" | sed s/o//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + case "$firstarg" in + *h*) + firstarg=`echo "$firstarg" | sed s/h//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + fi + + echo 1>&2 "\ +WARNING: I can't seem to be able to run \`tar' with the given arguments. + You may want to install GNU tar or Free paxutils, or check the + command line arguments." + exit 1 + ;; + + *) + echo 1>&2 "\ +WARNING: \`$1' is needed, and is $msg. + You might have modified some files without having the + proper tools for further handling them. Check the \`README' file, + it often tells you about the needed prerequisites for installing + this package. You may also peek at any GNU archive site, in case + some other package would contain this missing \`$1' program." + exit 1 + ;; +esac + +exit 0 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/usr/src/grub/grub-0.97/mkinstalldirs b/usr/src/grub/grub-0.97/mkinstalldirs new file mode 100755 index 0000000000..6fbe5e1176 --- /dev/null +++ b/usr/src/grub/grub-0.97/mkinstalldirs @@ -0,0 +1,150 @@ +#! /bin/sh +# mkinstalldirs --- make directory hierarchy + +scriptversion=2004-02-15.20 + +# Original author: Noah Friedman +# Created: 1993-05-16 +# Public domain. +# +# This file is maintained in Automake, please report +# bugs to or send patches to +# . + +errstatus=0 +dirmode="" + +usage="\ +Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ... + +Create each directory DIR (with mode MODE, if specified), including all +leading file name components. + +Report bugs to ." + +# process command line arguments +while test $# -gt 0 ; do + case $1 in + -h | --help | --h*) # -h for help + echo "$usage" + exit 0 + ;; + -m) # -m PERM arg + shift + test $# -eq 0 && { echo "$usage" 1>&2; exit 1; } + dirmode=$1 + shift + ;; + --version) + echo "$0 $scriptversion" + exit 0 + ;; + --) # stop option processing + shift + break + ;; + -*) # unknown option + echo "$usage" 1>&2 + exit 1 + ;; + *) # first non-opt arg + break + ;; + esac +done + +for file +do + if test -d "$file"; then + shift + else + break + fi +done + +case $# in + 0) exit 0 ;; +esac + +# Solaris 8's mkdir -p isn't thread-safe. If you mkdir -p a/b and +# mkdir -p a/c at the same time, both will detect that a is missing, +# one will create a, then the other will try to create a and die with +# a "File exists" error. This is a problem when calling mkinstalldirs +# from a parallel make. We use --version in the probe to restrict +# ourselves to GNU mkdir, which is thread-safe. +case $dirmode in + '') + if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then + echo "mkdir -p -- $*" + exec mkdir -p -- "$@" + else + # On NextStep and OpenStep, the `mkdir' command does not + # recognize any option. It will interpret all options as + # directories to create, and then abort because `.' already + # exists. + test -d ./-p && rmdir ./-p + test -d ./--version && rmdir ./--version + fi + ;; + *) + if mkdir -m "$dirmode" -p --version . >/dev/null 2>&1 && + test ! -d ./--version; then + echo "mkdir -m $dirmode -p -- $*" + exec mkdir -m "$dirmode" -p -- "$@" + else + # Clean up after NextStep and OpenStep mkdir. + for d in ./-m ./-p ./--version "./$dirmode"; + do + test -d $d && rmdir $d + done + fi + ;; +esac + +for file +do + set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` + shift + + pathcomp= + for d + do + pathcomp="$pathcomp$d" + case $pathcomp in + -*) pathcomp=./$pathcomp ;; + esac + + if test ! -d "$pathcomp"; then + echo "mkdir $pathcomp" + + mkdir "$pathcomp" || lasterr=$? + + if test ! -d "$pathcomp"; then + errstatus=$lasterr + else + if test ! -z "$dirmode"; then + echo "chmod $dirmode $pathcomp" + lasterr="" + chmod "$dirmode" "$pathcomp" || lasterr=$? + + if test ! -z "$lasterr"; then + errstatus=$lasterr + fi + fi + fi + fi + + pathcomp="$pathcomp/" + done +done + +exit $errstatus + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/usr/src/grub/grub-0.97/netboot/3c595.c b/usr/src/grub/grub-0.97/netboot/3c595.c new file mode 100644 index 0000000000..70894ea969 --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/3c595.c @@ -0,0 +1,550 @@ +/* +* 3c595.c -- 3COM 3C595 Fast Etherlink III PCI driver for etherboot +* +* Copyright (C) 2000 Shusuke Nisiyama +* All rights reserved. +* Mar. 14, 2000 +* +* This software may be used, modified, copied, distributed, and sold, in +* both source and binary form provided that the above copyright and these +* terms are retained. Under no circumstances are the authors responsible for +* the proper functioning of this software, nor do the authors assume any +* responsibility for damages incurred with its use. +* +* This code is based on Martin Renters' etherboot-4.4.3 3c509.c and +* Herb Peyerl's FreeBSD 3.4-RELEASE if_vx.c driver. +* +* Copyright (C) 1993-1994, David Greenman, Martin Renters. +* Copyright (C) 1993-1995, Andres Vega Garcia. +* Copyright (C) 1995, Serge Babkin. +* +* Copyright (c) 1994 Herb Peyerl +* +* timlegge 08-24-2003 Add Multicast Support +*/ + +/* #define EDEBUG */ + +#include "etherboot.h" +#include "nic.h" +#include "pci.h" +#include "3c595.h" +#include "timer.h" + +static unsigned short eth_nic_base; +static unsigned short vx_connector, vx_connectors; + +static struct connector_entry { + int bit; + char *name; +} conn_tab[VX_CONNECTORS] = { +#define CONNECTOR_UTP 0 + { 0x08, "utp"}, +#define CONNECTOR_AUI 1 + { 0x20, "aui"}, +/* dummy */ + { 0, "???"}, +#define CONNECTOR_BNC 3 + { 0x10, "bnc"}, +#define CONNECTOR_TX 4 + { 0x02, "tx"}, +#define CONNECTOR_FX 5 + { 0x04, "fx"}, +#define CONNECTOR_MII 6 + { 0x40, "mii"}, + { 0, "???"} +}; + +static void vxgetlink(void); +static void vxsetlink(void); + +/************************************************************************** +ETH_RESET - Reset adapter +***************************************************************************/ +static void t595_reset(struct nic *nic) +{ + int i; + + /*********************************************************** + Reset 3Com 595 card + *************************************************************/ + + /* stop card */ + outw(RX_DISABLE, BASE + VX_COMMAND); + outw(RX_DISCARD_TOP_PACK, BASE + VX_COMMAND); + VX_BUSY_WAIT; + outw(TX_DISABLE, BASE + VX_COMMAND); + outw(STOP_TRANSCEIVER, BASE + VX_COMMAND); + udelay(8000); + outw(RX_RESET, BASE + VX_COMMAND); + VX_BUSY_WAIT; + outw(TX_RESET, BASE + VX_COMMAND); + VX_BUSY_WAIT; + outw(C_INTR_LATCH, BASE + VX_COMMAND); + outw(SET_RD_0_MASK, BASE + VX_COMMAND); + outw(SET_INTR_MASK, BASE + VX_COMMAND); + outw(SET_RX_FILTER, BASE + VX_COMMAND); + + /* + * initialize card + */ + VX_BUSY_WAIT; + + GO_WINDOW(0); + + /* Disable the card */ +/* outw(0, BASE + VX_W0_CONFIG_CTRL); */ + + /* Configure IRQ to none */ +/* outw(SET_IRQ(0), BASE + VX_W0_RESOURCE_CFG); */ + + /* Enable the card */ +/* outw(ENABLE_DRQ_IRQ, BASE + VX_W0_CONFIG_CTRL); */ + + GO_WINDOW(2); + + /* Reload the ether_addr. */ + for (i = 0; i < ETH_ALEN; i++) + outb(nic->node_addr[i], BASE + VX_W2_ADDR_0 + i); + + outw(RX_RESET, BASE + VX_COMMAND); + VX_BUSY_WAIT; + outw(TX_RESET, BASE + VX_COMMAND); + VX_BUSY_WAIT; + + /* Window 1 is operating window */ + GO_WINDOW(1); + for (i = 0; i < 31; i++) + inb(BASE + VX_W1_TX_STATUS); + + outw(SET_RD_0_MASK | S_CARD_FAILURE | S_RX_COMPLETE | + S_TX_COMPLETE | S_TX_AVAIL, BASE + VX_COMMAND); + outw(SET_INTR_MASK | S_CARD_FAILURE | S_RX_COMPLETE | + S_TX_COMPLETE | S_TX_AVAIL, BASE + VX_COMMAND); + +/* + * Attempt to get rid of any stray interrupts that occured during + * configuration. On the i386 this isn't possible because one may + * already be queued. However, a single stray interrupt is + * unimportant. + */ + + outw(ACK_INTR | 0xff, BASE + VX_COMMAND); + + outw(SET_RX_FILTER | FIL_INDIVIDUAL | + FIL_BRDCST|FIL_MULTICAST, BASE + VX_COMMAND); + + vxsetlink(); +/*{ + int i,j; + i = CONNECTOR_TX; + GO_WINDOW(3); + j = inl(BASE + VX_W3_INTERNAL_CFG) & ~INTERNAL_CONNECTOR_MASK; + outl(BASE + VX_W3_INTERNAL_CFG, j | (i < ETH_FRAME_LEN) { + return; + } + + /* drop acknowledgements */ + while(( status=inb(BASE + VX_W1_TX_STATUS) )& TXS_COMPLETE ) { + if(status & (TXS_UNDERRUN|TXS_MAX_COLLISION|TXS_STATUS_OVERFLOW)) { + outw(TX_RESET, BASE + VX_COMMAND); + outw(TX_ENABLE, BASE + VX_COMMAND); + } + + outb(0x0, BASE + VX_W1_TX_STATUS); + } + + while (inw(BASE + VX_W1_FREE_TX) < len + pad + 4) { + /* no room in FIFO */ + } + + outw(len, BASE + VX_W1_TX_PIO_WR_1); + outw(0x0, BASE + VX_W1_TX_PIO_WR_1); /* Second dword meaningless */ + + /* write packet */ + outsw(BASE + VX_W1_TX_PIO_WR_1, d, ETH_ALEN/2); + outsw(BASE + VX_W1_TX_PIO_WR_1, nic->node_addr, ETH_ALEN/2); + outw(t, BASE + VX_W1_TX_PIO_WR_1); + outsw(BASE + VX_W1_TX_PIO_WR_1, p, s / 2); + if (s & 1) + outb(*(p+s - 1), BASE + VX_W1_TX_PIO_WR_1); + + while (pad--) + outb(0, BASE + VX_W1_TX_PIO_WR_1); /* Padding */ + + /* wait for Tx complete */ + while((inw(BASE + VX_STATUS) & S_COMMAND_IN_PROGRESS) != 0) + ; +} + +/************************************************************************** +ETH_POLL - Wait for a frame +***************************************************************************/ +static int t595_poll(struct nic *nic, int retrieve) +{ + /* common variables */ + /* variables for 3C595 */ + short status, cst; + register short rx_fifo; + + cst=inw(BASE + VX_STATUS); + +#ifdef EDEBUG + if(cst & 0x1FFF) + printf("-%hX-",cst); +#endif + + if( (cst & S_RX_COMPLETE)==0 ) { + /* acknowledge everything */ + outw(ACK_INTR | cst, BASE + VX_COMMAND); + outw(C_INTR_LATCH, BASE + VX_COMMAND); + + return 0; + } + + status = inw(BASE + VX_W1_RX_STATUS); +#ifdef EDEBUG + printf("*%hX*",status); +#endif + + if (status & ERR_RX) { + outw(RX_DISCARD_TOP_PACK, BASE + VX_COMMAND); + return 0; + } + + rx_fifo = status & RX_BYTES_MASK; + if (rx_fifo==0) + return 0; + + if ( ! retrieve ) return 1; + + /* read packet */ +#ifdef EDEBUG + printf("[l=%d",rx_fifo); +#endif + insw(BASE + VX_W1_RX_PIO_RD_1, nic->packet, rx_fifo / 2); + if(rx_fifo & 1) + nic->packet[rx_fifo-1]=inb(BASE + VX_W1_RX_PIO_RD_1); + nic->packetlen=rx_fifo; + + while(1) { + status = inw(BASE + VX_W1_RX_STATUS); +#ifdef EDEBUG + printf("*%hX*",status); +#endif + rx_fifo = status & RX_BYTES_MASK; + + if(rx_fifo>0) { + insw(BASE + VX_W1_RX_PIO_RD_1, nic->packet+nic->packetlen, rx_fifo / 2); + if(rx_fifo & 1) + nic->packet[nic->packetlen+rx_fifo-1]=inb(BASE + VX_W1_RX_PIO_RD_1); + nic->packetlen+=rx_fifo; +#ifdef EDEBUG + printf("+%d",rx_fifo); +#endif + } + if(( status & RX_INCOMPLETE )==0) { +#ifdef EDEBUG + printf("=%d",nic->packetlen); +#endif + break; + } + udelay(1000); + } + + /* acknowledge reception of packet */ + outw(RX_DISCARD_TOP_PACK, BASE + VX_COMMAND); + while (inw(BASE + VX_STATUS) & S_COMMAND_IN_PROGRESS); +#ifdef EDEBUG +{ + unsigned short type = 0; /* used by EDEBUG */ + type = (nic->packet[12]<<8) | nic->packet[13]; + if(nic->packet[0]+nic->packet[1]+nic->packet[2]+nic->packet[3]+nic->packet[4]+ + nic->packet[5] == 0xFF*ETH_ALEN) + printf(",t=%hX,b]",type); + else + printf(",t=%hX]",type); +} +#endif + return 1; +} + + +/************************************************************************* + 3Com 595 - specific routines +**************************************************************************/ + +static int +eeprom_rdy() +{ + int i; + + for (i = 0; is_eeprom_busy(BASE) && i < MAX_EEPROMBUSY; i++) + udelay(1000); + if (i >= MAX_EEPROMBUSY) { + /* printf("3c595: eeprom failed to come ready.\n"); */ + printf("3c595: eeprom is busy.\n"); /* memory in EPROM is tight */ + return (0); + } + return (1); +} + +/* + * get_e: gets a 16 bits word from the EEPROM. we must have set the window + * before + */ +static int +get_e(offset) +int offset; +{ + if (!eeprom_rdy()) + return (0xffff); + outw(EEPROM_CMD_RD | offset, BASE + VX_W0_EEPROM_COMMAND); + if (!eeprom_rdy()) + return (0xffff); + return (inw(BASE + VX_W0_EEPROM_DATA)); +} + +static void +vxgetlink(void) +{ + int n, k; + + GO_WINDOW(3); + vx_connectors = inw(BASE + VX_W3_RESET_OPT) & 0x7f; + for (n = 0, k = 0; k < VX_CONNECTORS; k++) { + if (vx_connectors & conn_tab[k].bit) { + if (n > 0) { + printf("/"); + } + printf(conn_tab[k].name); + n++; + } + } + if (vx_connectors == 0) { + printf("no connectors!"); + return; + } + GO_WINDOW(3); + vx_connector = (inl(BASE + VX_W3_INTERNAL_CFG) + & INTERNAL_CONNECTOR_MASK) + >> INTERNAL_CONNECTOR_BITS; + if (vx_connector & 0x10) { + vx_connector &= 0x0f; + printf("[*%s*]", conn_tab[vx_connector].name); + printf(": disable 'auto select' with DOS util!"); + } else { + printf("[*%s*]", conn_tab[vx_connector].name); + } +} + +static void +vxsetlink(void) +{ + int i, j; + char *reason, *warning; + static char prev_conn = -1; + + if (prev_conn == -1) { + prev_conn = vx_connector; + } + + i = vx_connector; /* default in EEPROM */ + reason = "default"; + warning = 0; + + if ((vx_connectors & conn_tab[vx_connector].bit) == 0) { + warning = "strange connector type in EEPROM."; + reason = "forced"; + i = CONNECTOR_UTP; + } + + if (warning != 0) { + printf("warning: %s\n", warning); + } + printf("selected %s. (%s)\n", conn_tab[i].name, reason); + + /* Set the selected connector. */ + GO_WINDOW(3); + j = inl(BASE + VX_W3_INTERNAL_CFG) & ~INTERNAL_CONNECTOR_MASK; + outl(j | (i <ioaddr == 0) + return 0; +/* eth_nic_base = probeaddrs[0] & ~3; */ + eth_nic_base = pci->ioaddr; + + nic->irqno = 0; + nic->ioaddr = pci->ioaddr & ~3; + + GO_WINDOW(0); + outw(GLOBAL_RESET, BASE + VX_COMMAND); + VX_BUSY_WAIT; + + vxgetlink(); + +/* + printf("\nEEPROM:"); + for (i = 0; i < (EEPROMSIZE/2); i++) { + printf("%hX:", get_e(i)); + } + printf("\n"); +*/ + /* + * Read the station address from the eeprom + */ + p = (unsigned short *) nic->node_addr; + for (i = 0; i < 3; i++) { + GO_WINDOW(0); + p[i] = htons(get_e(EEPROM_OEM_ADDR_0 + i)); + GO_WINDOW(2); + outw(ntohs(p[i]), BASE + VX_W2_ADDR_0 + (i * 2)); + } + + printf("Ethernet address: %!\n", nic->node_addr); + + t595_reset(nic); + dev->disable = t595_disable; + nic->poll = t595_poll; + nic->transmit = t595_transmit; + nic->irq = t595_irq; + return 1; + +} + +static struct pci_id t595_nics[] = { +PCI_ROM(0x10b7, 0x5900, "3c590", "3Com590"), /* Vortex 10Mbps */ +PCI_ROM(0x10b7, 0x5950, "3c595", "3Com595"), /* Vortex 100baseTx */ +PCI_ROM(0x10b7, 0x5951, "3c595-1", "3Com595"), /* Vortex 100baseT4 */ +PCI_ROM(0x10b7, 0x5952, "3c595-2", "3Com595"), /* Vortex 100base-MII */ +PCI_ROM(0x10b7, 0x9000, "3c900-tpo", "3Com900-TPO"), /* 10 Base TPO */ +PCI_ROM(0x10b7, 0x9001, "3c900-t4", "3Com900-Combo"), /* 10/100 T4 */ +PCI_ROM(0x10b7, 0x9004, "3c900b-tpo", "3Com900B-TPO"), /* 10 Base TPO */ +PCI_ROM(0x10b7, 0x9005, "3c900b-combo", "3Com900B-Combo"), /* 10 Base Combo */ +PCI_ROM(0x10b7, 0x9006, "3c900b-tpb2", "3Com900B-2/T"), /* 10 Base TP and Base2 */ +PCI_ROM(0x10b7, 0x900a, "3c900b-fl", "3Com900B-FL"), /* 10 Base F */ +PCI_ROM(0x10b7, 0x9800, "3c980-cyclone-1", "3Com980-Cyclone"), /* Cyclone */ +PCI_ROM(0x10b7, 0x9805, "3c9805-1", "3Com9805"), /* Dual Port Server Cyclone */ +PCI_ROM(0x10b7, 0x7646, "3csoho100-tx-1", "3CSOHO100-TX"), /* Hurricane */ +PCI_ROM(0x10b7, 0x4500, "3c450-1", "3Com450 HomePNA Tornado"), +}; + +struct pci_driver t595_driver = { + .type = NIC_DRIVER, + .name = "3C595", + .probe = t595_probe, + .ids = t595_nics, + .id_count = sizeof(t595_nics)/sizeof(t595_nics[0]), + .class = 0, +}; + +/* + * Local variables: + * c-basic-offset: 8 + * End: + */ + diff --git a/usr/src/grub/grub-0.97/netboot/3c595.h b/usr/src/grub/grub-0.97/netboot/3c595.h new file mode 100644 index 0000000000..49d8d9b049 --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/3c595.h @@ -0,0 +1,435 @@ +/* + * Copyright (c) 1993 Herb Peyerl (hpeyerl@novatel.ca) 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. 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. + * + October 2, 1994 + + Modified by: Andres Vega Garcia + + INRIA - Sophia Antipolis, France + e-mail: avega@sophia.inria.fr + finger: avega@pax.inria.fr + + */ + +/* + * Created from if_epreg.h by Fred Gray (fgray@rice.edu) to support the + * 3c590 family. + */ + +/* + * Modified by Shusuke Nisiyama + * for etherboot + * Mar. 14, 2000 +*/ + +/* + * Ethernet software status per interface. + */ + +/* + * Some global constants + */ + +#define TX_INIT_RATE 16 +#define TX_INIT_MAX_RATE 64 +#define RX_INIT_LATENCY 64 +#define RX_INIT_EARLY_THRESH 64 +#define MIN_RX_EARLY_THRESHF 16 /* not less than ether_header */ +#define MIN_RX_EARLY_THRESHL 4 + +#define EEPROMSIZE 0x40 +#define MAX_EEPROMBUSY 1000 +#define VX_LAST_TAG 0xd7 +#define VX_MAX_BOARDS 16 +#define VX_ID_PORT 0x100 + +/* + * some macros to acces long named fields + */ +#define BASE (eth_nic_base) + +/* + * Commands to read/write EEPROM trough EEPROM command register (Window 0, + * Offset 0xa) + */ +#define EEPROM_CMD_RD 0x0080 /* Read: Address required (5 bits) */ +#define EEPROM_CMD_WR 0x0040 /* Write: Address required (5 bits) */ +#define EEPROM_CMD_ERASE 0x00c0 /* Erase: Address required (5 bits) */ +#define EEPROM_CMD_EWEN 0x0030 /* Erase/Write Enable: No data required */ + +#define EEPROM_BUSY (1<<15) + +/* + * Some short functions, worth to let them be a macro + */ + +/************************************************************************** + * * + * These define the EEPROM data structure. They are used in the probe + * function to verify the existence of the adapter after having sent + * the ID_Sequence. + * + * There are others but only the ones we use are defined here. + * + **************************************************************************/ + +#define EEPROM_NODE_ADDR_0 0x0 /* Word */ +#define EEPROM_NODE_ADDR_1 0x1 /* Word */ +#define EEPROM_NODE_ADDR_2 0x2 /* Word */ +#define EEPROM_PROD_ID 0x3 /* 0x9[0-f]50 */ +#define EEPROM_MFG_ID 0x7 /* 0x6d50 */ +#define EEPROM_ADDR_CFG 0x8 /* Base addr */ +#define EEPROM_RESOURCE_CFG 0x9 /* IRQ. Bits 12-15 */ +#define EEPROM_OEM_ADDR_0 0xa /* Word */ +#define EEPROM_OEM_ADDR_1 0xb /* Word */ +#define EEPROM_OEM_ADDR_2 0xc /* Word */ +#define EEPROM_SOFT_INFO_2 0xf /* Software information 2 */ + +#define NO_RX_OVN_ANOMALY (1<<5) + +/************************************************************************** + * * + * These are the registers for the 3Com 3c509 and their bit patterns when * + * applicable. They have been taken out the the "EtherLink III Parallel * + * Tasking EISA and ISA Technical Reference" "Beta Draft 10/30/92" manual * + * from 3com. * + * * + **************************************************************************/ + +#define VX_COMMAND 0x0e /* Write. BASE+0x0e is always a + * command reg. */ +#define VX_STATUS 0x0e /* Read. BASE+0x0e is always status + * reg. */ +#define VX_WINDOW 0x0f /* Read. BASE+0x0f is always window + * reg. */ +/* + * Window 0 registers. Setup. + */ +/* Write */ +#define VX_W0_EEPROM_DATA 0x0c +#define VX_W0_EEPROM_COMMAND 0x0a +#define VX_W0_RESOURCE_CFG 0x08 +#define VX_W0_ADDRESS_CFG 0x06 +#define VX_W0_CONFIG_CTRL 0x04 + /* Read */ +#define VX_W0_PRODUCT_ID 0x02 +#define VX_W0_MFG_ID 0x00 + + +/* + * Window 1 registers. Operating Set. + */ +/* Write */ +#define VX_W1_TX_PIO_WR_2 0x02 +#define VX_W1_TX_PIO_WR_1 0x00 +/* Read */ +#define VX_W1_FREE_TX 0x0c +#define VX_W1_TX_STATUS 0x0b /* byte */ +#define VX_W1_TIMER 0x0a /* byte */ +#define VX_W1_RX_STATUS 0x08 +#define VX_W1_RX_PIO_RD_2 0x02 +#define VX_W1_RX_PIO_RD_1 0x00 + +/* + * Window 2 registers. Station Address Setup/Read + */ +/* Read/Write */ +#define VX_W2_ADDR_5 0x05 +#define VX_W2_ADDR_4 0x04 +#define VX_W2_ADDR_3 0x03 +#define VX_W2_ADDR_2 0x02 +#define VX_W2_ADDR_1 0x01 +#define VX_W2_ADDR_0 0x00 + +/* + * Window 3 registers. FIFO Management. + */ +/* Read */ +#define VX_W3_INTERNAL_CFG 0x00 +#define VX_W3_RESET_OPT 0x08 +#define VX_W3_FREE_TX 0x0c +#define VX_W3_FREE_RX 0x0a + +/* + * Window 4 registers. Diagnostics. + */ +/* Read/Write */ +#define VX_W4_MEDIA_TYPE 0x0a +#define VX_W4_CTRLR_STATUS 0x08 +#define VX_W4_NET_DIAG 0x06 +#define VX_W4_FIFO_DIAG 0x04 +#define VX_W4_HOST_DIAG 0x02 +#define VX_W4_TX_DIAG 0x00 + +/* + * Window 5 Registers. Results and Internal status. + */ +/* Read */ +#define VX_W5_READ_0_MASK 0x0c +#define VX_W5_INTR_MASK 0x0a +#define VX_W5_RX_FILTER 0x08 +#define VX_W5_RX_EARLY_THRESH 0x06 +#define VX_W5_TX_AVAIL_THRESH 0x02 +#define VX_W5_TX_START_THRESH 0x00 + +/* + * Window 6 registers. Statistics. + */ +/* Read/Write */ +#define TX_TOTAL_OK 0x0c +#define RX_TOTAL_OK 0x0a +#define TX_DEFERRALS 0x08 +#define RX_FRAMES_OK 0x07 +#define TX_FRAMES_OK 0x06 +#define RX_OVERRUNS 0x05 +#define TX_COLLISIONS 0x04 +#define TX_AFTER_1_COLLISION 0x03 +#define TX_AFTER_X_COLLISIONS 0x02 +#define TX_NO_SQE 0x01 +#define TX_CD_LOST 0x00 + +/**************************************** + * + * Register definitions. + * + ****************************************/ + +/* + * Command register. All windows. + * + * 16 bit register. + * 15-11: 5-bit code for command to be executed. + * 10-0: 11-bit arg if any. For commands with no args; + * this can be set to anything. + */ +#define GLOBAL_RESET (unsigned short) 0x0000 /* Wait at least 1ms + * after issuing */ +#define WINDOW_SELECT (unsigned short) (0x1<<11) +#define START_TRANSCEIVER (unsigned short) (0x2<<11) /* Read ADDR_CFG reg to + * determine whether + * this is needed. If + * so; wait 800 uSec + * before using trans- + * ceiver. */ +#define RX_DISABLE (unsigned short) (0x3<<11) /* state disabled on + * power-up */ +#define RX_ENABLE (unsigned short) (0x4<<11) +#define RX_RESET (unsigned short) (0x5<<11) +#define RX_DISCARD_TOP_PACK (unsigned short) (0x8<<11) +#define TX_ENABLE (unsigned short) (0x9<<11) +#define TX_DISABLE (unsigned short) (0xa<<11) +#define TX_RESET (unsigned short) (0xb<<11) +#define REQ_INTR (unsigned short) (0xc<<11) +/* + * The following C_* acknowledge the various interrupts. Some of them don't + * do anything. See the manual. + */ +#define ACK_INTR (unsigned short) (0x6800) +# define C_INTR_LATCH (unsigned short) (ACK_INTR|0x1) +# define C_CARD_FAILURE (unsigned short) (ACK_INTR|0x2) +# define C_TX_COMPLETE (unsigned short) (ACK_INTR|0x4) +# define C_TX_AVAIL (unsigned short) (ACK_INTR|0x8) +# define C_RX_COMPLETE (unsigned short) (ACK_INTR|0x10) +# define C_RX_EARLY (unsigned short) (ACK_INTR|0x20) +# define C_INT_RQD (unsigned short) (ACK_INTR|0x40) +# define C_UPD_STATS (unsigned short) (ACK_INTR|0x80) +#define SET_INTR_MASK (unsigned short) (0xe<<11) +#define SET_RD_0_MASK (unsigned short) (0xf<<11) +#define SET_RX_FILTER (unsigned short) (0x10<<11) +# define FIL_INDIVIDUAL (unsigned short) (0x1) +# define FIL_MULTICAST (unsigned short) (0x02) +# define FIL_BRDCST (unsigned short) (0x04) +# define FIL_PROMISC (unsigned short) (0x08) +#define SET_RX_EARLY_THRESH (unsigned short) (0x11<<11) +#define SET_TX_AVAIL_THRESH (unsigned short) (0x12<<11) +#define SET_TX_START_THRESH (unsigned short) (0x13<<11) +#define STATS_ENABLE (unsigned short) (0x15<<11) +#define STATS_DISABLE (unsigned short) (0x16<<11) +#define STOP_TRANSCEIVER (unsigned short) (0x17<<11) + +/* + * Status register. All windows. + * + * 15-13: Window number(0-7). + * 12: Command_in_progress. + * 11: reserved. + * 10: reserved. + * 9: reserved. + * 8: reserved. + * 7: Update Statistics. + * 6: Interrupt Requested. + * 5: RX Early. + * 4: RX Complete. + * 3: TX Available. + * 2: TX Complete. + * 1: Adapter Failure. + * 0: Interrupt Latch. + */ +#define S_INTR_LATCH (unsigned short) (0x1) +#define S_CARD_FAILURE (unsigned short) (0x2) +#define S_TX_COMPLETE (unsigned short) (0x4) +#define S_TX_AVAIL (unsigned short) (0x8) +#define S_RX_COMPLETE (unsigned short) (0x10) +#define S_RX_EARLY (unsigned short) (0x20) +#define S_INT_RQD (unsigned short) (0x40) +#define S_UPD_STATS (unsigned short) (0x80) +#define S_COMMAND_IN_PROGRESS (unsigned short) (0x1000) + +#define VX_BUSY_WAIT while (inw(BASE + VX_STATUS) & S_COMMAND_IN_PROGRESS) + +/* Address Config. Register. + * Window 0/Port 06 + */ + +#define ACF_CONNECTOR_BITS 14 +#define ACF_CONNECTOR_UTP 0 +#define ACF_CONNECTOR_AUI 1 +#define ACF_CONNECTOR_BNC 3 + +#define INTERNAL_CONNECTOR_BITS 20 +#define INTERNAL_CONNECTOR_MASK 0x01700000 + +/* + * FIFO Registers. RX Status. + * + * 15: Incomplete or FIFO empty. + * 14: 1: Error in RX Packet 0: Incomplete or no error. + * 13-11: Type of error. + * 1000 = Overrun. + * 1011 = Run Packet Error. + * 1100 = Alignment Error. + * 1101 = CRC Error. + * 1001 = Oversize Packet Error (>1514 bytes) + * 0010 = Dribble Bits. + * (all other error codes, no errors.) + * + * 10-0: RX Bytes (0-1514) + */ +#define ERR_INCOMPLETE (unsigned short) (0x8000) +#define ERR_RX (unsigned short) (0x4000) +#define ERR_MASK (unsigned short) (0x7800) +#define ERR_OVERRUN (unsigned short) (0x4000) +#define ERR_RUNT (unsigned short) (0x5800) +#define ERR_ALIGNMENT (unsigned short) (0x6000) +#define ERR_CRC (unsigned short) (0x6800) +#define ERR_OVERSIZE (unsigned short) (0x4800) +#define ERR_DRIBBLE (unsigned short) (0x1000) + +/* + * TX Status. + * + * Reports the transmit status of a completed transmission. Writing this + * register pops the transmit completion stack. + * + * Window 1/Port 0x0b. + * + * 7: Complete + * 6: Interrupt on successful transmission requested. + * 5: Jabber Error (TP Only, TX Reset required. ) + * 4: Underrun (TX Reset required. ) + * 3: Maximum Collisions. + * 2: TX Status Overflow. + * 1-0: Undefined. + * + */ +#define TXS_COMPLETE 0x80 +#define TXS_INTR_REQ 0x40 +#define TXS_JABBER 0x20 +#define TXS_UNDERRUN 0x10 +#define TXS_MAX_COLLISION 0x8 +#define TXS_STATUS_OVERFLOW 0x4 + +#define RS_AUI (1<<5) +#define RS_BNC (1<<4) +#define RS_UTP (1<<3) +#define RS_T4 (1<<0) +#define RS_TX (1<<1) +#define RS_FX (1<<2) +#define RS_MII (1<<6) + + +/* + * FIFO Status (Window 4) + * + * Supports FIFO diagnostics + * + * Window 4/Port 0x04.1 + * + * 15: 1=RX receiving (RO). Set when a packet is being received + * into the RX FIFO. + * 14: Reserved + * 13: 1=RX underrun (RO). Generates Adapter Failure interrupt. + * Requires RX Reset or Global Reset command to recover. + * It is generated when you read past the end of a packet - + * reading past what has been received so far will give bad + * data. + * 12: 1=RX status overrun (RO). Set when there are already 8 + * packets in the RX FIFO. While this bit is set, no additional + * packets are received. Requires no action on the part of + * the host. The condition is cleared once a packet has been + * read out of the RX FIFO. + * 11: 1=RX overrun (RO). Set when the RX FIFO is full (there + * may not be an overrun packet yet). While this bit is set, + * no additional packets will be received (some additional + * bytes can still be pending between the wire and the RX + * FIFO). Requires no action on the part of the host. The + * condition is cleared once a few bytes have been read out + * from the RX FIFO. + * 10: 1=TX overrun (RO). Generates adapter failure interrupt. + * Requires TX Reset or Global Reset command to recover. + * Disables Transmitter. + * 9-8: Unassigned. + * 7-0: Built in self test bits for the RX and TX FIFO's. + */ +#define FIFOS_RX_RECEIVING (unsigned short) 0x8000 +#define FIFOS_RX_UNDERRUN (unsigned short) 0x2000 +#define FIFOS_RX_STATUS_OVERRUN (unsigned short) 0x1000 +#define FIFOS_RX_OVERRUN (unsigned short) 0x0800 +#define FIFOS_TX_OVERRUN (unsigned short) 0x0400 + +/* + * Misc defines for various things. + */ +#define TAG_ADAPTER 0xd0 +#define ACTIVATE_ADAPTER_TO_CONFIG 0xff +#define ENABLE_DRQ_IRQ 0x0001 +#define MFG_ID 0x506d /* `TCM' */ +#define PROD_ID 0x5090 +#define GO_WINDOW(x) outw(WINDOW_SELECT|(x),BASE+VX_COMMAND) +#define JABBER_GUARD_ENABLE 0x40 +#define LINKBEAT_ENABLE 0x80 +#define ENABLE_UTP (JABBER_GUARD_ENABLE | LINKBEAT_ENABLE) +#define DISABLE_UTP 0x0 +#define RX_BYTES_MASK (unsigned short) (0x07ff) +#define RX_ERROR 0x4000 +#define RX_INCOMPLETE 0x8000 +#define TX_INDICATE 1<<15 +#define is_eeprom_busy(b) (inw((b)+VX_W0_EEPROM_COMMAND)&EEPROM_BUSY) + +#define VX_IOSIZE 0x20 + +#define VX_CONNECTORS 8 + +/* + * Local variables: + * c-basic-offset: 8 + * End: + */ diff --git a/usr/src/grub/grub-0.97/netboot/3c90x.c b/usr/src/grub/grub-0.97/netboot/3c90x.c new file mode 100644 index 0000000000..2a11e6e8c0 --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/3c90x.c @@ -0,0 +1,995 @@ +/* + * 3c90x.c -- This file implements the 3c90x driver for etherboot. Written + * by Greg Beeley, Greg.Beeley@LightSys.org. Modified by Steve Smith, + * Steve.Smith@Juno.Com. Alignment bug fix Neil Newell (nn@icenoir.net). + * + * This program Copyright (C) 1999 LightSys Technology Services, Inc. + * Portions Copyright (C) 1999 Steve Smith + * + * This program may be re-distributed in source or binary form, modified, + * sold, or copied for any purpose, provided that the above copyright message + * and this text are included with all source copies or derivative works, and + * provided that the above copyright message and this text are included in the + * documentation of any binary-only distributions. This program is distributed + * WITHOUT ANY WARRANTY, without even the warranty of FITNESS FOR A PARTICULAR + * PURPOSE or MERCHANTABILITY. Please read the associated documentation + * "3c90x.txt" before compiling and using this driver. + * + * -------- + * + * Program written with the assistance of the 3com documentation for + * the 3c905B-TX card, as well as with some assistance from the 3c59x + * driver Donald Becker wrote for the Linux kernel, and with some assistance + * from the remainder of the Etherboot distribution. + * + * REVISION HISTORY: + * + * v0.10 1-26-1998 GRB Initial implementation. + * v0.90 1-27-1998 GRB System works. + * v1.00pre1 2-11-1998 GRB Got prom boot issue fixed. + * v2.0 9-24-1999 SCS Modified for 3c905 (from 3c905b code) + * Re-wrote poll and transmit for + * better error recovery and heavy + * network traffic operation + * v2.01 5-26-2003 NN Fixed driver alignment issue which + * caused system lockups if driver structures + * not 8-byte aligned. + * + */ + +#include "etherboot.h" +#include "nic.h" +#include "pci.h" +#include "timer.h" + +#define XCVR_MAGIC (0x5A00) +/** any single transmission fails after 16 collisions or other errors + ** this is the number of times to retry the transmission -- this should + ** be plenty + **/ +#define XMIT_RETRIES 250 + +/*** Register definitions for the 3c905 ***/ +enum Registers + { + regPowerMgmtCtrl_w = 0x7c, /** 905B Revision Only **/ + regUpMaxBurst_w = 0x7a, /** 905B Revision Only **/ + regDnMaxBurst_w = 0x78, /** 905B Revision Only **/ + regDebugControl_w = 0x74, /** 905B Revision Only **/ + regDebugData_l = 0x70, /** 905B Revision Only **/ + regRealTimeCnt_l = 0x40, /** Universal **/ + regUpBurstThresh_b = 0x3e, /** 905B Revision Only **/ + regUpPoll_b = 0x3d, /** 905B Revision Only **/ + regUpPriorityThresh_b = 0x3c, /** 905B Revision Only **/ + regUpListPtr_l = 0x38, /** Universal **/ + regCountdown_w = 0x36, /** Universal **/ + regFreeTimer_w = 0x34, /** Universal **/ + regUpPktStatus_l = 0x30, /** Universal with Exception, pg 130 **/ + regTxFreeThresh_b = 0x2f, /** 90X Revision Only **/ + regDnPoll_b = 0x2d, /** 905B Revision Only **/ + regDnPriorityThresh_b = 0x2c, /** 905B Revision Only **/ + regDnBurstThresh_b = 0x2a, /** 905B Revision Only **/ + regDnListPtr_l = 0x24, /** Universal with Exception, pg 107 **/ + regDmaCtrl_l = 0x20, /** Universal with Exception, pg 106 **/ + /** **/ + regIntStatusAuto_w = 0x1e, /** 905B Revision Only **/ + regTxStatus_b = 0x1b, /** Universal with Exception, pg 113 **/ + regTimer_b = 0x1a, /** Universal **/ + regTxPktId_b = 0x18, /** 905B Revision Only **/ + regCommandIntStatus_w = 0x0e, /** Universal (Command Variations) **/ + }; + +/** following are windowed registers **/ +enum Registers7 + { + regPowerMgmtEvent_7_w = 0x0c, /** 905B Revision Only **/ + regVlanEtherType_7_w = 0x04, /** 905B Revision Only **/ + regVlanMask_7_w = 0x00, /** 905B Revision Only **/ + }; + +enum Registers6 + { + regBytesXmittedOk_6_w = 0x0c, /** Universal **/ + regBytesRcvdOk_6_w = 0x0a, /** Universal **/ + regUpperFramesOk_6_b = 0x09, /** Universal **/ + regFramesDeferred_6_b = 0x08, /** Universal **/ + regFramesRecdOk_6_b = 0x07, /** Universal with Exceptions, pg 142 **/ + regFramesXmittedOk_6_b = 0x06, /** Universal **/ + regRxOverruns_6_b = 0x05, /** Universal **/ + regLateCollisions_6_b = 0x04, /** Universal **/ + regSingleCollisions_6_b = 0x03, /** Universal **/ + regMultipleCollisions_6_b = 0x02, /** Universal **/ + regSqeErrors_6_b = 0x01, /** Universal **/ + regCarrierLost_6_b = 0x00, /** Universal **/ + }; + +enum Registers5 + { + regIndicationEnable_5_w = 0x0c, /** Universal **/ + regInterruptEnable_5_w = 0x0a, /** Universal **/ + regTxReclaimThresh_5_b = 0x09, /** 905B Revision Only **/ + regRxFilter_5_b = 0x08, /** Universal **/ + regRxEarlyThresh_5_w = 0x06, /** Universal **/ + regTxStartThresh_5_w = 0x00, /** Universal **/ + }; + +enum Registers4 + { + regUpperBytesOk_4_b = 0x0d, /** Universal **/ + regBadSSD_4_b = 0x0c, /** Universal **/ + regMediaStatus_4_w = 0x0a, /** Universal with Exceptions, pg 201 **/ + regPhysicalMgmt_4_w = 0x08, /** Universal **/ + regNetworkDiagnostic_4_w = 0x06, /** Universal with Exceptions, pg 203 **/ + regFifoDiagnostic_4_w = 0x04, /** Universal with Exceptions, pg 196 **/ + regVcoDiagnostic_4_w = 0x02, /** Undocumented? **/ + }; + +enum Registers3 + { + regTxFree_3_w = 0x0c, /** Universal **/ + regRxFree_3_w = 0x0a, /** Universal with Exceptions, pg 125 **/ + regResetMediaOptions_3_w = 0x08, /** Media Options on B Revision, **/ + /** Reset Options on Non-B Revision **/ + regMacControl_3_w = 0x06, /** Universal with Exceptions, pg 199 **/ + regMaxPktSize_3_w = 0x04, /** 905B Revision Only **/ + regInternalConfig_3_l = 0x00, /** Universal, different bit **/ + /** definitions, pg 59 **/ + }; + +enum Registers2 + { + regResetOptions_2_w = 0x0c, /** 905B Revision Only **/ + regStationMask_2_3w = 0x06, /** Universal with Exceptions, pg 127 **/ + regStationAddress_2_3w = 0x00, /** Universal with Exceptions, pg 127 **/ + }; + +enum Registers1 + { + regRxStatus_1_w = 0x0a, /** 90X Revision Only, Pg 126 **/ + }; + +enum Registers0 + { + regEepromData_0_w = 0x0c, /** Universal **/ + regEepromCommand_0_w = 0x0a, /** Universal **/ + regBiosRomData_0_b = 0x08, /** 905B Revision Only **/ + regBiosRomAddr_0_l = 0x04, /** 905B Revision Only **/ + }; + + +/*** The names for the eight register windows ***/ +enum Windows + { + winPowerVlan7 = 0x07, + winStatistics6 = 0x06, + winTxRxControl5 = 0x05, + winDiagnostics4 = 0x04, + winTxRxOptions3 = 0x03, + winAddressing2 = 0x02, + winUnused1 = 0x01, + winEepromBios0 = 0x00, + }; + + +/*** Command definitions for the 3c90X ***/ +enum Commands + { + cmdGlobalReset = 0x00, /** Universal with Exceptions, pg 151 **/ + cmdSelectRegisterWindow = 0x01, /** Universal **/ + cmdEnableDcConverter = 0x02, /** **/ + cmdRxDisable = 0x03, /** **/ + cmdRxEnable = 0x04, /** Universal **/ + cmdRxReset = 0x05, /** Universal **/ + cmdStallCtl = 0x06, /** Universal **/ + cmdTxEnable = 0x09, /** Universal **/ + cmdTxDisable = 0x0A, /** **/ + cmdTxReset = 0x0B, /** Universal **/ + cmdRequestInterrupt = 0x0C, /** **/ + cmdAcknowledgeInterrupt = 0x0D, /** Universal **/ + cmdSetInterruptEnable = 0x0E, /** Universal **/ + cmdSetIndicationEnable = 0x0F, /** Universal **/ + cmdSetRxFilter = 0x10, /** Universal **/ + cmdSetRxEarlyThresh = 0x11, /** **/ + cmdSetTxStartThresh = 0x13, /** **/ + cmdStatisticsEnable = 0x15, /** **/ + cmdStatisticsDisable = 0x16, /** **/ + cmdDisableDcConverter = 0x17, /** **/ + cmdSetTxReclaimThresh = 0x18, /** **/ + cmdSetHashFilterBit = 0x19, /** **/ + }; + + +/*** Values for int status register bitmask **/ +#define INT_INTERRUPTLATCH (1<<0) +#define INT_HOSTERROR (1<<1) +#define INT_TXCOMPLETE (1<<2) +#define INT_RXCOMPLETE (1<<4) +#define INT_RXEARLY (1<<5) +#define INT_INTREQUESTED (1<<6) +#define INT_UPDATESTATS (1<<7) +#define INT_LINKEVENT (1<<8) +#define INT_DNCOMPLETE (1<<9) +#define INT_UPCOMPLETE (1<<10) +#define INT_CMDINPROGRESS (1<<12) +#define INT_WINDOWNUMBER (7<<13) + + +/*** TX descriptor ***/ +typedef struct + { + unsigned int DnNextPtr; + unsigned int FrameStartHeader; + unsigned int HdrAddr; + unsigned int HdrLength; + unsigned int DataAddr; + unsigned int DataLength; + } + TXD __attribute__ ((aligned(8))); /* 64-bit aligned for bus mastering */ + +/*** RX descriptor ***/ +typedef struct + { + unsigned int UpNextPtr; + unsigned int UpPktStatus; + unsigned int DataAddr; + unsigned int DataLength; + } + RXD __attribute__ ((aligned(8))); /* 64-bit aligned for bus mastering */ + +/*** Global variables ***/ +static struct + { + unsigned char isBrev; + unsigned char CurrentWindow; + unsigned int IOAddr; + unsigned char HWAddr[ETH_ALEN]; + TXD TransmitDPD; + RXD ReceiveUPD; + } + INF_3C90X; + + +/*** a3c90x_internal_IssueCommand: sends a command to the 3c90x card + ***/ +static int +a3c90x_internal_IssueCommand(int ioaddr, int cmd, int param) + { + unsigned int val; + + /** Build the cmd. **/ + val = cmd; + val <<= 11; + val |= param; + + /** Send the cmd to the cmd register **/ + outw(val, ioaddr + regCommandIntStatus_w); + + /** Wait for the cmd to complete, if necessary **/ + while (inw(ioaddr + regCommandIntStatus_w) & INT_CMDINPROGRESS); + + return 0; + } + + +/*** a3c90x_internal_SetWindow: selects a register window set. + ***/ +static int +a3c90x_internal_SetWindow(int ioaddr, int window) + { + + /** Window already as set? **/ + if (INF_3C90X.CurrentWindow == window) return 0; + + /** Issue the window command. **/ + a3c90x_internal_IssueCommand(ioaddr, cmdSelectRegisterWindow, window); + INF_3C90X.CurrentWindow = window; + + return 0; + } + + +/*** a3c90x_internal_ReadEeprom - read data from the serial eeprom. + ***/ +static unsigned short +a3c90x_internal_ReadEeprom(int ioaddr, int address) + { + unsigned short val; + + /** Select correct window **/ + a3c90x_internal_SetWindow(INF_3C90X.IOAddr, winEepromBios0); + + /** Make sure the eeprom isn't busy **/ + while((1<<15) & inw(ioaddr + regEepromCommand_0_w)); + + /** Read the value. **/ + outw(address + ((0x02)<<6), ioaddr + regEepromCommand_0_w); + while((1<<15) & inw(ioaddr + regEepromCommand_0_w)); + val = inw(ioaddr + regEepromData_0_w); + + return val; + } + + +#if 0 +/*** a3c90x_internal_WriteEepromWord - write a physical word of + *** data to the onboard serial eeprom (not the BIOS prom, but the + *** nvram in the card that stores, among other things, the MAC + *** address). + ***/ +static int +a3c90x_internal_WriteEepromWord(int ioaddr, int address, unsigned short value) + { + /** Select register window **/ + a3c90x_internal_SetWindow(ioaddr, winEepromBios0); + + /** Verify Eeprom not busy **/ + while((1<<15) & inw(ioaddr + regEepromCommand_0_w)); + + /** Issue WriteEnable, and wait for completion. **/ + outw(0x30, ioaddr + regEepromCommand_0_w); + while((1<<15) & inw(ioaddr + regEepromCommand_0_w)); + + /** Issue EraseRegister, and wait for completion. **/ + outw(address + ((0x03)<<6), ioaddr + regEepromCommand_0_w); + while((1<<15) & inw(ioaddr + regEepromCommand_0_w)); + + /** Send the new data to the eeprom, and wait for completion. **/ + outw(value, ioaddr + regEepromData_0_w); + outw(0x30, ioaddr + regEepromCommand_0_w); + while((1<<15) & inw(ioaddr + regEepromCommand_0_w)); + + /** Burn the new data into the eeprom, and wait for completion. **/ + outw(address + ((0x01)<<6), ioaddr + regEepromCommand_0_w); + while((1<<15) & inw(ioaddr + regEepromCommand_0_w)); + + return 0; + } +#endif + +#if 0 +/*** a3c90x_internal_WriteEeprom - write data to the serial eeprom, + *** and re-compute the eeprom checksum. + ***/ +static int +a3c90x_internal_WriteEeprom(int ioaddr, int address, unsigned short value) + { + int cksum = 0,v; + int i; + int maxAddress, cksumAddress; + + if (INF_3C90X.isBrev) + { + maxAddress=0x1f; + cksumAddress=0x20; + } + else + { + maxAddress=0x16; + cksumAddress=0x17; + } + + /** Write the value. **/ + if (a3c90x_internal_WriteEepromWord(ioaddr, address, value) == -1) + return -1; + + /** Recompute the checksum. **/ + for(i=0;i<=maxAddress;i++) + { + v = a3c90x_internal_ReadEeprom(ioaddr, i); + cksum ^= (v & 0xFF); + cksum ^= ((v>>8) & 0xFF); + } + /** Write the checksum to the location in the eeprom **/ + if (a3c90x_internal_WriteEepromWord(ioaddr, cksumAddress, cksum) == -1) + return -1; + + return 0; + } +#endif + +/*** a3c90x_reset: exported function that resets the card to its default + *** state. This is so the Linux driver can re-set the card up the way + *** it wants to. If CFG_3C90X_PRESERVE_XCVR is defined, then the reset will + *** not alter the selected transceiver that we used to download the boot + *** image. + ***/ +static void a3c90x_reset(void) + { +#ifdef CFG_3C90X_PRESERVE_XCVR + int cfg; + /** Read the current InternalConfig value. **/ + a3c90x_internal_SetWindow(INF_3C90X.IOAddr, winTxRxOptions3); + cfg = inl(INF_3C90X.IOAddr + regInternalConfig_3_l); +#endif + + /** Send the reset command to the card **/ + printf("Issuing RESET:\n"); + a3c90x_internal_IssueCommand(INF_3C90X.IOAddr, cmdGlobalReset, 0); + + /** wait for reset command to complete **/ + while (inw(INF_3C90X.IOAddr + regCommandIntStatus_w) & INT_CMDINPROGRESS); + + /** global reset command resets station mask, non-B revision cards + ** require explicit reset of values + **/ + a3c90x_internal_SetWindow(INF_3C90X.IOAddr, winAddressing2); + outw(0, INF_3C90X.IOAddr + regStationMask_2_3w+0); + outw(0, INF_3C90X.IOAddr + regStationMask_2_3w+2); + outw(0, INF_3C90X.IOAddr + regStationMask_2_3w+4); + +#ifdef CFG_3C90X_PRESERVE_XCVR + /** Re-set the original InternalConfig value from before reset **/ + a3c90x_internal_SetWindow(INF_3C90X.IOAddr, winTxRxOptions3); + outl(cfg, INF_3C90X.IOAddr + regInternalConfig_3_l); + + /** enable DC converter for 10-Base-T **/ + if ((cfg&0x0300) == 0x0300) + { + a3c90x_internal_IssueCommand(INF_3C90X.IOAddr, cmdEnableDcConverter, 0); + } +#endif + + /** Issue transmit reset, wait for command completion **/ + a3c90x_internal_IssueCommand(INF_3C90X.IOAddr, cmdTxReset, 0); + while (inw(INF_3C90X.IOAddr + regCommandIntStatus_w) & INT_CMDINPROGRESS) + ; + if (! INF_3C90X.isBrev) + outb(0x01, INF_3C90X.IOAddr + regTxFreeThresh_b); + a3c90x_internal_IssueCommand(INF_3C90X.IOAddr, cmdTxEnable, 0); + + /** + ** reset of the receiver on B-revision cards re-negotiates the link + ** takes several seconds (a computer eternity) + **/ + if (INF_3C90X.isBrev) + a3c90x_internal_IssueCommand(INF_3C90X.IOAddr, cmdRxReset, 0x04); + else + a3c90x_internal_IssueCommand(INF_3C90X.IOAddr, cmdRxReset, 0x00); + while (inw(INF_3C90X.IOAddr + regCommandIntStatus_w) & INT_CMDINPROGRESS); + ; + a3c90x_internal_IssueCommand(INF_3C90X.IOAddr, cmdRxEnable, 0); + + a3c90x_internal_IssueCommand(INF_3C90X.IOAddr, + cmdSetInterruptEnable, 0); + /** enable rxComplete and txComplete **/ + a3c90x_internal_IssueCommand(INF_3C90X.IOAddr, + cmdSetIndicationEnable, 0x0014); + /** acknowledge any pending status flags **/ + a3c90x_internal_IssueCommand(INF_3C90X.IOAddr, + cmdAcknowledgeInterrupt, 0x661); + + return; + } + + + +/*** a3c90x_transmit: exported function that transmits a packet. Does not + *** return any particular status. Parameters are: + *** d[6] - destination address, ethernet; + *** t - protocol type (ARP, IP, etc); + *** s - size of the non-header part of the packet that needs transmitted; + *** p - the pointer to the packet data itself. + ***/ +static void +a3c90x_transmit(struct nic *nic __unused, const char *d, unsigned int t, + unsigned int s, const char *p) + { + + struct eth_hdr + { + unsigned char dst_addr[ETH_ALEN]; + unsigned char src_addr[ETH_ALEN]; + unsigned short type; + } hdr; + + unsigned char status; + unsigned i, retries; + + for (retries=0; retries < XMIT_RETRIES ; retries++) + { + /** Stall the download engine **/ + a3c90x_internal_IssueCommand(INF_3C90X.IOAddr, cmdStallCtl, 2); + + /** Make sure the card is not waiting on us **/ + inw(INF_3C90X.IOAddr + regCommandIntStatus_w); + inw(INF_3C90X.IOAddr + regCommandIntStatus_w); + + while (inw(INF_3C90X.IOAddr+regCommandIntStatus_w) & + INT_CMDINPROGRESS) + ; + + /** Set the ethernet packet type **/ + hdr.type = htons(t); + + /** Copy the destination address **/ + memcpy(hdr.dst_addr, d, ETH_ALEN); + + /** Copy our MAC address **/ + memcpy(hdr.src_addr, INF_3C90X.HWAddr, ETH_ALEN); + + /** Setup the DPD (download descriptor) **/ + INF_3C90X.TransmitDPD.DnNextPtr = 0; + /** set notification for transmission completion (bit 15) **/ + INF_3C90X.TransmitDPD.FrameStartHeader = (s + sizeof(hdr)) | 0x8000; + INF_3C90X.TransmitDPD.HdrAddr = virt_to_bus(&hdr); + INF_3C90X.TransmitDPD.HdrLength = sizeof(hdr); + INF_3C90X.TransmitDPD.DataAddr = virt_to_bus(p); + INF_3C90X.TransmitDPD.DataLength = s + (1<<31); + + /** Send the packet **/ + outl(virt_to_bus(&(INF_3C90X.TransmitDPD)), + INF_3C90X.IOAddr + regDnListPtr_l); + + /** End Stall and Wait for upload to complete. **/ + a3c90x_internal_IssueCommand(INF_3C90X.IOAddr, cmdStallCtl, 3); + while(inl(INF_3C90X.IOAddr + regDnListPtr_l) != 0) + ; + + /** Wait for NIC Transmit to Complete **/ + load_timer2(10*TICKS_PER_MS); /* Give it 10 ms */ + while (!(inw(INF_3C90X.IOAddr + regCommandIntStatus_w)&0x0004) && + timer2_running()) + ; + + if (!(inw(INF_3C90X.IOAddr + regCommandIntStatus_w)&0x0004)) + { + printf("3C90X: Tx Timeout\n"); + continue; + } + + status = inb(INF_3C90X.IOAddr + regTxStatus_b); + + /** acknowledge transmit interrupt by writing status **/ + outb(0x00, INF_3C90X.IOAddr + regTxStatus_b); + + /** successful completion (sans "interrupt Requested" bit) **/ + if ((status & 0xbf) == 0x80) + return; + + printf("3C90X: Status (%hhX)\n", status); + /** check error codes **/ + if (status & 0x02) + { + printf("3C90X: Tx Reclaim Error (%hhX)\n", status); + a3c90x_reset(); + } + else if (status & 0x04) + { + printf("3C90X: Tx Status Overflow (%hhX)\n", status); + for (i=0; i<32; i++) + outb(0x00, INF_3C90X.IOAddr + regTxStatus_b); + /** must re-enable after max collisions before re-issuing tx **/ + a3c90x_internal_IssueCommand(INF_3C90X.IOAddr, cmdTxEnable, 0); + } + else if (status & 0x08) + { + printf("3C90X: Tx Max Collisions (%hhX)\n", status); + /** must re-enable after max collisions before re-issuing tx **/ + a3c90x_internal_IssueCommand(INF_3C90X.IOAddr, cmdTxEnable, 0); + } + else if (status & 0x10) + { + printf("3C90X: Tx Underrun (%hhX)\n", status); + a3c90x_reset(); + } + else if (status & 0x20) + { + printf("3C90X: Tx Jabber (%hhX)\n", status); + a3c90x_reset(); + } + else if ((status & 0x80) != 0x80) + { + printf("3C90X: Internal Error - Incomplete Transmission (%hhX)\n", + status); + a3c90x_reset(); + } + } + + /** failed after RETRY attempts **/ + printf("Failed to send after %d retries\n", retries); + return; + + } + + + +/*** a3c90x_poll: exported routine that waits for a certain length of time + *** for a packet, and if it sees none, returns 0. This routine should + *** copy the packet to nic->packet if it gets a packet and set the size + *** in nic->packetlen. Return 1 if a packet was found. + ***/ +static int +a3c90x_poll(struct nic *nic, int retrieve) + { + int i, errcode; + + if (!(inw(INF_3C90X.IOAddr + regCommandIntStatus_w)&0x0010)) + { + return 0; + } + + if ( ! retrieve ) return 1; + + /** we don't need to acknowledge rxComplete -- the upload engine + ** does it for us. + **/ + + /** Build the up-load descriptor **/ + INF_3C90X.ReceiveUPD.UpNextPtr = 0; + INF_3C90X.ReceiveUPD.UpPktStatus = 0; + INF_3C90X.ReceiveUPD.DataAddr = virt_to_bus(nic->packet); + INF_3C90X.ReceiveUPD.DataLength = 1536 + (1<<31); + + /** Submit the upload descriptor to the NIC **/ + outl(virt_to_bus(&(INF_3C90X.ReceiveUPD)), + INF_3C90X.IOAddr + regUpListPtr_l); + + /** Wait for upload completion (upComplete(15) or upError (14)) **/ + for(i=0;i<40000;i++); + while((INF_3C90X.ReceiveUPD.UpPktStatus & ((1<<14) | (1<<15))) == 0) + for(i=0;i<40000;i++); + + /** Check for Error (else we have good packet) **/ + if (INF_3C90X.ReceiveUPD.UpPktStatus & (1<<14)) + { + errcode = INF_3C90X.ReceiveUPD.UpPktStatus; + if (errcode & (1<<16)) + printf("3C90X: Rx Overrun (%hX)\n",errcode>>16); + else if (errcode & (1<<17)) + printf("3C90X: Runt Frame (%hX)\n",errcode>>16); + else if (errcode & (1<<18)) + printf("3C90X: Alignment Error (%hX)\n",errcode>>16); + else if (errcode & (1<<19)) + printf("3C90X: CRC Error (%hX)\n",errcode>>16); + else if (errcode & (1<<20)) + printf("3C90X: Oversized Frame (%hX)\n",errcode>>16); + else + printf("3C90X: Packet error (%hX)\n",errcode>>16); + return 0; + } + + /** Ok, got packet. Set length in nic->packetlen. **/ + nic->packetlen = (INF_3C90X.ReceiveUPD.UpPktStatus & 0x1FFF); + + return 1; + } + + + +/*** a3c90x_disable: exported routine to disable the card. What's this for? + *** the eepro100.c driver didn't have one, so I just left this one empty too. + *** Ideas anyone? + *** Must turn off receiver at least so stray packets will not corrupt memory + *** [Ken] + ***/ +static void +a3c90x_disable(struct dev *dev __unused) +{ + /* reset and disable merge */ + a3c90x_reset(); + /* Disable the receiver and transmitter. */ + outw(cmdRxDisable, INF_3C90X.IOAddr + regCommandIntStatus_w); + outw(cmdTxDisable, INF_3C90X.IOAddr + regCommandIntStatus_w); +} + +static void a3c90x_irq(struct nic *nic __unused, irq_action_t action __unused) +{ + switch ( action ) { + case DISABLE : + break; + case ENABLE : + break; + case FORCE : + break; + } +} + +/*** a3c90x_probe: exported routine to probe for the 3c905 card and perform + *** initialization. If this routine is called, the pci functions did find the + *** card. We just have to init it here. + ***/ +static int a3c90x_probe(struct dev *dev, struct pci_device *pci) +{ + struct nic *nic = (struct nic *)dev; + int i, c; + unsigned short eeprom[0x21]; + unsigned int cfg; + unsigned int mopt; + unsigned int mstat; + unsigned short linktype; +#define HWADDR_OFFSET 10 + + if (pci->ioaddr == 0) + return 0; + + adjust_pci_device(pci); + + nic->ioaddr = pci->ioaddr & ~3; + nic->irqno = 0; + + INF_3C90X.IOAddr = pci->ioaddr & ~3; + INF_3C90X.CurrentWindow = 255; + switch (a3c90x_internal_ReadEeprom(INF_3C90X.IOAddr, 0x03)) + { + case 0x9000: /** 10 Base TPO **/ + case 0x9001: /** 10/100 T4 **/ + case 0x9050: /** 10/100 TPO **/ + case 0x9051: /** 10 Base Combo **/ + INF_3C90X.isBrev = 0; + break; + + case 0x9004: /** 10 Base TPO **/ + case 0x9005: /** 10 Base Combo **/ + case 0x9006: /** 10 Base TPO and Base2 **/ + case 0x900A: /** 10 Base FL **/ + case 0x9055: /** 10/100 TPO **/ + case 0x9056: /** 10/100 T4 **/ + case 0x905A: /** 10 Base FX **/ + default: + INF_3C90X.isBrev = 1; + break; + } + + /** Load the EEPROM contents **/ + if (INF_3C90X.isBrev) + { + for(i=0;i<=0x20;i++) + { + eeprom[i] = a3c90x_internal_ReadEeprom(INF_3C90X.IOAddr, i); + } + +#ifdef CFG_3C90X_BOOTROM_FIX + /** Set xcvrSelect in InternalConfig in eeprom. **/ + /* only necessary for 3c905b revision cards with boot PROM bug!!! */ + a3c90x_internal_WriteEeprom(INF_3C90X.IOAddr, 0x13, 0x0160); +#endif + +#ifdef CFG_3C90X_XCVR + if (CFG_3C90X_XCVR == 255) + { + /** Clear the LanWorks register **/ + a3c90x_internal_WriteEeprom(INF_3C90X.IOAddr, 0x16, 0); + } + else + { + /** Set the selected permanent-xcvrSelect in the + ** LanWorks register + **/ + a3c90x_internal_WriteEeprom(INF_3C90X.IOAddr, 0x16, + XCVR_MAGIC + ((CFG_3C90X_XCVR) & 0x000F)); + } +#endif + } + else + { + for(i=0;i<=0x17;i++) + { + eeprom[i] = a3c90x_internal_ReadEeprom(INF_3C90X.IOAddr, i); + } + } + + /** Print identification message **/ + printf("\n\n3C90X Driver 2.00 " + "Copyright 1999 LightSys Technology Services, Inc.\n" + "Portions Copyright 1999 Steve Smith\n"); + printf("Provided with ABSOLUTELY NO WARRANTY.\n"); +#ifdef CFG_3C90X_BOOTROM_FIX + if (INF_3C90X.isBrev) + { + printf("NOTE: 3c905b bootrom fix enabled; has side " + "effects. See 3c90x.txt for info.\n"); + } +#endif + printf("-------------------------------------------------------" + "------------------------\n"); + + /** Retrieve the Hardware address and print it on the screen. **/ + INF_3C90X.HWAddr[0] = eeprom[HWADDR_OFFSET + 0]>>8; + INF_3C90X.HWAddr[1] = eeprom[HWADDR_OFFSET + 0]&0xFF; + INF_3C90X.HWAddr[2] = eeprom[HWADDR_OFFSET + 1]>>8; + INF_3C90X.HWAddr[3] = eeprom[HWADDR_OFFSET + 1]&0xFF; + INF_3C90X.HWAddr[4] = eeprom[HWADDR_OFFSET + 2]>>8; + INF_3C90X.HWAddr[5] = eeprom[HWADDR_OFFSET + 2]&0xFF; + printf("MAC Address = %!\n", INF_3C90X.HWAddr); + + /* Test if the link is good, if not continue */ + a3c90x_internal_SetWindow(INF_3C90X.IOAddr, winDiagnostics4); + mstat = inw(INF_3C90X.IOAddr + regMediaStatus_4_w); + if((mstat & (1<<11)) == 0) { + printf("Valid link not established\n"); + return 0; + } + + /** Program the MAC address into the station address registers **/ + a3c90x_internal_SetWindow(INF_3C90X.IOAddr, winAddressing2); + outw(htons(eeprom[HWADDR_OFFSET + 0]), INF_3C90X.IOAddr + regStationAddress_2_3w); + outw(htons(eeprom[HWADDR_OFFSET + 1]), INF_3C90X.IOAddr + regStationAddress_2_3w+2); + outw(htons(eeprom[HWADDR_OFFSET + 2]), INF_3C90X.IOAddr + regStationAddress_2_3w+4); + outw(0, INF_3C90X.IOAddr + regStationMask_2_3w+0); + outw(0, INF_3C90X.IOAddr + regStationMask_2_3w+2); + outw(0, INF_3C90X.IOAddr + regStationMask_2_3w+4); + + /** Fill in our entry in the etherboot arp table **/ + for(i=0;inode_addr[i] = (eeprom[HWADDR_OFFSET + i/2] >> (8*((i&1)^1))) & 0xff; + + /** Read the media options register, print a message and set default + ** xcvr. + ** + ** Uses Media Option command on B revision, Reset Option on non-B + ** revision cards -- same register address + **/ + a3c90x_internal_SetWindow(INF_3C90X.IOAddr, winTxRxOptions3); + mopt = inw(INF_3C90X.IOAddr + regResetMediaOptions_3_w); + + /** mask out VCO bit that is defined as 10baseFL bit on B-rev cards **/ + if (! INF_3C90X.isBrev) + { + mopt &= 0x7F; + } + + printf("Connectors present: "); + c = 0; + linktype = 0x0008; + if (mopt & 0x01) + { + printf("%s100Base-T4",(c++)?", ":""); + linktype = 0x0006; + } + if (mopt & 0x04) + { + printf("%s100Base-FX",(c++)?", ":""); + linktype = 0x0005; + } + if (mopt & 0x10) + { + printf("%s10Base-2",(c++)?", ":""); + linktype = 0x0003; + } + if (mopt & 0x20) + { + printf("%sAUI",(c++)?", ":""); + linktype = 0x0001; + } + if (mopt & 0x40) + { + printf("%sMII",(c++)?", ":""); + linktype = 0x0006; + } + if ((mopt & 0xA) == 0xA) + { + printf("%s10Base-T / 100Base-TX",(c++)?", ":""); + linktype = 0x0008; + } + else if ((mopt & 0xA) == 0x2) + { + printf("%s100Base-TX",(c++)?", ":""); + linktype = 0x0008; + } + else if ((mopt & 0xA) == 0x8) + { + printf("%s10Base-T",(c++)?", ":""); + linktype = 0x0008; + } + printf(".\n"); + + /** Determine transceiver type to use, depending on value stored in + ** eeprom 0x16 + **/ + if (INF_3C90X.isBrev) + { + if ((eeprom[0x16] & 0xFF00) == XCVR_MAGIC) + { + /** User-defined **/ + linktype = eeprom[0x16] & 0x000F; + } + } + else + { +#ifdef CFG_3C90X_XCVR + if (CFG_3C90X_XCVR != 255) + linktype = CFG_3C90X_XCVR; +#endif /* CFG_3C90X_XCVR */ + + /** I don't know what MII MAC only mode is!!! **/ + if (linktype == 0x0009) + { + if (INF_3C90X.isBrev) + printf("WARNING: MII External MAC Mode only supported on B-revision " + "cards!!!!\nFalling Back to MII Mode\n"); + linktype = 0x0006; + } + } + + /** enable DC converter for 10-Base-T **/ + if (linktype == 0x0003) + { + a3c90x_internal_IssueCommand(INF_3C90X.IOAddr, cmdEnableDcConverter, 0); + } + + /** Set the link to the type we just determined. **/ + a3c90x_internal_SetWindow(INF_3C90X.IOAddr, winTxRxOptions3); + cfg = inl(INF_3C90X.IOAddr + regInternalConfig_3_l); + cfg &= ~(0xF<<20); + cfg |= (linktype<<20); + outl(cfg, INF_3C90X.IOAddr + regInternalConfig_3_l); + + /** Now that we set the xcvr type, reset the Tx and Rx, re-enable. **/ + a3c90x_internal_IssueCommand(INF_3C90X.IOAddr, cmdTxReset, 0x00); + while (inw(INF_3C90X.IOAddr + regCommandIntStatus_w) & INT_CMDINPROGRESS) + ; + + if (!INF_3C90X.isBrev) + outb(0x01, INF_3C90X.IOAddr + regTxFreeThresh_b); + + a3c90x_internal_IssueCommand(INF_3C90X.IOAddr, cmdTxEnable, 0); + + /** + ** reset of the receiver on B-revision cards re-negotiates the link + ** takes several seconds (a computer eternity) + **/ + if (INF_3C90X.isBrev) + a3c90x_internal_IssueCommand(INF_3C90X.IOAddr, cmdRxReset, 0x04); + else + a3c90x_internal_IssueCommand(INF_3C90X.IOAddr, cmdRxReset, 0x00); + while (inw(INF_3C90X.IOAddr + regCommandIntStatus_w) & INT_CMDINPROGRESS) + ; + + /** Set the RX filter = receive only individual pkts & multicast & bcast. **/ + a3c90x_internal_IssueCommand(INF_3C90X.IOAddr, cmdSetRxFilter, 0x01 + 0x02 + 0x04); + a3c90x_internal_IssueCommand(INF_3C90X.IOAddr, cmdRxEnable, 0); + + + /** + ** set Indication and Interrupt flags , acknowledge any IRQ's + **/ + a3c90x_internal_IssueCommand(INF_3C90X.IOAddr, cmdSetInterruptEnable, 0); + a3c90x_internal_IssueCommand(INF_3C90X.IOAddr, + cmdSetIndicationEnable, 0x0014); + a3c90x_internal_IssueCommand(INF_3C90X.IOAddr, + cmdAcknowledgeInterrupt, 0x661); + + /** Set our exported functions **/ + dev->disable = a3c90x_disable; + nic->poll = a3c90x_poll; + nic->transmit = a3c90x_transmit; + nic->irq = a3c90x_irq; + + return 1; +} + + +static struct pci_id a3c90x_nics[] = { +/* Original 90x revisions: */ +PCI_ROM(0x10b7, 0x9000, "3c905-tpo", "3Com900-TPO"), /* 10 Base TPO */ +PCI_ROM(0x10b7, 0x9001, "3c905-t4", "3Com900-Combo"), /* 10/100 T4 */ +PCI_ROM(0x10b7, 0x9050, "3c905-tpo100", "3Com905-TX"), /* 100 Base TX / 10/100 TPO */ +PCI_ROM(0x10b7, 0x9051, "3c905-combo", "3Com905-T4"), /* 100 Base T4 / 10 Base Combo */ +/* Newer 90xB revisions: */ +PCI_ROM(0x10b7, 0x9004, "3c905b-tpo", "3Com900B-TPO"), /* 10 Base TPO */ +PCI_ROM(0x10b7, 0x9005, "3c905b-combo", "3Com900B-Combo"), /* 10 Base Combo */ +PCI_ROM(0x10b7, 0x9006, "3c905b-tpb2", "3Com900B-2/T"), /* 10 Base TP and Base2 */ +PCI_ROM(0x10b7, 0x900a, "3c905b-fl", "3Com900B-FL"), /* 10 Base FL */ +PCI_ROM(0x10b7, 0x9055, "3c905b-tpo100", "3Com905B-TX"), /* 10/100 TPO */ +PCI_ROM(0x10b7, 0x9056, "3c905b-t4", "3Com905B-T4"), /* 10/100 T4 */ +PCI_ROM(0x10b7, 0x9058, "3c905b-9058", "3Com905B-9058"), /* Cyclone 10/100/BNC */ +PCI_ROM(0x10b7, 0x905a, "3c905b-fx", "3Com905B-FL"), /* 100 Base FX / 10 Base FX */ +/* Newer 90xC revision: */ +PCI_ROM(0x10b7, 0x9200, "3c905c-tpo", "3Com905C-TXM"), /* 10/100 TPO (3C905C-TXM) */ +PCI_ROM(0x10b7, 0x9210, "3c920b-emb-wnm","3Com20B-EMB WNM"), +PCI_ROM(0x10b7, 0x9800, "3c980", "3Com980-Cyclone"), /* Cyclone */ +PCI_ROM(0x10b7, 0x9805, "3c9805", "3Com9805"), /* Dual Port Server Cyclone */ +PCI_ROM(0x10b7, 0x7646, "3csoho100-tx", "3CSOHO100-TX"), /* Hurricane */ +PCI_ROM(0x10b7, 0x4500, "3c450", "3Com450 HomePNA Tornado"), +PCI_ROM(0x10b7, 0x1201, "3c982a", "3Com982A"), +PCI_ROM(0x10b7, 0x1202, "3c982b", "3Com982B"), +}; + +struct pci_driver a3c90x_driver = { + .type = NIC_DRIVER, + .name = "3C90X", + .probe = a3c90x_probe, + .ids = a3c90x_nics, + .id_count = sizeof(a3c90x_nics)/sizeof(a3c90x_nics[0]), + .class = 0, +}; diff --git a/usr/src/grub/grub-0.97/netboot/Makefile.am b/usr/src/grub/grub-0.97/netboot/Makefile.am new file mode 100644 index 0000000000..938443f818 --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/Makefile.am @@ -0,0 +1,287 @@ +# For and . +INCLUDES = -I$(top_srcdir)/stage2 -I$(top_srcdir)/stage1 + +# Don't build the netboot support by default. +if NETBOOT_SUPPORT +LIBDRIVERS = libdrivers.a +else +LIBDRIVERS = +endif + +noinst_LIBRARIES = $(LIBDRIVERS) + +libdrivers_a_SOURCES = big_bswap.h bootp.h byteswap.h config.c cpu.h \ + dev.h elf.h endian.h etherboot.h fsys_tftp.c grub.h \ + i386_byteswap.h i386_elf.h i386_endian.h i386_timer.c \ + if_arp.h if_ether.h igmp.h in.h io.h ip.h isa.h latch.h \ + little_bswap.h misc.c nic.c nic.h osdep.h pci.c pci.h \ + pci_ids.h pci_io.c stdint.h tftp.h timer.c timer.h \ + types.h udp.h mii.h pic8259.c pic8259.h pxe.h basemem.c segoff.h +EXTRA_libdrivers_a_SOURCES = 3c595.c 3c595.h 3c90x.c davicom.c \ + e1000.c e1000_hw.h eepro100.c epic100.c epic100.h natsemi.c \ + ns8390.c ns8390.h pcnet32.c rtl8139.c sis900.c sis900.h \ + sundance.c tg3.c tg3.h tlan.c tlan.h tulip.c via-rhine.c \ + w89c840.c r8169.c forcedeth.c ns83820.c pnic.c pnic_api.c \ + undi.c undi.h +libdrivers_a_CFLAGS = $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ + -DFSYS_TFTP=1 $(NET_CFLAGS) $(NET_EXTRAFLAGS) +# Filled by configure. +libdrivers_a_LIBADD = @NETBOOT_DRIVERS@ +libdrivers_a_DEPENDENCIES = $(libdrivers_a_LIBADD) + +EXTRA_DIST = README.netboot + +# These below are several special rules for the device drivers. +# We cannot use a simple rule for them... + +# What objects are derived from a driver? +#3c509_drivers = 3c509.o 3c529.o +3c595_drivers = 3c595.o +3c90x_drivers = 3c90x.o +#cs89x0_drivers = cs89x0.o +davicom_drivers = davicom.o +#depca_drivers = depca.o +#eepro_drivers = eepro.o +e1000_drivers = e1000.o +eepro100_drivers = eepro100.o +epic100_drivers = epic100.o +#fa311_drivers = fa311.o +forcedeth_drivers = forcedeth.o +#i82586_drivers = 3c507.o exos205.o ni5210.o +#lance_drivers = lance.o ne2100.o ni6510.o +natsemi_drivers = natsemi.o +#ni5010_drivers = ni5010.o +ns83820_drivers = ns83820.o +ns8390_drivers = 3c503.o ne.o ns8390.o wd.o +#otulip_drivers = otulip.o +pcnet32_drivers = pcnet32.o +pnic_drivers = pnic.o +r8169_drivers = r8169.o +rtl8139_drivers = rtl8139.o +sis900_drivers = sis900.o +#sk_g16_drivers = sk_g16.o +sundance_drivers = sundance.o +#smc9000_drivers = smc9000.o +tg3_drivers = tg3.o +#tiara_drivers = tiara.o +tlan_drivers = tlan.o +tulip_drivers = tulip.o +undi_drivers = undi.o +via_rhine_drivers = via_rhine.o +w89c840_drivers = w89c840.o + + +# Is it really necessary to specify dependecies explicitly? +#$(3c509_drivers): 3c509.c 3c509.h +#$(3c509_drivers): %.o: 3c509.c +# $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ +# $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< + +$(3c595_drivers): 3c595.c 3c595.h +$(3c595_drivers): %.o: 3c595.c + $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ + $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< + +$(3c90x_drivers): 3c90x.c +$(3c90x_drivers): %.o: 3c90x.c + $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ + $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< + +#$(cs89x0_drivers): cs89x0.c cs89x0.h +#$(cs89x0_drivers): %.o: cs89x0.c +# $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ +# $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< + +$(davicom_drivers): davicom.c +$(davicom_drivers): %.o: davicom.c + $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ + $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< + +#$(depca_drivers): depca.c +#$(depca_drivers): %.o: depca.c +# $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ +# $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< + +#$(eepro_drivers): eepro.c +#$(eepro_drivers): %.o: eepro.c +# $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ +# $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< + +$(e1000_drivers): e1000.c e1000_hw.h +$(e1000_drivers): %.o: e1000.c + $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ + $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< + +$(eepro100_drivers): eepro100.c +$(eepro100_drivers): %.o: eepro100.c + $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ + $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< + +$(epic100_drivers): epic100.c epic100.h +$(epic100_drivers): %.o: epic100.c + $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ + $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< + +$(forcedeth_drivers): forcedeth.c +$(forcedeth_drivers): %.o: forcedeth.c + $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ + $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< + +#$(fa311_drivers): fa311.c +#$(fa311_drivers): %.o: fa311.c +# $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ +# $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< + +#$(i82586_drivers): i82586.c +#$(i82586_drivers): %.o: i82586.c +# $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ +# $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< + +#$(lance_drivers): lance.c +#$(lance_drivers): %.o: lance.c +# $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ +# $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< + +$(natsemi_drivers): natsemi.c +$(natsemi_drivers): %.o: natsemi.c + $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ + $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< + +#$(ni5010_drivers): ni5010.c +#$(ni5010_drivers): %.o: ni5010.c +# $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ +# $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< + +$(ns83820_drivers): ns83820.c +$(ns83820_drivers): %.o: ns83820.c + $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ + $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< + +$(ns8390_drivers): ns8390.c ns8390.h +$(ns8390_drivers): %.o: ns8390.c + $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ + $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< + +#$(otulip_drivers): otulip.c otulip.h +#$(otulip_drivers): %.o: otulip.c +# $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ +# $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< + +$(pcnet32_drivers): pcnet32.c +$(pcnet32_drivers): %.o: pcnet32.c + $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ + $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< + +$(pnic_drivers): pnic.c +$(pnic_drivers): %.o: pnic.c pnic_api.h + $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ + $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< + +$(rtl8139_drivers): rtl8139.c +$(rtl8139_drivers): %.o: rtl8139.c + $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ + $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< + +$(r8169_drivers): r8169.c +$(r8169_drivers): %.o: r8169.c + $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ + $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< + +$(sis900_drivers): sis900.c sis900.h +$(sis900_drivers): %.o: sis900.c + $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ + $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< + +#$(sk_g16_drivers): sk_g16.c sk_g16.h +#$(sk_g16_drivers): %.o: sk_g16.c +# $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ +# $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< + +#$(smc9000_drivers): smc9000.c smc9000.h +#$(smc9000_drivers): %.o: smc9000.c +# $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ +# $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< + +$(sundance_drivers): sundance.c +$(sundance_drivers): %.o: sundance.c + $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ + $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< + +$(tg3_drivers): tg3.c tg3.h +$(tg3_drivers): %.o: tg3.c + $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ + $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< + +#$(tiara_drivers): tiara.c +#$(tiara_drivers): %.o: tiara.c +# $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ +# $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< + +$(tlan_drivers): tlan.c tlan.h +$(tlan_drivers): %.o: tlan.c + $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ + $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< + +$(tulip_drivers): tulip.c +$(tulip_drivers): %.o: tulip.c + $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ + $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< + +$(undi_drivers): undi.c undi.h +$(undi_drivers): %.o: undi.c + $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ + $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< + +$(via_rhine_drivers): via-rhine.c +$(via_rhine_drivers): %.o: via-rhine.c + $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ + $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< + +$(w89c840_drivers): w89c840.c +$(w89c840_drivers): %.o: w89c840.c + $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ + $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< + +# Per-object flags. +#3c509_o_CFLAGS = -DINCLUDE_3C509=1 +#3c529_o_CFLAGS = -DINCLUDE_3C529=1 +3c595_o_CFLAGS = -DINCLUDE_3C595=1 +3c90x_o_CFLAGS = -DINCLUDE_3C90X=1 +#cs89x0_o_CFLAGS = -DINCLUDE_CS89X0=1 +davicom_o_CFLAGS = -DINCLUDE_DAVICOM=1 +#depca_o_CFLAGS = -DINCLUDE_DEPCA=1 +#eepro_o_CFLAGS = -DINCLUDE_EEPRO=1 +e1000_o_CFLAGS = -DINCLUDE_E1000=1 +eepro100_o_CFLAGS = -DINCLUDE_EEPRO100=1 +epic100_o_CFLAGS = -DINCLUDE_EPIC100=1 +#fa311_o_CFLAGS = -DINCLUDE_FA311=1 +forcedeth_o_CFLAGS = -DINCLUDE_FORCEDETH=1 +#3c507_o_CFLAGS = -DINCLUDE_3C507=1 +#exos205_o_CFLAGS = -DINCLUDE_EXOS205=1 +#ni5210_o_CFLAGS = -DINCLUDE_NI5210=1 +#lance_o_CFLAGS = -DINCLUDE_LANCE=1 +#ne2100_o_CFLAGS = -DINCLUDE_NE2100=1 +#ni6510_o_CFLAGS = -DINCLUDE_NI6510=1 +natsemi_o_CFLAGS = -DINCLUDE_NATSEMI=1 +#ni5010_o_CFLAGS = -DINCLUDE_NI5010=1 +#3c503_o_CFLAGS = -DINCLUDE_3C503=1 +#ne_o_CFLAGS = -DINCLUDE_NE=1 +ns83820_o_CFLAGS = -DINCLUDE_NS83820=1 +ns8390_o_CFLAGS = -DINCLUDE_NS8390=1 +#wd_o_CFLAGS = -DINCLUDE_WD=1 +#otulip_o_CFLAGS = -DINCLUDE_OTULIP=1 +pcnet32_o_CFLAGS = -DINCLUDE_PCNET32=1 +pnic_o_CFLAGS = -DINCLUDE_PNIC=1 +r8169_o_CFLAGS = -DINCLUDE_R8169=1 +rtl8139_o_CFLAGS = -DINCLUDE_RTL8139=1 +sis900_o_CFLAGS = -DINCLUDE_SIS900=1 +#sk_g16_o_CFLAGS = -DINCLUDE_SK_G16=1 +#smc9000_o_CFLAGS = -DINCLUDE_SMC9000=1 +sundance_o_CFLAGS = -DINCLUDE_SUNDANCE=1 +#tiara_o_CFLAGS = -DINCLUDE_TIARA=1 +tg3_o_CFLAGS = -DINCLUDE_TG3=1 +tlan_o_CFLAGS = -DINCLUDE_TLAN=1 +tulip_o_CFLAGS = -DINCLUDE_TULIP=1 +undi_o_CFLAGS = -DINCLUDE_UNDI=1 +via_rhine_o_CFLAGS = -DINCLUDE_VIA_RHINE=1 +w89c840_o_CFLAGS = -DINCLUDE_W89C840=1 diff --git a/usr/src/grub/grub-0.97/netboot/Makefile.in b/usr/src/grub/grub-0.97/netboot/Makefile.in new file mode 100644 index 0000000000..75ac299712 --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/Makefile.in @@ -0,0 +1,1091 @@ +# Makefile.in generated by automake 1.9.4 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +SOURCES = $(libdrivers_a_SOURCES) $(EXTRA_libdrivers_a_SOURCES) + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = netboot +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +LIBRARIES = $(noinst_LIBRARIES) +AR = ar +ARFLAGS = cru +libdrivers_a_AR = $(AR) $(ARFLAGS) +am_libdrivers_a_OBJECTS = libdrivers_a-config.$(OBJEXT) \ + libdrivers_a-fsys_tftp.$(OBJEXT) libdrivers_a-main.$(OBJEXT) \ + libdrivers_a-misc.$(OBJEXT) libdrivers_a-pci.$(OBJEXT) \ + libdrivers_a-timer.$(OBJEXT) +libdrivers_a_OBJECTS = $(am_libdrivers_a_OBJECTS) +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(libdrivers_a_SOURCES) $(EXTRA_libdrivers_a_SOURCES) +DIST_SOURCES = $(libdrivers_a_SOURCES) $(EXTRA_libdrivers_a_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BUILD_EXAMPLE_KERNEL_FALSE = @BUILD_EXAMPLE_KERNEL_FALSE@ +BUILD_EXAMPLE_KERNEL_TRUE = @BUILD_EXAMPLE_KERNEL_TRUE@ +CC = @CC@ +CCAS = @CCAS@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DISKLESS_SUPPORT_FALSE = @DISKLESS_SUPPORT_FALSE@ +DISKLESS_SUPPORT_TRUE = @DISKLESS_SUPPORT_TRUE@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FSYS_CFLAGS = @FSYS_CFLAGS@ +GRUB_CFLAGS = @GRUB_CFLAGS@ +GRUB_LIBS = @GRUB_LIBS@ +HERCULES_SUPPORT_FALSE = @HERCULES_SUPPORT_FALSE@ +HERCULES_SUPPORT_TRUE = @HERCULES_SUPPORT_TRUE@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +NETBOOT_DRIVERS = @NETBOOT_DRIVERS@ +NETBOOT_SUPPORT_FALSE = @NETBOOT_SUPPORT_FALSE@ +NETBOOT_SUPPORT_TRUE = @NETBOOT_SUPPORT_TRUE@ +NET_CFLAGS = @NET_CFLAGS@ +NET_EXTRAFLAGS = @NET_EXTRAFLAGS@ +OBJCOPY = @OBJCOPY@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PERL = @PERL@ +RANLIB = @RANLIB@ +SERIAL_SPEED_SIMULATION_FALSE = @SERIAL_SPEED_SIMULATION_FALSE@ +SERIAL_SPEED_SIMULATION_TRUE = @SERIAL_SPEED_SIMULATION_TRUE@ +SERIAL_SUPPORT_FALSE = @SERIAL_SUPPORT_FALSE@ +SERIAL_SUPPORT_TRUE = @SERIAL_SUPPORT_TRUE@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STAGE1_CFLAGS = @STAGE1_CFLAGS@ +STAGE2_CFLAGS = @STAGE2_CFLAGS@ +STRIP = @STRIP@ +VERSION = @VERSION@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_OBJCOPY = @ac_ct_OBJCOPY@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ + +# For and . +INCLUDES = -I$(top_srcdir)/stage2 -I$(top_srcdir)/stage1 +@NETBOOT_SUPPORT_FALSE@LIBDRIVERS = + +# Don't build the netboot support by default. +@NETBOOT_SUPPORT_TRUE@LIBDRIVERS = libdrivers.a +noinst_LIBRARIES = $(LIBDRIVERS) +libdrivers_a_SOURCES = cards.h config.c etherboot.h \ + fsys_tftp.c linux-asm-io.h linux-asm-string.h \ + main.c misc.c nic.h osdep.h pci.c pci.h timer.c timer.h + +EXTRA_libdrivers_a_SOURCES = 3c509.c 3c509.h 3c595.c 3c595.h 3c90x.c \ + cs89x0.c cs89x0.h davicom.c depca.c eepro.c eepro100.c \ + epic100.c epic100.h fa311.c i82586.c lance.c natsemi.c \ + ni5010.c ns8390.c ns8390.h otulip.c otulip.h rtl8139.c \ + sis900.c sis900.h sk_g16.c sk_g16.h smc9000.c smc9000.h \ + tiara.c tlan.c tulip.c via-rhine.c w89c840.c + +libdrivers_a_CFLAGS = $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ + -DFSYS_TFTP=1 $(NET_CFLAGS) $(NET_EXTRAFLAGS) + +# Filled by configure. +libdrivers_a_LIBADD = @NETBOOT_DRIVERS@ +libdrivers_a_DEPENDENCIES = $(libdrivers_a_LIBADD) +EXTRA_DIST = README.netboot 3c90x.txt cs89x0.txt sis900.txt tulip.txt + +# These below are several special rules for the device drivers. +# We cannot use a simple rule for them... + +# What objects are derived from a driver? +3c509_drivers = 3c509.o 3c529.o +3c595_drivers = 3c595.o +3c90x_drivers = 3c90x.o +cs89x0_drivers = cs89x0.o +davicom_drivers = davicom.o +depca_drivers = depca.o +eepro_drivers = eepro.o +eepro100_drivers = eepro100.o +epic100_drivers = epic100.o +#fa311_drivers = fa311.o +i82586_drivers = 3c507.o exos205.o ni5210.o +lance_drivers = lance.o ne2100.o ni6510.o +natsemi_drivers = natsemi.o +ni5010_drivers = ni5010.o +ns8390_drivers = 3c503.o ne.o ns8390.o wd.o +otulip_drivers = otulip.o +rtl8139_drivers = rtl8139.o +sis900_drivers = sis900.o +sk_g16_drivers = sk_g16.o +smc9000_drivers = smc9000.o +tiara_drivers = tiara.o +#tlan_drivers = tlan.o +tulip_drivers = tulip.o +via_rhine_drivers = via_rhine.o +w89c840_drivers = w89c840.o + +# Per-object flags. +3c509_o_CFLAGS = -DINCLUDE_3C509=1 +3c529_o_CFLAGS = -DINCLUDE_3C529=1 +3c595_o_CFLAGS = -DINCLUDE_3C595=1 +3c90x_o_CFLAGS = -DINCLUDE_3C90X=1 +cs89x0_o_CFLAGS = -DINCLUDE_CS89X0=1 +davicom_o_CFLAGS = -DINCLUDE_DAVICOM=1 +depca_o_CFLAGS = -DINCLUDE_DEPCA=1 +eepro_o_CFLAGS = -DINCLUDE_EEPRO=1 +eepro100_o_CFLAGS = -DINCLUDE_EEPRO100=1 +epic100_o_CFLAGS = -DINCLUDE_EPIC100=1 +#fa311_o_CFLAGS = -DINCLUDE_FA311=1 +3c507_o_CFLAGS = -DINCLUDE_3C507=1 +exos205_o_CFLAGS = -DINCLUDE_EXOS205=1 +ni5210_o_CFLAGS = -DINCLUDE_NI5210=1 +lance_o_CFLAGS = -DINCLUDE_LANCE=1 +ne2100_o_CFLAGS = -DINCLUDE_NE2100=1 +ni6510_o_CFLAGS = -DINCLUDE_NI6510=1 +natsemi_o_CFLAGS = -DINCLUDE_NATSEMI=1 +ni5010_o_CFLAGS = -DINCLUDE_NI5010=1 +3c503_o_CFLAGS = -DINCLUDE_3C503=1 +ne_o_CFLAGS = -DINCLUDE_NE=1 +ns8390_o_CFLAGS = -DINCLUDE_NS8390=1 +wd_o_CFLAGS = -DINCLUDE_WD=1 +otulip_o_CFLAGS = -DINCLUDE_OTULIP=1 +rtl8139_o_CFLAGS = -DINCLUDE_RTL8139=1 +sis900_o_CFLAGS = -DINCLUDE_SIS900=1 +sk_g16_o_CFLAGS = -DINCLUDE_SK_G16=1 +smc9000_o_CFLAGS = -DINCLUDE_SMC9000=1 +tiara_o_CFLAGS = -DINCLUDE_TIARA=1 +#tlan_o_CFLAGS = -DINCLUDE_TLAN=1 +tulip_o_CFLAGS = -DINCLUDE_TULIP=1 +via_rhine_o_CFLAGS = -DINCLUDE_VIA_RHINE=1 +w89c840_o_CFLAGS = -DINCLUDE_W89C840=1 +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu netboot/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu netboot/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +clean-noinstLIBRARIES: + -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) +libdrivers.a: $(libdrivers_a_OBJECTS) $(libdrivers_a_DEPENDENCIES) + -rm -f libdrivers.a + $(libdrivers_a_AR) libdrivers.a $(libdrivers_a_OBJECTS) $(libdrivers_a_LIBADD) + $(RANLIB) libdrivers.a + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-3c509.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-3c595.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-3c90x.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-config.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-cs89x0.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-davicom.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-depca.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-eepro.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-eepro100.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-epic100.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-fa311.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-fsys_tftp.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-i82586.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-lance.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-misc.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-natsemi.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-ni5010.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-ns8390.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-otulip.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-pci.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-rtl8139.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-sis900.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-sk_g16.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-smc9000.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-tiara.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-timer.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-tlan.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-tulip.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-via-rhine.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-w89c840.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +libdrivers_a-config.o: config.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-config.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-config.Tpo" -c -o libdrivers_a-config.o `test -f 'config.c' || echo '$(srcdir)/'`config.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-config.Tpo" "$(DEPDIR)/libdrivers_a-config.Po"; else rm -f "$(DEPDIR)/libdrivers_a-config.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='config.c' object='libdrivers_a-config.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-config.o `test -f 'config.c' || echo '$(srcdir)/'`config.c + +libdrivers_a-config.obj: config.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-config.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-config.Tpo" -c -o libdrivers_a-config.obj `if test -f 'config.c'; then $(CYGPATH_W) 'config.c'; else $(CYGPATH_W) '$(srcdir)/config.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-config.Tpo" "$(DEPDIR)/libdrivers_a-config.Po"; else rm -f "$(DEPDIR)/libdrivers_a-config.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='config.c' object='libdrivers_a-config.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-config.obj `if test -f 'config.c'; then $(CYGPATH_W) 'config.c'; else $(CYGPATH_W) '$(srcdir)/config.c'; fi` + +libdrivers_a-fsys_tftp.o: fsys_tftp.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-fsys_tftp.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-fsys_tftp.Tpo" -c -o libdrivers_a-fsys_tftp.o `test -f 'fsys_tftp.c' || echo '$(srcdir)/'`fsys_tftp.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-fsys_tftp.Tpo" "$(DEPDIR)/libdrivers_a-fsys_tftp.Po"; else rm -f "$(DEPDIR)/libdrivers_a-fsys_tftp.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_tftp.c' object='libdrivers_a-fsys_tftp.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-fsys_tftp.o `test -f 'fsys_tftp.c' || echo '$(srcdir)/'`fsys_tftp.c + +libdrivers_a-fsys_tftp.obj: fsys_tftp.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-fsys_tftp.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-fsys_tftp.Tpo" -c -o libdrivers_a-fsys_tftp.obj `if test -f 'fsys_tftp.c'; then $(CYGPATH_W) 'fsys_tftp.c'; else $(CYGPATH_W) '$(srcdir)/fsys_tftp.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-fsys_tftp.Tpo" "$(DEPDIR)/libdrivers_a-fsys_tftp.Po"; else rm -f "$(DEPDIR)/libdrivers_a-fsys_tftp.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_tftp.c' object='libdrivers_a-fsys_tftp.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-fsys_tftp.obj `if test -f 'fsys_tftp.c'; then $(CYGPATH_W) 'fsys_tftp.c'; else $(CYGPATH_W) '$(srcdir)/fsys_tftp.c'; fi` + +libdrivers_a-main.o: main.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-main.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-main.Tpo" -c -o libdrivers_a-main.o `test -f 'main.c' || echo '$(srcdir)/'`main.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-main.Tpo" "$(DEPDIR)/libdrivers_a-main.Po"; else rm -f "$(DEPDIR)/libdrivers_a-main.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='main.c' object='libdrivers_a-main.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-main.o `test -f 'main.c' || echo '$(srcdir)/'`main.c + +libdrivers_a-main.obj: main.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-main.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-main.Tpo" -c -o libdrivers_a-main.obj `if test -f 'main.c'; then $(CYGPATH_W) 'main.c'; else $(CYGPATH_W) '$(srcdir)/main.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-main.Tpo" "$(DEPDIR)/libdrivers_a-main.Po"; else rm -f "$(DEPDIR)/libdrivers_a-main.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='main.c' object='libdrivers_a-main.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-main.obj `if test -f 'main.c'; then $(CYGPATH_W) 'main.c'; else $(CYGPATH_W) '$(srcdir)/main.c'; fi` + +libdrivers_a-misc.o: misc.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-misc.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-misc.Tpo" -c -o libdrivers_a-misc.o `test -f 'misc.c' || echo '$(srcdir)/'`misc.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-misc.Tpo" "$(DEPDIR)/libdrivers_a-misc.Po"; else rm -f "$(DEPDIR)/libdrivers_a-misc.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='misc.c' object='libdrivers_a-misc.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-misc.o `test -f 'misc.c' || echo '$(srcdir)/'`misc.c + +libdrivers_a-misc.obj: misc.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-misc.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-misc.Tpo" -c -o libdrivers_a-misc.obj `if test -f 'misc.c'; then $(CYGPATH_W) 'misc.c'; else $(CYGPATH_W) '$(srcdir)/misc.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-misc.Tpo" "$(DEPDIR)/libdrivers_a-misc.Po"; else rm -f "$(DEPDIR)/libdrivers_a-misc.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='misc.c' object='libdrivers_a-misc.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-misc.obj `if test -f 'misc.c'; then $(CYGPATH_W) 'misc.c'; else $(CYGPATH_W) '$(srcdir)/misc.c'; fi` + +libdrivers_a-pci.o: pci.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-pci.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-pci.Tpo" -c -o libdrivers_a-pci.o `test -f 'pci.c' || echo '$(srcdir)/'`pci.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-pci.Tpo" "$(DEPDIR)/libdrivers_a-pci.Po"; else rm -f "$(DEPDIR)/libdrivers_a-pci.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pci.c' object='libdrivers_a-pci.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-pci.o `test -f 'pci.c' || echo '$(srcdir)/'`pci.c + +libdrivers_a-pci.obj: pci.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-pci.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-pci.Tpo" -c -o libdrivers_a-pci.obj `if test -f 'pci.c'; then $(CYGPATH_W) 'pci.c'; else $(CYGPATH_W) '$(srcdir)/pci.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-pci.Tpo" "$(DEPDIR)/libdrivers_a-pci.Po"; else rm -f "$(DEPDIR)/libdrivers_a-pci.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pci.c' object='libdrivers_a-pci.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-pci.obj `if test -f 'pci.c'; then $(CYGPATH_W) 'pci.c'; else $(CYGPATH_W) '$(srcdir)/pci.c'; fi` + +libdrivers_a-timer.o: timer.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-timer.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-timer.Tpo" -c -o libdrivers_a-timer.o `test -f 'timer.c' || echo '$(srcdir)/'`timer.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-timer.Tpo" "$(DEPDIR)/libdrivers_a-timer.Po"; else rm -f "$(DEPDIR)/libdrivers_a-timer.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='timer.c' object='libdrivers_a-timer.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-timer.o `test -f 'timer.c' || echo '$(srcdir)/'`timer.c + +libdrivers_a-timer.obj: timer.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-timer.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-timer.Tpo" -c -o libdrivers_a-timer.obj `if test -f 'timer.c'; then $(CYGPATH_W) 'timer.c'; else $(CYGPATH_W) '$(srcdir)/timer.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-timer.Tpo" "$(DEPDIR)/libdrivers_a-timer.Po"; else rm -f "$(DEPDIR)/libdrivers_a-timer.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='timer.c' object='libdrivers_a-timer.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-timer.obj `if test -f 'timer.c'; then $(CYGPATH_W) 'timer.c'; else $(CYGPATH_W) '$(srcdir)/timer.c'; fi` + +libdrivers_a-3c509.o: 3c509.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-3c509.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-3c509.Tpo" -c -o libdrivers_a-3c509.o `test -f '3c509.c' || echo '$(srcdir)/'`3c509.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-3c509.Tpo" "$(DEPDIR)/libdrivers_a-3c509.Po"; else rm -f "$(DEPDIR)/libdrivers_a-3c509.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='3c509.c' object='libdrivers_a-3c509.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-3c509.o `test -f '3c509.c' || echo '$(srcdir)/'`3c509.c + +libdrivers_a-3c509.obj: 3c509.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-3c509.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-3c509.Tpo" -c -o libdrivers_a-3c509.obj `if test -f '3c509.c'; then $(CYGPATH_W) '3c509.c'; else $(CYGPATH_W) '$(srcdir)/3c509.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-3c509.Tpo" "$(DEPDIR)/libdrivers_a-3c509.Po"; else rm -f "$(DEPDIR)/libdrivers_a-3c509.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='3c509.c' object='libdrivers_a-3c509.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-3c509.obj `if test -f '3c509.c'; then $(CYGPATH_W) '3c509.c'; else $(CYGPATH_W) '$(srcdir)/3c509.c'; fi` + +libdrivers_a-3c595.o: 3c595.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-3c595.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-3c595.Tpo" -c -o libdrivers_a-3c595.o `test -f '3c595.c' || echo '$(srcdir)/'`3c595.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-3c595.Tpo" "$(DEPDIR)/libdrivers_a-3c595.Po"; else rm -f "$(DEPDIR)/libdrivers_a-3c595.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='3c595.c' object='libdrivers_a-3c595.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-3c595.o `test -f '3c595.c' || echo '$(srcdir)/'`3c595.c + +libdrivers_a-3c595.obj: 3c595.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-3c595.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-3c595.Tpo" -c -o libdrivers_a-3c595.obj `if test -f '3c595.c'; then $(CYGPATH_W) '3c595.c'; else $(CYGPATH_W) '$(srcdir)/3c595.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-3c595.Tpo" "$(DEPDIR)/libdrivers_a-3c595.Po"; else rm -f "$(DEPDIR)/libdrivers_a-3c595.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='3c595.c' object='libdrivers_a-3c595.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-3c595.obj `if test -f '3c595.c'; then $(CYGPATH_W) '3c595.c'; else $(CYGPATH_W) '$(srcdir)/3c595.c'; fi` + +libdrivers_a-3c90x.o: 3c90x.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-3c90x.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-3c90x.Tpo" -c -o libdrivers_a-3c90x.o `test -f '3c90x.c' || echo '$(srcdir)/'`3c90x.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-3c90x.Tpo" "$(DEPDIR)/libdrivers_a-3c90x.Po"; else rm -f "$(DEPDIR)/libdrivers_a-3c90x.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='3c90x.c' object='libdrivers_a-3c90x.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-3c90x.o `test -f '3c90x.c' || echo '$(srcdir)/'`3c90x.c + +libdrivers_a-3c90x.obj: 3c90x.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-3c90x.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-3c90x.Tpo" -c -o libdrivers_a-3c90x.obj `if test -f '3c90x.c'; then $(CYGPATH_W) '3c90x.c'; else $(CYGPATH_W) '$(srcdir)/3c90x.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-3c90x.Tpo" "$(DEPDIR)/libdrivers_a-3c90x.Po"; else rm -f "$(DEPDIR)/libdrivers_a-3c90x.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='3c90x.c' object='libdrivers_a-3c90x.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-3c90x.obj `if test -f '3c90x.c'; then $(CYGPATH_W) '3c90x.c'; else $(CYGPATH_W) '$(srcdir)/3c90x.c'; fi` + +libdrivers_a-cs89x0.o: cs89x0.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-cs89x0.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-cs89x0.Tpo" -c -o libdrivers_a-cs89x0.o `test -f 'cs89x0.c' || echo '$(srcdir)/'`cs89x0.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-cs89x0.Tpo" "$(DEPDIR)/libdrivers_a-cs89x0.Po"; else rm -f "$(DEPDIR)/libdrivers_a-cs89x0.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cs89x0.c' object='libdrivers_a-cs89x0.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-cs89x0.o `test -f 'cs89x0.c' || echo '$(srcdir)/'`cs89x0.c + +libdrivers_a-cs89x0.obj: cs89x0.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-cs89x0.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-cs89x0.Tpo" -c -o libdrivers_a-cs89x0.obj `if test -f 'cs89x0.c'; then $(CYGPATH_W) 'cs89x0.c'; else $(CYGPATH_W) '$(srcdir)/cs89x0.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-cs89x0.Tpo" "$(DEPDIR)/libdrivers_a-cs89x0.Po"; else rm -f "$(DEPDIR)/libdrivers_a-cs89x0.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cs89x0.c' object='libdrivers_a-cs89x0.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-cs89x0.obj `if test -f 'cs89x0.c'; then $(CYGPATH_W) 'cs89x0.c'; else $(CYGPATH_W) '$(srcdir)/cs89x0.c'; fi` + +libdrivers_a-davicom.o: davicom.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-davicom.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-davicom.Tpo" -c -o libdrivers_a-davicom.o `test -f 'davicom.c' || echo '$(srcdir)/'`davicom.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-davicom.Tpo" "$(DEPDIR)/libdrivers_a-davicom.Po"; else rm -f "$(DEPDIR)/libdrivers_a-davicom.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='davicom.c' object='libdrivers_a-davicom.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-davicom.o `test -f 'davicom.c' || echo '$(srcdir)/'`davicom.c + +libdrivers_a-davicom.obj: davicom.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-davicom.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-davicom.Tpo" -c -o libdrivers_a-davicom.obj `if test -f 'davicom.c'; then $(CYGPATH_W) 'davicom.c'; else $(CYGPATH_W) '$(srcdir)/davicom.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-davicom.Tpo" "$(DEPDIR)/libdrivers_a-davicom.Po"; else rm -f "$(DEPDIR)/libdrivers_a-davicom.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='davicom.c' object='libdrivers_a-davicom.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-davicom.obj `if test -f 'davicom.c'; then $(CYGPATH_W) 'davicom.c'; else $(CYGPATH_W) '$(srcdir)/davicom.c'; fi` + +libdrivers_a-depca.o: depca.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-depca.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-depca.Tpo" -c -o libdrivers_a-depca.o `test -f 'depca.c' || echo '$(srcdir)/'`depca.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-depca.Tpo" "$(DEPDIR)/libdrivers_a-depca.Po"; else rm -f "$(DEPDIR)/libdrivers_a-depca.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='depca.c' object='libdrivers_a-depca.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-depca.o `test -f 'depca.c' || echo '$(srcdir)/'`depca.c + +libdrivers_a-depca.obj: depca.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-depca.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-depca.Tpo" -c -o libdrivers_a-depca.obj `if test -f 'depca.c'; then $(CYGPATH_W) 'depca.c'; else $(CYGPATH_W) '$(srcdir)/depca.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-depca.Tpo" "$(DEPDIR)/libdrivers_a-depca.Po"; else rm -f "$(DEPDIR)/libdrivers_a-depca.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='depca.c' object='libdrivers_a-depca.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-depca.obj `if test -f 'depca.c'; then $(CYGPATH_W) 'depca.c'; else $(CYGPATH_W) '$(srcdir)/depca.c'; fi` + +libdrivers_a-eepro.o: eepro.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-eepro.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-eepro.Tpo" -c -o libdrivers_a-eepro.o `test -f 'eepro.c' || echo '$(srcdir)/'`eepro.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-eepro.Tpo" "$(DEPDIR)/libdrivers_a-eepro.Po"; else rm -f "$(DEPDIR)/libdrivers_a-eepro.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='eepro.c' object='libdrivers_a-eepro.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-eepro.o `test -f 'eepro.c' || echo '$(srcdir)/'`eepro.c + +libdrivers_a-eepro.obj: eepro.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-eepro.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-eepro.Tpo" -c -o libdrivers_a-eepro.obj `if test -f 'eepro.c'; then $(CYGPATH_W) 'eepro.c'; else $(CYGPATH_W) '$(srcdir)/eepro.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-eepro.Tpo" "$(DEPDIR)/libdrivers_a-eepro.Po"; else rm -f "$(DEPDIR)/libdrivers_a-eepro.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='eepro.c' object='libdrivers_a-eepro.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-eepro.obj `if test -f 'eepro.c'; then $(CYGPATH_W) 'eepro.c'; else $(CYGPATH_W) '$(srcdir)/eepro.c'; fi` + +libdrivers_a-eepro100.o: eepro100.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-eepro100.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-eepro100.Tpo" -c -o libdrivers_a-eepro100.o `test -f 'eepro100.c' || echo '$(srcdir)/'`eepro100.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-eepro100.Tpo" "$(DEPDIR)/libdrivers_a-eepro100.Po"; else rm -f "$(DEPDIR)/libdrivers_a-eepro100.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='eepro100.c' object='libdrivers_a-eepro100.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-eepro100.o `test -f 'eepro100.c' || echo '$(srcdir)/'`eepro100.c + +libdrivers_a-eepro100.obj: eepro100.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-eepro100.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-eepro100.Tpo" -c -o libdrivers_a-eepro100.obj `if test -f 'eepro100.c'; then $(CYGPATH_W) 'eepro100.c'; else $(CYGPATH_W) '$(srcdir)/eepro100.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-eepro100.Tpo" "$(DEPDIR)/libdrivers_a-eepro100.Po"; else rm -f "$(DEPDIR)/libdrivers_a-eepro100.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='eepro100.c' object='libdrivers_a-eepro100.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-eepro100.obj `if test -f 'eepro100.c'; then $(CYGPATH_W) 'eepro100.c'; else $(CYGPATH_W) '$(srcdir)/eepro100.c'; fi` + +libdrivers_a-epic100.o: epic100.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-epic100.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-epic100.Tpo" -c -o libdrivers_a-epic100.o `test -f 'epic100.c' || echo '$(srcdir)/'`epic100.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-epic100.Tpo" "$(DEPDIR)/libdrivers_a-epic100.Po"; else rm -f "$(DEPDIR)/libdrivers_a-epic100.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='epic100.c' object='libdrivers_a-epic100.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-epic100.o `test -f 'epic100.c' || echo '$(srcdir)/'`epic100.c + +libdrivers_a-epic100.obj: epic100.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-epic100.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-epic100.Tpo" -c -o libdrivers_a-epic100.obj `if test -f 'epic100.c'; then $(CYGPATH_W) 'epic100.c'; else $(CYGPATH_W) '$(srcdir)/epic100.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-epic100.Tpo" "$(DEPDIR)/libdrivers_a-epic100.Po"; else rm -f "$(DEPDIR)/libdrivers_a-epic100.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='epic100.c' object='libdrivers_a-epic100.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-epic100.obj `if test -f 'epic100.c'; then $(CYGPATH_W) 'epic100.c'; else $(CYGPATH_W) '$(srcdir)/epic100.c'; fi` + +libdrivers_a-fa311.o: fa311.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-fa311.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-fa311.Tpo" -c -o libdrivers_a-fa311.o `test -f 'fa311.c' || echo '$(srcdir)/'`fa311.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-fa311.Tpo" "$(DEPDIR)/libdrivers_a-fa311.Po"; else rm -f "$(DEPDIR)/libdrivers_a-fa311.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fa311.c' object='libdrivers_a-fa311.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-fa311.o `test -f 'fa311.c' || echo '$(srcdir)/'`fa311.c + +libdrivers_a-fa311.obj: fa311.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-fa311.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-fa311.Tpo" -c -o libdrivers_a-fa311.obj `if test -f 'fa311.c'; then $(CYGPATH_W) 'fa311.c'; else $(CYGPATH_W) '$(srcdir)/fa311.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-fa311.Tpo" "$(DEPDIR)/libdrivers_a-fa311.Po"; else rm -f "$(DEPDIR)/libdrivers_a-fa311.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fa311.c' object='libdrivers_a-fa311.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-fa311.obj `if test -f 'fa311.c'; then $(CYGPATH_W) 'fa311.c'; else $(CYGPATH_W) '$(srcdir)/fa311.c'; fi` + +libdrivers_a-i82586.o: i82586.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-i82586.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-i82586.Tpo" -c -o libdrivers_a-i82586.o `test -f 'i82586.c' || echo '$(srcdir)/'`i82586.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-i82586.Tpo" "$(DEPDIR)/libdrivers_a-i82586.Po"; else rm -f "$(DEPDIR)/libdrivers_a-i82586.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='i82586.c' object='libdrivers_a-i82586.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-i82586.o `test -f 'i82586.c' || echo '$(srcdir)/'`i82586.c + +libdrivers_a-i82586.obj: i82586.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-i82586.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-i82586.Tpo" -c -o libdrivers_a-i82586.obj `if test -f 'i82586.c'; then $(CYGPATH_W) 'i82586.c'; else $(CYGPATH_W) '$(srcdir)/i82586.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-i82586.Tpo" "$(DEPDIR)/libdrivers_a-i82586.Po"; else rm -f "$(DEPDIR)/libdrivers_a-i82586.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='i82586.c' object='libdrivers_a-i82586.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-i82586.obj `if test -f 'i82586.c'; then $(CYGPATH_W) 'i82586.c'; else $(CYGPATH_W) '$(srcdir)/i82586.c'; fi` + +libdrivers_a-lance.o: lance.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-lance.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-lance.Tpo" -c -o libdrivers_a-lance.o `test -f 'lance.c' || echo '$(srcdir)/'`lance.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-lance.Tpo" "$(DEPDIR)/libdrivers_a-lance.Po"; else rm -f "$(DEPDIR)/libdrivers_a-lance.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='lance.c' object='libdrivers_a-lance.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-lance.o `test -f 'lance.c' || echo '$(srcdir)/'`lance.c + +libdrivers_a-lance.obj: lance.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-lance.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-lance.Tpo" -c -o libdrivers_a-lance.obj `if test -f 'lance.c'; then $(CYGPATH_W) 'lance.c'; else $(CYGPATH_W) '$(srcdir)/lance.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-lance.Tpo" "$(DEPDIR)/libdrivers_a-lance.Po"; else rm -f "$(DEPDIR)/libdrivers_a-lance.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='lance.c' object='libdrivers_a-lance.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-lance.obj `if test -f 'lance.c'; then $(CYGPATH_W) 'lance.c'; else $(CYGPATH_W) '$(srcdir)/lance.c'; fi` + +libdrivers_a-natsemi.o: natsemi.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-natsemi.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-natsemi.Tpo" -c -o libdrivers_a-natsemi.o `test -f 'natsemi.c' || echo '$(srcdir)/'`natsemi.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-natsemi.Tpo" "$(DEPDIR)/libdrivers_a-natsemi.Po"; else rm -f "$(DEPDIR)/libdrivers_a-natsemi.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='natsemi.c' object='libdrivers_a-natsemi.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-natsemi.o `test -f 'natsemi.c' || echo '$(srcdir)/'`natsemi.c + +libdrivers_a-natsemi.obj: natsemi.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-natsemi.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-natsemi.Tpo" -c -o libdrivers_a-natsemi.obj `if test -f 'natsemi.c'; then $(CYGPATH_W) 'natsemi.c'; else $(CYGPATH_W) '$(srcdir)/natsemi.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-natsemi.Tpo" "$(DEPDIR)/libdrivers_a-natsemi.Po"; else rm -f "$(DEPDIR)/libdrivers_a-natsemi.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='natsemi.c' object='libdrivers_a-natsemi.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-natsemi.obj `if test -f 'natsemi.c'; then $(CYGPATH_W) 'natsemi.c'; else $(CYGPATH_W) '$(srcdir)/natsemi.c'; fi` + +libdrivers_a-ni5010.o: ni5010.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-ni5010.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-ni5010.Tpo" -c -o libdrivers_a-ni5010.o `test -f 'ni5010.c' || echo '$(srcdir)/'`ni5010.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-ni5010.Tpo" "$(DEPDIR)/libdrivers_a-ni5010.Po"; else rm -f "$(DEPDIR)/libdrivers_a-ni5010.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ni5010.c' object='libdrivers_a-ni5010.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-ni5010.o `test -f 'ni5010.c' || echo '$(srcdir)/'`ni5010.c + +libdrivers_a-ni5010.obj: ni5010.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-ni5010.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-ni5010.Tpo" -c -o libdrivers_a-ni5010.obj `if test -f 'ni5010.c'; then $(CYGPATH_W) 'ni5010.c'; else $(CYGPATH_W) '$(srcdir)/ni5010.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-ni5010.Tpo" "$(DEPDIR)/libdrivers_a-ni5010.Po"; else rm -f "$(DEPDIR)/libdrivers_a-ni5010.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ni5010.c' object='libdrivers_a-ni5010.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-ni5010.obj `if test -f 'ni5010.c'; then $(CYGPATH_W) 'ni5010.c'; else $(CYGPATH_W) '$(srcdir)/ni5010.c'; fi` + +libdrivers_a-ns8390.o: ns8390.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-ns8390.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-ns8390.Tpo" -c -o libdrivers_a-ns8390.o `test -f 'ns8390.c' || echo '$(srcdir)/'`ns8390.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-ns8390.Tpo" "$(DEPDIR)/libdrivers_a-ns8390.Po"; else rm -f "$(DEPDIR)/libdrivers_a-ns8390.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ns8390.c' object='libdrivers_a-ns8390.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-ns8390.o `test -f 'ns8390.c' || echo '$(srcdir)/'`ns8390.c + +libdrivers_a-ns8390.obj: ns8390.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-ns8390.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-ns8390.Tpo" -c -o libdrivers_a-ns8390.obj `if test -f 'ns8390.c'; then $(CYGPATH_W) 'ns8390.c'; else $(CYGPATH_W) '$(srcdir)/ns8390.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-ns8390.Tpo" "$(DEPDIR)/libdrivers_a-ns8390.Po"; else rm -f "$(DEPDIR)/libdrivers_a-ns8390.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ns8390.c' object='libdrivers_a-ns8390.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-ns8390.obj `if test -f 'ns8390.c'; then $(CYGPATH_W) 'ns8390.c'; else $(CYGPATH_W) '$(srcdir)/ns8390.c'; fi` + +libdrivers_a-otulip.o: otulip.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-otulip.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-otulip.Tpo" -c -o libdrivers_a-otulip.o `test -f 'otulip.c' || echo '$(srcdir)/'`otulip.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-otulip.Tpo" "$(DEPDIR)/libdrivers_a-otulip.Po"; else rm -f "$(DEPDIR)/libdrivers_a-otulip.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='otulip.c' object='libdrivers_a-otulip.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-otulip.o `test -f 'otulip.c' || echo '$(srcdir)/'`otulip.c + +libdrivers_a-otulip.obj: otulip.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-otulip.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-otulip.Tpo" -c -o libdrivers_a-otulip.obj `if test -f 'otulip.c'; then $(CYGPATH_W) 'otulip.c'; else $(CYGPATH_W) '$(srcdir)/otulip.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-otulip.Tpo" "$(DEPDIR)/libdrivers_a-otulip.Po"; else rm -f "$(DEPDIR)/libdrivers_a-otulip.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='otulip.c' object='libdrivers_a-otulip.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-otulip.obj `if test -f 'otulip.c'; then $(CYGPATH_W) 'otulip.c'; else $(CYGPATH_W) '$(srcdir)/otulip.c'; fi` + +libdrivers_a-rtl8139.o: rtl8139.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-rtl8139.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-rtl8139.Tpo" -c -o libdrivers_a-rtl8139.o `test -f 'rtl8139.c' || echo '$(srcdir)/'`rtl8139.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-rtl8139.Tpo" "$(DEPDIR)/libdrivers_a-rtl8139.Po"; else rm -f "$(DEPDIR)/libdrivers_a-rtl8139.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='rtl8139.c' object='libdrivers_a-rtl8139.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-rtl8139.o `test -f 'rtl8139.c' || echo '$(srcdir)/'`rtl8139.c + +libdrivers_a-rtl8139.obj: rtl8139.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-rtl8139.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-rtl8139.Tpo" -c -o libdrivers_a-rtl8139.obj `if test -f 'rtl8139.c'; then $(CYGPATH_W) 'rtl8139.c'; else $(CYGPATH_W) '$(srcdir)/rtl8139.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-rtl8139.Tpo" "$(DEPDIR)/libdrivers_a-rtl8139.Po"; else rm -f "$(DEPDIR)/libdrivers_a-rtl8139.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='rtl8139.c' object='libdrivers_a-rtl8139.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-rtl8139.obj `if test -f 'rtl8139.c'; then $(CYGPATH_W) 'rtl8139.c'; else $(CYGPATH_W) '$(srcdir)/rtl8139.c'; fi` + +libdrivers_a-sis900.o: sis900.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-sis900.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-sis900.Tpo" -c -o libdrivers_a-sis900.o `test -f 'sis900.c' || echo '$(srcdir)/'`sis900.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-sis900.Tpo" "$(DEPDIR)/libdrivers_a-sis900.Po"; else rm -f "$(DEPDIR)/libdrivers_a-sis900.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sis900.c' object='libdrivers_a-sis900.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-sis900.o `test -f 'sis900.c' || echo '$(srcdir)/'`sis900.c + +libdrivers_a-sis900.obj: sis900.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-sis900.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-sis900.Tpo" -c -o libdrivers_a-sis900.obj `if test -f 'sis900.c'; then $(CYGPATH_W) 'sis900.c'; else $(CYGPATH_W) '$(srcdir)/sis900.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-sis900.Tpo" "$(DEPDIR)/libdrivers_a-sis900.Po"; else rm -f "$(DEPDIR)/libdrivers_a-sis900.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sis900.c' object='libdrivers_a-sis900.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-sis900.obj `if test -f 'sis900.c'; then $(CYGPATH_W) 'sis900.c'; else $(CYGPATH_W) '$(srcdir)/sis900.c'; fi` + +libdrivers_a-sk_g16.o: sk_g16.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-sk_g16.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-sk_g16.Tpo" -c -o libdrivers_a-sk_g16.o `test -f 'sk_g16.c' || echo '$(srcdir)/'`sk_g16.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-sk_g16.Tpo" "$(DEPDIR)/libdrivers_a-sk_g16.Po"; else rm -f "$(DEPDIR)/libdrivers_a-sk_g16.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sk_g16.c' object='libdrivers_a-sk_g16.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-sk_g16.o `test -f 'sk_g16.c' || echo '$(srcdir)/'`sk_g16.c + +libdrivers_a-sk_g16.obj: sk_g16.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-sk_g16.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-sk_g16.Tpo" -c -o libdrivers_a-sk_g16.obj `if test -f 'sk_g16.c'; then $(CYGPATH_W) 'sk_g16.c'; else $(CYGPATH_W) '$(srcdir)/sk_g16.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-sk_g16.Tpo" "$(DEPDIR)/libdrivers_a-sk_g16.Po"; else rm -f "$(DEPDIR)/libdrivers_a-sk_g16.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sk_g16.c' object='libdrivers_a-sk_g16.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-sk_g16.obj `if test -f 'sk_g16.c'; then $(CYGPATH_W) 'sk_g16.c'; else $(CYGPATH_W) '$(srcdir)/sk_g16.c'; fi` + +libdrivers_a-smc9000.o: smc9000.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-smc9000.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-smc9000.Tpo" -c -o libdrivers_a-smc9000.o `test -f 'smc9000.c' || echo '$(srcdir)/'`smc9000.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-smc9000.Tpo" "$(DEPDIR)/libdrivers_a-smc9000.Po"; else rm -f "$(DEPDIR)/libdrivers_a-smc9000.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='smc9000.c' object='libdrivers_a-smc9000.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-smc9000.o `test -f 'smc9000.c' || echo '$(srcdir)/'`smc9000.c + +libdrivers_a-smc9000.obj: smc9000.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-smc9000.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-smc9000.Tpo" -c -o libdrivers_a-smc9000.obj `if test -f 'smc9000.c'; then $(CYGPATH_W) 'smc9000.c'; else $(CYGPATH_W) '$(srcdir)/smc9000.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-smc9000.Tpo" "$(DEPDIR)/libdrivers_a-smc9000.Po"; else rm -f "$(DEPDIR)/libdrivers_a-smc9000.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='smc9000.c' object='libdrivers_a-smc9000.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-smc9000.obj `if test -f 'smc9000.c'; then $(CYGPATH_W) 'smc9000.c'; else $(CYGPATH_W) '$(srcdir)/smc9000.c'; fi` + +libdrivers_a-tiara.o: tiara.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-tiara.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-tiara.Tpo" -c -o libdrivers_a-tiara.o `test -f 'tiara.c' || echo '$(srcdir)/'`tiara.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-tiara.Tpo" "$(DEPDIR)/libdrivers_a-tiara.Po"; else rm -f "$(DEPDIR)/libdrivers_a-tiara.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tiara.c' object='libdrivers_a-tiara.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-tiara.o `test -f 'tiara.c' || echo '$(srcdir)/'`tiara.c + +libdrivers_a-tiara.obj: tiara.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-tiara.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-tiara.Tpo" -c -o libdrivers_a-tiara.obj `if test -f 'tiara.c'; then $(CYGPATH_W) 'tiara.c'; else $(CYGPATH_W) '$(srcdir)/tiara.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-tiara.Tpo" "$(DEPDIR)/libdrivers_a-tiara.Po"; else rm -f "$(DEPDIR)/libdrivers_a-tiara.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tiara.c' object='libdrivers_a-tiara.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-tiara.obj `if test -f 'tiara.c'; then $(CYGPATH_W) 'tiara.c'; else $(CYGPATH_W) '$(srcdir)/tiara.c'; fi` + +libdrivers_a-tlan.o: tlan.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-tlan.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-tlan.Tpo" -c -o libdrivers_a-tlan.o `test -f 'tlan.c' || echo '$(srcdir)/'`tlan.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-tlan.Tpo" "$(DEPDIR)/libdrivers_a-tlan.Po"; else rm -f "$(DEPDIR)/libdrivers_a-tlan.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tlan.c' object='libdrivers_a-tlan.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-tlan.o `test -f 'tlan.c' || echo '$(srcdir)/'`tlan.c + +libdrivers_a-tlan.obj: tlan.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-tlan.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-tlan.Tpo" -c -o libdrivers_a-tlan.obj `if test -f 'tlan.c'; then $(CYGPATH_W) 'tlan.c'; else $(CYGPATH_W) '$(srcdir)/tlan.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-tlan.Tpo" "$(DEPDIR)/libdrivers_a-tlan.Po"; else rm -f "$(DEPDIR)/libdrivers_a-tlan.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tlan.c' object='libdrivers_a-tlan.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-tlan.obj `if test -f 'tlan.c'; then $(CYGPATH_W) 'tlan.c'; else $(CYGPATH_W) '$(srcdir)/tlan.c'; fi` + +libdrivers_a-tulip.o: tulip.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-tulip.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-tulip.Tpo" -c -o libdrivers_a-tulip.o `test -f 'tulip.c' || echo '$(srcdir)/'`tulip.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-tulip.Tpo" "$(DEPDIR)/libdrivers_a-tulip.Po"; else rm -f "$(DEPDIR)/libdrivers_a-tulip.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tulip.c' object='libdrivers_a-tulip.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-tulip.o `test -f 'tulip.c' || echo '$(srcdir)/'`tulip.c + +libdrivers_a-tulip.obj: tulip.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-tulip.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-tulip.Tpo" -c -o libdrivers_a-tulip.obj `if test -f 'tulip.c'; then $(CYGPATH_W) 'tulip.c'; else $(CYGPATH_W) '$(srcdir)/tulip.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-tulip.Tpo" "$(DEPDIR)/libdrivers_a-tulip.Po"; else rm -f "$(DEPDIR)/libdrivers_a-tulip.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tulip.c' object='libdrivers_a-tulip.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-tulip.obj `if test -f 'tulip.c'; then $(CYGPATH_W) 'tulip.c'; else $(CYGPATH_W) '$(srcdir)/tulip.c'; fi` + +libdrivers_a-via-rhine.o: via-rhine.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-via-rhine.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-via-rhine.Tpo" -c -o libdrivers_a-via-rhine.o `test -f 'via-rhine.c' || echo '$(srcdir)/'`via-rhine.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-via-rhine.Tpo" "$(DEPDIR)/libdrivers_a-via-rhine.Po"; else rm -f "$(DEPDIR)/libdrivers_a-via-rhine.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='via-rhine.c' object='libdrivers_a-via-rhine.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-via-rhine.o `test -f 'via-rhine.c' || echo '$(srcdir)/'`via-rhine.c + +libdrivers_a-via-rhine.obj: via-rhine.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-via-rhine.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-via-rhine.Tpo" -c -o libdrivers_a-via-rhine.obj `if test -f 'via-rhine.c'; then $(CYGPATH_W) 'via-rhine.c'; else $(CYGPATH_W) '$(srcdir)/via-rhine.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-via-rhine.Tpo" "$(DEPDIR)/libdrivers_a-via-rhine.Po"; else rm -f "$(DEPDIR)/libdrivers_a-via-rhine.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='via-rhine.c' object='libdrivers_a-via-rhine.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-via-rhine.obj `if test -f 'via-rhine.c'; then $(CYGPATH_W) 'via-rhine.c'; else $(CYGPATH_W) '$(srcdir)/via-rhine.c'; fi` + +libdrivers_a-w89c840.o: w89c840.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-w89c840.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-w89c840.Tpo" -c -o libdrivers_a-w89c840.o `test -f 'w89c840.c' || echo '$(srcdir)/'`w89c840.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-w89c840.Tpo" "$(DEPDIR)/libdrivers_a-w89c840.Po"; else rm -f "$(DEPDIR)/libdrivers_a-w89c840.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='w89c840.c' object='libdrivers_a-w89c840.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-w89c840.o `test -f 'w89c840.c' || echo '$(srcdir)/'`w89c840.c + +libdrivers_a-w89c840.obj: w89c840.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-w89c840.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-w89c840.Tpo" -c -o libdrivers_a-w89c840.obj `if test -f 'w89c840.c'; then $(CYGPATH_W) 'w89c840.c'; else $(CYGPATH_W) '$(srcdir)/w89c840.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-w89c840.Tpo" "$(DEPDIR)/libdrivers_a-w89c840.Po"; else rm -f "$(DEPDIR)/libdrivers_a-w89c840.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='w89c840.c' object='libdrivers_a-w89c840.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-w89c840.obj `if test -f 'w89c840.c'; then $(CYGPATH_W) 'w89c840.c'; else $(CYGPATH_W) '$(srcdir)/w89c840.c'; fi` +uninstall-info-am: + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LIBRARIES) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-noinstLIBRARIES ctags distclean distclean-compile \ + distclean-generic distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-man install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ + uninstall-am uninstall-info-am + + +# Is it really necessary to specify dependecies explicitly? +$(3c509_drivers): 3c509.c 3c509.h +$(3c509_drivers): %.o: 3c509.c + $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ + $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< + +$(3c595_drivers): 3c595.c 3c595.h +$(3c595_drivers): %.o: 3c595.c + $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ + $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< + +$(3c90x_drivers): 3c90x.c +$(3c90x_drivers): %.o: 3c90x.c + $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ + $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< + +$(cs89x0_drivers): cs89x0.c cs89x0.h +$(cs89x0_drivers): %.o: cs89x0.c + $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ + $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< + +$(davicom_drivers): davicom.c +$(davicom_drivers): %.o: davicom.c + $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ + $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< + +$(depca_drivers): depca.c +$(depca_drivers): %.o: depca.c + $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ + $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< + +$(eepro_drivers): eepro.c +$(eepro_drivers): %.o: eepro.c + $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ + $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< + +$(eepro100_drivers): eepro100.c +$(eepro100_drivers): %.o: eepro100.c + $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ + $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< + +$(epic100_drivers): epic100.c epic100.h +$(epic100_drivers): %.o: epic100.c + $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ + $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< + +#$(fa311_drivers): fa311.c +#$(fa311_drivers): %.o: fa311.c +# $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ +# $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< + +$(i82586_drivers): i82586.c +$(i82586_drivers): %.o: i82586.c + $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ + $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< + +$(lance_drivers): lance.c +$(lance_drivers): %.o: lance.c + $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ + $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< + +$(natsemi_drivers): natsemi.c +$(natsemi_drivers): %.o: natsemi.c + $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ + $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< + +$(ni5010_drivers): ni5010.c +$(ni5010_drivers): %.o: ni5010.c + $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ + $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< + +$(ns8390_drivers): ns8390.c ns8390.h +$(ns8390_drivers): %.o: ns8390.c + $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ + $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< + +$(otulip_drivers): otulip.c otulip.h +$(otulip_drivers): %.o: otulip.c + $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ + $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< + +$(rtl8139_drivers): rtl8139.c +$(rtl8139_drivers): %.o: rtl8139.c + $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ + $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< + +$(sis900_drivers): sis900.c +$(sis900_drivers): %.o: sis900.c sis900.h + $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ + $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< + +$(sk_g16_drivers): sk_g16.c sk_g16.h +$(sk_g16_drivers): %.o: sk_g16.c + $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ + $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< + +$(smc9000_drivers): smc9000.c smc9000.h +$(smc9000_drivers): %.o: smc9000.c + $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ + $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< + +$(tiara_drivers): tiara.c +$(tiara_drivers): %.o: tiara.c + $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ + $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< + +#$(tlan_drivers): tlan.c +#$(tlan_drivers): %.o: tlan.c +# $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ +# $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< + +$(tulip_drivers): tulip.c +$(tulip_drivers): %.o: tulip.c + $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ + $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< + +$(via_rhine_drivers): via-rhine.c +$(via_rhine_drivers): %.o: via-rhine.c + $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ + $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< + +$(w89c840_drivers): w89c840.c +$(w89c840_drivers): %.o: w89c840.c + $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ + $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $< +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/usr/src/grub/grub-0.97/netboot/Makefile.solaris b/usr/src/grub/grub-0.97/netboot/Makefile.solaris new file mode 100644 index 0000000000..af7687fe4f --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/Makefile.solaris @@ -0,0 +1,168 @@ +# +# Copyright 2005 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# ident "%Z%%M% %I% %E% SMI" +# +include ../../Makefile.grub +include ../Makefile.solaris.defs + +LIBDRIVERS = libdrivers.a + +LIBDRIVERS_OBJS = $(LIB_OBJS) $(DRIVER_OBJS) + +LIB_OBJS = libdrivers_a-basemem.o \ + libdrivers_a-config.o \ + libdrivers_a-fsys_tftp.o \ + libdrivers_a-i386_timer.o \ + libdrivers_a-misc.o \ + libdrivers_a-nic.o \ + libdrivers_a-pci.o \ + libdrivers_a-pci_io.o \ + libdrivers_a-pic8259.o \ + libdrivers_a-timer.o +$(LIB_OBJS) := CFLAGS = $(BASE_CFLAGS) -Os -fno-builtin -nostdinc \ + -DFSYS_TFTP=1 $(NET_CFLAGS) $(NET_EXTRAFLAGS) + +# +# The following netboot drivers are available. +# NOTE: Compiling too many netboot drivers into stage2 could cause GRUB to +# crash or misbehave. +# NOTE: NET_CFLAGS has to be adjusted to correspond to the drivers +# selected in $(DRIVER_OBJS). +# +# 3c595.o - 3Com595 driver +# 3c90x.o - 3Com90x driver +# davicom.o - Davicom driver +# e1000.o - Etherexpress Pro/1000 driver +# eepro100.o - Etherexpress Pro/100 driver +# epic100.o - SMC 83c170 EPIC/100 driver +# forcedeth.o - Nvidia Geforce driver +# natsemi.o - NatSemi DP8381x driver +# ns83820.o - NS83820 driver +# ns8390.o - NE2000 PCI driver +# pcnet32.o - AMD Lance/PCI PCNet/32 driver +# pnic.o - Bochs Pseudo Nic driver +# r8169.o - Realtek 8169 driver +# rtl8139.o - Realtek 8139 driver +# sis900.o - SIS 900 and SIS 7016 driver +# sundance.o - Sundance ST201 driver +# tg3.o - Broadcom Tigon3 driver +# tlan.o - TI ThunderLAN driver +# tulip.o - Tulip driver +# undi.o - PXE UNDI driver +# via-rhine.o - Rhine-I/II driver +# w89c840.o - Winbond W89c840 driver +# +DRIVER_OBJS = undi.o + +NET_CFLAGS = -DINCLUDE_UNDI=1 + +$(DRIVER_OBJS) := CFLAGS = $(BASE_CFLAGS) -Os -fno-builtin -nostdinc \ + $(NET_EXTRAFLAGS) $(DRIVER_DEFS) + +3c595.o := DRIVER_DEFS = -DINCLUDE_3C595=1 +3c90x.o := DRIVER_DEFS = -DINCLUDE_3C90X=1 +davicom.o := DRIVER_DEFS = -DINCLUDE_DAVICOM=1 +e1000.o := DRIVER_DEFS = -DINCLUDE_E1000=1 +eepro100.o := DRIVER_DEFS = -DINCLUDE_EEPRO100=1 +epic100.o := DRIVER_DEFS = -DINCLUDE_EPIC100=1 +forcedeth.o := DRIVER_DEFS = -DINCLUDE_FORCEDETH=1 +natsemi.o := DRIVER_DEFS = -DINCLUDE_NATSEMI=1 +ns83820.o := DRIVER_DEFS = -DINCLUDE_NS83820=1 +ns8390.o := DRIVER_DEFS = -DINCLUDE_NS8390=1 +pcnet32.o := DRIVER_DEFS = -DINCLUDE_PCNET32=1 +pnic.o := DRIVER_DEFS = -DINCLUDE_PNIC=1 +r8169.o := DRIVER_DEFS = -DINCLUDE_R8169=1 +rtl8139.o := DRIVER_DEFS = -DINCLUDE_RTL8139=1 +sis900.o := DRIVER_DEFS = -DINCLUDE_SIS900=1 +sundance.o := DRIVER_DEFS = -DINCLUDE_SUNDANCE=1 +tg3.o := DRIVER_DEFS = -DINCLUDE_TG3=1 +tlan.o := DRIVER_DEFS = -DINCLUDE_TLAN=1 +tulip.o := DRIVER_DEFS = -DINCLUDE_TULIP=1 +undi.o := DRIVER_DEFS = -DINCLUDE_UNDI=1 +via-rhine.o := DRIVER_DEFS = -DINCLUDE_VIA_RHINE=1 +w89c840.o := DRIVER_DEFS = -DINCLUDE_W89C840=1 + +3c595.o := DRIVER_SRC = 3c595.c +3c90x.o := DRIVER_SRC = 3c90x.c +davicom.o := DRIVER_SRC = davicom.c +e1000.o := DRIVER_SRC = e1000.c +eepro100.o := DRIVER_SRC = eepro100.c +epic100.o := DRIVER_SRC = epic100.c +forcedeth.o := DRIVER_SRC = forcedeth.c +natsemi.o := DRIVER_SRC = natsemi.c +ns83820.o := DRIVER_SRC = ns83820.c +ns8390.o := DRIVER_SRC = ns8390.c +pcnet32.o := DRIVER_SRC = pcnet32.c +pnic.o := DRIVER_SRC = pnic.c +r8169.o := DRIVER_SRC = r8169.c +rtl8139.o := DRIVER_SRC = rtl8139.c +sis900.o := DRIVER_SRC = sis900.c +sundance.o := DRIVER_SRC = sundance.c +tg3.o := DRIVER_SRC = tg3.c +tlan.o := DRIVER_SRC = tlan.c +tulip.o := DRIVER_SRC = tulip.c +undi.o := DRIVER_SRC = undi.c +via-rhine.o := DRIVER_SRC = via-rhine.c +w89c840.o := DRIVER_SRC = w89c840.c + + +INCLUDES = -I. -I.. -I../stage2 -I../stage1 + +NET_EXTRAFLAGS = -DCONFIG_PCI \ + -DCONFIG_PCI_DIRECT=1 \ + -DCONGESTED=1 \ + -DNE_SCAN=0x280,0x300,0x320,0x340 \ + -DWD_DEFAULT_MEM=0xCC000 + +# +# Source files to be installed in $(SRC_DIR). +# +SRC_DIR = $(ROOT_SRC)/netboot +SRC_FILES = Makefile.am Makefile.in README.netboot \ + 3c595.c 3c595.h 3c90x.c basemem.c big_bswap.h bootp.h \ + byteswap.h config.c cpu.h davicom.c dev.h e1000.c \ + e1000_hw.h eepro100.c elf.h endian.h epic100.c epic100.h \ + etherboot.h forcedeth.c fsys_tftp.c grub.h i386_byteswap.h \ + i386_elf.h i386_endian.h i386_timer.c if_arp.h if_ether.h \ + igmp.h in.h io.h ip.h isa.h latch.h little_bswap.h mii.h \ + misc.c natsemi.c nfs.h nic.c nic.h ns83820.c ns8390.c \ + ns8390.h osdep.h pci.c pci.h pci_ids.h pci_io.c pcnet32.c \ + pic8259.c pic8259.h pnic.c pnic_api.h pxe.h r8169.c \ + rtl8139.c segoff.h sis900.c sis900.h stdint.h sundance.c \ + tftp.h tg3.c tg3.h timer.c timer.h tlan.c tlan.h tulip.c \ + types.h udp.h undi.c undi.h via-rhine.c w89c840.c + +INSTALL_TARGETS = $(SRC_FILES:%=$(SRC_DIR)/%) + + +all: $(LIBDRIVERS) + +$(LIBDRIVERS): $(LIBDRIVERS_OBJS) + $(RM) $@ + $(AR) cru $@ $(LIBDRIVERS_OBJS) + $(RANLIB) $@ + +$(LIB_OBJS): $$(@:libdrivers_a-%.o=%.c) + $(CC) $(CFLAGS) -c -o $@ $(@:libdrivers_a-%.o=%.c) + +$(DRIVER_OBJS): $$(DRIVER_SRC) + $(CC) $(CFLAGS) -c -o $@ $(DRIVER_SRC) + + +install: all $(INSTALL_TARGETS) + +$(SRC_DIR)/%: $(SRC_DIR) % + $(INS.file) + +$(SRC_DIR): + $(INS.dir) + + +clean: _FORCE + $(RM) *.o $(LIBDRIVERS) + +clobber: clean + +_FORCE: diff --git a/usr/src/grub/grub-0.97/netboot/README.netboot b/usr/src/grub/grub-0.97/netboot/README.netboot new file mode 100644 index 0000000000..7edfaf02ec --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/README.netboot @@ -0,0 +1,168 @@ +You can use the netboot support to download OS images from a network. +Nearly all the device drivers are coming from the network-based boot +loader, Etherboot. Please visit its web page. They have rich +documentations so you will be able to get useful information from there. +The URL is . + +These below are common options for configure. Perhaps you may not need +to specify them. + +--disable-packet-retransmission + Turns off packet retransmission. Use it on an empty network, where + no packet collision can happen. + +--enable-pci-direct + Define this for PCI BIOSes that do not implement BIOS32 or not + correctly. + +--enable-diskless + Enable the diskless support. If specified, you will get two optional + images, called "nbgrub" and "pxegrub". The former is the ``Net Boot + Image Proposal'' format, which is used by Etherboot and Netboot, while + the latter is the ``Preboot Execution Environment" format, which is + used by a PXE ROM. You may buy a PXE ROM from some companies. + +Here is the information about the device drivers. They are all disabled +by default, so you must specify configure options to enable drivers you +want to use. Some drivers have extra per-driver options, so the extra +options are also described below. + +Caution: You should enable them as you need. Don't enable any +unnecessary driver, because GRUB might crash if you include too many +drivers at the same time. + +3Com509, ISA/EISA + --enable-3c509 + +3Com529 == MCA 3c509 + --enable-3c529 + +3Com59x and 3Com900 + --enable-3c595 + +3Com90x + --enable-3c90x + +Crystal Semiconductor CS89x0 + --enable-cs89x0 + --enable-cs-scan=LIST + Probe for CS89x0 base address using LIST of comma separated hex + addresses; increasing the address by one (0x300 -> 0x301) will force + a more aggressive probing algorithm. This might be neccessary after + a soft-reset of the NIC. + +Davicom DM9102 and 9009 + --enable-davicom + +Digital DE100 and DE200 + --enable-depca + +Intel Etherexpress Pro/10 (ISA card) + --enable-eepro + +Intel Etherexpress Pro/100 + --enable-eepro100 + +SMC 83c170 EPIC/100 + --enable-epic100 + +3Com507 + --enable-3c507 + +EXOS205 + --enable-exos205 + +Racal-Interlan NI5210 + --enable-ni5210 + +Lance PCI PCNet/32 +AMD HomePNA + --enable-lance + +Novell NE2100 and NE1500 + --enable-ne2100 + +Racal-Interlan NI6510 + --enable-ni6510 + +National Semiconductor DP8381x (Netgear FA311 and FA312) + --enable-natsemi + +Racal-Interlan NI5010 + --enable-ni5010 + +3Com503, aka Etherlink II, also /16 model + --enable-3c503 + --enable-3c503-shmem + Use 3c503 shared memory mode. + --enable-3c503-aui + Use AUI by default on 3c503 cards. + +NE1000/2000 and clones (ISA) + --enable-ne + --enable-ne-scan=LIST (0x280,0x300,0x320,0x340) + Probe for NE base address using LIST of comma separated hex + addresses. + +NE2000 PCI clone (RTL8029) +Winbond 86C940 +Compex RL2000 +KTI ET32P2 +NetVin 5000SC +Holtek 80232 + --enable-ns8390 + --enable-compex-rl2000-fix + If you have a Compex RL2000 PCI 32-bit (11F6:1401), and the probe + hangs in "Probing...[NE*000/PCI]", try enabling this fix... it + worked for me :). + +WD8003/8013, SMC8216/8416 + --enable-wd + --enable-wd-default-mem=MEM (0xCC000) + Default memory location for WD/SMC cards. + +Old base driver for Tulip clones + --enable-otulip + +Realtek 8139 +SMC 1211 +D-Link DFE530TX+ and DFE538TX + --enable-rtl8139 + +SIS 900 and SIS 7016 + --enable-sis900 + +Schneider and Koch G16 + --enable-sk-g16 + +SMC9000 + --enable-smc9000 + --enable-smc9000-scan=LIST + List of I/O addresses to probe. + +Tiara, Fujitsu Lancard + --enable-tiara + +Linksys LNE100TX and other NICs using this Tulip clone chip +Netgear FA310TX and other NICs using this Tulip clone chip +Tulip clones based on the ADMtek Centaur-P +Tulip clones based on the Macronix 987x5 +Tulip-Fast +Tulip+ +Tulip 21142 +ASIX AX88140 +Intel Tulip +Compex RL100-TX + --enable-tulip + +Rhine-I, e.g. D-Link DFE-530TX +Rhine-II + --enable-via-rhine + +Winbond W89c840 +Compex RL100-ATX + --enable-w89c840 + + +The description about how to use the support can be found in the GRUB +manual. Run "info grub" in the shell prompt. diff --git a/usr/src/grub/grub-0.97/netboot/basemem.c b/usr/src/grub/grub-0.97/netboot/basemem.c new file mode 100644 index 0000000000..ee99ab3b40 --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/basemem.c @@ -0,0 +1,178 @@ +#include "etherboot.h" +#define DEBUG_BASEMEM +/* Routines to allocate base memory in a BIOS-compatible way, by + * updating the Free Base Memory Size counter at 40:13h. + * + * Michael Brown (mcb30) + * $Id: basemem.c,v 1.5 2004/06/17 12:48:08 fengshuo Exp $ + */ + +#define fbms ( ( uint16_t * ) phys_to_virt ( 0x413 ) ) +#define BASE_MEMORY_MAX ( 640 ) +#define FREE_BLOCK_MAGIC ( ('!'<<0) + ('F'<<8) + ('R'<<16) + ('E'<<24) ) + +typedef struct free_base_memory_block { + uint32_t magic; + uint16_t size_kb; +} free_base_memory_block_t; + +/* Return amount of free base memory in bytes + */ + +uint32_t get_free_base_memory ( void ) { + return *fbms << 10; +} + +/* Adjust the real mode stack pointer. We keep the real mode stack at + * the top of free base memory, rather than allocating space for it. + */ + +static inline void adjust_real_mode_stack ( void ) { +/* real_mode_stack = ( *fbms << 10 ); */ +} + +/* Allocate N bytes of base memory. Amount allocated will be rounded + * up to the nearest kB, since that's the granularity of the BIOS FBMS + * counter. Returns NULL if memory cannot be allocated. + */ + +void * allot_base_memory ( size_t size ) { + uint16_t size_kb = ( size + 1023 ) >> 10; + void *ptr = NULL; + +#ifdef DEBUG_BASEMEM + printf ( "Trying to allocate %d kB of base memory, %d kB free\n", + size_kb, *fbms ); +#endif + + /* Free up any unused memory before we start */ + free_unused_base_memory(); + + /* Check available base memory */ + if ( size_kb > *fbms ) { return NULL; } + + /* Reduce available base memory */ + *fbms -= size_kb; + + /* Calculate address of memory allocated */ + ptr = phys_to_virt ( *fbms << 10 ); + +#ifdef DEBUG_BASEMEM + /* Zero out memory. We do this so that allocation of + * already-used space will show up in the form of a crash as + * soon as possible. + */ + memset ( ptr, 0, size_kb << 10 ); +#endif + + /* Adjust real mode stack pointer */ + adjust_real_mode_stack (); + + return ptr; +} + +/* Free base memory allocated by allot_base_memory. The BIOS provides + * nothing better than a LIFO mechanism for freeing memory (i.e. it + * just has the single "total free memory" counter), but we improve + * upon this slightly; as long as you free all the allotted blocks, it + * doesn't matter what order you free them in. (This will only work + * for blocks that are freed via forget_base_memory()). + * + * Yes, it's annoying that you have to remember the size of the blocks + * you've allotted. However, since our granularity of allocation is + * 1K, the alternative is to risk wasting the occasional kB of base + * memory, which is a Bad Thing. Really, you should be using as + * little base memory as possible, so consider the awkwardness of the + * API to be a feature! :-) + */ + +void forget_base_memory ( void *ptr, size_t size ) { + uint16_t remainder = virt_to_phys(ptr) & 1023; + uint16_t size_kb = ( size + remainder + 1023 ) >> 10; + free_base_memory_block_t *free_block = + ( free_base_memory_block_t * ) ( ptr - remainder ); + + if ( ( ptr == NULL ) || ( size == 0 ) ) { return; } + +#ifdef DEBUG_BASEMEM + printf ( "Trying to free %d bytes base memory at 0x%x\n", + size, virt_to_phys ( ptr ) ); + if ( remainder > 0 ) { + printf ( "WARNING: destructively expanding free block " + "downwards to 0x%x\n", + virt_to_phys ( ptr - remainder ) ); + } +#endif + + /* Mark every kilobyte within this block as free. This is + * overkill for normal purposes, but helps when something has + * allocated base memory with a granularity finer than the + * BIOS granularity of 1kB. PXE ROMs tend to do this when + * they allocate their own memory. This method allows us to + * free their blocks (admittedly in a rather dangerous, + * tread-on-anything-either-side sort of way, but there's no + * other way to do it). + * + * Since we're marking every kB as free, there's actually no + * need for recording the size of the blocks. However, we + * keep this in so that debug messages are friendlier. It + * probably adds around 8 bytes to the overall code size. + */ + while ( size_kb > 0 ) { + /* Mark this block as unused */ + free_block->magic = FREE_BLOCK_MAGIC; + free_block->size_kb = size_kb; + /* Move up by 1 kB */ + free_block = (void *)free_block + ( 1 << 10 ); + size_kb--; + } + + /* Free up unused base memory */ + free_unused_base_memory(); +} + +/* Do the actual freeing of memory. This is split out from + * forget_base_memory() so that it may be called separately. It + * should be called whenever base memory is deallocated by an external + * entity (if we can detect that it has done so) so that we get the + * chance to free up our own blocks. + */ +void free_unused_base_memory ( void ) { + free_base_memory_block_t *free_block = NULL; + + /* Try to release memory back to the BIOS. Free all + * consecutive blocks marked as free. + */ + while ( 1 ) { + /* Calculate address of next potential free block */ + free_block = ( free_base_memory_block_t * ) + phys_to_virt ( *fbms << 10 ); + + /* Stop processing if we're all the way up to 640K or + * if this is not a free block + */ + if ( ( *fbms == BASE_MEMORY_MAX ) || + ( free_block->magic != FREE_BLOCK_MAGIC ) ) { + break; + } + + /* Return memory to BIOS */ + *fbms += free_block->size_kb; + +#ifdef DEBUG_BASEMEM + printf ( "Freed %d kB base memory, %d kB now free\n", + free_block->size_kb, *fbms ); + + /* Zero out freed block. We do this in case + * the block contained any structures that + * might be located by scanning through + * memory. + */ + memset ( free_block, 0, free_block->size_kb << 10 ); +#endif + } + + /* Adjust real mode stack pointer */ + adjust_real_mode_stack (); +} + diff --git a/usr/src/grub/grub-0.97/netboot/big_bswap.h b/usr/src/grub/grub-0.97/netboot/big_bswap.h new file mode 100644 index 0000000000..66c3360e0a --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/big_bswap.h @@ -0,0 +1,17 @@ +#ifndef ETHERBOOT_BIG_BSWAP_H +#define ETHERBOOT_BIG_BSWAP_H + +#define ntohl(x) (x) +#define htonl(x) (x) +#define ntohs(x) (x) +#define htons(x) (x) +#define cpu_to_le32(x) __bswap_32(x) +#define cpu_to_le16(x) __bswap_16(x) +#define cpu_to_be32(x) (x) +#define cpu_to_be16(x) (x) +#define le32_to_cpu(x) __bswap_32(x) +#define le16_to_cpu(x) __bswap_16(x) +#define be32_to_cpu(x) (x) +#define be16_to_cpu(x) (x) + +#endif /* ETHERBOOT_BIG_BSWAP_H */ diff --git a/usr/src/grub/grub-0.97/netboot/bootp.h b/usr/src/grub/grub-0.97/netboot/bootp.h new file mode 100644 index 0000000000..c6f6088074 --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/bootp.h @@ -0,0 +1,182 @@ +#ifndef _BOOTP_H +#define _BOOTP_H + +#include "if_ether.h" +#include "ip.h" +#include "udp.h" + +#ifndef MAX_BOOTP_RETRIES +#define MAX_BOOTP_RETRIES 20 +#endif + +#ifdef ALTERNATE_DHCP_PORTS_1067_1068 +#undef NON_STANDARD_BOOTP_SERVER +#define NON_STANDARD_BOOTP_SERVER 1067 +#undef NON_STANDARD_BOOTP_CLIENT +#define NON_STANDARD_BOOTP_CLIENT 1068 +#endif + +#ifdef NON_STANDARD_BOOTP_SERVER +#define BOOTP_SERVER NON_STANDARD_BOOTP_SERVER +#else +#define BOOTP_SERVER 67 +#endif +#ifdef NON_STANDARD_BOOTP_CLIENT +#define BOOTP_CLIENT NON_STANDARD_BOOTP_CLIENT +#else +#define BOOTP_CLIENT 68 +#endif + +#define BOOTP_REQUEST 1 +#define BOOTP_REPLY 2 + +#define TAG_LEN(p) (*((p)+1)) +#define RFC1533_COOKIE 99, 130, 83, 99 +#define RFC1533_PAD 0 +#define RFC1533_NETMASK 1 +#define RFC1533_TIMEOFFSET 2 +#define RFC1533_GATEWAY 3 +#define RFC1533_TIMESERVER 4 +#define RFC1533_IEN116NS 5 +#define RFC1533_DNS 6 +#define RFC1533_LOGSERVER 7 +#define RFC1533_COOKIESERVER 8 +#define RFC1533_LPRSERVER 9 +#define RFC1533_IMPRESSSERVER 10 +#define RFC1533_RESOURCESERVER 11 +#define RFC1533_HOSTNAME 12 +#define RFC1533_BOOTFILESIZE 13 +#define RFC1533_MERITDUMPFILE 14 +#define RFC1533_DOMAINNAME 15 +#define RFC1533_SWAPSERVER 16 +#define RFC1533_ROOTPATH 17 +#define RFC1533_EXTENSIONPATH 18 +#define RFC1533_IPFORWARDING 19 +#define RFC1533_IPSOURCEROUTING 20 +#define RFC1533_IPPOLICYFILTER 21 +#define RFC1533_IPMAXREASSEMBLY 22 +#define RFC1533_IPTTL 23 +#define RFC1533_IPMTU 24 +#define RFC1533_IPMTUPLATEAU 25 +#define RFC1533_INTMTU 26 +#define RFC1533_INTLOCALSUBNETS 27 +#define RFC1533_INTBROADCAST 28 +#define RFC1533_INTICMPDISCOVER 29 +#define RFC1533_INTICMPRESPOND 30 +#define RFC1533_INTROUTEDISCOVER 31 +#define RFC1533_INTROUTESOLICIT 32 +#define RFC1533_INTSTATICROUTES 33 +#define RFC1533_LLTRAILERENCAP 34 +#define RFC1533_LLARPCACHETMO 35 +#define RFC1533_LLETHERNETENCAP 36 +#define RFC1533_TCPTTL 37 +#define RFC1533_TCPKEEPALIVETMO 38 +#define RFC1533_TCPKEEPALIVEGB 39 +#define RFC1533_NISDOMAIN 40 +#define RFC1533_NISSERVER 41 +#define RFC1533_NTPSERVER 42 +#define RFC1533_VENDOR 43 +#define RFC1533_NBNS 44 +#define RFC1533_NBDD 45 +#define RFC1533_NBNT 46 +#define RFC1533_NBSCOPE 47 +#define RFC1533_XFS 48 +#define RFC1533_XDM 49 +#ifndef NO_DHCP_SUPPORT +#define RFC2132_REQ_ADDR 50 +#define RFC2132_MSG_TYPE 53 +#define RFC2132_SRV_ID 54 +#define RFC2132_PARAM_LIST 55 +#define RFC2132_MAX_SIZE 57 +#define RFC2132_VENDOR_CLASS_ID 60 + +#define DHCPDISCOVER 1 +#define DHCPOFFER 2 +#define DHCPREQUEST 3 +#define DHCPACK 5 +#endif /* NO_DHCP_SUPPORT */ + +#define RFC1533_VENDOR_MAJOR 0 +#define RFC1533_VENDOR_MINOR 0 + +#define RFC1533_VENDOR_MAGIC 128 +#define RFC1533_VENDOR_ADDPARM 129 +#define RFC1533_VENDOR_ETHDEV 130 +#ifdef IMAGE_FREEBSD +#define RFC1533_VENDOR_HOWTO 132 +#define RFC1533_VENDOR_KERNEL_ENV 133 +#endif +#define RFC1533_VENDOR_ETHERBOOT_ENCAP 150 +#define RFC1533_VENDOR_MNUOPTS 160 +#define RFC1533_VENDOR_NIC_DEV_ID 175 +#define RFC1533_VENDOR_SELECTION 176 +#define RFC1533_VENDOR_ARCH 177 +#define RFC1533_VENDOR_MOTD 184 +#define RFC1533_VENDOR_NUMOFMOTD 8 +#define RFC1533_VENDOR_IMG 192 +#define RFC1533_VENDOR_NUMOFIMG 16 + +#define RFC1533_VENDOR_CONFIGFILE 150 + +#define RFC1533_END 255 + +#define BOOTP_VENDOR_LEN 64 + +#define DHCP_OPT_LEN 312 + +/* Format of a bootp packet */ +struct bootp_t { + uint8_t bp_op; + uint8_t bp_htype; + uint8_t bp_hlen; + uint8_t bp_hops; + uint32_t bp_xid; + uint16_t bp_secs; + uint16_t unused; + in_addr bp_ciaddr; + in_addr bp_yiaddr; + in_addr bp_siaddr; + in_addr bp_giaddr; + uint8_t bp_hwaddr[16]; + uint8_t bp_sname[64]; + char bp_file[128]; + uint8_t bp_vend[BOOTP_VENDOR_LEN]; +}; + +struct dhcp_t { + uint8_t bp_op; + uint8_t bp_htype; + uint8_t bp_hlen; + uint8_t bp_hops; + uint32_t bp_xid; + uint16_t bp_secs; + uint16_t bp_flag; + in_addr bp_ciaddr; + in_addr bp_yiaddr; + in_addr bp_siaddr; + in_addr bp_giaddr; + uint8_t bp_hwaddr[16]; + uint8_t bp_sname[64]; + char bp_file[128]; + uint8_t bp_vend[DHCP_OPT_LEN]; +}; + +/* Format of a bootp IP packet */ +struct bootpip_t +{ + struct iphdr ip; + struct udphdr udp; + struct bootp_t bp; +}; +struct dhcpip_t +{ + struct iphdr ip; + struct udphdr udp; + struct dhcp_t bp; +}; + +#define MAX_RFC1533_VENDLEN (ETH_MAX_MTU - sizeof(struct bootpip_t) + BOOTP_VENDOR_LEN) + +#define BOOTP_DATA_ADDR (&bootp_data) + +#endif /* _BOOTP_H */ diff --git a/usr/src/grub/grub-0.97/netboot/byteswap.h b/usr/src/grub/grub-0.97/netboot/byteswap.h new file mode 100644 index 0000000000..d9bef934fc --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/byteswap.h @@ -0,0 +1,20 @@ +#ifndef ETHERBOOT_BYTESWAP_H +#define ETHERBOOT_BYTESWAP_H + +#include "endian.h" +#include "i386_byteswap.h" + +#if __BYTE_ORDER == __LITTLE_ENDIAN +#include "little_bswap.h" +#endif +#if __BYTE_ORDER == __BIG_ENDIAN +#include "big_bswap.h" +#endif + +/* Make routines available to all */ +#define swap32(x) __bswap_32(x) +#define swap16(x) __bswap_16(x) +#define bswap_32(x) __bswap_32(x) +#define bswap_16(x) __bswap_16(x) + +#endif /* ETHERBOOT_BYTESWAP_H */ diff --git a/usr/src/grub/grub-0.97/netboot/config.c b/usr/src/grub/grub-0.97/netboot/config.c new file mode 100644 index 0000000000..39f70c474d --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/config.c @@ -0,0 +1,165 @@ +/* + * 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. + */ + +#include "grub.h" +#include "pci.h" +#include "isa.h" +#include "nic.h" + +#ifdef CONFIG_PCI +static int pci_probe(struct dev *dev, const char *type_name) +{ +/* + * NIC probing is in pci device order, followed by the + * link order of the drivers. A driver that matches + * on vendor and device id will supersede a driver + * that matches on pci class. + * + * If you want to probe for another device behind the same pci + * device just increment index. And the previous probe call + * will be repeated. + */ + struct pci_probe_state *state = &dev->state.pci; + printf("Probing pci %s...\n", type_name); + if (dev->how_probe == PROBE_FIRST) { + state->advance = 1; + state->dev.driver = 0; + state->dev.bus = 0; + state->dev.devfn = 0; + dev->index = -1; + } + for(;;) { + if ((dev->how_probe != PROBE_AWAKE) && state->advance) { + find_pci(dev->type, &state->dev); + dev->index = -1; + } + state->advance = 1; + + if (state->dev.driver == 0) + break; + +#if 0 + /* FIXME the romaddr code needs a total rethought to be useful */ + if (state->dev.romaddr != ((unsigned long) rom.rom_segment << 4)) { + continue; + } +#endif + if (dev->how_probe != PROBE_AWAKE) { + dev->type_index++; + } + dev->devid.bus_type = PCI_BUS_TYPE; + dev->devid.vendor_id = htons(state->dev.vendor); + dev->devid.device_id = htons(state->dev.dev_id); + /* FIXME how do I handle dev->index + PROBE_AGAIN?? */ + + printf("[%s]", state->dev.name); + if (state->dev.driver->probe(dev, &state->dev)) { + state->advance = (dev->index == -1); + return PROBE_WORKED; + } + putchar('\n'); + } + return PROBE_FAILED; +} +#endif + +#ifdef CONFIG_ISA +static int isa_probe(struct dev *dev, const char *type_name) +{ +/* + * NIC probing is in the order the drivers were linked togeter. + * If for some reason you want to change the order, + * just change the order you list the drivers in. + */ + struct isa_probe_state *state = &dev->state.isa; + printf("Probing isa %s...\n", type_name); + if (dev->how_probe == PROBE_FIRST) { + state->advance = 0; + state->driver = isa_drivers; + dev->index = -1; + } + for(;;) + { + if ((dev->how_probe != PROBE_AWAKE) && state->advance) { + state->driver++; + dev->index = -1; + } + state->advance = 1; + + if (state->driver >= isa_drivers_end) + break; + + if (state->driver->type != dev->type) + continue; + + if (dev->how_probe != PROBE_AWAKE) { + dev->type_index++; + } + printf("[%s]", state->driver->name); + dev->devid.bus_type = ISA_BUS_TYPE; + /* FIXME how do I handle dev->index + PROBE_AGAIN?? */ + /* driver will fill in vendor and device IDs */ + if (state->driver->probe(dev, state->driver->ioaddrs)) { + state->advance = (dev->index == -1); + return PROBE_WORKED; + } + putchar('\n'); + } + return PROBE_FAILED; +} +#else +#define isa_probe(d,tn) (PROBE_FAILED) +#endif +static const char *driver_name[] = { + "nic", + "disk", + "floppy", +}; +int probe(struct dev *dev) +{ + const char *type_name; + + EnterFunction("probe"); + + type_name = ""; + if ((dev->type >= 0) && + (dev->type < sizeof(driver_name)/sizeof(driver_name[0]))) { + type_name = driver_name[dev->type]; + } + if (dev->how_probe == PROBE_FIRST) { + dev->to_probe = PROBE_PCI; + memset(&dev->state, 0, sizeof(dev->state)); + } + if (dev->to_probe == PROBE_PCI) { + dev->how_probe = pci_probe(dev, type_name); + if (dev->how_probe == PROBE_FAILED) { + dev->to_probe = PROBE_ISA; + } + } + if (dev->to_probe == PROBE_ISA) { + dev->how_probe = isa_probe(dev, type_name); + if (dev->how_probe == PROBE_FAILED) { + dev->to_probe = PROBE_NONE; + } + } + if ((dev->to_probe != PROBE_PCI) && + (dev->to_probe != PROBE_ISA)) { + dev->how_probe = PROBE_FAILED; + + } + + LeaveFunction("probe"); + return dev->how_probe; +} + +void disable(struct dev *dev) +{ + if (dev->disable) { + dev->disable(dev); + dev->disable = 0; + } +} diff --git a/usr/src/grub/grub-0.97/netboot/cpu.h b/usr/src/grub/grub-0.97/netboot/cpu.h new file mode 100644 index 0000000000..2e9b27ba91 --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/cpu.h @@ -0,0 +1,243 @@ +#ifndef I386_BITS_CPU_H +#define I386_BITS_CPU_H + + +/* Sample usage: CPU_FEATURE_P(cpu.x86_capability, FPU) */ +#define CPU_FEATURE_P(CAP, FEATURE) \ + (!!(CAP[(X86_FEATURE_##FEATURE)/32] & ((X86_FEATURE_##FEATURE) & 0x1f))) + +#define NCAPINTS 4 /* Currently we have 4 32-bit words worth of info */ + +/* Intel-defined CPU features, CPUID level 0x00000001, word 0 */ +#define X86_FEATURE_FPU (0*32+ 0) /* Onboard FPU */ +#define X86_FEATURE_VME (0*32+ 1) /* Virtual Mode Extensions */ +#define X86_FEATURE_DE (0*32+ 2) /* Debugging Extensions */ +#define X86_FEATURE_PSE (0*32+ 3) /* Page Size Extensions */ +#define X86_FEATURE_TSC (0*32+ 4) /* Time Stamp Counter */ +#define X86_FEATURE_MSR (0*32+ 5) /* Model-Specific Registers, RDMSR, WRMSR */ +#define X86_FEATURE_PAE (0*32+ 6) /* Physical Address Extensions */ +#define X86_FEATURE_MCE (0*32+ 7) /* Machine Check Architecture */ +#define X86_FEATURE_CX8 (0*32+ 8) /* CMPXCHG8 instruction */ +#define X86_FEATURE_APIC (0*32+ 9) /* Onboard APIC */ +#define X86_FEATURE_SEP (0*32+11) /* SYSENTER/SYSEXIT */ +#define X86_FEATURE_MTRR (0*32+12) /* Memory Type Range Registers */ +#define X86_FEATURE_PGE (0*32+13) /* Page Global Enable */ +#define X86_FEATURE_MCA (0*32+14) /* Machine Check Architecture */ +#define X86_FEATURE_CMOV (0*32+15) /* CMOV instruction (FCMOVCC and FCOMI too if FPU present) */ +#define X86_FEATURE_PAT (0*32+16) /* Page Attribute Table */ +#define X86_FEATURE_PSE36 (0*32+17) /* 36-bit PSEs */ +#define X86_FEATURE_PN (0*32+18) /* Processor serial number */ +#define X86_FEATURE_CLFLSH (0*32+19) /* Supports the CLFLUSH instruction */ +#define X86_FEATURE_DTES (0*32+21) /* Debug Trace Store */ +#define X86_FEATURE_ACPI (0*32+22) /* ACPI via MSR */ +#define X86_FEATURE_MMX (0*32+23) /* Multimedia Extensions */ +#define X86_FEATURE_FXSR (0*32+24) /* FXSAVE and FXRSTOR instructions (fast save and restore */ + /* of FPU context), and CR4.OSFXSR available */ +#define X86_FEATURE_XMM (0*32+25) /* Streaming SIMD Extensions */ +#define X86_FEATURE_XMM2 (0*32+26) /* Streaming SIMD Extensions-2 */ +#define X86_FEATURE_SELFSNOOP (0*32+27) /* CPU self snoop */ +#define X86_FEATURE_HT (0*32+28) /* Hyper-Threading */ +#define X86_FEATURE_ACC (0*32+29) /* Automatic clock control */ +#define X86_FEATURE_IA64 (0*32+30) /* IA-64 processor */ + +/* AMD-defined CPU features, CPUID level 0x80000001, word 1 */ +/* Don't duplicate feature flags which are redundant with Intel! */ +#define X86_FEATURE_SYSCALL (1*32+11) /* SYSCALL/SYSRET */ +#define X86_FEATURE_MMXEXT (1*32+22) /* AMD MMX extensions */ +#define X86_FEATURE_LM (1*32+29) /* Long Mode (x86-64) */ +#define X86_FEATURE_3DNOWEXT (1*32+30) /* AMD 3DNow! extensions */ +#define X86_FEATURE_3DNOW (1*32+31) /* 3DNow! */ + +/* Transmeta-defined CPU features, CPUID level 0x80860001, word 2 */ +#define X86_FEATURE_RECOVERY (2*32+ 0) /* CPU in recovery mode */ +#define X86_FEATURE_LONGRUN (2*32+ 1) /* Longrun power control */ +#define X86_FEATURE_LRTI (2*32+ 3) /* LongRun table interface */ + +/* Other features, Linux-defined mapping, word 3 */ +/* This range is used for feature bits which conflict or are synthesized */ +#define X86_FEATURE_CXMMX (3*32+ 0) /* Cyrix MMX extensions */ +#define X86_FEATURE_K6_MTRR (3*32+ 1) /* AMD K6 nonstandard MTRRs */ +#define X86_FEATURE_CYRIX_ARR (3*32+ 2) /* Cyrix ARRs (= MTRRs) */ +#define X86_FEATURE_CENTAUR_MCR (3*32+ 3) /* Centaur MCRs (= MTRRs) */ + +#define MAX_X86_VENDOR_ID 16 +struct cpuinfo_x86 { + uint8_t x86; /* CPU family */ + uint8_t x86_model; + uint8_t x86_mask; + + int cpuid_level; /* Maximum supported CPUID level, -1=no CPUID */ + unsigned x86_capability[NCAPINTS]; + char x86_vendor_id[MAX_X86_VENDOR_ID]; +}; + + +#define X86_VENDOR_INTEL 0 +#define X86_VENDOR_CYRIX 1 +#define X86_VENDOR_AMD 2 +#define X86_VENDOR_UMC 3 +#define X86_VENDOR_NEXGEN 4 +#define X86_VENDOR_CENTAUR 5 +#define X86_VENDOR_RISE 6 +#define X86_VENDOR_TRANSMETA 7 +#define X86_VENDOR_NSC 8 +#define X86_VENDOR_UNKNOWN 0xff + +/* + * EFLAGS bits + */ +#define X86_EFLAGS_CF 0x00000001 /* Carry Flag */ +#define X86_EFLAGS_PF 0x00000004 /* Parity Flag */ +#define X86_EFLAGS_AF 0x00000010 /* Auxillary carry Flag */ +#define X86_EFLAGS_ZF 0x00000040 /* Zero Flag */ +#define X86_EFLAGS_SF 0x00000080 /* Sign Flag */ +#define X86_EFLAGS_TF 0x00000100 /* Trap Flag */ +#define X86_EFLAGS_IF 0x00000200 /* Interrupt Flag */ +#define X86_EFLAGS_DF 0x00000400 /* Direction Flag */ +#define X86_EFLAGS_OF 0x00000800 /* Overflow Flag */ +#define X86_EFLAGS_IOPL 0x00003000 /* IOPL mask */ +#define X86_EFLAGS_NT 0x00004000 /* Nested Task */ +#define X86_EFLAGS_RF 0x00010000 /* Resume Flag */ +#define X86_EFLAGS_VM 0x00020000 /* Virtual Mode */ +#define X86_EFLAGS_AC 0x00040000 /* Alignment Check */ +#define X86_EFLAGS_VIF 0x00080000 /* Virtual Interrupt Flag */ +#define X86_EFLAGS_VIP 0x00100000 /* Virtual Interrupt Pending */ +#define X86_EFLAGS_ID 0x00200000 /* CPUID detection flag */ + +/* + * Generic CPUID function + */ +static inline void cpuid(int op, + unsigned int *eax, unsigned int *ebx, unsigned int *ecx, unsigned int *edx) +{ + __asm__("cpuid" + : "=a" (*eax), + "=b" (*ebx), + "=c" (*ecx), + "=d" (*edx) + : "0" (op)); +} + +/* + * CPUID functions returning a single datum + */ +static inline unsigned int cpuid_eax(unsigned int op) +{ + unsigned int eax; + + __asm__("cpuid" + : "=a" (eax) + : "0" (op) + : "bx", "cx", "dx"); + return eax; +} +static inline unsigned int cpuid_ebx(unsigned int op) +{ + unsigned int eax, ebx; + + __asm__("cpuid" + : "=a" (eax), "=b" (ebx) + : "0" (op) + : "cx", "dx" ); + return ebx; +} +static inline unsigned int cpuid_ecx(unsigned int op) +{ + unsigned int eax, ecx; + + __asm__("cpuid" + : "=a" (eax), "=c" (ecx) + : "0" (op) + : "bx", "dx" ); + return ecx; +} +static inline unsigned int cpuid_edx(unsigned int op) +{ + unsigned int eax, edx; + + __asm__("cpuid" + : "=a" (eax), "=d" (edx) + : "0" (op) + : "bx", "cx"); + return edx; +} + +/* + * Intel CPU features in CR4 + */ +#define X86_CR4_VME 0x0001 /* enable vm86 extensions */ +#define X86_CR4_PVI 0x0002 /* virtual interrupts flag enable */ +#define X86_CR4_TSD 0x0004 /* disable time stamp at ipl 3 */ +#define X86_CR4_DE 0x0008 /* enable debugging extensions */ +#define X86_CR4_PSE 0x0010 /* enable page size extensions */ +#define X86_CR4_PAE 0x0020 /* enable physical address extensions */ +#define X86_CR4_MCE 0x0040 /* Machine check enable */ +#define X86_CR4_PGE 0x0080 /* enable global pages */ +#define X86_CR4_PCE 0x0100 /* enable performance counters at ipl 3 */ +#define X86_CR4_OSFXSR 0x0200 /* enable fast FPU save and restore */ +#define X86_CR4_OSXMMEXCPT 0x0400 /* enable unmasked SSE exceptions */ + + +#define MSR_K6_EFER 0xC0000080 +/* EFER bits: */ +#define _EFER_SCE 0 /* SYSCALL/SYSRET */ +#define _EFER_LME 8 /* Long mode enable */ +#define _EFER_LMA 10 /* Long mode active (read-only) */ +#define _EFER_NX 11 /* No execute enable */ + +#define EFER_SCE (1<<_EFER_SCE) +#define EFER_LME (1<0; i=i>>1) + phy_write_1bit(io_dcr9, phy_addr&i ? PHY_DATA_1: PHY_DATA_0); + + /* Send register addres */ + for (i=0x10; i>0; i=i>>1) + phy_write_1bit(io_dcr9, location&i ? PHY_DATA_1: PHY_DATA_0); + + /* Skip transition state */ + phy_read_1bit(io_dcr9); + + /* read 16bit data */ + for (phy_data=0, i=0; i<16; i++) { + phy_data<<=1; + phy_data|=phy_read_1bit(io_dcr9); + } + + return phy_data; +} + +/* + Write a word to Phy register +*/ +static void phy_write(int location, u16 phy_data) +{ + u16 i, phy_addr=1; + u32 io_dcr9; + + whereami("phy_write\n"); + + io_dcr9 = ioaddr + CSR9; + + /* Send 33 synchronization clock to Phy controller */ + for (i=0; i<34; i++) + phy_write_1bit(io_dcr9, PHY_DATA_1); + + /* Send start command(01) to Phy */ + phy_write_1bit(io_dcr9, PHY_DATA_0); + phy_write_1bit(io_dcr9, PHY_DATA_1); + + /* Send write command(01) to Phy */ + phy_write_1bit(io_dcr9, PHY_DATA_0); + phy_write_1bit(io_dcr9, PHY_DATA_1); + + /* Send Phy addres */ + for (i=0x10; i>0; i=i>>1) + phy_write_1bit(io_dcr9, phy_addr&i ? PHY_DATA_1: PHY_DATA_0); + + /* Send register addres */ + for (i=0x10; i>0; i=i>>1) + phy_write_1bit(io_dcr9, location&i ? PHY_DATA_1: PHY_DATA_0); + + /* written trasnition */ + phy_write_1bit(io_dcr9, PHY_DATA_1); + phy_write_1bit(io_dcr9, PHY_DATA_0); + + /* Write a word data to PHY controller */ + for (i=0x8000; i>0; i>>=1) + phy_write_1bit(io_dcr9, phy_data&i ? PHY_DATA_1: PHY_DATA_0); +} + +/* + Write one bit data to Phy Controller +*/ +static void phy_write_1bit(u32 ee_addr, u32 phy_data) +{ + whereami("phy_write_1bit\n"); + outl(phy_data, ee_addr); /* MII Clock Low */ + eeprom_delay(); + outl(phy_data|MDCLKH, ee_addr); /* MII Clock High */ + eeprom_delay(); + outl(phy_data, ee_addr); /* MII Clock Low */ + eeprom_delay(); +} + +/* + Read one bit phy data from PHY controller +*/ +static int phy_read_1bit(u32 ee_addr) +{ + int phy_data; + + whereami("phy_read_1bit\n"); + + outl(0x50000, ee_addr); + eeprom_delay(); + + phy_data=(inl(ee_addr)>>19) & 0x1; + + outl(0x40000, ee_addr); + eeprom_delay(); + + return phy_data; +} + +/* + DM9801/DM9802 present check and program +*/ +static void HPNA_process(void) +{ + + if ( (phy_read(3) & 0xfff0) == 0xb900 ) { + if ( phy_read(31) == 0x4404 ) { + /* DM9801 present */ + if (phy_read(3) == 0xb901) + phy_write(16, 0x5); /* DM9801 E4 */ + else + phy_write(16, 0x1005); /* DM9801 E3 and others */ + phy_write(25, ((phy_read(24) + 3) & 0xff) | 0xf000); + } else { + /* DM9802 present */ + phy_write(16, 0x5); + phy_write(25, (phy_read(25) & 0xff00) + 2); + } + } +} + +/* + Sense media mode and set CR6 +*/ +static void davicom_media_chk(struct nic * nic __unused) +{ + unsigned long to, csr6; + + csr6 = 0x00200000; /* SF */ + outl(csr6, ioaddr + CSR6); + + if (vendor == PCI_VENDOR_ID_DAVICOM && dev_id == PCI_DEVICE_ID_DM9009) { + /* Set to 10BaseT mode for DM9009 */ + phy_write(0, 0); + } else { + /* For DM9102/DM9102A */ + to = currticks() + 2 * TICKS_PER_SEC; + while ( ((phy_read(1) & 0x24)!=0x24) && (currticks() < to)) + /* wait */ ; + + if ( (phy_read(1) & 0x24) == 0x24 ) { + if (phy_read(17) & 0xa000) + csr6 |= 0x00000200; /* Full Duplex mode */ + } else + csr6 |= 0x00040000; /* Select DM9801/DM9802 when Ethernet link failed */ + } + + /* set the chip's operating mode */ + outl(csr6, ioaddr + CSR6); + + /* DM9801/DM9802 present check & program */ + if (csr6 & 0x40000) + HPNA_process(); +} + + +/*********************************************************************/ +/* EEPROM Reading Code */ +/*********************************************************************/ +/* EEPROM routines adapted from the Linux Tulip Code */ +/* Reading a serial EEPROM is a "bit" grungy, but we work our way + through:->. +*/ +static int read_eeprom(unsigned long ioaddr, int location, int addr_len) +{ + int i; + unsigned short retval = 0; + long ee_addr = ioaddr + CSR9; + int read_cmd = location | EE_READ_CMD; + + whereami("read_eeprom\n"); + + outl(EE_ENB & ~EE_CS, ee_addr); + outl(EE_ENB, ee_addr); + + /* Shift the read command bits out. */ + for (i = 4 + addr_len; i >= 0; i--) { + short dataval = (read_cmd & (1 << i)) ? EE_DATA_WRITE : 0; + outl(EE_ENB | dataval, ee_addr); + eeprom_delay(); + outl(EE_ENB | dataval | EE_SHIFT_CLK, ee_addr); + eeprom_delay(); + } + outl(EE_ENB, ee_addr); + + for (i = 16; i > 0; i--) { + outl(EE_ENB | EE_SHIFT_CLK, ee_addr); + eeprom_delay(); + retval = (retval << 1) | ((inl(ee_addr) & EE_DATA_READ) ? 1 : 0); + outl(EE_ENB, ee_addr); + eeprom_delay(); + } + + /* Terminate the EEPROM access. */ + outl(EE_ENB & ~EE_CS, ee_addr); + return retval; +} + +/*********************************************************************/ +/* davicom_init_chain - setup the tx and rx descriptors */ +/* Sten 10/9 */ +/*********************************************************************/ +static void davicom_init_chain(struct nic *nic) +{ + int i; + + /* setup the transmit descriptor */ + /* Sten: Set 2 TX descriptor but use one TX buffer because + it transmit a packet and wait complete every time. */ + for (i=0; inode_addr[0]; + txb[1] = nic->node_addr[1]; + txb[4] = nic->node_addr[2]; + txb[5] = nic->node_addr[3]; + txb[8] = nic->node_addr[4]; + txb[9] = nic->node_addr[5]; + + /* setup receive descriptor */ + for (i=0; i= to) { + printf ("TX Setup Timeout!\n"); + } + /* Point to next TX descriptor */ + TxPtr = (++TxPtr >= NTXD) ? 0:TxPtr; /* Sten 10/9 */ + +#ifdef DAVICOM_DEBUG + printf("txd.status = %X\n", txd.status); + printf("ticks = %d\n", currticks() - (to - TX_TIME_OUT)); + davicom_more(); +#endif + + /* enable RX */ + outl(inl(ioaddr + CSR6) | 0x00000002, ioaddr + CSR6); + /* immediate poll demand */ + outl(0, ioaddr + CSR2); +} + + +/*********************************************************************/ +/* eth_transmit - Transmit a frame */ +/*********************************************************************/ +static void davicom_transmit(struct nic *nic, const char *d, unsigned int t, + unsigned int s, const char *p) +{ + unsigned long to; + + whereami("davicom_transmit\n"); + + /* Stop Tx */ + /* outl(inl(ioaddr + CSR6) & ~0x00002000, ioaddr + CSR6); */ + + /* setup ethernet header */ + memcpy(&txb[0], d, ETH_ALEN); /* DA 6byte */ + memcpy(&txb[ETH_ALEN], nic->node_addr, ETH_ALEN); /* SA 6byte*/ + txb[ETH_ALEN*2] = (t >> 8) & 0xFF; /* Frame type: 2byte */ + txb[ETH_ALEN*2+1] = t & 0xFF; + memcpy(&txb[ETH_HLEN], p, s); /* Frame data */ + + /* setup the transmit descriptor */ + txd[TxPtr].buf1sz = ETH_HLEN+s; + txd[TxPtr].control = 0x00000184; /* LS+FS+CE */ + txd[TxPtr].status = 0x80000000; /* give ownership to device */ + + /* immediate transmit demand */ + outl(0, ioaddr + CSR1); + + to = currticks() + TX_TIME_OUT; + while ((txd[TxPtr].status & 0x80000000) && (currticks() < to)) + /* wait */ ; + + if (currticks() >= to) { + printf ("TX Timeout!\n"); + } + + /* Point to next TX descriptor */ + TxPtr = (++TxPtr >= NTXD) ? 0:TxPtr; /* Sten 10/9 */ + +} + +/*********************************************************************/ +/* eth_poll - Wait for a frame */ +/*********************************************************************/ +static int davicom_poll(struct nic *nic, int retrieve) +{ + whereami("davicom_poll\n"); + + if (rxd[rxd_tail].status & 0x80000000) + return 0; + + if ( ! retrieve ) return 1; + + whereami("davicom_poll got one\n"); + + nic->packetlen = (rxd[rxd_tail].status & 0x3FFF0000) >> 16; + + if( rxd[rxd_tail].status & 0x00008000){ + rxd[rxd_tail].status = 0x80000000; + rxd_tail++; + if (rxd_tail == NRXD) rxd_tail = 0; + return 0; + } + + /* copy packet to working buffer */ + /* XXX - this copy could be avoided with a little more work + but for now we are content with it because the optimised + memcpy is quite fast */ + + memcpy(nic->packet, rxb + rxd_tail * BUFLEN, nic->packetlen); + + /* return the descriptor and buffer to receive ring */ + rxd[rxd_tail].status = 0x80000000; + rxd_tail++; + if (rxd_tail == NRXD) rxd_tail = 0; + + return 1; +} + +/*********************************************************************/ +/* eth_disable - Disable the interface */ +/*********************************************************************/ +static void davicom_disable(struct dev *dev) +{ + struct nic *nic = (struct nic *)dev; + whereami("davicom_disable\n"); + + davicom_reset(nic); + + /* disable interrupts */ + outl(0x00000000, ioaddr + CSR7); + + /* Stop the chip's Tx and Rx processes. */ + outl(inl(ioaddr + CSR6) & ~0x00002002, ioaddr + CSR6); + + /* Clear the missed-packet counter. */ + (volatile unsigned long)inl(ioaddr + CSR8); +} + + +/*********************************************************************/ +/* eth_irq - enable, disable and force interrupts */ +/*********************************************************************/ +static void davicom_irq(struct nic *nic __unused, irq_action_t action __unused) +{ + switch ( action ) { + case DISABLE : + break; + case ENABLE : + break; + case FORCE : + break; + } +} + + +/*********************************************************************/ +/* eth_probe - Look for an adapter */ +/*********************************************************************/ +static int davicom_probe(struct dev *dev, struct pci_device *pci) +{ + struct nic *nic = (struct nic *)dev; + unsigned int i; + + whereami("davicom_probe\n"); + + if (pci->ioaddr == 0) + return 0; + + vendor = pci->vendor; + dev_id = pci->dev_id; + ioaddr = pci->ioaddr & ~3; + + nic->irqno = 0; + nic->ioaddr = pci->ioaddr & ~3; + + /* wakeup chip */ + pcibios_write_config_dword(pci->bus, pci->devfn, 0x40, 0x00000000); + + /* Stop the chip's Tx and Rx processes. */ + outl(inl(ioaddr + CSR6) & ~0x00002002, ioaddr + CSR6); + + /* Clear the missed-packet counter. */ + (volatile unsigned long)inl(ioaddr + CSR8); + + /* Get MAC Address */ + /* read EEPROM data */ + for (i = 0; i < sizeof(ee_data)/2; i++) + ((unsigned short *)ee_data)[i] = + le16_to_cpu(read_eeprom(ioaddr, i, EEPROM_ADDRLEN)); + + /* extract MAC address from EEPROM buffer */ + for (i=0; inode_addr[i] = ee_data[20+i]; + + printf("Davicom %! at ioaddr %#hX\n", nic->node_addr, ioaddr); + + /* initialize device */ + davicom_reset(nic); + + dev->disable = davicom_disable; + nic->poll = davicom_poll; + nic->transmit = davicom_transmit; + nic->irq = davicom_irq; + + return 1; +} + +static struct pci_id davicom_nics[] = { +PCI_ROM(0x1282, 0x9100, "davicom9100", "Davicom 9100"), +PCI_ROM(0x1282, 0x9102, "davicom9102", "Davicom 9102"), +PCI_ROM(0x1282, 0x9009, "davicom9009", "Davicom 9009"), +PCI_ROM(0x1282, 0x9132, "davicom9132", "Davicom 9132"), /* Needs probably some fixing */ +}; + +struct pci_driver davicom_driver = { + .type = NIC_DRIVER, + .name = "DAVICOM", + .probe = davicom_probe, + .ids = davicom_nics, + .id_count = sizeof(davicom_nics)/sizeof(davicom_nics[0]), + .class = 0, +}; diff --git a/usr/src/grub/grub-0.97/netboot/dev.h b/usr/src/grub/grub-0.97/netboot/dev.h new file mode 100644 index 0000000000..5578e8ef0c --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/dev.h @@ -0,0 +1,83 @@ +#ifndef _DEV_H +#define _DEV_H + +#include "isa.h" +#include "pci.h" + +/* Need to check the packing of this struct if Etherboot is ported */ +struct dev_id +{ + unsigned short vendor_id; + unsigned short device_id; + unsigned char bus_type; +#define PCI_BUS_TYPE 1 +#define ISA_BUS_TYPE 2 +}; + +/* Dont use sizeof, that will include the padding */ +#define DEV_ID_SIZE 8 + + +struct pci_probe_state +{ +#ifdef CONFIG_PCI + struct pci_device dev; + int advance; +#else + int dummy; +#endif +}; +struct isa_probe_state +{ +#ifdef CONFIG_ISA + const struct isa_driver *driver; + int advance; +#else + int dummy; +#endif +}; + +union probe_state +{ + struct pci_probe_state pci; + struct isa_probe_state isa; +}; + +struct dev +{ + void (*disable)P((struct dev *)); + struct dev_id devid; /* device ID string (sent to DHCP server) */ + int index; /* Index of next device on this controller to probe */ + int type; /* Type of device I am probing for */ + int how_probe; /* First, next or awake */ + int to_probe; /* Flavor of device I am probing */ + int failsafe; /* Failsafe probe requested */ + int type_index; /* Index of this device (within type) */ +#define PROBE_NONE 0 +#define PROBE_PCI 1 +#define PROBE_ISA 2 + union probe_state state; +}; + + +#define NIC_DRIVER 0 +#define DISK_DRIVER 1 +#define FLOPPY_DRIVER 2 + +#define BRIDGE_DRIVER 1000 + +#define PROBE_FIRST (-1) +#define PROBE_NEXT 0 +#define PROBE_AWAKE 1 /* After calling disable bring up the same device */ + +/* The probe result codes are selected + * to allow them to be fed back into the probe + * routine and get a successful probe. + */ +#define PROBE_FAILED PROBE_FIRST +#define PROBE_WORKED PROBE_NEXT + +extern int probe(struct dev *dev); +extern void disable(struct dev *dev); + +#endif /* _DEV_H */ diff --git a/usr/src/grub/grub-0.97/netboot/e1000.c b/usr/src/grub/grub-0.97/netboot/e1000.c new file mode 100644 index 0000000000..ad88420863 --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/e1000.c @@ -0,0 +1,3682 @@ +/************************************************************************** +Etherboot - BOOTP/TFTP Bootstrap Program +Inter Pro 1000 for Etherboot +Drivers are port from Intel's Linux driver e1000-4.3.15 + +***************************************************************************/ +/******************************************************************************* + + + Copyright(c) 1999 - 2003 Intel 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 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. + + The full GNU General Public License is included in this distribution in the + file called LICENSE. + + Contact Information: + Linux NICS + Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 + +*******************************************************************************/ +/* + * Copyright (C) Archway Digital Solutions. + * + * written by Chrsitopher Li or + * 2/9/2002 + * + * Copyright (C) Linux Networx. + * Massive upgrade to work with the new intel gigabit NICs. + * + * + * Support for 82541ei & 82547ei chips from Intel's Linux driver 5.1.13 added by + * Georg Baum , sponsored by PetaMem GmbH and linkLINE Communications, Inc. + * + * 01/2004: Updated to Linux driver 5.2.22 by Georg Baum + */ + +/* to get some global routines like printf */ +#include "etherboot.h" +/* to get the interface to the body of the program */ +#include "nic.h" +/* to get the PCI support functions, if this is a PCI NIC */ +#include "pci.h" +#include "timer.h" + +typedef unsigned char *dma_addr_t; + +typedef enum { + FALSE = 0, + TRUE = 1 +} boolean_t; + +#define DEBUG 0 + + +/* Some pieces of code are disabled with #if 0 ... #endif. + * They are not deleted to show where the etherboot driver differs + * from the linux driver below the function level. + * Some member variables of the hw struct have been eliminated + * and the corresponding inplace checks inserted instead. + * Pieces such as LED handling that we definitely don't need are deleted. + * + * The following defines should not be needed normally, + * but may be helpful for debugging purposes. */ + +/* Define this if you want to program the transmission control register + * the way the Linux driver does it. */ +#undef LINUX_DRIVER_TCTL + +/* Define this to behave more like the Linux driver. */ +#undef LINUX_DRIVER + +#include "e1000_hw.h" + +/* NIC specific static variables go here */ +static struct e1000_hw hw; +static char tx_pool[128 + 16]; +static char rx_pool[128 + 16]; +static char packet[2096]; + +static struct e1000_tx_desc *tx_base; +static struct e1000_rx_desc *rx_base; + +static int tx_tail; +static int rx_tail, rx_last; + +/* Function forward declarations */ +static int e1000_setup_link(struct e1000_hw *hw); +static int e1000_setup_fiber_serdes_link(struct e1000_hw *hw); +static int e1000_setup_copper_link(struct e1000_hw *hw); +static int e1000_phy_setup_autoneg(struct e1000_hw *hw); +static void e1000_config_collision_dist(struct e1000_hw *hw); +static int e1000_config_mac_to_phy(struct e1000_hw *hw); +static int e1000_config_fc_after_link_up(struct e1000_hw *hw); +static int e1000_check_for_link(struct e1000_hw *hw); +static int e1000_wait_autoneg(struct e1000_hw *hw); +static void e1000_get_speed_and_duplex(struct e1000_hw *hw, uint16_t *speed, uint16_t *duplex); +static int e1000_read_phy_reg(struct e1000_hw *hw, uint32_t reg_addr, uint16_t *phy_data); +static int e1000_read_phy_reg_ex(struct e1000_hw *hw, uint32_t reg_addr, uint16_t *phy_data); +static int e1000_write_phy_reg(struct e1000_hw *hw, uint32_t reg_addr, uint16_t phy_data); +static int e1000_write_phy_reg_ex(struct e1000_hw *hw, uint32_t reg_addr, uint16_t phy_data); +static void e1000_phy_hw_reset(struct e1000_hw *hw); +static int e1000_phy_reset(struct e1000_hw *hw); +static int e1000_detect_gig_phy(struct e1000_hw *hw); + +/* Printing macros... */ + +#define E1000_ERR(args...) printf("e1000: " args) + +#if DEBUG >= 3 +#define E1000_DBG(args...) printf("e1000: " args) +#else +#define E1000_DBG(args...) +#endif + +#define MSGOUT(S, A, B) printk(S "\n", A, B) +#if DEBUG >= 2 +#define DEBUGFUNC(F) DEBUGOUT(F "\n"); +#else +#define DEBUGFUNC(F) +#endif +#if DEBUG >= 1 +#define DEBUGOUT(S) printf(S) +#define DEBUGOUT1(S,A) printf(S,A) +#define DEBUGOUT2(S,A,B) printf(S,A,B) +#define DEBUGOUT3(S,A,B,C) printf(S,A,B,C) +#define DEBUGOUT7(S,A,B,C,D,E,F,G) printf(S,A,B,C,D,E,F,G) +#else +#define DEBUGOUT(S) +#define DEBUGOUT1(S,A) +#define DEBUGOUT2(S,A,B) +#define DEBUGOUT3(S,A,B,C) +#define DEBUGOUT7(S,A,B,C,D,E,F,G) +#endif + +#define E1000_WRITE_REG(a, reg, value) ( \ + ((a)->mac_type >= e1000_82543) ? \ + (writel((value), ((a)->hw_addr + E1000_##reg))) : \ + (writel((value), ((a)->hw_addr + E1000_82542_##reg)))) + +#define E1000_READ_REG(a, reg) ( \ + ((a)->mac_type >= e1000_82543) ? \ + readl((a)->hw_addr + E1000_##reg) : \ + readl((a)->hw_addr + E1000_82542_##reg)) + +#define E1000_WRITE_REG_ARRAY(a, reg, offset, value) ( \ + ((a)->mac_type >= e1000_82543) ? \ + writel((value), ((a)->hw_addr + E1000_##reg + ((offset) << 2))) : \ + writel((value), ((a)->hw_addr + E1000_82542_##reg + ((offset) << 2)))) + +#define E1000_READ_REG_ARRAY(a, reg, offset) ( \ + ((a)->mac_type >= e1000_82543) ? \ + readl((a)->hw_addr + E1000_##reg + ((offset) << 2)) : \ + readl((a)->hw_addr + E1000_82542_##reg + ((offset) << 2))) + +#define E1000_WRITE_FLUSH(a) {uint32_t x; x = E1000_READ_REG(a, STATUS);} + +uint32_t +e1000_io_read(struct e1000_hw *hw __unused, uint32_t port) +{ + return inl(port); +} + +void +e1000_io_write(struct e1000_hw *hw __unused, uint32_t port, uint32_t value) +{ + outl(value, port); +} + +static inline void e1000_pci_set_mwi(struct e1000_hw *hw) +{ + pci_write_config_word(hw->pdev, PCI_COMMAND, hw->pci_cmd_word); +} + +static inline void e1000_pci_clear_mwi(struct e1000_hw *hw) +{ + pci_write_config_word(hw->pdev, PCI_COMMAND, + hw->pci_cmd_word & ~PCI_COMMAND_INVALIDATE); +} + +/****************************************************************************** + * Raises the EEPROM's clock input. + * + * hw - Struct containing variables accessed by shared code + * eecd - EECD's current value + *****************************************************************************/ +static void +e1000_raise_ee_clk(struct e1000_hw *hw, + uint32_t *eecd) +{ + /* Raise the clock input to the EEPROM (by setting the SK bit), and then + * wait microseconds. + */ + *eecd = *eecd | E1000_EECD_SK; + E1000_WRITE_REG(hw, EECD, *eecd); + E1000_WRITE_FLUSH(hw); + udelay(hw->eeprom.delay_usec); +} + +/****************************************************************************** + * Lowers the EEPROM's clock input. + * + * hw - Struct containing variables accessed by shared code + * eecd - EECD's current value + *****************************************************************************/ +static void +e1000_lower_ee_clk(struct e1000_hw *hw, + uint32_t *eecd) +{ + /* Lower the clock input to the EEPROM (by clearing the SK bit), and then + * wait 50 microseconds. + */ + *eecd = *eecd & ~E1000_EECD_SK; + E1000_WRITE_REG(hw, EECD, *eecd); + E1000_WRITE_FLUSH(hw); + udelay(hw->eeprom.delay_usec); +} + +/****************************************************************************** + * Shift data bits out to the EEPROM. + * + * hw - Struct containing variables accessed by shared code + * data - data to send to the EEPROM + * count - number of bits to shift out + *****************************************************************************/ +static void +e1000_shift_out_ee_bits(struct e1000_hw *hw, + uint16_t data, + uint16_t count) +{ + struct e1000_eeprom_info *eeprom = &hw->eeprom; + uint32_t eecd; + uint32_t mask; + + /* We need to shift "count" bits out to the EEPROM. So, value in the + * "data" parameter will be shifted out to the EEPROM one bit at a time. + * In order to do this, "data" must be broken down into bits. + */ + mask = 0x01 << (count - 1); + eecd = E1000_READ_REG(hw, EECD); + if (eeprom->type == e1000_eeprom_microwire) { + eecd &= ~E1000_EECD_DO; + } else if (eeprom->type == e1000_eeprom_spi) { + eecd |= E1000_EECD_DO; + } + do { + /* A "1" is shifted out to the EEPROM by setting bit "DI" to a "1", + * and then raising and then lowering the clock (the SK bit controls + * the clock input to the EEPROM). A "0" is shifted out to the EEPROM + * by setting "DI" to "0" and then raising and then lowering the clock. + */ + eecd &= ~E1000_EECD_DI; + + if(data & mask) + eecd |= E1000_EECD_DI; + + E1000_WRITE_REG(hw, EECD, eecd); + E1000_WRITE_FLUSH(hw); + + udelay(eeprom->delay_usec); + + e1000_raise_ee_clk(hw, &eecd); + e1000_lower_ee_clk(hw, &eecd); + + mask = mask >> 1; + + } while(mask); + + /* We leave the "DI" bit set to "0" when we leave this routine. */ + eecd &= ~E1000_EECD_DI; + E1000_WRITE_REG(hw, EECD, eecd); +} + +/****************************************************************************** + * Shift data bits in from the EEPROM + * + * hw - Struct containing variables accessed by shared code + *****************************************************************************/ +static uint16_t +e1000_shift_in_ee_bits(struct e1000_hw *hw, + uint16_t count) +{ + uint32_t eecd; + uint32_t i; + uint16_t data; + + /* In order to read a register from the EEPROM, we need to shift 'count' + * bits in from the EEPROM. Bits are "shifted in" by raising the clock + * input to the EEPROM (setting the SK bit), and then reading the value of + * the "DO" bit. During this "shifting in" process the "DI" bit should + * always be clear. + */ + + eecd = E1000_READ_REG(hw, EECD); + + eecd &= ~(E1000_EECD_DO | E1000_EECD_DI); + data = 0; + + for(i = 0; i < count; i++) { + data = data << 1; + e1000_raise_ee_clk(hw, &eecd); + + eecd = E1000_READ_REG(hw, EECD); + + eecd &= ~(E1000_EECD_DI); + if(eecd & E1000_EECD_DO) + data |= 1; + + e1000_lower_ee_clk(hw, &eecd); + } + + return data; +} + +/****************************************************************************** + * Prepares EEPROM for access + * + * hw - Struct containing variables accessed by shared code + * + * Lowers EEPROM clock. Clears input pin. Sets the chip select pin. This + * function should be called before issuing a command to the EEPROM. + *****************************************************************************/ +static int32_t +e1000_acquire_eeprom(struct e1000_hw *hw) +{ + struct e1000_eeprom_info *eeprom = &hw->eeprom; + uint32_t eecd, i=0; + + eecd = E1000_READ_REG(hw, EECD); + + /* Request EEPROM Access */ + if(hw->mac_type > e1000_82544) { + eecd |= E1000_EECD_REQ; + E1000_WRITE_REG(hw, EECD, eecd); + eecd = E1000_READ_REG(hw, EECD); + while((!(eecd & E1000_EECD_GNT)) && + (i < E1000_EEPROM_GRANT_ATTEMPTS)) { + i++; + udelay(5); + eecd = E1000_READ_REG(hw, EECD); + } + if(!(eecd & E1000_EECD_GNT)) { + eecd &= ~E1000_EECD_REQ; + E1000_WRITE_REG(hw, EECD, eecd); + DEBUGOUT("Could not acquire EEPROM grant\n"); + return -E1000_ERR_EEPROM; + } + } + + /* Setup EEPROM for Read/Write */ + + if (eeprom->type == e1000_eeprom_microwire) { + /* Clear SK and DI */ + eecd &= ~(E1000_EECD_DI | E1000_EECD_SK); + E1000_WRITE_REG(hw, EECD, eecd); + + /* Set CS */ + eecd |= E1000_EECD_CS; + E1000_WRITE_REG(hw, EECD, eecd); + } else if (eeprom->type == e1000_eeprom_spi) { + /* Clear SK and CS */ + eecd &= ~(E1000_EECD_CS | E1000_EECD_SK); + E1000_WRITE_REG(hw, EECD, eecd); + udelay(1); + } + + return E1000_SUCCESS; +} + +/****************************************************************************** + * Returns EEPROM to a "standby" state + * + * hw - Struct containing variables accessed by shared code + *****************************************************************************/ +static void +e1000_standby_eeprom(struct e1000_hw *hw) +{ + struct e1000_eeprom_info *eeprom = &hw->eeprom; + uint32_t eecd; + + eecd = E1000_READ_REG(hw, EECD); + + if(eeprom->type == e1000_eeprom_microwire) { + + /* Deselect EEPROM */ + eecd &= ~(E1000_EECD_CS | E1000_EECD_SK); + E1000_WRITE_REG(hw, EECD, eecd); + E1000_WRITE_FLUSH(hw); + udelay(eeprom->delay_usec); + + /* Clock high */ + eecd |= E1000_EECD_SK; + E1000_WRITE_REG(hw, EECD, eecd); + E1000_WRITE_FLUSH(hw); + udelay(eeprom->delay_usec); + + /* Select EEPROM */ + eecd |= E1000_EECD_CS; + E1000_WRITE_REG(hw, EECD, eecd); + E1000_WRITE_FLUSH(hw); + udelay(eeprom->delay_usec); + + /* Clock low */ + eecd &= ~E1000_EECD_SK; + E1000_WRITE_REG(hw, EECD, eecd); + E1000_WRITE_FLUSH(hw); + udelay(eeprom->delay_usec); + } else if(eeprom->type == e1000_eeprom_spi) { + /* Toggle CS to flush commands */ + eecd |= E1000_EECD_CS; + E1000_WRITE_REG(hw, EECD, eecd); + E1000_WRITE_FLUSH(hw); + udelay(eeprom->delay_usec); + eecd &= ~E1000_EECD_CS; + E1000_WRITE_REG(hw, EECD, eecd); + E1000_WRITE_FLUSH(hw); + udelay(eeprom->delay_usec); + } +} + +/****************************************************************************** + * Terminates a command by inverting the EEPROM's chip select pin + * + * hw - Struct containing variables accessed by shared code + *****************************************************************************/ +static void +e1000_release_eeprom(struct e1000_hw *hw) +{ + uint32_t eecd; + + eecd = E1000_READ_REG(hw, EECD); + + if (hw->eeprom.type == e1000_eeprom_spi) { + eecd |= E1000_EECD_CS; /* Pull CS high */ + eecd &= ~E1000_EECD_SK; /* Lower SCK */ + + E1000_WRITE_REG(hw, EECD, eecd); + + udelay(hw->eeprom.delay_usec); + } else if(hw->eeprom.type == e1000_eeprom_microwire) { + /* cleanup eeprom */ + + /* CS on Microwire is active-high */ + eecd &= ~(E1000_EECD_CS | E1000_EECD_DI); + + E1000_WRITE_REG(hw, EECD, eecd); + + /* Rising edge of clock */ + eecd |= E1000_EECD_SK; + E1000_WRITE_REG(hw, EECD, eecd); + E1000_WRITE_FLUSH(hw); + udelay(hw->eeprom.delay_usec); + + /* Falling edge of clock */ + eecd &= ~E1000_EECD_SK; + E1000_WRITE_REG(hw, EECD, eecd); + E1000_WRITE_FLUSH(hw); + udelay(hw->eeprom.delay_usec); + } + + /* Stop requesting EEPROM access */ + if(hw->mac_type > e1000_82544) { + eecd &= ~E1000_EECD_REQ; + E1000_WRITE_REG(hw, EECD, eecd); + } +} + +/****************************************************************************** + * Reads a 16 bit word from the EEPROM. + * + * hw - Struct containing variables accessed by shared code + *****************************************************************************/ +static int32_t +e1000_spi_eeprom_ready(struct e1000_hw *hw) +{ + uint16_t retry_count = 0; + uint8_t spi_stat_reg; + + /* Read "Status Register" repeatedly until the LSB is cleared. The + * EEPROM will signal that the command has been completed by clearing + * bit 0 of the internal status register. If it's not cleared within + * 5 milliseconds, then error out. + */ + retry_count = 0; + do { + e1000_shift_out_ee_bits(hw, EEPROM_RDSR_OPCODE_SPI, + hw->eeprom.opcode_bits); + spi_stat_reg = (uint8_t)e1000_shift_in_ee_bits(hw, 8); + if (!(spi_stat_reg & EEPROM_STATUS_RDY_SPI)) + break; + + udelay(5); + retry_count += 5; + + } while(retry_count < EEPROM_MAX_RETRY_SPI); + + /* ATMEL SPI write time could vary from 0-20mSec on 3.3V devices (and + * only 0-5mSec on 5V devices) + */ + if(retry_count >= EEPROM_MAX_RETRY_SPI) { + DEBUGOUT("SPI EEPROM Status error\n"); + return -E1000_ERR_EEPROM; + } + + return E1000_SUCCESS; +} + +/****************************************************************************** + * Reads a 16 bit word from the EEPROM. + * + * hw - Struct containing variables accessed by shared code + * offset - offset of word in the EEPROM to read + * data - word read from the EEPROM + * words - number of words to read + *****************************************************************************/ +static int +e1000_read_eeprom(struct e1000_hw *hw, + uint16_t offset, + uint16_t words, + uint16_t *data) +{ + struct e1000_eeprom_info *eeprom = &hw->eeprom; + uint32_t i = 0; + + DEBUGFUNC("e1000_read_eeprom"); + + /* A check for invalid values: offset too large, too many words, and not + * enough words. + */ + if((offset > eeprom->word_size) || (words > eeprom->word_size - offset) || + (words == 0)) { + DEBUGOUT("\"words\" parameter out of bounds\n"); + return -E1000_ERR_EEPROM; + } + + /* Prepare the EEPROM for reading */ + if(e1000_acquire_eeprom(hw) != E1000_SUCCESS) + return -E1000_ERR_EEPROM; + + if(eeprom->type == e1000_eeprom_spi) { + uint16_t word_in; + uint8_t read_opcode = EEPROM_READ_OPCODE_SPI; + + if(e1000_spi_eeprom_ready(hw)) { + e1000_release_eeprom(hw); + return -E1000_ERR_EEPROM; + } + + e1000_standby_eeprom(hw); + + /* Some SPI eeproms use the 8th address bit embedded in the opcode */ + if((eeprom->address_bits == 8) && (offset >= 128)) + read_opcode |= EEPROM_A8_OPCODE_SPI; + + /* Send the READ command (opcode + addr) */ + e1000_shift_out_ee_bits(hw, read_opcode, eeprom->opcode_bits); + e1000_shift_out_ee_bits(hw, (uint16_t)(offset*2), eeprom->address_bits); + + /* Read the data. The address of the eeprom internally increments with + * each byte (spi) being read, saving on the overhead of eeprom setup + * and tear-down. The address counter will roll over if reading beyond + * the size of the eeprom, thus allowing the entire memory to be read + * starting from any offset. */ + for (i = 0; i < words; i++) { + word_in = e1000_shift_in_ee_bits(hw, 16); + data[i] = (word_in >> 8) | (word_in << 8); + } + } else if(eeprom->type == e1000_eeprom_microwire) { + for (i = 0; i < words; i++) { + /* Send the READ command (opcode + addr) */ + e1000_shift_out_ee_bits(hw, EEPROM_READ_OPCODE_MICROWIRE, + eeprom->opcode_bits); + e1000_shift_out_ee_bits(hw, (uint16_t)(offset + i), + eeprom->address_bits); + + /* Read the data. For microwire, each word requires the overhead + * of eeprom setup and tear-down. */ + data[i] = e1000_shift_in_ee_bits(hw, 16); + e1000_standby_eeprom(hw); + } + } + + /* End this read operation */ + e1000_release_eeprom(hw); + + return E1000_SUCCESS; +} + +/****************************************************************************** + * Verifies that the EEPROM has a valid checksum + * + * hw - Struct containing variables accessed by shared code + * + * Reads the first 64 16 bit words of the EEPROM and sums the values read. + * If the the sum of the 64 16 bit words is 0xBABA, the EEPROM's checksum is + * valid. + *****************************************************************************/ +static int +e1000_validate_eeprom_checksum(struct e1000_hw *hw) +{ + uint16_t checksum = 0; + uint16_t i, eeprom_data; + + DEBUGFUNC("e1000_validate_eeprom_checksum"); + + for(i = 0; i < (EEPROM_CHECKSUM_REG + 1); i++) { + if(e1000_read_eeprom(hw, i, 1, &eeprom_data) < 0) { + DEBUGOUT("EEPROM Read Error\n"); + return -E1000_ERR_EEPROM; + } + checksum += eeprom_data; + } + + if(checksum == (uint16_t) EEPROM_SUM) + return E1000_SUCCESS; + else { + DEBUGOUT("EEPROM Checksum Invalid\n"); + return -E1000_ERR_EEPROM; + } +} + +/****************************************************************************** + * Reads the adapter's MAC address from the EEPROM and inverts the LSB for the + * second function of dual function devices + * + * hw - Struct containing variables accessed by shared code + *****************************************************************************/ +static int +e1000_read_mac_addr(struct e1000_hw *hw) +{ + uint16_t offset; + uint16_t eeprom_data; + int i; + + DEBUGFUNC("e1000_read_mac_addr"); + + for(i = 0; i < NODE_ADDRESS_SIZE; i += 2) { + offset = i >> 1; + if(e1000_read_eeprom(hw, offset, 1, &eeprom_data) < 0) { + DEBUGOUT("EEPROM Read Error\n"); + return -E1000_ERR_EEPROM; + } + hw->mac_addr[i] = eeprom_data & 0xff; + hw->mac_addr[i+1] = (eeprom_data >> 8) & 0xff; + } + if(((hw->mac_type == e1000_82546) || (hw->mac_type == e1000_82546_rev_3)) && + (E1000_READ_REG(hw, STATUS) & E1000_STATUS_FUNC_1)) + /* Invert the last bit if this is the second device */ + hw->mac_addr[5] ^= 1; + return E1000_SUCCESS; +} + +/****************************************************************************** + * Initializes receive address filters. + * + * hw - Struct containing variables accessed by shared code + * + * Places the MAC address in receive address register 0 and clears the rest + * of the receive addresss registers. Clears the multicast table. Assumes + * the receiver is in reset when the routine is called. + *****************************************************************************/ +static void +e1000_init_rx_addrs(struct e1000_hw *hw) +{ + uint32_t i; + uint32_t addr_low; + uint32_t addr_high; + + DEBUGFUNC("e1000_init_rx_addrs"); + + /* Setup the receive address. */ + DEBUGOUT("Programming MAC Address into RAR[0]\n"); + addr_low = (hw->mac_addr[0] | + (hw->mac_addr[1] << 8) | + (hw->mac_addr[2] << 16) | (hw->mac_addr[3] << 24)); + + addr_high = (hw->mac_addr[4] | + (hw->mac_addr[5] << 8) | E1000_RAH_AV); + + E1000_WRITE_REG_ARRAY(hw, RA, 0, addr_low); + E1000_WRITE_REG_ARRAY(hw, RA, 1, addr_high); + + /* Zero out the other 15 receive addresses. */ + DEBUGOUT("Clearing RAR[1-15]\n"); + for(i = 1; i < E1000_RAR_ENTRIES; i++) { + E1000_WRITE_REG_ARRAY(hw, RA, (i << 1), 0); + E1000_WRITE_REG_ARRAY(hw, RA, ((i << 1) + 1), 0); + } +} + +/****************************************************************************** + * Clears the VLAN filer table + * + * hw - Struct containing variables accessed by shared code + *****************************************************************************/ +static void +e1000_clear_vfta(struct e1000_hw *hw) +{ + uint32_t offset; + + for(offset = 0; offset < E1000_VLAN_FILTER_TBL_SIZE; offset++) + E1000_WRITE_REG_ARRAY(hw, VFTA, offset, 0); +} + +/****************************************************************************** +* Writes a value to one of the devices registers using port I/O (as opposed to +* memory mapped I/O). Only 82544 and newer devices support port I/O. * +* hw - Struct containing variables accessed by shared code +* offset - offset to write to * value - value to write +*****************************************************************************/ +void e1000_write_reg_io(struct e1000_hw *hw, uint32_t offset, uint32_t value){ + uint32_t io_addr = hw->io_base; + uint32_t io_data = hw->io_base + 4; + e1000_io_write(hw, io_addr, offset); + e1000_io_write(hw, io_data, value); +} + +/****************************************************************************** + * Set the phy type member in the hw struct. + * + * hw - Struct containing variables accessed by shared code + *****************************************************************************/ +static int32_t +e1000_set_phy_type(struct e1000_hw *hw) +{ + DEBUGFUNC("e1000_set_phy_type"); + + switch(hw->phy_id) { + case M88E1000_E_PHY_ID: + case M88E1000_I_PHY_ID: + case M88E1011_I_PHY_ID: + hw->phy_type = e1000_phy_m88; + break; + case IGP01E1000_I_PHY_ID: + hw->phy_type = e1000_phy_igp; + break; + default: + /* Should never have loaded on this device */ + hw->phy_type = e1000_phy_undefined; + return -E1000_ERR_PHY_TYPE; + } + + return E1000_SUCCESS; +} + +/****************************************************************************** + * IGP phy init script - initializes the GbE PHY + * + * hw - Struct containing variables accessed by shared code + *****************************************************************************/ +static void +e1000_phy_init_script(struct e1000_hw *hw) +{ + DEBUGFUNC("e1000_phy_init_script"); + +#if 0 + /* See e1000_sw_init() of the Linux driver */ + if(hw->phy_init_script) { +#else + if((hw->mac_type == e1000_82541) || + (hw->mac_type == e1000_82547) || + (hw->mac_type == e1000_82541_rev_2) || + (hw->mac_type == e1000_82547_rev_2)) { +#endif + mdelay(20); + + e1000_write_phy_reg(hw,0x0000,0x0140); + + mdelay(5); + + if(hw->mac_type == e1000_82541 || hw->mac_type == e1000_82547) { + e1000_write_phy_reg(hw, 0x1F95, 0x0001); + + e1000_write_phy_reg(hw, 0x1F71, 0xBD21); + + e1000_write_phy_reg(hw, 0x1F79, 0x0018); + + e1000_write_phy_reg(hw, 0x1F30, 0x1600); + + e1000_write_phy_reg(hw, 0x1F31, 0x0014); + + e1000_write_phy_reg(hw, 0x1F32, 0x161C); + + e1000_write_phy_reg(hw, 0x1F94, 0x0003); + + e1000_write_phy_reg(hw, 0x1F96, 0x003F); + + e1000_write_phy_reg(hw, 0x2010, 0x0008); + } else { + e1000_write_phy_reg(hw, 0x1F73, 0x0099); + } + + e1000_write_phy_reg(hw, 0x0000, 0x3300); + + + if(hw->mac_type == e1000_82547) { + uint16_t fused, fine, coarse; + + /* Move to analog registers page */ + e1000_read_phy_reg(hw, IGP01E1000_ANALOG_SPARE_FUSE_STATUS, &fused); + + if(!(fused & IGP01E1000_ANALOG_SPARE_FUSE_ENABLED)) { + e1000_read_phy_reg(hw, IGP01E1000_ANALOG_FUSE_STATUS, &fused); + + fine = fused & IGP01E1000_ANALOG_FUSE_FINE_MASK; + coarse = fused & IGP01E1000_ANALOG_FUSE_COARSE_MASK; + + if(coarse > IGP01E1000_ANALOG_FUSE_COARSE_THRESH) { + coarse -= IGP01E1000_ANALOG_FUSE_COARSE_10; + fine -= IGP01E1000_ANALOG_FUSE_FINE_1; + } else if(coarse == IGP01E1000_ANALOG_FUSE_COARSE_THRESH) + fine -= IGP01E1000_ANALOG_FUSE_FINE_10; + + fused = (fused & IGP01E1000_ANALOG_FUSE_POLY_MASK) | + (fine & IGP01E1000_ANALOG_FUSE_FINE_MASK) | + (coarse & IGP01E1000_ANALOG_FUSE_COARSE_MASK); + + e1000_write_phy_reg(hw, IGP01E1000_ANALOG_FUSE_CONTROL, fused); + e1000_write_phy_reg(hw, IGP01E1000_ANALOG_FUSE_BYPASS, + IGP01E1000_ANALOG_FUSE_ENABLE_SW_CONTROL); + } + } + } +} + +/****************************************************************************** + * Set the mac type member in the hw struct. + * + * hw - Struct containing variables accessed by shared code + *****************************************************************************/ +static int +e1000_set_mac_type(struct e1000_hw *hw) +{ + DEBUGFUNC("e1000_set_mac_type"); + + switch (hw->device_id) { + case E1000_DEV_ID_82542: + switch (hw->revision_id) { + case E1000_82542_2_0_REV_ID: + hw->mac_type = e1000_82542_rev2_0; + break; + case E1000_82542_2_1_REV_ID: + hw->mac_type = e1000_82542_rev2_1; + break; + default: + /* Invalid 82542 revision ID */ + return -E1000_ERR_MAC_TYPE; + } + break; + case E1000_DEV_ID_82543GC_FIBER: + case E1000_DEV_ID_82543GC_COPPER: + hw->mac_type = e1000_82543; + break; + case E1000_DEV_ID_82544EI_COPPER: + case E1000_DEV_ID_82544EI_FIBER: + case E1000_DEV_ID_82544GC_COPPER: + case E1000_DEV_ID_82544GC_LOM: + hw->mac_type = e1000_82544; + break; + case E1000_DEV_ID_82540EM: + case E1000_DEV_ID_82540EM_LOM: + case E1000_DEV_ID_82540EP: + case E1000_DEV_ID_82540EP_LOM: + case E1000_DEV_ID_82540EP_LP: + hw->mac_type = e1000_82540; + break; + case E1000_DEV_ID_82545EM_COPPER: + case E1000_DEV_ID_82545EM_FIBER: + hw->mac_type = e1000_82545; + break; + case E1000_DEV_ID_82545GM_COPPER: + case E1000_DEV_ID_82545GM_FIBER: + case E1000_DEV_ID_82545GM_SERDES: + hw->mac_type = e1000_82545_rev_3; + break; + case E1000_DEV_ID_82546EB_COPPER: + case E1000_DEV_ID_82546EB_FIBER: + case E1000_DEV_ID_82546EB_QUAD_COPPER: + hw->mac_type = e1000_82546; + break; + case E1000_DEV_ID_82546GB_COPPER: + case E1000_DEV_ID_82546GB_FIBER: + case E1000_DEV_ID_82546GB_SERDES: + hw->mac_type = e1000_82546_rev_3; + break; + case E1000_DEV_ID_82541EI: + case E1000_DEV_ID_82541EI_MOBILE: + hw->mac_type = e1000_82541; + break; + case E1000_DEV_ID_82541ER: + case E1000_DEV_ID_82541GI: + case E1000_DEV_ID_82541GI_MOBILE: + hw->mac_type = e1000_82541_rev_2; + break; + case E1000_DEV_ID_82547EI: + hw->mac_type = e1000_82547; + break; + case E1000_DEV_ID_82547GI: + hw->mac_type = e1000_82547_rev_2; + break; + default: + /* Should never have loaded on this device */ + return -E1000_ERR_MAC_TYPE; + } + + return E1000_SUCCESS; +} + +/***************************************************************************** + * Set media type and TBI compatibility. + * + * hw - Struct containing variables accessed by shared code + * **************************************************************************/ +static void +e1000_set_media_type(struct e1000_hw *hw) +{ + uint32_t status; + + DEBUGFUNC("e1000_set_media_type"); + + if(hw->mac_type != e1000_82543) { + /* tbi_compatibility is only valid on 82543 */ + hw->tbi_compatibility_en = FALSE; + } + + switch (hw->device_id) { + case E1000_DEV_ID_82545GM_SERDES: + case E1000_DEV_ID_82546GB_SERDES: + hw->media_type = e1000_media_type_internal_serdes; + break; + default: + if(hw->mac_type >= e1000_82543) { + status = E1000_READ_REG(hw, STATUS); + if(status & E1000_STATUS_TBIMODE) { + hw->media_type = e1000_media_type_fiber; + /* tbi_compatibility not valid on fiber */ + hw->tbi_compatibility_en = FALSE; + } else { + hw->media_type = e1000_media_type_copper; + } + } else { + /* This is an 82542 (fiber only) */ + hw->media_type = e1000_media_type_fiber; + } + } +} + +/****************************************************************************** + * Reset the transmit and receive units; mask and clear all interrupts. + * + * hw - Struct containing variables accessed by shared code + *****************************************************************************/ +static void +e1000_reset_hw(struct e1000_hw *hw) +{ + uint32_t ctrl; + uint32_t ctrl_ext; + uint32_t icr; + uint32_t manc; + + DEBUGFUNC("e1000_reset_hw"); + + /* For 82542 (rev 2.0), disable MWI before issuing a device reset */ + if(hw->mac_type == e1000_82542_rev2_0) { + DEBUGOUT("Disabling MWI on 82542 rev 2.0\n"); + e1000_pci_clear_mwi(hw); + } + + /* Clear interrupt mask to stop board from generating interrupts */ + DEBUGOUT("Masking off all interrupts\n"); + E1000_WRITE_REG(hw, IMC, 0xffffffff); + + /* Disable the Transmit and Receive units. Then delay to allow + * any pending transactions to complete before we hit the MAC with + * the global reset. + */ + E1000_WRITE_REG(hw, RCTL, 0); + E1000_WRITE_REG(hw, TCTL, E1000_TCTL_PSP); + E1000_WRITE_FLUSH(hw); + + /* The tbi_compatibility_on Flag must be cleared when Rctl is cleared. */ + hw->tbi_compatibility_on = FALSE; + + /* Delay to allow any outstanding PCI transactions to complete before + * resetting the device + */ + mdelay(10); + + ctrl = E1000_READ_REG(hw, CTRL); + + /* Must reset the PHY before resetting the MAC */ + if((hw->mac_type == e1000_82541) || (hw->mac_type == e1000_82547)) { + E1000_WRITE_REG_IO(hw, CTRL, (ctrl | E1000_CTRL_PHY_RST)); + mdelay(5); + } + + /* Issue a global reset to the MAC. This will reset the chip's + * transmit, receive, DMA, and link units. It will not effect + * the current PCI configuration. The global reset bit is self- + * clearing, and should clear within a microsecond. + */ + DEBUGOUT("Issuing a global reset to MAC\n"); + + switch(hw->mac_type) { + case e1000_82544: + case e1000_82540: + case e1000_82545: + case e1000_82546: + case e1000_82541: + case e1000_82541_rev_2: + /* These controllers can't ack the 64-bit write when issuing the + * reset, so use IO-mapping as a workaround to issue the reset */ + E1000_WRITE_REG_IO(hw, CTRL, (ctrl | E1000_CTRL_RST)); + break; + case e1000_82545_rev_3: + case e1000_82546_rev_3: + /* Reset is performed on a shadow of the control register */ + E1000_WRITE_REG(hw, CTRL_DUP, (ctrl | E1000_CTRL_RST)); + break; + default: + E1000_WRITE_REG(hw, CTRL, (ctrl | E1000_CTRL_RST)); + break; + } + + /* After MAC reset, force reload of EEPROM to restore power-on settings to + * device. Later controllers reload the EEPROM automatically, so just wait + * for reload to complete. + */ + switch(hw->mac_type) { + case e1000_82542_rev2_0: + case e1000_82542_rev2_1: + case e1000_82543: + case e1000_82544: + /* Wait for reset to complete */ + udelay(10); + ctrl_ext = E1000_READ_REG(hw, CTRL_EXT); + ctrl_ext |= E1000_CTRL_EXT_EE_RST; + E1000_WRITE_REG(hw, CTRL_EXT, ctrl_ext); + E1000_WRITE_FLUSH(hw); + /* Wait for EEPROM reload */ + mdelay(2); + break; + case e1000_82541: + case e1000_82541_rev_2: + case e1000_82547: + case e1000_82547_rev_2: + /* Wait for EEPROM reload */ + mdelay(20); + break; + default: + /* Wait for EEPROM reload (it happens automatically) */ + mdelay(5); + break; + } + + /* Disable HW ARPs on ASF enabled adapters */ + if(hw->mac_type >= e1000_82540) { + manc = E1000_READ_REG(hw, MANC); + manc &= ~(E1000_MANC_ARP_EN); + E1000_WRITE_REG(hw, MANC, manc); + } + + if((hw->mac_type == e1000_82541) || (hw->mac_type == e1000_82547)) { + e1000_phy_init_script(hw); + } + + /* Clear interrupt mask to stop board from generating interrupts */ + DEBUGOUT("Masking off all interrupts\n"); + E1000_WRITE_REG(hw, IMC, 0xffffffff); + + /* Clear any pending interrupt events. */ + icr = E1000_READ_REG(hw, ICR); + + /* If MWI was previously enabled, reenable it. */ + if(hw->mac_type == e1000_82542_rev2_0) { +#ifdef LINUX_DRIVER + if(hw->pci_cmd_word & CMD_MEM_WRT_INVALIDATE) +#endif + e1000_pci_set_mwi(hw); + } +} + +/****************************************************************************** + * Performs basic configuration of the adapter. + * + * hw - Struct containing variables accessed by shared code + * + * Assumes that the controller has previously been reset and is in a + * post-reset uninitialized state. Initializes the receive address registers, + * multicast table, and VLAN filter table. Calls routines to setup link + * configuration and flow control settings. Clears all on-chip counters. Leaves + * the transmit and receive units disabled and uninitialized. + *****************************************************************************/ +static int +e1000_init_hw(struct e1000_hw *hw) +{ + uint32_t ctrl, status; + uint32_t i; + int32_t ret_val; + uint16_t pcix_cmd_word; + uint16_t pcix_stat_hi_word; + uint16_t cmd_mmrbc; + uint16_t stat_mmrbc; + e1000_bus_type bus_type = e1000_bus_type_unknown; + + DEBUGFUNC("e1000_init_hw"); + + /* Set the media type and TBI compatibility */ + e1000_set_media_type(hw); + + /* Disabling VLAN filtering. */ + DEBUGOUT("Initializing the IEEE VLAN\n"); + E1000_WRITE_REG(hw, VET, 0); + + e1000_clear_vfta(hw); + + /* For 82542 (rev 2.0), disable MWI and put the receiver into reset */ + if(hw->mac_type == e1000_82542_rev2_0) { + DEBUGOUT("Disabling MWI on 82542 rev 2.0\n"); + e1000_pci_clear_mwi(hw); + E1000_WRITE_REG(hw, RCTL, E1000_RCTL_RST); + E1000_WRITE_FLUSH(hw); + mdelay(5); + } + + /* Setup the receive address. This involves initializing all of the Receive + * Address Registers (RARs 0 - 15). + */ + e1000_init_rx_addrs(hw); + + /* For 82542 (rev 2.0), take the receiver out of reset and enable MWI */ + if(hw->mac_type == e1000_82542_rev2_0) { + E1000_WRITE_REG(hw, RCTL, 0); + E1000_WRITE_FLUSH(hw); + mdelay(1); +#ifdef LINUX_DRIVER + if(hw->pci_cmd_word & CMD_MEM_WRT_INVALIDATE) +#endif + e1000_pci_set_mwi(hw); + } + + /* Zero out the Multicast HASH table */ + DEBUGOUT("Zeroing the MTA\n"); + for(i = 0; i < E1000_MC_TBL_SIZE; i++) + E1000_WRITE_REG_ARRAY(hw, MTA, i, 0); + +#if 0 + /* Set the PCI priority bit correctly in the CTRL register. This + * determines if the adapter gives priority to receives, or if it + * gives equal priority to transmits and receives. + */ + if(hw->dma_fairness) { + ctrl = E1000_READ_REG(hw, CTRL); + E1000_WRITE_REG(hw, CTRL, ctrl | E1000_CTRL_PRIOR); + } +#endif + + switch(hw->mac_type) { + case e1000_82545_rev_3: + case e1000_82546_rev_3: + break; + default: + if (hw->mac_type >= e1000_82543) { + /* See e1000_get_bus_info() of the Linux driver */ + status = E1000_READ_REG(hw, STATUS); + bus_type = (status & E1000_STATUS_PCIX_MODE) ? + e1000_bus_type_pcix : e1000_bus_type_pci; + } + + /* Workaround for PCI-X problem when BIOS sets MMRBC incorrectly. */ + if(bus_type == e1000_bus_type_pcix) { + pci_read_config_word(hw->pdev, PCIX_COMMAND_REGISTER, &pcix_cmd_word); + pci_read_config_word(hw->pdev, PCIX_STATUS_REGISTER_HI, &pcix_stat_hi_word); + cmd_mmrbc = (pcix_cmd_word & PCIX_COMMAND_MMRBC_MASK) >> + PCIX_COMMAND_MMRBC_SHIFT; + stat_mmrbc = (pcix_stat_hi_word & PCIX_STATUS_HI_MMRBC_MASK) >> + PCIX_STATUS_HI_MMRBC_SHIFT; + if(stat_mmrbc == PCIX_STATUS_HI_MMRBC_4K) + stat_mmrbc = PCIX_STATUS_HI_MMRBC_2K; + if(cmd_mmrbc > stat_mmrbc) { + pcix_cmd_word &= ~PCIX_COMMAND_MMRBC_MASK; + pcix_cmd_word |= stat_mmrbc << PCIX_COMMAND_MMRBC_SHIFT; + pci_write_config_word(hw->pdev, PCIX_COMMAND_REGISTER, pcix_cmd_word); + } + } + break; + } + + /* Call a subroutine to configure the link and setup flow control. */ + ret_val = e1000_setup_link(hw); + + /* Set the transmit descriptor write-back policy */ + if(hw->mac_type > e1000_82544) { + ctrl = E1000_READ_REG(hw, TXDCTL); + ctrl = (ctrl & ~E1000_TXDCTL_WTHRESH) | E1000_TXDCTL_FULL_TX_DESC_WB; + E1000_WRITE_REG(hw, TXDCTL, ctrl); + } + +#if 0 + /* Clear all of the statistics registers (clear on read). It is + * important that we do this after we have tried to establish link + * because the symbol error count will increment wildly if there + * is no link. + */ + e1000_clear_hw_cntrs(hw); +#endif + + return ret_val; +} + +/****************************************************************************** + * Adjust SERDES output amplitude based on EEPROM setting. + * + * hw - Struct containing variables accessed by shared code. + *****************************************************************************/ +static int32_t +e1000_adjust_serdes_amplitude(struct e1000_hw *hw) +{ + uint16_t eeprom_data; + int32_t ret_val; + + DEBUGFUNC("e1000_adjust_serdes_amplitude"); + + if(hw->media_type != e1000_media_type_internal_serdes) + return E1000_SUCCESS; + + switch(hw->mac_type) { + case e1000_82545_rev_3: + case e1000_82546_rev_3: + break; + default: + return E1000_SUCCESS; + } + + if ((ret_val = e1000_read_eeprom(hw, EEPROM_SERDES_AMPLITUDE, 1, + &eeprom_data))) { + return ret_val; + } + + if(eeprom_data != EEPROM_RESERVED_WORD) { + /* Adjust SERDES output amplitude only. */ + eeprom_data &= EEPROM_SERDES_AMPLITUDE_MASK; + if((ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_EXT_CTRL, + eeprom_data))) + return ret_val; + } + + return E1000_SUCCESS; +} + +/****************************************************************************** + * Configures flow control and link settings. + * + * hw - Struct containing variables accessed by shared code + * + * Determines which flow control settings to use. Calls the apropriate media- + * specific link configuration function. Configures the flow control settings. + * Assuming the adapter has a valid link partner, a valid link should be + * established. Assumes the hardware has previously been reset and the + * transmitter and receiver are not enabled. + *****************************************************************************/ +static int +e1000_setup_link(struct e1000_hw *hw) +{ + uint32_t ctrl_ext; + int32_t ret_val; + uint16_t eeprom_data; + + DEBUGFUNC("e1000_setup_link"); + + /* Read and store word 0x0F of the EEPROM. This word contains bits + * that determine the hardware's default PAUSE (flow control) mode, + * a bit that determines whether the HW defaults to enabling or + * disabling auto-negotiation, and the direction of the + * SW defined pins. If there is no SW over-ride of the flow + * control setting, then the variable hw->fc will + * be initialized based on a value in the EEPROM. + */ + if(e1000_read_eeprom(hw, EEPROM_INIT_CONTROL2_REG, 1, &eeprom_data) < 0) { + DEBUGOUT("EEPROM Read Error\n"); + return -E1000_ERR_EEPROM; + } + + if(hw->fc == e1000_fc_default) { + if((eeprom_data & EEPROM_WORD0F_PAUSE_MASK) == 0) + hw->fc = e1000_fc_none; + else if((eeprom_data & EEPROM_WORD0F_PAUSE_MASK) == + EEPROM_WORD0F_ASM_DIR) + hw->fc = e1000_fc_tx_pause; + else + hw->fc = e1000_fc_full; + } + + /* We want to save off the original Flow Control configuration just + * in case we get disconnected and then reconnected into a different + * hub or switch with different Flow Control capabilities. + */ + if(hw->mac_type == e1000_82542_rev2_0) + hw->fc &= (~e1000_fc_tx_pause); + +#if 0 + /* See e1000_sw_init() of the Linux driver */ + if((hw->mac_type < e1000_82543) && (hw->report_tx_early == 1)) +#else + if((hw->mac_type < e1000_82543) && (hw->mac_type >= e1000_82543)) +#endif + hw->fc &= (~e1000_fc_rx_pause); + +#if 0 + hw->original_fc = hw->fc; +#endif + + DEBUGOUT1("After fix-ups FlowControl is now = %x\n", hw->fc); + + /* Take the 4 bits from EEPROM word 0x0F that determine the initial + * polarity value for the SW controlled pins, and setup the + * Extended Device Control reg with that info. + * This is needed because one of the SW controlled pins is used for + * signal detection. So this should be done before e1000_setup_pcs_link() + * or e1000_phy_setup() is called. + */ + if(hw->mac_type == e1000_82543) { + ctrl_ext = ((eeprom_data & EEPROM_WORD0F_SWPDIO_EXT) << + SWDPIO__EXT_SHIFT); + E1000_WRITE_REG(hw, CTRL_EXT, ctrl_ext); + } + + /* Call the necessary subroutine to configure the link. */ + ret_val = (hw->media_type == e1000_media_type_copper) ? + e1000_setup_copper_link(hw) : + e1000_setup_fiber_serdes_link(hw); + if (ret_val < 0) { + return ret_val; + } + + /* Initialize the flow control address, type, and PAUSE timer + * registers to their default values. This is done even if flow + * control is disabled, because it does not hurt anything to + * initialize these registers. + */ + DEBUGOUT("Initializing the Flow Control address, type and timer regs\n"); + + E1000_WRITE_REG(hw, FCAL, FLOW_CONTROL_ADDRESS_LOW); + E1000_WRITE_REG(hw, FCAH, FLOW_CONTROL_ADDRESS_HIGH); + E1000_WRITE_REG(hw, FCT, FLOW_CONTROL_TYPE); +#if 0 + E1000_WRITE_REG(hw, FCTTV, hw->fc_pause_time); +#else + E1000_WRITE_REG(hw, FCTTV, FC_DEFAULT_TX_TIMER); +#endif + + /* Set the flow control receive threshold registers. Normally, + * these registers will be set to a default threshold that may be + * adjusted later by the driver's runtime code. However, if the + * ability to transmit pause frames in not enabled, then these + * registers will be set to 0. + */ + if(!(hw->fc & e1000_fc_tx_pause)) { + E1000_WRITE_REG(hw, FCRTL, 0); + E1000_WRITE_REG(hw, FCRTH, 0); + } else { + /* We need to set up the Receive Threshold high and low water marks + * as well as (optionally) enabling the transmission of XON frames. + */ +#if 0 + if(hw->fc_send_xon) { + E1000_WRITE_REG(hw, FCRTL, (hw->fc_low_water | E1000_FCRTL_XONE)); + E1000_WRITE_REG(hw, FCRTH, hw->fc_high_water); + } else { + E1000_WRITE_REG(hw, FCRTL, hw->fc_low_water); + E1000_WRITE_REG(hw, FCRTH, hw->fc_high_water); + } +#else + E1000_WRITE_REG(hw, FCRTL, (FC_DEFAULT_LO_THRESH | E1000_FCRTL_XONE)); + E1000_WRITE_REG(hw, FCRTH, FC_DEFAULT_HI_THRESH); +#endif + } + return ret_val; +} + +/****************************************************************************** + * Sets up link for a fiber based or serdes based adapter + * + * hw - Struct containing variables accessed by shared code + * + * Manipulates Physical Coding Sublayer functions in order to configure + * link. Assumes the hardware has been previously reset and the transmitter + * and receiver are not enabled. + *****************************************************************************/ +static int +e1000_setup_fiber_serdes_link(struct e1000_hw *hw) +{ + uint32_t ctrl; + uint32_t status; + uint32_t txcw = 0; + uint32_t i; + uint32_t signal = 0; + int32_t ret_val; + + DEBUGFUNC("e1000_setup_fiber_serdes_link"); + + /* On adapters with a MAC newer than 82544, SW Defineable pin 1 will be + * set when the optics detect a signal. On older adapters, it will be + * cleared when there is a signal. This applies to fiber media only. + * If we're on serdes media, adjust the output amplitude to value set in + * the EEPROM. + */ + ctrl = E1000_READ_REG(hw, CTRL); + if(hw->media_type == e1000_media_type_fiber) + signal = (hw->mac_type > e1000_82544) ? E1000_CTRL_SWDPIN1 : 0; + + if((ret_val = e1000_adjust_serdes_amplitude(hw))) + return ret_val; + + /* Take the link out of reset */ + ctrl &= ~(E1000_CTRL_LRST); + +#if 0 + /* Adjust VCO speed to improve BER performance */ + if((ret_val = e1000_set_vco_speed(hw))) + return ret_val; +#endif + + e1000_config_collision_dist(hw); + + /* Check for a software override of the flow control settings, and setup + * the device accordingly. If auto-negotiation is enabled, then software + * will have to set the "PAUSE" bits to the correct value in the Tranmsit + * Config Word Register (TXCW) and re-start auto-negotiation. However, if + * auto-negotiation is disabled, then software will have to manually + * configure the two flow control enable bits in the CTRL register. + * + * The possible values of the "fc" parameter are: + * 0: Flow control is completely disabled + * 1: Rx flow control is enabled (we can receive pause frames, but + * not send pause frames). + * 2: Tx flow control is enabled (we can send pause frames but we do + * not support receiving pause frames). + * 3: Both Rx and TX flow control (symmetric) are enabled. + */ + switch (hw->fc) { + case e1000_fc_none: + /* Flow control is completely disabled by a software over-ride. */ + txcw = (E1000_TXCW_ANE | E1000_TXCW_FD); + break; + case e1000_fc_rx_pause: + /* RX Flow control is enabled and TX Flow control is disabled by a + * software over-ride. Since there really isn't a way to advertise + * that we are capable of RX Pause ONLY, we will advertise that we + * support both symmetric and asymmetric RX PAUSE. Later, we will + * disable the adapter's ability to send PAUSE frames. + */ + txcw = (E1000_TXCW_ANE | E1000_TXCW_FD | E1000_TXCW_PAUSE_MASK); + break; + case e1000_fc_tx_pause: + /* TX Flow control is enabled, and RX Flow control is disabled, by a + * software over-ride. + */ + txcw = (E1000_TXCW_ANE | E1000_TXCW_FD | E1000_TXCW_ASM_DIR); + break; + case e1000_fc_full: + /* Flow control (both RX and TX) is enabled by a software over-ride. */ + txcw = (E1000_TXCW_ANE | E1000_TXCW_FD | E1000_TXCW_PAUSE_MASK); + break; + default: + DEBUGOUT("Flow control param set incorrectly\n"); + return -E1000_ERR_CONFIG; + break; + } + + /* Since auto-negotiation is enabled, take the link out of reset (the link + * will be in reset, because we previously reset the chip). This will + * restart auto-negotiation. If auto-neogtiation is successful then the + * link-up status bit will be set and the flow control enable bits (RFCE + * and TFCE) will be set according to their negotiated value. + */ + DEBUGOUT("Auto-negotiation enabled\n"); + + E1000_WRITE_REG(hw, TXCW, txcw); + E1000_WRITE_REG(hw, CTRL, ctrl); + E1000_WRITE_FLUSH(hw); + + hw->txcw = txcw; + mdelay(1); + + /* If we have a signal (the cable is plugged in) then poll for a "Link-Up" + * indication in the Device Status Register. Time-out if a link isn't + * seen in 500 milliseconds seconds (Auto-negotiation should complete in + * less than 500 milliseconds even if the other end is doing it in SW). + * For internal serdes, we just assume a signal is present, then poll. + */ + if(hw->media_type == e1000_media_type_internal_serdes || + (E1000_READ_REG(hw, CTRL) & E1000_CTRL_SWDPIN1) == signal) { + DEBUGOUT("Looking for Link\n"); + for(i = 0; i < (LINK_UP_TIMEOUT / 10); i++) { + mdelay(10); + status = E1000_READ_REG(hw, STATUS); + if(status & E1000_STATUS_LU) break; + } + if(i == (LINK_UP_TIMEOUT / 10)) { + DEBUGOUT("Never got a valid link from auto-neg!!!\n"); + hw->autoneg_failed = 1; + /* AutoNeg failed to achieve a link, so we'll call + * e1000_check_for_link. This routine will force the link up if + * we detect a signal. This will allow us to communicate with + * non-autonegotiating link partners. + */ + if((ret_val = e1000_check_for_link(hw))) { + DEBUGOUT("Error while checking for link\n"); + return ret_val; + } + hw->autoneg_failed = 0; + } else { + hw->autoneg_failed = 0; + DEBUGOUT("Valid Link Found\n"); + } + } else { + DEBUGOUT("No Signal Detected\n"); + } + return E1000_SUCCESS; +} + +/****************************************************************************** +* Detects which PHY is present and the speed and duplex +* +* hw - Struct containing variables accessed by shared code +******************************************************************************/ +static int +e1000_setup_copper_link(struct e1000_hw *hw) +{ + uint32_t ctrl; + int32_t ret_val; + uint16_t i; + uint16_t phy_data; + + DEBUGFUNC("e1000_setup_copper_link"); + + ctrl = E1000_READ_REG(hw, CTRL); + /* With 82543, we need to force speed and duplex on the MAC equal to what + * the PHY speed and duplex configuration is. In addition, we need to + * perform a hardware reset on the PHY to take it out of reset. + */ + if(hw->mac_type > e1000_82543) { + ctrl |= E1000_CTRL_SLU; + ctrl &= ~(E1000_CTRL_FRCSPD | E1000_CTRL_FRCDPX); + E1000_WRITE_REG(hw, CTRL, ctrl); + } else { + ctrl |= (E1000_CTRL_FRCSPD | E1000_CTRL_FRCDPX | E1000_CTRL_SLU); + E1000_WRITE_REG(hw, CTRL, ctrl); + e1000_phy_hw_reset(hw); + } + + /* Make sure we have a valid PHY */ + if((ret_val = e1000_detect_gig_phy(hw))) { + DEBUGOUT("Error, did not detect valid phy.\n"); + return ret_val; + } + DEBUGOUT1("Phy ID = %x \n", hw->phy_id); + + if(hw->mac_type <= e1000_82543 || + hw->mac_type == e1000_82541 || hw->mac_type == e1000_82547 || +#if 0 + hw->mac_type == e1000_82541_rev_2 || hw->mac_type == e1000_82547_rev_2) + hw->phy_reset_disable = FALSE; + + if(!hw->phy_reset_disable) { +#else + hw->mac_type == e1000_82541_rev_2 || hw->mac_type == e1000_82547_rev_2) { +#endif + if (hw->phy_type == e1000_phy_igp) { + + if((ret_val = e1000_phy_reset(hw))) { + DEBUGOUT("Error Resetting the PHY\n"); + return ret_val; + } + + /* Wait 10ms for MAC to configure PHY from eeprom settings */ + mdelay(15); + +#if 0 + /* disable lplu d3 during driver init */ + if((ret_val = e1000_set_d3_lplu_state(hw, FALSE))) { + DEBUGOUT("Error Disabling LPLU D3\n"); + return ret_val; + } + + /* Configure mdi-mdix settings */ + if((ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CTRL, + &phy_data))) + return ret_val; + + if((hw->mac_type == e1000_82541) || (hw->mac_type == e1000_82547)) { + hw->dsp_config_state = e1000_dsp_config_disabled; + /* Force MDI for IGP B-0 PHY */ + phy_data &= ~(IGP01E1000_PSCR_AUTO_MDIX | + IGP01E1000_PSCR_FORCE_MDI_MDIX); + hw->mdix = 1; + + } else { + hw->dsp_config_state = e1000_dsp_config_enabled; + phy_data &= ~IGP01E1000_PSCR_AUTO_MDIX; + + switch (hw->mdix) { + case 1: + phy_data &= ~IGP01E1000_PSCR_FORCE_MDI_MDIX; + break; + case 2: + phy_data |= IGP01E1000_PSCR_FORCE_MDI_MDIX; + break; + case 0: + default: + phy_data |= IGP01E1000_PSCR_AUTO_MDIX; + break; + } + } + if((ret_val = e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CTRL, + phy_data))) + return ret_val; + + /* set auto-master slave resolution settings */ + e1000_ms_type phy_ms_setting = hw->master_slave; + + if(hw->ffe_config_state == e1000_ffe_config_active) + hw->ffe_config_state = e1000_ffe_config_enabled; + + if(hw->dsp_config_state == e1000_dsp_config_activated) + hw->dsp_config_state = e1000_dsp_config_enabled; +#endif + + /* when autonegotiation advertisment is only 1000Mbps then we + * should disable SmartSpeed and enable Auto MasterSlave + * resolution as hardware default. */ + if(hw->autoneg_advertised == ADVERTISE_1000_FULL) { + /* Disable SmartSpeed */ + if((ret_val = e1000_read_phy_reg(hw, + IGP01E1000_PHY_PORT_CONFIG, + &phy_data))) + return ret_val; + phy_data &= ~IGP01E1000_PSCFR_SMART_SPEED; + if((ret_val = e1000_write_phy_reg(hw, + IGP01E1000_PHY_PORT_CONFIG, + phy_data))) + return ret_val; + /* Set auto Master/Slave resolution process */ + if((ret_val = e1000_read_phy_reg(hw, PHY_1000T_CTRL, + &phy_data))) + return ret_val; + phy_data &= ~CR_1000T_MS_ENABLE; + if((ret_val = e1000_write_phy_reg(hw, PHY_1000T_CTRL, + phy_data))) + return ret_val; + } + + if((ret_val = e1000_read_phy_reg(hw, PHY_1000T_CTRL, + &phy_data))) + return ret_val; + +#if 0 + /* load defaults for future use */ + hw->original_master_slave = (phy_data & CR_1000T_MS_ENABLE) ? + ((phy_data & CR_1000T_MS_VALUE) ? + e1000_ms_force_master : + e1000_ms_force_slave) : + e1000_ms_auto; + + switch (phy_ms_setting) { + case e1000_ms_force_master: + phy_data |= (CR_1000T_MS_ENABLE | CR_1000T_MS_VALUE); + break; + case e1000_ms_force_slave: + phy_data |= CR_1000T_MS_ENABLE; + phy_data &= ~(CR_1000T_MS_VALUE); + break; + case e1000_ms_auto: + phy_data &= ~CR_1000T_MS_ENABLE; + default: + break; + } +#endif + + if((ret_val = e1000_write_phy_reg(hw, PHY_1000T_CTRL, + phy_data))) + return ret_val; + } else { + /* Enable CRS on TX. This must be set for half-duplex operation. */ + if((ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, + &phy_data))) + return ret_val; + + phy_data |= M88E1000_PSCR_ASSERT_CRS_ON_TX; + + /* Options: + * MDI/MDI-X = 0 (default) + * 0 - Auto for all speeds + * 1 - MDI mode + * 2 - MDI-X mode + * 3 - Auto for 1000Base-T only (MDI-X for 10/100Base-T modes) + */ +#if 0 + phy_data &= ~M88E1000_PSCR_AUTO_X_MODE; + + switch (hw->mdix) { + case 1: + phy_data |= M88E1000_PSCR_MDI_MANUAL_MODE; + break; + case 2: + phy_data |= M88E1000_PSCR_MDIX_MANUAL_MODE; + break; + case 3: + phy_data |= M88E1000_PSCR_AUTO_X_1000T; + break; + case 0: + default: +#endif + phy_data |= M88E1000_PSCR_AUTO_X_MODE; +#if 0 + break; + } +#endif + + /* Options: + * disable_polarity_correction = 0 (default) + * Automatic Correction for Reversed Cable Polarity + * 0 - Disabled + * 1 - Enabled + */ + phy_data &= ~M88E1000_PSCR_POLARITY_REVERSAL; + if((ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, + phy_data))) + return ret_val; + + /* Force TX_CLK in the Extended PHY Specific Control Register + * to 25MHz clock. + */ + if((ret_val = e1000_read_phy_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL, + &phy_data))) + return ret_val; + + phy_data |= M88E1000_EPSCR_TX_CLK_25; + +#ifdef LINUX_DRIVER + if (hw->phy_revision < M88E1011_I_REV_4) { +#endif + /* Configure Master and Slave downshift values */ + phy_data &= ~(M88E1000_EPSCR_MASTER_DOWNSHIFT_MASK | + M88E1000_EPSCR_SLAVE_DOWNSHIFT_MASK); + phy_data |= (M88E1000_EPSCR_MASTER_DOWNSHIFT_1X | + M88E1000_EPSCR_SLAVE_DOWNSHIFT_1X); + if((ret_val = e1000_write_phy_reg(hw, + M88E1000_EXT_PHY_SPEC_CTRL, + phy_data))) + return ret_val; + } + + /* SW Reset the PHY so all changes take effect */ + if((ret_val = e1000_phy_reset(hw))) { + DEBUGOUT("Error Resetting the PHY\n"); + return ret_val; +#ifdef LINUX_DRIVER + } +#endif + } + + /* Options: + * autoneg = 1 (default) + * PHY will advertise value(s) parsed from + * autoneg_advertised and fc + * autoneg = 0 + * PHY will be set to 10H, 10F, 100H, or 100F + * depending on value parsed from forced_speed_duplex. + */ + + /* Is autoneg enabled? This is enabled by default or by software + * override. If so, call e1000_phy_setup_autoneg routine to parse the + * autoneg_advertised and fc options. If autoneg is NOT enabled, then + * the user should have provided a speed/duplex override. If so, then + * call e1000_phy_force_speed_duplex to parse and set this up. + */ + /* Perform some bounds checking on the hw->autoneg_advertised + * parameter. If this variable is zero, then set it to the default. + */ + hw->autoneg_advertised &= AUTONEG_ADVERTISE_SPEED_DEFAULT; + + /* If autoneg_advertised is zero, we assume it was not defaulted + * by the calling code so we set to advertise full capability. + */ + if(hw->autoneg_advertised == 0) + hw->autoneg_advertised = AUTONEG_ADVERTISE_SPEED_DEFAULT; + + DEBUGOUT("Reconfiguring auto-neg advertisement params\n"); + if((ret_val = e1000_phy_setup_autoneg(hw))) { + DEBUGOUT("Error Setting up Auto-Negotiation\n"); + return ret_val; + } + DEBUGOUT("Restarting Auto-Neg\n"); + + /* Restart auto-negotiation by setting the Auto Neg Enable bit and + * the Auto Neg Restart bit in the PHY control register. + */ + if((ret_val = e1000_read_phy_reg(hw, PHY_CTRL, &phy_data))) + return ret_val; + + phy_data |= (MII_CR_AUTO_NEG_EN | MII_CR_RESTART_AUTO_NEG); + if((ret_val = e1000_write_phy_reg(hw, PHY_CTRL, phy_data))) + return ret_val; + +#if 0 + /* Does the user want to wait for Auto-Neg to complete here, or + * check at a later time (for example, callback routine). + */ + if(hw->wait_autoneg_complete) { + if((ret_val = e1000_wait_autoneg(hw))) { + DEBUGOUT("Error while waiting for autoneg to complete\n"); + return ret_val; + } + } +#else + /* If we do not wait for autonegotiation to complete I + * do not see a valid link status. + */ + if((ret_val = e1000_wait_autoneg(hw))) { + DEBUGOUT("Error while waiting for autoneg to complete\n"); + return ret_val; + } +#endif + } /* !hw->phy_reset_disable */ + + /* Check link status. Wait up to 100 microseconds for link to become + * valid. + */ + for(i = 0; i < 10; i++) { + if((ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data))) + return ret_val; + if((ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data))) + return ret_val; + + if(phy_data & MII_SR_LINK_STATUS) { + /* We have link, so we need to finish the config process: + * 1) Set up the MAC to the current PHY speed/duplex + * if we are on 82543. If we + * are on newer silicon, we only need to configure + * collision distance in the Transmit Control Register. + * 2) Set up flow control on the MAC to that established with + * the link partner. + */ + if(hw->mac_type >= e1000_82544) { + e1000_config_collision_dist(hw); + } else { + if((ret_val = e1000_config_mac_to_phy(hw))) { + DEBUGOUT("Error configuring MAC to PHY settings\n"); + return ret_val; + } + } + if((ret_val = e1000_config_fc_after_link_up(hw))) { + DEBUGOUT("Error Configuring Flow Control\n"); + return ret_val; + } +#if 0 + if(hw->phy_type == e1000_phy_igp) { + if((ret_val = e1000_config_dsp_after_link_change(hw, TRUE))) { + DEBUGOUT("Error Configuring DSP after link up\n"); + return ret_val; + } + } +#endif + DEBUGOUT("Valid link established!!!\n"); + return E1000_SUCCESS; + } + udelay(10); + } + + DEBUGOUT("Unable to establish link!!!\n"); + return -E1000_ERR_NOLINK; +} + +/****************************************************************************** +* Configures PHY autoneg and flow control advertisement settings +* +* hw - Struct containing variables accessed by shared code +******************************************************************************/ +static int +e1000_phy_setup_autoneg(struct e1000_hw *hw) +{ + int32_t ret_val; + uint16_t mii_autoneg_adv_reg; + uint16_t mii_1000t_ctrl_reg; + + DEBUGFUNC("e1000_phy_setup_autoneg"); + + /* Read the MII Auto-Neg Advertisement Register (Address 4). */ + if((ret_val = e1000_read_phy_reg(hw, PHY_AUTONEG_ADV, + &mii_autoneg_adv_reg))) + return ret_val; + + /* Read the MII 1000Base-T Control Register (Address 9). */ + if((ret_val = e1000_read_phy_reg(hw, PHY_1000T_CTRL, &mii_1000t_ctrl_reg))) + return ret_val; + + /* Need to parse both autoneg_advertised and fc and set up + * the appropriate PHY registers. First we will parse for + * autoneg_advertised software override. Since we can advertise + * a plethora of combinations, we need to check each bit + * individually. + */ + + /* First we clear all the 10/100 mb speed bits in the Auto-Neg + * Advertisement Register (Address 4) and the 1000 mb speed bits in + * the 1000Base-T Control Register (Address 9). + */ + mii_autoneg_adv_reg &= ~REG4_SPEED_MASK; + mii_1000t_ctrl_reg &= ~REG9_SPEED_MASK; + + DEBUGOUT1("autoneg_advertised %x\n", hw->autoneg_advertised); + + /* Do we want to advertise 10 Mb Half Duplex? */ + if(hw->autoneg_advertised & ADVERTISE_10_HALF) { + DEBUGOUT("Advertise 10mb Half duplex\n"); + mii_autoneg_adv_reg |= NWAY_AR_10T_HD_CAPS; + } + + /* Do we want to advertise 10 Mb Full Duplex? */ + if(hw->autoneg_advertised & ADVERTISE_10_FULL) { + DEBUGOUT("Advertise 10mb Full duplex\n"); + mii_autoneg_adv_reg |= NWAY_AR_10T_FD_CAPS; + } + + /* Do we want to advertise 100 Mb Half Duplex? */ + if(hw->autoneg_advertised & ADVERTISE_100_HALF) { + DEBUGOUT("Advertise 100mb Half duplex\n"); + mii_autoneg_adv_reg |= NWAY_AR_100TX_HD_CAPS; + } + + /* Do we want to advertise 100 Mb Full Duplex? */ + if(hw->autoneg_advertised & ADVERTISE_100_FULL) { + DEBUGOUT("Advertise 100mb Full duplex\n"); + mii_autoneg_adv_reg |= NWAY_AR_100TX_FD_CAPS; + } + + /* We do not allow the Phy to advertise 1000 Mb Half Duplex */ + if(hw->autoneg_advertised & ADVERTISE_1000_HALF) { + DEBUGOUT("Advertise 1000mb Half duplex requested, request denied!\n"); + } + + /* Do we want to advertise 1000 Mb Full Duplex? */ + if(hw->autoneg_advertised & ADVERTISE_1000_FULL) { + DEBUGOUT("Advertise 1000mb Full duplex\n"); + mii_1000t_ctrl_reg |= CR_1000T_FD_CAPS; + } + + /* Check for a software override of the flow control settings, and + * setup the PHY advertisement registers accordingly. If + * auto-negotiation is enabled, then software will have to set the + * "PAUSE" bits to the correct value in the Auto-Negotiation + * Advertisement Register (PHY_AUTONEG_ADV) and re-start auto-negotiation. + * + * The possible values of the "fc" parameter are: + * 0: Flow control is completely disabled + * 1: Rx flow control is enabled (we can receive pause frames + * but not send pause frames). + * 2: Tx flow control is enabled (we can send pause frames + * but we do not support receiving pause frames). + * 3: Both Rx and TX flow control (symmetric) are enabled. + * other: No software override. The flow control configuration + * in the EEPROM is used. + */ + switch (hw->fc) { + case e1000_fc_none: /* 0 */ + /* Flow control (RX & TX) is completely disabled by a + * software over-ride. + */ + mii_autoneg_adv_reg &= ~(NWAY_AR_ASM_DIR | NWAY_AR_PAUSE); + break; + case e1000_fc_rx_pause: /* 1 */ + /* RX Flow control is enabled, and TX Flow control is + * disabled, by a software over-ride. + */ + /* Since there really isn't a way to advertise that we are + * capable of RX Pause ONLY, we will advertise that we + * support both symmetric and asymmetric RX PAUSE. Later + * (in e1000_config_fc_after_link_up) we will disable the + *hw's ability to send PAUSE frames. + */ + mii_autoneg_adv_reg |= (NWAY_AR_ASM_DIR | NWAY_AR_PAUSE); + break; + case e1000_fc_tx_pause: /* 2 */ + /* TX Flow control is enabled, and RX Flow control is + * disabled, by a software over-ride. + */ + mii_autoneg_adv_reg |= NWAY_AR_ASM_DIR; + mii_autoneg_adv_reg &= ~NWAY_AR_PAUSE; + break; + case e1000_fc_full: /* 3 */ + /* Flow control (both RX and TX) is enabled by a software + * over-ride. + */ + mii_autoneg_adv_reg |= (NWAY_AR_ASM_DIR | NWAY_AR_PAUSE); + break; + default: + DEBUGOUT("Flow control param set incorrectly\n"); + return -E1000_ERR_CONFIG; + } + + if((ret_val = e1000_write_phy_reg(hw, PHY_AUTONEG_ADV, + mii_autoneg_adv_reg))) + return ret_val; + + DEBUGOUT1("Auto-Neg Advertising %x\n", mii_autoneg_adv_reg); + + if((ret_val = e1000_write_phy_reg(hw, PHY_1000T_CTRL, mii_1000t_ctrl_reg))) + return ret_val; + + return E1000_SUCCESS; +} + +/****************************************************************************** +* Sets the collision distance in the Transmit Control register +* +* hw - Struct containing variables accessed by shared code +* +* Link should have been established previously. Reads the speed and duplex +* information from the Device Status register. +******************************************************************************/ +static void +e1000_config_collision_dist(struct e1000_hw *hw) +{ + uint32_t tctl; + + tctl = E1000_READ_REG(hw, TCTL); + + tctl &= ~E1000_TCTL_COLD; + tctl |= E1000_COLLISION_DISTANCE << E1000_COLD_SHIFT; + + E1000_WRITE_REG(hw, TCTL, tctl); + E1000_WRITE_FLUSH(hw); +} + +/****************************************************************************** +* Sets MAC speed and duplex settings to reflect the those in the PHY +* +* hw - Struct containing variables accessed by shared code +* mii_reg - data to write to the MII control register +* +* The contents of the PHY register containing the needed information need to +* be passed in. +******************************************************************************/ +static int +e1000_config_mac_to_phy(struct e1000_hw *hw) +{ + uint32_t ctrl; + int32_t ret_val; + uint16_t phy_data; + + DEBUGFUNC("e1000_config_mac_to_phy"); + + /* Read the Device Control Register and set the bits to Force Speed + * and Duplex. + */ + ctrl = E1000_READ_REG(hw, CTRL); + ctrl |= (E1000_CTRL_FRCSPD | E1000_CTRL_FRCDPX); + ctrl &= ~(E1000_CTRL_SPD_SEL | E1000_CTRL_ILOS); + + /* Set up duplex in the Device Control and Transmit Control + * registers depending on negotiated values. + */ + if (hw->phy_type == e1000_phy_igp) { + if((ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_STATUS, + &phy_data))) + return ret_val; + + if(phy_data & IGP01E1000_PSSR_FULL_DUPLEX) ctrl |= E1000_CTRL_FD; + else ctrl &= ~E1000_CTRL_FD; + + e1000_config_collision_dist(hw); + + /* Set up speed in the Device Control register depending on + * negotiated values. + */ + if((phy_data & IGP01E1000_PSSR_SPEED_MASK) == + IGP01E1000_PSSR_SPEED_1000MBPS) + ctrl |= E1000_CTRL_SPD_1000; + else if((phy_data & IGP01E1000_PSSR_SPEED_MASK) == + IGP01E1000_PSSR_SPEED_100MBPS) + ctrl |= E1000_CTRL_SPD_100; + } else { + if((ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS, + &phy_data))) + return ret_val; + + if(phy_data & M88E1000_PSSR_DPLX) ctrl |= E1000_CTRL_FD; + else ctrl &= ~E1000_CTRL_FD; + + e1000_config_collision_dist(hw); + + /* Set up speed in the Device Control register depending on + * negotiated values. + */ + if((phy_data & M88E1000_PSSR_SPEED) == M88E1000_PSSR_1000MBS) + ctrl |= E1000_CTRL_SPD_1000; + else if((phy_data & M88E1000_PSSR_SPEED) == M88E1000_PSSR_100MBS) + ctrl |= E1000_CTRL_SPD_100; + } + /* Write the configured values back to the Device Control Reg. */ + E1000_WRITE_REG(hw, CTRL, ctrl); + return E1000_SUCCESS; +} + +/****************************************************************************** + * Forces the MAC's flow control settings. + * + * hw - Struct containing variables accessed by shared code + * + * Sets the TFCE and RFCE bits in the device control register to reflect + * the adapter settings. TFCE and RFCE need to be explicitly set by + * software when a Copper PHY is used because autonegotiation is managed + * by the PHY rather than the MAC. Software must also configure these + * bits when link is forced on a fiber connection. + *****************************************************************************/ +static int +e1000_force_mac_fc(struct e1000_hw *hw) +{ + uint32_t ctrl; + + DEBUGFUNC("e1000_force_mac_fc"); + + /* Get the current configuration of the Device Control Register */ + ctrl = E1000_READ_REG(hw, CTRL); + + /* Because we didn't get link via the internal auto-negotiation + * mechanism (we either forced link or we got link via PHY + * auto-neg), we have to manually enable/disable transmit an + * receive flow control. + * + * The "Case" statement below enables/disable flow control + * according to the "hw->fc" parameter. + * + * The possible values of the "fc" parameter are: + * 0: Flow control is completely disabled + * 1: Rx flow control is enabled (we can receive pause + * frames but not send pause frames). + * 2: Tx flow control is enabled (we can send pause frames + * frames but we do not receive pause frames). + * 3: Both Rx and TX flow control (symmetric) is enabled. + * other: No other values should be possible at this point. + */ + + switch (hw->fc) { + case e1000_fc_none: + ctrl &= (~(E1000_CTRL_TFCE | E1000_CTRL_RFCE)); + break; + case e1000_fc_rx_pause: + ctrl &= (~E1000_CTRL_TFCE); + ctrl |= E1000_CTRL_RFCE; + break; + case e1000_fc_tx_pause: + ctrl &= (~E1000_CTRL_RFCE); + ctrl |= E1000_CTRL_TFCE; + break; + case e1000_fc_full: + ctrl |= (E1000_CTRL_TFCE | E1000_CTRL_RFCE); + break; + default: + DEBUGOUT("Flow control param set incorrectly\n"); + return -E1000_ERR_CONFIG; + } + + /* Disable TX Flow Control for 82542 (rev 2.0) */ + if(hw->mac_type == e1000_82542_rev2_0) + ctrl &= (~E1000_CTRL_TFCE); + + E1000_WRITE_REG(hw, CTRL, ctrl); + return E1000_SUCCESS; +} + +/****************************************************************************** + * Configures flow control settings after link is established + * + * hw - Struct containing variables accessed by shared code + * + * Should be called immediately after a valid link has been established. + * Forces MAC flow control settings if link was forced. When in MII/GMII mode + * and autonegotiation is enabled, the MAC flow control settings will be set + * based on the flow control negotiated by the PHY. In TBI mode, the TFCE + * and RFCE bits will be automaticaly set to the negotiated flow control mode. + *****************************************************************************/ +static int +e1000_config_fc_after_link_up(struct e1000_hw *hw) +{ + int32_t ret_val; + uint16_t mii_status_reg; + uint16_t mii_nway_adv_reg; + uint16_t mii_nway_lp_ability_reg; + uint16_t speed; + uint16_t duplex; + + DEBUGFUNC("e1000_config_fc_after_link_up"); + + /* Check for the case where we have fiber media and auto-neg failed + * so we had to force link. In this case, we need to force the + * configuration of the MAC to match the "fc" parameter. + */ + if(((hw->media_type == e1000_media_type_fiber) && (hw->autoneg_failed)) || + ((hw->media_type == e1000_media_type_internal_serdes) && (hw->autoneg_failed))) { + if((ret_val = e1000_force_mac_fc(hw))) { + DEBUGOUT("Error forcing flow control settings\n"); + return ret_val; + } + } + + /* Check for the case where we have copper media and auto-neg is + * enabled. In this case, we need to check and see if Auto-Neg + * has completed, and if so, how the PHY and link partner has + * flow control configured. + */ + if(hw->media_type == e1000_media_type_copper) { + /* Read the MII Status Register and check to see if AutoNeg + * has completed. We read this twice because this reg has + * some "sticky" (latched) bits. + */ + if((ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg))) + return ret_val; + if((ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg))) + return ret_val; + + if(mii_status_reg & MII_SR_AUTONEG_COMPLETE) { + /* The AutoNeg process has completed, so we now need to + * read both the Auto Negotiation Advertisement Register + * (Address 4) and the Auto_Negotiation Base Page Ability + * Register (Address 5) to determine how flow control was + * negotiated. + */ + if((ret_val = e1000_read_phy_reg(hw, PHY_AUTONEG_ADV, + &mii_nway_adv_reg))) + return ret_val; + if((ret_val = e1000_read_phy_reg(hw, PHY_LP_ABILITY, + &mii_nway_lp_ability_reg))) + return ret_val; + + /* Two bits in the Auto Negotiation Advertisement Register + * (Address 4) and two bits in the Auto Negotiation Base + * Page Ability Register (Address 5) determine flow control + * for both the PHY and the link partner. The following + * table, taken out of the IEEE 802.3ab/D6.0 dated March 25, + * 1999, describes these PAUSE resolution bits and how flow + * control is determined based upon these settings. + * NOTE: DC = Don't Care + * + * LOCAL DEVICE | LINK PARTNER + * PAUSE | ASM_DIR | PAUSE | ASM_DIR | NIC Resolution + *-------|---------|-------|---------|-------------------- + * 0 | 0 | DC | DC | e1000_fc_none + * 0 | 1 | 0 | DC | e1000_fc_none + * 0 | 1 | 1 | 0 | e1000_fc_none + * 0 | 1 | 1 | 1 | e1000_fc_tx_pause + * 1 | 0 | 0 | DC | e1000_fc_none + * 1 | DC | 1 | DC | e1000_fc_full + * 1 | 1 | 0 | 0 | e1000_fc_none + * 1 | 1 | 0 | 1 | e1000_fc_rx_pause + * + */ + /* Are both PAUSE bits set to 1? If so, this implies + * Symmetric Flow Control is enabled at both ends. The + * ASM_DIR bits are irrelevant per the spec. + * + * For Symmetric Flow Control: + * + * LOCAL DEVICE | LINK PARTNER + * PAUSE | ASM_DIR | PAUSE | ASM_DIR | Result + *-------|---------|-------|---------|-------------------- + * 1 | DC | 1 | DC | e1000_fc_full + * + */ + if((mii_nway_adv_reg & NWAY_AR_PAUSE) && + (mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE)) { + /* Now we need to check if the user selected RX ONLY + * of pause frames. In this case, we had to advertise + * FULL flow control because we could not advertise RX + * ONLY. Hence, we must now check to see if we need to + * turn OFF the TRANSMISSION of PAUSE frames. + */ +#if 0 + if(hw->original_fc == e1000_fc_full) { + hw->fc = e1000_fc_full; +#else + if(hw->fc == e1000_fc_full) { +#endif + DEBUGOUT("Flow Control = FULL.\r\n"); + } else { + hw->fc = e1000_fc_rx_pause; + DEBUGOUT("Flow Control = RX PAUSE frames only.\r\n"); + } + } + /* For receiving PAUSE frames ONLY. + * + * LOCAL DEVICE | LINK PARTNER + * PAUSE | ASM_DIR | PAUSE | ASM_DIR | Result + *-------|---------|-------|---------|-------------------- + * 0 | 1 | 1 | 1 | e1000_fc_tx_pause + * + */ + else if(!(mii_nway_adv_reg & NWAY_AR_PAUSE) && + (mii_nway_adv_reg & NWAY_AR_ASM_DIR) && + (mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE) && + (mii_nway_lp_ability_reg & NWAY_LPAR_ASM_DIR)) { + hw->fc = e1000_fc_tx_pause; + DEBUGOUT("Flow Control = TX PAUSE frames only.\r\n"); + } + /* For transmitting PAUSE frames ONLY. + * + * LOCAL DEVICE | LINK PARTNER + * PAUSE | ASM_DIR | PAUSE | ASM_DIR | Result + *-------|---------|-------|---------|-------------------- + * 1 | 1 | 0 | 1 | e1000_fc_rx_pause + * + */ + else if((mii_nway_adv_reg & NWAY_AR_PAUSE) && + (mii_nway_adv_reg & NWAY_AR_ASM_DIR) && + !(mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE) && + (mii_nway_lp_ability_reg & NWAY_LPAR_ASM_DIR)) { + hw->fc = e1000_fc_rx_pause; + DEBUGOUT("Flow Control = RX PAUSE frames only.\r\n"); + } + /* Per the IEEE spec, at this point flow control should be + * disabled. However, we want to consider that we could + * be connected to a legacy switch that doesn't advertise + * desired flow control, but can be forced on the link + * partner. So if we advertised no flow control, that is + * what we will resolve to. If we advertised some kind of + * receive capability (Rx Pause Only or Full Flow Control) + * and the link partner advertised none, we will configure + * ourselves to enable Rx Flow Control only. We can do + * this safely for two reasons: If the link partner really + * didn't want flow control enabled, and we enable Rx, no + * harm done since we won't be receiving any PAUSE frames + * anyway. If the intent on the link partner was to have + * flow control enabled, then by us enabling RX only, we + * can at least receive pause frames and process them. + * This is a good idea because in most cases, since we are + * predominantly a server NIC, more times than not we will + * be asked to delay transmission of packets than asking + * our link partner to pause transmission of frames. + */ +#if 0 + else if(hw->original_fc == e1000_fc_none || + hw->original_fc == e1000_fc_tx_pause) { +#else + else if(hw->fc == e1000_fc_none) + DEBUGOUT("Flow Control = NONE.\r\n"); + else if(hw->fc == e1000_fc_tx_pause) { +#endif + hw->fc = e1000_fc_none; + DEBUGOUT("Flow Control = NONE.\r\n"); + } else { + hw->fc = e1000_fc_rx_pause; + DEBUGOUT("Flow Control = RX PAUSE frames only.\r\n"); + } + + /* Now we need to do one last check... If we auto- + * negotiated to HALF DUPLEX, flow control should not be + * enabled per IEEE 802.3 spec. + */ + e1000_get_speed_and_duplex(hw, &speed, &duplex); + + if(duplex == HALF_DUPLEX) + hw->fc = e1000_fc_none; + + /* Now we call a subroutine to actually force the MAC + * controller to use the correct flow control settings. + */ + if((ret_val = e1000_force_mac_fc(hw))) { + DEBUGOUT("Error forcing flow control settings\n"); + return ret_val; + } + } else { + DEBUGOUT("Copper PHY and Auto Neg has not completed.\r\n"); + } + } + return E1000_SUCCESS; +} + +/****************************************************************************** + * Checks to see if the link status of the hardware has changed. + * + * hw - Struct containing variables accessed by shared code + * + * Called by any function that needs to check the link status of the adapter. + *****************************************************************************/ +static int +e1000_check_for_link(struct e1000_hw *hw) +{ + uint32_t rxcw; + uint32_t ctrl; + uint32_t status; + uint32_t rctl; + uint32_t signal = 0; + int32_t ret_val; + uint16_t phy_data; + uint16_t lp_capability; + + DEBUGFUNC("e1000_check_for_link"); + + /* On adapters with a MAC newer than 82544, SW Defineable pin 1 will be + * set when the optics detect a signal. On older adapters, it will be + * cleared when there is a signal. This applies to fiber media only. + */ + if(hw->media_type == e1000_media_type_fiber) + signal = (hw->mac_type > e1000_82544) ? E1000_CTRL_SWDPIN1 : 0; + + ctrl = E1000_READ_REG(hw, CTRL); + status = E1000_READ_REG(hw, STATUS); + rxcw = E1000_READ_REG(hw, RXCW); + + /* If we have a copper PHY then we only want to go out to the PHY + * registers to see if Auto-Neg has completed and/or if our link + * status has changed. The get_link_status flag will be set if we + * receive a Link Status Change interrupt or we have Rx Sequence + * Errors. + */ +#if 0 + if((hw->media_type == e1000_media_type_copper) && hw->get_link_status) { +#else + if(hw->media_type == e1000_media_type_copper) { +#endif + /* First we want to see if the MII Status Register reports + * link. If so, then we want to get the current speed/duplex + * of the PHY. + * Read the register twice since the link bit is sticky. + */ + if((ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data))) + return ret_val; + if((ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data))) + return ret_val; + + if(phy_data & MII_SR_LINK_STATUS) { +#if 0 + hw->get_link_status = FALSE; +#endif + } else { + /* No link detected */ + return -E1000_ERR_NOLINK; + } + + /* We have a M88E1000 PHY and Auto-Neg is enabled. If we + * have Si on board that is 82544 or newer, Auto + * Speed Detection takes care of MAC speed/duplex + * configuration. So we only need to configure Collision + * Distance in the MAC. Otherwise, we need to force + * speed/duplex on the MAC to the current PHY speed/duplex + * settings. + */ + if(hw->mac_type >= e1000_82544) + e1000_config_collision_dist(hw); + else { + if((ret_val = e1000_config_mac_to_phy(hw))) { + DEBUGOUT("Error configuring MAC to PHY settings\n"); + return ret_val; + } + } + + /* Configure Flow Control now that Auto-Neg has completed. First, we + * need to restore the desired flow control settings because we may + * have had to re-autoneg with a different link partner. + */ + if((ret_val = e1000_config_fc_after_link_up(hw))) { + DEBUGOUT("Error configuring flow control\n"); + return ret_val; + } + + /* At this point we know that we are on copper and we have + * auto-negotiated link. These are conditions for checking the link + * parter capability register. We use the link partner capability to + * determine if TBI Compatibility needs to be turned on or off. If + * the link partner advertises any speed in addition to Gigabit, then + * we assume that they are GMII-based, and TBI compatibility is not + * needed. If no other speeds are advertised, we assume the link + * partner is TBI-based, and we turn on TBI Compatibility. + */ + if(hw->tbi_compatibility_en) { + if((ret_val = e1000_read_phy_reg(hw, PHY_LP_ABILITY, + &lp_capability))) + return ret_val; + if(lp_capability & (NWAY_LPAR_10T_HD_CAPS | + NWAY_LPAR_10T_FD_CAPS | + NWAY_LPAR_100TX_HD_CAPS | + NWAY_LPAR_100TX_FD_CAPS | + NWAY_LPAR_100T4_CAPS)) { + /* If our link partner advertises anything in addition to + * gigabit, we do not need to enable TBI compatibility. + */ + if(hw->tbi_compatibility_on) { + /* If we previously were in the mode, turn it off. */ + rctl = E1000_READ_REG(hw, RCTL); + rctl &= ~E1000_RCTL_SBP; + E1000_WRITE_REG(hw, RCTL, rctl); + hw->tbi_compatibility_on = FALSE; + } + } else { + /* If TBI compatibility is was previously off, turn it on. For + * compatibility with a TBI link partner, we will store bad + * packets. Some frames have an additional byte on the end and + * will look like CRC errors to to the hardware. + */ + if(!hw->tbi_compatibility_on) { + hw->tbi_compatibility_on = TRUE; + rctl = E1000_READ_REG(hw, RCTL); + rctl |= E1000_RCTL_SBP; + E1000_WRITE_REG(hw, RCTL, rctl); + } + } + } + } + /* If we don't have link (auto-negotiation failed or link partner cannot + * auto-negotiate), the cable is plugged in (we have signal), and our + * link partner is not trying to auto-negotiate with us (we are receiving + * idles or data), we need to force link up. We also need to give + * auto-negotiation time to complete, in case the cable was just plugged + * in. The autoneg_failed flag does this. + */ + else if((((hw->media_type == e1000_media_type_fiber) && + ((ctrl & E1000_CTRL_SWDPIN1) == signal)) || + (hw->media_type == e1000_media_type_internal_serdes)) && + (!(status & E1000_STATUS_LU)) && + (!(rxcw & E1000_RXCW_C))) { + if(hw->autoneg_failed == 0) { + hw->autoneg_failed = 1; + return 0; + } + DEBUGOUT("NOT RXing /C/, disable AutoNeg and force link.\r\n"); + + /* Disable auto-negotiation in the TXCW register */ + E1000_WRITE_REG(hw, TXCW, (hw->txcw & ~E1000_TXCW_ANE)); + + /* Force link-up and also force full-duplex. */ + ctrl = E1000_READ_REG(hw, CTRL); + ctrl |= (E1000_CTRL_SLU | E1000_CTRL_FD); + E1000_WRITE_REG(hw, CTRL, ctrl); + + /* Configure Flow Control after forcing link up. */ + if((ret_val = e1000_config_fc_after_link_up(hw))) { + DEBUGOUT("Error configuring flow control\n"); + return ret_val; + } + } + /* If we are forcing link and we are receiving /C/ ordered sets, re-enable + * auto-negotiation in the TXCW register and disable forced link in the + * Device Control register in an attempt to auto-negotiate with our link + * partner. + */ + else if(((hw->media_type == e1000_media_type_fiber) || + (hw->media_type == e1000_media_type_internal_serdes)) && + (ctrl & E1000_CTRL_SLU) && + (rxcw & E1000_RXCW_C)) { + DEBUGOUT("RXing /C/, enable AutoNeg and stop forcing link.\r\n"); + E1000_WRITE_REG(hw, TXCW, hw->txcw); + E1000_WRITE_REG(hw, CTRL, (ctrl & ~E1000_CTRL_SLU)); + } +#if 0 + /* If we force link for non-auto-negotiation switch, check link status + * based on MAC synchronization for internal serdes media type. + */ + else if((hw->media_type == e1000_media_type_internal_serdes) && + !(E1000_TXCW_ANE & E1000_READ_REG(hw, TXCW))) { + /* SYNCH bit and IV bit are sticky. */ + udelay(10); + if(E1000_RXCW_SYNCH & E1000_READ_REG(hw, RXCW)) { + if(!(rxcw & E1000_RXCW_IV)) { + hw->serdes_link_down = FALSE; + DEBUGOUT("SERDES: Link is up.\n"); + } + } else { + hw->serdes_link_down = TRUE; + DEBUGOUT("SERDES: Link is down.\n"); + } + } +#endif + return E1000_SUCCESS; +} + +/****************************************************************************** + * Detects the current speed and duplex settings of the hardware. + * + * hw - Struct containing variables accessed by shared code + * speed - Speed of the connection + * duplex - Duplex setting of the connection + *****************************************************************************/ +static void +e1000_get_speed_and_duplex(struct e1000_hw *hw, + uint16_t *speed, + uint16_t *duplex) +{ + uint32_t status; + + DEBUGFUNC("e1000_get_speed_and_duplex"); + + if(hw->mac_type >= e1000_82543) { + status = E1000_READ_REG(hw, STATUS); + if(status & E1000_STATUS_SPEED_1000) { + *speed = SPEED_1000; + DEBUGOUT("1000 Mbs, "); + } else if(status & E1000_STATUS_SPEED_100) { + *speed = SPEED_100; + DEBUGOUT("100 Mbs, "); + } else { + *speed = SPEED_10; + DEBUGOUT("10 Mbs, "); + } + + if(status & E1000_STATUS_FD) { + *duplex = FULL_DUPLEX; + DEBUGOUT("Full Duplex\r\n"); + } else { + *duplex = HALF_DUPLEX; + DEBUGOUT(" Half Duplex\r\n"); + } + } else { + DEBUGOUT("1000 Mbs, Full Duplex\r\n"); + *speed = SPEED_1000; + *duplex = FULL_DUPLEX; + } +} + +/****************************************************************************** +* Blocks until autoneg completes or times out (~4.5 seconds) +* +* hw - Struct containing variables accessed by shared code +******************************************************************************/ +static int +e1000_wait_autoneg(struct e1000_hw *hw) +{ + int32_t ret_val; + uint16_t i; + uint16_t phy_data; + + DEBUGFUNC("e1000_wait_autoneg"); + DEBUGOUT("Waiting for Auto-Neg to complete.\n"); + + /* We will wait for autoneg to complete or 4.5 seconds to expire. */ + for(i = PHY_AUTO_NEG_TIME; i > 0; i--) { + /* Read the MII Status Register and wait for Auto-Neg + * Complete bit to be set. + */ + if((ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data))) + return ret_val; + if((ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data))) + return ret_val; + if(phy_data & MII_SR_AUTONEG_COMPLETE) { + DEBUGOUT("Auto-Neg complete.\n"); + return E1000_SUCCESS; + } + mdelay(100); + } + DEBUGOUT("Auto-Neg timedout.\n"); + return -E1000_ERR_TIMEOUT; +} + +/****************************************************************************** +* Raises the Management Data Clock +* +* hw - Struct containing variables accessed by shared code +* ctrl - Device control register's current value +******************************************************************************/ +static void +e1000_raise_mdi_clk(struct e1000_hw *hw, + uint32_t *ctrl) +{ + /* Raise the clock input to the Management Data Clock (by setting the MDC + * bit), and then delay 10 microseconds. + */ + E1000_WRITE_REG(hw, CTRL, (*ctrl | E1000_CTRL_MDC)); + E1000_WRITE_FLUSH(hw); + udelay(10); +} + +/****************************************************************************** +* Lowers the Management Data Clock +* +* hw - Struct containing variables accessed by shared code +* ctrl - Device control register's current value +******************************************************************************/ +static void +e1000_lower_mdi_clk(struct e1000_hw *hw, + uint32_t *ctrl) +{ + /* Lower the clock input to the Management Data Clock (by clearing the MDC + * bit), and then delay 10 microseconds. + */ + E1000_WRITE_REG(hw, CTRL, (*ctrl & ~E1000_CTRL_MDC)); + E1000_WRITE_FLUSH(hw); + udelay(10); +} + +/****************************************************************************** +* Shifts data bits out to the PHY +* +* hw - Struct containing variables accessed by shared code +* data - Data to send out to the PHY +* count - Number of bits to shift out +* +* Bits are shifted out in MSB to LSB order. +******************************************************************************/ +static void +e1000_shift_out_mdi_bits(struct e1000_hw *hw, + uint32_t data, + uint16_t count) +{ + uint32_t ctrl; + uint32_t mask; + + /* We need to shift "count" number of bits out to the PHY. So, the value + * in the "data" parameter will be shifted out to the PHY one bit at a + * time. In order to do this, "data" must be broken down into bits. + */ + mask = 0x01; + mask <<= (count - 1); + + ctrl = E1000_READ_REG(hw, CTRL); + + /* Set MDIO_DIR and MDC_DIR direction bits to be used as output pins. */ + ctrl |= (E1000_CTRL_MDIO_DIR | E1000_CTRL_MDC_DIR); + + while(mask) { + /* A "1" is shifted out to the PHY by setting the MDIO bit to "1" and + * then raising and lowering the Management Data Clock. A "0" is + * shifted out to the PHY by setting the MDIO bit to "0" and then + * raising and lowering the clock. + */ + if(data & mask) ctrl |= E1000_CTRL_MDIO; + else ctrl &= ~E1000_CTRL_MDIO; + + E1000_WRITE_REG(hw, CTRL, ctrl); + E1000_WRITE_FLUSH(hw); + + udelay(10); + + e1000_raise_mdi_clk(hw, &ctrl); + e1000_lower_mdi_clk(hw, &ctrl); + + mask = mask >> 1; + } +} + +/****************************************************************************** +* Shifts data bits in from the PHY +* +* hw - Struct containing variables accessed by shared code +* +* Bits are shifted in in MSB to LSB order. +******************************************************************************/ +static uint16_t +e1000_shift_in_mdi_bits(struct e1000_hw *hw) +{ + uint32_t ctrl; + uint16_t data = 0; + uint8_t i; + + /* In order to read a register from the PHY, we need to shift in a total + * of 18 bits from the PHY. The first two bit (turnaround) times are used + * to avoid contention on the MDIO pin when a read operation is performed. + * These two bits are ignored by us and thrown away. Bits are "shifted in" + * by raising the input to the Management Data Clock (setting the MDC bit), + * and then reading the value of the MDIO bit. + */ + ctrl = E1000_READ_REG(hw, CTRL); + + /* Clear MDIO_DIR (SWDPIO1) to indicate this bit is to be used as input. */ + ctrl &= ~E1000_CTRL_MDIO_DIR; + ctrl &= ~E1000_CTRL_MDIO; + + E1000_WRITE_REG(hw, CTRL, ctrl); + E1000_WRITE_FLUSH(hw); + + /* Raise and Lower the clock before reading in the data. This accounts for + * the turnaround bits. The first clock occurred when we clocked out the + * last bit of the Register Address. + */ + e1000_raise_mdi_clk(hw, &ctrl); + e1000_lower_mdi_clk(hw, &ctrl); + + for(data = 0, i = 0; i < 16; i++) { + data = data << 1; + e1000_raise_mdi_clk(hw, &ctrl); + ctrl = E1000_READ_REG(hw, CTRL); + /* Check to see if we shifted in a "1". */ + if(ctrl & E1000_CTRL_MDIO) data |= 1; + e1000_lower_mdi_clk(hw, &ctrl); + } + + e1000_raise_mdi_clk(hw, &ctrl); + e1000_lower_mdi_clk(hw, &ctrl); + + return data; +} + +/***************************************************************************** +* Reads the value from a PHY register, if the value is on a specific non zero +* page, sets the page first. +* +* hw - Struct containing variables accessed by shared code +* reg_addr - address of the PHY register to read +******************************************************************************/ +static int +e1000_read_phy_reg(struct e1000_hw *hw, + uint32_t reg_addr, + uint16_t *phy_data) +{ + uint32_t ret_val; + + DEBUGFUNC("e1000_read_phy_reg"); + + if(hw->phy_type == e1000_phy_igp && + (reg_addr > MAX_PHY_MULTI_PAGE_REG)) { + if((ret_val = e1000_write_phy_reg_ex(hw, IGP01E1000_PHY_PAGE_SELECT, + (uint16_t)reg_addr))) + return ret_val; + } + + ret_val = e1000_read_phy_reg_ex(hw, IGP01E1000_PHY_PAGE_SELECT & reg_addr, + phy_data); + + return ret_val; +} + +static int +e1000_read_phy_reg_ex(struct e1000_hw *hw, + uint32_t reg_addr, + uint16_t *phy_data) +{ + uint32_t i; + uint32_t mdic = 0; + const uint32_t phy_addr = 1; + + DEBUGFUNC("e1000_read_phy_reg_ex"); + + if(reg_addr > MAX_PHY_REG_ADDRESS) { + DEBUGOUT1("PHY Address %d is out of range\n", reg_addr); + return -E1000_ERR_PARAM; + } + + if(hw->mac_type > e1000_82543) { + /* Set up Op-code, Phy Address, and register address in the MDI + * Control register. The MAC will take care of interfacing with the + * PHY to retrieve the desired data. + */ + mdic = ((reg_addr << E1000_MDIC_REG_SHIFT) | + (phy_addr << E1000_MDIC_PHY_SHIFT) | + (E1000_MDIC_OP_READ)); + + E1000_WRITE_REG(hw, MDIC, mdic); + + /* Poll the ready bit to see if the MDI read completed */ + for(i = 0; i < 64; i++) { + udelay(50); + mdic = E1000_READ_REG(hw, MDIC); + if(mdic & E1000_MDIC_READY) break; + } + if(!(mdic & E1000_MDIC_READY)) { + DEBUGOUT("MDI Read did not complete\n"); + return -E1000_ERR_PHY; + } + if(mdic & E1000_MDIC_ERROR) { + DEBUGOUT("MDI Error\n"); + return -E1000_ERR_PHY; + } + *phy_data = (uint16_t) mdic; + } else { + /* We must first send a preamble through the MDIO pin to signal the + * beginning of an MII instruction. This is done by sending 32 + * consecutive "1" bits. + */ + e1000_shift_out_mdi_bits(hw, PHY_PREAMBLE, PHY_PREAMBLE_SIZE); + + /* Now combine the next few fields that are required for a read + * operation. We use this method instead of calling the + * e1000_shift_out_mdi_bits routine five different times. The format of + * a MII read instruction consists of a shift out of 14 bits and is + * defined as follows: + * + * followed by a shift in of 18 bits. This first two bits shifted in + * are TurnAround bits used to avoid contention on the MDIO pin when a + * READ operation is performed. These two bits are thrown away + * followed by a shift in of 16 bits which contains the desired data. + */ + mdic = ((reg_addr) | (phy_addr << 5) | + (PHY_OP_READ << 10) | (PHY_SOF << 12)); + + e1000_shift_out_mdi_bits(hw, mdic, 14); + + /* Now that we've shifted out the read command to the MII, we need to + * "shift in" the 16-bit value (18 total bits) of the requested PHY + * register address. + */ + *phy_data = e1000_shift_in_mdi_bits(hw); + } + return E1000_SUCCESS; +} + +/****************************************************************************** +* Writes a value to a PHY register +* +* hw - Struct containing variables accessed by shared code +* reg_addr - address of the PHY register to write +* data - data to write to the PHY +******************************************************************************/ +static int +e1000_write_phy_reg(struct e1000_hw *hw, + uint32_t reg_addr, + uint16_t phy_data) +{ + uint32_t ret_val; + + DEBUGFUNC("e1000_write_phy_reg"); + + if(hw->phy_type == e1000_phy_igp && + (reg_addr > MAX_PHY_MULTI_PAGE_REG)) { + if((ret_val = e1000_write_phy_reg_ex(hw, IGP01E1000_PHY_PAGE_SELECT, + (uint16_t)reg_addr))) + return ret_val; + } + + ret_val = e1000_write_phy_reg_ex(hw, IGP01E1000_PHY_PAGE_SELECT & reg_addr, + phy_data); + + return ret_val; +} + +static int +e1000_write_phy_reg_ex(struct e1000_hw *hw, + uint32_t reg_addr, + uint16_t phy_data) +{ + uint32_t i; + uint32_t mdic = 0; + const uint32_t phy_addr = 1; + + DEBUGFUNC("e1000_write_phy_reg_ex"); + + if(reg_addr > MAX_PHY_REG_ADDRESS) { + DEBUGOUT1("PHY Address %d is out of range\n", reg_addr); + return -E1000_ERR_PARAM; + } + + if(hw->mac_type > e1000_82543) { + /* Set up Op-code, Phy Address, register address, and data intended + * for the PHY register in the MDI Control register. The MAC will take + * care of interfacing with the PHY to send the desired data. + */ + mdic = (((uint32_t) phy_data) | + (reg_addr << E1000_MDIC_REG_SHIFT) | + (phy_addr << E1000_MDIC_PHY_SHIFT) | + (E1000_MDIC_OP_WRITE)); + + E1000_WRITE_REG(hw, MDIC, mdic); + + /* Poll the ready bit to see if the MDI read completed */ + for(i = 0; i < 640; i++) { + udelay(5); + mdic = E1000_READ_REG(hw, MDIC); + if(mdic & E1000_MDIC_READY) break; + } + if(!(mdic & E1000_MDIC_READY)) { + DEBUGOUT("MDI Write did not complete\n"); + return -E1000_ERR_PHY; + } + } else { + /* We'll need to use the SW defined pins to shift the write command + * out to the PHY. We first send a preamble to the PHY to signal the + * beginning of the MII instruction. This is done by sending 32 + * consecutive "1" bits. + */ + e1000_shift_out_mdi_bits(hw, PHY_PREAMBLE, PHY_PREAMBLE_SIZE); + + /* Now combine the remaining required fields that will indicate a + * write operation. We use this method instead of calling the + * e1000_shift_out_mdi_bits routine for each field in the command. The + * format of a MII write instruction is as follows: + * . + */ + mdic = ((PHY_TURNAROUND) | (reg_addr << 2) | (phy_addr << 7) | + (PHY_OP_WRITE << 12) | (PHY_SOF << 14)); + mdic <<= 16; + mdic |= (uint32_t) phy_data; + + e1000_shift_out_mdi_bits(hw, mdic, 32); + } + + return E1000_SUCCESS; +} + +/****************************************************************************** +* Returns the PHY to the power-on reset state +* +* hw - Struct containing variables accessed by shared code +******************************************************************************/ +static void +e1000_phy_hw_reset(struct e1000_hw *hw) +{ + uint32_t ctrl, ctrl_ext; + + DEBUGFUNC("e1000_phy_hw_reset"); + + DEBUGOUT("Resetting Phy...\n"); + + if(hw->mac_type > e1000_82543) { + /* Read the device control register and assert the E1000_CTRL_PHY_RST + * bit. Then, take it out of reset. + */ + ctrl = E1000_READ_REG(hw, CTRL); + E1000_WRITE_REG(hw, CTRL, ctrl | E1000_CTRL_PHY_RST); + E1000_WRITE_FLUSH(hw); + mdelay(10); + E1000_WRITE_REG(hw, CTRL, ctrl); + E1000_WRITE_FLUSH(hw); + } else { + /* Read the Extended Device Control Register, assert the PHY_RESET_DIR + * bit to put the PHY into reset. Then, take it out of reset. + */ + ctrl_ext = E1000_READ_REG(hw, CTRL_EXT); + ctrl_ext |= E1000_CTRL_EXT_SDP4_DIR; + ctrl_ext &= ~E1000_CTRL_EXT_SDP4_DATA; + E1000_WRITE_REG(hw, CTRL_EXT, ctrl_ext); + E1000_WRITE_FLUSH(hw); + mdelay(10); + ctrl_ext |= E1000_CTRL_EXT_SDP4_DATA; + E1000_WRITE_REG(hw, CTRL_EXT, ctrl_ext); + E1000_WRITE_FLUSH(hw); + } + udelay(150); +} + +/****************************************************************************** +* Resets the PHY +* +* hw - Struct containing variables accessed by shared code +* +* Sets bit 15 of the MII Control regiser +******************************************************************************/ +static int +e1000_phy_reset(struct e1000_hw *hw) +{ + int32_t ret_val; + uint16_t phy_data; + + DEBUGFUNC("e1000_phy_reset"); + + if(hw->mac_type != e1000_82541_rev_2) { + if((ret_val = e1000_read_phy_reg(hw, PHY_CTRL, &phy_data))) + return ret_val; + + phy_data |= MII_CR_RESET; + if((ret_val = e1000_write_phy_reg(hw, PHY_CTRL, phy_data))) + return ret_val; + + udelay(1); + } else e1000_phy_hw_reset(hw); + + if(hw->phy_type == e1000_phy_igp) + e1000_phy_init_script(hw); + + return E1000_SUCCESS; +} + +/****************************************************************************** +* Probes the expected PHY address for known PHY IDs +* +* hw - Struct containing variables accessed by shared code +******************************************************************************/ +static int +e1000_detect_gig_phy(struct e1000_hw *hw) +{ + int32_t phy_init_status, ret_val; + uint16_t phy_id_high, phy_id_low; + boolean_t match = FALSE; + + DEBUGFUNC("e1000_detect_gig_phy"); + + /* Read the PHY ID Registers to identify which PHY is onboard. */ + if((ret_val = e1000_read_phy_reg(hw, PHY_ID1, &phy_id_high))) + return ret_val; + + hw->phy_id = (uint32_t) (phy_id_high << 16); + udelay(20); + if((ret_val = e1000_read_phy_reg(hw, PHY_ID2, &phy_id_low))) + return ret_val; + + hw->phy_id |= (uint32_t) (phy_id_low & PHY_REVISION_MASK); +#ifdef LINUX_DRIVER + hw->phy_revision = (uint32_t) phy_id_low & ~PHY_REVISION_MASK; +#endif + + switch(hw->mac_type) { + case e1000_82543: + if(hw->phy_id == M88E1000_E_PHY_ID) match = TRUE; + break; + case e1000_82544: + if(hw->phy_id == M88E1000_I_PHY_ID) match = TRUE; + break; + case e1000_82540: + case e1000_82545: + case e1000_82545_rev_3: + case e1000_82546: + case e1000_82546_rev_3: + if(hw->phy_id == M88E1011_I_PHY_ID) match = TRUE; + break; + case e1000_82541: + case e1000_82541_rev_2: + case e1000_82547: + case e1000_82547_rev_2: + if(hw->phy_id == IGP01E1000_I_PHY_ID) match = TRUE; + break; + default: + DEBUGOUT1("Invalid MAC type %d\n", hw->mac_type); + return -E1000_ERR_CONFIG; + } + phy_init_status = e1000_set_phy_type(hw); + + if ((match) && (phy_init_status == E1000_SUCCESS)) { + DEBUGOUT1("PHY ID 0x%X detected\n", hw->phy_id); + return E1000_SUCCESS; + } + DEBUGOUT1("Invalid PHY ID 0x%X\n", hw->phy_id); + return -E1000_ERR_PHY; +} + +/****************************************************************************** + * Sets up eeprom variables in the hw struct. Must be called after mac_type + * is configured. + * + * hw - Struct containing variables accessed by shared code + *****************************************************************************/ +static void +e1000_init_eeprom_params(struct e1000_hw *hw) +{ + struct e1000_eeprom_info *eeprom = &hw->eeprom; + uint32_t eecd = E1000_READ_REG(hw, EECD); + uint16_t eeprom_size; + + DEBUGFUNC("e1000_init_eeprom_params"); + + switch (hw->mac_type) { + case e1000_82542_rev2_0: + case e1000_82542_rev2_1: + case e1000_82543: + case e1000_82544: + eeprom->type = e1000_eeprom_microwire; + eeprom->word_size = 64; + eeprom->opcode_bits = 3; + eeprom->address_bits = 6; + eeprom->delay_usec = 50; + break; + case e1000_82540: + case e1000_82545: + case e1000_82545_rev_3: + case e1000_82546: + case e1000_82546_rev_3: + eeprom->type = e1000_eeprom_microwire; + eeprom->opcode_bits = 3; + eeprom->delay_usec = 50; + if(eecd & E1000_EECD_SIZE) { + eeprom->word_size = 256; + eeprom->address_bits = 8; + } else { + eeprom->word_size = 64; + eeprom->address_bits = 6; + } + break; + case e1000_82541: + case e1000_82541_rev_2: + case e1000_82547: + case e1000_82547_rev_2: + if (eecd & E1000_EECD_TYPE) { + eeprom->type = e1000_eeprom_spi; + if (eecd & E1000_EECD_ADDR_BITS) { + eeprom->page_size = 32; + eeprom->address_bits = 16; + } else { + eeprom->page_size = 8; + eeprom->address_bits = 8; + } + } else { + eeprom->type = e1000_eeprom_microwire; + eeprom->opcode_bits = 3; + eeprom->delay_usec = 50; + if (eecd & E1000_EECD_ADDR_BITS) { + eeprom->word_size = 256; + eeprom->address_bits = 8; + } else { + eeprom->word_size = 64; + eeprom->address_bits = 6; + } + } + break; + default: + eeprom->type = e1000_eeprom_spi; + if (eecd & E1000_EECD_ADDR_BITS) { + eeprom->page_size = 32; + eeprom->address_bits = 16; + } else { + eeprom->page_size = 8; + eeprom->address_bits = 8; + } + break; + } + + if (eeprom->type == e1000_eeprom_spi) { + eeprom->opcode_bits = 8; + eeprom->delay_usec = 1; + eeprom->word_size = 64; + if (e1000_read_eeprom(hw, EEPROM_CFG, 1, &eeprom_size) == 0) { + eeprom_size &= EEPROM_SIZE_MASK; + + switch (eeprom_size) { + case EEPROM_SIZE_16KB: + eeprom->word_size = 8192; + break; + case EEPROM_SIZE_8KB: + eeprom->word_size = 4096; + break; + case EEPROM_SIZE_4KB: + eeprom->word_size = 2048; + break; + case EEPROM_SIZE_2KB: + eeprom->word_size = 1024; + break; + case EEPROM_SIZE_1KB: + eeprom->word_size = 512; + break; + case EEPROM_SIZE_512B: + eeprom->word_size = 256; + break; + case EEPROM_SIZE_128B: + default: + break; + } + } + } +} + +/** + * e1000_reset - Reset the adapter + */ + +static int +e1000_reset(struct e1000_hw *hw) +{ + uint32_t pba; + /* Repartition Pba for greater than 9k mtu + * To take effect CTRL.RST is required. + */ + + if(hw->mac_type < e1000_82547) { + pba = E1000_PBA_48K; + } else { + pba = E1000_PBA_30K; + } + E1000_WRITE_REG(hw, PBA, pba); + + /* flow control settings */ +#if 0 + hw->fc_high_water = FC_DEFAULT_HI_THRESH; + hw->fc_low_water = FC_DEFAULT_LO_THRESH; + hw->fc_pause_time = FC_DEFAULT_TX_TIMER; + hw->fc_send_xon = 1; + hw->fc = hw->original_fc; +#endif + + e1000_reset_hw(hw); + if(hw->mac_type >= e1000_82544) + E1000_WRITE_REG(hw, WUC, 0); + return e1000_init_hw(hw); +} + +/** + * e1000_sw_init - Initialize general software structures (struct e1000_adapter) + * @adapter: board private structure to initialize + * + * e1000_sw_init initializes the Adapter private data structure. + * Fields are initialized based on PCI device information and + * OS network device settings (MTU size). + **/ + +static int +e1000_sw_init(struct pci_device *pdev, struct e1000_hw *hw) +{ + int result; + + /* PCI config space info */ + pci_read_config_word(pdev, PCI_VENDOR_ID, &hw->vendor_id); + pci_read_config_word(pdev, PCI_DEVICE_ID, &hw->device_id); + pci_read_config_byte(pdev, PCI_REVISION, &hw->revision_id); +#if 0 + pci_read_config_word(pdev, PCI_SUBSYSTEM_VENDOR_ID, + &hw->subsystem_vendor_id); + pci_read_config_word(pdev, PCI_SUBSYSTEM_ID, &hw->subsystem_id); +#endif + + pci_read_config_word(pdev, PCI_COMMAND, &hw->pci_cmd_word); + + /* identify the MAC */ + + result = e1000_set_mac_type(hw); + if (result) { + E1000_ERR("Unknown MAC Type\n"); + return result; + } + + /* initialize eeprom parameters */ + + e1000_init_eeprom_params(hw); + +#if 0 + if((hw->mac_type == e1000_82541) || + (hw->mac_type == e1000_82547) || + (hw->mac_type == e1000_82541_rev_2) || + (hw->mac_type == e1000_82547_rev_2)) + hw->phy_init_script = 1; +#endif + + e1000_set_media_type(hw); + +#if 0 + if(hw->mac_type < e1000_82543) + hw->report_tx_early = 0; + else + hw->report_tx_early = 1; + + hw->wait_autoneg_complete = FALSE; +#endif + hw->tbi_compatibility_en = TRUE; +#if 0 + hw->adaptive_ifs = TRUE; + + /* Copper options */ + + if(hw->media_type == e1000_media_type_copper) { + hw->mdix = AUTO_ALL_MODES; + hw->disable_polarity_correction = FALSE; + hw->master_slave = E1000_MASTER_SLAVE; + } +#endif + return E1000_SUCCESS; +} + +static void fill_rx (void) +{ + struct e1000_rx_desc *rd; + rx_last = rx_tail; + rd = rx_base + rx_tail; + rx_tail = (rx_tail + 1) % 8; + memset (rd, 0, 16); + rd->buffer_addr = virt_to_bus(&packet); + E1000_WRITE_REG (&hw, RDT, rx_tail); +} + +static void init_descriptor (void) +{ + unsigned long ptr; + unsigned long tctl; + + ptr = virt_to_phys(tx_pool); + if (ptr & 0xf) + ptr = (ptr + 0x10) & (~0xf); + + tx_base = phys_to_virt(ptr); + + E1000_WRITE_REG (&hw, TDBAL, virt_to_bus(tx_base)); + E1000_WRITE_REG (&hw, TDBAH, 0); + E1000_WRITE_REG (&hw, TDLEN, 128); + + /* Setup the HW Tx Head and Tail descriptor pointers */ + + E1000_WRITE_REG (&hw, TDH, 0); + E1000_WRITE_REG (&hw, TDT, 0); + tx_tail = 0; + + /* Program the Transmit Control Register */ + +#ifdef LINUX_DRIVER_TCTL + tctl = E1000_READ_REG(&hw, TCTL); + + tctl &= ~E1000_TCTL_CT; + tctl |= E1000_TCTL_EN | E1000_TCTL_PSP | + (E1000_COLLISION_THRESHOLD << E1000_CT_SHIFT); +#else + tctl = E1000_TCTL_PSP | E1000_TCTL_EN | + (E1000_COLLISION_THRESHOLD << E1000_CT_SHIFT) | + (E1000_HDX_COLLISION_DISTANCE << E1000_COLD_SHIFT); +#endif + + E1000_WRITE_REG (&hw, TCTL, tctl); + + e1000_config_collision_dist(&hw); + + + rx_tail = 0; + /* disable receive */ + E1000_WRITE_REG (&hw, RCTL, 0); + ptr = virt_to_phys(rx_pool); + if (ptr & 0xf) + ptr = (ptr + 0x10) & (~0xf); + rx_base = phys_to_virt(ptr); + + /* Setup the Base and Length of the Rx Descriptor Ring */ + + E1000_WRITE_REG (&hw, RDBAL, virt_to_bus(rx_base)); + E1000_WRITE_REG (&hw, RDBAH, 0); + + E1000_WRITE_REG (&hw, RDLEN, 128); + + /* Setup the HW Rx Head and Tail Descriptor Pointers */ + E1000_WRITE_REG (&hw, RDH, 0); + E1000_WRITE_REG (&hw, RDT, 0); + + E1000_WRITE_REG (&hw, RCTL, + E1000_RCTL_EN | + E1000_RCTL_BAM | + E1000_RCTL_SZ_2048 | + E1000_RCTL_MPE); + fill_rx(); +} + + + +/************************************************************************** +POLL - Wait for a frame +***************************************************************************/ +static int +e1000_poll (struct nic *nic, int retrieve) +{ + /* return true if there's an ethernet packet ready to read */ + /* nic->packet should contain data on return */ + /* nic->packetlen should contain length of data */ + struct e1000_rx_desc *rd; + + rd = rx_base + rx_last; + if (!rd->status & E1000_RXD_STAT_DD) + return 0; + + if ( ! retrieve ) return 1; + + // printf("recv: packet %! -> %! len=%d \n", packet+6, packet,rd->Length); + memcpy (nic->packet, packet, rd->length); + nic->packetlen = rd->length; + fill_rx (); + return 1; +} + +/************************************************************************** +TRANSMIT - Transmit a frame +***************************************************************************/ +static void +e1000_transmit (struct nic *nic, const char *d, /* Destination */ + unsigned int type, /* Type */ + unsigned int size, /* size */ + const char *p) /* Packet */ +{ + /* send the packet to destination */ + struct eth_hdr { + unsigned char dst_addr[ETH_ALEN]; + unsigned char src_addr[ETH_ALEN]; + unsigned short type; + } hdr; + struct e1000_tx_desc *txhd; /* header */ + struct e1000_tx_desc *txp; /* payload */ + DEBUGFUNC("send"); + + memcpy (&hdr.dst_addr, d, ETH_ALEN); + memcpy (&hdr.src_addr, nic->node_addr, ETH_ALEN); + + hdr.type = htons (type); + txhd = tx_base + tx_tail; + tx_tail = (tx_tail + 1) % 8; + txp = tx_base + tx_tail; + tx_tail = (tx_tail + 1) % 8; + + txhd->buffer_addr = virt_to_bus (&hdr); + txhd->lower.data = sizeof (hdr); + txhd->upper.data = 0; + + txp->buffer_addr = virt_to_bus(p); + txp->lower.data = E1000_TXD_CMD_RPS | E1000_TXD_CMD_EOP | E1000_TXD_CMD_IFCS | size; + txp->upper.data = 0; + + E1000_WRITE_REG (&hw, TDT, tx_tail); + while (!(txp->upper.data & E1000_TXD_STAT_DD)) { + udelay(10); /* give the nic a chance to write to the register */ + poll_interruptions(); + } + DEBUGFUNC("send end"); +} + + +/************************************************************************** +DISABLE - Turn off ethernet interface +***************************************************************************/ +static void e1000_disable (struct dev *dev __unused) +{ + /* Clear the transmit ring */ + E1000_WRITE_REG (&hw, TDH, 0); + E1000_WRITE_REG (&hw, TDT, 0); + + /* Clear the receive ring */ + E1000_WRITE_REG (&hw, RDH, 0); + E1000_WRITE_REG (&hw, RDT, 0); + + /* put the card in its initial state */ + E1000_WRITE_REG (&hw, CTRL, E1000_CTRL_RST); + + /* Turn off the ethernet interface */ + E1000_WRITE_REG (&hw, RCTL, 0); + E1000_WRITE_REG (&hw, TCTL, 0); + mdelay (10); + + /* Unmap my window to the device */ + iounmap(hw.hw_addr); +} + +/************************************************************************** +IRQ - Enable, Disable, or Force interrupts +***************************************************************************/ +static void e1000_irq(struct nic *nic __unused, irq_action_t action __unused) +{ + switch ( action ) { + case DISABLE : + break; + case ENABLE : + break; + case FORCE : + break; + } +} + +#define IORESOURCE_IO 0x00000100 /* Resource type */ +#define BAR_0 0 +#define BAR_1 1 +#define BAR_5 5 + +/************************************************************************** +PROBE - Look for an adapter, this routine's visible to the outside +You should omit the last argument struct pci_device * for a non-PCI NIC +***************************************************************************/ +static int e1000_probe(struct dev *dev, struct pci_device *p) +{ + struct nic *nic = (struct nic *)dev; + unsigned long mmio_start, mmio_len; + int ret_val, i; + + if (p == 0) + return 0; + /* Initialize hw with default values */ + memset(&hw, 0, sizeof(hw)); + hw.pdev = p; + +#if 1 + /* Are these variables needed? */ + hw.fc = e1000_fc_none; +#if 0 + hw.original_fc = e1000_fc_none; +#endif + hw.autoneg_failed = 0; +#if 0 + hw.get_link_status = TRUE; +#endif +#endif + + mmio_start = pci_bar_start(p, PCI_BASE_ADDRESS_0); + mmio_len = pci_bar_size(p, PCI_BASE_ADDRESS_0); + hw.hw_addr = ioremap(mmio_start, mmio_len); + + for(i = BAR_1; i <= BAR_5; i++) { + if(pci_bar_size(p, i) == 0) + continue; + if(pci_find_capability(p, i) & IORESOURCE_IO) { + hw.io_base = pci_bar_start(p, i); + break; + } + } + + adjust_pci_device(p); + + nic->ioaddr = p->ioaddr & ~3; + nic->irqno = 0; + + /* From Matt Hortman */ + /* MAC and Phy settings */ + + /* setup the private structure */ + if (e1000_sw_init(p, &hw) < 0) { + iounmap(hw.hw_addr); + return 0; + } + + /* make sure the EEPROM is good */ + + if (e1000_validate_eeprom_checksum(&hw) < 0) { + printf ("The EEPROM Checksum Is Not Valid\n"); + iounmap(hw.hw_addr); + return 0; + } + + /* copy the MAC address out of the EEPROM */ + + e1000_read_mac_addr(&hw); + memcpy (nic->node_addr, hw.mac_addr, ETH_ALEN); + + printf("Ethernet addr: %!\n", nic->node_addr); + + /* reset the hardware with the new settings */ + + ret_val = e1000_reset(&hw); + if (ret_val < 0) { + if ((ret_val == -E1000_ERR_NOLINK) || + (ret_val == -E1000_ERR_TIMEOUT)) { + E1000_ERR("Valid Link not detected\n"); + } else { + E1000_ERR("Hardware Initialization Failed\n"); + } + iounmap(hw.hw_addr); + return 0; + } + init_descriptor(); + + /* point to NIC specific routines */ + dev->disable = e1000_disable; + nic->poll = e1000_poll; + nic->transmit = e1000_transmit; + nic->irq = e1000_irq; + + return 1; +} + +static struct pci_id e1000_nics[] = { +PCI_ROM(0x8086, 0x1000, "e1000-82542", "Intel EtherExpressPro1000"), +PCI_ROM(0x8086, 0x1001, "e1000-82543gc-fiber", "Intel EtherExpressPro1000 82543GC Fiber"), +PCI_ROM(0x8086, 0x1004, "e1000-82543gc-copper", "Intel EtherExpressPro1000 82543GC Copper"), +PCI_ROM(0x8086, 0x1008, "e1000-82544ei-copper", "Intel EtherExpressPro1000 82544EI Copper"), +PCI_ROM(0x8086, 0x1009, "e1000-82544ei-fiber", "Intel EtherExpressPro1000 82544EI Fiber"), +PCI_ROM(0x8086, 0x100C, "e1000-82544gc-copper", "Intel EtherExpressPro1000 82544GC Copper"), +PCI_ROM(0x8086, 0x100D, "e1000-82544gc-lom", "Intel EtherExpressPro1000 82544GC LOM"), +PCI_ROM(0x8086, 0x100E, "e1000-82540em", "Intel EtherExpressPro1000 82540EM"), +PCI_ROM(0x8086, 0x100F, "e1000-82545em-copper", "Intel EtherExpressPro1000 82545EM Copper"), +PCI_ROM(0x8086, 0x1010, "e1000-82546eb-copper", "Intel EtherExpressPro1000 82546EB Copper"), +PCI_ROM(0x8086, 0x1011, "e1000-82545em-fiber", "Intel EtherExpressPro1000 82545EM Fiber"), +PCI_ROM(0x8086, 0x1012, "e1000-82546eb-fiber", "Intel EtherExpressPro1000 82546EB Copper"), +PCI_ROM(0x8086, 0x1013, "e1000-82541ei", "Intel EtherExpressPro1000 82541EI"), +PCI_ROM(0x8086, 0x1015, "e1000-82540em-lom", "Intel EtherExpressPro1000 82540EM LOM"), +PCI_ROM(0x8086, 0x1016, "e1000-82540ep-lom", "Intel EtherExpressPro1000 82540EP LOM"), +PCI_ROM(0x8086, 0x1017, "e1000-82540ep", "Intel EtherExpressPro1000 82540EP"), +PCI_ROM(0x8086, 0x1018, "e1000-82541ep", "Intel EtherExpressPro1000 82541EP"), +PCI_ROM(0x8086, 0x1019, "e1000-82547ei", "Intel EtherExpressPro1000 82547EI"), +PCI_ROM(0x8086, 0x101d, "e1000-82546eb-quad-copper", "Intel EtherExpressPro1000 82546EB Quad Copper"), +PCI_ROM(0x8086, 0x101e, "e1000-82540ep-lp", "Intel EtherExpressPro1000 82540EP LP"), +PCI_ROM(0x8086, 0x1026, "e1000-82545gm-copper", "Intel EtherExpressPro1000 82545GM Copper"), +PCI_ROM(0x8086, 0x1027, "e1000-82545gm-fiber", "Intel EtherExpressPro1000 82545GM Fiber"), +PCI_ROM(0x8086, 0x1028, "e1000-82545gm-serdes", "Intel EtherExpressPro1000 82545GM SERDES"), +PCI_ROM(0x8086, 0x1075, "e1000-82547gi", "Intel EtherExpressPro1000 82547GI"), +PCI_ROM(0x8086, 0x1076, "e1000-82541gi", "Intel EtherExpressPro1000 82541GI"), +PCI_ROM(0x8086, 0x1077, "e1000-82541gi-mobile", "Intel EtherExpressPro1000 82541GI Mobile"), +PCI_ROM(0x8086, 0x1078, "e1000-82541er", "Intel EtherExpressPro1000 82541ER"), +PCI_ROM(0x8086, 0x1079, "e1000-82546gb-copper", "Intel EtherExpressPro1000 82546GB Copper"), +PCI_ROM(0x8086, 0x107a, "e1000-82546gb-fiber", "Intel EtherExpressPro1000 82546GB Fiber"), +PCI_ROM(0x8086, 0x107b, "e1000-82546gb-serdes", "Intel EtherExpressPro1000 82546GB SERDES"), +}; + +struct pci_driver e1000_driver = { + .type = NIC_DRIVER, + .name = "E1000", + .probe = e1000_probe, + .ids = e1000_nics, + .id_count = sizeof(e1000_nics)/sizeof(e1000_nics[0]), + .class = 0, +}; diff --git a/usr/src/grub/grub-0.97/netboot/e1000_hw.h b/usr/src/grub/grub-0.97/netboot/e1000_hw.h new file mode 100644 index 0000000000..7c7f48f617 --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/e1000_hw.h @@ -0,0 +1,2058 @@ +/******************************************************************************* + + + Copyright(c) 1999 - 2003 Intel 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 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. + + The full GNU General Public License is included in this distribution in the + file called LICENSE. + + Contact Information: + Linux NICS + Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 + +*******************************************************************************/ + +/* e1000_hw.h + * Structures, enums, and macros for the MAC + */ + +#ifndef _E1000_HW_H_ +#define _E1000_HW_H_ + +/* Forward declarations of structures used by the shared code */ +struct e1000_hw; +struct e1000_hw_stats; + +/* Enumerated types specific to the e1000 hardware */ +/* Media Access Controlers */ +typedef enum { + e1000_undefined = 0, + e1000_82542_rev2_0, + e1000_82542_rev2_1, + e1000_82543, + e1000_82544, + e1000_82540, + e1000_82545, + e1000_82545_rev_3, + e1000_82546, + e1000_82546_rev_3, + e1000_82541, + e1000_82541_rev_2, + e1000_82547, + e1000_82547_rev_2, + e1000_num_macs +} e1000_mac_type; + +typedef enum { + e1000_eeprom_uninitialized = 0, + e1000_eeprom_spi, + e1000_eeprom_microwire, + e1000_num_eeprom_types +} e1000_eeprom_type; + +/* Media Types */ +typedef enum { + e1000_media_type_copper = 0, + e1000_media_type_fiber = 1, + e1000_media_type_internal_serdes = 2, + e1000_num_media_types +} e1000_media_type; + +typedef enum { + e1000_10_half = 0, + e1000_10_full = 1, + e1000_100_half = 2, + e1000_100_full = 3 +} e1000_speed_duplex_type; + +/* Flow Control Settings */ +typedef enum { + e1000_fc_none = 0, + e1000_fc_rx_pause = 1, + e1000_fc_tx_pause = 2, + e1000_fc_full = 3, + e1000_fc_default = 0xFF +} e1000_fc_type; + +/* PCI bus types */ +typedef enum { + e1000_bus_type_unknown = 0, + e1000_bus_type_pci, + e1000_bus_type_pcix, + e1000_bus_type_reserved +} e1000_bus_type; + +/* PCI bus speeds */ +typedef enum { + e1000_bus_speed_unknown = 0, + e1000_bus_speed_33, + e1000_bus_speed_66, + e1000_bus_speed_100, + e1000_bus_speed_120, + e1000_bus_speed_133, + e1000_bus_speed_reserved +} e1000_bus_speed; + +/* PCI bus widths */ +typedef enum { + e1000_bus_width_unknown = 0, + e1000_bus_width_32, + e1000_bus_width_64, + e1000_bus_width_reserved +} e1000_bus_width; + +/* PHY status info structure and supporting enums */ +typedef enum { + e1000_cable_length_50 = 0, + e1000_cable_length_50_80, + e1000_cable_length_80_110, + e1000_cable_length_110_140, + e1000_cable_length_140, + e1000_cable_length_undefined = 0xFF +} e1000_cable_length; + +typedef enum { + e1000_igp_cable_length_10 = 10, + e1000_igp_cable_length_20 = 20, + e1000_igp_cable_length_30 = 30, + e1000_igp_cable_length_40 = 40, + e1000_igp_cable_length_50 = 50, + e1000_igp_cable_length_60 = 60, + e1000_igp_cable_length_70 = 70, + e1000_igp_cable_length_80 = 80, + e1000_igp_cable_length_90 = 90, + e1000_igp_cable_length_100 = 100, + e1000_igp_cable_length_110 = 110, + e1000_igp_cable_length_120 = 120, + e1000_igp_cable_length_130 = 130, + e1000_igp_cable_length_140 = 140, + e1000_igp_cable_length_150 = 150, + e1000_igp_cable_length_160 = 160, + e1000_igp_cable_length_170 = 170, + e1000_igp_cable_length_180 = 180 +} e1000_igp_cable_length; + +typedef enum { + e1000_10bt_ext_dist_enable_normal = 0, + e1000_10bt_ext_dist_enable_lower, + e1000_10bt_ext_dist_enable_undefined = 0xFF +} e1000_10bt_ext_dist_enable; + +typedef enum { + e1000_rev_polarity_normal = 0, + e1000_rev_polarity_reversed, + e1000_rev_polarity_undefined = 0xFF +} e1000_rev_polarity; + +typedef enum { + e1000_downshift_normal = 0, + e1000_downshift_activated, + e1000_downshift_undefined = 0xFF +} e1000_downshift; + +typedef enum { + e1000_polarity_reversal_enabled = 0, + e1000_polarity_reversal_disabled, + e1000_polarity_reversal_undefined = 0xFF +} e1000_polarity_reversal; + +typedef enum { + e1000_auto_x_mode_manual_mdi = 0, + e1000_auto_x_mode_manual_mdix, + e1000_auto_x_mode_auto1, + e1000_auto_x_mode_auto2, + e1000_auto_x_mode_undefined = 0xFF +} e1000_auto_x_mode; + +typedef enum { + e1000_1000t_rx_status_not_ok = 0, + e1000_1000t_rx_status_ok, + e1000_1000t_rx_status_undefined = 0xFF +} e1000_1000t_rx_status; + +typedef enum { + e1000_phy_m88 = 0, + e1000_phy_igp, + e1000_phy_undefined = 0xFF +} e1000_phy_type; + +typedef enum { + e1000_ms_hw_default = 0, + e1000_ms_force_master, + e1000_ms_force_slave, + e1000_ms_auto +} e1000_ms_type; + +typedef enum { + e1000_ffe_config_enabled = 0, + e1000_ffe_config_active, + e1000_ffe_config_blocked +} e1000_ffe_config; + +typedef enum { + e1000_dsp_config_disabled = 0, + e1000_dsp_config_enabled, + e1000_dsp_config_activated, + e1000_dsp_config_undefined = 0xFF +} e1000_dsp_config; + +struct e1000_phy_info { + e1000_cable_length cable_length; + e1000_10bt_ext_dist_enable extended_10bt_distance; + e1000_rev_polarity cable_polarity; + e1000_downshift downshift; + e1000_polarity_reversal polarity_correction; + e1000_auto_x_mode mdix_mode; + e1000_1000t_rx_status local_rx; + e1000_1000t_rx_status remote_rx; +}; + +struct e1000_phy_stats { + uint32_t idle_errors; + uint32_t receive_errors; +}; + +struct e1000_eeprom_info { + e1000_eeprom_type type; + uint16_t word_size; + uint16_t opcode_bits; + uint16_t address_bits; + uint16_t delay_usec; + uint16_t page_size; +}; + + + +/* Error Codes */ +#define E1000_SUCCESS 0 +#define E1000_ERR_EEPROM 1 +#define E1000_ERR_PHY 2 +#define E1000_ERR_CONFIG 3 +#define E1000_ERR_PARAM 4 +#define E1000_ERR_MAC_TYPE 5 +#define E1000_ERR_PHY_TYPE 6 +#define E1000_ERR_NOLINK 7 +#define E1000_ERR_TIMEOUT 8 + +#define E1000_READ_REG_IO(a, reg) \ + e1000_read_reg_io((a), E1000_##reg) +#define E1000_WRITE_REG_IO(a, reg, val) \ + e1000_write_reg_io((a), E1000_##reg, val) + +/* PCI Device IDs */ +#define E1000_DEV_ID_82542 0x1000 +#define E1000_DEV_ID_82543GC_FIBER 0x1001 +#define E1000_DEV_ID_82543GC_COPPER 0x1004 +#define E1000_DEV_ID_82544EI_COPPER 0x1008 +#define E1000_DEV_ID_82544EI_FIBER 0x1009 +#define E1000_DEV_ID_82544GC_COPPER 0x100C +#define E1000_DEV_ID_82544GC_LOM 0x100D +#define E1000_DEV_ID_82540EM 0x100E +#define E1000_DEV_ID_82540EM_LOM 0x1015 +#define E1000_DEV_ID_82540EP_LOM 0x1016 +#define E1000_DEV_ID_82540EP 0x1017 +#define E1000_DEV_ID_82540EP_LP 0x101E +#define E1000_DEV_ID_82545EM_COPPER 0x100F +#define E1000_DEV_ID_82545EM_FIBER 0x1011 +#define E1000_DEV_ID_82545GM_COPPER 0x1026 +#define E1000_DEV_ID_82545GM_FIBER 0x1027 +#define E1000_DEV_ID_82545GM_SERDES 0x1028 +#define E1000_DEV_ID_82546EB_COPPER 0x1010 +#define E1000_DEV_ID_82546EB_FIBER 0x1012 +#define E1000_DEV_ID_82546EB_QUAD_COPPER 0x101D +#define E1000_DEV_ID_82541EI 0x1013 +#define E1000_DEV_ID_82541EI_MOBILE 0x1018 +#define E1000_DEV_ID_82541ER 0x1078 +#define E1000_DEV_ID_82547GI 0x1075 +#define E1000_DEV_ID_82541GI 0x1076 +#define E1000_DEV_ID_82541GI_MOBILE 0x1077 +#define E1000_DEV_ID_82546GB_COPPER 0x1079 +#define E1000_DEV_ID_82546GB_FIBER 0x107A +#define E1000_DEV_ID_82546GB_SERDES 0x107B +#define E1000_DEV_ID_82547EI 0x1019 + +#define NODE_ADDRESS_SIZE 6 +#define ETH_LENGTH_OF_ADDRESS 6 + +/* MAC decode size is 128K - This is the size of BAR0 */ +#define MAC_DECODE_SIZE (128 * 1024) + +#define E1000_82542_2_0_REV_ID 2 +#define E1000_82542_2_1_REV_ID 3 + +#define SPEED_10 10 +#define SPEED_100 100 +#define SPEED_1000 1000 +#define HALF_DUPLEX 1 +#define FULL_DUPLEX 2 + +/* The sizes (in bytes) of a ethernet packet */ +#define ENET_HEADER_SIZE 14 +#define MAXIMUM_ETHERNET_FRAME_SIZE 1518 /* With FCS */ +#define MINIMUM_ETHERNET_FRAME_SIZE 64 /* With FCS */ +#define ETHERNET_FCS_SIZE 4 +#define MAXIMUM_ETHERNET_PACKET_SIZE \ + (MAXIMUM_ETHERNET_FRAME_SIZE - ETHERNET_FCS_SIZE) +#define MINIMUM_ETHERNET_PACKET_SIZE \ + (MINIMUM_ETHERNET_FRAME_SIZE - ETHERNET_FCS_SIZE) +#define CRC_LENGTH ETHERNET_FCS_SIZE +#define MAX_JUMBO_FRAME_SIZE 0x3F00 + + +/* 802.1q VLAN Packet Sizes */ +#define VLAN_TAG_SIZE 4 /* 802.3ac tag (not DMAed) */ + +/* Ethertype field values */ +#define ETHERNET_IEEE_VLAN_TYPE 0x8100 /* 802.3ac packet */ +#define ETHERNET_IP_TYPE 0x0800 /* IP packets */ +#define ETHERNET_ARP_TYPE 0x0806 /* Address Resolution Protocol (ARP) */ + +/* Packet Header defines */ +#define IP_PROTOCOL_TCP 6 +#define IP_PROTOCOL_UDP 0x11 + +/* This defines the bits that are set in the Interrupt Mask + * Set/Read Register. Each bit is documented below: + * o RXDMT0 = Receive Descriptor Minimum Threshold hit (ring 0) + * o RXSEQ = Receive Sequence Error + */ +#define POLL_IMS_ENABLE_MASK ( \ + E1000_IMS_RXDMT0 | \ + E1000_IMS_RXSEQ) + +/* This defines the bits that are set in the Interrupt Mask + * Set/Read Register. Each bit is documented below: + * o RXT0 = Receiver Timer Interrupt (ring 0) + * o TXDW = Transmit Descriptor Written Back + * o RXDMT0 = Receive Descriptor Minimum Threshold hit (ring 0) + * o RXSEQ = Receive Sequence Error + * o LSC = Link Status Change + */ +#define IMS_ENABLE_MASK ( \ + E1000_IMS_RXT0 | \ + E1000_IMS_TXDW | \ + E1000_IMS_RXDMT0 | \ + E1000_IMS_RXSEQ | \ + E1000_IMS_LSC) + +/* Number of high/low register pairs in the RAR. The RAR (Receive Address + * Registers) holds the directed and multicast addresses that we monitor. We + * reserve one of these spots for our directed address, allowing us room for + * E1000_RAR_ENTRIES - 1 multicast addresses. + */ +#define E1000_RAR_ENTRIES 15 + +#define MIN_NUMBER_OF_DESCRIPTORS 8 +#define MAX_NUMBER_OF_DESCRIPTORS 0xFFF8 + +/* Receive Descriptor */ +struct e1000_rx_desc { + uint64_t buffer_addr; /* Address of the descriptor's data buffer */ + uint16_t length; /* Length of data DMAed into data buffer */ + uint16_t csum; /* Packet checksum */ + uint8_t status; /* Descriptor status */ + uint8_t errors; /* Descriptor Errors */ + uint16_t special; +}; + +/* Receive Decriptor bit definitions */ +#define E1000_RXD_STAT_DD 0x01 /* Descriptor Done */ +#define E1000_RXD_STAT_EOP 0x02 /* End of Packet */ +#define E1000_RXD_STAT_IXSM 0x04 /* Ignore checksum */ +#define E1000_RXD_STAT_VP 0x08 /* IEEE VLAN Packet */ +#define E1000_RXD_STAT_TCPCS 0x20 /* TCP xsum calculated */ +#define E1000_RXD_STAT_IPCS 0x40 /* IP xsum calculated */ +#define E1000_RXD_STAT_PIF 0x80 /* passed in-exact filter */ +#define E1000_RXD_ERR_CE 0x01 /* CRC Error */ +#define E1000_RXD_ERR_SE 0x02 /* Symbol Error */ +#define E1000_RXD_ERR_SEQ 0x04 /* Sequence Error */ +#define E1000_RXD_ERR_CXE 0x10 /* Carrier Extension Error */ +#define E1000_RXD_ERR_TCPE 0x20 /* TCP/UDP Checksum Error */ +#define E1000_RXD_ERR_IPE 0x40 /* IP Checksum Error */ +#define E1000_RXD_ERR_RXE 0x80 /* Rx Data Error */ +#define E1000_RXD_SPC_VLAN_MASK 0x0FFF /* VLAN ID is in lower 12 bits */ +#define E1000_RXD_SPC_PRI_MASK 0xE000 /* Priority is in upper 3 bits */ +#define E1000_RXD_SPC_PRI_SHIFT 0x000D /* Priority is in upper 3 of 16 */ +#define E1000_RXD_SPC_CFI_MASK 0x1000 /* CFI is bit 12 */ +#define E1000_RXD_SPC_CFI_SHIFT 0x000C /* CFI is bit 12 */ + +/* mask to determine if packets should be dropped due to frame errors */ +#define E1000_RXD_ERR_FRAME_ERR_MASK ( \ + E1000_RXD_ERR_CE | \ + E1000_RXD_ERR_SE | \ + E1000_RXD_ERR_SEQ | \ + E1000_RXD_ERR_CXE | \ + E1000_RXD_ERR_RXE) + +/* Transmit Descriptor */ +struct e1000_tx_desc { + uint64_t buffer_addr; /* Address of the descriptor's data buffer */ + union { + uint32_t data; + struct { + uint16_t length; /* Data buffer length */ + uint8_t cso; /* Checksum offset */ + uint8_t cmd; /* Descriptor control */ + } flags; + } lower; + union { + uint32_t data; + struct { + uint8_t status; /* Descriptor status */ + uint8_t css; /* Checksum start */ + uint16_t special; + } fields; + } upper; +}; + +/* Transmit Descriptor bit definitions */ +#define E1000_TXD_DTYP_D 0x00100000 /* Data Descriptor */ +#define E1000_TXD_DTYP_C 0x00000000 /* Context Descriptor */ +#define E1000_TXD_POPTS_IXSM 0x01 /* Insert IP checksum */ +#define E1000_TXD_POPTS_TXSM 0x02 /* Insert TCP/UDP checksum */ +#define E1000_TXD_CMD_EOP 0x01000000 /* End of Packet */ +#define E1000_TXD_CMD_IFCS 0x02000000 /* Insert FCS (Ethernet CRC) */ +#define E1000_TXD_CMD_IC 0x04000000 /* Insert Checksum */ +#define E1000_TXD_CMD_RS 0x08000000 /* Report Status */ +#define E1000_TXD_CMD_RPS 0x10000000 /* Report Packet Sent */ +#define E1000_TXD_CMD_DEXT 0x20000000 /* Descriptor extension (0 = legacy) */ +#define E1000_TXD_CMD_VLE 0x40000000 /* Add VLAN tag */ +#define E1000_TXD_CMD_IDE 0x80000000 /* Enable Tidv register */ +#define E1000_TXD_STAT_DD 0x00000001 /* Descriptor Done */ +#define E1000_TXD_STAT_EC 0x00000002 /* Excess Collisions */ +#define E1000_TXD_STAT_LC 0x00000004 /* Late Collisions */ +#define E1000_TXD_STAT_TU 0x00000008 /* Transmit underrun */ +#define E1000_TXD_CMD_TCP 0x01000000 /* TCP packet */ +#define E1000_TXD_CMD_IP 0x02000000 /* IP packet */ +#define E1000_TXD_CMD_TSE 0x04000000 /* TCP Seg enable */ +#define E1000_TXD_STAT_TC 0x00000004 /* Tx Underrun */ + +/* Offload Context Descriptor */ +struct e1000_context_desc { + union { + uint32_t ip_config; + struct { + uint8_t ipcss; /* IP checksum start */ + uint8_t ipcso; /* IP checksum offset */ + uint16_t ipcse; /* IP checksum end */ + } ip_fields; + } lower_setup; + union { + uint32_t tcp_config; + struct { + uint8_t tucss; /* TCP checksum start */ + uint8_t tucso; /* TCP checksum offset */ + uint16_t tucse; /* TCP checksum end */ + } tcp_fields; + } upper_setup; + uint32_t cmd_and_length; /* */ + union { + uint32_t data; + struct { + uint8_t status; /* Descriptor status */ + uint8_t hdr_len; /* Header length */ + uint16_t mss; /* Maximum segment size */ + } fields; + } tcp_seg_setup; +}; + +/* Offload data descriptor */ +struct e1000_data_desc { + uint64_t buffer_addr; /* Address of the descriptor's buffer address */ + union { + uint32_t data; + struct { + uint16_t length; /* Data buffer length */ + uint8_t typ_len_ext; /* */ + uint8_t cmd; /* */ + } flags; + } lower; + union { + uint32_t data; + struct { + uint8_t status; /* Descriptor status */ + uint8_t popts; /* Packet Options */ + uint16_t special; /* */ + } fields; + } upper; +}; + +/* Filters */ +#define E1000_NUM_UNICAST 16 /* Unicast filter entries */ +#define E1000_MC_TBL_SIZE 128 /* Multicast Filter Table (4096 bits) */ +#define E1000_VLAN_FILTER_TBL_SIZE 128 /* VLAN Filter Table (4096 bits) */ + + +/* Receive Address Register */ +struct e1000_rar { + volatile uint32_t low; /* receive address low */ + volatile uint32_t high; /* receive address high */ +}; + +/* Number of entries in the Multicast Table Array (MTA). */ +#define E1000_NUM_MTA_REGISTERS 128 + +/* IPv4 Address Table Entry */ +struct e1000_ipv4_at_entry { + volatile uint32_t ipv4_addr; /* IP Address (RW) */ + volatile uint32_t reserved; +}; + +/* Four wakeup IP addresses are supported */ +#define E1000_WAKEUP_IP_ADDRESS_COUNT_MAX 4 +#define E1000_IP4AT_SIZE E1000_WAKEUP_IP_ADDRESS_COUNT_MAX +#define E1000_IP6AT_SIZE 1 + +/* IPv6 Address Table Entry */ +struct e1000_ipv6_at_entry { + volatile uint8_t ipv6_addr[16]; +}; + +/* Flexible Filter Length Table Entry */ +struct e1000_fflt_entry { + volatile uint32_t length; /* Flexible Filter Length (RW) */ + volatile uint32_t reserved; +}; + +/* Flexible Filter Mask Table Entry */ +struct e1000_ffmt_entry { + volatile uint32_t mask; /* Flexible Filter Mask (RW) */ + volatile uint32_t reserved; +}; + +/* Flexible Filter Value Table Entry */ +struct e1000_ffvt_entry { + volatile uint32_t value; /* Flexible Filter Value (RW) */ + volatile uint32_t reserved; +}; + +/* Four Flexible Filters are supported */ +#define E1000_FLEXIBLE_FILTER_COUNT_MAX 4 + +/* Each Flexible Filter is at most 128 (0x80) bytes in length */ +#define E1000_FLEXIBLE_FILTER_SIZE_MAX 128 + +#define E1000_FFLT_SIZE E1000_FLEXIBLE_FILTER_COUNT_MAX +#define E1000_FFMT_SIZE E1000_FLEXIBLE_FILTER_SIZE_MAX +#define E1000_FFVT_SIZE E1000_FLEXIBLE_FILTER_SIZE_MAX + +/* Register Set. (82543, 82544) + * + * Registers are defined to be 32 bits and should be accessed as 32 bit values. + * These registers are physically located on the NIC, but are mapped into the + * host memory address space. + * + * RW - register is both readable and writable + * RO - register is read only + * WO - register is write only + * R/clr - register is read only and is cleared when read + * A - register array + */ +#define E1000_CTRL 0x00000 /* Device Control - RW */ +#define E1000_CTRL_DUP 0x00004 /* Device Control Duplicate (Shadow) - RW */ +#define E1000_STATUS 0x00008 /* Device Status - RO */ +#define E1000_EECD 0x00010 /* EEPROM/Flash Control - RW */ +#define E1000_EERD 0x00014 /* EEPROM Read - RW */ +#define E1000_CTRL_EXT 0x00018 /* Extended Device Control - RW */ +#define E1000_FLA 0x0001C /* Flash Access - RW */ +#define E1000_MDIC 0x00020 /* MDI Control - RW */ +#define E1000_FCAL 0x00028 /* Flow Control Address Low - RW */ +#define E1000_FCAH 0x0002C /* Flow Control Address High -RW */ +#define E1000_FCT 0x00030 /* Flow Control Type - RW */ +#define E1000_VET 0x00038 /* VLAN Ether Type - RW */ +#define E1000_ICR 0x000C0 /* Interrupt Cause Read - R/clr */ +#define E1000_ITR 0x000C4 /* Interrupt Throttling Rate - RW */ +#define E1000_ICS 0x000C8 /* Interrupt Cause Set - WO */ +#define E1000_IMS 0x000D0 /* Interrupt Mask Set - RW */ +#define E1000_IMC 0x000D8 /* Interrupt Mask Clear - WO */ +#define E1000_RCTL 0x00100 /* RX Control - RW */ +#define E1000_FCTTV 0x00170 /* Flow Control Transmit Timer Value - RW */ +#define E1000_TXCW 0x00178 /* TX Configuration Word - RW */ +#define E1000_RXCW 0x00180 /* RX Configuration Word - RO */ +#define E1000_TCTL 0x00400 /* TX Control - RW */ +#define E1000_TIPG 0x00410 /* TX Inter-packet gap -RW */ +#define E1000_TBT 0x00448 /* TX Burst Timer - RW */ +#define E1000_AIT 0x00458 /* Adaptive Interframe Spacing Throttle - RW */ +#define E1000_LEDCTL 0x00E00 /* LED Control - RW */ +#define E1000_PBA 0x01000 /* Packet Buffer Allocation - RW */ +#define E1000_FCRTL 0x02160 /* Flow Control Receive Threshold Low - RW */ +#define E1000_FCRTH 0x02168 /* Flow Control Receive Threshold High - RW */ +#define E1000_RDBAL 0x02800 /* RX Descriptor Base Address Low - RW */ +#define E1000_RDBAH 0x02804 /* RX Descriptor Base Address High - RW */ +#define E1000_RDLEN 0x02808 /* RX Descriptor Length - RW */ +#define E1000_RDH 0x02810 /* RX Descriptor Head - RW */ +#define E1000_RDT 0x02818 /* RX Descriptor Tail - RW */ +#define E1000_RDTR 0x02820 /* RX Delay Timer - RW */ +#define E1000_RXDCTL 0x02828 /* RX Descriptor Control - RW */ +#define E1000_RADV 0x0282C /* RX Interrupt Absolute Delay Timer - RW */ +#define E1000_RSRPD 0x02C00 /* RX Small Packet Detect - RW */ +#define E1000_TXDMAC 0x03000 /* TX DMA Control - RW */ +#define E1000_TDFH 0x03410 /* TX Data FIFO Head - RW */ +#define E1000_TDFT 0x03418 /* TX Data FIFO Tail - RW */ +#define E1000_TDFHS 0x03420 /* TX Data FIFO Head Saved - RW */ +#define E1000_TDFTS 0x03428 /* TX Data FIFO Tail Saved - RW */ +#define E1000_TDFPC 0x03430 /* TX Data FIFO Packet Count - RW */ +#define E1000_TDBAL 0x03800 /* TX Descriptor Base Address Low - RW */ +#define E1000_TDBAH 0x03804 /* TX Descriptor Base Address High - RW */ +#define E1000_TDLEN 0x03808 /* TX Descriptor Length - RW */ +#define E1000_TDH 0x03810 /* TX Descriptor Head - RW */ +#define E1000_TDT 0x03818 /* TX Descripotr Tail - RW */ +#define E1000_TIDV 0x03820 /* TX Interrupt Delay Value - RW */ +#define E1000_TXDCTL 0x03828 /* TX Descriptor Control - RW */ +#define E1000_TADV 0x0382C /* TX Interrupt Absolute Delay Val - RW */ +#define E1000_TSPMT 0x03830 /* TCP Segmentation PAD & Min Threshold - RW */ +#define E1000_CRCERRS 0x04000 /* CRC Error Count - R/clr */ +#define E1000_ALGNERRC 0x04004 /* Alignment Error Count - R/clr */ +#define E1000_SYMERRS 0x04008 /* Symbol Error Count - R/clr */ +#define E1000_RXERRC 0x0400C /* Receive Error Count - R/clr */ +#define E1000_MPC 0x04010 /* Missed Packet Count - R/clr */ +#define E1000_SCC 0x04014 /* Single Collision Count - R/clr */ +#define E1000_ECOL 0x04018 /* Excessive Collision Count - R/clr */ +#define E1000_MCC 0x0401C /* Multiple Collision Count - R/clr */ +#define E1000_LATECOL 0x04020 /* Late Collision Count - R/clr */ +#define E1000_COLC 0x04028 /* Collision Count - R/clr */ +#define E1000_DC 0x04030 /* Defer Count - R/clr */ +#define E1000_TNCRS 0x04034 /* TX-No CRS - R/clr */ +#define E1000_SEC 0x04038 /* Sequence Error Count - R/clr */ +#define E1000_CEXTERR 0x0403C /* Carrier Extension Error Count - R/clr */ +#define E1000_RLEC 0x04040 /* Receive Length Error Count - R/clr */ +#define E1000_XONRXC 0x04048 /* XON RX Count - R/clr */ +#define E1000_XONTXC 0x0404C /* XON TX Count - R/clr */ +#define E1000_XOFFRXC 0x04050 /* XOFF RX Count - R/clr */ +#define E1000_XOFFTXC 0x04054 /* XOFF TX Count - R/clr */ +#define E1000_FCRUC 0x04058 /* Flow Control RX Unsupported Count- R/clr */ +#define E1000_PRC64 0x0405C /* Packets RX (64 bytes) - R/clr */ +#define E1000_PRC127 0x04060 /* Packets RX (65-127 bytes) - R/clr */ +#define E1000_PRC255 0x04064 /* Packets RX (128-255 bytes) - R/clr */ +#define E1000_PRC511 0x04068 /* Packets RX (255-511 bytes) - R/clr */ +#define E1000_PRC1023 0x0406C /* Packets RX (512-1023 bytes) - R/clr */ +#define E1000_PRC1522 0x04070 /* Packets RX (1024-1522 bytes) - R/clr */ +#define E1000_GPRC 0x04074 /* Good Packets RX Count - R/clr */ +#define E1000_BPRC 0x04078 /* Broadcast Packets RX Count - R/clr */ +#define E1000_MPRC 0x0407C /* Multicast Packets RX Count - R/clr */ +#define E1000_GPTC 0x04080 /* Good Packets TX Count - R/clr */ +#define E1000_GORCL 0x04088 /* Good Octets RX Count Low - R/clr */ +#define E1000_GORCH 0x0408C /* Good Octets RX Count High - R/clr */ +#define E1000_GOTCL 0x04090 /* Good Octets TX Count Low - R/clr */ +#define E1000_GOTCH 0x04094 /* Good Octets TX Count High - R/clr */ +#define E1000_RNBC 0x040A0 /* RX No Buffers Count - R/clr */ +#define E1000_RUC 0x040A4 /* RX Undersize Count - R/clr */ +#define E1000_RFC 0x040A8 /* RX Fragment Count - R/clr */ +#define E1000_ROC 0x040AC /* RX Oversize Count - R/clr */ +#define E1000_RJC 0x040B0 /* RX Jabber Count - R/clr */ +#define E1000_MGTPRC 0x040B4 /* Management Packets RX Count - R/clr */ +#define E1000_MGTPDC 0x040B8 /* Management Packets Dropped Count - R/clr */ +#define E1000_MGTPTC 0x040BC /* Management Packets TX Count - R/clr */ +#define E1000_TORL 0x040C0 /* Total Octets RX Low - R/clr */ +#define E1000_TORH 0x040C4 /* Total Octets RX High - R/clr */ +#define E1000_TOTL 0x040C8 /* Total Octets TX Low - R/clr */ +#define E1000_TOTH 0x040CC /* Total Octets TX High - R/clr */ +#define E1000_TPR 0x040D0 /* Total Packets RX - R/clr */ +#define E1000_TPT 0x040D4 /* Total Packets TX - R/clr */ +#define E1000_PTC64 0x040D8 /* Packets TX (64 bytes) - R/clr */ +#define E1000_PTC127 0x040DC /* Packets TX (65-127 bytes) - R/clr */ +#define E1000_PTC255 0x040E0 /* Packets TX (128-255 bytes) - R/clr */ +#define E1000_PTC511 0x040E4 /* Packets TX (256-511 bytes) - R/clr */ +#define E1000_PTC1023 0x040E8 /* Packets TX (512-1023 bytes) - R/clr */ +#define E1000_PTC1522 0x040EC /* Packets TX (1024-1522 Bytes) - R/clr */ +#define E1000_MPTC 0x040F0 /* Multicast Packets TX Count - R/clr */ +#define E1000_BPTC 0x040F4 /* Broadcast Packets TX Count - R/clr */ +#define E1000_TSCTC 0x040F8 /* TCP Segmentation Context TX - R/clr */ +#define E1000_TSCTFC 0x040FC /* TCP Segmentation Context TX Fail - R/clr */ +#define E1000_RXCSUM 0x05000 /* RX Checksum Control - RW */ +#define E1000_MTA 0x05200 /* Multicast Table Array - RW Array */ +#define E1000_RA 0x05400 /* Receive Address - RW Array */ +#define E1000_VFTA 0x05600 /* VLAN Filter Table Array - RW Array */ +#define E1000_WUC 0x05800 /* Wakeup Control - RW */ +#define E1000_WUFC 0x05808 /* Wakeup Filter Control - RW */ +#define E1000_WUS 0x05810 /* Wakeup Status - RO */ +#define E1000_MANC 0x05820 /* Management Control - RW */ +#define E1000_IPAV 0x05838 /* IP Address Valid - RW */ +#define E1000_IP4AT 0x05840 /* IPv4 Address Table - RW Array */ +#define E1000_IP6AT 0x05880 /* IPv6 Address Table - RW Array */ +#define E1000_WUPL 0x05900 /* Wakeup Packet Length - RW */ +#define E1000_WUPM 0x05A00 /* Wakeup Packet Memory - RO A */ +#define E1000_FFLT 0x05F00 /* Flexible Filter Length Table - RW Array */ +#define E1000_FFMT 0x09000 /* Flexible Filter Mask Table - RW Array */ +#define E1000_FFVT 0x09800 /* Flexible Filter Value Table - RW Array */ + +/* Register Set (82542) + * + * Some of the 82542 registers are located at different offsets than they are + * in more current versions of the 8254x. Despite the difference in location, + * the registers function in the same manner. + */ +#define E1000_82542_CTRL E1000_CTRL +#define E1000_82542_CTRL_DUP E1000_CTRL_DUP +#define E1000_82542_STATUS E1000_STATUS +#define E1000_82542_EECD E1000_EECD +#define E1000_82542_EERD E1000_EERD +#define E1000_82542_CTRL_EXT E1000_CTRL_EXT +#define E1000_82542_FLA E1000_FLA +#define E1000_82542_MDIC E1000_MDIC +#define E1000_82542_FCAL E1000_FCAL +#define E1000_82542_FCAH E1000_FCAH +#define E1000_82542_FCT E1000_FCT +#define E1000_82542_VET E1000_VET +#define E1000_82542_RA 0x00040 +#define E1000_82542_ICR E1000_ICR +#define E1000_82542_ITR E1000_ITR +#define E1000_82542_ICS E1000_ICS +#define E1000_82542_IMS E1000_IMS +#define E1000_82542_IMC E1000_IMC +#define E1000_82542_RCTL E1000_RCTL +#define E1000_82542_RDTR 0x00108 +#define E1000_82542_RDBAL 0x00110 +#define E1000_82542_RDBAH 0x00114 +#define E1000_82542_RDLEN 0x00118 +#define E1000_82542_RDH 0x00120 +#define E1000_82542_RDT 0x00128 +#define E1000_82542_FCRTH 0x00160 +#define E1000_82542_FCRTL 0x00168 +#define E1000_82542_FCTTV E1000_FCTTV +#define E1000_82542_TXCW E1000_TXCW +#define E1000_82542_RXCW E1000_RXCW +#define E1000_82542_MTA 0x00200 +#define E1000_82542_TCTL E1000_TCTL +#define E1000_82542_TIPG E1000_TIPG +#define E1000_82542_TDBAL 0x00420 +#define E1000_82542_TDBAH 0x00424 +#define E1000_82542_TDLEN 0x00428 +#define E1000_82542_TDH 0x00430 +#define E1000_82542_TDT 0x00438 +#define E1000_82542_TIDV 0x00440 +#define E1000_82542_TBT E1000_TBT +#define E1000_82542_AIT E1000_AIT +#define E1000_82542_VFTA 0x00600 +#define E1000_82542_LEDCTL E1000_LEDCTL +#define E1000_82542_PBA E1000_PBA +#define E1000_82542_RXDCTL E1000_RXDCTL +#define E1000_82542_RADV E1000_RADV +#define E1000_82542_RSRPD E1000_RSRPD +#define E1000_82542_TXDMAC E1000_TXDMAC +#define E1000_82542_TDFHS E1000_TDFHS +#define E1000_82542_TDFTS E1000_TDFTS +#define E1000_82542_TDFPC E1000_TDFPC +#define E1000_82542_TXDCTL E1000_TXDCTL +#define E1000_82542_TADV E1000_TADV +#define E1000_82542_TSPMT E1000_TSPMT +#define E1000_82542_CRCERRS E1000_CRCERRS +#define E1000_82542_ALGNERRC E1000_ALGNERRC +#define E1000_82542_SYMERRS E1000_SYMERRS +#define E1000_82542_RXERRC E1000_RXERRC +#define E1000_82542_MPC E1000_MPC +#define E1000_82542_SCC E1000_SCC +#define E1000_82542_ECOL E1000_ECOL +#define E1000_82542_MCC E1000_MCC +#define E1000_82542_LATECOL E1000_LATECOL +#define E1000_82542_COLC E1000_COLC +#define E1000_82542_DC E1000_DC +#define E1000_82542_TNCRS E1000_TNCRS +#define E1000_82542_SEC E1000_SEC +#define E1000_82542_CEXTERR E1000_CEXTERR +#define E1000_82542_RLEC E1000_RLEC +#define E1000_82542_XONRXC E1000_XONRXC +#define E1000_82542_XONTXC E1000_XONTXC +#define E1000_82542_XOFFRXC E1000_XOFFRXC +#define E1000_82542_XOFFTXC E1000_XOFFTXC +#define E1000_82542_FCRUC E1000_FCRUC +#define E1000_82542_PRC64 E1000_PRC64 +#define E1000_82542_PRC127 E1000_PRC127 +#define E1000_82542_PRC255 E1000_PRC255 +#define E1000_82542_PRC511 E1000_PRC511 +#define E1000_82542_PRC1023 E1000_PRC1023 +#define E1000_82542_PRC1522 E1000_PRC1522 +#define E1000_82542_GPRC E1000_GPRC +#define E1000_82542_BPRC E1000_BPRC +#define E1000_82542_MPRC E1000_MPRC +#define E1000_82542_GPTC E1000_GPTC +#define E1000_82542_GORCL E1000_GORCL +#define E1000_82542_GORCH E1000_GORCH +#define E1000_82542_GOTCL E1000_GOTCL +#define E1000_82542_GOTCH E1000_GOTCH +#define E1000_82542_RNBC E1000_RNBC +#define E1000_82542_RUC E1000_RUC +#define E1000_82542_RFC E1000_RFC +#define E1000_82542_ROC E1000_ROC +#define E1000_82542_RJC E1000_RJC +#define E1000_82542_MGTPRC E1000_MGTPRC +#define E1000_82542_MGTPDC E1000_MGTPDC +#define E1000_82542_MGTPTC E1000_MGTPTC +#define E1000_82542_TORL E1000_TORL +#define E1000_82542_TORH E1000_TORH +#define E1000_82542_TOTL E1000_TOTL +#define E1000_82542_TOTH E1000_TOTH +#define E1000_82542_TPR E1000_TPR +#define E1000_82542_TPT E1000_TPT +#define E1000_82542_PTC64 E1000_PTC64 +#define E1000_82542_PTC127 E1000_PTC127 +#define E1000_82542_PTC255 E1000_PTC255 +#define E1000_82542_PTC511 E1000_PTC511 +#define E1000_82542_PTC1023 E1000_PTC1023 +#define E1000_82542_PTC1522 E1000_PTC1522 +#define E1000_82542_MPTC E1000_MPTC +#define E1000_82542_BPTC E1000_BPTC +#define E1000_82542_TSCTC E1000_TSCTC +#define E1000_82542_TSCTFC E1000_TSCTFC +#define E1000_82542_RXCSUM E1000_RXCSUM +#define E1000_82542_WUC E1000_WUC +#define E1000_82542_WUFC E1000_WUFC +#define E1000_82542_WUS E1000_WUS +#define E1000_82542_MANC E1000_MANC +#define E1000_82542_IPAV E1000_IPAV +#define E1000_82542_IP4AT E1000_IP4AT +#define E1000_82542_IP6AT E1000_IP6AT +#define E1000_82542_WUPL E1000_WUPL +#define E1000_82542_WUPM E1000_WUPM +#define E1000_82542_FFLT E1000_FFLT +#define E1000_82542_TDFH 0x08010 +#define E1000_82542_TDFT 0x08018 +#define E1000_82542_FFMT E1000_FFMT +#define E1000_82542_FFVT E1000_FFVT + +/* Statistics counters collected by the MAC */ +struct e1000_hw_stats { + uint64_t crcerrs; + uint64_t algnerrc; + uint64_t symerrs; + uint64_t rxerrc; + uint64_t mpc; + uint64_t scc; + uint64_t ecol; + uint64_t mcc; + uint64_t latecol; + uint64_t colc; + uint64_t dc; + uint64_t tncrs; + uint64_t sec; + uint64_t cexterr; + uint64_t rlec; + uint64_t xonrxc; + uint64_t xontxc; + uint64_t xoffrxc; + uint64_t xofftxc; + uint64_t fcruc; + uint64_t prc64; + uint64_t prc127; + uint64_t prc255; + uint64_t prc511; + uint64_t prc1023; + uint64_t prc1522; + uint64_t gprc; + uint64_t bprc; + uint64_t mprc; + uint64_t gptc; + uint64_t gorcl; + uint64_t gorch; + uint64_t gotcl; + uint64_t gotch; + uint64_t rnbc; + uint64_t ruc; + uint64_t rfc; + uint64_t roc; + uint64_t rjc; + uint64_t mgprc; + uint64_t mgpdc; + uint64_t mgptc; + uint64_t torl; + uint64_t torh; + uint64_t totl; + uint64_t toth; + uint64_t tpr; + uint64_t tpt; + uint64_t ptc64; + uint64_t ptc127; + uint64_t ptc255; + uint64_t ptc511; + uint64_t ptc1023; + uint64_t ptc1522; + uint64_t mptc; + uint64_t bptc; + uint64_t tsctc; + uint64_t tsctfc; +}; + +/* Structure containing variables used by the shared code (e1000_hw.c) */ +struct e1000_hw { + struct pci_device *pdev; + uint8_t *hw_addr; + e1000_mac_type mac_type; + e1000_phy_type phy_type; +#if 0 + uint32_t phy_init_script; +#endif + e1000_media_type media_type; + e1000_fc_type fc; +#if 0 + e1000_bus_speed bus_speed; + e1000_bus_width bus_width; + e1000_bus_type bus_type; +#endif + struct e1000_eeprom_info eeprom; +#if 0 + e1000_ms_type master_slave; + e1000_ms_type original_master_slave; + e1000_ffe_config ffe_config_state; +#endif + uint32_t io_base; + uint32_t phy_id; +#ifdef LINUX_DRIVER + uint32_t phy_revision; +#endif + uint32_t phy_addr; +#if 0 + uint32_t original_fc; +#endif + uint32_t txcw; + uint32_t autoneg_failed; +#if 0 + uint32_t max_frame_size; + uint32_t min_frame_size; + uint32_t mc_filter_type; + uint32_t num_mc_addrs; + uint32_t collision_delta; + uint32_t tx_packet_delta; + uint32_t ledctl_default; + uint32_t ledctl_mode1; + uint32_t ledctl_mode2; + uint16_t phy_spd_default; +#endif + uint16_t autoneg_advertised; + uint16_t pci_cmd_word; +#if 0 + uint16_t fc_high_water; + uint16_t fc_low_water; + uint16_t fc_pause_time; + uint16_t current_ifs_val; + uint16_t ifs_min_val; + uint16_t ifs_max_val; + uint16_t ifs_step_size; + uint16_t ifs_ratio; +#endif + uint16_t device_id; + uint16_t vendor_id; +#if 0 + uint16_t subsystem_id; + uint16_t subsystem_vendor_id; +#endif + uint8_t revision_id; +#if 0 + uint8_t autoneg; + uint8_t mdix; + uint8_t forced_speed_duplex; + uint8_t wait_autoneg_complete; + uint8_t dma_fairness; +#endif + uint8_t mac_addr[NODE_ADDRESS_SIZE]; +#if 0 + uint8_t perm_mac_addr[NODE_ADDRESS_SIZE]; + boolean_t disable_polarity_correction; + boolean_t speed_downgraded; + e1000_dsp_config dsp_config_state; + boolean_t get_link_status; + boolean_t serdes_link_down; +#endif + boolean_t tbi_compatibility_en; + boolean_t tbi_compatibility_on; +#if 0 + boolean_t phy_reset_disable; + boolean_t fc_send_xon; + boolean_t fc_strict_ieee; + boolean_t report_tx_early; + boolean_t adaptive_ifs; + boolean_t ifs_params_forced; + boolean_t in_ifs_mode; +#endif +}; + + +#define E1000_EEPROM_SWDPIN0 0x0001 /* SWDPIN 0 EEPROM Value */ +#define E1000_EEPROM_LED_LOGIC 0x0020 /* Led Logic Word */ + +/* Register Bit Masks */ +/* Device Control */ +#define E1000_CTRL_FD 0x00000001 /* Full duplex.0=half; 1=full */ +#define E1000_CTRL_BEM 0x00000002 /* Endian Mode.0=little,1=big */ +#define E1000_CTRL_PRIOR 0x00000004 /* Priority on PCI. 0=rx,1=fair */ +#define E1000_CTRL_LRST 0x00000008 /* Link reset. 0=normal,1=reset */ +#define E1000_CTRL_TME 0x00000010 /* Test mode. 0=normal,1=test */ +#define E1000_CTRL_SLE 0x00000020 /* Serial Link on 0=dis,1=en */ +#define E1000_CTRL_ASDE 0x00000020 /* Auto-speed detect enable */ +#define E1000_CTRL_SLU 0x00000040 /* Set link up (Force Link) */ +#define E1000_CTRL_ILOS 0x00000080 /* Invert Loss-Of Signal */ +#define E1000_CTRL_SPD_SEL 0x00000300 /* Speed Select Mask */ +#define E1000_CTRL_SPD_10 0x00000000 /* Force 10Mb */ +#define E1000_CTRL_SPD_100 0x00000100 /* Force 100Mb */ +#define E1000_CTRL_SPD_1000 0x00000200 /* Force 1Gb */ +#define E1000_CTRL_BEM32 0x00000400 /* Big Endian 32 mode */ +#define E1000_CTRL_FRCSPD 0x00000800 /* Force Speed */ +#define E1000_CTRL_FRCDPX 0x00001000 /* Force Duplex */ +#define E1000_CTRL_SWDPIN0 0x00040000 /* SWDPIN 0 value */ +#define E1000_CTRL_SWDPIN1 0x00080000 /* SWDPIN 1 value */ +#define E1000_CTRL_SWDPIN2 0x00100000 /* SWDPIN 2 value */ +#define E1000_CTRL_SWDPIN3 0x00200000 /* SWDPIN 3 value */ +#define E1000_CTRL_SWDPIO0 0x00400000 /* SWDPIN 0 Input or output */ +#define E1000_CTRL_SWDPIO1 0x00800000 /* SWDPIN 1 input or output */ +#define E1000_CTRL_SWDPIO2 0x01000000 /* SWDPIN 2 input or output */ +#define E1000_CTRL_SWDPIO3 0x02000000 /* SWDPIN 3 input or output */ +#define E1000_CTRL_RST 0x04000000 /* Global reset */ +#define E1000_CTRL_RFCE 0x08000000 /* Receive Flow Control enable */ +#define E1000_CTRL_TFCE 0x10000000 /* Transmit flow control enable */ +#define E1000_CTRL_RTE 0x20000000 /* Routing tag enable */ +#define E1000_CTRL_VME 0x40000000 /* IEEE VLAN mode enable */ +#define E1000_CTRL_PHY_RST 0x80000000 /* PHY Reset */ + +/* Device Status */ +#define E1000_STATUS_FD 0x00000001 /* Full duplex.0=half,1=full */ +#define E1000_STATUS_LU 0x00000002 /* Link up.0=no,1=link */ +#define E1000_STATUS_FUNC_MASK 0x0000000C /* PCI Function Mask */ +#define E1000_STATUS_FUNC_0 0x00000000 /* Function 0 */ +#define E1000_STATUS_FUNC_1 0x00000004 /* Function 1 */ +#define E1000_STATUS_TXOFF 0x00000010 /* transmission paused */ +#define E1000_STATUS_TBIMODE 0x00000020 /* TBI mode */ +#define E1000_STATUS_SPEED_MASK 0x000000C0 +#define E1000_STATUS_SPEED_10 0x00000000 /* Speed 10Mb/s */ +#define E1000_STATUS_SPEED_100 0x00000040 /* Speed 100Mb/s */ +#define E1000_STATUS_SPEED_1000 0x00000080 /* Speed 1000Mb/s */ +#define E1000_STATUS_ASDV 0x00000300 /* Auto speed detect value */ +#define E1000_STATUS_MTXCKOK 0x00000400 /* MTX clock running OK */ +#define E1000_STATUS_PCI66 0x00000800 /* In 66Mhz slot */ +#define E1000_STATUS_BUS64 0x00001000 /* In 64 bit slot */ +#define E1000_STATUS_PCIX_MODE 0x00002000 /* PCI-X mode */ +#define E1000_STATUS_PCIX_SPEED 0x0000C000 /* PCI-X bus speed */ + +/* Constants used to intrepret the masked PCI-X bus speed. */ +#define E1000_STATUS_PCIX_SPEED_66 0x00000000 /* PCI-X bus speed 50-66 MHz */ +#define E1000_STATUS_PCIX_SPEED_100 0x00004000 /* PCI-X bus speed 66-100 MHz */ +#define E1000_STATUS_PCIX_SPEED_133 0x00008000 /* PCI-X bus speed 100-133 MHz */ + +/* EEPROM/Flash Control */ +#define E1000_EECD_SK 0x00000001 /* EEPROM Clock */ +#define E1000_EECD_CS 0x00000002 /* EEPROM Chip Select */ +#define E1000_EECD_DI 0x00000004 /* EEPROM Data In */ +#define E1000_EECD_DO 0x00000008 /* EEPROM Data Out */ +#define E1000_EECD_FWE_MASK 0x00000030 +#define E1000_EECD_FWE_DIS 0x00000010 /* Disable FLASH writes */ +#define E1000_EECD_FWE_EN 0x00000020 /* Enable FLASH writes */ +#define E1000_EECD_FWE_SHIFT 4 +#define E1000_EECD_REQ 0x00000040 /* EEPROM Access Request */ +#define E1000_EECD_GNT 0x00000080 /* EEPROM Access Grant */ +#define E1000_EECD_PRES 0x00000100 /* EEPROM Present */ +#define E1000_EECD_SIZE 0x00000200 /* EEPROM Size (0=64 word 1=256 word) */ +#define E1000_EECD_ADDR_BITS 0x00000400 /* EEPROM Addressing bits based on type + * (0-small, 1-large) */ +#define E1000_EECD_TYPE 0x00002000 /* EEPROM Type (1-SPI, 0-Microwire) */ +#ifndef E1000_EEPROM_GRANT_ATTEMPTS +#define E1000_EEPROM_GRANT_ATTEMPTS 1000 /* EEPROM # attempts to gain grant */ +#endif + +/* EEPROM Read */ +#define E1000_EERD_START 0x00000001 /* Start Read */ +#define E1000_EERD_DONE 0x00000010 /* Read Done */ +#define E1000_EERD_ADDR_SHIFT 8 +#define E1000_EERD_ADDR_MASK 0x0000FF00 /* Read Address */ +#define E1000_EERD_DATA_SHIFT 16 +#define E1000_EERD_DATA_MASK 0xFFFF0000 /* Read Data */ + +/* SPI EEPROM Status Register */ +#define EEPROM_STATUS_RDY_SPI 0x01 +#define EEPROM_STATUS_WEN_SPI 0x02 +#define EEPROM_STATUS_BP0_SPI 0x04 +#define EEPROM_STATUS_BP1_SPI 0x08 +#define EEPROM_STATUS_WPEN_SPI 0x80 + +/* Extended Device Control */ +#define E1000_CTRL_EXT_GPI0_EN 0x00000001 /* Maps SDP4 to GPI0 */ +#define E1000_CTRL_EXT_GPI1_EN 0x00000002 /* Maps SDP5 to GPI1 */ +#define E1000_CTRL_EXT_PHYINT_EN E1000_CTRL_EXT_GPI1_EN +#define E1000_CTRL_EXT_GPI2_EN 0x00000004 /* Maps SDP6 to GPI2 */ +#define E1000_CTRL_EXT_GPI3_EN 0x00000008 /* Maps SDP7 to GPI3 */ +#define E1000_CTRL_EXT_SDP4_DATA 0x00000010 /* Value of SW Defineable Pin 4 */ +#define E1000_CTRL_EXT_SDP5_DATA 0x00000020 /* Value of SW Defineable Pin 5 */ +#define E1000_CTRL_EXT_PHY_INT E1000_CTRL_EXT_SDP5_DATA +#define E1000_CTRL_EXT_SDP6_DATA 0x00000040 /* Value of SW Defineable Pin 6 */ +#define E1000_CTRL_EXT_SDP7_DATA 0x00000080 /* Value of SW Defineable Pin 7 */ +#define E1000_CTRL_EXT_SDP4_DIR 0x00000100 /* Direction of SDP4 0=in 1=out */ +#define E1000_CTRL_EXT_SDP5_DIR 0x00000200 /* Direction of SDP5 0=in 1=out */ +#define E1000_CTRL_EXT_SDP6_DIR 0x00000400 /* Direction of SDP6 0=in 1=out */ +#define E1000_CTRL_EXT_SDP7_DIR 0x00000800 /* Direction of SDP7 0=in 1=out */ +#define E1000_CTRL_EXT_ASDCHK 0x00001000 /* Initiate an ASD sequence */ +#define E1000_CTRL_EXT_EE_RST 0x00002000 /* Reinitialize from EEPROM */ +#define E1000_CTRL_EXT_IPS 0x00004000 /* Invert Power State */ +#define E1000_CTRL_EXT_SPD_BYPS 0x00008000 /* Speed Select Bypass */ +#define E1000_CTRL_EXT_LINK_MODE_MASK 0x00C00000 +#define E1000_CTRL_EXT_LINK_MODE_GMII 0x00000000 +#define E1000_CTRL_EXT_LINK_MODE_TBI 0x00C00000 +#define E1000_CTRL_EXT_WR_WMARK_MASK 0x03000000 +#define E1000_CTRL_EXT_WR_WMARK_256 0x00000000 +#define E1000_CTRL_EXT_WR_WMARK_320 0x01000000 +#define E1000_CTRL_EXT_WR_WMARK_384 0x02000000 +#define E1000_CTRL_EXT_WR_WMARK_448 0x03000000 + +/* MDI Control */ +#define E1000_MDIC_DATA_MASK 0x0000FFFF +#define E1000_MDIC_REG_MASK 0x001F0000 +#define E1000_MDIC_REG_SHIFT 16 +#define E1000_MDIC_PHY_MASK 0x03E00000 +#define E1000_MDIC_PHY_SHIFT 21 +#define E1000_MDIC_OP_WRITE 0x04000000 +#define E1000_MDIC_OP_READ 0x08000000 +#define E1000_MDIC_READY 0x10000000 +#define E1000_MDIC_INT_EN 0x20000000 +#define E1000_MDIC_ERROR 0x40000000 + +/* LED Control */ +#define E1000_LEDCTL_LED0_MODE_MASK 0x0000000F +#define E1000_LEDCTL_LED0_MODE_SHIFT 0 +#define E1000_LEDCTL_LED0_IVRT 0x00000040 +#define E1000_LEDCTL_LED0_BLINK 0x00000080 +#define E1000_LEDCTL_LED1_MODE_MASK 0x00000F00 +#define E1000_LEDCTL_LED1_MODE_SHIFT 8 +#define E1000_LEDCTL_LED1_IVRT 0x00004000 +#define E1000_LEDCTL_LED1_BLINK 0x00008000 +#define E1000_LEDCTL_LED2_MODE_MASK 0x000F0000 +#define E1000_LEDCTL_LED2_MODE_SHIFT 16 +#define E1000_LEDCTL_LED2_IVRT 0x00400000 +#define E1000_LEDCTL_LED2_BLINK 0x00800000 +#define E1000_LEDCTL_LED3_MODE_MASK 0x0F000000 +#define E1000_LEDCTL_LED3_MODE_SHIFT 24 +#define E1000_LEDCTL_LED3_IVRT 0x40000000 +#define E1000_LEDCTL_LED3_BLINK 0x80000000 + +#define E1000_LEDCTL_MODE_LINK_10_1000 0x0 +#define E1000_LEDCTL_MODE_LINK_100_1000 0x1 +#define E1000_LEDCTL_MODE_LINK_UP 0x2 +#define E1000_LEDCTL_MODE_ACTIVITY 0x3 +#define E1000_LEDCTL_MODE_LINK_ACTIVITY 0x4 +#define E1000_LEDCTL_MODE_LINK_10 0x5 +#define E1000_LEDCTL_MODE_LINK_100 0x6 +#define E1000_LEDCTL_MODE_LINK_1000 0x7 +#define E1000_LEDCTL_MODE_PCIX_MODE 0x8 +#define E1000_LEDCTL_MODE_FULL_DUPLEX 0x9 +#define E1000_LEDCTL_MODE_COLLISION 0xA +#define E1000_LEDCTL_MODE_BUS_SPEED 0xB +#define E1000_LEDCTL_MODE_BUS_SIZE 0xC +#define E1000_LEDCTL_MODE_PAUSED 0xD +#define E1000_LEDCTL_MODE_LED_ON 0xE +#define E1000_LEDCTL_MODE_LED_OFF 0xF + +/* Receive Address */ +#define E1000_RAH_AV 0x80000000 /* Receive descriptor valid */ + +/* Interrupt Cause Read */ +#define E1000_ICR_TXDW 0x00000001 /* Transmit desc written back */ +#define E1000_ICR_TXQE 0x00000002 /* Transmit Queue empty */ +#define E1000_ICR_LSC 0x00000004 /* Link Status Change */ +#define E1000_ICR_RXSEQ 0x00000008 /* rx sequence error */ +#define E1000_ICR_RXDMT0 0x00000010 /* rx desc min. threshold (0) */ +#define E1000_ICR_RXO 0x00000040 /* rx overrun */ +#define E1000_ICR_RXT0 0x00000080 /* rx timer intr (ring 0) */ +#define E1000_ICR_MDAC 0x00000200 /* MDIO access complete */ +#define E1000_ICR_RXCFG 0x00000400 /* RX /c/ ordered set */ +#define E1000_ICR_GPI_EN0 0x00000800 /* GP Int 0 */ +#define E1000_ICR_GPI_EN1 0x00001000 /* GP Int 1 */ +#define E1000_ICR_GPI_EN2 0x00002000 /* GP Int 2 */ +#define E1000_ICR_GPI_EN3 0x00004000 /* GP Int 3 */ +#define E1000_ICR_TXD_LOW 0x00008000 +#define E1000_ICR_SRPD 0x00010000 + +/* Interrupt Cause Set */ +#define E1000_ICS_TXDW E1000_ICR_TXDW /* Transmit desc written back */ +#define E1000_ICS_TXQE E1000_ICR_TXQE /* Transmit Queue empty */ +#define E1000_ICS_LSC E1000_ICR_LSC /* Link Status Change */ +#define E1000_ICS_RXSEQ E1000_ICR_RXSEQ /* rx sequence error */ +#define E1000_ICS_RXDMT0 E1000_ICR_RXDMT0 /* rx desc min. threshold */ +#define E1000_ICS_RXO E1000_ICR_RXO /* rx overrun */ +#define E1000_ICS_RXT0 E1000_ICR_RXT0 /* rx timer intr */ +#define E1000_ICS_MDAC E1000_ICR_MDAC /* MDIO access complete */ +#define E1000_ICS_RXCFG E1000_ICR_RXCFG /* RX /c/ ordered set */ +#define E1000_ICS_GPI_EN0 E1000_ICR_GPI_EN0 /* GP Int 0 */ +#define E1000_ICS_GPI_EN1 E1000_ICR_GPI_EN1 /* GP Int 1 */ +#define E1000_ICS_GPI_EN2 E1000_ICR_GPI_EN2 /* GP Int 2 */ +#define E1000_ICS_GPI_EN3 E1000_ICR_GPI_EN3 /* GP Int 3 */ +#define E1000_ICS_TXD_LOW E1000_ICR_TXD_LOW +#define E1000_ICS_SRPD E1000_ICR_SRPD + +/* Interrupt Mask Set */ +#define E1000_IMS_TXDW E1000_ICR_TXDW /* Transmit desc written back */ +#define E1000_IMS_TXQE E1000_ICR_TXQE /* Transmit Queue empty */ +#define E1000_IMS_LSC E1000_ICR_LSC /* Link Status Change */ +#define E1000_IMS_RXSEQ E1000_ICR_RXSEQ /* rx sequence error */ +#define E1000_IMS_RXDMT0 E1000_ICR_RXDMT0 /* rx desc min. threshold */ +#define E1000_IMS_RXO E1000_ICR_RXO /* rx overrun */ +#define E1000_IMS_RXT0 E1000_ICR_RXT0 /* rx timer intr */ +#define E1000_IMS_MDAC E1000_ICR_MDAC /* MDIO access complete */ +#define E1000_IMS_RXCFG E1000_ICR_RXCFG /* RX /c/ ordered set */ +#define E1000_IMS_GPI_EN0 E1000_ICR_GPI_EN0 /* GP Int 0 */ +#define E1000_IMS_GPI_EN1 E1000_ICR_GPI_EN1 /* GP Int 1 */ +#define E1000_IMS_GPI_EN2 E1000_ICR_GPI_EN2 /* GP Int 2 */ +#define E1000_IMS_GPI_EN3 E1000_ICR_GPI_EN3 /* GP Int 3 */ +#define E1000_IMS_TXD_LOW E1000_ICR_TXD_LOW +#define E1000_IMS_SRPD E1000_ICR_SRPD + +/* Interrupt Mask Clear */ +#define E1000_IMC_TXDW E1000_ICR_TXDW /* Transmit desc written back */ +#define E1000_IMC_TXQE E1000_ICR_TXQE /* Transmit Queue empty */ +#define E1000_IMC_LSC E1000_ICR_LSC /* Link Status Change */ +#define E1000_IMC_RXSEQ E1000_ICR_RXSEQ /* rx sequence error */ +#define E1000_IMC_RXDMT0 E1000_ICR_RXDMT0 /* rx desc min. threshold */ +#define E1000_IMC_RXO E1000_ICR_RXO /* rx overrun */ +#define E1000_IMC_RXT0 E1000_ICR_RXT0 /* rx timer intr */ +#define E1000_IMC_MDAC E1000_ICR_MDAC /* MDIO access complete */ +#define E1000_IMC_RXCFG E1000_ICR_RXCFG /* RX /c/ ordered set */ +#define E1000_IMC_GPI_EN0 E1000_ICR_GPI_EN0 /* GP Int 0 */ +#define E1000_IMC_GPI_EN1 E1000_ICR_GPI_EN1 /* GP Int 1 */ +#define E1000_IMC_GPI_EN2 E1000_ICR_GPI_EN2 /* GP Int 2 */ +#define E1000_IMC_GPI_EN3 E1000_ICR_GPI_EN3 /* GP Int 3 */ +#define E1000_IMC_TXD_LOW E1000_ICR_TXD_LOW +#define E1000_IMC_SRPD E1000_ICR_SRPD + +/* Receive Control */ +#define E1000_RCTL_RST 0x00000001 /* Software reset */ +#define E1000_RCTL_EN 0x00000002 /* enable */ +#define E1000_RCTL_SBP 0x00000004 /* store bad packet */ +#define E1000_RCTL_UPE 0x00000008 /* unicast promiscuous enable */ +#define E1000_RCTL_MPE 0x00000010 /* multicast promiscuous enab */ +#define E1000_RCTL_LPE 0x00000020 /* long packet enable */ +#define E1000_RCTL_LBM_NO 0x00000000 /* no loopback mode */ +#define E1000_RCTL_LBM_MAC 0x00000040 /* MAC loopback mode */ +#define E1000_RCTL_LBM_SLP 0x00000080 /* serial link loopback mode */ +#define E1000_RCTL_LBM_TCVR 0x000000C0 /* tcvr loopback mode */ +#define E1000_RCTL_RDMTS_HALF 0x00000000 /* rx desc min threshold size */ +#define E1000_RCTL_RDMTS_QUAT 0x00000100 /* rx desc min threshold size */ +#define E1000_RCTL_RDMTS_EIGTH 0x00000200 /* rx desc min threshold size */ +#define E1000_RCTL_MO_SHIFT 12 /* multicast offset shift */ +#define E1000_RCTL_MO_0 0x00000000 /* multicast offset 11:0 */ +#define E1000_RCTL_MO_1 0x00001000 /* multicast offset 12:1 */ +#define E1000_RCTL_MO_2 0x00002000 /* multicast offset 13:2 */ +#define E1000_RCTL_MO_3 0x00003000 /* multicast offset 15:4 */ +#define E1000_RCTL_MDR 0x00004000 /* multicast desc ring 0 */ +#define E1000_RCTL_BAM 0x00008000 /* broadcast enable */ +/* these buffer sizes are valid if E1000_RCTL_BSEX is 0 */ +#define E1000_RCTL_SZ_2048 0x00000000 /* rx buffer size 2048 */ +#define E1000_RCTL_SZ_1024 0x00010000 /* rx buffer size 1024 */ +#define E1000_RCTL_SZ_512 0x00020000 /* rx buffer size 512 */ +#define E1000_RCTL_SZ_256 0x00030000 /* rx buffer size 256 */ +/* these buffer sizes are valid if E1000_RCTL_BSEX is 1 */ +#define E1000_RCTL_SZ_16384 0x00010000 /* rx buffer size 16384 */ +#define E1000_RCTL_SZ_8192 0x00020000 /* rx buffer size 8192 */ +#define E1000_RCTL_SZ_4096 0x00030000 /* rx buffer size 4096 */ +#define E1000_RCTL_VFE 0x00040000 /* vlan filter enable */ +#define E1000_RCTL_CFIEN 0x00080000 /* canonical form enable */ +#define E1000_RCTL_CFI 0x00100000 /* canonical form indicator */ +#define E1000_RCTL_DPF 0x00400000 /* discard pause frames */ +#define E1000_RCTL_PMCF 0x00800000 /* pass MAC control frames */ +#define E1000_RCTL_BSEX 0x02000000 /* Buffer size extension */ + +/* Receive Descriptor */ +#define E1000_RDT_DELAY 0x0000ffff /* Delay timer (1=1024us) */ +#define E1000_RDT_FPDB 0x80000000 /* Flush descriptor block */ +#define E1000_RDLEN_LEN 0x0007ff80 /* descriptor length */ +#define E1000_RDH_RDH 0x0000ffff /* receive descriptor head */ +#define E1000_RDT_RDT 0x0000ffff /* receive descriptor tail */ + +/* Flow Control */ +#define E1000_FCRTH_RTH 0x0000FFF8 /* Mask Bits[15:3] for RTH */ +#define E1000_FCRTH_XFCE 0x80000000 /* External Flow Control Enable */ +#define E1000_FCRTL_RTL 0x0000FFF8 /* Mask Bits[15:3] for RTL */ +#define E1000_FCRTL_XONE 0x80000000 /* Enable XON frame transmission */ + +/* Receive Descriptor Control */ +#define E1000_RXDCTL_PTHRESH 0x0000003F /* RXDCTL Prefetch Threshold */ +#define E1000_RXDCTL_HTHRESH 0x00003F00 /* RXDCTL Host Threshold */ +#define E1000_RXDCTL_WTHRESH 0x003F0000 /* RXDCTL Writeback Threshold */ +#define E1000_RXDCTL_GRAN 0x01000000 /* RXDCTL Granularity */ + +/* Transmit Descriptor Control */ +#define E1000_TXDCTL_PTHRESH 0x000000FF /* TXDCTL Prefetch Threshold */ +#define E1000_TXDCTL_HTHRESH 0x0000FF00 /* TXDCTL Host Threshold */ +#define E1000_TXDCTL_WTHRESH 0x00FF0000 /* TXDCTL Writeback Threshold */ +#define E1000_TXDCTL_GRAN 0x01000000 /* TXDCTL Granularity */ +#define E1000_TXDCTL_LWTHRESH 0xFE000000 /* TXDCTL Low Threshold */ +#define E1000_TXDCTL_FULL_TX_DESC_WB 0x01010000 /* GRAN=1, WTHRESH=1 */ + +/* Transmit Configuration Word */ +#define E1000_TXCW_FD 0x00000020 /* TXCW full duplex */ +#define E1000_TXCW_HD 0x00000040 /* TXCW half duplex */ +#define E1000_TXCW_PAUSE 0x00000080 /* TXCW sym pause request */ +#define E1000_TXCW_ASM_DIR 0x00000100 /* TXCW astm pause direction */ +#define E1000_TXCW_PAUSE_MASK 0x00000180 /* TXCW pause request mask */ +#define E1000_TXCW_RF 0x00003000 /* TXCW remote fault */ +#define E1000_TXCW_NP 0x00008000 /* TXCW next page */ +#define E1000_TXCW_CW 0x0000ffff /* TxConfigWord mask */ +#define E1000_TXCW_TXC 0x40000000 /* Transmit Config control */ +#define E1000_TXCW_ANE 0x80000000 /* Auto-neg enable */ + +/* Receive Configuration Word */ +#define E1000_RXCW_CW 0x0000ffff /* RxConfigWord mask */ +#define E1000_RXCW_NC 0x04000000 /* Receive config no carrier */ +#define E1000_RXCW_IV 0x08000000 /* Receive config invalid */ +#define E1000_RXCW_CC 0x10000000 /* Receive config change */ +#define E1000_RXCW_C 0x20000000 /* Receive config */ +#define E1000_RXCW_SYNCH 0x40000000 /* Receive config synch */ +#define E1000_RXCW_ANC 0x80000000 /* Auto-neg complete */ + +/* Transmit Control */ +#define E1000_TCTL_RST 0x00000001 /* software reset */ +#define E1000_TCTL_EN 0x00000002 /* enable tx */ +#define E1000_TCTL_BCE 0x00000004 /* busy check enable */ +#define E1000_TCTL_PSP 0x00000008 /* pad short packets */ +#define E1000_TCTL_CT 0x00000ff0 /* collision threshold */ +#define E1000_TCTL_COLD 0x003ff000 /* collision distance */ +#define E1000_TCTL_SWXOFF 0x00400000 /* SW Xoff transmission */ +#define E1000_TCTL_PBE 0x00800000 /* Packet Burst Enable */ +#define E1000_TCTL_RTLC 0x01000000 /* Re-transmit on late collision */ +#define E1000_TCTL_NRTU 0x02000000 /* No Re-transmit on underrun */ + +/* Receive Checksum Control */ +#define E1000_RXCSUM_PCSS_MASK 0x000000FF /* Packet Checksum Start */ +#define E1000_RXCSUM_IPOFL 0x00000100 /* IPv4 checksum offload */ +#define E1000_RXCSUM_TUOFL 0x00000200 /* TCP / UDP checksum offload */ +#define E1000_RXCSUM_IPV6OFL 0x00000400 /* IPv6 checksum offload */ + +/* Definitions for power management and wakeup registers */ +/* Wake Up Control */ +#define E1000_WUC_APME 0x00000001 /* APM Enable */ +#define E1000_WUC_PME_EN 0x00000002 /* PME Enable */ +#define E1000_WUC_PME_STATUS 0x00000004 /* PME Status */ +#define E1000_WUC_APMPME 0x00000008 /* Assert PME on APM Wakeup */ +#define E1000_WUC_SPM 0x80000000 /* Enable SPM */ + +/* Wake Up Filter Control */ +#define E1000_WUFC_LNKC 0x00000001 /* Link Status Change Wakeup Enable */ +#define E1000_WUFC_MAG 0x00000002 /* Magic Packet Wakeup Enable */ +#define E1000_WUFC_EX 0x00000004 /* Directed Exact Wakeup Enable */ +#define E1000_WUFC_MC 0x00000008 /* Directed Multicast Wakeup Enable */ +#define E1000_WUFC_BC 0x00000010 /* Broadcast Wakeup Enable */ +#define E1000_WUFC_ARP 0x00000020 /* ARP Request Packet Wakeup Enable */ +#define E1000_WUFC_IPV4 0x00000040 /* Directed IPv4 Packet Wakeup Enable */ +#define E1000_WUFC_IPV6 0x00000080 /* Directed IPv6 Packet Wakeup Enable */ +#define E1000_WUFC_FLX0 0x00010000 /* Flexible Filter 0 Enable */ +#define E1000_WUFC_FLX1 0x00020000 /* Flexible Filter 1 Enable */ +#define E1000_WUFC_FLX2 0x00040000 /* Flexible Filter 2 Enable */ +#define E1000_WUFC_FLX3 0x00080000 /* Flexible Filter 3 Enable */ +#define E1000_WUFC_ALL_FILTERS 0x000F00FF /* Mask for all wakeup filters */ +#define E1000_WUFC_FLX_OFFSET 16 /* Offset to the Flexible Filters bits */ +#define E1000_WUFC_FLX_FILTERS 0x000F0000 /* Mask for the 4 flexible filters */ + +/* Wake Up Status */ +#define E1000_WUS_LNKC 0x00000001 /* Link Status Changed */ +#define E1000_WUS_MAG 0x00000002 /* Magic Packet Received */ +#define E1000_WUS_EX 0x00000004 /* Directed Exact Received */ +#define E1000_WUS_MC 0x00000008 /* Directed Multicast Received */ +#define E1000_WUS_BC 0x00000010 /* Broadcast Received */ +#define E1000_WUS_ARP 0x00000020 /* ARP Request Packet Received */ +#define E1000_WUS_IPV4 0x00000040 /* Directed IPv4 Packet Wakeup Received */ +#define E1000_WUS_IPV6 0x00000080 /* Directed IPv6 Packet Wakeup Received */ +#define E1000_WUS_FLX0 0x00010000 /* Flexible Filter 0 Match */ +#define E1000_WUS_FLX1 0x00020000 /* Flexible Filter 1 Match */ +#define E1000_WUS_FLX2 0x00040000 /* Flexible Filter 2 Match */ +#define E1000_WUS_FLX3 0x00080000 /* Flexible Filter 3 Match */ +#define E1000_WUS_FLX_FILTERS 0x000F0000 /* Mask for the 4 flexible filters */ + +/* Management Control */ +#define E1000_MANC_SMBUS_EN 0x00000001 /* SMBus Enabled - RO */ +#define E1000_MANC_ASF_EN 0x00000002 /* ASF Enabled - RO */ +#define E1000_MANC_R_ON_FORCE 0x00000004 /* Reset on Force TCO - RO */ +#define E1000_MANC_RMCP_EN 0x00000100 /* Enable RCMP 026Fh Filtering */ +#define E1000_MANC_0298_EN 0x00000200 /* Enable RCMP 0298h Filtering */ +#define E1000_MANC_IPV4_EN 0x00000400 /* Enable IPv4 */ +#define E1000_MANC_IPV6_EN 0x00000800 /* Enable IPv6 */ +#define E1000_MANC_SNAP_EN 0x00001000 /* Accept LLC/SNAP */ +#define E1000_MANC_ARP_EN 0x00002000 /* Enable ARP Request Filtering */ +#define E1000_MANC_NEIGHBOR_EN 0x00004000 /* Enable Neighbor Discovery + * Filtering */ +#define E1000_MANC_TCO_RESET 0x00010000 /* TCO Reset Occurred */ +#define E1000_MANC_RCV_TCO_EN 0x00020000 /* Receive TCO Packets Enabled */ +#define E1000_MANC_REPORT_STATUS 0x00040000 /* Status Reporting Enabled */ +#define E1000_MANC_SMB_REQ 0x01000000 /* SMBus Request */ +#define E1000_MANC_SMB_GNT 0x02000000 /* SMBus Grant */ +#define E1000_MANC_SMB_CLK_IN 0x04000000 /* SMBus Clock In */ +#define E1000_MANC_SMB_DATA_IN 0x08000000 /* SMBus Data In */ +#define E1000_MANC_SMB_DATA_OUT 0x10000000 /* SMBus Data Out */ +#define E1000_MANC_SMB_CLK_OUT 0x20000000 /* SMBus Clock Out */ + +#define E1000_MANC_SMB_DATA_OUT_SHIFT 28 /* SMBus Data Out Shift */ +#define E1000_MANC_SMB_CLK_OUT_SHIFT 29 /* SMBus Clock Out Shift */ + +/* Wake Up Packet Length */ +#define E1000_WUPL_LENGTH_MASK 0x0FFF /* Only the lower 12 bits are valid */ + +#define E1000_MDALIGN 4096 + +/* EEPROM Commands - Microwire */ +#define EEPROM_READ_OPCODE_MICROWIRE 0x6 /* EEPROM read opcode */ +#define EEPROM_WRITE_OPCODE_MICROWIRE 0x5 /* EEPROM write opcode */ +#define EEPROM_ERASE_OPCODE_MICROWIRE 0x7 /* EEPROM erase opcode */ +#define EEPROM_EWEN_OPCODE_MICROWIRE 0x13 /* EEPROM erase/write enable */ +#define EEPROM_EWDS_OPCODE_MICROWIRE 0x10 /* EEPROM erast/write disable */ + +/* EEPROM Commands - SPI */ +#define EEPROM_MAX_RETRY_SPI 5000 /* Max wait of 5ms, for RDY signal */ +#define EEPROM_READ_OPCODE_SPI 0x3 /* EEPROM read opcode */ +#define EEPROM_WRITE_OPCODE_SPI 0x2 /* EEPROM write opcode */ +#define EEPROM_A8_OPCODE_SPI 0x8 /* opcode bit-3 = address bit-8 */ +#define EEPROM_WREN_OPCODE_SPI 0x6 /* EEPROM set Write Enable latch */ +#define EEPROM_WRDI_OPCODE_SPI 0x4 /* EEPROM reset Write Enable latch */ +#define EEPROM_RDSR_OPCODE_SPI 0x5 /* EEPROM read Status register */ +#define EEPROM_WRSR_OPCODE_SPI 0x1 /* EEPROM write Status register */ + +/* EEPROM Size definitions */ +#define EEPROM_SIZE_16KB 0x1800 +#define EEPROM_SIZE_8KB 0x1400 +#define EEPROM_SIZE_4KB 0x1000 +#define EEPROM_SIZE_2KB 0x0C00 +#define EEPROM_SIZE_1KB 0x0800 +#define EEPROM_SIZE_512B 0x0400 +#define EEPROM_SIZE_128B 0x0000 +#define EEPROM_SIZE_MASK 0x1C00 + +/* EEPROM Word Offsets */ +#define EEPROM_COMPAT 0x0003 +#define EEPROM_ID_LED_SETTINGS 0x0004 +#define EEPROM_SERDES_AMPLITUDE 0x0006 /* For SERDES output amplitude adjustment. */ +#define EEPROM_INIT_CONTROL1_REG 0x000A +#define EEPROM_INIT_CONTROL2_REG 0x000F +#define EEPROM_INIT_CONTROL3_PORT_B 0x0014 +#define EEPROM_INIT_CONTROL3_PORT_A 0x0024 +#define EEPROM_CFG 0x0012 +#define EEPROM_FLASH_VERSION 0x0032 +#define EEPROM_CHECKSUM_REG 0x003F + +/* Word definitions for ID LED Settings */ +#define ID_LED_RESERVED_0000 0x0000 +#define ID_LED_RESERVED_FFFF 0xFFFF +#define ID_LED_DEFAULT ((ID_LED_OFF1_ON2 << 12) | \ + (ID_LED_OFF1_OFF2 << 8) | \ + (ID_LED_DEF1_DEF2 << 4) | \ + (ID_LED_DEF1_DEF2)) +#define ID_LED_DEF1_DEF2 0x1 +#define ID_LED_DEF1_ON2 0x2 +#define ID_LED_DEF1_OFF2 0x3 +#define ID_LED_ON1_DEF2 0x4 +#define ID_LED_ON1_ON2 0x5 +#define ID_LED_ON1_OFF2 0x6 +#define ID_LED_OFF1_DEF2 0x7 +#define ID_LED_OFF1_ON2 0x8 +#define ID_LED_OFF1_OFF2 0x9 + +#define IGP_ACTIVITY_LED_MASK 0xFFFFF0FF +#define IGP_ACTIVITY_LED_ENABLE 0x0300 +#define IGP_LED3_MODE 0x07000000 + + +/* Mask bits for SERDES amplitude adjustment in Word 6 of the EEPROM */ +#define EEPROM_SERDES_AMPLITUDE_MASK 0x000F + +/* Mask bits for fields in Word 0x0a of the EEPROM */ +#define EEPROM_WORD0A_ILOS 0x0010 +#define EEPROM_WORD0A_SWDPIO 0x01E0 +#define EEPROM_WORD0A_LRST 0x0200 +#define EEPROM_WORD0A_FD 0x0400 +#define EEPROM_WORD0A_66MHZ 0x0800 + +/* Mask bits for fields in Word 0x0f of the EEPROM */ +#define EEPROM_WORD0F_PAUSE_MASK 0x3000 +#define EEPROM_WORD0F_PAUSE 0x1000 +#define EEPROM_WORD0F_ASM_DIR 0x2000 +#define EEPROM_WORD0F_ANE 0x0800 +#define EEPROM_WORD0F_SWPDIO_EXT 0x00F0 + +/* For checksumming, the sum of all words in the EEPROM should equal 0xBABA. */ +#define EEPROM_SUM 0xBABA + +/* EEPROM Map defines (WORD OFFSETS)*/ +#define EEPROM_NODE_ADDRESS_BYTE_0 0 +#define EEPROM_PBA_BYTE_1 8 + +#define EEPROM_RESERVED_WORD 0xFFFF + +/* EEPROM Map Sizes (Byte Counts) */ +#define PBA_SIZE 4 + +/* Collision related configuration parameters */ +#define E1000_COLLISION_THRESHOLD 16 +#define E1000_CT_SHIFT 4 +#define E1000_COLLISION_DISTANCE 64 +#define E1000_FDX_COLLISION_DISTANCE E1000_COLLISION_DISTANCE +#define E1000_HDX_COLLISION_DISTANCE E1000_COLLISION_DISTANCE +#define E1000_COLD_SHIFT 12 + +/* Number of Transmit and Receive Descriptors must be a multiple of 8 */ +#define REQ_TX_DESCRIPTOR_MULTIPLE 8 +#define REQ_RX_DESCRIPTOR_MULTIPLE 8 + +/* Default values for the transmit IPG register */ +#define DEFAULT_82542_TIPG_IPGT 10 +#define DEFAULT_82543_TIPG_IPGT_FIBER 9 +#define DEFAULT_82543_TIPG_IPGT_COPPER 8 + +#define E1000_TIPG_IPGT_MASK 0x000003FF +#define E1000_TIPG_IPGR1_MASK 0x000FFC00 +#define E1000_TIPG_IPGR2_MASK 0x3FF00000 + +#define DEFAULT_82542_TIPG_IPGR1 2 +#define DEFAULT_82543_TIPG_IPGR1 8 +#define E1000_TIPG_IPGR1_SHIFT 10 + +#define DEFAULT_82542_TIPG_IPGR2 10 +#define DEFAULT_82543_TIPG_IPGR2 6 +#define E1000_TIPG_IPGR2_SHIFT 20 + +#define E1000_TXDMAC_DPP 0x00000001 + +/* Adaptive IFS defines */ +#define TX_THRESHOLD_START 8 +#define TX_THRESHOLD_INCREMENT 10 +#define TX_THRESHOLD_DECREMENT 1 +#define TX_THRESHOLD_STOP 190 +#define TX_THRESHOLD_DISABLE 0 +#define TX_THRESHOLD_TIMER_MS 10000 +#define MIN_NUM_XMITS 1000 +#define IFS_MAX 80 +#define IFS_STEP 10 +#define IFS_MIN 40 +#define IFS_RATIO 4 + +/* PBA constants */ +#define E1000_PBA_16K 0x0010 /* 16KB, default TX allocation */ +#define E1000_PBA_22K 0x0016 +#define E1000_PBA_24K 0x0018 +#define E1000_PBA_30K 0x001E +#define E1000_PBA_40K 0x0028 +#define E1000_PBA_48K 0x0030 /* 48KB, default RX allocation */ + +/* Flow Control Constants */ +#define FLOW_CONTROL_ADDRESS_LOW 0x00C28001 +#define FLOW_CONTROL_ADDRESS_HIGH 0x00000100 +#define FLOW_CONTROL_TYPE 0x8808 + +/* The historical defaults for the flow control values are given below. */ +#define FC_DEFAULT_HI_THRESH (0x8000) /* 32KB */ +#define FC_DEFAULT_LO_THRESH (0x4000) /* 16KB */ +#define FC_DEFAULT_TX_TIMER (0x100) /* ~130 us */ + +/* PCIX Config space */ +#define PCIX_COMMAND_REGISTER 0xE6 +#define PCIX_STATUS_REGISTER_LO 0xE8 +#define PCIX_STATUS_REGISTER_HI 0xEA + +#define PCIX_COMMAND_MMRBC_MASK 0x000C +#define PCIX_COMMAND_MMRBC_SHIFT 0x2 +#define PCIX_STATUS_HI_MMRBC_MASK 0x0060 +#define PCIX_STATUS_HI_MMRBC_SHIFT 0x5 +#define PCIX_STATUS_HI_MMRBC_4K 0x3 +#define PCIX_STATUS_HI_MMRBC_2K 0x2 + + +/* Number of bits required to shift right the "pause" bits from the + * EEPROM (bits 13:12) to the "pause" (bits 8:7) field in the TXCW register. + */ +#define PAUSE_SHIFT 5 + +/* Number of bits required to shift left the "SWDPIO" bits from the + * EEPROM (bits 8:5) to the "SWDPIO" (bits 25:22) field in the CTRL register. + */ +#define SWDPIO_SHIFT 17 + +/* Number of bits required to shift left the "SWDPIO_EXT" bits from the + * EEPROM word F (bits 7:4) to the bits 11:8 of The Extended CTRL register. + */ +#define SWDPIO__EXT_SHIFT 4 + +/* Number of bits required to shift left the "ILOS" bit from the EEPROM + * (bit 4) to the "ILOS" (bit 7) field in the CTRL register. + */ +#define ILOS_SHIFT 3 + + +#define RECEIVE_BUFFER_ALIGN_SIZE (256) + +/* Number of milliseconds we wait for auto-negotiation to complete */ +#define LINK_UP_TIMEOUT 500 + +#define E1000_TX_BUFFER_SIZE ((uint32_t)1514) + +/* The carrier extension symbol, as received by the NIC. */ +#define CARRIER_EXTENSION 0x0F + +/* TBI_ACCEPT macro definition: + * + * This macro requires: + * adapter = a pointer to struct e1000_hw + * status = the 8 bit status field of the RX descriptor with EOP set + * error = the 8 bit error field of the RX descriptor with EOP set + * length = the sum of all the length fields of the RX descriptors that + * make up the current frame + * last_byte = the last byte of the frame DMAed by the hardware + * max_frame_length = the maximum frame length we want to accept. + * min_frame_length = the minimum frame length we want to accept. + * + * This macro is a conditional that should be used in the interrupt + * handler's Rx processing routine when RxErrors have been detected. + * + * Typical use: + * ... + * if (TBI_ACCEPT) { + * accept_frame = TRUE; + * e1000_tbi_adjust_stats(adapter, MacAddress); + * frame_length--; + * } else { + * accept_frame = FALSE; + * } + * ... + */ + +#define TBI_ACCEPT(adapter, status, errors, length, last_byte) \ + ((adapter)->tbi_compatibility_on && \ + (((errors) & E1000_RXD_ERR_FRAME_ERR_MASK) == E1000_RXD_ERR_CE) && \ + ((last_byte) == CARRIER_EXTENSION) && \ + (((status) & E1000_RXD_STAT_VP) ? \ + (((length) > ((adapter)->min_frame_size - VLAN_TAG_SIZE)) && \ + ((length) <= ((adapter)->max_frame_size + 1))) : \ + (((length) > (adapter)->min_frame_size) && \ + ((length) <= ((adapter)->max_frame_size + VLAN_TAG_SIZE + 1))))) + + +/* Structures, enums, and macros for the PHY */ + +/* Bit definitions for the Management Data IO (MDIO) and Management Data + * Clock (MDC) pins in the Device Control Register. + */ +#define E1000_CTRL_PHY_RESET_DIR E1000_CTRL_SWDPIO0 +#define E1000_CTRL_PHY_RESET E1000_CTRL_SWDPIN0 +#define E1000_CTRL_MDIO_DIR E1000_CTRL_SWDPIO2 +#define E1000_CTRL_MDIO E1000_CTRL_SWDPIN2 +#define E1000_CTRL_MDC_DIR E1000_CTRL_SWDPIO3 +#define E1000_CTRL_MDC E1000_CTRL_SWDPIN3 +#define E1000_CTRL_PHY_RESET_DIR4 E1000_CTRL_EXT_SDP4_DIR +#define E1000_CTRL_PHY_RESET4 E1000_CTRL_EXT_SDP4_DATA + +/* PHY 1000 MII Register/Bit Definitions */ +/* PHY Registers defined by IEEE */ +#define PHY_CTRL 0x00 /* Control Register */ +#define PHY_STATUS 0x01 /* Status Regiser */ +#define PHY_ID1 0x02 /* Phy Id Reg (word 1) */ +#define PHY_ID2 0x03 /* Phy Id Reg (word 2) */ +#define PHY_AUTONEG_ADV 0x04 /* Autoneg Advertisement */ +#define PHY_LP_ABILITY 0x05 /* Link Partner Ability (Base Page) */ +#define PHY_AUTONEG_EXP 0x06 /* Autoneg Expansion Reg */ +#define PHY_NEXT_PAGE_TX 0x07 /* Next Page TX */ +#define PHY_LP_NEXT_PAGE 0x08 /* Link Partner Next Page */ +#define PHY_1000T_CTRL 0x09 /* 1000Base-T Control Reg */ +#define PHY_1000T_STATUS 0x0A /* 1000Base-T Status Reg */ +#define PHY_EXT_STATUS 0x0F /* Extended Status Reg */ + +/* M88E1000 Specific Registers */ +#define M88E1000_PHY_SPEC_CTRL 0x10 /* PHY Specific Control Register */ +#define M88E1000_PHY_SPEC_STATUS 0x11 /* PHY Specific Status Register */ +#define M88E1000_INT_ENABLE 0x12 /* Interrupt Enable Register */ +#define M88E1000_INT_STATUS 0x13 /* Interrupt Status Register */ +#define M88E1000_EXT_PHY_SPEC_CTRL 0x14 /* Extended PHY Specific Control */ +#define M88E1000_RX_ERR_CNTR 0x15 /* Receive Error Counter */ + +#define M88E1000_PHY_EXT_CTRL 0x1A /* PHY extend control register */ +#define M88E1000_PHY_PAGE_SELECT 0x1D /* Reg 29 for page number setting */ +#define M88E1000_PHY_GEN_CONTROL 0x1E /* Its meaning depends on reg 29 */ +#define M88E1000_PHY_VCO_REG_BIT8 0x100 /* Bits 8 & 11 are adjusted for */ +#define M88E1000_PHY_VCO_REG_BIT11 0x800 /* improved BER performance */ + +#define IGP01E1000_IEEE_REGS_PAGE 0x0000 +#define IGP01E1000_IEEE_RESTART_AUTONEG 0x3300 +#define IGP01E1000_IEEE_FORCE_GIGA 0x0140 + +/* IGP01E1000 Specific Registers */ +#define IGP01E1000_PHY_PORT_CONFIG 0x10 /* PHY Specific Port Config Register */ +#define IGP01E1000_PHY_PORT_STATUS 0x11 /* PHY Specific Status Register */ +#define IGP01E1000_PHY_PORT_CTRL 0x12 /* PHY Specific Control Register */ +#define IGP01E1000_PHY_LINK_HEALTH 0x13 /* PHY Link Health Register */ +#define IGP01E1000_GMII_FIFO 0x14 /* GMII FIFO Register */ +#define IGP01E1000_PHY_CHANNEL_QUALITY 0x15 /* PHY Channel Quality Register */ +#define IGP01E1000_PHY_PAGE_SELECT 0x1F /* PHY Page Select Core Register */ + +/* IGP01E1000 AGC Registers - stores the cable length values*/ +#define IGP01E1000_PHY_AGC_A 0x1172 +#define IGP01E1000_PHY_AGC_B 0x1272 +#define IGP01E1000_PHY_AGC_C 0x1472 +#define IGP01E1000_PHY_AGC_D 0x1872 + +/* IGP01E1000 DSP Reset Register */ +#define IGP01E1000_PHY_DSP_RESET 0x1F33 +#define IGP01E1000_PHY_DSP_SET 0x1F71 +#define IGP01E1000_PHY_DSP_FFE 0x1F35 + +#define IGP01E1000_PHY_CHANNEL_NUM 4 +#define IGP01E1000_PHY_AGC_PARAM_A 0x1171 +#define IGP01E1000_PHY_AGC_PARAM_B 0x1271 +#define IGP01E1000_PHY_AGC_PARAM_C 0x1471 +#define IGP01E1000_PHY_AGC_PARAM_D 0x1871 + +#define IGP01E1000_PHY_EDAC_MU_INDEX 0xC000 +#define IGP01E1000_PHY_EDAC_SIGN_EXT_9_BITS 0x8000 + +#define IGP01E1000_PHY_ANALOG_TX_STATE 0x2890 +#define IGP01E1000_PHY_ANALOG_CLASS_A 0x2000 +#define IGP01E1000_PHY_FORCE_ANALOG_ENABLE 0x0004 +#define IGP01E1000_PHY_DSP_FFE_CM_CP 0x0069 + +#define IGP01E1000_PHY_DSP_FFE_DEFAULT 0x002A +/* IGP01E1000 PCS Initialization register - stores the polarity status when + * speed = 1000 Mbps. */ +#define IGP01E1000_PHY_PCS_INIT_REG 0x00B4 +#define IGP01E1000_PHY_PCS_CTRL_REG 0x00B5 + +#define IGP01E1000_ANALOG_REGS_PAGE 0x20C0 + +#define MAX_PHY_REG_ADDRESS 0x1F /* 5 bit address bus (0-0x1F) */ +#define MAX_PHY_MULTI_PAGE_REG 0xF /*Registers that are equal on all pages*/ +/* PHY Control Register */ +#define MII_CR_SPEED_SELECT_MSB 0x0040 /* bits 6,13: 10=1000, 01=100, 00=10 */ +#define MII_CR_COLL_TEST_ENABLE 0x0080 /* Collision test enable */ +#define MII_CR_FULL_DUPLEX 0x0100 /* FDX =1, half duplex =0 */ +#define MII_CR_RESTART_AUTO_NEG 0x0200 /* Restart auto negotiation */ +#define MII_CR_ISOLATE 0x0400 /* Isolate PHY from MII */ +#define MII_CR_POWER_DOWN 0x0800 /* Power down */ +#define MII_CR_AUTO_NEG_EN 0x1000 /* Auto Neg Enable */ +#define MII_CR_SPEED_SELECT_LSB 0x2000 /* bits 6,13: 10=1000, 01=100, 00=10 */ +#define MII_CR_LOOPBACK 0x4000 /* 0 = normal, 1 = loopback */ +#define MII_CR_RESET 0x8000 /* 0 = normal, 1 = PHY reset */ + +/* PHY Status Register */ +#define MII_SR_EXTENDED_CAPS 0x0001 /* Extended register capabilities */ +#define MII_SR_JABBER_DETECT 0x0002 /* Jabber Detected */ +#define MII_SR_LINK_STATUS 0x0004 /* Link Status 1 = link */ +#define MII_SR_AUTONEG_CAPS 0x0008 /* Auto Neg Capable */ +#define MII_SR_REMOTE_FAULT 0x0010 /* Remote Fault Detect */ +#define MII_SR_AUTONEG_COMPLETE 0x0020 /* Auto Neg Complete */ +#define MII_SR_PREAMBLE_SUPPRESS 0x0040 /* Preamble may be suppressed */ +#define MII_SR_EXTENDED_STATUS 0x0100 /* Ext. status info in Reg 0x0F */ +#define MII_SR_100T2_HD_CAPS 0x0200 /* 100T2 Half Duplex Capable */ +#define MII_SR_100T2_FD_CAPS 0x0400 /* 100T2 Full Duplex Capable */ +#define MII_SR_10T_HD_CAPS 0x0800 /* 10T Half Duplex Capable */ +#define MII_SR_10T_FD_CAPS 0x1000 /* 10T Full Duplex Capable */ +#define MII_SR_100X_HD_CAPS 0x2000 /* 100X Half Duplex Capable */ +#define MII_SR_100X_FD_CAPS 0x4000 /* 100X Full Duplex Capable */ +#define MII_SR_100T4_CAPS 0x8000 /* 100T4 Capable */ + +/* Autoneg Advertisement Register */ +#define NWAY_AR_SELECTOR_FIELD 0x0001 /* indicates IEEE 802.3 CSMA/CD */ +#define NWAY_AR_10T_HD_CAPS 0x0020 /* 10T Half Duplex Capable */ +#define NWAY_AR_10T_FD_CAPS 0x0040 /* 10T Full Duplex Capable */ +#define NWAY_AR_100TX_HD_CAPS 0x0080 /* 100TX Half Duplex Capable */ +#define NWAY_AR_100TX_FD_CAPS 0x0100 /* 100TX Full Duplex Capable */ +#define NWAY_AR_100T4_CAPS 0x0200 /* 100T4 Capable */ +#define NWAY_AR_PAUSE 0x0400 /* Pause operation desired */ +#define NWAY_AR_ASM_DIR 0x0800 /* Asymmetric Pause Direction bit */ +#define NWAY_AR_REMOTE_FAULT 0x2000 /* Remote Fault detected */ +#define NWAY_AR_NEXT_PAGE 0x8000 /* Next Page ability supported */ + +/* Link Partner Ability Register (Base Page) */ +#define NWAY_LPAR_SELECTOR_FIELD 0x0000 /* LP protocol selector field */ +#define NWAY_LPAR_10T_HD_CAPS 0x0020 /* LP is 10T Half Duplex Capable */ +#define NWAY_LPAR_10T_FD_CAPS 0x0040 /* LP is 10T Full Duplex Capable */ +#define NWAY_LPAR_100TX_HD_CAPS 0x0080 /* LP is 100TX Half Duplex Capable */ +#define NWAY_LPAR_100TX_FD_CAPS 0x0100 /* LP is 100TX Full Duplex Capable */ +#define NWAY_LPAR_100T4_CAPS 0x0200 /* LP is 100T4 Capable */ +#define NWAY_LPAR_PAUSE 0x0400 /* LP Pause operation desired */ +#define NWAY_LPAR_ASM_DIR 0x0800 /* LP Asymmetric Pause Direction bit */ +#define NWAY_LPAR_REMOTE_FAULT 0x2000 /* LP has detected Remote Fault */ +#define NWAY_LPAR_ACKNOWLEDGE 0x4000 /* LP has rx'd link code word */ +#define NWAY_LPAR_NEXT_PAGE 0x8000 /* Next Page ability supported */ + +/* Autoneg Expansion Register */ +#define NWAY_ER_LP_NWAY_CAPS 0x0001 /* LP has Auto Neg Capability */ +#define NWAY_ER_PAGE_RXD 0x0002 /* LP is 10T Half Duplex Capable */ +#define NWAY_ER_NEXT_PAGE_CAPS 0x0004 /* LP is 10T Full Duplex Capable */ +#define NWAY_ER_LP_NEXT_PAGE_CAPS 0x0008 /* LP is 100TX Half Duplex Capable */ +#define NWAY_ER_PAR_DETECT_FAULT 0x0010 /* LP is 100TX Full Duplex Capable */ + +/* Next Page TX Register */ +#define NPTX_MSG_CODE_FIELD 0x0001 /* NP msg code or unformatted data */ +#define NPTX_TOGGLE 0x0800 /* Toggles between exchanges + * of different NP + */ +#define NPTX_ACKNOWLDGE2 0x1000 /* 1 = will comply with msg + * 0 = cannot comply with msg + */ +#define NPTX_MSG_PAGE 0x2000 /* formatted(1)/unformatted(0) pg */ +#define NPTX_NEXT_PAGE 0x8000 /* 1 = addition NP will follow + * 0 = sending last NP + */ + +/* Link Partner Next Page Register */ +#define LP_RNPR_MSG_CODE_FIELD 0x0001 /* NP msg code or unformatted data */ +#define LP_RNPR_TOGGLE 0x0800 /* Toggles between exchanges + * of different NP + */ +#define LP_RNPR_ACKNOWLDGE2 0x1000 /* 1 = will comply with msg + * 0 = cannot comply with msg + */ +#define LP_RNPR_MSG_PAGE 0x2000 /* formatted(1)/unformatted(0) pg */ +#define LP_RNPR_ACKNOWLDGE 0x4000 /* 1 = ACK / 0 = NO ACK */ +#define LP_RNPR_NEXT_PAGE 0x8000 /* 1 = addition NP will follow + * 0 = sending last NP + */ + +/* 1000BASE-T Control Register */ +#define CR_1000T_ASYM_PAUSE 0x0080 /* Advertise asymmetric pause bit */ +#define CR_1000T_HD_CAPS 0x0100 /* Advertise 1000T HD capability */ +#define CR_1000T_FD_CAPS 0x0200 /* Advertise 1000T FD capability */ +#define CR_1000T_REPEATER_DTE 0x0400 /* 1=Repeater/switch device port */ + /* 0=DTE device */ +#define CR_1000T_MS_VALUE 0x0800 /* 1=Configure PHY as Master */ + /* 0=Configure PHY as Slave */ +#define CR_1000T_MS_ENABLE 0x1000 /* 1=Master/Slave manual config value */ + /* 0=Automatic Master/Slave config */ +#define CR_1000T_TEST_MODE_NORMAL 0x0000 /* Normal Operation */ +#define CR_1000T_TEST_MODE_1 0x2000 /* Transmit Waveform test */ +#define CR_1000T_TEST_MODE_2 0x4000 /* Master Transmit Jitter test */ +#define CR_1000T_TEST_MODE_3 0x6000 /* Slave Transmit Jitter test */ +#define CR_1000T_TEST_MODE_4 0x8000 /* Transmitter Distortion test */ + +/* 1000BASE-T Status Register */ +#define SR_1000T_IDLE_ERROR_CNT 0x00FF /* Num idle errors since last read */ +#define SR_1000T_ASYM_PAUSE_DIR 0x0100 /* LP asymmetric pause direction bit */ +#define SR_1000T_LP_HD_CAPS 0x0400 /* LP is 1000T HD capable */ +#define SR_1000T_LP_FD_CAPS 0x0800 /* LP is 1000T FD capable */ +#define SR_1000T_REMOTE_RX_STATUS 0x1000 /* Remote receiver OK */ +#define SR_1000T_LOCAL_RX_STATUS 0x2000 /* Local receiver OK */ +#define SR_1000T_MS_CONFIG_RES 0x4000 /* 1=Local TX is Master, 0=Slave */ +#define SR_1000T_MS_CONFIG_FAULT 0x8000 /* Master/Slave config fault */ +#define SR_1000T_REMOTE_RX_STATUS_SHIFT 12 +#define SR_1000T_LOCAL_RX_STATUS_SHIFT 13 +#define SR_1000T_PHY_EXCESSIVE_IDLE_ERR_COUNT 5 +#define FFE_IDLE_ERR_COUNT_TIMEOUT_20 20 +#define FFE_IDLE_ERR_COUNT_TIMEOUT_100 100 + +/* Extended Status Register */ +#define IEEE_ESR_1000T_HD_CAPS 0x1000 /* 1000T HD capable */ +#define IEEE_ESR_1000T_FD_CAPS 0x2000 /* 1000T FD capable */ +#define IEEE_ESR_1000X_HD_CAPS 0x4000 /* 1000X HD capable */ +#define IEEE_ESR_1000X_FD_CAPS 0x8000 /* 1000X FD capable */ + +#define PHY_TX_POLARITY_MASK 0x0100 /* register 10h bit 8 (polarity bit) */ +#define PHY_TX_NORMAL_POLARITY 0 /* register 10h bit 8 (normal polarity) */ + +#define AUTO_POLARITY_DISABLE 0x0010 /* register 11h bit 4 */ + /* (0=enable, 1=disable) */ + +/* M88E1000 PHY Specific Control Register */ +#define M88E1000_PSCR_JABBER_DISABLE 0x0001 /* 1=Jabber Function disabled */ +#define M88E1000_PSCR_POLARITY_REVERSAL 0x0002 /* 1=Polarity Reversal enabled */ +#define M88E1000_PSCR_SQE_TEST 0x0004 /* 1=SQE Test enabled */ +#define M88E1000_PSCR_CLK125_DISABLE 0x0010 /* 1=CLK125 low, + * 0=CLK125 toggling + */ +#define M88E1000_PSCR_MDI_MANUAL_MODE 0x0000 /* MDI Crossover Mode bits 6:5 */ + /* Manual MDI configuration */ +#define M88E1000_PSCR_MDIX_MANUAL_MODE 0x0020 /* Manual MDIX configuration */ +#define M88E1000_PSCR_AUTO_X_1000T 0x0040 /* 1000BASE-T: Auto crossover, + * 100BASE-TX/10BASE-T: + * MDI Mode + */ +#define M88E1000_PSCR_AUTO_X_MODE 0x0060 /* Auto crossover enabled + * all speeds. + */ +#define M88E1000_PSCR_10BT_EXT_DIST_ENABLE 0x0080 + /* 1=Enable Extended 10BASE-T distance + * (Lower 10BASE-T RX Threshold) + * 0=Normal 10BASE-T RX Threshold */ +#define M88E1000_PSCR_MII_5BIT_ENABLE 0x0100 + /* 1=5-Bit interface in 100BASE-TX + * 0=MII interface in 100BASE-TX */ +#define M88E1000_PSCR_SCRAMBLER_DISABLE 0x0200 /* 1=Scrambler disable */ +#define M88E1000_PSCR_FORCE_LINK_GOOD 0x0400 /* 1=Force link good */ +#define M88E1000_PSCR_ASSERT_CRS_ON_TX 0x0800 /* 1=Assert CRS on Transmit */ + +#define M88E1000_PSCR_POLARITY_REVERSAL_SHIFT 1 +#define M88E1000_PSCR_AUTO_X_MODE_SHIFT 5 +#define M88E1000_PSCR_10BT_EXT_DIST_ENABLE_SHIFT 7 + +/* M88E1000 PHY Specific Status Register */ +#define M88E1000_PSSR_JABBER 0x0001 /* 1=Jabber */ +#define M88E1000_PSSR_REV_POLARITY 0x0002 /* 1=Polarity reversed */ +#define M88E1000_PSSR_DOWNSHIFT 0x0020 /* 1=Downshifted */ +#define M88E1000_PSSR_MDIX 0x0040 /* 1=MDIX; 0=MDI */ +#define M88E1000_PSSR_CABLE_LENGTH 0x0380 /* 0=<50M;1=50-80M;2=80-110M; + * 3=110-140M;4=>140M */ +#define M88E1000_PSSR_LINK 0x0400 /* 1=Link up, 0=Link down */ +#define M88E1000_PSSR_SPD_DPLX_RESOLVED 0x0800 /* 1=Speed & Duplex resolved */ +#define M88E1000_PSSR_PAGE_RCVD 0x1000 /* 1=Page received */ +#define M88E1000_PSSR_DPLX 0x2000 /* 1=Duplex 0=Half Duplex */ +#define M88E1000_PSSR_SPEED 0xC000 /* Speed, bits 14:15 */ +#define M88E1000_PSSR_10MBS 0x0000 /* 00=10Mbs */ +#define M88E1000_PSSR_100MBS 0x4000 /* 01=100Mbs */ +#define M88E1000_PSSR_1000MBS 0x8000 /* 10=1000Mbs */ + +#define M88E1000_PSSR_REV_POLARITY_SHIFT 1 +#define M88E1000_PSSR_DOWNSHIFT_SHIFT 5 +#define M88E1000_PSSR_MDIX_SHIFT 6 +#define M88E1000_PSSR_CABLE_LENGTH_SHIFT 7 + +/* M88E1000 Extended PHY Specific Control Register */ +#define M88E1000_EPSCR_FIBER_LOOPBACK 0x4000 /* 1=Fiber loopback */ +#define M88E1000_EPSCR_DOWN_NO_IDLE 0x8000 /* 1=Lost lock detect enabled. + * Will assert lost lock and bring + * link down if idle not seen + * within 1ms in 1000BASE-T + */ +/* Number of times we will attempt to autonegotiate before downshifting if we + * are the master */ +#define M88E1000_EPSCR_MASTER_DOWNSHIFT_MASK 0x0C00 +#define M88E1000_EPSCR_MASTER_DOWNSHIFT_1X 0x0000 +#define M88E1000_EPSCR_MASTER_DOWNSHIFT_2X 0x0400 +#define M88E1000_EPSCR_MASTER_DOWNSHIFT_3X 0x0800 +#define M88E1000_EPSCR_MASTER_DOWNSHIFT_4X 0x0C00 +/* Number of times we will attempt to autonegotiate before downshifting if we + * are the slave */ +#define M88E1000_EPSCR_SLAVE_DOWNSHIFT_MASK 0x0300 +#define M88E1000_EPSCR_SLAVE_DOWNSHIFT_DIS 0x0000 +#define M88E1000_EPSCR_SLAVE_DOWNSHIFT_1X 0x0100 +#define M88E1000_EPSCR_SLAVE_DOWNSHIFT_2X 0x0200 +#define M88E1000_EPSCR_SLAVE_DOWNSHIFT_3X 0x0300 +#define M88E1000_EPSCR_TX_CLK_2_5 0x0060 /* 2.5 MHz TX_CLK */ +#define M88E1000_EPSCR_TX_CLK_25 0x0070 /* 25 MHz TX_CLK */ +#define M88E1000_EPSCR_TX_CLK_0 0x0000 /* NO TX_CLK */ + +/* IGP01E1000 Specific Port Config Register - R/W */ +#define IGP01E1000_PSCFR_AUTO_MDIX_PAR_DETECT 0x0010 +#define IGP01E1000_PSCFR_PRE_EN 0x0020 +#define IGP01E1000_PSCFR_SMART_SPEED 0x0080 +#define IGP01E1000_PSCFR_DISABLE_TPLOOPBACK 0x0100 +#define IGP01E1000_PSCFR_DISABLE_JABBER 0x0400 +#define IGP01E1000_PSCFR_DISABLE_TRANSMIT 0x2000 + +/* IGP01E1000 Specific Port Status Register - R/O */ +#define IGP01E1000_PSSR_AUTONEG_FAILED 0x0001 /* RO LH SC */ +#define IGP01E1000_PSSR_POLARITY_REVERSED 0x0002 +#define IGP01E1000_PSSR_CABLE_LENGTH 0x007C +#define IGP01E1000_PSSR_FULL_DUPLEX 0x0200 +#define IGP01E1000_PSSR_LINK_UP 0x0400 +#define IGP01E1000_PSSR_MDIX 0x0800 +#define IGP01E1000_PSSR_SPEED_MASK 0xC000 /* speed bits mask */ +#define IGP01E1000_PSSR_SPEED_10MBPS 0x4000 +#define IGP01E1000_PSSR_SPEED_100MBPS 0x8000 +#define IGP01E1000_PSSR_SPEED_1000MBPS 0xC000 +#define IGP01E1000_PSSR_CABLE_LENGTH_SHIFT 0x0002 /* shift right 2 */ +#define IGP01E1000_PSSR_MDIX_SHIFT 0x000B /* shift right 11 */ + +/* IGP01E1000 Specific Port Control Register - R/W */ +#define IGP01E1000_PSCR_TP_LOOPBACK 0x0001 +#define IGP01E1000_PSCR_CORRECT_NC_SCMBLR 0x0200 +#define IGP01E1000_PSCR_TEN_CRS_SELECT 0x0400 +#define IGP01E1000_PSCR_FLIP_CHIP 0x0800 +#define IGP01E1000_PSCR_AUTO_MDIX 0x1000 +#define IGP01E1000_PSCR_FORCE_MDI_MDIX 0x2000 /* 0-MDI, 1-MDIX */ + +/* IGP01E1000 Specific Port Link Health Register */ +#define IGP01E1000_PLHR_SS_DOWNGRADE 0x8000 +#define IGP01E1000_PLHR_GIG_SCRAMBLER_ERROR 0x4000 +#define IGP01E1000_PLHR_GIG_REM_RCVR_NOK 0x0800 /* LH */ +#define IGP01E1000_PLHR_IDLE_ERROR_CNT_OFLOW 0x0400 /* LH */ +#define IGP01E1000_PLHR_DATA_ERR_1 0x0200 /* LH */ +#define IGP01E1000_PLHR_DATA_ERR_0 0x0100 +#define IGP01E1000_PLHR_AUTONEG_FAULT 0x0010 +#define IGP01E1000_PLHR_AUTONEG_ACTIVE 0x0008 +#define IGP01E1000_PLHR_VALID_CHANNEL_D 0x0004 +#define IGP01E1000_PLHR_VALID_CHANNEL_C 0x0002 +#define IGP01E1000_PLHR_VALID_CHANNEL_B 0x0001 +#define IGP01E1000_PLHR_VALID_CHANNEL_A 0x0000 + +/* IGP01E1000 Channel Quality Register */ +#define IGP01E1000_MSE_CHANNEL_D 0x000F +#define IGP01E1000_MSE_CHANNEL_C 0x00F0 +#define IGP01E1000_MSE_CHANNEL_B 0x0F00 +#define IGP01E1000_MSE_CHANNEL_A 0xF000 + +/* IGP01E1000 DSP reset macros */ +#define DSP_RESET_ENABLE 0x0 +#define DSP_RESET_DISABLE 0x2 +#define E1000_MAX_DSP_RESETS 10 + +/* IGP01E1000 AGC Registers */ + +#define IGP01E1000_AGC_LENGTH_SHIFT 7 /* Coarse - 13:11, Fine - 10:7 */ + +/* 7 bits (3 Coarse + 4 Fine) --> 128 optional values */ +#define IGP01E1000_AGC_LENGTH_TABLE_SIZE 128 + +/* The precision of the length is +/- 10 meters */ +#define IGP01E1000_AGC_RANGE 10 + +/* IGP01E1000 PCS Initialization register */ +/* bits 3:6 in the PCS registers stores the channels polarity */ +#define IGP01E1000_PHY_POLARITY_MASK 0x0078 + +/* IGP01E1000 GMII FIFO Register */ +#define IGP01E1000_GMII_FLEX_SPD 0x10 /* Enable flexible speed + * on Link-Up */ +#define IGP01E1000_GMII_SPD 0x20 /* Enable SPD */ + +/* IGP01E1000 Analog Register */ +#define IGP01E1000_ANALOG_SPARE_FUSE_STATUS 0x20D1 +#define IGP01E1000_ANALOG_FUSE_STATUS 0x20D0 +#define IGP01E1000_ANALOG_FUSE_CONTROL 0x20DC +#define IGP01E1000_ANALOG_FUSE_BYPASS 0x20DE + +#define IGP01E1000_ANALOG_FUSE_POLY_MASK 0xF000 +#define IGP01E1000_ANALOG_FUSE_FINE_MASK 0x0F80 +#define IGP01E1000_ANALOG_FUSE_COARSE_MASK 0x0070 +#define IGP01E1000_ANALOG_SPARE_FUSE_ENABLED 0x0100 +#define IGP01E1000_ANALOG_FUSE_ENABLE_SW_CONTROL 0x0002 + +#define IGP01E1000_ANALOG_FUSE_COARSE_THRESH 0x0040 +#define IGP01E1000_ANALOG_FUSE_COARSE_10 0x0010 +#define IGP01E1000_ANALOG_FUSE_FINE_1 0x0080 +#define IGP01E1000_ANALOG_FUSE_FINE_10 0x0500 + +/* Bit definitions for valid PHY IDs. */ +#define M88E1000_E_PHY_ID 0x01410C50 +#define M88E1000_I_PHY_ID 0x01410C30 +#define M88E1011_I_PHY_ID 0x01410C20 +#define IGP01E1000_I_PHY_ID 0x02A80380 +#define M88E1000_12_PHY_ID M88E1000_E_PHY_ID +#define M88E1000_14_PHY_ID M88E1000_E_PHY_ID +#define M88E1011_I_REV_4 0x04 + +/* Miscellaneous PHY bit definitions. */ +#define PHY_PREAMBLE 0xFFFFFFFF +#define PHY_SOF 0x01 +#define PHY_OP_READ 0x02 +#define PHY_OP_WRITE 0x01 +#define PHY_TURNAROUND 0x02 +#define PHY_PREAMBLE_SIZE 32 +#define MII_CR_SPEED_1000 0x0040 +#define MII_CR_SPEED_100 0x2000 +#define MII_CR_SPEED_10 0x0000 +#define E1000_PHY_ADDRESS 0x01 +#define PHY_AUTO_NEG_TIME 45 /* 4.5 Seconds */ +#define PHY_FORCE_TIME 20 /* 2.0 Seconds */ +#define PHY_REVISION_MASK 0xFFFFFFF0 +#define DEVICE_SPEED_MASK 0x00000300 /* Device Ctrl Reg Speed Mask */ +#define REG4_SPEED_MASK 0x01E0 +#define REG9_SPEED_MASK 0x0300 +#define ADVERTISE_10_HALF 0x0001 +#define ADVERTISE_10_FULL 0x0002 +#define ADVERTISE_100_HALF 0x0004 +#define ADVERTISE_100_FULL 0x0008 +#define ADVERTISE_1000_HALF 0x0010 +#define ADVERTISE_1000_FULL 0x0020 +#define AUTONEG_ADVERTISE_SPEED_DEFAULT 0x002F /* Everything but 1000-Half */ +#define AUTONEG_ADVERTISE_10_100_ALL 0x000F /* All 10/100 speeds*/ +#define AUTONEG_ADVERTISE_10_ALL 0x0003 /* 10Mbps Full & Half speeds*/ + +#endif /* _E1000_HW_H_ */ diff --git a/usr/src/grub/grub-0.97/netboot/eepro100.c b/usr/src/grub/grub-0.97/netboot/eepro100.c new file mode 100644 index 0000000000..4aeeff97e2 --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/eepro100.c @@ -0,0 +1,809 @@ +/* + * eepro100.c -- This file implements the eepro100 driver for etherboot. + * + * + * Copyright (C) AW Computer Systems. + * written by R.E.Wolff -- R.E.Wolff@BitWizard.nl + * + * + * AW Computer Systems is contributing to the free software community + * by paying for this driver and then putting the result under GPL. + * + * If you need a Linux device driver, please contact BitWizard for a + * quote. + * + * + * 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. + * + * 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. + * + * + * date version by what + * Written: May 29 1997 V0.10 REW Initial revision. + * changes: May 31 1997 V0.90 REW Works! + * Jun 1 1997 V0.91 REW Cleanup + * Jun 2 1997 V0.92 REW Add some code documentation + * Jul 25 1997 V1.00 REW Tested by AW to work in a PROM + * Cleanup for publication + * + * This is the etherboot intel etherexpress Pro/100B driver. + * + * It was written from scratch, with Donald Beckers eepro100.c kernel + * driver as a guideline. Mostly the 82557 related definitions and the + * lower level routines have been cut-and-pasted into this source. + * + * The driver was finished before Intel got the NDA out of the closet. + * I still don't have the docs. + * */ + +/* Philosophy of this driver. + * + * Probing: + * + * Using the pci.c functions of the Etherboot code, the 82557 chip is detected. + * It is verified that the BIOS initialized everything properly and if + * something is missing it is done now. + * + * + * Initialization: + * + * + * The chip is then initialized to "know" its ethernet address, and to + * start recieving packets. The Linux driver has a whole transmit and + * recieve ring of buffers. This is neat if you need high performance: + * you can write the buffers asynchronously to the chip reading the + * buffers and transmitting them over the network. Performance is NOT + * an issue here. We can boot a 400k kernel in about two + * seconds. (Theory: 0.4 seconds). Booting a system is going to take + * about half a minute anyway, so getting 10 times closer to the + * theoretical limit is going to make a difference of a few percent. + * + * + * Transmitting and recieving. + * + * We have only one transmit descriptor. It has two buffer descriptors: + * one for the header, and the other for the data. + * We have only one receive buffer. The chip is told to recieve packets, + * and suspend itself once it got one. The recieve (poll) routine simply + * looks at the recieve buffer to see if there is already a packet there. + * if there is, the buffer is copied, and the reciever is restarted. + * + * Caveats: + * + * The Etherboot framework moves the code to the 48k segment from + * 0x94000 to 0xa0000. There is just a little room between the end of + * this driver and the 0xa0000 address. If you compile in too many + * features, this will overflow. + * The number under "hex" in the output of size that scrolls by while + * compiling should be less than 8000. Maybe even the stack is up there, + * so that you need even more headroom. + */ + +/* The etherboot authors seem to dislike the argument ordering in + * outb macros that Linux uses. I disklike the confusion that this + * has caused even more.... This file uses the Linux argument ordering. */ +/* Sorry not us. It's inherited code from FreeBSD. [The authors] */ + +#include "etherboot.h" +#include "nic.h" +#include "pci.h" +#include "timer.h" + +static int ioaddr; + +typedef unsigned char u8; +typedef signed char s8; +typedef unsigned short u16; +typedef signed short s16; +typedef unsigned int u32; +typedef signed int s32; + +enum speedo_offsets { + SCBStatus = 0, SCBCmd = 2, /* Rx/Command Unit command and status. */ + SCBPointer = 4, /* General purpose pointer. */ + SCBPort = 8, /* Misc. commands and operands. */ + SCBflash = 12, SCBeeprom = 14, /* EEPROM and flash memory control. */ + SCBCtrlMDI = 16, /* MDI interface control. */ + SCBEarlyRx = 20, /* Early receive byte count. */ +}; + +enum SCBCmdBits { + SCBMaskCmdDone=0x8000, SCBMaskRxDone=0x4000, SCBMaskCmdIdle=0x2000, + SCBMaskRxSuspend=0x1000, SCBMaskEarlyRx=0x0800, SCBMaskFlowCtl=0x0400, + SCBTriggerIntr=0x0200, SCBMaskAll=0x0100, + /* The rest are Rx and Tx commands. */ + CUStart=0x0010, CUResume=0x0020, CUStatsAddr=0x0040, CUShowStats=0x0050, + CUCmdBase=0x0060, /* CU Base address (set to zero) . */ + CUDumpStats=0x0070, /* Dump then reset stats counters. */ + RxStart=0x0001, RxResume=0x0002, RxAbort=0x0004, RxAddrLoad=0x0006, + RxResumeNoResources=0x0007, +}; + +static int do_eeprom_cmd(int cmd, int cmd_len); +void hd(void *where, int n); + +/***********************************************************************/ +/* I82557 related defines */ +/***********************************************************************/ + +/* Serial EEPROM section. + A "bit" grungy, but we work our way through bit-by-bit :->. */ +/* EEPROM_Ctrl bits. */ +#define EE_SHIFT_CLK 0x01 /* EEPROM shift clock. */ +#define EE_CS 0x02 /* EEPROM chip select. */ +#define EE_DATA_WRITE 0x04 /* EEPROM chip data in. */ +#define EE_DATA_READ 0x08 /* EEPROM chip data out. */ +#define EE_WRITE_0 0x4802 +#define EE_WRITE_1 0x4806 +#define EE_ENB (0x4800 | EE_CS) + +/* The EEPROM commands include the alway-set leading bit. */ +#define EE_READ_CMD 6 + +/* The SCB accepts the following controls for the Tx and Rx units: */ +#define CU_START 0x0010 +#define CU_RESUME 0x0020 +#define CU_STATSADDR 0x0040 +#define CU_SHOWSTATS 0x0050 /* Dump statistics counters. */ +#define CU_CMD_BASE 0x0060 /* Base address to add to add CU commands. */ +#define CU_DUMPSTATS 0x0070 /* Dump then reset stats counters. */ + +#define RX_START 0x0001 +#define RX_RESUME 0x0002 +#define RX_ABORT 0x0004 +#define RX_ADDR_LOAD 0x0006 +#define RX_RESUMENR 0x0007 +#define INT_MASK 0x0100 +#define DRVR_INT 0x0200 /* Driver generated interrupt. */ + +enum phy_chips { NonSuchPhy=0, I82553AB, I82553C, I82503, DP83840, S80C240, + S80C24, PhyUndefined, DP83840A=10, }; + +/* Commands that can be put in a command list entry. */ +enum commands { + CmdNOp = 0, + CmdIASetup = 1, + CmdConfigure = 2, + CmdMulticastList = 3, + CmdTx = 4, + CmdTDR = 5, + CmdDump = 6, + CmdDiagnose = 7, + + /* And some extra flags: */ + CmdSuspend = 0x4000, /* Suspend after completion. */ + CmdIntr = 0x2000, /* Interrupt after completion. */ + CmdTxFlex = 0x0008, /* Use "Flexible mode" for CmdTx command. */ +}; + +/* How to wait for the command unit to accept a command. + Typically this takes 0 ticks. */ +static inline void wait_for_cmd_done(int cmd_ioaddr) +{ + int wait = 0; + int delayed_cmd; + + do + if (inb(cmd_ioaddr) == 0) return; + while(++wait <= 100); + delayed_cmd = inb(cmd_ioaddr); + do + if (inb(cmd_ioaddr) == 0) break; + while(++wait <= 10000); + printf("Command %2.2x was not immediately accepted, %d ticks!\n", + delayed_cmd, wait); +} + +/* Elements of the dump_statistics block. This block must be lword aligned. */ +static struct speedo_stats { + u32 tx_good_frames; + u32 tx_coll16_errs; + u32 tx_late_colls; + u32 tx_underruns; + u32 tx_lost_carrier; + u32 tx_deferred; + u32 tx_one_colls; + u32 tx_multi_colls; + u32 tx_total_colls; + u32 rx_good_frames; + u32 rx_crc_errs; + u32 rx_align_errs; + u32 rx_resource_errs; + u32 rx_overrun_errs; + u32 rx_colls_errs; + u32 rx_runt_errs; + u32 done_marker; +} lstats; + +/* A speedo3 TX buffer descriptor with two buffers... */ +static struct TxFD { + volatile s16 status; + s16 command; + u32 link; /* void * */ + u32 tx_desc_addr; /* (almost) Always points to the tx_buf_addr element. */ + s32 count; /* # of TBD (=2), Tx start thresh., etc. */ + /* This constitutes two "TBD" entries: hdr and data */ + u32 tx_buf_addr0; /* void *, header of frame to be transmitted. */ + s32 tx_buf_size0; /* Length of Tx hdr. */ + u32 tx_buf_addr1; /* void *, data to be transmitted. */ + s32 tx_buf_size1; /* Length of Tx data. */ +} txfd; + +struct RxFD { /* Receive frame descriptor. */ + volatile s16 status; + s16 command; + u32 link; /* struct RxFD * */ + u32 rx_buf_addr; /* void * */ + u16 count; + u16 size; + char packet[1518]; +}; + +static struct RxFD rxfd; +#define ACCESS(x) x. + +static int congenb = 0; /* Enable congestion control in the DP83840. */ +static int txfifo = 8; /* Tx FIFO threshold in 4 byte units, 0-15 */ +static int rxfifo = 8; /* Rx FIFO threshold, default 32 bytes. */ +static int txdmacount = 0; /* Tx DMA burst length, 0-127, default 0. */ +static int rxdmacount = 0; /* Rx DMA length, 0 means no preemption. */ + +/* I don't understand a byte in this structure. It was copied from the + * Linux kernel initialization for the eepro100. -- REW */ +static struct ConfCmd { + s16 status; + s16 command; + u32 link; + unsigned char data[22]; +} confcmd = { + 0, 0, 0, /* filled in later */ + {22, 0x08, 0, 0, 0, 0x80, 0x32, 0x03, 1, /* 1=Use MII 0=Use AUI */ + 0, 0x2E, 0, 0x60, 0, + 0xf2, 0x48, 0, 0x40, 0xf2, 0x80, /* 0x40=Force full-duplex */ + 0x3f, 0x05, } +}; + +/***********************************************************************/ +/* Locally used functions */ +/***********************************************************************/ + +/* Support function: mdio_write + * + * This probably writes to the "physical media interface chip". + * -- REW + */ + +static int mdio_write(int phy_id, int location, int value) +{ + int val, boguscnt = 64*4; /* <64 usec. to complete, typ 27 ticks */ + + outl(0x04000000 | (location<<16) | (phy_id<<21) | value, + ioaddr + SCBCtrlMDI); + do { + udelay(16); + + val = inl(ioaddr + SCBCtrlMDI); + if (--boguscnt < 0) { + printf(" mdio_write() timed out with val = %X.\n", val); + break; + } + } while (! (val & 0x10000000)); + return val & 0xffff; +} + +/* Support function: mdio_read + * + * This probably reads a register in the "physical media interface chip". + * -- REW + */ +static int mdio_read(int phy_id, int location) +{ + int val, boguscnt = 64*4; /* <64 usec. to complete, typ 27 ticks */ + outl(0x08000000 | (location<<16) | (phy_id<<21), ioaddr + SCBCtrlMDI); + do { + udelay(16); + + val = inl(ioaddr + SCBCtrlMDI); + + if (--boguscnt < 0) { + printf( " mdio_read() timed out with val = %X.\n", val); + break; + } + } while (! (val & 0x10000000)); + return val & 0xffff; +} + +/* The fixes for the code were kindly provided by Dragan Stancevic + to strictly follow Intel specifications of EEPROM + access timing. + The publicly available sheet 64486302 (sec. 3.1) specifies 1us access + interval for serial EEPROM. However, it looks like that there is an + additional requirement dictating larger udelay's in the code below. + 2000/05/24 SAW */ +static int do_eeprom_cmd(int cmd, int cmd_len) +{ + unsigned retval = 0; + long ee_addr = ioaddr + SCBeeprom; + + outw(EE_ENB, ee_addr); udelay(2); + outw(EE_ENB | EE_SHIFT_CLK, ee_addr); udelay(2); + + /* Shift the command bits out. */ + do { + short dataval = (cmd & (1 << cmd_len)) ? EE_WRITE_1 : EE_WRITE_0; + outw(dataval, ee_addr); udelay(2); + outw(dataval | EE_SHIFT_CLK, ee_addr); udelay(2); + retval = (retval << 1) | ((inw(ee_addr) & EE_DATA_READ) ? 1 : 0); + } while (--cmd_len >= 0); + outw(EE_ENB, ee_addr); udelay(2); + + /* Terminate the EEPROM access. */ + outw(EE_ENB & ~EE_CS, ee_addr); + return retval; +} + +#if 0 +static inline void whereami (const char *str) +{ + printf ("%s\n", str); + sleep (2); +} +#else +#define whereami(s) +#endif + +static void eepro100_irq(struct nic *nic __unused, irq_action_t action __unused) +{ + switch ( action ) { + case DISABLE : + break; + case ENABLE : + break; + case FORCE : + break; + } +} + +/* function: eepro100_transmit + * This transmits a packet. + * + * Arguments: char d[6]: destination ethernet address. + * unsigned short t: ethernet protocol type. + * unsigned short s: size of the data-part of the packet. + * char *p: the data for the packet. + * returns: void. + */ + +static void eepro100_transmit(struct nic *nic, const char *d, unsigned int t, unsigned int s, const char *p) +{ + struct eth_hdr { + unsigned char dst_addr[ETH_ALEN]; + unsigned char src_addr[ETH_ALEN]; + unsigned short type; + } hdr; + unsigned short status; + int s1, s2; + + status = inw(ioaddr + SCBStatus); + /* Acknowledge all of the current interrupt sources ASAP. */ + outw(status & 0xfc00, ioaddr + SCBStatus); + +#ifdef DEBUG + printf ("transmitting type %hX packet (%d bytes). status = %hX, cmd=%hX\n", + t, s, status, inw (ioaddr + SCBCmd)); +#endif + + memcpy (&hdr.dst_addr, d, ETH_ALEN); + memcpy (&hdr.src_addr, nic->node_addr, ETH_ALEN); + + hdr.type = htons (t); + + txfd.status = 0; + txfd.command = CmdSuspend | CmdTx | CmdTxFlex; + txfd.link = virt_to_bus (&txfd); + txfd.count = 0x02208000; + txfd.tx_desc_addr = virt_to_bus(&txfd.tx_buf_addr0); + + txfd.tx_buf_addr0 = virt_to_bus (&hdr); + txfd.tx_buf_size0 = sizeof (hdr); + + txfd.tx_buf_addr1 = virt_to_bus (p); + txfd.tx_buf_size1 = s; + +#ifdef DEBUG + printf ("txfd: \n"); + hd (&txfd, sizeof (txfd)); +#endif + + outl(virt_to_bus(&txfd), ioaddr + SCBPointer); + outw(INT_MASK | CU_START, ioaddr + SCBCmd); + wait_for_cmd_done(ioaddr + SCBCmd); + + s1 = inw (ioaddr + SCBStatus); + load_timer2(10*TICKS_PER_MS); /* timeout 10 ms for transmit */ + while (!txfd.status && timer2_running()) + /* Wait */; + s2 = inw (ioaddr + SCBStatus); + +#ifdef DEBUG + printf ("s1 = %hX, s2 = %hX.\n", s1, s2); +#endif +} + +/* + * Sometimes the receiver stops making progress. This routine knows how to + * get it going again, without losing packets or being otherwise nasty like + * a chip reset would be. Previously the driver had a whole sequence + * of if RxSuspended, if it's no buffers do one thing, if it's no resources, + * do another, etc. But those things don't really matter. Separate logic + * in the ISR provides for allocating buffers--the other half of operation + * is just making sure the receiver is active. speedo_rx_soft_reset does that. + * This problem with the old, more involved algorithm is shown up under + * ping floods on the order of 60K packets/second on a 100Mbps fdx network. + */ +static void +speedo_rx_soft_reset(void) +{ + wait_for_cmd_done(ioaddr + SCBCmd); + /* + * Put the hardware into a known state. + */ + outb(RX_ABORT, ioaddr + SCBCmd); + + ACCESS(rxfd)rx_buf_addr = 0xffffffff; + + wait_for_cmd_done(ioaddr + SCBCmd); + + outb(RX_START, ioaddr + SCBCmd); +} + +/* function: eepro100_poll / eth_poll + * This recieves a packet from the network. + * + * Arguments: none + * + * returns: 1 if a packet was recieved. + * 0 if no pacet was recieved. + * side effects: + * returns the packet in the array nic->packet. + * returns the length of the packet in nic->packetlen. + */ + +static int eepro100_poll(struct nic *nic, int retrieve) +{ + unsigned int status; + status = inw(ioaddr + SCBStatus); + + if (!ACCESS(rxfd)status) + return 0; + + /* There is a packet ready */ + if ( ! retrieve ) return 1; + + /* + * The chip may have suspended reception for various reasons. + * Check for that, and re-prime it should this be the case. + */ + switch ((status >> 2) & 0xf) { + case 0: /* Idle */ + break; + case 1: /* Suspended */ + case 2: /* No resources (RxFDs) */ + case 9: /* Suspended with no more RBDs */ + case 10: /* No resources due to no RBDs */ + case 12: /* Ready with no RBDs */ + speedo_rx_soft_reset(); + break; + case 3: case 5: case 6: case 7: case 8: + case 11: case 13: case 14: case 15: + /* these are all reserved values */ + break; + } + + /* Ok. We got a packet. Now restart the reciever.... */ + ACCESS(rxfd)status = 0; + ACCESS(rxfd)command = 0xc000; + outl(virt_to_bus(&(ACCESS(rxfd)status)), ioaddr + SCBPointer); + outw(INT_MASK | RX_START, ioaddr + SCBCmd); + wait_for_cmd_done(ioaddr + SCBCmd); + +#ifdef DEBUG + printf ("Got a packet: Len = %d.\n", ACCESS(rxfd)count & 0x3fff); +#endif + nic->packetlen = ACCESS(rxfd)count & 0x3fff; + memcpy (nic->packet, ACCESS(rxfd)packet, nic->packetlen); +#ifdef DEBUG + hd (nic->packet, 0x30); +#endif + return 1; +} + +/* function: eepro100_disable + * resets the card. This is used to allow Etherboot or Linux + * to probe the card again from a "virginal" state.... + * Arguments: none + * + * returns: void. + */ +static void eepro100_disable(struct dev *dev __unused) +{ +/* from eepro100_reset */ + outl(0, ioaddr + SCBPort); +/* from eepro100_disable */ + /* See if this PartialReset solves the problem with interfering with + kernel operation after Etherboot hands over. - Ken 20001102 */ + outl(2, ioaddr + SCBPort); + + /* The following is from the Intel e100 driver. + * This hopefully solves the problem with hanging hard DOS images. */ + + /* wait for the reset to take effect */ + udelay(20); + + /* Mask off our interrupt line -- it is unmasked after reset */ + { + u16 intr_status; + /* Disable interrupts on our PCI board by setting the mask bit */ + outw(INT_MASK, ioaddr + SCBCmd); + intr_status = inw(ioaddr + SCBStatus); + /* ack and clear intrs */ + outw(intr_status, ioaddr + SCBStatus); + inw(ioaddr + SCBStatus); + } +} + +/* exported function: eepro100_probe / eth_probe + * initializes a card + * + * side effects: + * leaves the ioaddress of the 82557 chip in the variable ioaddr. + * leaves the 82557 initialized, and ready to recieve packets. + */ + +static int eepro100_probe(struct dev *dev, struct pci_device *p) +{ + struct nic *nic = (struct nic *)dev; + unsigned short sum = 0; + int i; + int read_cmd, ee_size; + int options; + int rx_mode; + + /* we cache only the first few words of the EEPROM data + be careful not to access beyond this array */ + unsigned short eeprom[16]; + + if (p->ioaddr == 0) + return 0; + ioaddr = p->ioaddr & ~3; /* Mask the bit that says "this is an io addr" */ + nic->ioaddr = ioaddr; + + adjust_pci_device(p); + + /* Copy IRQ from PCI information */ + /* nic->irqno = pci->irq; */ + nic->irqno = 0; + + if ((do_eeprom_cmd(EE_READ_CMD << 24, 27) & 0xffe0000) + == 0xffe0000) { + ee_size = 0x100; + read_cmd = EE_READ_CMD << 24; + } else { + ee_size = 0x40; + read_cmd = EE_READ_CMD << 22; + } + + for (i = 0, sum = 0; i < ee_size; i++) { + unsigned short value = do_eeprom_cmd(read_cmd | (i << 16), 27); + if (i < (int)(sizeof(eeprom)/sizeof(eeprom[0]))) + eeprom[i] = value; + sum += value; + } + + for (i=0;inode_addr[i] = (eeprom[i/2] >> (8*(i&1))) & 0xff; + } + printf ("Ethernet addr: %!\n", nic->node_addr); + + if (sum != 0xBABA) + printf("eepro100: Invalid EEPROM checksum %#hX, " + "check settings before activating this device!\n", sum); + outl(0, ioaddr + SCBPort); + udelay (10000); + whereami ("Got eeprom."); + + /* Base = 0 */ + outl(0, ioaddr + SCBPointer); + outw(INT_MASK | RX_ADDR_LOAD, ioaddr + SCBCmd); + wait_for_cmd_done(ioaddr + SCBCmd); + whereami ("set rx base addr."); + + outl(virt_to_bus(&lstats), ioaddr + SCBPointer); + outw(INT_MASK | CU_STATSADDR, ioaddr + SCBCmd); + wait_for_cmd_done(ioaddr + SCBCmd); + whereami ("set stats addr."); + + /* INIT RX stuff. */ + ACCESS(rxfd)status = 0x0001; + ACCESS(rxfd)command = 0x0000; + ACCESS(rxfd)link = virt_to_bus(&(ACCESS(rxfd)status)); + ACCESS(rxfd)rx_buf_addr = virt_to_bus(&nic->packet); + ACCESS(rxfd)count = 0; + ACCESS(rxfd)size = 1528; + + outl(virt_to_bus(&(ACCESS(rxfd)status)), ioaddr + SCBPointer); + outw(INT_MASK | RX_START, ioaddr + SCBCmd); + wait_for_cmd_done(ioaddr + SCBCmd); + + whereami ("started RX process."); + + /* Start the reciever.... */ + ACCESS(rxfd)status = 0; + ACCESS(rxfd)command = 0xc000; + outl(virt_to_bus(&(ACCESS(rxfd)status)), ioaddr + SCBPointer); + outw(INT_MASK | RX_START, ioaddr + SCBCmd); + + /* INIT TX stuff. */ + + /* Base = 0 */ + outl(0, ioaddr + SCBPointer); + outw(INT_MASK | CU_CMD_BASE, ioaddr + SCBCmd); + wait_for_cmd_done(ioaddr + SCBCmd); + + whereami ("set TX base addr."); + + txfd.command = (CmdIASetup); + txfd.status = 0x0000; + txfd.link = virt_to_bus (&confcmd); + + { + char *t = (char *)&txfd.tx_desc_addr; + + for (i=0;inode_addr[i]; + } + +#ifdef DEBUG + printf ("Setup_eaddr:\n"); + hd (&txfd, 0x20); +#endif + /* options = 0x40; */ /* 10mbps half duplex... */ + options = 0x00; /* Autosense */ + +#ifdef PROMISC + rx_mode = 3; +#elif ALLMULTI + rx_mode = 1; +#else + rx_mode = 0; +#endif + + if ( ((eeprom[6]>>8) & 0x3f) == DP83840 + || ((eeprom[6]>>8) & 0x3f) == DP83840A) { + int mdi_reg23 = mdio_read(eeprom[6] & 0x1f, 23) | 0x0422; + if (congenb) + mdi_reg23 |= 0x0100; + printf(" DP83840 specific setup, setting register 23 to %hX.\n", + mdi_reg23); + mdio_write(eeprom[6] & 0x1f, 23, mdi_reg23); + } + whereami ("Done DP8340 special setup."); + if (options != 0) { + mdio_write(eeprom[6] & 0x1f, 0, + ((options & 0x20) ? 0x2000 : 0) | /* 100mbps? */ + ((options & 0x10) ? 0x0100 : 0)); /* Full duplex? */ + whereami ("set mdio_register."); + } + + confcmd.command = CmdSuspend | CmdConfigure; + confcmd.status = 0x0000; + confcmd.link = virt_to_bus (&txfd); + confcmd.data[1] = (txfifo << 4) | rxfifo; + confcmd.data[4] = rxdmacount; + confcmd.data[5] = txdmacount + 0x80; + confcmd.data[15] = (rx_mode & 2) ? 0x49: 0x48; + confcmd.data[19] = (options & 0x10) ? 0xC0 : 0x80; + confcmd.data[21] = (rx_mode & 1) ? 0x0D: 0x05; + + outl(virt_to_bus(&txfd), ioaddr + SCBPointer); + outw(INT_MASK | CU_START, ioaddr + SCBCmd); + wait_for_cmd_done(ioaddr + SCBCmd); + + whereami ("started TX thingy (config, iasetup)."); + + load_timer2(10*TICKS_PER_MS); + while (!txfd.status && timer2_running()) + /* Wait */; + + /* Read the status register once to disgard stale data */ + mdio_read(eeprom[6] & 0x1f, 1); + /* Check to see if the network cable is plugged in. + * This allows for faster failure if there is nothing + * we can do. + */ + if (!(mdio_read(eeprom[6] & 0x1f, 1) & (1 << 2))) { + printf("Valid link not established\n"); + eepro100_disable(dev); + return 0; + } + + dev->disable = eepro100_disable; + nic->poll = eepro100_poll; + nic->transmit = eepro100_transmit; + nic->irq = eepro100_irq; + return 1; +} + +/*********************************************************************/ + +#ifdef DEBUG + +/* Hexdump a number of bytes from memory... */ +void hd (void *where, int n) +{ + int i; + + while (n > 0) { + printf ("%X ", where); + for (i=0;i < ( (n>16)?16:n);i++) + printf (" %hhX", ((char *)where)[i]); + printf ("\n"); + n -= 16; + where += 16; + } +} +#endif + +static struct pci_id eepro100_nics[] = { +PCI_ROM(0x8086, 0x1029, "id1029", "Intel EtherExpressPro100 ID1029"), +PCI_ROM(0x8086, 0x1030, "id1030", "Intel EtherExpressPro100 ID1030"), +PCI_ROM(0x8086, 0x1031, "82801cam", "Intel 82801CAM (ICH3) Chipset Ethernet Controller"), +PCI_ROM(0x8086, 0x1032, "eepro100-1032", "Intel PRO/100 VE Network Connection"), +PCI_ROM(0x8086, 0x1033, "eepro100-1033", "Intel PRO/100 VM Network Connection"), +PCI_ROM(0x8086, 0x1034, "eepro100-1034", "Intel PRO/100 VM Network Connection"), +PCI_ROM(0x8086, 0x1035, "eepro100-1035", "Intel 82801CAM (ICH3) Chipset Ethernet Controller"), +PCI_ROM(0x8086, 0x1036, "eepro100-1036", "Intel 82801CAM (ICH3) Chipset Ethernet Controller"), +PCI_ROM(0x8086, 0x1037, "eepro100-1037", "Intel 82801CAM (ICH3) Chipset Ethernet Controller"), +PCI_ROM(0x8086, 0x1038, "id1038", "Intel PRO/100 VM Network Connection"), +PCI_ROM(0x8086, 0x1039, "82562et", "Intel PRO100 VE 82562ET"), +PCI_ROM(0x8086, 0x103a, "id103a", "Intel Corporation 82559 InBusiness 10/100"), +PCI_ROM(0x8086, 0x103b, "82562etb", "Intel PRO100 VE 82562ETB"), +PCI_ROM(0x8086, 0x103c, "eepro100-103c", "Intel PRO/100 VM Network Connection"), +PCI_ROM(0x8086, 0x103d, "eepro100-103d", "Intel PRO/100 VE Network Connection"), +PCI_ROM(0x8086, 0x103e, "eepro100-103e", "Intel PRO/100 VM Network Connection"), +PCI_ROM(0x8086, 0x1059, "82551qm", "Intel PRO/100 M Mobile Connection"), +PCI_ROM(0x8086, 0x1209, "82559er", "Intel EtherExpressPro100 82559ER"), +PCI_ROM(0x8086, 0x1227, "82865", "Intel 82865 EtherExpress PRO/100A"), +PCI_ROM(0x8086, 0x1228, "82556", "Intel 82556 EtherExpress PRO/100 Smart"), +PCI_ROM(0x8086, 0x1229, "eepro100", "Intel EtherExpressPro100"), +PCI_ROM(0x8086, 0x2449, "82562em", "Intel EtherExpressPro100 82562EM"), +PCI_ROM(0x8086, 0x2459, "82562-1", "Intel 82562 based Fast Ethernet Connection"), +PCI_ROM(0x8086, 0x245d, "82562-2", "Intel 82562 based Fast Ethernet Connection"), +PCI_ROM(0x8086, 0x1050, "82562ez", "Intel 82562EZ Network Connection"), +PCI_ROM(0x8086, 0x5200, "eepro100-5200", "Intel EtherExpress PRO/100 Intelligent Server"), +PCI_ROM(0x8086, 0x5201, "eepro100-5201", "Intel EtherExpress PRO/100 Intelligent Server"), +}; + +/* Cards with device ids 0x1030 to 0x103F, 0x2449, 0x2459 or 0x245D might need + * a workaround for hardware bug on 10 mbit half duplex (see linux driver eepro100.c) + * 2003/03/17 gbaum */ + + +struct pci_driver eepro100_driver = { + .type = NIC_DRIVER, + .name = "EEPRO100", + .probe = eepro100_probe, + .ids = eepro100_nics, + .id_count = sizeof(eepro100_nics)/sizeof(eepro100_nics[0]), + .class = 0 +}; diff --git a/usr/src/grub/grub-0.97/netboot/elf.h b/usr/src/grub/grub-0.97/netboot/elf.h new file mode 100644 index 0000000000..2eb08de151 --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/elf.h @@ -0,0 +1,234 @@ +#ifndef ELF_H +#define ELF_H + +#define EI_NIDENT 16 /* Size of e_ident array. */ + +/* Values for 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 */ + +/* Values for e_machine (architecute). */ +#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 /* Perhaps disused */ +#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_RCE 39 /* Motorola RCE */ +#define EM_ARM 40 /* ARM */ +#define EM_FAKE_ALPHA 41 /* Digital Alpha */ +#define EM_SH 42 /* Hitachi 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 /* Hitachi H8/300 */ +#define EM_H8_300H 47 /* Hitachi H8/300H */ +#define EM_H8S 48 /* Hitachi H8S */ +#define EM_H8_500 49 /* Hitachi 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_AT19 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 /* Mitsubishi 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_NUM 95 + +/* Values for p_type. */ +#define PT_NULL 0 /* Unused entry. */ +#define PT_LOAD 1 /* Loadable segment. */ +#define PT_DYNAMIC 2 /* Dynamic linking information segment. */ +#define PT_INTERP 3 /* Pathname of interpreter. */ +#define PT_NOTE 4 /* Auxiliary information. */ +#define PT_SHLIB 5 /* Reserved (not used). */ +#define PT_PHDR 6 /* Location of program header itself. */ + +/* Values for p_flags. */ +#define PF_X 0x1 /* Executable. */ +#define PF_W 0x2 /* Writable. */ +#define PF_R 0x4 /* Readable. */ + + +#define ELF_PROGRAM_RETURNS_BIT 0x8000000 /* e_flags bit 31 */ + +#define EI_MAG0 0 +#define ELFMAG0 0x7f + +#define EI_MAG1 1 +#define ELFMAG1 'E' + +#define EI_MAG2 2 +#define ELFMAG2 'L' + +#define EI_MAG3 3 +#define ELFMAG3 'F' + +#define ELFMAG "\177ELF" + +#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 EI_DATA 5 /* Data encodeing 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 EI_VERSION 6 /* File version byte index */ + /* Value must be EV_CURRENT */ + +#define EV_NONE 0 /* Invalid ELF Version */ +#define EV_CURRENT 1 /* Current version */ + +#define ELF32_PHDR_SIZE (8*4) /* Size of an elf program header */ + +#ifndef ASSEMBLY +/* + * ELF definitions common to all 32-bit architectures. + */ + +typedef uint32_t Elf32_Addr; +typedef uint16_t Elf32_Half; +typedef uint32_t Elf32_Off; +typedef int32_t Elf32_Sword; +typedef uint32_t Elf32_Word; +typedef uint32_t Elf32_Size; + +typedef uint64_t Elf64_Addr; +typedef uint16_t Elf64_Half; +typedef uint64_t Elf64_Off; +typedef int32_t Elf64_Sword; +typedef uint32_t Elf64_Word; +typedef uint64_t Elf64_Size; + +/* + * ELF header. + */ +typedef struct { + unsigned char e_ident[EI_NIDENT]; /* File identification. */ + Elf32_Half e_type; /* File type. */ + Elf32_Half e_machine; /* Machine architecture. */ + Elf32_Word e_version; /* ELF format version. */ + Elf32_Addr e_entry; /* Entry point. */ + Elf32_Off e_phoff; /* Program header file offset. */ + Elf32_Off e_shoff; /* Section header file offset. */ + Elf32_Word e_flags; /* Architecture-specific flags. */ + Elf32_Half e_ehsize; /* Size of ELF header in bytes. */ + Elf32_Half e_phentsize; /* Size of program header entry. */ + Elf32_Half e_phnum; /* Number of program header entries. */ + Elf32_Half e_shentsize; /* Size of section header entry. */ + Elf32_Half e_shnum; /* Number of section header entries. */ + Elf32_Half e_shstrndx; /* Section name strings section. */ +} Elf32_Ehdr; + +typedef struct { + unsigned char e_ident[EI_NIDENT]; /* File identification. */ + Elf64_Half e_type; /* File type. */ + Elf64_Half e_machine; /* Machine architecture. */ + Elf64_Word e_version; /* ELF format version. */ + Elf64_Addr e_entry; /* Entry point. */ + Elf64_Off e_phoff; /* Program header file offset. */ + Elf64_Off e_shoff; /* Section header file offset. */ + Elf64_Word e_flags; /* Architecture-specific flags. */ + Elf64_Half e_ehsize; /* Size of ELF header in bytes. */ + Elf64_Half e_phentsize; /* Size of program header entry. */ + Elf64_Half e_phnum; /* Number of program header entries. */ + Elf64_Half e_shentsize; /* Size of section header entry. */ + Elf64_Half e_shnum; /* Number of section header entries. */ + Elf64_Half e_shstrndx; /* Section name strings section. */ +} Elf64_Ehdr; + +/* + * Program header. + */ +typedef struct { + Elf32_Word p_type; /* Entry type. */ + Elf32_Off p_offset; /* File offset of contents. */ + Elf32_Addr p_vaddr; /* Virtual address (not used). */ + Elf32_Addr p_paddr; /* Physical address. */ + Elf32_Size p_filesz; /* Size of contents in file. */ + Elf32_Size p_memsz; /* Size of contents in memory. */ + Elf32_Word p_flags; /* Access permission flags. */ + Elf32_Size p_align; /* Alignment in memory and file. */ +} Elf32_Phdr; + +typedef struct { + Elf64_Word p_type; /* Entry type. */ + Elf64_Word p_flags; /* Access permission flags. */ + Elf64_Off p_offset; /* File offset of contents. */ + Elf64_Addr p_vaddr; /* Virtual address (not used). */ + Elf64_Addr p_paddr; /* Physical address. */ + Elf64_Size p_filesz; /* Size of contents in file. */ + Elf64_Size p_memsz; /* Size of contents in memory. */ + Elf64_Size p_align; /* Alignment in memory and file. */ +} Elf64_Phdr; + +/* Standardized Elf image notes for booting... The name for all of these is ELFBoot */ + + +/* ELF Defines for the current architecture */ +#include "i386_elf.h" + +#endif /* ASSEMBLY */ + +//#include "elf_boot.h" + +#endif /* ELF_H */ diff --git a/usr/src/grub/grub-0.97/netboot/endian.h b/usr/src/grub/grub-0.97/netboot/endian.h new file mode 100644 index 0000000000..f8381be251 --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/endian.h @@ -0,0 +1,19 @@ +#ifndef ETHERBOOT_ENDIAN_H +#define ETHERBOOT_ENDIAN_H + +/* 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 + +#include "i386_endian.h" + + +#endif /* ETHERBOOT_ENDIAN_H */ diff --git a/usr/src/grub/grub-0.97/netboot/epic100.c b/usr/src/grub/grub-0.97/netboot/epic100.c new file mode 100644 index 0000000000..9015c612ba --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/epic100.c @@ -0,0 +1,520 @@ + +/* epic100.c: A SMC 83c170 EPIC/100 fast ethernet driver for Etherboot */ + +/* 05/06/2003 timlegge Fixed relocation and implemented Multicast */ +#define LINUX_OUT_MACROS + +#include "etherboot.h" +#include "pci.h" +#include "nic.h" +#include "timer.h" +#include "epic100.h" + +/* Condensed operations for readability */ +#define virt_to_le32desc(addr) cpu_to_le32(virt_to_bus(addr)) +#define le32desc_to_virt(addr) bus_to_virt(le32_to_cpu(addr)) + +#define TX_RING_SIZE 2 /* use at least 2 buffers for TX */ +#define RX_RING_SIZE 2 + +#define PKT_BUF_SZ 1536 /* Size of each temporary Tx/Rx buffer.*/ + +/* +#define DEBUG_RX +#define DEBUG_TX +#define DEBUG_EEPROM +*/ + +#define EPIC_DEBUG 0 /* debug level */ + +/* The EPIC100 Rx and Tx buffer descriptors. */ +struct epic_rx_desc { + unsigned long status; + unsigned long bufaddr; + unsigned long buflength; + unsigned long next; +}; +/* description of the tx descriptors control bits commonly used */ +#define TD_STDFLAGS TD_LASTDESC + +struct epic_tx_desc { + unsigned long status; + unsigned long bufaddr; + unsigned long buflength; + unsigned long next; +}; + +#define delay(nanosec) do { int _i = 3; while (--_i > 0) \ + { __SLOW_DOWN_IO; }} while (0) + +static void epic100_open(void); +static void epic100_init_ring(void); +static void epic100_disable(struct dev *dev); +static int epic100_poll(struct nic *nic, int retrieve); +static void epic100_transmit(struct nic *nic, const char *destaddr, + unsigned int type, unsigned int len, const char *data); +#ifdef DEBUG_EEPROM +static int read_eeprom(int location); +#endif +static int mii_read(int phy_id, int location); +static void epic100_irq(struct nic *nic, irq_action_t action); + +static int ioaddr; + +static int command; +static int intstat; +static int intmask; +static int genctl ; +static int eectl ; +static int test ; +static int mmctl ; +static int mmdata ; +static int lan0 ; +static int mc0 ; +static int rxcon ; +static int txcon ; +static int prcdar ; +static int ptcdar ; +static int eththr ; + +static unsigned int cur_rx, cur_tx; /* The next free ring entry */ +#ifdef DEBUG_EEPROM +static unsigned short eeprom[64]; +#endif +static signed char phys[4]; /* MII device addresses. */ +static struct epic_rx_desc rx_ring[RX_RING_SIZE] + __attribute__ ((aligned(4))); +static struct epic_tx_desc tx_ring[TX_RING_SIZE] + __attribute__ ((aligned(4))); +static unsigned char rx_packet[PKT_BUF_SZ * RX_RING_SIZE]; +static unsigned char tx_packet[PKT_BUF_SZ * TX_RING_SIZE]; + +/***********************************************************************/ +/* Externally visible functions */ +/***********************************************************************/ + + + static int +epic100_probe(struct dev *dev, struct pci_device *pci) +{ + struct nic *nic = (struct nic *)dev; + int i; + unsigned short* ap; + unsigned int phy, phy_idx; + + if (pci->ioaddr == 0) + return 0; + + /* Ideally we would detect all network cards in slot order. That would + be best done a central PCI probe dispatch, which wouldn't work + well with the current structure. So instead we detect just the + Epic cards in slot order. */ + + ioaddr = pci->ioaddr; + nic->irqno = 0; + nic->ioaddr = pci->ioaddr & ~3; + + /* compute all used static epic100 registers address */ + command = ioaddr + COMMAND; /* Control Register */ + intstat = ioaddr + INTSTAT; /* Interrupt Status */ + intmask = ioaddr + INTMASK; /* Interrupt Mask */ + genctl = ioaddr + GENCTL; /* General Control */ + eectl = ioaddr + EECTL; /* EEPROM Control */ + test = ioaddr + TEST; /* Test register (clocks) */ + mmctl = ioaddr + MMCTL; /* MII Management Interface Control */ + mmdata = ioaddr + MMDATA; /* MII Management Interface Data */ + lan0 = ioaddr + LAN0; /* MAC address. (0x40-0x48) */ + mc0 = ioaddr + MC0; /* Multicast Control */ + rxcon = ioaddr + RXCON; /* Receive Control */ + txcon = ioaddr + TXCON; /* Transmit Control */ + prcdar = ioaddr + PRCDAR; /* PCI Receive Current Descr Address */ + ptcdar = ioaddr + PTCDAR; /* PCI Transmit Current Descr Address */ + eththr = ioaddr + ETHTHR; /* Early Transmit Threshold */ + + /* Reset the chip & bring it out of low-power mode. */ + outl(GC_SOFT_RESET, genctl); + + /* Disable ALL interrupts by setting the interrupt mask. */ + outl(INTR_DISABLE, intmask); + + /* + * set the internal clocks: + * Application Note 7.15 says: + * In order to set the CLOCK TEST bit in the TEST register, + * perform the following: + * + * Write 0x0008 to the test register at least sixteen + * consecutive times. + * + * The CLOCK TEST bit is Write-Only. Writing it several times + * consecutively insures a successful write to the bit... + */ + + for (i = 0; i < 16; i++) { + outl(0x00000008, test); + } + +#ifdef DEBUG_EEPROM +{ + unsigned short sum = 0; + unsigned short value; + for (i = 0; i < 64; i++) { + value = read_eeprom(i); + eeprom[i] = value; + sum += value; + } +} + +#if (EPIC_DEBUG > 1) + printf("EEPROM contents\n"); + for (i = 0; i < 64; i++) { + printf(" %hhX%s", eeprom[i], i % 16 == 15 ? "\n" : ""); + } +#endif +#endif + + /* This could also be read from the EEPROM. */ + ap = (unsigned short*)nic->node_addr; + for (i = 0; i < 3; i++) + *ap++ = inw(lan0 + i*4); + + printf(" I/O %#hX %! ", ioaddr, nic->node_addr); + + /* Find the connected MII xcvrs. */ + for (phy = 0, phy_idx = 0; phy < 32 && phy_idx < sizeof(phys); phy++) { + int mii_status = mii_read(phy, 0); + + if (mii_status != 0xffff && mii_status != 0x0000) { + phys[phy_idx++] = phy; +#if (EPIC_DEBUG > 1) + printf("MII transceiver found at address %d.\n", phy); +#endif + } + } + if (phy_idx == 0) { +#if (EPIC_DEBUG > 1) + printf("***WARNING***: No MII transceiver found!\n"); +#endif + /* Use the known PHY address of the EPII. */ + phys[0] = 3; + } + + epic100_open(); + + dev->disable = epic100_disable; + nic->poll = epic100_poll; + nic->transmit = epic100_transmit; + nic->irq = epic100_irq; + + return 1; +} + +static void set_rx_mode(void) +{ + unsigned char mc_filter[8]; + int i; + memset(mc_filter, 0xff, sizeof(mc_filter)); + outl(0x0C, rxcon); + for(i = 0; i < 4; i++) + outw(((unsigned short *)mc_filter)[i], mc0 + i*4); + return; +} + + static void +epic100_open(void) +{ + int mii_reg5; + int full_duplex = 0; + unsigned long tmp; + + epic100_init_ring(); + + /* Pull the chip out of low-power mode, and set for PCI read multiple. */ + outl(GC_RX_FIFO_THR_64 | GC_MRC_READ_MULT | GC_ONE_COPY, genctl); + + outl(TX_FIFO_THRESH, eththr); + + tmp = TC_EARLY_TX_ENABLE | TX_SLOT_TIME; + + mii_reg5 = mii_read(phys[0], 5); + if (mii_reg5 != 0xffff && (mii_reg5 & 0x0100)) { + full_duplex = 1; + printf(" full-duplex mode"); + tmp |= TC_LM_FULL_DPX; + } else + tmp |= TC_LM_NORMAL; + + outl(tmp, txcon); + + /* Give adress of RX and TX ring to the chip */ + outl(virt_to_le32desc(&rx_ring), prcdar); + outl(virt_to_le32desc(&tx_ring), ptcdar); + + /* Start the chip's Rx process: receive unicast and broadcast */ + set_rx_mode(); + outl(CR_START_RX | CR_QUEUE_RX, command); + + putchar('\n'); +} + +/* Initialize the Rx and Tx rings. */ + static void +epic100_init_ring(void) +{ + int i; + + cur_rx = cur_tx = 0; + + for (i = 0; i < RX_RING_SIZE; i++) { + rx_ring[i].status = cpu_to_le32(RRING_OWN); /* Owned by Epic chip */ + rx_ring[i].buflength = cpu_to_le32(PKT_BUF_SZ); + rx_ring[i].bufaddr = virt_to_bus(&rx_packet[i * PKT_BUF_SZ]); + rx_ring[i].next = virt_to_le32desc(&rx_ring[i + 1]) ; + } + /* Mark the last entry as wrapping the ring. */ + rx_ring[i-1].next = virt_to_le32desc(&rx_ring[0]); + + /* + *The Tx buffer descriptor is filled in as needed, + * but we do need to clear the ownership bit. + */ + + for (i = 0; i < TX_RING_SIZE; i++) { + tx_ring[i].status = 0x0000; /* Owned by CPU */ + tx_ring[i].buflength = 0x0000 | cpu_to_le32(TD_STDFLAGS << 16); + tx_ring[i].bufaddr = virt_to_bus(&tx_packet[i * PKT_BUF_SZ]); + tx_ring[i].next = virt_to_le32desc(&tx_ring[i + 1]); + } + tx_ring[i-1].next = virt_to_le32desc(&tx_ring[0]); +} + +/* function: epic100_transmit + * This transmits a packet. + * + * Arguments: char d[6]: destination ethernet address. + * unsigned short t: ethernet protocol type. + * unsigned short s: size of the data-part of the packet. + * char *p: the data for the packet. + * returns: void. + */ + static void +epic100_transmit(struct nic *nic, const char *destaddr, unsigned int type, + unsigned int len, const char *data) +{ + unsigned short nstype; + unsigned char *txp; + int entry; + + /* Calculate the next Tx descriptor entry. */ + entry = cur_tx % TX_RING_SIZE; + + if ((tx_ring[entry].status & TRING_OWN) == TRING_OWN) { + printf("eth_transmit: Unable to transmit. status=%hX. Resetting...\n", + tx_ring[entry].status); + + epic100_open(); + return; + } + + txp = tx_packet + (entry * PKT_BUF_SZ); + + memcpy(txp, destaddr, ETH_ALEN); + memcpy(txp + ETH_ALEN, nic->node_addr, ETH_ALEN); + nstype = htons(type); + memcpy(txp + 12, (char*)&nstype, 2); + memcpy(txp + ETH_HLEN, data, len); + + len += ETH_HLEN; + len &= 0x0FFF; + while(len < ETH_ZLEN) + txp[len++] = '\0'; + /* + * Caution: the write order is important here, + * set the base address with the "ownership" + * bits last. + */ + + tx_ring[entry].buflength |= cpu_to_le32(len); + tx_ring[entry].status = cpu_to_le32(len << 16) | + cpu_to_le32(TRING_OWN); /* Pass ownership to the chip. */ + + cur_tx++; + + /* Trigger an immediate transmit demand. */ + outl(CR_QUEUE_TX, command); + + load_timer2(10*TICKS_PER_MS); /* timeout 10 ms for transmit */ + while ((le32_to_cpu(tx_ring[entry].status) & (TRING_OWN)) && timer2_running()) + /* Wait */; + + if ((le32_to_cpu(tx_ring[entry].status) & TRING_OWN) != 0) + printf("Oops, transmitter timeout, status=%hX\n", + tx_ring[entry].status); +} + +/* function: epic100_poll / eth_poll + * This receives a packet from the network. + * + * Arguments: none + * + * returns: 1 if a packet was received. + * 0 if no pacet was received. + * side effects: + * returns the packet in the array nic->packet. + * returns the length of the packet in nic->packetlen. + */ + + static int +epic100_poll(struct nic *nic, int retrieve) +{ + int entry; + int retcode; + int status; + entry = cur_rx % RX_RING_SIZE; + + if ((rx_ring[entry].status & cpu_to_le32(RRING_OWN)) == RRING_OWN) + return (0); + + if ( ! retrieve ) return 1; + + status = le32_to_cpu(rx_ring[entry].status); + /* We own the next entry, it's a new packet. Send it up. */ + +#if (EPIC_DEBUG > 4) + printf("epic_poll: entry %d status %hX\n", entry, status); +#endif + + cur_rx++; + if (status & 0x2000) { + printf("epic_poll: Giant packet\n"); + retcode = 0; + } else if (status & 0x0006) { + /* Rx Frame errors are counted in hardware. */ + printf("epic_poll: Frame received with errors\n"); + retcode = 0; + } else { + /* Omit the four octet CRC from the length. */ + nic->packetlen = le32_to_cpu((rx_ring[entry].buflength))- 4; + memcpy(nic->packet, &rx_packet[entry * PKT_BUF_SZ], nic->packetlen); + retcode = 1; + } + + /* Clear all error sources. */ + outl(status & INTR_CLEARERRS, intstat); + + /* Give the descriptor back to the chip */ + rx_ring[entry].status = RRING_OWN; + + /* Restart Receiver */ + outl(CR_START_RX | CR_QUEUE_RX, command); + + return retcode; +} + + + static void +epic100_disable(struct dev *dev __unused) +{ + /* Soft reset the chip. */ + outl(GC_SOFT_RESET, genctl); +} + +static void epic100_irq(struct nic *nic __unused, irq_action_t action __unused) +{ + switch ( action ) { + case DISABLE : + break; + case ENABLE : + break; + case FORCE : + break; + } +} + +#ifdef DEBUG_EEPROM +/* Serial EEPROM section. */ + +/* EEPROM_Ctrl bits. */ +#define EE_SHIFT_CLK 0x04 /* EEPROM shift clock. */ +#define EE_CS 0x02 /* EEPROM chip select. */ +#define EE_DATA_WRITE 0x08 /* EEPROM chip data in. */ +#define EE_WRITE_0 0x01 +#define EE_WRITE_1 0x09 +#define EE_DATA_READ 0x10 /* EEPROM chip data out. */ +#define EE_ENB (0x0001 | EE_CS) + +/* The EEPROM commands include the alway-set leading bit. */ +#define EE_WRITE_CMD (5 << 6) +#define EE_READ_CMD (6 << 6) +#define EE_ERASE_CMD (7 << 6) + +#define eeprom_delay(n) delay(n) + + static int +read_eeprom(int location) +{ + int i; + int retval = 0; + int read_cmd = location | EE_READ_CMD; + + outl(EE_ENB & ~EE_CS, eectl); + outl(EE_ENB, eectl); + + /* Shift the read command bits out. */ + for (i = 10; i >= 0; i--) { + short dataval = (read_cmd & (1 << i)) ? EE_DATA_WRITE : 0; + outl(EE_ENB | dataval, eectl); + eeprom_delay(100); + outl(EE_ENB | dataval | EE_SHIFT_CLK, eectl); + eeprom_delay(150); + outl(EE_ENB | dataval, eectl); /* Finish EEPROM a clock tick. */ + eeprom_delay(250); + } + outl(EE_ENB, eectl); + + for (i = 16; i > 0; i--) { + outl(EE_ENB | EE_SHIFT_CLK, eectl); + eeprom_delay(100); + retval = (retval << 1) | ((inl(eectl) & EE_DATA_READ) ? 1 : 0); + outl(EE_ENB, eectl); + eeprom_delay(100); + } + + /* Terminate the EEPROM access. */ + outl(EE_ENB & ~EE_CS, eectl); + return retval; +} +#endif + + +#define MII_READOP 1 +#define MII_WRITEOP 2 + + static int +mii_read(int phy_id, int location) +{ + int i; + + outl((phy_id << 9) | (location << 4) | MII_READOP, mmctl); + /* Typical operation takes < 50 ticks. */ + + for (i = 4000; i > 0; i--) + if ((inl(mmctl) & MII_READOP) == 0) + break; + return inw(mmdata); +} + + +static struct pci_id epic100_nics[] = { +PCI_ROM(0x10b8, 0x0005, "epic100", "SMC EtherPowerII"), /* SMC 83c170 EPIC/100 */ +PCI_ROM(0x10b8, 0x0006, "smc-83c175", "SMC EPIC/C 83c175"), +}; + +struct pci_driver epic100_driver = { + .type = NIC_DRIVER, + .name = "EPIC100", + .probe = epic100_probe, + .ids = epic100_nics, + .id_count = sizeof(epic100_nics)/sizeof(epic100_nics[0]), + .class = 0, +}; diff --git a/usr/src/grub/grub-0.97/netboot/epic100.h b/usr/src/grub/grub-0.97/netboot/epic100.h new file mode 100644 index 0000000000..61bd1d94b3 --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/epic100.h @@ -0,0 +1,188 @@ +#ifndef _EPIC100_H_ +# define _EPIC100_H_ + +#ifndef PCI_VENDOR_SMC +# define PCI_VENDOR_SMC 0x10B8 +#endif + +#ifndef PCI_DEVICE_SMC_EPIC100 +# define PCI_DEVICE_SMC_EPIC100 0x0005 +#endif + +#define PCI_DEVICE_ID_NONE 0xFFFF + +/* Offsets to registers (using SMC names). */ +enum epic100_registers { + COMMAND= 0, /* Control Register */ + INTSTAT= 4, /* Interrupt Status */ + INTMASK= 8, /* Interrupt Mask */ + GENCTL = 0x0C, /* General Control */ + NVCTL = 0x10, /* Non Volatile Control */ + EECTL = 0x14, /* EEPROM Control */ + TEST = 0x1C, /* Test register: marked as reserved (see in source code) */ + CRCCNT = 0x20, /* CRC Error Counter */ + ALICNT = 0x24, /* Frame Alignment Error Counter */ + MPCNT = 0x28, /* Missed Packet Counter */ + MMCTL = 0x30, /* MII Management Interface Control */ + MMDATA = 0x34, /* MII Management Interface Data */ + MIICFG = 0x38, /* MII Configuration */ + IPG = 0x3C, /* InterPacket Gap */ + LAN0 = 0x40, /* MAC address. (0x40-0x48) */ + IDCHK = 0x4C, /* BoardID/ Checksum */ + MC0 = 0x50, /* Multicast filter table. (0x50-0x5c) */ + RXCON = 0x60, /* Receive Control */ + TXCON = 0x70, /* Transmit Control */ + TXSTAT = 0x74, /* Transmit Status */ + PRCDAR = 0x84, /* PCI Receive Current Descriptor Address */ + PRSTAT = 0xA4, /* PCI Receive DMA Status */ + PRCPTHR= 0xB0, /* PCI Receive Copy Threshold */ + PTCDAR = 0xC4, /* PCI Transmit Current Descriptor Address */ + ETHTHR = 0xDC /* Early Transmit Threshold */ +}; + +/* Command register (CR_) bits */ +#define CR_STOP_RX (0x00000001) +#define CR_START_RX (0x00000002) +#define CR_QUEUE_TX (0x00000004) +#define CR_QUEUE_RX (0x00000008) +#define CR_NEXTFRAME (0x00000010) +#define CR_STOP_TX_DMA (0x00000020) +#define CR_STOP_RX_DMA (0x00000040) +#define CR_TX_UGO (0x00000080) + +/* Interrupt register bits. NI means No Interrupt generated */ + +#define INTR_RX_THR_STA (0x00400000) /* rx copy threshold status NI */ +#define INTR_RX_BUFF_EMPTY (0x00200000) /* rx buffers empty. NI */ +#define INTR_TX_IN_PROG (0x00100000) /* tx copy in progess. NI */ +#define INTR_RX_IN_PROG (0x00080000) /* rx copy in progress. NI */ +#define INTR_TXIDLE (0x00040000) /* tx idle. NI */ +#define INTR_RXIDLE (0x00020000) /* rx idle. NI */ +#define INTR_INTR_ACTIVE (0x00010000) /* Interrupt active. NI */ +#define INTR_RX_STATUS_OK (0x00008000) /* rx status valid. NI */ +#define INTR_PCI_TGT_ABT (0x00004000) /* PCI Target abort */ +#define INTR_PCI_MASTER_ABT (0x00002000) /* PCI Master abort */ +#define INTR_PCI_PARITY_ERR (0x00001000) /* PCI adress parity error */ +#define INTR_PCI_DATA_ERR (0x00000800) /* PCI data parity error */ +#define INTR_RX_THR_CROSSED (0x00000400) /* rx copy threshold crossed */ +#define INTR_CNTFULL (0x00000200) /* Counter overflow */ +#define INTR_TXUNDERRUN (0x00000100) /* tx underrun. */ +#define INTR_TXEMPTY (0x00000080) /* tx queue empty */ +#define INTR_TX_CH_COMPLETE (0x00000040) /* tx chain complete */ +#define INTR_TXDONE (0x00000020) /* tx complete (w or w/o err) */ +#define INTR_RXERROR (0x00000010) /* rx error (CRC) */ +#define INTR_RXOVERFLOW (0x00000008) /* rx buffer overflow */ +#define INTR_RX_QUEUE_EMPTY (0x00000004) /* rx queue empty. */ +#define INTR_RXHEADER (0x00000002) /* header copy complete */ +#define INTR_RXDONE (0x00000001) /* Receive copy complete */ + +#define INTR_CLEARINTR (0x00007FFF) +#define INTR_VALIDBITS (0x007FFFFF) +#define INTR_DISABLE (0x00000000) +#define INTR_CLEARERRS (0x00007F18) +#define INTR_ABNINTR (INTR_CNTFULL | INTR_TXUNDERRUN | INTR_RXOVERFLOW) + +/* General Control (GC_) bits */ + +#define GC_SOFT_RESET (0x00000001) +#define GC_INTR_ENABLE (0x00000002) +#define GC_SOFT_INTR (0x00000004) +#define GC_POWER_DOWN (0x00000008) +#define GC_ONE_COPY (0x00000010) +#define GC_BIG_ENDIAN (0x00000020) +#define GC_RX_PREEMPT_TX (0x00000040) +#define GC_TX_PREEMPT_RX (0x00000080) + +/* + * Receive FIFO Threshold values + * Control the level at which the PCI burst state machine + * begins to empty the receive FIFO. Possible values: 0-3 + * + * 0 => 32, 1 => 64, 2 => 96 3 => 128 bytes. + */ +#define GC_RX_FIFO_THR_32 (0x00000000) +#define GC_RX_FIFO_THR_64 (0x00000100) +#define GC_RX_FIFO_THR_96 (0x00000200) +#define GC_RX_FIFO_THR_128 (0x00000300) + +/* Memory Read Control (MRC_) values */ +#define GC_MRC_MEM_READ (0x00000000) +#define GC_MRC_READ_MULT (0x00000400) +#define GC_MRC_READ_LINE (0x00000800) + +#define GC_SOFTBIT0 (0x00001000) +#define GC_SOFTBIT1 (0x00002000) +#define GC_RESET_PHY (0x00004000) + +/* Definitions of the Receive Control (RC_) register bits */ + +#define RC_SAVE_ERRORED_PKT (0x00000001) +#define RC_SAVE_RUNT_FRAMES (0x00000002) +#define RC_RCV_BROADCAST (0x00000004) +#define RC_RCV_MULTICAST (0x00000008) +#define RC_RCV_INVERSE_PKT (0x00000010) +#define RC_PROMISCUOUS_MODE (0x00000020) +#define RC_MONITOR_MODE (0x00000040) +#define RC_EARLY_RCV_ENABLE (0x00000080) + +/* description of the rx descriptors control bits */ +#define RD_FRAGLIST (0x0001) /* Desc points to a fragment list */ +#define RD_LLFORM (0x0002) /* Frag list format */ +#define RD_HDR_CPY (0x0004) /* Desc used for header copy */ + +/* Definition of the Transmit CONTROL (TC) register bits */ + +#define TC_EARLY_TX_ENABLE (0x00000001) + +/* Loopback Mode (LM_) Select valuesbits */ +#define TC_LM_NORMAL (0x00000000) +#define TC_LM_INTERNAL (0x00000002) +#define TC_LM_EXTERNAL (0x00000004) +#define TC_LM_FULL_DPX (0x00000006) + +#define TX_SLOT_TIME (0x00000078) + +/* Bytes transferred to chip before transmission starts. */ +#define TX_FIFO_THRESH 128 /* Rounded down to 4 byte units. */ + +/* description of rx descriptors status bits */ +#define RRING_PKT_INTACT (0x0001) +#define RRING_ALIGN_ERR (0x0002) +#define RRING_CRC_ERR (0x0004) +#define RRING_MISSED_PKT (0x0008) +#define RRING_MULTICAST (0x0010) +#define RRING_BROADCAST (0x0020) +#define RRING_RECEIVER_DISABLE (0x0040) +#define RRING_STATUS_VALID (0x1000) +#define RRING_FRAGLIST_ERR (0x2000) +#define RRING_HDR_COPIED (0x4000) +#define RRING_OWN (0x8000) + +/* error summary */ +#define RRING_ERROR (RRING_ALIGN_ERR|RRING_CRC_ERR) + +/* description of tx descriptors status bits */ +#define TRING_PKT_INTACT (0x0001) /* pkt transmitted. */ +#define TRING_PKT_NONDEFER (0x0002) /* pkt xmitted w/o deferring */ +#define TRING_COLL (0x0004) /* pkt xmitted w collisions */ +#define TRING_CARR (0x0008) /* carrier sense lost */ +#define TRING_UNDERRUN (0x0010) /* DMA underrun */ +#define TRING_HB_COLL (0x0020) /* Collision detect Heartbeat */ +#define TRING_WIN_COLL (0x0040) /* out of window collision */ +#define TRING_DEFERRED (0x0080) /* Deferring */ +#define TRING_COLL_COUNT (0x0F00) /* collision counter (mask) */ +#define TRING_COLL_EXCESS (0x1000) /* tx aborted: excessive colls */ +#define TRING_OWN (0x8000) /* desc ownership bit */ + +/* error summary */ +#define TRING_ABORT (TRING_COLL_EXCESS|TRING_WIN_COLL|TRING_UNDERRUN) +#define TRING_ERROR (TRING_DEFERRED|TRING_WIN_COLL|TRING_UNDERRUN|TRING_CARR/*|TRING_COLL*/ ) + +/* description of the tx descriptors control bits */ +#define TD_FRAGLIST (0x0001) /* Desc points to a fragment list */ +#define TD_LLFORM (0x0002) /* Frag list format */ +#define TD_IAF (0x0004) /* Generate Interrupt after tx */ +#define TD_NOCRC (0x0008) /* No CRC generated */ +#define TD_LASTDESC (0x0010) /* Last desc for this frame */ + +#endif /* _EPIC100_H_ */ diff --git a/usr/src/grub/grub-0.97/netboot/etherboot.h b/usr/src/grub/grub-0.97/netboot/etherboot.h new file mode 100644 index 0000000000..1701493378 --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/etherboot.h @@ -0,0 +1,62 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, 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 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. + */ + +/* + * Transport layer to use Etherboot NIC drivers in GRUB. + */ + +#ifndef ETHERBOOT_H +#define ETHERBOOT_H + +#include "shared.h" +#include "osdep.h" +#include "if_ether.h" +#include "in.h" + +/* Link configuration time in tenths of a second */ +#ifndef VALID_LINK_TIMEOUT +#define VALID_LINK_TIMEOUT 100 /* 10.0 seconds */ +#endif + +#ifndef NULL +#define NULL ((void *)0) +#endif + + +#define gateA20_set() gateA20(1) +#define gateA20_unset() gateA20(0) +#if !defined(__sun) +#define EBDEBUG 0 +#endif +/* The 'rom_info' maybe arch depended. It must be moved to some other + * place */ +struct rom_info { + unsigned short rom_segment; + unsigned short rom_length; +}; + +extern void poll_interruptions P((void)); + +/* For UNDI drivers */ +extern uint32_t get_free_base_memory ( void ); +extern void *allot_base_memory ( size_t ); +extern void forget_base_memory ( void*, size_t ); +extern void free_unused_base_memory ( void ); + +#endif /* ETHERBOOT_H */ diff --git a/usr/src/grub/grub-0.97/netboot/forcedeth.c b/usr/src/grub/grub-0.97/netboot/forcedeth.c new file mode 100644 index 0000000000..88486568d7 --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/forcedeth.c @@ -0,0 +1,1039 @@ +/************************************************************************** +* forcedeth.c -- Etherboot device driver for the NVIDIA nForce +* media access controllers. +* +* Note: This driver is based on the Linux driver that was based on +* a cleanroom reimplementation which was based on reverse +* engineered documentation written by Carl-Daniel Hailfinger +* and Andrew de Quincey. It's neither supported nor endorsed +* by NVIDIA Corp. Use at your own risk. +* +* Written 2004 by Timothy Legge +* +* 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. +* +* Portions of this code based on: +* forcedeth: Ethernet driver for NVIDIA nForce media access controllers: +* +* (C) 2003 Manfred Spraul +* See Linux Driver for full information +* +* Linux Driver Version 0.22, 19 Jan 2004 +* +* +* REVISION HISTORY: +* ================ +* v1.0 01-31-2004 timlegge Initial port of Linux driver +* v1.1 02-03-2004 timlegge Large Clean up, first release +* +* Indent Options: indent -kr -i8 +***************************************************************************/ + +/* to get some global routines like printf */ +#include "etherboot.h" +/* to get the interface to the body of the program */ +#include "nic.h" +/* to get the PCI support functions, if this is a PCI NIC */ +#include "pci.h" +/* Include timer support functions */ +#include "timer.h" + +#define drv_version "v1.1" +#define drv_date "02-03-2004" + +//#define TFTM_DEBUG +#ifdef TFTM_DEBUG +#define dprintf(x) printf x +#else +#define dprintf(x) +#endif + +typedef unsigned char u8; +typedef signed char s8; +typedef unsigned short u16; +typedef signed short s16; +typedef unsigned int u32; +typedef signed int s32; + +/* Condensed operations for readability. */ +#define virt_to_le32desc(addr) cpu_to_le32(virt_to_bus(addr)) +#define le32desc_to_virt(addr) bus_to_virt(le32_to_cpu(addr)) + +unsigned long BASE; +/* NIC specific static variables go here */ + + +/* + * Hardware access: + */ + +#define DEV_NEED_LASTPACKET1 0x0001 +#define DEV_IRQMASK_1 0x0002 +#define DEV_IRQMASK_2 0x0004 +#define DEV_NEED_TIMERIRQ 0x0008 + +enum { + NvRegIrqStatus = 0x000, +#define NVREG_IRQSTAT_MIIEVENT 0040 +#define NVREG_IRQSTAT_MASK 0x1ff + NvRegIrqMask = 0x004, +#define NVREG_IRQ_RX 0x0002 +#define NVREG_IRQ_RX_NOBUF 0x0004 +#define NVREG_IRQ_TX_ERR 0x0008 +#define NVREG_IRQ_TX2 0x0010 +#define NVREG_IRQ_TIMER 0x0020 +#define NVREG_IRQ_LINK 0x0040 +#define NVREG_IRQ_TX1 0x0100 +#define NVREG_IRQMASK_WANTED_1 0x005f +#define NVREG_IRQMASK_WANTED_2 0x0147 +#define NVREG_IRQ_UNKNOWN (~(NVREG_IRQ_RX|NVREG_IRQ_RX_NOBUF|NVREG_IRQ_TX_ERR|NVREG_IRQ_TX2|NVREG_IRQ_TIMER|NVREG_IRQ_LINK|NVREG_IRQ_TX1)) + + NvRegUnknownSetupReg6 = 0x008, +#define NVREG_UNKSETUP6_VAL 3 + +/* + * NVREG_POLL_DEFAULT is the interval length of the timer source on the nic + * NVREG_POLL_DEFAULT=97 would result in an interval length of 1 ms + */ + NvRegPollingInterval = 0x00c, +#define NVREG_POLL_DEFAULT 970 + NvRegMisc1 = 0x080, +#define NVREG_MISC1_HD 0x02 +#define NVREG_MISC1_FORCE 0x3b0f3c + + NvRegTransmitterControl = 0x084, +#define NVREG_XMITCTL_START 0x01 + NvRegTransmitterStatus = 0x088, +#define NVREG_XMITSTAT_BUSY 0x01 + + NvRegPacketFilterFlags = 0x8c, +#define NVREG_PFF_ALWAYS 0x7F0008 +#define NVREG_PFF_PROMISC 0x80 +#define NVREG_PFF_MYADDR 0x20 + + NvRegOffloadConfig = 0x90, +#define NVREG_OFFLOAD_HOMEPHY 0x601 +#define NVREG_OFFLOAD_NORMAL 0x5ee + NvRegReceiverControl = 0x094, +#define NVREG_RCVCTL_START 0x01 + NvRegReceiverStatus = 0x98, +#define NVREG_RCVSTAT_BUSY 0x01 + + NvRegRandomSeed = 0x9c, +#define NVREG_RNDSEED_MASK 0x00ff +#define NVREG_RNDSEED_FORCE 0x7f00 + + NvRegUnknownSetupReg1 = 0xA0, +#define NVREG_UNKSETUP1_VAL 0x16070f + NvRegUnknownSetupReg2 = 0xA4, +#define NVREG_UNKSETUP2_VAL 0x16 + NvRegMacAddrA = 0xA8, + NvRegMacAddrB = 0xAC, + NvRegMulticastAddrA = 0xB0, +#define NVREG_MCASTADDRA_FORCE 0x01 + NvRegMulticastAddrB = 0xB4, + NvRegMulticastMaskA = 0xB8, + NvRegMulticastMaskB = 0xBC, + + NvRegTxRingPhysAddr = 0x100, + NvRegRxRingPhysAddr = 0x104, + NvRegRingSizes = 0x108, +#define NVREG_RINGSZ_TXSHIFT 0 +#define NVREG_RINGSZ_RXSHIFT 16 + NvRegUnknownTransmitterReg = 0x10c, + NvRegLinkSpeed = 0x110, +#define NVREG_LINKSPEED_FORCE 0x10000 +#define NVREG_LINKSPEED_10 10 +#define NVREG_LINKSPEED_100 100 +#define NVREG_LINKSPEED_1000 1000 + NvRegUnknownSetupReg5 = 0x130, +#define NVREG_UNKSETUP5_BIT31 (1<<31) + NvRegUnknownSetupReg3 = 0x134, +#define NVREG_UNKSETUP3_VAL1 0x200010 + NvRegTxRxControl = 0x144, +#define NVREG_TXRXCTL_KICK 0x0001 +#define NVREG_TXRXCTL_BIT1 0x0002 +#define NVREG_TXRXCTL_BIT2 0x0004 +#define NVREG_TXRXCTL_IDLE 0x0008 +#define NVREG_TXRXCTL_RESET 0x0010 + NvRegMIIStatus = 0x180, +#define NVREG_MIISTAT_ERROR 0x0001 +#define NVREG_MIISTAT_LINKCHANGE 0x0008 +#define NVREG_MIISTAT_MASK 0x000f +#define NVREG_MIISTAT_MASK2 0x000f + NvRegUnknownSetupReg4 = 0x184, +#define NVREG_UNKSETUP4_VAL 8 + + NvRegAdapterControl = 0x188, +#define NVREG_ADAPTCTL_START 0x02 +#define NVREG_ADAPTCTL_LINKUP 0x04 +#define NVREG_ADAPTCTL_PHYVALID 0x4000 +#define NVREG_ADAPTCTL_RUNNING 0x100000 +#define NVREG_ADAPTCTL_PHYSHIFT 24 + NvRegMIISpeed = 0x18c, +#define NVREG_MIISPEED_BIT8 (1<<8) +#define NVREG_MIIDELAY 5 + NvRegMIIControl = 0x190, +#define NVREG_MIICTL_INUSE 0x10000 +#define NVREG_MIICTL_WRITE 0x08000 +#define NVREG_MIICTL_ADDRSHIFT 5 + NvRegMIIData = 0x194, + NvRegWakeUpFlags = 0x200, +#define NVREG_WAKEUPFLAGS_VAL 0x7770 +#define NVREG_WAKEUPFLAGS_BUSYSHIFT 24 +#define NVREG_WAKEUPFLAGS_ENABLESHIFT 16 +#define NVREG_WAKEUPFLAGS_D3SHIFT 12 +#define NVREG_WAKEUPFLAGS_D2SHIFT 8 +#define NVREG_WAKEUPFLAGS_D1SHIFT 4 +#define NVREG_WAKEUPFLAGS_D0SHIFT 0 +#define NVREG_WAKEUPFLAGS_ACCEPT_MAGPAT 0x01 +#define NVREG_WAKEUPFLAGS_ACCEPT_WAKEUPPAT 0x02 +#define NVREG_WAKEUPFLAGS_ACCEPT_LINKCHANGE 0x04 + + NvRegPatternCRC = 0x204, + NvRegPatternMask = 0x208, + NvRegPowerCap = 0x268, +#define NVREG_POWERCAP_D3SUPP (1<<30) +#define NVREG_POWERCAP_D2SUPP (1<<26) +#define NVREG_POWERCAP_D1SUPP (1<<25) + NvRegPowerState = 0x26c, +#define NVREG_POWERSTATE_POWEREDUP 0x8000 +#define NVREG_POWERSTATE_VALID 0x0100 +#define NVREG_POWERSTATE_MASK 0x0003 +#define NVREG_POWERSTATE_D0 0x0000 +#define NVREG_POWERSTATE_D1 0x0001 +#define NVREG_POWERSTATE_D2 0x0002 +#define NVREG_POWERSTATE_D3 0x0003 +}; + + + +#define NV_TX_LASTPACKET (1<<0) +#define NV_TX_RETRYERROR (1<<3) +#define NV_TX_LASTPACKET1 (1<<8) +#define NV_TX_DEFERRED (1<<10) +#define NV_TX_CARRIERLOST (1<<11) +#define NV_TX_LATECOLLISION (1<<12) +#define NV_TX_UNDERFLOW (1<<13) +#define NV_TX_ERROR (1<<14) +#define NV_TX_VALID (1<<15) + +#define NV_RX_DESCRIPTORVALID (1<<0) +#define NV_RX_MISSEDFRAME (1<<1) +#define NV_RX_SUBSTRACT1 (1<<3) +#define NV_RX_ERROR1 (1<<7) +#define NV_RX_ERROR2 (1<<8) +#define NV_RX_ERROR3 (1<<9) +#define NV_RX_ERROR4 (1<<10) +#define NV_RX_CRCERR (1<<11) +#define NV_RX_OVERFLOW (1<<12) +#define NV_RX_FRAMINGERR (1<<13) +#define NV_RX_ERROR (1<<14) +#define NV_RX_AVAIL (1<<15) + +/* Miscelaneous hardware related defines: */ +#define NV_PCI_REGSZ 0x270 + +/* various timeout delays: all in usec */ +#define NV_TXRX_RESET_DELAY 4 +#define NV_TXSTOP_DELAY1 10 +#define NV_TXSTOP_DELAY1MAX 500000 +#define NV_TXSTOP_DELAY2 100 +#define NV_RXSTOP_DELAY1 10 +#define NV_RXSTOP_DELAY1MAX 500000 +#define NV_RXSTOP_DELAY2 100 +#define NV_SETUP5_DELAY 5 +#define NV_SETUP5_DELAYMAX 50000 +#define NV_POWERUP_DELAY 5 +#define NV_POWERUP_DELAYMAX 5000 +#define NV_MIIBUSY_DELAY 50 +#define NV_MIIPHY_DELAY 10 +#define NV_MIIPHY_DELAYMAX 10000 + +#define NV_WAKEUPPATTERNS 5 +#define NV_WAKEUPMASKENTRIES 4 + +/* General driver defaults */ +#define NV_WATCHDOG_TIMEO (2*HZ) +#define DEFAULT_MTU 1500 /* also maximum supported, at least for now */ + +#define RX_RING 4 +#define TX_RING 2 +/* limited to 1 packet until we understand NV_TX_LASTPACKET */ +#define TX_LIMIT_STOP 10 +#define TX_LIMIT_START 5 + +/* rx/tx mac addr + type + vlan + align + slack*/ +#define RX_NIC_BUFSIZE (DEFAULT_MTU + 64) +/* even more slack */ +#define RX_ALLOC_BUFSIZE (DEFAULT_MTU + 128) + +#define OOM_REFILL (1+HZ/20) +#define POLL_WAIT (1+HZ/100) + +struct ring_desc { + u32 PacketBuffer; + u16 Length; + u16 Flags; +}; + + +/* Define the TX Descriptor */ +static struct ring_desc tx_ring[TX_RING]; + +/* Create a static buffer of size RX_BUF_SZ for each +TX Descriptor. All descriptors point to a +part of this buffer */ +static unsigned char txb[TX_RING * RX_NIC_BUFSIZE]; + +/* Define the TX Descriptor */ +static struct ring_desc rx_ring[RX_RING]; + +/* Create a static buffer of size RX_BUF_SZ for each +RX Descriptor All descriptors point to a +part of this buffer */ +static unsigned char rxb[RX_RING * RX_NIC_BUFSIZE]; + +/* Private Storage for the NIC */ +struct forcedeth_private { + /* General data: + * Locking: spin_lock(&np->lock); */ + int in_shutdown; + u32 linkspeed; + int duplex; + int phyaddr; + + /* General data: RO fields */ + u8 *ring_addr; + u32 orig_mac[2]; + u32 irqmask; + /* rx specific fields. + * Locking: Within irq hander or disable_irq+spin_lock(&np->lock); + */ + struct ring_desc *rx_ring; + unsigned int cur_rx, refill_rx; + struct sk_buff *rx_skbuff[RX_RING]; + u32 rx_dma[RX_RING]; + unsigned int rx_buf_sz; + + /* + * tx specific fields. + */ + struct ring_desc *tx_ring; + unsigned int next_tx, nic_tx; + struct sk_buff *tx_skbuff[TX_RING]; + u32 tx_dma[TX_RING]; + u16 tx_flags; +} npx; + +static struct forcedeth_private *np; + +static inline void pci_push(u8 * base) +{ + /* force out pending posted writes */ + readl(base); +} +static int reg_delay(int offset, u32 mask, + u32 target, int delay, int delaymax, const char *msg) +{ + u8 *base = (u8 *) BASE; + + pci_push(base); + do { + udelay(delay); + delaymax -= delay; + if (delaymax < 0) { + if (msg) + printf(msg); + return 1; + } + } while ((readl(base + offset) & mask) != target); + return 0; +} + +#define MII_READ (-1) +#define MII_PHYSID1 0x02 /* PHYS ID 1 */ +#define MII_PHYSID2 0x03 /* PHYS ID 2 */ +#define MII_BMCR 0x00 /* Basic mode control register */ +#define MII_BMSR 0x01 /* Basic mode status register */ +#define MII_ADVERTISE 0x04 /* Advertisement control reg */ +#define MII_LPA 0x05 /* Link partner ability reg */ + +#define BMSR_ANEGCOMPLETE 0x0020 /* Auto-negotiation complete */ + +/* Link partner ability register. */ +#define LPA_SLCT 0x001f /* Same as advertise selector */ +#define LPA_10HALF 0x0020 /* Can do 10mbps half-duplex */ +#define LPA_10FULL 0x0040 /* Can do 10mbps full-duplex */ +#define LPA_100HALF 0x0080 /* Can do 100mbps half-duplex */ +#define LPA_100FULL 0x0100 /* Can do 100mbps full-duplex */ +#define LPA_100BASE4 0x0200 /* Can do 100mbps 4k packets */ +#define LPA_RESV 0x1c00 /* Unused... */ +#define LPA_RFAULT 0x2000 /* Link partner faulted */ +#define LPA_LPACK 0x4000 /* Link partner acked us */ +#define LPA_NPAGE 0x8000 /* Next page bit */ + +/* mii_rw: read/write a register on the PHY. + * + * Caller must guarantee serialization + */ +static int mii_rw(struct nic *nic __unused, int addr, int miireg, + int value) +{ + u8 *base = (u8 *) BASE; + int was_running; + u32 reg; + int retval; + + writel(NVREG_MIISTAT_MASK, base + NvRegMIIStatus); + was_running = 0; + reg = readl(base + NvRegAdapterControl); + if (reg & NVREG_ADAPTCTL_RUNNING) { + was_running = 1; + writel(reg & ~NVREG_ADAPTCTL_RUNNING, + base + NvRegAdapterControl); + } + reg = readl(base + NvRegMIIControl); + if (reg & NVREG_MIICTL_INUSE) { + writel(NVREG_MIICTL_INUSE, base + NvRegMIIControl); + udelay(NV_MIIBUSY_DELAY); + } + + reg = + NVREG_MIICTL_INUSE | (addr << NVREG_MIICTL_ADDRSHIFT) | miireg; + if (value != MII_READ) { + writel(value, base + NvRegMIIData); + reg |= NVREG_MIICTL_WRITE; + } + writel(reg, base + NvRegMIIControl); + + if (reg_delay(NvRegMIIControl, NVREG_MIICTL_INUSE, 0, + NV_MIIPHY_DELAY, NV_MIIPHY_DELAYMAX, NULL)) { + dprintf(("mii_rw of reg %d at PHY %d timed out.\n", + miireg, addr)); + retval = -1; + } else if (value != MII_READ) { + /* it was a write operation - fewer failures are detectable */ + dprintf(("mii_rw wrote 0x%x to reg %d at PHY %d\n", + value, miireg, addr)); + retval = 0; + } else if (readl(base + NvRegMIIStatus) & NVREG_MIISTAT_ERROR) { + dprintf(("mii_rw of reg %d at PHY %d failed.\n", + miireg, addr)); + retval = -1; + } else { + /* FIXME: why is that required? */ + udelay(50); + retval = readl(base + NvRegMIIData); + dprintf(("mii_rw read from reg %d at PHY %d: 0x%x.\n", + miireg, addr, retval)); + } + if (was_running) { + reg = readl(base + NvRegAdapterControl); + writel(reg | NVREG_ADAPTCTL_RUNNING, + base + NvRegAdapterControl); + } + return retval; +} + +static void start_rx(struct nic *nic __unused) +{ + u8 *base = (u8 *) BASE; + + dprintf(("start_rx\n")); + /* Already running? Stop it. */ + if (readl(base + NvRegReceiverControl) & NVREG_RCVCTL_START) { + writel(0, base + NvRegReceiverControl); + pci_push(base); + } + writel(np->linkspeed, base + NvRegLinkSpeed); + pci_push(base); + writel(NVREG_RCVCTL_START, base + NvRegReceiverControl); + pci_push(base); +} + +static void stop_rx(void) +{ + u8 *base = (u8 *) BASE; + + dprintf(("stop_rx\n")); + writel(0, base + NvRegReceiverControl); + reg_delay(NvRegReceiverStatus, NVREG_RCVSTAT_BUSY, 0, + NV_RXSTOP_DELAY1, NV_RXSTOP_DELAY1MAX, + "stop_rx: ReceiverStatus remained busy"); + + udelay(NV_RXSTOP_DELAY2); + writel(0, base + NvRegLinkSpeed); +} + +static void start_tx(struct nic *nic __unused) +{ + u8 *base = (u8 *) BASE; + + dprintf(("start_tx\n")); + writel(NVREG_XMITCTL_START, base + NvRegTransmitterControl); + pci_push(base); +} + +static void stop_tx(void) +{ + u8 *base = (u8 *) BASE; + + dprintf(("stop_tx\n")); + writel(0, base + NvRegTransmitterControl); + reg_delay(NvRegTransmitterStatus, NVREG_XMITSTAT_BUSY, 0, + NV_TXSTOP_DELAY1, NV_TXSTOP_DELAY1MAX, + "stop_tx: TransmitterStatus remained busy"); + + udelay(NV_TXSTOP_DELAY2); + writel(0, base + NvRegUnknownTransmitterReg); +} + + +static void txrx_reset(struct nic *nic __unused) +{ + u8 *base = (u8 *) BASE; + + dprintf(("txrx_reset\n")); + writel(NVREG_TXRXCTL_BIT2 | NVREG_TXRXCTL_RESET, + base + NvRegTxRxControl); + pci_push(base); + udelay(NV_TXRX_RESET_DELAY); + writel(NVREG_TXRXCTL_BIT2, base + NvRegTxRxControl); + pci_push(base); +} + +/* + * alloc_rx: fill rx ring entries. + * Return 1 if the allocations for the skbs failed and the + * rx engine is without Available descriptors + */ +static int alloc_rx(struct nic *nic __unused) +{ + unsigned int refill_rx = np->refill_rx; + int i; + //while (np->cur_rx != refill_rx) { + for (i = 0; i < RX_RING; i++) { + //int nr = refill_rx % RX_RING; + rx_ring[i].PacketBuffer = + virt_to_le32desc(&rxb[i * RX_NIC_BUFSIZE]); + rx_ring[i].Length = cpu_to_le16(RX_NIC_BUFSIZE); + wmb(); + rx_ring[i].Flags = cpu_to_le16(NV_RX_AVAIL); + /* printf("alloc_rx: Packet %d marked as Available\n", + refill_rx); */ + refill_rx++; + } + np->refill_rx = refill_rx; + if (np->cur_rx - refill_rx == RX_RING) + return 1; + return 0; +} + +static int update_linkspeed(struct nic *nic) +{ + int adv, lpa, newdup; + u32 newls; + adv = mii_rw(nic, np->phyaddr, MII_ADVERTISE, MII_READ); + lpa = mii_rw(nic, np->phyaddr, MII_LPA, MII_READ); + dprintf(("update_linkspeed: PHY advertises 0x%hX, lpa 0x%hX.\n", + adv, lpa)); + + /* FIXME: handle parallel detection properly, handle gigabit ethernet */ + lpa = lpa & adv; + if (lpa & LPA_100FULL) { + newls = NVREG_LINKSPEED_FORCE | NVREG_LINKSPEED_100; + newdup = 1; + } else if (lpa & LPA_100HALF) { + newls = NVREG_LINKSPEED_FORCE | NVREG_LINKSPEED_100; + newdup = 0; + } else if (lpa & LPA_10FULL) { + newls = NVREG_LINKSPEED_FORCE | NVREG_LINKSPEED_10; + newdup = 1; + } else if (lpa & LPA_10HALF) { + newls = NVREG_LINKSPEED_FORCE | NVREG_LINKSPEED_10; + newdup = 0; + } else { + printf("bad ability %hX - falling back to 10HD.\n", lpa); + newls = NVREG_LINKSPEED_FORCE | NVREG_LINKSPEED_10; + newdup = 0; + } + if (np->duplex != newdup || np->linkspeed != newls) { + np->duplex = newdup; + np->linkspeed = newls; + return 1; + } + return 0; +} + + + +static int init_ring(struct nic *nic) +{ + int i; + + np->next_tx = np->nic_tx = 0; + for (i = 0; i < TX_RING; i++) { + tx_ring[i].Flags = 0; + } + + np->cur_rx = 0; + np->refill_rx = 0; + for (i = 0; i < RX_RING; i++) { + rx_ring[i].Flags = 0; + } + return alloc_rx(nic); +} + +static void set_multicast(struct nic *nic) +{ + + u8 *base = (u8 *) BASE; + u32 addr[2]; + u32 mask[2]; + u32 pff; + u32 alwaysOff[2]; + u32 alwaysOn[2]; + + memset(addr, 0, sizeof(addr)); + memset(mask, 0, sizeof(mask)); + + pff = NVREG_PFF_MYADDR; + + alwaysOn[0] = alwaysOn[1] = alwaysOff[0] = alwaysOff[1] = 0; + + addr[0] = alwaysOn[0]; + addr[1] = alwaysOn[1]; + mask[0] = alwaysOn[0] | alwaysOff[0]; + mask[1] = alwaysOn[1] | alwaysOff[1]; + + addr[0] |= NVREG_MCASTADDRA_FORCE; + pff |= NVREG_PFF_ALWAYS; + stop_rx(); + writel(addr[0], base + NvRegMulticastAddrA); + writel(addr[1], base + NvRegMulticastAddrB); + writel(mask[0], base + NvRegMulticastMaskA); + writel(mask[1], base + NvRegMulticastMaskB); + writel(pff, base + NvRegPacketFilterFlags); + start_rx(nic); +} + +/************************************************************************** +RESET - Reset the NIC to prepare for use +***************************************************************************/ +static int forcedeth_reset(struct nic *nic) +{ + u8 *base = (u8 *) BASE; + int ret, oom, i; + ret = 0; + dprintf(("forcedeth: open\n")); + + /* 1) erase previous misconfiguration */ + /* 4.1-1: stop adapter: ignored, 4.3 seems to be overkill */ + writel(NVREG_MCASTADDRA_FORCE, base + NvRegMulticastAddrA); + writel(0, base + NvRegMulticastAddrB); + writel(0, base + NvRegMulticastMaskA); + writel(0, base + NvRegMulticastMaskB); + writel(0, base + NvRegPacketFilterFlags); + writel(0, base + NvRegAdapterControl); + writel(0, base + NvRegLinkSpeed); + writel(0, base + NvRegUnknownTransmitterReg); + txrx_reset(nic); + writel(0, base + NvRegUnknownSetupReg6); + + /* 2) initialize descriptor rings */ + np->in_shutdown = 0; + oom = init_ring(nic); + + /* 3) set mac address */ + { + u32 mac[2]; + + mac[0] = + (nic->node_addr[0] << 0) + (nic->node_addr[1] << 8) + + (nic->node_addr[2] << 16) + (nic->node_addr[3] << 24); + mac[1] = + (nic->node_addr[4] << 0) + (nic->node_addr[5] << 8); + + writel(mac[0], base + NvRegMacAddrA); + writel(mac[1], base + NvRegMacAddrB); + } + + /* 4) continue setup */ + np->linkspeed = NVREG_LINKSPEED_FORCE | NVREG_LINKSPEED_10; + np->duplex = 0; + writel(NVREG_UNKSETUP3_VAL1, base + NvRegUnknownSetupReg3); + writel(0, base + NvRegTxRxControl); + pci_push(base); + writel(NVREG_TXRXCTL_BIT1, base + NvRegTxRxControl); + + reg_delay(NvRegUnknownSetupReg5, NVREG_UNKSETUP5_BIT31, + NVREG_UNKSETUP5_BIT31, NV_SETUP5_DELAY, + NV_SETUP5_DELAYMAX, + "open: SetupReg5, Bit 31 remained off\n"); + writel(0, base + NvRegUnknownSetupReg4); + + /* 5) Find a suitable PHY */ + writel(NVREG_MIISPEED_BIT8 | NVREG_MIIDELAY, base + NvRegMIISpeed); + for (i = 1; i < 32; i++) { + int id1, id2; + + id1 = mii_rw(nic, i, MII_PHYSID1, MII_READ); + if (id1 < 0) + continue; + id2 = mii_rw(nic, i, MII_PHYSID2, MII_READ); + if (id2 < 0) + continue; + dprintf(("open: Found PHY %04x:%04x at address %d.\n", + id1, id2, i)); + np->phyaddr = i; + + update_linkspeed(nic); + + break; + } + if (i == 32) { + printf("open: failing due to lack of suitable PHY.\n"); + ret = -1; + goto out_drain; + } + + printf("%d-Mbs Link, %s-Duplex\n", + np->linkspeed & NVREG_LINKSPEED_10 ? 10 : 100, + np->duplex ? "Full" : "Half"); + /* 6) continue setup */ + writel(NVREG_MISC1_FORCE | (np->duplex ? 0 : NVREG_MISC1_HD), + base + NvRegMisc1); + writel(readl(base + NvRegTransmitterStatus), + base + NvRegTransmitterStatus); + writel(NVREG_PFF_ALWAYS, base + NvRegPacketFilterFlags); + writel(NVREG_OFFLOAD_NORMAL, base + NvRegOffloadConfig); + + writel(readl(base + NvRegReceiverStatus), + base + NvRegReceiverStatus); + + /* FIXME: I cheated and used the calculator to get a random number */ + i = 75963081; + writel(NVREG_RNDSEED_FORCE | (i & NVREG_RNDSEED_MASK), + base + NvRegRandomSeed); + writel(NVREG_UNKSETUP1_VAL, base + NvRegUnknownSetupReg1); + writel(NVREG_UNKSETUP2_VAL, base + NvRegUnknownSetupReg2); + writel(NVREG_POLL_DEFAULT, base + NvRegPollingInterval); + writel(NVREG_UNKSETUP6_VAL, base + NvRegUnknownSetupReg6); + writel((np-> + phyaddr << NVREG_ADAPTCTL_PHYSHIFT) | + NVREG_ADAPTCTL_PHYVALID, base + NvRegAdapterControl); + writel(NVREG_UNKSETUP4_VAL, base + NvRegUnknownSetupReg4); + writel(NVREG_WAKEUPFLAGS_VAL, base + NvRegWakeUpFlags); + + /* 7) start packet processing */ + writel((u32) virt_to_le32desc(&rx_ring[0]), + base + NvRegRxRingPhysAddr); + writel((u32) virt_to_le32desc(&tx_ring[0]), + base + NvRegTxRingPhysAddr); + + + writel(((RX_RING - 1) << NVREG_RINGSZ_RXSHIFT) + + ((TX_RING - 1) << NVREG_RINGSZ_TXSHIFT), + base + NvRegRingSizes); + + i = readl(base + NvRegPowerState); + if ((i & NVREG_POWERSTATE_POWEREDUP) == 0) { + writel(NVREG_POWERSTATE_POWEREDUP | i, + base + NvRegPowerState); + } + pci_push(base); + udelay(10); + writel(readl(base + NvRegPowerState) | NVREG_POWERSTATE_VALID, + base + NvRegPowerState); + writel(NVREG_ADAPTCTL_RUNNING, base + NvRegAdapterControl); + + writel(0, base + NvRegIrqMask); + pci_push(base); + writel(NVREG_IRQSTAT_MASK, base + NvRegIrqStatus); + pci_push(base); + writel(NVREG_MIISTAT_MASK2, base + NvRegMIIStatus); + writel(NVREG_IRQSTAT_MASK, base + NvRegIrqStatus); + pci_push(base); +/* + writel(np->irqmask, base + NvRegIrqMask); +*/ + writel(NVREG_MCASTADDRA_FORCE, base + NvRegMulticastAddrA); + writel(0, base + NvRegMulticastAddrB); + writel(0, base + NvRegMulticastMaskA); + writel(0, base + NvRegMulticastMaskB); + writel(NVREG_PFF_ALWAYS | NVREG_PFF_MYADDR, + base + NvRegPacketFilterFlags); + + set_multicast(nic); + //start_rx(nic); + start_tx(nic); + + if (! + (mii_rw(nic, np->phyaddr, MII_BMSR, MII_READ) & + BMSR_ANEGCOMPLETE)) { + printf("no link during initialization.\n"); + } + + udelay(10000); + out_drain: + return ret; +} + +//extern void hex_dump(const char *data, const unsigned int len); + +/************************************************************************** +POLL - Wait for a frame +***************************************************************************/ +static int forcedeth_poll(struct nic *nic, int retrieve) +{ + /* return true if there's an ethernet packet ready to read */ + /* nic->packet should contain data on return */ + /* nic->packetlen should contain length of data */ + + struct ring_desc *prd; + int len; + int i; + + i = np->cur_rx % RX_RING; + prd = &rx_ring[i]; + + if ( ! (prd->Flags & cpu_to_le16(NV_RX_DESCRIPTORVALID)) ) { + return 0; + } + + if ( ! retrieve ) return 1; + + /* got a valid packet - forward it to the network core */ + len = cpu_to_le16(prd->Length); + nic->packetlen = len; + //hex_dump(rxb + (i * RX_NIC_BUFSIZE), len); + memcpy(nic->packet, rxb + + (i * RX_NIC_BUFSIZE), nic->packetlen); + + wmb(); + np->cur_rx++; + alloc_rx(nic); + return 1; +} + + +/************************************************************************** +TRANSMIT - Transmit a frame +***************************************************************************/ +static void forcedeth_transmit(struct nic *nic, const char *d, /* Destination */ + unsigned int t, /* Type */ + unsigned int s, /* size */ + const char *p) +{ /* Packet */ + /* send the packet to destination */ + u8 *ptxb; + u16 nstype; + //u16 status; + u8 *base = (u8 *) BASE; + int nr = np->next_tx % TX_RING; + + /* point to the current txb incase multiple tx_rings are used */ + ptxb = txb + (nr * RX_NIC_BUFSIZE); + //np->tx_skbuff[nr] = ptxb; + + /* copy the packet to ring buffer */ + memcpy(ptxb, d, ETH_ALEN); /* dst */ + memcpy(ptxb + ETH_ALEN, nic->node_addr, ETH_ALEN); /* src */ + nstype = htons((u16) t); /* type */ + memcpy(ptxb + 2 * ETH_ALEN, (u8 *) & nstype, 2); /* type */ + memcpy(ptxb + ETH_HLEN, p, s); + + s += ETH_HLEN; + while (s < ETH_ZLEN) /* pad to min length */ + ptxb[s++] = '\0'; + + tx_ring[nr].PacketBuffer = (u32) virt_to_le32desc(ptxb); + tx_ring[nr].Length = cpu_to_le16(s - 1); + + wmb(); + tx_ring[nr].Flags = np->tx_flags; + + writel(NVREG_TXRXCTL_KICK, base + NvRegTxRxControl); + pci_push(base); + tx_ring[nr].Flags = np->tx_flags; + np->next_tx++; +} + +/************************************************************************** +DISABLE - Turn off ethernet interface +***************************************************************************/ +static void forcedeth_disable(struct dev *dev __unused) +{ + /* put the card in its initial state */ + /* This function serves 3 purposes. + * This disables DMA and interrupts so we don't receive + * unexpected packets or interrupts from the card after + * etherboot has finished. + * This frees resources so etherboot may use + * this driver on another interface + * This allows etherboot to reinitialize the interface + * if something is something goes wrong. + */ + u8 *base = (u8 *) BASE; + np->in_shutdown = 1; + stop_tx(); + stop_rx(); + + /* disable interrupts on the nic or we will lock up */ + writel(0, base + NvRegIrqMask); + pci_push(base); + dprintf(("Irqmask is zero again\n")); + + /* specia op:o write back the misordered MAC address - otherwise + * the next probe_nic would see a wrong address. + */ + writel(np->orig_mac[0], base + NvRegMacAddrA); + writel(np->orig_mac[1], base + NvRegMacAddrB); +} + +/************************************************************************** +IRQ - Enable, Disable, or Force interrupts +***************************************************************************/ +static void forcedeth_irq(struct nic *nic __unused, irq_action_t action __unused) +{ + switch ( action ) { + case DISABLE : + break; + case ENABLE : + break; + case FORCE : + break; + } +} + +/************************************************************************** +PROBE - Look for an adapter, this routine's visible to the outside +***************************************************************************/ +#define IORESOURCE_MEM 0x00000200 +#define board_found 1 +#define valid_link 0 +static int forcedeth_probe(struct dev *dev, struct pci_device *pci) +{ + struct nic *nic = (struct nic *) dev; + unsigned long addr; + int sz; + u8 *base; + + if (pci->ioaddr == 0) + return 0; + + printf("forcedeth.c: Found %s, vendor=0x%hX, device=0x%hX\n", + pci->name, pci->vendor, pci->dev_id); + + nic->irqno = 0; + nic->ioaddr = pci->ioaddr & ~3; + + /* point to private storage */ + np = &npx; + + adjust_pci_device(pci); + + addr = pci_bar_start(pci, PCI_BASE_ADDRESS_0); + sz = pci_bar_size(pci, PCI_BASE_ADDRESS_0); + + /* BASE is used throughout to address the card */ + BASE = (unsigned long) ioremap(addr, sz); + if (!BASE) + return 0; + //rx_ring[0] = rx_ring; + //tx_ring[0] = tx_ring; + + /* read the mac address */ + base = (u8 *) BASE; + np->orig_mac[0] = readl(base + NvRegMacAddrA); + np->orig_mac[1] = readl(base + NvRegMacAddrB); + + nic->node_addr[0] = (np->orig_mac[1] >> 8) & 0xff; + nic->node_addr[1] = (np->orig_mac[1] >> 0) & 0xff; + nic->node_addr[2] = (np->orig_mac[0] >> 24) & 0xff; + nic->node_addr[3] = (np->orig_mac[0] >> 16) & 0xff; + nic->node_addr[4] = (np->orig_mac[0] >> 8) & 0xff; + nic->node_addr[5] = (np->orig_mac[0] >> 0) & 0xff; +#ifdef LINUX + if (!is_valid_ether_addr(dev->dev_addr)) { + /* + * Bad mac address. At least one bios sets the mac address + * to 01:23:45:67:89:ab + */ + printk(KERN_ERR + "%s: Invalid Mac address detected: %02x:%02x:%02x:%02x:%02x:%02x\n", + pci_name(pci_dev), dev->dev_addr[0], + dev->dev_addr[1], dev->dev_addr[2], + dev->dev_addr[3], dev->dev_addr[4], + dev->dev_addr[5]); + printk(KERN_ERR + "Please complain to your hardware vendor. Switching to a random MAC.\n"); + dev->dev_addr[0] = 0x00; + dev->dev_addr[1] = 0x00; + dev->dev_addr[2] = 0x6c; + get_random_bytes(&dev->dev_addr[3], 3); + } +#endif + printf("%s: MAC Address %!, ", pci->name, nic->node_addr); + + np->tx_flags = + cpu_to_le16(NV_TX_LASTPACKET | NV_TX_LASTPACKET1 | + NV_TX_VALID); + switch (pci->dev_id) { + case 0x01C3: // nforce + np->irqmask = NVREG_IRQMASK_WANTED_2; + np->irqmask |= NVREG_IRQ_TIMER; + break; + case 0x0066: // nforce2 + np->tx_flags |= cpu_to_le16(NV_TX_LASTPACKET1); + np->irqmask = NVREG_IRQMASK_WANTED_2; + np->irqmask |= NVREG_IRQ_TIMER; + break; + case 0x00D6: // nforce3 + np->tx_flags |= cpu_to_le16(NV_TX_LASTPACKET1); + np->irqmask = NVREG_IRQMASK_WANTED_2; + np->irqmask |= NVREG_IRQ_TIMER; + + } + dprintf(("%s: forcedeth.c: subsystem: %hX:%hX bound to %s\n", + pci->name, pci->vendor, pci->dev_id, pci->name)); + + forcedeth_reset(nic); +// if (board_found && valid_link) + /* point to NIC specific routines */ + dev->disable = forcedeth_disable; + nic->poll = forcedeth_poll; + nic->transmit = forcedeth_transmit; + nic->irq = forcedeth_irq; + return 1; +// } + /* else */ +} + +static struct pci_id forcedeth_nics[] = { + PCI_ROM(0x10de, 0x01C3, "nforce", "nForce Ethernet Controller"), + PCI_ROM(0x10de, 0x0066, "nforce2", "nForce2 Ethernet Controller"), + PCI_ROM(0x10de, 0x00D6, "nforce3", "nForce3 Ethernet Controller"), +}; + +struct pci_driver forcedeth_driver = { + .type = NIC_DRIVER, + .name = "forcedeth", + .probe = forcedeth_probe, + .ids = forcedeth_nics, + .id_count = sizeof(forcedeth_nics) / sizeof(forcedeth_nics[0]), + .class = 0, +}; diff --git a/usr/src/grub/grub-0.97/netboot/fsys_tftp.c b/usr/src/grub/grub-0.97/netboot/fsys_tftp.c new file mode 100644 index 0000000000..0ba70d06ba --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/fsys_tftp.c @@ -0,0 +1,877 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2000,2001,2002,2004 Free Software Foundation, 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 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. + */ + +/* Based on "src/main.c" in etherboot-4.5.8. */ +/************************************************************************** +ETHERBOOT - BOOTP/TFTP Bootstrap Program + +Author: Martin Renters + Date: Dec/93 + +**************************************************************************/ + +/* #define TFTP_DEBUG 1 */ + +#include +#include + +#include "grub.h" +#include "tftp.h" +#include "nic.h" + +static int tftp_file_read_undi(const char *name, + int (*fnc)(unsigned char *, unsigned int, unsigned int, int)); +static int tftp_read_undi(char *addr, int size); +static int tftp_dir_undi(char *dirname); +static void tftp_close_undi(void); +static int buf_fill_undi(int abort); + +extern int use_bios_pxe; + +static int retry; +static unsigned short iport = 2000; +static unsigned short oport = 0; +static unsigned short block, prevblock; +static int bcounter; +static struct tftp_t tp, saved_tp; +static int packetsize; +static int buf_eof, buf_read; +static int saved_filepos; +static unsigned short len, saved_len; +static char *buf, *saved_name; + +/** + * tftp_read + * + * Read file with _name_, data handled by _fnc_. In fact, grub never + * use it, we just use it to read dhcp config file. + */ +static int await_tftp(int ival, void *ptr __unused, + unsigned short ptype __unused, struct iphdr *ip, + struct udphdr *udp) +{ + static int tftp_count = 0; + + if (!udp) { + return 0; + } + if (arptable[ARP_CLIENT].ipaddr.s_addr != ip->dest.s_addr) + return 0; + if (ntohs(udp->dest) != ival) + return 0; + tftp_count++; /* show progress */ + if ((tftp_count % 1000) == 0) + printf("."); + return 1; +} + +int tftp_file_read(const char *name, int (*fnc)(unsigned char *, unsigned int, unsigned int, int)) +{ + struct tftpreq_t tp; + struct tftp_t *tr; + int rc; + + if (use_bios_pxe) + return (tftp_file_read_undi(name, fnc)); + + retry = 0; + block = 0; + prevblock = 0; + bcounter = 0; + + + rx_qdrain(); + + tp.opcode = htons(TFTP_RRQ); + /* Warning: the following assumes the layout of bootp_t. + But that's fixed by the IP, UDP and BOOTP specs. */ + len = sizeof(tp.ip) + sizeof(tp.udp) + sizeof(tp.opcode) + + sprintf((char *)tp.u.rrq, "%s%coctet%cblksize%c%d", + name, 0, 0, 0, TFTP_MAX_PACKET) + 1; + if (!udp_transmit(arptable[ARP_SERVER].ipaddr.s_addr, ++iport, + TFTP_PORT, len, &tp)) + return (0); + for (;;) + { + long timeout; +#ifdef CONGESTED + timeout = rfc2131_sleep_interval(block?TFTP_REXMT: TIMEOUT, retry); +#else + timeout = rfc2131_sleep_interval(TIMEOUT, retry); +#endif + if (!await_reply(await_tftp, iport, NULL, timeout)) + { + if (!block && retry++ < MAX_TFTP_RETRIES) + { /* maybe initial request was lost */ + if (!udp_transmit(arptable[ARP_SERVER].ipaddr.s_addr, + ++iport, TFTP_PORT, len, &tp)) + return (0); + continue; + } +#ifdef CONGESTED + if (block && ((retry += TFTP_REXMT) < TFTP_TIMEOUT)) + { /* we resend our last ack */ +#ifdef MDEBUG + printf("\n"); +#endif + udp_transmit(arptable[ARP_SERVER].ipaddr.s_addr, + iport, oport, + TFTP_MIN_PACKET, &tp); + continue; + } +#endif + break; /* timeout */ + } + tr = (struct tftp_t *)&nic.packet[ETH_HLEN]; + if (tr->opcode == ntohs(TFTP_ERROR)) + { + printf("TFTP error %d (%s)\n", + ntohs(tr->u.err.errcode), + tr->u.err.errmsg); + break; + } + + if (tr->opcode == ntohs(TFTP_OACK)) { + char *p = tr->u.oack.data, *e; + + if (prevblock) /* shouldn't happen */ + continue; /* ignore it */ + len = ntohs(tr->udp.len) - sizeof(struct udphdr) - 2; + if (len > TFTP_MAX_PACKET) + goto noak; + e = p + len; + while (*p != '\0' && p < e) { +/* if (!strcasecmp("blksize", p)) { */ + if (!grub_strcmp("blksize", p)) { + p += 8; +/* if ((packetsize = strtoul(p, &p, 10)) < */ + if ((packetsize = getdec(&p)) < TFTP_DEFAULTSIZE_PACKET) + goto noak; + while (p < e && *p) p++; + if (p < e) + p++; + } + else { + noak: + tp.opcode = htons(TFTP_ERROR); + tp.u.err.errcode = 8; +/* + * Warning: the following assumes the layout of bootp_t. + * But that's fixed by the IP, UDP and BOOTP specs. + */ + len = sizeof(tp.ip) + sizeof(tp.udp) + sizeof(tp.opcode) + sizeof(tp.u.err.errcode) + +/* + * Normally bad form to omit the format string, but in this case + * the string we are copying from is fixed. sprintf is just being + * used as a strcpy and strlen. + */ + sprintf((char *)tp.u.err.errmsg, + "RFC1782 error") + 1; + udp_transmit(arptable[ARP_SERVER].ipaddr.s_addr, + iport, ntohs(tr->udp.src), + len, &tp); + return (0); + } + } + if (p > e) + goto noak; + block = tp.u.ack.block = 0; /* this ensures, that */ + /* the packet does not get */ + /* processed as data! */ + } + else if (tr->opcode == htons(TFTP_DATA)) { + len = ntohs(tr->udp.len) - sizeof(struct udphdr) - 4; + if (len > packetsize) /* shouldn't happen */ + continue; /* ignore it */ + block = ntohs(tp.u.ack.block = tr->u.data.block); } + else {/* neither TFTP_OACK nor TFTP_DATA */ + break; + } + + if ((block || bcounter) && (block != (unsigned short)(prevblock+1))) { + /* Block order should be continuous */ + tp.u.ack.block = htons(block = prevblock); + } + tp.opcode = htons(TFTP_ACK); + oport = ntohs(tr->udp.src); + udp_transmit(arptable[ARP_SERVER].ipaddr.s_addr, iport, + oport, TFTP_MIN_PACKET, &tp); /* ack */ + if ((unsigned short)(block-prevblock) != 1) { + /* Retransmission or OACK, don't process via callback + * and don't change the value of prevblock. */ + continue; + } + prevblock = block; + retry = 0; /* It's the right place to zero the timer? */ + if ((rc = fnc(tr->u.data.download, + ++bcounter, len, len < packetsize)) <= 0) + return(rc); + if (len < packetsize) { /* End of data --- fnc should not have returned */ + printf("tftp download complete, but\n"); + return (1); + } + } + return (0); +} + +/* Fill the buffer by receiving the data via the TFTP protocol. */ +static int +buf_fill (int abort) +{ +#ifdef TFTP_DEBUG + grub_printf ("buf_fill (%d)\n", abort); +#endif + + if (use_bios_pxe) + return (buf_fill_undi(abort)); + + while (! buf_eof && (buf_read + packetsize <= FSYS_BUFLEN)) + { + struct tftp_t *tr; + long timeout; + +#ifdef CONGESTED + timeout = rfc2131_sleep_interval (block ? TFTP_REXMT : TIMEOUT, retry); +#else + timeout = rfc2131_sleep_interval (TIMEOUT, retry); +#endif + + if (! await_reply (await_tftp, iport, NULL, timeout)) + { + if (user_abort) + return 0; + + if (! block && retry++ < MAX_TFTP_RETRIES) + { + /* Maybe initial request was lost. */ +#ifdef TFTP_DEBUG + grub_printf ("Maybe initial request was lost.\n"); +#endif + if (! udp_transmit (arptable[ARP_SERVER].ipaddr.s_addr, + ++iport, TFTP_PORT, len, &tp)) + return 0; + + continue; + } + +#ifdef CONGESTED + if (block && ((retry += TFTP_REXMT) < TFTP_TIMEOUT)) + { + /* We resend our last ack. */ +# ifdef TFTP_DEBUG + grub_printf ("\n"); +# endif + udp_transmit (arptable[ARP_SERVER].ipaddr.s_addr, + iport, oport, + TFTP_MIN_PACKET, &tp); + continue; + } +#endif + /* Timeout. */ + return 0; + } + + tr = (struct tftp_t *) &nic.packet[ETH_HLEN]; + if (tr->opcode == ntohs (TFTP_ERROR)) + { + grub_printf ("TFTP error %d (%s)\n", + ntohs (tr->u.err.errcode), + tr->u.err.errmsg); + return 0; + } + + if (tr->opcode == ntohs (TFTP_OACK)) + { + char *p = tr->u.oack.data, *e; + +#ifdef TFTP_DEBUG + grub_printf ("OACK "); +#endif + /* Shouldn't happen. */ + if (prevblock) + { + /* Ignore it. */ + grub_printf ("%s:%d: warning: PREVBLOCK != 0 (0x%x)\n", + __FILE__, __LINE__, prevblock); + continue; + } + + len = ntohs (tr->udp.len) - sizeof (struct udphdr) - 2; + if (len > TFTP_MAX_PACKET) + goto noak; + + e = p + len; + while (*p != '\000' && p < e) + { + if (! grub_strcmp ("blksize", p)) + { + p += 8; + if ((packetsize = getdec (&p)) < TFTP_DEFAULTSIZE_PACKET) + goto noak; +#ifdef TFTP_DEBUG + grub_printf ("blksize = %d\n", packetsize); +#endif + } + else if (! grub_strcmp ("tsize", p)) + { + p += 6; + if ((filemax = getdec (&p)) < 0) + { + filemax = -1; + goto noak; + } +#ifdef TFTP_DEBUG + grub_printf ("tsize = %d\n", filemax); +#endif + } + else + { + noak: +#ifdef TFTP_DEBUG + grub_printf ("NOAK\n"); +#endif + tp.opcode = htons (TFTP_ERROR); + tp.u.err.errcode = 8; + len = (grub_sprintf ((char *) tp.u.err.errmsg, + "RFC1782 error") + + sizeof (tp.ip) + sizeof (tp.udp) + + sizeof (tp.opcode) + sizeof (tp.u.err.errcode) + + 1); + udp_transmit (arptable[ARP_SERVER].ipaddr.s_addr, + iport, ntohs (tr->udp.src), + len, &tp); + return 0; + } + + while (p < e && *p) + p++; + + if (p < e) + p++; + } + + if (p > e) + goto noak; + + /* This ensures that the packet does not get processed as + data! */ + block = tp.u.ack.block = 0; + } + else if (tr->opcode == ntohs (TFTP_DATA)) + { +#ifdef TFTP_DEBUG + grub_printf ("DATA "); +#endif + len = ntohs (tr->udp.len) - sizeof (struct udphdr) - 4; + + /* Shouldn't happen. */ + if (len > packetsize) + { + /* Ignore it. */ + grub_printf ("%s:%d: warning: LEN > PACKETSIZE (0x%x > 0x%x)\n", + __FILE__, __LINE__, len, packetsize); + continue; + } + + block = ntohs (tp.u.ack.block = tr->u.data.block); + } + else + /* Neither TFTP_OACK nor TFTP_DATA. */ + break; + + if ((block || bcounter) && (block != prevblock + (unsigned short) 1)) + /* Block order should be continuous */ + tp.u.ack.block = htons (block = prevblock); + + /* Should be continuous. */ + tp.opcode = abort ? htons (TFTP_ERROR) : htons (TFTP_ACK); + oport = ntohs (tr->udp.src); + +#ifdef TFTP_DEBUG + grub_printf ("ACK\n"); +#endif + /* Ack. */ + udp_transmit (arptable[ARP_SERVER].ipaddr.s_addr, iport, + oport, TFTP_MIN_PACKET, &tp); + + if (abort) + { + buf_eof = 1; + break; + } + + /* Retransmission or OACK. */ + if ((unsigned short) (block - prevblock) != 1) + /* Don't process. */ + continue; + + prevblock = block; + /* Is it the right place to zero the timer? */ + retry = 0; + + /* In GRUB, this variable doesn't play any important role at all, + but use it for consistency with Etherboot. */ + bcounter++; + + /* Copy the downloaded data to the buffer. */ + grub_memmove (buf + buf_read, tr->u.data.download, len); + buf_read += len; + + /* End of data. */ + if (len < packetsize) + buf_eof = 1; + } + + return 1; +} + +/* Send the RRQ whose length is LEN. */ +static int +send_rrq (void) +{ + /* Initialize some variables. */ + retry = 0; + block = 0; + prevblock = 0; + packetsize = TFTP_DEFAULTSIZE_PACKET; + bcounter = 0; + + buf = (char *) FSYS_BUF; + buf_eof = 0; + buf_read = 0; + saved_filepos = 0; + + rx_qdrain(); + +#ifdef TFTP_DEBUG + grub_printf ("send_rrq ()\n"); + { + int i; + char *p; + + for (i = 0, p = (char *) &tp; i < len; i++) + if (p[i] >= ' ' && p[i] <= '~') + grub_putchar (p[i]); + else + grub_printf ("\\%x", (unsigned) p[i]); + + grub_putchar ('\n'); + } +#endif + /* Send the packet. */ + return udp_transmit (arptable[ARP_SERVER].ipaddr.s_addr, ++iport, + TFTP_PORT, len, &tp); +} + +/* Mount the network drive. If the drive is ready, return one, otherwise + return zero. */ +int +tftp_mount (void) +{ + /* Check if the current drive is the network drive. */ + if (current_drive != NETWORK_DRIVE) + return 0; + + /* If the drive is not initialized yet, abort. */ + if (! network_ready) + return 0; + + return 1; +} + +/* Read up to SIZE bytes, returned in ADDR. */ +int +tftp_read (char *addr, int size) +{ + /* How many bytes is read? */ + int ret = 0; + +#ifdef TFTP_DEBUG + grub_printf ("tftp_read (0x%x, %d)\n", (int) addr, size); +#endif + + if (use_bios_pxe) + return (tftp_read_undi(addr, size)); + + if (filepos < saved_filepos) + { + /* Uggh.. FILEPOS has been moved backwards. So reopen the file. */ + buf_read = 0; + buf_fill (1); + grub_memmove ((char *) &tp, (char *) &saved_tp, saved_len); + len = saved_len; +#ifdef TFTP_DEBUG + { + int i; + grub_printf ("opcode = 0x%x, rrq = ", (unsigned long) tp.opcode); + for (i = 0; i < TFTP_DEFAULTSIZE_PACKET; i++) + { + if (tp.u.rrq[i] >= ' ' && tp.u.rrq[i] <= '~') + grub_putchar (tp.u.rrq[i]); + else + grub_putchar ('*'); + } + grub_putchar ('\n'); + } +#endif + + if (! send_rrq ()) + { + errnum = ERR_WRITE; + return 0; + } + } + + while (size > 0) + { + int amt = buf_read + saved_filepos - filepos; + + /* If the length that can be copied from the buffer is over the + requested size, cut it down. */ + if (amt > size) + amt = size; + + if (amt > 0) + { + /* Copy the buffer to the supplied memory space. */ + grub_memmove (addr, buf + filepos - saved_filepos, amt); + size -= amt; + addr += amt; + filepos += amt; + ret += amt; + + /* If the size of the empty space becomes small, move the unused + data forwards. */ + if (filepos - saved_filepos > FSYS_BUFLEN / 2) + { + grub_memmove (buf, buf + FSYS_BUFLEN / 2, FSYS_BUFLEN / 2); + buf_read -= FSYS_BUFLEN / 2; + saved_filepos += FSYS_BUFLEN / 2; + } + } + else + { + /* Skip the whole buffer. */ + saved_filepos += buf_read; + buf_read = 0; + } + + /* Read the data. */ + if (size > 0 && ! buf_fill (0)) + { + errnum = ERR_READ; + return 0; + } + + /* Sanity check. */ + if (size > 0 && buf_read == 0) + { + errnum = ERR_READ; + return 0; + } + } + + return ret; +} + +/* Check if the file DIRNAME really exists. Get the size and save it in + FILEMAX. */ +int +tftp_dir (char *dirname) +{ + int ch; + +#ifdef TFTP_DEBUG + grub_printf ("tftp_dir (%s)\n", dirname); +#endif + + if (use_bios_pxe) + return (tftp_dir_undi(dirname)); + + /* In TFTP, there is no way to know what files exist. */ + if (print_possibilities) + return 1; + + /* Don't know the size yet. */ + filemax = -1; + + reopen: + /* Construct the TFTP request packet. */ + tp.opcode = htons (TFTP_RRQ); + /* Terminate the filename. */ + ch = nul_terminate (dirname); + /* Make the request string (octet, blksize and tsize). */ + len = (grub_sprintf ((char *) tp.u.rrq, + "%s%coctet%cblksize%c%d%ctsize%c0", + dirname, 0, 0, 0, TFTP_MAX_PACKET, 0, 0) + + sizeof (tp.ip) + sizeof (tp.udp) + sizeof (tp.opcode) + 1); + /* Restore the original DIRNAME. */ + dirname[grub_strlen (dirname)] = ch; + /* Save the TFTP packet so that we can reopen the file later. */ + grub_memmove ((char *) &saved_tp, (char *) &tp, len); + saved_len = len; + if (! send_rrq ()) + { + errnum = ERR_WRITE; + return 0; + } + + /* Read the data. */ + if (! buf_fill (0)) + { + errnum = ERR_FILE_NOT_FOUND; + return 0; + } + + if (filemax == -1) + { + /* The server doesn't support the "tsize" option, so we must read + the file twice... */ + + /* Zero the size of the file. */ + filemax = 0; + do + { + /* Add the length of the downloaded data. */ + filemax += buf_read; + /* Reset the offset. Just discard the contents of the buffer. */ + buf_read = 0; + /* Read the data. */ + if (! buf_fill (0)) + { + errnum = ERR_READ; + return 0; + } + } + while (! buf_eof); + + /* Maybe a few amounts of data remains. */ + filemax += buf_read; + + /* Retry the open instruction. */ + goto reopen; + } + + return 1; +} + +/* Close the file. */ +void +tftp_close (void) +{ +#ifdef TFTP_DEBUG + grub_printf ("tftp_close ()\n"); +#endif + + if (use_bios_pxe) { + tftp_close_undi(); + return; + } + + buf_read = 0; + buf_fill (1); +} + +/* tftp implementation using BIOS established PXE stack */ + +static int tftp_file_read_undi(const char *name, + int (*fnc)(unsigned char *, unsigned int, unsigned int, int)) +{ + int rc; + uint16_t len; + + buf = (char *)&nic.packet; + /* open tftp session */ + if (eb_pxenv_tftp_open(name, arptable[ARP_SERVER].ipaddr, + arptable[ARP_GATEWAY].ipaddr, &packetsize) == 0) + return (0); + + /* read blocks and invoke fnc for each block */ + for (;;) { + rc = eb_pxenv_tftp_read(buf, &len); + if (rc == 0) + break; + rc = fnc(buf, ++block, len, len < packetsize); + if (rc <= 0 || len < packetsize) + break; + } + + (void) eb_pxenv_tftp_close(); + return (rc > 0 ? 1 : 0); +} + +/* Fill the buffer by reading the data via the TFTP protocol. */ +static int +buf_fill_undi(int abort) +{ + int rc; + uint8_t *tmpbuf; + + while (! buf_eof && (buf_read + packetsize <= FSYS_BUFLEN)) { + poll_interruptions(); + if (user_abort) + return 0; + if (abort) { + buf_eof = 1; + break; + } + + if (eb_pxenv_tftp_read(buf + buf_read, &len) == 0) + return (0); + + buf_read += len; + + /* End of data. */ + if (len < packetsize) + buf_eof = 1; + } + return 1; +} + +static void +tftp_reopen_undi(void) +{ + tftp_close(); + (void) eb_pxenv_tftp_open(saved_name, arptable[ARP_SERVER].ipaddr, + arptable[ARP_GATEWAY].ipaddr, &packetsize); + + buf_eof = 0; + buf_read = 0; + saved_filepos = 0; +} + +/* Read up to SIZE bytes, returned in ADDR. */ +static int +tftp_read_undi(char *addr, int size) +{ + int ret = 0; + + if (filepos < saved_filepos) { + /* Uggh.. FILEPOS has been moved backwards. reopen the file. */ + tftp_reopen_undi(); + } + + while (size > 0) { + int amt = buf_read + saved_filepos - filepos; + + /* If the length that can be copied from the buffer is over + the requested size, cut it down. */ + if (amt > size) + amt = size; + + if (amt > 0) { + /* Copy the buffer to the supplied memory space. */ + grub_memmove (addr, buf + filepos - saved_filepos, amt); + size -= amt; + addr += amt; + filepos += amt; + ret += amt; + + /* If the size of the empty space becomes small, + * move the unused data forwards. + */ + if (filepos - saved_filepos > FSYS_BUFLEN / 2) { + grub_memmove (buf, buf + FSYS_BUFLEN / 2, + FSYS_BUFLEN / 2); + buf_read -= FSYS_BUFLEN / 2; + saved_filepos += FSYS_BUFLEN / 2; + } + } else { + /* Skip the whole buffer. */ + saved_filepos += buf_read; + buf_read = 0; + } + + /* Read the data. */ + if (size > 0 && ! buf_fill (0)) { + errnum = ERR_READ; + return 0; + } + + /* Sanity check. */ + if (size > 0 && buf_read == 0) { + errnum = ERR_READ; + return 0; + } + } + + return ret; +} + +static int +tftp_dir_undi(char *dirname) +{ + int rc, ch; + uint16_t len; + + /* In TFTP, there is no way to know what files exist. */ + if (print_possibilities) + return 1; + + /* name may be space terminated */ + ch = nul_terminate(dirname); + saved_name = (char *)&saved_tp; + sprintf(saved_name, "%s", dirname); + + /* Restore the original dirname */ + dirname[grub_strlen (dirname)] = ch; + + /* get the file size; must call before tftp_open */ + rc = eb_pxenv_tftp_get_fsize(saved_name, arptable[ARP_SERVER].ipaddr, + arptable[ARP_GATEWAY].ipaddr, &filemax); + + /* open tftp session */ + if (eb_pxenv_tftp_open(saved_name, arptable[ARP_SERVER].ipaddr, + arptable[ARP_GATEWAY].ipaddr, &packetsize) == 0) + return (0); + + buf = (char *) FSYS_BUF; + buf_eof = 0; + buf_read = 0; + saved_filepos = 0; + + if (rc == 0) { + /* Read the entire file to get filemax */ + filemax = 0; + do { + /* Add the length of the downloaded data. */ + filemax += buf_read; + buf_read = 0; + if (! buf_fill (0)) { + errnum = ERR_READ; + return 0; + } + } while (! buf_eof); + + /* Maybe a few amounts of data remains. */ + filemax += buf_read; + + tftp_reopen_undi(); /* reopen file to read from beginning */ + } + + return (1); +} + +static void +tftp_close_undi(void) +{ + buf_read = 0; + buf_fill (1); + (void) eb_pxenv_tftp_close(); +} diff --git a/usr/src/grub/grub-0.97/netboot/grub.h b/usr/src/grub/grub-0.97/netboot/grub.h new file mode 100644 index 0000000000..3d0df44b0d --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/grub.h @@ -0,0 +1,171 @@ +#ifndef GRUB_H +#define GRUB_H + +#include "osdep.h" +#include "byteswap.h" +#include "in.h" +#include "ip.h" +#include "udp.h" +#include "if_ether.h" +#include "latch.h" +#include "io.h" +#include "nic.h" +#include + +#define K_ESC '\033' +#define K_EOF '\04' /* Ctrl-D */ +#define K_INTR '\03' /* Ctrl-C */ + +#ifndef MAX_RPC_RETRIES +#define MAX_RPC_RETRIES 20 +#endif + + +/* Inter-packet retry in ticks */ +#ifndef TIMEOUT +#define TIMEOUT (10*TICKS_PER_SEC) +#endif + +#ifndef NULL +#define NULL ((void *)0) +#endif + + +#define ARP_CLIENT 0 +#define ARP_SERVER 1 +#define ARP_GATEWAY 2 +#define MAX_ARP ARP_GATEWAY+1 + +#define IGMP_SERVER 0 +#define MAX_IGMP IGMP_SERVER+1 + +#define RARP_REQUEST 3 +#define RARP_REPLY 4 + + +#define MULTICAST_MASK 0xF0000000 +#define MULTICAST_NETWORK 0xE0000000 + +struct arptable_t { + in_addr ipaddr; + uint8_t node[6]; +}; + +struct igmptable_t { + in_addr group; + unsigned long time; +}; + +#define KERNEL_BUF (BOOTP_DATA_ADDR->bootp_reply.bp_file) + +#define FLOPPY_BOOT_LOCATION 0x7c00 +/* Must match offsets in loader.S */ +#define ROM_SEGMENT 0x1fa +#define ROM_LENGTH 0x1fc + +#define ROM_INFO_LOCATION (FLOPPY_BOOT_LOCATION+ROM_SEGMENT) +/* at end of floppy boot block */ + + + +/* Define a type for passing info to a loaded program */ +struct ebinfo { + uint8_t major, minor; /* Version */ + uint16_t flags; /* Bit flags */ +}; + +/*************************************************************************** +External prototypes +***************************************************************************/ +extern void rx_qdrain P((void)); +extern int tftp P((const char *name, int (*)(unsigned char *, unsigned int, unsigned int, int))); +extern int ip_transmit P((int len, const void *buf)); +extern void build_ip_hdr P((unsigned long destip, int ttl, int protocol, + int option_len, int len, const void *buf)); +extern void build_udp_hdr P((unsigned long destip, + unsigned int srcsock, unsigned int destsock, int ttl, + int len, const void *buf)); +extern int udp_transmit P((unsigned long destip, unsigned int srcsock, + unsigned int destsock, int len, const void *buf)); +typedef int (*reply_t)(int ival, void *ptr, unsigned short ptype, struct iphdr *ip, struct udphdr *udp); +extern int await_reply P((reply_t reply, int ival, void *ptr, long timeout)); +extern int decode_rfc1533 P((unsigned char *, unsigned int, unsigned int, int)); +extern void join_group(int slot, unsigned long group); +extern void leave_group(int slot); +#define RAND_MAX 2147483647L +extern uint16_t ipchksum P((const void *ip, unsigned long len)); +extern uint16_t add_ipchksums P((unsigned long offset, uint16_t sum, uint16_t new)); +extern int32_t random P((void)); +extern long rfc2131_sleep_interval P((long base, int exp)); +extern long rfc1112_sleep_interval P((long base, int exp)); +#ifndef DOWNLOAD_PROTO_TFTP +#define tftp(fname, load_block) 0 +#endif +extern void cleanup P((void)); + +/* misc.c */ +extern void twiddle P((void)); +extern void sleep P((int secs)); +extern void interruptible_sleep P((int secs)); +extern void poll_interruptions P((void)); +extern int strcasecmp P((const char *a, const char *b)); +extern char *substr P((const char *a, const char *b)); +extern unsigned long strtoul P((const char *p, const char **, int base)); +extern void printf P((const char *, ...)); +extern int sprintf P((char *, const char *, ...)); +extern int inet_aton P((char *p, in_addr *i)); +extern void putchar P((int)); +extern int getchar P((void)); +extern int iskey P((void)); + +extern void grub_printf(const char *, ...); +extern char config_file[128]; +extern void etherboot_printf(const char *, ...); +extern int etherboot_sprintf(char *, const char *, ...); +extern int getdec(char **s); +extern void cleanup_net(void); +extern void print_network_configuration (void); +extern int ifconfig (char *, char *, char *, char *); +extern struct arptable_t arptable[MAX_ARP]; + +#undef printf +#undef sprintf +#define printf etherboot_printf +#define sprintf etherboot_sprintf + +#ifdef DEBUG +#define EnterFunction(func) printf("Enter: " func "\n"); +#define LeaveFunction(func) printf("Leave: " func "\n"); +#else +#define EnterFunction(func) +#define LeaveFunction(func) +#endif + +/* + * Some codes from etherboot use a level in DEBUG. Define it to be + * zero means no debug info output, that will make them silence in + * compiling. Up it as you want. + */ +#ifndef DEBUG +# define DEBUG 0 +#endif + +/*#define RPC_DEBUG*/ + +extern char *hostname; + +extern int hostnamelen; +/* Whether network is ready */ +extern int network_ready; + +/* User aborted in await_reply if not zero */ +extern int user_abort; + +extern int rarp(void); +extern int grub_eth_probe(void); +extern int bootp(void); + +extern int dhcp(void); + +extern struct nic nic; +#endif /* GRUB_H */ diff --git a/usr/src/grub/grub-0.97/netboot/i386_byteswap.h b/usr/src/grub/grub-0.97/netboot/i386_byteswap.h new file mode 100644 index 0000000000..e7e8bbcd95 --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/i386_byteswap.h @@ -0,0 +1,46 @@ +#ifndef ETHERBOOT_BITS_BYTESWAP_H +#define ETHERBOOT_BITS_BYTESWAP_H + +#include "types.h" +static inline uint16_t __i386_bswap_16(uint16_t x) +{ + __asm__("xchgb %b0,%h0\n\t" + : "=q" (x) + : "0" (x)); + return x; +} + +static inline uint32_t __i386_bswap_32(uint32_t x) +{ + __asm__("xchgb %b0,%h0\n\t" + "rorl $16,%0\n\t" + "xchgb %b0,%h0" + : "=q" (x) + : "0" (x)); + return x; +} + + +#define __bswap_constant_16(x) \ + ((uint16_t)((((uint16_t)(x) & 0x00ff) << 8) | \ + (((uint16_t)(x) & 0xff00) >> 8))) + +#define __bswap_constant_32(x) \ + ((uint32_t)((((uint32_t)(x) & 0x000000ffU) << 24) | \ + (((uint32_t)(x) & 0x0000ff00U) << 8) | \ + (((uint32_t)(x) & 0x00ff0000U) >> 8) | \ + (((uint32_t)(x) & 0xff000000U) >> 24))) + +#define __bswap_16(x) \ + (__builtin_constant_p(x) ? \ + __bswap_constant_16(x) : \ + __i386_bswap_16(x)) + + +#define __bswap_32(x) \ + (__builtin_constant_p(x) ? \ + __bswap_constant_32(x) : \ + __i386_bswap_32(x)) + + +#endif /* ETHERBOOT_BITS_BYTESWAP_H */ diff --git a/usr/src/grub/grub-0.97/netboot/i386_elf.h b/usr/src/grub/grub-0.97/netboot/i386_elf.h new file mode 100644 index 0000000000..dad9c7b8fd --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/i386_elf.h @@ -0,0 +1,91 @@ +#ifndef I386_BITS_ELF_H +#define I386_BITS_ELF_H + +#include "cpu.h" + +#ifdef CONFIG_X86_64 +/* ELF Defines for the 64bit version of the current architecture */ +#define EM_CURRENT_64 EM_X86_64 +#define EM_CURRENT_64_PRESENT ( \ + CPU_FEATURE_P(cpu_info.x86_capability, LM) && \ + CPU_FEATURE_P(cpu_info.x86_capability, PAE) && \ + CPU_FEATURE_P(cpu_info.x86_capability, PSE)) + +#define ELF_CHECK_X86_64_ARCH(x) \ + (EM_CURRENT_64_PRESENT && ((x).e_machine == EM_X86_64)) +#define __unused_i386 +#else +#define ELF_CHECK_X86_64_ARCH(x) 0 +#define __unused_i386 __unused +#endif + + +/* ELF Defines for the current architecture */ +#define EM_CURRENT EM_386 +#define ELFDATA_CURRENT ELFDATA2LSB + +#define ELF_CHECK_I386_ARCH(x) \ + (((x).e_machine == EM_386) || ((x).e_machine == EM_486)) + +#define ELF_CHECK_ARCH(x) \ + ((ELF_CHECK_I386_ARCH(x) || ELF_CHECK_X86_64_ARCH(x)) && \ + ((x).e_entry <= 0xffffffffUL)) + +#ifdef IMAGE_FREEBSD +/* + * FreeBSD has this rather strange "feature" of its design. + * At some point in its evolution, FreeBSD started to rely + * externally on private/static/debug internal symbol information. + * That is, some of the interfaces that software uses to access + * and work with the FreeBSD kernel are made available not + * via the shared library symbol information (the .DYNAMIC section) + * but rather the debug symbols. This means that any symbol, not + * just publicly defined symbols can be (and are) used by system + * tools to make the system work. (such as top, swapinfo, swapon, + * etc) + * + * Even worse, however, is the fact that standard ELF loaders do + * not know how to load the symbols since they are not within + * an ELF PT_LOAD section. The kernel needs these symbols to + * operate so the following changes/additions to the boot + * loading of EtherBoot have been made to get the kernel to load. + * All of the changes are within IMAGE_FREEBSD such that the + * extra/changed code only compiles when FREEBSD support is + * enabled. + */ + +/* + * Section header for FreeBSD (debug symbol kludge!) support + */ +typedef struct { + Elf32_Word sh_name; /* Section name (index into the + section header string table). */ + Elf32_Word sh_type; /* Section type. */ + Elf32_Word sh_flags; /* Section flags. */ + Elf32_Addr sh_addr; /* Address in memory image. */ + Elf32_Off sh_offset; /* Offset in file. */ + Elf32_Size sh_size; /* Size in bytes. */ + Elf32_Word sh_link; /* Index of a related section. */ + Elf32_Word sh_info; /* Depends on section type. */ + Elf32_Size sh_addralign; /* Alignment in bytes. */ + Elf32_Size sh_entsize; /* Size of each entry in section. */ +} Elf32_Shdr; + +/* sh_type */ +#define SHT_SYMTAB 2 /* symbol table section */ +#define SHT_STRTAB 3 /* string table section */ + +/* + * Module information subtypes (for the metadata that we need to build) + */ +#define MODINFO_END 0x0000 /* End of list */ +#define MODINFO_NAME 0x0001 /* Name of module (string) */ +#define MODINFO_TYPE 0x0002 /* Type of module (string) */ +#define MODINFO_METADATA 0x8000 /* Module-specfic */ + +#define MODINFOMD_SSYM 0x0003 /* start of symbols */ +#define MODINFOMD_ESYM 0x0004 /* end of symbols */ + +#endif /* IMAGE_FREEBSD */ + +#endif /* I386_BITS_ELF_H */ diff --git a/usr/src/grub/grub-0.97/netboot/i386_endian.h b/usr/src/grub/grub-0.97/netboot/i386_endian.h new file mode 100644 index 0000000000..413e702dba --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/i386_endian.h @@ -0,0 +1,6 @@ +#ifndef ETHERBOOT_BITS_ENDIAN_H +#define ETHERBOOT_BITS_ENDIAN_H + +#define __BYTE_ORDER __LITTLE_ENDIAN + +#endif /* ETHERBOOT_BITS_ENDIAN_H */ diff --git a/usr/src/grub/grub-0.97/netboot/i386_timer.c b/usr/src/grub/grub-0.97/netboot/i386_timer.c new file mode 100644 index 0000000000..b5ad5e6f09 --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/i386_timer.c @@ -0,0 +1,192 @@ +/* A couple of routines to implement a low-overhead timer for drivers */ + + /* + * 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. + */ +#include "grub.h" +#include "osdep.h" +#include "io.h" +#include "timer.h" +#include "latch.h" + +void __load_timer2(unsigned int ticks) +{ + /* + * Now let's take care of PPC channel 2 + * + * Set the Gate high, program PPC channel 2 for mode 0, + * (interrupt on terminal count mode), binary count, + * load 5 * LATCH count, (LSB and MSB) to begin countdown. + * + * Note some implementations have a bug where the high bits byte + * of channel 2 is ignored. + */ + /* Set up the timer gate, turn off the speaker */ + /* Set the Gate high, disable speaker */ + outb((inb(PPC_PORTB) & ~PPCB_SPKR) | PPCB_T2GATE, PPC_PORTB); + /* binary, mode 0, LSB/MSB, Ch 2 */ + outb(TIMER2_SEL|WORD_ACCESS|MODE0|BINARY_COUNT, TIMER_MODE_PORT); + /* LSB of ticks */ + outb(ticks & 0xFF, TIMER2_PORT); + /* MSB of ticks */ + outb(ticks >> 8, TIMER2_PORT); +} + +static int __timer2_running(void) +{ + return ((inb(PPC_PORTB) & PPCB_T2OUT) == 0); +} + +#if !defined(CONFIG_TSC_CURRTICKS) +void setup_timers(void) +{ + return; +} + +void load_timer2(unsigned int ticks) +{ + return __load_timer2(ticks); +} + +int timer2_running(void) +{ + return __timer2_running(); +} + +void ndelay(unsigned int nsecs) +{ + waiton_timer2((nsecs * CLOCK_TICK_RATE)/1000000000); +} +void udelay(unsigned int usecs) +{ + waiton_timer2((usecs * TICKS_PER_MS)/1000); +} +#endif /* !defined(CONFIG_TSC_CURRTICKS) */ + +#if defined(CONFIG_TSC_CURRTICKS) + +#define rdtsc(low,high) \ + __asm__ __volatile__("rdtsc" : "=a" (low), "=d" (high)) + +#define rdtscll(val) \ + __asm__ __volatile__ ("rdtsc" : "=A" (val)) + + +/* Number of clock ticks to time with the rtc */ +#define LATCH 0xFF + +#define LATCHES_PER_SEC ((CLOCK_TICK_RATE + (LATCH/2))/LATCH) +#define TICKS_PER_LATCH ((LATCHES_PER_SEC + (TICKS_PER_SEC/2))/TICKS_PER_SEC) + +static void sleep_latch(void) +{ + __load_timer2(LATCH); + while(__timer2_running()); +} + +/* ------ Calibrate the TSC ------- + * Time how long it takes to excute a loop that runs in known time. + * And find the convertion needed to get to CLOCK_TICK_RATE + */ + + +static unsigned long long calibrate_tsc(void) +{ + unsigned long startlow, starthigh; + unsigned long endlow, endhigh; + + rdtsc(startlow,starthigh); + sleep_latch(); + rdtsc(endlow,endhigh); + + /* 64-bit subtract - gcc just messes up with long longs */ + __asm__("subl %2,%0\n\t" + "sbbl %3,%1" + :"=a" (endlow), "=d" (endhigh) + :"g" (startlow), "g" (starthigh), + "0" (endlow), "1" (endhigh)); + + /* Error: ECPUTOOFAST */ + if (endhigh) + goto bad_ctc; + + endlow *= TICKS_PER_LATCH; + return endlow; + + /* + * The CTC wasn't reliable: we got a hit on the very first read, + * or the CPU was so fast/slow that the quotient wouldn't fit in + * 32 bits.. + */ +bad_ctc: + printf("bad_ctc\n"); + return 0; +} + +static unsigned long clocks_per_tick; +void setup_timers(void) +{ + if (!clocks_per_tick) { + clocks_per_tick = calibrate_tsc(); + /* Display the CPU Mhz to easily test if the calibration was bad */ + printf("CPU %ld Mhz\n", (clocks_per_tick/1000 * TICKS_PER_SEC)/1000); + } +} + +unsigned long currticks(void) +{ + unsigned long clocks_high, clocks_low; + unsigned long currticks; + /* Read the Time Stamp Counter */ + rdtsc(clocks_low, clocks_high); + + /* currticks = clocks / clocks_per_tick; */ + __asm__("divl %1" + :"=a" (currticks) + :"r" (clocks_per_tick), "0" (clocks_low), "d" (clocks_high)); + + + return currticks; +} + +static unsigned long long timer_timeout; +static int __timer_running(void) +{ + unsigned long long now; + rdtscll(now); + return now < timer_timeout; +} + +void udelay(unsigned int usecs) +{ + unsigned long long now; + rdtscll(now); + timer_timeout = now + usecs * ((clocks_per_tick * TICKS_PER_SEC)/(1000*1000)); + while(__timer_running()); +} +void ndelay(unsigned int nsecs) +{ + unsigned long long now; + rdtscll(now); + timer_timeout = now + nsecs * ((clocks_per_tick * TICKS_PER_SEC)/(1000*1000*1000)); + while(__timer_running()); +} + +void load_timer2(unsigned int timer2_ticks) +{ + unsigned long long now; + unsigned long clocks; + rdtscll(now); + clocks = timer2_ticks * ((clocks_per_tick * TICKS_PER_SEC)/CLOCK_TICK_RATE); + timer_timeout = now + clocks; +} + +int timer2_running(void) +{ + return __timer_running(); +} + +#endif /* RTC_CURRTICKS */ diff --git a/usr/src/grub/grub-0.97/netboot/if_arp.h b/usr/src/grub/grub-0.97/netboot/if_arp.h new file mode 100644 index 0000000000..73b59a4c6c --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/if_arp.h @@ -0,0 +1,29 @@ +#ifndef _IF_ARP_H +#define _IF_ARP_H + +#include "types.h" + +#define ARP_REQUEST 1 +#define ARP_REPLY 2 + +#ifndef MAX_ARP_RETRIES +#define MAX_ARP_RETRIES 20 +#endif + +/* + * A pity sipaddr and tipaddr are not longword aligned or we could use + * in_addr. No, I don't want to use #pragma packed. + */ +struct arprequest { + uint16_t hwtype; + uint16_t protocol; + uint8_t hwlen; + uint8_t protolen; + uint16_t opcode; + uint8_t shwaddr[6]; + uint8_t sipaddr[4]; + uint8_t thwaddr[6]; + uint8_t tipaddr[4]; +}; + +#endif /* _IF_ARP_H */ diff --git a/usr/src/grub/grub-0.97/netboot/if_ether.h b/usr/src/grub/grub-0.97/netboot/if_ether.h new file mode 100644 index 0000000000..7a253dd5d5 --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/if_ether.h @@ -0,0 +1,21 @@ +#ifndef _IF_ETHER_H +#define _IF_ETHER_H + +/* + I'm moving towards the defined names in linux/if_ether.h for clarity. + The confusion between 60/64 and 1514/1518 arose because the NS8390 + counts the 4 byte frame checksum in the incoming packet, but not + in the outgoing packet. 60/1514 are the correct numbers for most + if not all of the other NIC controllers. +*/ + +#define ETH_ALEN 6 /* Size of Ethernet address */ +#define ETH_HLEN 14 /* Size of ethernet header */ +#define ETH_ZLEN 60 /* Minimum packet */ +#define ETH_FRAME_LEN 1514 /* Maximum packet */ +#define ETH_DATA_ALIGN 2 /* Amount needed to align the data after an ethernet header */ +#ifndef ETH_MAX_MTU +#define ETH_MAX_MTU (ETH_FRAME_LEN-ETH_HLEN) +#endif + +#endif /* _IF_ETHER_H */ diff --git a/usr/src/grub/grub-0.97/netboot/igmp.h b/usr/src/grub/grub-0.97/netboot/igmp.h new file mode 100644 index 0000000000..a83129092c --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/igmp.h @@ -0,0 +1,27 @@ +#ifndef _IGMP_H +#define _IGMP_H + +/* Max interval between IGMP packets */ +#define IGMP_INTERVAL (10*TICKS_PER_SEC) +#define IGMPv1_ROUTER_PRESENT_TIMEOUT (400*TICKS_PER_SEC) + +#define IGMP_QUERY 0x11 +#define IGMPv1_REPORT 0x12 +#define IGMPv2_REPORT 0x16 +#define IGMP_LEAVE 0x17 +#define GROUP_ALL_HOSTS 0xe0000001 /* 224.0.0.1 Host byte order */ + +struct igmp { + uint8_t type; + uint8_t response_time; + uint16_t chksum; + in_addr group; +}; + +struct igmp_ip_t { /* Format of an igmp ip packet */ + struct iphdr ip; + uint8_t router_alert[4]; /* Router alert option */ + struct igmp igmp; +}; + +#endif /* _IGMP_H */ diff --git a/usr/src/grub/grub-0.97/netboot/in.h b/usr/src/grub/grub-0.97/netboot/in.h new file mode 100644 index 0000000000..e6d29f4db8 --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/in.h @@ -0,0 +1,21 @@ +#ifndef _IN_H +#define _IN_H + +#include "types.h" + +#define IP 0x0800 +#define ARP 0x0806 +#define RARP 0x8035 + +#define IP_ICMP 1 +#define IP_IGMP 2 +#define IP_UDP 17 + +/* Same after going through htonl */ +#define IP_BROADCAST 0xFFFFFFFF + +typedef struct { + uint32_t s_addr; +} in_addr; + +#endif /* _IN_H */ diff --git a/usr/src/grub/grub-0.97/netboot/io.h b/usr/src/grub/grub-0.97/netboot/io.h new file mode 100644 index 0000000000..a6e4880e3f --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/io.h @@ -0,0 +1,239 @@ +#ifndef IO_H +#define IO_H + + +/* Amount of relocation etherboot is experiencing */ +extern unsigned long virt_offset; + +/* Don't require identity mapped physical memory, + * osloader.c is the only valid user at the moment. + */ +unsigned long virt_to_phys(volatile const void *virt_addr); +void *phys_to_virt(unsigned long phys_addr); + +/* virt_to_bus converts an addresss inside of etherboot [_start, _end] + * into a memory access cards can use. + */ +#define virt_to_bus virt_to_phys + + +/* bus_to_virt reverses virt_to_bus, the address must be output + * from virt_to_bus to be valid. This function does not work on + * all bus addresses. + */ +#define bus_to_virt phys_to_virt + +/* ioremap converts a random 32bit bus address into something + * etherboot can access. + */ +static inline void *ioremap(unsigned long bus_addr, unsigned long length __unused) +{ + return bus_to_virt(bus_addr); +} + +/* iounmap cleans up anything ioremap had to setup */ +static inline void iounmap(void *virt_addr __unused) +{ + return; +} + +/* + * This file contains the definitions for the x86 IO instructions + * inb/inw/inl/outb/outw/outl and the "string versions" of the same + * (insb/insw/insl/outsb/outsw/outsl). You can also use "pausing" + * versions of the single-IO instructions (inb_p/inw_p/..). + * + * This file is not meant to be obfuscating: it's just complicated + * to (a) handle it all in a way that makes gcc able to optimize it + * as well as possible and (b) trying to avoid writing the same thing + * over and over again with slight variations and possibly making a + * mistake somewhere. + */ + +/* + * Thanks to James van Artsdalen for a better timing-fix than + * the two short jumps: using outb's to a nonexistent port seems + * to guarantee better timings even on fast machines. + * + * On the other hand, I'd like to be sure of a non-existent port: + * I feel a bit unsafe about using 0x80 (should be safe, though) + * + * Linus + */ + +#ifdef SLOW_IO_BY_JUMPING +#define __SLOW_DOWN_IO __asm__ __volatile__("jmp 1f\n1:\tjmp 1f\n1:") +#else +#define __SLOW_DOWN_IO __asm__ __volatile__("outb %al,$0x80") +#endif + +#ifdef REALLY_SLOW_IO +#define SLOW_DOWN_IO { __SLOW_DOWN_IO; __SLOW_DOWN_IO; __SLOW_DOWN_IO; __SLOW_DOWN_IO; } +#else +#define SLOW_DOWN_IO __SLOW_DOWN_IO +#endif + +/* + * readX/writeX() are used to access memory mapped devices. On some + * architectures the memory mapped IO stuff needs to be accessed + * differently. On the x86 architecture, we just read/write the + * memory location directly. + */ +#define readb(addr) (*(volatile unsigned char *) (addr)) +#define readw(addr) (*(volatile unsigned short *) (addr)) +#define readl(addr) (*(volatile unsigned int *) (addr)) + +#define writeb(b,addr) ((*(volatile unsigned char *) (addr)) = (b)) +#define writew(b,addr) ((*(volatile unsigned short *) (addr)) = (b)) +#define writel(b,addr) ((*(volatile unsigned int *) (addr)) = (b)) + +#define memcpy_fromio(a,b,c) memcpy((a),(void *)(b),(c)) +#define memcpy_toio(a,b,c) memcpy((void *)(a),(b),(c)) + +/* + * Force strict CPU ordering. + * And yes, this is required on UP too when we're talking + * to devices. + * + * For now, "wmb()" doesn't actually do anything, as all + * Intel CPU's follow what Intel calls a *Processor Order*, + * in which all writes are seen in the program order even + * outside the CPU. + * + * I expect future Intel CPU's to have a weaker ordering, + * but I'd also expect them to finally get their act together + * and add some real memory barriers if so. + * + * Some non intel clones support out of order store. wmb() ceases to be a + * nop for these. + */ + +#define mb() __asm__ __volatile__ ("lock; addl $0,0(%%esp)": : :"memory") +#define rmb() mb() +#define wmb() mb(); + + +/* + * Talk about misusing macros.. + */ + +#define __OUT1(s,x) \ +extern void __out##s(unsigned x value, unsigned short port); \ +extern inline void __out##s(unsigned x value, unsigned short port) { + +#define __OUT2(s,s1,s2) \ +__asm__ __volatile__ ("out" #s " %" s1 "0,%" s2 "1" + +#define __OUT(s,s1,x) \ +__OUT1(s,x) __OUT2(s,s1,"w") : : "a" (value), "d" (port)); } \ +__OUT1(s##c,x) __OUT2(s,s1,"") : : "a" (value), "id" (port)); } \ +__OUT1(s##_p,x) __OUT2(s,s1,"w") : : "a" (value), "d" (port)); SLOW_DOWN_IO; } \ +__OUT1(s##c_p,x) __OUT2(s,s1,"") : : "a" (value), "id" (port)); SLOW_DOWN_IO; } + +#define __IN1(s,x) \ +extern unsigned x __in##s(unsigned short port); \ +extern inline unsigned x __in##s(unsigned short port) { unsigned x _v; + +#define __IN2(s,s1,s2) \ +__asm__ __volatile__ ("in" #s " %" s2 "1,%" s1 "0" + +#define __IN(s,s1,x,i...) \ +__IN1(s,x) __IN2(s,s1,"w") : "=a" (_v) : "d" (port) ,##i ); return _v; } \ +__IN1(s##c,x) __IN2(s,s1,"") : "=a" (_v) : "id" (port) ,##i ); return _v; } \ +__IN1(s##_p,x) __IN2(s,s1,"w") : "=a" (_v) : "d" (port) ,##i ); SLOW_DOWN_IO; return _v; } \ +__IN1(s##c_p,x) __IN2(s,s1,"") : "=a" (_v) : "id" (port) ,##i ); SLOW_DOWN_IO; return _v; } + +#define __INS(s) \ +extern void ins##s(unsigned short port, void * addr, unsigned long count); \ +extern inline void ins##s(unsigned short port, void * addr, unsigned long count) \ +{ __asm__ __volatile__ ("cld ; rep ; ins" #s \ +: "=D" (addr), "=c" (count) : "d" (port),"0" (addr),"1" (count)); } + +#define __OUTS(s) \ +extern void outs##s(unsigned short port, const void * addr, unsigned long count); \ +extern inline void outs##s(unsigned short port, const void * addr, unsigned long count) \ +{ __asm__ __volatile__ ("cld ; rep ; outs" #s \ +: "=S" (addr), "=c" (count) : "d" (port),"0" (addr),"1" (count)); } + +__IN(b,"", char) +__IN(w,"",short) +__IN(l,"", long) + +__OUT(b,"b",char) +__OUT(w,"w",short) +__OUT(l,,int) + +__INS(b) +__INS(w) +__INS(l) + +__OUTS(b) +__OUTS(w) +__OUTS(l) + +/* + * Note that due to the way __builtin_constant_p() works, you + * - can't use it inside a inline function (it will never be true) + * - you don't have to worry about side effects within the __builtin.. + */ +#define outb(val,port) \ +((__builtin_constant_p((port)) && (port) < 256) ? \ + __outbc((val),(port)) : \ + __outb((val),(port))) + +#define inb(port) \ +((__builtin_constant_p((port)) && (port) < 256) ? \ + __inbc(port) : \ + __inb(port)) + +#define outb_p(val,port) \ +((__builtin_constant_p((port)) && (port) < 256) ? \ + __outbc_p((val),(port)) : \ + __outb_p((val),(port))) + +#define inb_p(port) \ +((__builtin_constant_p((port)) && (port) < 256) ? \ + __inbc_p(port) : \ + __inb_p(port)) + +#define outw(val,port) \ +((__builtin_constant_p((port)) && (port) < 256) ? \ + __outwc((val),(port)) : \ + __outw((val),(port))) + +#define inw(port) \ +((__builtin_constant_p((port)) && (port) < 256) ? \ + __inwc(port) : \ + __inw(port)) + +#define outw_p(val,port) \ +((__builtin_constant_p((port)) && (port) < 256) ? \ + __outwc_p((val),(port)) : \ + __outw_p((val),(port))) + +#define inw_p(port) \ +((__builtin_constant_p((port)) && (port) < 256) ? \ + __inwc_p(port) : \ + __inw_p(port)) + +#define outl(val,port) \ +((__builtin_constant_p((port)) && (port) < 256) ? \ + __outlc((val),(port)) : \ + __outl((val),(port))) + +#define inl(port) \ +((__builtin_constant_p((port)) && (port) < 256) ? \ + __inlc(port) : \ + __inl(port)) + +#define outl_p(val,port) \ +((__builtin_constant_p((port)) && (port) < 256) ? \ + __outlc_p((val),(port)) : \ + __outl_p((val),(port))) + +#define inl_p(port) \ +((__builtin_constant_p((port)) && (port) < 256) ? \ + __inlc_p(port) : \ + __inl_p(port)) + +#endif /* ETHERBOOT_IO_H */ diff --git a/usr/src/grub/grub-0.97/netboot/ip.h b/usr/src/grub/grub-0.97/netboot/ip.h new file mode 100644 index 0000000000..496134e1e5 --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/ip.h @@ -0,0 +1,36 @@ +#ifndef _IP_H +#define _IP_H + +/* We need 'uint16_t' */ +#include "types.h" +/* We need 'in_addr' */ +#include "in.h" + +struct iphdr { + uint8_t verhdrlen; + uint8_t service; + uint16_t len; + uint16_t ident; + uint16_t frags; + uint8_t ttl; + uint8_t protocol; + uint16_t chksum; + in_addr src; + in_addr dest; +}; + +extern void build_ip_hdr(unsigned long __destip, int __ttl, int __protocol, + int __option_len, int __len, const void * __buf); + +extern int ip_transmit(int __len, const void * __buf); + +extern uint16_t ipchksum(const void * __data, unsigned long __length); + +extern uint16_t add_ipchksums(unsigned long __offset, uint16_t __sum, + uint16_t __new); + + + + + +#endif /* _IP_H */ diff --git a/usr/src/grub/grub-0.97/netboot/isa.h b/usr/src/grub/grub-0.97/netboot/isa.h new file mode 100644 index 0000000000..e0e85cdf1d --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/isa.h @@ -0,0 +1,27 @@ +#if !defined(ISA_H) && defined(CONFIG_ISA) +#define ISA_H + +struct dev; + +#define ISAPNP_VENDOR(a,b,c) (((((a)-'A'+1)&0x3f)<<2)|\ + ((((b)-'A'+1)&0x18)>>3)|((((b)-'A'+1)&7)<<13)|\ + ((((c)-'A'+1)&0x1f)<<8)) + +#define GENERIC_ISAPNP_VENDOR ISAPNP_VENDOR('P','N','P') + +struct isa_driver +{ + int type; + const char *name; + int (*probe)(struct dev *, unsigned short *); + unsigned short *ioaddrs; +}; + +#define __isa_driver __attribute__ ((unused,__section__(".drivers.isa"))) +extern const struct isa_driver isa_drivers[]; +extern const struct isa_driver isa_drivers_end[]; + +#define ISA_ROM(IMAGE, DESCRIPTION) + +#endif /* ISA_H */ + diff --git a/usr/src/grub/grub-0.97/netboot/latch.h b/usr/src/grub/grub-0.97/netboot/latch.h new file mode 100644 index 0000000000..38a8bd211d --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/latch.h @@ -0,0 +1,10 @@ +#ifndef LATCH_H +#define LATCH_H + +#define TICKS_PER_SEC 18 + +/* For different calibrators of the TSC move the declaration of + * sleep_latch and the definitions of it's length here... + */ + +#endif /* LATCH_H */ diff --git a/usr/src/grub/grub-0.97/netboot/little_bswap.h b/usr/src/grub/grub-0.97/netboot/little_bswap.h new file mode 100644 index 0000000000..35918530b4 --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/little_bswap.h @@ -0,0 +1,17 @@ +#ifndef ETHERBOOT_LITTLE_BSWAP_H +#define ETHERBOOT_LITTLE_BSWAP_H + +#define ntohl(x) __bswap_32(x) +#define htonl(x) __bswap_32(x) +#define ntohs(x) __bswap_16(x) +#define htons(x) __bswap_16(x) +#define cpu_to_le32(x) (x) +#define cpu_to_le16(x) (x) +#define cpu_to_be32(x) __bswap_32(x) +#define cpu_to_be16(x) __bswap_16(x) +#define le32_to_cpu(x) (x) +#define le16_to_cpu(x) (x) +#define be32_to_cpu(x) __bswap_32(x) +#define be16_to_cpu(x) __bswap_16(x) + +#endif /* ETHERBOOT_LITTLE_BSWAP_H */ diff --git a/usr/src/grub/grub-0.97/netboot/mii.h b/usr/src/grub/grub-0.97/netboot/mii.h new file mode 100644 index 0000000000..34c1ca9b13 --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/mii.h @@ -0,0 +1,105 @@ +/* + * linux/mii.h: definitions for MII-compatible transceivers + * Originally drivers/net/sunhme.h. + * + * Copyright (C) 1996, 1999, 2001 David S. Miller (davem@redhat.com) + * + * Copied Form Linux 2.4.25 an unneeded items removed by: + * Timothy Legge (timlegge at etherboot dot org) + * + * 03/26/2004 + */ + +/* 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_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 0x007f /* Unused... */ +#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 0x07c0 /* Unused... */ +#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_10FULL 0x0040 /* Try for 10mbps full-duplex */ +#define ADVERTISE_100HALF 0x0080 /* Try for 100mbps half-duplex */ +#define ADVERTISE_100FULL 0x0100 /* Try for 100mbps full-duplex */ +#define ADVERTISE_100BASE4 0x0200 /* Try for 100mbps 4k packets */ +#define ADVERTISE_RESV 0x1c00 /* 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_10FULL 0x0040 /* Can do 10mbps full-duplex */ +#define LPA_100HALF 0x0080 /* Can do 100mbps half-duplex */ +#define LPA_100FULL 0x0100 /* Can do 100mbps full-duplex */ +#define LPA_100BASE4 0x0200 /* Can do 100mbps 4k packets */ +#define LPA_RESV 0x1c00 /* 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... */ + +/* N-way test register. */ +#define NWAYTEST_RESV1 0x00ff /* Unused... */ +#define NWAYTEST_LOOPBACK 0x0100 /* Enable loopback for N-way */ +#define NWAYTEST_RESV2 0xfe00 /* Unused... */ + diff --git a/usr/src/grub/grub-0.97/netboot/misc.c b/usr/src/grub/grub-0.97/netboot/misc.c new file mode 100644 index 0000000000..339ef8e602 --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/misc.c @@ -0,0 +1,321 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2000,2001,2002 Free Software Foundation, 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 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. + */ + +/* Based on "src/misc.c" in etherboot-5.0.5. */ + +#include "grub.h" +#include "timer.h" + +#include "nic.h" + +/************************************************************************** +RANDOM - compute a random number between 0 and 2147483647L or 2147483562? +**************************************************************************/ +int32_t random(void) +{ + static int32_t seed = 0; + int32_t q; + if (!seed) /* Initialize linear congruential generator */ + seed = currticks() + *(int32_t *)&arptable[ARP_CLIENT].node + + ((int16_t *)arptable[ARP_CLIENT].node)[2]; + /* simplified version of the LCG given in Bruce Schneier's + "Applied Cryptography" */ + q = seed/53668; + if ((seed = 40014*(seed-53668*q) - 12211*q) < 0) seed += 2147483563L; + return seed; +} + +/************************************************************************** +POLL INTERRUPTIONS +**************************************************************************/ +void poll_interruptions(void) +{ + if (checkkey() != -1 && ASCII_CHAR(getkey()) == K_INTR) { + user_abort++; + } +} + +/************************************************************************** +SLEEP +**************************************************************************/ +void sleep(int secs) +{ + unsigned long tmo; + + for (tmo = currticks()+secs*TICKS_PER_SEC; currticks() < tmo; ) { + poll_interruptions(); + } +} + +/************************************************************************** +INTERRUPTIBLE SLEEP +**************************************************************************/ +void interruptible_sleep(int secs) +{ + printf("\n"); + return sleep(secs); +} + +/************************************************************************** +TWIDDLE +**************************************************************************/ +void twiddle(void) +{ +#ifdef BAR_PROGRESS + static int count=0; + static const char tiddles[]="-\\|/"; + static unsigned long lastticks = 0; + unsigned long ticks; +#endif +#ifdef FREEBSD_PXEEMU + extern char pxeemu_nbp_active; + if(pxeemu_nbp_active != 0) + return; +#endif +#ifdef BAR_PROGRESS + /* Limit the maximum rate at which characters are printed */ + ticks = currticks(); + if ((lastticks + (TICKS_PER_SEC/18)) > ticks) + return; + lastticks = ticks; + + putchar(tiddles[(count++)&3]); + putchar('\b'); +#else + //putchar('.'); +#endif /* BAR_PROGRESS */ +} + + +/* Because Etherboot uses its own formats for the printf family, + define separate definitions from GRUB. */ +/************************************************************************** +PRINTF and friends + + Formats: + %[#]x - 4 bytes long (8 hex digits, lower case) + %[#]X - 4 bytes long (8 hex digits, upper case) + %[#]hx - 2 bytes int (4 hex digits, lower case) + %[#]hX - 2 bytes int (4 hex digits, upper case) + %[#]hhx - 1 byte int (2 hex digits, lower case) + %[#]hhX - 1 byte int (2 hex digits, upper case) + - optional # prefixes 0x or 0X + %d - decimal int + %c - char + %s - string + %@ - Internet address in ddd.ddd.ddd.ddd notation + %! - Ethernet address in xx:xx:xx:xx:xx:xx notation + Note: width specification not supported +**************************************************************************/ +static int +etherboot_vsprintf (char *buf, const char *fmt, const int *dp) +{ + char *p, *s; + + s = buf; + for ( ; *fmt != '\0'; ++fmt) + { + if (*fmt != '%') + { + buf ? *s++ = *fmt : grub_putchar (*fmt); + continue; + } + + if (*++fmt == 's') + { + for (p = (char *) *dp++; *p != '\0'; p++) + buf ? *s++ = *p : grub_putchar (*p); + } + else + { + /* Length of item is bounded */ + char tmp[20], *q = tmp; + int alt = 0; + int shift = 28; + + if (*fmt == '#') + { + alt = 1; + fmt++; + } + + if (*fmt == 'h') + { + shift = 12; + fmt++; + } + + if (*fmt == 'h') + { + shift = 4; + fmt++; + } + + /* + * Before each format q points to tmp buffer + * After each format q points past end of item + */ + if ((*fmt | 0x20) == 'x') + { + /* With x86 gcc, sizeof(long) == sizeof(int) */ + const long *lp = (const long *) dp; + long h = *lp++; + int ncase = (*fmt & 0x20); + + dp = (const int *) lp; + if (alt) + { + *q++ = '0'; + *q++ = 'X' | ncase; + } + for (; shift >= 0; shift -= 4) + *q++ = "0123456789ABCDEF"[(h >> shift) & 0xF] | ncase; + } + else if (*fmt == 'd') + { + int i = *dp++; + char *r; + + if (i < 0) + { + *q++ = '-'; + i = -i; + } + + p = q; /* save beginning of digits */ + do + { + *q++ = '0' + (i % 10); + i /= 10; + } + while (i); + + /* reverse digits, stop in middle */ + r = q; /* don't alter q */ + while (--r > p) + { + i = *r; + *r = *p; + *p++ = i; + } + } + else if (*fmt == '@') + { + unsigned char *r; + union + { + long l; + unsigned char c[4]; + } + u; + const long *lp = (const long *) dp; + + u.l = *lp++; + dp = (const int *) lp; + + for (r = &u.c[0]; r < &u.c[4]; ++r) + q += etherboot_sprintf (q, "%d.", *r); + + --q; + } + else if (*fmt == '!') + { + char *r; + p = (char *) *dp++; + + for (r = p + ETH_ALEN; p < r; ++p) + q += etherboot_sprintf (q, "%hhX:", *p); + + --q; + } + else if (*fmt == 'c') + *q++ = *dp++; + else + *q++ = *fmt; + + /* now output the saved string */ + for (p = tmp; p < q; ++p) + buf ? *s++ = *p : grub_putchar (*p); + } + } + + if (buf) + *s = '\0'; + + return (s - buf); +} + +int +etherboot_sprintf (char *buf, const char *fmt, ...) +{ + return etherboot_vsprintf (buf, fmt, ((const int *) &fmt) + 1); +} + +void +etherboot_printf (const char *fmt, ...) +{ + (void) etherboot_vsprintf (0, fmt, ((const int *) &fmt) + 1); +} + +int +inet_aton (char *p, in_addr *addr) +{ + unsigned long ip = 0; + int val; + int i; + + for (i = 0; i < 4; i++) + { + val = getdec (&p); + + if (val < 0 || val > 255) + return 0; + + if (i != 3 && *p++ != '.') + return 0; + + ip = (ip << 8) | val; + } + + addr->s_addr = htonl (ip); + + return 1; +} + +int +getdec (char **ptr) +{ + char *p = *ptr; + int ret = 0; + + if (*p < '0' || *p > '9') + return -1; + + while (*p >= '0' && *p <= '9') + { + ret = ret * 10 + (*p - '0'); + p++; + } + + *ptr = p; + + return ret; +} + + diff --git a/usr/src/grub/grub-0.97/netboot/natsemi.c b/usr/src/grub/grub-0.97/netboot/natsemi.c new file mode 100644 index 0000000000..9e2e22f4ef --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/natsemi.c @@ -0,0 +1,780 @@ +/* -*- Mode:C; c-basic-offset:4; -*- */ + +/* + natsemi.c: An Etherboot driver for the NatSemi DP8381x series. + + Copyright (C) 2001 Entity Cyber, Inc. + + This development of this Etherboot driver was funded by + + Sicom Systems: http://www.sicompos.com/ + + Author: Marty Connor (mdc@thinguin.org) + Adapted from a Linux driver which was written by Donald Becker + + This software may be used and distributed according to the terms + of the GNU Public License (GPL), incorporated herein by reference. + + Original Copyright Notice: + + Written/copyright 1999-2001 by Donald Becker. + + This software may be used and distributed according to the terms of + the GNU General Public License (GPL), incorporated herein by reference. + Drivers based on or derived from this code fall under the GPL and must + retain the authorship, copyright and license notice. This file is not + a complete program and may only be used when the entire operating + system is licensed under the GPL. License for under other terms may be + available. Contact the original author for details. + + The original author may be reached as becker@scyld.com, or at + Scyld Computing Corporation + 410 Severn Ave., Suite 210 + Annapolis MD 21403 + + Support information and updates available at + http://www.scyld.com/network/netsemi.html + + References: + + http://www.scyld.com/expert/100mbps.html + http://www.scyld.com/expert/NWay.html + Datasheet is available from: + http://www.national.com/pf/DP/DP83815.html + +*/ + +/* Revision History */ + +/* + 13 Dec 2003 timlegge 1.1 Enabled Multicast Support + 29 May 2001 mdc 1.0 + Initial Release. Tested with Netgear FA311 and FA312 boards +*/ +/* Includes */ + +#include "etherboot.h" +#include "nic.h" +#include "pci.h" + +/* defines */ + +#define OWN 0x80000000 +#define DSIZE 0x00000FFF +#define CRC_SIZE 4 + +/* Time in ticks before concluding the transmitter is hung. */ +#define TX_TIMEOUT (4*TICKS_PER_SEC) + +#define TX_BUF_SIZE 1536 +#define RX_BUF_SIZE 1536 + +#define NUM_RX_DESC 4 /* Number of Rx descriptor registers. */ + +typedef uint8_t u8; +typedef int8_t s8; +typedef uint16_t u16; +typedef int16_t s16; +typedef uint32_t u32; +typedef int32_t s32; + +/* helpful macroes if on a big_endian machine for changing byte order. + not strictly needed on Intel */ +#define get_unaligned(ptr) (*(ptr)) +#define put_unaligned(val, ptr) ((void)( *(ptr) = (val) )) +#define get_u16(ptr) (*(u16 *)(ptr)) +#define virt_to_le32desc(addr) virt_to_bus(addr) + +enum pcistuff { + PCI_USES_IO = 0x01, + PCI_USES_MEM = 0x02, + PCI_USES_MASTER = 0x04, + PCI_ADDR0 = 0x08, + PCI_ADDR1 = 0x10, +}; + +/* MMIO operations required */ +#define PCI_IOTYPE (PCI_USES_MASTER | PCI_USES_MEM | PCI_ADDR1) + +/* Offsets to the device registers. + Unlike software-only systems, device drivers interact with complex hardware. + It's not useful to define symbolic names for every register bit in the + device. +*/ +enum register_offsets { + ChipCmd = 0x00, + ChipConfig = 0x04, + EECtrl = 0x08, + PCIBusCfg = 0x0C, + IntrStatus = 0x10, + IntrMask = 0x14, + IntrEnable = 0x18, + TxRingPtr = 0x20, + TxConfig = 0x24, + RxRingPtr = 0x30, + RxConfig = 0x34, + ClkRun = 0x3C, + WOLCmd = 0x40, + PauseCmd = 0x44, + RxFilterAddr = 0x48, + RxFilterData = 0x4C, + BootRomAddr = 0x50, + BootRomData = 0x54, + SiliconRev = 0x58, + StatsCtrl = 0x5C, + StatsData = 0x60, + RxPktErrs = 0x60, + RxMissed = 0x68, + RxCRCErrs = 0x64, + PCIPM = 0x44, + PhyStatus = 0xC0, + MIntrCtrl = 0xC4, + MIntrStatus = 0xC8, + + /* These are from the spec, around page 78... on a separate table. */ + PGSEL = 0xCC, + PMDCSR = 0xE4, + TSTDAT = 0xFC, + DSPCFG = 0xF4, + SDCFG = 0x8C +}; + +/* Bit in ChipCmd. */ +enum ChipCmdBits { + ChipReset = 0x100, + RxReset = 0x20, + TxReset = 0x10, + RxOff = 0x08, + RxOn = 0x04, + TxOff = 0x02, + TxOn = 0x01 +}; + +/* Bits in the RxMode register. */ +enum rx_mode_bits { + AcceptErr = 0x20, + AcceptRunt = 0x10, + AcceptBroadcast = 0xC0000000, + AcceptMulticast = 0x00200000, + AcceptAllMulticast = 0x20000000, + AcceptAllPhys = 0x10000000, + AcceptMyPhys = 0x08000000, + RxFilterEnable = 0x80000000 +}; + +typedef struct _BufferDesc { + u32 link; + volatile u32 cmdsts; + u32 bufptr; + u32 software_use; +} BufferDesc; + +/* Bits in network_desc.status */ +enum desc_status_bits { + DescOwn = 0x80000000, + DescMore = 0x40000000, + DescIntr = 0x20000000, + DescNoCRC = 0x10000000, + DescPktOK = 0x08000000, + RxTooLong = 0x00400000 +}; + +/* Globals */ + +static int natsemi_debug = 1; /* 1 normal messages, 0 quiet .. 7 verbose. */ + +const char *nic_name; + +static u32 SavedClkRun; + + +static unsigned short vendor, dev_id; +static unsigned long ioaddr; + +static unsigned int cur_rx; + +static unsigned int advertising; + +static unsigned int rx_config; +static unsigned int tx_config; + +/* Note: transmit and receive buffers and descriptors must be + longword aligned +*/ + +static BufferDesc txd __attribute__ ((aligned(4))); +static BufferDesc rxd[NUM_RX_DESC] __attribute__ ((aligned(4))); + +static unsigned char txb[TX_BUF_SIZE] __attribute__ ((aligned(4))); +static unsigned char rxb[NUM_RX_DESC * RX_BUF_SIZE] __attribute__ ((aligned(4))); + +/* Function Prototypes */ + +static int natsemi_probe(struct dev *dev, struct pci_device *pci); +static int eeprom_read(long addr, int location); +static int mdio_read(int phy_id, int location); +static void natsemi_init(struct nic *nic); +static void natsemi_reset(struct nic *nic); +static void natsemi_init_rxfilter(struct nic *nic); +static void natsemi_init_txd(struct nic *nic); +static void natsemi_init_rxd(struct nic *nic); +static void natsemi_set_rx_mode(struct nic *nic); +static void natsemi_check_duplex(struct nic *nic); +static void natsemi_transmit(struct nic *nic, const char *d, unsigned int t, unsigned int s, const char *p); +static int natsemi_poll(struct nic *nic, int retrieve); +static void natsemi_disable(struct dev *dev); +static void natsemi_irq(struct nic *nic, irq_action_t action); + +/* + * Function: natsemi_probe + * + * Description: Retrieves the MAC address of the card, and sets up some + * globals required by other routines, and initializes the NIC, making it + * ready to send and receive packets. + * + * Side effects: + * leaves the ioaddress of the natsemi chip in the variable ioaddr. + * leaves the natsemi initialized, and ready to recieve packets. + * + * Returns: struct nic *: pointer to NIC data structure + */ + +static int +natsemi_probe(struct dev *dev, struct pci_device *pci) +{ + struct nic *nic = (struct nic *)dev; + int i; + int prev_eedata; + u32 tmp; + + if (pci->ioaddr == 0) + return 0; + + adjust_pci_device(pci); + + /* initialize some commonly used globals */ + + nic->irqno = 0; + nic->ioaddr = pci->ioaddr & ~3; + + ioaddr = pci->ioaddr & ~3; + vendor = pci->vendor; + dev_id = pci->dev_id; + nic_name = pci->name; + + /* natsemi has a non-standard PM control register + * in PCI config space. Some boards apparently need + * to be brought to D0 in this manner. + */ + pcibios_read_config_dword(pci->bus, pci->devfn, PCIPM, &tmp); + if (tmp & (0x03|0x100)) { + /* D0 state, disable PME assertion */ + u32 newtmp = tmp & ~(0x03|0x100); + pcibios_write_config_dword(pci->bus, pci->devfn, PCIPM, newtmp); + } + + /* get MAC address */ + + prev_eedata = eeprom_read(ioaddr, 6); + for (i = 0; i < 3; i++) { + int eedata = eeprom_read(ioaddr, i + 7); + nic->node_addr[i*2] = (eedata << 1) + (prev_eedata >> 15); + nic->node_addr[i*2+1] = eedata >> 7; + prev_eedata = eedata; + } + + printf("\nnatsemi_probe: MAC addr %! at ioaddr %#hX\n", + nic->node_addr, ioaddr); + printf("natsemi_probe: Vendor:%#hX Device:%#hX\n", vendor, dev_id); + + /* Reset the chip to erase any previous misconfiguration. */ + outl(ChipReset, ioaddr + ChipCmd); + + advertising = mdio_read(1, 4); + { + u32 chip_config = inl(ioaddr + ChipConfig); + printf("%s: Transceiver default autoneg. %s " + "10%s %s duplex.\n", + nic_name, + chip_config & 0x2000 ? "enabled, advertise" : "disabled, force", + chip_config & 0x4000 ? "0" : "", + chip_config & 0x8000 ? "full" : "half"); + } + printf("%s: Transceiver status %hX advertising %hX\n", + nic_name, (int)inl(ioaddr + 0x84), advertising); + + /* Disable PME: + * The PME bit is initialized from the EEPROM contents. + * PCI cards probably have PME disabled, but motherboard + * implementations may have PME set to enable WakeOnLan. + * With PME set the chip will scan incoming packets but + * nothing will be written to memory. */ + SavedClkRun = inl(ioaddr + ClkRun); + outl(SavedClkRun & ~0x100, ioaddr + ClkRun); + + /* initialize device */ + natsemi_init(nic); + + dev->disable = natsemi_disable; + nic->poll = natsemi_poll; + nic->transmit = natsemi_transmit; + nic->irq = natsemi_irq; + + return 1; +} + +/* Read the EEPROM and MII Management Data I/O (MDIO) interfaces. + The EEPROM code is for the common 93c06/46 EEPROMs with 6 bit addresses. +*/ + +/* Delay between EEPROM clock transitions. + No extra delay is needed with 33Mhz PCI, but future 66Mhz access may need + a delay. */ +#define eeprom_delay(ee_addr) inl(ee_addr) + +enum EEPROM_Ctrl_Bits { + EE_ShiftClk = 0x04, + EE_DataIn = 0x01, + EE_ChipSelect = 0x08, + EE_DataOut = 0x02 +}; + +#define EE_Write0 (EE_ChipSelect) +#define EE_Write1 (EE_ChipSelect | EE_DataIn) + +/* The EEPROM commands include the alway-set leading bit. */ +enum EEPROM_Cmds { + EE_WriteCmd=(5 << 6), EE_ReadCmd=(6 << 6), EE_EraseCmd=(7 << 6), +}; + +static int eeprom_read(long addr, int location) +{ + int i; + int retval = 0; + int ee_addr = addr + EECtrl; + int read_cmd = location | EE_ReadCmd; + outl(EE_Write0, ee_addr); + + /* Shift the read command bits out. */ + for (i = 10; i >= 0; i--) { + short dataval = (read_cmd & (1 << i)) ? EE_Write1 : EE_Write0; + outl(dataval, ee_addr); + eeprom_delay(ee_addr); + outl(dataval | EE_ShiftClk, ee_addr); + eeprom_delay(ee_addr); + } + outl(EE_ChipSelect, ee_addr); + eeprom_delay(ee_addr); + + for (i = 0; i < 16; i++) { + outl(EE_ChipSelect | EE_ShiftClk, ee_addr); + eeprom_delay(ee_addr); + retval |= (inl(ee_addr) & EE_DataOut) ? 1 << i : 0; + outl(EE_ChipSelect, ee_addr); + eeprom_delay(ee_addr); + } + + /* Terminate the EEPROM access. */ + outl(EE_Write0, ee_addr); + outl(0, ee_addr); + + return retval; +} + +/* MII transceiver control section. + The 83815 series has an internal transceiver, and we present the + management registers as if they were MII connected. */ + +static int mdio_read(int phy_id, int location) +{ + if (phy_id == 1 && location < 32) + return inl(ioaddr + 0x80 + (location<<2)) & 0xffff; + else + return 0xffff; +} + +/* Function: natsemi_init + * + * Description: resets the ethernet controller chip and configures + * registers and data structures required for sending and receiving packets. + * + * Arguments: struct nic *nic: NIC data structure + * + * returns: void. + */ + +static void +natsemi_init(struct nic *nic) +{ + natsemi_reset(nic); + + /* Disable PME: + * The PME bit is initialized from the EEPROM contents. + * PCI cards probably have PME disabled, but motherboard + * implementations may have PME set to enable WakeOnLan. + * With PME set the chip will scan incoming packets but + * nothing will be written to memory. */ + outl(SavedClkRun & ~0x100, ioaddr + ClkRun); + + natsemi_init_rxfilter(nic); + + natsemi_init_txd(nic); + natsemi_init_rxd(nic); + + /* Initialize other registers. */ + /* Configure the PCI bus bursts and FIFO thresholds. */ + /* Configure for standard, in-spec Ethernet. */ + if (inl(ioaddr + ChipConfig) & 0x20000000) { /* Full duplex */ + tx_config = 0xD0801002; + rx_config = 0x10000020; + } else { + tx_config = 0x10801002; + rx_config = 0x0020; + } + outl(tx_config, ioaddr + TxConfig); + outl(rx_config, ioaddr + RxConfig); + + natsemi_check_duplex(nic); + natsemi_set_rx_mode(nic); + + outl(RxOn, ioaddr + ChipCmd); +} + +/* + * Function: natsemi_reset + * + * Description: soft resets the controller chip + * + * Arguments: struct nic *nic: NIC data structure + * + * Returns: void. + */ +static void +natsemi_reset(struct nic *nic __unused) +{ + outl(ChipReset, ioaddr + ChipCmd); + + /* On page 78 of the spec, they recommend some settings for "optimum + performance" to be done in sequence. These settings optimize some + of the 100Mbit autodetection circuitry. Also, we only want to do + this for rev C of the chip. + */ + if (inl(ioaddr + SiliconRev) == 0x302) { + outw(0x0001, ioaddr + PGSEL); + outw(0x189C, ioaddr + PMDCSR); + outw(0x0000, ioaddr + TSTDAT); + outw(0x5040, ioaddr + DSPCFG); + outw(0x008C, ioaddr + SDCFG); + } + /* Disable interrupts using the mask. */ + outl(0, ioaddr + IntrMask); + outl(0, ioaddr + IntrEnable); +} + +/* Function: natsemi_init_rxfilter + * + * Description: sets receive filter address to our MAC address + * + * Arguments: struct nic *nic: NIC data structure + * + * returns: void. + */ + +static void +natsemi_init_rxfilter(struct nic *nic) +{ + int i; + + for (i = 0; i < ETH_ALEN; i += 2) { + outl(i, ioaddr + RxFilterAddr); + outw(nic->node_addr[i] + (nic->node_addr[i+1] << 8), ioaddr + RxFilterData); + } +} + +/* + * Function: natsemi_init_txd + * + * Description: initializes the Tx descriptor + * + * Arguments: struct nic *nic: NIC data structure + * + * returns: void. + */ + +static void +natsemi_init_txd(struct nic *nic __unused) +{ + txd.link = (u32) 0; + txd.cmdsts = (u32) 0; + txd.bufptr = virt_to_bus(&txb[0]); + + /* load Transmit Descriptor Register */ + outl(virt_to_bus(&txd), ioaddr + TxRingPtr); + if (natsemi_debug > 1) + printf("natsemi_init_txd: TX descriptor register loaded with: %X\n", + inl(ioaddr + TxRingPtr)); +} + +/* Function: natsemi_init_rxd + * + * Description: initializes the Rx descriptor ring + * + * Arguments: struct nic *nic: NIC data structure + * + * Returns: void. + */ + +static void +natsemi_init_rxd(struct nic *nic __unused) +{ + int i; + + cur_rx = 0; + + /* init RX descriptor */ + for (i = 0; i < NUM_RX_DESC; i++) { + rxd[i].link = virt_to_bus((i+1 < NUM_RX_DESC) ? &rxd[i+1] : &rxd[0]); + rxd[i].cmdsts = (u32) RX_BUF_SIZE; + rxd[i].bufptr = virt_to_bus(&rxb[i*RX_BUF_SIZE]); + if (natsemi_debug > 1) + printf("natsemi_init_rxd: rxd[%d]=%X link=%X cmdsts=%X bufptr=%X\n", + i, &rxd[i], rxd[i].link, rxd[i].cmdsts, rxd[i].bufptr); + } + + /* load Receive Descriptor Register */ + outl(virt_to_bus(&rxd[0]), ioaddr + RxRingPtr); + + if (natsemi_debug > 1) + printf("natsemi_init_rxd: RX descriptor register loaded with: %X\n", + inl(ioaddr + RxRingPtr)); +} + +/* Function: natsemi_set_rx_mode + * + * Description: + * sets the receive mode to accept all broadcast packets and packets + * with our MAC address, and reject all multicast packets. + * + * Arguments: struct nic *nic: NIC data structure + * + * Returns: void. + */ + +static void natsemi_set_rx_mode(struct nic *nic __unused) +{ + u32 rx_mode = RxFilterEnable | AcceptBroadcast | + AcceptAllMulticast | AcceptMyPhys; + + outl(rx_mode, ioaddr + RxFilterAddr); +} + +static void natsemi_check_duplex(struct nic *nic __unused) +{ + int duplex = inl(ioaddr + ChipConfig) & 0x20000000 ? 1 : 0; + + if (natsemi_debug) + printf("%s: Setting %s-duplex based on negotiated link" + " capability.\n", nic_name, + duplex ? "full" : "half"); + if (duplex) { + rx_config |= 0x10000000; + tx_config |= 0xC0000000; + } else { + rx_config &= ~0x10000000; + tx_config &= ~0xC0000000; + } + outl(tx_config, ioaddr + TxConfig); + outl(rx_config, ioaddr + RxConfig); +} + +/* Function: natsemi_transmit + * + * Description: transmits a packet and waits for completion or timeout. + * + * Arguments: char d[6]: destination ethernet address. + * unsigned short t: ethernet protocol type. + * unsigned short s: size of the data-part of the packet. + * char *p: the data for the packet. + * + * Returns: void. + */ + +static void +natsemi_transmit(struct nic *nic, + const char *d, /* Destination */ + unsigned int t, /* Type */ + unsigned int s, /* size */ + const char *p) /* Packet */ +{ + u32 to, nstype; + u32 tx_status; + + /* Stop the transmitter */ + outl(TxOff, ioaddr + ChipCmd); + + /* load Transmit Descriptor Register */ + outl(virt_to_bus(&txd), ioaddr + TxRingPtr); + if (natsemi_debug > 1) + printf("natsemi_transmit: TX descriptor register loaded with: %X\n", + inl(ioaddr + TxRingPtr)); + + memcpy(txb, d, ETH_ALEN); + memcpy(txb + ETH_ALEN, nic->node_addr, ETH_ALEN); + nstype = htons(t); + memcpy(txb + 2 * ETH_ALEN, (char*)&nstype, 2); + memcpy(txb + ETH_HLEN, p, s); + + s += ETH_HLEN; + s &= DSIZE; + + if (natsemi_debug > 1) + printf("natsemi_transmit: sending %d bytes ethtype %hX\n", (int) s, t); + + /* pad to minimum packet size */ + while (s < ETH_ZLEN) + txb[s++] = '\0'; + + /* set the transmit buffer descriptor and enable Transmit State Machine */ + txd.bufptr = virt_to_bus(&txb[0]); + txd.cmdsts = (u32) OWN | s; + + /* restart the transmitter */ + outl(TxOn, ioaddr + ChipCmd); + + if (natsemi_debug > 1) + printf("natsemi_transmit: Queued Tx packet size %d.\n", (int) s); + + to = currticks() + TX_TIMEOUT; + + while ((((volatile u32) tx_status=txd.cmdsts) & OWN) && (currticks() < to)) + /* wait */ ; + + if (currticks() >= to) { + printf("natsemi_transmit: TX Timeout! Tx status %X.\n", tx_status); + } + + if (!(tx_status & 0x08000000)) { + printf("natsemi_transmit: Transmit error, Tx status %X.\n", tx_status); + } +} + +/* Function: natsemi_poll + * + * Description: checks for a received packet and returns it if found. + * + * Arguments: struct nic *nic: NIC data structure + * + * Returns: 1 if packet was received. + * 0 if no packet was received. + * + * Side effects: + * Returns (copies) the packet to the array nic->packet. + * Returns the length of the packet in nic->packetlen. + */ + +static int +natsemi_poll(struct nic *nic, int retrieve) +{ + u32 rx_status = rxd[cur_rx].cmdsts; + int retstat = 0; + + if (natsemi_debug > 2) + printf("natsemi_poll: cur_rx:%d, status:%X\n", cur_rx, rx_status); + + if (!(rx_status & OWN)) + return retstat; + + if ( ! retrieve ) return 1; + + if (natsemi_debug > 1) + printf("natsemi_poll: got a packet: cur_rx:%d, status:%X\n", + cur_rx, rx_status); + + nic->packetlen = (rx_status & DSIZE) - CRC_SIZE; + + if ((rx_status & (DescMore|DescPktOK|RxTooLong)) != DescPktOK) { + /* corrupted packet received */ + printf("natsemi_poll: Corrupted packet received, buffer status = %X\n", + rx_status); + retstat = 0; + } else { + /* give packet to higher level routine */ + memcpy(nic->packet, (rxb + cur_rx*RX_BUF_SIZE), nic->packetlen); + retstat = 1; + } + + /* return the descriptor and buffer to receive ring */ + rxd[cur_rx].cmdsts = RX_BUF_SIZE; + rxd[cur_rx].bufptr = virt_to_bus(&rxb[cur_rx*RX_BUF_SIZE]); + + if (++cur_rx == NUM_RX_DESC) + cur_rx = 0; + + /* re-enable the potentially idle receive state machine */ + outl(RxOn, ioaddr + ChipCmd); + + return retstat; +} + +/* Function: natsemi_disable + * + * Description: Turns off interrupts and stops Tx and Rx engines + * + * Arguments: struct nic *nic: NIC data structure + * + * Returns: void. + */ + +static void +natsemi_disable(struct dev *dev) +{ + struct nic *nic = (struct nic *)dev; + /* merge reset and disable */ + natsemi_init(nic); + + /* Disable interrupts using the mask. */ + outl(0, ioaddr + IntrMask); + outl(0, ioaddr + IntrEnable); + + /* Stop the chip's Tx and Rx processes. */ + outl(RxOff | TxOff, ioaddr + ChipCmd); + + /* Restore PME enable bit */ + outl(SavedClkRun, ioaddr + ClkRun); +} + +/* Function: natsemi_irq + * + * Description: Enable, Disable, or Force interrupts + * + * Arguments: struct nic *nic: NIC data structure + * irq_action_t action: requested action to perform + * + * Returns: void. + */ + +static void +natsemi_irq(struct nic *nic __unused, irq_action_t action __unused) +{ + switch ( action ) { + case DISABLE : + break; + case ENABLE : + break; + case FORCE : + break; + } +} + +static struct pci_id natsemi_nics[] = { +PCI_ROM(0x100b, 0x0020, "dp83815", "DP83815"), +}; + +struct pci_driver natsemi_driver = { + .type = NIC_DRIVER, + .name = "NATSEMI", + .probe = natsemi_probe, + .ids = natsemi_nics, + .id_count = sizeof(natsemi_nics)/sizeof(natsemi_nics[0]), + .class = 0, +}; diff --git a/usr/src/grub/grub-0.97/netboot/nfs.h b/usr/src/grub/grub-0.97/netboot/nfs.h new file mode 100644 index 0000000000..e159067aa8 --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/nfs.h @@ -0,0 +1,63 @@ +#ifndef _NFS_H +#define _NFS_H + +#define SUNRPC_PORT 111 + +#define PROG_PORTMAP 100000 +#define PROG_NFS 100003 +#define PROG_MOUNT 100005 + +#define MSG_CALL 0 +#define MSG_REPLY 1 + +#define PORTMAP_GETPORT 3 + +#define MOUNT_ADDENTRY 1 +#define MOUNT_UMOUNTALL 4 + +#define NFS_LOOKUP 4 +#define NFS_READLINK 5 +#define NFS_READ 6 + +#define NFS_FHSIZE 32 + +#define NFSERR_PERM 1 +#define NFSERR_NOENT 2 +#define NFSERR_ACCES 13 +#define NFSERR_ISDIR 21 +#define NFSERR_INVAL 22 + +/* Block size used for NFS read accesses. A RPC reply packet (including all + * headers) must fit within a single Ethernet frame to avoid fragmentation. + * Chosen to be a power of two, as most NFS servers are optimized for this. */ +#define NFS_READ_SIZE 1024 + +#define NFS_MAXLINKDEPTH 16 + +struct rpc_t { + struct iphdr ip; + struct udphdr udp; + union { + uint8_t data[300]; /* longest RPC call must fit!!!! */ + struct { + uint32_t id; + uint32_t type; + uint32_t rpcvers; + uint32_t prog; + uint32_t vers; + uint32_t proc; + uint32_t data[1]; + } call; + struct { + uint32_t id; + uint32_t type; + uint32_t rstatus; + uint32_t verifier; + uint32_t v2; + uint32_t astatus; + uint32_t data[1]; + } reply; + } u; +}; + +#endif /* _NFS_H */ diff --git a/usr/src/grub/grub-0.97/netboot/nic.c b/usr/src/grub/grub-0.97/netboot/nic.c new file mode 100644 index 0000000000..f6d28fad9a --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/nic.c @@ -0,0 +1,1312 @@ +/************************************************************************** +Etherboot - Network Bootstrap Program + +Literature dealing with the network protocols: + ARP - RFC826 + RARP - RFC903 + IP - RFC791 + UDP - RFC768 + BOOTP - RFC951, RFC2132 (vendor extensions) + DHCP - RFC2131, RFC2132 (options) + TFTP - RFC1350, RFC2347 (options), RFC2348 (blocksize), RFC2349 (tsize) + RPC - RFC1831, RFC1832 (XDR), RFC1833 (rpcbind/portmapper) + NFS - RFC1094, RFC1813 (v3, useful for clarifications, not implemented) + IGMP - RFC1112, RFC2113, RFC2365, RFC2236, RFC3171 + +**************************************************************************/ +#include "etherboot.h" +#include "grub.h" +#include "nic.h" +#include "elf.h" /* FOR EM_CURRENT */ +#include "bootp.h" +#include "if_arp.h" +#include "tftp.h" +#include "timer.h" +#include "ip.h" +#include "udp.h" + +/* Currently no other module uses rom, but it is available */ +struct rom_info rom; +struct arptable_t arptable[MAX_ARP]; +#ifdef MULTICAST_LEVEL2 +unsigned long last_igmpv1 = 0; +struct igmptable_t igmptable[MAX_IGMP]; +#endif +static unsigned long netmask; +/* Used by nfs.c */ +char *hostname = ""; +int hostnamelen = 0; +/* Used by fsys_tftp.c */ +int use_bios_pxe = 0; +static uint32_t xid; +static unsigned char *end_of_rfc1533 = NULL; +static const unsigned char broadcast[] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; +static const in_addr zeroIP = { 0L }; +static char rfc1533_venddata[MAX_RFC1533_VENDLEN]; +static unsigned char rfc1533_cookie[4] = { RFC1533_COOKIE }; +static unsigned char rfc1533_cookie_bootp[5] = { RFC1533_COOKIE, RFC1533_END }; +static unsigned char rfc1533_cookie_dhcp[] = { RFC1533_COOKIE }; +static int dhcp_reply; +static in_addr dhcp_server = { 0L }; +static in_addr dhcp_addr = { 0L }; + +static const unsigned char dhcpdiscover[] = { + RFC2132_MSG_TYPE, 1, DHCPDISCOVER, + RFC2132_MAX_SIZE, 2, /* request as much as we can */ + ETH_MAX_MTU / 256, ETH_MAX_MTU % 256, + /* Vendor class identifier */ +#ifdef SOLARIS_NETBOOT + RFC2132_VENDOR_CLASS_ID,32,'P','X','E','C','l','i','e','n','t',':', + 'A','r','c','h',':','0','0','0','0','0',':','U','N','D','I',':', + '0','0','2','0','0','1', +#else + RFC2132_VENDOR_CLASS_ID, 10, 'G', 'R', 'U', 'B', 'C', 'l', 'i', 'e', 'n', 't', +#endif + RFC2132_PARAM_LIST, 4, RFC1533_NETMASK, RFC1533_GATEWAY, + RFC1533_HOSTNAME, RFC1533_EXTENSIONPATH, RFC1533_END +}; +static const unsigned char dhcprequest [] = { + RFC2132_MSG_TYPE,1,DHCPREQUEST, + RFC2132_SRV_ID,4,0,0,0,0, + RFC2132_REQ_ADDR,4,0,0,0,0, + RFC2132_MAX_SIZE,2, /* request as much as we can */ + ETH_MAX_MTU / 256, ETH_MAX_MTU % 256, + /* Vendor class identifier */ +#ifdef SOLARIS_NETBOOT + RFC2132_VENDOR_CLASS_ID,32,'P','X','E','C','l','i','e','n','t',':', + 'A','r','c','h',':','0','0','0','0','0',':','U','N','D','I',':', + '0','0','2','0','0','1', +#else + RFC2132_VENDOR_CLASS_ID, 10, 'G', 'R', 'U', 'B', 'C', 'l', 'i', 'e', 'n', 't', +#endif + RFC2132_PARAM_LIST, + /* 4 standard + 2 vendortags */ + 4 + 2, + /* Standard parameters */ + RFC1533_NETMASK, RFC1533_GATEWAY, + RFC1533_HOSTNAME, RFC1533_EXTENSIONPATH, + /* Etherboot vendortags */ + RFC1533_VENDOR_MAGIC, + RFC1533_VENDOR_CONFIGFILE, + RFC1533_END +}; + +/* See nic.h */ +int user_abort = 0; +int network_ready = 0; + +#ifdef REQUIRE_VCI_ETHERBOOT +int vci_etherboot; +#endif + +static void update_network_configuration(void); + +static int dummy(void *unused __unused) +{ + return (0); +} + +/* Careful. We need an aligned buffer to avoid problems on machines + * that care about alignment. To trivally align the ethernet data + * (the ip hdr and arp requests) we offset the packet by 2 bytes. + * leaving the ethernet data 16 byte aligned. Beyond this + * we use memmove but this makes the common cast simple and fast. + */ +static char packet[ETH_FRAME_LEN + ETH_DATA_ALIGN] __aligned; + +struct nic nic = +{ + { + 0, /* dev.disable */ + { + 0, + 0, + PCI_BUS_TYPE, + }, /* dev.devid */ + 0, /* index */ + 0, /* type */ + PROBE_FIRST, /* how_pobe */ + PROBE_NONE, /* to_probe */ + 0, /* failsafe */ + 0, /* type_index */ + {}, /* state */ + }, + (int (*)(struct nic *, int))dummy, /* poll */ + (void (*)(struct nic *, const char *, + unsigned int, unsigned int, + const char *))dummy, /* transmit */ + (void (*)(struct nic *, irq_action_t))dummy, /* irq */ + 0, /* flags */ + &rom, /* rom_info */ + arptable[ARP_CLIENT].node, /* node_addr */ + packet + ETH_DATA_ALIGN, /* packet */ + 0, /* packetlen */ + 0, /* ioaddr */ + 0, /* irqno */ + NULL, /* priv_data */ +}; + + + +int grub_eth_probe(void) +{ + static int probed = 0; + struct dev *dev; + + EnterFunction("grub_eth_probe"); + + if (probed) + return 1; + + network_ready = 0; + grub_memset((char *)arptable, 0, MAX_ARP * sizeof(struct arptable_t)); + dev = &nic.dev; + dev->how_probe = -1; + dev->type = NIC_DRIVER; + dev->failsafe = 1; + rom = *((struct rom_info *)ROM_INFO_LOCATION); + + probed = (eth_probe(dev) == PROBE_WORKED); + + LeaveFunction("grub_eth_probe"); + return probed; +} + +int eth_probe(struct dev *dev) +{ + return probe(dev); +} + +int eth_poll(int retrieve) +{ + return ((*nic.poll)(&nic, retrieve)); +} + +void eth_transmit(const char *d, unsigned int t, unsigned int s, const void *p) +{ + (*nic.transmit)(&nic, d, t, s, p); + if (t == IP) twiddle(); +} + +void eth_disable(void) +{ +#ifdef MULTICAST_LEVEL2 + int i; + for(i = 0; i < MAX_IGMP; i++) { + leave_group(i); + } +#endif + disable(&nic.dev); +} + +void eth_irq (irq_action_t action) +{ + (*nic.irq)(&nic,action); +} + +/************************************************************************** +IPCHKSUM - Checksum IP Header +**************************************************************************/ +uint16_t ipchksum(const void *data, unsigned long length) +{ + unsigned long sum; + unsigned long i; + const uint8_t *ptr; + + /* In the most straight forward way possible, + * compute an ip style checksum. + */ + sum = 0; + ptr = data; + for(i = 0; i < length; i++) { + unsigned long value; + value = ptr[i]; + if (i & 1) { + value <<= 8; + } + /* Add the new value */ + sum += value; + /* Wrap around the carry */ + if (sum > 0xFFFF) { + sum = (sum + (sum >> 16)) & 0xFFFF; + } + } + return (~cpu_to_le16(sum)) & 0xFFFF; +} + +uint16_t add_ipchksums(unsigned long offset, uint16_t sum, uint16_t new) +{ + unsigned long checksum; + sum = ~sum & 0xFFFF; + new = ~new & 0xFFFF; + if (offset & 1) { + /* byte swap the sum if it came from an odd offset + * since the computation is endian independant this + * works. + */ + new = bswap_16(new); + } + checksum = sum + new; + if (checksum > 0xFFFF) { + checksum -= 0xFFFF; + } + return (~checksum) & 0xFFFF; +} + +/************************************************************************** +DEFAULT_NETMASK - Return default netmask for IP address +**************************************************************************/ +static inline unsigned long default_netmask(void) +{ + int net = ntohl(arptable[ARP_CLIENT].ipaddr.s_addr) >> 24; + if (net <= 127) + return(htonl(0xff000000)); + else if (net < 192) + return(htonl(0xffff0000)); + else + return(htonl(0xffffff00)); +} + +/************************************************************************** +IP_TRANSMIT - Send an IP datagram +**************************************************************************/ +static int await_arp(int ival, void *ptr, + unsigned short ptype, struct iphdr *ip __unused, struct udphdr *udp __unused) +{ + struct arprequest *arpreply; + if (ptype != ARP) + return 0; + if (nic.packetlen < ETH_HLEN + sizeof(struct arprequest)) + return 0; + arpreply = (struct arprequest *)&nic.packet[ETH_HLEN]; + + if (arpreply->opcode != htons(ARP_REPLY)) + return 0; + if (memcmp(arpreply->sipaddr, ptr, sizeof(in_addr)) != 0) + return 0; + memcpy(arptable[ival].node, arpreply->shwaddr, ETH_ALEN); + return 1; +} + +int ip_transmit(int len, const void *buf) +{ + unsigned long destip; + struct iphdr *ip; + struct arprequest arpreq; + int arpentry, i; + int retry; + + ip = (struct iphdr *)buf; + destip = ip->dest.s_addr; + if (destip == IP_BROADCAST) { + eth_transmit(broadcast, IP, len, buf); +#ifdef MULTICAST_LEVEL1 + } else if ((destip & htonl(MULTICAST_MASK)) == htonl(MULTICAST_NETWORK)) { + unsigned char multicast[6]; + unsigned long hdestip; + hdestip = ntohl(destip); + multicast[0] = 0x01; + multicast[1] = 0x00; + multicast[2] = 0x5e; + multicast[3] = (hdestip >> 16) & 0x7; + multicast[4] = (hdestip >> 8) & 0xff; + multicast[5] = hdestip & 0xff; + eth_transmit(multicast, IP, len, buf); +#endif + } else { + if (((destip & netmask) != + (arptable[ARP_CLIENT].ipaddr.s_addr & netmask)) && + arptable[ARP_GATEWAY].ipaddr.s_addr) + destip = arptable[ARP_GATEWAY].ipaddr.s_addr; + for(arpentry = 0; arpentryverhdrlen = 0x45; + ip->verhdrlen += (option_len/4); + ip->service = 0; + ip->len = htons(len); + ip->ident = 0; + ip->frags = 0; /* Should we set don't fragment? */ + ip->ttl = ttl; + ip->protocol = protocol; + ip->chksum = 0; + ip->src.s_addr = arptable[ARP_CLIENT].ipaddr.s_addr; + ip->dest.s_addr = destip; + ip->chksum = ipchksum(buf, sizeof(struct iphdr) + option_len); +} + +static uint16_t udpchksum(struct iphdr *ip, struct udphdr *udp) +{ + struct udp_pseudo_hdr pseudo; + uint16_t checksum; + + /* Compute the pseudo header */ + pseudo.src.s_addr = ip->src.s_addr; + pseudo.dest.s_addr = ip->dest.s_addr; + pseudo.unused = 0; + pseudo.protocol = IP_UDP; + pseudo.len = udp->len; + + /* Sum the pseudo header */ + checksum = ipchksum(&pseudo, 12); + + /* Sum the rest of the udp packet */ + checksum = add_ipchksums(12, checksum, ipchksum(udp, ntohs(udp->len))); + return checksum; +} + + +void build_udp_hdr(unsigned long destip, + unsigned int srcsock, unsigned int destsock, int ttl, + int len, const void *buf) +{ + struct iphdr *ip; + struct udphdr *udp; + ip = (struct iphdr *)buf; + build_ip_hdr(destip, ttl, IP_UDP, 0, len, buf); + udp = (struct udphdr *)((char *)buf + sizeof(struct iphdr)); + udp->src = htons(srcsock); + udp->dest = htons(destsock); + udp->len = htons(len - sizeof(struct iphdr)); + udp->chksum = 0; + if ((udp->chksum = udpchksum(ip, udp)) == 0) + udp->chksum = 0xffff; +} + + +/************************************************************************** +UDP_TRANSMIT - Send an UDP datagram +**************************************************************************/ +int udp_transmit(unsigned long destip, unsigned int srcsock, + unsigned int destsock, int len, const void *buf) +{ + build_udp_hdr(destip, srcsock, destsock, 60, len, buf); + return ip_transmit(len, buf); +} + +/************************************************************************** +QDRAIN - clear the nic's receive queue +**************************************************************************/ +static int await_qdrain(int ival __unused, void *ptr __unused, + unsigned short ptype __unused, + struct iphdr *ip __unused, struct udphdr *udp __unused) +{ + return 0; +} + +void rx_qdrain(void) +{ + /* Clear out the Rx queue first. It contains nothing of interest, + * except possibly ARP requests from the DHCP/TFTP server. We use + * polling throughout Etherboot, so some time may have passed since we + * last polled the receive queue, which may now be filled with + * broadcast packets. This will cause the reply to the packets we are + * about to send to be lost immediately. Not very clever. */ + await_reply(await_qdrain, 0, NULL, 0); +} + +/** + * rarp + * + * Get IP address by rarp. Just copy from etherboot + **/ +static int await_rarp(int ival, void *ptr, unsigned short ptype, + struct iphdr *ip, struct udphdr *udp) +{ + struct arprequest *arpreply; + if (ptype != RARP) + return 0; + if (nic.packetlen < ETH_HLEN + sizeof(struct arprequest)) + return 0; + arpreply = (struct arprequest *)&nic.packet[ETH_HLEN]; + if (arpreply->opcode != htons(RARP_REPLY)) + return 0; + if (memcmp(arpreply->thwaddr, ptr, ETH_ALEN) == 0){ + memcpy(arptable[ARP_SERVER].node, arpreply->shwaddr, ETH_ALEN); + memcpy(&arptable[ARP_SERVER].ipaddr, arpreply->sipaddr, sizeof(in_addr)); + memcpy(&arptable[ARP_CLIENT].ipaddr, arpreply->tipaddr, sizeof(in_addr)); + memset(&arptable[ARP_GATEWAY].ipaddr, 0, sizeof(in_addr)); + return 1; + } + return 0; +} + +int rarp(void) +{ + int retry; + + /* arp and rarp requests share the same packet structure. */ + struct arprequest rarpreq; + + if(!grub_eth_probe()) + return 0; + network_ready = 0; + + memset(&rarpreq, 0, sizeof(rarpreq)); + + rarpreq.hwtype = htons(1); + rarpreq.protocol = htons(IP); + rarpreq.hwlen = ETH_ALEN; + rarpreq.protolen = 4; + rarpreq.opcode = htons(RARP_REQUEST); + memcpy(&rarpreq.shwaddr, arptable[ARP_CLIENT].node, ETH_ALEN); + /* sipaddr is already zeroed out */ + memcpy(&rarpreq.thwaddr, arptable[ARP_CLIENT].node, ETH_ALEN); + /* tipaddr is already zeroed out */ + + for (retry = 0; retry < MAX_ARP_RETRIES; ++retry) { + long timeout; + eth_transmit(broadcast, RARP, sizeof(rarpreq), &rarpreq); + + timeout = rfc2131_sleep_interval(TIMEOUT, retry); + if (await_reply(await_rarp, 0, rarpreq.shwaddr, timeout)) + break; + if (user_abort) + return 0; + } + + if (retry == MAX_ARP_RETRIES) { + return (0); + } + + network_ready = 1; + update_network_configuration(); + return (1); +} + +/** + * bootp + * + * Get IP address by bootp, segregate from bootp in etherboot. + **/ +static int await_bootp(int ival __unused, void *ptr __unused, + unsigned short ptype __unused, struct iphdr *ip __unused, + struct udphdr *udp) +{ + struct bootp_t *bootpreply; + int len; /* Length of vendor */ + + if (!udp) { + return 0; + } + bootpreply = (struct bootp_t *) + &nic.packet[ETH_HLEN + sizeof(struct iphdr) + sizeof(struct udphdr)]; + len = nic.packetlen - (ETH_HLEN + sizeof(struct iphdr) + + sizeof(struct udphdr) + sizeof(struct bootp_t) - BOOTP_VENDOR_LEN); + if (len < 0) { + return 0; + } + if (udp->dest != htons(BOOTP_CLIENT)) + return 0; + if (bootpreply->bp_op != BOOTP_REPLY) + return 0; + if (bootpreply->bp_xid != xid) + return 0; + if (memcmp((char *)&bootpreply->bp_siaddr, (char *)&zeroIP, sizeof(in_addr)) == 0) + return 0; + if ((memcmp(broadcast, bootpreply->bp_hwaddr, ETH_ALEN) != 0) && + (memcmp(arptable[ARP_CLIENT].node, bootpreply->bp_hwaddr, ETH_ALEN) != 0)) { + return 0; + } + +#ifdef SOLARIS_NETBOOT + /* fill in netinfo */ + dhcpack_length = len + sizeof (struct bootp_t) - BOOTP_VENDOR_LEN; + memcpy((char *)dhcpack_buf, (char *)bootpreply, dhcpack_length); +#endif + + arptable[ARP_CLIENT].ipaddr.s_addr = bootpreply->bp_yiaddr.s_addr; + netmask = default_netmask(); + arptable[ARP_SERVER].ipaddr.s_addr = bootpreply->bp_siaddr.s_addr; + memset(arptable[ARP_SERVER].node, 0, ETH_ALEN); /* Kill arp */ + arptable[ARP_GATEWAY].ipaddr.s_addr = bootpreply->bp_giaddr.s_addr; + memset(arptable[ARP_GATEWAY].node, 0, ETH_ALEN); /* Kill arp */ + /* We don't care bootpreply->bp_file, it must be 'pxegrub':-) */ + memcpy((char *)rfc1533_venddata, (char *)(bootpreply->bp_vend), len); + decode_rfc1533(rfc1533_venddata, 0, len, 1); + return(1); +} + +int bootp(void) +{ + int retry; + struct bootpip_t ip; + unsigned long starttime; + + EnterFunction("bootp"); + + if(!grub_eth_probe()) + return 0; + network_ready = 0; + + memset(&ip, 0, sizeof(struct bootpip_t)); + ip.bp.bp_op = BOOTP_REQUEST; + ip.bp.bp_htype = 1; + ip.bp.bp_hlen = ETH_ALEN; + starttime = currticks(); + /* Use lower 32 bits of node address, more likely to be + distinct than the time since booting */ + memcpy(&xid, &arptable[ARP_CLIENT].node[2], sizeof(xid)); + ip.bp.bp_xid = xid += htonl(starttime); + /* bp_secs defaults to zero */ + memcpy(ip.bp.bp_hwaddr, arptable[ARP_CLIENT].node, ETH_ALEN); + memcpy(ip.bp.bp_vend, rfc1533_cookie_bootp, sizeof(rfc1533_cookie_bootp)); /* request RFC-style options */ + + for (retry = 0; retry < MAX_BOOTP_RETRIES; ) { + long timeout; + + rx_qdrain(); + + udp_transmit(IP_BROADCAST, BOOTP_CLIENT, BOOTP_SERVER, + sizeof(struct bootpip_t), &ip); + timeout = rfc2131_sleep_interval(TIMEOUT, retry++); + if (await_reply(await_bootp, 0, NULL, timeout)){ + network_ready = 1; + return(1); + } + if (user_abort) + return 0; + ip.bp.bp_secs = htons((currticks()-starttime)/TICKS_PER_SEC); + } + return(0); +} + +/** + * dhcp + * + * Get IP address by dhcp, segregate from bootp in etherboot. + **/ +static int await_dhcp(int ival __unused, void *ptr __unused, + unsigned short ptype __unused, struct iphdr *ip __unused, + struct udphdr *udp) +{ + struct dhcp_t *dhcpreply; + int len; + + if (!udp) { + return 0; + } + dhcpreply = (struct dhcp_t *) + &nic.packet[ETH_HLEN + sizeof(struct iphdr) + sizeof(struct udphdr)]; + len = nic.packetlen - (ETH_HLEN + sizeof(struct iphdr) + + sizeof(struct udphdr) + sizeof(struct dhcp_t) - DHCP_OPT_LEN); + if (len < 0){ + return 0; + } + if (udp->dest != htons(BOOTP_CLIENT)) + return 0; + if (dhcpreply->bp_op != BOOTP_REPLY) + return 0; + if (dhcpreply->bp_xid != xid) + return 0; + if (memcmp((char *)&dhcpreply->bp_siaddr, (char *)&zeroIP, sizeof(in_addr)) == 0) + return 0; + if ((memcmp(broadcast, dhcpreply->bp_hwaddr, ETH_ALEN) != 0) && + (memcmp(arptable[ARP_CLIENT].node, dhcpreply->bp_hwaddr, ETH_ALEN) != 0)) { + return 0; + } + +#ifdef SOLARIS_NETBOOT + /* fill in netinfo */ + dhcpack_length = len + sizeof (struct dhcp_t) - DHCP_OPT_LEN; + memcpy((char *)dhcpack_buf, (char *)dhcpreply, dhcpack_length); +#endif + + arptable[ARP_CLIENT].ipaddr.s_addr = dhcpreply->bp_yiaddr.s_addr; + dhcp_addr.s_addr = dhcpreply->bp_yiaddr.s_addr; + netmask = default_netmask(); + arptable[ARP_SERVER].ipaddr.s_addr = dhcpreply->bp_siaddr.s_addr; + memset(arptable[ARP_SERVER].node, 0, ETH_ALEN); /* Kill arp */ + arptable[ARP_GATEWAY].ipaddr.s_addr = dhcpreply->bp_giaddr.s_addr; + memset(arptable[ARP_GATEWAY].node, 0, ETH_ALEN); /* Kill arp */ + /* We don't care bootpreply->bp_file. It must be 'pxegrub' */ + memcpy((char *)rfc1533_venddata, (char *)(dhcpreply->bp_vend), len); + decode_rfc1533(rfc1533_venddata, 0, len, 1); + return(1); +} + +int dhcp(void) +{ + int retry; + int reqretry; + struct dhcpip_t ip; + unsigned long starttime; + + /* try bios pxe stack first */ + if (dhcp_undi()) + return 1; + + if(!grub_eth_probe()) + return 0; + + network_ready = 0; + + memset(&ip, 0, sizeof(ip)); + ip.bp.bp_op = BOOTP_REQUEST; + ip.bp.bp_htype = 1; + ip.bp.bp_hlen = ETH_ALEN; + starttime = currticks(); + /* Use lower 32 bits of node address, more likely to be + distinct than the time since booting */ + memcpy(&xid, &arptable[ARP_CLIENT].node[2], sizeof(xid)); + ip.bp.bp_xid = xid += htonl(starttime); + memcpy(ip.bp.bp_hwaddr, arptable[ARP_CLIENT].node, ETH_ALEN); + memcpy(ip.bp.bp_vend, rfc1533_cookie_dhcp, sizeof rfc1533_cookie_dhcp); /* request RFC-style options */ + memcpy(ip.bp.bp_vend + sizeof rfc1533_cookie_dhcp, dhcpdiscover, sizeof dhcpdiscover); + + for (retry = 0; retry < MAX_BOOTP_RETRIES; ) { + long timeout; + + rx_qdrain(); + + udp_transmit(IP_BROADCAST, BOOTP_CLIENT, BOOTP_SERVER, + sizeof(ip), &ip); + timeout = rfc2131_sleep_interval(TIMEOUT, retry++); + if (await_reply(await_dhcp, 0, NULL, timeout)) { + /* If not a DHCPOFFER then must be just a + BOOTP reply, be backward compatible with + BOOTP then. Jscott report a bug here, but I + don't know how it happened */ + if (dhcp_reply != DHCPOFFER){ + network_ready = 1; + return(1); + } + dhcp_reply = 0; + memcpy(ip.bp.bp_vend, rfc1533_cookie_dhcp, sizeof rfc1533_cookie_dhcp); + memcpy(ip.bp.bp_vend + sizeof rfc1533_cookie_dhcp, dhcprequest, sizeof dhcprequest); + /* Beware: the magic numbers 9 and 15 depend on + the layout of dhcprequest */ + memcpy(&ip.bp.bp_vend[9], &dhcp_server, sizeof(in_addr)); + memcpy(&ip.bp.bp_vend[15], &dhcp_addr, sizeof(in_addr)); + for (reqretry = 0; reqretry < MAX_BOOTP_RETRIES; ) { + udp_transmit(IP_BROADCAST, BOOTP_CLIENT, BOOTP_SERVER, + sizeof(ip), &ip); + dhcp_reply=0; + timeout = rfc2131_sleep_interval(TIMEOUT, reqretry++); + if (await_reply(await_dhcp, 0, NULL, timeout)) + if (dhcp_reply == DHCPACK){ + network_ready = 1; + return(1); + } + if (user_abort) + return 0; + } + } + if (user_abort) + return 0; + ip.bp.bp_secs = htons((currticks()-starttime)/TICKS_PER_SEC); + } + return(0); +} + +#ifdef MULTICAST_LEVEL2 +static void send_igmp_reports(unsigned long now) +{ + int i; + for(i = 0; i < MAX_IGMP; i++) { + if (igmptable[i].time && (now >= igmptable[i].time)) { + struct igmp_ip_t igmp; + igmp.router_alert[0] = 0x94; + igmp.router_alert[1] = 0x04; + igmp.router_alert[2] = 0; + igmp.router_alert[3] = 0; + build_ip_hdr(igmptable[i].group.s_addr, + 1, IP_IGMP, sizeof(igmp.router_alert), sizeof(igmp), &igmp); + igmp.igmp.type = IGMPv2_REPORT; + if (last_igmpv1 && + (now < last_igmpv1 + IGMPv1_ROUTER_PRESENT_TIMEOUT)) { + igmp.igmp.type = IGMPv1_REPORT; + } + igmp.igmp.response_time = 0; + igmp.igmp.chksum = 0; + igmp.igmp.group.s_addr = igmptable[i].group.s_addr; + igmp.igmp.chksum = ipchksum(&igmp.igmp, sizeof(igmp.igmp)); + ip_transmit(sizeof(igmp), &igmp); +#ifdef MDEBUG + printf("Sent IGMP report to: %@\n", igmp.igmp.group.s_addr); +#endif + /* Don't send another igmp report until asked */ + igmptable[i].time = 0; + } + } +} + +static void process_igmp(struct iphdr *ip, unsigned long now) +{ + struct igmp *igmp; + int i; + unsigned iplen = 0; + if (!ip || (ip->protocol == IP_IGMP) || + (nic.packetlen < sizeof(struct iphdr) + sizeof(struct igmp))) { + return; + } + iplen = (ip->verhdrlen & 0xf)*4; + igmp = (struct igmp *)&nic.packet[sizeof(struct iphdr)]; + if (ipchksum(igmp, ntohs(ip->len) - iplen) != 0) + return; + if ((igmp->type == IGMP_QUERY) && + (ip->dest.s_addr == htonl(GROUP_ALL_HOSTS))) { + unsigned long interval = IGMP_INTERVAL; + if (igmp->response_time == 0) { + last_igmpv1 = now; + } else { + interval = (igmp->response_time * TICKS_PER_SEC)/10; + } + +#ifdef MDEBUG + printf("Received IGMP query for: %@\n", igmp->group.s_addr); +#endif + for(i = 0; i < MAX_IGMP; i++) { + uint32_t group = igmptable[i].group.s_addr; + if ((group == 0) || (group == igmp->group.s_addr)) { + unsigned long time; + time = currticks() + rfc1112_sleep_interval(interval, 0); + if (time < igmptable[i].time) { + igmptable[i].time = time; + } + } + } + } + if (((igmp->type == IGMPv1_REPORT) || (igmp->type == IGMPv2_REPORT)) && + (ip->dest.s_addr == igmp->group.s_addr)) { +#ifdef MDEBUG + printf("Received IGMP report for: %@\n", igmp->group.s_addr); +#endif + for(i = 0; i < MAX_IGMP; i++) { + if ((igmptable[i].group.s_addr == igmp->group.s_addr) && + igmptable[i].time != 0) { + igmptable[i].time = 0; + } + } + } +} + +void leave_group(int slot) +{ + /* Be very stupid and always send a leave group message if + * I have subscribed. Imperfect but it is standards + * compliant, easy and reliable to implement. + * + * The optimal group leave method is to only send leave when, + * we were the last host to respond to a query on this group, + * and igmpv1 compatibility is not enabled. + */ + if (igmptable[slot].group.s_addr) { + struct igmp_ip_t igmp; + igmp.router_alert[0] = 0x94; + igmp.router_alert[1] = 0x04; + igmp.router_alert[2] = 0; + igmp.router_alert[3] = 0; + build_ip_hdr(htonl(GROUP_ALL_HOSTS), + 1, IP_IGMP, sizeof(igmp.router_alert), sizeof(igmp), &igmp); + igmp.igmp.type = IGMP_LEAVE; + igmp.igmp.response_time = 0; + igmp.igmp.chksum = 0; + igmp.igmp.group.s_addr = igmptable[slot].group.s_addr; + igmp.igmp.chksum = ipchksum(&igmp.igmp, sizeof(igmp)); + ip_transmit(sizeof(igmp), &igmp); +#ifdef MDEBUG + printf("Sent IGMP leave for: %@\n", igmp.igmp.group.s_addr); +#endif + } + memset(&igmptable[slot], 0, sizeof(igmptable[0])); +} + +void join_group(int slot, unsigned long group) +{ + /* I have already joined */ + if (igmptable[slot].group.s_addr == group) + return; + if (igmptable[slot].group.s_addr) { + leave_group(slot); + } + /* Only join a group if we are given a multicast ip, this way + * code can be given a non-multicast (broadcast or unicast ip) + * and still work... + */ + if ((group & htonl(MULTICAST_MASK)) == htonl(MULTICAST_NETWORK)) { + igmptable[slot].group.s_addr = group; + igmptable[slot].time = currticks(); + } +} +#else +#define send_igmp_reports(now); +#define process_igmp(ip, now) +#endif + +/************************************************************************** +AWAIT_REPLY - Wait until we get a response for our request +************f**************************************************************/ +int await_reply(reply_t reply, int ival, void *ptr, long timeout) +{ + unsigned long time, now; + struct iphdr *ip; + unsigned iplen = 0; + struct udphdr *udp; + unsigned short ptype; + int result; + + user_abort = 0; + + time = timeout + currticks(); + /* The timeout check is done below. The timeout is only checked if + * there is no packet in the Rx queue. This assumes that eth_poll() + * needs a negligible amount of time. + */ + for (;;) { + now = currticks(); + send_igmp_reports(now); + result = eth_poll(1); + if (result == 0) { + /* We don't have anything */ + + /* Check for abort key only if the Rx queue is empty - + * as long as we have something to process, don't + * assume that something failed. It is unlikely that + * we have no processing time left between packets. */ + poll_interruptions(); + /* Do the timeout after at least a full queue walk. */ + if ((timeout == 0) || (currticks() > time) || user_abort == 1) { + break; + } + continue; + } + + /* We have something! */ + + /* Find the Ethernet packet type */ + if (nic.packetlen >= ETH_HLEN) { + ptype = ((unsigned short) nic.packet[12]) << 8 + | ((unsigned short) nic.packet[13]); + } else continue; /* what else could we do with it? */ + /* Verify an IP header */ + ip = 0; + if ((ptype == IP) && (nic.packetlen >= ETH_HLEN + sizeof(struct iphdr))) { + unsigned ipoptlen; + ip = (struct iphdr *)&nic.packet[ETH_HLEN]; + if ((ip->verhdrlen < 0x45) || (ip->verhdrlen > 0x4F)) + continue; + iplen = (ip->verhdrlen & 0xf) * 4; + if (ipchksum(ip, iplen) != 0) + continue; + if (ip->frags & htons(0x3FFF)) { + static int warned_fragmentation = 0; + if (!warned_fragmentation) { + printf("ALERT: got a fragmented packet - reconfigure your server\n"); + warned_fragmentation = 1; + } + continue; + } + if (ntohs(ip->len) > ETH_MAX_MTU) + continue; + + ipoptlen = iplen - sizeof(struct iphdr); + if (ipoptlen) { + /* Delete the ip options, to guarantee + * good alignment, and make etherboot simpler. + */ + memmove(&nic.packet[ETH_HLEN + sizeof(struct iphdr)], + &nic.packet[ETH_HLEN + iplen], + nic.packetlen - ipoptlen); + nic.packetlen -= ipoptlen; + } + } + udp = 0; + if (ip && (ip->protocol == IP_UDP) && + (nic.packetlen >= ETH_HLEN + sizeof(struct iphdr) + sizeof(struct udphdr))) { + udp = (struct udphdr *)&nic.packet[ETH_HLEN + sizeof(struct iphdr)]; + + /* Make certain we have a reasonable packet length */ + if (ntohs(udp->len) > (ntohs(ip->len) - iplen)) + continue; + + if (udp->chksum && udpchksum(ip, udp)) { + printf("UDP checksum error\n"); + continue; + } + } + result = reply(ival, ptr, ptype, ip, udp); + if (result > 0) { + return result; + } + + /* If it isn't a packet the upper layer wants see if there is a default + * action. This allows us reply to arp and igmp queryies. + */ + if ((ptype == ARP) && + (nic.packetlen >= ETH_HLEN + sizeof(struct arprequest))) { + struct arprequest *arpreply; + unsigned long tmp; + + arpreply = (struct arprequest *)&nic.packet[ETH_HLEN]; + memcpy(&tmp, arpreply->tipaddr, sizeof(in_addr)); + if ((arpreply->opcode == htons(ARP_REQUEST)) && + (tmp == arptable[ARP_CLIENT].ipaddr.s_addr)) { + arpreply->opcode = htons(ARP_REPLY); + memcpy(arpreply->tipaddr, arpreply->sipaddr, sizeof(in_addr)); + memcpy(arpreply->thwaddr, arpreply->shwaddr, ETH_ALEN); + memcpy(arpreply->sipaddr, &arptable[ARP_CLIENT].ipaddr, sizeof(in_addr)); + memcpy(arpreply->shwaddr, arptable[ARP_CLIENT].node, ETH_ALEN); + eth_transmit(arpreply->thwaddr, ARP, + sizeof(struct arprequest), + arpreply); +#ifdef MDEBUG + memcpy(&tmp, arpreply->tipaddr, sizeof(in_addr)); + printf("Sent ARP reply to: %@\n",tmp); +#endif /* MDEBUG */ + } + } + process_igmp(ip, now); + } + return(0); +} + +#ifdef REQUIRE_VCI_ETHERBOOT +/************************************************************************** +FIND_VCI_ETHERBOOT - Looks for "Etherboot" in Vendor Encapsulated Identifiers +On entry p points to byte count of VCI options +**************************************************************************/ +static int find_vci_etherboot(unsigned char *p) +{ + unsigned char *end = p + 1 + *p; + + for (p++; p < end; ) { + if (*p == RFC2132_VENDOR_CLASS_ID) { + if (strncmp("Etherboot", p + 2, sizeof("Etherboot") - 1) == 0) + return (1); + } else if (*p == RFC1533_END) + return (0); + p += TAG_LEN(p) + 2; + } + return (0); +} +#endif /* REQUIRE_VCI_ETHERBOOT */ + +/** + * decode_rfc1533 + * + * Decodes RFC1533 header + **/ +int decode_rfc1533(unsigned char *p, unsigned int block, unsigned int len, int eof) +{ + static unsigned char *extdata = NULL, *extend = NULL; + unsigned char *extpath = NULL; + unsigned char *endp; + + if (block == 0) { + end_of_rfc1533 = NULL; + if (memcmp(p, rfc1533_cookie, sizeof(rfc1533_cookie))) + return(0); /* no RFC 1533 header found */ + p += 4; + endp = p + len; + } else { + if (block == 1) { + if (memcmp(p, rfc1533_cookie, sizeof(rfc1533_cookie))) + return(0); /* no RFC 1533 header found */ + p += 4; + len -= 4; } + if (extend + len <= (unsigned char *) + rfc1533_venddata + sizeof(rfc1533_venddata)) { + memcpy(extend, p, len); + extend += len; + } else { + printf("Overflow in vendor data buffer! Aborting...\n"); + *extdata = RFC1533_END; + return(0); + } + p = extdata; endp = extend; + } + if (!eof) + return 1; + while (p < endp) { + unsigned char c = *p; + if (c == RFC1533_PAD) { + p++; + continue; + } + else if (c == RFC1533_END) { + end_of_rfc1533 = endp = p; + continue; + } + else if (c == RFC1533_NETMASK) + memcpy(&netmask, p+2, sizeof(in_addr)); + else if (c == RFC1533_GATEWAY) { + /* This is a little simplistic, but it will + usually be sufficient. + Take only the first entry */ + if (TAG_LEN(p) >= sizeof(in_addr)) + memcpy(&arptable[ARP_GATEWAY].ipaddr, p+2, sizeof(in_addr)); + } + else if (c == RFC1533_EXTENSIONPATH) + extpath = p; + else if (c == RFC2132_MSG_TYPE) + dhcp_reply=*(p+2); + else if (c == RFC2132_SRV_ID) + memcpy(&dhcp_server, p+2, sizeof(in_addr)); + else if (c == RFC1533_HOSTNAME) { + hostname = p + 2; + hostnamelen = *(p + 1); + } + else if (c == RFC1533_VENDOR_CONFIGFILE){ + int l = TAG_LEN (p); + + /* Eliminate the trailing NULs according to RFC 2132. */ + while (*(p + 2 + l - 1) == '\000' && l > 0) + l--; + + /* XXX: Should check if LEN is less than the maximum length + of CONFIG_FILE. This kind of robustness will be a goal + in GRUB 1.0. */ + memcpy (config_file, p + 2, l); + config_file[l] = 0; + } + else { + ; + } + p += TAG_LEN(p) + 2; + } + extdata = extend = endp; + if (block <= 0 && extpath != NULL) { + char fname[64]; + if (TAG_LEN(extpath) >= sizeof(fname)){ + printf("Overflow in vendor data buffer! Aborting...\n"); + *extdata = RFC1533_END; + return(0); + } + memcpy(fname, extpath+2, TAG_LEN(extpath)); + fname[(int)TAG_LEN(extpath)] = '\0'; + printf("Loading BOOTP-extension file: %s\n",fname); + tftp_file_read(fname, decode_rfc1533); + } + return 1; /* proceed with next block */ +} + + +/* FIXME double check TWO_SECOND_DIVISOR */ +#define TWO_SECOND_DIVISOR (RAND_MAX/TICKS_PER_SEC) +/************************************************************************** +RFC2131_SLEEP_INTERVAL - sleep for expotentially longer times (base << exp) +- 1 sec) +**************************************************************************/ +long rfc2131_sleep_interval(long base, int exp) +{ + unsigned long tmo; +#ifdef BACKOFF_LIMIT + if (exp > BACKOFF_LIMIT) + exp = BACKOFF_LIMIT; +#endif + tmo = (base << exp) + (TICKS_PER_SEC - (random()/TWO_SECOND_DIVISOR)); + return tmo; +} + +#ifdef MULTICAST_LEVEL2 +/************************************************************************** +RFC1112_SLEEP_INTERVAL - sleep for expotentially longer times, up to (base << exp) +**************************************************************************/ +long rfc1112_sleep_interval(long base, int exp) +{ + unsigned long divisor, tmo; +#ifdef BACKOFF_LIMIT + if (exp > BACKOFF_LIMIT) + exp = BACKOFF_LIMIT; +#endif + divisor = RAND_MAX/(base << exp); + tmo = random()/divisor; + return tmo; +} +#endif /* MULTICAST_LEVEL_2 */ +/* ifconfig - configure network interface. */ +int +ifconfig (char *ip, char *sm, char *gw, char *svr) +{ + in_addr tmp; + + if (sm) + { + if (! inet_aton (sm, &tmp)) + return 0; + + netmask = tmp.s_addr; + } + + if (ip) + { + if (! inet_aton (ip, &arptable[ARP_CLIENT].ipaddr)) + return 0; + + if (! netmask && ! sm) + netmask = default_netmask (); + } + + if (gw && ! inet_aton (gw, &arptable[ARP_GATEWAY].ipaddr)) + return 0; + + /* Clear out the ARP entry. */ + grub_memset (arptable[ARP_GATEWAY].node, 0, ETH_ALEN); + + if (svr && ! inet_aton (svr, &arptable[ARP_SERVER].ipaddr)) + return 0; + + /* Likewise. */ + grub_memset (arptable[ARP_SERVER].node, 0, ETH_ALEN); + + if (ip || sm) + { + if (IP_BROADCAST == (netmask | arptable[ARP_CLIENT].ipaddr.s_addr) + || netmask == (netmask | arptable[ARP_CLIENT].ipaddr.s_addr) + || ! netmask) + network_ready = 0; + else + network_ready = 1; + } + + update_network_configuration(); + return 1; +} + +/* + * print_network_configuration + * + * Output the network configuration. It may broke the graphic console now.:-( + */ +void print_network_configuration (void) +{ + EnterFunction("print_network_configuration"); + if (! network_ready) + grub_printf ("Network interface not initialized yet.\n"); + else { + etherboot_printf ("Address: %@\n", arptable[ARP_CLIENT].ipaddr.s_addr); + etherboot_printf ("Netmask: %@\n", netmask); + etherboot_printf ("Server: %@\n", arptable[ARP_SERVER].ipaddr.s_addr); + etherboot_printf ("Gateway: %@\n", arptable[ARP_GATEWAY].ipaddr.s_addr); + } + LeaveFunction("print_network_configuration"); +} + +/* + * update_network_configuration + * + * Update network configuration for diskless clients (Solaris only) + */ +static void update_network_configuration (void) +{ +#ifdef SOLARIS_NETBOOT + struct sol_netinfo { + uint8_t sn_infotype; + uint8_t sn_mactype; + uint8_t sn_maclen; + uint8_t sn_padding; + unsigned long sn_ciaddr; + unsigned long sn_siaddr; + unsigned long sn_giaddr; + unsigned long sn_netmask; + uint8_t sn_macaddr[1]; + } *sip; + + if (! network_ready) + return; + + sip = (struct sol_netinfo *)dhcpack_buf; + sip->sn_infotype = 0xf0; /* something not BOOTP_REPLY */ + sip->sn_mactype = 4; /* DL_ETHER */ + sip->sn_maclen = ETH_ALEN; + sip->sn_ciaddr = arptable[ARP_CLIENT].ipaddr.s_addr; + sip->sn_siaddr = arptable[ARP_SERVER].ipaddr.s_addr; + sip->sn_giaddr = arptable[ARP_GATEWAY].ipaddr.s_addr; + sip->sn_netmask = netmask; + memcpy(sip->sn_macaddr, arptable[ARP_CLIENT].node, ETH_ALEN); + dhcpack_length = sizeof (*sip) + sip->sn_maclen - 1; +#endif /* SOLARIS_NETBOOT */ +} + +/** + * cleanup_net + * + * Mark network unusable, and disable NICs + */ +void cleanup_net (void) +{ + if (network_ready){ + /* Stop receiving packets. */ + if (use_bios_pxe) + undi_pxe_disable(); + else + eth_disable (); + network_ready = 0; + } +} + +/******************************************************************* + * dhcp implementation reusing the BIOS pxe stack + */ +static void +dhcp_copy(struct dhcp_t *dhcpreply) +{ + unsigned long time; + int ret, len = DHCP_OPT_LEN; + + /* fill in netinfo */ + dhcpack_length = sizeof (struct dhcp_t); + memcpy((char *)dhcpack_buf, (char *)dhcpreply, dhcpack_length); + + memcpy(arptable[ARP_CLIENT].node, dhcpreply->bp_hwaddr, ETH_ALEN); + arptable[ARP_CLIENT].ipaddr.s_addr = dhcpreply->bp_yiaddr.s_addr; + dhcp_addr.s_addr = dhcpreply->bp_yiaddr.s_addr; + netmask = default_netmask(); + arptable[ARP_SERVER].ipaddr.s_addr = dhcpreply->bp_siaddr.s_addr; + memset(arptable[ARP_SERVER].node, 0, ETH_ALEN); /* Kill arp */ + arptable[ARP_GATEWAY].ipaddr.s_addr = dhcpreply->bp_giaddr.s_addr; + memset(arptable[ARP_GATEWAY].node, 0, ETH_ALEN); /* Kill arp */ + /* We don't care bootpreply->bp_file. It must be 'pxegrub' */ + memcpy((char *)rfc1533_venddata, (char *)(dhcpreply->bp_vend), len); + decode_rfc1533(rfc1533_venddata, 0, len, 1); +} + +int dhcp_undi(void) +{ + struct dhcp_t *dhcpreply; + + if (!undi_bios_pxe((void **)&dhcpreply)) + return 0; + + dhcp_copy(dhcpreply); + network_ready = 1; + use_bios_pxe = 1; + return (1); +} diff --git a/usr/src/grub/grub-0.97/netboot/nic.h b/usr/src/grub/grub-0.97/netboot/nic.h new file mode 100644 index 0000000000..40b35daf01 --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/nic.h @@ -0,0 +1,45 @@ + /* + * 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. + */ + +#ifndef NIC_H +#define NIC_H + +#include "dev.h" + +typedef enum { + DISABLE = 0, + ENABLE, + FORCE +} irq_action_t; + +/* + * Structure returned from eth_probe and passed to other driver + * functions. + */ +struct nic +{ + struct dev dev; /* This must come first */ + int (*poll)P((struct nic *, int retrieve)); + void (*transmit)P((struct nic *, const char *d, + unsigned int t, unsigned int s, const char *p)); + void (*irq)P((struct nic *, irq_action_t)); + int flags; /* driver specific flags */ + struct rom_info *rom_info; /* -> rom_info from main */ + unsigned char *node_addr; + unsigned char *packet; + unsigned int packetlen; + unsigned int ioaddr; + unsigned char irqno; + void *priv_data; /* driver can hang private data here */ +}; + +extern int eth_probe(struct dev *dev); +extern int eth_poll(int retrieve); +extern void eth_transmit(const char *d, unsigned int t, unsigned int s, const void *p); +extern void eth_disable(void); +extern void eth_irq(irq_action_t action); +#endif /* NIC_H */ diff --git a/usr/src/grub/grub-0.97/netboot/ns83820.c b/usr/src/grub/grub-0.97/netboot/ns83820.c new file mode 100644 index 0000000000..d104d9cdae --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/ns83820.c @@ -0,0 +1,1020 @@ +/************************************************************************** +* ns83820.c: Etherboot device driver for the National Semiconductor 83820 +* Written 2004 by Timothy Legge +* +* 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. +* +* Portions of this code based on: +* ns83820.c by Benjamin LaHaise with contributions +* for Linux kernel 2.4.x. +* +* Linux Driver Version 0.20, 20020610 +* +* This development of this Etherboot driver was funded by: +* +* NXTV: http://www.nxtv.com/ +* +* REVISION HISTORY: +* ================ +* +* v1.0 02-16-2004 timlegge Initial port of Linux driver +* v1.1 02-19-2004 timlegge More rohbust transmit and poll +* +* Indent Options: indent -kr -i8 +***************************************************************************/ + +/* to get some global routines like printf */ +#include "etherboot.h" +/* to get the interface to the body of the program */ +#include "nic.h" +/* to get the PCI support functions, if this is a PCI NIC */ +#include "pci.h" + +#if ARCH == ia64 /* Support 64-bit addressing */ +#define USE_64BIT_ADDR +#endif + +//#define DDEBUG +#ifdef DDEBUG +#define dprintf(x) printf x +#else +#define dprintf(x) +#endif + +typedef unsigned char u8; +typedef signed char s8; +typedef unsigned short u16; +typedef signed short s16; +typedef unsigned int u32; +typedef signed int s32; + +#define HZ 100 + +/* Condensed operations for readability. */ +#define virt_to_le32desc(addr) cpu_to_le32(virt_to_bus(addr)) +#define le32desc_to_virt(addr) bus_to_virt(le32_to_cpu(addr)) + +/* NIC specific static variables go here */ + +/* Global parameters. See MODULE_PARM near the bottom. */ +// static int ihr = 2; +static int reset_phy = 0; +static int lnksts = 0; /* CFG_LNKSTS bit polarity */ + +#if defined(CONFIG_HIGHMEM64G) || defined(__ia64__) +#define USE_64BIT_ADDR "+" +#endif + +#if defined(USE_64BIT_ADDR) +#define TRY_DAC 1 +#else +#define TRY_DAC 0 +#endif + +/* tunables */ +#define RX_BUF_SIZE 1500 /* 8192 */ + +/* Must not exceed ~65000. */ +#define NR_RX_DESC 64 +#define NR_TX_DESC 1 + + /* not tunable *//* Extra 6 bytes for 64 bit alignment (divisable by 8) */ +#define REAL_RX_BUF_SIZE (RX_BUF_SIZE + 14 + 6) /* rx/tx mac addr + type */ + +#define MIN_TX_DESC_FREE 8 + +/* register defines */ +#define CFGCS 0x04 + +#define CR_TXE 0x00000001 +#define CR_TXD 0x00000002 +/* Ramit : Here's a tip, don't do a RXD immediately followed by an RXE + * The Receive engine skips one descriptor and moves + * onto the next one!! */ +#define CR_RXE 0x00000004 +#define CR_RXD 0x00000008 +#define CR_TXR 0x00000010 +#define CR_RXR 0x00000020 +#define CR_SWI 0x00000080 +#define CR_RST 0x00000100 + +#define PTSCR_EEBIST_FAIL 0x00000001 +#define PTSCR_EEBIST_EN 0x00000002 +#define PTSCR_EELOAD_EN 0x00000004 +#define PTSCR_RBIST_FAIL 0x000001b8 +#define PTSCR_RBIST_DONE 0x00000200 +#define PTSCR_RBIST_EN 0x00000400 +#define PTSCR_RBIST_RST 0x00002000 + +#define MEAR_EEDI 0x00000001 +#define MEAR_EEDO 0x00000002 +#define MEAR_EECLK 0x00000004 +#define MEAR_EESEL 0x00000008 +#define MEAR_MDIO 0x00000010 +#define MEAR_MDDIR 0x00000020 +#define MEAR_MDC 0x00000040 + +#define ISR_TXDESC3 0x40000000 +#define ISR_TXDESC2 0x20000000 +#define ISR_TXDESC1 0x10000000 +#define ISR_TXDESC0 0x08000000 +#define ISR_RXDESC3 0x04000000 +#define ISR_RXDESC2 0x02000000 +#define ISR_RXDESC1 0x01000000 +#define ISR_RXDESC0 0x00800000 +#define ISR_TXRCMP 0x00400000 +#define ISR_RXRCMP 0x00200000 +#define ISR_DPERR 0x00100000 +#define ISR_SSERR 0x00080000 +#define ISR_RMABT 0x00040000 +#define ISR_RTABT 0x00020000 +#define ISR_RXSOVR 0x00010000 +#define ISR_HIBINT 0x00008000 +#define ISR_PHY 0x00004000 +#define ISR_PME 0x00002000 +#define ISR_SWI 0x00001000 +#define ISR_MIB 0x00000800 +#define ISR_TXURN 0x00000400 +#define ISR_TXIDLE 0x00000200 +#define ISR_TXERR 0x00000100 +#define ISR_TXDESC 0x00000080 +#define ISR_TXOK 0x00000040 +#define ISR_RXORN 0x00000020 +#define ISR_RXIDLE 0x00000010 +#define ISR_RXEARLY 0x00000008 +#define ISR_RXERR 0x00000004 +#define ISR_RXDESC 0x00000002 +#define ISR_RXOK 0x00000001 + +#define TXCFG_CSI 0x80000000 +#define TXCFG_HBI 0x40000000 +#define TXCFG_MLB 0x20000000 +#define TXCFG_ATP 0x10000000 +#define TXCFG_ECRETRY 0x00800000 +#define TXCFG_BRST_DIS 0x00080000 +#define TXCFG_MXDMA1024 0x00000000 +#define TXCFG_MXDMA512 0x00700000 +#define TXCFG_MXDMA256 0x00600000 +#define TXCFG_MXDMA128 0x00500000 +#define TXCFG_MXDMA64 0x00400000 +#define TXCFG_MXDMA32 0x00300000 +#define TXCFG_MXDMA16 0x00200000 +#define TXCFG_MXDMA8 0x00100000 + +#define CFG_LNKSTS 0x80000000 +#define CFG_SPDSTS 0x60000000 +#define CFG_SPDSTS1 0x40000000 +#define CFG_SPDSTS0 0x20000000 +#define CFG_DUPSTS 0x10000000 +#define CFG_TBI_EN 0x01000000 +#define CFG_MODE_1000 0x00400000 +/* Ramit : Dont' ever use AUTO_1000, it never works and is buggy. + * Read the Phy response and then configure the MAC accordingly */ +#define CFG_AUTO_1000 0x00200000 +#define CFG_PINT_CTL 0x001c0000 +#define CFG_PINT_DUPSTS 0x00100000 +#define CFG_PINT_LNKSTS 0x00080000 +#define CFG_PINT_SPDSTS 0x00040000 +#define CFG_TMRTEST 0x00020000 +#define CFG_MRM_DIS 0x00010000 +#define CFG_MWI_DIS 0x00008000 +#define CFG_T64ADDR 0x00004000 +#define CFG_PCI64_DET 0x00002000 +#define CFG_DATA64_EN 0x00001000 +#define CFG_M64ADDR 0x00000800 +#define CFG_PHY_RST 0x00000400 +#define CFG_PHY_DIS 0x00000200 +#define CFG_EXTSTS_EN 0x00000100 +#define CFG_REQALG 0x00000080 +#define CFG_SB 0x00000040 +#define CFG_POW 0x00000020 +#define CFG_EXD 0x00000010 +#define CFG_PESEL 0x00000008 +#define CFG_BROM_DIS 0x00000004 +#define CFG_EXT_125 0x00000002 +#define CFG_BEM 0x00000001 + +#define EXTSTS_UDPPKT 0x00200000 +#define EXTSTS_TCPPKT 0x00080000 +#define EXTSTS_IPPKT 0x00020000 + +#define SPDSTS_POLARITY (CFG_SPDSTS1 | CFG_SPDSTS0 | CFG_DUPSTS | (lnksts ? CFG_LNKSTS : 0)) + +#define MIBC_MIBS 0x00000008 +#define MIBC_ACLR 0x00000004 +#define MIBC_FRZ 0x00000002 +#define MIBC_WRN 0x00000001 + +#define PCR_PSEN (1 << 31) +#define PCR_PS_MCAST (1 << 30) +#define PCR_PS_DA (1 << 29) +#define PCR_STHI_8 (3 << 23) +#define PCR_STLO_4 (1 << 23) +#define PCR_FFHI_8K (3 << 21) +#define PCR_FFLO_4K (1 << 21) +#define PCR_PAUSE_CNT 0xFFFE + +#define RXCFG_AEP 0x80000000 +#define RXCFG_ARP 0x40000000 +#define RXCFG_STRIPCRC 0x20000000 +#define RXCFG_RX_FD 0x10000000 +#define RXCFG_ALP 0x08000000 +#define RXCFG_AIRL 0x04000000 +#define RXCFG_MXDMA512 0x00700000 +#define RXCFG_DRTH 0x0000003e +#define RXCFG_DRTH0 0x00000002 + +#define RFCR_RFEN 0x80000000 +#define RFCR_AAB 0x40000000 +#define RFCR_AAM 0x20000000 +#define RFCR_AAU 0x10000000 +#define RFCR_APM 0x08000000 +#define RFCR_APAT 0x07800000 +#define RFCR_APAT3 0x04000000 +#define RFCR_APAT2 0x02000000 +#define RFCR_APAT1 0x01000000 +#define RFCR_APAT0 0x00800000 +#define RFCR_AARP 0x00400000 +#define RFCR_MHEN 0x00200000 +#define RFCR_UHEN 0x00100000 +#define RFCR_ULM 0x00080000 + +#define VRCR_RUDPE 0x00000080 +#define VRCR_RTCPE 0x00000040 +#define VRCR_RIPE 0x00000020 +#define VRCR_IPEN 0x00000010 +#define VRCR_DUTF 0x00000008 +#define VRCR_DVTF 0x00000004 +#define VRCR_VTREN 0x00000002 +#define VRCR_VTDEN 0x00000001 + +#define VTCR_PPCHK 0x00000008 +#define VTCR_GCHK 0x00000004 +#define VTCR_VPPTI 0x00000002 +#define VTCR_VGTI 0x00000001 + +#define CR 0x00 +#define CFG 0x04 +#define MEAR 0x08 +#define PTSCR 0x0c +#define ISR 0x10 +#define IMR 0x14 +#define IER 0x18 +#define IHR 0x1c +#define TXDP 0x20 +#define TXDP_HI 0x24 +#define TXCFG 0x28 +#define GPIOR 0x2c +#define RXDP 0x30 +#define RXDP_HI 0x34 +#define RXCFG 0x38 +#define PQCR 0x3c +#define WCSR 0x40 +#define PCR 0x44 +#define RFCR 0x48 +#define RFDR 0x4c + +#define SRR 0x58 + +#define VRCR 0xbc +#define VTCR 0xc0 +#define VDR 0xc4 +#define CCSR 0xcc + +#define TBICR 0xe0 +#define TBISR 0xe4 +#define TANAR 0xe8 +#define TANLPAR 0xec +#define TANER 0xf0 +#define TESR 0xf4 + +#define TBICR_MR_AN_ENABLE 0x00001000 +#define TBICR_MR_RESTART_AN 0x00000200 + +#define TBISR_MR_LINK_STATUS 0x00000020 +#define TBISR_MR_AN_COMPLETE 0x00000004 + +#define TANAR_PS2 0x00000100 +#define TANAR_PS1 0x00000080 +#define TANAR_HALF_DUP 0x00000040 +#define TANAR_FULL_DUP 0x00000020 + +#define GPIOR_GP5_OE 0x00000200 +#define GPIOR_GP4_OE 0x00000100 +#define GPIOR_GP3_OE 0x00000080 +#define GPIOR_GP2_OE 0x00000040 +#define GPIOR_GP1_OE 0x00000020 +#define GPIOR_GP3_OUT 0x00000004 +#define GPIOR_GP1_OUT 0x00000001 + +#define LINK_AUTONEGOTIATE 0x01 +#define LINK_DOWN 0x02 +#define LINK_UP 0x04 + + +#define __kick_rx() writel(CR_RXE, ns->base + CR) + +#define kick_rx() do { \ + dprintf(("kick_rx: maybe kicking\n")); \ + writel(virt_to_le32desc(&rx_ring[ns->cur_rx]), ns->base + RXDP); \ + if (ns->next_rx == ns->next_empty) \ + printf("uh-oh: next_rx == next_empty???\n"); \ + __kick_rx(); \ +} while(0) + + +#ifdef USE_64BIT_ADDR +#define HW_ADDR_LEN 8 +#else +#define HW_ADDR_LEN 4 +#endif + +#define CMDSTS_OWN 0x80000000 +#define CMDSTS_MORE 0x40000000 +#define CMDSTS_INTR 0x20000000 +#define CMDSTS_ERR 0x10000000 +#define CMDSTS_OK 0x08000000 +#define CMDSTS_LEN_MASK 0x0000ffff + +#define CMDSTS_DEST_MASK 0x01800000 +#define CMDSTS_DEST_SELF 0x00800000 +#define CMDSTS_DEST_MULTI 0x01000000 + +#define DESC_SIZE 8 /* Should be cache line sized */ + +#ifdef USE_64BIT_ADDR +struct ring_desc { + uint64_t link; + uint64_t bufptr; + u32 cmdsts; + u32 extsts; /* Extended status field */ +}; +#else +struct ring_desc { + u32 link; + u32 bufptr; + u32 cmdsts; + u32 extsts; /* Extended status field */ +}; +#endif + +/* Define the TX Descriptor */ +static struct ring_desc tx_ring[NR_TX_DESC] + __attribute__ ((aligned(8))); + +/* Create a static buffer of size REAL_RX_BUF_SIZE for each +TX Descriptor. All descriptors point to a +part of this buffer */ +static unsigned char txb[NR_TX_DESC * REAL_RX_BUF_SIZE]; + +/* Define the TX Descriptor */ +static struct ring_desc rx_ring[NR_RX_DESC] + __attribute__ ((aligned(8))); + +/* Create a static buffer of size REAL_RX_BUF_SIZE for each +RX Descriptor All descriptors point to a +part of this buffer */ +static unsigned char rxb[NR_RX_DESC * REAL_RX_BUF_SIZE] + __attribute__ ((aligned(8))); + +/* Private Storage for the NIC */ +struct ns83820_private { + u8 *base; + int up; + long idle; + u32 *next_rx_desc; + u16 next_rx, next_empty; + u32 cur_rx; + u32 *descs; + unsigned ihr; + u32 CFG_cache; + u32 MEAR_cache; + u32 IMR_cache; + int linkstate; + u16 tx_done_idx; + u16 tx_idx; + u16 tx_intr_idx; + u32 phy_descs; + u32 *tx_descs; + +} nsx; +static struct ns83820_private *ns; + +static void phy_intr(struct nic *nic __unused) +{ + static char *speeds[] = + { "10", "100", "1000", "1000(?)", "1000F" }; + u32 cfg, new_cfg; + u32 tbisr, tanar, tanlpar; + int speed, fullduplex, newlinkstate; + + cfg = readl(ns->base + CFG) ^ SPDSTS_POLARITY; + if (ns->CFG_cache & CFG_TBI_EN) { + /* we have an optical transceiver */ + tbisr = readl(ns->base + TBISR); + tanar = readl(ns->base + TANAR); + tanlpar = readl(ns->base + TANLPAR); + dprintf(("phy_intr: tbisr=%hX, tanar=%hX, tanlpar=%hX\n", + tbisr, tanar, tanlpar)); + + if ((fullduplex = (tanlpar & TANAR_FULL_DUP) + && (tanar & TANAR_FULL_DUP))) { + + /* both of us are full duplex */ + writel(readl(ns->base + TXCFG) + | TXCFG_CSI | TXCFG_HBI | TXCFG_ATP, + ns->base + TXCFG); + writel(readl(ns->base + RXCFG) | RXCFG_RX_FD, + ns->base + RXCFG); + /* Light up full duplex LED */ + writel(readl(ns->base + GPIOR) | GPIOR_GP1_OUT, + ns->base + GPIOR); + + } else if (((tanlpar & TANAR_HALF_DUP) + && (tanar & TANAR_HALF_DUP)) + || ((tanlpar & TANAR_FULL_DUP) + && (tanar & TANAR_HALF_DUP)) + || ((tanlpar & TANAR_HALF_DUP) + && (tanar & TANAR_FULL_DUP))) { + + /* one or both of us are half duplex */ + writel((readl(ns->base + TXCFG) + & ~(TXCFG_CSI | TXCFG_HBI)) | TXCFG_ATP, + ns->base + TXCFG); + writel(readl(ns->base + RXCFG) & ~RXCFG_RX_FD, + ns->base + RXCFG); + /* Turn off full duplex LED */ + writel(readl(ns->base + GPIOR) & ~GPIOR_GP1_OUT, + ns->base + GPIOR); + } + + speed = 4; /* 1000F */ + + } else { + /* we have a copper transceiver */ + new_cfg = + ns->CFG_cache & ~(CFG_SB | CFG_MODE_1000 | CFG_SPDSTS); + + if (cfg & CFG_SPDSTS1) + new_cfg |= CFG_MODE_1000; + else + new_cfg &= ~CFG_MODE_1000; + + speed = ((cfg / CFG_SPDSTS0) & 3); + fullduplex = (cfg & CFG_DUPSTS); + + if (fullduplex) + new_cfg |= CFG_SB; + + if ((cfg & CFG_LNKSTS) && + ((new_cfg ^ ns->CFG_cache) & CFG_MODE_1000)) { + writel(new_cfg, ns->base + CFG); + ns->CFG_cache = new_cfg; + } + + ns->CFG_cache &= ~CFG_SPDSTS; + ns->CFG_cache |= cfg & CFG_SPDSTS; + } + + newlinkstate = (cfg & CFG_LNKSTS) ? LINK_UP : LINK_DOWN; + + if (newlinkstate & LINK_UP && ns->linkstate != newlinkstate) { + printf("link now %s mbps, %s duplex and up.\n", + speeds[speed], fullduplex ? "full" : "half"); + } else if (newlinkstate & LINK_DOWN + && ns->linkstate != newlinkstate) { + printf("link now down.\n"); + } + ns->linkstate = newlinkstate; +} +static void ns83820_set_multicast(struct nic *nic __unused); +static void ns83820_setup_rx(struct nic *nic) +{ + unsigned i; + ns->idle = 1; + ns->next_rx = 0; + ns->next_rx_desc = ns->descs; + ns->next_empty = 0; + ns->cur_rx = 0; + + + for (i = 0; i < NR_RX_DESC; i++) { + rx_ring[i].link = virt_to_le32desc(&rx_ring[i + 1]); + rx_ring[i].bufptr = + virt_to_le32desc(&rxb[i * REAL_RX_BUF_SIZE]); + rx_ring[i].cmdsts = cpu_to_le32(REAL_RX_BUF_SIZE); + rx_ring[i].extsts = cpu_to_le32(0); + } +// No need to wrap the ring +// rx_ring[i].link = virt_to_le32desc(&rx_ring[0]); + writel(0, ns->base + RXDP_HI); + writel(virt_to_le32desc(&rx_ring[0]), ns->base + RXDP); + + dprintf(("starting receiver\n")); + + writel(0x0001, ns->base + CCSR); + writel(0, ns->base + RFCR); + writel(0x7fc00000, ns->base + RFCR); + writel(0xffc00000, ns->base + RFCR); + + ns->up = 1; + + phy_intr(nic); + + /* Okay, let it rip */ + ns->IMR_cache |= ISR_PHY; + ns->IMR_cache |= ISR_RXRCMP; + //dev->IMR_cache |= ISR_RXERR; + //dev->IMR_cache |= ISR_RXOK; + ns->IMR_cache |= ISR_RXORN; + ns->IMR_cache |= ISR_RXSOVR; + ns->IMR_cache |= ISR_RXDESC; + ns->IMR_cache |= ISR_RXIDLE; + ns->IMR_cache |= ISR_TXDESC; + ns->IMR_cache |= ISR_TXIDLE; + + // No reason to enable interupts... + // writel(ns->IMR_cache, ns->base + IMR); + // writel(1, ns->base + IER); + ns83820_set_multicast(nic); + kick_rx(); +} + + +static void ns83820_do_reset(struct nic *nic __unused, u32 which) +{ + dprintf(("resetting chip...\n")); + writel(which, ns->base + CR); + do { + + } while (readl(ns->base + CR) & which); + dprintf(("okay!\n")); +} + +static void ns83820_reset(struct nic *nic) +{ + unsigned i; + dprintf(("ns83820_reset\n")); + + writel(0, ns->base + PQCR); + + ns83820_setup_rx(nic); + + for (i = 0; i < NR_TX_DESC; i++) { + tx_ring[i].link = 0; + tx_ring[i].bufptr = 0; + tx_ring[i].cmdsts = cpu_to_le32(0); + tx_ring[i].extsts = cpu_to_le32(0); + } + + ns->tx_idx = 0; + ns->tx_done_idx = 0; + writel(0, ns->base + TXDP_HI); + return; +} +static void ns83820_getmac(struct nic *nic __unused, u8 * mac) +{ + unsigned i; + for (i = 0; i < 3; i++) { + u32 data; + /* Read from the perfect match memory: this is loaded by + * the chip from the EEPROM via the EELOAD self test. + */ + writel(i * 2, ns->base + RFCR); + data = readl(ns->base + RFDR); + *mac++ = data; + *mac++ = data >> 8; + } +} + +static void ns83820_set_multicast(struct nic *nic __unused) +{ + u8 *rfcr = ns->base + RFCR; + u32 and_mask = 0xffffffff; + u32 or_mask = 0; + u32 val; + + /* Support Multicast */ + and_mask &= ~(RFCR_AAU | RFCR_AAM); + or_mask |= RFCR_AAM; + val = (readl(rfcr) & and_mask) | or_mask; + /* Ramit : RFCR Write Fix doc says RFEN must be 0 modify other bits */ + writel(val & ~RFCR_RFEN, rfcr); + writel(val, rfcr); + +} +static void ns83820_run_bist(struct nic *nic __unused, const char *name, + u32 enable, u32 done, u32 fail) +{ + int timed_out = 0; + long start; + u32 status; + int loops = 0; + + dprintf(("start %s\n", name)) + + start = currticks(); + + writel(enable, ns->base + PTSCR); + for (;;) { + loops++; + status = readl(ns->base + PTSCR); + if (!(status & enable)) + break; + if (status & done) + break; + if (status & fail) + break; + if ((currticks() - start) >= HZ) { + timed_out = 1; + break; + } + } + + if (status & fail) + printf("%s failed! (0x%hX & 0x%hX)\n", name, status, fail); + else if (timed_out) + printf("run_bist %s timed out! (%hX)\n", name, status); + dprintf(("done %s in %d loops\n", name, loops)); +} + +/************************************* +Check Link +*************************************/ +static void ns83820_check_intr(struct nic *nic) { + int i; + u32 isr = readl(ns->base + ISR); + if(ISR_PHY & isr) + phy_intr(nic); + if(( ISR_RXIDLE | ISR_RXDESC | ISR_RXERR) & isr) + kick_rx(); + for (i = 0; i < NR_RX_DESC; i++) { + if (rx_ring[i].cmdsts == CMDSTS_OWN) { +// rx_ring[i].link = virt_to_le32desc(&rx_ring[i + 1]); + rx_ring[i].cmdsts = cpu_to_le32(REAL_RX_BUF_SIZE); + } + } +} +/************************************************************************** +POLL - Wait for a frame +***************************************************************************/ +static int ns83820_poll(struct nic *nic, int retrieve) +{ + /* return true if there's an ethernet packet ready to read */ + /* nic->packet should contain data on return */ + /* nic->packetlen should contain length of data */ + u32 cmdsts; + int entry = ns->cur_rx; + + ns83820_check_intr(nic); + + cmdsts = le32_to_cpu(rx_ring[entry].cmdsts); + + if ( ! ( (CMDSTS_OWN & (cmdsts)) && (cmdsts != (CMDSTS_OWN)) ) ) + return 0; + + if ( ! retrieve ) return 1; + + if (! (CMDSTS_OK & cmdsts) ) + return 0; + + nic->packetlen = cmdsts & 0xffff; + memcpy(nic->packet, + rxb + (entry * REAL_RX_BUF_SIZE), + nic->packetlen); + // rx_ring[entry].link = 0; + rx_ring[entry].cmdsts = cpu_to_le32(CMDSTS_OWN); + + ns->cur_rx = ++ns->cur_rx % NR_RX_DESC; + + if (ns->cur_rx == 0) /* We have wrapped the ring */ + kick_rx(); + + return 1; +} + +static inline void kick_tx(struct nic *nic __unused) +{ + dprintf(("kick_tx\n")); + writel(CR_TXE, ns->base + CR); +} + +/************************************************************************** +TRANSMIT - Transmit a frame +***************************************************************************/ +static void ns83820_transmit(struct nic *nic, const char *d, /* Destination */ + unsigned int t, /* Type */ + unsigned int s, /* size */ + const char *p) +{ /* Packet */ + /* send the packet to destination */ + + u16 nstype; + u32 cmdsts, extsts; + int cur_tx = 0; + u32 isr = readl(ns->base + ISR); + if (ISR_TXIDLE & isr) + kick_tx(nic); + /* point to the current txb incase multiple tx_rings are used */ + memcpy(txb, d, ETH_ALEN); + memcpy(txb + ETH_ALEN, nic->node_addr, ETH_ALEN); + nstype = htons((u16) t); + memcpy(txb + 2 * ETH_ALEN, (u8 *) & nstype, 2); + memcpy(txb + ETH_HLEN, p, s); + s += ETH_HLEN; + s &= 0x0FFF; + while (s < ETH_ZLEN) + txb[s++] = '\0'; + + /* Setup the transmit descriptor */ + extsts = 0; + extsts |= EXTSTS_UDPPKT; + + tx_ring[cur_tx].bufptr = virt_to_le32desc(&txb); + tx_ring[cur_tx].extsts = cpu_to_le32(extsts); + + cmdsts = cpu_to_le32(0); + cmdsts |= cpu_to_le32(CMDSTS_OWN | s); + tx_ring[cur_tx].cmdsts = cpu_to_le32(cmdsts); + + writel(virt_to_le32desc(&tx_ring[0]), ns->base + TXDP); + kick_tx(nic); +} + +/************************************************************************** +DISABLE - Turn off ethernet interface +***************************************************************************/ +static void ns83820_disable(struct dev *dev) +{ + /* put the card in its initial state */ + /* This function serves 3 purposes. + * This disables DMA and interrupts so we don't receive + * unexpected packets or interrupts from the card after + * etherboot has finished. + * This frees resources so etherboot may use + * this driver on another interface + * This allows etherboot to reinitialize the interface + * if something is something goes wrong. + */ + /* disable interrupts */ + writel(0, ns->base + IMR); + writel(0, ns->base + IER); + readl(ns->base + IER); + + ns->up = 0; + + ns83820_do_reset((struct nic *) dev, CR_RST); + + ns->IMR_cache &= + ~(ISR_RXOK | ISR_RXDESC | ISR_RXERR | ISR_RXEARLY | + ISR_RXIDLE); + writel(ns->IMR_cache, ns->base + IMR); + + /* touch the pci bus... */ + readl(ns->base + IMR); + + /* assumes the transmitter is already disabled and reset */ + writel(0, ns->base + RXDP_HI); + writel(0, ns->base + RXDP); +} + +/************************************************************************** +IRQ - Enable, Disable, or Force interrupts +***************************************************************************/ +static void ns83820_irq(struct nic *nic __unused, irq_action_t action __unused) +{ + switch ( action ) { + case DISABLE : + break; + case ENABLE : + break; + case FORCE : + break; + } +} + +/************************************************************************** +PROBE - Look for an adapter, this routine's visible to the outside +***************************************************************************/ + +#define board_found 1 +#define valid_link 0 +static int ns83820_probe(struct dev *dev, struct pci_device *pci) +{ + struct nic *nic = (struct nic *) dev; + int sz; + long addr; + int using_dac = 0; + + if (pci->ioaddr == 0) + return 0; + + printf("ns83820.c: Found %s, vendor=0x%hX, device=0x%hX\n", + pci->name, pci->vendor, pci->dev_id); + + /* point to private storage */ + ns = &nsx; + + adjust_pci_device(pci); + + addr = pci_bar_start(pci, PCI_BASE_ADDRESS_1); + sz = pci_bar_size(pci, PCI_BASE_ADDRESS_1); + + ns->base = ioremap(addr, (1UL << 12)); +// ns->base = ioremap(addr, sz); + + if (!ns->base) + return 0; + + nic->irqno = 0; + nic->ioaddr = pci->ioaddr & ~3; + + /* disable interrupts */ + writel(0, ns->base + IMR); + writel(0, ns->base + IER); + readl(ns->base + IER); + + ns->IMR_cache = 0; + + ns83820_do_reset(nic, CR_RST); + + /* Must reset the ram bist before running it */ + writel(PTSCR_RBIST_RST, ns->base + PTSCR); + ns83820_run_bist(nic, "sram bist", PTSCR_RBIST_EN, + PTSCR_RBIST_DONE, PTSCR_RBIST_FAIL); + ns83820_run_bist(nic, "eeprom bist", PTSCR_EEBIST_EN, 0, + PTSCR_EEBIST_FAIL); + ns83820_run_bist(nic, "eeprom load", PTSCR_EELOAD_EN, 0, 0); + + /* I love config registers */ + ns->CFG_cache = readl(ns->base + CFG); + + if ((ns->CFG_cache & CFG_PCI64_DET)) { + printf("%s: detected 64 bit PCI data bus.\n", pci->name); + /*dev->CFG_cache |= CFG_DATA64_EN; */ + if (!(ns->CFG_cache & CFG_DATA64_EN)) + printf + ("%s: EEPROM did not enable 64 bit bus. Disabled.\n", + pci->name); + } else + ns->CFG_cache &= ~(CFG_DATA64_EN); + + ns->CFG_cache &= (CFG_TBI_EN | CFG_MRM_DIS | CFG_MWI_DIS | + CFG_T64ADDR | CFG_DATA64_EN | CFG_EXT_125 | + CFG_M64ADDR); + ns->CFG_cache |= + CFG_PINT_DUPSTS | CFG_PINT_LNKSTS | CFG_PINT_SPDSTS | + CFG_EXTSTS_EN | CFG_EXD | CFG_PESEL; + ns->CFG_cache |= CFG_REQALG; + ns->CFG_cache |= CFG_POW; + ns->CFG_cache |= CFG_TMRTEST; + + /* When compiled with 64 bit addressing, we must always enable + * the 64 bit descriptor format. + */ +#ifdef USE_64BIT_ADDR + ns->CFG_cache |= CFG_M64ADDR; +#endif + +//FIXME: Enable section on dac or remove this + if (using_dac) + ns->CFG_cache |= CFG_T64ADDR; + + /* Big endian mode does not seem to do what the docs suggest */ + ns->CFG_cache &= ~CFG_BEM; + + /* setup optical transceiver if we have one */ + if (ns->CFG_cache & CFG_TBI_EN) { + dprintf(("%s: enabling optical transceiver\n", pci->name)); + writel(readl(ns->base + GPIOR) | 0x3e8, ns->base + GPIOR); + + /* setup auto negotiation feature advertisement */ + writel(readl(ns->base + TANAR) + | TANAR_HALF_DUP | TANAR_FULL_DUP, + ns->base + TANAR); + + /* start auto negotiation */ + writel(TBICR_MR_AN_ENABLE | TBICR_MR_RESTART_AN, + ns->base + TBICR); + writel(TBICR_MR_AN_ENABLE, ns->base + TBICR); + ns->linkstate = LINK_AUTONEGOTIATE; + + ns->CFG_cache |= CFG_MODE_1000; + } + writel(ns->CFG_cache, ns->base + CFG); + dprintf(("CFG: %hX\n", ns->CFG_cache)); + + /* FIXME: reset_phy is defaulted to 0, should we reset anyway? */ + if (reset_phy) { + dprintf(("%s: resetting phy\n", pci->name)); + writel(ns->CFG_cache | CFG_PHY_RST, ns->base + CFG); + writel(ns->CFG_cache, ns->base + CFG); + } +#if 0 /* Huh? This sets the PCI latency register. Should be done via + * the PCI layer. FIXME. + */ + if (readl(dev->base + SRR)) + writel(readl(dev->base + 0x20c) | 0xfe00, + dev->base + 0x20c); +#endif + + /* Note! The DMA burst size interacts with packet + * transmission, such that the largest packet that + * can be transmitted is 8192 - FLTH - burst size. + * If only the transmit fifo was larger... + */ + /* Ramit : 1024 DMA is not a good idea, it ends up banging + * some DELL and COMPAQ SMP systems */ + writel(TXCFG_CSI | TXCFG_HBI | TXCFG_ATP | TXCFG_MXDMA512 + | ((1600 / 32) * 0x100), ns->base + TXCFG); + + /* Set Rx to full duplex, don't accept runt, errored, long or length + * range errored packets. Use 512 byte DMA. + */ + /* Ramit : 1024 DMA is not a good idea, it ends up banging + * some DELL and COMPAQ SMP systems + * Turn on ALP, only we are accpeting Jumbo Packets */ + writel(RXCFG_AEP | RXCFG_ARP | RXCFG_AIRL | RXCFG_RX_FD + | RXCFG_STRIPCRC + //| RXCFG_ALP + | (RXCFG_MXDMA512) | 0, ns->base + RXCFG); + + /* Disable priority queueing */ + writel(0, ns->base + PQCR); + + /* Enable IP checksum validation and detetion of VLAN headers. + * Note: do not set the reject options as at least the 0x102 + * revision of the chip does not properly accept IP fragments + * at least for UDP. + */ + /* Ramit : Be sure to turn on RXCFG_ARP if VLAN's are enabled, since + * the MAC it calculates the packetsize AFTER stripping the VLAN + * header, and if a VLAN Tagged packet of 64 bytes is received (like + * a ping with a VLAN header) then the card, strips the 4 byte VLAN + * tag and then checks the packet size, so if RXCFG_ARP is not enabled, + * it discrards it!. These guys...... + */ + writel(VRCR_IPEN | VRCR_VTDEN, ns->base + VRCR); + + /* Enable per-packet TCP/UDP/IP checksumming */ + writel(VTCR_PPCHK, ns->base + VTCR); + + /* Ramit : Enable async and sync pause frames */ +// writel(0, ns->base + PCR); + writel((PCR_PS_MCAST | PCR_PS_DA | PCR_PSEN | PCR_FFLO_4K | + PCR_FFHI_8K | PCR_STLO_4 | PCR_STHI_8 | PCR_PAUSE_CNT), + ns->base + PCR); + + /* Disable Wake On Lan */ + writel(0, ns->base + WCSR); + + ns83820_getmac(nic, nic->node_addr); + printf("%! at ioaddr 0x%hX, ", nic->node_addr, ns->base); + + if (using_dac) { + dprintf(("%s: using 64 bit addressing.\n", pci->name)); + } + + dprintf(("%s: DP83820 %d.%d: %! io=0x%hX\n", + pci->name, + (unsigned) readl(ns->base + SRR) >> 8, + (unsigned) readl(ns->base + SRR) & 0xff, + nic->node_addr, pci->ioaddr)); + +#ifdef PHY_CODE_IS_FINISHED + ns83820_probe_phy(dev); +#endif + + ns83820_reset(nic); + /* point to NIC specific routines */ + dev->disable = ns83820_disable; + nic->poll = ns83820_poll; + nic->transmit = ns83820_transmit; + nic->irq = ns83820_irq; + return 1; +} + +static struct pci_id ns83820_nics[] = { + PCI_ROM(0x100b, 0x0022, "ns83820", "National Semiconductor 83820"), +}; + +struct pci_driver ns83820_driver = { + .type = NIC_DRIVER, + .name = "NS83820/PCI", + .probe = ns83820_probe, + .ids = ns83820_nics, + .id_count = sizeof(ns83820_nics) / sizeof(ns83820_nics[0]), + .class = 0, +}; diff --git a/usr/src/grub/grub-0.97/netboot/ns8390.c b/usr/src/grub/grub-0.97/netboot/ns8390.c new file mode 100644 index 0000000000..14e0dd1176 --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/ns8390.c @@ -0,0 +1,1016 @@ +/************************************************************************** +ETHERBOOT - BOOTP/TFTP Bootstrap Program + +Author: Martin Renters + Date: May/94 + + This code is based heavily on David Greenman's if_ed.c driver + + Copyright (C) 1993-1994, David Greenman, Martin Renters. + This software may be used, modified, copied, distributed, and sold, in + both source and binary form provided that the above copyright and these + terms are retained. Under no circumstances are the authors responsible for + the proper functioning of this software, nor do the authors assume any + responsibility for damages incurred with its use. + +Multicast support added by Timothy Legge (timlegge@users.sourceforge.net) 09/28/2003 +Relocation support added by Ken Yap (ken_yap@users.sourceforge.net) 28/12/02 +3c503 support added by Bill Paul (wpaul@ctr.columbia.edu) on 11/15/94 +SMC8416 support added by Bill Paul (wpaul@ctr.columbia.edu) on 12/25/94 +3c503 PIO support added by Jim Hague (jim.hague@acm.org) on 2/17/98 +RX overrun by Klaus Espenlaub (espenlaub@informatik.uni-ulm.de) on 3/10/99 + parts taken from the Linux 8390 driver (by Donald Becker and Paul Gortmaker) +SMC8416 PIO support added by Andrew Bettison (andrewb@zip.com.au) on 4/3/02 + based on the Linux 8390 driver (by Donald Becker and Paul Gortmaker) + +**************************************************************************/ + +#include "etherboot.h" +#include "nic.h" +#include "ns8390.h" +#ifdef INCLUDE_NS8390 +#include "pci.h" +#else +#include "isa.h" +#endif + +static unsigned char eth_vendor, eth_flags; +#ifdef INCLUDE_WD +static unsigned char eth_laar; +#endif +static unsigned short eth_nic_base, eth_asic_base; +static unsigned char eth_memsize, eth_rx_start, eth_tx_start; +static Address eth_bmem, eth_rmem; +static unsigned char eth_drain_receiver; + +#ifdef INCLUDE_WD +static struct wd_board { + const char *name; + char id; + char flags; + char memsize; +} wd_boards[] = { + {"WD8003S", TYPE_WD8003S, 0, MEM_8192}, + {"WD8003E", TYPE_WD8003E, 0, MEM_8192}, + {"WD8013EBT", TYPE_WD8013EBT, FLAG_16BIT, MEM_16384}, + {"WD8003W", TYPE_WD8003W, 0, MEM_8192}, + {"WD8003EB", TYPE_WD8003EB, 0, MEM_8192}, + {"WD8013W", TYPE_WD8013W, FLAG_16BIT, MEM_16384}, + {"WD8003EP/WD8013EP", + TYPE_WD8013EP, 0, MEM_8192}, + {"WD8013WC", TYPE_WD8013WC, FLAG_16BIT, MEM_16384}, + {"WD8013EPC", TYPE_WD8013EPC, FLAG_16BIT, MEM_16384}, + {"SMC8216T", TYPE_SMC8216T, FLAG_16BIT | FLAG_790, MEM_16384}, + {"SMC8216C", TYPE_SMC8216C, FLAG_16BIT | FLAG_790, MEM_16384}, + {"SMC8416T", TYPE_SMC8416T, FLAG_16BIT | FLAG_790, MEM_8192}, + {"SMC8416C/BT", TYPE_SMC8416C, FLAG_16BIT | FLAG_790, MEM_8192}, + {"SMC8013EBP", TYPE_SMC8013EBP,FLAG_16BIT, MEM_16384}, + {NULL, 0, 0, 0} +}; +#endif + +#ifdef INCLUDE_3C503 +static unsigned char t503_output; /* AUI or internal xcvr (Thinnet) */ +#endif + +#if defined(INCLUDE_WD) +#define ASIC_PIO WD_IAR +#define eth_probe wd_probe +#if defined(INCLUDE_3C503) || defined(INCLUDE_NE) || defined(INCLUDE_NS8390) +Error you must only define one of INCLUDE_WD, INCLUDE_3C503, INCLUDE_NE, INCLUDE_NS8390 +#endif +#endif + +#if defined(INCLUDE_3C503) +#define eth_probe t503_probe +#if defined(INCLUDE_NE) || defined(INCLUDE_NS8390) || defined(INCLUDE_WD) +Error you must only define one of INCLUDE_WD, INCLUDE_3C503, INCLUDE_NE, INCLUDE_NS8390 +#endif +#endif + +#if defined(INCLUDE_NE) +#define eth_probe ne_probe +#if defined(INCLUDE_NS8390) || defined(INCLUDE_3C503) || defined(INCLUDE_WD) +Error you must only define one of INCLUDE_WD, INCLUDE_3C503, INCLUDE_NE, INCLUDE_NS8390 +#endif +#endif + +#if defined(INCLUDE_NS8390) +#define eth_probe nepci_probe +#if defined(INCLUDE_NE) || defined(INCLUDE_3C503) || defined(INCLUDE_WD) +Error you must only define one of INCLUDE_WD, INCLUDE_3C503, INCLUDE_NE, INCLUDE_NS8390 +#endif +#endif + +#if defined(INCLUDE_3C503) +#define ASIC_PIO _3COM_RFMSB +#else +#if defined(INCLUDE_NE) || defined(INCLUDE_NS8390) +#define ASIC_PIO NE_DATA +#endif +#endif + +#if defined(INCLUDE_NE) || defined(INCLUDE_NS8390) || (defined(INCLUDE_3C503) && !defined(T503_SHMEM)) || (defined(INCLUDE_WD) && defined(WD_790_PIO)) +/************************************************************************** +ETH_PIO_READ - Read a frame via Programmed I/O +**************************************************************************/ +static void eth_pio_read(unsigned int src, unsigned char *dst, unsigned int cnt) +{ +#ifdef INCLUDE_WD + outb(src & 0xff, eth_asic_base + WD_GP2); + outb(src >> 8, eth_asic_base + WD_GP2); +#else + outb(D8390_COMMAND_RD2 | + D8390_COMMAND_STA, eth_nic_base + D8390_P0_COMMAND); + outb(cnt, eth_nic_base + D8390_P0_RBCR0); + outb(cnt>>8, eth_nic_base + D8390_P0_RBCR1); + outb(src, eth_nic_base + D8390_P0_RSAR0); + outb(src>>8, eth_nic_base + D8390_P0_RSAR1); + outb(D8390_COMMAND_RD0 | + D8390_COMMAND_STA, eth_nic_base + D8390_P0_COMMAND); + +#ifdef INCLUDE_3C503 + outb(src & 0xff, eth_asic_base + _3COM_DALSB); + outb(src >> 8, eth_asic_base + _3COM_DAMSB); + outb(t503_output | _3COM_CR_START, eth_asic_base + _3COM_CR); +#endif +#endif + + if (eth_flags & FLAG_16BIT) + cnt = (cnt + 1) >> 1; + + while(cnt--) { +#ifdef INCLUDE_3C503 + while((inb(eth_asic_base + _3COM_STREG) & _3COM_STREG_DPRDY) == 0) + ; +#endif + + if (eth_flags & FLAG_16BIT) { + *((unsigned short *)dst) = inw(eth_asic_base + ASIC_PIO); + dst += 2; + } + else + *(dst++) = inb(eth_asic_base + ASIC_PIO); + } + +#ifdef INCLUDE_3C503 + outb(t503_output, eth_asic_base + _3COM_CR); +#endif +} + +/************************************************************************** +ETH_PIO_WRITE - Write a frame via Programmed I/O +**************************************************************************/ +static void eth_pio_write(const unsigned char *src, unsigned int dst, unsigned int cnt) +{ +#ifdef COMPEX_RL2000_FIX + unsigned int x; +#endif /* COMPEX_RL2000_FIX */ +#ifdef INCLUDE_WD + outb(dst & 0xff, eth_asic_base + WD_GP2); + outb(dst >> 8, eth_asic_base + WD_GP2); +#else + outb(D8390_COMMAND_RD2 | + D8390_COMMAND_STA, eth_nic_base + D8390_P0_COMMAND); + outb(D8390_ISR_RDC, eth_nic_base + D8390_P0_ISR); + outb(cnt, eth_nic_base + D8390_P0_RBCR0); + outb(cnt>>8, eth_nic_base + D8390_P0_RBCR1); + outb(dst, eth_nic_base + D8390_P0_RSAR0); + outb(dst>>8, eth_nic_base + D8390_P0_RSAR1); + outb(D8390_COMMAND_RD1 | + D8390_COMMAND_STA, eth_nic_base + D8390_P0_COMMAND); + +#ifdef INCLUDE_3C503 + outb(dst & 0xff, eth_asic_base + _3COM_DALSB); + outb(dst >> 8, eth_asic_base + _3COM_DAMSB); + + outb(t503_output | _3COM_CR_DDIR | _3COM_CR_START, eth_asic_base + _3COM_CR); +#endif +#endif + + if (eth_flags & FLAG_16BIT) + cnt = (cnt + 1) >> 1; + + while(cnt--) + { +#ifdef INCLUDE_3C503 + while((inb(eth_asic_base + _3COM_STREG) & _3COM_STREG_DPRDY) == 0) + ; +#endif + + if (eth_flags & FLAG_16BIT) { + outw(*((unsigned short *)src), eth_asic_base + ASIC_PIO); + src += 2; + } + else + outb(*(src++), eth_asic_base + ASIC_PIO); + } + +#ifdef INCLUDE_3C503 + outb(t503_output, eth_asic_base + _3COM_CR); +#else +#ifdef COMPEX_RL2000_FIX + for (x = 0; + x < COMPEX_RL2000_TRIES && + (inb(eth_nic_base + D8390_P0_ISR) & D8390_ISR_RDC) + != D8390_ISR_RDC; + ++x); + if (x >= COMPEX_RL2000_TRIES) + printf("Warning: Compex RL2000 aborted wait!\n"); +#endif /* COMPEX_RL2000_FIX */ +#ifndef INCLUDE_WD + while((inb(eth_nic_base + D8390_P0_ISR) & D8390_ISR_RDC) + != D8390_ISR_RDC); +#endif +#endif +} +#else +/************************************************************************** +ETH_PIO_READ - Dummy routine when NE2000 not compiled in +**************************************************************************/ +static void eth_pio_read(unsigned int src __unused, unsigned char *dst __unused, unsigned int cnt __unused) {} +#endif + + +/************************************************************************** +enable_multycast - Enable Multicast +**************************************************************************/ +static void enable_multicast(unsigned short eth_nic_base) +{ + unsigned char mcfilter[8]; + int i; + memset(mcfilter, 0xFF, 8); + outb(4, eth_nic_base+D8390_P0_RCR); + outb(D8390_COMMAND_RD2 + D8390_COMMAND_PS1, eth_nic_base + D8390_P0_COMMAND); + for(i=0;i<8;i++) + { + outb(mcfilter[i], eth_nic_base + 8 + i); + if(inb(eth_nic_base + 8 + i)!=mcfilter[i]) + printf("Error SMC 83C690 Multicast filter read/write mishap %d\n",i); + } + outb(D8390_COMMAND_RD2 + D8390_COMMAND_PS0, eth_nic_base + D8390_P0_COMMAND); + outb(4 | 0x08, eth_nic_base+D8390_P0_RCR); +} + +/************************************************************************** +NS8390_RESET - Reset adapter +**************************************************************************/ +static void ns8390_reset(struct nic *nic) +{ + int i; + + eth_drain_receiver = 0; +#ifdef INCLUDE_WD + if (eth_flags & FLAG_790) + outb(D8390_COMMAND_PS0 | D8390_COMMAND_STP, eth_nic_base+D8390_P0_COMMAND); + else +#endif + outb(D8390_COMMAND_PS0 | D8390_COMMAND_RD2 | + D8390_COMMAND_STP, eth_nic_base+D8390_P0_COMMAND); + if (eth_flags & FLAG_16BIT) + outb(0x49, eth_nic_base+D8390_P0_DCR); + else + outb(0x48, eth_nic_base+D8390_P0_DCR); + outb(0, eth_nic_base+D8390_P0_RBCR0); + outb(0, eth_nic_base+D8390_P0_RBCR1); + outb(0x20, eth_nic_base+D8390_P0_RCR); /* monitor mode */ + outb(2, eth_nic_base+D8390_P0_TCR); + outb(eth_tx_start, eth_nic_base+D8390_P0_TPSR); + outb(eth_rx_start, eth_nic_base+D8390_P0_PSTART); +#ifdef INCLUDE_WD + if (eth_flags & FLAG_790) { +#ifdef WD_790_PIO + outb(0x10, eth_asic_base + 0x06); /* disable interrupts, enable PIO */ + outb(0x01, eth_nic_base + 0x09); /* enable ring read auto-wrap */ +#else + outb(0, eth_nic_base + 0x09); +#endif + } +#endif + outb(eth_memsize, eth_nic_base+D8390_P0_PSTOP); + outb(eth_memsize - 1, eth_nic_base+D8390_P0_BOUND); + outb(0xFF, eth_nic_base+D8390_P0_ISR); + outb(0, eth_nic_base+D8390_P0_IMR); +#ifdef INCLUDE_WD + if (eth_flags & FLAG_790) + outb(D8390_COMMAND_PS1 | + D8390_COMMAND_STP, eth_nic_base+D8390_P0_COMMAND); + else +#endif + outb(D8390_COMMAND_PS1 | + D8390_COMMAND_RD2 | D8390_COMMAND_STP, eth_nic_base+D8390_P0_COMMAND); + for (i=0; inode_addr[i], eth_nic_base+D8390_P1_PAR0+i); + for (i=0; iflags) ? 0 : _3COM_CR_XSEL; + outb(t503_output, eth_asic_base + _3COM_CR); +#endif +} + +static int ns8390_poll(struct nic *nic, int retrieve); + +#ifndef INCLUDE_3C503 +/************************************************************************** +ETH_RX_OVERRUN - Bring adapter back to work after an RX overrun +**************************************************************************/ +static void eth_rx_overrun(struct nic *nic) +{ + int start_time; + +#ifdef INCLUDE_WD + if (eth_flags & FLAG_790) + outb(D8390_COMMAND_PS0 | D8390_COMMAND_STP, eth_nic_base+D8390_P0_COMMAND); + else +#endif + outb(D8390_COMMAND_PS0 | D8390_COMMAND_RD2 | + D8390_COMMAND_STP, eth_nic_base+D8390_P0_COMMAND); + + /* wait for at least 1.6ms - we wait one timer tick */ + start_time = currticks(); + while (currticks() - start_time <= 1) + /* Nothing */; + + outb(0, eth_nic_base+D8390_P0_RBCR0); /* reset byte counter */ + outb(0, eth_nic_base+D8390_P0_RBCR1); + + /* + * Linux driver checks for interrupted TX here. This is not necessary, + * because the transmit routine waits until the frame is sent. + */ + + /* enter loopback mode and restart NIC */ + outb(2, eth_nic_base+D8390_P0_TCR); +#ifdef INCLUDE_WD + if (eth_flags & FLAG_790) + outb(D8390_COMMAND_PS0 | D8390_COMMAND_STA, eth_nic_base+D8390_P0_COMMAND); + else +#endif + outb(D8390_COMMAND_PS0 | D8390_COMMAND_RD2 | + D8390_COMMAND_STA, eth_nic_base+D8390_P0_COMMAND); + + /* clear the RX ring, acknowledge overrun interrupt */ + eth_drain_receiver = 1; + while (ns8390_poll(nic, 1)) + /* Nothing */; + eth_drain_receiver = 0; + outb(D8390_ISR_OVW, eth_nic_base+D8390_P0_ISR); + + /* leave loopback mode - no packets to be resent (see Linux driver) */ + outb(0, eth_nic_base+D8390_P0_TCR); +} +#endif /* INCLUDE_3C503 */ + +/************************************************************************** +NS8390_TRANSMIT - Transmit a frame +**************************************************************************/ +static void ns8390_transmit( + struct nic *nic, + const char *d, /* Destination */ + unsigned int t, /* Type */ + unsigned int s, /* size */ + const char *p) /* Packet */ +{ +#if defined(INCLUDE_3C503) || (defined(INCLUDE_WD) && ! defined(WD_790_PIO)) + Address eth_vmem = bus_to_virt(eth_bmem); +#endif +#ifdef INCLUDE_3C503 + if (!(eth_flags & FLAG_PIO)) { + memcpy((char *)eth_vmem, d, ETH_ALEN); /* dst */ + memcpy((char *)eth_vmem+ETH_ALEN, nic->node_addr, ETH_ALEN); /* src */ + *((char *)eth_vmem+12) = t>>8; /* type */ + *((char *)eth_vmem+13) = t; + memcpy((char *)eth_vmem+ETH_HLEN, p, s); + s += ETH_HLEN; + while (s < ETH_ZLEN) *((char *)eth_vmem+(s++)) = 0; + } +#endif + +#ifdef INCLUDE_WD + if (eth_flags & FLAG_16BIT) { + outb(eth_laar | WD_LAAR_M16EN, eth_asic_base + WD_LAAR); + inb(0x84); + } +#ifndef WD_790_PIO + /* Memory interface */ + if (eth_flags & FLAG_790) { + outb(WD_MSR_MENB, eth_asic_base + WD_MSR); + inb(0x84); + } + inb(0x84); + memcpy((char *)eth_vmem, d, ETH_ALEN); /* dst */ + memcpy((char *)eth_vmem+ETH_ALEN, nic->node_addr, ETH_ALEN); /* src */ + *((char *)eth_vmem+12) = t>>8; /* type */ + *((char *)eth_vmem+13) = t; + memcpy((char *)eth_vmem+ETH_HLEN, p, s); + s += ETH_HLEN; + while (s < ETH_ZLEN) *((char *)eth_vmem+(s++)) = 0; + if (eth_flags & FLAG_790) { + outb(0, eth_asic_base + WD_MSR); + inb(0x84); + } +#else + inb(0x84); +#endif +#endif + +#if defined(INCLUDE_3C503) + if (eth_flags & FLAG_PIO) +#endif +#if defined(INCLUDE_NE) || defined(INCLUDE_NS8390) || (defined(INCLUDE_3C503) && !defined(T503_SHMEM)) || (defined(INCLUDE_WD) && defined(WD_790_PIO)) + { + /* Programmed I/O */ + unsigned short type; + type = (t >> 8) | (t << 8); + eth_pio_write(d, eth_tx_start<<8, ETH_ALEN); + eth_pio_write(nic->node_addr, (eth_tx_start<<8)+ETH_ALEN, ETH_ALEN); + /* bcc generates worse code without (const+const) below */ + eth_pio_write((unsigned char *)&type, (eth_tx_start<<8)+(ETH_ALEN+ETH_ALEN), 2); + eth_pio_write(p, (eth_tx_start<<8)+ETH_HLEN, s); + s += ETH_HLEN; + if (s < ETH_ZLEN) s = ETH_ZLEN; + } +#endif +#if defined(INCLUDE_3C503) +#endif + +#ifdef INCLUDE_WD + if (eth_flags & FLAG_16BIT) { + outb(eth_laar & ~WD_LAAR_M16EN, eth_asic_base + WD_LAAR); + inb(0x84); + } + if (eth_flags & FLAG_790) + outb(D8390_COMMAND_PS0 | + D8390_COMMAND_STA, eth_nic_base+D8390_P0_COMMAND); + else +#endif + outb(D8390_COMMAND_PS0 | + D8390_COMMAND_RD2 | D8390_COMMAND_STA, eth_nic_base+D8390_P0_COMMAND); + outb(eth_tx_start, eth_nic_base+D8390_P0_TPSR); + outb(s, eth_nic_base+D8390_P0_TBCR0); + outb(s>>8, eth_nic_base+D8390_P0_TBCR1); +#ifdef INCLUDE_WD + if (eth_flags & FLAG_790) + outb(D8390_COMMAND_PS0 | + D8390_COMMAND_TXP | D8390_COMMAND_STA, eth_nic_base+D8390_P0_COMMAND); + else +#endif + outb(D8390_COMMAND_PS0 | + D8390_COMMAND_TXP | D8390_COMMAND_RD2 | + D8390_COMMAND_STA, eth_nic_base+D8390_P0_COMMAND); +} + +/************************************************************************** +NS8390_POLL - Wait for a frame +**************************************************************************/ +static int ns8390_poll(struct nic *nic, int retrieve) +{ + int ret = 0; + unsigned char rstat, curr, next; + unsigned short len, frag; + unsigned short pktoff; + unsigned char *p; + struct ringbuffer pkthdr; + +#ifndef INCLUDE_3C503 + /* avoid infinite recursion: see eth_rx_overrun() */ + if (!eth_drain_receiver && (inb(eth_nic_base+D8390_P0_ISR) & D8390_ISR_OVW)) { + eth_rx_overrun(nic); + return(0); + } +#endif /* INCLUDE_3C503 */ + rstat = inb(eth_nic_base+D8390_P0_RSR); + if (!(rstat & D8390_RSTAT_PRX)) return(0); + next = inb(eth_nic_base+D8390_P0_BOUND)+1; + if (next >= eth_memsize) next = eth_rx_start; + outb(D8390_COMMAND_PS1, eth_nic_base+D8390_P0_COMMAND); + curr = inb(eth_nic_base+D8390_P1_CURR); + outb(D8390_COMMAND_PS0, eth_nic_base+D8390_P0_COMMAND); + if (curr >= eth_memsize) curr=eth_rx_start; + if (curr == next) return(0); + + if ( ! retrieve ) return 1; + +#ifdef INCLUDE_WD + if (eth_flags & FLAG_16BIT) { + outb(eth_laar | WD_LAAR_M16EN, eth_asic_base + WD_LAAR); + inb(0x84); + } +#ifndef WD_790_PIO + if (eth_flags & FLAG_790) { + outb(WD_MSR_MENB, eth_asic_base + WD_MSR); + inb(0x84); + } +#endif + inb(0x84); +#endif + pktoff = next << 8; + if (eth_flags & FLAG_PIO) + eth_pio_read(pktoff, (char *)&pkthdr, 4); + else + memcpy(&pkthdr, bus_to_virt(eth_rmem + pktoff), 4); + pktoff += sizeof(pkthdr); + /* incoming length includes FCS so must sub 4 */ + len = pkthdr.len - 4; + if ((pkthdr.status & D8390_RSTAT_PRX) == 0 || len < ETH_ZLEN + || len > ETH_FRAME_LEN) { + printf("Bogus packet, ignoring\n"); + return (0); + } + else { + p = nic->packet; + nic->packetlen = len; /* available to caller */ + frag = (eth_memsize << 8) - pktoff; + if (len > frag) { /* We have a wrap-around */ + /* read first part */ + if (eth_flags & FLAG_PIO) + eth_pio_read(pktoff, p, frag); + else + memcpy(p, bus_to_virt(eth_rmem + pktoff), frag); + pktoff = eth_rx_start << 8; + p += frag; + len -= frag; + } + /* read second part */ + if (eth_flags & FLAG_PIO) + eth_pio_read(pktoff, p, len); + else + memcpy(p, bus_to_virt(eth_rmem + pktoff), len); + ret = 1; + } +#ifdef INCLUDE_WD +#ifndef WD_790_PIO + if (eth_flags & FLAG_790) { + outb(0, eth_asic_base + WD_MSR); + inb(0x84); + } +#endif + if (eth_flags & FLAG_16BIT) { + outb(eth_laar & ~WD_LAAR_M16EN, eth_asic_base + WD_LAAR); + inb(0x84); + } + inb(0x84); +#endif + next = pkthdr.next; /* frame number of next packet */ + if (next == eth_rx_start) + next = eth_memsize; + outb(next-1, eth_nic_base+D8390_P0_BOUND); + return(ret); +} + +/************************************************************************** +NS8390_DISABLE - Turn off adapter +**************************************************************************/ +static void ns8390_disable(struct dev *dev) +{ + struct nic *nic = (struct nic *)dev; + /* reset and disable merge */ + ns8390_reset(nic); +} + +/************************************************************************** +NS8390_IRQ - Enable, Disable, or Force interrupts +**************************************************************************/ +static void ns8390_irq(struct nic *nic __unused, irq_action_t action __unused) +{ + switch ( action ) { + case DISABLE : + break; + case ENABLE : + break; + case FORCE : + break; + } +} + +/************************************************************************** +ETH_PROBE - Look for an adapter +**************************************************************************/ +#ifdef INCLUDE_NS8390 +static int eth_probe (struct dev *dev, struct pci_device *pci) +#else +static int eth_probe (struct dev *dev, unsigned short *probe_addrs __unused) +#endif +{ + struct nic *nic = (struct nic *)dev; + int i; +#ifdef INCLUDE_NS8390 + unsigned short pci_probe_addrs[] = { pci->ioaddr, 0 }; + unsigned short *probe_addrs = pci_probe_addrs; +#endif + eth_vendor = VENDOR_NONE; + eth_drain_receiver = 0; + + nic->irqno = 0; + +#ifdef INCLUDE_WD +{ + /****************************************************************** + Search for WD/SMC cards + ******************************************************************/ + struct wd_board *brd; + unsigned short chksum; + unsigned char c; + for (eth_asic_base = WD_LOW_BASE; eth_asic_base <= WD_HIGH_BASE; + eth_asic_base += 0x20) { + chksum = 0; + for (i=8; i<16; i++) + chksum += inb(eth_asic_base+i); + /* Extra checks to avoid soundcard */ + if ((chksum & 0xFF) == 0xFF && + inb(eth_asic_base+8) != 0xFF && + inb(eth_asic_base+9) != 0xFF) + break; + } + if (eth_asic_base > WD_HIGH_BASE) + return (0); + /* We've found a board */ + eth_vendor = VENDOR_WD; + eth_nic_base = eth_asic_base + WD_NIC_ADDR; + + nic->ioaddr = eth_nic_base; + + c = inb(eth_asic_base+WD_BID); /* Get board id */ + for (brd = wd_boards; brd->name; brd++) + if (brd->id == c) break; + if (!brd->name) { + printf("Unknown WD/SMC NIC type %hhX\n", c); + return (0); /* Unknown type */ + } + eth_flags = brd->flags; + eth_memsize = brd->memsize; + eth_tx_start = 0; + eth_rx_start = D8390_TXBUF_SIZE; + if ((c == TYPE_WD8013EP) && + (inb(eth_asic_base + WD_ICR) & WD_ICR_16BIT)) { + eth_flags = FLAG_16BIT; + eth_memsize = MEM_16384; + } + if ((c & WD_SOFTCONFIG) && (!(eth_flags & FLAG_790))) { + eth_bmem = (0x80000 | + ((inb(eth_asic_base + WD_MSR) & 0x3F) << 13)); + } else + eth_bmem = WD_DEFAULT_MEM; + if (brd->id == TYPE_SMC8216T || brd->id == TYPE_SMC8216C) { + /* from Linux driver, 8416BT detects as 8216 sometimes */ + unsigned int addr = inb(eth_asic_base + 0xb); + if (((addr >> 4) & 3) == 0) { + brd += 2; + eth_memsize = brd->memsize; + } + } + outb(0x80, eth_asic_base + WD_MSR); /* Reset */ + for (i=0; inode_addr[i] = inb(i+eth_asic_base+WD_LAR); + } + printf("\n%s base %#hx", brd->name, eth_asic_base); + if (eth_flags & FLAG_790) { +#ifdef WD_790_PIO + printf(", PIO mode, addr %!\n", nic->node_addr); + eth_bmem = 0; + eth_flags |= FLAG_PIO; /* force PIO mode */ + outb(0, eth_asic_base+WD_MSR); +#else + printf(", memory %#x, addr %!\n", eth_bmem, nic->node_addr); + outb(WD_MSR_MENB, eth_asic_base+WD_MSR); + outb((inb(eth_asic_base+0x04) | + 0x80), eth_asic_base+0x04); + outb(((unsigned)(eth_bmem >> 13) & 0x0F) | + ((unsigned)(eth_bmem >> 11) & 0x40) | + (inb(eth_asic_base+0x0B) & 0xB0), eth_asic_base+0x0B); + outb((inb(eth_asic_base+0x04) & + ~0x80), eth_asic_base+0x04); +#endif + } else { + printf(", memory %#x, addr %!\n", eth_bmem, nic->node_addr); + outb(((unsigned)(eth_bmem >> 13) & 0x3F) | 0x40, eth_asic_base+WD_MSR); + } + if (eth_flags & FLAG_16BIT) { + if (eth_flags & FLAG_790) { + eth_laar = inb(eth_asic_base + WD_LAAR); + outb(WD_LAAR_M16EN, eth_asic_base + WD_LAAR); + } else { + outb((eth_laar = + WD_LAAR_L16EN | 1), eth_asic_base + WD_LAAR); +/* + The previous line used to be + WD_LAAR_M16EN | WD_LAAR_L16EN | 1)); + jluke@deakin.edu.au reported that removing WD_LAAR_M16EN made + it work for WD8013s. This seems to work for my 8013 boards. I + don't know what is really happening. I wish I had data sheets + or more time to decode the Linux driver. - Ken +*/ + } + inb(0x84); + } +} +#endif +#ifdef INCLUDE_3C503 +#ifdef T503_AUI + nic->flags = 1; /* aui */ +#else + nic->flags = 0; /* no aui */ +#endif + /****************************************************************** + Search for 3Com 3c503 if no WD/SMC cards + ******************************************************************/ + if (eth_vendor == VENDOR_NONE) { + int idx; + int iobase_reg, membase_reg; + static unsigned short base[] = { + 0x300, 0x310, 0x330, 0x350, + 0x250, 0x280, 0x2A0, 0x2E0, 0 }; + + /* Loop through possible addresses checking each one */ + + for (idx = 0; (eth_nic_base = base[idx]) != 0; ++idx) { + + eth_asic_base = eth_nic_base + _3COM_ASIC_OFFSET; +/* + * Note that we use the same settings for both 8 and 16 bit cards: + * both have an 8K bank of memory at page 1 while only the 16 bit + * cards have a bank at page 0. + */ + eth_memsize = MEM_16384; + eth_tx_start = 32; + eth_rx_start = 32 + D8390_TXBUF_SIZE; + + /* Check our base address. iobase and membase should */ + /* both have a maximum of 1 bit set or be 0. */ + + iobase_reg = inb(eth_asic_base + _3COM_BCFR); + membase_reg = inb(eth_asic_base + _3COM_PCFR); + + if ((iobase_reg & (iobase_reg - 1)) || + (membase_reg & (membase_reg - 1))) + continue; /* nope */ + + /* Now get the shared memory address */ + + eth_flags = 0; + + switch (membase_reg) { + case _3COM_PCFR_DC000: + eth_bmem = 0xdc000; + break; + case _3COM_PCFR_D8000: + eth_bmem = 0xd8000; + break; + case _3COM_PCFR_CC000: + eth_bmem = 0xcc000; + break; + case _3COM_PCFR_C8000: + eth_bmem = 0xc8000; + break; + case _3COM_PCFR_PIO: + eth_flags |= FLAG_PIO; + eth_bmem = 0; + break; + default: + continue; /* nope */ + } + break; + } + + if (base[idx] == 0) /* not found */ + return (0); +#ifndef T503_SHMEM + eth_flags |= FLAG_PIO; /* force PIO mode */ + eth_bmem = 0; +#endif + eth_vendor = VENDOR_3COM; + + + /* Need this to make ns8390_poll() happy. */ + + eth_rmem = eth_bmem - 0x2000; + + /* Reset NIC and ASIC */ + + outb(_3COM_CR_RST | _3COM_CR_XSEL, eth_asic_base + _3COM_CR ); + outb(_3COM_CR_XSEL, eth_asic_base + _3COM_CR ); + + /* Get our ethernet address */ + + outb(_3COM_CR_EALO | _3COM_CR_XSEL, eth_asic_base + _3COM_CR); + nic->ioaddr = eth_nic_base; + printf("\n3Com 3c503 base %#hx, ", eth_nic_base); + if (eth_flags & FLAG_PIO) + printf("PIO mode"); + else + printf("memory %#x", eth_bmem); + for (i=0; inode_addr[i] = inb(eth_nic_base+i); + } + printf(", %s, addr %!\n", nic->flags ? "AUI" : "internal xcvr", + nic->node_addr); + outb(_3COM_CR_XSEL, eth_asic_base + _3COM_CR); + /* + * Initialize GA configuration register. Set bank and enable shared + * mem. We always use bank 1. Disable interrupts. + */ + outb(_3COM_GACFR_RSEL | + _3COM_GACFR_MBS0 | _3COM_GACFR_TCM | _3COM_GACFR_NIM, eth_asic_base + _3COM_GACFR); + + outb(0xff, eth_asic_base + _3COM_VPTR2); + outb(0xff, eth_asic_base + _3COM_VPTR1); + outb(0x00, eth_asic_base + _3COM_VPTR0); + /* + * Clear memory and verify that it worked (we use only 8K) + */ + + if (!(eth_flags & FLAG_PIO)) { + memset(bus_to_virt(eth_bmem), 0, 0x2000); + for(i = 0; i < 0x2000; ++i) + if (*((char *)(bus_to_virt(eth_bmem+i)))) { + printf ("Failed to clear 3c503 shared mem.\n"); + return (0); + } + } + /* + * Initialize GA page/start/stop registers. + */ + outb(eth_tx_start, eth_asic_base + _3COM_PSTR); + outb(eth_memsize, eth_asic_base + _3COM_PSPR); + } +#endif +#if defined(INCLUDE_NE) || defined(INCLUDE_NS8390) +{ + /****************************************************************** + Search for NE1000/2000 if no WD/SMC or 3com cards + ******************************************************************/ + unsigned char c; + if (eth_vendor == VENDOR_NONE) { + char romdata[16], testbuf[32]; + int idx; + static char test[] = "NE*000 memory"; + static unsigned short base[] = { +#ifdef NE_SCAN + NE_SCAN, +#endif + 0 }; + /* if no addresses supplied, fall back on defaults */ + if (probe_addrs == 0 || probe_addrs[0] == 0) + probe_addrs = base; + eth_bmem = 0; /* No shared memory */ + for (idx = 0; (eth_nic_base = probe_addrs[idx]) != 0; ++idx) { + eth_flags = FLAG_PIO; + eth_asic_base = eth_nic_base + NE_ASIC_OFFSET; + eth_memsize = MEM_16384; + eth_tx_start = 32; + eth_rx_start = 32 + D8390_TXBUF_SIZE; + c = inb(eth_asic_base + NE_RESET); + outb(c, eth_asic_base + NE_RESET); + inb(0x84); + outb(D8390_COMMAND_STP | + D8390_COMMAND_RD2, eth_nic_base + D8390_P0_COMMAND); + outb(D8390_RCR_MON, eth_nic_base + D8390_P0_RCR); + outb(D8390_DCR_FT1 | D8390_DCR_LS, eth_nic_base + D8390_P0_DCR); + outb(MEM_8192, eth_nic_base + D8390_P0_PSTART); + outb(MEM_16384, eth_nic_base + D8390_P0_PSTOP); +#ifdef NS8390_FORCE_16BIT + eth_flags |= FLAG_16BIT; /* force 16-bit mode */ +#endif + + eth_pio_write(test, 8192, sizeof(test)); + eth_pio_read(8192, testbuf, sizeof(test)); + if (!memcmp(test, testbuf, sizeof(test))) + break; + eth_flags |= FLAG_16BIT; + eth_memsize = MEM_32768; + eth_tx_start = 64; + eth_rx_start = 64 + D8390_TXBUF_SIZE; + outb(D8390_DCR_WTS | + D8390_DCR_FT1 | D8390_DCR_LS, eth_nic_base + D8390_P0_DCR); + outb(MEM_16384, eth_nic_base + D8390_P0_PSTART); + outb(MEM_32768, eth_nic_base + D8390_P0_PSTOP); + eth_pio_write(test, 16384, sizeof(test)); + eth_pio_read(16384, testbuf, sizeof(test)); + if (!memcmp(testbuf, test, sizeof(test))) + break; + } + if (eth_nic_base == 0) + return (0); + if (eth_nic_base > ISA_MAX_ADDR) /* PCI probably */ + eth_flags |= FLAG_16BIT; + eth_vendor = VENDOR_NOVELL; + eth_pio_read(0, romdata, sizeof(romdata)); + for (i=0; inode_addr[i] = romdata[i + ((eth_flags & FLAG_16BIT) ? i : 0)]; + } + nic->ioaddr = eth_nic_base; + printf("\nNE%c000 base %#hx, addr %!\n", + (eth_flags & FLAG_16BIT) ? '2' : '1', eth_nic_base, + nic->node_addr); + } +} +#endif + if (eth_vendor == VENDOR_NONE) + return(0); + if (eth_vendor != VENDOR_3COM) + eth_rmem = eth_bmem; + ns8390_reset(nic); + + dev->disable = ns8390_disable; + nic->poll = ns8390_poll; + nic->transmit = ns8390_transmit; + nic->irq = ns8390_irq; + + /* Based on PnP ISA map */ +#ifdef INCLUDE_WD + dev->devid.vendor_id = htons(GENERIC_ISAPNP_VENDOR); + dev->devid.device_id = htons(0x812a); +#endif +#ifdef INCLUDE_3C503 + dev->devid.vendor_id = htons(GENERIC_ISAPNP_VENDOR); + dev->devid.device_id = htons(0x80f3); +#endif +#ifdef INCLUDE_NE + dev->devid.vendor_id = htons(GENERIC_ISAPNP_VENDOR); + dev->devid.device_id = htons(0x80d6); +#endif + return 1; +} + +#ifdef INCLUDE_WD +static struct isa_driver wd_driver __isa_driver = { + .type = NIC_DRIVER, + .name = "WD", + .probe = wd_probe, + .ioaddrs = 0, +}; +#endif + +#ifdef INCLUDE_3C503 +static struct isa_driver t503_driver __isa_driver = { + .type = NIC_DRIVER, + .name = "3C503", + .probe = t503_probe, + .ioaddrs = 0, +}; +#endif + +#ifdef INCLUDE_NE +static struct isa_driver ne_driver __isa_driver = { + .type = NIC_DRIVER, + .name = "NE*000", + .probe = ne_probe, + .ioaddrs = 0, +}; +#endif + +#ifdef INCLUDE_NS8390 +static struct pci_id nepci_nics[] = { +/* A few NE2000 PCI clones, list not exhaustive */ +PCI_ROM(0x10ec, 0x8029, "rtl8029", "Realtek 8029"), +PCI_ROM(0x1186, 0x0300, "dlink-528", "D-Link DE-528"), +PCI_ROM(0x1050, 0x0940, "winbond940", "Winbond NE2000-PCI"), /* Winbond 86C940 / 89C940 */ +PCI_ROM(0x1050, 0x5a5a, "winbond940f", "Winbond W89c940F"), /* Winbond 89C940F */ +PCI_ROM(0x11f6, 0x1401, "compexrl2000", "Compex ReadyLink 2000"), +PCI_ROM(0x8e2e, 0x3000, "ktiet32p2", "KTI ET32P2"), +PCI_ROM(0x4a14, 0x5000, "nv5000sc", "NetVin NV5000SC"), +PCI_ROM(0x12c3, 0x0058, "holtek80232", "Holtek HT80232"), +PCI_ROM(0x12c3, 0x5598, "holtek80229", "Holtek HT80229"), +PCI_ROM(0x10bd, 0x0e34, "surecom-ne34", "Surecom NE34"), +PCI_ROM(0x1106, 0x0926, "via86c926", "Via 86c926"), +}; + +struct pci_driver nepci_driver = { + .type = NIC_DRIVER, + .name = "NE2000/PCI", + .probe = nepci_probe, + .ids = nepci_nics, + .id_count = sizeof(nepci_nics)/sizeof(nepci_nics[0]), + .class = 0, +}; + +#endif /* INCLUDE_NS8390 */ + +/* + * Local variables: + * c-basic-offset: 8 + * End: + */ + diff --git a/usr/src/grub/grub-0.97/netboot/ns8390.h b/usr/src/grub/grub-0.97/netboot/ns8390.h new file mode 100644 index 0000000000..2c4e972d52 --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/ns8390.h @@ -0,0 +1,238 @@ +/************************************************************************** +ETHERBOOT - BOOTP/TFTP Bootstrap Program + +Author: Martin Renters + Date: Jun/94 + +**************************************************************************/ + +#define VENDOR_NONE 0 +#define VENDOR_WD 1 +#define VENDOR_NOVELL 2 +#define VENDOR_3COM 3 + +#define FLAG_PIO 0x01 +#define FLAG_16BIT 0x02 +#define FLAG_790 0x04 + +#define MEM_8192 32 +#define MEM_16384 64 +#define MEM_32768 128 + +#define ISA_MAX_ADDR 0x400 + +/************************************************************************** +Western Digital/SMC Board Definitions +**************************************************************************/ +#define WD_LOW_BASE 0x200 +#define WD_HIGH_BASE 0x3e0 +#ifndef WD_DEFAULT_MEM +#define WD_DEFAULT_MEM 0xD0000 +#endif +#define WD_NIC_ADDR 0x10 + +/************************************************************************** +Western Digital/SMC ASIC Addresses +**************************************************************************/ +#define WD_MSR 0x00 +#define WD_ICR 0x01 +#define WD_IAR 0x02 +#define WD_BIO 0x03 +#define WD_IRR 0x04 +#define WD_LAAR 0x05 +#define WD_IJR 0x06 +#define WD_GP2 0x07 +#define WD_LAR 0x08 +#define WD_BID 0x0E + +#define WD_ICR_16BIT 0x01 + +#define WD_MSR_MENB 0x40 + +#define WD_LAAR_L16EN 0x40 +#define WD_LAAR_M16EN 0x80 + +#define WD_SOFTCONFIG 0x20 + +/************************************************************************** +Western Digital/SMC Board Types +**************************************************************************/ +#define TYPE_WD8003S 0x02 +#define TYPE_WD8003E 0x03 +#define TYPE_WD8013EBT 0x05 +#define TYPE_WD8003W 0x24 +#define TYPE_WD8003EB 0x25 +#define TYPE_WD8013W 0x26 +#define TYPE_WD8013EP 0x27 +#define TYPE_WD8013WC 0x28 +#define TYPE_WD8013EPC 0x29 +#define TYPE_SMC8216T 0x2a +#define TYPE_SMC8216C 0x2b +#define TYPE_SMC8416T 0x00 /* Bogus entries: the 8416 generates the */ +#define TYPE_SMC8416C 0x00 /* the same codes as the 8216. */ +#define TYPE_SMC8013EBP 0x2c + +/************************************************************************** +3com 3c503 definitions +**************************************************************************/ + +#ifndef _3COM_BASE +#define _3COM_BASE 0x300 +#endif + +#define _3COM_TX_PAGE_OFFSET_8BIT 0x20 +#define _3COM_TX_PAGE_OFFSET_16BIT 0x0 +#define _3COM_RX_PAGE_OFFSET_16BIT 0x20 + +#define _3COM_ASIC_OFFSET 0x400 +#define _3COM_NIC_OFFSET 0x0 + +#define _3COM_PSTR 0 +#define _3COM_PSPR 1 + +#define _3COM_BCFR 3 +#define _3COM_BCFR_2E0 0x01 +#define _3COM_BCFR_2A0 0x02 +#define _3COM_BCFR_280 0x04 +#define _3COM_BCFR_250 0x08 +#define _3COM_BCFR_350 0x10 +#define _3COM_BCFR_330 0x20 +#define _3COM_BCFR_310 0x40 +#define _3COM_BCFR_300 0x80 +#define _3COM_PCFR 4 +#define _3COM_PCFR_PIO 0 +#define _3COM_PCFR_C8000 0x10 +#define _3COM_PCFR_CC000 0x20 +#define _3COM_PCFR_D8000 0x40 +#define _3COM_PCFR_DC000 0x80 +#define _3COM_CR 6 +#define _3COM_CR_RST 0x01 /* Reset GA and NIC */ +#define _3COM_CR_XSEL 0x02 /* Transceiver select. BNC=1(def) AUI=0 */ +#define _3COM_CR_EALO 0x04 /* window EA PROM 0-15 to I/O base */ +#define _3COM_CR_EAHI 0x08 /* window EA PROM 16-31 to I/O base */ +#define _3COM_CR_SHARE 0x10 /* select interrupt sharing option */ +#define _3COM_CR_DBSEL 0x20 /* Double buffer select */ +#define _3COM_CR_DDIR 0x40 /* DMA direction select */ +#define _3COM_CR_START 0x80 /* Start DMA controller */ +#define _3COM_GACFR 5 +#define _3COM_GACFR_MBS0 0x01 +#define _3COM_GACFR_MBS1 0x02 +#define _3COM_GACFR_MBS2 0x04 +#define _3COM_GACFR_RSEL 0x08 /* enable shared memory */ +#define _3COM_GACFR_TEST 0x10 /* for GA testing */ +#define _3COM_GACFR_OWS 0x20 /* select 0WS access to GA */ +#define _3COM_GACFR_TCM 0x40 /* Mask DMA interrupts */ +#define _3COM_GACFR_NIM 0x80 /* Mask NIC interrupts */ +#define _3COM_STREG 7 +#define _3COM_STREG_REV 0x07 /* GA revision */ +#define _3COM_STREG_DIP 0x08 /* DMA in progress */ +#define _3COM_STREG_DTC 0x10 /* DMA terminal count */ +#define _3COM_STREG_OFLW 0x20 /* Overflow */ +#define _3COM_STREG_UFLW 0x40 /* Underflow */ +#define _3COM_STREG_DPRDY 0x80 /* Data port ready */ +#define _3COM_IDCFR 8 +#define _3COM_IDCFR_DRQ0 0x01 /* DMA request 1 select */ +#define _3COM_IDCFR_DRQ1 0x02 /* DMA request 2 select */ +#define _3COM_IDCFR_DRQ2 0x04 /* DMA request 3 select */ +#define _3COM_IDCFR_UNUSED 0x08 /* not used */ +#define _3COM_IDCFR_IRQ2 0x10 /* Interrupt request 2 select */ +#define _3COM_IDCFR_IRQ3 0x20 /* Interrupt request 3 select */ +#define _3COM_IDCFR_IRQ4 0x40 /* Interrupt request 4 select */ +#define _3COM_IDCFR_IRQ5 0x80 /* Interrupt request 5 select */ +#define _3COM_IRQ2 2 +#define _3COM_IRQ3 3 +#define _3COM_IRQ4 4 +#define _3COM_IRQ5 5 +#define _3COM_DAMSB 9 +#define _3COM_DALSB 0x0a +#define _3COM_VPTR2 0x0b +#define _3COM_VPTR1 0x0c +#define _3COM_VPTR0 0x0d +#define _3COM_RFMSB 0x0e +#define _3COM_RFLSB 0x0f + +/************************************************************************** +NE1000/2000 definitions +**************************************************************************/ +#define NE_ASIC_OFFSET 0x10 +#define NE_RESET 0x0F /* Used to reset card */ +#define NE_DATA 0x00 /* Used to read/write NIC mem */ + +#define COMPEX_RL2000_TRIES 200 + +/************************************************************************** +8390 Register Definitions +**************************************************************************/ +#define D8390_P0_COMMAND 0x00 +#define D8390_P0_PSTART 0x01 +#define D8390_P0_PSTOP 0x02 +#define D8390_P0_BOUND 0x03 +#define D8390_P0_TSR 0x04 +#define D8390_P0_TPSR 0x04 +#define D8390_P0_TBCR0 0x05 +#define D8390_P0_TBCR1 0x06 +#define D8390_P0_ISR 0x07 +#define D8390_P0_RSAR0 0x08 +#define D8390_P0_RSAR1 0x09 +#define D8390_P0_RBCR0 0x0A +#define D8390_P0_RBCR1 0x0B +#define D8390_P0_RSR 0x0C +#define D8390_P0_RCR 0x0C +#define D8390_P0_TCR 0x0D +#define D8390_P0_DCR 0x0E +#define D8390_P0_IMR 0x0F +#define D8390_P1_COMMAND 0x00 +#define D8390_P1_PAR0 0x01 +#define D8390_P1_PAR1 0x02 +#define D8390_P1_PAR2 0x03 +#define D8390_P1_PAR3 0x04 +#define D8390_P1_PAR4 0x05 +#define D8390_P1_PAR5 0x06 +#define D8390_P1_CURR 0x07 +#define D8390_P1_MAR0 0x08 + +#define D8390_COMMAND_PS0 0x0 /* Page 0 select */ +#define D8390_COMMAND_PS1 0x40 /* Page 1 select */ +#define D8390_COMMAND_PS2 0x80 /* Page 2 select */ +#define D8390_COMMAND_RD2 0x20 /* Remote DMA control */ +#define D8390_COMMAND_RD1 0x10 +#define D8390_COMMAND_RD0 0x08 +#define D8390_COMMAND_TXP 0x04 /* transmit packet */ +#define D8390_COMMAND_STA 0x02 /* start */ +#define D8390_COMMAND_STP 0x01 /* stop */ + +#define D8390_RCR_MON 0x20 /* monitor mode */ + +#define D8390_DCR_FT1 0x40 +#define D8390_DCR_LS 0x08 /* Loopback select */ +#define D8390_DCR_WTS 0x01 /* Word transfer select */ + +#define D8390_ISR_PRX 0x01 /* successful recv */ +#define D8390_ISR_PTX 0x02 /* successful xmit */ +#define D8390_ISR_RXE 0x04 /* receive error */ +#define D8390_ISR_TXE 0x08 /* transmit error */ +#define D8390_ISR_OVW 0x10 /* Overflow */ +#define D8390_ISR_CNT 0x20 /* Counter overflow */ +#define D8390_ISR_RDC 0x40 /* Remote DMA complete */ +#define D8390_ISR_RST 0x80 /* reset */ + +#define D8390_RSTAT_PRX 0x01 /* successful recv */ +#define D8390_RSTAT_CRC 0x02 /* CRC error */ +#define D8390_RSTAT_FAE 0x04 /* Frame alignment error */ +#define D8390_RSTAT_OVER 0x08 /* FIFO overrun */ + +#define D8390_TXBUF_SIZE 6 +#define D8390_RXBUF_END 32 +#define D8390_PAGE_SIZE 256 + +struct ringbuffer { + unsigned char status; + unsigned char next; + unsigned short len; +}; +/* + * Local variables: + * c-basic-offset: 8 + * End: + */ + diff --git a/usr/src/grub/grub-0.97/netboot/osdep.h b/usr/src/grub/grub-0.97/netboot/osdep.h new file mode 100644 index 0000000000..03b8981d82 --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/osdep.h @@ -0,0 +1,22 @@ +#ifndef _OSDEP_H +#define _OSDEP_H + +#define __unused __attribute__((unused)) +#define __aligned __attribute__((aligned(16))) + +#include "io.h" +#include "byteswap.h" +#include "latch.h" + +#if defined(__sun) +typedef unsigned long Address; +#endif + +/* ANSI prototyping macro */ +#ifdef __STDC__ +# define P(x) x +#else +# define P(x) () +#endif + +#endif diff --git a/usr/src/grub/grub-0.97/netboot/pci.c b/usr/src/grub/grub-0.97/netboot/pci.c new file mode 100644 index 0000000000..59daf02816 --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/pci.c @@ -0,0 +1,530 @@ + +/* + * 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. + */ + +#include "grub.h" +#include "pci.h" + +unsigned long virt_offset = 0; +unsigned long virt_to_phys(volatile const void *virt_addr) +{ + return ((unsigned long)virt_addr) + virt_offset; +} + +void *phys_to_virt(unsigned long phys_addr) +{ + return (void *)(phys_addr - virt_offset); +} + +#ifdef INCLUDE_3C595 +extern struct pci_driver t595_driver; +#endif /* INCLUDE_3C595 */ + +#ifdef INCLUDE_3C90X +extern struct pci_driver a3c90x_driver; +#endif /* INCLUDE_3C90X */ + +#ifdef INCLUDE_DAVICOM +extern struct pci_driver davicom_driver; +#endif /* INCLUDE_DAVICOM */ + +#ifdef INCLUDE_E1000 +extern struct pci_driver e1000_driver; +#endif /* INCLUDE_E1000 */ + +#ifdef INCLUDE_EEPRO100 +extern struct pci_driver eepro100_driver; +#endif /* INCLUDE_EEPRO100 */ + +#ifdef INCLUDE_EPIC100 +extern struct pci_driver epic100_driver; +#endif /* INCLUDE_EPIC100 */ + +#ifdef INCLUDE_FORCEDETH +extern struct pci_driver forcedeth_driver; +#endif /* INCLUDE_FORCEDETH */ + +#ifdef INCLUDE_NATSEMI +extern struct pci_driver natsemi_driver; +#endif /* INCLUDE_NATSEMI */ + +#ifdef INCLUDE_NS83820 +extern struct pci_driver ns83820_driver; +#endif /* INCLUDE_NS83820 */ + +#ifdef INCLUDE_NS8390 +extern struct pci_driver nepci_driver; +#endif /* INCLUDE_NS8390 */ + +#ifdef INCLUDE_PCNET32 +extern struct pci_driver pcnet32_driver; +#endif /* INCLUDE_PCNET32 */ + +#ifdef INCLUDE_PNIC +extern struct pci_driver pnic_driver; +#endif /* INCLUDE_PNIC */ + +#ifdef INCLUDE_RTL8139 +extern struct pci_driver rtl8139_driver; +#endif /* INCLUDE_RTL8139 */ + +#ifdef INCLUDE_SIS900 +extern struct pci_driver sis900_driver; +extern struct pci_driver sis_bridge_driver; +#endif /* INCLUDE_SIS900 */ + +#ifdef INCLUDE_SUNDANCE +extern struct pci_driver sundance_driver; +#endif /* INCLUDE_SUNDANCE */ + +#ifdef INCLUDE_TG3 +extern struct pci_driver tg3_driver; +#endif /* INCLUDE_TG3 */ + +#ifdef INCLUDE_TLAN +extern struct pci_driver tlan_driver; +#endif /* INCLUDE_TLAN */ + +#ifdef INCLUDE_TULIP +extern struct pci_driver tulip_driver; +#endif /* INCLUDE_TULIP */ + +#ifdef INCLUDE_UNDI +extern struct pci_driver undi_driver; +#endif /* INCLUDE_UNDI */ + +#ifdef INCLUDE_VIA_RHINE +extern struct pci_driver rhine_driver; +#endif/* INCLUDE_VIA_RHINE */ + +#ifdef INCLUDE_W89C840 +extern struct pci_driver w89c840_driver; +#endif /* INCLUDE_W89C840 */ + +#ifdef INCLUDE_R8169 +extern struct pci_driver r8169_driver; +#endif /* INCLUDE_R8169 */ + +static const struct pci_driver *pci_drivers[] = { + +#ifdef INCLUDE_3C595 + &t595_driver, +#endif /* INCLUDE_3C595 */ + +#ifdef INCLUDE_3C90X + &a3c90x_driver, +#endif /* INCLUDE_3C90X */ + +#ifdef INCLUDE_DAVICOM + &davicom_driver, +#endif /* INCLUDE_DAVICOM */ + +#ifdef INCLUDE_E1000 + &e1000_driver, +#endif /* INCLUDE_E1000 */ + +#ifdef INCLUDE_EEPRO100 + &eepro100_driver, +#endif /* INCLUDE_EEPRO100 */ + +#ifdef INCLUDE_EPIC100 + &epic100_driver, +#endif /* INCLUDE_EPIC100 */ + +#ifdef INCLUDE_FORCEDETH + &forcedeth_driver, +#endif /* INCLUDE_FORCEDETH */ + +#ifdef INCLUDE_NATSEMI + &natsemi_driver, +#endif /* INCLUDE_NATSEMI */ + +#ifdef INCLUDE_NS83820 + &ns83820_driver, +#endif /* INCLUDE_NS83820 */ + +#ifdef INCLUDE_NS8390 + &nepci_driver, +#endif /* INCLUDE_NS8390 */ + +#ifdef INCLUDE_PCNET32 + &pcnet32_driver, +#endif /* INCLUDE_PCNET32 */ + +#ifdef INCLUDE_PNIC + &pnic_driver, +#endif /* INCLUDE_PNIC */ + +#ifdef INCLUDE_RTL8139 + &rtl8139_driver, +#endif /* INCLUDE_RTL8139 */ + +#ifdef INCLUDE_SIS900 + &sis900_driver, + &sis_bridge_driver, +#endif /* INCLUDE_SIS900 */ + +#ifdef INCLUDE_SUNDANCE + &sundance_driver, +#endif /* INCLUDE_SUNDANCE */ + +#ifdef INCLUDE_TG3 + & tg3_driver, +#endif /* INCLUDE_TG3 */ + +#ifdef INCLUDE_TLAN + &tlan_driver, +#endif /* INCLUDE_TLAN */ + +#ifdef INCLUDE_TULIP + & tulip_driver, +#endif /* INCLUDE_TULIP */ + +#ifdef INCLUDE_VIA_RHINE + &rhine_driver, +#endif/* INCLUDE_VIA_RHINE */ + +#ifdef INCLUDE_W89C840 + &w89c840_driver, +#endif /* INCLUDE_W89C840 */ + +#ifdef INCLUDE_R8169 + &r8169_driver, +#endif /* INCLUDE_R8169 */ + +/* We must be the last one */ +#ifdef INCLUDE_UNDI + &undi_driver, +#endif /* INCLUDE_UNDI */ + + 0 +}; + +static void scan_drivers( + int type, + uint32_t class, uint16_t vendor, uint16_t device, + const struct pci_driver *last_driver, struct pci_device *dev) +{ + const struct pci_driver *skip_driver = last_driver; + /* Assume there is only one match of the correct type */ + const struct pci_driver *driver; + int i, j; + + for(j = 0; pci_drivers[j] != 0; j++){ + driver = pci_drivers[j]; + if (driver->type != type) + continue; + if (skip_driver) { + if (skip_driver == driver) + skip_driver = 0; + continue; + } + for(i = 0; i < driver->id_count; i++) { + if ((vendor == driver->ids[i].vendor) && + (device == driver->ids[i].dev_id)) { + + dev->driver = driver; + dev->name = driver->ids[i].name; + + goto out; + } + } + } + if (!class) { + goto out; + } + for(j = 0; pci_drivers[j] != 0; j++){ + driver = pci_drivers[j]; + if (driver->type != type) + continue; + if (skip_driver) { + if (skip_driver == driver) + skip_driver = 0; + continue; + } + if (last_driver == driver) + continue; + if ((class >> 8) == driver->class) { + dev->driver = driver; + dev->name = driver->name; + goto out; + } + } + out: + return; +} + +void scan_pci_bus(int type, struct pci_device *dev) +{ + unsigned int first_bus, first_devfn; + const struct pci_driver *first_driver; + unsigned int devfn, bus, buses; + unsigned char hdr_type = 0; + uint32_t class; + uint16_t vendor, device; + uint32_t l, membase, ioaddr, romaddr; + int reg; + + EnterFunction("scan_pci_bus"); + first_bus = 0; + first_devfn = 0; + first_driver = 0; + if (dev->driver) { + first_driver = dev->driver; + first_bus = dev->bus; + first_devfn = dev->devfn; + /* Re read the header type on a restart */ + pcibios_read_config_byte(first_bus, first_devfn & ~0x7, + PCI_HEADER_TYPE, &hdr_type); + dev->driver = 0; + dev->bus = 0; + dev->devfn = 0; + } + + /* Scan all PCI buses, until we find our card. + * We could be smart only scan the required buses but that + * is error prone, and tricky. + * By scanning all possible pci buses in order we should find + * our card eventually. + */ + buses=256; + for (bus = first_bus; bus < buses; ++bus) { + for (devfn = first_devfn; devfn < 0xff; ++devfn, first_driver = 0) { + if (PCI_FUNC (devfn) == 0) + pcibios_read_config_byte(bus, devfn, PCI_HEADER_TYPE, &hdr_type); + else if (!(hdr_type & 0x80)) /* not a multi-function device */ + continue; + pcibios_read_config_dword(bus, devfn, PCI_VENDOR_ID, &l); + /* some broken boards return 0 if a slot is empty: */ + if (l == 0xffffffff || l == 0x00000000) { + continue; + } + vendor = l & 0xffff; + device = (l >> 16) & 0xffff; + + pcibios_read_config_dword(bus, devfn, PCI_REVISION, &l); + class = (l >> 8) & 0xffffff; +#if DEBUG + { + int i; + printf("%hhx:%hhx.%hhx [%hX/%hX] ---- ", + bus, PCI_SLOT(devfn), PCI_FUNC(devfn), + vendor, device); +#if DEBUG > 1 + for(i = 0; i < 256; i++) { + unsigned char byte; + if ((i & 0xf) == 0) { + printf("%hhx: ", i); + } + pcibios_read_config_byte(bus, devfn, i, &byte); + printf("%hhx ", byte); + if ((i & 0xf) == 0xf) { + printf("\n"); + } + } +#endif + + } +#endif + scan_drivers(type, class, vendor, device, first_driver, dev); + if (!dev->driver){ +#if DEBUG + printf("No driver fit.\n"); +#endif + continue; + } +#if DEBUG + printf("Get Driver:\n"); +#endif + dev->devfn = devfn; + dev->bus = bus; + dev->class = class; + dev->vendor = vendor; + dev->dev_id = device; + + + /* Get the ROM base address */ + pcibios_read_config_dword(bus, devfn, + PCI_ROM_ADDRESS, &romaddr); + romaddr >>= 10; + dev->romaddr = romaddr; + + /* Get the ``membase'' */ + pcibios_read_config_dword(bus, devfn, + PCI_BASE_ADDRESS_1, &membase); + dev->membase = membase; + + /* Get the ``ioaddr'' */ + for (reg = PCI_BASE_ADDRESS_0; reg <= PCI_BASE_ADDRESS_5; reg += 4) { + pcibios_read_config_dword(bus, devfn, reg, &ioaddr); + if ((ioaddr & PCI_BASE_ADDRESS_IO_MASK) == 0 || (ioaddr & PCI_BASE_ADDRESS_SPACE_IO) == 0) + continue; + + + /* Strip the I/O address out of the returned value */ + ioaddr &= PCI_BASE_ADDRESS_IO_MASK; + + /* Take the first one or the one that matches in boot ROM address */ + dev->ioaddr = ioaddr; + } +#if DEBUG > 2 + printf("Found %s ROM address %#hx\n", + dev->name, romaddr); +#endif + LeaveFunction("scan_pci_bus"); + return; + } + first_devfn = 0; + } + first_bus = 0; + LeaveFunction("scan_pci_bus"); +} + + + +/* + * Set device to be a busmaster in case BIOS neglected to do so. + * Also adjust PCI latency timer to a reasonable value, 32. + */ +void adjust_pci_device(struct pci_device *p) +{ + unsigned short new_command, pci_command; + unsigned char pci_latency; + + pcibios_read_config_word(p->bus, p->devfn, PCI_COMMAND, &pci_command); + new_command = pci_command | PCI_COMMAND_MASTER|PCI_COMMAND_IO; + if (pci_command != new_command) { +#if DEBUG > 0 + printf( + "The PCI BIOS has not enabled this device!\n" + "Updating PCI command %hX->%hX. pci_bus %hhX pci_device_fn %hhX\n", + pci_command, new_command, p->bus, p->devfn); +#endif + pcibios_write_config_word(p->bus, p->devfn, PCI_COMMAND, new_command); + } + pcibios_read_config_byte(p->bus, p->devfn, PCI_LATENCY_TIMER, &pci_latency); + if (pci_latency < 32) { +#if DEBUG > 0 + printf("PCI latency timer (CFLT) is unreasonably low at %d. Setting to 32 clocks.\n", + pci_latency); +#endif + pcibios_write_config_byte(p->bus, p->devfn, PCI_LATENCY_TIMER, 32); + } +} + +/* + * Find the start of a pci resource. + */ +unsigned long pci_bar_start(struct pci_device *dev, unsigned int index) +{ + uint32_t lo, hi; + unsigned long bar; + pci_read_config_dword(dev, index, &lo); + if (lo & PCI_BASE_ADDRESS_SPACE_IO) { + bar = lo & PCI_BASE_ADDRESS_IO_MASK; + } else { + bar = 0; + if ((lo & PCI_BASE_ADDRESS_MEM_TYPE_MASK) == PCI_BASE_ADDRESS_MEM_TYPE_64) { + pci_read_config_dword(dev, index + 4, &hi); + if (hi) { + if (sizeof(unsigned long) > sizeof(uint32_t)) { + /* It's REALLY interesting:-) */ + bar = (uint64_t)hi << 32; + } + else { + printf("Unhandled 64bit BAR\n"); + return -1UL; + } + } + } + bar |= lo & PCI_BASE_ADDRESS_MEM_MASK; + } + return bar + pcibios_bus_base(dev->bus); +} + +/* + * Find the size of a pci resource. + */ +unsigned long pci_bar_size(struct pci_device *dev, unsigned int bar) +{ + uint32_t start, size; + /* Save the original bar */ + pci_read_config_dword(dev, bar, &start); + /* Compute which bits can be set */ + pci_write_config_dword(dev, bar, ~0); + pci_read_config_dword(dev, bar, &size); + /* Restore the original size */ + pci_write_config_dword(dev, bar, start); + /* Find the significant bits */ + if (start & PCI_BASE_ADDRESS_SPACE_IO) { + size &= PCI_BASE_ADDRESS_IO_MASK; + } else { + size &= PCI_BASE_ADDRESS_MEM_MASK; + } + /* Find the lowest bit set */ + size = size & ~(size - 1); + return size; +} + +/** + * pci_find_capability - query for devices' capabilities + * @dev: PCI device to query + * @cap: capability code + * + * Tell if a device supports a given PCI capability. + * Returns the address of the requested capability structure within the + * device's PCI configuration space or 0 in case the device does not + * support it. Possible values for @cap: + * + * %PCI_CAP_ID_PM Power Management + * + * %PCI_CAP_ID_AGP Accelerated Graphics Port + * + * %PCI_CAP_ID_VPD Vital Product Data + * + * %PCI_CAP_ID_SLOTID Slot Identification + * + * %PCI_CAP_ID_MSI Message Signalled Interrupts + * + * %PCI_CAP_ID_CHSWP CompactPCI HotSwap + */ +int pci_find_capability(struct pci_device *dev, int cap) +{ + uint16_t status; + uint8_t pos, id; + uint8_t hdr_type; + int ttl = 48; + + pci_read_config_word(dev, PCI_STATUS, &status); + if (!(status & PCI_STATUS_CAP_LIST)) + return 0; + pci_read_config_byte(dev, PCI_HEADER_TYPE, &hdr_type); + switch (hdr_type & 0x7F) { + case PCI_HEADER_TYPE_NORMAL: + case PCI_HEADER_TYPE_BRIDGE: + default: + pci_read_config_byte(dev, PCI_CAPABILITY_LIST, &pos); + break; + case PCI_HEADER_TYPE_CARDBUS: + pci_read_config_byte(dev, PCI_CB_CAPABILITY_LIST, &pos); + break; + } + while (ttl-- && pos >= 0x40) { + pos &= ~3; + pci_read_config_byte(dev, pos + PCI_CAP_LIST_ID, &id); +#if DEBUG > 0 + printf("Capability: %d\n", id); +#endif + if (id == 0xff) + break; + if (id == cap) + return pos; + pci_read_config_byte(dev, pos + PCI_CAP_LIST_NEXT, &pos); + } + return 0; +} + diff --git a/usr/src/grub/grub-0.97/netboot/pci.h b/usr/src/grub/grub-0.97/netboot/pci.h new file mode 100644 index 0000000000..ac54b7833d --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/pci.h @@ -0,0 +1,357 @@ +#if !defined(PCI_H) && defined(CONFIG_PCI) +#define PCI_H + +/* +** Support for NE2000 PCI clones added David Monro June 1997 +** Generalised for other PCI NICs by Ken Yap July 1997 +** +** Most of this is taken from: +** +** /usr/src/linux/drivers/pci/pci.c +** /usr/src/linux/include/linux/pci.h +** /usr/src/linux/arch/i386/bios32.c +** /usr/src/linux/include/linux/bios32.h +** /usr/src/linux/drivers/net/ne.c +*/ + +/* + * 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. + */ + +#include "pci_ids.h" + +#define PCI_COMMAND_IO 0x1 /* Enable response in I/O space */ +#define PCI_COMMAND_MEM 0x2 /* Enable response in mem space */ +#define PCI_COMMAND_MASTER 0x4 /* Enable bus mastering */ +#define PCI_LATENCY_TIMER 0x0d /* 8 bits */ +#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 PCIBIOS_PCI_FUNCTION_ID 0xb1XX +#define PCIBIOS_PCI_BIOS_PRESENT 0xb101 +#define PCIBIOS_FIND_PCI_DEVICE 0xb102 +#define PCIBIOS_FIND_PCI_CLASS_CODE 0xb103 +#define PCIBIOS_GENERATE_SPECIAL_CYCLE 0xb106 +#define PCIBIOS_READ_CONFIG_BYTE 0xb108 +#define PCIBIOS_READ_CONFIG_WORD 0xb109 +#define PCIBIOS_READ_CONFIG_DWORD 0xb10a +#define PCIBIOS_WRITE_CONFIG_BYTE 0xb10b +#define PCIBIOS_WRITE_CONFIG_WORD 0xb10c +#define PCIBIOS_WRITE_CONFIG_DWORD 0xb10d + +#define PCI_VENDOR_ID 0x00 /* 16 bits */ +#define PCI_DEVICE_ID 0x02 /* 16 bits */ +#define PCI_COMMAND 0x04 /* 16 bits */ + +#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_REVISION 0x08 /* 8 bits */ +#define PCI_REVISION_ID 0x08 /* 8 bits */ +#define PCI_CLASS_REVISION 0x08 /* 32 bits */ +#define PCI_CLASS_CODE 0x0b /* 8 bits */ +#define PCI_SUBCLASS_CODE 0x0a /* 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 + + +/* Header type 0 (normal devices) */ +#define PCI_CARDBUS_CIS 0x28 +#define PCI_SUBSYSTEM_VENDOR_ID 0x2c +#define PCI_SUBSYSTEM_ID 0x2e + +#define PCI_BASE_ADDRESS_0 0x10 /* 32 bits */ +#define PCI_BASE_ADDRESS_1 0x14 /* 32 bits */ +#define PCI_BASE_ADDRESS_2 0x18 /* 32 bits */ +#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_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 */ + +#ifndef PCI_BASE_ADDRESS_IO_MASK +#define PCI_BASE_ADDRESS_IO_MASK (~0x03) +#endif +#ifndef PCI_BASE_ADDRESS_MEM_MASK +#define PCI_BASE_ADDRESS_MEM_MASK (~0x0f) +#endif +#define PCI_BASE_ADDRESS_SPACE_IO 0x01 +#define PCI_ROM_ADDRESS 0x30 /* 32 bits */ +#define PCI_ROM_ADDRESS_ENABLE 0x01 /* Write 1 to enable ROM, + bits 31..11 are address, + 10..2 are reserved */ + +#define PCI_CAPABILITY_LIST 0x34 /* Offset of first capability list entry */ + +#define PCI_INTERRUPT_LINE 0x3c /* IRQ number (0-15) */ +#define PCI_INTERRUPT_PIN 0x3d /* IRQ pin on PCI bus (A-D) */ + +/* 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 0x0f /* I/O bridging type */ +#define PCI_IO_RANGE_TYPE_16 0x00 +#define PCI_IO_RANGE_TYPE_32 0x01 +#define PCI_IO_RANGE_MASK ~0x0f +#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 0x0f +#define PCI_MEMORY_RANGE_MASK ~0x0f +#define PCI_PREF_MEMORY_BASE 0x24 /* Prefetchable memory range behind */ +#define PCI_PREF_MEMORY_LIMIT 0x26 +#define PCI_PREF_RANGE_TYPE_MASK 0x0f +#define PCI_PREF_RANGE_TYPE_32 0x00 +#define PCI_PREF_RANGE_TYPE_64 0x01 +#define PCI_PREF_RANGE_MASK ~0x0f +#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_NO_ISA 0x04 /* Disable bridging of ISA ports */ +#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 */ + +#define PCI_CB_CAPABILITY_LIST 0x14 + +/* 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_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_CTRL 4 /* PM control and status register */ +#define PCI_PM_CTRL_STATE_MASK 0x0003 /* Current power state (D0 to D3) */ +#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 + +/* 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_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_SLOT(devfn) ((devfn) >> 3) +#define PCI_FUNC(devfn) ((devfn) & 0x07) + +#define BIOS32_SIGNATURE (('_' << 0) + ('3' << 8) + ('2' << 16) + ('_' << 24)) + +/* PCI signature: "PCI " */ +#define PCI_SIGNATURE (('P' << 0) + ('C' << 8) + ('I' << 16) + (' ' << 24)) + +/* PCI service signature: "$PCI" */ +#define PCI_SERVICE (('$' << 0) + ('P' << 8) + ('C' << 16) + ('I' << 24)) + +union bios32 { + struct { + unsigned long signature; /* _32_ */ + unsigned long entry; /* 32 bit physical address */ + unsigned char revision; /* Revision level, 0 */ + unsigned char length; /* Length in paragraphs should be 01 */ + unsigned char checksum; /* All bytes must add up to zero */ + unsigned char reserved[5]; /* Must be zero */ + } fields; + char chars[16]; +}; + +struct pci_device; +struct dev; +typedef int (*pci_probe_t)(struct dev *, struct pci_device *); + +struct pci_device { + uint32_t class; + uint16_t vendor, dev_id; + const char *name; + /* membase and ioaddr are silly and depricated */ + unsigned int membase; + unsigned int ioaddr; + unsigned int romaddr; + unsigned char irq; + unsigned char devfn; + unsigned char bus; + unsigned char use_specified; + const struct pci_driver *driver; +}; + +extern void scan_pci_bus(int type, struct pci_device *dev); +extern void find_pci(int type, struct pci_device *dev); + +extern int pcibios_read_config_byte(unsigned int bus, unsigned int device_fn, unsigned int where, uint8_t *value); +extern int pcibios_write_config_byte (unsigned int bus, unsigned int device_fn, unsigned int where, uint8_t value); +extern int pcibios_read_config_word(unsigned int bus, unsigned int device_fn, unsigned int where, uint16_t *value); +extern int pcibios_write_config_word (unsigned int bus, unsigned int device_fn, unsigned int where, uint16_t value); +extern int pcibios_read_config_dword(unsigned int bus, unsigned int device_fn, unsigned int where, uint32_t *value); +extern int pcibios_write_config_dword(unsigned int bus, unsigned int device_fn, unsigned int where, uint32_t value); +extern unsigned long pcibios_bus_base(unsigned int bus); +extern void adjust_pci_device(struct pci_device *p); + + +static inline int +pci_read_config_byte(struct pci_device *dev, unsigned int where, uint8_t *value) +{ + return pcibios_read_config_byte(dev->bus, dev->devfn, where, value); +} +static inline int +pci_write_config_byte(struct pci_device *dev, unsigned int where, uint8_t value) +{ + return pcibios_write_config_byte(dev->bus, dev->devfn, where, value); +} +static inline int +pci_read_config_word(struct pci_device *dev, unsigned int where, uint16_t *value) +{ + return pcibios_read_config_word(dev->bus, dev->devfn, where, value); +} +static inline int +pci_write_config_word(struct pci_device *dev, unsigned int where, uint16_t value) +{ + return pcibios_write_config_word(dev->bus, dev->devfn, where, value); +} +static inline int +pci_read_config_dword(struct pci_device *dev, unsigned int where, uint32_t *value) +{ + return pcibios_read_config_dword(dev->bus, dev->devfn, where, value); +} +static inline int +pci_write_config_dword(struct pci_device *dev, unsigned int where, uint32_t value) +{ + return pcibios_write_config_dword(dev->bus, dev->devfn, where, value); +} + +/* Helper functions to find the size of a pci bar */ +extern unsigned long pci_bar_start(struct pci_device *dev, unsigned int bar); +extern unsigned long pci_bar_size(struct pci_device *dev, unsigned int bar); +/* Helper function to find pci capabilities */ +extern int pci_find_capability(struct pci_device *dev, int cap); +struct pci_id { + unsigned short vendor, dev_id; + const char *name; +}; + +struct dev; +/* Most pci drivers will use this */ +struct pci_driver { + int type; + const char *name; + pci_probe_t probe; + struct pci_id *ids; + int id_count; + +/* On a few occasions the hardware is standardized enough that + * we only need to know the class of the device and not the exact + * type to drive the device correctly. If this is the case + * set a class value other than 0. + */ + unsigned short class; +}; + +#define PCI_ROM(VENDOR_ID, DEVICE_ID, IMAGE, DESCRIPTION) \ + { VENDOR_ID, DEVICE_ID, IMAGE, } + +#endif /* PCI_H */ diff --git a/usr/src/grub/grub-0.97/netboot/pci_ids.h b/usr/src/grub/grub-0.97/netboot/pci_ids.h new file mode 100644 index 0000000000..deec4103cf --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/pci_ids.h @@ -0,0 +1,1809 @@ +/* + * PCI Class, Vendor and Device IDs + * + * Please keep sorted. + */ + +/* Device classes and subclasses */ + +#define PCI_CLASS_NOT_DEFINED 0x0000 +#define PCI_CLASS_NOT_DEFINED_VGA 0x0001 + +#define PCI_BASE_CLASS_STORAGE 0x01 +#define PCI_CLASS_STORAGE_SCSI 0x0100 +#define PCI_CLASS_STORAGE_IDE 0x0101 +#define PCI_CLASS_STORAGE_FLOPPY 0x0102 +#define PCI_CLASS_STORAGE_IPI 0x0103 +#define PCI_CLASS_STORAGE_RAID 0x0104 +#define PCI_CLASS_STORAGE_OTHER 0x0180 + +#define PCI_BASE_CLASS_NETWORK 0x02 +#define PCI_CLASS_NETWORK_ETHERNET 0x0200 +#define PCI_CLASS_NETWORK_TOKEN_RING 0x0201 +#define PCI_CLASS_NETWORK_FDDI 0x0202 +#define PCI_CLASS_NETWORK_ATM 0x0203 +#define PCI_CLASS_NETWORK_OTHER 0x0280 + +#define PCI_BASE_CLASS_DISPLAY 0x03 +#define PCI_CLASS_DISPLAY_VGA 0x0300 +#define PCI_CLASS_DISPLAY_XGA 0x0301 +#define PCI_CLASS_DISPLAY_3D 0x0302 +#define PCI_CLASS_DISPLAY_OTHER 0x0380 + +#define PCI_BASE_CLASS_MULTIMEDIA 0x04 +#define PCI_CLASS_MULTIMEDIA_VIDEO 0x0400 +#define PCI_CLASS_MULTIMEDIA_AUDIO 0x0401 +#define PCI_CLASS_MULTIMEDIA_PHONE 0x0402 +#define PCI_CLASS_MULTIMEDIA_OTHER 0x0480 + +#define PCI_BASE_CLASS_MEMORY 0x05 +#define PCI_CLASS_MEMORY_RAM 0x0500 +#define PCI_CLASS_MEMORY_FLASH 0x0501 +#define PCI_CLASS_MEMORY_OTHER 0x0580 + +#define PCI_BASE_CLASS_BRIDGE 0x06 +#define PCI_CLASS_BRIDGE_HOST 0x0600 +#define PCI_CLASS_BRIDGE_ISA 0x0601 +#define PCI_CLASS_BRIDGE_EISA 0x0602 +#define PCI_CLASS_BRIDGE_MC 0x0603 +#define PCI_CLASS_BRIDGE_PCI 0x0604 +#define PCI_CLASS_BRIDGE_PCMCIA 0x0605 +#define PCI_CLASS_BRIDGE_NUBUS 0x0606 +#define PCI_CLASS_BRIDGE_CARDBUS 0x0607 +#define PCI_CLASS_BRIDGE_RACEWAY 0x0608 +#define PCI_CLASS_BRIDGE_OTHER 0x0680 + +#define PCI_BASE_CLASS_COMMUNICATION 0x07 +#define PCI_CLASS_COMMUNICATION_SERIAL 0x0700 +#define PCI_CLASS_COMMUNICATION_PARALLEL 0x0701 +#define PCI_CLASS_COMMUNICATION_MULTISERIAL 0x0702 +#define PCI_CLASS_COMMUNICATION_MODEM 0x0703 +#define PCI_CLASS_COMMUNICATION_OTHER 0x0780 + +#define PCI_BASE_CLASS_SYSTEM 0x08 +#define PCI_CLASS_SYSTEM_PIC 0x0800 +#define PCI_CLASS_SYSTEM_DMA 0x0801 +#define PCI_CLASS_SYSTEM_TIMER 0x0802 +#define PCI_CLASS_SYSTEM_RTC 0x0803 +#define PCI_CLASS_SYSTEM_PCI_HOTPLUG 0x0804 +#define PCI_CLASS_SYSTEM_OTHER 0x0880 + +#define PCI_BASE_CLASS_INPUT 0x09 +#define PCI_CLASS_INPUT_KEYBOARD 0x0900 +#define PCI_CLASS_INPUT_PEN 0x0901 +#define PCI_CLASS_INPUT_MOUSE 0x0902 +#define PCI_CLASS_INPUT_SCANNER 0x0903 +#define PCI_CLASS_INPUT_GAMEPORT 0x0904 +#define PCI_CLASS_INPUT_OTHER 0x0980 + +#define PCI_BASE_CLASS_DOCKING 0x0a +#define PCI_CLASS_DOCKING_GENERIC 0x0a00 +#define PCI_CLASS_DOCKING_OTHER 0x0a80 + +#define PCI_BASE_CLASS_PROCESSOR 0x0b +#define PCI_CLASS_PROCESSOR_386 0x0b00 +#define PCI_CLASS_PROCESSOR_486 0x0b01 +#define PCI_CLASS_PROCESSOR_PENTIUM 0x0b02 +#define PCI_CLASS_PROCESSOR_ALPHA 0x0b10 +#define PCI_CLASS_PROCESSOR_POWERPC 0x0b20 +#define PCI_CLASS_PROCESSOR_MIPS 0x0b30 +#define PCI_CLASS_PROCESSOR_CO 0x0b40 + +#define PCI_BASE_CLASS_SERIAL 0x0c +#define PCI_CLASS_SERIAL_FIREWIRE 0x0c00 +#define PCI_CLASS_SERIAL_ACCESS 0x0c01 +#define PCI_CLASS_SERIAL_SSA 0x0c02 +#define PCI_CLASS_SERIAL_USB 0x0c03 +#define PCI_CLASS_SERIAL_FIBER 0x0c04 +#define PCI_CLASS_SERIAL_SMBUS 0x0c05 + +#define PCI_BASE_CLASS_INTELLIGENT 0x0e +#define PCI_CLASS_INTELLIGENT_I2O 0x0e00 + +#define PCI_BASE_CLASS_SATELLITE 0x0f +#define PCI_CLASS_SATELLITE_TV 0x0f00 +#define PCI_CLASS_SATELLITE_AUDIO 0x0f01 +#define PCI_CLASS_SATELLITE_VOICE 0x0f03 +#define PCI_CLASS_SATELLITE_DATA 0x0f04 + +#define PCI_BASE_CLASS_CRYPT 0x10 +#define PCI_CLASS_CRYPT_NETWORK 0x1000 +#define PCI_CLASS_CRYPT_ENTERTAINMENT 0x1001 +#define PCI_CLASS_CRYPT_OTHER 0x1080 + +#define PCI_BASE_CLASS_SIGNAL_PROCESSING 0x11 +#define PCI_CLASS_SP_DPIO 0x1100 +#define PCI_CLASS_SP_OTHER 0x1180 + +#define PCI_CLASS_OTHERS 0xff + +/* Vendors and devices. Sort key: vendor first, device next. */ + +#define PCI_VENDOR_ID_DYNALINK 0x0675 +#define PCI_DEVICE_ID_DYNALINK_IS64PH 0x1702 + +#define PCI_VENDOR_ID_BERKOM 0x0871 +#define PCI_DEVICE_ID_BERKOM_A1T 0xffa1 +#define PCI_DEVICE_ID_BERKOM_T_CONCEPT 0xffa2 +#define PCI_DEVICE_ID_BERKOM_A4T 0xffa4 +#define PCI_DEVICE_ID_BERKOM_SCITEL_QUADRO 0xffa8 + +#define PCI_VENDOR_ID_COMPAQ 0x0e11 +#define PCI_DEVICE_ID_COMPAQ_TOKENRING 0x0508 +#define PCI_DEVICE_ID_COMPAQ_1280 0x3033 +#define PCI_DEVICE_ID_COMPAQ_TRIFLEX 0x4000 +#define PCI_DEVICE_ID_COMPAQ_6010 0x6010 +#define PCI_DEVICE_ID_COMPAQ_SMART2P 0xae10 +#define PCI_DEVICE_ID_COMPAQ_NETEL100 0xae32 +#define PCI_DEVICE_ID_COMPAQ_NETEL10 0xae34 +#define PCI_DEVICE_ID_COMPAQ_NETFLEX3I 0xae35 +#define PCI_DEVICE_ID_COMPAQ_NETEL100D 0xae40 +#define PCI_DEVICE_ID_COMPAQ_NETEL100PI 0xae43 +#define PCI_DEVICE_ID_COMPAQ_NETEL100I 0xb011 +#define PCI_DEVICE_ID_COMPAQ_CISS 0xb060 +#define PCI_DEVICE_ID_COMPAQ_CISSB 0xb178 +#define PCI_DEVICE_ID_COMPAQ_THUNDER 0xf130 +#define PCI_DEVICE_ID_COMPAQ_NETFLEX3B 0xf150 + +#define PCI_VENDOR_ID_NCR 0x1000 +#define PCI_VENDOR_ID_LSI_LOGIC 0x1000 +#define PCI_DEVICE_ID_NCR_53C810 0x0001 +#define PCI_DEVICE_ID_NCR_53C820 0x0002 +#define PCI_DEVICE_ID_NCR_53C825 0x0003 +#define PCI_DEVICE_ID_NCR_53C815 0x0004 +#define PCI_DEVICE_ID_LSI_53C810AP 0x0005 +#define PCI_DEVICE_ID_NCR_53C860 0x0006 +#define PCI_DEVICE_ID_LSI_53C1510 0x000a +#define PCI_DEVICE_ID_NCR_53C896 0x000b +#define PCI_DEVICE_ID_NCR_53C895 0x000c +#define PCI_DEVICE_ID_NCR_53C885 0x000d +#define PCI_DEVICE_ID_NCR_53C875 0x000f +#define PCI_DEVICE_ID_NCR_53C1510 0x0010 +#define PCI_DEVICE_ID_LSI_53C895A 0x0012 +#define PCI_DEVICE_ID_LSI_53C875A 0x0013 +#define PCI_DEVICE_ID_LSI_53C1010_33 0x0020 +#define PCI_DEVICE_ID_LSI_53C1010_66 0x0021 +#define PCI_DEVICE_ID_LSI_53C1030 0x0030 +#define PCI_DEVICE_ID_LSI_53C1035 0x0040 +#define PCI_DEVICE_ID_NCR_53C875J 0x008f +#define PCI_DEVICE_ID_LSI_FC909 0x0621 +#define PCI_DEVICE_ID_LSI_FC929 0x0622 +#define PCI_DEVICE_ID_LSI_FC929_LAN 0x0623 +#define PCI_DEVICE_ID_LSI_FC919 0x0624 +#define PCI_DEVICE_ID_LSI_FC919_LAN 0x0625 +#define PCI_DEVICE_ID_NCR_YELLOWFIN 0x0701 +#define PCI_DEVICE_ID_LSI_61C102 0x0901 +#define PCI_DEVICE_ID_LSI_63C815 0x1000 + +#define PCI_VENDOR_ID_ATI 0x1002 +/* Mach64 */ +#define PCI_DEVICE_ID_ATI_68800 0x4158 +#define PCI_DEVICE_ID_ATI_215CT222 0x4354 +#define PCI_DEVICE_ID_ATI_210888CX 0x4358 +#define PCI_DEVICE_ID_ATI_215ET222 0x4554 +/* Mach64 / Rage */ +#define PCI_DEVICE_ID_ATI_215GB 0x4742 +#define PCI_DEVICE_ID_ATI_215GD 0x4744 +#define PCI_DEVICE_ID_ATI_215GI 0x4749 +#define PCI_DEVICE_ID_ATI_215GP 0x4750 +#define PCI_DEVICE_ID_ATI_215GQ 0x4751 +#define PCI_DEVICE_ID_ATI_215XL 0x4752 +#define PCI_DEVICE_ID_ATI_215GT 0x4754 +#define PCI_DEVICE_ID_ATI_215GTB 0x4755 +#define PCI_DEVICE_ID_ATI_215_IV 0x4756 +#define PCI_DEVICE_ID_ATI_215_IW 0x4757 +#define PCI_DEVICE_ID_ATI_215_IZ 0x475A +#define PCI_DEVICE_ID_ATI_210888GX 0x4758 +#define PCI_DEVICE_ID_ATI_215_LB 0x4c42 +#define PCI_DEVICE_ID_ATI_215_LD 0x4c44 +#define PCI_DEVICE_ID_ATI_215_LG 0x4c47 +#define PCI_DEVICE_ID_ATI_215_LI 0x4c49 +#define PCI_DEVICE_ID_ATI_215_LM 0x4c4D +#define PCI_DEVICE_ID_ATI_215_LN 0x4c4E +#define PCI_DEVICE_ID_ATI_215_LR 0x4c52 +#define PCI_DEVICE_ID_ATI_215_LS 0x4c53 +#define PCI_DEVICE_ID_ATI_264_LT 0x4c54 +/* Mach64 VT */ +#define PCI_DEVICE_ID_ATI_264VT 0x5654 +#define PCI_DEVICE_ID_ATI_264VU 0x5655 +#define PCI_DEVICE_ID_ATI_264VV 0x5656 +/* Rage128 Pro GL */ +#define PCI_DEVICE_ID_ATI_Rage128_PA 0x5041 +#define PCI_DEVICE_ID_ATI_Rage128_PB 0x5042 +#define PCI_DEVICE_ID_ATI_Rage128_PC 0x5043 +#define PCI_DEVICE_ID_ATI_Rage128_PD 0x5044 +#define PCI_DEVICE_ID_ATI_Rage128_PE 0x5045 +#define PCI_DEVICE_ID_ATI_RAGE128_PF 0x5046 +/* Rage128 Pro VR */ +#define PCI_DEVICE_ID_ATI_RAGE128_PG 0x5047 +#define PCI_DEVICE_ID_ATI_RAGE128_PH 0x5048 +#define PCI_DEVICE_ID_ATI_RAGE128_PI 0x5049 +#define PCI_DEVICE_ID_ATI_RAGE128_PJ 0x504A +#define PCI_DEVICE_ID_ATI_RAGE128_PK 0x504B +#define PCI_DEVICE_ID_ATI_RAGE128_PL 0x504C +#define PCI_DEVICE_ID_ATI_RAGE128_PM 0x504D +#define PCI_DEVICE_ID_ATI_RAGE128_PN 0x504E +#define PCI_DEVICE_ID_ATI_RAGE128_PO 0x504F +#define PCI_DEVICE_ID_ATI_RAGE128_PP 0x5050 +#define PCI_DEVICE_ID_ATI_RAGE128_PQ 0x5051 +#define PCI_DEVICE_ID_ATI_RAGE128_PR 0x5052 +#define PCI_DEVICE_ID_ATI_RAGE128_TR 0x5452 +#define PCI_DEVICE_ID_ATI_RAGE128_PS 0x5053 +#define PCI_DEVICE_ID_ATI_RAGE128_PT 0x5054 +#define PCI_DEVICE_ID_ATI_RAGE128_PU 0x5055 +#define PCI_DEVICE_ID_ATI_RAGE128_PV 0x5056 +#define PCI_DEVICE_ID_ATI_RAGE128_PW 0x5057 +#define PCI_DEVICE_ID_ATI_RAGE128_PX 0x5058 +/* Rage128 GL */ +#define PCI_DEVICE_ID_ATI_RAGE128_RE 0x5245 +#define PCI_DEVICE_ID_ATI_RAGE128_RF 0x5246 +#define PCI_DEVICE_ID_ATI_RAGE128_RG 0x534b +#define PCI_DEVICE_ID_ATI_RAGE128_RH 0x534c +#define PCI_DEVICE_ID_ATI_RAGE128_RI 0x534d +/* Rage128 VR */ +#define PCI_DEVICE_ID_ATI_RAGE128_RK 0x524b +#define PCI_DEVICE_ID_ATI_RAGE128_RL 0x524c +#define PCI_DEVICE_ID_ATI_RAGE128_RM 0x5345 +#define PCI_DEVICE_ID_ATI_RAGE128_RN 0x5346 +#define PCI_DEVICE_ID_ATI_RAGE128_RO 0x5347 +/* Rage128 M3 */ +#define PCI_DEVICE_ID_ATI_RAGE128_LE 0x4c45 +#define PCI_DEVICE_ID_ATI_RAGE128_LF 0x4c46 +/* Rage128 Pro Ultra */ +#define PCI_DEVICE_ID_ATI_RAGE128_U1 0x5446 +#define PCI_DEVICE_ID_ATI_RAGE128_U2 0x544C +#define PCI_DEVICE_ID_ATI_RAGE128_U3 0x5452 +/* Radeon M4 */ +#define PCI_DEVICE_ID_ATI_RADEON_LE 0x4d45 +#define PCI_DEVICE_ID_ATI_RADEON_LF 0x4d46 +/* Radeon NV-100 */ +#define PCI_DEVICE_ID_ATI_RADEON_N1 0x5159 +#define PCI_DEVICE_ID_ATI_RADEON_N2 0x515a +/* Radeon */ +#define PCI_DEVICE_ID_ATI_RADEON_RA 0x5144 +#define PCI_DEVICE_ID_ATI_RADEON_RB 0x5145 +#define PCI_DEVICE_ID_ATI_RADEON_RC 0x5146 +#define PCI_DEVICE_ID_ATI_RADEON_RD 0x5147 + +#define PCI_VENDOR_ID_VLSI 0x1004 +#define PCI_DEVICE_ID_VLSI_82C592 0x0005 +#define PCI_DEVICE_ID_VLSI_82C593 0x0006 +#define PCI_DEVICE_ID_VLSI_82C594 0x0007 +#define PCI_DEVICE_ID_VLSI_82C597 0x0009 +#define PCI_DEVICE_ID_VLSI_82C541 0x000c +#define PCI_DEVICE_ID_VLSI_82C543 0x000d +#define PCI_DEVICE_ID_VLSI_82C532 0x0101 +#define PCI_DEVICE_ID_VLSI_82C534 0x0102 +#define PCI_DEVICE_ID_VLSI_82C535 0x0104 +#define PCI_DEVICE_ID_VLSI_82C147 0x0105 +#define PCI_DEVICE_ID_VLSI_VAS96011 0x0702 + +#define PCI_VENDOR_ID_ADL 0x1005 +#define PCI_DEVICE_ID_ADL_2301 0x2301 + +#define PCI_VENDOR_ID_NS 0x100b +#define PCI_DEVICE_ID_NS_87415 0x0002 +#define PCI_DEVICE_ID_NS_87560_LIO 0x000e +#define PCI_DEVICE_ID_NS_87560_USB 0x0012 +#define PCI_DEVICE_ID_NS_83815 0x0020 +#define PCI_DEVICE_ID_DP83815 0x0020 +#define PCI_DEVICE_ID_NS_83820 0x0022 +#define PCI_DEVICE_ID_NS_87410 0xd001 + +#define PCI_VENDOR_ID_TSENG 0x100c +#define PCI_DEVICE_ID_TSENG_W32P_2 0x3202 +#define PCI_DEVICE_ID_TSENG_W32P_b 0x3205 +#define PCI_DEVICE_ID_TSENG_W32P_c 0x3206 +#define PCI_DEVICE_ID_TSENG_W32P_d 0x3207 +#define PCI_DEVICE_ID_TSENG_ET6000 0x3208 + +#define PCI_VENDOR_ID_WEITEK 0x100e +#define PCI_DEVICE_ID_WEITEK_P9000 0x9001 +#define PCI_DEVICE_ID_WEITEK_P9100 0x9100 + +#define PCI_VENDOR_ID_DEC 0x1011 +#define PCI_DEVICE_ID_DEC_BRD 0x0001 +#define PCI_DEVICE_ID_DEC_TULIP 0x0002 +#define PCI_DEVICE_ID_DEC_TGA 0x0004 +#define PCI_DEVICE_ID_DEC_TULIP_FAST 0x0009 +#define PCI_DEVICE_ID_DEC_TGA2 0x000D +#define PCI_DEVICE_ID_DEC_FDDI 0x000F +#define PCI_DEVICE_ID_DEC_TULIP_PLUS 0x0014 +#define PCI_DEVICE_ID_DEC_21142 0x0019 +#define PCI_DEVICE_ID_DEC_21052 0x0021 +#define PCI_DEVICE_ID_DEC_21150 0x0022 +#define PCI_DEVICE_ID_DEC_21152 0x0024 +#define PCI_DEVICE_ID_DEC_21153 0x0025 +#define PCI_DEVICE_ID_DEC_21154 0x0026 +#define PCI_DEVICE_ID_DEC_21285 0x1065 +#define PCI_DEVICE_ID_COMPAQ_42XX 0x0046 + +#define PCI_VENDOR_ID_CIRRUS 0x1013 +#define PCI_DEVICE_ID_CIRRUS_7548 0x0038 +#define PCI_DEVICE_ID_CIRRUS_5430 0x00a0 +#define PCI_DEVICE_ID_CIRRUS_5434_4 0x00a4 +#define PCI_DEVICE_ID_CIRRUS_5434_8 0x00a8 +#define PCI_DEVICE_ID_CIRRUS_5436 0x00ac +#define PCI_DEVICE_ID_CIRRUS_5446 0x00b8 +#define PCI_DEVICE_ID_CIRRUS_5480 0x00bc +#define PCI_DEVICE_ID_CIRRUS_5462 0x00d0 +#define PCI_DEVICE_ID_CIRRUS_5464 0x00d4 +#define PCI_DEVICE_ID_CIRRUS_5465 0x00d6 +#define PCI_DEVICE_ID_CIRRUS_6729 0x1100 +#define PCI_DEVICE_ID_CIRRUS_6832 0x1110 +#define PCI_DEVICE_ID_CIRRUS_7542 0x1200 +#define PCI_DEVICE_ID_CIRRUS_7543 0x1202 +#define PCI_DEVICE_ID_CIRRUS_7541 0x1204 + +#define PCI_VENDOR_ID_IBM 0x1014 +#define PCI_DEVICE_ID_IBM_FIRE_CORAL 0x000a +#define PCI_DEVICE_ID_IBM_TR 0x0018 +#define PCI_DEVICE_ID_IBM_82G2675 0x001d +#define PCI_DEVICE_ID_IBM_MCA 0x0020 +#define PCI_DEVICE_ID_IBM_82351 0x0022 +#define PCI_DEVICE_ID_IBM_PYTHON 0x002d +#define PCI_DEVICE_ID_IBM_SERVERAID 0x002e +#define PCI_DEVICE_ID_IBM_TR_WAKE 0x003e +#define PCI_DEVICE_ID_IBM_MPIC 0x0046 +#define PCI_DEVICE_ID_IBM_3780IDSP 0x007d +#define PCI_DEVICE_ID_IBM_CHUKAR 0x0096 +#define PCI_DEVICE_ID_IBM_405GP 0x0156 +#define PCI_DEVICE_ID_IBM_SERVERAIDI960 0x01bd +#define PCI_DEVICE_ID_IBM_MPIC_2 0xffff + +#define PCI_VENDOR_ID_COMPEX2 0x101a // pci.ids says "AT&T GIS (NCR)" +#define PCI_DEVICE_ID_COMPEX2_100VG 0x0005 + +#define PCI_VENDOR_ID_WD 0x101c +#define PCI_DEVICE_ID_WD_7197 0x3296 + +#define PCI_VENDOR_ID_AMI 0x101e +#define PCI_DEVICE_ID_AMI_MEGARAID3 0x1960 +#define PCI_DEVICE_ID_AMI_MEGARAID 0x9010 +#define PCI_DEVICE_ID_AMI_MEGARAID2 0x9060 + +#define PCI_VENDOR_ID_AMD 0x1022 + +#define PCI_DEVICE_ID_AMD_LANCE 0x2000 +#define PCI_DEVICE_ID_AMD_LANCE_HOME 0x2001 +#define PCI_DEVICE_ID_AMD_HOMEPNA 0x2001 +#define PCI_DEVICE_ID_AMD_SCSI 0x2020 +#define PCI_DEVICE_ID_AMD_FE_GATE_7006 0x7006 +#define PCI_DEVICE_ID_AMD_FE_GATE_7007 0x7007 +#define PCI_DEVICE_ID_AMD_FE_GATE_700C 0x700C +#define PCI_DEVIDE_ID_AMD_FE_GATE_700D 0x700D +#define PCI_DEVICE_ID_AMD_FE_GATE_700E 0x700E +#define PCI_DEVICE_ID_AMD_FE_GATE_700F 0x700F +#define PCI_DEVICE_ID_AMD_COBRA_7400 0x7400 +#define PCI_DEVICE_ID_AMD_COBRA_7401 0x7401 +#define PCI_DEVICE_ID_AMD_COBRA_7403 0x7403 +#define PCI_DEVICE_ID_AMD_COBRA_7404 0x7404 +#define PCI_DEVICE_ID_AMD_VIPER_7408 0x7408 +#define PCI_DEVICE_ID_AMD_VIPER_7409 0x7409 +#define PCI_DEVICE_ID_AMD_VIPER_740B 0x740B +#define PCI_DEVICE_ID_AMD_VIPER_740C 0x740C +#define PCI_DEVICE_ID_AMD_VIPER_7410 0x7410 +#define PCI_DEVICE_ID_AMD_VIPER_7411 0x7411 +#define PCI_DEVICE_ID_AMD_VIPER_7413 0x7413 +#define PCI_DEVICE_ID_AMD_VIPER_7414 0x7414 +#define PCI_DEVICE_ID_AMD_VIPER_7440 0x7440 +#define PCI_DEVICE_ID_AMD_VIPER_7441 0x7441 +#define PCI_DEVICE_ID_AMD_VIPER_7443 0x7443 +#define PCI_DEVICE_ID_AMD_VIPER_7448 0x7448 +#define PCI_DEVICE_ID_AMD_VIPER_7449 0x7449 + +#define PCI_VENDOR_ID_TRIDENT 0x1023 +#define PCI_DEVICE_ID_TRIDENT_4DWAVE_DX 0x2000 +#define PCI_DEVICE_ID_TRIDENT_4DWAVE_NX 0x2001 +#define PCI_DEVICE_ID_TRIDENT_9320 0x9320 +#define PCI_DEVICE_ID_TRIDENT_9388 0x9388 +#define PCI_DEVICE_ID_TRIDENT_9397 0x9397 +#define PCI_DEVICE_ID_TRIDENT_939A 0x939A +#define PCI_DEVICE_ID_TRIDENT_9520 0x9520 +#define PCI_DEVICE_ID_TRIDENT_9525 0x9525 +#define PCI_DEVICE_ID_TRIDENT_9420 0x9420 +#define PCI_DEVICE_ID_TRIDENT_9440 0x9440 +#define PCI_DEVICE_ID_TRIDENT_9660 0x9660 +#define PCI_DEVICE_ID_TRIDENT_9750 0x9750 +#define PCI_DEVICE_ID_TRIDENT_9850 0x9850 +#define PCI_DEVICE_ID_TRIDENT_9880 0x9880 +#define PCI_DEVICE_ID_TRIDENT_8400 0x8400 +#define PCI_DEVICE_ID_TRIDENT_8420 0x8420 +#define PCI_DEVICE_ID_TRIDENT_8500 0x8500 + +#define PCI_VENDOR_ID_AI 0x1025 +#define PCI_DEVICE_ID_AI_M1435 0x1435 + +#define PCI_VENDOR_ID_DELL 0x1028 + +#define PCI_VENDOR_ID_MATROX 0x102B +#define PCI_DEVICE_ID_MATROX_MGA_2 0x0518 +#define PCI_DEVICE_ID_MATROX_MIL 0x0519 +#define PCI_DEVICE_ID_MATROX_MYS 0x051A +#define PCI_DEVICE_ID_MATROX_MIL_2 0x051b +#define PCI_DEVICE_ID_MATROX_MIL_2_AGP 0x051f +#define PCI_DEVICE_ID_MATROX_MGA_IMP 0x0d10 +#define PCI_DEVICE_ID_MATROX_G100_MM 0x1000 +#define PCI_DEVICE_ID_MATROX_G100_AGP 0x1001 +#define PCI_DEVICE_ID_MATROX_G200_PCI 0x0520 +#define PCI_DEVICE_ID_MATROX_G200_AGP 0x0521 +#define PCI_DEVICE_ID_MATROX_G400 0x0525 +#define PCI_DEVICE_ID_MATROX_G550 0x2527 +#define PCI_DEVICE_ID_MATROX_VIA 0x4536 + +#define PCI_VENDOR_ID_CT 0x102c +#define PCI_DEVICE_ID_CT_65545 0x00d8 +#define PCI_DEVICE_ID_CT_65548 0x00dc +#define PCI_DEVICE_ID_CT_65550 0x00e0 +#define PCI_DEVICE_ID_CT_65554 0x00e4 +#define PCI_DEVICE_ID_CT_65555 0x00e5 + +#define PCI_VENDOR_ID_MIRO 0x1031 +#define PCI_DEVICE_ID_MIRO_36050 0x5601 + +#define PCI_VENDOR_ID_NEC 0x1033 +#define PCI_DEVICE_ID_NEC_PCX2 0x0046 +#define PCI_DEVICE_ID_NEC_NILE4 0x005a +#define PCI_DEVICE_ID_NEC_VRC5476 0x009b + +#define PCI_VENDOR_ID_FD 0x1036 +#define PCI_DEVICE_ID_FD_36C70 0x0000 + +#define PCI_VENDOR_ID_SIS 0x1039 +#define PCI_VENDOR_ID_SI 0x1039 +#define PCI_DEVICE_ID_SI_5591_AGP 0x0001 +#define PCI_DEVICE_ID_SI_6202 0x0002 +#define PCI_DEVICE_ID_SI_503 0x0008 +#define PCI_DEVICE_ID_SI_ACPI 0x0009 +#define PCI_DEVICE_ID_SI_5597_VGA 0x0200 +#define PCI_DEVICE_ID_SI_6205 0x0205 +#define PCI_DEVICE_ID_SI_501 0x0406 +#define PCI_DEVICE_ID_SI_496 0x0496 +#define PCI_DEVICE_ID_SI_300 0x0300 +#define PCI_DEVICE_ID_SI_315H 0x0310 +#define PCI_DEVICE_ID_SI_315 0x0315 +#define PCI_DEVICE_ID_SI_315PRO 0x0325 +#define PCI_DEVICE_ID_SI_530 0x0530 +#define PCI_DEVICE_ID_SI_540 0x0540 +#define PCI_DEVICE_ID_SI_550 0x0550 +#define PCI_DEVICE_ID_SI_601 0x0601 +#define PCI_DEVICE_ID_SI_620 0x0620 +#define PCI_DEVICE_ID_SI_630 0x0630 +#define PCI_DEVICE_ID_SI_635 0x0635 +#define PCI_DEVICE_ID_SI_640 0x0640 +#define PCI_DEVICE_ID_SI_645 0x0645 +#define PCI_DEVICE_ID_SI_650 0x0650 +#define PCI_DEVICE_ID_SI_730 0x0730 +#define PCI_DEVICE_ID_SI_735 0x0735 +#define PCI_DEVICE_ID_SI_740 0x0740 +#define PCI_DEVICE_ID_SI_745 0x0745 +#define PCI_DEVICE_ID_SI_750 0x0750 +#define PCI_DEVICE_ID_SI_900 0x0900 +#define PCI_DEVICE_ID_SIS900 0x0900 +#define PCI_DEVICE_ID_SI_5107 0x5107 +#define PCI_DEVICE_ID_SI_5300 0x5300 +#define PCI_DEVICE_ID_SI_540_VGA 0x5300 +#define PCI_DEVICE_ID_SI_550_VGA 0x5315 +#define PCI_DEVICE_ID_SI_5511 0x5511 +#define PCI_DEVICE_ID_SI_5513 0x5513 +#define PCI_DEVICE_ID_SI_5571 0x5571 +#define PCI_DEVICE_ID_SI_5591 0x5591 +#define PCI_DEVICE_ID_SI_5597 0x5597 +#define PCI_DEVICE_ID_SI_5598 0x5598 +#define PCI_DEVICE_ID_SI_5600 0x5600 +#define PCI_DEVICE_ID_SI_6300 0x6300 +#define PCI_DEVICE_ID_SI_630_VGA 0x6300 +#define PCI_DEVICE_ID_SI_6306 0x6306 +#define PCI_DEVICE_ID_SI_6326 0x6326 +#define PCI_DEVICE_ID_SI_7001 0x7001 +#define PCI_DEVICE_ID_SI_7016 0x7016 +#define PCI_DEVICE_ID_SIS7016 0x7016 +#define PCI_DEVICE_ID_SI_730_VGA 0x7300 + +#define PCI_VENDOR_ID_HP 0x103c +#define PCI_DEVICE_ID_HP_DONNER_GFX 0x1008 +#define PCI_DEVICE_ID_HP_TACHYON 0x1028 +#define PCI_DEVICE_ID_HP_TACHLITE 0x1029 +#define PCI_DEVICE_ID_HP_J2585A 0x1030 +#define PCI_DEVICE_ID_HP_J2585B 0x1031 +#define PCI_DEVICE_ID_HP_SAS 0x1048 +#define PCI_DEVICE_ID_HP_DIVA1 0x1049 +#define PCI_DEVICE_ID_HP_DIVA2 0x104A +#define PCI_DEVICE_ID_HP_SP2_0 0x104B + +#define PCI_VENDOR_ID_PCTECH 0x1042 +#define PCI_DEVICE_ID_PCTECH_RZ1000 0x1000 +#define PCI_DEVICE_ID_PCTECH_RZ1001 0x1001 +#define PCI_DEVICE_ID_PCTECH_SAMURAI_0 0x3000 +#define PCI_DEVICE_ID_PCTECH_SAMURAI_1 0x3010 +#define PCI_DEVICE_ID_PCTECH_SAMURAI_IDE 0x3020 + +#define PCI_VENDOR_ID_ASUSTEK 0x1043 +#define PCI_DEVICE_ID_ASUSTEK_0675 0x0675 + +#define PCI_VENDOR_ID_DPT 0x1044 +#define PCI_DEVICE_ID_DPT 0xa400 + +#define PCI_VENDOR_ID_OPTI 0x1045 +#define PCI_DEVICE_ID_OPTI_92C178 0xc178 +#define PCI_DEVICE_ID_OPTI_82C557 0xc557 +#define PCI_DEVICE_ID_OPTI_82C558 0xc558 +#define PCI_DEVICE_ID_OPTI_82C621 0xc621 +#define PCI_DEVICE_ID_OPTI_82C700 0xc700 +#define PCI_DEVICE_ID_OPTI_82C701 0xc701 +#define PCI_DEVICE_ID_OPTI_82C814 0xc814 +#define PCI_DEVICE_ID_OPTI_82C822 0xc822 +#define PCI_DEVICE_ID_OPTI_82C861 0xc861 +#define PCI_DEVICE_ID_OPTI_82C825 0xd568 + +#define PCI_VENDOR_ID_ELSA 0x1048 +#define PCI_DEVICE_ID_ELSA_MICROLINK 0x1000 +#define PCI_DEVICE_ID_ELSA_QS3000 0x3000 + +#define PCI_VENDOR_ID_ELSA 0x1048 +#define PCI_DEVICE_ID_ELSA_MICROLINK 0x1000 +#define PCI_DEVICE_ID_ELSA_QS3000 0x3000 + +#define PCI_VENDOR_ID_SGS 0x104a +#define PCI_DEVICE_ID_SGS_2000 0x0008 +#define PCI_DEVICE_ID_SGS_1764 0x0009 + +#define PCI_VENDOR_ID_BUSLOGIC 0x104B +#define PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER_NC 0x0140 +#define PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER 0x1040 +#define PCI_DEVICE_ID_BUSLOGIC_FLASHPOINT 0x8130 + +#define PCI_VENDOR_ID_TI 0x104c +#define PCI_DEVICE_ID_TI_TVP4010 0x3d04 +#define PCI_DEVICE_ID_TI_TVP4020 0x3d07 +#define PCI_DEVICE_ID_TI_1130 0xac12 +#define PCI_DEVICE_ID_TI_1031 0xac13 +#define PCI_DEVICE_ID_TI_1131 0xac15 +#define PCI_DEVICE_ID_TI_1250 0xac16 +#define PCI_DEVICE_ID_TI_1220 0xac17 +#define PCI_DEVICE_ID_TI_1221 0xac19 +#define PCI_DEVICE_ID_TI_1210 0xac1a +#define PCI_DEVICE_ID_TI_1410 0xac50 +#define PCI_DEVICE_ID_TI_1450 0xac1b +#define PCI_DEVICE_ID_TI_1225 0xac1c +#define PCI_DEVICE_ID_TI_1251A 0xac1d +#define PCI_DEVICE_ID_TI_1211 0xac1e +#define PCI_DEVICE_ID_TI_1251B 0xac1f +#define PCI_DEVICE_ID_TI_4410 0xac41 +#define PCI_DEVICE_ID_TI_4451 0xac42 +#define PCI_DEVICE_ID_TI_1420 0xac51 + +#define PCI_VENDOR_ID_SONY 0x104d +#define PCI_DEVICE_ID_SONY_CXD3222 0x8039 + +#define PCI_VENDOR_ID_OAK 0x104e +#define PCI_DEVICE_ID_OAK_OTI107 0x0107 + +/* Winbond have two vendor IDs! See 0x10ad as well */ +#define PCI_VENDOR_ID_WINBOND2 0x1050 +#define PCI_DEVICE_ID_WINBOND2_89C840 0x0840 +#define PCI_DEVICE_ID_WINBOND2_89C940 0x0940 +#define PCI_DEVICE_ID_WINBOND2_89C940F 0x5a5a +#define PCI_DEVICE_ID_WINBOND2_6692 0x6692 + +#define PCI_VENDOR_ID_ANIGMA 0x1051 +#define PCI_DEVICE_ID_ANIGMA_MC145575 0x0100 + +#define PCI_VENDOR_ID_EFAR 0x1055 +#define PCI_DEVICE_ID_EFAR_SLC90E66_1 0x9130 +#define PCI_DEVICE_ID_EFAR_SLC90E66_0 0x9460 +#define PCI_DEVICE_ID_EFAR_SLC90E66_2 0x9462 +#define PCI_DEVICE_ID_EFAR_SLC90E66_3 0x9463 + +#define PCI_VENDOR_ID_MOTOROLA 0x1057 +#define PCI_VENDOR_ID_MOTOROLA_OOPS 0x1507 +#define PCI_DEVICE_ID_MOTOROLA_MPC105 0x0001 +#define PCI_DEVICE_ID_MOTOROLA_MPC106 0x0002 +#define PCI_DEVICE_ID_MOTOROLA_RAVEN 0x4801 +#define PCI_DEVICE_ID_MOTOROLA_FALCON 0x4802 +#define PCI_DEVICE_ID_MOTOROLA_CPX8216 0x4806 + +#define PCI_VENDOR_ID_PROMISE 0x105a +#define PCI_DEVICE_ID_PROMISE_20265 0x0d30 +#define PCI_DEVICE_ID_PROMISE_20267 0x4d30 +#define PCI_DEVICE_ID_PROMISE_20246 0x4d33 +#define PCI_DEVICE_ID_PROMISE_20262 0x4d38 +#define PCI_DEVICE_ID_PROMISE_20268 0x4d68 +#define PCI_DEVICE_ID_PROMISE_20268R 0x6268 +#define PCI_DEVICE_ID_PROMISE_20269 0x4d69 +#define PCI_DEVICE_ID_PROMISE_20275 0x1275 +#define PCI_DEVICE_ID_PROMISE_5300 0x5300 + +#define PCI_VENDOR_ID_N9 0x105d +#define PCI_DEVICE_ID_N9_I128 0x2309 +#define PCI_DEVICE_ID_N9_I128_2 0x2339 +#define PCI_DEVICE_ID_N9_I128_T2R 0x493d + +#define PCI_VENDOR_ID_UMC 0x1060 +#define PCI_DEVICE_ID_UMC_UM8673F 0x0101 +#define PCI_DEVICE_ID_UMC_UM8891A 0x0891 +#define PCI_DEVICE_ID_UMC_UM8886BF 0x673a +#define PCI_DEVICE_ID_UMC_UM8886A 0x886a +#define PCI_DEVICE_ID_UMC_UM8881F 0x8881 +#define PCI_DEVICE_ID_UMC_UM8886F 0x8886 +#define PCI_DEVICE_ID_UMC_UM9017F 0x9017 +#define PCI_DEVICE_ID_UMC_UM8886N 0xe886 +#define PCI_DEVICE_ID_UMC_UM8891N 0xe891 + +#define PCI_VENDOR_ID_X 0x1061 +#define PCI_DEVICE_ID_X_AGX016 0x0001 + +#define PCI_VENDOR_ID_MYLEX 0x1069 +#define PCI_DEVICE_ID_MYLEX_DAC960_P 0x0001 +#define PCI_DEVICE_ID_MYLEX_DAC960_PD 0x0002 +#define PCI_DEVICE_ID_MYLEX_DAC960_PG 0x0010 +#define PCI_DEVICE_ID_MYLEX_DAC960_LA 0x0020 +#define PCI_DEVICE_ID_MYLEX_DAC960_LP 0x0050 +#define PCI_DEVICE_ID_MYLEX_DAC960_BA 0xBA56 + +#define PCI_VENDOR_ID_PICOP 0x1066 +#define PCI_DEVICE_ID_PICOP_PT86C52X 0x0001 +#define PCI_DEVICE_ID_PICOP_PT80C524 0x8002 + +#define PCI_VENDOR_ID_APPLE 0x106b +#define PCI_DEVICE_ID_APPLE_BANDIT 0x0001 +#define PCI_DEVICE_ID_APPLE_GC 0x0002 +#define PCI_DEVICE_ID_APPLE_HYDRA 0x000e +#define PCI_DEVICE_ID_APPLE_UNI_N_FW 0x0018 +#define PCI_DEVICE_ID_APPLE_KL_USB 0x0019 +#define PCI_DEVICE_ID_APPLE_UNI_N_AGP 0x0020 +#define PCI_DEVICE_ID_APPLE_UNI_N_GMAC 0x0021 +#define PCI_DEVICE_ID_APPLE_UNI_N_FW2 0x0030 + +#define PCI_VENDOR_ID_YAMAHA 0x1073 +#define PCI_DEVICE_ID_YAMAHA_724 0x0004 +#define PCI_DEVICE_ID_YAMAHA_724F 0x000d +#define PCI_DEVICE_ID_YAMAHA_740 0x000a +#define PCI_DEVICE_ID_YAMAHA_740C 0x000c +#define PCI_DEVICE_ID_YAMAHA_744 0x0010 +#define PCI_DEVICE_ID_YAMAHA_754 0x0012 + +#define PCI_VENDOR_ID_NEXGEN 0x1074 +#define PCI_DEVICE_ID_NEXGEN_82C501 0x4e78 + +#define PCI_VENDOR_ID_QLOGIC 0x1077 +#define PCI_DEVICE_ID_QLOGIC_ISP1020 0x1020 +#define PCI_DEVICE_ID_QLOGIC_ISP1022 0x1022 +#define PCI_DEVICE_ID_QLOGIC_ISP2100 0x2100 +#define PCI_DEVICE_ID_QLOGIC_ISP2200 0x2200 + +#define PCI_VENDOR_ID_CYRIX 0x1078 +#define PCI_DEVICE_ID_CYRIX_5510 0x0000 +#define PCI_DEVICE_ID_CYRIX_PCI_MASTER 0x0001 +#define PCI_DEVICE_ID_CYRIX_5520 0x0002 +#define PCI_DEVICE_ID_CYRIX_5530_LEGACY 0x0100 +#define PCI_DEVICE_ID_CYRIX_5530_SMI 0x0101 +#define PCI_DEVICE_ID_CYRIX_5530_IDE 0x0102 +#define PCI_DEVICE_ID_CYRIX_5530_AUDIO 0x0103 +#define PCI_DEVICE_ID_CYRIX_5530_VIDEO 0x0104 + +#define PCI_VENDOR_ID_LEADTEK 0x107d +#define PCI_DEVICE_ID_LEADTEK_805 0x0000 + +#define PCI_VENDOR_ID_INTERPHASE 0x107e +#define PCI_DEVICE_ID_INTERPHASE_5526 0x0004 +#define PCI_DEVICE_ID_INTERPHASE_55x6 0x0005 +#define PCI_DEVICE_ID_INTERPHASE_5575 0x0008 + +#define PCI_VENDOR_ID_CONTAQ 0x1080 +#define PCI_DEVICE_ID_CONTAQ_82C599 0x0600 +#define PCI_DEVICE_ID_CONTAQ_82C693 0xc693 + +#define PCI_VENDOR_ID_FOREX 0x1083 + +#define PCI_VENDOR_ID_OLICOM 0x108d +#define PCI_DEVICE_ID_OLICOM_OC3136 0x0001 +#define PCI_DEVICE_ID_OLICOM_OC2315 0x0011 +#define PCI_DEVICE_ID_OLICOM_OC2325 0x0012 +#define PCI_DEVICE_ID_OLICOM_OC2183 0x0013 +#define PCI_DEVICE_ID_OLICOM_OC2326 0x0014 +#define PCI_DEVICE_ID_OLICOM_OC6151 0x0021 + +#define PCI_VENDOR_ID_SUN 0x108e +#define PCI_DEVICE_ID_SUN_EBUS 0x1000 +#define PCI_DEVICE_ID_SUN_HAPPYMEAL 0x1001 +#define PCI_DEVICE_ID_SUN_RIO_EBUS 0x1100 +#define PCI_DEVICE_ID_SUN_RIO_GEM 0x1101 +#define PCI_DEVICE_ID_SUN_RIO_1394 0x1102 +#define PCI_DEVICE_ID_SUN_RIO_USB 0x1103 +#define PCI_DEVICE_ID_SUN_GEM 0x2bad +#define PCI_DEVICE_ID_SUN_SIMBA 0x5000 +#define PCI_DEVICE_ID_SUN_PBM 0x8000 +#define PCI_DEVICE_ID_SUN_SCHIZO 0x8001 +#define PCI_DEVICE_ID_SUN_SABRE 0xa000 +#define PCI_DEVICE_ID_SUN_HUMMINGBIRD 0xa001 + +#define PCI_VENDOR_ID_CMD 0x1095 +#define PCI_DEVICE_ID_CMD_640 0x0640 +#define PCI_DEVICE_ID_CMD_643 0x0643 +#define PCI_DEVICE_ID_CMD_646 0x0646 +#define PCI_DEVICE_ID_CMD_647 0x0647 +#define PCI_DEVICE_ID_CMD_648 0x0648 +#define PCI_DEVICE_ID_CMD_649 0x0649 +#define PCI_DEVICE_ID_CMD_670 0x0670 +#define PCI_DEVICE_ID_CMD_680 0x0680 + +#define PCI_VENDOR_ID_VISION 0x1098 +#define PCI_DEVICE_ID_VISION_QD8500 0x0001 +#define PCI_DEVICE_ID_VISION_QD8580 0x0002 + +#define PCI_VENDOR_ID_BROOKTREE 0x109e +#define PCI_DEVICE_ID_BROOKTREE_848 0x0350 +#define PCI_DEVICE_ID_BROOKTREE_849A 0x0351 +#define PCI_DEVICE_ID_BROOKTREE_878_1 0x036e +#define PCI_DEVICE_ID_BROOKTREE_878 0x0878 +#define PCI_DEVICE_ID_BROOKTREE_8474 0x8474 + +#define PCI_VENDOR_ID_SIERRA 0x10a8 +#define PCI_DEVICE_ID_SIERRA_STB 0x0000 + +#define PCI_VENDOR_ID_SGI 0x10a9 +#define PCI_DEVICE_ID_SGI_IOC3 0x0003 + +#define PCI_VENDOR_ID_ACC 0x10aa +#define PCI_DEVICE_ID_ACC_2056 0x0000 + +#define PCI_VENDOR_ID_WINBOND 0x10ad +#define PCI_DEVICE_ID_WINBOND_83769 0x0001 +#define PCI_DEVICE_ID_WINBOND_82C105 0x0105 +#define PCI_DEVICE_ID_WINBOND_83C553 0x0565 + +#define PCI_VENDOR_ID_DATABOOK 0x10b3 +#define PCI_DEVICE_ID_DATABOOK_87144 0xb106 + +#define PCI_VENDOR_ID_PLX 0x10b5 +#define PCI_DEVICE_ID_PLX_R685 0x1030 +#define PCI_DEVICE_ID_PLX_ROMULUS 0x106a +#define PCI_DEVICE_ID_PLX_SPCOM800 0x1076 +#define PCI_DEVICE_ID_PLX_1077 0x1077 +#define PCI_DEVICE_ID_PLX_SPCOM200 0x1103 +#define PCI_DEVICE_ID_PLX_DJINN_ITOO 0x1151 +#define PCI_DEVICE_ID_PLX_R753 0x1152 +#define PCI_DEVICE_ID_PLX_9050 0x9050 +#define PCI_DEVICE_ID_PLX_9060 0x9060 +#define PCI_DEVICE_ID_PLX_9060ES 0x906E +#define PCI_DEVICE_ID_PLX_9060SD 0x906D +#define PCI_DEVICE_ID_PLX_9080 0x9080 +#define PCI_DEVICE_ID_PLX_GTEK_SERIAL2 0xa001 + +#define PCI_VENDOR_ID_MADGE 0x10b6 +#define PCI_DEVICE_ID_MADGE_MK2 0x0002 +#define PCI_DEVICE_ID_MADGE_C155S 0x1001 + +#define PCI_VENDOR_ID_3COM 0x10b7 +#define PCI_DEVICE_ID_3COM_3C985 0x0001 +#define PCI_DEVICE_ID_3COM_3C339 0x3390 +#define PCI_DEVICE_ID_3COM_3C590 0x5900 +#define PCI_DEVICE_ID_3COM_3C595 0x5950 +#define PCI_DEVICE_ID_3COM_3C595TX 0x5950 +#define PCI_DEVICE_ID_3COM_3C595_1 0x5951 +#define PCI_DEVICE_ID_3COM_3C595T4 0x5951 +#define PCI_DEVICE_ID_3COM_3C595_2 0x5952 +#define PCI_DEVICE_ID_3COM_3C595MII 0x5952 +#define PCI_DEVICE_ID_3COM_3C900TPO 0x9000 +#define PCI_DEVICE_ID_3COM_3C900COMBO 0x9001 +#define PCI_DEVICE_ID_3COM_3C905TX 0x9050 +#define PCI_DEVICE_ID_3COM_3C905T4 0x9051 +#define PCI_DEVICE_ID_3COM_3C905B_TX 0x9055 +#define PCI_DEVICE_ID_3COM_3C905C_TXM 0x9200 + +#define PCI_VENDOR_ID_SMC 0x10b8 +#define PCI_DEVICE_ID_SMC_EPIC100 0x0005 + +#define PCI_VENDOR_ID_SUNDANCE 0x13F0 +#define PCI_DEVICE_ID_SUNDANCE_ALTA 0x0201 + +#define PCI_VENDOR_ID_AL 0x10b9 +#define PCI_DEVICE_ID_AL_M1445 0x1445 +#define PCI_DEVICE_ID_AL_M1449 0x1449 +#define PCI_DEVICE_ID_AL_M1451 0x1451 +#define PCI_DEVICE_ID_AL_M1461 0x1461 +#define PCI_DEVICE_ID_AL_M1489 0x1489 +#define PCI_DEVICE_ID_AL_M1511 0x1511 +#define PCI_DEVICE_ID_AL_M1513 0x1513 +#define PCI_DEVICE_ID_AL_M1521 0x1521 +#define PCI_DEVICE_ID_AL_M1523 0x1523 +#define PCI_DEVICE_ID_AL_M1531 0x1531 +#define PCI_DEVICE_ID_AL_M1533 0x1533 +#define PCI_DEVICE_ID_AL_M1541 0x1541 +#define PCI_DEVICE_ID_AL_M1621 0x1621 +#define PCI_DEVICE_ID_AL_M1631 0x1631 +#define PCI_DEVICE_ID_AL_M1641 0x1641 +#define PCI_DEVICE_ID_AL_M1647 0x1647 +#define PCI_DEVICE_ID_AL_M1651 0x1651 +#define PCI_DEVICE_ID_AL_M1543 0x1543 +#define PCI_DEVICE_ID_AL_M3307 0x3307 +#define PCI_DEVICE_ID_AL_M4803 0x5215 +#define PCI_DEVICE_ID_AL_M5219 0x5219 +#define PCI_DEVICE_ID_AL_M5229 0x5229 +#define PCI_DEVICE_ID_AL_M5237 0x5237 +#define PCI_DEVICE_ID_AL_M5243 0x5243 +#define PCI_DEVICE_ID_AL_M5451 0x5451 +#define PCI_DEVICE_ID_AL_M7101 0x7101 + +#define PCI_VENDOR_ID_MITSUBISHI 0x10ba + +#define PCI_VENDOR_ID_SURECOM 0x10bd +#define PCI_DEVICE_ID_SURECOM_NE34 0x0e34 + +#define PCI_VENDOR_ID_NEOMAGIC 0x10c8 +#define PCI_DEVICE_ID_NEOMAGIC_MAGICGRAPH_NM2070 0x0001 +#define PCI_DEVICE_ID_NEOMAGIC_MAGICGRAPH_128V 0x0002 +#define PCI_DEVICE_ID_NEOMAGIC_MAGICGRAPH_128ZV 0x0003 +#define PCI_DEVICE_ID_NEOMAGIC_MAGICGRAPH_NM2160 0x0004 +#define PCI_DEVICE_ID_NEOMAGIC_MAGICMEDIA_256AV 0x0005 +#define PCI_DEVICE_ID_NEOMAGIC_MAGICGRAPH_128ZVPLUS 0x0083 + +#define PCI_VENDOR_ID_ASP 0x10cd +#define PCI_DEVICE_ID_ASP_ABP940 0x1200 +#define PCI_DEVICE_ID_ASP_ABP940U 0x1300 +#define PCI_DEVICE_ID_ASP_ABP940UW 0x2300 + +#define PCI_VENDOR_ID_MACRONIX 0x10d9 +#define PCI_DEVICE_ID_MACRONIX_MX98713 0x0512 +#define PCI_DEVICE_ID_MX987x3 0x0512 +#define PCI_DEVICE_ID_MACRONIX_MX987x5 0x0531 +#define PCI_DEVICE_ID_MX987x5 0x0531 + +#define PCI_VENDOR_ID_TCONRAD 0x10da +#define PCI_DEVICE_ID_TCONRAD_TOKENRING 0x0508 + +#define PCI_VENDOR_ID_CERN 0x10dc +#define PCI_DEVICE_ID_CERN_SPSB_PMC 0x0001 +#define PCI_DEVICE_ID_CERN_SPSB_PCI 0x0002 +#define PCI_DEVICE_ID_CERN_HIPPI_DST 0x0021 +#define PCI_DEVICE_ID_CERN_HIPPI_SRC 0x0022 + +#define PCI_VENDOR_ID_NVIDIA 0x10de +#define PCI_DEVICE_ID_NVIDIA_TNT 0x0020 +#define PCI_DEVICE_ID_NVIDIA_TNT2 0x0028 +#define PCI_DEVICE_ID_NVIDIA_UTNT2 0x0029 +#define PCI_DEVICE_ID_NVIDIA_VTNT2 0x002C +#define PCI_DEVICE_ID_NVIDIA_UVTNT2 0x002D +#define PCI_DEVICE_ID_NVIDIA_ITNT2 0x00A0 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_SDR 0x0100 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_DDR 0x0101 +#define PCI_DEVICE_ID_NVIDIA_QUADRO 0x0103 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE2_MX 0x0110 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE2_MX2 0x0111 +#define PCI_DEVICE_ID_NVIDIA_QUADRO2_MXR 0x0113 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE2_GTS 0x0150 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE2_GTS2 0x0151 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE2_ULTRA 0x0152 +#define PCI_DEVICE_ID_NVIDIA_QUADRO2_PRO 0x0153 + +#define PCI_VENDOR_ID_IMS 0x10e0 +#define PCI_DEVICE_ID_IMS_8849 0x8849 +#define PCI_DEVICE_ID_IMS_TT128 0x9128 +#define PCI_DEVICE_ID_IMS_TT3D 0x9135 + +#define PCI_VENDOR_ID_TEKRAM2 0x10e1 +#define PCI_DEVICE_ID_TEKRAM2_690c 0x690c + +#define PCI_VENDOR_ID_TUNDRA 0x10e3 +#define PCI_DEVICE_ID_TUNDRA_CA91C042 0x0000 + +#define PCI_VENDOR_ID_AMCC 0x10e8 +#define PCI_DEVICE_ID_AMCC_MYRINET 0x8043 +#define PCI_DEVICE_ID_AMCC_PARASTATION 0x8062 +#define PCI_DEVICE_ID_AMCC_S5933 0x807d +#define PCI_DEVICE_ID_AMCC_S5933_HEPC3 0x809c + +#define PCI_VENDOR_ID_INTERG 0x10ea +#define PCI_DEVICE_ID_INTERG_1680 0x1680 +#define PCI_DEVICE_ID_INTERG_1682 0x1682 +#define PCI_DEVICE_ID_INTERG_2000 0x2000 +#define PCI_DEVICE_ID_INTERG_2010 0x2010 +#define PCI_DEVICE_ID_INTERG_5000 0x5000 +#define PCI_DEVICE_ID_INTERG_5050 0x5050 + +#define PCI_VENDOR_ID_REALTEK 0x10ec +#define PCI_DEVICE_ID_REALTEK_8029 0x8029 +#define PCI_DEVICE_ID_REALTEK_8129 0x8129 +#define PCI_DEVICE_ID_REALTEK_8139 0x8139 + +#define PCI_VENDOR_ID_XILINX 0x10ee +#define PCI_DEVICE_ID_TURBOPAM 0x4020 + +#define PCI_VENDOR_ID_TRUEVISION 0x10fa +#define PCI_DEVICE_ID_TRUEVISION_T1000 0x000c + +#define PCI_VENDOR_ID_INIT 0x1101 +#define PCI_DEVICE_ID_INIT_320P 0x9100 +#define PCI_DEVICE_ID_INIT_360P 0x9500 + +#define PCI_VENDOR_ID_CREATIVE 0x1102 // duplicate: ECTIVA +#define PCI_DEVICE_ID_CREATIVE_EMU10K1 0x0002 + +#define PCI_VENDOR_ID_ECTIVA 0x1102 // duplicate: CREATIVE +#define PCI_DEVICE_ID_ECTIVA_EV1938 0x8938 + +#define PCI_VENDOR_ID_TTI 0x1103 +#define PCI_DEVICE_ID_TTI_HPT343 0x0003 +#define PCI_DEVICE_ID_TTI_HPT366 0x0004 + +#define PCI_VENDOR_ID_VIA 0x1106 +#define PCI_VENDOR_ID_VIATEC 0x1106 +#define PCI_DEVICE_ID_VIA_8363_0 0x0305 +#define PCI_DEVICE_ID_VIA_8371_0 0x0391 +#define PCI_DEVICE_ID_VIA_8501_0 0x0501 +#define PCI_DEVICE_ID_VIA_82C505 0x0505 +#define PCI_DEVICE_ID_VIA_82C561 0x0561 +#define PCI_DEVICE_ID_VIA_82C586_1 0x0571 +#define PCI_DEVICE_ID_VIA_82C576 0x0576 +#define PCI_DEVICE_ID_VIA_82C585 0x0585 +#define PCI_DEVICE_ID_VIA_82C586_0 0x0586 +#define PCI_DEVICE_ID_VIA_82C595 0x0595 +#define PCI_DEVICE_ID_VIA_82C596 0x0596 +#define PCI_DEVICE_ID_VIA_82C597_0 0x0597 +#define PCI_DEVICE_ID_VIA_82C598_0 0x0598 +#define PCI_DEVICE_ID_VIA_8601_0 0x0601 +#define PCI_DEVICE_ID_VIA_8605_0 0x0605 +#define PCI_DEVICE_ID_VIA_82C680 0x0680 +#define PCI_DEVICE_ID_VIA_82C686 0x0686 +#define PCI_DEVICE_ID_VIA_82C691 0x0691 +#define PCI_DEVICE_ID_VIA_82C693 0x0693 +#define PCI_DEVICE_ID_VIA_82C693_1 0x0698 +#define PCI_DEVICE_ID_VIA_82C926 0x0926 +#define PCI_DEVICE_ID_VIA_82C576_1 0x1571 +#define PCI_DEVICE_ID_VIA_82C595_97 0x1595 +#define PCI_DEVICE_ID_VIA_82C586_2 0x3038 +#define PCI_DEVICE_ID_VIA_82C586_3 0x3040 +#define PCI_DEVICE_ID_VIA_RHINE_I 0x3043 +#define PCI_DEVICE_ID_VIA_6305 0x3044 +#define PCI_DEVICE_ID_VIA_82C596_3 0x3050 +#define PCI_DEVICE_ID_VIA_82C596B_3 0x3051 +#define PCI_DEVICE_ID_VIA_82C686_4 0x3057 +#define PCI_DEVICE_ID_VIA_82C686_5 0x3058 +#define PCI_DEVICE_ID_VIA_8233_5 0x3059 +#define PCI_DEVICE_ID_VIA_8233_7 0x3065 +#define PCI_DEVICE_ID_VIA_VT6102 0x3065 +#define PCI_DEVICE_ID_VIA_82C686_6 0x3068 +#define PCI_DEVICE_ID_VIA_8233_0 0x3074 +#define PCI_DEVICE_ID_VIA_VT6105 0x3106 +#define PCI_DEVICE_ID_VIA_8233C_0 0x3109 +#define PCI_DEVICE_ID_VIA_8633_0 0x3091 +#define PCI_DEVICE_ID_VIA_8367_0 0x3099 +#define PCI_DEVICE_ID_VIA_86C100A 0x6100 +#define PCI_DEVICE_ID_VIA_8231 0x8231 +#define PCI_DEVICE_ID_VIA_8231_4 0x8235 +#define PCI_DEVICE_ID_VIA_8365_1 0x8305 +#define PCI_DEVICE_ID_VIA_8371_1 0x8391 +#define PCI_DEVICE_ID_VIA_8501_1 0x8501 +#define PCI_DEVICE_ID_VIA_82C597_1 0x8597 +#define PCI_DEVICE_ID_VIA_82C598_1 0x8598 +#define PCI_DEVICE_ID_VIA_8601_1 0x8601 +#define PCI_DEVICE_ID_VIA_8505_1 0X8605 +#define PCI_DEVICE_ID_VIA_8633_1 0xB091 +#define PCI_DEVICE_ID_VIA_8367_1 0xB099 + +#define PCI_VENDOR_ID_SIEMENS 0x110A +#define PCI_DEVICE_ID_SIEMENS_DSCC4 0x2102 + +#define PCI_VENDOR_ID_SMC2 0x1113 +#define PCI_DEVICE_ID_SMC2_1211TX 0x1211 +#define PCI_DEVICE_ID_SMC2_1211 0x1211 +#define PCI_DEVICE_ID_SMC2_1216 0x1216 + +#define PCI_VENDOR_ID_VORTEX 0x1119 +#define PCI_DEVICE_ID_VORTEX_GDT60x0 0x0000 +#define PCI_DEVICE_ID_VORTEX_GDT6000B 0x0001 +#define PCI_DEVICE_ID_VORTEX_GDT6x10 0x0002 +#define PCI_DEVICE_ID_VORTEX_GDT6x20 0x0003 +#define PCI_DEVICE_ID_VORTEX_GDT6530 0x0004 +#define PCI_DEVICE_ID_VORTEX_GDT6550 0x0005 +#define PCI_DEVICE_ID_VORTEX_GDT6x17 0x0006 +#define PCI_DEVICE_ID_VORTEX_GDT6x27 0x0007 +#define PCI_DEVICE_ID_VORTEX_GDT6537 0x0008 +#define PCI_DEVICE_ID_VORTEX_GDT6557 0x0009 +#define PCI_DEVICE_ID_VORTEX_GDT6x15 0x000a +#define PCI_DEVICE_ID_VORTEX_GDT6x25 0x000b +#define PCI_DEVICE_ID_VORTEX_GDT6535 0x000c +#define PCI_DEVICE_ID_VORTEX_GDT6555 0x000d +#define PCI_DEVICE_ID_VORTEX_GDT6x17RP 0x0100 +#define PCI_DEVICE_ID_VORTEX_GDT6x27RP 0x0101 +#define PCI_DEVICE_ID_VORTEX_GDT6537RP 0x0102 +#define PCI_DEVICE_ID_VORTEX_GDT6557RP 0x0103 +#define PCI_DEVICE_ID_VORTEX_GDT6x11RP 0x0104 +#define PCI_DEVICE_ID_VORTEX_GDT6x21RP 0x0105 +#define PCI_DEVICE_ID_VORTEX_GDT6x17RP1 0x0110 +#define PCI_DEVICE_ID_VORTEX_GDT6x27RP1 0x0111 +#define PCI_DEVICE_ID_VORTEX_GDT6537RP1 0x0112 +#define PCI_DEVICE_ID_VORTEX_GDT6557RP1 0x0113 +#define PCI_DEVICE_ID_VORTEX_GDT6x11RP1 0x0114 +#define PCI_DEVICE_ID_VORTEX_GDT6x21RP1 0x0115 +#define PCI_DEVICE_ID_VORTEX_GDT6x17RP2 0x0120 +#define PCI_DEVICE_ID_VORTEX_GDT6x27RP2 0x0121 +#define PCI_DEVICE_ID_VORTEX_GDT6537RP2 0x0122 +#define PCI_DEVICE_ID_VORTEX_GDT6557RP2 0x0123 +#define PCI_DEVICE_ID_VORTEX_GDT6x11RP2 0x0124 +#define PCI_DEVICE_ID_VORTEX_GDT6x21RP2 0x0125 + +#define PCI_VENDOR_ID_EF 0x111a +#define PCI_DEVICE_ID_EF_ATM_FPGA 0x0000 +#define PCI_DEVICE_ID_EF_ATM_ASIC 0x0002 + +#define PCI_VENDOR_ID_IDT 0x111d +#define PCI_DEVICE_ID_IDT_IDT77201 0x0001 + +#define PCI_VENDOR_ID_FORE 0x1127 +#define PCI_DEVICE_ID_FORE_PCA200PC 0x0210 +#define PCI_DEVICE_ID_FORE_PCA200E 0x0300 + +#define PCI_VENDOR_ID_IMAGINGTECH 0x112f +#define PCI_DEVICE_ID_IMAGINGTECH_ICPCI 0x0000 + +#define PCI_VENDOR_ID_PHILIPS 0x1131 +#define PCI_DEVICE_ID_PHILIPS_SAA7145 0x7145 +#define PCI_DEVICE_ID_PHILIPS_SAA7146 0x7146 +#define PCI_DEVICE_ID_PHILIPS_SAA9730 0x9730 + +#define PCI_VENDOR_ID_EICON 0x1133 +#define PCI_DEVICE_ID_EICON_DIVA20PRO 0xe001 +#define PCI_DEVICE_ID_EICON_DIVA20 0xe002 +#define PCI_DEVICE_ID_EICON_DIVA20PRO_U 0xe003 +#define PCI_DEVICE_ID_EICON_DIVA20_U 0xe004 +#define PCI_DEVICE_ID_EICON_DIVA201 0xe005 +#define PCI_DEVICE_ID_EICON_MAESTRA 0xe010 +#define PCI_DEVICE_ID_EICON_MAESTRAQ 0xe012 +#define PCI_DEVICE_ID_EICON_MAESTRAQ_U 0xe013 +#define PCI_DEVICE_ID_EICON_MAESTRAP 0xe014 + +#define PCI_VENDOR_ID_CYCLONE 0x113c +#define PCI_DEVICE_ID_CYCLONE_SDK 0x0001 + +#define PCI_VENDOR_ID_ALLIANCE 0x1142 +#define PCI_DEVICE_ID_ALLIANCE_PROMOTIO 0x3210 +#define PCI_DEVICE_ID_ALLIANCE_PROVIDEO 0x6422 +#define PCI_DEVICE_ID_ALLIANCE_AT24 0x6424 +#define PCI_DEVICE_ID_ALLIANCE_AT3D 0x643d + +#define PCI_VENDOR_ID_SYSKONNECT 0x1148 +#define PCI_DEVICE_ID_SYSKONNECT_FP 0x4000 +#define PCI_DEVICE_ID_SYSKONNECT_TR 0x4200 +#define PCI_DEVICE_ID_SYSKONNECT_GE 0x4300 + +#define PCI_VENDOR_ID_VMIC 0x114a +#define PCI_DEVICE_ID_VMIC_VME 0x7587 + +#define PCI_VENDOR_ID_DIGI 0x114f +#define PCI_DEVICE_ID_DIGI_EPC 0x0002 +#define PCI_DEVICE_ID_DIGI_RIGHTSWITCH 0x0003 +#define PCI_DEVICE_ID_DIGI_XEM 0x0004 +#define PCI_DEVICE_ID_DIGI_XR 0x0005 +#define PCI_DEVICE_ID_DIGI_CX 0x0006 +#define PCI_DEVICE_ID_DIGI_XRJ 0x0009 +#define PCI_DEVICE_ID_DIGI_EPCJ 0x000a +#define PCI_DEVICE_ID_DIGI_XR_920 0x0027 +#define PCI_DEVICE_ID_DIGI_DF_M_IOM2_E 0x0070 +#define PCI_DEVICE_ID_DIGI_DF_M_E 0x0071 +#define PCI_DEVICE_ID_DIGI_DF_M_IOM2_A 0x0072 +#define PCI_DEVICE_ID_DIGI_DF_M_A 0x0073 + +#define PCI_VENDOR_ID_MUTECH 0x1159 +#define PCI_DEVICE_ID_MUTECH_MV1000 0x0001 + +#define PCI_VENDOR_ID_XIRCOM 0x115d +#define PCI_DEVICE_ID_XIRCOM_X3201_ETH 0x0003 +#define PCI_DEVICE_ID_XIRCOM_X3201_MDM 0x0103 + +#define PCI_VENDOR_ID_RENDITION 0x1163 +#define PCI_DEVICE_ID_RENDITION_VERITE 0x0001 +#define PCI_DEVICE_ID_RENDITION_VERITE2100 0x2000 + +#define PCI_VENDOR_ID_SERVERWORKS 0x1166 +#define PCI_DEVICE_ID_SERVERWORKS_HE 0x0008 +#define PCI_DEVICE_ID_SERVERWORKS_LE 0x0009 +#define PCI_DEVICE_ID_SERVERWORKS_CIOB30 0x0010 +#define PCI_DEVICE_ID_SERVERWORKS_CMIC_HE 0x0011 +#define PCI_DEVICE_ID_SERVERWORKS_OSB4 0x0200 +#define PCI_DEVICE_ID_SERVERWORKS_CSB5 0x0201 +#define PCI_DEVICE_ID_SERVERWORKS_OSB4IDE 0x0211 +#define PCI_DEVICE_ID_SERVERWORKS_CSB5IDE 0x0212 +#define PCI_DEVICE_ID_SERVERWORKS_OSB4USB 0x0220 +#define PCI_DEVICE_ID_SERVERWORKS_CSB5USB PCI_DEVICE_ID_SERVERWORKS_OSB4USB +#define PCI_DEVICE_ID_SERVERWORKS_CSB5ISA 0x0230 + +#define PCI_VENDOR_ID_SBE 0x1176 +#define PCI_DEVICE_ID_SBE_WANXL100 0x0301 +#define PCI_DEVICE_ID_SBE_WANXL200 0x0302 +#define PCI_DEVICE_ID_SBE_WANXL400 0x0104 + +#define PCI_VENDOR_ID_TOSHIBA 0x1179 +#define PCI_DEVICE_ID_TOSHIBA_601 0x0601 +#define PCI_DEVICE_ID_TOSHIBA_TOPIC95 0x060a +#define PCI_DEVICE_ID_TOSHIBA_TOPIC97 0x060f + +#define PCI_VENDOR_ID_RICOH 0x1180 +#define PCI_DEVICE_ID_RICOH_RL5C465 0x0465 +#define PCI_DEVICE_ID_RICOH_RL5C466 0x0466 +#define PCI_DEVICE_ID_RICOH_RL5C475 0x0475 +#define PCI_DEVICE_ID_RICOH_RL5C476 0x0476 +#define PCI_DEVICE_ID_RICOH_RL5C478 0x0478 + +#define PCI_VENDOR_ID_DLINK 0x1186 +#define PCI_DEVICE_ID_DFE530TXP 0x1300 +#define PCI_DEVICE_ID_DFE530TXS 0x1002 + +#define PCI_VENDOR_ID_ARTOP 0x1191 +#define PCI_DEVICE_ID_ARTOP_ATP8400 0x0004 +#define PCI_DEVICE_ID_ARTOP_ATP850UF 0x0005 +#define PCI_DEVICE_ID_ARTOP_ATP860 0x0006 +#define PCI_DEVICE_ID_ARTOP_ATP860R 0x0007 +#define PCI_DEVICE_ID_ARTOP_AEC7610 0x8002 +#define PCI_DEVICE_ID_ARTOP_AEC7612UW 0x8010 +#define PCI_DEVICE_ID_ARTOP_AEC7612U 0x8020 +#define PCI_DEVICE_ID_ARTOP_AEC7612S 0x8030 +#define PCI_DEVICE_ID_ARTOP_AEC7612D 0x8040 +#define PCI_DEVICE_ID_ARTOP_AEC7612SUW 0x8050 +#define PCI_DEVICE_ID_ARTOP_8060 0x8060 + +#define PCI_VENDOR_ID_ZEITNET 0x1193 +#define PCI_DEVICE_ID_ZEITNET_1221 0x0001 +#define PCI_DEVICE_ID_ZEITNET_1225 0x0002 + +#define PCI_VENDOR_ID_OMEGA 0x119b +#define PCI_DEVICE_ID_OMEGA_82C092G 0x1221 + +#define PCI_VENDOR_ID_FUJITSU_ME 0x119e +#define PCI_DEVICE_ID_FUJITSU_FS155 0x0001 +#define PCI_DEVICE_ID_FUJITSU_FS50 0x0003 + +#define PCI_SUBVENDOR_ID_KEYSPAN 0x11a9 +#define PCI_SUBDEVICE_ID_KEYSPAN_SX2 0x5334 + +#define PCI_VENDOR_ID_GALILEO 0x11ab +#define PCI_DEVICE_ID_GALILEO_GT64011 0x4146 +#define PCI_DEVICE_ID_GALILEO_GT64111 0x4146 +#define PCI_DEVICE_ID_GALILEO_GT96100 0x9652 +#define PCI_DEVICE_ID_GALILEO_GT96100A 0x9653 + +#define PCI_VENDOR_ID_LINKSYS 0x11ad +#define PCI_VENDOR_ID_LITEON 0x11ad +#define PCI_DEVICE_ID_LITEON_LNE100TX 0x0002 +#define PCI_DEVICE_ID_LC82C115 0xC115 + +#define PCI_VENDOR_ID_V3 0x11b0 +#define PCI_DEVICE_ID_V3_V960 0x0001 +#define PCI_DEVICE_ID_V3_V350 0x0001 +#define PCI_DEVICE_ID_V3_V961 0x0002 +#define PCI_DEVICE_ID_V3_V351 0x0002 + +#define PCI_VENDOR_ID_NP 0x11bc +#define PCI_DEVICE_ID_NP_PCI_FDDI 0x0001 + +#define PCI_VENDOR_ID_ATT 0x11c1 +#define PCI_DEVICE_ID_ATT_L56XMF 0x0440 +#define PCI_DEVICE_ID_ATT_VENUS_MODEM 0x480 + +#define PCI_VENDOR_ID_SPECIALIX 0x11cb +#define PCI_DEVICE_ID_SPECIALIX_IO8 0x2000 +#define PCI_DEVICE_ID_SPECIALIX_XIO 0x4000 +#define PCI_DEVICE_ID_SPECIALIX_RIO 0x8000 +#define PCI_SUBDEVICE_ID_SPECIALIX_SPEED4 0xa004 + +#define PCI_VENDOR_ID_AURAVISION 0x11d1 +#define PCI_DEVICE_ID_AURAVISION_VXP524 0x01f7 + +#define PCI_VENDOR_ID_ANALOG_DEVICES 0x11d4 +#define PCI_DEVICE_ID_AD1889JS 0x1889 + +#define PCI_VENDOR_ID_IKON 0x11d5 +#define PCI_DEVICE_ID_IKON_10115 0x0115 +#define PCI_DEVICE_ID_IKON_10117 0x0117 + +#define PCI_VENDOR_ID_ZORAN 0x11de +#define PCI_DEVICE_ID_ZORAN_36057 0x6057 +#define PCI_DEVICE_ID_ZORAN_36120 0x6120 + +#define PCI_VENDOR_ID_KINETIC 0x11f4 +#define PCI_DEVICE_ID_KINETIC_2915 0x2915 + +#define PCI_VENDOR_ID_COMPEX 0x11f6 +#define PCI_DEVICE_ID_COMPEX_ENET100VG4 0x0112 +#define PCI_DEVICE_ID_COMPEX_RL2000 0x1401 +#define PCI_DEVICE_ID_COMPEX_RL100ATX 0x2011 + +#define PCI_VENDOR_ID_RP 0x11fe +#define PCI_DEVICE_ID_RP32INTF 0x0001 +#define PCI_DEVICE_ID_RP8INTF 0x0002 +#define PCI_DEVICE_ID_RP16INTF 0x0003 +#define PCI_DEVICE_ID_RP4QUAD 0x0004 +#define PCI_DEVICE_ID_RP8OCTA 0x0005 +#define PCI_DEVICE_ID_RP8J 0x0006 +#define PCI_DEVICE_ID_RPP4 0x000A +#define PCI_DEVICE_ID_RPP8 0x000B +#define PCI_DEVICE_ID_RP8M 0x000C + +#define PCI_VENDOR_ID_CYCLADES 0x120e +#define PCI_DEVICE_ID_CYCLOM_Y_Lo 0x0100 +#define PCI_DEVICE_ID_CYCLOM_Y_Hi 0x0101 +#define PCI_DEVICE_ID_CYCLOM_4Y_Lo 0x0102 +#define PCI_DEVICE_ID_CYCLOM_4Y_Hi 0x0103 +#define PCI_DEVICE_ID_CYCLOM_8Y_Lo 0x0104 +#define PCI_DEVICE_ID_CYCLOM_8Y_Hi 0x0105 +#define PCI_DEVICE_ID_CYCLOM_Z_Lo 0x0200 +#define PCI_DEVICE_ID_CYCLOM_Z_Hi 0x0201 +#define PCI_DEVICE_ID_PC300_RX_2 0x0300 +#define PCI_DEVICE_ID_PC300_RX_1 0x0301 +#define PCI_DEVICE_ID_PC300_TE_2 0x0310 +#define PCI_DEVICE_ID_PC300_TE_1 0x0311 + +#define PCI_VENDOR_ID_ESSENTIAL 0x120f +#define PCI_DEVICE_ID_ESSENTIAL_ROADRUNNER 0x0001 + +#define PCI_VENDOR_ID_O2 0x1217 +#define PCI_DEVICE_ID_O2_6729 0x6729 +#define PCI_DEVICE_ID_O2_6730 0x673a +#define PCI_DEVICE_ID_O2_6832 0x6832 +#define PCI_DEVICE_ID_O2_6836 0x6836 + +#define PCI_VENDOR_ID_3DFX 0x121a +#define PCI_DEVICE_ID_3DFX_VOODOO 0x0001 +#define PCI_DEVICE_ID_3DFX_VOODOO2 0x0002 +#define PCI_DEVICE_ID_3DFX_BANSHEE 0x0003 +#define PCI_DEVICE_ID_3DFX_VOODOO3 0x0005 + +#define PCI_VENDOR_ID_SIGMADES 0x1236 +#define PCI_DEVICE_ID_SIGMADES_6425 0x6401 + +#define PCI_VENDOR_ID_CCUBE 0x123f + +#define PCI_VENDOR_ID_AVM 0x1244 +#define PCI_DEVICE_ID_AVM_B1 0x0700 +#define PCI_DEVICE_ID_AVM_C4 0x0800 +#define PCI_DEVICE_ID_AVM_A1 0x0a00 +#define PCI_DEVICE_ID_AVM_A1_V2 0x0e00 +#define PCI_DEVICE_ID_AVM_C2 0x1100 +#define PCI_DEVICE_ID_AVM_T1 0x1200 + +#define PCI_VENDOR_ID_DIPIX 0x1246 + +#define PCI_VENDOR_ID_STALLION 0x124d +#define PCI_DEVICE_ID_STALLION_ECHPCI832 0x0000 +#define PCI_DEVICE_ID_STALLION_ECHPCI864 0x0002 +#define PCI_DEVICE_ID_STALLION_EIOPCI 0x0003 + +#define PCI_VENDOR_ID_OPTIBASE 0x1255 +#define PCI_DEVICE_ID_OPTIBASE_FORGE 0x1110 +#define PCI_DEVICE_ID_OPTIBASE_FUSION 0x1210 +#define PCI_DEVICE_ID_OPTIBASE_VPLEX 0x2110 +#define PCI_DEVICE_ID_OPTIBASE_VPLEXCC 0x2120 +#define PCI_DEVICE_ID_OPTIBASE_VQUEST 0x2130 + +#define PCI_VENDOR_ID_ESS 0x125d +#define PCI_DEVICE_ID_ESS_ESS1968 0x1968 +#define PCI_DEVICE_ID_ESS_AUDIOPCI 0x1969 +#define PCI_DEVICE_ID_ESS_ESS1978 0x1978 + +#define PCI_VENDOR_ID_HARRIS 0x1260 +#define PCI_DEVICE_ID_HARRIS_PRISM2 0x3873 + +#define PCI_VENDOR_ID_SATSAGEM 0x1267 +#define PCI_DEVICE_ID_SATSAGEM_NICCY 0x1016 +#define PCI_DEVICE_ID_SATSAGEM_PCR2101 0x5352 +#define PCI_DEVICE_ID_SATSAGEM_TELSATTURBO 0x5a4b + +#define PCI_VENDOR_ID_HUGHES 0x1273 +#define PCI_DEVICE_ID_HUGHES_DIRECPC 0x0002 + +#define PCI_VENDOR_ID_ENSONIQ 0x1274 +#define PCI_DEVICE_ID_ENSONIQ_CT5880 0x5880 +#define PCI_DEVICE_ID_ENSONIQ_ES1370 0x5000 +#define PCI_DEVICE_ID_ENSONIQ_ES1371 0x1371 + +#define PCI_VENDOR_ID_ROCKWELL 0x127A + +#define PCI_VENDOR_ID_DAVICOM 0x1282 +#define PCI_DEVICE_ID_DM9009 0x9009 +#define PCI_DEVICE_ID_DM9102 0x9102 + +#define PCI_VENDOR_ID_ITE 0x1283 +#define PCI_DEVICE_ID_ITE_IT8172G_AUDIO 0x0801 +#define PCI_DEVICE_ID_ITE_IT8172G 0x8172 +#define PCI_DEVICE_ID_ITE_8872 0x8872 + + +/* formerly Platform Tech */ +#define PCI_VENDOR_ID_ESS_OLD 0x1285 +#define PCI_DEVICE_ID_ESS_ESS0100 0x0100 + +#define PCI_VENDOR_ID_ALTEON 0x12ae +#define PCI_DEVICE_ID_ALTEON_ACENIC 0x0001 + +#define PCI_VENDOR_ID_USR 0x12B9 + +#define PCI_VENDOR_ID_HOLTEK 0x12c3 +#define PCI_DEVICE_ID_HOLTEK_HT80232 0x0058 + +#define PCI_SUBVENDOR_ID_CONNECT_TECH 0x12c4 +#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_232 0x0001 +#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH4_232 0x0002 +#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH2_232 0x0003 +#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_485 0x0004 +#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_485_4_4 0x0005 +#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH4_485 0x0006 +#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH4_485_2_2 0x0007 +#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH2_485 0x0008 +#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_485_2_6 0x0009 +#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH081101V1 0x000A +#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH041101V1 0x000B + +#define PCI_VENDOR_ID_PICTUREL 0x12c5 +#define PCI_DEVICE_ID_PICTUREL_PCIVST 0x0081 + +#define PCI_VENDOR_ID_NVIDIA_SGS 0x12d2 +#define PCI_DEVICE_ID_NVIDIA_SGS_RIVA128 0x0018 + +#define PCI_SUBVENDOR_ID_CHASE_PCIFAST 0x12E0 +#define PCI_SUBDEVICE_ID_CHASE_PCIFAST4 0x0031 +#define PCI_SUBDEVICE_ID_CHASE_PCIFAST8 0x0021 +#define PCI_SUBDEVICE_ID_CHASE_PCIFAST16 0x0011 +#define PCI_SUBDEVICE_ID_CHASE_PCIFAST16FMC 0x0041 +#define PCI_SUBVENDOR_ID_CHASE_PCIRAS 0x124D +#define PCI_SUBDEVICE_ID_CHASE_PCIRAS4 0xF001 +#define PCI_SUBDEVICE_ID_CHASE_PCIRAS8 0xF010 + +#define PCI_VENDOR_ID_AUREAL 0x12eb +#define PCI_DEVICE_ID_AUREAL_VORTEX_1 0x0001 +#define PCI_DEVICE_ID_AUREAL_VORTEX_2 0x0002 + +#define PCI_VENDOR_ID_CBOARDS 0x1307 +#define PCI_DEVICE_ID_CBOARDS_DAS1602_16 0x0001 + +#define PCI_VENDOR_ID_SIIG 0x131f +#define PCI_DEVICE_ID_SIIG_1S_10x_550 0x1000 +#define PCI_DEVICE_ID_SIIG_1S_10x_650 0x1001 +#define PCI_DEVICE_ID_SIIG_1S_10x_850 0x1002 +#define PCI_DEVICE_ID_SIIG_1S1P_10x_550 0x1010 +#define PCI_DEVICE_ID_SIIG_1S1P_10x_650 0x1011 +#define PCI_DEVICE_ID_SIIG_1S1P_10x_850 0x1012 +#define PCI_DEVICE_ID_SIIG_1P_10x 0x1020 +#define PCI_DEVICE_ID_SIIG_2P_10x 0x1021 +#define PCI_DEVICE_ID_SIIG_2S_10x_550 0x1030 +#define PCI_DEVICE_ID_SIIG_2S_10x_650 0x1031 +#define PCI_DEVICE_ID_SIIG_2S_10x_850 0x1032 +#define PCI_DEVICE_ID_SIIG_2S1P_10x_550 0x1034 +#define PCI_DEVICE_ID_SIIG_2S1P_10x_650 0x1035 +#define PCI_DEVICE_ID_SIIG_2S1P_10x_850 0x1036 +#define PCI_DEVICE_ID_SIIG_4S_10x_550 0x1050 +#define PCI_DEVICE_ID_SIIG_4S_10x_650 0x1051 +#define PCI_DEVICE_ID_SIIG_4S_10x_850 0x1052 +#define PCI_DEVICE_ID_SIIG_1S_20x_550 0x2000 +#define PCI_DEVICE_ID_SIIG_1S_20x_650 0x2001 +#define PCI_DEVICE_ID_SIIG_1S_20x_850 0x2002 +#define PCI_DEVICE_ID_SIIG_1P_20x 0x2020 +#define PCI_DEVICE_ID_SIIG_2P_20x 0x2021 +#define PCI_DEVICE_ID_SIIG_2S_20x_550 0x2030 +#define PCI_DEVICE_ID_SIIG_2S_20x_650 0x2031 +#define PCI_DEVICE_ID_SIIG_2S_20x_850 0x2032 +#define PCI_DEVICE_ID_SIIG_2P1S_20x_550 0x2040 +#define PCI_DEVICE_ID_SIIG_2P1S_20x_650 0x2041 +#define PCI_DEVICE_ID_SIIG_2P1S_20x_850 0x2042 +#define PCI_DEVICE_ID_SIIG_1S1P_20x_550 0x2010 +#define PCI_DEVICE_ID_SIIG_1S1P_20x_650 0x2011 +#define PCI_DEVICE_ID_SIIG_1S1P_20x_850 0x2012 +#define PCI_DEVICE_ID_SIIG_4S_20x_550 0x2050 +#define PCI_DEVICE_ID_SIIG_4S_20x_650 0x2051 +#define PCI_DEVICE_ID_SIIG_4S_20x_850 0x2052 +#define PCI_DEVICE_ID_SIIG_2S1P_20x_550 0x2060 +#define PCI_DEVICE_ID_SIIG_2S1P_20x_650 0x2061 +#define PCI_DEVICE_ID_SIIG_2S1P_20x_850 0x2062 + +#define PCI_VENDOR_ID_ADMTEK 0x1317 +#define PCI_DEVICE_ID_ADMTEK_0985 0x0985 + +#define PCI_VENDOR_ID_DOMEX 0x134a +#define PCI_DEVICE_ID_DOMEX_DMX3191D 0x0001 + +#define PCI_VENDOR_ID_QUATECH 0x135C +#define PCI_DEVICE_ID_QUATECH_QSC100 0x0010 +#define PCI_DEVICE_ID_QUATECH_DSC100 0x0020 +#define PCI_DEVICE_ID_QUATECH_DSC200 0x0030 +#define PCI_DEVICE_ID_QUATECH_QSC200 0x0040 +#define PCI_DEVICE_ID_QUATECH_ESC100D 0x0050 +#define PCI_DEVICE_ID_QUATECH_ESC100M 0x0060 + +#define PCI_VENDOR_ID_SEALEVEL 0x135e +#define PCI_DEVICE_ID_SEALEVEL_U530 0x7101 +#define PCI_DEVICE_ID_SEALEVEL_UCOMM2 0x7201 +#define PCI_DEVICE_ID_SEALEVEL_UCOMM422 0x7402 +#define PCI_DEVICE_ID_SEALEVEL_UCOMM232 0x7202 +#define PCI_DEVICE_ID_SEALEVEL_COMM4 0x7401 +#define PCI_DEVICE_ID_SEALEVEL_COMM8 0x7801 + +#define PCI_VENDOR_ID_HYPERCOPE 0x1365 +#define PCI_DEVICE_ID_HYPERCOPE_PLX 0x9050 +#define PCI_SUBDEVICE_ID_HYPERCOPE_OLD_ERGO 0x0104 +#define PCI_SUBDEVICE_ID_HYPERCOPE_ERGO 0x0106 +#define PCI_SUBDEVICE_ID_HYPERCOPE_METRO 0x0107 +#define PCI_SUBDEVICE_ID_HYPERCOPE_CHAMP2 0x0108 +#define PCI_SUBDEVICE_ID_HYPERCOPE_PLEXUS 0x0109 + +#define PCI_VENDOR_ID_KAWASAKI 0x136b +#define PCI_DEVICE_ID_MCHIP_KL5A72002 0xff01 + +#define PCI_VENDOR_ID_LMC 0x1376 +#define PCI_DEVICE_ID_LMC_HSSI 0x0003 +#define PCI_DEVICE_ID_LMC_DS3 0x0004 +#define PCI_DEVICE_ID_LMC_SSI 0x0005 +#define PCI_DEVICE_ID_LMC_T1 0x0006 + +#define PCI_VENDOR_ID_NETGEAR 0x1385 +#define PCI_DEVICE_ID_NETGEAR_MA301 0x4100 +#define PCI_DEVICE_ID_NETGEAR_GA620 0x620a +#define PCI_DEVICE_ID_NETGEAR_GA622 0x622a + +#define PCI_VENDOR_ID_APPLICOM 0x1389 +#define PCI_DEVICE_ID_APPLICOM_PCIGENERIC 0x0001 +#define PCI_DEVICE_ID_APPLICOM_PCI2000IBS_CAN 0x0002 +#define PCI_DEVICE_ID_APPLICOM_PCI2000PFB 0x0003 + +#define PCI_VENDOR_ID_MOXA 0x1393 +#define PCI_DEVICE_ID_MOXA_C104 0x1040 +#define PCI_DEVICE_ID_MOXA_C168 0x1680 +#define PCI_DEVICE_ID_MOXA_CP204J 0x2040 +#define PCI_DEVICE_ID_MOXA_C218 0x2180 +#define PCI_DEVICE_ID_MOXA_C320 0x3200 + +#define PCI_VENDOR_ID_CCD 0x1397 +#define PCI_DEVICE_ID_CCD_2BD0 0x2bd0 +#define PCI_DEVICE_ID_CCD_B000 0xb000 +#define PCI_DEVICE_ID_CCD_B006 0xb006 +#define PCI_DEVICE_ID_CCD_B007 0xb007 +#define PCI_DEVICE_ID_CCD_B008 0xb008 +#define PCI_DEVICE_ID_CCD_B009 0xb009 +#define PCI_DEVICE_ID_CCD_B00A 0xb00a +#define PCI_DEVICE_ID_CCD_B00B 0xb00b +#define PCI_DEVICE_ID_CCD_B00C 0xb00c +#define PCI_DEVICE_ID_CCD_B100 0xb100 + +#define PCI_VENDOR_ID_MICROGATE 0x13c0 +#define PCI_DEVICE_ID_MICROGATE_USC 0x0010 +#define PCI_DEVICE_ID_MICROGATE_SCC 0x0020 +#define PCI_DEVICE_ID_MICROGATE_SCA 0x0030 + +#define PCI_VENDOR_ID_3WARE 0x13C1 +#define PCI_DEVICE_ID_3WARE_1000 0x1000 + +#define PCI_VENDOR_ID_ABOCOM 0x13D1 +#define PCI_DEVICE_ID_ABOCOM_2BD1 0x2BD1 + +#define PCI_VENDOR_ID_CMEDIA 0x13f6 +#define PCI_DEVICE_ID_CMEDIA_CM8338A 0x0100 +#define PCI_DEVICE_ID_CMEDIA_CM8338B 0x0101 +#define PCI_DEVICE_ID_CMEDIA_CM8738 0x0111 +#define PCI_DEVICE_ID_CMEDIA_CM8738B 0x0112 + +#define PCI_VENDOR_ID_LAVA 0x1407 +#define PCI_DEVICE_ID_LAVA_DSERIAL 0x0100 /* 2x 16550 */ +#define PCI_DEVICE_ID_LAVA_QUATRO_A 0x0101 /* 2x 16550, half of 4 port */ +#define PCI_DEVICE_ID_LAVA_QUATRO_B 0x0102 /* 2x 16550, half of 4 port */ +#define PCI_DEVICE_ID_LAVA_PORT_PLUS 0x0200 /* 2x 16650 */ +#define PCI_DEVICE_ID_LAVA_QUAD_A 0x0201 /* 2x 16650, half of 4 port */ +#define PCI_DEVICE_ID_LAVA_QUAD_B 0x0202 /* 2x 16650, half of 4 port */ +#define PCI_DEVICE_ID_LAVA_SSERIAL 0x0500 /* 1x 16550 */ +#define PCI_DEVICE_ID_LAVA_PORT_650 0x0600 /* 1x 16650 */ +#define PCI_DEVICE_ID_LAVA_PARALLEL 0x8000 +#define PCI_DEVICE_ID_LAVA_DUAL_PAR_A 0x8002 /* The Lava Dual Parallel is */ +#define PCI_DEVICE_ID_LAVA_DUAL_PAR_B 0x8003 /* two PCI devices on a card */ +#define PCI_DEVICE_ID_LAVA_BOCA_IOPPAR 0x8800 + +#define PCI_VENDOR_ID_TIMEDIA 0x1409 +#define PCI_DEVICE_ID_TIMEDIA_1889 0x7168 + +#define PCI_VENDOR_ID_OXSEMI 0x1415 +#define PCI_DEVICE_ID_OXSEMI_12PCI840 0x8403 +#define PCI_DEVICE_ID_OXSEMI_16PCI954 0x9501 +#define PCI_DEVICE_ID_OXSEMI_16PCI952 0x950A +#define PCI_DEVICE_ID_OXSEMI_16PCI95N 0x9511 +#define PCI_DEVICE_ID_OXSEMI_16PCI954PP 0x9513 + +#define PCI_VENDOR_ID_AIRONET 0x14b9 +#define PCI_DEVICE_ID_AIRONET_4800_1 0x0001 +#define PCI_DEVICE_ID_AIRONET_4800 0x4500 // values switched? see +#define PCI_DEVICE_ID_AIRONET_4500 0x4800 // drivers/net/aironet4500_card.c + +#define PCI_VENDOR_ID_TITAN 0x14D2 +#define PCI_DEVICE_ID_TITAN_010L 0x8001 +#define PCI_DEVICE_ID_TITAN_100L 0x8010 +#define PCI_DEVICE_ID_TITAN_110L 0x8011 +#define PCI_DEVICE_ID_TITAN_200L 0x8020 +#define PCI_DEVICE_ID_TITAN_210L 0x8021 +#define PCI_DEVICE_ID_TITAN_400L 0x8040 +#define PCI_DEVICE_ID_TITAN_800L 0x8080 +#define PCI_DEVICE_ID_TITAN_100 0xA001 +#define PCI_DEVICE_ID_TITAN_200 0xA005 +#define PCI_DEVICE_ID_TITAN_400 0xA003 +#define PCI_DEVICE_ID_TITAN_800B 0xA004 + +#define PCI_VENDOR_ID_PANACOM 0x14d4 +#define PCI_DEVICE_ID_PANACOM_QUADMODEM 0x0400 +#define PCI_DEVICE_ID_PANACOM_DUALMODEM 0x0402 + +#define PCI_VENDOR_ID_BROADCOM 0x14e4 +#define PCI_DEVICE_ID_TIGON3_5700 0x1644 +#define PCI_DEVICE_ID_TIGON3_5701 0x1645 +#define PCI_DEVICE_ID_TIGON3_5702 0x1646 +#define PCI_DEVICE_ID_TIGON3_5703 0x1647 +#define PCI_DEVICE_ID_TIGON3_5704 0x1648 +#define PCI_DEVICE_ID_TIGON3_5702FE 0x164d +#define PCI_DEVICE_ID_TIGON3_5705 0x1653 +#define PCI_DEVICE_ID_TIGON3_5705_2 0x1654 +#define PCI_DEVICE_ID_TIGON3_5705M 0x165d +#define PCI_DEVICE_ID_TIGON3_5705M_2 0x165e +#define PCI_DEVICE_ID_TIGON3_5782 0x1696 +#define PCI_DEVICE_ID_TIGON3_5788 0x169c +#define PCI_DEVICE_ID_TIGON3_5702X 0x16a6 +#define PCI_DEVICE_ID_TIGON3_5703X 0x16a7 +#define PCI_DEVICE_ID_TIGON3_5704S 0x16a8 +#define PCI_DEVICE_ID_TIGON3_5702A3 0x16c6 +#define PCI_DEVICE_ID_TIGON3_5703A3 0x16c7 +#define PCI_DEVICE_ID_TIGON3_5901 0x170d +#define PCI_DEVICE_ID_TIGON3_5901_2 0x170e + +#define PCI_VENDOR_ID_SYBA 0x1592 +#define PCI_DEVICE_ID_SYBA_2P_EPP 0x0782 +#define PCI_DEVICE_ID_SYBA_1P_ECP 0x0783 + +#define PCI_VENDOR_ID_MORETON 0x15aa +#define PCI_DEVICE_ID_RASTEL_2PORT 0x2000 + +#define PCI_VENDOR_ID_ZOLTRIX 0x15b0 +#define PCI_DEVICE_ID_ZOLTRIX_2BD0 0x2bd0 + +#define PCI_VENDOR_ID_PDC 0x15e9 +#define PCI_DEVICE_ID_PDC_1841 0x1841 + +#define PCI_VENDOR_ID_SYMPHONY 0x1c1c +#define PCI_DEVICE_ID_SYMPHONY_101 0x0001 + +#define PCI_VENDOR_ID_TEKRAM 0x1de1 +#define PCI_DEVICE_ID_TEKRAM_DC290 0xdc29 + +#define PCI_VENDOR_ID_3DLABS 0x3d3d +#define PCI_DEVICE_ID_3DLABS_300SX 0x0001 +#define PCI_DEVICE_ID_3DLABS_500TX 0x0002 +#define PCI_DEVICE_ID_3DLABS_DELTA 0x0003 +#define PCI_DEVICE_ID_3DLABS_PERMEDIA 0x0004 +#define PCI_DEVICE_ID_3DLABS_MX 0x0006 +#define PCI_DEVICE_ID_3DLABS_PERMEDIA2 0x0007 +#define PCI_DEVICE_ID_3DLABS_GAMMA 0x0008 +#define PCI_DEVICE_ID_3DLABS_PERMEDIA2V 0x0009 + +#define PCI_VENDOR_ID_AVANCE 0x4005 +#define PCI_DEVICE_ID_AVANCE_ALG2064 0x2064 +#define PCI_DEVICE_ID_AVANCE_2302 0x2302 + +#define PCI_VENDOR_ID_AKS 0x416c +#define PCI_DEVICE_ID_AKS_ALADDINCARD 0x0100 +#define PCI_DEVICE_ID_AKS_CPC 0x0200 + +#define PCI_VENDOR_ID_NETVIN 0x4a14 +#define PCI_DEVICE_ID_NETVIN_NV5000SC 0x5000 + +#define PCI_VENDOR_ID_S3 0x5333 +#define PCI_DEVICE_ID_S3_PLATO_PXS 0x0551 +#define PCI_DEVICE_ID_S3_ViRGE 0x5631 +#define PCI_DEVICE_ID_S3_TRIO 0x8811 +#define PCI_DEVICE_ID_S3_AURORA64VP 0x8812 +#define PCI_DEVICE_ID_S3_TRIO64UVP 0x8814 +#define PCI_DEVICE_ID_S3_ViRGE_VX 0x883d +#define PCI_DEVICE_ID_S3_868 0x8880 +#define PCI_DEVICE_ID_S3_928 0x88b0 +#define PCI_DEVICE_ID_S3_864_1 0x88c0 +#define PCI_DEVICE_ID_S3_864_2 0x88c1 +#define PCI_DEVICE_ID_S3_964_1 0x88d0 +#define PCI_DEVICE_ID_S3_964_2 0x88d1 +#define PCI_DEVICE_ID_S3_968 0x88f0 +#define PCI_DEVICE_ID_S3_TRIO64V2 0x8901 +#define PCI_DEVICE_ID_S3_PLATO_PXG 0x8902 +#define PCI_DEVICE_ID_S3_ViRGE_DXGX 0x8a01 +#define PCI_DEVICE_ID_S3_ViRGE_GX2 0x8a10 +#define PCI_DEVICE_ID_S3_ViRGE_MX 0x8c01 +#define PCI_DEVICE_ID_S3_ViRGE_MXP 0x8c02 +#define PCI_DEVICE_ID_S3_ViRGE_MXPMV 0x8c03 +#define PCI_DEVICE_ID_S3_SONICVIBES 0xca00 + +#define PCI_VENDOR_ID_DCI 0x6666 +#define PCI_DEVICE_ID_DCI_PCCOM4 0x0001 +#define PCI_DEVICE_ID_DCI_PCCOM8 0x0002 + +#define PCI_VENDOR_ID_GENROCO 0x5555 +#define PCI_DEVICE_ID_GENROCO_HFP832 0x0003 + +#define PCI_VENDOR_ID_INTEL 0x8086 +#define PCI_DEVICE_ID_INTEL_21145 0x0039 +#define PCI_DEVICE_ID_INTEL_82375 0x0482 +#define PCI_DEVICE_ID_INTEL_82424 0x0483 +#define PCI_DEVICE_ID_INTEL_82378 0x0484 +#define PCI_DEVICE_ID_INTEL_82430 0x0486 +#define PCI_DEVICE_ID_INTEL_82434 0x04a3 +#define PCI_DEVICE_ID_INTEL_I960 0x0960 +#define PCI_DEVICE_ID_INTEL_82542 0x1000 +#define PCI_DEVICE_ID_INTEL_82543GC_FIBER 0x1001 +#define PCI_DEVICE_ID_INTEL_82543GC_COPPER 0x1004 +#define PCI_DEVICE_ID_INTEL_82544EI_COPPER 0x1008 +#define PCI_DEVICE_ID_INTEL_82544EI_FIBER 0x1009 +#define PCI_DEVICE_ID_INTEL_82544GC_COPPER 0x100C +#define PCI_DEVICE_ID_INTEL_82544GC_LOM 0x100D +#define PCI_DEVICE_ID_INTEL_82540EM 0x100E +#define PCI_DEVICE_ID_INTEL_82545EM_COPPER 0x100F +#define PCI_DEVICE_ID_INTEL_82546EB_COPPER 0x1010 +#define PCI_DEVICE_ID_INTEL_82545EM_FIBER 0x1011 +#define PCI_DEVICE_ID_INTEL_82546EB_FIBER 0x1012 +#define PCI_DEVICE_ID_INTEL_82540EM_LOM 0x1015 +#define PCI_DEVICE_ID_INTEL_ID1029 0x1029 +#define PCI_DEVICE_ID_INTEL_ID1030 0x1030 +#define PCI_DEVICE_ID_INTEL_ID1031 0x1031 +#define PCI_DEVICE_ID_INTEL_ID1038 0x1038 +#define PCI_DEVICE_ID_INTEL_ID1039 0x1039 +#define PCI_DEVICE_ID_INTEL_ID103A 0x103A +#define PCI_DEVICE_ID_INTEL_82562ET 0x1031 +#define PCI_DEVICE_ID_INTEL_82559ER 0x1209 +#define PCI_DEVICE_ID_INTEL_82092AA_0 0x1221 +#define PCI_DEVICE_ID_INTEL_82092AA_1 0x1222 +#define PCI_DEVICE_ID_INTEL_7116 0x1223 +#define PCI_DEVICE_ID_INTEL_82596 0x1226 +#define PCI_DEVICE_ID_INTEL_82865 0x1227 +#define PCI_DEVICE_ID_INTEL_82557 0x1229 +#define PCI_DEVICE_ID_INTEL_82437 0x122d +#define PCI_DEVICE_ID_INTEL_82371FB_0 0x122e +#define PCI_DEVICE_ID_INTEL_82371FB_1 0x1230 +#define PCI_DEVICE_ID_INTEL_82371MX 0x1234 +#define PCI_DEVICE_ID_INTEL_82437MX 0x1235 +#define PCI_DEVICE_ID_INTEL_82441 0x1237 +#define PCI_DEVICE_ID_INTEL_82380FB 0x124b +#define PCI_DEVICE_ID_INTEL_82439 0x1250 +#define PCI_DEVICE_ID_INTEL_80960_RP 0x1960 +#define PCI_DEVICE_ID_INTEL_82801AA_0 0x2410 +#define PCI_DEVICE_ID_INTEL_82801AA_1 0x2411 +#define PCI_DEVICE_ID_INTEL_82801AA_2 0x2412 +#define PCI_DEVICE_ID_INTEL_82801AA_3 0x2413 +#define PCI_DEVICE_ID_INTEL_82801AA_5 0x2415 +#define PCI_DEVICE_ID_INTEL_82801AA_6 0x2416 +#define PCI_DEVICE_ID_INTEL_82801AA_8 0x2418 +#define PCI_DEVICE_ID_INTEL_82801AB_0 0x2420 +#define PCI_DEVICE_ID_INTEL_82801AB_1 0x2421 +#define PCI_DEVICE_ID_INTEL_82801AB_2 0x2422 +#define PCI_DEVICE_ID_INTEL_82801AB_3 0x2423 +#define PCI_DEVICE_ID_INTEL_82801AB_5 0x2425 +#define PCI_DEVICE_ID_INTEL_82801AB_6 0x2426 +#define PCI_DEVICE_ID_INTEL_82801AB_8 0x2428 +#define PCI_DEVICE_ID_INTEL_82801BA_0 0x2440 +#define PCI_DEVICE_ID_INTEL_82801BA_1 0x2442 +#define PCI_DEVICE_ID_INTEL_82801BA_2 0x2443 +#define PCI_DEVICE_ID_INTEL_82801BA_3 0x2444 +#define PCI_DEVICE_ID_INTEL_82801BA_4 0x2445 +#define PCI_DEVICE_ID_INTEL_82801BA_5 0x2446 +#define PCI_DEVICE_ID_INTEL_82801BA_6 0x2448 +#define PCI_DEVICE_ID_INTEL_82801BA_7 0x2449 +#define PCI_DEVICE_ID_INTEL_82562 0x2449 +#define PCI_DEVICE_ID_INTEL_82801BA_8 0x244a +#define PCI_DEVICE_ID_INTEL_82801BA_9 0x244b +#define PCI_DEVICE_ID_INTEL_82801BA_10 0x244c +#define PCI_DEVICE_ID_INTEL_82801BA_11 0x244e +#define PCI_DEVICE_ID_INTEL_82801CA_0 0x2480 +#define PCI_DEVICE_ID_INTEL_82801CA_2 0x2482 +#define PCI_DEVICE_ID_INTEL_82801CA_3 0x2483 +#define PCI_DEVICE_ID_INTEL_82801CA_4 0x2484 +#define PCI_DEVICE_ID_INTEL_82801CA_5 0x2485 +#define PCI_DEVICE_ID_INTEL_82801CA_6 0x2486 +#define PCI_DEVICE_ID_INTEL_82801CA_7 0x2487 +#define PCI_DEVICE_ID_INTEL_82801CA_10 0x248a +#define PCI_DEVICE_ID_INTEL_82801CA_11 0x248b +#define PCI_DEVICE_ID_INTEL_82801CA_12 0x248c +#define PCI_DEVICE_ID_INTEL_80310 0x530d +#define PCI_DEVICE_ID_INTEL_82371SB_0 0x7000 +#define PCI_DEVICE_ID_INTEL_82371SB_1 0x7010 +#define PCI_DEVICE_ID_INTEL_82371SB_2 0x7020 +#define PCI_DEVICE_ID_INTEL_82437VX 0x7030 +#define PCI_DEVICE_ID_INTEL_82439TX 0x7100 +#define PCI_DEVICE_ID_INTEL_82371AB_0 0x7110 +#define PCI_DEVICE_ID_INTEL_82371AB 0x7111 +#define PCI_DEVICE_ID_INTEL_82371AB_2 0x7112 +#define PCI_DEVICE_ID_INTEL_82371AB_3 0x7113 +#define PCI_DEVICE_ID_INTEL_82810_MC1 0x7120 +#define PCI_DEVICE_ID_INTEL_82810_IG1 0x7121 +#define PCI_DEVICE_ID_INTEL_82810_MC3 0x7122 +#define PCI_DEVICE_ID_INTEL_82810_IG3 0x7123 +#define PCI_DEVICE_ID_INTEL_82443LX_0 0x7180 +#define PCI_DEVICE_ID_INTEL_82443LX_1 0x7181 +#define PCI_DEVICE_ID_INTEL_82443BX_0 0x7190 +#define PCI_DEVICE_ID_INTEL_82443BX_1 0x7191 +#define PCI_DEVICE_ID_INTEL_82443BX_2 0x7192 +#define PCI_DEVICE_ID_INTEL_82443MX_0 0x7198 +#define PCI_DEVICE_ID_INTEL_82443MX_1 0x7199 +#define PCI_DEVICE_ID_INTEL_82443MX_2 0x719a +#define PCI_DEVICE_ID_INTEL_82443MX_3 0x719b +#define PCI_DEVICE_ID_INTEL_82372FB_0 0x7600 +#define PCI_DEVICE_ID_INTEL_82372FB_1 0x7601 +#define PCI_DEVICE_ID_INTEL_82372FB_2 0x7602 +#define PCI_DEVICE_ID_INTEL_82372FB_3 0x7603 +#define PCI_DEVICE_ID_INTEL_82454GX 0x84c4 +#define PCI_DEVICE_ID_INTEL_82450GX 0x84c5 +#define PCI_DEVICE_ID_INTEL_82451NX 0x84ca + +#define PCI_VENDOR_ID_COMPUTONE 0x8e0e +#define PCI_DEVICE_ID_COMPUTONE_IP2EX 0x0291 +#define PCI_DEVICE_ID_COMPUTONE_PG 0x0302 +#define PCI_SUBVENDOR_ID_COMPUTONE 0x8e0e +#define PCI_SUBDEVICE_ID_COMPUTONE_PG4 0x0001 +#define PCI_SUBDEVICE_ID_COMPUTONE_PG8 0x0002 +#define PCI_SUBDEVICE_ID_COMPUTONE_PG6 0x0003 + +#define PCI_VENDOR_ID_KTI 0x8e2e +#define PCI_DEVICE_ID_KTI_ET32P2 0x3000 + +#define PCI_VENDOR_ID_ADAPTEC 0x9004 +#define PCI_DEVICE_ID_ADAPTEC_7810 0x1078 +#define PCI_DEVICE_ID_ADAPTEC_7821 0x2178 +#define PCI_DEVICE_ID_ADAPTEC_38602 0x3860 +#define PCI_DEVICE_ID_ADAPTEC_7850 0x5078 +#define PCI_DEVICE_ID_ADAPTEC_7855 0x5578 +#define PCI_DEVICE_ID_ADAPTEC_5800 0x5800 +#define PCI_DEVICE_ID_ADAPTEC_3860 0x6038 +#define PCI_DEVICE_ID_ADAPTEC_1480A 0x6075 +#define PCI_DEVICE_ID_ADAPTEC_7860 0x6078 +#define PCI_DEVICE_ID_ADAPTEC_7861 0x6178 +#define PCI_DEVICE_ID_ADAPTEC_7870 0x7078 +#define PCI_DEVICE_ID_ADAPTEC_7871 0x7178 +#define PCI_DEVICE_ID_ADAPTEC_7872 0x7278 +#define PCI_DEVICE_ID_ADAPTEC_7873 0x7378 +#define PCI_DEVICE_ID_ADAPTEC_7874 0x7478 +#define PCI_DEVICE_ID_ADAPTEC_7895 0x7895 +#define PCI_DEVICE_ID_ADAPTEC_7880 0x8078 +#define PCI_DEVICE_ID_ADAPTEC_7881 0x8178 +#define PCI_DEVICE_ID_ADAPTEC_7882 0x8278 +#define PCI_DEVICE_ID_ADAPTEC_7883 0x8378 +#define PCI_DEVICE_ID_ADAPTEC_7884 0x8478 +#define PCI_DEVICE_ID_ADAPTEC_7885 0x8578 +#define PCI_DEVICE_ID_ADAPTEC_7886 0x8678 +#define PCI_DEVICE_ID_ADAPTEC_7887 0x8778 +#define PCI_DEVICE_ID_ADAPTEC_7888 0x8878 +#define PCI_DEVICE_ID_ADAPTEC_1030 0x8b78 + +#define PCI_VENDOR_ID_ADAPTEC2 0x9005 +#define PCI_DEVICE_ID_ADAPTEC2_2940U2 0x0010 +#define PCI_DEVICE_ID_ADAPTEC2_2930U2 0x0011 +#define PCI_DEVICE_ID_ADAPTEC2_7890B 0x0013 +#define PCI_DEVICE_ID_ADAPTEC2_7890 0x001f +#define PCI_DEVICE_ID_ADAPTEC2_3940U2 0x0050 +#define PCI_DEVICE_ID_ADAPTEC2_3950U2D 0x0051 +#define PCI_DEVICE_ID_ADAPTEC2_7896 0x005f +#define PCI_DEVICE_ID_ADAPTEC2_7892A 0x0080 +#define PCI_DEVICE_ID_ADAPTEC2_7892B 0x0081 +#define PCI_DEVICE_ID_ADAPTEC2_7892D 0x0083 +#define PCI_DEVICE_ID_ADAPTEC2_7892P 0x008f +#define PCI_DEVICE_ID_ADAPTEC2_7899A 0x00c0 +#define PCI_DEVICE_ID_ADAPTEC2_7899B 0x00c1 +#define PCI_DEVICE_ID_ADAPTEC2_7899D 0x00c3 +#define PCI_DEVICE_ID_ADAPTEC2_7899P 0x00cf + +#define PCI_VENDOR_ID_ATRONICS 0x907f +#define PCI_DEVICE_ID_ATRONICS_2015 0x2015 + +#define PCI_VENDOR_ID_HOLTEK2 0x9412 +#define PCI_DEVICE_ID_HOLTEK2_6565 0x6565 + +#define PCI_VENDOR_ID_NETMOS 0x9710 +#define PCI_DEVICE_ID_NETMOS_9735 0x9735 +#define PCI_DEVICE_ID_NETMOS_9835 0x9835 + +#define PCI_SUBVENDOR_ID_EXSYS 0xd84d +#define PCI_SUBDEVICE_ID_EXSYS_4014 0x4014 + +#define PCI_VENDOR_ID_TIGERJET 0xe159 +#define PCI_DEVICE_ID_TIGERJET_300 0x0001 +#define PCI_DEVICE_ID_TIGERJET_100 0x0002 + +#define PCI_VENDOR_ID_ARK 0xedd8 +#define PCI_DEVICE_ID_ARK_STING 0xa091 +#define PCI_DEVICE_ID_ARK_STINGARK 0xa099 +#define PCI_DEVICE_ID_ARK_2000MT 0xa0a1 + diff --git a/usr/src/grub/grub-0.97/netboot/pci_io.c b/usr/src/grub/grub-0.97/netboot/pci_io.c new file mode 100644 index 0000000000..029482528a --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/pci_io.c @@ -0,0 +1,431 @@ +/* +** Support for NE2000 PCI clones added David Monro June 1997 +** Generalised to other NICs by Ken Yap July 1997 +** +** Most of this is taken from: +** +** /usr/src/linux/drivers/pci/pci.c +** /usr/src/linux/include/linux/pci.h +** /usr/src/linux/arch/i386/bios32.c +** /usr/src/linux/include/linux/bios32.h +** /usr/src/linux/drivers/net/ne.c +*/ +#define PCBIOS +#include "grub.h" +#include "pci.h" + +#ifdef CONFIG_PCI_DIRECT +#define PCIBIOS_SUCCESSFUL 0x00 + +#define DEBUG 0 + +/* + * Functions for accessing PCI configuration space with type 1 accesses + */ + +#define CONFIG_CMD(bus, device_fn, where) (0x80000000 | (bus << 16) | (device_fn << 8) | (where & ~3)) + +int pcibios_read_config_byte(unsigned int bus, unsigned int device_fn, + unsigned int where, uint8_t *value) +{ + outl(CONFIG_CMD(bus,device_fn,where), 0xCF8); + *value = inb(0xCFC + (where&3)); + return PCIBIOS_SUCCESSFUL; +} + +int pcibios_read_config_word (unsigned int bus, + unsigned int device_fn, unsigned int where, uint16_t *value) +{ + outl(CONFIG_CMD(bus,device_fn,where), 0xCF8); + *value = inw(0xCFC + (where&2)); + return PCIBIOS_SUCCESSFUL; +} + +int pcibios_read_config_dword (unsigned int bus, unsigned int device_fn, + unsigned int where, uint32_t *value) +{ + outl(CONFIG_CMD(bus,device_fn,where), 0xCF8); + *value = inl(0xCFC); + return PCIBIOS_SUCCESSFUL; +} + +int pcibios_write_config_byte (unsigned int bus, unsigned int device_fn, + unsigned int where, uint8_t value) +{ + outl(CONFIG_CMD(bus,device_fn,where), 0xCF8); + outb(value, 0xCFC + (where&3)); + return PCIBIOS_SUCCESSFUL; +} + +int pcibios_write_config_word (unsigned int bus, unsigned int device_fn, + unsigned int where, uint16_t value) +{ + outl(CONFIG_CMD(bus,device_fn,where), 0xCF8); + outw(value, 0xCFC + (where&2)); + return PCIBIOS_SUCCESSFUL; +} + +int pcibios_write_config_dword (unsigned int bus, unsigned int device_fn, unsigned int where, uint32_t value) +{ + outl(CONFIG_CMD(bus,device_fn,where), 0xCF8); + outl(value, 0xCFC); + return PCIBIOS_SUCCESSFUL; +} + +#undef CONFIG_CMD + +#else /* CONFIG_PCI_DIRECT not defined */ + +#if !defined(PCBIOS) +#error "The pcibios can only be used when the PCBIOS support is compiled in" +#endif + + +#define KERN_CODE_SEG 0X8 +/* Stuff for asm */ +#define save_flags(x) \ +__asm__ __volatile__("pushfl ; popl %0":"=g" (x): /* no input */ :"memory") + +#define cli() __asm__ __volatile__ ("cli": : :"memory") + +#define restore_flags(x) \ +__asm__ __volatile__("pushl %0 ; popfl": /* no output */ :"g" (x):"memory") + + + +static struct { + unsigned long address; + unsigned short segment; +} bios32_indirect = { 0, KERN_CODE_SEG }; + +static long pcibios_entry = 0; +static struct { + unsigned long address; + unsigned short segment; +} pci_indirect = { 0, KERN_CODE_SEG }; + +static unsigned long bios32_service(unsigned long service) +{ + unsigned char return_code; /* %al */ + unsigned long address; /* %ebx */ + unsigned long length; /* %ecx */ + unsigned long entry; /* %edx */ + unsigned long flags; + + save_flags(flags); + __asm__( +#ifdef ABSOLUTE_WITHOUT_ASTERISK + "lcall (%%edi)" +#else + "lcall *(%%edi)" +#endif + : "=a" (return_code), + "=b" (address), + "=c" (length), + "=d" (entry) + : "0" (service), + "1" (0), + "D" (&bios32_indirect)); + restore_flags(flags); + + switch (return_code) { + case 0: + return address + entry; + case 0x80: /* Not present */ + printf("bios32_service(%d) : not present\n", service); + return 0; + default: /* Shouldn't happen */ + printf("bios32_service(%d) : returned %#X, mail drew@colorado.edu\n", + service, return_code); + return 0; + } +} + +int pcibios_read_config_byte(unsigned int bus, + unsigned int device_fn, unsigned int where, uint8_t *value) +{ + unsigned long ret; + unsigned long bx = (bus << 8) | device_fn; + unsigned long flags; + + save_flags(flags); + __asm__( +#ifdef ABSOLUTE_WITHOUT_ASTERISK + "lcall (%%esi)\n\t" +#else + "lcall *(%%esi)\n\t" +#endif + "jc 1f\n\t" + "xor %%ah, %%ah\n" + "1:" + : "=c" (*value), + "=a" (ret) + : "1" (PCIBIOS_READ_CONFIG_BYTE), + "b" (bx), + "D" ((long) where), + "S" (&pci_indirect)); + restore_flags(flags); + return (int) (ret & 0xff00) >> 8; +} + +int pcibios_read_config_word(unsigned int bus, + unsigned int device_fn, unsigned int where, uint16_t *value) +{ + unsigned long ret; + unsigned long bx = (bus << 8) | device_fn; + unsigned long flags; + + save_flags(flags); + __asm__( +#ifdef ABSOLUTE_WITHOUT_ASTERISK + "lcall (%%esi)\n\t" +#else + "lcall *(%%esi)\n\t" +#endif + "jc 1f\n\t" + "xor %%ah, %%ah\n" + "1:" + : "=c" (*value), + "=a" (ret) + : "1" (PCIBIOS_READ_CONFIG_WORD), + "b" (bx), + "D" ((long) where), + "S" (&pci_indirect)); + restore_flags(flags); + return (int) (ret & 0xff00) >> 8; +} + +int pcibios_read_config_dword(unsigned int bus, + unsigned int device_fn, unsigned int where, uint32_t *value) +{ + unsigned long ret; + unsigned long bx = (bus << 8) | device_fn; + unsigned long flags; + + save_flags(flags); + __asm__( +#ifdef ABSOLUTE_WITHOUT_ASTERISK + "lcall (%%esi)\n\t" +#else + "lcall *(%%esi)\n\t" +#endif + "jc 1f\n\t" + "xor %%ah, %%ah\n" + "1:" + : "=c" (*value), + "=a" (ret) + : "1" (PCIBIOS_READ_CONFIG_DWORD), + "b" (bx), + "D" ((long) where), + "S" (&pci_indirect)); + restore_flags(flags); + return (int) (ret & 0xff00) >> 8; +} + +int pcibios_write_config_byte (unsigned int bus, + unsigned int device_fn, unsigned int where, uint8_t value) +{ + unsigned long ret; + unsigned long bx = (bus << 8) | device_fn; + unsigned long flags; + + save_flags(flags); cli(); + __asm__( +#ifdef ABSOLUTE_WITHOUT_ASTERISK + "lcall (%%esi)\n\t" +#else + "lcall *(%%esi)\n\t" +#endif + "jc 1f\n\t" + "xor %%ah, %%ah\n" + "1:" + : "=a" (ret) + : "0" (PCIBIOS_WRITE_CONFIG_BYTE), + "c" (value), + "b" (bx), + "D" ((long) where), + "S" (&pci_indirect)); + restore_flags(flags); + return (int) (ret & 0xff00) >> 8; +} + +int pcibios_write_config_word (unsigned int bus, + unsigned int device_fn, unsigned int where, uint16_t value) +{ + unsigned long ret; + unsigned long bx = (bus << 8) | device_fn; + unsigned long flags; + + save_flags(flags); cli(); + __asm__( +#ifdef ABSOLUTE_WITHOUT_ASTERISK + "lcall (%%esi)\n\t" +#else + "lcall *(%%esi)\n\t" +#endif + "jc 1f\n\t" + "xor %%ah, %%ah\n" + "1:" + : "=a" (ret) + : "0" (PCIBIOS_WRITE_CONFIG_WORD), + "c" (value), + "b" (bx), + "D" ((long) where), + "S" (&pci_indirect)); + restore_flags(flags); + return (int) (ret & 0xff00) >> 8; +} + +int pcibios_write_config_dword (unsigned int bus, + unsigned int device_fn, unsigned int where, uint32_t value) +{ + unsigned long ret; + unsigned long bx = (bus << 8) | device_fn; + unsigned long flags; + + save_flags(flags); cli(); + __asm__( +#ifdef ABSOLUTE_WITHOUT_ASTERISK + "lcall (%%esi)\n\t" +#else + "lcall *(%%esi)\n\t" +#endif + "jc 1f\n\t" + "xor %%ah, %%ah\n" + "1:" + : "=a" (ret) + : "0" (PCIBIOS_WRITE_CONFIG_DWORD), + "c" (value), + "b" (bx), + "D" ((long) where), + "S" (&pci_indirect)); + restore_flags(flags); + return (int) (ret & 0xff00) >> 8; +} + +static void check_pcibios(void) +{ + unsigned long signature; + unsigned char present_status; + unsigned char major_revision; + unsigned char minor_revision; + unsigned long flags; + int pack; + + if ((pcibios_entry = bios32_service(PCI_SERVICE))) { + pci_indirect.address = pcibios_entry; + + save_flags(flags); + __asm__( +#ifdef ABSOLUTE_WITHOUT_ASTERISK + "lcall (%%edi)\n\t" +#else + "lcall *(%%edi)\n\t" +#endif + "jc 1f\n\t" + "xor %%ah, %%ah\n" + "1:\tshl $8, %%eax\n\t" + "movw %%bx, %%ax" + : "=d" (signature), + "=a" (pack) + : "1" (PCIBIOS_PCI_BIOS_PRESENT), + "D" (&pci_indirect) + : "bx", "cx"); + restore_flags(flags); + + present_status = (pack >> 16) & 0xff; + major_revision = (pack >> 8) & 0xff; + minor_revision = pack & 0xff; + if (present_status || (signature != PCI_SIGNATURE)) { + printf("ERROR: BIOS32 says PCI BIOS, but no PCI " + "BIOS????\n"); + pcibios_entry = 0; + } +#if DEBUG + if (pcibios_entry) { + printf ("pcibios_init : PCI BIOS revision %hhX.%hhX" + " entry at %#X\n", major_revision, + minor_revision, pcibios_entry); + } +#endif + } +} + +static void pcibios_init(void) +{ + union bios32 *check; + unsigned char sum; + int i, length; + unsigned long bios32_entry = 0; + + EnterFunction("pcibios_init"); + /* + * Follow the standard procedure for locating the BIOS32 Service + * directory by scanning the permissible address range from + * 0xe0000 through 0xfffff for a valid BIOS32 structure. + * + */ + + for (check = (union bios32 *) 0xe0000; check <= (union bios32 *) 0xffff0; ++check) { + if (check->fields.signature != BIOS32_SIGNATURE) + continue; + length = check->fields.length * 16; + if (!length) + continue; + sum = 0; + for (i = 0; i < length ; ++i) + sum += check->chars[i]; + if (sum != 0) + continue; + if (check->fields.revision != 0) { + printf("pcibios_init : unsupported revision %d at %#X, mail drew@colorado.edu\n", + check->fields.revision, check); + continue; + } +#if DEBUG + printf("pcibios_init : BIOS32 Service Directory " + "structure at %#X\n", check); +#endif + if (!bios32_entry) { + if (check->fields.entry >= 0x100000) { + printf("pcibios_init: entry in high " + "memory, giving up\n"); + return; + } else { + bios32_entry = check->fields.entry; +#if DEBUG + printf("pcibios_init : BIOS32 Service Directory" + " entry at %#X\n", bios32_entry); +#endif + bios32_indirect.address = bios32_entry; + } + } + } + if (bios32_entry) + check_pcibios(); + LeaveFunction("pcibios_init"); +} + +#endif /* CONFIG_PCI_DIRECT not defined*/ + +unsigned long pcibios_bus_base(unsigned int bus __unused) +{ + /* architecturally this must be 0 */ + return 0; +} + +void find_pci(int type, struct pci_device *dev) +{ + EnterFunction("find_pci"); +#ifndef CONFIG_PCI_DIRECT + if (!pcibios_entry) { + pcibios_init(); + } + if (!pcibios_entry) { + printf("pci_init: no BIOS32 detected\n"); + return; + } +#endif + LeaveFunction("find_pci"); + return scan_pci_bus(type, dev); +} diff --git a/usr/src/grub/grub-0.97/netboot/pcnet32.c b/usr/src/grub/grub-0.97/netboot/pcnet32.c new file mode 100644 index 0000000000..f7bd1f6d10 --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/pcnet32.c @@ -0,0 +1,1004 @@ +/************************************************************************** +* +* pcnet32.c -- Etherboot device driver for the AMD PCnet32 +* Written 2003-2003 by Timothy Legge +* +* 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. +* +* Portions of this code based on: +* pcnet32.c: An AMD PCnet32 ethernet driver for linux: +* +* (C) 1996-1999 Thomas Bogendoerfer +* See Linux Driver for full information +* +* The transmit and poll functions were written with reference to: +* lance.c - LANCE NIC driver for Etherboot written by Ken Yap +* +* Linux Driver Version 1.27a, 10.02.2002 +* +* +* REVISION HISTORY: +* ================ +* v1.0 08-06-2003 timlegge Initial port of Linux driver +* v1.1 08-23-2003 timlegge Add multicast support +* v1.2 01-17-2004 timlegge Initial driver output cleanup +* v1.3 03-29-2004 timlegge More driver cleanup +* +* Indent Options: indent -kr -i8 +***************************************************************************/ + +/* to get some global routines like printf */ +#include "etherboot.h" +/* to get the interface to the body of the program */ +#include "nic.h" +/* to get the PCI support functions, if this is a PCI NIC */ +#include "pci.h" +/* Include the time functions */ +#include "timer.h" +#include "mii.h" +/* void hex_dump(const char *data, const unsigned int len); */ + +/* Etherboot Specific definations */ +#define drv_version "v1.3" +#define drv_date "03-29-2004" + +typedef unsigned char u8; +typedef signed char s8; +typedef unsigned short u16; +typedef signed short s16; +typedef unsigned int u32; +typedef signed int s32; + +static u32 ioaddr; /* Globally used for the card's io address */ + +#ifdef EDEBUG +#define dprintf(x) printf x +#else +#define dprintf(x) +#endif + +/* Condensed operations for readability. */ +#define virt_to_le32desc(addr) cpu_to_le32(virt_to_bus(addr)) +#define le32desc_to_virt(addr) bus_to_virt(le32_to_cpu(addr)) + +/* End Etherboot Specific */ + +int cards_found /* __initdata */ ; + +#ifdef REMOVE +/* FIXME: Remove these they are probably pointless */ + +/* + * VLB I/O addresses + */ +static unsigned int pcnet32_portlist[] /*__initdata */ = +{ 0x300, 0x320, 0x340, 0x360, 0 }; + +static int pcnet32_debug = 1; +static int tx_start = 1; /* Mapping -- 0:20, 1:64, 2:128, 3:~220 (depends on chip vers) */ +static int pcnet32vlb; /* check for VLB cards ? */ + +static struct net_device *pcnet32_dev; + +static int max_interrupt_work = 80; +static int rx_copybreak = 200; +#endif +#define PCNET32_PORT_AUI 0x00 +#define PCNET32_PORT_10BT 0x01 +#define PCNET32_PORT_GPSI 0x02 +#define PCNET32_PORT_MII 0x03 + +#define PCNET32_PORT_PORTSEL 0x03 +#define PCNET32_PORT_ASEL 0x04 +#define PCNET32_PORT_100 0x40 +#define PCNET32_PORT_FD 0x80 + +#define PCNET32_DMA_MASK 0xffffffff + +/* + * table to translate option values from tulip + * to internal options + */ +static unsigned char options_mapping[] = { + PCNET32_PORT_ASEL, /* 0 Auto-select */ + PCNET32_PORT_AUI, /* 1 BNC/AUI */ + PCNET32_PORT_AUI, /* 2 AUI/BNC */ + PCNET32_PORT_ASEL, /* 3 not supported */ + PCNET32_PORT_10BT | PCNET32_PORT_FD, /* 4 10baseT-FD */ + PCNET32_PORT_ASEL, /* 5 not supported */ + PCNET32_PORT_ASEL, /* 6 not supported */ + PCNET32_PORT_ASEL, /* 7 not supported */ + PCNET32_PORT_ASEL, /* 8 not supported */ + PCNET32_PORT_MII, /* 9 MII 10baseT */ + PCNET32_PORT_MII | PCNET32_PORT_FD, /* 10 MII 10baseT-FD */ + PCNET32_PORT_MII, /* 11 MII (autosel) */ + PCNET32_PORT_10BT, /* 12 10BaseT */ + PCNET32_PORT_MII | PCNET32_PORT_100, /* 13 MII 100BaseTx */ + PCNET32_PORT_MII | PCNET32_PORT_100 | PCNET32_PORT_FD, /* 14 MII 100BaseTx-FD */ + PCNET32_PORT_ASEL /* 15 not supported */ +}; + +#define MAX_UNITS 8 /* More are supported, limit only on options */ +static int options[MAX_UNITS]; +static int full_duplex[MAX_UNITS]; + +/* + * Theory of Operation + * + * This driver uses the same software structure as the normal lance + * driver. So look for a verbose description in lance.c. The differences + * to the normal lance driver is the use of the 32bit mode of PCnet32 + * and PCnetPCI chips. Because these chips are 32bit chips, there is no + * 16MB limitation and we don't need bounce buffers. + */ + + + +/* + * Set the number of Tx and Rx buffers, using Log_2(# buffers). + * Reasonable default values are 4 Tx buffers, and 16 Rx buffers. + * That translates to 2 (4 == 2^^2) and 4 (16 == 2^^4). + */ +#ifndef PCNET32_LOG_TX_BUFFERS +#define PCNET32_LOG_TX_BUFFERS 1 +#define PCNET32_LOG_RX_BUFFERS 2 +#endif + +#define TX_RING_SIZE (1 << (PCNET32_LOG_TX_BUFFERS)) +#define TX_RING_MOD_MASK (TX_RING_SIZE - 1) +/* FIXME: Fix this to allow multiple tx_ring descriptors */ +#define TX_RING_LEN_BITS 0x0000 /*PCNET32_LOG_TX_BUFFERS) << 12) */ + +#define RX_RING_SIZE (1 << (PCNET32_LOG_RX_BUFFERS)) +#define RX_RING_MOD_MASK (RX_RING_SIZE - 1) +#define RX_RING_LEN_BITS ((PCNET32_LOG_RX_BUFFERS) << 4) + +#define PKT_BUF_SZ 1544 + +/* Offsets from base I/O address. */ +#define PCNET32_WIO_RDP 0x10 +#define PCNET32_WIO_RAP 0x12 +#define PCNET32_WIO_RESET 0x14 +#define PCNET32_WIO_BDP 0x16 + +#define PCNET32_DWIO_RDP 0x10 +#define PCNET32_DWIO_RAP 0x14 +#define PCNET32_DWIO_RESET 0x18 +#define PCNET32_DWIO_BDP 0x1C + +#define PCNET32_TOTAL_SIZE 0x20 + +/* Buffers for the tx and Rx */ + +/* Create a static buffer of size PKT_BUF_SZ for each +TX Descriptor. All descriptors point to a +part of this buffer */ +static unsigned char txb[PKT_BUF_SZ * TX_RING_SIZE]; +// __attribute__ ((aligned(16))); + +/* Create a static buffer of size PKT_BUF_SZ for each +RX Descriptor All descriptors point to a +part of this buffer */ +static unsigned char rxb[RX_RING_SIZE * PKT_BUF_SZ]; +// __attribute__ ((aligned(16))); + +/* The PCNET32 Rx and Tx ring descriptors. */ +struct pcnet32_rx_head { + u32 base; + s16 buf_length; + s16 status; + u32 msg_length; + u32 reserved; +}; + +struct pcnet32_tx_head { + u32 base; + s16 length; + s16 status; + u32 misc; + u32 reserved; +}; + +/* The PCNET32 32-Bit initialization block, described in databook. */ +struct pcnet32_init_block { + u16 mode; + u16 tlen_rlen; + u8 phys_addr[6]; + u16 reserved; + u32 filter[2]; + /* Receive and transmit ring base, along with extra bits. */ + u32 rx_ring; + u32 tx_ring; +}; +/* PCnet32 access functions */ +struct pcnet32_access { + u16(*read_csr) (unsigned long, int); + void (*write_csr) (unsigned long, int, u16); + u16(*read_bcr) (unsigned long, int); + void (*write_bcr) (unsigned long, int, u16); + u16(*read_rap) (unsigned long); + void (*write_rap) (unsigned long, u16); + void (*reset) (unsigned long); +}; + +/* Define the TX Descriptor */ +static struct pcnet32_tx_head tx_ring[TX_RING_SIZE] + __attribute__ ((aligned(16))); + + +/* Define the RX Descriptor */ +static struct pcnet32_rx_head rx_ring[RX_RING_SIZE] + __attribute__ ((aligned(16))); + +/* May need to be moved to mii.h */ +struct mii_if_info { + int phy_id; + int advertising; + unsigned int full_duplex:1; /* is full duplex? */ +}; + +/* + * The first three fields of pcnet32_private are read by the ethernet device + * so we allocate the structure should be allocated by pci_alloc_consistent(). + */ +#define MII_CNT 4 +struct pcnet32_private { + struct pcnet32_init_block init_block; + struct pci_dev *pci_dev; /* Pointer to the associated pci device structure */ + const char *name; + /* The saved address of a sent-in-place packet/buffer, for skfree(). */ + struct sk_buff *tx_skbuff[TX_RING_SIZE]; + struct sk_buff *rx_skbuff[RX_RING_SIZE]; + struct pcnet32_access a; + unsigned int cur_rx, cur_tx; /* The next free ring entry */ + char tx_full; + int options; + int shared_irq:1, /* shared irq possible */ + ltint:1, /* enable TxDone-intr inhibitor */ + dxsuflo:1, /* disable transmit stop on uflo */ + mii:1; /* mii port available */ + struct mii_if_info mii_if; + unsigned char phys[MII_CNT]; + struct net_device *next; + int full_duplex:1; +} lpx; + +static struct pcnet32_private *lp; + +static int mdio_read(struct nic *nic __unused, int phy_id, int reg_num); +#if 0 +static void mdio_write(struct nic *nic __unused, int phy_id, int reg_num, + int val); +#endif +enum pci_flags_bit { + PCI_USES_IO = 1, PCI_USES_MEM = 2, PCI_USES_MASTER = 4, + PCI_ADDR0 = 0x10 << 0, PCI_ADDR1 = 0x10 << 1, PCI_ADDR2 = + 0x10 << 2, PCI_ADDR3 = 0x10 << 3, +}; + + +static u16 pcnet32_wio_read_csr(unsigned long addr, int index) +{ + outw(index, addr + PCNET32_WIO_RAP); + return inw(addr + PCNET32_WIO_RDP); +} + +static void pcnet32_wio_write_csr(unsigned long addr, int index, u16 val) +{ + outw(index, addr + PCNET32_WIO_RAP); + outw(val, addr + PCNET32_WIO_RDP); +} + +static u16 pcnet32_wio_read_bcr(unsigned long addr, int index) +{ + outw(index, addr + PCNET32_WIO_RAP); + return inw(addr + PCNET32_WIO_BDP); +} + +static void pcnet32_wio_write_bcr(unsigned long addr, int index, u16 val) +{ + outw(index, addr + PCNET32_WIO_RAP); + outw(val, addr + PCNET32_WIO_BDP); +} + +static u16 pcnet32_wio_read_rap(unsigned long addr) +{ + return inw(addr + PCNET32_WIO_RAP); +} + +static void pcnet32_wio_write_rap(unsigned long addr, u16 val) +{ + outw(val, addr + PCNET32_WIO_RAP); +} + +static void pcnet32_wio_reset(unsigned long addr) +{ + inw(addr + PCNET32_WIO_RESET); +} + +static int pcnet32_wio_check(unsigned long addr) +{ + outw(88, addr + PCNET32_WIO_RAP); + return (inw(addr + PCNET32_WIO_RAP) == 88); +} + +static struct pcnet32_access pcnet32_wio = { + read_csr:pcnet32_wio_read_csr, + write_csr:pcnet32_wio_write_csr, + read_bcr:pcnet32_wio_read_bcr, + write_bcr:pcnet32_wio_write_bcr, + read_rap:pcnet32_wio_read_rap, + write_rap:pcnet32_wio_write_rap, + reset:pcnet32_wio_reset +}; + +static u16 pcnet32_dwio_read_csr(unsigned long addr, int index) +{ + outl(index, addr + PCNET32_DWIO_RAP); + return (inl(addr + PCNET32_DWIO_RDP) & 0xffff); +} + +static void pcnet32_dwio_write_csr(unsigned long addr, int index, u16 val) +{ + outl(index, addr + PCNET32_DWIO_RAP); + outl(val, addr + PCNET32_DWIO_RDP); +} + +static u16 pcnet32_dwio_read_bcr(unsigned long addr, int index) +{ + outl(index, addr + PCNET32_DWIO_RAP); + return (inl(addr + PCNET32_DWIO_BDP) & 0xffff); +} + +static void pcnet32_dwio_write_bcr(unsigned long addr, int index, u16 val) +{ + outl(index, addr + PCNET32_DWIO_RAP); + outl(val, addr + PCNET32_DWIO_BDP); +} + +static u16 pcnet32_dwio_read_rap(unsigned long addr) +{ + return (inl(addr + PCNET32_DWIO_RAP) & 0xffff); +} + +static void pcnet32_dwio_write_rap(unsigned long addr, u16 val) +{ + outl(val, addr + PCNET32_DWIO_RAP); +} + +static void pcnet32_dwio_reset(unsigned long addr) +{ + inl(addr + PCNET32_DWIO_RESET); +} + +static int pcnet32_dwio_check(unsigned long addr) +{ + outl(88, addr + PCNET32_DWIO_RAP); + return ((inl(addr + PCNET32_DWIO_RAP) & 0xffff) == 88); +} + +static struct pcnet32_access pcnet32_dwio = { + read_csr:pcnet32_dwio_read_csr, + write_csr:pcnet32_dwio_write_csr, + read_bcr:pcnet32_dwio_read_bcr, + write_bcr:pcnet32_dwio_write_bcr, + read_rap:pcnet32_dwio_read_rap, + write_rap:pcnet32_dwio_write_rap, + reset:pcnet32_dwio_reset +}; + + +/* Initialize the PCNET32 Rx and Tx rings. */ +static int pcnet32_init_ring(struct nic *nic) +{ + int i; + + lp->tx_full = 0; + lp->cur_rx = lp->cur_tx = 0; + + for (i = 0; i < RX_RING_SIZE; i++) { + rx_ring[i].base = (u32) virt_to_le32desc(&rxb[i]); + rx_ring[i].buf_length = le16_to_cpu(-PKT_BUF_SZ); + rx_ring[i].status = le16_to_cpu(0x8000); + } + + /* The Tx buffer address is filled in as needed, but we do need to clear + the upper ownership bit. */ + for (i = 0; i < TX_RING_SIZE; i++) { + tx_ring[i].base = 0; + tx_ring[i].status = 0; + } + + + lp->init_block.tlen_rlen = + le16_to_cpu(TX_RING_LEN_BITS | RX_RING_LEN_BITS); + for (i = 0; i < 6; i++) + lp->init_block.phys_addr[i] = nic->node_addr[i]; + lp->init_block.rx_ring = (u32) virt_to_le32desc(&rx_ring[0]); + lp->init_block.tx_ring = (u32) virt_to_le32desc(&tx_ring[0]); + return 0; +} + +/************************************************************************** +RESET - Reset adapter +***************************************************************************/ +static void pcnet32_reset(struct nic *nic) +{ + /* put the card in its initial state */ + u16 val; + int i; + + /* Reset the PCNET32 */ + lp->a.reset(ioaddr); + + /* switch pcnet32 to 32bit mode */ + lp->a.write_bcr(ioaddr, 20, 2); + + /* set/reset autoselect bit */ + val = lp->a.read_bcr(ioaddr, 2) & ~2; + if (lp->options & PCNET32_PORT_ASEL) + val |= 2; + lp->a.write_bcr(ioaddr, 2, val); + /* handle full duplex setting */ + if (lp->full_duplex) { + val = lp->a.read_bcr(ioaddr, 9) & ~3; + if (lp->options & PCNET32_PORT_FD) { + val |= 1; + if (lp->options == + (PCNET32_PORT_FD | PCNET32_PORT_AUI)) + val |= 2; + } else if (lp->options & PCNET32_PORT_ASEL) { + /* workaround of xSeries250, turn on for 79C975 only */ + i = ((lp->a. + read_csr(ioaddr, + 88) | (lp->a.read_csr(ioaddr, + 89) << 16)) >> + 12) & 0xffff; + if (i == 0x2627) + val |= 3; + } + lp->a.write_bcr(ioaddr, 9, val); + } + + /* set/reset GPSI bit in test register */ + val = lp->a.read_csr(ioaddr, 124) & ~0x10; + if ((lp->options & PCNET32_PORT_PORTSEL) == PCNET32_PORT_GPSI) + val |= 0x10; + lp->a.write_csr(ioaddr, 124, val); + + if (lp->mii && !(lp->options & PCNET32_PORT_ASEL)) { + val = lp->a.read_bcr(ioaddr, 32) & ~0x38; /* disable Auto Negotiation, set 10Mpbs, HD */ + if (lp->options & PCNET32_PORT_FD) + val |= 0x10; + if (lp->options & PCNET32_PORT_100) + val |= 0x08; + lp->a.write_bcr(ioaddr, 32, val); + } else { + if (lp->options & PCNET32_PORT_ASEL) { /* enable auto negotiate, setup, disable fd */ + val = lp->a.read_bcr(ioaddr, 32) & ~0x98; + val |= 0x20; + lp->a.write_bcr(ioaddr, 32, val); + } + } + +#ifdef DO_DXSUFLO + if (lp->dxsuflo) { /* Disable transmit stop on underflow */ + val = lp->a.read_csr(ioaddr, 3); + val |= 0x40; + lp->a.write_csr(ioaddr, 3, val); + } +#endif + + if (lp->ltint) { /* Enable TxDone-intr inhibitor */ + val = lp->a.read_csr(ioaddr, 5); + val |= (1 << 14); + lp->a.write_csr(ioaddr, 5, val); + } + lp->init_block.mode = + le16_to_cpu((lp->options & PCNET32_PORT_PORTSEL) << 7); + lp->init_block.filter[0] = 0xffffffff; + lp->init_block.filter[1] = 0xffffffff; + + pcnet32_init_ring(nic); + + + /* Re-initialize the PCNET32, and start it when done. */ + lp->a.write_csr(ioaddr, 1, + (virt_to_bus(&lp->init_block)) & 0xffff); + lp->a.write_csr(ioaddr, 2, (virt_to_bus(&lp->init_block)) >> 16); + lp->a.write_csr(ioaddr, 4, 0x0915); + lp->a.write_csr(ioaddr, 0, 0x0001); + + + i = 0; + while (i++ < 100) + if (lp->a.read_csr(ioaddr, 0) & 0x0100) + break; + /* + * We used to clear the InitDone bit, 0x0100, here but Mark Stockton + * reports that doing so triggers a bug in the '974. + */ + lp->a.write_csr(ioaddr, 0, 0x0042); + + dprintf(("pcnet32 open, csr0 %hX.\n", lp->a.read_csr(ioaddr, 0))); + +} + +/************************************************************************** +POLL - Wait for a frame +***************************************************************************/ +static int pcnet32_poll(struct nic *nic __unused, int retrieve) +{ + /* return true if there's an ethernet packet ready to read */ + /* nic->packet should contain data on return */ + /* nic->packetlen should contain length of data */ + + int status; + int entry; + + entry = lp->cur_rx & RX_RING_MOD_MASK; + status = ((short) le16_to_cpu(rx_ring[entry].status) >> 8); + + if (status < 0) + return 0; + + if ( ! retrieve ) return 1; + + if (status == 0x03) { + nic->packetlen = + (le32_to_cpu(rx_ring[entry].msg_length) & 0xfff) - 4; + memcpy(nic->packet, &rxb[entry], nic->packetlen); + + /* Andrew Boyd of QNX reports that some revs of the 79C765 + * clear the buffer length */ + rx_ring[entry].buf_length = le16_to_cpu(-PKT_BUF_SZ); + rx_ring[entry].status |= le16_to_cpu(0x8000); /* prime for next receive */ + /* Switch to the next Rx ring buffer */ + lp->cur_rx++; + + } else { + return 0; + } + + return 1; +} + +/************************************************************************** +TRANSMIT - Transmit a frame +***************************************************************************/ +static void pcnet32_transmit(struct nic *nic __unused, const char *d, /* Destination */ + unsigned int t, /* Type */ + unsigned int s, /* size */ + const char *p) +{ /* Packet */ + /* send the packet to destination */ + unsigned long time; + u8 *ptxb; + u16 nstype; + u16 status; + int entry = 0; /*lp->cur_tx & TX_RING_MOD_MASK; */ + + status = 0x8300; + /* point to the current txb incase multiple tx_rings are used */ + ptxb = txb + (lp->cur_tx * PKT_BUF_SZ); + + /* copy the packet to ring buffer */ + memcpy(ptxb, d, ETH_ALEN); /* dst */ + memcpy(ptxb + ETH_ALEN, nic->node_addr, ETH_ALEN); /* src */ + nstype = htons((u16) t); /* type */ + memcpy(ptxb + 2 * ETH_ALEN, (u8 *) & nstype, 2); /* type */ + memcpy(ptxb + ETH_HLEN, p, s); + + s += ETH_HLEN; + while (s < ETH_ZLEN) /* pad to min length */ + ptxb[s++] = '\0'; + + tx_ring[entry].length = le16_to_cpu(-s); + tx_ring[entry].misc = 0x00000000; + tx_ring[entry].base = (u32) virt_to_le32desc(ptxb); + + /* we set the top byte as the very last thing */ + tx_ring[entry].status = le16_to_cpu(status); + + + /* Trigger an immediate send poll */ + lp->a.write_csr(ioaddr, 0, 0x0048); + + /* wait for transmit complete */ + lp->cur_tx = 0; /* (lp->cur_tx + 1); */ + time = currticks() + TICKS_PER_SEC; /* wait one second */ + while (currticks() < time && + ((short) le16_to_cpu(tx_ring[entry].status) < 0)); + + if ((short) le16_to_cpu(tx_ring[entry].status) < 0) + printf("PCNET32 timed out on transmit\n"); + + /* Stop pointing at the current txb + * otherwise the card continues to send the packet */ + tx_ring[entry].base = 0; + +} + +/************************************************************************** +DISABLE - Turn off ethernet interface +***************************************************************************/ +static void pcnet32_disable(struct dev *dev __unused) +{ + /* Stop the PCNET32 here -- it ocassionally polls memory if we don't */ + lp->a.write_csr(ioaddr, 0, 0x0004); + + /* + * Switch back to 16-bit mode to avoid problesm with dumb + * DOS packet driver after a warm reboot + */ + lp->a.write_bcr(ioaddr, 20, 4); +} + +/************************************************************************** +IRQ - Enable, Disable, or Force interrupts +***************************************************************************/ +static void pcnet32_irq(struct nic *nic __unused, irq_action_t action __unused) +{ + switch ( action ) { + case DISABLE : + break; + case ENABLE : + break; + case FORCE : + break; + } +} + +/************************************************************************** +PROBE - Look for an adapter, this routine's visible to the outside +You should omit the last argument struct pci_device * for a non-PCI NIC +***************************************************************************/ +static int pcnet32_probe(struct dev *dev, struct pci_device *pci) +{ + struct nic *nic = (struct nic *) dev; + int i, media; + int fdx, mii, fset, dxsuflo, ltint; + int chip_version; + char *chipname; + struct pcnet32_access *a = NULL; + u8 promaddr[6]; + + int shared = 1; + if (pci->ioaddr == 0) + return 0; + + /* BASE is used throughout to address the card */ + ioaddr = pci->ioaddr; + printf("pcnet32.c: Found %s, Vendor=0x%hX Device=0x%hX\n", + pci->name, pci->vendor, pci->dev_id); + + nic->irqno = 0; + nic->ioaddr = pci->ioaddr & ~3; + + /* reset the chip */ + pcnet32_wio_reset(ioaddr); + + /* NOTE: 16-bit check is first, otherwise some older PCnet chips fail */ + if (pcnet32_wio_read_csr(ioaddr, 0) == 4 + && pcnet32_wio_check(ioaddr)) { + a = &pcnet32_wio; + } else { + pcnet32_dwio_reset(ioaddr); + if (pcnet32_dwio_read_csr(ioaddr, 0) == 4 + && pcnet32_dwio_check(ioaddr)) { + a = &pcnet32_dwio; + } else + return 0; + } + + chip_version = + a->read_csr(ioaddr, 88) | (a->read_csr(ioaddr, 89) << 16); + + dprintf(("PCnet chip version is %0xhX\n", chip_version)); + if ((chip_version & 0xfff) != 0x003) + return 0; + + /* initialize variables */ + fdx = mii = fset = dxsuflo = ltint = 0; + chip_version = (chip_version >> 12) & 0xffff; + + switch (chip_version) { + case 0x2420: + chipname = "PCnet/PCI 79C970"; /* PCI */ + break; + case 0x2430: + if (shared) + chipname = "PCnet/PCI 79C970"; /* 970 gives the wrong chip id back */ + else + chipname = "PCnet/32 79C965"; /* 486/VL bus */ + break; + case 0x2621: + chipname = "PCnet/PCI II 79C970A"; /* PCI */ + fdx = 1; + break; + case 0x2623: + chipname = "PCnet/FAST 79C971"; /* PCI */ + fdx = 1; + mii = 1; + fset = 1; + ltint = 1; + break; + case 0x2624: + chipname = "PCnet/FAST+ 79C972"; /* PCI */ + fdx = 1; + mii = 1; + fset = 1; + break; + case 0x2625: + chipname = "PCnet/FAST III 79C973"; /* PCI */ + fdx = 1; + mii = 1; + break; + case 0x2626: + chipname = "PCnet/Home 79C978"; /* PCI */ + fdx = 1; + /* + * This is based on specs published at www.amd.com. This section + * assumes that a card with a 79C978 wants to go into 1Mb HomePNA + * mode. The 79C978 can also go into standard ethernet, and there + * probably should be some sort of module option to select the + * mode by which the card should operate + */ + /* switch to home wiring mode */ + media = a->read_bcr(ioaddr, 49); + + printf("media reset to %#x.\n", media); + a->write_bcr(ioaddr, 49, media); + break; + case 0x2627: + chipname = "PCnet/FAST III 79C975"; /* PCI */ + fdx = 1; + mii = 1; + break; + default: + printf("PCnet version %#x, no PCnet32 chip.\n", + chip_version); + return 0; + } + + /* + * On selected chips turn on the BCR18:NOUFLO bit. This stops transmit + * starting until the packet is loaded. Strike one for reliability, lose + * one for latency - although on PCI this isnt a big loss. Older chips + * have FIFO's smaller than a packet, so you can't do this. + */ + + if (fset) { + a->write_bcr(ioaddr, 18, + (a->read_bcr(ioaddr, 18) | 0x0800)); + a->write_csr(ioaddr, 80, + (a->read_csr(ioaddr, 80) & 0x0C00) | 0x0c00); + dxsuflo = 1; + ltint = 1; + } + + dprintf(("%s at %hX,", chipname, ioaddr)); + + /* read PROM address */ + for (i = 0; i < 6; i++) + promaddr[i] = inb(ioaddr + i); + + /* Update the nic structure with the MAC Address */ + for (i = 0; i < ETH_ALEN; i++) { + nic->node_addr[i] = promaddr[i]; + } + /* Print out some hardware info */ + printf("%s: %! at ioaddr %hX, ", pci->name, nic->node_addr, + ioaddr); + + /* Set to pci bus master */ + adjust_pci_device(pci); + + /* point to private storage */ + lp = &lpx; + +#if EBDEBUG + if (((chip_version + 1) & 0xfffe) == 0x2624) { /* Version 0x2623 or 0x2624 */ + i = a->read_csr(ioaddr, 80) & 0x0C00; /* Check tx_start_pt */ + dprintf((" tx_start_pt(0x%hX):", i)); + switch (i >> 10) { + case 0: + dprintf((" 20 bytes,")); + break; + case 1: + dprintf((" 64 bytes,")); + break; + case 2: + dprintf((" 128 bytes,")); + break; + case 3: + dprintf(("~220 bytes,")); + break; + } + i = a->read_bcr(ioaddr, 18); /* Check Burst/Bus control */ + dprintf((" BCR18(%hX):", i & 0xffff)); + if (i & (1 << 5)) + dprintf(("BurstWrEn ")); + if (i & (1 << 6)) + dprintf(("BurstRdEn ")); + if (i & (1 << 7)) + dprintf(("DWordIO ")); + if (i & (1 << 11)) + dprintf(("NoUFlow ")); + i = a->read_bcr(ioaddr, 25); + dprintf((" SRAMSIZE=0x%hX,", i << 8)); + i = a->read_bcr(ioaddr, 26); + dprintf((" SRAM_BND=0x%hX,", i << 8)); + i = a->read_bcr(ioaddr, 27); + if (i & (1 << 14)) + dprintf(("LowLatRx")); + } +#endif + lp->name = chipname; + lp->shared_irq = shared; + lp->full_duplex = fdx; + lp->dxsuflo = dxsuflo; + lp->ltint = ltint; + lp->mii = mii; + /* FIXME: Fix Options for only one card */ + if ((cards_found >= MAX_UNITS) + || ((unsigned int) options[cards_found] > sizeof(options_mapping))) + lp->options = PCNET32_PORT_ASEL; + else + lp->options = options_mapping[options[cards_found]]; + + if (fdx && !(lp->options & PCNET32_PORT_ASEL) && + ((cards_found >= MAX_UNITS) || full_duplex[cards_found])) + lp->options |= PCNET32_PORT_FD; + + if (!a) { + printf("No access methods\n"); + return 0; + } + lp->a = *a; + + /* detect special T1/E1 WAN card by checking for MAC address */ + if (nic->node_addr[0] == 0x00 && nic->node_addr[1] == 0xe0 + && nic->node_addr[2] == 0x75) + lp->options = PCNET32_PORT_FD | PCNET32_PORT_GPSI; + + lp->init_block.mode = le16_to_cpu(0x0003); /* Disable Rx and Tx. */ + lp->init_block.tlen_rlen = + le16_to_cpu(TX_RING_LEN_BITS | RX_RING_LEN_BITS); + for (i = 0; i < 6; i++) + lp->init_block.phys_addr[i] = nic->node_addr[i]; + lp->init_block.filter[0] = 0xffffffff; + lp->init_block.filter[1] = 0xffffffff; + lp->init_block.rx_ring = virt_to_bus(&rx_ring); + lp->init_block.tx_ring = virt_to_bus(&tx_ring); + + /* switch pcnet32 to 32bit mode */ + a->write_bcr(ioaddr, 20, 2); + + + a->write_csr(ioaddr, 1, (virt_to_bus(&lp->init_block)) & 0xffff); + a->write_csr(ioaddr, 2, (virt_to_bus(&lp->init_block)) >> 16); + + /* + * To auto-IRQ we enable the initialization-done and DMA error + * interrupts. For ISA boards we get a DMA error, but VLB and PCI + * boards will work. + */ + /* Trigger an initialization just for the interrupt. */ + + a->write_csr(ioaddr, 0, 0x41); + mdelay(1); + + cards_found++; + + /* point to NIC specific routines */ + pcnet32_reset(nic); + if (1) { + int tmp; + int phy, phy_idx = 0; + u16 mii_lpa; + lp->phys[0] = 1; /* Default Setting */ + for (phy = 1; phy < 32 && phy_idx < MII_CNT; phy++) { + int mii_status = mdio_read(nic, phy, MII_BMSR); + if (mii_status != 0xffff && mii_status != 0x0000) { + lp->phys[phy_idx++] = phy; + lp->mii_if.advertising = + mdio_read(nic, phy, MII_ADVERTISE); + if ((mii_status & 0x0040) == 0) { + tmp = phy; + dprintf (("MII PHY found at address %d, status " + "%hX advertising %hX\n", phy, mii_status, + lp->mii_if.advertising)); + } + } + } + if (phy_idx == 0) + printf("No MII transceiver found!\n"); + lp->mii_if.phy_id = lp->phys[0]; + + lp->mii_if.advertising = + mdio_read(nic, lp->phys[0], MII_ADVERTISE); + + mii_lpa = mdio_read(nic, lp->phys[0], MII_LPA); + lp->mii_if.advertising &= mii_lpa; + if (lp->mii_if.advertising & ADVERTISE_100FULL) + printf("100Mbps Full-Duplex\n"); + else if (lp->mii_if.advertising & ADVERTISE_100HALF) + printf("100Mbps Half-Duplex\n"); + else if (lp->mii_if.advertising & ADVERTISE_10FULL) + printf("10Mbps Full-Duplex\n"); + else if (lp->mii_if.advertising & ADVERTISE_10HALF) + printf("10Mbps Half-Duplex\n"); + else + printf("\n"); + } + + nic->poll = pcnet32_poll; + nic->transmit = pcnet32_transmit; + dev->disable = pcnet32_disable; + nic->irq = pcnet32_irq; + + return 1; +} +static int mdio_read(struct nic *nic __unused, int phy_id, int reg_num) +{ + u16 val_out; + int phyaddr; + + if (!lp->mii) + return 0; + + phyaddr = lp->a.read_bcr(ioaddr, 33); + + lp->a.write_bcr(ioaddr, 33, + ((phy_id & 0x1f) << 5) | (reg_num & 0x1f)); + val_out = lp->a.read_bcr(ioaddr, 34); + lp->a.write_bcr(ioaddr, 33, phyaddr); + + return val_out; +} + +#if 0 +static void mdio_write(struct nic *nic __unused, int phy_id, int reg_num, + int val) +{ + int phyaddr; + + if (!lp->mii) + return; + + phyaddr = lp->a.read_bcr(ioaddr, 33); + + lp->a.write_bcr(ioaddr, 33, + ((phy_id & 0x1f) << 5) | (reg_num & 0x1f)); + lp->a.write_bcr(ioaddr, 34, val); + lp->a.write_bcr(ioaddr, 33, phyaddr); +} +#endif + +static struct pci_id pcnet32_nics[] = { + PCI_ROM(0x1022, 0x2000, "lancepci", "AMD Lance/PCI"), + PCI_ROM(0x1022, 0x2625, "pcnetfastiii", "AMD Lance/PCI PCNet/32"), + PCI_ROM(0x1022, 0x2001, "amdhomepna", "AMD Lance/HomePNA"), +}; + +struct pci_driver pcnet32_driver = { + .type = NIC_DRIVER, + .name = "PCNET32/PCI", + .probe = pcnet32_probe, + .ids = pcnet32_nics, + .id_count = sizeof(pcnet32_nics) / sizeof(pcnet32_nics[0]), + .class = 0, +}; diff --git a/usr/src/grub/grub-0.97/netboot/pic8259.c b/usr/src/grub/grub-0.97/netboot/pic8259.c new file mode 100644 index 0000000000..25002d9b82 --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/pic8259.c @@ -0,0 +1,205 @@ +/* + * Basic support for controlling the 8259 Programmable Interrupt Controllers. + * + * Initially written by Michael Brown (mcb30). + */ + +#include +#include + +#ifdef DEBUG_IRQ +#define DBG(...) printf ( __VA_ARGS__ ) +#else +#define DBG(...) +#endif + +/* Install a handler for the specified IRQ. Address of previous + * handler will be stored in previous_handler. Enabled/disabled state + * of IRQ will be preserved across call, therefore if the handler does + * chaining, ensure that either (a) IRQ is disabled before call, or + * (b) previous_handler points directly to the place that the handler + * picks up its chain-to address. + */ + +int install_irq_handler ( irq_t irq, segoff_t *handler, + uint8_t *previously_enabled, + segoff_t *previous_handler ) { + segoff_t *irq_vector = IRQ_VECTOR ( irq ); + *previously_enabled = irq_enabled ( irq ); + + if ( irq > IRQ_MAX ) { + DBG ( "Invalid IRQ number %d\n" ); + return 0; + } + + previous_handler->segment = irq_vector->segment; + previous_handler->offset = irq_vector->offset; + if ( *previously_enabled ) disable_irq ( irq ); + DBG ( "Installing handler at %hx:%hx for IRQ %d, leaving %s\n", + handler->segment, handler->offset, irq, + ( *previously_enabled ? "enabled" : "disabled" ) ); + DBG ( "...(previous handler at %hx:%hx)\n", + previous_handler->segment, previous_handler->offset ); + irq_vector->segment = handler->segment; + irq_vector->offset = handler->offset; + if ( *previously_enabled ) enable_irq ( irq ); + return 1; +} + +/* Remove handler for the specified IRQ. Routine checks that another + * handler has not been installed that chains to handler before + * uninstalling handler. Enabled/disabled state of the IRQ will be + * restored to that specified by previously_enabled. + */ + +int remove_irq_handler ( irq_t irq, segoff_t *handler, + uint8_t *previously_enabled, + segoff_t *previous_handler ) { + segoff_t *irq_vector = IRQ_VECTOR ( irq ); + + if ( irq > IRQ_MAX ) { + DBG ( "Invalid IRQ number %d\n" ); + return 0; + } + if ( ( irq_vector->segment != handler->segment ) || + ( irq_vector->offset != handler->offset ) ) { + DBG ( "Cannot remove handler for IRQ %d\n" ); + return 0; + } + + DBG ( "Removing handler for IRQ %d\n", irq ); + disable_irq ( irq ); + irq_vector->segment = previous_handler->segment; + irq_vector->offset = previous_handler->offset; + if ( *previously_enabled ) enable_irq ( irq ); + return 1; +} + +/* Send specific EOI(s). + */ + +void send_specific_eoi ( irq_t irq ) { + DBG ( "Sending specific EOI for IRQ %d\n", irq ); + outb ( ICR_EOI_SPECIFIC | ICR_VALUE(irq), ICR_REG(irq) ); + if ( irq >= IRQ_PIC_CUTOFF ) { + outb ( ICR_EOI_SPECIFIC | ICR_VALUE(CHAINED_IRQ), + ICR_REG(CHAINED_IRQ) ); + } +} + +/* Dump current 8259 status: enabled IRQs and handler addresses. + */ + +#ifdef DEBUG_IRQ +void dump_irq_status (void) { + int irq = 0; + + for ( irq = 0; irq < 16; irq++ ) { + if ( irq_enabled ( irq ) ) { + printf ( "IRQ%d enabled, ISR at %hx:%hx\n", irq, + IRQ_VECTOR(irq)->segment, + IRQ_VECTOR(irq)->offset ); + } + } +} +#endif + +/******************************************************************** + * UNDI interrupt handling + * This essentially follows the defintion of the trivial interrupt + * handler routines. The text is assumed to locate in base memory. + */ +void (*undi_irq_handler)P((void)) = _undi_irq_handler; +uint16_t volatile *undi_irq_trigger_count = &_undi_irq_trigger_count; +segoff_t *undi_irq_chain_to = &_undi_irq_chain_to; +uint8_t *undi_irq_chain = &_undi_irq_chain; +irq_t undi_irq_installed_on = IRQ_NONE; + +/* UNDI entry point and irq, used by interrupt handler + */ +segoff_t *pxenv_undi_entrypointsp = &_pxenv_undi_entrypointsp; +uint8_t *pxenv_undi_irq = &_pxenv_undi_irq; + +/* Previous trigger count for undi IRQ handler */ +static uint16_t undi_irq_previous_trigger_count = 0; + +/* Install the undi IRQ handler. Don't test as UNDI has not be opened. + */ + +int install_undi_irq_handler ( irq_t irq, segoff_t entrypointsp ) { + segoff_t undi_irq_handler_segoff = SEGOFF(undi_irq_handler); + + if ( undi_irq_installed_on != IRQ_NONE ) { + DBG ( "Can install undi IRQ handler only once\n" ); + return 0; + } + if ( SEGMENT(undi_irq_handler) > 0xffff ) { + DBG ( "Trivial IRQ handler not in base memory\n" ); + return 0; + } + + DBG ( "Installing undi IRQ handler on IRQ %d\n", irq ); + *pxenv_undi_entrypointsp = entrypointsp; + *pxenv_undi_irq = irq; + if ( ! install_irq_handler ( irq, &undi_irq_handler_segoff, + undi_irq_chain, + undi_irq_chain_to ) ) + return 0; + undi_irq_installed_on = irq; + + DBG ( "Disabling undi IRQ %d\n", irq ); + disable_irq ( irq ); + *undi_irq_trigger_count = 0; + undi_irq_previous_trigger_count = 0; + DBG ( "UNDI IRQ handler installed successfully\n" ); + return 1; +} + +/* Remove the undi IRQ handler. + */ + +int remove_undi_irq_handler ( irq_t irq ) { + segoff_t undi_irq_handler_segoff = SEGOFF(undi_irq_handler); + + if ( undi_irq_installed_on == IRQ_NONE ) return 1; + if ( irq != undi_irq_installed_on ) { + DBG ( "Cannot uninstall undi IRQ handler from IRQ %d; " + "is installed on IRQ %d\n", irq, + undi_irq_installed_on ); + return 0; + } + + if ( ! remove_irq_handler ( irq, &undi_irq_handler_segoff, + undi_irq_chain, + undi_irq_chain_to ) ) + return 0; + + if ( undi_irq_triggered ( undi_irq_installed_on ) ) { + DBG ( "Sending EOI for unwanted undi IRQ\n" ); + send_specific_eoi ( undi_irq_installed_on ); + } + + undi_irq_installed_on = IRQ_NONE; + return 1; +} + +/* Safe method to detect whether or not undi IRQ has been + * triggered. Using this call avoids potential race conditions. This + * call will return success only once per trigger. + */ + +int undi_irq_triggered ( irq_t irq ) { + uint16_t undi_irq_this_trigger_count = *undi_irq_trigger_count; + int triggered = ( undi_irq_this_trigger_count - + undi_irq_previous_trigger_count ); + + /* irq is not used at present, but we have it in the API for + * future-proofing; in case we want the facility to have + * multiple undi IRQ handlers installed simultaneously. + * + * Avoid compiler warning about unused variable. + */ + if ( irq == IRQ_NONE ) {}; + undi_irq_previous_trigger_count = undi_irq_this_trigger_count; + return triggered ? 1 : 0; +} diff --git a/usr/src/grub/grub-0.97/netboot/pic8259.h b/usr/src/grub/grub-0.97/netboot/pic8259.h new file mode 100644 index 0000000000..76cc711a7b --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/pic8259.h @@ -0,0 +1,98 @@ +/* + * Basic support for controlling the 8259 Programmable Interrupt Controllers. + * + * Initially written by Michael Brown (mcb30). + */ + +#ifndef PIC8259_H +#define PIC8259_H + +/* For segoff_t */ +#include + +#define IRQ_PIC_CUTOFF (8) + +/* 8259 register locations */ +#define PIC1_ICW1 (0x20) +#define PIC1_OCW2 (0x20) +#define PIC1_OCW3 (0x20) +#define PIC1_ICR (0x20) +#define PIC1_IRR (0x20) +#define PIC1_ISR (0x20) +#define PIC1_ICW2 (0x21) +#define PIC1_ICW3 (0x21) +#define PIC1_ICW4 (0x21) +#define PIC1_IMR (0x21) +#define PIC2_ICW1 (0xa0) +#define PIC2_OCW2 (0xa0) +#define PIC2_OCW3 (0xa0) +#define PIC2_ICR (0xa0) +#define PIC2_IRR (0xa0) +#define PIC2_ISR (0xa0) +#define PIC2_ICW2 (0xa1) +#define PIC2_ICW3 (0xa1) +#define PIC2_ICW4 (0xa1) +#define PIC2_IMR (0xa1) + +/* Register command values */ +#define OCW3_ID (0x08) +#define OCW3_READ_IRR (0x03) +#define OCW3_READ_ISR (0x02) +#define ICR_EOI_NON_SPECIFIC (0x20) +#define ICR_EOI_NOP (0x40) +#define ICR_EOI_SPECIFIC (0x60) +#define ICR_EOI_SET_PRIORITY (0xc0) + +/* Macros to enable/disable IRQs */ +#define IMR_REG(x) ( (x) < IRQ_PIC_CUTOFF ? PIC1_IMR : PIC2_IMR ) +#define IMR_BIT(x) ( 1 << ( (x) % IRQ_PIC_CUTOFF ) ) +#define irq_enabled(x) ( ( inb ( IMR_REG(x) ) & IMR_BIT(x) ) == 0 ) +#define enable_irq(x) outb ( inb( IMR_REG(x) ) & ~IMR_BIT(x), IMR_REG(x) ) +#define disable_irq(x) outb ( inb( IMR_REG(x) ) | IMR_BIT(x), IMR_REG(x) ) + +/* Macros for acknowledging IRQs */ +#define ICR_REG(x) ( (x) < IRQ_PIC_CUTOFF ? PIC1_ICR : PIC2_ICR ) +#define ICR_VALUE(x) ( (x) % IRQ_PIC_CUTOFF ) +#define CHAINED_IRQ 2 + +/* Utility macros to convert IRQ numbers to INT numbers and INT vectors */ +#define IRQ_INT(x) ( (x)ioaddr + PNIC_REG_LEN ); + /* Write input data */ + for ( i = 0; i < input_length; i++ ) { + outb( ((char*)input)[i], nic->ioaddr + PNIC_REG_DATA ); + } + } + /* Write command */ + outw ( command, nic->ioaddr + PNIC_REG_CMD ); + /* Retrieve status */ + status = inw ( nic->ioaddr + PNIC_REG_STAT ); + /* Retrieve output length */ + _output_length = inw ( nic->ioaddr + PNIC_REG_LEN ); + if ( output_length == NULL ) { + if ( _output_length != output_max_length ) { + printf ( "pnic_command %#hx: wrong data length " + "returned (expected %d, got %d)\n", command, + output_max_length, _output_length ); + } + } else { + *output_length = _output_length; + } + if ( output != NULL ) { + if ( _output_length > output_max_length ) { + printf ( "pnic_command %#hx: output buffer too small " + "(have %d, need %d)\n", command, + output_max_length, _output_length ); + _output_length = output_max_length; + } + /* Retrieve output data */ + for ( i = 0; i < _output_length; i++ ) { + ((char*)output)[i] = + inb ( nic->ioaddr + PNIC_REG_DATA ); + } + } + return status; +} + +static uint16_t pnic_command ( struct nic *nic, uint16_t command, + void *input, uint16_t input_length, + void *output, uint16_t output_max_length, + uint16_t *output_length ) { + pnic_priv_data_t *priv = (pnic_priv_data_t*)nic->priv_data; + uint16_t status = pnic_command_quiet ( nic, command, + input, input_length, + output, output_max_length, + output_length ); + if ( status == PNIC_STATUS_OK ) return status; + printf ( "PNIC command %#hx (len %#hx) failed with status %#hx\n", + command, input_length, status ); + if ( priv->api_version ) pnic_api_check(priv->api_version); + return status; +} + +/* Check API version matches that of NIC */ +static int pnic_api_check ( uint16_t api_version ) { + if ( api_version != PNIC_API_VERSION ) { + printf ( "Warning: API version mismatch! " + "(NIC's is %d.%d, ours is %d.%d)\n", + api_version >> 8, api_version & 0xff, + PNIC_API_VERSION >> 8, PNIC_API_VERSION & 0xff ); + } + if ( api_version < PNIC_API_VERSION ) { + printf ( "*** You may need to update your copy of Bochs ***\n" ); + } + return ( api_version == PNIC_API_VERSION ); +} + +/************************************************************************** +POLL - Wait for a frame +***************************************************************************/ +static int pnic_poll(struct nic *nic, int retrieve) +{ + uint16_t length; + uint16_t qlen; + + /* Check receive queue length to see if there's anything to + * get. Necessary since once we've called PNIC_CMD_RECV we + * have to read out the packet, otherwise it's lost forever. + */ + if ( pnic_command ( nic, PNIC_CMD_RECV_QLEN, NULL, 0, + &qlen, sizeof(qlen), NULL ) + != PNIC_STATUS_OK ) return ( 0 ); + if ( qlen == 0 ) return ( 0 ); + + /* There is a packet ready. Return 1 if we're only checking. */ + if ( ! retrieve ) return ( 1 ); + + /* Retrieve the packet */ + if ( pnic_command ( nic, PNIC_CMD_RECV, NULL, 0, + nic->packet, ETH_FRAME_LEN, &length ) + != PNIC_STATUS_OK ) return ( 0 ); + nic->packetlen = length; + return ( 1 ); +} + +/************************************************************************** +TRANSMIT - Transmit a frame +***************************************************************************/ +static void pnic_transmit( + struct nic *nic, + const char *dest, /* Destination */ + unsigned int type, /* Type */ + unsigned int size, /* size */ + const char *data) /* Packet */ +{ + unsigned int nstype = htons ( type ); + + if ( ( ETH_HLEN + size ) >= ETH_FRAME_LEN ) { + printf ( "pnic_transmit: packet too large\n" ); + return; + } + + /* Assemble packet */ + memcpy ( tx_buffer, dest, ETH_ALEN ); + memcpy ( tx_buffer + ETH_ALEN, nic->node_addr, ETH_ALEN ); + memcpy ( tx_buffer + 2 * ETH_ALEN, &nstype, 2 ); + memcpy ( tx_buffer + ETH_HLEN, data, size ); + + pnic_command ( nic, PNIC_CMD_XMIT, tx_buffer, ETH_HLEN + size, + NULL, 0, NULL ); +} + +/************************************************************************** +DISABLE - Turn off ethernet interface +***************************************************************************/ +static void pnic_disable(struct dev *dev) +{ + struct nic *nic = (struct nic *)dev; + pnic_command ( nic, PNIC_CMD_RESET, NULL, 0, NULL, 0, NULL ); +} + +/************************************************************************** +IRQ - Handle card interrupt status +***************************************************************************/ +static void pnic_irq ( struct nic *nic, irq_action_t action ) +{ + uint8_t enabled; + + switch ( action ) { + case DISABLE : + case ENABLE : + enabled = ( action == ENABLE ? 1 : 0 ); + pnic_command ( nic, PNIC_CMD_MASK_IRQ, + &enabled, sizeof(enabled), NULL, 0, NULL ); + break; + case FORCE : + pnic_command ( nic, PNIC_CMD_FORCE_IRQ, + NULL, 0, NULL, 0, NULL ); + break; + } +} + +/************************************************************************** +PROBE - Look for an adapter, this routine's visible to the outside +***************************************************************************/ + +static int pnic_probe(struct dev *dev, struct pci_device *pci) +{ + struct nic *nic = (struct nic *)dev; + static pnic_priv_data_t priv; + uint16_t status; + + printf(" - "); + + /* Clear private data structure and chain it in */ + memset ( &priv, 0, sizeof(priv) ); + nic->priv_data = &priv; + + /* Mask the bit that says "this is an io addr" */ + nic->ioaddr = pci->ioaddr & ~3; + nic->irqno = pci->irq; + /* Not sure what this does, but the rtl8139 driver does it */ + adjust_pci_device(pci); + + status = pnic_command_quiet( nic, PNIC_CMD_API_VER, NULL, 0, + &priv.api_version, + sizeof(priv.api_version), NULL ); + if ( status != PNIC_STATUS_OK ) { + printf ( "PNIC failed installation check, code %#hx\n", + status ); + return 0; + } + pnic_api_check(priv.api_version); + status = pnic_command ( nic, PNIC_CMD_READ_MAC, NULL, 0, + nic->node_addr, ETH_ALEN, NULL ); + printf ( "Detected Bochs Pseudo NIC MAC %! (API v%d.%d) at %#hx\n", + nic->node_addr, priv.api_version>>8, priv.api_version&0xff, + nic->ioaddr ); + + /* point to NIC specific routines */ + dev->disable = pnic_disable; + nic->poll = pnic_poll; + nic->transmit = pnic_transmit; + nic->irq = pnic_irq; + return 1; +} + +static struct pci_id pnic_nics[] = { +/* genrules.pl doesn't let us use macros for PCI IDs...*/ +PCI_ROM(0xfefe, 0xefef, "pnic", "Bochs Pseudo NIC Adaptor"), +}; + +struct pci_driver pnic_driver = { + .type = NIC_DRIVER, + .name = "PNIC", + .probe = pnic_probe, + .ids = pnic_nics, + .id_count = sizeof(pnic_nics)/sizeof(pnic_nics[0]), + .class = 0, +}; diff --git a/usr/src/grub/grub-0.97/netboot/pnic_api.h b/usr/src/grub/grub-0.97/netboot/pnic_api.h new file mode 100644 index 0000000000..6d117fa60c --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/pnic_api.h @@ -0,0 +1,59 @@ +/* + * Constants etc. for the Bochs/Etherboot pseudo-NIC + * + * This header file must be valid C and C++. + * + * Operation of the pseudo-NIC (PNIC) is pretty simple. To write a + * command plus data, first write the length of the data to + * PNIC_REG_LEN, then write the data a byte at a type to + * PNIC_REG_DATA, then write the command code to PNIC_REG_CMD. The + * status will be available from PNIC_REG_STAT. The length of any + * data returned will be in PNIC_REG_LEN and can be read a byte at a + * time from PNIC_REG_DATA. + */ + +/* + * PCI parameters + */ +#define PNIC_PCI_VENDOR 0xfefe /* Hopefully these won't clash with */ +#define PNIC_PCI_DEVICE 0xefef /* any real PCI device IDs. */ + +/* + * 'Hardware' register addresses, offset from io_base + */ +#define PNIC_REG_CMD 0x00 /* Command register, 2 bytes, write only */ +#define PNIC_REG_STAT 0x00 /* Status register, 2 bytes, read only */ +#define PNIC_REG_LEN 0x02 /* Length register, 2 bytes, read-write */ +#define PNIC_REG_DATA 0x04 /* Data port, 1 byte, read-write */ +/* + * PNIC_MAX_REG used in Bochs to claim i/o space + */ +#define PNIC_MAX_REG 0x04 + +/* + * Command code definitions: write these into PNIC_REG_CMD + */ +#define PNIC_CMD_NOOP 0x0000 +#define PNIC_CMD_API_VER 0x0001 +#define PNIC_CMD_READ_MAC 0x0002 +#define PNIC_CMD_RESET 0x0003 +#define PNIC_CMD_XMIT 0x0004 +#define PNIC_CMD_RECV 0x0005 +#define PNIC_CMD_RECV_QLEN 0x0006 +#define PNIC_CMD_MASK_IRQ 0x0007 +#define PNIC_CMD_FORCE_IRQ 0x0008 + +/* + * Status code definitions: read these from PNIC_REG_STAT + * + * We avoid using status codes that might be confused with + * randomly-read data (e.g. 0x0000, 0xffff etc.) + */ +#define PNIC_STATUS_OK 0x4f4b /* 'OK' */ +#define PNIC_STATUS_UNKNOWN_CMD 0x3f3f /* '??' */ + +/* + * Other miscellaneous information + */ + +#define PNIC_API_VERSION 0x0101 /* 1.1 */ diff --git a/usr/src/grub/grub-0.97/netboot/pxe.h b/usr/src/grub/grub-0.97/netboot/pxe.h new file mode 100644 index 0000000000..a266eb7094 --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/pxe.h @@ -0,0 +1,521 @@ +/* + * Copyright (c) 2000 Alfred Perlstein + * All rights reserved. + * Copyright (c) 2000 Paul Saab + * All rights reserved. + * Copyright (c) 2000 John Baldwin + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/sys/boot/i386/libi386/pxe.h,v 1.4.2.2 2000/09/10 02:52:18 ps Exp $ + */ + +/* + * The typedefs and structures declared in this file + * clearly violate style(9), the reason for this is to conform to the + * typedefs/structure-names used in the Intel literature to avoid confusion. + * + * It's for your own good. :) + */ + +/* SEGOFF16_t defined in separate header for Etherboot + */ +#include + +/* It seems that intel didn't think about ABI, + * either that or 16bit ABI != 32bit ABI (which seems reasonable) + * I have to thank Intel for the hair loss I incurred trying to figure + * out why PXE was mis-reading structures I was passing it (at least + * from my point of view) + * + * Solution: use gcc's '__attribute__ ((packed))' to correctly align + * structures passed into PXE + * Question: does this really work for PXE's expected ABI? + */ +#define PACKED __attribute__ ((packed)) + +#define S_SIZE(s) s, sizeof(s) - 1 + +#define IP_STR "%d.%d.%d.%d" +#define IP_ARGS(ip) \ + (int)(ip >> 24) & 0xff, (int)(ip >> 16) & 0xff, \ + (int)(ip >> 8) & 0xff, (int)ip & 0xff + +#define MAC_STR "%02x:%02x:%02x:%02x:%02x:%02x" +#define MAC_ARGS(mac) \ + mac[0], mac[1], mac[2], mac[3], mac[4], mac[5] + +#define PXENFSROOTPATH "/pxeroot" + +typedef struct { + uint16_t Seg_Addr; + uint32_t Phy_Addr; + uint16_t Seg_Size; +} PACKED SEGDESC_t; /* PACKED is required, otherwise gcc pads this out to 12 + bytes - mbrown@fensystems.co.uk (mcb30) 17/5/03 */ + +typedef uint16_t SEGSEL_t; +typedef uint16_t PXENV_STATUS_t; +typedef uint32_t IP4_t; +typedef uint32_t ADDR32_t; +typedef uint16_t UDP_PORT_t; + +#define MAC_ADDR_LEN 16 +typedef uint8_t MAC_ADDR[MAC_ADDR_LEN]; + +/* PXENV+ */ +typedef struct { + uint8_t Signature[6]; /* 'PXENV+' */ + uint16_t Version; /* MSB = major, LSB = minor */ + uint8_t Length; /* structure length */ + uint8_t Checksum; /* checksum pad */ + SEGOFF16_t RMEntry; /* SEG:OFF to PXE entry point */ + /* don't use PMOffset and PMSelector (from the 2.1 PXE manual) */ + uint32_t PMOffset; /* Protected mode entry */ + SEGSEL_t PMSelector; /* Protected mode selector */ + SEGSEL_t StackSeg; /* Stack segment address */ + uint16_t StackSize; /* Stack segment size (bytes) */ + SEGSEL_t BC_CodeSeg; /* BC Code segment address */ + uint16_t BC_CodeSize; /* BC Code segment size (bytes) */ + SEGSEL_t BC_DataSeg; /* BC Data segment address */ + uint16_t BC_DataSize; /* BC Data segment size (bytes) */ + SEGSEL_t UNDIDataSeg; /* UNDI Data segment address */ + uint16_t UNDIDataSize; /* UNDI Data segment size (bytes) */ + SEGSEL_t UNDICodeSeg; /* UNDI Code segment address */ + uint16_t UNDICodeSize; /* UNDI Code segment size (bytes) */ + SEGOFF16_t PXEPtr; /* SEG:OFF to !PXE struct, + only present when Version > 2.1 */ +} PACKED pxenv_t; + +/* !PXE */ +typedef struct { + uint8_t Signature[4]; + uint8_t StructLength; + uint8_t StructCksum; + uint8_t StructRev; + uint8_t reserved_1; + SEGOFF16_t UNDIROMID; + SEGOFF16_t BaseROMID; + SEGOFF16_t EntryPointSP; + SEGOFF16_t EntryPointESP; + SEGOFF16_t StatusCallout; + uint8_t reserved_2; + uint8_t SegDescCn; + SEGSEL_t FirstSelector; + SEGDESC_t Stack; + SEGDESC_t UNDIData; + SEGDESC_t UNDICode; + SEGDESC_t UNDICodeWrite; + SEGDESC_t BC_Data; + SEGDESC_t BC_Code; + SEGDESC_t BC_CodeWrite; +} PACKED pxe_t; + +#define PXENV_START_UNDI 0x0000 +typedef struct { + PXENV_STATUS_t Status; + uint16_t ax; + uint16_t bx; + uint16_t dx; + uint16_t di; + uint16_t es; +} PACKED t_PXENV_START_UNDI; + +#define PXENV_UNDI_STARTUP 0x0001 +typedef struct { + PXENV_STATUS_t Status; +} PACKED t_PXENV_UNDI_STARTUP; + +#define PXENV_UNDI_CLEANUP 0x0002 +typedef struct { + PXENV_STATUS_t Status; +} PACKED t_PXENV_UNDI_CLEANUP; + +#define PXENV_UNDI_INITIALIZE 0x0003 +typedef struct { + PXENV_STATUS_t Status; + ADDR32_t ProtocolIni; /* Phys addr of a copy of the driver module */ + uint8_t reserved[8]; +} PACKED t_PXENV_UNDI_INITIALIZE; + + +#define MAXNUM_MCADDR 8 +typedef struct { + uint16_t MCastAddrCount; + MAC_ADDR McastAddr[MAXNUM_MCADDR]; +} PACKED t_PXENV_UNDI_MCAST_ADDRESS; + +#define PXENV_UNDI_RESET_ADAPTER 0x0004 +typedef struct { + PXENV_STATUS_t Status; + t_PXENV_UNDI_MCAST_ADDRESS R_Mcast_Buf; +} PACKED t_PXENV_UNDI_RESET; + +#define PXENV_UNDI_SHUTDOWN 0x0005 +typedef struct { + PXENV_STATUS_t Status; +} PACKED t_PXENV_UNDI_SHUTDOWN; + +#define PXENV_UNDI_OPEN 0x0006 +typedef struct { + PXENV_STATUS_t Status; + uint16_t OpenFlag; + uint16_t PktFilter; +# define FLTR_DIRECTED 0x0001 +# define FLTR_BRDCST 0x0002 +# define FLTR_PRMSCS 0x0003 +# define FLTR_SRC_RTG 0x0004 + + t_PXENV_UNDI_MCAST_ADDRESS R_Mcast_Buf; +} PACKED t_PXENV_UNDI_OPEN; + +#define PXENV_UNDI_CLOSE 0x0007 +typedef struct { + PXENV_STATUS_t Status; +} PACKED t_PXENV_UNDI_CLOSE; + +#define PXENV_UNDI_TRANSMIT 0x0008 +typedef struct { + PXENV_STATUS_t Status; + uint8_t Protocol; +# define P_UNKNOWN 0 +# define P_IP 1 +# define P_ARP 2 +# define P_RARP 3 + + uint8_t XmitFlag; +# define XMT_DESTADDR 0x0000 +# define XMT_BROADCAST 0x0001 + + SEGOFF16_t DestAddr; + SEGOFF16_t TBD; + uint32_t Reserved[2]; +} PACKED t_PXENV_UNDI_TRANSMIT; + +#define MAX_DATA_BLKS 8 +typedef struct { + uint16_t ImmedLength; + SEGOFF16_t Xmit; + uint16_t DataBlkCount; + struct DataBlk { + uint8_t TDPtrType; + uint8_t TDRsvdByte; + uint16_t TDDataLen; + SEGOFF16_t TDDataPtr; + } DataBlock[MAX_DATA_BLKS]; +} PACKED t_PXENV_UNDI_TBD; + +#define PXENV_UNDI_SET_MCAST_ADDRESS 0x0009 +typedef struct { + PXENV_STATUS_t Status; + t_PXENV_UNDI_MCAST_ADDRESS R_Mcast_Buf; +} PACKED t_PXENV_UNDI_SET_MCAST_ADDR; + +#define PXENV_UNDI_SET_STATION_ADDRESS 0x000A +typedef struct { + PXENV_STATUS_t Status; + MAC_ADDR StationAddress; /* Temp MAC addres to use */ +} PACKED t_PXENV_UNDI_SET_STATION_ADDRESS; + +#define PXENV_UNDI_SET_PACKET_FILTER 0x000B +typedef struct { + PXENV_STATUS_t Status; + uint8_t filter; /* see UNDI_OPEN (0x0006) */ +} PACKED t_PXENV_UNDI_SET_PACKET_FILTER; + +#define PXENV_UNDI_GET_INFORMATION 0x000C +typedef struct { + PXENV_STATUS_t Status; + uint16_t BaseIo; /* Adapter base I/O address */ + uint16_t IntNumber; /* Adapter IRQ number */ + uint16_t MaxTranUnit; /* Adapter maximum transmit unit */ + uint16_t HwType; /* Type of protocol at the hardware addr */ +# define ETHER_TYPE 1 +# define EXP_ETHER_TYPE 2 +# define IEEE_TYPE 6 +# define ARCNET_TYPE 7 + + uint16_t HwAddrLen; /* Length of hardware address */ + MAC_ADDR CurrentNodeAddress; /* Current hardware address */ + MAC_ADDR PermNodeAddress; /* Permanent hardware address */ + SEGSEL_t ROMAddress; /* Real mode ROM segment address */ + uint16_t RxBufCt; /* Receive queue length */ + uint16_t TxBufCt; /* Transmit queue length */ +} PACKED t_PXENV_UNDI_GET_INFORMATION; + +#define PXENV_UNDI_GET_STATISTICS 0x000D +typedef struct { + PXENV_STATUS_t Status; + uint32_t XmitGoodFrames; /* Number of successful transmissions */ + uint32_t RcvGoodFrames; /* Number of good frames received */ + uint32_t RcvCRCErrors; /* Number of frames with CRC errors */ + uint32_t RcvResourceErrors; /* Number of frames dropped */ +} PACKED t_PXENV_UNDI_GET_STATISTICS; + +#define PXENV_UNDI_CLEAR_STATISTICS 0x000E +typedef struct { + PXENV_STATUS_t Status; +} PACKED t_PXENV_UNDI_CLEAR_STATISTICS; + +#define PXENV_UNDI_INITIATE_DIAGS 0x000F +typedef struct { + PXENV_STATUS_t Status; +} PACKED t_PXENV_UNDI_INITIATE_DIAGS; + +#define PXENV_UNDI_FORCE_INTERRUPT 0x0010 +typedef struct { + PXENV_STATUS_t Status; +} PACKED t_PXENV_UNDI_FORCE_INTERRUPT; + +#define PXENV_UNDI_GET_MCAST_ADDRESS 0x0011 +typedef struct { + PXENV_STATUS_t Status; + IP4_t InetAddr; /* IP mulicast address */ + MAC_ADDR MediaAddr; /* MAC multicast address */ +} PACKED t_PXENV_UNDI_GET_MCAST_ADDR; + +#define PXENV_UNDI_GET_NIC_TYPE 0x0012 +typedef struct { + PXENV_STATUS_t Status; + uint8_t NicType; /* Type of NIC */ +# define PCI_NIC 2 +# define PnP_NIC 3 +# define CardBus_NIC 4 + + union { + struct { + uint16_t Vendor_ID; + uint16_t Dev_ID; + uint8_t Base_Class; + uint8_t Sub_Class; + uint8_t Prog_Intf; + uint8_t Rev; + uint16_t BusDevFunc; + uint16_t SubVendor_ID; + uint16_t SubDevice_ID; + } pci, cardbus; + struct { + uint32_t EISA_Dev_ID; + uint8_t Base_Class; + uint8_t Sub_Class; + uint8_t Prog_Intf; + uint16_t CardSelNum; + } pnp; + } info; +} PACKED t_PXENV_UNDI_GET_NIC_TYPE; + +#define PXENV_UNDI_GET_IFACE_INFO 0x0013 +typedef struct { + PXENV_STATUS_t Status; + uint8_t IfaceType[16]; /* Name of MAC type in ASCII. */ + uint32_t LinkSpeed; /* Defined in NDIS 2.0 spec */ + uint32_t ServiceFlags; /* Defined in NDIS 2.0 spec */ + uint32_t Reserved[4]; /* must be 0 */ +} PACKED t_PXENV_UNDI_GET_IFACE_INFO; + +#define PXENV_UNDI_ISR 0x0014 +typedef struct { + PXENV_STATUS_t Status; + uint16_t FuncFlag; /* PXENV_UNDI_ISR_OUT_xxx */ + uint16_t BufferLength; /* Length of Frame */ + uint16_t FrameLength; /* Total length of reciever frame */ + uint16_t FrameHeaderLength; /* Length of the media header in Frame */ + SEGOFF16_t Frame; /* receive buffer */ + uint8_t ProtType; /* Protocol type */ + uint8_t PktType; /* Packet Type */ +# define PXENV_UNDI_ISR_IN_START 1 +# define PXENV_UNDI_ISR_IN_PROCESS 2 +# define PXENV_UNDI_ISR_IN_GET_NEXT 3 + + /* one of these will be returned for PXENV_UNDI_ISR_IN_START */ +# define PXENV_UNDI_ISR_OUT_OURS 0 +# define PXENV_UNDI_ISR_OUT_NOT_OURS 1 + + /* + * one of these will bre returnd for PXEND_UNDI_ISR_IN_PROCESS + * and PXENV_UNDI_ISR_IN_GET_NEXT + */ +# define PXENV_UNDI_ISR_OUT_DONE 0 +# define PXENV_UNDI_ISR_OUT_TRANSMIT 2 +# define PXENV_UNDI_ISR_OUT_RECEIVE 3 +# define PXENV_UNDI_ISR_OUT_BUSY 4 +} PACKED t_PXENV_UNDI_ISR; + +#define PXENV_STOP_UNDI 0x0015 +typedef struct { + PXENV_STATUS_t Status; +} PACKED t_PXENV_STOP_UNDI; + +#define PXENV_TFTP_OPEN 0x0020 +typedef struct { + PXENV_STATUS_t Status; + IP4_t ServerIPAddress; + IP4_t GatewayIPAddress; + uint8_t FileName[128]; + UDP_PORT_t TFTPPort; + uint16_t PacketSize; +} PACKED t_PXENV_TFTP_OPEN; + +#define PXENV_TFTP_CLOSE 0x0021 +typedef struct { + PXENV_STATUS_t Status; +} PACKED t_PXENV_TFTP_CLOSE; + +#define PXENV_TFTP_READ 0x0022 +typedef struct { + PXENV_STATUS_t Status; + uint16_t PacketNumber; + uint16_t BufferSize; + SEGOFF16_t Buffer; +} PACKED t_PXENV_TFTP_READ; + +#define PXENV_TFTP_READ_FILE 0x0023 +typedef struct { + PXENV_STATUS_t Status; + uint8_t FileName[128]; + uint32_t BufferSize; + ADDR32_t Buffer; + IP4_t ServerIPAddress; + IP4_t GatewayIPAdress; + IP4_t McastIPAdress; + UDP_PORT_t TFTPClntPort; + UDP_PORT_t TFTPSrvPort; + uint16_t TFTPOpenTimeOut; + uint16_t TFTPReopenDelay; +} PACKED t_PXENV_TFTP_READ_FILE; + +#define PXENV_TFTP_GET_FSIZE 0x0025 +typedef struct { + PXENV_STATUS_t Status; + IP4_t ServerIPAddress; + IP4_t GatewayIPAdress; + uint8_t FileName[128]; + uint32_t FileSize; +} PACKED t_PXENV_TFTP_GET_FSIZE; + +#define PXENV_UDP_OPEN 0x0030 +typedef struct { + PXENV_STATUS_t Status; + IP4_t src_ip; /* IP address of this station */ +} PACKED t_PXENV_UDP_OPEN; + +#define PXENV_UDP_CLOSE 0x0031 +typedef struct { + PXENV_STATUS_t status; +} PACKED t_PXENV_UDP_CLOSE; + +#define PXENV_UDP_READ 0x0032 +typedef struct { + PXENV_STATUS_t status; + IP4_t src_ip; /* IP of sender */ + IP4_t dest_ip; /* Only accept packets sent to this IP */ + UDP_PORT_t s_port; /* UDP source port of sender */ + UDP_PORT_t d_port; /* Only accept packets sent to this port */ + uint16_t buffer_size; /* Size of the packet buffer */ + SEGOFF16_t buffer; /* SEG:OFF to the packet buffer */ +} PACKED t_PXENV_UDP_READ; + +#define PXENV_UDP_WRITE 0x0033 +typedef struct { + PXENV_STATUS_t status; + IP4_t ip; /* dest ip addr */ + IP4_t gw; /* ip gateway */ + UDP_PORT_t src_port; /* source udp port */ + UDP_PORT_t dst_port; /* destination udp port */ + uint16_t buffer_size; /* Size of the packet buffer */ + SEGOFF16_t buffer; /* SEG:OFF to the packet buffer */ +} PACKED t_PXENV_UDP_WRITE; + +#define PXENV_UNLOAD_STACK 0x0070 +typedef struct { + PXENV_STATUS_t Status; + uint8_t reserved[10]; +} PACKED t_PXENV_UNLOAD_STACK; + + +#define PXENV_GET_CACHED_INFO 0x0071 +typedef struct { + PXENV_STATUS_t Status; + uint16_t PacketType; /* type (defined right here) */ +# define PXENV_PACKET_TYPE_DHCP_DISCOVER 1 +# define PXENV_PACKET_TYPE_DHCP_ACK 2 +# define PXENV_PACKET_TYPE_BINL_REPLY 3 + uint16_t BufferSize; /* max to copy, leave at 0 for pointer */ + SEGOFF16_t Buffer; /* copy to, leave at 0 for pointer */ + uint16_t BufferLimit; /* max size of buffer in BC dataseg ? */ +} PACKED t_PXENV_GET_CACHED_INFO; + + +/* structure filled in by PXENV_GET_CACHED_INFO + * (how we determine which IP we downloaded the initial bootstrap from) + * words can't describe... + */ +typedef struct { + uint8_t opcode; +# define BOOTP_REQ 1 +# define BOOTP_REP 2 + uint8_t Hardware; /* hardware type */ + uint8_t Hardlen; /* hardware addr len */ + uint8_t Gatehops; /* zero it */ + uint32_t ident; /* random number chosen by client */ + uint16_t seconds; /* seconds since did initial bootstrap */ + uint16_t Flags; /* seconds since did initial bootstrap */ +# define BOOTP_BCAST 0x8000 /* ? */ + IP4_t cip; /* Client IP */ + IP4_t yip; /* Your IP */ + IP4_t sip; /* IP to use for next boot stage */ + IP4_t gip; /* Relay IP ? */ + MAC_ADDR CAddr; /* Client hardware address */ + uint8_t Sname[64]; /* Server's hostname (Optional) */ + uint8_t bootfile[128]; /* boot filename */ + union { +# if 1 +# define BOOTP_DHCPVEND 1024 /* DHCP extended vendor field size */ +# else +# define BOOTP_DHCPVEND 312 /* DHCP standard vendor field size */ +# endif + uint8_t d[BOOTP_DHCPVEND]; /* raw array of vendor/dhcp options */ + struct { + uint8_t magic[4]; /* DHCP magic cookie */ +# ifndef VM_RFC1048 +# define VM_RFC1048 0x63825363L /* ? */ +# endif + uint32_t flags; /* bootp flags/opcodes */ + uint8_t pad[56]; /* I don't think intel knows what a + union does... */ + } v; + } vendor; +} PACKED BOOTPLAYER; + +#define PXENV_RESTART_TFTP 0x0073 +#define t_PXENV_RESTART_TFTP t_PXENV_TFTP_READ_FILE + +#define PXENV_START_BASE 0x0075 +typedef struct { + PXENV_STATUS_t Status; +} PACKED t_PXENV_START_BASE; + +#define PXENV_STOP_BASE 0x0076 +typedef struct { + PXENV_STATUS_t Status; +} PACKED t_PXENV_STOP_BASE; diff --git a/usr/src/grub/grub-0.97/netboot/r8169.c b/usr/src/grub/grub-0.97/netboot/r8169.c new file mode 100644 index 0000000000..a7f0e15e34 --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/r8169.c @@ -0,0 +1,854 @@ +/************************************************************************** +* r8169.c: Etherboot device driver for the RealTek RTL-8169 Gigabit +* Written 2003 by Timothy Legge +* +* 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. +* +* Portions of this code based on: +* r8169.c: A RealTek RTL-8169 Gigabit Ethernet driver +* for Linux kernel 2.4.x. +* +* Written 2002 ShuChen +* See Linux Driver for full information +* +* Linux Driver Version 1.27a, 10.02.2002 +* +* Thanks to: +* Jean Chen of RealTek Semiconductor Corp. for +* providing the evaluation NIC used to develop +* this driver. RealTek's support for Etherboot +* is appreciated. +* +* REVISION HISTORY: +* ================ +* +* v1.0 11-26-2003 timlegge Initial port of Linux driver +* v1.5 01-17-2004 timlegge Initial driver output cleanup +* v1.6 03-27-2004 timlegge Additional Cleanup +* +* Indent Options: indent -kr -i8 +***************************************************************************/ + +/* to get some global routines like printf */ +#include "etherboot.h" +/* to get the interface to the body of the program */ +#include "nic.h" +/* to get the PCI support functions, if this is a PCI NIC */ +#include "pci.h" +#include "timer.h" + +#define drv_version "v1.6" +#define drv_date "03-27-2004" + +typedef unsigned char u8; +typedef signed char s8; +typedef unsigned short u16; +typedef signed short s16; +typedef unsigned int u32; +typedef signed int s32; + +#define HZ 1000 + +static u32 ioaddr; + +#ifdef EDEBUG +#define dprintf(x) printf x +#else +#define dprintf(x) +#endif + +/* Condensed operations for readability. */ +#define virt_to_le32desc(addr) cpu_to_le32(virt_to_bus(addr)) +#define le32desc_to_virt(addr) bus_to_virt(le32_to_cpu(addr)) + +#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) + +/* media options + _10_Half = 0x01, + _10_Full = 0x02, + _100_Half = 0x04, + _100_Full = 0x08, + _1000_Full = 0x10, +*/ +static int media = -1; + +#if 0 +/* Maximum events (Rx packets, etc.) to handle at each interrupt. */ +static int max_interrupt_work = 20; +#endif + +#if 0 +/* Maximum number of multicast addresses to filter (vs. Rx-all-multicast). + The RTL chips use a 64 element hash table based on the Ethernet CRC. */ +static int multicast_filter_limit = 32; +#endif + +/* MAC address length*/ +#define MAC_ADDR_LEN 6 + +/* max supported gigabit ethernet frame size -- must be at least (dev->mtu+14+4).*/ +#define MAX_ETH_FRAME_SIZE 1536 + +#define TX_FIFO_THRESH 256 /* In bytes */ + +#define RX_FIFO_THRESH 7 /* 7 means NO threshold, Rx buffer level before first PCI xfer. */ +#define RX_DMA_BURST 6 /* Maximum PCI burst, '6' is 1024 */ +#define TX_DMA_BURST 6 /* Maximum PCI burst, '6' is 1024 */ +#define EarlyTxThld 0x3F /* 0x3F means NO early transmit */ +#define RxPacketMaxSize 0x0800 /* Maximum size supported is 16K-1 */ +#define InterFrameGap 0x03 /* 3 means InterFrameGap = the shortest one */ + +#define NUM_TX_DESC 1 /* Number of Tx descriptor registers */ +#define NUM_RX_DESC 4 /* Number of Rx descriptor registers */ +#define RX_BUF_SIZE 1536 /* Rx Buffer size */ + +#define RTL_MIN_IO_SIZE 0x80 +#define TX_TIMEOUT (6*HZ) + +/* write/read MMIO register */ +#define RTL_W8(reg, val8) writeb ((val8), ioaddr + (reg)) +#define RTL_W16(reg, val16) writew ((val16), ioaddr + (reg)) +#define RTL_W32(reg, val32) writel ((val32), ioaddr + (reg)) +#define RTL_R8(reg) readb (ioaddr + (reg)) +#define RTL_R16(reg) readw (ioaddr + (reg)) +#define RTL_R32(reg) ((unsigned long) readl (ioaddr + (reg))) + +enum RTL8169_registers { + MAC0 = 0, /* Ethernet hardware address. */ + MAR0 = 8, /* Multicast filter. */ + TxDescStartAddr = 0x20, + TxHDescStartAddr = 0x28, + FLASH = 0x30, + ERSR = 0x36, + ChipCmd = 0x37, + TxPoll = 0x38, + IntrMask = 0x3C, + IntrStatus = 0x3E, + TxConfig = 0x40, + RxConfig = 0x44, + RxMissed = 0x4C, + Cfg9346 = 0x50, + Config0 = 0x51, + Config1 = 0x52, + Config2 = 0x53, + Config3 = 0x54, + Config4 = 0x55, + Config5 = 0x56, + MultiIntr = 0x5C, + PHYAR = 0x60, + TBICSR = 0x64, + TBI_ANAR = 0x68, + TBI_LPAR = 0x6A, + PHYstatus = 0x6C, + RxMaxSize = 0xDA, + CPlusCmd = 0xE0, + RxDescStartAddr = 0xE4, + EarlyTxThres = 0xEC, + FuncEvent = 0xF0, + FuncEventMask = 0xF4, + FuncPresetState = 0xF8, + FuncForceEvent = 0xFC, +}; + +enum RTL8169_register_content { + /*InterruptStatusBits */ + SYSErr = 0x8000, + PCSTimeout = 0x4000, + SWInt = 0x0100, + TxDescUnavail = 0x80, + RxFIFOOver = 0x40, + RxUnderrun = 0x20, + RxOverflow = 0x10, + TxErr = 0x08, + TxOK = 0x04, + RxErr = 0x02, + RxOK = 0x01, + + /*RxStatusDesc */ + RxRES = 0x00200000, + RxCRC = 0x00080000, + RxRUNT = 0x00100000, + RxRWT = 0x00400000, + + /*ChipCmdBits */ + CmdReset = 0x10, + CmdRxEnb = 0x08, + CmdTxEnb = 0x04, + RxBufEmpty = 0x01, + + /*Cfg9346Bits */ + Cfg9346_Lock = 0x00, + Cfg9346_Unlock = 0xC0, + + /*rx_mode_bits */ + AcceptErr = 0x20, + AcceptRunt = 0x10, + AcceptBroadcast = 0x08, + AcceptMulticast = 0x04, + AcceptMyPhys = 0x02, + AcceptAllPhys = 0x01, + + /*RxConfigBits */ + RxCfgFIFOShift = 13, + RxCfgDMAShift = 8, + + /*TxConfigBits */ + TxInterFrameGapShift = 24, + TxDMAShift = 8, /* DMA burst value (0-7) is shift this many bits */ + + /*rtl8169_PHYstatus */ + TBI_Enable = 0x80, + TxFlowCtrl = 0x40, + RxFlowCtrl = 0x20, + _1000bpsF = 0x10, + _100bps = 0x08, + _10bps = 0x04, + LinkStatus = 0x02, + FullDup = 0x01, + + /*GIGABIT_PHY_registers */ + PHY_CTRL_REG = 0, + PHY_STAT_REG = 1, + PHY_AUTO_NEGO_REG = 4, + PHY_1000_CTRL_REG = 9, + + /*GIGABIT_PHY_REG_BIT */ + PHY_Restart_Auto_Nego = 0x0200, + PHY_Enable_Auto_Nego = 0x1000, + + /* PHY_STAT_REG = 1; */ + PHY_Auto_Neco_Comp = 0x0020, + + /* PHY_AUTO_NEGO_REG = 4; */ + PHY_Cap_10_Half = 0x0020, + PHY_Cap_10_Full = 0x0040, + PHY_Cap_100_Half = 0x0080, + PHY_Cap_100_Full = 0x0100, + + /* PHY_1000_CTRL_REG = 9; */ + PHY_Cap_1000_Full = 0x0200, + + PHY_Cap_Null = 0x0, + + /*_MediaType*/ + _10_Half = 0x01, + _10_Full = 0x02, + _100_Half = 0x04, + _100_Full = 0x08, + _1000_Full = 0x10, + + /*_TBICSRBit*/ + TBILinkOK = 0x02000000, +}; + +static struct { + const char *name; + u8 version; /* depend on RTL8169 docs */ + u32 RxConfigMask; /* should clear the bits supported by this chip */ +} rtl_chip_info[] = { + { +"RTL-8169", 0x00, 0xff7e1880,},}; + +enum _DescStatusBit { + OWNbit = 0x80000000, + EORbit = 0x40000000, + FSbit = 0x20000000, + LSbit = 0x10000000, +}; + +struct TxDesc { + u32 status; + u32 vlan_tag; + u32 buf_addr; + u32 buf_Haddr; +}; + +struct RxDesc { + u32 status; + u32 vlan_tag; + u32 buf_addr; + u32 buf_Haddr; +}; + +/* The descriptors for this card are required to be aligned on +256 byte boundaries. As the align attribute does not do more than +16 bytes of alignment it requires some extra steps. Add 256 to the +size of the array and the init_ring adjusts the alignment */ + +/* Define the TX Descriptor */ +static u8 tx_ring[NUM_TX_DESC * sizeof(struct TxDesc) + 256]; + +/* Create a static buffer of size RX_BUF_SZ for each +TX Descriptor. All descriptors point to a +part of this buffer */ +static unsigned char txb[NUM_TX_DESC * RX_BUF_SIZE]; + +/* Define the RX Descriptor */ +static u8 rx_ring[NUM_RX_DESC * sizeof(struct TxDesc) + 256]; + +/* Create a static buffer of size RX_BUF_SZ for each +RX Descriptor All descriptors point to a +part of this buffer */ +static unsigned char rxb[NUM_RX_DESC * RX_BUF_SIZE]; + +struct rtl8169_private { + void *mmio_addr; /* memory map physical address */ + int chipset; + unsigned long cur_rx; /* Index into the Rx descriptor buffer of next Rx pkt. */ + unsigned long cur_tx; /* Index into the Tx descriptor buffer of next Rx pkt. */ + unsigned char *TxDescArrays; /* Index of Tx Descriptor buffer */ + unsigned char *RxDescArrays; /* Index of Rx Descriptor buffer */ + struct TxDesc *TxDescArray; /* Index of 256-alignment Tx Descriptor buffer */ + struct RxDesc *RxDescArray; /* Index of 256-alignment Rx Descriptor buffer */ + unsigned char *RxBufferRing[NUM_RX_DESC]; /* Index of Rx Buffer array */ + unsigned char *Tx_skbuff[NUM_TX_DESC]; +} tpx; + +static struct rtl8169_private *tpc; + +static const u16 rtl8169_intr_mask = + SYSErr | PCSTimeout | RxUnderrun | RxOverflow | RxFIFOOver | TxErr | + TxOK | RxErr | RxOK; +static const unsigned int rtl8169_rx_config = + (RX_FIFO_THRESH << RxCfgFIFOShift) | (RX_DMA_BURST << RxCfgDMAShift); + +void mdio_write(int RegAddr, int value) +{ + int i; + + RTL_W32(PHYAR, 0x80000000 | (RegAddr & 0xFF) << 16 | value); + udelay(1000); + + for (i = 2000; i > 0; i--) { + /* Check if the RTL8169 has completed writing to the specified MII register */ + if (!(RTL_R32(PHYAR) & 0x80000000)) { + break; + } else { + udelay(100); + } + } +} + +int mdio_read(int RegAddr) +{ + int i, value = -1; + + RTL_W32(PHYAR, 0x0 | (RegAddr & 0xFF) << 16); + udelay(1000); + + for (i = 2000; i > 0; i--) { + /* Check if the RTL8169 has completed retrieving data from the specified MII register */ + if (RTL_R32(PHYAR) & 0x80000000) { + value = (int) (RTL_R32(PHYAR) & 0xFFFF); + break; + } else { + udelay(100); + } + } + return value; +} + +static int rtl8169_init_board(struct pci_device *pdev) +{ + int i; + unsigned long rtreg_base, rtreg_len; + u32 tmp; + + rtreg_base = pci_bar_start(pdev, PCI_BASE_ADDRESS_1); + rtreg_len = pci_bar_size(pdev, PCI_BASE_ADDRESS_1); + + /* check for weird/broken PCI region reporting */ + if (rtreg_len < RTL_MIN_IO_SIZE) { + printf("Invalid PCI region size(s), aborting\n"); + } + + adjust_pci_device(pdev); +/* pm_cap = pci_find_capability(pdev, PCI_CAP_ID_PM); */ + + /* ioremap MMIO region */ + ioaddr = (unsigned long) ioremap(rtreg_base, rtreg_len); + if (ioaddr == 0) + return 0; + + tpc->mmio_addr = &ioaddr; + /* Soft reset the chip. */ + RTL_W8(ChipCmd, CmdReset); + + /* Check that the chip has finished the reset. */ + for (i = 1000; i > 0; i--) + if ((RTL_R8(ChipCmd) & CmdReset) == 0) + break; + else + udelay(10); + + /* identify chip attached to board */ + tmp = RTL_R32(TxConfig); + tmp = ((tmp & 0x7c000000) + ((tmp & 0x00800000) << 2)) >> 24; + + for (i = ARRAY_SIZE(rtl_chip_info) - 1; i >= 0; i--) + if (tmp == rtl_chip_info[i].version) { + tpc->chipset = i; + goto match; + } + /* if unknown chip, assume array element #0, original RTL-8169 in this case */ + dprintf(("PCI device: unknown chip version, assuming RTL-8169\n")); + dprintf(("PCI device: TxConfig = 0x%hX\n", + (unsigned long) RTL_R32(TxConfig))); + tpc->chipset = 0; + return 1; + match: + return 0; + +} + +/************************************************************************** +IRQ - Wait for a frame +***************************************************************************/ +void r8169_irq ( struct nic *nic __unused, irq_action_t action ) { + int intr_status = 0; + int interested = RxUnderrun | RxOverflow | RxFIFOOver | RxErr | RxOK; + + switch ( action ) { + case DISABLE: + case ENABLE: + intr_status = RTL_R16(IntrStatus); + /* h/w no longer present (hotplug?) or major error, + bail */ + if (intr_status == 0xFFFF) + break; + + intr_status = intr_status & ~interested; + if ( action == ENABLE ) + intr_status = intr_status | interested; + RTL_W16(IntrMask, intr_status); + break; + case FORCE : + RTL_W8(TxPoll, (RTL_R8(TxPoll) | 0x01)); + break; + } +} + +/************************************************************************** +POLL - Wait for a frame +***************************************************************************/ +static int r8169_poll(struct nic *nic, int retreive) +{ + /* return true if there's an ethernet packet ready to read */ + /* nic->packet should contain data on return */ + /* nic->packetlen should contain length of data */ + int cur_rx; + unsigned int intr_status = 0; + cur_rx = tpc->cur_rx; + if ((tpc->RxDescArray[cur_rx].status & OWNbit) == 0) { + /* There is a packet ready */ + if(!retreive) + return 1; + intr_status = RTL_R16(IntrStatus); + /* h/w no longer present (hotplug?) or major error, + bail */ + if (intr_status == 0xFFFF) + return 0; + RTL_W16(IntrStatus, intr_status & + ~(RxFIFOOver | RxOverflow | RxOK)); + + if (!(tpc->RxDescArray[cur_rx].status & RxRES)) { + nic->packetlen = (int) (tpc->RxDescArray[cur_rx]. + status & 0x00001FFF) - 4; + memcpy(nic->packet, tpc->RxBufferRing[cur_rx], + nic->packetlen); + if (cur_rx == NUM_RX_DESC - 1) + tpc->RxDescArray[cur_rx].status = + (OWNbit | EORbit) + RX_BUF_SIZE; + else + tpc->RxDescArray[cur_rx].status = + OWNbit + RX_BUF_SIZE; + tpc->RxDescArray[cur_rx].buf_addr = + virt_to_bus(tpc->RxBufferRing[cur_rx]); + } else + printf("Error Rx"); + /* FIXME: shouldn't I reset the status on an error */ + cur_rx = (cur_rx + 1) % NUM_RX_DESC; + tpc->cur_rx = cur_rx; + RTL_W16(IntrStatus, intr_status & + (RxFIFOOver | RxOverflow | RxOK)); + + return 1; + + } + tpc->cur_rx = cur_rx; + /* FIXME: There is no reason to do this as cur_rx did not change */ + + return (0); /* initially as this is called to flush the input */ + +} + +/************************************************************************** +TRANSMIT - Transmit a frame +***************************************************************************/ +static void r8169_transmit(struct nic *nic, const char *d, /* Destination */ + unsigned int t, /* Type */ + unsigned int s, /* size */ + const char *p) +{ /* Packet */ + /* send the packet to destination */ + + u16 nstype; + u32 to; + u8 *ptxb; + int entry = tpc->cur_tx % NUM_TX_DESC; + + /* point to the current txb incase multiple tx_rings are used */ + ptxb = tpc->Tx_skbuff[entry * MAX_ETH_FRAME_SIZE]; + memcpy(ptxb, d, ETH_ALEN); + memcpy(ptxb + ETH_ALEN, nic->node_addr, ETH_ALEN); + nstype = htons((u16) t); + memcpy(ptxb + 2 * ETH_ALEN, (u8 *) & nstype, 2); + memcpy(ptxb + ETH_HLEN, p, s); + s += ETH_HLEN; + s &= 0x0FFF; + while (s < ETH_ZLEN) + ptxb[s++] = '\0'; + + tpc->TxDescArray[entry].buf_addr = virt_to_bus(ptxb); + if (entry != (NUM_TX_DESC - 1)) + tpc->TxDescArray[entry].status = + (OWNbit | FSbit | LSbit) | ((s > ETH_ZLEN) ? s : + ETH_ZLEN); + else + tpc->TxDescArray[entry].status = + (OWNbit | EORbit | FSbit | LSbit) | ((s > ETH_ZLEN) ? s + : ETH_ZLEN); + RTL_W8(TxPoll, 0x40); /* set polling bit */ + + tpc->cur_tx++; + to = currticks() + TX_TIMEOUT; + while ((tpc->TxDescArray[entry].status & OWNbit) && (currticks() < to)); /* wait */ + + if (currticks() >= to) { + printf("TX Time Out"); + } +} + +static void rtl8169_set_rx_mode(struct nic *nic __unused) +{ + u32 mc_filter[2]; /* Multicast hash filter */ + int rx_mode; + u32 tmp = 0; + + /* IFF_ALLMULTI */ + /* Too many to filter perfectly -- accept all multicasts. */ + rx_mode = AcceptBroadcast | AcceptMulticast | AcceptMyPhys; + mc_filter[1] = mc_filter[0] = 0xffffffff; + + tmp = + rtl8169_rx_config | rx_mode | (RTL_R32(RxConfig) & + rtl_chip_info[tpc->chipset]. + RxConfigMask); + + RTL_W32(RxConfig, tmp); + RTL_W32(MAR0 + 0, mc_filter[0]); + RTL_W32(MAR0 + 4, mc_filter[1]); +} +static void rtl8169_hw_start(struct nic *nic) +{ + u32 i; + + /* Soft reset the chip. */ + RTL_W8(ChipCmd, CmdReset); + + /* Check that the chip has finished the reset. */ + for (i = 1000; i > 0; i--) { + if ((RTL_R8(ChipCmd) & CmdReset) == 0) + break; + else + udelay(10); + } + + RTL_W8(Cfg9346, Cfg9346_Unlock); + RTL_W8(ChipCmd, CmdTxEnb | CmdRxEnb); + RTL_W8(EarlyTxThres, EarlyTxThld); + + /* For gigabit rtl8169 */ + RTL_W16(RxMaxSize, RxPacketMaxSize); + + /* Set Rx Config register */ + i = rtl8169_rx_config | (RTL_R32(RxConfig) & + rtl_chip_info[tpc->chipset].RxConfigMask); + RTL_W32(RxConfig, i); + + /* Set DMA burst size and Interframe Gap Time */ + RTL_W32(TxConfig, + (TX_DMA_BURST << TxDMAShift) | (InterFrameGap << + TxInterFrameGapShift)); + + + tpc->cur_rx = 0; + + RTL_W32(TxDescStartAddr, virt_to_le32desc(tpc->TxDescArray)); + RTL_W32(RxDescStartAddr, virt_to_le32desc(tpc->RxDescArray)); + RTL_W8(Cfg9346, Cfg9346_Lock); + udelay(10); + + RTL_W32(RxMissed, 0); + + rtl8169_set_rx_mode(nic); + + /* no early-rx interrupts */ + RTL_W16(MultiIntr, RTL_R16(MultiIntr) & 0xF000); +} + +static void rtl8169_init_ring(struct nic *nic __unused) +{ + int i; + + tpc->cur_rx = 0; + tpc->cur_tx = 0; + memset(tpc->TxDescArray, 0x0, NUM_TX_DESC * sizeof(struct TxDesc)); + memset(tpc->RxDescArray, 0x0, NUM_RX_DESC * sizeof(struct RxDesc)); + + for (i = 0; i < NUM_TX_DESC; i++) { + tpc->Tx_skbuff[i] = &txb[i]; + } + + for (i = 0; i < NUM_RX_DESC; i++) { + if (i == (NUM_RX_DESC - 1)) + tpc->RxDescArray[i].status = + (OWNbit | EORbit) + RX_BUF_SIZE; + else + tpc->RxDescArray[i].status = OWNbit + RX_BUF_SIZE; + + tpc->RxBufferRing[i] = &rxb[i * RX_BUF_SIZE]; + tpc->RxDescArray[i].buf_addr = + virt_to_bus(tpc->RxBufferRing[i]); + } +} + +/************************************************************************** +RESET - Finish setting up the ethernet interface +***************************************************************************/ +static void r8169_reset(struct nic *nic) +{ + int i; + u8 diff; + u32 TxPhyAddr, RxPhyAddr; + + tpc->TxDescArrays = tx_ring; + if (tpc->TxDescArrays == 0) + printf("Allot Error"); + /* Tx Desscriptor needs 256 bytes alignment; */ + TxPhyAddr = virt_to_bus(tpc->TxDescArrays); + diff = 256 - (TxPhyAddr - ((TxPhyAddr >> 8) << 8)); + TxPhyAddr += diff; + tpc->TxDescArray = (struct TxDesc *) (tpc->TxDescArrays + diff); + + tpc->RxDescArrays = rx_ring; + /* Rx Desscriptor needs 256 bytes alignment; */ + RxPhyAddr = virt_to_bus(tpc->RxDescArrays); + diff = 256 - (RxPhyAddr - ((RxPhyAddr >> 8) << 8)); + RxPhyAddr += diff; + tpc->RxDescArray = (struct RxDesc *) (tpc->RxDescArrays + diff); + + if (tpc->TxDescArrays == NULL || tpc->RxDescArrays == NULL) { + printf("Allocate RxDescArray or TxDescArray failed\n"); + return; + } + + rtl8169_init_ring(nic); + rtl8169_hw_start(nic); + /* Construct a perfect filter frame with the mac address as first match + * and broadcast for all others */ + for (i = 0; i < 192; i++) + txb[i] = 0xFF; + + txb[0] = nic->node_addr[0]; + txb[1] = nic->node_addr[1]; + txb[2] = nic->node_addr[2]; + txb[3] = nic->node_addr[3]; + txb[4] = nic->node_addr[4]; + txb[5] = nic->node_addr[5]; +} + +/************************************************************************** +DISABLE - Turn off ethernet interface +***************************************************************************/ +static void r8169_disable(struct dev *dev __unused) +{ + int i; + /* Stop the chip's Tx and Rx DMA processes. */ + RTL_W8(ChipCmd, 0x00); + + /* Disable interrupts by clearing the interrupt mask. */ + RTL_W16(IntrMask, 0x0000); + + RTL_W32(RxMissed, 0); + + tpc->TxDescArrays = NULL; + tpc->RxDescArrays = NULL; + tpc->TxDescArray = NULL; + tpc->RxDescArray = NULL; + for (i = 0; i < NUM_RX_DESC; i++) { + tpc->RxBufferRing[i] = NULL; + } +} + +/************************************************************************** +PROBE - Look for an adapter, this routine's visible to the outside +***************************************************************************/ + +#define board_found 1 +#define valid_link 0 +static int r8169_probe(struct dev *dev, struct pci_device *pci) +{ + struct nic *nic = (struct nic *) dev; + static int board_idx = -1; + static int printed_version = 0; + int i, rc; + int option = -1, Cap10_100 = 0, Cap1000 = 0; + + printf("r8169.c: Found %s, Vendor=%hX Device=%hX\n", + pci->name, pci->vendor, pci->dev_id); + + board_idx++; + + printed_version = 1; + + /* point to private storage */ + tpc = &tpx; + + rc = rtl8169_init_board(pci); /* Return code is meaningless */ + + /* Get MAC address. FIXME: read EEPROM */ + for (i = 0; i < MAC_ADDR_LEN; i++) + nic->node_addr[i] = RTL_R8(MAC0 + i); + + dprintf(("%s: Identified chip type is '%s'.\n", pci->name, + rtl_chip_info[tpc->chipset].name)); + /* Print out some hardware info */ + printf("%s: %! at ioaddr %hX, ", pci->name, nic->node_addr, + ioaddr); + + /* if TBI is not endbled */ + if (!(RTL_R8(PHYstatus) & TBI_Enable)) { + int val = mdio_read(PHY_AUTO_NEGO_REG); + + option = media; + /* Force RTL8169 in 10/100/1000 Full/Half mode. */ + if (option > 0) { + printf(" Force-mode Enabled.\n"); + Cap10_100 = 0, Cap1000 = 0; + switch (option) { + case _10_Half: + Cap10_100 = PHY_Cap_10_Half; + Cap1000 = PHY_Cap_Null; + break; + case _10_Full: + Cap10_100 = PHY_Cap_10_Full; + Cap1000 = PHY_Cap_Null; + break; + case _100_Half: + Cap10_100 = PHY_Cap_100_Half; + Cap1000 = PHY_Cap_Null; + break; + case _100_Full: + Cap10_100 = PHY_Cap_100_Full; + Cap1000 = PHY_Cap_Null; + break; + case _1000_Full: + Cap10_100 = PHY_Cap_Null; + Cap1000 = PHY_Cap_1000_Full; + break; + default: + break; + } + /* leave PHY_AUTO_NEGO_REG bit4:0 unchanged */ + mdio_write(PHY_AUTO_NEGO_REG, + Cap10_100 | (val & 0x1F)); + mdio_write(PHY_1000_CTRL_REG, Cap1000); + } else { + dprintf(("Auto-negotiation Enabled.\n", + pci->name)); + + /* enable 10/100 Full/Half Mode, leave PHY_AUTO_NEGO_REG bit4:0 unchanged */ + mdio_write(PHY_AUTO_NEGO_REG, + PHY_Cap_10_Half | PHY_Cap_10_Full | + PHY_Cap_100_Half | PHY_Cap_100_Full | + (val & 0x1F)); + + /* enable 1000 Full Mode */ + mdio_write(PHY_1000_CTRL_REG, PHY_Cap_1000_Full); + + } + + /* Enable auto-negotiation and restart auto-nigotiation */ + mdio_write(PHY_CTRL_REG, + PHY_Enable_Auto_Nego | PHY_Restart_Auto_Nego); + udelay(100); + + /* wait for auto-negotiation process */ + for (i = 10000; i > 0; i--) { + /* Check if auto-negotiation complete */ + if (mdio_read(PHY_STAT_REG) & PHY_Auto_Neco_Comp) { + udelay(100); + option = RTL_R8(PHYstatus); + if (option & _1000bpsF) { + printf + ("1000Mbps Full-duplex operation.\n"); + } else { + printf + ("%sMbps %s-duplex operation.\n", + (option & _100bps) ? "100" : + "10", + (option & FullDup) ? "Full" : + "Half"); + } + break; + } else { + udelay(100); + } + } /* end for-loop to wait for auto-negotiation process */ + + } else { + udelay(100); + printf + ("%s: 1000Mbps Full-duplex operation, TBI Link %s!\n", + pci->name, + (RTL_R32(TBICSR) & TBILinkOK) ? "OK" : "Failed"); + + } + + r8169_reset(nic); + /* point to NIC specific routines */ + dev->disable = r8169_disable; + nic->poll = r8169_poll; + nic->transmit = r8169_transmit; + nic->irqno = pci->irq; + nic->irq = r8169_irq; + nic->ioaddr = ioaddr; + return 1; + +} + +static struct pci_id r8169_nics[] = { + PCI_ROM(0x10ec, 0x8169, "r8169", "RealTek RTL8169 Gigabit Ethernet"), +}; + +struct pci_driver r8169_driver = { + .type = NIC_DRIVER, + .name = "r8169/PCI", + .probe = r8169_probe, + .ids = r8169_nics, + .id_count = sizeof(r8169_nics) / sizeof(r8169_nics[0]), + .class = 0, +}; diff --git a/usr/src/grub/grub-0.97/netboot/rtl8139.c b/usr/src/grub/grub-0.97/netboot/rtl8139.c new file mode 100644 index 0000000000..59a2601855 --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/rtl8139.c @@ -0,0 +1,551 @@ +/* rtl8139.c - etherboot driver for the Realtek 8139 chipset + + ported from the linux driver written by Donald Becker + by Rainer Bawidamann (Rainer.Bawidamann@informatik.uni-ulm.de) 1999 + + This software may be used and distributed according to the terms + of the GNU Public License, incorporated herein by reference. + + changes to the original driver: + - removed support for interrupts, switching to polling mode (yuck!) + - removed support for the 8129 chip (external MII) + +*/ + +/*********************************************************************/ +/* Revision History */ +/*********************************************************************/ + +/* + 28 Dec 2002 ken_yap@users.sourceforge.net (Ken Yap) + Put in virt_to_bus calls to allow Etherboot relocation. + + 06 Apr 2001 ken_yap@users.sourceforge.net (Ken Yap) + Following email from Hyun-Joon Cha, added a disable routine, otherwise + NIC remains live and can crash the kernel later. + + 4 Feb 2000 espenlaub@informatik.uni-ulm.de (Klaus Espenlaub) + Shuffled things around, removed the leftovers from the 8129 support + that was in the Linux driver and added a bit more 8139 definitions. + Moved the 8K receive buffer to a fixed, available address outside the + 0x98000-0x9ffff range. This is a bit of a hack, but currently the only + way to make room for the Etherboot features that need substantial amounts + of code like the ANSI console support. Currently the buffer is just below + 0x10000, so this even conforms to the tagged boot image specification, + which reserves the ranges 0x00000-0x10000 and 0x98000-0xA0000. My + interpretation of this "reserved" is that Etherboot may do whatever it + likes, as long as its environment is kept intact (like the BIOS + variables). Hopefully fixed rtl_poll() once and for all. The symptoms + were that if Etherboot was left at the boot menu for several minutes, the + first eth_poll failed. Seems like I am the only person who does this. + First of all I fixed the debugging code and then set out for a long bug + hunting session. It took me about a week full time work - poking around + various places in the driver, reading Don Becker's and Jeff Garzik's Linux + driver and even the FreeBSD driver (what a piece of crap!) - and + eventually spotted the nasty thing: the transmit routine was acknowledging + each and every interrupt pending, including the RxOverrun and RxFIFIOver + interrupts. This confused the RTL8139 thoroughly. It destroyed the + Rx ring contents by dumping the 2K FIFO contents right where we wanted to + get the next packet. Oh well, what fun. + + 18 Jan 2000 mdc@thinguin.org (Marty Connor) + Drastically simplified error handling. Basically, if any error + in transmission or reception occurs, the card is reset. + Also, pointed all transmit descriptors to the same buffer to + save buffer space. This should decrease driver size and avoid + corruption because of exceeding 32K during runtime. + + 28 Jul 1999 (Matthias Meixner - meixner@rbg.informatik.tu-darmstadt.de) + rtl_poll was quite broken: it used the RxOK interrupt flag instead + of the RxBufferEmpty flag which often resulted in very bad + transmission performace - below 1kBytes/s. + +*/ + +#include "etherboot.h" +#include "nic.h" +#include "pci.h" +#include "timer.h" + +#define RTL_TIMEOUT (1*TICKS_PER_SEC) + +/* PCI Tuning Parameters + Threshold is bytes transferred to chip before transmission starts. */ +#define TX_FIFO_THRESH 256 /* In bytes, rounded down to 32 byte units. */ +#define RX_FIFO_THRESH 4 /* Rx buffer level before first PCI xfer. */ +#define RX_DMA_BURST 4 /* Maximum PCI burst, '4' is 256 bytes */ +#define TX_DMA_BURST 4 /* Calculate as 16<node_addr; + + /* There are enough "RTL8139" strings on the console already, so + * be brief and concentrate on the interesting pieces of info... */ + printf(" - "); + + /* Mask the bit that says "this is an io addr" */ + nic->ioaddr = pci->ioaddr & ~3; + + /* Copy IRQ from PCI information */ + nic->irqno = pci->irq; + + adjust_pci_device(pci); + + /* Bring the chip out of low-power mode. */ + outb(0x00, nic->ioaddr + Config1); + + addr_len = read_eeprom(nic,0,8) == 0x8129 ? 8 : 6; + for (i = 0; i < 3; i++) + *ap++ = read_eeprom(nic,i + 7,addr_len); + + speed10 = inb(nic->ioaddr + MediaStatus) & MSRSpeed10; + fullduplex = inw(nic->ioaddr + MII_BMCR) & BMCRDuplex; + printf("ioaddr %#hX, irq %d, addr %! %sMbps %s-duplex\n", nic->ioaddr, + nic->irqno, nic->node_addr, speed10 ? "10" : "100", + fullduplex ? "full" : "half"); + + rtl_reset(nic); + + if (inb(nic->ioaddr + MediaStatus) & MSRLinkFail) { + printf("Cable not connected or other link failure\n"); + return(0); + } + + dev->disable = rtl_disable; + nic->poll = rtl_poll; + nic->transmit = rtl_transmit; + nic->irq = rtl_irq; + + return 1; +} + +/* Serial EEPROM section. */ + +/* EEPROM_Ctrl bits. */ +#define EE_SHIFT_CLK 0x04 /* EEPROM shift clock. */ +#define EE_CS 0x08 /* EEPROM chip select. */ +#define EE_DATA_WRITE 0x02 /* EEPROM chip data in. */ +#define EE_WRITE_0 0x00 +#define EE_WRITE_1 0x02 +#define EE_DATA_READ 0x01 /* EEPROM chip data out. */ +#define EE_ENB (0x80 | EE_CS) + +/* + Delay between EEPROM clock transitions. + No extra delay is needed with 33Mhz PCI, but 66Mhz may change this. +*/ + +#define eeprom_delay() inl(ee_addr) + +/* The EEPROM commands include the alway-set leading bit. */ +#define EE_WRITE_CMD (5) +#define EE_READ_CMD (6) +#define EE_ERASE_CMD (7) + +static int read_eeprom(struct nic *nic, int location, int addr_len) +{ + int i; + unsigned int retval = 0; + long ee_addr = nic->ioaddr + Cfg9346; + int read_cmd = location | (EE_READ_CMD << addr_len); + + outb(EE_ENB & ~EE_CS, ee_addr); + outb(EE_ENB, ee_addr); + eeprom_delay(); + + /* Shift the read command bits out. */ + for (i = 4 + addr_len; i >= 0; i--) { + int dataval = (read_cmd & (1 << i)) ? EE_DATA_WRITE : 0; + outb(EE_ENB | dataval, ee_addr); + eeprom_delay(); + outb(EE_ENB | dataval | EE_SHIFT_CLK, ee_addr); + eeprom_delay(); + } + outb(EE_ENB, ee_addr); + eeprom_delay(); + + for (i = 16; i > 0; i--) { + outb(EE_ENB | EE_SHIFT_CLK, ee_addr); + eeprom_delay(); + retval = (retval << 1) | ((inb(ee_addr) & EE_DATA_READ) ? 1 : 0); + outb(EE_ENB, ee_addr); + eeprom_delay(); + } + + /* Terminate the EEPROM access. */ + outb(~EE_CS, ee_addr); + eeprom_delay(); + return retval; +} + +static const unsigned int rtl8139_rx_config = + (RX_BUF_LEN_IDX << 11) | + (RX_FIFO_THRESH << 13) | + (RX_DMA_BURST << 8); + +static void set_rx_mode(struct nic *nic) { + unsigned int mc_filter[2]; + int rx_mode; + /* !IFF_PROMISC */ + rx_mode = AcceptBroadcast | AcceptMulticast | AcceptMyPhys; + mc_filter[1] = mc_filter[0] = 0xffffffff; + + outl(rtl8139_rx_config | rx_mode, nic->ioaddr + RxConfig); + + outl(mc_filter[0], nic->ioaddr + MAR0 + 0); + outl(mc_filter[1], nic->ioaddr + MAR0 + 4); +} + +static void rtl_reset(struct nic* nic) +{ + int i; + + outb(CmdReset, nic->ioaddr + ChipCmd); + + cur_rx = 0; + cur_tx = 0; + + /* Give the chip 10ms to finish the reset. */ + load_timer2(10*TICKS_PER_MS); + while ((inb(nic->ioaddr + ChipCmd) & CmdReset) != 0 && + timer2_running()) + /* wait */; + + for (i = 0; i < ETH_ALEN; i++) + outb(nic->node_addr[i], nic->ioaddr + MAC0 + i); + + /* Must enable Tx/Rx before setting transfer thresholds! */ + outb(CmdRxEnb | CmdTxEnb, nic->ioaddr + ChipCmd); + outl((RX_FIFO_THRESH<<13) | (RX_BUF_LEN_IDX<<11) | (RX_DMA_BURST<<8), + nic->ioaddr + RxConfig); /* accept no frames yet! */ + outl((TX_DMA_BURST<<8)|0x03000000, nic->ioaddr + TxConfig); + + /* The Linux driver changes Config1 here to use a different LED pattern + * for half duplex or full/autodetect duplex (for full/autodetect, the + * outputs are TX/RX, Link10/100, FULL, while for half duplex it uses + * TX/RX, Link100, Link10). This is messy, because it doesn't match + * the inscription on the mounting bracket. It should not be changed + * from the configuration EEPROM default, because the card manufacturer + * should have set that to match the card. */ + +#ifdef DEBUG_RX + printf("rx ring address is %X\n",(unsigned long)rx_ring); +#endif + outl((unsigned long)virt_to_bus(rx_ring), nic->ioaddr + RxBuf); + + + + /* If we add multicast support, the MAR0 register would have to be + * initialized to 0xffffffffffffffff (two 32 bit accesses). Etherboot + * only needs broadcast (for ARP/RARP/BOOTP/DHCP) and unicast. */ + + outb(CmdRxEnb | CmdTxEnb, nic->ioaddr + ChipCmd); + + outl(rtl8139_rx_config, nic->ioaddr + RxConfig); + + /* Start the chip's Tx and Rx process. */ + outl(0, nic->ioaddr + RxMissed); + + /* set_rx_mode */ + set_rx_mode(nic); + + /* Disable all known interrupts by setting the interrupt mask. */ + outw(0, nic->ioaddr + IntrMask); +} + +static void rtl_transmit(struct nic *nic, const char *destaddr, + unsigned int type, unsigned int len, const char *data) +{ + unsigned int status, to, nstype; + unsigned long txstatus; + + /* nstype assignment moved up here to avoid gcc 3.0.3 compiler bug */ + nstype = htons(type); + memcpy(tx_buffer, destaddr, ETH_ALEN); + memcpy(tx_buffer + ETH_ALEN, nic->node_addr, ETH_ALEN); + memcpy(tx_buffer + 2 * ETH_ALEN, &nstype, 2); + memcpy(tx_buffer + ETH_HLEN, data, len); + + len += ETH_HLEN; +#ifdef DEBUG_TX + printf("sending %d bytes ethtype %hX\n", len, type); +#endif + + /* Note: RTL8139 doesn't auto-pad, send minimum payload (another 4 + * bytes are sent automatically for the FCS, totalling to 64 bytes). */ + while (len < ETH_ZLEN) { + tx_buffer[len++] = '\0'; + } + + outl((unsigned long)virt_to_bus(tx_buffer), nic->ioaddr + TxAddr0 + cur_tx*4); + outl(((TX_FIFO_THRESH<<11) & 0x003f0000) | len, + nic->ioaddr + TxStatus0 + cur_tx*4); + + to = currticks() + RTL_TIMEOUT; + + do { + status = inw(nic->ioaddr + IntrStatus); + /* Only acknlowledge interrupt sources we can properly handle + * here - the RxOverflow/RxFIFOOver MUST be handled in the + * rtl_poll() function. */ + outw(status & (TxOK | TxErr | PCIErr), nic->ioaddr + IntrStatus); + if ((status & (TxOK | TxErr | PCIErr)) != 0) break; + } while (currticks() < to); + + txstatus = inl(nic->ioaddr+ TxStatus0 + cur_tx*4); + + if (status & TxOK) { + cur_tx = (cur_tx + 1) % NUM_TX_DESC; +#ifdef DEBUG_TX + printf("tx done (%d ticks), status %hX txstatus %X\n", + to-currticks(), status, txstatus); +#endif + } else { +#ifdef DEBUG_TX + printf("tx timeout/error (%d ticks), status %hX txstatus %X\n", + currticks()-to, status, txstatus); +#endif + rtl_reset(nic); + } +} + +static int rtl_poll(struct nic *nic, int retrieve) +{ + unsigned int status; + unsigned int ring_offs; + unsigned int rx_size, rx_status; + + if (inb(nic->ioaddr + ChipCmd) & RxBufEmpty) { + return 0; + } + + /* There is a packet ready */ + if ( ! retrieve ) return 1; + + status = inw(nic->ioaddr + IntrStatus); + /* See below for the rest of the interrupt acknowledges. */ + outw(status & ~(RxFIFOOver | RxOverflow | RxOK), nic->ioaddr + IntrStatus); + +#ifdef DEBUG_RX + printf("rtl_poll: int %hX ", status); +#endif + + ring_offs = cur_rx % RX_BUF_LEN; + rx_status = *(unsigned int*)(rx_ring + ring_offs); + rx_size = rx_status >> 16; + rx_status &= 0xffff; + + if ((rx_status & (RxBadSymbol|RxRunt|RxTooLong|RxCRCErr|RxBadAlign)) || + (rx_size < ETH_ZLEN) || (rx_size > ETH_FRAME_LEN + 4)) { + printf("rx error %hX\n", rx_status); + rtl_reset(nic); /* this clears all interrupts still pending */ + return 0; + } + + /* Received a good packet */ + nic->packetlen = rx_size - 4; /* no one cares about the FCS */ + if (ring_offs+4+rx_size-4 > RX_BUF_LEN) { + int semi_count = RX_BUF_LEN - ring_offs - 4; + + memcpy(nic->packet, rx_ring + ring_offs + 4, semi_count); + memcpy(nic->packet+semi_count, rx_ring, rx_size-4-semi_count); +#ifdef DEBUG_RX + printf("rx packet %d+%d bytes", semi_count,rx_size-4-semi_count); +#endif + } else { + memcpy(nic->packet, rx_ring + ring_offs + 4, nic->packetlen); +#ifdef DEBUG_RX + printf("rx packet %d bytes", rx_size-4); +#endif + } +#ifdef DEBUG_RX + printf(" at %X type %hhX%hhX rxstatus %hX\n", + (unsigned long)(rx_ring+ring_offs+4), + nic->packet[12], nic->packet[13], rx_status); +#endif + cur_rx = (cur_rx + rx_size + 4 + 3) & ~3; + outw(cur_rx - 16, nic->ioaddr + RxBufPtr); + /* See RTL8139 Programming Guide V0.1 for the official handling of + * Rx overflow situations. The document itself contains basically no + * usable information, except for a few exception handling rules. */ + outw(status & (RxFIFOOver | RxOverflow | RxOK), nic->ioaddr + IntrStatus); + return 1; +} + +static void rtl_irq(struct nic *nic, irq_action_t action) +{ + unsigned int mask; + /* Bit of a guess as to which interrupts we should allow */ + unsigned int interested = ROK | RER | RXOVW | FOVW | SERR; + + switch ( action ) { + case DISABLE : + case ENABLE : + mask = inw(nic->ioaddr + IntrMask); + mask = mask & ~interested; + if ( action == ENABLE ) mask = mask | interested; + outw(mask, nic->ioaddr + IntrMask); + break; + case FORCE : + /* Apparently writing a 1 to this read-only bit of a + * read-only and otherwise unrelated register will + * force an interrupt. If you ever want to see how + * not to write a datasheet, read the one for the + * RTL8139... + */ + outb(EROK, nic->ioaddr + RxEarlyStatus); + break; + } +} + +static void rtl_disable(struct dev *dev) +{ + struct nic *nic = (struct nic *)dev; + /* merge reset and disable */ + rtl_reset(nic); + + /* reset the chip */ + outb(CmdReset, nic->ioaddr + ChipCmd); + + /* 10 ms timeout */ + load_timer2(10*TICKS_PER_MS); + while ((inb(nic->ioaddr + ChipCmd) & CmdReset) != 0 && timer2_running()) + /* wait */; +} + +static struct pci_id rtl8139_nics[] = { +PCI_ROM(0x10ec, 0x8129, "rtl8129", "Realtek 8129"), +PCI_ROM(0x10ec, 0x8139, "rtl8139", "Realtek 8139"), +PCI_ROM(0x10ec, 0x8138, "rtl8139b", "Realtek 8139B"), +PCI_ROM(0x1186, 0x1300, "dfe538", "DFE530TX+/DFE538TX"), +PCI_ROM(0x1113, 0x1211, "smc1211-1", "SMC EZ10/100"), +PCI_ROM(0x1112, 0x1211, "smc1211", "SMC EZ10/100"), +PCI_ROM(0x1500, 0x1360, "delta8139", "Delta Electronics 8139"), +PCI_ROM(0x4033, 0x1360, "addtron8139", "Addtron Technology 8139"), +PCI_ROM(0x1186, 0x1340, "dfe690txd", "D-Link DFE690TXD"), +PCI_ROM(0x13d1, 0xab06, "fe2000vx", "AboCom FE2000VX"), +PCI_ROM(0x1259, 0xa117, "allied8139", "Allied Telesyn 8139"), +PCI_ROM(0x14ea, 0xab06, "fnw3603tx", "Planex FNW-3603-TX"), +PCI_ROM(0x14ea, 0xab07, "fnw3800tx", "Planex FNW-3800-TX"), +PCI_ROM(0xffff, 0x8139, "clone-rtl8139", "Cloned 8139"), +}; + +struct pci_driver rtl8139_driver = { + .type = NIC_DRIVER, + .name = "RTL8139", + .probe = rtl8139_probe, + .ids = rtl8139_nics, + .id_count = sizeof(rtl8139_nics)/sizeof(rtl8139_nics[0]), + .class = 0, +}; diff --git a/usr/src/grub/grub-0.97/netboot/segoff.h b/usr/src/grub/grub-0.97/netboot/segoff.h new file mode 100644 index 0000000000..958de63f43 --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/segoff.h @@ -0,0 +1,43 @@ +/* + * Segment:offset types and macros + * + * Initially written by Michael Brown (mcb30). + */ + +#ifndef SEGOFF_H +#define SEGOFF_H + +#include +#include + +/* Segment:offset structure. Note that the order within the structure + * is offset:segment. + */ +typedef struct { + uint16_t offset; + uint16_t segment; +} segoff_t; + +/* For PXE stuff */ +typedef segoff_t SEGOFF16_t; + +/* Macros for converting from virtual to segment:offset addresses, + * when we don't actually care which of the many isomorphic results we + * get. + */ +#ifdef DEBUG_SEGMENT +uint16_t SEGMENT ( const void * const ptr ) { + uint32_t phys = virt_to_phys ( ptr ); + if ( phys > 0xfffff ) { + printf ( "FATAL ERROR: segment address out of range\n" ); + } + return phys >> 4; +} +#else +#define SEGMENT(x) ( virt_to_phys ( x ) >> 4 ) +#endif +#define OFFSET(x) ( virt_to_phys ( x ) & 0xf ) +#define SEGOFF(x) { OFFSET(x), SEGMENT(x) } +#define VIRTUAL(x,y) ( phys_to_virt ( ( ( x ) << 4 ) + ( y ) ) ) + +#endif /* SEGOFF_H */ diff --git a/usr/src/grub/grub-0.97/netboot/sis900.c b/usr/src/grub/grub-0.97/netboot/sis900.c new file mode 100644 index 0000000000..6d5d2c769e --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/sis900.c @@ -0,0 +1,1251 @@ +/* -*- Mode:C; c-basic-offset:4; -*- */ + +/* + sis900.c: An SiS 900/7016 PCI Fast Ethernet driver for Etherboot + Copyright (C) 2001 Entity Cyber, Inc. + + Revision: 1.0 March 1, 2001 + + Author: Marty Connor (mdc@thinguin.org) + + Adapted from a Linux driver which was written by Donald Becker + and modified by Ollie Lho and Chin-Shan Li of SiS Corporation. + Rewritten for Etherboot by Marty Connor. + + This software may be used and distributed according to the terms + of the GNU Public License (GPL), incorporated herein by reference. + + References: + SiS 7016 Fast Ethernet PCI Bus 10/100 Mbps LAN Controller with OnNow Support, + preliminary Rev. 1.0 Jan. 14, 1998 + SiS 900 Fast Ethernet PCI Bus 10/100 Mbps LAN Single Chip with OnNow Support, + preliminary Rev. 1.0 Nov. 10, 1998 + SiS 7014 Single Chip 100BASE-TX/10BASE-T Physical Layer Solution, + preliminary Rev. 1.0 Jan. 18, 1998 + http://www.sis.com.tw/support/databook.htm */ + +/* Revision History */ + +/* + 07 Dec 2003 timlegge - Enabled Multicast Support + 06 Dec 2003 timlegge - Fixed relocation issue in 5.2 + 04 Jan 2002 Chien-Yu Chen, Doug Ambrisko, Marty Connor Patch to Etherboot 5.0.5 + Added support for the SiS 630ET plus various bug fixes from linux kernel + source 2.4.17. + 01 March 2001 mdc 1.0 + Initial Release. Tested with PCI based sis900 card and ThinkNIC + computer. + 20 March 2001 P.Koegel + added support for sis630e and PHY ICS1893 and RTL8201 + Testet with SIS730S chipset + ICS1893 +*/ + +/* Includes */ + +#include "etherboot.h" +#include "nic.h" +#include "pci.h" +#include "timer.h" + +#include "sis900.h" + +/* Globals */ + +static int sis900_debug = 0; + +static unsigned short vendor, dev_id; +static unsigned long ioaddr; +static u8 pci_revision; + +static unsigned int cur_phy; + +static unsigned int cur_rx; + +static BufferDesc txd; +static BufferDesc rxd[NUM_RX_DESC]; +static unsigned char txb[TX_BUF_SIZE]; +static unsigned char rxb[NUM_RX_DESC * RX_BUF_SIZE]; + +#if 0 +static struct mac_chip_info { + const char *name; + u16 vendor_id, device_id, flags; + int io_size; +} mac_chip_table[] = { + { "SiS 900 PCI Fast Ethernet", PCI_VENDOR_ID_SIS, PCI_DEVICE_ID_SIS900, + PCI_COMMAND_IO|PCI_COMMAND_MASTER, SIS900_TOTAL_SIZE}, + { "SiS 7016 PCI Fast Ethernet",PCI_VENDOR_ID_SIS, PCI_DEVICE_ID_SIS7016, + PCI_COMMAND_IO|PCI_COMMAND_MASTER, SIS900_TOTAL_SIZE}, + {0,0,0,0,0} /* 0 terminated list. */ +}; +#endif + +static void sis900_read_mode(struct nic *nic, int phy_addr, int *speed, int *duplex); +static void amd79c901_read_mode(struct nic *nic, int phy_addr, int *speed, int *duplex); +static void ics1893_read_mode(struct nic *nic, int phy_addr, int *speed, int *duplex); +static void rtl8201_read_mode(struct nic *nic, int phy_addr, int *speed, int *duplex); +static void vt6103_read_mode(struct nic *nic, int phy_addr, int *speed, int *duplex); + +static struct mii_chip_info { + const char * name; + u16 phy_id0; + u16 phy_id1; + void (*read_mode) (struct nic *nic, int phy_addr, int *speed, int *duplex); +} mii_chip_table[] = { + {"SiS 900 Internal MII PHY", 0x001d, 0x8000, sis900_read_mode}, + {"SiS 7014 Physical Layer Solution", 0x0016, 0xf830,sis900_read_mode}, + {"AMD 79C901 10BASE-T PHY", 0x0000, 0x35b9, amd79c901_read_mode}, + {"AMD 79C901 HomePNA PHY", 0x0000, 0x35c8, amd79c901_read_mode}, + {"ICS 1893 Integrated PHYceiver" , 0x0015, 0xf441,ics1893_read_mode}, + {"RTL 8201 10/100Mbps Phyceiver" , 0x0000, 0x8201,rtl8201_read_mode}, + {"VIA 6103 10/100Mbps Phyceiver", 0x0101, 0x8f20,vt6103_read_mode}, + {0,0,0,0} +}; + +static struct mii_phy { + struct mii_phy * next; + struct mii_chip_info * chip_info; + int phy_addr; + u16 status; +} mii; + +// PCI to ISA bridge for SIS640E access +static struct pci_id pci_isa_bridge_list[] = { + { 0x1039, 0x0008, + "SIS 85C503/5513 PCI to ISA bridge"}, +}; + +struct pci_driver sis_bridge_driver = { + .type = BRIDGE_DRIVER, + .name = "", + .probe = 0, + .ids = pci_isa_bridge_list, + .id_count = sizeof(pci_isa_bridge_list)/sizeof(pci_isa_bridge_list[0]), + .class = 0, +}; + +/* Function Prototypes */ + +static int sis900_probe(struct dev *dev, struct pci_device *pci); + +static u16 sis900_read_eeprom(int location); +static void sis900_mdio_reset(long mdio_addr); +static void sis900_mdio_idle(long mdio_addr); +static u16 sis900_mdio_read(int phy_id, int location); +#if 0 +static void sis900_mdio_write(int phy_id, int location, int val); +#endif +static void sis900_init(struct nic *nic); + +static void sis900_reset(struct nic *nic); + +static void sis900_init_rxfilter(struct nic *nic); +static void sis900_init_txd(struct nic *nic); +static void sis900_init_rxd(struct nic *nic); +static void sis900_set_rx_mode(struct nic *nic); +static void sis900_check_mode(struct nic *nic); + +static void sis900_transmit(struct nic *nic, const char *d, + unsigned int t, unsigned int s, const char *p); +static int sis900_poll(struct nic *nic, int retrieve); + +static void sis900_disable(struct dev *dev); + +static void sis900_irq(struct nic *nic, irq_action_t action); + +/** + * sis900_get_mac_addr: - Get MAC address for stand alone SiS900 model + * @pci_dev: the sis900 pci device + * @net_dev: the net device to get address for + * + * Older SiS900 and friends, use EEPROM to store MAC address. + * MAC address is read from read_eeprom() into @net_dev->dev_addr. + */ + +static int sis900_get_mac_addr(struct pci_device * pci_dev __unused, struct nic *nic) +{ + u16 signature; + int i; + + /* check to see if we have sane EEPROM */ + signature = (u16) sis900_read_eeprom( EEPROMSignature); + if (signature == 0xffff || signature == 0x0000) { + printf ("sis900_probe: Error EERPOM read %hX\n", signature); + return 0; + } + + /* get MAC address from EEPROM */ + for (i = 0; i < 3; i++) + ((u16 *)(nic->node_addr))[i] = sis900_read_eeprom(i+EEPROMMACAddr); + return 1; +} + +/** + * sis96x_get_mac_addr: - Get MAC address for SiS962 or SiS963 model + * @pci_dev: the sis900 pci device + * @net_dev: the net device to get address for + * + * SiS962 or SiS963 model, use EEPROM to store MAC address. And EEPROM + * is shared by + * LAN and 1394. When access EEPROM, send EEREQ signal to hardware first + * and wait for EEGNT. If EEGNT is ON, EEPROM is permitted to be access + * by LAN, otherwise is not. After MAC address is read from EEPROM, send + * EEDONE signal to refuse EEPROM access by LAN. + * The EEPROM map of SiS962 or SiS963 is different to SiS900. + * The signature field in SiS962 or SiS963 spec is meaningless. + * MAC address is read into @net_dev->dev_addr. + */ + +static int sis96x_get_mac_addr(struct pci_device * pci_dev __unused, struct nic *nic) +{ +/* long ioaddr = net_dev->base_addr; */ + long ee_addr = ioaddr + mear; + u32 waittime = 0; + int i; + + printf("Alternate function\n"); + + outl(EEREQ, ee_addr); + while(waittime < 2000) { + if(inl(ee_addr) & EEGNT) { + + /* get MAC address from EEPROM */ + for (i = 0; i < 3; i++) + ((u16 *)(nic->node_addr))[i] = sis900_read_eeprom(i+EEPROMMACAddr); + + outl(EEDONE, ee_addr); + return 1; + } else { + udelay(1); + waittime ++; + } + } + outl(EEDONE, ee_addr); + return 0; +} + +/** + * sis630e_get_mac_addr: - Get MAC address for SiS630E model + * @pci_dev: the sis900 pci device + * @net_dev: the net device to get address for + * + * SiS630E model, use APC CMOS RAM to store MAC address. + * APC CMOS RAM is accessed through ISA bridge. + * MAC address is read into @net_dev->dev_addr. + */ + +static int sis630e_get_mac_addr(struct pci_device * pci_dev __unused, struct nic *nic) +{ + u8 reg; + int i; + struct pci_device p[1]; + + /* find PCI to ISA bridge */ + memset(p, 0, sizeof(p)); + do { + find_pci(BRIDGE_DRIVER, p); + } while(p->driver && p->driver != &sis_bridge_driver); + + /* error on failure */ + if (!p->driver) + return 0; + + pcibios_read_config_byte(p->bus,p->devfn, 0x48, ®); + pcibios_write_config_byte(p->bus,p->devfn, 0x48, reg | 0x40); + + for (i = 0; i < ETH_ALEN; i++) + { + outb(0x09 + i, 0x70); + ((u8 *)(nic->node_addr))[i] = inb(0x71); + } + pcibios_write_config_byte(p->bus,p->devfn, 0x48, reg & ~0x40); + + return 1; +} + +/** + * sis630e_get_mac_addr: - Get MAC address for SiS630E model + * @pci_dev: the sis900 pci device + * @net_dev: the net device to get address for + * + * SiS630E model, use APC CMOS RAM to store MAC address. + * APC CMOS RAM is accessed through ISA bridge. + * MAC address is read into @net_dev->dev_addr. + */ + +static int sis635_get_mac_addr(struct pci_device * pci_dev __unused, struct nic *nic) +{ + u32 rfcrSave; + u32 i; + + + rfcrSave = inl(rfcr + ioaddr); + + outl(rfcrSave | RELOAD, ioaddr + cr); + outl(0, ioaddr + cr); + + /* disable packet filtering before setting filter */ + outl(rfcrSave & ~RFEN, rfcr + ioaddr); + + /* load MAC addr to filter data register */ + for (i = 0 ; i < 3 ; i++) { + outl((i << RFADDR_shift), ioaddr + rfcr); + *( ((u16 *)nic->node_addr) + i) = inw(ioaddr + rfdr); + } + + /* enable packet filitering */ + outl(rfcrSave | RFEN, rfcr + ioaddr); + + return 1; +} + +/* + * Function: sis900_probe + * + * Description: initializes initializes the NIC, retrieves the + * MAC address of the card, and sets up some globals required by + * other routines. + * + * Side effects: + * leaves the ioaddress of the sis900 chip in the variable ioaddr. + * leaves the sis900 initialized, and ready to recieve packets. + * + * Returns: struct nic *: pointer to NIC data structure + */ + +static int sis900_probe(struct dev *dev, struct pci_device *pci) +{ + struct nic *nic = (struct nic *)dev; + int i; + int found=0; + int phy_addr; + u8 revision; + int ret; + + if (pci->ioaddr == 0) + return 0; + + nic->irqno = 0; + nic->ioaddr = pci->ioaddr & ~3; + ioaddr = pci->ioaddr & ~3; + vendor = pci->vendor; + dev_id = pci->dev_id; + + /* wakeup chip */ + pcibios_write_config_dword(pci->bus, pci->devfn, 0x40, 0x00000000); + + adjust_pci_device(pci); + + /* get MAC address */ + ret = 0; + pcibios_read_config_byte(pci->bus,pci->devfn, PCI_REVISION, &revision); + + /* save for use later in sis900_reset() */ + pci_revision = revision; + + if (revision == SIS630E_900_REV) + ret = sis630e_get_mac_addr(pci, nic); + else if ((revision > 0x81) && (revision <= 0x90)) + ret = sis635_get_mac_addr(pci, nic); + else if (revision == SIS96x_900_REV) + ret = sis96x_get_mac_addr(pci, nic); + else + ret = sis900_get_mac_addr(pci, nic); + + if (ret == 0) + { + printf ("sis900_probe: Error MAC address not found\n"); + return 0; + } + + /* 630ET : set the mii access mode as software-mode */ + if (revision == SIS630ET_900_REV) + outl(ACCESSMODE | inl(ioaddr + cr), ioaddr + cr); + + printf("\nsis900_probe: MAC addr %! at ioaddr %#hX\n", + nic->node_addr, ioaddr); + printf("sis900_probe: Vendor:%#hX Device:%#hX\n", vendor, dev_id); + + /* probe for mii transceiver */ + /* search for total of 32 possible mii phy addresses */ + + found = 0; + for (phy_addr = 0; phy_addr < 32; phy_addr++) { + u16 mii_status; + u16 phy_id0, phy_id1; + + mii_status = sis900_mdio_read(phy_addr, MII_STATUS); + if (mii_status == 0xffff || mii_status == 0x0000) + /* the mii is not accessable, try next one */ + continue; + + phy_id0 = sis900_mdio_read(phy_addr, MII_PHY_ID0); + phy_id1 = sis900_mdio_read(phy_addr, MII_PHY_ID1); + + /* search our mii table for the current mii */ + for (i = 0; mii_chip_table[i].phy_id1; i++) { + + if (phy_id0 == mii_chip_table[i].phy_id0) { + + printf("sis900_probe: %s transceiver found at address %d.\n", + mii_chip_table[i].name, phy_addr); + + mii.chip_info = &mii_chip_table[i]; + mii.phy_addr = phy_addr; + mii.status = sis900_mdio_read(phy_addr, MII_STATUS); + mii.next = NULL; + + found=1; + break; + } + } + } + + if (found == 0) { + printf("sis900_probe: No MII transceivers found!\n"); + return 0; + } + + /* Arbitrarily select the last PHY found as current PHY */ + cur_phy = mii.phy_addr; + printf("sis900_probe: Using %s as default\n", mii.chip_info->name); + + /* initialize device */ + sis900_init(nic); + + dev->disable = sis900_disable; + nic->poll = sis900_poll; + nic->transmit = sis900_transmit; + nic->irq = sis900_irq; + + return 1; +} + +/* + * EEPROM Routines: These functions read and write to EEPROM for + * retrieving the MAC address and other configuration information about + * the card. + */ + +/* Delay between EEPROM clock transitions. */ +#define eeprom_delay() inl(ee_addr) + +/* Function: sis900_read_eeprom + * + * Description: reads and returns a given location from EEPROM + * + * Arguments: int location: requested EEPROM location + * + * Returns: u16: contents of requested EEPROM location + * + */ + +/* Read Serial EEPROM through EEPROM Access Register, Note that location is + in word (16 bits) unit */ +static u16 sis900_read_eeprom(int location) +{ + int i; + u16 retval = 0; + long ee_addr = ioaddr + mear; + u32 read_cmd = location | EEread; + + outl(0, ee_addr); + eeprom_delay(); + outl(EECLK, ee_addr); + eeprom_delay(); + + /* Shift the read command (9) bits out. */ + for (i = 8; i >= 0; i--) { + u32 dataval = (read_cmd & (1 << i)) ? EEDI | EECS : EECS; + outl(dataval, ee_addr); + eeprom_delay(); + outl(dataval | EECLK, ee_addr); + eeprom_delay(); + } + outb(EECS, ee_addr); + eeprom_delay(); + + /* read the 16-bits data in */ + for (i = 16; i > 0; i--) { + outl(EECS, ee_addr); + eeprom_delay(); + outl(EECS | EECLK, ee_addr); + eeprom_delay(); + retval = (retval << 1) | ((inl(ee_addr) & EEDO) ? 1 : 0); + eeprom_delay(); + } + + /* Terminate the EEPROM access. */ + outl(0, ee_addr); + eeprom_delay(); + outl(EECLK, ee_addr); + + return (retval); +} + +#define sis900_mdio_delay() inl(mdio_addr) + +/* + Read and write the MII management registers using software-generated + serial MDIO protocol. Note that the command bits and data bits are + send out seperately +*/ + +static void sis900_mdio_idle(long mdio_addr) +{ + outl(MDIO | MDDIR, mdio_addr); + sis900_mdio_delay(); + outl(MDIO | MDDIR | MDC, mdio_addr); +} + +/* Syncronize the MII management interface by shifting 32 one bits out. */ +static void sis900_mdio_reset(long mdio_addr) +{ + int i; + + for (i = 31; i >= 0; i--) { + outl(MDDIR | MDIO, mdio_addr); + sis900_mdio_delay(); + outl(MDDIR | MDIO | MDC, mdio_addr); + sis900_mdio_delay(); + } + return; +} + +static u16 sis900_mdio_read(int phy_id, int location) +{ + long mdio_addr = ioaddr + mear; + int mii_cmd = MIIread|(phy_id<= 0; i--) { + int dataval = (mii_cmd & (1 << i)) ? MDDIR | MDIO : MDDIR; + outl(dataval, mdio_addr); + sis900_mdio_delay(); + outl(dataval | MDC, mdio_addr); + sis900_mdio_delay(); + } + + /* Read the 16 data bits. */ + for (i = 16; i > 0; i--) { + outl(0, mdio_addr); + sis900_mdio_delay(); + retval = (retval << 1) | ((inl(mdio_addr) & MDIO) ? 1 : 0); + outl(MDC, mdio_addr); + sis900_mdio_delay(); + } + outl(0x00, mdio_addr); + return retval; +} + +#if 0 +static void sis900_mdio_write(int phy_id, int location, int value) +{ + long mdio_addr = ioaddr + mear; + int mii_cmd = MIIwrite|(phy_id<= 0; i--) { + int dataval = (mii_cmd & (1 << i)) ? MDDIR | MDIO : MDDIR; + outb(dataval, mdio_addr); + sis900_mdio_delay(); + outb(dataval | MDC, mdio_addr); + sis900_mdio_delay(); + } + sis900_mdio_delay(); + + /* Shift the value bits out. */ + for (i = 15; i >= 0; i--) { + int dataval = (value & (1 << i)) ? MDDIR | MDIO : MDDIR; + outl(dataval, mdio_addr); + sis900_mdio_delay(); + outl(dataval | MDC, mdio_addr); + sis900_mdio_delay(); + } + sis900_mdio_delay(); + + /* Clear out extra bits. */ + for (i = 2; i > 0; i--) { + outb(0, mdio_addr); + sis900_mdio_delay(); + outb(MDC, mdio_addr); + sis900_mdio_delay(); + } + outl(0x00, mdio_addr); + return; +} +#endif + +/* Function: sis900_init + * + * Description: resets the ethernet controller chip and various + * data structures required for sending and receiving packets. + * + * Arguments: struct nic *nic: NIC data structure + * + * returns: void. + */ + +static void +sis900_init(struct nic *nic) +{ + /* Soft reset the chip. */ + sis900_reset(nic); + + sis900_init_rxfilter(nic); + + sis900_init_txd(nic); + sis900_init_rxd(nic); + + sis900_set_rx_mode(nic); + + sis900_check_mode(nic); + + outl(RxENA| inl(ioaddr + cr), ioaddr + cr); +} + +/* + * Function: sis900_reset + * + * Description: disables interrupts and soft resets the controller chip + * + * Arguments: struct nic *nic: NIC data structure + * + * Returns: void. + */ + +static void +sis900_reset(struct nic *nic __unused) +{ + int i = 0; + u32 status = TxRCMP | RxRCMP; + + outl(0, ioaddr + ier); + outl(0, ioaddr + imr); + outl(0, ioaddr + rfcr); + + outl(RxRESET | TxRESET | RESET | inl(ioaddr + cr), ioaddr + cr); + + /* Check that the chip has finished the reset. */ + while (status && (i++ < 1000)) { + status ^= (inl(isr + ioaddr) & status); + } + + if( (pci_revision == SIS635A_900_REV) || (pci_revision == SIS900B_900_REV) ) + outl(PESEL | RND_CNT, ioaddr + cfg); + else + outl(PESEL, ioaddr + cfg); +} + +/* Function: sis_init_rxfilter + * + * Description: sets receive filter address to our MAC address + * + * Arguments: struct nic *nic: NIC data structure + * + * returns: void. + */ + +static void +sis900_init_rxfilter(struct nic *nic) +{ + u32 rfcrSave; + int i; + + rfcrSave = inl(rfcr + ioaddr); + + /* disable packet filtering before setting filter */ + outl(rfcrSave & ~RFEN, rfcr + ioaddr); + + /* load MAC addr to filter data register */ + for (i = 0 ; i < 3 ; i++) { + u32 w; + + w = (u32) *((u16 *)(nic->node_addr)+i); + outl((i << RFADDR_shift), ioaddr + rfcr); + outl(w, ioaddr + rfdr); + + if (sis900_debug > 0) + printf("sis900_init_rxfilter: Receive Filter Addrss[%d]=%X\n", + i, inl(ioaddr + rfdr)); + } + + /* enable packet filitering */ + outl(rfcrSave | RFEN, rfcr + ioaddr); +} + +/* + * Function: sis_init_txd + * + * Description: initializes the Tx descriptor + * + * Arguments: struct nic *nic: NIC data structure + * + * returns: void. + */ + +static void +sis900_init_txd(struct nic *nic __unused) +{ + txd.link = (u32) 0; + txd.cmdsts = (u32) 0; + txd.bufptr = virt_to_bus(&txb[0]); + + /* load Transmit Descriptor Register */ + outl(virt_to_bus(&txd), ioaddr + txdp); + if (sis900_debug > 0) + printf("sis900_init_txd: TX descriptor register loaded with: %X\n", + inl(ioaddr + txdp)); +} + +/* Function: sis_init_rxd + * + * Description: initializes the Rx descriptor ring + * + * Arguments: struct nic *nic: NIC data structure + * + * Returns: void. + */ + +static void +sis900_init_rxd(struct nic *nic __unused) +{ + int i; + + cur_rx = 0; + + /* init RX descriptor */ + for (i = 0; i < NUM_RX_DESC; i++) { + rxd[i].link = virt_to_bus((i+1 < NUM_RX_DESC) ? &rxd[i+1] : &rxd[0]); + rxd[i].cmdsts = (u32) RX_BUF_SIZE; + rxd[i].bufptr = virt_to_bus(&rxb[i*RX_BUF_SIZE]); + if (sis900_debug > 0) + printf("sis900_init_rxd: rxd[%d]=%X link=%X cmdsts=%X bufptr=%X\n", + i, &rxd[i], rxd[i].link, rxd[i].cmdsts, rxd[i].bufptr); + } + + /* load Receive Descriptor Register */ + outl(virt_to_bus(&rxd[0]), ioaddr + rxdp); + + if (sis900_debug > 0) + printf("sis900_init_rxd: RX descriptor register loaded with: %X\n", + inl(ioaddr + rxdp)); + +} + +/* Function: sis_init_rxd + * + * Description: + * sets the receive mode to accept all broadcast packets and packets + * with our MAC address, and reject all multicast packets. + * + * Arguments: struct nic *nic: NIC data structure + * + * Returns: void. + */ + +static void sis900_set_rx_mode(struct nic *nic __unused) +{ + int i, table_entries; + u32 rx_mode; + u16 mc_filter[16] = {0}; /* 256/128 bits multicast hash table */ + + if((pci_revision == SIS635A_900_REV) || (pci_revision == SIS900B_900_REV)) + table_entries = 16; + else + table_entries = 8; + + /* accept all multicast packet */ + rx_mode = RFAAB | RFAAM; + for (i = 0; i < table_entries; i++) + mc_filter[i] = 0xffff; + + /* update Multicast Hash Table in Receive Filter */ + for (i = 0; i < table_entries; i++) { + /* why plus 0x04? That makes the correct value for hash table. */ + outl((u32)(0x00000004+i) << RFADDR_shift, ioaddr + rfcr); + outl(mc_filter[i], ioaddr + rfdr); + } + + /* Accept Broadcast and multicast packets, destination addresses that match + our MAC address */ + outl(RFEN | rx_mode, ioaddr + rfcr); + + return; +} + +/* Function: sis900_check_mode + * + * Description: checks the state of transmit and receive + * parameters on the NIC, and updates NIC registers to match + * + * Arguments: struct nic *nic: NIC data structure + * + * Returns: void. + */ + +static void +sis900_check_mode(struct nic *nic) +{ + int speed, duplex; + u32 tx_flags = 0, rx_flags = 0; + + mii.chip_info->read_mode(nic, cur_phy, &speed, &duplex); + + if( inl(ioaddr + cfg) & EDB_MASTER_EN ) { + tx_flags = TxATP | (DMA_BURST_64 << TxMXDMA_shift) | (TX_FILL_THRESH << TxFILLT_shift); + rx_flags = DMA_BURST_64 << RxMXDMA_shift; + } + else { + tx_flags = TxATP | (DMA_BURST_512 << TxMXDMA_shift) | (TX_FILL_THRESH << TxFILLT_shift); + rx_flags = DMA_BURST_512 << RxMXDMA_shift; + } + + if (speed == HW_SPEED_HOME || speed == HW_SPEED_10_MBPS) { + rx_flags |= (RxDRNT_10 << RxDRNT_shift); + tx_flags |= (TxDRNT_10 << TxDRNT_shift); + } + else { + rx_flags |= (RxDRNT_100 << RxDRNT_shift); + tx_flags |= (TxDRNT_100 << TxDRNT_shift); + } + + if (duplex == FDX_CAPABLE_FULL_SELECTED) { + tx_flags |= (TxCSI | TxHBI); + rx_flags |= RxATX; + } + + outl (tx_flags, ioaddr + txcfg); + outl (rx_flags, ioaddr + rxcfg); +} + +/* Function: sis900_read_mode + * + * Description: retrieves and displays speed and duplex + * parameters from the NIC + * + * Arguments: struct nic *nic: NIC data structure + * + * Returns: void. + */ + +static void +sis900_read_mode(struct nic *nic __unused, int phy_addr, int *speed, int *duplex) +{ + int i = 0; + u32 status; + u16 phy_id0, phy_id1; + + /* STSOUT register is Latched on Transition, read operation updates it */ + while (i++ < 2) + status = sis900_mdio_read(phy_addr, MII_STSOUT); + + *speed = HW_SPEED_10_MBPS; + *duplex = FDX_CAPABLE_HALF_SELECTED; + + if (status & (MII_NWAY_TX | MII_NWAY_TX_FDX)) + *speed = HW_SPEED_100_MBPS; + if (status & ( MII_NWAY_TX_FDX | MII_NWAY_T_FDX)) + *duplex = FDX_CAPABLE_FULL_SELECTED; + + /* Workaround for Realtek RTL8201 PHY issue */ + phy_id0 = sis900_mdio_read(phy_addr, MII_PHY_ID0); + phy_id1 = sis900_mdio_read(phy_addr, MII_PHY_ID1); + if((phy_id0 == 0x0000) && ((phy_id1 & 0xFFF0) == 0x8200)){ + if(sis900_mdio_read(phy_addr, MII_CONTROL) & MII_CNTL_FDX) + *duplex = FDX_CAPABLE_FULL_SELECTED; + if(sis900_mdio_read(phy_addr, 0x0019) & 0x01) + *speed = HW_SPEED_100_MBPS; + } + + if (status & MII_STSOUT_LINK_FAIL) + printf("sis900_read_mode: Media Link Off\n"); + else + printf("sis900_read_mode: Media Link On %s %s-duplex \n", + *speed == HW_SPEED_100_MBPS ? + "100mbps" : "10mbps", + *duplex == FDX_CAPABLE_FULL_SELECTED ? + "full" : "half"); +} + +/* Function: amd79c901_read_mode + * + * Description: retrieves and displays speed and duplex + * parameters from the NIC + * + * Arguments: struct nic *nic: NIC data structure + * + * Returns: void. + */ + +static void +amd79c901_read_mode(struct nic *nic __unused, int phy_addr, int *speed, int *duplex) +{ + int i; + u16 status; + + for (i = 0; i < 2; i++) + status = sis900_mdio_read(phy_addr, MII_STATUS); + + if (status & MII_STAT_CAN_AUTO) { + /* 10BASE-T PHY */ + for (i = 0; i < 2; i++) + status = sis900_mdio_read(phy_addr, MII_STATUS_SUMMARY); + if (status & MII_STSSUM_SPD) + *speed = HW_SPEED_100_MBPS; + else + *speed = HW_SPEED_10_MBPS; + if (status & MII_STSSUM_DPLX) + *duplex = FDX_CAPABLE_FULL_SELECTED; + else + *duplex = FDX_CAPABLE_HALF_SELECTED; + + if (status & MII_STSSUM_LINK) + printf("amd79c901_read_mode: Media Link On %s %s-duplex \n", + *speed == HW_SPEED_100_MBPS ? + "100mbps" : "10mbps", + *duplex == FDX_CAPABLE_FULL_SELECTED ? + "full" : "half"); + else + printf("amd79c901_read_mode: Media Link Off\n"); + } + else { + /* HomePNA */ + *speed = HW_SPEED_HOME; + *duplex = FDX_CAPABLE_HALF_SELECTED; + if (status & MII_STAT_LINK) + printf("amd79c901_read_mode:Media Link On 1mbps half-duplex \n"); + else + printf("amd79c901_read_mode: Media Link Off\n"); + } +} + +/** + * ics1893_read_mode: - read media mode for ICS1893 PHY + * @net_dev: the net device to read mode for + * @phy_addr: mii phy address + * @speed: the transmit speed to be determined + * @duplex: the duplex mode to be determined + * + * ICS1893 PHY use Quick Poll Detailed Status register + * to determine the speed and duplex mode for sis900 + */ + +static void ics1893_read_mode(struct nic *nic __unused, int phy_addr, int *speed, int *duplex) +{ + int i = 0; + u32 status; + + /* MII_QPDSTS is Latched, read twice in succession will reflect the current state */ + for (i = 0; i < 2; i++) + status = sis900_mdio_read(phy_addr, MII_QPDSTS); + + if (status & MII_STSICS_SPD) + *speed = HW_SPEED_100_MBPS; + else + *speed = HW_SPEED_10_MBPS; + + if (status & MII_STSICS_DPLX) + *duplex = FDX_CAPABLE_FULL_SELECTED; + else + *duplex = FDX_CAPABLE_HALF_SELECTED; + + if (status & MII_STSICS_LINKSTS) + printf("ics1893_read_mode: Media Link On %s %s-duplex \n", + *speed == HW_SPEED_100_MBPS ? + "100mbps" : "10mbps", + *duplex == FDX_CAPABLE_FULL_SELECTED ? + "full" : "half"); + else + printf("ics1893_read_mode: Media Link Off\n"); +} + +/** + * rtl8201_read_mode: - read media mode for rtl8201 phy + * @nic: the net device to read mode for + * @phy_addr: mii phy address + * @speed: the transmit speed to be determined + * @duplex: the duplex mode to be determined + * + * read MII_STATUS register from rtl8201 phy + * to determine the speed and duplex mode for sis900 + */ + +static void rtl8201_read_mode(struct nic *nic __unused, int phy_addr, int *speed, int *duplex) +{ + u32 status; + + status = sis900_mdio_read(phy_addr, MII_STATUS); + + if (status & MII_STAT_CAN_TX_FDX) { + *speed = HW_SPEED_100_MBPS; + *duplex = FDX_CAPABLE_FULL_SELECTED; + } + else if (status & MII_STAT_CAN_TX) { + *speed = HW_SPEED_100_MBPS; + *duplex = FDX_CAPABLE_HALF_SELECTED; + } + else if (status & MII_STAT_CAN_T_FDX) { + *speed = HW_SPEED_10_MBPS; + *duplex = FDX_CAPABLE_FULL_SELECTED; + } + else if (status & MII_STAT_CAN_T) { + *speed = HW_SPEED_10_MBPS; + *duplex = FDX_CAPABLE_HALF_SELECTED; + } + + if (status & MII_STAT_LINK) + printf("rtl8201_read_mode: Media Link On %s %s-duplex \n", + *speed == HW_SPEED_100_MBPS ? + "100mbps" : "10mbps", + *duplex == FDX_CAPABLE_FULL_SELECTED ? + "full" : "half"); + else + printf("rtl8201_read_config_mode: Media Link Off\n"); +} + +/** + * vt6103_read_mode: - read media mode for vt6103 phy + * @nic: the net device to read mode for + * @phy_addr: mii phy address + * @speed: the transmit speed to be determined + * @duplex: the duplex mode to be determined + * + * read MII_STATUS register from rtl8201 phy + * to determine the speed and duplex mode for sis900 + */ + +static void vt6103_read_mode(struct nic *nic __unused, int phy_addr, int *speed, int *duplex) +{ + u32 status; + + status = sis900_mdio_read(phy_addr, MII_STATUS); + + if (status & MII_STAT_CAN_TX_FDX) { + *speed = HW_SPEED_100_MBPS; + *duplex = FDX_CAPABLE_FULL_SELECTED; + } + else if (status & MII_STAT_CAN_TX) { + *speed = HW_SPEED_100_MBPS; + *duplex = FDX_CAPABLE_HALF_SELECTED; + } + else if (status & MII_STAT_CAN_T_FDX) { + *speed = HW_SPEED_10_MBPS; + *duplex = FDX_CAPABLE_FULL_SELECTED; + } + else if (status & MII_STAT_CAN_T) { + *speed = HW_SPEED_10_MBPS; + *duplex = FDX_CAPABLE_HALF_SELECTED; + } + + if (status & MII_STAT_LINK) + printf("vt6103_read_mode: Media Link On %s %s-duplex \n", + *speed == HW_SPEED_100_MBPS ? + "100mbps" : "10mbps", + *duplex == FDX_CAPABLE_FULL_SELECTED ? + "full" : "half"); + else + printf("vt6103_read_config_mode: Media Link Off\n"); +} + +/* Function: sis900_transmit + * + * Description: transmits a packet and waits for completion or timeout. + * + * Arguments: char d[6]: destination ethernet address. + * unsigned short t: ethernet protocol type. + * unsigned short s: size of the data-part of the packet. + * char *p: the data for the packet. + * + * Returns: void. + */ + +static void +sis900_transmit(struct nic *nic, + const char *d, /* Destination */ + unsigned int t, /* Type */ + unsigned int s, /* size */ + const char *p) /* Packet */ +{ + u32 to, nstype; + u32 tx_status; + + /* Stop the transmitter */ + outl(TxDIS | inl(ioaddr + cr), ioaddr + cr); + + /* load Transmit Descriptor Register */ + outl(virt_to_bus(&txd), ioaddr + txdp); + if (sis900_debug > 1) + printf("sis900_transmit: TX descriptor register loaded with: %X\n", + inl(ioaddr + txdp)); + + memcpy(txb, d, ETH_ALEN); + memcpy(txb + ETH_ALEN, nic->node_addr, ETH_ALEN); + nstype = htons(t); + memcpy(txb + 2 * ETH_ALEN, (char*)&nstype, 2); + memcpy(txb + ETH_HLEN, p, s); + + s += ETH_HLEN; + s &= DSIZE; + + if (sis900_debug > 1) + printf("sis900_transmit: sending %d bytes ethtype %hX\n", (int) s, t); + + /* pad to minimum packet size */ + while (s < ETH_ZLEN) + txb[s++] = '\0'; + + /* set the transmit buffer descriptor and enable Transmit State Machine */ + txd.bufptr = virt_to_bus(&txb[0]); + txd.cmdsts = (u32) OWN | s; + + /* restart the transmitter */ + outl(TxENA | inl(ioaddr + cr), ioaddr + cr); + + if (sis900_debug > 1) + printf("sis900_transmit: Queued Tx packet size %d.\n", (int) s); + + to = currticks() + TX_TIMEOUT; + + while ((((volatile u32) tx_status=txd.cmdsts) & OWN) && (currticks() < to)) + /* wait */ ; + + if (currticks() >= to) { + printf("sis900_transmit: TX Timeout! Tx status %X.\n", tx_status); + } + + if (tx_status & (ABORT | UNDERRUN | OWCOLL)) { + /* packet unsuccessfully transmited */ + printf("sis900_transmit: Transmit error, Tx status %X.\n", tx_status); + } + /* Disable interrupts by clearing the interrupt mask. */ + outl(0, ioaddr + imr); +} + +/* Function: sis900_poll + * + * Description: checks for a received packet and returns it if found. + * + * Arguments: struct nic *nic: NIC data structure + * + * Returns: 1 if a packet was recieved. + * 0 if no pacet was recieved. + * + * Side effects: + * Returns (copies) the packet to the array nic->packet. + * Returns the length of the packet in nic->packetlen. + */ + +static int +sis900_poll(struct nic *nic, int retrieve) +{ + u32 rx_status = rxd[cur_rx].cmdsts; + int retstat = 0; + + if (sis900_debug > 2) + printf("sis900_poll: cur_rx:%d, status:%X\n", cur_rx, rx_status); + + if (!(rx_status & OWN)) + return retstat; + + if (sis900_debug > 1) + printf("sis900_poll: got a packet: cur_rx:%d, status:%X\n", + cur_rx, rx_status); + + if ( ! retrieve ) return 1; + + nic->packetlen = (rx_status & DSIZE) - CRC_SIZE; + + if (rx_status & (ABORT|OVERRUN|TOOLONG|RUNT|RXISERR|CRCERR|FAERR)) { + /* corrupted packet received */ + printf("sis900_poll: Corrupted packet received, buffer status = %X\n", + rx_status); + retstat = 0; + } else { + /* give packet to higher level routine */ + memcpy(nic->packet, (rxb + cur_rx*RX_BUF_SIZE), nic->packetlen); + retstat = 1; + } + + /* return the descriptor and buffer to receive ring */ + rxd[cur_rx].cmdsts = RX_BUF_SIZE; + rxd[cur_rx].bufptr = virt_to_bus(&rxb[cur_rx*RX_BUF_SIZE]); + + if (++cur_rx == NUM_RX_DESC) + cur_rx = 0; + + /* re-enable the potentially idle receive state machine */ + outl(RxENA | inl(ioaddr + cr), ioaddr + cr); + + return retstat; + +} + +/* Function: sis900_disable + * + * Description: Turns off interrupts and stops Tx and Rx engines + * + * Arguments: struct nic *nic: NIC data structure + * + * Returns: void. + */ + +static void +sis900_disable(struct dev *dev) +{ + struct nic *nic = (struct nic *)dev; + /* merge reset and disable */ + sis900_init(nic); + + /* Disable interrupts by clearing the interrupt mask. */ + outl(0, ioaddr + imr); + outl(0, ioaddr + ier); + + /* Stop the chip's Tx and Rx Status Machine */ + outl(RxDIS | TxDIS | inl(ioaddr + cr), ioaddr + cr); +} + +/* Function: sis900_irq + * + * Description: Enable, Disable, or Force, interrupts + * + * Arguments: struct nic *nic: NIC data structure + * irq_action_t action: Requested action + * + * Returns: void. + */ + +static void +sis900_irq(struct nic *nic __unused, irq_action_t action __unused) +{ + switch ( action ) { + case DISABLE : + break; + case ENABLE : + break; + case FORCE : + break; + } +} + +static struct pci_id sis900_nics[] = { +PCI_ROM(0x1039, 0x0900, "sis900", "SIS900"), +PCI_ROM(0x1039, 0x7016, "sis7016", "SIS7016"), +}; + +struct pci_driver sis900_driver = { + .type = NIC_DRIVER, + .name = "SIS900", + .probe = sis900_probe, + .ids = sis900_nics, + .id_count = sizeof(sis900_nics)/sizeof(sis900_nics[0]), + .class = 0, +}; diff --git a/usr/src/grub/grub-0.97/netboot/sis900.h b/usr/src/grub/grub-0.97/netboot/sis900.h new file mode 100644 index 0000000000..89aa3aa5aa --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/sis900.h @@ -0,0 +1,380 @@ +/* -*- Mode:C; c-basic-offset:4; -*- */ + +/* Definitions for SiS ethernet controllers including 7014/7016 and 900 + * References: + * SiS 7016 Fast Ethernet PCI Bus 10/100 Mbps LAN Controller with OnNow Support, + * preliminary Rev. 1.0 Jan. 14, 1998 + * SiS 900 Fast Ethernet PCI Bus 10/100 Mbps LAN Single Chip with OnNow Support, + * preliminary Rev. 1.0 Nov. 10, 1998 + * SiS 7014 Single Chip 100BASE-TX/10BASE-T Physical Layer Solution, + * preliminary Rev. 1.0 Jan. 18, 1998 + * http://www.sis.com.tw/support/databook.htm + */ + +/* MAC operationl registers of SiS 7016 and SiS 900 ethernet controller */ +/* The I/O extent, SiS 900 needs 256 bytes of io address */ +#define SIS900_TOTAL_SIZE 0x100 + +/* Symbolic offsets to registers. */ +enum sis900_registers { + cr=0x0, /* Command Register */ + cfg=0x4, /* Configuration Register */ + mear=0x8, /* EEPROM Access Register */ + ptscr=0xc, /* PCI Test Control Register */ + isr=0x10, /* Interrupt Status Register */ + imr=0x14, /* Interrupt Mask Register */ + ier=0x18, /* Interrupt Enable Register */ + epar=0x18, /* Enhanced PHY Access Register */ + txdp=0x20, /* Transmit Descriptor Pointer Register */ + txcfg=0x24, /* Transmit Configuration Register */ + rxdp=0x30, /* Receive Descriptor Pointer Register */ + rxcfg=0x34, /* Receive Configuration Register */ + flctrl=0x38, /* Flow Control Register */ + rxlen=0x3c, /* Receive Packet Length Register */ + rfcr=0x48, /* Receive Filter Control Register */ + rfdr=0x4C, /* Receive Filter Data Register */ + pmctrl=0xB0, /* Power Management Control Register */ + pmer=0xB4 /* Power Management Wake-up Event Register */ +}; + +/* Symbolic names for bits in various registers */ +enum sis900_command_register_bits { + RELOAD = 0x00000400, + ACCESSMODE = 0x00000200, + RESET = 0x00000100, + SWI = 0x00000080, + RxRESET = 0x00000020, + TxRESET = 0x00000010, + RxDIS = 0x00000008, + RxENA = 0x00000004, + TxDIS = 0x00000002, + TxENA = 0x00000001 +}; + +enum sis900_configuration_register_bits { + DESCRFMT = 0x00000100, /* 7016 specific */ + REQALG = 0x00000080, + SB = 0x00000040, + POW = 0x00000020, + EXD = 0x00000010, + PESEL = 0x00000008, + LPM = 0x00000004, + BEM = 0x00000001, + RND_CNT = 0x00000400, + FAIR_BACKOFF = 0x00000200, + EDB_MASTER_EN = 0x00002000 +}; + +enum sis900_eeprom_access_reigster_bits { + MDC = 0x00000040, + MDDIR = 0x00000020, + MDIO = 0x00000010, /* 7016 specific */ + EECS = 0x00000008, + EECLK = 0x00000004, + EEDO = 0x00000002, + EEDI = 0x00000001 +}; + +enum sis900_interrupt_register_bits { + WKEVT = 0x10000000, + TxPAUSEEND = 0x08000000, + TxPAUSE = 0x04000000, + TxRCMP = 0x02000000, + RxRCMP = 0x01000000, + DPERR = 0x00800000, + SSERR = 0x00400000, + RMABT = 0x00200000, + RTABT = 0x00100000, + RxSOVR = 0x00010000, + HIBERR = 0x00008000, + SWINT = 0x00001000, + MIBINT = 0x00000800, + TxURN = 0x00000400, + TxIDLE = 0x00000200, + TxERR = 0x00000100, + TxDESC = 0x00000080, + TxOK = 0x00000040, + RxORN = 0x00000020, + RxIDLE = 0x00000010, + RxEARLY = 0x00000008, + RxERR = 0x00000004, + RxDESC = 0x00000002, + RxOK = 0x00000001 +}; + +enum sis900_interrupt_enable_reigster_bits { + IE = 0x00000001 +}; + +/* maximum dma burst fro transmission and receive*/ +#define MAX_DMA_RANGE 7 /* actually 0 means MAXIMUM !! */ +#define TxMXDMA_shift 20 +#define RxMXDMA_shift 20 +#define TX_DMA_BURST 0 +#define RX_DMA_BURST 0 + +enum sis900_tx_rx_dma{ + DMA_BURST_512 = 0, DMA_BURST_64 = 5 +}; + +/* transmit FIFO threshholds */ +#define TX_FILL_THRESH 16 /* 1/4 FIFO size */ +#define TxFILLT_shift 8 +#define TxDRNT_shift 0 +#define TxDRNT_100 48 /* 3/4 FIFO size */ +#define TxDRNT_10 16 /* 1/2 FIFO size */ + +enum sis900_transmit_config_register_bits { + TxCSI = 0x80000000, + TxHBI = 0x40000000, + TxMLB = 0x20000000, + TxATP = 0x10000000, + TxIFG = 0x0C000000, + TxFILLT = 0x00003F00, + TxDRNT = 0x0000003F +}; + +/* recevie FIFO thresholds */ +#define RxDRNT_shift 1 +#define RxDRNT_100 16 /* 1/2 FIFO size */ +#define RxDRNT_10 24 /* 3/4 FIFO size */ + +enum sis900_reveive_config_register_bits { + RxAEP = 0x80000000, + RxARP = 0x40000000, + RxATX = 0x10000000, + RxAJAB = 0x08000000, + RxDRNT = 0x0000007F +}; + +#define RFAA_shift 28 +#define RFADDR_shift 16 + +enum sis900_receive_filter_control_register_bits { + RFEN = 0x80000000, + RFAAB = 0x40000000, + RFAAM = 0x20000000, + RFAAP = 0x10000000, + RFPromiscuous = (RFAAB|RFAAM|RFAAP) +}; + +enum sis900_reveive_filter_data_mask { + RFDAT = 0x0000FFFF +}; + +/* EEPROM Addresses */ +enum sis900_eeprom_address { + EEPROMSignature = 0x00, + EEPROMVendorID = 0x02, + EEPROMDeviceID = 0x03, + EEPROMMACAddr = 0x08, + EEPROMChecksum = 0x0b +}; + +/* The EEPROM commands include the alway-set leading bit. Refer to NM93Cxx datasheet */ +enum sis900_eeprom_command { + EEread = 0x0180, + EEwrite = 0x0140, + EEerase = 0x01C0, + EEwriteEnable = 0x0130, + EEwriteDisable = 0x0100, + EEeraseAll = 0x0120, + EEwriteAll = 0x0110, + EEaddrMask = 0x013F, + EEcmdShift = 16 +}; +/* For SiS962 or SiS963, request the eeprom software access */ +enum sis96x_eeprom_command { + EEREQ = 0x00000400, EEDONE = 0x00000200, EEGNT = 0x00000100 +}; + +/* Manamgement Data I/O (mdio) frame */ +#define MIIread 0x6000 +#define MIIwrite 0x5002 +#define MIIpmdShift 7 +#define MIIregShift 2 +#define MIIcmdLen 16 +#define MIIcmdShift 16 + +/* Buffer Descriptor Status*/ +enum sis900_buffer_status { + OWN = 0x80000000, + MORE = 0x40000000, + INTR = 0x20000000, + SUPCRC = 0x10000000, + INCCRC = 0x10000000, + OK = 0x08000000, + DSIZE = 0x00000FFF +}; + +/* Status for TX Buffers */ +enum sis900_tx_buffer_status { + ABORT = 0x04000000, + UNDERRUN = 0x02000000, + NOCARRIER = 0x01000000, + DEFERD = 0x00800000, + EXCDEFER = 0x00400000, + OWCOLL = 0x00200000, + EXCCOLL = 0x00100000, + COLCNT = 0x000F0000 +}; + +enum sis900_rx_bufer_status { + OVERRUN = 0x02000000, + DEST = 0x00800000, + BCAST = 0x01800000, + MCAST = 0x01000000, + UNIMATCH = 0x00800000, + TOOLONG = 0x00400000, + RUNT = 0x00200000, + RXISERR = 0x00100000, + CRCERR = 0x00080000, + FAERR = 0x00040000, + LOOPBK = 0x00020000, + RXCOL = 0x00010000 +}; + +/* MII register offsets */ +enum mii_registers { + MII_CONTROL = 0x0000, + MII_STATUS = 0x0001, + MII_PHY_ID0 = 0x0002, + MII_PHY_ID1 = 0x0003, + MII_ANADV = 0x0004, + MII_ANLPAR = 0x0005, + MII_ANEXT = 0x0006 +}; + +/* mii registers specific to SiS 900 */ +enum sis_mii_registers { + MII_CONFIG1 = 0x0010, + MII_CONFIG2 = 0x0011, + MII_STSOUT = 0x0012, + MII_MASK = 0x0013, + MII_RESV = 0x0014 +}; + +/* mii registers specific to AMD 79C901 */ +enum amd_mii_registers { + MII_STATUS_SUMMARY = 0x0018 +}; + +/* mii registers specific to ICS 1893 */ +enum ics_mii_registers { + MII_EXTCTRL = 0x0010, MII_QPDSTS = 0x0011, MII_10BTOP = 0x0012, + MII_EXTCTRL2 = 0x0013 +}; + + + +/* MII Control register bit definitions. */ +enum mii_control_register_bits { + MII_CNTL_FDX = 0x0100, + MII_CNTL_RST_AUTO = 0x0200, + MII_CNTL_ISOLATE = 0x0400, + MII_CNTL_PWRDWN = 0x0800, + MII_CNTL_AUTO = 0x1000, + MII_CNTL_SPEED = 0x2000, + MII_CNTL_LPBK = 0x4000, + MII_CNTL_RESET = 0x8000 +}; + +/* MII Status register bit */ +enum mii_status_register_bits { + MII_STAT_EXT = 0x0001, + MII_STAT_JAB = 0x0002, + MII_STAT_LINK = 0x0004, + MII_STAT_CAN_AUTO = 0x0008, + MII_STAT_FAULT = 0x0010, + MII_STAT_AUTO_DONE = 0x0020, + MII_STAT_CAN_T = 0x0800, + MII_STAT_CAN_T_FDX = 0x1000, + MII_STAT_CAN_TX = 0x2000, + MII_STAT_CAN_TX_FDX = 0x4000, + MII_STAT_CAN_T4 = 0x8000 +}; + +#define MII_ID1_OUI_LO 0xFC00 /* low bits of OUI mask */ +#define MII_ID1_MODEL 0x03F0 /* model number */ +#define MII_ID1_REV 0x000F /* model number */ + +/* MII NWAY Register Bits ... + valid for the ANAR (Auto-Negotiation Advertisement) and + ANLPAR (Auto-Negotiation Link Partner) registers */ +enum mii_nway_register_bits { + MII_NWAY_NODE_SEL = 0x001f, + MII_NWAY_CSMA_CD = 0x0001, + MII_NWAY_T = 0x0020, + MII_NWAY_T_FDX = 0x0040, + MII_NWAY_TX = 0x0080, + MII_NWAY_TX_FDX = 0x0100, + MII_NWAY_T4 = 0x0200, + MII_NWAY_PAUSE = 0x0400, + MII_NWAY_RF = 0x2000, + MII_NWAY_ACK = 0x4000, + MII_NWAY_NP = 0x8000 +}; + +enum mii_stsout_register_bits { + MII_STSOUT_LINK_FAIL = 0x4000, + MII_STSOUT_SPD = 0x0080, + MII_STSOUT_DPLX = 0x0040 +}; + +enum mii_stsics_register_bits { + MII_STSICS_SPD = 0x8000, MII_STSICS_DPLX = 0x4000, + MII_STSICS_LINKSTS = 0x0001 +}; + +enum mii_stssum_register_bits { + MII_STSSUM_LINK = 0x0008, + MII_STSSUM_DPLX = 0x0004, + MII_STSSUM_AUTO = 0x0002, + MII_STSSUM_SPD = 0x0001 +}; + +enum sis900_revision_id { + SIS630A_900_REV = 0x80, SIS630E_900_REV = 0x81, + SIS630S_900_REV = 0x82, SIS630EA1_900_REV = 0x83, + SIS630ET_900_REV = 0x84, SIS635A_900_REV = 0x90, + SIS96x_900_REV = 0X91, SIS900B_900_REV = 0x03 +}; + +enum sis630_revision_id { + SIS630A0 = 0x00, SIS630A1 = 0x01, + SIS630B0 = 0x10, SIS630B1 = 0x11 +}; + +#define FDX_CAPABLE_DUPLEX_UNKNOWN 0 +#define FDX_CAPABLE_HALF_SELECTED 1 +#define FDX_CAPABLE_FULL_SELECTED 2 + +#define HW_SPEED_UNCONFIG 0 +#define HW_SPEED_HOME 1 +#define HW_SPEED_10_MBPS 10 +#define HW_SPEED_100_MBPS 100 +#define HW_SPEED_DEFAULT (HW_SPEED_100_MBPS) + +#define CRC_SIZE 4 +#define MAC_HEADER_SIZE 14 + +#define TX_BUF_SIZE 1536 +#define RX_BUF_SIZE 1536 + +#define NUM_RX_DESC 4 /* Number of Rx descriptor registers. */ + +typedef unsigned char u8; +typedef signed char s8; +typedef unsigned short u16; +typedef signed short s16; +typedef unsigned int u32; +typedef signed int s32; + +/* Time in ticks before concluding the transmitter is hung. */ +#define TX_TIMEOUT (4*TICKS_PER_SEC) + +typedef struct _BufferDesc { + u32 link; + volatile u32 cmdsts; + u32 bufptr; +} BufferDesc; diff --git a/usr/src/grub/grub-0.97/netboot/stdint.h b/usr/src/grub/grub-0.97/netboot/stdint.h new file mode 100644 index 0000000000..037f12fa48 --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/stdint.h @@ -0,0 +1,18 @@ +#ifndef STDINT_H +#define STDINT_H +/* + * I'm architecture depended. Check me before port GRUB + */ +typedef unsigned size_t; + +typedef unsigned char uint8_t; +typedef unsigned short uint16_t; +typedef unsigned long uint32_t; +typedef unsigned long long uint64_t; + +typedef signed char int8_t; +typedef signed short int16_t; +typedef signed long int32_t; +typedef signed long long int64_t; + +#endif /* STDINT_H */ diff --git a/usr/src/grub/grub-0.97/netboot/sundance.c b/usr/src/grub/grub-0.97/netboot/sundance.c new file mode 100644 index 0000000000..04ace8b804 --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/sundance.c @@ -0,0 +1,896 @@ +/************************************************************************** +* +* sundance.c -- Etherboot device driver for the Sundance ST201 "Alta". +* Written 2002-2002 by Timothy Legge +* +* 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. +* +* Portions of this code based on: +* sundance.c: A Linux device driver for the Sundance ST201 "Alta" +* Written 1999-2002 by Donald Becker +* +* tulip.c: Tulip and Clone Etherboot Driver +* By Marty Conner +* Copyright (C) 2001 Entity Cyber, Inc. +* +* Linux Driver Version LK1.09a, 10-Jul-2003 (2.4.25) +* +* REVISION HISTORY: +* ================ +* v1.1 01-01-2003 timlegge Initial implementation +* v1.7 04-10-2003 timlegge Transfers Linux Kernel (30 sec) +* v1.8 04-13-2003 timlegge Fix multiple transmission bug +* v1.9 08-19-2003 timlegge Support Multicast +* v1.10 01-17-2004 timlegge Initial driver output cleanup +* v1.11 03-21-2004 timlegge Remove unused variables +* v1.12 03-21-2004 timlegge Remove excess MII defines +* v1.13 03-24-2004 timlegge Update to Linux 2.4.25 driver +* +****************************************************************************/ + +/* to get some global routines like printf */ +#include "etherboot.h" +/* to get the interface to the body of the program */ +#include "nic.h" +/* to get the PCI support functions, if this is a PCI NIC */ +#include "pci.h" +#include "timer.h" +#include "mii.h" + +#define drv_version "v1.12" +#define drv_date "2004-03-21" + +typedef unsigned char u8; +typedef signed char s8; +typedef unsigned short u16; +typedef signed short s16; +typedef unsigned int u32; +typedef signed int s32; + +#define HZ 100 + +/* Condensed operations for readability. */ +#define virt_to_le32desc(addr) cpu_to_le32(virt_to_bus(addr)) +#define le32desc_to_virt(addr) bus_to_virt(le32_to_cpu(addr)) + +/* May need to be moved to mii.h */ +struct mii_if_info { + int phy_id; + int advertising; + unsigned int full_duplex:1; /* is full duplex? */ +}; + +//#define EDEBUG +#ifdef EDEBUG +#define dprintf(x) printf x +#else +#define dprintf(x) +#endif + +#if defined(__sun) +/* Hack: use grub_strcmp since strcasecmp is undefined */ +#define strcasecmp grub_strcmp +#endif + + +/* Set the mtu */ +static int mtu = 1514; + +/* Maximum number of multicast addresses to filter (vs. rx-all-multicast). + The sundance uses a 64 element hash table based on the Ethernet CRC. */ +// static int multicast_filter_limit = 32; + +/* Set the copy breakpoint for the copy-only-tiny-frames scheme. + Setting to > 1518 effectively disables this feature. + This chip can receive into any byte alignment buffers, so word-oriented + archs do not need a copy-align of the IP header. */ +static int rx_copybreak = 0; +static int flowctrl = 1; + +/* Allow forcing the media type */ +/* media[] specifies the media type the NIC operates at. + autosense Autosensing active media. + 10mbps_hd 10Mbps half duplex. + 10mbps_fd 10Mbps full duplex. + 100mbps_hd 100Mbps half duplex. + 100mbps_fd 100Mbps full duplex. +*/ +static char media[] = "autosense"; + +/* Operational parameters that are set at compile time. */ + +/* As Etherboot uses a Polling driver we can keep the number of rings +to the minimum number required. In general that is 1 transmit and 4 receive receive rings. However some cards require that +there be a minimum of 2 rings */ +#define TX_RING_SIZE 2 +#define TX_QUEUE_LEN 10 /* Limit ring entries actually used. */ +#define RX_RING_SIZE 4 + + +/* Operational parameters that usually are not changed. */ +/* Time in jiffies before concluding the transmitter is hung. */ +#define TX_TIME_OUT (4*HZ) +#define PKT_BUF_SZ 1536 + +/* Offsets to the device registers. + Unlike software-only systems, device drivers interact with complex hardware. + It's not useful to define symbolic names for every register bit in the + device. The name can only partially document the semantics and make + the driver longer and more difficult to read. + In general, only the important configuration values or bits changed + multiple times should be defined symbolically. +*/ +enum alta_offsets { + DMACtrl = 0x00, + TxListPtr = 0x04, + TxDMABurstThresh = 0x08, + TxDMAUrgentThresh = 0x09, + TxDMAPollPeriod = 0x0a, + RxDMAStatus = 0x0c, + RxListPtr = 0x10, + DebugCtrl0 = 0x1a, + DebugCtrl1 = 0x1c, + RxDMABurstThresh = 0x14, + RxDMAUrgentThresh = 0x15, + RxDMAPollPeriod = 0x16, + LEDCtrl = 0x1a, + ASICCtrl = 0x30, + EEData = 0x34, + EECtrl = 0x36, + TxStartThresh = 0x3c, + RxEarlyThresh = 0x3e, + FlashAddr = 0x40, + FlashData = 0x44, + TxStatus = 0x46, + TxFrameId = 0x47, + DownCounter = 0x18, + IntrClear = 0x4a, + IntrEnable = 0x4c, + IntrStatus = 0x4e, + MACCtrl0 = 0x50, + MACCtrl1 = 0x52, + StationAddr = 0x54, + MaxFrameSize = 0x5A, + RxMode = 0x5c, + MIICtrl = 0x5e, + MulticastFilter0 = 0x60, + MulticastFilter1 = 0x64, + RxOctetsLow = 0x68, + RxOctetsHigh = 0x6a, + TxOctetsLow = 0x6c, + TxOctetsHigh = 0x6e, + TxFramesOK = 0x70, + RxFramesOK = 0x72, + StatsCarrierError = 0x74, + StatsLateColl = 0x75, + StatsMultiColl = 0x76, + StatsOneColl = 0x77, + StatsTxDefer = 0x78, + RxMissed = 0x79, + StatsTxXSDefer = 0x7a, + StatsTxAbort = 0x7b, + StatsBcastTx = 0x7c, + StatsBcastRx = 0x7d, + StatsMcastTx = 0x7e, + StatsMcastRx = 0x7f, + /* Aliased and bogus values! */ + RxStatus = 0x0c, +}; +enum ASICCtrl_HiWord_bit { + GlobalReset = 0x0001, + RxReset = 0x0002, + TxReset = 0x0004, + DMAReset = 0x0008, + FIFOReset = 0x0010, + NetworkReset = 0x0020, + HostReset = 0x0040, + ResetBusy = 0x0400, +}; + +/* Bits in the interrupt status/mask registers. */ +enum intr_status_bits { + IntrSummary = 0x0001, IntrPCIErr = 0x0002, IntrMACCtrl = 0x0008, + IntrTxDone = 0x0004, IntrRxDone = 0x0010, IntrRxStart = 0x0020, + IntrDrvRqst = 0x0040, + StatsMax = 0x0080, LinkChange = 0x0100, + IntrTxDMADone = 0x0200, IntrRxDMADone = 0x0400, +}; + +/* Bits in the RxMode register. */ +enum rx_mode_bits { + AcceptAllIPMulti = 0x20, AcceptMultiHash = 0x10, AcceptAll = 0x08, + AcceptBroadcast = 0x04, AcceptMulticast = 0x02, AcceptMyPhys = + 0x01, +}; +/* Bits in MACCtrl. */ +enum mac_ctrl0_bits { + EnbFullDuplex = 0x20, EnbRcvLargeFrame = 0x40, + EnbFlowCtrl = 0x100, EnbPassRxCRC = 0x200, +}; +enum mac_ctrl1_bits { + StatsEnable = 0x0020, StatsDisable = 0x0040, StatsEnabled = 0x0080, + TxEnable = 0x0100, TxDisable = 0x0200, TxEnabled = 0x0400, + RxEnable = 0x0800, RxDisable = 0x1000, RxEnabled = 0x2000, +}; + +/* The Rx and Tx buffer descriptors. + Using only 32 bit fields simplifies software endian correction. + This structure must be aligned, and should avoid spanning cache lines. +*/ +struct netdev_desc { + u32 next_desc; + u32 status; + u32 addr; + u32 length; +}; + +/* Bits in netdev_desc.status */ +enum desc_status_bits { + DescOwn = 0x8000, + DescEndPacket = 0x4000, + DescEndRing = 0x2000, + LastFrag = 0x80000000, + DescIntrOnTx = 0x8000, + DescIntrOnDMADone = 0x80000000, + DisableAlign = 0x00000001, +}; + +/********************************************** +* Descriptor Ring and Buffer defination +***********************************************/ +/* Define the TX Descriptor */ +static struct netdev_desc tx_ring[TX_RING_SIZE]; + +/* Create a static buffer of size PKT_BUF_SZ for each TX Descriptor. + All descriptors point to a part of this buffer */ +static unsigned char txb[PKT_BUF_SZ * TX_RING_SIZE]; + +/* Define the RX Descriptor */ +static struct netdev_desc rx_ring[RX_RING_SIZE]; + +/* Create a static buffer of size PKT_BUF_SZ for each RX Descriptor. + All descriptors point to a part of this buffer */ +static unsigned char rxb[RX_RING_SIZE * PKT_BUF_SZ]; + +/* FIXME: Move BASE to the private structure */ +static u32 BASE; +#define EEPROM_SIZE 128 + +enum pci_id_flags_bits { + PCI_USES_IO = 1, PCI_USES_MEM = 2, PCI_USES_MASTER = 4, + PCI_ADDR0 = 0 << 4, PCI_ADDR1 = 1 << 4, PCI_ADDR2 = + 2 << 4, PCI_ADDR3 = 3 << 4, +}; + +enum chip_capability_flags { CanHaveMII = 1, KendinPktDropBug = 2, }; +#define PCI_IOTYPE (PCI_USES_MASTER | PCI_USES_IO | PCI_ADDR0) + +#define MII_CNT 4 +struct sundance_private { + const char *nic_name; + /* Frequently used values */ + + unsigned int cur_rx; /* Producer/consumer ring indicies */ + unsigned int mtu; + + /* These values keep track of the tranceiver/media in use */ + unsigned int flowctrl:1; + unsigned int an_enable:1; + + unsigned int speed; + + /* MII tranceiver section */ + struct mii_if_info mii_if; + int mii_preamble_required; + unsigned char phys[MII_CNT]; + unsigned char pci_rev_id; +} sdx; + +static struct sundance_private *sdc; + +/* Station Address location within the EEPROM */ +#define EEPROM_SA_OFFSET 0x10 +#define DEFAULT_INTR (IntrRxDMADone | IntrPCIErr | \ + IntrDrvRqst | IntrTxDone | StatsMax | \ + LinkChange) + +static int eeprom_read(long ioaddr, int location); +static int mdio_read(struct nic *nic, int phy_id, unsigned int location); +static void mdio_write(struct nic *nic, int phy_id, unsigned int location, + int value); +static void set_rx_mode(struct nic *nic); + +static void check_duplex(struct nic *nic) +{ + int mii_lpa = mdio_read(nic, sdc->phys[0], MII_LPA); + int negotiated = mii_lpa & sdc->mii_if.advertising; + int duplex; + + /* Force media */ + if (!sdc->an_enable || mii_lpa == 0xffff) { + if (sdc->mii_if.full_duplex) + outw(inw(BASE + MACCtrl0) | EnbFullDuplex, + BASE + MACCtrl0); + return; + } + + /* Autonegotiation */ + duplex = (negotiated & 0x0100) || (negotiated & 0x01C0) == 0x0040; + if (sdc->mii_if.full_duplex != duplex) { + sdc->mii_if.full_duplex = duplex; + dprintf(("%s: Setting %s-duplex based on MII #%d " + "negotiated capability %4.4x.\n", sdc->nic_name, + duplex ? "full" : "half", sdc->phys[0], + negotiated)); + outw(inw(BASE + MACCtrl0) | duplex ? 0x20 : 0, + BASE + MACCtrl0); + } +} + + +/************************************************************************** + * init_ring - setup the tx and rx descriptors + *************************************************************************/ +static void init_ring(struct nic *nic __unused) +{ + int i; + + sdc->cur_rx = 0; + + /* Initialize all the Rx descriptors */ + for (i = 0; i < RX_RING_SIZE; i++) { + rx_ring[i].next_desc = virt_to_le32desc(&rx_ring[i + 1]); + rx_ring[i].status = 0; + rx_ring[i].length = 0; + rx_ring[i].addr = 0; + } + + /* Mark the last entry as wrapping the ring */ + rx_ring[i - 1].next_desc = virt_to_le32desc(&rx_ring[0]); + + for (i = 0; i < RX_RING_SIZE; i++) { + rx_ring[i].addr = virt_to_le32desc(&rxb[i * PKT_BUF_SZ]); + rx_ring[i].length = cpu_to_le32(PKT_BUF_SZ | LastFrag); + } + + /* We only use one transmit buffer, but two + * descriptors so transmit engines have somewhere + * to point should they feel the need */ + tx_ring[0].status = 0x00000000; + tx_ring[0].addr = virt_to_bus(&txb[0]); + tx_ring[0].next_desc = 0; /* virt_to_bus(&tx_ring[1]); */ + + /* This descriptor is never used */ + tx_ring[1].status = 0x00000000; + tx_ring[1].addr = 0; /*virt_to_bus(&txb[0]); */ + tx_ring[1].next_desc = 0; + + /* Mark the last entry as wrapping the ring, + * though this should never happen */ + tx_ring[1].length = cpu_to_le32(LastFrag | PKT_BUF_SZ); +} + +/************************************************************************** + * RESET - Reset Adapter + * ***********************************************************************/ +static void sundance_reset(struct nic *nic) +{ + int i; + + init_ring(nic); + + outl(virt_to_le32desc(&rx_ring[0]), BASE + RxListPtr); + /* The Tx List Pointer is written as packets are queued */ + + /* Initialize other registers. */ + /* __set_mac_addr(dev); */ + { + u16 addr16; + + addr16 = (nic->node_addr[0] | (nic->node_addr[1] << 8)); + outw(addr16, BASE + StationAddr); + addr16 = (nic->node_addr[2] | (nic->node_addr[3] << 8)); + outw(addr16, BASE + StationAddr + 2); + addr16 = (nic->node_addr[4] | (nic->node_addr[5] << 8)); + outw(addr16, BASE + StationAddr + 4); + } + + outw(sdc->mtu + 14, BASE + MaxFrameSize); + if (sdc->mtu > 2047) /* this will never happen with default options */ + outl(inl(BASE + ASICCtrl) | 0x0c, BASE + ASICCtrl); + + set_rx_mode(nic); + + outw(0, BASE + DownCounter); + /* Set the chip to poll every N*30nsec */ + outb(100, BASE + RxDMAPollPeriod); + + /* Fix DFE-580TX packet drop issue */ + if (sdc->pci_rev_id >= 0x14) + writeb(0x01, BASE + DebugCtrl1); + + outw(RxEnable | TxEnable, BASE + MACCtrl1); + + /* Construct a perfect filter frame with the mac address as first match + * and broadcast for all others */ + for (i = 0; i < 192; i++) + txb[i] = 0xFF; + + txb[0] = nic->node_addr[0]; + txb[1] = nic->node_addr[1]; + txb[2] = nic->node_addr[2]; + txb[3] = nic->node_addr[3]; + txb[4] = nic->node_addr[4]; + txb[5] = nic->node_addr[5]; + + dprintf(("%s: Done sundance_reset, status: Rx %hX Tx %hX " + "MAC Control %hX, %hX %hX\n", + sdc->nic_name, (int) inl(BASE + RxStatus), + (int) inw(BASE + TxStatus), (int) inl(BASE + MACCtrl0), + (int) inw(BASE + MACCtrl1), (int) inw(BASE + MACCtrl0))); +} + +/************************************************************************** +IRQ - Wait for a frame +***************************************************************************/ +void sundance_irq ( struct nic *nic, irq_action_t action ) { + unsigned int intr_status; + + switch ( action ) { + case DISABLE : + case ENABLE : + intr_status = inw(nic->ioaddr + IntrStatus); + intr_status = intr_status & ~DEFAULT_INTR; + if ( action == ENABLE ) + intr_status = intr_status | DEFAULT_INTR; + outw(intr_status, nic->ioaddr + IntrEnable); + break; + case FORCE : + outw(0x0200, BASE + ASICCtrl); + break; + } +} +/************************************************************************** +POLL - Wait for a frame +***************************************************************************/ +static int sundance_poll(struct nic *nic, int retreive) +{ + /* return true if there's an ethernet packet ready to read */ + /* nic->packet should contain data on return */ + /* nic->packetlen should contain length of data */ + int entry = sdc->cur_rx % RX_RING_SIZE; + u32 frame_status = le32_to_cpu(rx_ring[entry].status); + int intr_status; + int pkt_len = 0; + + if (!(frame_status & DescOwn)) + return 0; + + /* There is a packet ready */ + if(!retreive) + return 1; + + intr_status = inw(nic->ioaddr + IntrStatus); + outw(intr_status, nic->ioaddr + IntrStatus); + + pkt_len = frame_status & 0x1fff; + + if (frame_status & 0x001f4000) { + dprintf(("Polling frame_status error\n")); /* Do we really care about this */ + } else { + if (pkt_len < rx_copybreak) { + /* FIXME: What should happen Will this ever occur */ + printf("Poll Error: pkt_len < rx_copybreak"); + } else { + nic->packetlen = pkt_len; + memcpy(nic->packet, rxb + + (sdc->cur_rx * PKT_BUF_SZ), nic->packetlen); + + } + } + rx_ring[entry].length = cpu_to_le32(PKT_BUF_SZ | LastFrag); + rx_ring[entry].status = 0; + entry++; + sdc->cur_rx = entry % RX_RING_SIZE; + outw(DEFAULT_INTR & ~(IntrRxDone|IntrRxDMADone), + nic->ioaddr + IntrStatus); + return 1; +} + +/************************************************************************** +TRANSMIT - Transmit a frame +***************************************************************************/ +static void sundance_transmit(struct nic *nic, const char *d, /* Destination */ + unsigned int t, /* Type */ + unsigned int s, /* size */ + const char *p) +{ /* Packet */ + u16 nstype; + u32 to; + + /* Disable the Tx */ + outw(TxDisable, BASE + MACCtrl1); + + memcpy(txb, d, ETH_ALEN); + memcpy(txb + ETH_ALEN, nic->node_addr, ETH_ALEN); + nstype = htons((u16) t); + memcpy(txb + 2 * ETH_ALEN, (u8 *) & nstype, 2); + memcpy(txb + ETH_HLEN, p, s); + + s += ETH_HLEN; + s &= 0x0FFF; + while (s < ETH_ZLEN) + txb[s++] = '\0'; + + /* Setup the transmit descriptor */ + tx_ring[0].length = cpu_to_le32(s | LastFrag); + tx_ring[0].status = cpu_to_le32(0x00000001); + + /* Point to transmit descriptor */ + outl(virt_to_le32desc(&tx_ring[0]), BASE + TxListPtr); + + /* Enable Tx */ + outw(TxEnable, BASE + MACCtrl1); + /* Trigger an immediate send */ + outw(0, BASE + TxStatus); + + to = currticks() + TX_TIME_OUT; + while (!(tx_ring[0].status & 0x00010000) && (currticks() < to)); /* wait */ + + if (currticks() >= to) { + printf("TX Time Out"); + } + /* Disable Tx */ + outw(TxDisable, BASE + MACCtrl1); + +} + +/************************************************************************** +DISABLE - Turn off ethernet interface +***************************************************************************/ +static void sundance_disable(struct dev *dev __unused) +{ + /* put the card in its initial state */ + /* This function serves 3 purposes. + * This disables DMA and interrupts so we don't receive + * unexpected packets or interrupts from the card after + * etherboot has finished. + * This frees resources so etherboot may use + * this driver on another interface + * This allows etherboot to reinitialize the interface + * if something is something goes wrong. + */ + outw(0x0000, BASE + IntrEnable); + /* Stop the Chipchips Tx and Rx Status */ + outw(TxDisable | RxDisable | StatsDisable, BASE + MACCtrl1); +} + + + +/************************************************************************** +PROBE - Look for an adapter, this routine's visible to the outside +***************************************************************************/ +static int sundance_probe(struct dev *dev, struct pci_device *pci) +{ + struct nic *nic = (struct nic *) dev; + u8 ee_data[EEPROM_SIZE]; + u16 mii_ctl; + int i; + int speed; + + if (pci->ioaddr == 0) + return 0; + + /* BASE is used throughout to address the card */ + BASE = pci->ioaddr; + printf(" sundance.c: Found %s Vendor=0x%hX Device=0x%hX\n", + pci->name, pci->vendor, pci->dev_id); + + /* Get the MAC Address by reading the EEPROM */ + for (i = 0; i < 3; i++) { + ((u16 *) ee_data)[i] = + le16_to_cpu(eeprom_read(BASE, i + EEPROM_SA_OFFSET)); + } + /* Update the nic structure with the MAC Address */ + for (i = 0; i < ETH_ALEN; i++) { + nic->node_addr[i] = ee_data[i]; + } + + /* Set the card as PCI Bus Master */ + adjust_pci_device(pci); + +// sdc->mii_if.dev = pci; +// sdc->mii_if.phy_id_mask = 0x1f; +// sdc->mii_if.reg_num_mask = 0x1f; + + /* point to private storage */ + sdc = &sdx; + + sdc->nic_name = pci->name; + sdc->mtu = mtu; + + pci_read_config_byte(pci, PCI_REVISION_ID, &sdc->pci_rev_id); + dprintf(("Device revision id: %hx\n", sdc->pci_rev_id)); + /* Print out some hardware info */ + printf("%s: %! at ioaddr %hX, ", pci->name, nic->node_addr, BASE); + sdc->mii_preamble_required = 0; + if (1) { + int phy, phy_idx = 0; + sdc->phys[0] = 1; /* Default Setting */ + sdc->mii_preamble_required++; + for (phy = 1; phy < 32 && phy_idx < MII_CNT; phy++) { + int mii_status = mdio_read(nic, phy, MII_BMSR); + if (mii_status != 0xffff && mii_status != 0x0000) { + sdc->phys[phy_idx++] = phy; + sdc->mii_if.advertising = + mdio_read(nic, phy, MII_ADVERTISE); + if ((mii_status & 0x0040) == 0) + sdc->mii_preamble_required++; + dprintf + (("%s: MII PHY found at address %d, status " "%hX advertising %hX\n", sdc->nic_name, phy, mii_status, sdc->mii_if.advertising)); + } + } + sdc->mii_preamble_required--; + if (phy_idx == 0) + printf("%s: No MII transceiver found!\n", + sdc->nic_name); + sdc->mii_if.phy_id = sdc->phys[0]; + } + + /* Parse override configuration */ + sdc->an_enable = 1; + if (strcasecmp(media, "autosense") != 0) { + sdc->an_enable = 0; + if (strcasecmp(media, "100mbps_fd") == 0 || + strcasecmp(media, "4") == 0) { + sdc->speed = 100; + sdc->mii_if.full_duplex = 1; + } else if (strcasecmp(media, "100mbps_hd") == 0 + || strcasecmp(media, "3") == 0) { + sdc->speed = 100; + sdc->mii_if.full_duplex = 0; + } else if (strcasecmp(media, "10mbps_fd") == 0 || + strcasecmp(media, "2") == 0) { + sdc->speed = 10; + sdc->mii_if.full_duplex = 1; + } else if (strcasecmp(media, "10mbps_hd") == 0 || + strcasecmp(media, "1") == 0) { + sdc->speed = 10; + sdc->mii_if.full_duplex = 0; + } else { + sdc->an_enable = 1; + } + } + if (flowctrl == 1) + sdc->flowctrl = 1; + + /* Fibre PHY? */ + if (inl(BASE + ASICCtrl) & 0x80) { + /* Default 100Mbps Full */ + if (sdc->an_enable) { + sdc->speed = 100; + sdc->mii_if.full_duplex = 1; + sdc->an_enable = 0; + } + } + + /* The Linux driver uses flow control and resets the link here. This means the + mii section from above would need to be re done I believe. Since it serves + no real purpose leave it out. */ + + /* Force media type */ + if (!sdc->an_enable) { + mii_ctl = 0; + mii_ctl |= (sdc->speed == 100) ? BMCR_SPEED100 : 0; + mii_ctl |= (sdc->mii_if.full_duplex) ? BMCR_FULLDPLX : 0; + mdio_write(nic, sdc->phys[0], MII_BMCR, mii_ctl); + printf("Override speed=%d, %s duplex\n", + sdc->speed, + sdc->mii_if.full_duplex ? "Full" : "Half"); + } + + /* Reset the chip to erase previous misconfiguration */ + dprintf(("ASIC Control is %x.\n", inl(BASE + ASICCtrl))); + outw(0x007f, BASE + ASICCtrl + 2); + dprintf(("ASIC Control is now %x.\n", inl(BASE + ASICCtrl))); + + sundance_reset(nic); + if (sdc->an_enable) { + u16 mii_advertise, mii_lpa; + mii_advertise = + mdio_read(nic, sdc->phys[0], MII_ADVERTISE); + mii_lpa = mdio_read(nic, sdc->phys[0], MII_LPA); + mii_advertise &= mii_lpa; + if (mii_advertise & ADVERTISE_100FULL) + sdc->speed = 100; + else if (mii_advertise & ADVERTISE_100HALF) + sdc->speed = 100; + else if (mii_advertise & ADVERTISE_10FULL) + sdc->speed = 10; + else if (mii_advertise & ADVERTISE_10HALF) + sdc->speed = 10; + } else { + mii_ctl = mdio_read(nic, sdc->phys[0], MII_BMCR); + speed = (mii_ctl & BMCR_SPEED100) ? 100 : 10; + sdc->speed = speed; + printf("%s: Link changed: %dMbps ,", sdc->nic_name, speed); + printf("%s duplex.\n", (mii_ctl & BMCR_FULLDPLX) ? + "full" : "half"); + } + check_duplex(nic); + if (sdc->flowctrl && sdc->mii_if.full_duplex) { + outw(inw(BASE + MulticastFilter1 + 2) | 0x0200, + BASE + MulticastFilter1 + 2); + outw(inw(BASE + MACCtrl0) | EnbFlowCtrl, BASE + MACCtrl0); + } + printf("%dMbps, %s-Duplex\n", sdc->speed, + sdc->mii_if.full_duplex ? "Full" : "Half"); + + /* point to NIC specific routines */ + dev->disable = sundance_disable; + nic->poll = sundance_poll; + nic->transmit = sundance_transmit; + nic->irqno = pci->irq; + nic->irq = sundance_irq; + nic->ioaddr = BASE; + + return 1; +} + + +/* Read the EEPROM and MII Management Data I/O (MDIO) interfaces. */ +static int eeprom_read(long ioaddr, int location) +{ + int boguscnt = 10000; /* Typical 1900 ticks */ + outw(0x0200 | (location & 0xff), ioaddr + EECtrl); + do { + if (!(inw(ioaddr + EECtrl) & 0x8000)) { + return inw(ioaddr + EEData); + } + } + while (--boguscnt > 0); + return 0; +} + +/* MII transceiver control section. + Read and write the MII registers using software-generated serial + MDIO protocol. See the MII specifications or DP83840A data sheet + for details. + + The maximum data clock rate is 2.5 Mhz. + The timing is decoupled from the processor clock by flushing the write + from the CPU write buffer with a following read, and using PCI + transaction time. */ + +#define mdio_in(mdio_addr) inb(mdio_addr) +#define mdio_out(value, mdio_addr) outb(value, mdio_addr) +#define mdio_delay(mdio_addr) inb(mdio_addr) + +enum mii_reg_bits { + MDIO_ShiftClk = 0x0001, MDIO_Data = 0x0002, MDIO_EnbOutput = + 0x0004, +}; +#define MDIO_EnbIn (0) +#define MDIO_WRITE0 (MDIO_EnbOutput) +#define MDIO_WRITE1 (MDIO_Data | MDIO_EnbOutput) + +/* Generate the preamble required for initial synchronization and + a few older transceivers. */ +static void mdio_sync(long mdio_addr) +{ + int bits = 32; + + /* Establish sync by sending at least 32 logic ones. */ + while (--bits >= 0) { + mdio_out(MDIO_WRITE1, mdio_addr); + mdio_delay(mdio_addr); + mdio_out(MDIO_WRITE1 | MDIO_ShiftClk, mdio_addr); + mdio_delay(mdio_addr); + } +} + +static int +mdio_read(struct nic *nic __unused, int phy_id, unsigned int location) +{ + long mdio_addr = BASE + MIICtrl; + int mii_cmd = (0xf6 << 10) | (phy_id << 5) | location; + int i, retval = 0; + + if (sdc->mii_preamble_required) + mdio_sync(mdio_addr); + + /* Shift the read command bits out. */ + for (i = 15; i >= 0; i--) { + int dataval = + (mii_cmd & (1 << i)) ? MDIO_WRITE1 : MDIO_WRITE0; + + mdio_out(dataval, mdio_addr); + mdio_delay(mdio_addr); + mdio_out(dataval | MDIO_ShiftClk, mdio_addr); + mdio_delay(mdio_addr); + } + /* Read the two transition, 16 data, and wire-idle bits. */ + for (i = 19; i > 0; i--) { + mdio_out(MDIO_EnbIn, mdio_addr); + mdio_delay(mdio_addr); + retval = (retval << 1) | ((mdio_in(mdio_addr) & MDIO_Data) + ? 1 : 0); + mdio_out(MDIO_EnbIn | MDIO_ShiftClk, mdio_addr); + mdio_delay(mdio_addr); + } + return (retval >> 1) & 0xffff; +} + +static void +mdio_write(struct nic *nic __unused, int phy_id, + unsigned int location, int value) +{ + long mdio_addr = BASE + MIICtrl; + int mii_cmd = + (0x5002 << 16) | (phy_id << 23) | (location << 18) | value; + int i; + + if (sdc->mii_preamble_required) + mdio_sync(mdio_addr); + + /* Shift the command bits out. */ + for (i = 31; i >= 0; i--) { + int dataval = + (mii_cmd & (1 << i)) ? MDIO_WRITE1 : MDIO_WRITE0; + mdio_out(dataval, mdio_addr); + mdio_delay(mdio_addr); + mdio_out(dataval | MDIO_ShiftClk, mdio_addr); + mdio_delay(mdio_addr); + } + /* Clear out extra bits. */ + for (i = 2; i > 0; i--) { + mdio_out(MDIO_EnbIn, mdio_addr); + mdio_delay(mdio_addr); + mdio_out(MDIO_EnbIn | MDIO_ShiftClk, mdio_addr); + mdio_delay(mdio_addr); + } + return; +} + +static void set_rx_mode(struct nic *nic __unused) +{ + int i; + u16 mc_filter[4]; /* Multicast hash filter */ + u32 rx_mode; + + memset(mc_filter, 0xff, sizeof(mc_filter)); + rx_mode = AcceptBroadcast | AcceptMulticast | AcceptMyPhys; + + if (sdc->mii_if.full_duplex && sdc->flowctrl) + mc_filter[3] |= 0x0200; + for (i = 0; i < 4; i++) + outw(mc_filter[i], BASE + MulticastFilter0 + i * 2); + outb(rx_mode, BASE + RxMode); + return; +} + +static struct pci_id sundance_nics[] = { + PCI_ROM(0x13f0, 0x0201, "sundance", "ST201 Sundance 'Alta' based Adaptor"), + PCI_ROM(0x1186, 0x1002, "dfe530txs", "D-Link DFE530TXS (Sundance ST201 Alta)"), +}; + +struct pci_driver sundance_driver = { + .type = NIC_DRIVER, + .name = "SUNDANCE/PCI", + .probe = sundance_probe, + .ids = sundance_nics, + .id_count = sizeof(sundance_nics) / sizeof(sundance_nics[0]), + .class = 0, +}; diff --git a/usr/src/grub/grub-0.97/netboot/tftp.h b/usr/src/grub/grub-0.97/netboot/tftp.h new file mode 100644 index 0000000000..dec4a3c0bc --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/tftp.h @@ -0,0 +1,82 @@ +#ifndef _TFTP_H +#define _TFTP_H + +#include "if_ether.h" +#include "ip.h" +#include "udp.h" + +#ifndef MAX_TFTP_RETRIES +#define MAX_TFTP_RETRIES 20 +#endif + +/* These settings have sense only if compiled with -DCONGESTED */ +/* total retransmission timeout in ticks */ +#define TFTP_TIMEOUT (30*TICKS_PER_SEC) +/* packet retransmission timeout in ticks */ +#define TFTP_REXMT (3*TICKS_PER_SEC) + +#define TFTP_PORT 69 +#define TFTP_DEFAULTSIZE_PACKET 512 +#define TFTP_MAX_PACKET 1432 /* 512 */ + +#define TFTP_RRQ 1 +#define TFTP_WRQ 2 +#define TFTP_DATA 3 +#define TFTP_ACK 4 +#define TFTP_ERROR 5 +#define TFTP_OACK 6 + +#define TFTP_CODE_EOF 1 +#define TFTP_CODE_MORE 2 +#define TFTP_CODE_ERROR 3 +#define TFTP_CODE_BOOT 4 +#define TFTP_CODE_CFG 5 + +struct tftp_t { + struct iphdr ip; + struct udphdr udp; + uint16_t opcode; + union { + uint8_t rrq[TFTP_DEFAULTSIZE_PACKET]; + struct { + uint16_t block; + uint8_t download[TFTP_MAX_PACKET]; + } data; + struct { + uint16_t block; + } ack; + struct { + uint16_t errcode; + uint8_t errmsg[TFTP_DEFAULTSIZE_PACKET]; + } err; + struct { + uint8_t data[TFTP_DEFAULTSIZE_PACKET+2]; + } oack; + } u; +}; + +/* define a smaller tftp packet solely for making requests to conserve stack + 512 bytes should be enough */ +struct tftpreq_t { + struct iphdr ip; + struct udphdr udp; + uint16_t opcode; + union { + uint8_t rrq[512]; + struct { + uint16_t block; + } ack; + struct { + uint16_t errcode; + uint8_t errmsg[512-2]; + } err; + } u; +}; + +#define TFTP_MIN_PACKET (sizeof(struct iphdr) + sizeof(struct udphdr) + 4) + +typedef int (*read_actor_t)(unsigned char *, unsigned int, unsigned int, int); + +int tftp_file_read(const char *name, read_actor_t); + +#endif /* _TFTP_H */ diff --git a/usr/src/grub/grub-0.97/netboot/tg3.c b/usr/src/grub/grub-0.97/netboot/tg3.c new file mode 100644 index 0000000000..76525f584c --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/tg3.c @@ -0,0 +1,3322 @@ +/* $Id: tg3.c,v 1.5 2003/03/19 21:26:20 gbaum Exp $ + * tg3.c: Broadcom Tigon3 ethernet driver. + * + * Copyright (C) 2001, 2002 David S. Miller (davem@redhat.com) + * Copyright (C) 2001, 2002 Jeff Garzik (jgarzik@mandrakesoft.com) + * Copyright (C) 2003 Eric Biederman (ebiederman@lnxi.com) [etherboot port] + */ + +/* 11-13-2003 timlegge Fix Issue with NetGear GA302T + * 11-18-2003 ebiederm Generalize NetGear Fix to what the code was supposed to be. + */ + +#include "etherboot.h" +#include "nic.h" +#include "pci.h" +#include "timer.h" +/*#include "string.h"*/ +#include "tg3.h" + +#define SUPPORT_COPPER_PHY 1 +#define SUPPORT_FIBER_PHY 1 +#define SUPPORT_LINK_REPORT 1 +#define SUPPORT_PARTNO_STR 1 +#define SUPPORT_PHY_STR 1 + +struct tg3 tg3; + +/* Dummy defines for error handling */ +#define EBUSY 1 +#define ENODEV 2 +#define EINVAL 3 +#define ENOMEM 4 + + +/* These numbers seem to be hard coded in the NIC firmware somehow. + * You can't change the ring sizes, but you can change where you place + * them in the NIC onboard memory. + */ +#define TG3_RX_RING_SIZE 512 +#define TG3_DEF_RX_RING_PENDING 20 /* RX_RING_PENDING seems to be o.k. at 20 and 200 */ +#define TG3_RX_RCB_RING_SIZE 1024 + +/* (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705 ? \ + 512 : 1024) */ + #define TG3_TX_RING_SIZE 512 +#define TG3_DEF_TX_RING_PENDING (TG3_TX_RING_SIZE - 1) + +#define TG3_RX_RING_BYTES (sizeof(struct tg3_rx_buffer_desc) * TG3_RX_RING_SIZE) +#define TG3_RX_RCB_RING_BYTES (sizeof(struct tg3_rx_buffer_desc) * TG3_RX_RCB_RING_SIZE) + +#define TG3_TX_RING_BYTES (sizeof(struct tg3_tx_buffer_desc) * TG3_TX_RING_SIZE) +#define NEXT_TX(N) (((N) + 1) & (TG3_TX_RING_SIZE - 1)) +#define PREV_TX(N) (((N) - 1) & (TG3_TX_RING_SIZE - 1)) + +#define RX_PKT_BUF_SZ (1536 + 2 + 64) + + +static struct bss { + struct tg3_rx_buffer_desc rx_std[TG3_RX_RING_SIZE]; + struct tg3_rx_buffer_desc rx_rcb[TG3_RX_RCB_RING_SIZE]; + struct tg3_tx_buffer_desc tx_ring[TG3_TX_RING_SIZE]; + struct tg3_hw_status hw_status; + struct tg3_hw_stats hw_stats; + unsigned char rx_bufs[TG3_DEF_RX_RING_PENDING][RX_PKT_BUF_SZ]; +} tg3_bss; + +/** + * pci_save_state - save the PCI configuration space of a device before suspending + * @dev: - PCI device that we're dealing with + * @buffer: - buffer to hold config space context + * + * @buffer must be large enough to hold the entire PCI 2.2 config space + * (>= 64 bytes). + */ +static int pci_save_state(struct pci_device *dev, uint32_t *buffer) +{ + int i; + for (i = 0; i < 16; i++) + pci_read_config_dword(dev, i * 4,&buffer[i]); + return 0; +} + +/** + * pci_restore_state - Restore the saved state of a PCI device + * @dev: - PCI device that we're dealing with + * @buffer: - saved PCI config space + * + */ +static int pci_restore_state(struct pci_device *dev, uint32_t *buffer) +{ + int i; + + for (i = 0; i < 16; i++) + pci_write_config_dword(dev,i * 4, buffer[i]); + return 0; +} + +static void tg3_write_indirect_reg32(uint32_t off, uint32_t val) +{ + pci_write_config_dword(tg3.pdev, TG3PCI_REG_BASE_ADDR, off); + pci_write_config_dword(tg3.pdev, TG3PCI_REG_DATA, val); +} + +#define tw32(reg,val) tg3_write_indirect_reg32((reg),(val)) +#define tw32_mailbox(reg, val) writel(((val) & 0xffffffff), tg3.regs + (reg)) +#define tw16(reg,val) writew(((val) & 0xffff), tg3.regs + (reg)) +#define tw8(reg,val) writeb(((val) & 0xff), tg3.regs + (reg)) +#define tr32(reg) readl(tg3.regs + (reg)) +#define tr16(reg) readw(tg3.regs + (reg)) +#define tr8(reg) readb(tg3.regs + (reg)) + +static void tw32_carefully(uint32_t reg, uint32_t val) +{ + tw32(reg, val); + tr32(reg); + udelay(100); +} + +static void tw32_mailbox2(uint32_t reg, uint32_t val) +{ + tw32_mailbox(reg, val); + tr32(reg); +} + +static void tg3_write_mem(uint32_t off, uint32_t val) +{ + pci_write_config_dword(tg3.pdev, TG3PCI_MEM_WIN_BASE_ADDR, off); + pci_write_config_dword(tg3.pdev, TG3PCI_MEM_WIN_DATA, val); + + /* Always leave this as zero. */ + pci_write_config_dword(tg3.pdev, TG3PCI_MEM_WIN_BASE_ADDR, 0); +} + +static void tg3_read_mem(uint32_t off, uint32_t *val) +{ + pci_write_config_dword(tg3.pdev, TG3PCI_MEM_WIN_BASE_ADDR, off); + pci_read_config_dword(tg3.pdev, TG3PCI_MEM_WIN_DATA, val); + + /* Always leave this as zero. */ + pci_write_config_dword(tg3.pdev, TG3PCI_MEM_WIN_BASE_ADDR, 0); +} + +static void tg3_disable_ints(struct tg3 *tp) +{ + tw32(TG3PCI_MISC_HOST_CTRL, + (tp->misc_host_ctrl | MISC_HOST_CTRL_MASK_PCI_INT)); + tw32_mailbox2(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, 0x00000001); +} + +static void tg3_switch_clocks(struct tg3 *tp) +{ + uint32_t orig_clock_ctrl, clock_ctrl; + + clock_ctrl = tr32(TG3PCI_CLOCK_CTRL); + + orig_clock_ctrl = clock_ctrl; + clock_ctrl &= (CLOCK_CTRL_FORCE_CLKRUN | CLOCK_CTRL_CLKRUN_OENABLE | 0x1f); + tp->pci_clock_ctrl = clock_ctrl; + + if ((GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705) && + (orig_clock_ctrl & CLOCK_CTRL_44MHZ_CORE)!=0) { + tw32_carefully(TG3PCI_CLOCK_CTRL, + clock_ctrl | (CLOCK_CTRL_44MHZ_CORE | CLOCK_CTRL_ALTCLK)); + tw32_carefully(TG3PCI_CLOCK_CTRL, + clock_ctrl | (CLOCK_CTRL_ALTCLK)); + } + tw32_carefully(TG3PCI_CLOCK_CTRL, clock_ctrl); +} + +#define PHY_BUSY_LOOPS 5000 + +static int tg3_readphy(struct tg3 *tp, int reg, uint32_t *val) +{ + uint32_t frame_val; + int loops, ret; + + tw32_carefully(MAC_MI_MODE, tp->mi_mode & ~MAC_MI_MODE_AUTO_POLL); + + *val = 0xffffffff; + + frame_val = ((PHY_ADDR << MI_COM_PHY_ADDR_SHIFT) & + MI_COM_PHY_ADDR_MASK); + frame_val |= ((reg << MI_COM_REG_ADDR_SHIFT) & + MI_COM_REG_ADDR_MASK); + frame_val |= (MI_COM_CMD_READ | MI_COM_START); + + tw32_carefully(MAC_MI_COM, frame_val); + + loops = PHY_BUSY_LOOPS; + while (loops-- > 0) { + udelay(10); + frame_val = tr32(MAC_MI_COM); + + if ((frame_val & MI_COM_BUSY) == 0) { + udelay(5); + frame_val = tr32(MAC_MI_COM); + break; + } + } + + ret = -EBUSY; + if (loops > 0) { + *val = frame_val & MI_COM_DATA_MASK; + ret = 0; + } + + tw32_carefully(MAC_MI_MODE, tp->mi_mode); + + return ret; +} + +static int tg3_writephy(struct tg3 *tp, int reg, uint32_t val) +{ + uint32_t frame_val; + int loops, ret; + + tw32_carefully(MAC_MI_MODE, tp->mi_mode & ~MAC_MI_MODE_AUTO_POLL); + + frame_val = ((PHY_ADDR << MI_COM_PHY_ADDR_SHIFT) & + MI_COM_PHY_ADDR_MASK); + frame_val |= ((reg << MI_COM_REG_ADDR_SHIFT) & + MI_COM_REG_ADDR_MASK); + frame_val |= (val & MI_COM_DATA_MASK); + frame_val |= (MI_COM_CMD_WRITE | MI_COM_START); + + tw32_carefully(MAC_MI_COM, frame_val); + + loops = PHY_BUSY_LOOPS; + while (loops-- > 0) { + udelay(10); + frame_val = tr32(MAC_MI_COM); + if ((frame_val & MI_COM_BUSY) == 0) { + udelay(5); + frame_val = tr32(MAC_MI_COM); + break; + } + } + + ret = -EBUSY; + if (loops > 0) + ret = 0; + + tw32_carefully(MAC_MI_MODE, tp->mi_mode); + + return ret; +} + +static int tg3_writedsp(struct tg3 *tp, uint16_t addr, uint16_t val) +{ + int err; + err = tg3_writephy(tp, MII_TG3_DSP_ADDRESS, addr); + err |= tg3_writephy(tp, MII_TG3_DSP_RW_PORT, val); + return err; +} + + +static void tg3_phy_set_wirespeed(struct tg3 *tp) +{ + uint32_t val; + + if (tp->tg3_flags2 & TG3_FLG2_NO_ETH_WIRE_SPEED) + return; + + tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x7007); + tg3_readphy(tp, MII_TG3_AUX_CTRL, &val); + tg3_writephy(tp, MII_TG3_AUX_CTRL, (val | (1 << 15) | (1 << 4))); +} + +static int tg3_bmcr_reset(struct tg3 *tp) +{ + uint32_t phy_control; + int limit, err; + + /* OK, reset it, and poll the BMCR_RESET bit until it + * clears or we time out. + */ + phy_control = BMCR_RESET; + err = tg3_writephy(tp, MII_BMCR, phy_control); + if (err != 0) + return -EBUSY; + + limit = 5000; + while (limit--) { + err = tg3_readphy(tp, MII_BMCR, &phy_control); + if (err != 0) + return -EBUSY; + + if ((phy_control & BMCR_RESET) == 0) { + udelay(40); + break; + } + udelay(10); + } + if (limit <= 0) + return -EBUSY; + + return 0; +} + +static int tg3_wait_macro_done(struct tg3 *tp) +{ + int limit = 100; + + while (limit--) { + uint32_t tmp32; + + tg3_readphy(tp, 0x16, &tmp32); + if ((tmp32 & 0x1000) == 0) + break; + } + if (limit <= 0) + return -EBUSY; + + return 0; +} + +static int tg3_phy_write_and_check_testpat(struct tg3 *tp, int *resetp) +{ + static const uint32_t test_pat[4][6] = { + { 0x00005555, 0x00000005, 0x00002aaa, 0x0000000a, 0x00003456, 0x00000003 }, + { 0x00002aaa, 0x0000000a, 0x00003333, 0x00000003, 0x0000789a, 0x00000005 }, + { 0x00005a5a, 0x00000005, 0x00002a6a, 0x0000000a, 0x00001bcd, 0x00000003 }, + { 0x00002a5a, 0x0000000a, 0x000033c3, 0x00000003, 0x00002ef1, 0x00000005 } + }; + int chan; + + for (chan = 0; chan < 4; chan++) { + int i; + + tg3_writephy(tp, MII_TG3_DSP_ADDRESS, + (chan * 0x2000) | 0x0200); + tg3_writephy(tp, 0x16, 0x0002); + + for (i = 0; i < 6; i++) + tg3_writephy(tp, MII_TG3_DSP_RW_PORT, + test_pat[chan][i]); + + tg3_writephy(tp, 0x16, 0x0202); + if (tg3_wait_macro_done(tp)) { + *resetp = 1; + return -EBUSY; + } + + tg3_writephy(tp, MII_TG3_DSP_ADDRESS, + (chan * 0x2000) | 0x0200); + tg3_writephy(tp, 0x16, 0x0082); + if (tg3_wait_macro_done(tp)) { + *resetp = 1; + return -EBUSY; + } + + tg3_writephy(tp, 0x16, 0x0802); + if (tg3_wait_macro_done(tp)) { + *resetp = 1; + return -EBUSY; + } + + for (i = 0; i < 6; i += 2) { + uint32_t low, high; + + tg3_readphy(tp, MII_TG3_DSP_RW_PORT, &low); + tg3_readphy(tp, MII_TG3_DSP_RW_PORT, &high); + if (tg3_wait_macro_done(tp)) { + *resetp = 1; + return -EBUSY; + } + low &= 0x7fff; + high &= 0x000f; + if (low != test_pat[chan][i] || + high != test_pat[chan][i+1]) { + tg3_writephy(tp, MII_TG3_DSP_ADDRESS, 0x000b); + tg3_writephy(tp, MII_TG3_DSP_RW_PORT, 0x4001); + tg3_writephy(tp, MII_TG3_DSP_RW_PORT, 0x4005); + + return -EBUSY; + } + } + } + + return 0; +} + +static int tg3_phy_reset_chanpat(struct tg3 *tp) +{ + int chan; + + for (chan = 0; chan < 4; chan++) { + int i; + + tg3_writephy(tp, MII_TG3_DSP_ADDRESS, + (chan * 0x2000) | 0x0200); + tg3_writephy(tp, 0x16, 0x0002); + for (i = 0; i < 6; i++) + tg3_writephy(tp, MII_TG3_DSP_RW_PORT, 0x000); + tg3_writephy(tp, 0x16, 0x0202); + if (tg3_wait_macro_done(tp)) + return -EBUSY; + } + + return 0; +} + +static int tg3_phy_reset_5703_4_5(struct tg3 *tp) +{ + uint32_t reg32, phy9_orig; + int retries, do_phy_reset, err; + + retries = 10; + do_phy_reset = 1; + do { + if (do_phy_reset) { + err = tg3_bmcr_reset(tp); + if (err) + return err; + do_phy_reset = 0; + } + + /* Disable transmitter and interrupt. */ + tg3_readphy(tp, MII_TG3_EXT_CTRL, ®32); + reg32 |= 0x3000; + tg3_writephy(tp, MII_TG3_EXT_CTRL, reg32); + + /* Set full-duplex, 1000 mbps. */ + tg3_writephy(tp, MII_BMCR, + BMCR_FULLDPLX | TG3_BMCR_SPEED1000); + + /* Set to master mode. */ + tg3_readphy(tp, MII_TG3_CTRL, &phy9_orig); + tg3_writephy(tp, MII_TG3_CTRL, + (MII_TG3_CTRL_AS_MASTER | + MII_TG3_CTRL_ENABLE_AS_MASTER)); + + /* Enable SM_DSP_CLOCK and 6dB. */ + tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x0c00); + + /* Block the PHY control access. */ + tg3_writephy(tp, MII_TG3_DSP_ADDRESS, 0x8005); + tg3_writephy(tp, MII_TG3_DSP_RW_PORT, 0x0800); + + err = tg3_phy_write_and_check_testpat(tp, &do_phy_reset); + if (!err) + break; + } while (--retries); + + err = tg3_phy_reset_chanpat(tp); + if (err) + return err; + + tg3_writephy(tp, MII_TG3_DSP_ADDRESS, 0x8005); + tg3_writephy(tp, MII_TG3_DSP_RW_PORT, 0x0000); + + tg3_writephy(tp, MII_TG3_DSP_ADDRESS, 0x8200); + tg3_writephy(tp, 0x16, 0x0000); + + tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x0400); + + tg3_writephy(tp, MII_TG3_CTRL, phy9_orig); + + tg3_readphy(tp, MII_TG3_EXT_CTRL, ®32); + reg32 &= ~0x3000; + tg3_writephy(tp, MII_TG3_EXT_CTRL, reg32); + + return err; +} + +/* This will reset the tigon3 PHY if there is no valid + * link. + */ +static int tg3_phy_reset(struct tg3 *tp) +{ + uint32_t phy_status; + int err; + + err = tg3_readphy(tp, MII_BMSR, &phy_status); + err |= tg3_readphy(tp, MII_BMSR, &phy_status); + if (err != 0) + return -EBUSY; + + if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5703) || + (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) || + (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705)) { + err = tg3_phy_reset_5703_4_5(tp); + if (err) + return err; + goto out; + } + err = tg3_bmcr_reset(tp); + if (err) + return err; + out: + tg3_phy_set_wirespeed(tp); + return 0; +} + +static void tg3_set_power_state_0(struct tg3 *tp) +{ + uint16_t power_control; + int pm = tp->pm_cap; + + /* Make sure register accesses (indirect or otherwise) + * will function correctly. + */ + pci_write_config_dword(tp->pdev, TG3PCI_MISC_HOST_CTRL, tp->misc_host_ctrl); + + pci_read_config_word(tp->pdev, pm + PCI_PM_CTRL, &power_control); + + power_control |= PCI_PM_CTRL_PME_STATUS; + power_control &= ~(PCI_PM_CTRL_STATE_MASK); + power_control |= 0; + pci_write_config_word(tp->pdev, pm + PCI_PM_CTRL, power_control); + + tw32_carefully(GRC_LOCAL_CTRL, tp->grc_local_ctrl); + + return; +} + + +#if SUPPORT_LINK_REPORT +static void tg3_link_report(struct tg3 *tp) +{ + if (!tp->carrier_ok) { + printf("Link is down.\n"); + } else { + printf("Link is up at %d Mbps, %s duplex. %s %s %s\n", + (tp->link_config.active_speed == SPEED_1000 ? + 1000 : + (tp->link_config.active_speed == SPEED_100 ? + 100 : 10)), + (tp->link_config.active_duplex == DUPLEX_FULL ? + "full" : "half"), + (tp->tg3_flags & TG3_FLAG_TX_PAUSE) ? "TX" : "", + (tp->tg3_flags & TG3_FLAG_RX_PAUSE) ? "RX" : "", + (tp->tg3_flags & (TG3_FLAG_TX_PAUSE |TG3_FLAG_RX_PAUSE)) ? "flow control" : ""); + } +} +#else +#define tg3_link_report(tp) +#endif + +static void tg3_setup_flow_control(struct tg3 *tp, uint32_t local_adv, uint32_t remote_adv) +{ + uint32_t new_tg3_flags = 0; + + if (local_adv & ADVERTISE_PAUSE_CAP) { + if (local_adv & ADVERTISE_PAUSE_ASYM) { + if (remote_adv & LPA_PAUSE_CAP) + new_tg3_flags |= + (TG3_FLAG_RX_PAUSE | + TG3_FLAG_TX_PAUSE); + else if (remote_adv & LPA_PAUSE_ASYM) + new_tg3_flags |= + (TG3_FLAG_RX_PAUSE); + } else { + if (remote_adv & LPA_PAUSE_CAP) + new_tg3_flags |= + (TG3_FLAG_RX_PAUSE | + TG3_FLAG_TX_PAUSE); + } + } else if (local_adv & ADVERTISE_PAUSE_ASYM) { + if ((remote_adv & LPA_PAUSE_CAP) && + (remote_adv & LPA_PAUSE_ASYM)) + new_tg3_flags |= TG3_FLAG_TX_PAUSE; + } + + tp->tg3_flags &= ~(TG3_FLAG_RX_PAUSE | TG3_FLAG_TX_PAUSE); + tp->tg3_flags |= new_tg3_flags; + + if (new_tg3_flags & TG3_FLAG_RX_PAUSE) + tp->rx_mode |= RX_MODE_FLOW_CTRL_ENABLE; + else + tp->rx_mode &= ~RX_MODE_FLOW_CTRL_ENABLE; + + if (new_tg3_flags & TG3_FLAG_TX_PAUSE) + tp->tx_mode |= TX_MODE_FLOW_CTRL_ENABLE; + else + tp->tx_mode &= ~TX_MODE_FLOW_CTRL_ENABLE; +} + +#if SUPPORT_COPPER_PHY +static void tg3_aux_stat_to_speed_duplex( + struct tg3 *tp __unused, uint32_t val, uint8_t *speed, uint8_t *duplex) +{ + static const uint8_t map[] = { + [0] = (SPEED_INVALID << 2) | DUPLEX_INVALID, + [MII_TG3_AUX_STAT_10HALF >> 8] = (SPEED_10 << 2) | DUPLEX_HALF, + [MII_TG3_AUX_STAT_10FULL >> 8] = (SPEED_10 << 2) | DUPLEX_FULL, + [MII_TG3_AUX_STAT_100HALF >> 8] = (SPEED_100 << 2) | DUPLEX_HALF, + [MII_TG3_AUX_STAT_100_4 >> 8] = (SPEED_INVALID << 2) | DUPLEX_INVALID, + [MII_TG3_AUX_STAT_100FULL >> 8] = (SPEED_100 << 2) | DUPLEX_FULL, + [MII_TG3_AUX_STAT_1000HALF >> 8] = (SPEED_1000 << 2) | DUPLEX_HALF, + [MII_TG3_AUX_STAT_1000FULL >> 8] = (SPEED_1000 << 2) | DUPLEX_FULL, + }; + uint8_t result; + result = map[(val & MII_TG3_AUX_STAT_SPDMASK) >> 8]; + *speed = result >> 2; + *duplex = result & 3; +} + +static int tg3_phy_copper_begin(struct tg3 *tp) +{ + uint32_t new_adv; + + tp->link_config.advertising = + (ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full | + ADVERTISED_100baseT_Half | ADVERTISED_100baseT_Full | + ADVERTISED_1000baseT_Half | ADVERTISED_1000baseT_Full | + ADVERTISED_Autoneg | ADVERTISED_MII); + + if (tp->tg3_flags & TG3_FLAG_10_100_ONLY) { + tp->link_config.advertising &= + ~(ADVERTISED_1000baseT_Half | ADVERTISED_1000baseT_Full); + } + + new_adv = (ADVERTISE_CSMA | ADVERTISE_PAUSE_CAP); + if (tp->link_config.advertising & ADVERTISED_10baseT_Half) { + new_adv |= ADVERTISE_10HALF; + } + if (tp->link_config.advertising & ADVERTISED_10baseT_Full) { + new_adv |= ADVERTISE_10FULL; + } + if (tp->link_config.advertising & ADVERTISED_100baseT_Half) { + new_adv |= ADVERTISE_100HALF; + } + if (tp->link_config.advertising & ADVERTISED_100baseT_Full) { + new_adv |= ADVERTISE_100FULL; + } + tg3_writephy(tp, MII_ADVERTISE, new_adv); + + if (tp->link_config.advertising & + (ADVERTISED_1000baseT_Half | ADVERTISED_1000baseT_Full)) { + new_adv = 0; + if (tp->link_config.advertising & ADVERTISED_1000baseT_Half) { + new_adv |= MII_TG3_CTRL_ADV_1000_HALF; + } + if (tp->link_config.advertising & ADVERTISED_1000baseT_Full) { + new_adv |= MII_TG3_CTRL_ADV_1000_FULL; + } + if (!(tp->tg3_flags & TG3_FLAG_10_100_ONLY) && + (tp->pci_chip_rev_id == CHIPREV_ID_5701_A0 || + tp->pci_chip_rev_id == CHIPREV_ID_5701_B0)) { + new_adv |= (MII_TG3_CTRL_AS_MASTER | + MII_TG3_CTRL_ENABLE_AS_MASTER); + } + tg3_writephy(tp, MII_TG3_CTRL, new_adv); + } else { + tg3_writephy(tp, MII_TG3_CTRL, 0); + } + + tg3_writephy(tp, MII_BMCR, BMCR_ANENABLE | BMCR_ANRESTART); + + return 0; +} + +static int tg3_init_5401phy_dsp(struct tg3 *tp) +{ + int err; + + /* Turn off tap power management. */ + err = tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x0c20); + + err |= tg3_writedsp(tp, 0x0012, 0x1804); + err |= tg3_writedsp(tp, 0x0013, 0x1204); + err |= tg3_writedsp(tp, 0x8006, 0x0132); + err |= tg3_writedsp(tp, 0x8006, 0x0232); + err |= tg3_writedsp(tp, 0x201f, 0x0a20); + + udelay(40); + + return err; +} + +static int tg3_setup_copper_phy(struct tg3 *tp) +{ + int current_link_up; + uint32_t bmsr, dummy; + int i, err; + + tw32_carefully(MAC_STATUS, + (MAC_STATUS_SYNC_CHANGED | MAC_STATUS_CFG_CHANGED)); + + tp->mi_mode = MAC_MI_MODE_BASE; + tw32_carefully(MAC_MI_MODE, tp->mi_mode); + + tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x02); + + /* Some third-party PHYs need to be reset on link going + * down. + */ + if ( ( (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5703) || + (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) || + (tp->pci_chip_rev_id == CHIPREV_ID_5705_A0)) && + (tp->carrier_ok)) { + tg3_readphy(tp, MII_BMSR, &bmsr); + tg3_readphy(tp, MII_BMSR, &bmsr); + if (!(bmsr & BMSR_LSTATUS)) + tg3_phy_reset(tp); + } + + if ((tp->phy_id & PHY_ID_MASK) == PHY_ID_BCM5401) { + tg3_readphy(tp, MII_BMSR, &bmsr); + tg3_readphy(tp, MII_BMSR, &bmsr); + + if (!(tp->tg3_flags & TG3_FLAG_INIT_COMPLETE)) + bmsr = 0; + + if (!(bmsr & BMSR_LSTATUS)) { + err = tg3_init_5401phy_dsp(tp); + if (err) + return err; + + tg3_readphy(tp, MII_BMSR, &bmsr); + for (i = 0; i < 1000; i++) { + udelay(10); + tg3_readphy(tp, MII_BMSR, &bmsr); + if (bmsr & BMSR_LSTATUS) { + udelay(40); + break; + } + } + + if ((tp->phy_id & PHY_ID_REV_MASK) == PHY_REV_BCM5401_B0 && + !(bmsr & BMSR_LSTATUS) && + tp->link_config.active_speed == SPEED_1000) { + err = tg3_phy_reset(tp); + if (!err) + err = tg3_init_5401phy_dsp(tp); + if (err) + return err; + } + } + } else if (tp->pci_chip_rev_id == CHIPREV_ID_5701_A0 || + tp->pci_chip_rev_id == CHIPREV_ID_5701_B0) { + /* 5701 {A0,B0} CRC bug workaround */ + tg3_writephy(tp, 0x15, 0x0a75); + tg3_writephy(tp, 0x1c, 0x8c68); + tg3_writephy(tp, 0x1c, 0x8d68); + tg3_writephy(tp, 0x1c, 0x8c68); + } + + /* Clear pending interrupts... */ + tg3_readphy(tp, MII_TG3_ISTAT, &dummy); + tg3_readphy(tp, MII_TG3_ISTAT, &dummy); + + tg3_writephy(tp, MII_TG3_IMASK, ~0); + + if (tp->led_mode == led_mode_three_link) + tg3_writephy(tp, MII_TG3_EXT_CTRL, + MII_TG3_EXT_CTRL_LNK3_LED_MODE); + else + tg3_writephy(tp, MII_TG3_EXT_CTRL, 0); + + current_link_up = 0; + + tg3_readphy(tp, MII_BMSR, &bmsr); + tg3_readphy(tp, MII_BMSR, &bmsr); + + if (bmsr & BMSR_LSTATUS) { + uint32_t aux_stat, bmcr; + + tg3_readphy(tp, MII_TG3_AUX_STAT, &aux_stat); + for (i = 0; i < 2000; i++) { + udelay(10); + tg3_readphy(tp, MII_TG3_AUX_STAT, &aux_stat); + if (aux_stat) + break; + } + + tg3_aux_stat_to_speed_duplex(tp, aux_stat, + &tp->link_config.active_speed, + &tp->link_config.active_duplex); + tg3_readphy(tp, MII_BMCR, &bmcr); + tg3_readphy(tp, MII_BMCR, &bmcr); + if (bmcr & BMCR_ANENABLE) { + uint32_t gig_ctrl; + + current_link_up = 1; + + /* Force autoneg restart if we are exiting + * low power mode. + */ + tg3_readphy(tp, MII_TG3_CTRL, &gig_ctrl); + if (!(gig_ctrl & (MII_TG3_CTRL_ADV_1000_HALF | + MII_TG3_CTRL_ADV_1000_FULL))) { + current_link_up = 0; + } + } else { + current_link_up = 0; + } + } + + if (current_link_up == 1 && + (tp->link_config.active_duplex == DUPLEX_FULL)) { + uint32_t local_adv, remote_adv; + + tg3_readphy(tp, MII_ADVERTISE, &local_adv); + local_adv &= (ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM); + + tg3_readphy(tp, MII_LPA, &remote_adv); + remote_adv &= (LPA_PAUSE_CAP | LPA_PAUSE_ASYM); + + /* If we are not advertising full pause capability, + * something is wrong. Bring the link down and reconfigure. + */ + if (local_adv != ADVERTISE_PAUSE_CAP) { + current_link_up = 0; + } else { + tg3_setup_flow_control(tp, local_adv, remote_adv); + } + } + + if (current_link_up == 0) { + uint32_t tmp; + + tg3_phy_copper_begin(tp); + + tg3_readphy(tp, MII_BMSR, &tmp); + tg3_readphy(tp, MII_BMSR, &tmp); + if (tmp & BMSR_LSTATUS) + current_link_up = 1; + } + + tp->mac_mode &= ~MAC_MODE_PORT_MODE_MASK; + if (current_link_up == 1) { + if (tp->link_config.active_speed == SPEED_100 || + tp->link_config.active_speed == SPEED_10) + tp->mac_mode |= MAC_MODE_PORT_MODE_MII; + else + tp->mac_mode |= MAC_MODE_PORT_MODE_GMII; + } else + tp->mac_mode |= MAC_MODE_PORT_MODE_GMII; + + tp->mac_mode &= ~MAC_MODE_HALF_DUPLEX; + if (tp->link_config.active_duplex == DUPLEX_HALF) + tp->mac_mode |= MAC_MODE_HALF_DUPLEX; + + tp->mac_mode &= ~MAC_MODE_LINK_POLARITY; + if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700) { + if ((tp->led_mode == led_mode_link10) || + (current_link_up == 1 && + tp->link_config.active_speed == SPEED_10)) + tp->mac_mode |= MAC_MODE_LINK_POLARITY; + } else { + if (current_link_up == 1) + tp->mac_mode |= MAC_MODE_LINK_POLARITY; + tw32(MAC_LED_CTRL, LED_CTRL_PHY_MODE_1); + } + + /* ??? Without this setting Netgear GA302T PHY does not + * ??? send/receive packets... + * With this other PHYs cannot bring up the link + */ + if ((tp->phy_id & PHY_ID_MASK) == PHY_ID_BCM5411 && + tp->pci_chip_rev_id == CHIPREV_ID_5700_ALTIMA) { + tp->mi_mode |= MAC_MI_MODE_AUTO_POLL; + tw32_carefully(MAC_MI_MODE, tp->mi_mode); + } + + tw32_carefully(MAC_MODE, tp->mac_mode); + + /* Link change polled. */ + tw32_carefully(MAC_EVENT, 0); + + if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700 && + current_link_up == 1 && + tp->link_config.active_speed == SPEED_1000 && + ((tp->tg3_flags & TG3_FLAG_PCIX_MODE) || + (tp->tg3_flags & TG3_FLAG_PCI_HIGH_SPEED))) { + udelay(120); + tw32_carefully(MAC_STATUS, + (MAC_STATUS_SYNC_CHANGED | MAC_STATUS_CFG_CHANGED)); + tg3_write_mem( + NIC_SRAM_FIRMWARE_MBOX, + NIC_SRAM_FIRMWARE_MBOX_MAGIC2); + } + + if (current_link_up != tp->carrier_ok) { + tp->carrier_ok = current_link_up; + tg3_link_report(tp); + } + + return 0; +} +#else +#define tg3_setup_copper_phy(TP) (-EINVAL) +#endif /* SUPPORT_COPPER_PHY */ + +#if SUPPORT_FIBER_PHY +struct tg3_fiber_aneginfo { + int state; +#define ANEG_STATE_UNKNOWN 0 +#define ANEG_STATE_AN_ENABLE 1 +#define ANEG_STATE_RESTART_INIT 2 +#define ANEG_STATE_RESTART 3 +#define ANEG_STATE_DISABLE_LINK_OK 4 +#define ANEG_STATE_ABILITY_DETECT_INIT 5 +#define ANEG_STATE_ABILITY_DETECT 6 +#define ANEG_STATE_ACK_DETECT_INIT 7 +#define ANEG_STATE_ACK_DETECT 8 +#define ANEG_STATE_COMPLETE_ACK_INIT 9 +#define ANEG_STATE_COMPLETE_ACK 10 +#define ANEG_STATE_IDLE_DETECT_INIT 11 +#define ANEG_STATE_IDLE_DETECT 12 +#define ANEG_STATE_LINK_OK 13 +#define ANEG_STATE_NEXT_PAGE_WAIT_INIT 14 +#define ANEG_STATE_NEXT_PAGE_WAIT 15 + + uint32_t flags; +#define MR_AN_ENABLE 0x00000001 +#define MR_RESTART_AN 0x00000002 +#define MR_AN_COMPLETE 0x00000004 +#define MR_PAGE_RX 0x00000008 +#define MR_NP_LOADED 0x00000010 +#define MR_TOGGLE_TX 0x00000020 +#define MR_LP_ADV_FULL_DUPLEX 0x00000040 +#define MR_LP_ADV_HALF_DUPLEX 0x00000080 +#define MR_LP_ADV_SYM_PAUSE 0x00000100 +#define MR_LP_ADV_ASYM_PAUSE 0x00000200 +#define MR_LP_ADV_REMOTE_FAULT1 0x00000400 +#define MR_LP_ADV_REMOTE_FAULT2 0x00000800 +#define MR_LP_ADV_NEXT_PAGE 0x00001000 +#define MR_TOGGLE_RX 0x00002000 +#define MR_NP_RX 0x00004000 + +#define MR_LINK_OK 0x80000000 + + unsigned long link_time, cur_time; + + uint32_t ability_match_cfg; + int ability_match_count; + + char ability_match, idle_match, ack_match; + + uint32_t txconfig, rxconfig; +#define ANEG_CFG_NP 0x00000080 +#define ANEG_CFG_ACK 0x00000040 +#define ANEG_CFG_RF2 0x00000020 +#define ANEG_CFG_RF1 0x00000010 +#define ANEG_CFG_PS2 0x00000001 +#define ANEG_CFG_PS1 0x00008000 +#define ANEG_CFG_HD 0x00004000 +#define ANEG_CFG_FD 0x00002000 +#define ANEG_CFG_INVAL 0x00001f06 + +}; +#define ANEG_OK 0 +#define ANEG_DONE 1 +#define ANEG_TIMER_ENAB 2 +#define ANEG_FAILED -1 + +#define ANEG_STATE_SETTLE_TIME 10000 + +static int tg3_fiber_aneg_smachine(struct tg3 *tp, + struct tg3_fiber_aneginfo *ap) +{ + unsigned long delta; + uint32_t rx_cfg_reg; + int ret; + + if (ap->state == ANEG_STATE_UNKNOWN) { + ap->rxconfig = 0; + ap->link_time = 0; + ap->cur_time = 0; + ap->ability_match_cfg = 0; + ap->ability_match_count = 0; + ap->ability_match = 0; + ap->idle_match = 0; + ap->ack_match = 0; + } + ap->cur_time++; + + if (tr32(MAC_STATUS) & MAC_STATUS_RCVD_CFG) { + rx_cfg_reg = tr32(MAC_RX_AUTO_NEG); + + if (rx_cfg_reg != ap->ability_match_cfg) { + ap->ability_match_cfg = rx_cfg_reg; + ap->ability_match = 0; + ap->ability_match_count = 0; + } else { + if (++ap->ability_match_count > 1) { + ap->ability_match = 1; + ap->ability_match_cfg = rx_cfg_reg; + } + } + if (rx_cfg_reg & ANEG_CFG_ACK) + ap->ack_match = 1; + else + ap->ack_match = 0; + + ap->idle_match = 0; + } else { + ap->idle_match = 1; + ap->ability_match_cfg = 0; + ap->ability_match_count = 0; + ap->ability_match = 0; + ap->ack_match = 0; + + rx_cfg_reg = 0; + } + + ap->rxconfig = rx_cfg_reg; + ret = ANEG_OK; + + switch(ap->state) { + case ANEG_STATE_UNKNOWN: + if (ap->flags & (MR_AN_ENABLE | MR_RESTART_AN)) + ap->state = ANEG_STATE_AN_ENABLE; + + /* fallthru */ + case ANEG_STATE_AN_ENABLE: + ap->flags &= ~(MR_AN_COMPLETE | MR_PAGE_RX); + if (ap->flags & MR_AN_ENABLE) { + ap->link_time = 0; + ap->cur_time = 0; + ap->ability_match_cfg = 0; + ap->ability_match_count = 0; + ap->ability_match = 0; + ap->idle_match = 0; + ap->ack_match = 0; + + ap->state = ANEG_STATE_RESTART_INIT; + } else { + ap->state = ANEG_STATE_DISABLE_LINK_OK; + } + break; + + case ANEG_STATE_RESTART_INIT: + ap->link_time = ap->cur_time; + ap->flags &= ~(MR_NP_LOADED); + ap->txconfig = 0; + tw32(MAC_TX_AUTO_NEG, 0); + tp->mac_mode |= MAC_MODE_SEND_CONFIGS; + tw32_carefully(MAC_MODE, tp->mac_mode); + + ret = ANEG_TIMER_ENAB; + ap->state = ANEG_STATE_RESTART; + + /* fallthru */ + case ANEG_STATE_RESTART: + delta = ap->cur_time - ap->link_time; + if (delta > ANEG_STATE_SETTLE_TIME) { + ap->state = ANEG_STATE_ABILITY_DETECT_INIT; + } else { + ret = ANEG_TIMER_ENAB; + } + break; + + case ANEG_STATE_DISABLE_LINK_OK: + ret = ANEG_DONE; + break; + + case ANEG_STATE_ABILITY_DETECT_INIT: + ap->flags &= ~(MR_TOGGLE_TX); + ap->txconfig = (ANEG_CFG_FD | ANEG_CFG_PS1); + tw32(MAC_TX_AUTO_NEG, ap->txconfig); + tp->mac_mode |= MAC_MODE_SEND_CONFIGS; + tw32_carefully(MAC_MODE, tp->mac_mode); + + ap->state = ANEG_STATE_ABILITY_DETECT; + break; + + case ANEG_STATE_ABILITY_DETECT: + if (ap->ability_match != 0 && ap->rxconfig != 0) { + ap->state = ANEG_STATE_ACK_DETECT_INIT; + } + break; + + case ANEG_STATE_ACK_DETECT_INIT: + ap->txconfig |= ANEG_CFG_ACK; + tw32(MAC_TX_AUTO_NEG, ap->txconfig); + tp->mac_mode |= MAC_MODE_SEND_CONFIGS; + tw32_carefully(MAC_MODE, tp->mac_mode); + + ap->state = ANEG_STATE_ACK_DETECT; + + /* fallthru */ + case ANEG_STATE_ACK_DETECT: + if (ap->ack_match != 0) { + if ((ap->rxconfig & ~ANEG_CFG_ACK) == + (ap->ability_match_cfg & ~ANEG_CFG_ACK)) { + ap->state = ANEG_STATE_COMPLETE_ACK_INIT; + } else { + ap->state = ANEG_STATE_AN_ENABLE; + } + } else if (ap->ability_match != 0 && + ap->rxconfig == 0) { + ap->state = ANEG_STATE_AN_ENABLE; + } + break; + + case ANEG_STATE_COMPLETE_ACK_INIT: + if (ap->rxconfig & ANEG_CFG_INVAL) { + ret = ANEG_FAILED; + break; + } + ap->flags &= ~(MR_LP_ADV_FULL_DUPLEX | + MR_LP_ADV_HALF_DUPLEX | + MR_LP_ADV_SYM_PAUSE | + MR_LP_ADV_ASYM_PAUSE | + MR_LP_ADV_REMOTE_FAULT1 | + MR_LP_ADV_REMOTE_FAULT2 | + MR_LP_ADV_NEXT_PAGE | + MR_TOGGLE_RX | + MR_NP_RX); + if (ap->rxconfig & ANEG_CFG_FD) + ap->flags |= MR_LP_ADV_FULL_DUPLEX; + if (ap->rxconfig & ANEG_CFG_HD) + ap->flags |= MR_LP_ADV_HALF_DUPLEX; + if (ap->rxconfig & ANEG_CFG_PS1) + ap->flags |= MR_LP_ADV_SYM_PAUSE; + if (ap->rxconfig & ANEG_CFG_PS2) + ap->flags |= MR_LP_ADV_ASYM_PAUSE; + if (ap->rxconfig & ANEG_CFG_RF1) + ap->flags |= MR_LP_ADV_REMOTE_FAULT1; + if (ap->rxconfig & ANEG_CFG_RF2) + ap->flags |= MR_LP_ADV_REMOTE_FAULT2; + if (ap->rxconfig & ANEG_CFG_NP) + ap->flags |= MR_LP_ADV_NEXT_PAGE; + + ap->link_time = ap->cur_time; + + ap->flags ^= (MR_TOGGLE_TX); + if (ap->rxconfig & 0x0008) + ap->flags |= MR_TOGGLE_RX; + if (ap->rxconfig & ANEG_CFG_NP) + ap->flags |= MR_NP_RX; + ap->flags |= MR_PAGE_RX; + + ap->state = ANEG_STATE_COMPLETE_ACK; + ret = ANEG_TIMER_ENAB; + break; + + case ANEG_STATE_COMPLETE_ACK: + if (ap->ability_match != 0 && + ap->rxconfig == 0) { + ap->state = ANEG_STATE_AN_ENABLE; + break; + } + delta = ap->cur_time - ap->link_time; + if (delta > ANEG_STATE_SETTLE_TIME) { + if (!(ap->flags & (MR_LP_ADV_NEXT_PAGE))) { + ap->state = ANEG_STATE_IDLE_DETECT_INIT; + } else { + if ((ap->txconfig & ANEG_CFG_NP) == 0 && + !(ap->flags & MR_NP_RX)) { + ap->state = ANEG_STATE_IDLE_DETECT_INIT; + } else { + ret = ANEG_FAILED; + } + } + } + break; + + case ANEG_STATE_IDLE_DETECT_INIT: + ap->link_time = ap->cur_time; + tp->mac_mode &= ~MAC_MODE_SEND_CONFIGS; + tw32_carefully(MAC_MODE, tp->mac_mode); + + ap->state = ANEG_STATE_IDLE_DETECT; + ret = ANEG_TIMER_ENAB; + break; + + case ANEG_STATE_IDLE_DETECT: + if (ap->ability_match != 0 && + ap->rxconfig == 0) { + ap->state = ANEG_STATE_AN_ENABLE; + break; + } + delta = ap->cur_time - ap->link_time; + if (delta > ANEG_STATE_SETTLE_TIME) { + /* XXX another gem from the Broadcom driver :( */ + ap->state = ANEG_STATE_LINK_OK; + } + break; + + case ANEG_STATE_LINK_OK: + ap->flags |= (MR_AN_COMPLETE | MR_LINK_OK); + ret = ANEG_DONE; + break; + + case ANEG_STATE_NEXT_PAGE_WAIT_INIT: + /* ??? unimplemented */ + break; + + case ANEG_STATE_NEXT_PAGE_WAIT: + /* ??? unimplemented */ + break; + + default: + ret = ANEG_FAILED; + break; + }; + + return ret; +} + +static int tg3_setup_fiber_phy(struct tg3 *tp) +{ + uint32_t orig_pause_cfg; + uint16_t orig_active_speed; + uint8_t orig_active_duplex; + int current_link_up; + int i; + + orig_pause_cfg = + (tp->tg3_flags & (TG3_FLAG_RX_PAUSE | + TG3_FLAG_TX_PAUSE)); + orig_active_speed = tp->link_config.active_speed; + orig_active_duplex = tp->link_config.active_duplex; + + tp->mac_mode &= ~(MAC_MODE_PORT_MODE_MASK | MAC_MODE_HALF_DUPLEX); + tp->mac_mode |= MAC_MODE_PORT_MODE_TBI; + tw32_carefully(MAC_MODE, tp->mac_mode); + + /* Reset when initting first time or we have a link. */ + if (!(tp->tg3_flags & TG3_FLAG_INIT_COMPLETE) || + (tr32(MAC_STATUS) & MAC_STATUS_PCS_SYNCED)) { + /* Set PLL lock range. */ + tg3_writephy(tp, 0x16, 0x8007); + + /* SW reset */ + tg3_writephy(tp, MII_BMCR, BMCR_RESET); + + /* Wait for reset to complete. */ + mdelay(5); + + /* Config mode; select PMA/Ch 1 regs. */ + tg3_writephy(tp, 0x10, 0x8411); + + /* Enable auto-lock and comdet, select txclk for tx. */ + tg3_writephy(tp, 0x11, 0x0a10); + + tg3_writephy(tp, 0x18, 0x00a0); + tg3_writephy(tp, 0x16, 0x41ff); + + /* Assert and deassert POR. */ + tg3_writephy(tp, 0x13, 0x0400); + udelay(40); + tg3_writephy(tp, 0x13, 0x0000); + + tg3_writephy(tp, 0x11, 0x0a50); + udelay(40); + tg3_writephy(tp, 0x11, 0x0a10); + + /* Wait for signal to stabilize */ + mdelay(150); + + /* Deselect the channel register so we can read the PHYID + * later. + */ + tg3_writephy(tp, 0x10, 0x8011); + } + + /* Disable link change interrupt. */ + tw32_carefully(MAC_EVENT, 0); + + current_link_up = 0; + if (tr32(MAC_STATUS) & MAC_STATUS_PCS_SYNCED) { + if (!(tp->tg3_flags & TG3_FLAG_GOT_SERDES_FLOWCTL)) { + struct tg3_fiber_aneginfo aninfo; + int status = ANEG_FAILED; + unsigned int tick; + uint32_t tmp; + + memset(&aninfo, 0, sizeof(aninfo)); + aninfo.flags |= (MR_AN_ENABLE); + + tw32(MAC_TX_AUTO_NEG, 0); + + tmp = tp->mac_mode & ~MAC_MODE_PORT_MODE_MASK; + tw32_carefully(MAC_MODE, tmp | MAC_MODE_PORT_MODE_GMII); + + tw32_carefully(MAC_MODE, tp->mac_mode | MAC_MODE_SEND_CONFIGS); + + aninfo.state = ANEG_STATE_UNKNOWN; + aninfo.cur_time = 0; + tick = 0; + while (++tick < 195000) { + status = tg3_fiber_aneg_smachine(tp, &aninfo); + if (status == ANEG_DONE || + status == ANEG_FAILED) + break; + + udelay(1); + } + + tp->mac_mode &= ~MAC_MODE_SEND_CONFIGS; + tw32_carefully(MAC_MODE, tp->mac_mode); + + if (status == ANEG_DONE && + (aninfo.flags & + (MR_AN_COMPLETE | MR_LINK_OK | + MR_LP_ADV_FULL_DUPLEX))) { + uint32_t local_adv, remote_adv; + + local_adv = ADVERTISE_PAUSE_CAP; + remote_adv = 0; + if (aninfo.flags & MR_LP_ADV_SYM_PAUSE) + remote_adv |= LPA_PAUSE_CAP; + if (aninfo.flags & MR_LP_ADV_ASYM_PAUSE) + remote_adv |= LPA_PAUSE_ASYM; + + tg3_setup_flow_control(tp, local_adv, remote_adv); + + tp->tg3_flags |= + TG3_FLAG_GOT_SERDES_FLOWCTL; + current_link_up = 1; + } + for (i = 0; i < 60; i++) { + udelay(20); + tw32_carefully(MAC_STATUS, + (MAC_STATUS_SYNC_CHANGED | MAC_STATUS_CFG_CHANGED)); + if ((tr32(MAC_STATUS) & + (MAC_STATUS_SYNC_CHANGED | + MAC_STATUS_CFG_CHANGED)) == 0) + break; + } + if (current_link_up == 0 && + (tr32(MAC_STATUS) & MAC_STATUS_PCS_SYNCED)) { + current_link_up = 1; + } + } else { + /* Forcing 1000FD link up. */ + current_link_up = 1; + } + } + + tp->mac_mode &= ~MAC_MODE_LINK_POLARITY; + tw32_carefully(MAC_MODE, tp->mac_mode); + + tp->hw_status->status = + (SD_STATUS_UPDATED | + (tp->hw_status->status & ~SD_STATUS_LINK_CHG)); + + for (i = 0; i < 100; i++) { + udelay(20); + tw32_carefully(MAC_STATUS, + (MAC_STATUS_SYNC_CHANGED | MAC_STATUS_CFG_CHANGED)); + if ((tr32(MAC_STATUS) & + (MAC_STATUS_SYNC_CHANGED | + MAC_STATUS_CFG_CHANGED)) == 0) + break; + } + + if ((tr32(MAC_STATUS) & MAC_STATUS_PCS_SYNCED) == 0) + current_link_up = 0; + + if (current_link_up == 1) { + tp->link_config.active_speed = SPEED_1000; + tp->link_config.active_duplex = DUPLEX_FULL; + } else { + tp->link_config.active_speed = SPEED_INVALID; + tp->link_config.active_duplex = DUPLEX_INVALID; + } + + if (current_link_up != tp->carrier_ok) { + tp->carrier_ok = current_link_up; + tg3_link_report(tp); + } else { + uint32_t now_pause_cfg = + tp->tg3_flags & (TG3_FLAG_RX_PAUSE | + TG3_FLAG_TX_PAUSE); + if (orig_pause_cfg != now_pause_cfg || + orig_active_speed != tp->link_config.active_speed || + orig_active_duplex != tp->link_config.active_duplex) + tg3_link_report(tp); + } + + if ((tr32(MAC_STATUS) & MAC_STATUS_PCS_SYNCED) == 0) { + tw32_carefully(MAC_MODE, tp->mac_mode | MAC_MODE_LINK_POLARITY); + if (tp->tg3_flags & TG3_FLAG_INIT_COMPLETE) { + tw32_carefully(MAC_MODE, tp->mac_mode); + } + } + + return 0; +} +#else +#define tg3_setup_fiber_phy(TP) (-EINVAL) +#endif /* SUPPORT_FIBER_PHY */ + +static int tg3_setup_phy(struct tg3 *tp) +{ + int err; + + if (tp->phy_id == PHY_ID_SERDES) { + err = tg3_setup_fiber_phy(tp); + } else { + err = tg3_setup_copper_phy(tp); + } + + if (tp->link_config.active_speed == SPEED_1000 && + tp->link_config.active_duplex == DUPLEX_HALF) + tw32(MAC_TX_LENGTHS, + ((2 << TX_LENGTHS_IPG_CRS_SHIFT) | + (6 << TX_LENGTHS_IPG_SHIFT) | + (0xff << TX_LENGTHS_SLOT_TIME_SHIFT))); + else + tw32(MAC_TX_LENGTHS, + ((2 << TX_LENGTHS_IPG_CRS_SHIFT) | + (6 << TX_LENGTHS_IPG_SHIFT) | + (32 << TX_LENGTHS_SLOT_TIME_SHIFT))); + + return err; +} + + +#define MAX_WAIT_CNT 1000 + +/* To stop a block, clear the enable bit and poll till it + * clears. + */ +static int tg3_stop_block(struct tg3 *tp, unsigned long ofs, uint32_t enable_bit) +{ + unsigned int i; + uint32_t val; + + if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705) { + switch(ofs) { + case RCVLSC_MODE: + case DMAC_MODE: + case MBFREE_MODE: + case BUFMGR_MODE: + case MEMARB_MODE: + /* We can't enable/disable these bits of the + * 5705, just say success. + */ + return 0; + default: + break; + } + } + val = tr32(ofs); + val &= ~enable_bit; + tw32(ofs, val); + tr32(ofs); + + for (i = 0; i < MAX_WAIT_CNT; i++) { + udelay(100); + val = tr32(ofs); + if ((val & enable_bit) == 0) + break; + } + + if (i == MAX_WAIT_CNT) { + printf("tg3_stop_block timed out, ofs=%lx enable_bit=%x\n", + ofs, enable_bit); + return -ENODEV; + } + + return 0; +} + +static int tg3_abort_hw(struct tg3 *tp) +{ + int i, err; + + tg3_disable_ints(tp); + + tp->rx_mode &= ~RX_MODE_ENABLE; + tw32_carefully(MAC_RX_MODE, tp->rx_mode); + + err = tg3_stop_block(tp, RCVBDI_MODE, RCVBDI_MODE_ENABLE); + err |= tg3_stop_block(tp, RCVLPC_MODE, RCVLPC_MODE_ENABLE); + err |= tg3_stop_block(tp, RCVLSC_MODE, RCVLSC_MODE_ENABLE); + err |= tg3_stop_block(tp, RCVDBDI_MODE, RCVDBDI_MODE_ENABLE); + err |= tg3_stop_block(tp, RCVDCC_MODE, RCVDCC_MODE_ENABLE); + err |= tg3_stop_block(tp, RCVCC_MODE, RCVCC_MODE_ENABLE); + + err |= tg3_stop_block(tp, SNDBDS_MODE, SNDBDS_MODE_ENABLE); + err |= tg3_stop_block(tp, SNDBDI_MODE, SNDBDI_MODE_ENABLE); + err |= tg3_stop_block(tp, SNDDATAI_MODE, SNDDATAI_MODE_ENABLE); + err |= tg3_stop_block(tp, RDMAC_MODE, RDMAC_MODE_ENABLE); + err |= tg3_stop_block(tp, SNDDATAC_MODE, SNDDATAC_MODE_ENABLE); + err |= tg3_stop_block(tp, SNDBDC_MODE, SNDBDC_MODE_ENABLE); + if (err) + goto out; + + tp->mac_mode &= ~MAC_MODE_TDE_ENABLE; + tw32_carefully(MAC_MODE, tp->mac_mode); + + tp->tx_mode &= ~TX_MODE_ENABLE; + tw32_carefully(MAC_TX_MODE, tp->tx_mode); + + for (i = 0; i < MAX_WAIT_CNT; i++) { + udelay(100); + if (!(tr32(MAC_TX_MODE) & TX_MODE_ENABLE)) + break; + } + if (i >= MAX_WAIT_CNT) { + printf("tg3_abort_hw timed out TX_MODE_ENABLE will not clear MAC_TX_MODE=%x\n", + tr32(MAC_TX_MODE)); + return -ENODEV; + } + + err = tg3_stop_block(tp, HOSTCC_MODE, HOSTCC_MODE_ENABLE); + err |= tg3_stop_block(tp, WDMAC_MODE, WDMAC_MODE_ENABLE); + err |= tg3_stop_block(tp, MBFREE_MODE, MBFREE_MODE_ENABLE); + + tw32(FTQ_RESET, 0xffffffff); + tw32(FTQ_RESET, 0x00000000); + + err |= tg3_stop_block(tp, BUFMGR_MODE, BUFMGR_MODE_ENABLE); + err |= tg3_stop_block(tp, MEMARB_MODE, MEMARB_MODE_ENABLE); + if (err) + goto out; + + memset(tp->hw_status, 0, TG3_HW_STATUS_SIZE); + +out: + return err; +} + +static void tg3_chip_reset(struct tg3 *tp) +{ + uint32_t val; + + if (!(tp->tg3_flags2 & TG3_FLG2_SUN_5704)) { + /* Force NVRAM to settle. + * This deals with a chip bug which can result in EEPROM + * corruption. + */ + if (tp->tg3_flags & TG3_FLAG_NVRAM) { + int i; + + tw32(NVRAM_SWARB, SWARB_REQ_SET1); + for (i = 0; i < 100000; i++) { + if (tr32(NVRAM_SWARB) & SWARB_GNT1) + break; + udelay(10); + } + } + } + /* In Etherboot we don't need to worry about the 5701 + * REG_WRITE_BUG because we do all register writes indirectly. + */ + + /* do the reset */ + val = GRC_MISC_CFG_CORECLK_RESET; + if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705) + val |= GRC_MISC_CFG_KEEP_GPHY_POWER; + tw32(GRC_MISC_CFG, val); + + /* Flush PCI posted writes. The normal MMIO registers + * are inaccessible at this time so this is the only + * way to make this reliably. I tried to use indirect + * register read/write but this upset some 5701 variants. + */ + pci_read_config_dword(tp->pdev, PCI_COMMAND, &val); + + udelay(120); + + /* Re-enable indirect register accesses. */ + pci_write_config_dword(tp->pdev, TG3PCI_MISC_HOST_CTRL, + tp->misc_host_ctrl); + + /* Set MAX PCI retry to zero. */ + val = (PCISTATE_ROM_ENABLE | PCISTATE_ROM_RETRY_ENABLE); + if (tp->pci_chip_rev_id == CHIPREV_ID_5704_A0 && + (tp->tg3_flags & TG3_FLAG_PCIX_MODE)) + val |= PCISTATE_RETRY_SAME_DMA; + pci_write_config_dword(tp->pdev, TG3PCI_PCISTATE, val); + + pci_restore_state(tp->pdev, tp->pci_cfg_state); + + /* Make sure PCI-X relaxed ordering bit is clear. */ + pci_read_config_dword(tp->pdev, TG3PCI_X_CAPS, &val); + val &= ~PCIX_CAPS_RELAXED_ORDERING; + pci_write_config_dword(tp->pdev, TG3PCI_X_CAPS, val); + + tw32(MEMARB_MODE, MEMARB_MODE_ENABLE); + + if (((tp->nic_sram_data_cfg & NIC_SRAM_DATA_CFG_MINI_PCI) != 0) && + (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705)) { + tp->pci_clock_ctrl |= + (CLOCK_CTRL_FORCE_CLKRUN | CLOCK_CTRL_CLKRUN_OENABLE); + tw32(TG3PCI_CLOCK_CTRL, tp->pci_clock_ctrl); + } + + tw32(TG3PCI_MISC_HOST_CTRL, tp->misc_host_ctrl); +} + +static void tg3_stop_fw(struct tg3 *tp) +{ + if (tp->tg3_flags & TG3_FLAG_ENABLE_ASF) { + uint32_t val; + int i; + + tg3_write_mem(NIC_SRAM_FW_CMD_MBOX, FWCMD_NICDRV_PAUSE_FW); + val = tr32(GRC_RX_CPU_EVENT); + val |= (1 << 14); + tw32(GRC_RX_CPU_EVENT, val); + + /* Wait for RX cpu to ACK the event. */ + for (i = 0; i < 100; i++) { + if (!(tr32(GRC_RX_CPU_EVENT) & (1 << 14))) + break; + udelay(1); + } + } +} + +static int tg3_restart_fw(struct tg3 *tp, uint32_t state) +{ + uint32_t val; + int i; + + tg3_write_mem(NIC_SRAM_FIRMWARE_MBOX, + NIC_SRAM_FIRMWARE_MBOX_MAGIC1); + /* Wait for firmware initialization to complete. */ + for (i = 0; i < 100000; i++) { + tg3_read_mem(NIC_SRAM_FIRMWARE_MBOX, &val); + if (val == (uint32_t) ~NIC_SRAM_FIRMWARE_MBOX_MAGIC1) + break; + udelay(10); + } + if (i >= 100000 && + !(tp->tg3_flags2 & TG3_FLG2_SUN_5704)) { + printf("Firmware will not restart magic=%x\n", + val); + return -ENODEV; + } + if (!(tp->tg3_flags & TG3_FLAG_ENABLE_ASF)) { + state = DRV_STATE_SUSPEND; + } + tg3_write_mem(NIC_SRAM_FW_DRV_STATE_MBOX, state); + return 0; +} + +static int tg3_halt(struct tg3 *tp) +{ + tg3_stop_fw(tp); + tg3_abort_hw(tp); + tg3_chip_reset(tp); + return tg3_restart_fw(tp, DRV_STATE_UNLOAD); +} + +static void __tg3_set_mac_addr(struct tg3 *tp) +{ + uint32_t addr_high, addr_low; + int i; + + addr_high = ((tp->nic->node_addr[0] << 8) | + tp->nic->node_addr[1]); + addr_low = ((tp->nic->node_addr[2] << 24) | + (tp->nic->node_addr[3] << 16) | + (tp->nic->node_addr[4] << 8) | + (tp->nic->node_addr[5] << 0)); + for (i = 0; i < 4; i++) { + tw32(MAC_ADDR_0_HIGH + (i * 8), addr_high); + tw32(MAC_ADDR_0_LOW + (i * 8), addr_low); + } + + if ((GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5700) && + (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5701) && + (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705)) { + for(i = 0; i < 12; i++) { + tw32(MAC_EXTADDR_0_HIGH + (i * 8), addr_high); + tw32(MAC_EXTADDR_0_LOW + (i * 8), addr_low); + } + } + addr_high = (tp->nic->node_addr[0] + + tp->nic->node_addr[1] + + tp->nic->node_addr[2] + + tp->nic->node_addr[3] + + tp->nic->node_addr[4] + + tp->nic->node_addr[5]) & + TX_BACKOFF_SEED_MASK; + tw32(MAC_TX_BACKOFF_SEED, addr_high); +} + +static void tg3_set_bdinfo(struct tg3 *tp, uint32_t bdinfo_addr, + dma_addr_t mapping, uint32_t maxlen_flags, + uint32_t nic_addr) +{ + tg3_write_mem((bdinfo_addr + + TG3_BDINFO_HOST_ADDR + TG3_64BIT_REG_HIGH), + ((uint64_t) mapping >> 32)); + tg3_write_mem((bdinfo_addr + + TG3_BDINFO_HOST_ADDR + TG3_64BIT_REG_LOW), + ((uint64_t) mapping & 0xffffffff)); + tg3_write_mem((bdinfo_addr + + TG3_BDINFO_MAXLEN_FLAGS), + maxlen_flags); + if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705) { + tg3_write_mem((bdinfo_addr + TG3_BDINFO_NIC_ADDR), nic_addr); + } +} + + +static void tg3_init_rings(struct tg3 *tp) +{ + unsigned i; + + /* Zero out the tg3 variables */ + memset(&tg3_bss, 0, sizeof(tg3_bss)); + tp->rx_std = &tg3_bss.rx_std[0]; + tp->rx_rcb = &tg3_bss.rx_rcb[0]; + tp->tx_ring = &tg3_bss.tx_ring[0]; + tp->hw_status = &tg3_bss.hw_status; + tp->hw_stats = &tg3_bss.hw_stats; + tp->mac_mode = 0; + + + /* Initialize tx/rx rings for packet processing. + * + * The chip has been shut down and the driver detached from + * the networking, so no interrupts or new tx packets will + * end up in the driver. + */ + + /* Initialize invariants of the rings, we only set this + * stuff once. This works because the card does not + * write into the rx buffer posting rings. + */ + for (i = 0; i < TG3_RX_RING_SIZE; i++) { + struct tg3_rx_buffer_desc *rxd; + + rxd = &tp->rx_std[i]; + rxd->idx_len = (RX_PKT_BUF_SZ - 2 - 64) << RXD_LEN_SHIFT; + rxd->type_flags = (RXD_FLAG_END << RXD_FLAGS_SHIFT); + rxd->opaque = (RXD_OPAQUE_RING_STD | (i << RXD_OPAQUE_INDEX_SHIFT)); + + /* Note where the receive buffer for the ring is placed */ + rxd->addr_hi = 0; + rxd->addr_lo = virt_to_bus( + &tg3_bss.rx_bufs[i%TG3_DEF_RX_RING_PENDING][2]); + } +} + +#define TG3_WRITE_SETTINGS(TABLE) \ +do { \ + const uint32_t *_table, *_end; \ + _table = TABLE; \ + _end = _table + sizeof(TABLE)/sizeof(TABLE[0]); \ + for(; _table < _end; _table += 2) { \ + tw32(_table[0], _table[1]); \ + } \ +} while(0) + + +/* initialize/reset the tg3 */ +static int tg3_setup_hw(struct tg3 *tp) +{ + uint32_t val, rdmac_mode; + int i, err, limit; + + /* Simply don't support setups with extremly buggy firmware in etherboot */ + if (tp->pci_chip_rev_id == CHIPREV_ID_5701_A0) { + printf("Error 5701_A0 firmware bug detected\n"); + return -EINVAL; + } + + tg3_disable_ints(tp); + + /* Originally this was all in tg3_init_hw */ + + /* Force the chip into D0. */ + tg3_set_power_state_0(tp); + + tg3_switch_clocks(tp); + + tw32(TG3PCI_MEM_WIN_BASE_ADDR, 0); + + + /* Originally this was all in tg3_reset_hw */ + + tg3_stop_fw(tp); + + /* No need to call tg3_abort_hw here, it is called before tg3_setup_hw. */ + + tg3_chip_reset(tp); + + tw32(GRC_MODE, tp->grc_mode); /* Redundant? */ + + err = tg3_restart_fw(tp, DRV_STATE_START); + if (err) + return err; + + if (tp->phy_id == PHY_ID_SERDES) { + tp->mac_mode = MAC_MODE_PORT_MODE_TBI; + } + tw32_carefully(MAC_MODE, tp->mac_mode); + + + /* This works around an issue with Athlon chipsets on + * B3 tigon3 silicon. This bit has no effect on any + * other revision. + */ + tp->pci_clock_ctrl |= CLOCK_CTRL_DELAY_PCI_GRANT; + tw32_carefully(TG3PCI_CLOCK_CTRL, tp->pci_clock_ctrl); + + if (tp->pci_chip_rev_id == CHIPREV_ID_5704_A0 && + (tp->tg3_flags & TG3_FLAG_PCIX_MODE)) { + val = tr32(TG3PCI_PCISTATE); + val |= PCISTATE_RETRY_SAME_DMA; + tw32(TG3PCI_PCISTATE, val); + } + + /* Descriptor ring init may make accesses to the + * NIC SRAM area to setup the TX descriptors, so we + * can only do this after the hardware has been + * successfully reset. + */ + tg3_init_rings(tp); + + /* Clear statistics/status block in chip */ + if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705) { + for (i = NIC_SRAM_STATS_BLK; + i < NIC_SRAM_STATUS_BLK + TG3_HW_STATUS_SIZE; + i += sizeof(uint32_t)) { + tg3_write_mem(i, 0); + udelay(40); + } + } + + /* This value is determined during the probe time DMA + * engine test, tg3_setup_dma. + */ + tw32(TG3PCI_DMA_RW_CTRL, tp->dma_rwctrl); + + tp->grc_mode &= ~(GRC_MODE_HOST_SENDBDS | + GRC_MODE_4X_NIC_SEND_RINGS | + GRC_MODE_NO_TX_PHDR_CSUM | + GRC_MODE_NO_RX_PHDR_CSUM); + tp->grc_mode |= GRC_MODE_HOST_SENDBDS; + tp->grc_mode |= GRC_MODE_NO_TX_PHDR_CSUM; + tp->grc_mode |= GRC_MODE_NO_RX_PHDR_CSUM; + + tw32(GRC_MODE, + tp->grc_mode | + (GRC_MODE_IRQ_ON_MAC_ATTN | GRC_MODE_HOST_STACKUP)); + + /* Setup the timer prescalar register. Clock is always 66Mhz. */ + tw32(GRC_MISC_CFG, + (65 << GRC_MISC_CFG_PRESCALAR_SHIFT)); + + /* Initialize MBUF/DESC pool. */ + if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705) { + tw32(BUFMGR_MB_POOL_ADDR, NIC_SRAM_MBUF_POOL_BASE); + if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) + tw32(BUFMGR_MB_POOL_SIZE, NIC_SRAM_MBUF_POOL_SIZE64); + else + tw32(BUFMGR_MB_POOL_SIZE, NIC_SRAM_MBUF_POOL_SIZE96); + tw32(BUFMGR_DMA_DESC_POOL_ADDR, NIC_SRAM_DMA_DESC_POOL_BASE); + tw32(BUFMGR_DMA_DESC_POOL_SIZE, NIC_SRAM_DMA_DESC_POOL_SIZE); + } + if (!(tp->tg3_flags & TG3_FLAG_JUMBO_ENABLE)) { + tw32(BUFMGR_MB_RDMA_LOW_WATER, + tp->bufmgr_config.mbuf_read_dma_low_water); + tw32(BUFMGR_MB_MACRX_LOW_WATER, + tp->bufmgr_config.mbuf_mac_rx_low_water); + tw32(BUFMGR_MB_HIGH_WATER, + tp->bufmgr_config.mbuf_high_water); + } else { + tw32(BUFMGR_MB_RDMA_LOW_WATER, + tp->bufmgr_config.mbuf_read_dma_low_water_jumbo); + tw32(BUFMGR_MB_MACRX_LOW_WATER, + tp->bufmgr_config.mbuf_mac_rx_low_water_jumbo); + tw32(BUFMGR_MB_HIGH_WATER, + tp->bufmgr_config.mbuf_high_water_jumbo); + } + tw32(BUFMGR_DMA_LOW_WATER, + tp->bufmgr_config.dma_low_water); + tw32(BUFMGR_DMA_HIGH_WATER, + tp->bufmgr_config.dma_high_water); + + tw32(BUFMGR_MODE, BUFMGR_MODE_ENABLE | BUFMGR_MODE_ATTN_ENABLE); + for (i = 0; i < 2000; i++) { + if (tr32(BUFMGR_MODE) & BUFMGR_MODE_ENABLE) + break; + udelay(10); + } + if (i >= 2000) { + printf("tg3_setup_hw cannot enable BUFMGR\n"); + return -ENODEV; + } + + tw32(FTQ_RESET, 0xffffffff); + tw32(FTQ_RESET, 0x00000000); + for (i = 0; i < 2000; i++) { + if (tr32(FTQ_RESET) == 0x00000000) + break; + udelay(10); + } + if (i >= 2000) { + printf("tg3_setup_hw cannot reset FTQ\n"); + return -ENODEV; + } + + /* Initialize TG3_BDINFO's at: + * RCVDBDI_STD_BD: standard eth size rx ring + * RCVDBDI_JUMBO_BD: jumbo frame rx ring + * RCVDBDI_MINI_BD: small frame rx ring (??? does not work) + * + * like so: + * TG3_BDINFO_HOST_ADDR: high/low parts of DMA address of ring + * TG3_BDINFO_MAXLEN_FLAGS: (rx max buffer size << 16) | + * ring attribute flags + * TG3_BDINFO_NIC_ADDR: location of descriptors in nic SRAM + * + * Standard receive ring @ NIC_SRAM_RX_BUFFER_DESC, 512 entries. + * Jumbo receive ring @ NIC_SRAM_RX_JUMBO_BUFFER_DESC, 256 entries. + * + * ??? No space allocated for mini receive ring? :( + * + * The size of each ring is fixed in the firmware, but the location is + * configurable. + */ + { + static const uint32_t table_all[] = { + /* Setup replenish thresholds. */ + RCVBDI_STD_THRESH, TG3_DEF_RX_RING_PENDING / 8, + + /* Etherboot lives below 4GB */ + RCVDBDI_STD_BD + TG3_BDINFO_HOST_ADDR + TG3_64BIT_REG_HIGH, 0, + RCVDBDI_STD_BD + TG3_BDINFO_NIC_ADDR, NIC_SRAM_RX_BUFFER_DESC, + }; + static const uint32_t table_not_5705[] = { + /* Buffer maximum length */ + RCVDBDI_STD_BD + TG3_BDINFO_MAXLEN_FLAGS, RX_STD_MAX_SIZE << BDINFO_FLAGS_MAXLEN_SHIFT, + + /* Disable the mini frame rx ring */ + RCVDBDI_MINI_BD + TG3_BDINFO_MAXLEN_FLAGS, BDINFO_FLAGS_DISABLED, + + /* Disable the jumbo frame rx ring */ + RCVBDI_JUMBO_THRESH, 0, + RCVDBDI_JUMBO_BD + TG3_BDINFO_MAXLEN_FLAGS, BDINFO_FLAGS_DISABLED, + + + }; + TG3_WRITE_SETTINGS(table_all); + tw32(RCVDBDI_STD_BD + TG3_BDINFO_HOST_ADDR + TG3_64BIT_REG_LOW, + virt_to_bus(tp->rx_std)); + if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705) { + tw32(RCVDBDI_STD_BD + TG3_BDINFO_MAXLEN_FLAGS, + RX_STD_MAX_SIZE_5705 << BDINFO_FLAGS_MAXLEN_SHIFT); + } else { + TG3_WRITE_SETTINGS(table_not_5705); + } + } + + + /* There is only one send ring on 5705, no need to explicitly + * disable the others. + */ + if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705) { + /* Clear out send RCB ring in SRAM. */ + for (i = NIC_SRAM_SEND_RCB; i < NIC_SRAM_RCV_RET_RCB; i += TG3_BDINFO_SIZE) + tg3_write_mem(i + TG3_BDINFO_MAXLEN_FLAGS, BDINFO_FLAGS_DISABLED); + } + + tp->tx_prod = 0; + tw32_mailbox(MAILBOX_SNDHOST_PROD_IDX_0 + TG3_64BIT_REG_LOW, 0); + tw32_mailbox2(MAILBOX_SNDNIC_PROD_IDX_0 + TG3_64BIT_REG_LOW, 0); + + tg3_set_bdinfo(tp, + NIC_SRAM_SEND_RCB, + virt_to_bus(tp->tx_ring), + (TG3_TX_RING_SIZE << BDINFO_FLAGS_MAXLEN_SHIFT), + NIC_SRAM_TX_BUFFER_DESC); + + /* There is only one receive return ring on 5705, no need to explicitly + * disable the others. + */ + if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705) { + for (i = NIC_SRAM_RCV_RET_RCB; i < NIC_SRAM_STATS_BLK; i += TG3_BDINFO_SIZE) { + tg3_write_mem(i + TG3_BDINFO_MAXLEN_FLAGS, + BDINFO_FLAGS_DISABLED); + } + } + + tp->rx_rcb_ptr = 0; + tw32_mailbox2(MAILBOX_RCVRET_CON_IDX_0 + TG3_64BIT_REG_LOW, 0); + + tg3_set_bdinfo(tp, + NIC_SRAM_RCV_RET_RCB, + virt_to_bus(tp->rx_rcb), + (TG3_RX_RCB_RING_SIZE << BDINFO_FLAGS_MAXLEN_SHIFT), + 0); + + tp->rx_std_ptr = TG3_DEF_RX_RING_PENDING; + tw32_mailbox2(MAILBOX_RCV_STD_PROD_IDX + TG3_64BIT_REG_LOW, + tp->rx_std_ptr); + + tw32_mailbox2(MAILBOX_RCV_JUMBO_PROD_IDX + TG3_64BIT_REG_LOW, 0); + + /* Initialize MAC address and backoff seed. */ + __tg3_set_mac_addr(tp); + + /* Calculate RDMAC_MODE setting early, we need it to determine + * the RCVLPC_STATE_ENABLE mask. + */ + rdmac_mode = (RDMAC_MODE_ENABLE | RDMAC_MODE_TGTABORT_ENAB | + RDMAC_MODE_MSTABORT_ENAB | RDMAC_MODE_PARITYERR_ENAB | + RDMAC_MODE_ADDROFLOW_ENAB | RDMAC_MODE_FIFOOFLOW_ENAB | + RDMAC_MODE_FIFOURUN_ENAB | RDMAC_MODE_FIFOOREAD_ENAB | + RDMAC_MODE_LNGREAD_ENAB); + if (tp->tg3_flags & TG3_FLAG_SPLIT_MODE) + rdmac_mode |= RDMAC_MODE_SPLIT_ENABLE; + if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705) { + if (tp->pci_chip_rev_id != CHIPREV_ID_5705_A0) { + if (!(tr32(TG3PCI_PCISTATE) & PCISTATE_BUS_SPEED_HIGH) && + !(tp->tg3_flags2 & TG3_FLG2_IS_5788)) { + rdmac_mode |= RDMAC_MODE_FIFO_LONG_BURST; + } + } + } + + /* Setup host coalescing engine. */ + tw32(HOSTCC_MODE, 0); + for (i = 0; i < 2000; i++) { + if (!(tr32(HOSTCC_MODE) & HOSTCC_MODE_ENABLE)) + break; + udelay(10); + } + + tp->mac_mode = MAC_MODE_TXSTAT_ENABLE | MAC_MODE_RXSTAT_ENABLE | + MAC_MODE_TDE_ENABLE | MAC_MODE_RDE_ENABLE | MAC_MODE_FHDE_ENABLE; + tw32_carefully(MAC_MODE, tp->mac_mode | MAC_MODE_RXSTAT_CLEAR | MAC_MODE_TXSTAT_CLEAR); + + tp->grc_local_ctrl = GRC_LCLCTRL_INT_ON_ATTN | GRC_LCLCTRL_AUTO_SEEPROM; + if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700) + tp->grc_local_ctrl |= (GRC_LCLCTRL_GPIO_OE1 | + GRC_LCLCTRL_GPIO_OUTPUT1); + tw32_carefully(GRC_LOCAL_CTRL, tp->grc_local_ctrl); + + tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, 0); + tr32(MAILBOX_INTERRUPT_0); + + if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705) { + tw32_carefully(DMAC_MODE, DMAC_MODE_ENABLE); + } + + val = ( WDMAC_MODE_ENABLE | WDMAC_MODE_TGTABORT_ENAB | + WDMAC_MODE_MSTABORT_ENAB | WDMAC_MODE_PARITYERR_ENAB | + WDMAC_MODE_ADDROFLOW_ENAB | WDMAC_MODE_FIFOOFLOW_ENAB | + WDMAC_MODE_FIFOURUN_ENAB | WDMAC_MODE_FIFOOREAD_ENAB | + WDMAC_MODE_LNGREAD_ENAB); + if ((GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705) && + ((tr32(TG3PCI_PCISTATE) & PCISTATE_BUS_SPEED_HIGH) != 0) && + !(tp->tg3_flags2 & TG3_FLG2_IS_5788)) { + val |= WDMAC_MODE_RX_ACCEL; + } + tw32_carefully(WDMAC_MODE, val); + + if ((tp->tg3_flags & TG3_FLAG_PCIX_MODE) != 0) { + val = tr32(TG3PCI_X_CAPS); + if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5703) { + val &= PCIX_CAPS_BURST_MASK; + val |= (PCIX_CAPS_MAX_BURST_CPIOB << PCIX_CAPS_BURST_SHIFT); + } else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) { + val &= ~(PCIX_CAPS_SPLIT_MASK | PCIX_CAPS_BURST_MASK); + val |= (PCIX_CAPS_MAX_BURST_CPIOB << PCIX_CAPS_BURST_SHIFT); + if (tp->tg3_flags & TG3_FLAG_SPLIT_MODE) + val |= (tp->split_mode_max_reqs << + PCIX_CAPS_SPLIT_SHIFT); + } + tw32(TG3PCI_X_CAPS, val); + } + + tw32_carefully(RDMAC_MODE, rdmac_mode); + { + static const uint32_t table_all[] = { + /* MTU + ethernet header + FCS + optional VLAN tag */ + MAC_RX_MTU_SIZE, ETH_MAX_MTU + ETH_HLEN + 8, + + /* The slot time is changed by tg3_setup_phy if we + * run at gigabit with half duplex. + */ + MAC_TX_LENGTHS, + (2 << TX_LENGTHS_IPG_CRS_SHIFT) | + (6 << TX_LENGTHS_IPG_SHIFT) | + (32 << TX_LENGTHS_SLOT_TIME_SHIFT), + + /* Receive rules. */ + MAC_RCV_RULE_CFG, RCV_RULE_CFG_DEFAULT_CLASS, + RCVLPC_CONFIG, 0x0181, + + /* Receive/send statistics. */ + RCVLPC_STATS_ENABLE, 0xffffff, + RCVLPC_STATSCTRL, RCVLPC_STATSCTRL_ENABLE, + SNDDATAI_STATSENAB, 0xffffff, + SNDDATAI_STATSCTRL, (SNDDATAI_SCTRL_ENABLE |SNDDATAI_SCTRL_FASTUPD), + + /* Host coalescing engine */ + HOSTCC_RXCOL_TICKS, 0, + HOSTCC_TXCOL_TICKS, LOW_TXCOL_TICKS, + HOSTCC_RXMAX_FRAMES, 1, + HOSTCC_TXMAX_FRAMES, LOW_RXMAX_FRAMES, + HOSTCC_RXCOAL_MAXF_INT, 1, + HOSTCC_TXCOAL_MAXF_INT, 0, + + /* Status/statistics block address. */ + /* Etherboot lives below 4GB, so HIGH == 0 */ + HOSTCC_STATUS_BLK_HOST_ADDR + TG3_64BIT_REG_HIGH, 0, + + /* No need to enable 32byte coalesce mode. */ + HOSTCC_MODE, HOSTCC_MODE_ENABLE | 0, + + RCVCC_MODE, RCVCC_MODE_ENABLE | RCVCC_MODE_ATTN_ENABLE, + RCVLPC_MODE, RCVLPC_MODE_ENABLE, + + RCVDCC_MODE, RCVDCC_MODE_ENABLE | RCVDCC_MODE_ATTN_ENABLE, + + SNDDATAC_MODE, SNDDATAC_MODE_ENABLE, + SNDBDC_MODE, SNDBDC_MODE_ENABLE | SNDBDC_MODE_ATTN_ENABLE, + RCVBDI_MODE, RCVBDI_MODE_ENABLE | RCVBDI_MODE_RCB_ATTN_ENAB, + RCVDBDI_MODE, RCVDBDI_MODE_ENABLE | RCVDBDI_MODE_INV_RING_SZ, + SNDDATAI_MODE, SNDDATAI_MODE_ENABLE, + SNDBDI_MODE, SNDBDI_MODE_ENABLE | SNDBDI_MODE_ATTN_ENABLE, + SNDBDS_MODE, SNDBDS_MODE_ENABLE | SNDBDS_MODE_ATTN_ENABLE, + + /* Accept all multicast frames. */ + MAC_HASH_REG_0, 0xffffffff, + MAC_HASH_REG_1, 0xffffffff, + MAC_HASH_REG_2, 0xffffffff, + MAC_HASH_REG_3, 0xffffffff, + }; + static const uint32_t table_not_5705[] = { + /* Host coalescing engine */ + HOSTCC_RXCOAL_TICK_INT, 0, + HOSTCC_TXCOAL_TICK_INT, 0, + + /* Status/statistics block address. */ + /* Etherboot lives below 4GB, so HIGH == 0 */ + HOSTCC_STAT_COAL_TICKS, DEFAULT_STAT_COAL_TICKS, + HOSTCC_STATS_BLK_HOST_ADDR + TG3_64BIT_REG_HIGH, 0, + HOSTCC_STATS_BLK_NIC_ADDR, NIC_SRAM_STATS_BLK, + HOSTCC_STATUS_BLK_NIC_ADDR, NIC_SRAM_STATUS_BLK, + + RCVLSC_MODE, RCVLSC_MODE_ENABLE | RCVLSC_MODE_ATTN_ENABLE, + + MBFREE_MODE, MBFREE_MODE_ENABLE, + }; + TG3_WRITE_SETTINGS(table_all); + tw32(HOSTCC_STATS_BLK_HOST_ADDR + TG3_64BIT_REG_LOW, + virt_to_bus(tp->hw_stats)); + tw32(HOSTCC_STATUS_BLK_HOST_ADDR + TG3_64BIT_REG_LOW, + virt_to_bus(tp->hw_status)); + if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705) { + TG3_WRITE_SETTINGS(table_not_5705); + } + } + + tp->tx_mode = TX_MODE_ENABLE; + tw32_carefully(MAC_TX_MODE, tp->tx_mode); + + tp->rx_mode = RX_MODE_ENABLE; + tw32_carefully(MAC_RX_MODE, tp->rx_mode); + + tp->mi_mode = MAC_MI_MODE_BASE; + tw32_carefully(MAC_MI_MODE, tp->mi_mode); + + tw32(MAC_LED_CTRL, 0); + tw32(MAC_MI_STAT, MAC_MI_STAT_LNKSTAT_ATTN_ENAB); + if (tp->phy_id == PHY_ID_SERDES) { + tw32_carefully(MAC_RX_MODE, RX_MODE_RESET); + } + tp->rx_mode |= RX_MODE_KEEP_VLAN_TAG; /* drop tagged vlan packets */ + tw32_carefully(MAC_RX_MODE, tp->rx_mode); + + if (tp->pci_chip_rev_id == CHIPREV_ID_5703_A1) + tw32(MAC_SERDES_CFG, 0x616000); + + /* Prevent chip from dropping frames when flow control + * is enabled. + */ + tw32(MAC_LOW_WMARK_MAX_RX_FRAME, 2); + tr32(MAC_LOW_WMARK_MAX_RX_FRAME); + + err = tg3_setup_phy(tp); + + /* Ignore CRC stats */ + + /* Initialize receive rules. */ + tw32(MAC_RCV_RULE_0, 0xc2000000 & RCV_RULE_DISABLE_MASK); + tw32(MAC_RCV_VALUE_0, 0xffffffff & RCV_RULE_DISABLE_MASK); + tw32(MAC_RCV_RULE_1, 0x86000004 & RCV_RULE_DISABLE_MASK); + tw32(MAC_RCV_VALUE_1, 0xffffffff & RCV_RULE_DISABLE_MASK); + + if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705) + limit = 8; + else + limit = 16; + if (tp->tg3_flags & TG3_FLAG_ENABLE_ASF) + limit -= 4; + switch (limit) { + case 16: tw32(MAC_RCV_RULE_15, 0); tw32(MAC_RCV_VALUE_15, 0); + case 15: tw32(MAC_RCV_RULE_14, 0); tw32(MAC_RCV_VALUE_14, 0); + case 14: tw32(MAC_RCV_RULE_13, 0); tw32(MAC_RCV_VALUE_13, 0); + case 13: tw32(MAC_RCV_RULE_12, 0); tw32(MAC_RCV_VALUE_12, 0); + case 12: tw32(MAC_RCV_RULE_11, 0); tw32(MAC_RCV_VALUE_11, 0); + case 11: tw32(MAC_RCV_RULE_10, 0); tw32(MAC_RCV_VALUE_10, 0); + case 10: tw32(MAC_RCV_RULE_9, 0); tw32(MAC_RCV_VALUE_9, 0); + case 9: tw32(MAC_RCV_RULE_8, 0); tw32(MAC_RCV_VALUE_8, 0); + case 8: tw32(MAC_RCV_RULE_7, 0); tw32(MAC_RCV_VALUE_7, 0); + case 7: tw32(MAC_RCV_RULE_6, 0); tw32(MAC_RCV_VALUE_6, 0); + case 6: tw32(MAC_RCV_RULE_5, 0); tw32(MAC_RCV_VALUE_5, 0); + case 5: tw32(MAC_RCV_RULE_4, 0); tw32(MAC_RCV_VALUE_4, 0); + case 4: /* tw32(MAC_RCV_RULE_3, 0); tw32(MAC_RCV_VALUE_3, 0); */ + case 3: /* tw32(MAC_RCV_RULE_2, 0); tw32(MAC_RCV_VALUE_2, 0); */ + case 2: + case 1: + default: + break; + }; + + return err; +} + + + +/* Chips other than 5700/5701 use the NVRAM for fetching info. */ +static void tg3_nvram_init(struct tg3 *tp) +{ + tw32(GRC_EEPROM_ADDR, + (EEPROM_ADDR_FSM_RESET | + (EEPROM_DEFAULT_CLOCK_PERIOD << + EEPROM_ADDR_CLKPERD_SHIFT))); + + mdelay(1); + + /* Enable seeprom accesses. */ + tw32_carefully(GRC_LOCAL_CTRL, + tr32(GRC_LOCAL_CTRL) | GRC_LCLCTRL_AUTO_SEEPROM); + + if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5700 && + GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5701) { + uint32_t nvcfg1 = tr32(NVRAM_CFG1); + + tp->tg3_flags |= TG3_FLAG_NVRAM; + if (nvcfg1 & NVRAM_CFG1_FLASHIF_ENAB) { + if (nvcfg1 & NVRAM_CFG1_BUFFERED_MODE) + tp->tg3_flags |= TG3_FLAG_NVRAM_BUFFERED; + } else { + nvcfg1 &= ~NVRAM_CFG1_COMPAT_BYPASS; + tw32(NVRAM_CFG1, nvcfg1); + } + + } else { + tp->tg3_flags &= ~(TG3_FLAG_NVRAM | TG3_FLAG_NVRAM_BUFFERED); + } +} + + +static int tg3_nvram_read_using_eeprom( + struct tg3 *tp __unused, uint32_t offset, uint32_t *val) +{ + uint32_t tmp; + int i; + + if (offset > EEPROM_ADDR_ADDR_MASK || + (offset % 4) != 0) { + return -EINVAL; + } + + tmp = tr32(GRC_EEPROM_ADDR) & ~(EEPROM_ADDR_ADDR_MASK | + EEPROM_ADDR_DEVID_MASK | + EEPROM_ADDR_READ); + tw32(GRC_EEPROM_ADDR, + tmp | + (0 << EEPROM_ADDR_DEVID_SHIFT) | + ((offset << EEPROM_ADDR_ADDR_SHIFT) & + EEPROM_ADDR_ADDR_MASK) | + EEPROM_ADDR_READ | EEPROM_ADDR_START); + + for (i = 0; i < 10000; i++) { + tmp = tr32(GRC_EEPROM_ADDR); + + if (tmp & EEPROM_ADDR_COMPLETE) + break; + udelay(100); + } + if (!(tmp & EEPROM_ADDR_COMPLETE)) { + return -EBUSY; + } + + *val = tr32(GRC_EEPROM_DATA); + return 0; +} + +static int tg3_nvram_read(struct tg3 *tp, uint32_t offset, uint32_t *val) +{ + int i, saw_done_clear; + + if (!(tp->tg3_flags & TG3_FLAG_NVRAM)) + return tg3_nvram_read_using_eeprom(tp, offset, val); + + if (tp->tg3_flags & TG3_FLAG_NVRAM_BUFFERED) + offset = ((offset / NVRAM_BUFFERED_PAGE_SIZE) << + NVRAM_BUFFERED_PAGE_POS) + + (offset % NVRAM_BUFFERED_PAGE_SIZE); + + if (offset > NVRAM_ADDR_MSK) + return -EINVAL; + + tw32(NVRAM_SWARB, SWARB_REQ_SET1); + for (i = 0; i < 1000; i++) { + if (tr32(NVRAM_SWARB) & SWARB_GNT1) + break; + udelay(20); + } + + tw32(NVRAM_ADDR, offset); + tw32(NVRAM_CMD, + NVRAM_CMD_RD | NVRAM_CMD_GO | + NVRAM_CMD_FIRST | NVRAM_CMD_LAST | NVRAM_CMD_DONE); + + /* Wait for done bit to clear then set again. */ + saw_done_clear = 0; + for (i = 0; i < 1000; i++) { + udelay(10); + if (!saw_done_clear && + !(tr32(NVRAM_CMD) & NVRAM_CMD_DONE)) + saw_done_clear = 1; + else if (saw_done_clear && + (tr32(NVRAM_CMD) & NVRAM_CMD_DONE)) + break; + } + if (i >= 1000) { + tw32(NVRAM_SWARB, SWARB_REQ_CLR1); + return -EBUSY; + } + + *val = bswap_32(tr32(NVRAM_RDDATA)); + tw32(NVRAM_SWARB, 0x20); + + return 0; +} + +struct subsys_tbl_ent { + uint16_t subsys_vendor, subsys_devid; + uint32_t phy_id; +}; + +static struct subsys_tbl_ent subsys_id_to_phy_id[] = { + /* Broadcom boards. */ + { 0x14e4, 0x1644, PHY_ID_BCM5401 }, /* BCM95700A6 */ + { 0x14e4, 0x0001, PHY_ID_BCM5701 }, /* BCM95701A5 */ + { 0x14e4, 0x0002, PHY_ID_BCM8002 }, /* BCM95700T6 */ + { 0x14e4, 0x0003, PHY_ID_SERDES }, /* BCM95700A9 */ + { 0x14e4, 0x0005, PHY_ID_BCM5701 }, /* BCM95701T1 */ + { 0x14e4, 0x0006, PHY_ID_BCM5701 }, /* BCM95701T8 */ + { 0x14e4, 0x0007, PHY_ID_SERDES }, /* BCM95701A7 */ + { 0x14e4, 0x0008, PHY_ID_BCM5701 }, /* BCM95701A10 */ + { 0x14e4, 0x8008, PHY_ID_BCM5701 }, /* BCM95701A12 */ + { 0x14e4, 0x0009, PHY_ID_BCM5701 }, /* BCM95703Ax1 */ + { 0x14e4, 0x8009, PHY_ID_BCM5701 }, /* BCM95703Ax2 */ + + /* 3com boards. */ + { PCI_VENDOR_ID_3COM, 0x1000, PHY_ID_BCM5401 }, /* 3C996T */ + { PCI_VENDOR_ID_3COM, 0x1006, PHY_ID_BCM5701 }, /* 3C996BT */ + /* { PCI_VENDOR_ID_3COM, 0x1002, PHY_ID_XXX }, 3C996CT */ + /* { PCI_VENDOR_ID_3COM, 0x1003, PHY_ID_XXX }, 3C997T */ + { PCI_VENDOR_ID_3COM, 0x1004, PHY_ID_SERDES }, /* 3C996SX */ + /* { PCI_VENDOR_ID_3COM, 0x1005, PHY_ID_XXX }, 3C997SZ */ + { PCI_VENDOR_ID_3COM, 0x1007, PHY_ID_BCM5701 }, /* 3C1000T */ + { PCI_VENDOR_ID_3COM, 0x1008, PHY_ID_BCM5701 }, /* 3C940BR01 */ + + /* DELL boards. */ + { PCI_VENDOR_ID_DELL, 0x00d1, PHY_ID_BCM5401 }, /* VIPER */ + { PCI_VENDOR_ID_DELL, 0x0106, PHY_ID_BCM5401 }, /* JAGUAR */ + { PCI_VENDOR_ID_DELL, 0x0109, PHY_ID_BCM5411 }, /* MERLOT */ + { PCI_VENDOR_ID_DELL, 0x010a, PHY_ID_BCM5411 }, /* SLIM_MERLOT */ + + /* Compaq boards. */ + { PCI_VENDOR_ID_COMPAQ, 0x007c, PHY_ID_BCM5701 }, /* BANSHEE */ + { PCI_VENDOR_ID_COMPAQ, 0x009a, PHY_ID_BCM5701 }, /* BANSHEE_2 */ + { PCI_VENDOR_ID_COMPAQ, 0x007d, PHY_ID_SERDES }, /* CHANGELING */ + { PCI_VENDOR_ID_COMPAQ, 0x0085, PHY_ID_BCM5701 }, /* NC7780 */ + { PCI_VENDOR_ID_COMPAQ, 0x0099, PHY_ID_BCM5701 } /* NC7780_2 */ +}; + +static int tg3_phy_probe(struct tg3 *tp) +{ + uint32_t eeprom_phy_id, hw_phy_id_1, hw_phy_id_2; + uint32_t hw_phy_id, hw_phy_id_masked; + enum phy_led_mode eeprom_led_mode; + uint32_t val; + unsigned i; + int eeprom_signature_found, err; + + tp->phy_id = PHY_ID_INVALID; + + for (i = 0; i < sizeof(subsys_id_to_phy_id)/sizeof(subsys_id_to_phy_id[0]); i++) { + if ((subsys_id_to_phy_id[i].subsys_vendor == tp->subsystem_vendor) && + (subsys_id_to_phy_id[i].subsys_devid == tp->subsystem_device)) { + tp->phy_id = subsys_id_to_phy_id[i].phy_id; + break; + } + } + + eeprom_phy_id = PHY_ID_INVALID; + eeprom_led_mode = led_mode_auto; + eeprom_signature_found = 0; + tg3_read_mem(NIC_SRAM_DATA_SIG, &val); + if (val == NIC_SRAM_DATA_SIG_MAGIC) { + uint32_t nic_cfg; + + tg3_read_mem(NIC_SRAM_DATA_CFG, &nic_cfg); + tp->nic_sram_data_cfg = nic_cfg; + + eeprom_signature_found = 1; + + if ((nic_cfg & NIC_SRAM_DATA_CFG_PHY_TYPE_MASK) == + NIC_SRAM_DATA_CFG_PHY_TYPE_FIBER) { + eeprom_phy_id = PHY_ID_SERDES; + } else { + uint32_t nic_phy_id; + + tg3_read_mem(NIC_SRAM_DATA_PHY_ID, &nic_phy_id); + if (nic_phy_id != 0) { + uint32_t id1 = nic_phy_id & NIC_SRAM_DATA_PHY_ID1_MASK; + uint32_t id2 = nic_phy_id & NIC_SRAM_DATA_PHY_ID2_MASK; + + eeprom_phy_id = (id1 >> 16) << 10; + eeprom_phy_id |= (id2 & 0xfc00) << 16; + eeprom_phy_id |= (id2 & 0x03ff) << 0; + } + } + + switch (nic_cfg & NIC_SRAM_DATA_CFG_LED_MODE_MASK) { + case NIC_SRAM_DATA_CFG_LED_TRIPLE_SPD: + eeprom_led_mode = led_mode_three_link; + break; + + case NIC_SRAM_DATA_CFG_LED_LINK_SPD: + eeprom_led_mode = led_mode_link10; + break; + + default: + eeprom_led_mode = led_mode_auto; + break; + }; + if (((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5703) || + (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) || + (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705)) && + (nic_cfg & NIC_SRAM_DATA_CFG_EEPROM_WP)) { + tp->tg3_flags |= TG3_FLAG_EEPROM_WRITE_PROT; + } + + if (nic_cfg & NIC_SRAM_DATA_CFG_ASF_ENABLE) + tp->tg3_flags |= TG3_FLAG_ENABLE_ASF; + if (nic_cfg & NIC_SRAM_DATA_CFG_FIBER_WOL) + tp->tg3_flags |= TG3_FLAG_SERDES_WOL_CAP; + } + + /* Now read the physical PHY_ID from the chip and verify + * that it is sane. If it doesn't look good, we fall back + * to either the hard-coded table based PHY_ID and failing + * that the value found in the eeprom area. + */ + err = tg3_readphy(tp, MII_PHYSID1, &hw_phy_id_1); + err |= tg3_readphy(tp, MII_PHYSID2, &hw_phy_id_2); + + hw_phy_id = (hw_phy_id_1 & 0xffff) << 10; + hw_phy_id |= (hw_phy_id_2 & 0xfc00) << 16; + hw_phy_id |= (hw_phy_id_2 & 0x03ff) << 0; + + hw_phy_id_masked = hw_phy_id & PHY_ID_MASK; + + if (!err && KNOWN_PHY_ID(hw_phy_id_masked)) { + tp->phy_id = hw_phy_id; + } else { + /* phy_id currently holds the value found in the + * subsys_id_to_phy_id[] table or PHY_ID_INVALID + * if a match was not found there. + */ + if (tp->phy_id == PHY_ID_INVALID) { + if (!eeprom_signature_found || + !KNOWN_PHY_ID(eeprom_phy_id & PHY_ID_MASK)) + return -ENODEV; + tp->phy_id = eeprom_phy_id; + } + } + + err = tg3_phy_reset(tp); + if (err) + return err; + + if (tp->pci_chip_rev_id == CHIPREV_ID_5701_A0 || + tp->pci_chip_rev_id == CHIPREV_ID_5701_B0) { + uint32_t mii_tg3_ctrl; + + /* These chips, when reset, only advertise 10Mb + * capabilities. Fix that. + */ + err = tg3_writephy(tp, MII_ADVERTISE, + (ADVERTISE_CSMA | + ADVERTISE_PAUSE_CAP | + ADVERTISE_10HALF | + ADVERTISE_10FULL | + ADVERTISE_100HALF | + ADVERTISE_100FULL)); + mii_tg3_ctrl = (MII_TG3_CTRL_ADV_1000_HALF | + MII_TG3_CTRL_ADV_1000_FULL | + MII_TG3_CTRL_AS_MASTER | + MII_TG3_CTRL_ENABLE_AS_MASTER); + if (tp->tg3_flags & TG3_FLAG_10_100_ONLY) + mii_tg3_ctrl = 0; + + err |= tg3_writephy(tp, MII_TG3_CTRL, mii_tg3_ctrl); + err |= tg3_writephy(tp, MII_BMCR, + (BMCR_ANRESTART | BMCR_ANENABLE)); + } + + if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5703) { + tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x0c00); + tg3_writephy(tp, MII_TG3_DSP_ADDRESS, 0x201f); + tg3_writedsp(tp, MII_TG3_DSP_RW_PORT, 0x2aaa); + } + + if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) { + tg3_writephy(tp, 0x1c, 0x8d68); + tg3_writephy(tp, 0x1c, 0x8d68); + } + + /* Enable Ethernet@WireSpeed */ + tg3_phy_set_wirespeed(tp); + + if (!err && ((tp->phy_id & PHY_ID_MASK) == PHY_ID_BCM5401)) { + err = tg3_init_5401phy_dsp(tp); + } + + /* Determine the PHY led mode. + * Be careful if this gets set wrong it can result in an inability to + * establish a link. + */ + if (tp->phy_id == PHY_ID_SERDES) { + tp->led_mode = led_mode_three_link; + } + else if (tp->subsystem_vendor == PCI_VENDOR_ID_DELL) { + tp->led_mode = led_mode_link10; + } else { + tp->led_mode = led_mode_three_link; + if (eeprom_signature_found && + eeprom_led_mode != led_mode_auto) + tp->led_mode = eeprom_led_mode; + } + + if (tp->phy_id == PHY_ID_SERDES) + tp->link_config.advertising = + (ADVERTISED_1000baseT_Half | + ADVERTISED_1000baseT_Full | + ADVERTISED_Autoneg | + ADVERTISED_FIBRE); + if (tp->tg3_flags & TG3_FLAG_10_100_ONLY) + tp->link_config.advertising &= + ~(ADVERTISED_1000baseT_Half | + ADVERTISED_1000baseT_Full); + + return err; +} + +#if SUPPORT_PARTNO_STR +static void tg3_read_partno(struct tg3 *tp) +{ + unsigned char vpd_data[256]; + int i; + + for (i = 0; i < 256; i += 4) { + uint32_t tmp; + + if (tg3_nvram_read(tp, 0x100 + i, &tmp)) + goto out_not_found; + + vpd_data[i + 0] = ((tmp >> 0) & 0xff); + vpd_data[i + 1] = ((tmp >> 8) & 0xff); + vpd_data[i + 2] = ((tmp >> 16) & 0xff); + vpd_data[i + 3] = ((tmp >> 24) & 0xff); + } + + /* Now parse and find the part number. */ + for (i = 0; i < 256; ) { + unsigned char val = vpd_data[i]; + int block_end; + + if (val == 0x82 || val == 0x91) { + i = (i + 3 + + (vpd_data[i + 1] + + (vpd_data[i + 2] << 8))); + continue; + } + + if (val != 0x90) + goto out_not_found; + + block_end = (i + 3 + + (vpd_data[i + 1] + + (vpd_data[i + 2] << 8))); + i += 3; + while (i < block_end) { + if (vpd_data[i + 0] == 'P' && + vpd_data[i + 1] == 'N') { + int partno_len = vpd_data[i + 2]; + + if (partno_len > 24) + goto out_not_found; + + memcpy(tp->board_part_number, + &vpd_data[i + 3], + partno_len); + + /* Success. */ + return; + } + } + + /* Part number not found. */ + goto out_not_found; + } + +out_not_found: + memcpy(tp->board_part_number, "none", sizeof("none")); +} +#else +#define tg3_read_partno(TP) ((TP)->board_part_number[0] = '\0') +#endif + +static int tg3_get_invariants(struct tg3 *tp) +{ + uint32_t misc_ctrl_reg; + uint32_t pci_state_reg, grc_misc_cfg; + uint16_t pci_cmd; + uint8_t pci_latency; + int err; + + /* Read the subsystem vendor and device ids */ + pci_read_config_word(tp->pdev, PCI_SUBSYSTEM_VENDOR_ID, &tp->subsystem_vendor); + pci_read_config_word(tp->pdev, PCI_SUBSYSTEM_ID, &tp->subsystem_device); + + /* The sun_5704 code needs infrastructure etherboot does have + * ignore it for now. + */ + + /* If we have an AMD 762 or Intel ICH/ICH0 chipset, write + * reordering to the mailbox registers done by the host + * controller can cause major troubles. We read back from + * every mailbox register write to force the writes to be + * posted to the chip in order. + * + * TG3_FLAG_MBOX_WRITE_REORDER has been forced on. + */ + + /* Force memory write invalidate off. If we leave it on, + * then on 5700_BX chips we have to enable a workaround. + * The workaround is to set the TG3PCI_DMA_RW_CTRL boundry + * to match the cacheline size. The Broadcom driver have this + * workaround but turns MWI off all the times so never uses + * it. This seems to suggest that the workaround is insufficient. + */ + pci_read_config_word(tp->pdev, PCI_COMMAND, &pci_cmd); + pci_cmd &= ~PCI_COMMAND_INVALIDATE; + /* Also, force SERR#/PERR# in PCI command. */ + pci_cmd |= PCI_COMMAND_PARITY | PCI_COMMAND_SERR; + pci_write_config_word(tp->pdev, PCI_COMMAND, pci_cmd); + + /* It is absolutely critical that TG3PCI_MISC_HOST_CTRL + * has the register indirect write enable bit set before + * we try to access any of the MMIO registers. It is also + * critical that the PCI-X hw workaround situation is decided + * before that as well. + */ + pci_read_config_dword(tp->pdev, TG3PCI_MISC_HOST_CTRL, &misc_ctrl_reg); + + tp->pci_chip_rev_id = (misc_ctrl_reg >> MISC_HOST_CTRL_CHIPREV_SHIFT); + + /* Initialize misc host control in PCI block. */ + tp->misc_host_ctrl |= (misc_ctrl_reg & + MISC_HOST_CTRL_CHIPREV); + pci_write_config_dword(tp->pdev, TG3PCI_MISC_HOST_CTRL, + tp->misc_host_ctrl); + + pci_read_config_byte(tp->pdev, PCI_LATENCY_TIMER, &pci_latency); + if (pci_latency < 64) { + pci_write_config_byte(tp->pdev, PCI_LATENCY_TIMER, 64); + } + + pci_read_config_dword(tp->pdev, TG3PCI_PCISTATE, &pci_state_reg); + + /* If this is a 5700 BX chipset, and we are in PCI-X + * mode, enable register write workaround. + * + * The workaround is to use indirect register accesses + * for all chip writes not to mailbox registers. + * + * In etherboot to simplify things we just always use this work around. + */ + if ((pci_state_reg & PCISTATE_CONV_PCI_MODE) == 0) { + tp->tg3_flags |= TG3_FLAG_PCIX_MODE; + } + /* Back to back register writes can cause problems on the 5701, + * the workaround is to read back all reg writes except those to + * mailbox regs. + * In etherboot we always use indirect register accesses so + * we don't see this. + */ + + if ((pci_state_reg & PCISTATE_BUS_SPEED_HIGH) != 0) + tp->tg3_flags |= TG3_FLAG_PCI_HIGH_SPEED; + if ((pci_state_reg & PCISTATE_BUS_32BIT) != 0) + tp->tg3_flags |= TG3_FLAG_PCI_32BIT; + + /* Chip-specific fixup from Broadcom driver */ + if ((tp->pci_chip_rev_id == CHIPREV_ID_5704_A0) && + (!(pci_state_reg & PCISTATE_RETRY_SAME_DMA))) { + pci_state_reg |= PCISTATE_RETRY_SAME_DMA; + pci_write_config_dword(tp->pdev, TG3PCI_PCISTATE, pci_state_reg); + } + + /* Force the chip into D0. */ + tg3_set_power_state_0(tp); + + /* Etherboot does not ask the tg3 to do checksums */ + /* Etherboot does not ask the tg3 to do jumbo frames */ + /* Ehterboot does not ask the tg3 to use WakeOnLan. */ + + /* A few boards don't want Ethernet@WireSpeed phy feature */ + if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700) || + ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705) && + (tp->pci_chip_rev_id != CHIPREV_ID_5705_A0) && + (tp->pci_chip_rev_id != CHIPREV_ID_5705_A1))) { + tp->tg3_flags2 |= TG3_FLG2_NO_ETH_WIRE_SPEED; + } + + /* Avoid tagged irq status etherboot does not use irqs */ + + /* Only 5701 and later support tagged irq status mode. + * Also, 5788 chips cannot use tagged irq status. + * + * However, since etherboot does not use irqs avoid tagged irqs + * status because the interrupt condition is more difficult to + * fully clear in that mode. + */ + + /* Since some 5700_AX && 5700_BX have problems with 32BYTE + * coalesce_mode, and the rest work fine anything set. + * Don't enable HOST_CC_MODE_32BYTE in etherboot. + */ + + /* Initialize MAC MI mode, polling disabled. */ + tw32_carefully(MAC_MI_MODE, tp->mi_mode); + + /* Initialize data/descriptor byte/word swapping. */ + tw32(GRC_MODE, tp->grc_mode); + + tg3_switch_clocks(tp); + + /* Clear this out for sanity. */ + tw32(TG3PCI_MEM_WIN_BASE_ADDR, 0); + + /* Etherboot does not need to check if the PCIX_TARGET_HWBUG + * is needed. It always uses it. + */ + + udelay(50); + tg3_nvram_init(tp); + + /* The TX descriptors will reside in main memory. + */ + + /* See which board we are using. + */ + grc_misc_cfg = tr32(GRC_MISC_CFG); + grc_misc_cfg &= GRC_MISC_CFG_BOARD_ID_MASK; + + if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704 && + grc_misc_cfg == GRC_MISC_CFG_BOARD_ID_5704CIOBE) { + tp->tg3_flags |= TG3_FLAG_SPLIT_MODE; + tp->split_mode_max_reqs = SPLIT_MODE_5704_MAX_REQ; + } + + if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705 && + (grc_misc_cfg == GRC_MISC_CFG_BOARD_ID_5788 || + grc_misc_cfg == GRC_MISC_CFG_BOARD_ID_5788M)) + tp->tg3_flags2 |= TG3_FLG2_IS_5788; + + /* these are limited to 10/100 only */ + if (((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5703) && + ((grc_misc_cfg == 0x8000) || (grc_misc_cfg == 0x4000))) || + ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705) && + (tp->pdev->vendor == PCI_VENDOR_ID_BROADCOM) && + ((tp->pdev->dev_id == PCI_DEVICE_ID_TIGON3_5901) || + (tp->pdev->dev_id == PCI_DEVICE_ID_TIGON3_5901_2)))) { + tp->tg3_flags |= TG3_FLAG_10_100_ONLY; + } + + err = tg3_phy_probe(tp); + if (err) { + printf("phy probe failed, err %d\n", err); + } + + tg3_read_partno(tp); + + + /* 5700 BX chips need to have their TX producer index mailboxes + * written twice to workaround a bug. + * In etherboot we do this unconditionally to simplify things. + */ + + /* 5700 chips can get confused if TX buffers straddle the + * 4GB address boundary in some cases. + * + * In etherboot we can ignore the problem as etherboot lives below 4GB. + */ + + /* In etherboot wake-on-lan is unconditionally disabled */ + return err; +} + +static int tg3_get_device_address(struct tg3 *tp) +{ + struct nic *nic = tp->nic; + uint32_t hi, lo, mac_offset; + + if (PCI_FUNC(tp->pdev->devfn) == 0) + mac_offset = 0x7c; + else + mac_offset = 0xcc; + + /* First try to get it from MAC address mailbox. */ + tg3_read_mem(NIC_SRAM_MAC_ADDR_HIGH_MBOX, &hi); + if ((hi >> 16) == 0x484b) { + nic->node_addr[0] = (hi >> 8) & 0xff; + nic->node_addr[1] = (hi >> 0) & 0xff; + + tg3_read_mem(NIC_SRAM_MAC_ADDR_LOW_MBOX, &lo); + nic->node_addr[2] = (lo >> 24) & 0xff; + nic->node_addr[3] = (lo >> 16) & 0xff; + nic->node_addr[4] = (lo >> 8) & 0xff; + nic->node_addr[5] = (lo >> 0) & 0xff; + } + /* Next, try NVRAM. */ + else if (!tg3_nvram_read(tp, mac_offset + 0, &hi) && + !tg3_nvram_read(tp, mac_offset + 4, &lo)) { + nic->node_addr[0] = ((hi >> 16) & 0xff); + nic->node_addr[1] = ((hi >> 24) & 0xff); + nic->node_addr[2] = ((lo >> 0) & 0xff); + nic->node_addr[3] = ((lo >> 8) & 0xff); + nic->node_addr[4] = ((lo >> 16) & 0xff); + nic->node_addr[5] = ((lo >> 24) & 0xff); + } + /* Finally just fetch it out of the MAC control regs. */ + else { + hi = tr32(MAC_ADDR_0_HIGH); + lo = tr32(MAC_ADDR_0_LOW); + + nic->node_addr[5] = lo & 0xff; + nic->node_addr[4] = (lo >> 8) & 0xff; + nic->node_addr[3] = (lo >> 16) & 0xff; + nic->node_addr[2] = (lo >> 24) & 0xff; + nic->node_addr[1] = hi & 0xff; + nic->node_addr[0] = (hi >> 8) & 0xff; + } + + return 0; +} + + +static int tg3_setup_dma(struct tg3 *tp) +{ + tw32(TG3PCI_CLOCK_CTRL, 0); + + if ((tp->tg3_flags & TG3_FLAG_PCIX_MODE) == 0) { + tp->dma_rwctrl = + (0x7 << DMA_RWCTRL_PCI_WRITE_CMD_SHIFT) | + (0x6 << DMA_RWCTRL_PCI_READ_CMD_SHIFT) | + (0x7 << DMA_RWCTRL_WRITE_WATER_SHIFT) | + (0x7 << DMA_RWCTRL_READ_WATER_SHIFT) | + (0x0f << DMA_RWCTRL_MIN_DMA_SHIFT); + if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705) { + tp->dma_rwctrl &= ~(DMA_RWCTRL_MIN_DMA << DMA_RWCTRL_MIN_DMA_SHIFT); + } + } else { + if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) + tp->dma_rwctrl = + (0x7 << DMA_RWCTRL_PCI_WRITE_CMD_SHIFT) | + (0x6 << DMA_RWCTRL_PCI_READ_CMD_SHIFT) | + (0x3 << DMA_RWCTRL_WRITE_WATER_SHIFT) | + (0x7 << DMA_RWCTRL_READ_WATER_SHIFT) | + (0x00 << DMA_RWCTRL_MIN_DMA_SHIFT); + else + tp->dma_rwctrl = + (0x7 << DMA_RWCTRL_PCI_WRITE_CMD_SHIFT) | + (0x6 << DMA_RWCTRL_PCI_READ_CMD_SHIFT) | + (0x3 << DMA_RWCTRL_WRITE_WATER_SHIFT) | + (0x3 << DMA_RWCTRL_READ_WATER_SHIFT) | + (0x0f << DMA_RWCTRL_MIN_DMA_SHIFT); + + /* Wheee, some more chip bugs... */ + if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5703) || + (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704)) { + uint32_t ccval = tr32(TG3PCI_CLOCK_CTRL) & 0x1f; + + if ((ccval == 0x6) || (ccval == 0x7)) { + tp->dma_rwctrl |= DMA_RWCTRL_ONE_DMA; + } + } + } + + if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5703) || + (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704)) { + tp->dma_rwctrl &= ~(DMA_RWCTRL_MIN_DMA << DMA_RWCTRL_MIN_DMA_SHIFT); + } + + tp->dma_rwctrl |= DMA_RWCTRL_ASSERT_ALL_BE; + + tw32(TG3PCI_DMA_RW_CTRL, tp->dma_rwctrl); + + return 0; +} + +static void tg3_init_link_config(struct tg3 *tp) +{ + tp->link_config.advertising = + (ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full | + ADVERTISED_100baseT_Half | ADVERTISED_100baseT_Full | + ADVERTISED_1000baseT_Half | ADVERTISED_1000baseT_Full | + ADVERTISED_Autoneg | ADVERTISED_MII); + tp->carrier_ok = 0; + tp->link_config.active_speed = SPEED_INVALID; + tp->link_config.active_duplex = DUPLEX_INVALID; +} + + +#if SUPPORT_PHY_STR +static const char * tg3_phy_string(struct tg3 *tp) +{ + switch (tp->phy_id & PHY_ID_MASK) { + case PHY_ID_BCM5400: return "5400"; + case PHY_ID_BCM5401: return "5401"; + case PHY_ID_BCM5411: return "5411"; + case PHY_ID_BCM5701: return "5701"; + case PHY_ID_BCM5703: return "5703"; + case PHY_ID_BCM5704: return "5704"; + case PHY_ID_BCM8002: return "8002"; + case PHY_ID_SERDES: return "serdes"; + default: return "unknown"; + }; +} +#else +#define tg3_phy_string(TP) "?" +#endif + + +static void tg3_poll_link(struct tg3 *tp) +{ + uint32_t mac_stat; + + mac_stat = tr32(MAC_STATUS); + if (tp->phy_id == PHY_ID_SERDES) { + if (tp->carrier_ok? + (mac_stat & MAC_STATUS_LNKSTATE_CHANGED): + (mac_stat & MAC_STATUS_PCS_SYNCED)) { + tw32_carefully(MAC_MODE, tp->mac_mode & ~MAC_MODE_PORT_MODE_MASK); + tw32_carefully(MAC_MODE, tp->mac_mode); + + tg3_setup_phy(tp); + } + } + else { + if (mac_stat & MAC_STATUS_LNKSTATE_CHANGED) { + tg3_setup_phy(tp); + } + } +} + +/************************************************************************** +POLL - Wait for a frame +***************************************************************************/ +static void tg3_ack_irqs(struct tg3 *tp) +{ + if (tp->hw_status->status & SD_STATUS_UPDATED) { + /* + * writing any value to intr-mbox-0 clears PCI INTA# and + * chip-internal interrupt pending events. + * writing non-zero to intr-mbox-0 additional tells the + * NIC to stop sending us irqs, engaging "in-intr-handler" + * event coalescing. + */ + tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, + 0x00000001); + /* + * Flush PCI write. This also guarantees that our + * status block has been flushed to host memory. + */ + tr32(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW); + tp->hw_status->status &= ~SD_STATUS_UPDATED; + } +} + +static int tg3_poll(struct nic *nic, int retrieve) +{ + /* return true if there's an ethernet packet ready to read */ + /* nic->packet should contain data on return */ + /* nic->packetlen should contain length of data */ + + struct tg3 *tp = &tg3; + int result; + + result = 0; + + if ( (tp->hw_status->idx[0].rx_producer != tp->rx_rcb_ptr) && !retrieve ) + return 1; + + tg3_ack_irqs(tp); + + if (tp->hw_status->idx[0].rx_producer != tp->rx_rcb_ptr) { + struct tg3_rx_buffer_desc *desc; + unsigned int len; + desc = &tp->rx_rcb[tp->rx_rcb_ptr]; + if ((desc->opaque & RXD_OPAQUE_RING_MASK) == RXD_OPAQUE_RING_STD) { + len = ((desc->idx_len & RXD_LEN_MASK) >> RXD_LEN_SHIFT) - 4; /* omit crc */ + + nic->packetlen = len; + memcpy(nic->packet, bus_to_virt(desc->addr_lo), len); + result = 1; + } + tp->rx_rcb_ptr = (tp->rx_rcb_ptr + 1) % TG3_RX_RCB_RING_SIZE; + + /* ACK the status ring */ + tw32_mailbox2(MAILBOX_RCVRET_CON_IDX_0 + TG3_64BIT_REG_LOW, tp->rx_rcb_ptr); + + /* Refill RX ring. */ + if (result) { + tp->rx_std_ptr = (tp->rx_std_ptr + 1) % TG3_RX_RING_SIZE; + tw32_mailbox2(MAILBOX_RCV_STD_PROD_IDX + TG3_64BIT_REG_LOW, tp->rx_std_ptr); + } + } + tg3_poll_link(tp); + return result; +} + +/************************************************************************** +TRANSMIT - Transmit a frame +***************************************************************************/ +#if 0 +static void tg3_set_txd(struct tg3 *tp, int entry, + dma_addr_t mapping, int len, uint32_t flags, + uint32_t mss_and_is_end) +{ + struct tg3_tx_buffer_desc *txd = &tp->tx_ring[entry]; + int is_end = (mss_and_is_end & 0x1); + if (is_end) { + flags |= TXD_FLAG_END; + } + + txd->addr_hi = 0; + txd->addr_lo = mapping & 0xffffffff; + txd->len_flags = (len << TXD_LEN_SHIFT) | flags; + txd->vlan_tag = 0 << TXD_VLAN_TAG_SHIFT; +} +#endif + +static void tg3_transmit(struct nic *nic, const char *dst_addr, + unsigned int type, unsigned int size, const char *packet) +{ + static struct eth_frame { + uint8_t dst_addr[ETH_ALEN]; + uint8_t src_addr[ETH_ALEN]; + uint16_t type; + uint8_t data [ETH_FRAME_LEN - ETH_HLEN]; + } frame[2]; + static int frame_idx; + + /* send the packet to destination */ + struct tg3_tx_buffer_desc *txd; + struct tg3 *tp; + uint32_t entry; + int i; + + /* Wait until there is a free packet frame */ + tp = &tg3; + i = 0; + entry = tp->tx_prod; + while((tp->hw_status->idx[0].tx_consumer != entry) && + (tp->hw_status->idx[0].tx_consumer != PREV_TX(entry))) { + mdelay(10); /* give the nick a chance */ + poll_interruptions(); + if (++i > 500) { /* timeout 5s for transmit */ + printf("transmit timed out\n"); + tg3_halt(tp); + tg3_setup_hw(tp); + return; + } + } + if (i != 0) { + printf("#"); + } + + /* Copy the packet to the our local buffer */ + memcpy(&frame[frame_idx].dst_addr, dst_addr, ETH_ALEN); + memcpy(&frame[frame_idx].src_addr, nic->node_addr, ETH_ALEN); + frame[frame_idx].type = htons(type); + memset(&frame[frame_idx].data, 0, sizeof(frame[frame_idx].data)); + memcpy(&frame[frame_idx].data, packet, size); + + /* Setup the ring buffer entry to transmit */ + txd = &tp->tx_ring[entry]; + txd->addr_hi = 0; /* Etherboot runs under 4GB */ + txd->addr_lo = virt_to_bus(&frame[frame_idx]); + txd->len_flags = ((size + ETH_HLEN) << TXD_LEN_SHIFT) | TXD_FLAG_END; + txd->vlan_tag = 0 << TXD_VLAN_TAG_SHIFT; + + /* Advance to the next entry */ + entry = NEXT_TX(entry); + frame_idx ^= 1; + + /* Packets are ready, update Tx producer idx local and on card */ + tw32_mailbox((MAILBOX_SNDHOST_PROD_IDX_0 + TG3_64BIT_REG_LOW), entry); + tw32_mailbox2((MAILBOX_SNDHOST_PROD_IDX_0 + TG3_64BIT_REG_LOW), entry); + tp->tx_prod = entry; +} + +/************************************************************************** +DISABLE - Turn off ethernet interface +***************************************************************************/ +static void tg3_disable(struct dev *dev __unused) +{ + struct tg3 *tp = &tg3; + /* put the card in its initial state */ + /* This function serves 3 purposes. + * This disables DMA and interrupts so we don't receive + * unexpected packets or interrupts from the card after + * etherboot has finished. + * This frees resources so etherboot may use + * this driver on another interface + * This allows etherboot to reinitialize the interface + * if something is something goes wrong. + */ + tg3_halt(tp); + tp->tg3_flags &= ~(TG3_FLAG_INIT_COMPLETE|TG3_FLAG_GOT_SERDES_FLOWCTL); + tp->carrier_ok = 0; + iounmap((void *)tp->regs); +} + +/************************************************************************** +IRQ - Enable, Disable, or Force interrupts +***************************************************************************/ +static void tg3_irq(struct nic *nic __unused, irq_action_t action __unused) +{ + switch ( action ) { + case DISABLE : + break; + case ENABLE : + break; + case FORCE : + break; + } +} + +/************************************************************************** +PROBE - Look for an adapter, this routine's visible to the outside +You should omit the last argument struct pci_device * for a non-PCI NIC +***************************************************************************/ +static int tg3_probe(struct dev *dev, struct pci_device *pdev) +{ + struct nic *nic = (struct nic *)dev; + struct tg3 *tp = &tg3; + unsigned long tg3reg_base, tg3reg_len; + int i, err, pm_cap; + + if (pdev == 0) + return 0; + + memset(tp, 0, sizeof(*tp)); + + adjust_pci_device(pdev); + + nic->irqno = 0; + nic->ioaddr = pdev->ioaddr & ~3; + + /* Find power-management capability. */ + pm_cap = pci_find_capability(pdev, PCI_CAP_ID_PM); + if (pm_cap == 0) { + printf("Cannot find PowerManagement capability, aborting.\n"); + return 0; + } + tg3reg_base = pci_bar_start(pdev, PCI_BASE_ADDRESS_0); + if (tg3reg_base == -1UL) { + printf("Unuseable bar\n"); + return 0; + } + tg3reg_len = pci_bar_size(pdev, PCI_BASE_ADDRESS_0); + + tp->pdev = pdev; + tp->nic = nic; + tp->pm_cap = pm_cap; + tp->rx_mode = 0; + tp->tx_mode = 0; + tp->mi_mode = MAC_MI_MODE_BASE; + tp->tg3_flags = 0 & ~TG3_FLAG_INIT_COMPLETE; + + /* The word/byte swap controls here control register access byte + * swapping. DMA data byte swapping is controlled in the GRC_MODE + * setting below. + */ + tp->misc_host_ctrl = + MISC_HOST_CTRL_MASK_PCI_INT | + MISC_HOST_CTRL_WORD_SWAP | + MISC_HOST_CTRL_INDIR_ACCESS | + MISC_HOST_CTRL_PCISTATE_RW; + + /* The NONFRM (non-frame) byte/word swap controls take effect + * on descriptor entries, anything which isn't packet data. + * + * The StrongARM chips on the board (one for tx, one for rx) + * are running in big-endian mode. + */ + tp->grc_mode = (GRC_MODE_WSWAP_DATA | GRC_MODE_BSWAP_DATA | + GRC_MODE_WSWAP_NONFRM_DATA); +#if __BYTE_ORDER == __BIG_ENDIAN + tp->grc_mode |= GRC_MODE_BSWAP_NONFRM_DATA; +#endif + tp->regs = (unsigned long) ioremap(tg3reg_base, tg3reg_len); + if (tp->regs == 0UL) { + printf("Cannot map device registers, aborting\n"); + return 0; + } + + tg3_init_link_config(tp); + + err = tg3_get_invariants(tp); + if (err) { + printf("Problem fetching invariants of chip, aborting.\n"); + goto err_out_iounmap; + } + + err = tg3_get_device_address(tp); + if (err) { + printf("Could not obtain valid ethernet address, aborting.\n"); + goto err_out_iounmap; + } + printf("Ethernet addr: %!\n", nic->node_addr); + + tg3_setup_dma(tp); + + /* Now that we have fully setup the chip, save away a snapshot + * of the PCI config space. We need to restore this after + * GRC_MISC_CFG core clock resets and some resume events. + */ + pci_save_state(tp->pdev, tp->pci_cfg_state); + + printf("Tigon3 [partno(%s) rev %hx PHY(%s)] (PCI%s:%s:%s)\n", + tp->board_part_number, + tp->pci_chip_rev_id, + tg3_phy_string(tp), + ((tp->tg3_flags & TG3_FLAG_PCIX_MODE) ? "X" : ""), + ((tp->tg3_flags & TG3_FLAG_PCI_HIGH_SPEED) ? + ((tp->tg3_flags & TG3_FLAG_PCIX_MODE) ? "133MHz" : "66MHz") : + ((tp->tg3_flags & TG3_FLAG_PCIX_MODE) ? "100MHz" : "33MHz")), + ((tp->tg3_flags & TG3_FLAG_PCI_32BIT) ? "32-bit" : "64-bit")); + + + err = tg3_setup_hw(tp); + if (err) { + goto err_out_disable; + } + tp->tg3_flags |= TG3_FLAG_INIT_COMPLETE; + + /* Wait for a reasonable time for the link to come up */ + tg3_poll_link(tp); + for(i = 0; !tp->carrier_ok && (i < VALID_LINK_TIMEOUT*100); i++) { + mdelay(1); + tg3_poll_link(tp); + } + if (!tp->carrier_ok){ + printf("Valid link not established\n"); + goto err_out_disable; + } + + dev->disable = tg3_disable; + nic->poll = tg3_poll; + nic->transmit = tg3_transmit; + nic->irq = tg3_irq; + + return 1; + + err_out_iounmap: + iounmap((void *)tp->regs); + return 0; + err_out_disable: + tg3_disable(dev); + return 0; +} + +static struct pci_id tg3_nics[] = { +PCI_ROM(0x14e4, 0x1644, "tg3-5700", "Broadcom Tigon 3 5700"), +PCI_ROM(0x14e4, 0x1645, "tg3-5701", "Broadcom Tigon 3 5701"), +PCI_ROM(0x14e4, 0x1646, "tg3-5702", "Broadcom Tigon 3 5702"), +PCI_ROM(0x14e4, 0x1647, "tg3-5703", "Broadcom Tigon 3 5703"), +PCI_ROM(0x14e4, 0x1648, "tg3-5704", "Broadcom Tigon 3 5704"), +PCI_ROM(0x14e4, 0x164d, "tg3-5702FE", "Broadcom Tigon 3 5702FE"), +PCI_ROM(0x14e4, 0x1653, "tg3-5705", "Broadcom Tigon 3 5705"), +PCI_ROM(0x14e4, 0x1654, "tg3-5705_2", "Broadcom Tigon 3 5705_2"), +PCI_ROM(0x14e4, 0x165d, "tg3-5705M", "Broadcom Tigon 3 5705M"), +PCI_ROM(0x14e4, 0x165e, "tg3-5705M_2", "Broadcom Tigon 3 5705M_2"), +PCI_ROM(0x14e4, 0x1696, "tg3-5782", "Broadcom Tigon 3 5782"), +PCI_ROM(0x14e4, 0x169c, "tg3-5788", "Broadcom Tigon 3 5788"), +PCI_ROM(0x14e4, 0x16a6, "tg3-5702X", "Broadcom Tigon 3 5702X"), +PCI_ROM(0x14e4, 0x16a7, "tg3-5703X", "Broadcom Tigon 3 5703X"), +PCI_ROM(0x14e4, 0x16a8, "tg3-5704S", "Broadcom Tigon 3 5704S"), +PCI_ROM(0x14e4, 0x16c6, "tg3-5702A3", "Broadcom Tigon 3 5702A3"), +PCI_ROM(0x14e4, 0x16c7, "tg3-5703A3", "Broadcom Tigon 3 5703A3"), +PCI_ROM(0x14e4, 0x170d, "tg3-5901", "Broadcom Tigon 3 5901"), +PCI_ROM(0x14e4, 0x170e, "tg3-5901_2", "Broadcom Tigon 3 5901_2"), +PCI_ROM(0x1148, 0x4400, "tg3-9DXX", "Syskonnect 9DXX"), +PCI_ROM(0x1148, 0x4500, "tg3-9MXX", "Syskonnect 9MXX"), +PCI_ROM(0x173b, 0x03e8, "tg3-ac1000", "Altima AC1000"), +PCI_ROM(0x173b, 0x03e9, "tg3-ac1001", "Altima AC1001"), +PCI_ROM(0x173b, 0x03ea, "tg3-ac9100", "Altima AC9100"), +PCI_ROM(0x173b, 0x03eb, "tg3-ac1003", "Altima AC1003"), +}; + +struct pci_driver tg3_driver = { + .type = NIC_DRIVER, + .name = "TG3", + .probe = tg3_probe, + .ids = tg3_nics, + .id_count = sizeof(tg3_nics)/sizeof(tg3_nics[0]), + .class = 0, +}; diff --git a/usr/src/grub/grub-0.97/netboot/tg3.h b/usr/src/grub/grub-0.97/netboot/tg3.h new file mode 100644 index 0000000000..a337a2aca8 --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/tg3.h @@ -0,0 +1,2203 @@ +/* $Id: tg3.h,v 1.3 2003/02/25 06:02:58 ebiederm Exp $ + * tg3.h: Definitions for Broadcom Tigon3 ethernet driver. + * + * Copyright (C) 2001, 2002 David S. Miller (davem@redhat.com) + * Copyright (C) 2001 Jeff Garzik (jgarzik@mandrakesoft.com) + */ + +#ifndef _T3_H +#define _T3_H + +#include "stdint.h" + +typedef unsigned long dma_addr_t; + +/* From mii.h */ + +/* 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) + +/* 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. */ +#define SPEED_10 0 +#define SPEED_100 1 +#define SPEED_1000 2 +#define SPEED_INVALID 3 + + +/* Duplex, half or full. */ +#define DUPLEX_HALF 0x00 +#define DUPLEX_FULL 0x01 +#define DUPLEX_INVALID 0x02 + +/* Which connector port. */ +#define PORT_TP 0x00 +#define PORT_AUI 0x01 +#define PORT_MII 0x02 +#define PORT_FIBRE 0x03 +#define PORT_BNC 0x04 + +/* Which tranceiver 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 */ + +/* 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_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 0x007f /* Unused... */ +#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 0x07c0 /* Unused... */ +#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_10FULL 0x0040 /* Try for 10mbps full-duplex */ +#define ADVERTISE_100HALF 0x0080 /* Try for 100mbps half-duplex */ +#define ADVERTISE_100FULL 0x0100 /* Try for 100mbps full-duplex */ +#define ADVERTISE_100BASE4 0x0200 /* Try for 100mbps 4k packets */ +#define ADVERTISE_RESV 0x1c00 /* 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_10FULL 0x0040 /* Can do 10mbps full-duplex */ +#define LPA_100HALF 0x0080 /* Can do 100mbps half-duplex */ +#define LPA_100FULL 0x0100 /* Can do 100mbps full-duplex */ +#define LPA_100BASE4 0x0200 /* Can do 100mbps 4k packets */ +#define LPA_RESV 0x1c00 /* 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... */ + +/* N-way test register. */ +#define NWAYTEST_RESV1 0x00ff /* Unused... */ +#define NWAYTEST_LOOPBACK 0x0100 /* Enable loopback for N-way */ +#define NWAYTEST_RESV2 0xfe00 /* Unused... */ + + +/* From tg3.h */ + +#define TG3_64BIT_REG_HIGH 0x00UL +#define TG3_64BIT_REG_LOW 0x04UL + +/* Descriptor block info. */ +#define TG3_BDINFO_HOST_ADDR 0x0UL /* 64-bit */ +#define TG3_BDINFO_MAXLEN_FLAGS 0x8UL /* 32-bit */ +#define BDINFO_FLAGS_USE_EXT_RECV 0x00000001 /* ext rx_buffer_desc */ +#define BDINFO_FLAGS_DISABLED 0x00000002 +#define BDINFO_FLAGS_MAXLEN_MASK 0xffff0000 +#define BDINFO_FLAGS_MAXLEN_SHIFT 16 +#define TG3_BDINFO_NIC_ADDR 0xcUL /* 32-bit */ +#define TG3_BDINFO_SIZE 0x10UL + +#define RX_COPY_THRESHOLD 256 + +#define RX_STD_MAX_SIZE 1536 +#define RX_STD_MAX_SIZE_5705 512 +#define RX_JUMBO_MAX_SIZE 0xdeadbeef /* XXX */ + +/* First 256 bytes are a mirror of PCI config space. */ +#define TG3PCI_VENDOR 0x00000000 +#define TG3PCI_VENDOR_BROADCOM 0x14e4 +#define TG3PCI_DEVICE 0x00000002 +#define TG3PCI_DEVICE_TIGON3_1 0x1644 /* BCM5700 */ +#define TG3PCI_DEVICE_TIGON3_2 0x1645 /* BCM5701 */ +#define TG3PCI_DEVICE_TIGON3_3 0x1646 /* BCM5702 */ +#define TG3PCI_DEVICE_TIGON3_4 0x1647 /* BCM5703 */ +#define TG3PCI_COMMAND 0x00000004 +#define TG3PCI_STATUS 0x00000006 +#define TG3PCI_CCREVID 0x00000008 +#define TG3PCI_CACHELINESZ 0x0000000c +#define TG3PCI_LATTIMER 0x0000000d +#define TG3PCI_HEADERTYPE 0x0000000e +#define TG3PCI_BIST 0x0000000f +#define TG3PCI_BASE0_LOW 0x00000010 +#define TG3PCI_BASE0_HIGH 0x00000014 +/* 0x18 --> 0x2c unused */ +#define TG3PCI_SUBSYSVENID 0x0000002c +#define TG3PCI_SUBSYSID 0x0000002e +#define TG3PCI_ROMADDR 0x00000030 +#define TG3PCI_CAPLIST 0x00000034 +/* 0x35 --> 0x3c unused */ +#define TG3PCI_IRQ_LINE 0x0000003c +#define TG3PCI_IRQ_PIN 0x0000003d +#define TG3PCI_MIN_GNT 0x0000003e +#define TG3PCI_MAX_LAT 0x0000003f +#define TG3PCI_X_CAPS 0x00000040 +#define PCIX_CAPS_RELAXED_ORDERING 0x00020000 +#define PCIX_CAPS_SPLIT_MASK 0x00700000 +#define PCIX_CAPS_SPLIT_SHIFT 20 +#define PCIX_CAPS_BURST_MASK 0x000c0000 +#define PCIX_CAPS_BURST_SHIFT 18 +#define PCIX_CAPS_MAX_BURST_CPIOB 2 +#define TG3PCI_PM_CAP_PTR 0x00000041 +#define TG3PCI_X_COMMAND 0x00000042 +#define TG3PCI_X_STATUS 0x00000044 +#define TG3PCI_PM_CAP_ID 0x00000048 +#define TG3PCI_VPD_CAP_PTR 0x00000049 +#define TG3PCI_PM_CAPS 0x0000004a +#define TG3PCI_PM_CTRL_STAT 0x0000004c +#define TG3PCI_BR_SUPP_EXT 0x0000004e +#define TG3PCI_PM_DATA 0x0000004f +#define TG3PCI_VPD_CAP_ID 0x00000050 +#define TG3PCI_MSI_CAP_PTR 0x00000051 +#define TG3PCI_VPD_ADDR_FLAG 0x00000052 +#define VPD_ADDR_FLAG_WRITE 0x00008000 +#define TG3PCI_VPD_DATA 0x00000054 +#define TG3PCI_MSI_CAP_ID 0x00000058 +#define TG3PCI_NXT_CAP_PTR 0x00000059 +#define TG3PCI_MSI_CTRL 0x0000005a +#define TG3PCI_MSI_ADDR_LOW 0x0000005c +#define TG3PCI_MSI_ADDR_HIGH 0x00000060 +#define TG3PCI_MSI_DATA 0x00000064 +/* 0x66 --> 0x68 unused */ +#define TG3PCI_MISC_HOST_CTRL 0x00000068 +#define MISC_HOST_CTRL_CLEAR_INT 0x00000001 +#define MISC_HOST_CTRL_MASK_PCI_INT 0x00000002 +#define MISC_HOST_CTRL_BYTE_SWAP 0x00000004 +#define MISC_HOST_CTRL_WORD_SWAP 0x00000008 +#define MISC_HOST_CTRL_PCISTATE_RW 0x00000010 +#define MISC_HOST_CTRL_CLKREG_RW 0x00000020 +#define MISC_HOST_CTRL_REGWORD_SWAP 0x00000040 +#define MISC_HOST_CTRL_INDIR_ACCESS 0x00000080 +#define MISC_HOST_CTRL_IRQ_MASK_MODE 0x00000100 +#define MISC_HOST_CTRL_TAGGED_STATUS 0x00000200 +#define MISC_HOST_CTRL_CHIPREV 0xffff0000 +#define MISC_HOST_CTRL_CHIPREV_SHIFT 16 +#define GET_CHIP_REV_ID(MISC_HOST_CTRL) \ + (((MISC_HOST_CTRL) & MISC_HOST_CTRL_CHIPREV) >> \ + MISC_HOST_CTRL_CHIPREV_SHIFT) +#define CHIPREV_ID_5700_A0 0x7000 +#define CHIPREV_ID_5700_A1 0x7001 +#define CHIPREV_ID_5700_B0 0x7100 +#define CHIPREV_ID_5700_B1 0x7101 +#define CHIPREV_ID_5700_B3 0x7102 +#define CHIPREV_ID_5700_ALTIMA 0x7104 +#define CHIPREV_ID_5700_C0 0x7200 +#define CHIPREV_ID_5701_A0 0x0000 +#define CHIPREV_ID_5701_B0 0x0100 +#define CHIPREV_ID_5701_B2 0x0102 +#define CHIPREV_ID_5701_B5 0x0105 +#define CHIPREV_ID_5703_A0 0x1000 +#define CHIPREV_ID_5703_A1 0x1001 +#define CHIPREV_ID_5703_A2 0x1002 +#define CHIPREV_ID_5703_A3 0x1003 +#define CHIPREV_ID_5704_A0 0x2000 +#define CHIPREV_ID_5704_A1 0x2001 +#define CHIPREV_ID_5704_A2 0x2002 +#define CHIPREV_ID_5705_A0 0x3000 +#define CHIPREV_ID_5705_A1 0x3001 +#define CHIPREV_ID_5705_A2 0x3002 +#define CHIPREV_ID_5705_A3 0x3003 +#define GET_ASIC_REV(CHIP_REV_ID) ((CHIP_REV_ID) >> 12) +#define ASIC_REV_5700 0x07 +#define ASIC_REV_5701 0x00 +#define ASIC_REV_5703 0x01 +#define ASIC_REV_5704 0x02 +#define ASIC_REV_5705 0x03 +#define GET_CHIP_REV(CHIP_REV_ID) ((CHIP_REV_ID) >> 8) +#define CHIPREV_5700_AX 0x70 +#define CHIPREV_5700_BX 0x71 +#define CHIPREV_5700_CX 0x72 +#define CHIPREV_5701_AX 0x00 +#define GET_METAL_REV(CHIP_REV_ID) ((CHIP_REV_ID) & 0xff) +#define METAL_REV_A0 0x00 +#define METAL_REV_A1 0x01 +#define METAL_REV_B0 0x00 +#define METAL_REV_B1 0x01 +#define METAL_REV_B2 0x02 +#define TG3PCI_DMA_RW_CTRL 0x0000006c +#define DMA_RWCTRL_MIN_DMA 0x000000ff +#define DMA_RWCTRL_MIN_DMA_SHIFT 0 +#define DMA_RWCTRL_READ_BNDRY_MASK 0x00000700 +#define DMA_RWCTRL_READ_BNDRY_DISAB 0x00000000 +#define DMA_RWCTRL_READ_BNDRY_16 0x00000100 +#define DMA_RWCTRL_READ_BNDRY_32 0x00000200 +#define DMA_RWCTRL_READ_BNDRY_64 0x00000300 +#define DMA_RWCTRL_READ_BNDRY_128 0x00000400 +#define DMA_RWCTRL_READ_BNDRY_256 0x00000500 +#define DMA_RWCTRL_READ_BNDRY_512 0x00000600 +#define DMA_RWCTRL_READ_BNDRY_1024 0x00000700 +#define DMA_RWCTRL_WRITE_BNDRY_MASK 0x00003800 +#define DMA_RWCTRL_WRITE_BNDRY_DISAB 0x00000000 +#define DMA_RWCTRL_WRITE_BNDRY_16 0x00000800 +#define DMA_RWCTRL_WRITE_BNDRY_32 0x00001000 +#define DMA_RWCTRL_WRITE_BNDRY_64 0x00001800 +#define DMA_RWCTRL_WRITE_BNDRY_128 0x00002000 +#define DMA_RWCTRL_WRITE_BNDRY_256 0x00002800 +#define DMA_RWCTRL_WRITE_BNDRY_512 0x00003000 +#define DMA_RWCTRL_WRITE_BNDRY_1024 0x00003800 +#define DMA_RWCTRL_ONE_DMA 0x00004000 +#define DMA_RWCTRL_READ_WATER 0x00070000 +#define DMA_RWCTRL_READ_WATER_SHIFT 16 +#define DMA_RWCTRL_WRITE_WATER 0x00380000 +#define DMA_RWCTRL_WRITE_WATER_SHIFT 19 +#define DMA_RWCTRL_USE_MEM_READ_MULT 0x00400000 +#define DMA_RWCTRL_ASSERT_ALL_BE 0x00800000 +#define DMA_RWCTRL_PCI_READ_CMD 0x0f000000 +#define DMA_RWCTRL_PCI_READ_CMD_SHIFT 24 +#define DMA_RWCTRL_PCI_WRITE_CMD 0xf0000000 +#define DMA_RWCTRL_PCI_WRITE_CMD_SHIFT 28 +#define TG3PCI_PCISTATE 0x00000070 +#define PCISTATE_FORCE_RESET 0x00000001 +#define PCISTATE_INT_NOT_ACTIVE 0x00000002 +#define PCISTATE_CONV_PCI_MODE 0x00000004 +#define PCISTATE_BUS_SPEED_HIGH 0x00000008 +#define PCISTATE_BUS_32BIT 0x00000010 +#define PCISTATE_ROM_ENABLE 0x00000020 +#define PCISTATE_ROM_RETRY_ENABLE 0x00000040 +#define PCISTATE_FLAT_VIEW 0x00000100 +#define PCISTATE_RETRY_SAME_DMA 0x00002000 +#define TG3PCI_CLOCK_CTRL 0x00000074 +#define CLOCK_CTRL_CORECLK_DISABLE 0x00000200 +#define CLOCK_CTRL_RXCLK_DISABLE 0x00000400 +#define CLOCK_CTRL_TXCLK_DISABLE 0x00000800 +#define CLOCK_CTRL_ALTCLK 0x00001000 +#define CLOCK_CTRL_PWRDOWN_PLL133 0x00008000 +#define CLOCK_CTRL_44MHZ_CORE 0x00040000 +#define CLOCK_CTRL_625_CORE 0x00100000 +#define CLOCK_CTRL_FORCE_CLKRUN 0x00200000 +#define CLOCK_CTRL_CLKRUN_OENABLE 0x00400000 +#define CLOCK_CTRL_DELAY_PCI_GRANT 0x80000000 +#define TG3PCI_REG_BASE_ADDR 0x00000078 +#define TG3PCI_MEM_WIN_BASE_ADDR 0x0000007c +#define TG3PCI_REG_DATA 0x00000080 +#define TG3PCI_MEM_WIN_DATA 0x00000084 +#define TG3PCI_MODE_CTRL 0x00000088 +#define TG3PCI_MISC_CFG 0x0000008c +#define TG3PCI_MISC_LOCAL_CTRL 0x00000090 +/* 0x94 --> 0x98 unused */ +#define TG3PCI_STD_RING_PROD_IDX 0x00000098 /* 64-bit */ +#define TG3PCI_RCV_RET_RING_CON_IDX 0x000000a0 /* 64-bit */ +#define TG3PCI_SND_PROD_IDX 0x000000a8 /* 64-bit */ +/* 0xb0 --> 0x100 unused */ + +/* 0x100 --> 0x200 unused */ + +/* Mailbox registers */ +#define MAILBOX_INTERRUPT_0 0x00000200 /* 64-bit */ +#define MAILBOX_INTERRUPT_1 0x00000208 /* 64-bit */ +#define MAILBOX_INTERRUPT_2 0x00000210 /* 64-bit */ +#define MAILBOX_INTERRUPT_3 0x00000218 /* 64-bit */ +#define MAILBOX_GENERAL_0 0x00000220 /* 64-bit */ +#define MAILBOX_GENERAL_1 0x00000228 /* 64-bit */ +#define MAILBOX_GENERAL_2 0x00000230 /* 64-bit */ +#define MAILBOX_GENERAL_3 0x00000238 /* 64-bit */ +#define MAILBOX_GENERAL_4 0x00000240 /* 64-bit */ +#define MAILBOX_GENERAL_5 0x00000248 /* 64-bit */ +#define MAILBOX_GENERAL_6 0x00000250 /* 64-bit */ +#define MAILBOX_GENERAL_7 0x00000258 /* 64-bit */ +#define MAILBOX_RELOAD_STAT 0x00000260 /* 64-bit */ +#define MAILBOX_RCV_STD_PROD_IDX 0x00000268 /* 64-bit */ +#define MAILBOX_RCV_JUMBO_PROD_IDX 0x00000270 /* 64-bit */ +#define MAILBOX_RCV_MINI_PROD_IDX 0x00000278 /* 64-bit */ +#define MAILBOX_RCVRET_CON_IDX_0 0x00000280 /* 64-bit */ +#define MAILBOX_RCVRET_CON_IDX_1 0x00000288 /* 64-bit */ +#define MAILBOX_RCVRET_CON_IDX_2 0x00000290 /* 64-bit */ +#define MAILBOX_RCVRET_CON_IDX_3 0x00000298 /* 64-bit */ +#define MAILBOX_RCVRET_CON_IDX_4 0x000002a0 /* 64-bit */ +#define MAILBOX_RCVRET_CON_IDX_5 0x000002a8 /* 64-bit */ +#define MAILBOX_RCVRET_CON_IDX_6 0x000002b0 /* 64-bit */ +#define MAILBOX_RCVRET_CON_IDX_7 0x000002b8 /* 64-bit */ +#define MAILBOX_RCVRET_CON_IDX_8 0x000002c0 /* 64-bit */ +#define MAILBOX_RCVRET_CON_IDX_9 0x000002c8 /* 64-bit */ +#define MAILBOX_RCVRET_CON_IDX_10 0x000002d0 /* 64-bit */ +#define MAILBOX_RCVRET_CON_IDX_11 0x000002d8 /* 64-bit */ +#define MAILBOX_RCVRET_CON_IDX_12 0x000002e0 /* 64-bit */ +#define MAILBOX_RCVRET_CON_IDX_13 0x000002e8 /* 64-bit */ +#define MAILBOX_RCVRET_CON_IDX_14 0x000002f0 /* 64-bit */ +#define MAILBOX_RCVRET_CON_IDX_15 0x000002f8 /* 64-bit */ +#define MAILBOX_SNDHOST_PROD_IDX_0 0x00000300 /* 64-bit */ +#define MAILBOX_SNDHOST_PROD_IDX_1 0x00000308 /* 64-bit */ +#define MAILBOX_SNDHOST_PROD_IDX_2 0x00000310 /* 64-bit */ +#define MAILBOX_SNDHOST_PROD_IDX_3 0x00000318 /* 64-bit */ +#define MAILBOX_SNDHOST_PROD_IDX_4 0x00000320 /* 64-bit */ +#define MAILBOX_SNDHOST_PROD_IDX_5 0x00000328 /* 64-bit */ +#define MAILBOX_SNDHOST_PROD_IDX_6 0x00000330 /* 64-bit */ +#define MAILBOX_SNDHOST_PROD_IDX_7 0x00000338 /* 64-bit */ +#define MAILBOX_SNDHOST_PROD_IDX_8 0x00000340 /* 64-bit */ +#define MAILBOX_SNDHOST_PROD_IDX_9 0x00000348 /* 64-bit */ +#define MAILBOX_SNDHOST_PROD_IDX_10 0x00000350 /* 64-bit */ +#define MAILBOX_SNDHOST_PROD_IDX_11 0x00000358 /* 64-bit */ +#define MAILBOX_SNDHOST_PROD_IDX_12 0x00000360 /* 64-bit */ +#define MAILBOX_SNDHOST_PROD_IDX_13 0x00000368 /* 64-bit */ +#define MAILBOX_SNDHOST_PROD_IDX_14 0x00000370 /* 64-bit */ +#define MAILBOX_SNDHOST_PROD_IDX_15 0x00000378 /* 64-bit */ +#define MAILBOX_SNDNIC_PROD_IDX_0 0x00000380 /* 64-bit */ +#define MAILBOX_SNDNIC_PROD_IDX_1 0x00000388 /* 64-bit */ +#define MAILBOX_SNDNIC_PROD_IDX_2 0x00000390 /* 64-bit */ +#define MAILBOX_SNDNIC_PROD_IDX_3 0x00000398 /* 64-bit */ +#define MAILBOX_SNDNIC_PROD_IDX_4 0x000003a0 /* 64-bit */ +#define MAILBOX_SNDNIC_PROD_IDX_5 0x000003a8 /* 64-bit */ +#define MAILBOX_SNDNIC_PROD_IDX_6 0x000003b0 /* 64-bit */ +#define MAILBOX_SNDNIC_PROD_IDX_7 0x000003b8 /* 64-bit */ +#define MAILBOX_SNDNIC_PROD_IDX_8 0x000003c0 /* 64-bit */ +#define MAILBOX_SNDNIC_PROD_IDX_9 0x000003c8 /* 64-bit */ +#define MAILBOX_SNDNIC_PROD_IDX_10 0x000003d0 /* 64-bit */ +#define MAILBOX_SNDNIC_PROD_IDX_11 0x000003d8 /* 64-bit */ +#define MAILBOX_SNDNIC_PROD_IDX_12 0x000003e0 /* 64-bit */ +#define MAILBOX_SNDNIC_PROD_IDX_13 0x000003e8 /* 64-bit */ +#define MAILBOX_SNDNIC_PROD_IDX_14 0x000003f0 /* 64-bit */ +#define MAILBOX_SNDNIC_PROD_IDX_15 0x000003f8 /* 64-bit */ + +/* MAC control registers */ +#define MAC_MODE 0x00000400 +#define MAC_MODE_RESET 0x00000001 +#define MAC_MODE_HALF_DUPLEX 0x00000002 +#define MAC_MODE_PORT_MODE_MASK 0x0000000c +#define MAC_MODE_PORT_MODE_TBI 0x0000000c +#define MAC_MODE_PORT_MODE_GMII 0x00000008 +#define MAC_MODE_PORT_MODE_MII 0x00000004 +#define MAC_MODE_PORT_MODE_NONE 0x00000000 +#define MAC_MODE_PORT_INT_LPBACK 0x00000010 +#define MAC_MODE_TAGGED_MAC_CTRL 0x00000080 +#define MAC_MODE_TX_BURSTING 0x00000100 +#define MAC_MODE_MAX_DEFER 0x00000200 +#define MAC_MODE_LINK_POLARITY 0x00000400 +#define MAC_MODE_RXSTAT_ENABLE 0x00000800 +#define MAC_MODE_RXSTAT_CLEAR 0x00001000 +#define MAC_MODE_RXSTAT_FLUSH 0x00002000 +#define MAC_MODE_TXSTAT_ENABLE 0x00004000 +#define MAC_MODE_TXSTAT_CLEAR 0x00008000 +#define MAC_MODE_TXSTAT_FLUSH 0x00010000 +#define MAC_MODE_SEND_CONFIGS 0x00020000 +#define MAC_MODE_MAGIC_PKT_ENABLE 0x00040000 +#define MAC_MODE_ACPI_ENABLE 0x00080000 +#define MAC_MODE_MIP_ENABLE 0x00100000 +#define MAC_MODE_TDE_ENABLE 0x00200000 +#define MAC_MODE_RDE_ENABLE 0x00400000 +#define MAC_MODE_FHDE_ENABLE 0x00800000 +#define MAC_STATUS 0x00000404 +#define MAC_STATUS_PCS_SYNCED 0x00000001 +#define MAC_STATUS_SIGNAL_DET 0x00000002 +#define MAC_STATUS_RCVD_CFG 0x00000004 +#define MAC_STATUS_CFG_CHANGED 0x00000008 +#define MAC_STATUS_SYNC_CHANGED 0x00000010 +#define MAC_STATUS_PORT_DEC_ERR 0x00000400 +#define MAC_STATUS_LNKSTATE_CHANGED 0x00001000 +#define MAC_STATUS_MI_COMPLETION 0x00400000 +#define MAC_STATUS_MI_INTERRUPT 0x00800000 +#define MAC_STATUS_AP_ERROR 0x01000000 +#define MAC_STATUS_ODI_ERROR 0x02000000 +#define MAC_STATUS_RXSTAT_OVERRUN 0x04000000 +#define MAC_STATUS_TXSTAT_OVERRUN 0x08000000 +#define MAC_EVENT 0x00000408 +#define MAC_EVENT_PORT_DECODE_ERR 0x00000400 +#define MAC_EVENT_LNKSTATE_CHANGED 0x00001000 +#define MAC_EVENT_MI_COMPLETION 0x00400000 +#define MAC_EVENT_MI_INTERRUPT 0x00800000 +#define MAC_EVENT_AP_ERROR 0x01000000 +#define MAC_EVENT_ODI_ERROR 0x02000000 +#define MAC_EVENT_RXSTAT_OVERRUN 0x04000000 +#define MAC_EVENT_TXSTAT_OVERRUN 0x08000000 +#define MAC_LED_CTRL 0x0000040c +#define LED_CTRL_LNKLED_OVERRIDE 0x00000001 +#define LED_CTRL_1000MBPS_ON 0x00000002 +#define LED_CTRL_100MBPS_ON 0x00000004 +#define LED_CTRL_10MBPS_ON 0x00000008 +#define LED_CTRL_TRAFFIC_OVERRIDE 0x00000010 +#define LED_CTRL_TRAFFIC_BLINK 0x00000020 +#define LED_CTRL_TRAFFIC_LED 0x00000040 +#define LED_CTRL_1000MBPS_STATUS 0x00000080 +#define LED_CTRL_100MBPS_STATUS 0x00000100 +#define LED_CTRL_10MBPS_STATUS 0x00000200 +#define LED_CTRL_TRAFFIC_STATUS 0x00000400 +#define LED_CTRL_MAC_MODE 0x00000000 +#define LED_CTRL_PHY_MODE_1 0x00000800 +#define LED_CTRL_PHY_MODE_2 0x00001000 +#define LED_CTRL_BLINK_RATE_MASK 0x7ff80000 +#define LED_CTRL_BLINK_RATE_SHIFT 19 +#define LED_CTRL_BLINK_PER_OVERRIDE 0x00080000 +#define LED_CTRL_BLINK_RATE_OVERRIDE 0x80000000 +#define MAC_ADDR_0_HIGH 0x00000410 /* upper 2 bytes */ +#define MAC_ADDR_0_LOW 0x00000414 /* lower 4 bytes */ +#define MAC_ADDR_1_HIGH 0x00000418 /* upper 2 bytes */ +#define MAC_ADDR_1_LOW 0x0000041c /* lower 4 bytes */ +#define MAC_ADDR_2_HIGH 0x00000420 /* upper 2 bytes */ +#define MAC_ADDR_2_LOW 0x00000424 /* lower 4 bytes */ +#define MAC_ADDR_3_HIGH 0x00000428 /* upper 2 bytes */ +#define MAC_ADDR_3_LOW 0x0000042c /* lower 4 bytes */ +#define MAC_ACPI_MBUF_PTR 0x00000430 +#define MAC_ACPI_LEN_OFFSET 0x00000434 +#define ACPI_LENOFF_LEN_MASK 0x0000ffff +#define ACPI_LENOFF_LEN_SHIFT 0 +#define ACPI_LENOFF_OFF_MASK 0x0fff0000 +#define ACPI_LENOFF_OFF_SHIFT 16 +#define MAC_TX_BACKOFF_SEED 0x00000438 +#define TX_BACKOFF_SEED_MASK 0x000003ff +#define MAC_RX_MTU_SIZE 0x0000043c +#define RX_MTU_SIZE_MASK 0x0000ffff +#define MAC_PCS_TEST 0x00000440 +#define PCS_TEST_PATTERN_MASK 0x000fffff +#define PCS_TEST_PATTERN_SHIFT 0 +#define PCS_TEST_ENABLE 0x00100000 +#define MAC_TX_AUTO_NEG 0x00000444 +#define TX_AUTO_NEG_MASK 0x0000ffff +#define TX_AUTO_NEG_SHIFT 0 +#define MAC_RX_AUTO_NEG 0x00000448 +#define RX_AUTO_NEG_MASK 0x0000ffff +#define RX_AUTO_NEG_SHIFT 0 +#define MAC_MI_COM 0x0000044c +#define MI_COM_CMD_MASK 0x0c000000 +#define MI_COM_CMD_WRITE 0x04000000 +#define MI_COM_CMD_READ 0x08000000 +#define MI_COM_READ_FAILED 0x10000000 +#define MI_COM_START 0x20000000 +#define MI_COM_BUSY 0x20000000 +#define MI_COM_PHY_ADDR_MASK 0x03e00000 +#define MI_COM_PHY_ADDR_SHIFT 21 +#define MI_COM_REG_ADDR_MASK 0x001f0000 +#define MI_COM_REG_ADDR_SHIFT 16 +#define MI_COM_DATA_MASK 0x0000ffff +#define MAC_MI_STAT 0x00000450 +#define MAC_MI_STAT_LNKSTAT_ATTN_ENAB 0x00000001 +#define MAC_MI_MODE 0x00000454 +#define MAC_MI_MODE_CLK_10MHZ 0x00000001 +#define MAC_MI_MODE_SHORT_PREAMBLE 0x00000002 +#define MAC_MI_MODE_AUTO_POLL 0x00000010 +#define MAC_MI_MODE_CORE_CLK_62MHZ 0x00008000 +#define MAC_MI_MODE_BASE 0x000c0000 /* XXX magic values XXX */ +#define MAC_AUTO_POLL_STATUS 0x00000458 +#define MAC_AUTO_POLL_ERROR 0x00000001 +#define MAC_TX_MODE 0x0000045c +#define TX_MODE_RESET 0x00000001 +#define TX_MODE_ENABLE 0x00000002 +#define TX_MODE_FLOW_CTRL_ENABLE 0x00000010 +#define TX_MODE_BIG_BCKOFF_ENABLE 0x00000020 +#define TX_MODE_LONG_PAUSE_ENABLE 0x00000040 +#define MAC_TX_STATUS 0x00000460 +#define TX_STATUS_XOFFED 0x00000001 +#define TX_STATUS_SENT_XOFF 0x00000002 +#define TX_STATUS_SENT_XON 0x00000004 +#define TX_STATUS_LINK_UP 0x00000008 +#define TX_STATUS_ODI_UNDERRUN 0x00000010 +#define TX_STATUS_ODI_OVERRUN 0x00000020 +#define MAC_TX_LENGTHS 0x00000464 +#define TX_LENGTHS_SLOT_TIME_MASK 0x000000ff +#define TX_LENGTHS_SLOT_TIME_SHIFT 0 +#define TX_LENGTHS_IPG_MASK 0x00000f00 +#define TX_LENGTHS_IPG_SHIFT 8 +#define TX_LENGTHS_IPG_CRS_MASK 0x00003000 +#define TX_LENGTHS_IPG_CRS_SHIFT 12 +#define MAC_RX_MODE 0x00000468 +#define RX_MODE_RESET 0x00000001 +#define RX_MODE_ENABLE 0x00000002 +#define RX_MODE_FLOW_CTRL_ENABLE 0x00000004 +#define RX_MODE_KEEP_MAC_CTRL 0x00000008 +#define RX_MODE_KEEP_PAUSE 0x00000010 +#define RX_MODE_ACCEPT_OVERSIZED 0x00000020 +#define RX_MODE_ACCEPT_RUNTS 0x00000040 +#define RX_MODE_LEN_CHECK 0x00000080 +#define RX_MODE_PROMISC 0x00000100 +#define RX_MODE_NO_CRC_CHECK 0x00000200 +#define RX_MODE_KEEP_VLAN_TAG 0x00000400 +#define MAC_RX_STATUS 0x0000046c +#define RX_STATUS_REMOTE_TX_XOFFED 0x00000001 +#define RX_STATUS_XOFF_RCVD 0x00000002 +#define RX_STATUS_XON_RCVD 0x00000004 +#define MAC_HASH_REG_0 0x00000470 +#define MAC_HASH_REG_1 0x00000474 +#define MAC_HASH_REG_2 0x00000478 +#define MAC_HASH_REG_3 0x0000047c +#define MAC_RCV_RULE_0 0x00000480 +#define MAC_RCV_VALUE_0 0x00000484 +#define MAC_RCV_RULE_1 0x00000488 +#define MAC_RCV_VALUE_1 0x0000048c +#define MAC_RCV_RULE_2 0x00000490 +#define MAC_RCV_VALUE_2 0x00000494 +#define MAC_RCV_RULE_3 0x00000498 +#define MAC_RCV_VALUE_3 0x0000049c +#define MAC_RCV_RULE_4 0x000004a0 +#define MAC_RCV_VALUE_4 0x000004a4 +#define MAC_RCV_RULE_5 0x000004a8 +#define MAC_RCV_VALUE_5 0x000004ac +#define MAC_RCV_RULE_6 0x000004b0 +#define MAC_RCV_VALUE_6 0x000004b4 +#define MAC_RCV_RULE_7 0x000004b8 +#define MAC_RCV_VALUE_7 0x000004bc +#define MAC_RCV_RULE_8 0x000004c0 +#define MAC_RCV_VALUE_8 0x000004c4 +#define MAC_RCV_RULE_9 0x000004c8 +#define MAC_RCV_VALUE_9 0x000004cc +#define MAC_RCV_RULE_10 0x000004d0 +#define MAC_RCV_VALUE_10 0x000004d4 +#define MAC_RCV_RULE_11 0x000004d8 +#define MAC_RCV_VALUE_11 0x000004dc +#define MAC_RCV_RULE_12 0x000004e0 +#define MAC_RCV_VALUE_12 0x000004e4 +#define MAC_RCV_RULE_13 0x000004e8 +#define MAC_RCV_VALUE_13 0x000004ec +#define MAC_RCV_RULE_14 0x000004f0 +#define MAC_RCV_VALUE_14 0x000004f4 +#define MAC_RCV_RULE_15 0x000004f8 +#define MAC_RCV_VALUE_15 0x000004fc +#define RCV_RULE_DISABLE_MASK 0x7fffffff +#define MAC_RCV_RULE_CFG 0x00000500 +#define RCV_RULE_CFG_DEFAULT_CLASS 0x00000008 +#define MAC_LOW_WMARK_MAX_RX_FRAME 0x00000504 +/* 0x508 --> 0x520 unused */ +#define MAC_HASHREGU_0 0x00000520 +#define MAC_HASHREGU_1 0x00000524 +#define MAC_HASHREGU_2 0x00000528 +#define MAC_HASHREGU_3 0x0000052c +#define MAC_EXTADDR_0_HIGH 0x00000530 +#define MAC_EXTADDR_0_LOW 0x00000534 +#define MAC_EXTADDR_1_HIGH 0x00000538 +#define MAC_EXTADDR_1_LOW 0x0000053c +#define MAC_EXTADDR_2_HIGH 0x00000540 +#define MAC_EXTADDR_2_LOW 0x00000544 +#define MAC_EXTADDR_3_HIGH 0x00000548 +#define MAC_EXTADDR_3_LOW 0x0000054c +#define MAC_EXTADDR_4_HIGH 0x00000550 +#define MAC_EXTADDR_4_LOW 0x00000554 +#define MAC_EXTADDR_5_HIGH 0x00000558 +#define MAC_EXTADDR_5_LOW 0x0000055c +#define MAC_EXTADDR_6_HIGH 0x00000560 +#define MAC_EXTADDR_6_LOW 0x00000564 +#define MAC_EXTADDR_7_HIGH 0x00000568 +#define MAC_EXTADDR_7_LOW 0x0000056c +#define MAC_EXTADDR_8_HIGH 0x00000570 +#define MAC_EXTADDR_8_LOW 0x00000574 +#define MAC_EXTADDR_9_HIGH 0x00000578 +#define MAC_EXTADDR_9_LOW 0x0000057c +#define MAC_EXTADDR_10_HIGH 0x00000580 +#define MAC_EXTADDR_10_LOW 0x00000584 +#define MAC_EXTADDR_11_HIGH 0x00000588 +#define MAC_EXTADDR_11_LOW 0x0000058c +#define MAC_SERDES_CFG 0x00000590 +#define MAC_SERDES_STAT 0x00000594 +/* 0x598 --> 0x600 unused */ +#define MAC_TX_MAC_STATE_BASE 0x00000600 /* 16 bytes */ +#define MAC_RX_MAC_STATE_BASE 0x00000610 /* 20 bytes */ +/* 0x624 --> 0x800 unused */ +#define MAC_TX_STATS_OCTETS 0x00000800 +#define MAC_TX_STATS_RESV1 0x00000804 +#define MAC_TX_STATS_COLLISIONS 0x00000808 +#define MAC_TX_STATS_XON_SENT 0x0000080c +#define MAC_TX_STATS_XOFF_SENT 0x00000810 +#define MAC_TX_STATS_RESV2 0x00000814 +#define MAC_TX_STATS_MAC_ERRORS 0x00000818 +#define MAC_TX_STATS_SINGLE_COLLISIONS 0x0000081c +#define MAC_TX_STATS_MULT_COLLISIONS 0x00000820 +#define MAC_TX_STATS_DEFERRED 0x00000824 +#define MAC_TX_STATS_RESV3 0x00000828 +#define MAC_TX_STATS_EXCESSIVE_COL 0x0000082c +#define MAC_TX_STATS_LATE_COL 0x00000830 +#define MAC_TX_STATS_RESV4_1 0x00000834 +#define MAC_TX_STATS_RESV4_2 0x00000838 +#define MAC_TX_STATS_RESV4_3 0x0000083c +#define MAC_TX_STATS_RESV4_4 0x00000840 +#define MAC_TX_STATS_RESV4_5 0x00000844 +#define MAC_TX_STATS_RESV4_6 0x00000848 +#define MAC_TX_STATS_RESV4_7 0x0000084c +#define MAC_TX_STATS_RESV4_8 0x00000850 +#define MAC_TX_STATS_RESV4_9 0x00000854 +#define MAC_TX_STATS_RESV4_10 0x00000858 +#define MAC_TX_STATS_RESV4_11 0x0000085c +#define MAC_TX_STATS_RESV4_12 0x00000860 +#define MAC_TX_STATS_RESV4_13 0x00000864 +#define MAC_TX_STATS_RESV4_14 0x00000868 +#define MAC_TX_STATS_UCAST 0x0000086c +#define MAC_TX_STATS_MCAST 0x00000870 +#define MAC_TX_STATS_BCAST 0x00000874 +#define MAC_TX_STATS_RESV5_1 0x00000878 +#define MAC_TX_STATS_RESV5_2 0x0000087c +#define MAC_RX_STATS_OCTETS 0x00000880 +#define MAC_RX_STATS_RESV1 0x00000884 +#define MAC_RX_STATS_FRAGMENTS 0x00000888 +#define MAC_RX_STATS_UCAST 0x0000088c +#define MAC_RX_STATS_MCAST 0x00000890 +#define MAC_RX_STATS_BCAST 0x00000894 +#define MAC_RX_STATS_FCS_ERRORS 0x00000898 +#define MAC_RX_STATS_ALIGN_ERRORS 0x0000089c +#define MAC_RX_STATS_XON_PAUSE_RECVD 0x000008a0 +#define MAC_RX_STATS_XOFF_PAUSE_RECVD 0x000008a4 +#define MAC_RX_STATS_MAC_CTRL_RECVD 0x000008a8 +#define MAC_RX_STATS_XOFF_ENTERED 0x000008ac +#define MAC_RX_STATS_FRAME_TOO_LONG 0x000008b0 +#define MAC_RX_STATS_JABBERS 0x000008b4 +#define MAC_RX_STATS_UNDERSIZE 0x000008b8 +/* 0x8bc --> 0xc00 unused */ + +/* Send data initiator control registers */ +#define SNDDATAI_MODE 0x00000c00 +#define SNDDATAI_MODE_RESET 0x00000001 +#define SNDDATAI_MODE_ENABLE 0x00000002 +#define SNDDATAI_MODE_STAT_OFLOW_ENAB 0x00000004 +#define SNDDATAI_STATUS 0x00000c04 +#define SNDDATAI_STATUS_STAT_OFLOW 0x00000004 +#define SNDDATAI_STATSCTRL 0x00000c08 +#define SNDDATAI_SCTRL_ENABLE 0x00000001 +#define SNDDATAI_SCTRL_FASTUPD 0x00000002 +#define SNDDATAI_SCTRL_CLEAR 0x00000004 +#define SNDDATAI_SCTRL_FLUSH 0x00000008 +#define SNDDATAI_SCTRL_FORCE_ZERO 0x00000010 +#define SNDDATAI_STATSENAB 0x00000c0c +#define SNDDATAI_STATSINCMASK 0x00000c10 +/* 0xc14 --> 0xc80 unused */ +#define SNDDATAI_COS_CNT_0 0x00000c80 +#define SNDDATAI_COS_CNT_1 0x00000c84 +#define SNDDATAI_COS_CNT_2 0x00000c88 +#define SNDDATAI_COS_CNT_3 0x00000c8c +#define SNDDATAI_COS_CNT_4 0x00000c90 +#define SNDDATAI_COS_CNT_5 0x00000c94 +#define SNDDATAI_COS_CNT_6 0x00000c98 +#define SNDDATAI_COS_CNT_7 0x00000c9c +#define SNDDATAI_COS_CNT_8 0x00000ca0 +#define SNDDATAI_COS_CNT_9 0x00000ca4 +#define SNDDATAI_COS_CNT_10 0x00000ca8 +#define SNDDATAI_COS_CNT_11 0x00000cac +#define SNDDATAI_COS_CNT_12 0x00000cb0 +#define SNDDATAI_COS_CNT_13 0x00000cb4 +#define SNDDATAI_COS_CNT_14 0x00000cb8 +#define SNDDATAI_COS_CNT_15 0x00000cbc +#define SNDDATAI_DMA_RDQ_FULL_CNT 0x00000cc0 +#define SNDDATAI_DMA_PRIO_RDQ_FULL_CNT 0x00000cc4 +#define SNDDATAI_SDCQ_FULL_CNT 0x00000cc8 +#define SNDDATAI_NICRNG_SSND_PIDX_CNT 0x00000ccc +#define SNDDATAI_STATS_UPDATED_CNT 0x00000cd0 +#define SNDDATAI_INTERRUPTS_CNT 0x00000cd4 +#define SNDDATAI_AVOID_INTERRUPTS_CNT 0x00000cd8 +#define SNDDATAI_SND_THRESH_HIT_CNT 0x00000cdc +/* 0xce0 --> 0x1000 unused */ + +/* Send data completion control registers */ +#define SNDDATAC_MODE 0x00001000 +#define SNDDATAC_MODE_RESET 0x00000001 +#define SNDDATAC_MODE_ENABLE 0x00000002 +/* 0x1004 --> 0x1400 unused */ + +/* Send BD ring selector */ +#define SNDBDS_MODE 0x00001400 +#define SNDBDS_MODE_RESET 0x00000001 +#define SNDBDS_MODE_ENABLE 0x00000002 +#define SNDBDS_MODE_ATTN_ENABLE 0x00000004 +#define SNDBDS_STATUS 0x00001404 +#define SNDBDS_STATUS_ERROR_ATTN 0x00000004 +#define SNDBDS_HWDIAG 0x00001408 +/* 0x140c --> 0x1440 */ +#define SNDBDS_SEL_CON_IDX_0 0x00001440 +#define SNDBDS_SEL_CON_IDX_1 0x00001444 +#define SNDBDS_SEL_CON_IDX_2 0x00001448 +#define SNDBDS_SEL_CON_IDX_3 0x0000144c +#define SNDBDS_SEL_CON_IDX_4 0x00001450 +#define SNDBDS_SEL_CON_IDX_5 0x00001454 +#define SNDBDS_SEL_CON_IDX_6 0x00001458 +#define SNDBDS_SEL_CON_IDX_7 0x0000145c +#define SNDBDS_SEL_CON_IDX_8 0x00001460 +#define SNDBDS_SEL_CON_IDX_9 0x00001464 +#define SNDBDS_SEL_CON_IDX_10 0x00001468 +#define SNDBDS_SEL_CON_IDX_11 0x0000146c +#define SNDBDS_SEL_CON_IDX_12 0x00001470 +#define SNDBDS_SEL_CON_IDX_13 0x00001474 +#define SNDBDS_SEL_CON_IDX_14 0x00001478 +#define SNDBDS_SEL_CON_IDX_15 0x0000147c +/* 0x1480 --> 0x1800 unused */ + +/* Send BD initiator control registers */ +#define SNDBDI_MODE 0x00001800 +#define SNDBDI_MODE_RESET 0x00000001 +#define SNDBDI_MODE_ENABLE 0x00000002 +#define SNDBDI_MODE_ATTN_ENABLE 0x00000004 +#define SNDBDI_STATUS 0x00001804 +#define SNDBDI_STATUS_ERROR_ATTN 0x00000004 +#define SNDBDI_IN_PROD_IDX_0 0x00001808 +#define SNDBDI_IN_PROD_IDX_1 0x0000180c +#define SNDBDI_IN_PROD_IDX_2 0x00001810 +#define SNDBDI_IN_PROD_IDX_3 0x00001814 +#define SNDBDI_IN_PROD_IDX_4 0x00001818 +#define SNDBDI_IN_PROD_IDX_5 0x0000181c +#define SNDBDI_IN_PROD_IDX_6 0x00001820 +#define SNDBDI_IN_PROD_IDX_7 0x00001824 +#define SNDBDI_IN_PROD_IDX_8 0x00001828 +#define SNDBDI_IN_PROD_IDX_9 0x0000182c +#define SNDBDI_IN_PROD_IDX_10 0x00001830 +#define SNDBDI_IN_PROD_IDX_11 0x00001834 +#define SNDBDI_IN_PROD_IDX_12 0x00001838 +#define SNDBDI_IN_PROD_IDX_13 0x0000183c +#define SNDBDI_IN_PROD_IDX_14 0x00001840 +#define SNDBDI_IN_PROD_IDX_15 0x00001844 +/* 0x1848 --> 0x1c00 unused */ + +/* Send BD completion control registers */ +#define SNDBDC_MODE 0x00001c00 +#define SNDBDC_MODE_RESET 0x00000001 +#define SNDBDC_MODE_ENABLE 0x00000002 +#define SNDBDC_MODE_ATTN_ENABLE 0x00000004 +/* 0x1c04 --> 0x2000 unused */ + +/* Receive list placement control registers */ +#define RCVLPC_MODE 0x00002000 +#define RCVLPC_MODE_RESET 0x00000001 +#define RCVLPC_MODE_ENABLE 0x00000002 +#define RCVLPC_MODE_CLASS0_ATTN_ENAB 0x00000004 +#define RCVLPC_MODE_MAPOOR_AATTN_ENAB 0x00000008 +#define RCVLPC_MODE_STAT_OFLOW_ENAB 0x00000010 +#define RCVLPC_STATUS 0x00002004 +#define RCVLPC_STATUS_CLASS0 0x00000004 +#define RCVLPC_STATUS_MAPOOR 0x00000008 +#define RCVLPC_STATUS_STAT_OFLOW 0x00000010 +#define RCVLPC_LOCK 0x00002008 +#define RCVLPC_LOCK_REQ_MASK 0x0000ffff +#define RCVLPC_LOCK_REQ_SHIFT 0 +#define RCVLPC_LOCK_GRANT_MASK 0xffff0000 +#define RCVLPC_LOCK_GRANT_SHIFT 16 +#define RCVLPC_NON_EMPTY_BITS 0x0000200c +#define RCVLPC_NON_EMPTY_BITS_MASK 0x0000ffff +#define RCVLPC_CONFIG 0x00002010 +#define RCVLPC_STATSCTRL 0x00002014 +#define RCVLPC_STATSCTRL_ENABLE 0x00000001 +#define RCVLPC_STATSCTRL_FASTUPD 0x00000002 +#define RCVLPC_STATS_ENABLE 0x00002018 +#define RCVLPC_STATSENAB_LNGBRST_RFIX 0x00400000 +#define RCVLPC_STATS_INCMASK 0x0000201c +/* 0x2020 --> 0x2100 unused */ +#define RCVLPC_SELLST_BASE 0x00002100 /* 16 16-byte entries */ +#define SELLST_TAIL 0x00000004 +#define SELLST_CONT 0x00000008 +#define SELLST_UNUSED 0x0000000c +#define RCVLPC_COS_CNTL_BASE 0x00002200 /* 16 4-byte entries */ +#define RCVLPC_DROP_FILTER_CNT 0x00002240 +#define RCVLPC_DMA_WQ_FULL_CNT 0x00002244 +#define RCVLPC_DMA_HIPRIO_WQ_FULL_CNT 0x00002248 +#define RCVLPC_NO_RCV_BD_CNT 0x0000224c +#define RCVLPC_IN_DISCARDS_CNT 0x00002250 +#define RCVLPC_IN_ERRORS_CNT 0x00002254 +#define RCVLPC_RCV_THRESH_HIT_CNT 0x00002258 +/* 0x225c --> 0x2400 unused */ + +/* Receive Data and Receive BD Initiator Control */ +#define RCVDBDI_MODE 0x00002400 +#define RCVDBDI_MODE_RESET 0x00000001 +#define RCVDBDI_MODE_ENABLE 0x00000002 +#define RCVDBDI_MODE_JUMBOBD_NEEDED 0x00000004 +#define RCVDBDI_MODE_FRM_TOO_BIG 0x00000008 +#define RCVDBDI_MODE_INV_RING_SZ 0x00000010 +#define RCVDBDI_STATUS 0x00002404 +#define RCVDBDI_STATUS_JUMBOBD_NEEDED 0x00000004 +#define RCVDBDI_STATUS_FRM_TOO_BIG 0x00000008 +#define RCVDBDI_STATUS_INV_RING_SZ 0x00000010 +#define RCVDBDI_SPLIT_FRAME_MINSZ 0x00002408 +/* 0x240c --> 0x2440 unused */ +#define RCVDBDI_JUMBO_BD 0x00002440 /* TG3_BDINFO_... */ +#define RCVDBDI_STD_BD 0x00002450 /* TG3_BDINFO_... */ +#define RCVDBDI_MINI_BD 0x00002460 /* TG3_BDINFO_... */ +#define RCVDBDI_JUMBO_CON_IDX 0x00002470 +#define RCVDBDI_STD_CON_IDX 0x00002474 +#define RCVDBDI_MINI_CON_IDX 0x00002478 +/* 0x247c --> 0x2480 unused */ +#define RCVDBDI_BD_PROD_IDX_0 0x00002480 +#define RCVDBDI_BD_PROD_IDX_1 0x00002484 +#define RCVDBDI_BD_PROD_IDX_2 0x00002488 +#define RCVDBDI_BD_PROD_IDX_3 0x0000248c +#define RCVDBDI_BD_PROD_IDX_4 0x00002490 +#define RCVDBDI_BD_PROD_IDX_5 0x00002494 +#define RCVDBDI_BD_PROD_IDX_6 0x00002498 +#define RCVDBDI_BD_PROD_IDX_7 0x0000249c +#define RCVDBDI_BD_PROD_IDX_8 0x000024a0 +#define RCVDBDI_BD_PROD_IDX_9 0x000024a4 +#define RCVDBDI_BD_PROD_IDX_10 0x000024a8 +#define RCVDBDI_BD_PROD_IDX_11 0x000024ac +#define RCVDBDI_BD_PROD_IDX_12 0x000024b0 +#define RCVDBDI_BD_PROD_IDX_13 0x000024b4 +#define RCVDBDI_BD_PROD_IDX_14 0x000024b8 +#define RCVDBDI_BD_PROD_IDX_15 0x000024bc +#define RCVDBDI_HWDIAG 0x000024c0 +/* 0x24c4 --> 0x2800 unused */ + +/* Receive Data Completion Control */ +#define RCVDCC_MODE 0x00002800 +#define RCVDCC_MODE_RESET 0x00000001 +#define RCVDCC_MODE_ENABLE 0x00000002 +#define RCVDCC_MODE_ATTN_ENABLE 0x00000004 +/* 0x2804 --> 0x2c00 unused */ + +/* Receive BD Initiator Control Registers */ +#define RCVBDI_MODE 0x00002c00 +#define RCVBDI_MODE_RESET 0x00000001 +#define RCVBDI_MODE_ENABLE 0x00000002 +#define RCVBDI_MODE_RCB_ATTN_ENAB 0x00000004 +#define RCVBDI_STATUS 0x00002c04 +#define RCVBDI_STATUS_RCB_ATTN 0x00000004 +#define RCVBDI_JUMBO_PROD_IDX 0x00002c08 +#define RCVBDI_STD_PROD_IDX 0x00002c0c +#define RCVBDI_MINI_PROD_IDX 0x00002c10 +#define RCVBDI_MINI_THRESH 0x00002c14 +#define RCVBDI_STD_THRESH 0x00002c18 +#define RCVBDI_JUMBO_THRESH 0x00002c1c +/* 0x2c20 --> 0x3000 unused */ + +/* Receive BD Completion Control Registers */ +#define RCVCC_MODE 0x00003000 +#define RCVCC_MODE_RESET 0x00000001 +#define RCVCC_MODE_ENABLE 0x00000002 +#define RCVCC_MODE_ATTN_ENABLE 0x00000004 +#define RCVCC_STATUS 0x00003004 +#define RCVCC_STATUS_ERROR_ATTN 0x00000004 +#define RCVCC_JUMP_PROD_IDX 0x00003008 +#define RCVCC_STD_PROD_IDX 0x0000300c +#define RCVCC_MINI_PROD_IDX 0x00003010 +/* 0x3014 --> 0x3400 unused */ + +/* Receive list selector control registers */ +#define RCVLSC_MODE 0x00003400 +#define RCVLSC_MODE_RESET 0x00000001 +#define RCVLSC_MODE_ENABLE 0x00000002 +#define RCVLSC_MODE_ATTN_ENABLE 0x00000004 +#define RCVLSC_STATUS 0x00003404 +#define RCVLSC_STATUS_ERROR_ATTN 0x00000004 +/* 0x3408 --> 0x3800 unused */ + +/* Mbuf cluster free registers */ +#define MBFREE_MODE 0x00003800 +#define MBFREE_MODE_RESET 0x00000001 +#define MBFREE_MODE_ENABLE 0x00000002 +#define MBFREE_STATUS 0x00003804 +/* 0x3808 --> 0x3c00 unused */ + +/* Host coalescing control registers */ +#define HOSTCC_MODE 0x00003c00 +#define HOSTCC_MODE_RESET 0x00000001 +#define HOSTCC_MODE_ENABLE 0x00000002 +#define HOSTCC_MODE_ATTN 0x00000004 +#define HOSTCC_MODE_NOW 0x00000008 +#define HOSTCC_MODE_FULL_STATUS 0x00000000 +#define HOSTCC_MODE_64BYTE 0x00000080 +#define HOSTCC_MODE_32BYTE 0x00000100 +#define HOSTCC_MODE_CLRTICK_RXBD 0x00000200 +#define HOSTCC_MODE_CLRTICK_TXBD 0x00000400 +#define HOSTCC_MODE_NOINT_ON_NOW 0x00000800 +#define HOSTCC_MODE_NOINT_ON_FORCE 0x00001000 +#define HOSTCC_STATUS 0x00003c04 +#define HOSTCC_STATUS_ERROR_ATTN 0x00000004 +#define HOSTCC_RXCOL_TICKS 0x00003c08 +#define LOW_RXCOL_TICKS 0x00000032 +#define DEFAULT_RXCOL_TICKS 0x00000048 +#define HIGH_RXCOL_TICKS 0x00000096 +#define HOSTCC_TXCOL_TICKS 0x00003c0c +#define LOW_TXCOL_TICKS 0x00000096 +#define DEFAULT_TXCOL_TICKS 0x0000012c +#define HIGH_TXCOL_TICKS 0x00000145 +#define HOSTCC_RXMAX_FRAMES 0x00003c10 +#define LOW_RXMAX_FRAMES 0x00000005 +#define DEFAULT_RXMAX_FRAMES 0x00000008 +#define HIGH_RXMAX_FRAMES 0x00000012 +#define HOSTCC_TXMAX_FRAMES 0x00003c14 +#define LOW_TXMAX_FRAMES 0x00000035 +#define DEFAULT_TXMAX_FRAMES 0x0000004b +#define HIGH_TXMAX_FRAMES 0x00000052 +#define HOSTCC_RXCOAL_TICK_INT 0x00003c18 +#define DEFAULT_RXCOAL_TICK_INT 0x00000019 +#define HOSTCC_TXCOAL_TICK_INT 0x00003c1c +#define DEFAULT_TXCOAL_TICK_INT 0x00000019 +#define HOSTCC_RXCOAL_MAXF_INT 0x00003c20 +#define DEFAULT_RXCOAL_MAXF_INT 0x00000005 +#define HOSTCC_TXCOAL_MAXF_INT 0x00003c24 +#define DEFAULT_TXCOAL_MAXF_INT 0x00000005 +#define HOSTCC_STAT_COAL_TICKS 0x00003c28 +#define DEFAULT_STAT_COAL_TICKS 0x000f4240 +/* 0x3c2c --> 0x3c30 unused */ +#define HOSTCC_STATS_BLK_HOST_ADDR 0x00003c30 /* 64-bit */ +#define HOSTCC_STATUS_BLK_HOST_ADDR 0x00003c38 /* 64-bit */ +#define HOSTCC_STATS_BLK_NIC_ADDR 0x00003c40 +#define HOSTCC_STATUS_BLK_NIC_ADDR 0x00003c44 +#define HOSTCC_FLOW_ATTN 0x00003c48 +/* 0x3c4c --> 0x3c50 unused */ +#define HOSTCC_JUMBO_CON_IDX 0x00003c50 +#define HOSTCC_STD_CON_IDX 0x00003c54 +#define HOSTCC_MINI_CON_IDX 0x00003c58 +/* 0x3c5c --> 0x3c80 unused */ +#define HOSTCC_RET_PROD_IDX_0 0x00003c80 +#define HOSTCC_RET_PROD_IDX_1 0x00003c84 +#define HOSTCC_RET_PROD_IDX_2 0x00003c88 +#define HOSTCC_RET_PROD_IDX_3 0x00003c8c +#define HOSTCC_RET_PROD_IDX_4 0x00003c90 +#define HOSTCC_RET_PROD_IDX_5 0x00003c94 +#define HOSTCC_RET_PROD_IDX_6 0x00003c98 +#define HOSTCC_RET_PROD_IDX_7 0x00003c9c +#define HOSTCC_RET_PROD_IDX_8 0x00003ca0 +#define HOSTCC_RET_PROD_IDX_9 0x00003ca4 +#define HOSTCC_RET_PROD_IDX_10 0x00003ca8 +#define HOSTCC_RET_PROD_IDX_11 0x00003cac +#define HOSTCC_RET_PROD_IDX_12 0x00003cb0 +#define HOSTCC_RET_PROD_IDX_13 0x00003cb4 +#define HOSTCC_RET_PROD_IDX_14 0x00003cb8 +#define HOSTCC_RET_PROD_IDX_15 0x00003cbc +#define HOSTCC_SND_CON_IDX_0 0x00003cc0 +#define HOSTCC_SND_CON_IDX_1 0x00003cc4 +#define HOSTCC_SND_CON_IDX_2 0x00003cc8 +#define HOSTCC_SND_CON_IDX_3 0x00003ccc +#define HOSTCC_SND_CON_IDX_4 0x00003cd0 +#define HOSTCC_SND_CON_IDX_5 0x00003cd4 +#define HOSTCC_SND_CON_IDX_6 0x00003cd8 +#define HOSTCC_SND_CON_IDX_7 0x00003cdc +#define HOSTCC_SND_CON_IDX_8 0x00003ce0 +#define HOSTCC_SND_CON_IDX_9 0x00003ce4 +#define HOSTCC_SND_CON_IDX_10 0x00003ce8 +#define HOSTCC_SND_CON_IDX_11 0x00003cec +#define HOSTCC_SND_CON_IDX_12 0x00003cf0 +#define HOSTCC_SND_CON_IDX_13 0x00003cf4 +#define HOSTCC_SND_CON_IDX_14 0x00003cf8 +#define HOSTCC_SND_CON_IDX_15 0x00003cfc +/* 0x3d00 --> 0x4000 unused */ + +/* Memory arbiter control registers */ +#define MEMARB_MODE 0x00004000 +#define MEMARB_MODE_RESET 0x00000001 +#define MEMARB_MODE_ENABLE 0x00000002 +#define MEMARB_STATUS 0x00004004 +#define MEMARB_TRAP_ADDR_LOW 0x00004008 +#define MEMARB_TRAP_ADDR_HIGH 0x0000400c +/* 0x4010 --> 0x4400 unused */ + +/* Buffer manager control registers */ +#define BUFMGR_MODE 0x00004400 +#define BUFMGR_MODE_RESET 0x00000001 +#define BUFMGR_MODE_ENABLE 0x00000002 +#define BUFMGR_MODE_ATTN_ENABLE 0x00000004 +#define BUFMGR_MODE_BM_TEST 0x00000008 +#define BUFMGR_MODE_MBLOW_ATTN_ENAB 0x00000010 +#define BUFMGR_STATUS 0x00004404 +#define BUFMGR_STATUS_ERROR 0x00000004 +#define BUFMGR_STATUS_MBLOW 0x00000010 +#define BUFMGR_MB_POOL_ADDR 0x00004408 +#define BUFMGR_MB_POOL_SIZE 0x0000440c +#define BUFMGR_MB_RDMA_LOW_WATER 0x00004410 +#define DEFAULT_MB_RDMA_LOW_WATER 0x00000050 +#define DEFAULT_MB_RDMA_LOW_WATER_5705 0x00000000 +#define DEFAULT_MB_RDMA_LOW_WATER_JUMBO 0x00000130 +#define BUFMGR_MB_MACRX_LOW_WATER 0x00004414 +#define DEFAULT_MB_MACRX_LOW_WATER 0x00000020 +#define DEFAULT_MB_MACRX_LOW_WATER_5705 0x00000010 +#define DEFAULT_MB_MACRX_LOW_WATER_JUMBO 0x00000098 +#define BUFMGR_MB_HIGH_WATER 0x00004418 +#define DEFAULT_MB_HIGH_WATER 0x00000060 +#define DEFAULT_MB_HIGH_WATER_5705 0x00000060 +#define DEFAULT_MB_HIGH_WATER_JUMBO 0x0000017c +#define BUFMGR_RX_MB_ALLOC_REQ 0x0000441c +#define BUFMGR_MB_ALLOC_BIT 0x10000000 +#define BUFMGR_RX_MB_ALLOC_RESP 0x00004420 +#define BUFMGR_TX_MB_ALLOC_REQ 0x00004424 +#define BUFMGR_TX_MB_ALLOC_RESP 0x00004428 +#define BUFMGR_DMA_DESC_POOL_ADDR 0x0000442c +#define BUFMGR_DMA_DESC_POOL_SIZE 0x00004430 +#define BUFMGR_DMA_LOW_WATER 0x00004434 +#define DEFAULT_DMA_LOW_WATER 0x00000005 +#define BUFMGR_DMA_HIGH_WATER 0x00004438 +#define DEFAULT_DMA_HIGH_WATER 0x0000000a +#define BUFMGR_RX_DMA_ALLOC_REQ 0x0000443c +#define BUFMGR_RX_DMA_ALLOC_RESP 0x00004440 +#define BUFMGR_TX_DMA_ALLOC_REQ 0x00004444 +#define BUFMGR_TX_DMA_ALLOC_RESP 0x00004448 +#define BUFMGR_HWDIAG_0 0x0000444c +#define BUFMGR_HWDIAG_1 0x00004450 +#define BUFMGR_HWDIAG_2 0x00004454 +/* 0x4458 --> 0x4800 unused */ + +/* Read DMA control registers */ +#define RDMAC_MODE 0x00004800 +#define RDMAC_MODE_RESET 0x00000001 +#define RDMAC_MODE_ENABLE 0x00000002 +#define RDMAC_MODE_TGTABORT_ENAB 0x00000004 +#define RDMAC_MODE_MSTABORT_ENAB 0x00000008 +#define RDMAC_MODE_PARITYERR_ENAB 0x00000010 +#define RDMAC_MODE_ADDROFLOW_ENAB 0x00000020 +#define RDMAC_MODE_FIFOOFLOW_ENAB 0x00000040 +#define RDMAC_MODE_FIFOURUN_ENAB 0x00000080 +#define RDMAC_MODE_FIFOOREAD_ENAB 0x00000100 +#define RDMAC_MODE_LNGREAD_ENAB 0x00000200 +#define RDMAC_MODE_SPLIT_ENABLE 0x00000800 +#define RDMAC_MODE_SPLIT_RESET 0x00001000 +#define RDMAC_MODE_FIFO_SIZE_128 0x00020000 +#define RDMAC_MODE_FIFO_LONG_BURST 0x00030000 +#define RDMAC_STATUS 0x00004804 +#define RDMAC_STATUS_TGTABORT 0x00000004 +#define RDMAC_STATUS_MSTABORT 0x00000008 +#define RDMAC_STATUS_PARITYERR 0x00000010 +#define RDMAC_STATUS_ADDROFLOW 0x00000020 +#define RDMAC_STATUS_FIFOOFLOW 0x00000040 +#define RDMAC_STATUS_FIFOURUN 0x00000080 +#define RDMAC_STATUS_FIFOOREAD 0x00000100 +#define RDMAC_STATUS_LNGREAD 0x00000200 +/* 0x4808 --> 0x4c00 unused */ + +/* Write DMA control registers */ +#define WDMAC_MODE 0x00004c00 +#define WDMAC_MODE_RESET 0x00000001 +#define WDMAC_MODE_ENABLE 0x00000002 +#define WDMAC_MODE_TGTABORT_ENAB 0x00000004 +#define WDMAC_MODE_MSTABORT_ENAB 0x00000008 +#define WDMAC_MODE_PARITYERR_ENAB 0x00000010 +#define WDMAC_MODE_ADDROFLOW_ENAB 0x00000020 +#define WDMAC_MODE_FIFOOFLOW_ENAB 0x00000040 +#define WDMAC_MODE_FIFOURUN_ENAB 0x00000080 +#define WDMAC_MODE_FIFOOREAD_ENAB 0x00000100 +#define WDMAC_MODE_LNGREAD_ENAB 0x00000200 +#define WDMAC_MODE_RX_ACCEL 0x00000400 +#define WDMAC_STATUS 0x00004c04 +#define WDMAC_STATUS_TGTABORT 0x00000004 +#define WDMAC_STATUS_MSTABORT 0x00000008 +#define WDMAC_STATUS_PARITYERR 0x00000010 +#define WDMAC_STATUS_ADDROFLOW 0x00000020 +#define WDMAC_STATUS_FIFOOFLOW 0x00000040 +#define WDMAC_STATUS_FIFOURUN 0x00000080 +#define WDMAC_STATUS_FIFOOREAD 0x00000100 +#define WDMAC_STATUS_LNGREAD 0x00000200 +/* 0x4c08 --> 0x5000 unused */ + +/* Per-cpu register offsets (arm9) */ +#define CPU_MODE 0x00000000 +#define CPU_MODE_RESET 0x00000001 +#define CPU_MODE_HALT 0x00000400 +#define CPU_STATE 0x00000004 +#define CPU_EVTMASK 0x00000008 +/* 0xc --> 0x1c reserved */ +#define CPU_PC 0x0000001c +#define CPU_INSN 0x00000020 +#define CPU_SPAD_UFLOW 0x00000024 +#define CPU_WDOG_CLEAR 0x00000028 +#define CPU_WDOG_VECTOR 0x0000002c +#define CPU_WDOG_PC 0x00000030 +#define CPU_HW_BP 0x00000034 +/* 0x38 --> 0x44 unused */ +#define CPU_WDOG_SAVED_STATE 0x00000044 +#define CPU_LAST_BRANCH_ADDR 0x00000048 +#define CPU_SPAD_UFLOW_SET 0x0000004c +/* 0x50 --> 0x200 unused */ +#define CPU_R0 0x00000200 +#define CPU_R1 0x00000204 +#define CPU_R2 0x00000208 +#define CPU_R3 0x0000020c +#define CPU_R4 0x00000210 +#define CPU_R5 0x00000214 +#define CPU_R6 0x00000218 +#define CPU_R7 0x0000021c +#define CPU_R8 0x00000220 +#define CPU_R9 0x00000224 +#define CPU_R10 0x00000228 +#define CPU_R11 0x0000022c +#define CPU_R12 0x00000230 +#define CPU_R13 0x00000234 +#define CPU_R14 0x00000238 +#define CPU_R15 0x0000023c +#define CPU_R16 0x00000240 +#define CPU_R17 0x00000244 +#define CPU_R18 0x00000248 +#define CPU_R19 0x0000024c +#define CPU_R20 0x00000250 +#define CPU_R21 0x00000254 +#define CPU_R22 0x00000258 +#define CPU_R23 0x0000025c +#define CPU_R24 0x00000260 +#define CPU_R25 0x00000264 +#define CPU_R26 0x00000268 +#define CPU_R27 0x0000026c +#define CPU_R28 0x00000270 +#define CPU_R29 0x00000274 +#define CPU_R30 0x00000278 +#define CPU_R31 0x0000027c +/* 0x280 --> 0x400 unused */ + +#define RX_CPU_BASE 0x00005000 +#define TX_CPU_BASE 0x00005400 + +/* Mailboxes */ +#define GRCMBOX_INTERRUPT_0 0x00005800 /* 64-bit */ +#define GRCMBOX_INTERRUPT_1 0x00005808 /* 64-bit */ +#define GRCMBOX_INTERRUPT_2 0x00005810 /* 64-bit */ +#define GRCMBOX_INTERRUPT_3 0x00005818 /* 64-bit */ +#define GRCMBOX_GENERAL_0 0x00005820 /* 64-bit */ +#define GRCMBOX_GENERAL_1 0x00005828 /* 64-bit */ +#define GRCMBOX_GENERAL_2 0x00005830 /* 64-bit */ +#define GRCMBOX_GENERAL_3 0x00005838 /* 64-bit */ +#define GRCMBOX_GENERAL_4 0x00005840 /* 64-bit */ +#define GRCMBOX_GENERAL_5 0x00005848 /* 64-bit */ +#define GRCMBOX_GENERAL_6 0x00005850 /* 64-bit */ +#define GRCMBOX_GENERAL_7 0x00005858 /* 64-bit */ +#define GRCMBOX_RELOAD_STAT 0x00005860 /* 64-bit */ +#define GRCMBOX_RCVSTD_PROD_IDX 0x00005868 /* 64-bit */ +#define GRCMBOX_RCVJUMBO_PROD_IDX 0x00005870 /* 64-bit */ +#define GRCMBOX_RCVMINI_PROD_IDX 0x00005878 /* 64-bit */ +#define GRCMBOX_RCVRET_CON_IDX_0 0x00005880 /* 64-bit */ +#define GRCMBOX_RCVRET_CON_IDX_1 0x00005888 /* 64-bit */ +#define GRCMBOX_RCVRET_CON_IDX_2 0x00005890 /* 64-bit */ +#define GRCMBOX_RCVRET_CON_IDX_3 0x00005898 /* 64-bit */ +#define GRCMBOX_RCVRET_CON_IDX_4 0x000058a0 /* 64-bit */ +#define GRCMBOX_RCVRET_CON_IDX_5 0x000058a8 /* 64-bit */ +#define GRCMBOX_RCVRET_CON_IDX_6 0x000058b0 /* 64-bit */ +#define GRCMBOX_RCVRET_CON_IDX_7 0x000058b8 /* 64-bit */ +#define GRCMBOX_RCVRET_CON_IDX_8 0x000058c0 /* 64-bit */ +#define GRCMBOX_RCVRET_CON_IDX_9 0x000058c8 /* 64-bit */ +#define GRCMBOX_RCVRET_CON_IDX_10 0x000058d0 /* 64-bit */ +#define GRCMBOX_RCVRET_CON_IDX_11 0x000058d8 /* 64-bit */ +#define GRCMBOX_RCVRET_CON_IDX_12 0x000058e0 /* 64-bit */ +#define GRCMBOX_RCVRET_CON_IDX_13 0x000058e8 /* 64-bit */ +#define GRCMBOX_RCVRET_CON_IDX_14 0x000058f0 /* 64-bit */ +#define GRCMBOX_RCVRET_CON_IDX_15 0x000058f8 /* 64-bit */ +#define GRCMBOX_SNDHOST_PROD_IDX_0 0x00005900 /* 64-bit */ +#define GRCMBOX_SNDHOST_PROD_IDX_1 0x00005908 /* 64-bit */ +#define GRCMBOX_SNDHOST_PROD_IDX_2 0x00005910 /* 64-bit */ +#define GRCMBOX_SNDHOST_PROD_IDX_3 0x00005918 /* 64-bit */ +#define GRCMBOX_SNDHOST_PROD_IDX_4 0x00005920 /* 64-bit */ +#define GRCMBOX_SNDHOST_PROD_IDX_5 0x00005928 /* 64-bit */ +#define GRCMBOX_SNDHOST_PROD_IDX_6 0x00005930 /* 64-bit */ +#define GRCMBOX_SNDHOST_PROD_IDX_7 0x00005938 /* 64-bit */ +#define GRCMBOX_SNDHOST_PROD_IDX_8 0x00005940 /* 64-bit */ +#define GRCMBOX_SNDHOST_PROD_IDX_9 0x00005948 /* 64-bit */ +#define GRCMBOX_SNDHOST_PROD_IDX_10 0x00005950 /* 64-bit */ +#define GRCMBOX_SNDHOST_PROD_IDX_11 0x00005958 /* 64-bit */ +#define GRCMBOX_SNDHOST_PROD_IDX_12 0x00005960 /* 64-bit */ +#define GRCMBOX_SNDHOST_PROD_IDX_13 0x00005968 /* 64-bit */ +#define GRCMBOX_SNDHOST_PROD_IDX_14 0x00005970 /* 64-bit */ +#define GRCMBOX_SNDHOST_PROD_IDX_15 0x00005978 /* 64-bit */ +#define GRCMBOX_SNDNIC_PROD_IDX_0 0x00005980 /* 64-bit */ +#define GRCMBOX_SNDNIC_PROD_IDX_1 0x00005988 /* 64-bit */ +#define GRCMBOX_SNDNIC_PROD_IDX_2 0x00005990 /* 64-bit */ +#define GRCMBOX_SNDNIC_PROD_IDX_3 0x00005998 /* 64-bit */ +#define GRCMBOX_SNDNIC_PROD_IDX_4 0x000059a0 /* 64-bit */ +#define GRCMBOX_SNDNIC_PROD_IDX_5 0x000059a8 /* 64-bit */ +#define GRCMBOX_SNDNIC_PROD_IDX_6 0x000059b0 /* 64-bit */ +#define GRCMBOX_SNDNIC_PROD_IDX_7 0x000059b8 /* 64-bit */ +#define GRCMBOX_SNDNIC_PROD_IDX_8 0x000059c0 /* 64-bit */ +#define GRCMBOX_SNDNIC_PROD_IDX_9 0x000059c8 /* 64-bit */ +#define GRCMBOX_SNDNIC_PROD_IDX_10 0x000059d0 /* 64-bit */ +#define GRCMBOX_SNDNIC_PROD_IDX_11 0x000059d8 /* 64-bit */ +#define GRCMBOX_SNDNIC_PROD_IDX_12 0x000059e0 /* 64-bit */ +#define GRCMBOX_SNDNIC_PROD_IDX_13 0x000059e8 /* 64-bit */ +#define GRCMBOX_SNDNIC_PROD_IDX_14 0x000059f0 /* 64-bit */ +#define GRCMBOX_SNDNIC_PROD_IDX_15 0x000059f8 /* 64-bit */ +#define GRCMBOX_HIGH_PRIO_EV_VECTOR 0x00005a00 +#define GRCMBOX_HIGH_PRIO_EV_MASK 0x00005a04 +#define GRCMBOX_LOW_PRIO_EV_VEC 0x00005a08 +#define GRCMBOX_LOW_PRIO_EV_MASK 0x00005a0c +/* 0x5a10 --> 0x5c00 */ + +/* Flow Through queues */ +#define FTQ_RESET 0x00005c00 +/* 0x5c04 --> 0x5c10 unused */ +#define FTQ_DMA_NORM_READ_CTL 0x00005c10 +#define FTQ_DMA_NORM_READ_FULL_CNT 0x00005c14 +#define FTQ_DMA_NORM_READ_FIFO_ENQDEQ 0x00005c18 +#define FTQ_DMA_NORM_READ_WRITE_PEEK 0x00005c1c +#define FTQ_DMA_HIGH_READ_CTL 0x00005c20 +#define FTQ_DMA_HIGH_READ_FULL_CNT 0x00005c24 +#define FTQ_DMA_HIGH_READ_FIFO_ENQDEQ 0x00005c28 +#define FTQ_DMA_HIGH_READ_WRITE_PEEK 0x00005c2c +#define FTQ_DMA_COMP_DISC_CTL 0x00005c30 +#define FTQ_DMA_COMP_DISC_FULL_CNT 0x00005c34 +#define FTQ_DMA_COMP_DISC_FIFO_ENQDEQ 0x00005c38 +#define FTQ_DMA_COMP_DISC_WRITE_PEEK 0x00005c3c +#define FTQ_SEND_BD_COMP_CTL 0x00005c40 +#define FTQ_SEND_BD_COMP_FULL_CNT 0x00005c44 +#define FTQ_SEND_BD_COMP_FIFO_ENQDEQ 0x00005c48 +#define FTQ_SEND_BD_COMP_WRITE_PEEK 0x00005c4c +#define FTQ_SEND_DATA_INIT_CTL 0x00005c50 +#define FTQ_SEND_DATA_INIT_FULL_CNT 0x00005c54 +#define FTQ_SEND_DATA_INIT_FIFO_ENQDEQ 0x00005c58 +#define FTQ_SEND_DATA_INIT_WRITE_PEEK 0x00005c5c +#define FTQ_DMA_NORM_WRITE_CTL 0x00005c60 +#define FTQ_DMA_NORM_WRITE_FULL_CNT 0x00005c64 +#define FTQ_DMA_NORM_WRITE_FIFO_ENQDEQ 0x00005c68 +#define FTQ_DMA_NORM_WRITE_WRITE_PEEK 0x00005c6c +#define FTQ_DMA_HIGH_WRITE_CTL 0x00005c70 +#define FTQ_DMA_HIGH_WRITE_FULL_CNT 0x00005c74 +#define FTQ_DMA_HIGH_WRITE_FIFO_ENQDEQ 0x00005c78 +#define FTQ_DMA_HIGH_WRITE_WRITE_PEEK 0x00005c7c +#define FTQ_SWTYPE1_CTL 0x00005c80 +#define FTQ_SWTYPE1_FULL_CNT 0x00005c84 +#define FTQ_SWTYPE1_FIFO_ENQDEQ 0x00005c88 +#define FTQ_SWTYPE1_WRITE_PEEK 0x00005c8c +#define FTQ_SEND_DATA_COMP_CTL 0x00005c90 +#define FTQ_SEND_DATA_COMP_FULL_CNT 0x00005c94 +#define FTQ_SEND_DATA_COMP_FIFO_ENQDEQ 0x00005c98 +#define FTQ_SEND_DATA_COMP_WRITE_PEEK 0x00005c9c +#define FTQ_HOST_COAL_CTL 0x00005ca0 +#define FTQ_HOST_COAL_FULL_CNT 0x00005ca4 +#define FTQ_HOST_COAL_FIFO_ENQDEQ 0x00005ca8 +#define FTQ_HOST_COAL_WRITE_PEEK 0x00005cac +#define FTQ_MAC_TX_CTL 0x00005cb0 +#define FTQ_MAC_TX_FULL_CNT 0x00005cb4 +#define FTQ_MAC_TX_FIFO_ENQDEQ 0x00005cb8 +#define FTQ_MAC_TX_WRITE_PEEK 0x00005cbc +#define FTQ_MB_FREE_CTL 0x00005cc0 +#define FTQ_MB_FREE_FULL_CNT 0x00005cc4 +#define FTQ_MB_FREE_FIFO_ENQDEQ 0x00005cc8 +#define FTQ_MB_FREE_WRITE_PEEK 0x00005ccc +#define FTQ_RCVBD_COMP_CTL 0x00005cd0 +#define FTQ_RCVBD_COMP_FULL_CNT 0x00005cd4 +#define FTQ_RCVBD_COMP_FIFO_ENQDEQ 0x00005cd8 +#define FTQ_RCVBD_COMP_WRITE_PEEK 0x00005cdc +#define FTQ_RCVLST_PLMT_CTL 0x00005ce0 +#define FTQ_RCVLST_PLMT_FULL_CNT 0x00005ce4 +#define FTQ_RCVLST_PLMT_FIFO_ENQDEQ 0x00005ce8 +#define FTQ_RCVLST_PLMT_WRITE_PEEK 0x00005cec +#define FTQ_RCVDATA_INI_CTL 0x00005cf0 +#define FTQ_RCVDATA_INI_FULL_CNT 0x00005cf4 +#define FTQ_RCVDATA_INI_FIFO_ENQDEQ 0x00005cf8 +#define FTQ_RCVDATA_INI_WRITE_PEEK 0x00005cfc +#define FTQ_RCVDATA_COMP_CTL 0x00005d00 +#define FTQ_RCVDATA_COMP_FULL_CNT 0x00005d04 +#define FTQ_RCVDATA_COMP_FIFO_ENQDEQ 0x00005d08 +#define FTQ_RCVDATA_COMP_WRITE_PEEK 0x00005d0c +#define FTQ_SWTYPE2_CTL 0x00005d10 +#define FTQ_SWTYPE2_FULL_CNT 0x00005d14 +#define FTQ_SWTYPE2_FIFO_ENQDEQ 0x00005d18 +#define FTQ_SWTYPE2_WRITE_PEEK 0x00005d1c +/* 0x5d20 --> 0x6000 unused */ + +/* Message signaled interrupt registers */ +#define MSGINT_MODE 0x00006000 +#define MSGINT_MODE_RESET 0x00000001 +#define MSGINT_MODE_ENABLE 0x00000002 +#define MSGINT_STATUS 0x00006004 +#define MSGINT_FIFO 0x00006008 +/* 0x600c --> 0x6400 unused */ + +/* DMA completion registers */ +#define DMAC_MODE 0x00006400 +#define DMAC_MODE_RESET 0x00000001 +#define DMAC_MODE_ENABLE 0x00000002 +/* 0x6404 --> 0x6800 unused */ + +/* GRC registers */ +#define GRC_MODE 0x00006800 +#define GRC_MODE_UPD_ON_COAL 0x00000001 +#define GRC_MODE_BSWAP_NONFRM_DATA 0x00000002 +#define GRC_MODE_WSWAP_NONFRM_DATA 0x00000004 +#define GRC_MODE_BSWAP_DATA 0x00000010 +#define GRC_MODE_WSWAP_DATA 0x00000020 +#define GRC_MODE_SPLITHDR 0x00000100 +#define GRC_MODE_NOFRM_CRACKING 0x00000200 +#define GRC_MODE_INCL_CRC 0x00000400 +#define GRC_MODE_ALLOW_BAD_FRMS 0x00000800 +#define GRC_MODE_NOIRQ_ON_SENDS 0x00002000 +#define GRC_MODE_NOIRQ_ON_RCV 0x00004000 +#define GRC_MODE_FORCE_PCI32BIT 0x00008000 +#define GRC_MODE_HOST_STACKUP 0x00010000 +#define GRC_MODE_HOST_SENDBDS 0x00020000 +#define GRC_MODE_NO_TX_PHDR_CSUM 0x00100000 +#define GRC_MODE_NO_RX_PHDR_CSUM 0x00800000 +#define GRC_MODE_IRQ_ON_TX_CPU_ATTN 0x01000000 +#define GRC_MODE_IRQ_ON_RX_CPU_ATTN 0x02000000 +#define GRC_MODE_IRQ_ON_MAC_ATTN 0x04000000 +#define GRC_MODE_IRQ_ON_DMA_ATTN 0x08000000 +#define GRC_MODE_IRQ_ON_FLOW_ATTN 0x10000000 +#define GRC_MODE_4X_NIC_SEND_RINGS 0x20000000 +#define GRC_MODE_MCAST_FRM_ENABLE 0x40000000 +#define GRC_MISC_CFG 0x00006804 +#define GRC_MISC_CFG_CORECLK_RESET 0x00000001 +#define GRC_MISC_CFG_PRESCALAR_MASK 0x000000fe +#define GRC_MISC_CFG_PRESCALAR_SHIFT 1 +#define GRC_MISC_CFG_BOARD_ID_MASK 0x0001e000 +#define GRC_MISC_CFG_BOARD_ID_5700 0x0001e000 +#define GRC_MISC_CFG_BOARD_ID_5701 0x00000000 +#define GRC_MISC_CFG_BOARD_ID_5702FE 0x00004000 +#define GRC_MISC_CFG_BOARD_ID_5703 0x00000000 +#define GRC_MISC_CFG_BOARD_ID_5703S 0x00002000 +#define GRC_MISC_CFG_BOARD_ID_5704 0x00000000 +#define GRC_MISC_CFG_BOARD_ID_5704CIOBE 0x00004000 +#define GRC_MISC_CFG_BOARD_ID_5704_A2 0x00008000 +#define GRC_MISC_CFG_BOARD_ID_5788 0x00010000 +#define GRC_MISC_CFG_BOARD_ID_5788M 0x00018000 +#define GRC_MISC_CFG_BOARD_ID_AC91002A1 0x00018000 +#define GRC_MISC_CFG_KEEP_GPHY_POWER 0x04000000 +#define GRC_LOCAL_CTRL 0x00006808 +#define GRC_LCLCTRL_INT_ACTIVE 0x00000001 +#define GRC_LCLCTRL_CLEARINT 0x00000002 +#define GRC_LCLCTRL_SETINT 0x00000004 +#define GRC_LCLCTRL_INT_ON_ATTN 0x00000008 +#define GRC_LCLCTRL_GPIO_INPUT0 0x00000100 +#define GRC_LCLCTRL_GPIO_INPUT1 0x00000200 +#define GRC_LCLCTRL_GPIO_INPUT2 0x00000400 +#define GRC_LCLCTRL_GPIO_OE0 0x00000800 +#define GRC_LCLCTRL_GPIO_OE1 0x00001000 +#define GRC_LCLCTRL_GPIO_OE2 0x00002000 +#define GRC_LCLCTRL_GPIO_OUTPUT0 0x00004000 +#define GRC_LCLCTRL_GPIO_OUTPUT1 0x00008000 +#define GRC_LCLCTRL_GPIO_OUTPUT2 0x00010000 +#define GRC_LCLCTRL_EXTMEM_ENABLE 0x00020000 +#define GRC_LCLCTRL_MEMSZ_MASK 0x001c0000 +#define GRC_LCLCTRL_MEMSZ_256K 0x00000000 +#define GRC_LCLCTRL_MEMSZ_512K 0x00040000 +#define GRC_LCLCTRL_MEMSZ_1M 0x00080000 +#define GRC_LCLCTRL_MEMSZ_2M 0x000c0000 +#define GRC_LCLCTRL_MEMSZ_4M 0x00100000 +#define GRC_LCLCTRL_MEMSZ_8M 0x00140000 +#define GRC_LCLCTRL_MEMSZ_16M 0x00180000 +#define GRC_LCLCTRL_BANK_SELECT 0x00200000 +#define GRC_LCLCTRL_SSRAM_TYPE 0x00400000 +#define GRC_LCLCTRL_AUTO_SEEPROM 0x01000000 +#define GRC_TIMER 0x0000680c +#define GRC_RX_CPU_EVENT 0x00006810 +#define GRC_RX_TIMER_REF 0x00006814 +#define GRC_RX_CPU_SEM 0x00006818 +#define GRC_REMOTE_RX_CPU_ATTN 0x0000681c +#define GRC_TX_CPU_EVENT 0x00006820 +#define GRC_TX_TIMER_REF 0x00006824 +#define GRC_TX_CPU_SEM 0x00006828 +#define GRC_REMOTE_TX_CPU_ATTN 0x0000682c +#define GRC_MEM_POWER_UP 0x00006830 /* 64-bit */ +#define GRC_EEPROM_ADDR 0x00006838 +#define EEPROM_ADDR_WRITE 0x00000000 +#define EEPROM_ADDR_READ 0x80000000 +#define EEPROM_ADDR_COMPLETE 0x40000000 +#define EEPROM_ADDR_FSM_RESET 0x20000000 +#define EEPROM_ADDR_DEVID_MASK 0x1c000000 +#define EEPROM_ADDR_DEVID_SHIFT 26 +#define EEPROM_ADDR_START 0x02000000 +#define EEPROM_ADDR_CLKPERD_SHIFT 16 +#define EEPROM_ADDR_ADDR_MASK 0x0000ffff +#define EEPROM_ADDR_ADDR_SHIFT 0 +#define EEPROM_DEFAULT_CLOCK_PERIOD 0x60 +#define EEPROM_CHIP_SIZE (64 * 1024) +#define GRC_EEPROM_DATA 0x0000683c +#define GRC_EEPROM_CTRL 0x00006840 +#define GRC_MDI_CTRL 0x00006844 +#define GRC_SEEPROM_DELAY 0x00006848 +/* 0x684c --> 0x6c00 unused */ + +/* 0x6c00 --> 0x7000 unused */ + +/* NVRAM Control registers */ +#define NVRAM_CMD 0x00007000 +#define NVRAM_CMD_RESET 0x00000001 +#define NVRAM_CMD_DONE 0x00000008 +#define NVRAM_CMD_GO 0x00000010 +#define NVRAM_CMD_WR 0x00000020 +#define NVRAM_CMD_RD 0x00000000 +#define NVRAM_CMD_ERASE 0x00000040 +#define NVRAM_CMD_FIRST 0x00000080 +#define NVRAM_CMD_LAST 0x00000100 +#define NVRAM_STAT 0x00007004 +#define NVRAM_WRDATA 0x00007008 +#define NVRAM_ADDR 0x0000700c +#define NVRAM_ADDR_MSK 0x00ffffff +#define NVRAM_RDDATA 0x00007010 +#define NVRAM_CFG1 0x00007014 +#define NVRAM_CFG1_FLASHIF_ENAB 0x00000001 +#define NVRAM_CFG1_BUFFERED_MODE 0x00000002 +#define NVRAM_CFG1_PASS_THRU 0x00000004 +#define NVRAM_CFG1_BIT_BANG 0x00000008 +#define NVRAM_CFG1_COMPAT_BYPASS 0x80000000 +#define NVRAM_CFG2 0x00007018 +#define NVRAM_CFG3 0x0000701c +#define NVRAM_SWARB 0x00007020 +#define SWARB_REQ_SET0 0x00000001 +#define SWARB_REQ_SET1 0x00000002 +#define SWARB_REQ_SET2 0x00000004 +#define SWARB_REQ_SET3 0x00000008 +#define SWARB_REQ_CLR0 0x00000010 +#define SWARB_REQ_CLR1 0x00000020 +#define SWARB_REQ_CLR2 0x00000040 +#define SWARB_REQ_CLR3 0x00000080 +#define SWARB_GNT0 0x00000100 +#define SWARB_GNT1 0x00000200 +#define SWARB_GNT2 0x00000400 +#define SWARB_GNT3 0x00000800 +#define SWARB_REQ0 0x00001000 +#define SWARB_REQ1 0x00002000 +#define SWARB_REQ2 0x00004000 +#define SWARB_REQ3 0x00008000 +#define NVRAM_BUFFERED_PAGE_SIZE 264 +#define NVRAM_BUFFERED_PAGE_POS 9 +/* 0x7024 --> 0x7400 unused */ + +/* 0x7400 --> 0x8000 unused */ + +/* 32K Window into NIC internal memory */ +#define NIC_SRAM_WIN_BASE 0x00008000 + +/* Offsets into first 32k of NIC internal memory. */ +#define NIC_SRAM_PAGE_ZERO 0x00000000 +#define NIC_SRAM_SEND_RCB 0x00000100 /* 16 * TG3_BDINFO_... */ +#define NIC_SRAM_RCV_RET_RCB 0x00000200 /* 16 * TG3_BDINFO_... */ +#define NIC_SRAM_STATS_BLK 0x00000300 +#define NIC_SRAM_STATUS_BLK 0x00000b00 + +#define NIC_SRAM_FIRMWARE_MBOX 0x00000b50 +#define NIC_SRAM_FIRMWARE_MBOX_MAGIC1 0x4B657654 +#define NIC_SRAM_FIRMWARE_MBOX_MAGIC2 0x4861764b /* !dma on linkchg */ + +#define NIC_SRAM_DATA_SIG 0x00000b54 +#define NIC_SRAM_DATA_SIG_MAGIC 0x4b657654 /* ascii for 'KevT' */ + +#define NIC_SRAM_DATA_CFG 0x00000b58 +#define NIC_SRAM_DATA_CFG_LED_MODE_MASK 0x0000000c +#define NIC_SRAM_DATA_CFG_LED_MODE_UNKNOWN 0x00000000 +#define NIC_SRAM_DATA_CFG_LED_TRIPLE_SPD 0x00000004 +#define NIC_SRAM_DATA_CFG_LED_OPEN_DRAIN 0x00000004 +#define NIC_SRAM_DATA_CFG_LED_LINK_SPD 0x00000008 +#define NIC_SRAM_DATA_CFG_LED_OUTPUT 0x00000008 +#define NIC_SRAM_DATA_CFG_PHY_TYPE_MASK 0x00000030 +#define NIC_SRAM_DATA_CFG_PHY_TYPE_UNKNOWN 0x00000000 +#define NIC_SRAM_DATA_CFG_PHY_TYPE_COPPER 0x00000010 +#define NIC_SRAM_DATA_CFG_PHY_TYPE_FIBER 0x00000020 +#define NIC_SRAM_DATA_CFG_WOL_ENABLE 0x00000040 +#define NIC_SRAM_DATA_CFG_ASF_ENABLE 0x00000080 +#define NIC_SRAM_DATA_CFG_EEPROM_WP 0x00000100 +#define NIC_SRAM_DATA_CFG_MINI_PCI 0x00001000 +#define NIC_SRAM_DATA_CFG_FIBER_WOL 0x00004000 + +#define NIC_SRAM_DATA_PHY_ID 0x00000b74 +#define NIC_SRAM_DATA_PHY_ID1_MASK 0xffff0000 +#define NIC_SRAM_DATA_PHY_ID2_MASK 0x0000ffff + +#define NIC_SRAM_FW_CMD_MBOX 0x00000b78 +#define FWCMD_NICDRV_ALIVE 0x00000001 +#define FWCMD_NICDRV_PAUSE_FW 0x00000002 +#define FWCMD_NICDRV_IPV4ADDR_CHG 0x00000003 +#define FWCMD_NICDRV_IPV6ADDR_CHG 0x00000004 +#define FWCMD_NICDRV_FIX_DMAR 0x00000005 +#define FWCMD_NICDRV_FIX_DMAW 0x00000006 +#define NIC_SRAM_FW_CMD_LEN_MBOX 0x00000b7c +#define NIC_SRAM_FW_CMD_DATA_MBOX 0x00000b80 +#define NIC_SRAM_FW_ASF_STATUS_MBOX 0x00000c00 +#define NIC_SRAM_FW_DRV_STATE_MBOX 0x00000c04 +#define DRV_STATE_START 0x00000001 +#define DRV_STATE_UNLOAD 0x00000002 +#define DRV_STATE_WOL 0x00000003 +#define DRV_STATE_SUSPEND 0x00000004 + +#define NIC_SRAM_FW_RESET_TYPE_MBOX 0x00000c08 + +#define NIC_SRAM_MAC_ADDR_HIGH_MBOX 0x00000c14 +#define NIC_SRAM_MAC_ADDR_LOW_MBOX 0x00000c18 + +#define NIC_SRAM_RX_MINI_BUFFER_DESC 0x00001000 + +#define NIC_SRAM_DMA_DESC_POOL_BASE 0x00002000 +#define NIC_SRAM_DMA_DESC_POOL_SIZE 0x00002000 +#define NIC_SRAM_TX_BUFFER_DESC 0x00004000 /* 512 entries */ +#define NIC_SRAM_RX_BUFFER_DESC 0x00006000 /* 256 entries */ +#define NIC_SRAM_RX_JUMBO_BUFFER_DESC 0x00007000 /* 256 entries */ +#define NIC_SRAM_MBUF_POOL_BASE 0x00008000 +#define NIC_SRAM_MBUF_POOL_SIZE96 0x00018000 +#define NIC_SRAM_MBUF_POOL_SIZE64 0x00010000 +#define NIC_SRAM_MBUF_POOL_BASE5705 0x00010000 +#define NIC_SRAM_MBUF_POOL_SIZE5705 0x0000e000 + +/* Currently this is fixed. */ +#define PHY_ADDR 0x01 + +/* Tigon3 specific PHY MII registers. */ +#define TG3_BMCR_SPEED1000 0x0040 + +#define MII_TG3_CTRL 0x09 /* 1000-baseT control register */ +#define MII_TG3_CTRL_ADV_1000_HALF 0x0100 +#define MII_TG3_CTRL_ADV_1000_FULL 0x0200 +#define MII_TG3_CTRL_AS_MASTER 0x0800 +#define MII_TG3_CTRL_ENABLE_AS_MASTER 0x1000 + +#define MII_TG3_EXT_CTRL 0x10 /* Extended control register */ +#define MII_TG3_EXT_CTRL_LNK3_LED_MODE 0x0002 +#define MII_TG3_EXT_CTRL_TBI 0x8000 + +#define MII_TG3_EXT_STAT 0x11 /* Extended status register */ +#define MII_TG3_EXT_STAT_LPASS 0x0100 + +#define MII_TG3_DSP_RW_PORT 0x15 /* DSP coefficient read/write port */ + +#define MII_TG3_DSP_ADDRESS 0x17 /* DSP address register */ + +#define MII_TG3_AUX_CTRL 0x18 /* auxilliary control register */ + +#define MII_TG3_AUX_STAT 0x19 /* auxilliary status register */ +#define MII_TG3_AUX_STAT_LPASS 0x0004 +#define MII_TG3_AUX_STAT_SPDMASK 0x0700 +#define MII_TG3_AUX_STAT_10HALF 0x0100 +#define MII_TG3_AUX_STAT_10FULL 0x0200 +#define MII_TG3_AUX_STAT_100HALF 0x0300 +#define MII_TG3_AUX_STAT_100_4 0x0400 +#define MII_TG3_AUX_STAT_100FULL 0x0500 +#define MII_TG3_AUX_STAT_1000HALF 0x0600 +#define MII_TG3_AUX_STAT_1000FULL 0x0700 + +#define MII_TG3_ISTAT 0x1a /* IRQ status register */ +#define MII_TG3_IMASK 0x1b /* IRQ mask register */ + +/* ISTAT/IMASK event bits */ +#define MII_TG3_INT_LINKCHG 0x0002 +#define MII_TG3_INT_SPEEDCHG 0x0004 +#define MII_TG3_INT_DUPLEXCHG 0x0008 +#define MII_TG3_INT_ANEG_PAGE_RX 0x0400 + +/* XXX Add this to mii.h */ +#ifndef ADVERTISE_PAUSE +#define ADVERTISE_PAUSE_CAP 0x0400 +#endif +#ifndef ADVERTISE_PAUSE_ASYM +#define ADVERTISE_PAUSE_ASYM 0x0800 +#endif +#ifndef LPA_PAUSE +#define LPA_PAUSE_CAP 0x0400 +#endif +#ifndef LPA_PAUSE_ASYM +#define LPA_PAUSE_ASYM 0x0800 +#endif + +/* There are two ways to manage the TX descriptors on the tigon3. + * Either the descriptors are in host DMA'able memory, or they + * exist only in the cards on-chip SRAM. All 16 send bds are under + * the same mode, they may not be configured individually. + * + * The mode we use is controlled by TG3_FLAG_HOST_TXDS in tp->tg3_flags. + * + * To use host memory TX descriptors: + * 1) Set GRC_MODE_HOST_SENDBDS in GRC_MODE register. + * Make sure GRC_MODE_4X_NIC_SEND_RINGS is clear. + * 2) Allocate DMA'able memory. + * 3) In NIC_SRAM_SEND_RCB (of desired index) of on-chip SRAM: + * a) Set TG3_BDINFO_HOST_ADDR to DMA address of memory + * obtained in step 2 + * b) Set TG3_BDINFO_NIC_ADDR to NIC_SRAM_TX_BUFFER_DESC. + * c) Set len field of TG3_BDINFO_MAXLEN_FLAGS to number + * of TX descriptors. Leave flags field clear. + * 4) Access TX descriptors via host memory. The chip + * will refetch into local SRAM as needed when producer + * index mailboxes are updated. + * + * To use on-chip TX descriptors: + * 1) Set GRC_MODE_4X_NIC_SEND_RINGS in GRC_MODE register. + * Make sure GRC_MODE_HOST_SENDBDS is clear. + * 2) In NIC_SRAM_SEND_RCB (of desired index) of on-chip SRAM: + * a) Set TG3_BDINFO_HOST_ADDR to zero. + * b) Set TG3_BDINFO_NIC_ADDR to NIC_SRAM_TX_BUFFER_DESC + * c) TG3_BDINFO_MAXLEN_FLAGS is don't care. + * 3) Access TX descriptors directly in on-chip SRAM + * using normal {read,write}l(). (and not using + * pointer dereferencing of ioremap()'d memory like + * the broken Broadcom driver does) + * + * Note that BDINFO_FLAGS_DISABLED should be set in the flags field of + * TG3_BDINFO_MAXLEN_FLAGS of all unused SEND_RCB indices. + */ +struct tg3_tx_buffer_desc { + uint32_t addr_hi; + uint32_t addr_lo; + + uint32_t len_flags; +#define TXD_FLAG_TCPUDP_CSUM 0x0001 +#define TXD_FLAG_IP_CSUM 0x0002 +#define TXD_FLAG_END 0x0004 +#define TXD_FLAG_IP_FRAG 0x0008 +#define TXD_FLAG_IP_FRAG_END 0x0010 +#define TXD_FLAG_VLAN 0x0040 +#define TXD_FLAG_COAL_NOW 0x0080 +#define TXD_FLAG_CPU_PRE_DMA 0x0100 +#define TXD_FLAG_CPU_POST_DMA 0x0200 +#define TXD_FLAG_ADD_SRC_ADDR 0x1000 +#define TXD_FLAG_CHOOSE_SRC_ADDR 0x6000 +#define TXD_FLAG_NO_CRC 0x8000 +#define TXD_LEN_SHIFT 16 + + uint32_t vlan_tag; +#define TXD_VLAN_TAG_SHIFT 0 +#define TXD_MSS_SHIFT 16 +}; + +#define TXD_ADDR 0x00UL /* 64-bit */ +#define TXD_LEN_FLAGS 0x08UL /* 32-bit (upper 16-bits are len) */ +#define TXD_VLAN_TAG 0x0cUL /* 32-bit (upper 16-bits are tag) */ +#define TXD_SIZE 0x10UL + +struct tg3_rx_buffer_desc { + uint32_t addr_hi; + uint32_t addr_lo; + + uint32_t idx_len; +#define RXD_IDX_MASK 0xffff0000 +#define RXD_IDX_SHIFT 16 +#define RXD_LEN_MASK 0x0000ffff +#define RXD_LEN_SHIFT 0 + + uint32_t type_flags; +#define RXD_TYPE_SHIFT 16 +#define RXD_FLAGS_SHIFT 0 + +#define RXD_FLAG_END 0x0004 +#define RXD_FLAG_MINI 0x0800 +#define RXD_FLAG_JUMBO 0x0020 +#define RXD_FLAG_VLAN 0x0040 +#define RXD_FLAG_ERROR 0x0400 +#define RXD_FLAG_IP_CSUM 0x1000 +#define RXD_FLAG_TCPUDP_CSUM 0x2000 +#define RXD_FLAG_IS_TCP 0x4000 + + uint32_t ip_tcp_csum; +#define RXD_IPCSUM_MASK 0xffff0000 +#define RXD_IPCSUM_SHIFT 16 +#define RXD_TCPCSUM_MASK 0x0000ffff +#define RXD_TCPCSUM_SHIFT 0 + + uint32_t err_vlan; + +#define RXD_VLAN_MASK 0x0000ffff + +#define RXD_ERR_BAD_CRC 0x00010000 +#define RXD_ERR_COLLISION 0x00020000 +#define RXD_ERR_LINK_LOST 0x00040000 +#define RXD_ERR_PHY_DECODE 0x00080000 +#define RXD_ERR_ODD_NIBBLE_RCVD_MII 0x00100000 +#define RXD_ERR_MAC_ABRT 0x00200000 +#define RXD_ERR_TOO_SMALL 0x00400000 +#define RXD_ERR_NO_RESOURCES 0x00800000 +#define RXD_ERR_HUGE_FRAME 0x01000000 +#define RXD_ERR_MASK 0xffff0000 + + uint32_t reserved; + uint32_t opaque; +#define RXD_OPAQUE_INDEX_MASK 0x0000ffff +#define RXD_OPAQUE_INDEX_SHIFT 0 +#define RXD_OPAQUE_RING_STD 0x00010000 +#define RXD_OPAQUE_RING_JUMBO 0x00020000 +#define RXD_OPAQUE_RING_MINI 0x00040000 +#define RXD_OPAQUE_RING_MASK 0x00070000 +}; + +struct tg3_ext_rx_buffer_desc { + struct { + uint32_t addr_hi; + uint32_t addr_lo; + } addrlist[3]; + uint32_t len2_len1; + uint32_t resv_len3; + struct tg3_rx_buffer_desc std; +}; + +/* We only use this when testing out the DMA engine + * at probe time. This is the internal format of buffer + * descriptors used by the chip at NIC_SRAM_DMA_DESCS. + */ +struct tg3_internal_buffer_desc { + uint32_t addr_hi; + uint32_t addr_lo; + uint32_t nic_mbuf; + /* XXX FIX THIS */ +#if __BYTE_ORDER == __BIG_ENDIAN + uint16_t cqid_sqid; + uint16_t len; +#else + uint16_t len; + uint16_t cqid_sqid; +#endif + uint32_t flags; + uint32_t __cookie1; + uint32_t __cookie2; + uint32_t __cookie3; +}; + +#define TG3_HW_STATUS_SIZE 0x50 +struct tg3_hw_status { + uint32_t status; +#define SD_STATUS_UPDATED 0x00000001 +#define SD_STATUS_LINK_CHG 0x00000002 +#define SD_STATUS_ERROR 0x00000004 + + uint32_t status_tag; + +#if __BYTE_ORDER == __BIG_ENDIAN + uint16_t rx_consumer; + uint16_t rx_jumbo_consumer; +#else + uint16_t rx_jumbo_consumer; + uint16_t rx_consumer; +#endif + +#if __BYTE_ORDER == __BIG_ENDIAN + uint16_t reserved; + uint16_t rx_mini_consumer; +#else + uint16_t rx_mini_consumer; + uint16_t reserved; +#endif + struct { +#if __BYTE_ORDER == __BIG_ENDIAN + uint16_t tx_consumer; + uint16_t rx_producer; +#else + uint16_t rx_producer; + uint16_t tx_consumer; +#endif + } idx[16]; +}; + +typedef struct { + uint32_t high, low; +} tg3_stat64_t; + +struct tg3_hw_stats { + uint8_t __reserved0[0x400-0x300]; + + /* Statistics maintained by Receive MAC. */ + tg3_stat64_t rx_octets; + uint64_t __reserved1; + tg3_stat64_t rx_fragments; + tg3_stat64_t rx_ucast_packets; + tg3_stat64_t rx_mcast_packets; + tg3_stat64_t rx_bcast_packets; + tg3_stat64_t rx_fcs_errors; + tg3_stat64_t rx_align_errors; + tg3_stat64_t rx_xon_pause_rcvd; + tg3_stat64_t rx_xoff_pause_rcvd; + tg3_stat64_t rx_mac_ctrl_rcvd; + tg3_stat64_t rx_xoff_entered; + tg3_stat64_t rx_frame_too_long_errors; + tg3_stat64_t rx_jabbers; + tg3_stat64_t rx_undersize_packets; + tg3_stat64_t rx_in_length_errors; + tg3_stat64_t rx_out_length_errors; + tg3_stat64_t rx_64_or_less_octet_packets; + tg3_stat64_t rx_65_to_127_octet_packets; + tg3_stat64_t rx_128_to_255_octet_packets; + tg3_stat64_t rx_256_to_511_octet_packets; + tg3_stat64_t rx_512_to_1023_octet_packets; + tg3_stat64_t rx_1024_to_1522_octet_packets; + tg3_stat64_t rx_1523_to_2047_octet_packets; + tg3_stat64_t rx_2048_to_4095_octet_packets; + tg3_stat64_t rx_4096_to_8191_octet_packets; + tg3_stat64_t rx_8192_to_9022_octet_packets; + + uint64_t __unused0[37]; + + /* Statistics maintained by Transmit MAC. */ + tg3_stat64_t tx_octets; + uint64_t __reserved2; + tg3_stat64_t tx_collisions; + tg3_stat64_t tx_xon_sent; + tg3_stat64_t tx_xoff_sent; + tg3_stat64_t tx_flow_control; + tg3_stat64_t tx_mac_errors; + tg3_stat64_t tx_single_collisions; + tg3_stat64_t tx_mult_collisions; + tg3_stat64_t tx_deferred; + uint64_t __reserved3; + tg3_stat64_t tx_excessive_collisions; + tg3_stat64_t tx_late_collisions; + tg3_stat64_t tx_collide_2times; + tg3_stat64_t tx_collide_3times; + tg3_stat64_t tx_collide_4times; + tg3_stat64_t tx_collide_5times; + tg3_stat64_t tx_collide_6times; + tg3_stat64_t tx_collide_7times; + tg3_stat64_t tx_collide_8times; + tg3_stat64_t tx_collide_9times; + tg3_stat64_t tx_collide_10times; + tg3_stat64_t tx_collide_11times; + tg3_stat64_t tx_collide_12times; + tg3_stat64_t tx_collide_13times; + tg3_stat64_t tx_collide_14times; + tg3_stat64_t tx_collide_15times; + tg3_stat64_t tx_ucast_packets; + tg3_stat64_t tx_mcast_packets; + tg3_stat64_t tx_bcast_packets; + tg3_stat64_t tx_carrier_sense_errors; + tg3_stat64_t tx_discards; + tg3_stat64_t tx_errors; + + uint64_t __unused1[31]; + + /* Statistics maintained by Receive List Placement. */ + tg3_stat64_t COS_rx_packets[16]; + tg3_stat64_t COS_rx_filter_dropped; + tg3_stat64_t dma_writeq_full; + tg3_stat64_t dma_write_prioq_full; + tg3_stat64_t rxbds_empty; + tg3_stat64_t rx_discards; + tg3_stat64_t rx_errors; + tg3_stat64_t rx_threshold_hit; + + uint64_t __unused2[9]; + + /* Statistics maintained by Send Data Initiator. */ + tg3_stat64_t COS_out_packets[16]; + tg3_stat64_t dma_readq_full; + tg3_stat64_t dma_read_prioq_full; + tg3_stat64_t tx_comp_queue_full; + + /* Statistics maintained by Host Coalescing. */ + tg3_stat64_t ring_set_send_prod_index; + tg3_stat64_t ring_status_update; + tg3_stat64_t nic_irqs; + tg3_stat64_t nic_avoided_irqs; + tg3_stat64_t nic_tx_threshold_hit; + + uint8_t __reserved4[0xb00-0x9c0]; +}; + +enum phy_led_mode { + led_mode_auto, + led_mode_three_link, + led_mode_link10 +}; + +#if 0 +/* 'mapping' is superfluous as the chip does not write into + * the tx/rx post rings so we could just fetch it from there. + * But the cache behavior is better how we are doing it now. + */ +struct ring_info { + struct sk_buff *skb; + DECLARE_PCI_UNMAP_ADDR(mapping) +}; + +struct tx_ring_info { + struct sk_buff *skb; + DECLARE_PCI_UNMAP_ADDR(mapping) + uint32_t prev_vlan_tag; +}; +#endif + +struct tg3_config_info { + uint32_t flags; +}; + +struct tg3_link_config { + /* Describes what we're trying to get. */ + uint32_t advertising; +#if 0 + uint16_t speed; + uint8_t duplex; + uint8_t autoneg; +#define SPEED_INVALID 0xffff +#define DUPLEX_INVALID 0xff +#define AUTONEG_INVALID 0xff +#endif + + /* Describes what we actually have. */ + uint8_t active_speed; + uint8_t active_duplex; + + /* When we go in and out of low power mode we need + * to swap with this state. + */ +#if 0 + int phy_is_low_power; + uint16_t orig_speed; + uint8_t orig_duplex; + uint8_t orig_autoneg; +#endif +}; + +struct tg3_bufmgr_config { + uint32_t mbuf_read_dma_low_water; + uint32_t mbuf_mac_rx_low_water; + uint32_t mbuf_high_water; + + uint32_t mbuf_read_dma_low_water_jumbo; + uint32_t mbuf_mac_rx_low_water_jumbo; + uint32_t mbuf_high_water_jumbo; + + uint32_t dma_low_water; + uint32_t dma_high_water; +}; + +struct tg3 { +#if 0 + /* SMP locking strategy: + * + * lock: Held during all operations except TX packet + * processing. + * + * tx_lock: Held during tg3_start_xmit{,_4gbug} and tg3_tx + * + * If you want to shut up all asynchronous processing you must + * acquire both locks, 'lock' taken before 'tx_lock'. IRQs must + * be disabled to take 'lock' but only softirq disabling is + * necessary for acquisition of 'tx_lock'. + */ + spinlock_t lock; + spinlock_t tx_lock; +#endif + + uint32_t tx_prod; +#if 0 + uint32_t tx_cons; +#endif + uint32_t rx_rcb_ptr; + uint32_t rx_std_ptr; +#if 0 + uint32_t rx_jumbo_ptr; + spinlock_t indirect_lock; + + struct net_device_stats net_stats; + struct net_device_stats net_stats_prev; +#endif + unsigned long phy_crc_errors; + +#if 0 + uint32_t rx_offset; +#endif + uint32_t tg3_flags; +#if 0 +#define TG3_FLAG_HOST_TXDS 0x00000001 +#endif +#define TG3_FLAG_TXD_MBOX_HWBUG 0x00000002 +#define TG3_FLAG_RX_CHECKSUMS 0x00000004 +#define TG3_FLAG_USE_LINKCHG_REG 0x00000008 +#define TG3_FLAG_USE_MI_INTERRUPT 0x00000010 +#define TG3_FLAG_ENABLE_ASF 0x00000020 +#define TG3_FLAG_5701_REG_WRITE_BUG 0x00000040 +#define TG3_FLAG_POLL_SERDES 0x00000080 +#define TG3_FLAG_MBOX_WRITE_REORDER 0x00000100 +#define TG3_FLAG_PCIX_TARGET_HWBUG 0x00000200 +#define TG3_FLAG_WOL_SPEED_100MB 0x00000400 +#define TG3_FLAG_WOL_ENABLE 0x00000800 +#define TG3_FLAG_EEPROM_WRITE_PROT 0x00001000 +#define TG3_FLAG_NVRAM 0x00002000 +#define TG3_FLAG_NVRAM_BUFFERED 0x00004000 +#define TG3_FLAG_RX_PAUSE 0x00008000 +#define TG3_FLAG_TX_PAUSE 0x00010000 +#define TG3_FLAG_PCIX_MODE 0x00020000 +#define TG3_FLAG_PCI_HIGH_SPEED 0x00040000 +#define TG3_FLAG_PCI_32BIT 0x00080000 +#define TG3_FLAG_NO_TX_PSEUDO_CSUM 0x00100000 +#define TG3_FLAG_NO_RX_PSEUDO_CSUM 0x00200000 +#define TG3_FLAG_SERDES_WOL_CAP 0x00400000 +#define TG3_FLAG_JUMBO_ENABLE 0x00800000 +#define TG3_FLAG_10_100_ONLY 0x01000000 +#define TG3_FLAG_PAUSE_AUTONEG 0x02000000 +#define TG3_FLAG_PAUSE_RX 0x04000000 +#define TG3_FLAG_PAUSE_TX 0x08000000 +#define TG3_FLAG_BROKEN_CHECKSUMS 0x10000000 +#define TG3_FLAG_GOT_SERDES_FLOWCTL 0x20000000 +#define TG3_FLAG_SPLIT_MODE 0x40000000 +#define TG3_FLAG_INIT_COMPLETE 0x80000000 + + uint32_t tg3_flags2; +#define TG3_FLG2_RESTART_TIMER 0x00000001 +#define TG3_FLG2_SUN_5704 0x00000002 +#define TG3_FLG2_NO_ETH_WIRE_SPEED 0x00000004 +#define TG3_FLG2_IS_5788 0x00000008 +#define TG3_FLG2_MAX_RXPEND_64 0x00000010 +#define TG3_FLG2_TSO_CAPABLE 0x00000020 + + + + uint32_t split_mode_max_reqs; +#define SPLIT_MODE_5704_MAX_REQ 3 + +#if 0 + struct timer_list timer; + uint16_t timer_counter; + uint16_t timer_multiplier; + uint32_t timer_offset; + uint16_t asf_counter; + uint16_t asf_multiplier; +#endif + + struct tg3_link_config link_config; + struct tg3_bufmgr_config bufmgr_config; + +#if 0 + uint32_t rx_pending; + uint32_t rx_jumbo_pending; + uint32_t tx_pending; +#endif + + /* cache h/w values, often passed straight to h/w */ + uint32_t rx_mode; + uint32_t tx_mode; + uint32_t mac_mode; + uint32_t mi_mode; + uint32_t misc_host_ctrl; + uint32_t grc_mode; + uint32_t grc_local_ctrl; + uint32_t dma_rwctrl; +#if 0 + uint32_t coalesce_mode; +#endif + + /* PCI block */ + uint16_t pci_chip_rev_id; +#if 0 + uint8_t pci_cacheline_sz; + uint8_t pci_lat_timer; + uint8_t pci_hdr_type; + uint8_t pci_bist; +#endif + uint32_t pci_cfg_state[64 / sizeof(uint32_t)]; + + int pm_cap; + + /* PHY info */ + uint32_t phy_id; +#define PHY_ID_MASK 0xfffffff0 +#define PHY_ID_BCM5400 0x60008040 +#define PHY_ID_BCM5401 0x60008050 +#define PHY_ID_BCM5411 0x60008070 +#define PHY_ID_BCM5701 0x60008110 +#define PHY_ID_BCM5703 0x60008160 +#define PHY_ID_BCM5704 0x60008190 +#define PHY_ID_BCM5705 0x600081a0 +#define PHY_ID_BCM8002 0x60010140 +#define PHY_ID_SERDES 0xfeedbee0 +#define PHY_ID_INVALID 0xffffffff +#define PHY_ID_REV_MASK 0x0000000f +#define PHY_REV_BCM5401_B0 0x1 +#define PHY_REV_BCM5401_B2 0x3 +#define PHY_REV_BCM5401_C0 0x6 +#define PHY_REV_BCM5411_X0 0x1 /* Found on Netgear GA302T */ + + enum phy_led_mode led_mode; + + char board_part_number[24]; + uint32_t nic_sram_data_cfg; + uint32_t pci_clock_ctrl; +#if 0 + struct pci_device *pdev_peer; +#endif + + /* This macro assumes the passed PHY ID is already masked + * with PHY_ID_MASK. + */ +#define KNOWN_PHY_ID(X) \ + ((X) == PHY_ID_BCM5400 || (X) == PHY_ID_BCM5401 || \ + (X) == PHY_ID_BCM5411 || (X) == PHY_ID_BCM5701 || \ + (X) == PHY_ID_BCM5703 || (X) == PHY_ID_BCM5704 || \ + (X) == PHY_ID_BCM5705 || \ + (X) == PHY_ID_BCM8002 || (X) == PHY_ID_SERDES) + + unsigned long regs; + struct pci_device *pdev; + struct nic *nic; +#if 0 + struct net_device *dev; +#endif +#if TG3_VLAN_TAG_USED + struct vlan_group *vlgrp; +#endif + + struct tg3_rx_buffer_desc *rx_std; +#if 0 + struct ring_info *rx_std_buffers; + dma_addr_t rx_std_mapping; + struct tg3_rx_buffer_desc *rx_jumbo; + struct ring_info *rx_jumbo_buffers; + dma_addr_t rx_jumbo_mapping; +#endif + + struct tg3_rx_buffer_desc *rx_rcb; +#if 0 + dma_addr_t rx_rcb_mapping; +#endif + + /* TX descs are only used if TG3_FLAG_HOST_TXDS is set. */ + struct tg3_tx_buffer_desc *tx_ring; +#if 0 + struct tx_ring_info *tx_buffers; + dma_addr_t tx_desc_mapping; +#endif + + struct tg3_hw_status *hw_status; +#if 0 + dma_addr_t status_mapping; +#endif +#if 0 + uint32_t msg_enable; +#endif + + struct tg3_hw_stats *hw_stats; +#if 0 + dma_addr_t stats_mapping; +#endif + + int carrier_ok; + uint16_t subsystem_vendor; + uint16_t subsystem_device; +}; + +#endif /* !(_T3_H) */ diff --git a/usr/src/grub/grub-0.97/netboot/timer.c b/usr/src/grub/grub-0.97/netboot/timer.c new file mode 100644 index 0000000000..e4f62421e5 --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/timer.c @@ -0,0 +1,29 @@ +/* A couple of routines to implement a low-overhead timer for drivers */ + + /* + * 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. + */ +#include "grub.h" +#include "timer.h" + +/* Machine Independant timer helper functions */ + +void mdelay(unsigned int msecs) +{ + unsigned int i; + for(i = 0; i < msecs; i++) { + udelay(1000); + poll_interruptions(); + } +} + +void waiton_timer2(unsigned int ticks) +{ + load_timer2(ticks); + while(timer2_running()) { + poll_interruptions(); + } +} diff --git a/usr/src/grub/grub-0.97/netboot/timer.h b/usr/src/grub/grub-0.97/netboot/timer.h new file mode 100644 index 0000000000..e9ab9ddcd8 --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/timer.h @@ -0,0 +1,68 @@ +/* Defines for routines to implement a low-overhead timer for drivers */ + + /* + * 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. + */ + +#ifndef TIMER_H +#define TIMER_H + +/* Ports for the 8254 timer chip */ +#define TIMER2_PORT 0x42 +#define TIMER_MODE_PORT 0x43 + +/* Meaning of the mode bits */ +#define TIMER0_SEL 0x00 +#define TIMER1_SEL 0x40 +#define TIMER2_SEL 0x80 +#define READBACK_SEL 0xC0 + +#define LATCH_COUNT 0x00 +#define LOBYTE_ACCESS 0x10 +#define HIBYTE_ACCESS 0x20 +#define WORD_ACCESS 0x30 + +#define MODE0 0x00 +#define MODE1 0x02 +#define MODE2 0x04 +#define MODE3 0x06 +#define MODE4 0x08 +#define MODE5 0x0A + +#define BINARY_COUNT 0x00 +#define BCD_COUNT 0x01 + +/* Timers tick over at this rate */ +#define CLOCK_TICK_RATE 1193180U +#define TICKS_PER_MS (CLOCK_TICK_RATE/1000) + +/* Parallel Peripheral Controller Port B */ +#define PPC_PORTB 0x61 + +/* Meaning of the port bits */ +#define PPCB_T2OUT 0x20 /* Bit 5 */ +#define PPCB_SPKR 0x02 /* Bit 1 */ +#define PPCB_T2GATE 0x01 /* Bit 0 */ + +/* Ticks must be between 0 and 65535 (0 == 65536) + because it is a 16 bit counter */ +extern void load_timer2(unsigned int ticks); +extern inline int timer2_running(void); +extern void waiton_timer2(unsigned int ticks); +extern void __load_timer2(unsigned int ticks); + +extern void setup_timers(void); +extern void ndelay(unsigned int nsecs); +extern void udelay(unsigned int usecs); +extern void mdelay(unsigned int msecs); +//extern unsigned long currticks(void); + +struct timeval { + long tv_sec; + long tv_usec; +}; + +#endif /* TIMER_H */ diff --git a/usr/src/grub/grub-0.97/netboot/tlan.c b/usr/src/grub/grub-0.97/netboot/tlan.c new file mode 100644 index 0000000000..df52c98d2a --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/tlan.c @@ -0,0 +1,1814 @@ +#define EB51 + +#ifdef EB50 +#define __unused __attribute__((unused)) +#endif + +/************************************************************************** +* +* tlan.c -- Etherboot device driver for the Texas Instruments ThunderLAN +* Written 2003-2003 by Timothy Legge +* +* 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. +* +* Portions of this code based on: +* lan.c: Linux ThunderLan Driver: +* +* by James Banks +* +* (C) 1997-1998 Caldera, Inc. +* (C) 1998 James Banks +* (C) 1999-2001 Torben Mathiasen +* (C) 2002 Samuel Chessman +* +* REVISION HISTORY: +* ================ +* v1.0 07-08-2003 timlegge Initial not quite working version +* v1.1 07-27-2003 timlegge Sync 5.0 and 5.1 versions +* v1.2 08-19-2003 timlegge Implement Multicast Support +* v1.3 08-23-2003 timlegge Fix the transmit Function +* v1.4 01-17-2004 timlegge Initial driver output cleanup +* +* Indent Options: indent -kr -i8 +***************************************************************************/ + +/* to get some global routines like printf */ +#include "etherboot.h" +/* to get the interface to the body of the program */ +#include "nic.h" +/* to get the PCI support functions, if this is a PCI NIC */ +#include "pci.h" +#include "timer.h" +#include "tlan.h" + +#define drv_version "v1.4" +#define drv_date "01-17-2004" + +/* NIC specific static variables go here */ +#define HZ 100 +#define TX_TIME_OUT (6*HZ) + +#ifdef EB50 +#define cpu_to_le32(val) (val) +#define le32_to_cpu(val) (val) +#define virt_to_bus(x) ((unsigned long) x) +#define bus_to_virt(x) ((unsigned long) x) +#endif + +/* Condensed operations for readability. */ +#define virt_to_le32desc(addr) cpu_to_le32(virt_to_bus(addr)) +#define le32desc_to_virt(addr) bus_to_virt(le32_to_cpu(addr)) + + +static void TLan_ResetLists(struct nic *nic __unused); +static void TLan_ResetAdapter(struct nic *nic __unused); +static void TLan_FinishReset(struct nic *nic __unused); + +static void TLan_EeSendStart(u16); +static int TLan_EeSendByte(u16, u8, int); +static void TLan_EeReceiveByte(u16, u8 *, int); +static int TLan_EeReadByte(u16 io_base, u8, u8 *); + +static void TLan_PhyDetect(struct nic *nic); +static void TLan_PhyPowerDown(struct nic *nic); +static void TLan_PhyPowerUp(struct nic *nic); + + +static void TLan_SetMac(struct nic *nic __unused, int areg, char *mac); + +static void TLan_PhyReset(struct nic *nic); +static void TLan_PhyStartLink(struct nic *nic); +static void TLan_PhyFinishAutoNeg(struct nic *nic); + +#ifdef MONITOR +static void TLan_PhyMonitor(struct nic *nic); +#endif + + +static void refill_rx(struct nic *nic __unused); + +static int TLan_MiiReadReg(struct nic *nic __unused, u16, u16, u16 *); +static void TLan_MiiSendData(u16, u32, unsigned); +static void TLan_MiiSync(u16); +static void TLan_MiiWriteReg(struct nic *nic __unused, u16, u16, u16); + + +const char *media[] = { + "10BaseT-HD ", "10BaseT-FD ", "100baseTx-HD ", + "100baseTx-FD", "100baseT4", 0 +}; + +/* This much match tlan_pci_tbl[]! */ +enum tlan_nics { + NETEL10 = 0, NETEL100 = 1, NETFLEX3I = 2, THUNDER = 3, NETFLEX3B = + 4, NETEL100PI = 5, + NETEL100D = 6, NETEL100I = 7, OC2183 = 8, OC2325 = 9, OC2326 = + 10, NETELLIGENT_10_100_WS_5100 = 11, + NETELLIGENT_10_T2 = 12 +}; + +struct pci_id_info { + const char *name; + int nic_id; + struct match_info { + u32 pci, pci_mask, subsystem, subsystem_mask; + u32 revision, revision_mask; /* Only 8 bits. */ + } id; + u32 flags; + u16 addrOfs; /* Address Offset */ +}; + +static struct pci_id_info tlan_pci_tbl[] = { + {"Compaq Netelligent 10 T PCI UTP", NETEL10, + {0xae340e11, 0xffffffff, 0, 0, 0, 0}, + TLAN_ADAPTER_ACTIVITY_LED, 0x83}, + {"Compaq Netelligent 10/100 TX PCI UTP", NETEL100, + {0xae320e11, 0xffffffff, 0, 0, 0, 0}, + TLAN_ADAPTER_ACTIVITY_LED, 0x83}, + {"Compaq Integrated NetFlex-3/P", NETFLEX3I, + {0xae350e11, 0xffffffff, 0, 0, 0, 0}, + TLAN_ADAPTER_NONE, 0x83}, + {"Compaq NetFlex-3/P", THUNDER, + {0xf1300e11, 0xffffffff, 0, 0, 0, 0}, + TLAN_ADAPTER_UNMANAGED_PHY | TLAN_ADAPTER_BIT_RATE_PHY, 0x83}, + {"Compaq NetFlex-3/P", NETFLEX3B, + {0xf1500e11, 0xffffffff, 0, 0, 0, 0}, + TLAN_ADAPTER_NONE, 0x83}, + {"Compaq Netelligent Integrated 10/100 TX UTP", NETEL100PI, + {0xae430e11, 0xffffffff, 0, 0, 0, 0}, + TLAN_ADAPTER_ACTIVITY_LED, 0x83}, + {"Compaq Netelligent Dual 10/100 TX PCI UTP", NETEL100D, + {0xae400e11, 0xffffffff, 0, 0, 0, 0}, + TLAN_ADAPTER_NONE, 0x83}, + {"Compaq Netelligent 10/100 TX Embedded UTP", NETEL100I, + {0xb0110e11, 0xffffffff, 0, 0, 0, 0}, + TLAN_ADAPTER_NONE, 0x83}, + {"Olicom OC-2183/2185", OC2183, + {0x0013108d, 0xffffffff, 0, 0, 0, 0}, + TLAN_ADAPTER_USE_INTERN_10, 0x83}, + {"Olicom OC-2325", OC2325, + {0x0012108d, 0xffffffff, 0, 0, 0, 0}, + TLAN_ADAPTER_UNMANAGED_PHY, 0xF8}, + {"Olicom OC-2326", OC2326, + {0x0014108d, 0xffffffff, 0, 0, 0, 0}, + TLAN_ADAPTER_USE_INTERN_10, 0xF8}, + {"Compaq Netelligent 10/100 TX UTP", NETELLIGENT_10_100_WS_5100, + {0xb0300e11, 0xffffffff, 0, 0, 0, 0}, + TLAN_ADAPTER_ACTIVITY_LED, 0x83}, + {"Compaq Netelligent 10 T/2 PCI UTP/Coax", NETELLIGENT_10_T2, + {0xb0120e11, 0xffffffff, 0, 0, 0, 0}, + TLAN_ADAPTER_NONE, 0x83}, + {"Compaq NetFlex-3/E", 0, /* EISA card */ + {0, 0, 0, 0, 0, 0}, + TLAN_ADAPTER_ACTIVITY_LED | TLAN_ADAPTER_UNMANAGED_PHY | + TLAN_ADAPTER_BIT_RATE_PHY, 0x83}, + {"Compaq NetFlex-3/E", 0, /* EISA card */ + {0, 0, 0, 0, 0, 0}, + TLAN_ADAPTER_ACTIVITY_LED, 0x83}, + {0, 0, + {0, 0, 0, 0, 0, 0}, + 0, 0}, +}; + + +struct TLanList { + u32 forward; + u16 cStat; + u16 frameSize; + struct { + u32 count; + u32 address; + } buffer[TLAN_BUFFERS_PER_LIST]; +}; + + + +struct TLanList tx_ring[TLAN_NUM_TX_LISTS]; +static unsigned char txb[TLAN_MAX_FRAME_SIZE * TLAN_NUM_TX_LISTS]; + +struct TLanList rx_ring[TLAN_NUM_RX_LISTS]; +static unsigned char rxb[TLAN_MAX_FRAME_SIZE * TLAN_NUM_RX_LISTS]; + +typedef u8 TLanBuffer[TLAN_MAX_FRAME_SIZE]; + + +int chip_idx; + + +/***************************************************************** +* TLAN Private Information Structure +* +****************************************************************/ +struct tlan_private { + unsigned short vendor_id; /* PCI Vendor code */ + unsigned short dev_id; /* PCI Device code */ + const char *nic_name; + u8 *padBuffer; + u8 *rxBuffer; + struct TLanList *rx_head_desc; + u32 rxHead; + u32 rxTail; + u32 rxEocCount; + unsigned int cur_rx, dirty_rx; /* Producer/consumer ring indicies */ + unsigned int cur_tx, dirty_tx; + unsigned rx_buf_sz; /* Based on mtu + Slack */ + struct TLanList *txList; + struct TLanList *rxList; + u8 *txBuffer; + u32 txHead; + u32 txInProgress; + u32 txTail; + int eoc; + u32 txBusyCount; + u32 phyOnline; + u32 timerSetAt; + u32 timerType; + u32 adapterRev; + u32 aui; + u32 debug; + u32 duplex; + u32 phy[2]; + u32 phyNum; + u32 speed; + u8 tlanRev; + u8 tlanFullDuplex; + char devName[8]; + u8 link; + u8 is_eisa; + u8 neg_be_verbose; +} TLanPrivateInfo; + +static struct tlan_private *priv; + +u32 BASE; + + + +/*************************************************************** +* TLan_ResetLists +* +* Returns: +* Nothing +* Parms: +* dev The device structure with the list +* stuctures to be reset. +* +* This routine sets the variables associated with managing +* the TLAN lists to their initial values. +* +**************************************************************/ + +void TLan_ResetLists(struct nic *nic __unused) +{ + + int i; + struct TLanList *list; + priv->txHead = 0; + priv->txTail = 0; + + for (i = 0; i < TLAN_NUM_TX_LISTS; i++) { + list = &tx_ring[i]; + list->cStat = TLAN_CSTAT_UNUSED; +/* list->buffer[0].address = 0; */ + list->buffer[0].address = virt_to_bus(txb + + (i * TLAN_MAX_FRAME_SIZE)); + list->buffer[2].count = 0; + list->buffer[2].address = 0; + list->buffer[9].address = 0; +/* list->forward = 0; */ + } + + priv->cur_rx = 0; + priv->rx_buf_sz = (TLAN_MAX_FRAME_SIZE); + priv->rx_head_desc = &rx_ring[0]; + + /* Initialize all the Rx descriptors */ + for (i = 0; i < TLAN_NUM_RX_LISTS; i++) { + rx_ring[i].forward = virt_to_le32desc(&rx_ring[i + 1]); + rx_ring[i].cStat = TLAN_CSTAT_READY; + rx_ring[i].frameSize = TLAN_MAX_FRAME_SIZE; + rx_ring[i].buffer[0].count = + TLAN_MAX_FRAME_SIZE | TLAN_LAST_BUFFER; + rx_ring[i].buffer[0].address = + virt_to_le32desc(&rxb[i * TLAN_MAX_FRAME_SIZE]); + rx_ring[i].buffer[1].count = 0; + rx_ring[i].buffer[1].address = 0; + } + + /* Mark the last entry as wrapping the ring */ + rx_ring[i - 1].forward = virt_to_le32desc(&rx_ring[0]); + priv->dirty_rx = (unsigned int) (i - TLAN_NUM_RX_LISTS); + +} /* TLan_ResetLists */ + +/*************************************************************** +* TLan_Reset +* +* Returns: +* 0 +* Parms: +* dev Pointer to device structure of adapter +* to be reset. +* +* This function resets the adapter and it's physical +* device. See Chap. 3, pp. 9-10 of the "ThunderLAN +* Programmer's Guide" for details. The routine tries to +* implement what is detailed there, though adjustments +* have been made. +* +**************************************************************/ + +void TLan_ResetAdapter(struct nic *nic __unused) +{ + int i; + u32 addr; + u32 data; + u8 data8; + + priv->tlanFullDuplex = FALSE; + priv->phyOnline = 0; +/* 1. Assert reset bit. */ + + data = inl(BASE + TLAN_HOST_CMD); + data |= TLAN_HC_AD_RST; + outl(data, BASE + TLAN_HOST_CMD); + + udelay(1000); + +/* 2. Turn off interrupts. ( Probably isn't necessary ) */ + + data = inl(BASE + TLAN_HOST_CMD); + data |= TLAN_HC_INT_OFF; + outl(data, BASE + TLAN_HOST_CMD); +/* 3. Clear AREGs and HASHs. */ + + for (i = TLAN_AREG_0; i <= TLAN_HASH_2; i += 4) { + TLan_DioWrite32(BASE, (u16) i, 0); + } + +/* 4. Setup NetConfig register. */ + + data = + TLAN_NET_CFG_1FRAG | TLAN_NET_CFG_1CHAN | TLAN_NET_CFG_PHY_EN; + TLan_DioWrite16(BASE, TLAN_NET_CONFIG, (u16) data); + +/* 5. Load Ld_Tmr and Ld_Thr in HOST_CMD. */ + + outl(TLAN_HC_LD_TMR | 0x3f, BASE + TLAN_HOST_CMD); + outl(TLAN_HC_LD_THR | 0x0, BASE + TLAN_HOST_CMD); + +/* 6. Unreset the MII by setting NMRST (in NetSio) to 1. */ + + outw(TLAN_NET_SIO, BASE + TLAN_DIO_ADR); + addr = BASE + TLAN_DIO_DATA + TLAN_NET_SIO; + TLan_SetBit(TLAN_NET_SIO_NMRST, addr); + +/* 7. Setup the remaining registers. */ + + if (priv->tlanRev >= 0x30) { + data8 = TLAN_ID_TX_EOC | TLAN_ID_RX_EOC; + TLan_DioWrite8(BASE, TLAN_INT_DIS, data8); + } + TLan_PhyDetect(nic); + data = TLAN_NET_CFG_1FRAG | TLAN_NET_CFG_1CHAN; + + if (tlan_pci_tbl[chip_idx].flags & TLAN_ADAPTER_BIT_RATE_PHY) { + data |= TLAN_NET_CFG_BIT; + if (priv->aui == 1) { + TLan_DioWrite8(BASE, TLAN_ACOMMIT, 0x0a); + } else if (priv->duplex == TLAN_DUPLEX_FULL) { + TLan_DioWrite8(BASE, TLAN_ACOMMIT, 0x00); + priv->tlanFullDuplex = TRUE; + } else { + TLan_DioWrite8(BASE, TLAN_ACOMMIT, 0x08); + } + } + + if (priv->phyNum == 0) { + data |= TLAN_NET_CFG_PHY_EN; + } + TLan_DioWrite16(BASE, TLAN_NET_CONFIG, (u16) data); + + if (tlan_pci_tbl[chip_idx].flags & TLAN_ADAPTER_UNMANAGED_PHY) { + TLan_FinishReset(nic); + } else { + TLan_PhyPowerDown(nic); + } + +} /* TLan_ResetAdapter */ + +void TLan_FinishReset(struct nic *nic) +{ + + u8 data; + u32 phy; + u8 sio; + u16 status; + u16 partner; + u16 tlphy_ctl; + u16 tlphy_par; + u16 tlphy_id1, tlphy_id2; + int i; + + phy = priv->phy[priv->phyNum]; + + data = TLAN_NET_CMD_NRESET | TLAN_NET_CMD_NWRAP; + if (priv->tlanFullDuplex) { + data |= TLAN_NET_CMD_DUPLEX; + } + TLan_DioWrite8(BASE, TLAN_NET_CMD, data); + data = TLAN_NET_MASK_MASK4 | TLAN_NET_MASK_MASK5; + if (priv->phyNum == 0) { + data |= TLAN_NET_MASK_MASK7; + } + TLan_DioWrite8(BASE, TLAN_NET_MASK, data); + TLan_DioWrite16(BASE, TLAN_MAX_RX, ((1536) + 7) & ~7); + TLan_MiiReadReg(nic, phy, MII_GEN_ID_HI, &tlphy_id1); + TLan_MiiReadReg(nic, phy, MII_GEN_ID_LO, &tlphy_id2); + + if ((tlan_pci_tbl[chip_idx].flags & TLAN_ADAPTER_UNMANAGED_PHY) + || (priv->aui)) { + status = MII_GS_LINK; + printf("TLAN: %s: Link forced.\n", priv->nic_name); + } else { + TLan_MiiReadReg(nic, phy, MII_GEN_STS, &status); + udelay(1000); + TLan_MiiReadReg(nic, phy, MII_GEN_STS, &status); + if ((status & MII_GS_LINK) && /* We only support link info on Nat.Sem. PHY's */ + (tlphy_id1 == NAT_SEM_ID1) + && (tlphy_id2 == NAT_SEM_ID2)) { + TLan_MiiReadReg(nic, phy, MII_AN_LPA, &partner); + TLan_MiiReadReg(nic, phy, TLAN_TLPHY_PAR, + &tlphy_par); + + printf("TLAN: %s: Link active with ", + priv->nic_name); + if (!(tlphy_par & TLAN_PHY_AN_EN_STAT)) { + printf("forced 10%sMbps %s-Duplex\n", + tlphy_par & TLAN_PHY_SPEED_100 ? "" + : "0", + tlphy_par & TLAN_PHY_DUPLEX_FULL ? + "Full" : "Half"); + } else { + printf + ("AutoNegotiation enabled, at 10%sMbps %s-Duplex\n", + tlphy_par & TLAN_PHY_SPEED_100 ? "" : + "0", + tlphy_par & TLAN_PHY_DUPLEX_FULL ? + "Full" : "Half"); + printf("TLAN: Partner capability: "); + for (i = 5; i <= 10; i++) + if (partner & (1 << i)) + printf("%s", media[i - 5]); + printf("\n"); + } + + TLan_DioWrite8(BASE, TLAN_LED_REG, TLAN_LED_LINK); +#ifdef MONITOR + /* We have link beat..for now anyway */ + priv->link = 1; + /*Enabling link beat monitoring */ + /* TLan_SetTimer( nic, (10*HZ), TLAN_TIMER_LINK_BEAT ); */ + mdelay(10000); + TLan_PhyMonitor(nic); +#endif + } else if (status & MII_GS_LINK) { + printf("TLAN: %s: Link active\n", priv->nic_name); + TLan_DioWrite8(BASE, TLAN_LED_REG, TLAN_LED_LINK); + } + } + + if (priv->phyNum == 0) { + TLan_MiiReadReg(nic, phy, TLAN_TLPHY_CTL, &tlphy_ctl); + tlphy_ctl |= TLAN_TC_INTEN; + TLan_MiiWriteReg(nic, phy, TLAN_TLPHY_CTL, tlphy_ctl); + sio = TLan_DioRead8(BASE, TLAN_NET_SIO); + sio |= TLAN_NET_SIO_MINTEN; + TLan_DioWrite8(BASE, TLAN_NET_SIO, sio); + } + + if (status & MII_GS_LINK) { + TLan_SetMac(nic, 0, nic->node_addr); + priv->phyOnline = 1; + outb((TLAN_HC_INT_ON >> 8), BASE + TLAN_HOST_CMD + 1); +/* if ( debug >= 1 && debug != TLAN_DEBUG_PROBE ) { + outb( ( TLAN_HC_REQ_INT >> 8 ), BASE + TLAN_HOST_CMD + 1 ); + } + + */ + outl(virt_to_bus(&rx_ring), BASE + TLAN_CH_PARM); + outl(TLAN_HC_GO | TLAN_HC_RT, BASE + TLAN_HOST_CMD); + } else { + printf + ("TLAN: %s: Link inactive, will retry in 10 secs...\n", + priv->nic_name); + /* TLan_SetTimer( nic, (10*HZ), TLAN_TIMER_FINISH_RESET ); */ + mdelay(10000); + TLan_FinishReset(nic); + return; + + } + +} /* TLan_FinishReset */ + +/************************************************************************** +POLL - Wait for a frame +***************************************************************************/ +static int tlan_poll(struct nic *nic, int retrieve) +{ + /* return true if there's an ethernet packet ready to read */ + /* nic->packet should contain data on return */ + /* nic->packetlen should contain length of data */ + u32 framesize; + u32 host_cmd = 0; + u32 ack = 1; + int eoc = 0; + int entry = priv->cur_rx % TLAN_NUM_RX_LISTS; + u16 tmpCStat = le32_to_cpu(rx_ring[entry].cStat); + u16 host_int = inw(BASE + TLAN_HOST_INT); + + if ((tmpCStat & TLAN_CSTAT_FRM_CMP) && !retrieve) + return 1; + + outw(host_int, BASE + TLAN_HOST_INT); + + if (!(tmpCStat & TLAN_CSTAT_FRM_CMP)) + return 0; + + /* printf("PI-1: 0x%hX\n", host_int); */ + if (tmpCStat & TLAN_CSTAT_EOC) + eoc = 1; + + framesize = rx_ring[entry].frameSize; + + nic->packetlen = framesize; + +#ifdef EBDEBUG + printf(".%d.", framesize); +#endif + + memcpy(nic->packet, rxb + + (priv->cur_rx * TLAN_MAX_FRAME_SIZE), nic->packetlen); + + rx_ring[entry].cStat = 0; +#ifdef EBDEBUG + hex_dump(nic->packet, nic->packetlen); + printf("%d", entry); +#endif + entry = (entry + 1) % TLAN_NUM_RX_LISTS; + priv->cur_rx = entry; + if (eoc) { + if ((rx_ring[entry].cStat & TLAN_CSTAT_READY) == + TLAN_CSTAT_READY) { + ack |= TLAN_HC_GO | TLAN_HC_RT; + host_cmd = TLAN_HC_ACK | ack | 0x001C0000; + outl(host_cmd, BASE + TLAN_HOST_CMD); + } + } else { + host_cmd = TLAN_HC_ACK | ack | (0x000C0000); + outl(host_cmd, BASE + TLAN_HOST_CMD); +#ifdef EBDEBUG + printf("AC: 0x%hX\n", inw(BASE + TLAN_CH_PARM)); + host_int = inw(BASE + TLAN_HOST_INT); + printf("PI-2: 0x%hX\n", host_int); +#endif + } + refill_rx(nic); + return (1); /* initially as this is called to flush the input */ +} + +static void refill_rx(struct nic *nic __unused) +{ + int entry = 0; + + for (; + (priv->cur_rx - priv->dirty_rx + + TLAN_NUM_RX_LISTS) % TLAN_NUM_RX_LISTS > 0; + priv->dirty_rx = (priv->dirty_rx + 1) % TLAN_NUM_RX_LISTS) { + entry = priv->dirty_rx % TLAN_NUM_TX_LISTS; + rx_ring[entry].frameSize = TLAN_MAX_FRAME_SIZE; + rx_ring[entry].cStat = TLAN_CSTAT_READY; + } + +} + +/* #define EBDEBUG */ +/************************************************************************** +TRANSMIT - Transmit a frame +***************************************************************************/ +static void tlan_transmit(struct nic *nic, const char *d, /* Destination */ + unsigned int t, /* Type */ + unsigned int s, /* size */ + const char *p) +{ /* Packet */ + u16 nstype; + u32 to; + struct TLanList *tail_list; + struct TLanList *head_list; + u8 *tail_buffer; + u32 ack = 0; + u32 host_cmd; + int eoc = 0; + u16 tmpCStat; +#ifdef EBDEBUG + u16 host_int = inw(BASE + TLAN_HOST_INT); +#endif + int entry = 0; + +#ifdef EBDEBUG + printf("INT0-0x%hX\n", host_int); +#endif + + if (!priv->phyOnline) { + printf("TRANSMIT: %s PHY is not ready\n", priv->nic_name); + return; + } + + tail_list = priv->txList + priv->txTail; + + if (tail_list->cStat != TLAN_CSTAT_UNUSED) { + printf("TRANSMIT: %s is busy (Head=%d Tail=%d)\n", + priv->nic_name, priv->txList, priv->txTail); + tx_ring[entry].cStat = TLAN_CSTAT_UNUSED; + priv->txBusyCount++; + return; + } + + tail_list->forward = 0; + + tail_buffer = txb + (priv->txTail * TLAN_MAX_FRAME_SIZE); + + /* send the packet to destination */ + memcpy(tail_buffer, d, ETH_ALEN); + memcpy(tail_buffer + ETH_ALEN, nic->node_addr, ETH_ALEN); + nstype = htons((u16) t); + memcpy(tail_buffer + 2 * ETH_ALEN, (u8 *) & nstype, 2); + memcpy(tail_buffer + ETH_HLEN, p, s); + + s += ETH_HLEN; + s &= 0x0FFF; + while (s < ETH_ZLEN) + tail_buffer[s++] = '\0'; + + /*=====================================================*/ + /* Receive + * 0000 0000 0001 1100 + * 0000 0000 0000 1100 + * 0000 0000 0000 0011 = 0x0003 + * + * 0000 0000 0000 0000 0000 0000 0000 0011 + * 0000 0000 0000 1100 0000 0000 0000 0000 = 0x000C0000 + * + * Transmit + * 0000 0000 0001 1100 + * 0000 0000 0000 0100 + * 0000 0000 0000 0001 = 0x0001 + * + * 0000 0000 0000 0000 0000 0000 0000 0001 + * 0000 0000 0000 0100 0000 0000 0000 0000 = 0x00040000 + * */ + + /* Setup the transmit descriptor */ + tail_list->frameSize = (u16) s; + tail_list->buffer[0].count = TLAN_LAST_BUFFER | (u32) s; + tail_list->buffer[1].count = 0; + tail_list->buffer[1].address = 0; + + tail_list->cStat = TLAN_CSTAT_READY; + +#ifdef EBDEBUG + host_int = inw(BASE + TLAN_HOST_INT); + printf("INT1-0x%hX\n", host_int); +#endif + + if (!priv->txInProgress) { + priv->txInProgress = 1; + outl(virt_to_le32desc(tail_list), BASE + TLAN_CH_PARM); + outl(TLAN_HC_GO, BASE + TLAN_HOST_CMD); + } else { + if (priv->txTail == 0) { +#ifdef EBDEBUG + printf("Out buffer\n"); +#endif + (priv->txList + (TLAN_NUM_TX_LISTS - 1))->forward = + virt_to_le32desc(tail_list); + } else { +#ifdef EBDEBUG + printf("Fix this \n"); +#endif + (priv->txList + (priv->txTail - 1))->forward = + virt_to_le32desc(tail_list); + } + } + + CIRC_INC(priv->txTail, TLAN_NUM_TX_LISTS); + +#ifdef EBDEBUG + host_int = inw(BASE + TLAN_HOST_INT); + printf("INT2-0x%hX\n", host_int); +#endif + + to = currticks() + TX_TIME_OUT; + while ((tail_list->cStat == TLAN_CSTAT_READY) && currticks() < to); + + head_list = priv->txList + priv->txHead; + while (((tmpCStat = head_list->cStat) & TLAN_CSTAT_FRM_CMP) + && (ack < 255)) { + ack++; + if(tmpCStat & TLAN_CSTAT_EOC) + eoc =1; + head_list->cStat = TLAN_CSTAT_UNUSED; + CIRC_INC(priv->txHead, TLAN_NUM_TX_LISTS); + head_list = priv->txList + priv->txHead; + + } + if(!ack) + printf("Incomplete TX Frame\n"); + + if(eoc) { + head_list = priv->txList + priv->txHead; + if ((head_list->cStat & TLAN_CSTAT_READY) == TLAN_CSTAT_READY) { + outl(virt_to_le32desc(head_list), BASE + TLAN_CH_PARM); + ack |= TLAN_HC_GO; + } else { + priv->txInProgress = 0; + } + } + if(ack) { + host_cmd = TLAN_HC_ACK | ack; + outl(host_cmd, BASE + TLAN_HOST_CMD); + } + + if(priv->tlanRev < 0x30 ) { + ack = 1; + head_list = priv->txList + priv->txHead; + if ((head_list->cStat & TLAN_CSTAT_READY) == TLAN_CSTAT_READY) { + outl(virt_to_le32desc(head_list), BASE + TLAN_CH_PARM); + ack |= TLAN_HC_GO; + } else { + priv->txInProgress = 0; + } + host_cmd = TLAN_HC_ACK | ack | 0x00140000; + outl(host_cmd, BASE + TLAN_HOST_CMD); + + } + + if (currticks() >= to) { + printf("TX Time Out"); + } +} + +/************************************************************************** +DISABLE - Turn off ethernet interface +***************************************************************************/ +#ifdef EB51 +static void tlan_disable(struct dev *dev __unused) +#else +static void tlan_disable(struct nic *nic __unused) +#endif +{ + /* put the card in its initial state */ + /* This function serves 3 purposes. + * This disables DMA and interrupts so we don't receive + * unexpected packets or interrupts from the card after + * etherboot has finished. + * This frees resources so etherboot may use + * this driver on another interface + * This allows etherboot to reinitialize the interface + * if something is something goes wrong. + * + */ + outl(TLAN_HC_AD_RST, BASE + TLAN_HOST_CMD); +} + +/************************************************************************** +IRQ - Enable, Disable, or Force interrupts +***************************************************************************/ +static void tlan_irq(struct nic *nic __unused, irq_action_t action __unused) +{ + switch ( action ) { + case DISABLE : + break; + case ENABLE : + break; + case FORCE : + break; + } +} + +static void TLan_SetMulticastList(struct nic *nic) { + int i; + u8 tmp; + + /* !IFF_PROMISC */ + tmp = TLan_DioRead8(BASE, TLAN_NET_CMD); + TLan_DioWrite8(BASE, TLAN_NET_CMD, tmp & ~TLAN_NET_CMD_CAF); + + /* IFF_ALLMULTI */ + for(i = 0; i< 3; i++) + TLan_SetMac(nic, i + 1, NULL); + TLan_DioWrite32(BASE, TLAN_HASH_1, 0xFFFFFFFF); + TLan_DioWrite32(BASE, TLAN_HASH_2, 0xFFFFFFFF); + + +} +/************************************************************************** +PROBE - Look for an adapter, this routine's visible to the outside +***************************************************************************/ + +#define board_found 1 +#define valid_link 0 +#ifdef EB51 +static int tlan_probe(struct dev *dev, struct pci_device *pci) +{ + struct nic *nic = (struct nic *) dev; +#else +struct nic *tlan_probe(struct nic *nic, unsigned short *io_addrs, struct pci_device *pci) +{ +#endif + u16 data = 0; + int err; + int i; + + if (pci->ioaddr == 0) + return 0; + + nic->irqno = 0; + nic->ioaddr = pci->ioaddr & ~3; + + BASE = pci->ioaddr; + printf("\n"); + printf("tlan.c: %s, %s\n", drv_version, drv_date); + printf("%s: Probing for Vendor 0x%hX, Device 0x%hX", + pci->name, pci->vendor, pci->dev_id); + + + /* I really must find out what this does */ + adjust_pci_device(pci); + + /* Point to private storage */ + priv = &TLanPrivateInfo; + /* Figure out which chip we're dealing with */ + i = 0; + chip_idx = -1; + + while (tlan_pci_tbl[i].name) { + if ((((u32) pci->dev_id << 16) | pci->vendor) == + (tlan_pci_tbl[i].id.pci & 0xffffffff)) { + chip_idx = i; + break; + } + i++; + } + + priv->vendor_id = pci->vendor; + priv->dev_id = pci->dev_id; + priv->nic_name = pci->name; + priv->eoc = 0; + + err = 0; + for (i = 0; i < 6; i++) + err |= TLan_EeReadByte(BASE, + (u8) tlan_pci_tbl[chip_idx]. + addrOfs + i, + (u8 *) & nic->node_addr[i]); + if (err) { + printf("TLAN: %s: Error reading MAC from eeprom: %d\n", + pci->name, err); + } else + printf("\nAddress: %!\n", nic->node_addr); + + priv->tlanRev = TLan_DioRead8(BASE, TLAN_DEF_REVISION); + printf("\nRevision = 0x%hX\n", priv->tlanRev); + + TLan_ResetLists(nic); + TLan_ResetAdapter(nic); +/* + data = inl(BASE + TLAN_HOST_CMD); + data |= TLAN_HC_EOC; + outw(data, BASE + TLAN_HOST_CMD); +*/ + + data = inl(BASE + TLAN_HOST_CMD); + data |= TLAN_HC_INT_OFF; + outw(data, BASE + TLAN_HOST_CMD); + + TLan_SetMulticastList(nic); + udelay(100); + priv->txList = tx_ring; + priv->rxList = rx_ring; +/* if (board_found && valid_link) + {*/ + /* point to NIC specific routines */ +#ifdef EB51 + dev->disable = tlan_disable; + nic->poll = tlan_poll; + nic->transmit = tlan_transmit; + nic->irq = tlan_irq; + return 1; +#else + nic->disable = tlan_disable; + nic->poll = tlan_poll; + nic->transmit = tlan_transmit; + nic->irq = tlan_irq; + return nic; +#endif +} + + +/***************************************************************************** +****************************************************************************** + + ThunderLAN Driver Eeprom routines + + The Compaq Netelligent 10 and 10/100 cards use a Microchip 24C02A + EEPROM. These functions are based on information in Microchip's + data sheet. I don't know how well this functions will work with + other EEPROMs. + +****************************************************************************** +*****************************************************************************/ + + + /*************************************************************** + * TLan_EeSendStart + * + * Returns: + * Nothing + * Parms: + * io_base The IO port base address for the + * TLAN device with the EEPROM to + * use. + * + * This function sends a start cycle to an EEPROM attached + * to a TLAN chip. + * + **************************************************************/ + +void TLan_EeSendStart(u16 io_base) +{ + u16 sio; + + outw(TLAN_NET_SIO, io_base + TLAN_DIO_ADR); + sio = io_base + TLAN_DIO_DATA + TLAN_NET_SIO; + + TLan_SetBit(TLAN_NET_SIO_ECLOK, sio); + TLan_SetBit(TLAN_NET_SIO_EDATA, sio); + TLan_SetBit(TLAN_NET_SIO_ETXEN, sio); + TLan_ClearBit(TLAN_NET_SIO_EDATA, sio); + TLan_ClearBit(TLAN_NET_SIO_ECLOK, sio); + +} /* TLan_EeSendStart */ + + + + + /*************************************************************** + * TLan_EeSendByte + * + * Returns: + * If the correct ack was received, 0, otherwise 1 + * Parms: io_base The IO port base address for the + * TLAN device with the EEPROM to + * use. + * data The 8 bits of information to + * send to the EEPROM. + * stop If TLAN_EEPROM_STOP is passed, a + * stop cycle is sent after the + * byte is sent after the ack is + * read. + * + * This function sends a byte on the serial EEPROM line, + * driving the clock to send each bit. The function then + * reverses transmission direction and reads an acknowledge + * bit. + * + **************************************************************/ + +int TLan_EeSendByte(u16 io_base, u8 data, int stop) +{ + int err; + u8 place; + u16 sio; + + outw(TLAN_NET_SIO, io_base + TLAN_DIO_ADR); + sio = io_base + TLAN_DIO_DATA + TLAN_NET_SIO; + + /* Assume clock is low, tx is enabled; */ + for (place = 0x80; place != 0; place >>= 1) { + if (place & data) + TLan_SetBit(TLAN_NET_SIO_EDATA, sio); + else + TLan_ClearBit(TLAN_NET_SIO_EDATA, sio); + TLan_SetBit(TLAN_NET_SIO_ECLOK, sio); + TLan_ClearBit(TLAN_NET_SIO_ECLOK, sio); + } + TLan_ClearBit(TLAN_NET_SIO_ETXEN, sio); + TLan_SetBit(TLAN_NET_SIO_ECLOK, sio); + err = TLan_GetBit(TLAN_NET_SIO_EDATA, sio); + TLan_ClearBit(TLAN_NET_SIO_ECLOK, sio); + TLan_SetBit(TLAN_NET_SIO_ETXEN, sio); + + if ((!err) && stop) { + TLan_ClearBit(TLAN_NET_SIO_EDATA, sio); /* STOP, raise data while clock is high */ + TLan_SetBit(TLAN_NET_SIO_ECLOK, sio); + TLan_SetBit(TLAN_NET_SIO_EDATA, sio); + } + + return (err); + +} /* TLan_EeSendByte */ + + + + + /*************************************************************** + * TLan_EeReceiveByte + * + * Returns: + * Nothing + * Parms: + * io_base The IO port base address for the + * TLAN device with the EEPROM to + * use. + * data An address to a char to hold the + * data sent from the EEPROM. + * stop If TLAN_EEPROM_STOP is passed, a + * stop cycle is sent after the + * byte is received, and no ack is + * sent. + * + * This function receives 8 bits of data from the EEPROM + * over the serial link. It then sends and ack bit, or no + * ack and a stop bit. This function is used to retrieve + * data after the address of a byte in the EEPROM has been + * sent. + * + **************************************************************/ + +void TLan_EeReceiveByte(u16 io_base, u8 * data, int stop) +{ + u8 place; + u16 sio; + + outw(TLAN_NET_SIO, io_base + TLAN_DIO_ADR); + sio = io_base + TLAN_DIO_DATA + TLAN_NET_SIO; + *data = 0; + + /* Assume clock is low, tx is enabled; */ + TLan_ClearBit(TLAN_NET_SIO_ETXEN, sio); + for (place = 0x80; place; place >>= 1) { + TLan_SetBit(TLAN_NET_SIO_ECLOK, sio); + if (TLan_GetBit(TLAN_NET_SIO_EDATA, sio)) + *data |= place; + TLan_ClearBit(TLAN_NET_SIO_ECLOK, sio); + } + + TLan_SetBit(TLAN_NET_SIO_ETXEN, sio); + if (!stop) { + TLan_ClearBit(TLAN_NET_SIO_EDATA, sio); /* Ack = 0 */ + TLan_SetBit(TLAN_NET_SIO_ECLOK, sio); + TLan_ClearBit(TLAN_NET_SIO_ECLOK, sio); + } else { + TLan_SetBit(TLAN_NET_SIO_EDATA, sio); /* No ack = 1 (?) */ + TLan_SetBit(TLAN_NET_SIO_ECLOK, sio); + TLan_ClearBit(TLAN_NET_SIO_ECLOK, sio); + TLan_ClearBit(TLAN_NET_SIO_EDATA, sio); /* STOP, raise data while clock is high */ + TLan_SetBit(TLAN_NET_SIO_ECLOK, sio); + TLan_SetBit(TLAN_NET_SIO_EDATA, sio); + } + +} /* TLan_EeReceiveByte */ + + + + /*************************************************************** + * TLan_EeReadByte + * + * Returns: + * No error = 0, else, the stage at which the error + * occurred. + * Parms: + * io_base The IO port base address for the + * TLAN device with the EEPROM to + * use. + * ee_addr The address of the byte in the + * EEPROM whose contents are to be + * retrieved. + * data An address to a char to hold the + * data obtained from the EEPROM. + * + * This function reads a byte of information from an byte + * cell in the EEPROM. + * + **************************************************************/ + +int TLan_EeReadByte(u16 io_base, u8 ee_addr, u8 * data) +{ + int err; + int ret = 0; + + + TLan_EeSendStart(io_base); + err = TLan_EeSendByte(io_base, 0xA0, TLAN_EEPROM_ACK); + if (err) { + ret = 1; + goto fail; + } + err = TLan_EeSendByte(io_base, ee_addr, TLAN_EEPROM_ACK); + if (err) { + ret = 2; + goto fail; + } + TLan_EeSendStart(io_base); + err = TLan_EeSendByte(io_base, 0xA1, TLAN_EEPROM_ACK); + if (err) { + ret = 3; + goto fail; + } + TLan_EeReceiveByte(io_base, data, TLAN_EEPROM_STOP); + fail: + + return ret; + +} /* TLan_EeReadByte */ + + +/***************************************************************************** +****************************************************************************** + + ThunderLAN Driver MII Routines + + These routines are based on the information in Chap. 2 of the + "ThunderLAN Programmer's Guide", pp. 15-24. + +****************************************************************************** +*****************************************************************************/ + + + /*************************************************************** + * TLan_MiiReadReg + * + * Returns: + * 0 if ack received ok + * 1 otherwise. + * + * Parms: + * dev The device structure containing + * The io address and interrupt count + * for this device. + * phy The address of the PHY to be queried. + * reg The register whose contents are to be + * retreived. + * val A pointer to a variable to store the + * retrieved value. + * + * This function uses the TLAN's MII bus to retreive the contents + * of a given register on a PHY. It sends the appropriate info + * and then reads the 16-bit register value from the MII bus via + * the TLAN SIO register. + * + **************************************************************/ + +int TLan_MiiReadReg(struct nic *nic __unused, u16 phy, u16 reg, u16 * val) +{ + u8 nack; + u16 sio, tmp; + u32 i; + int err; + int minten; + + err = FALSE; + outw(TLAN_NET_SIO, BASE + TLAN_DIO_ADR); + sio = BASE + TLAN_DIO_DATA + TLAN_NET_SIO; + + TLan_MiiSync(BASE); + + minten = TLan_GetBit(TLAN_NET_SIO_MINTEN, sio); + if (minten) + TLan_ClearBit(TLAN_NET_SIO_MINTEN, sio); + + TLan_MiiSendData(BASE, 0x1, 2); /* Start ( 01b ) */ + TLan_MiiSendData(BASE, 0x2, 2); /* Read ( 10b ) */ + TLan_MiiSendData(BASE, phy, 5); /* Device # */ + TLan_MiiSendData(BASE, reg, 5); /* Register # */ + + + TLan_ClearBit(TLAN_NET_SIO_MTXEN, sio); /* Change direction */ + + TLan_ClearBit(TLAN_NET_SIO_MCLK, sio); /* Clock Idle bit */ + TLan_SetBit(TLAN_NET_SIO_MCLK, sio); + TLan_ClearBit(TLAN_NET_SIO_MCLK, sio); /* Wait 300ns */ + + nack = TLan_GetBit(TLAN_NET_SIO_MDATA, sio); /* Check for ACK */ + TLan_SetBit(TLAN_NET_SIO_MCLK, sio); /* Finish ACK */ + if (nack) { /* No ACK, so fake it */ + for (i = 0; i < 16; i++) { + TLan_ClearBit(TLAN_NET_SIO_MCLK, sio); + TLan_SetBit(TLAN_NET_SIO_MCLK, sio); + } + tmp = 0xffff; + err = TRUE; + } else { /* ACK, so read data */ + for (tmp = 0, i = 0x8000; i; i >>= 1) { + TLan_ClearBit(TLAN_NET_SIO_MCLK, sio); + if (TLan_GetBit(TLAN_NET_SIO_MDATA, sio)) + tmp |= i; + TLan_SetBit(TLAN_NET_SIO_MCLK, sio); + } + } + + + TLan_ClearBit(TLAN_NET_SIO_MCLK, sio); /* Idle cycle */ + TLan_SetBit(TLAN_NET_SIO_MCLK, sio); + + if (minten) + TLan_SetBit(TLAN_NET_SIO_MINTEN, sio); + + *val = tmp; + + return err; + +} /* TLan_MiiReadReg */ + + /*************************************************************** + * TLan_MiiSendData + * + * Returns: + * Nothing + * Parms: + * base_port The base IO port of the adapter in + * question. + * dev The address of the PHY to be queried. + * data The value to be placed on the MII bus. + * num_bits The number of bits in data that are to + * be placed on the MII bus. + * + * This function sends on sequence of bits on the MII + * configuration bus. + * + **************************************************************/ + +void TLan_MiiSendData(u16 base_port, u32 data, unsigned num_bits) +{ + u16 sio; + u32 i; + + if (num_bits == 0) + return; + + outw(TLAN_NET_SIO, base_port + TLAN_DIO_ADR); + sio = base_port + TLAN_DIO_DATA + TLAN_NET_SIO; + TLan_SetBit(TLAN_NET_SIO_MTXEN, sio); + + for (i = (0x1 << (num_bits - 1)); i; i >>= 1) { + TLan_ClearBit(TLAN_NET_SIO_MCLK, sio); + (void) TLan_GetBit(TLAN_NET_SIO_MCLK, sio); + if (data & i) + TLan_SetBit(TLAN_NET_SIO_MDATA, sio); + else + TLan_ClearBit(TLAN_NET_SIO_MDATA, sio); + TLan_SetBit(TLAN_NET_SIO_MCLK, sio); + (void) TLan_GetBit(TLAN_NET_SIO_MCLK, sio); + } + +} /* TLan_MiiSendData */ + + + + + /*************************************************************** + * TLan_MiiSync + * + * Returns: + * Nothing + * Parms: + * base_port The base IO port of the adapter in + * question. + * + * This functions syncs all PHYs in terms of the MII configuration + * bus. + * + **************************************************************/ + +void TLan_MiiSync(u16 base_port) +{ + int i; + u16 sio; + + outw(TLAN_NET_SIO, base_port + TLAN_DIO_ADR); + sio = base_port + TLAN_DIO_DATA + TLAN_NET_SIO; + + TLan_ClearBit(TLAN_NET_SIO_MTXEN, sio); + for (i = 0; i < 32; i++) { + TLan_ClearBit(TLAN_NET_SIO_MCLK, sio); + TLan_SetBit(TLAN_NET_SIO_MCLK, sio); + } + +} /* TLan_MiiSync */ + + + + + /*************************************************************** + * TLan_MiiWriteReg + * + * Returns: + * Nothing + * Parms: + * dev The device structure for the device + * to write to. + * phy The address of the PHY to be written to. + * reg The register whose contents are to be + * written. + * val The value to be written to the register. + * + * This function uses the TLAN's MII bus to write the contents of a + * given register on a PHY. It sends the appropriate info and then + * writes the 16-bit register value from the MII configuration bus + * via the TLAN SIO register. + * + **************************************************************/ + +void TLan_MiiWriteReg(struct nic *nic __unused, u16 phy, u16 reg, u16 val) +{ + u16 sio; + int minten; + + outw(TLAN_NET_SIO, BASE + TLAN_DIO_ADR); + sio = BASE + TLAN_DIO_DATA + TLAN_NET_SIO; + + TLan_MiiSync(BASE); + + minten = TLan_GetBit(TLAN_NET_SIO_MINTEN, sio); + if (minten) + TLan_ClearBit(TLAN_NET_SIO_MINTEN, sio); + + TLan_MiiSendData(BASE, 0x1, 2); /* Start ( 01b ) */ + TLan_MiiSendData(BASE, 0x1, 2); /* Write ( 01b ) */ + TLan_MiiSendData(BASE, phy, 5); /* Device # */ + TLan_MiiSendData(BASE, reg, 5); /* Register # */ + + TLan_MiiSendData(BASE, 0x2, 2); /* Send ACK */ + TLan_MiiSendData(BASE, val, 16); /* Send Data */ + + TLan_ClearBit(TLAN_NET_SIO_MCLK, sio); /* Idle cycle */ + TLan_SetBit(TLAN_NET_SIO_MCLK, sio); + + if (minten) + TLan_SetBit(TLAN_NET_SIO_MINTEN, sio); + + +} /* TLan_MiiWriteReg */ + + /*************************************************************** + * TLan_SetMac + * + * Returns: + * Nothing + * Parms: + * dev Pointer to device structure of adapter + * on which to change the AREG. + * areg The AREG to set the address in (0 - 3). + * mac A pointer to an array of chars. Each + * element stores one byte of the address. + * IE, it isn't in ascii. + * + * This function transfers a MAC address to one of the + * TLAN AREGs (address registers). The TLAN chip locks + * the register on writing to offset 0 and unlocks the + * register after writing to offset 5. If NULL is passed + * in mac, then the AREG is filled with 0's. + * + **************************************************************/ + +void TLan_SetMac(struct nic *nic __unused, int areg, char *mac) +{ + int i; + + areg *= 6; + + if (mac != NULL) { + for (i = 0; i < 6; i++) + TLan_DioWrite8(BASE, TLAN_AREG_0 + areg + i, + mac[i]); + } else { + for (i = 0; i < 6; i++) + TLan_DioWrite8(BASE, TLAN_AREG_0 + areg + i, 0); + } + +} /* TLan_SetMac */ + + /********************************************************************* + * TLan_PhyDetect + * + * Returns: + * Nothing + * Parms: + * dev A pointer to the device structure of the adapter + * for which the PHY needs determined. + * + * So far I've found that adapters which have external PHYs + * may also use the internal PHY for part of the functionality. + * (eg, AUI/Thinnet). This function finds out if this TLAN + * chip has an internal PHY, and then finds the first external + * PHY (starting from address 0) if it exists). + * + ********************************************************************/ + +void TLan_PhyDetect(struct nic *nic) +{ + u16 control; + u16 hi; + u16 lo; + u32 phy; + + if (tlan_pci_tbl[chip_idx].flags & TLAN_ADAPTER_UNMANAGED_PHY) { + priv->phyNum = 0xFFFF; + return; + } + + TLan_MiiReadReg(nic, TLAN_PHY_MAX_ADDR, MII_GEN_ID_HI, &hi); + + if (hi != 0xFFFF) { + priv->phy[0] = TLAN_PHY_MAX_ADDR; + } else { + priv->phy[0] = TLAN_PHY_NONE; + } + + priv->phy[1] = TLAN_PHY_NONE; + for (phy = 0; phy <= TLAN_PHY_MAX_ADDR; phy++) { + TLan_MiiReadReg(nic, phy, MII_GEN_CTL, &control); + TLan_MiiReadReg(nic, phy, MII_GEN_ID_HI, &hi); + TLan_MiiReadReg(nic, phy, MII_GEN_ID_LO, &lo); + if ((control != 0xFFFF) || (hi != 0xFFFF) + || (lo != 0xFFFF)) { + printf("PHY found at %hX %hX %hX %hX\n", phy, + control, hi, lo); + if ((priv->phy[1] == TLAN_PHY_NONE) + && (phy != TLAN_PHY_MAX_ADDR)) { + priv->phy[1] = phy; + } + } + } + + if (priv->phy[1] != TLAN_PHY_NONE) { + priv->phyNum = 1; + } else if (priv->phy[0] != TLAN_PHY_NONE) { + priv->phyNum = 0; + } else { + printf + ("TLAN: Cannot initialize device, no PHY was found!\n"); + } + +} /* TLan_PhyDetect */ + +void TLan_PhyPowerDown(struct nic *nic) +{ + + u16 value; + printf("%s: Powering down PHY(s).\n", priv->nic_name); + value = MII_GC_PDOWN | MII_GC_LOOPBK | MII_GC_ISOLATE; + TLan_MiiSync(BASE); + TLan_MiiWriteReg(nic, priv->phy[priv->phyNum], MII_GEN_CTL, value); + if ((priv->phyNum == 0) && (priv->phy[1] != TLAN_PHY_NONE) + && + (!(tlan_pci_tbl[chip_idx]. + flags & TLAN_ADAPTER_USE_INTERN_10))) { + TLan_MiiSync(BASE); + TLan_MiiWriteReg(nic, priv->phy[1], MII_GEN_CTL, value); + } + + /* Wait for 50 ms and powerup + * This is abitrary. It is intended to make sure the + * tranceiver settles. + */ + /* TLan_SetTimer( dev, (HZ/20), TLAN_TIMER_PHY_PUP ); */ + mdelay(50); + TLan_PhyPowerUp(nic); + +} /* TLan_PhyPowerDown */ + + +void TLan_PhyPowerUp(struct nic *nic) +{ + u16 value; + + printf("%s: Powering up PHY.\n", priv->nic_name); + TLan_MiiSync(BASE); + value = MII_GC_LOOPBK; + TLan_MiiWriteReg(nic, priv->phy[priv->phyNum], MII_GEN_CTL, value); + TLan_MiiSync(BASE); + /* Wait for 500 ms and reset the + * tranceiver. The TLAN docs say both 50 ms and + * 500 ms, so do the longer, just in case. + */ + mdelay(500); + TLan_PhyReset(nic); + /* TLan_SetTimer( dev, (HZ/20), TLAN_TIMER_PHY_RESET ); */ + +} /* TLan_PhyPowerUp */ + +void TLan_PhyReset(struct nic *nic) +{ + u16 phy; + u16 value; + + phy = priv->phy[priv->phyNum]; + + printf("%s: Reseting PHY.\n", priv->nic_name); + TLan_MiiSync(BASE); + value = MII_GC_LOOPBK | MII_GC_RESET; + TLan_MiiWriteReg(nic, phy, MII_GEN_CTL, value); + TLan_MiiReadReg(nic, phy, MII_GEN_CTL, &value); + while (value & MII_GC_RESET) { + TLan_MiiReadReg(nic, phy, MII_GEN_CTL, &value); + } + + /* Wait for 500 ms and initialize. + * I don't remember why I wait this long. + * I've changed this to 50ms, as it seems long enough. + */ + /* TLan_SetTimer( dev, (HZ/20), TLAN_TIMER_PHY_START_LINK ); */ + mdelay(50); + TLan_PhyStartLink(nic); + +} /* TLan_PhyReset */ + + +void TLan_PhyStartLink(struct nic *nic) +{ + + u16 ability; + u16 control; + u16 data; + u16 phy; + u16 status; + u16 tctl; + + phy = priv->phy[priv->phyNum]; + printf("%s: Trying to activate link.\n", priv->nic_name); + TLan_MiiReadReg(nic, phy, MII_GEN_STS, &status); + TLan_MiiReadReg(nic, phy, MII_GEN_STS, &ability); + + if ((status & MII_GS_AUTONEG) && (!priv->aui)) { + ability = status >> 11; + if (priv->speed == TLAN_SPEED_10 && + priv->duplex == TLAN_DUPLEX_HALF) { + TLan_MiiWriteReg(nic, phy, MII_GEN_CTL, 0x0000); + } else if (priv->speed == TLAN_SPEED_10 && + priv->duplex == TLAN_DUPLEX_FULL) { + priv->tlanFullDuplex = TRUE; + TLan_MiiWriteReg(nic, phy, MII_GEN_CTL, 0x0100); + } else if (priv->speed == TLAN_SPEED_100 && + priv->duplex == TLAN_DUPLEX_HALF) { + TLan_MiiWriteReg(nic, phy, MII_GEN_CTL, 0x2000); + } else if (priv->speed == TLAN_SPEED_100 && + priv->duplex == TLAN_DUPLEX_FULL) { + priv->tlanFullDuplex = TRUE; + TLan_MiiWriteReg(nic, phy, MII_GEN_CTL, 0x2100); + } else { + + /* Set Auto-Neg advertisement */ + TLan_MiiWriteReg(nic, phy, MII_AN_ADV, + (ability << 5) | 1); + /* Enablee Auto-Neg */ + TLan_MiiWriteReg(nic, phy, MII_GEN_CTL, 0x1000); + /* Restart Auto-Neg */ + TLan_MiiWriteReg(nic, phy, MII_GEN_CTL, 0x1200); + /* Wait for 4 sec for autonegotiation + * to complete. The max spec time is less than this + * but the card need additional time to start AN. + * .5 sec should be plenty extra. + */ + printf("TLAN: %s: Starting autonegotiation.\n", + priv->nic_name); + mdelay(4000); + TLan_PhyFinishAutoNeg(nic); + /* TLan_SetTimer( dev, (2*HZ), TLAN_TIMER_PHY_FINISH_AN ); */ + return; + } + + } + + if ((priv->aui) && (priv->phyNum != 0)) { + priv->phyNum = 0; + data = + TLAN_NET_CFG_1FRAG | TLAN_NET_CFG_1CHAN | + TLAN_NET_CFG_PHY_EN; + TLan_DioWrite16(BASE, TLAN_NET_CONFIG, data); + mdelay(50); + /* TLan_SetTimer( dev, (40*HZ/1000), TLAN_TIMER_PHY_PDOWN ); */ + TLan_PhyPowerDown(nic); + return; + } else if (priv->phyNum == 0) { + control = 0; + TLan_MiiReadReg(nic, phy, TLAN_TLPHY_CTL, &tctl); + if (priv->aui) { + tctl |= TLAN_TC_AUISEL; + } else { + tctl &= ~TLAN_TC_AUISEL; + if (priv->duplex == TLAN_DUPLEX_FULL) { + control |= MII_GC_DUPLEX; + priv->tlanFullDuplex = TRUE; + } + if (priv->speed == TLAN_SPEED_100) { + control |= MII_GC_SPEEDSEL; + } + } + TLan_MiiWriteReg(nic, phy, MII_GEN_CTL, control); + TLan_MiiWriteReg(nic, phy, TLAN_TLPHY_CTL, tctl); + } + + /* Wait for 2 sec to give the tranceiver time + * to establish link. + */ + /* TLan_SetTimer( dev, (4*HZ), TLAN_TIMER_FINISH_RESET ); */ + mdelay(2000); + TLan_FinishReset(nic); + +} /* TLan_PhyStartLink */ + +void TLan_PhyFinishAutoNeg(struct nic *nic) +{ + + u16 an_adv; + u16 an_lpa; + u16 data; + u16 mode; + u16 phy; + u16 status; + + phy = priv->phy[priv->phyNum]; + + TLan_MiiReadReg(nic, phy, MII_GEN_STS, &status); + udelay(1000); + TLan_MiiReadReg(nic, phy, MII_GEN_STS, &status); + + if (!(status & MII_GS_AUTOCMPLT)) { + /* Wait for 8 sec to give the process + * more time. Perhaps we should fail after a while. + */ + if (!priv->neg_be_verbose++) { + printf + ("TLAN: Giving autonegotiation more time.\n"); + printf + ("TLAN: Please check that your adapter has\n"); + printf + ("TLAN: been properly connected to a HUB or Switch.\n"); + printf + ("TLAN: Trying to establish link in the background...\n"); + } + mdelay(8000); + TLan_PhyFinishAutoNeg(nic); + /* TLan_SetTimer( dev, (8*HZ), TLAN_TIMER_PHY_FINISH_AN ); */ + return; + } + + printf("TLAN: %s: Autonegotiation complete.\n", priv->nic_name); + TLan_MiiReadReg(nic, phy, MII_AN_ADV, &an_adv); + TLan_MiiReadReg(nic, phy, MII_AN_LPA, &an_lpa); + mode = an_adv & an_lpa & 0x03E0; + if (mode & 0x0100) { + printf("Full Duplex\n"); + priv->tlanFullDuplex = TRUE; + } else if (!(mode & 0x0080) && (mode & 0x0040)) { + priv->tlanFullDuplex = TRUE; + printf("Full Duplex\n"); + } + + if ((!(mode & 0x0180)) + && (tlan_pci_tbl[chip_idx].flags & TLAN_ADAPTER_USE_INTERN_10) + && (priv->phyNum != 0)) { + priv->phyNum = 0; + data = + TLAN_NET_CFG_1FRAG | TLAN_NET_CFG_1CHAN | + TLAN_NET_CFG_PHY_EN; + TLan_DioWrite16(BASE, TLAN_NET_CONFIG, data); + /* TLan_SetTimer( nic, (400*HZ/1000), TLAN_TIMER_PHY_PDOWN ); */ + mdelay(400); + TLan_PhyPowerDown(nic); + return; + } + + if (priv->phyNum == 0) { + if ((priv->duplex == TLAN_DUPLEX_FULL) + || (an_adv & an_lpa & 0x0040)) { + TLan_MiiWriteReg(nic, phy, MII_GEN_CTL, + MII_GC_AUTOENB | MII_GC_DUPLEX); + printf + ("TLAN: Starting internal PHY with FULL-DUPLEX\n"); + } else { + TLan_MiiWriteReg(nic, phy, MII_GEN_CTL, + MII_GC_AUTOENB); + printf + ("TLAN: Starting internal PHY with HALF-DUPLEX\n"); + } + } + + /* Wait for 100 ms. No reason in partiticular. + */ + /* TLan_SetTimer( dev, (HZ/10), TLAN_TIMER_FINISH_RESET ); */ + mdelay(100); + TLan_FinishReset(nic); + +} /* TLan_PhyFinishAutoNeg */ + +#ifdef MONITOR + + /********************************************************************* + * + * TLan_phyMonitor + * + * Returns: + * None + * + * Params: + * dev The device structure of this device. + * + * + * This function monitors PHY condition by reading the status + * register via the MII bus. This can be used to give info + * about link changes (up/down), and possible switch to alternate + * media. + * + * ******************************************************************/ + +void TLan_PhyMonitor(struct net_device *dev) +{ + TLanPrivateInfo *priv = dev->priv; + u16 phy; + u16 phy_status; + + phy = priv->phy[priv->phyNum]; + + /* Get PHY status register */ + TLan_MiiReadReg(nic, phy, MII_GEN_STS, &phy_status); + + /* Check if link has been lost */ + if (!(phy_status & MII_GS_LINK)) { + if (priv->link) { + priv->link = 0; + printf("TLAN: %s has lost link\n", priv->nic_name); + priv->flags &= ~IFF_RUNNING; + mdelay(2000); + TLan_PhyMonitor(nic); + /* TLan_SetTimer( dev, (2*HZ), TLAN_TIMER_LINK_BEAT ); */ + return; + } + } + + /* Link restablished? */ + if ((phy_status & MII_GS_LINK) && !priv->link) { + priv->link = 1; + printf("TLAN: %s has reestablished link\n", + priv->nic_name); + priv->flags |= IFF_RUNNING; + } + + /* Setup a new monitor */ + /* TLan_SetTimer( dev, (2*HZ), TLAN_TIMER_LINK_BEAT ); */ + mdelay(2000); + TLan_PhyMonitor(nic); +} + +#endif /* MONITOR */ + +#ifdef EB51 +static struct pci_id tlan_nics[] = { + PCI_ROM(0x0e11, 0xae34, "netel10", "Compaq Netelligent 10 T PCI UTP"), + PCI_ROM(0x0e11, 0xae32, "netel100","Compaq Netelligent 10/100 TX PCI UTP"), + PCI_ROM(0x0e11, 0xae35, "netflex3i", "Compaq Integrated NetFlex-3/P"), + PCI_ROM(0x0e11, 0xf130, "thunder", "Compaq NetFlex-3/P"), + PCI_ROM(0x0e11, 0xf150, "netflex3b", "Compaq NetFlex-3/P"), + PCI_ROM(0x0e11, 0xae43, "netel100pi", "Compaq Netelligent Integrated 10/100 TX UTP"), + PCI_ROM(0x0e11, 0xae40, "netel100d", "Compaq Netelligent Dual 10/100 TX PCI UTP"), + PCI_ROM(0x0e11, 0xb011, "netel100i", "Compaq Netelligent 10/100 TX Embedded UTP"), + PCI_ROM(0x108d, 0x0013, "oc2183", "Olicom OC-2183/2185"), + PCI_ROM(0x108d, 0x0012, "oc2325", "Olicom OC-2325"), + PCI_ROM(0x108d, 0x0014, "oc2326", "Olicom OC-2326"), + PCI_ROM(0x0e11, 0xb030, "netelligent_10_100_ws_5100", "Compaq Netelligent 10/100 TX UTP"), + PCI_ROM(0x0e11, 0xb012, "netelligent_10_t2", "Compaq Netelligent 10 T/2 PCI UTP/Coax"), +}; + +struct pci_driver tlan_driver = { + .type = NIC_DRIVER, + .name = "TLAN/PCI", + .probe = tlan_probe, + .ids = tlan_nics, + .id_count = sizeof(tlan_nics) / sizeof(tlan_nics[0]), + .class = 0, +}; +#endif diff --git a/usr/src/grub/grub-0.97/netboot/tlan.h b/usr/src/grub/grub-0.97/netboot/tlan.h new file mode 100644 index 0000000000..35753e6a9e --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/tlan.h @@ -0,0 +1,536 @@ +/************************************************************************** +* +* tlan.c -- Etherboot device driver for the Texas Instruments ThunderLAN +* Written 2003-2003 by Timothy Legge +* +* 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. +* +* Portions of this code (almost all) based on: +* tlan.c: Linux ThunderLan Driver: +* +* by James Banks +* +* (C) 1997-1998 Caldera, Inc. +* (C) 1998 James Banks +* (C) 1999-2001 Torben Mathiasen +* (C) 2002 Samuel Chessman +* +* REVISION HISTORY: +* ================ +* v1.0 07-08-2003 timlegge Initial not quite working version +* +* Indent Style: indent -kr -i8 +***************************************************************************/ + +/* +#include +#include +#include +*/ + +typedef unsigned char u8; +typedef signed char s8; +typedef unsigned short u16; +typedef signed short s16; +typedef unsigned int u32; +typedef signed int s32; + /***************************************************************** + * TLan Definitions + * + ****************************************************************/ + +#define FALSE 0 +#define TRUE 1 + +#define TLAN_MIN_FRAME_SIZE 64 +#define TLAN_MAX_FRAME_SIZE 1600 + +#define TLAN_NUM_RX_LISTS 4 +#define TLAN_NUM_TX_LISTS 2 + +#define TLAN_IGNORE 0 +#define TLAN_RECORD 1 +/* +#define TLAN_DBG(lvl, format, args...) if (debug&lvl) printf("TLAN: " format, ##args ); +*/ +#define TLAN_DEBUG_GNRL 0x0001 +#define TLAN_DEBUG_TX 0x0002 +#define TLAN_DEBUG_RX 0x0004 +#define TLAN_DEBUG_LIST 0x0008 +#define TLAN_DEBUG_PROBE 0x0010 + +#define TX_TIMEOUT (10*HZ) /* We need time for auto-neg */ +#define MAX_TLAN_BOARDS 8 /* Max number of boards installed at a time */ + + + /***************************************************************** + * Device Identification Definitions + * + ****************************************************************/ + +#define PCI_DEVICE_ID_NETELLIGENT_10_T2 0xB012 +#define PCI_DEVICE_ID_NETELLIGENT_10_100_WS_5100 0xB030 +#ifndef PCI_DEVICE_ID_OLICOM_OC2183 +#define PCI_DEVICE_ID_OLICOM_OC2183 0x0013 +#endif +#ifndef PCI_DEVICE_ID_OLICOM_OC2325 +#define PCI_DEVICE_ID_OLICOM_OC2325 0x0012 +#endif +#ifndef PCI_DEVICE_ID_OLICOM_OC2326 +#define PCI_DEVICE_ID_OLICOM_OC2326 0x0014 +#endif + +typedef struct tlan_adapter_entry { + u16 vendorId; + u16 deviceId; + char *deviceLabel; + u32 flags; + u16 addrOfs; +} TLanAdapterEntry; + +#define TLAN_ADAPTER_NONE 0x00000000 +#define TLAN_ADAPTER_UNMANAGED_PHY 0x00000001 +#define TLAN_ADAPTER_BIT_RATE_PHY 0x00000002 +#define TLAN_ADAPTER_USE_INTERN_10 0x00000004 +#define TLAN_ADAPTER_ACTIVITY_LED 0x00000008 + +#define TLAN_SPEED_DEFAULT 0 +#define TLAN_SPEED_10 10 +#define TLAN_SPEED_100 100 + +#define TLAN_DUPLEX_DEFAULT 0 +#define TLAN_DUPLEX_HALF 1 +#define TLAN_DUPLEX_FULL 2 + + + + /***************************************************************** + * EISA Definitions + * + ****************************************************************/ + +#define EISA_ID 0xc80 /* EISA ID Registers */ +#define EISA_ID0 0xc80 /* EISA ID Register 0 */ +#define EISA_ID1 0xc81 /* EISA ID Register 1 */ +#define EISA_ID2 0xc82 /* EISA ID Register 2 */ +#define EISA_ID3 0xc83 /* EISA ID Register 3 */ +#define EISA_CR 0xc84 /* EISA Control Register */ +#define EISA_REG0 0xc88 /* EISA Configuration Register 0 */ +#define EISA_REG1 0xc89 /* EISA Configuration Register 1 */ +#define EISA_REG2 0xc8a /* EISA Configuration Register 2 */ +#define EISA_REG3 0xc8f /* EISA Configuration Register 3 */ +#define EISA_APROM 0xc90 /* Ethernet Address PROM */ + + + + /***************************************************************** + * Rx/Tx List Definitions + * + ****************************************************************/ + +#define TLAN_BUFFERS_PER_LIST 10 +#define TLAN_LAST_BUFFER 0x80000000 +#define TLAN_CSTAT_UNUSED 0x8000 +#define TLAN_CSTAT_FRM_CMP 0x4000 +#define TLAN_CSTAT_READY 0x3000 +#define TLAN_CSTAT_EOC 0x0800 +#define TLAN_CSTAT_RX_ERROR 0x0400 +#define TLAN_CSTAT_PASS_CRC 0x0200 +#define TLAN_CSTAT_DP_PR 0x0100 + + + + + + + /***************************************************************** + * PHY definitions + * + ****************************************************************/ + +#define TLAN_PHY_MAX_ADDR 0x1F +#define TLAN_PHY_NONE 0x20 + + + + /***************************************************************** + * TLan Driver Timer Definitions + * + ****************************************************************/ + +#define TLAN_TIMER_LINK_BEAT 1 +#define TLAN_TIMER_ACTIVITY 2 +#define TLAN_TIMER_PHY_PDOWN 3 +#define TLAN_TIMER_PHY_PUP 4 +#define TLAN_TIMER_PHY_RESET 5 +#define TLAN_TIMER_PHY_START_LINK 6 +#define TLAN_TIMER_PHY_FINISH_AN 7 +#define TLAN_TIMER_FINISH_RESET 8 + +#define TLAN_TIMER_ACT_DELAY (HZ/10) + + + + + /***************************************************************** + * TLan Driver Eeprom Definitions + * + ****************************************************************/ + +#define TLAN_EEPROM_ACK 0 +#define TLAN_EEPROM_STOP 1 + + + + + /***************************************************************** + * Host Register Offsets and Contents + * + ****************************************************************/ + +#define TLAN_HOST_CMD 0x00 +#define TLAN_HC_GO 0x80000000 +#define TLAN_HC_STOP 0x40000000 +#define TLAN_HC_ACK 0x20000000 +#define TLAN_HC_CS_MASK 0x1FE00000 +#define TLAN_HC_EOC 0x00100000 +#define TLAN_HC_RT 0x00080000 +#define TLAN_HC_NES 0x00040000 +#define TLAN_HC_AD_RST 0x00008000 +#define TLAN_HC_LD_TMR 0x00004000 +#define TLAN_HC_LD_THR 0x00002000 +#define TLAN_HC_REQ_INT 0x00001000 +#define TLAN_HC_INT_OFF 0x00000800 +#define TLAN_HC_INT_ON 0x00000400 +#define TLAN_HC_AC_MASK 0x000000FF +#define TLAN_CH_PARM 0x04 +#define TLAN_DIO_ADR 0x08 +#define TLAN_DA_ADR_INC 0x8000 +#define TLAN_DA_RAM_ADR 0x4000 +#define TLAN_HOST_INT 0x0A +#define TLAN_HI_IV_MASK 0x1FE0 +#define TLAN_HI_IT_MASK 0x001C +#define TLAN_DIO_DATA 0x0C + + +/* ThunderLAN Internal Register DIO Offsets */ + +#define TLAN_NET_CMD 0x00 +#define TLAN_NET_CMD_NRESET 0x80 +#define TLAN_NET_CMD_NWRAP 0x40 +#define TLAN_NET_CMD_CSF 0x20 +#define TLAN_NET_CMD_CAF 0x10 +#define TLAN_NET_CMD_NOBRX 0x08 +#define TLAN_NET_CMD_DUPLEX 0x04 +#define TLAN_NET_CMD_TRFRAM 0x02 +#define TLAN_NET_CMD_TXPACE 0x01 +#define TLAN_NET_SIO 0x01 +#define TLAN_NET_SIO_MINTEN 0x80 +#define TLAN_NET_SIO_ECLOK 0x40 +#define TLAN_NET_SIO_ETXEN 0x20 +#define TLAN_NET_SIO_EDATA 0x10 +#define TLAN_NET_SIO_NMRST 0x08 +#define TLAN_NET_SIO_MCLK 0x04 +#define TLAN_NET_SIO_MTXEN 0x02 +#define TLAN_NET_SIO_MDATA 0x01 +#define TLAN_NET_STS 0x02 +#define TLAN_NET_STS_MIRQ 0x80 +#define TLAN_NET_STS_HBEAT 0x40 +#define TLAN_NET_STS_TXSTOP 0x20 +#define TLAN_NET_STS_RXSTOP 0x10 +#define TLAN_NET_STS_RSRVD 0x0F +#define TLAN_NET_MASK 0x03 +#define TLAN_NET_MASK_MASK7 0x80 +#define TLAN_NET_MASK_MASK6 0x40 +#define TLAN_NET_MASK_MASK5 0x20 +#define TLAN_NET_MASK_MASK4 0x10 +#define TLAN_NET_MASK_RSRVD 0x0F +#define TLAN_NET_CONFIG 0x04 +#define TLAN_NET_CFG_RCLK 0x8000 +#define TLAN_NET_CFG_TCLK 0x4000 +#define TLAN_NET_CFG_BIT 0x2000 +#define TLAN_NET_CFG_RXCRC 0x1000 +#define TLAN_NET_CFG_PEF 0x0800 +#define TLAN_NET_CFG_1FRAG 0x0400 +#define TLAN_NET_CFG_1CHAN 0x0200 +#define TLAN_NET_CFG_MTEST 0x0100 +#define TLAN_NET_CFG_PHY_EN 0x0080 +#define TLAN_NET_CFG_MSMASK 0x007F +#define TLAN_MAN_TEST 0x06 +#define TLAN_DEF_VENDOR_ID 0x08 +#define TLAN_DEF_DEVICE_ID 0x0A +#define TLAN_DEF_REVISION 0x0C +#define TLAN_DEF_SUBCLASS 0x0D +#define TLAN_DEF_MIN_LAT 0x0E +#define TLAN_DEF_MAX_LAT 0x0F +#define TLAN_AREG_0 0x10 +#define TLAN_AREG_1 0x16 +#define TLAN_AREG_2 0x1C +#define TLAN_AREG_3 0x22 +#define TLAN_HASH_1 0x28 +#define TLAN_HASH_2 0x2C +#define TLAN_GOOD_TX_FRMS 0x30 +#define TLAN_TX_UNDERUNS 0x33 +#define TLAN_GOOD_RX_FRMS 0x34 +#define TLAN_RX_OVERRUNS 0x37 +#define TLAN_DEFERRED_TX 0x38 +#define TLAN_CRC_ERRORS 0x3A +#define TLAN_CODE_ERRORS 0x3B +#define TLAN_MULTICOL_FRMS 0x3C +#define TLAN_SINGLECOL_FRMS 0x3E +#define TLAN_EXCESSCOL_FRMS 0x40 +#define TLAN_LATE_COLS 0x41 +#define TLAN_CARRIER_LOSS 0x42 +#define TLAN_ACOMMIT 0x43 +#define TLAN_LED_REG 0x44 +#define TLAN_LED_ACT 0x10 +#define TLAN_LED_LINK 0x01 +#define TLAN_BSIZE_REG 0x45 +#define TLAN_MAX_RX 0x46 +#define TLAN_INT_DIS 0x48 +#define TLAN_ID_TX_EOC 0x04 +#define TLAN_ID_RX_EOF 0x02 +#define TLAN_ID_RX_EOC 0x01 + + + +/* ThunderLAN Interrupt Codes */ + +#define TLAN_INT_NUMBER_OF_INTS 8 + +#define TLAN_INT_NONE 0x0000 +#define TLAN_INT_TX_EOF 0x0001 +#define TLAN_INT_STAT_OVERFLOW 0x0002 +#define TLAN_INT_RX_EOF 0x0003 +#define TLAN_INT_DUMMY 0x0004 +#define TLAN_INT_TX_EOC 0x0005 +#define TLAN_INT_STATUS_CHECK 0x0006 +#define TLAN_INT_RX_EOC 0x0007 + + + +/* ThunderLAN MII Registers */ + +/* Generic MII/PHY Registers */ + +#define MII_GEN_CTL 0x00 +#define MII_GC_RESET 0x8000 +#define MII_GC_LOOPBK 0x4000 +#define MII_GC_SPEEDSEL 0x2000 +#define MII_GC_AUTOENB 0x1000 +#define MII_GC_PDOWN 0x0800 +#define MII_GC_ISOLATE 0x0400 +#define MII_GC_AUTORSRT 0x0200 +#define MII_GC_DUPLEX 0x0100 +#define MII_GC_COLTEST 0x0080 +#define MII_GC_RESERVED 0x007F +#define MII_GEN_STS 0x01 +#define MII_GS_100BT4 0x8000 +#define MII_GS_100BTXFD 0x4000 +#define MII_GS_100BTXHD 0x2000 +#define MII_GS_10BTFD 0x1000 +#define MII_GS_10BTHD 0x0800 +#define MII_GS_RESERVED 0x07C0 +#define MII_GS_AUTOCMPLT 0x0020 +#define MII_GS_RFLT 0x0010 +#define MII_GS_AUTONEG 0x0008 +#define MII_GS_LINK 0x0004 +#define MII_GS_JABBER 0x0002 +#define MII_GS_EXTCAP 0x0001 +#define MII_GEN_ID_HI 0x02 +#define MII_GEN_ID_LO 0x03 +#define MII_GIL_OUI 0xFC00 +#define MII_GIL_MODEL 0x03F0 +#define MII_GIL_REVISION 0x000F +#define MII_AN_ADV 0x04 +#define MII_AN_LPA 0x05 +#define MII_AN_EXP 0x06 + +/* ThunderLAN Specific MII/PHY Registers */ + +#define TLAN_TLPHY_ID 0x10 +#define TLAN_TLPHY_CTL 0x11 +#define TLAN_TC_IGLINK 0x8000 +#define TLAN_TC_SWAPOL 0x4000 +#define TLAN_TC_AUISEL 0x2000 +#define TLAN_TC_SQEEN 0x1000 +#define TLAN_TC_MTEST 0x0800 +#define TLAN_TC_RESERVED 0x07F8 +#define TLAN_TC_NFEW 0x0004 +#define TLAN_TC_INTEN 0x0002 +#define TLAN_TC_TINT 0x0001 +#define TLAN_TLPHY_STS 0x12 +#define TLAN_TS_MINT 0x8000 +#define TLAN_TS_PHOK 0x4000 +#define TLAN_TS_POLOK 0x2000 +#define TLAN_TS_TPENERGY 0x1000 +#define TLAN_TS_RESERVED 0x0FFF +#define TLAN_TLPHY_PAR 0x19 +#define TLAN_PHY_CIM_STAT 0x0020 +#define TLAN_PHY_SPEED_100 0x0040 +#define TLAN_PHY_DUPLEX_FULL 0x0080 +#define TLAN_PHY_AN_EN_STAT 0x0400 + +/* National Sem. & Level1 PHY id's */ +#define NAT_SEM_ID1 0x2000 +#define NAT_SEM_ID2 0x5C01 +#define LEVEL1_ID1 0x7810 +#define LEVEL1_ID2 0x0000 + +#define CIRC_INC( a, b ) if ( ++a >= b ) a = 0 + +/* Routines to access internal registers. */ + +inline u8 TLan_DioRead8(u16 base_addr, u16 internal_addr) +{ + outw(internal_addr, base_addr + TLAN_DIO_ADR); + return (inb((base_addr + TLAN_DIO_DATA) + (internal_addr & 0x3))); + +} /* TLan_DioRead8 */ + + + + +inline u16 TLan_DioRead16(u16 base_addr, u16 internal_addr) +{ + outw(internal_addr, base_addr + TLAN_DIO_ADR); + return (inw((base_addr + TLAN_DIO_DATA) + (internal_addr & 0x2))); + +} /* TLan_DioRead16 */ + + + + +inline u32 TLan_DioRead32(u16 base_addr, u16 internal_addr) +{ + outw(internal_addr, base_addr + TLAN_DIO_ADR); + return (inl(base_addr + TLAN_DIO_DATA)); + +} /* TLan_DioRead32 */ + + + + +inline void TLan_DioWrite8(u16 base_addr, u16 internal_addr, u8 data) +{ + outw(internal_addr, base_addr + TLAN_DIO_ADR); + outb(data, base_addr + TLAN_DIO_DATA + (internal_addr & 0x3)); + +} + + + + +inline void TLan_DioWrite16(u16 base_addr, u16 internal_addr, u16 data) +{ + outw(internal_addr, base_addr + TLAN_DIO_ADR); + outw(data, base_addr + TLAN_DIO_DATA + (internal_addr & 0x2)); + +} + + + + +inline void TLan_DioWrite32(u16 base_addr, u16 internal_addr, u32 data) +{ + outw(internal_addr, base_addr + TLAN_DIO_ADR); + outl(data, base_addr + TLAN_DIO_DATA + (internal_addr & 0x2)); + +} + + + +#if 0 +inline void TLan_ClearBit(u8 bit, u16 port) +{ + outb_p(inb_p(port) & ~bit, port); +} + + + + +inline int TLan_GetBit(u8 bit, u16 port) +{ + return ((int) (inb_p(port) & bit)); +} + + + + +inline void TLan_SetBit(u8 bit, u16 port) +{ + outb_p(inb_p(port) | bit, port); +} +#endif + +#define TLan_ClearBit( bit, port ) outb_p(inb_p(port) & ~bit, port) +#define TLan_GetBit( bit, port ) ((int) (inb_p(port) & bit)) +#define TLan_SetBit( bit, port ) outb_p(inb_p(port) | bit, port) + +#ifdef I_LIKE_A_FAST_HASH_FUNCTION +/* given 6 bytes, view them as 8 6-bit numbers and return the XOR of those */ +/* the code below is about seven times as fast as the original code */ +inline u32 TLan_HashFunc(u8 * a) +{ + u8 hash; + + hash = (a[0] ^ a[3]); /* & 077 */ + hash ^= ((a[0] ^ a[3]) >> 6); /* & 003 */ + hash ^= ((a[1] ^ a[4]) << 2); /* & 074 */ + hash ^= ((a[1] ^ a[4]) >> 4); /* & 017 */ + hash ^= ((a[2] ^ a[5]) << 4); /* & 060 */ + hash ^= ((a[2] ^ a[5]) >> 2); /* & 077 */ + + return (hash & 077); +} + +#else /* original code */ + +inline u32 xor(u32 a, u32 b) +{ + return ((a && !b) || (!a && b)); +} + +#define XOR8( a, b, c, d, e, f, g, h ) xor( a, xor( b, xor( c, xor( d, xor( e, xor( f, xor( g, h ) ) ) ) ) ) ) +#define DA( a, bit ) ( ( (u8) a[bit/8] ) & ( (u8) ( 1 << bit%8 ) ) ) + +inline u32 TLan_HashFunc(u8 * a) +{ + u32 hash; + + hash = + XOR8(DA(a, 0), DA(a, 6), DA(a, 12), DA(a, 18), DA(a, 24), + DA(a, 30), DA(a, 36), DA(a, 42)); + hash |= + XOR8(DA(a, 1), DA(a, 7), DA(a, 13), DA(a, 19), DA(a, 25), + DA(a, 31), DA(a, 37), DA(a, 43)) << 1; + hash |= + XOR8(DA(a, 2), DA(a, 8), DA(a, 14), DA(a, 20), DA(a, 26), + DA(a, 32), DA(a, 38), DA(a, 44)) << 2; + hash |= + XOR8(DA(a, 3), DA(a, 9), DA(a, 15), DA(a, 21), DA(a, 27), + DA(a, 33), DA(a, 39), DA(a, 45)) << 3; + hash |= + XOR8(DA(a, 4), DA(a, 10), DA(a, 16), DA(a, 22), DA(a, 28), + DA(a, 34), DA(a, 40), DA(a, 46)) << 4; + hash |= + XOR8(DA(a, 5), DA(a, 11), DA(a, 17), DA(a, 23), DA(a, 29), + DA(a, 35), DA(a, 41), DA(a, 47)) << 5; + + return hash; + +} + +#endif /* I_LIKE_A_FAST_HASH_FUNCTION */ diff --git a/usr/src/grub/grub-0.97/netboot/tulip.c b/usr/src/grub/grub-0.97/netboot/tulip.c new file mode 100644 index 0000000000..747ea53659 --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/tulip.c @@ -0,0 +1,2069 @@ +/* -*- Mode:C; c-basic-offset:4; -*- */ + +/* + Tulip and clone Etherboot Driver + + By Marty Connor (mdc@thinguin.org) + Copyright (C) 2001 Entity Cyber, Inc. + + This software may be used and distributed according to the terms + of the GNU Public License, incorporated herein by reference. + + As of April 2001 this driver should support most tulip cards that + the Linux tulip driver supports because Donald Becker's Linux media + detection code is now included. + + Based on Ken Yap's Tulip Etherboot Driver and Donald Becker's + Linux Tulip Driver. Supports N-Way speed auto-configuration on + MX98715, MX98715A and MX98725. Support inexpensive PCI 10/100 cards + based on the Macronix MX987x5 chip, such as the SOHOware Fast + model SFA110A, and the LinkSYS model LNE100TX. The NetGear + model FA310X, based on the LC82C168 chip is supported. + The TRENDnet TE100-PCIA NIC which uses a genuine Intel 21143-PD + chipset is supported. Also, Davicom DM9102's. + + Documentation and source code used: + Source for Etherboot driver at + http://etherboot.sourceforge.net/ + MX98715A Data Sheet and MX98715A Application Note + on http://www.macronix.com/ (PDF format files) + Source for Linux tulip driver at + http://cesdis.gsfc.nasa.gov/linux/drivers/tulip.html + + Adapted by Ken Yap from + FreeBSD netboot DEC 21143 driver + Author: David Sharp + date: Nov/98 + + Some code fragments were taken from verious places, Ken Yap's + etherboot, FreeBSD's if_de.c, and various Linux related files. + DEC's manuals for the 21143 and SROM format were very helpful. + The Linux de driver development page has a number of links to + useful related information. Have a look at: + ftp://cesdis.gsfc.nasa.gov/pub/linux/drivers/tulip-devel.html +*/ + +/*********************************************************************/ +/* Revision History */ +/*********************************************************************/ + +/* + 07 Sep 2003 timlegge Multicast Support Added + 11 Apr 2001 mdc [patch to etherboot 4.7.24] + Major rewrite to include Linux tulip driver media detection + code. This driver should support a lot more cards now. + 16 Jul 2000 mdc 0.75b11 + Added support for ADMtek 0985 Centaur-P, a "Comet" tulip clone + which is used on the LinkSYS LNE100TX v4.x cards. We already + support LNE100TX v2.0 cards, which use a different controller. + 04 Jul 2000 jam ? + Added test of status after receiving a packet from the card. + Also uncommented the tulip_disable routine. Stray packets + seemed to be causing problems. + 27 Apr 2000 njl ? + 29 Feb 2000 mdc 0.75b7 + Increased reset delay to 3 seconds because Macronix cards seem to + need more reset time before card comes back to a usable state. + 26 Feb 2000 mdc 0.75b6 + Added a 1 second delay after initializing the transmitter because + some cards seem to need the time or they drop the first packet + transmitted. + 23 Feb 2000 mdc 0.75b5 + removed udelay code and used currticks() for more reliable delay + code in reset pause and sanity timeouts. Added function prototypes + and TX debugging code. + 21 Feb 2000 mdc patch to Etherboot 4.4.3 + Incorporated patches from Bob Edwards and Paul Mackerras of + Linuxcare's OZLabs to deal with inefficiencies in tulip_transmit + and udelay. We now wait for packet transmission to complete + (or sanity timeout). + 04 Feb 2000 Robert.Edwards@anu.edu.au patch to Etherboot 4.4.2 + patch to tulip.c that implements the automatic selection of the MII + interface on cards using the Intel/DEC 21143 reference design, in + particular, the TRENDnet TE100-PCIA NIC which uses a genuine Intel + 21143-PD chipset. + 11 Jan 2000 mdc 0.75b4 + Added support for NetGear FA310TX card based on the LC82C168 + chip. This should also support Lite-On LC82C168 boards. + Added simple MII support. Re-arranged code to better modularize + initializations. + 04 Dec 1999 mdc 0.75b3 + Added preliminary support for LNE100TX PCI cards. Should work for + PNIC2 cards. No MII support, but single interface (RJ45) tulip + cards seem to not care. + 03 Dec 1999 mdc 0.75b2 + Renamed from mx987x5 to tulip, merged in original tulip init code + from tulip.c to support other tulip compatible cards. + 02 Dec 1999 mdc 0.75b1 + Released Beta MX987x5 Driver for code review and testing to netboot + and thinguin mailing lists. +*/ + +/*********************************************************************/ +/* Declarations */ +/*********************************************************************/ + +#include "etherboot.h" +#include "nic.h" +#include "pci.h" + +/* User settable parameters */ + +#undef TULIP_DEBUG +#undef TULIP_DEBUG_WHERE +#ifdef TULIP_DEBUG +static int tulip_debug = 2; /* 1 normal messages, 0 quiet .. 7 verbose. */ +#endif + +#define TX_TIME_OUT 2*TICKS_PER_SEC + +typedef uint8_t u8; +typedef int8_t s8; +typedef uint16_t u16; +typedef int16_t s16; +typedef uint32_t u32; +typedef int32_t s32; + +/* helpful macros if on a big_endian machine for changing byte order. + not strictly needed on Intel */ +#define get_unaligned(ptr) (*(ptr)) +#define put_unaligned(val, ptr) ((void)( *(ptr) = (val) )) +#define get_u16(ptr) (*(u16 *)(ptr)) +#define virt_to_le32desc(addr) virt_to_bus(addr) + +#define TULIP_IOTYPE PCI_USES_MASTER | PCI_USES_IO | PCI_ADDR0 +#define TULIP_SIZE 0x80 + +/* This is a mysterious value that can be written to CSR11 in the 21040 (only) + to support a pre-NWay full-duplex signaling mechanism using short frames. + No one knows what it should be, but if left at its default value some + 10base2(!) packets trigger a full-duplex-request interrupt. */ +#define FULL_DUPLEX_MAGIC 0x6969 + +static const int csr0 = 0x01A00000 | 0x8000; + +/* The possible media types that can be set in options[] are: */ +#define MEDIA_MASK 31 +static const char * const medianame[32] = { + "10baseT", "10base2", "AUI", "100baseTx", + "10baseT-FDX", "100baseTx-FDX", "100baseT4", "100baseFx", + "100baseFx-FDX", "MII 10baseT", "MII 10baseT-FDX", "MII", + "10baseT(forced)", "MII 100baseTx", "MII 100baseTx-FDX", "MII 100baseT4", + "MII 100baseFx-HDX", "MII 100baseFx-FDX", "Home-PNA 1Mbps", "Invalid-19", +}; + +/* This much match tulip_tbl[]! Note 21142 == 21143. */ +enum tulip_chips { + DC21040=0, DC21041=1, DC21140=2, DC21142=3, DC21143=3, + LC82C168, MX98713, MX98715, MX98725, AX88141, AX88140, PNIC2, COMET, + COMPEX9881, I21145, XIRCOM +}; + +enum pci_id_flags_bits { + /* Set PCI command register bits before calling probe1(). */ + PCI_USES_IO=1, PCI_USES_MEM=2, PCI_USES_MASTER=4, + /* Read and map the single following PCI BAR. */ + PCI_ADDR0=0<<4, PCI_ADDR1=1<<4, PCI_ADDR2=2<<4, PCI_ADDR3=3<<4, + PCI_ADDR_64BITS=0x100, PCI_NO_ACPI_WAKE=0x200, PCI_NO_MIN_LATENCY=0x400, + PCI_UNUSED_IRQ=0x800, +}; + +struct pci_id_info { + char *name; + struct match_info { + u32 pci, pci_mask, subsystem, subsystem_mask; + u32 revision, revision_mask; /* Only 8 bits. */ + } id; + enum pci_id_flags_bits pci_flags; + int io_size; /* Needed for I/O region check or ioremap(). */ + int drv_flags; /* Driver use, intended as capability flags. */ +}; + +static struct pci_id_info pci_id_tbl[] = { + { "Digital DC21040 Tulip", { 0x00021011, 0xffffffff, 0, 0, 0, 0 }, + TULIP_IOTYPE, 0x80, DC21040 }, + { "Digital DC21041 Tulip", { 0x00141011, 0xffffffff, 0, 0, 0, 0 }, + TULIP_IOTYPE, 0x80, DC21041 }, + { "Digital DS21140A Tulip", { 0x00091011, 0xffffffff, 0,0, 0x20,0xf0 }, + TULIP_IOTYPE, 0x80, DC21140 }, + { "Digital DS21140 Tulip", { 0x00091011, 0xffffffff, 0, 0, 0, 0 }, + TULIP_IOTYPE, 0x80, DC21140 }, + { "Digital DS21143 Tulip", { 0x00191011, 0xffffffff, 0,0, 65,0xff }, + TULIP_IOTYPE, TULIP_SIZE, DC21142 }, + { "Digital DS21142 Tulip", { 0x00191011, 0xffffffff, 0, 0, 0, 0 }, + TULIP_IOTYPE, TULIP_SIZE, DC21142 }, + { "Kingston KNE110tx (PNIC)", { 0x000211AD, 0xffffffff, 0xf0022646, 0xffffffff, 0, 0 }, + TULIP_IOTYPE, 256, LC82C168 }, + { "Lite-On 82c168 PNIC", { 0x000211AD, 0xffffffff, 0, 0, 0, 0 }, + TULIP_IOTYPE, 256, LC82C168 }, + { "Macronix 98713 PMAC", { 0x051210d9, 0xffffffff, 0, 0, 0, 0 }, + TULIP_IOTYPE, 256, MX98713 }, + { "Macronix 98715 PMAC", { 0x053110d9, 0xffffffff, 0, 0, 0, 0 }, + TULIP_IOTYPE, 256, MX98715 }, + { "Macronix 98725 PMAC", { 0x053110d9, 0xffffffff, 0, 0, 0, 0 }, + TULIP_IOTYPE, 256, MX98725 }, + { "ASIX AX88141", { 0x1400125B, 0xffffffff, 0,0, 0x10, 0xf0 }, + TULIP_IOTYPE, 128, AX88141 }, + { "ASIX AX88140", { 0x1400125B, 0xffffffff, 0, 0, 0, 0 }, + TULIP_IOTYPE, 128, AX88140 }, + { "Lite-On LC82C115 PNIC-II", { 0xc11511AD, 0xffffffff, 0, 0, 0, 0 }, + TULIP_IOTYPE, 256, PNIC2 }, + { "ADMtek AN981 Comet", { 0x09811317, 0xffffffff, 0, 0, 0, 0 }, + TULIP_IOTYPE, 256, COMET }, + { "ADMTek AN983 Comet", { 0x12161113, 0xffffffff, 0, 0, 0, 0 }, + TULIP_IOTYPE, 256, COMET }, + { "ADMtek Centaur-P", { 0x09851317, 0xffffffff, 0, 0, 0, 0 }, + TULIP_IOTYPE, 256, COMET }, + { "ADMtek Centaur-C", { 0x19851317, 0xffffffff, 0, 0, 0, 0 }, + TULIP_IOTYPE, 256, COMET }, + { "Compex RL100-TX", { 0x988111F6, 0xffffffff, 0, 0, 0, 0 }, + TULIP_IOTYPE, 128, COMPEX9881 }, + { "Intel 21145 Tulip", { 0x00398086, 0xffffffff, 0, 0, 0, 0 }, + TULIP_IOTYPE, 128, I21145 }, + { "Xircom Tulip clone", { 0x0003115d, 0xffffffff, 0, 0, 0, 0 }, + TULIP_IOTYPE, 128, XIRCOM }, + { "Davicom DM9102", { 0x91021282, 0xffffffff, 0, 0, 0, 0 }, + TULIP_IOTYPE, 0x80, DC21140 }, + { "Davicom DM9100", { 0x91001282, 0xffffffff, 0, 0, 0, 0 }, + TULIP_IOTYPE, 0x80, DC21140 }, + { "Macronix mxic-98715 (EN1217)", { 0x12171113, 0xffffffff, 0, 0, 0, 0 }, + TULIP_IOTYPE, 256, MX98715 }, + { 0, { 0, 0, 0, 0, 0, 0 }, 0, 0, 0 }, +}; + +enum tbl_flag { + HAS_MII=1, HAS_MEDIA_TABLE=2, CSR12_IN_SROM=4, ALWAYS_CHECK_MII=8, + HAS_PWRDWN=0x10, MC_HASH_ONLY=0x20, /* Hash-only multicast filter. */ + HAS_PNICNWAY=0x80, HAS_NWAY=0x40, /* Uses internal NWay xcvr. */ + HAS_INTR_MITIGATION=0x100, IS_ASIX=0x200, HAS_8023X=0x400, +}; + +/* Note: this table must match enum tulip_chips above. */ +static struct tulip_chip_table { + char *chip_name; + int flags; +} tulip_tbl[] = { + { "Digital DC21040 Tulip", 0}, + { "Digital DC21041 Tulip", HAS_MEDIA_TABLE | HAS_NWAY }, + { "Digital DS21140 Tulip", HAS_MII | HAS_MEDIA_TABLE | CSR12_IN_SROM }, + { "Digital DS21143 Tulip", HAS_MII | HAS_MEDIA_TABLE | ALWAYS_CHECK_MII + | HAS_PWRDWN | HAS_NWAY | HAS_INTR_MITIGATION }, + { "Lite-On 82c168 PNIC", HAS_MII | HAS_PNICNWAY }, + { "Macronix 98713 PMAC", HAS_MII | HAS_MEDIA_TABLE | CSR12_IN_SROM }, + { "Macronix 98715 PMAC", HAS_MEDIA_TABLE }, + { "Macronix 98725 PMAC", HAS_MEDIA_TABLE }, + { "ASIX AX88140", HAS_MII | HAS_MEDIA_TABLE | CSR12_IN_SROM + | MC_HASH_ONLY | IS_ASIX }, + { "ASIX AX88141", HAS_MII | HAS_MEDIA_TABLE | CSR12_IN_SROM | MC_HASH_ONLY + | IS_ASIX }, + { "Lite-On PNIC-II", HAS_MII | HAS_NWAY | HAS_8023X }, + { "ADMtek Comet", MC_HASH_ONLY }, + { "Compex 9881 PMAC", HAS_MII | HAS_MEDIA_TABLE | CSR12_IN_SROM }, + { "Intel DS21145 Tulip", HAS_MII | HAS_MEDIA_TABLE | ALWAYS_CHECK_MII + | HAS_PWRDWN | HAS_NWAY }, + { "Xircom tulip work-alike", HAS_MII | HAS_MEDIA_TABLE | ALWAYS_CHECK_MII + | HAS_PWRDWN | HAS_NWAY }, + { 0, 0 }, +}; + +/* A full-duplex map for media types. */ +enum MediaIs { + MediaIsFD = 1, MediaAlwaysFD=2, MediaIsMII=4, MediaIsFx=8, + MediaIs100=16}; + +static const char media_cap[32] = +{0,0,0,16, 3,19,16,24, 27,4,7,5, 0,20,23,20, 20,31,0,0, }; +static u8 t21040_csr13[] = {2,0x0C,8,4, 4,0,0,0, 0,0,0,0, 4,0,0,0}; + +/* 21041 transceiver register settings: 10-T, 10-2, AUI, 10-T, 10T-FD */ +static u16 t21041_csr13[] = { 0xEF01, 0xEF09, 0xEF09, 0xEF01, 0xEF09, }; +static u16 t21041_csr14[] = { 0xFFFF, 0xF7FD, 0xF7FD, 0x7F3F, 0x7F3D, }; +static u16 t21041_csr15[] = { 0x0008, 0x0006, 0x000E, 0x0008, 0x0008, }; + +/* not used +static u16 t21142_csr13[] = { 0x0001, 0x0009, 0x0009, 0x0000, 0x0001, }; +*/ +static u16 t21142_csr14[] = { 0xFFFF, 0x0705, 0x0705, 0x0000, 0x7F3D, }; +/* not used +static u16 t21142_csr15[] = { 0x0008, 0x0006, 0x000E, 0x0008, 0x0008, }; +*/ + +/* Offsets to the Command and Status Registers, "CSRs". All accesses + must be longword instructions and quadword aligned. */ +enum tulip_offsets { + CSR0=0, CSR1=0x08, CSR2=0x10, CSR3=0x18, CSR4=0x20, CSR5=0x28, + CSR6=0x30, CSR7=0x38, CSR8=0x40, CSR9=0x48, CSR10=0x50, CSR11=0x58, + CSR12=0x60, CSR13=0x68, CSR14=0x70, CSR15=0x78, CSR16=0x80, CSR20=0xA0 +}; + +/* The bits in the CSR5 status registers, mostly interrupt sources. */ +enum status_bits { + TimerInt=0x800, TPLnkFail=0x1000, TPLnkPass=0x10, + NormalIntr=0x10000, AbnormalIntr=0x8000, + RxJabber=0x200, RxDied=0x100, RxNoBuf=0x80, RxIntr=0x40, + TxFIFOUnderflow=0x20, TxJabber=0x08, TxNoBuf=0x04, TxDied=0x02, TxIntr=0x01, +}; + +/* The configuration bits in CSR6. */ +enum csr6_mode_bits { + TxOn=0x2000, RxOn=0x0002, FullDuplex=0x0200, + AcceptBroadcast=0x0100, AcceptAllMulticast=0x0080, + AcceptAllPhys=0x0040, AcceptRunt=0x0008, +}; + + +enum desc_status_bits { + DescOwnded=0x80000000, RxDescFatalErr=0x8000, RxWholePkt=0x0300, +}; + +struct medialeaf { + u8 type; + u8 media; + unsigned char *leafdata; +}; + +struct mediatable { + u16 defaultmedia; + u8 leafcount, csr12dir; /* General purpose pin directions. */ + unsigned has_mii:1, has_nonmii:1, has_reset:6; + u32 csr15dir, csr15val; /* 21143 NWay setting. */ + struct medialeaf mleaf[0]; +}; + +struct mediainfo { + struct mediainfo *next; + int info_type; + int index; + unsigned char *info; +}; + +/* EEPROM Address width definitions */ +#define EEPROM_ADDRLEN 6 +#define EEPROM_SIZE 128 /* 2 << EEPROM_ADDRLEN */ + +/* The EEPROM commands include the alway-set leading bit. */ +#define EE_WRITE_CMD (5 << addr_len) +#define EE_READ_CMD (6 << addr_len) +#define EE_ERASE_CMD (7 << addr_len) + +/* EEPROM_Ctrl bits. */ +#define EE_SHIFT_CLK 0x02 /* EEPROM shift clock. */ +#define EE_CS 0x01 /* EEPROM chip select. */ +#define EE_DATA_WRITE 0x04 /* EEPROM chip data in. */ +#define EE_WRITE_0 0x01 +#define EE_WRITE_1 0x05 +#define EE_DATA_READ 0x08 /* EEPROM chip data out. */ +#define EE_ENB (0x4800 | EE_CS) + +/* Delay between EEPROM clock transitions. Even at 33Mhz current PCI + implementations don't overrun the EEPROM clock. We add a bus + turn-around to insure that this remains true. */ +#define eeprom_delay() inl(ee_addr) + +/* Size of transmit and receive buffers */ +#define BUFLEN 1536 + +/* Ring-wrap flag in length field, use for last ring entry. + 0x01000000 means chain on buffer2 address, + 0x02000000 means use the ring start address in CSR2/3. + Note: Some work-alike chips do not function correctly in chained mode. + The ASIX chip works only in chained mode. + Thus we indicate ring mode, but always write the 'next' field for + chained mode as well. */ +#define DESC_RING_WRAP 0x02000000 + +/* transmit and receive descriptor format */ +struct tulip_rx_desc { + volatile u32 status; + u32 length; + u32 buffer1, buffer2; +}; + +struct tulip_tx_desc { + volatile u32 status; + u32 length; + u32 buffer1, buffer2; +}; + +/*********************************************************************/ +/* Global Storage */ +/*********************************************************************/ + +static u32 ioaddr; + +/* Note: transmit and receive buffers must be longword aligned and + longword divisable */ + +#define TX_RING_SIZE 2 +static struct tulip_tx_desc tx_ring[TX_RING_SIZE] __attribute__ ((aligned(4))); +static unsigned char txb[BUFLEN] __attribute__ ((aligned(4))); + +#define RX_RING_SIZE 4 +static struct tulip_rx_desc rx_ring[RX_RING_SIZE] __attribute__ ((aligned(4))); +static unsigned char rxb[RX_RING_SIZE * BUFLEN] __attribute__ ((aligned(4))); + +static struct tulip_private { + int cur_rx; + int chip_id; /* index into tulip_tbl[] */ + int pci_id_idx; /* index into pci_id_tbl[] */ + int revision; + int flags; + unsigned short vendor_id; /* PCI card vendor code */ + unsigned short dev_id; /* PCI card device code */ + unsigned char ehdr[ETH_HLEN]; /* buffer for ethernet header */ + const char *nic_name; + unsigned int csr0, csr6; /* Current CSR0, CSR6 settings. */ + unsigned int if_port; + unsigned int full_duplex; /* Full-duplex operation requested. */ + unsigned int full_duplex_lock; + unsigned int medialock; /* Do not sense media type. */ + unsigned int mediasense; /* Media sensing in progress. */ + unsigned int nway, nwayset; /* 21143 internal NWay. */ + unsigned int default_port; + unsigned char eeprom[EEPROM_SIZE]; /* Serial EEPROM contents. */ + u8 media_table_storage[(sizeof(struct mediatable) + 32*sizeof(struct medialeaf))]; + u16 sym_advertise, mii_advertise; /* NWay to-advertise. */ + struct mediatable *mtable; + u16 lpar; /* 21143 Link partner ability. */ + u16 advertising[4]; /* MII advertise, from SROM table. */ + signed char phys[4], mii_cnt; /* MII device addresses. */ + int cur_index; /* Current media index. */ + int saved_if_port; +} tpx; + +static struct tulip_private *tp; + +/* Known cards that have old-style EEPROMs. + Writing this table is described at + http://cesdis.gsfc.nasa.gov/linux/drivers/tulip-drivers/tulip-media.html */ +static struct fixups { + char *name; + unsigned char addr0, addr1, addr2; + u16 newtable[32]; /* Max length below. */ +} eeprom_fixups[] = { + {"Asante", 0, 0, 0x94, {0x1e00, 0x0000, 0x0800, 0x0100, 0x018c, + 0x0000, 0x0000, 0xe078, 0x0001, 0x0050, 0x0018 }}, + {"SMC9332DST", 0, 0, 0xC0, { 0x1e00, 0x0000, 0x0800, 0x041f, + 0x0000, 0x009E, /* 10baseT */ + 0x0004, 0x009E, /* 10baseT-FD */ + 0x0903, 0x006D, /* 100baseTx */ + 0x0905, 0x006D, /* 100baseTx-FD */ }}, + {"Cogent EM100", 0, 0, 0x92, { 0x1e00, 0x0000, 0x0800, 0x063f, + 0x0107, 0x8021, /* 100baseFx */ + 0x0108, 0x8021, /* 100baseFx-FD */ + 0x0100, 0x009E, /* 10baseT */ + 0x0104, 0x009E, /* 10baseT-FD */ + 0x0103, 0x006D, /* 100baseTx */ + 0x0105, 0x006D, /* 100baseTx-FD */ }}, + {"Maxtech NX-110", 0, 0, 0xE8, { 0x1e00, 0x0000, 0x0800, 0x0513, + 0x1001, 0x009E, /* 10base2, CSR12 0x10*/ + 0x0000, 0x009E, /* 10baseT */ + 0x0004, 0x009E, /* 10baseT-FD */ + 0x0303, 0x006D, /* 100baseTx, CSR12 0x03 */ + 0x0305, 0x006D, /* 100baseTx-FD CSR12 0x03 */}}, + {"Accton EN1207", 0, 0, 0xE8, { 0x1e00, 0x0000, 0x0800, 0x051F, + 0x1B01, 0x0000, /* 10base2, CSR12 0x1B */ + 0x0B00, 0x009E, /* 10baseT, CSR12 0x0B */ + 0x0B04, 0x009E, /* 10baseT-FD,CSR12 0x0B */ + 0x1B03, 0x006D, /* 100baseTx, CSR12 0x1B */ + 0x1B05, 0x006D, /* 100baseTx-FD CSR12 0x1B */ + }}, + {0, 0, 0, 0, {}}}; + +static const char * block_name[] = {"21140 non-MII", "21140 MII PHY", + "21142 Serial PHY", "21142 MII PHY", "21143 SYM PHY", "21143 reset method"}; + +/*********************************************************************/ +/* Function Prototypes */ +/*********************************************************************/ +static int mdio_read(struct nic *nic, int phy_id, int location); +static void mdio_write(struct nic *nic, int phy_id, int location, int value); +static int read_eeprom(unsigned long ioaddr, int location, int addr_len); +static void parse_eeprom(struct nic *nic); +static int tulip_probe(struct dev *dev, struct pci_device *pci); +static void tulip_init_ring(struct nic *nic); +static void tulip_reset(struct nic *nic); +static void tulip_transmit(struct nic *nic, const char *d, unsigned int t, + unsigned int s, const char *p); +static int tulip_poll(struct nic *nic, int retrieve); +static void tulip_disable(struct dev *dev); +static void nway_start(struct nic *nic); +static void pnic_do_nway(struct nic *nic); +static void select_media(struct nic *nic, int startup); +static void init_media(struct nic *nic); +static void start_link(struct nic *nic); +static int tulip_check_duplex(struct nic *nic); + +static void tulip_wait(unsigned int nticks); + +#ifdef TULIP_DEBUG_WHERE +static void whereami(const char *str); +#endif + +#ifdef TULIP_DEBUG +static void tulip_more(void); +#endif + +/*********************************************************************/ +/* Utility Routines */ +/*********************************************************************/ + +#ifdef TULIP_DEBUG_WHERE +static void whereami (const char *str) +{ + printf("%s: %s\n", tp->nic_name, str); + /* sleep(2); */ +} +#endif + +#ifdef TULIP_DEBUG +static void tulip_more(void) +{ + printf("\n\n-- more --"); + while (!iskey()) + /* wait */; + getchar(); + printf("\n\n"); +} +#endif /* TULIP_DEBUG */ + +static void tulip_wait(unsigned int nticks) +{ + unsigned int to = currticks() + nticks; + while (currticks() < to) + /* wait */ ; +} + +/*********************************************************************/ +/* Media Descriptor Code */ +/*********************************************************************/ + +/* MII transceiver control section. + Read and write the MII registers using software-generated serial + MDIO protocol. See the MII specifications or DP83840A data sheet + for details. */ + +/* The maximum data clock rate is 2.5 Mhz. The minimum timing is usually + met by back-to-back PCI I/O cycles, but we insert a delay to avoid + "overclocking" issues or future 66Mhz PCI. */ +#define mdio_delay() inl(mdio_addr) + +/* Read and write the MII registers using software-generated serial + MDIO protocol. It is just different enough from the EEPROM protocol + to not share code. The maxium data clock rate is 2.5 Mhz. */ +#define MDIO_SHIFT_CLK 0x10000 +#define MDIO_DATA_WRITE0 0x00000 +#define MDIO_DATA_WRITE1 0x20000 +#define MDIO_ENB 0x00000 /* Ignore the 0x02000 databook setting. */ +#define MDIO_ENB_IN 0x40000 +#define MDIO_DATA_READ 0x80000 + +/* MII transceiver control section. + Read and write the MII registers using software-generated serial + MDIO protocol. See the MII specifications or DP83840A data sheet + for details. */ + +int mdio_read(struct nic *nic __unused, int phy_id, int location) +{ + int i; + int read_cmd = (0xf6 << 10) | (phy_id << 5) | location; + int retval = 0; + long mdio_addr = ioaddr + CSR9; + +#ifdef TULIP_DEBUG_WHERE + whereami("mdio_read\n"); +#endif + + if (tp->chip_id == LC82C168) { + int i = 1000; + outl(0x60020000 + (phy_id<<23) + (location<<18), ioaddr + 0xA0); + inl(ioaddr + 0xA0); + inl(ioaddr + 0xA0); + while (--i > 0) + if ( ! ((retval = inl(ioaddr + 0xA0)) & 0x80000000)) + return retval & 0xffff; + return 0xffff; + } + + if (tp->chip_id == COMET) { + if (phy_id == 1) { + if (location < 7) + return inl(ioaddr + 0xB4 + (location<<2)); + else if (location == 17) + return inl(ioaddr + 0xD0); + else if (location >= 29 && location <= 31) + return inl(ioaddr + 0xD4 + ((location-29)<<2)); + } + return 0xffff; + } + + /* Establish sync by sending at least 32 logic ones. */ + for (i = 32; i >= 0; i--) { + outl(MDIO_ENB | MDIO_DATA_WRITE1, mdio_addr); + mdio_delay(); + outl(MDIO_ENB | MDIO_DATA_WRITE1 | MDIO_SHIFT_CLK, mdio_addr); + mdio_delay(); + } + /* Shift the read command bits out. */ + for (i = 15; i >= 0; i--) { + int dataval = (read_cmd & (1 << i)) ? MDIO_DATA_WRITE1 : 0; + + outl(MDIO_ENB | dataval, mdio_addr); + mdio_delay(); + outl(MDIO_ENB | dataval | MDIO_SHIFT_CLK, mdio_addr); + mdio_delay(); + } + /* Read the two transition, 16 data, and wire-idle bits. */ + for (i = 19; i > 0; i--) { + outl(MDIO_ENB_IN, mdio_addr); + mdio_delay(); + retval = (retval << 1) | ((inl(mdio_addr) & MDIO_DATA_READ) ? 1 : 0); + outl(MDIO_ENB_IN | MDIO_SHIFT_CLK, mdio_addr); + mdio_delay(); + } + return (retval>>1) & 0xffff; +} + +void mdio_write(struct nic *nic __unused, int phy_id, int location, int value) +{ + int i; + int cmd = (0x5002 << 16) | (phy_id << 23) | (location<<18) | value; + long mdio_addr = ioaddr + CSR9; + +#ifdef TULIP_DEBUG_WHERE + whereami("mdio_write\n"); +#endif + + if (tp->chip_id == LC82C168) { + int i = 1000; + outl(cmd, ioaddr + 0xA0); + do + if ( ! (inl(ioaddr + 0xA0) & 0x80000000)) + break; + while (--i > 0); + return; + } + + if (tp->chip_id == COMET) { + if (phy_id != 1) + return; + if (location < 7) + outl(value, ioaddr + 0xB4 + (location<<2)); + else if (location == 17) + outl(value, ioaddr + 0xD0); + else if (location >= 29 && location <= 31) + outl(value, ioaddr + 0xD4 + ((location-29)<<2)); + return; + } + + /* Establish sync by sending 32 logic ones. */ + for (i = 32; i >= 0; i--) { + outl(MDIO_ENB | MDIO_DATA_WRITE1, mdio_addr); + mdio_delay(); + outl(MDIO_ENB | MDIO_DATA_WRITE1 | MDIO_SHIFT_CLK, mdio_addr); + mdio_delay(); + } + /* Shift the command bits out. */ + for (i = 31; i >= 0; i--) { + int dataval = (cmd & (1 << i)) ? MDIO_DATA_WRITE1 : 0; + outl(MDIO_ENB | dataval, mdio_addr); + mdio_delay(); + outl(MDIO_ENB | dataval | MDIO_SHIFT_CLK, mdio_addr); + mdio_delay(); + } + /* Clear out extra bits. */ + for (i = 2; i > 0; i--) { + outl(MDIO_ENB_IN, mdio_addr); + mdio_delay(); + outl(MDIO_ENB_IN | MDIO_SHIFT_CLK, mdio_addr); + mdio_delay(); + } +} + +/*********************************************************************/ +/* EEPROM Reading Code */ +/*********************************************************************/ +/* EEPROM routines adapted from the Linux Tulip Code */ +/* Reading a serial EEPROM is a "bit" grungy, but we work our way + through:->. +*/ +static int read_eeprom(unsigned long ioaddr, int location, int addr_len) +{ + int i; + unsigned short retval = 0; + long ee_addr = ioaddr + CSR9; + int read_cmd = location | EE_READ_CMD; + +#ifdef TULIP_DEBUG_WHERE + whereami("read_eeprom\n"); +#endif + + outl(EE_ENB & ~EE_CS, ee_addr); + outl(EE_ENB, ee_addr); + + /* Shift the read command bits out. */ + for (i = 4 + addr_len; i >= 0; i--) { + short dataval = (read_cmd & (1 << i)) ? EE_DATA_WRITE : 0; + outl(EE_ENB | dataval, ee_addr); + eeprom_delay(); + outl(EE_ENB | dataval | EE_SHIFT_CLK, ee_addr); + eeprom_delay(); + } + outl(EE_ENB, ee_addr); + + for (i = 16; i > 0; i--) { + outl(EE_ENB | EE_SHIFT_CLK, ee_addr); + eeprom_delay(); + retval = (retval << 1) | ((inl(ee_addr) & EE_DATA_READ) ? 1 : 0); + outl(EE_ENB, ee_addr); + eeprom_delay(); + } + + /* Terminate the EEPROM access. */ + outl(EE_ENB & ~EE_CS, ee_addr); + return retval; +} + +/*********************************************************************/ +/* EEPROM Parsing Code */ +/*********************************************************************/ +static void parse_eeprom(struct nic *nic) +{ + unsigned char *p, *ee_data = tp->eeprom; + int new_advertise = 0; + int i; + +#ifdef TULIP_DEBUG_WHERE + whereami("parse_eeprom\n"); +#endif + + tp->mtable = 0; + /* Detect an old-style (SA only) EEPROM layout: + memcmp(ee_data, ee_data+16, 8). */ + for (i = 0; i < 8; i ++) + if (ee_data[i] != ee_data[16+i]) + break; + if (i >= 8) { + /* Do a fix-up based on the vendor half of the station address. */ + for (i = 0; eeprom_fixups[i].name; i++) { + if (nic->node_addr[0] == eeprom_fixups[i].addr0 + && nic->node_addr[1] == eeprom_fixups[i].addr1 + && nic->node_addr[2] == eeprom_fixups[i].addr2) { + if (nic->node_addr[2] == 0xE8 && ee_data[0x1a] == 0x55) + i++; /* An Accton EN1207, not an outlaw Maxtech. */ + memcpy(ee_data + 26, eeprom_fixups[i].newtable, + sizeof(eeprom_fixups[i].newtable)); +#ifdef TULIP_DEBUG + printf("%s: Old format EEPROM on '%s' board.\n%s: Using substitute media control info.\n", + tp->nic_name, eeprom_fixups[i].name, tp->nic_name); +#endif + break; + } + } + if (eeprom_fixups[i].name == NULL) { /* No fixup found. */ +#ifdef TULIP_DEBUG + printf("%s: Old style EEPROM with no media selection information.\n", + tp->nic_name); +#endif + return; + } + } + + if (ee_data[19] > 1) { +#ifdef TULIP_DEBUG + printf("%s: Multiport cards (%d ports) may not work correctly.\n", + tp->nic_name, ee_data[19]); +#endif + } + + p = (void *)ee_data + ee_data[27]; + + if (ee_data[27] == 0) { /* No valid media table. */ +#ifdef TULIP_DEBUG + if (tulip_debug > 1) { + printf("%s: No Valid Media Table. ee_data[27] = %hhX\n", + tp->nic_name, ee_data[27]); + } +#endif + } else if (tp->chip_id == DC21041) { + int media = get_u16(p); + int count = p[2]; + p += 3; + + printf("%s: 21041 Media table, default media %hX (%s).\n", + tp->nic_name, media, + media & 0x0800 ? "Autosense" : medianame[media & 15]); + for (i = 0; i < count; i++) { + unsigned char media_block = *p++; + int media_code = media_block & MEDIA_MASK; + if (media_block & 0x40) + p += 6; + switch(media_code) { + case 0: new_advertise |= 0x0020; break; + case 4: new_advertise |= 0x0040; break; + } + printf("%s: 21041 media #%d, %s.\n", + tp->nic_name, media_code, medianame[media_code]); + } + } else { + unsigned char csr12dir = 0; + int count; + struct mediatable *mtable; + u16 media = get_u16(p); + + p += 2; + if (tp->flags & CSR12_IN_SROM) + csr12dir = *p++; + count = *p++; + + tp->mtable = mtable = (struct mediatable *)&tp->media_table_storage[0]; + + mtable->defaultmedia = media; + mtable->leafcount = count; + mtable->csr12dir = csr12dir; + mtable->has_nonmii = mtable->has_mii = mtable->has_reset = 0; + mtable->csr15dir = mtable->csr15val = 0; + + printf("%s: EEPROM default media type %s.\n", tp->nic_name, + media & 0x0800 ? "Autosense" : medianame[media & MEDIA_MASK]); + + for (i = 0; i < count; i++) { + struct medialeaf *leaf = &mtable->mleaf[i]; + + if ((p[0] & 0x80) == 0) { /* 21140 Compact block. */ + leaf->type = 0; + leaf->media = p[0] & 0x3f; + leaf->leafdata = p; + if ((p[2] & 0x61) == 0x01) /* Bogus, but Znyx boards do it. */ + mtable->has_mii = 1; + p += 4; + } else { + switch(leaf->type = p[1]) { + case 5: + mtable->has_reset = i; + leaf->media = p[2] & 0x0f; + break; + case 1: case 3: + mtable->has_mii = 1; + leaf->media = 11; + break; + case 2: + if ((p[2] & 0x3f) == 0) { + u32 base15 = (p[2] & 0x40) ? get_u16(p + 7) : 0x0008; + u16 *p1 = (u16 *)(p + (p[2] & 0x40 ? 9 : 3)); + mtable->csr15dir = (get_unaligned(p1 + 0)<<16) + base15; + mtable->csr15val = (get_unaligned(p1 + 1)<<16) + base15; + } + /* Fall through. */ + case 0: case 4: + mtable->has_nonmii = 1; + leaf->media = p[2] & MEDIA_MASK; + switch (leaf->media) { + case 0: new_advertise |= 0x0020; break; + case 4: new_advertise |= 0x0040; break; + case 3: new_advertise |= 0x0080; break; + case 5: new_advertise |= 0x0100; break; + case 6: new_advertise |= 0x0200; break; + } + break; + default: + leaf->media = 19; + } + leaf->leafdata = p + 2; + p += (p[0] & 0x3f) + 1; + } +#ifdef TULIP_DEBUG + if (tulip_debug > 1 && leaf->media == 11) { + unsigned char *bp = leaf->leafdata; + printf("%s: MII interface PHY %d, setup/reset sequences %d/%d long, capabilities %hhX %hhX.\n", + tp->nic_name, bp[0], bp[1], bp[2 + bp[1]*2], + bp[5 + bp[2 + bp[1]*2]*2], bp[4 + bp[2 + bp[1]*2]*2]); + } +#endif + printf("%s: Index #%d - Media %s (#%d) described " + "by a %s (%d) block.\n", + tp->nic_name, i, medianame[leaf->media], leaf->media, + leaf->type < 6 ? block_name[leaf->type] : "UNKNOWN", + leaf->type); + } + if (new_advertise) + tp->sym_advertise = new_advertise; + } +} + +/*********************************************************************/ +/* tulip_init_ring - setup the tx and rx descriptors */ +/*********************************************************************/ +static void tulip_init_ring(struct nic *nic __unused) +{ + int i; + +#ifdef TULIP_DEBUG_WHERE + whereami("tulip_init_ring\n"); +#endif + + tp->cur_rx = 0; + + for (i = 0; i < RX_RING_SIZE; i++) { + rx_ring[i].status = cpu_to_le32(0x80000000); + rx_ring[i].length = cpu_to_le32(BUFLEN); + rx_ring[i].buffer1 = virt_to_le32desc(&rxb[i * BUFLEN]); + rx_ring[i].buffer2 = virt_to_le32desc(&rx_ring[i+1]); + } + /* Mark the last entry as wrapping the ring. */ + rx_ring[i-1].length = cpu_to_le32(DESC_RING_WRAP | BUFLEN); + rx_ring[i-1].buffer2 = virt_to_le32desc(&rx_ring[0]); + + /* We only use 1 transmit buffer, but we use 2 descriptors so + transmit engines have somewhere to point to if they feel the need */ + + tx_ring[0].status = 0x00000000; + tx_ring[0].buffer1 = virt_to_le32desc(&txb[0]); + tx_ring[0].buffer2 = virt_to_le32desc(&tx_ring[1]); + + /* this descriptor should never get used, since it will never be owned + by the machine (status will always == 0) */ + tx_ring[1].status = 0x00000000; + tx_ring[1].buffer1 = virt_to_le32desc(&txb[0]); + tx_ring[1].buffer2 = virt_to_le32desc(&tx_ring[0]); + + /* Mark the last entry as wrapping the ring, though this should never happen */ + tx_ring[1].length = cpu_to_le32(DESC_RING_WRAP | BUFLEN); +} + +static void set_rx_mode(struct nic *nic __unused) { + int csr6 = inl(ioaddr + CSR6) & ~0x00D5; + + tp->csr6 &= ~0x00D5; + + /* !IFF_PROMISC */ + tp->csr6 |= AcceptAllMulticast; + csr6 |= AcceptAllMulticast; + + outl(csr6, ioaddr + CSR6); + + + +} + +/*********************************************************************/ +/* eth_reset - Reset adapter */ +/*********************************************************************/ +static void tulip_reset(struct nic *nic) +{ + int i; + unsigned long to; + +#ifdef TULIP_DEBUG_WHERE + whereami("tulip_reset\n"); +#endif + + /* Stop Tx and RX */ + outl(inl(ioaddr + CSR6) & ~0x00002002, ioaddr + CSR6); + + /* On some chip revs we must set the MII/SYM port before the reset!? */ + if (tp->mii_cnt || (tp->mtable && tp->mtable->has_mii)) { + outl(0x814C0000, ioaddr + CSR6); + } + + /* Reset the chip, holding bit 0 set at least 50 PCI cycles. */ + outl(0x00000001, ioaddr + CSR0); + tulip_wait(1); + + /* turn off reset and set cache align=16lword, burst=unlimit */ + outl(tp->csr0, ioaddr + CSR0); + + /* Wait the specified 50 PCI cycles after a reset */ + tulip_wait(1); + + /* set up transmit and receive descriptors */ + tulip_init_ring(nic); + + if (tp->chip_id == PNIC2) { + u32 addr_high = (nic->node_addr[1]<<8) + (nic->node_addr[0]<<0); + /* This address setting does not appear to impact chip operation?? */ + outl((nic->node_addr[5]<<8) + nic->node_addr[4] + + (nic->node_addr[3]<<24) + (nic->node_addr[2]<<16), + ioaddr + 0xB0); + outl(addr_high + (addr_high<<16), ioaddr + 0xB8); + } + + /* MC_HASH_ONLY boards don't support setup packets */ + if (tp->flags & MC_HASH_ONLY) { + u32 addr_low = cpu_to_le32(get_unaligned((u32 *)nic->node_addr)); + u32 addr_high = cpu_to_le32(get_unaligned((u16 *)(nic->node_addr+4))); + + /* clear multicast hash filters and setup MAC address filters */ + if (tp->flags & IS_ASIX) { + outl(0, ioaddr + CSR13); + outl(addr_low, ioaddr + CSR14); + outl(1, ioaddr + CSR13); + outl(addr_high, ioaddr + CSR14); + outl(2, ioaddr + CSR13); + outl(0, ioaddr + CSR14); + outl(3, ioaddr + CSR13); + outl(0, ioaddr + CSR14); + } else if (tp->chip_id == COMET) { + outl(addr_low, ioaddr + 0xA4); + outl(addr_high, ioaddr + 0xA8); + outl(0, ioaddr + 0xAC); + outl(0, ioaddr + 0xB0); + } + } else { + /* for other boards we send a setup packet to initialize + the filters */ + u32 tx_flags = 0x08000000 | 192; + + /* construct perfect filter frame with mac address as first match + and broadcast address for all others */ + for (i=0; i<192; i++) + txb[i] = 0xFF; + txb[0] = nic->node_addr[0]; + txb[1] = nic->node_addr[1]; + txb[4] = nic->node_addr[2]; + txb[5] = nic->node_addr[3]; + txb[8] = nic->node_addr[4]; + txb[9] = nic->node_addr[5]; + + tx_ring[0].length = cpu_to_le32(tx_flags); + tx_ring[0].buffer1 = virt_to_le32desc(&txb[0]); + tx_ring[0].status = cpu_to_le32(0x80000000); + } + + /* Point to rx and tx descriptors */ + outl(virt_to_le32desc(&rx_ring[0]), ioaddr + CSR3); + outl(virt_to_le32desc(&tx_ring[0]), ioaddr + CSR4); + + init_media(nic); + + /* set the chip's operating mode (but don't turn on xmit and recv yet) */ + outl((tp->csr6 & ~0x00002002), ioaddr + CSR6); + + /* send setup packet for cards that support it */ + if (!(tp->flags & MC_HASH_ONLY)) { + /* enable transmit wait for completion */ + outl(tp->csr6 | 0x00002000, ioaddr + CSR6); + /* immediate transmit demand */ + outl(0, ioaddr + CSR1); + + to = currticks() + TX_TIME_OUT; + while ((tx_ring[0].status & 0x80000000) && (currticks() < to)) + /* wait */ ; + + if (currticks() >= to) { + printf ("%s: TX Setup Timeout.\n", tp->nic_name); + } + } + + if (tp->chip_id == LC82C168) + tulip_check_duplex(nic); + + set_rx_mode(nic); + + /* enable transmit and receive */ + outl(tp->csr6 | 0x00002002, ioaddr + CSR6); +} + +/*********************************************************************/ +/* eth_transmit - Transmit a frame */ +/*********************************************************************/ +static void tulip_transmit(struct nic *nic, const char *d, unsigned int t, + unsigned int s, const char *p) +{ + u16 nstype; + u32 to; + u32 csr6 = inl(ioaddr + CSR6); + +#ifdef TULIP_DEBUG_WHERE + whereami("tulip_transmit\n"); +#endif + + /* Disable Tx */ + outl(csr6 & ~0x00002000, ioaddr + CSR6); + + memcpy(txb, d, ETH_ALEN); + memcpy(txb + ETH_ALEN, nic->node_addr, ETH_ALEN); + nstype = htons((u16) t); + memcpy(txb + 2 * ETH_ALEN, (u8 *)&nstype, 2); + memcpy(txb + ETH_HLEN, p, s); + + s += ETH_HLEN; + s &= 0x0FFF; + + /* pad to minimum packet size */ + while (s < ETH_ZLEN) + txb[s++] = '\0'; + +#ifdef TULIP_DEBUG + if (tulip_debug > 1) + printf("%s: sending %d bytes ethtype %hX\n", tp->nic_name, s, t); +#endif + + /* setup the transmit descriptor */ + /* 0x60000000 = no interrupt on completion */ + tx_ring[0].length = cpu_to_le32(0x60000000 | s); + tx_ring[0].status = cpu_to_le32(0x80000000); + + /* Point to transmit descriptor */ + outl(virt_to_le32desc(&tx_ring[0]), ioaddr + CSR4); + + /* Enable Tx */ + outl(csr6 | 0x00002000, ioaddr + CSR6); + /* immediate transmit demand */ + outl(0, ioaddr + CSR1); + + to = currticks() + TX_TIME_OUT; + while ((tx_ring[0].status & 0x80000000) && (currticks() < to)) + /* wait */ ; + + if (currticks() >= to) { + printf ("TX Timeout!\n"); + } + + /* Disable Tx */ + outl(csr6 & ~0x00002000, ioaddr + CSR6); +} + +/*********************************************************************/ +/* eth_poll - Wait for a frame */ +/*********************************************************************/ +static int tulip_poll(struct nic *nic, int retrieve) +{ + +#ifdef TULIP_DEBUG_WHERE + whereami("tulip_poll\n"); +#endif + + /* no packet waiting. packet still owned by NIC */ + if (rx_ring[tp->cur_rx].status & 0x80000000) + return 0; + + if ( ! retrieve ) return 1; + +#ifdef TULIP_DEBUG_WHERE + whereami("tulip_poll got one\n"); +#endif + + nic->packetlen = (rx_ring[tp->cur_rx].status & 0x3FFF0000) >> 16; + + /* if we get a corrupted packet. throw it away and move on */ + if (rx_ring[tp->cur_rx].status & 0x00008000) { + /* return the descriptor and buffer to receive ring */ + rx_ring[tp->cur_rx].status = 0x80000000; + tp->cur_rx = (++tp->cur_rx) % RX_RING_SIZE; + return 0; + } + + /* copy packet to working buffer */ + memcpy(nic->packet, rxb + tp->cur_rx * BUFLEN, nic->packetlen); + + /* return the descriptor and buffer to receive ring */ + rx_ring[tp->cur_rx].status = 0x80000000; + tp->cur_rx = (++tp->cur_rx) % RX_RING_SIZE; + + return 1; +} + +/*********************************************************************/ +/* eth_disable - Disable the interface */ +/*********************************************************************/ +static void tulip_disable(struct dev *dev) +{ + struct nic *nic = (struct nic *)dev; +#ifdef TULIP_DEBUG_WHERE + whereami("tulip_disable\n"); +#endif + + /* merge reset and disable */ + tulip_reset(nic); + + /* disable interrupts */ + outl(0x00000000, ioaddr + CSR7); + + /* Stop the chip's Tx and Rx processes. */ + outl(inl(ioaddr + CSR6) & ~0x00002002, ioaddr + CSR6); + + /* Clear the missed-packet counter. */ + (volatile unsigned long)inl(ioaddr + CSR8); +} + +/*********************************************************************/ +/*IRQ - Enable, Disable, or Force interrupts */ +/*********************************************************************/ +static void tulip_irq(struct nic *nic __unused, irq_action_t action __unused) +{ + switch ( action ) { + case DISABLE : + break; + case ENABLE : + break; + case FORCE : + break; + } +} + +/*********************************************************************/ +/* eth_probe - Look for an adapter */ +/*********************************************************************/ +static int tulip_probe(struct dev *dev, struct pci_device *pci) +{ + struct nic *nic = (struct nic *)dev; + u32 i; + u8 chip_rev; + u8 ee_data[EEPROM_SIZE]; + unsigned short sum; + int chip_idx; + static unsigned char last_phys_addr[ETH_ALEN] = {0x00, 'L', 'i', 'n', 'u', 'x'}; + + if (pci->ioaddr == 0) + return 0; + + ioaddr = pci->ioaddr; + nic->ioaddr = pci->ioaddr & ~3; + nic->irqno = 0; + + /* point to private storage */ + tp = &tpx; + + tp->vendor_id = pci->vendor; + tp->dev_id = pci->dev_id; + tp->nic_name = pci->name; + + tp->if_port = 0; + tp->default_port = 0; + + adjust_pci_device(pci); + + /* disable interrupts */ + outl(0x00000000, ioaddr + CSR7); + + /* Stop the chip's Tx and Rx processes. */ + outl(inl(ioaddr + CSR6) & ~0x00002002, ioaddr + CSR6); + + /* Clear the missed-packet counter. */ + (volatile unsigned long)inl(ioaddr + CSR8); + + printf("\n"); /* so we start on a fresh line */ +#ifdef TULIP_DEBUG_WHERE + whereami("tulip_probe\n"); +#endif + +#ifdef TULIP_DEBUG + if (tulip_debug > 1) + printf ("%s: Looking for Tulip Chip: Vendor=%hX Device=%hX\n", tp->nic_name, + tp->vendor_id, tp->dev_id); +#endif + + /* Figure out which chip we're dealing with */ + i = 0; + chip_idx = -1; + + while (pci_id_tbl[i].name) { + if ( (((u32) tp->dev_id << 16) | tp->vendor_id) == + (pci_id_tbl[i].id.pci & pci_id_tbl[i].id.pci_mask) ) { + chip_idx = pci_id_tbl[i].drv_flags; + break; + } + i++; + } + + if (chip_idx == -1) { + printf ("%s: Unknown Tulip Chip: Vendor=%hX Device=%hX\n", tp->nic_name, + tp->vendor_id, tp->dev_id); + return 0; + } + + tp->pci_id_idx = i; + tp->flags = tulip_tbl[chip_idx].flags; + +#ifdef TULIP_DEBUG + if (tulip_debug > 1) { + printf ("%s: tp->pci_id_idx == %d, name == %s\n", tp->nic_name, + tp->pci_id_idx, pci_id_tbl[tp->pci_id_idx].name); + printf ("%s: chip_idx == %d, name == %s\n", tp->nic_name, chip_idx, + tulip_tbl[chip_idx].chip_name); + } +#endif + + /* Bring the 21041/21143 out of sleep mode. + Caution: Snooze mode does not work with some boards! */ + if (tp->flags & HAS_PWRDWN) + pcibios_write_config_dword(pci->bus, pci->devfn, 0x40, 0x00000000); + + if (inl(ioaddr + CSR5) == 0xFFFFFFFF) { + printf("%s: The Tulip chip at %X is not functioning.\n", + tp->nic_name, ioaddr); + return 0; + } + + pcibios_read_config_byte(pci->bus, pci->devfn, PCI_REVISION, &chip_rev); + + printf("%s: [chip: %s] rev %d at %hX\n", tp->nic_name, + tulip_tbl[chip_idx].chip_name, chip_rev, ioaddr); + printf("%s: Vendor=%hX Device=%hX", tp->nic_name, tp->vendor_id, tp->dev_id); + + if (chip_idx == DC21041 && inl(ioaddr + CSR9) & 0x8000) { + printf(" 21040 compatible mode."); + chip_idx = DC21040; + } + + printf("\n"); + + /* The SROM/EEPROM interface varies dramatically. */ + sum = 0; + if (chip_idx == DC21040) { + outl(0, ioaddr + CSR9); /* Reset the pointer with a dummy write. */ + for (i = 0; i < ETH_ALEN; i++) { + int value, boguscnt = 100000; + do + value = inl(ioaddr + CSR9); + while (value < 0 && --boguscnt > 0); + nic->node_addr[i] = value; + sum += value & 0xff; + } + } else if (chip_idx == LC82C168) { + for (i = 0; i < 3; i++) { + int value, boguscnt = 100000; + outl(0x600 | i, ioaddr + 0x98); + do + value = inl(ioaddr + CSR9); + while (value < 0 && --boguscnt > 0); + put_unaligned(le16_to_cpu(value), ((u16*)nic->node_addr) + i); + sum += value & 0xffff; + } + } else if (chip_idx == COMET) { + /* No need to read the EEPROM. */ + put_unaligned(inl(ioaddr + 0xA4), (u32 *)nic->node_addr); + put_unaligned(inl(ioaddr + 0xA8), (u16 *)(nic->node_addr + 4)); + for (i = 0; i < ETH_ALEN; i ++) + sum += nic->node_addr[i]; + } else { + /* A serial EEPROM interface, we read now and sort it out later. */ + int sa_offset = 0; + int ee_addr_size = read_eeprom(ioaddr, 0xff, 8) & 0x40000 ? 8 : 6; + + for (i = 0; i < sizeof(ee_data)/2; i++) + ((u16 *)ee_data)[i] = + le16_to_cpu(read_eeprom(ioaddr, i, ee_addr_size)); + + /* DEC now has a specification (see Notes) but early board makers + just put the address in the first EEPROM locations. */ + /* This does memcmp(eedata, eedata+16, 8) */ + for (i = 0; i < 8; i ++) + if (ee_data[i] != ee_data[16+i]) + sa_offset = 20; + if (ee_data[0] == 0xff && ee_data[1] == 0xff && ee_data[2] == 0) { + sa_offset = 2; /* Grrr, damn Matrox boards. */ + } + for (i = 0; i < ETH_ALEN; i ++) { + nic->node_addr[i] = ee_data[i + sa_offset]; + sum += ee_data[i + sa_offset]; + } + } + /* Lite-On boards have the address byte-swapped. */ + if ((nic->node_addr[0] == 0xA0 || nic->node_addr[0] == 0xC0) + && nic->node_addr[1] == 0x00) + for (i = 0; i < ETH_ALEN; i+=2) { + char tmp = nic->node_addr[i]; + nic->node_addr[i] = nic->node_addr[i+1]; + nic->node_addr[i+1] = tmp; + } + + if (sum == 0 || sum == ETH_ALEN*0xff) { + printf("%s: EEPROM not present!\n", tp->nic_name); + for (i = 0; i < ETH_ALEN-1; i++) + nic->node_addr[i] = last_phys_addr[i]; + nic->node_addr[i] = last_phys_addr[i] + 1; + } + + for (i = 0; i < ETH_ALEN; i++) + last_phys_addr[i] = nic->node_addr[i]; + + printf("%s: %! at ioaddr %hX\n", tp->nic_name, nic->node_addr, ioaddr); + + tp->chip_id = chip_idx; + tp->revision = chip_rev; + tp->csr0 = csr0; + + /* BugFixes: The 21143-TD hangs with PCI Write-and-Invalidate cycles. + And the ASIX must have a burst limit or horrible things happen. */ + if (chip_idx == DC21143 && chip_rev == 65) + tp->csr0 &= ~0x01000000; + else if (tp->flags & IS_ASIX) + tp->csr0 |= 0x2000; + + if (media_cap[tp->default_port] & MediaIsMII) { + u16 media2advert[] = { 0x20, 0x40, 0x03e0, 0x60, 0x80, 0x100, 0x200 }; + tp->mii_advertise = media2advert[tp->default_port - 9]; + tp->mii_advertise |= (tp->flags & HAS_8023X); /* Matching bits! */ + } + + /* This is logically part of the probe routine, but too complex + to write inline. */ + if (tp->flags & HAS_MEDIA_TABLE) { + memcpy(tp->eeprom, ee_data, sizeof(tp->eeprom)); + parse_eeprom(nic); + } + + start_link(nic); + + /* reset the device and make ready for tx and rx of packets */ + tulip_reset(nic); + + dev->disable = tulip_disable; + nic->poll = tulip_poll; + nic->transmit = tulip_transmit; + nic->irq = tulip_irq; + + /* give the board a chance to reset before returning */ + tulip_wait(4*TICKS_PER_SEC); + + return 1; +} + +static void start_link(struct nic *nic) +{ + int i; + +#ifdef TULIP_DEBUG_WHERE + whereami("start_link\n"); +#endif + + if ((tp->flags & ALWAYS_CHECK_MII) || + (tp->mtable && tp->mtable->has_mii) || + ( ! tp->mtable && (tp->flags & HAS_MII))) { + unsigned int phy, phy_idx; + if (tp->mtable && tp->mtable->has_mii) { + for (i = 0; i < tp->mtable->leafcount; i++) + if (tp->mtable->mleaf[i].media == 11) { + tp->cur_index = i; + tp->saved_if_port = tp->if_port; + select_media(nic, 2); + tp->if_port = tp->saved_if_port; + break; + } + } + + /* Find the connected MII xcvrs. */ + for (phy = 0, phy_idx = 0; phy < 32 && phy_idx < sizeof(tp->phys); + phy++) { + int mii_status = mdio_read(nic, phy, 1); + if ((mii_status & 0x8301) == 0x8001 || + ((mii_status & 0x8000) == 0 && (mii_status & 0x7800) != 0)) { + int mii_reg0 = mdio_read(nic, phy, 0); + int mii_advert = mdio_read(nic, phy, 4); + int to_advert; + + if (tp->mii_advertise) + to_advert = tp->mii_advertise; + else if (tp->advertising[phy_idx]) + to_advert = tp->advertising[phy_idx]; + else /* Leave unchanged. */ + tp->mii_advertise = to_advert = mii_advert; + + tp->phys[phy_idx++] = phy; + printf("%s: MII transceiver %d config %hX status %hX advertising %hX.\n", + tp->nic_name, phy, mii_reg0, mii_status, mii_advert); + /* Fixup for DLink with miswired PHY. */ + if (mii_advert != to_advert) { + printf("%s: Advertising %hX on PHY %d previously advertising %hX.\n", + tp->nic_name, to_advert, phy, mii_advert); + mdio_write(nic, phy, 4, to_advert); + } + /* Enable autonegotiation: some boards default to off. */ + mdio_write(nic, phy, 0, mii_reg0 | + (tp->full_duplex ? 0x1100 : 0x1000) | + (media_cap[tp->default_port]&MediaIs100 ? 0x2000:0)); + } + } + tp->mii_cnt = phy_idx; + if (tp->mtable && tp->mtable->has_mii && phy_idx == 0) { + printf("%s: ***WARNING***: No MII transceiver found!\n", + tp->nic_name); + tp->phys[0] = 1; + } + } + + /* Reset the xcvr interface and turn on heartbeat. */ + switch (tp->chip_id) { + case DC21040: + outl(0x00000000, ioaddr + CSR13); + outl(0x00000004, ioaddr + CSR13); + break; + case DC21041: + /* This is nway_start(). */ + if (tp->sym_advertise == 0) + tp->sym_advertise = 0x0061; + outl(0x00000000, ioaddr + CSR13); + outl(0xFFFFFFFF, ioaddr + CSR14); + outl(0x00000008, ioaddr + CSR15); /* Listen on AUI also. */ + outl(inl(ioaddr + CSR6) | 0x0200, ioaddr + CSR6); + outl(0x0000EF01, ioaddr + CSR13); + break; + case DC21140: default: + if (tp->mtable) + outl(tp->mtable->csr12dir | 0x100, ioaddr + CSR12); + break; + case DC21142: + case PNIC2: + if (tp->mii_cnt || media_cap[tp->if_port] & MediaIsMII) { + outl(0x82020000, ioaddr + CSR6); + outl(0x0000, ioaddr + CSR13); + outl(0x0000, ioaddr + CSR14); + outl(0x820E0000, ioaddr + CSR6); + } else + nway_start(nic); + break; + case LC82C168: + if ( ! tp->mii_cnt) { + tp->nway = 1; + tp->nwayset = 0; + outl(0x00420000, ioaddr + CSR6); + outl(0x30, ioaddr + CSR12); + outl(0x0001F078, ioaddr + 0xB8); + outl(0x0201F078, ioaddr + 0xB8); /* Turn on autonegotiation. */ + } + break; + case MX98713: case COMPEX9881: + outl(0x00000000, ioaddr + CSR6); + outl(0x000711C0, ioaddr + CSR14); /* Turn on NWay. */ + outl(0x00000001, ioaddr + CSR13); + break; + case MX98715: case MX98725: + outl(0x01a80000, ioaddr + CSR6); + outl(0xFFFFFFFF, ioaddr + CSR14); + outl(0x00001000, ioaddr + CSR12); + break; + case COMET: + /* No initialization necessary. */ + break; + } +} + +static void nway_start(struct nic *nic __unused) +{ + int csr14 = ((tp->sym_advertise & 0x0780) << 9) | + ((tp->sym_advertise&0x0020)<<1) | 0xffbf; + +#ifdef TULIP_DEBUG_WHERE + whereami("nway_start\n"); +#endif + + tp->if_port = 0; + tp->nway = tp->mediasense = 1; + tp->nwayset = tp->lpar = 0; + if (tp->chip_id == PNIC2) { + tp->csr6 = 0x01000000 | (tp->sym_advertise & 0x0040 ? 0x0200 : 0); + return; + } +#ifdef TULIP_DEBUG + if (tulip_debug > 1) + printf("%s: Restarting internal NWay autonegotiation, %X.\n", + tp->nic_name, csr14); +#endif + outl(0x0001, ioaddr + CSR13); + outl(csr14, ioaddr + CSR14); + tp->csr6 = 0x82420000 | (tp->sym_advertise & 0x0040 ? 0x0200 : 0); + outl(tp->csr6, ioaddr + CSR6); + if (tp->mtable && tp->mtable->csr15dir) { + outl(tp->mtable->csr15dir, ioaddr + CSR15); + outl(tp->mtable->csr15val, ioaddr + CSR15); + } else if (tp->chip_id != PNIC2) + outw(0x0008, ioaddr + CSR15); + if (tp->chip_id == DC21041) /* Trigger NWAY. */ + outl(0xEF01, ioaddr + CSR12); + else + outl(0x1301, ioaddr + CSR12); +} + +static void init_media(struct nic *nic) +{ + int i; + +#ifdef TULIP_DEBUG_WHERE + whereami("init_media\n"); +#endif + + tp->saved_if_port = tp->if_port; + if (tp->if_port == 0) + tp->if_port = tp->default_port; + + /* Allow selecting a default media. */ + i = 0; + if (tp->mtable == NULL) + goto media_picked; + if (tp->if_port) { + int looking_for = media_cap[tp->if_port] & MediaIsMII ? 11 : + (tp->if_port == 12 ? 0 : tp->if_port); + for (i = 0; i < tp->mtable->leafcount; i++) + if (tp->mtable->mleaf[i].media == looking_for) { + printf("%s: Using user-specified media %s.\n", + tp->nic_name, medianame[tp->if_port]); + goto media_picked; + } + } + if ((tp->mtable->defaultmedia & 0x0800) == 0) { + int looking_for = tp->mtable->defaultmedia & 15; + for (i = 0; i < tp->mtable->leafcount; i++) + if (tp->mtable->mleaf[i].media == looking_for) { + printf("%s: Using EEPROM-set media %s.\n", + tp->nic_name, medianame[looking_for]); + goto media_picked; + } + } + /* Start sensing first non-full-duplex media. */ + for (i = tp->mtable->leafcount - 1; + (media_cap[tp->mtable->mleaf[i].media] & MediaAlwaysFD) && i > 0; i--) + ; + media_picked: + + tp->csr6 = 0; + tp->cur_index = i; + tp->nwayset = 0; + + if (tp->if_port) { + if (tp->chip_id == DC21143 && media_cap[tp->if_port] & MediaIsMII) { + /* We must reset the media CSRs when we force-select MII mode. */ + outl(0x0000, ioaddr + CSR13); + outl(0x0000, ioaddr + CSR14); + outl(0x0008, ioaddr + CSR15); + } + select_media(nic, 1); + return; + } + switch(tp->chip_id) { + case DC21041: + /* tp->nway = 1;*/ + nway_start(nic); + break; + case DC21142: + if (tp->mii_cnt) { + select_media(nic, 1); +#ifdef TULIP_DEBUG + if (tulip_debug > 1) + printf("%s: Using MII transceiver %d, status %hX.\n", + tp->nic_name, tp->phys[0], mdio_read(nic, tp->phys[0], 1)); +#endif + outl(0x82020000, ioaddr + CSR6); + tp->csr6 = 0x820E0000; + tp->if_port = 11; + outl(0x0000, ioaddr + CSR13); + outl(0x0000, ioaddr + CSR14); + } else + nway_start(nic); + break; + case PNIC2: + nway_start(nic); + break; + case LC82C168: + if (tp->mii_cnt) { + tp->if_port = 11; + tp->csr6 = 0x814C0000 | (tp->full_duplex ? 0x0200 : 0); + outl(0x0001, ioaddr + CSR15); + } else if (inl(ioaddr + CSR5) & TPLnkPass) + pnic_do_nway(nic); + else { + /* Start with 10mbps to do autonegotiation. */ + outl(0x32, ioaddr + CSR12); + tp->csr6 = 0x00420000; + outl(0x0001B078, ioaddr + 0xB8); + outl(0x0201B078, ioaddr + 0xB8); + } + break; + case MX98713: case COMPEX9881: + tp->if_port = 0; + tp->csr6 = 0x01880000 | (tp->full_duplex ? 0x0200 : 0); + outl(0x0f370000 | inw(ioaddr + 0x80), ioaddr + 0x80); + break; + case MX98715: case MX98725: + /* Provided by BOLO, Macronix - 12/10/1998. */ + tp->if_port = 0; + tp->csr6 = 0x01a80200; + outl(0x0f370000 | inw(ioaddr + 0x80), ioaddr + 0x80); + outl(0x11000 | inw(ioaddr + 0xa0), ioaddr + 0xa0); + break; + case COMET: + tp->if_port = 0; + tp->csr6 = 0x00040000; + break; + case AX88140: case AX88141: + tp->csr6 = tp->mii_cnt ? 0x00040100 : 0x00000100; + break; + default: + select_media(nic, 1); + } +} + +static void pnic_do_nway(struct nic *nic __unused) +{ + u32 phy_reg = inl(ioaddr + 0xB8); + u32 new_csr6 = tp->csr6 & ~0x40C40200; + +#ifdef TULIP_DEBUG_WHERE + whereami("pnic_do_nway\n"); +#endif + + if (phy_reg & 0x78000000) { /* Ignore baseT4 */ + if (phy_reg & 0x20000000) tp->if_port = 5; + else if (phy_reg & 0x40000000) tp->if_port = 3; + else if (phy_reg & 0x10000000) tp->if_port = 4; + else if (phy_reg & 0x08000000) tp->if_port = 0; + tp->nwayset = 1; + new_csr6 = (tp->if_port & 1) ? 0x01860000 : 0x00420000; + outl(0x32 | (tp->if_port & 1), ioaddr + CSR12); + if (tp->if_port & 1) + outl(0x1F868, ioaddr + 0xB8); + if (phy_reg & 0x30000000) { + tp->full_duplex = 1; + new_csr6 |= 0x00000200; + } +#ifdef TULIP_DEBUG + if (tulip_debug > 1) + printf("%s: PNIC autonegotiated status %X, %s.\n", + tp->nic_name, phy_reg, medianame[tp->if_port]); +#endif + if (tp->csr6 != new_csr6) { + tp->csr6 = new_csr6; + outl(tp->csr6 | 0x0002, ioaddr + CSR6); /* Restart Tx */ + outl(tp->csr6 | 0x2002, ioaddr + CSR6); + } + } +} + +/* Set up the transceiver control registers for the selected media type. */ +static void select_media(struct nic *nic, int startup) +{ + struct mediatable *mtable = tp->mtable; + u32 new_csr6; + int i; + +#ifdef TULIP_DEBUG_WHERE + whereami("select_media\n"); +#endif + + if (mtable) { + struct medialeaf *mleaf = &mtable->mleaf[tp->cur_index]; + unsigned char *p = mleaf->leafdata; + switch (mleaf->type) { + case 0: /* 21140 non-MII xcvr. */ +#ifdef TULIP_DEBUG + if (tulip_debug > 1) + printf("%s: Using a 21140 non-MII transceiver" + " with control setting %hhX.\n", + tp->nic_name, p[1]); +#endif + tp->if_port = p[0]; + if (startup) + outl(mtable->csr12dir | 0x100, ioaddr + CSR12); + outl(p[1], ioaddr + CSR12); + new_csr6 = 0x02000000 | ((p[2] & 0x71) << 18); + break; + case 2: case 4: { + u16 setup[5]; + u32 csr13val, csr14val, csr15dir, csr15val; + for (i = 0; i < 5; i++) + setup[i] = get_u16(&p[i*2 + 1]); + + tp->if_port = p[0] & 15; + if (media_cap[tp->if_port] & MediaAlwaysFD) + tp->full_duplex = 1; + + if (startup && mtable->has_reset) { + struct medialeaf *rleaf = &mtable->mleaf[mtable->has_reset]; + unsigned char *rst = rleaf->leafdata; +#ifdef TULIP_DEBUG + if (tulip_debug > 1) + printf("%s: Resetting the transceiver.\n", + tp->nic_name); +#endif + for (i = 0; i < rst[0]; i++) + outl(get_u16(rst + 1 + (i<<1)) << 16, ioaddr + CSR15); + } +#ifdef TULIP_DEBUG + if (tulip_debug > 1) + printf("%s: 21143 non-MII %s transceiver control " + "%hX/%hX.\n", + tp->nic_name, medianame[tp->if_port], setup[0], setup[1]); +#endif + if (p[0] & 0x40) { /* SIA (CSR13-15) setup values are provided. */ + csr13val = setup[0]; + csr14val = setup[1]; + csr15dir = (setup[3]<<16) | setup[2]; + csr15val = (setup[4]<<16) | setup[2]; + outl(0, ioaddr + CSR13); + outl(csr14val, ioaddr + CSR14); + outl(csr15dir, ioaddr + CSR15); /* Direction */ + outl(csr15val, ioaddr + CSR15); /* Data */ + outl(csr13val, ioaddr + CSR13); + } else { + csr13val = 1; + csr14val = 0x0003FF7F; + csr15dir = (setup[0]<<16) | 0x0008; + csr15val = (setup[1]<<16) | 0x0008; + if (tp->if_port <= 4) + csr14val = t21142_csr14[tp->if_port]; + if (startup) { + outl(0, ioaddr + CSR13); + outl(csr14val, ioaddr + CSR14); + } + outl(csr15dir, ioaddr + CSR15); /* Direction */ + outl(csr15val, ioaddr + CSR15); /* Data */ + if (startup) outl(csr13val, ioaddr + CSR13); + } +#ifdef TULIP_DEBUG + if (tulip_debug > 1) + printf("%s: Setting CSR15 to %X/%X.\n", + tp->nic_name, csr15dir, csr15val); +#endif + if (mleaf->type == 4) + new_csr6 = 0x82020000 | ((setup[2] & 0x71) << 18); + else + new_csr6 = 0x82420000; + break; + } + case 1: case 3: { + int phy_num = p[0]; + int init_length = p[1]; + u16 *misc_info; + + tp->if_port = 11; + new_csr6 = 0x020E0000; + if (mleaf->type == 3) { /* 21142 */ + u16 *init_sequence = (u16*)(p+2); + u16 *reset_sequence = &((u16*)(p+3))[init_length]; + int reset_length = p[2 + init_length*2]; + misc_info = reset_sequence + reset_length; + if (startup) + for (i = 0; i < reset_length; i++) + outl(get_u16(&reset_sequence[i]) << 16, ioaddr + CSR15); + for (i = 0; i < init_length; i++) + outl(get_u16(&init_sequence[i]) << 16, ioaddr + CSR15); + } else { + u8 *init_sequence = p + 2; + u8 *reset_sequence = p + 3 + init_length; + int reset_length = p[2 + init_length]; + misc_info = (u16*)(reset_sequence + reset_length); + if (startup) { + outl(mtable->csr12dir | 0x100, ioaddr + CSR12); + for (i = 0; i < reset_length; i++) + outl(reset_sequence[i], ioaddr + CSR12); + } + for (i = 0; i < init_length; i++) + outl(init_sequence[i], ioaddr + CSR12); + } + tp->advertising[phy_num] = get_u16(&misc_info[1]) | 1; + if (startup < 2) { + if (tp->mii_advertise == 0) + tp->mii_advertise = tp->advertising[phy_num]; +#ifdef TULIP_DEBUG + if (tulip_debug > 1) + printf("%s: Advertising %hX on MII %d.\n", + tp->nic_name, tp->mii_advertise, tp->phys[phy_num]); +#endif + mdio_write(nic, tp->phys[phy_num], 4, tp->mii_advertise); + } + break; + } + default: + printf("%s: Invalid media table selection %d.\n", + tp->nic_name, mleaf->type); + new_csr6 = 0x020E0000; + } +#ifdef TULIP_DEBUG + if (tulip_debug > 1) + printf("%s: Using media type %s, CSR12 is %hhX.\n", + tp->nic_name, medianame[tp->if_port], + inl(ioaddr + CSR12) & 0xff); +#endif + } else if (tp->chip_id == DC21041) { + int port = tp->if_port <= 4 ? tp->if_port : 0; +#ifdef TULIP_DEBUG + if (tulip_debug > 1) + printf("%s: 21041 using media %s, CSR12 is %hX.\n", + tp->nic_name, medianame[port == 3 ? 12: port], + inl(ioaddr + CSR12)); +#endif + outl(0x00000000, ioaddr + CSR13); /* Reset the serial interface */ + outl(t21041_csr14[port], ioaddr + CSR14); + outl(t21041_csr15[port], ioaddr + CSR15); + outl(t21041_csr13[port], ioaddr + CSR13); + new_csr6 = 0x80020000; + } else if (tp->chip_id == LC82C168) { + if (startup && ! tp->medialock) + tp->if_port = tp->mii_cnt ? 11 : 0; +#ifdef TULIP_DEBUG + if (tulip_debug > 1) + printf("%s: PNIC PHY status is %hX, media %s.\n", + tp->nic_name, inl(ioaddr + 0xB8), medianame[tp->if_port]); +#endif + if (tp->mii_cnt) { + new_csr6 = 0x810C0000; + outl(0x0001, ioaddr + CSR15); + outl(0x0201B07A, ioaddr + 0xB8); + } else if (startup) { + /* Start with 10mbps to do autonegotiation. */ + outl(0x32, ioaddr + CSR12); + new_csr6 = 0x00420000; + outl(0x0001B078, ioaddr + 0xB8); + outl(0x0201B078, ioaddr + 0xB8); + } else if (tp->if_port == 3 || tp->if_port == 5) { + outl(0x33, ioaddr + CSR12); + new_csr6 = 0x01860000; + /* Trigger autonegotiation. */ + outl(startup ? 0x0201F868 : 0x0001F868, ioaddr + 0xB8); + } else { + outl(0x32, ioaddr + CSR12); + new_csr6 = 0x00420000; + outl(0x1F078, ioaddr + 0xB8); + } + } else if (tp->chip_id == DC21040) { /* 21040 */ + /* Turn on the xcvr interface. */ +#ifdef TULIP_DEBUG + int csr12 = inl(ioaddr + CSR12); + if (tulip_debug > 1) + printf("%s: 21040 media type is %s, CSR12 is %hhX.\n", + tp->nic_name, medianame[tp->if_port], csr12); +#endif + if (media_cap[tp->if_port] & MediaAlwaysFD) + tp->full_duplex = 1; + new_csr6 = 0x20000; + /* Set the full duplux match frame. */ + outl(FULL_DUPLEX_MAGIC, ioaddr + CSR11); + outl(0x00000000, ioaddr + CSR13); /* Reset the serial interface */ + if (t21040_csr13[tp->if_port] & 8) { + outl(0x0705, ioaddr + CSR14); + outl(0x0006, ioaddr + CSR15); + } else { + outl(0xffff, ioaddr + CSR14); + outl(0x0000, ioaddr + CSR15); + } + outl(0x8f01 | t21040_csr13[tp->if_port], ioaddr + CSR13); + } else { /* Unknown chip type with no media table. */ + if (tp->default_port == 0) + tp->if_port = tp->mii_cnt ? 11 : 3; + if (media_cap[tp->if_port] & MediaIsMII) { + new_csr6 = 0x020E0000; + } else if (media_cap[tp->if_port] & MediaIsFx) { + new_csr6 = 0x028600000; + } else + new_csr6 = 0x038600000; +#ifdef TULIP_DEBUG + if (tulip_debug > 1) + printf("%s: No media description table, assuming " + "%s transceiver, CSR12 %hhX.\n", + tp->nic_name, medianame[tp->if_port], + inl(ioaddr + CSR12)); +#endif + } + + tp->csr6 = new_csr6 | (tp->csr6 & 0xfdff) | (tp->full_duplex ? 0x0200 : 0); + return; +} + +/* + Check the MII negotiated duplex and change the CSR6 setting if + required. + Return 0 if everything is OK. + Return < 0 if the transceiver is missing or has no link beat. +*/ +static int tulip_check_duplex(struct nic *nic) +{ + unsigned int bmsr, lpa, negotiated, new_csr6; + + bmsr = mdio_read(nic, tp->phys[0], 1); + lpa = mdio_read(nic, tp->phys[0], 5); + +#ifdef TULIP_DEBUG + if (tulip_debug > 1) + printf("%s: MII status %#x, Link partner report " + "%#x.\n", tp->nic_name, bmsr, lpa); +#endif + + if (bmsr == 0xffff) + return -2; + if ((bmsr & 4) == 0) { + int new_bmsr = mdio_read(nic, tp->phys[0], 1); + if ((new_bmsr & 4) == 0) { +#ifdef TULIP_DEBUG + if (tulip_debug > 1) + printf("%s: No link beat on the MII interface," + " status %#x.\n", tp->nic_name, + new_bmsr); +#endif + return -1; + } + } + tp->full_duplex = lpa & 0x140; + + new_csr6 = tp->csr6; + negotiated = lpa & tp->advertising[0]; + + if(negotiated & 0x380) new_csr6 &= ~0x400000; + else new_csr6 |= 0x400000; + if (tp->full_duplex) new_csr6 |= 0x200; + else new_csr6 &= ~0x200; + + if (new_csr6 != tp->csr6) { + tp->csr6 = new_csr6; + +#ifdef TULIP_DEBUG + if (tulip_debug > 0) + printf("%s: Setting %s-duplex based on MII" + "#%d link partner capability of %#x.\n", + tp->nic_name, + tp->full_duplex ? "full" : "half", + tp->phys[0], lpa); +#endif + return 1; + } + + return 0; +} + +static struct pci_id tulip_nics[] = { +PCI_ROM(0x1011, 0x0002, "dc21040", "Digital Tulip"), +PCI_ROM(0x1011, 0x0009, "ds21140", "Digital Tulip Fast"), +PCI_ROM(0x1011, 0x0014, "dc21041", "Digital Tulip+"), +PCI_ROM(0x1011, 0x0019, "ds21142", "Digital Tulip 21142"), +PCI_ROM(0x10b7, 0x9300, "3csoho100b-tx","3ComSOHO100B-TX"), +PCI_ROM(0x10b9, 0x5261, "ali1563", "ALi 1563 integrated ethernet"), +PCI_ROM(0x10d9, 0x0512, "mx98713", "Macronix MX987x3"), +PCI_ROM(0x10d9, 0x0531, "mx98715", "Macronix MX987x5"), +PCI_ROM(0x1113, 0x1217, "mxic-98715", "Macronix MX987x5"), +PCI_ROM(0x11ad, 0xc115, "lc82c115", "LinkSys LNE100TX"), +PCI_ROM(0x11ad, 0x0002, "82c168", "Netgear FA310TX"), +PCI_ROM(0x1282, 0x9100, "dm9100", "Davicom 9100"), +PCI_ROM(0x1282, 0x9102, "dm9102", "Davicom 9102"), +PCI_ROM(0x1282, 0x9009, "dm9009", "Davicom 9009"), +PCI_ROM(0x1282, 0x9132, "dm9132", "Davicom 9132"), +PCI_ROM(0x1317, 0x0985, "centaur-p", "ADMtek Centaur-P"), +PCI_ROM(0x1317, 0x0981, "an981", "ADMtek AN981 Comet"), /* ADMTek Centaur-P (stmicro) */ +PCI_ROM(0x1113, 0x1216, "an983", "ADMTek AN983 Comet"), +PCI_ROM(0x1317, 0x9511, "an983b", "ADMTek Comet 983b"), +PCI_ROM(0x1317, 0x1985, "centaur-c", "ADMTek Centaur-C"), +PCI_ROM(0x8086, 0x0039, "intel21145", "Intel Tulip"), +PCI_ROM(0x125b, 0x1400, "ax88140", "ASIX AX88140"), +PCI_ROM(0x11f6, 0x9881, "rl100tx", "Compex RL100-TX"), +PCI_ROM(0x115d, 0x0003, "xircomtulip", "Xircom Tulip"), +PCI_ROM(0x104a, 0x0981, "tulip-0981", "Tulip 0x104a 0x0981"), +PCI_ROM(0x104a, 0x2774, "tulip-2774", "Tulip 0x104a 0x2774"), +PCI_ROM(0x1113, 0x9511, "tulip-9511", "Tulip 0x1113 0x9511"), +PCI_ROM(0x1186, 0x1561, "tulip-1561", "Tulip 0x1186 0x1561"), +PCI_ROM(0x1259, 0xa120, "tulip-a120", "Tulip 0x1259 0xa120"), +PCI_ROM(0x13d1, 0xab02, "tulip-ab02", "Tulip 0x13d1 0xab02"), +PCI_ROM(0x13d1, 0xab03, "tulip-ab03", "Tulip 0x13d1 0xab03"), +PCI_ROM(0x13d1, 0xab08, "tulip-ab08", "Tulip 0x13d1 0xab08"), +PCI_ROM(0x14f1, 0x1803, "lanfinity", "Conexant LANfinity"), +PCI_ROM(0x1626, 0x8410, "tulip-8410", "Tulip 0x1626 0x8410"), +PCI_ROM(0x1737, 0xab08, "tulip-1737-ab08","Tulip 0x1737 0xab08"), +PCI_ROM(0x1737, 0xab09, "tulip-ab09", "Tulip 0x1737 0xab09"), +}; + +struct pci_driver tulip_driver = { + .type = NIC_DRIVER, + .name = "Tulip", + .probe = tulip_probe, + .ids = tulip_nics, + .id_count = sizeof(tulip_nics)/sizeof(tulip_nics[0]), + .class = 0, +}; diff --git a/usr/src/grub/grub-0.97/netboot/types.h b/usr/src/grub/grub-0.97/netboot/types.h new file mode 100644 index 0000000000..54fe5aafea --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/types.h @@ -0,0 +1,44 @@ +#ifndef _TYPES_H +#define _TYPES_H + +/* I'm architecture independed :-) */ + +/* + * It's architecture depended headers for common integer types + */ +#include "stdint.h" + +/* + * Here are some RPC types define from linux /usr/include/rpc/types.h + */ +typedef int bool_t; +typedef int enum_t; +typedef uint32_t rpcprog_t; +typedef uint32_t rpcvers_t; +typedef uint32_t rpcproc_t; +typedef uint32_t rpcprot_t; +typedef uint32_t rpcport_t; + +/* For bool_t */ +/* typedef enum { */ +/* FALSE = 0, */ +/* TRUE = 1 */ +/* } boolean_t; */ + + + +/* Some BSD or RPC style types */ +typedef unsigned char u_char; +typedef unsigned short u_short; +typedef unsigned int u_int; +typedef unsigned long u_long; +typedef long long quad_t; +typedef unsigned long long u_quad_t; +typedef struct { + int __val[2]; +}fsid_t; /* Type of file system IDs, from bits/types.h */ + +typedef int daddr_t; /* The type of a disk address, from bits/types.h */ +typedef char * caddr_t; + +#endif /* _TYPES_H */ diff --git a/usr/src/grub/grub-0.97/netboot/udp.h b/usr/src/grub/grub-0.97/netboot/udp.h new file mode 100644 index 0000000000..9d4f6123ea --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/udp.h @@ -0,0 +1,30 @@ +#ifndef _UDP_H +#define _UDP_H + +/* We need 'uint16_t' and 'uint8_t' */ +#include "types.h" +/* We need 'in_addr' */ +#include "in.h" + +struct udp_pseudo_hdr { + in_addr src; + in_addr dest; + uint8_t unused; + uint8_t protocol; + uint16_t len; +}; +struct udphdr { + uint16_t src; + uint16_t dest; + uint16_t len; + uint16_t chksum; +}; + +extern void build_udp_hdr(unsigned long __destip, unsigned int __srcsock, + unsigned int __destsock, int __ttl, int __len, + const void * __buf); + +extern int udp_transmit(unsigned long __destip, unsigned int __srcsock, + unsigned int __destsock, int __len, const void * __buf); + +#endif /* _UDP_H */ diff --git a/usr/src/grub/grub-0.97/netboot/undi.c b/usr/src/grub/grub-0.97/netboot/undi.c new file mode 100644 index 0000000000..54e5061793 --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/undi.c @@ -0,0 +1,1321 @@ +/************************************************************************** +Etherboot - BOOTP/TFTP Bootstrap Program +UNDI NIC driver for Etherboot + +This file Copyright (C) 2003 Michael Brown +of Fen Systems Ltd. (http://www.fensystems.co.uk/). All rights +reserved. + +$Id: undi.c,v 1.8 2003/10/25 13:54:53 mcb30 Exp $ +***************************************************************************/ + +/* + * 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. + */ + +/* to get some global routines like printf */ +#include "etherboot.h" +/* to get the interface to the body of the program */ +#include "nic.h" +/* to get the PCI support functions, if this is a PCI NIC */ +#include "pci.h" +/* UNDI and PXE defines. Includes pxe.h. */ +#include "undi.h" +/* 8259 PIC defines */ +#include "pic8259.h" +#include "bootp.h" +#include "tftp.h" +#include "shared.h" + +/* NIC specific static variables go here */ +static undi_t undi = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, 0, NULL, 0, NULL, + 0, 0, 0, 0, + { 0, 0, 0, NULL, 0, 0, 0, 0, 0, 0, 0, NULL }, + IRQ_NONE }; +static undi_base_mem_data_t undi_base_mem_data; + +#define UNDI_HEAP (void *)(512 << 10) + +/* Function prototypes */ +int allocate_base_mem_data ( void ); +int free_base_mem_data ( void ); +int eb_pxenv_undi_shutdown ( void ); +int eb_pxenv_stop_undi ( void ); +int undi_unload_base_code ( void ); +int undi_full_shutdown ( void ); +int eb_pxenv_get_cached_info (uint8_t, void **info); + +/************************************************************************** + * Utility functions + **************************************************************************/ + +/* Checksum a block. + */ + +uint8_t checksum ( void *block, size_t size ) { + uint8_t sum = 0; + uint16_t i = 0; + for ( i = 0; i < size; i++ ) { + sum += ( ( uint8_t * ) block )[i]; + } + return sum; +} + +/* Print the status of a !PXE structure + */ + +void pxe_dump ( void ) { +#ifdef TRACE_UNDI + printf ( "API %hx:%hx St %hx:%hx UD %hx:%hx UC %hx:%hx " + "BD %hx:%hx BC %hx:%hx\n", + undi.pxe->EntryPointSP.segment, undi.pxe->EntryPointSP.offset, + undi.pxe->Stack.Seg_Addr, undi.pxe->Stack.Seg_Size, + undi.pxe->UNDIData.Seg_Addr, undi.pxe->UNDIData.Seg_Size, + undi.pxe->UNDICode.Seg_Addr, undi.pxe->UNDICode.Seg_Size, + undi.pxe->BC_Data.Seg_Addr, undi.pxe->BC_Data.Seg_Size, + undi.pxe->BC_Code.Seg_Addr, undi.pxe->BC_Code.Seg_Size ); +#endif +} + +/* Allocate/free space for structures that must reside in base memory + */ + +int allocate_base_mem_data ( void ) { + /* In GRUB, anything is in base address, so we do not need + * allocate anything */ + undi.base_mem_data = &undi_base_mem_data; + memset ( undi.base_mem_data, 0, sizeof(undi_base_mem_data_t) ); + undi.undi_call_info = &undi.base_mem_data->undi_call_info; + undi.pxs = &undi.base_mem_data->pxs; + undi.xmit_data = &undi.base_mem_data->xmit_data; + undi.xmit_buffer = undi.base_mem_data->xmit_buffer; +#if 0 /* Etherboot Code */ + /* Allocate space in base memory. + * Initialise pointers to base memory structures. + */ + if ( undi.base_mem_data == NULL ) { + undi.base_mem_data = + allot_base_memory ( sizeof(undi_base_mem_data_t) + + TRIVIAL_IRQ_HANDLER_SIZE ); + if ( undi.base_mem_data == NULL ) { + printf ( "Failed to allocate base memory\n" ); + free_base_mem_data(); + return 0; + } + memset ( undi.base_mem_data, 0, sizeof(undi_base_mem_data_t) ); + undi.undi_call_info = &undi.base_mem_data->undi_call_info; + undi.pxs = &undi.base_mem_data->pxs; + undi.xmit_data = &undi.base_mem_data->xmit_data; + undi.xmit_buffer = undi.base_mem_data->xmit_buffer; + copy_trivial_irq_handler ( undi.base_mem_data->irq_handler, + TRIVIAL_IRQ_HANDLER_SIZE ); + } +#endif /* Etherboot Code */ + return 1; +} + +int free_base_mem_data ( void ) { + /* Just pretend to free something :-) */ + undi.base_mem_data = NULL; + undi.undi_call_info = NULL; + undi.pxs = NULL; + undi.xmit_data = NULL; + undi.xmit_buffer = NULL; +#if 0 /* Etherboot Code */ + if ( undi.base_mem_data != NULL ) { + forget_base_memory ( undi.base_mem_data, + sizeof(undi_base_mem_data_t) + + TRIVIAL_IRQ_HANDLER_SIZE ); + undi.base_mem_data = NULL; + undi.undi_call_info = NULL; + undi.pxs = NULL; + undi.xmit_data = NULL; + undi.xmit_buffer = NULL; + copy_trivial_irq_handler ( NULL, 0 ); + } +#endif /* Etherboot Code */ + return 1; +} + +void assemble_firing_squad ( firing_squad_lineup_t *lineup, + void *start, size_t size, + firing_squad_shoot_t shoot ) { + int target; + int index; + int bit; + int start_kb = virt_to_phys(start) >> 10; + int end_kb = ( virt_to_phys(start+size) + (1<<10) - 1 ) >> 10; + + for ( target = start_kb; target <= end_kb; target++ ) { + index = FIRING_SQUAD_TARGET_INDEX ( target ); + bit = FIRING_SQUAD_TARGET_BIT ( target ); + lineup->targets[index] = ( shoot << bit ) | + ( lineup->targets[index] & ~( 1 << bit ) ); + } +} + +void shoot_targets ( firing_squad_lineup_t *lineup ) { + int shoot_this_target = 0; + int shoot_last_target = 0; + int start_target = 0; + int target; + + for ( target = 0; target <= 640; target++ ) { + shoot_this_target = ( target == 640 ? 0 : + ( 1 << FIRING_SQUAD_TARGET_BIT(target) ) & + lineup->targets[FIRING_SQUAD_TARGET_INDEX(target)] ); + if ( shoot_this_target && !shoot_last_target ) { + start_target = target; + } else if ( shoot_last_target && !shoot_this_target ) { + size_t range_size = ( target - start_target ) << 10; + forget_base_memory ( phys_to_virt( start_target<<10 ), + range_size ); + } + shoot_last_target = shoot_this_target; + } +} + +/* Debug macros + */ + +#ifdef TRACE_UNDI +#define DBG(...) printf ( __VA_ARGS__ ) +#else +#define DBG(...) +#endif + +#define UNDI_STATUS(pxs) ( (pxs)->Status == PXENV_EXIT_SUCCESS ? \ + "SUCCESS" : \ + ( (pxs)->Status == PXENV_EXIT_FAILURE ? \ + "FAILURE" : "UNKNOWN" ) ) + +/************************************************************************** + * Base memory scanning functions + **************************************************************************/ + +/* Locate the $PnP structure indicating a PnP BIOS. + */ + +int hunt_pnp_bios ( void ) { + uint32_t off = 0x10000; + + DBG ( "Hunting for PnP BIOS..." ); + while ( off > 0 ) { + off -= 16; + undi.pnp_bios = (pnp_bios_t *) phys_to_virt ( 0xf0000 + off ); + if ( undi.pnp_bios->signature == PNP_BIOS_SIGNATURE ) { + DBG ( "found $PnP at f000:%hx...", off ); + if ( checksum(undi.pnp_bios,sizeof(pnp_bios_t)) !=0) { + DBG ( "invalid checksum\n..." ); + continue; + } + DBG ( "ok\n" ); + return 1; + } + } + DBG ( "none found\n" ); + undi.pnp_bios = NULL; + return 0; +} + +/* Locate the !PXE structure indicating a loaded UNDI driver. + */ + +int hunt_pixie ( void ) { + static uint32_t ptr = 0; + pxe_t *pxe = NULL; + + DBG ( "Hunting for pixies..." ); + if ( ptr == 0 ) ptr = 0xa0000; + while ( ptr > 0x10000 ) { + ptr -= 16; + pxe = (pxe_t *) phys_to_virt ( ptr ); + if ( memcmp ( pxe->Signature, "!PXE", 4 ) == 0 ) { + DBG ( "found !PXE at %x...", ptr ); + if ( checksum ( pxe, sizeof(pxe_t) ) != 0 ) { + DBG ( "invalid checksum\n..." ); + continue; + } + if ( ptr < get_free_base_memory() ) { + DBG ( "in free base memory!\n\n" + "WARNING: a valid !PXE structure was " + "found in an area of memory marked " + "as free!\n\n" ); + undi.pxe = pxe; + pxe_dump(); + undi.pxe = NULL; + DBG ( "\nIgnoring and continuing, but this " + "may cause problems later!\n\n" ); + continue; + } + DBG ( "ok\n" ); + undi.pxe = pxe; + pxe_dump(); + DBG ( "Resetting pixie...\n" ); + undi_unload_base_code(); + eb_pxenv_stop_undi(); + pxe_dump(); + return 1; + } + } + DBG ( "none found\n" ); + ptr = 0; + return 0; +} + +/* Locate PCI PnP ROMs. + */ + +int hunt_rom ( void ) { + static uint32_t ptr = 0; + + DBG ( "Hunting for ROMs..." ); + if ( ptr == 0 ) ptr = 0x100000; + while ( ptr > 0x0c0000 ) { + ptr -= 0x800; + undi.rom = ( rom_t * ) phys_to_virt ( ptr ); + if ( undi.rom->signature == ROM_SIGNATURE ) { + pcir_header_t *pcir_header = NULL; + pnp_header_t *pnp_header = NULL; + + DBG ( "found 55AA at %x...", ptr ); + if ( undi.rom->pcir_off == 0 ) { + DBG ( "not a PCI ROM\n..." ); + continue; + } + pcir_header = (pcir_header_t*)( ( void * ) undi.rom + + undi.rom->pcir_off ); + if ( pcir_header->signature != PCIR_SIGNATURE ) { + DBG ( "invalid PCI signature\n..." ); + continue; + } + DBG ( "PCI:%hx:%hx...", pcir_header->vendor_id, + pcir_header->device_id ); + if ( ( pcir_header->vendor_id != undi.pci.vendor ) || + ( pcir_header->device_id != undi.pci.dev_id ) ) { + DBG ( "not me (%hx:%hx)\n...", + undi.pci.vendor, + undi.pci.dev_id ); + continue; + } + if ( undi.rom->pnp_off == 0 ) { + DBG ( "not a PnP ROM\n..." ); + continue; + } + pnp_header = (pnp_header_t*)( ( void * ) undi.rom + + undi.rom->pnp_off ); + if ( pnp_header->signature != PNP_SIGNATURE ) { + DBG ( "invalid $PnP signature\n..." ); + continue; + } + if ( checksum(pnp_header,sizeof(pnp_header_t)) != 0 ) { + DBG ( "invalid PnP checksum\n..." ); + continue; + } + DBG ( "ok\n"); + printf ("ROM %s by %s\n", + pnp_header->product_str_off==0 ? "(unknown)" : + (void*)undi.rom+pnp_header->product_str_off, + pnp_header->manuf_str_off==0 ? "(unknown)" : + (void*)undi.rom+pnp_header->manuf_str_off ); + return 1; + } + } + DBG ( "none found\n" ); + ptr = 0; + undi.rom = NULL; + return 0; +} + +/* Locate ROMs containing UNDI drivers. + */ + +int hunt_undi_rom ( void ) { + while ( hunt_rom() ) { + if ( undi.rom->undi_rom_id_off == 0 ) { + DBG ( "Not a PXE ROM\n" ); + continue; + } + undi.undi_rom_id = (undi_rom_id_t *) + ( (void *)undi.rom + undi.rom->undi_rom_id_off ); + if ( undi.undi_rom_id->signature != UNDI_SIGNATURE ) { + DBG ( "Invalid UNDI signature\n" ); + continue; + } + printf ( "Revision %d.%d.%d", + undi.undi_rom_id->undi_rev[2], + undi.undi_rom_id->undi_rev[1], + undi.undi_rom_id->undi_rev[0] ); + return 1; + } + return 0; +} + +/************************************************************************** + * Low-level UNDI API call wrappers + **************************************************************************/ + +/* Make a real-mode UNDI API call to the UNDI routine at + * routine_seg:routine_off, passing in three uint16 parameters on the + * real-mode stack. + * Calls the assembler wrapper routine __undi_call. + */ + +static inline PXENV_EXIT_t _undi_call ( uint16_t routine_seg, + uint16_t routine_off, uint16_t st0, + uint16_t st1, uint16_t st2 ) { + PXENV_EXIT_t ret = PXENV_EXIT_FAILURE; + + undi.undi_call_info->routine.segment = routine_seg; + undi.undi_call_info->routine.offset = routine_off; + undi.undi_call_info->stack[0] = st0; + undi.undi_call_info->stack[1] = st1; + undi.undi_call_info->stack[2] = st2; + ret = __undi_call ( SEGMENT( undi.undi_call_info ), + OFFSET( undi.undi_call_info ) ); + + /* UNDI API calls may rudely change the status of A20 and not + * bother to restore it afterwards. Intel is known to be + * guilty of this. + * + * Note that we will return to this point even if A20 gets + * screwed up by the UNDI driver, because Etherboot always + * resides in an even megabyte of RAM. + */ + gateA20_set(); + + return ret; +} + +/* Make a real-mode call to the UNDI loader routine at + * routine_seg:routine_off, passing in the seg:off address of a + * pxenv_structure on the real-mode stack. + */ + +int undi_call_loader ( void ) { + PXENV_EXIT_t pxenv_exit = PXENV_EXIT_FAILURE; + + pxenv_exit = _undi_call ( SEGMENT( undi.rom ), + undi.undi_rom_id->undi_loader_off, + OFFSET( undi.pxs ), + SEGMENT( undi.pxs ), + 0 /* Unused for UNDI loader API */ ); + /* Return 1 for success, to be consistent with other routines */ + if ( pxenv_exit == PXENV_EXIT_SUCCESS ) return 1; + DBG ( "UNDI loader call failed with status %#hx\n", + undi.pxs->Status ); + return 0; +} + +/* Make a real-mode UNDI API call, passing in the opcode and the + * seg:off address of a pxenv_structure on the real-mode stack. + * + * Two versions: undi_call() will automatically report any failure + * codes, undi_call_silent() will not. + */ + +int undi_call_silent ( uint16_t opcode ) { + PXENV_EXIT_t pxenv_exit = PXENV_EXIT_FAILURE; + + pxenv_exit = _undi_call ( undi.pxe->EntryPointSP.segment, + undi.pxe->EntryPointSP.offset, + opcode, + OFFSET( undi.pxs ), + SEGMENT( undi.pxs ) ); + /* Return 1 for success, to be consistent with other routines */ + return pxenv_exit == PXENV_EXIT_SUCCESS ? 1 : 0; +} + +int undi_call ( uint16_t opcode ) { + if ( undi_call_silent ( opcode ) ) return 1; + DBG ( "UNDI API call %#hx failed with status %#hx\n", + opcode, undi.pxs->Status ); + return 0; +} + +/************************************************************************** + * High-level UNDI API call wrappers + **************************************************************************/ + +/* Install the UNDI driver from a located UNDI ROM. + */ + +int undi_loader ( void ) { + pxe_t *pxe = NULL; + + /* AX contains PCI bus:devfn (PCI specification) */ + undi.pxs->loader.ax = ( undi.pci.bus << 8 ) | undi.pci.devfn; + /* BX and DX set to 0xffff for non-ISAPnP devices + * (BIOS boot specification) + */ + undi.pxs->loader.bx = 0xffff; + undi.pxs->loader.dx = 0xffff; + /* ES:DI points to PnP BIOS' $PnP structure + * (BIOS boot specification) + */ + undi.pxs->loader.es = 0xf000; + undi.pxs->loader.di = virt_to_phys ( undi.pnp_bios ) - 0xf0000; + + /* Allocate space for UNDI driver's code and data segments */ + undi.driver_code_size = undi.undi_rom_id->code_size; + undi.driver_code = UNDI_HEAP; + if ( undi.driver_code == NULL ) { + printf ( "Could not allocate %d bytes for UNDI code segment\n", + undi.driver_code_size ); + return 0; + } + undi.pxs->loader.undi_cs = SEGMENT( undi.driver_code ); + + undi.driver_data_size = undi.undi_rom_id->data_size; + undi.driver_data = (void *)((((unsigned long)UNDI_HEAP + undi.undi_rom_id->code_size) | (1024 -1)) + 1); + if ( undi.driver_data == NULL ) { + printf ( "Could not allocate %d bytes for UNDI code segment\n", + undi.driver_data_size ); + return 0; + } + undi.pxs->loader.undi_ds = SEGMENT( undi.driver_data ); + + DBG ( "Installing UNDI driver code to %hx:0000, data at %hx:0000\n", + undi.pxs->loader.undi_cs, undi.pxs->loader.undi_ds ); + + /* Do the API call to install the loader */ + if ( ! undi_call_loader () ) return 0; + + pxe = VIRTUAL( undi.pxs->loader.undi_cs, undi.pxs->loader.pxe_off ); + DBG ( "UNDI driver created a pixie at %hx:%hx...", + undi.pxs->loader.undi_cs, undi.pxs->loader.pxe_off ); + if ( memcmp ( pxe->Signature, "!PXE", 4 ) != 0 ) { + DBG ( "invalid signature\n" ); + return 0; + } + if ( checksum ( pxe, sizeof(pxe_t) ) != 0 ) { + DBG ( "invalid checksum\n" ); + return 0; + } + DBG ( "ok\n" ); + undi.pxe = pxe; + pxe_dump(); + return 1; +} + +/* Start the UNDI driver. + */ + +int eb_pxenv_start_undi ( void ) { + int success = 0; + + /* AX contains PCI bus:devfn (PCI specification) */ + undi.pxs->start_undi.ax = ( undi.pci.bus << 8 ) | undi.pci.devfn; + /* BX and DX set to 0xffff for non-ISAPnP devices + * (BIOS boot specification) + */ + undi.pxs->start_undi.bx = 0xffff; + undi.pxs->start_undi.dx = 0xffff; + /* ES:DI points to PnP BIOS' $PnP structure + * (BIOS boot specification) + */ + undi.pxs->start_undi.es = 0xf000; + undi.pxs->start_undi.di = virt_to_phys ( undi.pnp_bios ) - 0xf0000; + + DBG ( "PXENV_START_UNDI => AX=%hx BX=%hx DX=%hx ES:DI=%hx:%hx\n", + undi.pxs->start_undi.ax, + undi.pxs->start_undi.bx, undi.pxs->start_undi.dx, + undi.pxs->start_undi.es, undi.pxs->start_undi.di ); + success = undi_call ( PXENV_START_UNDI ); + DBG ( "PXENV_START_UNDI <= Status=%s\n", UNDI_STATUS(undi.pxs) ); + if ( success ) undi.prestarted = 1; + return success; +} + +int eb_pxenv_undi_startup ( void ) { + int success = 0; + + DBG ( "PXENV_UNDI_STARTUP => (void)\n" ); + success = undi_call ( PXENV_UNDI_STARTUP ); + DBG ( "PXENV_UNDI_STARTUP <= Status=%s\n", UNDI_STATUS(undi.pxs) ); + if ( success ) undi.started = 1; + return success; +} + +int eb_pxenv_undi_cleanup ( void ) { + int success = 0; + + DBG ( "PXENV_UNDI_CLEANUP => (void)\n" ); + success = undi_call ( PXENV_UNDI_CLEANUP ); + DBG ( "PXENV_UNDI_CLEANUP <= Status=%s\n", UNDI_STATUS(undi.pxs) ); + return success; +} + +int eb_pxenv_undi_initialize ( void ) { + int success = 0; + + undi.pxs->undi_initialize.ProtocolIni = 0; + memset ( &undi.pxs->undi_initialize.reserved, 0, + sizeof ( undi.pxs->undi_initialize.reserved ) ); + DBG ( "PXENV_UNDI_INITIALIZE => ProtocolIni=%x\n" ); + success = undi_call ( PXENV_UNDI_INITIALIZE ); + DBG ( "PXENV_UNDI_INITIALIZE <= Status=%s\n", UNDI_STATUS(undi.pxs) ); + if ( success ) undi.initialized = 1; + return success; +} + +int eb_pxenv_undi_shutdown ( void ) { + int success = 0; + + DBG ( "PXENV_UNDI_SHUTDOWN => (void)\n" ); + success = undi_call ( PXENV_UNDI_SHUTDOWN ); + DBG ( "PXENV_UNDI_SHUTDOWN <= Status=%s\n", UNDI_STATUS(undi.pxs) ); + if ( success ) { + undi.initialized = 0; + undi.started = 0; + } + return success; +} + +int eb_pxenv_undi_open ( void ) { + int success = 0; + + undi.pxs->undi_open.OpenFlag = 0; + undi.pxs->undi_open.PktFilter = FLTR_DIRECTED | FLTR_BRDCST; + + /* Multicast support not yet implemented */ + undi.pxs->undi_open.R_Mcast_Buf.MCastAddrCount = 0; + DBG ( "PXENV_UNDI_OPEN => OpenFlag=%hx PktFilter=%hx " + "MCastAddrCount=%hx\n", + undi.pxs->undi_open.OpenFlag, undi.pxs->undi_open.PktFilter, + undi.pxs->undi_open.R_Mcast_Buf.MCastAddrCount ); + success = undi_call ( PXENV_UNDI_OPEN ); + DBG ( "PXENV_UNDI_OPEN <= Status=%s\n", UNDI_STATUS(undi.pxs) ); + if ( success ) undi.opened = 1; + return success; +} + +int eb_pxenv_undi_close ( void ) { + int success = 0; + + DBG ( "PXENV_UNDI_CLOSE => (void)\n" ); + success = undi_call ( PXENV_UNDI_CLOSE ); + DBG ( "PXENV_UNDI_CLOSE <= Status=%s\n", UNDI_STATUS(undi.pxs) ); + if ( success ) undi.opened = 0; + return success; +} + +int eb_pxenv_undi_transmit_packet ( void ) { + int success = 0; + static const uint8_t broadcast[] = { 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF }; + + /* XMitFlag selects unicast / broadcast */ + if ( memcmp ( undi.xmit_data->destaddr, broadcast, + sizeof(broadcast) ) == 0 ) { + undi.pxs->undi_transmit.XmitFlag = XMT_BROADCAST; + } else { + undi.pxs->undi_transmit.XmitFlag = XMT_DESTADDR; + } + + /* Zero reserved dwords */ + undi.pxs->undi_transmit.Reserved[0] = 0; + undi.pxs->undi_transmit.Reserved[1] = 0; + + /* Segment:offset pointer to DestAddr in base memory */ + undi.pxs->undi_transmit.DestAddr.segment = + SEGMENT( undi.xmit_data->destaddr ); + undi.pxs->undi_transmit.DestAddr.offset = + OFFSET( undi.xmit_data->destaddr ); + + /* Segment:offset pointer to TBD in base memory */ + undi.pxs->undi_transmit.TBD.segment = SEGMENT( &undi.xmit_data->tbd ); + undi.pxs->undi_transmit.TBD.offset = OFFSET( &undi.xmit_data->tbd ); + + /* Use only the "immediate" part of the TBD */ + undi.xmit_data->tbd.DataBlkCount = 0; + + DBG ( "PXENV_UNDI_TRANSMIT_PACKET => Protocol=%hx XmitFlag=%hx ...\n" + "... DestAddr=%hx:%hx TBD=%hx:%hx ...\n", + undi.pxs->undi_transmit.Protocol, + undi.pxs->undi_transmit.XmitFlag, + undi.pxs->undi_transmit.DestAddr.segment, + undi.pxs->undi_transmit.DestAddr.offset, + undi.pxs->undi_transmit.TBD.segment, + undi.pxs->undi_transmit.TBD.offset ); + DBG ( "... TBD { ImmedLength=%hx Xmit=%hx:%hx DataBlkCount=%hx }\n", + undi.xmit_data->tbd.ImmedLength, + undi.xmit_data->tbd.Xmit.segment, + undi.xmit_data->tbd.Xmit.offset, + undi.xmit_data->tbd.DataBlkCount ); + success = undi_call ( PXENV_UNDI_TRANSMIT ); + DBG ( "PXENV_UNDI_TRANSMIT_PACKET <= Status=%s\n", + UNDI_STATUS(undi.pxs) ); + return success; +} + +int eb_pxenv_undi_set_station_address ( void ) { + /* This will spuriously fail on some cards. Ignore failures. + * We only ever use it to set the MAC address to the card's + * permanent value anyway, so it's a useless call (although we + * make it because PXE spec says we should). + */ + DBG ( "PXENV_UNDI_SET_STATION_ADDRESS => " + "StationAddress=%!\n", + undi.pxs->undi_set_station_address.StationAddress ); + undi_call_silent ( PXENV_UNDI_SET_STATION_ADDRESS ); + DBG ( "PXENV_UNDI_SET_STATION_ADDRESS <= Status=%s\n", + UNDI_STATUS(undi.pxs) ); + return 1; +} + +int eb_pxenv_undi_get_information ( void ) { + int success = 0; + memset ( undi.pxs, 0, sizeof ( undi.pxs ) ); + DBG ( "PXENV_UNDI_GET_INFORMATION => (void)\n" ); + success = undi_call ( PXENV_UNDI_GET_INFORMATION ); + DBG ( "PXENV_UNDI_GET_INFORMATION <= Status=%s " + "BaseIO=%hx IntNumber=%hx ...\n" + "... MaxTranUnit=%hx HwType=%hx HwAddrlen=%hx ...\n" + "... CurrentNodeAddress=%! PermNodeAddress=%! ...\n" + "... ROMAddress=%hx RxBufCt=%hx TxBufCt=%hx\n", + UNDI_STATUS(undi.pxs), + undi.pxs->undi_get_information.BaseIo, + undi.pxs->undi_get_information.IntNumber, + undi.pxs->undi_get_information.MaxTranUnit, + undi.pxs->undi_get_information.HwType, + undi.pxs->undi_get_information.HwAddrLen, + undi.pxs->undi_get_information.CurrentNodeAddress, + undi.pxs->undi_get_information.PermNodeAddress, + undi.pxs->undi_get_information.ROMAddress, + undi.pxs->undi_get_information.RxBufCt, + undi.pxs->undi_get_information.TxBufCt ); + return success; +} + +int eb_pxenv_undi_get_iface_info ( void ) { + int success = 0; + + DBG ( "PXENV_UNDI_GET_IFACE_INFO => (void)\n" ); + success = undi_call ( PXENV_UNDI_GET_IFACE_INFO ); + DBG ( "PXENV_UNDI_GET_IFACE_INFO <= Status=%s IfaceType=%s ...\n" + "... LinkSpeed=%x ServiceFlags=%x\n", + UNDI_STATUS(undi.pxs), + undi.pxs->undi_get_iface_info.IfaceType, + undi.pxs->undi_get_iface_info.LinkSpeed, + undi.pxs->undi_get_iface_info.ServiceFlags ); + return success; +} + +int eb_pxenv_undi_isr ( void ) { + int success = 0; + + DBG ( "PXENV_UNDI_ISR => FuncFlag=%hx\n", + undi.pxs->undi_isr.FuncFlag ); + success = undi_call ( PXENV_UNDI_ISR ); + DBG ( "PXENV_UNDI_ISR <= Status=%s FuncFlag=%hx BufferLength=%hx ...\n" + "... FrameLength=%hx FrameHeaderLength=%hx Frame=%hx:%hx " + "ProtType=%hhx ...\n... PktType=%hhx\n", + UNDI_STATUS(undi.pxs), undi.pxs->undi_isr.FuncFlag, + undi.pxs->undi_isr.BufferLength, + undi.pxs->undi_isr.FrameLength, + undi.pxs->undi_isr.FrameHeaderLength, + undi.pxs->undi_isr.Frame.segment, + undi.pxs->undi_isr.Frame.offset, + undi.pxs->undi_isr.ProtType, + undi.pxs->undi_isr.PktType ); + return success; +} + +int eb_pxenv_stop_undi ( void ) { + int success = 0; + + DBG ( "PXENV_STOP_UNDI => (void)\n" ); + success = undi_call ( PXENV_STOP_UNDI ); + DBG ( "PXENV_STOP_UNDI <= Status=%s\n", UNDI_STATUS(undi.pxs) ); + if ( success ) undi.prestarted = 0; + return success; +} + +int eb_pxenv_unload_stack ( void ) { + int success = 0; + + memset ( undi.pxs, 0, sizeof ( undi.pxs ) ); + DBG ( "PXENV_UNLOAD_STACK => (void)\n" ); + success = undi_call_silent ( PXENV_UNLOAD_STACK ); + DBG ( "PXENV_UNLOAD_STACK <= Status=%s ...\n... (%s)\n", + UNDI_STATUS(undi.pxs), + ( undi.pxs->Status == PXENV_STATUS_SUCCESS ? + "base-code is ready to be removed" : + ( undi.pxs->Status == PXENV_STATUS_FAILURE ? + "the size of free base memory has been changed" : + ( undi.pxs->Status == PXENV_STATUS_KEEP_ALL ? + "the NIC interrupt vector has been changed" : + "UNEXPECTED STATUS CODE" ) ) ) ); + return success; +} + +int eb_pxenv_stop_base ( void ) { + int success = 0; + + DBG ( "PXENV_STOP_BASE => (void)\n" ); + success = undi_call ( PXENV_STOP_BASE ); + DBG ( "PXENV_STOP_BASE <= Status=%s\n", UNDI_STATUS(undi.pxs) ); + return success; +} + +/* Unload UNDI base code (if any present) and free memory. + */ +int undi_unload_base_code ( void ) { + /* In GRUB, we do not allocate anything, but we still can call + * to free the base space */ + void *bc_code = VIRTUAL( undi.pxe->BC_Code.Seg_Addr, 0 ); + size_t bc_code_size = undi.pxe->BC_Code.Seg_Size; + void *bc_data = VIRTUAL( undi.pxe->BC_Data.Seg_Addr, 0 ); + size_t bc_data_size = undi.pxe->BC_Data.Seg_Size; + void *bc_stck = VIRTUAL( undi.pxe->Stack.Seg_Addr, 0 ); + size_t bc_stck_size = undi.pxe->Stack.Seg_Size; + firing_squad_lineup_t lineup; + + /* Don't unload if there is no base code present */ + if ( undi.pxe->BC_Code.Seg_Addr == 0 ) return 1; + + /* Since we never start the base code, the only time we should + * reach this is if we were loaded via PXE. There are many + * different and conflicting versions of the "correct" way to + * unload the PXE base code, several of which appear within + * the PXE specification itself. This one seems to work for + * our purposes. + */ + eb_pxenv_stop_base(); + //eb_pxenv_unload_stack(); +/* if ( ( undi.pxs->unload_stack.Status != PXENV_STATUS_SUCCESS ) && + ( undi.pxs->unload_stack.Status != PXENV_STATUS_FAILURE ) ) { + printf ( "Could not free memory allocated to PXE base code: " + "possible memory leak\n" ); + return 0; + }*/ + /* Free data structures. Forget what the PXE specification + * says about how to calculate the new size of base memory; + * basemem.c takes care of all that for us. Note that we also + * have to free the stack (even though PXE spec doesn't say + * anything about it) because nothing else is going to do so. + * + * Structures will almost certainly not be kB-aligned and + * there's a reasonable chance that the UNDI code or data + * portions will lie in the same kB as the base code. Since + * forget_base_memory works only in 1kB increments, this means + * we have to do some arcane trickery. + */ + memset ( &lineup, 0, sizeof(lineup) ); + if ( SEGMENT(bc_code) != 0 ) + assemble_firing_squad( &lineup, bc_code, bc_code_size, SHOOT ); + if ( SEGMENT(bc_data) != 0 ) + assemble_firing_squad( &lineup, bc_data, bc_data_size, SHOOT ); + if ( SEGMENT(bc_stck) != 0 ) + assemble_firing_squad( &lineup, bc_stck, bc_stck_size, SHOOT ); + /* Don't shoot any bits of the UNDI driver code or data */ + assemble_firing_squad ( &lineup, + VIRTUAL(undi.pxe->UNDICode.Seg_Addr, 0), + undi.pxe->UNDICode.Seg_Size, DONTSHOOT ); + assemble_firing_squad ( &lineup, + VIRTUAL(undi.pxe->UNDIData.Seg_Addr, 0), + undi.pxe->UNDIData.Seg_Size, DONTSHOOT ); + //shoot_targets ( &lineup ); + //undi.pxe->BC_Code.Seg_Addr = 0; + //undi.pxe->BC_Data.Seg_Addr = 0; + //undi.pxe->Stack.Seg_Addr = 0; + + /* Free and reallocate our own base memory data structures, to + * allow the freed base-code blocks to be fully released. + */ + free_base_mem_data(); + if ( ! allocate_base_mem_data() ) { + printf ( "FATAL: memory unaccountably lost\n" ); + while ( 1 ) {}; + } + + return 1; +} + +/* UNDI full initialization + * + * This calls all the various UNDI initialization routines in sequence. + */ + +int undi_full_startup ( void ) { + if ( ! eb_pxenv_start_undi() ) return 0; + if ( ! eb_pxenv_undi_startup() ) return 0; + if ( ! eb_pxenv_undi_initialize() ) return 0; + if ( ! eb_pxenv_undi_get_information() ) return 0; + undi.irq = undi.pxs->undi_get_information.IntNumber; + if ( ! install_undi_irq_handler ( undi.irq, undi.pxe->EntryPointSP ) ) { + undi.irq = IRQ_NONE; + return 0; + } + memmove ( &undi.pxs->undi_set_station_address.StationAddress, + &undi.pxs->undi_get_information.PermNodeAddress, + sizeof (undi.pxs->undi_set_station_address.StationAddress) ); + if ( ! eb_pxenv_undi_set_station_address() ) return 0; + if ( ! eb_pxenv_undi_open() ) return 0; + /* install_undi_irq_handler leaves irq disabled */ + enable_irq ( undi.irq ); + return 1; +} + +/* UNDI full shutdown + * + * This calls all the various UNDI shutdown routines in sequence and + * also frees any memory that it can. + */ + +int undi_full_shutdown ( void ) { + if ( undi.pxe != NULL ) { + /* In case we didn't allocate the driver's memory in the first + * place, try to grab the code and data segments and sizes + * from the !PXE structure. + */ + if ( undi.driver_code == NULL ) { + undi.driver_code = VIRTUAL(undi.pxe->UNDICode.Seg_Addr, + 0 ); + undi.driver_code_size = undi.pxe->UNDICode.Seg_Size; + } + if ( undi.driver_data == NULL ) { + undi.driver_data = VIRTUAL(undi.pxe->UNDIData.Seg_Addr, + 0 ); + undi.driver_data_size = undi.pxe->UNDIData.Seg_Size; + } + + /* Ignore errors and continue in the hope of shutting + * down anyway + */ + if ( undi.opened ) eb_pxenv_undi_close(); + if ( undi.started ) { + eb_pxenv_undi_cleanup(); + /* We may get spurious UNDI API errors at this + * point. If startup() succeeded but + * initialize() failed then according to the + * spec, we should call shutdown(). However, + * some NICS will fail with a status code + * 0x006a (INVALID_STATE). + */ + eb_pxenv_undi_shutdown(); + } + if ( undi.irq != IRQ_NONE ) { + remove_undi_irq_handler ( undi.irq ); + undi.irq = IRQ_NONE; + } + undi_unload_base_code(); + if ( undi.prestarted ) { + eb_pxenv_stop_undi(); + /* Success OR Failure indicates that memory + * can be freed. Any other status code means + * that it can't. + */ + if (( undi.pxs->Status == PXENV_STATUS_KEEP_UNDI ) || + ( undi.pxs->Status == PXENV_STATUS_KEEP_ALL ) ) { + printf ("Could not free memory allocated to " + "UNDI driver: possible memory leak\n"); + return 0; + } + } + } + /* Free memory allocated to UNDI driver */ + if ( undi.driver_code != NULL ) { + /* Clear contents in order to eliminate !PXE and PXENV + * signatures to prevent spurious detection via base + * memory scan. + */ + memset ( undi.driver_code, 0, undi.driver_code_size ); + /* forget_base_memory ( undi.driver_code, undi.driver_code_size ); */ + undi.driver_code = NULL; + undi.driver_code_size = 0; + } + if ( undi.driver_data != NULL ) { + /* forget_base_memory ( undi.driver_data, undi.driver_data_size ); */ + undi.driver_data = NULL; + undi.driver_data_size = 0; + } + /* !PXE structure now gone; memory freed */ + undi.pxe = NULL; + return 1; +} + +/************************************************************************** +POLL - Wait for a frame +***************************************************************************/ +static int undi_poll(struct nic *nic, int retrieve) +{ + /* Fun, fun, fun. UNDI drivers don't use polling; they use + * interrupts. We therefore cheat and pretend that an + * interrupt has occurred every time undi_poll() is called. + * This isn't too much of a hack; PCI devices share IRQs and + * so the first thing that a proper ISR should do is call + * PXENV_UNDI_ISR to determine whether or not the UNDI NIC + * generated the interrupt; there is no harm done by spurious + * calls to PXENV_UNDI_ISR. Similarly, we wouldn't be + * handling them any more rapidly than the usual rate of + * undi_poll() being called even if we did implement a full + * ISR. So it should work. Ha! + * + * Addendum (21/10/03). Some cards don't play nicely with + * this trick, so instead of doing it the easy way we have to + * go to all the hassle of installing a genuine interrupt + * service routine and dealing with the wonderful 8259 + * Programmable Interrupt Controller. Joy. + * + * (02/01/2005). A real UNDI ISR is now implemented in, + * following Figure 3-4 in PXE spec 2.0. The interrupt + * handler, undi_irq_handler, issues PXENV_UNDI_ISR_IN_START. + * If the interrupt is ours, the handler sends EOI and bumps the + * undi_irq_trigger_count. This polled routine is equivalent + * to the "driver strategy routine". + * + * Another issue is that upper layer await_*() does not handle + * coalesced packets. The UNDI implementation on broadcom chips + * appear to combine interrupts. If we loop through GET_NEXT, + * we may hand up coalesced packets, resulting in drops, and + * severe time delay. As a temperary hack, we return as soon as + * we get something, remembering where we were (IN_PROCESS + * or GET_NEXT). This assume packets are never broken up. + * XXX Need to fix upper layer to handle coalesced data. + */ + + static int undi_opcode = PXENV_UNDI_ISR_IN_PROCESS; + + /* See if a hardware interrupt has occurred since the last poll(). + */ + switch ( undi_opcode ) { + case PXENV_UNDI_ISR_IN_PROCESS: + if ( ! undi_irq_triggered ( undi.irq ) ) + return 0; + default: + break; + } + + /* We have an interrupt or there is something left from + * last poll. Either way, we need to call UNDI ISR. + */ + nic->packetlen = 0; + undi.pxs->undi_isr.FuncFlag = undi_opcode; + /* there is no good way to handle this error */ + if ( ! eb_pxenv_undi_isr() ) { + printf ("undi isr call failed: opcode = %d\n", undi_opcode); + return 0; + } + switch ( undi.pxs->undi_isr.FuncFlag ) { + case PXENV_UNDI_ISR_OUT_DONE: + /* Set opcode back to IN_PROCESS and wait for next intr */ + undi_opcode = PXENV_UNDI_ISR_IN_PROCESS; + return 0; + case PXENV_UNDI_ISR_OUT_TRANSMIT: + /* We really don't care about transmission complete + * interrupts. Move on to next frame. + */ + undi_opcode = PXENV_UNDI_ISR_IN_GET_NEXT; + return 0; + case PXENV_UNDI_ISR_OUT_BUSY: + /* This should never happen. + */ + undi_opcode = PXENV_UNDI_ISR_IN_GET_NEXT; + printf ( "UNDI ISR thinks it's being re-entered!\n" + "Aborting receive\n" ); + return 0; + case PXENV_UNDI_ISR_OUT_RECEIVE: + /* Copy data to receive buffer and move on to next frame */ + undi_opcode = PXENV_UNDI_ISR_IN_GET_NEXT; + memcpy ( nic->packet + nic->packetlen, + VIRTUAL( undi.pxs->undi_isr.Frame.segment, + undi.pxs->undi_isr.Frame.offset ), + undi.pxs->undi_isr.BufferLength ); + nic->packetlen += undi.pxs->undi_isr.BufferLength; + break; + default: + undi_opcode = PXENV_UNDI_ISR_IN_PROCESS; + printf ( "UNDI ISR returned bizzare status code %d\n", + undi.pxs->undi_isr.FuncFlag ); + } + + return nic->packetlen > 0 ? 1 : 0; +} + +/************************************************************************** +TRANSMIT - Transmit a frame +***************************************************************************/ +static void undi_transmit( + struct nic *nic, + const char *d, /* Destination */ + unsigned int t, /* Type */ + unsigned int s, /* size */ + const char *p) /* Packet */ +{ + /* Inhibit compiler warning about unused parameter nic */ + if ( nic == NULL ) {}; + + /* Copy destination to buffer in base memory */ + memcpy ( undi.xmit_data->destaddr, d, sizeof(MAC_ADDR) ); + + /* Translate packet type to UNDI packet type */ + switch ( t ) { + case IP : undi.pxs->undi_transmit.Protocol = P_IP; break; + case ARP: undi.pxs->undi_transmit.Protocol = P_ARP; break; + case RARP: undi.pxs->undi_transmit.Protocol = P_RARP; break; + default: undi.pxs->undi_transmit.Protocol = P_UNKNOWN; break; + } + + /* Store packet length in TBD */ + undi.xmit_data->tbd.ImmedLength = s; + + /* Check to see if data to be transmitted is currently in base + * memory. If not, allocate temporary storage in base memory + * and copy it there. + */ + if ( SEGMENT( p ) <= 0xffff ) { + undi.xmit_data->tbd.Xmit.segment = SEGMENT( p ); + undi.xmit_data->tbd.Xmit.offset = OFFSET( p ); + } else { + memcpy ( undi.xmit_buffer, p, s ); + undi.xmit_data->tbd.Xmit.segment = SEGMENT( undi.xmit_buffer ); + undi.xmit_data->tbd.Xmit.offset = OFFSET( undi.xmit_buffer ); + } + + eb_pxenv_undi_transmit_packet(); +} + +/************************************************************************** +DISABLE - Turn off ethernet interface +***************************************************************************/ +static void undi_disable(struct dev *dev) +{ + /* Inhibit compiler warning about unused parameter dev */ + if ( dev == NULL ) {}; + undi_full_shutdown(); + free_base_mem_data(); +} + +/************************************************************************** +PROBE - Look for an adapter, this routine's visible to the outside +***************************************************************************/ + +/* Locate an UNDI driver by first scanning through base memory for an + * installed driver and then by scanning for UNDI ROMs and attempting + * to install their drivers. + */ + +int hunt_pixies_and_undi_roms ( void ) { + static uint8_t hunt_type = HUNT_FOR_PIXIES; + + if ( hunt_type == HUNT_FOR_PIXIES ) { + if ( hunt_pixie() ) { + return 1; + } + } + hunt_type = HUNT_FOR_UNDI_ROMS; + while ( hunt_undi_rom() ) { + if ( undi_loader() ) { + return 1; + } + undi_full_shutdown(); /* Free any allocated memory */ + } + hunt_type = HUNT_FOR_PIXIES; + return 0; +} + +/* The actual Etherboot probe routine. + */ + +static int undi_probe(struct dev *dev, struct pci_device *pci) +{ + struct nic *nic = (struct nic *)dev; + + /* Zero out global undi structure */ + memset ( &undi, 0, sizeof(undi) ); + + /* Store PCI parameters; we will need them to initialize the UNDI + * driver later. + */ + memcpy ( &undi.pci, pci, sizeof(undi.pci) ); + + /* Find the BIOS' $PnP structure */ + if ( ! hunt_pnp_bios() ) { + printf ( "No PnP BIOS found; aborting\n" ); + return 0; + } + + /* Allocate base memory data structures */ + if ( ! allocate_base_mem_data() ) return 0; + + /* Search thoroughly for UNDI drivers */ + for ( ; hunt_pixies_and_undi_roms(); undi_full_shutdown() ) { + /* Try to initialise UNDI driver */ + DBG ( "Initializing UNDI driver. Please wait...\n" ); + if ( ! undi_full_startup() ) { + if ( undi.pxs->Status == + PXENV_STATUS_UNDI_MEDIATEST_FAILED ) { + DBG ( "Cable not connected (code %#hx)\n", + PXENV_STATUS_UNDI_MEDIATEST_FAILED ); + } + continue; + } + /* Basic information: MAC, IO addr, IRQ */ + if ( ! eb_pxenv_undi_get_information() ) continue; + DBG ( "Initialized UNDI NIC with IO %#hx, IRQ %d, MAC %!\n", + undi.pxs->undi_get_information.BaseIo, + undi.pxs->undi_get_information.IntNumber, + undi.pxs->undi_get_information.CurrentNodeAddress ); + /* Fill out MAC address in nic structure */ + memcpy ( nic->node_addr, + undi.pxs->undi_get_information.CurrentNodeAddress, + ETH_ALEN ); + /* More diagnostic information including link speed */ + if ( ! eb_pxenv_undi_get_iface_info() ) continue; + printf ( " NDIS type %s interface at %d Mbps\n", + undi.pxs->undi_get_iface_info.IfaceType, + undi.pxs->undi_get_iface_info.LinkSpeed / 1000000 ); + DBG ("UNDI Stack at %#hx:%#hx",UNDI_STACK_SEG, UNDI_STACK_OFF); + dev->disable = undi_disable; + nic->poll = undi_poll; + nic->transmit = undi_transmit; + return 1; + } + undi_disable ( dev ); /* To free base memory structures */ + return 0; +} + +/* UNDI driver states that it is suitable for any PCI NIC (i.e. any + * PCI device of class PCI_CLASS_NETWORK_ETHERNET). If there are any + * obscure UNDI NICs that have the incorrect PCI class, add them to + * this list. + */ +static struct pci_id undi_nics[] = { + /* PCI_ROM(0x0000, 0x0000, "undi", "UNDI adaptor"), */ +}; + +struct pci_driver undi_driver = { + .type = NIC_DRIVER, + .name = "UNDI", + .probe = undi_probe, + .ids = undi_nics, + .id_count = sizeof(undi_nics)/sizeof(undi_nics[0]), + .class = PCI_CLASS_NETWORK_ETHERNET, +}; + +/************************************************ + * Code for reusing the BIOS provided pxe stack + */ + +/* Verify !PXE structure saved by pxeloader. */ +int undi_bios_pxe(void **dhcpreply) +{ + pxe_t *pxe; + uint16_t *ptr = (uint16_t *)0x7C80; + + pxe = (pxe_t *) VIRTUAL(ptr[0], ptr[1]); + if (memcmp(pxe->Signature, "!PXE", 4) != 0) { + DBG ("invalid !PXE signature at %x:%x\n", ptr[0], ptr[1]); + return 0; + } + + if (checksum(pxe, sizeof(pxe_t)) != 0) { + DBG ("invalid checksum\n"); + return 0; + } + + /* Zero out global undi structure */ + memset (&undi, 0, sizeof(undi)); + + /* Allocate base memory data structures */ + if (! allocate_base_mem_data()) return 0; + + undi.pxe = pxe; + pxe_dump(); + + if (!eb_pxenv_get_cached_info(PXENV_PACKET_TYPE_DHCP_ACK, dhcpreply)) { + DBG ("failed to get cached DHCP reply\n"); + return 0; + } + return 1; +} + +void undi_pxe_disable(void) +{ + /* full shutdown is problematic for some machines */ + (void) eb_pxenv_undi_shutdown(); +} + +/* + * Various helper functions for dhcp and tftp + */ +int eb_pxenv_get_cached_info (uint8_t type, void **info) +{ + int success; + + memset(undi.pxs, 0, sizeof (undi.pxs)); + /* Segment:offset pointer to DestAddr in base memory */ + undi.pxs->get_cached_info.PacketType = type; + undi.pxs->get_cached_info.BufferSize = 0; + undi.pxs->get_cached_info.Buffer.segment = 0; + undi.pxs->get_cached_info.Buffer.offset = 0; + + success = undi_call(PXENV_GET_CACHED_INFO); + DBG ("PXENV_GET_CACHED_INFO <= Status=%s\n", UNDI_STATUS(undi.pxs)); + + *info = (void *)VIRTUAL(undi.pxs->get_cached_info.Buffer.segment, + undi.pxs->get_cached_info.Buffer.offset); + return success; +} + +/* tftp help routines */ +int eb_pxenv_tftp_open(char *file, IP4_t serverip, IP4_t gatewayip, + uint16_t *pktlen) +{ + int success; + memset(undi.pxs, 0, sizeof (undi.pxs)); + undi.pxs->tftp_open.ServerIPAddress = serverip; + undi.pxs->tftp_open.GatewayIPAddress = gatewayip; + undi.pxs->tftp_open.TFTPPort = htons(TFTP_PORT); + undi.pxs->tftp_open.PacketSize = TFTP_MAX_PACKET; + (void) sprintf(undi.pxs->tftp_open.FileName, "%s", file); + success = undi_call(PXENV_TFTP_OPEN); + DBG ("PXENV_TFTP_OPEN <= Status=%s\n", UNDI_STATUS(undi.pxs)); + *pktlen = undi.pxs->tftp_open.PacketSize; + return success; +} + +int eb_pxenv_tftp_read(uint8_t *buf, uint16_t *len) +{ + static int tftp_count = 0; + + int success; + memset(undi.pxs, 0, sizeof (undi.pxs)); + undi.pxs->tftp_read.Buffer.segment = SEGMENT(buf); + undi.pxs->tftp_read.Buffer.offset = OFFSET(buf); + success = undi_call(PXENV_TFTP_READ); + DBG ("PXENV_TFTP_READ <= Status=%s\n", UNDI_STATUS(undi.pxs)); + *len = undi.pxs->tftp_read.BufferSize; + tftp_count++; + if ((tftp_count % 1000) == 0) + noisy_printf("."); + return success; +} + +int eb_pxenv_tftp_close(void) +{ + int success; + memset(undi.pxs, 0, sizeof (undi.pxs)); + success = undi_call(PXENV_TFTP_CLOSE); + DBG ("PXENV_TFTP_CLOSE <= Status=%s\n", UNDI_STATUS(undi.pxs)); + return success; +} + +int eb_pxenv_tftp_get_fsize(char *file, IP4_t serverip, IP4_t gatewayip, + uint32_t *fsize) +{ + int success; + memset(undi.pxs, 0, sizeof (undi.pxs)); + undi.pxs->tftp_open.ServerIPAddress = serverip; + undi.pxs->tftp_open.GatewayIPAddress = gatewayip; + (void) sprintf(undi.pxs->tftp_open.FileName, "%s", file); + success = undi_call(PXENV_TFTP_GET_FSIZE); + DBG ("PXENV_TFTP_GET_FSIZE <= Status=%s\n", UNDI_STATUS(undi.pxs)); + *fsize = undi.pxs->tftp_get_fsize.FileSize; + return success; +} diff --git a/usr/src/grub/grub-0.97/netboot/undi.h b/usr/src/grub/grub-0.97/netboot/undi.h new file mode 100644 index 0000000000..511de98b8a --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/undi.h @@ -0,0 +1,239 @@ +/************************************************************************** +Etherboot - BOOTP/TFTP Bootstrap Program +UNDI NIC driver for Etherboot - header file + +This file Copyright (C) 2003 Michael Brown +of Fen Systems Ltd. (http://www.fensystems.co.uk/). All rights +reserved. + +$Id: undi.h,v 1.5 2003/10/24 10:05:06 mcb30 Exp $ +***************************************************************************/ + +/* + * 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. + */ + +/* Include pxe.h from FreeBSD. + * pxe.h defines PACKED, which etherboot.h has already defined. + */ + +#undef PACKED +#include "pxe.h" +#include "pic8259.h" + +/* __undi_call is the assembler wrapper to the real-mode UNDI calls. + * Pass it the real-mode segment:offset address of an undi_call_info_t + * structure. The parameters are only uint16_t, but GCC will push + * them on the stack as uint32_t anyway for the sake of alignment. We + * specify them here as uint32_t to remove ambiguity. + */ + +typedef struct undi_call_info { + SEGOFF16_t routine; + uint16_t stack[3]; +} undi_call_info_t; + +typedef uint16_t PXENV_EXIT_t; +#define PXENV_EXIT_SUCCESS 0x0000 +#define PXENV_EXIT_FAILURE 0x0001 +PXENV_EXIT_t __undi_call ( uint32_t, uint32_t ); + +/* The UNDI loader parameter structure is not defined in pxe.h + */ + +typedef struct undi_loader { + PXENV_STATUS_t status; + uint16_t ax; + uint16_t bx; + uint16_t dx; + uint16_t di; + uint16_t es; + uint16_t undi_ds; + uint16_t undi_cs; + uint16_t pxe_off; + uint16_t pxenv_off; +} undi_loader_t; + +/* A union that can function as the parameter block for any UNDI API call. + */ + +typedef union pxenv_structure { + PXENV_STATUS_t Status; /* Make it easy to read status + for any operation */ + undi_loader_t loader; + t_PXENV_START_UNDI start_undi; + t_PXENV_UNDI_STARTUP undi_startup; + t_PXENV_UNDI_CLEANUP undi_cleanup; + t_PXENV_UNDI_INITIALIZE undi_initialize; + t_PXENV_UNDI_SHUTDOWN undi_shutdown; + t_PXENV_UNDI_OPEN undi_open; + t_PXENV_UNDI_CLOSE undi_close; + t_PXENV_UNDI_TRANSMIT undi_transmit; + t_PXENV_UNDI_SET_STATION_ADDRESS undi_set_station_address; + t_PXENV_UNDI_GET_INFORMATION undi_get_information; + t_PXENV_UNDI_GET_IFACE_INFO undi_get_iface_info; + t_PXENV_UNDI_ISR undi_isr; + t_PXENV_STOP_UNDI stop_undi; + t_PXENV_UNLOAD_STACK unload_stack; + t_PXENV_GET_CACHED_INFO get_cached_info; + t_PXENV_UDP_OPEN udp_open; + t_PXENV_UDP_CLOSE udp_close; + t_PXENV_UDP_READ udp_read; + t_PXENV_UDP_WRITE udp_write; + t_PXENV_TFTP_OPEN tftp_open; + t_PXENV_TFTP_CLOSE tftp_close; + t_PXENV_TFTP_READ tftp_read; + t_PXENV_TFTP_GET_FSIZE tftp_get_fsize; +} pxenv_structure_t; + +/* UNDI status codes + */ + +#define PXENV_STATUS_SUCCESS 0x0000 +#define PXENV_STATUS_FAILURE 0x0001 +#define PXENV_STATUS_KEEP_UNDI 0x0004 +#define PXENV_STATUS_KEEP_ALL 0x0005 +#define PXENV_STATUS_UNDI_MEDIATEST_FAILED 0x0061 + +/* BIOS PnP parameter block. We scan for this so that we can pass it + * to the UNDI driver. + */ + +#define PNP_BIOS_SIGNATURE ( ('$'<<0) + ('P'<<8) + ('n'<<16) + ('P'<<24) ) +typedef struct pnp_bios { + uint32_t signature; + uint8_t version; + uint8_t length; + uint16_t control; + uint8_t checksum; + uint8_t dontcare[24]; +} PACKED pnp_bios_t; + +/* Structures within the PXE ROM. + */ + +#define ROM_SIGNATURE 0xaa55 +typedef struct rom { + uint16_t signature; + uint8_t unused[0x14]; + uint16_t undi_rom_id_off; + uint16_t pcir_off; + uint16_t pnp_off; +} PACKED rom_t; + +#define PCIR_SIGNATURE ( ('P'<<0) + ('C'<<8) + ('I'<<16) + ('R'<<24) ) +typedef struct pcir_header { + uint32_t signature; + uint16_t vendor_id; + uint16_t device_id; +} PACKED pcir_header_t; + +#define PNP_SIGNATURE ( ('$'<<0) + ('P'<<8) + ('n'<<16) + ('P'<<24) ) +typedef struct pnp_header { + uint32_t signature; + uint8_t struct_revision; + uint8_t length; + uint16_t next; + uint8_t reserved; + uint8_t checksum; + uint16_t id[2]; + uint16_t manuf_str_off; + uint16_t product_str_off; + uint8_t base_type; + uint8_t sub_type; + uint8_t interface_type; + uint8_t indicator; + uint16_t boot_connect_off; + uint16_t disconnect_off; + uint16_t initialise_off; + uint16_t reserved2; + uint16_t info; +} PACKED pnp_header_t; + +#define UNDI_SIGNATURE ( ('U'<<0) + ('N'<<8) + ('D'<<16) + ('I'<<24) ) +typedef struct undi_rom_id { + uint32_t signature; + uint8_t struct_length; + uint8_t struct_cksum; + uint8_t struct_rev; + uint8_t undi_rev[3]; + uint16_t undi_loader_off; + uint16_t stack_size; + uint16_t data_size; + uint16_t code_size; +} PACKED undi_rom_id_t; + +/* Storage buffers that we need in base memory. We collect these into + * a single structure to make allocation simpler. + */ + +typedef struct undi_base_mem_xmit_data { + MAC_ADDR destaddr; + t_PXENV_UNDI_TBD tbd; +} undi_base_mem_xmit_data_t; + +typedef struct undi_base_mem_data { + undi_call_info_t undi_call_info; + pxenv_structure_t pxs; + undi_base_mem_xmit_data_t xmit_data; + char xmit_buffer[ETH_FRAME_LEN]; + char irq_handler[0]; /* Must be last in structure */ +} undi_base_mem_data_t; + +/* Macros and data structures used when freeing bits of base memory + * used by the UNDI driver. + */ + +#define FIRING_SQUAD_TARGET_SIZE 8 +#define FIRING_SQUAD_TARGET_INDEX(x) ( (x) / FIRING_SQUAD_TARGET_SIZE ) +#define FIRING_SQUAD_TARGET_BIT(x) ( (x) % FIRING_SQUAD_TARGET_SIZE ) +typedef struct firing_squad_lineup { + uint8_t targets[ 640 / FIRING_SQUAD_TARGET_SIZE ]; +} firing_squad_lineup_t; +typedef enum firing_squad_shoot { + DONTSHOOT = 0, + SHOOT = 1 +} firing_squad_shoot_t; + +/* Driver private data structure. + */ + +typedef struct undi { + /* Pointers to various data structures */ + pnp_bios_t *pnp_bios; + rom_t *rom; + undi_rom_id_t *undi_rom_id; + pxe_t *pxe; + undi_call_info_t *undi_call_info; + pxenv_structure_t *pxs; + undi_base_mem_xmit_data_t *xmit_data; + /* Pointers and sizes to keep track of allocated base memory */ + undi_base_mem_data_t *base_mem_data; + void *driver_code; + size_t driver_code_size; + void *driver_data; + size_t driver_data_size; + char *xmit_buffer; + /* Flags. We keep our own instead of trusting the UNDI driver + * to have implemented PXENV_UNDI_GET_STATE correctly. Plus + * there's the small issue of PXENV_UNDI_GET_STATE being the + * same API call as PXENV_STOP_UNDI... + */ + uint8_t prestarted; /* pxenv_start_undi() has been called */ + uint8_t started; /* pxenv_undi_startup() has been called */ + uint8_t initialized; /* pxenv_undi_initialize() has been called */ + uint8_t opened; /* pxenv_undi_open() has been called */ + /* Parameters that we need to store for future reference + */ + struct pci_device pci; + irq_t irq; +} undi_t; + +/* Constants + */ + +#define HUNT_FOR_PIXIES 0 +#define HUNT_FOR_UNDI_ROMS 1 diff --git a/usr/src/grub/grub-0.97/netboot/via-rhine.c b/usr/src/grub/grub-0.97/netboot/via-rhine.c new file mode 100644 index 0000000000..b27205e7e5 --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/via-rhine.c @@ -0,0 +1,1318 @@ +/* rhine.c:Fast Ethernet driver for Linux. */ +/* + Adapted 09-jan-2000 by Paolo Marini (paolom@prisma-eng.it) + + originally written by Donald Becker. + + This software may be used and distributed according to the terms + of the GNU Public License (GPL), incorporated herein by reference. + Drivers derived from this code also fall under the GPL and must retain + this authorship and copyright notice. + + Under no circumstances are the authors responsible for + the proper functioning of this software, nor do the authors assume any + responsibility for damages incurred with its use. + + This driver is designed for the VIA VT86C100A Rhine-II PCI Fast Ethernet + controller. + +*/ + +static const char *version = "rhine.c v1.0.1 2003-02-06\n"; + +/* A few user-configurable values. */ + +/* Size of the in-memory receive ring. */ +#define RX_BUF_LEN_IDX 3 /* 0==8K, 1==16K, 2==32K, 3==64K */ +#define RX_BUF_LEN (8192 << RX_BUF_LEN_IDX) + +/* Size of the Tx bounce buffers -- must be at least (dev->mtu+14+4). */ +#define TX_BUF_SIZE 1536 +#define RX_BUF_SIZE 1536 + +/* PCI Tuning Parameters + Threshold is bytes transferred to chip before transmission starts. */ +#define TX_FIFO_THRESH 256 /* In bytes, rounded down to 32 byte units. */ + +/* The following settings are log_2(bytes)-4: 0 == 16 bytes .. 6==1024. */ +#define RX_FIFO_THRESH 4 /* Rx buffer level before first PCI xfer. */ +#define RX_DMA_BURST 4 /* Maximum PCI burst, '4' is 256 bytes */ +#define TX_DMA_BURST 4 + +/* Operational parameters that usually are not changed. */ +/* Time in jiffies before concluding the transmitter is hung. */ +#define TX_TIMEOUT ((2000*HZ)/1000) + +#include "etherboot.h" +#include "nic.h" +#include "pci.h" + +/* define all ioaddr */ + +#define byPAR0 ioaddr +#define byRCR ioaddr + 6 +#define byTCR ioaddr + 7 +#define byCR0 ioaddr + 8 +#define byCR1 ioaddr + 9 +#define byISR0 ioaddr + 0x0c +#define byISR1 ioaddr + 0x0d +#define byIMR0 ioaddr + 0x0e +#define byIMR1 ioaddr + 0x0f +#define byMAR0 ioaddr + 0x10 +#define byMAR1 ioaddr + 0x11 +#define byMAR2 ioaddr + 0x12 +#define byMAR3 ioaddr + 0x13 +#define byMAR4 ioaddr + 0x14 +#define byMAR5 ioaddr + 0x15 +#define byMAR6 ioaddr + 0x16 +#define byMAR7 ioaddr + 0x17 +#define dwCurrentRxDescAddr ioaddr + 0x18 +#define dwCurrentTxDescAddr ioaddr + 0x1c +#define dwCurrentRDSE0 ioaddr + 0x20 +#define dwCurrentRDSE1 ioaddr + 0x24 +#define dwCurrentRDSE2 ioaddr + 0x28 +#define dwCurrentRDSE3 ioaddr + 0x2c +#define dwNextRDSE0 ioaddr + 0x30 +#define dwNextRDSE1 ioaddr + 0x34 +#define dwNextRDSE2 ioaddr + 0x38 +#define dwNextRDSE3 ioaddr + 0x3c +#define dwCurrentTDSE0 ioaddr + 0x40 +#define dwCurrentTDSE1 ioaddr + 0x44 +#define dwCurrentTDSE2 ioaddr + 0x48 +#define dwCurrentTDSE3 ioaddr + 0x4c +#define dwNextTDSE0 ioaddr + 0x50 +#define dwNextTDSE1 ioaddr + 0x54 +#define dwNextTDSE2 ioaddr + 0x58 +#define dwNextTDSE3 ioaddr + 0x5c +#define dwCurrRxDMAPtr ioaddr + 0x60 +#define dwCurrTxDMAPtr ioaddr + 0x64 +#define byMPHY ioaddr + 0x6c +#define byMIISR ioaddr + 0x6d +#define byBCR0 ioaddr + 0x6e +#define byBCR1 ioaddr + 0x6f +#define byMIICR ioaddr + 0x70 +#define byMIIAD ioaddr + 0x71 +#define wMIIDATA ioaddr + 0x72 +#define byEECSR ioaddr + 0x74 +#define byTEST ioaddr + 0x75 +#define byGPIO ioaddr + 0x76 +#define byCFGA ioaddr + 0x78 +#define byCFGB ioaddr + 0x79 +#define byCFGC ioaddr + 0x7a +#define byCFGD ioaddr + 0x7b +#define wTallyCntMPA ioaddr + 0x7c +#define wTallyCntCRC ioaddr + 0x7d +#define bySTICKHW ioaddr + 0x83 +#define byWOLcrClr ioaddr + 0xA4 +#define byWOLcgClr ioaddr + 0xA7 +#define byPwrcsrClr ioaddr + 0xAC + +/*--------------------- Exioaddr Definitions -------------------------*/ + +/* + * Bits in the RCR register + */ + +#define RCR_RRFT2 0x80 +#define RCR_RRFT1 0x40 +#define RCR_RRFT0 0x20 +#define RCR_PROM 0x10 +#define RCR_AB 0x08 +#define RCR_AM 0x04 +#define RCR_AR 0x02 +#define RCR_SEP 0x01 + +/* + * Bits in the TCR register + */ + +#define TCR_RTSF 0x80 +#define TCR_RTFT1 0x40 +#define TCR_RTFT0 0x20 +#define TCR_OFSET 0x08 +#define TCR_LB1 0x04 /* loopback[1] */ +#define TCR_LB0 0x02 /* loopback[0] */ + +/* + * Bits in the CR0 register + */ + +#define CR0_RDMD 0x40 /* rx descriptor polling demand */ +#define CR0_TDMD 0x20 /* tx descriptor polling demand */ +#define CR0_TXON 0x10 +#define CR0_RXON 0x08 +#define CR0_STOP 0x04 /* stop NIC, default = 1 */ +#define CR0_STRT 0x02 /* start NIC */ +#define CR0_INIT 0x01 /* start init process */ + + +/* + * Bits in the CR1 register + */ + +#define CR1_SFRST 0x80 /* software reset */ +#define CR1_RDMD1 0x40 /* RDMD1 */ +#define CR1_TDMD1 0x20 /* TDMD1 */ +#define CR1_KEYPAG 0x10 /* turn on par/key */ +#define CR1_DPOLL 0x08 /* disable rx/tx auto polling */ +#define CR1_FDX 0x04 /* full duplex mode */ +#define CR1_ETEN 0x02 /* early tx mode */ +#define CR1_EREN 0x01 /* early rx mode */ + +/* + * Bits in the CR register + */ + +#define CR_RDMD 0x0040 /* rx descriptor polling demand */ +#define CR_TDMD 0x0020 /* tx descriptor polling demand */ +#define CR_TXON 0x0010 +#define CR_RXON 0x0008 +#define CR_STOP 0x0004 /* stop NIC, default = 1 */ +#define CR_STRT 0x0002 /* start NIC */ +#define CR_INIT 0x0001 /* start init process */ +#define CR_SFRST 0x8000 /* software reset */ +#define CR_RDMD1 0x4000 /* RDMD1 */ +#define CR_TDMD1 0x2000 /* TDMD1 */ +#define CR_KEYPAG 0x1000 /* turn on par/key */ +#define CR_DPOLL 0x0800 /* disable rx/tx auto polling */ +#define CR_FDX 0x0400 /* full duplex mode */ +#define CR_ETEN 0x0200 /* early tx mode */ +#define CR_EREN 0x0100 /* early rx mode */ + +/* + * Bits in the IMR0 register + */ + +#define IMR0_CNTM 0x80 +#define IMR0_BEM 0x40 +#define IMR0_RUM 0x20 +#define IMR0_TUM 0x10 +#define IMR0_TXEM 0x08 +#define IMR0_RXEM 0x04 +#define IMR0_PTXM 0x02 +#define IMR0_PRXM 0x01 + +/* define imrshadow */ + +#define IMRShadow 0x5AFF + +/* + * Bits in the IMR1 register + */ + +#define IMR1_INITM 0x80 +#define IMR1_SRCM 0x40 +#define IMR1_NBFM 0x10 +#define IMR1_PRAIM 0x08 +#define IMR1_RES0M 0x04 +#define IMR1_ETM 0x02 +#define IMR1_ERM 0x01 + +/* + * Bits in the ISR register + */ + +#define ISR_INITI 0x8000 +#define ISR_SRCI 0x4000 +#define ISR_ABTI 0x2000 +#define ISR_NORBF 0x1000 +#define ISR_PKTRA 0x0800 +#define ISR_RES0 0x0400 +#define ISR_ETI 0x0200 +#define ISR_ERI 0x0100 +#define ISR_CNT 0x0080 +#define ISR_BE 0x0040 +#define ISR_RU 0x0020 +#define ISR_TU 0x0010 +#define ISR_TXE 0x0008 +#define ISR_RXE 0x0004 +#define ISR_PTX 0x0002 +#define ISR_PRX 0x0001 + +/* + * Bits in the ISR0 register + */ + +#define ISR0_CNT 0x80 +#define ISR0_BE 0x40 +#define ISR0_RU 0x20 +#define ISR0_TU 0x10 +#define ISR0_TXE 0x08 +#define ISR0_RXE 0x04 +#define ISR0_PTX 0x02 +#define ISR0_PRX 0x01 + +/* + * Bits in the ISR1 register + */ + +#define ISR1_INITI 0x80 +#define ISR1_SRCI 0x40 +#define ISR1_NORBF 0x10 +#define ISR1_PKTRA 0x08 +#define ISR1_ETI 0x02 +#define ISR1_ERI 0x01 + +/* ISR ABNORMAL CONDITION */ + +#define ISR_ABNORMAL ISR_BE+ISR_RU+ISR_TU+ISR_CNT+ISR_NORBF+ISR_PKTRA + +/* + * Bits in the MIISR register + */ + +#define MIISR_MIIERR 0x08 +#define MIISR_MRERR 0x04 +#define MIISR_LNKFL 0x02 +#define MIISR_SPEED 0x01 + +/* + * Bits in the MIICR register + */ + +#define MIICR_MAUTO 0x80 +#define MIICR_RCMD 0x40 +#define MIICR_WCMD 0x20 +#define MIICR_MDPM 0x10 +#define MIICR_MOUT 0x08 +#define MIICR_MDO 0x04 +#define MIICR_MDI 0x02 +#define MIICR_MDC 0x01 + +/* + * Bits in the EECSR register + */ + +#define EECSR_EEPR 0x80 /* eeprom programed status, 73h means programed */ +#define EECSR_EMBP 0x40 /* eeprom embeded programming */ +#define EECSR_AUTOLD 0x20 /* eeprom content reload */ +#define EECSR_DPM 0x10 /* eeprom direct programming */ +#define EECSR_CS 0x08 /* eeprom CS pin */ +#define EECSR_SK 0x04 /* eeprom SK pin */ +#define EECSR_DI 0x02 /* eeprom DI pin */ +#define EECSR_DO 0x01 /* eeprom DO pin */ + +/* + * Bits in the BCR0 register + */ + +#define BCR0_CRFT2 0x20 +#define BCR0_CRFT1 0x10 +#define BCR0_CRFT0 0x08 +#define BCR0_DMAL2 0x04 +#define BCR0_DMAL1 0x02 +#define BCR0_DMAL0 0x01 + +/* + * Bits in the BCR1 register + */ + +#define BCR1_CTSF 0x20 +#define BCR1_CTFT1 0x10 +#define BCR1_CTFT0 0x08 +#define BCR1_POT2 0x04 +#define BCR1_POT1 0x02 +#define BCR1_POT0 0x01 + +/* + * Bits in the CFGA register + */ + +#define CFGA_EELOAD 0x80 /* enable eeprom embeded and direct programming */ +#define CFGA_JUMPER 0x40 +#define CFGA_MTGPIO 0x08 +#define CFGA_T10EN 0x02 +#define CFGA_AUTO 0x01 + +/* + * Bits in the CFGB register + */ + +#define CFGB_PD 0x80 +#define CFGB_POLEN 0x02 +#define CFGB_LNKEN 0x01 + +/* + * Bits in the CFGC register + */ + +#define CFGC_M10TIO 0x80 +#define CFGC_M10POL 0x40 +#define CFGC_PHY1 0x20 +#define CFGC_PHY0 0x10 +#define CFGC_BTSEL 0x08 +#define CFGC_BPS2 0x04 /* bootrom select[2] */ +#define CFGC_BPS1 0x02 /* bootrom select[1] */ +#define CFGC_BPS0 0x01 /* bootrom select[0] */ + +/* + * Bits in the CFGD register + */ + +#define CFGD_GPIOEN 0x80 +#define CFGD_DIAG 0x40 +#define CFGD_MAGIC 0x10 +#define CFGD_CFDX 0x04 +#define CFGD_CEREN 0x02 +#define CFGD_CETEN 0x01 + +/* Bits in RSR */ +#define RSR_RERR 0x00000001 +#define RSR_CRC 0x00000002 +#define RSR_FAE 0x00000004 +#define RSR_FOV 0x00000008 +#define RSR_LONG 0x00000010 +#define RSR_RUNT 0x00000020 +#define RSR_SERR 0x00000040 +#define RSR_BUFF 0x00000080 +#define RSR_EDP 0x00000100 +#define RSR_STP 0x00000200 +#define RSR_CHN 0x00000400 +#define RSR_PHY 0x00000800 +#define RSR_BAR 0x00001000 +#define RSR_MAR 0x00002000 +#define RSR_RXOK 0x00008000 +#define RSR_ABNORMAL RSR_RERR+RSR_LONG+RSR_RUNT + +/* Bits in TSR */ +#define TSR_NCR0 0x00000001 +#define TSR_NCR1 0x00000002 +#define TSR_NCR2 0x00000004 +#define TSR_NCR3 0x00000008 +#define TSR_COLS 0x00000010 +#define TSR_CDH 0x00000080 +#define TSR_ABT 0x00000100 +#define TSR_OWC 0x00000200 +#define TSR_CRS 0x00000400 +#define TSR_UDF 0x00000800 +#define TSR_TBUFF 0x00001000 +#define TSR_SERR 0x00002000 +#define TSR_JAB 0x00004000 +#define TSR_TERR 0x00008000 +#define TSR_ABNORMAL TSR_TERR+TSR_OWC+TSR_ABT+TSR_JAB+TSR_CRS +#define TSR_OWN_BIT 0x80000000 + +#define CB_DELAY_LOOP_WAIT 10 /* 10ms */ +/* enabled mask value of irq */ + +#define W_IMR_MASK_VALUE 0x1BFF /* initial value of IMR */ + +/* Ethernet address filter type */ +#define PKT_TYPE_DIRECTED 0x0001 /* obsolete, directed address is always accepted */ +#define PKT_TYPE_MULTICAST 0x0002 +#define PKT_TYPE_ALL_MULTICAST 0x0004 +#define PKT_TYPE_BROADCAST 0x0008 +#define PKT_TYPE_PROMISCUOUS 0x0020 +#define PKT_TYPE_LONG 0x2000 +#define PKT_TYPE_RUNT 0x4000 +#define PKT_TYPE_ERROR 0x8000 /* accept error packets, e.g. CRC error */ + +/* Loopback mode */ + +#define NIC_LB_NONE 0x00 +#define NIC_LB_INTERNAL 0x01 +#define NIC_LB_PHY 0x02 /* MII or Internal-10BaseT loopback */ + +#define TX_RING_SIZE 2 +#define RX_RING_SIZE 2 +#define PKT_BUF_SZ 1536 /* Size of each temporary Rx buffer. */ + +/* Transmit and receive descriptors definition */ + +struct rhine_tx_desc +{ + union VTC_tx_status_tag + { + struct + { + unsigned long ncro:1; + unsigned long ncr1:1; + unsigned long ncr2:1; + unsigned long ncr3:1; + unsigned long cols:1; + unsigned long reserve_1:2; + unsigned long cdh:1; + unsigned long abt:1; + unsigned long owc:1; + unsigned long crs:1; + unsigned long udf:1; + unsigned long tbuff:1; + unsigned long serr:1; + unsigned long jab:1; + unsigned long terr:1; + unsigned long reserve_2:15; + unsigned long own_bit:1; + } + bits; + unsigned long lw; + } + tx_status; + + union VTC_tx_ctrl_tag + { + struct + { + unsigned long tx_buf_size:11; + unsigned long extend_tx_buf_size:4; + unsigned long chn:1; + unsigned long crc:1; + unsigned long reserve_1:4; + unsigned long stp:1; + unsigned long edp:1; + unsigned long ic:1; + unsigned long reserve_2:8; + } + bits; + unsigned long lw; + } + tx_ctrl; + + unsigned long buf_addr_1:32; + unsigned long buf_addr_2:32; + +}; + +struct rhine_rx_desc +{ + union VTC_rx_status_tag + { + struct + { + unsigned long rerr:1; + unsigned long crc_error:1; + unsigned long fae:1; + unsigned long fov:1; + unsigned long toolong:1; + unsigned long runt:1; + unsigned long serr:1; + unsigned long buff:1; + unsigned long edp:1; + unsigned long stp:1; + unsigned long chn:1; + unsigned long phy:1; + unsigned long bar:1; + unsigned long mar:1; + unsigned long reserve_1:1; + unsigned long rxok:1; + unsigned long frame_length:11; + unsigned long reverve_2:4; + unsigned long own_bit:1; + } + bits; + unsigned long lw; + } + rx_status; + + union VTC_rx_ctrl_tag + { + struct + { + unsigned long rx_buf_size:11; + unsigned long extend_rx_buf_size:4; + unsigned long reserved_1:17; + } + bits; + unsigned long lw; + } + rx_ctrl; + + unsigned long buf_addr_1:32; + unsigned long buf_addr_2:32; + +}; + + +/* The I/O extent. */ +#define rhine_TOTAL_SIZE 0x80 + +#ifdef HAVE_DEVLIST +struct netdev_entry rhine_drv = + { "rhine", rhine_probe, rhine_TOTAL_SIZE, NULL }; +#endif + +static int rhine_debug = 1; + +/* + Theory of Operation + +I. Board Compatibility + +This driver is designed for the VIA 86c100A Rhine-II PCI Fast Ethernet +controller. + +II. Board-specific settings + +Boards with this chip are functional only in a bus-master PCI slot. + +Many operational settings are loaded from the EEPROM to the Config word at +offset 0x78. This driver assumes that they are correct. +If this driver is compiled to use PCI memory space operations the EEPROM +must be configured to enable memory ops. + +III. Driver operation + +IIIa. Ring buffers + +This driver uses two statically allocated fixed-size descriptor lists +formed into rings by a branch from the final descriptor to the beginning of +the list. The ring sizes are set at compile time by RX/TX_RING_SIZE. + +IIIb/c. Transmit/Receive Structure + +This driver attempts to use a zero-copy receive and transmit scheme. + +Alas, all data buffers are required to start on a 32 bit boundary, so +the driver must often copy transmit packets into bounce buffers. + +The driver allocates full frame size skbuffs for the Rx ring buffers at +open() time and passes the skb->data field to the chip as receive data +buffers. When an incoming frame is less than RX_COPYBREAK bytes long, +a fresh skbuff is allocated and the frame is copied to the new skbuff. +When the incoming frame is larger, the skbuff is passed directly up the +protocol stack. Buffers consumed this way are replaced by newly allocated +skbuffs in the last phase of netdev_rx(). + +The RX_COPYBREAK value is chosen to trade-off the memory wasted by +using a full-sized skbuff for small frames vs. the copying costs of larger +frames. New boards are typically used in generously configured machines +and the underfilled buffers have negligible impact compared to the benefit of +a single allocation size, so the default value of zero results in never +copying packets. When copying is done, the cost is usually mitigated by using +a combined copy/checksum routine. Copying also preloads the cache, which is +most useful with small frames. + +Since the VIA chips are only able to transfer data to buffers on 32 bit +boundaries, the the IP header at offset 14 in an ethernet frame isn't +longword aligned for further processing. Copying these unaligned buffers +has the beneficial effect of 16-byte aligning the IP header. + +IIId. Synchronization + +The driver runs as two independent, single-threaded flows of control. One +is the send-packet routine, which enforces single-threaded use by the +dev->tbusy flag. The other thread is the interrupt handler, which is single +threaded by the hardware and interrupt handling software. + +The send packet thread has partial control over the Tx ring and 'dev->tbusy' +flag. It sets the tbusy flag whenever it's queuing a Tx packet. If the next +queue slot is empty, it clears the tbusy flag when finished otherwise it sets +the 'lp->tx_full' flag. + +The interrupt handler has exclusive control over the Rx ring and records stats +from the Tx ring. After reaping the stats, it marks the Tx queue entry as +empty by incrementing the dirty_tx mark. Iff the 'lp->tx_full' flag is set, it +clears both the tx_full and tbusy flags. + +IV. Notes + +IVb. References + +Preliminary VT86C100A manual from http://www.via.com.tw/ +http://cesdis.gsfc.nasa.gov/linux/misc/100mbps.html +http://cesdis.gsfc.nasa.gov/linux/misc/NWay.html + +IVc. Errata + +The VT86C100A manual is not reliable information. +The chip does not handle unaligned transmit or receive buffers, resulting +in significant performance degradation for bounce buffer copies on transmit +and unaligned IP headers on receive. +The chip does not pad to minimum transmit length. + +*/ + +/* The rest of these values should never change. */ +#define NUM_TX_DESC 2 /* Number of Tx descriptor registers. */ + +static struct rhine_private +{ + char devname[8]; /* Used only for kernel debugging. */ + const char *product_name; + struct rhine_rx_desc *rx_ring; + struct rhine_tx_desc *tx_ring; + char *rx_buffs[RX_RING_SIZE]; + char *tx_buffs[TX_RING_SIZE]; + + /* temporary Rx buffers. */ + + int chip_id; + int chip_revision; + unsigned short ioaddr; + unsigned int cur_rx, cur_tx; /* The next free and used entries */ + unsigned int dirty_rx, dirty_tx; + /* The saved address of a sent-in-place packet/buffer, for skfree(). */ + struct sk_buff *tx_skbuff[TX_RING_SIZE]; + unsigned char mc_filter[8]; /* Current multicast filter. */ + char phys[4]; /* MII device addresses. */ + unsigned int tx_full:1; /* The Tx queue is full. */ + unsigned int full_duplex:1; /* Full-duplex operation requested. */ + unsigned int default_port:4; /* Last dev->if_port value. */ + unsigned int media2:4; /* Secondary monitored media port. */ + unsigned int medialock:1; /* Don't sense media type. */ + unsigned int mediasense:1; /* Media sensing in progress. */ +} +rhine; + +static void rhine_probe1 (struct nic *nic, int ioaddr, + int chip_id, int options); +static int QueryAuto (int); +static int ReadMII (int byMIIIndex, int); +static void WriteMII (char, char, char, int); +static void MIIDelay (void); +static void rhine_init_ring (struct nic *dev); +static void rhine_disable (struct dev *dev); +static void rhine_reset (struct nic *nic); +static int rhine_poll (struct nic *nic, int retreive); +static void rhine_transmit (struct nic *nic, const char *d, unsigned int t, + unsigned int s, const char *p); + +/* Initialize the Rx and Tx rings, along with various 'dev' bits. */ +static void +rhine_init_ring (struct nic *nic) +{ + struct rhine_private *tp = (struct rhine_private *) nic->priv_data; + int i; + + tp->tx_full = 0; + tp->cur_rx = tp->cur_tx = 0; + tp->dirty_rx = tp->dirty_tx = 0; + + for (i = 0; i < RX_RING_SIZE; i++) + { + + tp->rx_ring[i].rx_status.bits.own_bit = 1; + tp->rx_ring[i].rx_ctrl.bits.rx_buf_size = 1536; + + tp->rx_ring[i].buf_addr_1 = virt_to_bus (tp->rx_buffs[i]); + tp->rx_ring[i].buf_addr_2 = virt_to_bus (&tp->rx_ring[i + 1]); + /* printf("[%d]buf1=%hX,buf2=%hX",i,tp->rx_ring[i].buf_addr_1,tp->rx_ring[i].buf_addr_2); */ + } + /* Mark the last entry as wrapping the ring. */ + /* tp->rx_ring[i-1].rx_ctrl.bits.rx_buf_size =1518; */ + tp->rx_ring[i - 1].buf_addr_2 = virt_to_bus (&tp->rx_ring[0]); + /*printf("[%d]buf1=%hX,buf2=%hX",i-1,tp->rx_ring[i-1].buf_addr_1,tp->rx_ring[i-1].buf_addr_2); */ + + /* The Tx buffer descriptor is filled in as needed, but we + do need to clear the ownership bit. */ + + for (i = 0; i < TX_RING_SIZE; i++) + { + + tp->tx_ring[i].tx_status.lw = 0; + tp->tx_ring[i].tx_ctrl.lw = 0x00e08000; + tp->tx_ring[i].buf_addr_1 = virt_to_bus (tp->tx_buffs[i]); + tp->tx_ring[i].buf_addr_2 = virt_to_bus (&tp->tx_ring[i + 1]); + /* printf("[%d]buf1=%hX,buf2=%hX",i,tp->tx_ring[i].buf_addr_1,tp->tx_ring[i].buf_addr_2); */ + } + + tp->tx_ring[i - 1].buf_addr_2 = virt_to_bus (&tp->tx_ring[0]); + /* printf("[%d]buf1=%hX,buf2=%hX",i,tp->tx_ring[i-1].buf_addr_1,tp->tx_ring[i-1].buf_addr_2); */ +} + +int +QueryAuto (int ioaddr) +{ + int byMIIIndex; + int MIIReturn; + + int advertising,mii_reg5; + int negociated; + + byMIIIndex = 0x04; + MIIReturn = ReadMII (byMIIIndex, ioaddr); + advertising=MIIReturn; + + byMIIIndex = 0x05; + MIIReturn = ReadMII (byMIIIndex, ioaddr); + mii_reg5=MIIReturn; + + negociated=mii_reg5 & advertising; + + if ( (negociated & 0x100) || (negociated & 0x1C0) == 0x40 ) + return 1; + else + return 0; + +} + +int +ReadMII (int byMIIIndex, int ioaddr) +{ + int ReturnMII; + char byMIIAdrbak; + char byMIICRbak; + char byMIItemp; + + byMIIAdrbak = inb (byMIIAD); + byMIICRbak = inb (byMIICR); + outb (byMIICRbak & 0x7f, byMIICR); + MIIDelay (); + + outb (byMIIIndex, byMIIAD); + MIIDelay (); + + outb (inb (byMIICR) | 0x40, byMIICR); + + byMIItemp = inb (byMIICR); + byMIItemp = byMIItemp & 0x40; + + while (byMIItemp != 0) + { + byMIItemp = inb (byMIICR); + byMIItemp = byMIItemp & 0x40; + } + MIIDelay (); + + ReturnMII = inw (wMIIDATA); + + outb (byMIIAdrbak, byMIIAD); + outb (byMIICRbak, byMIICR); + MIIDelay (); + + return (ReturnMII); + +} + +void +WriteMII (char byMIISetByte, char byMIISetBit, char byMIIOP, int ioaddr) +{ + int ReadMIItmp; + int MIIMask; + char byMIIAdrbak; + char byMIICRbak; + char byMIItemp; + + + byMIIAdrbak = inb (byMIIAD); + + byMIICRbak = inb (byMIICR); + outb (byMIICRbak & 0x7f, byMIICR); + MIIDelay (); + outb (byMIISetByte, byMIIAD); + MIIDelay (); + + outb (inb (byMIICR) | 0x40, byMIICR); + + byMIItemp = inb (byMIICR); + byMIItemp = byMIItemp & 0x40; + + while (byMIItemp != 0) + { + byMIItemp = inb (byMIICR); + byMIItemp = byMIItemp & 0x40; + } + MIIDelay (); + + ReadMIItmp = inw (wMIIDATA); + MIIMask = 0x0001; + MIIMask = MIIMask << byMIISetBit; + + + if (byMIIOP == 0) + { + MIIMask = ~MIIMask; + ReadMIItmp = ReadMIItmp & MIIMask; + } + else + { + ReadMIItmp = ReadMIItmp | MIIMask; + + } + outw (ReadMIItmp, wMIIDATA); + MIIDelay (); + + outb (inb (byMIICR) | 0x20, byMIICR); + byMIItemp = inb (byMIICR); + byMIItemp = byMIItemp & 0x20; + + while (byMIItemp != 0) + { + byMIItemp = inb (byMIICR); + byMIItemp = byMIItemp & 0x20; + } + MIIDelay (); + + outb (byMIIAdrbak & 0x7f, byMIIAD); + outb (byMIICRbak, byMIICR); + MIIDelay (); + +} + +void +MIIDelay (void) +{ + int i; + for (i = 0; i < 0x7fff; i++) + { + inb (0x61); + inb (0x61); + inb (0x61); + inb (0x61); + } +} + +/* Offsets to the device registers. */ +enum register_offsets { + StationAddr=0x00, RxConfig=0x06, TxConfig=0x07, ChipCmd=0x08, + IntrStatus=0x0C, IntrEnable=0x0E, + MulticastFilter0=0x10, MulticastFilter1=0x14, + RxRingPtr=0x18, TxRingPtr=0x1C, GFIFOTest=0x54, + MIIPhyAddr=0x6C, MIIStatus=0x6D, PCIBusConfig=0x6E, + MIICmd=0x70, MIIRegAddr=0x71, MIIData=0x72, MACRegEEcsr=0x74, + ConfigA=0x78, ConfigB=0x79, ConfigC=0x7A, ConfigD=0x7B, + RxMissed=0x7C, RxCRCErrs=0x7E, MiscCmd=0x81, + StickyHW=0x83, IntrStatus2=0x84, WOLcrClr=0xA4, WOLcgClr=0xA7, + PwrcsrClr=0xAC, +}; + +/* Bits in the interrupt status/mask registers. */ +enum intr_status_bits { + IntrRxDone=0x0001, IntrRxErr=0x0004, IntrRxEmpty=0x0020, + IntrTxDone=0x0002, IntrTxError=0x0008, IntrTxUnderrun=0x0210, + IntrPCIErr=0x0040, + IntrStatsMax=0x0080, IntrRxEarly=0x0100, + IntrRxOverflow=0x0400, IntrRxDropped=0x0800, IntrRxNoBuf=0x1000, + IntrTxAborted=0x2000, IntrLinkChange=0x4000, + IntrRxWakeUp=0x8000, + IntrNormalSummary=0x0003, IntrAbnormalSummary=0xC260, + IntrTxDescRace=0x080000, /* mapped from IntrStatus2 */ + IntrTxErrSummary=0x082218, +}; +#define DEFAULT_INTR (IntrRxDone | IntrRxErr | IntrRxEmpty| IntrRxOverflow | \ + IntrRxDropped | IntrRxNoBuf) + +/*************************************************************************** + IRQ - PXE IRQ Handler +***************************************************************************/ +void rhine_irq ( struct nic *nic, irq_action_t action ) { + struct rhine_private *tp = (struct rhine_private *) nic->priv_data; + /* Enable interrupts by setting the interrupt mask. */ + unsigned int intr_status; + + switch ( action ) { + case DISABLE : + case ENABLE : + intr_status = inw(nic->ioaddr + IntrStatus); + /* On Rhine-II, Bit 3 indicates Tx descriptor write-back race. */ + if (tp->chip_id == 0x3065) + intr_status |= inb(nic->ioaddr + IntrStatus2) << 16; + intr_status = (intr_status & ~DEFAULT_INTR); + if ( action == ENABLE ) + intr_status = intr_status | DEFAULT_INTR; + outw(intr_status, nic->ioaddr + IntrEnable); + break; + case FORCE : + outw(0x0010, nic->ioaddr + 0x84); + break; + } +} + +static int +rhine_probe (struct dev *dev, struct pci_device *pci) +{ + struct nic *nic = (struct nic *)dev; + struct rhine_private *tp = &rhine; + if (!pci->ioaddr) + return 0; + rhine_probe1 (nic, pci->ioaddr, pci->dev_id, -1); + + adjust_pci_device(pci); + rhine_reset (nic); + + dev->disable = rhine_disable; + nic->poll = rhine_poll; + nic->transmit = rhine_transmit; + nic->irqno = pci->irq; + nic->irq = rhine_irq; + nic->ioaddr = tp->ioaddr; + + + return 1; +} + +static void set_rx_mode(struct nic *nic __unused) { + struct rhine_private *tp = (struct rhine_private *) nic->priv_data; + unsigned char rx_mode; + int ioaddr = tp->ioaddr; + + /* ! IFF_PROMISC */ + outl(0xffffffff, byMAR0); + outl(0xffffffff, byMAR4); + rx_mode = 0x0C; + + outb(0x60 /* thresh */ | rx_mode, byRCR ); +} + +static void +rhine_probe1 (struct nic *nic, int ioaddr, int chip_id, int options) +{ + struct rhine_private *tp; + static int did_version = 0; /* Already printed version info. */ + int i; + unsigned int timeout; + int FDXFlag; + int byMIIvalue, LineSpeed, MIICRbak; + + if (rhine_debug > 0 && did_version++ == 0) + printf (version); + + /* D-Link provided reset code (with comment additions) */ + if((chip_id != 0x3043) && (chip_id != 0x6100)) { + unsigned char byOrgValue; + + if(rhine_debug > 0) + printf("Enabling Sticky Bit Workaround for Chip_id: 0x%hX\n" + , chip_id); + /* clear sticky bit before reset & read ethernet address */ + byOrgValue = inb(bySTICKHW); + byOrgValue = byOrgValue & 0xFC; + outb(byOrgValue, bySTICKHW); + + /* (bits written are cleared?) */ + /* disable force PME-enable */ + outb(0x80, byWOLcgClr); + /* disable power-event config bit */ + outb(0xFF, byWOLcrClr); + /* clear power status (undocumented in vt6102 docs?) */ + outb(0xFF, byPwrcsrClr); + + } + + /* Perhaps this should be read from the EEPROM? */ + for (i = 0; i < ETH_ALEN; i++) + nic->node_addr[i] = inb (byPAR0 + i); + printf ("IO address %hX Ethernet Address: %!\n", ioaddr, nic->node_addr); + + /* restart MII auto-negotiation */ + WriteMII (0, 9, 1, ioaddr); + printf ("Analyzing Media type,this will take several seconds........"); + for (i = 0; i < 5; i++) + { + /* need to wait 1 millisecond - we will round it up to 50-100ms */ + timeout = currticks() + 2; + for (timeout = currticks() + 2; currticks() < timeout;) + /* nothing */; + if (ReadMII (1, ioaddr) & 0x0020) + break; + } + printf ("OK\n"); + +#if 0 + /* JJM : for Debug */ + printf("MII : Address %hhX ",inb(ioaddr+0x6c)); + { + unsigned char st1,st2,adv1,adv2,l1,l2; + + st1=ReadMII(1,ioaddr)>>8; + st2=ReadMII(1,ioaddr)&0xFF; + adv1=ReadMII(4,ioaddr)>>8; + adv2=ReadMII(4,ioaddr)&0xFF; + l1=ReadMII(5,ioaddr)>>8; + l2=ReadMII(5,ioaddr)&0xFF; + printf(" status 0x%hhX%hhX, advertising 0x%hhX%hhX, link 0x%hhX%hhX\n", st1,st2,adv1,adv2,l1,l2); + } +#endif + + + /* query MII to know LineSpeed,duplex mode */ + byMIIvalue = inb (ioaddr + 0x6d); + LineSpeed = byMIIvalue & MIISR_SPEED; + if (LineSpeed != 0) //JJM + { + printf ("Linespeed=10Mbs"); + } + else + { + printf ("Linespeed=100Mbs"); + } + + FDXFlag = QueryAuto (ioaddr); + if (FDXFlag == 1) + { + printf (" Fullduplex\n"); + outw (CR_FDX, byCR0); + } + else + { + printf (" Halfduplex\n"); + } + + + /* set MII 10 FULL ON */ + WriteMII (17, 1, 1, ioaddr); + + /* turn on MII link change */ + MIICRbak = inb (byMIICR); + outb (MIICRbak & 0x7F, byMIICR); + MIIDelay (); + outb (0x41, byMIIAD); + MIIDelay (); + + /* while((inb(byMIIAD)&0x20)==0) ; */ + outb (MIICRbak | 0x80, byMIICR); + + nic->priv_data = &rhine; + tp = &rhine; + tp->chip_id = chip_id; + tp->ioaddr = ioaddr; + tp->phys[0] = -1; + + /* The lower four bits are the media type. */ + if (options > 0) + { + tp->full_duplex = (options & 16) ? 1 : 0; + tp->default_port = options & 15; + if (tp->default_port) + tp->medialock = 1; + } + return; +} + +static void +rhine_disable (struct dev *dev) +{ + struct nic *nic = (struct nic *)dev; + struct rhine_private *tp = (struct rhine_private *) nic->priv_data; + int ioaddr = tp->ioaddr; + + /* merge reset and disable */ + rhine_reset(nic); + + printf ("rhine disable\n"); + /* Switch to loopback mode to avoid hardware races. */ + writeb(0x60 | 0x01, byTCR); + /* Stop the chip's Tx and Rx processes. */ + writew(CR_STOP, byCR0); +} + +/************************************************************************** +ETH_RESET - Reset adapter +***************************************************************************/ +static void +rhine_reset (struct nic *nic) +{ + struct rhine_private *tp = (struct rhine_private *) nic->priv_data; + int ioaddr = tp->ioaddr; + int i, j; + int FDXFlag, CRbak; + int rx_ring_tmp, rx_ring_tmp1; + int tx_ring_tmp, tx_ring_tmp1; + int rx_bufs_tmp, rx_bufs_tmp1; + int tx_bufs_tmp, tx_bufs_tmp1; + + static char buf1[RX_RING_SIZE * PKT_BUF_SZ + 32]; + static char buf2[RX_RING_SIZE * PKT_BUF_SZ + 32]; + static char desc1[TX_RING_SIZE * sizeof (struct rhine_tx_desc) + 32]; + static char desc2[TX_RING_SIZE * sizeof (struct rhine_tx_desc) + 32]; + + /* printf ("rhine_reset\n"); */ + /* Soft reset the chip. */ + /*outb(CmdReset, ioaddr + ChipCmd); */ + + tx_bufs_tmp = (int) buf1; + tx_ring_tmp = (int) desc1; + rx_bufs_tmp = (int) buf2; + rx_ring_tmp = (int) desc2; + + /* tune RD TD 32 byte alignment */ + rx_ring_tmp1 = (int) virt_to_bus ((char *) rx_ring_tmp); + j = (rx_ring_tmp1 + 32) & (~0x1f); + /* printf ("txring[%d]", j); */ + tp->rx_ring = (struct rhine_rx_desc *) bus_to_virt (j); + + tx_ring_tmp1 = (int) virt_to_bus ((char *) tx_ring_tmp); + j = (tx_ring_tmp1 + 32) & (~0x1f); + tp->tx_ring = (struct rhine_tx_desc *) bus_to_virt (j); + /* printf ("rxring[%X]", j); */ + + + tx_bufs_tmp1 = (int) virt_to_bus ((char *) tx_bufs_tmp); + j = (int) (tx_bufs_tmp1 + 32) & (~0x1f); + tx_bufs_tmp = (int) bus_to_virt (j); + /* printf ("txb[%X]", j); */ + + rx_bufs_tmp1 = (int) virt_to_bus ((char *) rx_bufs_tmp); + j = (int) (rx_bufs_tmp1 + 32) & (~0x1f); + rx_bufs_tmp = (int) bus_to_virt (j); + /* printf ("rxb[%X][%X]", rx_bufs_tmp1, j); */ + + for (i = 0; i < RX_RING_SIZE; i++) + { + tp->rx_buffs[i] = (char *) rx_bufs_tmp; + /* printf("r[%X]",tp->rx_buffs[i]); */ + rx_bufs_tmp += 1536; + } + + for (i = 0; i < TX_RING_SIZE; i++) + { + tp->tx_buffs[i] = (char *) tx_bufs_tmp; + /* printf("t[%X]",tp->tx_buffs[i]); */ + tx_bufs_tmp += 1536; + } + + /* software reset */ + outb (CR1_SFRST, byCR1); + MIIDelay (); + + /* printf ("init ring"); */ + rhine_init_ring (nic); + /*write TD RD Descriptor to MAC */ + outl (virt_to_bus (tp->rx_ring), dwCurrentRxDescAddr); + outl (virt_to_bus (tp->tx_ring), dwCurrentTxDescAddr); + + /* Setup Multicast */ + set_rx_mode(nic); + + /* close IMR */ + outw (0x0000, byIMR0); + + /* set TCR RCR threshold */ + outb (0x06, byBCR0); + outb (0x00, byBCR1); + outb (0x2c, byRCR); + outb (0x60, byTCR); + /* Set Fulldupex */ + FDXFlag = QueryAuto (ioaddr); + if (FDXFlag == 1) + { + outb (CFGD_CFDX, byCFGD); + outw (CR_FDX, byCR0); + } + + /* KICK NIC to WORK */ + CRbak = inw (byCR0); + CRbak = CRbak & 0xFFFB; /* not CR_STOP */ + outw ((CRbak | CR_STRT | CR_TXON | CR_RXON | CR_DPOLL), byCR0); + + /*set IMR to work */ + outw (IMRShadow, byIMR0); +} +/* Beware of PCI posted writes */ +#define IOSYNC do { readb(nic->ioaddr + StationAddr); } while (0) + +static int +rhine_poll (struct nic *nic, int retreive) +{ + struct rhine_private *tp = (struct rhine_private *) nic->priv_data; + int rxstatus, good = 0;; + + if (tp->rx_ring[tp->cur_rx].rx_status.bits.own_bit == 0) + { + unsigned int intr_status; + /* There is a packet ready */ + if(!retreive) + return 1; + + intr_status = inw(nic->ioaddr + IntrStatus); + /* On Rhine-II, Bit 3 indicates Tx descriptor write-back race. */ +#if 0 + if (tp->chip_id == 0x3065) + intr_status |= inb(nic->ioaddr + IntrStatus2) << 16; +#endif + /* Acknowledge all of the current interrupt sources ASAP. */ + if (intr_status & IntrTxDescRace) + outb(0x08, nic->ioaddr + IntrStatus2); + outw(intr_status & 0xffff, nic->ioaddr + IntrStatus); + IOSYNC; + + rxstatus = tp->rx_ring[tp->cur_rx].rx_status.lw; + if ((rxstatus & 0x0300) != 0x0300) + { + printf("rhine_poll: bad status\n"); + } + else if (rxstatus & (RSR_ABNORMAL)) + { + printf ("rxerr[%X]\n", rxstatus); + } + else + good = 1; + + if (good) + { + nic->packetlen = tp->rx_ring[tp->cur_rx].rx_status.bits.frame_length; + memcpy (nic->packet, tp->rx_buffs[tp->cur_rx], nic->packetlen); + /* printf ("Packet RXed\n"); */ + } + tp->rx_ring[tp->cur_rx].rx_status.bits.own_bit = 1; + tp->cur_rx++; + tp->cur_rx = tp->cur_rx % RX_RING_SIZE; + } + /* Acknowledge all of the current interrupt sources ASAP. */ + outw(DEFAULT_INTR & ~IntrRxDone, nic->ioaddr + IntrStatus); + + IOSYNC; + + return good; +} + +static void +rhine_transmit (struct nic *nic, + const char *d, unsigned int t, unsigned int s, const char *p) +{ + struct rhine_private *tp = (struct rhine_private *) nic->priv_data; + int ioaddr = tp->ioaddr; + int entry; + unsigned char CR1bak; + + /*printf ("rhine_transmit\n"); */ + /* setup ethernet header */ + + + /* Calculate the next Tx descriptor entry. */ + entry = tp->cur_tx % TX_RING_SIZE; + + memcpy (tp->tx_buffs[entry], d, ETH_ALEN); /* dst */ + memcpy (tp->tx_buffs[entry] + ETH_ALEN, nic->node_addr, ETH_ALEN); /* src */ + *((char *) tp->tx_buffs[entry] + 12) = t >> 8; /* type */ + *((char *) tp->tx_buffs[entry] + 13) = t; + memcpy (tp->tx_buffs[entry] + ETH_HLEN, p, s); + s += ETH_HLEN; + while (s < ETH_ZLEN) + *((char *) tp->tx_buffs[entry] + ETH_HLEN + (s++)) = 0; + + tp->tx_ring[entry].tx_ctrl.bits.tx_buf_size = s; + + tp->tx_ring[entry].tx_status.bits.own_bit = 1; + + + CR1bak = inb (byCR1); + + CR1bak = CR1bak | CR1_TDMD1; + /*printf("tdsw=[%X]",tp->tx_ring[entry].tx_status.lw); */ + /*printf("tdcw=[%X]",tp->tx_ring[entry].tx_ctrl.lw); */ + /*printf("tdbuf1=[%X]",tp->tx_ring[entry].buf_addr_1); */ + /*printf("tdbuf2=[%X]",tp->tx_ring[entry].buf_addr_2); */ + /*printf("td1=[%X]",inl(dwCurrentTDSE0)); */ + /*printf("td2=[%X]",inl(dwCurrentTDSE1)); */ + /*printf("td3=[%X]",inl(dwCurrentTDSE2)); */ + /*printf("td4=[%X]",inl(dwCurrentTDSE3)); */ + + outb (CR1bak, byCR1); + /* Wait until transmit is finished */ + while (tp->tx_ring[entry].tx_status.bits.own_bit != 0) + ; + tp->cur_tx++; + + /*outw(IMRShadow,byIMR0); */ + /*dev_kfree_skb(tp->tx_skbuff[entry], FREE_WRITE); */ + /*tp->tx_skbuff[entry] = 0; */ +} + +static struct pci_id rhine_nics[] = { +PCI_ROM(0x1106, 0x3065, "dlink-530tx", "VIA 6102"), +PCI_ROM(0x1106, 0x3106, "via-rhine-6105", "VIA 6105"), +PCI_ROM(0x1106, 0x3043, "dlink-530tx-old", "VIA 3043"), /* Rhine-I 86c100a */ +PCI_ROM(0x1106, 0x3053, "via6105m", "VIA 6105M"), +PCI_ROM(0x1106, 0x6100, "via-rhine-old", "VIA 86C100A"), /* Rhine-II */ +}; + +struct pci_driver rhine_driver = { + .type = NIC_DRIVER, + .name = "VIA 86C100", + .probe = rhine_probe, + .ids = rhine_nics, + .id_count = sizeof(rhine_nics)/sizeof(rhine_nics[0]), + .class = 0, +}; + +/* EOF via-rhine.c */ diff --git a/usr/src/grub/grub-0.97/netboot/w89c840.c b/usr/src/grub/grub-0.97/netboot/w89c840.c new file mode 100644 index 0000000000..fa31bc957b --- /dev/null +++ b/usr/src/grub/grub-0.97/netboot/w89c840.c @@ -0,0 +1,955 @@ +/* + * Etherboot - BOOTP/TFTP Bootstrap Program + * + * w89c840.c -- This file implements the winbond-840 driver for etherboot. + * + */ + +/* + * Adapted by Igor V. Kovalenko + * -- + * OR + * -- + * Initial adaptaion stage, including testing, completed 23 August 2000. + */ + +/* + * 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. + * + * 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. + */ + +/* + * date version by what + * Written: Aug 20 2000 V0.10 iko Initial revision. + * changes: Aug 22 2000 V0.90 iko Works! + * Aug 23 2000 V0.91 iko Cleanup, posted to etherboot + * maintainer. + * Aug 26 2000 V0.92 iko Fixed Rx ring handling. + * First Linux Kernel (TM) + * successfully loaded using + * this driver. + * Jan 07 2001 V0.93 iko Transmitter timeouts are handled + * using timer2 routines. Proposed + * by Ken Yap to eliminate CPU speed + * dependency. + * Dec 12 2003 V0.94 timlegge Fixed issues in 5.2, removed + * interrupt usage, enabled + * multicast support + * + * This is the etherboot driver for cards based on Winbond W89c840F chip. + * + * It was written from skeleton source, with Donald Becker's winbond-840.c + * kernel driver as a guideline. Mostly the w89c840 related definitions + * and the lower level routines have been cut-and-pasted into this source. + * + * Frankly speaking, about 90% of the code was obtained using cut'n'paste + * sequence :) while the remainder appeared while brainstorming + * Linux Kernel 2.4.0-testX source code. Thanks, Donald and Linus! + * + * There was a demand for using this card in a rather large + * remote boot environment at MSKP OVTI Lab of + * Moscow Institute for Physics and Technology (MIPT) -- http://www.mipt.ru/ + * so you may count that for motivation. + * + */ + +/* + * If you want to see debugging output then define W89C840_DEBUG + */ + +/* +#define W89C840_DEBUG +*/ + +/* + * Keep using IO_OPS for Etherboot driver! + */ +#define USE_IO_OPS + +#include "etherboot.h" +#include "nic.h" +#include "pci.h" +#include "timer.h" + +static const char *w89c840_version = "driver Version 0.94 - December 12, 2003"; + +typedef unsigned char u8; +typedef signed char s8; +typedef unsigned short u16; +typedef signed short s16; +typedef unsigned int u32; +typedef signed int s32; + +/* Linux support functions */ +#define virt_to_le32desc(addr) virt_to_bus(addr) +#define le32desc_to_virt(addr) bus_to_virt(addr) + +/* +#define cpu_to_le32(val) (val) +#define le32_to_cpu(val) (val) +*/ + +/* Operational parameters that are set at compile time. */ + +/* Keep the ring sizes a power of two for compile efficiency. + The compiler will convert '%'<2^N> into a bit mask. + Making the Tx ring too large decreases the effectiveness of channel + bonding and packet priority. + There are no ill effects from too-large receive rings. */ +#define TX_RING_SIZE 2 +#define RX_RING_SIZE 2 + +/* The presumed FIFO size for working around the Tx-FIFO-overflow bug. + To avoid overflowing we don't queue again until we have room for a + full-size packet. + */ +#define TX_FIFO_SIZE (2048) +#define TX_BUG_FIFO_LIMIT (TX_FIFO_SIZE-1514-16) + +/* Operational parameters that usually are not changed. */ +/* Time in jiffies before concluding the transmitter is hung. */ +#define TX_TIMEOUT (10*TICKS_PER_MS) + +#define PKT_BUF_SZ 1536 /* Size of each temporary Rx buffer.*/ + +/* + * Used to be this much CPU loops on Celeron@400 (?), + * now using real timer and TX_TIMEOUT! + * #define TX_LOOP_COUNT 10000000 + */ + +#if !defined(__OPTIMIZE__) +#warning You must compile this file with the correct options! +#warning See the last lines of the source file. +#error You must compile this driver with "-O". +#endif + +enum chip_capability_flags {CanHaveMII=1, HasBrokenTx=2}; + +#ifdef USE_IO_OPS +#define W840_FLAGS (PCI_USES_IO | PCI_ADDR0 | PCI_USES_MASTER) +#else +#define W840_FLAGS (PCI_USES_MEM | PCI_ADDR1 | PCI_USES_MASTER) +#endif + +static u32 driver_flags = CanHaveMII | HasBrokenTx; + +/* This driver was written to use PCI memory space, however some x86 systems + work only with I/O space accesses. Pass -DUSE_IO_OPS to use PCI I/O space + accesses instead of memory space. */ + +#ifdef USE_IO_OPS +#undef readb +#undef readw +#undef readl +#undef writeb +#undef writew +#undef writel +#define readb inb +#define readw inw +#define readl inl +#define writeb outb +#define writew outw +#define writel outl +#endif + +/* Offsets to the Command and Status Registers, "CSRs". + While similar to the Tulip, these registers are longword aligned. + Note: It's not useful to define symbolic names for every register bit in + the device. The name can only partially document the semantics and make + the driver longer and more difficult to read. +*/ +enum w840_offsets { + PCIBusCfg=0x00, TxStartDemand=0x04, RxStartDemand=0x08, + RxRingPtr=0x0C, TxRingPtr=0x10, + IntrStatus=0x14, NetworkConfig=0x18, IntrEnable=0x1C, + RxMissed=0x20, EECtrl=0x24, MIICtrl=0x24, BootRom=0x28, GPTimer=0x2C, + CurRxDescAddr=0x30, CurRxBufAddr=0x34, /* Debug use */ + MulticastFilter0=0x38, MulticastFilter1=0x3C, StationAddr=0x40, + CurTxDescAddr=0x4C, CurTxBufAddr=0x50, +}; + +/* Bits in the interrupt status/enable registers. */ +/* The bits in the Intr Status/Enable registers, mostly interrupt sources. */ +enum intr_status_bits { + NormalIntr=0x10000, AbnormalIntr=0x8000, + IntrPCIErr=0x2000, TimerInt=0x800, + IntrRxDied=0x100, RxNoBuf=0x80, IntrRxDone=0x40, + TxFIFOUnderflow=0x20, RxErrIntr=0x10, + TxIdle=0x04, IntrTxStopped=0x02, IntrTxDone=0x01, +}; + +/* Bits in the NetworkConfig register. */ +enum rx_mode_bits { + AcceptErr=0x80, AcceptRunt=0x40, + AcceptBroadcast=0x20, AcceptMulticast=0x10, + AcceptAllPhys=0x08, AcceptMyPhys=0x02, +}; + +enum mii_reg_bits { + MDIO_ShiftClk=0x10000, MDIO_DataIn=0x80000, MDIO_DataOut=0x20000, + MDIO_EnbOutput=0x40000, MDIO_EnbIn = 0x00000, +}; + +/* The Tulip Rx and Tx buffer descriptors. */ +struct w840_rx_desc { + s32 status; + s32 length; + u32 buffer1; + u32 next_desc; +}; + +struct w840_tx_desc { + s32 status; + s32 length; + u32 buffer1, buffer2; /* We use only buffer 1. */ +}; + +/* Bits in network_desc.status */ +enum desc_status_bits { + DescOwn=0x80000000, DescEndRing=0x02000000, DescUseLink=0x01000000, + DescWholePkt=0x60000000, DescStartPkt=0x20000000, DescEndPkt=0x40000000, + DescIntr=0x80000000, +}; +#define PRIV_ALIGN 15 /* Required alignment mask */ +#define PRIV_ALIGN_BYTES 32 + +static struct winbond_private +{ + /* Descriptor rings first for alignment. */ + struct w840_rx_desc rx_ring[RX_RING_SIZE]; + struct w840_tx_desc tx_ring[TX_RING_SIZE]; + struct net_device *next_module; /* Link for devices of this type. */ + void *priv_addr; /* Unaligned address for kfree */ + const char *product_name; + /* Frequently used values: keep some adjacent for cache effect. */ + int chip_id, drv_flags; + struct pci_dev *pci_dev; + int csr6; + struct w840_rx_desc *rx_head_desc; + unsigned int cur_rx, dirty_rx; /* Producer/consumer ring indices */ + unsigned int rx_buf_sz; /* Based on MTU+slack. */ + unsigned int cur_tx, dirty_tx; + int tx_q_bytes; + unsigned int tx_full:1; /* The Tx queue is full. */ + /* These values are keep track of the transceiver/media in use. */ + unsigned int full_duplex:1; /* Full-duplex operation requested. */ + unsigned int duplex_lock:1; + unsigned int medialock:1; /* Do not sense media. */ + unsigned int default_port:4; /* Last dev->if_port value. */ + /* MII transceiver section. */ + int mii_cnt; /* MII device addresses. */ + u16 advertising; /* NWay media advertisement */ + unsigned char phys[2]; /* MII device addresses. */ +} w840private __attribute__ ((aligned (PRIV_ALIGN_BYTES))); + +/* NIC specific static variables go here */ + +static int ioaddr; +static unsigned short eeprom [0x40]; +static char rx_packet[PKT_BUF_SZ * RX_RING_SIZE]; +static char tx_packet[PKT_BUF_SZ * TX_RING_SIZE]; + +static int eeprom_read(long ioaddr, int location); +static int mdio_read(int base_address, int phy_id, int location); +#if 0 +static void mdio_write(int base_address, int phy_id, int location, int value); +#endif + +static void check_duplex(void); +static void set_rx_mode(void); +static void init_ring(void); + +#if defined(W89C840_DEBUG) +static void decode_interrupt(u32 intr_status) +{ + printf("Interrupt status: "); + +#define TRACE_INTR(_intr_) \ + if (intr_status & (_intr_)) { printf (" " #_intr_); } + + TRACE_INTR(NormalIntr); + TRACE_INTR(AbnormalIntr); + TRACE_INTR(IntrPCIErr); + TRACE_INTR(TimerInt); + TRACE_INTR(IntrRxDied); + TRACE_INTR(RxNoBuf); + TRACE_INTR(IntrRxDone); + TRACE_INTR(TxFIFOUnderflow); + TRACE_INTR(RxErrIntr); + TRACE_INTR(TxIdle); + TRACE_INTR(IntrTxStopped); + TRACE_INTR(IntrTxDone); + + printf("\n"); + /*sleep(1);*/ +} +#endif + +/************************************************************************** +w89c840_reset - Reset adapter +***************************************************************************/ +static void w89c840_reset(struct nic *nic) +{ + int i; + + /* Reset the chip to erase previous misconfiguration. + No hold time required! */ + writel(0x00000001, ioaddr + PCIBusCfg); + + init_ring(); + + writel(virt_to_bus(w840private.rx_ring), ioaddr + RxRingPtr); + writel(virt_to_bus(w840private.tx_ring), ioaddr + TxRingPtr); + + for (i = 0; i < ETH_ALEN; i++) + writeb(nic->node_addr[i], ioaddr + StationAddr + i); + + /* Initialize other registers. */ + /* Configure the PCI bus bursts and FIFO thresholds. + 486: Set 8 longword cache alignment, 8 longword burst. + 586: Set 16 longword cache alignment, no burst limit. + Cache alignment bits 15:14 Burst length 13:8 + 0000 0000 align to cache 0800 8 longwords + 4000 8 longwords 0100 1 longword 1000 16 longwords + 8000 16 longwords 0200 2 longwords 2000 32 longwords + C000 32 longwords 0400 4 longwords + Wait the specified 50 PCI cycles after a reset by initializing + Tx and Rx queues and the address filter list. */ + + writel(0xE010, ioaddr + PCIBusCfg); + + writel(0, ioaddr + RxStartDemand); + w840private.csr6 = 0x20022002; + check_duplex(); + set_rx_mode(); + + /* Do not enable the interrupts Etherboot doesn't need them */ +/* + writel(0x1A0F5, ioaddr + IntrStatus); + writel(0x1A0F5, ioaddr + IntrEnable); +*/ +#if defined(W89C840_DEBUG) + printf("winbond-840 : Done reset.\n"); +#endif +} + +#if 0 +static void handle_intr(u32 intr_stat) +{ + if ((intr_stat & (NormalIntr|AbnormalIntr)) == 0) { + /* we are polling, do not return now */ + /*return 0;*/ + } else { + /* Acknowledge all of the current interrupt sources ASAP. */ + writel(intr_stat & 0x001ffff, ioaddr + IntrStatus); + } + + if (intr_stat & AbnormalIntr) { + /* There was an abnormal interrupt */ + printf("\n-=- Abnormal interrupt.\n"); + +#if defined(W89C840_DEBUG) + decode_interrupt(intr_stat); +#endif + + if (intr_stat & RxNoBuf) { + /* There was an interrupt */ + printf("-=- <=> No receive buffers available.\n"); + writel(0, ioaddr + RxStartDemand); + } + } +} +#endif + +/************************************************************************** +w89c840_poll - Wait for a frame +***************************************************************************/ +static int w89c840_poll(struct nic *nic, int retrieve) +{ + /* return true if there's an ethernet packet ready to read */ + /* nic->packet should contain data on return */ + /* nic->packetlen should contain length of data */ + int packet_received = 0; + +#if defined(W89C840_DEBUG) + u32 intr_status = readl(ioaddr + IntrStatus); +#endif + + do { + /* Code from netdev_rx(dev) */ + + int entry = w840private.cur_rx % RX_RING_SIZE; + + struct w840_rx_desc *desc = w840private.rx_head_desc; + s32 status = desc->status; + + if (status & DescOwn) { + /* DescOwn bit is still set, we should wait for RX to complete */ + packet_received = 0; + break; + } + + if ( !retrieve ) { + packet_received = 1; + break; + } + + if ((status & 0x38008300) != 0x0300) { + if ((status & 0x38000300) != 0x0300) { + /* Ingore earlier buffers. */ + if ((status & 0xffff) != 0x7fff) { + printf("winbond-840 : Oversized Ethernet frame spanned " + "multiple buffers, entry %d status %X !\n", + w840private.cur_rx, status); + } + } else if (status & 0x8000) { + /* There was a fatal error. */ +#if defined(W89C840_DEBUG) + printf("winbond-840 : Receive error, Rx status %X :", status); + if (status & 0x0890) { + printf(" RXLEN_ERROR"); + } + if (status & 0x004C) { + printf(", FRAME_ERROR"); + } + if (status & 0x0002) { + printf(", CRC_ERROR"); + } + printf("\n"); +#endif + + /* Simpy do a reset now... */ + w89c840_reset(nic); + + packet_received = 0; + break; + } + } else { + /* Omit the four octet CRC from the length. */ + int pkt_len = ((status >> 16) & 0x7ff) - 4; + +#if defined(W89C840_DEBUG) + printf(" netdev_rx() normal Rx pkt ring %d length %d status %X\n", entry, pkt_len, status); +#endif + + nic->packetlen = pkt_len; + + /* Check if the packet is long enough to accept without copying + to a minimally-sized skbuff. */ + + memcpy(nic->packet, le32desc_to_virt(w840private.rx_ring[entry].buffer1), pkt_len); + packet_received = 1; + + /* Release buffer to NIC */ + w840private.rx_ring[entry].status = DescOwn; + +#if defined(W89C840_DEBUG) + /* You will want this info for the initial debug. */ + printf(" Rx data %hhX:%hhX:%hhX:%hhX:%hhX:" + "%hhX %hhX:%hhX:%hhX:%hhX:%hhX:%hhX %hhX%hhX " + "%hhX.%hhX.%hhX.%hhX.\n", + nic->packet[0], nic->packet[1], nic->packet[2], nic->packet[3], + nic->packet[4], nic->packet[5], nic->packet[6], nic->packet[7], + nic->packet[8], nic->packet[9], nic->packet[10], + nic->packet[11], nic->packet[12], nic->packet[13], + nic->packet[14], nic->packet[15], nic->packet[16], + nic->packet[17]); +#endif + + } + + entry = (++w840private.cur_rx) % RX_RING_SIZE; + w840private.rx_head_desc = &w840private.rx_ring[entry]; + } while (0); + + return packet_received; +} + +/************************************************************************** +w89c840_transmit - Transmit a frame +***************************************************************************/ + +static void w89c840_transmit( + struct nic *nic, + const char *d, /* Destination */ + unsigned int t, /* Type */ + unsigned int s, /* size */ + const char *p) /* Packet */ +{ + /* send the packet to destination */ + unsigned entry; + int transmit_status; + + /* Caution: the write order is important here, set the field + with the "ownership" bits last. */ + + /* Fill in our transmit buffer */ + entry = w840private.cur_tx % TX_RING_SIZE; + + memcpy (tx_packet, d, ETH_ALEN); /* dst */ + memcpy (tx_packet + ETH_ALEN, nic->node_addr, ETH_ALEN);/* src */ + + *((char *) tx_packet + 12) = t >> 8; /* type */ + *((char *) tx_packet + 13) = t; + + memcpy (tx_packet + ETH_HLEN, p, s); + s += ETH_HLEN; + + while (s < ETH_ZLEN) + *((char *) tx_packet + ETH_HLEN + (s++)) = 0; + + w840private.tx_ring[entry].buffer1 = virt_to_le32desc(tx_packet); + + w840private.tx_ring[entry].length = (DescWholePkt | (u32) s); + if (entry >= TX_RING_SIZE-1) /* Wrap ring */ + w840private.tx_ring[entry].length |= (DescIntr | DescEndRing); + w840private.tx_ring[entry].status = (DescOwn); + w840private.cur_tx++; + + w840private.tx_q_bytes = (u16) s; + writel(0, ioaddr + TxStartDemand); + + /* Work around horrible bug in the chip by marking the queue as full + when we do not have FIFO room for a maximum sized packet. */ + + if ((w840private.drv_flags & HasBrokenTx) && w840private.tx_q_bytes > TX_BUG_FIFO_LIMIT) { + /* Actually this is left to help finding error tails later in debugging... + * See Linux kernel driver in winbond-840.c for details. + */ + w840private.tx_full = 1; + } + +#if defined(W89C840_DEBUG) + printf("winbond-840 : Transmit frame # %d size %d queued in slot %d.\n", w840private.cur_tx, s, entry); +#endif + + /* Now wait for TX to complete. */ + transmit_status = w840private.tx_ring[entry].status; + + load_timer2(TX_TIMEOUT); + + { +#if defined W89C840_DEBUG + u32 intr_stat = 0; +#endif + while (1) { + +#if defined(W89C840_DEBUG) + decode_interrupt(intr_stat); +#endif + + while ( (transmit_status & DescOwn) && timer2_running()) { + + transmit_status = w840private.tx_ring[entry].status; + } + + break; + } + } + + if ((transmit_status & DescOwn) == 0) { + +#if defined(W89C840_DEBUG) + printf("winbond-840 : transmission complete after wait loop iterations, status %X\n", + w840private.tx_ring[entry].status); +#endif + + return; + } + + /* Transmit timed out... */ + + printf("winbond-840 : transmission TIMEOUT : status %X\n", w840private.tx_ring[entry].status); + + return; +} + +/************************************************************************** +w89c840_disable - Turn off ethernet interface +***************************************************************************/ +static void w89c840_disable(struct dev *dev) +{ + struct nic *nic = (struct nic *)dev; + /* merge reset and disable */ + w89c840_reset(nic); + + /* Don't know what to do to disable the board. Is this needed at all? */ + /* Yes, a live NIC can corrupt the loaded memory later [Ken] */ + /* Stop the chip's Tx and Rx processes. */ + writel(w840private.csr6 &= ~0x20FA, ioaddr + NetworkConfig); +} + +/************************************************************************** +w89c840_irq - Enable, Disable, or Force interrupts +***************************************************************************/ +static void w89c840_irq(struct nic *nic __unused, irq_action_t action __unused) +{ + switch ( action ) { + case DISABLE : + break; + case ENABLE : + break; + case FORCE : + break; + } +} + +/************************************************************************** +w89c840_probe - Look for an adapter, this routine's visible to the outside +***************************************************************************/ +static int w89c840_probe(struct dev *dev, struct pci_device *p) +{ + struct nic *nic = (struct nic *)dev; + u16 sum = 0; + int i, j; + unsigned short value; + + if (p->ioaddr == 0) + return 0; + + ioaddr = p->ioaddr; + nic->ioaddr = p->ioaddr & ~3; + nic->irqno = 0; + + +#if defined(W89C840_DEBUG) + printf("winbond-840: PCI bus %hhX device function %hhX: I/O address: %hX\n", p->bus, p->devfn, ioaddr); +#endif + + ioaddr = ioaddr & ~3; /* Mask the bit that says "this is an io addr" */ + + /* From Matt Hortman */ + if (p->vendor == PCI_VENDOR_ID_WINBOND2 + && p->dev_id == PCI_DEVICE_ID_WINBOND2_89C840) { + + /* detected "Winbond W89c840 Fast Ethernet PCI NIC" */ + + } else if ( p->vendor == PCI_VENDOR_ID_COMPEX + && p->dev_id == PCI_DEVICE_ID_COMPEX_RL100ATX) { + + /* detected "Compex RL100ATX Fast Ethernet PCI NIC" */ + + } else { + /* Gee, guess what? They missed again. */ + printf("device ID : %X - is not a Compex RL100ATX NIC.\n", p->dev_id); + return 0; + } + + printf(" %s\n", w89c840_version); + + adjust_pci_device(p); + + /* Ok. Got one. Read the eeprom. */ + for (j = 0, i = 0; i < 0x40; i++) { + value = eeprom_read(ioaddr, i); + eeprom[i] = value; + sum += value; + } + + for (i=0;inode_addr[i] = (eeprom[i/2] >> (8*(i&1))) & 0xff; + } + printf ("Ethernet addr: %!\n", nic->node_addr); + +#if defined(W89C840_DEBUG) + printf("winbond-840: EEPROM checksum %hX, got eeprom", sum); +#endif + + /* Reset the chip to erase previous misconfiguration. + No hold time required! */ + writel(0x00000001, ioaddr + PCIBusCfg); + + if (driver_flags & CanHaveMII) { + int phy, phy_idx = 0; + for (phy = 1; phy < 32 && phy_idx < 4; phy++) { + int mii_status = mdio_read(ioaddr, phy, 1); + if (mii_status != 0xffff && mii_status != 0x0000) { + w840private.phys[phy_idx++] = phy; + w840private.advertising = mdio_read(ioaddr, phy, 4); + +#if defined(W89C840_DEBUG) + printf("winbond-840 : MII PHY found at address %d, status " + "%X advertising %hX.\n", phy, mii_status, w840private.advertising); +#endif + + } + } + + w840private.mii_cnt = phy_idx; + + if (phy_idx == 0) { + printf("winbond-840 : MII PHY not found -- this device may not operate correctly.\n"); + } + } + + /* point to NIC specific routines */ + dev->disable = w89c840_disable; + nic->poll = w89c840_poll; + nic->transmit = w89c840_transmit; + nic->irq = w89c840_irq; + + w89c840_reset(nic); + + return 1; +} + +/* Read the EEPROM and MII Management Data I/O (MDIO) interfaces. These are + often serial bit streams generated by the host processor. + The example below is for the common 93c46 EEPROM, 64 16 bit words. */ + +/* Delay between EEPROM clock transitions. + No extra delay is needed with 33Mhz PCI, but future 66Mhz access may need + a delay. Note that pre-2.0.34 kernels had a cache-alignment bug that + made udelay() unreliable. + The old method of using an ISA access as a delay, __SLOW_DOWN_IO__, is + depricated. +*/ +#define eeprom_delay(ee_addr) readl(ee_addr) + +enum EEPROM_Ctrl_Bits { + EE_ShiftClk=0x02, EE_Write0=0x801, EE_Write1=0x805, + EE_ChipSelect=0x801, EE_DataIn=0x08, +}; + +/* The EEPROM commands include the alway-set leading bit. */ +enum EEPROM_Cmds { + EE_WriteCmd=(5 << 6), EE_ReadCmd=(6 << 6), EE_EraseCmd=(7 << 6), +}; + +static int eeprom_read(long addr, int location) +{ + int i; + int retval = 0; + int ee_addr = addr + EECtrl; + int read_cmd = location | EE_ReadCmd; + writel(EE_ChipSelect, ee_addr); + + /* Shift the read command bits out. */ + for (i = 10; i >= 0; i--) { + short dataval = (read_cmd & (1 << i)) ? EE_Write1 : EE_Write0; + writel(dataval, ee_addr); + eeprom_delay(ee_addr); + writel(dataval | EE_ShiftClk, ee_addr); + eeprom_delay(ee_addr); + } + writel(EE_ChipSelect, ee_addr); + + for (i = 16; i > 0; i--) { + writel(EE_ChipSelect | EE_ShiftClk, ee_addr); + eeprom_delay(ee_addr); + retval = (retval << 1) | ((readl(ee_addr) & EE_DataIn) ? 1 : 0); + writel(EE_ChipSelect, ee_addr); + eeprom_delay(ee_addr); + } + + /* Terminate the EEPROM access. */ + writel(0, ee_addr); + return retval; +} + +/* MII transceiver control section. + Read and write the MII registers using software-generated serial + MDIO protocol. See the MII specifications or DP83840A data sheet + for details. + + The maximum data clock rate is 2.5 Mhz. The minimum timing is usually + met by back-to-back 33Mhz PCI cycles. */ +#define mdio_delay(mdio_addr) readl(mdio_addr) + +/* Set iff a MII transceiver on any interface requires mdio preamble. + This only set with older tranceivers, so the extra + code size of a per-interface flag is not worthwhile. */ +static char mii_preamble_required = 1; + +#define MDIO_WRITE0 (MDIO_EnbOutput) +#define MDIO_WRITE1 (MDIO_DataOut | MDIO_EnbOutput) + +/* Generate the preamble required for initial synchronization and + a few older transceivers. */ +static void mdio_sync(long mdio_addr) +{ + int bits = 32; + + /* Establish sync by sending at least 32 logic ones. */ + while (--bits >= 0) { + writel(MDIO_WRITE1, mdio_addr); + mdio_delay(mdio_addr); + writel(MDIO_WRITE1 | MDIO_ShiftClk, mdio_addr); + mdio_delay(mdio_addr); + } +} + +static int mdio_read(int base_address, int phy_id, int location) +{ + long mdio_addr = base_address + MIICtrl; + int mii_cmd = (0xf6 << 10) | (phy_id << 5) | location; + int i, retval = 0; + + if (mii_preamble_required) + mdio_sync(mdio_addr); + + /* Shift the read command bits out. */ + for (i = 15; i >= 0; i--) { + int dataval = (mii_cmd & (1 << i)) ? MDIO_WRITE1 : MDIO_WRITE0; + + writel(dataval, mdio_addr); + mdio_delay(mdio_addr); + writel(dataval | MDIO_ShiftClk, mdio_addr); + mdio_delay(mdio_addr); + } + /* Read the two transition, 16 data, and wire-idle bits. */ + for (i = 20; i > 0; i--) { + writel(MDIO_EnbIn, mdio_addr); + mdio_delay(mdio_addr); + retval = (retval << 1) | ((readl(mdio_addr) & MDIO_DataIn) ? 1 : 0); + writel(MDIO_EnbIn | MDIO_ShiftClk, mdio_addr); + mdio_delay(mdio_addr); + } + return (retval>>1) & 0xffff; +} + +#if 0 +static void mdio_write(int base_address, int phy_id, int location, int value) +{ + long mdio_addr = base_address + MIICtrl; + int mii_cmd = (0x5002 << 16) | (phy_id << 23) | (location<<18) | value; + int i; + + if (location == 4 && phy_id == w840private.phys[0]) + w840private.advertising = value; + + if (mii_preamble_required) + mdio_sync(mdio_addr); + + /* Shift the command bits out. */ + for (i = 31; i >= 0; i--) { + int dataval = (mii_cmd & (1 << i)) ? MDIO_WRITE1 : MDIO_WRITE0; + + writel(dataval, mdio_addr); + mdio_delay(mdio_addr); + writel(dataval | MDIO_ShiftClk, mdio_addr); + mdio_delay(mdio_addr); + } + /* Clear out extra bits. */ + for (i = 2; i > 0; i--) { + writel(MDIO_EnbIn, mdio_addr); + mdio_delay(mdio_addr); + writel(MDIO_EnbIn | MDIO_ShiftClk, mdio_addr); + mdio_delay(mdio_addr); + } + return; +} +#endif + +static void check_duplex(void) +{ + int mii_reg5 = mdio_read(ioaddr, w840private.phys[0], 5); + int negotiated = mii_reg5 & w840private.advertising; + int duplex; + + if (w840private.duplex_lock || mii_reg5 == 0xffff) + return; + + duplex = (negotiated & 0x0100) || (negotiated & 0x01C0) == 0x0040; + if (w840private.full_duplex != duplex) { + w840private.full_duplex = duplex; + +#if defined(W89C840_DEBUG) + printf("winbond-840 : Setting %s-duplex based on MII # %d negotiated capability %X\n", + duplex ? "full" : "half", w840private.phys[0], negotiated); +#endif + + w840private.csr6 &= ~0x200; + w840private.csr6 |= duplex ? 0x200 : 0; + } +} + +static void set_rx_mode(void) +{ + u32 mc_filter[2]; /* Multicast hash filter */ + u32 rx_mode; + + /* Accept all multicasts from now on. */ + memset(mc_filter, 0xff, sizeof(mc_filter)); + +/* + * works OK with multicast enabled. + */ + + rx_mode = AcceptBroadcast | AcceptMyPhys | AcceptMulticast; + + writel(mc_filter[0], ioaddr + MulticastFilter0); + writel(mc_filter[1], ioaddr + MulticastFilter1); + w840private.csr6 &= ~0x00F8; + w840private.csr6 |= rx_mode; + writel(w840private.csr6, ioaddr + NetworkConfig); + +#if defined(W89C840_DEBUG) + printf("winbond-840 : Done setting RX mode.\n"); +#endif +} + +/* Initialize the Rx and Tx rings, along with various 'dev' bits. */ +static void init_ring(void) +{ + int i; + char * p; + + w840private.tx_full = 0; + w840private.tx_q_bytes = w840private.cur_rx = w840private.cur_tx = 0; + w840private.dirty_rx = w840private.dirty_tx = 0; + + w840private.rx_buf_sz = PKT_BUF_SZ; + w840private.rx_head_desc = &w840private.rx_ring[0]; + + /* Initial all Rx descriptors. Fill in the Rx buffers. */ + + p = &rx_packet[0]; + + for (i = 0; i < RX_RING_SIZE; i++) { + w840private.rx_ring[i].length = w840private.rx_buf_sz; + w840private.rx_ring[i].status = 0; + w840private.rx_ring[i].next_desc = virt_to_le32desc(&w840private.rx_ring[i+1]); + + w840private.rx_ring[i].buffer1 = virt_to_le32desc(p + (PKT_BUF_SZ * i)); + w840private.rx_ring[i].status = DescOwn | DescIntr; + } + + /* Mark the last entry as wrapping the ring. */ + w840private.rx_ring[i-1].length |= DescEndRing; + w840private.rx_ring[i-1].next_desc = virt_to_le32desc(&w840private.rx_ring[0]); + + w840private.dirty_rx = (unsigned int)(i - RX_RING_SIZE); + + for (i = 0; i < TX_RING_SIZE; i++) { + w840private.tx_ring[i].status = 0; + } + return; +} + + +static struct pci_id w89c840_nics[] = { +PCI_ROM(0x1050, 0x0840, "winbond840", "Winbond W89C840F"), +PCI_ROM(0x11f6, 0x2011, "compexrl100atx", "Compex RL100ATX"), +}; + +struct pci_driver w89c840_driver = { + .type = NIC_DRIVER, + .name = "W89C840F", + .probe = w89c840_probe, + .ids = w89c840_nics, + .id_count = sizeof(w89c840_nics)/sizeof(w89c840_nics[0]), + .class = 0, +}; diff --git a/usr/src/grub/grub-0.97/stage1/Makefile.am b/usr/src/grub/grub-0.97/stage1/Makefile.am new file mode 100644 index 0000000000..0afc285279 --- /dev/null +++ b/usr/src/grub/grub-0.97/stage1/Makefile.am @@ -0,0 +1,15 @@ +pkglibdir = $(libdir)/$(PACKAGE)/$(host_cpu)-$(host_vendor) +nodist_pkglib_DATA = stage1 + +CLEANFILES = $(nodist_pkglib_DATA) + +# We can't use builtins or standard includes. +AM_CCASFLAGS = $(STAGE1_CFLAGS) -fno-builtin -nostdinc +LDFLAGS = -nostdlib -Wl,-N,-Ttext,7C00 + +noinst_PROGRAMS = stage1.exec +stage1_exec_SOURCES = stage1.S stage1.h + +SUFFIXES = .exec +.exec: + $(OBJCOPY) -O binary $< $@ diff --git a/usr/src/grub/grub-0.97/stage1/Makefile.in b/usr/src/grub/grub-0.97/stage1/Makefile.in new file mode 100644 index 0000000000..7134bdf31a --- /dev/null +++ b/usr/src/grub/grub-0.97/stage1/Makefile.in @@ -0,0 +1,433 @@ +# Makefile.in generated by automake 1.9.4 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +SOURCES = $(stage1_exec_SOURCES) + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +noinst_PROGRAMS = stage1.exec$(EXEEXT) +subdir = stage1 +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +PROGRAMS = $(noinst_PROGRAMS) +am_stage1_exec_OBJECTS = stage1.$(OBJEXT) +stage1_exec_OBJECTS = $(am_stage1_exec_OBJECTS) +stage1_exec_LDADD = $(LDADD) +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +CCASCOMPILE = $(CCAS) $(AM_CCASFLAGS) $(CCASFLAGS) +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(stage1_exec_SOURCES) +DIST_SOURCES = $(stage1_exec_SOURCES) +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +am__installdirs = "$(DESTDIR)$(pkglibdir)" +nodist_pkglibDATA_INSTALL = $(INSTALL_DATA) +DATA = $(nodist_pkglib_DATA) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +pkglibdir = $(libdir)/$(PACKAGE)/$(host_cpu)-$(host_vendor) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BUILD_EXAMPLE_KERNEL_FALSE = @BUILD_EXAMPLE_KERNEL_FALSE@ +BUILD_EXAMPLE_KERNEL_TRUE = @BUILD_EXAMPLE_KERNEL_TRUE@ +CC = @CC@ +CCAS = @CCAS@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DISKLESS_SUPPORT_FALSE = @DISKLESS_SUPPORT_FALSE@ +DISKLESS_SUPPORT_TRUE = @DISKLESS_SUPPORT_TRUE@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FSYS_CFLAGS = @FSYS_CFLAGS@ +GRUB_CFLAGS = @GRUB_CFLAGS@ +GRUB_LIBS = @GRUB_LIBS@ +HERCULES_SUPPORT_FALSE = @HERCULES_SUPPORT_FALSE@ +HERCULES_SUPPORT_TRUE = @HERCULES_SUPPORT_TRUE@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = -nostdlib -Wl,-N,-Ttext,7C00 +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +NETBOOT_DRIVERS = @NETBOOT_DRIVERS@ +NETBOOT_SUPPORT_FALSE = @NETBOOT_SUPPORT_FALSE@ +NETBOOT_SUPPORT_TRUE = @NETBOOT_SUPPORT_TRUE@ +NET_CFLAGS = @NET_CFLAGS@ +NET_EXTRAFLAGS = @NET_EXTRAFLAGS@ +OBJCOPY = @OBJCOPY@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PERL = @PERL@ +RANLIB = @RANLIB@ +SERIAL_SPEED_SIMULATION_FALSE = @SERIAL_SPEED_SIMULATION_FALSE@ +SERIAL_SPEED_SIMULATION_TRUE = @SERIAL_SPEED_SIMULATION_TRUE@ +SERIAL_SUPPORT_FALSE = @SERIAL_SUPPORT_FALSE@ +SERIAL_SUPPORT_TRUE = @SERIAL_SUPPORT_TRUE@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STAGE1_CFLAGS = @STAGE1_CFLAGS@ +STAGE2_CFLAGS = @STAGE2_CFLAGS@ +STRIP = @STRIP@ +VERSION = @VERSION@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_OBJCOPY = @ac_ct_OBJCOPY@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +nodist_pkglib_DATA = stage1 +CLEANFILES = $(nodist_pkglib_DATA) + +# We can't use builtins or standard includes. +AM_CCASFLAGS = $(STAGE1_CFLAGS) -fno-builtin -nostdinc +stage1_exec_SOURCES = stage1.S stage1.h +SUFFIXES = .exec +all: all-am + +.SUFFIXES: +.SUFFIXES: .exec .S .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu stage1/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu stage1/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +clean-noinstPROGRAMS: + -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) +stage1.exec$(EXEEXT): $(stage1_exec_OBJECTS) $(stage1_exec_DEPENDENCIES) + @rm -f stage1.exec$(EXEEXT) + $(LINK) $(stage1_exec_LDFLAGS) $(stage1_exec_OBJECTS) $(stage1_exec_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +.S.o: + $(CCASCOMPILE) -c $< + +.S.obj: + $(CCASCOMPILE) -c `$(CYGPATH_W) '$<'` +uninstall-info-am: +install-nodist_pkglibDATA: $(nodist_pkglib_DATA) + @$(NORMAL_INSTALL) + test -z "$(pkglibdir)" || $(mkdir_p) "$(DESTDIR)$(pkglibdir)" + @list='$(nodist_pkglib_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(nodist_pkglibDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(pkglibdir)/$$f'"; \ + $(nodist_pkglibDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(pkglibdir)/$$f"; \ + done + +uninstall-nodist_pkglibDATA: + @$(NORMAL_UNINSTALL) + @list='$(nodist_pkglib_DATA)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(pkglibdir)/$$f'"; \ + rm -f "$(DESTDIR)$(pkglibdir)/$$f"; \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) $(DATA) +installdirs: + for dir in "$(DESTDIR)$(pkglibdir)"; do \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-noinstPROGRAMS mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: install-nodist_pkglibDATA + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am uninstall-nodist_pkglibDATA + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-noinstPROGRAMS ctags distclean distclean-compile \ + distclean-generic distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-man install-nodist_pkglibDATA \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-info-am \ + uninstall-nodist_pkglibDATA + +.exec: + $(OBJCOPY) -O binary $< $@ +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/usr/src/grub/grub-0.97/stage1/Makefile.solaris b/usr/src/grub/grub-0.97/stage1/Makefile.solaris new file mode 100644 index 0000000000..d5d34b9d1f --- /dev/null +++ b/usr/src/grub/grub-0.97/stage1/Makefile.solaris @@ -0,0 +1,74 @@ +# +# Copyright 2005 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# ident "%Z%%M% %I% %E% SMI" +# +include ../../Makefile.grub +include ../Makefile.solaris.defs + +.SUFFIXES: +.SUFFIXES: .exec $(SUFFIXES) + +.exec: + $(OBJCOPY) -O binary $< $@ + + +INCLUDES = -I. -I.. +CCASFLAGS += -O2 -fno-builtin -nostdinc +LDFLAGS += -nostdlib -N -Ttext 7C00 +LIBS = + + +DATA = $(STAGE1_DATA) +PROGRAMS = $(STAGE1_EXEC) + +STAGE1_DATA = stage1 +STAGE1_EXEC = stage1.exec +STAGE1_ASMOBJS = stage1.o +STAGE1_OBJS = + +INSTALL_TARGETS = $(DATA:%=$(ROOT_BOOT_GRUB)/%) + +# +# Source files to be installed in $(SRC_DIR). +# +SRC_DIR = $(ROOT_SRC)/stage1 +SRC_FILES = Makefile.am Makefile.in stage1.S stage1.h + +INSTALL_TARGETS += $(SRC_FILES:%=$(SRC_DIR)/%) + + +all: $(PROGRAMS) $(DATA) + + +$(STAGE1_EXEC): $(STAGE1_ASMOBJS) $(STAGE1_OBJS) + $(RM) $@ + $(LINK) -o $@ $(STAGE1_ASMOBJS) $(STAGE1_OBJS) $(LIBS) + +$(STAGE1_ASMOBJS): $$(@:.o=.S) + $(CCAS) $(CCASFLAGS) -c -o $@ $(@:.o=.S) + +$(STAGE1_OBJS): $$(@:.o=.c) + $(CC) $(CFLAGS) -c -o $@ $(@:.o=.c) + + +install: all $(INSTALL_TARGETS) + +$(ROOT_BOOT_GRUB)/%: $(ROOT_BOOT_GRUB) % + $(INS.file) + +$(SRC_DIR)/%: $(SRC_DIR) % + $(INS.file) + +$(ROOT_BOOT_GRUB) $(SRC_DIR): + $(INS.dir) + + +clean: _FORCE + $(RM) *.o $(PROGRAMS) + +clobber: clean + $(RM) $(DATA) + +_FORCE: diff --git a/usr/src/grub/grub-0.97/stage1/stage1.S b/usr/src/grub/grub-0.97/stage1/stage1.S new file mode 100644 index 0000000000..7eb38984ed --- /dev/null +++ b/usr/src/grub/grub-0.97/stage1/stage1.S @@ -0,0 +1,499 @@ +/* -*-Asm-*- */ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2004 Free Software Foundation, 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 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 + +/* + * defines for the code go here + */ + + /* Absolute addresses + This makes the assembler generate the address without support + from the linker. (ELF can't relocate 16-bit addresses!) */ +#define ABS(x) (x-_start+0x7c00) + + /* Print message string */ +#define MSG(x) movw $ABS(x), %si; call message + + /* XXX: binutils-2.9.1.0.x doesn't produce a short opcode for this. */ +#define MOV_MEM_TO_AL(x) .byte 0xa0; .word x + + .file "stage1.S" + + .text + + /* Tell GAS to generate 16-bit instructions so that this code works + in real mode. */ + .code16 + +.globl _start; _start: + /* + * _start is loaded at 0x7c00 and is jumped to with CS:IP 0:0x7c00 + */ + + /* + * Beginning of the sector is compatible with the FAT/HPFS BIOS + * parameter block. + */ + + jmp after_BPB + nop /* do I care about this ??? */ + + /* + * This space is for the BIOS parameter block!!!! Don't change + * the first jump, nor start the code anywhere but right after + * this area. + */ + + . = _start + 4 + + /* scratch space */ +mode: + .byte 0 +disk_address_packet: +sectors: + .long 0 +heads: + .long 0 +cylinders: + .word 0 +sector_start: + .byte 0 +head_start: + .byte 0 +cylinder_start: + .word 0 + /* more space... */ + + . = _start + STAGE1_BPBEND + + /* + * End of BIOS parameter block. + */ + +stage1_version: + .byte COMPAT_VERSION_MAJOR, COMPAT_VERSION_MINOR +boot_drive: + .byte GRUB_INVALID_DRIVE /* the disk to load stage2 from */ +force_lba: + .byte 0 +stage2_address: + .word 0x8000 +stage2_sector: + .long 1 +stage2_segment: + .word 0x800 + +after_BPB: + +/* general setup */ + cli /* we're not safe here! */ + + /* + * This is a workaround for buggy BIOSes which don't pass boot + * drive correctly. If GRUB is installed into a HDD, check if + * DL is masked correctly. If not, assume that the BIOS passed + * a bogus value and set DL to 0x80, since this is the only + * possible boot drive. If GRUB is installed into a floppy, + * this does nothing (only jump). + */ +boot_drive_check: + jmp 1f + testb $0x80, %dl + jnz 1f + movb $0x80, %dl +1: + + /* + * ljmp to the next instruction because some bogus BIOSes + * jump to 07C0:0000 instead of 0000:7C00. + */ + ljmp $0, $ABS(real_start) + +real_start: + + /* set up %ds and %ss as offset from 0 */ + xorw %ax, %ax + movw %ax, %ds + movw %ax, %ss + + /* set up the REAL stack */ + movw $STAGE1_STACKSEG, %sp + + sti /* we're safe again */ + + /* + * Check if we have a forced disk reference here + */ + MOV_MEM_TO_AL(ABS(boot_drive)) /* movb ABS(boot_drive), %al */ + cmpb $GRUB_INVALID_DRIVE, %al + je 1f + movb %al, %dl +1: + /* save drive reference first thing! */ + pushw %dx + + /* print a notification message on the screen */ + MSG(notification_string) + + /* do not probe LBA if the drive is a floppy */ + testb $STAGE1_BIOS_HD_FLAG, %dl + jz chs_mode + + /* check if LBA is supported */ + movb $0x41, %ah + movw $0x55aa, %bx + int $0x13 + + /* + * %dl may have been clobbered by INT 13, AH=41H. + * This happens, for example, with AST BIOS 1.04. + */ + popw %dx + pushw %dx + + /* use CHS if fails */ + jc chs_mode + cmpw $0xaa55, %bx + jne chs_mode + + /* check if AH=0x42 is supported if FORCE_LBA is zero */ + MOV_MEM_TO_AL(ABS(force_lba)) /* movb ABS(force_lba), %al */ + testb %al, %al + jnz lba_mode + andw $1, %cx + jz chs_mode + +lba_mode: + /* save the total number of sectors */ + movl 0x10(%si), %ecx + + /* set %si to the disk address packet */ + movw $ABS(disk_address_packet), %si + + /* set the mode to non-zero */ + movb $1, -1(%si) + + movl ABS(stage2_sector), %ebx + + /* the size and the reserved byte */ + movw $0x0010, (%si) + + /* the blocks */ + movw $1, 2(%si) + + /* the absolute address (low 32 bits) */ + movl %ebx, 8(%si) + + /* the segment of buffer address */ + movw $STAGE1_BUFFERSEG, 6(%si) + + xorl %eax, %eax + movw %ax, 4(%si) + movl %eax, 12(%si) + +/* + * BIOS call "INT 0x13 Function 0x42" to read sectors from disk into memory + * Call with %ah = 0x42 + * %dl = drive number + * %ds:%si = segment:offset of disk address packet + * Return: + * %al = 0x0 on success; err code on failure + */ + + movb $0x42, %ah + int $0x13 + + /* LBA read is not supported, so fallback to CHS. */ + jc chs_mode + + movw $STAGE1_BUFFERSEG, %bx + jmp copy_buffer + +chs_mode: + /* + * Determine the hard disk geometry from the BIOS! + * We do this first, so that LS-120 IDE floppies work correctly. + */ + movb $8, %ah + int $0x13 + jnc final_init + + /* + * The call failed, so maybe use the floppy probe instead. + */ + testb $STAGE1_BIOS_HD_FLAG, %dl + jz floppy_probe + + /* Nope, we definitely have a hard disk, and we're screwed. */ + jmp hd_probe_error + +final_init: + + movw $ABS(sectors), %si + + /* set the mode to zero */ + movb $0, -1(%si) + + /* save number of heads */ + xorl %eax, %eax + movb %dh, %al + incw %ax + movl %eax, 4(%si) + + xorw %dx, %dx + movb %cl, %dl + shlw $2, %dx + movb %ch, %al + movb %dh, %ah + + /* save number of cylinders */ + incw %ax + movw %ax, 8(%si) + + xorw %ax, %ax + movb %dl, %al + shrb $2, %al + + /* save number of sectors */ + movl %eax, (%si) + +setup_sectors: + /* load logical sector start (bottom half) */ + movl ABS(stage2_sector), %eax + + /* zero %edx */ + xorl %edx, %edx + + /* divide by number of sectors */ + divl (%si) + + /* save sector start */ + movb %dl, 10(%si) + + xorl %edx, %edx /* zero %edx */ + divl 4(%si) /* divide by number of heads */ + + /* save head start */ + movb %dl, 11(%si) + + /* save cylinder start */ + movw %ax, 12(%si) + + /* do we need too many cylinders? */ + cmpw 8(%si), %ax + jge geometry_error + +/* + * This is the loop for taking care of BIOS geometry translation (ugh!) + */ + + /* get high bits of cylinder */ + movb 13(%si), %dl + + shlb $6, %dl /* shift left by 6 bits */ + movb 10(%si), %cl /* get sector */ + + incb %cl /* normalize sector (sectors go + from 1-N, not 0-(N-1) ) */ + orb %dl, %cl /* composite together */ + movb 12(%si), %ch /* sector+hcyl in cl, cylinder in ch */ + + /* restore %dx */ + popw %dx + + /* head number */ + movb 11(%si), %dh + +/* + * BIOS call "INT 0x13 Function 0x2" to read sectors from disk into memory + * Call with %ah = 0x2 + * %al = number of sectors + * %ch = cylinder + * %cl = sector (bits 6-7 are high bits of "cylinder") + * %dh = head + * %dl = drive (0x80 for hard disk, 0x0 for floppy disk) + * %es:%bx = segment:offset of buffer + * Return: + * %al = 0x0 on success; err code on failure + */ + + movw $STAGE1_BUFFERSEG, %bx + movw %bx, %es /* load %es segment with disk buffer */ + + xorw %bx, %bx /* %bx = 0, put it at 0 in the segment */ + movw $0x0201, %ax /* function 2 */ + int $0x13 + + jc read_error + + movw %es, %bx + +copy_buffer: + movw ABS(stage2_segment), %es + + /* + * We need to save %cx and %si because the startup code in + * stage2 uses them without initializing them. + */ + pusha + pushw %ds + + movw $0x100, %cx + movw %bx, %ds + xorw %si, %si + xorw %di, %di + + cld + + rep + movsw + + popw %ds + popa + + /* boot stage2 */ + jmp *(stage2_address) + +/* END OF MAIN LOOP */ + +/* + * BIOS Geometry translation error (past the end of the disk geometry!). + */ +geometry_error: + MSG(geometry_error_string) + jmp general_error + +/* + * Disk probe failure. + */ +hd_probe_error: + MSG(hd_probe_error_string) + jmp general_error + +/* + * Read error on the disk. + */ +read_error: + MSG(read_error_string) + +general_error: + MSG(general_error_string) + +/* go here when you need to stop the machine hard after an error condition */ +stop: jmp stop + +notification_string: .string "GRUB " +geometry_error_string: .string "Geom" +hd_probe_error_string: .string "Hard Disk" +read_error_string: .string "Read" +general_error_string: .string " Error" + +/* + * message: write the string pointed to by %si + * + * WARNING: trashes %si, %ax, and %bx + */ + + /* + * Use BIOS "int 10H Function 0Eh" to write character in teletype mode + * %ah = 0xe %al = character + * %bh = page %bl = foreground color (graphics modes) + */ +1: + movw $0x0001, %bx + movb $0xe, %ah + int $0x10 /* display a byte */ +message: + lodsb + cmpb $0, %al + jne 1b /* if not end of string, jmp to display */ + ret + + /* + * Windows NT breaks compatibility by embedding a magic + * number here. + */ + + . = _start + STAGE1_WINDOWS_NT_MAGIC +nt_magic: + .long 0 + .word 0 + + /* + * This is where an MBR would go if on a hard disk. The code + * here isn't even referenced unless we're on a floppy. Kinda + * sneaky, huh? + */ + +part_start: + . = _start + STAGE1_PARTSTART + +probe_values: + .byte 36, 18, 15, 9, 0 + +floppy_probe: +/* + * Perform floppy probe. + */ + + movw $ABS(probe_values-1), %si + +probe_loop: + /* reset floppy controller INT 13h AH=0 */ + xorw %ax, %ax + int $0x13 + + incw %si + movb (%si), %cl + + /* if number of sectors is 0, display error and die */ + cmpb $0, %cl + jne 1f + +/* + * Floppy disk probe failure. + */ + MSG(fd_probe_error_string) + jmp general_error + +fd_probe_error_string: .string "Floppy" + +1: + /* perform read */ + movw $STAGE1_BUFFERSEG, %bx + movw $0x201, %ax + movb $0, %ch + movb $0, %dh + int $0x13 + + /* if error, jump to "probe_loop" */ + jc probe_loop + + /* %cl is already the correct value! */ + movb $1, %dh + movb $79, %ch + + jmp final_init + + . = _start + STAGE1_PARTEND + +/* the last 2 bytes in the sector 0 contain the signature */ + .word STAGE1_SIGNATURE diff --git a/usr/src/grub/grub-0.97/stage1/stage1.h b/usr/src/grub/grub-0.97/stage1/stage1.h new file mode 100644 index 0000000000..d232ade113 --- /dev/null +++ b/usr/src/grub/grub-0.97/stage1/stage1.h @@ -0,0 +1,86 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2002,2004 Free Software Foundation, 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 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 STAGE1_HEADER +#define STAGE1_HEADER 1 + + +/* Define the version numbers here, so that Stage 1 can know them. */ +#define COMPAT_VERSION_MAJOR 3 +#define COMPAT_VERSION_MINOR 2 +#define COMPAT_VERSION ((COMPAT_VERSION_MINOR << 8) \ + | COMPAT_VERSION_MAJOR) + +/* The signature for bootloader. */ +#define STAGE1_SIGNATURE 0xaa55 + +/* The offset of the end of BPB (BIOS Parameter Block). */ +#define STAGE1_BPBEND 0x3e + +/* The offset of the major version. */ +#define STAGE1_VER_MAJ_OFFS 0x3e + +/* The offset of BOOT_DRIVE. */ +#define STAGE1_BOOT_DRIVE 0x40 + +/* The offset of FORCE_LBA. */ +#define STAGE1_FORCE_LBA 0x41 + +/* The offset of STAGE2_ADDRESS. */ +#define STAGE1_STAGE2_ADDRESS 0x42 + +/* The offset of STAGE2_SECTOR. */ +#define STAGE1_STAGE2_SECTOR 0x44 + +/* The offset of STAGE2_SEGMENT. */ +#define STAGE1_STAGE2_SEGMENT 0x48 + +/* The offset of BOOT_DRIVE_CHECK. */ +#define STAGE1_BOOT_DRIVE_CHECK 0x4b + +/* The offset of a magic number used by Windows NT. */ +#define STAGE1_WINDOWS_NT_MAGIC 0x1b8 + +/* The offset of the start of the partition table. */ +#define STAGE1_PARTSTART 0x1be + +/* The offset of the end of the partition table. */ +#define STAGE1_PARTEND 0x1fe + +/* The stack segment. */ +#define STAGE1_STACKSEG 0x2000 + +/* The segment of disk buffer. The disk buffer MUST be 32K long and + cannot straddle a 64K boundary. */ +#define STAGE1_BUFFERSEG 0x7000 + +/* The address of drive parameters. */ +#define STAGE1_DRP_ADDR 0x7f00 + +/* The size of drive parameters. */ +#define STAGE1_DRP_SIZE 0x42 + +/* The flag for BIOS drive number to designate a hard disk vs. a + floppy. */ +#define STAGE1_BIOS_HD_FLAG 0x80 + +/* The drive number of an invalid drive. */ +#define GRUB_INVALID_DRIVE 0xFF + +#endif /* ! STAGE1_HEADER */ diff --git a/usr/src/grub/grub-0.97/stage2/Makefile.am b/usr/src/grub/grub-0.97/stage2/Makefile.am new file mode 100644 index 0000000000..44144e7353 --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/Makefile.am @@ -0,0 +1,303 @@ +# For test target. +TESTS = size_test +noinst_SCRIPTS = $(TESTS) + +# For dist target. +noinst_HEADERS = apic.h defs.h dir.h disk_inode.h disk_inode_ffs.h \ + fat.h filesys.h freebsd.h fs.h hercules.h i386-elf.h \ + imgact_aout.h iso9660.h jfs.h mb_header.h mb_info.h md5.h \ + nbi.h pc_slice.h serial.h shared.h smp-imps.h term.h \ + terminfo.h tparm.h nbi.h ufs.h ufs2.h vstafs.h xfs.h graphics.h \ + fsys_zfs.h +EXTRA_DIST = setjmp.S apm.S $(noinst_SCRIPTS) + +# For . +INCLUDES = -I$(top_srcdir)/stage1 + +# The library for /sbin/grub. +noinst_LIBRARIES = libgrub.a +libgrub_a_SOURCES = boot.c builtins.c char_io.c cmdline.c common.c \ + disk_io.c fsys_ext2fs.c fsys_fat.c fsys_ffs.c fsys_iso9660.c \ + fsys_jfs.c fsys_minix.c fsys_reiserfs.c fsys_ufs.c fsys_ufs2.c \ + fsys_zfs.c zfs_fletcher.c zfs_lzjb.c zfs_sha256.c \ + fsys_vstafs.c fsys_xfs.c gunzip.c md5.c serial.c stage2.c \ + terminfo.c tparm.c graphics.c +libgrub_a_CFLAGS = $(GRUB_CFLAGS) -I$(top_srcdir)/lib \ + -DGRUB_UTIL=1 -DFSYS_EXT2FS=1 -DFSYS_FAT=1 -DFSYS_FFS=1 \ + -DFSYS_ISO9660=1 -DFSYS_JFS=1 -DFSYS_MINIX=1 -DFSYS_REISERFS=1 \ + -DFSYS_UFS=1 -DFSYS_UFS2=1 -DFSYS_ZFS=1 -DFSYS_VSTAFS=1 -DFSYS_XFS=1 \ + -DUSE_MD5_PASSWORDS=1 -DSUPPORT_SERIAL=1 -DSUPPORT_HERCULES=1 \ + +# Stage 2 and Stage 1.5's. +pkglibdir = $(libdir)/$(PACKAGE)/$(host_cpu)-$(host_vendor) + +EXTRA_PROGRAMS = nbloader.exec pxeloader.exec diskless.exec + +if DISKLESS_SUPPORT +pkglib_DATA = stage2 stage2_eltorito e2fs_stage1_5 fat_stage1_5 \ + ffs_stage1_5 iso9660_stage1_5 jfs_stage1_5 minix_stage1_5 \ + reiserfs_stage1_5 ufs_stage1_5 ufs2_stage1_5 zfs_stage1_5 vstafs_stage1_5 \ + xfs_stage1_5 nbgrub pxegrub +noinst_DATA = pre_stage2 start start_eltorito nbloader pxeloader diskless +noinst_PROGRAMS = pre_stage2.exec start.exec start_eltorito.exec \ + e2fs_stage1_5.exec fat_stage1_5.exec ffs_stage1_5.exec \ + iso9660_stage1_5.exec jfs_stage1_5.exec minix_stage1_5.exec \ + reiserfs_stage1_5.exec ufs_stage1_5.exec ufs2_stage1_5.exec \ + zfs_stage1_5.exec \ + vstafs_stage1_5.exec xfs_stage1_5.exec \ + nbloader.exec pxeloader.exec diskless.exec +else +pkglib_DATA = stage2 stage2_eltorito e2fs_stage1_5 fat_stage1_5 \ + ffs_stage1_5 iso9660_stage1_5 jfs_stage1_5 minix_stage1_5 \ + reiserfs_stage1_5 ufs_stage1_5 ufs2_stage1_5 zfs_stage1_5 vstafs_stage1_5 \ + xfs_stage1_5 +noinst_DATA = pre_stage2 start start_eltorito +noinst_PROGRAMS = pre_stage2.exec start.exec start_eltorito.exec \ + e2fs_stage1_5.exec fat_stage1_5.exec ffs_stage1_5.exec \ + iso9660_stage1_5.exec jfs_stage1_5.exec minix_stage1_5.exec \ + reiserfs_stage1_5.exec ufs_stage1_5.exec ufs2_stage1_5.exec \ + zfs_stage1_5.exec vstafs_stage1_5.exec xfs_stage1_5.exec +endif +MOSTLYCLEANFILES = $(noinst_PROGRAMS) + +PRE_STAGE2_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,8200 +START_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,8000 +NBLOADER_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,0 +PXELOADER_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,7C00 +START_ELTORITO_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,7C00 + +if NETBOOT_SUPPORT +NETBOOT_FLAGS = -I$(top_srcdir)/netboot -DSUPPORT_NETBOOT=1 +else +NETBOOT_FLAGS = +endif + +if SERIAL_SUPPORT +SERIAL_FLAGS = -DSUPPORT_SERIAL=1 +else +SERIAL_FLAGS = +endif + +if HERCULES_SUPPORT +HERCULES_FLAGS = -DSUPPORT_HERCULES=1 +else +HERCULES_FLAGS = +endif + +if GRAPHICS_SUPPORT +GRAPHICS_FLAGS = -DSUPPORT_GRAPHICS=1 +else +GRAPHICS_FLAGS = +endif + +STAGE2_COMPILE = $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ + $(NETBOOT_FLAGS) $(SERIAL_FLAGS) $(HERCULES_FLAGS) $(GRAPHICS_FLAGS) + +STAGE1_5_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,2000 +STAGE1_5_COMPILE = $(STAGE2_COMPILE) -DNO_DECOMPRESSION=1 -DSTAGE1_5=1 + +# For stage2 target. +pre_stage2_exec_SOURCES = asm.S bios.c boot.c builtins.c char_io.c \ + cmdline.c common.c console.c disk_io.c fsys_ext2fs.c \ + fsys_fat.c fsys_ffs.c fsys_iso9660.c fsys_jfs.c fsys_minix.c \ + fsys_reiserfs.c fsys_ufs.c fsys_ufs2.c fsys_vstafs.c fsys_xfs.c \ + fsys_zfs.c zfs_fletcher.c zfs_lzjb.c zfs_sha256.c \ + gunzip.c hercules.c md5.c serial.c smp-imps.c stage2.c terminfo.c \ + tparm.c graphics.c +pre_stage2_exec_CFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS) +pre_stage2_exec_CCASFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS) +pre_stage2_exec_LDFLAGS = $(PRE_STAGE2_LINK) + +if NETBOOT_SUPPORT +pre_stage2_exec_LDADD = ../netboot/libdrivers.a +endif + +if DISKLESS_SUPPORT +BUILT_SOURCES = stage2_size.h diskless_size.h +else +BUILT_SOURCES = stage2_size.h +endif + +CLEANFILES = $(pkglib_DATA) $(noinst_DATA) $(BUILT_SOURCES) + +stage2_size.h: pre_stage2 + -rm -f stage2_size.h + set dummy `ls -l pre_stage2`; \ + echo "#define STAGE2_SIZE $$6" > stage2_size.h + +start_exec_SOURCES = start.S +start_exec_CCASFLAGS = $(STAGE2_COMPILE) +start_exec_LDFLAGS = $(START_LINK) + +# XXX: automake doesn't provide a way to specify dependencies for object +# files explicitly, so we must write this by a general Makefile scheme. +# If automake change the naming scheme for per-executable objects, this +# will be broken. +start_exec-start.$(OBJEXT): stage2_size.h + +stage2: pre_stage2 start + -rm -f stage2 + cat start pre_stage2 > stage2 + +start_eltorito_exec_SOURCES = start_eltorito.S +start_eltorito_exec_CCASFLAGS = $(STAGE2_COMPILE) +start_eltorito_exec_LDFLAGS = $(START_ELTORITO_LINK) + +start_eltorito_exec-start.$(OBJEXT): stage2_size.h + +stage2_eltorito: pre_stage2 start_eltorito + -rm -f stage2_eltorito + cat start_eltorito pre_stage2 > stage2_eltorito + +# For e2fs_stage1_5 target. +e2fs_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c disk_io.c \ + stage1_5.c fsys_ext2fs.c bios.c +e2fs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_EXT2FS=1 \ + -DNO_BLOCK_FILES=1 +e2fs_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_EXT2FS=1 \ + -DNO_BLOCK_FILES=1 +e2fs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) + +# For fat_stage1_5 target. +fat_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c disk_io.c \ + stage1_5.c fsys_fat.c bios.c +fat_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_FAT=1 \ + -DNO_BLOCK_FILES=1 +fat_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_FAT=1 \ + -DNO_BLOCK_FILES=1 +fat_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) + +# For ffs_stage1_5 target. +ffs_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c disk_io.c \ + stage1_5.c fsys_ffs.c bios.c +ffs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_FFS=1 \ + -DNO_BLOCK_FILES=1 +ffs_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_FFS=1 \ + -DNO_BLOCK_FILES=1 +ffs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) + +# For ufs_stage1_5 target. +ufs_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c disk_io.c \ + stage1_5.c fsys_ufs.c bios.c +ufs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_UFS=1 \ + -DNO_BLOCK_FILES=1 +ufs_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_UFS=1 \ + -DNO_BLOCK_FILES=1 +ufs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) + +# For ufs2_stage1_5 target. +ufs2_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c disk_io.c \ + stage1_5.c fsys_ufs2.c bios.c +ufs2_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_UFS2=1 \ + -DNO_BLOCK_FILES=1 +ufs2_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_UFS2=1 \ + -DNO_BLOCK_FILES=1 +ufs2_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) + +# For zfs_stage1_5 target. +zfs_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c disk_io.c \ + stage1_5.c fsys_zfs.c zfs_fletcher.c zfs_lzjb.c zfs_sha256.c bios.c +zfs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_ZFS=1 \ + -DNO_BLOCK_FILES=1 +zfs_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_ZFS=1 \ + -DNO_BLOCK_FILES=1 +zfs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) + +# For minix_stage1_5 target. +minix_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c disk_io.c \ + stage1_5.c fsys_minix.c bios.c +minix_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_MINIX=1 \ + -DNO_BLOCK_FILES=1 +minix_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_MINIX=1 \ + -DNO_BLOCK_FILES=1 +minix_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) + +# For reiserfs_stage1_5 target. +reiserfs_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c \ + disk_io.c stage1_5.c fsys_reiserfs.c bios.c +reiserfs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_REISERFS=1 \ + -DNO_BLOCK_FILES=1 +reiserfs_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_REISERFS=1 \ + -DNO_BLOCK_FILES=1 +reiserfs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) + +# For vstafs_stage1_5 target. +vstafs_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c \ + disk_io.c stage1_5.c fsys_vstafs.c bios.c +vstafs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_VSTAFS=1 \ + -DNO_BLOCK_FILES=1 +vstafs_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_VSTAFS=1 \ + -DNO_BLOCK_FILES=1 +vstafs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) + +# For jfs_stage1_5 target. +jfs_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c \ + disk_io.c stage1_5.c fsys_jfs.c bios.c +jfs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_JFS=1 \ + -DNO_BLOCK_FILES=1 +jfs_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_JFS=1 \ + -DNO_BLOCK_FILES=1 +jfs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) + +# For xfs_stage1_5 target. +xfs_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c \ + disk_io.c stage1_5.c fsys_xfs.c bios.c +xfs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_XFS=1 \ + -DNO_BLOCK_FILES=1 +xfs_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_XFS=1 \ + -DNO_BLOCK_FILES=1 +xfs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) + +# For iso9660_stage1_5 target. +iso9660_stage1_5_exec_SOURCES = start_eltorito.S asm.S common.c char_io.c \ + disk_io.c stage1_5.c fsys_iso9660.c bios.c +iso9660_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_ISO9660=1 \ + -DNO_BLOCK_FILES=1 +iso9660_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_ISO9660=1 \ + -DNO_BLOCK_FILES=1 +iso9660_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) + +# For diskless target. +diskless_exec_SOURCES = $(pre_stage2_exec_SOURCES) +diskless_exec_CFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS) \ + -DSUPPORT_DISKLESS=1 +diskless_exec_CCASFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS) \ + -DSUPPORT_DISKLESS=1 +diskless_exec_LDFLAGS = $(PRE_STAGE2_LINK) +diskless_exec_LDADD = ../netboot/libdrivers.a + +diskless_size.h: diskless + -rm -f $@ + set dummy `ls -l $^`; \ + echo "#define DISKLESS_SIZE $$6" > $@ + +# For nbloader target. +nbloader_exec_SOURCES = nbloader.S +nbloader_exec_CCASFLAGS = $(STAGE2_COMPILE) +nbloader_exec_LDFLAGS = $(NBLOADER_LINK) + +# XXX: See the comment for start_exec-start.o. +nbloader_exec-nbloader.$(OBJEXT): diskless_size.h + +# For nbgrub target. +nbgrub: nbloader diskless + -rm -f $@ + cat $^ > $@ + +# For pxeloader target. +pxeloader_exec_SOURCES = pxeloader.S +pxeloader_exec_CCASFLAGS = $(STAGE2_COMPILE) +pxeloader_exec_LDFLAGS = $(PXELOADER_LINK) + +# XXX: See the comment for start_exec-start.o. +pxeloader_exec-pxeloader.$(OBJEXT): diskless_size.h + +# For pxegrub target. +pxegrub: pxeloader diskless + -rm -f $@ + cat $^ > $@ + +# General rule for making a raw binary. +SUFFIXES = .exec +.exec: + $(OBJCOPY) -O binary $< $@ diff --git a/usr/src/grub/grub-0.97/stage2/Makefile.in b/usr/src/grub/grub-0.97/stage2/Makefile.in new file mode 100644 index 0000000000..0ebf69b4e8 --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/Makefile.in @@ -0,0 +1,3855 @@ +# Makefile.in generated by automake 1.9.4 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + + + + +SOURCES = $(libgrub_a_SOURCES) $(diskless_exec_SOURCES) $(e2fs_stage1_5_exec_SOURCES) $(fat_stage1_5_exec_SOURCES) $(ffs_stage1_5_exec_SOURCES) $(iso9660_stage1_5_exec_SOURCES) $(jfs_stage1_5_exec_SOURCES) $(minix_stage1_5_exec_SOURCES) $(nbloader_exec_SOURCES) $(pre_stage2_exec_SOURCES) $(pxeloader_exec_SOURCES) $(reiserfs_stage1_5_exec_SOURCES) $(start_exec_SOURCES) $(start_eltorito_exec_SOURCES) $(ufs2_stage1_5_exec_SOURCES) $(zfs_stage1_5_exec_SOURCE) $(ufs_stage1_5_exec_SOURCES) $(vstafs_stage1_5_exec_SOURCES) $(xfs_stage1_5_exec_SOURCES) + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +EXTRA_PROGRAMS = nbloader.exec$(EXEEXT) pxeloader.exec$(EXEEXT) \ + diskless.exec$(EXEEXT) +@DISKLESS_SUPPORT_FALSE@noinst_PROGRAMS = pre_stage2.exec$(EXEEXT) \ +@DISKLESS_SUPPORT_FALSE@ start.exec$(EXEEXT) \ +@DISKLESS_SUPPORT_FALSE@ start_eltorito.exec$(EXEEXT) \ +@DISKLESS_SUPPORT_FALSE@ e2fs_stage1_5.exec$(EXEEXT) \ +@DISKLESS_SUPPORT_FALSE@ fat_stage1_5.exec$(EXEEXT) \ +@DISKLESS_SUPPORT_FALSE@ ffs_stage1_5.exec$(EXEEXT) \ +@DISKLESS_SUPPORT_FALSE@ iso9660_stage1_5.exec$(EXEEXT) \ +@DISKLESS_SUPPORT_FALSE@ jfs_stage1_5.exec$(EXEEXT) \ +@DISKLESS_SUPPORT_FALSE@ minix_stage1_5.exec$(EXEEXT) \ +@DISKLESS_SUPPORT_FALSE@ reiserfs_stage1_5.exec$(EXEEXT) \ +@DISKLESS_SUPPORT_FALSE@ ufs_stage1_5.exec$(EXEEXT) \ +@DISKLESS_SUPPORT_FALSE@ ufs2_stage1_5.exec$(EXEEXT) \ +@DISKLESS_SUPPORT_FALSE@ zfs_stage1_5.exec$(EXEEXT) \ +@DISKLESS_SUPPORT_FALSE@ vstafs_stage1_5.exec$(EXEEXT) \ +@DISKLESS_SUPPORT_FALSE@ xfs_stage1_5.exec$(EXEEXT) +@DISKLESS_SUPPORT_TRUE@noinst_PROGRAMS = pre_stage2.exec$(EXEEXT) \ +@DISKLESS_SUPPORT_TRUE@ start.exec$(EXEEXT) \ +@DISKLESS_SUPPORT_TRUE@ start_eltorito.exec$(EXEEXT) \ +@DISKLESS_SUPPORT_TRUE@ e2fs_stage1_5.exec$(EXEEXT) \ +@DISKLESS_SUPPORT_TRUE@ fat_stage1_5.exec$(EXEEXT) \ +@DISKLESS_SUPPORT_TRUE@ ffs_stage1_5.exec$(EXEEXT) \ +@DISKLESS_SUPPORT_TRUE@ iso9660_stage1_5.exec$(EXEEXT) \ +@DISKLESS_SUPPORT_TRUE@ jfs_stage1_5.exec$(EXEEXT) \ +@DISKLESS_SUPPORT_TRUE@ minix_stage1_5.exec$(EXEEXT) \ +@DISKLESS_SUPPORT_TRUE@ reiserfs_stage1_5.exec$(EXEEXT) \ +@DISKLESS_SUPPORT_TRUE@ ufs_stage1_5.exec$(EXEEXT) \ +@DISKLESS_SUPPORT_TRUE@ ufs2_stage1_5.exec$(EXEEXT) \ +@DISKLESS_SUPPORT_TRUE@ zfs_stage1_5.exec$(EXEEXT) \ +@DISKLESS_SUPPORT_TRUE@ vstafs_stage1_5.exec$(EXEEXT) \ +@DISKLESS_SUPPORT_TRUE@ xfs_stage1_5.exec$(EXEEXT) \ +@DISKLESS_SUPPORT_TRUE@ nbloader.exec$(EXEEXT) \ +@DISKLESS_SUPPORT_TRUE@ pxeloader.exec$(EXEEXT) \ +@DISKLESS_SUPPORT_TRUE@ diskless.exec$(EXEEXT) +subdir = stage2 +DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +LIBRARIES = $(noinst_LIBRARIES) +AR = ar +ARFLAGS = cru +libgrub_a_AR = $(AR) $(ARFLAGS) +libgrub_a_LIBADD = +am_libgrub_a_OBJECTS = libgrub_a-boot.$(OBJEXT) \ + libgrub_a-builtins.$(OBJEXT) libgrub_a-char_io.$(OBJEXT) \ + libgrub_a-cmdline.$(OBJEXT) libgrub_a-common.$(OBJEXT) \ + libgrub_a-disk_io.$(OBJEXT) libgrub_a-fsys_ext2fs.$(OBJEXT) \ + libgrub_a-fsys_fat.$(OBJEXT) libgrub_a-fsys_ffs.$(OBJEXT) \ + libgrub_a-fsys_iso9660.$(OBJEXT) libgrub_a-fsys_jfs.$(OBJEXT) \ + libgrub_a-fsys_minix.$(OBJEXT) \ + libgrub_a-fsys_reiserfs.$(OBJEXT) libgrub_a-fsys_ufs.$(OBJEXT) \ + libgrub_a-zfs_sha256.$(OBJEXT) \ + libgrub_a-zfs_lzjb.$(OBJEXT) \ + libgrub_a-zfs_fletcher.$(OBJEXT) \ + libgrub_a-fsys_zfs.$(OBJEXT) \ + libgrub_a-fsys_ufs2.$(OBJEXT) libgrub_a-fsys_vstafs.$(OBJEXT) \ + libgrub_a-fsys_xfs.$(OBJEXT) libgrub_a-gunzip.$(OBJEXT) \ + libgrub_a-md5.$(OBJEXT) libgrub_a-serial.$(OBJEXT) \ + libgrub_a-stage2.$(OBJEXT) libgrub_a-terminfo.$(OBJEXT) \ + libgrub_a-tparm.$(OBJEXT) libgrub_a-graphics.$(OBJEXT) +libgrub_a_OBJECTS = $(am_libgrub_a_OBJECTS) +PROGRAMS = $(noinst_PROGRAMS) +am__objects_1 = diskless_exec-asm.$(OBJEXT) \ + diskless_exec-bios.$(OBJEXT) diskless_exec-boot.$(OBJEXT) \ + diskless_exec-builtins.$(OBJEXT) \ + diskless_exec-char_io.$(OBJEXT) \ + diskless_exec-cmdline.$(OBJEXT) diskless_exec-common.$(OBJEXT) \ + diskless_exec-console.$(OBJEXT) \ + diskless_exec-disk_io.$(OBJEXT) \ + diskless_exec-fsys_ext2fs.$(OBJEXT) \ + diskless_exec-fsys_fat.$(OBJEXT) \ + diskless_exec-fsys_ffs.$(OBJEXT) \ + diskless_exec-fsys_iso9660.$(OBJEXT) \ + diskless_exec-fsys_jfs.$(OBJEXT) \ + diskless_exec-fsys_minix.$(OBJEXT) \ + diskless_exec-fsys_reiserfs.$(OBJEXT) \ + diskless_exec-zfs_sha256.$(OBJEXT) \ + diskless_exec-zfs_lzjb.$(OBJEXT) \ + diskless_exec-zfs_fletcher.$(OBJEXT) \ + diskless_exec-fsys_zfs.$(OBJEXT) \ + diskless_exec-fsys_ufs.$(OBJEXT) \ + diskless_exec-fsys_ufs2.$(OBJEXT) \ + diskless_exec-fsys_vstafs.$(OBJEXT) \ + diskless_exec-fsys_xfs.$(OBJEXT) \ + diskless_exec-gunzip.$(OBJEXT) \ + diskless_exec-hercules.$(OBJEXT) diskless_exec-md5.$(OBJEXT) \ + diskless_exec-serial.$(OBJEXT) \ + diskless_exec-smp-imps.$(OBJEXT) \ + diskless_exec-stage2.$(OBJEXT) \ + diskless_exec-terminfo.$(OBJEXT) diskless_exec-tparm.$(OBJEXT) \ + diskless_exec-graphics.$(OBJEXT) +am_diskless_exec_OBJECTS = $(am__objects_1) +diskless_exec_OBJECTS = $(am_diskless_exec_OBJECTS) +diskless_exec_DEPENDENCIES = ../netboot/libdrivers.a +am_e2fs_stage1_5_exec_OBJECTS = e2fs_stage1_5_exec-start.$(OBJEXT) \ + e2fs_stage1_5_exec-asm.$(OBJEXT) \ + e2fs_stage1_5_exec-common.$(OBJEXT) \ + e2fs_stage1_5_exec-char_io.$(OBJEXT) \ + e2fs_stage1_5_exec-disk_io.$(OBJEXT) \ + e2fs_stage1_5_exec-stage1_5.$(OBJEXT) \ + e2fs_stage1_5_exec-fsys_ext2fs.$(OBJEXT) \ + e2fs_stage1_5_exec-bios.$(OBJEXT) +e2fs_stage1_5_exec_OBJECTS = $(am_e2fs_stage1_5_exec_OBJECTS) +e2fs_stage1_5_exec_LDADD = $(LDADD) +am_fat_stage1_5_exec_OBJECTS = fat_stage1_5_exec-start.$(OBJEXT) \ + fat_stage1_5_exec-asm.$(OBJEXT) \ + fat_stage1_5_exec-common.$(OBJEXT) \ + fat_stage1_5_exec-char_io.$(OBJEXT) \ + fat_stage1_5_exec-disk_io.$(OBJEXT) \ + fat_stage1_5_exec-stage1_5.$(OBJEXT) \ + fat_stage1_5_exec-fsys_fat.$(OBJEXT) \ + fat_stage1_5_exec-bios.$(OBJEXT) +fat_stage1_5_exec_OBJECTS = $(am_fat_stage1_5_exec_OBJECTS) +fat_stage1_5_exec_LDADD = $(LDADD) +am_ffs_stage1_5_exec_OBJECTS = ffs_stage1_5_exec-start.$(OBJEXT) \ + ffs_stage1_5_exec-asm.$(OBJEXT) \ + ffs_stage1_5_exec-common.$(OBJEXT) \ + ffs_stage1_5_exec-char_io.$(OBJEXT) \ + ffs_stage1_5_exec-disk_io.$(OBJEXT) \ + ffs_stage1_5_exec-stage1_5.$(OBJEXT) \ + ffs_stage1_5_exec-fsys_ffs.$(OBJEXT) \ + ffs_stage1_5_exec-bios.$(OBJEXT) +ffs_stage1_5_exec_OBJECTS = $(am_ffs_stage1_5_exec_OBJECTS) +ffs_stage1_5_exec_LDADD = $(LDADD) +am_iso9660_stage1_5_exec_OBJECTS = \ + iso9660_stage1_5_exec-start_eltorito.$(OBJEXT) \ + iso9660_stage1_5_exec-asm.$(OBJEXT) \ + iso9660_stage1_5_exec-common.$(OBJEXT) \ + iso9660_stage1_5_exec-char_io.$(OBJEXT) \ + iso9660_stage1_5_exec-disk_io.$(OBJEXT) \ + iso9660_stage1_5_exec-stage1_5.$(OBJEXT) \ + iso9660_stage1_5_exec-fsys_iso9660.$(OBJEXT) \ + iso9660_stage1_5_exec-bios.$(OBJEXT) +iso9660_stage1_5_exec_OBJECTS = $(am_iso9660_stage1_5_exec_OBJECTS) +iso9660_stage1_5_exec_LDADD = $(LDADD) +am_jfs_stage1_5_exec_OBJECTS = jfs_stage1_5_exec-start.$(OBJEXT) \ + jfs_stage1_5_exec-asm.$(OBJEXT) \ + jfs_stage1_5_exec-common.$(OBJEXT) \ + jfs_stage1_5_exec-char_io.$(OBJEXT) \ + jfs_stage1_5_exec-disk_io.$(OBJEXT) \ + jfs_stage1_5_exec-stage1_5.$(OBJEXT) \ + jfs_stage1_5_exec-fsys_jfs.$(OBJEXT) \ + jfs_stage1_5_exec-bios.$(OBJEXT) +jfs_stage1_5_exec_OBJECTS = $(am_jfs_stage1_5_exec_OBJECTS) +jfs_stage1_5_exec_LDADD = $(LDADD) +am_minix_stage1_5_exec_OBJECTS = minix_stage1_5_exec-start.$(OBJEXT) \ + minix_stage1_5_exec-asm.$(OBJEXT) \ + minix_stage1_5_exec-common.$(OBJEXT) \ + minix_stage1_5_exec-char_io.$(OBJEXT) \ + minix_stage1_5_exec-disk_io.$(OBJEXT) \ + minix_stage1_5_exec-stage1_5.$(OBJEXT) \ + minix_stage1_5_exec-fsys_minix.$(OBJEXT) \ + minix_stage1_5_exec-bios.$(OBJEXT) +minix_stage1_5_exec_OBJECTS = $(am_minix_stage1_5_exec_OBJECTS) +minix_stage1_5_exec_LDADD = $(LDADD) +am_nbloader_exec_OBJECTS = nbloader_exec-nbloader.$(OBJEXT) +nbloader_exec_OBJECTS = $(am_nbloader_exec_OBJECTS) +nbloader_exec_LDADD = $(LDADD) +am_pre_stage2_exec_OBJECTS = pre_stage2_exec-asm.$(OBJEXT) \ + pre_stage2_exec-bios.$(OBJEXT) pre_stage2_exec-boot.$(OBJEXT) \ + pre_stage2_exec-builtins.$(OBJEXT) \ + pre_stage2_exec-char_io.$(OBJEXT) \ + pre_stage2_exec-cmdline.$(OBJEXT) \ + pre_stage2_exec-common.$(OBJEXT) \ + pre_stage2_exec-console.$(OBJEXT) \ + pre_stage2_exec-disk_io.$(OBJEXT) \ + pre_stage2_exec-fsys_ext2fs.$(OBJEXT) \ + pre_stage2_exec-fsys_fat.$(OBJEXT) \ + pre_stage2_exec-fsys_ffs.$(OBJEXT) \ + pre_stage2_exec-fsys_iso9660.$(OBJEXT) \ + pre_stage2_exec-fsys_jfs.$(OBJEXT) \ + pre_stage2_exec-fsys_minix.$(OBJEXT) \ + pre_stage2_exec-fsys_reiserfs.$(OBJEXT) \ + pre_stage2_exec-zfs_sha256.$(OBJEXT) \ + pre_stage2_exec-zfs_lzjb.$(OBJEXT) \ + pre_stage2_exec-zfs_fletcher.$(OBJEXT) \ + pre_stage2_exec-fsys_zfs.$(OBJEXT) \ + pre_stage2_exec-fsys_ufs.$(OBJEXT) \ + pre_stage2_exec-fsys_ufs2.$(OBJEXT) \ + pre_stage2_exec-fsys_vstafs.$(OBJEXT) \ + pre_stage2_exec-fsys_xfs.$(OBJEXT) \ + pre_stage2_exec-gunzip.$(OBJEXT) \ + pre_stage2_exec-hercules.$(OBJEXT) \ + pre_stage2_exec-md5.$(OBJEXT) pre_stage2_exec-serial.$(OBJEXT) \ + pre_stage2_exec-smp-imps.$(OBJEXT) \ + pre_stage2_exec-stage2.$(OBJEXT) \ + pre_stage2_exec-terminfo.$(OBJEXT) \ + pre_stage2_exec-tparm.$(OBJEXT) \ + pre_stage2_exec-graphics.$(OBJEXT) +pre_stage2_exec_OBJECTS = $(am_pre_stage2_exec_OBJECTS) +@NETBOOT_SUPPORT_TRUE@pre_stage2_exec_DEPENDENCIES = \ +@NETBOOT_SUPPORT_TRUE@ ../netboot/libdrivers.a +am_pxeloader_exec_OBJECTS = pxeloader_exec-pxeloader.$(OBJEXT) +pxeloader_exec_OBJECTS = $(am_pxeloader_exec_OBJECTS) +pxeloader_exec_LDADD = $(LDADD) +am_reiserfs_stage1_5_exec_OBJECTS = \ + reiserfs_stage1_5_exec-start.$(OBJEXT) \ + reiserfs_stage1_5_exec-asm.$(OBJEXT) \ + reiserfs_stage1_5_exec-common.$(OBJEXT) \ + reiserfs_stage1_5_exec-char_io.$(OBJEXT) \ + reiserfs_stage1_5_exec-disk_io.$(OBJEXT) \ + reiserfs_stage1_5_exec-stage1_5.$(OBJEXT) \ + reiserfs_stage1_5_exec-fsys_reiserfs.$(OBJEXT) \ + reiserfs_stage1_5_exec-bios.$(OBJEXT) +reiserfs_stage1_5_exec_OBJECTS = $(am_reiserfs_stage1_5_exec_OBJECTS) +reiserfs_stage1_5_exec_LDADD = $(LDADD) +am_start_exec_OBJECTS = start_exec-start.$(OBJEXT) +start_exec_OBJECTS = $(am_start_exec_OBJECTS) +start_exec_LDADD = $(LDADD) +am_start_eltorito_exec_OBJECTS = \ + start_eltorito_exec-start_eltorito.$(OBJEXT) +start_eltorito_exec_OBJECTS = $(am_start_eltorito_exec_OBJECTS) +start_eltorito_exec_LDADD = $(LDADD) +am_ufs2_stage1_5_exec_OBJECTS = ufs2_stage1_5_exec-start.$(OBJEXT) \ + ufs2_stage1_5_exec-asm.$(OBJEXT) \ + ufs2_stage1_5_exec-common.$(OBJEXT) \ + ufs2_stage1_5_exec-char_io.$(OBJEXT) \ + ufs2_stage1_5_exec-disk_io.$(OBJEXT) \ + ufs2_stage1_5_exec-stage1_5.$(OBJEXT) \ + ufs2_stage1_5_exec-fsys_ufs2.$(OBJEXT) \ + ufs2_stage1_5_exec-bios.$(OBJEXT) +ufs2_stage1_5_exec_OBJECTS = $(am_ufs2_stage1_5_exec_OBJECTS) +ufs2_stage1_5_exec_LDADD = $(LDADD) +am_ufs_stage1_5_exec_OBJECTS = ufs_stage1_5_exec-start.$(OBJEXT) \ + ufs_stage1_5_exec-asm.$(OBJEXT) \ + ufs_stage1_5_exec-common.$(OBJEXT) \ + ufs_stage1_5_exec-char_io.$(OBJEXT) \ + ufs_stage1_5_exec-disk_io.$(OBJEXT) \ + ufs_stage1_5_exec-stage1_5.$(OBJEXT) \ + ufs_stage1_5_exec-fsys_ufs.$(OBJEXT) \ + ufs_stage1_5_exec-bios.$(OBJEXT) +ufs_stage1_5_exec_OBJECTS = $(am_ufs_stage1_5_exec_OBJECTS) +ufs_stage1_5_exec_LDADD = $(LDADD) +am_zfs_stage1_5_exec_OBJECTS = zfs_stage1_5_exec-start.$(OBJEXT) \ + zfs_stage1_5_exec-asm.$(OBJEXT) \ + zfs_stage1_5_exec-common.$(OBJEXT) \ + zfs_stage1_5_exec-char_io.$(OBJEXT) \ + zfs_stage1_5_exec-disk_io.$(OBJEXT) \ + zfs_stage1_5_exec-stage1_5.$(OBJEXT) \ + zfs_stage1_5_exec-zfs_sha256.$(OBJEXT) \ + zfs_stage1_5_exec-zfs_lzjb.$(OBJEXT) \ + zfs_stage1_5_exec-zfs_fletcher.$(OBJEXT) \ + zfs_stage1_5_exec-fsys_zfs.$(OBJEXT) \ + zfs_stage1_5_exec-bios.$(OBJEXT) +zfs_stage1_5_exec_OBJECTS = $(am_zfs_stage1_5_exec_OBJECTS) +zfs_stage1_5_exec_LDADD = $(LDADD) +am_vstafs_stage1_5_exec_OBJECTS = \ + vstafs_stage1_5_exec-start.$(OBJEXT) \ + vstafs_stage1_5_exec-asm.$(OBJEXT) \ + vstafs_stage1_5_exec-common.$(OBJEXT) \ + vstafs_stage1_5_exec-char_io.$(OBJEXT) \ + vstafs_stage1_5_exec-disk_io.$(OBJEXT) \ + vstafs_stage1_5_exec-stage1_5.$(OBJEXT) \ + vstafs_stage1_5_exec-fsys_vstafs.$(OBJEXT) \ + vstafs_stage1_5_exec-bios.$(OBJEXT) +vstafs_stage1_5_exec_OBJECTS = $(am_vstafs_stage1_5_exec_OBJECTS) +vstafs_stage1_5_exec_LDADD = $(LDADD) +am_xfs_stage1_5_exec_OBJECTS = xfs_stage1_5_exec-start.$(OBJEXT) \ + xfs_stage1_5_exec-asm.$(OBJEXT) \ + xfs_stage1_5_exec-common.$(OBJEXT) \ + xfs_stage1_5_exec-char_io.$(OBJEXT) \ + xfs_stage1_5_exec-disk_io.$(OBJEXT) \ + xfs_stage1_5_exec-stage1_5.$(OBJEXT) \ + xfs_stage1_5_exec-fsys_xfs.$(OBJEXT) \ + xfs_stage1_5_exec-bios.$(OBJEXT) +xfs_stage1_5_exec_OBJECTS = $(am_xfs_stage1_5_exec_OBJECTS) +xfs_stage1_5_exec_LDADD = $(LDADD) +SCRIPTS = $(noinst_SCRIPTS) +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +CCASCOMPILE = $(CCAS) $(AM_CCASFLAGS) $(CCASFLAGS) +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(libgrub_a_SOURCES) $(diskless_exec_SOURCES) \ + $(e2fs_stage1_5_exec_SOURCES) $(fat_stage1_5_exec_SOURCES) \ + $(ffs_stage1_5_exec_SOURCES) $(iso9660_stage1_5_exec_SOURCES) \ + $(jfs_stage1_5_exec_SOURCES) $(minix_stage1_5_exec_SOURCES) \ + $(nbloader_exec_SOURCES) $(pre_stage2_exec_SOURCES) \ + $(pxeloader_exec_SOURCES) $(reiserfs_stage1_5_exec_SOURCES) \ + $(start_exec_SOURCES) $(start_eltorito_exec_SOURCES) \ + $(ufs2_stage1_5_exec_SOURCES) $(ufs_stage1_5_exec_SOURCES) \ + $(zfs_stage1_5_exec_SOURCES) \ + $(vstafs_stage1_5_exec_SOURCES) $(xfs_stage1_5_exec_SOURCES) +DIST_SOURCES = $(libgrub_a_SOURCES) $(diskless_exec_SOURCES) \ + $(e2fs_stage1_5_exec_SOURCES) $(fat_stage1_5_exec_SOURCES) \ + $(ffs_stage1_5_exec_SOURCES) $(iso9660_stage1_5_exec_SOURCES) \ + $(jfs_stage1_5_exec_SOURCES) $(minix_stage1_5_exec_SOURCES) \ + $(nbloader_exec_SOURCES) $(pre_stage2_exec_SOURCES) \ + $(pxeloader_exec_SOURCES) $(reiserfs_stage1_5_exec_SOURCES) \ + $(start_exec_SOURCES) $(start_eltorito_exec_SOURCES) \ + $(ufs2_stage1_5_exec_SOURCES) $(ufs_stage1_5_exec_SOURCES) \ + $(zfs_stage1_5_exec_SOURCES) \ + $(vstafs_stage1_5_exec_SOURCES) $(xfs_stage1_5_exec_SOURCES) +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +am__installdirs = "$(DESTDIR)$(pkglibdir)" +pkglibDATA_INSTALL = $(INSTALL_DATA) +DATA = $(noinst_DATA) $(pkglib_DATA) +HEADERS = $(noinst_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +# Stage 2 and Stage 1.5's. +pkglibdir = $(libdir)/$(PACKAGE)/$(host_cpu)-$(host_vendor) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BUILD_EXAMPLE_KERNEL_FALSE = @BUILD_EXAMPLE_KERNEL_FALSE@ +BUILD_EXAMPLE_KERNEL_TRUE = @BUILD_EXAMPLE_KERNEL_TRUE@ +CC = @CC@ +CCAS = @CCAS@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DISKLESS_SUPPORT_FALSE = @DISKLESS_SUPPORT_FALSE@ +DISKLESS_SUPPORT_TRUE = @DISKLESS_SUPPORT_TRUE@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FSYS_CFLAGS = @FSYS_CFLAGS@ +GRAPHICS_SUPPORT_FALSE = @GRAPHICS_SUPPORT_FALSE@ +GRAPHICS_SUPPORT_TRUE = @GRAPHICS_SUPPORT_TRUE@ +GRUB_CFLAGS = @GRUB_CFLAGS@ +GRUB_LIBS = @GRUB_LIBS@ +HERCULES_SUPPORT_FALSE = @HERCULES_SUPPORT_FALSE@ +HERCULES_SUPPORT_TRUE = @HERCULES_SUPPORT_TRUE@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +NETBOOT_DRIVERS = @NETBOOT_DRIVERS@ +NETBOOT_SUPPORT_FALSE = @NETBOOT_SUPPORT_FALSE@ +NETBOOT_SUPPORT_TRUE = @NETBOOT_SUPPORT_TRUE@ +NET_CFLAGS = @NET_CFLAGS@ +NET_EXTRAFLAGS = @NET_EXTRAFLAGS@ +OBJCOPY = @OBJCOPY@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PERL = @PERL@ +RANLIB = @RANLIB@ +SERIAL_SPEED_SIMULATION_FALSE = @SERIAL_SPEED_SIMULATION_FALSE@ +SERIAL_SPEED_SIMULATION_TRUE = @SERIAL_SPEED_SIMULATION_TRUE@ +SERIAL_SUPPORT_FALSE = @SERIAL_SUPPORT_FALSE@ +SERIAL_SUPPORT_TRUE = @SERIAL_SUPPORT_TRUE@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STAGE1_CFLAGS = @STAGE1_CFLAGS@ +STAGE2_CFLAGS = @STAGE2_CFLAGS@ +STRIP = @STRIP@ +VERSION = @VERSION@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_OBJCOPY = @ac_ct_OBJCOPY@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ + +# For test target. +TESTS = size_test +noinst_SCRIPTS = $(TESTS) + +# For dist target. +noinst_HEADERS = apic.h defs.h dir.h disk_inode.h disk_inode_ffs.h \ + fat.h filesys.h freebsd.h fs.h hercules.h i386-elf.h \ + imgact_aout.h iso9660.h jfs.h mb_header.h mb_info.h md5.h \ + nbi.h pc_slice.h serial.h shared.h smp-imps.h term.h \ + terminfo.h tparm.h nbi.h fsys_zfs.h ufs.h ufs2.h vstafs.h xfs.h graphics.h + +EXTRA_DIST = setjmp.S apm.S $(noinst_SCRIPTS) + +# For . +INCLUDES = -I$(top_srcdir)/stage1 + +# The library for /sbin/grub. +noinst_LIBRARIES = libgrub.a +libgrub_a_SOURCES = boot.c builtins.c char_io.c cmdline.c common.c \ + disk_io.c fsys_ext2fs.c fsys_fat.c fsys_ffs.c fsys_iso9660.c \ + fsys_jfs.c fsys_minix.c fsys_reiserfs.c fsys_ufs.c fsys_ufs2.c \ + zfs_sha256.c zfs_lzjb.c zfs_fletcher.c fsys_zfs.c \ + fsys_vstafs.c fsys_xfs.c gunzip.c md5.c serial.c stage2.c \ + terminfo.c tparm.c graphics.c + +libgrub_a_CFLAGS = $(GRUB_CFLAGS) -I$(top_srcdir)/lib \ + -DGRUB_UTIL=1 -DFSYS_EXT2FS=1 -DFSYS_FAT=1 -DFSYS_FFS=1 \ + -DFSYS_ISO9660=1 -DFSYS_JFS=1 -DFSYS_MINIX=1 -DFSYS_REISERFS=1 \ + -DFSYS_ZFS=1 -DFSYS_UFS=1 -DFSYS_UFS2=1 -DFSYS_VSTAFS=1 -DFSYS_XFS=1 \ + -DUSE_MD5_PASSWORDS=1 -DSUPPORT_SERIAL=1 -DSUPPORT_HERCULES=1 \ + +@DISKLESS_SUPPORT_FALSE@pkglib_DATA = stage2 stage2_eltorito e2fs_stage1_5 fat_stage1_5 \ +@DISKLESS_SUPPORT_FALSE@ ffs_stage1_5 iso9660_stage1_5 jfs_stage1_5 minix_stage1_5 \ +@DISKLESS_SUPPORT_FALSE@ zfs_stage1_5 \ +@DISKLESS_SUPPORT_FALSE@ reiserfs_stage1_5 ufs_stage1_5 ufs2_stage1_5 vstafs_stage1_5 \ +@DISKLESS_SUPPORT_FALSE@ xfs_stage1_5 + +@DISKLESS_SUPPORT_TRUE@pkglib_DATA = stage2 stage2_eltorito e2fs_stage1_5 fat_stage1_5 \ +@DISKLESS_SUPPORT_TRUE@ ffs_stage1_5 iso9660_stage1_5 jfs_stage1_5 minix_stage1_5 \ +@DISKLESS_SUPPORT_TRUE@ zfs_stage1_5 \ +@DISKLESS_SUPPORT_TRUE@ reiserfs_stage1_5 ufs_stage1_5 ufs2_stage1_5 vstafs_stage1_5 \ +@DISKLESS_SUPPORT_TRUE@ xfs_stage1_5 nbgrub pxegrub + +@DISKLESS_SUPPORT_FALSE@noinst_DATA = pre_stage2 start start_eltorito +@DISKLESS_SUPPORT_TRUE@noinst_DATA = pre_stage2 start start_eltorito nbloader pxeloader diskless +MOSTLYCLEANFILES = $(noinst_PROGRAMS) +PRE_STAGE2_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,8200 +START_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,8000 +NBLOADER_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,0 +PXELOADER_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,7C00 +START_ELTORITO_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,7C00 +@NETBOOT_SUPPORT_FALSE@NETBOOT_FLAGS = +@NETBOOT_SUPPORT_TRUE@NETBOOT_FLAGS = -I$(top_srcdir)/netboot -DSUPPORT_NETBOOT=1 +@SERIAL_SUPPORT_FALSE@SERIAL_FLAGS = +@SERIAL_SUPPORT_TRUE@SERIAL_FLAGS = -DSUPPORT_SERIAL=1 +@HERCULES_SUPPORT_FALSE@HERCULES_FLAGS = +@HERCULES_SUPPORT_TRUE@HERCULES_FLAGS = -DSUPPORT_HERCULES=1 +@GRAPHICS_SUPPORT_FALSE@GRAPHICS_FLAGS = +@GRAPHICS_SUPPORT_TRUE@GRAPHICS_FLAGS = -DSUPPORT_GRAPHICS=1 +STAGE2_COMPILE = $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ + $(NETBOOT_FLAGS) $(SERIAL_FLAGS) $(HERCULES_FLAGS) $(GRAPHICS_FLAGS) + +STAGE1_5_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,2000 +STAGE1_5_COMPILE = $(STAGE2_COMPILE) -DNO_DECOMPRESSION=1 -DSTAGE1_5=1 + +# For stage2 target. +pre_stage2_exec_SOURCES = asm.S bios.c boot.c builtins.c char_io.c \ + cmdline.c common.c console.c disk_io.c fsys_ext2fs.c \ + fsys_fat.c fsys_ffs.c fsys_iso9660.c fsys_jfs.c fsys_minix.c \ + fsys_zfs.c zfs_fletcher.c zfs_lzjb.c zfs_sha256.c \ + fsys_reiserfs.c fsys_ufs.c fsys_ufs2.c fsys_vstafs.c fsys_xfs.c \ + gunzip.c hercules.c md5.c serial.c smp-imps.c stage2.c terminfo.c \ + tparm.c graphics.c + +pre_stage2_exec_CFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS) +pre_stage2_exec_CCASFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS) +pre_stage2_exec_LDFLAGS = $(PRE_STAGE2_LINK) +@NETBOOT_SUPPORT_TRUE@pre_stage2_exec_LDADD = ../netboot/libdrivers.a +@DISKLESS_SUPPORT_FALSE@BUILT_SOURCES = stage2_size.h +@DISKLESS_SUPPORT_TRUE@BUILT_SOURCES = stage2_size.h diskless_size.h +CLEANFILES = $(pkglib_DATA) $(noinst_DATA) $(BUILT_SOURCES) +start_exec_SOURCES = start.S +start_exec_CCASFLAGS = $(STAGE2_COMPILE) +start_exec_LDFLAGS = $(START_LINK) +start_eltorito_exec_SOURCES = start_eltorito.S +start_eltorito_exec_CCASFLAGS = $(STAGE2_COMPILE) +start_eltorito_exec_LDFLAGS = $(START_ELTORITO_LINK) + +# For e2fs_stage1_5 target. +e2fs_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c disk_io.c \ + stage1_5.c fsys_ext2fs.c bios.c + +e2fs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_EXT2FS=1 \ + -DNO_BLOCK_FILES=1 + +e2fs_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_EXT2FS=1 \ + -DNO_BLOCK_FILES=1 + +e2fs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) + +# For fat_stage1_5 target. +fat_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c disk_io.c \ + stage1_5.c fsys_fat.c bios.c + +fat_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_FAT=1 \ + -DNO_BLOCK_FILES=1 + +fat_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_FAT=1 \ + -DNO_BLOCK_FILES=1 + +fat_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) + +# For ffs_stage1_5 target. +ffs_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c disk_io.c \ + stage1_5.c fsys_ffs.c bios.c + +ffs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_FFS=1 \ + -DNO_BLOCK_FILES=1 + +ffs_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_FFS=1 \ + -DNO_BLOCK_FILES=1 + +ffs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) + +# For zfs_stage1_5 target. +zfs_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c disk_io.c \ + stage1_5.c fsys_zfs.c zfs_fletcher.c zfs_lzjb.c zfs_sha256.c bios.c + +zfs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_ZFS=1 \ + -DNO_BLOCK_FILES=1 + +zfs_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_ZFS=1 \ + -DNO_BLOCK_FILES=1 + +zfs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) + +# For ufs_stage1_5 target. +ufs_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c disk_io.c \ + stage1_5.c fsys_ufs.c bios.c + +ufs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_UFS=1 \ + -DNO_BLOCK_FILES=1 + +ufs_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_UFS=1 \ + -DNO_BLOCK_FILES=1 + +ufs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) + +# For ufs2_stage1_5 target. +ufs2_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c disk_io.c \ + stage1_5.c fsys_ufs2.c bios.c + +ufs2_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_UFS2=1 \ + -DNO_BLOCK_FILES=1 + +ufs2_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_UFS2=1 \ + -DNO_BLOCK_FILES=1 + +ufs2_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) + +# For minix_stage1_5 target. +minix_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c disk_io.c \ + stage1_5.c fsys_minix.c bios.c + +minix_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_MINIX=1 \ + -DNO_BLOCK_FILES=1 + +minix_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_MINIX=1 \ + -DNO_BLOCK_FILES=1 + +minix_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) + +# For reiserfs_stage1_5 target. +reiserfs_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c \ + disk_io.c stage1_5.c fsys_reiserfs.c bios.c + +reiserfs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_REISERFS=1 \ + -DNO_BLOCK_FILES=1 + +reiserfs_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_REISERFS=1 \ + -DNO_BLOCK_FILES=1 + +reiserfs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) + +# For vstafs_stage1_5 target. +vstafs_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c \ + disk_io.c stage1_5.c fsys_vstafs.c bios.c + +vstafs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_VSTAFS=1 \ + -DNO_BLOCK_FILES=1 + +vstafs_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_VSTAFS=1 \ + -DNO_BLOCK_FILES=1 + +vstafs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) + +# For jfs_stage1_5 target. +jfs_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c \ + disk_io.c stage1_5.c fsys_jfs.c bios.c + +jfs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_JFS=1 \ + -DNO_BLOCK_FILES=1 + +jfs_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_JFS=1 \ + -DNO_BLOCK_FILES=1 + +jfs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) + +# For xfs_stage1_5 target. +xfs_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c \ + disk_io.c stage1_5.c fsys_xfs.c bios.c + +xfs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_XFS=1 \ + -DNO_BLOCK_FILES=1 + +xfs_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_XFS=1 \ + -DNO_BLOCK_FILES=1 + +xfs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) + +# For iso9660_stage1_5 target. +iso9660_stage1_5_exec_SOURCES = start_eltorito.S asm.S common.c char_io.c \ + disk_io.c stage1_5.c fsys_iso9660.c bios.c + +iso9660_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_ISO9660=1 \ + -DNO_BLOCK_FILES=1 + +iso9660_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_ISO9660=1 \ + -DNO_BLOCK_FILES=1 + +iso9660_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) + +# For diskless target. +diskless_exec_SOURCES = $(pre_stage2_exec_SOURCES) +diskless_exec_CFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS) \ + -DSUPPORT_DISKLESS=1 + +diskless_exec_CCASFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS) \ + -DSUPPORT_DISKLESS=1 + +diskless_exec_LDFLAGS = $(PRE_STAGE2_LINK) +diskless_exec_LDADD = ../netboot/libdrivers.a + +# For nbloader target. +nbloader_exec_SOURCES = nbloader.S +nbloader_exec_CCASFLAGS = $(STAGE2_COMPILE) +nbloader_exec_LDFLAGS = $(NBLOADER_LINK) + +# For pxeloader target. +pxeloader_exec_SOURCES = pxeloader.S +pxeloader_exec_CCASFLAGS = $(STAGE2_COMPILE) +pxeloader_exec_LDFLAGS = $(PXELOADER_LINK) + +# General rule for making a raw binary. +SUFFIXES = .exec +all: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) all-am + +.SUFFIXES: +.SUFFIXES: .exec .S .c .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu stage2/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu stage2/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +clean-noinstLIBRARIES: + -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) +libgrub.a: $(libgrub_a_OBJECTS) $(libgrub_a_DEPENDENCIES) + -rm -f libgrub.a + $(libgrub_a_AR) libgrub.a $(libgrub_a_OBJECTS) $(libgrub_a_LIBADD) + $(RANLIB) libgrub.a + +clean-noinstPROGRAMS: + -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) +diskless.exec$(EXEEXT): $(diskless_exec_OBJECTS) $(diskless_exec_DEPENDENCIES) + @rm -f diskless.exec$(EXEEXT) + $(LINK) $(diskless_exec_LDFLAGS) $(diskless_exec_OBJECTS) $(diskless_exec_LDADD) $(LIBS) +e2fs_stage1_5.exec$(EXEEXT): $(e2fs_stage1_5_exec_OBJECTS) $(e2fs_stage1_5_exec_DEPENDENCIES) + @rm -f e2fs_stage1_5.exec$(EXEEXT) + $(LINK) $(e2fs_stage1_5_exec_LDFLAGS) $(e2fs_stage1_5_exec_OBJECTS) $(e2fs_stage1_5_exec_LDADD) $(LIBS) +fat_stage1_5.exec$(EXEEXT): $(fat_stage1_5_exec_OBJECTS) $(fat_stage1_5_exec_DEPENDENCIES) + @rm -f fat_stage1_5.exec$(EXEEXT) + $(LINK) $(fat_stage1_5_exec_LDFLAGS) $(fat_stage1_5_exec_OBJECTS) $(fat_stage1_5_exec_LDADD) $(LIBS) +ffs_stage1_5.exec$(EXEEXT): $(ffs_stage1_5_exec_OBJECTS) $(ffs_stage1_5_exec_DEPENDENCIES) + @rm -f ffs_stage1_5.exec$(EXEEXT) + $(LINK) $(ffs_stage1_5_exec_LDFLAGS) $(ffs_stage1_5_exec_OBJECTS) $(ffs_stage1_5_exec_LDADD) $(LIBS) +iso9660_stage1_5.exec$(EXEEXT): $(iso9660_stage1_5_exec_OBJECTS) $(iso9660_stage1_5_exec_DEPENDENCIES) + @rm -f iso9660_stage1_5.exec$(EXEEXT) + $(LINK) $(iso9660_stage1_5_exec_LDFLAGS) $(iso9660_stage1_5_exec_OBJECTS) $(iso9660_stage1_5_exec_LDADD) $(LIBS) +jfs_stage1_5.exec$(EXEEXT): $(jfs_stage1_5_exec_OBJECTS) $(jfs_stage1_5_exec_DEPENDENCIES) + @rm -f jfs_stage1_5.exec$(EXEEXT) + $(LINK) $(jfs_stage1_5_exec_LDFLAGS) $(jfs_stage1_5_exec_OBJECTS) $(jfs_stage1_5_exec_LDADD) $(LIBS) +minix_stage1_5.exec$(EXEEXT): $(minix_stage1_5_exec_OBJECTS) $(minix_stage1_5_exec_DEPENDENCIES) + @rm -f minix_stage1_5.exec$(EXEEXT) + $(LINK) $(minix_stage1_5_exec_LDFLAGS) $(minix_stage1_5_exec_OBJECTS) $(minix_stage1_5_exec_LDADD) $(LIBS) +nbloader.exec$(EXEEXT): $(nbloader_exec_OBJECTS) $(nbloader_exec_DEPENDENCIES) + @rm -f nbloader.exec$(EXEEXT) + $(LINK) $(nbloader_exec_LDFLAGS) $(nbloader_exec_OBJECTS) $(nbloader_exec_LDADD) $(LIBS) +pre_stage2.exec$(EXEEXT): $(pre_stage2_exec_OBJECTS) $(pre_stage2_exec_DEPENDENCIES) + @rm -f pre_stage2.exec$(EXEEXT) + $(LINK) $(pre_stage2_exec_LDFLAGS) $(pre_stage2_exec_OBJECTS) $(pre_stage2_exec_LDADD) $(LIBS) +pxeloader.exec$(EXEEXT): $(pxeloader_exec_OBJECTS) $(pxeloader_exec_DEPENDENCIES) + @rm -f pxeloader.exec$(EXEEXT) + $(LINK) $(pxeloader_exec_LDFLAGS) $(pxeloader_exec_OBJECTS) $(pxeloader_exec_LDADD) $(LIBS) +reiserfs_stage1_5.exec$(EXEEXT): $(reiserfs_stage1_5_exec_OBJECTS) $(reiserfs_stage1_5_exec_DEPENDENCIES) + @rm -f reiserfs_stage1_5.exec$(EXEEXT) + $(LINK) $(reiserfs_stage1_5_exec_LDFLAGS) $(reiserfs_stage1_5_exec_OBJECTS) $(reiserfs_stage1_5_exec_LDADD) $(LIBS) +start.exec$(EXEEXT): $(start_exec_OBJECTS) $(start_exec_DEPENDENCIES) + @rm -f start.exec$(EXEEXT) + $(LINK) $(start_exec_LDFLAGS) $(start_exec_OBJECTS) $(start_exec_LDADD) $(LIBS) +start_eltorito.exec$(EXEEXT): $(start_eltorito_exec_OBJECTS) $(start_eltorito_exec_DEPENDENCIES) + @rm -f start_eltorito.exec$(EXEEXT) + $(LINK) $(start_eltorito_exec_LDFLAGS) $(start_eltorito_exec_OBJECTS) $(start_eltorito_exec_LDADD) $(LIBS) +zfs_stage1_5.exec$(EXEEXT): $(zfs_stage1_5_exec_OBJECTS) $(zfs_stage1_5_exec_DEPENDENCIES) + @rm -f zfs_stage1_5.exec$(EXEEXT) + $(LINK) $(zfs_stage1_5_exec_LDFLAGS) $(zfs_stage1_5_exec_OBJECTS) $(zfs_stage1_5_exec_LDADD) $(LIBS) +ufs2_stage1_5.exec$(EXEEXT): $(ufs2_stage1_5_exec_OBJECTS) $(ufs2_stage1_5_exec_DEPENDENCIES) + @rm -f ufs2_stage1_5.exec$(EXEEXT) + $(LINK) $(ufs2_stage1_5_exec_LDFLAGS) $(ufs2_stage1_5_exec_OBJECTS) $(ufs2_stage1_5_exec_LDADD) $(LIBS) +ufs_stage1_5.exec$(EXEEXT): $(ufs_stage1_5_exec_OBJECTS) $(ufs_stage1_5_exec_DEPENDENCIES) + @rm -f ufs_stage1_5.exec$(EXEEXT) + $(LINK) $(ufs_stage1_5_exec_LDFLAGS) $(ufs_stage1_5_exec_OBJECTS) $(ufs_stage1_5_exec_LDADD) $(LIBS) +vstafs_stage1_5.exec$(EXEEXT): $(vstafs_stage1_5_exec_OBJECTS) $(vstafs_stage1_5_exec_DEPENDENCIES) + @rm -f vstafs_stage1_5.exec$(EXEEXT) + $(LINK) $(vstafs_stage1_5_exec_LDFLAGS) $(vstafs_stage1_5_exec_OBJECTS) $(vstafs_stage1_5_exec_LDADD) $(LIBS) +xfs_stage1_5.exec$(EXEEXT): $(xfs_stage1_5_exec_OBJECTS) $(xfs_stage1_5_exec_DEPENDENCIES) + @rm -f xfs_stage1_5.exec$(EXEEXT) + $(LINK) $(xfs_stage1_5_exec_LDFLAGS) $(xfs_stage1_5_exec_OBJECTS) $(xfs_stage1_5_exec_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskless_exec-bios.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskless_exec-boot.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskless_exec-builtins.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskless_exec-char_io.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskless_exec-cmdline.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskless_exec-common.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskless_exec-console.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskless_exec-disk_io.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskless_exec-fsys_ext2fs.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskless_exec-fsys_fat.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskless_exec-fsys_ffs.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskless_exec-fsys_iso9660.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskless_exec-fsys_jfs.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskless_exec-fsys_minix.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskless_exec-fsys_reiserfs.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskless_exec-zfs_sha256.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskless_exec-zfs_lzjb.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskless_exec-zfs_fletcher.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskless_exec-fsys_zfs.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskless_exec-fsys_ufs.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskless_exec-fsys_ufs2.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskless_exec-fsys_vstafs.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskless_exec-fsys_xfs.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskless_exec-graphics.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskless_exec-gunzip.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskless_exec-hercules.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskless_exec-md5.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskless_exec-serial.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskless_exec-smp-imps.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskless_exec-stage2.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskless_exec-terminfo.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskless_exec-tparm.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/e2fs_stage1_5_exec-bios.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/e2fs_stage1_5_exec-char_io.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/e2fs_stage1_5_exec-common.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/e2fs_stage1_5_exec-disk_io.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/e2fs_stage1_5_exec-fsys_ext2fs.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/e2fs_stage1_5_exec-stage1_5.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fat_stage1_5_exec-bios.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fat_stage1_5_exec-char_io.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fat_stage1_5_exec-common.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fat_stage1_5_exec-disk_io.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fat_stage1_5_exec-fsys_fat.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fat_stage1_5_exec-stage1_5.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ffs_stage1_5_exec-bios.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ffs_stage1_5_exec-char_io.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ffs_stage1_5_exec-common.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ffs_stage1_5_exec-disk_io.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ffs_stage1_5_exec-fsys_ffs.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ffs_stage1_5_exec-stage1_5.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iso9660_stage1_5_exec-bios.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iso9660_stage1_5_exec-char_io.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iso9660_stage1_5_exec-common.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iso9660_stage1_5_exec-disk_io.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iso9660_stage1_5_exec-fsys_iso9660.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iso9660_stage1_5_exec-stage1_5.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jfs_stage1_5_exec-bios.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jfs_stage1_5_exec-char_io.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jfs_stage1_5_exec-common.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jfs_stage1_5_exec-disk_io.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jfs_stage1_5_exec-fsys_jfs.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jfs_stage1_5_exec-stage1_5.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgrub_a-boot.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgrub_a-builtins.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgrub_a-char_io.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgrub_a-cmdline.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgrub_a-common.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgrub_a-disk_io.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgrub_a-fsys_ext2fs.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgrub_a-fsys_fat.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgrub_a-fsys_ffs.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgrub_a-fsys_iso9660.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgrub_a-fsys_jfs.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgrub_a-fsys_minix.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgrub_a-fsys_reiserfs.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgrub_a-zfs_sha256.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgrub_a-zfs_lzjb.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgrub_a-zfs_fletcher.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgrub_a-fsys_zfs.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgrub_a-fsys_ufs.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgrub_a-fsys_ufs2.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgrub_a-fsys_vstafs.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgrub_a-fsys_xfs.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgrub_a-graphics.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgrub_a-gunzip.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgrub_a-md5.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgrub_a-serial.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgrub_a-stage2.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgrub_a-terminfo.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgrub_a-tparm.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/minix_stage1_5_exec-bios.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/minix_stage1_5_exec-char_io.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/minix_stage1_5_exec-common.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/minix_stage1_5_exec-disk_io.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/minix_stage1_5_exec-fsys_minix.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/minix_stage1_5_exec-stage1_5.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_stage2_exec-bios.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_stage2_exec-boot.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_stage2_exec-builtins.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_stage2_exec-char_io.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_stage2_exec-cmdline.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_stage2_exec-common.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_stage2_exec-console.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_stage2_exec-disk_io.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_stage2_exec-fsys_ext2fs.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_stage2_exec-fsys_fat.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_stage2_exec-fsys_ffs.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_stage2_exec-fsys_iso9660.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_stage2_exec-fsys_jfs.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_stage2_exec-fsys_minix.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_stage2_exec-fsys_reiserfs.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_stage2_exec-zfs_sha256.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_stage2_exec-zfs_lzjb.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_stage2_exec-zfs_fletcher.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_stage2_exec-fsys_zfs.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_stage2_exec-fsys_ufs.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_stage2_exec-fsys_ufs2.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_stage2_exec-fsys_vstafs.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_stage2_exec-fsys_xfs.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_stage2_exec-graphics.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_stage2_exec-gunzip.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_stage2_exec-hercules.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_stage2_exec-md5.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_stage2_exec-serial.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_stage2_exec-smp-imps.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_stage2_exec-stage2.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_stage2_exec-terminfo.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_stage2_exec-tparm.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/reiserfs_stage1_5_exec-bios.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/reiserfs_stage1_5_exec-char_io.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/reiserfs_stage1_5_exec-common.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/reiserfs_stage1_5_exec-disk_io.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/reiserfs_stage1_5_exec-fsys_reiserfs.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/reiserfs_stage1_5_exec-stage1_5.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ufs2_stage1_5_exec-bios.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ufs2_stage1_5_exec-char_io.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ufs2_stage1_5_exec-common.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ufs2_stage1_5_exec-disk_io.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ufs2_stage1_5_exec-fsys_ufs2.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ufs2_stage1_5_exec-stage1_5.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ufs_stage1_5_exec-bios.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ufs_stage1_5_exec-char_io.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ufs_stage1_5_exec-common.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ufs_stage1_5_exec-disk_io.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ufs_stage1_5_exec-fsys_ufs.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ufs_stage1_5_exec-stage1_5.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zfs_stage1_5_exec-bios.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zfs_stage1_5_exec-char_io.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zfs_stage1_5_exec-common.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zfs_stage1_5_exec-disk_io.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zfs_stage1_5_exec-zfs_sha256.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zfs_stage1_5_exec-zfs_lzjb.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zfs_stage1_5_exec-zfs_fletcher.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zfs_stage1_5_exec-fsys_zfs.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zfs_stage1_5_exec-stage1_5.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vstafs_stage1_5_exec-bios.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vstafs_stage1_5_exec-char_io.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vstafs_stage1_5_exec-common.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vstafs_stage1_5_exec-disk_io.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vstafs_stage1_5_exec-fsys_vstafs.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vstafs_stage1_5_exec-stage1_5.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xfs_stage1_5_exec-bios.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xfs_stage1_5_exec-char_io.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xfs_stage1_5_exec-common.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xfs_stage1_5_exec-disk_io.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xfs_stage1_5_exec-fsys_xfs.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xfs_stage1_5_exec-stage1_5.Po@am__quote@ + +.S.o: + $(CCASCOMPILE) -c $< + +.S.obj: + $(CCASCOMPILE) -c `$(CYGPATH_W) '$<'` + +diskless_exec-asm.o: asm.S + $(CCAS) $(diskless_exec_CCASFLAGS) $(CCASFLAGS) -c -o diskless_exec-asm.o `test -f 'asm.S' || echo '$(srcdir)/'`asm.S + +diskless_exec-asm.obj: asm.S + $(CCAS) $(diskless_exec_CCASFLAGS) $(CCASFLAGS) -c -o diskless_exec-asm.obj `if test -f 'asm.S'; then $(CYGPATH_W) 'asm.S'; else $(CYGPATH_W) '$(srcdir)/asm.S'; fi` + +e2fs_stage1_5_exec-start.o: start.S + $(CCAS) $(e2fs_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o e2fs_stage1_5_exec-start.o `test -f 'start.S' || echo '$(srcdir)/'`start.S + +e2fs_stage1_5_exec-start.obj: start.S + $(CCAS) $(e2fs_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o e2fs_stage1_5_exec-start.obj `if test -f 'start.S'; then $(CYGPATH_W) 'start.S'; else $(CYGPATH_W) '$(srcdir)/start.S'; fi` + +e2fs_stage1_5_exec-asm.o: asm.S + $(CCAS) $(e2fs_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o e2fs_stage1_5_exec-asm.o `test -f 'asm.S' || echo '$(srcdir)/'`asm.S + +e2fs_stage1_5_exec-asm.obj: asm.S + $(CCAS) $(e2fs_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o e2fs_stage1_5_exec-asm.obj `if test -f 'asm.S'; then $(CYGPATH_W) 'asm.S'; else $(CYGPATH_W) '$(srcdir)/asm.S'; fi` + +fat_stage1_5_exec-start.o: start.S + $(CCAS) $(fat_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o fat_stage1_5_exec-start.o `test -f 'start.S' || echo '$(srcdir)/'`start.S + +fat_stage1_5_exec-start.obj: start.S + $(CCAS) $(fat_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o fat_stage1_5_exec-start.obj `if test -f 'start.S'; then $(CYGPATH_W) 'start.S'; else $(CYGPATH_W) '$(srcdir)/start.S'; fi` + +fat_stage1_5_exec-asm.o: asm.S + $(CCAS) $(fat_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o fat_stage1_5_exec-asm.o `test -f 'asm.S' || echo '$(srcdir)/'`asm.S + +fat_stage1_5_exec-asm.obj: asm.S + $(CCAS) $(fat_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o fat_stage1_5_exec-asm.obj `if test -f 'asm.S'; then $(CYGPATH_W) 'asm.S'; else $(CYGPATH_W) '$(srcdir)/asm.S'; fi` + +ffs_stage1_5_exec-start.o: start.S + $(CCAS) $(ffs_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o ffs_stage1_5_exec-start.o `test -f 'start.S' || echo '$(srcdir)/'`start.S + +ffs_stage1_5_exec-start.obj: start.S + $(CCAS) $(ffs_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o ffs_stage1_5_exec-start.obj `if test -f 'start.S'; then $(CYGPATH_W) 'start.S'; else $(CYGPATH_W) '$(srcdir)/start.S'; fi` + +ffs_stage1_5_exec-asm.o: asm.S + $(CCAS) $(ffs_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o ffs_stage1_5_exec-asm.o `test -f 'asm.S' || echo '$(srcdir)/'`asm.S + +ffs_stage1_5_exec-asm.obj: asm.S + $(CCAS) $(ffs_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o ffs_stage1_5_exec-asm.obj `if test -f 'asm.S'; then $(CYGPATH_W) 'asm.S'; else $(CYGPATH_W) '$(srcdir)/asm.S'; fi` + +iso9660_stage1_5_exec-start_eltorito.o: start_eltorito.S + $(CCAS) $(iso9660_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o iso9660_stage1_5_exec-start_eltorito.o `test -f 'start_eltorito.S' || echo '$(srcdir)/'`start_eltorito.S + +iso9660_stage1_5_exec-start_eltorito.obj: start_eltorito.S + $(CCAS) $(iso9660_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o iso9660_stage1_5_exec-start_eltorito.obj `if test -f 'start_eltorito.S'; then $(CYGPATH_W) 'start_eltorito.S'; else $(CYGPATH_W) '$(srcdir)/start_eltorito.S'; fi` + +iso9660_stage1_5_exec-asm.o: asm.S + $(CCAS) $(iso9660_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o iso9660_stage1_5_exec-asm.o `test -f 'asm.S' || echo '$(srcdir)/'`asm.S + +iso9660_stage1_5_exec-asm.obj: asm.S + $(CCAS) $(iso9660_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o iso9660_stage1_5_exec-asm.obj `if test -f 'asm.S'; then $(CYGPATH_W) 'asm.S'; else $(CYGPATH_W) '$(srcdir)/asm.S'; fi` + +jfs_stage1_5_exec-start.o: start.S + $(CCAS) $(jfs_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o jfs_stage1_5_exec-start.o `test -f 'start.S' || echo '$(srcdir)/'`start.S + +jfs_stage1_5_exec-start.obj: start.S + $(CCAS) $(jfs_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o jfs_stage1_5_exec-start.obj `if test -f 'start.S'; then $(CYGPATH_W) 'start.S'; else $(CYGPATH_W) '$(srcdir)/start.S'; fi` + +jfs_stage1_5_exec-asm.o: asm.S + $(CCAS) $(jfs_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o jfs_stage1_5_exec-asm.o `test -f 'asm.S' || echo '$(srcdir)/'`asm.S + +jfs_stage1_5_exec-asm.obj: asm.S + $(CCAS) $(jfs_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o jfs_stage1_5_exec-asm.obj `if test -f 'asm.S'; then $(CYGPATH_W) 'asm.S'; else $(CYGPATH_W) '$(srcdir)/asm.S'; fi` + +minix_stage1_5_exec-start.o: start.S + $(CCAS) $(minix_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o minix_stage1_5_exec-start.o `test -f 'start.S' || echo '$(srcdir)/'`start.S + +minix_stage1_5_exec-start.obj: start.S + $(CCAS) $(minix_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o minix_stage1_5_exec-start.obj `if test -f 'start.S'; then $(CYGPATH_W) 'start.S'; else $(CYGPATH_W) '$(srcdir)/start.S'; fi` + +minix_stage1_5_exec-asm.o: asm.S + $(CCAS) $(minix_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o minix_stage1_5_exec-asm.o `test -f 'asm.S' || echo '$(srcdir)/'`asm.S + +minix_stage1_5_exec-asm.obj: asm.S + $(CCAS) $(minix_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o minix_stage1_5_exec-asm.obj `if test -f 'asm.S'; then $(CYGPATH_W) 'asm.S'; else $(CYGPATH_W) '$(srcdir)/asm.S'; fi` + +nbloader_exec-nbloader.o: nbloader.S + $(CCAS) $(nbloader_exec_CCASFLAGS) $(CCASFLAGS) -c -o nbloader_exec-nbloader.o `test -f 'nbloader.S' || echo '$(srcdir)/'`nbloader.S + +nbloader_exec-nbloader.obj: nbloader.S + $(CCAS) $(nbloader_exec_CCASFLAGS) $(CCASFLAGS) -c -o nbloader_exec-nbloader.obj `if test -f 'nbloader.S'; then $(CYGPATH_W) 'nbloader.S'; else $(CYGPATH_W) '$(srcdir)/nbloader.S'; fi` + +pre_stage2_exec-asm.o: asm.S + $(CCAS) $(pre_stage2_exec_CCASFLAGS) $(CCASFLAGS) -c -o pre_stage2_exec-asm.o `test -f 'asm.S' || echo '$(srcdir)/'`asm.S + +pre_stage2_exec-asm.obj: asm.S + $(CCAS) $(pre_stage2_exec_CCASFLAGS) $(CCASFLAGS) -c -o pre_stage2_exec-asm.obj `if test -f 'asm.S'; then $(CYGPATH_W) 'asm.S'; else $(CYGPATH_W) '$(srcdir)/asm.S'; fi` + +pxeloader_exec-pxeloader.o: pxeloader.S + $(CCAS) $(pxeloader_exec_CCASFLAGS) $(CCASFLAGS) -c -o pxeloader_exec-pxeloader.o `test -f 'pxeloader.S' || echo '$(srcdir)/'`pxeloader.S + +pxeloader_exec-pxeloader.obj: pxeloader.S + $(CCAS) $(pxeloader_exec_CCASFLAGS) $(CCASFLAGS) -c -o pxeloader_exec-pxeloader.obj `if test -f 'pxeloader.S'; then $(CYGPATH_W) 'pxeloader.S'; else $(CYGPATH_W) '$(srcdir)/pxeloader.S'; fi` + +reiserfs_stage1_5_exec-start.o: start.S + $(CCAS) $(reiserfs_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o reiserfs_stage1_5_exec-start.o `test -f 'start.S' || echo '$(srcdir)/'`start.S + +reiserfs_stage1_5_exec-start.obj: start.S + $(CCAS) $(reiserfs_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o reiserfs_stage1_5_exec-start.obj `if test -f 'start.S'; then $(CYGPATH_W) 'start.S'; else $(CYGPATH_W) '$(srcdir)/start.S'; fi` + +reiserfs_stage1_5_exec-asm.o: asm.S + $(CCAS) $(reiserfs_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o reiserfs_stage1_5_exec-asm.o `test -f 'asm.S' || echo '$(srcdir)/'`asm.S + +reiserfs_stage1_5_exec-asm.obj: asm.S + $(CCAS) $(reiserfs_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o reiserfs_stage1_5_exec-asm.obj `if test -f 'asm.S'; then $(CYGPATH_W) 'asm.S'; else $(CYGPATH_W) '$(srcdir)/asm.S'; fi` + +start_exec-start.o: start.S + $(CCAS) $(start_exec_CCASFLAGS) $(CCASFLAGS) -c -o start_exec-start.o `test -f 'start.S' || echo '$(srcdir)/'`start.S + +start_exec-start.obj: start.S + $(CCAS) $(start_exec_CCASFLAGS) $(CCASFLAGS) -c -o start_exec-start.obj `if test -f 'start.S'; then $(CYGPATH_W) 'start.S'; else $(CYGPATH_W) '$(srcdir)/start.S'; fi` + +start_eltorito_exec-start_eltorito.o: start_eltorito.S + $(CCAS) $(start_eltorito_exec_CCASFLAGS) $(CCASFLAGS) -c -o start_eltorito_exec-start_eltorito.o `test -f 'start_eltorito.S' || echo '$(srcdir)/'`start_eltorito.S + +start_eltorito_exec-start_eltorito.obj: start_eltorito.S + $(CCAS) $(start_eltorito_exec_CCASFLAGS) $(CCASFLAGS) -c -o start_eltorito_exec-start_eltorito.obj `if test -f 'start_eltorito.S'; then $(CYGPATH_W) 'start_eltorito.S'; else $(CYGPATH_W) '$(srcdir)/start_eltorito.S'; fi` + +ufs2_stage1_5_exec-start.o: start.S + $(CCAS) $(ufs2_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o ufs2_stage1_5_exec-start.o `test -f 'start.S' || echo '$(srcdir)/'`start.S + +ufs2_stage1_5_exec-start.obj: start.S + $(CCAS) $(ufs2_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o ufs2_stage1_5_exec-start.obj `if test -f 'start.S'; then $(CYGPATH_W) 'start.S'; else $(CYGPATH_W) '$(srcdir)/start.S'; fi` + +ufs2_stage1_5_exec-asm.o: asm.S + $(CCAS) $(ufs2_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o ufs2_stage1_5_exec-asm.o `test -f 'asm.S' || echo '$(srcdir)/'`asm.S + +ufs2_stage1_5_exec-asm.obj: asm.S + $(CCAS) $(ufs2_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o ufs2_stage1_5_exec-asm.obj `if test -f 'asm.S'; then $(CYGPATH_W) 'asm.S'; else $(CYGPATH_W) '$(srcdir)/asm.S'; fi` + +ufs_stage1_5_exec-start.o: start.S + $(CCAS) $(ufs_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o ufs_stage1_5_exec-start.o `test -f 'start.S' || echo '$(srcdir)/'`start.S + +ufs_stage1_5_exec-start.obj: start.S + $(CCAS) $(ufs_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o ufs_stage1_5_exec-start.obj `if test -f 'start.S'; then $(CYGPATH_W) 'start.S'; else $(CYGPATH_W) '$(srcdir)/start.S'; fi` + +ufs_stage1_5_exec-asm.o: asm.S + $(CCAS) $(ufs_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o ufs_stage1_5_exec-asm.o `test -f 'asm.S' || echo '$(srcdir)/'`asm.S + +ufs_stage1_5_exec-asm.obj: asm.S + $(CCAS) $(ufs_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o ufs_stage1_5_exec-asm.obj `if test -f 'asm.S'; then $(CYGPATH_W) 'asm.S'; else $(CYGPATH_W) '$(srcdir)/asm.S'; fi` + +zfs_stage1_5_exec-start.o: start.S + $(CCAS) $(zfs_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o zfs_stage1_5_exec-start.o `test -f 'start.S' || echo '$(srcdir)/'`start.S + +zfs_stage1_5_exec-start.obj: start.S + $(CCAS) $(zfs_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o zfs_stage1_5_exec-start.obj `if test -f 'start.S'; then $(CYGPATH_W) 'start.S'; else $(CYGPATH_W) '$(srcdir)/start.S'; fi` + +zfs_stage1_5_exec-asm.o: asm.S + $(CCAS) $(zfs_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o zfs_stage1_5_exec-asm.o `test -f 'asm.S' || echo '$(srcdir)/'`asm.S + +zfs_stage1_5_exec-asm.obj: asm.S + $(CCAS) $(zfs_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o zfs_stage1_5_exec-asm.obj `if test -f 'asm.S'; then $(CYGPATH_W) 'asm.S'; else $(CYGPATH_W) '$(srcdir)/asm.S'; fi` + +vstafs_stage1_5_exec-start.o: start.S + $(CCAS) $(vstafs_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o vstafs_stage1_5_exec-start.o `test -f 'start.S' || echo '$(srcdir)/'`start.S + +vstafs_stage1_5_exec-start.obj: start.S + $(CCAS) $(vstafs_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o vstafs_stage1_5_exec-start.obj `if test -f 'start.S'; then $(CYGPATH_W) 'start.S'; else $(CYGPATH_W) '$(srcdir)/start.S'; fi` + +vstafs_stage1_5_exec-asm.o: asm.S + $(CCAS) $(vstafs_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o vstafs_stage1_5_exec-asm.o `test -f 'asm.S' || echo '$(srcdir)/'`asm.S + +vstafs_stage1_5_exec-asm.obj: asm.S + $(CCAS) $(vstafs_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o vstafs_stage1_5_exec-asm.obj `if test -f 'asm.S'; then $(CYGPATH_W) 'asm.S'; else $(CYGPATH_W) '$(srcdir)/asm.S'; fi` + +xfs_stage1_5_exec-start.o: start.S + $(CCAS) $(xfs_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o xfs_stage1_5_exec-start.o `test -f 'start.S' || echo '$(srcdir)/'`start.S + +xfs_stage1_5_exec-start.obj: start.S + $(CCAS) $(xfs_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o xfs_stage1_5_exec-start.obj `if test -f 'start.S'; then $(CYGPATH_W) 'start.S'; else $(CYGPATH_W) '$(srcdir)/start.S'; fi` + +xfs_stage1_5_exec-asm.o: asm.S + $(CCAS) $(xfs_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o xfs_stage1_5_exec-asm.o `test -f 'asm.S' || echo '$(srcdir)/'`asm.S + +xfs_stage1_5_exec-asm.obj: asm.S + $(CCAS) $(xfs_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o xfs_stage1_5_exec-asm.obj `if test -f 'asm.S'; then $(CYGPATH_W) 'asm.S'; else $(CYGPATH_W) '$(srcdir)/asm.S'; fi` + +.c.o: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +libgrub_a-boot.o: boot.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-boot.o -MD -MP -MF "$(DEPDIR)/libgrub_a-boot.Tpo" -c -o libgrub_a-boot.o `test -f 'boot.c' || echo '$(srcdir)/'`boot.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-boot.Tpo" "$(DEPDIR)/libgrub_a-boot.Po"; else rm -f "$(DEPDIR)/libgrub_a-boot.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='boot.c' object='libgrub_a-boot.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-boot.o `test -f 'boot.c' || echo '$(srcdir)/'`boot.c + +libgrub_a-boot.obj: boot.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-boot.obj -MD -MP -MF "$(DEPDIR)/libgrub_a-boot.Tpo" -c -o libgrub_a-boot.obj `if test -f 'boot.c'; then $(CYGPATH_W) 'boot.c'; else $(CYGPATH_W) '$(srcdir)/boot.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-boot.Tpo" "$(DEPDIR)/libgrub_a-boot.Po"; else rm -f "$(DEPDIR)/libgrub_a-boot.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='boot.c' object='libgrub_a-boot.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-boot.obj `if test -f 'boot.c'; then $(CYGPATH_W) 'boot.c'; else $(CYGPATH_W) '$(srcdir)/boot.c'; fi` + +libgrub_a-builtins.o: builtins.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-builtins.o -MD -MP -MF "$(DEPDIR)/libgrub_a-builtins.Tpo" -c -o libgrub_a-builtins.o `test -f 'builtins.c' || echo '$(srcdir)/'`builtins.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-builtins.Tpo" "$(DEPDIR)/libgrub_a-builtins.Po"; else rm -f "$(DEPDIR)/libgrub_a-builtins.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='builtins.c' object='libgrub_a-builtins.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-builtins.o `test -f 'builtins.c' || echo '$(srcdir)/'`builtins.c + +libgrub_a-builtins.obj: builtins.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-builtins.obj -MD -MP -MF "$(DEPDIR)/libgrub_a-builtins.Tpo" -c -o libgrub_a-builtins.obj `if test -f 'builtins.c'; then $(CYGPATH_W) 'builtins.c'; else $(CYGPATH_W) '$(srcdir)/builtins.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-builtins.Tpo" "$(DEPDIR)/libgrub_a-builtins.Po"; else rm -f "$(DEPDIR)/libgrub_a-builtins.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='builtins.c' object='libgrub_a-builtins.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-builtins.obj `if test -f 'builtins.c'; then $(CYGPATH_W) 'builtins.c'; else $(CYGPATH_W) '$(srcdir)/builtins.c'; fi` + +libgrub_a-char_io.o: char_io.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-char_io.o -MD -MP -MF "$(DEPDIR)/libgrub_a-char_io.Tpo" -c -o libgrub_a-char_io.o `test -f 'char_io.c' || echo '$(srcdir)/'`char_io.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-char_io.Tpo" "$(DEPDIR)/libgrub_a-char_io.Po"; else rm -f "$(DEPDIR)/libgrub_a-char_io.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='char_io.c' object='libgrub_a-char_io.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-char_io.o `test -f 'char_io.c' || echo '$(srcdir)/'`char_io.c + +libgrub_a-char_io.obj: char_io.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-char_io.obj -MD -MP -MF "$(DEPDIR)/libgrub_a-char_io.Tpo" -c -o libgrub_a-char_io.obj `if test -f 'char_io.c'; then $(CYGPATH_W) 'char_io.c'; else $(CYGPATH_W) '$(srcdir)/char_io.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-char_io.Tpo" "$(DEPDIR)/libgrub_a-char_io.Po"; else rm -f "$(DEPDIR)/libgrub_a-char_io.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='char_io.c' object='libgrub_a-char_io.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-char_io.obj `if test -f 'char_io.c'; then $(CYGPATH_W) 'char_io.c'; else $(CYGPATH_W) '$(srcdir)/char_io.c'; fi` + +libgrub_a-cmdline.o: cmdline.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-cmdline.o -MD -MP -MF "$(DEPDIR)/libgrub_a-cmdline.Tpo" -c -o libgrub_a-cmdline.o `test -f 'cmdline.c' || echo '$(srcdir)/'`cmdline.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-cmdline.Tpo" "$(DEPDIR)/libgrub_a-cmdline.Po"; else rm -f "$(DEPDIR)/libgrub_a-cmdline.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cmdline.c' object='libgrub_a-cmdline.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-cmdline.o `test -f 'cmdline.c' || echo '$(srcdir)/'`cmdline.c + +libgrub_a-cmdline.obj: cmdline.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-cmdline.obj -MD -MP -MF "$(DEPDIR)/libgrub_a-cmdline.Tpo" -c -o libgrub_a-cmdline.obj `if test -f 'cmdline.c'; then $(CYGPATH_W) 'cmdline.c'; else $(CYGPATH_W) '$(srcdir)/cmdline.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-cmdline.Tpo" "$(DEPDIR)/libgrub_a-cmdline.Po"; else rm -f "$(DEPDIR)/libgrub_a-cmdline.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cmdline.c' object='libgrub_a-cmdline.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-cmdline.obj `if test -f 'cmdline.c'; then $(CYGPATH_W) 'cmdline.c'; else $(CYGPATH_W) '$(srcdir)/cmdline.c'; fi` + +libgrub_a-common.o: common.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-common.o -MD -MP -MF "$(DEPDIR)/libgrub_a-common.Tpo" -c -o libgrub_a-common.o `test -f 'common.c' || echo '$(srcdir)/'`common.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-common.Tpo" "$(DEPDIR)/libgrub_a-common.Po"; else rm -f "$(DEPDIR)/libgrub_a-common.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='common.c' object='libgrub_a-common.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-common.o `test -f 'common.c' || echo '$(srcdir)/'`common.c + +libgrub_a-common.obj: common.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-common.obj -MD -MP -MF "$(DEPDIR)/libgrub_a-common.Tpo" -c -o libgrub_a-common.obj `if test -f 'common.c'; then $(CYGPATH_W) 'common.c'; else $(CYGPATH_W) '$(srcdir)/common.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-common.Tpo" "$(DEPDIR)/libgrub_a-common.Po"; else rm -f "$(DEPDIR)/libgrub_a-common.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='common.c' object='libgrub_a-common.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-common.obj `if test -f 'common.c'; then $(CYGPATH_W) 'common.c'; else $(CYGPATH_W) '$(srcdir)/common.c'; fi` + +libgrub_a-disk_io.o: disk_io.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-disk_io.o -MD -MP -MF "$(DEPDIR)/libgrub_a-disk_io.Tpo" -c -o libgrub_a-disk_io.o `test -f 'disk_io.c' || echo '$(srcdir)/'`disk_io.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-disk_io.Tpo" "$(DEPDIR)/libgrub_a-disk_io.Po"; else rm -f "$(DEPDIR)/libgrub_a-disk_io.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='disk_io.c' object='libgrub_a-disk_io.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-disk_io.o `test -f 'disk_io.c' || echo '$(srcdir)/'`disk_io.c + +libgrub_a-disk_io.obj: disk_io.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-disk_io.obj -MD -MP -MF "$(DEPDIR)/libgrub_a-disk_io.Tpo" -c -o libgrub_a-disk_io.obj `if test -f 'disk_io.c'; then $(CYGPATH_W) 'disk_io.c'; else $(CYGPATH_W) '$(srcdir)/disk_io.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-disk_io.Tpo" "$(DEPDIR)/libgrub_a-disk_io.Po"; else rm -f "$(DEPDIR)/libgrub_a-disk_io.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='disk_io.c' object='libgrub_a-disk_io.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-disk_io.obj `if test -f 'disk_io.c'; then $(CYGPATH_W) 'disk_io.c'; else $(CYGPATH_W) '$(srcdir)/disk_io.c'; fi` + +libgrub_a-fsys_ext2fs.o: fsys_ext2fs.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-fsys_ext2fs.o -MD -MP -MF "$(DEPDIR)/libgrub_a-fsys_ext2fs.Tpo" -c -o libgrub_a-fsys_ext2fs.o `test -f 'fsys_ext2fs.c' || echo '$(srcdir)/'`fsys_ext2fs.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-fsys_ext2fs.Tpo" "$(DEPDIR)/libgrub_a-fsys_ext2fs.Po"; else rm -f "$(DEPDIR)/libgrub_a-fsys_ext2fs.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_ext2fs.c' object='libgrub_a-fsys_ext2fs.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-fsys_ext2fs.o `test -f 'fsys_ext2fs.c' || echo '$(srcdir)/'`fsys_ext2fs.c + +libgrub_a-fsys_ext2fs.obj: fsys_ext2fs.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-fsys_ext2fs.obj -MD -MP -MF "$(DEPDIR)/libgrub_a-fsys_ext2fs.Tpo" -c -o libgrub_a-fsys_ext2fs.obj `if test -f 'fsys_ext2fs.c'; then $(CYGPATH_W) 'fsys_ext2fs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_ext2fs.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-fsys_ext2fs.Tpo" "$(DEPDIR)/libgrub_a-fsys_ext2fs.Po"; else rm -f "$(DEPDIR)/libgrub_a-fsys_ext2fs.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_ext2fs.c' object='libgrub_a-fsys_ext2fs.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-fsys_ext2fs.obj `if test -f 'fsys_ext2fs.c'; then $(CYGPATH_W) 'fsys_ext2fs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_ext2fs.c'; fi` + +libgrub_a-fsys_fat.o: fsys_fat.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-fsys_fat.o -MD -MP -MF "$(DEPDIR)/libgrub_a-fsys_fat.Tpo" -c -o libgrub_a-fsys_fat.o `test -f 'fsys_fat.c' || echo '$(srcdir)/'`fsys_fat.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-fsys_fat.Tpo" "$(DEPDIR)/libgrub_a-fsys_fat.Po"; else rm -f "$(DEPDIR)/libgrub_a-fsys_fat.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_fat.c' object='libgrub_a-fsys_fat.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-fsys_fat.o `test -f 'fsys_fat.c' || echo '$(srcdir)/'`fsys_fat.c + +libgrub_a-fsys_fat.obj: fsys_fat.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-fsys_fat.obj -MD -MP -MF "$(DEPDIR)/libgrub_a-fsys_fat.Tpo" -c -o libgrub_a-fsys_fat.obj `if test -f 'fsys_fat.c'; then $(CYGPATH_W) 'fsys_fat.c'; else $(CYGPATH_W) '$(srcdir)/fsys_fat.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-fsys_fat.Tpo" "$(DEPDIR)/libgrub_a-fsys_fat.Po"; else rm -f "$(DEPDIR)/libgrub_a-fsys_fat.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_fat.c' object='libgrub_a-fsys_fat.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-fsys_fat.obj `if test -f 'fsys_fat.c'; then $(CYGPATH_W) 'fsys_fat.c'; else $(CYGPATH_W) '$(srcdir)/fsys_fat.c'; fi` + +libgrub_a-fsys_ffs.o: fsys_ffs.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-fsys_ffs.o -MD -MP -MF "$(DEPDIR)/libgrub_a-fsys_ffs.Tpo" -c -o libgrub_a-fsys_ffs.o `test -f 'fsys_ffs.c' || echo '$(srcdir)/'`fsys_ffs.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-fsys_ffs.Tpo" "$(DEPDIR)/libgrub_a-fsys_ffs.Po"; else rm -f "$(DEPDIR)/libgrub_a-fsys_ffs.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_ffs.c' object='libgrub_a-fsys_ffs.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-fsys_ffs.o `test -f 'fsys_ffs.c' || echo '$(srcdir)/'`fsys_ffs.c + +libgrub_a-fsys_ffs.obj: fsys_ffs.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-fsys_ffs.obj -MD -MP -MF "$(DEPDIR)/libgrub_a-fsys_ffs.Tpo" -c -o libgrub_a-fsys_ffs.obj `if test -f 'fsys_ffs.c'; then $(CYGPATH_W) 'fsys_ffs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_ffs.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-fsys_ffs.Tpo" "$(DEPDIR)/libgrub_a-fsys_ffs.Po"; else rm -f "$(DEPDIR)/libgrub_a-fsys_ffs.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_ffs.c' object='libgrub_a-fsys_ffs.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-fsys_ffs.obj `if test -f 'fsys_ffs.c'; then $(CYGPATH_W) 'fsys_ffs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_ffs.c'; fi` + +libgrub_a-fsys_iso9660.o: fsys_iso9660.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-fsys_iso9660.o -MD -MP -MF "$(DEPDIR)/libgrub_a-fsys_iso9660.Tpo" -c -o libgrub_a-fsys_iso9660.o `test -f 'fsys_iso9660.c' || echo '$(srcdir)/'`fsys_iso9660.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-fsys_iso9660.Tpo" "$(DEPDIR)/libgrub_a-fsys_iso9660.Po"; else rm -f "$(DEPDIR)/libgrub_a-fsys_iso9660.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_iso9660.c' object='libgrub_a-fsys_iso9660.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-fsys_iso9660.o `test -f 'fsys_iso9660.c' || echo '$(srcdir)/'`fsys_iso9660.c + +libgrub_a-fsys_iso9660.obj: fsys_iso9660.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-fsys_iso9660.obj -MD -MP -MF "$(DEPDIR)/libgrub_a-fsys_iso9660.Tpo" -c -o libgrub_a-fsys_iso9660.obj `if test -f 'fsys_iso9660.c'; then $(CYGPATH_W) 'fsys_iso9660.c'; else $(CYGPATH_W) '$(srcdir)/fsys_iso9660.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-fsys_iso9660.Tpo" "$(DEPDIR)/libgrub_a-fsys_iso9660.Po"; else rm -f "$(DEPDIR)/libgrub_a-fsys_iso9660.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_iso9660.c' object='libgrub_a-fsys_iso9660.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-fsys_iso9660.obj `if test -f 'fsys_iso9660.c'; then $(CYGPATH_W) 'fsys_iso9660.c'; else $(CYGPATH_W) '$(srcdir)/fsys_iso9660.c'; fi` + +libgrub_a-fsys_jfs.o: fsys_jfs.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-fsys_jfs.o -MD -MP -MF "$(DEPDIR)/libgrub_a-fsys_jfs.Tpo" -c -o libgrub_a-fsys_jfs.o `test -f 'fsys_jfs.c' || echo '$(srcdir)/'`fsys_jfs.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-fsys_jfs.Tpo" "$(DEPDIR)/libgrub_a-fsys_jfs.Po"; else rm -f "$(DEPDIR)/libgrub_a-fsys_jfs.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_jfs.c' object='libgrub_a-fsys_jfs.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-fsys_jfs.o `test -f 'fsys_jfs.c' || echo '$(srcdir)/'`fsys_jfs.c + +libgrub_a-fsys_jfs.obj: fsys_jfs.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-fsys_jfs.obj -MD -MP -MF "$(DEPDIR)/libgrub_a-fsys_jfs.Tpo" -c -o libgrub_a-fsys_jfs.obj `if test -f 'fsys_jfs.c'; then $(CYGPATH_W) 'fsys_jfs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_jfs.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-fsys_jfs.Tpo" "$(DEPDIR)/libgrub_a-fsys_jfs.Po"; else rm -f "$(DEPDIR)/libgrub_a-fsys_jfs.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_jfs.c' object='libgrub_a-fsys_jfs.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-fsys_jfs.obj `if test -f 'fsys_jfs.c'; then $(CYGPATH_W) 'fsys_jfs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_jfs.c'; fi` + +libgrub_a-fsys_minix.o: fsys_minix.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-fsys_minix.o -MD -MP -MF "$(DEPDIR)/libgrub_a-fsys_minix.Tpo" -c -o libgrub_a-fsys_minix.o `test -f 'fsys_minix.c' || echo '$(srcdir)/'`fsys_minix.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-fsys_minix.Tpo" "$(DEPDIR)/libgrub_a-fsys_minix.Po"; else rm -f "$(DEPDIR)/libgrub_a-fsys_minix.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_minix.c' object='libgrub_a-fsys_minix.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-fsys_minix.o `test -f 'fsys_minix.c' || echo '$(srcdir)/'`fsys_minix.c + +libgrub_a-fsys_minix.obj: fsys_minix.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-fsys_minix.obj -MD -MP -MF "$(DEPDIR)/libgrub_a-fsys_minix.Tpo" -c -o libgrub_a-fsys_minix.obj `if test -f 'fsys_minix.c'; then $(CYGPATH_W) 'fsys_minix.c'; else $(CYGPATH_W) '$(srcdir)/fsys_minix.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-fsys_minix.Tpo" "$(DEPDIR)/libgrub_a-fsys_minix.Po"; else rm -f "$(DEPDIR)/libgrub_a-fsys_minix.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_minix.c' object='libgrub_a-fsys_minix.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-fsys_minix.obj `if test -f 'fsys_minix.c'; then $(CYGPATH_W) 'fsys_minix.c'; else $(CYGPATH_W) '$(srcdir)/fsys_minix.c'; fi` + +libgrub_a-fsys_reiserfs.o: fsys_reiserfs.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-fsys_reiserfs.o -MD -MP -MF "$(DEPDIR)/libgrub_a-fsys_reiserfs.Tpo" -c -o libgrub_a-fsys_reiserfs.o `test -f 'fsys_reiserfs.c' || echo '$(srcdir)/'`fsys_reiserfs.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-fsys_reiserfs.Tpo" "$(DEPDIR)/libgrub_a-fsys_reiserfs.Po"; else rm -f "$(DEPDIR)/libgrub_a-fsys_reiserfs.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_reiserfs.c' object='libgrub_a-fsys_reiserfs.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-fsys_reiserfs.o `test -f 'fsys_reiserfs.c' || echo '$(srcdir)/'`fsys_reiserfs.c + +libgrub_a-fsys_reiserfs.obj: fsys_reiserfs.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-fsys_reiserfs.obj -MD -MP -MF "$(DEPDIR)/libgrub_a-fsys_reiserfs.Tpo" -c -o libgrub_a-fsys_reiserfs.obj `if test -f 'fsys_reiserfs.c'; then $(CYGPATH_W) 'fsys_reiserfs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_reiserfs.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-fsys_reiserfs.Tpo" "$(DEPDIR)/libgrub_a-fsys_reiserfs.Po"; else rm -f "$(DEPDIR)/libgrub_a-fsys_reiserfs.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_reiserfs.c' object='libgrub_a-fsys_reiserfs.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-fsys_reiserfs.obj `if test -f 'fsys_reiserfs.c'; then $(CYGPATH_W) 'fsys_reiserfs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_reiserfs.c'; fi` + +libgrub_a-zfs_sha256.o: zfs_sha256.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-zfs_sha256.o -MD -MP -MF "$(DEPDIR)/libgrub_a-zfs_sha256.Tpo" -c -o libgrub_a-zfs_sha256.o `test -f 'zfs_sha256.c' || echo '$(srcdir)/'`zfs_sha256.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-zfs_sha256.Tpo" "$(DEPDIR)/libgrub_a-zfs_sha256.Po"; else rm -f "$(DEPDIR)/libgrub_a-zfs_sha256.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='zfs_sha256.c' object='libgrub_a-zfs_sha256.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-zfs_sha256.o `test -f 'zfs_sha256.c' || echo '$(srcdir)/'`zfs_sha256.c + +libgrub_a-zfs_sha256.obj: zfs_sha256.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-zfs_sha256.obj -MD -MP -MF "$(DEPDIR)/libgrub_a-zfs_sha256.Tpo" -c -o libgrub_a-zfs_sha256.obj `if test -f 'zfs_sha256.c'; then $(CYGPATH_W) 'zfs_sha256.c'; else $(CYGPATH_W) '$(srcdir)/zfs_sha256.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-zfs_sha256.Tpo" "$(DEPDIR)/libgrub_a-zfs_sha256.Po"; else rm -f "$(DEPDIR)/libgrub_a-zfs_sha256.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='zfs_sha256.c' object='libgrub_a-zfs_sha256.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-zfs_sha256.obj `if test -f 'zfs_sha256.c'; then $(CYGPATH_W) 'zfs_sha256.c'; else $(CYGPATH_W) '$(srcdir)/zfs_sha256.c'; fi` + +libgrub_a-zfs_lzjb.o: zfs_lzjb.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-zfs_lzjb.o -MD -MP -MF "$(DEPDIR)/libgrub_a-zfs_lzjb.Tpo" -c -o libgrub_a-zfs_lzjb.o `test -f 'zfs_lzjb.c' || echo '$(srcdir)/'`zfs_lzjb.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-zfs_lzjb.Tpo" "$(DEPDIR)/libgrub_a-zfs_lzjb.Po"; else rm -f "$(DEPDIR)/libgrub_a-zfs_lzjb.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='zfs_lzjb.c' object='libgrub_a-zfs_lzjb.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-zfs_lzjb.o `test -f 'zfs_lzjb.c' || echo '$(srcdir)/'`zfs_lzjb.c + +libgrub_a-zfs_lzjb.obj: zfs_lzjb.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-zfs_lzjb.obj -MD -MP -MF "$(DEPDIR)/libgrub_a-zfs_lzjb.Tpo" -c -o libgrub_a-zfs_lzjb.obj `if test -f 'zfs_lzjb.c'; then $(CYGPATH_W) 'zfs_lzjb.c'; else $(CYGPATH_W) '$(srcdir)/zfs_lzjb.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-zfs_lzjb.Tpo" "$(DEPDIR)/libgrub_a-zfs_lzjb.Po"; else rm -f "$(DEPDIR)/libgrub_a-zfs_lzjb.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='zfs_lzjb.c' object='libgrub_a-zfs_lzjb.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-zfs_lzjb.obj `if test -f 'zfs_lzjb.c'; then $(CYGPATH_W) 'zfs_lzjb.c'; else $(CYGPATH_W) '$(srcdir)/zfs_lzjb.c'; fi` + +libgrub_a-zfs_fletcher.o: zfs_fletcher.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-zfs_fletcher.o -MD -MP -MF "$(DEPDIR)/libgrub_a-zfs_fletcher.Tpo" -c -o libgrub_a-zfs_fletcher.o `test -f 'zfs_fletcher.c' || echo '$(srcdir)/'`zfs_fletcher.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-zfs_fletcher.Tpo" "$(DEPDIR)/libgrub_a-zfs_fletcher.Po"; else rm -f "$(DEPDIR)/libgrub_a-zfs_fletcher.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='zfs_fletcher.c' object='libgrub_a-zfs_fletcher.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-zfs_fletcher.o `test -f 'zfs_fletcher.c' || echo '$(srcdir)/'`zfs_fletcher.c + +libgrub_a-zfs_fletcher.obj: zfs_fletcher.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-zfs_fletcher.obj -MD -MP -MF "$(DEPDIR)/libgrub_a-zfs_fletcher.Tpo" -c -o libgrub_a-zfs_fletcher.obj `if test -f 'zfs_fletcher.c'; then $(CYGPATH_W) 'zfs_fletcher.c'; else $(CYGPATH_W) '$(srcdir)/zfs_fletcher.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-zfs_fletcher.Tpo" "$(DEPDIR)/libgrub_a-zfs_fletcher.Po"; else rm -f "$(DEPDIR)/libgrub_a-zfs_fletcher.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='zfs_fletcher.c' object='libgrub_a-zfs_fletcher.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-zfs_fletcher.obj `if test -f 'zfs_fletcher.c'; then $(CYGPATH_W) 'zfs_fletcher.c'; else $(CYGPATH_W) '$(srcdir)/zfs_fletcher.c'; fi` + +libgrub_a-fsys_zfs.o: fsys_zfs.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-fsys_zfs.o -MD -MP -MF "$(DEPDIR)/libgrub_a-fsys_zfs.Tpo" -c -o libgrub_a-fsys_zfs.o `test -f 'fsys_zfs.c' || echo '$(srcdir)/'`fsys_zfs.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-fsys_zfs.Tpo" "$(DEPDIR)/libgrub_a-fsys_zfs.Po"; else rm -f "$(DEPDIR)/libgrub_a-fsys_zfs.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_zfs.c' object='libgrub_a-fsys_zfs.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-fsys_zfs.o `test -f 'fsys_zfs.c' || echo '$(srcdir)/'`fsys_zfs.c + +libgrub_a-fsys_zfs.obj: fsys_zfs.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-fsys_zfs.obj -MD -MP -MF "$(DEPDIR)/libgrub_a-fsys_zfs.Tpo" -c -o libgrub_a-fsys_zfs.obj `if test -f 'fsys_zfs.c'; then $(CYGPATH_W) 'fsys_zfs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_zfs.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-fsys_zfs.Tpo" "$(DEPDIR)/libgrub_a-fsys_zfs.Po"; else rm -f "$(DEPDIR)/libgrub_a-fsys_zfs.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_zfs.c' object='libgrub_a-fsys_zfs.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-fsys_zfs.obj `if test -f 'fsys_zfs.c'; then $(CYGPATH_W) 'fsys_zfs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_zfs.c'; fi` + +libgrub_a-fsys_ufs.o: fsys_ufs.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-fsys_ufs.o -MD -MP -MF "$(DEPDIR)/libgrub_a-fsys_ufs.Tpo" -c -o libgrub_a-fsys_ufs.o `test -f 'fsys_ufs.c' || echo '$(srcdir)/'`fsys_ufs.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-fsys_ufs.Tpo" "$(DEPDIR)/libgrub_a-fsys_ufs.Po"; else rm -f "$(DEPDIR)/libgrub_a-fsys_ufs.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_ufs.c' object='libgrub_a-fsys_ufs.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-fsys_ufs.o `test -f 'fsys_ufs.c' || echo '$(srcdir)/'`fsys_ufs.c + +libgrub_a-fsys_ufs.obj: fsys_ufs.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-fsys_ufs.obj -MD -MP -MF "$(DEPDIR)/libgrub_a-fsys_ufs.Tpo" -c -o libgrub_a-fsys_ufs.obj `if test -f 'fsys_ufs.c'; then $(CYGPATH_W) 'fsys_ufs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_ufs.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-fsys_ufs.Tpo" "$(DEPDIR)/libgrub_a-fsys_ufs.Po"; else rm -f "$(DEPDIR)/libgrub_a-fsys_ufs.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_ufs.c' object='libgrub_a-fsys_ufs.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-fsys_ufs.obj `if test -f 'fsys_ufs.c'; then $(CYGPATH_W) 'fsys_ufs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_ufs.c'; fi` + +libgrub_a-fsys_ufs2.o: fsys_ufs2.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-fsys_ufs2.o -MD -MP -MF "$(DEPDIR)/libgrub_a-fsys_ufs2.Tpo" -c -o libgrub_a-fsys_ufs2.o `test -f 'fsys_ufs2.c' || echo '$(srcdir)/'`fsys_ufs2.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-fsys_ufs2.Tpo" "$(DEPDIR)/libgrub_a-fsys_ufs2.Po"; else rm -f "$(DEPDIR)/libgrub_a-fsys_ufs2.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_ufs2.c' object='libgrub_a-fsys_ufs2.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-fsys_ufs2.o `test -f 'fsys_ufs2.c' || echo '$(srcdir)/'`fsys_ufs2.c + +libgrub_a-fsys_ufs2.obj: fsys_ufs2.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-fsys_ufs2.obj -MD -MP -MF "$(DEPDIR)/libgrub_a-fsys_ufs2.Tpo" -c -o libgrub_a-fsys_ufs2.obj `if test -f 'fsys_ufs2.c'; then $(CYGPATH_W) 'fsys_ufs2.c'; else $(CYGPATH_W) '$(srcdir)/fsys_ufs2.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-fsys_ufs2.Tpo" "$(DEPDIR)/libgrub_a-fsys_ufs2.Po"; else rm -f "$(DEPDIR)/libgrub_a-fsys_ufs2.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_ufs2.c' object='libgrub_a-fsys_ufs2.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-fsys_ufs2.obj `if test -f 'fsys_ufs2.c'; then $(CYGPATH_W) 'fsys_ufs2.c'; else $(CYGPATH_W) '$(srcdir)/fsys_ufs2.c'; fi` + +libgrub_a-fsys_vstafs.o: fsys_vstafs.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-fsys_vstafs.o -MD -MP -MF "$(DEPDIR)/libgrub_a-fsys_vstafs.Tpo" -c -o libgrub_a-fsys_vstafs.o `test -f 'fsys_vstafs.c' || echo '$(srcdir)/'`fsys_vstafs.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-fsys_vstafs.Tpo" "$(DEPDIR)/libgrub_a-fsys_vstafs.Po"; else rm -f "$(DEPDIR)/libgrub_a-fsys_vstafs.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_vstafs.c' object='libgrub_a-fsys_vstafs.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-fsys_vstafs.o `test -f 'fsys_vstafs.c' || echo '$(srcdir)/'`fsys_vstafs.c + +libgrub_a-fsys_vstafs.obj: fsys_vstafs.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-fsys_vstafs.obj -MD -MP -MF "$(DEPDIR)/libgrub_a-fsys_vstafs.Tpo" -c -o libgrub_a-fsys_vstafs.obj `if test -f 'fsys_vstafs.c'; then $(CYGPATH_W) 'fsys_vstafs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_vstafs.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-fsys_vstafs.Tpo" "$(DEPDIR)/libgrub_a-fsys_vstafs.Po"; else rm -f "$(DEPDIR)/libgrub_a-fsys_vstafs.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_vstafs.c' object='libgrub_a-fsys_vstafs.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-fsys_vstafs.obj `if test -f 'fsys_vstafs.c'; then $(CYGPATH_W) 'fsys_vstafs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_vstafs.c'; fi` + +libgrub_a-fsys_xfs.o: fsys_xfs.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-fsys_xfs.o -MD -MP -MF "$(DEPDIR)/libgrub_a-fsys_xfs.Tpo" -c -o libgrub_a-fsys_xfs.o `test -f 'fsys_xfs.c' || echo '$(srcdir)/'`fsys_xfs.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-fsys_xfs.Tpo" "$(DEPDIR)/libgrub_a-fsys_xfs.Po"; else rm -f "$(DEPDIR)/libgrub_a-fsys_xfs.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_xfs.c' object='libgrub_a-fsys_xfs.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-fsys_xfs.o `test -f 'fsys_xfs.c' || echo '$(srcdir)/'`fsys_xfs.c + +libgrub_a-fsys_xfs.obj: fsys_xfs.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-fsys_xfs.obj -MD -MP -MF "$(DEPDIR)/libgrub_a-fsys_xfs.Tpo" -c -o libgrub_a-fsys_xfs.obj `if test -f 'fsys_xfs.c'; then $(CYGPATH_W) 'fsys_xfs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_xfs.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-fsys_xfs.Tpo" "$(DEPDIR)/libgrub_a-fsys_xfs.Po"; else rm -f "$(DEPDIR)/libgrub_a-fsys_xfs.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_xfs.c' object='libgrub_a-fsys_xfs.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-fsys_xfs.obj `if test -f 'fsys_xfs.c'; then $(CYGPATH_W) 'fsys_xfs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_xfs.c'; fi` + +libgrub_a-gunzip.o: gunzip.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-gunzip.o -MD -MP -MF "$(DEPDIR)/libgrub_a-gunzip.Tpo" -c -o libgrub_a-gunzip.o `test -f 'gunzip.c' || echo '$(srcdir)/'`gunzip.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-gunzip.Tpo" "$(DEPDIR)/libgrub_a-gunzip.Po"; else rm -f "$(DEPDIR)/libgrub_a-gunzip.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gunzip.c' object='libgrub_a-gunzip.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-gunzip.o `test -f 'gunzip.c' || echo '$(srcdir)/'`gunzip.c + +libgrub_a-gunzip.obj: gunzip.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-gunzip.obj -MD -MP -MF "$(DEPDIR)/libgrub_a-gunzip.Tpo" -c -o libgrub_a-gunzip.obj `if test -f 'gunzip.c'; then $(CYGPATH_W) 'gunzip.c'; else $(CYGPATH_W) '$(srcdir)/gunzip.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-gunzip.Tpo" "$(DEPDIR)/libgrub_a-gunzip.Po"; else rm -f "$(DEPDIR)/libgrub_a-gunzip.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gunzip.c' object='libgrub_a-gunzip.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-gunzip.obj `if test -f 'gunzip.c'; then $(CYGPATH_W) 'gunzip.c'; else $(CYGPATH_W) '$(srcdir)/gunzip.c'; fi` + +libgrub_a-md5.o: md5.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-md5.o -MD -MP -MF "$(DEPDIR)/libgrub_a-md5.Tpo" -c -o libgrub_a-md5.o `test -f 'md5.c' || echo '$(srcdir)/'`md5.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-md5.Tpo" "$(DEPDIR)/libgrub_a-md5.Po"; else rm -f "$(DEPDIR)/libgrub_a-md5.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='md5.c' object='libgrub_a-md5.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-md5.o `test -f 'md5.c' || echo '$(srcdir)/'`md5.c + +libgrub_a-md5.obj: md5.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-md5.obj -MD -MP -MF "$(DEPDIR)/libgrub_a-md5.Tpo" -c -o libgrub_a-md5.obj `if test -f 'md5.c'; then $(CYGPATH_W) 'md5.c'; else $(CYGPATH_W) '$(srcdir)/md5.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-md5.Tpo" "$(DEPDIR)/libgrub_a-md5.Po"; else rm -f "$(DEPDIR)/libgrub_a-md5.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='md5.c' object='libgrub_a-md5.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-md5.obj `if test -f 'md5.c'; then $(CYGPATH_W) 'md5.c'; else $(CYGPATH_W) '$(srcdir)/md5.c'; fi` + +libgrub_a-serial.o: serial.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-serial.o -MD -MP -MF "$(DEPDIR)/libgrub_a-serial.Tpo" -c -o libgrub_a-serial.o `test -f 'serial.c' || echo '$(srcdir)/'`serial.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-serial.Tpo" "$(DEPDIR)/libgrub_a-serial.Po"; else rm -f "$(DEPDIR)/libgrub_a-serial.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='serial.c' object='libgrub_a-serial.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-serial.o `test -f 'serial.c' || echo '$(srcdir)/'`serial.c + +libgrub_a-serial.obj: serial.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-serial.obj -MD -MP -MF "$(DEPDIR)/libgrub_a-serial.Tpo" -c -o libgrub_a-serial.obj `if test -f 'serial.c'; then $(CYGPATH_W) 'serial.c'; else $(CYGPATH_W) '$(srcdir)/serial.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-serial.Tpo" "$(DEPDIR)/libgrub_a-serial.Po"; else rm -f "$(DEPDIR)/libgrub_a-serial.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='serial.c' object='libgrub_a-serial.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-serial.obj `if test -f 'serial.c'; then $(CYGPATH_W) 'serial.c'; else $(CYGPATH_W) '$(srcdir)/serial.c'; fi` + +libgrub_a-stage2.o: stage2.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-stage2.o -MD -MP -MF "$(DEPDIR)/libgrub_a-stage2.Tpo" -c -o libgrub_a-stage2.o `test -f 'stage2.c' || echo '$(srcdir)/'`stage2.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-stage2.Tpo" "$(DEPDIR)/libgrub_a-stage2.Po"; else rm -f "$(DEPDIR)/libgrub_a-stage2.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='stage2.c' object='libgrub_a-stage2.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-stage2.o `test -f 'stage2.c' || echo '$(srcdir)/'`stage2.c + +libgrub_a-stage2.obj: stage2.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-stage2.obj -MD -MP -MF "$(DEPDIR)/libgrub_a-stage2.Tpo" -c -o libgrub_a-stage2.obj `if test -f 'stage2.c'; then $(CYGPATH_W) 'stage2.c'; else $(CYGPATH_W) '$(srcdir)/stage2.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-stage2.Tpo" "$(DEPDIR)/libgrub_a-stage2.Po"; else rm -f "$(DEPDIR)/libgrub_a-stage2.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='stage2.c' object='libgrub_a-stage2.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-stage2.obj `if test -f 'stage2.c'; then $(CYGPATH_W) 'stage2.c'; else $(CYGPATH_W) '$(srcdir)/stage2.c'; fi` + +libgrub_a-terminfo.o: terminfo.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-terminfo.o -MD -MP -MF "$(DEPDIR)/libgrub_a-terminfo.Tpo" -c -o libgrub_a-terminfo.o `test -f 'terminfo.c' || echo '$(srcdir)/'`terminfo.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-terminfo.Tpo" "$(DEPDIR)/libgrub_a-terminfo.Po"; else rm -f "$(DEPDIR)/libgrub_a-terminfo.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='terminfo.c' object='libgrub_a-terminfo.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-terminfo.o `test -f 'terminfo.c' || echo '$(srcdir)/'`terminfo.c + +libgrub_a-terminfo.obj: terminfo.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-terminfo.obj -MD -MP -MF "$(DEPDIR)/libgrub_a-terminfo.Tpo" -c -o libgrub_a-terminfo.obj `if test -f 'terminfo.c'; then $(CYGPATH_W) 'terminfo.c'; else $(CYGPATH_W) '$(srcdir)/terminfo.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-terminfo.Tpo" "$(DEPDIR)/libgrub_a-terminfo.Po"; else rm -f "$(DEPDIR)/libgrub_a-terminfo.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='terminfo.c' object='libgrub_a-terminfo.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-terminfo.obj `if test -f 'terminfo.c'; then $(CYGPATH_W) 'terminfo.c'; else $(CYGPATH_W) '$(srcdir)/terminfo.c'; fi` + +libgrub_a-tparm.o: tparm.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-tparm.o -MD -MP -MF "$(DEPDIR)/libgrub_a-tparm.Tpo" -c -o libgrub_a-tparm.o `test -f 'tparm.c' || echo '$(srcdir)/'`tparm.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-tparm.Tpo" "$(DEPDIR)/libgrub_a-tparm.Po"; else rm -f "$(DEPDIR)/libgrub_a-tparm.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tparm.c' object='libgrub_a-tparm.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-tparm.o `test -f 'tparm.c' || echo '$(srcdir)/'`tparm.c + +libgrub_a-tparm.obj: tparm.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-tparm.obj -MD -MP -MF "$(DEPDIR)/libgrub_a-tparm.Tpo" -c -o libgrub_a-tparm.obj `if test -f 'tparm.c'; then $(CYGPATH_W) 'tparm.c'; else $(CYGPATH_W) '$(srcdir)/tparm.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-tparm.Tpo" "$(DEPDIR)/libgrub_a-tparm.Po"; else rm -f "$(DEPDIR)/libgrub_a-tparm.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tparm.c' object='libgrub_a-tparm.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-tparm.obj `if test -f 'tparm.c'; then $(CYGPATH_W) 'tparm.c'; else $(CYGPATH_W) '$(srcdir)/tparm.c'; fi` + +libgrub_a-graphics.o: graphics.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-graphics.o -MD -MP -MF "$(DEPDIR)/libgrub_a-graphics.Tpo" -c -o libgrub_a-graphics.o `test -f 'graphics.c' || echo '$(srcdir)/'`graphics.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-graphics.Tpo" "$(DEPDIR)/libgrub_a-graphics.Po"; else rm -f "$(DEPDIR)/libgrub_a-graphics.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='graphics.c' object='libgrub_a-graphics.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-graphics.o `test -f 'graphics.c' || echo '$(srcdir)/'`graphics.c + +libgrub_a-graphics.obj: graphics.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-graphics.obj -MD -MP -MF "$(DEPDIR)/libgrub_a-graphics.Tpo" -c -o libgrub_a-graphics.obj `if test -f 'graphics.c'; then $(CYGPATH_W) 'graphics.c'; else $(CYGPATH_W) '$(srcdir)/graphics.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgrub_a-graphics.Tpo" "$(DEPDIR)/libgrub_a-graphics.Po"; else rm -f "$(DEPDIR)/libgrub_a-graphics.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='graphics.c' object='libgrub_a-graphics.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-graphics.obj `if test -f 'graphics.c'; then $(CYGPATH_W) 'graphics.c'; else $(CYGPATH_W) '$(srcdir)/graphics.c'; fi` + +diskless_exec-bios.o: bios.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-bios.o -MD -MP -MF "$(DEPDIR)/diskless_exec-bios.Tpo" -c -o diskless_exec-bios.o `test -f 'bios.c' || echo '$(srcdir)/'`bios.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-bios.Tpo" "$(DEPDIR)/diskless_exec-bios.Po"; else rm -f "$(DEPDIR)/diskless_exec-bios.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bios.c' object='diskless_exec-bios.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-bios.o `test -f 'bios.c' || echo '$(srcdir)/'`bios.c + +diskless_exec-bios.obj: bios.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-bios.obj -MD -MP -MF "$(DEPDIR)/diskless_exec-bios.Tpo" -c -o diskless_exec-bios.obj `if test -f 'bios.c'; then $(CYGPATH_W) 'bios.c'; else $(CYGPATH_W) '$(srcdir)/bios.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-bios.Tpo" "$(DEPDIR)/diskless_exec-bios.Po"; else rm -f "$(DEPDIR)/diskless_exec-bios.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bios.c' object='diskless_exec-bios.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-bios.obj `if test -f 'bios.c'; then $(CYGPATH_W) 'bios.c'; else $(CYGPATH_W) '$(srcdir)/bios.c'; fi` + +diskless_exec-boot.o: boot.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-boot.o -MD -MP -MF "$(DEPDIR)/diskless_exec-boot.Tpo" -c -o diskless_exec-boot.o `test -f 'boot.c' || echo '$(srcdir)/'`boot.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-boot.Tpo" "$(DEPDIR)/diskless_exec-boot.Po"; else rm -f "$(DEPDIR)/diskless_exec-boot.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='boot.c' object='diskless_exec-boot.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-boot.o `test -f 'boot.c' || echo '$(srcdir)/'`boot.c + +diskless_exec-boot.obj: boot.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-boot.obj -MD -MP -MF "$(DEPDIR)/diskless_exec-boot.Tpo" -c -o diskless_exec-boot.obj `if test -f 'boot.c'; then $(CYGPATH_W) 'boot.c'; else $(CYGPATH_W) '$(srcdir)/boot.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-boot.Tpo" "$(DEPDIR)/diskless_exec-boot.Po"; else rm -f "$(DEPDIR)/diskless_exec-boot.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='boot.c' object='diskless_exec-boot.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-boot.obj `if test -f 'boot.c'; then $(CYGPATH_W) 'boot.c'; else $(CYGPATH_W) '$(srcdir)/boot.c'; fi` + +diskless_exec-builtins.o: builtins.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-builtins.o -MD -MP -MF "$(DEPDIR)/diskless_exec-builtins.Tpo" -c -o diskless_exec-builtins.o `test -f 'builtins.c' || echo '$(srcdir)/'`builtins.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-builtins.Tpo" "$(DEPDIR)/diskless_exec-builtins.Po"; else rm -f "$(DEPDIR)/diskless_exec-builtins.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='builtins.c' object='diskless_exec-builtins.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-builtins.o `test -f 'builtins.c' || echo '$(srcdir)/'`builtins.c + +diskless_exec-builtins.obj: builtins.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-builtins.obj -MD -MP -MF "$(DEPDIR)/diskless_exec-builtins.Tpo" -c -o diskless_exec-builtins.obj `if test -f 'builtins.c'; then $(CYGPATH_W) 'builtins.c'; else $(CYGPATH_W) '$(srcdir)/builtins.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-builtins.Tpo" "$(DEPDIR)/diskless_exec-builtins.Po"; else rm -f "$(DEPDIR)/diskless_exec-builtins.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='builtins.c' object='diskless_exec-builtins.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-builtins.obj `if test -f 'builtins.c'; then $(CYGPATH_W) 'builtins.c'; else $(CYGPATH_W) '$(srcdir)/builtins.c'; fi` + +diskless_exec-char_io.o: char_io.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-char_io.o -MD -MP -MF "$(DEPDIR)/diskless_exec-char_io.Tpo" -c -o diskless_exec-char_io.o `test -f 'char_io.c' || echo '$(srcdir)/'`char_io.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-char_io.Tpo" "$(DEPDIR)/diskless_exec-char_io.Po"; else rm -f "$(DEPDIR)/diskless_exec-char_io.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='char_io.c' object='diskless_exec-char_io.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-char_io.o `test -f 'char_io.c' || echo '$(srcdir)/'`char_io.c + +diskless_exec-char_io.obj: char_io.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-char_io.obj -MD -MP -MF "$(DEPDIR)/diskless_exec-char_io.Tpo" -c -o diskless_exec-char_io.obj `if test -f 'char_io.c'; then $(CYGPATH_W) 'char_io.c'; else $(CYGPATH_W) '$(srcdir)/char_io.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-char_io.Tpo" "$(DEPDIR)/diskless_exec-char_io.Po"; else rm -f "$(DEPDIR)/diskless_exec-char_io.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='char_io.c' object='diskless_exec-char_io.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-char_io.obj `if test -f 'char_io.c'; then $(CYGPATH_W) 'char_io.c'; else $(CYGPATH_W) '$(srcdir)/char_io.c'; fi` + +diskless_exec-cmdline.o: cmdline.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-cmdline.o -MD -MP -MF "$(DEPDIR)/diskless_exec-cmdline.Tpo" -c -o diskless_exec-cmdline.o `test -f 'cmdline.c' || echo '$(srcdir)/'`cmdline.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-cmdline.Tpo" "$(DEPDIR)/diskless_exec-cmdline.Po"; else rm -f "$(DEPDIR)/diskless_exec-cmdline.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cmdline.c' object='diskless_exec-cmdline.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-cmdline.o `test -f 'cmdline.c' || echo '$(srcdir)/'`cmdline.c + +diskless_exec-cmdline.obj: cmdline.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-cmdline.obj -MD -MP -MF "$(DEPDIR)/diskless_exec-cmdline.Tpo" -c -o diskless_exec-cmdline.obj `if test -f 'cmdline.c'; then $(CYGPATH_W) 'cmdline.c'; else $(CYGPATH_W) '$(srcdir)/cmdline.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-cmdline.Tpo" "$(DEPDIR)/diskless_exec-cmdline.Po"; else rm -f "$(DEPDIR)/diskless_exec-cmdline.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cmdline.c' object='diskless_exec-cmdline.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-cmdline.obj `if test -f 'cmdline.c'; then $(CYGPATH_W) 'cmdline.c'; else $(CYGPATH_W) '$(srcdir)/cmdline.c'; fi` + +diskless_exec-common.o: common.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-common.o -MD -MP -MF "$(DEPDIR)/diskless_exec-common.Tpo" -c -o diskless_exec-common.o `test -f 'common.c' || echo '$(srcdir)/'`common.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-common.Tpo" "$(DEPDIR)/diskless_exec-common.Po"; else rm -f "$(DEPDIR)/diskless_exec-common.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='common.c' object='diskless_exec-common.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-common.o `test -f 'common.c' || echo '$(srcdir)/'`common.c + +diskless_exec-common.obj: common.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-common.obj -MD -MP -MF "$(DEPDIR)/diskless_exec-common.Tpo" -c -o diskless_exec-common.obj `if test -f 'common.c'; then $(CYGPATH_W) 'common.c'; else $(CYGPATH_W) '$(srcdir)/common.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-common.Tpo" "$(DEPDIR)/diskless_exec-common.Po"; else rm -f "$(DEPDIR)/diskless_exec-common.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='common.c' object='diskless_exec-common.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-common.obj `if test -f 'common.c'; then $(CYGPATH_W) 'common.c'; else $(CYGPATH_W) '$(srcdir)/common.c'; fi` + +diskless_exec-console.o: console.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-console.o -MD -MP -MF "$(DEPDIR)/diskless_exec-console.Tpo" -c -o diskless_exec-console.o `test -f 'console.c' || echo '$(srcdir)/'`console.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-console.Tpo" "$(DEPDIR)/diskless_exec-console.Po"; else rm -f "$(DEPDIR)/diskless_exec-console.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='console.c' object='diskless_exec-console.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-console.o `test -f 'console.c' || echo '$(srcdir)/'`console.c + +diskless_exec-console.obj: console.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-console.obj -MD -MP -MF "$(DEPDIR)/diskless_exec-console.Tpo" -c -o diskless_exec-console.obj `if test -f 'console.c'; then $(CYGPATH_W) 'console.c'; else $(CYGPATH_W) '$(srcdir)/console.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-console.Tpo" "$(DEPDIR)/diskless_exec-console.Po"; else rm -f "$(DEPDIR)/diskless_exec-console.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='console.c' object='diskless_exec-console.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-console.obj `if test -f 'console.c'; then $(CYGPATH_W) 'console.c'; else $(CYGPATH_W) '$(srcdir)/console.c'; fi` + +diskless_exec-disk_io.o: disk_io.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-disk_io.o -MD -MP -MF "$(DEPDIR)/diskless_exec-disk_io.Tpo" -c -o diskless_exec-disk_io.o `test -f 'disk_io.c' || echo '$(srcdir)/'`disk_io.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-disk_io.Tpo" "$(DEPDIR)/diskless_exec-disk_io.Po"; else rm -f "$(DEPDIR)/diskless_exec-disk_io.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='disk_io.c' object='diskless_exec-disk_io.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-disk_io.o `test -f 'disk_io.c' || echo '$(srcdir)/'`disk_io.c + +diskless_exec-disk_io.obj: disk_io.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-disk_io.obj -MD -MP -MF "$(DEPDIR)/diskless_exec-disk_io.Tpo" -c -o diskless_exec-disk_io.obj `if test -f 'disk_io.c'; then $(CYGPATH_W) 'disk_io.c'; else $(CYGPATH_W) '$(srcdir)/disk_io.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-disk_io.Tpo" "$(DEPDIR)/diskless_exec-disk_io.Po"; else rm -f "$(DEPDIR)/diskless_exec-disk_io.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='disk_io.c' object='diskless_exec-disk_io.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-disk_io.obj `if test -f 'disk_io.c'; then $(CYGPATH_W) 'disk_io.c'; else $(CYGPATH_W) '$(srcdir)/disk_io.c'; fi` + +diskless_exec-fsys_ext2fs.o: fsys_ext2fs.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-fsys_ext2fs.o -MD -MP -MF "$(DEPDIR)/diskless_exec-fsys_ext2fs.Tpo" -c -o diskless_exec-fsys_ext2fs.o `test -f 'fsys_ext2fs.c' || echo '$(srcdir)/'`fsys_ext2fs.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-fsys_ext2fs.Tpo" "$(DEPDIR)/diskless_exec-fsys_ext2fs.Po"; else rm -f "$(DEPDIR)/diskless_exec-fsys_ext2fs.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_ext2fs.c' object='diskless_exec-fsys_ext2fs.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-fsys_ext2fs.o `test -f 'fsys_ext2fs.c' || echo '$(srcdir)/'`fsys_ext2fs.c + +diskless_exec-fsys_ext2fs.obj: fsys_ext2fs.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-fsys_ext2fs.obj -MD -MP -MF "$(DEPDIR)/diskless_exec-fsys_ext2fs.Tpo" -c -o diskless_exec-fsys_ext2fs.obj `if test -f 'fsys_ext2fs.c'; then $(CYGPATH_W) 'fsys_ext2fs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_ext2fs.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-fsys_ext2fs.Tpo" "$(DEPDIR)/diskless_exec-fsys_ext2fs.Po"; else rm -f "$(DEPDIR)/diskless_exec-fsys_ext2fs.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_ext2fs.c' object='diskless_exec-fsys_ext2fs.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-fsys_ext2fs.obj `if test -f 'fsys_ext2fs.c'; then $(CYGPATH_W) 'fsys_ext2fs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_ext2fs.c'; fi` + +diskless_exec-fsys_fat.o: fsys_fat.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-fsys_fat.o -MD -MP -MF "$(DEPDIR)/diskless_exec-fsys_fat.Tpo" -c -o diskless_exec-fsys_fat.o `test -f 'fsys_fat.c' || echo '$(srcdir)/'`fsys_fat.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-fsys_fat.Tpo" "$(DEPDIR)/diskless_exec-fsys_fat.Po"; else rm -f "$(DEPDIR)/diskless_exec-fsys_fat.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_fat.c' object='diskless_exec-fsys_fat.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-fsys_fat.o `test -f 'fsys_fat.c' || echo '$(srcdir)/'`fsys_fat.c + +diskless_exec-fsys_fat.obj: fsys_fat.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-fsys_fat.obj -MD -MP -MF "$(DEPDIR)/diskless_exec-fsys_fat.Tpo" -c -o diskless_exec-fsys_fat.obj `if test -f 'fsys_fat.c'; then $(CYGPATH_W) 'fsys_fat.c'; else $(CYGPATH_W) '$(srcdir)/fsys_fat.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-fsys_fat.Tpo" "$(DEPDIR)/diskless_exec-fsys_fat.Po"; else rm -f "$(DEPDIR)/diskless_exec-fsys_fat.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_fat.c' object='diskless_exec-fsys_fat.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-fsys_fat.obj `if test -f 'fsys_fat.c'; then $(CYGPATH_W) 'fsys_fat.c'; else $(CYGPATH_W) '$(srcdir)/fsys_fat.c'; fi` + +diskless_exec-fsys_ffs.o: fsys_ffs.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-fsys_ffs.o -MD -MP -MF "$(DEPDIR)/diskless_exec-fsys_ffs.Tpo" -c -o diskless_exec-fsys_ffs.o `test -f 'fsys_ffs.c' || echo '$(srcdir)/'`fsys_ffs.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-fsys_ffs.Tpo" "$(DEPDIR)/diskless_exec-fsys_ffs.Po"; else rm -f "$(DEPDIR)/diskless_exec-fsys_ffs.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_ffs.c' object='diskless_exec-fsys_ffs.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-fsys_ffs.o `test -f 'fsys_ffs.c' || echo '$(srcdir)/'`fsys_ffs.c + +diskless_exec-fsys_ffs.obj: fsys_ffs.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-fsys_ffs.obj -MD -MP -MF "$(DEPDIR)/diskless_exec-fsys_ffs.Tpo" -c -o diskless_exec-fsys_ffs.obj `if test -f 'fsys_ffs.c'; then $(CYGPATH_W) 'fsys_ffs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_ffs.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-fsys_ffs.Tpo" "$(DEPDIR)/diskless_exec-fsys_ffs.Po"; else rm -f "$(DEPDIR)/diskless_exec-fsys_ffs.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_ffs.c' object='diskless_exec-fsys_ffs.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-fsys_ffs.obj `if test -f 'fsys_ffs.c'; then $(CYGPATH_W) 'fsys_ffs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_ffs.c'; fi` + +diskless_exec-fsys_iso9660.o: fsys_iso9660.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-fsys_iso9660.o -MD -MP -MF "$(DEPDIR)/diskless_exec-fsys_iso9660.Tpo" -c -o diskless_exec-fsys_iso9660.o `test -f 'fsys_iso9660.c' || echo '$(srcdir)/'`fsys_iso9660.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-fsys_iso9660.Tpo" "$(DEPDIR)/diskless_exec-fsys_iso9660.Po"; else rm -f "$(DEPDIR)/diskless_exec-fsys_iso9660.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_iso9660.c' object='diskless_exec-fsys_iso9660.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-fsys_iso9660.o `test -f 'fsys_iso9660.c' || echo '$(srcdir)/'`fsys_iso9660.c + +diskless_exec-fsys_iso9660.obj: fsys_iso9660.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-fsys_iso9660.obj -MD -MP -MF "$(DEPDIR)/diskless_exec-fsys_iso9660.Tpo" -c -o diskless_exec-fsys_iso9660.obj `if test -f 'fsys_iso9660.c'; then $(CYGPATH_W) 'fsys_iso9660.c'; else $(CYGPATH_W) '$(srcdir)/fsys_iso9660.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-fsys_iso9660.Tpo" "$(DEPDIR)/diskless_exec-fsys_iso9660.Po"; else rm -f "$(DEPDIR)/diskless_exec-fsys_iso9660.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_iso9660.c' object='diskless_exec-fsys_iso9660.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-fsys_iso9660.obj `if test -f 'fsys_iso9660.c'; then $(CYGPATH_W) 'fsys_iso9660.c'; else $(CYGPATH_W) '$(srcdir)/fsys_iso9660.c'; fi` + +diskless_exec-fsys_jfs.o: fsys_jfs.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-fsys_jfs.o -MD -MP -MF "$(DEPDIR)/diskless_exec-fsys_jfs.Tpo" -c -o diskless_exec-fsys_jfs.o `test -f 'fsys_jfs.c' || echo '$(srcdir)/'`fsys_jfs.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-fsys_jfs.Tpo" "$(DEPDIR)/diskless_exec-fsys_jfs.Po"; else rm -f "$(DEPDIR)/diskless_exec-fsys_jfs.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_jfs.c' object='diskless_exec-fsys_jfs.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-fsys_jfs.o `test -f 'fsys_jfs.c' || echo '$(srcdir)/'`fsys_jfs.c + +diskless_exec-fsys_jfs.obj: fsys_jfs.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-fsys_jfs.obj -MD -MP -MF "$(DEPDIR)/diskless_exec-fsys_jfs.Tpo" -c -o diskless_exec-fsys_jfs.obj `if test -f 'fsys_jfs.c'; then $(CYGPATH_W) 'fsys_jfs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_jfs.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-fsys_jfs.Tpo" "$(DEPDIR)/diskless_exec-fsys_jfs.Po"; else rm -f "$(DEPDIR)/diskless_exec-fsys_jfs.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_jfs.c' object='diskless_exec-fsys_jfs.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-fsys_jfs.obj `if test -f 'fsys_jfs.c'; then $(CYGPATH_W) 'fsys_jfs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_jfs.c'; fi` + +diskless_exec-fsys_minix.o: fsys_minix.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-fsys_minix.o -MD -MP -MF "$(DEPDIR)/diskless_exec-fsys_minix.Tpo" -c -o diskless_exec-fsys_minix.o `test -f 'fsys_minix.c' || echo '$(srcdir)/'`fsys_minix.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-fsys_minix.Tpo" "$(DEPDIR)/diskless_exec-fsys_minix.Po"; else rm -f "$(DEPDIR)/diskless_exec-fsys_minix.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_minix.c' object='diskless_exec-fsys_minix.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-fsys_minix.o `test -f 'fsys_minix.c' || echo '$(srcdir)/'`fsys_minix.c + +diskless_exec-fsys_minix.obj: fsys_minix.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-fsys_minix.obj -MD -MP -MF "$(DEPDIR)/diskless_exec-fsys_minix.Tpo" -c -o diskless_exec-fsys_minix.obj `if test -f 'fsys_minix.c'; then $(CYGPATH_W) 'fsys_minix.c'; else $(CYGPATH_W) '$(srcdir)/fsys_minix.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-fsys_minix.Tpo" "$(DEPDIR)/diskless_exec-fsys_minix.Po"; else rm -f "$(DEPDIR)/diskless_exec-fsys_minix.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_minix.c' object='diskless_exec-fsys_minix.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-fsys_minix.obj `if test -f 'fsys_minix.c'; then $(CYGPATH_W) 'fsys_minix.c'; else $(CYGPATH_W) '$(srcdir)/fsys_minix.c'; fi` + +diskless_exec-fsys_reiserfs.o: fsys_reiserfs.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-fsys_reiserfs.o -MD -MP -MF "$(DEPDIR)/diskless_exec-fsys_reiserfs.Tpo" -c -o diskless_exec-fsys_reiserfs.o `test -f 'fsys_reiserfs.c' || echo '$(srcdir)/'`fsys_reiserfs.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-fsys_reiserfs.Tpo" "$(DEPDIR)/diskless_exec-fsys_reiserfs.Po"; else rm -f "$(DEPDIR)/diskless_exec-fsys_reiserfs.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_reiserfs.c' object='diskless_exec-fsys_reiserfs.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-fsys_reiserfs.o `test -f 'fsys_reiserfs.c' || echo '$(srcdir)/'`fsys_reiserfs.c + +diskless_exec-fsys_reiserfs.obj: fsys_reiserfs.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-fsys_reiserfs.obj -MD -MP -MF "$(DEPDIR)/diskless_exec-fsys_reiserfs.Tpo" -c -o diskless_exec-fsys_reiserfs.obj `if test -f 'fsys_reiserfs.c'; then $(CYGPATH_W) 'fsys_reiserfs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_reiserfs.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-fsys_reiserfs.Tpo" "$(DEPDIR)/diskless_exec-fsys_reiserfs.Po"; else rm -f "$(DEPDIR)/diskless_exec-fsys_reiserfs.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_reiserfs.c' object='diskless_exec-fsys_reiserfs.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-fsys_reiserfs.obj `if test -f 'fsys_reiserfs.c'; then $(CYGPATH_W) 'fsys_reiserfs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_reiserfs.c'; fi` + +diskless_exec-zfs_sha256.o: zfs_sha256.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-zfs_sha256.o -MD -MP -MF "$(DEPDIR)/diskless_exec-zfs_sha256.Tpo" -c -o diskless_exec-zfs_sha256.o `test -f 'zfs_sha256.c' || echo '$(srcdir)/'`zfs_sha256.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-zfs_sha256.Tpo" "$(DEPDIR)/diskless_exec-zfs_sha256.Po"; else rm -f "$(DEPDIR)/diskless_exec-zfs_sha256.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='zfs_sha256.c' object='diskless_exec-zfs_sha256.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-zfs_sha256.o `test -f 'zfs_sha256.c' || echo '$(srcdir)/'`zfs_sha256.c + +diskless_exec-zfs_sha256.obj: zfs_sha256.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-zfs_sha256.obj -MD -MP -MF "$(DEPDIR)/diskless_exec-zfs_sha256.Tpo" -c -o diskless_exec-zfs_sha256.obj `if test -f 'zfs_sha256.c'; then $(CYGPATH_W) 'zfs_sha256.c'; else $(CYGPATH_W) '$(srcdir)/zfs_sha256.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-zfs_sha256.Tpo" "$(DEPDIR)/diskless_exec-zfs_sha256.Po"; else rm -f "$(DEPDIR)/diskless_exec-zfs_sha256.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='zfs_sha256.c' object='diskless_exec-zfs_sha256.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-zfs_sha256.obj `if test -f 'zfs_sha256.c'; then $(CYGPATH_W) 'zfs_sha256.c'; else $(CYGPATH_W) '$(srcdir)/zfs_sha256.c'; fi` + +diskless_exec-zfs_lzjb.o: zfs_lzjb.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-zfs_lzjb.o -MD -MP -MF "$(DEPDIR)/diskless_exec-zfs_lzjb.Tpo" -c -o diskless_exec-zfs_lzjb.o `test -f 'zfs_lzjb.c' || echo '$(srcdir)/'`zfs_lzjb.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-zfs_lzjb.Tpo" "$(DEPDIR)/diskless_exec-zfs_lzjb.Po"; else rm -f "$(DEPDIR)/diskless_exec-zfs_lzjb.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='zfs_lzjb.c' object='diskless_exec-zfs_lzjb.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-zfs_lzjb.o `test -f 'zfs_lzjb.c' || echo '$(srcdir)/'`zfs_lzjb.c + +diskless_exec-zfs_lzjb.obj: zfs_lzjb.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-zfs_lzjb.obj -MD -MP -MF "$(DEPDIR)/diskless_exec-zfs_lzjb.Tpo" -c -o diskless_exec-zfs_lzjb.obj `if test -f 'zfs_lzjb.c'; then $(CYGPATH_W) 'zfs_lzjb.c'; else $(CYGPATH_W) '$(srcdir)/zfs_lzjb.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-zfs_lzjb.Tpo" "$(DEPDIR)/diskless_exec-zfs_lzjb.Po"; else rm -f "$(DEPDIR)/diskless_exec-zfs_lzjb.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='zfs_lzjb.c' object='diskless_exec-zfs_lzjb.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-zfs_lzjb.obj `if test -f 'zfs_lzjb.c'; then $(CYGPATH_W) 'zfs_lzjb.c'; else $(CYGPATH_W) '$(srcdir)/zfs_lzjb.c'; fi` + +diskless_exec-zfs_fletcher.o: zfs_fletcher.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-zfs_fletcher.o -MD -MP -MF "$(DEPDIR)/diskless_exec-zfs_fletcher.Tpo" -c -o diskless_exec-zfs_fletcher.o `test -f 'zfs_fletcher.c' || echo '$(srcdir)/'`zfs_fletcher.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-zfs_fletcher.Tpo" "$(DEPDIR)/diskless_exec-zfs_fletcher.Po"; else rm -f "$(DEPDIR)/diskless_exec-zfs_fletcher.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='zfs_fletcher.c' object='diskless_exec-zfs_fletcher.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-zfs_fletcher.o `test -f 'zfs_fletcher.c' || echo '$(srcdir)/'`zfs_fletcher.c + +diskless_exec-zfs_fletcher.obj: zfs_fletcher.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-zfs_fletcher.obj -MD -MP -MF "$(DEPDIR)/diskless_exec-zfs_fletcher.Tpo" -c -o diskless_exec-zfs_fletcher.obj `if test -f 'zfs_fletcher.c'; then $(CYGPATH_W) 'zfs_fletcher.c'; else $(CYGPATH_W) '$(srcdir)/zfs_fletcher.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-zfs_fletcher.Tpo" "$(DEPDIR)/diskless_exec-zfs_fletcher.Po"; else rm -f "$(DEPDIR)/diskless_exec-zfs_fletcher.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='zfs_fletcher.c' object='diskless_exec-zfs_fletcher.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-zfs_fletcher.obj `if test -f 'zfs_fletcher.c'; then $(CYGPATH_W) 'zfs_fletcher.c'; else $(CYGPATH_W) '$(srcdir)/zfs_fletcher.c'; fi` + +diskless_exec-fsys_zfs.o: fsys_zfs.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-fsys_zfs.o -MD -MP -MF "$(DEPDIR)/diskless_exec-fsys_zfs.Tpo" -c -o diskless_exec-fsys_zfs.o `test -f 'fsys_zfs.c' || echo '$(srcdir)/'`fsys_zfs.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-fsys_zfs.Tpo" "$(DEPDIR)/diskless_exec-fsys_zfs.Po"; else rm -f "$(DEPDIR)/diskless_exec-fsys_zfs.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_zfs.c' object='diskless_exec-fsys_zfs.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-fsys_zfs.o `test -f 'fsys_zfs.c' || echo '$(srcdir)/'`fsys_zfs.c + +diskless_exec-fsys_zfs.obj: fsys_zfs.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-fsys_zfs.obj -MD -MP -MF "$(DEPDIR)/diskless_exec-fsys_zfs.Tpo" -c -o diskless_exec-fsys_zfs.obj `if test -f 'fsys_zfs.c'; then $(CYGPATH_W) 'fsys_zfs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_zfs.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-fsys_zfs.Tpo" "$(DEPDIR)/diskless_exec-fsys_zfs.Po"; else rm -f "$(DEPDIR)/diskless_exec-fsys_zfs.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_zfs.c' object='diskless_exec-fsys_zfs.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-fsys_zfs.obj `if test -f 'fsys_zfs.c'; then $(CYGPATH_W) 'fsys_zfs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_zfs.c'; fi` + +diskless_exec-fsys_ufs.o: fsys_ufs.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-fsys_ufs.o -MD -MP -MF "$(DEPDIR)/diskless_exec-fsys_ufs.Tpo" -c -o diskless_exec-fsys_ufs.o `test -f 'fsys_ufs.c' || echo '$(srcdir)/'`fsys_ufs.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-fsys_ufs.Tpo" "$(DEPDIR)/diskless_exec-fsys_ufs.Po"; else rm -f "$(DEPDIR)/diskless_exec-fsys_ufs.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_ufs.c' object='diskless_exec-fsys_ufs.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-fsys_ufs.o `test -f 'fsys_ufs.c' || echo '$(srcdir)/'`fsys_ufs.c + +diskless_exec-fsys_ufs.obj: fsys_ufs.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-fsys_ufs.obj -MD -MP -MF "$(DEPDIR)/diskless_exec-fsys_ufs.Tpo" -c -o diskless_exec-fsys_ufs.obj `if test -f 'fsys_ufs.c'; then $(CYGPATH_W) 'fsys_ufs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_ufs.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-fsys_ufs.Tpo" "$(DEPDIR)/diskless_exec-fsys_ufs.Po"; else rm -f "$(DEPDIR)/diskless_exec-fsys_ufs.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_ufs.c' object='diskless_exec-fsys_ufs.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-fsys_ufs.obj `if test -f 'fsys_ufs.c'; then $(CYGPATH_W) 'fsys_ufs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_ufs.c'; fi` + +diskless_exec-fsys_ufs2.o: fsys_ufs2.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-fsys_ufs2.o -MD -MP -MF "$(DEPDIR)/diskless_exec-fsys_ufs2.Tpo" -c -o diskless_exec-fsys_ufs2.o `test -f 'fsys_ufs2.c' || echo '$(srcdir)/'`fsys_ufs2.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-fsys_ufs2.Tpo" "$(DEPDIR)/diskless_exec-fsys_ufs2.Po"; else rm -f "$(DEPDIR)/diskless_exec-fsys_ufs2.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_ufs2.c' object='diskless_exec-fsys_ufs2.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-fsys_ufs2.o `test -f 'fsys_ufs2.c' || echo '$(srcdir)/'`fsys_ufs2.c + +diskless_exec-fsys_ufs2.obj: fsys_ufs2.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-fsys_ufs2.obj -MD -MP -MF "$(DEPDIR)/diskless_exec-fsys_ufs2.Tpo" -c -o diskless_exec-fsys_ufs2.obj `if test -f 'fsys_ufs2.c'; then $(CYGPATH_W) 'fsys_ufs2.c'; else $(CYGPATH_W) '$(srcdir)/fsys_ufs2.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-fsys_ufs2.Tpo" "$(DEPDIR)/diskless_exec-fsys_ufs2.Po"; else rm -f "$(DEPDIR)/diskless_exec-fsys_ufs2.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_ufs2.c' object='diskless_exec-fsys_ufs2.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-fsys_ufs2.obj `if test -f 'fsys_ufs2.c'; then $(CYGPATH_W) 'fsys_ufs2.c'; else $(CYGPATH_W) '$(srcdir)/fsys_ufs2.c'; fi` + +diskless_exec-fsys_vstafs.o: fsys_vstafs.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-fsys_vstafs.o -MD -MP -MF "$(DEPDIR)/diskless_exec-fsys_vstafs.Tpo" -c -o diskless_exec-fsys_vstafs.o `test -f 'fsys_vstafs.c' || echo '$(srcdir)/'`fsys_vstafs.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-fsys_vstafs.Tpo" "$(DEPDIR)/diskless_exec-fsys_vstafs.Po"; else rm -f "$(DEPDIR)/diskless_exec-fsys_vstafs.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_vstafs.c' object='diskless_exec-fsys_vstafs.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-fsys_vstafs.o `test -f 'fsys_vstafs.c' || echo '$(srcdir)/'`fsys_vstafs.c + +diskless_exec-fsys_vstafs.obj: fsys_vstafs.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-fsys_vstafs.obj -MD -MP -MF "$(DEPDIR)/diskless_exec-fsys_vstafs.Tpo" -c -o diskless_exec-fsys_vstafs.obj `if test -f 'fsys_vstafs.c'; then $(CYGPATH_W) 'fsys_vstafs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_vstafs.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-fsys_vstafs.Tpo" "$(DEPDIR)/diskless_exec-fsys_vstafs.Po"; else rm -f "$(DEPDIR)/diskless_exec-fsys_vstafs.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_vstafs.c' object='diskless_exec-fsys_vstafs.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-fsys_vstafs.obj `if test -f 'fsys_vstafs.c'; then $(CYGPATH_W) 'fsys_vstafs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_vstafs.c'; fi` + +diskless_exec-fsys_xfs.o: fsys_xfs.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-fsys_xfs.o -MD -MP -MF "$(DEPDIR)/diskless_exec-fsys_xfs.Tpo" -c -o diskless_exec-fsys_xfs.o `test -f 'fsys_xfs.c' || echo '$(srcdir)/'`fsys_xfs.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-fsys_xfs.Tpo" "$(DEPDIR)/diskless_exec-fsys_xfs.Po"; else rm -f "$(DEPDIR)/diskless_exec-fsys_xfs.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_xfs.c' object='diskless_exec-fsys_xfs.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-fsys_xfs.o `test -f 'fsys_xfs.c' || echo '$(srcdir)/'`fsys_xfs.c + +diskless_exec-fsys_xfs.obj: fsys_xfs.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-fsys_xfs.obj -MD -MP -MF "$(DEPDIR)/diskless_exec-fsys_xfs.Tpo" -c -o diskless_exec-fsys_xfs.obj `if test -f 'fsys_xfs.c'; then $(CYGPATH_W) 'fsys_xfs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_xfs.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-fsys_xfs.Tpo" "$(DEPDIR)/diskless_exec-fsys_xfs.Po"; else rm -f "$(DEPDIR)/diskless_exec-fsys_xfs.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_xfs.c' object='diskless_exec-fsys_xfs.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-fsys_xfs.obj `if test -f 'fsys_xfs.c'; then $(CYGPATH_W) 'fsys_xfs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_xfs.c'; fi` + +diskless_exec-gunzip.o: gunzip.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-gunzip.o -MD -MP -MF "$(DEPDIR)/diskless_exec-gunzip.Tpo" -c -o diskless_exec-gunzip.o `test -f 'gunzip.c' || echo '$(srcdir)/'`gunzip.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-gunzip.Tpo" "$(DEPDIR)/diskless_exec-gunzip.Po"; else rm -f "$(DEPDIR)/diskless_exec-gunzip.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gunzip.c' object='diskless_exec-gunzip.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-gunzip.o `test -f 'gunzip.c' || echo '$(srcdir)/'`gunzip.c + +diskless_exec-gunzip.obj: gunzip.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-gunzip.obj -MD -MP -MF "$(DEPDIR)/diskless_exec-gunzip.Tpo" -c -o diskless_exec-gunzip.obj `if test -f 'gunzip.c'; then $(CYGPATH_W) 'gunzip.c'; else $(CYGPATH_W) '$(srcdir)/gunzip.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-gunzip.Tpo" "$(DEPDIR)/diskless_exec-gunzip.Po"; else rm -f "$(DEPDIR)/diskless_exec-gunzip.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gunzip.c' object='diskless_exec-gunzip.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-gunzip.obj `if test -f 'gunzip.c'; then $(CYGPATH_W) 'gunzip.c'; else $(CYGPATH_W) '$(srcdir)/gunzip.c'; fi` + +diskless_exec-hercules.o: hercules.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-hercules.o -MD -MP -MF "$(DEPDIR)/diskless_exec-hercules.Tpo" -c -o diskless_exec-hercules.o `test -f 'hercules.c' || echo '$(srcdir)/'`hercules.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-hercules.Tpo" "$(DEPDIR)/diskless_exec-hercules.Po"; else rm -f "$(DEPDIR)/diskless_exec-hercules.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='hercules.c' object='diskless_exec-hercules.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-hercules.o `test -f 'hercules.c' || echo '$(srcdir)/'`hercules.c + +diskless_exec-hercules.obj: hercules.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-hercules.obj -MD -MP -MF "$(DEPDIR)/diskless_exec-hercules.Tpo" -c -o diskless_exec-hercules.obj `if test -f 'hercules.c'; then $(CYGPATH_W) 'hercules.c'; else $(CYGPATH_W) '$(srcdir)/hercules.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-hercules.Tpo" "$(DEPDIR)/diskless_exec-hercules.Po"; else rm -f "$(DEPDIR)/diskless_exec-hercules.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='hercules.c' object='diskless_exec-hercules.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-hercules.obj `if test -f 'hercules.c'; then $(CYGPATH_W) 'hercules.c'; else $(CYGPATH_W) '$(srcdir)/hercules.c'; fi` + +diskless_exec-md5.o: md5.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-md5.o -MD -MP -MF "$(DEPDIR)/diskless_exec-md5.Tpo" -c -o diskless_exec-md5.o `test -f 'md5.c' || echo '$(srcdir)/'`md5.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-md5.Tpo" "$(DEPDIR)/diskless_exec-md5.Po"; else rm -f "$(DEPDIR)/diskless_exec-md5.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='md5.c' object='diskless_exec-md5.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-md5.o `test -f 'md5.c' || echo '$(srcdir)/'`md5.c + +diskless_exec-md5.obj: md5.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-md5.obj -MD -MP -MF "$(DEPDIR)/diskless_exec-md5.Tpo" -c -o diskless_exec-md5.obj `if test -f 'md5.c'; then $(CYGPATH_W) 'md5.c'; else $(CYGPATH_W) '$(srcdir)/md5.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-md5.Tpo" "$(DEPDIR)/diskless_exec-md5.Po"; else rm -f "$(DEPDIR)/diskless_exec-md5.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='md5.c' object='diskless_exec-md5.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-md5.obj `if test -f 'md5.c'; then $(CYGPATH_W) 'md5.c'; else $(CYGPATH_W) '$(srcdir)/md5.c'; fi` + +diskless_exec-serial.o: serial.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-serial.o -MD -MP -MF "$(DEPDIR)/diskless_exec-serial.Tpo" -c -o diskless_exec-serial.o `test -f 'serial.c' || echo '$(srcdir)/'`serial.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-serial.Tpo" "$(DEPDIR)/diskless_exec-serial.Po"; else rm -f "$(DEPDIR)/diskless_exec-serial.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='serial.c' object='diskless_exec-serial.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-serial.o `test -f 'serial.c' || echo '$(srcdir)/'`serial.c + +diskless_exec-serial.obj: serial.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-serial.obj -MD -MP -MF "$(DEPDIR)/diskless_exec-serial.Tpo" -c -o diskless_exec-serial.obj `if test -f 'serial.c'; then $(CYGPATH_W) 'serial.c'; else $(CYGPATH_W) '$(srcdir)/serial.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-serial.Tpo" "$(DEPDIR)/diskless_exec-serial.Po"; else rm -f "$(DEPDIR)/diskless_exec-serial.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='serial.c' object='diskless_exec-serial.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-serial.obj `if test -f 'serial.c'; then $(CYGPATH_W) 'serial.c'; else $(CYGPATH_W) '$(srcdir)/serial.c'; fi` + +diskless_exec-smp-imps.o: smp-imps.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-smp-imps.o -MD -MP -MF "$(DEPDIR)/diskless_exec-smp-imps.Tpo" -c -o diskless_exec-smp-imps.o `test -f 'smp-imps.c' || echo '$(srcdir)/'`smp-imps.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-smp-imps.Tpo" "$(DEPDIR)/diskless_exec-smp-imps.Po"; else rm -f "$(DEPDIR)/diskless_exec-smp-imps.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='smp-imps.c' object='diskless_exec-smp-imps.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-smp-imps.o `test -f 'smp-imps.c' || echo '$(srcdir)/'`smp-imps.c + +diskless_exec-smp-imps.obj: smp-imps.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-smp-imps.obj -MD -MP -MF "$(DEPDIR)/diskless_exec-smp-imps.Tpo" -c -o diskless_exec-smp-imps.obj `if test -f 'smp-imps.c'; then $(CYGPATH_W) 'smp-imps.c'; else $(CYGPATH_W) '$(srcdir)/smp-imps.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-smp-imps.Tpo" "$(DEPDIR)/diskless_exec-smp-imps.Po"; else rm -f "$(DEPDIR)/diskless_exec-smp-imps.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='smp-imps.c' object='diskless_exec-smp-imps.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-smp-imps.obj `if test -f 'smp-imps.c'; then $(CYGPATH_W) 'smp-imps.c'; else $(CYGPATH_W) '$(srcdir)/smp-imps.c'; fi` + +diskless_exec-stage2.o: stage2.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-stage2.o -MD -MP -MF "$(DEPDIR)/diskless_exec-stage2.Tpo" -c -o diskless_exec-stage2.o `test -f 'stage2.c' || echo '$(srcdir)/'`stage2.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-stage2.Tpo" "$(DEPDIR)/diskless_exec-stage2.Po"; else rm -f "$(DEPDIR)/diskless_exec-stage2.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='stage2.c' object='diskless_exec-stage2.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-stage2.o `test -f 'stage2.c' || echo '$(srcdir)/'`stage2.c + +diskless_exec-stage2.obj: stage2.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-stage2.obj -MD -MP -MF "$(DEPDIR)/diskless_exec-stage2.Tpo" -c -o diskless_exec-stage2.obj `if test -f 'stage2.c'; then $(CYGPATH_W) 'stage2.c'; else $(CYGPATH_W) '$(srcdir)/stage2.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-stage2.Tpo" "$(DEPDIR)/diskless_exec-stage2.Po"; else rm -f "$(DEPDIR)/diskless_exec-stage2.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='stage2.c' object='diskless_exec-stage2.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-stage2.obj `if test -f 'stage2.c'; then $(CYGPATH_W) 'stage2.c'; else $(CYGPATH_W) '$(srcdir)/stage2.c'; fi` + +diskless_exec-terminfo.o: terminfo.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-terminfo.o -MD -MP -MF "$(DEPDIR)/diskless_exec-terminfo.Tpo" -c -o diskless_exec-terminfo.o `test -f 'terminfo.c' || echo '$(srcdir)/'`terminfo.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-terminfo.Tpo" "$(DEPDIR)/diskless_exec-terminfo.Po"; else rm -f "$(DEPDIR)/diskless_exec-terminfo.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='terminfo.c' object='diskless_exec-terminfo.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-terminfo.o `test -f 'terminfo.c' || echo '$(srcdir)/'`terminfo.c + +diskless_exec-terminfo.obj: terminfo.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-terminfo.obj -MD -MP -MF "$(DEPDIR)/diskless_exec-terminfo.Tpo" -c -o diskless_exec-terminfo.obj `if test -f 'terminfo.c'; then $(CYGPATH_W) 'terminfo.c'; else $(CYGPATH_W) '$(srcdir)/terminfo.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-terminfo.Tpo" "$(DEPDIR)/diskless_exec-terminfo.Po"; else rm -f "$(DEPDIR)/diskless_exec-terminfo.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='terminfo.c' object='diskless_exec-terminfo.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-terminfo.obj `if test -f 'terminfo.c'; then $(CYGPATH_W) 'terminfo.c'; else $(CYGPATH_W) '$(srcdir)/terminfo.c'; fi` + +diskless_exec-tparm.o: tparm.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-tparm.o -MD -MP -MF "$(DEPDIR)/diskless_exec-tparm.Tpo" -c -o diskless_exec-tparm.o `test -f 'tparm.c' || echo '$(srcdir)/'`tparm.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-tparm.Tpo" "$(DEPDIR)/diskless_exec-tparm.Po"; else rm -f "$(DEPDIR)/diskless_exec-tparm.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tparm.c' object='diskless_exec-tparm.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-tparm.o `test -f 'tparm.c' || echo '$(srcdir)/'`tparm.c + +diskless_exec-tparm.obj: tparm.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-tparm.obj -MD -MP -MF "$(DEPDIR)/diskless_exec-tparm.Tpo" -c -o diskless_exec-tparm.obj `if test -f 'tparm.c'; then $(CYGPATH_W) 'tparm.c'; else $(CYGPATH_W) '$(srcdir)/tparm.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-tparm.Tpo" "$(DEPDIR)/diskless_exec-tparm.Po"; else rm -f "$(DEPDIR)/diskless_exec-tparm.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tparm.c' object='diskless_exec-tparm.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-tparm.obj `if test -f 'tparm.c'; then $(CYGPATH_W) 'tparm.c'; else $(CYGPATH_W) '$(srcdir)/tparm.c'; fi` + +diskless_exec-graphics.o: graphics.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-graphics.o -MD -MP -MF "$(DEPDIR)/diskless_exec-graphics.Tpo" -c -o diskless_exec-graphics.o `test -f 'graphics.c' || echo '$(srcdir)/'`graphics.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-graphics.Tpo" "$(DEPDIR)/diskless_exec-graphics.Po"; else rm -f "$(DEPDIR)/diskless_exec-graphics.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='graphics.c' object='diskless_exec-graphics.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-graphics.o `test -f 'graphics.c' || echo '$(srcdir)/'`graphics.c + +diskless_exec-graphics.obj: graphics.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-graphics.obj -MD -MP -MF "$(DEPDIR)/diskless_exec-graphics.Tpo" -c -o diskless_exec-graphics.obj `if test -f 'graphics.c'; then $(CYGPATH_W) 'graphics.c'; else $(CYGPATH_W) '$(srcdir)/graphics.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/diskless_exec-graphics.Tpo" "$(DEPDIR)/diskless_exec-graphics.Po"; else rm -f "$(DEPDIR)/diskless_exec-graphics.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='graphics.c' object='diskless_exec-graphics.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-graphics.obj `if test -f 'graphics.c'; then $(CYGPATH_W) 'graphics.c'; else $(CYGPATH_W) '$(srcdir)/graphics.c'; fi` + +e2fs_stage1_5_exec-common.o: common.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(e2fs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT e2fs_stage1_5_exec-common.o -MD -MP -MF "$(DEPDIR)/e2fs_stage1_5_exec-common.Tpo" -c -o e2fs_stage1_5_exec-common.o `test -f 'common.c' || echo '$(srcdir)/'`common.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/e2fs_stage1_5_exec-common.Tpo" "$(DEPDIR)/e2fs_stage1_5_exec-common.Po"; else rm -f "$(DEPDIR)/e2fs_stage1_5_exec-common.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='common.c' object='e2fs_stage1_5_exec-common.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(e2fs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o e2fs_stage1_5_exec-common.o `test -f 'common.c' || echo '$(srcdir)/'`common.c + +e2fs_stage1_5_exec-common.obj: common.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(e2fs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT e2fs_stage1_5_exec-common.obj -MD -MP -MF "$(DEPDIR)/e2fs_stage1_5_exec-common.Tpo" -c -o e2fs_stage1_5_exec-common.obj `if test -f 'common.c'; then $(CYGPATH_W) 'common.c'; else $(CYGPATH_W) '$(srcdir)/common.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/e2fs_stage1_5_exec-common.Tpo" "$(DEPDIR)/e2fs_stage1_5_exec-common.Po"; else rm -f "$(DEPDIR)/e2fs_stage1_5_exec-common.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='common.c' object='e2fs_stage1_5_exec-common.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(e2fs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o e2fs_stage1_5_exec-common.obj `if test -f 'common.c'; then $(CYGPATH_W) 'common.c'; else $(CYGPATH_W) '$(srcdir)/common.c'; fi` + +e2fs_stage1_5_exec-char_io.o: char_io.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(e2fs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT e2fs_stage1_5_exec-char_io.o -MD -MP -MF "$(DEPDIR)/e2fs_stage1_5_exec-char_io.Tpo" -c -o e2fs_stage1_5_exec-char_io.o `test -f 'char_io.c' || echo '$(srcdir)/'`char_io.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/e2fs_stage1_5_exec-char_io.Tpo" "$(DEPDIR)/e2fs_stage1_5_exec-char_io.Po"; else rm -f "$(DEPDIR)/e2fs_stage1_5_exec-char_io.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='char_io.c' object='e2fs_stage1_5_exec-char_io.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(e2fs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o e2fs_stage1_5_exec-char_io.o `test -f 'char_io.c' || echo '$(srcdir)/'`char_io.c + +e2fs_stage1_5_exec-char_io.obj: char_io.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(e2fs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT e2fs_stage1_5_exec-char_io.obj -MD -MP -MF "$(DEPDIR)/e2fs_stage1_5_exec-char_io.Tpo" -c -o e2fs_stage1_5_exec-char_io.obj `if test -f 'char_io.c'; then $(CYGPATH_W) 'char_io.c'; else $(CYGPATH_W) '$(srcdir)/char_io.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/e2fs_stage1_5_exec-char_io.Tpo" "$(DEPDIR)/e2fs_stage1_5_exec-char_io.Po"; else rm -f "$(DEPDIR)/e2fs_stage1_5_exec-char_io.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='char_io.c' object='e2fs_stage1_5_exec-char_io.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(e2fs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o e2fs_stage1_5_exec-char_io.obj `if test -f 'char_io.c'; then $(CYGPATH_W) 'char_io.c'; else $(CYGPATH_W) '$(srcdir)/char_io.c'; fi` + +e2fs_stage1_5_exec-disk_io.o: disk_io.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(e2fs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT e2fs_stage1_5_exec-disk_io.o -MD -MP -MF "$(DEPDIR)/e2fs_stage1_5_exec-disk_io.Tpo" -c -o e2fs_stage1_5_exec-disk_io.o `test -f 'disk_io.c' || echo '$(srcdir)/'`disk_io.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/e2fs_stage1_5_exec-disk_io.Tpo" "$(DEPDIR)/e2fs_stage1_5_exec-disk_io.Po"; else rm -f "$(DEPDIR)/e2fs_stage1_5_exec-disk_io.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='disk_io.c' object='e2fs_stage1_5_exec-disk_io.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(e2fs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o e2fs_stage1_5_exec-disk_io.o `test -f 'disk_io.c' || echo '$(srcdir)/'`disk_io.c + +e2fs_stage1_5_exec-disk_io.obj: disk_io.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(e2fs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT e2fs_stage1_5_exec-disk_io.obj -MD -MP -MF "$(DEPDIR)/e2fs_stage1_5_exec-disk_io.Tpo" -c -o e2fs_stage1_5_exec-disk_io.obj `if test -f 'disk_io.c'; then $(CYGPATH_W) 'disk_io.c'; else $(CYGPATH_W) '$(srcdir)/disk_io.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/e2fs_stage1_5_exec-disk_io.Tpo" "$(DEPDIR)/e2fs_stage1_5_exec-disk_io.Po"; else rm -f "$(DEPDIR)/e2fs_stage1_5_exec-disk_io.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='disk_io.c' object='e2fs_stage1_5_exec-disk_io.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(e2fs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o e2fs_stage1_5_exec-disk_io.obj `if test -f 'disk_io.c'; then $(CYGPATH_W) 'disk_io.c'; else $(CYGPATH_W) '$(srcdir)/disk_io.c'; fi` + +e2fs_stage1_5_exec-stage1_5.o: stage1_5.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(e2fs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT e2fs_stage1_5_exec-stage1_5.o -MD -MP -MF "$(DEPDIR)/e2fs_stage1_5_exec-stage1_5.Tpo" -c -o e2fs_stage1_5_exec-stage1_5.o `test -f 'stage1_5.c' || echo '$(srcdir)/'`stage1_5.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/e2fs_stage1_5_exec-stage1_5.Tpo" "$(DEPDIR)/e2fs_stage1_5_exec-stage1_5.Po"; else rm -f "$(DEPDIR)/e2fs_stage1_5_exec-stage1_5.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='stage1_5.c' object='e2fs_stage1_5_exec-stage1_5.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(e2fs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o e2fs_stage1_5_exec-stage1_5.o `test -f 'stage1_5.c' || echo '$(srcdir)/'`stage1_5.c + +e2fs_stage1_5_exec-stage1_5.obj: stage1_5.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(e2fs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT e2fs_stage1_5_exec-stage1_5.obj -MD -MP -MF "$(DEPDIR)/e2fs_stage1_5_exec-stage1_5.Tpo" -c -o e2fs_stage1_5_exec-stage1_5.obj `if test -f 'stage1_5.c'; then $(CYGPATH_W) 'stage1_5.c'; else $(CYGPATH_W) '$(srcdir)/stage1_5.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/e2fs_stage1_5_exec-stage1_5.Tpo" "$(DEPDIR)/e2fs_stage1_5_exec-stage1_5.Po"; else rm -f "$(DEPDIR)/e2fs_stage1_5_exec-stage1_5.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='stage1_5.c' object='e2fs_stage1_5_exec-stage1_5.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(e2fs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o e2fs_stage1_5_exec-stage1_5.obj `if test -f 'stage1_5.c'; then $(CYGPATH_W) 'stage1_5.c'; else $(CYGPATH_W) '$(srcdir)/stage1_5.c'; fi` + +e2fs_stage1_5_exec-fsys_ext2fs.o: fsys_ext2fs.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(e2fs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT e2fs_stage1_5_exec-fsys_ext2fs.o -MD -MP -MF "$(DEPDIR)/e2fs_stage1_5_exec-fsys_ext2fs.Tpo" -c -o e2fs_stage1_5_exec-fsys_ext2fs.o `test -f 'fsys_ext2fs.c' || echo '$(srcdir)/'`fsys_ext2fs.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/e2fs_stage1_5_exec-fsys_ext2fs.Tpo" "$(DEPDIR)/e2fs_stage1_5_exec-fsys_ext2fs.Po"; else rm -f "$(DEPDIR)/e2fs_stage1_5_exec-fsys_ext2fs.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_ext2fs.c' object='e2fs_stage1_5_exec-fsys_ext2fs.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(e2fs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o e2fs_stage1_5_exec-fsys_ext2fs.o `test -f 'fsys_ext2fs.c' || echo '$(srcdir)/'`fsys_ext2fs.c + +e2fs_stage1_5_exec-fsys_ext2fs.obj: fsys_ext2fs.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(e2fs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT e2fs_stage1_5_exec-fsys_ext2fs.obj -MD -MP -MF "$(DEPDIR)/e2fs_stage1_5_exec-fsys_ext2fs.Tpo" -c -o e2fs_stage1_5_exec-fsys_ext2fs.obj `if test -f 'fsys_ext2fs.c'; then $(CYGPATH_W) 'fsys_ext2fs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_ext2fs.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/e2fs_stage1_5_exec-fsys_ext2fs.Tpo" "$(DEPDIR)/e2fs_stage1_5_exec-fsys_ext2fs.Po"; else rm -f "$(DEPDIR)/e2fs_stage1_5_exec-fsys_ext2fs.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_ext2fs.c' object='e2fs_stage1_5_exec-fsys_ext2fs.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(e2fs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o e2fs_stage1_5_exec-fsys_ext2fs.obj `if test -f 'fsys_ext2fs.c'; then $(CYGPATH_W) 'fsys_ext2fs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_ext2fs.c'; fi` + +e2fs_stage1_5_exec-bios.o: bios.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(e2fs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT e2fs_stage1_5_exec-bios.o -MD -MP -MF "$(DEPDIR)/e2fs_stage1_5_exec-bios.Tpo" -c -o e2fs_stage1_5_exec-bios.o `test -f 'bios.c' || echo '$(srcdir)/'`bios.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/e2fs_stage1_5_exec-bios.Tpo" "$(DEPDIR)/e2fs_stage1_5_exec-bios.Po"; else rm -f "$(DEPDIR)/e2fs_stage1_5_exec-bios.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bios.c' object='e2fs_stage1_5_exec-bios.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(e2fs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o e2fs_stage1_5_exec-bios.o `test -f 'bios.c' || echo '$(srcdir)/'`bios.c + +e2fs_stage1_5_exec-bios.obj: bios.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(e2fs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT e2fs_stage1_5_exec-bios.obj -MD -MP -MF "$(DEPDIR)/e2fs_stage1_5_exec-bios.Tpo" -c -o e2fs_stage1_5_exec-bios.obj `if test -f 'bios.c'; then $(CYGPATH_W) 'bios.c'; else $(CYGPATH_W) '$(srcdir)/bios.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/e2fs_stage1_5_exec-bios.Tpo" "$(DEPDIR)/e2fs_stage1_5_exec-bios.Po"; else rm -f "$(DEPDIR)/e2fs_stage1_5_exec-bios.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bios.c' object='e2fs_stage1_5_exec-bios.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(e2fs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o e2fs_stage1_5_exec-bios.obj `if test -f 'bios.c'; then $(CYGPATH_W) 'bios.c'; else $(CYGPATH_W) '$(srcdir)/bios.c'; fi` + +fat_stage1_5_exec-common.o: common.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fat_stage1_5_exec_CFLAGS) $(CFLAGS) -MT fat_stage1_5_exec-common.o -MD -MP -MF "$(DEPDIR)/fat_stage1_5_exec-common.Tpo" -c -o fat_stage1_5_exec-common.o `test -f 'common.c' || echo '$(srcdir)/'`common.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/fat_stage1_5_exec-common.Tpo" "$(DEPDIR)/fat_stage1_5_exec-common.Po"; else rm -f "$(DEPDIR)/fat_stage1_5_exec-common.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='common.c' object='fat_stage1_5_exec-common.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fat_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o fat_stage1_5_exec-common.o `test -f 'common.c' || echo '$(srcdir)/'`common.c + +fat_stage1_5_exec-common.obj: common.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fat_stage1_5_exec_CFLAGS) $(CFLAGS) -MT fat_stage1_5_exec-common.obj -MD -MP -MF "$(DEPDIR)/fat_stage1_5_exec-common.Tpo" -c -o fat_stage1_5_exec-common.obj `if test -f 'common.c'; then $(CYGPATH_W) 'common.c'; else $(CYGPATH_W) '$(srcdir)/common.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/fat_stage1_5_exec-common.Tpo" "$(DEPDIR)/fat_stage1_5_exec-common.Po"; else rm -f "$(DEPDIR)/fat_stage1_5_exec-common.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='common.c' object='fat_stage1_5_exec-common.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fat_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o fat_stage1_5_exec-common.obj `if test -f 'common.c'; then $(CYGPATH_W) 'common.c'; else $(CYGPATH_W) '$(srcdir)/common.c'; fi` + +fat_stage1_5_exec-char_io.o: char_io.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fat_stage1_5_exec_CFLAGS) $(CFLAGS) -MT fat_stage1_5_exec-char_io.o -MD -MP -MF "$(DEPDIR)/fat_stage1_5_exec-char_io.Tpo" -c -o fat_stage1_5_exec-char_io.o `test -f 'char_io.c' || echo '$(srcdir)/'`char_io.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/fat_stage1_5_exec-char_io.Tpo" "$(DEPDIR)/fat_stage1_5_exec-char_io.Po"; else rm -f "$(DEPDIR)/fat_stage1_5_exec-char_io.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='char_io.c' object='fat_stage1_5_exec-char_io.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fat_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o fat_stage1_5_exec-char_io.o `test -f 'char_io.c' || echo '$(srcdir)/'`char_io.c + +fat_stage1_5_exec-char_io.obj: char_io.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fat_stage1_5_exec_CFLAGS) $(CFLAGS) -MT fat_stage1_5_exec-char_io.obj -MD -MP -MF "$(DEPDIR)/fat_stage1_5_exec-char_io.Tpo" -c -o fat_stage1_5_exec-char_io.obj `if test -f 'char_io.c'; then $(CYGPATH_W) 'char_io.c'; else $(CYGPATH_W) '$(srcdir)/char_io.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/fat_stage1_5_exec-char_io.Tpo" "$(DEPDIR)/fat_stage1_5_exec-char_io.Po"; else rm -f "$(DEPDIR)/fat_stage1_5_exec-char_io.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='char_io.c' object='fat_stage1_5_exec-char_io.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fat_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o fat_stage1_5_exec-char_io.obj `if test -f 'char_io.c'; then $(CYGPATH_W) 'char_io.c'; else $(CYGPATH_W) '$(srcdir)/char_io.c'; fi` + +fat_stage1_5_exec-disk_io.o: disk_io.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fat_stage1_5_exec_CFLAGS) $(CFLAGS) -MT fat_stage1_5_exec-disk_io.o -MD -MP -MF "$(DEPDIR)/fat_stage1_5_exec-disk_io.Tpo" -c -o fat_stage1_5_exec-disk_io.o `test -f 'disk_io.c' || echo '$(srcdir)/'`disk_io.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/fat_stage1_5_exec-disk_io.Tpo" "$(DEPDIR)/fat_stage1_5_exec-disk_io.Po"; else rm -f "$(DEPDIR)/fat_stage1_5_exec-disk_io.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='disk_io.c' object='fat_stage1_5_exec-disk_io.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fat_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o fat_stage1_5_exec-disk_io.o `test -f 'disk_io.c' || echo '$(srcdir)/'`disk_io.c + +fat_stage1_5_exec-disk_io.obj: disk_io.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fat_stage1_5_exec_CFLAGS) $(CFLAGS) -MT fat_stage1_5_exec-disk_io.obj -MD -MP -MF "$(DEPDIR)/fat_stage1_5_exec-disk_io.Tpo" -c -o fat_stage1_5_exec-disk_io.obj `if test -f 'disk_io.c'; then $(CYGPATH_W) 'disk_io.c'; else $(CYGPATH_W) '$(srcdir)/disk_io.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/fat_stage1_5_exec-disk_io.Tpo" "$(DEPDIR)/fat_stage1_5_exec-disk_io.Po"; else rm -f "$(DEPDIR)/fat_stage1_5_exec-disk_io.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='disk_io.c' object='fat_stage1_5_exec-disk_io.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fat_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o fat_stage1_5_exec-disk_io.obj `if test -f 'disk_io.c'; then $(CYGPATH_W) 'disk_io.c'; else $(CYGPATH_W) '$(srcdir)/disk_io.c'; fi` + +fat_stage1_5_exec-stage1_5.o: stage1_5.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fat_stage1_5_exec_CFLAGS) $(CFLAGS) -MT fat_stage1_5_exec-stage1_5.o -MD -MP -MF "$(DEPDIR)/fat_stage1_5_exec-stage1_5.Tpo" -c -o fat_stage1_5_exec-stage1_5.o `test -f 'stage1_5.c' || echo '$(srcdir)/'`stage1_5.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/fat_stage1_5_exec-stage1_5.Tpo" "$(DEPDIR)/fat_stage1_5_exec-stage1_5.Po"; else rm -f "$(DEPDIR)/fat_stage1_5_exec-stage1_5.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='stage1_5.c' object='fat_stage1_5_exec-stage1_5.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fat_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o fat_stage1_5_exec-stage1_5.o `test -f 'stage1_5.c' || echo '$(srcdir)/'`stage1_5.c + +fat_stage1_5_exec-stage1_5.obj: stage1_5.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fat_stage1_5_exec_CFLAGS) $(CFLAGS) -MT fat_stage1_5_exec-stage1_5.obj -MD -MP -MF "$(DEPDIR)/fat_stage1_5_exec-stage1_5.Tpo" -c -o fat_stage1_5_exec-stage1_5.obj `if test -f 'stage1_5.c'; then $(CYGPATH_W) 'stage1_5.c'; else $(CYGPATH_W) '$(srcdir)/stage1_5.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/fat_stage1_5_exec-stage1_5.Tpo" "$(DEPDIR)/fat_stage1_5_exec-stage1_5.Po"; else rm -f "$(DEPDIR)/fat_stage1_5_exec-stage1_5.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='stage1_5.c' object='fat_stage1_5_exec-stage1_5.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fat_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o fat_stage1_5_exec-stage1_5.obj `if test -f 'stage1_5.c'; then $(CYGPATH_W) 'stage1_5.c'; else $(CYGPATH_W) '$(srcdir)/stage1_5.c'; fi` + +fat_stage1_5_exec-fsys_fat.o: fsys_fat.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fat_stage1_5_exec_CFLAGS) $(CFLAGS) -MT fat_stage1_5_exec-fsys_fat.o -MD -MP -MF "$(DEPDIR)/fat_stage1_5_exec-fsys_fat.Tpo" -c -o fat_stage1_5_exec-fsys_fat.o `test -f 'fsys_fat.c' || echo '$(srcdir)/'`fsys_fat.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/fat_stage1_5_exec-fsys_fat.Tpo" "$(DEPDIR)/fat_stage1_5_exec-fsys_fat.Po"; else rm -f "$(DEPDIR)/fat_stage1_5_exec-fsys_fat.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_fat.c' object='fat_stage1_5_exec-fsys_fat.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fat_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o fat_stage1_5_exec-fsys_fat.o `test -f 'fsys_fat.c' || echo '$(srcdir)/'`fsys_fat.c + +fat_stage1_5_exec-fsys_fat.obj: fsys_fat.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fat_stage1_5_exec_CFLAGS) $(CFLAGS) -MT fat_stage1_5_exec-fsys_fat.obj -MD -MP -MF "$(DEPDIR)/fat_stage1_5_exec-fsys_fat.Tpo" -c -o fat_stage1_5_exec-fsys_fat.obj `if test -f 'fsys_fat.c'; then $(CYGPATH_W) 'fsys_fat.c'; else $(CYGPATH_W) '$(srcdir)/fsys_fat.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/fat_stage1_5_exec-fsys_fat.Tpo" "$(DEPDIR)/fat_stage1_5_exec-fsys_fat.Po"; else rm -f "$(DEPDIR)/fat_stage1_5_exec-fsys_fat.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_fat.c' object='fat_stage1_5_exec-fsys_fat.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fat_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o fat_stage1_5_exec-fsys_fat.obj `if test -f 'fsys_fat.c'; then $(CYGPATH_W) 'fsys_fat.c'; else $(CYGPATH_W) '$(srcdir)/fsys_fat.c'; fi` + +fat_stage1_5_exec-bios.o: bios.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fat_stage1_5_exec_CFLAGS) $(CFLAGS) -MT fat_stage1_5_exec-bios.o -MD -MP -MF "$(DEPDIR)/fat_stage1_5_exec-bios.Tpo" -c -o fat_stage1_5_exec-bios.o `test -f 'bios.c' || echo '$(srcdir)/'`bios.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/fat_stage1_5_exec-bios.Tpo" "$(DEPDIR)/fat_stage1_5_exec-bios.Po"; else rm -f "$(DEPDIR)/fat_stage1_5_exec-bios.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bios.c' object='fat_stage1_5_exec-bios.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fat_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o fat_stage1_5_exec-bios.o `test -f 'bios.c' || echo '$(srcdir)/'`bios.c + +fat_stage1_5_exec-bios.obj: bios.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fat_stage1_5_exec_CFLAGS) $(CFLAGS) -MT fat_stage1_5_exec-bios.obj -MD -MP -MF "$(DEPDIR)/fat_stage1_5_exec-bios.Tpo" -c -o fat_stage1_5_exec-bios.obj `if test -f 'bios.c'; then $(CYGPATH_W) 'bios.c'; else $(CYGPATH_W) '$(srcdir)/bios.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/fat_stage1_5_exec-bios.Tpo" "$(DEPDIR)/fat_stage1_5_exec-bios.Po"; else rm -f "$(DEPDIR)/fat_stage1_5_exec-bios.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bios.c' object='fat_stage1_5_exec-bios.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fat_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o fat_stage1_5_exec-bios.obj `if test -f 'bios.c'; then $(CYGPATH_W) 'bios.c'; else $(CYGPATH_W) '$(srcdir)/bios.c'; fi` + +ffs_stage1_5_exec-common.o: common.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ffs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT ffs_stage1_5_exec-common.o -MD -MP -MF "$(DEPDIR)/ffs_stage1_5_exec-common.Tpo" -c -o ffs_stage1_5_exec-common.o `test -f 'common.c' || echo '$(srcdir)/'`common.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ffs_stage1_5_exec-common.Tpo" "$(DEPDIR)/ffs_stage1_5_exec-common.Po"; else rm -f "$(DEPDIR)/ffs_stage1_5_exec-common.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='common.c' object='ffs_stage1_5_exec-common.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ffs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ffs_stage1_5_exec-common.o `test -f 'common.c' || echo '$(srcdir)/'`common.c + +ffs_stage1_5_exec-common.obj: common.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ffs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT ffs_stage1_5_exec-common.obj -MD -MP -MF "$(DEPDIR)/ffs_stage1_5_exec-common.Tpo" -c -o ffs_stage1_5_exec-common.obj `if test -f 'common.c'; then $(CYGPATH_W) 'common.c'; else $(CYGPATH_W) '$(srcdir)/common.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ffs_stage1_5_exec-common.Tpo" "$(DEPDIR)/ffs_stage1_5_exec-common.Po"; else rm -f "$(DEPDIR)/ffs_stage1_5_exec-common.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='common.c' object='ffs_stage1_5_exec-common.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ffs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ffs_stage1_5_exec-common.obj `if test -f 'common.c'; then $(CYGPATH_W) 'common.c'; else $(CYGPATH_W) '$(srcdir)/common.c'; fi` + +ffs_stage1_5_exec-char_io.o: char_io.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ffs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT ffs_stage1_5_exec-char_io.o -MD -MP -MF "$(DEPDIR)/ffs_stage1_5_exec-char_io.Tpo" -c -o ffs_stage1_5_exec-char_io.o `test -f 'char_io.c' || echo '$(srcdir)/'`char_io.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ffs_stage1_5_exec-char_io.Tpo" "$(DEPDIR)/ffs_stage1_5_exec-char_io.Po"; else rm -f "$(DEPDIR)/ffs_stage1_5_exec-char_io.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='char_io.c' object='ffs_stage1_5_exec-char_io.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ffs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ffs_stage1_5_exec-char_io.o `test -f 'char_io.c' || echo '$(srcdir)/'`char_io.c + +ffs_stage1_5_exec-char_io.obj: char_io.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ffs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT ffs_stage1_5_exec-char_io.obj -MD -MP -MF "$(DEPDIR)/ffs_stage1_5_exec-char_io.Tpo" -c -o ffs_stage1_5_exec-char_io.obj `if test -f 'char_io.c'; then $(CYGPATH_W) 'char_io.c'; else $(CYGPATH_W) '$(srcdir)/char_io.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ffs_stage1_5_exec-char_io.Tpo" "$(DEPDIR)/ffs_stage1_5_exec-char_io.Po"; else rm -f "$(DEPDIR)/ffs_stage1_5_exec-char_io.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='char_io.c' object='ffs_stage1_5_exec-char_io.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ffs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ffs_stage1_5_exec-char_io.obj `if test -f 'char_io.c'; then $(CYGPATH_W) 'char_io.c'; else $(CYGPATH_W) '$(srcdir)/char_io.c'; fi` + +ffs_stage1_5_exec-disk_io.o: disk_io.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ffs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT ffs_stage1_5_exec-disk_io.o -MD -MP -MF "$(DEPDIR)/ffs_stage1_5_exec-disk_io.Tpo" -c -o ffs_stage1_5_exec-disk_io.o `test -f 'disk_io.c' || echo '$(srcdir)/'`disk_io.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ffs_stage1_5_exec-disk_io.Tpo" "$(DEPDIR)/ffs_stage1_5_exec-disk_io.Po"; else rm -f "$(DEPDIR)/ffs_stage1_5_exec-disk_io.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='disk_io.c' object='ffs_stage1_5_exec-disk_io.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ffs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ffs_stage1_5_exec-disk_io.o `test -f 'disk_io.c' || echo '$(srcdir)/'`disk_io.c + +ffs_stage1_5_exec-disk_io.obj: disk_io.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ffs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT ffs_stage1_5_exec-disk_io.obj -MD -MP -MF "$(DEPDIR)/ffs_stage1_5_exec-disk_io.Tpo" -c -o ffs_stage1_5_exec-disk_io.obj `if test -f 'disk_io.c'; then $(CYGPATH_W) 'disk_io.c'; else $(CYGPATH_W) '$(srcdir)/disk_io.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ffs_stage1_5_exec-disk_io.Tpo" "$(DEPDIR)/ffs_stage1_5_exec-disk_io.Po"; else rm -f "$(DEPDIR)/ffs_stage1_5_exec-disk_io.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='disk_io.c' object='ffs_stage1_5_exec-disk_io.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ffs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ffs_stage1_5_exec-disk_io.obj `if test -f 'disk_io.c'; then $(CYGPATH_W) 'disk_io.c'; else $(CYGPATH_W) '$(srcdir)/disk_io.c'; fi` + +ffs_stage1_5_exec-stage1_5.o: stage1_5.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ffs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT ffs_stage1_5_exec-stage1_5.o -MD -MP -MF "$(DEPDIR)/ffs_stage1_5_exec-stage1_5.Tpo" -c -o ffs_stage1_5_exec-stage1_5.o `test -f 'stage1_5.c' || echo '$(srcdir)/'`stage1_5.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ffs_stage1_5_exec-stage1_5.Tpo" "$(DEPDIR)/ffs_stage1_5_exec-stage1_5.Po"; else rm -f "$(DEPDIR)/ffs_stage1_5_exec-stage1_5.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='stage1_5.c' object='ffs_stage1_5_exec-stage1_5.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ffs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ffs_stage1_5_exec-stage1_5.o `test -f 'stage1_5.c' || echo '$(srcdir)/'`stage1_5.c + +ffs_stage1_5_exec-stage1_5.obj: stage1_5.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ffs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT ffs_stage1_5_exec-stage1_5.obj -MD -MP -MF "$(DEPDIR)/ffs_stage1_5_exec-stage1_5.Tpo" -c -o ffs_stage1_5_exec-stage1_5.obj `if test -f 'stage1_5.c'; then $(CYGPATH_W) 'stage1_5.c'; else $(CYGPATH_W) '$(srcdir)/stage1_5.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ffs_stage1_5_exec-stage1_5.Tpo" "$(DEPDIR)/ffs_stage1_5_exec-stage1_5.Po"; else rm -f "$(DEPDIR)/ffs_stage1_5_exec-stage1_5.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='stage1_5.c' object='ffs_stage1_5_exec-stage1_5.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ffs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ffs_stage1_5_exec-stage1_5.obj `if test -f 'stage1_5.c'; then $(CYGPATH_W) 'stage1_5.c'; else $(CYGPATH_W) '$(srcdir)/stage1_5.c'; fi` + +ffs_stage1_5_exec-fsys_ffs.o: fsys_ffs.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ffs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT ffs_stage1_5_exec-fsys_ffs.o -MD -MP -MF "$(DEPDIR)/ffs_stage1_5_exec-fsys_ffs.Tpo" -c -o ffs_stage1_5_exec-fsys_ffs.o `test -f 'fsys_ffs.c' || echo '$(srcdir)/'`fsys_ffs.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ffs_stage1_5_exec-fsys_ffs.Tpo" "$(DEPDIR)/ffs_stage1_5_exec-fsys_ffs.Po"; else rm -f "$(DEPDIR)/ffs_stage1_5_exec-fsys_ffs.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_ffs.c' object='ffs_stage1_5_exec-fsys_ffs.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ffs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ffs_stage1_5_exec-fsys_ffs.o `test -f 'fsys_ffs.c' || echo '$(srcdir)/'`fsys_ffs.c + +ffs_stage1_5_exec-fsys_ffs.obj: fsys_ffs.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ffs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT ffs_stage1_5_exec-fsys_ffs.obj -MD -MP -MF "$(DEPDIR)/ffs_stage1_5_exec-fsys_ffs.Tpo" -c -o ffs_stage1_5_exec-fsys_ffs.obj `if test -f 'fsys_ffs.c'; then $(CYGPATH_W) 'fsys_ffs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_ffs.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ffs_stage1_5_exec-fsys_ffs.Tpo" "$(DEPDIR)/ffs_stage1_5_exec-fsys_ffs.Po"; else rm -f "$(DEPDIR)/ffs_stage1_5_exec-fsys_ffs.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_ffs.c' object='ffs_stage1_5_exec-fsys_ffs.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ffs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ffs_stage1_5_exec-fsys_ffs.obj `if test -f 'fsys_ffs.c'; then $(CYGPATH_W) 'fsys_ffs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_ffs.c'; fi` + +ffs_stage1_5_exec-bios.o: bios.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ffs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT ffs_stage1_5_exec-bios.o -MD -MP -MF "$(DEPDIR)/ffs_stage1_5_exec-bios.Tpo" -c -o ffs_stage1_5_exec-bios.o `test -f 'bios.c' || echo '$(srcdir)/'`bios.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ffs_stage1_5_exec-bios.Tpo" "$(DEPDIR)/ffs_stage1_5_exec-bios.Po"; else rm -f "$(DEPDIR)/ffs_stage1_5_exec-bios.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bios.c' object='ffs_stage1_5_exec-bios.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ffs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ffs_stage1_5_exec-bios.o `test -f 'bios.c' || echo '$(srcdir)/'`bios.c + +ffs_stage1_5_exec-bios.obj: bios.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ffs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT ffs_stage1_5_exec-bios.obj -MD -MP -MF "$(DEPDIR)/ffs_stage1_5_exec-bios.Tpo" -c -o ffs_stage1_5_exec-bios.obj `if test -f 'bios.c'; then $(CYGPATH_W) 'bios.c'; else $(CYGPATH_W) '$(srcdir)/bios.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ffs_stage1_5_exec-bios.Tpo" "$(DEPDIR)/ffs_stage1_5_exec-bios.Po"; else rm -f "$(DEPDIR)/ffs_stage1_5_exec-bios.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bios.c' object='ffs_stage1_5_exec-bios.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ffs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ffs_stage1_5_exec-bios.obj `if test -f 'bios.c'; then $(CYGPATH_W) 'bios.c'; else $(CYGPATH_W) '$(srcdir)/bios.c'; fi` + +iso9660_stage1_5_exec-common.o: common.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(iso9660_stage1_5_exec_CFLAGS) $(CFLAGS) -MT iso9660_stage1_5_exec-common.o -MD -MP -MF "$(DEPDIR)/iso9660_stage1_5_exec-common.Tpo" -c -o iso9660_stage1_5_exec-common.o `test -f 'common.c' || echo '$(srcdir)/'`common.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/iso9660_stage1_5_exec-common.Tpo" "$(DEPDIR)/iso9660_stage1_5_exec-common.Po"; else rm -f "$(DEPDIR)/iso9660_stage1_5_exec-common.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='common.c' object='iso9660_stage1_5_exec-common.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(iso9660_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o iso9660_stage1_5_exec-common.o `test -f 'common.c' || echo '$(srcdir)/'`common.c + +iso9660_stage1_5_exec-common.obj: common.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(iso9660_stage1_5_exec_CFLAGS) $(CFLAGS) -MT iso9660_stage1_5_exec-common.obj -MD -MP -MF "$(DEPDIR)/iso9660_stage1_5_exec-common.Tpo" -c -o iso9660_stage1_5_exec-common.obj `if test -f 'common.c'; then $(CYGPATH_W) 'common.c'; else $(CYGPATH_W) '$(srcdir)/common.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/iso9660_stage1_5_exec-common.Tpo" "$(DEPDIR)/iso9660_stage1_5_exec-common.Po"; else rm -f "$(DEPDIR)/iso9660_stage1_5_exec-common.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='common.c' object='iso9660_stage1_5_exec-common.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(iso9660_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o iso9660_stage1_5_exec-common.obj `if test -f 'common.c'; then $(CYGPATH_W) 'common.c'; else $(CYGPATH_W) '$(srcdir)/common.c'; fi` + +iso9660_stage1_5_exec-char_io.o: char_io.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(iso9660_stage1_5_exec_CFLAGS) $(CFLAGS) -MT iso9660_stage1_5_exec-char_io.o -MD -MP -MF "$(DEPDIR)/iso9660_stage1_5_exec-char_io.Tpo" -c -o iso9660_stage1_5_exec-char_io.o `test -f 'char_io.c' || echo '$(srcdir)/'`char_io.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/iso9660_stage1_5_exec-char_io.Tpo" "$(DEPDIR)/iso9660_stage1_5_exec-char_io.Po"; else rm -f "$(DEPDIR)/iso9660_stage1_5_exec-char_io.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='char_io.c' object='iso9660_stage1_5_exec-char_io.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(iso9660_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o iso9660_stage1_5_exec-char_io.o `test -f 'char_io.c' || echo '$(srcdir)/'`char_io.c + +iso9660_stage1_5_exec-char_io.obj: char_io.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(iso9660_stage1_5_exec_CFLAGS) $(CFLAGS) -MT iso9660_stage1_5_exec-char_io.obj -MD -MP -MF "$(DEPDIR)/iso9660_stage1_5_exec-char_io.Tpo" -c -o iso9660_stage1_5_exec-char_io.obj `if test -f 'char_io.c'; then $(CYGPATH_W) 'char_io.c'; else $(CYGPATH_W) '$(srcdir)/char_io.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/iso9660_stage1_5_exec-char_io.Tpo" "$(DEPDIR)/iso9660_stage1_5_exec-char_io.Po"; else rm -f "$(DEPDIR)/iso9660_stage1_5_exec-char_io.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='char_io.c' object='iso9660_stage1_5_exec-char_io.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(iso9660_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o iso9660_stage1_5_exec-char_io.obj `if test -f 'char_io.c'; then $(CYGPATH_W) 'char_io.c'; else $(CYGPATH_W) '$(srcdir)/char_io.c'; fi` + +iso9660_stage1_5_exec-disk_io.o: disk_io.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(iso9660_stage1_5_exec_CFLAGS) $(CFLAGS) -MT iso9660_stage1_5_exec-disk_io.o -MD -MP -MF "$(DEPDIR)/iso9660_stage1_5_exec-disk_io.Tpo" -c -o iso9660_stage1_5_exec-disk_io.o `test -f 'disk_io.c' || echo '$(srcdir)/'`disk_io.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/iso9660_stage1_5_exec-disk_io.Tpo" "$(DEPDIR)/iso9660_stage1_5_exec-disk_io.Po"; else rm -f "$(DEPDIR)/iso9660_stage1_5_exec-disk_io.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='disk_io.c' object='iso9660_stage1_5_exec-disk_io.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(iso9660_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o iso9660_stage1_5_exec-disk_io.o `test -f 'disk_io.c' || echo '$(srcdir)/'`disk_io.c + +iso9660_stage1_5_exec-disk_io.obj: disk_io.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(iso9660_stage1_5_exec_CFLAGS) $(CFLAGS) -MT iso9660_stage1_5_exec-disk_io.obj -MD -MP -MF "$(DEPDIR)/iso9660_stage1_5_exec-disk_io.Tpo" -c -o iso9660_stage1_5_exec-disk_io.obj `if test -f 'disk_io.c'; then $(CYGPATH_W) 'disk_io.c'; else $(CYGPATH_W) '$(srcdir)/disk_io.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/iso9660_stage1_5_exec-disk_io.Tpo" "$(DEPDIR)/iso9660_stage1_5_exec-disk_io.Po"; else rm -f "$(DEPDIR)/iso9660_stage1_5_exec-disk_io.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='disk_io.c' object='iso9660_stage1_5_exec-disk_io.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(iso9660_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o iso9660_stage1_5_exec-disk_io.obj `if test -f 'disk_io.c'; then $(CYGPATH_W) 'disk_io.c'; else $(CYGPATH_W) '$(srcdir)/disk_io.c'; fi` + +iso9660_stage1_5_exec-stage1_5.o: stage1_5.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(iso9660_stage1_5_exec_CFLAGS) $(CFLAGS) -MT iso9660_stage1_5_exec-stage1_5.o -MD -MP -MF "$(DEPDIR)/iso9660_stage1_5_exec-stage1_5.Tpo" -c -o iso9660_stage1_5_exec-stage1_5.o `test -f 'stage1_5.c' || echo '$(srcdir)/'`stage1_5.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/iso9660_stage1_5_exec-stage1_5.Tpo" "$(DEPDIR)/iso9660_stage1_5_exec-stage1_5.Po"; else rm -f "$(DEPDIR)/iso9660_stage1_5_exec-stage1_5.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='stage1_5.c' object='iso9660_stage1_5_exec-stage1_5.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(iso9660_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o iso9660_stage1_5_exec-stage1_5.o `test -f 'stage1_5.c' || echo '$(srcdir)/'`stage1_5.c + +iso9660_stage1_5_exec-stage1_5.obj: stage1_5.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(iso9660_stage1_5_exec_CFLAGS) $(CFLAGS) -MT iso9660_stage1_5_exec-stage1_5.obj -MD -MP -MF "$(DEPDIR)/iso9660_stage1_5_exec-stage1_5.Tpo" -c -o iso9660_stage1_5_exec-stage1_5.obj `if test -f 'stage1_5.c'; then $(CYGPATH_W) 'stage1_5.c'; else $(CYGPATH_W) '$(srcdir)/stage1_5.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/iso9660_stage1_5_exec-stage1_5.Tpo" "$(DEPDIR)/iso9660_stage1_5_exec-stage1_5.Po"; else rm -f "$(DEPDIR)/iso9660_stage1_5_exec-stage1_5.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='stage1_5.c' object='iso9660_stage1_5_exec-stage1_5.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(iso9660_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o iso9660_stage1_5_exec-stage1_5.obj `if test -f 'stage1_5.c'; then $(CYGPATH_W) 'stage1_5.c'; else $(CYGPATH_W) '$(srcdir)/stage1_5.c'; fi` + +iso9660_stage1_5_exec-fsys_iso9660.o: fsys_iso9660.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(iso9660_stage1_5_exec_CFLAGS) $(CFLAGS) -MT iso9660_stage1_5_exec-fsys_iso9660.o -MD -MP -MF "$(DEPDIR)/iso9660_stage1_5_exec-fsys_iso9660.Tpo" -c -o iso9660_stage1_5_exec-fsys_iso9660.o `test -f 'fsys_iso9660.c' || echo '$(srcdir)/'`fsys_iso9660.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/iso9660_stage1_5_exec-fsys_iso9660.Tpo" "$(DEPDIR)/iso9660_stage1_5_exec-fsys_iso9660.Po"; else rm -f "$(DEPDIR)/iso9660_stage1_5_exec-fsys_iso9660.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_iso9660.c' object='iso9660_stage1_5_exec-fsys_iso9660.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(iso9660_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o iso9660_stage1_5_exec-fsys_iso9660.o `test -f 'fsys_iso9660.c' || echo '$(srcdir)/'`fsys_iso9660.c + +iso9660_stage1_5_exec-fsys_iso9660.obj: fsys_iso9660.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(iso9660_stage1_5_exec_CFLAGS) $(CFLAGS) -MT iso9660_stage1_5_exec-fsys_iso9660.obj -MD -MP -MF "$(DEPDIR)/iso9660_stage1_5_exec-fsys_iso9660.Tpo" -c -o iso9660_stage1_5_exec-fsys_iso9660.obj `if test -f 'fsys_iso9660.c'; then $(CYGPATH_W) 'fsys_iso9660.c'; else $(CYGPATH_W) '$(srcdir)/fsys_iso9660.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/iso9660_stage1_5_exec-fsys_iso9660.Tpo" "$(DEPDIR)/iso9660_stage1_5_exec-fsys_iso9660.Po"; else rm -f "$(DEPDIR)/iso9660_stage1_5_exec-fsys_iso9660.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_iso9660.c' object='iso9660_stage1_5_exec-fsys_iso9660.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(iso9660_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o iso9660_stage1_5_exec-fsys_iso9660.obj `if test -f 'fsys_iso9660.c'; then $(CYGPATH_W) 'fsys_iso9660.c'; else $(CYGPATH_W) '$(srcdir)/fsys_iso9660.c'; fi` + +iso9660_stage1_5_exec-bios.o: bios.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(iso9660_stage1_5_exec_CFLAGS) $(CFLAGS) -MT iso9660_stage1_5_exec-bios.o -MD -MP -MF "$(DEPDIR)/iso9660_stage1_5_exec-bios.Tpo" -c -o iso9660_stage1_5_exec-bios.o `test -f 'bios.c' || echo '$(srcdir)/'`bios.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/iso9660_stage1_5_exec-bios.Tpo" "$(DEPDIR)/iso9660_stage1_5_exec-bios.Po"; else rm -f "$(DEPDIR)/iso9660_stage1_5_exec-bios.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bios.c' object='iso9660_stage1_5_exec-bios.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(iso9660_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o iso9660_stage1_5_exec-bios.o `test -f 'bios.c' || echo '$(srcdir)/'`bios.c + +iso9660_stage1_5_exec-bios.obj: bios.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(iso9660_stage1_5_exec_CFLAGS) $(CFLAGS) -MT iso9660_stage1_5_exec-bios.obj -MD -MP -MF "$(DEPDIR)/iso9660_stage1_5_exec-bios.Tpo" -c -o iso9660_stage1_5_exec-bios.obj `if test -f 'bios.c'; then $(CYGPATH_W) 'bios.c'; else $(CYGPATH_W) '$(srcdir)/bios.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/iso9660_stage1_5_exec-bios.Tpo" "$(DEPDIR)/iso9660_stage1_5_exec-bios.Po"; else rm -f "$(DEPDIR)/iso9660_stage1_5_exec-bios.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bios.c' object='iso9660_stage1_5_exec-bios.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(iso9660_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o iso9660_stage1_5_exec-bios.obj `if test -f 'bios.c'; then $(CYGPATH_W) 'bios.c'; else $(CYGPATH_W) '$(srcdir)/bios.c'; fi` + +jfs_stage1_5_exec-common.o: common.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(jfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT jfs_stage1_5_exec-common.o -MD -MP -MF "$(DEPDIR)/jfs_stage1_5_exec-common.Tpo" -c -o jfs_stage1_5_exec-common.o `test -f 'common.c' || echo '$(srcdir)/'`common.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/jfs_stage1_5_exec-common.Tpo" "$(DEPDIR)/jfs_stage1_5_exec-common.Po"; else rm -f "$(DEPDIR)/jfs_stage1_5_exec-common.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='common.c' object='jfs_stage1_5_exec-common.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(jfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o jfs_stage1_5_exec-common.o `test -f 'common.c' || echo '$(srcdir)/'`common.c + +jfs_stage1_5_exec-common.obj: common.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(jfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT jfs_stage1_5_exec-common.obj -MD -MP -MF "$(DEPDIR)/jfs_stage1_5_exec-common.Tpo" -c -o jfs_stage1_5_exec-common.obj `if test -f 'common.c'; then $(CYGPATH_W) 'common.c'; else $(CYGPATH_W) '$(srcdir)/common.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/jfs_stage1_5_exec-common.Tpo" "$(DEPDIR)/jfs_stage1_5_exec-common.Po"; else rm -f "$(DEPDIR)/jfs_stage1_5_exec-common.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='common.c' object='jfs_stage1_5_exec-common.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(jfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o jfs_stage1_5_exec-common.obj `if test -f 'common.c'; then $(CYGPATH_W) 'common.c'; else $(CYGPATH_W) '$(srcdir)/common.c'; fi` + +jfs_stage1_5_exec-char_io.o: char_io.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(jfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT jfs_stage1_5_exec-char_io.o -MD -MP -MF "$(DEPDIR)/jfs_stage1_5_exec-char_io.Tpo" -c -o jfs_stage1_5_exec-char_io.o `test -f 'char_io.c' || echo '$(srcdir)/'`char_io.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/jfs_stage1_5_exec-char_io.Tpo" "$(DEPDIR)/jfs_stage1_5_exec-char_io.Po"; else rm -f "$(DEPDIR)/jfs_stage1_5_exec-char_io.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='char_io.c' object='jfs_stage1_5_exec-char_io.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(jfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o jfs_stage1_5_exec-char_io.o `test -f 'char_io.c' || echo '$(srcdir)/'`char_io.c + +jfs_stage1_5_exec-char_io.obj: char_io.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(jfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT jfs_stage1_5_exec-char_io.obj -MD -MP -MF "$(DEPDIR)/jfs_stage1_5_exec-char_io.Tpo" -c -o jfs_stage1_5_exec-char_io.obj `if test -f 'char_io.c'; then $(CYGPATH_W) 'char_io.c'; else $(CYGPATH_W) '$(srcdir)/char_io.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/jfs_stage1_5_exec-char_io.Tpo" "$(DEPDIR)/jfs_stage1_5_exec-char_io.Po"; else rm -f "$(DEPDIR)/jfs_stage1_5_exec-char_io.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='char_io.c' object='jfs_stage1_5_exec-char_io.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(jfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o jfs_stage1_5_exec-char_io.obj `if test -f 'char_io.c'; then $(CYGPATH_W) 'char_io.c'; else $(CYGPATH_W) '$(srcdir)/char_io.c'; fi` + +jfs_stage1_5_exec-disk_io.o: disk_io.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(jfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT jfs_stage1_5_exec-disk_io.o -MD -MP -MF "$(DEPDIR)/jfs_stage1_5_exec-disk_io.Tpo" -c -o jfs_stage1_5_exec-disk_io.o `test -f 'disk_io.c' || echo '$(srcdir)/'`disk_io.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/jfs_stage1_5_exec-disk_io.Tpo" "$(DEPDIR)/jfs_stage1_5_exec-disk_io.Po"; else rm -f "$(DEPDIR)/jfs_stage1_5_exec-disk_io.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='disk_io.c' object='jfs_stage1_5_exec-disk_io.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(jfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o jfs_stage1_5_exec-disk_io.o `test -f 'disk_io.c' || echo '$(srcdir)/'`disk_io.c + +jfs_stage1_5_exec-disk_io.obj: disk_io.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(jfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT jfs_stage1_5_exec-disk_io.obj -MD -MP -MF "$(DEPDIR)/jfs_stage1_5_exec-disk_io.Tpo" -c -o jfs_stage1_5_exec-disk_io.obj `if test -f 'disk_io.c'; then $(CYGPATH_W) 'disk_io.c'; else $(CYGPATH_W) '$(srcdir)/disk_io.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/jfs_stage1_5_exec-disk_io.Tpo" "$(DEPDIR)/jfs_stage1_5_exec-disk_io.Po"; else rm -f "$(DEPDIR)/jfs_stage1_5_exec-disk_io.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='disk_io.c' object='jfs_stage1_5_exec-disk_io.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(jfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o jfs_stage1_5_exec-disk_io.obj `if test -f 'disk_io.c'; then $(CYGPATH_W) 'disk_io.c'; else $(CYGPATH_W) '$(srcdir)/disk_io.c'; fi` + +jfs_stage1_5_exec-stage1_5.o: stage1_5.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(jfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT jfs_stage1_5_exec-stage1_5.o -MD -MP -MF "$(DEPDIR)/jfs_stage1_5_exec-stage1_5.Tpo" -c -o jfs_stage1_5_exec-stage1_5.o `test -f 'stage1_5.c' || echo '$(srcdir)/'`stage1_5.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/jfs_stage1_5_exec-stage1_5.Tpo" "$(DEPDIR)/jfs_stage1_5_exec-stage1_5.Po"; else rm -f "$(DEPDIR)/jfs_stage1_5_exec-stage1_5.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='stage1_5.c' object='jfs_stage1_5_exec-stage1_5.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(jfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o jfs_stage1_5_exec-stage1_5.o `test -f 'stage1_5.c' || echo '$(srcdir)/'`stage1_5.c + +jfs_stage1_5_exec-stage1_5.obj: stage1_5.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(jfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT jfs_stage1_5_exec-stage1_5.obj -MD -MP -MF "$(DEPDIR)/jfs_stage1_5_exec-stage1_5.Tpo" -c -o jfs_stage1_5_exec-stage1_5.obj `if test -f 'stage1_5.c'; then $(CYGPATH_W) 'stage1_5.c'; else $(CYGPATH_W) '$(srcdir)/stage1_5.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/jfs_stage1_5_exec-stage1_5.Tpo" "$(DEPDIR)/jfs_stage1_5_exec-stage1_5.Po"; else rm -f "$(DEPDIR)/jfs_stage1_5_exec-stage1_5.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='stage1_5.c' object='jfs_stage1_5_exec-stage1_5.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(jfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o jfs_stage1_5_exec-stage1_5.obj `if test -f 'stage1_5.c'; then $(CYGPATH_W) 'stage1_5.c'; else $(CYGPATH_W) '$(srcdir)/stage1_5.c'; fi` + +jfs_stage1_5_exec-fsys_jfs.o: fsys_jfs.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(jfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT jfs_stage1_5_exec-fsys_jfs.o -MD -MP -MF "$(DEPDIR)/jfs_stage1_5_exec-fsys_jfs.Tpo" -c -o jfs_stage1_5_exec-fsys_jfs.o `test -f 'fsys_jfs.c' || echo '$(srcdir)/'`fsys_jfs.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/jfs_stage1_5_exec-fsys_jfs.Tpo" "$(DEPDIR)/jfs_stage1_5_exec-fsys_jfs.Po"; else rm -f "$(DEPDIR)/jfs_stage1_5_exec-fsys_jfs.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_jfs.c' object='jfs_stage1_5_exec-fsys_jfs.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(jfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o jfs_stage1_5_exec-fsys_jfs.o `test -f 'fsys_jfs.c' || echo '$(srcdir)/'`fsys_jfs.c + +jfs_stage1_5_exec-fsys_jfs.obj: fsys_jfs.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(jfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT jfs_stage1_5_exec-fsys_jfs.obj -MD -MP -MF "$(DEPDIR)/jfs_stage1_5_exec-fsys_jfs.Tpo" -c -o jfs_stage1_5_exec-fsys_jfs.obj `if test -f 'fsys_jfs.c'; then $(CYGPATH_W) 'fsys_jfs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_jfs.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/jfs_stage1_5_exec-fsys_jfs.Tpo" "$(DEPDIR)/jfs_stage1_5_exec-fsys_jfs.Po"; else rm -f "$(DEPDIR)/jfs_stage1_5_exec-fsys_jfs.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_jfs.c' object='jfs_stage1_5_exec-fsys_jfs.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(jfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o jfs_stage1_5_exec-fsys_jfs.obj `if test -f 'fsys_jfs.c'; then $(CYGPATH_W) 'fsys_jfs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_jfs.c'; fi` + +jfs_stage1_5_exec-bios.o: bios.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(jfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT jfs_stage1_5_exec-bios.o -MD -MP -MF "$(DEPDIR)/jfs_stage1_5_exec-bios.Tpo" -c -o jfs_stage1_5_exec-bios.o `test -f 'bios.c' || echo '$(srcdir)/'`bios.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/jfs_stage1_5_exec-bios.Tpo" "$(DEPDIR)/jfs_stage1_5_exec-bios.Po"; else rm -f "$(DEPDIR)/jfs_stage1_5_exec-bios.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bios.c' object='jfs_stage1_5_exec-bios.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(jfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o jfs_stage1_5_exec-bios.o `test -f 'bios.c' || echo '$(srcdir)/'`bios.c + +jfs_stage1_5_exec-bios.obj: bios.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(jfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT jfs_stage1_5_exec-bios.obj -MD -MP -MF "$(DEPDIR)/jfs_stage1_5_exec-bios.Tpo" -c -o jfs_stage1_5_exec-bios.obj `if test -f 'bios.c'; then $(CYGPATH_W) 'bios.c'; else $(CYGPATH_W) '$(srcdir)/bios.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/jfs_stage1_5_exec-bios.Tpo" "$(DEPDIR)/jfs_stage1_5_exec-bios.Po"; else rm -f "$(DEPDIR)/jfs_stage1_5_exec-bios.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bios.c' object='jfs_stage1_5_exec-bios.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(jfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o jfs_stage1_5_exec-bios.obj `if test -f 'bios.c'; then $(CYGPATH_W) 'bios.c'; else $(CYGPATH_W) '$(srcdir)/bios.c'; fi` + +minix_stage1_5_exec-common.o: common.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -MT minix_stage1_5_exec-common.o -MD -MP -MF "$(DEPDIR)/minix_stage1_5_exec-common.Tpo" -c -o minix_stage1_5_exec-common.o `test -f 'common.c' || echo '$(srcdir)/'`common.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/minix_stage1_5_exec-common.Tpo" "$(DEPDIR)/minix_stage1_5_exec-common.Po"; else rm -f "$(DEPDIR)/minix_stage1_5_exec-common.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='common.c' object='minix_stage1_5_exec-common.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o minix_stage1_5_exec-common.o `test -f 'common.c' || echo '$(srcdir)/'`common.c + +minix_stage1_5_exec-common.obj: common.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -MT minix_stage1_5_exec-common.obj -MD -MP -MF "$(DEPDIR)/minix_stage1_5_exec-common.Tpo" -c -o minix_stage1_5_exec-common.obj `if test -f 'common.c'; then $(CYGPATH_W) 'common.c'; else $(CYGPATH_W) '$(srcdir)/common.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/minix_stage1_5_exec-common.Tpo" "$(DEPDIR)/minix_stage1_5_exec-common.Po"; else rm -f "$(DEPDIR)/minix_stage1_5_exec-common.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='common.c' object='minix_stage1_5_exec-common.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o minix_stage1_5_exec-common.obj `if test -f 'common.c'; then $(CYGPATH_W) 'common.c'; else $(CYGPATH_W) '$(srcdir)/common.c'; fi` + +minix_stage1_5_exec-char_io.o: char_io.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -MT minix_stage1_5_exec-char_io.o -MD -MP -MF "$(DEPDIR)/minix_stage1_5_exec-char_io.Tpo" -c -o minix_stage1_5_exec-char_io.o `test -f 'char_io.c' || echo '$(srcdir)/'`char_io.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/minix_stage1_5_exec-char_io.Tpo" "$(DEPDIR)/minix_stage1_5_exec-char_io.Po"; else rm -f "$(DEPDIR)/minix_stage1_5_exec-char_io.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='char_io.c' object='minix_stage1_5_exec-char_io.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o minix_stage1_5_exec-char_io.o `test -f 'char_io.c' || echo '$(srcdir)/'`char_io.c + +minix_stage1_5_exec-char_io.obj: char_io.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -MT minix_stage1_5_exec-char_io.obj -MD -MP -MF "$(DEPDIR)/minix_stage1_5_exec-char_io.Tpo" -c -o minix_stage1_5_exec-char_io.obj `if test -f 'char_io.c'; then $(CYGPATH_W) 'char_io.c'; else $(CYGPATH_W) '$(srcdir)/char_io.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/minix_stage1_5_exec-char_io.Tpo" "$(DEPDIR)/minix_stage1_5_exec-char_io.Po"; else rm -f "$(DEPDIR)/minix_stage1_5_exec-char_io.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='char_io.c' object='minix_stage1_5_exec-char_io.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o minix_stage1_5_exec-char_io.obj `if test -f 'char_io.c'; then $(CYGPATH_W) 'char_io.c'; else $(CYGPATH_W) '$(srcdir)/char_io.c'; fi` + +minix_stage1_5_exec-disk_io.o: disk_io.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -MT minix_stage1_5_exec-disk_io.o -MD -MP -MF "$(DEPDIR)/minix_stage1_5_exec-disk_io.Tpo" -c -o minix_stage1_5_exec-disk_io.o `test -f 'disk_io.c' || echo '$(srcdir)/'`disk_io.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/minix_stage1_5_exec-disk_io.Tpo" "$(DEPDIR)/minix_stage1_5_exec-disk_io.Po"; else rm -f "$(DEPDIR)/minix_stage1_5_exec-disk_io.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='disk_io.c' object='minix_stage1_5_exec-disk_io.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o minix_stage1_5_exec-disk_io.o `test -f 'disk_io.c' || echo '$(srcdir)/'`disk_io.c + +minix_stage1_5_exec-disk_io.obj: disk_io.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -MT minix_stage1_5_exec-disk_io.obj -MD -MP -MF "$(DEPDIR)/minix_stage1_5_exec-disk_io.Tpo" -c -o minix_stage1_5_exec-disk_io.obj `if test -f 'disk_io.c'; then $(CYGPATH_W) 'disk_io.c'; else $(CYGPATH_W) '$(srcdir)/disk_io.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/minix_stage1_5_exec-disk_io.Tpo" "$(DEPDIR)/minix_stage1_5_exec-disk_io.Po"; else rm -f "$(DEPDIR)/minix_stage1_5_exec-disk_io.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='disk_io.c' object='minix_stage1_5_exec-disk_io.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o minix_stage1_5_exec-disk_io.obj `if test -f 'disk_io.c'; then $(CYGPATH_W) 'disk_io.c'; else $(CYGPATH_W) '$(srcdir)/disk_io.c'; fi` + +minix_stage1_5_exec-stage1_5.o: stage1_5.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -MT minix_stage1_5_exec-stage1_5.o -MD -MP -MF "$(DEPDIR)/minix_stage1_5_exec-stage1_5.Tpo" -c -o minix_stage1_5_exec-stage1_5.o `test -f 'stage1_5.c' || echo '$(srcdir)/'`stage1_5.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/minix_stage1_5_exec-stage1_5.Tpo" "$(DEPDIR)/minix_stage1_5_exec-stage1_5.Po"; else rm -f "$(DEPDIR)/minix_stage1_5_exec-stage1_5.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='stage1_5.c' object='minix_stage1_5_exec-stage1_5.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o minix_stage1_5_exec-stage1_5.o `test -f 'stage1_5.c' || echo '$(srcdir)/'`stage1_5.c + +minix_stage1_5_exec-stage1_5.obj: stage1_5.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -MT minix_stage1_5_exec-stage1_5.obj -MD -MP -MF "$(DEPDIR)/minix_stage1_5_exec-stage1_5.Tpo" -c -o minix_stage1_5_exec-stage1_5.obj `if test -f 'stage1_5.c'; then $(CYGPATH_W) 'stage1_5.c'; else $(CYGPATH_W) '$(srcdir)/stage1_5.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/minix_stage1_5_exec-stage1_5.Tpo" "$(DEPDIR)/minix_stage1_5_exec-stage1_5.Po"; else rm -f "$(DEPDIR)/minix_stage1_5_exec-stage1_5.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='stage1_5.c' object='minix_stage1_5_exec-stage1_5.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o minix_stage1_5_exec-stage1_5.obj `if test -f 'stage1_5.c'; then $(CYGPATH_W) 'stage1_5.c'; else $(CYGPATH_W) '$(srcdir)/stage1_5.c'; fi` + +minix_stage1_5_exec-fsys_minix.o: fsys_minix.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -MT minix_stage1_5_exec-fsys_minix.o -MD -MP -MF "$(DEPDIR)/minix_stage1_5_exec-fsys_minix.Tpo" -c -o minix_stage1_5_exec-fsys_minix.o `test -f 'fsys_minix.c' || echo '$(srcdir)/'`fsys_minix.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/minix_stage1_5_exec-fsys_minix.Tpo" "$(DEPDIR)/minix_stage1_5_exec-fsys_minix.Po"; else rm -f "$(DEPDIR)/minix_stage1_5_exec-fsys_minix.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_minix.c' object='minix_stage1_5_exec-fsys_minix.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o minix_stage1_5_exec-fsys_minix.o `test -f 'fsys_minix.c' || echo '$(srcdir)/'`fsys_minix.c + +minix_stage1_5_exec-fsys_minix.obj: fsys_minix.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -MT minix_stage1_5_exec-fsys_minix.obj -MD -MP -MF "$(DEPDIR)/minix_stage1_5_exec-fsys_minix.Tpo" -c -o minix_stage1_5_exec-fsys_minix.obj `if test -f 'fsys_minix.c'; then $(CYGPATH_W) 'fsys_minix.c'; else $(CYGPATH_W) '$(srcdir)/fsys_minix.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/minix_stage1_5_exec-fsys_minix.Tpo" "$(DEPDIR)/minix_stage1_5_exec-fsys_minix.Po"; else rm -f "$(DEPDIR)/minix_stage1_5_exec-fsys_minix.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_minix.c' object='minix_stage1_5_exec-fsys_minix.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o minix_stage1_5_exec-fsys_minix.obj `if test -f 'fsys_minix.c'; then $(CYGPATH_W) 'fsys_minix.c'; else $(CYGPATH_W) '$(srcdir)/fsys_minix.c'; fi` + +minix_stage1_5_exec-bios.o: bios.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -MT minix_stage1_5_exec-bios.o -MD -MP -MF "$(DEPDIR)/minix_stage1_5_exec-bios.Tpo" -c -o minix_stage1_5_exec-bios.o `test -f 'bios.c' || echo '$(srcdir)/'`bios.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/minix_stage1_5_exec-bios.Tpo" "$(DEPDIR)/minix_stage1_5_exec-bios.Po"; else rm -f "$(DEPDIR)/minix_stage1_5_exec-bios.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bios.c' object='minix_stage1_5_exec-bios.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o minix_stage1_5_exec-bios.o `test -f 'bios.c' || echo '$(srcdir)/'`bios.c + +minix_stage1_5_exec-bios.obj: bios.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -MT minix_stage1_5_exec-bios.obj -MD -MP -MF "$(DEPDIR)/minix_stage1_5_exec-bios.Tpo" -c -o minix_stage1_5_exec-bios.obj `if test -f 'bios.c'; then $(CYGPATH_W) 'bios.c'; else $(CYGPATH_W) '$(srcdir)/bios.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/minix_stage1_5_exec-bios.Tpo" "$(DEPDIR)/minix_stage1_5_exec-bios.Po"; else rm -f "$(DEPDIR)/minix_stage1_5_exec-bios.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bios.c' object='minix_stage1_5_exec-bios.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o minix_stage1_5_exec-bios.obj `if test -f 'bios.c'; then $(CYGPATH_W) 'bios.c'; else $(CYGPATH_W) '$(srcdir)/bios.c'; fi` + +pre_stage2_exec-bios.o: bios.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-bios.o -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-bios.Tpo" -c -o pre_stage2_exec-bios.o `test -f 'bios.c' || echo '$(srcdir)/'`bios.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-bios.Tpo" "$(DEPDIR)/pre_stage2_exec-bios.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-bios.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bios.c' object='pre_stage2_exec-bios.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-bios.o `test -f 'bios.c' || echo '$(srcdir)/'`bios.c + +pre_stage2_exec-bios.obj: bios.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-bios.obj -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-bios.Tpo" -c -o pre_stage2_exec-bios.obj `if test -f 'bios.c'; then $(CYGPATH_W) 'bios.c'; else $(CYGPATH_W) '$(srcdir)/bios.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-bios.Tpo" "$(DEPDIR)/pre_stage2_exec-bios.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-bios.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bios.c' object='pre_stage2_exec-bios.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-bios.obj `if test -f 'bios.c'; then $(CYGPATH_W) 'bios.c'; else $(CYGPATH_W) '$(srcdir)/bios.c'; fi` + +pre_stage2_exec-boot.o: boot.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-boot.o -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-boot.Tpo" -c -o pre_stage2_exec-boot.o `test -f 'boot.c' || echo '$(srcdir)/'`boot.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-boot.Tpo" "$(DEPDIR)/pre_stage2_exec-boot.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-boot.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='boot.c' object='pre_stage2_exec-boot.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-boot.o `test -f 'boot.c' || echo '$(srcdir)/'`boot.c + +pre_stage2_exec-boot.obj: boot.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-boot.obj -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-boot.Tpo" -c -o pre_stage2_exec-boot.obj `if test -f 'boot.c'; then $(CYGPATH_W) 'boot.c'; else $(CYGPATH_W) '$(srcdir)/boot.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-boot.Tpo" "$(DEPDIR)/pre_stage2_exec-boot.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-boot.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='boot.c' object='pre_stage2_exec-boot.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-boot.obj `if test -f 'boot.c'; then $(CYGPATH_W) 'boot.c'; else $(CYGPATH_W) '$(srcdir)/boot.c'; fi` + +pre_stage2_exec-builtins.o: builtins.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-builtins.o -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-builtins.Tpo" -c -o pre_stage2_exec-builtins.o `test -f 'builtins.c' || echo '$(srcdir)/'`builtins.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-builtins.Tpo" "$(DEPDIR)/pre_stage2_exec-builtins.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-builtins.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='builtins.c' object='pre_stage2_exec-builtins.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-builtins.o `test -f 'builtins.c' || echo '$(srcdir)/'`builtins.c + +pre_stage2_exec-builtins.obj: builtins.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-builtins.obj -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-builtins.Tpo" -c -o pre_stage2_exec-builtins.obj `if test -f 'builtins.c'; then $(CYGPATH_W) 'builtins.c'; else $(CYGPATH_W) '$(srcdir)/builtins.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-builtins.Tpo" "$(DEPDIR)/pre_stage2_exec-builtins.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-builtins.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='builtins.c' object='pre_stage2_exec-builtins.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-builtins.obj `if test -f 'builtins.c'; then $(CYGPATH_W) 'builtins.c'; else $(CYGPATH_W) '$(srcdir)/builtins.c'; fi` + +pre_stage2_exec-char_io.o: char_io.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-char_io.o -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-char_io.Tpo" -c -o pre_stage2_exec-char_io.o `test -f 'char_io.c' || echo '$(srcdir)/'`char_io.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-char_io.Tpo" "$(DEPDIR)/pre_stage2_exec-char_io.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-char_io.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='char_io.c' object='pre_stage2_exec-char_io.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-char_io.o `test -f 'char_io.c' || echo '$(srcdir)/'`char_io.c + +pre_stage2_exec-char_io.obj: char_io.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-char_io.obj -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-char_io.Tpo" -c -o pre_stage2_exec-char_io.obj `if test -f 'char_io.c'; then $(CYGPATH_W) 'char_io.c'; else $(CYGPATH_W) '$(srcdir)/char_io.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-char_io.Tpo" "$(DEPDIR)/pre_stage2_exec-char_io.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-char_io.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='char_io.c' object='pre_stage2_exec-char_io.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-char_io.obj `if test -f 'char_io.c'; then $(CYGPATH_W) 'char_io.c'; else $(CYGPATH_W) '$(srcdir)/char_io.c'; fi` + +pre_stage2_exec-cmdline.o: cmdline.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-cmdline.o -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-cmdline.Tpo" -c -o pre_stage2_exec-cmdline.o `test -f 'cmdline.c' || echo '$(srcdir)/'`cmdline.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-cmdline.Tpo" "$(DEPDIR)/pre_stage2_exec-cmdline.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-cmdline.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cmdline.c' object='pre_stage2_exec-cmdline.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-cmdline.o `test -f 'cmdline.c' || echo '$(srcdir)/'`cmdline.c + +pre_stage2_exec-cmdline.obj: cmdline.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-cmdline.obj -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-cmdline.Tpo" -c -o pre_stage2_exec-cmdline.obj `if test -f 'cmdline.c'; then $(CYGPATH_W) 'cmdline.c'; else $(CYGPATH_W) '$(srcdir)/cmdline.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-cmdline.Tpo" "$(DEPDIR)/pre_stage2_exec-cmdline.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-cmdline.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cmdline.c' object='pre_stage2_exec-cmdline.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-cmdline.obj `if test -f 'cmdline.c'; then $(CYGPATH_W) 'cmdline.c'; else $(CYGPATH_W) '$(srcdir)/cmdline.c'; fi` + +pre_stage2_exec-common.o: common.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-common.o -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-common.Tpo" -c -o pre_stage2_exec-common.o `test -f 'common.c' || echo '$(srcdir)/'`common.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-common.Tpo" "$(DEPDIR)/pre_stage2_exec-common.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-common.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='common.c' object='pre_stage2_exec-common.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-common.o `test -f 'common.c' || echo '$(srcdir)/'`common.c + +pre_stage2_exec-common.obj: common.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-common.obj -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-common.Tpo" -c -o pre_stage2_exec-common.obj `if test -f 'common.c'; then $(CYGPATH_W) 'common.c'; else $(CYGPATH_W) '$(srcdir)/common.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-common.Tpo" "$(DEPDIR)/pre_stage2_exec-common.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-common.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='common.c' object='pre_stage2_exec-common.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-common.obj `if test -f 'common.c'; then $(CYGPATH_W) 'common.c'; else $(CYGPATH_W) '$(srcdir)/common.c'; fi` + +pre_stage2_exec-console.o: console.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-console.o -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-console.Tpo" -c -o pre_stage2_exec-console.o `test -f 'console.c' || echo '$(srcdir)/'`console.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-console.Tpo" "$(DEPDIR)/pre_stage2_exec-console.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-console.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='console.c' object='pre_stage2_exec-console.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-console.o `test -f 'console.c' || echo '$(srcdir)/'`console.c + +pre_stage2_exec-console.obj: console.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-console.obj -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-console.Tpo" -c -o pre_stage2_exec-console.obj `if test -f 'console.c'; then $(CYGPATH_W) 'console.c'; else $(CYGPATH_W) '$(srcdir)/console.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-console.Tpo" "$(DEPDIR)/pre_stage2_exec-console.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-console.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='console.c' object='pre_stage2_exec-console.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-console.obj `if test -f 'console.c'; then $(CYGPATH_W) 'console.c'; else $(CYGPATH_W) '$(srcdir)/console.c'; fi` + +pre_stage2_exec-disk_io.o: disk_io.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-disk_io.o -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-disk_io.Tpo" -c -o pre_stage2_exec-disk_io.o `test -f 'disk_io.c' || echo '$(srcdir)/'`disk_io.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-disk_io.Tpo" "$(DEPDIR)/pre_stage2_exec-disk_io.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-disk_io.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='disk_io.c' object='pre_stage2_exec-disk_io.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-disk_io.o `test -f 'disk_io.c' || echo '$(srcdir)/'`disk_io.c + +pre_stage2_exec-disk_io.obj: disk_io.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-disk_io.obj -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-disk_io.Tpo" -c -o pre_stage2_exec-disk_io.obj `if test -f 'disk_io.c'; then $(CYGPATH_W) 'disk_io.c'; else $(CYGPATH_W) '$(srcdir)/disk_io.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-disk_io.Tpo" "$(DEPDIR)/pre_stage2_exec-disk_io.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-disk_io.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='disk_io.c' object='pre_stage2_exec-disk_io.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-disk_io.obj `if test -f 'disk_io.c'; then $(CYGPATH_W) 'disk_io.c'; else $(CYGPATH_W) '$(srcdir)/disk_io.c'; fi` + +pre_stage2_exec-fsys_ext2fs.o: fsys_ext2fs.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-fsys_ext2fs.o -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-fsys_ext2fs.Tpo" -c -o pre_stage2_exec-fsys_ext2fs.o `test -f 'fsys_ext2fs.c' || echo '$(srcdir)/'`fsys_ext2fs.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-fsys_ext2fs.Tpo" "$(DEPDIR)/pre_stage2_exec-fsys_ext2fs.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-fsys_ext2fs.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_ext2fs.c' object='pre_stage2_exec-fsys_ext2fs.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-fsys_ext2fs.o `test -f 'fsys_ext2fs.c' || echo '$(srcdir)/'`fsys_ext2fs.c + +pre_stage2_exec-fsys_ext2fs.obj: fsys_ext2fs.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-fsys_ext2fs.obj -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-fsys_ext2fs.Tpo" -c -o pre_stage2_exec-fsys_ext2fs.obj `if test -f 'fsys_ext2fs.c'; then $(CYGPATH_W) 'fsys_ext2fs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_ext2fs.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-fsys_ext2fs.Tpo" "$(DEPDIR)/pre_stage2_exec-fsys_ext2fs.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-fsys_ext2fs.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_ext2fs.c' object='pre_stage2_exec-fsys_ext2fs.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-fsys_ext2fs.obj `if test -f 'fsys_ext2fs.c'; then $(CYGPATH_W) 'fsys_ext2fs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_ext2fs.c'; fi` + +pre_stage2_exec-fsys_fat.o: fsys_fat.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-fsys_fat.o -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-fsys_fat.Tpo" -c -o pre_stage2_exec-fsys_fat.o `test -f 'fsys_fat.c' || echo '$(srcdir)/'`fsys_fat.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-fsys_fat.Tpo" "$(DEPDIR)/pre_stage2_exec-fsys_fat.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-fsys_fat.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_fat.c' object='pre_stage2_exec-fsys_fat.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-fsys_fat.o `test -f 'fsys_fat.c' || echo '$(srcdir)/'`fsys_fat.c + +pre_stage2_exec-fsys_fat.obj: fsys_fat.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-fsys_fat.obj -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-fsys_fat.Tpo" -c -o pre_stage2_exec-fsys_fat.obj `if test -f 'fsys_fat.c'; then $(CYGPATH_W) 'fsys_fat.c'; else $(CYGPATH_W) '$(srcdir)/fsys_fat.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-fsys_fat.Tpo" "$(DEPDIR)/pre_stage2_exec-fsys_fat.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-fsys_fat.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_fat.c' object='pre_stage2_exec-fsys_fat.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-fsys_fat.obj `if test -f 'fsys_fat.c'; then $(CYGPATH_W) 'fsys_fat.c'; else $(CYGPATH_W) '$(srcdir)/fsys_fat.c'; fi` + +pre_stage2_exec-fsys_ffs.o: fsys_ffs.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-fsys_ffs.o -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-fsys_ffs.Tpo" -c -o pre_stage2_exec-fsys_ffs.o `test -f 'fsys_ffs.c' || echo '$(srcdir)/'`fsys_ffs.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-fsys_ffs.Tpo" "$(DEPDIR)/pre_stage2_exec-fsys_ffs.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-fsys_ffs.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_ffs.c' object='pre_stage2_exec-fsys_ffs.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-fsys_ffs.o `test -f 'fsys_ffs.c' || echo '$(srcdir)/'`fsys_ffs.c + +pre_stage2_exec-fsys_ffs.obj: fsys_ffs.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-fsys_ffs.obj -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-fsys_ffs.Tpo" -c -o pre_stage2_exec-fsys_ffs.obj `if test -f 'fsys_ffs.c'; then $(CYGPATH_W) 'fsys_ffs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_ffs.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-fsys_ffs.Tpo" "$(DEPDIR)/pre_stage2_exec-fsys_ffs.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-fsys_ffs.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_ffs.c' object='pre_stage2_exec-fsys_ffs.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-fsys_ffs.obj `if test -f 'fsys_ffs.c'; then $(CYGPATH_W) 'fsys_ffs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_ffs.c'; fi` + +pre_stage2_exec-fsys_iso9660.o: fsys_iso9660.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-fsys_iso9660.o -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-fsys_iso9660.Tpo" -c -o pre_stage2_exec-fsys_iso9660.o `test -f 'fsys_iso9660.c' || echo '$(srcdir)/'`fsys_iso9660.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-fsys_iso9660.Tpo" "$(DEPDIR)/pre_stage2_exec-fsys_iso9660.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-fsys_iso9660.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_iso9660.c' object='pre_stage2_exec-fsys_iso9660.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-fsys_iso9660.o `test -f 'fsys_iso9660.c' || echo '$(srcdir)/'`fsys_iso9660.c + +pre_stage2_exec-fsys_iso9660.obj: fsys_iso9660.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-fsys_iso9660.obj -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-fsys_iso9660.Tpo" -c -o pre_stage2_exec-fsys_iso9660.obj `if test -f 'fsys_iso9660.c'; then $(CYGPATH_W) 'fsys_iso9660.c'; else $(CYGPATH_W) '$(srcdir)/fsys_iso9660.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-fsys_iso9660.Tpo" "$(DEPDIR)/pre_stage2_exec-fsys_iso9660.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-fsys_iso9660.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_iso9660.c' object='pre_stage2_exec-fsys_iso9660.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-fsys_iso9660.obj `if test -f 'fsys_iso9660.c'; then $(CYGPATH_W) 'fsys_iso9660.c'; else $(CYGPATH_W) '$(srcdir)/fsys_iso9660.c'; fi` + +pre_stage2_exec-fsys_jfs.o: fsys_jfs.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-fsys_jfs.o -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-fsys_jfs.Tpo" -c -o pre_stage2_exec-fsys_jfs.o `test -f 'fsys_jfs.c' || echo '$(srcdir)/'`fsys_jfs.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-fsys_jfs.Tpo" "$(DEPDIR)/pre_stage2_exec-fsys_jfs.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-fsys_jfs.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_jfs.c' object='pre_stage2_exec-fsys_jfs.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-fsys_jfs.o `test -f 'fsys_jfs.c' || echo '$(srcdir)/'`fsys_jfs.c + +pre_stage2_exec-fsys_jfs.obj: fsys_jfs.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-fsys_jfs.obj -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-fsys_jfs.Tpo" -c -o pre_stage2_exec-fsys_jfs.obj `if test -f 'fsys_jfs.c'; then $(CYGPATH_W) 'fsys_jfs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_jfs.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-fsys_jfs.Tpo" "$(DEPDIR)/pre_stage2_exec-fsys_jfs.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-fsys_jfs.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_jfs.c' object='pre_stage2_exec-fsys_jfs.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-fsys_jfs.obj `if test -f 'fsys_jfs.c'; then $(CYGPATH_W) 'fsys_jfs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_jfs.c'; fi` + +pre_stage2_exec-fsys_minix.o: fsys_minix.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-fsys_minix.o -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-fsys_minix.Tpo" -c -o pre_stage2_exec-fsys_minix.o `test -f 'fsys_minix.c' || echo '$(srcdir)/'`fsys_minix.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-fsys_minix.Tpo" "$(DEPDIR)/pre_stage2_exec-fsys_minix.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-fsys_minix.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_minix.c' object='pre_stage2_exec-fsys_minix.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-fsys_minix.o `test -f 'fsys_minix.c' || echo '$(srcdir)/'`fsys_minix.c + +pre_stage2_exec-fsys_minix.obj: fsys_minix.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-fsys_minix.obj -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-fsys_minix.Tpo" -c -o pre_stage2_exec-fsys_minix.obj `if test -f 'fsys_minix.c'; then $(CYGPATH_W) 'fsys_minix.c'; else $(CYGPATH_W) '$(srcdir)/fsys_minix.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-fsys_minix.Tpo" "$(DEPDIR)/pre_stage2_exec-fsys_minix.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-fsys_minix.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_minix.c' object='pre_stage2_exec-fsys_minix.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-fsys_minix.obj `if test -f 'fsys_minix.c'; then $(CYGPATH_W) 'fsys_minix.c'; else $(CYGPATH_W) '$(srcdir)/fsys_minix.c'; fi` + +pre_stage2_exec-fsys_reiserfs.o: fsys_reiserfs.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-fsys_reiserfs.o -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-fsys_reiserfs.Tpo" -c -o pre_stage2_exec-fsys_reiserfs.o `test -f 'fsys_reiserfs.c' || echo '$(srcdir)/'`fsys_reiserfs.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-fsys_reiserfs.Tpo" "$(DEPDIR)/pre_stage2_exec-fsys_reiserfs.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-fsys_reiserfs.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_reiserfs.c' object='pre_stage2_exec-fsys_reiserfs.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-fsys_reiserfs.o `test -f 'fsys_reiserfs.c' || echo '$(srcdir)/'`fsys_reiserfs.c + +pre_stage2_exec-fsys_reiserfs.obj: fsys_reiserfs.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-fsys_reiserfs.obj -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-fsys_reiserfs.Tpo" -c -o pre_stage2_exec-fsys_reiserfs.obj `if test -f 'fsys_reiserfs.c'; then $(CYGPATH_W) 'fsys_reiserfs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_reiserfs.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-fsys_reiserfs.Tpo" "$(DEPDIR)/pre_stage2_exec-fsys_reiserfs.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-fsys_reiserfs.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_reiserfs.c' object='pre_stage2_exec-fsys_reiserfs.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-fsys_reiserfs.obj `if test -f 'fsys_reiserfs.c'; then $(CYGPATH_W) 'fsys_reiserfs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_reiserfs.c'; fi` + +pre_stage2_exec-zfs_sha256.o: zfs_sha256.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-zfs_sha256.o -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-zfs_sha256.Tpo" -c -o pre_stage2_exec-zfs_sha256.o `test -f 'zfs_sha256.c' || echo '$(srcdir)/'`zfs_sha256.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-zfs_sha256.Tpo" "$(DEPDIR)/pre_stage2_exec-zfs_sha256.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-zfs_sha256.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='zfs_sha256.c' object='pre_stage2_exec-zfs_sha256.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-zfs_sha256.o `test -f 'zfs_sha256.c' || echo '$(srcdir)/'`zfs_sha256.c + +pre_stage2_exec-zfs_sha256.obj: zfs_sha256.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-zfs_sha256.obj -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-zfs_sha256.Tpo" -c -o pre_stage2_exec-zfs_sha256.obj `if test -f 'zfs_sha256.c'; then $(CYGPATH_W) 'zfs_sha256.c'; else $(CYGPATH_W) '$(srcdir)/zfs_sha256.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-zfs_sha256.Tpo" "$(DEPDIR)/pre_stage2_exec-zfs_sha256.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-zfs_sha256.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='zfs_sha256.c' object='pre_stage2_exec-zfs_sha256.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-zfs_sha256.obj `if test -f 'zfs_sha256.c'; then $(CYGPATH_W) 'zfs_sha256.c'; else $(CYGPATH_W) '$(srcdir)/zfs_sha256.c'; fi` + +pre_stage2_exec-zfs_lzjb.o: zfs_lzjb.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-zfs_lzjb.o -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-zfs_lzjb.Tpo" -c -o pre_stage2_exec-zfs_lzjb.o `test -f 'zfs_lzjb.c' || echo '$(srcdir)/'`zfs_lzjb.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-zfs_lzjb.Tpo" "$(DEPDIR)/pre_stage2_exec-zfs_lzjb.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-zfs_lzjb.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='zfs_lzjb.c' object='pre_stage2_exec-zfs_lzjb.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-zfs_lzjb.o `test -f 'zfs_lzjb.c' || echo '$(srcdir)/'`zfs_lzjb.c + +pre_stage2_exec-zfs_lzjb.obj: zfs_lzjb.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-zfs_lzjb.obj -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-zfs_lzjb.Tpo" -c -o pre_stage2_exec-zfs_lzjb.obj `if test -f 'zfs_lzjb.c'; then $(CYGPATH_W) 'zfs_lzjb.c'; else $(CYGPATH_W) '$(srcdir)/zfs_lzjb.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-zfs_lzjb.Tpo" "$(DEPDIR)/pre_stage2_exec-zfs_lzjb.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-zfs_lzjb.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='zfs_lzjb.c' object='pre_stage2_exec-zfs_lzjb.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-zfs_lzjb.obj `if test -f 'zfs_lzjb.c'; then $(CYGPATH_W) 'zfs_lzjb.c'; else $(CYGPATH_W) '$(srcdir)/zfs_lzjb.c'; fi` + +pre_stage2_exec-zfs_fletcher.o: zfs_fletcher.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-zfs_fletcher.o -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-zfs_fletcher.Tpo" -c -o pre_stage2_exec-zfs_fletcher.o `test -f 'zfs_fletcher.c' || echo '$(srcdir)/'`zfs_fletcher.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-zfs_fletcher.Tpo" "$(DEPDIR)/pre_stage2_exec-zfs_fletcher.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-zfs_fletcher.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='zfs_fletcher.c' object='pre_stage2_exec-zfs_fletcher.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-zfs_fletcher.o `test -f 'zfs_fletcher.c' || echo '$(srcdir)/'`zfs_fletcher.c + +pre_stage2_exec-zfs_fletcher.obj: zfs_fletcher.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-zfs_fletcher.obj -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-zfs_fletcher.Tpo" -c -o pre_stage2_exec-zfs_fletcher.obj `if test -f 'zfs_fletcher.c'; then $(CYGPATH_W) 'zfs_fletcher.c'; else $(CYGPATH_W) '$(srcdir)/zfs_fletcher.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-zfs_fletcher.Tpo" "$(DEPDIR)/pre_stage2_exec-zfs_fletcher.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-zfs_fletcher.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='zfs_fletcher.c' object='pre_stage2_exec-zfs_fletcher.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-zfs_fletcher.obj `if test -f 'zfs_fletcher.c'; then $(CYGPATH_W) 'zfs_fletcher.c'; else $(CYGPATH_W) '$(srcdir)/zfs_fletcher.c'; fi` + +pre_stage2_exec-fsys_zfs.o: fsys_zfs.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-fsys_zfs.o -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-fsys_zfs.Tpo" -c -o pre_stage2_exec-fsys_zfs.o `test -f 'fsys_zfs.c' || echo '$(srcdir)/'`fsys_zfs.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-fsys_zfs.Tpo" "$(DEPDIR)/pre_stage2_exec-fsys_zfs.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-fsys_zfs.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_zfs.c' object='pre_stage2_exec-fsys_zfs.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-fsys_zfs.o `test -f 'fsys_zfs.c' || echo '$(srcdir)/'`fsys_zfs.c + +pre_stage2_exec-fsys_zfs.obj: fsys_zfs.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-fsys_zfs.obj -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-fsys_zfs.Tpo" -c -o pre_stage2_exec-fsys_zfs.obj `if test -f 'fsys_zfs.c'; then $(CYGPATH_W) 'fsys_zfs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_zfs.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-fsys_zfs.Tpo" "$(DEPDIR)/pre_stage2_exec-fsys_zfs.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-fsys_zfs.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_zfs.c' object='pre_stage2_exec-fsys_zfs.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-fsys_zfs.obj `if test -f 'fsys_zfs.c'; then $(CYGPATH_W) 'fsys_zfs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_zfs.c'; fi` + +pre_stage2_exec-fsys_ufs.o: fsys_ufs.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-fsys_ufs.o -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-fsys_ufs.Tpo" -c -o pre_stage2_exec-fsys_ufs.o `test -f 'fsys_ufs.c' || echo '$(srcdir)/'`fsys_ufs.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-fsys_ufs.Tpo" "$(DEPDIR)/pre_stage2_exec-fsys_ufs.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-fsys_ufs.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_ufs.c' object='pre_stage2_exec-fsys_ufs.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-fsys_ufs.o `test -f 'fsys_ufs.c' || echo '$(srcdir)/'`fsys_ufs.c + +pre_stage2_exec-fsys_ufs.obj: fsys_ufs.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-fsys_ufs.obj -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-fsys_ufs.Tpo" -c -o pre_stage2_exec-fsys_ufs.obj `if test -f 'fsys_ufs.c'; then $(CYGPATH_W) 'fsys_ufs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_ufs.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-fsys_ufs.Tpo" "$(DEPDIR)/pre_stage2_exec-fsys_ufs.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-fsys_ufs.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_ufs.c' object='pre_stage2_exec-fsys_ufs.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-fsys_ufs.obj `if test -f 'fsys_ufs.c'; then $(CYGPATH_W) 'fsys_ufs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_ufs.c'; fi` + +pre_stage2_exec-fsys_ufs2.o: fsys_ufs2.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-fsys_ufs2.o -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-fsys_ufs2.Tpo" -c -o pre_stage2_exec-fsys_ufs2.o `test -f 'fsys_ufs2.c' || echo '$(srcdir)/'`fsys_ufs2.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-fsys_ufs2.Tpo" "$(DEPDIR)/pre_stage2_exec-fsys_ufs2.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-fsys_ufs2.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_ufs2.c' object='pre_stage2_exec-fsys_ufs2.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-fsys_ufs2.o `test -f 'fsys_ufs2.c' || echo '$(srcdir)/'`fsys_ufs2.c + +pre_stage2_exec-fsys_ufs2.obj: fsys_ufs2.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-fsys_ufs2.obj -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-fsys_ufs2.Tpo" -c -o pre_stage2_exec-fsys_ufs2.obj `if test -f 'fsys_ufs2.c'; then $(CYGPATH_W) 'fsys_ufs2.c'; else $(CYGPATH_W) '$(srcdir)/fsys_ufs2.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-fsys_ufs2.Tpo" "$(DEPDIR)/pre_stage2_exec-fsys_ufs2.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-fsys_ufs2.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_ufs2.c' object='pre_stage2_exec-fsys_ufs2.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-fsys_ufs2.obj `if test -f 'fsys_ufs2.c'; then $(CYGPATH_W) 'fsys_ufs2.c'; else $(CYGPATH_W) '$(srcdir)/fsys_ufs2.c'; fi` + +pre_stage2_exec-fsys_vstafs.o: fsys_vstafs.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-fsys_vstafs.o -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-fsys_vstafs.Tpo" -c -o pre_stage2_exec-fsys_vstafs.o `test -f 'fsys_vstafs.c' || echo '$(srcdir)/'`fsys_vstafs.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-fsys_vstafs.Tpo" "$(DEPDIR)/pre_stage2_exec-fsys_vstafs.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-fsys_vstafs.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_vstafs.c' object='pre_stage2_exec-fsys_vstafs.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-fsys_vstafs.o `test -f 'fsys_vstafs.c' || echo '$(srcdir)/'`fsys_vstafs.c + +pre_stage2_exec-fsys_vstafs.obj: fsys_vstafs.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-fsys_vstafs.obj -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-fsys_vstafs.Tpo" -c -o pre_stage2_exec-fsys_vstafs.obj `if test -f 'fsys_vstafs.c'; then $(CYGPATH_W) 'fsys_vstafs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_vstafs.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-fsys_vstafs.Tpo" "$(DEPDIR)/pre_stage2_exec-fsys_vstafs.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-fsys_vstafs.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_vstafs.c' object='pre_stage2_exec-fsys_vstafs.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-fsys_vstafs.obj `if test -f 'fsys_vstafs.c'; then $(CYGPATH_W) 'fsys_vstafs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_vstafs.c'; fi` + +pre_stage2_exec-fsys_xfs.o: fsys_xfs.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-fsys_xfs.o -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-fsys_xfs.Tpo" -c -o pre_stage2_exec-fsys_xfs.o `test -f 'fsys_xfs.c' || echo '$(srcdir)/'`fsys_xfs.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-fsys_xfs.Tpo" "$(DEPDIR)/pre_stage2_exec-fsys_xfs.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-fsys_xfs.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_xfs.c' object='pre_stage2_exec-fsys_xfs.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-fsys_xfs.o `test -f 'fsys_xfs.c' || echo '$(srcdir)/'`fsys_xfs.c + +pre_stage2_exec-fsys_xfs.obj: fsys_xfs.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-fsys_xfs.obj -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-fsys_xfs.Tpo" -c -o pre_stage2_exec-fsys_xfs.obj `if test -f 'fsys_xfs.c'; then $(CYGPATH_W) 'fsys_xfs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_xfs.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-fsys_xfs.Tpo" "$(DEPDIR)/pre_stage2_exec-fsys_xfs.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-fsys_xfs.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_xfs.c' object='pre_stage2_exec-fsys_xfs.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-fsys_xfs.obj `if test -f 'fsys_xfs.c'; then $(CYGPATH_W) 'fsys_xfs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_xfs.c'; fi` + +pre_stage2_exec-gunzip.o: gunzip.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-gunzip.o -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-gunzip.Tpo" -c -o pre_stage2_exec-gunzip.o `test -f 'gunzip.c' || echo '$(srcdir)/'`gunzip.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-gunzip.Tpo" "$(DEPDIR)/pre_stage2_exec-gunzip.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-gunzip.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gunzip.c' object='pre_stage2_exec-gunzip.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-gunzip.o `test -f 'gunzip.c' || echo '$(srcdir)/'`gunzip.c + +pre_stage2_exec-gunzip.obj: gunzip.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-gunzip.obj -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-gunzip.Tpo" -c -o pre_stage2_exec-gunzip.obj `if test -f 'gunzip.c'; then $(CYGPATH_W) 'gunzip.c'; else $(CYGPATH_W) '$(srcdir)/gunzip.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-gunzip.Tpo" "$(DEPDIR)/pre_stage2_exec-gunzip.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-gunzip.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gunzip.c' object='pre_stage2_exec-gunzip.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-gunzip.obj `if test -f 'gunzip.c'; then $(CYGPATH_W) 'gunzip.c'; else $(CYGPATH_W) '$(srcdir)/gunzip.c'; fi` + +pre_stage2_exec-hercules.o: hercules.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-hercules.o -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-hercules.Tpo" -c -o pre_stage2_exec-hercules.o `test -f 'hercules.c' || echo '$(srcdir)/'`hercules.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-hercules.Tpo" "$(DEPDIR)/pre_stage2_exec-hercules.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-hercules.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='hercules.c' object='pre_stage2_exec-hercules.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-hercules.o `test -f 'hercules.c' || echo '$(srcdir)/'`hercules.c + +pre_stage2_exec-hercules.obj: hercules.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-hercules.obj -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-hercules.Tpo" -c -o pre_stage2_exec-hercules.obj `if test -f 'hercules.c'; then $(CYGPATH_W) 'hercules.c'; else $(CYGPATH_W) '$(srcdir)/hercules.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-hercules.Tpo" "$(DEPDIR)/pre_stage2_exec-hercules.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-hercules.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='hercules.c' object='pre_stage2_exec-hercules.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-hercules.obj `if test -f 'hercules.c'; then $(CYGPATH_W) 'hercules.c'; else $(CYGPATH_W) '$(srcdir)/hercules.c'; fi` + +pre_stage2_exec-md5.o: md5.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-md5.o -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-md5.Tpo" -c -o pre_stage2_exec-md5.o `test -f 'md5.c' || echo '$(srcdir)/'`md5.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-md5.Tpo" "$(DEPDIR)/pre_stage2_exec-md5.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-md5.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='md5.c' object='pre_stage2_exec-md5.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-md5.o `test -f 'md5.c' || echo '$(srcdir)/'`md5.c + +pre_stage2_exec-md5.obj: md5.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-md5.obj -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-md5.Tpo" -c -o pre_stage2_exec-md5.obj `if test -f 'md5.c'; then $(CYGPATH_W) 'md5.c'; else $(CYGPATH_W) '$(srcdir)/md5.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-md5.Tpo" "$(DEPDIR)/pre_stage2_exec-md5.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-md5.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='md5.c' object='pre_stage2_exec-md5.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-md5.obj `if test -f 'md5.c'; then $(CYGPATH_W) 'md5.c'; else $(CYGPATH_W) '$(srcdir)/md5.c'; fi` + +pre_stage2_exec-serial.o: serial.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-serial.o -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-serial.Tpo" -c -o pre_stage2_exec-serial.o `test -f 'serial.c' || echo '$(srcdir)/'`serial.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-serial.Tpo" "$(DEPDIR)/pre_stage2_exec-serial.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-serial.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='serial.c' object='pre_stage2_exec-serial.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-serial.o `test -f 'serial.c' || echo '$(srcdir)/'`serial.c + +pre_stage2_exec-serial.obj: serial.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-serial.obj -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-serial.Tpo" -c -o pre_stage2_exec-serial.obj `if test -f 'serial.c'; then $(CYGPATH_W) 'serial.c'; else $(CYGPATH_W) '$(srcdir)/serial.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-serial.Tpo" "$(DEPDIR)/pre_stage2_exec-serial.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-serial.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='serial.c' object='pre_stage2_exec-serial.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-serial.obj `if test -f 'serial.c'; then $(CYGPATH_W) 'serial.c'; else $(CYGPATH_W) '$(srcdir)/serial.c'; fi` + +pre_stage2_exec-smp-imps.o: smp-imps.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-smp-imps.o -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-smp-imps.Tpo" -c -o pre_stage2_exec-smp-imps.o `test -f 'smp-imps.c' || echo '$(srcdir)/'`smp-imps.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-smp-imps.Tpo" "$(DEPDIR)/pre_stage2_exec-smp-imps.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-smp-imps.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='smp-imps.c' object='pre_stage2_exec-smp-imps.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-smp-imps.o `test -f 'smp-imps.c' || echo '$(srcdir)/'`smp-imps.c + +pre_stage2_exec-smp-imps.obj: smp-imps.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-smp-imps.obj -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-smp-imps.Tpo" -c -o pre_stage2_exec-smp-imps.obj `if test -f 'smp-imps.c'; then $(CYGPATH_W) 'smp-imps.c'; else $(CYGPATH_W) '$(srcdir)/smp-imps.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-smp-imps.Tpo" "$(DEPDIR)/pre_stage2_exec-smp-imps.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-smp-imps.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='smp-imps.c' object='pre_stage2_exec-smp-imps.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-smp-imps.obj `if test -f 'smp-imps.c'; then $(CYGPATH_W) 'smp-imps.c'; else $(CYGPATH_W) '$(srcdir)/smp-imps.c'; fi` + +pre_stage2_exec-stage2.o: stage2.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-stage2.o -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-stage2.Tpo" -c -o pre_stage2_exec-stage2.o `test -f 'stage2.c' || echo '$(srcdir)/'`stage2.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-stage2.Tpo" "$(DEPDIR)/pre_stage2_exec-stage2.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-stage2.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='stage2.c' object='pre_stage2_exec-stage2.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-stage2.o `test -f 'stage2.c' || echo '$(srcdir)/'`stage2.c + +pre_stage2_exec-stage2.obj: stage2.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-stage2.obj -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-stage2.Tpo" -c -o pre_stage2_exec-stage2.obj `if test -f 'stage2.c'; then $(CYGPATH_W) 'stage2.c'; else $(CYGPATH_W) '$(srcdir)/stage2.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-stage2.Tpo" "$(DEPDIR)/pre_stage2_exec-stage2.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-stage2.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='stage2.c' object='pre_stage2_exec-stage2.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-stage2.obj `if test -f 'stage2.c'; then $(CYGPATH_W) 'stage2.c'; else $(CYGPATH_W) '$(srcdir)/stage2.c'; fi` + +pre_stage2_exec-terminfo.o: terminfo.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-terminfo.o -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-terminfo.Tpo" -c -o pre_stage2_exec-terminfo.o `test -f 'terminfo.c' || echo '$(srcdir)/'`terminfo.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-terminfo.Tpo" "$(DEPDIR)/pre_stage2_exec-terminfo.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-terminfo.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='terminfo.c' object='pre_stage2_exec-terminfo.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-terminfo.o `test -f 'terminfo.c' || echo '$(srcdir)/'`terminfo.c + +pre_stage2_exec-terminfo.obj: terminfo.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-terminfo.obj -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-terminfo.Tpo" -c -o pre_stage2_exec-terminfo.obj `if test -f 'terminfo.c'; then $(CYGPATH_W) 'terminfo.c'; else $(CYGPATH_W) '$(srcdir)/terminfo.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-terminfo.Tpo" "$(DEPDIR)/pre_stage2_exec-terminfo.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-terminfo.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='terminfo.c' object='pre_stage2_exec-terminfo.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-terminfo.obj `if test -f 'terminfo.c'; then $(CYGPATH_W) 'terminfo.c'; else $(CYGPATH_W) '$(srcdir)/terminfo.c'; fi` + +pre_stage2_exec-tparm.o: tparm.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-tparm.o -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-tparm.Tpo" -c -o pre_stage2_exec-tparm.o `test -f 'tparm.c' || echo '$(srcdir)/'`tparm.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-tparm.Tpo" "$(DEPDIR)/pre_stage2_exec-tparm.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-tparm.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tparm.c' object='pre_stage2_exec-tparm.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-tparm.o `test -f 'tparm.c' || echo '$(srcdir)/'`tparm.c + +pre_stage2_exec-tparm.obj: tparm.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-tparm.obj -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-tparm.Tpo" -c -o pre_stage2_exec-tparm.obj `if test -f 'tparm.c'; then $(CYGPATH_W) 'tparm.c'; else $(CYGPATH_W) '$(srcdir)/tparm.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-tparm.Tpo" "$(DEPDIR)/pre_stage2_exec-tparm.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-tparm.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tparm.c' object='pre_stage2_exec-tparm.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-tparm.obj `if test -f 'tparm.c'; then $(CYGPATH_W) 'tparm.c'; else $(CYGPATH_W) '$(srcdir)/tparm.c'; fi` + +pre_stage2_exec-graphics.o: graphics.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-graphics.o -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-graphics.Tpo" -c -o pre_stage2_exec-graphics.o `test -f 'graphics.c' || echo '$(srcdir)/'`graphics.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-graphics.Tpo" "$(DEPDIR)/pre_stage2_exec-graphics.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-graphics.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='graphics.c' object='pre_stage2_exec-graphics.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-graphics.o `test -f 'graphics.c' || echo '$(srcdir)/'`graphics.c + +pre_stage2_exec-graphics.obj: graphics.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-graphics.obj -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-graphics.Tpo" -c -o pre_stage2_exec-graphics.obj `if test -f 'graphics.c'; then $(CYGPATH_W) 'graphics.c'; else $(CYGPATH_W) '$(srcdir)/graphics.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pre_stage2_exec-graphics.Tpo" "$(DEPDIR)/pre_stage2_exec-graphics.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-graphics.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='graphics.c' object='pre_stage2_exec-graphics.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-graphics.obj `if test -f 'graphics.c'; then $(CYGPATH_W) 'graphics.c'; else $(CYGPATH_W) '$(srcdir)/graphics.c'; fi` + +reiserfs_stage1_5_exec-common.o: common.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(reiserfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT reiserfs_stage1_5_exec-common.o -MD -MP -MF "$(DEPDIR)/reiserfs_stage1_5_exec-common.Tpo" -c -o reiserfs_stage1_5_exec-common.o `test -f 'common.c' || echo '$(srcdir)/'`common.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/reiserfs_stage1_5_exec-common.Tpo" "$(DEPDIR)/reiserfs_stage1_5_exec-common.Po"; else rm -f "$(DEPDIR)/reiserfs_stage1_5_exec-common.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='common.c' object='reiserfs_stage1_5_exec-common.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(reiserfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o reiserfs_stage1_5_exec-common.o `test -f 'common.c' || echo '$(srcdir)/'`common.c + +reiserfs_stage1_5_exec-common.obj: common.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(reiserfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT reiserfs_stage1_5_exec-common.obj -MD -MP -MF "$(DEPDIR)/reiserfs_stage1_5_exec-common.Tpo" -c -o reiserfs_stage1_5_exec-common.obj `if test -f 'common.c'; then $(CYGPATH_W) 'common.c'; else $(CYGPATH_W) '$(srcdir)/common.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/reiserfs_stage1_5_exec-common.Tpo" "$(DEPDIR)/reiserfs_stage1_5_exec-common.Po"; else rm -f "$(DEPDIR)/reiserfs_stage1_5_exec-common.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='common.c' object='reiserfs_stage1_5_exec-common.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(reiserfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o reiserfs_stage1_5_exec-common.obj `if test -f 'common.c'; then $(CYGPATH_W) 'common.c'; else $(CYGPATH_W) '$(srcdir)/common.c'; fi` + +reiserfs_stage1_5_exec-char_io.o: char_io.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(reiserfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT reiserfs_stage1_5_exec-char_io.o -MD -MP -MF "$(DEPDIR)/reiserfs_stage1_5_exec-char_io.Tpo" -c -o reiserfs_stage1_5_exec-char_io.o `test -f 'char_io.c' || echo '$(srcdir)/'`char_io.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/reiserfs_stage1_5_exec-char_io.Tpo" "$(DEPDIR)/reiserfs_stage1_5_exec-char_io.Po"; else rm -f "$(DEPDIR)/reiserfs_stage1_5_exec-char_io.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='char_io.c' object='reiserfs_stage1_5_exec-char_io.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(reiserfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o reiserfs_stage1_5_exec-char_io.o `test -f 'char_io.c' || echo '$(srcdir)/'`char_io.c + +reiserfs_stage1_5_exec-char_io.obj: char_io.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(reiserfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT reiserfs_stage1_5_exec-char_io.obj -MD -MP -MF "$(DEPDIR)/reiserfs_stage1_5_exec-char_io.Tpo" -c -o reiserfs_stage1_5_exec-char_io.obj `if test -f 'char_io.c'; then $(CYGPATH_W) 'char_io.c'; else $(CYGPATH_W) '$(srcdir)/char_io.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/reiserfs_stage1_5_exec-char_io.Tpo" "$(DEPDIR)/reiserfs_stage1_5_exec-char_io.Po"; else rm -f "$(DEPDIR)/reiserfs_stage1_5_exec-char_io.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='char_io.c' object='reiserfs_stage1_5_exec-char_io.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(reiserfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o reiserfs_stage1_5_exec-char_io.obj `if test -f 'char_io.c'; then $(CYGPATH_W) 'char_io.c'; else $(CYGPATH_W) '$(srcdir)/char_io.c'; fi` + +reiserfs_stage1_5_exec-disk_io.o: disk_io.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(reiserfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT reiserfs_stage1_5_exec-disk_io.o -MD -MP -MF "$(DEPDIR)/reiserfs_stage1_5_exec-disk_io.Tpo" -c -o reiserfs_stage1_5_exec-disk_io.o `test -f 'disk_io.c' || echo '$(srcdir)/'`disk_io.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/reiserfs_stage1_5_exec-disk_io.Tpo" "$(DEPDIR)/reiserfs_stage1_5_exec-disk_io.Po"; else rm -f "$(DEPDIR)/reiserfs_stage1_5_exec-disk_io.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='disk_io.c' object='reiserfs_stage1_5_exec-disk_io.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(reiserfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o reiserfs_stage1_5_exec-disk_io.o `test -f 'disk_io.c' || echo '$(srcdir)/'`disk_io.c + +reiserfs_stage1_5_exec-disk_io.obj: disk_io.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(reiserfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT reiserfs_stage1_5_exec-disk_io.obj -MD -MP -MF "$(DEPDIR)/reiserfs_stage1_5_exec-disk_io.Tpo" -c -o reiserfs_stage1_5_exec-disk_io.obj `if test -f 'disk_io.c'; then $(CYGPATH_W) 'disk_io.c'; else $(CYGPATH_W) '$(srcdir)/disk_io.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/reiserfs_stage1_5_exec-disk_io.Tpo" "$(DEPDIR)/reiserfs_stage1_5_exec-disk_io.Po"; else rm -f "$(DEPDIR)/reiserfs_stage1_5_exec-disk_io.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='disk_io.c' object='reiserfs_stage1_5_exec-disk_io.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(reiserfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o reiserfs_stage1_5_exec-disk_io.obj `if test -f 'disk_io.c'; then $(CYGPATH_W) 'disk_io.c'; else $(CYGPATH_W) '$(srcdir)/disk_io.c'; fi` + +reiserfs_stage1_5_exec-stage1_5.o: stage1_5.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(reiserfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT reiserfs_stage1_5_exec-stage1_5.o -MD -MP -MF "$(DEPDIR)/reiserfs_stage1_5_exec-stage1_5.Tpo" -c -o reiserfs_stage1_5_exec-stage1_5.o `test -f 'stage1_5.c' || echo '$(srcdir)/'`stage1_5.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/reiserfs_stage1_5_exec-stage1_5.Tpo" "$(DEPDIR)/reiserfs_stage1_5_exec-stage1_5.Po"; else rm -f "$(DEPDIR)/reiserfs_stage1_5_exec-stage1_5.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='stage1_5.c' object='reiserfs_stage1_5_exec-stage1_5.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(reiserfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o reiserfs_stage1_5_exec-stage1_5.o `test -f 'stage1_5.c' || echo '$(srcdir)/'`stage1_5.c + +reiserfs_stage1_5_exec-stage1_5.obj: stage1_5.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(reiserfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT reiserfs_stage1_5_exec-stage1_5.obj -MD -MP -MF "$(DEPDIR)/reiserfs_stage1_5_exec-stage1_5.Tpo" -c -o reiserfs_stage1_5_exec-stage1_5.obj `if test -f 'stage1_5.c'; then $(CYGPATH_W) 'stage1_5.c'; else $(CYGPATH_W) '$(srcdir)/stage1_5.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/reiserfs_stage1_5_exec-stage1_5.Tpo" "$(DEPDIR)/reiserfs_stage1_5_exec-stage1_5.Po"; else rm -f "$(DEPDIR)/reiserfs_stage1_5_exec-stage1_5.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='stage1_5.c' object='reiserfs_stage1_5_exec-stage1_5.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(reiserfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o reiserfs_stage1_5_exec-stage1_5.obj `if test -f 'stage1_5.c'; then $(CYGPATH_W) 'stage1_5.c'; else $(CYGPATH_W) '$(srcdir)/stage1_5.c'; fi` + +reiserfs_stage1_5_exec-fsys_reiserfs.o: fsys_reiserfs.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(reiserfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT reiserfs_stage1_5_exec-fsys_reiserfs.o -MD -MP -MF "$(DEPDIR)/reiserfs_stage1_5_exec-fsys_reiserfs.Tpo" -c -o reiserfs_stage1_5_exec-fsys_reiserfs.o `test -f 'fsys_reiserfs.c' || echo '$(srcdir)/'`fsys_reiserfs.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/reiserfs_stage1_5_exec-fsys_reiserfs.Tpo" "$(DEPDIR)/reiserfs_stage1_5_exec-fsys_reiserfs.Po"; else rm -f "$(DEPDIR)/reiserfs_stage1_5_exec-fsys_reiserfs.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_reiserfs.c' object='reiserfs_stage1_5_exec-fsys_reiserfs.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(reiserfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o reiserfs_stage1_5_exec-fsys_reiserfs.o `test -f 'fsys_reiserfs.c' || echo '$(srcdir)/'`fsys_reiserfs.c + +reiserfs_stage1_5_exec-fsys_reiserfs.obj: fsys_reiserfs.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(reiserfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT reiserfs_stage1_5_exec-fsys_reiserfs.obj -MD -MP -MF "$(DEPDIR)/reiserfs_stage1_5_exec-fsys_reiserfs.Tpo" -c -o reiserfs_stage1_5_exec-fsys_reiserfs.obj `if test -f 'fsys_reiserfs.c'; then $(CYGPATH_W) 'fsys_reiserfs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_reiserfs.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/reiserfs_stage1_5_exec-fsys_reiserfs.Tpo" "$(DEPDIR)/reiserfs_stage1_5_exec-fsys_reiserfs.Po"; else rm -f "$(DEPDIR)/reiserfs_stage1_5_exec-fsys_reiserfs.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_reiserfs.c' object='reiserfs_stage1_5_exec-fsys_reiserfs.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(reiserfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o reiserfs_stage1_5_exec-fsys_reiserfs.obj `if test -f 'fsys_reiserfs.c'; then $(CYGPATH_W) 'fsys_reiserfs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_reiserfs.c'; fi` + +reiserfs_stage1_5_exec-bios.o: bios.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(reiserfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT reiserfs_stage1_5_exec-bios.o -MD -MP -MF "$(DEPDIR)/reiserfs_stage1_5_exec-bios.Tpo" -c -o reiserfs_stage1_5_exec-bios.o `test -f 'bios.c' || echo '$(srcdir)/'`bios.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/reiserfs_stage1_5_exec-bios.Tpo" "$(DEPDIR)/reiserfs_stage1_5_exec-bios.Po"; else rm -f "$(DEPDIR)/reiserfs_stage1_5_exec-bios.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bios.c' object='reiserfs_stage1_5_exec-bios.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(reiserfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o reiserfs_stage1_5_exec-bios.o `test -f 'bios.c' || echo '$(srcdir)/'`bios.c + +reiserfs_stage1_5_exec-bios.obj: bios.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(reiserfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT reiserfs_stage1_5_exec-bios.obj -MD -MP -MF "$(DEPDIR)/reiserfs_stage1_5_exec-bios.Tpo" -c -o reiserfs_stage1_5_exec-bios.obj `if test -f 'bios.c'; then $(CYGPATH_W) 'bios.c'; else $(CYGPATH_W) '$(srcdir)/bios.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/reiserfs_stage1_5_exec-bios.Tpo" "$(DEPDIR)/reiserfs_stage1_5_exec-bios.Po"; else rm -f "$(DEPDIR)/reiserfs_stage1_5_exec-bios.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bios.c' object='reiserfs_stage1_5_exec-bios.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(reiserfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o reiserfs_stage1_5_exec-bios.obj `if test -f 'bios.c'; then $(CYGPATH_W) 'bios.c'; else $(CYGPATH_W) '$(srcdir)/bios.c'; fi` + +ufs2_stage1_5_exec-common.o: common.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs2_stage1_5_exec_CFLAGS) $(CFLAGS) -MT ufs2_stage1_5_exec-common.o -MD -MP -MF "$(DEPDIR)/ufs2_stage1_5_exec-common.Tpo" -c -o ufs2_stage1_5_exec-common.o `test -f 'common.c' || echo '$(srcdir)/'`common.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ufs2_stage1_5_exec-common.Tpo" "$(DEPDIR)/ufs2_stage1_5_exec-common.Po"; else rm -f "$(DEPDIR)/ufs2_stage1_5_exec-common.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='common.c' object='ufs2_stage1_5_exec-common.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs2_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ufs2_stage1_5_exec-common.o `test -f 'common.c' || echo '$(srcdir)/'`common.c + +ufs2_stage1_5_exec-common.obj: common.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs2_stage1_5_exec_CFLAGS) $(CFLAGS) -MT ufs2_stage1_5_exec-common.obj -MD -MP -MF "$(DEPDIR)/ufs2_stage1_5_exec-common.Tpo" -c -o ufs2_stage1_5_exec-common.obj `if test -f 'common.c'; then $(CYGPATH_W) 'common.c'; else $(CYGPATH_W) '$(srcdir)/common.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ufs2_stage1_5_exec-common.Tpo" "$(DEPDIR)/ufs2_stage1_5_exec-common.Po"; else rm -f "$(DEPDIR)/ufs2_stage1_5_exec-common.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='common.c' object='ufs2_stage1_5_exec-common.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs2_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ufs2_stage1_5_exec-common.obj `if test -f 'common.c'; then $(CYGPATH_W) 'common.c'; else $(CYGPATH_W) '$(srcdir)/common.c'; fi` + +ufs2_stage1_5_exec-char_io.o: char_io.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs2_stage1_5_exec_CFLAGS) $(CFLAGS) -MT ufs2_stage1_5_exec-char_io.o -MD -MP -MF "$(DEPDIR)/ufs2_stage1_5_exec-char_io.Tpo" -c -o ufs2_stage1_5_exec-char_io.o `test -f 'char_io.c' || echo '$(srcdir)/'`char_io.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ufs2_stage1_5_exec-char_io.Tpo" "$(DEPDIR)/ufs2_stage1_5_exec-char_io.Po"; else rm -f "$(DEPDIR)/ufs2_stage1_5_exec-char_io.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='char_io.c' object='ufs2_stage1_5_exec-char_io.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs2_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ufs2_stage1_5_exec-char_io.o `test -f 'char_io.c' || echo '$(srcdir)/'`char_io.c + +ufs2_stage1_5_exec-char_io.obj: char_io.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs2_stage1_5_exec_CFLAGS) $(CFLAGS) -MT ufs2_stage1_5_exec-char_io.obj -MD -MP -MF "$(DEPDIR)/ufs2_stage1_5_exec-char_io.Tpo" -c -o ufs2_stage1_5_exec-char_io.obj `if test -f 'char_io.c'; then $(CYGPATH_W) 'char_io.c'; else $(CYGPATH_W) '$(srcdir)/char_io.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ufs2_stage1_5_exec-char_io.Tpo" "$(DEPDIR)/ufs2_stage1_5_exec-char_io.Po"; else rm -f "$(DEPDIR)/ufs2_stage1_5_exec-char_io.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='char_io.c' object='ufs2_stage1_5_exec-char_io.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs2_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ufs2_stage1_5_exec-char_io.obj `if test -f 'char_io.c'; then $(CYGPATH_W) 'char_io.c'; else $(CYGPATH_W) '$(srcdir)/char_io.c'; fi` + +ufs2_stage1_5_exec-disk_io.o: disk_io.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs2_stage1_5_exec_CFLAGS) $(CFLAGS) -MT ufs2_stage1_5_exec-disk_io.o -MD -MP -MF "$(DEPDIR)/ufs2_stage1_5_exec-disk_io.Tpo" -c -o ufs2_stage1_5_exec-disk_io.o `test -f 'disk_io.c' || echo '$(srcdir)/'`disk_io.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ufs2_stage1_5_exec-disk_io.Tpo" "$(DEPDIR)/ufs2_stage1_5_exec-disk_io.Po"; else rm -f "$(DEPDIR)/ufs2_stage1_5_exec-disk_io.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='disk_io.c' object='ufs2_stage1_5_exec-disk_io.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs2_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ufs2_stage1_5_exec-disk_io.o `test -f 'disk_io.c' || echo '$(srcdir)/'`disk_io.c + +ufs2_stage1_5_exec-disk_io.obj: disk_io.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs2_stage1_5_exec_CFLAGS) $(CFLAGS) -MT ufs2_stage1_5_exec-disk_io.obj -MD -MP -MF "$(DEPDIR)/ufs2_stage1_5_exec-disk_io.Tpo" -c -o ufs2_stage1_5_exec-disk_io.obj `if test -f 'disk_io.c'; then $(CYGPATH_W) 'disk_io.c'; else $(CYGPATH_W) '$(srcdir)/disk_io.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ufs2_stage1_5_exec-disk_io.Tpo" "$(DEPDIR)/ufs2_stage1_5_exec-disk_io.Po"; else rm -f "$(DEPDIR)/ufs2_stage1_5_exec-disk_io.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='disk_io.c' object='ufs2_stage1_5_exec-disk_io.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs2_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ufs2_stage1_5_exec-disk_io.obj `if test -f 'disk_io.c'; then $(CYGPATH_W) 'disk_io.c'; else $(CYGPATH_W) '$(srcdir)/disk_io.c'; fi` + +ufs2_stage1_5_exec-stage1_5.o: stage1_5.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs2_stage1_5_exec_CFLAGS) $(CFLAGS) -MT ufs2_stage1_5_exec-stage1_5.o -MD -MP -MF "$(DEPDIR)/ufs2_stage1_5_exec-stage1_5.Tpo" -c -o ufs2_stage1_5_exec-stage1_5.o `test -f 'stage1_5.c' || echo '$(srcdir)/'`stage1_5.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ufs2_stage1_5_exec-stage1_5.Tpo" "$(DEPDIR)/ufs2_stage1_5_exec-stage1_5.Po"; else rm -f "$(DEPDIR)/ufs2_stage1_5_exec-stage1_5.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='stage1_5.c' object='ufs2_stage1_5_exec-stage1_5.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs2_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ufs2_stage1_5_exec-stage1_5.o `test -f 'stage1_5.c' || echo '$(srcdir)/'`stage1_5.c + +ufs2_stage1_5_exec-stage1_5.obj: stage1_5.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs2_stage1_5_exec_CFLAGS) $(CFLAGS) -MT ufs2_stage1_5_exec-stage1_5.obj -MD -MP -MF "$(DEPDIR)/ufs2_stage1_5_exec-stage1_5.Tpo" -c -o ufs2_stage1_5_exec-stage1_5.obj `if test -f 'stage1_5.c'; then $(CYGPATH_W) 'stage1_5.c'; else $(CYGPATH_W) '$(srcdir)/stage1_5.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ufs2_stage1_5_exec-stage1_5.Tpo" "$(DEPDIR)/ufs2_stage1_5_exec-stage1_5.Po"; else rm -f "$(DEPDIR)/ufs2_stage1_5_exec-stage1_5.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='stage1_5.c' object='ufs2_stage1_5_exec-stage1_5.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs2_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ufs2_stage1_5_exec-stage1_5.obj `if test -f 'stage1_5.c'; then $(CYGPATH_W) 'stage1_5.c'; else $(CYGPATH_W) '$(srcdir)/stage1_5.c'; fi` + +ufs2_stage1_5_exec-fsys_ufs2.o: fsys_ufs2.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs2_stage1_5_exec_CFLAGS) $(CFLAGS) -MT ufs2_stage1_5_exec-fsys_ufs2.o -MD -MP -MF "$(DEPDIR)/ufs2_stage1_5_exec-fsys_ufs2.Tpo" -c -o ufs2_stage1_5_exec-fsys_ufs2.o `test -f 'fsys_ufs2.c' || echo '$(srcdir)/'`fsys_ufs2.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ufs2_stage1_5_exec-fsys_ufs2.Tpo" "$(DEPDIR)/ufs2_stage1_5_exec-fsys_ufs2.Po"; else rm -f "$(DEPDIR)/ufs2_stage1_5_exec-fsys_ufs2.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_ufs2.c' object='ufs2_stage1_5_exec-fsys_ufs2.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs2_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ufs2_stage1_5_exec-fsys_ufs2.o `test -f 'fsys_ufs2.c' || echo '$(srcdir)/'`fsys_ufs2.c + +ufs2_stage1_5_exec-fsys_ufs2.obj: fsys_ufs2.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs2_stage1_5_exec_CFLAGS) $(CFLAGS) -MT ufs2_stage1_5_exec-fsys_ufs2.obj -MD -MP -MF "$(DEPDIR)/ufs2_stage1_5_exec-fsys_ufs2.Tpo" -c -o ufs2_stage1_5_exec-fsys_ufs2.obj `if test -f 'fsys_ufs2.c'; then $(CYGPATH_W) 'fsys_ufs2.c'; else $(CYGPATH_W) '$(srcdir)/fsys_ufs2.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ufs2_stage1_5_exec-fsys_ufs2.Tpo" "$(DEPDIR)/ufs2_stage1_5_exec-fsys_ufs2.Po"; else rm -f "$(DEPDIR)/ufs2_stage1_5_exec-fsys_ufs2.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_ufs2.c' object='ufs2_stage1_5_exec-fsys_ufs2.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs2_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ufs2_stage1_5_exec-fsys_ufs2.obj `if test -f 'fsys_ufs2.c'; then $(CYGPATH_W) 'fsys_ufs2.c'; else $(CYGPATH_W) '$(srcdir)/fsys_ufs2.c'; fi` + +ufs2_stage1_5_exec-bios.o: bios.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs2_stage1_5_exec_CFLAGS) $(CFLAGS) -MT ufs2_stage1_5_exec-bios.o -MD -MP -MF "$(DEPDIR)/ufs2_stage1_5_exec-bios.Tpo" -c -o ufs2_stage1_5_exec-bios.o `test -f 'bios.c' || echo '$(srcdir)/'`bios.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ufs2_stage1_5_exec-bios.Tpo" "$(DEPDIR)/ufs2_stage1_5_exec-bios.Po"; else rm -f "$(DEPDIR)/ufs2_stage1_5_exec-bios.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bios.c' object='ufs2_stage1_5_exec-bios.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs2_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ufs2_stage1_5_exec-bios.o `test -f 'bios.c' || echo '$(srcdir)/'`bios.c + +ufs2_stage1_5_exec-bios.obj: bios.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs2_stage1_5_exec_CFLAGS) $(CFLAGS) -MT ufs2_stage1_5_exec-bios.obj -MD -MP -MF "$(DEPDIR)/ufs2_stage1_5_exec-bios.Tpo" -c -o ufs2_stage1_5_exec-bios.obj `if test -f 'bios.c'; then $(CYGPATH_W) 'bios.c'; else $(CYGPATH_W) '$(srcdir)/bios.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ufs2_stage1_5_exec-bios.Tpo" "$(DEPDIR)/ufs2_stage1_5_exec-bios.Po"; else rm -f "$(DEPDIR)/ufs2_stage1_5_exec-bios.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bios.c' object='ufs2_stage1_5_exec-bios.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs2_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ufs2_stage1_5_exec-bios.obj `if test -f 'bios.c'; then $(CYGPATH_W) 'bios.c'; else $(CYGPATH_W) '$(srcdir)/bios.c'; fi` + +ufs_stage1_5_exec-common.o: common.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT ufs_stage1_5_exec-common.o -MD -MP -MF "$(DEPDIR)/ufs_stage1_5_exec-common.Tpo" -c -o ufs_stage1_5_exec-common.o `test -f 'common.c' || echo '$(srcdir)/'`common.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ufs_stage1_5_exec-common.Tpo" "$(DEPDIR)/ufs_stage1_5_exec-common.Po"; else rm -f "$(DEPDIR)/ufs_stage1_5_exec-common.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='common.c' object='ufs_stage1_5_exec-common.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ufs_stage1_5_exec-common.o `test -f 'common.c' || echo '$(srcdir)/'`common.c + +ufs_stage1_5_exec-common.obj: common.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT ufs_stage1_5_exec-common.obj -MD -MP -MF "$(DEPDIR)/ufs_stage1_5_exec-common.Tpo" -c -o ufs_stage1_5_exec-common.obj `if test -f 'common.c'; then $(CYGPATH_W) 'common.c'; else $(CYGPATH_W) '$(srcdir)/common.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ufs_stage1_5_exec-common.Tpo" "$(DEPDIR)/ufs_stage1_5_exec-common.Po"; else rm -f "$(DEPDIR)/ufs_stage1_5_exec-common.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='common.c' object='ufs_stage1_5_exec-common.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ufs_stage1_5_exec-common.obj `if test -f 'common.c'; then $(CYGPATH_W) 'common.c'; else $(CYGPATH_W) '$(srcdir)/common.c'; fi` + +ufs_stage1_5_exec-char_io.o: char_io.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT ufs_stage1_5_exec-char_io.o -MD -MP -MF "$(DEPDIR)/ufs_stage1_5_exec-char_io.Tpo" -c -o ufs_stage1_5_exec-char_io.o `test -f 'char_io.c' || echo '$(srcdir)/'`char_io.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ufs_stage1_5_exec-char_io.Tpo" "$(DEPDIR)/ufs_stage1_5_exec-char_io.Po"; else rm -f "$(DEPDIR)/ufs_stage1_5_exec-char_io.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='char_io.c' object='ufs_stage1_5_exec-char_io.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ufs_stage1_5_exec-char_io.o `test -f 'char_io.c' || echo '$(srcdir)/'`char_io.c + +ufs_stage1_5_exec-char_io.obj: char_io.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT ufs_stage1_5_exec-char_io.obj -MD -MP -MF "$(DEPDIR)/ufs_stage1_5_exec-char_io.Tpo" -c -o ufs_stage1_5_exec-char_io.obj `if test -f 'char_io.c'; then $(CYGPATH_W) 'char_io.c'; else $(CYGPATH_W) '$(srcdir)/char_io.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ufs_stage1_5_exec-char_io.Tpo" "$(DEPDIR)/ufs_stage1_5_exec-char_io.Po"; else rm -f "$(DEPDIR)/ufs_stage1_5_exec-char_io.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='char_io.c' object='ufs_stage1_5_exec-char_io.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ufs_stage1_5_exec-char_io.obj `if test -f 'char_io.c'; then $(CYGPATH_W) 'char_io.c'; else $(CYGPATH_W) '$(srcdir)/char_io.c'; fi` + +ufs_stage1_5_exec-disk_io.o: disk_io.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT ufs_stage1_5_exec-disk_io.o -MD -MP -MF "$(DEPDIR)/ufs_stage1_5_exec-disk_io.Tpo" -c -o ufs_stage1_5_exec-disk_io.o `test -f 'disk_io.c' || echo '$(srcdir)/'`disk_io.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ufs_stage1_5_exec-disk_io.Tpo" "$(DEPDIR)/ufs_stage1_5_exec-disk_io.Po"; else rm -f "$(DEPDIR)/ufs_stage1_5_exec-disk_io.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='disk_io.c' object='ufs_stage1_5_exec-disk_io.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ufs_stage1_5_exec-disk_io.o `test -f 'disk_io.c' || echo '$(srcdir)/'`disk_io.c + +ufs_stage1_5_exec-disk_io.obj: disk_io.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT ufs_stage1_5_exec-disk_io.obj -MD -MP -MF "$(DEPDIR)/ufs_stage1_5_exec-disk_io.Tpo" -c -o ufs_stage1_5_exec-disk_io.obj `if test -f 'disk_io.c'; then $(CYGPATH_W) 'disk_io.c'; else $(CYGPATH_W) '$(srcdir)/disk_io.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ufs_stage1_5_exec-disk_io.Tpo" "$(DEPDIR)/ufs_stage1_5_exec-disk_io.Po"; else rm -f "$(DEPDIR)/ufs_stage1_5_exec-disk_io.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='disk_io.c' object='ufs_stage1_5_exec-disk_io.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ufs_stage1_5_exec-disk_io.obj `if test -f 'disk_io.c'; then $(CYGPATH_W) 'disk_io.c'; else $(CYGPATH_W) '$(srcdir)/disk_io.c'; fi` + +ufs_stage1_5_exec-stage1_5.o: stage1_5.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT ufs_stage1_5_exec-stage1_5.o -MD -MP -MF "$(DEPDIR)/ufs_stage1_5_exec-stage1_5.Tpo" -c -o ufs_stage1_5_exec-stage1_5.o `test -f 'stage1_5.c' || echo '$(srcdir)/'`stage1_5.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ufs_stage1_5_exec-stage1_5.Tpo" "$(DEPDIR)/ufs_stage1_5_exec-stage1_5.Po"; else rm -f "$(DEPDIR)/ufs_stage1_5_exec-stage1_5.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='stage1_5.c' object='ufs_stage1_5_exec-stage1_5.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ufs_stage1_5_exec-stage1_5.o `test -f 'stage1_5.c' || echo '$(srcdir)/'`stage1_5.c + +ufs_stage1_5_exec-stage1_5.obj: stage1_5.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT ufs_stage1_5_exec-stage1_5.obj -MD -MP -MF "$(DEPDIR)/ufs_stage1_5_exec-stage1_5.Tpo" -c -o ufs_stage1_5_exec-stage1_5.obj `if test -f 'stage1_5.c'; then $(CYGPATH_W) 'stage1_5.c'; else $(CYGPATH_W) '$(srcdir)/stage1_5.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ufs_stage1_5_exec-stage1_5.Tpo" "$(DEPDIR)/ufs_stage1_5_exec-stage1_5.Po"; else rm -f "$(DEPDIR)/ufs_stage1_5_exec-stage1_5.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='stage1_5.c' object='ufs_stage1_5_exec-stage1_5.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ufs_stage1_5_exec-stage1_5.obj `if test -f 'stage1_5.c'; then $(CYGPATH_W) 'stage1_5.c'; else $(CYGPATH_W) '$(srcdir)/stage1_5.c'; fi` + +ufs_stage1_5_exec-fsys_ufs.o: fsys_ufs.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT ufs_stage1_5_exec-fsys_ufs.o -MD -MP -MF "$(DEPDIR)/ufs_stage1_5_exec-fsys_ufs.Tpo" -c -o ufs_stage1_5_exec-fsys_ufs.o `test -f 'fsys_ufs.c' || echo '$(srcdir)/'`fsys_ufs.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ufs_stage1_5_exec-fsys_ufs.Tpo" "$(DEPDIR)/ufs_stage1_5_exec-fsys_ufs.Po"; else rm -f "$(DEPDIR)/ufs_stage1_5_exec-fsys_ufs.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_ufs.c' object='ufs_stage1_5_exec-fsys_ufs.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ufs_stage1_5_exec-fsys_ufs.o `test -f 'fsys_ufs.c' || echo '$(srcdir)/'`fsys_ufs.c + +ufs_stage1_5_exec-fsys_ufs.obj: fsys_ufs.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT ufs_stage1_5_exec-fsys_ufs.obj -MD -MP -MF "$(DEPDIR)/ufs_stage1_5_exec-fsys_ufs.Tpo" -c -o ufs_stage1_5_exec-fsys_ufs.obj `if test -f 'fsys_ufs.c'; then $(CYGPATH_W) 'fsys_ufs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_ufs.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ufs_stage1_5_exec-fsys_ufs.Tpo" "$(DEPDIR)/ufs_stage1_5_exec-fsys_ufs.Po"; else rm -f "$(DEPDIR)/ufs_stage1_5_exec-fsys_ufs.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_ufs.c' object='ufs_stage1_5_exec-fsys_ufs.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ufs_stage1_5_exec-fsys_ufs.obj `if test -f 'fsys_ufs.c'; then $(CYGPATH_W) 'fsys_ufs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_ufs.c'; fi` + +ufs_stage1_5_exec-bios.o: bios.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT ufs_stage1_5_exec-bios.o -MD -MP -MF "$(DEPDIR)/ufs_stage1_5_exec-bios.Tpo" -c -o ufs_stage1_5_exec-bios.o `test -f 'bios.c' || echo '$(srcdir)/'`bios.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ufs_stage1_5_exec-bios.Tpo" "$(DEPDIR)/ufs_stage1_5_exec-bios.Po"; else rm -f "$(DEPDIR)/ufs_stage1_5_exec-bios.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bios.c' object='ufs_stage1_5_exec-bios.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ufs_stage1_5_exec-bios.o `test -f 'bios.c' || echo '$(srcdir)/'`bios.c + +ufs_stage1_5_exec-bios.obj: bios.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT ufs_stage1_5_exec-bios.obj -MD -MP -MF "$(DEPDIR)/ufs_stage1_5_exec-bios.Tpo" -c -o ufs_stage1_5_exec-bios.obj `if test -f 'bios.c'; then $(CYGPATH_W) 'bios.c'; else $(CYGPATH_W) '$(srcdir)/bios.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ufs_stage1_5_exec-bios.Tpo" "$(DEPDIR)/ufs_stage1_5_exec-bios.Po"; else rm -f "$(DEPDIR)/ufs_stage1_5_exec-bios.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bios.c' object='ufs_stage1_5_exec-bios.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ufs_stage1_5_exec-bios.obj `if test -f 'bios.c'; then $(CYGPATH_W) 'bios.c'; else $(CYGPATH_W) '$(srcdir)/bios.c'; fi` + +zfs_stage1_5_exec-common.o: common.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT zfs_stage1_5_exec-common.o -MD -MP -MF "$(DEPDIR)/zfs_stage1_5_exec-common.Tpo" -c -o zfs_stage1_5_exec-common.o `test -f 'common.c' || echo '$(srcdir)/'`common.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/zfs_stage1_5_exec-common.Tpo" "$(DEPDIR)/zfs_stage1_5_exec-common.Po"; else rm -f "$(DEPDIR)/zfs_stage1_5_exec-common.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='common.c' object='zfs_stage1_5_exec-common.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o zfs_stage1_5_exec-common.o `test -f 'common.c' || echo '$(srcdir)/'`common.c + +zfs_stage1_5_exec-common.obj: common.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT zfs_stage1_5_exec-common.obj -MD -MP -MF "$(DEPDIR)/zfs_stage1_5_exec-common.Tpo" -c -o zfs_stage1_5_exec-common.obj `if test -f 'common.c'; then $(CYGPATH_W) 'common.c'; else $(CYGPATH_W) '$(srcdir)/common.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/zfs_stage1_5_exec-common.Tpo" "$(DEPDIR)/zfs_stage1_5_exec-common.Po"; else rm -f "$(DEPDIR)/zfs_stage1_5_exec-common.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='common.c' object='zfs_stage1_5_exec-common.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o zfs_stage1_5_exec-common.obj `if test -f 'common.c'; then $(CYGPATH_W) 'common.c'; else $(CYGPATH_W) '$(srcdir)/common.c'; fi` + +zfs_stage1_5_exec-char_io.o: char_io.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT zfs_stage1_5_exec-char_io.o -MD -MP -MF "$(DEPDIR)/zfs_stage1_5_exec-char_io.Tpo" -c -o zfs_stage1_5_exec-char_io.o `test -f 'char_io.c' || echo '$(srcdir)/'`char_io.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/zfs_stage1_5_exec-char_io.Tpo" "$(DEPDIR)/zfs_stage1_5_exec-char_io.Po"; else rm -f "$(DEPDIR)/zfs_stage1_5_exec-char_io.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='char_io.c' object='zfs_stage1_5_exec-char_io.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o zfs_stage1_5_exec-char_io.o `test -f 'char_io.c' || echo '$(srcdir)/'`char_io.c + +zfs_stage1_5_exec-char_io.obj: char_io.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT zfs_stage1_5_exec-char_io.obj -MD -MP -MF "$(DEPDIR)/zfs_stage1_5_exec-char_io.Tpo" -c -o zfs_stage1_5_exec-char_io.obj `if test -f 'char_io.c'; then $(CYGPATH_W) 'char_io.c'; else $(CYGPATH_W) '$(srcdir)/char_io.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/zfs_stage1_5_exec-char_io.Tpo" "$(DEPDIR)/zfs_stage1_5_exec-char_io.Po"; else rm -f "$(DEPDIR)/zfs_stage1_5_exec-char_io.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='char_io.c' object='zfs_stage1_5_exec-char_io.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o zfs_stage1_5_exec-char_io.obj `if test -f 'char_io.c'; then $(CYGPATH_W) 'char_io.c'; else $(CYGPATH_W) '$(srcdir)/char_io.c'; fi` + +zfs_stage1_5_exec-disk_io.o: disk_io.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT zfs_stage1_5_exec-disk_io.o -MD -MP -MF "$(DEPDIR)/zfs_stage1_5_exec-disk_io.Tpo" -c -o zfs_stage1_5_exec-disk_io.o `test -f 'disk_io.c' || echo '$(srcdir)/'`disk_io.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/zfs_stage1_5_exec-disk_io.Tpo" "$(DEPDIR)/zfs_stage1_5_exec-disk_io.Po"; else rm -f "$(DEPDIR)/zfs_stage1_5_exec-disk_io.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='disk_io.c' object='zfs_stage1_5_exec-disk_io.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o zfs_stage1_5_exec-disk_io.o `test -f 'disk_io.c' || echo '$(srcdir)/'`disk_io.c + +zfs_stage1_5_exec-disk_io.obj: disk_io.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT zfs_stage1_5_exec-disk_io.obj -MD -MP -MF "$(DEPDIR)/zfs_stage1_5_exec-disk_io.Tpo" -c -o zfs_stage1_5_exec-disk_io.obj `if test -f 'disk_io.c'; then $(CYGPATH_W) 'disk_io.c'; else $(CYGPATH_W) '$(srcdir)/disk_io.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/zfs_stage1_5_exec-disk_io.Tpo" "$(DEPDIR)/zfs_stage1_5_exec-disk_io.Po"; else rm -f "$(DEPDIR)/zfs_stage1_5_exec-disk_io.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='disk_io.c' object='zfs_stage1_5_exec-disk_io.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o zfs_stage1_5_exec-disk_io.obj `if test -f 'disk_io.c'; then $(CYGPATH_W) 'disk_io.c'; else $(CYGPATH_W) '$(srcdir)/disk_io.c'; fi` + +zfs_stage1_5_exec-stage1_5.o: stage1_5.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT zfs_stage1_5_exec-stage1_5.o -MD -MP -MF "$(DEPDIR)/zfs_stage1_5_exec-stage1_5.Tpo" -c -o zfs_stage1_5_exec-stage1_5.o `test -f 'stage1_5.c' || echo '$(srcdir)/'`stage1_5.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/zfs_stage1_5_exec-stage1_5.Tpo" "$(DEPDIR)/zfs_stage1_5_exec-stage1_5.Po"; else rm -f "$(DEPDIR)/zfs_stage1_5_exec-stage1_5.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='stage1_5.c' object='zfs_stage1_5_exec-stage1_5.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o zfs_stage1_5_exec-stage1_5.o `test -f 'stage1_5.c' || echo '$(srcdir)/'`stage1_5.c + +zfs_stage1_5_exec-stage1_5.obj: stage1_5.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT zfs_stage1_5_exec-stage1_5.obj -MD -MP -MF "$(DEPDIR)/zfs_stage1_5_exec-stage1_5.Tpo" -c -o zfs_stage1_5_exec-stage1_5.obj `if test -f 'stage1_5.c'; then $(CYGPATH_W) 'stage1_5.c'; else $(CYGPATH_W) '$(srcdir)/stage1_5.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/zfs_stage1_5_exec-stage1_5.Tpo" "$(DEPDIR)/zfs_stage1_5_exec-stage1_5.Po"; else rm -f "$(DEPDIR)/zfs_stage1_5_exec-stage1_5.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='stage1_5.c' object='zfs_stage1_5_exec-stage1_5.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o zfs_stage1_5_exec-stage1_5.obj `if test -f 'stage1_5.c'; then $(CYGPATH_W) 'stage1_5.c'; else $(CYGPATH_W) '$(srcdir)/stage1_5.c'; fi` + +zfs_stage1_5_exec-zfs_sha256.o: zfs_sha256.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT zfs_stage1_5_exec-zfs_sha256.o -MD -MP -MF "$(DEPDIR)/zfs_stage1_5_exec-zfs_sha256.Tpo" -c -o zfs_stage1_5_exec-zfs_sha256.o `test -f 'zfs_sha256.c' || echo '$(srcdir)/'`zfs_sha256.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/zfs_stage1_5_exec-zfs_sha256.Tpo" "$(DEPDIR)/zfs_stage1_5_exec-zfs_sha256.Po"; else rm -f "$(DEPDIR)/zfs_stage1_5_exec-zfs_sha256.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='zfs_sha256.c' object='zfs_stage1_5_exec-zfs_sha256.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o zfs_stage1_5_exec-zfs_sha256.o `test -f 'zfs_sha256.c' || echo '$(srcdir)/'`zfs_sha256.c + +zfs_stage1_5_exec-zfs_sha256.obj: zfs_sha256.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT zfs_stage1_5_exec-zfs_sha256.obj -MD -MP -MF "$(DEPDIR)/zfs_stage1_5_exec-zfs_sha256.Tpo" -c -o zfs_stage1_5_exec-zfs_sha256.obj `if test -f 'zfs_sha256.c'; then $(CYGPATH_W) 'zfs_sha256.c'; else $(CYGPATH_W) '$(srcdir)/zfs_sha256.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/zfs_stage1_5_exec-zfs_sha256.Tpo" "$(DEPDIR)/zfs_stage1_5_exec-zfs_sha256.Po"; else rm -f "$(DEPDIR)/zfs_stage1_5_exec-zfs_sha256.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='zfs_sha256.c' object='zfs_stage1_5_exec-zfs_sha256.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o zfs_stage1_5_exec-zfs_sha256.obj `if test -f 'zfs_sha256.c'; then $(CYGPATH_W) 'zfs_sha256.c'; else $(CYGPATH_W) '$(srcdir)/zfs_sha256.c'; fi` + +zfs_stage1_5_exec-zfs_lzjb.o: zfs_lzjb.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT zfs_stage1_5_exec-zfs_lzjb.o -MD -MP -MF "$(DEPDIR)/zfs_stage1_5_exec-zfs_lzjb.Tpo" -c -o zfs_stage1_5_exec-zfs_lzjb.o `test -f 'zfs_lzjb.c' || echo '$(srcdir)/'`zfs_lzjb.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/zfs_stage1_5_exec-zfs_lzjb.Tpo" "$(DEPDIR)/zfs_stage1_5_exec-zfs_lzjb.Po"; else rm -f "$(DEPDIR)/zfs_stage1_5_exec-zfs_lzjb.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='zfs_lzjb.c' object='zfs_stage1_5_exec-zfs_lzjb.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o zfs_stage1_5_exec-zfs_lzjb.o `test -f 'zfs_lzjb.c' || echo '$(srcdir)/'`zfs_lzjb.c + +zfs_stage1_5_exec-zfs_lzjb.obj: zfs_lzjb.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT zfs_stage1_5_exec-zfs_lzjb.obj -MD -MP -MF "$(DEPDIR)/zfs_stage1_5_exec-zfs_lzjb.Tpo" -c -o zfs_stage1_5_exec-zfs_lzjb.obj `if test -f 'zfs_lzjb.c'; then $(CYGPATH_W) 'zfs_lzjb.c'; else $(CYGPATH_W) '$(srcdir)/zfs_lzjb.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/zfs_stage1_5_exec-zfs_lzjb.Tpo" "$(DEPDIR)/zfs_stage1_5_exec-zfs_lzjb.Po"; else rm -f "$(DEPDIR)/zfs_stage1_5_exec-zfs_lzjb.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='zfs_lzjb.c' object='zfs_stage1_5_exec-zfs_lzjb.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o zfs_stage1_5_exec-zfs_lzjb.obj `if test -f 'zfs_lzjb.c'; then $(CYGPATH_W) 'zfs_lzjb.c'; else $(CYGPATH_W) '$(srcdir)/zfs_lzjb.c'; fi` + +zfs_stage1_5_exec-zfs_fletcher.o: zfs_fletcher.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT zfs_stage1_5_exec-zfs_fletcher.o -MD -MP -MF "$(DEPDIR)/zfs_stage1_5_exec-zfs_fletcher.Tpo" -c -o zfs_stage1_5_exec-zfs_fletcher.o `test -f 'zfs_fletcher.c' || echo '$(srcdir)/'`zfs_fletcher.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/zfs_stage1_5_exec-zfs_fletcher.Tpo" "$(DEPDIR)/zfs_stage1_5_exec-zfs_fletcher.Po"; else rm -f "$(DEPDIR)/zfs_stage1_5_exec-zfs_fletcher.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='zfs_fletcher.c' object='zfs_stage1_5_exec-zfs_fletcher.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o zfs_stage1_5_exec-zfs_fletcher.o `test -f 'zfs_fletcher.c' || echo '$(srcdir)/'`zfs_fletcher.c + +zfs_stage1_5_exec-zfs_fletcher.obj: zfs_fletcher.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT zfs_stage1_5_exec-zfs_fletcher.obj -MD -MP -MF "$(DEPDIR)/zfs_stage1_5_exec-zfs_fletcher.Tpo" -c -o zfs_stage1_5_exec-zfs_fletcher.obj `if test -f 'zfs_fletcher.c'; then $(CYGPATH_W) 'zfs_fletcher.c'; else $(CYGPATH_W) '$(srcdir)/zfs_fletcher.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/zfs_stage1_5_exec-zfs_fletcher.Tpo" "$(DEPDIR)/zfs_stage1_5_exec-zfs_fletcher.Po"; else rm -f "$(DEPDIR)/zfs_stage1_5_exec-zfs_fletcher.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='zfs_fletcher.c' object='zfs_stage1_5_exec-zfs_fletcher.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o zfs_stage1_5_exec-zfs_fletcher.obj `if test -f 'zfs_fletcher.c'; then $(CYGPATH_W) 'zfs_fletcher.c'; else $(CYGPATH_W) '$(srcdir)/zfs_fletcher.c'; fi` + +zfs_stage1_5_exec-fsys_zfs.o: fsys_zfs.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT zfs_stage1_5_exec-fsys_zfs.o -MD -MP -MF "$(DEPDIR)/zfs_stage1_5_exec-fsys_zfs.Tpo" -c -o zfs_stage1_5_exec-fsys_zfs.o `test -f 'fsys_zfs.c' || echo '$(srcdir)/'`fsys_zfs.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/zfs_stage1_5_exec-fsys_zfs.Tpo" "$(DEPDIR)/zfs_stage1_5_exec-fsys_zfs.Po"; else rm -f "$(DEPDIR)/zfs_stage1_5_exec-fsys_zfs.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_zfs.c' object='zfs_stage1_5_exec-fsys_zfs.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o zfs_stage1_5_exec-fsys_zfs.o `test -f 'fsys_zfs.c' || echo '$(srcdir)/'`fsys_zfs.c + +zfs_stage1_5_exec-fsys_zfs.obj: fsys_zfs.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT zfs_stage1_5_exec-fsys_zfs.obj -MD -MP -MF "$(DEPDIR)/zfs_stage1_5_exec-fsys_zfs.Tpo" -c -o zfs_stage1_5_exec-fsys_zfs.obj `if test -f 'fsys_zfs.c'; then $(CYGPATH_W) 'fsys_zfs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_zfs.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/zfs_stage1_5_exec-fsys_zfs.Tpo" "$(DEPDIR)/zfs_stage1_5_exec-fsys_zfs.Po"; else rm -f "$(DEPDIR)/zfs_stage1_5_exec-fsys_zfs.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_zfs.c' object='zfs_stage1_5_exec-fsys_zfs.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o zfs_stage1_5_exec-fsys_zfs.obj `if test -f 'fsys_zfs.c'; then $(CYGPATH_W) 'fsys_zfs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_zfs.c'; fi` + +zfs_stage1_5_exec-bios.o: bios.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT zfs_stage1_5_exec-bios.o -MD -MP -MF "$(DEPDIR)/zfs_stage1_5_exec-bios.Tpo" -c -o zfs_stage1_5_exec-bios.o `test -f 'bios.c' || echo '$(srcdir)/'`bios.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/zfs_stage1_5_exec-bios.Tpo" "$(DEPDIR)/zfs_stage1_5_exec-bios.Po"; else rm -f "$(DEPDIR)/zfs_stage1_5_exec-bios.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bios.c' object='zfs_stage1_5_exec-bios.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o zfs_stage1_5_exec-bios.o `test -f 'bios.c' || echo '$(srcdir)/'`bios.c + +zfs_stage1_5_exec-bios.obj: bios.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT zfs_stage1_5_exec-bios.obj -MD -MP -MF "$(DEPDIR)/zfs_stage1_5_exec-bios.Tpo" -c -o zfs_stage1_5_exec-bios.obj `if test -f 'bios.c'; then $(CYGPATH_W) 'bios.c'; else $(CYGPATH_W) '$(srcdir)/bios.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/zfs_stage1_5_exec-bios.Tpo" "$(DEPDIR)/zfs_stage1_5_exec-bios.Po"; else rm -f "$(DEPDIR)/zfs_stage1_5_exec-bios.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bios.c' object='zfs_stage1_5_exec-bios.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o zfs_stage1_5_exec-bios.obj `if test -f 'bios.c'; then $(CYGPATH_W) 'bios.c'; else $(CYGPATH_W) '$(srcdir)/bios.c'; fi` + +vstafs_stage1_5_exec-common.o: common.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vstafs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT vstafs_stage1_5_exec-common.o -MD -MP -MF "$(DEPDIR)/vstafs_stage1_5_exec-common.Tpo" -c -o vstafs_stage1_5_exec-common.o `test -f 'common.c' || echo '$(srcdir)/'`common.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/vstafs_stage1_5_exec-common.Tpo" "$(DEPDIR)/vstafs_stage1_5_exec-common.Po"; else rm -f "$(DEPDIR)/vstafs_stage1_5_exec-common.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='common.c' object='vstafs_stage1_5_exec-common.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vstafs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o vstafs_stage1_5_exec-common.o `test -f 'common.c' || echo '$(srcdir)/'`common.c + +vstafs_stage1_5_exec-common.obj: common.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vstafs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT vstafs_stage1_5_exec-common.obj -MD -MP -MF "$(DEPDIR)/vstafs_stage1_5_exec-common.Tpo" -c -o vstafs_stage1_5_exec-common.obj `if test -f 'common.c'; then $(CYGPATH_W) 'common.c'; else $(CYGPATH_W) '$(srcdir)/common.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/vstafs_stage1_5_exec-common.Tpo" "$(DEPDIR)/vstafs_stage1_5_exec-common.Po"; else rm -f "$(DEPDIR)/vstafs_stage1_5_exec-common.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='common.c' object='vstafs_stage1_5_exec-common.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vstafs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o vstafs_stage1_5_exec-common.obj `if test -f 'common.c'; then $(CYGPATH_W) 'common.c'; else $(CYGPATH_W) '$(srcdir)/common.c'; fi` + +vstafs_stage1_5_exec-char_io.o: char_io.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vstafs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT vstafs_stage1_5_exec-char_io.o -MD -MP -MF "$(DEPDIR)/vstafs_stage1_5_exec-char_io.Tpo" -c -o vstafs_stage1_5_exec-char_io.o `test -f 'char_io.c' || echo '$(srcdir)/'`char_io.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/vstafs_stage1_5_exec-char_io.Tpo" "$(DEPDIR)/vstafs_stage1_5_exec-char_io.Po"; else rm -f "$(DEPDIR)/vstafs_stage1_5_exec-char_io.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='char_io.c' object='vstafs_stage1_5_exec-char_io.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vstafs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o vstafs_stage1_5_exec-char_io.o `test -f 'char_io.c' || echo '$(srcdir)/'`char_io.c + +vstafs_stage1_5_exec-char_io.obj: char_io.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vstafs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT vstafs_stage1_5_exec-char_io.obj -MD -MP -MF "$(DEPDIR)/vstafs_stage1_5_exec-char_io.Tpo" -c -o vstafs_stage1_5_exec-char_io.obj `if test -f 'char_io.c'; then $(CYGPATH_W) 'char_io.c'; else $(CYGPATH_W) '$(srcdir)/char_io.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/vstafs_stage1_5_exec-char_io.Tpo" "$(DEPDIR)/vstafs_stage1_5_exec-char_io.Po"; else rm -f "$(DEPDIR)/vstafs_stage1_5_exec-char_io.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='char_io.c' object='vstafs_stage1_5_exec-char_io.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vstafs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o vstafs_stage1_5_exec-char_io.obj `if test -f 'char_io.c'; then $(CYGPATH_W) 'char_io.c'; else $(CYGPATH_W) '$(srcdir)/char_io.c'; fi` + +vstafs_stage1_5_exec-disk_io.o: disk_io.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vstafs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT vstafs_stage1_5_exec-disk_io.o -MD -MP -MF "$(DEPDIR)/vstafs_stage1_5_exec-disk_io.Tpo" -c -o vstafs_stage1_5_exec-disk_io.o `test -f 'disk_io.c' || echo '$(srcdir)/'`disk_io.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/vstafs_stage1_5_exec-disk_io.Tpo" "$(DEPDIR)/vstafs_stage1_5_exec-disk_io.Po"; else rm -f "$(DEPDIR)/vstafs_stage1_5_exec-disk_io.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='disk_io.c' object='vstafs_stage1_5_exec-disk_io.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vstafs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o vstafs_stage1_5_exec-disk_io.o `test -f 'disk_io.c' || echo '$(srcdir)/'`disk_io.c + +vstafs_stage1_5_exec-disk_io.obj: disk_io.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vstafs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT vstafs_stage1_5_exec-disk_io.obj -MD -MP -MF "$(DEPDIR)/vstafs_stage1_5_exec-disk_io.Tpo" -c -o vstafs_stage1_5_exec-disk_io.obj `if test -f 'disk_io.c'; then $(CYGPATH_W) 'disk_io.c'; else $(CYGPATH_W) '$(srcdir)/disk_io.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/vstafs_stage1_5_exec-disk_io.Tpo" "$(DEPDIR)/vstafs_stage1_5_exec-disk_io.Po"; else rm -f "$(DEPDIR)/vstafs_stage1_5_exec-disk_io.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='disk_io.c' object='vstafs_stage1_5_exec-disk_io.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vstafs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o vstafs_stage1_5_exec-disk_io.obj `if test -f 'disk_io.c'; then $(CYGPATH_W) 'disk_io.c'; else $(CYGPATH_W) '$(srcdir)/disk_io.c'; fi` + +vstafs_stage1_5_exec-stage1_5.o: stage1_5.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vstafs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT vstafs_stage1_5_exec-stage1_5.o -MD -MP -MF "$(DEPDIR)/vstafs_stage1_5_exec-stage1_5.Tpo" -c -o vstafs_stage1_5_exec-stage1_5.o `test -f 'stage1_5.c' || echo '$(srcdir)/'`stage1_5.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/vstafs_stage1_5_exec-stage1_5.Tpo" "$(DEPDIR)/vstafs_stage1_5_exec-stage1_5.Po"; else rm -f "$(DEPDIR)/vstafs_stage1_5_exec-stage1_5.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='stage1_5.c' object='vstafs_stage1_5_exec-stage1_5.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vstafs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o vstafs_stage1_5_exec-stage1_5.o `test -f 'stage1_5.c' || echo '$(srcdir)/'`stage1_5.c + +vstafs_stage1_5_exec-stage1_5.obj: stage1_5.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vstafs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT vstafs_stage1_5_exec-stage1_5.obj -MD -MP -MF "$(DEPDIR)/vstafs_stage1_5_exec-stage1_5.Tpo" -c -o vstafs_stage1_5_exec-stage1_5.obj `if test -f 'stage1_5.c'; then $(CYGPATH_W) 'stage1_5.c'; else $(CYGPATH_W) '$(srcdir)/stage1_5.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/vstafs_stage1_5_exec-stage1_5.Tpo" "$(DEPDIR)/vstafs_stage1_5_exec-stage1_5.Po"; else rm -f "$(DEPDIR)/vstafs_stage1_5_exec-stage1_5.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='stage1_5.c' object='vstafs_stage1_5_exec-stage1_5.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vstafs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o vstafs_stage1_5_exec-stage1_5.obj `if test -f 'stage1_5.c'; then $(CYGPATH_W) 'stage1_5.c'; else $(CYGPATH_W) '$(srcdir)/stage1_5.c'; fi` + +vstafs_stage1_5_exec-fsys_vstafs.o: fsys_vstafs.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vstafs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT vstafs_stage1_5_exec-fsys_vstafs.o -MD -MP -MF "$(DEPDIR)/vstafs_stage1_5_exec-fsys_vstafs.Tpo" -c -o vstafs_stage1_5_exec-fsys_vstafs.o `test -f 'fsys_vstafs.c' || echo '$(srcdir)/'`fsys_vstafs.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/vstafs_stage1_5_exec-fsys_vstafs.Tpo" "$(DEPDIR)/vstafs_stage1_5_exec-fsys_vstafs.Po"; else rm -f "$(DEPDIR)/vstafs_stage1_5_exec-fsys_vstafs.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_vstafs.c' object='vstafs_stage1_5_exec-fsys_vstafs.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vstafs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o vstafs_stage1_5_exec-fsys_vstafs.o `test -f 'fsys_vstafs.c' || echo '$(srcdir)/'`fsys_vstafs.c + +vstafs_stage1_5_exec-fsys_vstafs.obj: fsys_vstafs.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vstafs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT vstafs_stage1_5_exec-fsys_vstafs.obj -MD -MP -MF "$(DEPDIR)/vstafs_stage1_5_exec-fsys_vstafs.Tpo" -c -o vstafs_stage1_5_exec-fsys_vstafs.obj `if test -f 'fsys_vstafs.c'; then $(CYGPATH_W) 'fsys_vstafs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_vstafs.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/vstafs_stage1_5_exec-fsys_vstafs.Tpo" "$(DEPDIR)/vstafs_stage1_5_exec-fsys_vstafs.Po"; else rm -f "$(DEPDIR)/vstafs_stage1_5_exec-fsys_vstafs.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_vstafs.c' object='vstafs_stage1_5_exec-fsys_vstafs.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vstafs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o vstafs_stage1_5_exec-fsys_vstafs.obj `if test -f 'fsys_vstafs.c'; then $(CYGPATH_W) 'fsys_vstafs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_vstafs.c'; fi` + +vstafs_stage1_5_exec-bios.o: bios.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vstafs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT vstafs_stage1_5_exec-bios.o -MD -MP -MF "$(DEPDIR)/vstafs_stage1_5_exec-bios.Tpo" -c -o vstafs_stage1_5_exec-bios.o `test -f 'bios.c' || echo '$(srcdir)/'`bios.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/vstafs_stage1_5_exec-bios.Tpo" "$(DEPDIR)/vstafs_stage1_5_exec-bios.Po"; else rm -f "$(DEPDIR)/vstafs_stage1_5_exec-bios.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bios.c' object='vstafs_stage1_5_exec-bios.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vstafs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o vstafs_stage1_5_exec-bios.o `test -f 'bios.c' || echo '$(srcdir)/'`bios.c + +vstafs_stage1_5_exec-bios.obj: bios.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vstafs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT vstafs_stage1_5_exec-bios.obj -MD -MP -MF "$(DEPDIR)/vstafs_stage1_5_exec-bios.Tpo" -c -o vstafs_stage1_5_exec-bios.obj `if test -f 'bios.c'; then $(CYGPATH_W) 'bios.c'; else $(CYGPATH_W) '$(srcdir)/bios.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/vstafs_stage1_5_exec-bios.Tpo" "$(DEPDIR)/vstafs_stage1_5_exec-bios.Po"; else rm -f "$(DEPDIR)/vstafs_stage1_5_exec-bios.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bios.c' object='vstafs_stage1_5_exec-bios.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vstafs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o vstafs_stage1_5_exec-bios.obj `if test -f 'bios.c'; then $(CYGPATH_W) 'bios.c'; else $(CYGPATH_W) '$(srcdir)/bios.c'; fi` + +xfs_stage1_5_exec-common.o: common.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT xfs_stage1_5_exec-common.o -MD -MP -MF "$(DEPDIR)/xfs_stage1_5_exec-common.Tpo" -c -o xfs_stage1_5_exec-common.o `test -f 'common.c' || echo '$(srcdir)/'`common.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/xfs_stage1_5_exec-common.Tpo" "$(DEPDIR)/xfs_stage1_5_exec-common.Po"; else rm -f "$(DEPDIR)/xfs_stage1_5_exec-common.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='common.c' object='xfs_stage1_5_exec-common.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o xfs_stage1_5_exec-common.o `test -f 'common.c' || echo '$(srcdir)/'`common.c + +xfs_stage1_5_exec-common.obj: common.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT xfs_stage1_5_exec-common.obj -MD -MP -MF "$(DEPDIR)/xfs_stage1_5_exec-common.Tpo" -c -o xfs_stage1_5_exec-common.obj `if test -f 'common.c'; then $(CYGPATH_W) 'common.c'; else $(CYGPATH_W) '$(srcdir)/common.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/xfs_stage1_5_exec-common.Tpo" "$(DEPDIR)/xfs_stage1_5_exec-common.Po"; else rm -f "$(DEPDIR)/xfs_stage1_5_exec-common.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='common.c' object='xfs_stage1_5_exec-common.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o xfs_stage1_5_exec-common.obj `if test -f 'common.c'; then $(CYGPATH_W) 'common.c'; else $(CYGPATH_W) '$(srcdir)/common.c'; fi` + +xfs_stage1_5_exec-char_io.o: char_io.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT xfs_stage1_5_exec-char_io.o -MD -MP -MF "$(DEPDIR)/xfs_stage1_5_exec-char_io.Tpo" -c -o xfs_stage1_5_exec-char_io.o `test -f 'char_io.c' || echo '$(srcdir)/'`char_io.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/xfs_stage1_5_exec-char_io.Tpo" "$(DEPDIR)/xfs_stage1_5_exec-char_io.Po"; else rm -f "$(DEPDIR)/xfs_stage1_5_exec-char_io.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='char_io.c' object='xfs_stage1_5_exec-char_io.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o xfs_stage1_5_exec-char_io.o `test -f 'char_io.c' || echo '$(srcdir)/'`char_io.c + +xfs_stage1_5_exec-char_io.obj: char_io.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT xfs_stage1_5_exec-char_io.obj -MD -MP -MF "$(DEPDIR)/xfs_stage1_5_exec-char_io.Tpo" -c -o xfs_stage1_5_exec-char_io.obj `if test -f 'char_io.c'; then $(CYGPATH_W) 'char_io.c'; else $(CYGPATH_W) '$(srcdir)/char_io.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/xfs_stage1_5_exec-char_io.Tpo" "$(DEPDIR)/xfs_stage1_5_exec-char_io.Po"; else rm -f "$(DEPDIR)/xfs_stage1_5_exec-char_io.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='char_io.c' object='xfs_stage1_5_exec-char_io.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o xfs_stage1_5_exec-char_io.obj `if test -f 'char_io.c'; then $(CYGPATH_W) 'char_io.c'; else $(CYGPATH_W) '$(srcdir)/char_io.c'; fi` + +xfs_stage1_5_exec-disk_io.o: disk_io.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT xfs_stage1_5_exec-disk_io.o -MD -MP -MF "$(DEPDIR)/xfs_stage1_5_exec-disk_io.Tpo" -c -o xfs_stage1_5_exec-disk_io.o `test -f 'disk_io.c' || echo '$(srcdir)/'`disk_io.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/xfs_stage1_5_exec-disk_io.Tpo" "$(DEPDIR)/xfs_stage1_5_exec-disk_io.Po"; else rm -f "$(DEPDIR)/xfs_stage1_5_exec-disk_io.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='disk_io.c' object='xfs_stage1_5_exec-disk_io.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o xfs_stage1_5_exec-disk_io.o `test -f 'disk_io.c' || echo '$(srcdir)/'`disk_io.c + +xfs_stage1_5_exec-disk_io.obj: disk_io.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT xfs_stage1_5_exec-disk_io.obj -MD -MP -MF "$(DEPDIR)/xfs_stage1_5_exec-disk_io.Tpo" -c -o xfs_stage1_5_exec-disk_io.obj `if test -f 'disk_io.c'; then $(CYGPATH_W) 'disk_io.c'; else $(CYGPATH_W) '$(srcdir)/disk_io.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/xfs_stage1_5_exec-disk_io.Tpo" "$(DEPDIR)/xfs_stage1_5_exec-disk_io.Po"; else rm -f "$(DEPDIR)/xfs_stage1_5_exec-disk_io.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='disk_io.c' object='xfs_stage1_5_exec-disk_io.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o xfs_stage1_5_exec-disk_io.obj `if test -f 'disk_io.c'; then $(CYGPATH_W) 'disk_io.c'; else $(CYGPATH_W) '$(srcdir)/disk_io.c'; fi` + +xfs_stage1_5_exec-stage1_5.o: stage1_5.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT xfs_stage1_5_exec-stage1_5.o -MD -MP -MF "$(DEPDIR)/xfs_stage1_5_exec-stage1_5.Tpo" -c -o xfs_stage1_5_exec-stage1_5.o `test -f 'stage1_5.c' || echo '$(srcdir)/'`stage1_5.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/xfs_stage1_5_exec-stage1_5.Tpo" "$(DEPDIR)/xfs_stage1_5_exec-stage1_5.Po"; else rm -f "$(DEPDIR)/xfs_stage1_5_exec-stage1_5.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='stage1_5.c' object='xfs_stage1_5_exec-stage1_5.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o xfs_stage1_5_exec-stage1_5.o `test -f 'stage1_5.c' || echo '$(srcdir)/'`stage1_5.c + +xfs_stage1_5_exec-stage1_5.obj: stage1_5.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT xfs_stage1_5_exec-stage1_5.obj -MD -MP -MF "$(DEPDIR)/xfs_stage1_5_exec-stage1_5.Tpo" -c -o xfs_stage1_5_exec-stage1_5.obj `if test -f 'stage1_5.c'; then $(CYGPATH_W) 'stage1_5.c'; else $(CYGPATH_W) '$(srcdir)/stage1_5.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/xfs_stage1_5_exec-stage1_5.Tpo" "$(DEPDIR)/xfs_stage1_5_exec-stage1_5.Po"; else rm -f "$(DEPDIR)/xfs_stage1_5_exec-stage1_5.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='stage1_5.c' object='xfs_stage1_5_exec-stage1_5.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o xfs_stage1_5_exec-stage1_5.obj `if test -f 'stage1_5.c'; then $(CYGPATH_W) 'stage1_5.c'; else $(CYGPATH_W) '$(srcdir)/stage1_5.c'; fi` + +xfs_stage1_5_exec-fsys_xfs.o: fsys_xfs.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT xfs_stage1_5_exec-fsys_xfs.o -MD -MP -MF "$(DEPDIR)/xfs_stage1_5_exec-fsys_xfs.Tpo" -c -o xfs_stage1_5_exec-fsys_xfs.o `test -f 'fsys_xfs.c' || echo '$(srcdir)/'`fsys_xfs.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/xfs_stage1_5_exec-fsys_xfs.Tpo" "$(DEPDIR)/xfs_stage1_5_exec-fsys_xfs.Po"; else rm -f "$(DEPDIR)/xfs_stage1_5_exec-fsys_xfs.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_xfs.c' object='xfs_stage1_5_exec-fsys_xfs.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o xfs_stage1_5_exec-fsys_xfs.o `test -f 'fsys_xfs.c' || echo '$(srcdir)/'`fsys_xfs.c + +xfs_stage1_5_exec-fsys_xfs.obj: fsys_xfs.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT xfs_stage1_5_exec-fsys_xfs.obj -MD -MP -MF "$(DEPDIR)/xfs_stage1_5_exec-fsys_xfs.Tpo" -c -o xfs_stage1_5_exec-fsys_xfs.obj `if test -f 'fsys_xfs.c'; then $(CYGPATH_W) 'fsys_xfs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_xfs.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/xfs_stage1_5_exec-fsys_xfs.Tpo" "$(DEPDIR)/xfs_stage1_5_exec-fsys_xfs.Po"; else rm -f "$(DEPDIR)/xfs_stage1_5_exec-fsys_xfs.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_xfs.c' object='xfs_stage1_5_exec-fsys_xfs.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o xfs_stage1_5_exec-fsys_xfs.obj `if test -f 'fsys_xfs.c'; then $(CYGPATH_W) 'fsys_xfs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_xfs.c'; fi` + +xfs_stage1_5_exec-bios.o: bios.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT xfs_stage1_5_exec-bios.o -MD -MP -MF "$(DEPDIR)/xfs_stage1_5_exec-bios.Tpo" -c -o xfs_stage1_5_exec-bios.o `test -f 'bios.c' || echo '$(srcdir)/'`bios.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/xfs_stage1_5_exec-bios.Tpo" "$(DEPDIR)/xfs_stage1_5_exec-bios.Po"; else rm -f "$(DEPDIR)/xfs_stage1_5_exec-bios.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bios.c' object='xfs_stage1_5_exec-bios.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o xfs_stage1_5_exec-bios.o `test -f 'bios.c' || echo '$(srcdir)/'`bios.c + +xfs_stage1_5_exec-bios.obj: bios.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT xfs_stage1_5_exec-bios.obj -MD -MP -MF "$(DEPDIR)/xfs_stage1_5_exec-bios.Tpo" -c -o xfs_stage1_5_exec-bios.obj `if test -f 'bios.c'; then $(CYGPATH_W) 'bios.c'; else $(CYGPATH_W) '$(srcdir)/bios.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/xfs_stage1_5_exec-bios.Tpo" "$(DEPDIR)/xfs_stage1_5_exec-bios.Po"; else rm -f "$(DEPDIR)/xfs_stage1_5_exec-bios.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bios.c' object='xfs_stage1_5_exec-bios.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o xfs_stage1_5_exec-bios.obj `if test -f 'bios.c'; then $(CYGPATH_W) 'bios.c'; else $(CYGPATH_W) '$(srcdir)/bios.c'; fi` +uninstall-info-am: +install-pkglibDATA: $(pkglib_DATA) + @$(NORMAL_INSTALL) + test -z "$(pkglibdir)" || $(mkdir_p) "$(DESTDIR)$(pkglibdir)" + @list='$(pkglib_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(pkglibDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(pkglibdir)/$$f'"; \ + $(pkglibDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(pkglibdir)/$$f"; \ + done + +uninstall-pkglibDATA: + @$(NORMAL_UNINSTALL) + @list='$(pkglib_DATA)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(pkglibdir)/$$f'"; \ + rm -f "$(DESTDIR)$(pkglibdir)/$$f"; \ + done + + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +check-TESTS: $(TESTS) + @failed=0; all=0; xfail=0; xpass=0; skip=0; \ + srcdir=$(srcdir); export srcdir; \ + list='$(TESTS)'; \ + if test -n "$$list"; then \ + for tst in $$list; do \ + if test -f ./$$tst; then dir=./; \ + elif test -f $$tst; then dir=; \ + else dir="$(srcdir)/"; fi; \ + if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *" $$tst "*) \ + xpass=`expr $$xpass + 1`; \ + failed=`expr $$failed + 1`; \ + echo "XPASS: $$tst"; \ + ;; \ + *) \ + echo "PASS: $$tst"; \ + ;; \ + esac; \ + elif test $$? -ne 77; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *" $$tst "*) \ + xfail=`expr $$xfail + 1`; \ + echo "XFAIL: $$tst"; \ + ;; \ + *) \ + failed=`expr $$failed + 1`; \ + echo "FAIL: $$tst"; \ + ;; \ + esac; \ + else \ + skip=`expr $$skip + 1`; \ + echo "SKIP: $$tst"; \ + fi; \ + done; \ + if test "$$failed" -eq 0; then \ + if test "$$xfail" -eq 0; then \ + banner="All $$all tests passed"; \ + else \ + banner="All $$all tests behaved as expected ($$xfail expected failures)"; \ + fi; \ + else \ + if test "$$xpass" -eq 0; then \ + banner="$$failed of $$all tests failed"; \ + else \ + banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \ + fi; \ + fi; \ + dashes="$$banner"; \ + skipped=""; \ + if test "$$skip" -ne 0; then \ + skipped="($$skip tests were not run)"; \ + test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$skipped"; \ + fi; \ + report=""; \ + if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ + report="Please report to $(PACKAGE_BUGREPORT)"; \ + test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$report"; \ + fi; \ + dashes=`echo "$$dashes" | sed s/./=/g`; \ + echo "$$dashes"; \ + echo "$$banner"; \ + test -z "$$skipped" || echo "$$skipped"; \ + test -z "$$report" || echo "$$report"; \ + echo "$$dashes"; \ + test "$$failed" -eq 0; \ + else :; fi + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) check-TESTS +check: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) check-am +all-am: Makefile $(LIBRARIES) $(PROGRAMS) $(SCRIPTS) $(DATA) \ + $(HEADERS) +installdirs: + for dir in "$(DESTDIR)$(pkglibdir)"; do \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ + done +install: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES) + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) +clean: clean-am + +clean-am: clean-generic clean-noinstLIBRARIES clean-noinstPROGRAMS \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: install-pkglibDATA + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am uninstall-pkglibDATA + +.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \ + clean-generic clean-noinstLIBRARIES clean-noinstPROGRAMS ctags \ + distclean distclean-compile distclean-generic distclean-tags \ + distdir dvi dvi-am html html-am info info-am install \ + install-am install-data install-data-am install-exec \ + install-exec-am install-info install-info-am install-man \ + install-pkglibDATA install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \ + ps ps-am tags uninstall uninstall-am uninstall-info-am \ + uninstall-pkglibDATA + + +stage2_size.h: pre_stage2 + -rm -f stage2_size.h + set dummy `ls -l pre_stage2`; \ + echo "#define STAGE2_SIZE $$6" > stage2_size.h + +# XXX: automake doesn't provide a way to specify dependencies for object +# files explicitly, so we must write this by a general Makefile scheme. +# If automake change the naming scheme for per-executable objects, this +# will be broken. +start_exec-start.$(OBJEXT): stage2_size.h + +stage2: pre_stage2 start + -rm -f stage2 + cat start pre_stage2 > stage2 + +start_eltorito_exec-start.$(OBJEXT): stage2_size.h + +stage2_eltorito: pre_stage2 start_eltorito + -rm -f stage2_eltorito + cat start_eltorito pre_stage2 > stage2_eltorito + +diskless_size.h: diskless + -rm -f $@ + set dummy `ls -l $^`; \ + echo "#define DISKLESS_SIZE $$6" > $@ + +# XXX: See the comment for start_exec-start.o. +nbloader_exec-nbloader.$(OBJEXT): diskless_size.h + +# For nbgrub target. +nbgrub: nbloader diskless + -rm -f $@ + cat $^ > $@ + +# XXX: See the comment for start_exec-start.o. +pxeloader_exec-pxeloader.$(OBJEXT): diskless_size.h + +# For pxegrub target. +pxegrub: pxeloader diskless + -rm -f $@ + cat $^ > $@ +.exec: + $(OBJCOPY) -O binary $< $@ +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/usr/src/grub/grub-0.97/stage2/Makefile.solaris b/usr/src/grub/grub-0.97/stage2/Makefile.solaris new file mode 100644 index 0000000000..8363441bad --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/Makefile.solaris @@ -0,0 +1,941 @@ +# +# Copyright 2005 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# ident "%Z%%M% %I% %E% SMI" +# +include ../../Makefile.grub +include ../Makefile.solaris.defs + +.SUFFIXES: +.SUFFIXES: .exec $(SUFFIXES) + +.exec: + $(OBJCOPY) -O binary $< $@ + + +INCLUDES = -I. -I.. -I../stage1 -I../netboot +LIBS = + +FSYS_CFLAGS = -DFSYS_EXT2FS=1 -DFSYS_FAT=1 -DFSYS_FFS=1 -DFSYS_UFS=1 \ + -DFSYS_ZFS=1 \ + -DFSYS_UFS2=1 -DFSYS_REISERFS=1 -DFSYS_ISO9660=1 \ + -DUSE_MD5_PASSWORDS=1 +$(STAGE2_NETBOOT)TFTP_CFLAGS = -DFSYS_TFTP=1 +$(OPTION_FS)FSYS_CFLAGS += -DFSYS_MINIX=1 -DFSYS_JFS=1 -DFSYS_XFS=1 \ + -DSYS_VSTAFS=1 + +GRAPHICS_CFLAGS = -DSUPPORT_GRAPHICS=1 +# HERCULES_CFLAGS = -DSUPPORT_HERCULES=1 +NETBOOT_CFLAGS = -DSUPPORT_NETBOOT=1 +SERIAL_CFLAGS = -DSUPPORT_SERIAL=1 +GRUB_CFLAGS = -O2 -I../lib -DGRUB_UTIL=1 \ + -DFSYS_EXT2FS=1 -DFSYS_FAT=1 -DFSYS_FFS=1 -DFSYS_ISO9660=1 \ + -DFSYS_ZFS=1 \ + -DFSYS_REISERFS=1 -DFSYS_UFS=1 -DFSYS_UFS2=1 \ + -DUSE_MD5_PASSWORDS=1 -DSUPPORT_SERIAL=1 +$(OPTION_FS)GRUB_CFLAGS += -DFSYS_MINIX=1 -DFSYS_JFS=1 -DFSYS_XFS=1 \ + -DSYS_VSTAFS=1 +# GRUB_CFLAGS += -DSUPPORT_HERCULES=1 +STAGE1_5_CFLAGS = $(STAGE2_CFLAGS) -DNO_DECOMPRESSION=1 -DSTAGE1_5=1 +STAGE2_CFLAGS = -Os -fno-builtin -nostdinc \ + $(SERIAL_CFLAGS) $(GRAPHICS_CFLAGS) +$(STAGE2_NETBOOT)STAGE2_CFLAGS += $(NETBOOT_CFLAGS) +#STAGE2_CFLAGS += $(HERCULES_CFLAGS) + +NBLOADER_LINK = -nostdlib -N -Ttext 0 +PRE_STAGE2_LINK = -nostdlib -N -Ttext 8200 +PXELOADER_LINK = -nostdlib -N -Ttext 7C00 +STAGE1_5_LINK = -nostdlib -N -Ttext 2000 +START_ELTORITO_LINK = -nostdlib -N -Ttext 7C00 +START_LINK = -nostdlib -N -Ttext 8000 + +LIBDRIVERS = ../netboot/libdrivers.a + + +BUILT_SOURCES = stage2_size.h +BUILT_SOURCES += diskless_size.h + + +LIBRARIES = $(LIBGRUB) + +LIBGRUB = libgrub.a +LIBGRUB_OBJS = libgrub_a-boot.o \ + libgrub_a-builtins.o \ + libgrub_a-char_io.o \ + libgrub_a-cmdline.o \ + libgrub_a-common.o \ + libgrub_a-disk_io.o \ + libgrub_a-fsys_ext2fs.o \ + libgrub_a-fsys_fat.o \ + libgrub_a-fsys_ffs.o \ + libgrub_a-fsys_iso9660.o \ + libgrub_a-fsys_jfs.o \ + libgrub_a-fsys_minix.o \ + libgrub_a-fsys_reiserfs.o \ + libgrub_a-zfs_sha256.o \ + libgrub_a-zfs_lzjb.o \ + libgrub_a-zfs_fletcher.o \ + libgrub_a-fsys_zfs.o \ + libgrub_a-fsys_ufs.o \ + libgrub_a-fsys_ufs2.o \ + libgrub_a-fsys_vstafs.o \ + libgrub_a-fsys_xfs.o \ + libgrub_a-graphics.o \ + libgrub_a-gunzip.o \ + libgrub_a-md5.o \ + libgrub_a-serial.o \ + libgrub_a-stage2.o \ + libgrub_a-terminfo.o \ + libgrub_a-tparm.o +$(LIBGRUB_OBJS) := CFLAGS = $(BASE_CFLAGS) $(GRUB_CFLAGS) + + +# Will be installed in $(ROOT_BOOT_GRUB). +INSTALL_DATA = $(E2FS_STAGE1_5_DATA) \ + $(FAT_STAGE1_5_DATA) \ + $(FFS_STAGE1_5_DATA) \ + $(ISO9660_STAGE1_5_DATA) \ + $(JFS_STAGE1_5_DATA) \ + $(MINIX_STAGE1_5_DATA) \ + $(NBGRUB_DATA) \ + $(PXEGRUB_DATA) \ + $(REISERFS_STAGE1_5_DATA) \ + $(STAGE2_DATA) \ + $(STAGE2_ELTORITO_DATA) \ + $(UFS2_STAGE1_5_DATA) \ + $(UFS_STAGE1_5_DATA) \ + $(ZFS_STAGE1_5_DATA) \ + $(VSTAFS_STAGE1_5_DATA) \ + $(XFS_STAGE1_5_DATA) + +# Won't be installed. +NOINSTALL_DATA = $(DISKLESS_DATA) \ + $(NBLOADER_DATA) \ + $(PRE_STAGE2_DATA) \ + $(PXELOADER_DATA) \ + $(START_DATA) \ + $(START_ELTORITO_DATA) + +DATA = $(INSTALL_DATA) $(NOINSTALL_DATA) + + +PROGRAMS = $(DISKLESS_EXEC) \ + $(E2FS_STAGE1_5_EXEC) \ + $(FAT_STAGE1_5_EXEC) \ + $(FFS_STAGE1_5_EXEC) \ + $(ISO9660_STAGE1_5_EXEC) \ + $(JFS_STAGE1_5_EXEC) \ + $(MINIX_STAGE1_5_EXEC) \ + $(NBLOADER_EXEC) \ + $(PRE_STAGE2_EXEC) \ + $(PXELOADER_EXEC) \ + $(REISERFS_STAGE1_5_EXEC) \ + $(START_EXEC) \ + $(START_ELTORITO_EXEC) \ + $(UFS2_STAGE1_5_EXEC) \ + $(UFS_STAGE1_5_EXEC) \ + $(ZFS_STAGE1_5_EXEC) \ + $(VSTAFS_STAGE1_5_EXEC) \ + $(XFS_STAGE1_5_EXEC) + + +# +# diskless +# +DISKLESS_DATA = diskless +DISKLESS_EXEC = diskless.exec +DISKLESS_ASMOBJS = diskless_exec-asm.o + +DISKLESS_OBJS = diskless_exec-bios.o \ + diskless_exec-boot.o \ + diskless_exec-builtins.o \ + diskless_exec-char_io.o \ + diskless_exec-cmdline.o \ + diskless_exec-common.o \ + diskless_exec-console.o \ + diskless_exec-disk_io.o \ + diskless_exec-fsys_ext2fs.o \ + diskless_exec-fsys_fat.o \ + diskless_exec-fsys_ffs.o \ + diskless_exec-fsys_iso9660.o \ + diskless_exec-fsys_jfs.o \ + diskless_exec-fsys_minix.o \ + diskless_exec-fsys_reiserfs.o \ + diskless_exec-zfs_sha256.o \ + diskless_exec-zfs_lzjb.o \ + diskless_exec-zfs_fletcher.o \ + diskless_exec-fsys_zfs.o \ + diskless_exec-fsys_ufs.o \ + diskless_exec-fsys_ufs2.o \ + diskless_exec-fsys_vstafs.o \ + diskless_exec-fsys_xfs.o \ + diskless_exec-graphics.o \ + diskless_exec-gunzip.o \ + diskless_exec-hercules.o \ + diskless_exec-md5.o \ + diskless_exec-serial.o \ + diskless_exec-smp-imps.o \ + diskless_exec-stage2.o \ + diskless_exec-terminfo.o \ + diskless_exec-tparm.o + +$(DISKLESS_EXEC) := LDFLAGS = $(BASE_LDFLAGS) $(PRE_STAGE2_LINK) +$(DISKLESS_EXEC) := LIBS = $(LIBDRIVERS) + +$(DISKLESS_ASMOBJS) := CCASFLAGS = $(BASE_CCASFLAGS) $(STAGE2_CFLAGS) \ + $(FSYS_CFLAGS) -DFSYS_TFTP=1 \ + -DSUPPORT_DISKLESS=1 + +$(DISKLESS_OBJS) := CFLAGS = $(BASE_CFLAGS) $(STAGE2_CFLAGS) \ + $(FSYS_CFLAGS) -DFSYS_TFTP=1 \ + -DSUPPORT_DISKLESS=1 + +# +# ext2fs stage 1.5 +# +E2FS_STAGE1_5_DATA = e2fs_stage1_5 +E2FS_STAGE1_5_EXEC = e2fs_stage1_5.exec + +E2FS_STAGE1_5_ASMOBJS = e2fs_stage1_5_exec-asm.o \ + e2fs_stage1_5_exec-start.o + +E2FS_STAGE1_5_OBJS = e2fs_stage1_5_exec-bios.o \ + e2fs_stage1_5_exec-char_io.o \ + e2fs_stage1_5_exec-common.o \ + e2fs_stage1_5_exec-disk_io.o \ + e2fs_stage1_5_exec-fsys_ext2fs.o \ + e2fs_stage1_5_exec-stage1_5.o + +$(E2FS_STAGE1_5_EXEC) := LDFLAGS = $(BASE_LDFLAGS) $(STAGE1_5_LINK) + +$(E2FS_STAGE1_5_ASMOBJS) := CCASFLAGS = $(BASE_CCASFLAGS) $(STAGE1_5_CFLAGS) \ + -DFSYS_EXT2FS=1 -DNO_BLOCK_FILES=1 + +$(E2FS_STAGE1_5_OBJS) := CFLAGS = $(BASE_CFLAGS) $(STAGE1_5_CFLAGS) \ + -DFSYS_EXT2FS=1 -DNO_BLOCK_FILES=1 + +# +# FAT stage 1.5 +# +FAT_STAGE1_5_DATA = fat_stage1_5 +FAT_STAGE1_5_EXEC = fat_stage1_5.exec + +FAT_STAGE1_5_ASMOBJS = fat_stage1_5_exec-asm.o \ + fat_stage1_5_exec-start.o + +FAT_STAGE1_5_OBJS = fat_stage1_5_exec-bios.o \ + fat_stage1_5_exec-char_io.o \ + fat_stage1_5_exec-common.o \ + fat_stage1_5_exec-disk_io.o \ + fat_stage1_5_exec-fsys_fat.o \ + fat_stage1_5_exec-stage1_5.o + +$(FAT_STAGE1_5_EXEC) := LDFLAGS = $(BASE_LDFLAGS) $(STAGE1_5_LINK) + +$(FAT_STAGE1_5_ASMOBJS) := CCASFLAGS = $(BASE_CCASFLAGS) $(STAGE1_5_CFLAGS) \ + -DFSYS_FAT=1 -DNO_BLOCK_FILES=1 + +$(FAT_STAGE1_5_OBJS) := CFLAGS = $(BASE_CFLAGS) $(STAGE1_5_CFLAGS) \ + -DFSYS_FAT=1 -DNO_BLOCK_FILES=1 + +# +# FFS stage 1.5 +# +FFS_STAGE1_5_DATA = ffs_stage1_5 +FFS_STAGE1_5_EXEC = ffs_stage1_5.exec + +FFS_STAGE1_5_ASMOBJS = ffs_stage1_5_exec-asm.o \ + ffs_stage1_5_exec-start.o + +FFS_STAGE1_5_OBJS = ffs_stage1_5_exec-bios.o \ + ffs_stage1_5_exec-char_io.o \ + ffs_stage1_5_exec-common.o \ + ffs_stage1_5_exec-disk_io.o \ + ffs_stage1_5_exec-fsys_ffs.o \ + ffs_stage1_5_exec-stage1_5.o + +$(FFS_STAGE1_5_EXEC) := LDFLAGS = $(BASE_LDFLAGS) $(STAGE1_5_LINK) + +$(FFS_STAGE1_5_ASMOBJS) := CCASFLAGS = $(BASE_CCASFLAGS) $(STAGE1_5_CFLAGS) \ + -DFSYS_FFS=1 -DNO_BLOCK_FILES=1 + +$(FFS_STAGE1_5_OBJS) := CFLAGS = $(BASE_CFLAGS) $(STAGE1_5_CFLAGS) \ + -DFSYS_FFS=1 -DNO_BLOCK_FILES=1 + +# +# ISO9660 stage 1.5 +# +ISO9660_STAGE1_5_DATA = iso9660_stage1_5 +ISO9660_STAGE1_5_EXEC = iso9660_stage1_5.exec + +ISO9660_STAGE1_5_ASMOBJS = iso9660_stage1_5_exec-asm.o \ + iso9660_stage1_5_exec-start_eltorito.o + +ISO9660_STAGE1_5_OBJS = iso9660_stage1_5_exec-bios.o \ + iso9660_stage1_5_exec-char_io.o \ + iso9660_stage1_5_exec-common.o \ + iso9660_stage1_5_exec-disk_io.o \ + iso9660_stage1_5_exec-fsys_iso9660.o \ + iso9660_stage1_5_exec-stage1_5.o + +$(ISO9660_STAGE1_5_EXEC) := LDFLAGS = $(BASE_LDFLAGS) $(STAGE1_5_LINK) + +$(ISO9660_STAGE1_5_ASMOBJS) := CCASFLAGS = $(BASE_CCASFLAGS) \ + $(STAGE1_5_CFLAGS) \ + -DFSYS_ISO9660=1 -DNO_BLOCK_FILES=1 + +$(ISO9660_STAGE1_5_OBJS) := CFLAGS = $(BASE_CFLAGS) $(STAGE1_5_CFLAGS) \ + -DFSYS_ISO9660=1 -DNO_BLOCK_FILES=1 + +# +# IBM JFS stage 1.5 +# +JFS_STAGE1_5_DATA = jfs_stage1_5 +JFS_STAGE1_5_EXEC = jfs_stage1_5.exec + +JFS_STAGE1_5_ASMOBJS = jfs_stage1_5_exec-asm.o \ + jfs_stage1_5_exec-start.o + +JFS_STAGE1_5_OBJS = jfs_stage1_5_exec-bios.o \ + jfs_stage1_5_exec-char_io.o \ + jfs_stage1_5_exec-common.o \ + jfs_stage1_5_exec-disk_io.o \ + jfs_stage1_5_exec-fsys_jfs.o \ + jfs_stage1_5_exec-stage1_5.o + +$(JFS_STAGE1_5_EXEC) := LDFLAGS = $(BASE_LDFLAGS) $(STAGE1_5_LINK) + +$(JFS_STAGE1_5_ASMOBJS) := CCASFLAGS = $(BASE_CCASFLAGS) $(STAGE1_5_CFLAGS) \ + -DFSYS_JFS=1 -DNO_BLOCK_FILES=1 + +$(JFS_STAGE1_5_OBJS) := CFLAGS = $(BASE_CFLAGS) $(STAGE1_5_CFLAGS) \ + -DFSYS_JFS=1 -DNO_BLOCK_FILES=1 + +# +# Minix fs stage 1.5 +# +MINIX_STAGE1_5_DATA = minix_stage1_5 +MINIX_STAGE1_5_EXEC = minix_stage1_5.exec + +MINIX_STAGE1_5_ASMOBJS = minix_stage1_5_exec-asm.o \ + minix_stage1_5_exec-start.o + +MINIX_STAGE1_5_OBJS = minix_stage1_5_exec-bios.o \ + minix_stage1_5_exec-char_io.o \ + minix_stage1_5_exec-common.o \ + minix_stage1_5_exec-disk_io.o \ + minix_stage1_5_exec-fsys_minix.o \ + minix_stage1_5_exec-stage1_5.o + +$(MINIX_STAGE1_5_EXEC) := LDFLAGS = $(BASE_LDFLAGS) $(STAGE1_5_LINK) + +$(MINIX_STAGE1_5_ASMOBJS) := CCASFLAGS = $(BASE_CCASFLAGS) $(STAGE1_5_CFLAGS) \ + -DFSYS_MINIX=1 -DNO_BLOCK_FILES=1 + +$(MINIX_STAGE1_5_OBJS) := CFLAGS = $(BASE_CFLAGS) $(STAGE1_5_CFLAGS) \ + -DFSYS_MINIX=1 -DNO_BLOCK_FILES=1 + +# +# nbgrub +# +NBGRUB_DATA = nbgrub + +# +# nbloader +# +NBLOADER_DATA = nbloader +NBLOADER_EXEC = nbloader.exec +NBLOADER_ASMOBJS = nbloader_exec-nbloader.o +NBLOADER_OBJS = +$(NBLOADER_EXEC) := LDFLAGS = $(BASE_LDFLAGS) $(NBLOADER_LINK) +$(NBLOADER_ASMOBJS) := CCASFLAGS = $(BASE_CCASFLAGS) $(STAGE2_CFLAGS) + +# +# Pre-stage2 +# +PRE_STAGE2_DATA = pre_stage2 +PRE_STAGE2_EXEC = pre_stage2.exec +PRE_STAGE2_ASMOBJS = pre_stage2_exec-asm.o + +PRE_STAGE2_OBJS = pre_stage2_exec-bios.o \ + pre_stage2_exec-boot.o \ + pre_stage2_exec-builtins.o \ + pre_stage2_exec-char_io.o \ + pre_stage2_exec-cmdline.o \ + pre_stage2_exec-common.o \ + pre_stage2_exec-console.o \ + pre_stage2_exec-disk_io.o \ + pre_stage2_exec-fsys_ext2fs.o \ + pre_stage2_exec-fsys_fat.o \ + pre_stage2_exec-fsys_ffs.o \ + pre_stage2_exec-fsys_iso9660.o \ + pre_stage2_exec-fsys_jfs.o \ + pre_stage2_exec-fsys_minix.o \ + pre_stage2_exec-fsys_reiserfs.o \ + pre_stage2_exec-zfs_sha256.o \ + pre_stage2_exec-zfs_lzjb.o \ + pre_stage2_exec-zfs_fletcher.o \ + pre_stage2_exec-fsys_zfs.o \ + pre_stage2_exec-fsys_ufs.o \ + pre_stage2_exec-fsys_ufs2.o \ + pre_stage2_exec-fsys_vstafs.o \ + pre_stage2_exec-fsys_xfs.o \ + pre_stage2_exec-graphics.o \ + pre_stage2_exec-gunzip.o \ + pre_stage2_exec-hercules.o \ + pre_stage2_exec-md5.o \ + pre_stage2_exec-serial.o \ + pre_stage2_exec-smp-imps.o \ + pre_stage2_exec-stage2.o \ + pre_stage2_exec-terminfo.o \ + pre_stage2_exec-tparm.o + +$(PRE_STAGE2_EXEC) := LDFLAGS = $(BASE_LDFLAGS) $(PRE_STAGE2_LINK) +$(STAGE2_NETBOOT)$(PRE_STAGE2_EXEC) := LIBS = $(LIBDRIVERS) + +$(PRE_STAGE2_ASMOBJS) := CCASFLAGS = $(BASE_CCASFLAGS) $(STAGE2_CFLAGS) \ + $(FSYS_CFLAGS) $(TFTP_CFLAGS) + +$(PRE_STAGE2_OBJS) := CFLAGS = $(BASE_CFLAGS) $(STAGE2_CFLAGS) \ + $(FSYS_CFLAGS) $(TFTP_CFLAGS) + +# +# pxegrub +# +PXEGRUB_DATA = pxegrub + +# +# pxeloader +# +PXELOADER_DATA = pxeloader +PXELOADER_EXEC = pxeloader.exec +PXELOADER_ASMOBJS = pxeloader_exec-pxeloader.o +PXELOADER_OBJS = +$(PXELOADER_EXEC) := LDFLAGS = $(BASE_LDFLAGS) $(PXELOADER_LINK) +$(PXELOADER_ASMOBJS) := CCASFLAGS = $(BASE_CCASFLAGS) $(STAGE2_CFLAGS) + +# +# ReiserFS stage 1.5 +# +REISERFS_STAGE1_5_DATA = reiserfs_stage1_5 +REISERFS_STAGE1_5_EXEC = reiserfs_stage1_5.exec + +REISERFS_STAGE1_5_ASMOBJS = reiserfs_stage1_5_exec-asm.o \ + reiserfs_stage1_5_exec-start.o + +REISERFS_STAGE1_5_OBJS = reiserfs_stage1_5_exec-bios.o \ + reiserfs_stage1_5_exec-char_io.o \ + reiserfs_stage1_5_exec-common.o \ + reiserfs_stage1_5_exec-disk_io.o \ + reiserfs_stage1_5_exec-fsys_reiserfs.o \ + reiserfs_stage1_5_exec-stage1_5.o + +$(REISERFS_STAGE1_5_EXEC) := LDFLAGS = $(BASE_LDFLAGS) $(STAGE1_5_LINK) + +$(REISERFS_STAGE1_5_ASMOBJS) := CCASFLAGS = $(BASE_CCASFLAGS) \ + $(STAGE1_5_CFLAGS) \ + -DFSYS_REISERFS=1 -DNO_BLOCK_FILES=1 + +$(REISERFS_STAGE1_5_OBJS) := CFLAGS = $(BASE_CFLAGS) $(STAGE1_5_CFLAGS) \ + -DFSYS_REISERFS=1 -DNO_BLOCK_FILES=1 + +# +# stage2 +# +STAGE2_DATA = stage2 + +# +# Eltorito stage2 +# +STAGE2_ELTORITO_DATA = stage2_eltorito + +# +# start +# +START_DATA = start +START_EXEC = start.exec +START_ASMOBJS = start_exec-start.o +START_OBJS = +$(START_EXEC) := LDFLAGS = $(BASE_LDFLAGS) $(START_LINK) +$(START_ASMOBJS) := CCASFLAGS = $(BASE_CCASFLAGS) $(STAGE2_CFLAGS) + +# +# Eltorito start +# +START_ELTORITO_DATA = start_eltorito +START_ELTORITO_EXEC = start_eltorito.exec +START_ELTORITO_ASMOBJS = start_eltorito_exec-start_eltorito.o +START_ELTORITO_OBJS = +$(START_ELTORITO_EXEC) := LDFLAGS = $(BASE_LDFLAGS) $(START_ELTORITO_LINK) +$(START_ELTORITO_ASMOBJS) := CCASFLAGS = $(BASE_CCASFLAGS) $(STAGE2_CFLAGS) + +# +# UFS2 stage 1.5 +# +UFS2_STAGE1_5_DATA = ufs2_stage1_5 +UFS2_STAGE1_5_EXEC = ufs2_stage1_5.exec + +UFS2_STAGE1_5_ASMOBJS = ufs2_stage1_5_exec-asm.o \ + ufs2_stage1_5_exec-start.o + +UFS2_STAGE1_5_OBJS = ufs2_stage1_5_exec-bios.o \ + ufs2_stage1_5_exec-char_io.o \ + ufs2_stage1_5_exec-common.o \ + ufs2_stage1_5_exec-disk_io.o \ + ufs2_stage1_5_exec-fsys_ufs2.o \ + ufs2_stage1_5_exec-stage1_5.o + +$(UFS2_STAGE1_5_EXEC) := LDFLAGS = $(BASE_LDFLAGS) $(STAGE1_5_LINK) + +$(UFS2_STAGE1_5_ASMOBJS) := CCASFLAGS = $(BASE_CCASFLAGS) $(STAGE1_5_CFLAGS) \ + -DFSYS_UFS2=1 -DNO_BLOCK_FILES=1 + +$(UFS2_STAGE1_5_OBJS) := CFLAGS = $(BASE_CFLAGS) $(STAGE1_5_CFLAGS) \ + -DFSYS_UFS2=1 -DNO_BLOCK_FILES=1 + +# +# UFS stage 1.5 +# +UFS_STAGE1_5_DATA = ufs_stage1_5 +UFS_STAGE1_5_EXEC = ufs_stage1_5.exec + +UFS_STAGE1_5_ASMOBJS = ufs_stage1_5_exec-asm.o \ + ufs_stage1_5_exec-start.o + +UFS_STAGE1_5_OBJS = ufs_stage1_5_exec-bios.o \ + ufs_stage1_5_exec-char_io.o \ + ufs_stage1_5_exec-common.o \ + ufs_stage1_5_exec-disk_io.o \ + ufs_stage1_5_exec-fsys_ufs.o \ + ufs_stage1_5_exec-stage1_5.o + +$(UFS_STAGE1_5_EXEC) := LDFLAGS = $(BASE_LDFLAGS) $(STAGE1_5_LINK) + +$(UFS_STAGE1_5_ASMOBJS) := CCASFLAGS = $(BASE_CCASFLAGS) $(STAGE1_5_CFLAGS) \ + -DFSYS_UFS=1 -DNO_BLOCK_FILES=1 + +$(UFS_STAGE1_5_OBJS) := CFLAGS = $(BASE_CFLAGS) $(STAGE1_5_CFLAGS) \ + -DFSYS_UFS=1 -DNO_BLOCK_FILES=1 + +# +# ZFS stage 1.5 +# +ZFS_STAGE1_5_DATA = zfs_stage1_5 +ZFS_STAGE1_5_EXEC = zfs_stage1_5.exec + +ZFS_STAGE1_5_ASMOBJS = zfs_stage1_5_exec-asm.o \ + zfs_stage1_5_exec-start.o + +ZFS_STAGE1_5_OBJS = zfs_stage1_5_exec-bios.o \ + zfs_stage1_5_exec-char_io.o \ + zfs_stage1_5_exec-common.o \ + zfs_stage1_5_exec-disk_io.o \ + zfs_stage1_5_exec-zfs_sha256.o \ + zfs_stage1_5_exec-zfs_lzjb.o \ + zfs_stage1_5_exec-zfs_fletcher.o \ + zfs_stage1_5_exec-fsys_zfs.o \ + zfs_stage1_5_exec-stage1_5.o + +$(ZFS_STAGE1_5_EXEC) := LDFLAGS = $(BASE_LDFLAGS) $(STAGE1_5_LINK) + +$(ZFS_STAGE1_5_ASMOBJS) := CCASFLAGS = $(BASE_CCASFLAGS) $(STAGE1_5_CFLAGS) \ + -DFSYS_ZFS=1 -DNO_BLOCK_FILES=1 + +$(ZFS_STAGE1_5_OBJS) := CFLAGS = $(BASE_CFLAGS) $(STAGE1_5_CFLAGS) \ + -DFSYS_ZFS=1 -DNO_BLOCK_FILES=1 + +# +# VSTa FS +# +VSTAFS_STAGE1_5_DATA = vstafs_stage1_5 +VSTAFS_STAGE1_5_EXEC = vstafs_stage1_5.exec + +VSTAFS_STAGE1_5_ASMOBJS = vstafs_stage1_5_exec-asm.o \ + vstafs_stage1_5_exec-start.o + +VSTAFS_STAGE1_5_OBJS = vstafs_stage1_5_exec-bios.o \ + vstafs_stage1_5_exec-char_io.o \ + vstafs_stage1_5_exec-common.o \ + vstafs_stage1_5_exec-disk_io.o \ + vstafs_stage1_5_exec-fsys_vstafs.o \ + vstafs_stage1_5_exec-stage1_5.o + +$(VSTAFS_STAGE1_5_EXEC) := LDFLAGS = $(BASE_LDFLAGS) $(STAGE1_5_LINK) + +$(VSTAFS_STAGE1_5_ASMOBJS) := CCASFLAGS = $(BASE_CCASFLAGS) $(STAGE1_5_CFLAGS) \ + -DFSYS_VSTAFS=1 -DNO_BLOCK_FILES=1 + +$(VSTAFS_STAGE1_5_OBJS) := CFLAGS = $(BASE_CFLAGS) $(STAGE1_5_CFLAGS) \ + -DFSYS_VSTAFS=1 -DNO_BLOCK_FILES=1 + +# +# SGI XFS stage 1.5 +# +XFS_STAGE1_5_DATA = xfs_stage1_5 +XFS_STAGE1_5_EXEC = xfs_stage1_5.exec + +XFS_STAGE1_5_ASMOBJS = xfs_stage1_5_exec-asm.o \ + xfs_stage1_5_exec-start.o + +XFS_STAGE1_5_OBJS = xfs_stage1_5_exec-bios.o \ + xfs_stage1_5_exec-char_io.o \ + xfs_stage1_5_exec-common.o \ + xfs_stage1_5_exec-disk_io.o \ + xfs_stage1_5_exec-fsys_xfs.o \ + xfs_stage1_5_exec-stage1_5.o + +$(XFS_STAGE1_5_EXEC) := LDFLAGS = $(BASE_LDFLAGS) $(STAGE1_5_LINK) + +$(XFS_STAGE1_5_ASMOBJS) := CCASFLAGS = $(BASE_CCASFLAGS) $(STAGE1_5_CFLAGS) \ + -DFSYS_XFS=1 -DNO_BLOCK_FILES=1 + +$(XFS_STAGE1_5_OBJS) := CFLAGS = $(BASE_CFLAGS) $(STAGE1_5_CFLAGS) \ + -DFSYS_XFS=1 -DNO_BLOCK_FILES=1 + + +INSTALL_TARGETS = $(INSTALL_DATA:%=$(ROOT_BOOT_GRUB)/%) \ + $(SRC_ZFSINC_DIR) + +# +# Source files to be installed in $(ROOT_SRC). +# +SRC_DIR = $(ROOT_SRC)/stage2 +SRC_ZFSINC_DIR = $(SRC_DIR)/zfs-include +SRC_FILES = Makefile.am Makefile.in apic.h apm.S asm.S bios.c boot.c \ + builtins.c char_io.c cmdline.c common.c console.c defs.h \ + dir.h disk_inode.h disk_inode_ffs.h disk_io.c fat.h \ + filesys.h freebsd.h fs.h fsys_ext2fs.c fsys_fat.c \ + fsys_ffs.c fsys_iso9660.c fsys_jfs.c fsys_minix.c \ + zfs_sha256.c zfs_lzjb.c zfs_fletcher.c fsys_zfs.c \ + fsys_reiserfs.c fsys_ufs.c fsys_ufs2.c fsys_vstafs.c \ + fsys_xfs.c graphics.c graphics.h gunzip.c hercules.c \ + hercules.h i386-elf.h imgact_aout.h iso9660.h jfs.h \ + logo.xbm mb_header.h mb_info.h md5.c md5.h nbi.h nbloader.S \ + pc_slice.h pxeloader.S serial.c serial.h setjmp.S shared.h \ + size_test smp-imps.c smp-imps.h stage1_5.c stage2.c \ + start.S start_eltorito.S term.h terminfo.c terminfo.h \ + tparm.c tparm.h fsys_zfs.h ufs.h ufs2.h vstafs.h xfs.h +SRC_ZFSINC_FILES = dmu.h dmu_objset.h dnode.h dsl_dataset.h dsl_dir.h spa.h \ + uberblock_impl.h vdev_impl.h zap_impl.h zap_leaf.h zfs.h \ + zfs_acl.h zfs_znode.h zil.h zio.h zio_checksum.h + +INSTALL_TARGETS += $(SRC_FILES:%=$(SRC_DIR)/%) \ + $(SRC_ZFSINC_FILES:%=$(SRC_ZFSINC_DIR)/%) + + +############################################################################### +all: $(BUILT_SOURCES) .WAIT $(LIBRARIES) $(PROGRAMS) $(DATA) + +# +# BUILT_SOURCES +# +stage2_size.h: $(PRE_STAGE2_DATA) + $(RM) $@ + set dummy `ls -l $(PRE_STAGE2_DATA)`; \ + echo "#define STAGE2_SIZE $$6" > $@ + +diskless_size.h: $(DISKLESS_DATA) + $(RM) $@ + set dummy `ls -l $(DISKLESS_DATA)`; \ + echo "#define DISKLESS_SIZE $$6" > $@ + +# +# LIBRARIES +# +$(LIBGRUB): $(LIBGRUB_OBJS) + $(RM) $@ + $(AR) cru $@ $(LIBGRUB_OBJS) + $(RANLIB) $@ + +$(LIBGRUB_OBJS): $$(@:libgrub_a-%.o=%.c) + $(CC) $(CFLAGS) -c -o $@ $(@:libgrub_a-%.o=%.c) + + +# +# Diskless +# +$(DISKLESS_EXEC): $(DISKLESS_ASMOBJS) $(DISKLESS_OBJS) + $(RM) $@ + $(LINK) -o $@ $(DISKLESS_ASMOBJS) $(DISKLESS_OBJS) $(LIBS) + +$(DISKLESS_ASMOBJS): $$(@:diskless_exec-%.o=%.S) + $(CCAS) $(CCASFLAGS) -c -o $@ $(@:diskless_exec-%.o=%.S) + +$(DISKLESS_OBJS): $$(@:diskless_exec-%.o=%.c) + $(CC) $(CFLAGS) -c -o $@ $(@:diskless_exec-%.o=%.c) + +# +# ext2fs stage 1.5 +# +$(E2FS_STAGE1_5_EXEC): $(E2FS_STAGE1_5_ASMOBJS) $(E2FS_STAGE1_5_OBJS) + $(RM) $@ + $(LINK) -o $@ $(E2FS_STAGE1_5_ASMOBJS) $(E2FS_STAGE1_5_OBJS) $(LIBS) + +$(E2FS_STAGE1_5_ASMOBJS): $$(@:e2fs_stage1_5_exec-%.o=%.S) + $(CCAS) $(CCASFLAGS) -c -o $@ $(@:e2fs_stage1_5_exec-%.o=%.S) + +$(E2FS_STAGE1_5_OBJS): $$(@:e2fs_stage1_5_exec-%.o=%.c) + $(CC) $(CFLAGS) -c -o $@ $(@:e2fs_stage1_5_exec-%.o=%.c) + +# +# FAT stage 1.5 +# +$(FAT_STAGE1_5_EXEC): $(FAT_STAGE1_5_ASMOBJS) $(FAT_STAGE1_5_OBJS) + $(RM) $@ + $(LINK) -o $@ $(FAT_STAGE1_5_ASMOBJS) $(FAT_STAGE1_5_OBJS) $(LIBS) + +$(FAT_STAGE1_5_ASMOBJS): $$(@:fat_stage1_5_exec-%.o=%.S) + $(CCAS) $(CCASFLAGS) -c -o $@ $(@:fat_stage1_5_exec-%.o=%.S) + +$(FAT_STAGE1_5_OBJS): $$(@:fat_stage1_5_exec-%.o=%.c) + $(CC) $(CFLAGS) -c -o $@ $(@:fat_stage1_5_exec-%.o=%.c) + +# +# FFS stage 1.5 +# +$(FFS_STAGE1_5_EXEC): $(FFS_STAGE1_5_ASMOBJS) $(FFS_STAGE1_5_OBJS) + $(RM) $@ + $(LINK) -o $@ $(FFS_STAGE1_5_ASMOBJS) $(FFS_STAGE1_5_OBJS) $(LIBS) + +$(FFS_STAGE1_5_ASMOBJS): $$(@:ffs_stage1_5_exec-%.o=%.S) + $(CCAS) $(CCASFLAGS) -c -o $@ $(@:ffs_stage1_5_exec-%.o=%.S) + +$(FFS_STAGE1_5_OBJS): $$(@:ffs_stage1_5_exec-%.o=%.c) + $(CC) $(CFLAGS) -c -o $@ $(@:ffs_stage1_5_exec-%.o=%.c) + +# +# ISO9660 stage 1.5 +# +$(ISO9660_STAGE1_5_EXEC): $(ISO9660_STAGE1_5_ASMOBJS) $(ISO9660_STAGE1_5_OBJS) + $(RM) $@ + $(LINK) -o $@ $(ISO9660_STAGE1_5_ASMOBJS) $(ISO9660_STAGE1_5_OBJS) \ + $(LIBS) + +$(ISO9660_STAGE1_5_ASMOBJS): $$(@:iso9660_stage1_5_exec-%.o=%.S) + $(CCAS) $(CCASFLAGS) -c -o $@ $(@:iso9660_stage1_5_exec-%.o=%.S) + +$(ISO9660_STAGE1_5_OBJS): $$(@:iso9660_stage1_5_exec-%.o=%.c) + $(CC) $(CFLAGS) -c -o $@ $(@:iso9660_stage1_5_exec-%.o=%.c) + +# +# JFS stage 1.5 +# +$(JFS_STAGE1_5_EXEC): $(JFS_STAGE1_5_ASMOBJS) $(JFS_STAGE1_5_OBJS) + $(RM) $@ + $(LINK) -o $@ $(JFS_STAGE1_5_ASMOBJS) $(JFS_STAGE1_5_OBJS) $(LIBS) + +$(JFS_STAGE1_5_ASMOBJS): $$(@:jfs_stage1_5_exec-%.o=%.S) + $(CCAS) $(CCASFLAGS) -c -o $@ $(@:jfs_stage1_5_exec-%.o=%.S) + +$(JFS_STAGE1_5_OBJS): $$(@:jfs_stage1_5_exec-%.o=%.c) + $(CC) $(CFLAGS) -c -o $@ $(@:jfs_stage1_5_exec-%.o=%.c) + +# +# Minix stage 1.5 +# +$(MINIX_STAGE1_5_EXEC): $(MINIX_STAGE1_5_ASMOBJS) $(MINIX_STAGE1_5_OBJS) + $(RM) $@ + $(LINK) -o $@ $(MINIX_STAGE1_5_ASMOBJS) $(MINIX_STAGE1_5_OBJS) $(LIBS) + +$(MINIX_STAGE1_5_ASMOBJS): $$(@:minix_stage1_5_exec-%.o=%.S) + $(CCAS) $(CCASFLAGS) -c -o $@ $(@:minix_stage1_5_exec-%.o=%.S) + +$(MINIX_STAGE1_5_OBJS): $$(@:minix_stage1_5_exec-%.o=%.c) + $(CC) $(CFLAGS) -c -o $@ $(@:minix_stage1_5_exec-%.o=%.c) + +# +# nbgrub +# +$(NBGRUB_DATA): $(NBLOADER_DATA) $(DISKLESS_DATA) + $(RM) $@ + cat $(NBLOADER_DATA) $(DISKLESS_DATA) > $@ + +# +# nbloader +# +$(NBLOADER_EXEC): $(NBLOADER_ASMOBJS) $(NBLOADER_OBJS) + $(RM) $@ + $(LINK) -o $@ $(NBLOADER_ASMOBJS) $(NBLOADER_OBJS) $(LIBS) + +$(NBLOADER_ASMOBJS): $$(@:nbloader_exec-%.o=%.S) diskless_size.h + $(CCAS) $(CCASFLAGS) -c -o $@ $(@:nbloader_exec-%.o=%.S) + +$(NBLOADER_OBJS): $$(@:nbloader_exec-%.o=%.c) + $(CC) $(CFLAGS) -c -o $@ $(@:nbloader_exec-%.o=%.c) + +# +# Pre-stage2 +# +$(PRE_STAGE2_EXEC): $(PRE_STAGE2_ASMOBJS) $(PRE_STAGE2_OBJS) + $(RM) $@ + $(LINK) -o $@ $(PRE_STAGE2_ASMOBJS) $(PRE_STAGE2_OBJS) $(LIBS) + +$(PRE_STAGE2_ASMOBJS): $$(@:pre_stage2_exec-%.o=%.S) + $(CCAS) $(CCASFLAGS) -c -o $@ $(@:pre_stage2_exec-%.o=%.S) + +$(PRE_STAGE2_OBJS): $$(@:pre_stage2_exec-%.o=%.c) + $(CC) $(CFLAGS) -c -o $@ $(@:pre_stage2_exec-%.o=%.c) + +# +# pxegrub +# +$(PXEGRUB_DATA): $(PXELOADER_DATA) $(DISKLESS_DATA) + $(RM) $@ + cat $(PXELOADER_DATA) $(DISKLESS_DATA) > $@ + +# +# pxeloader +# +$(PXELOADER_EXEC): $(PXELOADER_ASMOBJS) $(PXELOADER_OBJS) + $(RM) $@ + $(LINK) -o $@ $(PXELOADER_ASMOBJS) $(PXELOADER_OBJS) $(LIBS) + +$(PXELOADER_ASMOBJS): $$(@:pxeloader_exec-%.o=%.S) diskless_size.h + $(CCAS) $(CCASFLAGS) -c -o $@ $(@:pxeloader_exec-%.o=%.S) + +$(PXELOADER_OBJS): $$(@:pxeloader_exec-%.o=%.c) + $(CC) $(CFLAGS) -c -o $@ $(@:pxeloader_exec-%.o=%.c) + +# +# ReiserFS stage 1.5 +# +$(REISERFS_STAGE1_5_EXEC): $(REISERFS_STAGE1_5_ASMOBJS) \ + $(REISERFS_STAGE1_5_OBJS) + $(RM) $@ + $(LINK) -o $@ $(REISERFS_STAGE1_5_ASMOBJS) $(REISERFS_STAGE1_5_OBJS) \ + $(LIBS) + +$(REISERFS_STAGE1_5_ASMOBJS): $$(@:reiserfs_stage1_5_exec-%.o=%.S) + $(CCAS) $(CCASFLAGS) -c -o $@ $(@:reiserfs_stage1_5_exec-%.o=%.S) + +$(REISERFS_STAGE1_5_OBJS): $$(@:reiserfs_stage1_5_exec-%.o=%.c) + $(CC) $(CFLAGS) -c -o $@ $(@:reiserfs_stage1_5_exec-%.o=%.c) + +# +# stage2 +# +$(STAGE2_DATA): $(START_DATA) $(PRE_STAGE2_DATA) + $(RM) $@ + cat $(START_DATA) $(PRE_STAGE2_DATA) > $@ +# +# Eltorito stage2 +# +$(STAGE2_ELTORITO_DATA): $(START_ELTORITO_DATA) $(PRE_STAGE2_DATA) + $(RM) $@ + cat $(START_ELTORITO_DATA) $(PRE_STAGE2_DATA) > $@ + +# +# start +# +$(START_EXEC): $(START_ASMOBJS) $(START_OBJS) + $(RM) $@ + $(LINK) -o $@ $(START_ASMOBJS) $(START_OBJS) $(LIBS) + +$(START_ASMOBJS): $$(@:start_exec-%.o=%.S) stage2_size.h + $(CCAS) $(CCASFLAGS) -c -o $@ $(@:start_exec-%.o=%.S) + +$(START_OBJS): $$(@:start_exec-%.o=%.c) + $(CC) $(CFLAGS) -c -o $@ $(@:start_exec-%.o=%.c) + +# +# Eltorito start +# +$(START_ELTORITO_EXEC): $(START_ELTORITO_ASMOBJS) $(START_ELTORITO_OBJS) + $(RM) $@ + $(LINK) -o $@ $(START_ELTORITO_ASMOBJS) $(START_ELTORITO_OBJS) $(LIBS) + +$(START_ELTORITO_ASMOBJS): $$(@:start_eltorito_exec-%.o=%.S) stage2_size.h + $(CCAS) $(CCASFLAGS) -c -o $@ $(@:start_eltorito_exec-%.o=%.S) + +$(START_ELTORITO_OBJS): $$(@:start_eltorito_exec-%.o=%.c) + $(CC) $(CFLAGS) -c -o $@ $(@:start_eltorito_exec-%.o=%.c) + +# +# UFS2 stage 1.5 +# +$(UFS2_STAGE1_5_EXEC): $(UFS2_STAGE1_5_ASMOBJS) $(UFS2_STAGE1_5_OBJS) + $(RM) $@ + $(LINK) -o $@ $(UFS2_STAGE1_5_ASMOBJS) $(UFS2_STAGE1_5_OBJS) $(LIBS) + +$(UFS2_STAGE1_5_ASMOBJS): $$(@:ufs2_stage1_5_exec-%.o=%.S) + $(CCAS) $(CCASFLAGS) -c -o $@ $(@:ufs2_stage1_5_exec-%.o=%.S) + +$(UFS2_STAGE1_5_OBJS): $$(@:ufs2_stage1_5_exec-%.o=%.c) + $(CC) $(CFLAGS) -c -o $@ $(@:ufs2_stage1_5_exec-%.o=%.c) + +# +# UFS stage 1.5 +# +$(UFS_STAGE1_5_EXEC): $(UFS_STAGE1_5_ASMOBJS) $(UFS_STAGE1_5_OBJS) + $(RM) $@ + $(LINK) -o $@ $(UFS_STAGE1_5_ASMOBJS) $(UFS_STAGE1_5_OBJS) $(LIBS) + +$(UFS_STAGE1_5_ASMOBJS): $$(@:ufs_stage1_5_exec-%.o=%.S) + $(CCAS) $(CCASFLAGS) -c -o $@ $(@:ufs_stage1_5_exec-%.o=%.S) + +$(UFS_STAGE1_5_OBJS): $$(@:ufs_stage1_5_exec-%.o=%.c) + $(CC) $(CFLAGS) -c -o $@ $(@:ufs_stage1_5_exec-%.o=%.c) + +# +# ZFS stage 1.5 +# +$(ZFS_STAGE1_5_EXEC): $(ZFS_STAGE1_5_ASMOBJS) $(ZFS_STAGE1_5_OBJS) + $(RM) $@ + $(LINK) -o $@ $(ZFS_STAGE1_5_ASMOBJS) $(ZFS_STAGE1_5_OBJS) $(LIBS) + +$(ZFS_STAGE1_5_ASMOBJS): $$(@:zfs_stage1_5_exec-%.o=%.S) + $(CCAS) $(CCASFLAGS) -c -o $@ $(@:zfs_stage1_5_exec-%.o=%.S) + +$(ZFS_STAGE1_5_OBJS): $$(@:zfs_stage1_5_exec-%.o=%.c) + $(CC) $(CFLAGS) -c -o $@ $(@:zfs_stage1_5_exec-%.o=%.c) + +# +# VSTa stage 1.5 +# +$(VSTAFS_STAGE1_5_EXEC): $(VSTAFS_STAGE1_5_ASMOBJS) $(VSTAFS_STAGE1_5_OBJS) + $(RM) $@ + $(LINK) -o $@ $(VSTAFS_STAGE1_5_ASMOBJS) $(VSTAFS_STAGE1_5_OBJS) $(LIBS) + +$(VSTAFS_STAGE1_5_ASMOBJS): $$(@:vstafs_stage1_5_exec-%.o=%.S) + $(CCAS) $(CCASFLAGS) -c -o $@ $(@:vstafs_stage1_5_exec-%.o=%.S) + +$(VSTAFS_STAGE1_5_OBJS): $$(@:vstafs_stage1_5_exec-%.o=%.c) + $(CC) $(CFLAGS) -c -o $@ $(@:vstafs_stage1_5_exec-%.o=%.c) + +# +# SGI XFS stage 1.5 +# +$(XFS_STAGE1_5_EXEC): $(XFS_STAGE1_5_ASMOBJS) $(XFS_STAGE1_5_OBJS) + $(RM) $@ + $(LINK) -o $@ $(XFS_STAGE1_5_ASMOBJS) $(XFS_STAGE1_5_OBJS) $(LIBS) + +$(XFS_STAGE1_5_ASMOBJS): $$(@:xfs_stage1_5_exec-%.o=%.S) + $(CCAS) $(CCASFLAGS) -c -o $@ $(@:xfs_stage1_5_exec-%.o=%.S) + +$(XFS_STAGE1_5_OBJS): $$(@:xfs_stage1_5_exec-%.o=%.c) + $(CC) $(CFLAGS) -c -o $@ $(@:xfs_stage1_5_exec-%.o=%.c) + + + +install: all $(INSTALL_TARGETS) + +$(ROOT_BOOT_GRUB)/%: $(ROOT_BOOT_GRUB) % + $(INS.file) + +$(SRC_DIR)/%: $(SRC_DIR) % + $(INS.file) + +$(SRC_ZFSINC_DIR)/%: $(SRC_ZFSINC_DIR) % + $(INS.file) + +$(ROOT_BOOT_GRUB) $(SRC_DIR) $(SRC_ZFSINC_DIR): + $(INS.dir) + +clean: _FORCE + $(RM) *.o $(BUILT_SOURCES) $(LIBRARIES) $(PROGRAMS) $(NOINSTALL_DATA) + +clobber: clean + $(RM) $(INSTALL_DATA) + +_FORCE: diff --git a/usr/src/grub/grub-0.97/stage2/apic.h b/usr/src/grub/grub-0.97/stage2/apic.h new file mode 100644 index 0000000000..9241329c73 --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/apic.h @@ -0,0 +1,72 @@ +/* + * + * + * Author: Erich Boleyn http://www.uruk.org/~erich/ + * + * Header file for Intel Architecture local and I/O APIC definitions. + * + * This file was created from information in the Intel Pentium Pro + * Family Developer's Manual, Volume 3: Operating System Writer's + * Manual, order number 242692-001, which can be ordered from the + * Intel literature center. + */ + +#ifndef _APIC_H +#define _APIC_H + +/* + * APIC Defines. + */ + +#define APIC_BROADCAST_ID 0xFF + +/* + * APIC register definitions + */ + +/* + * Shared defines for I/O and local APIC definitions + */ +/* APIC version register */ +#define APIC_VERSION(x) ((x) & 0xFF) +/* if the APIC version is equal or greater than APIC_VER_NEW, it + is a "new" APIC */ +#define APIC_VER_NEW 0x10 +/* this next one is used in all cases but an old local APIC, which has + 2 entries in it's LVT */ +#define APIC_MAXREDIR(x) (((x) >> 16) & 0xFF) +/* APIC id register */ +#define APIC_OLD_ID(x) ((x) >> 24) +#define APIC_NEW_ID(x) (((x) >> 24) & 0xF) + +#define IOAPIC_REGSEL 0 +#define IOAPIC_RW 0x10 +#define IOAPIC_ID 0 +#define IOAPIC_VER 1 +#define IOAPIC_REDIR 0x10 +#define LAPIC_ID 0x20 +#define LAPIC_VER 0x30 +#define LAPIC_TPR 0x80 +#define LAPIC_APR 0x90 +#define LAPIC_PPR 0xA0 +#define LAPIC_EOI 0xB0 +#define LAPIC_LDR 0xD0 +#define LAPIC_DFR 0xE0 +#define LAPIC_SPIV 0xF0 +#define LAPIC_SPIV_ENABLE_APIC 0x100 +#define LAPIC_ISR 0x100 +#define LAPIC_TMR 0x180 +#define LAPIC_IRR 0x200 +#define LAPIC_ESR 0x280 +#define LAPIC_ICR 0x300 +#define LAPIC_DEST_MASK 0xFFFFFF +#define LAPIC_LVTT 0x320 +#define LAPIC_LVTPC 0x340 +#define LAPIC_LVT0 0x350 +#define LAPIC_LVT1 0x360 +#define LAPIC_LVTE 0x370 +#define LAPIC_TICR 0x380 +#define LAPIC_TCCR 0x390 +#define LAPIC_TDCR 0x3E0 + +#endif /* _APIC_H */ diff --git a/usr/src/grub/grub-0.97/stage2/apm.S b/usr/src/grub/grub-0.97/stage2/apm.S new file mode 100644 index 0000000000..abf5e271c2 --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/apm.S @@ -0,0 +1,125 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2000, 2001 Free Software Foundation, 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 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. + */ + +/* This is stolen from arch/i386/boot/setup.S in Linux 2.2.17 */ +/* +! setup.S Copyright (C) 1991, 1992 Linus Torvalds +*/ + +ENTRY(get_apm_info) + pushl %ebp + pushl %ebx + pushl %edi + pushl %esi + + call EXT_C(prot_to_real) + .code16 + + /* APM BIOS installation check */ + movw $0x5300, %ax + xorw %bx, %bx + int $0x15 + /* error -> no APM BIOS */ + jc done_apm_bios + + /* check for "PM" signature */ + cmpw $0x504d, %bx + /* no signature -> no APM BIOS */ + jne done_apm_bios + + /* Is 32 bit supported? */ + andw $0x0002, %cx + /* no ... */ + je done_apm_bios + + /* Disconnect first just in case */ + movw $0x5304, %ax + xorw %bx, %bx + /* ignore return code */ + int $0x15 + + /* 32 bit connect */ + movw $0x5303, %ax + xorl %ebx, %ebx + /* paranoia */ + xorw %cx, %cx + xorw %dx, %dx + xorl %esi, %esi + xorw %di, %di + int $0x15 + /* error */ + jc no_32_apm_bios + + /* BIOS code segment */ + movw %ax, ABS(EXT_C(apm_bios_info)) + 2 + /* BIOS entry point offset */ + movl %ebx, ABS(EXT_C(apm_bios_info)) + 4 + /* BIOS 16 bit code segment */ + movw %cx, ABS(EXT_C(apm_bios_info)) + 8 + /* BIOS data segment */ + movw %dx, ABS(EXT_C(apm_bios_info)) + 10 + /* BIOS code segment length */ + movl %esi, ABS(EXT_C(apm_bios_info)) + 14 + /* BIOS data segment length */ + movw %di, ABS(EXT_C(apm_bios_info)) + 18 + + /* + * Redo the installation check as the 32 bit connect + * modifies the flags returned on some BIOSs + */ + + /* APM BIOS installation check */ + movw $0x5300, %ax + xorw %bx, %bx + /* paranoia */ + xorw %cx, %cx + int $0x15 + /* error -> should not happen, tidy up */ + jc done_apm_bios + + /* check for "PM" signature */ + cmpw $0x504d, %bx + /* no signature -> should not happen, tidy up */ + jne done_apm_bios + + /* record the APM BIOS version */ + movw %ax, ABS(EXT_C(apm_bios_info)) + /* and flags */ + movw %cx, ABS(EXT_C(apm_bios_info)) + 12 + jmp done_apm_bios + +no_32_apm_bios: + /* remove 32 bit support bit */ + andw $0xfffd, ABS(EXT_C(apm_bios_info)) + 12 + +done_apm_bios: + /* Some paranoia here: Always Disconnect from APM */ + movw $0x5304, %ax + xorw %bx, %bx + /* ignore return code */ + int $0x15 + + DATA32 call EXT_C(real_to_prot) + .code32 + + popl %esi + popl %edi + popl %ebx + popl %ebp + ret diff --git a/usr/src/grub/grub-0.97/stage2/asm.S b/usr/src/grub/grub-0.97/stage2/asm.S new file mode 100644 index 0000000000..1952421725 --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/asm.S @@ -0,0 +1,2755 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2004 Free Software Foundation, 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 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. + */ + + +/* + * Note: These functions defined in this file may be called from C. + * Be careful of that you must not modify some registers. Quote + * from gcc-2.95.2/gcc/config/i386/i386.h: + + 1 for registers not available across function calls. + These must include the FIXED_REGISTERS and also any + registers that can be used without being saved. + The latter must include the registers where values are returned + and the register where structure-value addresses are passed. + Aside from that, you can include as many other registers as you like. + + ax,dx,cx,bx,si,di,bp,sp,st,st1,st2,st3,st4,st5,st6,st7,arg +{ 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } + */ + +#define ASM_FILE + +#include "shared.h" + +#ifdef STAGE1_5 +# define ABS(x) ((x) - EXT_C(main) + 0x2200) +#else +# define ABS(x) ((x) - EXT_C(main) + 0x8200) +#endif + + .file "asm.S" + + .text + + /* Tell GAS to generate 16-bit instructions so that this code works + in real mode. */ + .code16 + +#ifndef STAGE1_5 + /* + * In stage2, do not link start.S with the rest of the source + * files directly, so define the start symbols here just to + * force ld quiet. These are not referred anyway. + */ + .globl start, _start +start: +_start: +#endif /* ! STAGE1_5 */ + +ENTRY(main) + /* + * Guarantee that "main" is loaded at 0x0:0x8200 in stage2 and + * at 0x0:0x2200 in stage1.5. + */ + ljmp $0, $ABS(codestart) + + /* + * Compatibility version number + * + * These MUST be at byte offset 6 and 7 of the executable + * DO NOT MOVE !!! + */ + . = EXT_C(main) + 0x6 + .byte COMPAT_VERSION_MAJOR, COMPAT_VERSION_MINOR + + /* + * This is a special data area 8 bytes from the beginning. + */ + + . = EXT_C(main) + 0x8 + +VARIABLE(install_partition) + .long 0xFFFFFF +/* This variable is here only because of a historical reason. */ +VARIABLE(saved_entryno) + .long 0 +VARIABLE(stage2_id) + .byte STAGE2_ID +VARIABLE(force_lba) + .byte 0 +VARIABLE(version_string) + .string VERSION +VARIABLE(config_file) +#ifndef STAGE1_5 + .string "/boot/grub/menu.lst" +#else /* STAGE1_5 */ + .long 0xffffffff + .string "/boot/grub/stage2" +#endif /* STAGE1_5 */ + + /* + * Leave some breathing room for the config file name. + */ + + . = EXT_C(main) + 0x70 + +/* the real mode code continues... */ +codestart: + cli /* we're not safe here! */ + + /* set up %ds, %ss, and %es */ + xorw %ax, %ax + movw %ax, %ds + movw %ax, %ss + movw %ax, %es + +#ifndef SUPPORT_DISKLESS + /* + * Save the sector number of the second sector (i.e. this sector) + * in INSTALL_SECOND_SECTOR. See also "stage2/start.S". + */ + ADDR32 movl %ebp, EXT_C(install_second_sector) +#endif + + /* set up the real mode/BIOS stack */ + movl $STACKOFF, %ebp + movl %ebp, %esp + + sti /* we're safe again */ + +#ifndef SUPPORT_DISKLESS + /* save boot drive reference */ + ADDR32 movb %dl, EXT_C(boot_drive) + + /* reset disk system (%ah = 0) */ + int $0x13 +#endif + + /* transition to protected mode */ + DATA32 call EXT_C(real_to_prot) + + /* The ".code32" directive takes GAS out of 16-bit mode. */ + .code32 + + /* clean out the bss */ + + /* set %edi to the bss starting address */ +#if defined(HAVE_USCORE_USCORE_BSS_START_SYMBOL) + movl $__bss_start, %edi +#elif defined(HAVE_USCORE_EDATA_SYMBOL) + movl $_edata, %edi +#elif defined(HAVE_EDATA_SYMBOL) + movl $edata, %edi +#endif + + /* set %ecx to the bss end */ +#if defined(HAVE_END_SYMBOL) + movl $end, %ecx +#elif defined(HAVE_USCORE_END_SYMBOL) + movl $_end, %ecx +#endif + + /* compute the bss length */ + subl %edi, %ecx + + /* zero %al */ + xorb %al, %al + + /* set the direction */ + cld + + /* clean out */ + rep + stosb + + /* + * Call the start of main body of C code, which does some + * of it's own initialization before transferring to "cmain". + */ + call EXT_C(init_bios_info) + + +/* + * This call is special... it never returns... in fact it should simply + * hang at this point! + */ + +ENTRY(stop) + call EXT_C(prot_to_real) + + /* + * This next part is sort of evil. It takes advantage of the + * byte ordering on the x86 to work in either 16-bit or 32-bit + * mode, so think about it before changing it. + */ + +ENTRY(hard_stop) + hlt + jmp EXT_C(hard_stop) + +#ifndef STAGE1_5 + +/************************************************************************** +UNDI_CALL - wrapper around real-mode UNDI API calls +**************************************************************************/ +ENTRY(__undi_call) + pushl %ebp + movl %esp,%ebp + pushl %esi + pushl %edi + pushl %ebx + + movw 8(%ebp),%cx /* Seg:off addr of undi_call_info_t struct */ + movw 12(%ebp),%dx /* Pass to 16-bit code in %cx:%dx */ + + call EXT_C(prot_to_real) + .code16 + + movw %cx,%es /* Seg:off addr of undi_call_info_t struct */ + movw %dx,%bx /* into %es:%bx */ + + movw %es:8(%bx),%ax /* Transfer contents of undi_call_info_t */ + pushw %ax /* structure to the real-mode stack */ + movw %es:6(%bx),%ax + pushw %ax + movw %es:4(%bx),%ax + pushw %ax + + lcall *%es:0(%bx) /* Do the UNDI call */ + cld /* Don't know whether or not we need this */ + /* but pxelinux includes it for some reason, */ + /* so we put it in just in case. */ + + popw %cx /* Tidy up the stack */ + popw %cx + popw %cx + movw %ax,%cx /* Return %ax via %cx */ + + DATA32 call EXT_C(real_to_prot) + .code32 + + xorl %eax,%eax /* %ax is returned via %cx */ + movw %cx,%ax + + popl %ebx + popl %edi + popl %esi + popl %ebp + ret + +/************************************************************************** +UNDI_IRQ_HANDLER - UNDI IRQ handler: calls PXENV_UNDI_ISR and send EOI +NOTE: For some reason, this handler needs to be aligned. Else, the + undi driver won't get the trigger count on some platforms. +**************************************************************************/ + .align 4 +ENTRY(_undi_irq_handler) + .code16 + pushw %ax + pushw %bx + pushw %cx + call 1f /* Position-independent access to */ +1: popw %bx /* various locations. */ + pushw %bx /* save for after UNDI call */ + + /* set funcflag to PXENV_UNDI_ISR_IN_START */ + movw $1,%cs:(pxenv_undi_isr-1b+2)(%bx) + + /* push pxenv_undi_isr struct on stack */ + movl $(ABS(pxenv_undi_isr)),%eax + movw %ax,%cx + shrl $4,%eax /* get segment */ + pushw %ax + andw $0xf,%cx /* get offset */ + pushw %cx + movw $0x14,%ax /* opcode PXENV_UNDI_ISR */ + pushw %ax + + lcall *%cs:(pxenv_entrypointsp-1b)(%bx) /* Do the UNDI call */ + cld /* Don't know whether or not we need this */ + /* but pxelinux includes it for some reason, */ + /* so we put it in just in case. */ + popw %cx /* Tidy up the stack */ + popw %cx + popw %cx + + popw %bx /* restore old position reg */ + + cmpw $0,%ax /* did the UNDI call succeed? */ + jne 3f + movw %cs:(pxenv_undi_isr-1b+2)(%bx),%ax + cmpw $0,%ax /* is this our interrupt? */ + jne 3f + + /* send EOI -- non specific for now */ + movw $0x20,%ax /* ICR_EOI_NON_SPECIFIC */ + movb %cs:(pxenv_undi_irq-1b),%cl + cmpb $8,%cl + jg 2f + outb $0xa0 /* PIC2_ICR */ +2: outb $0x20 /* PIC1_ICR */ + + /* increment trigger count */ + incw %cs:(EXT_C(_undi_irq_trigger_count)-1b)(%bx) + + /* restore other registers */ +3: popw %cx + popw %bx + popw %ax + iret +ENTRY(_undi_irq_trigger_count) +undi_irq_trigger_count: + .word 0 +ENTRY(_undi_irq_chain_to) + .long 0 +ENTRY(_undi_irq_chain) + .byte 0 +ENTRY(_pxenv_undi_irq) +pxenv_undi_irq: + .byte 0 +ENTRY(_pxenv_undi_entrypointsp) +pxenv_entrypointsp: + .word 0 /* offset */ + .word 0 /* segment */ +pxenv_undi_isr: + .word 0 /* status */ + .word 0 /* funcflag */ + .long 0 /* struct padding not used by ISR */ + .long 0 + .long 0 + + .code32 + +/* + * stop_floppy() + * + * Stops the floppy drive from spinning, so that other software is + * jumped to with a known state. + */ +ENTRY(stop_floppy) + pusha + call EXT_C(prot_to_real) + .code16 + xorb %dl, %dl + int $0x13 + DATA32 call EXT_C(real_to_prot) + .code32 + popa + ret + +/* + * grub_reboot() + * + * Reboot the system. At the moment, rely on BIOS. + */ +ENTRY(grub_reboot) + call EXT_C(prot_to_real) + .code16 + /* cold boot */ + movw $0x0472, %di + movw %ax, (%di) + ljmp $0xFFFF, $0x0000 + .code32 + +/* + * grub_halt(int no_apm) + * + * Halt the system, using APM if possible. If NO_APM is true, don't use + * APM even if it is available. + */ +ENTRY(grub_halt) + /* get the argument */ + movl 4(%esp), %eax + + /* see if zero */ + testl %eax, %eax + jnz EXT_C(stop) + + call EXT_C(prot_to_real) + .code16 + + /* detect APM */ + movw $0x5300, %ax + xorw %bx, %bx + int $0x15 + jc EXT_C(hard_stop) + /* don't check %bx for buggy BIOSes... */ + + /* disconnect APM first */ + movw $0x5304, %ax + xorw %bx, %bx + int $0x15 + + /* connect APM */ + movw $0x5301, %ax + xorw %bx, %bx + int $0x15 + jc EXT_C(hard_stop) + + /* set APM protocol level - 1.1 or bust. (this covers APM 1.2 also) */ + movw $0x530E, %ax + xorw %bx, %bx + movw $0x0101, %cx + int $0x15 + jc EXT_C(hard_stop) + + /* set the power state to off */ + movw $0x5307, %ax + movw $1, %bx + movw $3, %cx + int $0x15 + + /* shouldn't reach here */ + jmp EXT_C(hard_stop) + .code32 + +/* + * track_int13(int drive) + * + * Track the int13 handler to probe I/O address space. + */ +ENTRY(track_int13) + pushl %ebp + movl %esp, %ebp + + pushl %ebx + pushl %edi + + /* copy the original int13 handler segment:offset */ + movl $0x4c, %edi + movl (%edi), %eax + movl %eax, track_int13_addr + + /* replace the int1 handler */ + movl $0x4, %edi + pushl (%edi) + movl $ABS(int1_handler), %eax + movl %eax, (%edi) + + /* read the MBR to call int13 successfully */ + movb 8(%ebp), %dl + + call EXT_C(prot_to_real) + .code16 + + movw $SCRATCHSEG, %ax + movw %ax, %es + xorw %bx, %bx + movw $1, %cx + xorb %dh, %dh + + /* save FLAGS on the stack to emulate int13 */ + pushfw + + /* set the TF flag */ + /* FIXME: this can be simplified not to use AX */ + pushfw + popw %ax + orw $0x100, %ax + pushw %ax + popfw + + movw $0x0201, %ax + + .byte 0x9a /* lcall */ +track_int13_addr: + .word 0 /* offset */ + .word 0 /* segment */ + + /* TF is cleared here automatically */ + + DATA32 call EXT_C(real_to_prot) + .code32 + + /* restore the int1 handler */ + movl $0x4, %edi + popl (%edi) + + popl %edi + popl %ebx + popl %ebp + + ret + + +/* + * Check if the next instruction is I/O, and if this is true, add the + * port into the io map. + * + * Note: Probably this will make the execution of int13 very slow. + * + * Note2: In this implementation, all we can know is I/O-mapped I/O. It + * is impossible to detect memory-mapped I/O. + */ +int1_handler: + .code16 + + pushw %bp + movw %sp, %bp + pushw %ds + pushw %ax + pushw %si + pushw %dx + + /* IP */ + movw 2(%bp), %si + /* CS */ + movw 4(%bp), %ax + movw %ax, %ds + + /* examine the next instruction */ +1: lodsb (%si), %al + /* skip this code if it is a prefix */ + cmpb $0x2E, %al + je 1b + cmpb $0x36, %al + je 1b + cmpb $0x3E, %al + je 1b + cmpb $0x26, %al + je 1b + cmpb $0x64, %al + jl 2f + cmpb $0x67, %al + jle 1b +2: cmpb $0xF0, %al + jl 3f + cmpb $0xF3, %al + jle 1b + +3: /* check if this code is out* or in* */ + + /* ins? or outs? */ + cmpb $0x6C, %al + jl 4f + cmpb $0x6F, %al + jle 5f + +4: /* in? or out? (register operand version) */ + cmpb $0xEC, %al + jl 6f + cmpb $0xEF, %al + jle 5f + +6: /* in? or out? (immediate operand version) */ + cmpb $0xE4, %al + jl 8f + cmpb $0xE7, %al + jg 8f + +7: /* immediate has a port */ + lodsb (%si), %al + movzbw %al, %dx + +5: /* %dx has a port */ + + /* set %ds to zero */ + xorw %ax, %ax + movw %ax, %ds + + /* set %si to the io map */ + movw $ABS(EXT_C(io_map)), %si + + +9: /* check if the io map already has the port */ + lodsw (%si), %ax + /* check if this is the end */ + testw %ax, %ax + jz 1f + /* check if this matches the port */ + cmpw %ax, %dx + jne 9b + /* if so, leave from this handler */ + jmp 8f + +1: /* check for the buffer overrun */ + cmpw $(ABS(EXT_C(io_map)) + (IO_MAP_SIZE + 1) * 2), %si + je 8f + /* add the port into the io map */ + movw %dx, -2(%si) + +8: /* restore registers */ + popw %dx + popw %si + popw %ax + popw %ds + popw %bp + + iret + + .code32 + +ENTRY(io_map) + .space (IO_MAP_SIZE + 1) * 2 + + +/* + * set_int15_handler(void) + * + * Set up int15_handler. + */ +ENTRY(set_int15_handler) + pushl %edi + + /* save the original int15 handler */ + movl $0x54, %edi + movw (%edi), %ax + movw %ax, ABS(int15_offset) + movw 2(%edi), %ax + movw %ax, ABS(int15_segment) + + /* save the new int15 handler */ + movw $ABS(int15_handler), %ax + movw %ax, (%edi) + xorw %ax, %ax + movw %ax, 2(%edi) + + popl %edi + ret + + +/* + * unset_int15_handler(void) + * + * Restore the original int15 handler + */ +ENTRY(unset_int15_handler) + pushl %edi + + /* check if int15_handler is set */ + movl $0x54, %edi + movw $ABS(int15_handler), %ax + cmpw %ax, (%edi) + jne 1f + xorw %ax, %ax + cmpw %ax, 2(%edi) + jne 1f + + /* restore the original */ + movw ABS(int15_offset), %ax + movw %ax, (%edi) + movw ABS(int15_segment), %ax + movw %ax, 2(%edi) + +1: + popl %edi + ret + + +/* + * Translate a key code to another. + * + * Note: This implementation cannot handle more than one length + * scancodes (such as Right Ctrl). + */ + .code16 +int15_handler: + /* if non-carrier, ignore it */ + jnc 1f + /* check if AH=4F */ + cmpb $0x4F, %ah + jne 1f + + /* E0 and E1 are special */ + cmpb $0xE1, %al + je 4f + cmpb $0xE0, %al + /* this flag is actually the machine code (je or jmp) */ +int15_skip_flag: + je 4f + + pushw %bp + movw %sp, %bp + + pushw %bx + pushw %dx + pushw %ds + pushw %si + + /* save bits 0-6 of %al in %dl */ + movw %ax, %dx + andb $0x7f, %dl + /* save the highest bit in %bl */ + movb %al, %bl + xorb %dl, %bl + /* set %ds to 0 */ + xorw %ax, %ax + movw %ax, %ds + /* set %si to the key map */ + movw $ABS(EXT_C(bios_key_map)), %si + + /* find the key code from the key map */ +2: + lodsw + /* check if this is the end */ + testw %ax, %ax + jz 3f + /* check if this matches the key code */ + cmpb %al, %dl + jne 2b + /* if so, perform the mapping */ + movb %ah, %dl +3: + /* restore %ax */ + movw %dx, %ax + orb %bl, %al + /* make sure that CF is set */ + orw $1, 6(%bp) + /* restore other registers */ + popw %si + popw %ds + popw %dx + popw %bx + popw %bp + iret + +4: + /* tricky: jmp (0x74) <-> je (0xeb) */ + xorb $(0x74 ^ 0xeb), ABS(int15_skip_flag) +1: + /* just cascade to the original */ + /* ljmp */ + .byte 0xea +int15_offset: .word 0 +int15_segment: .word 0 + + .code32 + + .align 4 +ENTRY(bios_key_map) + .space (KEY_MAP_SIZE + 1) * 2 + + +/* + * set_int13_handler(map) + * + * Copy MAP to the drive map and set up int13_handler. + */ +ENTRY(set_int13_handler) + pushl %ebp + movl %esp, %ebp + + pushl %edi + pushl %esi + + /* copy MAP to the drive map */ + movl $(DRIVE_MAP_SIZE * 2), %ecx + movl $ABS(drive_map), %edi + movl 8(%ebp), %esi + cld + rep + movsb + + /* save the original int13 handler */ + movl $0x4c, %edi + movw (%edi), %ax + movw %ax, ABS(int13_offset) + movw 2(%edi), %ax + movw %ax, ABS(int13_segment) + + /* decrease the lower memory size and set it to the BIOS memory */ + movl $0x413, %edi + decw (%edi) + xorl %eax, %eax + movw (%edi), %ax + + /* compute the segment */ + shll $6, %eax + + /* save the new int13 handler */ + movl $0x4c, %edi + movw %ax, 2(%edi) + xorw %cx, %cx + movw %cx, (%edi) + + /* copy int13_handler to the reserved area */ + shll $4, %eax + movl %eax, %edi + movl $ABS(int13_handler), %esi + movl $(int13_handler_end - int13_handler), %ecx + rep + movsb + + popl %esi + popl %edi + popl %ebp + ret + + +/* + * Map a drive to another drive. + */ + + .code16 + +int13_handler: + pushw %ax + pushw %bp + movw %sp, %bp + + pushw %si + + /* set %si to the drive map */ + movw $(drive_map - int13_handler), %si + /* find the drive number from the drive map */ + cld +1: + lodsw %cs:(%si), %ax + /* check if this is the end */ + testw %ax, %ax + jz 2f + /* check if this matches the drive number */ + cmpb %al, %dl + jne 1b + /* if so, perform the mapping */ + movb %ah, %dl +2: + /* restore %si */ + popw %si + /* save %ax in the stack */ + pushw %ax + /* simulate the interrupt call */ + pushw 8(%bp) + /* set %ax and %bp to the original values */ + movw 2(%bp), %ax + movw (%bp), %bp + /* lcall */ + .byte 0x9a +int13_offset: .word 0 +int13_segment: .word 0 + /* save flags */ + pushf + /* restore %bp */ + movw %sp, %bp + /* save %ax */ + pushw %ax + /* set the flags in the stack to the value returned by int13 */ + movw (%bp), %ax + movw %ax, 0xc(%bp) + /* check if should map the drive number */ + movw 6(%bp), %ax + cmpw $0x8, %ax + jne 3f + cmpw $0x15, %ax + jne 3f + /* check if the mapping was performed */ + movw 2(%bp), %ax + testw %ax, %ax + jz 3f + /* perform the mapping */ + movb %al, %dl +3: + popw %ax + movw 4(%bp), %bp + addw $8, %sp + iret + + .align 4 +drive_map: .space (DRIVE_MAP_SIZE + 1) * 2 +int13_handler_end: + + .code32 + + +/* + * chain_stage1(segment, offset, part_table_addr) + * + * This starts another stage1 loader, at segment:offset. + */ + +ENTRY(chain_stage1) + /* no need to save anything, just use %esp */ + + /* store %ESI, presuming %ES is 0 */ + movl 0xc(%esp), %esi + + /* store new offset */ + movl 0x8(%esp), %eax + movl %eax, offset + + /* store new segment */ + movw 0x4(%esp), %ax + movw %ax, segment + + /* set up to pass boot drive */ + movb EXT_C(boot_drive), %dl + + call EXT_C(prot_to_real) + .code16 + +#ifdef ABSOLUTE_WITHOUT_ASTERISK + DATA32 ADDR32 ljmp (offset) +#else + DATA32 ADDR32 ljmp *(offset) +#endif + .code32 +#endif /* STAGE1_5 */ + + +#ifdef STAGE1_5 +/* + * chain_stage2(segment, offset, second_sector) + * + * This starts another stage2 loader, at segment:offset. It presumes + * that the other one starts with this same "asm.S" file, and passes + * parameters by writing the embedded install variables. + */ + +ENTRY(chain_stage2) + /* no need to save anything, just use %esp */ + + /* store new offset */ + movl 0x8(%esp), %eax + movl %eax, offset + movl %eax, %ebx + + /* store new segment */ + movw 0x4(%esp), %ax + movw %ax, segment + shll $4, %eax + + /* generate linear address */ + addl %eax, %ebx + + /* set up to pass the partition where stage2 is located in */ + movl EXT_C(current_partition), %eax + movl %eax, (EXT_C(install_partition)-EXT_C(main))(%ebx) + + /* set up to pass the drive where stage2 is located in */ + movb EXT_C(current_drive), %dl + + /* set up to pass the second sector of stage2 */ + movl 0xc(%esp), %ecx + + call EXT_C(prot_to_real) + .code16 + + movl %ecx, %ebp + +#ifdef ABSOLUTE_WITHOUT_ASTERISK + DATA32 ADDR32 ljmp (offset) +#else + DATA32 ADDR32 ljmp *(offset) +#endif + + .code32 +#endif /* STAGE1_5 */ + +/* + * These next two routines, "real_to_prot" and "prot_to_real" are structured + * in a very specific way. Be very careful when changing them. + * + * NOTE: Use of either one messes up %eax and %ebp. + */ + +ENTRY(real_to_prot) + .code16 + cli + + /* load the GDT register */ + DATA32 ADDR32 lgdt gdtdesc + + /* turn on protected mode */ + movl %cr0, %eax + orl $CR0_PE_ON, %eax + movl %eax, %cr0 + + /* jump to relocation, flush prefetch queue, and reload %cs */ + DATA32 ljmp $PROT_MODE_CSEG, $protcseg + + /* + * The ".code32" directive only works in GAS, the GNU assembler! + * This gets out of "16-bit" mode. + */ + .code32 + +protcseg: + /* reload other segment registers */ + movw $PROT_MODE_DSEG, %ax + movw %ax, %ds + movw %ax, %es + movw %ax, %fs + movw %ax, %gs + movw %ax, %ss + + /* put the return address in a known safe location */ + movl (%esp), %eax + movl %eax, STACKOFF + + /* get protected mode stack */ + movl protstack, %eax + movl %eax, %esp + movl %eax, %ebp + + /* get return address onto the right stack */ + movl STACKOFF, %eax + movl %eax, (%esp) + + /* zero %eax */ + xorl %eax, %eax + + /* return on the old (or initialized) stack! */ + ret + + +ENTRY(prot_to_real) + /* just in case, set GDT */ + lgdt gdtdesc + + /* save the protected mode stack */ + movl %esp, %eax + movl %eax, protstack + + /* get the return address */ + movl (%esp), %eax + movl %eax, STACKOFF + + /* set up new stack */ + movl $STACKOFF, %eax + movl %eax, %esp + movl %eax, %ebp + + /* set up segment limits */ + movw $PSEUDO_RM_DSEG, %ax + movw %ax, %ds + movw %ax, %es + movw %ax, %fs + movw %ax, %gs + movw %ax, %ss + + /* this might be an extra step */ + ljmp $PSEUDO_RM_CSEG, $tmpcseg /* jump to a 16 bit segment */ + +tmpcseg: + .code16 + + /* clear the PE bit of CR0 */ + movl %cr0, %eax + andl $CR0_PE_OFF, %eax + movl %eax, %cr0 + + /* flush prefetch queue, reload %cs */ + DATA32 ljmp $0, $realcseg + +realcseg: + /* we are in real mode now + * set up the real mode segment registers : DS, SS, ES + */ + /* zero %eax */ + xorl %eax, %eax + + movw %ax, %ds + movw %ax, %es + movw %ax, %fs + movw %ax, %gs + movw %ax, %ss + + /* restore interrupts */ + sti + + /* return on new stack! */ + DATA32 ret + + .code32 + + +/* + * int biosdisk_int13_extensions (int ax, int drive, void *dap) + * + * Call IBM/MS INT13 Extensions (int 13 %ax=AX) for DRIVE. DAP + * is passed for disk address packet. If an error occurs, return + * non-zero, otherwise zero. + */ + +ENTRY(biosdisk_int13_extensions) + pushl %ebp + movl %esp, %ebp + + pushl %esi + pushl %ebx + + /* compute the address of disk_address_packet */ + movl 0x10(%ebp), %eax + movw %ax, %si + xorw %ax, %ax + shrl $4, %eax + movw %ax, %cx /* save the segment to cx */ + + /* drive */ + movb 0xc(%ebp), %dl + /* ax */ + movw 0x8(%ebp), %bx + /* enter real mode */ + call EXT_C(prot_to_real) + + .code16 + movw %bx, %ax + movw %cx, %ds + int $0x13 /* do the operation */ + movb %ah, %dl /* save return value */ + /* clear the data segment */ + xorw %ax, %ax + movw %ax, %ds + /* back to protected mode */ + DATA32 call EXT_C(real_to_prot) + .code32 + + movb %dl, %al /* return value in %eax */ + + popl %ebx + popl %esi + popl %ebp + + ret + +/* + * int biosdisk_standard (int ah, int drive, int coff, int hoff, int soff, + * int nsec, int segment) + * + * Call standard and old INT13 (int 13 %ah=AH) for DRIVE. Read/write + * NSEC sectors from COFF/HOFF/SOFF into SEGMENT. If an error occurs, + * return non-zero, otherwise zero. + */ + +ENTRY(biosdisk_standard) + pushl %ebp + movl %esp, %ebp + + pushl %ebx + pushl %edi + pushl %esi + + /* set up CHS information */ + movl 0x10(%ebp), %eax + movb %al, %ch + movb 0x18(%ebp), %al + shlb $2, %al + shrw $2, %ax + movb %al, %cl + movb 0x14(%ebp), %dh + /* drive */ + movb 0xc(%ebp), %dl + /* segment */ + movw 0x20(%ebp), %bx + /* save nsec and ah to %di */ + movb 0x8(%ebp), %ah + movb 0x1c(%ebp), %al + movw %ax, %di + /* enter real mode */ + call EXT_C(prot_to_real) + + .code16 + movw %bx, %es + xorw %bx, %bx + movw $3, %si /* attempt at least three times */ + +1: + movw %di, %ax + int $0x13 /* do the operation */ + jnc 2f /* check if successful */ + + movb %ah, %bl /* save return value */ + /* if fail, reset the disk system */ + xorw %ax, %ax + int $0x13 + + decw %si + cmpw $0, %si + je 2f + xorb %bl, %bl + jmp 1b /* retry */ +2: + /* back to protected mode */ + DATA32 call EXT_C(real_to_prot) + .code32 + + movb %bl, %al /* return value in %eax */ + + popl %esi + popl %edi + popl %ebx + popl %ebp + + ret + + +/* + * int check_int13_extensions (int drive) + * + * Check if LBA is supported for DRIVE. If it is supported, then return + * the major version of extensions, otherwise zero. + */ + +ENTRY(check_int13_extensions) + pushl %ebp + movl %esp, %ebp + + pushl %ebx + + /* drive */ + movb 0x8(%ebp), %dl + /* enter real mode */ + call EXT_C(prot_to_real) + + .code16 + movb $0x41, %ah + movw $0x55aa, %bx + int $0x13 /* do the operation */ + + /* check the result */ + jc 1f + cmpw $0xaa55, %bx + jne 1f + + movb %ah, %bl /* save the major version into %bl */ + + /* check if AH=0x42 is supported if FORCE_LBA is zero */ + movb EXT_C(force_lba), %al + testb %al, %al + jnz 2f + andw $1, %cx + jnz 2f + +1: + xorb %bl, %bl +2: + /* back to protected mode */ + DATA32 call EXT_C(real_to_prot) + .code32 + + movb %bl, %al /* return value in %eax */ + + popl %ebx + popl %ebp + + ret + + +/* + * int get_diskinfo_standard (int drive, unsigned long *cylinders, + * unsigned long *heads, unsigned long *sectors) + * + * Return the geometry of DRIVE in CYLINDERS, HEADS and SECTORS. If an + * error occurs, then return non-zero, otherwise zero. + */ + +ENTRY(get_diskinfo_standard) + pushl %ebp + movl %esp, %ebp + + pushl %ebx + pushl %edi + + /* drive */ + movb 0x8(%ebp), %dl + /* enter real mode */ + call EXT_C(prot_to_real) + + .code16 + movb $0x8, %ah + int $0x13 /* do the operation */ + /* check if successful */ + testb %ah, %ah + jnz 1f + /* bogus BIOSes may not return an error number */ + testb $0x3f, %cl /* 0 sectors means no disk */ + jnz 1f /* if non-zero, then succeed */ + /* XXX 0x60 is one of the unused error numbers */ + movb $0x60, %ah +1: + movb %ah, %bl /* save return value in %bl */ + /* back to protected mode */ + DATA32 call EXT_C(real_to_prot) + .code32 + + /* restore %ebp */ + leal 0x8(%esp), %ebp + + /* heads */ + movb %dh, %al + incl %eax /* the number of heads is counted from zero */ + movl 0x10(%ebp), %edi + movl %eax, (%edi) + + /* sectors */ + xorl %eax, %eax + movb %cl, %al + andb $0x3f, %al + movl 0x14(%ebp), %edi + movl %eax, (%edi) + + /* cylinders */ + shrb $6, %cl + movb %cl, %ah + movb %ch, %al + incl %eax /* the number of cylinders is + counted from zero */ + movl 0xc(%ebp), %edi + movl %eax, (%edi) + + xorl %eax, %eax + movb %bl, %al /* return value in %eax */ + + popl %edi + popl %ebx + popl %ebp + + ret + + +#if 0 +/* + * int get_diskinfo_floppy (int drive, unsigned long *cylinders, + * unsigned long *heads, unsigned long *sectors) + * + * Return the geometry of DRIVE in CYLINDERS, HEADS and SECTORS. If an + * error occurs, then return non-zero, otherwise zero. + */ + +ENTRY(get_diskinfo_floppy) + pushl %ebp + movl %esp, %ebp + + pushl %ebx + pushl %esi + + /* drive */ + movb 0x8(%ebp), %dl + /* enter real mode */ + call EXT_C(prot_to_real) + + .code16 + /* init probe value */ + movl $probe_values-1, %esi +1: + xorw %ax, %ax + int $0x13 /* reset floppy controller */ + + incw %si + movb (%si), %cl + cmpb $0, %cl /* probe failed if zero */ + je 2f + + /* perform read */ + movw $SCRATCHSEG, %ax + movw %ax, %es + xorw %bx, %bx + movw $0x0201, %ax + movb $0, %ch + movb $0, %dh + int $0x13 + + /* FIXME: Read from floppy may fail even if the geometry is correct. + So should retry at least three times. */ + jc 1b /* next value */ + + /* succeed */ + jmp 2f + +probe_values: + .byte 36, 18, 15, 9, 0 + +2: + /* back to protected mode */ + DATA32 call EXT_C(real_to_prot) + .code32 + + /* restore %ebp */ + leal 0x8(%esp), %ebp + + /* cylinders */ + movl 0xc(%ebp), %eax + movl $80, %ebx + movl %ebx, (%eax) + /* heads */ + movl 0x10(%ebp), %eax + movl $2, %ebx + movl %ebx, (%eax) + /* sectors */ + movl 0x14(%ebp), %eax + movzbl %cl, %ebx + movl %ebx, (%eax) + + /* return value in %eax */ + xorl %eax, %eax + cmpb $0, %cl + jne 3f + incl %eax /* %eax = 1 (non-zero) */ +3: + popl %esi + popl %ebx + popl %ebp + + ret +#endif + + +/* Source files are splitted, as they have different copyrights. */ +#ifndef STAGE1_5 +# include "setjmp.S" +# include "apm.S" +#endif /* ! STAGE1_5 */ + + + +#ifndef STAGE1_5 +/* get_code_end() : return the address of the end of the code + * This is here so that it can be replaced by asmstub.c. + */ +ENTRY(get_code_end) + /* will be the end of the bss */ +# if defined(HAVE_END_SYMBOL) + movl $end, %eax +# elif defined(HAVE_USCORE_END_SYMBOL) + movl $_end, %eax +# endif + shrl $2, %eax /* Round up to the next word. */ + incl %eax + shll $2, %eax + ret +#endif /* ! STAGE1_5 */ + +/* + * + * get_memsize(i) : return the memory size in KB. i == 0 for conventional + * memory, i == 1 for extended memory + * BIOS call "INT 12H" to get conventional memory size + * BIOS call "INT 15H, AH=88H" to get extended memory size + * Both have the return value in AX. + * + */ + +ENTRY(get_memsize) + push %ebp + push %ebx + + mov 0xc(%esp), %ebx + + call EXT_C(prot_to_real) /* enter real mode */ + .code16 + + cmpb $0x1, %bl + DATA32 je xext + + int $0x12 + DATA32 jmp xdone + +xext: + movb $0x88, %ah + int $0x15 + +xdone: + movw %ax, %bx + + DATA32 call EXT_C(real_to_prot) + .code32 + + movw %bx, %ax + pop %ebx + pop %ebp + ret + + +#ifndef STAGE1_5 + +/* + * + * get_eisamemsize() : return packed EISA memory map, lower 16 bits is + * memory between 1M and 16M in 1K parts, upper 16 bits is + * memory above 16M in 64K parts. If error, return -1. + * BIOS call "INT 15H, AH=E801H" to get EISA memory map, + * AX = memory between 1M and 16M in 1K parts. + * BX = memory above 16M in 64K parts. + * + */ + +ENTRY(get_eisamemsize) + push %ebp + push %ebx + + call EXT_C(prot_to_real) /* enter real mode */ + .code16 + + movw $0xe801, %ax + int $0x15 + + shll $16, %ebx + movw %ax, %bx + + DATA32 call EXT_C(real_to_prot) + .code32 + + movl $0xFFFFFFFF, %eax + cmpb $0x86, %bh + je xnoteisa + + movl %ebx, %eax + +xnoteisa: + pop %ebx + pop %ebp + ret + +/* + * + * get_mmap_entry(addr, cont) : address and old continuation value (zero to + * start), for the Query System Address Map BIOS call. + * + * Sets the first 4-byte int value of "addr" to the size returned by + * the call. If the call fails, sets it to zero. + * + * Returns: new (non-zero) continuation value, 0 if done. + * + * NOTE: Currently hard-coded for a maximum buffer length of 1024. + */ + +ENTRY(get_mmap_entry) + push %ebp + push %ebx + push %edi + push %esi + + /* place address (+4) in ES:DI */ + movl 0x14(%esp), %eax + addl $4, %eax + movl %eax, %edi + andl $0xf, %edi + shrl $4, %eax + movl %eax, %esi + + /* set continuation value */ + movl 0x18(%esp), %ebx + + /* set default maximum buffer size */ + movl $0x14, %ecx + + /* set EDX to 'SMAP' */ + movl $0x534d4150, %edx + + call EXT_C(prot_to_real) /* enter real mode */ + .code16 + + movw %si, %es + movl $0xe820, %eax + int $0x15 + + DATA32 jc xnosmap + + cmpl $0x534d4150, %eax + DATA32 jne xnosmap + + cmpl $0x14, %ecx + DATA32 jl xnosmap + + cmpl $0x400, %ecx + DATA32 jg xnosmap + + DATA32 jmp xsmap + +xnosmap: + movl $0, %ecx + +xsmap: + DATA32 call EXT_C(real_to_prot) + .code32 + + /* write length of buffer (zero if error) into "addr" */ + movl 0x14(%esp), %eax + movl %ecx, (%eax) + + /* set return value to continuation */ + movl %ebx, %eax + + pop %esi + pop %edi + pop %ebx + pop %ebp + ret + +/* + * get_rom_config_table() + * + * Get the linear address of a ROM configuration table. Return zero, + * if fails. + */ + +ENTRY(get_rom_config_table) + pushl %ebp + pushl %ebx + + /* zero %ebx for simplicity */ + xorl %ebx, %ebx + + call EXT_C(prot_to_real) + .code16 + + movw $0xc0, %ax + int $0x15 + + jc no_rom_table + testb %ah, %ah + jnz no_rom_table + + movw %es, %dx + jmp found_rom_table + +no_rom_table: + xorw %dx, %dx + xorw %bx, %bx + +found_rom_table: + DATA32 call EXT_C(real_to_prot) + .code32 + + /* compute the linear address */ + movw %dx, %ax + shll $4, %eax + addl %ebx, %eax + + popl %ebx + popl %ebp + ret + + +/* + * int get_vbe_controller_info (struct vbe_controller *controller_ptr) + * + * Get VBE controller information. + */ + +ENTRY(get_vbe_controller_info) + pushl %ebp + movl %esp, %ebp + + pushl %edi + pushl %ebx + + /* Convert the linear address to segment:offset */ + movl 8(%ebp), %eax + movl %eax, %edi + andl $0x0000000f, %edi + shrl $4, %eax + movl %eax, %ebx + + call EXT_C(prot_to_real) + .code16 + + movw %bx, %es + movw $0x4F00, %ax + int $0x10 + + movw %ax, %bx + DATA32 call EXT_C(real_to_prot) + .code32 + + movzwl %bx, %eax + + popl %ebx + popl %edi + popl %ebp + ret + + +/* + * int get_vbe_mode_info (int mode_number, struct vbe_mode *mode_ptr) + * + * Get VBE mode information. + */ + +ENTRY(get_vbe_mode_info) + pushl %ebp + movl %esp, %ebp + + pushl %edi + pushl %ebx + + /* Convert the linear address to segment:offset */ + movl 0xc(%ebp), %eax + movl %eax, %edi + andl $0x0000000f, %edi + shrl $4, %eax + movl %eax, %ebx + + /* Save the mode number in %cx */ + movl 0x8(%ebp), %ecx + + call EXT_C(prot_to_real) + .code16 + + movw %bx, %es + movw $0x4F01, %ax + int $0x10 + + movw %ax, %bx + DATA32 call EXT_C(real_to_prot) + .code32 + + movzwl %bx, %eax + + popl %ebx + popl %edi + popl %ebp + ret + + +/* + * int set_vbe_mode (int mode_number) + * + * Set VBE mode. Don't support user-specified CRTC information. + */ + +ENTRY(set_vbe_mode) + pushl %ebp + movl %esp, %ebp + + pushl %ebx + + /* Save the mode number in %bx */ + movl 0x8(%ebp), %ebx + /* Clear bit D11 */ + andl $0xF7FF, %ebx + + call EXT_C(prot_to_real) + .code16 + + movw $0x4F02, %ax + int $0x10 + + movw %ax, %bx + DATA32 call EXT_C(real_to_prot) + .code32 + + movzwl %bx, %eax + + popl %ebx + popl %ebp + ret + + +/* + * gateA20(int linear) + * + * Gate address-line 20 for high memory. + * + * This routine is probably overconservative in what it does, but so what? + * + * It also eats any keystrokes in the keyboard buffer. :-( + */ + +ENTRY(gateA20) + /* first, try a BIOS call */ + pushl %ebp + movl 8(%esp), %edx + + call EXT_C(prot_to_real) + + .code16 + movw $0x2400, %ax + testw %dx, %dx + jz 1f + incw %ax +1: stc + int $0x15 + jnc 2f + + /* set non-zero if failed */ + movb $1, %ah + + /* save the status */ +2: movb %ah, %dl + + DATA32 call EXT_C(real_to_prot) + .code32 + + popl %ebp + testb %dl, %dl + jnz 3f + ret + +3: /* + * try to switch gateA20 using PORT92, the "Fast A20 and Init" + * register + */ + mov $0x92, %dx + inb %dx, %al + /* skip the port92 code if it's unimplemented (read returns 0xff) */ + cmpb $0xff, %al + jz 6f + + /* set or clear bit1, the ALT_A20_GATE bit */ + movb 4(%esp), %ah + testb %ah, %ah + jz 4f + orb $2, %al + jmp 5f +4: and $0xfd, %al + + /* clear the INIT_NOW bit; don't accidently reset the machine */ +5: and $0xfe, %al + outb %al, %dx + +6: /* use keyboard controller */ + pushl %eax + + call gloop1 + + movb $KC_CMD_WOUT, %al + outb $K_CMD + +gloopint1: + inb $K_STATUS + cmpb $0xff, %al + jz gloopint1_done + andb $K_IBUF_FUL, %al + jnz gloopint1 + +gloopint1_done: + movb $KB_OUTPUT_MASK, %al + cmpb $0, 0x8(%esp) + jz gdoit + + orb $KB_A20_ENABLE, %al +gdoit: + outb $K_RDWR + + call gloop1 + + /* output a dummy command (USB keyboard hack) */ + movb $0xff, %al + outb $K_CMD + call gloop1 + + popl %eax + ret + +gloop1: + inb $K_STATUS + cmpb $0xff, %al + jz gloop2ret + andb $K_IBUF_FUL, %al + jnz gloop1 + +gloop2: + inb $K_STATUS + andb $K_OBUF_FUL, %al + jz gloop2ret + inb $K_RDWR + jmp gloop2 + +gloop2ret: + ret + + +ENTRY(patch_code) /* labels start with "pc_" */ + .code16 + + mov %cs, %ax + mov %ax, %ds + mov %ax, %es + mov %ax, %fs + mov %ax, %gs + ADDR32 movl $0, 0 +pc_stop: + hlt + DATA32 jmp pc_stop +ENTRY(patch_code_end) + + .code32 + + +/* + * linux_boot() + * + * Does some funky things (including on the stack!), then jumps to the + * entry point of the Linux setup code. + */ + +VARIABLE(linux_text_len) + .long 0 + +VARIABLE(linux_data_tmp_addr) + .long 0 + +VARIABLE(linux_data_real_addr) + .long 0 + +ENTRY(linux_boot) + /* don't worry about saving anything, we're committed at this point */ + cld /* forward copying */ + + /* copy kernel */ + movl EXT_C(linux_text_len), %ecx + addl $3, %ecx + shrl $2, %ecx + movl $LINUX_BZIMAGE_ADDR, %esi + movl $LINUX_ZIMAGE_ADDR, %edi + + rep + movsl + +ENTRY(big_linux_boot) + movl EXT_C(linux_data_real_addr), %ebx + + /* copy the real mode part */ + movl EXT_C(linux_data_tmp_addr), %esi + movl %ebx, %edi + movl $LINUX_SETUP_MOVE_SIZE, %ecx + cld + rep + movsb + + /* change %ebx to the segment address */ + shrl $4, %ebx + movl %ebx, %eax + addl $0x20, %eax + movl %eax, linux_setup_seg + + /* XXX new stack pointer in safe area for calling functions */ + movl $0x4000, %esp + call EXT_C(stop_floppy) + + /* final setup for linux boot */ + + call EXT_C(prot_to_real) + .code16 + + /* final setup for linux boot */ + cli + movw %bx, %ss + movw $LINUX_SETUP_STACK, %sp + + movw %bx, %ds + movw %bx, %es + movw %bx, %fs + movw %bx, %gs + + /* jump to start */ + /* ljmp */ + .byte 0xea + .word 0 +linux_setup_seg: + .word 0 + .code32 + + +/* + * multi_boot(int start, int mb_info) + * + * This starts a kernel in the manner expected of the multiboot standard. + */ + +ENTRY(multi_boot) + /* no need to save anything */ + call EXT_C(stop_floppy) + + movl $0x2BADB002, %eax + movl 0x8(%esp), %ebx + + /* boot kernel here (absolute address call) */ + call *0x4(%esp) + + /* error */ + call EXT_C(stop) + +#endif /* ! STAGE1_5 */ + +/* + * void console_putchar (int c) + * + * Put the character C on the console. Because GRUB wants to write a + * character with an attribute, this implementation is a bit tricky. + * If C is a control character (CR, LF, BEL, BS), use INT 10, AH = 0Eh + * (TELETYPE OUTPUT). Otherwise, save the original position, put a space, + * save the current position, restore the original position, write the + * character and the attribute, and restore the current position. + * + * The reason why this is so complicated is that there is no easy way to + * get the height of the screen, and the TELETYPE OUPUT BIOS call doesn't + * support setting a background attribute. + */ +ENTRY(console_putchar) + movl 0x4(%esp), %edx + pusha +#ifdef STAGE1_5 + movb $0x07, %bl +#else + movl EXT_C(console_current_color), %ebx +#endif + + call EXT_C(prot_to_real) + .code16 + movb %dl, %al + xorb %bh, %bh + +#ifndef STAGE1_5 + /* use teletype output if control character */ + cmpb $0x7, %al + je 1f + cmpb $0x8, %al + je 1f + cmpb $0xa, %al + je 1f + cmpb $0xd, %al + je 1f + + /* save the character and the attribute on the stack */ + pushw %ax + pushw %bx + + /* get the current position */ + movb $0x3, %ah + int $0x10 + + /* check the column with the width */ + cmpb $79, %dl + jl 2f + + /* print CR and LF, if next write will exceed the width */ + movw $0x0e0d, %ax + int $0x10 + movb $0x0a, %al + int $0x10 + + /* get the current position */ + movb $0x3, %ah + int $0x10 + +2: + /* restore the character and the attribute */ + popw %bx + popw %ax + + /* write the character with the attribute */ + movb $0x9, %ah + movw $1, %cx + int $0x10 + + /* move the cursor forward */ + incb %dl + movb $0x2, %ah + int $0x10 + + jmp 3f +#endif /* ! STAGE1_5 */ + +1: movb $0xe, %ah + int $0x10 + +3: DATA32 call EXT_C(real_to_prot) + .code32 + + popa + ret + + +#ifndef STAGE1_5 + +/* this table is used in translate_keycode below */ +translation_table: + .word KEY_LEFT, 2 + .word KEY_RIGHT, 6 + .word KEY_UP, 16 + .word KEY_DOWN, 14 + .word KEY_HOME, 1 + .word KEY_END, 5 + .word KEY_DC, 4 + .word KEY_BACKSPACE, 8 + .word KEY_PPAGE, 7 + .word KEY_NPAGE, 3 + .word 0 + +/* + * translate_keycode translates the key code %dx to an ascii code. + */ + .code16 + +translate_keycode: + pushw %bx + pushw %si + + movw $ABS(translation_table), %si + +1: lodsw + /* check if this is the end */ + testw %ax, %ax + jz 2f + /* load the ascii code into %ax */ + movw %ax, %bx + lodsw + /* check if this matches the key code */ + cmpw %bx, %dx + jne 1b + /* translate %dx, if successful */ + movw %ax, %dx + +2: popw %si + popw %bx + ret + + .code32 + + +/* + * remap_ascii_char remaps the ascii code %dl to another if the code is + * contained in ASCII_KEY_MAP. + */ + .code16 + +remap_ascii_char: + pushw %si + + movw $ABS(EXT_C(ascii_key_map)), %si +1: + lodsw + /* check if this is the end */ + testw %ax, %ax + jz 2f + /* check if this matches the ascii code */ + cmpb %al, %dl + jne 1b + /* if so, perform the mapping */ + movb %ah, %dl +2: + /* restore %si */ + popw %si + + ret + + .code32 + + .align 4 +ENTRY(ascii_key_map) + .space (KEY_MAP_SIZE + 1) * 2 + + +/* + * int console_getkey (void) + * BIOS call "INT 16H Function 00H" to read character from keyboard + * Call with %ah = 0x0 + * Return: %ah = keyboard scan code + * %al = ASCII character + */ + +ENTRY(console_getkey) + push %ebp + +wait_for_key: + call EXT_C(console_checkkey) + incl %eax + jz wait_for_key + + call EXT_C(prot_to_real) + .code16 + + int $0x16 + + movw %ax, %dx /* real_to_prot uses %eax */ + call translate_keycode + call remap_ascii_char + + DATA32 call EXT_C(real_to_prot) + .code32 + + movw %dx, %ax + + pop %ebp + ret + + +/* + * int console_checkkey (void) + * if there is a character pending, return it; otherwise return -1 + * BIOS call "INT 16H Function 01H" to check whether a character is pending + * Call with %ah = 0x1 + * Return: + * If key waiting to be input: + * %ah = keyboard scan code + * %al = ASCII character + * Zero flag = clear + * else + * Zero flag = set + */ +ENTRY(console_checkkey) + push %ebp + xorl %edx, %edx + + call EXT_C(prot_to_real) /* enter real mode */ + .code16 + + movb $0x1, %ah + int $0x16 + + DATA32 jz notpending + + movw %ax, %dx + call translate_keycode + call remap_ascii_char + DATA32 jmp pending + +notpending: + movl $0xFFFFFFFF, %edx + +pending: + DATA32 call EXT_C(real_to_prot) + .code32 + + mov %edx, %eax + + pop %ebp + ret + + +/* + * int console_getxy (void) + * BIOS call "INT 10H Function 03h" to get cursor position + * Call with %ah = 0x03 + * %bh = page + * Returns %ch = starting scan line + * %cl = ending scan line + * %dh = row (0 is top) + * %dl = column (0 is left) + */ + + +ENTRY(console_getxy) + push %ebp + push %ebx /* save EBX */ + + call EXT_C(prot_to_real) + .code16 + + xorb %bh, %bh /* set page to 0 */ + movb $0x3, %ah + int $0x10 /* get cursor position */ + + DATA32 call EXT_C(real_to_prot) + .code32 + + movb %dl, %ah + movb %dh, %al + + pop %ebx + pop %ebp + ret + + +/* + * void console_gotoxy(int x, int y) + * BIOS call "INT 10H Function 02h" to set cursor position + * Call with %ah = 0x02 + * %bh = page + * %dh = row (0 is top) + * %dl = column (0 is left) + */ + + +ENTRY(console_gotoxy) + push %ebp + push %ebx /* save EBX */ + + movb 0xc(%esp), %dl /* %dl = x */ + movb 0x10(%esp), %dh /* %dh = y */ + + call EXT_C(prot_to_real) + .code16 + + xorb %bh, %bh /* set page to 0 */ + movb $0x2, %ah + int $0x10 /* set cursor position */ + + DATA32 call EXT_C(real_to_prot) + .code32 + + pop %ebx + pop %ebp + ret + + +/* + * void console_cls (void) + * BIOS call "INT 10H Function 09h" to write character and attribute + * Call with %ah = 0x09 + * %al = (character) + * %bh = (page number) + * %bl = (attribute) + * %cx = (number of times) + */ + + +ENTRY(console_cls) + push %ebp + push %ebx /* save EBX */ + + call EXT_C(prot_to_real) + .code16 + + /* move the cursor to the beginning */ + movb $0x02, %ah + xorb %bh, %bh + xorw %dx, %dx + int $0x10 + + /* write spaces to the entire screen */ + movw $0x0920, %ax + movw $0x07, %bx + movw $(80 * 25), %cx + int $0x10 + + /* move back the cursor */ + movb $0x02, %ah + int $0x10 + + DATA32 call EXT_C(real_to_prot) + .code32 + + pop %ebx + pop %ebp + ret + + +/* + * int console_setcursor (int on) + * BIOS call "INT 10H Function 01h" to set cursor type + * Call with %ah = 0x01 + * %ch = cursor starting scanline + * %cl = cursor ending scanline + */ + +console_cursor_state: + .byte 1 +console_cursor_shape: + .word 0 + +ENTRY(console_setcursor) + push %ebp + push %ebx + + /* check if the standard cursor shape has already been saved */ + movw console_cursor_shape, %ax + testw %ax, %ax + jne 1f + + call EXT_C(prot_to_real) + .code16 + + movb $0x03, %ah + xorb %bh, %bh + int $0x10 + + DATA32 call EXT_C(real_to_prot) + .code32 + + movw %cx, console_cursor_shape +1: + /* set %cx to the designated cursor shape */ + movw $0x2000, %cx + movl 0xc(%esp), %ebx + testl %ebx, %ebx + jz 2f + movw console_cursor_shape, %cx +2: + call EXT_C(prot_to_real) + .code16 + + movb $0x1, %ah + int $0x10 + + DATA32 call EXT_C(real_to_prot) + .code32 + + movzbl console_cursor_state, %eax + movb %bl, console_cursor_state + + pop %ebx + pop %ebp + ret + +/* graphics mode functions */ +#ifdef SUPPORT_GRAPHICS +VARIABLE(cursorX) +.word 0 +VARIABLE(cursorY) +.word 0 +VARIABLE(cursorCount) +.word 0 +VARIABLE(cursorBuf) +.byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + + +/* + * int set_videomode(mode) + * BIOS call "INT 10H Function 0h" to set video mode + * Call with %ah = 0x0 + * %al = video mode + * Returns old videomode. + */ +ENTRY(set_videomode) + push %ebp + push %ebx + push %ecx + + movb 0x10(%esp), %cl + + call EXT_C(prot_to_real) + .code16 + + xorw %bx, %bx + movb $0xf, %ah + int $0x10 /* Get Current Video mode */ + movb %al, %ch + xorb %ah, %ah + movb %cl, %al + int $0x10 /* Set Video mode */ + + DATA32 call EXT_C(real_to_prot) + .code32 + + xorb %ah, %ah + movb %ch, %al + + pop %ecx + pop %ebx + pop %ebp + ret + + +/* + * unsigned char * graphics_get_font() + * BIOS call "INT 10H Function 11h" to set font + * Call with %ah = 0x11 + */ +ENTRY(graphics_get_font) + push %ebp + push %ebx + push %ecx + push %edx + + call EXT_C(prot_to_real) + .code16 + + movw $0x1130, %ax + movb $6, %bh /* font 8x16 */ + int $0x10 + movw %bp, %dx + movw %es, %cx + + DATA32 call EXT_C(real_to_prot) + .code32 + + xorl %eax, %eax + movw %cx, %ax + shll $4, %eax + movw %dx, %ax + + pop %edx + pop %ecx + pop %ebx + pop %ebp + ret + + + +/* + * graphics_set_palette(index, red, green, blue) + * BIOS call "INT 10H Function 10h" to set individual dac register + * Call with %ah = 0x10 + * %bx = register number + * %ch = new value for green (0-63) + * %cl = new value for blue (0-63) + * %dh = new value for red (0-63) + */ + +ENTRY(graphics_set_palette) + push %ebp + push %eax + push %ebx + push %ecx + push %edx + + movw $0x3c8, %bx /* address write mode register */ + + /* wait vertical retrace */ + + movw $0x3da, %dx +l1b: inb %dx, %al /* wait vertical active display */ + test $8, %al + jnz l1b + +l2b: inb %dx, %al /* wait vertical retrace */ + test $8, %al + jnz l2b + + mov %bx, %dx + movb 0x18(%esp), %al /* index */ + outb %al, %dx + inc %dx + + movb 0x1c(%esp), %al /* red */ + outb %al, %dx + + movb 0x20(%esp), %al /* green */ + outb %al, %dx + + movb 0x24(%esp), %al /* blue */ + outb %al, %dx + + movw 0x18(%esp), %bx + + call EXT_C(prot_to_real) + .code16 + + movb %bl, %bh + movw $0x1000, %ax + int $0x10 + + DATA32 call EXT_C(real_to_prot) + .code32 + + pop %edx + pop %ecx + pop %ebx + pop %eax + pop %ebp + ret + +#endif /* SUPPORT_GRAPHICS */ + +/* + * getrtsecs() + * if a seconds value can be read, read it and return it (BCD), + * otherwise return 0xFF + * BIOS call "INT 1AH Function 02H" to check whether a character is pending + * Call with %ah = 0x2 + * Return: + * If RT Clock can give correct values + * %ch = hour (BCD) + * %cl = minutes (BCD) + * %dh = seconds (BCD) + * %dl = daylight savings time (00h std, 01h daylight) + * Carry flag = clear + * else + * Carry flag = set + * (this indicates that the clock is updating, or + * that it isn't running) + */ +ENTRY(getrtsecs) + push %ebp + + call EXT_C(prot_to_real) /* enter real mode */ + .code16 + + movb $0x2, %ah + int $0x1a + + DATA32 jnc gottime + movb $0xff, %dh + +gottime: + DATA32 call EXT_C(real_to_prot) + .code32 + + movb %dh, %al + + pop %ebp + ret + + +/* + * currticks() + * return the real time in ticks, of which there are about + * 18-20 per second + */ +ENTRY(currticks) + pushl %ebp + + call EXT_C(prot_to_real) /* enter real mode */ + .code16 + + /* %ax is already zero */ + int $0x1a + + DATA32 call EXT_C(real_to_prot) + .code32 + + movl %ecx, %eax + shll $16, %eax + movw %dx, %ax + + popl %ebp + ret + +ENTRY(amd64_rdmsr) + movl 4(%esp), %ecx + rdmsr + movl 8(%esp), %ecx + movl %eax, (%ecx) + movl %edx, 4(%ecx) + ret + +ENTRY(amd64_wrmsr) + movl 8(%esp), %ecx + movl (%ecx), %eax + movl 4(%ecx), %edx + movl 4(%esp), %ecx + wrmsr + ret + +ENTRY(amd64_cpuid_insn) + pushl %ebp + movl %esp, %ebp + pushl %ebx + pushl %esi + movl 0x8(%ebp), %eax + movl 0xc(%ebp), %esi + cpuid + movl %eax, 0x0(%esi) + movl %ebx, 0x4(%esi) + movl %ecx, 0x8(%esi) + movl %edx, 0xc(%esi) + popl %esi + popl %ebx + popl %ebp + ret + + /* + * Based on code from AMD64 Volume 3 + */ +ENTRY(amd64_cpuid_supported) + pushf + popl %eax + mov %eax, %edx /* save %eax for later */ + xorl %eax, 0x200000 /* toggle bit 21 */ + pushl %eax + popf /* save new %eax to EFLAGS */ + pushf /* save new EFLAGS */ + popl %ecx /* copy EFLAGS to %eax */ + xorl %eax, %eax + cmpl %ecx, %edx /* see if bit 21 has changes */ + jne 1f + incl %eax +1: + ret + +ENTRY(get_target_operating_mode) + pusha + + call EXT_C(prot_to_real) + .code16 + + movw $0xec00, %ax + movw $0x03, %bx + int $0x15 +/* XXX still need to pass back return */ + + movw %ax, %cx + + DATA32 call EXT_C(real_to_prot) + .code32 + + xorl %eax, %eax + movw %cx, %ax + + popa + ret + +#endif /* ! STAGE1_5 */ + +/* + * This is the area for all of the special variables. + */ + + .p2align 2 /* force 4-byte alignment */ + +protstack: + .long PROTSTACKINIT + +VARIABLE(boot_drive) +#ifdef SUPPORT_DISKLESS + .long NETWORK_DRIVE +#else + .long 0 +#endif + +VARIABLE(install_second_sector) + .long 0 + + /* an address can only be long-jumped to if it is in memory, this + is used by multiple routines */ +offset: + .long 0x8000 +segment: + .word 0 + +VARIABLE(apm_bios_info) + .word 0 /* version */ + .word 0 /* cseg */ + .long 0 /* offset */ + .word 0 /* cseg_16 */ + .word 0 /* dseg_16 */ + .word 0 /* cseg_len */ + .word 0 /* cseg_16_len */ + .word 0 /* dseg_16_len */ + +/* + * This is the Global Descriptor Table + * + * An entry, a "Segment Descriptor", looks like this: + * + * 31 24 19 16 7 0 + * ------------------------------------------------------------ + * | | |B| |A| | | |1|0|E|W|A| | + * | BASE 31..24 |G|/|0|V| LIMIT |P|DPL| TYPE | BASE 23:16 | + * | | |D| |L| 19..16| | |1|1|C|R|A| | + * ------------------------------------------------------------ + * | | | + * | BASE 15..0 | LIMIT 15..0 | + * | | | + * ------------------------------------------------------------ + * + * Note the ordering of the data items is reversed from the above + * description. + */ + + .p2align 2 /* force 4-byte alignment */ +gdt: + .word 0, 0 + .byte 0, 0, 0, 0 + + /* code segment */ + .word 0xFFFF, 0 + .byte 0, 0x9A, 0xCF, 0 + + /* data segment */ + .word 0xFFFF, 0 + .byte 0, 0x92, 0xCF, 0 + + /* 16 bit real mode CS */ + .word 0xFFFF, 0 + .byte 0, 0x9E, 0, 0 + + /* 16 bit real mode DS */ + .word 0xFFFF, 0 + .byte 0, 0x92, 0, 0 + + +/* this is the GDT descriptor */ +gdtdesc: + .word 0x27 /* limit */ + .long gdt /* addr */ diff --git a/usr/src/grub/grub-0.97/stage2/bios.c b/usr/src/grub/grub-0.97/stage2/bios.c new file mode 100644 index 0000000000..9756caa869 --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/bios.c @@ -0,0 +1,341 @@ +/* bios.c - implement C part of low-level BIOS disk input and output */ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2003,2004 Free Software Foundation, 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 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 "shared.h" + + +/* These are defined in asm.S, and never be used elsewhere, so declare the + prototypes here. */ +extern int biosdisk_int13_extensions (int ax, int drive, void *dap); +extern int biosdisk_standard (int ah, int drive, + int coff, int hoff, int soff, + int nsec, int segment); +extern int check_int13_extensions (int drive); +extern int get_diskinfo_standard (int drive, + unsigned long *cylinders, + unsigned long *heads, + unsigned long *sectors); +#if 0 +extern int get_diskinfo_floppy (int drive, + unsigned long *cylinders, + unsigned long *heads, + unsigned long *sectors); +#endif + + +/* Read/write NSEC sectors starting from SECTOR in DRIVE disk with GEOMETRY + from/into SEGMENT segment. If READ is BIOSDISK_READ, then read it, + else if READ is BIOSDISK_WRITE, then write it. If an geometry error + occurs, return BIOSDISK_ERROR_GEOMETRY, and if other error occurs, then + return the error number. Otherwise, return 0. */ +int +biosdisk (int read, int drive, struct geometry *geometry, + unsigned int sector, int nsec, int segment) +{ + + int err; + + if (geometry->flags & BIOSDISK_FLAG_LBA_EXTENSION) + { + struct disk_address_packet + { + unsigned char length; + unsigned char reserved; + unsigned short blocks; + unsigned long buffer; + unsigned long long block; + } __attribute__ ((packed)) dap; + + /* XXX: Don't check the geometry by default, because some buggy + BIOSes don't return the number of total sectors correctly, + even if they have working LBA support. Hell. */ +#ifdef NO_BUGGY_BIOS_IN_THE_WORLD + if (sector >= geometry->total_sectors) + return BIOSDISK_ERROR_GEOMETRY; +#endif /* NO_BUGGY_BIOS_IN_THE_WORLD */ + + /* FIXME: sizeof (DAP) must be 0x10. Should assert that the compiler + can't add any padding. */ + dap.length = sizeof (dap); + dap.block = sector; + dap.blocks = nsec; + dap.reserved = 0; + /* This is undocumented part. The address is formated in + SEGMENT:ADDRESS. */ + dap.buffer = segment << 16; + err = biosdisk_int13_extensions ((read + 0x42) << 8, drive, &dap); + /* + * Try to report errors upwards when the bios has read only part of + * the requested buffer, but didn't return an error code. + */ + if (err == 0 && dap.blocks != nsec) + err = BIOSDISK_ERROR_SHORT_IO; + +/* #undef NO_INT13_FALLBACK */ +#ifndef NO_INT13_FALLBACK + if (err) + { + if (geometry->flags & BIOSDISK_FLAG_CDROM) + return err; + + geometry->flags &= ~BIOSDISK_FLAG_LBA_EXTENSION; + geometry->total_sectors = (geometry->cylinders + * geometry->heads + * geometry->sectors); + return biosdisk (read, drive, geometry, sector, nsec, segment); + } +#endif /* ! NO_INT13_FALLBACK */ + + } + else + { + int cylinder_offset, head_offset, sector_offset; + int head; + /* SECTOR_OFFSET is counted from one, while HEAD_OFFSET and + CYLINDER_OFFSET are counted from zero. */ + sector_offset = sector % geometry->sectors + 1; + head = sector / geometry->sectors; + head_offset = head % geometry->heads; + cylinder_offset = head / geometry->heads; + + if (cylinder_offset >= geometry->cylinders) + return BIOSDISK_ERROR_GEOMETRY; + + err = biosdisk_standard (read + 0x02, drive, + cylinder_offset, head_offset, sector_offset, + nsec, segment); + } + + return err; +} + +/* Check bootable CD-ROM emulation status. */ +static int +get_cdinfo (int drive, struct geometry *geometry) +{ + int err; + struct iso_spec_packet + { + unsigned char size; + unsigned char media_type; + unsigned char drive_no; + unsigned char controller_no; + unsigned long image_lba; + unsigned short device_spec; + unsigned short cache_seg; + unsigned short load_seg; + unsigned short length_sec512; + unsigned char cylinders; + unsigned char sectors; + unsigned char heads; + + unsigned char dummy[16]; + } __attribute__ ((packed)) cdrp; + + grub_memset (&cdrp, 0, sizeof (cdrp)); + cdrp.size = sizeof (cdrp) - sizeof (cdrp.dummy); + err = biosdisk_int13_extensions (0x4B01, drive, &cdrp); + if (! err && cdrp.drive_no == drive) + { + if ((cdrp.media_type & 0x0F) == 0) + { + /* No emulation bootable CD-ROM */ + geometry->flags = BIOSDISK_FLAG_LBA_EXTENSION | BIOSDISK_FLAG_CDROM; + geometry->cylinders = 0; + geometry->heads = 1; + geometry->sectors = 15; + geometry->sector_size = 2048; + geometry->total_sectors = MAXINT; + return 1; + } + else + { + /* Floppy or hard-disk emulation */ + geometry->cylinders + = ((unsigned int) cdrp.cylinders + + (((unsigned int) (cdrp.sectors & 0xC0)) << 2)); + geometry->heads = cdrp.heads; + geometry->sectors = cdrp.sectors & 0x3F; + geometry->sector_size = SECTOR_SIZE; + geometry->total_sectors = (geometry->cylinders + * geometry->heads + * geometry->sectors); + return -1; + } + } + + /* + * If this is the boot_drive, default to non-emulation bootable CD-ROM. + * + * Some BIOS (Tecra S1) fails the int13 call above. If we return + * failure here, GRUB will run, but cannot see the boot drive, + * not a very good situation. Defaulting to non-emulation mode + * is a last-ditch effort. + */ + if (drive >= 0x88 && drive == boot_drive) + { + geometry->flags = BIOSDISK_FLAG_LBA_EXTENSION | BIOSDISK_FLAG_CDROM; + geometry->cylinders = 0; + geometry->heads = 1; + geometry->sectors = 15; + geometry->sector_size = 2048; + geometry->total_sectors = MAXINT; + return 1; + } + return 0; +} + +/* Return the geometry of DRIVE in GEOMETRY. If an error occurs, return + non-zero, otherwise zero. */ +int +get_diskinfo (int drive, struct geometry *geometry) +{ + int err; + + /* Clear the flags. */ + geometry->flags = 0; + + if (drive & 0x80) + { + /* hard disk or CD-ROM */ + int version; + unsigned long total_sectors = 0; + + version = check_int13_extensions (drive); + + if (drive >= 0x88 || version) + { + /* Possible CD-ROM - check the status. */ + if (get_cdinfo (drive, geometry)) + return 0; + } + + if (version) + { + struct drive_parameters + { + unsigned short size; + unsigned short flags; + unsigned long cylinders; + unsigned long heads; + unsigned long sectors; + unsigned long long total_sectors; + unsigned short bytes_per_sector; + /* ver 2.0 or higher */ + unsigned long EDD_configuration_parameters; + /* ver 3.0 or higher */ + unsigned short signature_dpi; + unsigned char length_dpi; + unsigned char reserved[3]; + unsigned char name_of_host_bus[4]; + unsigned char name_of_interface_type[8]; + unsigned char interface_path[8]; + unsigned char device_path[8]; + unsigned char reserved2; + unsigned char checksum; + + /* XXX: This is necessary, because the BIOS of Thinkpad X20 + writes a garbage to the tail of drive parameters, + regardless of a size specified in a caller. */ + unsigned char dummy[16]; + } __attribute__ ((packed)) drp; + + /* It is safe to clear out DRP. */ + grub_memset (&drp, 0, sizeof (drp)); + + /* PhoenixBIOS 4.0 Revision 6.0 for ZF Micro might understand + the greater buffer size for the "get drive parameters" int + 0x13 call in its own way. Supposedly the BIOS assumes even + bigger space is available and thus corrupts the stack. + This is why we specify the exactly necessary size of 0x42 + bytes. */ + drp.size = sizeof (drp) - sizeof (drp.dummy); + + err = biosdisk_int13_extensions (0x4800, drive, &drp); + if (! err) + { + /* Set the LBA flag. */ + geometry->flags = BIOSDISK_FLAG_LBA_EXTENSION; + + /* I'm not sure if GRUB should check the bit 1 of DRP.FLAGS, + so I omit the check for now. - okuji */ + /* if (drp.flags & (1 << 1)) */ + + /* FIXME: when the 2TB limit becomes critical, we must + change the type of TOTAL_SECTORS to unsigned long + long. */ + if (drp.total_sectors) + total_sectors = drp.total_sectors & ~0L; + else + /* Some buggy BIOSes doesn't return the total sectors + correctly but returns zero. So if it is zero, compute + it by C/H/S returned by the LBA BIOS call. */ + total_sectors = drp.cylinders * drp.heads * drp.sectors; + } + } + + /* Don't pass GEOMETRY directly, but pass each element instead, + so that we can change the structure easily. */ + err = get_diskinfo_standard (drive, + &geometry->cylinders, + &geometry->heads, + &geometry->sectors); + if (err) + return err; + + if (! total_sectors) + { + total_sectors = (geometry->cylinders + * geometry->heads + * geometry->sectors); + } + geometry->total_sectors = total_sectors; + geometry->sector_size = SECTOR_SIZE; + } + else + { + /* floppy disk */ + + /* First, try INT 13 AH=8h call. */ + err = get_diskinfo_standard (drive, + &geometry->cylinders, + &geometry->heads, + &geometry->sectors); + +#if 0 + /* If fails, then try floppy-specific probe routine. */ + if (err) + err = get_diskinfo_floppy (drive, + &geometry->cylinders, + &geometry->heads, + &geometry->sectors); +#endif + + if (err) + return err; + + geometry->total_sectors = (geometry->cylinders + * geometry->heads + * geometry->sectors); + geometry->sector_size = SECTOR_SIZE; + } + + return 0; +} diff --git a/usr/src/grub/grub-0.97/stage2/boot.c b/usr/src/grub/grub-0.97/stage2/boot.c new file mode 100644 index 0000000000..cfc2336a4c --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/boot.c @@ -0,0 +1,1030 @@ +/* boot.c - load and bootstrap a kernel */ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, 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 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 "shared.h" + +#include "freebsd.h" +#include "imgact_aout.h" +#include "i386-elf.h" + +static int cur_addr; +entry_func entry_addr; +static struct mod_list mll[99]; +static int linux_mem_size; + +/* + * The next two functions, 'load_image' and 'load_module', are the building + * blocks of the multiboot loader component. They handle essentially all + * of the gory details of loading in a bootable image and the modules. + */ + +kernel_t +load_image (char *kernel, char *arg, kernel_t suggested_type, + unsigned long load_flags) +{ + int len, i, exec_type = 0, align_4k = 1; + entry_func real_entry_addr = 0; + kernel_t type = KERNEL_TYPE_NONE; + unsigned long flags = 0, text_len = 0, data_len = 0, bss_len = 0; + char *str = 0, *str2 = 0; + struct linux_kernel_header *lh; + union + { + struct multiboot_header *mb; + struct exec *aout; + Elf32_Ehdr *elf; + } + pu; + /* presuming that MULTIBOOT_SEARCH is large enough to encompass an + executable header */ + unsigned char buffer[MULTIBOOT_SEARCH]; + + /* sets the header pointer to point to the beginning of the + buffer by default */ + pu.aout = (struct exec *) buffer; + + if (!grub_open (kernel)) + return KERNEL_TYPE_NONE; + + if (!(len = grub_read (buffer, MULTIBOOT_SEARCH)) || len < 32) + { + grub_close (); + + if (!errnum) + errnum = ERR_EXEC_FORMAT; + + return KERNEL_TYPE_NONE; + } + + for (i = 0; i < len; i++) + { + if (MULTIBOOT_FOUND ((int) (buffer + i), len - i)) + { + flags = ((struct multiboot_header *) (buffer + i))->flags; + if (flags & MULTIBOOT_UNSUPPORTED) + { + grub_close (); + errnum = ERR_BOOT_FEATURES; + return KERNEL_TYPE_NONE; + } + type = KERNEL_TYPE_MULTIBOOT; + str2 = "Multiboot"; + break; + } + } + + /* Use BUFFER as a linux kernel header, if the image is Linux zImage + or bzImage. */ + lh = (struct linux_kernel_header *) buffer; + + /* ELF loading supported if multiboot, FreeBSD and NetBSD. */ + if ((type == KERNEL_TYPE_MULTIBOOT + || pu.elf->e_ident[EI_OSABI] == ELFOSABI_FREEBSD + || grub_strcmp (pu.elf->e_ident + EI_BRAND, "FreeBSD") == 0 + || suggested_type == KERNEL_TYPE_NETBSD) + && len > sizeof (Elf32_Ehdr) + && BOOTABLE_I386_ELF ((*((Elf32_Ehdr *) buffer)))) + { + if (type == KERNEL_TYPE_MULTIBOOT) + entry_addr = (entry_func) pu.elf->e_entry; + else + entry_addr = (entry_func) (pu.elf->e_entry & 0xFFFFFF); + + if (entry_addr < (entry_func) 0x100000) + errnum = ERR_BELOW_1MB; + + /* don't want to deal with ELF program header at some random + place in the file -- this generally won't happen */ + if (pu.elf->e_phoff == 0 || pu.elf->e_phnum == 0 + || ((pu.elf->e_phoff + (pu.elf->e_phentsize * pu.elf->e_phnum)) + >= len)) + errnum = ERR_EXEC_FORMAT; + str = "elf"; + + if (type == KERNEL_TYPE_NONE) + { + /* At the moment, there is no way to identify a NetBSD ELF + kernel, so rely on the suggested type by the user. */ + if (suggested_type == KERNEL_TYPE_NETBSD) + { + str2 = "NetBSD"; + type = suggested_type; + } + else + { + str2 = "FreeBSD"; + type = KERNEL_TYPE_FREEBSD; + } + } + } + else if (flags & MULTIBOOT_AOUT_KLUDGE) + { + pu.mb = (struct multiboot_header *) (buffer + i); + entry_addr = (entry_func) pu.mb->entry_addr; + cur_addr = pu.mb->load_addr; + /* first offset into file */ + grub_seek (i - (pu.mb->header_addr - cur_addr)); + + /* If the load end address is zero, load the whole contents. */ + if (! pu.mb->load_end_addr) + pu.mb->load_end_addr = cur_addr + filemax; + + text_len = pu.mb->load_end_addr - cur_addr; + data_len = 0; + + /* If the bss end address is zero, assume that there is no bss area. */ + if (! pu.mb->bss_end_addr) + pu.mb->bss_end_addr = pu.mb->load_end_addr; + + bss_len = pu.mb->bss_end_addr - pu.mb->load_end_addr; + + if (pu.mb->header_addr < pu.mb->load_addr + || pu.mb->load_end_addr <= pu.mb->load_addr + || pu.mb->bss_end_addr < pu.mb->load_end_addr + || (pu.mb->header_addr - pu.mb->load_addr) > i) + errnum = ERR_EXEC_FORMAT; + + if (cur_addr < 0x100000) + errnum = ERR_BELOW_1MB; + + pu.aout = (struct exec *) buffer; + exec_type = 2; + str = "kludge"; + } + else if (len > sizeof (struct exec) && !N_BADMAG ((*(pu.aout)))) + { + entry_addr = (entry_func) pu.aout->a_entry; + + if (type == KERNEL_TYPE_NONE) + { + /* + * If it doesn't have a Multiboot header, then presume + * it is either a FreeBSD or NetBSD executable. If so, + * then use a magic number of normal ordering, ZMAGIC to + * determine if it is FreeBSD. + * + * This is all because freebsd and netbsd seem to require + * masking out some address bits... differently for each + * one... plus of course we need to know which booting + * method to use. + */ + entry_addr = (entry_func) ((int) entry_addr & 0xFFFFFF); + + if (buffer[0] == 0xb && buffer[1] == 1) + { + type = KERNEL_TYPE_FREEBSD; + cur_addr = (int) entry_addr; + str2 = "FreeBSD"; + } + else + { + type = KERNEL_TYPE_NETBSD; + cur_addr = (int) entry_addr & 0xF00000; + if (N_GETMAGIC ((*(pu.aout))) != NMAGIC) + align_4k = 0; + str2 = "NetBSD"; + } + } + + /* first offset into file */ + grub_seek (N_TXTOFF (*(pu.aout))); + text_len = pu.aout->a_text; + data_len = pu.aout->a_data; + bss_len = pu.aout->a_bss; + + if (cur_addr < 0x100000) + errnum = ERR_BELOW_1MB; + + exec_type = 1; + str = "a.out"; + } + else if (lh->boot_flag == BOOTSEC_SIGNATURE + && lh->setup_sects <= LINUX_MAX_SETUP_SECTS) + { + int big_linux = 0; + int setup_sects = lh->setup_sects; + + if (lh->header == LINUX_MAGIC_SIGNATURE && lh->version >= 0x0200) + { + big_linux = (lh->loadflags & LINUX_FLAG_BIG_KERNEL); + lh->type_of_loader = LINUX_BOOT_LOADER_TYPE; + + /* Put the real mode part at as a high location as possible. */ + linux_data_real_addr + = (char *) ((mbi.mem_lower << 10) - LINUX_SETUP_MOVE_SIZE); + /* But it must not exceed the traditional area. */ + if (linux_data_real_addr > (char *) LINUX_OLD_REAL_MODE_ADDR) + linux_data_real_addr = (char *) LINUX_OLD_REAL_MODE_ADDR; + + if (lh->version >= 0x0201) + { + lh->heap_end_ptr = LINUX_HEAP_END_OFFSET; + lh->loadflags |= LINUX_FLAG_CAN_USE_HEAP; + } + + if (lh->version >= 0x0202) + lh->cmd_line_ptr = linux_data_real_addr + LINUX_CL_OFFSET; + else + { + lh->cl_magic = LINUX_CL_MAGIC; + lh->cl_offset = LINUX_CL_OFFSET; + lh->setup_move_size = LINUX_SETUP_MOVE_SIZE; + } + } + else + { + /* Your kernel is quite old... */ + lh->cl_magic = LINUX_CL_MAGIC; + lh->cl_offset = LINUX_CL_OFFSET; + + setup_sects = LINUX_DEFAULT_SETUP_SECTS; + + linux_data_real_addr = (char *) LINUX_OLD_REAL_MODE_ADDR; + } + + /* If SETUP_SECTS is not set, set it to the default (4). */ + if (! setup_sects) + setup_sects = LINUX_DEFAULT_SETUP_SECTS; + + data_len = setup_sects << 9; + text_len = filemax - data_len - SECTOR_SIZE; + + linux_data_tmp_addr = (char *) LINUX_BZIMAGE_ADDR + text_len; + + if (! big_linux + && text_len > linux_data_real_addr - (char *) LINUX_ZIMAGE_ADDR) + { + grub_printf (" linux 'zImage' kernel too big, try 'make bzImage'\n"); + errnum = ERR_WONT_FIT; + } + else if (linux_data_real_addr + LINUX_SETUP_MOVE_SIZE + > RAW_ADDR ((char *) (mbi.mem_lower << 10))) + errnum = ERR_WONT_FIT; + else + { + grub_printf (" [Linux-%s, setup=0x%x, size=0x%x]\n", + (big_linux ? "bzImage" : "zImage"), data_len, text_len); + + /* Video mode selection support. What a mess! */ + /* NOTE: Even the word "mess" is not still enough to + represent how wrong and bad the Linux video support is, + but I don't want to hear complaints from Linux fanatics + any more. -okuji */ + { + char *vga; + + /* Find the substring "vga=". */ + vga = grub_strstr (arg, "vga="); + if (vga) + { + char *value = vga + 4; + int vid_mode; + + /* Handle special strings. */ + if (substring ("normal", value) < 1) + vid_mode = LINUX_VID_MODE_NORMAL; + else if (substring ("ext", value) < 1) + vid_mode = LINUX_VID_MODE_EXTENDED; + else if (substring ("ask", value) < 1) + vid_mode = LINUX_VID_MODE_ASK; + else if (safe_parse_maxint (&value, &vid_mode)) + ; + else + { + /* ERRNUM is already set inside the function + safe_parse_maxint. */ + grub_close (); + return KERNEL_TYPE_NONE; + } + + lh->vid_mode = vid_mode; + } + } + + /* Check the mem= option to limit memory used for initrd. */ + { + char *mem; + + mem = grub_strstr (arg, "mem="); + if (mem) + { + char *value = mem + 4; + + safe_parse_maxint (&value, &linux_mem_size); + switch (errnum) + { + case ERR_NUMBER_OVERFLOW: + /* If an overflow occurs, use the maximum address for + initrd instead. This is good, because MAXINT is + greater than LINUX_INITRD_MAX_ADDRESS. */ + linux_mem_size = LINUX_INITRD_MAX_ADDRESS; + errnum = ERR_NONE; + break; + + case ERR_NONE: + { + int shift = 0; + + switch (grub_tolower (*value)) + { + case 'g': + shift += 10; + case 'm': + shift += 10; + case 'k': + shift += 10; + default: + break; + } + + /* Check an overflow. */ + if (linux_mem_size > (MAXINT >> shift)) + linux_mem_size = LINUX_INITRD_MAX_ADDRESS; + else + linux_mem_size <<= shift; + } + break; + + default: + linux_mem_size = 0; + errnum = ERR_NONE; + break; + } + } + else + linux_mem_size = 0; + } + + /* It is possible that DATA_LEN + SECTOR_SIZE is greater than + MULTIBOOT_SEARCH, so the data may have been read partially. */ + if (data_len + SECTOR_SIZE <= MULTIBOOT_SEARCH) + grub_memmove (linux_data_tmp_addr, buffer, + data_len + SECTOR_SIZE); + else + { + grub_memmove (linux_data_tmp_addr, buffer, MULTIBOOT_SEARCH); + grub_read (linux_data_tmp_addr + MULTIBOOT_SEARCH, + data_len + SECTOR_SIZE - MULTIBOOT_SEARCH); + } + + if (lh->header != LINUX_MAGIC_SIGNATURE || + lh->version < 0x0200) + /* Clear the heap space. */ + grub_memset (linux_data_tmp_addr + ((setup_sects + 1) << 9), + 0, + (64 - setup_sects - 1) << 9); + + /* Copy command-line plus memory hack to staging area. + NOTE: Linux has a bug that it doesn't handle multiple spaces + between two options and a space after a "mem=" option isn't + removed correctly so the arguments to init could be like + {"init", "", "", NULL}. This affects some not-very-clever + shells. Thus, the code below does a trick to avoid the bug. + That is, copy "mem=XXX" to the end of the command-line, and + avoid to copy spaces unnecessarily. Hell. */ + { + char *src = skip_to (0, arg); + char *dest = linux_data_tmp_addr + LINUX_CL_OFFSET; + + while (dest < linux_data_tmp_addr + LINUX_CL_END_OFFSET && *src) + *(dest++) = *(src++); + + /* Old Linux kernels have problems determining the amount of + the available memory. To work around this problem, we add + the "mem" option to the kernel command line. This has its + own drawbacks because newer kernels can determine the + memory map more accurately. Boot protocol 2.03, which + appeared in Linux 2.4.18, provides a pointer to the kernel + version string, so we could check it. But since kernel + 2.4.18 and newer are known to detect memory reliably, boot + protocol 2.03 already implies that the kernel is new + enough. The "mem" option is added if neither of the + following conditions is met: + 1) The "mem" option is already present. + 2) The "kernel" command is used with "--no-mem-option". + 3) GNU GRUB is configured not to pass the "mem" option. + 4) The kernel supports boot protocol 2.03 or newer. */ + if (! grub_strstr (arg, "mem=") + && ! (load_flags & KERNEL_LOAD_NO_MEM_OPTION) + && lh->version < 0x0203 /* kernel version < 2.4.18 */ + && dest + 15 < linux_data_tmp_addr + LINUX_CL_END_OFFSET) + { + *dest++ = ' '; + *dest++ = 'm'; + *dest++ = 'e'; + *dest++ = 'm'; + *dest++ = '='; + + dest = convert_to_ascii (dest, 'u', (extended_memory + 0x400)); + *dest++ = 'K'; + } + + *dest = 0; + } + + /* offset into file */ + grub_seek (data_len + SECTOR_SIZE); + + cur_addr = (int) linux_data_tmp_addr + LINUX_SETUP_MOVE_SIZE; + grub_read ((char *) LINUX_BZIMAGE_ADDR, text_len); + + if (errnum == ERR_NONE) + { + grub_close (); + + /* Sanity check. */ + if (suggested_type != KERNEL_TYPE_NONE + && ((big_linux && suggested_type != KERNEL_TYPE_BIG_LINUX) + || (! big_linux && suggested_type != KERNEL_TYPE_LINUX))) + { + errnum = ERR_EXEC_FORMAT; + return KERNEL_TYPE_NONE; + } + + /* Ugly hack. */ + linux_text_len = text_len; + + return big_linux ? KERNEL_TYPE_BIG_LINUX : KERNEL_TYPE_LINUX; + } + } + } + else /* no recognizable format */ + errnum = ERR_EXEC_FORMAT; + + /* return if error */ + if (errnum) + { + grub_close (); + return KERNEL_TYPE_NONE; + } + + /* fill the multiboot info structure */ + mbi.cmdline = (int) arg; + mbi.mods_count = 0; + mbi.mods_addr = 0; + mbi.boot_device = (current_drive << 24) | current_partition; + mbi.flags &= ~(MB_INFO_MODS | MB_INFO_AOUT_SYMS | MB_INFO_ELF_SHDR); + mbi.syms.a.tabsize = 0; + mbi.syms.a.strsize = 0; + mbi.syms.a.addr = 0; + mbi.syms.a.pad = 0; + + printf (" [%s-%s", str2, str); + + str = ""; + + if (exec_type) /* can be loaded like a.out */ + { + if (flags & MULTIBOOT_AOUT_KLUDGE) + str = "-and-data"; + + printf (", loadaddr=0x%x, text%s=0x%x", cur_addr, str, text_len); + + /* read text, then read data */ + if (grub_read ((char *) RAW_ADDR (cur_addr), text_len) == text_len) + { + cur_addr += text_len; + + if (!(flags & MULTIBOOT_AOUT_KLUDGE)) + { + /* we have to align to a 4K boundary */ + if (align_4k) + cur_addr = (cur_addr + 0xFFF) & 0xFFFFF000; + else + printf (", C"); + + printf (", data=0x%x", data_len); + + if ((grub_read ((char *) RAW_ADDR (cur_addr), data_len) + != data_len) + && !errnum) + errnum = ERR_EXEC_FORMAT; + cur_addr += data_len; + } + + if (!errnum) + { + memset ((char *) RAW_ADDR (cur_addr), 0, bss_len); + cur_addr += bss_len; + + printf (", bss=0x%x", bss_len); + } + } + else if (!errnum) + errnum = ERR_EXEC_FORMAT; + + if (!errnum && pu.aout->a_syms + && pu.aout->a_syms < (filemax - filepos)) + { + int symtab_err, orig_addr = cur_addr; + + /* we should align to a 4K boundary here for good measure */ + if (align_4k) + cur_addr = (cur_addr + 0xFFF) & 0xFFFFF000; + + mbi.syms.a.addr = cur_addr; + + *((int *) RAW_ADDR (cur_addr)) = pu.aout->a_syms; + cur_addr += sizeof (int); + + printf (", symtab=0x%x", pu.aout->a_syms); + + if (grub_read ((char *) RAW_ADDR (cur_addr), pu.aout->a_syms) + == pu.aout->a_syms) + { + cur_addr += pu.aout->a_syms; + mbi.syms.a.tabsize = pu.aout->a_syms; + + if (grub_read ((char *) &i, sizeof (int)) == sizeof (int)) + { + *((int *) RAW_ADDR (cur_addr)) = i; + cur_addr += sizeof (int); + + mbi.syms.a.strsize = i; + + i -= sizeof (int); + + printf (", strtab=0x%x", i); + + symtab_err = (grub_read ((char *) RAW_ADDR (cur_addr), i) + != i); + cur_addr += i; + } + else + symtab_err = 1; + } + else + symtab_err = 1; + + if (symtab_err) + { + printf ("(bad)"); + cur_addr = orig_addr; + mbi.syms.a.tabsize = 0; + mbi.syms.a.strsize = 0; + mbi.syms.a.addr = 0; + } + else + mbi.flags |= MB_INFO_AOUT_SYMS; + } + } + else + /* ELF executable */ + { + unsigned loaded = 0, memaddr, memsiz, filesiz; + Elf32_Phdr *phdr; + + /* reset this to zero for now */ + cur_addr = 0; + + /* scan for program segments */ + for (i = 0; i < pu.elf->e_phnum; i++) + { + phdr = (Elf32_Phdr *) + (pu.elf->e_phoff + ((int) buffer) + + (pu.elf->e_phentsize * i)); + if (phdr->p_type == PT_LOAD) + { + /* offset into file */ + grub_seek (phdr->p_offset); + filesiz = phdr->p_filesz; + + if (type == KERNEL_TYPE_FREEBSD || type == KERNEL_TYPE_NETBSD) + memaddr = RAW_ADDR (phdr->p_paddr & 0xFFFFFF); + else + memaddr = RAW_ADDR (phdr->p_paddr); + + memsiz = phdr->p_memsz; + if (memaddr < RAW_ADDR (0x100000)) + errnum = ERR_BELOW_1MB; + + /* If the memory range contains the entry address, get the + physical address here. */ + if (type == KERNEL_TYPE_MULTIBOOT + && (unsigned) entry_addr >= phdr->p_vaddr + && (unsigned) entry_addr < phdr->p_vaddr + memsiz) + real_entry_addr = (entry_func) ((unsigned) entry_addr + + memaddr - phdr->p_vaddr); + + /* make sure we only load what we're supposed to! */ + if (filesiz > memsiz) + filesiz = memsiz; + /* mark memory as used */ + if (cur_addr < memaddr + memsiz) + cur_addr = memaddr + memsiz; + printf (", <0x%x:0x%x:0x%x>", memaddr, filesiz, + memsiz - filesiz); + /* increment number of segments */ + loaded++; + + /* load the segment */ + if (memcheck (memaddr, memsiz) + && grub_read ((char *) memaddr, filesiz) == filesiz) + { + if (memsiz > filesiz) + memset ((char *) (memaddr + filesiz), 0, memsiz - filesiz); + } + else + break; + } + } + + if (! errnum) + { + if (! loaded) + errnum = ERR_EXEC_FORMAT; + else + { + /* Load ELF symbols. */ + Elf32_Shdr *shdr = NULL; + int tab_size, sec_size; + int symtab_err = 0; + + mbi.syms.e.num = pu.elf->e_shnum; + mbi.syms.e.size = pu.elf->e_shentsize; + mbi.syms.e.shndx = pu.elf->e_shstrndx; + + /* We should align to a 4K boundary here for good measure. */ + if (align_4k) + cur_addr = (cur_addr + 0xFFF) & 0xFFFFF000; + + tab_size = pu.elf->e_shentsize * pu.elf->e_shnum; + + grub_seek (pu.elf->e_shoff); + /* + * Should not need to call RAW_ADDR; cur_addr is already + * adjusted to account for grub_scratch_mem. + * XXX Linux might calculate cur_addr differently. + */ + if (grub_read ((char *) (cur_addr), tab_size) + == tab_size) + { + mbi.syms.e.addr = cur_addr; + shdr = (Elf32_Shdr *) mbi.syms.e.addr; + cur_addr += tab_size; + + printf (", shtab=0x%x", cur_addr); + + for (i = 0; i < mbi.syms.e.num; i++) + { + /* This section is a loaded section, + so we don't care. */ + if (shdr[i].sh_addr != 0) + continue; + + /* This section is empty, so we don't care. */ + if (shdr[i].sh_size == 0) + continue; + + /* Align the section to a sh_addralign bits boundary. */ + cur_addr = ((cur_addr + shdr[i].sh_addralign) & + - (int) shdr[i].sh_addralign); + + grub_seek (shdr[i].sh_offset); + + sec_size = shdr[i].sh_size; + + /* + * Should not need to call RAW_ADDR; cur_addr is already + * adjusted to account for grub_scratch_mem. + * XXX Linux might calculate cur_addr differently. + */ + if (! (memcheck (cur_addr, sec_size) + && (grub_read ((char *) (cur_addr), + sec_size) + == sec_size))) + { + symtab_err = 1; + break; + } + + shdr[i].sh_addr = cur_addr; + cur_addr += sec_size; + } + } + else + symtab_err = 1; + + if (mbi.syms.e.addr < RAW_ADDR(0x10000)) + symtab_err = 1; + + if (symtab_err) + { + printf ("(bad)"); + mbi.syms.e.num = 0; + mbi.syms.e.size = 0; + mbi.syms.e.addr = 0; + mbi.syms.e.shndx = 0; + cur_addr = 0; + } + else + mbi.flags |= MB_INFO_ELF_SHDR; + } + } + } + + if (! errnum) + { + grub_printf (", entry=0x%x]\n", (unsigned) entry_addr); + + /* If the entry address is physically different from that of the ELF + header, correct it here. */ + if (real_entry_addr) + entry_addr = real_entry_addr; + } + else + { + putchar ('\n'); + type = KERNEL_TYPE_NONE; + } + + grub_close (); + + /* Sanity check. */ + if (suggested_type != KERNEL_TYPE_NONE && suggested_type != type) + { + errnum = ERR_EXEC_FORMAT; + return KERNEL_TYPE_NONE; + } + + return type; +} + +int +load_module (char *module, char *arg) +{ + int len; + + /* if we are supposed to load on 4K boundaries */ + cur_addr = (cur_addr + 0xFFF) & 0xFFFFF000; + + if (!grub_open (module)) + return 0; + + len = grub_read ((char *) cur_addr, -1); + if (! len) + { + grub_close (); + return 0; + } + + printf (" [Multiboot-module @ 0x%x, 0x%x bytes]\n", cur_addr, len); + + /* these two simply need to be set if any modules are loaded at all */ + mbi.flags |= MB_INFO_MODS; + mbi.mods_addr = (int) mll; + + mll[mbi.mods_count].cmdline = (int) arg; + mll[mbi.mods_count].mod_start = cur_addr; + cur_addr += len; + mll[mbi.mods_count].mod_end = cur_addr; + mll[mbi.mods_count].pad = 0; + + /* increment number of modules included */ + mbi.mods_count++; + + grub_close (); + return 1; +} + +int +load_initrd (char *initrd) +{ + int len; + unsigned long moveto; + unsigned long max_addr; + struct linux_kernel_header *lh + = (struct linux_kernel_header *) (cur_addr - LINUX_SETUP_MOVE_SIZE); + +#ifndef NO_DECOMPRESSION + no_decompression = 1; +#endif + + if (! grub_open (initrd)) + goto fail; + + len = grub_read ((char *) cur_addr, -1); + if (! len) + { + grub_close (); + goto fail; + } + + if (linux_mem_size) + moveto = linux_mem_size; + else + moveto = (mbi.mem_upper + 0x400) << 10; + + moveto = (moveto - len) & 0xfffff000; + max_addr = (lh->header == LINUX_MAGIC_SIGNATURE && lh->version >= 0x0203 + ? lh->initrd_addr_max : LINUX_INITRD_MAX_ADDRESS); + if (moveto + len >= max_addr) + moveto = (max_addr - len) & 0xfffff000; + + /* XXX: Linux 2.3.xx has a bug in the memory range check, so avoid + the last page. + XXX: Linux 2.2.xx has a bug in the memory range check, which is + worse than that of Linux 2.3.xx, so avoid the last 64kb. *sigh* */ + moveto -= 0x10000; + memmove ((void *) RAW_ADDR (moveto), (void *) cur_addr, len); + + printf (" [Linux-initrd @ 0x%x, 0x%x bytes]\n", moveto, len); + + /* FIXME: Should check if the kernel supports INITRD. */ + lh->ramdisk_image = RAW_ADDR (moveto); + lh->ramdisk_size = len; + + grub_close (); + + fail: + +#ifndef NO_DECOMPRESSION + no_decompression = 0; +#endif + + return ! errnum; +} + + +#ifdef GRUB_UTIL +/* Dummy function to fake the *BSD boot. */ +static void +bsd_boot_entry (int flags, int bootdev, int sym_start, int sym_end, + int mem_upper, int mem_lower) +{ + stop (); +} +#endif + + +/* + * All "*_boot" commands depend on the images being loaded into memory + * correctly, the variables in this file being set up correctly, and + * the root partition being set in the 'saved_drive' and 'saved_partition' + * variables. + */ + + +void +bsd_boot (kernel_t type, int bootdev, char *arg) +{ + char *str; + int clval = 0, i; + struct bootinfo bi; + +#ifdef GRUB_UTIL + entry_addr = (entry_func) bsd_boot_entry; +#else + stop_floppy (); +#endif + + while (*(++arg) && *arg != ' '); + str = arg; + while (*str) + { + if (*str == '-') + { + while (*str && *str != ' ') + { + if (*str == 'C') + clval |= RB_CDROM; + if (*str == 'a') + clval |= RB_ASKNAME; + if (*str == 'b') + clval |= RB_HALT; + if (*str == 'c') + clval |= RB_CONFIG; + if (*str == 'd') + clval |= RB_KDB; + if (*str == 'D') + clval |= RB_MULTIPLE; + if (*str == 'g') + clval |= RB_GDB; + if (*str == 'h') + clval |= RB_SERIAL; + if (*str == 'm') + clval |= RB_MUTE; + if (*str == 'r') + clval |= RB_DFLTROOT; + if (*str == 's') + clval |= RB_SINGLE; + if (*str == 'v') + clval |= RB_VERBOSE; + str++; + } + continue; + } + str++; + } + + if (type == KERNEL_TYPE_FREEBSD) + { + clval |= RB_BOOTINFO; + + bi.bi_version = BOOTINFO_VERSION; + + *arg = 0; + while ((--arg) > (char *) MB_CMDLINE_BUF && *arg != '/'); + if (*arg == '/') + bi.bi_kernelname = arg + 1; + else + bi.bi_kernelname = 0; + + bi.bi_nfs_diskless = 0; + bi.bi_n_bios_used = 0; /* this field is apparently unused */ + + for (i = 0; i < N_BIOS_GEOM; i++) + { + struct geometry geom; + + /* XXX Should check the return value. */ + get_diskinfo (i + 0x80, &geom); + /* FIXME: If HEADS or SECTORS is greater than 255, then this will + break the geometry information. That is a drawback of BSD + but not of GRUB. */ + bi.bi_bios_geom[i] = (((geom.cylinders - 1) << 16) + + (((geom.heads - 1) & 0xff) << 8) + + (geom.sectors & 0xff)); + } + + bi.bi_size = sizeof (struct bootinfo); + bi.bi_memsizes_valid = 1; + bi.bi_bios_dev = saved_drive; + bi.bi_basemem = mbi.mem_lower; + bi.bi_extmem = extended_memory; + + if (mbi.flags & MB_INFO_AOUT_SYMS) + { + bi.bi_symtab = mbi.syms.a.addr; + bi.bi_esymtab = mbi.syms.a.addr + 4 + + mbi.syms.a.tabsize + mbi.syms.a.strsize; + } +#if 0 + else if (mbi.flags & MB_INFO_ELF_SHDR) + { + /* FIXME: Should check if a symbol table exists and, if exists, + pass the table to BI. */ + } +#endif + else + { + bi.bi_symtab = 0; + bi.bi_esymtab = 0; + } + + /* call entry point */ + (*entry_addr) (clval, bootdev, 0, 0, 0, ((int) (&bi))); + } + else + { + /* + * We now pass the various bootstrap parameters to the loaded + * image via the argument list. + * + * This is the official list: + * + * arg0 = 8 (magic) + * arg1 = boot flags + * arg2 = boot device + * arg3 = start of symbol table (0 if not loaded) + * arg4 = end of symbol table (0 if not loaded) + * arg5 = transfer address from image + * arg6 = transfer address for next image pointer + * arg7 = conventional memory size (640) + * arg8 = extended memory size (8196) + * + * ...in actuality, we just pass the parameters used by the kernel. + */ + + /* call entry point */ + unsigned long end_mark; + + if (mbi.flags & MB_INFO_AOUT_SYMS) + end_mark = (mbi.syms.a.addr + 4 + + mbi.syms.a.tabsize + mbi.syms.a.strsize); + else + /* FIXME: it should be mbi.syms.e.size. */ + end_mark = 0; + + (*entry_addr) (clval, bootdev, 0, end_mark, + extended_memory, mbi.mem_lower); + } +} diff --git a/usr/src/grub/grub-0.97/stage2/builtins.c b/usr/src/grub/grub-0.97/stage2/builtins.c new file mode 100644 index 0000000000..28d9765dc2 --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/builtins.c @@ -0,0 +1,5875 @@ +/* builtins.c - the GRUB builtin commands */ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, 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 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. + */ + +/* + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Include stdio.h before shared.h, because we can't define + WITHOUT_LIBC_STUBS here. */ +#ifdef GRUB_UTIL +# include +#endif + +#include +#include +#include + +#ifdef SUPPORT_NETBOOT +# include +#endif + +#ifdef SUPPORT_SERIAL +# include +# include +#endif + +#ifdef GRUB_UTIL +# include +#else /* ! GRUB_UTIL */ +# include +# include +#endif /* ! GRUB_UTIL */ + +#ifdef USE_MD5_PASSWORDS +# include +#endif + +#include + +/* The type of kernel loaded. */ +kernel_t kernel_type; +/* The boot device. */ +static int bootdev; +/* True when the debug mode is turned on, and false + when it is turned off. */ +int debug = 0; +/* The default entry. */ +int default_entry = 0; +/* The fallback entry. */ +int fallback_entryno; +int fallback_entries[MAX_FALLBACK_ENTRIES]; +/* The number of current entry. */ +int current_entryno; +/* The address for Multiboot command-line buffer. */ +static char *mb_cmdline; +/* The password. */ +char *password; +/* The password type. */ +password_t password_type; +/* The flag for indicating that the user is authoritative. */ +int auth = 0; +/* The timeout. */ +int grub_timeout = -1; +/* Whether to show the menu or not. */ +int show_menu = 1; +/* The BIOS drive map. */ +static unsigned short bios_drive_map[DRIVE_MAP_SIZE + 1]; + +/* Prototypes for allowing straightfoward calling of builtins functions + inside other functions. */ +static int configfile_func (char *arg, int flags); +#ifdef SUPPORT_NETBOOT +static void solaris_config_file (void); +#endif + +static unsigned int min_mem64 = 0; + +#if defined(__sun) && !defined(GRUB_UTIL) +extern void __enable_execute_stack (void *); +void +__enable_execute_stack (void *addr) +{ +} +#endif /* __sun && !GRUB_UTIL */ + +/* Initialize the data for builtins. */ +void +init_builtins (void) +{ + kernel_type = KERNEL_TYPE_NONE; + /* BSD and chainloading evil hacks! */ + bootdev = set_bootdev (0); + mb_cmdline = (char *) MB_CMDLINE_BUF; +} + +/* Initialize the data for the configuration file. */ +void +init_config (void) +{ + default_entry = 0; + password = 0; + fallback_entryno = -1; + fallback_entries[0] = -1; + grub_timeout = -1; + current_rootpool[0] = '\0'; + current_bootfs[0] = '\0'; + current_bootpath[0] = '\0'; + current_bootfs_obj = 0; + current_devid[0] = '\0'; + is_zfs_mount = 0; +} + +/* Check a password for correctness. Returns 0 if password was + correct, and a value != 0 for error, similarly to strcmp. */ +int +check_password (char *entered, char* expected, password_t type) +{ + switch (type) + { + case PASSWORD_PLAIN: + return strcmp (entered, expected); + +#ifdef USE_MD5_PASSWORDS + case PASSWORD_MD5: + return check_md5_password (entered, expected); +#endif + default: + /* unsupported password type: be secure */ + return 1; + } +} + +/* Print which sector is read when loading a file. */ +static void +disk_read_print_func(unsigned int sector, int offset, int length) +{ + grub_printf ("[%u,%d,%d]", sector, offset, length); +} + + +/* blocklist */ +static int +blocklist_func (char *arg, int flags) +{ + char *dummy = (char *) RAW_ADDR (0x100000); + unsigned int start_sector = 0; + int num_sectors = 0; + int num_entries = 0; + int last_length = 0; + + auto void disk_read_blocklist_func (unsigned int sector, int offset, + int length); + + /* Collect contiguous blocks into one entry as many as possible, + and print the blocklist notation on the screen. */ + auto void disk_read_blocklist_func (unsigned int sector, int offset, + int length) + { + if (num_sectors > 0) + { + if (start_sector + num_sectors == sector + && offset == 0 && last_length == SECTOR_SIZE) + { + num_sectors++; + last_length = length; + return; + } + else + { + if (last_length == SECTOR_SIZE) + grub_printf ("%s%d+%d", num_entries ? "," : "", + start_sector - part_start, num_sectors); + else if (num_sectors > 1) + grub_printf ("%s%d+%d,%d[0-%d]", num_entries ? "," : "", + start_sector - part_start, num_sectors-1, + start_sector + num_sectors-1 - part_start, + last_length); + else + grub_printf ("%s%d[0-%d]", num_entries ? "," : "", + start_sector - part_start, last_length); + num_entries++; + num_sectors = 0; + } + } + + if (offset > 0) + { + grub_printf("%s%u[%d-%d]", num_entries ? "," : "", + sector-part_start, offset, offset+length); + num_entries++; + } + else + { + start_sector = sector; + num_sectors = 1; + last_length = length; + } + } + + /* Open the file. */ + if (! grub_open (arg)) + return 1; + + /* Print the device name. */ + grub_printf ("(%cd%d", + (current_drive & 0x80) ? 'h' : 'f', + current_drive & ~0x80); + + if ((current_partition & 0xFF0000) != 0xFF0000) + grub_printf (",%d", (current_partition >> 16) & 0xFF); + + if ((current_partition & 0x00FF00) != 0x00FF00) + grub_printf (",%c", 'a' + ((current_partition >> 8) & 0xFF)); + + grub_printf (")"); + + /* Read in the whole file to DUMMY. */ + disk_read_hook = disk_read_blocklist_func; + if (! grub_read (dummy, -1)) + goto fail; + + /* The last entry may not be printed yet. Don't check if it is a + * full sector, since it doesn't matter if we read too much. */ + if (num_sectors > 0) + grub_printf ("%s%d+%d", num_entries ? "," : "", + start_sector - part_start, num_sectors); + + grub_printf ("\n"); + + fail: + disk_read_hook = 0; + grub_close (); + return errnum; +} + +static struct builtin builtin_blocklist = +{ + "blocklist", + blocklist_func, + BUILTIN_CMDLINE | BUILTIN_HELP_LIST, + "blocklist FILE", + "Print the blocklist notation of the file FILE." +}; + +/* boot */ +static int +boot_func (char *arg, int flags) +{ + /* Clear the int15 handler if we can boot the kernel successfully. + This assumes that the boot code never fails only if KERNEL_TYPE is + not KERNEL_TYPE_NONE. Is this assumption is bad? */ + if (kernel_type != KERNEL_TYPE_NONE) + unset_int15_handler (); + +#ifdef SUPPORT_NETBOOT + /* Shut down the networking. */ + cleanup_net (); +#endif + + switch (kernel_type) + { + case KERNEL_TYPE_FREEBSD: + case KERNEL_TYPE_NETBSD: + /* *BSD */ + bsd_boot (kernel_type, bootdev, (char *) mbi.cmdline); + break; + + case KERNEL_TYPE_LINUX: + /* Linux */ + linux_boot (); + break; + + case KERNEL_TYPE_BIG_LINUX: + /* Big Linux */ + big_linux_boot (); + break; + + case KERNEL_TYPE_CHAINLOADER: + /* Chainloader */ + + /* Check if we should set the int13 handler. */ + if (bios_drive_map[0] != 0) + { + int i; + + /* Search for SAVED_DRIVE. */ + for (i = 0; i < DRIVE_MAP_SIZE; i++) + { + if (! bios_drive_map[i]) + break; + else if ((bios_drive_map[i] & 0xFF) == saved_drive) + { + /* Exchage SAVED_DRIVE with the mapped drive. */ + saved_drive = (bios_drive_map[i] >> 8) & 0xFF; + break; + } + } + + /* Set the handler. This is somewhat dangerous. */ + set_int13_handler (bios_drive_map); + } + + gateA20 (0); + boot_drive = saved_drive; + chain_stage1 (0, BOOTSEC_LOCATION, boot_part_addr); + break; + + case KERNEL_TYPE_MULTIBOOT: + /* Multiboot */ +#ifdef SUPPORT_NETBOOT +#ifdef SOLARIS_NETBOOT + if (current_drive == NETWORK_DRIVE) { + /* + * XXX Solaris hack: use drive_info to pass network information + * Turn off the flag bit to the loader is technically + * multiboot compliant. + */ + mbi.flags &= ~MB_INFO_DRIVE_INFO; + mbi.drives_length = dhcpack_length; + mbi.drives_addr = dhcpack_buf; + } +#endif /* SOLARIS_NETBOOT */ +#endif + multi_boot ((int) entry_addr, (int) &mbi); + break; + + default: + errnum = ERR_BOOT_COMMAND; + return 1; + } + + return 0; +} + +static struct builtin builtin_boot = +{ + "boot", + boot_func, + BUILTIN_CMDLINE | BUILTIN_HELP_LIST, + "boot", + "Boot the OS/chain-loader which has been loaded." +}; + + +#ifdef SUPPORT_NETBOOT +/* bootp */ +static int +bootp_func (char *arg, int flags) +{ + int with_configfile = 0; + + if (grub_memcmp (arg, "--with-configfile", sizeof ("--with-configfile") - 1) + == 0) + { + with_configfile = 1; + arg = skip_to (0, arg); + } + + if (! bootp ()) + { + if (errnum == ERR_NONE) + errnum = ERR_DEV_VALUES; + + return 1; + } + + /* Notify the configuration. */ + print_network_configuration (); + + /* XXX: this can cause an endless loop, but there is no easy way to + detect such a loop unfortunately. */ + if (with_configfile) + configfile_func (config_file, flags); + + return 0; +} + +static struct builtin builtin_bootp = +{ + "bootp", + bootp_func, + BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_HELP_LIST, + "bootp [--with-configfile]", + "Initialize a network device via BOOTP. If the option `--with-configfile'" + " is given, try to load a configuration file specified by the 150 vendor" + " tag." +}; +#endif /* SUPPORT_NETBOOT */ + + +/* cat */ +static int +cat_func (char *arg, int flags) +{ + char c; + + if (! grub_open (arg)) + return 1; + + while (grub_read (&c, 1)) + { + /* Because running "cat" with a binary file can confuse the terminal, + print only some characters as they are. */ + if (grub_isspace (c) || (c >= ' ' && c <= '~')) + grub_putchar (c); + else + grub_putchar ('?'); + } + + grub_close (); + return 0; +} + +static struct builtin builtin_cat = +{ + "cat", + cat_func, + BUILTIN_CMDLINE | BUILTIN_HELP_LIST, + "cat FILE", + "Print the contents of the file FILE." +}; + + +/* chainloader */ +static int +chainloader_func (char *arg, int flags) +{ + int force = 0; + char *file = arg; + + /* If the option `--force' is specified? */ + if (substring ("--force", arg) <= 0) + { + force = 1; + file = skip_to (0, arg); + } + + /* Open the file. */ + if (! grub_open (file)) + { + kernel_type = KERNEL_TYPE_NONE; + return 1; + } + + /* Read the first block. */ + if (grub_read ((char *) BOOTSEC_LOCATION, SECTOR_SIZE) != SECTOR_SIZE) + { + grub_close (); + kernel_type = KERNEL_TYPE_NONE; + + /* This below happens, if a file whose size is less than 512 bytes + is loaded. */ + if (errnum == ERR_NONE) + errnum = ERR_EXEC_FORMAT; + + return 1; + } + + /* If not loading it forcibly, check for the signature. */ + if (! force + && (*((unsigned short *) (BOOTSEC_LOCATION + BOOTSEC_SIG_OFFSET)) + != BOOTSEC_SIGNATURE)) + { + grub_close (); + errnum = ERR_EXEC_FORMAT; + kernel_type = KERNEL_TYPE_NONE; + return 1; + } + + grub_close (); + kernel_type = KERNEL_TYPE_CHAINLOADER; + + /* XXX: Windows evil hack. For now, only the first five letters are + checked. */ + if (IS_PC_SLICE_TYPE_FAT (current_slice) + && ! grub_memcmp ((char *) BOOTSEC_LOCATION + BOOTSEC_BPB_SYSTEM_ID, + "MSWIN", 5)) + *((unsigned long *) (BOOTSEC_LOCATION + BOOTSEC_BPB_HIDDEN_SECTORS)) + = part_start; + + errnum = ERR_NONE; + + return 0; +} + +static struct builtin builtin_chainloader = +{ + "chainloader", + chainloader_func, + BUILTIN_CMDLINE | BUILTIN_HELP_LIST, + "chainloader [--force] FILE", + "Load the chain-loader FILE. If --force is specified, then load it" + " forcibly, whether the boot loader signature is present or not." +}; + + +/* This function could be used to debug new filesystem code. Put a file + in the new filesystem and the same file in a well-tested filesystem. + Then, run "cmp" with the files. If no output is obtained, probably + the code is good, otherwise investigate what's wrong... */ +/* cmp FILE1 FILE2 */ +static int +cmp_func (char *arg, int flags) +{ + /* The filenames. */ + char *file1, *file2; + /* The addresses. */ + char *addr1, *addr2; + int i; + /* The size of the file. */ + int size; + + /* Get the filenames from ARG. */ + file1 = arg; + file2 = skip_to (0, arg); + if (! *file1 || ! *file2) + { + errnum = ERR_BAD_ARGUMENT; + return 1; + } + + /* Terminate the filenames for convenience. */ + nul_terminate (file1); + nul_terminate (file2); + + /* Read the whole data from FILE1. */ + addr1 = (char *) RAW_ADDR (0x100000); + if (! grub_open (file1)) + return 1; + + /* Get the size. */ + size = filemax; + if (grub_read (addr1, -1) != size) + { + grub_close (); + return 1; + } + + grub_close (); + + /* Read the whole data from FILE2. */ + addr2 = addr1 + size; + if (! grub_open (file2)) + return 1; + + /* Check if the size of FILE2 is equal to the one of FILE2. */ + if (size != filemax) + { + grub_printf ("Differ in size: 0x%x [%s], 0x%x [%s]\n", + size, file1, filemax, file2); + grub_close (); + return 0; + } + + if (! grub_read (addr2, -1)) + { + grub_close (); + return 1; + } + + grub_close (); + + /* Now compare ADDR1 with ADDR2. */ + for (i = 0; i < size; i++) + { + if (addr1[i] != addr2[i]) + grub_printf ("Differ at the offset %d: 0x%x [%s], 0x%x [%s]\n", + i, (unsigned) addr1[i], file1, + (unsigned) addr2[i], file2); + } + + return 0; +} + +static struct builtin builtin_cmp = +{ + "cmp", + cmp_func, + BUILTIN_CMDLINE, + "cmp FILE1 FILE2", + "Compare the file FILE1 with the FILE2 and inform the different values" + " if any." +}; + + +/* color */ +/* Set new colors used for the menu interface. Support two methods to + specify a color name: a direct integer representation and a symbolic + color name. An example of the latter is "blink-light-gray/blue". */ +static int +color_func (char *arg, int flags) +{ + char *normal; + char *highlight; + int new_normal_color; + int new_highlight_color; + static char *color_list[16] = + { + "black", + "blue", + "green", + "cyan", + "red", + "magenta", + "brown", + "light-gray", + "dark-gray", + "light-blue", + "light-green", + "light-cyan", + "light-red", + "light-magenta", + "yellow", + "white" + }; + + auto int color_number (char *str); + + /* Convert the color name STR into the magical number. */ + auto int color_number (char *str) + { + char *ptr; + int i; + int color = 0; + + /* Find the separator. */ + for (ptr = str; *ptr && *ptr != '/'; ptr++) + ; + + /* If not found, return -1. */ + if (! *ptr) + return -1; + + /* Terminate the string STR. */ + *ptr++ = 0; + + /* If STR contains the prefix "blink-", then set the `blink' bit + in COLOR. */ + if (substring ("blink-", str) <= 0) + { + color = 0x80; + str += 6; + } + + /* Search for the color name. */ + for (i = 0; i < 16; i++) + if (grub_strcmp (color_list[i], str) == 0) + { + color |= i; + break; + } + + if (i == 16) + return -1; + + str = ptr; + nul_terminate (str); + + /* Search for the color name. */ + for (i = 0; i < 8; i++) + if (grub_strcmp (color_list[i], str) == 0) + { + color |= i << 4; + break; + } + + if (i == 8) + return -1; + + return color; + } + + normal = arg; + highlight = skip_to (0, arg); + + new_normal_color = color_number (normal); + if (new_normal_color < 0 && ! safe_parse_maxint (&normal, &new_normal_color)) + return 1; + + /* The second argument is optional, so set highlight_color + to inverted NORMAL_COLOR. */ + if (! *highlight) + new_highlight_color = ((new_normal_color >> 4) + | ((new_normal_color & 0xf) << 4)); + else + { + new_highlight_color = color_number (highlight); + if (new_highlight_color < 0 + && ! safe_parse_maxint (&highlight, &new_highlight_color)) + return 1; + } + + if (current_term->setcolor) + current_term->setcolor (new_normal_color, new_highlight_color); + + return 0; +} + +static struct builtin builtin_color = +{ + "color", + color_func, + BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_HELP_LIST, + "color NORMAL [HIGHLIGHT]", + "Change the menu colors. The color NORMAL is used for most" + " lines in the menu, and the color HIGHLIGHT is used to highlight the" + " line where the cursor points. If you omit HIGHLIGHT, then the" + " inverted color of NORMAL is used for the highlighted line." + " The format of a color is \"FG/BG\". FG and BG are symbolic color names." + " A symbolic color name must be one of these: black, blue, green," + " cyan, red, magenta, brown, light-gray, dark-gray, light-blue," + " light-green, light-cyan, light-red, light-magenta, yellow and white." + " But only the first eight names can be used for BG. You can prefix" + " \"blink-\" to FG if you want a blinking foreground color." +}; + + +/* configfile */ +static int +configfile_func (char *arg, int flags) +{ + char *new_config = config_file; + + /* Check if the file ARG is present. */ + if (! grub_open (arg)) + return 1; + + grub_close (); + + /* Copy ARG to CONFIG_FILE. */ + while ((*new_config++ = *arg++) != 0) + ; + +#ifdef GRUB_UTIL + /* Force to load the configuration file. */ + use_config_file = 1; +#endif + + /* Make sure that the user will not be authoritative. */ + auth = 0; + + /* Restart cmain. */ + grub_longjmp (restart_env, 0); + + /* Never reach here. */ + return 0; +} + +static struct builtin builtin_configfile = +{ + "configfile", + configfile_func, + BUILTIN_CMDLINE | BUILTIN_HELP_LIST, + "configfile FILE", + "Load FILE as the configuration file." +}; + + +/* debug */ +static int +debug_func (char *arg, int flags) +{ + if (debug) + { + debug = 0; + grub_printf (" Debug mode is turned off\n"); + } + else + { + debug = 1; + grub_printf (" Debug mode is turned on\n"); + } + + return 0; +} + +static struct builtin builtin_debug = +{ + "debug", + debug_func, + BUILTIN_CMDLINE, + "debug", + "Turn on/off the debug mode." +}; + + +/* default */ +static int +default_func (char *arg, int flags) +{ +#ifndef SUPPORT_DISKLESS + if (grub_strcmp (arg, "saved") == 0) + { + default_entry = saved_entryno; + return 0; + } +#endif /* SUPPORT_DISKLESS */ + + if (! safe_parse_maxint (&arg, &default_entry)) + return 1; + + return 0; +} + +static struct builtin builtin_default = +{ + "default", + default_func, + BUILTIN_MENU, +#if 0 + "default [NUM | `saved']", + "Set the default entry to entry number NUM (if not specified, it is" + " 0, the first entry) or the entry number saved by savedefault." +#endif +}; + + +#ifdef GRUB_UTIL +/* device */ +static int +device_func (char *arg, int flags) +{ + char *drive = arg; + char *device; + + /* Get the drive number from DRIVE. */ + if (! set_device (drive)) + return 1; + + /* Get the device argument. */ + device = skip_to (0, drive); + + /* Terminate DEVICE. */ + nul_terminate (device); + + if (! *device || ! check_device (device)) + { + errnum = ERR_FILE_NOT_FOUND; + return 1; + } + + assign_device_name (current_drive, device); + + return 0; +} + +static struct builtin builtin_device = +{ + "device", + device_func, + BUILTIN_MENU | BUILTIN_CMDLINE | BUILTIN_HELP_LIST, + "device DRIVE DEVICE", + "Specify DEVICE as the actual drive for a BIOS drive DRIVE. This command" + " can be used only in the grub shell." +}; +#endif /* GRUB_UTIL */ + +#ifdef SUPPORT_NETBOOT +/* Debug Function for RPC */ +#ifdef RPC_DEBUG +/* portmap */ +static int +portmap_func (char *arg, int flags) +{ + int port, prog, ver; + if (! grub_eth_probe ()){ + grub_printf ("No ethernet card found.\n"); + errnum = ERR_DEV_VALUES; + return 1; + } + if ((prog = getdec(&arg)) == -1){ + grub_printf("Error prog number\n"); + return 1; + } + arg = skip_to (0, arg); + if ((ver = getdec(&arg)) == -1){ + grub_printf("Error ver number\n"); + return 1; + } + port = __pmapudp_getport(ARP_SERVER, prog, ver); + printf("portmap getport %d", port); + return 0; +} + +static struct builtin builtin_portmap = +{ + "portmap", + portmap_func, + BUILTIN_CMDLINE | BUILTIN_HELP_LIST, + "portmap prog_number vers_number", + "Do portmap with the prog_number and vers_number" +}; +#endif /* RPC_DEBUG */ + +/* dhcp */ +static int +dhcp_func (char *arg, int flags) +{ + int with_configfile = 0; + + if (grub_memcmp (arg, "--with-configfile", sizeof ("--with-configfile") - 1) + == 0) + { + with_configfile = 1; + arg = skip_to (0, arg); + } + + if (! dhcp ()) + { + if (errnum == ERR_NONE) + errnum = ERR_DEV_VALUES; + + return 1; + } + + /* Notify the configuration. */ + print_network_configuration (); + + /* XXX: this can cause an endless loop, but there is no easy way to + detect such a loop unfortunately. */ + if (with_configfile) + configfile_func (config_file, flags); + else + solaris_config_file(); + + return 0; +} + +static void solaris_config_file (void) +{ + static char menufile[64]; + static char hexdigit[] = "0123456789ABCDEF"; + char *c = menufile; + int i; + int err; + + /* if config_file is from DHCP option 150, keep the setting */ + if (grub_strcmp(config_file, "/boot/grub/menu.lst") != 0) + return; + + /* default solaris configfile name menu.lst.01 */ + grub_strcpy(c, "menu.lst.01"); + c += grub_strlen(c); + for (i = 0; i < ETH_ALEN; i++) { + unsigned char b = arptable[ARP_CLIENT].node[i]; + *c++ = hexdigit[b >> 4]; + *c++ = hexdigit[b & 0xf]; + } + *c = 0; + + /* + * If the file exists, make it the default. Else, fallback + * to what it was. Make sure we don't change errnum in the + * process. + */ + err = errnum; + if (grub_open(menufile)) { + grub_strcpy(config_file, menufile); + grub_close(); + } else { + char *cp = config_file; + /* skip leading slashes for tftp */ + while (*cp == '/') + ++cp; + grub_memmove (config_file, cp, strlen(cp) + 1); + } + errnum = err; +} + +static struct builtin builtin_dhcp = +{ + "dhcp", + dhcp_func, + BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_HELP_LIST, + "dhcp", + "Initialize a network device via DHCP." +}; +#endif /* SUPPORT_NETBOOT */ + +static int terminal_func (char *arg, int flags); + +static int verbose_func(char *arg, int flags) { + + if (grub_strcmp(arg, "off") == 0) { + silent.status = DEFER_SILENT; + return; + } else + if (flags == BUILTIN_CMDLINE) { + silent.status = DEFER_VERBOSE; + return; + } + + silent.status = VERBOSE; + + /* get back to text console */ + if (current_term->shutdown) { + (*current_term->shutdown)(); + current_term = term_table; /* assumption: console is first */ + } + + /* dump the buffer */ + if (!silent.looped) { + /* if the buffer hasn't looped, just print it */ + printf("%s", silent.buffer); + } else { + /* + * If the buffer has looped, first print the oldest part of the buffer, + * which is one past the current null. Then print the newer part which + * starts at the beginning of the buffer. + */ + printf("%s", silent.buffer_start + 1); + printf("%s", silent.buffer); + } + + return 0; +} + +static struct builtin builtin_verbose = +{ + "verbose", + verbose_func, + BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_SCRIPT | BUILTIN_HELP_LIST, + "verbose", + "Verbose output during menu entry (script) execution." +}; + +#ifdef SUPPORT_GRAPHICS + +static int splashimage_func(char *arg, int flags) { + char splashimage[64]; + int i; + + /* filename can only be 64 characters due to our buffer size */ + if (strlen(arg) > 63) + return 1; + + if (flags == BUILTIN_SCRIPT) + flags = BUILTIN_CMDLINE; + + if (flags == BUILTIN_CMDLINE) { + if (!grub_open(arg)) + return 1; + grub_close(); + } + + strcpy(splashimage, arg); + + /* get rid of TERM_NEED_INIT from the graphics terminal. */ + for (i = 0; term_table[i].name; i++) { + if (grub_strcmp (term_table[i].name, "graphics") == 0) { + term_table[i].flags &= ~TERM_NEED_INIT; + break; + } + } + + graphics_set_splash(splashimage); + + if (flags == BUILTIN_CMDLINE && graphics_inited) { + /* + * calling graphics_end() here flickers the screen black. OTOH not + * calling it gets us odd plane interlacing / early palette switching ? + * ideally one should figure out how to double buffer and switch... + */ + graphics_end(); + graphics_init(); + graphics_cls(); + } + + /* FIXME: should we be explicitly switching the terminal as a + * side effect here? */ + terminal_func("graphics", flags); + + reset_term = 0; + + return 0; +} + +static struct builtin builtin_splashimage = +{ + "splashimage", + splashimage_func, + BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_SCRIPT | BUILTIN_HELP_LIST, + "splashimage FILE", + "Load FILE as the background image when in graphics mode." +}; + + +/* foreground */ +static int +foreground_func(char *arg, int flags) +{ + if (grub_strlen(arg) == 6) { + int r = ((hex(arg[0]) << 4) | hex(arg[1])) >> 2; + int g = ((hex(arg[2]) << 4) | hex(arg[3])) >> 2; + int b = ((hex(arg[4]) << 4) | hex(arg[5])) >> 2; + + foreground = (r << 16) | (g << 8) | b; + if (graphics_inited) + graphics_set_palette(15, r, g, b); + + return (0); + } + + return (1); +} + +static struct builtin builtin_foreground = +{ + "foreground", + foreground_func, + BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_HELP_LIST | BUILTIN_SCRIPT, + "foreground RRGGBB", + "Sets the foreground color when in graphics mode." + "RR is red, GG is green, and BB blue. Numbers must be in hexadecimal." +}; + + +/* background */ +static int +background_func(char *arg, int flags) +{ + if (grub_strlen(arg) == 6) { + int r = ((hex(arg[0]) << 4) | hex(arg[1])) >> 2; + int g = ((hex(arg[2]) << 4) | hex(arg[3])) >> 2; + int b = ((hex(arg[4]) << 4) | hex(arg[5])) >> 2; + + background = (r << 16) | (g << 8) | b; + if (graphics_inited) + graphics_set_palette(0, r, g, b); + return (0); + } + + return (1); +} + +static struct builtin builtin_background = +{ + "background", + background_func, + BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_HELP_LIST | BUILTIN_SCRIPT, + "background RRGGBB", + "Sets the background color when in graphics mode." + "RR is red, GG is green, and BB blue. Numbers must be in hexadecimal." +}; + +#endif /* SUPPORT_GRAPHICS */ + + +/* clear */ +static int +clear_func() +{ + if (current_term->cls) + current_term->cls(); + + return 0; +} + +static struct builtin builtin_clear = +{ + "clear", + clear_func, + BUILTIN_CMDLINE | BUILTIN_HELP_LIST, + "clear", + "Clear the screen" +}; + +/* displayapm */ +static int +displayapm_func (char *arg, int flags) +{ + if (mbi.flags & MB_INFO_APM_TABLE) + { + grub_printf ("APM BIOS information:\n" + " Version: 0x%x\n" + " 32-bit CS: 0x%x\n" + " Offset: 0x%x\n" + " 16-bit CS: 0x%x\n" + " 16-bit DS: 0x%x\n" + " 32-bit CS length: 0x%x\n" + " 16-bit CS length: 0x%x\n" + " 16-bit DS length: 0x%x\n", + (unsigned) apm_bios_info.version, + (unsigned) apm_bios_info.cseg, + apm_bios_info.offset, + (unsigned) apm_bios_info.cseg_16, + (unsigned) apm_bios_info.dseg_16, + (unsigned) apm_bios_info.cseg_len, + (unsigned) apm_bios_info.cseg_16_len, + (unsigned) apm_bios_info.dseg_16_len); + } + else + { + grub_printf ("No APM BIOS found or probe failed\n"); + } + + return 0; +} + +static struct builtin builtin_displayapm = +{ + "displayapm", + displayapm_func, + BUILTIN_CMDLINE | BUILTIN_HELP_LIST, + "displayapm", + "Display APM BIOS information." +}; + + +/* displaymem */ +static int +displaymem_func (char *arg, int flags) +{ + if (get_eisamemsize () != -1) + grub_printf (" EISA Memory BIOS Interface is present\n"); + if (get_mmap_entry ((void *) SCRATCHADDR, 0) != 0 + || *((int *) SCRATCHADDR) != 0) + grub_printf (" Address Map BIOS Interface is present\n"); + + grub_printf (" Lower memory: %uK, " + "Upper memory (to first chipset hole): %uK\n", + mbi.mem_lower, mbi.mem_upper); + + if (min_mem64 != 0) + grub_printf (" Memory limit for 64-bit ISADIR expansion: %uMB\n", + min_mem64); + + if (mbi.flags & MB_INFO_MEM_MAP) + { + struct AddrRangeDesc *map = (struct AddrRangeDesc *) mbi.mmap_addr; + int end_addr = mbi.mmap_addr + mbi.mmap_length; + + grub_printf (" [Address Range Descriptor entries " + "immediately follow (values are 64-bit)]\n"); + while (end_addr > (int) map) + { + char *str; + + if (map->Type == MB_ARD_MEMORY) + str = "Usable RAM"; + else + str = "Reserved"; + grub_printf (" %s: Base Address: 0x%x X 4GB + 0x%x,\n" + " Length: 0x%x X 4GB + 0x%x bytes\n", + str, + (unsigned long) (map->BaseAddr >> 32), + (unsigned long) (map->BaseAddr & 0xFFFFFFFF), + (unsigned long) (map->Length >> 32), + (unsigned long) (map->Length & 0xFFFFFFFF)); + + map = ((struct AddrRangeDesc *) (((int) map) + 4 + map->size)); + } + } + + return 0; +} + +static struct builtin builtin_displaymem = +{ + "displaymem", + displaymem_func, + BUILTIN_CMDLINE | BUILTIN_HELP_LIST, + "displaymem", + "Display what GRUB thinks the system address space map of the" + " machine is, including all regions of physical RAM installed." +}; + + +/* dump FROM TO */ +#ifdef GRUB_UTIL +static int +dump_func (char *arg, int flags) +{ + char *from, *to; + FILE *fp; + char c; + + from = arg; + to = skip_to (0, arg); + if (! *from || ! *to) + { + errnum = ERR_BAD_ARGUMENT; + return 1; + } + + nul_terminate (from); + nul_terminate (to); + + if (! grub_open (from)) + return 1; + + fp = fopen (to, "w"); + if (! fp) + { + errnum = ERR_WRITE; + return 1; + } + + while (grub_read (&c, 1)) + if (fputc (c, fp) == EOF) + { + errnum = ERR_WRITE; + fclose (fp); + return 1; + } + + if (fclose (fp) == EOF) + { + errnum = ERR_WRITE; + return 1; + } + + grub_close (); + return 0; +} + +static struct builtin builtin_dump = + { + "dump", + dump_func, + BUILTIN_CMDLINE, + "dump FROM TO", + "Dump the contents of the file FROM to the file TO. FROM must be" + " a GRUB file and TO must be an OS file." + }; +#endif /* GRUB_UTIL */ + + +static char embed_info[32]; +/* embed */ +/* Embed a Stage 1.5 in the first cylinder after MBR or in the + bootloader block in a FFS. */ +static int +embed_func (char *arg, int flags) +{ + char *stage1_5; + char *device; + char *stage1_5_buffer = (char *) RAW_ADDR (0x100000); + int len, size; + int sector; + + stage1_5 = arg; + device = skip_to (0, stage1_5); + + /* Open a Stage 1.5. */ + if (! grub_open (stage1_5)) + return 1; + + /* Read the whole of the Stage 1.5. */ + len = grub_read (stage1_5_buffer, -1); + grub_close (); + + if (errnum) + return 1; + + size = (len + SECTOR_SIZE - 1) / SECTOR_SIZE; + + /* Get the device where the Stage 1.5 will be embedded. */ + set_device (device); + if (errnum) + return 1; + + if (current_partition == 0xFFFFFF) + { + /* Embed it after the MBR. */ + + char mbr[SECTOR_SIZE]; + char ezbios_check[2*SECTOR_SIZE]; + int i; + + /* Open the partition. */ + if (! open_partition ()) + return 1; + + /* No floppy has MBR. */ + if (! (current_drive & 0x80)) + { + errnum = ERR_DEV_VALUES; + return 1; + } + + /* Read the MBR of CURRENT_DRIVE. */ + if (! rawread (current_drive, PC_MBR_SECTOR, 0, SECTOR_SIZE, mbr)) + return 1; + + /* Sanity check. */ + if (! PC_MBR_CHECK_SIG (mbr)) + { + errnum = ERR_BAD_PART_TABLE; + return 1; + } + + /* Check if the disk can store the Stage 1.5. */ + for (i = 0; i < 4; i++) + if (PC_SLICE_TYPE (mbr, i) && PC_SLICE_START (mbr, i) - 1 < size) + { + errnum = ERR_NO_DISK_SPACE; + return 1; + } + + /* Check for EZ-BIOS signature. It should be in the third + * sector, but due to remapping it can appear in the second, so + * load and check both. + */ + if (! rawread (current_drive, 1, 0, 2 * SECTOR_SIZE, ezbios_check)) + return 1; + + if (! memcmp (ezbios_check + 3, "AERMH", 5) + || ! memcmp (ezbios_check + 512 + 3, "AERMH", 5)) + { + /* The space after the MBR is used by EZ-BIOS which we must + * not overwrite. + */ + errnum = ERR_NO_DISK_SPACE; + return 1; + } + + sector = 1; + } + else + { + /* Embed it in the bootloader block in the filesystem. */ + int start_sector; + + /* Open the partition. */ + if (! open_device ()) + return 1; + + /* Check if the current slice supports embedding. */ + if (fsys_table[fsys_type].embed_func == 0 + || ! fsys_table[fsys_type].embed_func (&start_sector, size)) + { + errnum = ERR_DEV_VALUES; + return 1; + } + + sector = part_start + start_sector; + } + + /* Clear the cache. */ + buf_track = BUF_CACHE_INVALID; + + /* Now perform the embedding. */ + if (! devwrite (sector - part_start, size, stage1_5_buffer)) + return 1; + + grub_printf (" %d sectors are embedded.\n", size); + grub_sprintf (embed_info, "%d+%d", sector - part_start, size); + return 0; +} + +static struct builtin builtin_embed = +{ + "embed", + embed_func, + BUILTIN_CMDLINE, + "embed STAGE1_5 DEVICE", + "Embed the Stage 1.5 STAGE1_5 in the sectors after MBR if DEVICE" + " is a drive, or in the \"bootloader\" area if DEVICE is a FFS partition." + " Print the number of sectors which STAGE1_5 occupies if successful." +}; + + +/* fallback */ +static int +fallback_func (char *arg, int flags) +{ + int i = 0; + + while (*arg) + { + int entry; + int j; + + if (! safe_parse_maxint (&arg, &entry)) + return 1; + + /* Remove duplications to prevent infinite looping. */ + for (j = 0; j < i; j++) + if (entry == fallback_entries[j]) + break; + if (j != i) + continue; + + fallback_entries[i++] = entry; + if (i == MAX_FALLBACK_ENTRIES) + break; + + arg = skip_to (0, arg); + } + + if (i < MAX_FALLBACK_ENTRIES) + fallback_entries[i] = -1; + + fallback_entryno = (i == 0) ? -1 : 0; + + return 0; +} + +static struct builtin builtin_fallback = +{ + "fallback", + fallback_func, + BUILTIN_MENU, +#if 0 + "fallback NUM...", + "Go into unattended boot mode: if the default boot entry has any" + " errors, instead of waiting for the user to do anything, it" + " immediately starts over using the NUM entry (same numbering as the" + " `default' command). This obviously won't help if the machine" + " was rebooted by a kernel that GRUB loaded." +#endif +}; + + + +void +set_root (char *root, unsigned long drive, unsigned long part) +{ + int bsd_part = (part >> 8) & 0xFF; + int pc_slice = part >> 16; + + if (bsd_part == 0xFF) { + grub_sprintf (root, "(hd%d,%d)\n", drive - 0x80, pc_slice); + } else { + grub_sprintf (root, "(hd%d,%d,%c)\n", + drive - 0x80, pc_slice, bsd_part + 'a'); + } +} + +static int +find_common (char *arg, char *root, int for_root, int flags) +{ + char *filename = NULL; + static char argpart[32]; + static char device[32]; + char *tmp_argpart = NULL; + unsigned long drive; + unsigned long tmp_drive = saved_drive; + unsigned long tmp_partition = saved_partition; + int got_file = 0; + static char bootsign[BOOTSIGN_LEN]; + + /* + * If argument has partition information (findroot command only), then + * it can't be a floppy + */ + if (for_root && arg[0] == '(') { + tmp_argpart = grub_strchr(arg + 1, ','); + if (tmp_argpart == NULL) + goto out; + grub_strcpy(argpart, tmp_argpart); + *tmp_argpart = '\0'; + arg++; + grub_sprintf(bootsign, "%s/%s", BOOTSIGN_DIR, arg); + filename = bootsign; + goto harddisk; + } else if (for_root) { + /* Boot signature without partition/slice information */ + grub_sprintf(bootsign, "%s/%s", BOOTSIGN_DIR, arg); + filename = bootsign; + } else { + /* plain vanilla find cmd */ + filename = arg; + } + + /* Floppies. */ + for (drive = 0; drive < 8; drive++) + { + current_drive = drive; + current_partition = 0xFFFFFF; + + if (open_device ()) + { + saved_drive = current_drive; + saved_partition = current_partition; + if (grub_open (filename)) + { + grub_close (); + got_file = 1; + if (for_root) { + grub_sprintf(root, "(fd%d)", drive); + goto out; + } else + grub_printf (" (fd%d)\n", drive); + } + } + + errnum = ERR_NONE; + } + +harddisk: + /* Hard disks. */ + for (drive = 0x80; drive < 0x88; drive++) + { + unsigned long part = 0xFFFFFF; + unsigned long start, len, offset, ext_offset; + int type, entry; + char buf[SECTOR_SIZE]; + + if (for_root && tmp_argpart) { + grub_sprintf(device, "(hd%d%s", drive - 0x80, argpart); + set_device(device); + errnum = ERR_NONE; + part = current_partition; + if (open_device ()) { + saved_drive = current_drive; + saved_partition = current_partition; + errnum = ERR_NONE; + if (grub_open (filename)) { + grub_close (); + got_file = 1; + if (is_zfs_mount == 0) { + set_root(root, current_drive, current_partition); + goto out; + } else { + best_drive = current_drive; + best_part = current_partition; + } + } + } + errnum = ERR_NONE; + continue; + } + current_drive = drive; + while (next_partition (drive, 0xFFFFFF, &part, &type, + &start, &len, &offset, &entry, + &ext_offset, buf)) + { + if (type != PC_SLICE_TYPE_NONE + && ! IS_PC_SLICE_TYPE_BSD (type) + && ! IS_PC_SLICE_TYPE_EXTENDED (type)) + { + current_partition = part; + if (open_device ()) + { + saved_drive = current_drive; + saved_partition = current_partition; + if (grub_open (filename)) + { + char tmproot[32]; + + grub_close (); + got_file = 1; + set_root(tmproot, drive, part); + if (for_root) { + grub_memcpy(root, tmproot, sizeof(tmproot)); + if (is_zfs_mount == 0) { + goto out; + } else { + best_drive = current_drive; + best_part = current_partition; + } + } else { + grub_printf("%s", tmproot); + } + } + } + } + + /* We want to ignore any error here. */ + errnum = ERR_NONE; + } + + /* next_partition always sets ERRNUM in the last call, so clear + it. */ + errnum = ERR_NONE; + } + +out: + if (is_zfs_mount && for_root) { + set_root(root, best_drive, best_part); + buf_drive = -1; + } else { + saved_drive = tmp_drive; + saved_partition = tmp_partition; + } + if (tmp_argpart) + *tmp_argpart = ','; + + if (got_file) + { + errnum = ERR_NONE; + return 0; + } + + errnum = ERR_FILE_NOT_FOUND; + return 1; +} + +/* find */ +/* Search for the filename ARG in all of partitions. */ +static int +find_func (char *arg, int flags) +{ + return (find_common(arg, NULL, 0, flags)); +} + +static struct builtin builtin_find = +{ + "find", + find_func, + BUILTIN_CMDLINE | BUILTIN_HELP_LIST, + "find FILENAME", + "Search for the filename FILENAME in all of partitions and print the list of" + " the devices which contain the file." +}; + + +/* fstest */ +static int +fstest_func (char *arg, int flags) +{ + if (disk_read_hook) + { + disk_read_hook = NULL; + printf (" Filesystem tracing is now off\n"); + } + else + { + disk_read_hook = disk_read_print_func; + printf (" Filesystem tracing is now on\n"); + } + + return 0; +} + +static struct builtin builtin_fstest = +{ + "fstest", + fstest_func, + BUILTIN_CMDLINE, + "fstest", + "Toggle filesystem test mode." +}; + + +/* geometry */ +static int +geometry_func (char *arg, int flags) +{ + struct geometry geom; + char *msg; + char *device = arg; +#ifdef GRUB_UTIL + char *ptr; +#endif + + /* Get the device number. */ + set_device (device); + if (errnum) + return 1; + + /* Check for the geometry. */ + if (get_diskinfo (current_drive, &geom)) + { + errnum = ERR_NO_DISK; + return 1; + } + + /* Attempt to read the first sector, because some BIOSes turns out not + to support LBA even though they set the bit 0 in the support + bitmap, only after reading something actually. */ + if (biosdisk (BIOSDISK_READ, current_drive, &geom, 0, 1, SCRATCHSEG)) + { + errnum = ERR_READ; + return 1; + } + +#ifdef GRUB_UTIL + ptr = skip_to (0, device); + if (*ptr) + { + char *cylinder, *head, *sector, *total_sector; + int num_cylinder, num_head, num_sector, num_total_sector; + + cylinder = ptr; + head = skip_to (0, cylinder); + sector = skip_to (0, head); + total_sector = skip_to (0, sector); + if (! safe_parse_maxint (&cylinder, &num_cylinder) + || ! safe_parse_maxint (&head, &num_head) + || ! safe_parse_maxint (§or, &num_sector)) + return 1; + + disks[current_drive].cylinders = num_cylinder; + disks[current_drive].heads = num_head; + disks[current_drive].sectors = num_sector; + + if (safe_parse_maxint (&total_sector, &num_total_sector)) + disks[current_drive].total_sectors = num_total_sector; + else + disks[current_drive].total_sectors + = num_cylinder * num_head * num_sector; + errnum = 0; + + geom = disks[current_drive]; + buf_drive = -1; + } +#endif /* GRUB_UTIL */ + +#ifdef GRUB_UTIL + msg = device_map[current_drive]; +#else + if (geom.flags & BIOSDISK_FLAG_LBA_EXTENSION) + msg = "LBA"; + else + msg = "CHS"; +#endif + + grub_printf ("drive 0x%x: C/H/S = %d/%d/%d, " + "The number of sectors = %u, %s\n", + current_drive, + geom.cylinders, geom.heads, geom.sectors, + geom.total_sectors, msg); + real_open_partition (1); + + return 0; +} + +static struct builtin builtin_geometry = +{ + "geometry", + geometry_func, + BUILTIN_CMDLINE | BUILTIN_HELP_LIST, + "geometry DRIVE [CYLINDER HEAD SECTOR [TOTAL_SECTOR]]", + "Print the information for a drive DRIVE. In the grub shell, you can" + " set the geometry of the drive arbitrarily. The number of the cylinders," + " the one of the heads, the one of the sectors and the one of the total" + " sectors are set to CYLINDER, HEAD, SECTOR and TOTAL_SECTOR," + " respectively. If you omit TOTAL_SECTOR, then it will be calculated based" + " on the C/H/S values automatically." +}; + + +/* halt */ +static int +halt_func (char *arg, int flags) +{ + int no_apm; + + no_apm = (grub_memcmp (arg, "--no-apm", 8) == 0); + grub_halt (no_apm); + + /* Never reach here. */ + return 1; +} + +static struct builtin builtin_halt = +{ + "halt", + halt_func, + BUILTIN_CMDLINE | BUILTIN_HELP_LIST, + "halt [--no-apm]", + "Halt your system. If APM is avaiable on it, turn off the power using" + " the APM BIOS, unless you specify the option `--no-apm'." +}; + + +/* help */ +#define MAX_SHORT_DOC_LEN 39 +#define MAX_LONG_DOC_LEN 66 + +static int +help_func (char *arg, int flags) +{ + int all = 0; + + if (grub_memcmp (arg, "--all", sizeof ("--all") - 1) == 0) + { + all = 1; + arg = skip_to (0, arg); + } + + if (! *arg) + { + /* Invoked with no argument. Print the list of the short docs. */ + struct builtin **builtin; + int left = 1; + + for (builtin = builtin_table; *builtin != 0; builtin++) + { + int len; + int i; + + /* If this cannot be used in the command-line interface, + skip this. */ + if (! ((*builtin)->flags & BUILTIN_CMDLINE)) + continue; + + /* If this doesn't need to be listed automatically and "--all" + is not specified, skip this. */ + if (! all && ! ((*builtin)->flags & BUILTIN_HELP_LIST)) + continue; + + len = grub_strlen ((*builtin)->short_doc); + /* If the length of SHORT_DOC is too long, truncate it. */ + if (len > MAX_SHORT_DOC_LEN - 1) + len = MAX_SHORT_DOC_LEN - 1; + + for (i = 0; i < len; i++) + grub_putchar ((*builtin)->short_doc[i]); + + for (; i < MAX_SHORT_DOC_LEN; i++) + grub_putchar (' '); + + if (! left) + grub_putchar ('\n'); + + left = ! left; + } + + /* If the last entry was at the left column, no newline was printed + at the end. */ + if (! left) + grub_putchar ('\n'); + } + else + { + /* Invoked with one or more patterns. */ + do + { + struct builtin **builtin; + char *next_arg; + + /* Get the next argument. */ + next_arg = skip_to (0, arg); + + /* Terminate ARG. */ + nul_terminate (arg); + + for (builtin = builtin_table; *builtin; builtin++) + { + /* Skip this if this is only for the configuration file. */ + if (! ((*builtin)->flags & BUILTIN_CMDLINE)) + continue; + + if (substring (arg, (*builtin)->name) < 1) + { + char *doc = (*builtin)->long_doc; + + /* At first, print the name and the short doc. */ + grub_printf ("%s: %s\n", + (*builtin)->name, (*builtin)->short_doc); + + /* Print the long doc. */ + while (*doc) + { + int len = grub_strlen (doc); + int i; + + /* If LEN is too long, fold DOC. */ + if (len > MAX_LONG_DOC_LEN) + { + /* Fold this line at the position of a space. */ + for (len = MAX_LONG_DOC_LEN; len > 0; len--) + if (doc[len - 1] == ' ') + break; + } + + grub_printf (" "); + for (i = 0; i < len; i++) + grub_putchar (*doc++); + grub_putchar ('\n'); + } + } + } + + arg = next_arg; + } + while (*arg); + } + + return 0; +} + +static struct builtin builtin_help = +{ + "help", + help_func, + BUILTIN_CMDLINE | BUILTIN_HELP_LIST, + "help [--all] [PATTERN ...]", + "Display helpful information about builtin commands. Not all commands" + " aren't shown without the option `--all'." +}; + + +/* hiddenmenu */ +static int +hiddenmenu_func (char *arg, int flags) +{ + show_menu = 0; + return 0; +} + +static struct builtin builtin_hiddenmenu = +{ + "hiddenmenu", + hiddenmenu_func, + BUILTIN_MENU, +#if 0 + "hiddenmenu", + "Hide the menu." +#endif +}; + + +/* hide */ +static int +hide_func (char *arg, int flags) +{ + if (! set_device (arg)) + return 1; + + if (! set_partition_hidden_flag (1)) + return 1; + + return 0; +} + +static struct builtin builtin_hide = +{ + "hide", + hide_func, + BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_HELP_LIST, + "hide PARTITION", + "Hide PARTITION by setting the \"hidden\" bit in" + " its partition type code." +}; + + +#ifdef SUPPORT_NETBOOT +/* ifconfig */ +static int +ifconfig_func (char *arg, int flags) +{ + char *svr = 0, *ip = 0, *gw = 0, *sm = 0; + + if (! grub_eth_probe ()) + { + grub_printf ("No ethernet card found.\n"); + errnum = ERR_DEV_VALUES; + return 1; + } + + while (*arg) + { + if (! grub_memcmp ("--server=", arg, sizeof ("--server=") - 1)) + svr = arg + sizeof("--server=") - 1; + else if (! grub_memcmp ("--address=", arg, sizeof ("--address=") - 1)) + ip = arg + sizeof ("--address=") - 1; + else if (! grub_memcmp ("--gateway=", arg, sizeof ("--gateway=") - 1)) + gw = arg + sizeof ("--gateway=") - 1; + else if (! grub_memcmp ("--mask=", arg, sizeof("--mask=") - 1)) + sm = arg + sizeof ("--mask=") - 1; + else + { + errnum = ERR_BAD_ARGUMENT; + return 1; + } + + arg = skip_to (0, arg); + } + + if (! ifconfig (ip, sm, gw, svr)) + { + errnum = ERR_BAD_ARGUMENT; + return 1; + } + + print_network_configuration (); + return 0; +} + +static struct builtin builtin_ifconfig = +{ + "ifconfig", + ifconfig_func, + BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_HELP_LIST, + "ifconfig [--address=IP] [--gateway=IP] [--mask=MASK] [--server=IP]", + "Configure the IP address, the netmask, the gateway and the server" + " address or print current network configuration." +}; +#endif /* SUPPORT_NETBOOT */ + + +/* impsprobe */ +static int +impsprobe_func (char *arg, int flags) +{ +#ifdef GRUB_UTIL + /* In the grub shell, we cannot probe IMPS. */ + errnum = ERR_UNRECOGNIZED; + return 1; +#else /* ! GRUB_UTIL */ + if (!imps_probe ()) + printf (" No MPS information found or probe failed\n"); + + return 0; +#endif /* ! GRUB_UTIL */ +} + +static struct builtin builtin_impsprobe = +{ + "impsprobe", + impsprobe_func, + BUILTIN_CMDLINE, + "impsprobe", + "Probe the Intel Multiprocessor Specification 1.1 or 1.4" + " configuration table and boot the various CPUs which are found into" + " a tight loop." +}; + + +/* initrd */ +static int +initrd_func (char *arg, int flags) +{ + switch (kernel_type) + { + case KERNEL_TYPE_LINUX: + case KERNEL_TYPE_BIG_LINUX: + if (! load_initrd (arg)) + return 1; + break; + + default: + errnum = ERR_NEED_LX_KERNEL; + return 1; + } + + return 0; +} + +static struct builtin builtin_initrd = +{ + "initrd", + initrd_func, + BUILTIN_CMDLINE | BUILTIN_HELP_LIST, + "initrd FILE [ARG ...]", + "Load an initial ramdisk FILE for a Linux format boot image and set the" + " appropriate parameters in the Linux setup area in memory." +}; + + +/* install */ +static int +install_func (char *arg, int flags) +{ + char *stage1_file, *dest_dev, *file, *addr; + char *stage1_buffer = (char *) RAW_ADDR (0x100000); + char *stage2_buffer = stage1_buffer + SECTOR_SIZE; + char *old_sect = stage2_buffer + SECTOR_SIZE; + char *stage2_first_buffer = old_sect + SECTOR_SIZE; + char *stage2_second_buffer = stage2_first_buffer + SECTOR_SIZE; + /* XXX: Probably SECTOR_SIZE is reasonable. */ + char *config_filename = stage2_second_buffer + SECTOR_SIZE; + char *dummy = config_filename + SECTOR_SIZE; + int new_drive = GRUB_INVALID_DRIVE; + int dest_drive, dest_partition; + unsigned int dest_sector; + int src_drive, src_partition, src_part_start; + int i; + struct geometry dest_geom, src_geom; + unsigned int saved_sector; + unsigned int stage2_first_sector, stage2_second_sector; + char *ptr; + int installaddr, installlist; + /* Point to the location of the name of a configuration file in Stage 2. */ + char *config_file_location; + /* If FILE is a Stage 1.5? */ + int is_stage1_5 = 0; + /* Must call grub_close? */ + int is_open = 0; + /* If LBA is forced? */ + int is_force_lba = 0; + /* Was the last sector full? */ + int last_length = SECTOR_SIZE; + +#ifdef GRUB_UTIL + /* If the Stage 2 is in a partition mounted by an OS, this will store + the filename under the OS. */ + char *stage2_os_file = 0; +#endif /* GRUB_UTIL */ + + auto void disk_read_savesect_func (unsigned int sector, int offset, + int length); + auto void disk_read_blocklist_func (unsigned int sector, int offset, + int length); + + /* Save the first sector of Stage2 in STAGE2_SECT. */ + auto void disk_read_savesect_func (unsigned int sector, int offset, + int length) + { + if (debug) + printf ("[%u]", sector); + + /* ReiserFS has files which sometimes contain data not aligned + on sector boundaries. Returning an error is better than + silently failing. */ + if (offset != 0 || length != SECTOR_SIZE) + errnum = ERR_UNALIGNED; + + saved_sector = sector; + } + + /* Write SECTOR to INSTALLLIST, and update INSTALLADDR and + INSTALLSECT. */ + auto void disk_read_blocklist_func (unsigned int sector, int offset, + int length) + { + if (debug) + printf("[%u]", sector); + + if (offset != 0 || last_length != SECTOR_SIZE) + { + /* We found a non-sector-aligned data block. */ + errnum = ERR_UNALIGNED; + return; + } + + last_length = length; + + if (*((unsigned long *) (installlist - 4)) + + *((unsigned short *) installlist) != sector + || installlist == (int) stage2_first_buffer + SECTOR_SIZE + 4) + { + installlist -= 8; + + if (*((unsigned long *) (installlist - 8))) + errnum = ERR_WONT_FIT; + else + { + *((unsigned short *) (installlist + 2)) = (installaddr >> 4); + *((unsigned long *) (installlist - 4)) = sector; + } + } + + *((unsigned short *) installlist) += 1; + installaddr += 512; + } + + /* First, check the GNU-style long option. */ + while (1) + { + if (grub_memcmp ("--force-lba", arg, sizeof ("--force-lba") - 1) == 0) + { + is_force_lba = 1; + arg = skip_to (0, arg); + } +#ifdef GRUB_UTIL + else if (grub_memcmp ("--stage2=", arg, sizeof ("--stage2=") - 1) == 0) + { + stage2_os_file = arg + sizeof ("--stage2=") - 1; + arg = skip_to (0, arg); + nul_terminate (stage2_os_file); + } +#endif /* GRUB_UTIL */ + else + break; + } + + stage1_file = arg; + dest_dev = skip_to (0, stage1_file); + if (*dest_dev == 'd') + { + new_drive = 0; + dest_dev = skip_to (0, dest_dev); + } + file = skip_to (0, dest_dev); + addr = skip_to (0, file); + + /* Get the installation address. */ + if (! safe_parse_maxint (&addr, &installaddr)) + { + /* ADDR is not specified. */ + installaddr = 0; + ptr = addr; + errnum = 0; + } + else + ptr = skip_to (0, addr); + +#ifndef NO_DECOMPRESSION + /* Do not decompress Stage 1 or Stage 2. */ + no_decompression = 1; +#endif + + /* Read Stage 1. */ + is_open = grub_open (stage1_file); + if (! is_open + || ! grub_read (stage1_buffer, SECTOR_SIZE) == SECTOR_SIZE) + goto fail; + + /* Read the old sector from DEST_DEV. */ + if (! set_device (dest_dev) + || ! open_partition () + || ! devread (0, 0, SECTOR_SIZE, old_sect)) + goto fail; + + /* Store the information for the destination device. */ + dest_drive = current_drive; + dest_partition = current_partition; + dest_geom = buf_geom; + dest_sector = part_start; + + /* Copy the possible DOS BPB, 59 bytes at byte offset 3. */ + grub_memmove (stage1_buffer + BOOTSEC_BPB_OFFSET, + old_sect + BOOTSEC_BPB_OFFSET, + BOOTSEC_BPB_LENGTH); + + /* If for a hard disk, copy the possible MBR/extended part table. */ + if (dest_drive & 0x80) + grub_memmove (stage1_buffer + STAGE1_WINDOWS_NT_MAGIC, + old_sect + STAGE1_WINDOWS_NT_MAGIC, + STAGE1_PARTEND - STAGE1_WINDOWS_NT_MAGIC); + + /* Check for the version and the signature of Stage 1. */ + if (*((short *)(stage1_buffer + STAGE1_VER_MAJ_OFFS)) != COMPAT_VERSION + || (*((unsigned short *) (stage1_buffer + BOOTSEC_SIG_OFFSET)) + != BOOTSEC_SIGNATURE)) + { + errnum = ERR_BAD_VERSION; + goto fail; + } + + /* This below is not true any longer. But should we leave this alone? */ + + /* If DEST_DRIVE is a floppy, Stage 2 must have the iteration probe + routine. */ + if (! (dest_drive & 0x80) + && (*((unsigned char *) (stage1_buffer + BOOTSEC_PART_OFFSET)) == 0x80 + || stage1_buffer[BOOTSEC_PART_OFFSET] == 0)) + { + errnum = ERR_BAD_VERSION; + goto fail; + } + + grub_close (); + + /* Open Stage 2. */ + is_open = grub_open (file); + if (! is_open) + goto fail; + + src_drive = current_drive; + src_partition = current_partition; + src_part_start = part_start; + src_geom = buf_geom; + + if (! new_drive) + new_drive = src_drive; + else if (src_drive != dest_drive) + grub_printf ("Warning: the option `d' was not used, but the Stage 1 will" + " be installed on a\ndifferent drive than the drive where" + " the Stage 2 resides.\n"); + + /* Set the boot drive. */ + *((unsigned char *) (stage1_buffer + STAGE1_BOOT_DRIVE)) = new_drive; + + /* Set the "force LBA" flag. */ + *((unsigned char *) (stage1_buffer + STAGE1_FORCE_LBA)) = is_force_lba; + + /* If DEST_DRIVE is a hard disk, enable the workaround, which is + for buggy BIOSes which don't pass boot drive correctly. Instead, + they pass 0x00 or 0x01 even when booted from 0x80. */ + if (dest_drive & BIOS_FLAG_FIXED_DISK) + /* Replace the jmp (2 bytes) with double nop's. */ + *((unsigned short *) (stage1_buffer + STAGE1_BOOT_DRIVE_CHECK)) + = 0x9090; + + /* Read the first sector of Stage 2. */ + disk_read_hook = disk_read_savesect_func; + if (grub_read (stage2_first_buffer, SECTOR_SIZE) != SECTOR_SIZE) + goto fail; + + stage2_first_sector = saved_sector; + + /* Read the second sector of Stage 2. */ + if (grub_read (stage2_second_buffer, SECTOR_SIZE) != SECTOR_SIZE) + goto fail; + + stage2_second_sector = saved_sector; + + /* Check for the version of Stage 2. */ + if (*((short *) (stage2_second_buffer + STAGE2_VER_MAJ_OFFS)) + != COMPAT_VERSION) + { + errnum = ERR_BAD_VERSION; + goto fail; + } + + /* Check for the Stage 2 id. */ + if (stage2_second_buffer[STAGE2_STAGE2_ID] != STAGE2_ID_STAGE2) + is_stage1_5 = 1; + + /* If INSTALLADDR is not specified explicitly in the command-line, + determine it by the Stage 2 id. */ + if (! installaddr) + { + if (! is_stage1_5) + /* Stage 2. */ + installaddr = 0x8000; + else + /* Stage 1.5. */ + installaddr = 0x2000; + } + + *((unsigned long *) (stage1_buffer + STAGE1_STAGE2_SECTOR)) + = stage2_first_sector; + *((unsigned short *) (stage1_buffer + STAGE1_STAGE2_ADDRESS)) + = installaddr; + *((unsigned short *) (stage1_buffer + STAGE1_STAGE2_SEGMENT)) + = installaddr >> 4; + + i = (int) stage2_first_buffer + SECTOR_SIZE - 4; + while (*((unsigned long *) i)) + { + if (i < (int) stage2_first_buffer + || (*((int *) (i - 4)) & 0x80000000) + || *((unsigned short *) i) >= 0xA00 + || *((short *) (i + 2)) == 0) + { + errnum = ERR_BAD_VERSION; + goto fail; + } + + *((int *) i) = 0; + *((int *) (i - 4)) = 0; + i -= 8; + } + + installlist = (int) stage2_first_buffer + SECTOR_SIZE + 4; + installaddr += SECTOR_SIZE; + + /* Read the whole of Stage2 except for the first sector. */ + grub_seek (SECTOR_SIZE); + + disk_read_hook = disk_read_blocklist_func; + if (! grub_read (dummy, -1)) + goto fail; + + disk_read_hook = 0; + + /* Find a string for the configuration filename. */ + config_file_location = stage2_second_buffer + STAGE2_VER_STR_OFFS; + while (*(config_file_location++)) + ; + + /* Set the "force LBA" flag for Stage2. */ + *((unsigned char *) (stage2_second_buffer + STAGE2_FORCE_LBA)) + = is_force_lba; + + if (*ptr == 'p') + { + *((long *) (stage2_second_buffer + STAGE2_INSTALLPART)) + = src_partition; + if (is_stage1_5) + { + /* Reset the device information in FILE if it is a Stage 1.5. */ + unsigned long device = 0xFFFFFFFF; + + grub_memmove (config_file_location, (char *) &device, + sizeof (device)); + } + + ptr = skip_to (0, ptr); + } + + if (*ptr) + { + grub_strcpy (config_filename, ptr); + nul_terminate (config_filename); + + if (! is_stage1_5) + /* If it is a Stage 2, just copy PTR to CONFIG_FILE_LOCATION. */ + grub_strcpy (config_file_location, ptr); + else + { + char *real_config; + unsigned long device; + + /* Translate the external device syntax to the internal device + syntax. */ + if (! (real_config = set_device (ptr))) + { + /* The Stage 2 PTR does not contain the device name, so + use the root device instead. */ + errnum = ERR_NONE; + current_drive = saved_drive; + current_partition = saved_partition; + real_config = ptr; + } + + if (current_drive == src_drive) + { + /* If the drive where the Stage 2 resides is the same as + the one where the Stage 1.5 resides, do not embed the + drive number. */ + current_drive = GRUB_INVALID_DRIVE; + } + + device = (current_drive << 24) | current_partition; + grub_memmove (config_file_location, (char *) &device, + sizeof (device)); + grub_strcpy (config_file_location + sizeof (device), + real_config); + } + + /* If a Stage 1.5 is used, then we need to modify the Stage2. */ + if (is_stage1_5) + { + char *real_config_filename = skip_to (0, ptr); + + is_open = grub_open (config_filename); + if (! is_open) + goto fail; + + /* Skip the first sector. */ + grub_seek (SECTOR_SIZE); + + disk_read_hook = disk_read_savesect_func; + if (grub_read (stage2_buffer, SECTOR_SIZE) != SECTOR_SIZE) + goto fail; + + disk_read_hook = 0; + grub_close (); + is_open = 0; + + /* Sanity check. */ + if (*(stage2_buffer + STAGE2_STAGE2_ID) != STAGE2_ID_STAGE2) + { + errnum = ERR_BAD_VERSION; + goto fail; + } + + /* Set the "force LBA" flag for Stage2. */ + *(stage2_buffer + STAGE2_FORCE_LBA) = is_force_lba; + + /* If REAL_CONFIG_FILENAME is specified, copy it to the Stage2. */ + if (*real_config_filename) + { + /* Specified */ + char *location; + + /* Find a string for the configuration filename. */ + location = stage2_buffer + STAGE2_VER_STR_OFFS; + while (*(location++)) + ; + + /* Copy the name. */ + grub_strcpy (location, real_config_filename); + } + + /* Write it to the disk. */ + buf_track = BUF_CACHE_INVALID; + +#ifdef GRUB_UTIL + /* In the grub shell, access the Stage 2 via the OS filesystem + service, if possible. */ + if (stage2_os_file) + { + FILE *fp; + + fp = fopen (stage2_os_file, "r+"); + if (! fp) + { + errnum = ERR_FILE_NOT_FOUND; + goto fail; + } + + if (fseek (fp, SECTOR_SIZE, SEEK_SET) != 0) + { + fclose (fp); + errnum = ERR_BAD_VERSION; + goto fail; + } + + if (fwrite (stage2_buffer, 1, SECTOR_SIZE, fp) + != SECTOR_SIZE) + { + fclose (fp); + errnum = ERR_WRITE; + goto fail; + } + + fclose (fp); + } + else +#endif /* GRUB_UTIL */ + { + if (! devwrite (saved_sector - part_start, 1, stage2_buffer)) + goto fail; + } + } + } + + /* Clear the cache. */ + buf_track = BUF_CACHE_INVALID; + + /* Write the modified sectors of Stage2 to the disk. */ +#ifdef GRUB_UTIL + if (! is_stage1_5 && stage2_os_file) + { + FILE *fp; + + fp = fopen (stage2_os_file, "r+"); + if (! fp) + { + errnum = ERR_FILE_NOT_FOUND; + goto fail; + } + + if (fwrite (stage2_first_buffer, 1, SECTOR_SIZE, fp) != SECTOR_SIZE) + { + fclose (fp); + errnum = ERR_WRITE; + goto fail; + } + + if (fwrite (stage2_second_buffer, 1, SECTOR_SIZE, fp) != SECTOR_SIZE) + { + fclose (fp); + errnum = ERR_WRITE; + goto fail; + } + + fclose (fp); + } + else +#endif /* GRUB_UTIL */ + { + /* The first. */ + current_drive = src_drive; + current_partition = src_partition; + + if (! open_partition ()) + goto fail; + + if (! devwrite (stage2_first_sector - src_part_start, 1, + stage2_first_buffer)) + goto fail; + + if (! devwrite (stage2_second_sector - src_part_start, 1, + stage2_second_buffer)) + goto fail; + } + + /* Write the modified sector of Stage 1 to the disk. */ + current_drive = dest_drive; + current_partition = dest_partition; + if (! open_partition ()) + goto fail; + + devwrite (0, 1, stage1_buffer); + + fail: + if (is_open) + grub_close (); + + disk_read_hook = 0; + +#ifndef NO_DECOMPRESSION + no_decompression = 0; +#endif + + return errnum; +} + +static struct builtin builtin_install = +{ + "install", + install_func, + BUILTIN_CMDLINE, + "install [--stage2=STAGE2_FILE] [--force-lba] STAGE1 [d] DEVICE STAGE2 [ADDR] [p] [CONFIG_FILE] [REAL_CONFIG_FILE]", + "Install STAGE1 on DEVICE, and install a blocklist for loading STAGE2" + " as a Stage 2. If the option `d' is present, the Stage 1 will always" + " look for the disk where STAGE2 was installed, rather than using" + " the booting drive. The Stage 2 will be loaded at address ADDR, which" + " will be determined automatically if you don't specify it. If" + " the option `p' or CONFIG_FILE is present, then the first block" + " of Stage 2 is patched with new values of the partition and name" + " of the configuration file used by the true Stage 2 (for a Stage 1.5," + " this is the name of the true Stage 2) at boot time. If STAGE2 is a Stage" + " 1.5 and REAL_CONFIG_FILE is present, then the Stage 2 CONFIG_FILE is" + " patched with the configuration filename REAL_CONFIG_FILE." + " If the option `--force-lba' is specified, disable some sanity checks" + " for LBA mode. If the option `--stage2' is specified, rewrite the Stage" + " 2 via your OS's filesystem instead of the raw device." +}; + + +/* ioprobe */ +static int +ioprobe_func (char *arg, int flags) +{ +#ifdef GRUB_UTIL + + errnum = ERR_UNRECOGNIZED; + return 1; + +#else /* ! GRUB_UTIL */ + + unsigned short *port; + + /* Get the drive number. */ + set_device (arg); + if (errnum) + return 1; + + /* Clean out IO_MAP. */ + grub_memset ((char *) io_map, 0, IO_MAP_SIZE * sizeof (unsigned short)); + + /* Track the int13 handler. */ + track_int13 (current_drive); + + /* Print out the result. */ + for (port = io_map; *port != 0; port++) + grub_printf (" 0x%x", (unsigned int) *port); + + return 0; + +#endif /* ! GRUB_UTIL */ +} + +static struct builtin builtin_ioprobe = +{ + "ioprobe", + ioprobe_func, + BUILTIN_CMDLINE, + "ioprobe DRIVE", + "Probe I/O ports used for the drive DRIVE." +}; + + +/* + * To boot from a ZFS root filesystem, the kernel$ or module$ commands + * must include "-B $ZFS-BOOTFS" to pass to the kernel: + * + * e.g. + * kernel$ /platform/i86pc/kernel/$ISADIR/unix -B $ZFS-BOOTFS,console=ttya + * + * The expand_dollar_bootfs routine expands $ZFS-BOOTFS to + * "pool-name/zfs-rootfilesystem-object-num", e.g. "rootpool/85" + * so that in the kernel zfs_mountroot would know which zfs root + * filesystem to be mounted. + */ +static int +expand_dollar_bootfs(char *in, char *out) +{ + char *token, *tmpout = out; + int outlen, blen; + int postcomma = 0; + + outlen = strlen(in); + blen = current_bootfs_obj == 0 ? strlen(current_rootpool) : + strlen(current_rootpool) + 11; + + out[0] = '\0'; + while (token = strstr(in, "$ZFS-BOOTFS")) { + + if ((outlen += blen) > MAX_CMDLINE) { + errnum = ERR_WONT_FIT; + return (1); + } + + token[0] = '\0'; + grub_sprintf(tmpout, "%s", in); + token[0] = '$'; + in = token + 11; /* skip over $ZFS-BOOTFS */ + tmpout = out + strlen(out); + + /* Note: %u only fits 32 bit integer; */ + if (current_bootfs_obj > 0) + grub_sprintf(tmpout, "zfs-bootfs=%s/%u", + current_rootpool, current_bootfs_obj); + else + grub_sprintf(tmpout, "zfs-bootfs=%s", + current_rootpool); + tmpout = out + strlen(out); + } + + /* + * Check to see if 'zfs-bootfs' was explicitly specified on the command + * line so that we can insert the 'bootpath' property. + */ + if ((tmpout == out) && (token = strstr(in, "zfs-bootfs")) != NULL) { + token[0] = '\0'; + grub_strcpy(tmpout, in); + token[0] = 'z'; + in = token; + + tmpout = out + strlen(out); + postcomma = 1; + } + + /* + * Set the 'bootpath' property if a ZFS dataset was specified, either + * through '$ZFS-BOOTFS' or an explicit 'zfs-bootfs' setting. + */ + if (tmpout != out) { + if ((outlen += 12 + strlen(current_bootpath)) > MAX_CMDLINE) { + errnum = ERR_WONT_FIT; + return (1); + } + grub_sprintf(tmpout, + postcomma ? "bootpath=\"%s\"," : ",bootpath=\"%s\"", + current_bootpath); + tmpout = out + strlen(out); + } + if (strlen(current_devid)) { + if ((outlen += 13 + strlen(current_devid)) > MAX_CMDLINE) { + errnum = ERR_WONT_FIT; + return (1); + } + grub_sprintf(tmpout, + postcomma ? "diskdevid=\"%s\"," : ",diskdevid=\"%s\"", + current_devid); + } + + strncat(out, in, MAX_CMDLINE); + return (0); +} + +/* kernel */ +static int +kernel_func (char *arg, int flags) +{ + int len; + kernel_t suggested_type = KERNEL_TYPE_NONE; + unsigned long load_flags = 0; + +#ifndef AUTO_LINUX_MEM_OPT + load_flags |= KERNEL_LOAD_NO_MEM_OPTION; +#endif + + /* Deal with GNU-style long options. */ + while (1) + { + /* If the option `--type=TYPE' is specified, convert the string to + a kernel type. */ + if (grub_memcmp (arg, "--type=", 7) == 0) + { + arg += 7; + + if (grub_memcmp (arg, "netbsd", 6) == 0) + suggested_type = KERNEL_TYPE_NETBSD; + else if (grub_memcmp (arg, "freebsd", 7) == 0) + suggested_type = KERNEL_TYPE_FREEBSD; + else if (grub_memcmp (arg, "openbsd", 7) == 0) + /* XXX: For now, OpenBSD is identical to NetBSD, from GRUB's + point of view. */ + suggested_type = KERNEL_TYPE_NETBSD; + else if (grub_memcmp (arg, "linux", 5) == 0) + suggested_type = KERNEL_TYPE_LINUX; + else if (grub_memcmp (arg, "biglinux", 8) == 0) + suggested_type = KERNEL_TYPE_BIG_LINUX; + else if (grub_memcmp (arg, "multiboot", 9) == 0) + suggested_type = KERNEL_TYPE_MULTIBOOT; + else + { + errnum = ERR_BAD_ARGUMENT; + return 1; + } + } + /* If the `--no-mem-option' is specified, don't pass a Linux's mem + option automatically. If the kernel is another type, this flag + has no effect. */ + else if (grub_memcmp (arg, "--no-mem-option", 15) == 0) + load_flags |= KERNEL_LOAD_NO_MEM_OPTION; + else + break; + + /* Try the next. */ + arg = skip_to (0, arg); + } + + len = grub_strlen (arg); + + /* Reset MB_CMDLINE. */ + mb_cmdline = (char *) MB_CMDLINE_BUF; + if (len + 1 > MB_CMDLINE_BUFLEN) + { + errnum = ERR_WONT_FIT; + return 1; + } + + /* Copy the command-line to MB_CMDLINE. */ + grub_memmove (mb_cmdline, arg, len + 1); + kernel_type = load_image (arg, mb_cmdline, suggested_type, load_flags); + if (kernel_type == KERNEL_TYPE_NONE) + return 1; + + mb_cmdline += grub_strlen(mb_cmdline) + 1; + return 0; +} + +static struct builtin builtin_kernel = +{ + "kernel", + kernel_func, + BUILTIN_CMDLINE | BUILTIN_HELP_LIST, + "kernel [--no-mem-option] [--type=TYPE] FILE [ARG ...]", + "Attempt to load the primary boot image from FILE. The rest of the" + " line is passed verbatim as the \"kernel command line\". Any modules" + " must be reloaded after using this command. The option --type is used" + " to suggest what type of kernel to be loaded. TYPE must be either of" + " \"netbsd\", \"freebsd\", \"openbsd\", \"linux\", \"biglinux\" and" + " \"multiboot\". The option --no-mem-option tells GRUB not to pass a" + " Linux's mem option automatically." +}; + +int +min_mem64_func(char *arg, int flags) +{ + if (!safe_parse_maxint(&arg, &min_mem64)) + return (1); +} + +static struct builtin builtin_min_mem64 = +{ + "min_mem64", + min_mem64_func, + BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_SCRIPT | BUILTIN_HELP_LIST, + "min_mem64 ", + "Sets minimum memory (in MB) required for $ISADIR to expand to amd64, " + "even on 64-bit capable hardware." +}; + +int +check_min_mem64() +{ + if (min_mem64 == 0) + return (1); + + if ((mbi.mem_upper / 10240) * 11 >= min_mem64) + return (1); + + return (0); +} + +static int detect_target_operating_mode(); + +int +amd64_config_cpu(void) +{ + struct amd64_cpuid_regs __vcr, *vcr = &__vcr; + uint32_t maxeax; + uint32_t max_maxeax = 0x100; + char vendor[13]; + int isamd64 = 0; + uint32_t stdfeatures = 0, xtdfeatures = 0; + uint64_t efer; + + /* + * This check may seem silly, but if the C preprocesor symbol __amd64 + * is #defined during compilation, something that may outwardly seem + * like a good idea, uts/common/sys/isa_defs.h will #define _LP64, + * which will cause uts/common/sys/int_types.h to typedef uint64_t as + * an unsigned long - which is only 4 bytes in size when using a 32-bit + * compiler. + * + * If that happens, all the page table translation routines will fail + * horribly, so check the size of uint64_t just to insure some degree + * of sanity in future operations. + */ + /*LINTED [sizeof result is invarient]*/ + if (sizeof (uint64_t) != 8) + prom_panic("grub compiled improperly, unable to boot " + "64-bit AMD64 executables"); + + /* + * If the CPU doesn't support the CPUID instruction, it's definitely + * not an AMD64. + */ + if (amd64_cpuid_supported() == 0) + return (0); + + amd64_cpuid_insn(0, vcr); + + maxeax = vcr->r_eax; + { + /*LINTED [vendor string from cpuid data]*/ + uint32_t *iptr = (uint32_t *)vendor; + + *iptr++ = vcr->r_ebx; + *iptr++ = vcr->r_edx; + *iptr++ = vcr->r_ecx; + + vendor[12] = '\0'; + } + + if (maxeax > max_maxeax) { + grub_printf("cpu: warning, maxeax was 0x%x -> 0x%x\n", + maxeax, max_maxeax); + maxeax = max_maxeax; + } + + if (maxeax < 1) + return (0); /* no additional functions, not an AMD64 */ + else { + uint_t family, model, step; + + amd64_cpuid_insn(1, vcr); + + /* + * All AMD64/IA32e processors technically SHOULD report + * themselves as being in family 0xf, but for some reason + * Simics doesn't, and this may change in the future, so + * don't error out if it's not true. + */ + if ((family = BITX(vcr->r_eax, 11, 8)) == 0xf) + family += BITX(vcr->r_eax, 27, 20); + + if ((model = BITX(vcr->r_eax, 7, 4)) == 0xf) + model += BITX(vcr->r_eax, 19, 16) << 4; + step = BITX(vcr->r_eax, 3, 0); + + grub_printf("cpu: '%s' family %d model %d step %d\n", + vendor, family, model, step); + stdfeatures = vcr->r_edx; + } + + amd64_cpuid_insn(0x80000000, vcr); + + if (vcr->r_eax & 0x80000000) { + uint32_t xmaxeax = vcr->r_eax; + const uint32_t max_xmaxeax = 0x80000100; + + if (xmaxeax > max_xmaxeax) { + grub_printf("amd64: warning, xmaxeax was " + "0x%x -> 0x%x\n", xmaxeax, max_xmaxeax); + xmaxeax = max_xmaxeax; + } + + if (xmaxeax >= 0x80000001) { + amd64_cpuid_insn(0x80000001, vcr); + xtdfeatures = vcr->r_edx; + } + } + + if (BITX(xtdfeatures, 29, 29)) /* long mode */ + isamd64++; + else + grub_printf("amd64: CPU does NOT support long mode\n"); + + if (!BITX(stdfeatures, 0, 0)) { + grub_printf("amd64: CPU does NOT support FPU\n"); + isamd64--; + } + + if (!BITX(stdfeatures, 4, 4)) { + grub_printf("amd64: CPU does NOT support TSC\n"); + isamd64--; + } + + if (!BITX(stdfeatures, 5, 5)) { + grub_printf("amd64: CPU does NOT support MSRs\n"); + isamd64--; + } + + if (!BITX(stdfeatures, 6, 6)) { + grub_printf("amd64: CPU does NOT support PAE\n"); + isamd64--; + } + + if (!BITX(stdfeatures, 8, 8)) { + grub_printf("amd64: CPU does NOT support CX8\n"); + isamd64--; + } + + if (!BITX(stdfeatures, 13, 13)) { + grub_printf("amd64: CPU does NOT support PGE\n"); + isamd64--; + } + + if (!BITX(stdfeatures, 19, 19)) { + grub_printf("amd64: CPU does NOT support CLFSH\n"); + isamd64--; + } + + if (!BITX(stdfeatures, 23, 23)) { + grub_printf("amd64: CPU does NOT support MMX\n"); + isamd64--; + } + + if (!BITX(stdfeatures, 24, 24)) { + grub_printf("amd64: CPU does NOT support FXSR\n"); + isamd64--; + } + + if (!BITX(stdfeatures, 25, 25)) { + grub_printf("amd64: CPU does NOT support SSE\n"); + isamd64--; + } + + if (!BITX(stdfeatures, 26, 26)) { + grub_printf("amd64: CPU does NOT support SSE2\n"); + isamd64--; + } + + if (isamd64 < 1) { + grub_printf("amd64: CPU does not support amd64 executables.\n"); + return (0); + } + + amd64_rdmsr(MSR_AMD_EFER, &efer); + if (efer & AMD_EFER_SCE) + grub_printf("amd64: EFER_SCE (syscall/sysret) already " + "enabled\n"); + if (efer & AMD_EFER_NXE) + grub_printf("amd64: EFER_NXE (no-exec prot) already enabled\n"); + if (efer & AMD_EFER_LME) + grub_printf("amd64: EFER_LME (long mode) already enabled\n"); + + return (detect_target_operating_mode()); +} + +static int +detect_target_operating_mode() +{ + int ret, ah; + + ah = get_target_operating_mode(); + + ah = ah >> 8; + + /* XXX still need to pass back the return from the call */ + ret = 0; + + if (ah == 0x86 && (ret & CB) != 0) { + grub_printf("[BIOS 'Detect Target Operating Mode' " + "callback unsupported on this platform]\n"); + return (1); /* unsupported, ignore */ + } + + if (ah == 0x0 && (ret & CB) == 0) { + grub_printf("[BIOS accepted mixed-mode target setting!]\n"); + return (1); /* told the bios what we're up to */ + } + + if (ah == 0 && ret & CB) { + grub_printf("fatal: BIOS reports this machine CANNOT run in " + "mixed 32/64-bit mode!\n"); + return (0); + } + + grub_printf("warning: BIOS Detect Target Operating Mode callback " + "confused.\n %%ax >> 8 = 0x%x, carry = %d\n", ah, + ret & CB ? 1 : 0); + + return (1); +} + + +int +isamd64() +{ + static int ret = -1; + + if (ret == -1) + ret = amd64_config_cpu(); + + return (ret); +} + +static void +expand_arch (char *arg, char *newarg) +{ + char *index; + + newarg[0] = '\0'; + + while ((index = strstr(arg, "$ISADIR")) != NULL) { + + index[0] = '\0'; + strncat(newarg, arg, MAX_CMDLINE); + index[0] = '$'; + + if (isamd64() && check_min_mem64()) + strncat(newarg, "amd64", MAX_CMDLINE); + + arg = index + 7; + } + + strncat(newarg, arg, MAX_CMDLINE); + return; +} + +/* kernel$ */ +static int +kernel_dollar_func (char *arg, int flags) +{ + char newarg[MAX_CMDLINE]; /* everything boils down to MAX_CMDLINE */ + + grub_printf("loading '%s' ...\n", arg); + expand_arch(arg, newarg); + + if (kernel_func(newarg, flags)) + return (1); + + mb_cmdline = (char *)MB_CMDLINE_BUF; + if (expand_dollar_bootfs(newarg, mb_cmdline)) + return (1); + + grub_printf("'%s' is loaded\n", mb_cmdline); + mb_cmdline += grub_strlen(mb_cmdline) + 1; + + return (0); +} + +static struct builtin builtin_kernel_dollar = +{ + "kernel$", + kernel_dollar_func, + BUILTIN_CMDLINE | BUILTIN_HELP_LIST, + "kernel$ [--no-mem-option] [--type=TYPE] FILE [ARG ...]", + " Just like kernel, but with $ISADIR expansion." +}; + + +/* lock */ +static int +lock_func (char *arg, int flags) +{ + if (! auth && password) + { + errnum = ERR_PRIVILEGED; + return 1; + } + + return 0; +} + +static struct builtin builtin_lock = +{ + "lock", + lock_func, + BUILTIN_CMDLINE, + "lock", + "Break a command execution unless the user is authenticated." +}; + + +/* makeactive */ +static int +makeactive_func (char *arg, int flags) +{ + if (! make_saved_active ()) + return 1; + + return 0; +} + +static struct builtin builtin_makeactive = +{ + "makeactive", + makeactive_func, + BUILTIN_CMDLINE | BUILTIN_HELP_LIST, + "makeactive", + "Set the active partition on the root disk to GRUB's root device." + " This command is limited to _primary_ PC partitions on a hard disk." +}; + + +/* map */ +/* Map FROM_DRIVE to TO_DRIVE. */ +static int +map_func (char *arg, int flags) +{ + char *to_drive; + char *from_drive; + unsigned long to, from; + int i; + + to_drive = arg; + from_drive = skip_to (0, arg); + + /* Get the drive number for TO_DRIVE. */ + set_device (to_drive); + if (errnum) + return 1; + to = current_drive; + + /* Get the drive number for FROM_DRIVE. */ + set_device (from_drive); + if (errnum) + return 1; + from = current_drive; + + /* Search for an empty slot in BIOS_DRIVE_MAP. */ + for (i = 0; i < DRIVE_MAP_SIZE; i++) + { + /* Perhaps the user wants to override the map. */ + if ((bios_drive_map[i] & 0xff) == from) + break; + + if (! bios_drive_map[i]) + break; + } + + if (i == DRIVE_MAP_SIZE) + { + errnum = ERR_WONT_FIT; + return 1; + } + + if (to == from) + /* If TO is equal to FROM, delete the entry. */ + grub_memmove ((char *) &bios_drive_map[i], (char *) &bios_drive_map[i + 1], + sizeof (unsigned short) * (DRIVE_MAP_SIZE - i)); + else + bios_drive_map[i] = from | (to << 8); + + return 0; +} + +static struct builtin builtin_map = +{ + "map", + map_func, + BUILTIN_CMDLINE | BUILTIN_HELP_LIST, + "map TO_DRIVE FROM_DRIVE", + "Map the drive FROM_DRIVE to the drive TO_DRIVE. This is necessary" + " when you chain-load some operating systems, such as DOS, if such an" + " OS resides at a non-first drive." +}; + + +#ifdef USE_MD5_PASSWORDS +/* md5crypt */ +static int +md5crypt_func (char *arg, int flags) +{ + char crypted[36]; + char key[32]; + unsigned int seed; + int i; + const char *const seedchars = + "./0123456789ABCDEFGHIJKLMNOPQRST" + "UVWXYZabcdefghijklmnopqrstuvwxyz"; + + /* First create a salt. */ + + /* The magical prefix. */ + grub_memset (crypted, 0, sizeof (crypted)); + grub_memmove (crypted, "$1$", 3); + + /* Create the length of a salt. */ + seed = currticks (); + + /* Generate a salt. */ + for (i = 0; i < 8 && seed; i++) + { + /* FIXME: This should be more random. */ + crypted[3 + i] = seedchars[seed & 0x3f]; + seed >>= 6; + } + + /* A salt must be terminated with `$', if it is less than 8 chars. */ + crypted[3 + i] = '$'; + +#ifdef DEBUG_MD5CRYPT + grub_printf ("salt = %s\n", crypted); +#endif + + /* Get a password. */ + grub_memset (key, 0, sizeof (key)); + get_cmdline ("Password: ", key, sizeof (key) - 1, '*', 0); + + /* Crypt the key. */ + make_md5_password (key, crypted); + + grub_printf ("Encrypted: %s\n", crypted); + return 0; +} + +static struct builtin builtin_md5crypt = +{ + "md5crypt", + md5crypt_func, + BUILTIN_CMDLINE | BUILTIN_HELP_LIST, + "md5crypt", + "Generate a password in MD5 format." +}; +#endif /* USE_MD5_PASSWORDS */ + + +/* module */ +static int +module_func (char *arg, int flags) +{ + int len = grub_strlen (arg); + + switch (kernel_type) + { + case KERNEL_TYPE_MULTIBOOT: + if (mb_cmdline + len + 1 > (char *) MB_CMDLINE_BUF + MB_CMDLINE_BUFLEN) + { + errnum = ERR_WONT_FIT; + return 1; + } + grub_memmove (mb_cmdline, arg, len + 1); + if (! load_module (arg, mb_cmdline)) + return 1; + + mb_cmdline += grub_strlen(mb_cmdline) + 1; + break; + + case KERNEL_TYPE_LINUX: + case KERNEL_TYPE_BIG_LINUX: + if (! load_initrd (arg)) + return 1; + break; + + default: + errnum = ERR_NEED_MB_KERNEL; + return 1; + } + + return 0; +} + +static struct builtin builtin_module = +{ + "module", + module_func, + BUILTIN_CMDLINE | BUILTIN_HELP_LIST, + "module FILE [ARG ...]", + "Load a boot module FILE for a Multiboot format boot image (no" + " interpretation of the file contents is made, so users of this" + " command must know what the kernel in question expects). The" + " rest of the line is passed as the \"module command line\", like" + " the `kernel' command." +}; + +/* module$ */ +static int +module_dollar_func (char *arg, int flags) +{ + char newarg[MAX_CMDLINE]; /* everything boils down to MAX_CMDLINE */ + char *cmdline_sav; + + grub_printf("loading '%s' ...\n", arg); + expand_arch(arg, newarg); + + cmdline_sav = (char *)mb_cmdline; + if (module_func(newarg, flags)) + return (1); + + if (expand_dollar_bootfs(newarg, cmdline_sav)) + return (1); + + grub_printf("'%s' is loaded\n", (char *)cmdline_sav); + mb_cmdline += grub_strlen(cmdline_sav) + 1; + + return (0); +} + +static struct builtin builtin_module_dollar = +{ + "module$", + module_dollar_func, + BUILTIN_CMDLINE | BUILTIN_HELP_LIST, + "module FILE [ARG ...]", + " Just like module, but with $ISADIR expansion." +}; + + +/* modulenounzip */ +static int +modulenounzip_func (char *arg, int flags) +{ + int ret; + +#ifndef NO_DECOMPRESSION + no_decompression = 1; +#endif + + ret = module_func (arg, flags); + +#ifndef NO_DECOMPRESSION + no_decompression = 0; +#endif + + return ret; +} + +static struct builtin builtin_modulenounzip = +{ + "modulenounzip", + modulenounzip_func, + BUILTIN_CMDLINE | BUILTIN_HELP_LIST, + "modulenounzip FILE [ARG ...]", + "The same as `module', except that automatic decompression is" + " disabled." +}; + + +/* pager [on|off] */ +static int +pager_func (char *arg, int flags) +{ + /* If ARG is empty, toggle the flag. */ + if (! *arg) + use_pager = ! use_pager; + else if (grub_memcmp (arg, "on", 2) == 0) + use_pager = 1; + else if (grub_memcmp (arg, "off", 3) == 0) + use_pager = 0; + else + { + errnum = ERR_BAD_ARGUMENT; + return 1; + } + + grub_printf (" Internal pager is now %s\n", use_pager ? "on" : "off"); + return 0; +} + +static struct builtin builtin_pager = +{ + "pager", + pager_func, + BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_HELP_LIST, + "pager [FLAG]", + "Toggle pager mode with no argument. If FLAG is given and its value" + " is `on', turn on the mode. If FLAG is `off', turn off the mode." +}; + + +/* partnew PART TYPE START LEN */ +static int +partnew_func (char *arg, int flags) +{ + int new_type, new_start, new_len; + int start_cl, start_ch, start_dh; + int end_cl, end_ch, end_dh; + int entry; + char mbr[512]; + + /* Convert a LBA address to a CHS address in the INT 13 format. */ + auto void lba_to_chs (int lba, int *cl, int *ch, int *dh); + void lba_to_chs (int lba, int *cl, int *ch, int *dh) + { + int cylinder, head, sector; + + sector = lba % buf_geom.sectors + 1; + head = (lba / buf_geom.sectors) % buf_geom.heads; + cylinder = lba / (buf_geom.sectors * buf_geom.heads); + + if (cylinder >= buf_geom.cylinders) + cylinder = buf_geom.cylinders - 1; + + *cl = sector | ((cylinder & 0x300) >> 2); + *ch = cylinder & 0xFF; + *dh = head; + } + + /* Get the drive and the partition. */ + if (! set_device (arg)) + return 1; + + /* The drive must be a hard disk. */ + if (! (current_drive & 0x80)) + { + errnum = ERR_BAD_ARGUMENT; + return 1; + } + + /* The partition must a primary partition. */ + if ((current_partition >> 16) > 3 + || (current_partition & 0xFFFF) != 0xFFFF) + { + errnum = ERR_BAD_ARGUMENT; + return 1; + } + + entry = current_partition >> 16; + + /* Get the new partition type. */ + arg = skip_to (0, arg); + if (! safe_parse_maxint (&arg, &new_type)) + return 1; + + /* The partition type is unsigned char. */ + if (new_type > 0xFF) + { + errnum = ERR_BAD_ARGUMENT; + return 1; + } + + /* Get the new partition start. */ + arg = skip_to (0, arg); + if (! safe_parse_maxint (&arg, &new_start)) + return 1; + + /* Get the new partition length. */ + arg = skip_to (0, arg); + if (! safe_parse_maxint (&arg, &new_len)) + return 1; + + /* Read the MBR. */ + if (! rawread (current_drive, 0, 0, SECTOR_SIZE, mbr)) + return 1; + + /* Check if the new partition will fit in the disk. */ + if (new_start + new_len > buf_geom.total_sectors) + { + errnum = ERR_GEOM; + return 1; + } + + /* Store the partition information in the MBR. */ + lba_to_chs (new_start, &start_cl, &start_ch, &start_dh); + lba_to_chs (new_start + new_len - 1, &end_cl, &end_ch, &end_dh); + + PC_SLICE_FLAG (mbr, entry) = 0; + PC_SLICE_HEAD (mbr, entry) = start_dh; + PC_SLICE_SEC (mbr, entry) = start_cl; + PC_SLICE_CYL (mbr, entry) = start_ch; + PC_SLICE_TYPE (mbr, entry) = new_type; + PC_SLICE_EHEAD (mbr, entry) = end_dh; + PC_SLICE_ESEC (mbr, entry) = end_cl; + PC_SLICE_ECYL (mbr, entry) = end_ch; + PC_SLICE_START (mbr, entry) = new_start; + PC_SLICE_LENGTH (mbr, entry) = new_len; + + /* Make sure that the MBR has a valid signature. */ + PC_MBR_SIG (mbr) = PC_MBR_SIGNATURE; + + /* Write back the MBR to the disk. */ + buf_track = BUF_CACHE_INVALID; + if (! rawwrite (current_drive, 0, mbr)) + return 1; + + return 0; +} + +static struct builtin builtin_partnew = +{ + "partnew", + partnew_func, + BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_HELP_LIST, + "partnew PART TYPE START LEN", + "Create a primary partition at the starting address START with the" + " length LEN, with the type TYPE. START and LEN are in sector units." +}; + + +/* parttype PART TYPE */ +static int +parttype_func (char *arg, int flags) +{ + int new_type; + unsigned long part = 0xFFFFFF; + unsigned long start, len, offset, ext_offset; + int entry, type; + char mbr[512]; + + /* Get the drive and the partition. */ + if (! set_device (arg)) + return 1; + + /* The drive must be a hard disk. */ + if (! (current_drive & 0x80)) + { + errnum = ERR_BAD_ARGUMENT; + return 1; + } + + /* The partition must be a PC slice. */ + if ((current_partition >> 16) == 0xFF + || (current_partition & 0xFFFF) != 0xFFFF) + { + errnum = ERR_BAD_ARGUMENT; + return 1; + } + + /* Get the new partition type. */ + arg = skip_to (0, arg); + if (! safe_parse_maxint (&arg, &new_type)) + return 1; + + /* The partition type is unsigned char. */ + if (new_type > 0xFF) + { + errnum = ERR_BAD_ARGUMENT; + return 1; + } + + /* Look for the partition. */ + while (next_partition (current_drive, 0xFFFFFF, &part, &type, + &start, &len, &offset, &entry, + &ext_offset, mbr)) + { + if (part == current_partition) + { + /* Found. */ + + /* Set the type to NEW_TYPE. */ + PC_SLICE_TYPE (mbr, entry) = new_type; + + /* Write back the MBR to the disk. */ + buf_track = BUF_CACHE_INVALID; + if (! rawwrite (current_drive, offset, mbr)) + return 1; + + /* Succeed. */ + return 0; + } + } + + /* The partition was not found. ERRNUM was set by next_partition. */ + return 1; +} + +static struct builtin builtin_parttype = +{ + "parttype", + parttype_func, + BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_HELP_LIST, + "parttype PART TYPE", + "Change the type of the partition PART to TYPE." +}; + + +/* password */ +static int +password_func (char *arg, int flags) +{ + int len; + password_t type = PASSWORD_PLAIN; + +#ifdef USE_MD5_PASSWORDS + if (grub_memcmp (arg, "--md5", 5) == 0) + { + type = PASSWORD_MD5; + arg = skip_to (0, arg); + } +#endif + if (grub_memcmp (arg, "--", 2) == 0) + { + type = PASSWORD_UNSUPPORTED; + arg = skip_to (0, arg); + } + + if ((flags & (BUILTIN_CMDLINE | BUILTIN_SCRIPT)) != 0) + { + /* Do password check! */ + char entered[32]; + + /* Wipe out any previously entered password */ + entered[0] = 0; + get_cmdline ("Password: ", entered, 31, '*', 0); + + nul_terminate (arg); + if (check_password (entered, arg, type) != 0) + { + errnum = ERR_PRIVILEGED; + return 1; + } + } + else + { + len = grub_strlen (arg); + + /* PASSWORD NUL NUL ... */ + if (len + 2 > PASSWORD_BUFLEN) + { + errnum = ERR_WONT_FIT; + return 1; + } + + /* Copy the password and clear the rest of the buffer. */ + password = (char *) PASSWORD_BUF; + grub_memmove (password, arg, len); + grub_memset (password + len, 0, PASSWORD_BUFLEN - len); + password_type = type; + } + return 0; +} + +static struct builtin builtin_password = +{ + "password", + password_func, + BUILTIN_MENU | BUILTIN_CMDLINE | BUILTIN_NO_ECHO, + "password [--md5] PASSWD [FILE]", + "If used in the first section of a menu file, disable all" + " interactive editing control (menu entry editor and" + " command line). If the password PASSWD is entered, it loads the" + " FILE as a new config file and restarts the GRUB Stage 2. If you" + " omit the argument FILE, then GRUB just unlocks privileged" + " instructions. You can also use it in the script section, in" + " which case it will ask for the password, before continueing." + " The option --md5 tells GRUB that PASSWD is encrypted with" + " md5crypt." +}; + + +/* pause */ +static int +pause_func (char *arg, int flags) +{ + printf("%s\n", arg); + + /* If ESC is returned, then abort this entry. */ + if (ASCII_CHAR (getkey ()) == 27) + return 1; + + return 0; +} + +static struct builtin builtin_pause = +{ + "pause", + pause_func, + BUILTIN_CMDLINE | BUILTIN_NO_ECHO, + "pause [MESSAGE ...]", + "Print MESSAGE, then wait until a key is pressed." +}; + + +#ifdef GRUB_UTIL +/* quit */ +static int +quit_func (char *arg, int flags) +{ + stop (); + + /* Never reach here. */ + return 0; +} + +static struct builtin builtin_quit = +{ + "quit", + quit_func, + BUILTIN_CMDLINE | BUILTIN_HELP_LIST, + "quit", + "Exit from the GRUB shell." +}; +#endif /* GRUB_UTIL */ + + +#ifdef SUPPORT_NETBOOT +/* rarp */ +static int +rarp_func (char *arg, int flags) +{ + if (! rarp ()) + { + if (errnum == ERR_NONE) + errnum = ERR_DEV_VALUES; + + return 1; + } + + /* Notify the configuration. */ + print_network_configuration (); + return 0; +} + +static struct builtin builtin_rarp = +{ + "rarp", + rarp_func, + BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_HELP_LIST, + "rarp", + "Initialize a network device via RARP." +}; +#endif /* SUPPORT_NETBOOT */ + + +static int +read_func (char *arg, int flags) +{ + int addr; + + if (! safe_parse_maxint (&arg, &addr)) + return 1; + + grub_printf ("Address 0x%x: Value 0x%x\n", + addr, *((unsigned *) RAW_ADDR (addr))); + return 0; +} + +static struct builtin builtin_read = +{ + "read", + read_func, + BUILTIN_CMDLINE, + "read ADDR", + "Read a 32-bit value from memory at address ADDR and" + " display it in hex format." +}; + + +/* reboot */ +static int +reboot_func (char *arg, int flags) +{ + grub_reboot (); + + /* Never reach here. */ + return 1; +} + +static struct builtin builtin_reboot = +{ + "reboot", + reboot_func, + BUILTIN_CMDLINE | BUILTIN_HELP_LIST, + "reboot", + "Reboot your system." +}; + + +/* Print the root device information. */ +static void +print_root_device (void) +{ + if (saved_drive == NETWORK_DRIVE) + { + /* Network drive. */ + grub_printf (" (nd):"); + } + else if (saved_drive & 0x80) + { + /* Hard disk drive. */ + grub_printf (" (hd%d", saved_drive - 0x80); + + if ((saved_partition & 0xFF0000) != 0xFF0000) + grub_printf (",%d", saved_partition >> 16); + + if ((saved_partition & 0x00FF00) != 0x00FF00) + grub_printf (",%c", ((saved_partition >> 8) & 0xFF) + 'a'); + + grub_printf ("):"); + } + else + { + /* Floppy disk drive. */ + grub_printf (" (fd%d):", saved_drive); + } + + /* Print the filesystem information. */ + current_partition = saved_partition; + current_drive = saved_drive; + print_fsys_type (); +} + +static int +real_root_func (char *arg, int attempt_mount) +{ + int hdbias = 0; + char *biasptr; + char *next; + + /* If ARG is empty, just print the current root device. */ + if (! *arg) + { + print_root_device (); + return 0; + } + + /* Call set_device to get the drive and the partition in ARG. */ + next = set_device (arg); + if (! next) + return 1; + + /* Ignore ERR_FSYS_MOUNT. */ + if (attempt_mount) + { + if (! open_device () && errnum != ERR_FSYS_MOUNT) + return 1; + } + else + { + /* This is necessary, because the location of a partition table + must be set appropriately. */ + if (open_partition ()) + { + set_bootdev (0); + if (errnum) + return 1; + } + } + + /* Clear ERRNUM. */ + errnum = 0; + saved_partition = current_partition; + saved_drive = current_drive; + + if (attempt_mount) + { + /* BSD and chainloading evil hacks !! */ + biasptr = skip_to (0, next); + safe_parse_maxint (&biasptr, &hdbias); + errnum = 0; + bootdev = set_bootdev (hdbias); + if (errnum) + return 1; + + /* Print the type of the filesystem. */ + print_fsys_type (); + } + + return 0; +} + +static int +root_func (char *arg, int flags) +{ + is_zfs_mount = 0; + return real_root_func (arg, 1); +} + +static struct builtin builtin_root = +{ + "root", + root_func, + BUILTIN_CMDLINE | BUILTIN_HELP_LIST, + "root [DEVICE [HDBIAS]]", + "Set the current \"root device\" to the device DEVICE, then" + " attempt to mount it to get the partition size (for passing the" + " partition descriptor in `ES:ESI', used by some chain-loaded" + " bootloaders), the BSD drive-type (for booting BSD kernels using" + " their native boot format), and correctly determine " + " the PC partition where a BSD sub-partition is located. The" + " optional HDBIAS parameter is a number to tell a BSD kernel" + " how many BIOS drive numbers are on controllers before the current" + " one. For example, if there is an IDE disk and a SCSI disk, and your" + " FreeBSD root partition is on the SCSI disk, then use a `1' for HDBIAS." +}; + + +/* findroot */ +static int +findroot_func (char *arg, int flags) +{ + int ret; + char root[32]; + + if (grub_strlen(arg) >= BOOTSIGN_ARGLEN) { + errnum = ERR_BAD_ARGUMENT; + return 1; + } + + if (arg[0] == '\0') { + errnum = ERR_BAD_ARGUMENT; + return 1; + } + + if (grub_strchr(arg, '/')) { + errnum = ERR_BAD_ARGUMENT; + return 1; + } + + find_best_root = 1; + best_drive = 0; + best_part = 0; + ret = find_common(arg, root, 1, flags); + if (ret != 0) + return (ret); + find_best_root = 0; + + return real_root_func (root, 1); +} + +static struct builtin builtin_findroot = +{ + "findroot", + findroot_func, + BUILTIN_CMDLINE | BUILTIN_HELP_LIST, + "findroot ", + "Searches across all partitions for the file name SIGNATURE." + " GRUB looks only in the directory /boot/grub/bootsign for the" + " filename and it stops as soon as it finds the first instance of" + " the file - so to be useful the name of the signature file must be" + " unique across all partitions. Once the signature file is found," + " GRUB invokes the \"root\" command on that partition." + " An optional partition and slice may be specified to optimize the search." +}; + + +/* + * COMMAND to override the default root filesystem for ZFS + * bootfs pool/fs + */ +static int +bootfs_func (char *arg, int flags) +{ + int hdbias = 0; + char *biasptr; + char *next; + + if (! *arg) { + if (current_bootfs[0] != '\0') + grub_printf ("The zfs boot filesystem is set to '%s'.\n", + current_bootfs); + else if (current_rootpool[0] != 0 && current_bootfs_obj != 0) + grub_printf("The zfs boot filesystem is .", + current_rootpool, current_bootfs_obj); + else + grub_printf ("The zfs boot filesystem will be derived from " + "the default bootfs pool property.\n"); + + return (1); + } + + /* Verify the zfs filesystem name */ + if (arg[0] == '/' || arg[0] == '\0') { + errnum = ERR_BAD_ARGUMENT; + return 0; + } + if (current_rootpool[0] != 0 && grub_strncmp(arg, + current_rootpool, strlen(current_rootpool))) { + errnum = ERR_BAD_ARGUMENT; + return 0; + } + + if (set_bootfs(arg) == 0) { + errnum = ERR_BAD_ARGUMENT; + return 0; + } + + return (1); +} + +static struct builtin builtin_bootfs = +{ + "bootfs", + bootfs_func, + BUILTIN_CMDLINE | BUILTIN_HELP_LIST, + "bootfs [ZFSBOOTFS]", + "Set the current zfs boot filesystem to ZFSBOOTFS (rootpool/rootfs)." +}; + + +/* rootnoverify */ +static int +rootnoverify_func (char *arg, int flags) +{ + return real_root_func (arg, 0); +} + +static struct builtin builtin_rootnoverify = +{ + "rootnoverify", + rootnoverify_func, + BUILTIN_CMDLINE | BUILTIN_HELP_LIST, + "rootnoverify [DEVICE [HDBIAS]]", + "Similar to `root', but don't attempt to mount the partition. This" + " is useful for when an OS is outside of the area of the disk that" + " GRUB can read, but setting the correct root device is still" + " desired. Note that the items mentioned in `root' which" + " derived from attempting the mount will NOT work correctly." +}; + + +/* savedefault */ +static int +savedefault_func (char *arg, int flags) +{ +#if !defined(SUPPORT_DISKLESS) && !defined(GRUB_UTIL) + unsigned long tmp_drive = saved_drive; + unsigned long tmp_partition = saved_partition; + char *default_file = (char *) DEFAULT_FILE_BUF; + char buf[10]; + char sect[SECTOR_SIZE]; + int entryno; + int sector_count = 0; + unsigned int saved_sectors[2]; + int saved_offsets[2]; + int saved_lengths[2]; + + /* not supported for zfs root */ + if (is_zfs_mount == 1) { + return (0); /* no-op */ + } + + /* Save sector information about at most two sectors. */ + auto void disk_read_savesect_func (unsigned int sector, int offset, + int length); + void disk_read_savesect_func (unsigned int sector, int offset, int length) + { + if (sector_count < 2) + { + saved_sectors[sector_count] = sector; + saved_offsets[sector_count] = offset; + saved_lengths[sector_count] = length; + } + sector_count++; + } + + /* This command is only useful when you boot an entry from the menu + interface. */ + if (! (flags & BUILTIN_SCRIPT)) + { + errnum = ERR_UNRECOGNIZED; + return 1; + } + + /* Determine a saved entry number. */ + if (*arg) + { + if (grub_memcmp (arg, "fallback", sizeof ("fallback") - 1) == 0) + { + int i; + int index = 0; + + for (i = 0; i < MAX_FALLBACK_ENTRIES; i++) + { + if (fallback_entries[i] < 0) + break; + if (fallback_entries[i] == current_entryno) + { + index = i + 1; + break; + } + } + + if (index >= MAX_FALLBACK_ENTRIES || fallback_entries[index] < 0) + { + /* This is the last. */ + errnum = ERR_BAD_ARGUMENT; + return 1; + } + + entryno = fallback_entries[index]; + } + else if (! safe_parse_maxint (&arg, &entryno)) + return 1; + } + else + entryno = current_entryno; + + /* Open the default file. */ + saved_drive = boot_drive; + saved_partition = install_partition; + if (grub_open (default_file)) + { + int len; + + disk_read_hook = disk_read_savesect_func; + len = grub_read (buf, sizeof (buf)); + disk_read_hook = 0; + grub_close (); + + if (len != sizeof (buf)) + { + /* This is too small. Do not modify the file manually, please! */ + errnum = ERR_READ; + goto fail; + } + + if (sector_count > 2) + { + /* Is this possible?! Too fragmented! */ + errnum = ERR_FSYS_CORRUPT; + goto fail; + } + + /* Set up a string to be written. */ + grub_memset (buf, '\n', sizeof (buf)); + grub_sprintf (buf, "%d", entryno); + + if (saved_lengths[0] < sizeof (buf)) + { + /* The file is anchored to another file and the first few bytes + are spanned in two sectors. Uggh... */ + if (! rawread (current_drive, saved_sectors[0], 0, SECTOR_SIZE, + sect)) + goto fail; + grub_memmove (sect + saved_offsets[0], buf, saved_lengths[0]); + if (! rawwrite (current_drive, saved_sectors[0], sect)) + goto fail; + + if (! rawread (current_drive, saved_sectors[1], 0, SECTOR_SIZE, + sect)) + goto fail; + grub_memmove (sect + saved_offsets[1], + buf + saved_lengths[0], + sizeof (buf) - saved_lengths[0]); + if (! rawwrite (current_drive, saved_sectors[1], sect)) + goto fail; + } + else + { + /* This is a simple case. It fits into a single sector. */ + if (! rawread (current_drive, saved_sectors[0], 0, SECTOR_SIZE, + sect)) + goto fail; + grub_memmove (sect + saved_offsets[0], buf, sizeof (buf)); + if (! rawwrite (current_drive, saved_sectors[0], sect)) + goto fail; + } + + /* Clear the cache. */ + buf_track = BUF_CACHE_INVALID; + } + + fail: + saved_drive = tmp_drive; + saved_partition = tmp_partition; + return errnum; +#else /* ! SUPPORT_DISKLESS && ! GRUB_UTIL */ + errnum = ERR_UNRECOGNIZED; + return 1; +#endif /* ! SUPPORT_DISKLESS && ! GRUB_UTIL */ +} + +static struct builtin builtin_savedefault = +{ + "savedefault", + savedefault_func, + BUILTIN_CMDLINE, + "savedefault [NUM | `fallback']", + "Save the current entry as the default boot entry if no argument is" + " specified. If a number is specified, this number is saved. If" + " `fallback' is used, next fallback entry is saved." +}; + + +#ifdef SUPPORT_SERIAL +/* serial */ +static int +serial_func (char *arg, int flags) +{ + unsigned short port = serial_hw_get_port (0); + unsigned int speed = 9600; + int word_len = UART_8BITS_WORD; + int parity = UART_NO_PARITY; + int stop_bit_len = UART_1_STOP_BIT; + + /* Process GNU-style long options. + FIXME: We should implement a getopt-like function, to avoid + duplications. */ + while (1) + { + if (grub_memcmp (arg, "--unit=", sizeof ("--unit=") - 1) == 0) + { + char *p = arg + sizeof ("--unit=") - 1; + int unit; + + if (! safe_parse_maxint (&p, &unit)) + return 1; + + if (unit < 0 || unit > 3) + { + errnum = ERR_DEV_VALUES; + return 1; + } + + port = serial_hw_get_port (unit); + } + else if (grub_memcmp (arg, "--speed=", sizeof ("--speed=") - 1) == 0) + { + char *p = arg + sizeof ("--speed=") - 1; + int num; + + if (! safe_parse_maxint (&p, &num)) + return 1; + + speed = (unsigned int) num; + } + else if (grub_memcmp (arg, "--port=", sizeof ("--port=") - 1) == 0) + { + char *p = arg + sizeof ("--port=") - 1; + int num; + + if (! safe_parse_maxint (&p, &num)) + return 1; + + port = (unsigned short) num; + } + else if (grub_memcmp (arg, "--word=", sizeof ("--word=") - 1) == 0) + { + char *p = arg + sizeof ("--word=") - 1; + int len; + + if (! safe_parse_maxint (&p, &len)) + return 1; + + switch (len) + { + case 5: word_len = UART_5BITS_WORD; break; + case 6: word_len = UART_6BITS_WORD; break; + case 7: word_len = UART_7BITS_WORD; break; + case 8: word_len = UART_8BITS_WORD; break; + default: + errnum = ERR_BAD_ARGUMENT; + return 1; + } + } + else if (grub_memcmp (arg, "--stop=", sizeof ("--stop=") - 1) == 0) + { + char *p = arg + sizeof ("--stop=") - 1; + int len; + + if (! safe_parse_maxint (&p, &len)) + return 1; + + switch (len) + { + case 1: stop_bit_len = UART_1_STOP_BIT; break; + case 2: stop_bit_len = UART_2_STOP_BITS; break; + default: + errnum = ERR_BAD_ARGUMENT; + return 1; + } + } + else if (grub_memcmp (arg, "--parity=", sizeof ("--parity=") - 1) == 0) + { + char *p = arg + sizeof ("--parity=") - 1; + + if (grub_memcmp (p, "no", sizeof ("no") - 1) == 0) + parity = UART_NO_PARITY; + else if (grub_memcmp (p, "odd", sizeof ("odd") - 1) == 0) + parity = UART_ODD_PARITY; + else if (grub_memcmp (p, "even", sizeof ("even") - 1) == 0) + parity = UART_EVEN_PARITY; + else + { + errnum = ERR_BAD_ARGUMENT; + return 1; + } + } +# ifdef GRUB_UTIL + /* In the grub shell, don't use any port number but open a tty + device instead. */ + else if (grub_memcmp (arg, "--device=", sizeof ("--device=") - 1) == 0) + { + char *p = arg + sizeof ("--device=") - 1; + char dev[256]; /* XXX */ + char *q = dev; + + while (*p && ! grub_isspace (*p)) + *q++ = *p++; + + *q = 0; + serial_set_device (dev); + } +# endif /* GRUB_UTIL */ + else + break; + + arg = skip_to (0, arg); + } + + /* Initialize the serial unit. */ + if (! serial_hw_init (port, speed, word_len, parity, stop_bit_len)) + { + errnum = ERR_BAD_ARGUMENT; + return 1; + } + + return 0; +} + +static struct builtin builtin_serial = +{ + "serial", + serial_func, + BUILTIN_MENU | BUILTIN_CMDLINE | BUILTIN_HELP_LIST, + "serial [--unit=UNIT] [--port=PORT] [--speed=SPEED] [--word=WORD] [--parity=PARITY] [--stop=STOP] [--device=DEV]", + "Initialize a serial device. UNIT is a digit that specifies which serial" + " device is used (e.g. 0 == COM1). If you need to specify the port number," + " set it by --port. SPEED is the DTE-DTE speed. WORD is the word length," + " PARITY is the type of parity, which is one of `no', `odd' and `even'." + " STOP is the length of stop bit(s). The option --device can be used only" + " in the grub shell, which specifies the file name of a tty device. The" + " default values are COM1, 9600, 8N1." +}; +#endif /* SUPPORT_SERIAL */ + + +/* setkey */ +struct keysym +{ + char *unshifted_name; /* the name in unshifted state */ + char *shifted_name; /* the name in shifted state */ + unsigned char unshifted_ascii; /* the ascii code in unshifted state */ + unsigned char shifted_ascii; /* the ascii code in shifted state */ + unsigned char keycode; /* keyboard scancode */ +}; + +/* The table for key symbols. If the "shifted" member of an entry is + NULL, the entry does not have shifted state. */ +static struct keysym keysym_table[] = +{ + {"escape", 0, 0x1b, 0, 0x01}, + {"1", "exclam", '1', '!', 0x02}, + {"2", "at", '2', '@', 0x03}, + {"3", "numbersign", '3', '#', 0x04}, + {"4", "dollar", '4', '$', 0x05}, + {"5", "percent", '5', '%', 0x06}, + {"6", "caret", '6', '^', 0x07}, + {"7", "ampersand", '7', '&', 0x08}, + {"8", "asterisk", '8', '*', 0x09}, + {"9", "parenleft", '9', '(', 0x0a}, + {"0", "parenright", '0', ')', 0x0b}, + {"minus", "underscore", '-', '_', 0x0c}, + {"equal", "plus", '=', '+', 0x0d}, + {"backspace", 0, '\b', 0, 0x0e}, + {"tab", 0, '\t', 0, 0x0f}, + {"q", "Q", 'q', 'Q', 0x10}, + {"w", "W", 'w', 'W', 0x11}, + {"e", "E", 'e', 'E', 0x12}, + {"r", "R", 'r', 'R', 0x13}, + {"t", "T", 't', 'T', 0x14}, + {"y", "Y", 'y', 'Y', 0x15}, + {"u", "U", 'u', 'U', 0x16}, + {"i", "I", 'i', 'I', 0x17}, + {"o", "O", 'o', 'O', 0x18}, + {"p", "P", 'p', 'P', 0x19}, + {"bracketleft", "braceleft", '[', '{', 0x1a}, + {"bracketright", "braceright", ']', '}', 0x1b}, + {"enter", 0, '\n', 0, 0x1c}, + {"control", 0, 0, 0, 0x1d}, + {"a", "A", 'a', 'A', 0x1e}, + {"s", "S", 's', 'S', 0x1f}, + {"d", "D", 'd', 'D', 0x20}, + {"f", "F", 'f', 'F', 0x21}, + {"g", "G", 'g', 'G', 0x22}, + {"h", "H", 'h', 'H', 0x23}, + {"j", "J", 'j', 'J', 0x24}, + {"k", "K", 'k', 'K', 0x25}, + {"l", "L", 'l', 'L', 0x26}, + {"semicolon", "colon", ';', ':', 0x27}, + {"quote", "doublequote", '\'', '"', 0x28}, + {"backquote", "tilde", '`', '~', 0x29}, + {"shift", 0, 0, 0, 0x2a}, + {"backslash", "bar", '\\', '|', 0x2b}, + {"z", "Z", 'z', 'Z', 0x2c}, + {"x", "X", 'x', 'X', 0x2d}, + {"c", "C", 'c', 'C', 0x2e}, + {"v", "V", 'v', 'V', 0x2f}, + {"b", "B", 'b', 'B', 0x30}, + {"n", "N", 'n', 'N', 0x31}, + {"m", "M", 'm', 'M', 0x32}, + {"comma", "less", ',', '<', 0x33}, + {"period", "greater", '.', '>', 0x34}, + {"slash", "question", '/', '?', 0x35}, + {"alt", 0, 0, 0, 0x38}, + {"space", 0, ' ', 0, 0x39}, + {"capslock", 0, 0, 0, 0x3a}, + {"F1", 0, 0, 0, 0x3b}, + {"F2", 0, 0, 0, 0x3c}, + {"F3", 0, 0, 0, 0x3d}, + {"F4", 0, 0, 0, 0x3e}, + {"F5", 0, 0, 0, 0x3f}, + {"F6", 0, 0, 0, 0x40}, + {"F7", 0, 0, 0, 0x41}, + {"F8", 0, 0, 0, 0x42}, + {"F9", 0, 0, 0, 0x43}, + {"F10", 0, 0, 0, 0x44}, + /* Caution: do not add NumLock here! we cannot deal with it properly. */ + {"delete", 0, 0x7f, 0, 0x53} +}; + +static int +setkey_func (char *arg, int flags) +{ + char *to_key, *from_key; + int to_code, from_code; + int map_in_interrupt = 0; + + auto int find_key_code (char *key); + auto int find_ascii_code (char *key); + + auto int find_key_code (char *key) + { + int i; + + for (i = 0; i < sizeof (keysym_table) / sizeof (keysym_table[0]); i++) + { + if (keysym_table[i].unshifted_name && + grub_strcmp (key, keysym_table[i].unshifted_name) == 0) + return keysym_table[i].keycode; + else if (keysym_table[i].shifted_name && + grub_strcmp (key, keysym_table[i].shifted_name) == 0) + return keysym_table[i].keycode; + } + + return 0; + } + + auto int find_ascii_code (char *key) + { + int i; + + for (i = 0; i < sizeof (keysym_table) / sizeof (keysym_table[0]); i++) + { + if (keysym_table[i].unshifted_name && + grub_strcmp (key, keysym_table[i].unshifted_name) == 0) + return keysym_table[i].unshifted_ascii; + else if (keysym_table[i].shifted_name && + grub_strcmp (key, keysym_table[i].shifted_name) == 0) + return keysym_table[i].shifted_ascii; + } + + return 0; + } + + to_key = arg; + from_key = skip_to (0, to_key); + + if (! *to_key) + { + /* If the user specifies no argument, reset the key mappings. */ + grub_memset (bios_key_map, 0, KEY_MAP_SIZE * sizeof (unsigned short)); + grub_memset (ascii_key_map, 0, KEY_MAP_SIZE * sizeof (unsigned short)); + + return 0; + } + else if (! *from_key) + { + /* The user must specify two arguments or zero argument. */ + errnum = ERR_BAD_ARGUMENT; + return 1; + } + + nul_terminate (to_key); + nul_terminate (from_key); + + to_code = find_ascii_code (to_key); + from_code = find_ascii_code (from_key); + if (! to_code || ! from_code) + { + map_in_interrupt = 1; + to_code = find_key_code (to_key); + from_code = find_key_code (from_key); + if (! to_code || ! from_code) + { + errnum = ERR_BAD_ARGUMENT; + return 1; + } + } + + if (map_in_interrupt) + { + int i; + + /* Find an empty slot. */ + for (i = 0; i < KEY_MAP_SIZE; i++) + { + if ((bios_key_map[i] & 0xff) == from_code) + /* Perhaps the user wants to overwrite the map. */ + break; + + if (! bios_key_map[i]) + break; + } + + if (i == KEY_MAP_SIZE) + { + errnum = ERR_WONT_FIT; + return 1; + } + + if (to_code == from_code) + /* If TO is equal to FROM, delete the entry. */ + grub_memmove ((char *) &bios_key_map[i], + (char *) &bios_key_map[i + 1], + sizeof (unsigned short) * (KEY_MAP_SIZE - i)); + else + bios_key_map[i] = (to_code << 8) | from_code; + + /* Ugly but should work. */ + unset_int15_handler (); + set_int15_handler (); + } + else + { + int i; + + /* Find an empty slot. */ + for (i = 0; i < KEY_MAP_SIZE; i++) + { + if ((ascii_key_map[i] & 0xff) == from_code) + /* Perhaps the user wants to overwrite the map. */ + break; + + if (! ascii_key_map[i]) + break; + } + + if (i == KEY_MAP_SIZE) + { + errnum = ERR_WONT_FIT; + return 1; + } + + if (to_code == from_code) + /* If TO is equal to FROM, delete the entry. */ + grub_memmove ((char *) &ascii_key_map[i], + (char *) &ascii_key_map[i + 1], + sizeof (unsigned short) * (KEY_MAP_SIZE - i)); + else + ascii_key_map[i] = (to_code << 8) | from_code; + } + + return 0; +} + +static struct builtin builtin_setkey = +{ + "setkey", + setkey_func, + BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_HELP_LIST, + "setkey [TO_KEY FROM_KEY]", + "Change the keyboard map. The key FROM_KEY is mapped to the key TO_KEY." + " A key must be an alphabet, a digit, or one of these: escape, exclam," + " at, numbersign, dollar, percent, caret, ampersand, asterisk, parenleft," + " parenright, minus, underscore, equal, plus, backspace, tab, bracketleft," + " braceleft, bracketright, braceright, enter, control, semicolon, colon," + " quote, doublequote, backquote, tilde, shift, backslash, bar, comma," + " less, period, greater, slash, question, alt, space, capslock, FX (X" + " is a digit), and delete. If no argument is specified, reset key" + " mappings." +}; + + +/* setup */ +static int +setup_func (char *arg, int flags) +{ + /* Point to the string of the installed drive/partition. */ + char *install_ptr; + /* Point to the string of the drive/parition where the GRUB images + reside. */ + char *image_ptr; + unsigned long installed_drive, installed_partition; + unsigned long image_drive, image_partition; + unsigned long tmp_drive, tmp_partition; + char stage1[64]; + char stage2[64]; + char config_filename[64]; + char real_config_filename[64]; + char cmd_arg[256]; + char device[16]; + char *buffer = (char *) RAW_ADDR (0x100000); + int is_force_lba = 0; + char *stage2_arg = 0; + char *prefix = 0; + + auto int check_file (char *file); + auto void sprint_device (int drive, int partition); + auto int embed_stage1_5 (char * stage1_5, int drive, int partition); + + /* Check if the file FILE exists like Autoconf. */ + int check_file (char *file) + { + int ret; + + grub_printf (" Checking if \"%s\" exists... ", file); + ret = grub_open (file); + if (ret) + { + grub_close (); + grub_printf ("yes\n"); + } + else + grub_printf ("no\n"); + + return ret; + } + + /* Construct a device name in DEVICE. */ + void sprint_device (int drive, int partition) + { + grub_sprintf (device, "(%cd%d", + (drive & 0x80) ? 'h' : 'f', + drive & ~0x80); + if ((partition & 0xFF0000) != 0xFF0000) + { + char tmp[16]; + grub_sprintf (tmp, ",%d", (partition >> 16) & 0xFF); + grub_strncat (device, tmp, 256); + } + if ((partition & 0x00FF00) != 0x00FF00) + { + char tmp[16]; + grub_sprintf (tmp, ",%c", 'a' + ((partition >> 8) & 0xFF)); + grub_strncat (device, tmp, 256); + } + grub_strncat (device, ")", 256); + } + + int embed_stage1_5 (char *stage1_5, int drive, int partition) + { + /* We install GRUB into the MBR, so try to embed the + Stage 1.5 in the sectors right after the MBR. */ + sprint_device (drive, partition); + grub_sprintf (cmd_arg, "%s %s", stage1_5, device); + + /* Notify what will be run. */ + grub_printf (" Running \"embed %s\"... ", cmd_arg); + + embed_func (cmd_arg, flags); + if (! errnum) + { + /* Construct the blocklist representation. */ + grub_sprintf (buffer, "%s%s", device, embed_info); + grub_printf ("succeeded\n"); + return 1; + } + else + { + grub_printf ("failed (this is not fatal)\n"); + return 0; + } + } + + struct stage1_5_map { + char *fsys; + char *name; + }; + struct stage1_5_map stage1_5_map[] = + { + {"ext2fs", "/e2fs_stage1_5"}, + {"fat", "/fat_stage1_5"}, + {"ufs2", "/ufs2_stage1_5"}, + {"ffs", "/ffs_stage1_5"}, + {"iso9660", "/iso9660_stage1_5"}, + {"jfs", "/jfs_stage1_5"}, + {"minix", "/minix_stage1_5"}, + {"reiserfs", "/reiserfs_stage1_5"}, + {"vstafs", "/vstafs_stage1_5"}, + {"xfs", "/xfs_stage1_5"}, + {"ufs", "/ufs_stage1_5"} + }; + + tmp_drive = saved_drive; + tmp_partition = saved_partition; + + /* Check if the user specifies --force-lba. */ + while (1) + { + if (grub_memcmp ("--force-lba", arg, sizeof ("--force-lba") - 1) == 0) + { + is_force_lba = 1; + arg = skip_to (0, arg); + } + else if (grub_memcmp ("--prefix=", arg, sizeof ("--prefix=") - 1) == 0) + { + prefix = arg + sizeof ("--prefix=") - 1; + arg = skip_to (0, arg); + nul_terminate (prefix); + } +#ifdef GRUB_UTIL + else if (grub_memcmp ("--stage2=", arg, sizeof ("--stage2=") - 1) == 0) + { + stage2_arg = arg; + arg = skip_to (0, arg); + nul_terminate (stage2_arg); + } +#endif /* GRUB_UTIL */ + else + break; + } + + install_ptr = arg; + image_ptr = skip_to (0, install_ptr); + + /* Make sure that INSTALL_PTR is valid. */ + set_device (install_ptr); + if (errnum) + return 1; + + installed_drive = current_drive; + installed_partition = current_partition; + + /* Mount the drive pointed by IMAGE_PTR. */ + if (*image_ptr) + { + /* If the drive/partition where the images reside is specified, + get the drive and the partition. */ + set_device (image_ptr); + if (errnum) + return 1; + } + else + { + /* If omitted, use SAVED_PARTITION and SAVED_DRIVE. */ + current_drive = saved_drive; + current_partition = saved_partition; + } + + image_drive = saved_drive = current_drive; + image_partition = saved_partition = current_partition; + + /* Open it. */ + if (! open_device ()) + goto fail; + + /* Check if stage1 exists. If the user doesn't specify the option + `--prefix', attempt /boot/grub and /grub. */ + /* NOTE: It is dangerous to run this command without `--prefix' in the + grub shell, since that affects `--stage2'. */ + if (! prefix) + { + prefix = "/boot/grub"; + grub_sprintf (stage1, "%s%s", prefix, "/stage1"); + if (! check_file (stage1)) + { + errnum = ERR_NONE; + prefix = "/grub"; + grub_sprintf (stage1, "%s%s", prefix, "/stage1"); + if (! check_file (stage1)) + goto fail; + } + } + else + { + grub_sprintf (stage1, "%s%s", prefix, "/stage1"); + if (! check_file (stage1)) + goto fail; + } + + /* The prefix was determined. */ + grub_sprintf (stage2, "%s%s", prefix, "/stage2"); + grub_sprintf (config_filename, "%s%s", prefix, "/menu.lst"); + *real_config_filename = 0; + + /* Check if stage2 exists. */ + if (! check_file (stage2)) + goto fail; + + { + char *fsys = fsys_table[fsys_type].name; + int i; + int size = sizeof (stage1_5_map) / sizeof (stage1_5_map[0]); + + /* Iterate finding the same filesystem name as FSYS. */ + for (i = 0; i < size; i++) + if (grub_strcmp (fsys, stage1_5_map[i].fsys) == 0) + { + /* OK, check if the Stage 1.5 exists. */ + char stage1_5[64]; + + grub_sprintf (stage1_5, "%s%s", prefix, stage1_5_map[i].name); + if (check_file (stage1_5)) + { + if (embed_stage1_5 (stage1_5, + installed_drive, installed_partition) + || embed_stage1_5 (stage1_5, + image_drive, image_partition)) + { + grub_strcpy (real_config_filename, config_filename); + sprint_device (image_drive, image_partition); + grub_sprintf (config_filename, "%s%s", device, stage2); + grub_strcpy (stage2, buffer); + } + } + errnum = 0; + break; + } + } + + /* Construct a string that is used by the command "install" as its + arguments. */ + sprint_device (installed_drive, installed_partition); + +#if 1 + /* Don't embed a drive number unnecessarily. */ + grub_sprintf (cmd_arg, "%s%s%s%s %s%s %s p %s %s", + is_force_lba? "--force-lba " : "", + stage2_arg? stage2_arg : "", + stage2_arg? " " : "", + stage1, + (installed_drive != image_drive) ? "d " : "", + device, + stage2, + config_filename, + real_config_filename); +#else /* NOT USED */ + /* This code was used, because we belived some BIOSes had a problem + that they didn't pass a booting drive correctly. It turned out, + however, stage1 could trash a booting drive when checking LBA support, + because some BIOSes modified the register %dx in INT 13H, AH=48H. + So it becamed unclear whether GRUB should use a pre-defined booting + drive or not. If the problem still exists, it would be necessary to + switch back to this code. */ + grub_sprintf (cmd_arg, "%s%s%s%s d %s %s p %s %s", + is_force_lba? "--force-lba " : "", + stage2_arg? stage2_arg : "", + stage2_arg? " " : "", + stage1, + device, + stage2, + config_filename, + real_config_filename); +#endif /* NOT USED */ + + /* Notify what will be run. */ + grub_printf (" Running \"install %s\"... ", cmd_arg); + + /* Make sure that SAVED_DRIVE and SAVED_PARTITION are identical + with IMAGE_DRIVE and IMAGE_PARTITION, respectively. */ + saved_drive = image_drive; + saved_partition = image_partition; + + /* Run the command. */ + if (! install_func (cmd_arg, flags)) + grub_printf ("succeeded\nDone.\n"); + else + grub_printf ("failed\n"); + + fail: + saved_drive = tmp_drive; + saved_partition = tmp_partition; + return errnum; +} + +static struct builtin builtin_setup = +{ + "setup", + setup_func, + BUILTIN_CMDLINE | BUILTIN_HELP_LIST, + "setup [--prefix=DIR] [--stage2=STAGE2_FILE] [--force-lba] INSTALL_DEVICE [IMAGE_DEVICE]", + "Set up the installation of GRUB automatically. This command uses" + " the more flexible command \"install\" in the backend and installs" + " GRUB into the device INSTALL_DEVICE. If IMAGE_DEVICE is specified," + " then find the GRUB images in the device IMAGE_DEVICE, otherwise" + " use the current \"root device\", which can be set by the command" + " \"root\". If you know that your BIOS should support LBA but GRUB" + " doesn't work in LBA mode, specify the option `--force-lba'." + " If you install GRUB under the grub shell and you cannot unmount the" + " partition where GRUB images reside, specify the option `--stage2'" + " to tell GRUB the file name under your OS." +}; + + +#if defined(SUPPORT_SERIAL) || defined(SUPPORT_HERCULES) || defined(SUPPORT_GRAPHICS) +/* terminal */ +static int +terminal_func (char *arg, int flags) +{ + /* The index of the default terminal in TERM_TABLE. */ + int default_term = -1; + struct term_entry *prev_term = current_term; + int to = -1; + int lines = 0; + int no_message = 0; + unsigned long term_flags = 0; + /* XXX: Assume less than 32 terminals. */ + unsigned long term_bitmap = 0; + + /* Get GNU-style long options. */ + while (1) + { + if (grub_memcmp (arg, "--dumb", sizeof ("--dumb") - 1) == 0) + term_flags |= TERM_DUMB; + else if (grub_memcmp (arg, "--no-echo", sizeof ("--no-echo") - 1) == 0) + /* ``--no-echo'' implies ``--no-edit''. */ + term_flags |= (TERM_NO_ECHO | TERM_NO_EDIT); + else if (grub_memcmp (arg, "--no-edit", sizeof ("--no-edit") - 1) == 0) + term_flags |= TERM_NO_EDIT; + else if (grub_memcmp (arg, "--timeout=", sizeof ("--timeout=") - 1) == 0) + { + char *val = arg + sizeof ("--timeout=") - 1; + + if (! safe_parse_maxint (&val, &to)) + return 1; + } + else if (grub_memcmp (arg, "--lines=", sizeof ("--lines=") - 1) == 0) + { + char *val = arg + sizeof ("--lines=") - 1; + + if (! safe_parse_maxint (&val, &lines)) + return 1; + + /* Probably less than four is meaningless.... */ + if (lines < 4) + { + errnum = ERR_BAD_ARGUMENT; + return 1; + } + } + else if (grub_memcmp (arg, "--silent", sizeof ("--silent") - 1) == 0) + no_message = 1; + else + break; + + arg = skip_to (0, arg); + } + + /* If no argument is specified, show current setting. */ + if (! *arg) + { + grub_printf ("%s%s%s%s\n", + current_term->name, + current_term->flags & TERM_DUMB ? " (dumb)" : "", + current_term->flags & TERM_NO_EDIT ? " (no edit)" : "", + current_term->flags & TERM_NO_ECHO ? " (no echo)" : ""); + return 0; + } + + while (*arg) + { + int i; + char *next = skip_to (0, arg); + + nul_terminate (arg); + + for (i = 0; term_table[i].name; i++) + { + if (grub_strcmp (arg, term_table[i].name) == 0) + { + if (term_table[i].flags & TERM_NEED_INIT) + { + errnum = ERR_DEV_NEED_INIT; + return 1; + } + + if (default_term < 0) + default_term = i; + + term_bitmap |= (1 << i); + break; + } + } + + if (! term_table[i].name) + { + errnum = ERR_BAD_ARGUMENT; + return 1; + } + + arg = next; + } + + /* If multiple terminals are specified, wait until the user pushes any + key on one of the terminals. */ + if (term_bitmap & ~(1 << default_term)) + { + int time1, time2 = -1; + + /* XXX: Disable the pager. */ + count_lines = -1; + + /* Get current time. */ + while ((time1 = getrtsecs ()) == 0xFF) + ; + + /* Wait for a key input. */ + while (to) + { + int i; + + for (i = 0; term_table[i].name; i++) + { + if (term_bitmap & (1 << i)) + { + if (term_table[i].checkkey () >= 0) + { + (void) term_table[i].getkey (); + default_term = i; + + goto end; + } + } + } + + /* Prompt the user, once per sec. */ + if ((time1 = getrtsecs ()) != time2 && time1 != 0xFF) + { + if (! no_message) + { + /* Need to set CURRENT_TERM to each of selected + terminals. */ + for (i = 0; term_table[i].name; i++) + if (term_bitmap & (1 << i)) + { + current_term = term_table + i; + grub_printf ("\rPress any key to continue.\n"); + } + + /* Restore CURRENT_TERM. */ + current_term = prev_term; + } + + time2 = time1; + if (to > 0) + to--; + } + } + } + + end: + current_term = term_table + default_term; + current_term->flags = term_flags; + + if (lines) + max_lines = lines; + else + max_lines = current_term->max_lines; + + /* If the interface is currently the command-line, + restart it to repaint the screen. */ + if ((current_term != prev_term) && (flags & BUILTIN_CMDLINE)){ + if (prev_term->shutdown) + prev_term->shutdown(); + if (current_term->startup) + current_term->startup(); + grub_longjmp (restart_cmdline_env, 0); + } + + return 0; +} + +static struct builtin builtin_terminal = +{ + "terminal", + terminal_func, + BUILTIN_MENU | BUILTIN_CMDLINE | BUILTIN_HELP_LIST, + "terminal [--dumb] [--no-echo] [--no-edit] [--timeout=SECS] [--lines=LINES] [--silent] [console] [serial] [hercules] [graphics]", + "Select a terminal. When multiple terminals are specified, wait until" + " you push any key to continue. If both console and serial are specified," + " the terminal to which you input a key first will be selected. If no" + " argument is specified, print current setting. The option --dumb" + " specifies that your terminal is dumb, otherwise, vt100-compatibility" + " is assumed. If you specify --no-echo, input characters won't be echoed." + " If you specify --no-edit, the BASH-like editing feature will be disabled." + " If --timeout is present, this command will wait at most for SECS" + " seconds. The option --lines specifies the maximum number of lines." + " The option --silent is used to suppress messages." +}; +#endif /* SUPPORT_SERIAL || SUPPORT_HERCULES || SUPPORT_GRAPHICS */ + + +#ifdef SUPPORT_SERIAL +static int +terminfo_func (char *arg, int flags) +{ + struct terminfo term; + + if (*arg) + { + struct + { + const char *name; + char *var; + } + options[] = + { + {"--name=", term.name}, + {"--cursor-address=", term.cursor_address}, + {"--clear-screen=", term.clear_screen}, + {"--enter-standout-mode=", term.enter_standout_mode}, + {"--exit-standout-mode=", term.exit_standout_mode} + }; + + grub_memset (&term, 0, sizeof (term)); + + while (*arg) + { + int i; + char *next = skip_to (0, arg); + + nul_terminate (arg); + + for (i = 0; i < sizeof (options) / sizeof (options[0]); i++) + { + const char *name = options[i].name; + int len = grub_strlen (name); + + if (! grub_memcmp (arg, name, len)) + { + grub_strcpy (options[i].var, ti_unescape_string (arg + len)); + break; + } + } + + if (i == sizeof (options) / sizeof (options[0])) + { + errnum = ERR_BAD_ARGUMENT; + return errnum; + } + + arg = next; + } + + if (term.name[0] == 0 || term.cursor_address[0] == 0) + { + errnum = ERR_BAD_ARGUMENT; + return errnum; + } + + ti_set_term (&term); + } + else + { + /* No option specifies printing out current settings. */ + ti_get_term (&term); + + grub_printf ("name=%s\n", + ti_escape_string (term.name)); + grub_printf ("cursor_address=%s\n", + ti_escape_string (term.cursor_address)); + grub_printf ("clear_screen=%s\n", + ti_escape_string (term.clear_screen)); + grub_printf ("enter_standout_mode=%s\n", + ti_escape_string (term.enter_standout_mode)); + grub_printf ("exit_standout_mode=%s\n", + ti_escape_string (term.exit_standout_mode)); + } + + return 0; +} + +static struct builtin builtin_terminfo = +{ + "terminfo", + terminfo_func, + BUILTIN_MENU | BUILTIN_CMDLINE | BUILTIN_HELP_LIST, + "terminfo [--name=NAME --cursor-address=SEQ [--clear-screen=SEQ]" + " [--enter-standout-mode=SEQ] [--exit-standout-mode=SEQ]]", + + "Define the capabilities of your terminal. Use this command to" + " define escape sequences, if it is not vt100-compatible." + " You may use \\e for ESC and ^X for a control character." + " If no option is specified, the current settings are printed." +}; +#endif /* SUPPORT_SERIAL */ + + +/* testload */ +static int +testload_func (char *arg, int flags) +{ + int i; + + kernel_type = KERNEL_TYPE_NONE; + + if (! grub_open (arg)) + return 1; + + disk_read_hook = disk_read_print_func; + + /* Perform filesystem test on the specified file. */ + /* Read whole file first. */ + grub_printf ("Whole file: "); + + grub_read ((char *) RAW_ADDR (0x100000), -1); + + /* Now compare two sections of the file read differently. */ + + for (i = 0; i < 0x10ac0; i++) + { + *((unsigned char *) RAW_ADDR (0x200000 + i)) = 0; + *((unsigned char *) RAW_ADDR (0x300000 + i)) = 1; + } + + /* First partial read. */ + grub_printf ("\nPartial read 1: "); + + grub_seek (0); + grub_read ((char *) RAW_ADDR (0x200000), 0x7); + grub_read ((char *) RAW_ADDR (0x200007), 0x100); + grub_read ((char *) RAW_ADDR (0x200107), 0x10); + grub_read ((char *) RAW_ADDR (0x200117), 0x999); + grub_read ((char *) RAW_ADDR (0x200ab0), 0x10); + grub_read ((char *) RAW_ADDR (0x200ac0), 0x10000); + + /* Second partial read. */ + grub_printf ("\nPartial read 2: "); + + grub_seek (0); + grub_read ((char *) RAW_ADDR (0x300000), 0x10000); + grub_read ((char *) RAW_ADDR (0x310000), 0x10); + grub_read ((char *) RAW_ADDR (0x310010), 0x7); + grub_read ((char *) RAW_ADDR (0x310017), 0x10); + grub_read ((char *) RAW_ADDR (0x310027), 0x999); + grub_read ((char *) RAW_ADDR (0x3109c0), 0x100); + + grub_printf ("\nHeader1 = 0x%x, next = 0x%x, next = 0x%x, next = 0x%x\n", + *((int *) RAW_ADDR (0x200000)), + *((int *) RAW_ADDR (0x200004)), + *((int *) RAW_ADDR (0x200008)), + *((int *) RAW_ADDR (0x20000c))); + + grub_printf ("Header2 = 0x%x, next = 0x%x, next = 0x%x, next = 0x%x\n", + *((int *) RAW_ADDR (0x300000)), + *((int *) RAW_ADDR (0x300004)), + *((int *) RAW_ADDR (0x300008)), + *((int *) RAW_ADDR (0x30000c))); + + for (i = 0; i < 0x10ac0; i++) + if (*((unsigned char *) RAW_ADDR (0x200000 + i)) + != *((unsigned char *) RAW_ADDR (0x300000 + i))) + break; + + grub_printf ("Max is 0x10ac0: i=0x%x, filepos=0x%x\n", i, filepos); + disk_read_hook = 0; + grub_close (); + return 0; +} + +static struct builtin builtin_testload = +{ + "testload", + testload_func, + BUILTIN_CMDLINE, + "testload FILE", + "Read the entire contents of FILE in several different ways and" + " compares them, to test the filesystem code. The output is somewhat" + " cryptic, but if no errors are reported and the final `i=X," + " filepos=Y' reading has X and Y equal, then it is definitely" + " consistent, and very likely works correctly subject to a" + " consistent offset error. If this test succeeds, then a good next" + " step is to try loading a kernel." +}; + + +/* testvbe MODE */ +static int +testvbe_func (char *arg, int flags) +{ + int mode_number; + struct vbe_controller controller; + struct vbe_mode mode; + + if (! *arg) + { + errnum = ERR_BAD_ARGUMENT; + return 1; + } + + if (! safe_parse_maxint (&arg, &mode_number)) + return 1; + + /* Preset `VBE2'. */ + grub_memmove (controller.signature, "VBE2", 4); + + /* Detect VBE BIOS. */ + if (get_vbe_controller_info (&controller) != 0x004F) + { + grub_printf (" VBE BIOS is not present.\n"); + return 0; + } + + if (controller.version < 0x0200) + { + grub_printf (" VBE version %d.%d is not supported.\n", + (int) (controller.version >> 8), + (int) (controller.version & 0xFF)); + return 0; + } + + if (get_vbe_mode_info (mode_number, &mode) != 0x004F + || (mode.mode_attributes & 0x0091) != 0x0091) + { + grub_printf (" Mode 0x%x is not supported.\n", mode_number); + return 0; + } + + /* Now trip to the graphics mode. */ + if (set_vbe_mode (mode_number | (1 << 14)) != 0x004F) + { + grub_printf (" Switching to Mode 0x%x failed.\n", mode_number); + return 0; + } + + /* Draw something on the screen... */ + { + unsigned char *base_buf = (unsigned char *) mode.phys_base; + int scanline = controller.version >= 0x0300 + ? mode.linear_bytes_per_scanline : mode.bytes_per_scanline; + /* FIXME: this assumes that any depth is a modulo of 8. */ + int bpp = mode.bits_per_pixel / 8; + int width = mode.x_resolution; + int height = mode.y_resolution; + int x, y; + unsigned color = 0; + + /* Iterate drawing on the screen, until the user hits any key. */ + while (checkkey () == -1) + { + for (y = 0; y < height; y++) + { + unsigned char *line_buf = base_buf + scanline * y; + + for (x = 0; x < width; x++) + { + unsigned char *buf = line_buf + bpp * x; + int i; + + for (i = 0; i < bpp; i++, buf++) + *buf = (color >> (i * 8)) & 0xff; + } + + color++; + } + } + + /* Discard the input. */ + getkey (); + } + + /* Back to the default text mode. */ + if (set_vbe_mode (0x03) != 0x004F) + { + /* Why?! */ + grub_reboot (); + } + + return 0; +} + +static struct builtin builtin_testvbe = +{ + "testvbe", + testvbe_func, + BUILTIN_CMDLINE | BUILTIN_HELP_LIST, + "testvbe MODE", + "Test the VBE mode MODE. Hit any key to return." +}; + + +#ifdef SUPPORT_NETBOOT +/* tftpserver */ +static int +tftpserver_func (char *arg, int flags) +{ + if (! *arg || ! ifconfig (0, 0, 0, arg)) + { + errnum = ERR_BAD_ARGUMENT; + return 1; + } + + print_network_configuration (); + return 0; +} + +static struct builtin builtin_tftpserver = +{ + "tftpserver", + tftpserver_func, + BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_HELP_LIST, + "tftpserver IPADDR", + "Override the TFTP server address." +}; +#endif /* SUPPORT_NETBOOT */ + + +/* timeout */ +static int +timeout_func (char *arg, int flags) +{ + if (! safe_parse_maxint (&arg, &grub_timeout)) + return 1; + + return 0; +} + +static struct builtin builtin_timeout = +{ + "timeout", + timeout_func, + BUILTIN_MENU, +#if 0 + "timeout SEC", + "Set a timeout, in SEC seconds, before automatically booting the" + " default entry (normally the first entry defined)." +#endif +}; + + +/* title */ +static int +title_func (char *arg, int flags) +{ + /* This function is not actually used at least currently. */ + return 0; +} + +static struct builtin builtin_title = +{ + "title", + title_func, + BUILTIN_TITLE, +#if 0 + "title [NAME ...]", + "Start a new boot entry, and set its name to the contents of the" + " rest of the line, starting with the first non-space character." +#endif +}; + + +/* unhide */ +static int +unhide_func (char *arg, int flags) +{ + if (! set_device (arg)) + return 1; + + if (! set_partition_hidden_flag (0)) + return 1; + + return 0; +} + +static struct builtin builtin_unhide = +{ + "unhide", + unhide_func, + BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_HELP_LIST, + "unhide PARTITION", + "Unhide PARTITION by clearing the \"hidden\" bit in its" + " partition type code." +}; + + +/* uppermem */ +static int +uppermem_func (char *arg, int flags) +{ + if (! safe_parse_maxint (&arg, (int *) &mbi.mem_upper)) + return 1; + + mbi.flags &= ~MB_INFO_MEM_MAP; + return 0; +} + +static struct builtin builtin_uppermem = +{ + "uppermem", + uppermem_func, + BUILTIN_CMDLINE | BUILTIN_HELP_LIST, + "uppermem KBYTES", + "Force GRUB to assume that only KBYTES kilobytes of upper memory are" + " installed. Any system address range maps are discarded." +}; + + +/* vbeprobe */ +static int +vbeprobe_func (char *arg, int flags) +{ + struct vbe_controller controller; + unsigned short *mode_list; + int mode_number = -1; + + auto unsigned long vbe_far_ptr_to_linear (unsigned long); + + unsigned long vbe_far_ptr_to_linear (unsigned long ptr) + { + unsigned short seg = (ptr >> 16); + unsigned short off = (ptr & 0xFFFF); + + return (seg << 4) + off; + } + + if (*arg) + { + if (! safe_parse_maxint (&arg, &mode_number)) + return 1; + } + + /* Set the signature to `VBE2', to obtain VBE 3.0 information. */ + grub_memmove (controller.signature, "VBE2", 4); + + if (get_vbe_controller_info (&controller) != 0x004F) + { + grub_printf (" VBE BIOS is not present.\n"); + return 0; + } + + /* Check the version. */ + if (controller.version < 0x0200) + { + grub_printf (" VBE version %d.%d is not supported.\n", + (int) (controller.version >> 8), + (int) (controller.version & 0xFF)); + return 0; + } + + /* Print some information. */ + grub_printf (" VBE version %d.%d\n", + (int) (controller.version >> 8), + (int) (controller.version & 0xFF)); + + /* Iterate probing modes. */ + for (mode_list + = (unsigned short *) vbe_far_ptr_to_linear (controller.video_mode); + *mode_list != 0xFFFF; + mode_list++) + { + struct vbe_mode mode; + + if (get_vbe_mode_info (*mode_list, &mode) != 0x004F) + continue; + + /* Skip this, if this is not supported or linear frame buffer + mode is not support. */ + if ((mode.mode_attributes & 0x0081) != 0x0081) + continue; + + if (mode_number == -1 || mode_number == *mode_list) + { + char *model; + switch (mode.memory_model) + { + case 0x00: model = "Text"; break; + case 0x01: model = "CGA graphics"; break; + case 0x02: model = "Hercules graphics"; break; + case 0x03: model = "Planar"; break; + case 0x04: model = "Packed pixel"; break; + case 0x05: model = "Non-chain 4, 256 color"; break; + case 0x06: model = "Direct Color"; break; + case 0x07: model = "YUV"; break; + default: model = "Unknown"; break; + } + + grub_printf (" 0x%x: %s, %ux%ux%u\n", + (unsigned) *mode_list, + model, + (unsigned) mode.x_resolution, + (unsigned) mode.y_resolution, + (unsigned) mode.bits_per_pixel); + + if (mode_number != -1) + break; + } + } + + if (mode_number != -1 && mode_number != *mode_list) + grub_printf (" Mode 0x%x is not found or supported.\n", mode_number); + + return 0; +} + +static struct builtin builtin_vbeprobe = +{ + "vbeprobe", + vbeprobe_func, + BUILTIN_CMDLINE | BUILTIN_HELP_LIST, + "vbeprobe [MODE]", + "Probe VBE information. If the mode number MODE is specified, show only" + " the information about only the mode." +}; + + +/* The table of builtin commands. Sorted in dictionary order. */ +struct builtin *builtin_table[] = +{ +#ifdef SUPPORT_GRAPHICS + &builtin_background, +#endif + &builtin_blocklist, + &builtin_boot, + &builtin_bootfs, +#ifdef SUPPORT_NETBOOT + &builtin_bootp, +#endif /* SUPPORT_NETBOOT */ + &builtin_cat, + &builtin_chainloader, + &builtin_clear, + &builtin_cmp, + &builtin_color, + &builtin_configfile, + &builtin_debug, + &builtin_default, +#ifdef GRUB_UTIL + &builtin_device, +#endif /* GRUB_UTIL */ +#ifdef SUPPORT_NETBOOT + &builtin_dhcp, +#endif /* SUPPORT_NETBOOT */ + &builtin_displayapm, + &builtin_displaymem, +#ifdef GRUB_UTIL + &builtin_dump, +#endif /* GRUB_UTIL */ + &builtin_embed, + &builtin_fallback, + &builtin_find, + &builtin_findroot, +#ifdef SUPPORT_GRAPHICS + &builtin_foreground, +#endif + &builtin_fstest, + &builtin_geometry, + &builtin_halt, + &builtin_help, + &builtin_hiddenmenu, + &builtin_hide, +#ifdef SUPPORT_NETBOOT + &builtin_ifconfig, +#endif /* SUPPORT_NETBOOT */ + &builtin_impsprobe, + &builtin_initrd, + &builtin_install, + &builtin_ioprobe, + &builtin_kernel, + &builtin_kernel_dollar, + &builtin_lock, + &builtin_makeactive, + &builtin_map, +#ifdef USE_MD5_PASSWORDS + &builtin_md5crypt, +#endif /* USE_MD5_PASSWORDS */ + &builtin_min_mem64, + &builtin_module, + &builtin_module_dollar, + &builtin_modulenounzip, + &builtin_pager, + &builtin_partnew, + &builtin_parttype, + &builtin_password, + &builtin_pause, +#if defined(RPC_DEBUG) && defined(SUPPORT_NETBOOT) + &builtin_portmap, +#endif /* RPC_DEBUG && SUPPORT_NETBOOT */ +#ifdef GRUB_UTIL + &builtin_quit, +#endif /* GRUB_UTIL */ +#ifdef SUPPORT_NETBOOT + &builtin_rarp, +#endif /* SUPPORT_NETBOOT */ + &builtin_read, + &builtin_reboot, + &builtin_root, + &builtin_rootnoverify, + &builtin_savedefault, +#ifdef SUPPORT_SERIAL + &builtin_serial, +#endif /* SUPPORT_SERIAL */ + &builtin_setkey, + &builtin_setup, +#ifdef SUPPORT_GRAPHICS + &builtin_splashimage, +#endif /* SUPPORT_GRAPHICS */ +#if defined(SUPPORT_SERIAL) || defined(SUPPORT_HERCULES) || defined(SUPPORT_GRAPHICS) + &builtin_terminal, +#endif /* SUPPORT_SERIAL || SUPPORT_HERCULES || SUPPORT_GRAPHICS */ +#ifdef SUPPORT_SERIAL + &builtin_terminfo, +#endif /* SUPPORT_SERIAL */ + &builtin_testload, + &builtin_testvbe, +#ifdef SUPPORT_NETBOOT + &builtin_tftpserver, +#endif /* SUPPORT_NETBOOT */ + &builtin_timeout, + &builtin_title, + &builtin_unhide, + &builtin_uppermem, + &builtin_vbeprobe, + &builtin_verbose, + 0 +}; diff --git a/usr/src/grub/grub-0.97/stage2/char_io.c b/usr/src/grub/grub-0.97/stage2/char_io.c new file mode 100644 index 0000000000..d73bc71001 --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/char_io.c @@ -0,0 +1,1416 @@ +/* char_io.c - basic console input and output */ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2004 Free Software Foundation, 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 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. + */ +/* + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ +#pragma ident "%Z%%M% %I% %E% SMI" + +#include +#include + +#ifdef SUPPORT_HERCULES +# include +#endif + +#ifdef SUPPORT_SERIAL +# include +#endif + +#ifndef STAGE1_5 +struct term_entry term_table[] = + { + { + "console", + 0, + 24, + console_putchar, + console_checkkey, + console_getkey, + console_getxy, + console_gotoxy, + console_cls, + console_setcolorstate, + console_setcolor, + console_setcursor, + 0, + 0 + }, +#ifdef SUPPORT_SERIAL + { + "serial", + /* A serial device must be initialized. */ + TERM_NEED_INIT, + 24, + serial_putchar, + serial_checkkey, + serial_getkey, + serial_getxy, + serial_gotoxy, + serial_cls, + serial_setcolorstate, + 0, + 0, + 0, + 0 + }, +#endif /* SUPPORT_SERIAL */ +#ifdef SUPPORT_HERCULES + { + "hercules", + 0, + 24, + hercules_putchar, + console_checkkey, + console_getkey, + hercules_getxy, + hercules_gotoxy, + hercules_cls, + hercules_setcolorstate, + hercules_setcolor, + hercules_setcursor, + 0, + 0 + }, +#endif /* SUPPORT_HERCULES */ +#ifdef SUPPORT_GRAPHICS + { "graphics", + TERM_NEED_INIT, /* flags */ + 30, /* number of lines */ + graphics_putchar, /* putchar */ + console_checkkey, /* checkkey */ + console_getkey, /* getkey */ + graphics_getxy, /* getxy */ + graphics_gotoxy, /* gotoxy */ + graphics_cls, /* cls */ + graphics_setcolorstate, /* setcolorstate */ + graphics_setcolor, /* setcolor */ + graphics_setcursor, /* nocursor */ + graphics_init, /* initialize */ + graphics_end /* shutdown */ + }, +#endif /* SUPPORT_GRAPHICS */ + /* This must be the last entry. */ + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } + }; + +/* This must be console. */ +struct term_entry *current_term = term_table; + +int max_lines = 24; +int count_lines = -1; +int use_pager = 1; +#endif + +void +print_error (void) +{ + if (errnum > ERR_NONE && errnum < MAX_ERR_NUM) +#ifndef STAGE1_5 + /* printf("\7\n %s\n", err_list[errnum]); */ + printf ("\nError %u: %s\n", errnum, err_list[errnum]); +#else /* STAGE1_5 */ + printf ("Error %u\n", errnum); +#endif /* STAGE1_5 */ +} + +char * +convert_to_ascii (char *buf, int c,...) +{ + unsigned long num = *((&c) + 1), mult = 10; + char *ptr = buf; + +#ifndef STAGE1_5 + if (c == 'x' || c == 'X') + mult = 16; + + if ((num & 0x80000000uL) && c == 'd') + { + num = (~num) + 1; + *(ptr++) = '-'; + buf++; + } +#endif + + do + { + int dig = num % mult; + *(ptr++) = ((dig > 9) ? dig + 'a' - 10 : '0' + dig); + } + while (num /= mult); + + /* reorder to correct direction!! */ + { + char *ptr1 = ptr - 1; + char *ptr2 = buf; + while (ptr1 > ptr2) + { + int tmp = *ptr1; + *ptr1 = *ptr2; + *ptr2 = tmp; + ptr1--; + ptr2++; + } + } + + return ptr; +} + +void +grub_putstr (const char *str) +{ + while (*str) + grub_putchar (*str++); +} + +static void +grub_vprintf (const char *format, int *dataptr) +{ + char c, str[16]; + + while ((c = *(format++)) != 0) + { + if (c != '%') + grub_putchar (c); + else + switch (c = *(format++)) + { +#ifndef STAGE1_5 + case 'd': + case 'x': + case 'X': +#endif + case 'u': + *convert_to_ascii (str, c, *((unsigned long *) dataptr++)) = 0; + grub_putstr (str); + break; + +#ifndef STAGE1_5 + case 'c': + grub_putchar ((*(dataptr++)) & 0xff); + break; + + case 's': + grub_putstr ((char *) *(dataptr++)); + break; +#endif + } + } +} + +#ifndef STAGE1_5 +void +init_page (void) +{ + cls (); + + grub_printf ("\n GNU GRUB version %s (%dK lower / %dK upper memory)\n\n", + version_string, mbi.mem_lower, mbi.mem_upper); +} + +/* The number of the history entries. */ +static int num_history = 0; + +/* Get the NOth history. If NO is less than zero or greater than or + equal to NUM_HISTORY, return NULL. Otherwise return a valid string. */ +static char * +get_history (int no) +{ + if (no < 0 || no >= num_history) + return 0; + + return (char *) HISTORY_BUF + MAX_CMDLINE * no; +} + +/* Add CMDLINE to the history buffer. */ +static void +add_history (const char *cmdline, int no) +{ + grub_memmove ((char *) HISTORY_BUF + MAX_CMDLINE * (no + 1), + (char *) HISTORY_BUF + MAX_CMDLINE * no, + MAX_CMDLINE * (num_history - no)); + grub_strcpy ((char *) HISTORY_BUF + MAX_CMDLINE * no, cmdline); + if (num_history < HISTORY_SIZE) + num_history++; +} + +static int +real_get_cmdline (char *prompt, char *cmdline, int maxlen, + int echo_char, int readline) +{ + /* This is a rather complicated function. So explain the concept. + + A command-line consists of ``section''s. A section is a part of the + line which may be displayed on the screen, but a section is never + displayed with another section simultaneously. + + Each section is basically 77 or less characters, but the exception + is the first section, which is 78 or less characters, because the + starting point is special. See below. + + The first section contains a prompt and a command-line (or the + first part of a command-line when it is too long to be fit in the + screen). So, in the first section, the number of command-line + characters displayed is 78 minus the length of the prompt (or + less). If the command-line has more characters, `>' is put at the + position 78 (zero-origin), to inform the user of the hidden + characters. + + Other sections always have `<' at the first position, since there + is absolutely a section before each section. If there is a section + after another section, this section consists of 77 characters and + `>' at the last position. The last section has 77 or less + characters and doesn't have `>'. + + Each section other than the last shares some characters with the + previous section. This region is called ``margin''. If the cursor + is put at the magin which is shared by the first section and the + second, the first section is displayed. Otherwise, a displayed + section is switched to another section, only if the cursor is put + outside that section. */ + + /* XXX: These should be defined in shared.h, but I leave these here, + until this code is freezed. */ +#define CMDLINE_WIDTH 78 +#define CMDLINE_MARGIN 10 + + int xpos, lpos, c, section; + /* The length of PROMPT. */ + int plen; + /* The length of the command-line. */ + int llen; + /* The index for the history. */ + int history = -1; + /* The working buffer for the command-line. */ + char *buf = (char *) CMDLINE_BUF; + /* The kill buffer. */ + char *kill_buf = (char *) KILL_BUF; + + /* Nested function definitions for code simplicity. */ + + /* The forward declarations of nested functions are prefixed + with `auto'. */ + auto void cl_refresh (int full, int len); + auto void cl_backward (int count); + auto void cl_forward (int count); + auto void cl_insert (const char *str); + auto void cl_delete (int count); + auto void cl_init (void); + + /* Move the cursor backward. */ + void cl_backward (int count) + { + lpos -= count; + + /* If the cursor is in the first section, display the first section + instead of the second. */ + if (section == 1 && plen + lpos < CMDLINE_WIDTH) + cl_refresh (1, 0); + else if (xpos - count < 1) + cl_refresh (1, 0); + else + { + xpos -= count; + + if (current_term->flags & TERM_DUMB) + { + int i; + + for (i = 0; i < count; i++) + grub_putchar ('\b'); + } + else + gotoxy (xpos, getxy () & 0xFF); + } + } + + /* Move the cursor forward. */ + void cl_forward (int count) + { + lpos += count; + + /* If the cursor goes outside, scroll the screen to the right. */ + if (xpos + count >= CMDLINE_WIDTH) + cl_refresh (1, 0); + else + { + xpos += count; + + if (current_term->flags & TERM_DUMB) + { + int i; + + for (i = lpos - count; i < lpos; i++) + { + if (! echo_char) + grub_putchar (buf[i]); + else + grub_putchar (echo_char); + } + } + else + gotoxy (xpos, getxy () & 0xFF); + } + } + + /* Refresh the screen. If FULL is true, redraw the full line, otherwise, + only LEN characters from LPOS. */ + void cl_refresh (int full, int len) + { + int i; + int start; + int pos = xpos; + + if (full) + { + /* Recompute the section number. */ + if (lpos + plen < CMDLINE_WIDTH) + section = 0; + else + section = ((lpos + plen - CMDLINE_WIDTH) + / (CMDLINE_WIDTH - 1 - CMDLINE_MARGIN) + 1); + + /* From the start to the end. */ + len = CMDLINE_WIDTH; + pos = 0; + grub_putchar ('\r'); + + /* If SECTION is the first section, print the prompt, otherwise, + print `<'. */ + if (section == 0) + { + grub_printf ("%s", prompt); + len -= plen; + pos += plen; + } + else + { + grub_putchar ('<'); + len--; + pos++; + } + } + + /* Compute the index to start writing BUF and the resulting position + on the screen. */ + if (section == 0) + { + int offset = 0; + + if (! full) + offset = xpos - plen; + + start = 0; + xpos = lpos + plen; + start += offset; + } + else + { + int offset = 0; + + if (! full) + offset = xpos - 1; + + start = ((section - 1) * (CMDLINE_WIDTH - 1 - CMDLINE_MARGIN) + + CMDLINE_WIDTH - plen - CMDLINE_MARGIN); + xpos = lpos + 1 - start; + start += offset; + } + + /* Print BUF. If ECHO_CHAR is not zero, put it instead. */ + for (i = start; i < start + len && i < llen; i++) + { + if (! echo_char) + grub_putchar (buf[i]); + else + grub_putchar (echo_char); + + pos++; + } + + /* Fill up the rest of the line with spaces. */ + for (; i < start + len; i++) + { + grub_putchar (' '); + pos++; + } + + /* If the cursor is at the last position, put `>' or a space, + depending on if there are more characters in BUF. */ + if (pos == CMDLINE_WIDTH) + { + if (start + len < llen) + grub_putchar ('>'); + else + grub_putchar (' '); + + pos++; + } + + /* Back to XPOS. */ + if (current_term->flags & TERM_DUMB) + { + for (i = 0; i < pos - xpos; i++) + grub_putchar ('\b'); + } + else + gotoxy (xpos, getxy () & 0xFF); + } + + /* Initialize the command-line. */ + void cl_init (void) + { + /* Distinguish us from other lines and error messages! */ + grub_putchar ('\n'); + + /* Print full line and set position here. */ + cl_refresh (1, 0); + } + + /* Insert STR to BUF. */ + void cl_insert (const char *str) + { + int l = grub_strlen (str); + + if (llen + l < maxlen) + { + if (lpos == llen) + grub_memmove (buf + lpos, str, l + 1); + else + { + grub_memmove (buf + lpos + l, buf + lpos, llen - lpos + 1); + grub_memmove (buf + lpos, str, l); + } + + llen += l; + lpos += l; + if (xpos + l >= CMDLINE_WIDTH) + cl_refresh (1, 0); + else if (xpos + l + llen - lpos > CMDLINE_WIDTH) + cl_refresh (0, CMDLINE_WIDTH - xpos); + else + cl_refresh (0, l + llen - lpos); + } + } + + /* Delete COUNT characters in BUF. */ + void cl_delete (int count) + { + grub_memmove (buf + lpos, buf + lpos + count, llen - count + 1); + llen -= count; + + if (xpos + llen + count - lpos > CMDLINE_WIDTH) + cl_refresh (0, CMDLINE_WIDTH - xpos); + else + cl_refresh (0, llen + count - lpos); + } + + plen = grub_strlen (prompt); + llen = grub_strlen (cmdline); + + if (maxlen > MAX_CMDLINE) + { + maxlen = MAX_CMDLINE; + if (llen >= MAX_CMDLINE) + { + llen = MAX_CMDLINE - 1; + cmdline[MAX_CMDLINE] = 0; + } + } + lpos = llen; + grub_strcpy (buf, cmdline); + + cl_init (); + + while ((c = ASCII_CHAR (getkey ())) != '\n' && c != '\r') + { + /* If READLINE is non-zero, handle readline-like key bindings. */ + if (readline) + { + switch (c) + { + case 9: /* TAB lists completions */ + { + int i; + /* POS points to the first space after a command. */ + int pos = 0; + int ret; + char *completion_buffer = (char *) COMPLETION_BUF; + int equal_pos = -1; + int is_filename; + + /* Find the first word. */ + while (buf[pos] == ' ') + pos++; + while (buf[pos] && buf[pos] != '=' && buf[pos] != ' ') + pos++; + + is_filename = (lpos > pos); + + /* Find the position of the equal character after a + command, and replace it with a space. */ + for (i = pos; buf[i] && buf[i] != ' '; i++) + if (buf[i] == '=') + { + equal_pos = i; + buf[i] = ' '; + break; + } + + /* Find the position of the first character in this + word. */ + for (i = lpos; i > 0 && buf[i - 1] != ' '; i--) + ; + + /* Invalidate the cache, because the user may exchange + removable disks. */ + buf_drive = -1; + + /* Copy this word to COMPLETION_BUFFER and do the + completion. */ + grub_memmove (completion_buffer, buf + i, lpos - i); + completion_buffer[lpos - i] = 0; + ret = print_completions (is_filename, 1); + errnum = ERR_NONE; + + if (ret >= 0) + { + /* Found, so insert COMPLETION_BUFFER. */ + cl_insert (completion_buffer + lpos - i); + + if (ret > 0) + { + /* There are more than one candidates, so print + the list. */ + grub_putchar ('\n'); + print_completions (is_filename, 0); + errnum = ERR_NONE; + } + } + + /* Restore the command-line. */ + if (equal_pos >= 0) + buf[equal_pos] = '='; + + if (ret) + cl_init (); + } + break; + case 1: /* C-a go to beginning of line */ + cl_backward (lpos); + break; + case 5: /* C-e go to end of line */ + cl_forward (llen - lpos); + break; + case 6: /* C-f forward one character */ + if (lpos < llen) + cl_forward (1); + break; + case 2: /* C-b backward one character */ + if (lpos > 0) + cl_backward (1); + break; + case 21: /* C-u kill to beginning of line */ + if (lpos == 0) + break; + /* Copy the string being deleted to KILL_BUF. */ + grub_memmove (kill_buf, buf, lpos); + kill_buf[lpos] = 0; + { + /* XXX: Not very clever. */ + + int count = lpos; + + cl_backward (lpos); + cl_delete (count); + } + break; + case 11: /* C-k kill to end of line */ + if (lpos == llen) + break; + /* Copy the string being deleted to KILL_BUF. */ + grub_memmove (kill_buf, buf + lpos, llen - lpos + 1); + cl_delete (llen - lpos); + break; + case 25: /* C-y yank the kill buffer */ + cl_insert (kill_buf); + break; + case 16: /* C-p fetch the previous command */ + { + char *p; + + if (history < 0) + /* Save the working buffer. */ + grub_strcpy (cmdline, buf); + else if (grub_strcmp (get_history (history), buf) != 0) + /* If BUF is modified, add it into the history list. */ + add_history (buf, history); + + history++; + p = get_history (history); + if (! p) + { + history--; + break; + } + + grub_strcpy (buf, p); + llen = grub_strlen (buf); + lpos = llen; + cl_refresh (1, 0); + } + break; + case 14: /* C-n fetch the next command */ + { + char *p; + + if (history < 0) + { + break; + } + else if (grub_strcmp (get_history (history), buf) != 0) + /* If BUF is modified, add it into the history list. */ + add_history (buf, history); + + history--; + p = get_history (history); + if (! p) + p = cmdline; + + grub_strcpy (buf, p); + llen = grub_strlen (buf); + lpos = llen; + cl_refresh (1, 0); + } + break; + } + } + + /* ESC, C-d and C-h are always handled. Actually C-d is not + functional if READLINE is zero, as the cursor cannot go + backward, but that's ok. */ + switch (c) + { + case 27: /* ESC immediately return 1 */ + return 1; + case 4: /* C-d delete character under cursor */ + if (lpos == llen) + break; + cl_delete (1); + break; + case 8: /* C-h backspace */ +# ifdef GRUB_UTIL + case 127: /* also backspace */ +# endif + if (lpos > 0) + { + cl_backward (1); + cl_delete (1); + } + break; + default: /* insert printable character into line */ + if (c >= ' ' && c <= '~') + { + char str[2]; + + str[0] = c; + str[1] = 0; + cl_insert (str); + } + } + } + + grub_putchar ('\n'); + + /* If ECHO_CHAR is NUL, remove the leading spaces. */ + lpos = 0; + if (! echo_char) + while (buf[lpos] == ' ') + lpos++; + + /* Copy the working buffer to CMDLINE. */ + grub_memmove (cmdline, buf + lpos, llen - lpos + 1); + + /* If the readline-like feature is turned on and CMDLINE is not + empty, add it into the history list. */ + if (readline && lpos < llen) + add_history (cmdline, 0); + + return 0; +} + +/* Don't use this with a MAXLEN greater than 1600 or so! The problem + is that GET_CMDLINE depends on the everything fitting on the screen + at once. So, the whole screen is about 2000 characters, minus the + PROMPT, and space for error and status lines, etc. MAXLEN must be + at least 1, and PROMPT and CMDLINE must be valid strings (not NULL + or zero-length). + + If ECHO_CHAR is nonzero, echo it instead of the typed character. */ +int +get_cmdline (char *prompt, char *cmdline, int maxlen, + int echo_char, int readline) +{ + int old_cursor; + int ret; + + old_cursor = setcursor (1); + + /* Because it is hard to deal with different conditions simultaneously, + less functional cases are handled here. Assume that TERM_NO_ECHO + implies TERM_NO_EDIT. */ + if (current_term->flags & (TERM_NO_ECHO | TERM_NO_EDIT)) + { + char *p = cmdline; + int c; + + /* Make sure that MAXLEN is not too large. */ + if (maxlen > MAX_CMDLINE) + maxlen = MAX_CMDLINE; + + /* Print only the prompt. The contents of CMDLINE is simply discarded, + even if it is not empty. */ + grub_printf ("%s", prompt); + + /* Gather characters until a newline is gotten. */ + while ((c = ASCII_CHAR (getkey ())) != '\n' && c != '\r') + { + /* Return immediately if ESC is pressed. */ + if (c == 27) + { + setcursor (old_cursor); + return 1; + } + + /* Printable characters are added into CMDLINE. */ + if (c >= ' ' && c <= '~') + { + if (! (current_term->flags & TERM_NO_ECHO)) + grub_putchar (c); + + /* Preceding space characters must be ignored. */ + if (c != ' ' || p != cmdline) + *p++ = c; + } + } + + *p = 0; + + if (! (current_term->flags & TERM_NO_ECHO)) + grub_putchar ('\n'); + + setcursor (old_cursor); + return 0; + } + + /* Complicated features are left to real_get_cmdline. */ + ret = real_get_cmdline (prompt, cmdline, maxlen, echo_char, readline); + setcursor (old_cursor); + return ret; +} + +int +safe_parse_maxint (char **str_ptr, int *myint_ptr) +{ + char *ptr = *str_ptr; + int myint = 0; + int mult = 10, found = 0; + + /* + * Is this a hex number? + */ + if (*ptr == '0' && tolower (*(ptr + 1)) == 'x') + { + ptr += 2; + mult = 16; + } + + while (1) + { + /* A bit tricky. This below makes use of the equivalence: + (A >= B && A <= C) <=> ((A - B) <= (C - B)) + when C > B and A is unsigned. */ + unsigned int digit; + + digit = tolower (*ptr) - '0'; + if (digit > 9) + { + digit -= 'a' - '0'; + if (mult == 10 || digit > 5) + break; + digit += 10; + } + + found = 1; + if (myint > ((MAXINT - digit) / mult)) + { + errnum = ERR_NUMBER_OVERFLOW; + return 0; + } + myint = (myint * mult) + digit; + ptr++; + } + + if (!found) + { + errnum = ERR_NUMBER_PARSING; + return 0; + } + + *str_ptr = ptr; + *myint_ptr = myint; + + return 1; +} +#endif /* STAGE1_5 */ + +#if !defined(STAGE1_5) || defined(FSYS_ZFS) +static int +grub_vsprintf (char *buffer, const char *format, int *dataptr) +{ + /* XXX hohmuth + ugly hack -- should unify with printf() */ + char c, *ptr, str[16]; + char *bp = buffer; + int len = 0; + + while ((c = *format++) != 0) + { + if (c != '%') { + if (buffer) + *bp++ = c; /* putchar(c); */ + len++; + } else { + switch (c = *(format++)) + { + case 'd': case 'u': case 'x': + *convert_to_ascii (str, c, *((unsigned long *) dataptr++)) = 0; + + ptr = str; + + while (*ptr) { + if (buffer) + *bp++ = *(ptr++); /* putchar(*(ptr++)); */ + else + ptr++; + len++; + } + break; + + case 'c': + if (buffer) + *bp++ = (*(dataptr++))&0xff; + else + dataptr++; + len++; + /* putchar((*(dataptr++))&0xff); */ + break; + + case 's': + ptr = (char *) (*(dataptr++)); + + while ((c = *ptr++) != 0) { + if (buffer) + *bp++ = c; /* putchar(c); */ + len++; + } + break; + } + } + } + + *bp = 0; + return (len); +} + +int +grub_sprintf (char *buffer, const char *format, ...) +{ + int *dataptr = (int *) &format; + dataptr++; + + return (grub_vsprintf (buffer, format, dataptr)); +} + +#endif /* !defined(STAGE1_5) || defined(FSYS_ZFS) */ + +void +noisy_printf (const char *format,...) +{ + int *dataptr = (int *) &format; + dataptr++; + + grub_vprintf(format, dataptr); +} + +/* + * print to a buffer, unless verbose mode is on + * if verbos mode is switched on, the buffer is dumped in verbose_func() + */ +void +grub_printf (const char *format,...) +{ + int len; + int *dataptr = (int *) &format; + dataptr++; + +#ifndef STAGE1_5 + if (silent.status != SILENT) +#endif + grub_vprintf(format, dataptr); +#ifndef STAGE1_5 + else { + len = grub_vsprintf(NULL, format, dataptr); + if (silent.buffer_start - silent.buffer + len + 1 >= + SCREENBUF) { + silent.buffer_start = silent.buffer; + silent.looped = 1; + } + if (len < SCREENBUF) /* all other cases loop safely */ + silent.buffer_start += + grub_vsprintf(silent.buffer_start, format, dataptr); + } +#endif +} + +#if !defined(STAGE1_5) || defined(FSYS_FAT) +int +grub_tolower (int c) +{ + if (c >= 'A' && c <= 'Z') + return (c + ('a' - 'A')); + + return c; +} +#endif /* ! STAGE1_5 || FSYS_FAT */ + +int +grub_isspace (int c) +{ + switch (c) + { + case ' ': + case '\t': + case '\r': + case '\n': + return 1; + default: + break; + } + + return 0; +} + +#if !defined(STAGE1_5) || defined(FSYS_ISO9660) +int +grub_memcmp (const char *s1, const char *s2, int n) +{ + while (n) + { + if (*s1 < *s2) + return -1; + else if (*s1 > *s2) + return 1; + s1++; + s2++; + n--; + } + + return 0; +} +#endif /* ! STAGE1_5 || FSYS_ISO9660 */ + +#ifndef STAGE1_5 +int +grub_strncat (char *s1, const char *s2, int n) +{ + int i = -1; + + while (++i < n && s1[i] != 0); + + while (i < n && (s1[i++] = *(s2++)) != 0); + + s1[n - 1] = 0; + + if (i >= n) + return 0; + + s1[i] = 0; + + return 1; +} +#endif /* ! STAGE1_5 */ + +/* XXX: This below is an evil hack. Certainly, we should change the + strategy to determine what should be defined and what shouldn't be + defined for each image. For example, it would be better to create + a static library supporting minimal standard C functions and link + each image with the library. Complicated things should be left to + computer, definitely. -okuji */ + +/* Make some grub_str* routines available to ZFS plug-in as well */ + +#if !defined(STAGE1_5) || defined(FSYS_VSTAFS) || defined(FSYS_ZFS) +int +grub_strcmp (const char *s1, const char *s2) +{ + while (*s1 || *s2) + { + if (*s1 < *s2) + return -1; + else if (*s1 > *s2) + return 1; + s1 ++; + s2 ++; + } + + return 0; +} + +int +grub_strncmp(const char *s1, const char *s2, int n) +{ + if (s1 == s2) + return (0); + n++; + while (--n != 0 && *s1 == *s2++) + if (*s1++ == '\0') + return (0); + return ((n == 0) ? 0 : *(unsigned char *)s1 - *(unsigned char *)--s2); +} + +#endif /* ! STAGE1_5 || FSYS_VSTAFS || defined(FSYS_ZFS) */ + +#ifndef STAGE1_5 +/* Wait for a keypress and return its code. */ +int +getkey (void) +{ + return current_term->getkey (); +} + +/* Check if a key code is available. */ +int +checkkey (void) +{ + return current_term->checkkey (); +} +#endif /* ! STAGE1_5 */ + +/* Display an ASCII character. */ +void +grub_putchar (int c) +{ + if (c == '\n') + grub_putchar ('\r'); +#ifndef STAGE1_5 + else if (c == '\t' && current_term->getxy) + { + int n; + + n = 8 - ((current_term->getxy () >> 8) & 3); + while (n--) + grub_putchar (' '); + + return; + } +#endif /* ! STAGE1_5 */ + +#ifdef STAGE1_5 + + /* In Stage 1.5, only the normal console is supported. */ + console_putchar (c); + +#else /* ! STAGE1_5 */ + + if (c == '\n') + { + /* Internal `more'-like feature. */ + if (count_lines >= 0) + { + count_lines++; + if (count_lines >= max_lines - 2) + { + int tmp; + + /* It's important to disable the feature temporarily, because + the following grub_printf call will print newlines. */ + count_lines = -1; + + grub_printf("\n"); + if (current_term->setcolorstate) + current_term->setcolorstate (COLOR_STATE_HIGHLIGHT); + + grub_printf ("[Hit return to continue]"); + + if (current_term->setcolorstate) + current_term->setcolorstate (COLOR_STATE_NORMAL); + + do + { + tmp = ASCII_CHAR (getkey ()); + } + while (tmp != '\n' && tmp != '\r'); + grub_printf ("\r \r"); + + /* Restart to count lines. */ + count_lines = 0; + return; + } + } + } + + current_term->putchar (c); + +#endif /* ! STAGE1_5 */ +} + +#ifndef STAGE1_5 +void +gotoxy (int x, int y) +{ + current_term->gotoxy (x, y); +} + +int +getxy (void) +{ + return current_term->getxy (); +} + +void +cls (void) +{ + /* If the terminal is dumb, there is no way to clean the terminal. */ + if (current_term->flags & TERM_DUMB) + grub_putchar ('\n'); + else + current_term->cls (); +} + +int +setcursor (int on) +{ + if (current_term->setcursor) + return current_term->setcursor (on); + + return 1; +} +#endif /* ! STAGE1_5 */ + +int +substring (const char *s1, const char *s2) +{ + while (*s1 == *s2) + { + /* The strings match exactly. */ + if (! *(s1++)) + return 0; + s2 ++; + } + + /* S1 is a substring of S2. */ + if (*s1 == 0) + return -1; + + /* S1 isn't a substring. */ + return 1; +} + +#if !defined(STAGE1_5) || defined(FSYS_ZFS) +char * +grub_strstr (const char *s1, const char *s2) +{ + while (*s1) + { + const char *ptr, *tmp; + + ptr = s1; + tmp = s2; + + while (*tmp && *ptr == *tmp) + ptr++, tmp++; + + if (tmp > s2 && ! *tmp) + return (char *) s1; + + s1++; + } + + return 0; +} + +int +grub_strlen (const char *str) +{ + int len = 0; + + while (*str++) + len++; + + return len; +} +#endif /* !defined(STAGE1_5) || defined(FSYS_ZFS) */ + +#ifndef STAGE1_5 +/* Terminate the string STR with NUL. */ +int +nul_terminate (char *str) +{ + int ch; + + while (*str && ! grub_isspace (*str)) + str++; + + ch = *str; + *str = 0; + return ch; +} + +char * +grub_strchr (char *str, char c) +{ + for (; *str && (*str != c); str++); + + return (*str ? str : NULL); +} +#endif /* ! STAGE1_5 */ + +int +memcheck (unsigned long addr, unsigned long len) +{ + int local_errnum = 0; +#ifdef GRUB_UTIL + auto unsigned long start_addr (void); + auto unsigned long end_addr (void); + + auto unsigned long start_addr (void) + { + int ret; +# if defined(HAVE_START_SYMBOL) + asm volatile ("movl $start, %0" : "=a" (ret)); +# elif defined(HAVE_USCORE_START_SYMBOL) + asm volatile ("movl $_start, %0" : "=a" (ret)); +# endif + return ret; + } + + auto unsigned long end_addr (void) + { + int ret; +# if defined(HAVE_END_SYMBOL) + asm volatile ("movl $end, %0" : "=a" (ret)); +# elif defined(HAVE_USCORE_END_SYMBOL) + asm volatile ("movl $_end, %0" : "=a" (ret)); +# endif + return ret; + } + + if (start_addr () <= addr && end_addr () > addr + len) + return ! local_errnum; +#endif /* GRUB_UTIL */ + + if ((addr < RAW_ADDR (0x1000)) + || (addr < RAW_ADDR (0x100000) + && RAW_ADDR (mbi.mem_lower * 1024) < (addr + len)) + || (addr >= RAW_ADDR (0x100000) + && RAW_ADDR (mbi.mem_upper * 1024) < ((addr - 0x100000) + len))) + local_errnum = ERR_WONT_FIT; + + if (errnum == 0) /* preserve original errnum */ + errnum = local_errnum; + return ! local_errnum; +} + +void +grub_memcpy(void *dest, const void *src, int len) +{ + int i; + register char *d = (char*)dest, *s = (char*)src; + + for (i = 0; i < len; i++) + d[i] = s[i]; +} + +void * +grub_memmove (void *to, const void *from, int len) +{ + if (memcheck ((int) to, len)) + { + /* This assembly code is stolen from + linux-2.2.2/include/asm-i386/string.h. This is not very fast + but compact. */ + int d0, d1, d2; + + if (to < from) + { + asm volatile ("cld\n\t" + "rep\n\t" + "movsb" + : "=&c" (d0), "=&S" (d1), "=&D" (d2) + : "0" (len),"1" (from),"2" (to) + : "memory"); + } + else + { + asm volatile ("std\n\t" + "rep\n\t" + "movsb\n\t" + "cld" + : "=&c" (d0), "=&S" (d1), "=&D" (d2) + : "0" (len), + "1" (len - 1 + (const char *) from), + "2" (len - 1 + (char *) to) + : "memory"); + } + return to; + } + + return NULL; +} + +void * +grub_memset (void *start, int c, int len) +{ + char *p = start; + + if (memcheck ((int) start, len)) + { + while (len -- > 0) + *p ++ = c; + } + + return errnum ? NULL : start; +} + +#ifndef STAGE1_5 +char * +grub_strcpy (char *dest, const char *src) +{ + grub_memmove (dest, src, grub_strlen (src) + 1); + return dest; +} +#endif /* ! STAGE1_5 */ + +#ifndef GRUB_UTIL +# undef memcpy +/* GCC emits references to memcpy() for struct copies etc. */ +void *memcpy (void *dest, const void *src, int n) __attribute__ ((alias ("grub_memmove"))); +#endif diff --git a/usr/src/grub/grub-0.97/stage2/cmdline.c b/usr/src/grub/grub-0.97/stage2/cmdline.c new file mode 100644 index 0000000000..46c5fda027 --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/cmdline.c @@ -0,0 +1,273 @@ +/* cmdline.c - the device-independent GRUB text command line */ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2004 Free Software Foundation, 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 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 +#include + +extern struct term_entry *current_term; + +#ifdef SUPPORT_DISKLESS +# include +#endif + +grub_jmp_buf restart_cmdline_env; + +/* Find the next word from CMDLINE and return the pointer. If + AFTER_EQUAL is non-zero, assume that the character `=' is treated as + a space. Caution: this assumption is for backward compatibility. */ +char * +skip_to (int after_equal, char *cmdline) +{ + /* Skip until we hit whitespace, or maybe an equal sign. */ + while (*cmdline && *cmdline != ' ' && *cmdline != '\t' && + ! (after_equal && *cmdline == '=')) + cmdline ++; + + /* Skip whitespace, and maybe equal signs. */ + while (*cmdline == ' ' || *cmdline == '\t' || + (after_equal && *cmdline == '=')) + cmdline ++; + + return cmdline; +} + +/* Print a helpful message for the command-line interface. */ +void +print_cmdline_message (int forever) +{ + printf (" [ Minimal BASH-like line editing is supported. For the first word, TAB\n" + " lists possible command completions. Anywhere else TAB lists the possible\n" + " completions of a device/filename.%s ]\n", + (forever ? "" : " ESC at any time exits.")); +} + +/* Find the builtin whose command name is COMMAND and return the + pointer. If not found, return 0. */ +struct builtin * +find_command (char *command) +{ + char *ptr; + char c; + struct builtin **builtin; + + /* Find the first space and terminate the command name. */ + ptr = command; + while (*ptr && *ptr != ' ' && *ptr != '\t' && *ptr != '=') + ptr ++; + + c = *ptr; + *ptr = 0; + + /* Seek out the builtin whose command name is COMMAND. */ + for (builtin = builtin_table; *builtin != 0; builtin++) + { + int ret = grub_strcmp (command, (*builtin)->name); + + if (ret == 0) + { + /* Find the builtin for COMMAND. */ + *ptr = c; + return *builtin; + } + else if (ret < 0) + break; + } + + /* Cannot find COMMAND. */ + errnum = ERR_UNRECOGNIZED; + *ptr = c; + return 0; +} + +/* Initialize the data for the command-line. */ +static void +init_cmdline (void) +{ + /* Initialization. */ + saved_drive = boot_drive; + saved_partition = install_partition; + current_drive = GRUB_INVALID_DRIVE; + errnum = 0; + count_lines = -1; + + /* Restore memory probe state. */ + mbi.mem_upper = saved_mem_upper; + if (mbi.mmap_length) + mbi.flags |= MB_INFO_MEM_MAP; + + /* Initialize the data for the builtin commands. */ + init_builtins (); +} + +/* Enter the command-line interface. HEAP is used for the command-line + buffer. Return only if FOREVER is nonzero and get_cmdline returns + nonzero (ESC is pushed). */ +void +enter_cmdline (char *heap, int forever) +{ + /* Initialize the data and print a message. */ + init_cmdline (); + grub_setjmp (restart_cmdline_env); + init_page (); +#ifdef SUPPORT_DISKLESS + print_network_configuration (); + grub_putchar ('\n'); +#endif + print_cmdline_message (forever); + + while (1) + { + struct builtin *builtin; + char *arg; + + *heap = 0; + print_error (); + errnum = ERR_NONE; + + /* Get the command-line with the minimal BASH-like interface. */ + if (get_cmdline (PACKAGE "> ", heap, 2048, 0, 1)) + return; + + /* If there was no command, grab a new one. */ + if (! heap[0]) + continue; + + /* Find a builtin. */ + builtin = find_command (heap); + if (! builtin) + continue; + + /* If BUILTIN cannot be run in the command-line, skip it. */ + if (! (builtin->flags & BUILTIN_CMDLINE)) + { + errnum = ERR_UNRECOGNIZED; + continue; + } + + /* Invalidate the cache, because the user may exchange removable + disks. */ + buf_drive = -1; + + /* Start to count lines, only if the internal pager is in use. */ + if (use_pager) + count_lines = 0; + + /* Run BUILTIN->FUNC. */ + arg = skip_to (1, heap); + (builtin->func) (arg, BUILTIN_CMDLINE); + + /* Finish the line count. */ + count_lines = -1; + } +} + +/* Run an entry from the script SCRIPT. HEAP is used for the + command-line buffer. If an error occurs, return non-zero, otherwise + return zero. */ +int +run_script (char *script, char *heap) +{ + char *old_entry; + char *cur_entry = script; + + /* Initialize the data. */ + init_cmdline (); + + while (1) + { + struct builtin *builtin; + char *arg; + + print_error (); + + if (errnum) + { + errnum = ERR_NONE; + + /* + * At this point something must have gone wrong, so dump the + * buffer and flip output back on. + */ + builtin = find_command("verbose"); + (builtin->func) ("on", BUILTIN_SCRIPT); + + /* If a fallback entry is defined, don't prompt a user's + intervention. */ + if (fallback_entryno < 0) + { + grub_printf ("\nPress any key to continue..."); + (void) getkey (); + } + + return 1; + } + + /* Copy the first string in CUR_ENTRY to HEAP. */ + old_entry = cur_entry; + while (*cur_entry++) + ; + + grub_memmove (heap, old_entry, (int) cur_entry - (int) old_entry); + if (! *heap) + { + /* If there is no more command in SCRIPT... */ + + /* If any kernel is not loaded, just exit successfully. */ + if (kernel_type == KERNEL_TYPE_NONE) + return 0; + + if (reset_term) + if (current_term->shutdown) { + (*current_term->shutdown)(); + current_term = term_table; /* assumption: console is first */ + } + + + /* Otherwise, the command boot is run implicitly. */ + grub_memmove (heap, "boot", 5); + } + + /* Find a builtin. */ + builtin = find_command (heap); + if (! builtin) + { + grub_printf ("%s\n", old_entry); + continue; + } + + if (! (builtin->flags & BUILTIN_NO_ECHO)) + grub_printf ("%s\n", old_entry); + + /* If BUILTIN cannot be run in the command-line, skip it. */ + if (! (builtin->flags & BUILTIN_CMDLINE)) + { + errnum = ERR_UNRECOGNIZED; + continue; + } + + /* Invalidate the cache, because the user may exchange removable + disks. */ + buf_drive = -1; + + /* Run BUILTIN->FUNC. */ + arg = skip_to (1, heap); + (builtin->func) (arg, BUILTIN_SCRIPT); + } +} diff --git a/usr/src/grub/grub-0.97/stage2/common.c b/usr/src/grub/grub-0.97/stage2/common.c new file mode 100644 index 0000000000..878fdfc13c --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/common.c @@ -0,0 +1,354 @@ +/* common.c - miscellaneous shared variables and routines */ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2004 Free Software Foundation, 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 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 + +#ifdef SUPPORT_NETBOOT +#include +#include +#endif + +/* + * Shared BIOS/boot data. + */ + +struct multiboot_info mbi; +unsigned long saved_drive; +unsigned long saved_partition; +unsigned long cdrom_drive; +#ifndef STAGE1_5 +#ifdef SOLARIS_NETBOOT +unsigned long dhcpack_length; +unsigned long dhcpack_buf; +#endif /* SOLARIS_NETBOOT */ +unsigned long saved_mem_upper; + +/* This saves the maximum size of extended memory (in KB). */ +unsigned long extended_memory; +#endif + +/* + * Error code stuff. + */ + +grub_error_t errnum = ERR_NONE; + +#ifndef STAGE1_5 + +char *err_list[] = +{ + [ERR_NONE] = 0, + [ERR_BAD_ARGUMENT] = "Invalid argument", + [ERR_BAD_FILENAME] = + "Filename must be either an absolute pathname or blocklist", + [ERR_BAD_FILETYPE] = "Bad file or directory type", + [ERR_BAD_GZIP_DATA] = "Bad or corrupt data while decompressing file", + [ERR_BAD_GZIP_HEADER] = "Bad or incompatible header in compressed file", + [ERR_BAD_PART_TABLE] = "Partition table invalid or corrupt", + [ERR_BAD_VERSION] = "Mismatched or corrupt version of stage1/stage2", + [ERR_BELOW_1MB] = "Loading below 1MB is not supported", + [ERR_BOOT_COMMAND] = "Kernel must be loaded before booting", + [ERR_BOOT_FAILURE] = "Unknown boot failure", + [ERR_BOOT_FEATURES] = "Unsupported Multiboot features requested", + [ERR_DEV_FORMAT] = "Unrecognized device string", + [ERR_DEV_NEED_INIT] = "Device not initialized yet", + [ERR_DEV_VALUES] = "Invalid device requested", + [ERR_EXEC_FORMAT] = "Invalid or unsupported executable format", + [ERR_FILELENGTH] = + "Filesystem compatibility error, cannot read whole file", + [ERR_FILE_NOT_FOUND] = "File not found", + [ERR_FSYS_CORRUPT] = "Inconsistent filesystem structure", + [ERR_FSYS_MOUNT] = "Cannot mount selected partition", + [ERR_GEOM] = "Selected cylinder exceeds maximum supported by BIOS", + [ERR_NEED_LX_KERNEL] = "Linux kernel must be loaded before initrd", + [ERR_NEED_MB_KERNEL] = "Multiboot kernel must be loaded before modules", + [ERR_NO_DISK] = "Selected disk does not exist", + [ERR_NO_DISK_SPACE] = "No spare sectors on the disk", + [ERR_NO_PART] = "No such partition", + [ERR_NUMBER_OVERFLOW] = "Overflow while parsing number", + [ERR_NUMBER_PARSING] = "Error while parsing number", + [ERR_OUTSIDE_PART] = "Attempt to access block outside partition", + [ERR_PRIVILEGED] = "Must be authenticated", + [ERR_READ] = "Disk read error", + [ERR_SYMLINK_LOOP] = "Too many symbolic links", + [ERR_UNALIGNED] = "File is not sector aligned", + [ERR_UNRECOGNIZED] = "Unrecognized command", + [ERR_WONT_FIT] = "Selected item cannot fit into memory", + [ERR_WRITE] = "Disk write error", + [ERR_BAD_GZIP_CRC] = "Incorrect gunzip CRC checksum", + [ERR_FILESYSTEM_NOT_FOUND] = "File System not found", + /* this zfs file system is not found in the pool of the device */ + [ERR_NO_BOOTPATH] = "No valid boot path found in the zfs label. This may be caused by attempting to boot from an off-lined device.", + [ERR_NEWER_VERSION] = "Newer on-disk pool version" +}; + + +/* static for BIOS memory map fakery */ +static struct AddrRangeDesc fakemap[3] = +{ + {20, 0, 0, MB_ARD_MEMORY}, + {20, 0x100000, 0, MB_ARD_MEMORY}, + {20, 0x1000000, 0, MB_ARD_MEMORY} +}; + +/* A big problem is that the memory areas aren't guaranteed to be: + (1) contiguous, (2) sorted in ascending order, or (3) non-overlapping. + Thus this kludge. */ +static unsigned long +mmap_avail_at (unsigned long bottom) +{ + unsigned long long top; + unsigned long addr; + int cont; + + top = bottom; + do + { + for (cont = 0, addr = mbi.mmap_addr; + addr < mbi.mmap_addr + mbi.mmap_length; + addr += *((unsigned long *) addr) + 4) + { + struct AddrRangeDesc *desc = (struct AddrRangeDesc *) addr; + + if (desc->Type == MB_ARD_MEMORY + && desc->BaseAddr <= top + && desc->BaseAddr + desc->Length > top) + { + top = desc->BaseAddr + desc->Length; + cont++; + } + } + } + while (cont); + + /* For now, GRUB assumes 32bits addresses, so... */ + if (top > 0xFFFFFFFF) + top = 0xFFFFFFFF; + + return (unsigned long) top - bottom; +} +#endif /* ! STAGE1_5 */ + +/* This queries for BIOS information. */ +void +init_bios_info (void) +{ +#ifndef STAGE1_5 + unsigned long cont, memtmp, addr; + int drive; +#endif + + /* + * Get information from BIOS on installed RAM. + */ + + mbi.mem_lower = get_memsize (0); + mbi.mem_upper = get_memsize (1); + +#ifndef STAGE1_5 + /* + * We need to call this somewhere before trying to put data + * above 1 MB, since without calling it, address line 20 will be wired + * to 0. Not too desirable. + */ + + gateA20 (1); + + /* Store the size of extended memory in EXTENDED_MEMORY, in order to + tell it to non-Multiboot OSes. */ + extended_memory = mbi.mem_upper; + + /* + * The "mbi.mem_upper" variable only recognizes upper memory in the + * first memory region. If there are multiple memory regions, + * the rest are reported to a Multiboot-compliant OS, but otherwise + * unused by GRUB. + */ + + addr = get_code_end (); + mbi.mmap_addr = addr; + mbi.mmap_length = 0; + cont = 0; + + do + { + cont = get_mmap_entry ((void *) addr, cont); + + /* If the returned buffer's length is zero, quit. */ + if (! *((unsigned long *) addr)) + break; + + mbi.mmap_length += *((unsigned long *) addr) + 4; + addr += *((unsigned long *) addr) + 4; + } + while (cont); + + if (mbi.mmap_length) + { + unsigned long long max_addr; + + /* + * This is to get the lower memory, and upper memory (up to the + * first memory hole), into the "mbi.mem_{lower,upper}" + * elements. This is for OS's that don't care about the memory + * map, but might care about total RAM available. + */ + mbi.mem_lower = mmap_avail_at (0) >> 10; + mbi.mem_upper = mmap_avail_at (0x100000) >> 10; + + /* Find the maximum available address. Ignore any memory holes. */ + for (max_addr = 0, addr = mbi.mmap_addr; + addr < mbi.mmap_addr + mbi.mmap_length; + addr += *((unsigned long *) addr) + 4) + { + struct AddrRangeDesc *desc = (struct AddrRangeDesc *) addr; + + if (desc->Type == MB_ARD_MEMORY && desc->Length > 0 + && desc->BaseAddr + desc->Length > max_addr) + max_addr = desc->BaseAddr + desc->Length; + } + + extended_memory = (max_addr - 0x100000) >> 10; + } + else if ((memtmp = get_eisamemsize ()) != -1) + { + cont = memtmp & ~0xFFFF; + memtmp = memtmp & 0xFFFF; + + if (cont != 0) + extended_memory = (cont >> 10) + 0x3c00; + else + extended_memory = memtmp; + + if (!cont || (memtmp == 0x3c00)) + memtmp += (cont >> 10); + else + { + /* XXX should I do this at all ??? */ + + mbi.mmap_addr = (unsigned long) fakemap; + mbi.mmap_length = sizeof (fakemap); + fakemap[0].Length = (mbi.mem_lower << 10); + fakemap[1].Length = (memtmp << 10); + fakemap[2].Length = cont; + } + + mbi.mem_upper = memtmp; + } + + saved_mem_upper = mbi.mem_upper; + +#ifdef SUPPORT_NETBOOT +#ifdef SOLARIS_NETBOOT + /* leave room for dhcpack_buf */ + dhcpack_buf = addr; + addr += sizeof (struct dhcp_t); +#endif +#endif + + /* Get the drive info. */ + /* FIXME: This should be postponed until a Multiboot kernel actually + requires it, because this could slow down the start-up + unreasonably. */ + mbi.drives_length = 0; + mbi.drives_addr = addr; + + /* For now, GRUB doesn't probe floppies, since it is trivial to map + floppy drives to BIOS drives. */ + for (drive = 0x80; drive < 0x88; drive++) + { + struct geometry geom; + struct drive_info *info = (struct drive_info *) addr; + unsigned short *port; + + /* Get the geometry. This ensures that the drive is present. */ + if (get_diskinfo (drive, &geom)) + break; + + /* Clean out the I/O map. */ + grub_memset ((char *) io_map, 0, + IO_MAP_SIZE * sizeof (unsigned short)); + + /* Disable to probe I/O ports temporarily, because this doesn't + work with some BIOSes (maybe they are too buggy). */ +#if 0 + /* Track the int13 handler. */ + track_int13 (drive); +#endif + + /* Set the information. */ + info->drive_number = drive; + info->drive_mode = ((geom.flags & BIOSDISK_FLAG_LBA_EXTENSION) + ? MB_DI_LBA_MODE : MB_DI_CHS_MODE); + info->drive_cylinders = geom.cylinders; + info->drive_heads = geom.heads; + info->drive_sectors = geom.sectors; + + addr += sizeof (struct drive_info); + for (port = io_map; *port; port++, addr += sizeof (unsigned short)) + *((unsigned short *) addr) = *port; + + info->size = addr - (unsigned long) info; + mbi.drives_length += info->size; + } + + /* Get the ROM configuration table by INT 15, AH=C0h. */ + mbi.config_table = get_rom_config_table (); + + /* Set the boot loader name. */ + mbi.boot_loader_name = (unsigned long) "GNU GRUB " VERSION; + + /* Get the APM BIOS table. */ + get_apm_info (); + if (apm_bios_info.version) + mbi.apm_table = (unsigned long) &apm_bios_info; + + /* + * Initialize other Multiboot Info flags. + */ + + mbi.flags = (MB_INFO_MEMORY | MB_INFO_CMDLINE | MB_INFO_BOOTDEV + | MB_INFO_DRIVE_INFO | MB_INFO_CONFIG_TABLE + | MB_INFO_BOOT_LOADER_NAME); + + if (apm_bios_info.version) + mbi.flags |= MB_INFO_APM_TABLE; + +#endif /* STAGE1_5 */ + + /* Set boot drive and partition. */ + saved_drive = boot_drive; + saved_partition = install_partition; + + /* Set cdrom drive. */ + { + struct geometry geom; + + /* Get the geometry. */ + if (get_diskinfo (boot_drive, &geom) + || ! (geom.flags & BIOSDISK_FLAG_CDROM)) + cdrom_drive = GRUB_INVALID_DRIVE; + else + cdrom_drive = boot_drive; + } + + /* Start main routine here. */ + cmain (); +} diff --git a/usr/src/grub/grub-0.97/stage2/console.c b/usr/src/grub/grub-0.97/stage2/console.c new file mode 100644 index 0000000000..fbe212e0d6 --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/console.c @@ -0,0 +1,62 @@ +/* term_console.c - console input and output */ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2002 Free Software Foundation, 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 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 +#include + +/* These functions are defined in asm.S instead of this file: + console_putchar, console_checkkey, console_getkey, console_getxy, + console_gotoxy, console_cls, and console_nocursor. */ + +int console_current_color = A_NORMAL; +static int console_standard_color = A_NORMAL; +static int console_normal_color = A_NORMAL; +static int console_highlight_color = A_REVERSE; +static color_state console_color_state = COLOR_STATE_STANDARD; + +void +console_setcolorstate (color_state state) +{ + switch (state) { + case COLOR_STATE_STANDARD: + console_current_color = console_standard_color; + break; + case COLOR_STATE_NORMAL: + console_current_color = console_normal_color; + break; + case COLOR_STATE_HIGHLIGHT: + console_current_color = console_highlight_color; + break; + default: + console_current_color = console_standard_color; + break; + } + + console_color_state = state; +} + +void +console_setcolor (int normal_color, int highlight_color) +{ + console_normal_color = normal_color; + console_highlight_color = highlight_color; + + console_setcolorstate (console_color_state); +} diff --git a/usr/src/grub/grub-0.97/stage2/controlregs.h b/usr/src/grub/grub-0.97/stage2/controlregs.h new file mode 100644 index 0000000000..dc675f603f --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/controlregs.h @@ -0,0 +1,161 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2006 Free Software Foundation, 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 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. + */ + +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _SYS_CONTROLREGS_H +#define _SYS_CONTROLREGS_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * This file describes the x86 architecture control registers which + * are part of the privileged architecture. + * + * Many of these definitions are shared between IA-32-style and + * AMD64-style processors. + */ + +/* CR0 Register */ + +#define CR0_PG 0x80000000 /* paging enabled */ +#define CR0_CD 0x40000000 /* cache disable */ +#define CR0_NW 0x20000000 /* not writethrough */ +#define CR0_AM 0x00040000 /* alignment mask */ +#define CR0_WP 0x00010000 /* write protect */ +#define CR0_NE 0x00000020 /* numeric error */ +#define CR0_ET 0x00000010 /* extension type */ +#define CR0_TS 0x00000008 /* task switch */ +#define CR0_EM 0x00000004 /* emulation */ +#define CR0_MP 0x00000002 /* monitor coprocessor */ +#define CR0_PE 0x00000001 /* protection enabled */ + +/* XX64 eliminate these compatibility defines */ + +#define CR0_CE CR0_CD +#define CR0_WT CR0_NW + +#define FMT_CR0 \ + "\20\40pg\37cd\36nw\35am\21wp\6ne\5et\4ts\3em\2mp\1pe" + +/* CR3 Register */ + +#define CR3_PCD 0x00000010 /* cache disable */ +#define CR3_PWT 0x00000008 /* write through */ + +#define FMT_CR3 "\20\5pcd\4pwt" + +/* CR4 Register */ + +#define CR4_VME 0x0001 /* virtual-8086 mode extensions */ +#define CR4_PVI 0x0002 /* protected-mode virtual interrupts */ +#define CR4_TSD 0x0004 /* time stamp disable */ +#define CR4_DE 0x0008 /* debugging extensions */ +#define CR4_PSE 0x0010 /* page size extensions */ +#define CR4_PAE 0x0020 /* physical address extension */ +#define CR4_MCE 0x0040 /* machine check enable */ +#define CR4_PGE 0x0080 /* page global enable */ +#define CR4_PCE 0x0100 /* perf-monitoring counter enable */ +#define CR4_OSFXSR 0x0200 /* OS fxsave/fxrstor support */ +#define CR4_OSXMMEXCPT 0x0400 /* OS unmasked exception support */ + +#define FMT_CR4 \ + "\20\13xmme\12fxsr\11pce\10pge\7mce\6pae\5pse\4de\3tsd\2pvi\1vme" + +/* Intel's SYSENTER configuration registers */ + +#define MSR_INTC_SEP_CS 0x174 /* kernel code selector MSR */ +#define MSR_INTC_SEP_ESP 0x175 /* kernel esp MSR */ +#define MSR_INTC_SEP_EIP 0x176 /* kernel eip MSR */ + +/* AMD's EFER register */ + +#define MSR_AMD_EFER 0xc0000080 /* extended feature enable MSR */ + +#define AMD_EFER_NXE 0x800 /* no-execute enable */ +#define AMD_EFER_LMA 0x400 /* long mode active (read-only) */ +#define AMD_EFER_LME 0x100 /* long mode enable */ +#define AMD_EFER_SCE 0x001 /* system call extensions */ + +#define FMT_AMD_EFER \ + "\20\14nxe\13lma\11lme\1sce" + +/* AMD's SYSCFG register */ + +#define MSR_AMD_SYSCFG 0xc0000010 /* system configuration MSR */ + +#define AMD_SYSCFG_TOM2 0x200000 /* MtrrTom2En */ +#define AMD_SYSCFG_MVDM 0x100000 /* MtrrVarDramEn */ +#define AMD_SYSCFG_MFDM 0x080000 /* MtrrFixDramModEn */ +#define AMD_SYSCFG_MFDE 0x040000 /* MtrrFixDramEn */ + +#define FMT_AMD_SYSCFG \ + "\20\26tom2\25mvdm\24mfdm\23mfde" + +/* AMD's syscall/sysret MSRs */ + +#define MSR_AMD_STAR 0xc0000081 /* %cs:%ss:%cs:%ss:%eip for syscall */ +#define MSR_AMD_LSTAR 0xc0000082 /* target %rip of 64-bit syscall */ +#define MSR_AMD_CSTAR 0xc0000083 /* target %rip of 32-bit syscall */ +#define MSR_AMD_SFMASK 0xc0000084 /* syscall flag mask */ + +/* AMD's FS.base and GS.base MSRs */ + +#define MSR_AMD_FSBASE 0xc0000100 /* 64-bit base address for %fs */ +#define MSR_AMD_GSBASE 0xc0000101 /* 64-bit base address for %gs */ +#define MSR_AMD_KGSBASE 0xc0000102 /* swapgs swaps this with gsbase */ + +/* AMD's configuration MSRs, weakly documented in the revision guide */ + +#define MSR_AMD_DC_CFG 0xc0011022 + +#define AMD_DC_CFG_DIS_CNV_WC_SSO (UINT64_C(1) << 3) +#define AMD_DC_CFG_DIS_SMC_CHK_BUF (UINT64_C(1) << 10) + +/* AMD's HWCR MSR */ + +#define MSR_AMD_HWCR 0xc0010015 + +#define AMD_HWCR_FFDIS 0x00040 /* disable TLB Flush Filter */ +#define AMD_HWCR_MCI_STATUS_WREN 0x40000 /* enable write of MCi_STATUS */ + +/* AMD's NorthBridge Config MSR, SHOULD ONLY BE WRITTEN TO BY BIOS */ + +#define MSR_AMD_NB_CFG 0xc001001f + +#define MSR_BU_CFG 0xc0011023 + +#define AMD_NB_CFG_SRQ_HEARTBEAT (UINT64_C(1) << 20) +#define AMD_NB_CFG_SRQ_SPR (UINT64_C(1) << 32) + +/* AMD */ +#define MSR_AMD_PATCHLEVEL 0x8b + +#ifdef __cplusplus +} +#endif + +#endif /* !_SYS_CONTROLREGS_H */ diff --git a/usr/src/grub/grub-0.97/stage2/cpu.h b/usr/src/grub/grub-0.97/stage2/cpu.h new file mode 100644 index 0000000000..34180727d9 --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/cpu.h @@ -0,0 +1,73 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2006 Free Software Foundation, 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 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. + */ +/* + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _AMD64_CPU +#define _AMD64_CPU + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef unsigned int uint_t; +typedef unsigned long ulong_t; + +#define BITX(u, h, l) (((u) >> (l)) & ((1lu << ((h) - (l) + 1lu)) - 1lu)) + +#include + +#define CB 0x0001 + +extern void amd64_flush_tlb(void); +extern void amd64_flush_tlbentry(caddr_t); + +extern ulong_t amd64_get_cr2(void); +extern ulong_t amd64_get_cr0(void); +extern ulong_t amd64_get_cr3(void); +extern ulong_t amd64_get_cr4(void); + +extern ulong_t amd64_get_eflags(void); + +struct amd64_cpuid_regs { + uint32_t r_eax; + uint32_t r_ebx; + uint32_t r_ecx; + uint32_t r_edx; +}; + +#define AMD64_Auth 0x68747541 +#define AMD64_enti 0x69746e65 +#define AMD64_cAMD 0x444d4163 + +extern uint32_t amd64_cpuid_supported(void); +extern void amd64_cpuid_insn(uint32_t, struct amd64_cpuid_regs *); +extern void amd64_rdmsr(uint32_t, uint64_t *); +extern void amd64_wrmsr(uint32_t, const uint64_t *); +extern int get_target_operating_mode(void); + +#ifdef __cplusplus +} +#endif + +#endif /* _AMD64_CPU */ diff --git a/usr/src/grub/grub-0.97/stage2/defs.h b/usr/src/grub/grub-0.97/stage2/defs.h new file mode 100644 index 0000000000..aac9207c08 --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/defs.h @@ -0,0 +1,98 @@ +/* + * Mach Operating System + * Copyright (c) 1991,1990 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. + * + * 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 FROM THE USE OF THIS SOFTWARE. + * + * Carnegie Mellon requests users of this software to return to + * + * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU + * School of Computer Science + * Carnegie Mellon University + * Pittsburgh PA 15213-3890 + * + * any improvements or extensions that they make and grant Carnegie Mellon + * the rights to redistribute these changes. + */ +/* + * Common definitions for Berkeley Fast File System. + */ + +/* + * Compatibility definitions for disk IO. + */ + +/* + * Disk devices do all IO in 512-byte blocks. + */ +#define DEV_BSIZE 512 + +/* + * Conversion between bytes and disk blocks. + */ +#define btodb(byte_offset) ((byte_offset) >> 9) +#define dbtob(block_number) ((block_number) << 9) + +/* + * Compatibility definitions for old type names. + */ + +typedef unsigned char u_char; /* unsigned char */ +typedef unsigned short u_short; /* unsigned short */ +typedef unsigned int u_int; /* unsigned int */ + +#if !defined(__sun) || !defined(GRUB_UTIL) +typedef struct _quad_ + { + unsigned int val[2]; /* 2 int values make... */ + } +quad; /* an 8-byte item */ +#endif /* !__sun || !GRUB_UTIL */ + +typedef unsigned int mach_time_t; /* an unsigned int */ +typedef unsigned int mach_daddr_t; /* an unsigned int */ +typedef unsigned int mach_off_t; /* another unsigned int */ + +typedef unsigned short mach_uid_t; +typedef unsigned short mach_gid_t; +typedef unsigned int mach_ino_t; + +#ifndef NBBY +#define NBBY 8 +#endif + +/* + * The file system is made out of blocks of at most MAXBSIZE units, + * with smaller units (fragments) only in the last direct block. + * MAXBSIZE primarily determines the size of buffers in the buffer + * pool. It may be made larger without any effect on existing + * file systems; however, making it smaller may make some file + * systems unmountable. + * + * Note that the disk devices are assumed to have DEV_BSIZE "sectors" + * and that fragments must be some multiple of this size. + */ +#define MAXBSIZE 8192 +#define MAXFRAG 8 + +/* + * MAXPATHLEN defines the longest permissible path length + * after expanding symbolic links. + * + * MAXSYMLINKS defines the maximum number of symbolic links + * that may be expanded in a path name. It should be set + * high enough to allow all legitimate uses, but halt infinite + * loops reasonably quickly. + */ + +#define MAXPATHLEN 1024 +#define MAXSYMLINKS 8 diff --git a/usr/src/grub/grub-0.97/stage2/dir.h b/usr/src/grub/grub-0.97/stage2/dir.h new file mode 100644 index 0000000000..287bf60298 --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/dir.h @@ -0,0 +1,147 @@ + +/* + * Mach Operating System + * Copyright (c) 1991,1990 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. + * + * 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 FROM THE USE OF THIS SOFTWARE. + * + * Carnegie Mellon requests users of this software to return to + * + * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU + * School of Computer Science + * Carnegie Mellon University + * Pittsburgh PA 15213-3890 + * + * any improvements or extensions that they make and grant Carnegie Mellon + * the rights to redistribute these changes. + */ +/* + * Copyright (c) 1982, 1986, 1989 The 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 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + * + * @(#)dir.h 7.6 (Berkeley) 5/9/89 + */ + +#ifndef _BOOT_UFS_DIR_H_ +#define _BOOT_UFS_DIR_H_ + +/* + * A directory consists of some number of blocks of DIRBLKSIZ + * bytes, where DIRBLKSIZ is chosen such that it can be transferred + * to disk in a single atomic operation (e.g. 512 bytes on most machines). + * + * Each DIRBLKSIZ byte block contains some number of directory entry + * structures, which are of variable length. Each directory entry has + * a struct direct at the front of it, containing its inode number, + * the length of the entry, and the length of the name contained in + * the entry. These are followed by the name padded to a 4 byte boundary + * with null bytes. All names are guaranteed null terminated. + * The maximum length of a name in a directory is MAXNAMLEN. + * + * The macro DIRSIZ(dp) gives the amount of space required to represent + * a directory entry. Free space in a directory is represented by + * entries which have dp->d_reclen > DIRSIZ(dp). All DIRBLKSIZ bytes + * in a directory block are claimed by the directory entries. This + * usually results in the last entry in a directory having a large + * dp->d_reclen. When entries are deleted from a directory, the + * space is returned to the previous entry in the same directory + * block by increasing its dp->d_reclen. If the first entry of + * a directory block is free, then its dp->d_ino is set to 0. + * Entries other than the first in a directory do not normally have + * dp->d_ino set to 0. + */ +#define DIRBLKSIZ DEV_BSIZE +#define MAXNAMLEN 255 + +struct direct + { + u_int d_ino; /* inode number of entry */ + u_short d_reclen; /* length of this record */ + u_short d_namlen; /* length of string in d_name */ + char d_name[MAXNAMLEN + 1]; /* name with length <= MAXNAMLEN */ + }; + +/* + * The DIRSIZ macro gives the minimum record length which will hold + * the directory entry. This requires the amount of space in struct direct + * without the d_name field, plus enough space for the name with a terminating + * null byte (dp->d_namlen+1), rounded up to a 4 byte boundary. + */ +#undef DIRSIZ +#define DIRSIZ(dp) \ + ((sizeof (struct direct) - (MAXNAMLEN+1)) + (((dp)->d_namlen+1 + 3) &~ 3)) + +#ifdef KERNEL +/* + * Template for manipulating directories. + * Should use struct direct's, but the name field + * is MAXNAMLEN - 1, and this just won't do. + */ +struct dirtemplate + { + u_int dot_ino; + short dot_reclen; + short dot_namlen; + char dot_name[4]; /* must be multiple of 4 */ + u_int dotdot_ino; + short dotdot_reclen; + short dotdot_namlen; + char dotdot_name[4]; /* ditto */ + }; +#endif + +/* + * The following information should be obtained from + * and is provided solely (and temporarily) for backward compatibility. + */ +#ifndef KERNEL +#define d_fileno d_ino /* compatibility with POSIX */ +#ifndef DEV_BSIZE +#define DEV_BSIZE 512 +#endif +/* + * Definitions for library routines operating on directories. + */ +typedef struct _dirdesc + { + int dd_fd; + int dd_loc; + int dd_size; + char dd_buf[DIRBLKSIZ]; + } +DIR; + +#define dirfd(dirp) ((dirp)->dd_fd) + +#ifndef NULL +#define NULL 0 +#endif +extern DIR *opendir (); +extern struct direct *readdir (); +extern int telldir (); +extern void seekdir (); +#define rewinddir(dirp) seekdir((dirp), (long)0) +extern void closedir (); +#endif /* not KERNEL */ +#endif /* _BOOT_UFS_DIR_H_ */ diff --git a/usr/src/grub/grub-0.97/stage2/disk_inode.h b/usr/src/grub/grub-0.97/stage2/disk_inode.h new file mode 100644 index 0000000000..2103cb86a4 --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/disk_inode.h @@ -0,0 +1,110 @@ +/* + * Mach Operating System + * Copyright (c) 1991,1990 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. + * + * 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 FROM THE USE OF THIS SOFTWARE. + * + * Carnegie Mellon requests users of this software to return to + * + * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU + * School of Computer Science + * Carnegie Mellon University + * Pittsburgh PA 15213-3890 + * + * any improvements or extensions that they make and grant Carnegie Mellon + * the rights to redistribute these changes. + */ +/* + * Copyright (c) 1982, 1989 The 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 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + * + * @(#)inode.h 7.5 (Berkeley) 7/3/89 + */ + +#ifndef _BOOT_UFS_DISK_INODE_H_ +#define _BOOT_UFS_DISK_INODE_H_ + +/* + * The I node is the focus of all file activity in the BSD Fast File System. + * There is a unique inode allocated for each active file, + * each current directory, each mounted-on file, text file, and the root. + * An inode is 'named' by its dev/inumber pair. (iget/iget.c) + * Data in icommon is read in from permanent inode on volume. + */ + +#define FFS_NDADDR 12 /* direct addresses in inode */ +#define FFS_NIADDR 3 /* indirect addresses in inode */ + +#define FFS_MAX_FASTLINK_SIZE ((FFS_NDADDR + FFS_NIADDR) \ + * sizeof (mach_daddr_t)) + +struct icommon + { + u_short ic_mode; /* 0: mode and type of file */ + short ic_nlink; /* 2: number of links to file */ + mach_uid_t ic_uid; /* 4: owner's user id */ + mach_gid_t ic_gid; /* 6: owner's group id */ + quad ic_size; /* 8: number of bytes in file */ + mach_time_t ic_atime; /* 16: time last accessed */ + int ic_atspare; + mach_time_t ic_mtime; /* 24: time last modified */ + int ic_mtspare; + mach_time_t ic_ctime; /* 32: last time inode changed */ + int ic_ctspare; + union + { + struct + { + mach_daddr_t Mb_db[FFS_NDADDR]; /* 40: disk block addresses */ + mach_daddr_t Mb_ib[FFS_NIADDR]; /* 88: indirect blocks */ + } + ic_Mb; + char ic_Msymlink[FFS_MAX_FASTLINK_SIZE]; + /* 40: symbolic link name */ + } + ic_Mun; +#define ic_db ic_Mun.ic_Mb.Mb_db +#define ic_ib ic_Mun.ic_Mb.Mb_ib +#define ic_symlink ic_Mun.ic_Msymlink + int ic_flags; /* 100: status, currently unused */ + int ic_blocks; /* 104: blocks actually held */ + int ic_gen; /* 108: generation number */ + int ic_spare[4]; /* 112: reserved, currently unused */ + }; + +/* + * Same structure, but on disk. + */ +struct dinode + { + union + { + struct icommon di_com; + char di_char[128]; + } + di_un; + }; +#define di_ic di_un.di_com + +#endif /* _BOOT_UFS_DISK_INODE_H_ */ diff --git a/usr/src/grub/grub-0.97/stage2/disk_inode_ffs.h b/usr/src/grub/grub-0.97/stage2/disk_inode_ffs.h new file mode 100644 index 0000000000..1c8caa1588 --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/disk_inode_ffs.h @@ -0,0 +1,101 @@ +/* + * Mach Operating System + * Copyright (c) 1991,1990 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. + * + * 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 FROM THE USE OF THIS SOFTWARE. + * + * Carnegie Mellon requests users of this software to return to + * + * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU + * School of Computer Science + * Carnegie Mellon University + * Pittsburgh PA 15213-3890 + * + * any improvements or extensions that they make and grant Carnegie Mellon + * the rights to redistribute these changes. + */ +/* + * Copyright (c) 1982, 1989 The 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 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + * + * @(#)inode.h 7.5 (Berkeley) 7/3/89 + */ + +#ifndef _BOOT_UFS_DISK_INODE_FFS_H_ +#define _BOOT_UFS_DISK_INODE_FFS_H_ + +#define NDADDR FFS_NDADDR +#define NIADDR FFS_NIADDR + +#define MAX_FASTLINK_SIZE FFS_MAX_FASTLINK_SIZE + +#define IC_FASTLINK 0x0001 /* Symbolic link in inode */ + +#define i_mode ic_mode +#define i_nlink ic_nlink +#define i_uid ic_uid +#define i_gid ic_gid +#if defined(BYTE_MSF) && BYTE_MSF +#define i_size ic_size.val[1] +#else /* BYTE_LSF */ +#define i_size ic_size.val[0] +#endif +#define i_db ic_db +#define i_ib ic_ib +#define i_atime ic_atime +#define i_mtime ic_mtime +#define i_ctime ic_ctime +#define i_blocks ic_blocks +#define i_rdev ic_db[0] +#define i_symlink ic_symlink +#define i_flags ic_flags +#define i_gen ic_gen + +/* modes */ +#define IFMT 0xf000 /* type of file */ +#define IFCHR 0x2000 /* character special */ +#define IFDIR 0x4000 /* directory */ +#define IFBLK 0x6000 /* block special */ +#define IFREG 0x8000 /* regular */ +#define IFLNK 0xa000 /* symbolic link */ +#define IFSOCK 0xc000 /* socket */ + + +#define ISUID 0x0800 /* set user id on execution */ +#define ISGID 0x0400 /* set group id on execution */ +#define ISVTX 0x0200 /* save swapped text even after use */ +#define IREAD 0x0100 /* read, write, execute permissions */ +#define IWRITE 0x0080 +#define IEXEC 0x0040 + +#ifdef EEK +#define f_fs u.ffs.ffs_fs +#define i_ic u.ffs.ffs_ic +#define f_nindir u.ffs.ffs_nindir +#define f_blk u.ffs.ffs_blk +#define f_blksize u.ffs.ffs_blksize +#define f_blkno u.ffs.ffs_blkno +#endif /* EEK */ + +#endif /* _BOOT_UFS_DISK_INODE_FFS_H_ */ diff --git a/usr/src/grub/grub-0.97/stage2/disk_io.c b/usr/src/grub/grub-0.97/stage2/disk_io.c new file mode 100644 index 0000000000..c3497cc518 --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/disk_io.c @@ -0,0 +1,1876 @@ +/* disk_io.c - implement abstract BIOS disk input and output */ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, 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 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 +#include + +#ifdef SUPPORT_NETBOOT +# include +#endif + +#ifdef GRUB_UTIL +# include +#endif + +/* instrumentation variables */ +void (*disk_read_hook) (unsigned int, int, int) = NULL; +void (*disk_read_func) (unsigned int, int, int) = NULL; + +#ifndef STAGE1_5 +int print_possibilities; + +static int do_completion; +static int unique; +static char *unique_string; + +#endif + +int fsmax; +struct fsys_entry fsys_table[NUM_FSYS + 1] = +{ + /* TFTP should come first because others don't handle net device. */ +# ifdef FSYS_TFTP + {"tftp", tftp_mount, tftp_read, tftp_dir, tftp_close, 0}, +# endif +# ifdef FSYS_FAT + {"fat", fat_mount, fat_read, fat_dir, 0, 0}, +# endif +# ifdef FSYS_EXT2FS + {"ext2fs", ext2fs_mount, ext2fs_read, ext2fs_dir, 0, 0}, +# endif +# ifdef FSYS_MINIX + {"minix", minix_mount, minix_read, minix_dir, 0, 0}, +# endif +# ifdef FSYS_REISERFS + {"reiserfs", reiserfs_mount, reiserfs_read, reiserfs_dir, 0, reiserfs_embed}, +# endif +# ifdef FSYS_VSTAFS + {"vstafs", vstafs_mount, vstafs_read, vstafs_dir, 0, 0}, +# endif +# ifdef FSYS_JFS + {"jfs", jfs_mount, jfs_read, jfs_dir, 0, jfs_embed}, +# endif +# ifdef FSYS_XFS + {"xfs", xfs_mount, xfs_read, xfs_dir, 0, 0}, +# endif +# ifdef FSYS_UFS + {"ufs", ufs_mount, ufs_read, ufs_dir, 0, ufs_embed}, +# endif +# ifdef FSYS_UFS2 + {"ufs2", ufs2_mount, ufs2_read, ufs2_dir, 0, ufs2_embed}, +# endif +# ifdef FSYS_ZFS + {"zfs", zfs_mount, zfs_read, zfs_open, 0, zfs_embed}, +# endif +# ifdef FSYS_ISO9660 + {"iso9660", iso9660_mount, iso9660_read, iso9660_dir, 0, 0}, +# endif + /* XX FFS should come last as it's superblock is commonly crossing tracks + on floppies from track 1 to 2, while others only use 1. */ +# ifdef FSYS_FFS + {"ffs", ffs_mount, ffs_read, ffs_dir, 0, ffs_embed}, +# endif + {0, 0, 0, 0, 0, 0} +}; + + +/* These have the same format as "boot_drive" and "install_partition", but + are meant to be working values. */ +unsigned long current_drive = GRUB_INVALID_DRIVE; +unsigned long current_partition; + +#ifndef STAGE1_5 +/* The register ESI should contain the address of the partition to be + used for loading a chain-loader when chain-loading the loader. */ +unsigned long boot_part_addr = 0; +#endif + +/* + * Global variables describing details of the filesystem + */ + +/* FIXME: BSD evil hack */ +#include "freebsd.h" +int bsd_evil_hack; + +/* filesystem type */ +int fsys_type = NUM_FSYS; +#ifndef NO_BLOCK_FILES +static int block_file = 0; +#endif /* NO_BLOCK_FILES */ + +/* these are the translated numbers for the open partition */ +unsigned long part_start; +unsigned long part_length; + +int current_slice; + +/* ZFS root filesystem for booting */ +char current_bootpath[MAXNAMELEN]; +char current_rootpool[MAXNAMELEN]; +char current_bootfs[MAXNAMELEN]; +uint64_t current_bootfs_obj; +char current_devid[MAXNAMELEN]; +int is_zfs_mount; +unsigned long best_drive; +unsigned long best_part; +int find_best_root; + +/* disk buffer parameters */ +int buf_drive = -1; +unsigned int buf_track; +struct geometry buf_geom; + +/* filesystem common variables */ +int filepos; +int filemax; + +static inline unsigned long +grub_log2 (unsigned long word) +{ + asm volatile ("bsfl %1,%0" + : "=r" (word) + : "r" (word)); + return word; +} +#define log2 grub_log2 + +int +rawread(int drive, unsigned int sector, int byte_offset, int byte_len, + char *buf) +{ + int slen, sectors_per_vtrack; + int sector_size_bits = log2 (buf_geom.sector_size); + + if (byte_len <= 0) + return 1; + + while (byte_len > 0 && !errnum) + { + int soff, num_sect, size = byte_len; + unsigned int track; + char *bufaddr; + + /* + * Check track buffer. If it isn't valid or it is from the + * wrong disk, then reset the disk geometry. + */ + if (buf_drive != drive) + { + if (get_diskinfo (drive, &buf_geom)) + { + errnum = ERR_NO_DISK; + return 0; + } + buf_drive = drive; + buf_track = BUF_CACHE_INVALID; + sector_size_bits = log2 (buf_geom.sector_size); + } + + /* Make sure that SECTOR is valid. */ + if (sector >= buf_geom.total_sectors) + { + errnum = ERR_GEOM; + return 0; + } + + slen = ((byte_offset + byte_len + buf_geom.sector_size - 1) + >> sector_size_bits); + + /* Eliminate a buffer overflow. */ + if ((buf_geom.sectors << sector_size_bits) > BUFFERLEN) + sectors_per_vtrack = (BUFFERLEN >> sector_size_bits); + else + sectors_per_vtrack = buf_geom.sectors; + + /* Get the first sector of track. */ + soff = sector % sectors_per_vtrack; + track = sector - soff; + num_sect = sectors_per_vtrack - soff; + bufaddr = ((char *) BUFFERADDR + + (soff << sector_size_bits) + byte_offset); + + if (track != buf_track) + { + int bios_err, read_len = sectors_per_vtrack; + unsigned int read_start = track; + + /* + * If there's more than one read in this entire loop, then + * only make the earlier reads for the portion needed. This + * saves filling the buffer with data that won't be used! + */ + if (slen > num_sect) + { + read_start = sector; + read_len = num_sect; + bufaddr = (char *) BUFFERADDR + byte_offset; + } + + bios_err = biosdisk (BIOSDISK_READ, drive, &buf_geom, + read_start, read_len, BUFFERSEG); + if (bios_err) + { + buf_track = BUF_CACHE_INVALID; + + if (bios_err == BIOSDISK_ERROR_GEOMETRY) + errnum = ERR_GEOM; + else + { + /* + * If there was an error, try to load only the + * required sector(s) rather than failing completely. + */ + if (slen > num_sect + || biosdisk (BIOSDISK_READ, drive, &buf_geom, + sector, slen, BUFFERSEG)) + errnum = ERR_READ; + + bufaddr = (char *) BUFFERADDR + byte_offset; + } + } + else + buf_track = track; + + if ((buf_track == 0 || sector == 0) + && (PC_SLICE_TYPE (BUFFERADDR, 0) == PC_SLICE_TYPE_EZD + || PC_SLICE_TYPE (BUFFERADDR, 1) == PC_SLICE_TYPE_EZD + || PC_SLICE_TYPE (BUFFERADDR, 2) == PC_SLICE_TYPE_EZD + || PC_SLICE_TYPE (BUFFERADDR, 3) == PC_SLICE_TYPE_EZD)) + { + /* This is a EZD disk map sector 0 to sector 1 */ + if (buf_track == 0 || slen >= 2) + { + /* We already read the sector 1, copy it to sector 0 */ + memmove ((char *) BUFFERADDR, + (char *) BUFFERADDR + buf_geom.sector_size, + buf_geom.sector_size); + } + else + { + if (biosdisk (BIOSDISK_READ, drive, &buf_geom, + 1, 1, BUFFERSEG)) + errnum = ERR_READ; + } + } + } + + if (size > ((num_sect << sector_size_bits) - byte_offset)) + size = (num_sect << sector_size_bits) - byte_offset; + + /* + * Instrumentation to tell which sectors were read and used. + */ + if (disk_read_func) + { + unsigned int sector_num = sector; + int length = buf_geom.sector_size - byte_offset; + if (length > size) + length = size; + (*disk_read_func) (sector_num++, byte_offset, length); + length = size - length; + if (length > 0) + { + while (length > buf_geom.sector_size) + { + (*disk_read_func) (sector_num++, 0, buf_geom.sector_size); + length -= buf_geom.sector_size; + } + (*disk_read_func) (sector_num, 0, length); + } + } + + grub_memmove (buf, bufaddr, size); + + buf += size; + byte_len -= size; + sector += num_sect; + byte_offset = 0; + } + + return (!errnum); +} + + +int +devread(unsigned int sector, int byte_offset, int byte_len, char *buf) +{ + /* + * Check partition boundaries + */ + if ((sector + ((byte_offset + byte_len - 1) >> SECTOR_BITS)) + >= part_length) + { + errnum = ERR_OUTSIDE_PART; + return 0; + } + + /* + * Get the read to the beginning of a partition. + */ + sector += byte_offset >> SECTOR_BITS; + byte_offset &= SECTOR_SIZE - 1; + +#if !defined(STAGE1_5) + if (disk_read_hook && debug) + printf ("<%u, %d, %d>", sector, byte_offset, byte_len); +#endif /* !STAGE1_5 */ + + /* + * Call RAWREAD, which is very similar, but: + * + * -- It takes an extra parameter, the drive number. + * -- It requires that "sector" is relative to the beginning + * of the disk. + * -- It doesn't handle offsets of more than 511 bytes into the + * sector. + */ + return rawread (current_drive, part_start + sector, byte_offset, + byte_len, buf); +} + +#ifndef STAGE1_5 +int +rawwrite(int drive, unsigned int sector, char *buf) +{ + if (sector == 0) + { + if (biosdisk (BIOSDISK_READ, drive, &buf_geom, 0, 1, SCRATCHSEG)) + { + errnum = ERR_WRITE; + return 0; + } + + if (PC_SLICE_TYPE (SCRATCHADDR, 0) == PC_SLICE_TYPE_EZD + || PC_SLICE_TYPE (SCRATCHADDR, 1) == PC_SLICE_TYPE_EZD + || PC_SLICE_TYPE (SCRATCHADDR, 2) == PC_SLICE_TYPE_EZD + || PC_SLICE_TYPE (SCRATCHADDR, 3) == PC_SLICE_TYPE_EZD) + sector = 1; + } + + memmove ((char *) SCRATCHADDR, buf, SECTOR_SIZE); + if (biosdisk (BIOSDISK_WRITE, drive, &buf_geom, + sector, 1, SCRATCHSEG)) + { + errnum = ERR_WRITE; + return 0; + } + + if (sector - sector % buf_geom.sectors == buf_track) + /* Clear the cache. */ + buf_track = BUF_CACHE_INVALID; + + return 1; +} + +int +devwrite(unsigned int sector, int sector_count, char *buf) +{ +#if defined(GRUB_UTIL) && defined(__linux__) + if (current_partition != 0xFFFFFF + && is_disk_device (device_map, current_drive)) + { + /* If the grub shell is running under Linux and the user wants to + embed a Stage 1.5 into a partition instead of a MBR, use system + calls directly instead of biosdisk, because of the bug in + Linux. *sigh* */ + return write_to_partition (device_map, current_drive, current_partition, + sector, sector_count, buf); + } + else +#endif /* GRUB_UTIL && __linux__ */ + { + int i; + + for (i = 0; i < sector_count; i++) + { + if (! rawwrite (current_drive, part_start + sector + i, + buf + (i << SECTOR_BITS))) + return 0; + + } + return 1; + } +} + +static int +sane_partition (void) +{ + /* network drive */ + if (current_drive == NETWORK_DRIVE) + return 1; + + if (!(current_partition & 0xFF000000uL) + && ((current_drive & 0xFFFFFF7F) < 8 + || current_drive == cdrom_drive) + && (current_partition & 0xFF) == 0xFF + && ((current_partition & 0xFF00) == 0xFF00 + || (current_partition & 0xFF00) < 0x1000) + && ((current_partition >> 16) == 0xFF + || (current_drive & 0x80))) + return 1; + + errnum = ERR_DEV_VALUES; + return 0; +} +#endif /* ! STAGE1_5 */ + +static void +attempt_mount (void) +{ +#ifndef STAGE1_5 + for (fsys_type = 0; fsys_type < NUM_FSYS; fsys_type++) + if ((fsys_table[fsys_type].mount_func) ()) + break; + + if (fsys_type == NUM_FSYS && errnum == ERR_NONE) + errnum = ERR_FSYS_MOUNT; +#else + fsys_type = 0; + if ((*(fsys_table[fsys_type].mount_func)) () != 1) + { + fsys_type = NUM_FSYS; + errnum = ERR_FSYS_MOUNT; + } +#endif +} + + +#ifndef STAGE1_5 +/* Turn on the active flag for the partition SAVED_PARTITION in the + drive SAVED_DRIVE. If an error occurs, return zero, otherwise return + non-zero. */ +int +make_saved_active (void) +{ + char mbr[512]; + + if (saved_drive & 0x80) + { + /* Hard disk */ + int part = saved_partition >> 16; + + /* If the partition is not a primary partition, the active flag is + meaningless. (XXX: Really?) */ + if (part > 3) + { + errnum = ERR_DEV_VALUES; + return 0; + } + + /* Read the MBR in the scratch space. */ + if (! rawread (saved_drive, 0, 0, SECTOR_SIZE, mbr)) + return 0; + + /* If the partition is an extended partition, setting the active + flag violates the specification by IBM. */ + if (IS_PC_SLICE_TYPE_EXTENDED (PC_SLICE_TYPE (mbr, part))) + { + errnum = ERR_DEV_VALUES; + return 0; + } + + /* Check if the active flag is disabled. */ + if (PC_SLICE_FLAG (mbr, part) != PC_SLICE_FLAG_BOOTABLE) + { + int i; + + /* Clear all the active flags in this table. */ + for (i = 0; i < 4; i++) + PC_SLICE_FLAG (mbr, i) = 0; + + /* Set the flag. */ + PC_SLICE_FLAG (mbr, part) = PC_SLICE_FLAG_BOOTABLE; + + /* Write back the MBR. */ + if (! rawwrite (saved_drive, 0, mbr)) + return 0; + } + } + else + { + /* If the drive is not a hard disk drive, you shouldn't call this + function. (XXX: Should I just ignore this error?) */ + errnum = ERR_DEV_VALUES; + return 0; + } + + return 1; +} + +/* Hide/Unhide CURRENT_PARTITION. */ +int +set_partition_hidden_flag (int hidden) +{ + unsigned long part = 0xFFFFFF; + unsigned long start, len, offset, ext_offset; + int entry, type; + char mbr[512]; + + /* The drive must be a hard disk. */ + if (! (current_drive & 0x80)) + { + errnum = ERR_BAD_ARGUMENT; + return 1; + } + + /* The partition must be a PC slice. */ + if ((current_partition >> 16) == 0xFF + || (current_partition & 0xFFFF) != 0xFFFF) + { + errnum = ERR_BAD_ARGUMENT; + return 1; + } + + /* Look for the partition. */ + while (next_partition (current_drive, 0xFFFFFF, &part, &type, + &start, &len, &offset, &entry, + &ext_offset, mbr)) + { + if (part == current_partition) + { + /* Found. */ + if (hidden) + PC_SLICE_TYPE (mbr, entry) |= PC_SLICE_TYPE_HIDDEN_FLAG; + else + PC_SLICE_TYPE (mbr, entry) &= ~PC_SLICE_TYPE_HIDDEN_FLAG; + + /* Write back the MBR to the disk. */ + buf_track = BUF_CACHE_INVALID; + if (! rawwrite (current_drive, offset, mbr)) + return 1; + + /* Succeed. */ + return 0; + } + } + + return 1; +} + + +static void +check_and_print_mount (void) +{ + attempt_mount (); + if (errnum == ERR_FSYS_MOUNT) + errnum = ERR_NONE; + if (!errnum) + print_fsys_type (); + print_error (); +} +#endif /* STAGE1_5 */ + + +/* Get the information on next partition on the drive DRIVE. + The caller must not modify the contents of the arguments when + iterating this function. The partition representation in GRUB will + be stored in *PARTITION. Likewise, the partition type in *TYPE, the + start sector in *START, the length in *LEN, the offset of the + partition table in *OFFSET, the entry number in the table in *ENTRY, + the offset of the extended partition in *EXT_OFFSET. + BUF is used to store a MBR, the boot sector of a partition, or + a BSD label sector, and it must be at least 512 bytes length. + When calling this function first, *PARTITION must be initialized to + 0xFFFFFF. The return value is zero if fails, otherwise non-zero. */ +int +next_partition (unsigned long drive, unsigned long dest, + unsigned long *partition, int *type, + unsigned long *start, unsigned long *len, + unsigned long *offset, int *entry, + unsigned long *ext_offset, char *buf) +{ + /* Forward declarations. */ + auto int next_bsd_partition (void); + auto int next_solaris_partition(void); + auto int next_pc_slice (void); + + /* Get next BSD partition in current PC slice. */ + int next_bsd_partition (void) + { + int i; + int bsd_part_no = (*partition & 0xFF00) >> 8; + + /* If this is the first time... */ + if (bsd_part_no == 0xFF) + { + /* Check if the BSD label is within current PC slice. */ + if (*len < BSD_LABEL_SECTOR + 1) + { + errnum = ERR_BAD_PART_TABLE; + return 0; + } + + /* Read the BSD label. */ + if (! rawread (drive, *start + BSD_LABEL_SECTOR, + 0, SECTOR_SIZE, buf)) + return 0; + + /* Check if it is valid. */ + if (! BSD_LABEL_CHECK_MAG (buf)) + { + errnum = ERR_BAD_PART_TABLE; + return 0; + } + + bsd_part_no = -1; + } + + /* Search next valid BSD partition. */ + for (i = bsd_part_no + 1; i < BSD_LABEL_NPARTS (buf); i++) + { + if (BSD_PART_TYPE (buf, i)) + { + /* Note that *TYPE and *PARTITION were set + for current PC slice. */ + *type = (BSD_PART_TYPE (buf, i) << 8) | (*type & 0xFF); + *start = BSD_PART_START (buf, i); + *len = BSD_PART_LENGTH (buf, i); + *partition = (*partition & 0xFF00FF) | (i << 8); + +#ifndef STAGE1_5 + /* XXX */ + if ((drive & 0x80) && BSD_LABEL_DTYPE (buf) == DTYPE_SCSI) + bsd_evil_hack = 4; +#endif /* ! STAGE1_5 */ + + return 1; + } + } + + errnum = ERR_NO_PART; + return 0; + } + + /* Get next Solaris partition in current PC slice. */ + int next_solaris_partition (void) + { + static unsigned long pcs_start; + int i; + int sol_part_no = (*partition & 0xFF00) >> 8; + + /* If this is the first time... */ + if (sol_part_no == 0xFF) + { + /* Check if the Solaris label is within current PC slice. */ + if (*len < SOL_LABEL_LOC + 1) + { + errnum = ERR_BAD_PART_TABLE; + return 0; + } + + /* Read the Solaris label. */ + if (! rawread (drive, *start + SOL_LABEL_LOC, 0, SECTOR_SIZE, buf)) + return 0; + + /* Check if it is valid. */ + if (! SOL_LABEL_CHECK_MAG (buf)) + { + errnum = ERR_BAD_PART_TABLE; + return 0; + } + + sol_part_no = -1; + pcs_start = *start; /* save the start of pc slice */ + } + + /* Search next valid Solaris partition. */ + for (i = sol_part_no + 1; i < SOL_LABEL_NPARTS; i++) + { + if (SOL_PART_EXISTS (buf, i)) + { + /* SOL_PART_START is relative to fdisk partition */ + *start = SOL_PART_START (buf, i) + pcs_start; + *len = SOL_PART_LENGTH (buf, i); + *partition = (*partition & 0xFF00FF) | (i << 8); + + return 1; + } + } + + errnum = ERR_NO_PART; + return 0; + } + + /* Get next PC slice. Be careful of that this function may return + an empty PC slice (i.e. a partition whose type is zero) as well. */ + int next_pc_slice (void) + { + int pc_slice_no = (*partition & 0xFF0000) >> 16; + + /* If this is the first time... */ + if (pc_slice_no == 0xFF) + { + *offset = 0; + *ext_offset = 0; + *entry = -1; + pc_slice_no = -1; + } + + /* Read the MBR or the boot sector of the extended partition. */ + if (! rawread (drive, *offset, 0, SECTOR_SIZE, buf)) + return 0; + + /* Check if it is valid. */ + if (! PC_MBR_CHECK_SIG (buf)) + { + errnum = ERR_BAD_PART_TABLE; + return 0; + } + + /* Increase the entry number. */ + (*entry)++; + + /* If this is out of current partition table... */ + if (*entry == PC_SLICE_MAX) + { + int i; + + /* Search the first extended partition in current table. */ + for (i = 0; i < PC_SLICE_MAX; i++) + { + if (IS_PC_SLICE_TYPE_EXTENDED (PC_SLICE_TYPE (buf, i))) + { + /* Found. Set the new offset and the entry number, + and restart this function. */ + *offset = *ext_offset + PC_SLICE_START (buf, i); + if (! *ext_offset) + *ext_offset = *offset; + *entry = -1; + return next_pc_slice (); + } + } + + errnum = ERR_NO_PART; + return 0; + } + + *type = PC_SLICE_TYPE (buf, *entry); + *start = *offset + PC_SLICE_START (buf, *entry); + *len = PC_SLICE_LENGTH (buf, *entry); + + /* The calculation of a PC slice number is complicated, because of + the rather odd definition of extended partitions. Even worse, + there is no guarantee that this is consistent with every + operating systems. Uggh. */ + if (pc_slice_no < PC_SLICE_MAX + || (! IS_PC_SLICE_TYPE_EXTENDED (*type) + && *type != PC_SLICE_TYPE_NONE)) + pc_slice_no++; + + *partition = (pc_slice_no << 16) | 0xFFFF; + return 1; + } + + /* Start the body of this function. */ + +#ifndef STAGE1_5 + if (current_drive == NETWORK_DRIVE) + return 0; +#endif + + /* check for Solaris partition */ + if (*partition != 0xFFFFFF && IS_PC_SLICE_TYPE_SOLARIS (*type & 0xff)) + { + if (next_solaris_partition ()) + return 1; + errnum = ERR_NONE; + } + + /* If previous partition is a BSD partition or a PC slice which + contains BSD partitions... */ + if ((*partition != 0xFFFFFF && IS_PC_SLICE_TYPE_BSD (*type & 0xff)) + || ! (drive & 0x80)) + { + if (*type == PC_SLICE_TYPE_NONE) + *type = PC_SLICE_TYPE_FREEBSD; + + /* Get next BSD partition, if any. */ + if (next_bsd_partition ()) + return 1; + + /* If the destination partition is a BSD partition and current + BSD partition has any error, abort the operation. */ + if ((dest & 0xFF00) != 0xFF00 + && ((dest & 0xFF0000) == 0xFF0000 + || (dest & 0xFF0000) == (*partition & 0xFF0000))) + return 0; + + /* Ignore the error. */ + errnum = ERR_NONE; + } + + return next_pc_slice (); +} + +#ifndef STAGE1_5 +static unsigned long cur_part_offset; +static unsigned long cur_part_addr; +#endif + +/* Open a partition. */ +int +real_open_partition (int flags) +{ + unsigned long dest_partition = current_partition; + unsigned long part_offset; + unsigned long ext_offset; + int entry; + char buf[SECTOR_SIZE]; + int unix_part, pc_slice; + + /* For simplicity. */ + auto int next (void); + int next (void) + { + int ret = next_partition (current_drive, dest_partition, + ¤t_partition, ¤t_slice, + &part_start, &part_length, + &part_offset, &entry, &ext_offset, buf); + unix_part = (current_partition >> 8) & 0xFF; + pc_slice = current_partition >> 16; + return ret; + } + +#ifndef STAGE1_5 + /* network drive */ + if (current_drive == NETWORK_DRIVE) + return 1; + + if (! sane_partition ()) + return 0; +#endif + + bsd_evil_hack = 0; + current_slice = 0; + part_start = 0; + + /* Make sure that buf_geom is valid. */ + if (buf_drive != current_drive) + { + if (get_diskinfo (current_drive, &buf_geom)) + { + errnum = ERR_NO_DISK; + return 0; + } + buf_drive = current_drive; + buf_track = BUF_CACHE_INVALID; + } + part_length = buf_geom.total_sectors; + + /* If this is the whole disk, return here. */ + if (! flags && current_partition == 0xFFFFFF) + return 1; + + if (flags) + dest_partition = 0xFFFFFF; + + /* Initialize CURRENT_PARTITION for next_partition. */ + current_partition = 0xFFFFFF; + + while (next ()) + { +#ifndef STAGE1_5 + loop_start: + + cur_part_offset = part_offset; + cur_part_addr = BOOT_PART_TABLE + (entry << 4); +#endif /* ! STAGE1_5 */ + + /* If this is a valid partition... */ + if (current_slice) + { +#ifndef STAGE1_5 + /* Display partition information. */ + if (flags && ! IS_PC_SLICE_TYPE_EXTENDED (current_slice)) + { + if (! do_completion) + { + if (current_drive & 0x80) + grub_printf (" Partition num: %d, ", + current_partition >> 16); + + if (! IS_PC_SLICE_TYPE_BSD (current_slice) && + ! IS_PC_SLICE_TYPE_SOLARIS (current_slice)) + check_and_print_mount (); + else + { + int got_part = 0; + int saved_slice = current_slice; + + while (next ()) + { + if (unix_part == 0xFF) + break; + + if (! got_part) + { + grub_printf ("[BSD/SOLARIS sub-partitions immediately follow]\n"); + got_part = 1; + } + + grub_printf (" BSD/SOLARIS Partition num: \'%c\', ", + unix_part + 'a'); + check_and_print_mount (); + } + + if (! got_part) + grub_printf (" No BSD/SOLARIS sub-partition found, partition type 0x%x\n", + saved_slice); + + if (errnum) + { + errnum = ERR_NONE; + break; + } + + goto loop_start; + } + } + else + { + if (unix_part != 0xFF) + { + char str[16]; + + if (! (current_drive & 0x80) + || (dest_partition >> 16) == pc_slice) + grub_sprintf (str, "%c)", unix_part + 'a'); + else + grub_sprintf (str, "%d,%c)", + pc_slice, unix_part + 'a'); + print_a_completion (str); + } + else if (! IS_PC_SLICE_TYPE_BSD (current_slice) && + ! IS_PC_SLICE_TYPE_SOLARIS (current_slice)) + { + char str[8]; + + grub_sprintf (str, "%d)", pc_slice); + print_a_completion (str); + } + } + } + + errnum = ERR_NONE; +#endif /* ! STAGE1_5 */ + + /* Check if this is the destination partition. */ + if (! flags + && (dest_partition == current_partition + || ((dest_partition >> 16) == 0xFF + && ((dest_partition >> 8) & 0xFF) == unix_part))) + return 1; + } + } + +#ifndef STAGE1_5 + if (flags) + { + if (! (current_drive & 0x80)) + { + current_partition = 0xFFFFFF; + check_and_print_mount (); + } + + errnum = ERR_NONE; + return 1; + } +#endif /* ! STAGE1_5 */ + + return 0; +} + + +int +open_partition (void) +{ + return real_open_partition (0); +} + + +#ifndef STAGE1_5 +/* XX used for device completion in 'set_device' and 'print_completions' */ +static int incomplete, disk_choice; +static enum +{ + PART_UNSPECIFIED = 0, + PART_DISK, + PART_CHOSEN, +} +part_choice; +#endif /* ! STAGE1_5 */ + +int +set_bootfs(char *fsname) +{ + grub_memmove(current_bootfs, fsname, MAXNAMELEN); +} + +char * +set_device (char *device) +{ +#ifdef STAGE1_5 + /* In Stage 1.5, the first 4 bytes of FILENAME has a device number. */ + unsigned long dev = *((unsigned long *) device); + int drive = (dev >> 24) & 0xFF; + int partition = dev & 0xFFFFFF; + + /* If DRIVE is disabled, use SAVED_DRIVE instead. */ + if (drive == GRUB_INVALID_DRIVE) + current_drive = saved_drive; + else + current_drive = drive; + + /* The `partition' part must always have a valid number. */ + current_partition = partition; + + return device + sizeof (unsigned long); + +#else /* ! STAGE1_5 */ + + int result = 0; + + incomplete = 0; + disk_choice = 1; + part_choice = PART_UNSPECIFIED; + current_drive = saved_drive; + current_partition = 0xFFFFFF; + + if (*device == '(' && !*(device + 1)) + /* user has given '(' only, let disk_choice handle what disks we have */ + return device + 1; + + if (*device == '(' && *(++device)) + { + if (*device != ',' && *device != ')') + { + char ch = *device; +#ifdef SUPPORT_NETBOOT + if (*device == 'f' || *device == 'h' + || (*device == 'n' && network_ready) + || (*device == 'c' && cdrom_drive != GRUB_INVALID_DRIVE)) +#else + if (*device == 'f' || *device == 'h' + || (*device == 'c' && cdrom_drive != GRUB_INVALID_DRIVE)) +#endif /* SUPPORT_NETBOOT */ + { + /* user has given '([fhn]', check for resp. add 'd' and + let disk_choice handle what disks we have */ + if (!*(device + 1)) + { + device++; + *device++ = 'd'; + *device = '\0'; + return device; + } + else if (*(device + 1) == 'd' && !*(device + 2)) + return device + 2; + } + + if ((*device == 'f' + || *device == 'h' +#ifdef SUPPORT_NETBOOT + || (*device == 'n' && network_ready) +#endif + || (*device == 'c' && cdrom_drive != GRUB_INVALID_DRIVE)) + && (device += 2, (*(device - 1) != 'd'))) + errnum = ERR_NUMBER_PARSING; + +#ifdef SUPPORT_NETBOOT + if (ch == 'n' && network_ready) + current_drive = NETWORK_DRIVE; + else +#endif /* SUPPORT_NETBOOT */ + { + if (ch == 'c' && cdrom_drive != GRUB_INVALID_DRIVE) + current_drive = cdrom_drive; + else + { + safe_parse_maxint (&device, (int *) ¤t_drive); + + disk_choice = 0; + if (ch == 'h') + current_drive += 0x80; + } + } + } + + if (errnum) + return 0; + + if (*device == ')') + { + part_choice = PART_CHOSEN; + result = 1; + } + else if (*device == ',') + { + /* Either an absolute PC, BSD, or Solaris partition. */ + disk_choice = 0; + part_choice ++; + device++; + + if (*device >= '0' && *device <= '9') + { + part_choice ++; + current_partition = 0; + + if (!(current_drive & 0x80) + || !safe_parse_maxint (&device, (int *) ¤t_partition) + || current_partition > 254) + { + errnum = ERR_DEV_FORMAT; + return 0; + } + + current_partition = (current_partition << 16) + 0xFFFF; + + if (*device == ',') + device++; + + if (*device >= 'a' && *device <= 'p') + { + current_partition = (((*(device++) - 'a') << 8) + | (current_partition & 0xFF00FF)); + } + } + else if (*device >= 'a' && *device <= 'p') + { + part_choice ++; + current_partition = ((*(device++) - 'a') << 8) | 0xFF00FF; + } + + if (*device == ')') + { + if (part_choice == PART_DISK) + { + current_partition = saved_partition; + part_choice ++; + } + + result = 1; + } + } + } + + if (! sane_partition ()) + return 0; + + if (result) + return device + 1; + else + { + if (!*device) + incomplete = 1; + errnum = ERR_DEV_FORMAT; + } + + return 0; + +#endif /* ! STAGE1_5 */ +} + +/* + * This performs a "mount" on the current device, both drive and partition + * number. + */ + +int +open_device (void) +{ + if (open_partition ()) + attempt_mount (); + + if (errnum != ERR_NONE) + return 0; + + return 1; +} + + +#ifndef STAGE1_5 +int +set_bootdev (int hdbias) +{ + int i, j; + + /* Copy the boot partition information to 0x7be-0x7fd for chain-loading. */ + if ((saved_drive & 0x80) && cur_part_addr) + { + if (rawread (saved_drive, cur_part_offset, + 0, SECTOR_SIZE, (char *) SCRATCHADDR)) + { + char *dst, *src; + + /* Need only the partition table. + XXX: We cannot use grub_memmove because BOOT_PART_TABLE + (0x07be) is less than 0x1000. */ + dst = (char *) BOOT_PART_TABLE; + src = (char *) SCRATCHADDR + BOOTSEC_PART_OFFSET; + while (dst < (char *) BOOT_PART_TABLE + BOOTSEC_PART_LENGTH) + *dst++ = *src++; + + /* Set the active flag of the booted partition. */ + for (i = 0; i < 4; i++) + PC_SLICE_FLAG (BOOT_PART_TABLE, i) = 0; + + *((unsigned char *) cur_part_addr) = PC_SLICE_FLAG_BOOTABLE; + boot_part_addr = cur_part_addr; + } + else + return 0; + } + + /* + * Set BSD boot device. + */ + i = (saved_partition >> 16) + 2; + if (saved_partition == 0xFFFFFF) + i = 1; + else if ((saved_partition >> 16) == 0xFF) + i = 0; + + /* FIXME: extremely evil hack!!! */ + j = 2; + if (saved_drive & 0x80) + j = bsd_evil_hack; + + return MAKEBOOTDEV (j, (i >> 4), (i & 0xF), + ((saved_drive - hdbias) & 0x7F), + ((saved_partition >> 8) & 0xFF)); +} +#endif /* STAGE1_5 */ + + +static char * +setup_part (char *filename) +{ +#ifdef STAGE1_5 + + if (! (filename = set_device (filename))) + { + current_drive = GRUB_INVALID_DRIVE; + return 0; + } + +# ifndef NO_BLOCK_FILES + if (*filename != '/') + open_partition (); + else +# endif /* ! NO_BLOCK_FILES */ + open_device (); + +#else /* ! STAGE1_5 */ + + if (*filename == '(') + { + if ((filename = set_device (filename)) == 0) + { + current_drive = GRUB_INVALID_DRIVE; + return 0; + } +# ifndef NO_BLOCK_FILES + if (*filename != '/' && current_drive != NETWORK_DRIVE) + open_partition (); + else +# endif /* ! NO_BLOCK_FILES */ + open_device (); + } + else if (saved_drive != current_drive + || saved_partition != current_partition + || (*filename == '/' && fsys_type == NUM_FSYS) + || buf_drive == -1) + { + current_drive = saved_drive; + current_partition = saved_partition; + /* allow for the error case of "no filesystem" after the partition + is found. This makes block files work fine on no filesystem */ +# ifndef NO_BLOCK_FILES + if (*filename != '/' && current_drive != NETWORK_DRIVE) + open_partition (); + else +# endif /* ! NO_BLOCK_FILES */ + open_device (); + } + +#endif /* ! STAGE1_5 */ + + if (errnum && (*filename == '/' || errnum != ERR_FSYS_MOUNT)) + return 0; + else + errnum = 0; + +#ifndef STAGE1_5 + if (!sane_partition ()) + return 0; +#endif + + return filename; +} + + +#ifndef STAGE1_5 +/* + * This prints the filesystem type or gives relevant information. + */ + +void +print_fsys_type (void) +{ + if (! do_completion) + { + grub_printf (" Filesystem type "); + + if (fsys_type != NUM_FSYS) + grub_printf ("is %s, ", fsys_table[fsys_type].name); + else + grub_printf ("unknown, "); + + if (current_partition == 0xFFFFFF) + grub_printf ("using whole disk\n"); + else + grub_printf ("partition type 0x%x\n", current_slice & 0xFF); + } +} +#endif /* STAGE1_5 */ + +#ifndef STAGE1_5 +/* If DO_COMPLETION is true, just print NAME. Otherwise save the unique + part into UNIQUE_STRING. */ +void +print_a_completion (char *name) +{ + /* If NAME is "." or "..", do not count it. */ + if (grub_strcmp (name, ".") == 0 || grub_strcmp (name, "..") == 0) + return; + + if (do_completion) + { + char *buf = unique_string; + + if (! unique) + while ((*buf++ = *name++)) + ; + else + { + while (*buf && (*buf == *name)) + { + buf++; + name++; + } + /* mismatch, strip it. */ + *buf = '\0'; + } + } + else + grub_printf (" %s", name); + + unique++; +} + +/* + * This lists the possible completions of a device string, filename, or + * any sane combination of the two. + */ + +int +print_completions (int is_filename, int is_completion) +{ + char *buf = (char *) COMPLETION_BUF; + char *ptr = buf; + + unique_string = (char *) UNIQUE_BUF; + *unique_string = 0; + unique = 0; + do_completion = is_completion; + + if (! is_filename) + { + /* Print the completions of builtin commands. */ + struct builtin **builtin; + + if (! is_completion) + grub_printf (" Possible commands are:"); + + for (builtin = builtin_table; (*builtin); builtin++) + { + /* If *BUILTIN cannot be run in the command-line, skip it. */ + if (! ((*builtin)->flags & BUILTIN_CMDLINE)) + continue; + + if (substring (buf, (*builtin)->name) <= 0) + print_a_completion ((*builtin)->name); + } + + if (is_completion && *unique_string) + { + if (unique == 1) + { + char *u = unique_string + grub_strlen (unique_string); + + *u++ = ' '; + *u = 0; + } + + grub_strcpy (buf, unique_string); + } + + if (! is_completion) + grub_putchar ('\n'); + + print_error (); + do_completion = 0; + if (errnum) + return -1; + else + return unique - 1; + } + + if (*buf == '/' || (ptr = set_device (buf)) || incomplete) + { + errnum = 0; + + if (*buf == '(' && (incomplete || ! *ptr)) + { + if (! part_choice) + { + /* disk completions */ + int disk_no, i, j; + struct geometry geom; + + if (! is_completion) + grub_printf (" Possible disks are: "); + + if (!ptr + || *(ptr-1) != 'd' +#ifdef SUPPORT_NETBOOT + || *(ptr-2) != 'n' +#endif /* SUPPORT_NETBOOT */ + || *(ptr-2) != 'c') + { + for (i = (ptr && (*(ptr-1) == 'd' && *(ptr-2) == 'h') ? 1:0); + i < (ptr && (*(ptr-1) == 'd' && *(ptr-2) == 'f') ? 1:2); + i++) + { + for (j = 0; j < 8; j++) + { + disk_no = (i * 0x80) + j; + if ((disk_choice || disk_no == current_drive) + && ! get_diskinfo (disk_no, &geom)) + { + char dev_name[8]; + + grub_sprintf (dev_name, "%cd%d", i ? 'h':'f', j); + print_a_completion (dev_name); + } + } + } + } + + if (cdrom_drive != GRUB_INVALID_DRIVE + && (disk_choice || cdrom_drive == current_drive) + && (!ptr + || *(ptr-1) == '(' + || (*(ptr-1) == 'd' && *(ptr-2) == 'c'))) + print_a_completion ("cd"); + +# ifdef SUPPORT_NETBOOT + if (network_ready + && (disk_choice || NETWORK_DRIVE == current_drive) + && (!ptr + || *(ptr-1) == '(' + || (*(ptr-1) == 'd' && *(ptr-2) == 'n'))) + print_a_completion ("nd"); +# endif /* SUPPORT_NETBOOT */ + + if (is_completion && *unique_string) + { + ptr = buf; + while (*ptr != '(') + ptr--; + ptr++; + grub_strcpy (ptr, unique_string); + if (unique == 1) + { + ptr += grub_strlen (ptr); + if (*unique_string == 'h') + { + *ptr++ = ','; + *ptr = 0; + } + else + { + *ptr++ = ')'; + *ptr = 0; + } + } + } + + if (! is_completion) + grub_putchar ('\n'); + } + else + { + /* partition completions */ + if (part_choice == PART_CHOSEN + && open_partition () + && ! IS_PC_SLICE_TYPE_BSD (current_slice)) + { + unique = 1; + ptr = buf + grub_strlen (buf); + if (*(ptr - 1) != ')') + { + *ptr++ = ')'; + *ptr = 0; + } + } + else + { + if (! is_completion) + grub_printf (" Possible partitions are:\n"); + real_open_partition (1); + + if (is_completion && *unique_string) + { + ptr = buf; + while (*ptr++ != ',') + ; + grub_strcpy (ptr, unique_string); + } + } + } + } + else if (ptr && *ptr == '/') + { + /* filename completions */ + if (! is_completion) + grub_printf (" Possible files are:"); + + dir (buf); + + if (is_completion && *unique_string) + { + ptr += grub_strlen (ptr); + while (*ptr != '/') + ptr--; + ptr++; + + grub_strcpy (ptr, unique_string); + + if (unique == 1) + { + ptr += grub_strlen (unique_string); + + /* Check if the file UNIQUE_STRING is a directory. */ + *ptr = '/'; + *(ptr + 1) = 0; + + dir (buf); + + /* Restore the original unique value. */ + unique = 1; + + if (errnum) + { + /* Regular file */ + errnum = 0; + *ptr = ' '; + *(ptr + 1) = 0; + } + } + } + + if (! is_completion) + grub_putchar ('\n'); + } + else + errnum = ERR_BAD_FILENAME; + } + + print_error (); + do_completion = 0; + if (errnum) + return -1; + else + return unique - 1; +} +#endif /* STAGE1_5 */ + + +/* + * This is the generic file open function. + */ + +int +grub_open (char *filename) +{ +#ifndef NO_DECOMPRESSION + compressed_file = 0; +#endif /* NO_DECOMPRESSION */ + + /* if any "dir" function uses/sets filepos, it must + set it to zero before returning if opening a file! */ + filepos = 0; + + if (!(filename = setup_part (filename))) + return 0; + +#ifndef NO_BLOCK_FILES + block_file = 0; +#endif /* NO_BLOCK_FILES */ + + /* This accounts for partial filesystem implementations. */ + fsmax = MAXINT; + + if (*filename != '/' && current_drive != NETWORK_DRIVE) + { +#ifndef NO_BLOCK_FILES + char *ptr = filename; + int tmp, list_addr = BLK_BLKLIST_START; + filemax = 0; + + while (list_addr < BLK_MAX_ADDR) + { + tmp = 0; + safe_parse_maxint (&ptr, &tmp); + errnum = 0; + + if (*ptr != '+') + { + if ((*ptr && *ptr != '/' && !isspace (*ptr)) + || tmp == 0 || tmp > filemax) + errnum = ERR_BAD_FILENAME; + else + filemax = tmp; + + break; + } + + /* since we use the same filesystem buffer, mark it to + be remounted */ + fsys_type = NUM_FSYS; + + BLK_BLKSTART (list_addr) = tmp; + ptr++; + + if (!safe_parse_maxint (&ptr, &tmp) + || tmp == 0 + || (*ptr && *ptr != ',' && *ptr != '/' && !isspace (*ptr))) + { + errnum = ERR_BAD_FILENAME; + break; + } + + BLK_BLKLENGTH (list_addr) = tmp; + + filemax += (tmp * SECTOR_SIZE); + list_addr += BLK_BLKLIST_INC_VAL; + + if (*ptr != ',') + break; + + ptr++; + } + + if (list_addr < BLK_MAX_ADDR && ptr != filename && !errnum) + { + block_file = 1; + BLK_CUR_FILEPOS = 0; + BLK_CUR_BLKLIST = BLK_BLKLIST_START; + BLK_CUR_BLKNUM = 0; + +#ifndef NO_DECOMPRESSION + return gunzip_test_header (); +#else /* NO_DECOMPRESSION */ + return 1; +#endif /* NO_DECOMPRESSION */ + } +#else /* NO_BLOCK_FILES */ + errnum = ERR_BAD_FILENAME; +#endif /* NO_BLOCK_FILES */ + } + + if (!errnum && fsys_type == NUM_FSYS) + errnum = ERR_FSYS_MOUNT; + +# ifndef STAGE1_5 + /* set "dir" function to open a file */ + print_possibilities = 0; +# endif + + if (!errnum && (*(fsys_table[fsys_type].dir_func)) (filename)) + { +#ifndef NO_DECOMPRESSION + return gunzip_test_header (); +#else /* NO_DECOMPRESSION */ + return 1; +#endif /* NO_DECOMPRESSION */ + } + + return 0; +} + + +int +grub_read (char *buf, int len) +{ + /* Make sure "filepos" is a sane value */ + if ((filepos < 0) || (filepos > filemax)) + filepos = filemax; + + /* Make sure "len" is a sane value */ + if ((len < 0) || (len > (filemax - filepos))) + len = filemax - filepos; + + /* if target file position is past the end of + the supported/configured filesize, then + there is an error */ + if (filepos + len > fsmax) + { + errnum = ERR_FILELENGTH; + return 0; + } + +#ifndef NO_DECOMPRESSION + if (compressed_file) + return gunzip_read (buf, len); +#endif /* NO_DECOMPRESSION */ + +#ifndef NO_BLOCK_FILES + if (block_file) + { + int size, off, ret = 0; + + while (len && !errnum) + { + /* we may need to look for the right block in the list(s) */ + if (filepos < BLK_CUR_FILEPOS) + { + BLK_CUR_FILEPOS = 0; + BLK_CUR_BLKLIST = BLK_BLKLIST_START; + BLK_CUR_BLKNUM = 0; + } + + /* run BLK_CUR_FILEPOS up to filepos */ + while (filepos > BLK_CUR_FILEPOS) + { + if ((filepos - (BLK_CUR_FILEPOS & ~(SECTOR_SIZE - 1))) + >= SECTOR_SIZE) + { + BLK_CUR_FILEPOS += SECTOR_SIZE; + BLK_CUR_BLKNUM++; + + if (BLK_CUR_BLKNUM >= BLK_BLKLENGTH (BLK_CUR_BLKLIST)) + { + BLK_CUR_BLKLIST += BLK_BLKLIST_INC_VAL; + BLK_CUR_BLKNUM = 0; + } + } + else + BLK_CUR_FILEPOS = filepos; + } + + off = filepos & (SECTOR_SIZE - 1); + size = ((BLK_BLKLENGTH (BLK_CUR_BLKLIST) - BLK_CUR_BLKNUM) + * SECTOR_SIZE) - off; + if (size > len) + size = len; + + disk_read_func = disk_read_hook; + + /* read current block and put it in the right place in memory */ + devread (BLK_BLKSTART (BLK_CUR_BLKLIST) + BLK_CUR_BLKNUM, + off, size, buf); + + disk_read_func = NULL; + + len -= size; + filepos += size; + ret += size; + buf += size; + } + + if (errnum) + ret = 0; + + return ret; + } +#endif /* NO_BLOCK_FILES */ + + if (fsys_type == NUM_FSYS) + { + errnum = ERR_FSYS_MOUNT; + return 0; + } + + return (*(fsys_table[fsys_type].read_func)) (buf, len); +} + +#ifndef STAGE1_5 +/* Reposition a file offset. */ +int +grub_seek (int offset) +{ + if (offset > filemax || offset < 0) + return -1; + + filepos = offset; + return offset; +} + +int +dir (char *dirname) +{ +#ifndef NO_DECOMPRESSION + compressed_file = 0; +#endif /* NO_DECOMPRESSION */ + + if (!(dirname = setup_part (dirname))) + return 0; + + if (*dirname != '/') + errnum = ERR_BAD_FILENAME; + + if (fsys_type == NUM_FSYS) + errnum = ERR_FSYS_MOUNT; + + if (errnum) + return 0; + + /* set "dir" function to list completions */ + print_possibilities = 1; + + return (*(fsys_table[fsys_type].dir_func)) (dirname); +} +#endif /* STAGE1_5 */ + +void +grub_close (void) +{ +#ifndef NO_BLOCK_FILES + if (block_file) + return; +#endif /* NO_BLOCK_FILES */ + + if (fsys_table[fsys_type].close_func != 0) + (*(fsys_table[fsys_type].close_func)) (); +} diff --git a/usr/src/grub/grub-0.97/stage2/fat.h b/usr/src/grub/grub-0.97/stage2/fat.h new file mode 100644 index 0000000000..7fed6bacb3 --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/fat.h @@ -0,0 +1,100 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2001 Free Software Foundation, 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 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. + */ + + +/* + * Defines for the FAT BIOS Parameter Block (embedded in the first block + * of the partition. + */ + +typedef __signed__ char __s8; +typedef unsigned char __u8; +typedef __signed__ short __s16; +typedef unsigned short __u16; +typedef __signed__ int __s32; +typedef unsigned int __u32; + +/* Note that some shorts are not aligned, and must therefore + * be declared as array of two bytes. + */ +struct fat_bpb { + __s8 ignored[3]; /* Boot strap short or near jump */ + __s8 system_id[8]; /* Name - can be used to special case + partition manager volumes */ + __u8 bytes_per_sect[2]; /* bytes per logical sector */ + __u8 sects_per_clust;/* sectors/cluster */ + __u8 reserved_sects[2]; /* reserved sectors */ + __u8 num_fats; /* number of FATs */ + __u8 dir_entries[2]; /* root directory entries */ + __u8 short_sectors[2]; /* number of sectors */ + __u8 media; /* media code (unused) */ + __u16 fat_length; /* sectors/FAT */ + __u16 secs_track; /* sectors per track */ + __u16 heads; /* number of heads */ + __u32 hidden; /* hidden sectors (unused) */ + __u32 long_sectors; /* number of sectors (if short_sectors == 0) */ + + /* The following fields are only used by FAT32 */ + __u32 fat32_length; /* sectors/FAT */ + __u16 flags; /* bit 8: fat mirroring, low 4: active fat */ + __u8 version[2]; /* major, minor filesystem version */ + __u32 root_cluster; /* first cluster in root directory */ + __u16 info_sector; /* filesystem info sector */ + __u16 backup_boot; /* backup boot sector */ + __u16 reserved2[6]; /* Unused */ +}; + +#define FAT_CVT_U16(bytarr) (* (__u16*)(bytarr)) + +/* + * Defines how to differentiate a 12-bit and 16-bit FAT. + */ + +#define FAT_MAX_12BIT_CLUST 4087 /* 4085 + 2 */ + +/* + * Defines for the file "attribute" byte + */ + +#define FAT_ATTRIB_OK_MASK 0x37 +#define FAT_ATTRIB_NOT_OK_MASK 0xC8 +#define FAT_ATTRIB_DIR 0x10 +#define FAT_ATTRIB_LONGNAME 0x0F + +/* + * Defines for FAT directory entries + */ + +#define FAT_DIRENTRY_LENGTH 32 + +#define FAT_DIRENTRY_ATTRIB(entry) \ + (*((unsigned char *) (entry+11))) +#define FAT_DIRENTRY_VALID(entry) \ + ( ((*((unsigned char *) entry)) != 0) \ + && ((*((unsigned char *) entry)) != 0xE5) \ + && !(FAT_DIRENTRY_ATTRIB(entry) & FAT_ATTRIB_NOT_OK_MASK) ) +#define FAT_DIRENTRY_FIRST_CLUSTER(entry) \ + ((*((unsigned short *) (entry+26)))+(*((unsigned short *) (entry+20)) << 16)) +#define FAT_DIRENTRY_FILELENGTH(entry) \ + (*((unsigned long *) (entry+28))) + +#define FAT_LONGDIR_ID(entry) \ + (*((unsigned char *) (entry))) +#define FAT_LONGDIR_ALIASCHECKSUM(entry) \ + (*((unsigned char *) (entry+13))) diff --git a/usr/src/grub/grub-0.97/stage2/filesys.h b/usr/src/grub/grub-0.97/stage2/filesys.h new file mode 100644 index 0000000000..94c23bf5de --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/filesys.h @@ -0,0 +1,186 @@ +/* filesys.h - abstract filesystem interface */ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2004 Free Software Foundation, 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 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 "pc_slice.h" + +#ifdef FSYS_FFS +#define FSYS_FFS_NUM 1 +int ffs_mount (void); +int ffs_read (char *buf, int len); +int ffs_dir (char *dirname); +int ffs_embed (int *start_sector, int needed_sectors); +#else +#define FSYS_FFS_NUM 0 +#endif + +#ifdef FSYS_UFS +#define FSYS_UFS_NUM 1 +int ufs_mount (void); +int ufs_read (char *buf, int len); +int ufs_dir (char *dirname); +int ufs_embed (int *start_sector, int needed_sectors); +#else +#define FSYS_UFS_NUM 0 +#endif + +#ifdef FSYS_UFS2 +#define FSYS_UFS2_NUM 1 +int ufs2_mount (void); +int ufs2_read (char *buf, int len); +int ufs2_dir (char *dirname); +int ufs2_embed (int *start_sector, int needed_sectors); +#else +#define FSYS_UFS2_NUM 0 +#endif + +#ifdef FSYS_ZFS +#define FSYS_ZFS_NUM 1 +int zfs_mount (void); +int zfs_read (char *buf, int len); +int zfs_open (char *dirname); +int zfs_embed (int *start_sector, int needed_sectors); +#else +#define FSYS_ZFS_NUM 0 +#endif + +#ifdef FSYS_FAT +#define FSYS_FAT_NUM 1 +int fat_mount (void); +int fat_read (char *buf, int len); +int fat_dir (char *dirname); +#else +#define FSYS_FAT_NUM 0 +#endif + +#ifdef FSYS_EXT2FS +#define FSYS_EXT2FS_NUM 1 +int ext2fs_mount (void); +int ext2fs_read (char *buf, int len); +int ext2fs_dir (char *dirname); +#else +#define FSYS_EXT2FS_NUM 0 +#endif + +#ifdef FSYS_MINIX +#define FSYS_MINIX_NUM 1 +int minix_mount (void); +int minix_read (char *buf, int len); +int minix_dir (char *dirname); +#else +#define FSYS_MINIX_NUM 0 +#endif + +#ifdef FSYS_REISERFS +#define FSYS_REISERFS_NUM 1 +int reiserfs_mount (void); +int reiserfs_read (char *buf, int len); +int reiserfs_dir (char *dirname); +int reiserfs_embed (int *start_sector, int needed_sectors); +#else +#define FSYS_REISERFS_NUM 0 +#endif + +#ifdef FSYS_VSTAFS +#define FSYS_VSTAFS_NUM 1 +int vstafs_mount (void); +int vstafs_read (char *buf, int len); +int vstafs_dir (char *dirname); +#else +#define FSYS_VSTAFS_NUM 0 +#endif + +#ifdef FSYS_JFS +#define FSYS_JFS_NUM 1 +int jfs_mount (void); +int jfs_read (char *buf, int len); +int jfs_dir (char *dirname); +int jfs_embed (int *start_sector, int needed_sectors); +#else +#define FSYS_JFS_NUM 0 +#endif + +#ifdef FSYS_XFS +#define FSYS_XFS_NUM 1 +int xfs_mount (void); +int xfs_read (char *buf, int len); +int xfs_dir (char *dirname); +#else +#define FSYS_XFS_NUM 0 +#endif + +#ifdef FSYS_TFTP +#define FSYS_TFTP_NUM 1 +int tftp_mount (void); +int tftp_read (char *buf, int len); +int tftp_dir (char *dirname); +void tftp_close (void); +#else +#define FSYS_TFTP_NUM 0 +#endif + +#ifdef FSYS_ISO9660 +#define FSYS_ISO9660_NUM 1 +int iso9660_mount (void); +int iso9660_read (char *buf, int len); +int iso9660_dir (char *dirname); +#else +#define FSYS_ISO9660_NUM 0 +#endif + +#ifndef NUM_FSYS +#define NUM_FSYS \ + (FSYS_FFS_NUM + FSYS_FAT_NUM + FSYS_EXT2FS_NUM + FSYS_MINIX_NUM \ + + FSYS_REISERFS_NUM + FSYS_VSTAFS_NUM + FSYS_JFS_NUM + FSYS_XFS_NUM \ + + FSYS_TFTP_NUM + FSYS_ISO9660_NUM + FSYS_UFS_NUM + FSYS_UFS2_NUM \ + + FSYS_ZFS_NUM) +#endif + +/* defines for the block filesystem info area */ +#ifndef NO_BLOCK_FILES +#define BLK_CUR_FILEPOS (*((int*)FSYS_BUF)) +#define BLK_CUR_BLKLIST (*((int*)(FSYS_BUF+4))) +#define BLK_CUR_BLKNUM (*((int*)(FSYS_BUF+8))) +#define BLK_MAX_ADDR (FSYS_BUF+0x7FF9) +#define BLK_BLKSTART(l) (*((int*)l)) +#define BLK_BLKLENGTH(l) (*((int*)(l+4))) +#define BLK_BLKLIST_START (FSYS_BUF+12) +#define BLK_BLKLIST_INC_VAL 8 +#endif /* NO_BLOCK_FILES */ + +/* this next part is pretty ugly, but it keeps it in one place! */ + +struct fsys_entry +{ + char *name; + int (*mount_func) (void); + int (*read_func) (char *buf, int len); + int (*dir_func) (char *dirname); + void (*close_func) (void); + int (*embed_func) (int *start_sector, int needed_sectors); +}; + +#ifdef STAGE1_5 +# define print_possibilities 0 +#else +extern int print_possibilities; +#endif + +extern int fsmax; +extern struct fsys_entry fsys_table[NUM_FSYS + 1]; diff --git a/usr/src/grub/grub-0.97/stage2/freebsd.h b/usr/src/grub/grub-0.97/stage2/freebsd.h new file mode 100644 index 0000000000..ffbf602b53 --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/freebsd.h @@ -0,0 +1,95 @@ + +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2001 Free Software Foundation, 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 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. + */ + +/* command-line parameter defines */ +#define RB_ASKNAME 0x01 /* ask for file name to reboot from */ +#define RB_SINGLE 0x02 /* reboot to single user only */ +#define RB_NOSYNC 0x04 /* dont sync before reboot */ +#define RB_HALT 0x08 /* don't reboot, just halt */ +#define RB_INITNAME 0x10 /* name given for /etc/init (unused) */ +#define RB_DFLTROOT 0x20 /* use compiled-in rootdev */ +#define RB_KDB 0x40 /* give control to kernel debugger */ +#define RB_RDONLY 0x80 /* mount root fs read-only */ +#define RB_DUMP 0x100 /* dump kernel memory before reboot */ +#define RB_MINIROOT 0x200 /* mini-root present in memory at boot time */ +#define RB_CONFIG 0x400 /* invoke user configuration routing */ +#define RB_VERBOSE 0x800 /* print all potentially useful info */ +#define RB_SERIAL 0x1000 /* user serial port as console */ +#define RB_CDROM 0x2000 /* use cdrom as root */ +#define RB_GDB 0x8000 /* use GDB remote debugger instead of DDB */ +#define RB_MUTE 0x10000 /* Come up with the console muted */ +#define RB_MULTIPLE 0x20000000 /* Use multiple consoles */ + +#define RB_BOOTINFO 0x80000000 /* have `struct bootinfo *' arg */ + +/* + * Constants for converting boot-style device number to type, + * adaptor (uba, mba, etc), unit number and partition number. + * Type (== major device number) is in the low byte + * for backward compatibility. Except for that of the "magic + * number", each mask applies to the shifted value. + * Format: + * (4) (4) (4) (4) (8) (8) + * -------------------------------- + * |MA | AD| CT| UN| PART | TYPE | + * -------------------------------- + */ +#define B_ADAPTORSHIFT 24 +#define B_CONTROLLERSHIFT 20 +#define B_UNITSHIFT 16 +#define B_PARTITIONSHIFT 8 +#define B_TYPESHIFT 0 + +#define B_DEVMAGIC ((unsigned long)0xa0000000) + +#define MAKEBOOTDEV(type, adaptor, controller, unit, partition) \ + (((type) << B_TYPESHIFT) | ((adaptor) << B_ADAPTORSHIFT) | \ + ((controller) << B_CONTROLLERSHIFT) | ((unit) << B_UNITSHIFT) | \ + ((partition) << B_PARTITIONSHIFT) | B_DEVMAGIC) + + +/* Only change the version number if you break compatibility. */ +#define BOOTINFO_VERSION 1 + +#define N_BIOS_GEOM 8 + +/* + * A zero bootinfo field often means that there is no info available. + * Flags are used to indicate the validity of fields where zero is a + * normal value. + */ +struct bootinfo + { + unsigned int bi_version; + unsigned char *bi_kernelname; + struct nfs_diskless *bi_nfs_diskless; + /* End of fields that are always present. */ +#define bi_endcommon bi_n_bios_used + unsigned int bi_n_bios_used; + unsigned long bi_bios_geom[N_BIOS_GEOM]; + unsigned int bi_size; + unsigned char bi_memsizes_valid; + unsigned char bi_bios_dev; + unsigned char bi_pad[2]; + unsigned long bi_basemem; + unsigned long bi_extmem; + unsigned long bi_symtab; + unsigned long bi_esymtab; + }; diff --git a/usr/src/grub/grub-0.97/stage2/fs.h b/usr/src/grub/grub-0.97/stage2/fs.h new file mode 100644 index 0000000000..8ed4fe0415 --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/fs.h @@ -0,0 +1,457 @@ +/* + * Mach Operating System + * Copyright (c) 1991,1990 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. + * + * 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 FROM THE USE OF THIS SOFTWARE. + * + * Carnegie Mellon requests users of this software to return to + * + * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU + * School of Computer Science + * Carnegie Mellon University + * Pittsburgh PA 15213-3890 + * + * any improvements or extensions that they make and grant Carnegie Mellon + * the rights to redistribute these changes. + */ +/* + * 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 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + * + * @(#)fs.h 7.7 (Berkeley) 5/9/89 + */ + +/* + * Each disk drive contains some number of file systems. + * A file system consists of a number of cylinder groups. + * Each cylinder group has inodes and data. + * + * A file system is described by its super-block, which in turn + * describes the cylinder groups. The super-block is critical + * data and is replicated in each cylinder group to protect against + * catastrophic loss. This is done at `newfs' time and the critical + * super-block data does not change, so the copies need not be + * referenced further unless disaster strikes. + * + * For file system fs, the offsets of the various blocks of interest + * are given in the super block as: + * [fs->fs_sblkno] Super-block + * [fs->fs_cblkno] Cylinder group block + * [fs->fs_iblkno] Inode blocks + * [fs->fs_dblkno] Data blocks + * The beginning of cylinder group cg in fs, is given by + * the ``cgbase(fs, cg)'' macro. + * + * The first boot and super blocks are given in absolute disk addresses. + * The byte-offset forms are preferred, as they don't imply a sector size. + */ +#define BBSIZE 8192 +#define SBSIZE 8192 +#define BBOFF ((mach_off_t)(0)) +#define SBOFF ((mach_off_t)(BBOFF + BBSIZE)) +#define BBLOCK ((mach_daddr_t)(0)) +#define SBLOCK ((mach_daddr_t)(BBLOCK + BBSIZE / DEV_BSIZE)) + +/* + * Addresses stored in inodes are capable of addressing fragments + * of `blocks'. File system blocks of at most size MAXBSIZE can + * be optionally broken into 2, 4, or 8 pieces, each of which is + * addressible; these pieces may be DEV_BSIZE, or some multiple of + * a DEV_BSIZE unit. + * + * Large files consist of exclusively large data blocks. To avoid + * undue wasted disk space, the last data block of a small file may be + * allocated as only as many fragments of a large block as are + * necessary. The file system format retains only a single pointer + * to such a fragment, which is a piece of a single large block that + * has been divided. The size of such a fragment is determinable from + * information in the inode, using the ``blksize(fs, ip, lbn)'' macro. + * + * The file system records space availability at the fragment level; + * to determine block availability, aligned fragments are examined. + * + * The root inode is the root of the file system. + * Inode 0 can't be used for normal purposes and + * historically bad blocks were linked to inode 1, + * thus the root inode is 2. (inode 1 is no longer used for + * this purpose, however numerous dump tapes make this + * assumption, so we are stuck with it) + */ +#define ROOTINO ((mach_ino_t)2) /* i number of all roots */ + +/* + * MINBSIZE is the smallest allowable block size. + * In order to insure that it is possible to create files of size + * 2^32 with only two levels of indirection, MINBSIZE is set to 4096. + * MINBSIZE must be big enough to hold a cylinder group block, + * thus changes to (struct cg) must keep its size within MINBSIZE. + * Note that super blocks are always of size SBSIZE, + * and that both SBSIZE and MAXBSIZE must be >= MINBSIZE. + */ +#define MINBSIZE 4096 + +/* + * The path name on which the file system is mounted is maintained + * in fs_fsmnt. MAXMNTLEN defines the amount of space allocated in + * the super block for this name. + * The limit on the amount of summary information per file system + * is defined by MAXCSBUFS. It is currently parameterized for a + * maximum of two million cylinders. + */ +#define MAXMNTLEN 512 +#define MAXCSBUFS 32 + +/* + * Per cylinder group information; summarized in blocks allocated + * from first cylinder group data blocks. These blocks have to be + * read in from fs_csaddr (size fs_cssize) in addition to the + * super block. + * + * N.B. sizeof(struct csum) must be a power of two in order for + * the ``fs_cs'' macro to work (see below). + */ +struct csum + { + int cs_ndir; /* number of directories */ + int cs_nbfree; /* number of free blocks */ + int cs_nifree; /* number of free inodes */ + int cs_nffree; /* number of free frags */ + }; + +/* + * Super block for a file system. + */ +#define FS_MAGIC 0x011954 +struct fs + { + int xxx1; /* struct fs *fs_link; */ + int xxx2; /* struct fs *fs_rlink; */ + mach_daddr_t fs_sblkno; /* addr of super-block in filesys */ + mach_daddr_t fs_cblkno; /* offset of cyl-block in filesys */ + mach_daddr_t fs_iblkno; /* offset of inode-blocks in filesys */ + mach_daddr_t fs_dblkno; /* offset of first data after cg */ + int fs_cgoffset; /* cylinder group offset in cylinder */ + int fs_cgmask; /* used to calc mod fs_ntrak */ + mach_time_t fs_time; /* last time written */ + int fs_size; /* number of blocks in fs */ + int fs_dsize; /* number of data blocks in fs */ + int fs_ncg; /* number of cylinder groups */ + int fs_bsize; /* size of basic blocks in fs */ + int fs_fsize; /* size of frag blocks in fs */ + int fs_frag; /* number of frags in a block in fs */ +/* these are configuration parameters */ + int fs_minfree; /* minimum percentage of free blocks */ + int fs_rotdelay; /* num of ms for optimal next block */ + int fs_rps; /* disk revolutions per second */ +/* these fields can be computed from the others */ + int fs_bmask; /* ``blkoff'' calc of blk offsets */ + int fs_fmask; /* ``fragoff'' calc of frag offsets */ + int fs_bshift; /* ``lblkno'' calc of logical blkno */ + int fs_fshift; /* ``numfrags'' calc number of frags */ +/* these are configuration parameters */ + int fs_maxcontig; /* max number of contiguous blks */ + int fs_maxbpg; /* max number of blks per cyl group */ +/* these fields can be computed from the others */ + int fs_fragshift; /* block to frag shift */ + int fs_fsbtodb; /* fsbtodb and dbtofsb shift constant */ + int fs_sbsize; /* actual size of super block */ + int fs_csmask; /* csum block offset */ + int fs_csshift; /* csum block number */ + int fs_nindir; /* value of NINDIR */ + int fs_inopb; /* value of INOPB */ + int fs_nspf; /* value of NSPF */ +/* yet another configuration parameter */ + int fs_optim; /* optimization preference, see below */ +/* these fields are derived from the hardware */ + int fs_npsect; /* # sectors/track including spares */ + int fs_interleave; /* hardware sector interleave */ + int fs_trackskew; /* sector 0 skew, per track */ + int fs_headswitch; /* head switch time, usec */ + int fs_trkseek; /* track-to-track seek, usec */ +/* sizes determined by number of cylinder groups and their sizes */ + mach_daddr_t fs_csaddr; /* blk addr of cyl grp summary area */ + int fs_cssize; /* size of cyl grp summary area */ + int fs_cgsize; /* cylinder group size */ +/* these fields are derived from the hardware */ + int fs_ntrak; /* tracks per cylinder */ + int fs_nsect; /* sectors per track */ + int fs_spc; /* sectors per cylinder */ +/* this comes from the disk driver partitioning */ + int fs_ncyl; /* cylinders in file system */ +/* these fields can be computed from the others */ + int fs_cpg; /* cylinders per group */ + int fs_ipg; /* inodes per group */ + int fs_fpg; /* blocks per group * fs_frag */ +/* this data must be re-computed after crashes */ + struct csum fs_cstotal; /* cylinder summary information */ +/* these fields are cleared at mount time */ + char fs_fmod; /* super block modified flag */ + char fs_clean; /* file system is clean flag */ + char fs_ronly; /* mounted read-only flag */ + char fs_flags; /* currently unused flag */ + char fs_fsmnt[MAXMNTLEN]; /* name mounted on */ +/* these fields retain the current block allocation info */ + int fs_cgrotor; /* last cg searched */ +#if 1 + int was_fs_csp[MAXCSBUFS]; +#else + struct csum *fs_csp[MAXCSBUFS]; /* list of fs_cs info buffers */ +#endif + int fs_cpc; /* cyl per cycle in postbl */ + short fs_opostbl[16][8]; /* old rotation block list head */ + long fs_sparecon[50]; /* reserved for future constants */ + long fs_contigsumsize; /* size of cluster summary array */ + long fs_maxsymlinklen; /* max length of an internal symlink */ + long fs_inodefmt; /* format of on-disk inodes */ + quad fs_maxfilesize; /* maximum representable file size */ + quad fs_qbmask; /* ~fs_bmask - for use with quad size */ + quad fs_qfmask; /* ~fs_fmask - for use with quad size */ + long fs_state; /* validate fs_clean field */ + int fs_postblformat; /* format of positional layout tables */ + int fs_nrpos; /* number of rotaional positions */ + int fs_postbloff; /* (short) rotation block list head */ + int fs_rotbloff; /* (u_char) blocks for each rotation */ + int fs_magic; /* magic number */ + u_char fs_space[1]; /* list of blocks for each rotation */ +/* actually longer */ + }; +/* + * Preference for optimization. + */ +#define FS_OPTTIME 0 /* minimize allocation time */ +#define FS_OPTSPACE 1 /* minimize disk fragmentation */ + +/* + * Rotational layout table format types + */ +#define FS_42POSTBLFMT -1 /* 4.2BSD rotational table format */ +#define FS_DYNAMICPOSTBLFMT 1 /* dynamic rotational table format */ +/* + * Macros for access to superblock array structures + */ +#define fs_postbl(fs, cylno) \ + (((fs)->fs_postblformat == FS_42POSTBLFMT) \ + ? ((fs)->fs_opostbl[cylno]) \ + : ((short *)((char *)(fs) + (fs)->fs_postbloff) + (cylno) * (fs)->fs_nrpos)) +#define fs_rotbl(fs) \ + (((fs)->fs_postblformat == FS_42POSTBLFMT) \ + ? ((fs)->fs_space) \ + : ((u_char *)((char *)(fs) + (fs)->fs_rotbloff))) + +/* + * Convert cylinder group to base address of its global summary info. + * + * N.B. This macro assumes that sizeof(struct csum) is a power of two. + */ +#define fs_cs(fs, indx) \ + fs_csp[(indx) >> (fs)->fs_csshift][(indx) & ~(fs)->fs_csmask] + +/* + * Cylinder group block for a file system. + */ +#define CG_MAGIC 0x090255 +struct cg + { + int xxx1; /* struct cg *cg_link; */ + int cg_magic; /* magic number */ + mach_time_t cg_time; /* time last written */ + int cg_cgx; /* we are the cgx'th cylinder group */ + short cg_ncyl; /* number of cyl's this cg */ + short cg_niblk; /* number of inode blocks this cg */ + int cg_ndblk; /* number of data blocks this cg */ + struct csum cg_cs; /* cylinder summary information */ + int cg_rotor; /* position of last used block */ + int cg_frotor; /* position of last used frag */ + int cg_irotor; /* position of last used inode */ + int cg_frsum[MAXFRAG]; /* counts of available frags */ + int cg_btotoff; /* (long) block totals per cylinder */ + int cg_boff; /* (short) free block positions */ + int cg_iusedoff; /* (char) used inode map */ + int cg_freeoff; /* (u_char) free block map */ + int cg_nextfreeoff; /* (u_char) next available space */ + int cg_sparecon[16]; /* reserved for future use */ + u_char cg_space[1]; /* space for cylinder group maps */ +/* actually longer */ + }; +/* + * Macros for access to cylinder group array structures + */ +#define cg_blktot(cgp) \ + (((cgp)->cg_magic != CG_MAGIC) \ + ? (((struct ocg *)(cgp))->cg_btot) \ + : ((int *)((char *)(cgp) + (cgp)->cg_btotoff))) +#define cg_blks(fs, cgp, cylno) \ + (((cgp)->cg_magic != CG_MAGIC) \ + ? (((struct ocg *)(cgp))->cg_b[cylno]) \ + : ((short *)((char *)(cgp) + (cgp)->cg_boff) + (cylno) * (fs)->fs_nrpos)) +#define cg_inosused(cgp) \ + (((cgp)->cg_magic != CG_MAGIC) \ + ? (((struct ocg *)(cgp))->cg_iused) \ + : ((char *)((char *)(cgp) + (cgp)->cg_iusedoff))) +#define cg_blksfree(cgp) \ + (((cgp)->cg_magic != CG_MAGIC) \ + ? (((struct ocg *)(cgp))->cg_free) \ + : ((u_char *)((char *)(cgp) + (cgp)->cg_freeoff))) +#define cg_chkmagic(cgp) \ + ((cgp)->cg_magic == CG_MAGIC || ((struct ocg *)(cgp))->cg_magic == CG_MAGIC) + +/* + * The following structure is defined + * for compatibility with old file systems. + */ +struct ocg + { + int xxx1; /* struct ocg *cg_link; */ + int xxx2; /* struct ocg *cg_rlink; */ + mach_time_t cg_time; /* time last written */ + int cg_cgx; /* we are the cgx'th cylinder group */ + short cg_ncyl; /* number of cyl's this cg */ + short cg_niblk; /* number of inode blocks this cg */ + int cg_ndblk; /* number of data blocks this cg */ + struct csum cg_cs; /* cylinder summary information */ + int cg_rotor; /* position of last used block */ + int cg_frotor; /* position of last used frag */ + int cg_irotor; /* position of last used inode */ + int cg_frsum[8]; /* counts of available frags */ + int cg_btot[32]; /* block totals per cylinder */ + short cg_b[32][8]; /* positions of free blocks */ + char cg_iused[256]; /* used inode map */ + int cg_magic; /* magic number */ + u_char cg_free[1]; /* free block map */ +/* actually longer */ + }; + +/* + * Turn file system block numbers into disk block addresses. + * This maps file system blocks to device size blocks. + */ +#define fsbtodb(fs, b) ((b) << (fs)->fs_fsbtodb) +#define dbtofsb(fs, b) ((b) >> (fs)->fs_fsbtodb) + +/* + * Cylinder group macros to locate things in cylinder groups. + * They calc file system addresses of cylinder group data structures. + */ +#define cgbase(fs, c) ((mach_daddr_t)((fs)->fs_fpg * (c))) +#define cgstart(fs, c) \ + (cgbase(fs, c) + (fs)->fs_cgoffset * ((c) & ~((fs)->fs_cgmask))) +#define cgsblock(fs, c) (cgstart(fs, c) + (fs)->fs_sblkno) /* super blk */ +#define cgtod(fs, c) (cgstart(fs, c) + (fs)->fs_cblkno) /* cg block */ +#define cgimin(fs, c) (cgstart(fs, c) + (fs)->fs_iblkno) /* inode blk */ +#define cgdmin(fs, c) (cgstart(fs, c) + (fs)->fs_dblkno) /* 1st data */ + +/* + * Macros for handling inode numbers: + * inode number to file system block offset. + * inode number to cylinder group number. + * inode number to file system block address. + */ +#define itoo(fs, x) ((x) % INOPB(fs)) +#define itog(fs, x) ((x) / (fs)->fs_ipg) +#define itod(fs, x) \ + ((mach_daddr_t)(cgimin(fs, itog(fs, x)) + \ + (blkstofrags((fs), (((x) % (fs)->fs_ipg) / INOPB(fs)))))) + +/* + * Give cylinder group number for a file system block. + * Give cylinder group block number for a file system block. + */ +#define dtog(fs, d) ((d) / (fs)->fs_fpg) +#define dtogd(fs, d) ((d) % (fs)->fs_fpg) + +/* + * Extract the bits for a block from a map. + * Compute the cylinder and rotational position of a cyl block addr. + */ +#define blkmap(fs, map, loc) \ + (((map)[(loc) / NBBY] >> ((loc) % NBBY)) & (0xff >> (NBBY - (fs)->fs_frag))) +#define cbtocylno(fs, bno) \ + ((bno) * NSPF(fs) / (fs)->fs_spc) +#define cbtorpos(fs, bno) \ + (((bno) * NSPF(fs) % (fs)->fs_spc / (fs)->fs_nsect * (fs)->fs_trackskew + \ + (bno) * NSPF(fs) % (fs)->fs_spc % (fs)->fs_nsect * (fs)->fs_interleave) % \ + (fs)->fs_nsect * (fs)->fs_nrpos / (fs)->fs_npsect) + +/* + * The following macros optimize certain frequently calculated + * quantities by using shifts and masks in place of divisions + * modulos and multiplications. + */ +#define blkoff(fs, loc) /* calculates (loc % fs->fs_bsize) */ \ + ((loc) & ~(fs)->fs_bmask) +#define fragoff(fs, loc) /* calculates (loc % fs->fs_fsize) */ \ + ((loc) & ~(fs)->fs_fmask) +#define lblkno(fs, loc) /* calculates (loc / fs->fs_bsize) */ \ + ((loc) >> (fs)->fs_bshift) +#define numfrags(fs, loc) /* calculates (loc / fs->fs_fsize) */ \ + ((loc) >> (fs)->fs_fshift) +#define blkroundup(fs, size) /* calculates roundup(size, fs->fs_bsize) */ \ + (((size) + (fs)->fs_bsize - 1) & (fs)->fs_bmask) +#define fragroundup(fs, size) /* calculates roundup(size, fs->fs_fsize) */ \ + (((size) + (fs)->fs_fsize - 1) & (fs)->fs_fmask) +#define fragstoblks(fs, frags) /* calculates (frags / fs->fs_frag) */ \ + ((frags) >> (fs)->fs_fragshift) +#define blkstofrags(fs, blks) /* calculates (blks * fs->fs_frag) */ \ + ((blks) << (fs)->fs_fragshift) +#define fragnum(fs, fsb) /* calculates (fsb % fs->fs_frag) */ \ + ((fsb) & ((fs)->fs_frag - 1)) +#define blknum(fs, fsb) /* calculates rounddown(fsb, fs->fs_frag) */ \ + ((fsb) &~ ((fs)->fs_frag - 1)) + +/* + * Determine the number of available frags given a + * percentage to hold in reserve + */ +#define freespace(fs, percentreserved) \ + (blkstofrags((fs), (fs)->fs_cstotal.cs_nbfree) + \ + (fs)->fs_cstotal.cs_nffree - ((fs)->fs_dsize * (percentreserved) / 100)) + +/* + * Determining the size of a file block in the file system. + */ +#define blksize(fs, ip, lbn) \ + (((lbn) >= NDADDR || (ip)->i_size >= ((lbn) + 1) << (fs)->fs_bshift) \ + ? (fs)->fs_bsize \ + : (fragroundup(fs, blkoff(fs, (ip)->i_size)))) +#define dblksize(fs, dip, lbn) \ + (((lbn) >= NDADDR || (dip)->di_size >= ((lbn) + 1) << (fs)->fs_bshift) \ + ? (fs)->fs_bsize \ + : (fragroundup(fs, blkoff(fs, (dip)->di_size)))) + +/* + * Number of disk sectors per block; assumes DEV_BSIZE byte sector size. + */ +#define NSPB(fs) ((fs)->fs_nspf << (fs)->fs_fragshift) +#define NSPF(fs) ((fs)->fs_nspf) + +/* + * INOPB is the number of inodes in a secondary storage block. + */ +#define INOPB(fs) ((fs)->fs_inopb) +#define INOPF(fs) ((fs)->fs_inopb >> (fs)->fs_fragshift) + +/* + * NINDIR is the number of indirects in a file system block. + */ +#define NINDIR(fs) ((fs)->fs_nindir) diff --git a/usr/src/grub/grub-0.97/stage2/fsys_ext2fs.c b/usr/src/grub/grub-0.97/stage2/fsys_ext2fs.c new file mode 100644 index 0000000000..568f8b5a07 --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/fsys_ext2fs.c @@ -0,0 +1,837 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999, 2001, 2003 Free Software Foundation, 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 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. + */ + +#ifdef FSYS_EXT2FS + +#include "shared.h" +#include "filesys.h" + +static int mapblock1, mapblock2; + +/* sizes are always in bytes, BLOCK values are always in DEV_BSIZE (sectors) */ +#define DEV_BSIZE 512 + +/* include/linux/fs.h */ +#define BLOCK_SIZE 1024 /* initial block size for superblock read */ +/* made up, defaults to 1 but can be passed via mount_opts */ +#define WHICH_SUPER 1 +/* kind of from fs/ext2/super.c */ +#define SBLOCK (WHICH_SUPER * BLOCK_SIZE / DEV_BSIZE) /* = 2 */ + +/* include/asm-i386/types.h */ +typedef __signed__ char __s8; +typedef unsigned char __u8; +typedef __signed__ short __s16; +typedef unsigned short __u16; +typedef __signed__ int __s32; +typedef unsigned int __u32; + +/* + * Constants relative to the data blocks, from ext2_fs.h + */ +#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) + +/* include/linux/ext2_fs.h */ +struct ext2_super_block + { + __u32 s_inodes_count; /* Inodes count */ + __u32 s_blocks_count; /* Blocks count */ + __u32 s_r_blocks_count; /* Reserved blocks count */ + __u32 s_free_blocks_count; /* Free blocks count */ + __u32 s_free_inodes_count; /* Free inodes count */ + __u32 s_first_data_block; /* First Data Block */ + __u32 s_log_block_size; /* Block size */ + __s32 s_log_frag_size; /* Fragment size */ + __u32 s_blocks_per_group; /* # Blocks per group */ + __u32 s_frags_per_group; /* # Fragments per group */ + __u32 s_inodes_per_group; /* # Inodes per group */ + __u32 s_mtime; /* Mount time */ + __u32 s_wtime; /* Write time */ + __u16 s_mnt_count; /* Mount count */ + __s16 s_max_mnt_count; /* Maximal mount count */ + __u16 s_magic; /* Magic signature */ + __u16 s_state; /* File system state */ + __u16 s_errors; /* Behaviour when detecting errors */ + __u16 s_pad; + __u32 s_lastcheck; /* time of last check */ + __u32 s_checkinterval; /* max. time between checks */ + __u32 s_creator_os; /* OS */ + __u32 s_rev_level; /* Revision level */ + __u16 s_def_resuid; /* Default uid for reserved blocks */ + __u16 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... + */ + __u32 s_first_ino; /* First non-reserved inode */ + __u16 s_inode_size; /* size of inode structure */ + __u16 s_block_group_nr; /* block group # of this superblock */ + __u32 s_feature_compat; /* compatible feature set */ + __u32 s_feature_incompat; /* incompatible feature set */ + __u32 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 */ + __u32 s_algorithm_usage_bitmap; /* For compression */ + /* + * Performance hints. Directory preallocation should only + * happen if the EXT2_FEATURE_COMPAT_DIR_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_reserved_gdt_blocks;/* Per group table for online growth */ + /* + * Journaling support valid if EXT2_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_jnl_backup_type; /* Default type of journal backup */ + __u16 s_reserved_word_pad; + __u32 s_default_mount_opts; + __u32 s_first_meta_bg; /* First metablock group */ + __u32 s_mkfs_time; /* When the filesystem was created */ + __u32 s_jnl_blocks[17]; /* Backup of the journal inode */ + __u32 s_reserved[172]; /* Padding to the end of the block */ + }; + +struct ext2_group_desc + { + __u32 bg_block_bitmap; /* Blocks bitmap block */ + __u32 bg_inode_bitmap; /* Inodes bitmap block */ + __u32 bg_inode_table; /* Inodes table block */ + __u16 bg_free_blocks_count; /* Free blocks count */ + __u16 bg_free_inodes_count; /* Free inodes count */ + __u16 bg_used_dirs_count; /* Directories count */ + __u16 bg_pad; + __u32 bg_reserved[3]; + }; + +struct ext2_inode + { + __u16 i_mode; /* File mode */ + __u16 i_uid; /* Owner Uid */ + __u32 i_size; /* 4: Size in bytes */ + __u32 i_atime; /* Access time */ + __u32 i_ctime; /* 12: Creation time */ + __u32 i_mtime; /* Modification time */ + __u32 i_dtime; /* 20: Deletion Time */ + __u16 i_gid; /* Group Id */ + __u16 i_links_count; /* 24: Links count */ + __u32 i_blocks; /* Blocks count */ + __u32 i_flags; /* 32: File flags */ + union + { + struct + { + __u32 l_i_reserved1; + } + linux1; + struct + { + __u32 h_i_translator; + } + hurd1; + struct + { + __u32 m_i_reserved1; + } + masix1; + } + osd1; /* OS dependent 1 */ + __u32 i_block[EXT2_N_BLOCKS]; /* 40: Pointers to blocks */ + __u32 i_version; /* File version (for NFS) */ + __u32 i_file_acl; /* File ACL */ + __u32 i_dir_acl; /* Directory ACL */ + __u32 i_faddr; /* Fragment address */ + union + { + struct + { + __u8 l_i_frag; /* Fragment number */ + __u8 l_i_fsize; /* Fragment size */ + __u16 i_pad1; + __u32 l_i_reserved2[2]; + } + linux2; + struct + { + __u8 h_i_frag; /* Fragment number */ + __u8 h_i_fsize; /* Fragment size */ + __u16 h_i_mode_high; + __u16 h_i_uid_high; + __u16 h_i_gid_high; + __u32 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 */ + }; + +/* linux/limits.h */ +#define NAME_MAX 255 /* # chars in a file name */ + +/* linux/posix_type.h */ +typedef long linux_off_t; + +/* linux/ext2fs.h */ +#define EXT2_NAME_LEN 255 +struct ext2_dir_entry + { + __u32 inode; /* Inode number */ + __u16 rec_len; /* Directory entry length */ + __u8 name_len; /* Name length */ + __u8 file_type; + char name[EXT2_NAME_LEN]; /* File name */ + }; + +/* linux/ext2fs.h */ +/* + * 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) + + +/* ext2/super.c */ +#define log2(n) ffz(~(n)) + +#define EXT2_SUPER_MAGIC 0xEF53 /* include/linux/ext2_fs.h */ +#define EXT2_ROOT_INO 2 /* include/linux/ext2_fs.h */ +#define PATH_MAX 1024 /* include/linux/limits.h */ +#define MAX_LINK_COUNT 5 /* number of symbolic links to follow */ + +/* made up, these are pointers into FSYS_BUF */ +/* read once, always stays there: */ +#define SUPERBLOCK \ + ((struct ext2_super_block *)(FSYS_BUF)) +#define GROUP_DESC \ + ((struct ext2_group_desc *) \ + ((int)SUPERBLOCK + sizeof(struct ext2_super_block))) +#define INODE \ + ((struct ext2_inode *)((int)GROUP_DESC + EXT2_BLOCK_SIZE(SUPERBLOCK))) +#define DATABLOCK1 \ + ((int)((int)INODE + sizeof(struct ext2_inode))) +#define DATABLOCK2 \ + ((int)((int)DATABLOCK1 + EXT2_BLOCK_SIZE(SUPERBLOCK))) + +/* linux/ext2_fs.h */ +#define EXT2_ADDR_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof (__u32)) +#define EXT2_ADDR_PER_BLOCK_BITS(s) (log2(EXT2_ADDR_PER_BLOCK(s))) + +#define EXT2_INODE_SIZE(s) (SUPERBLOCK->s_inode_size) +#define EXT2_INODES_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s)/EXT2_INODE_SIZE(s)) + +/* linux/ext2_fs.h */ +#define EXT2_BLOCK_SIZE_BITS(s) ((s)->s_log_block_size + 10) +/* kind of from ext2/super.c */ +#define EXT2_BLOCK_SIZE(s) (1 << EXT2_BLOCK_SIZE_BITS(s)) +/* linux/ext2fs.h */ +#define EXT2_DESC_PER_BLOCK(s) \ + (EXT2_BLOCK_SIZE(s) / sizeof (struct ext2_group_desc)) +/* linux/stat.h */ +#define S_IFMT 00170000 +#define S_IFLNK 0120000 +#define S_IFREG 0100000 +#define S_IFDIR 0040000 +#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) + +/* include/asm-i386/bitops.h */ +/* + * ffz = Find First Zero in word. Undefined if no zero exists, + * so code should check against ~0UL first.. + */ +static __inline__ unsigned long +ffz (unsigned long word) +{ + __asm__ ("bsfl %1,%0" +: "=r" (word) +: "r" (~word)); + return word; +} + +/* check filesystem types and read superblock into memory buffer */ +int +ext2fs_mount (void) +{ + int retval = 1; + + if ((((current_drive & 0x80) || (current_slice != 0)) + && (current_slice != PC_SLICE_TYPE_EXT2FS) + && (current_slice != PC_SLICE_TYPE_LINUX_RAID) + && (! IS_PC_SLICE_TYPE_BSD_WITH_FS (current_slice, FS_EXT2FS)) + && (! IS_PC_SLICE_TYPE_BSD_WITH_FS (current_slice, FS_OTHER))) + || part_length < (SBLOCK + (sizeof (struct ext2_super_block) / DEV_BSIZE)) + || !devread (SBLOCK, 0, sizeof (struct ext2_super_block), + (char *) SUPERBLOCK) + || SUPERBLOCK->s_magic != EXT2_SUPER_MAGIC) + retval = 0; + + return retval; +} + +/* Takes a file system block number and reads it into BUFFER. */ +static int +ext2_rdfsb (int fsblock, int buffer) +{ +#ifdef E2DEBUG + printf ("fsblock %d buffer %d\n", fsblock, buffer); +#endif /* E2DEBUG */ + return devread (fsblock * (EXT2_BLOCK_SIZE (SUPERBLOCK) / DEV_BSIZE), 0, + EXT2_BLOCK_SIZE (SUPERBLOCK), (char *) buffer); +} + +/* from + ext2/inode.c:ext2_bmap() +*/ +/* Maps LOGICAL_BLOCK (the file offset divided by the blocksize) into + a physical block (the location in the file system) via an inode. */ +static int +ext2fs_block_map (int logical_block) +{ + +#ifdef E2DEBUG + unsigned char *i; + for (i = (unsigned char *) INODE; + i < ((unsigned char *) INODE + sizeof (struct ext2_inode)); + i++) + { + printf ("%c", "0123456789abcdef"[*i >> 4]); + printf ("%c", "0123456789abcdef"[*i % 16]); + if (!((i + 1 - (unsigned char *) INODE) % 16)) + { + printf ("\n"); + } + else + { + printf (" "); + } + } + printf ("logical block %d\n", logical_block); +#endif /* E2DEBUG */ + + /* if it is directly pointed to by the inode, return that physical addr */ + if (logical_block < EXT2_NDIR_BLOCKS) + { +#ifdef E2DEBUG + printf ("returning %d\n", (unsigned char *) (INODE->i_block[logical_block])); + printf ("returning %d\n", INODE->i_block[logical_block]); +#endif /* E2DEBUG */ + return INODE->i_block[logical_block]; + } + /* else */ + logical_block -= EXT2_NDIR_BLOCKS; + /* try the indirect block */ + if (logical_block < EXT2_ADDR_PER_BLOCK (SUPERBLOCK)) + { + if (mapblock1 != 1 + && !ext2_rdfsb (INODE->i_block[EXT2_IND_BLOCK], DATABLOCK1)) + { + errnum = ERR_FSYS_CORRUPT; + return -1; + } + mapblock1 = 1; + return ((__u32 *) DATABLOCK1)[logical_block]; + } + /* else */ + logical_block -= EXT2_ADDR_PER_BLOCK (SUPERBLOCK); + /* now try the double indirect block */ + if (logical_block < (1 << (EXT2_ADDR_PER_BLOCK_BITS (SUPERBLOCK) * 2))) + { + int bnum; + if (mapblock1 != 2 + && !ext2_rdfsb (INODE->i_block[EXT2_DIND_BLOCK], DATABLOCK1)) + { + errnum = ERR_FSYS_CORRUPT; + return -1; + } + mapblock1 = 2; + if ((bnum = (((__u32 *) DATABLOCK1) + [logical_block >> EXT2_ADDR_PER_BLOCK_BITS (SUPERBLOCK)])) + != mapblock2 + && !ext2_rdfsb (bnum, DATABLOCK2)) + { + errnum = ERR_FSYS_CORRUPT; + return -1; + } + mapblock2 = bnum; + return ((__u32 *) DATABLOCK2) + [logical_block & (EXT2_ADDR_PER_BLOCK (SUPERBLOCK) - 1)]; + } + /* else */ + mapblock2 = -1; + logical_block -= (1 << (EXT2_ADDR_PER_BLOCK_BITS (SUPERBLOCK) * 2)); + if (mapblock1 != 3 + && !ext2_rdfsb (INODE->i_block[EXT2_TIND_BLOCK], DATABLOCK1)) + { + errnum = ERR_FSYS_CORRUPT; + return -1; + } + mapblock1 = 3; + if (!ext2_rdfsb (((__u32 *) DATABLOCK1) + [logical_block >> (EXT2_ADDR_PER_BLOCK_BITS (SUPERBLOCK) + * 2)], + DATABLOCK2)) + { + errnum = ERR_FSYS_CORRUPT; + return -1; + } + if (!ext2_rdfsb (((__u32 *) DATABLOCK2) + [(logical_block >> EXT2_ADDR_PER_BLOCK_BITS (SUPERBLOCK)) + & (EXT2_ADDR_PER_BLOCK (SUPERBLOCK) - 1)], + DATABLOCK2)) + { + errnum = ERR_FSYS_CORRUPT; + return -1; + } + return ((__u32 *) DATABLOCK2) + [logical_block & (EXT2_ADDR_PER_BLOCK (SUPERBLOCK) - 1)]; +} + +/* preconditions: all preconds of ext2fs_block_map */ +int +ext2fs_read (char *buf, int len) +{ + int logical_block; + int offset; + int map; + int ret = 0; + int size = 0; + +#ifdef E2DEBUG + static char hexdigit[] = "0123456789abcdef"; + unsigned char *i; + for (i = (unsigned char *) INODE; + i < ((unsigned char *) INODE + sizeof (struct ext2_inode)); + i++) + { + printf ("%c", hexdigit[*i >> 4]); + printf ("%c", hexdigit[*i % 16]); + if (!((i + 1 - (unsigned char *) INODE) % 16)) + { + printf ("\n"); + } + else + { + printf (" "); + } + } +#endif /* E2DEBUG */ + while (len > 0) + { + /* find the (logical) block component of our location */ + logical_block = filepos >> EXT2_BLOCK_SIZE_BITS (SUPERBLOCK); + offset = filepos & (EXT2_BLOCK_SIZE (SUPERBLOCK) - 1); + map = ext2fs_block_map (logical_block); +#ifdef E2DEBUG + printf ("map=%d\n", map); +#endif /* E2DEBUG */ + if (map < 0) + break; + + size = EXT2_BLOCK_SIZE (SUPERBLOCK); + size -= offset; + if (size > len) + size = len; + + if (map == 0) { + memset ((char *) buf, 0, size); + } else { + disk_read_func = disk_read_hook; + + devread (map * (EXT2_BLOCK_SIZE (SUPERBLOCK) / DEV_BSIZE), + offset, size, buf); + + disk_read_func = NULL; + } + + buf += size; + len -= size; + filepos += size; + ret += size; + } + + if (errnum) + ret = 0; + + return ret; +} + + +/* Based on: + def_blk_fops points to + blkdev_open, which calls (I think): + sys_open() + do_open() + open_namei() + dir_namei() which accesses current->fs->root + fs->root was set during original mount: + (something)... which calls (I think): + ext2_read_super() + iget() + __iget() + read_inode() + ext2_read_inode() + uses desc_per_block_bits, which is set in ext2_read_super() + also uses group descriptors loaded during ext2_read_super() + lookup() + ext2_lookup() + ext2_find_entry() + ext2_getblk() + +*/ + +static inline +int ext2_is_fast_symlink (void) +{ + int ea_blocks; + ea_blocks = INODE->i_file_acl ? EXT2_BLOCK_SIZE (SUPERBLOCK) / DEV_BSIZE : 0; + return INODE->i_blocks == ea_blocks; +} + +/* preconditions: ext2fs_mount already executed, therefore supblk in buffer + * known as SUPERBLOCK + * returns: 0 if error, nonzero iff we were able to find the file successfully + * postconditions: on a nonzero return, buffer known as INODE contains the + * inode of the file we were trying to look up + * side effects: messes up GROUP_DESC buffer area + */ +int +ext2fs_dir (char *dirname) +{ + int current_ino = EXT2_ROOT_INO; /* start at the root */ + int updir_ino = current_ino; /* the parent of the current directory */ + int group_id; /* which group the inode is in */ + int group_desc; /* fs pointer to that group */ + int desc; /* index within that group */ + int ino_blk; /* fs pointer of the inode's information */ + int str_chk = 0; /* used to hold the results of a string compare */ + struct ext2_group_desc *gdp; + struct ext2_inode *raw_inode; /* inode info corresponding to current_ino */ + + char linkbuf[PATH_MAX]; /* buffer for following symbolic links */ + int link_count = 0; + + char *rest; + char ch; /* temp char holder */ + + int off; /* offset within block of directory entry (off mod blocksize) */ + int loc; /* location within a directory */ + int blk; /* which data blk within dir entry (off div blocksize) */ + long map; /* fs pointer of a particular block from dir entry */ + struct ext2_dir_entry *dp; /* pointer to directory entry */ +#ifdef E2DEBUG + unsigned char *i; +#endif /* E2DEBUG */ + + /* loop invariants: + current_ino = inode to lookup + dirname = pointer to filename component we are cur looking up within + the directory known pointed to by current_ino (if any) + */ + + while (1) + { +#ifdef E2DEBUG + printf ("inode %d\n", current_ino); + printf ("dirname=%s\n", dirname); +#endif /* E2DEBUG */ + + /* look up an inode */ + group_id = (current_ino - 1) / (SUPERBLOCK->s_inodes_per_group); + group_desc = group_id >> log2 (EXT2_DESC_PER_BLOCK (SUPERBLOCK)); + desc = group_id & (EXT2_DESC_PER_BLOCK (SUPERBLOCK) - 1); +#ifdef E2DEBUG + printf ("ipg=%d, dpb=%d\n", SUPERBLOCK->s_inodes_per_group, + EXT2_DESC_PER_BLOCK (SUPERBLOCK)); + printf ("group_id=%d group_desc=%d desc=%d\n", group_id, group_desc, desc); +#endif /* E2DEBUG */ + if (!ext2_rdfsb ( + (WHICH_SUPER + group_desc + SUPERBLOCK->s_first_data_block), + (int) GROUP_DESC)) + { + return 0; + } + gdp = GROUP_DESC; + ino_blk = gdp[desc].bg_inode_table + + (((current_ino - 1) % (SUPERBLOCK->s_inodes_per_group)) + >> log2 (EXT2_INODES_PER_BLOCK (SUPERBLOCK))); +#ifdef E2DEBUG + printf ("inode table fsblock=%d\n", ino_blk); +#endif /* E2DEBUG */ + if (!ext2_rdfsb (ino_blk, (int) INODE)) + { + return 0; + } + + /* reset indirect blocks! */ + mapblock2 = mapblock1 = -1; + + raw_inode = (struct ext2_inode *)((char *)INODE + + ((current_ino - 1) & (EXT2_INODES_PER_BLOCK (SUPERBLOCK) - 1)) * + EXT2_INODE_SIZE (SUPERBLOCK)); + +#ifdef E2DEBUG + printf ("ipb=%d, sizeof(inode)=%d\n", + EXT2_INODES_PER_BLOCK (SUPERBLOCK), EXT2_INODE_SIZE (SUPERBLOCK)); + printf ("inode=%x, raw_inode=%x\n", INODE, raw_inode); + printf ("offset into inode table block=%d\n", (int) raw_inode - (int) INODE); + for (i = (unsigned char *) INODE; i <= (unsigned char *) raw_inode; + i++) + { + printf ("%c", "0123456789abcdef"[*i >> 4]); + printf ("%c", "0123456789abcdef"[*i % 16]); + if (!((i + 1 - (unsigned char *) INODE) % 16)) + { + printf ("\n"); + } + else + { + printf (" "); + } + } + printf ("first word=%x\n", *((int *) raw_inode)); +#endif /* E2DEBUG */ + + /* copy inode to fixed location */ + memmove ((void *) INODE, (void *) raw_inode, sizeof (struct ext2_inode)); + +#ifdef E2DEBUG + printf ("first word=%x\n", *((int *) INODE)); +#endif /* E2DEBUG */ + + /* If we've got a symbolic link, then chase it. */ + if (S_ISLNK (INODE->i_mode)) + { + int len; + if (++link_count > MAX_LINK_COUNT) + { + errnum = ERR_SYMLINK_LOOP; + return 0; + } + + /* Find out how long our remaining name is. */ + len = 0; + while (dirname[len] && !isspace (dirname[len])) + len++; + + /* Get the symlink size. */ + filemax = (INODE->i_size); + if (filemax + len > sizeof (linkbuf) - 2) + { + errnum = ERR_FILELENGTH; + return 0; + } + + if (len) + { + /* Copy the remaining name to the end of the symlink data. + Note that DIRNAME and LINKBUF may overlap! */ + memmove (linkbuf + filemax, dirname, len); + } + linkbuf[filemax + len] = '\0'; + + /* Read the symlink data. */ + if (! ext2_is_fast_symlink ()) + { + /* Read the necessary blocks, and reset the file pointer. */ + len = grub_read (linkbuf, filemax); + filepos = 0; + if (!len) + return 0; + } + else + { + /* Copy the data directly from the inode. */ + len = filemax; + memmove (linkbuf, (char *) INODE->i_block, len); + } + +#ifdef E2DEBUG + printf ("symlink=%s\n", linkbuf); +#endif + + dirname = linkbuf; + if (*dirname == '/') + { + /* It's an absolute link, so look it up in root. */ + current_ino = EXT2_ROOT_INO; + updir_ino = current_ino; + } + else + { + /* Relative, so look it up in our parent directory. */ + current_ino = updir_ino; + } + + /* Try again using the new name. */ + continue; + } + + /* if end of filename, INODE points to the file's inode */ + if (!*dirname || isspace (*dirname)) + { + if (!S_ISREG (INODE->i_mode)) + { + errnum = ERR_BAD_FILETYPE; + return 0; + } + + filemax = (INODE->i_size); + return 1; + } + + /* else we have to traverse a directory */ + updir_ino = current_ino; + + /* skip over slashes */ + while (*dirname == '/') + dirname++; + + /* if this isn't a directory of sufficient size to hold our file, abort */ + if (!(INODE->i_size) || !S_ISDIR (INODE->i_mode)) + { + errnum = ERR_BAD_FILETYPE; + return 0; + } + + /* skip to next slash or end of filename (space) */ + for (rest = dirname; (ch = *rest) && !isspace (ch) && ch != '/'; + rest++); + + /* look through this directory and find the next filename component */ + /* invariant: rest points to slash after the next filename component */ + *rest = 0; + loc = 0; + + do + { + +#ifdef E2DEBUG + printf ("dirname=%s, rest=%s, loc=%d\n", dirname, rest, loc); +#endif /* E2DEBUG */ + + /* if our location/byte offset into the directory exceeds the size, + give up */ + if (loc >= INODE->i_size) + { + if (print_possibilities < 0) + { +# if 0 + putchar ('\n'); +# endif + } + else + { + errnum = ERR_FILE_NOT_FOUND; + *rest = ch; + } + return (print_possibilities < 0); + } + + /* else, find the (logical) block component of our location */ + blk = loc >> EXT2_BLOCK_SIZE_BITS (SUPERBLOCK); + + /* we know which logical block of the directory entry we are looking + for, now we have to translate that to the physical (fs) block on + the disk */ + map = ext2fs_block_map (blk); +#ifdef E2DEBUG + printf ("fs block=%d\n", map); +#endif /* E2DEBUG */ + mapblock2 = -1; + if ((map < 0) || !ext2_rdfsb (map, DATABLOCK2)) + { + errnum = ERR_FSYS_CORRUPT; + *rest = ch; + return 0; + } + off = loc & (EXT2_BLOCK_SIZE (SUPERBLOCK) - 1); + dp = (struct ext2_dir_entry *) (DATABLOCK2 + off); + /* advance loc prematurely to next on-disk directory entry */ + loc += dp->rec_len; + + /* NOTE: ext2fs filenames are NOT null-terminated */ + +#ifdef E2DEBUG + printf ("directory entry ino=%d\n", dp->inode); + if (dp->inode) + printf ("entry=%s\n", dp->name); +#endif /* E2DEBUG */ + + if (dp->inode) + { + int saved_c = dp->name[dp->name_len]; + + dp->name[dp->name_len] = 0; + str_chk = substring (dirname, dp->name); + +# ifndef STAGE1_5 + if (print_possibilities && ch != '/' + && (!*dirname || str_chk <= 0)) + { + if (print_possibilities > 0) + print_possibilities = -print_possibilities; + print_a_completion (dp->name); + } +# endif + + dp->name[dp->name_len] = saved_c; + } + + } + while (!dp->inode || (str_chk || (print_possibilities && ch != '/'))); + + current_ino = dp->inode; + *(dirname = rest) = ch; + } + /* never get here */ +} + +#endif /* FSYS_EXT2_FS */ diff --git a/usr/src/grub/grub-0.97/stage2/fsys_fat.c b/usr/src/grub/grub-0.97/stage2/fsys_fat.c new file mode 100644 index 0000000000..850737b30d --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/fsys_fat.c @@ -0,0 +1,489 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2000,2001,2005 Free Software Foundation, 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 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. + */ + +#ifdef FSYS_FAT + +#include "shared.h" +#include "filesys.h" +#include "fat.h" + +struct fat_superblock +{ + int fat_offset; + int fat_length; + int fat_size; + int root_offset; + int root_max; + int data_offset; + + int num_sectors; + int num_clust; + int clust_eof_marker; + int sects_per_clust; + int sectsize_bits; + int clustsize_bits; + int root_cluster; + + int cached_fat; + int file_cluster; + int current_cluster_num; + int current_cluster; +}; + +/* pointer(s) into filesystem info buffer for DOS stuff */ +#define FAT_SUPER ( (struct fat_superblock *) \ + ( FSYS_BUF + 32256) )/* 512 bytes long */ +#define FAT_BUF ( FSYS_BUF + 30208 ) /* 4 sector FAT buffer */ +#define NAME_BUF ( FSYS_BUF + 29184 ) /* Filename buffer (833 bytes) */ + +#define FAT_CACHE_SIZE 2048 + +static __inline__ unsigned long +grub_log2 (unsigned long word) +{ + __asm__ ("bsfl %1,%0" + : "=r" (word) + : "r" (word)); + return word; +} +#define log2 grub_log2 + +int +fat_mount (void) +{ + struct fat_bpb bpb; + __u32 magic, first_fat; + + /* Check partition type for harddisk */ + if (((current_drive & 0x80) || (current_slice != 0)) + && ! IS_PC_SLICE_TYPE_FAT (current_slice) + && (! IS_PC_SLICE_TYPE_BSD_WITH_FS (current_slice, FS_MSDOS))) + return 0; + + /* Read bpb */ + if (! devread (0, 0, sizeof (bpb), (char *) &bpb)) + return 0; + + /* Check if the number of sectors per cluster is zero here, to avoid + zero division. */ + if (bpb.sects_per_clust == 0) + return 0; + + FAT_SUPER->sectsize_bits = log2 (FAT_CVT_U16 (bpb.bytes_per_sect)); + FAT_SUPER->clustsize_bits + = FAT_SUPER->sectsize_bits + log2 (bpb.sects_per_clust); + + /* Fill in info about super block */ + FAT_SUPER->num_sectors = FAT_CVT_U16 (bpb.short_sectors) + ? FAT_CVT_U16 (bpb.short_sectors) : bpb.long_sectors; + + /* FAT offset and length */ + FAT_SUPER->fat_offset = FAT_CVT_U16 (bpb.reserved_sects); + FAT_SUPER->fat_length = + bpb.fat_length ? bpb.fat_length : bpb.fat32_length; + + /* Rootdir offset and length for FAT12/16 */ + FAT_SUPER->root_offset = + FAT_SUPER->fat_offset + bpb.num_fats * FAT_SUPER->fat_length; + FAT_SUPER->root_max = FAT_DIRENTRY_LENGTH * FAT_CVT_U16(bpb.dir_entries); + + /* Data offset and number of clusters */ + FAT_SUPER->data_offset = + FAT_SUPER->root_offset + + ((FAT_SUPER->root_max - 1) >> FAT_SUPER->sectsize_bits) + 1; + FAT_SUPER->num_clust = + 2 + ((FAT_SUPER->num_sectors - FAT_SUPER->data_offset) + / bpb.sects_per_clust); + FAT_SUPER->sects_per_clust = bpb.sects_per_clust; + + if (!bpb.fat_length) + { + /* This is a FAT32 */ + if (FAT_CVT_U16(bpb.dir_entries)) + return 0; + + if (bpb.flags & 0x0080) + { + /* FAT mirroring is disabled, get active FAT */ + int active_fat = bpb.flags & 0x000f; + if (active_fat >= bpb.num_fats) + return 0; + FAT_SUPER->fat_offset += active_fat * FAT_SUPER->fat_length; + } + + FAT_SUPER->fat_size = 8; + FAT_SUPER->root_cluster = bpb.root_cluster; + + /* Yes the following is correct. FAT32 should be called FAT28 :) */ + FAT_SUPER->clust_eof_marker = 0xffffff8; + } + else + { + if (!FAT_SUPER->root_max) + return 0; + + FAT_SUPER->root_cluster = -1; + if (FAT_SUPER->num_clust > FAT_MAX_12BIT_CLUST) + { + FAT_SUPER->fat_size = 4; + FAT_SUPER->clust_eof_marker = 0xfff8; + } + else + { + FAT_SUPER->fat_size = 3; + FAT_SUPER->clust_eof_marker = 0xff8; + } + } + + /* Now do some sanity checks */ + + if (FAT_CVT_U16(bpb.bytes_per_sect) != (1 << FAT_SUPER->sectsize_bits) + || FAT_CVT_U16(bpb.bytes_per_sect) != SECTOR_SIZE + || bpb.sects_per_clust != (1 << (FAT_SUPER->clustsize_bits + - FAT_SUPER->sectsize_bits)) + || FAT_SUPER->num_clust <= 2 + || (FAT_SUPER->fat_size * FAT_SUPER->num_clust / (2 * SECTOR_SIZE) + > FAT_SUPER->fat_length)) + return 0; + + /* kbs: Media check on first FAT entry [ported from PUPA] */ + + if (!devread(FAT_SUPER->fat_offset, 0, + sizeof(first_fat), (char *)&first_fat)) + return 0; + + if (FAT_SUPER->fat_size == 8) + { + first_fat &= 0x0fffffff; + magic = 0x0fffff00; + } + else if (FAT_SUPER->fat_size == 4) + { + first_fat &= 0x0000ffff; + magic = 0xff00; + } + else + { + first_fat &= 0x00000fff; + magic = 0x0f00; + } + + /* Ignore the 3rd bit, because some BIOSes assigns 0xF0 to the media + descriptor, even if it is a so-called superfloppy (e.g. an USB key). + The check may be too strict for this kind of stupid BIOSes, as + they overwrite the media descriptor. */ + if ((first_fat | 0x8) != (magic | bpb.media | 0x8)) + return 0; + + FAT_SUPER->cached_fat = - 2 * FAT_CACHE_SIZE; + return 1; +} + +int +fat_read (char *buf, int len) +{ + int logical_clust; + int offset; + int ret = 0; + int size; + + if (FAT_SUPER->file_cluster < 0) + { + /* root directory for fat16 */ + size = FAT_SUPER->root_max - filepos; + if (size > len) + size = len; + if (!devread(FAT_SUPER->root_offset, filepos, size, buf)) + return 0; + filepos += size; + return size; + } + + logical_clust = filepos >> FAT_SUPER->clustsize_bits; + offset = (filepos & ((1 << FAT_SUPER->clustsize_bits) - 1)); + if (logical_clust < FAT_SUPER->current_cluster_num) + { + FAT_SUPER->current_cluster_num = 0; + FAT_SUPER->current_cluster = FAT_SUPER->file_cluster; + } + + while (len > 0) + { + int sector; + while (logical_clust > FAT_SUPER->current_cluster_num) + { + /* calculate next cluster */ + int fat_entry = + FAT_SUPER->current_cluster * FAT_SUPER->fat_size; + int next_cluster; + int cached_pos = (fat_entry - FAT_SUPER->cached_fat); + + if (cached_pos < 0 || + (cached_pos + FAT_SUPER->fat_size) > 2*FAT_CACHE_SIZE) + { + FAT_SUPER->cached_fat = (fat_entry & ~(2*SECTOR_SIZE - 1)); + cached_pos = (fat_entry - FAT_SUPER->cached_fat); + sector = FAT_SUPER->fat_offset + + FAT_SUPER->cached_fat / (2*SECTOR_SIZE); + if (!devread (sector, 0, FAT_CACHE_SIZE, (char*) FAT_BUF)) + return 0; + } + next_cluster = * (unsigned long *) (FAT_BUF + (cached_pos >> 1)); + if (FAT_SUPER->fat_size == 3) + { + if (cached_pos & 1) + next_cluster >>= 4; + next_cluster &= 0xFFF; + } + else if (FAT_SUPER->fat_size == 4) + next_cluster &= 0xFFFF; + + if (next_cluster >= FAT_SUPER->clust_eof_marker) + return ret; + if (next_cluster < 2 || next_cluster >= FAT_SUPER->num_clust) + { + errnum = ERR_FSYS_CORRUPT; + return 0; + } + + FAT_SUPER->current_cluster = next_cluster; + FAT_SUPER->current_cluster_num++; + } + + sector = FAT_SUPER->data_offset + + ((FAT_SUPER->current_cluster - 2) << (FAT_SUPER->clustsize_bits + - FAT_SUPER->sectsize_bits)); + size = (1 << FAT_SUPER->clustsize_bits) - offset; + if (size > len) + size = len; + + disk_read_func = disk_read_hook; + + devread(sector, offset, size, buf); + + disk_read_func = NULL; + + len -= size; + buf += size; + ret += size; + filepos += size; + logical_clust++; + offset = 0; + } + return errnum ? 0 : ret; +} + +int +fat_dir (char *dirname) +{ + char *rest, ch, dir_buf[FAT_DIRENTRY_LENGTH]; + char *filename = (char *) NAME_BUF; + int attrib = FAT_ATTRIB_DIR; +#ifndef STAGE1_5 + int do_possibilities = 0; +#endif + + /* XXX I18N: + * the positions 2,4,6 etc are high bytes of a 16 bit unicode char + */ + static unsigned char longdir_pos[] = + { 1, 3, 5, 7, 9, 14, 16, 18, 20, 22, 24, 28, 30 }; + int slot = -2; + int alias_checksum = -1; + + FAT_SUPER->file_cluster = FAT_SUPER->root_cluster; + filepos = 0; + FAT_SUPER->current_cluster_num = MAXINT; + + /* main loop to find desired directory entry */ + loop: + + /* if we have a real file (and we're not just printing possibilities), + then this is where we want to exit */ + + if (!*dirname || isspace (*dirname)) + { + if (attrib & FAT_ATTRIB_DIR) + { + errnum = ERR_BAD_FILETYPE; + return 0; + } + + return 1; + } + + /* continue with the file/directory name interpretation */ + + while (*dirname == '/') + dirname++; + + if (!(attrib & FAT_ATTRIB_DIR)) + { + errnum = ERR_BAD_FILETYPE; + return 0; + } + /* Directories don't have a file size */ + filemax = MAXINT; + + for (rest = dirname; (ch = *rest) && !isspace (ch) && ch != '/'; rest++); + + *rest = 0; + +# ifndef STAGE1_5 + if (print_possibilities && ch != '/') + do_possibilities = 1; +# endif + + while (1) + { + if (fat_read (dir_buf, FAT_DIRENTRY_LENGTH) != FAT_DIRENTRY_LENGTH + || dir_buf[0] == 0) + { + if (!errnum) + { +# ifndef STAGE1_5 + if (print_possibilities < 0) + { +#if 0 + putchar ('\n'); +#endif + return 1; + } +# endif /* STAGE1_5 */ + + errnum = ERR_FILE_NOT_FOUND; + *rest = ch; + } + + return 0; + } + + if (FAT_DIRENTRY_ATTRIB (dir_buf) == FAT_ATTRIB_LONGNAME) + { + /* This is a long filename. The filename is build from back + * to front and may span multiple entries. To bind these + * entries together they all contain the same checksum over + * the short alias. + * + * The id field tells if this is the first entry (the last + * part) of the long filename, and also at which offset this + * belongs. + * + * We just write the part of the long filename this entry + * describes and continue with the next dir entry. + */ + int i, offset; + unsigned char id = FAT_LONGDIR_ID(dir_buf); + + if ((id & 0x40)) + { + id &= 0x3f; + slot = id; + filename[slot * 13] = 0; + alias_checksum = FAT_LONGDIR_ALIASCHECKSUM(dir_buf); + } + + if (id != slot || slot == 0 + || alias_checksum != FAT_LONGDIR_ALIASCHECKSUM(dir_buf)) + { + alias_checksum = -1; + continue; + } + + slot--; + offset = slot * 13; + + for (i=0; i < 13; i++) + filename[offset+i] = dir_buf[longdir_pos[i]]; + continue; + } + + if (!FAT_DIRENTRY_VALID (dir_buf)) + continue; + + if (alias_checksum != -1 && slot == 0) + { + int i; + unsigned char sum; + + slot = -2; + for (sum = 0, i = 0; i< 11; i++) + sum = ((sum >> 1) | (sum << 7)) + dir_buf[i]; + + if (sum == alias_checksum) + { +# ifndef STAGE1_5 + if (do_possibilities) + goto print_filename; +# endif /* STAGE1_5 */ + + if (substring (dirname, filename) == 0) + break; + } + } + + /* XXX convert to 8.3 filename format here */ + { + int i, j, c; + + for (i = 0; i < 8 && (c = filename[i] = tolower (dir_buf[i])) + && !isspace (c); i++); + + filename[i++] = '.'; + + for (j = 0; j < 3 && (c = filename[i + j] = tolower (dir_buf[8 + j])) + && !isspace (c); j++); + + if (j == 0) + i--; + + filename[i + j] = 0; + } + +# ifndef STAGE1_5 + if (do_possibilities) + { + print_filename: + if (substring (dirname, filename) <= 0) + { + if (print_possibilities > 0) + print_possibilities = -print_possibilities; + print_a_completion (filename); + } + continue; + } +# endif /* STAGE1_5 */ + + if (substring (dirname, filename) == 0) + break; + } + + *(dirname = rest) = ch; + + attrib = FAT_DIRENTRY_ATTRIB (dir_buf); + filemax = FAT_DIRENTRY_FILELENGTH (dir_buf); + filepos = 0; + FAT_SUPER->file_cluster = FAT_DIRENTRY_FIRST_CLUSTER (dir_buf); + FAT_SUPER->current_cluster_num = MAXINT; + + /* go back to main loop at top of function */ + goto loop; +} + +#endif /* FSYS_FAT */ diff --git a/usr/src/grub/grub-0.97/stage2/fsys_ffs.c b/usr/src/grub/grub-0.97/stage2/fsys_ffs.c new file mode 100644 index 0000000000..2af53334f9 --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/fsys_ffs.c @@ -0,0 +1,310 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2000, 2001 Free Software Foundation, 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 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. + */ + +/* + * Elements of this file were originally from the FreeBSD "biosboot" + * bootloader file "disk.c" dated 4/12/95. + * + * The license and header comments from that file are included here. + */ + +/* + * Mach Operating System + * Copyright (c) 1992, 1991 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. + * + * 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 FROM THE USE OF THIS SOFTWARE. + * + * Carnegie Mellon requests users of this software to return to + * + * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU + * School of Computer Science + * Carnegie Mellon University + * Pittsburgh PA 15213-3890 + * + * any improvements or extensions that they make and grant Carnegie Mellon + * the rights to redistribute these changes. + * + * from: Mach, Revision 2.2 92/04/04 11:35:49 rpd + * $Id: fsys_ffs.c,v 1.1.1.1 2003/11/20 02:04:59 fengshuo Exp $ + */ + +#ifdef FSYS_FFS + +#include "shared.h" + +#include "filesys.h" + +#include "defs.h" +#include "disk_inode.h" +#include "disk_inode_ffs.h" +#include "dir.h" +#include "fs.h" + +/* used for filesystem map blocks */ +static int mapblock; +static int mapblock_offset; +static int mapblock_bsize; + +/* pointer to superblock */ +#define SUPERBLOCK ((struct fs *) ( FSYS_BUF + 8192 )) +#define INODE ((struct icommon *) ( FSYS_BUF + 16384 )) +#define MAPBUF ( FSYS_BUF + 24576 ) +#define MAPBUF_LEN 8192 + + +int +ffs_mount (void) +{ + int retval = 1; + + if ((((current_drive & 0x80) || (current_slice != 0)) + && ! IS_PC_SLICE_TYPE_BSD_WITH_FS (current_slice, FS_BSDFFS)) + || part_length < (SBLOCK + (SBSIZE / DEV_BSIZE)) + || !devread (SBLOCK, 0, SBSIZE, (char *) SUPERBLOCK) + || SUPERBLOCK->fs_magic != FS_MAGIC) + retval = 0; + + mapblock = -1; + mapblock_offset = -1; + + return retval; +} + +static int +block_map (int file_block) +{ + int bnum, offset, bsize; + + if (file_block < NDADDR) + return (INODE->i_db[file_block]); + + /* If the blockmap loaded does not include FILE_BLOCK, + load a new blockmap. */ + if ((bnum = fsbtodb (SUPERBLOCK, INODE->i_ib[0])) != mapblock + || (mapblock_offset <= bnum && bnum <= mapblock_offset + mapblock_bsize)) + { + if (MAPBUF_LEN < SUPERBLOCK->fs_bsize) + { + offset = ((file_block - NDADDR) % NINDIR (SUPERBLOCK)); + bsize = MAPBUF_LEN; + + if (offset + MAPBUF_LEN > SUPERBLOCK->fs_bsize) + offset = (SUPERBLOCK->fs_bsize - MAPBUF_LEN) / sizeof (int); + } + else + { + bsize = SUPERBLOCK->fs_bsize; + offset = 0; + } + + if (! devread (bnum, offset * sizeof (int), bsize, (char *) MAPBUF)) + { + mapblock = -1; + mapblock_bsize = -1; + mapblock_offset = -1; + errnum = ERR_FSYS_CORRUPT; + return -1; + } + + mapblock = bnum; + mapblock_bsize = bsize; + mapblock_offset = offset; + } + + return (((int *) MAPBUF)[((file_block - NDADDR) % NINDIR (SUPERBLOCK)) + - mapblock_offset]); +} + + +int +ffs_read (char *buf, int len) +{ + int logno, off, size, map, ret = 0; + + while (len && !errnum) + { + off = blkoff (SUPERBLOCK, filepos); + logno = lblkno (SUPERBLOCK, filepos); + size = blksize (SUPERBLOCK, INODE, logno); + + if ((map = block_map (logno)) < 0) + break; + + size -= off; + + if (size > len) + size = len; + + disk_read_func = disk_read_hook; + + devread (fsbtodb (SUPERBLOCK, map), off, size, buf); + + disk_read_func = NULL; + + buf += size; + len -= size; + filepos += size; + ret += size; + } + + if (errnum) + ret = 0; + + return ret; +} + + +int +ffs_dir (char *dirname) +{ + char *rest, ch; + int block, off, loc, map, ino = ROOTINO; + struct direct *dp; + +/* main loop to find destination inode */ +loop: + + /* load current inode (defaults to the root inode) */ + + if (!devread (fsbtodb (SUPERBLOCK, itod (SUPERBLOCK, ino)), + ino % (SUPERBLOCK->fs_inopb) * sizeof (struct dinode), + sizeof (struct dinode), (char *) INODE)) + return 0; /* XXX what return value? */ + + /* if we have a real file (and we're not just printing possibilities), + then this is where we want to exit */ + + if (!*dirname || isspace (*dirname)) + { + if ((INODE->i_mode & IFMT) != IFREG) + { + errnum = ERR_BAD_FILETYPE; + return 0; + } + + filemax = INODE->i_size; + + /* incomplete implementation requires this! */ + fsmax = (NDADDR + NINDIR (SUPERBLOCK)) * SUPERBLOCK->fs_bsize; + return 1; + } + + /* continue with file/directory name interpretation */ + + while (*dirname == '/') + dirname++; + + if (!(INODE->i_size) || ((INODE->i_mode & IFMT) != IFDIR)) + { + errnum = ERR_BAD_FILETYPE; + return 0; + } + + for (rest = dirname; (ch = *rest) && !isspace (ch) && ch != '/'; rest++); + + *rest = 0; + loc = 0; + + /* loop for reading a the entries in a directory */ + + do + { + if (loc >= INODE->i_size) + { +#if 0 + putchar ('\n'); +#endif + + if (print_possibilities < 0) + return 1; + + errnum = ERR_FILE_NOT_FOUND; + *rest = ch; + return 0; + } + + if (!(off = blkoff (SUPERBLOCK, loc))) + { + block = lblkno (SUPERBLOCK, loc); + + if ((map = block_map (block)) < 0 + || !devread (fsbtodb (SUPERBLOCK, map), 0, + blksize (SUPERBLOCK, INODE, block), + (char *) FSYS_BUF)) + { + errnum = ERR_FSYS_CORRUPT; + *rest = ch; + return 0; + } + } + + dp = (struct direct *) (FSYS_BUF + off); + loc += dp->d_reclen; + +#ifndef STAGE1_5 + if (dp->d_ino && print_possibilities && ch != '/' + && (!*dirname || substring (dirname, dp->d_name) <= 0)) + { + if (print_possibilities > 0) + print_possibilities = -print_possibilities; + + print_a_completion (dp->d_name); + } +#endif /* STAGE1_5 */ + } + while (!dp->d_ino || (substring (dirname, dp->d_name) != 0 + || (print_possibilities && ch != '/'))); + + /* only get here if we have a matching directory entry */ + + ino = dp->d_ino; + *(dirname = rest) = ch; + + /* go back to main loop at top of function */ + goto loop; +} + +int +ffs_embed (int *start_sector, int needed_sectors) +{ + /* XXX: I don't know if this is really correct. Someone who is + familiar with BSD should check for this. */ + if (needed_sectors > 14) + return 0; + + *start_sector = 1; +#if 1 + /* FIXME: Disable the embedding in FFS until someone checks if + the code above is correct. */ + return 0; +#else + return 1; +#endif +} + +#endif /* FSYS_FFS */ diff --git a/usr/src/grub/grub-0.97/stage2/fsys_iso9660.c b/usr/src/grub/grub-0.97/stage2/fsys_iso9660.c new file mode 100644 index 0000000000..555ea1eb77 --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/fsys_iso9660.c @@ -0,0 +1,449 @@ +/* + * ISO 9660 filesystem backend for GRUB (GRand Unified Bootloader) + * including Rock Ridge Extensions support + * + * Copyright (C) 1998, 1999 Kousuke Takai + * + * 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. + */ +/* + * References: + * linux/fs/isofs/rock.[ch] + * mkisofs-1.11.1/diag/isoinfo.c + * mkisofs-1.11.1/iso9660.h + * (all are written by Eric Youngdale) + * + * Modifications by: + * Leonid Lisovskiy 2003 + */ + +#ifdef FSYS_ISO9660 + +#include "shared.h" +#include "filesys.h" +#include "iso9660.h" + +/* iso9660 super-block data in memory */ +struct iso_sb_info { + unsigned long vol_sector; + +}; + +/* iso fs inode data in memory */ +struct iso_inode_info { + unsigned long file_start; +}; + +#define ISO_SUPER \ + ((struct iso_sb_info *)(FSYS_BUF)) +#define INODE \ + ((struct iso_inode_info *)(FSYS_BUF+sizeof(struct iso_sb_info))) +#define PRIMDESC ((struct iso_primary_descriptor *)(FSYS_BUF + 2048)) +#define DIRREC ((struct iso_directory_record *)(FSYS_BUF + 4096)) +#define RRCONT_BUF ((unsigned char *)(FSYS_BUF + 6144)) +#define NAME_BUF ((unsigned char *)(FSYS_BUF + 8192)) + + +static inline unsigned long +grub_log2 (unsigned long word) +{ + asm volatile ("bsfl %1,%0" + : "=r" (word) + : "r" (word)); + return word; +} +#define log2 grub_log2 + +static int +iso9660_devread (int sector, int byte_offset, int byte_len, char *buf) +{ + static int read_count = 0, threshold = 2; + unsigned short sector_size_lg2 = log2(buf_geom.sector_size); + + /* + * We have to use own devread() function since BIOS return wrong geometry + */ + if (sector < 0) + { + errnum = ERR_OUTSIDE_PART; + return 0; + } + if (byte_len <= 0) + return 1; + + sector += (byte_offset >> sector_size_lg2); + byte_offset &= (buf_geom.sector_size - 1); + asm volatile ("shl%L0 %1,%0" + : "=r"(sector) + : "Ic"((int8_t)(ISO_SECTOR_BITS - sector_size_lg2)), + "0"(sector)); + +#if !defined(STAGE1_5) + if (disk_read_hook && debug) + printf ("<%d, %d, %d>", sector, byte_offset, byte_len); +#endif /* !STAGE1_5 */ + + read_count += (byte_len >> 9); + if ((read_count >> 11) > threshold) { + noisy_printf("."); + threshold += 2; /* one dot every 2 MB */ + } + return rawread(current_drive, part_start + sector, byte_offset, byte_len, buf); +} + +int +iso9660_mount (void) +{ + unsigned int sector; + + /* + * Because there is no defined slice type ID for ISO-9660 filesystem, + * this test will pass only either (1) if entire disk is used, or + * (2) if current partition is BSD style sub-partition whose ID is + * ISO-9660. + */ + if ((current_partition != 0xFFFFFF) + && !IS_PC_SLICE_TYPE_BSD_WITH_FS(current_slice, FS_ISO9660)) + return 0; + + /* + * Currently, only FIRST session of MultiSession disks are supported !!! + */ + for (sector = 16 ; sector < 32 ; sector++) + { + if (!iso9660_devread(sector, 0, sizeof(*PRIMDESC), (char *)PRIMDESC)) + break; + /* check ISO_VD_PRIMARY and ISO_STANDARD_ID */ + if (PRIMDESC->type.l == ISO_VD_PRIMARY + && !memcmp(PRIMDESC->id, ISO_STANDARD_ID, sizeof(PRIMDESC->id))) + { + ISO_SUPER->vol_sector = sector; + INODE->file_start = 0; + fsmax = PRIMDESC->volume_space_size.l; + return 1; + } + } + + return 0; +} + +int +iso9660_dir (char *dirname) +{ + struct iso_directory_record *idr; + RR_ptr_t rr_ptr; + struct rock_ridge *ce_ptr; + unsigned int pathlen; + int size; + unsigned int extent; + unsigned char file_type; + unsigned int rr_len; + unsigned char rr_flag; + + idr = &PRIMDESC->root_directory_record; + INODE->file_start = 0; + + do + { + while (*dirname == '/') /* skip leading slashes */ + dirname++; + /* pathlen = strcspn(dirname, "/\n\t "); */ + for (pathlen = 0 ; + dirname[pathlen] + && !isspace(dirname[pathlen]) && dirname[pathlen] != '/' ; + pathlen++) + ; + + size = idr->size.l; + extent = idr->extent.l; + + while (size > 0) + { + if (!iso9660_devread(extent, 0, ISO_SECTOR_SIZE, (char *)DIRREC)) + { + errnum = ERR_FSYS_CORRUPT; + return 0; + } + extent++; + + idr = (struct iso_directory_record *)DIRREC; + for (; idr->length.l > 0; + idr = (struct iso_directory_record *)((char *)idr + idr->length.l) ) + { + const char *name = idr->name; + unsigned int name_len = idr->name_len.l; + + file_type = (idr->flags.l & 2) ? ISO_DIRECTORY : ISO_REGULAR; + if (name_len == 1) + { + if ((name[0] == 0) || /* self */ + (name[0] == 1)) /* parent */ + continue; + } + if (name_len > 2 && CHECK2(name + name_len - 2, ';', '1')) + { + name_len -= 2; /* truncate trailing file version */ + if (name_len > 1 && name[name_len - 1] == '.') + name_len--; /* truncate trailing dot */ + } + + /* + * Parse Rock-Ridge extension + */ + rr_len = (idr->length.l - idr->name_len.l + - sizeof(struct iso_directory_record) + + sizeof(idr->name)); + rr_ptr.ptr = ((unsigned char *)idr + idr->name_len.l + + sizeof(struct iso_directory_record) + - sizeof(idr->name)); + if (rr_ptr.i & 1) + rr_ptr.i++, rr_len--; + ce_ptr = NULL; + rr_flag = RR_FLAG_NM | RR_FLAG_PX /*| RR_FLAG_SL*/; + + while (rr_len >= 4) + { + if (rr_ptr.rr->version != 1) + { +#ifndef STAGE1_5 + if (debug) + printf( + "Non-supported version (%d) RockRidge chunk " + "`%c%c'\n", rr_ptr.rr->version, + rr_ptr.rr->signature & 0xFF, + rr_ptr.rr->signature >> 8); +#endif + } + else + { + switch (rr_ptr.rr->signature) + { + case RRMAGIC('R', 'R'): + if ( rr_ptr.rr->len >= (4+sizeof(struct RR))) + rr_flag &= rr_ptr.rr->u.rr.flags.l; + break; + case RRMAGIC('N', 'M'): + name = rr_ptr.rr->u.nm.name; + name_len = rr_ptr.rr->len - (4+sizeof(struct NM)); + rr_flag &= ~RR_FLAG_NM; + break; + case RRMAGIC('P', 'X'): + if (rr_ptr.rr->len >= (4+sizeof(struct PX))) + { + file_type = ((rr_ptr.rr->u.px.mode.l & POSIX_S_IFMT) + == POSIX_S_IFREG + ? ISO_REGULAR + : ((rr_ptr.rr->u.px.mode.l & POSIX_S_IFMT) + == POSIX_S_IFDIR + ? ISO_DIRECTORY : ISO_OTHER)); + rr_flag &= ~RR_FLAG_PX; + } + break; + case RRMAGIC('C', 'E'): + if (rr_ptr.rr->len >= (4+sizeof(struct CE))) + ce_ptr = rr_ptr.rr; + break; +#if 0 // RockRidge symlinks are not supported yet + case RRMAGIC('S', 'L'): + { + int slen; + unsigned char rootflag, prevflag; + char *rpnt = NAME_BUF+1024; + struct SL_component *slp; + + slen = rr_ptr.rr->len - (4+1); + slp = &rr_ptr.rr->u.sl.link; + while (slen > 1) + { + rootflag = 0; + switch (slp->flags.l) + { + case 0: + memcpy(rpnt, slp->text, slp->len); + rpnt += slp->len; + break; + case 4: + *rpnt++ = '.'; + /* fallthru */ + case 2: + *rpnt++ = '.'; + break; + case 8: + rootflag = 1; + *rpnt++ = '/'; + break; + default: + printf("Symlink component flag not implemented (%d)\n", + slp->flags.l); + slen = 0; + break; + } + slen -= slp->len + 2; + prevflag = slp->flags.l; + slp = (struct SL_component *) ((char *) slp + slp->len + 2); + + if (slen < 2) + { + /* + * If there is another SL record, and this component + * record isn't continued, then add a slash. + */ + if ((!rootflag) && (rr_ptr.rr->u.sl.flags.l & 1) && !(prevflag & 1)) + *rpnt++='/'; + break; + } + + /* + * If this component record isn't continued, then append a '/'. + */ + if (!rootflag && !(prevflag & 1)) + *rpnt++ = '/'; + } + *rpnt++ = '\0'; + grub_putstr(NAME_BUF+1024);// debug print! + } + rr_flag &= ~RR_FLAG_SL; + break; +#endif + default: + break; + } + } + if (!rr_flag) + /* + * There is no more extension we expects... + */ + break; + + rr_len -= rr_ptr.rr->len; + rr_ptr.ptr += rr_ptr.rr->len; + if (rr_len < 4 && ce_ptr != NULL) + { + /* preserve name before loading new extent. */ + if( RRCONT_BUF <= (unsigned char *)name + && (unsigned char *)name < RRCONT_BUF + ISO_SECTOR_SIZE ) + { + memcpy(NAME_BUF, name, name_len); + name = NAME_BUF; + } + rr_ptr.ptr = RRCONT_BUF + ce_ptr->u.ce.offset.l; + rr_len = ce_ptr->u.ce.size.l; + if (!iso9660_devread(ce_ptr->u.ce.extent.l, 0, ISO_SECTOR_SIZE, RRCONT_BUF)) + { + errnum = 0; /* this is not fatal. */ + break; + } + ce_ptr = NULL; + } + } /* rr_len >= 4 */ + + filemax = MAXINT; + if (name_len >= pathlen + && !memcmp(name, dirname, pathlen)) + { + if (dirname[pathlen] == '/' || !print_possibilities) + { + /* + * DIRNAME is directory component of pathname, + * or we are to open a file. + */ + if (pathlen == name_len) + { + if (dirname[pathlen] == '/') + { + if (file_type != ISO_DIRECTORY) + { + errnum = ERR_BAD_FILETYPE; + return 0; + } + goto next_dir_level; + } + if (file_type != ISO_REGULAR) + { + errnum = ERR_BAD_FILETYPE; + return 0; + } + INODE->file_start = idr->extent.l; + filepos = 0; + filemax = idr->size.l; + return 1; + } + } + else /* Completion */ + { +#ifndef STAGE1_5 + if (print_possibilities > 0) + print_possibilities = -print_possibilities; + memcpy(NAME_BUF, name, name_len); + NAME_BUF[name_len] = '\0'; + print_a_completion (NAME_BUF); +#endif + } + } + } /* for */ + + size -= ISO_SECTOR_SIZE; + } /* size>0 */ + + if (dirname[pathlen] == '/' || print_possibilities >= 0) + { + errnum = ERR_FILE_NOT_FOUND; + return 0; + } + + next_dir_level: + dirname += pathlen; + + } while (*dirname == '/'); + + return 1; +} + +int +iso9660_read (char *buf, int len) +{ + int sector, blkoffset, size, ret; + + if (INODE->file_start == 0) + return 0; + + ret = 0; + blkoffset = filepos & (ISO_SECTOR_SIZE - 1); + sector = filepos >> ISO_SECTOR_BITS; + while (len > 0) + { + size = ISO_SECTOR_SIZE - blkoffset; + if (size > len) + size = len; + + disk_read_func = disk_read_hook; + + if (!iso9660_devread(INODE->file_start + sector, blkoffset, size, buf)) + return 0; + + disk_read_func = NULL; + + len -= size; + buf += size; + ret += size; + filepos += size; + sector++; + blkoffset = 0; + } + + return ret; +} + +#endif /* FSYS_ISO9660 */ diff --git a/usr/src/grub/grub-0.97/stage2/fsys_jfs.c b/usr/src/grub/grub-0.97/stage2/fsys_jfs.c new file mode 100644 index 0000000000..307f83633c --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/fsys_jfs.c @@ -0,0 +1,403 @@ +/* fsys_jfs.c - an implementation for the IBM JFS file system */ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2001,2002 Free Software Foundation, 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 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. + */ + +#ifdef FSYS_JFS + +#include "shared.h" +#include "filesys.h" +#include "jfs.h" + +#define MAX_LINK_COUNT 8 + +#define DTTYPE_INLINE 0 +#define DTTYPE_PAGE 1 + +struct jfs_info +{ + int bsize; + int l2bsize; + int bdlog; + int xindex; + int xlastindex; + int sindex; + int slastindex; + int de_index; + int dttype; + xad_t *xad; + ldtentry_t *de; +}; + +static struct jfs_info jfs; + +#define xtpage ((xtpage_t *)FSYS_BUF) +#define dtpage ((dtpage_t *)((char *)FSYS_BUF + 4096)) +#define fileset ((dinode_t *)((char *)FSYS_BUF + 8192)) +#define inode ((dinode_t *)((char *)FSYS_BUF + 8192 + sizeof(dinode_t))) +#define dtroot ((dtroot_t *)(&inode->di_btroot)) + +static ldtentry_t de_always[2] = { + {1, -1, 2, {'.', '.'}}, + {1, -1, 1, {'.'}} +}; + +static int +isinxt (s64 key, s64 offset, s64 len) +{ + return (key >= offset) ? (key < offset + len ? 1 : 0) : 0; +} + +static xad_t * +first_extent (dinode_t *di) +{ + xtpage_t *xtp; + + jfs.xindex = 2; + xtp = (xtpage_t *)&di->di_btroot; + jfs.xad = &xtp->xad[2]; + if (xtp->header.flag & BT_LEAF) { + jfs.xlastindex = xtp->header.nextindex; + } else { + do { + devread (addressXAD (jfs.xad) << jfs.bdlog, 0, + sizeof(xtpage_t), (char *)xtpage); + jfs.xad = &xtpage->xad[2]; + } while (!(xtpage->header.flag & BT_LEAF)); + jfs.xlastindex = xtpage->header.nextindex; + } + + return jfs.xad; +} + +static xad_t * +next_extent (void) +{ + if (++jfs.xindex < jfs.xlastindex) { + } else if (xtpage->header.next) { + devread (xtpage->header.next << jfs.bdlog, 0, + sizeof(xtpage_t), (char *)xtpage); + jfs.xlastindex = xtpage->header.nextindex; + jfs.xindex = XTENTRYSTART; + jfs.xad = &xtpage->xad[XTENTRYSTART]; + } else { + return NULL; + } + return ++jfs.xad; +} + + +static void +di_read (u32 inum, dinode_t *di) +{ + s64 key; + u32 xd, ioffset; + s64 offset; + xad_t *xad; + pxd_t pxd; + + key = (((inum >> L2INOSPERIAG) << L2INOSPERIAG) + 4096) >> jfs.l2bsize; + xd = (inum & (INOSPERIAG - 1)) >> L2INOSPEREXT; + ioffset = ((inum & (INOSPERIAG - 1)) & (INOSPEREXT - 1)) << L2DISIZE; + xad = first_extent (fileset); + do { + offset = offsetXAD (xad); + if (isinxt (key, offset, lengthXAD (xad))) { + devread ((addressXAD (xad) + key - offset) << jfs.bdlog, + 3072 + xd*sizeof(pxd_t), sizeof(pxd_t), (char *)&pxd); + devread (addressPXD (&pxd) << jfs.bdlog, + ioffset, DISIZE, (char *)di); + break; + } + } while ((xad = next_extent ())); +} + +static ldtentry_t * +next_dentry (void) +{ + ldtentry_t *de; + s8 *stbl; + + if (jfs.dttype == DTTYPE_INLINE) { + if (jfs.sindex < jfs.slastindex) { + return (ldtentry_t *)&dtroot->slot[(int)dtroot->header.stbl[jfs.sindex++]]; + } + } else { + de = (ldtentry_t *)dtpage->slot; + stbl = (s8 *)&de[(int)dtpage->header.stblindex]; + if (jfs.sindex < jfs.slastindex) { + return &de[(int)stbl[jfs.sindex++]]; + } else if (dtpage->header.next) { + devread (dtpage->header.next << jfs.bdlog, 0, + sizeof(dtpage_t), (char *)dtpage); + jfs.slastindex = dtpage->header.nextindex; + jfs.sindex = 1; + return &de[(int)((s8 *)&de[(int)dtpage->header.stblindex])[0]]; + } + } + + return (jfs.de_index < 2) ? &de_always[jfs.de_index++] : NULL; +} + +static ldtentry_t * +first_dentry (void) +{ + dtroot_t *dtr; + pxd_t *xd; + idtentry_t *de; + + dtr = (dtroot_t *)&inode->di_btroot; + jfs.sindex = 0; + jfs.de_index = 0; + + de_always[0].inumber = inode->di_parent; + de_always[1].inumber = inode->di_number; + if (dtr->header.flag & BT_LEAF) { + jfs.dttype = DTTYPE_INLINE; + jfs.slastindex = dtr->header.nextindex; + } else { + de = (idtentry_t *)dtpage->slot; + jfs.dttype = DTTYPE_PAGE; + xd = &((idtentry_t *)dtr->slot)[(int)dtr->header.stbl[0]].xd; + for (;;) { + devread (addressPXD (xd) << jfs.bdlog, 0, + sizeof(dtpage_t), (char *)dtpage); + if (dtpage->header.flag & BT_LEAF) + break; + xd = &de[(int)((s8 *)&de[(int)dtpage->header.stblindex])[0]].xd; + } + jfs.slastindex = dtpage->header.nextindex; + } + + return next_dentry (); +} + + +static dtslot_t * +next_dslot (int next) +{ + return (jfs.dttype == DTTYPE_INLINE) + ? (dtslot_t *)&dtroot->slot[next] + : &((dtslot_t *)dtpage->slot)[next]; +} + +static void +uni2ansi (UniChar *uni, char *ansi, int len) +{ + for (; len; len--, uni++) + *ansi++ = (*uni & 0xff80) ? '?' : *(char *)uni; +} + +int +jfs_mount (void) +{ + struct jfs_superblock super; + + if (part_length < MINJFS >> SECTOR_BITS + || !devread (SUPER1_OFF >> SECTOR_BITS, 0, + sizeof(struct jfs_superblock), (char *)&super) + || (super.s_magic != JFS_MAGIC) + || !devread ((AITBL_OFF >> SECTOR_BITS) + FILESYSTEM_I, + 0, DISIZE, (char*)fileset)) { + return 0; + } + + jfs.bsize = super.s_bsize; + jfs.l2bsize = super.s_l2bsize; + jfs.bdlog = jfs.l2bsize - SECTOR_BITS; + + return 1; +} + +int +jfs_read (char *buf, int len) +{ + xad_t *xad; + s64 endofprev, endofcur; + s64 offset, xadlen; + int toread, startpos, endpos; + + startpos = filepos; + endpos = filepos + len; + endofprev = (1ULL << 62) - 1; + xad = first_extent (inode); + do { + offset = offsetXAD (xad); + xadlen = lengthXAD (xad); + if (isinxt (filepos >> jfs.l2bsize, offset, xadlen)) { + endofcur = (offset + xadlen) << jfs.l2bsize; + toread = (endofcur >= endpos) + ? len : (endofcur - filepos); + + disk_read_func = disk_read_hook; + devread (addressXAD (xad) << jfs.bdlog, + filepos - (offset << jfs.l2bsize), toread, buf); + disk_read_func = NULL; + + buf += toread; + len -= toread; + filepos += toread; + } else if (offset > endofprev) { + toread = ((offset << jfs.l2bsize) >= endpos) + ? len : ((offset - endofprev) << jfs.l2bsize); + len -= toread; + filepos += toread; + for (; toread; toread--) { + *buf++ = 0; + } + continue; + } + endofprev = offset + xadlen; + xad = next_extent (); + } while (len > 0 && xad); + + return filepos - startpos; +} + +int +jfs_dir (char *dirname) +{ + char *ptr, *rest, ch; + ldtentry_t *de; + dtslot_t *ds; + u32 inum, parent_inum; + s64 di_size; + u32 di_mode; + int namlen, cmp, n, link_count; + char namebuf[JFS_NAME_MAX + 1], linkbuf[JFS_PATH_MAX]; + + parent_inum = inum = ROOT_I; + link_count = 0; + for (;;) { + di_read (inum, inode); + di_size = inode->di_size; + di_mode = inode->di_mode; + + if ((di_mode & IFMT) == IFLNK) { + if (++link_count > MAX_LINK_COUNT) { + errnum = ERR_SYMLINK_LOOP; + return 0; + } + if (di_size < (di_mode & INLINEEA ? 256 : 128)) { + grub_memmove (linkbuf, inode->di_fastsymlink, di_size); + n = di_size; + } else if (di_size < JFS_PATH_MAX - 1) { + filepos = 0; + filemax = di_size; + n = jfs_read (linkbuf, filemax); + } else { + errnum = ERR_FILELENGTH; + return 0; + } + + inum = (linkbuf[0] == '/') ? ROOT_I : parent_inum; + while (n < (JFS_PATH_MAX - 1) && (linkbuf[n++] = *dirname++)); + linkbuf[n] = 0; + dirname = linkbuf; + continue; + } + + if (!*dirname || isspace (*dirname)) { + if ((di_mode & IFMT) != IFREG) { + errnum = ERR_BAD_FILETYPE; + return 0; + } + filepos = 0; + filemax = di_size; + return 1; + } + + if ((di_mode & IFMT) != IFDIR) { + errnum = ERR_BAD_FILETYPE; + return 0; + } + + for (; *dirname == '/'; dirname++); + + for (rest = dirname; (ch = *rest) && !isspace (ch) && ch != '/'; rest++); + *rest = 0; + + de = first_dentry (); + for (;;) { + namlen = de->namlen; + if (de->next == -1) { + uni2ansi (de->name, namebuf, namlen); + namebuf[namlen] = 0; + } else { + uni2ansi (de->name, namebuf, DTLHDRDATALEN); + ptr = namebuf; + ptr += DTLHDRDATALEN; + namlen -= DTLHDRDATALEN; + ds = next_dslot (de->next); + while (ds->next != -1) { + uni2ansi (ds->name, ptr, DTSLOTDATALEN); + ptr += DTSLOTDATALEN; + namlen -= DTSLOTDATALEN; + ds = next_dslot (ds->next); + } + uni2ansi (ds->name, ptr, namlen); + ptr += namlen; + *ptr = 0; + } + + cmp = (!*dirname) ? -1 : substring (dirname, namebuf); +#ifndef STAGE1_5 + if (print_possibilities && ch != '/' + && cmp <= 0) { + if (print_possibilities > 0) + print_possibilities = -print_possibilities; + print_a_completion (namebuf); + } else +#endif + if (cmp == 0) { + parent_inum = inum; + inum = de->inumber; + *(dirname = rest) = ch; + break; + } + de = next_dentry (); + if (de == NULL) { + if (print_possibilities < 0) + return 1; + + errnum = ERR_FILE_NOT_FOUND; + *rest = ch; + return 0; + } + } + } +} + +int +jfs_embed (int *start_sector, int needed_sectors) +{ + struct jfs_superblock super; + + if (needed_sectors > 63 + || !devread (SUPER1_OFF >> SECTOR_BITS, 0, + sizeof (struct jfs_superblock), + (char *)&super) + || (super.s_magic != JFS_MAGIC)) { + return 0; + } + + *start_sector = 1; + return 1; +} + +#endif /* FSYS_JFS */ diff --git a/usr/src/grub/grub-0.97/stage2/fsys_minix.c b/usr/src/grub/grub-0.97/stage2/fsys_minix.c new file mode 100644 index 0000000000..5c76796a21 --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/fsys_minix.c @@ -0,0 +1,534 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002 Free Software Foundation, 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 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. + */ + +/* Restrictions: + This is MINIX V1 only (yet) + Disk creation is like: + mkfs.minix -c DEVICE +*/ + +#ifdef FSYS_MINIX + +#include "shared.h" +#include "filesys.h" + +/* #define DEBUG_MINIX */ + +/* indirect blocks */ +static int mapblock1, mapblock2, namelen; + +/* sizes are always in bytes, BLOCK values are always in DEV_BSIZE (sectors) */ +#define DEV_BSIZE 512 + +/* include/linux/fs.h */ +#define BLOCK_SIZE_BITS 10 +#define BLOCK_SIZE (1<. 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_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 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))) +#define MINIX2_INODES_PER_BLOCK ((BLOCK_SIZE)/(sizeof (struct minix2_inode))) + +#define MINIX_V1 0x0001 /* original minix fs */ +#define MINIX_V2 0x0002 /* minix V2 fs */ + +/* originally this is : +#define INODE_VERSION(inode) inode->i_sb->u.minix_sb.s_version + here we have */ +#define INODE_VERSION(inode) (SUPERBLOCK->s_version) + +/* + * 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; +}; + +struct minix_dir_entry { + __u16 inode; + char name[0]; +}; + +/* made up, these are pointers into FSYS_BUF */ +/* read once, always stays there: */ +#define SUPERBLOCK \ + ((struct minix_super_block *)(FSYS_BUF)) +#define INODE \ + ((struct minix_inode *)((int) SUPERBLOCK + BLOCK_SIZE)) +#define DATABLOCK1 \ + ((int)((int)INODE + sizeof(struct minix_inode))) +#define DATABLOCK2 \ + ((int)((int)DATABLOCK1 + BLOCK_SIZE)) + +/* linux/stat.h */ +#define S_IFMT 00170000 +#define S_IFLNK 0120000 +#define S_IFREG 0100000 +#define S_IFDIR 0040000 +#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 PATH_MAX 1024 /* include/linux/limits.h */ +#define MAX_LINK_COUNT 5 /* number of symbolic links to follow */ + +/* check filesystem types and read superblock into memory buffer */ +int +minix_mount (void) +{ + if (((current_drive & 0x80) || current_slice != 0) + && ! IS_PC_SLICE_TYPE_MINIX (current_slice) + && ! IS_PC_SLICE_TYPE_BSD_WITH_FS (current_slice, FS_OTHER)) + return 0; /* The partition is not of MINIX type */ + + if (part_length < (SBLOCK + + (sizeof (struct minix_super_block) / DEV_BSIZE))) + return 0; /* The partition is too short */ + + if (!devread (SBLOCK, 0, sizeof (struct minix_super_block), + (char *) SUPERBLOCK)) + return 0; /* Cannot read superblock */ + + switch (SUPERBLOCK->s_magic) + { + case MINIX_SUPER_MAGIC: + namelen = 14; + break; + case MINIX_SUPER_MAGIC2: + namelen = 30; + break; + default: + return 0; /* Unsupported type */ + } + + return 1; +} + +/* Takes a file system block number and reads it into BUFFER. */ +static int +minix_rdfsb (int fsblock, int buffer) +{ + return devread (fsblock * (BLOCK_SIZE / DEV_BSIZE), 0, + BLOCK_SIZE, (char *) buffer); +} + +/* Maps LOGICAL_BLOCK (the file offset divided by the blocksize) into + a physical block (the location in the file system) via an inode. */ +static int +minix_block_map (int logical_block) +{ + int i; + + if (logical_block < 7) + return INODE->i_zone[logical_block]; + + logical_block -= 7; + if (logical_block < 512) + { + i = INODE->i_zone[7]; + + if (!i || ((mapblock1 != 1) + && !minix_rdfsb (i, DATABLOCK1))) + { + errnum = ERR_FSYS_CORRUPT; + return -1; + } + mapblock1 = 1; + return ((__u16 *) DATABLOCK1) [logical_block]; + } + + logical_block -= 512; + i = INODE->i_zone[8]; + if (!i || ((mapblock1 != 2) + && !minix_rdfsb (i, DATABLOCK1))) + { + errnum = ERR_FSYS_CORRUPT; + return -1; + } + mapblock1 = 2; + i = ((__u16 *) DATABLOCK1)[logical_block >> 9]; + if (!i || ((mapblock2 != i) + && !minix_rdfsb (i, DATABLOCK2))) + { + errnum = ERR_FSYS_CORRUPT; + return -1; + } + mapblock2 = i; + return ((__u16 *) DATABLOCK2)[logical_block & 511]; +} + +/* read from INODE into BUF */ +int +minix_read (char *buf, int len) +{ + int logical_block; + int offset; + int map; + int ret = 0; + int size = 0; + + while (len > 0) + { + /* find the (logical) block component of our location */ + logical_block = filepos >> BLOCK_SIZE_BITS; + offset = filepos & (BLOCK_SIZE - 1); + map = minix_block_map (logical_block); +#ifdef DEBUG_MINIX + printf ("map=%d\n", map); +#endif + if (map < 0) + break; + + size = BLOCK_SIZE; + size -= offset; + if (size > len) + size = len; + + disk_read_func = disk_read_hook; + + devread (map * (BLOCK_SIZE / DEV_BSIZE), + offset, size, buf); + + disk_read_func = NULL; + + buf += size; + len -= size; + filepos += size; + ret += size; + } + + if (errnum) + ret = 0; + + return ret; +} + +/* preconditions: minix_mount already executed, therefore supblk in buffer + known as SUPERBLOCK + returns: 0 if error, nonzero iff we were able to find the file successfully + postconditions: on a nonzero return, buffer known as INODE contains the + inode of the file we were trying to look up + side effects: none yet */ +int +minix_dir (char *dirname) +{ + int current_ino = MINIX_ROOT_INO; /* start at the root */ + int updir_ino = current_ino; /* the parent of the current directory */ + int ino_blk; /* fs pointer of the inode's info */ + + int str_chk = 0; /* used ot hold the results of a string + compare */ + + struct minix_inode * raw_inode; /* inode info for current_ino */ + + char linkbuf[PATH_MAX]; /* buffer for following sym-links */ + int link_count = 0; + + char * rest; + char ch; + + int off; /* offset within block of directory + entry */ + int loc; /* location within a directory */ + int blk; /* which data blk within dir entry */ + long map; /* fs pointer of a particular block from + dir entry */ + struct minix_dir_entry * dp; /* pointer to directory entry */ + + /* loop invariants: + current_ino = inode to lookup + dirname = pointer to filename component we are cur looking up within + the directory known pointed to by current_ino (if any) */ + +#ifdef DEBUG_MINIX + printf ("\n"); +#endif + + while (1) + { +#ifdef DEBUG_MINIX + printf ("inode %d, dirname %s\n", current_ino, dirname); +#endif + + ino_blk = (2 + SUPERBLOCK->s_imap_blocks + SUPERBLOCK->s_zmap_blocks + + (current_ino - 1) / MINIX_INODES_PER_BLOCK); + if (! minix_rdfsb (ino_blk, (int) INODE)) + return 0; + + /* reset indirect blocks! */ + mapblock2 = mapblock1 = -1; + + raw_inode = INODE + ((current_ino - 1) % MINIX_INODES_PER_BLOCK); + + /* copy inode to fixed location */ + memmove ((void *) INODE, (void *) raw_inode, + sizeof (struct minix_inode)); + + /* If we've got a symbolic link, then chase it. */ + if (S_ISLNK (INODE->i_mode)) + { + int len; + + if (++link_count > MAX_LINK_COUNT) + { + errnum = ERR_SYMLINK_LOOP; + return 0; + } +#ifdef DEBUG_MINIX + printf ("S_ISLNK (%s)\n", dirname); +#endif + + /* Find out how long our remaining name is. */ + len = 0; + while (dirname[len] && !isspace (dirname[len])) + len++; + + /* Get the symlink size. */ + filemax = (INODE->i_size); + if (filemax + len > sizeof (linkbuf) - 2) + { + errnum = ERR_FILELENGTH; + return 0; + } + + if (len) + { + /* Copy the remaining name to the end of the symlink data. + Note that DIRNAME and LINKBUF may overlap! */ + memmove (linkbuf + filemax, dirname, len); + } + linkbuf[filemax + len] = '\0'; + + /* Read the necessary blocks, and reset the file pointer. */ + len = grub_read (linkbuf, filemax); + filepos = 0; + if (!len) + return 0; + +#ifdef DEBUG_MINIX + printf ("symlink=%s\n", linkbuf); +#endif + + dirname = linkbuf; + if (*dirname == '/') + { + /* It's an absolute link, so look it up in root. */ + current_ino = MINIX_ROOT_INO; + updir_ino = current_ino; + } + else + { + /* Relative, so look it up in our parent directory. */ + current_ino = updir_ino; + } + + /* Try again using the new name. */ + continue; + } + + /* If end of filename, INODE points to the file's inode */ + if (!*dirname || isspace (*dirname)) + { + if (!S_ISREG (INODE->i_mode)) + { + errnum = ERR_BAD_FILETYPE; + return 0; + } + + filemax = (INODE->i_size); + return 1; + } + + /* else we have to traverse a directory */ + updir_ino = current_ino; + + /* skip over slashes */ + while (*dirname == '/') + dirname++; + + /* if this isn't a directory of sufficient size to hold our file, + abort */ + if (!(INODE->i_size) || !S_ISDIR (INODE->i_mode)) + { + errnum = ERR_BAD_FILETYPE; + return 0; + } + + /* skip to next slash or end of filename (space) */ + for (rest = dirname; (ch = *rest) && !isspace (ch) && ch != '/'; + rest++); + + /* look through this directory and find the next filename component */ + /* invariant: rest points to slash after the next filename component */ + *rest = 0; + loc = 0; + + do + { +#ifdef DEBUG_MINIX + printf ("dirname=`%s', rest=`%s', loc=%d\n", dirname, rest, loc); +#endif + + /* if our location/byte offset into the directory exceeds the size, + give up */ + if (loc >= INODE->i_size) + { + if (print_possibilities < 0) + { +#if 0 + putchar ('\n'); +#endif + } + else + { + errnum = ERR_FILE_NOT_FOUND; + *rest = ch; + } + return (print_possibilities < 0); + } + + /* else, find the (logical) block component of our location */ + blk = loc >> BLOCK_SIZE_BITS; + + /* we know which logical block of the directory entry we are looking + for, now we have to translate that to the physical (fs) block on + the disk */ + map = minix_block_map (blk); +#ifdef DEBUG_MINIX + printf ("fs block=%d\n", map); +#endif + mapblock2 = -1; + if ((map < 0) || !minix_rdfsb (map, DATABLOCK2)) + { + errnum = ERR_FSYS_CORRUPT; + *rest = ch; + return 0; + } + off = loc & (BLOCK_SIZE - 1); + dp = (struct minix_dir_entry *) (DATABLOCK2 + off); + /* advance loc prematurely to next on-disk directory entry */ + loc += sizeof (dp->inode) + namelen; + + /* NOTE: minix filenames are NULL terminated if < NAMELEN + else exact */ + +#ifdef DEBUG_MINIX + printf ("directory entry ino=%d\n", dp->inode); + if (dp->inode) + printf ("entry=%s\n", dp->name); +#endif + + if (dp->inode) + { + int saved_c = dp->name[namelen]; + + dp->name[namelen] = 0; + str_chk = substring (dirname, dp->name); + +# ifndef STAGE1_5 + if (print_possibilities && ch != '/' + && (!*dirname || str_chk <= 0)) + { + if (print_possibilities > 0) + print_possibilities = -print_possibilities; + print_a_completion (dp->name); + } +# endif + + dp->name[namelen] = saved_c; + } + + } + while (!dp->inode || (str_chk || (print_possibilities && ch != '/'))); + + current_ino = dp->inode; + *(dirname = rest) = ch; + } + /* never get here */ +} + +#endif /* FSYS_MINIX */ diff --git a/usr/src/grub/grub-0.97/stage2/fsys_reiserfs.c b/usr/src/grub/grub-0.97/stage2/fsys_reiserfs.c new file mode 100644 index 0000000000..d07ab2f675 --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/fsys_reiserfs.c @@ -0,0 +1,1239 @@ +/* fsys_reiserfs.c - an implementation for the ReiserFS filesystem */ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2000, 2001 Free Software Foundation, 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 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. + */ + +#ifdef FSYS_REISERFS +#include "shared.h" +#include "filesys.h" + +#undef REISERDEBUG + +/* Some parts of this code (mainly the structures and defines) are + * from the original reiser fs code, as found in the linux kernel. + */ + +/* include/asm-i386/types.h */ +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 unsigned long long __u64; + +/* linux/posix_type.h */ +typedef long linux_off_t; + +/* linux/little_endian.h */ +#define __cpu_to_le64(x) ((__u64) (x)) +#define __le64_to_cpu(x) ((__u64) (x)) +#define __cpu_to_le32(x) ((__u32) (x)) +#define __le32_to_cpu(x) ((__u32) (x)) +#define __cpu_to_le16(x) ((__u16) (x)) +#define __le16_to_cpu(x) ((__u16) (x)) + +/* include/linux/reiser_fs.h */ +/* This is the new super block of a journaling reiserfs system */ +struct reiserfs_super_block +{ + __u32 s_block_count; /* blocks count */ + __u32 s_free_blocks; /* free blocks count */ + __u32 s_root_block; /* root block number */ + __u32 s_journal_block; /* journal block number */ + __u32 s_journal_dev; /* journal device number */ + __u32 s_journal_size; /* size of the journal on FS creation. used to make sure they don't overflow it */ + __u32 s_journal_trans_max; /* max number of blocks in a transaction. */ + __u32 s_journal_magic; /* random value made on fs creation */ + __u32 s_journal_max_batch; /* max number of blocks to batch into a trans */ + __u32 s_journal_max_commit_age; /* in seconds, how old can an async commit be */ + __u32 s_journal_max_trans_age; /* in seconds, how old can a transaction be */ + __u16 s_blocksize; /* block size */ + __u16 s_oid_maxsize; /* max size of object id array */ + __u16 s_oid_cursize; /* current size of object id array */ + __u16 s_state; /* valid or error */ + char s_magic[16]; /* reiserfs magic string indicates that file system is reiserfs */ + __u16 s_tree_height; /* height of disk tree */ + __u16 s_bmap_nr; /* amount of bitmap blocks needed to address each block of file system */ + __u16 s_version; + char s_unused[128]; /* zero filled by mkreiserfs */ +}; + +#define REISERFS_MAX_SUPPORTED_VERSION 2 +#define REISERFS_SUPER_MAGIC_STRING "ReIsErFs" +#define REISER2FS_SUPER_MAGIC_STRING "ReIsEr2Fs" +#define REISER3FS_SUPER_MAGIC_STRING "ReIsEr3Fs" + +#define MAX_HEIGHT 7 + +/* must be correct to keep the desc and commit structs at 4k */ +#define JOURNAL_TRANS_HALF 1018 + +/* first block written in a commit. */ +struct reiserfs_journal_desc { + __u32 j_trans_id; /* id of commit */ + __u32 j_len; /* length of commit. len +1 is the commit block */ + __u32 j_mount_id; /* mount id of this trans*/ + __u32 j_realblock[JOURNAL_TRANS_HALF]; /* real locations for the first blocks */ + char j_magic[12]; +}; + +/* last block written in a commit */ +struct reiserfs_journal_commit { + __u32 j_trans_id; /* must match j_trans_id from the desc block */ + __u32 j_len; /* ditto */ + __u32 j_realblock[JOURNAL_TRANS_HALF]; /* real locations for the last blocks */ + char j_digest[16]; /* md5 sum of all the blocks involved, including desc and commit. not used, kill it */ +}; + +/* this header block gets written whenever a transaction is considered + fully flushed, and is more recent than the last fully flushed + transaction. + fully flushed means all the log blocks and all the real blocks are + on disk, and this transaction does not need to be replayed. +*/ +struct reiserfs_journal_header { + /* id of last fully flushed transaction */ + __u32 j_last_flush_trans_id; + /* offset in the log of where to start replay after a crash */ + __u32 j_first_unflushed_offset; + /* mount id to detect very old transactions */ + __u32 j_mount_id; +}; + +/* magic string to find desc blocks in the journal */ +#define JOURNAL_DESC_MAGIC "ReIsErLB" + + +/* + * directories use this key as well as old files + */ +struct offset_v1 +{ + /* + * for regular files this is the offset to the first byte of the + * body, contained in the object-item, as measured from the start of + * the entire body of the object. + * + * for directory entries, k_offset consists of hash derived from + * hashing the name and using few bits (23 or more) of the resulting + * hash, and generation number that allows distinguishing names with + * hash collisions. If number of collisions overflows generation + * number, we return EEXIST. High order bit is 0 always + */ + __u32 k_offset; + __u32 k_uniqueness; +}; + +struct offset_v2 +{ + /* + * for regular files this is the offset to the first byte of the + * body, contained in the object-item, as measured from the start of + * the entire body of the object. + * + * for directory entries, k_offset consists of hash derived from + * hashing the name and using few bits (23 or more) of the resulting + * hash, and generation number that allows distinguishing names with + * hash collisions. If number of collisions overflows generation + * number, we return EEXIST. High order bit is 0 always + */ + __u64 k_offset:60; + __u64 k_type: 4; +}; + + +struct key +{ + /* packing locality: by default parent directory object id */ + __u32 k_dir_id; + /* object identifier */ + __u32 k_objectid; + /* the offset and node type (old and new form) */ + union + { + struct offset_v1 v1; + struct offset_v2 v2; + } + u; +}; + +#define KEY_SIZE (sizeof (struct key)) + +/* Header of a disk block. More precisely, header of a formatted leaf + or internal node, and not the header of an unformatted node. */ +struct block_head +{ + __u16 blk_level; /* Level of a block in the tree. */ + __u16 blk_nr_item; /* Number of keys/items in a block. */ + __u16 blk_free_space; /* Block free space in bytes. */ + struct key blk_right_delim_key; /* Right delimiting key for this block (supported for leaf level nodes + only) */ +}; +#define BLKH_SIZE (sizeof (struct block_head)) +#define DISK_LEAF_NODE_LEVEL 1 /* Leaf node level. */ + +struct item_head +{ + struct key ih_key; /* Everything in the tree is found by searching for it based on its key.*/ + + union + { + __u16 ih_free_space; /* The free space in the last unformatted node of an indirect item if this + is an indirect item. This equals 0xFFFF iff this is a direct item or + stat data item. Note that the key, not this field, is used to determine + the item type, and thus which field this union contains. */ + __u16 ih_entry_count; /* Iff this is a directory item, this field equals the number of directory + entries in the directory item. */ + } + u; + __u16 ih_item_len; /* total size of the item body */ + __u16 ih_item_location; /* an offset to the item body within the block */ + __u16 ih_version; /* ITEM_VERSION_1 for all old items, + ITEM_VERSION_2 for new ones. + Highest bit is set by fsck + temporary, cleaned after all done */ +}; +/* size of item header */ +#define IH_SIZE (sizeof (struct item_head)) + +#define ITEM_VERSION_1 0 +#define ITEM_VERSION_2 1 +#define IH_KEY_OFFSET(ih) ((ih)->ih_version == ITEM_VERSION_1 \ + ? (ih)->ih_key.u.v1.k_offset \ + : (ih)->ih_key.u.v2.k_offset) + +#define IH_KEY_ISTYPE(ih, type) ((ih)->ih_version == ITEM_VERSION_1 \ + ? (ih)->ih_key.u.v1.k_uniqueness == V1_##type \ + : (ih)->ih_key.u.v2.k_type == V2_##type) + +struct disk_child +{ + unsigned long dc_block_number; /* Disk child's block number. */ + unsigned short dc_size; /* Disk child's used space. */ +}; + +#define DC_SIZE (sizeof (struct disk_child)) + +/* Stat Data on disk. + * + * Note that reiserfs has two different forms of stat data. Luckily + * the fields needed by grub are at the same position. + */ +struct stat_data +{ + __u16 sd_mode; /* file type, permissions */ + __u16 sd_notused1[3]; /* fields not needed by reiserfs */ + __u32 sd_size; /* file size */ + __u32 sd_size_hi; /* file size high 32 bits (since version 2) */ +}; + +struct reiserfs_de_head +{ + __u32 deh_offset; /* third component of the directory entry key */ + __u32 deh_dir_id; /* objectid of the parent directory of the + object, that is referenced by directory entry */ + __u32 deh_objectid;/* objectid of the object, that is referenced by + directory entry */ + __u16 deh_location;/* offset of name in the whole item */ + __u16 deh_state; /* whether 1) entry contains stat data (for + future), and 2) whether entry is hidden + (unlinked) */ +}; + +#define DEH_SIZE (sizeof (struct reiserfs_de_head)) + +#define DEH_Statdata (1 << 0) /* not used now */ +#define DEH_Visible (1 << 2) + +#define SD_OFFSET 0 +#define SD_UNIQUENESS 0 +#define DOT_OFFSET 1 +#define DOT_DOT_OFFSET 2 +#define DIRENTRY_UNIQUENESS 500 + +#define V1_TYPE_STAT_DATA 0x0 +#define V1_TYPE_DIRECT 0xffffffff +#define V1_TYPE_INDIRECT 0xfffffffe +#define V1_TYPE_DIRECTORY_MAX 0xfffffffd +#define V2_TYPE_STAT_DATA 0 +#define V2_TYPE_INDIRECT 1 +#define V2_TYPE_DIRECT 2 +#define V2_TYPE_DIRENTRY 3 + +#define REISERFS_ROOT_OBJECTID 2 +#define REISERFS_ROOT_PARENT_OBJECTID 1 +#define REISERFS_DISK_OFFSET_IN_BYTES (64 * 1024) +/* the spot for the super in versions 3.5 - 3.5.11 (inclusive) */ +#define REISERFS_OLD_DISK_OFFSET_IN_BYTES (8 * 1024) +#define REISERFS_OLD_BLOCKSIZE 4096 + +#define S_ISREG(mode) (((mode) & 0170000) == 0100000) +#define S_ISDIR(mode) (((mode) & 0170000) == 0040000) +#define S_ISLNK(mode) (((mode) & 0170000) == 0120000) + +#define PATH_MAX 1024 /* include/linux/limits.h */ +#define MAX_LINK_COUNT 5 /* number of symbolic links to follow */ + +/* The size of the node cache */ +#define FSYSREISER_CACHE_SIZE 24*1024 +#define FSYSREISER_MIN_BLOCKSIZE SECTOR_SIZE +#define FSYSREISER_MAX_BLOCKSIZE FSYSREISER_CACHE_SIZE / 3 + +/* Info about currently opened file */ +struct fsys_reiser_fileinfo +{ + __u32 k_dir_id; + __u32 k_objectid; +}; + +/* In memory info about the currently mounted filesystem */ +struct fsys_reiser_info +{ + /* The last read item head */ + struct item_head *current_ih; + /* The last read item */ + char *current_item; + /* The information for the currently opened file */ + struct fsys_reiser_fileinfo fileinfo; + /* The start of the journal */ + __u32 journal_block; + /* The size of the journal */ + __u32 journal_block_count; + /* The first valid descriptor block in journal + (relative to journal_block) */ + __u32 journal_first_desc; + + /* The ReiserFS version. */ + __u16 version; + /* The current depth of the reiser tree. */ + __u16 tree_depth; + /* SECTOR_SIZE << blocksize_shift == blocksize. */ + __u8 blocksize_shift; + /* 1 << full_blocksize_shift == blocksize. */ + __u8 fullblocksize_shift; + /* The reiserfs block size (must be a power of 2) */ + __u16 blocksize; + /* The number of cached tree nodes */ + __u16 cached_slots; + /* The number of valid transactions in journal */ + __u16 journal_transactions; + + unsigned int blocks[MAX_HEIGHT]; + unsigned int next_key_nr[MAX_HEIGHT]; +}; + +/* The cached s+tree blocks in FSYS_BUF, see below + * for a more detailed description. + */ +#define ROOT ((char *) ((int) FSYS_BUF)) +#define CACHE(i) (ROOT + ((i) << INFO->fullblocksize_shift)) +#define LEAF CACHE (DISK_LEAF_NODE_LEVEL) + +#define BLOCKHEAD(cache) ((struct block_head *) cache) +#define ITEMHEAD ((struct item_head *) ((int) LEAF + BLKH_SIZE)) +#define KEY(cache) ((struct key *) ((int) cache + BLKH_SIZE)) +#define DC(cache) ((struct disk_child *) \ + ((int) cache + BLKH_SIZE + KEY_SIZE * nr_item)) +/* The fsys_reiser_info block. + */ +#define INFO \ + ((struct fsys_reiser_info *) ((int) FSYS_BUF + FSYSREISER_CACHE_SIZE)) +/* + * The journal cache. For each transaction it contains the number of + * blocks followed by the real block numbers of this transaction. + * + * If the block numbers of some transaction won't fit in this space, + * this list is stopped with a 0xffffffff marker and the remaining + * uncommitted transactions aren't cached. + */ +#define JOURNAL_START ((__u32 *) (INFO + 1)) +#define JOURNAL_END ((__u32 *) (FSYS_BUF + FSYS_BUFLEN)) + + +static __inline__ unsigned long +grub_log2 (unsigned long word) +{ + __asm__ ("bsfl %1,%0" + : "=r" (word) + : "r" (word)); + return word; +} +#define log2 grub_log2 + +static __inline__ int +is_power_of_two (unsigned long word) +{ + return (word & -word) == word; +} + +static int +journal_read (int block, int len, char *buffer) +{ + return devread ((INFO->journal_block + block) << INFO->blocksize_shift, + 0, len, buffer); +} + +/* Read a block from ReiserFS file system, taking the journal into + * account. If the block nr is in the journal, the block from the + * journal taken. + */ +static int +block_read (int blockNr, int start, int len, char *buffer) +{ + int transactions = INFO->journal_transactions; + int desc_block = INFO->journal_first_desc; + int journal_mask = INFO->journal_block_count - 1; + int translatedNr = blockNr; + __u32 *journal_table = JOURNAL_START; + while (transactions-- > 0) + { + int i = 0; + int j_len; + if (*journal_table != 0xffffffff) + { + /* Search for the blockNr in cached journal */ + j_len = *journal_table++; + while (i++ < j_len) + { + if (*journal_table++ == blockNr) + { + journal_table += j_len - i; + goto found; + } + } + } + else + { + /* This is the end of cached journal marker. The remaining + * transactions are still on disk. + */ + struct reiserfs_journal_desc desc; + struct reiserfs_journal_commit commit; + + if (! journal_read (desc_block, sizeof (desc), (char *) &desc)) + return 0; + + j_len = desc.j_len; + while (i < j_len && i < JOURNAL_TRANS_HALF) + if (desc.j_realblock[i++] == blockNr) + goto found; + + if (j_len >= JOURNAL_TRANS_HALF) + { + int commit_block = (desc_block + 1 + j_len) & journal_mask; + if (! journal_read (commit_block, + sizeof (commit), (char *) &commit)) + return 0; + while (i < j_len) + if (commit.j_realblock[i++ - JOURNAL_TRANS_HALF] == blockNr) + goto found; + } + } + goto not_found; + + found: + translatedNr = INFO->journal_block + ((desc_block + i) & journal_mask); +#ifdef REISERDEBUG + printf ("block_read: block %d is mapped to journal block %d.\n", + blockNr, translatedNr - INFO->journal_block); +#endif + /* We must continue the search, as this block may be overwritten + * in later transactions. + */ + not_found: + desc_block = (desc_block + 2 + j_len) & journal_mask; + } + return devread (translatedNr << INFO->blocksize_shift, start, len, buffer); +} + +/* Init the journal data structure. We try to cache as much as + * possible in the JOURNAL_START-JOURNAL_END space, but if it is full + * we can still read the rest from the disk on demand. + * + * The first number of valid transactions and the descriptor block of the + * first valid transaction are held in INFO. The transactions are all + * adjacent, but we must take care of the journal wrap around. + */ +static int +journal_init (void) +{ + unsigned int block_count = INFO->journal_block_count; + unsigned int desc_block; + unsigned int commit_block; + unsigned int next_trans_id; + struct reiserfs_journal_header header; + struct reiserfs_journal_desc desc; + struct reiserfs_journal_commit commit; + __u32 *journal_table = JOURNAL_START; + + journal_read (block_count, sizeof (header), (char *) &header); + desc_block = header.j_first_unflushed_offset; + if (desc_block >= block_count) + return 0; + + INFO->journal_first_desc = desc_block; + next_trans_id = header.j_last_flush_trans_id + 1; + +#ifdef REISERDEBUG + printf ("journal_init: last flushed %d\n", + header.j_last_flush_trans_id); +#endif + + while (1) + { + journal_read (desc_block, sizeof (desc), (char *) &desc); + if (substring (JOURNAL_DESC_MAGIC, desc.j_magic) > 0 + || desc.j_trans_id != next_trans_id + || desc.j_mount_id != header.j_mount_id) + /* no more valid transactions */ + break; + + commit_block = (desc_block + desc.j_len + 1) & (block_count - 1); + journal_read (commit_block, sizeof (commit), (char *) &commit); + if (desc.j_trans_id != commit.j_trans_id + || desc.j_len != commit.j_len) + /* no more valid transactions */ + break; + +#ifdef REISERDEBUG + printf ("Found valid transaction %d/%d at %d.\n", + desc.j_trans_id, desc.j_mount_id, desc_block); +#endif + + next_trans_id++; + if (journal_table < JOURNAL_END) + { + if ((journal_table + 1 + desc.j_len) >= JOURNAL_END) + { + /* The table is almost full; mark the end of the cached + * journal.*/ + *journal_table = 0xffffffff; + journal_table = JOURNAL_END; + } + else + { + int i; + /* Cache the length and the realblock numbers in the table. + * The block number of descriptor can easily be computed. + * and need not to be stored here. + */ + *journal_table++ = desc.j_len; + for (i = 0; i < desc.j_len && i < JOURNAL_TRANS_HALF; i++) + { + *journal_table++ = desc.j_realblock[i]; +#ifdef REISERDEBUG + printf ("block %d is in journal %d.\n", + desc.j_realblock[i], desc_block); +#endif + } + for ( ; i < desc.j_len; i++) + { + *journal_table++ = commit.j_realblock[i-JOURNAL_TRANS_HALF]; +#ifdef REISERDEBUG + printf ("block %d is in journal %d.\n", + commit.j_realblock[i-JOURNAL_TRANS_HALF], + desc_block); +#endif + } + } + } + desc_block = (commit_block + 1) & (block_count - 1); + } +#ifdef REISERDEBUG + printf ("Transaction %d/%d at %d isn't valid.\n", + desc.j_trans_id, desc.j_mount_id, desc_block); +#endif + + INFO->journal_transactions + = next_trans_id - header.j_last_flush_trans_id - 1; + return errnum == 0; +} + +/* check filesystem types and read superblock into memory buffer */ +int +reiserfs_mount (void) +{ + struct reiserfs_super_block super; + int superblock = REISERFS_DISK_OFFSET_IN_BYTES >> SECTOR_BITS; + + if (part_length < superblock + (sizeof (super) >> SECTOR_BITS) + || ! devread (superblock, 0, sizeof (struct reiserfs_super_block), + (char *) &super) + || (substring (REISER3FS_SUPER_MAGIC_STRING, super.s_magic) > 0 + && substring (REISER2FS_SUPER_MAGIC_STRING, super.s_magic) > 0 + && substring (REISERFS_SUPER_MAGIC_STRING, super.s_magic) > 0) + || (/* check that this is not a copy inside the journal log */ + super.s_journal_block * super.s_blocksize + <= REISERFS_DISK_OFFSET_IN_BYTES)) + { + /* Try old super block position */ + superblock = REISERFS_OLD_DISK_OFFSET_IN_BYTES >> SECTOR_BITS; + if (part_length < superblock + (sizeof (super) >> SECTOR_BITS) + || ! devread (superblock, 0, sizeof (struct reiserfs_super_block), + (char *) &super)) + return 0; + + if (substring (REISER3FS_SUPER_MAGIC_STRING, super.s_magic) > 0 + && substring (REISER2FS_SUPER_MAGIC_STRING, super.s_magic) > 0 + && substring (REISERFS_SUPER_MAGIC_STRING, super.s_magic) > 0) + { + /* pre journaling super block ? */ + if (substring (REISERFS_SUPER_MAGIC_STRING, + (char*) ((int) &super + 20)) > 0) + return 0; + + super.s_blocksize = REISERFS_OLD_BLOCKSIZE; + super.s_journal_block = 0; + super.s_version = 0; + } + } + + /* check the version number. */ + if (super.s_version > REISERFS_MAX_SUPPORTED_VERSION) + return 0; + + INFO->version = super.s_version; + INFO->blocksize = super.s_blocksize; + INFO->fullblocksize_shift = log2 (super.s_blocksize); + INFO->blocksize_shift = INFO->fullblocksize_shift - SECTOR_BITS; + INFO->cached_slots = + (FSYSREISER_CACHE_SIZE >> INFO->fullblocksize_shift) - 1; + +#ifdef REISERDEBUG + printf ("reiserfs_mount: version=%d, blocksize=%d\n", + INFO->version, INFO->blocksize); +#endif /* REISERDEBUG */ + + /* Clear node cache. */ + memset (INFO->blocks, 0, sizeof (INFO->blocks)); + + if (super.s_blocksize < FSYSREISER_MIN_BLOCKSIZE + || super.s_blocksize > FSYSREISER_MAX_BLOCKSIZE + || (SECTOR_SIZE << INFO->blocksize_shift) != super.s_blocksize) + return 0; + + /* Initialize journal code. If something fails we end with zero + * journal_transactions, so we don't access the journal at all. + */ + INFO->journal_transactions = 0; + if (super.s_journal_block != 0 && super.s_journal_dev == 0) + { + INFO->journal_block = super.s_journal_block; + INFO->journal_block_count = super.s_journal_size; + if (is_power_of_two (INFO->journal_block_count)) + journal_init (); + + /* Read in super block again, maybe it is in the journal */ + block_read (superblock >> INFO->blocksize_shift, + 0, sizeof (struct reiserfs_super_block), (char *) &super); + } + + if (! block_read (super.s_root_block, 0, INFO->blocksize, (char*) ROOT)) + return 0; + + INFO->tree_depth = BLOCKHEAD (ROOT)->blk_level; + +#ifdef REISERDEBUG + printf ("root read_in: block=%d, depth=%d\n", + super.s_root_block, INFO->tree_depth); +#endif /* REISERDEBUG */ + + if (INFO->tree_depth >= MAX_HEIGHT) + return 0; + if (INFO->tree_depth == DISK_LEAF_NODE_LEVEL) + { + /* There is only one node in the whole filesystem, + * which is simultanously leaf and root */ + memcpy (LEAF, ROOT, INFO->blocksize); + } + return 1; +} + +/***************** TREE ACCESSING METHODS *****************************/ + +/* I assume you are familiar with the ReiserFS tree, if not go to + * http://www.namesys.com/content_table.html + * + * My tree node cache is organized as following + * 0 ROOT node + * 1 LEAF node (if the ROOT is also a LEAF it is copied here + * 2-n other nodes on current path from bottom to top. + * if there is not enough space in the cache, the top most are + * omitted. + * + * I have only two methods to find a key in the tree: + * search_stat(dir_id, objectid) searches for the stat entry (always + * the first entry) of an object. + * next_key() gets the next key in tree order. + * + * This means, that I can only sequential reads of files are + * efficient, but this really doesn't hurt for grub. + */ + +/* Read in the node at the current path and depth into the node cache. + * You must set INFO->blocks[depth] before. + */ +static char * +read_tree_node (unsigned int blockNr, int depth) +{ + char* cache = CACHE(depth); + int num_cached = INFO->cached_slots; + if (depth < num_cached) + { + /* This is the cached part of the path. Check if same block is + * needed. + */ + if (blockNr == INFO->blocks[depth]) + return cache; + } + else + cache = CACHE(num_cached); + +#ifdef REISERDEBUG + printf (" next read_in: block=%d (depth=%d)\n", + blockNr, depth); +#endif /* REISERDEBUG */ + if (! block_read (blockNr, 0, INFO->blocksize, cache)) + return 0; + /* Make sure it has the right node level */ + if (BLOCKHEAD (cache)->blk_level != depth) + { + errnum = ERR_FSYS_CORRUPT; + return 0; + } + + INFO->blocks[depth] = blockNr; + return cache; +} + +/* Get the next key, i.e. the key following the last retrieved key in + * tree order. INFO->current_ih and + * INFO->current_info are adapted accordingly. */ +static int +next_key (void) +{ + int depth; + struct item_head *ih = INFO->current_ih + 1; + char *cache; + +#ifdef REISERDEBUG + printf ("next_key:\n old ih: key %d:%d:%d:%d version:%d\n", + INFO->current_ih->ih_key.k_dir_id, + INFO->current_ih->ih_key.k_objectid, + INFO->current_ih->ih_key.u.v1.k_offset, + INFO->current_ih->ih_key.u.v1.k_uniqueness, + INFO->current_ih->ih_version); +#endif /* REISERDEBUG */ + + if (ih == &ITEMHEAD[BLOCKHEAD (LEAF)->blk_nr_item]) + { + depth = DISK_LEAF_NODE_LEVEL; + /* The last item, was the last in the leaf node. + * Read in the next block + */ + do + { + if (depth == INFO->tree_depth) + { + /* There are no more keys at all. + * Return a dummy item with MAX_KEY */ + ih = (struct item_head *) &BLOCKHEAD (LEAF)->blk_right_delim_key; + goto found; + } + depth++; +#ifdef REISERDEBUG + printf (" depth=%d, i=%d\n", depth, INFO->next_key_nr[depth]); +#endif /* REISERDEBUG */ + } + while (INFO->next_key_nr[depth] == 0); + + if (depth == INFO->tree_depth) + cache = ROOT; + else if (depth <= INFO->cached_slots) + cache = CACHE (depth); + else + { + cache = read_tree_node (INFO->blocks[depth], depth); + if (! cache) + return 0; + } + + do + { + int nr_item = BLOCKHEAD (cache)->blk_nr_item; + int key_nr = INFO->next_key_nr[depth]++; +#ifdef REISERDEBUG + printf (" depth=%d, i=%d/%d\n", depth, key_nr, nr_item); +#endif /* REISERDEBUG */ + if (key_nr == nr_item) + /* This is the last item in this block, set the next_key_nr to 0 */ + INFO->next_key_nr[depth] = 0; + + cache = read_tree_node (DC (cache)[key_nr].dc_block_number, --depth); + if (! cache) + return 0; + } + while (depth > DISK_LEAF_NODE_LEVEL); + + ih = ITEMHEAD; + } + found: + INFO->current_ih = ih; + INFO->current_item = &LEAF[ih->ih_item_location]; +#ifdef REISERDEBUG + printf (" new ih: key %d:%d:%d:%d version:%d\n", + INFO->current_ih->ih_key.k_dir_id, + INFO->current_ih->ih_key.k_objectid, + INFO->current_ih->ih_key.u.v1.k_offset, + INFO->current_ih->ih_key.u.v1.k_uniqueness, + INFO->current_ih->ih_version); +#endif /* REISERDEBUG */ + return 1; +} + +/* preconditions: reiserfs_mount already executed, therefore + * INFO block is valid + * returns: 0 if error (errnum is set), + * nonzero iff we were able to find the key successfully. + * postconditions: on a nonzero return, the current_ih and + * current_item fields describe the key that equals the + * searched key. INFO->next_key contains the next key after + * the searched key. + * side effects: messes around with the cache. + */ +static int +search_stat (__u32 dir_id, __u32 objectid) +{ + char *cache; + int depth; + int nr_item; + int i; + struct item_head *ih; +#ifdef REISERDEBUG + printf ("search_stat:\n key %d:%d:0:0\n", dir_id, objectid); +#endif /* REISERDEBUG */ + + depth = INFO->tree_depth; + cache = ROOT; + + while (depth > DISK_LEAF_NODE_LEVEL) + { + struct key *key; + nr_item = BLOCKHEAD (cache)->blk_nr_item; + + key = KEY (cache); + + for (i = 0; i < nr_item; i++) + { + if (key->k_dir_id > dir_id + || (key->k_dir_id == dir_id + && (key->k_objectid > objectid + || (key->k_objectid == objectid + && (key->u.v1.k_offset + | key->u.v1.k_uniqueness) > 0)))) + break; + key++; + } + +#ifdef REISERDEBUG + printf (" depth=%d, i=%d/%d\n", depth, i, nr_item); +#endif /* REISERDEBUG */ + INFO->next_key_nr[depth] = (i == nr_item) ? 0 : i+1; + cache = read_tree_node (DC (cache)[i].dc_block_number, --depth); + if (! cache) + return 0; + } + + /* cache == LEAF */ + nr_item = BLOCKHEAD (LEAF)->blk_nr_item; + ih = ITEMHEAD; + for (i = 0; i < nr_item; i++) + { + if (ih->ih_key.k_dir_id == dir_id + && ih->ih_key.k_objectid == objectid + && ih->ih_key.u.v1.k_offset == 0 + && ih->ih_key.u.v1.k_uniqueness == 0) + { +#ifdef REISERDEBUG + printf (" depth=%d, i=%d/%d\n", depth, i, nr_item); +#endif /* REISERDEBUG */ + INFO->current_ih = ih; + INFO->current_item = &LEAF[ih->ih_item_location]; + return 1; + } + ih++; + } + errnum = ERR_FSYS_CORRUPT; + return 0; +} + +int +reiserfs_read (char *buf, int len) +{ + unsigned int blocksize; + unsigned int offset; + unsigned int to_read; + char *prev_buf = buf; + +#ifdef REISERDEBUG + printf ("reiserfs_read: filepos=%d len=%d, offset=%x:%x\n", + filepos, len, (__u64) IH_KEY_OFFSET (INFO->current_ih) - 1); +#endif /* REISERDEBUG */ + + if (INFO->current_ih->ih_key.k_objectid != INFO->fileinfo.k_objectid + || IH_KEY_OFFSET (INFO->current_ih) > filepos + 1) + { + search_stat (INFO->fileinfo.k_dir_id, INFO->fileinfo.k_objectid); + goto get_next_key; + } + + while (! errnum) + { + if (INFO->current_ih->ih_key.k_objectid != INFO->fileinfo.k_objectid) + break; + + offset = filepos - IH_KEY_OFFSET (INFO->current_ih) + 1; + blocksize = INFO->current_ih->ih_item_len; + +#ifdef REISERDEBUG + printf (" loop: filepos=%d len=%d, offset=%d blocksize=%d\n", + filepos, len, offset, blocksize); +#endif /* REISERDEBUG */ + + if (IH_KEY_ISTYPE(INFO->current_ih, TYPE_DIRECT) + && offset < blocksize) + { +#ifdef REISERDEBUG + printf ("direct_read: offset=%d, blocksize=%d\n", + offset, blocksize); +#endif /* REISERDEBUG */ + to_read = blocksize - offset; + if (to_read > len) + to_read = len; + + if (disk_read_hook != NULL) + { + disk_read_func = disk_read_hook; + + block_read (INFO->blocks[DISK_LEAF_NODE_LEVEL], + (INFO->current_item - LEAF + offset), to_read, buf); + + disk_read_func = NULL; + } + else + memcpy (buf, INFO->current_item + offset, to_read); + goto update_buf_len; + } + else if (IH_KEY_ISTYPE(INFO->current_ih, TYPE_INDIRECT)) + { + blocksize = (blocksize >> 2) << INFO->fullblocksize_shift; +#ifdef REISERDEBUG + printf ("indirect_read: offset=%d, blocksize=%d\n", + offset, blocksize); +#endif /* REISERDEBUG */ + + while (offset < blocksize) + { + __u32 blocknr = ((__u32 *) INFO->current_item) + [offset >> INFO->fullblocksize_shift]; + int blk_offset = offset & (INFO->blocksize-1); + + to_read = INFO->blocksize - blk_offset; + if (to_read > len) + to_read = len; + + disk_read_func = disk_read_hook; + + /* Journal is only for meta data. Data blocks can be read + * directly without using block_read + */ + devread (blocknr << INFO->blocksize_shift, + blk_offset, to_read, buf); + + disk_read_func = NULL; + update_buf_len: + len -= to_read; + buf += to_read; + offset += to_read; + filepos += to_read; + if (len == 0) + goto done; + } + } + get_next_key: + next_key (); + } + done: + return errnum ? 0 : buf - prev_buf; +} + + +/* preconditions: reiserfs_mount already executed, therefore + * INFO block is valid + * returns: 0 if error, nonzero iff we were able to find the file successfully + * postconditions: on a nonzero return, INFO->fileinfo contains the info + * of the file we were trying to look up, filepos is 0 and filemax is + * the size of the file. + */ +int +reiserfs_dir (char *dirname) +{ + struct reiserfs_de_head *de_head; + char *rest, ch; + __u32 dir_id, objectid, parent_dir_id = 0, parent_objectid = 0; +#ifndef STAGE1_5 + int do_possibilities = 0; +#endif /* ! STAGE1_5 */ + char linkbuf[PATH_MAX]; /* buffer for following symbolic links */ + int link_count = 0; + int mode; + + dir_id = REISERFS_ROOT_PARENT_OBJECTID; + objectid = REISERFS_ROOT_OBJECTID; + + while (1) + { +#ifdef REISERDEBUG + printf ("dirname=%s\n", dirname); +#endif /* REISERDEBUG */ + + /* Search for the stat info first. */ + if (! search_stat (dir_id, objectid)) + return 0; + +#ifdef REISERDEBUG + printf ("sd_mode=%x sd_size=%d\n", + ((struct stat_data *) INFO->current_item)->sd_mode, + ((struct stat_data *) INFO->current_item)->sd_size); +#endif /* REISERDEBUG */ + + mode = ((struct stat_data *) INFO->current_item)->sd_mode; + + /* If we've got a symbolic link, then chase it. */ + if (S_ISLNK (mode)) + { + int len; + if (++link_count > MAX_LINK_COUNT) + { + errnum = ERR_SYMLINK_LOOP; + return 0; + } + + /* Get the symlink size. */ + filemax = ((struct stat_data *) INFO->current_item)->sd_size; + + /* Find out how long our remaining name is. */ + len = 0; + while (dirname[len] && !isspace (dirname[len])) + len++; + + if (filemax + len > sizeof (linkbuf) - 1) + { + errnum = ERR_FILELENGTH; + return 0; + } + + /* Copy the remaining name to the end of the symlink data. + Note that DIRNAME and LINKBUF may overlap! */ + grub_memmove (linkbuf + filemax, dirname, len+1); + + INFO->fileinfo.k_dir_id = dir_id; + INFO->fileinfo.k_objectid = objectid; + filepos = 0; + if (! next_key () + || reiserfs_read (linkbuf, filemax) != filemax) + { + if (! errnum) + errnum = ERR_FSYS_CORRUPT; + return 0; + } + +#ifdef REISERDEBUG + printf ("symlink=%s\n", linkbuf); +#endif /* REISERDEBUG */ + + dirname = linkbuf; + if (*dirname == '/') + { + /* It's an absolute link, so look it up in root. */ + dir_id = REISERFS_ROOT_PARENT_OBJECTID; + objectid = REISERFS_ROOT_OBJECTID; + } + else + { + /* Relative, so look it up in our parent directory. */ + dir_id = parent_dir_id; + objectid = parent_objectid; + } + + /* Now lookup the new name. */ + continue; + } + + /* if we have a real file (and we're not just printing possibilities), + then this is where we want to exit */ + + if (! *dirname || isspace (*dirname)) + { + if (! S_ISREG (mode)) + { + errnum = ERR_BAD_FILETYPE; + return 0; + } + + filepos = 0; + filemax = ((struct stat_data *) INFO->current_item)->sd_size; + + /* If this is a new stat data and size is > 4GB set filemax to + * maximum + */ + if (INFO->current_ih->ih_version == ITEM_VERSION_2 + && ((struct stat_data *) INFO->current_item)->sd_size_hi > 0) + filemax = 0xffffffff; + + INFO->fileinfo.k_dir_id = dir_id; + INFO->fileinfo.k_objectid = objectid; + return next_key (); + } + + /* continue with the file/directory name interpretation */ + while (*dirname == '/') + dirname++; + if (! S_ISDIR (mode)) + { + errnum = ERR_BAD_FILETYPE; + return 0; + } + for (rest = dirname; (ch = *rest) && ! isspace (ch) && ch != '/'; rest++); + *rest = 0; + +# ifndef STAGE1_5 + if (print_possibilities && ch != '/') + do_possibilities = 1; +# endif /* ! STAGE1_5 */ + + while (1) + { + char *name_end; + int num_entries; + + if (! next_key ()) + return 0; +#ifdef REISERDEBUG + printf ("ih: key %d:%d:%d:%d version:%d\n", + INFO->current_ih->ih_key.k_dir_id, + INFO->current_ih->ih_key.k_objectid, + INFO->current_ih->ih_key.u.v1.k_offset, + INFO->current_ih->ih_key.u.v1.k_uniqueness, + INFO->current_ih->ih_version); +#endif /* REISERDEBUG */ + + if (INFO->current_ih->ih_key.k_objectid != objectid) + break; + + name_end = INFO->current_item + INFO->current_ih->ih_item_len; + de_head = (struct reiserfs_de_head *) INFO->current_item; + num_entries = INFO->current_ih->u.ih_entry_count; + while (num_entries > 0) + { + char *filename = INFO->current_item + de_head->deh_location; + char tmp = *name_end; + if ((de_head->deh_state & DEH_Visible)) + { + int cmp; + /* Directory names in ReiserFS are not null + * terminated. We write a temporary 0 behind it. + * NOTE: that this may overwrite the first block in + * the tree cache. That doesn't hurt as long as we + * don't call next_key () in between. + */ + *name_end = 0; + cmp = substring (dirname, filename); + *name_end = tmp; +# ifndef STAGE1_5 + if (do_possibilities) + { + if (cmp <= 0) + { + if (print_possibilities > 0) + print_possibilities = -print_possibilities; + *name_end = 0; + print_a_completion (filename); + *name_end = tmp; + } + } + else +# endif /* ! STAGE1_5 */ + if (cmp == 0) + goto found; + } + /* The beginning of this name marks the end of the next name. + */ + name_end = filename; + de_head++; + num_entries--; + } + } + +# ifndef STAGE1_5 + if (print_possibilities < 0) + return 1; +# endif /* ! STAGE1_5 */ + + errnum = ERR_FILE_NOT_FOUND; + *rest = ch; + return 0; + + found: + + *rest = ch; + dirname = rest; + + parent_dir_id = dir_id; + parent_objectid = objectid; + dir_id = de_head->deh_dir_id; + objectid = de_head->deh_objectid; + } +} + +int +reiserfs_embed (int *start_sector, int needed_sectors) +{ + struct reiserfs_super_block super; + int num_sectors; + + if (! devread (REISERFS_DISK_OFFSET_IN_BYTES >> SECTOR_BITS, 0, + sizeof (struct reiserfs_super_block), (char *) &super)) + return 0; + + *start_sector = 1; /* reserve first sector for stage1 */ + if ((substring (REISERFS_SUPER_MAGIC_STRING, super.s_magic) <= 0 + || substring (REISER2FS_SUPER_MAGIC_STRING, super.s_magic) <= 0 + || substring (REISER3FS_SUPER_MAGIC_STRING, super.s_magic) <= 0) + && (/* check that this is not a super block copy inside + * the journal log */ + super.s_journal_block * super.s_blocksize + > REISERFS_DISK_OFFSET_IN_BYTES)) + num_sectors = (REISERFS_DISK_OFFSET_IN_BYTES >> SECTOR_BITS) - 1; + else + num_sectors = (REISERFS_OLD_DISK_OFFSET_IN_BYTES >> SECTOR_BITS) - 1; + + return (needed_sectors <= num_sectors); +} +#endif /* FSYS_REISERFS */ diff --git a/usr/src/grub/grub-0.97/stage2/fsys_ufs.c b/usr/src/grub/grub-0.97/stage2/fsys_ufs.c new file mode 100644 index 0000000000..88db5f392c --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/fsys_ufs.c @@ -0,0 +1,266 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2006 Free Software Foundation, 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 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. + */ +/* + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* From Solaris usr/src/stand/lib/fs/ufs/ufsops.c */ + +#ifdef FSYS_UFS + +#include "shared.h" +#include "filesys.h" + +#include "ufs.h" + +/* These are the pools of buffers, etc. */ + +#define SUPERBLOCK ((struct fs *)(FSYS_BUF + 0x2000)) +#define INODE ((struct icommon *)(FSYS_BUF + 0x1000)) +#define DIRENT (FSYS_BUF + 0x4000) +#define INDIRBLK1 ((grub_daddr32_t *)(FSYS_BUF + 0x4000)) /* 2+ indir blk */ +#define INDIRBLK0 ((grub_daddr32_t *)(FSYS_BUF+ 0x6000)) /* 1st indirect blk */ + +static int indirblk0, indirblk1; + +static int openi(grub_ino_t); +static grub_ino_t dlook(grub_ino_t, char *); +static grub_daddr32_t sbmap(grub_daddr32_t); + +/* read superblock and check fs magic */ +int +ufs_mount(void) +{ + if (! IS_PC_SLICE_TYPE_SOLARIS(current_slice) || + !devread(UFS_SBLOCK, 0, UFS_SBSIZE, (char *)SUPERBLOCK) || + SUPERBLOCK->fs_magic != UFS_MAGIC) + return 0; + + return 1; +} + + +/* + * searching for a file, if successful, inode will be loaded in INODE + * The entry point should really be named ufs_open(char *pathname). + * For now, keep it consistent with the rest of fsys modules. + */ +int +ufs_dir(char *dirname) +{ + grub_ino_t inode = ROOTINO; /* start from root */ + char *fname, ch; + + indirblk0 = indirblk1 = 0; + + /* skip leading slashes */ + while (*dirname == '/') + dirname++; + + while (inode && *dirname && !isspace(*dirname)) { + if (!openi(inode)) + return 0; + + /* parse for next path component */ + fname = dirname; + while (*dirname && !isspace(*dirname) && *dirname != '/') + dirname++; + ch = *dirname; + *dirname = 0; /* ensure null termination */ + + inode = dlook(inode, fname); + *dirname = ch; + while (*dirname == '/') + dirname++; + } + + /* return 1 only if inode exists and is a regular file */ + if (! openi(inode)) + return (0); + filepos = 0; + filemax = INODE->ic_sizelo; + return (inode && ((INODE->ic_smode & IFMT) == IFREG)); +} + +/* + * This is the high-level read function. + */ +int +ufs_read(char *buf, int len) +{ + int off, size, ret = 0, ok; + grub_daddr32_t lblk, dblk; + + while (len) { + off = blkoff(SUPERBLOCK, filepos); + lblk = lblkno(SUPERBLOCK, filepos); + size = SUPERBLOCK->fs_bsize; + size -= off; + if (size > len) + size = len; + + if ((dblk = sbmap(lblk)) <= 0) { + /* we are in a file hole, just zero the buf */ + grub_memset(buf, 0, size); + } else { + disk_read_func = disk_read_hook; + ok = devread(fsbtodb(SUPERBLOCK, dblk), off, size, buf); + disk_read_func = 0; + if (!ok) + return 0; + } + buf += size; + len -= size; + filepos += size; + ret += size; + } + + return (ret); +} + +int +ufs_embed (int *start_sector, int needed_sectors) +{ + if (needed_sectors > 14) + return 0; + + *start_sector = 2; + return 1; +} + +/* read inode and place content in INODE */ +static int +openi(grub_ino_t inode) +{ + grub_daddr32_t dblk; + int off; + + /* get block and byte offset into the block */ + dblk = fsbtodb(SUPERBLOCK, itod(SUPERBLOCK, inode)); + off = itoo(SUPERBLOCK, inode) * sizeof (struct icommon); + + return (devread(dblk, off, sizeof (struct icommon), (char *)INODE)); +} + +/* + * Performs fileblock mapping. Convert file block no. to disk block no. + * Returns 0 when block doesn't exist and <0 when block isn't initialized + * (i.e belongs to a hole in the file). + */ +grub_daddr32_t +sbmap(grub_daddr32_t bn) +{ + int level, bound, i, index; + grub_daddr32_t nb, blkno; + grub_daddr32_t *db = INODE->ic_db; + + /* blocks 0..UFS_NDADDR are direct blocks */ + if (bn < UFS_NDADDR) { + return db[bn]; + } + + /* determine how many levels of indirection. */ + level = 0; + bn -= UFS_NDADDR; + bound = UFS_NINDIR(SUPERBLOCK); + while (bn >= bound) { + level++; + bn -= bound; + bound *= UFS_NINDIR(SUPERBLOCK); + } + if (level >= UFS_NIADDR) /* bn too big */ + return ((grub_daddr32_t)0); + + /* fetch the first indirect block */ + nb = INODE->ic_ib[level]; + if (nb == 0) { + return ((grub_daddr32_t)0); + } + if (indirblk0 != nb) { + indirblk0 = 0; + blkno = fsbtodb(SUPERBLOCK, nb); + if (!devread(blkno, 0, SUPERBLOCK->fs_bsize, + (char *)INDIRBLK0)) + return (0); + indirblk0 = nb; + } + bound /= UFS_NINDIR(SUPERBLOCK); + index = (bn / bound) % UFS_NINDIR(SUPERBLOCK); + nb = INDIRBLK0[index]; + + /* fetch through the indirect blocks */ + for (i = 1; i <= level; i++) { + if (indirblk1 != nb) { + blkno = fsbtodb(SUPERBLOCK, nb); + if (!devread(blkno, 0, SUPERBLOCK->fs_bsize, + (char *)INDIRBLK1)) + return (0); + indirblk1 = nb; + } + bound /= UFS_NINDIR(SUPERBLOCK); + index = (bn / bound) % UFS_NINDIR(SUPERBLOCK); + nb = INDIRBLK1[index]; + if (nb == 0) + return ((grub_daddr32_t)0); + } + + return (nb); +} + +/* search directory content for name, return inode number */ +static grub_ino_t +dlook(grub_ino_t dir_ino, char *name) +{ + int loc, off; + grub_daddr32_t lbn, dbn, dblk; + struct direct *dp; + + if ((INODE->ic_smode & IFMT) != IFDIR) + return 0; + + loc = 0; + while (loc < INODE->ic_sizelo) { + /* offset into block */ + off = blkoff(SUPERBLOCK, loc); + if (off == 0) { /* need to read in a new block */ + + /* get logical block number */ + lbn = lblkno(SUPERBLOCK, loc); + /* resolve indrect blocks */ + dbn = sbmap(lbn); + if (dbn == 0) + return (0); + + dblk = fsbtodb(SUPERBLOCK, dbn); + if (!devread(dblk, 0, SUPERBLOCK->fs_bsize, + (char *)DIRENT)) { + return 0; + } + } + + dp = (struct direct *)(DIRENT + off); + if (dp->d_ino && substring(name, dp->d_name) == 0) + return (dp->d_ino); + loc += dp->d_reclen; + } + return (0); +} + +#endif /* FSYS_UFS */ diff --git a/usr/src/grub/grub-0.97/stage2/fsys_ufs2.c b/usr/src/grub/grub-0.97/stage2/fsys_ufs2.c new file mode 100644 index 0000000000..698aca4e55 --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/fsys_ufs2.c @@ -0,0 +1,331 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2000, 2001 Free Software Foundation, Inc. + * Copyright (c) 2004 Valery Hromov + * + * 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. + */ + +/* + * Elements of this file were originally from the FreeBSD "biosboot" + * bootloader file "disk.c" dated 4/12/95. + * + * The license and header comments from that file are included here. + */ + +/* + * Mach Operating System + * Copyright (c) 1992, 1991 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. + * + * 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 FROM THE USE OF THIS SOFTWARE. + * + * Carnegie Mellon requests users of this software to return to + * + * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU + * School of Computer Science + * Carnegie Mellon University + * Pittsburgh PA 15213-3890 + * + * any improvements or extensions that they make and grant Carnegie Mellon + * the rights to redistribute these changes. + * + * from: Mach, Revision 2.2 92/04/04 11:35:49 rpd + * $Id: fsys_ufs2.c,v 1.2 2004/06/19 12:17:52 okuji Exp $ + */ + +#ifdef FSYS_UFS2 + +#include "shared.h" +#include "filesys.h" + +#include "ufs2.h" + +/* used for filesystem map blocks */ +static int mapblock; +static int mapblock_offset; +static int mapblock_bsize; + +static int sblock_try[] = SBLOCKSEARCH; +static ufs2_daddr_t sblockloc; +static int type; + +/* pointer to superblock */ +#define SUPERBLOCK ((struct fs *) ( FSYS_BUF + 8192 )) + +#define INODE_UFS2 ((struct ufs2_dinode *) ( FSYS_BUF + 16384 )) + +#define MAPBUF ( FSYS_BUF + 24576 ) +#define MAPBUF_LEN 8192 + +int +ufs2_mount (void) +{ + int retval = 0; + int i; + + sblockloc = -1; + type = 0; + + if (! (((current_drive & 0x80) || (current_slice != 0)) + && ! IS_PC_SLICE_TYPE_BSD_WITH_FS (current_slice, FS_BSDFFS))) + { + for (i = 0; sblock_try[i] != -1; ++i) + { + if (! (part_length < (sblock_try[i] + (SBLOCKSIZE / DEV_BSIZE)) + || ! devread (0, sblock_try[i], SBLOCKSIZE, (char *) SUPERBLOCK))) + { + if (SUPERBLOCK->fs_magic == FS_UFS2_MAGIC /* && + (SUPERBLOCK->fs_sblockloc == sblockloc || + (SUPERBLOCK->fs_old_flags & FS_FLAGS_UPDATED) == 0)*/) + { + type = 2; + } + else + { + continue; + } + + retval = 1; + sblockloc = sblock_try[i]; + break; + } + } + } + + mapblock = -1; + mapblock_offset = -1; + + return retval; +} + +static grub_int64_t +block_map (int file_block) +{ + int bnum, offset, bsize; + + if (file_block < NDADDR) + return (INODE_UFS2->di_db[file_block]); + + /* If the blockmap loaded does not include FILE_BLOCK, + load a new blockmap. */ + + if ((bnum = fsbtodb (SUPERBLOCK, INODE_UFS2->di_ib[0])) != mapblock + || (mapblock_offset <= bnum && bnum <= mapblock_offset + mapblock_bsize)) + { + if (MAPBUF_LEN < SUPERBLOCK->fs_bsize) + { + offset = ((file_block - NDADDR) % NINDIR (SUPERBLOCK)); + bsize = MAPBUF_LEN; + + if (offset + MAPBUF_LEN > SUPERBLOCK->fs_bsize) + offset = (SUPERBLOCK->fs_bsize - MAPBUF_LEN) / sizeof (int); + } + else + { + bsize = SUPERBLOCK->fs_bsize; + offset = 0; + } + + if (! devread (bnum, offset * sizeof (int), bsize, (char *) MAPBUF)) + { + mapblock = -1; + mapblock_bsize = -1; + mapblock_offset = -1; + errnum = ERR_FSYS_CORRUPT; + return -1; + } + + mapblock = bnum; + mapblock_bsize = bsize; + mapblock_offset = offset; + } + + return (((grub_int64_t *) MAPBUF)[((file_block - NDADDR) % NINDIR (SUPERBLOCK)) + - mapblock_offset]); +} + +int +ufs2_read (char *buf, int len) +{ + int logno, off, size, ret = 0; + grub_int64_t map; + + while (len && !errnum) + { + off = blkoff (SUPERBLOCK, filepos); + logno = lblkno (SUPERBLOCK, filepos); + size = blksize (SUPERBLOCK, INODE_UFS2, logno); + + if ((map = block_map (logno)) < 0) + break; + + size -= off; + + if (size > len) + size = len; + + disk_read_func = disk_read_hook; + + devread (fsbtodb (SUPERBLOCK, map), off, size, buf); + + disk_read_func = NULL; + + buf += size; + len -= size; + filepos += size; + ret += size; + } + + if (errnum) + ret = 0; + + return ret; +} + +int +ufs2_dir (char *dirname) +{ + char *rest, ch; + int block, off, loc, ino = ROOTINO; + grub_int64_t map; + struct direct *dp; + +/* main loop to find destination inode */ +loop: + + /* load current inode (defaults to the root inode) */ + + if (!devread (fsbtodb (SUPERBLOCK, ino_to_fsba (SUPERBLOCK, ino)), + ino % (SUPERBLOCK->fs_inopb) * sizeof (struct ufs2_dinode), + sizeof (struct ufs2_dinode), (char *) INODE_UFS2)) + return 0; /* XXX what return value? */ + + /* if we have a real file (and we're not just printing possibilities), + then this is where we want to exit */ + + if (!*dirname || isspace (*dirname)) + { + if ((INODE_UFS2->di_mode & IFMT) != IFREG) + { + errnum = ERR_BAD_FILETYPE; + return 0; + } + + filemax = INODE_UFS2->di_size; + + /* incomplete implementation requires this! */ + fsmax = (NDADDR + NINDIR (SUPERBLOCK)) * SUPERBLOCK->fs_bsize; + return 1; + } + + /* continue with file/directory name interpretation */ + + while (*dirname == '/') + dirname++; + + if (!(INODE_UFS2->di_size) || ((INODE_UFS2->di_mode & IFMT) != IFDIR)) + { + errnum = ERR_BAD_FILETYPE; + return 0; + } + + for (rest = dirname; (ch = *rest) && !isspace (ch) && ch != '/'; rest++); + + *rest = 0; + loc = 0; + + /* loop for reading a the entries in a directory */ + + do + { + if (loc >= INODE_UFS2->di_size) + { + if (print_possibilities < 0) + return 1; + + errnum = ERR_FILE_NOT_FOUND; + *rest = ch; + return 0; + } + + if (!(off = blkoff (SUPERBLOCK, loc))) + { + block = lblkno (SUPERBLOCK, loc); + + if ((map = block_map (block)) < 0 + || !devread (fsbtodb (SUPERBLOCK, map), 0, + blksize (SUPERBLOCK, INODE_UFS2, block), + (char *) FSYS_BUF)) + { + errnum = ERR_FSYS_CORRUPT; + *rest = ch; + return 0; + } + } + + dp = (struct direct *) (FSYS_BUF + off); + loc += dp->d_reclen; + +#ifndef STAGE1_5 + if (dp->d_ino && print_possibilities && ch != '/' + && (!*dirname || substring (dirname, dp->d_name) <= 0)) + { + if (print_possibilities > 0) + print_possibilities = -print_possibilities; + + print_a_completion (dp->d_name); + } +#endif /* STAGE1_5 */ + } + while (!dp->d_ino || (substring (dirname, dp->d_name) != 0 + || (print_possibilities && ch != '/'))); + + /* only get here if we have a matching directory entry */ + + ino = dp->d_ino; + *(dirname = rest) = ch; + + /* go back to main loop at top of function */ + goto loop; +} + +int +ufs2_embed (int *start_sector, int needed_sectors) +{ + /* XXX: I don't know if this is really correct. Someone who is + familiar with BSD should check for this. */ + if (needed_sectors > 14) + return 0; + + *start_sector = 1; +#if 1 + /* FIXME: Disable the embedding in FFS until someone checks if + the code above is correct. */ + return 0; +#else + return 1; +#endif +} + +#endif /* FSYS_UFS2 */ diff --git a/usr/src/grub/grub-0.97/stage2/fsys_vstafs.c b/usr/src/grub/grub-0.97/stage2/fsys_vstafs.c new file mode 100644 index 0000000000..a1167172b9 --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/fsys_vstafs.c @@ -0,0 +1,252 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2001 Free Software Foundation, 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 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. + */ + +#ifdef FSYS_VSTAFS + +#include "shared.h" +#include "filesys.h" +#include "vstafs.h" + + +static void get_file_info (int sector); +static struct dir_entry *vstafs_readdir (long sector); +static struct dir_entry *vstafs_nextdir (void); + + +#define FIRST_SECTOR ((struct first_sector *) FSYS_BUF) +#define FILE_INFO ((struct fs_file *) (int) FIRST_SECTOR + 8192) +#define DIRECTORY_BUF ((struct dir_entry *) (int) FILE_INFO + 512) + +#define ROOT_SECTOR 1 + +/* + * In f_sector we store the sector number in which the information about + * the found file is. + */ +extern int filepos; +static int f_sector; + +int +vstafs_mount (void) +{ + int retval = 1; + + if( (((current_drive & 0x80) || (current_slice != 0)) + && current_slice != PC_SLICE_TYPE_VSTAFS) + || ! devread (0, 0, BLOCK_SIZE, (char *) FSYS_BUF) + || FIRST_SECTOR->fs_magic != 0xDEADFACE) + retval = 0; + + return retval; +} + +static void +get_file_info (int sector) +{ + devread (sector, 0, BLOCK_SIZE, (char *) FILE_INFO); +} + +static int curr_ext, current_direntry, current_blockpos; +static struct alloc *a; + +static struct dir_entry * +vstafs_readdir (long sector) +{ + /* + * Get some information from the current directory + */ + get_file_info (sector); + if (FILE_INFO->type != 2) + { + errnum = ERR_FILE_NOT_FOUND; + return 0; + } + + a = FILE_INFO->blocks; + curr_ext = 0; + devread (a[curr_ext].a_start, 0, 512, (char *) DIRECTORY_BUF); + current_direntry = 11; + current_blockpos = 0; + + return &DIRECTORY_BUF[10]; +} + +static struct dir_entry * +vstafs_nextdir (void) +{ + if (current_direntry > 15) + { + current_direntry = 0; + if (++current_blockpos > (a[curr_ext].a_len - 1)) + { + current_blockpos = 0; + curr_ext++; + } + + if (curr_ext < FILE_INFO->extents) + { + devread (a[curr_ext].a_start + current_blockpos, 0, + 512, (char *) DIRECTORY_BUF); + } + else + { + /* errnum =ERR_FILE_NOT_FOUND; */ + return 0; + } + } + + return &DIRECTORY_BUF[current_direntry++]; +} + +int +vstafs_dir (char *dirname) +{ + char *fn, ch; + struct dir_entry *d; + /* int l, i, s; */ + + /* + * Read in the entries of the current directory. + */ + f_sector = ROOT_SECTOR; + do + { + if (! (d = vstafs_readdir (f_sector))) + { + return 0; + } + + /* + * Find the file in the path + */ + while (*dirname == '/') dirname++; + fn = dirname; + while ((ch = *fn) && ch != '/' && ! isspace (ch)) fn++; + *fn = 0; + + do + { + if (d->name[0] == 0 || d->name[0] & 0x80) + continue; + +#ifndef STAGE1_5 + if (print_possibilities && ch != '/' + && (! *dirname || strcmp (dirname, d->name) <= 0)) + { + if (print_possibilities > 0) + print_possibilities = -print_possibilities; + + printf (" %s", d->name); + } +#endif + if (! grub_strcmp (dirname, d->name)) + { + f_sector = d->start; + get_file_info (f_sector); + filemax = FILE_INFO->len; + break; + } + } + while ((d =vstafs_nextdir ())); + + *(dirname = fn) = ch; + if (! d) + { + if (print_possibilities < 0) + { + putchar ('\n'); + return 1; + } + + errnum = ERR_FILE_NOT_FOUND; + return 0; + } + } + while (*dirname && ! isspace (ch)); + + return 1; +} + +int +vstafs_read (char *addr, int len) +{ + struct alloc *a; + int size, ret = 0, offset, curr_len = 0; + int curr_ext; + char extent; + int ext_size; + char *curr_pos; + + get_file_info (f_sector); + size = FILE_INFO->len-VSTAFS_START_DATA; + a = FILE_INFO->blocks; + + if (filepos > 0) + { + if (filepos < a[0].a_len * 512 - VSTAFS_START_DATA) + { + offset = filepos + VSTAFS_START_DATA; + extent = 0; + curr_len = a[0].a_len * 512 - offset - filepos; + } + else + { + ext_size = a[0].a_len * 512 - VSTAFS_START_DATA; + offset = filepos - ext_size; + extent = 1; + do + { + curr_len -= ext_size; + offset -= ext_size; + ext_size = a[extent+1].a_len * 512; + } + while (extent < FILE_INFO->extents && offset>ext_size); + } + } + else + { + offset = VSTAFS_START_DATA; + extent = 0; + curr_len = a[0].a_len * 512 - offset; + } + + curr_pos = addr; + if (curr_len > len) + curr_len = len; + + for (curr_ext=extent; + curr_ext < FILE_INFO->extents; + curr_len = a[curr_ext].a_len * 512, curr_pos += curr_len, curr_ext++) + { + ret += curr_len; + size -= curr_len; + if (size < 0) + { + ret += size; + curr_len += size; + } + + devread (a[curr_ext].a_start,offset, curr_len, curr_pos); + offset = 0; + } + + return ret; +} + +#endif /* FSYS_VSTAFS */ diff --git a/usr/src/grub/grub-0.97/stage2/fsys_xfs.c b/usr/src/grub/grub-0.97/stage2/fsys_xfs.c new file mode 100644 index 0000000000..c472047a8b --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/fsys_xfs.c @@ -0,0 +1,624 @@ +/* fsys_xfs.c - an implementation for the SGI XFS file system */ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2001,2002,2004 Free Software Foundation, 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 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. + */ + +#ifdef FSYS_XFS + +#include "shared.h" +#include "filesys.h" +#include "xfs.h" + +#define MAX_LINK_COUNT 8 + +typedef struct xad { + xfs_fileoff_t offset; + xfs_fsblock_t start; + xfs_filblks_t len; +} xad_t; + +struct xfs_info { + int bsize; + int dirbsize; + int isize; + unsigned int agblocks; + int bdlog; + int blklog; + int inopblog; + int agblklog; + int agnolog; + unsigned int nextents; + xfs_daddr_t next; + xfs_daddr_t daddr; + xfs_dablk_t forw; + xfs_dablk_t dablk; + xfs_bmbt_rec_32_t *xt; + xfs_bmbt_ptr_t ptr0; + int btnode_ptr0_off; + int i8param; + int dirpos; + int dirmax; + int blkoff; + int fpos; + xfs_ino_t rootino; +}; + +static struct xfs_info xfs; + +#define dirbuf ((char *)FSYS_BUF) +#define filebuf ((char *)FSYS_BUF + 4096) +#define inode ((xfs_dinode_t *)((char *)FSYS_BUF + 8192)) +#define icore (inode->di_core) + +#define mask32lo(n) (((xfs_uint32_t)1 << (n)) - 1) + +#define XFS_INO_MASK(k) ((xfs_uint32_t)((1ULL << (k)) - 1)) +#define XFS_INO_OFFSET_BITS xfs.inopblog +#define XFS_INO_AGBNO_BITS xfs.agblklog +#define XFS_INO_AGINO_BITS (xfs.agblklog + xfs.inopblog) +#define XFS_INO_AGNO_BITS xfs.agnolog + +static inline xfs_agblock_t +agino2agbno (xfs_agino_t agino) +{ + return agino >> XFS_INO_OFFSET_BITS; +} + +static inline xfs_agnumber_t +ino2agno (xfs_ino_t ino) +{ + return ino >> XFS_INO_AGINO_BITS; +} + +static inline xfs_agino_t +ino2agino (xfs_ino_t ino) +{ + return ino & XFS_INO_MASK(XFS_INO_AGINO_BITS); +} + +static inline int +ino2offset (xfs_ino_t ino) +{ + return ino & XFS_INO_MASK(XFS_INO_OFFSET_BITS); +} + +static inline __const__ xfs_uint16_t +le16 (xfs_uint16_t x) +{ + __asm__("xchgb %b0,%h0" \ + : "=q" (x) \ + : "0" (x)); \ + return x; +} + +static inline __const__ xfs_uint32_t +le32 (xfs_uint32_t x) +{ +#if 0 + /* 386 doesn't have bswap. */ + __asm__("bswap %0" : "=r" (x) : "0" (x)); +#else + /* This is slower but this works on all x86 architectures. */ + __asm__("xchgb %b0, %h0" \ + "\n\troll $16, %0" \ + "\n\txchgb %b0, %h0" \ + : "=q" (x) : "0" (x)); +#endif + return x; +} + +static inline __const__ xfs_uint64_t +le64 (xfs_uint64_t x) +{ + xfs_uint32_t h = x >> 32; + xfs_uint32_t l = x & ((1ULL<<32)-1); + return (((xfs_uint64_t)le32(l)) << 32) | ((xfs_uint64_t)(le32(h))); +} + + +static xfs_fsblock_t +xt_start (xfs_bmbt_rec_32_t *r) +{ + return (((xfs_fsblock_t)(le32 (r->l1) & mask32lo(9))) << 43) | + (((xfs_fsblock_t)le32 (r->l2)) << 11) | + (((xfs_fsblock_t)le32 (r->l3)) >> 21); +} + +static xfs_fileoff_t +xt_offset (xfs_bmbt_rec_32_t *r) +{ + return (((xfs_fileoff_t)le32 (r->l0) & + mask32lo(31)) << 23) | + (((xfs_fileoff_t)le32 (r->l1)) >> 9); +} + +static xfs_filblks_t +xt_len (xfs_bmbt_rec_32_t *r) +{ + return le32(r->l3) & mask32lo(21); +} + +static inline int +xfs_highbit32(xfs_uint32_t v) +{ + int i; + + if (--v) { + for (i = 0; i < 31; i++, v >>= 1) { + if (v == 0) + return i; + } + } + return 0; +} + +static int +isinxt (xfs_fileoff_t key, xfs_fileoff_t offset, xfs_filblks_t len) +{ + return (key >= offset) ? (key < offset + len ? 1 : 0) : 0; +} + +static xfs_daddr_t +agb2daddr (xfs_agnumber_t agno, xfs_agblock_t agbno) +{ + return ((xfs_fsblock_t)agno*xfs.agblocks + agbno) << xfs.bdlog; +} + +static xfs_daddr_t +fsb2daddr (xfs_fsblock_t fsbno) +{ + return agb2daddr ((xfs_agnumber_t)(fsbno >> xfs.agblklog), + (xfs_agblock_t)(fsbno & mask32lo(xfs.agblklog))); +} + +#undef offsetof +#define offsetof(t,m) ((int)&(((t *)0)->m)) + +static inline int +btroot_maxrecs (void) +{ + int tmp = icore.di_forkoff ? (icore.di_forkoff << 3) : xfs.isize; + + return (tmp - sizeof(xfs_bmdr_block_t) - offsetof(xfs_dinode_t, di_u)) / + (sizeof (xfs_bmbt_key_t) + sizeof (xfs_bmbt_ptr_t)); +} + +static int +di_read (xfs_ino_t ino) +{ + xfs_agino_t agino; + xfs_agnumber_t agno; + xfs_agblock_t agbno; + xfs_daddr_t daddr; + int offset; + + agno = ino2agno (ino); + agino = ino2agino (ino); + agbno = agino2agbno (agino); + offset = ino2offset (ino); + daddr = agb2daddr (agno, agbno); + + devread (daddr, offset*xfs.isize, xfs.isize, (char *)inode); + + xfs.ptr0 = *(xfs_bmbt_ptr_t *) + (inode->di_u.di_c + sizeof(xfs_bmdr_block_t) + + btroot_maxrecs ()*sizeof(xfs_bmbt_key_t)); + + return 1; +} + +static void +init_extents (void) +{ + xfs_bmbt_ptr_t ptr0; + xfs_btree_lblock_t h; + + switch (icore.di_format) { + case XFS_DINODE_FMT_EXTENTS: + xfs.xt = inode->di_u.di_bmx; + xfs.nextents = le32 (icore.di_nextents); + break; + case XFS_DINODE_FMT_BTREE: + ptr0 = xfs.ptr0; + for (;;) { + xfs.daddr = fsb2daddr (le64(ptr0)); + devread (xfs.daddr, 0, + sizeof(xfs_btree_lblock_t), (char *)&h); + if (!h.bb_level) { + xfs.nextents = le16(h.bb_numrecs); + xfs.next = fsb2daddr (le64(h.bb_rightsib)); + xfs.fpos = sizeof(xfs_btree_block_t); + return; + } + devread (xfs.daddr, xfs.btnode_ptr0_off, + sizeof(xfs_bmbt_ptr_t), (char *)&ptr0); + } + } +} + +static xad_t * +next_extent (void) +{ + static xad_t xad; + + switch (icore.di_format) { + case XFS_DINODE_FMT_EXTENTS: + if (xfs.nextents == 0) + return NULL; + break; + case XFS_DINODE_FMT_BTREE: + if (xfs.nextents == 0) { + xfs_btree_lblock_t h; + if (xfs.next == 0) + return NULL; + xfs.daddr = xfs.next; + devread (xfs.daddr, 0, sizeof(xfs_btree_lblock_t), (char *)&h); + xfs.nextents = le16(h.bb_numrecs); + xfs.next = fsb2daddr (le64(h.bb_rightsib)); + xfs.fpos = sizeof(xfs_btree_block_t); + } + /* Yeah, I know that's slow, but I really don't care */ + devread (xfs.daddr, xfs.fpos, sizeof(xfs_bmbt_rec_t), filebuf); + xfs.xt = (xfs_bmbt_rec_32_t *)filebuf; + xfs.fpos += sizeof(xfs_bmbt_rec_32_t); + } + xad.offset = xt_offset (xfs.xt); + xad.start = xt_start (xfs.xt); + xad.len = xt_len (xfs.xt); + ++xfs.xt; + --xfs.nextents; + + return &xad; +} + +/* + * Name lies - the function reads only first 100 bytes + */ +static void +xfs_dabread (void) +{ + xad_t *xad; + xfs_fileoff_t offset;; + + init_extents (); + while ((xad = next_extent ())) { + offset = xad->offset; + if (isinxt (xfs.dablk, offset, xad->len)) { + devread (fsb2daddr (xad->start + xfs.dablk - offset), + 0, 100, dirbuf); + break; + } + } +} + +static inline xfs_ino_t +sf_ino (char *sfe, int namelen) +{ + void *p = sfe + namelen + 3; + + return (xfs.i8param == 0) + ? le64(*(xfs_ino_t *)p) : le32(*(xfs_uint32_t *)p); +} + +static inline xfs_ino_t +sf_parent_ino (void) +{ + return (xfs.i8param == 0) + ? le64(*(xfs_ino_t *)(&inode->di_u.di_dir2sf.hdr.parent)) + : le32(*(xfs_uint32_t *)(&inode->di_u.di_dir2sf.hdr.parent)); +} + +static inline int +roundup8 (int n) +{ + return ((n+7)&~7); +} + +static char * +next_dentry (xfs_ino_t *ino) +{ + int namelen = 1; + int toread; + static char *usual[2][3] = {".", ".."}; + static xfs_dir2_sf_entry_t *sfe; + char *name = usual[0]; + + if (xfs.dirpos >= xfs.dirmax) { + if (xfs.forw == 0) + return NULL; + xfs.dablk = xfs.forw; + xfs_dabread (); +#define h ((xfs_dir2_leaf_hdr_t *)dirbuf) + xfs.dirmax = le16 (h->count) - le16 (h->stale); + xfs.forw = le32 (h->info.forw); +#undef h + xfs.dirpos = 0; + } + + switch (icore.di_format) { + case XFS_DINODE_FMT_LOCAL: + switch (xfs.dirpos) { + case -2: + *ino = 0; + break; + case -1: + *ino = sf_parent_ino (); + ++name; + ++namelen; + sfe = (xfs_dir2_sf_entry_t *) + (inode->di_u.di_c + + sizeof(xfs_dir2_sf_hdr_t) + - xfs.i8param); + break; + default: + namelen = sfe->namelen; + *ino = sf_ino ((char *)sfe, namelen); + name = sfe->name; + sfe = (xfs_dir2_sf_entry_t *) + ((char *)sfe + namelen + 11 - xfs.i8param); + } + break; + case XFS_DINODE_FMT_BTREE: + case XFS_DINODE_FMT_EXTENTS: +#define dau ((xfs_dir2_data_union_t *)dirbuf) + for (;;) { + if (xfs.blkoff >= xfs.dirbsize) { + xfs.blkoff = sizeof(xfs_dir2_data_hdr_t); + filepos &= ~(xfs.dirbsize - 1); + filepos |= xfs.blkoff; + } + xfs_read (dirbuf, 4); + xfs.blkoff += 4; + if (dau->unused.freetag == XFS_DIR2_DATA_FREE_TAG) { + toread = roundup8 (le16(dau->unused.length)) - 4; + xfs.blkoff += toread; + filepos += toread; + continue; + } + break; + } + xfs_read ((char *)dirbuf + 4, 5); + *ino = le64 (dau->entry.inumber); + namelen = dau->entry.namelen; +#undef dau + toread = roundup8 (namelen + 11) - 9; + xfs_read (dirbuf, toread); + name = (char *)dirbuf; + xfs.blkoff += toread + 5; + } + ++xfs.dirpos; + name[namelen] = 0; + + return name; +} + +static char * +first_dentry (xfs_ino_t *ino) +{ + xfs.forw = 0; + switch (icore.di_format) { + case XFS_DINODE_FMT_LOCAL: + xfs.dirmax = inode->di_u.di_dir2sf.hdr.count; + xfs.i8param = inode->di_u.di_dir2sf.hdr.i8count ? 0 : 4; + xfs.dirpos = -2; + break; + case XFS_DINODE_FMT_EXTENTS: + case XFS_DINODE_FMT_BTREE: + filepos = 0; + xfs_read (dirbuf, sizeof(xfs_dir2_data_hdr_t)); + if (((xfs_dir2_data_hdr_t *)dirbuf)->magic == le32(XFS_DIR2_BLOCK_MAGIC)) { +#define tail ((xfs_dir2_block_tail_t *)dirbuf) + filepos = xfs.dirbsize - sizeof(*tail); + xfs_read (dirbuf, sizeof(*tail)); + xfs.dirmax = le32 (tail->count) - le32 (tail->stale); +#undef tail + } else { + xfs.dablk = (1ULL << 35) >> xfs.blklog; +#define h ((xfs_dir2_leaf_hdr_t *)dirbuf) +#define n ((xfs_da_intnode_t *)dirbuf) + for (;;) { + xfs_dabread (); + if ((n->hdr.info.magic == le16(XFS_DIR2_LEAFN_MAGIC)) + || (n->hdr.info.magic == le16(XFS_DIR2_LEAF1_MAGIC))) { + xfs.dirmax = le16 (h->count) - le16 (h->stale); + xfs.forw = le32 (h->info.forw); + break; + } + xfs.dablk = le32 (n->btree[0].before); + } +#undef n +#undef h + } + xfs.blkoff = sizeof(xfs_dir2_data_hdr_t); + filepos = xfs.blkoff; + xfs.dirpos = 0; + } + return next_dentry (ino); +} + +int +xfs_mount (void) +{ + xfs_sb_t super; + + if (!devread (0, 0, sizeof(super), (char *)&super) + || (le32(super.sb_magicnum) != XFS_SB_MAGIC) + || ((le16(super.sb_versionnum) + & XFS_SB_VERSION_NUMBITS) != XFS_SB_VERSION_4) ) { + return 0; + } + + xfs.bsize = le32 (super.sb_blocksize); + xfs.blklog = super.sb_blocklog; + xfs.bdlog = xfs.blklog - SECTOR_BITS; + xfs.rootino = le64 (super.sb_rootino); + xfs.isize = le16 (super.sb_inodesize); + xfs.agblocks = le32 (super.sb_agblocks); + xfs.dirbsize = xfs.bsize << super.sb_dirblklog; + + xfs.inopblog = super.sb_inopblog; + xfs.agblklog = super.sb_agblklog; + xfs.agnolog = xfs_highbit32 (le32(super.sb_agcount)); + + xfs.btnode_ptr0_off = + ((xfs.bsize - sizeof(xfs_btree_block_t)) / + (sizeof (xfs_bmbt_key_t) + sizeof (xfs_bmbt_ptr_t))) + * sizeof(xfs_bmbt_key_t) + sizeof(xfs_btree_block_t); + + return 1; +} + +int +xfs_read (char *buf, int len) +{ + xad_t *xad; + xfs_fileoff_t endofprev, endofcur, offset; + xfs_filblks_t xadlen; + int toread, startpos, endpos; + + if (icore.di_format == XFS_DINODE_FMT_LOCAL) { + grub_memmove (buf, inode->di_u.di_c + filepos, len); + filepos += len; + return len; + } + + startpos = filepos; + endpos = filepos + len; + endofprev = (xfs_fileoff_t)-1; + init_extents (); + while (len > 0 && (xad = next_extent ())) { + offset = xad->offset; + xadlen = xad->len; + if (isinxt (filepos >> xfs.blklog, offset, xadlen)) { + endofcur = (offset + xadlen) << xfs.blklog; + toread = (endofcur >= endpos) + ? len : (endofcur - filepos); + + disk_read_func = disk_read_hook; + devread (fsb2daddr (xad->start), + filepos - (offset << xfs.blklog), toread, buf); + disk_read_func = NULL; + + buf += toread; + len -= toread; + filepos += toread; + } else if (offset > endofprev) { + toread = ((offset << xfs.blklog) >= endpos) + ? len : ((offset - endofprev) << xfs.blklog); + len -= toread; + filepos += toread; + for (; toread; toread--) { + *buf++ = 0; + } + continue; + } + endofprev = offset + xadlen; + } + + return filepos - startpos; +} + +int +xfs_dir (char *dirname) +{ + xfs_ino_t ino, parent_ino, new_ino; + xfs_fsize_t di_size; + int di_mode; + int cmp, n, link_count; + char linkbuf[xfs.bsize]; + char *rest, *name, ch; + + parent_ino = ino = xfs.rootino; + link_count = 0; + for (;;) { + di_read (ino); + di_size = le64 (icore.di_size); + di_mode = le16 (icore.di_mode); + + if ((di_mode & IFMT) == IFLNK) { + if (++link_count > MAX_LINK_COUNT) { + errnum = ERR_SYMLINK_LOOP; + return 0; + } + if (di_size < xfs.bsize - 1) { + filepos = 0; + filemax = di_size; + n = xfs_read (linkbuf, filemax); + } else { + errnum = ERR_FILELENGTH; + return 0; + } + + ino = (linkbuf[0] == '/') ? xfs.rootino : parent_ino; + while (n < (xfs.bsize - 1) && (linkbuf[n++] = *dirname++)); + linkbuf[n] = 0; + dirname = linkbuf; + continue; + } + + if (!*dirname || isspace (*dirname)) { + if ((di_mode & IFMT) != IFREG) { + errnum = ERR_BAD_FILETYPE; + return 0; + } + filepos = 0; + filemax = di_size; + return 1; + } + + if ((di_mode & IFMT) != IFDIR) { + errnum = ERR_BAD_FILETYPE; + return 0; + } + + for (; *dirname == '/'; dirname++); + + for (rest = dirname; (ch = *rest) && !isspace (ch) && ch != '/'; rest++); + *rest = 0; + + name = first_dentry (&new_ino); + for (;;) { + cmp = (!*dirname) ? -1 : substring (dirname, name); +#ifndef STAGE1_5 + if (print_possibilities && ch != '/' && cmp <= 0) { + if (print_possibilities > 0) + print_possibilities = -print_possibilities; + print_a_completion (name); + } else +#endif + if (cmp == 0) { + parent_ino = ino; + if (new_ino) + ino = new_ino; + *(dirname = rest) = ch; + break; + } + name = next_dentry (&new_ino); + if (name == NULL) { + if (print_possibilities < 0) + return 1; + + errnum = ERR_FILE_NOT_FOUND; + *rest = ch; + return 0; + } + } + } +} + +#endif /* FSYS_XFS */ diff --git a/usr/src/grub/grub-0.97/stage2/fsys_zfs.c b/usr/src/grub/grub-0.97/stage2/fsys_zfs.c new file mode 100644 index 0000000000..f0b09520a2 --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/fsys_zfs.c @@ -0,0 +1,1423 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, 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 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. + */ +/* + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* + * The zfs plug-in routines for GRUB are: + * + * zfs_mount() - locates a valid uberblock of the root pool and reads + * in its MOS at the memory address MOS. + * + * zfs_open() - locates a plain file object by following the MOS + * and places its dnode at the memory address DNODE. + * + * zfs_read() - read in the data blocks pointed by the DNODE. + * + * ZFS_SCRATCH is used as a working area. + * + * (memory addr) MOS DNODE ZFS_SCRATCH + * | | | + * +-------V---------V----------V---------------+ + * memory | | dnode | dnode | scratch | + * | | 512B | 512B | area | + * +--------------------------------------------+ + */ + +#ifdef FSYS_ZFS + +#include "shared.h" +#include "filesys.h" +#include "fsys_zfs.h" + +/* cache for a file block of the currently zfs_open()-ed file */ +static void *file_buf = NULL; +static uint64_t file_start = 0; +static uint64_t file_end = 0; + +/* cache for a dnode block */ +static dnode_phys_t *dnode_buf = NULL; +static dnode_phys_t *dnode_mdn = NULL; +static uint64_t dnode_start = 0; +static uint64_t dnode_end = 0; + +static uberblock_t current_uberblock; + +static char *stackbase; + +decomp_entry_t decomp_table[ZIO_COMPRESS_FUNCTIONS] = +{ + {"inherit", 0}, /* ZIO_COMPRESS_INHERIT */ + {"on", lzjb_decompress}, /* ZIO_COMPRESS_ON */ + {"off", 0}, /* ZIO_COMPRESS_OFF */ + {"lzjb", lzjb_decompress}, /* ZIO_COMPRESS_LZJB */ + {"empty", 0} /* ZIO_COMPRESS_EMPTY */ +}; + +/* + * Our own version of bcmp(). + */ +static int +zfs_bcmp(const void *s1, const void *s2, size_t n) +{ + const uchar_t *ps1 = s1; + const uchar_t *ps2 = s2; + + if (s1 != s2 && n != 0) { + do { + if (*ps1++ != *ps2++) + return (1); + } while (--n != 0); + } + + return (0); +} + +/* + * Our own version of log2(). Same thing as highbit()-1. + */ +static int +zfs_log2(uint64_t num) +{ + int i = 0; + + while (num > 1) { + i++; + num = num >> 1; + } + + return (i); +} + +/* Checksum Functions */ +static void +zio_checksum_off(const void *buf, uint64_t size, zio_cksum_t *zcp) +{ + ZIO_SET_CHECKSUM(zcp, 0, 0, 0, 0); +} + +/* Checksum Table and Values */ +zio_checksum_info_t zio_checksum_table[ZIO_CHECKSUM_FUNCTIONS] = { + NULL, NULL, 0, 0, "inherit", + NULL, NULL, 0, 0, "on", + zio_checksum_off, zio_checksum_off, 0, 0, "off", + zio_checksum_SHA256, zio_checksum_SHA256, 1, 1, "label", + zio_checksum_SHA256, zio_checksum_SHA256, 1, 1, "gang_header", + fletcher_2_native, fletcher_2_byteswap, 0, 1, "zilog", + fletcher_2_native, fletcher_2_byteswap, 0, 0, "fletcher2", + fletcher_4_native, fletcher_4_byteswap, 1, 0, "fletcher4", + zio_checksum_SHA256, zio_checksum_SHA256, 1, 0, "SHA256", +}; + +/* + * zio_checksum_verify: Provides support for checksum verification. + * + * Fletcher2, Fletcher4, and SHA256 are supported. + * + * Return: + * -1 = Failure + * 0 = Success + */ +static int +zio_checksum_verify(blkptr_t *bp, char *data, int size) +{ + zio_cksum_t zc = bp->blk_cksum; + uint32_t checksum = BP_IS_GANG(bp) ? ZIO_CHECKSUM_GANG_HEADER : + BP_GET_CHECKSUM(bp); + int byteswap = BP_SHOULD_BYTESWAP(bp); + zio_block_tail_t *zbt = (zio_block_tail_t *)(data + size) - 1; + zio_checksum_info_t *ci = &zio_checksum_table[checksum]; + zio_cksum_t actual_cksum, expected_cksum; + + /* byteswap is not supported */ + if (byteswap) + return (-1); + + if (checksum >= ZIO_CHECKSUM_FUNCTIONS || ci->ci_func[0] == NULL) + return (-1); + + if (ci->ci_zbt) { + if (checksum == ZIO_CHECKSUM_GANG_HEADER) { + /* + * 'gang blocks' is not supported. + */ + return (-1); + } + + if (zbt->zbt_magic == BSWAP_64(ZBT_MAGIC)) { + /* byte swapping is not supported */ + return (-1); + } else { + expected_cksum = zbt->zbt_cksum; + zbt->zbt_cksum = zc; + ci->ci_func[0](data, size, &actual_cksum); + zbt->zbt_cksum = expected_cksum; + } + zc = expected_cksum; + + } else { + if (BP_IS_GANG(bp)) + return (-1); + ci->ci_func[byteswap](data, size, &actual_cksum); + } + + if ((actual_cksum.zc_word[0] - zc.zc_word[0]) | + (actual_cksum.zc_word[1] - zc.zc_word[1]) | + (actual_cksum.zc_word[2] - zc.zc_word[2]) | + (actual_cksum.zc_word[3] - zc.zc_word[3])) + return (-1); + + return (0); +} + +/* + * vdev_label_offset takes "offset" (the offset within a vdev_label) and + * returns its physical disk offset (starting from the beginning of the vdev). + * + * Input: + * psize : Physical size of this vdev + * l : Label Number (0-3) + * offset : The offset with a vdev_label in which we want the physical + * address + * Return: + * Success : physical disk offset + * Failure : errnum = ERR_BAD_ARGUMENT, return value is meaningless + */ +static uint64_t +vdev_label_offset(uint64_t psize, int l, uint64_t offset) +{ + /* XXX Need to add back label support! */ + if (l >= VDEV_LABELS/2 || offset > sizeof (vdev_label_t)) { + errnum = ERR_BAD_ARGUMENT; + return (0); + } + + return (offset + l * sizeof (vdev_label_t) + (l < VDEV_LABELS / 2 ? + 0 : psize - VDEV_LABELS * sizeof (vdev_label_t))); + +} + +/* + * vdev_uberblock_compare takes two uberblock structures and returns an integer + * indicating the more recent of the two. + * Return Value = 1 if ub2 is more recent + * Return Value = -1 if ub1 is more recent + * The most recent uberblock is determined using its transaction number and + * timestamp. The uberblock with the highest transaction number is + * considered "newer". If the transaction numbers of the two blocks match, the + * timestamps are compared to determine the "newer" of the two. + */ +static int +vdev_uberblock_compare(uberblock_t *ub1, uberblock_t *ub2) +{ + if (ub1->ub_txg < ub2->ub_txg) + return (-1); + if (ub1->ub_txg > ub2->ub_txg) + return (1); + + if (ub1->ub_timestamp < ub2->ub_timestamp) + return (-1); + if (ub1->ub_timestamp > ub2->ub_timestamp) + return (1); + + return (0); +} + +/* + * Three pieces of information are needed to verify an uberblock: the magic + * number, the version number, and the checksum. + * + * Currently Implemented: version number, magic number + * Need to Implement: checksum + * + * Return: + * 0 - Success + * -1 - Failure + */ +static int +uberblock_verify(uberblock_phys_t *ub, int offset) +{ + + uberblock_t *uber = &ub->ubp_uberblock; + blkptr_t bp; + + BP_ZERO(&bp); + BP_SET_CHECKSUM(&bp, ZIO_CHECKSUM_LABEL); + BP_SET_BYTEORDER(&bp, ZFS_HOST_BYTEORDER); + ZIO_SET_CHECKSUM(&bp.blk_cksum, offset, 0, 0, 0); + + if (zio_checksum_verify(&bp, (char *)ub, UBERBLOCK_SIZE) != 0) + return (-1); + + if (uber->ub_magic == UBERBLOCK_MAGIC && + uber->ub_version > 0 && uber->ub_version <= SPA_VERSION) + return (0); + + return (-1); +} + +/* + * Find the best uberblock. + * Return: + * Success - Pointer to the best uberblock. + * Failure - NULL + */ +static uberblock_phys_t * +find_bestub(uberblock_phys_t *ub_array, int label) +{ + uberblock_phys_t *ubbest = NULL; + int i, offset; + + for (i = 0; i < (VDEV_UBERBLOCK_RING >> VDEV_UBERBLOCK_SHIFT); i++) { + offset = vdev_label_offset(0, label, VDEV_UBERBLOCK_OFFSET(i)); + if (errnum == ERR_BAD_ARGUMENT) + return (NULL); + if (uberblock_verify(&ub_array[i], offset) == 0) { + if (ubbest == NULL) { + ubbest = &ub_array[i]; + } else if (vdev_uberblock_compare( + &(ub_array[i].ubp_uberblock), + &(ubbest->ubp_uberblock)) > 0) { + ubbest = &ub_array[i]; + } + } + } + + return (ubbest); +} + +/* + * Read in a block and put its uncompressed data in buf. + * + * Return: + * 0 - success + * errnum - failure + */ +static int +zio_read(blkptr_t *bp, void *buf, char *stack) +{ + uint64_t offset, sector; + int psize, lsize; + int i, comp, cksum; + + psize = BP_GET_PSIZE(bp); + lsize = BP_GET_LSIZE(bp); + comp = BP_GET_COMPRESS(bp); + cksum = BP_GET_CHECKSUM(bp); + + if ((unsigned int)comp >= ZIO_COMPRESS_FUNCTIONS || + comp != ZIO_COMPRESS_OFF && decomp_table[comp].decomp_func == NULL) + return (ERR_FSYS_CORRUPT); + + if ((char *)buf < stack && ((char *)buf) + lsize > stack) + return (ERR_FSYS_CORRUPT); + /* pick a good dva from the block pointer */ + for (i = 0; i < SPA_DVAS_PER_BP; i++) { + + if (bp->blk_dva[i].dva_word[0] == 0 && + bp->blk_dva[i].dva_word[1] == 0) + continue; + + /* read in a block */ + offset = DVA_GET_OFFSET(&bp->blk_dva[i]); + sector = DVA_OFFSET_TO_PHYS_SECTOR(offset); + + if (comp != ZIO_COMPRESS_OFF) { + + if (devread(sector, 0, psize, stack) == 0) + continue; + if (zio_checksum_verify(bp, stack, psize) != 0) + continue; + decomp_table[comp].decomp_func(stack, buf, psize, + lsize); + } else { + if (devread(sector, 0, psize, buf) == 0) + continue; + if (zio_checksum_verify(bp, buf, psize) != 0) + continue; + } + return (0); + } + + return (ERR_FSYS_CORRUPT); +} + +/* + * Get the block from a block id. + * push the block onto the stack. + * + * Return: + * 0 - success + * errnum - failure + */ +static int +dmu_read(dnode_phys_t *dn, uint64_t blkid, void *buf, char *stack) +{ + int idx, level; + blkptr_t *bp_array = dn->dn_blkptr; + int epbs = dn->dn_indblkshift - SPA_BLKPTRSHIFT; + blkptr_t *bp, *tmpbuf; + + bp = (blkptr_t *)stack; + stack += sizeof (blkptr_t); + + tmpbuf = (blkptr_t *)stack; + stack += 1<dn_indblkshift; + + for (level = dn->dn_nlevels - 1; level >= 0; level--) { + idx = (blkid >> (epbs * level)) & ((1<dn_datablkszsec << SPA_MINBLOCKSHIFT); + break; + } else if (errnum = zio_read(bp, tmpbuf, stack)) { + return (errnum); + } + + bp_array = tmpbuf; + } + + return (0); +} + +/* + * mzap_lookup: Looks up property described by "name" and returns the value + * in "value". + * + * Return: + * 0 - success + * errnum - failure + */ +static int +mzap_lookup(mzap_phys_t *zapobj, int objsize, char *name, + uint64_t *value) +{ + int i, chunks; + mzap_ent_phys_t *mzap_ent = zapobj->mz_chunk; + + chunks = objsize/MZAP_ENT_LEN - 1; + for (i = 0; i < chunks; i++) { + if (grub_strcmp(mzap_ent[i].mze_name, name) == 0) { + *value = mzap_ent[i].mze_value; + return (0); + } + } + + return (ERR_FSYS_CORRUPT); +} + +static uint64_t +zap_hash(uint64_t salt, const char *name) +{ + static uint64_t table[256]; + const uint8_t *cp; + uint8_t c; + uint64_t crc = salt; + + if (table[128] == 0) { + uint64_t *ct; + int i, j; + for (i = 0; i < 256; i++) { + for (ct = table + i, *ct = i, j = 8; j > 0; j--) + *ct = (*ct >> 1) ^ (-(*ct & 1) & + ZFS_CRC64_POLY); + } + } + + if (crc == 0 || table[128] != ZFS_CRC64_POLY) { + errnum = ERR_FSYS_CORRUPT; + return (0); + } + + for (cp = (const uint8_t *)name; (c = *cp) != '\0'; cp++) + crc = (crc >> 8) ^ table[(crc ^ c) & 0xFF]; + + /* + * Only use 28 bits, since we need 4 bits in the cookie for the + * collision differentiator. We MUST use the high bits, since + * those are the onces that we first pay attention to when + * chosing the bucket. + */ + crc &= ~((1ULL << (64 - ZAP_HASHBITS)) - 1); + + return (crc); +} + +/* + * Only to be used on 8-bit arrays. + * array_len is actual len in bytes (not encoded le_value_length). + * buf is null-terminated. + */ +static int +zap_leaf_array_equal(zap_leaf_phys_t *l, int blksft, int chunk, + int array_len, const char *buf) +{ + int bseen = 0; + + while (bseen < array_len) { + struct zap_leaf_array *la = + &ZAP_LEAF_CHUNK(l, blksft, chunk).l_array; + int toread = MIN(array_len - bseen, ZAP_LEAF_ARRAY_BYTES); + + if (chunk >= ZAP_LEAF_NUMCHUNKS(blksft)) + return (0); + + if (zfs_bcmp(la->la_array, buf + bseen, toread) != 0) + break; + chunk = la->la_next; + bseen += toread; + } + return (bseen == array_len); +} + +/* + * Given a zap_leaf_phys_t, walk thru the zap leaf chunks to get the + * value for the property "name". + * + * Return: + * 0 - success + * errnum - failure + */ +static int +zap_leaf_lookup(zap_leaf_phys_t *l, int blksft, uint64_t h, + const char *name, uint64_t *value) +{ + uint16_t chunk; + struct zap_leaf_entry *le; + + /* Verify if this is a valid leaf block */ + if (l->l_hdr.lh_block_type != ZBT_LEAF) + return (ERR_FSYS_CORRUPT); + if (l->l_hdr.lh_magic != ZAP_LEAF_MAGIC) + return (ERR_FSYS_CORRUPT); + + for (chunk = l->l_hash[LEAF_HASH(blksft, h)]; + chunk != CHAIN_END; chunk = le->le_next) { + + if (chunk >= ZAP_LEAF_NUMCHUNKS(blksft)) + return (ERR_FSYS_CORRUPT); + + le = ZAP_LEAF_ENTRY(l, blksft, chunk); + + /* Verify the chunk entry */ + if (le->le_type != ZAP_CHUNK_ENTRY) + return (ERR_FSYS_CORRUPT); + + if (le->le_hash != h) + continue; + + if (zap_leaf_array_equal(l, blksft, le->le_name_chunk, + le->le_name_length, name)) { + + struct zap_leaf_array *la; + uint8_t *ip; + + if (le->le_int_size != 8 || le->le_value_length != 1) + return (ERR_FSYS_CORRUPT); + + /* get the uint64_t property value */ + la = &ZAP_LEAF_CHUNK(l, blksft, + le->le_value_chunk).l_array; + ip = la->la_array; + + *value = (uint64_t)ip[0] << 56 | (uint64_t)ip[1] << 48 | + (uint64_t)ip[2] << 40 | (uint64_t)ip[3] << 32 | + (uint64_t)ip[4] << 24 | (uint64_t)ip[5] << 16 | + (uint64_t)ip[6] << 8 | (uint64_t)ip[7]; + + return (0); + } + } + + return (ERR_FSYS_CORRUPT); +} + +/* + * Fat ZAP lookup + * + * Return: + * 0 - success + * errnum - failure + */ +static int +fzap_lookup(dnode_phys_t *zap_dnode, zap_phys_t *zap, + char *name, uint64_t *value, char *stack) +{ + zap_leaf_phys_t *l; + uint64_t hash, idx, blkid; + int blksft = zfs_log2(zap_dnode->dn_datablkszsec << DNODE_SHIFT); + + /* Verify if this is a fat zap header block */ + if (zap->zap_magic != (uint64_t)ZAP_MAGIC) + return (ERR_FSYS_CORRUPT); + + hash = zap_hash(zap->zap_salt, name); + if (errnum) + return (errnum); + + /* get block id from index */ + if (zap->zap_ptrtbl.zt_numblks != 0) { + /* external pointer tables not supported */ + return (ERR_FSYS_CORRUPT); + } + idx = ZAP_HASH_IDX(hash, zap->zap_ptrtbl.zt_shift); + blkid = ((uint64_t *)zap)[idx + (1<<(blksft-3-1))]; + + /* Get the leaf block */ + l = (zap_leaf_phys_t *)stack; + stack += 1<dn_datablkszsec << SPA_MINBLOCKSHIFT; + stack += size; + if (errnum = dmu_read(zap_dnode, 0, zapbuf, stack)) + return (errnum); + + block_type = *((uint64_t *)zapbuf); + + if (block_type == ZBT_MICRO) { + return (mzap_lookup(zapbuf, size, name, val)); + } else if (block_type == ZBT_HEADER) { + /* this is a fat zap */ + return (fzap_lookup(zap_dnode, zapbuf, name, + val, stack)); + } + + return (ERR_FSYS_CORRUPT); +} + +/* + * Get the dnode of an object number from the metadnode of an object set. + * + * Input + * mdn - metadnode to get the object dnode + * objnum - object number for the object dnode + * buf - data buffer that holds the returning dnode + * stack - scratch area + * + * Return: + * 0 - success + * errnum - failure + */ +static int +dnode_get(dnode_phys_t *mdn, uint64_t objnum, uint8_t type, dnode_phys_t *buf, + char *stack) +{ + uint64_t blkid, blksz; /* the block id this object dnode is in */ + int epbs; /* shift of number of dnodes in a block */ + int idx; /* index within a block */ + dnode_phys_t *dnbuf; + + blksz = mdn->dn_datablkszsec << SPA_MINBLOCKSHIFT; + epbs = zfs_log2(blksz) - DNODE_SHIFT; + blkid = objnum >> epbs; + idx = objnum & ((1<= dnode_start && objnum < dnode_end) { + grub_memmove(buf, &dnode_buf[idx], DNODE_SIZE); + VERIFY_DN_TYPE(buf, type); + return (0); + } + + if (dnode_buf && blksz == 1< ZPL_VERSION) + return (-1); + + if (errnum = zap_lookup(dn, ZFS_ROOT_OBJ, &objnum, stack)) + return (errnum); + + if (errnum = dnode_get(mdn, objnum, DMU_OT_DIRECTORY_CONTENTS, + dn, stack)) + return (errnum); + + /* skip leading slashes */ + while (*path == '/') + path++; + + while (*path && !isspace(*path)) { + + /* get the next component name */ + cname = path; + while (*path && !isspace(*path) && *path != '/') + path++; + ch = *path; + *path = 0; /* ensure null termination */ + + if (errnum = zap_lookup(dn, cname, &objnum, stack)) + return (errnum); + + objnum = ZFS_DIRENT_OBJ(objnum); + if (errnum = dnode_get(mdn, objnum, 0, dn, stack)) + return (errnum); + + *path = ch; + while (*path == '/') + path++; + } + + /* We found the dnode for this file. Verify if it is a plain file. */ + VERIFY_DN_TYPE(dn, DMU_OT_PLAIN_FILE_CONTENTS); + + return (0); +} + +/* + * Get the default 'bootfs' property value from the rootpool. + * + * Return: + * 0 - success + * errnum -failure + */ +static int +get_default_bootfsobj(dnode_phys_t *mosmdn, uint64_t *obj, char *stack) +{ + uint64_t objnum = 0; + dnode_phys_t *dn = (dnode_phys_t *)stack; + stack += DNODE_SIZE; + + if (errnum = dnode_get(mosmdn, DMU_POOL_DIRECTORY_OBJECT, + DMU_OT_OBJECT_DIRECTORY, dn, stack)) + return (errnum); + + /* + * find the object number for 'pool_props', and get the dnode + * of the 'pool_props'. + */ + if (zap_lookup(dn, DMU_POOL_PROPS, &objnum, stack)) + return (ERR_FILESYSTEM_NOT_FOUND); + + if (errnum = dnode_get(mosmdn, objnum, DMU_OT_POOL_PROPS, dn, stack)) + return (errnum); + + if (zap_lookup(dn, ZPOOL_PROP_BOOTFS, &objnum, stack)) + return (ERR_FILESYSTEM_NOT_FOUND); + + if (!objnum) + return (ERR_FILESYSTEM_NOT_FOUND); + + *obj = objnum; + return (0); +} + +/* + * Given a MOS metadnode, get the metadnode of a given filesystem name (fsname), + * e.g. pool/rootfs, or a given object number (obj), e.g. the object number + * of pool/rootfs. + * + * If no fsname and no obj are given, return the DSL_DIR metadnode. + * If fsname is given, return its metadnode and its matching object number. + * If only obj is given, return the metadnode for this object number. + * + * Return: + * 0 - success + * errnum - failure + */ +static int +get_objset_mdn(dnode_phys_t *mosmdn, char *fsname, uint64_t *obj, + dnode_phys_t *mdn, char *stack) +{ + uint64_t objnum, headobj; + char *cname, ch; + blkptr_t *bp; + objset_phys_t *osp; + int issnapshot = 0; + char *snapname; + + if (fsname == NULL && obj) { + headobj = *obj; + goto skip; + } + + if (errnum = dnode_get(mosmdn, DMU_POOL_DIRECTORY_OBJECT, + DMU_OT_OBJECT_DIRECTORY, mdn, stack)) + return (errnum); + + if (errnum = zap_lookup(mdn, DMU_POOL_ROOT_DATASET, &objnum, + stack)) + return (errnum); + + if (errnum = dnode_get(mosmdn, objnum, DMU_OT_DSL_DIR, mdn, stack)) + return (errnum); + + if (fsname == NULL) { + headobj = + ((dsl_dir_phys_t *)DN_BONUS(mdn))->dd_head_dataset_obj; + goto skip; + } + + /* take out the pool name */ + while (*fsname && !isspace(*fsname) && *fsname != '/') + fsname++; + + while (*fsname && !isspace(*fsname)) { + uint64_t childobj; + + while (*fsname == '/') + fsname++; + + cname = fsname; + while (*fsname && !isspace(*fsname) && *fsname != '/') + fsname++; + ch = *fsname; + *fsname = 0; + + snapname = cname; + while (*snapname && !isspace(*snapname) && *snapname != '@') + snapname++; + if (*snapname == '@') { + issnapshot = 1; + *snapname = 0; + } + childobj = + ((dsl_dir_phys_t *)DN_BONUS(mdn))->dd_child_dir_zapobj; + if (errnum = dnode_get(mosmdn, childobj, + DMU_OT_DSL_DIR_CHILD_MAP, mdn, stack)) + return (errnum); + + if (zap_lookup(mdn, cname, &objnum, stack)) + return (ERR_FILESYSTEM_NOT_FOUND); + + if (errnum = dnode_get(mosmdn, objnum, DMU_OT_DSL_DIR, + mdn, stack)) + return (errnum); + + *fsname = ch; + if (issnapshot) + *snapname = '@'; + } + headobj = ((dsl_dir_phys_t *)DN_BONUS(mdn))->dd_head_dataset_obj; + if (obj) + *obj = headobj; + +skip: + if (errnum = dnode_get(mosmdn, headobj, DMU_OT_DSL_DATASET, mdn, stack)) + return (errnum); + if (issnapshot) { + uint64_t snapobj; + + snapobj = ((dsl_dataset_phys_t *)DN_BONUS(mdn))-> + ds_snapnames_zapobj; + + if (errnum = dnode_get(mosmdn, snapobj, + DMU_OT_DSL_DS_SNAP_MAP, mdn, stack)) + return (errnum); + if (zap_lookup(mdn, snapname + 1, &headobj, stack)) + return (ERR_FILESYSTEM_NOT_FOUND); + if (errnum = dnode_get(mosmdn, headobj, + DMU_OT_DSL_DATASET, mdn, stack)) + return (errnum); + if (obj) + *obj = headobj; + } + + bp = &((dsl_dataset_phys_t *)DN_BONUS(mdn))->ds_bp; + osp = (objset_phys_t *)stack; + stack += sizeof (objset_phys_t); + if (errnum = zio_read(bp, osp, stack)) + return (errnum); + + grub_memmove((char *)mdn, (char *)&osp->os_meta_dnode, DNODE_SIZE); + + return (0); +} + +/* + * For a given XDR packed nvlist, verify the first 4 bytes and move on. + * + * An XDR packed nvlist is encoded as (comments from nvs_xdr_create) : + * + * encoding method/host endian (4 bytes) + * nvl_version (4 bytes) + * nvl_nvflag (4 bytes) + * encoded nvpairs: + * encoded size of the nvpair (4 bytes) + * decoded size of the nvpair (4 bytes) + * name string size (4 bytes) + * name string data (sizeof(NV_ALIGN4(string)) + * data type (4 bytes) + * # of elements in the nvpair (4 bytes) + * data + * 2 zero's for the last nvpair + * (end of the entire list) (8 bytes) + * + * Return: + * 0 - success + * 1 - failure + */ +static int +nvlist_unpack(char *nvlist, char **out) +{ + /* Verify if the 1st and 2nd byte in the nvlist are valid. */ + if (nvlist[0] != NV_ENCODE_XDR || nvlist[1] != HOST_ENDIAN) + return (1); + + nvlist += 4; + *out = nvlist; + return (0); +} + +static char * +nvlist_array(char *nvlist, int index) +{ + int i, encode_size; + + for (i = 0; i < index; i++) { + /* skip the header, nvl_version, and nvl_nvflag */ + nvlist = nvlist + 4 * 2; + + while (encode_size = BSWAP_32(*(uint32_t *)nvlist)) + nvlist += encode_size; /* goto the next nvpair */ + + nvlist = nvlist + 4 * 2; /* skip the ending 2 zeros - 8 bytes */ + } + + return (nvlist); +} + +static int +nvlist_lookup_value(char *nvlist, char *name, void *val, int valtype, + int *nelmp) +{ + int name_len, type, slen, encode_size; + char *nvpair, *nvp_name, *strval = val; + uint64_t *intval = val; + + /* skip the header, nvl_version, and nvl_nvflag */ + nvlist = nvlist + 4 * 2; + + /* + * Loop thru the nvpair list + * The XDR representation of an integer is in big-endian byte order. + */ + while (encode_size = BSWAP_32(*(uint32_t *)nvlist)) { + + nvpair = nvlist + 4 * 2; /* skip the encode/decode size */ + + name_len = BSWAP_32(*(uint32_t *)nvpair); + nvpair += 4; + + nvp_name = nvpair; + nvpair = nvpair + ((name_len + 3) & ~3); /* align */ + + type = BSWAP_32(*(uint32_t *)nvpair); + nvpair += 4; + + if ((grub_strncmp(nvp_name, name, name_len) == 0) && + type == valtype) { + int nelm; + + if ((nelm = BSWAP_32(*(uint32_t *)nvpair)) < 1) + return (1); + nvpair += 4; + + switch (valtype) { + case DATA_TYPE_STRING: + slen = BSWAP_32(*(uint32_t *)nvpair); + nvpair += 4; + grub_memmove(strval, nvpair, slen); + strval[slen] = '\0'; + return (0); + + case DATA_TYPE_UINT64: + *intval = BSWAP_64(*(uint64_t *)nvpair); + return (0); + + case DATA_TYPE_NVLIST: + *(void **)val = (void *)nvpair; + return (0); + + case DATA_TYPE_NVLIST_ARRAY: + *(void **)val = (void *)nvpair; + if (nelmp) + *nelmp = nelm; + return (0); + } + } + + nvlist += encode_size; /* goto the next nvpair */ + } + + return (1); +} + +/* + * Check if this vdev is online and is in a good state. + */ +static int +vdev_validate(char *nv) +{ + uint64_t ival; + + if (nvlist_lookup_value(nv, ZPOOL_CONFIG_OFFLINE, &ival, + DATA_TYPE_UINT64, NULL) == 0 || + nvlist_lookup_value(nv, ZPOOL_CONFIG_FAULTED, &ival, + DATA_TYPE_UINT64, NULL) == 0 || + nvlist_lookup_value(nv, ZPOOL_CONFIG_REMOVED, &ival, + DATA_TYPE_UINT64, NULL) == 0) + return (ERR_DEV_VALUES); + + return (0); +} + +/* + * Get a list of valid vdev pathname from the boot device. + * The caller should already allocate MAXNAMELEN memory for bootpath. + */ +int +vdev_get_bootpath(char *nv, uint64_t inguid, char *devid, char *bootpath) +{ + char type[16]; + + bootpath[0] = '\0'; + if (nvlist_lookup_value(nv, ZPOOL_CONFIG_TYPE, &type, DATA_TYPE_STRING, + NULL)) + return (ERR_FSYS_CORRUPT); + + if (strcmp(type, VDEV_TYPE_DISK) == 0) { + if (vdev_validate(nv) != 0 || + (nvlist_lookup_value(nv, ZPOOL_CONFIG_PHYS_PATH, + bootpath, DATA_TYPE_STRING, NULL) != 0) || + (nvlist_lookup_value(nv, ZPOOL_CONFIG_DEVID, + devid, DATA_TYPE_STRING, NULL) != 0)) + return (ERR_NO_BOOTPATH); + + } else if (strcmp(type, VDEV_TYPE_MIRROR) == 0) { + int nelm, i; + char *child; + + if (nvlist_lookup_value(nv, ZPOOL_CONFIG_CHILDREN, &child, + DATA_TYPE_NVLIST_ARRAY, &nelm)) + return (ERR_FSYS_CORRUPT); + + for (i = 0; i < nelm; i++) { + char tmp_path[MAXNAMELEN]; + char tmp_devid[MAXNAMELEN]; + char *child_i; + uint64_t guid; + + child_i = nvlist_array(child, i); + if (vdev_validate(child_i) != 0) + continue; + + if (nvlist_lookup_value(child_i, ZPOOL_CONFIG_PHYS_PATH, + tmp_path, DATA_TYPE_STRING, NULL) != 0) + return (ERR_NO_BOOTPATH); + + if ((strlen(bootpath) + strlen(tmp_path)) > MAXNAMELEN) + return (ERR_WONT_FIT); + + if (nvlist_lookup_value(child_i, ZPOOL_CONFIG_GUID, + &guid, DATA_TYPE_UINT64, NULL) != 0) + return (ERR_NO_BOOTPATH); + if (nvlist_lookup_value(child_i, ZPOOL_CONFIG_DEVID, + tmp_devid, DATA_TYPE_STRING, NULL) != 0) + return (ERR_NO_BOOTPATH); + if (guid == inguid) { + sprintf(devid, "%s", tmp_devid); + sprintf(bootpath, "%s", tmp_path); + break; + } + } + } + + return (strlen(bootpath) > 0 ? 0 : ERR_NO_BOOTPATH); +} + +/* + * Check the disk label information and retrieve needed vdev name-value pairs. + * + * Return: + * 0 - success + * ERR_* - failure + */ +int +check_pool_label(int label, char *stack, char *outdevid, char *outpath) +{ + vdev_phys_t *vdev; + uint64_t sector, pool_state, txg = 0; + char *nvlist, *nv; + uint64_t diskguid; + uint64_t version; + + sector = (label * sizeof (vdev_label_t) + VDEV_SKIP_SIZE + + VDEV_BOOT_HEADER_SIZE) >> SPA_MINBLOCKSHIFT; + + /* Read in the vdev name-value pair list (112K). */ + if (devread(sector, 0, VDEV_PHYS_SIZE, stack) == 0) + return (ERR_READ); + + vdev = (vdev_phys_t *)stack; + stack += sizeof (vdev_phys_t); + + if (nvlist_unpack(vdev->vp_nvlist, &nvlist)) + return (ERR_FSYS_CORRUPT); + + if (nvlist_lookup_value(nvlist, ZPOOL_CONFIG_POOL_STATE, &pool_state, + DATA_TYPE_UINT64, NULL)) + return (ERR_FSYS_CORRUPT); + + if (pool_state == POOL_STATE_DESTROYED) + return (ERR_FILESYSTEM_NOT_FOUND); + + if (nvlist_lookup_value(nvlist, ZPOOL_CONFIG_POOL_NAME, + current_rootpool, DATA_TYPE_STRING, NULL)) + return (ERR_FSYS_CORRUPT); + + if (nvlist_lookup_value(nvlist, ZPOOL_CONFIG_POOL_TXG, &txg, + DATA_TYPE_UINT64, NULL)) + return (ERR_FSYS_CORRUPT); + + /* not an active device */ + if (txg == 0) + return (ERR_NO_BOOTPATH); + + if (nvlist_lookup_value(nvlist, ZPOOL_CONFIG_VERSION, &version, + DATA_TYPE_UINT64, NULL)) + return (ERR_FSYS_CORRUPT); + if (version > SPA_VERSION) + return (ERR_NEWER_VERSION); + if (nvlist_lookup_value(nvlist, ZPOOL_CONFIG_VDEV_TREE, &nv, + DATA_TYPE_NVLIST, NULL)) + return (ERR_FSYS_CORRUPT); + if (nvlist_lookup_value(nvlist, ZPOOL_CONFIG_GUID, &diskguid, + DATA_TYPE_UINT64, NULL)) + return (ERR_FSYS_CORRUPT); + if (vdev_get_bootpath(nv, diskguid, outdevid, outpath)) + return (ERR_NO_BOOTPATH); + return (0); +} + +/* + * zfs_mount() locates a valid uberblock of the root pool and read in its MOS + * to the memory address MOS. + * + * Return: + * 1 - success + * 0 - failure + */ +int +zfs_mount(void) +{ + char *stack; + int label = 0; + uberblock_phys_t *ub_array, *ubbest = NULL; + vdev_boot_header_t *bh; + objset_phys_t *osp; + char tmp_bootpath[MAXNAMELEN]; + char tmp_devid[MAXNAMELEN]; + + /* if it's our first time here, zero the best uberblock out */ + if (best_drive == 0 && best_part == 0 && find_best_root) + grub_memset(¤t_uberblock, 0, sizeof (uberblock_t)); + + stackbase = ZFS_SCRATCH; + stack = stackbase; + ub_array = (uberblock_phys_t *)stack; + stack += VDEV_UBERBLOCK_RING; + + bh = (vdev_boot_header_t *)stack; + stack += VDEV_BOOT_HEADER_SIZE; + + osp = (objset_phys_t *)stack; + stack += sizeof (objset_phys_t); + + /* XXX add back labels support? */ + for (label = 0; ubbest == NULL && label < (VDEV_LABELS/2); label++) { + uint64_t sector = (label * sizeof (vdev_label_t) + + VDEV_SKIP_SIZE) >> SPA_MINBLOCKSHIFT; + if (devread(sector, 0, VDEV_BOOT_HEADER_SIZE, + (char *)bh) == 0) + continue; + if ((bh->vb_magic != VDEV_BOOT_MAGIC) || + (bh->vb_version != VDEV_BOOT_VERSION)) { + continue; + } + sector += (VDEV_BOOT_HEADER_SIZE + + VDEV_PHYS_SIZE) >> SPA_MINBLOCKSHIFT; + + /* Read in the uberblock ring (128K). */ + if (devread(sector, 0, VDEV_UBERBLOCK_RING, + (char *)ub_array) == 0) + continue; + + if ((ubbest = find_bestub(ub_array, label)) != NULL && + zio_read(&ubbest->ubp_uberblock.ub_rootbp, osp, stack) + == 0) { + + VERIFY_OS_TYPE(osp, DMU_OST_META); + + if (check_pool_label(label, stack, tmp_devid, + tmp_bootpath)) + return (0); + + if (find_best_root && + vdev_uberblock_compare(&ubbest->ubp_uberblock, + &(current_uberblock)) <= 0) + continue; + /* Got the MOS. Save it at the memory addr MOS. */ + grub_memmove(MOS, &osp->os_meta_dnode, DNODE_SIZE); + grub_memmove(¤t_uberblock, + &ubbest->ubp_uberblock, + sizeof (uberblock_t)); + grub_memmove(current_bootpath, tmp_bootpath, + MAXNAMELEN); + grub_memmove(current_devid, tmp_devid, + grub_strlen(tmp_devid)); + is_zfs_mount = 1; + return (1); + } + } + + return (0); +} + +/* + * zfs_open() locates a file in the rootpool by following the + * MOS and places the dnode of the file in the memory address DNODE. + * + * Return: + * 1 - success + * 0 - failure + */ +int +zfs_open(char *filename) +{ + char *stack; + dnode_phys_t *mdn; + + file_buf = NULL; + stackbase = ZFS_SCRATCH; + stack = stackbase; + + mdn = (dnode_phys_t *)stack; + stack += sizeof (dnode_phys_t); + + dnode_mdn = NULL; + dnode_buf = (dnode_phys_t *)stack; + stack += 1<zp_size; + filepos = 0; + + dnode_buf = NULL; + return (1); +} + +/* + * zfs_read reads in the data blocks pointed by the DNODE. + * + * Return: + * len - the length successfully read in to the buffer + * 0 - failure + */ +int +zfs_read(char *buf, int len) +{ + char *stack; + char *tmpbuf; + int blksz, length, movesize; + + if (file_buf == NULL) { + file_buf = stackbase; + stackbase += SPA_MAXBLOCKSIZE; + file_start = file_end = 0; + } + stack = stackbase; + + /* + * If offset is in memory, move it into the buffer provided and return. + */ + if (filepos >= file_start && filepos+len <= file_end) { + grub_memmove(buf, file_buf + filepos - file_start, len); + filepos += len; + return (len); + } + + blksz = DNODE->dn_datablkszsec << SPA_MINBLOCKSHIFT; + + /* + * Entire Dnode is too big to fit into the space available. We + * will need to read it in chunks. This could be optimized to + * read in as large a chunk as there is space available, but for + * now, this only reads in one data block at a time. + */ + length = len; + while (length) { + /* + * Find requested blkid and the offset within that block. + */ + uint64_t blkid = filepos / blksz; + + if (errnum = dmu_read(DNODE, blkid, file_buf, stack)) + return (0); + + file_start = blkid * blksz; + file_end = file_start + blksz; + + movesize = MIN(length, file_end - filepos); + + grub_memmove(buf, file_buf + filepos - file_start, + movesize); + buf += movesize; + length -= movesize; + filepos += movesize; + } + + return (len); +} + +/* + * No-Op + */ +int +zfs_embed(int *start_sector, int needed_sectors) +{ + return (1); +} + +#endif /* FSYS_ZFS */ diff --git a/usr/src/grub/grub-0.97/stage2/fsys_zfs.h b/usr/src/grub/grub-0.97/stage2/fsys_zfs.h new file mode 100644 index 0000000000..80d7e16890 --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/fsys_zfs.h @@ -0,0 +1,194 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, 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 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. + */ +/* + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ +#ifndef _FSYS_ZFS_H +#define _FSYS_ZFS_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef FSYS_ZFS + +typedef unsigned long long uint64_t; +typedef unsigned int uint32_t; +typedef unsigned short uint16_t; +typedef unsigned char uint8_t; +typedef unsigned char uchar_t; + +#if defined(_LP64) || defined(_I32LPx) +typedef unsigned long size_t; +#else +typedef unsigned int size_t; +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Global Memory addresses to store MOS and DNODE data + */ +#define MOS ((dnode_phys_t *)\ + (RAW_ADDR((mbi.mem_upper << 10) + 0x100000) - ZFS_SCRATCH_SIZE)) +#define DNODE (MOS+1) /* move sizeof(dnode_phys_t) bytes */ +#define ZFS_SCRATCH ((char *)(DNODE+1)) + +/* + * Verify dnode type. + * Can only be used in functions returning non-0 for failure. + */ +#define VERIFY_DN_TYPE(dnp, type) \ + if (type && (dnp)->dn_type != type) { \ + return (ERR_FSYS_CORRUPT); \ + } + +/* + * Verify object set type. + * Can only be used in functions returning 0 for failure. + */ +#define VERIFY_OS_TYPE(osp, type) \ + if (type && (osp)->os_type != type) { \ + errnum = ERR_FSYS_CORRUPT; \ + return (0); \ + } + +#define ZPOOL_PROP_BOOTFS "bootfs" + +/* General macros */ +#define BSWAP_8(x) ((x) & 0xff) +#define BSWAP_16(x) ((BSWAP_8(x) << 8) | BSWAP_8((x) >> 8)) +#define BSWAP_32(x) ((BSWAP_16(x) << 16) | BSWAP_16((x) >> 16)) +#define BSWAP_64(x) ((BSWAP_32(x) << 32) | BSWAP_32((x) >> 32)) +#define P2ROUNDUP(x, align) (-(-(x) & -(align))) + +/* + * XXX Match these macro up with real zfs once we have nvlist support so that we + * can support large sector disks. + */ +#define UBERBLOCK_SIZE (1ULL << UBERBLOCK_SHIFT) +#undef offsetof +#define offsetof(t, m) ((int)&(((t *)0)->m)) +#define VDEV_UBERBLOCK_SHIFT UBERBLOCK_SHIFT +#define VDEV_UBERBLOCK_OFFSET(n) \ +offsetof(vdev_label_t, vl_uberblock[(n) << VDEV_UBERBLOCK_SHIFT]) + +typedef struct uberblock uberblock_t; + +/* XXX Uberblock_phys_t is no longer in the kernel zfs */ +typedef struct uberblock_phys { + uberblock_t ubp_uberblock; + char ubp_pad[UBERBLOCK_SIZE - sizeof (uberblock_t) - + sizeof (zio_block_tail_t)]; + zio_block_tail_t ubp_zbt; +} uberblock_phys_t; + +/* + * Macros to get fields in a bp or DVA. + */ +#define P2PHASE(x, align) ((x) & ((align) - 1)) +#define DVA_OFFSET_TO_PHYS_SECTOR(offset) \ + ((offset + VDEV_LABEL_START_SIZE) >> SPA_MINBLOCKSHIFT) + +/* + * For nvlist manipulation. (from nvpair.h) + */ +#define NV_ENCODE_NATIVE 0 +#define NV_ENCODE_XDR 1 +#define HOST_ENDIAN 1 /* for x86 machine */ +#define DATA_TYPE_UINT64 8 +#define DATA_TYPE_STRING 9 +#define DATA_TYPE_NVLIST 19 +#define DATA_TYPE_NVLIST_ARRAY 20 + +/* + * Decompression Entry - lzjb + */ +#ifndef NBBY +#define NBBY 8 +#endif + +typedef int zfs_decomp_func_t(void *s_start, void *d_start, size_t s_len, + size_t d_len); +typedef struct decomp_entry { + char *name; + zfs_decomp_func_t *decomp_func; +} decomp_entry_t; + +/* + * FAT ZAP data structures + */ +#define ZFS_CRC64_POLY 0xC96C5795D7870F42ULL /* ECMA-182, reflected form */ +#define ZAP_HASH_IDX(hash, n) (((n) == 0) ? 0 : ((hash) >> (64 - (n)))) +#define CHAIN_END 0xffff /* end of the chunk chain */ + +/* + * The amount of space within the chunk available for the array is: + * chunk size - space for type (1) - space for next pointer (2) + */ +#define ZAP_LEAF_ARRAY_BYTES (ZAP_LEAF_CHUNKSIZE - 3) + +#define ZAP_LEAF_HASH_SHIFT(bs) (bs - 5) +#define ZAP_LEAF_HASH_NUMENTRIES(bs) (1 << ZAP_LEAF_HASH_SHIFT(bs)) +#define LEAF_HASH(bs, h) \ + ((ZAP_LEAF_HASH_NUMENTRIES(bs)-1) & \ + ((h) >> (64 - ZAP_LEAF_HASH_SHIFT(bs)-l->l_hdr.lh_prefix_len))) + +/* + * The amount of space available for chunks is: + * block size shift - hash entry size (2) * number of hash + * entries - header space (2*chunksize) + */ +#define ZAP_LEAF_NUMCHUNKS(bs) \ + (((1<l_hash + ZAP_LEAF_HASH_NUMENTRIES(bs)))[idx] +#define ZAP_LEAF_ENTRY(l, bs, idx) (&ZAP_LEAF_CHUNK(l, bs, idx).l_entry) + +extern void fletcher_2_native(const void *, uint64_t, zio_cksum_t *); +extern void fletcher_2_byteswap(const void *, uint64_t, zio_cksum_t *); +extern void fletcher_4_native(const void *, uint64_t, zio_cksum_t *); +extern void fletcher_4_byteswap(const void *, uint64_t, zio_cksum_t *); +extern void zio_checksum_SHA256(const void *, uint64_t, zio_cksum_t *); +extern int lzjb_decompress(void *, void *, size_t, size_t); + +#endif /* FSYS_ZFS */ + +#endif /* !_FSYS_ZFS_H */ diff --git a/usr/src/grub/grub-0.97/stage2/graphics.c b/usr/src/grub/grub-0.97/stage2/graphics.c new file mode 100644 index 0000000000..eb1a1c6a1f --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/graphics.c @@ -0,0 +1,654 @@ +/* graphics.c - graphics mode support for GRUB */ +/* Implemented as a terminal type by Jeremy Katz based + * on a patch by Paulo César Pereira de Andrade + */ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2001,2002 Red Hat, Inc. + * Portions copyright (C) 2000 Conectiva, 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 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. + */ + + + +#ifdef SUPPORT_GRAPHICS + +#include +#include +#include + +#include + +int saved_videomode; +unsigned char *font8x16; + +int graphics_inited = 0; +static char splashimage[64]; + +#define HPIXELS 640 +#define VPIXELS 480 +#define HPIXELSPERBYTE 8 + +#define ROWBYTES (HPIXELS / HPIXELSPERBYTE) +#define SCREENBYTES (ROWBYTES * VPIXELS) + +#define VSHADOW VSHADOW1 +unsigned char VSHADOW1[SCREENBYTES]; +unsigned char VSHADOW2[SCREENBYTES]; +unsigned char VSHADOW4[SCREENBYTES]; +unsigned char VSHADOW8[SCREENBYTES]; + +static unsigned char *s1 = (unsigned char*)VSHADOW1; +static unsigned char *s2 = (unsigned char*)VSHADOW2; +static unsigned char *s4 = (unsigned char*)VSHADOW4; +static unsigned char *s8 = (unsigned char*)VSHADOW8; + +/* constants to define the viewable area */ +const int x0 = 0; +const int x1 = ROWBYTES; +const int y0 = 0; +const int y1 = 30; + +/* text buffer has to be kept around so that we can write things as we + * scroll and the like */ +unsigned short text[ROWBYTES * 30]; + +/* why do these have to be kept here? */ +int foreground = (63 << 16) | (63 << 8) | (63), background = 0, border = 0; + + +/* current position */ +static int fontx = 0; +static int fonty = 0; + +/* global state so that we don't try to recursively scroll or cursor */ +static int no_scroll = 0; + +/* color state */ +static int graphics_standard_color = A_NORMAL; +static int graphics_normal_color = A_NORMAL; +static int graphics_highlight_color = A_REVERSE; +static int graphics_current_color = A_NORMAL; +static color_state graphics_color_state = COLOR_STATE_STANDARD; + + +/* graphics local functions */ +static void graphics_setxy(int col, int row); +static void graphics_scroll(); + +/* FIXME: where do these really belong? */ +static inline void outb(unsigned short port, unsigned char val) +{ + __asm __volatile ("outb %0,%1"::"a" (val), "d" (port)); +} + +static int splashscreen_read = 0; + +static void MapMask(int value) { + outb(0x3c4, 2); + outb(0x3c5, value); +} + +/* bit mask register */ +static void BitMask(int value) { + outb(0x3ce, 8); + outb(0x3cf, value); +} + + +/* Set the splash image */ +void graphics_set_splash(char *splashfile) { + grub_strcpy(splashimage, splashfile); +} + +/* Get the current splash image */ +char *graphics_get_splash(void) { + return splashimage; +} + +/* Initialize a vga16 graphics display with the palette based off of + * the image in splashimage. If the image doesn't exist, leave graphics + * mode. */ +int graphics_init() +{ + if (!graphics_inited) { + saved_videomode = set_videomode(0x12); + } + + if (!read_image(splashimage)) { + set_videomode(saved_videomode); + grub_printf("failed to read image\n"); + return 0; + } + + font8x16 = (unsigned char*)graphics_get_font(); + + graphics_inited = 1; + + /* make sure that the highlight color is set correctly */ + graphics_highlight_color = ((graphics_normal_color >> 4) | + ((graphics_normal_color & 0xf) << 4)); + + return 1; +} + +/* Leave graphics mode */ +void graphics_end(void) +{ + if (graphics_inited) { + set_videomode(saved_videomode); + graphics_inited = 0; + } +} + +/* Print ch on the screen. Handle any needed scrolling or the like */ +void graphics_putchar(int ch) { + ch &= 0xff; + + graphics_cursor(0); + + if (ch == '\n') { + if (fonty + 1 < y1) + graphics_setxy(fontx, fonty + 1); + else + graphics_scroll(); + graphics_cursor(1); + return; + } else if (ch == '\r') { + graphics_setxy(x0, fonty); + graphics_cursor(1); + return; + } + + graphics_cursor(0); + + text[fonty * ROWBYTES + fontx] = ch; + text[fonty * ROWBYTES + fontx] &= 0x00ff; + if (graphics_current_color & 0xf0) + text[fonty * ROWBYTES + fontx] |= 0x100; + + graphics_cursor(0); + + if ((fontx + 1) >= x1) { + graphics_setxy(x0, fonty); + if (fonty + 1 < y1) + graphics_setxy(x0, fonty + 1); + else + graphics_scroll(); + } else { + graphics_setxy(fontx + 1, fonty); + } + + graphics_cursor(1); +} + +/* get the current location of the cursor */ +int graphics_getxy(void) { + return (fontx << 8) | fonty; +} + +void graphics_gotoxy(int x, int y) { + graphics_cursor(0); + + graphics_setxy(x, y); + + graphics_cursor(1); +} + +void graphics_cls(void) { + int i; + unsigned char *mem; + + graphics_cursor(0); + graphics_gotoxy(x0, y0); + + mem = (unsigned char*)VIDEOMEM; + + for (i = 0; i < ROWBYTES * 30; i++) + text[i] = ' '; + graphics_cursor(1); + + BitMask(0xff); + + /* plane 1 */ + MapMask(1); + grub_memcpy(mem, s1, SCREENBYTES); + + /* plane 2 */ + MapMask(2); + grub_memcpy(mem, s2, SCREENBYTES); + + /* plane 3 */ + MapMask(4); + grub_memcpy(mem, s4, SCREENBYTES); + + /* plane 4 */ + MapMask(8); + grub_memcpy(mem, s8, SCREENBYTES); + + MapMask(15); +} + +void graphics_setcolorstate (color_state state) { + switch (state) { + case COLOR_STATE_STANDARD: + graphics_current_color = graphics_standard_color; + break; + case COLOR_STATE_NORMAL: + graphics_current_color = graphics_normal_color; + break; + case COLOR_STATE_HIGHLIGHT: + graphics_current_color = graphics_highlight_color; + break; + default: + graphics_current_color = graphics_standard_color; + break; + } + + graphics_color_state = state; +} + +void graphics_setcolor (int normal_color, int highlight_color) { + graphics_normal_color = normal_color; + graphics_highlight_color = highlight_color; + + graphics_setcolorstate (graphics_color_state); +} + +int graphics_setcursor (int on) { + /* FIXME: we don't have a cursor in graphics */ + return 1; +} + +void +draw_xbmlogo(void) +{ + unsigned char mask; + unsigned xbm_index = 0, xbm_incr; + unsigned screenx, logox, logoy, fb_offset, fb_index; + + /* + * Place the logo such that the right hand side will be four pixels from + * the right hand edge of the screen and the bottom will be two pixels + * from the bottom edge. + */ + fb_offset = ((VPIXELS - 1) - logo_height - 2) * ROWBYTES; + xbm_incr = (logo_width / 8) + 1; + + for (logoy = 0; logoy < logo_height; logoy++) { + for (logox = 0, screenx = (HPIXELS - 1) - logo_width - 4; + logox < logo_width; logox++, screenx++) { + mask = 0x80 >> (screenx & 7); + fb_index = fb_offset + (screenx >> 3); + + /* + * If a bit is clear in the bitmap, draw it onto the + * framebuffer in the default foreground color. + */ + if ((logo_bits[xbm_index + (logox >> 3)] & + (1 << (logox & 7))) == 0) { + /* system default foreground color */ + s1[fb_index] |= mask; + s2[fb_index] |= mask; + s4[fb_index] |= mask; + s8[fb_index] |= mask; + } + } + + xbm_index += xbm_incr; + fb_offset += ROWBYTES; + } +} + +/* + * Read in the splashscreen image and set the palette up appropriately. + * + * Format of splashscreen is an XPM (can be gzipped) with up to 15 colors and + * is assumed to be of the proper screen dimensions. + */ +int read_image(char *s) +{ + char buf[32], pal[16]; + unsigned char c, base, mask; + unsigned i, len, idx, colors, x, y, width, height; + + if (!grub_open(s)) + return 0; + + /* read XPM header - must match memcmp string PRECISELY. */ + if (!grub_read((char*)&buf, 10) || grub_memcmp(buf, "/* XPM */\n", 10)) { + grub_close(); + return 0; + } + + /* skip characters until we reach an initial '"' */ + while (grub_read(&c, 1)) { + if (c == '"') + break; + } + + /* skip whitespace */ + while (grub_read(&c, 1) && (c == ' ' || c == '\t')) + ; + + /* + * Format here should be four integers: + * + * Width Height NumberOfColors CharactersPerPixel + */ + i = 0; + width = c - '0'; + while (grub_read(&c, 1)) { + if (c >= '0' && c <= '9') + width = width * 10 + c - '0'; + else + break; + } + + /* skip whitespace to advance to next digit */ + while (grub_read(&c, 1) && (c == ' ' || c == '\t')) + ; + + height = c - '0'; + while (grub_read(&c, 1)) { + if (c >= '0' && c <= '9') + height = height * 10 + c - '0'; + else + break; + } + + /* skip whitespace to advance to next digit */ + while (grub_read(&c, 1) && (c == ' ' || c == '\t')) ; + + colors = c - '0'; + while (grub_read(&c, 1)) { + if (c >= '0' && c <= '9') + colors = colors * 10 + c - '0'; + else + break; + } + + /* allow 14 specified palette colors (indices 1 - 14) at most */ + if (colors > 14) { + grub_close(); + return (0); + } + + /* eat rest of line - assumes chars per pixel is one */ + while (grub_read(&c, 1) && c != '"') + ; + + /* + * Parse the XPM palette - the format is: + * + * identifier colorspace #RRGGBB + * + * The identifier is simply a single character; the colorspace identifier + * is skipped as it's assumed to be "c" denoting RGB color. + * + * The six digits after the "#" are assumed to be a six digit RGB color + * identifier as defined in X11's rgb.txt file. + */ + for (i = 0, idx = 1; i < colors; i++) { + len = 0; + + while (grub_read(&c, 1) && c != '"') + ; + + grub_read(&c, 1); /* char */ + base = c; + grub_read(buf, 4); /* \t c # */ + + while (grub_read(&c, 1) && c != '"') { + if (len < sizeof(buf)) + buf[len++] = c; + } + + if (len == 6) { + int r = ((hex(buf[0]) << 4) | hex(buf[1])) >> 2; + int g = ((hex(buf[2]) << 4) | hex(buf[3])) >> 2; + int b = ((hex(buf[4]) << 4) | hex(buf[5])) >> 2; + + pal[idx] = base; + graphics_set_palette(idx, r, g, b); + ++idx; + } + } + + x = y = len = 0; + + /* clear (zero out) all four planes of the framebuffer */ + for (i = 0; i < SCREENBYTES; i++) + s1[i] = s2[i] = s4[i] = s8[i] = 0; + + /* parse the XPM data */ + while (y < height) { + /* exit on EOF, otherwise skip characters until an initial '"' */ + while (1) { + if (!grub_read(&c, 1)) { + grub_close(); + return 0; + } + if (c == '"') + break; + } + + /* read characters until we hit an EOF or a terminating '"' */ + while (grub_read(&c, 1) && c != '"') { + + /* look up specified pixel color in palette */ + for (i = 1; i < 15; i++) + if (pal[i] == c) { + c = i; + break; + } + + /* + * A bit is set in each of the "planes" of the frame buffer to + * denote a pixel drawn in each color of the palette. + * + * The planes are a binary representation of the palette, so a + * pixel in color "1" of the palette would be denoted by setting a + * bit in plane "s1"; a pixel in color "15" of the palette would + * set the same bit in each of the four planes. + * + * Pixels are represented by set bits in a byte, in the order + * left-to-right (e.g. pixel 0 is 0x80, pixel 7 is 1.) + */ + mask = 0x80 >> (x & 7); + if (c & 1) + s1[len + (x >> 3)] |= mask; + if (c & 2) + s2[len + (x >> 3)] |= mask; + if (c & 4) + s4[len + (x >> 3)] |= mask; + if (c & 8) + s8[len + (x >> 3)] |= mask; + + /* + * Increment "x"; if we hit pixel HPIXELS, wrap to the start of the + * next horizontal line if we haven't yet reached the bottom of + * the screen. + */ + if (++x >= HPIXELS) { + x = 0; + + if (y++ < VPIXELS) + len += ROWBYTES; + else + break; + } + } + } + + grub_close(); + + /* + * Set BIOS palette color 0 to be the system background color, 15 to be the + * system foreground color, and 17 to be the system border color. + */ + graphics_set_palette(0, (background >> 16), (background >> 8) & 63, + background & 63); + graphics_set_palette(15, (foreground >> 16), (foreground >> 8) & 63, + foreground & 63); + graphics_set_palette(0x11, (border >> 16), (border >> 8) & 63, + border & 63); + + draw_xbmlogo(); + + return 1; +} + +/* Convert a character which is a hex digit to the appropriate integer */ +int hex(int v) +{ + if (v >= 'A' && v <= 'F') + return (v - 'A' + 10); + if (v >= 'a' && v <= 'f') + return (v - 'a' + 10); + return (v - '0'); +} + + +/* move the graphics cursor location to col, row */ +static void graphics_setxy(int col, int row) { + if (col >= x0 && col < x1) { + fontx = col; + cursorX = col << 3; + } + if (row >= y0 && row < y1) { + fonty = row; + cursorY = row << 4; + } +} + +/* scroll the screen */ +static void graphics_scroll() { + int i, j; + + /* we don't want to scroll recursively... that would be bad */ + if (no_scroll) + return; + no_scroll = 1; + + /* move everything up a line */ + for (j = y0 + 1; j < y1; j++) { + graphics_gotoxy(x0, j - 1); + for (i = x0; i < x1; i++) { + graphics_putchar(text[j * ROWBYTES + i]); + } + } + + /* last line should be blank */ + graphics_gotoxy(x0, y1 - 1); + for (i = x0; i < x1; i++) + graphics_putchar(' '); + graphics_setxy(x0, y1 - 1); + + no_scroll = 0; +} + +void graphics_cursor(int set) { + unsigned char *pat, *mem, *ptr, chr[16 << 2]; + int i, ch, invert, offset; + + if (set && no_scroll) + return; + + offset = cursorY * ROWBYTES + fontx; + ch = text[fonty * ROWBYTES + fontx] & 0xff; + invert = (text[fonty * ROWBYTES + fontx] & 0xff00) != 0; + pat = font8x16 + (ch << 4); + + mem = (unsigned char*)VIDEOMEM + offset; + + if (!set) { + for (i = 0; i < 16; i++) { + unsigned char mask = pat[i]; + + if (!invert) { + chr[i ] = ((unsigned char*)VSHADOW1)[offset]; + chr[16 + i] = ((unsigned char*)VSHADOW2)[offset]; + chr[32 + i] = ((unsigned char*)VSHADOW4)[offset]; + chr[48 + i] = ((unsigned char*)VSHADOW8)[offset]; + + /* FIXME: if (shade) */ + if (1) { + if (ch == DISP_VERT || ch == DISP_LL || + ch == DISP_UR || ch == DISP_LR) { + unsigned char pmask = ~(pat[i] >> 1); + + chr[i ] &= pmask; + chr[16 + i] &= pmask; + chr[32 + i] &= pmask; + chr[48 + i] &= pmask; + } + if (i > 0 && ch != DISP_VERT) { + unsigned char pmask = ~(pat[i - 1] >> 1); + + chr[i ] &= pmask; + chr[16 + i] &= pmask; + chr[32 + i] &= pmask; + chr[48 + i] &= pmask; + if (ch == DISP_HORIZ || ch == DISP_UR || ch == DISP_LR) { + pmask = ~pat[i - 1]; + + chr[i ] &= pmask; + chr[16 + i] &= pmask; + chr[32 + i] &= pmask; + chr[48 + i] &= pmask; + } + } + } + chr[i ] |= mask; + chr[16 + i] |= mask; + chr[32 + i] |= mask; + chr[48 + i] |= mask; + + offset += ROWBYTES; + } + else { + chr[i ] = mask; + chr[16 + i] = mask; + chr[32 + i] = mask; + chr[48 + i] = mask; + } + } + } + else { + MapMask(15); + ptr = mem; + for (i = 0; i < 16; i++, ptr += ROWBYTES) { + cursorBuf[i] = pat[i]; + *ptr = ~pat[i]; + } + return; + } + + offset = 0; + for (i = 1; i < 16; i <<= 1, offset += 16) { + int j; + + MapMask(i); + ptr = mem; + for (j = 0; j < 16; j++, ptr += ROWBYTES) + *ptr = chr[j + offset]; + } + + MapMask(15); +} + +#endif /* SUPPORT_GRAPHICS */ diff --git a/usr/src/grub/grub-0.97/stage2/graphics.h b/usr/src/grub/grub-0.97/stage2/graphics.h new file mode 100644 index 0000000000..a4cd9e8b59 --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/graphics.h @@ -0,0 +1,42 @@ +/* graphics.h - graphics console interface */ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2002 Free Software Foundation, 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 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 GRAPHICS_H +#define GRAPHICS_H + +/* magic constant */ +#define VIDEOMEM 0xA0000 + +/* function prototypes */ +char *graphics_get_splash(void); + +int read_image(char *s); +void graphics_cursor(int set); + +/* function prototypes for asm functions */ +void * graphics_get_font(); +void graphics_set_palette(int idx, int red, int green, int blue); +void set_int1c_handler(); +void unset_int1c_handler(); + +extern short cursorX, cursorY; +extern char cursorBuf[16]; + +#endif /* GRAPHICS_H */ diff --git a/usr/src/grub/grub-0.97/stage2/gunzip.c b/usr/src/grub/grub-0.97/stage2/gunzip.c new file mode 100644 index 0000000000..4a905a77c1 --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/gunzip.c @@ -0,0 +1,1362 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999 Free Software Foundation, 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 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. + */ + +/* + * Most of this file was originally the source file "inflate.c", written + * by Mark Adler. It has been very heavily modified. In particular, the + * original would run through the whole file at once, and this version can + * be stopped and restarted on any boundary during the decompression process. + * + * The license and header comments that file are included here. + */ + +/* inflate.c -- Not copyrighted 1992 by Mark Adler + version c10p1, 10 January 1993 */ + +/* You can do whatever you like with this source file, though I would + prefer that if you modify it and redistribute it that you include + comments to that effect with your name and the date. Thank you. + */ + +/* + Inflate deflated (PKZIP's method 8 compressed) data. The compression + method searches for as much of the current string of bytes (up to a + length of 258) in the previous 32K bytes. If it doesn't find any + matches (of at least length 3), it codes the next byte. Otherwise, it + codes the length of the matched string and its distance backwards from + the current position. There is a single Huffman code that codes both + single bytes (called "literals") and match lengths. A second Huffman + code codes the distance information, which follows a length code. Each + length or distance code actually represents a base value and a number + of "extra" (sometimes zero) bits to get to add to the base value. At + the end of each deflated block is a special end-of-block (EOB) literal/ + length code. The decoding process is basically: get a literal/length + code; if EOB then done; if a literal, emit the decoded byte; if a + length then get the distance and emit the referred-to bytes from the + sliding window of previously emitted data. + + There are (currently) three kinds of inflate blocks: stored, fixed, and + dynamic. The compressor deals with some chunk of data at a time, and + decides which method to use on a chunk-by-chunk basis. A chunk might + typically be 32K or 64K. If the chunk is uncompressible, then the + "stored" method is used. In this case, the bytes are simply stored as + is, eight bits per byte, with none of the above coding. The bytes are + preceded by a count, since there is no longer an EOB code. + + If the data is compressible, then either the fixed or dynamic methods + are used. In the dynamic method, the compressed data is preceded by + an encoding of the literal/length and distance Huffman codes that are + to be used to decode this block. The representation is itself Huffman + coded, and so is preceded by a description of that code. These code + descriptions take up a little space, and so for small blocks, there is + a predefined set of codes, called the fixed codes. The fixed method is + used if the block codes up smaller that way (usually for quite small + chunks), otherwise the dynamic method is used. In the latter case, the + codes are customized to the probabilities in the current block, and so + can code it much better than the pre-determined fixed codes. + + The Huffman codes themselves are decoded using a mutli-level table + lookup, in order to maximize the speed of decoding plus the speed of + building the decoding tables. See the comments below that precede the + lbits and dbits tuning parameters. + */ + + +/* + 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. Similarly, 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. + */ + +#ifndef NO_DECOMPRESSION + +#include "shared.h" + +#include "filesys.h" + +/* so we can disable decompression */ +int no_decompression = 0; + +/* used to tell if "read" should be redirected to "gunzip_read" */ +int compressed_file; + +/* internal variables only */ +static int gzip_data_offset; +static int gzip_filepos; +static int gzip_filemax; +static int gzip_fsmax; +static int saved_filepos; +static unsigned long gzip_crc; + +static unsigned long crc; + + +/* internal extra variables for use of inflate code */ +static int block_type; +static int block_len; +static int last_block; +static int code_state; + + +/* Function prototypes */ +static void initialize_tables (void); +static unsigned long updcrc(unsigned char *, unsigned); + +/* + * Linear allocator. + */ + +static unsigned long linalloc_topaddr; + +static void * +linalloc (int size) +{ + linalloc_topaddr = (linalloc_topaddr - size) & ~3; + return (void *) linalloc_topaddr; +} + +static void +reset_linalloc (void) +{ + linalloc_topaddr = RAW_ADDR ((mbi.mem_upper << 10) + 0x100000); + linalloc_topaddr -= ZFS_SCRATCH_SIZE; +} + + +/* internal variable swap function */ +static void +gunzip_swap_values (void) +{ + register int itmp; + + /* swap filepos */ + itmp = filepos; + filepos = gzip_filepos; + gzip_filepos = itmp; + + /* swap filemax */ + itmp = filemax; + filemax = gzip_filemax; + gzip_filemax = itmp; + + /* swap fsmax */ + itmp = fsmax; + fsmax = gzip_fsmax; + gzip_fsmax = itmp; +} + + +/* internal function for eating variable-length header fields */ +static int +bad_field (int len) +{ + char ch = 1; + int not_retval = 1; + + do + { + if (len >= 0) + { + if (!(len--)) + break; + } + else + { + if (!ch) + break; + } + } + while ((not_retval = grub_read (&ch, 1)) == 1); + + return (!not_retval); +} + + +/* Little-Endian defines for the 2-byte magic number for gzip files */ +#define GZIP_HDR_LE 0x8B1F +#define OLD_GZIP_HDR_LE 0x9E1F + +/* Compression methods (see algorithm.doc) */ +#define STORED 0 +#define COMPRESSED 1 +#define PACKED 2 +#define LZHED 3 +/* methods 4 to 7 reserved */ +#define DEFLATED 8 +#define MAX_METHODS 9 + +/* gzip flag byte */ +#define ASCII_FLAG 0x01 /* bit 0 set: file probably ascii text */ +#define CONTINUATION 0x02 /* bit 1 set: continuation of multi-part gzip file */ +#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 ENCRYPTED 0x20 /* bit 5 set: file is encrypted */ +#define RESERVED 0xC0 /* bit 6,7: reserved */ + +#define UNSUPP_FLAGS (CONTINUATION|ENCRYPTED|RESERVED) + +/* inflate block codes */ +#define INFLATE_STORED 0 +#define INFLATE_FIXED 1 +#define INFLATE_DYNAMIC 2 + +typedef unsigned char uch; +typedef unsigned short ush; +typedef unsigned long ulg; + +/* + * Window Size + * + * This must be a power of two, and at least 32K for zip's deflate method + */ + +#define WSIZE 0x8000 + + +int +gunzip_test_header (void) +{ + unsigned char buf[10]; + + /* "compressed_file" is already reset to zero by this point */ + + /* + * This checks if the file is gzipped. If a problem occurs here + * (other than a real error with the disk) then we don't think it + * is a compressed file, and simply mark it as such. + */ + if (no_decompression + || grub_read (buf, 10) != 10 + || ((*((unsigned short *) buf) != GZIP_HDR_LE) + && (*((unsigned short *) buf) != OLD_GZIP_HDR_LE))) + { + filepos = 0; + return ! errnum; + } + + /* + * This does consistency checking on the header data. If a + * problem occurs from here on, then we have corrupt or otherwise + * bad data, and the error should be reported to the user. + */ + if (buf[2] != DEFLATED + || (buf[3] & UNSUPP_FLAGS) + || ((buf[3] & EXTRA_FIELD) + && (grub_read (buf, 2) != 2 + || bad_field (*((unsigned short *) buf)))) + || ((buf[3] & ORIG_NAME) && bad_field (-1)) + || ((buf[3] & COMMENT) && bad_field (-1))) + { + if (! errnum) + errnum = ERR_BAD_GZIP_HEADER; + + return 0; + } + + gzip_data_offset = filepos; + + /* We could read the last 8 bytes of the file to get the uncompressed + * size. Doing so under tftp would cause the file to be downloaded + * twice, which can be problem with large files. So we set it to + * MAXINT and correct it later when we get to the end of the file + * in get_byte(). + */ + gzip_fsmax = gzip_filemax = MAXINT; + + initialize_tables (); + + compressed_file = 1; + gunzip_swap_values (); + /* + * Now "gzip_*" values refer to the compressed data. + */ + + filepos = 0; + + crc = (ulg)0xffffffffUL; + + return 1; +} + + +/* 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). + Valid extra bits are 0..13. e == 15 is EOB (end of block), e == 16 + means that v is a literal, 16 < e < 32 means that v is a pointer to + the next table, which codes e - 16 bits, and lastly e == 99 indicates + an unused code. If a code with e == 99 is looked up, this implies an + error in the data. */ +struct huft +{ + uch e; /* number of extra bits or operation */ + uch b; /* number of bits in this code or subcode */ + union + { + ush n; /* literal, length base, or distance base */ + struct huft *t; /* pointer to next level of table */ + } + v; +}; + + +/* The inflate algorithm uses a sliding 32K byte window on the uncompressed + stream to find repeated byte strings. This is implemented here as a + circular buffer. The index is updated simply by incrementing and then + and'ing with 0x7fff (32K-1). */ +/* It is left to other modules to supply the 32K area. It is assumed + to be usable as if it were declared "uch slide[32768];" or as just + "uch *slide;" and then malloc'ed in the latter case. The definition + must be in unzip.h, included above. */ + + +/* sliding window in uncompressed data */ +static uch slide[WSIZE]; + +/* current position in slide */ +static unsigned wp; + + +/* Tables for deflate from PKZIP's appnote.txt. */ +static unsigned bitorder[] = +{ /* 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}; +static ush cplens[] = +{ /* 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}; + /* note: see note #13 above about the 258 in this list. */ +static ush cplext[] = +{ /* 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, 99, 99}; /* 99==invalid */ +static ush cpdist[] = +{ /* 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}; +static ush cpdext[] = +{ /* 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. + */ + + +static int lbits = 9; /* bits in base literal/length lookup table */ +static int dbits = 6; /* bits in base distance lookup table */ + + +/* If BMAX needs to be larger than 16, then h and x[] should be ulg. */ +#define BMAX 16 /* maximum bit length of any code (16 for explode) */ +#define N_MAX 288 /* maximum number of codes in any set */ + + +static unsigned hufts; /* track memory usage */ + + +/* Macros for inflate() bit peeking and grabbing. + The usage is: + + NEEDBITS(j) + x = b & mask_bits[j]; + DUMPBITS(j) + + where NEEDBITS makes sure that b has at least j bits in it, and + DUMPBITS removes the bits from b. The macros use the variable k + for the number of bits in b. Normally, b and k are register + variables for speed, and are initialized at the beginning of a + routine that uses these macros from a global bit buffer and count. + + If we assume that EOB will be the longest code, then we will never + ask for bits with NEEDBITS that are beyond the end of the stream. + So, NEEDBITS should not read any more bytes than are needed to + meet the request. Then no bytes need to be "returned" to the buffer + at the end of the last block. + + However, this assumption is not true for fixed blocks--the EOB code + is 7 bits, but the other literal/length codes can be 8 or 9 bits. + (The EOB code is shorter than other codes because fixed blocks are + generally short. So, while a block always has an EOB, many other + literal/length codes have a significantly lower probability of + showing up at all.) However, by making the first table have a + lookup of seven bits, the EOB code will be found in that first + lookup, and so will not require that too many bits be pulled from + the stream. + */ + +static ulg bb; /* bit buffer */ +static unsigned bk; /* bits in bit buffer */ + +static ush mask_bits[] = +{ + 0x0000, + 0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff, + 0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff +}; + +#define NEEDBITS(n) do {while(k<(n)){b|=((ulg)get_byte())<>=(n);k-=(n);} while (0) + +#define INBUFSIZ 0x2000 + +static uch inbuf[INBUFSIZ]; +static int bufloc; +static uch endbuf[8]; + +static int +get_byte (void) +{ + if (filepos == gzip_data_offset || bufloc == INBUFSIZ) + { + int pos; + int old_filepos = filepos; + bufloc = 0; + grub_read (inbuf, INBUFSIZ); + /* If there are 8 bytes or less left, we have read in all the + * the file content. So get the last 8 bytes and get the crc + * and uncompressed size. This is important for the loop in + * gunzip_read() to terminate properly. + */ + if (filepos >= filemax - 8) { + uch *eb = endbuf; + for (pos = filemax - 8; pos < filepos; pos++) + *eb++ = inbuf[pos - old_filepos]; + if (filemax > filepos) + grub_read(eb, filemax - filepos); + gzip_crc = *((unsigned long *) endbuf); + gzip_filemax = *((unsigned long *) (endbuf + 4)); + } + } + + return inbuf[bufloc++]; +} + +/* decompression global pointers */ +static struct huft *tl; /* literal/length code table */ +static struct huft *td; /* distance code table */ +static int bl; /* lookup bits for tl */ +static int bd; /* lookup bits for td */ + + +/* more function prototypes */ +static int huft_build (unsigned *, unsigned, unsigned, ush *, ush *, + struct huft **, int *); +static int inflate_codes_in_window (void); + + +/* Given a list of code lengths and a maximum table size, make a set of + tables to decode that set of codes. Return zero on success, one if + the given code set is incomplete (the tables are still built in this + case), two if the input is invalid (all zero length codes or an + oversubscribed set of lengths), and three if not enough memory. */ + +static int +huft_build (unsigned *b, /* code lengths in bits (all assumed <= BMAX) */ + unsigned n, /* number of codes (assumed <= N_MAX) */ + unsigned s, /* number of simple-valued codes (0..s-1) */ + ush * d, /* list of base values for non-simple codes */ + ush * e, /* list of extra bits for non-simple codes */ + struct huft **t, /* result: starting table */ + int *m) /* maximum lookup bits, returns actual */ +{ + unsigned a; /* counter for codes of length k */ + unsigned c[BMAX + 1]; /* bit length count table */ + unsigned f; /* i repeats in table every f entries */ + int g; /* maximum code length */ + int h; /* table level */ + register unsigned i; /* counter, current code */ + register unsigned j; /* counter */ + register int k; /* number of bits in current code */ + int l; /* bits per table (returned in m) */ + register unsigned *p; /* pointer into c[], b[], or v[] */ + register struct huft *q; /* points to current table */ + struct huft r; /* table entry for structure assignment */ + struct huft *u[BMAX]; /* table stack */ + unsigned v[N_MAX]; /* values in order of bit length */ + register int w; /* bits before this table == (l * h) */ + unsigned x[BMAX + 1]; /* bit offsets, then code stack */ + unsigned *xp; /* pointer into x */ + int y; /* number of dummy codes added */ + unsigned z; /* number of entries in current table */ + + /* Generate counts for each bit length */ + memset ((char *) c, 0, sizeof (c)); + p = b; + i = n; + do + { + c[*p]++; /* assume all entries <= BMAX */ + p++; /* Can't combine with above line (Solaris bug) */ + } + while (--i); + if (c[0] == n) /* null input--all zero length codes */ + { + *t = (struct huft *) NULL; + *m = 0; + return 0; + } + + /* 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 ((unsigned) l < j) + l = j; + for (i = BMAX; i; i--) + if (c[i]) + break; + g = i; /* maximum code length */ + if ((unsigned) 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 2; /* bad input: more codes than bits */ + if ((y -= c[i]) < 0) + return 2; + 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); + + /* 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] = (struct huft *) NULL; /* just to keep compilers happy */ + q = (struct huft *) 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 = (z = g - w) > (unsigned) l ? l : z; /* upper limit on table size */ + 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; + 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 and link in new table */ + q = (struct huft *) linalloc ((z + 1) * sizeof (struct huft)); + + hufts += z + 1; /* track memory usage */ + *t = q + 1; /* link to list for huft_free() */ + *(t = &(q->v.t)) = (struct huft *) NULL; + u[h] = ++q; /* table starts after link */ + + /* connect to last table, if there is one */ + if (h) + { + x[h] = i; /* save pattern for backing up */ + r.b = (uch) l; /* bits to dump before this table */ + r.e = (uch) (16 + j); /* bits in this table */ + r.v.t = q; /* pointer to this table */ + j = i >> (w - l); /* (get around Turbo C bug) */ + u[h - 1][j] = r; /* connect to last table */ + } + } + + /* set up table entry in r */ + r.b = (uch) (k - w); + if (p >= v + n) + r.e = 99; /* out of values--invalid code */ + else if (*p < s) + { + r.e = (uch) (*p < 256 ? 16 : 15); /* 256 is end-of-block code */ + r.v.n = (ush) (*p); /* simple code is just the value */ + p++; /* one compiler does not like *p++ */ + } + else + { + r.e = (uch) e[*p - s]; /* non-simple--look up in lists */ + r.v.n = 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 */ + while ((i & ((1 << w) - 1)) != x[h]) + { + h--; /* don't need to update q */ + w -= l; + } + } + } + + /* Return true (1) if we were given an incomplete table */ + return y != 0 && g != 1; +} + + +/* + * inflate (decompress) the codes in a deflated (compressed) block. + * Return an error code or zero if it all goes ok. + */ + +static unsigned inflate_n, inflate_d; + +static int +inflate_codes_in_window (void) +{ + register unsigned e; /* table entry flag/number of extra bits */ + unsigned n, d; /* length and index for copy */ + unsigned w; /* current window position */ + struct huft *t; /* pointer to table entry */ + unsigned ml, md; /* masks for bl and bd bits */ + register ulg b; /* bit buffer */ + register unsigned k; /* number of bits in bit buffer */ + + /* make local copies of globals */ + d = inflate_d; + n = inflate_n; + b = bb; /* initialize bit buffer */ + k = bk; + w = wp; /* initialize window position */ + + /* inflate the coded data */ + ml = mask_bits[bl]; /* precompute masks for speed */ + md = mask_bits[bd]; + for (;;) /* do until end of block */ + { + if (!code_state) + { + NEEDBITS ((unsigned) bl); + if ((e = (t = tl + ((unsigned) b & ml))->e) > 16) + do + { + if (e == 99) + { + errnum = ERR_BAD_GZIP_DATA; + return 0; + } + DUMPBITS (t->b); + e -= 16; + NEEDBITS (e); + } + while ((e = (t = t->v.t + ((unsigned) b & mask_bits[e]))->e) > 16); + DUMPBITS (t->b); + + if (e == 16) /* then it's a literal */ + { + slide[w++] = (uch) t->v.n; + if (w == WSIZE) + break; + } + else + /* it's an EOB or a length */ + { + /* exit if end of block */ + if (e == 15) + { + block_len = 0; + break; + } + + /* get length of block to copy */ + NEEDBITS (e); + n = t->v.n + ((unsigned) b & mask_bits[e]); + DUMPBITS (e); + + /* decode distance of block to copy */ + NEEDBITS ((unsigned) bd); + if ((e = (t = td + ((unsigned) b & md))->e) > 16) + do + { + if (e == 99) + { + errnum = ERR_BAD_GZIP_DATA; + return 0; + } + DUMPBITS (t->b); + e -= 16; + NEEDBITS (e); + } + while ((e = (t = t->v.t + ((unsigned) b & mask_bits[e]))->e) + > 16); + DUMPBITS (t->b); + NEEDBITS (e); + d = w - t->v.n - ((unsigned) b & mask_bits[e]); + DUMPBITS (e); + code_state++; + } + } + + if (code_state) + { + /* do the copy */ + do + { + n -= (e = (e = WSIZE - ((d &= WSIZE - 1) > w ? d : w)) > n ? n + : e); + if (w - d >= e) + { + memmove (slide + w, slide + d, e); + w += e; + d += e; + } + else + /* purposefully use the overlap for extra copies here!! */ + { + while (e--) + slide[w++] = slide[d++]; + } + if (w == WSIZE) + break; + } + while (n); + + if (!n) + code_state--; + + /* did we break from the loop too soon? */ + if (w == WSIZE) + break; + } + } + + /* restore the globals from the locals */ + inflate_d = d; + inflate_n = n; + wp = w; /* restore global window pointer */ + bb = b; /* restore global bit buffer */ + bk = k; + + return !block_len; +} + + +/* get header for an inflated type 0 (stored) block. */ + +static void +init_stored_block (void) +{ + register ulg b; /* bit buffer */ + register unsigned k; /* number of bits in bit buffer */ + + /* make local copies of globals */ + b = bb; /* initialize bit buffer */ + k = bk; + + /* go to byte boundary */ + DUMPBITS (k & 7); + + /* get the length and its complement */ + NEEDBITS (16); + block_len = ((unsigned) b & 0xffff); + DUMPBITS (16); + NEEDBITS (16); + if (block_len != (unsigned) ((~b) & 0xffff)) + errnum = ERR_BAD_GZIP_DATA; + DUMPBITS (16); + + /* restore global variables */ + bb = b; + bk = k; +} + + +/* get header for an inflated type 1 (fixed Huffman codes) block. We should + either replace this with a custom decoder, or at least precompute the + Huffman tables. */ + +static void +init_fixed_block () +{ + int i; /* temporary variable */ + unsigned l[288]; /* length list for huft_build */ + + /* set up literal table */ + for (i = 0; i < 144; i++) + l[i] = 8; + for (; i < 256; i++) + l[i] = 9; + for (; i < 280; i++) + l[i] = 7; + for (; i < 288; i++) /* make a complete, but wrong code set */ + l[i] = 8; + bl = 7; + if ((i = huft_build (l, 288, 257, cplens, cplext, &tl, &bl)) != 0) + { + errnum = ERR_BAD_GZIP_DATA; + return; + } + + /* set up distance table */ + for (i = 0; i < 30; i++) /* make an incomplete code set */ + l[i] = 5; + bd = 5; + if ((i = huft_build (l, 30, 0, cpdist, cpdext, &td, &bd)) > 1) + { + errnum = ERR_BAD_GZIP_DATA; + return; + } + + /* indicate we're now working on a block */ + code_state = 0; + block_len++; +} + + +/* get header for an inflated type 2 (dynamic Huffman codes) block. */ + +static void +init_dynamic_block (void) +{ + int i; /* temporary variables */ + unsigned j; + unsigned l; /* last length */ + unsigned m; /* mask for bit lengths table */ + unsigned n; /* number of lengths to get */ + unsigned nb; /* number of bit length codes */ + unsigned nl; /* number of literal/length codes */ + unsigned nd; /* number of distance codes */ + unsigned ll[286 + 30]; /* literal/length and distance code lengths */ + register ulg b; /* bit buffer */ + register unsigned k; /* number of bits in bit buffer */ + + /* make local bit buffer */ + b = bb; + k = bk; + + /* read in table lengths */ + NEEDBITS (5); + nl = 257 + ((unsigned) b & 0x1f); /* number of literal/length codes */ + DUMPBITS (5); + NEEDBITS (5); + nd = 1 + ((unsigned) b & 0x1f); /* number of distance codes */ + DUMPBITS (5); + NEEDBITS (4); + nb = 4 + ((unsigned) b & 0xf); /* number of bit length codes */ + DUMPBITS (4); + if (nl > 286 || nd > 30) + { + errnum = ERR_BAD_GZIP_DATA; + return; + } + + /* read in bit-length-code lengths */ + for (j = 0; j < nb; j++) + { + NEEDBITS (3); + ll[bitorder[j]] = (unsigned) b & 7; + DUMPBITS (3); + } + for (; j < 19; j++) + ll[bitorder[j]] = 0; + + /* build decoding table for trees--single level, 7 bit lookup */ + bl = 7; + if ((i = huft_build (ll, 19, 19, NULL, NULL, &tl, &bl)) != 0) + { + errnum = ERR_BAD_GZIP_DATA; + return; + } + + /* read in literal and distance code lengths */ + n = nl + nd; + m = mask_bits[bl]; + i = l = 0; + while ((unsigned) i < n) + { + NEEDBITS ((unsigned) bl); + j = (td = tl + ((unsigned) b & m))->b; + DUMPBITS (j); + j = td->v.n; + if (j < 16) /* length of code in bits (0..15) */ + ll[i++] = l = j; /* save last length in l */ + else if (j == 16) /* repeat last length 3 to 6 times */ + { + NEEDBITS (2); + j = 3 + ((unsigned) b & 3); + DUMPBITS (2); + if ((unsigned) i + j > n) + { + errnum = ERR_BAD_GZIP_DATA; + return; + } + while (j--) + ll[i++] = l; + } + else if (j == 17) /* 3 to 10 zero length codes */ + { + NEEDBITS (3); + j = 3 + ((unsigned) b & 7); + DUMPBITS (3); + if ((unsigned) i + j > n) + { + errnum = ERR_BAD_GZIP_DATA; + return; + } + while (j--) + ll[i++] = 0; + l = 0; + } + else + /* j == 18: 11 to 138 zero length codes */ + { + NEEDBITS (7); + j = 11 + ((unsigned) b & 0x7f); + DUMPBITS (7); + if ((unsigned) i + j > n) + { + errnum = ERR_BAD_GZIP_DATA; + return; + } + while (j--) + ll[i++] = 0; + l = 0; + } + } + + /* free decoding table for trees */ + reset_linalloc (); + + /* restore the global bit buffer */ + bb = b; + bk = k; + + /* build the decoding tables for literal/length and distance codes */ + bl = lbits; + if ((i = huft_build (ll, nl, 257, cplens, cplext, &tl, &bl)) != 0) + { +#if 0 + if (i == 1) + printf ("gunzip: incomplete literal tree\n"); +#endif + + errnum = ERR_BAD_GZIP_DATA; + return; + } + bd = dbits; + if ((i = huft_build (ll + nl, nd, 0, cpdist, cpdext, &td, &bd)) != 0) + { +#if 0 + if (i == 1) + printf ("gunzip: incomplete distance tree\n"); +#endif + + errnum = ERR_BAD_GZIP_DATA; + return; + } + + /* indicate we're now working on a block */ + code_state = 0; + block_len++; +} + + +static void +get_new_block (void) +{ + register ulg b; /* bit buffer */ + register unsigned k; /* number of bits in bit buffer */ + + hufts = 0; + + /* make local bit buffer */ + b = bb; + k = bk; + + /* read in last block bit */ + NEEDBITS (1); + last_block = (int) b & 1; + DUMPBITS (1); + + /* read in block type */ + NEEDBITS (2); + block_type = (unsigned) b & 3; + DUMPBITS (2); + + /* restore the global bit buffer */ + bb = b; + bk = k; + + if (block_type == INFLATE_STORED) + init_stored_block (); + if (block_type == INFLATE_FIXED) + init_fixed_block (); + if (block_type == INFLATE_DYNAMIC) + init_dynamic_block (); +} + + +static void +inflate_window (void) +{ + /* initialize window */ + wp = 0; + + /* + * Main decompression loop. + */ + + while (wp < WSIZE && !errnum) + { + if (!block_len) + { + if (last_block) + break; + + get_new_block (); + } + + if (block_type > INFLATE_DYNAMIC) + errnum = ERR_BAD_GZIP_DATA; + + if (errnum) + return; + + /* + * Expand stored block here. + */ + if (block_type == INFLATE_STORED) + { + int w = wp; + + /* + * This is basically a glorified pass-through + */ + + while (block_len && w < WSIZE && !errnum) + { + slide[w++] = get_byte (); + block_len--; + } + + wp = w; + + continue; + } + + /* + * Expand other kind of block. + */ + + if (inflate_codes_in_window ()) + reset_linalloc (); + } + + saved_filepos += WSIZE; +} + + +static void +initialize_tables (void) +{ + saved_filepos = 0; + filepos = gzip_data_offset; + + /* initialize window, bit buffer */ + bk = 0; + bb = 0; + + /* reset partial decompression code */ + last_block = 0; + block_len = 0; + + /* reset memory allocation stuff */ + reset_linalloc (); +} + + +int +gunzip_read (char *buf, int len) +{ + int ret = 0; + int check_crc; + ulg crc_value = 0xffffffffUL; + + compressed_file = 0; + gunzip_swap_values (); + /* + * Now "gzip_*" values refer to the uncompressed data. + */ + + /* do we reset decompression to the beginning of the file? */ + if (saved_filepos > gzip_filepos + WSIZE) + initialize_tables (); + + /* perform CRC check only if reading the entire file */ + check_crc = (saved_filepos == 0 && len == MAXINT); + + /* + * This loop operates upon uncompressed data only. The only + * special thing it does is to make sure the decompression + * window is within the range of data it needs. + */ + + while (len > 0 && !errnum) + { + register int size; + register char *srcaddr; + + while (gzip_filepos >= saved_filepos && !errnum) + inflate_window (); + + if (errnum) + break; + + /* We could have started with an unknown gzip_filemax (MAXINT) + * which has been updated in get_byte(). If so, update len + * to avoid reading beyond the end. + */ + if (len > (gzip_filemax - gzip_filepos)) { + len = gzip_filemax - gzip_filepos; + if (len < 0) { + errnum = ERR_BAD_GZIP_DATA; + break; + } + } + + srcaddr = (char *) ((gzip_filepos & (WSIZE - 1)) + slide); + size = saved_filepos - gzip_filepos; + if (size > len) + size = len; + + memmove (buf, srcaddr, size); + + /* do CRC calculation here! */ + crc_value = updcrc(buf, (unsigned)size); + + buf += size; + len -= size; + gzip_filepos += size; + ret += size; + } + + /* check for CRC error if reading entire file */ + if (!errnum && check_crc && gzip_crc != crc_value) { +#if 0 + printf ("gunzip: crc value 0x%x, expected 0x%x\n", crc_value, gzip_crc); +#endif + errnum = ERR_BAD_GZIP_CRC; + } + + compressed_file = 1; + gunzip_swap_values (); + /* + * Now "gzip_*" values refer to the compressed data. + */ + + if (errnum) + ret = 0; + + return ret; +} + +/* The crc_23_tab and updcrc() are adapted from gzip 1.3.3 */ + +/* ======================================================================== + * Table of CRC-32's of all single-byte values (made by makecrc.c) + */ +static ulg crc_32_tab[] = { + 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 +}; + +/* =========================================================================== + * Run a set of bytes through the crc shift register. If s is a NULL + * pointer, then initialize the crc shift register contents instead. + * Return the current crc in either case. + */ +static ulg updcrc(s, n) + uch *s; /* pointer to bytes to pump through */ + unsigned n; /* number of bytes in s[] */ +{ + register ulg c; /* temporary variable */ + + c = crc; + if (n) do { + c = crc_32_tab[((int)c ^ (*s++)) & 0xff] ^ (c >> 8); + } while (--n); + crc = c; + return c ^ 0xffffffffL; /* (instead of ~c for 64-bit machines) */ +} + +#endif /* ! NO_DECOMPRESSION */ diff --git a/usr/src/grub/grub-0.97/stage2/hercules.c b/usr/src/grub/grub-0.97/stage2/hercules.c new file mode 100644 index 0000000000..4c0280bafc --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/hercules.c @@ -0,0 +1,186 @@ +/* hercules.c - hercules console interface */ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2001,2002 Free Software Foundation, 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 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. + */ + +#ifdef SUPPORT_HERCULES + +#include +#include +#include + +/* The position of the cursor. */ +static int herc_x; +static int herc_y; + +static int herc_standard_color = A_NORMAL; +static int herc_normal_color = A_NORMAL; +static int herc_highlight_color = A_REVERSE; +static int herc_current_color = A_NORMAL; +static color_state herc_color_state = COLOR_STATE_STANDARD; +static int herc_cursor_state = 1; + +/* Write a byte to a port. */ +static inline void +outb (unsigned short port, unsigned char value) +{ + asm volatile ("outb %b0, %w1" : : "a" (value), "Nd" (port)); +} + +static void +herc_set_cursor (void) +{ + unsigned offset = herc_y * HERCULES_WIDTH + herc_x; + + outb (HERCULES_INDEX_REG, 0x0f); + outb (0x80, 0); + outb (HERCULES_DATA_REG, offset & 0xFF); + outb (0x80, 0); + + outb (HERCULES_INDEX_REG, 0x0e); + outb (0x80, 0); + outb (HERCULES_DATA_REG, offset >> 8); + outb (0x80, 0); +} + +void +hercules_putchar (int c) +{ + switch (c) + { + case '\b': + if (herc_x > 0) + herc_x--; + break; + + case '\n': + herc_y++; + break; + + case '\r': + herc_x = 0; + break; + + case '\a': + break; + + default: + { + volatile unsigned short *video + = (unsigned short *) HERCULES_VIDEO_ADDR; + + video[herc_y * HERCULES_WIDTH + herc_x] + = (herc_current_color << 8) | c; + herc_x++; + if (herc_x >= HERCULES_WIDTH) + { + herc_x = 0; + herc_y++; + } + } + break; + } + + if (herc_y >= HERCULES_HEIGHT) + { + volatile unsigned long *video = (unsigned long *) HERCULES_VIDEO_ADDR; + int i; + + herc_y = HERCULES_HEIGHT - 1; + grub_memmove ((char *) HERCULES_VIDEO_ADDR, + (char *) HERCULES_VIDEO_ADDR + HERCULES_WIDTH * 2, + HERCULES_WIDTH * (HERCULES_HEIGHT - 1) * 2); + for (i = HERCULES_WIDTH * (HERCULES_HEIGHT - 1) / 2; + i < HERCULES_WIDTH * HERCULES_HEIGHT / 2; + i++) + video[i] = 0x07200720; + } +} + +void +hercules_cls (void) +{ + int i; + volatile unsigned long *video = (unsigned long *) HERCULES_VIDEO_ADDR; + + for (i = 0; i < HERCULES_WIDTH * HERCULES_HEIGHT / 2; i++) + video[i] = 0x07200720; + + herc_x = herc_y = 0; + herc_set_cursor (); +} + +int +hercules_getxy (void) +{ + return (herc_x << 8) | herc_y; +} + +void +hercules_gotoxy (int x, int y) +{ + herc_x = x; + herc_y = y; + herc_set_cursor (); +} + +void +hercules_setcolorstate (color_state state) +{ + switch (state) { + case COLOR_STATE_STANDARD: + herc_current_color = herc_standard_color; + break; + case COLOR_STATE_NORMAL: + herc_current_color = herc_normal_color; + break; + case COLOR_STATE_HIGHLIGHT: + herc_current_color = herc_highlight_color; + break; + default: + herc_current_color = herc_standard_color; + break; + } + + herc_color_state = state; +} + +void +hercules_setcolor (int normal_color, int highlight_color) +{ + herc_normal_color = normal_color; + herc_highlight_color = highlight_color; + + hercules_setcolorstate (herc_color_state); +} + +int +hercules_setcursor (int on) +{ + int old_state = herc_cursor_state; + + outb (HERCULES_INDEX_REG, 0x0a); + outb (0x80, 0); + outb (HERCULES_DATA_REG, on ? 0 : (1 << 5)); + outb (0x80, 0); + herc_cursor_state = on; + + return old_state; +} + +#endif /* SUPPORT_HERCULES */ diff --git a/usr/src/grub/grub-0.97/stage2/hercules.h b/usr/src/grub/grub-0.97/stage2/hercules.h new file mode 100644 index 0000000000..aaf794fa1e --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/hercules.h @@ -0,0 +1,31 @@ +/* hercules.h - hercules console interface */ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2001 Free Software Foundation, 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 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 GRUB_HERCULES_HEADER +#define GRUB_HERCULES_HEADER 1 + +/* Macros. */ +#define HERCULES_VIDEO_ADDR RAW_ADDR (0xB0000) +#define HERCULES_WIDTH 80 +#define HERCULES_HEIGHT 25 +#define HERCULES_INDEX_REG 0x3b4 +#define HERCULES_DATA_REG 0x3b5 + +#endif /* ! GRUB_HERCULES_HEADER */ diff --git a/usr/src/grub/grub-0.97/stage2/i386-elf.h b/usr/src/grub/grub-0.97/stage2/i386-elf.h new file mode 100644 index 0000000000..7162e3de8b --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/i386-elf.h @@ -0,0 +1,237 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2001,2002 Free Software Foundation, 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 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. + */ + +/* 32-bit data types */ + +typedef unsigned long Elf32_Addr; +typedef unsigned short Elf32_Half; +typedef unsigned long Elf32_Off; +typedef signed long Elf32_Sword; +typedef unsigned long Elf32_Word; +/* "unsigned char" already exists */ + +/* ELF header */ +typedef struct +{ + +#define EI_NIDENT 16 + + /* first four characters are defined below */ +#define EI_MAG0 0 +#define ELFMAG0 0x7f +#define EI_MAG1 1 +#define ELFMAG1 'E' +#define EI_MAG2 2 +#define ELFMAG2 'L' +#define EI_MAG3 3 +#define ELFMAG3 'F' + +#define EI_CLASS 4 /* data sizes */ +#define ELFCLASS32 1 /* i386 -- up to 32-bit data sizes present */ + +#define EI_DATA 5 /* data type and ordering */ +#define ELFDATA2LSB 1 /* i386 -- LSB 2's complement */ + +#define EI_VERSION 6 /* version number. "e_version" must be the same */ +#define EV_CURRENT 1 /* current version number */ + +#define EI_OSABI 7 /* operating system/ABI indication */ +#define ELFOSABI_FREEBSD 9 + +#define EI_ABIVERSION 8 /* ABI version */ + +#define EI_PAD 9 /* from here in is just padding */ + +#define EI_BRAND 8 /* start of OS branding (This is + obviously illegal against the ELF + standard.) */ + + unsigned char e_ident[EI_NIDENT]; /* basic identification block */ + +#define ET_EXEC 2 /* we only care about executable types */ + Elf32_Half e_type; /* file types */ + +#define EM_386 3 /* i386 -- obviously use this one */ + Elf32_Half e_machine; /* machine types */ + Elf32_Word e_version; /* use same as "EI_VERSION" above */ + Elf32_Addr e_entry; /* entry point of the program */ + Elf32_Off e_phoff; /* program header table file offset */ + Elf32_Off e_shoff; /* section header table file offset */ + Elf32_Word e_flags; /* flags */ + Elf32_Half e_ehsize; /* elf header size in bytes */ + Elf32_Half e_phentsize; /* program header entry size */ + Elf32_Half e_phnum; /* number of entries in program header */ + Elf32_Half e_shentsize; /* section header entry size */ + Elf32_Half e_shnum; /* number of entries in section header */ + +#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 + Elf32_Half e_shstrndx; /* section header table index */ +} +Elf32_Ehdr; + + +#define BOOTABLE_I386_ELF(h) \ + ((h.e_ident[EI_MAG0] == ELFMAG0) & (h.e_ident[EI_MAG1] == ELFMAG1) \ + & (h.e_ident[EI_MAG2] == ELFMAG2) & (h.e_ident[EI_MAG3] == ELFMAG3) \ + & (h.e_ident[EI_CLASS] == ELFCLASS32) & (h.e_ident[EI_DATA] == ELFDATA2LSB) \ + & (h.e_ident[EI_VERSION] == EV_CURRENT) & (h.e_type == ET_EXEC) \ + & (h.e_machine == EM_386) & (h.e_version == EV_CURRENT)) + +/* section table - ? */ +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; + +/* symbol table - page 4-25, figure 4-15 */ +typedef struct +{ + 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; + +/* symbol type and binding attributes - page 4-26 */ + +#define ELF32_ST_BIND(i) ((i) >> 4) +#define ELF32_ST_TYPE(i) ((i) & 0xf) +#define ELF32_ST_INFO(b,t) (((b)<<4)+((t)&0xf)) + +/* symbol binding - page 4-26, figure 4-16 */ + +#define STB_LOCAL 0 +#define STB_GLOBAL 1 +#define STB_WEAK 2 +#define STB_LOPROC 13 +#define STB_HIPROC 15 + +/* symbol types - page 4-28, figure 4-17 */ + +#define STT_NOTYPE 0 +#define STT_OBJECT 1 +#define STT_FUNC 2 +#define STT_SECTION 3 +#define STT_FILE 4 +#define STT_LOPROC 13 +#define STT_HIPROC 15 + + +/* Macros to split/combine relocation type and symbol page 4-32 */ + +#define ELF32_R_SYM(__i) ((__i)>>8) +#define ELF32_R_TYPE(__i) ((unsigned char) (__i)) +#define ELF32_R_INFO(__s, __t) (((__s)<<8) + (unsigned char) (__t)) + + +/* program header - page 5-2, figure 5-1 */ + +typedef struct +{ + 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; + +/* segment types - page 5-3, figure 5-2 */ + +#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_LOPROC 0x70000000 +#define PT_HIPROC 0x7fffffff + +/* segment permissions - page 5-6 */ + +#define PF_X 0x1 +#define PF_W 0x2 +#define PF_R 0x4 +#define PF_MASKPROC 0xf0000000 + + +/* dynamic structure - page 5-15, figure 5-9 */ + +typedef struct +{ + Elf32_Sword d_tag; + union + { + Elf32_Word d_val; + Elf32_Addr d_ptr; + } + d_un; +} +Elf32_Dyn; + +/* Dynamic array tags - page 5-16, figure 5-10. */ + +#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 diff --git a/usr/src/grub/grub-0.97/stage2/imgact_aout.h b/usr/src/grub/grub-0.97/stage2/imgact_aout.h new file mode 100644 index 0000000000..8b10379372 --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/imgact_aout.h @@ -0,0 +1,158 @@ + +/*- + * Copyright (c) 1992, 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. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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: @(#)exec.h 8.1 (Berkeley) 6/11/93 + * $Id: imgact_aout.h,v 1.1.1.1 2003/11/20 02:04:59 fengshuo Exp $ + */ +/* + * 11/23/95 - Kludge to get "ntohl" null macro added. -- ESB + * - and for __LDPGSZ + */ + +#ifndef _IMGACT_AOUT_H_ +#define _IMGACT_AOUT_H_ + +/* XXX ESB */ +#define ntohl(x) ((x << 24) | ((x & 0xFF00) << 8) \ + | ((x >> 8) & 0xFF00) | (x >> 24)) +#define htonl(x) ntohl(x) +#define __LDPGSZ 0x1000 + +#define N_GETMAGIC(ex) \ + ( (ex).a_midmag & 0xffff ) +#define N_GETMID(ex) \ + ( (N_GETMAGIC_NET(ex) == ZMAGIC) ? N_GETMID_NET(ex) : \ + ((ex).a_midmag >> 16) & 0x03ff ) +#define N_GETFLAG(ex) \ + ( (N_GETMAGIC_NET(ex) == ZMAGIC) ? N_GETFLAG_NET(ex) : \ + ((ex).a_midmag >> 26) & 0x3f ) +#define N_SETMAGIC(ex,mag,mid,flag) \ + ( (ex).a_midmag = (((flag) & 0x3f) <<26) | (((mid) & 0x03ff) << 16) | \ + ((mag) & 0xffff) ) + +#define N_GETMAGIC_NET(ex) \ + (ntohl((ex).a_midmag) & 0xffff) +#define N_GETMID_NET(ex) \ + ((ntohl((ex).a_midmag) >> 16) & 0x03ff) +#define N_GETFLAG_NET(ex) \ + ((ntohl((ex).a_midmag) >> 26) & 0x3f) +#define N_SETMAGIC_NET(ex,mag,mid,flag) \ + ( (ex).a_midmag = htonl( (((flag)&0x3f)<<26) | (((mid)&0x03ff)<<16) | \ + (((mag)&0xffff)) ) ) + +#define N_ALIGN(ex,x) \ + (N_GETMAGIC(ex) == ZMAGIC || N_GETMAGIC(ex) == QMAGIC || \ + N_GETMAGIC_NET(ex) == ZMAGIC || N_GETMAGIC_NET(ex) == QMAGIC ? \ + ((x) + __LDPGSZ - 1) & ~(unsigned long)(__LDPGSZ - 1) : (x)) + +/* Valid magic number check. */ +#define N_BADMAG(ex) \ + (N_GETMAGIC(ex) != OMAGIC && N_GETMAGIC(ex) != NMAGIC && \ + N_GETMAGIC(ex) != ZMAGIC && N_GETMAGIC(ex) != QMAGIC && \ + N_GETMAGIC_NET(ex) != OMAGIC && N_GETMAGIC_NET(ex) != NMAGIC && \ + N_GETMAGIC_NET(ex) != ZMAGIC && N_GETMAGIC_NET(ex) != QMAGIC) + + +/* Address of the bottom of the text segment. */ +#define N_TXTADDR(ex) \ + ((N_GETMAGIC(ex) == OMAGIC || N_GETMAGIC(ex) == NMAGIC || \ + N_GETMAGIC(ex) == ZMAGIC) ? 0 : __LDPGSZ) + +/* Address of the bottom of the data segment. */ +#define N_DATADDR(ex) \ + N_ALIGN(ex, N_TXTADDR(ex) + (ex).a_text) + +/* Text segment offset. */ +#define N_TXTOFF(ex) \ + (N_GETMAGIC(ex) == ZMAGIC ? __LDPGSZ : (N_GETMAGIC(ex) == QMAGIC || \ + N_GETMAGIC_NET(ex) == ZMAGIC) ? 0 : sizeof(struct exec)) + +/* Data segment offset. */ +#define N_DATOFF(ex) \ + N_ALIGN(ex, N_TXTOFF(ex) + (ex).a_text) + +/* Relocation table offset. */ +#define N_RELOFF(ex) \ + N_ALIGN(ex, N_DATOFF(ex) + (ex).a_data) + +/* Symbol table offset. */ +#define N_SYMOFF(ex) \ + (N_RELOFF(ex) + (ex).a_trsize + (ex).a_drsize) + +/* String table offset. */ +#define N_STROFF(ex) (N_SYMOFF(ex) + (ex).a_syms) + +/* + * Header prepended to each a.out file. + * only manipulate the a_midmag field via the + * N_SETMAGIC/N_GET{MAGIC,MID,FLAG} macros in a.out.h + */ + +struct exec + { + unsigned long a_midmag; /* htonl(flags<<26 | mid<<16 | magic) */ + unsigned long a_text; /* text segment size */ + unsigned long a_data; /* initialized data size */ + unsigned long a_bss; /* uninitialized data size */ + unsigned long a_syms; /* symbol table size */ + unsigned long a_entry; /* entry point */ + unsigned long a_trsize; /* text relocation size */ + unsigned long a_drsize; /* data relocation size */ + }; +#define a_magic a_midmag /* XXX Hack to work with current kern_execve.c */ + +/* a_magic */ +#define OMAGIC 0x107 /* 0407 old impure format */ +#define NMAGIC 0x108 /* 0410 read-only text */ +#define ZMAGIC 0x10b /* 0413 demand load format */ +#define QMAGIC 0xcc /* 0314 "compact" demand load format */ + +/* a_mid */ +#define MID_ZERO 0 /* unknown - implementation dependent */ +#define MID_SUN010 1 /* sun 68010/68020 binary */ +#define MID_SUN020 2 /* sun 68020-only binary */ +#define MID_I386 134 /* i386 BSD binary */ +#define MID_SPARC 138 /* sparc */ +#define MID_HP200 200 /* hp200 (68010) BSD binary */ +#define MID_HP300 300 /* hp300 (68020+68881) BSD binary */ +#define MID_HPUX 0x20C /* hp200/300 HP-UX binary */ +#define MID_HPUX800 0x20B /* hp800 HP-UX binary */ + +/* + * a_flags + */ +#define EX_PIC 0x10 /* contains position independant code */ +#define EX_DYNAMIC 0x20 /* contains run-time link-edit info */ +#define EX_DPMASK 0x30 /* mask for the above */ + +#endif /* !_IMGACT_AOUT_H_ */ diff --git a/usr/src/grub/grub-0.97/stage2/iso9660.h b/usr/src/grub/grub-0.97/stage2/iso9660.h new file mode 100644 index 0000000000..83d0019775 --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/iso9660.h @@ -0,0 +1,219 @@ +/* + * ISO 9660 filesystem backend for GRUB (GRand Unified Bootloader) + * including Rock Ridge Extensions support + * + * Copyright (C) 1998, 1999 Kousuke Takai + * + * 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. + */ +/* + * References: + * linux/fs/isofs/rock.[ch] + * mkisofs-1.11.1/diag/isoinfo.c + * mkisofs-1.11.1/iso9660.h + * (all are written by Eric Youngdale) + */ + +#ifndef _ISO9660_H_ +#define _ISO9660_H_ + +#define ISO_SECTOR_BITS (11) +#define ISO_SECTOR_SIZE (1<= file system block size >= PBSIZE >= DISIZE + */ +#define PBSIZE 512 /* physical block size (in byte) */ +#define DISIZE 512 /* on-disk inode size (in byte) */ +#define L2DISIZE 9 +#define INOSPERIAG 4096 /* number of disk inodes per iag */ +#define L2INOSPERIAG 12 +#define INOSPEREXT 32 /* number of disk inode per extent */ +#define L2INOSPEREXT 5 + +/* Minimum number of bytes supported for a JFS partition */ +#define MINJFS (0x1000000) + +/* + * fixed byte offset address + */ +#define SUPER1_OFF 0x8000 /* primary superblock */ + +#define AITBL_OFF (SUPER1_OFF + PSIZE + (PSIZE << 1)) + +/* + * fixed reserved inode number + */ +/* aggregate inode */ +#define AGGREGATE_I 1 /* aggregate inode map inode */ +#define FILESYSTEM_I 16 /* 1st/only fileset inode in ait: + * fileset inode map inode + */ + +/* per fileset inode */ +#define ROOT_I 2 /* fileset root inode */ + +/* + * directory configuration + */ +#define JFS_NAME_MAX 255 +#define JFS_PATH_MAX PSIZE + +typedef unsigned char u8; +typedef char s8; +typedef unsigned short u16; +typedef short s16; +typedef unsigned int u32; +typedef int s32; +typedef unsigned long long u64; +typedef long long s64; + +typedef u16 UniChar; + +/* these from jfs_btree.h */ + +/* btpaget_t flag */ +#define BT_TYPE 0x07 /* B+-tree index */ +#define BT_ROOT 0x01 /* root page */ +#define BT_LEAF 0x02 /* leaf page */ +#define BT_INTERNAL 0x04 /* internal page */ +#define BT_RIGHTMOST 0x10 /* rightmost page */ +#define BT_LEFTMOST 0x20 /* leftmost page */ + +/* those are from jfs_types.h */ + +struct timestruc_t { + u32 tv_sec; + u32 tv_nsec; +}; + +/* + * physical xd (pxd) + */ +typedef struct { + unsigned len:24; + unsigned addr1:8; + u32 addr2; +} pxd_t; + +/* xd_t field extraction */ +#define lengthPXD(pxd) ((pxd)->len) +#define addressPXD(pxd) (((s64)((pxd)->addr1)) << 32 | ((pxd)->addr2)) + +/* + * data extent descriptor (dxd) + */ +typedef struct { + unsigned flag:8; /* 1: flags */ + unsigned rsrvd:24; /* 3: */ + u32 size; /* 4: size in byte */ + unsigned len:24; /* 3: length in unit of fsblksize */ + unsigned addr1:8; /* 1: address in unit of fsblksize */ + u32 addr2; /* 4: address in unit of fsblksize */ +} dxd_t; /* - 16 - */ + +/* + * DASD limit information - stored in directory inode + */ +typedef struct dasd { + u8 thresh; /* Alert Threshold (in percent) */ + u8 delta; /* Alert Threshold delta (in percent) */ + u8 rsrvd1; + u8 limit_hi; /* DASD limit (in logical blocks) */ + u32 limit_lo; /* DASD limit (in logical blocks) */ + u8 rsrvd2[3]; + u8 used_hi; /* DASD usage (in logical blocks) */ + u32 used_lo; /* DASD usage (in logical blocks) */ +} dasd_t; + + +/* from jfs_superblock.h */ + +#define JFS_MAGIC 0x3153464A /* "JFS1" */ + +struct jfs_superblock +{ + u32 s_magic; /* 4: magic number */ + u32 s_version; /* 4: version number */ + + s64 s_size; /* 8: aggregate size in hardware/LVM blocks; + * VFS: number of blocks + */ + s32 s_bsize; /* 4: aggregate block size in bytes; + * VFS: fragment size + */ + s16 s_l2bsize; /* 2: log2 of s_bsize */ + s16 s_l2bfactor; /* 2: log2(s_bsize/hardware block size) */ + s32 s_pbsize; /* 4: hardware/LVM block size in bytes */ + s16 s_l2pbsize; /* 2: log2 of s_pbsize */ + s16 pad; /* 2: padding necessary for alignment */ + + u32 s_agsize; /* 4: allocation group size in aggr. blocks */ + + u32 s_flag; /* 4: aggregate attributes: + * see jfs_filsys.h + */ + u32 s_state; /* 4: mount/unmount/recovery state: + * see jfs_filsys.h + */ + s32 s_compress; /* 4: > 0 if data compression */ + + pxd_t s_ait2; /* 8: first extent of secondary + * aggregate inode table + */ + + pxd_t s_aim2; /* 8: first extent of secondary + * aggregate inode map + */ + u32 s_logdev; /* 4: device address of log */ + s32 s_logserial; /* 4: log serial number at aggregate mount */ + pxd_t s_logpxd; /* 8: inline log extent */ + + pxd_t s_fsckpxd; /* 8: inline fsck work space extent */ + + struct timestruc_t s_time; /* 8: time last updated */ + + s32 s_fsckloglen; /* 4: Number of filesystem blocks reserved for + * the fsck service log. + * N.B. These blocks are divided among the + * versions kept. This is not a per + * version size. + * N.B. These blocks are included in the + * length field of s_fsckpxd. + */ + s8 s_fscklog; /* 1: which fsck service log is most recent + * 0 => no service log data yet + * 1 => the first one + * 2 => the 2nd one + */ + char s_fpack[11]; /* 11: file system volume name + * N.B. This must be 11 bytes to + * conform with the OS/2 BootSector + * requirements + */ + + /* extendfs() parameter under s_state & FM_EXTENDFS */ + s64 s_xsize; /* 8: extendfs s_size */ + pxd_t s_xfsckpxd; /* 8: extendfs fsckpxd */ + pxd_t s_xlogpxd; /* 8: extendfs logpxd */ + /* - 128 byte boundary - */ + + /* + * DFS VFS support (preliminary) + */ + char s_attach; /* 1: VFS: flag: set when aggregate is attached + */ + u8 rsrvd4[7]; /* 7: reserved - set to 0 */ + + u64 totalUsable; /* 8: VFS: total of 1K blocks which are + * available to "normal" (non-root) users. + */ + u64 minFree; /* 8: VFS: # of 1K blocks held in reserve for + * exclusive use of root. This value can be 0, + * and if it is then totalUsable will be equal + * to # of blocks in aggregate. I believe this + * means that minFree + totalUsable = # blocks. + * In that case, we don't need to store both + * totalUsable and minFree since we can compute + * one from the other. I would guess minFree + * would be the one we should store, and + * totalUsable would be the one we should + * compute. (Just a guess...) + */ + + u64 realFree; /* 8: VFS: # of free 1K blocks can be used by + * "normal" users. It may be this is something + * we should compute when asked for instead of + * storing in the superblock. I don't know how + * often this information is needed. + */ + /* + * graffiti area + */ +}; + +/* from jfs_dtree.h */ + +/* + * entry segment/slot + * + * an entry consists of type dependent head/only segment/slot and + * additional segments/slots linked vi next field; + * N.B. last/only segment of entry is terminated by next = -1; + */ +/* + * directory page slot + */ +typedef struct { + s8 next; /* 1: */ + s8 cnt; /* 1: */ + UniChar name[15]; /* 30: */ +} dtslot_t; /* (32) */ + +#define DTSLOTDATALEN 15 + +/* + * internal node entry head/only segment + */ +typedef struct { + pxd_t xd; /* 8: child extent descriptor */ + + s8 next; /* 1: */ + u8 namlen; /* 1: */ + UniChar name[11]; /* 22: 2-byte aligned */ +} idtentry_t; /* (32) */ + +/* + * leaf node entry head/only segment + * + * For legacy filesystems, name contains 13 unichars -- no index field + */ +typedef struct { + u32 inumber; /* 4: 4-byte aligned */ + s8 next; /* 1: */ + u8 namlen; /* 1: */ + UniChar name[11]; /* 22: 2-byte aligned */ + u32 index; /* 4: index into dir_table */ +} ldtentry_t; /* (32) */ + +#define DTLHDRDATALEN 11 + +/* + * dir_table used for directory traversal during readdir +*/ + +/* + * Maximum entry in inline directory table + */ + +typedef struct dir_table_slot { + u8 rsrvd; /* 1: */ + u8 flag; /* 1: 0 if free */ + u8 slot; /* 1: slot within leaf page of entry */ + u8 addr1; /* 1: upper 8 bits of leaf page address */ + u32 addr2; /* 4: lower 32 bits of leaf page address -OR- + index of next entry when this entry was deleted */ +} dir_table_slot_t; /* (8) */ + +/* + * directory root page (in-line in on-disk inode): + * + * cf. dtpage_t below. + */ +typedef union { + struct { + dasd_t DASD; /* 16: DASD limit/usage info F226941 */ + + u8 flag; /* 1: */ + s8 nextindex; /* 1: next free entry in stbl */ + s8 freecnt; /* 1: free count */ + s8 freelist; /* 1: freelist header */ + + u32 idotdot; /* 4: parent inode number */ + + s8 stbl[8]; /* 8: sorted entry index table */ + } header; /* (32) */ + + dtslot_t slot[9]; +} dtroot_t; + +/* + * directory regular page: + * + * entry slot array of 32 byte slot + * + * sorted entry slot index table (stbl): + * contiguous slots at slot specified by stblindex, + * 1-byte per entry + * 512 byte block: 16 entry tbl (1 slot) + * 1024 byte block: 32 entry tbl (1 slot) + * 2048 byte block: 64 entry tbl (2 slot) + * 4096 byte block: 128 entry tbl (4 slot) + * + * data area: + * 512 byte block: 16 - 2 = 14 slot + * 1024 byte block: 32 - 2 = 30 slot + * 2048 byte block: 64 - 3 = 61 slot + * 4096 byte block: 128 - 5 = 123 slot + * + * N.B. index is 0-based; index fields refer to slot index + * except nextindex which refers to entry index in stbl; + * end of entry stot list or freelist is marked with -1. + */ +typedef union { + struct { + s64 next; /* 8: next sibling */ + s64 prev; /* 8: previous sibling */ + + u8 flag; /* 1: */ + s8 nextindex; /* 1: next entry index in stbl */ + s8 freecnt; /* 1: */ + s8 freelist; /* 1: slot index of head of freelist */ + + u8 maxslot; /* 1: number of slots in page slot[] */ + s8 stblindex; /* 1: slot index of start of stbl */ + u8 rsrvd[2]; /* 2: */ + + pxd_t self; /* 8: self pxd */ + } header; /* (32) */ + + dtslot_t slot[128]; +} dtpage_t; + +/* from jfs_xtree.h */ + +/* + * extent allocation descriptor (xad) + */ +typedef struct xad { + unsigned flag:8; /* 1: flag */ + unsigned rsvrd:16; /* 2: reserved */ + unsigned off1:8; /* 1: offset in unit of fsblksize */ + u32 off2; /* 4: offset in unit of fsblksize */ + unsigned len:24; /* 3: length in unit of fsblksize */ + unsigned addr1:8; /* 1: address in unit of fsblksize */ + u32 addr2; /* 4: address in unit of fsblksize */ +} xad_t; /* (16) */ + +/* xad_t field extraction */ +#define offsetXAD(xad) (((s64)((xad)->off1)) << 32 | ((xad)->off2)) +#define addressXAD(xad) (((s64)((xad)->addr1)) << 32 | ((xad)->addr2)) +#define lengthXAD(xad) ((xad)->len) + +/* possible values for maxentry */ +#define XTPAGEMAXSLOT 256 +#define XTENTRYSTART 2 + +/* + * xtree page: + */ +typedef union { + struct xtheader { + s64 next; /* 8: */ + s64 prev; /* 8: */ + + u8 flag; /* 1: */ + u8 rsrvd1; /* 1: */ + s16 nextindex; /* 2: next index = number of entries */ + s16 maxentry; /* 2: max number of entries */ + s16 rsrvd2; /* 2: */ + + pxd_t self; /* 8: self */ + } header; /* (32) */ + + xad_t xad[XTPAGEMAXSLOT]; /* 16 * maxentry: xad array */ +} xtpage_t; + +/* from jfs_dinode.h */ + +struct dinode { + /* + * I. base area (128 bytes) + * ------------------------ + * + * define generic/POSIX attributes + */ + u32 di_inostamp; /* 4: stamp to show inode belongs to fileset */ + s32 di_fileset; /* 4: fileset number */ + u32 di_number; /* 4: inode number, aka file serial number */ + u32 di_gen; /* 4: inode generation number */ + + pxd_t di_ixpxd; /* 8: inode extent descriptor */ + + s64 di_size; /* 8: size */ + s64 di_nblocks; /* 8: number of blocks allocated */ + + u32 di_nlink; /* 4: number of links to the object */ + + u32 di_uid; /* 4: user id of owner */ + u32 di_gid; /* 4: group id of owner */ + + u32 di_mode; /* 4: attribute, format and permission */ + + struct timestruc_t di_atime; /* 8: time last data accessed */ + struct timestruc_t di_ctime; /* 8: time last status changed */ + struct timestruc_t di_mtime; /* 8: time last data modified */ + struct timestruc_t di_otime; /* 8: time created */ + + dxd_t di_acl; /* 16: acl descriptor */ + + dxd_t di_ea; /* 16: ea descriptor */ + + s32 di_next_index; /* 4: Next available dir_table index */ + + s32 di_acltype; /* 4: Type of ACL */ + + /* + * Extension Areas. + * + * Historically, the inode was partitioned into 4 128-byte areas, + * the last 3 being defined as unions which could have multiple + * uses. The first 96 bytes had been completely unused until + * an index table was added to the directory. It is now more + * useful to describe the last 3/4 of the inode as a single + * union. We would probably be better off redesigning the + * entire structure from scratch, but we don't want to break + * commonality with OS/2's JFS at this time. + */ + union { + struct { + /* + * This table contains the information needed to + * find a directory entry from a 32-bit index. + * If the index is small enough, the table is inline, + * otherwise, an x-tree root overlays this table + */ + dir_table_slot_t _table[12]; /* 96: inline */ + + dtroot_t _dtroot; /* 288: dtree root */ + } _dir; /* (384) */ +#define di_dirtable u._dir._table +#define di_dtroot u._dir._dtroot +#define di_parent di_dtroot.header.idotdot +#define di_DASD di_dtroot.header.DASD + + struct { + union { + u8 _data[96]; /* 96: unused */ + struct { + void *_imap; /* 4: unused */ + u32 _gengen; /* 4: generator */ + } _imap; + } _u1; /* 96: */ +#define di_gengen u._file._u1._imap._gengen + + union { + xtpage_t _xtroot; + struct { + u8 unused[16]; /* 16: */ + dxd_t _dxd; /* 16: */ + union { + u32 _rdev; /* 4: */ + u8 _fastsymlink[128]; + } _u; + u8 _inlineea[128]; + } _special; + } _u2; + } _file; +#define di_xtroot u._file._u2._xtroot +#define di_dxd u._file._u2._special._dxd +#define di_btroot di_xtroot +#define di_inlinedata u._file._u2._special._u +#define di_rdev u._file._u2._special._u._rdev +#define di_fastsymlink u._file._u2._special._u._fastsymlink +#define di_inlineea u._file._u2._special._inlineea + } u; +}; + +typedef struct dinode dinode_t; + +/* di_mode */ +#define IFMT 0xF000 /* S_IFMT - mask of file type */ +#define IFDIR 0x4000 /* S_IFDIR - directory */ +#define IFREG 0x8000 /* S_IFREG - regular file */ +#define IFLNK 0xA000 /* S_IFLNK - symbolic link */ + +/* extended mode bits (on-disk inode di_mode) */ +#define INLINEEA 0x00040000 /* inline EA area free */ + +/* from jfs_imap.h */ + +#define EXTSPERIAG 128 /* number of disk inode extent per iag */ +#define SMAPSZ 4 /* number of words per summary map */ +#define MAXAG 128 /* maximum number of allocation groups */ + +/* + * inode allocation map: + * + * inode allocation map consists of + * . the inode map control page and + * . inode allocation group pages (per 4096 inodes) + * which are addressed by standard JFS xtree. + */ +/* + * inode allocation group page (per 4096 inodes of an AG) + */ +typedef struct { + s64 agstart; /* 8: starting block of ag */ + s32 iagnum; /* 4: inode allocation group number */ + s32 inofreefwd; /* 4: ag inode free list forward */ + s32 inofreeback; /* 4: ag inode free list back */ + s32 extfreefwd; /* 4: ag inode extent free list forward */ + s32 extfreeback; /* 4: ag inode extent free list back */ + s32 iagfree; /* 4: iag free list */ + + /* summary map: 1 bit per inode extent */ + s32 inosmap[SMAPSZ]; /* 16: sum map of mapwords w/ free inodes; + * note: this indicates free and backed + * inodes, if the extent is not backed the + * value will be 1. if the extent is + * backed but all inodes are being used the + * value will be 1. if the extent is + * backed but at least one of the inodes is + * free the value will be 0. + */ + s32 extsmap[SMAPSZ]; /* 16: sum map of mapwords w/ free extents */ + s32 nfreeinos; /* 4: number of free inodes */ + s32 nfreeexts; /* 4: number of free extents */ + /* (72) */ + u8 pad[1976]; /* 1976: pad to 2048 bytes */ + /* allocation bit map: 1 bit per inode (0 - free, 1 - allocated) */ + u32 wmap[EXTSPERIAG]; /* 512: working allocation map */ + u32 pmap[EXTSPERIAG]; /* 512: persistent allocation map */ + pxd_t inoext[EXTSPERIAG]; /* 1024: inode extent addresses */ +} iag_t; /* (4096) */ + +#endif /* _JFS_H_ */ diff --git a/usr/src/grub/grub-0.97/stage2/logo.xbm b/usr/src/grub/grub-0.97/stage2/logo.xbm new file mode 100644 index 0000000000..d8a7c9b2e8 --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/logo.xbm @@ -0,0 +1,191 @@ +#define logo_width 235 +#define logo_height 75 +static unsigned char logo_bits[] = { + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xf0, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, + 0xff, 0xff, 0xff, 0xff, 0x1f, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x80, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, + 0xff, 0xff, 0xff, 0xff, 0x07, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xff, 0xff, 0x83, 0xff, 0x03, 0x00, + 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, + 0xff, 0xff, 0x00, 0xfe, 0x01, 0x07, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xff, 0x7f, 0x00, 0xfc, 0xc1, 0x1f, + 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, + 0xff, 0x3f, 0x7c, 0xf8, 0xe0, 0x3f, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xff, 0x1f, 0xff, 0xf1, 0xe0, 0x3f, + 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, + 0xff, 0x1f, 0xff, 0xf1, 0xf0, 0x7f, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xff, 0x8f, 0xff, 0xe3, 0xf0, 0x7f, + 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, + 0xff, 0x8f, 0xff, 0xe3, 0xe0, 0x3f, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xff, 0x8f, 0xff, 0xe3, 0xe0, 0x3f, + 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, + 0xff, 0x8f, 0xff, 0xe3, 0xc1, 0x1f, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xff, 0x1f, 0xff, 0xf1, 0x01, 0x07, + 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, + 0xff, 0x1f, 0xff, 0xf1, 0x03, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xf1, 0x8f, 0xff, 0xff, 0xff, 0x07, 0xff, 0x3f, 0x7c, 0xf8, 0x07, 0x00, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf1, 0x8f, 0xff, 0xff, 0xff, 0x07, + 0xff, 0x7f, 0x00, 0xfc, 0x0f, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xf1, 0x8f, 0xff, 0xff, 0xff, 0x07, 0xff, 0xff, 0x00, 0xfe, 0x1f, 0xc0, + 0x3f, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf1, 0x8f, 0xff, 0xff, 0xff, 0x07, + 0xff, 0xff, 0x83, 0x9f, 0x7f, 0xf0, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xc4, 0x8f, 0xe7, 0x3d, 0x07, 0x67, 0x06, 0x3f, + 0xf0, 0x8f, 0x38, 0xcf, 0xff, 0x07, 0xff, 0xff, 0xff, 0x07, 0xfe, 0xff, + 0x07, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0x03, + 0xe6, 0x38, 0x03, 0x06, 0x02, 0x1e, 0xf0, 0x0f, 0x30, 0xcf, 0xff, 0x07, + 0xff, 0xff, 0xff, 0x03, 0xfc, 0xff, 0x03, 0x00, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0x7f, 0x0c, 0x21, 0xc4, 0x18, 0x63, 0x04, 0x62, 0x8c, + 0xf1, 0x8f, 0x21, 0xc6, 0xff, 0x07, 0xff, 0xff, 0xff, 0x03, 0xfc, 0xff, + 0x03, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x1c, 0x71, + 0xc4, 0x18, 0xf1, 0x84, 0xf1, 0xc4, 0xf1, 0x8f, 0x23, 0xc6, 0xff, 0x07, + 0xff, 0x0f, 0xf8, 0x01, 0xf8, 0xff, 0x01, 0x00, 0xfe, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0x7f, 0x1c, 0x71, 0x44, 0x12, 0x01, 0xc4, 0x01, 0xc4, + 0xf1, 0x8f, 0x63, 0xe6, 0xff, 0x07, 0xff, 0x03, 0xe0, 0x01, 0x78, 0xf0, + 0x01, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x1c, 0x71, + 0x4c, 0x92, 0x01, 0xc6, 0x01, 0xc6, 0xf1, 0x8f, 0x63, 0xe4, 0xff, 0x07, + 0xff, 0x01, 0xc0, 0x03, 0x3c, 0xe0, 0x01, 0x00, 0xfe, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0x7f, 0x1c, 0x71, 0x0c, 0x82, 0xf1, 0xc7, 0xf1, 0xc7, + 0xf1, 0x8f, 0x63, 0xf0, 0xff, 0x07, 0xff, 0xc0, 0x81, 0x03, 0x1c, 0xc0, + 0x01, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x8c, 0x21, + 0x0c, 0x82, 0xe3, 0xc4, 0xe3, 0x84, 0xf1, 0x8f, 0xf1, 0xf0, 0xff, 0x07, + 0x7f, 0xf0, 0x07, 0x07, 0x0e, 0x80, 0x01, 0x00, 0xfe, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0x7f, 0xc0, 0x03, 0x1e, 0xc7, 0x03, 0xc4, 0x03, 0x0c, + 0xf0, 0x0f, 0xf8, 0xf8, 0xff, 0x07, 0x7f, 0xf8, 0x0f, 0x9f, 0x0f, 0x80, + 0x01, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xe0, 0x8f, + 0x9f, 0xcf, 0x07, 0xce, 0x07, 0x1e, 0xf3, 0x1f, 0xfc, 0xf8, 0xff, 0x07, + 0x3f, 0xfc, 0x1f, 0xfe, 0x0f, 0x80, 0x03, 0x00, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0x7f, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0x7f, 0xfc, 0xff, 0x07, 0x3f, 0xfe, 0x3f, 0xfe, 0x0f, 0x80, + 0x03, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xfc, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xfe, 0xff, 0x07, + 0x3f, 0xfe, 0x3f, 0x1e, 0x0e, 0x80, 0x07, 0x80, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0x7f, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0x1f, 0xff, 0xff, 0x07, 0x3f, 0xfe, 0x3f, 0x0e, 0x1c, 0xc0, + 0x0f, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, + 0x3f, 0xfe, 0x3f, 0x06, 0x38, 0xe0, 0x3f, 0xf0, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0x3f, 0xfe, 0x3f, 0x06, 0x78, 0xf0, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, + 0x3f, 0xfe, 0x3f, 0x06, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0x3f, 0xfc, 0x1f, 0x06, 0xf8, 0x1f, + 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, + 0x7f, 0xf8, 0x0f, 0x0f, 0xfc, 0x07, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0x7f, 0xf0, 0x07, 0x1f, 0xfe, 0x03, + 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, + 0xff, 0xc0, 0x81, 0xff, 0xff, 0x01, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xff, 0x01, 0xc0, 0xff, 0xff, 0x00, + 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, + 0xff, 0x03, 0xe0, 0x87, 0xff, 0x80, 0x80, 0xff, 0x7f, 0xc0, 0x1f, 0x01, + 0xff, 0x03, 0x3f, 0x06, 0xfe, 0x01, 0xff, 0x80, 0x3f, 0xfc, 0x03, 0xfc, + 0x31, 0x0c, 0x1f, 0x30, 0xf4, 0x07, 0xff, 0x0f, 0xf8, 0x01, 0x7e, 0xe0, + 0x03, 0xff, 0x1f, 0x00, 0x1f, 0x00, 0xfe, 0x00, 0x3e, 0x02, 0xfc, 0x00, + 0x3e, 0x00, 0x3e, 0xfc, 0x01, 0xf0, 0x10, 0x0c, 0x0f, 0x60, 0xf1, 0x07, + 0xff, 0xff, 0xff, 0x00, 0x7c, 0xe0, 0x03, 0xff, 0x0f, 0x00, 0x1e, 0x00, + 0x7c, 0x00, 0x3c, 0x00, 0x78, 0x00, 0x1e, 0x00, 0x3c, 0xfc, 0x00, 0xe0, + 0x00, 0x0c, 0x07, 0x60, 0xf1, 0x07, 0xff, 0xff, 0x7f, 0x00, 0x78, 0xf0, + 0x07, 0xff, 0x07, 0x0e, 0x1c, 0x18, 0x3c, 0x38, 0x38, 0x30, 0x38, 0xf8, + 0x0f, 0x1c, 0x38, 0xfc, 0xf8, 0xe0, 0x00, 0x0c, 0x83, 0xff, 0xff, 0x07, + 0xff, 0xff, 0x7f, 0x00, 0x78, 0xe0, 0x03, 0xff, 0x07, 0x1f, 0x1c, 0x3c, + 0x38, 0x7c, 0x38, 0x78, 0x30, 0xfc, 0x0f, 0x3e, 0x38, 0xfc, 0xff, 0xe1, + 0xc0, 0x0f, 0xc3, 0xff, 0xff, 0x07, 0xff, 0xff, 0x3f, 0x00, 0x70, 0xe0, + 0x03, 0xff, 0x87, 0x3f, 0x1c, 0x7e, 0x38, 0x7c, 0x30, 0xfc, 0x30, 0xfc, + 0x0f, 0x7f, 0x38, 0xfc, 0xff, 0xe1, 0xe0, 0x0f, 0xc3, 0xff, 0xff, 0x07, + 0xff, 0xff, 0x3f, 0x00, 0xf0, 0x80, 0x80, 0xff, 0x87, 0x3f, 0x1c, 0x7e, + 0x18, 0xfe, 0x30, 0xfc, 0x30, 0xf0, 0x0f, 0x7f, 0x38, 0xfc, 0xff, 0xe1, + 0xf0, 0x0f, 0x03, 0xff, 0xff, 0x07, 0xff, 0xff, 0x3f, 0x00, 0xf0, 0x00, + 0x80, 0xff, 0x87, 0x3f, 0x1c, 0x7e, 0x18, 0x00, 0x30, 0xfc, 0x70, 0xc0, + 0x0f, 0x7f, 0x38, 0xfc, 0x07, 0xe0, 0xf0, 0x0f, 0x07, 0xfc, 0xff, 0x07, + 0xff, 0xff, 0x3f, 0x00, 0xf0, 0x01, 0xc0, 0xff, 0x87, 0x3f, 0x1c, 0x7e, + 0x18, 0x00, 0x38, 0xfc, 0xf0, 0x00, 0x0f, 0x7f, 0x38, 0xfc, 0x03, 0xe0, + 0xf0, 0x0f, 0x0f, 0xf0, 0xff, 0x07, 0xff, 0xff, 0x3f, 0x00, 0xf0, 0x03, + 0xe0, 0xff, 0x87, 0x3f, 0x1c, 0x7e, 0x18, 0x00, 0x38, 0xfc, 0xf0, 0x01, + 0x0e, 0x7f, 0x38, 0xfc, 0x01, 0xe0, 0xf0, 0x0f, 0x1f, 0xe0, 0xff, 0x07, + 0xff, 0xff, 0x7f, 0x00, 0xf8, 0x07, 0xf0, 0xff, 0x87, 0x3f, 0x1c, 0x7e, + 0x18, 0xfe, 0x3f, 0xfc, 0xf0, 0x07, 0x0c, 0x7f, 0x38, 0xfc, 0xe0, 0xe1, + 0xf0, 0x0f, 0x7f, 0xc0, 0xff, 0x07, 0xff, 0xff, 0x7f, 0x00, 0xf8, 0x1f, + 0xfc, 0xff, 0x87, 0x3f, 0x1c, 0x7e, 0x18, 0xfe, 0x3f, 0xfc, 0xf0, 0x1f, + 0x0c, 0x7f, 0x38, 0xfc, 0xf0, 0xe3, 0xf0, 0x0f, 0xff, 0xc1, 0xff, 0x07, + 0xff, 0xff, 0xff, 0x00, 0xfc, 0xff, 0xff, 0xff, 0x87, 0x3f, 0x1c, 0x7e, + 0x38, 0xfc, 0x3f, 0xfc, 0xf0, 0x3f, 0x0c, 0x7f, 0x38, 0xfc, 0xf8, 0xe3, + 0xf0, 0x0f, 0xff, 0xc3, 0xff, 0x07, 0xff, 0xff, 0xff, 0x01, 0xfe, 0xff, + 0xff, 0xff, 0x07, 0x1f, 0x1c, 0x3c, 0x3c, 0xfc, 0x3f, 0xfc, 0xf0, 0x3f, + 0x0c, 0x3e, 0x38, 0xfc, 0xf8, 0xe1, 0xf0, 0x0f, 0xff, 0xc3, 0xff, 0x07, + 0xff, 0xff, 0xff, 0x87, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x0e, 0x1e, 0x18, + 0x3c, 0xf8, 0x39, 0xfc, 0xf0, 0x1f, 0x1c, 0x1c, 0x3c, 0xfc, 0xf0, 0xe0, + 0xf0, 0x0f, 0xff, 0xc1, 0xff, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0x0f, 0x00, 0x1e, 0x00, 0x7e, 0x00, 0x38, 0xfc, 0x30, 0x00, + 0x1c, 0x00, 0x3c, 0xc0, 0x00, 0xe0, 0xf0, 0x0f, 0x03, 0xc0, 0xff, 0x07, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x1f, 0x00, + 0x7f, 0x00, 0x38, 0xfc, 0x30, 0x00, 0x3e, 0x00, 0x3e, 0xc0, 0x00, 0xe0, + 0xf0, 0x0f, 0x03, 0xe0, 0xff, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0x7f, 0xc0, 0x1f, 0xc0, 0xff, 0x01, 0x3e, 0xfc, 0x70, 0x00, + 0xff, 0x80, 0x7f, 0xc0, 0x01, 0xe3, 0xf1, 0x0f, 0x07, 0xf0, 0xff, 0x07, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0xfe, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0x1f, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0xfe, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0x1f, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0xfe, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0x1f, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0x07 }; diff --git a/usr/src/grub/grub-0.97/stage2/mb_header.h b/usr/src/grub/grub-0.97/stage2/mb_header.h new file mode 100644 index 0000000000..21934574f3 --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/mb_header.h @@ -0,0 +1,90 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2000 Free Software Foundation, 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 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. + */ + +/* + * MultiBoot Header description + */ + +struct multiboot_header +{ + /* Must be MULTIBOOT_MAGIC - see below. */ + unsigned magic; + + /* Feature flags - see below. */ + unsigned flags; + + /* + * Checksum + * + * The above fields plus this one must equal 0 mod 2^32. + */ + unsigned checksum; + + /* These are only valid if MULTIBOOT_AOUT_KLUDGE is set. */ + unsigned header_addr; + unsigned load_addr; + unsigned load_end_addr; + unsigned bss_end_addr; + unsigned entry_addr; + + /* These are only valid if MULTIBOOT_VIDEO_MODE is set. */ + unsigned mode_type; + unsigned width; + unsigned height; + unsigned depth; +}; + +/* + * The entire multiboot_header must be contained + * within the first MULTIBOOT_SEARCH bytes of the kernel image. + */ +#define MULTIBOOT_SEARCH 8192 +#define MULTIBOOT_FOUND(addr, len) \ + (! ((addr) & 0x3) \ + && (len) >= 12 \ + && *((int *) (addr)) == MULTIBOOT_MAGIC \ + && ! (*((unsigned *) (addr)) + *((unsigned *) (addr + 4)) \ + + *((unsigned *) (addr + 8))) \ + && (! (MULTIBOOT_AOUT_KLUDGE & *((int *) (addr + 4))) || (len) >= 32) \ + && (! (MULTIBOOT_VIDEO_MODE & *((int *) (addr + 4))) || (len) >= 48)) + +/* Magic value identifying the multiboot_header. */ +#define MULTIBOOT_MAGIC 0x1BADB002 + +/* + * Features flags for 'flags'. + * If a boot loader sees a flag in MULTIBOOT_MUSTKNOW set + * and it doesn't understand it, it must fail. + */ +#define MULTIBOOT_MUSTKNOW 0x0000FFFF + +/* currently unsupported flags... this is a kind of version number. */ +#define MULTIBOOT_UNSUPPORTED 0x0000FFF8 + +/* Align all boot modules on i386 page (4KB) boundaries. */ +#define MULTIBOOT_PAGE_ALIGN 0x00000001 + +/* Must pass memory information to OS. */ +#define MULTIBOOT_MEMORY_INFO 0x00000002 + +/* Must pass video information to OS. */ +#define MULTIBOOT_VIDEO_MODE 0x00000004 + +/* This flag indicates the use of the address fields in the header. */ +#define MULTIBOOT_AOUT_KLUDGE 0x00010000 diff --git a/usr/src/grub/grub-0.97/stage2/mb_info.h b/usr/src/grub/grub-0.97/stage2/mb_info.h new file mode 100644 index 0000000000..1e1e63bae6 --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/mb_info.h @@ -0,0 +1,217 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2000,2003 Free Software Foundation, 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 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. + */ + +/* + * The structure type "mod_list" is used by the "multiboot_info" structure. + */ + +struct mod_list +{ + /* the memory used goes from bytes 'mod_start' to 'mod_end-1' inclusive */ + unsigned long mod_start; + unsigned long mod_end; + + /* Module command line */ + unsigned long cmdline; + + /* padding to take it to 16 bytes (must be zero) */ + unsigned long pad; +}; + + +/* + * INT-15, AX=E820 style "AddressRangeDescriptor" + * ...with a "size" parameter on the front which is the structure size - 4, + * pointing to the next one, up until the full buffer length of the memory + * map has been reached. + */ + +struct AddrRangeDesc +{ + unsigned long size; + unsigned long long BaseAddr; + unsigned long long Length; + unsigned long Type; + + /* unspecified optional padding... */ +} __attribute__ ((packed)); + +/* usable memory "Type", all others are reserved. */ +#define MB_ARD_MEMORY 1 + + +/* Drive Info structure. */ +struct drive_info +{ + /* The size of this structure. */ + unsigned long size; + + /* The BIOS drive number. */ + unsigned char drive_number; + + /* The access mode (see below). */ + unsigned char drive_mode; + + /* The BIOS geometry. */ + unsigned short drive_cylinders; + unsigned char drive_heads; + unsigned char drive_sectors; + + /* The array of I/O ports used for the drive. */ + unsigned short drive_ports[0]; +}; + +/* Drive Mode. */ +#define MB_DI_CHS_MODE 0 +#define MB_DI_LBA_MODE 1 + + +/* APM BIOS info. */ +struct apm_info +{ + unsigned short version; + unsigned short cseg; + unsigned long offset; + unsigned short cseg_16; + unsigned short dseg_16; + unsigned short cseg_len; + unsigned short cseg_16_len; + unsigned short dseg_16_len; +}; + + +/* + * MultiBoot Info description + * + * This is the struct passed to the boot image. This is done by placing + * its address in the EAX register. + */ + +struct multiboot_info +{ + /* MultiBoot info version number */ + unsigned long flags; + + /* Available memory from BIOS */ + unsigned long mem_lower; + unsigned long mem_upper; + + /* "root" partition */ + unsigned long boot_device; + + /* Kernel command line */ + unsigned long cmdline; + + /* Boot-Module list */ + unsigned long mods_count; + unsigned long mods_addr; + + union + { + struct + { + /* (a.out) Kernel symbol table info */ + unsigned long tabsize; + unsigned long strsize; + unsigned long addr; + unsigned long pad; + } + a; + + struct + { + /* (ELF) Kernel section header table */ + unsigned long num; + unsigned long size; + unsigned long addr; + unsigned long shndx; + } + e; + } + syms; + + /* Memory Mapping buffer */ + unsigned long mmap_length; + unsigned long mmap_addr; + + /* Drive Info buffer */ + unsigned long drives_length; + unsigned long drives_addr; + + /* ROM configuration table */ + unsigned long config_table; + + /* Boot Loader Name */ + unsigned long boot_loader_name; + + /* APM table */ + unsigned long apm_table; + + /* Video */ + unsigned long vbe_control_info; + unsigned long vbe_mode_info; + unsigned short vbe_mode; + unsigned short vbe_interface_seg; + unsigned short vbe_interface_off; + unsigned short vbe_interface_len; +}; + +/* + * Flags to be set in the 'flags' parameter above + */ + +/* is there basic lower/upper memory information? */ +#define MB_INFO_MEMORY 0x00000001 +/* is there a boot device set? */ +#define MB_INFO_BOOTDEV 0x00000002 +/* is the command-line defined? */ +#define MB_INFO_CMDLINE 0x00000004 +/* are there modules to do something with? */ +#define MB_INFO_MODS 0x00000008 + +/* These next two are mutually exclusive */ + +/* is there a symbol table loaded? */ +#define MB_INFO_AOUT_SYMS 0x00000010 +/* is there an ELF section header table? */ +#define MB_INFO_ELF_SHDR 0x00000020 + +/* is there a full memory map? */ +#define MB_INFO_MEM_MAP 0x00000040 + +/* Is there drive info? */ +#define MB_INFO_DRIVE_INFO 0x00000080 + +/* Is there a config table? */ +#define MB_INFO_CONFIG_TABLE 0x00000100 + +/* Is there a boot loader name? */ +#define MB_INFO_BOOT_LOADER_NAME 0x00000200 + +/* Is there a APM table? */ +#define MB_INFO_APM_TABLE 0x00000400 + +/* Is there video information? */ +#define MB_INFO_VIDEO_INFO 0x00000800 + +/* + * The following value must be present in the EAX register. + */ + +#define MULTIBOOT_VALID 0x2BADB002 diff --git a/usr/src/grub/grub-0.97/stage2/md5.c b/usr/src/grub/grub-0.97/stage2/md5.c new file mode 100644 index 0000000000..21205bad70 --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/md5.c @@ -0,0 +1,383 @@ +/* md5.c - an implementation of the MD5 algorithm and MD5 crypt */ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2000, 2001 Free Software Foundation, 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 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. + */ + +/* See RFC 1321 for a description of the MD5 algorithm. + */ + +#include +#ifndef TEST +# include +#endif + +#ifdef TEST +# include +# define USE_MD5_PASSWORDS +# define USE_MD5 +#endif + +#ifdef USE_MD5_PASSWORDS +# define USE_MD5 +#endif + +#ifdef USE_MD5 + +#define cpu_to_le32(x) (x) +#define le32_to_cpu(x) cpu_to_le32(x) +typedef unsigned int UINT4; + +/* F, G, H and I are basic MD5 functions. + */ +#define F(x, y, z) (((x) & (y)) | ((~x) & (z))) +#define G(x, y, z) (((x) & (z)) | ((y) & (~z))) +#define H(x, y, z) ((x) ^ (y) ^ (z)) +#define I(x, y, z) ((y) ^ ((x) | (~z))) + +/* ROTATE_LEFT rotates x left n bits. + */ +#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x >> (32 - (n))))) + +static UINT4 initstate[4] = +{ + 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476 +}; + +static char s1[4] = { 7, 12, 17, 22 }; +static char s2[4] = { 5, 9, 14, 20 }; +static char s3[4] = { 4, 11, 16, 23 }; +static char s4[4] = { 6, 10, 15, 21 }; + +static UINT4 T[64] = +{ + 0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee, + 0xf57c0faf, 0x4787c62a, 0xa8304613, 0xfd469501, + 0x698098d8, 0x8b44f7af, 0xffff5bb1, 0x895cd7be, + 0x6b901122, 0xfd987193, 0xa679438e, 0x49b40821, + 0xf61e2562, 0xc040b340, 0x265e5a51, 0xe9b6c7aa, + 0xd62f105d, 0x02441453, 0xd8a1e681, 0xe7d3fbc8, + 0x21e1cde6, 0xc33707d6, 0xf4d50d87, 0x455a14ed, + 0xa9e3e905, 0xfcefa3f8, 0x676f02d9, 0x8d2a4c8a, + 0xfffa3942, 0x8771f681, 0x6d9d6122, 0xfde5380c, + 0xa4beea44, 0x4bdecfa9, 0xf6bb4b60, 0xbebfbc70, + 0x289b7ec6, 0xeaa127fa, 0xd4ef3085, 0x04881d05, + 0xd9d4d039, 0xe6db99e5, 0x1fa27cf8, 0xc4ac5665, + 0xf4292244, 0x432aff97, 0xab9423a7, 0xfc93a039, + 0x655b59c3, 0x8f0ccc92, 0xffeff47d, 0x85845dd1, + 0x6fa87e4f, 0xfe2ce6e0, 0xa3014314, 0x4e0811a1, + 0xf7537e82, 0xbd3af235, 0x2ad7d2bb, 0xeb86d391 +}; + +static const char *b64t = +"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; + +static UINT4 state[4]; +static unsigned int length; +static unsigned char buffer[64]; + +static void +md5_transform (const unsigned char block[64]) +{ + int i, j; + UINT4 a,b,c,d,tmp; + const UINT4 *x = (UINT4 *) block; + + a = state[0]; + b = state[1]; + c = state[2]; + d = state[3]; + + /* Round 1 */ + for (i = 0; i < 16; i++) + { + tmp = a + F (b, c, d) + le32_to_cpu (x[i]) + T[i]; + tmp = ROTATE_LEFT (tmp, s1[i & 3]); + tmp += b; + a = d; d = c; c = b; b = tmp; + } + /* Round 2 */ + for (i = 0, j = 1; i < 16; i++, j += 5) + { + tmp = a + G (b, c, d) + le32_to_cpu (x[j & 15]) + T[i+16]; + tmp = ROTATE_LEFT (tmp, s2[i & 3]); + tmp += b; + a = d; d = c; c = b; b = tmp; + } + /* Round 3 */ + for (i = 0, j = 5; i < 16; i++, j += 3) + { + tmp = a + H (b, c, d) + le32_to_cpu (x[j & 15]) + T[i+32]; + tmp = ROTATE_LEFT (tmp, s3[i & 3]); + tmp += b; + a = d; d = c; c = b; b = tmp; + } + /* Round 4 */ + for (i = 0, j = 0; i < 16; i++, j += 7) + { + tmp = a + I (b, c, d) + le32_to_cpu (x[j & 15]) + T[i+48]; + tmp = ROTATE_LEFT (tmp, s4[i & 3]); + tmp += b; + a = d; d = c; c = b; b = tmp; + } + + state[0] += a; + state[1] += b; + state[2] += c; + state[3] += d; +} + +static void +md5_init(void) +{ + memcpy ((char *) state, (char *) initstate, sizeof (initstate)); + length = 0; +} + +static void +md5_update (const char *input, int inputlen) +{ + int buflen = length & 63; + length += inputlen; + if (buflen + inputlen < 64) + { + memcpy (buffer + buflen, input, inputlen); + buflen += inputlen; + return; + } + + memcpy (buffer + buflen, input, 64 - buflen); + md5_transform (buffer); + input += 64 - buflen; + inputlen -= 64 - buflen; + while (inputlen >= 64) + { + md5_transform (input); + input += 64; + inputlen -= 64; + } + memcpy (buffer, input, inputlen); + buflen = inputlen; +} + +static unsigned char * +md5_final() +{ + int i, buflen = length & 63; + + buffer[buflen++] = 0x80; + memset (buffer+buflen, 0, 64 - buflen); + if (buflen > 56) + { + md5_transform (buffer); + memset (buffer, 0, 64); + buflen = 0; + } + + *(UINT4 *) (buffer + 56) = cpu_to_le32 (8 * length); + *(UINT4 *) (buffer + 60) = 0; + md5_transform (buffer); + + for (i = 0; i < 4; i++) + state[i] = cpu_to_le32 (state[i]); + return (unsigned char *) state; +} + +#ifdef USE_MD5_PASSWORDS +/* If CHECK is true, check a password for correctness. Returns 0 + if password was correct, and a value != 0 for error, similarly + to strcmp. + If CHECK is false, crypt KEY and save the result in CRYPTED. + CRYPTED must have a salt. */ +int +md5_password (const char *key, char *crypted, int check) +{ + int keylen = strlen (key); + char *salt = crypted + 3; /* skip $1$ header */ + char *p; + int saltlen; + int i, n; + unsigned char alt_result[16]; + unsigned char *digest; + + if (check) + { + /* If our crypted password isn't 3 chars, then it can't be md5 + crypted. So, they don't match. */ + if (strlen(crypted) <= 3) + return 1; + + saltlen = strstr (salt, "$") - salt; + } + else + { + char *end = strstr (salt, "$"); + if (end && end - salt < 8) + saltlen = end - salt; + else + saltlen = 8; + + salt[saltlen] = '$'; + } + + md5_init (); + md5_update (key, keylen); + md5_update (salt, saltlen); + md5_update (key, keylen); + digest = md5_final (); + memcpy (alt_result, digest, 16); + + memcpy ((char *) state, (char *) initstate, sizeof (initstate)); + length = 0; + md5_update (key, keylen); + md5_update (crypted, 3 + saltlen); /* include the $1$ header */ + for (i = keylen; i > 16; i -= 16) + md5_update (alt_result, 16); + md5_update (alt_result, i); + + for (i = keylen; i > 0; i >>= 1) + md5_update (key + ((i & 1) ? keylen : 0), 1); + digest = md5_final (); + + for (i = 0; i < 1000; i++) + { + memcpy (alt_result, digest, 16); + + memcpy ((char *) state, (char *) initstate, sizeof (initstate)); + length = 0; + if ((i & 1) != 0) + md5_update (key, keylen); + else + md5_update (alt_result, 16); + + if (i % 3 != 0) + md5_update (salt, saltlen); + + if (i % 7 != 0) + md5_update (key, keylen); + + if ((i & 1) != 0) + md5_update (alt_result, 16); + else + md5_update (key, keylen); + digest = md5_final (); + } + + p = salt + saltlen + 1; + for (i = 0; i < 5; i++) + { + unsigned int w = + digest[i == 4 ? 5 : 12+i] | (digest[6+i] << 8) | (digest[i] << 16); + for (n = 4; n-- > 0;) + { + if (check) + { + if (*p++ != b64t[w & 0x3f]) + return 1; + } + else + { + *p++ = b64t[w & 0x3f]; + } + + w >>= 6; + } + } + { + unsigned int w = digest[11]; + for (n = 2; n-- > 0;) + { + if (check) + { + if (*p++ != b64t[w & 0x3f]) + return 1; + } + else + { + *p++ = b64t[w & 0x3f]; + } + + w >>= 6; + } + } + + if (! check) + *p = '\0'; + + return *p; +} +#endif + +#ifdef TEST +static char * +md5 (const char *input) +{ + memcpy ((char *) state, (char *) initstate, sizeof (initstate)); + length = 0; + md5_update (input, strlen (input)); + return md5_final (); +} + +static void +test (char *buffer, char *expected) +{ + char result[16 * 3 +1]; + unsigned char* digest = md5 (buffer); + int i; + + for (i=0; i < 16; i++) + sprintf (result+2*i, "%02x", digest[i]); + + if (strcmp (result, expected)) + printf ("MD5(%s) failed: %s\n", buffer, result); + else + printf ("MD5(%s) OK\n", buffer); +} + +int +main (void) +{ + test ("", "d41d8cd98f00b204e9800998ecf8427e"); + test ("a", "0cc175b9c0f1b6a831c399e269772661"); + test ("abc", "900150983cd24fb0d6963f7d28e17f72"); + test ("message digest", "f96b697d7cb7938d525a2f31aaf161d0"); + test ("abcdefghijklmnopqrstuvwxyz", "c3fcd3d76192e4007dfb496cca67e13b"); + test ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", + "d174ab98d277d9f5a5611c2c9f419d9f"); + test ("12345678901234567890123456789012345678901234567890123456789012345678901234567890", + "57edf4a22be3c955ac49da2e2107b67a"); + test ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz3456", + "6831fa90115bb9a54fbcd4f9fee0b5c4"); + test ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz345", + "bc40505cc94a43b7ff3e2ac027325233"); + test ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz34567", + "fa94b73a6f072a0239b52acacfbcf9fa"); + test ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz345678901234", + "bd201eae17f29568927414fa326f1267"); + test ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz34567890123", + "80063db1e6b70a2e91eac903f0e46b85"); + + if (check_md5_password ("Hello world!", + "$1$saltstri$YMyguxXMBpd2TEZ.vS/3q1")) + printf ("Password differs\n"); + else + printf ("Password OK\n"); + return 0; +} +#endif + +#endif diff --git a/usr/src/grub/grub-0.97/stage2/md5.h b/usr/src/grub/grub-0.97/stage2/md5.h new file mode 100644 index 0000000000..c1dbd06074 --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/md5.h @@ -0,0 +1,30 @@ +/* md5.h - an implementation of the MD5 algorithm and MD5 crypt */ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2000 Free Software Foundation, 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 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. + */ + +/* If CHECK is true, check a password for correctness. Returns 0 + if password was correct, and a value != 0 for error, similarly + to strcmp. + If CHECK is false, crypt KEY and save the result in CRYPTED. + CRYPTED must have a salt. */ +extern int md5_password (const char *key, char *crypted, int check); + +/* For convenience. */ +#define check_md5_password(key,crypted) md5_password((key), (crypted), 1) +#define make_md5_password(key,crypted) md5_password((key), (crypted), 0) diff --git a/usr/src/grub/grub-0.97/stage2/nbi.h b/usr/src/grub/grub-0.97/stage2/nbi.h new file mode 100644 index 0000000000..3f70e21caf --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/nbi.h @@ -0,0 +1,33 @@ +/* nbi.h - definitions for Net Boot Image */ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2000 Free Software Foundation, 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 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 GRUB_NBI_HEADER +#define GRUB_NBI_HEADER + +#define NBI_MAGIC 0x1B031336 +#define NBI_DEST_ADDR 0x10000 +#define NBI_DEST_SEG 0x1000 +#define NBI_DEST_OFF 0x0000 +#define RELOCATED_ADDR 0x8000 +#define RELOCATED_SEG 0x0800 +#define RELOCATED_OFF 0x0000 +#define STAGE2_START_ADDR 0x8200 + +#endif /* ! GRUB_NBI_HEADER */ diff --git a/usr/src/grub/grub-0.97/stage2/nbloader.S b/usr/src/grub/grub-0.97/stage2/nbloader.S new file mode 100644 index 0000000000..57ad936551 --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/nbloader.S @@ -0,0 +1,121 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2000 Free Software Foundation, 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 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 +#include + + .file "nbloader.S" + .text + .code16 + + /* Just a dummy entry */ +.globl _start; _start: + + /* + * netboot image header + */ + + .long NBI_MAGIC + .long 0x00000004 + /* load address of the first block */ + .word NBI_DEST_OFF + .word NBI_DEST_SEG + /* start addr of the relocation code */ + .word NBI_DEST_OFF + (relocate - _start) + .word NBI_DEST_SEG + + .long 0x04000004 + .long NBI_DEST_ADDR + 0x0200 + .long DISKLESS_SIZE + .long DISKLESS_SIZE + +relocate: + /* + * This code is for now located at 0x10000. + * Relocate the code in two steps: + * 1. Copy the first 32k to 0x8000 and jump to the relocated area. + * 2. Copy the rest to 0x10000 (0x8000 + 32k). + */ + + /* Copy the first 32k */ + movw $NBI_DEST_SEG, %ax + movw %ax, %ds + movw $RELOCATED_SEG, %ax + movw %ax, %es + xorw %si, %si + xorw %di, %di + /* Always copy 32k bytes */ + movw $0x4000, %cx + + cld + rep + movsw + + /* Jump to the relocated address */ + ljmp $0, $(RELOCATED_ADDR + copy_rest - _start) + + /* Copy the rest */ +copy_rest: + /* Set %edx to the number of bytes */ + movl $(DISKLESS_SIZE + 0x200 - 0x8000), %edx + +copy_loop: + /* Check the rest */ + orl %edx, %edx + jz boot_stage2 + + /* Copy by 32k, as that is easy to implement */ + movl $0x8000, %ecx + cmpl %ecx, %edx + jg copy + movl %edx, %ecx + +copy: + /* Update the number of rest bytes */ + subl %ecx, %edx + + /* Add 0x0800 (32k >> 4) into %es and %ds */ + movw %es, %ax + addw $0x0800, %ax + movw %ax, %es + movw %ds, %ax + addw $0x800, %ax + movw %ax, %ds + + /* Zero the offsets */ + xorw %si, %si + xorw %di, %di + + /* Use word-size copy */ + addw $1, %cx + shrw $1, %cx + + /* The direction is already correct */ + rep + movsw + + jmp copy_loop + + /* Jump to the stage2 */ +boot_stage2: + ljmp $0, $STAGE2_START_ADDR + + /* This ensures that the length of this image will be 1 sector */ + . = _start + 0x200 - 1 + .byte 0 diff --git a/usr/src/grub/grub-0.97/stage2/pc_slice.h b/usr/src/grub/grub-0.97/stage2/pc_slice.h new file mode 100644 index 0000000000..a237f88a26 --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/pc_slice.h @@ -0,0 +1,283 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2003 Free Software Foundation, 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 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 _PC_SLICE_H +#define _PC_SLICE_H + +/* + * These define the basic PC MBR sector characteristics + */ + +#define PC_MBR_SECTOR 0 + +#define PC_MBR_SIG_OFFSET 510 +#define PC_MBR_SIGNATURE 0xaa55 + +#define PC_SLICE_OFFSET 446 +#define PC_SLICE_MAX 4 + + +/* + * Defines to guarantee structural alignment. + */ + +#define PC_MBR_CHECK_SIG(mbr_ptr) \ + ( *( (unsigned short *) (((int) mbr_ptr) + PC_MBR_SIG_OFFSET) ) \ + == PC_MBR_SIGNATURE ) + +#define PC_MBR_SIG(mbr_ptr) \ + ( *( (unsigned short *) (((int) mbr_ptr) + PC_MBR_SIG_OFFSET) ) ) + +#define PC_SLICE_FLAG(mbr_ptr, part) \ + ( *( (unsigned char *) (((int) mbr_ptr) + PC_SLICE_OFFSET \ + + (part << 4)) ) ) + +#define PC_SLICE_HEAD(mbr_ptr, part) \ + ( *( (unsigned char *) (((int) mbr_ptr) + PC_SLICE_OFFSET + 1 \ + + (part << 4)) ) ) + +#define PC_SLICE_SEC(mbr_ptr, part) \ + ( *( (unsigned char *) (((int) mbr_ptr) + PC_SLICE_OFFSET + 2 \ + + (part << 4)) ) ) + +#define PC_SLICE_CYL(mbr_ptr, part) \ + ( *( (unsigned char *) (((int) mbr_ptr) + PC_SLICE_OFFSET + 3 \ + + (part << 4)) ) ) + +#define PC_SLICE_TYPE(mbr_ptr, part) \ + ( *( (unsigned char *) (((int) mbr_ptr) + PC_SLICE_OFFSET + 4 \ + + (part << 4)) ) ) + +#define PC_SLICE_EHEAD(mbr_ptr, part) \ + ( *( (unsigned char *) (((int) mbr_ptr) + PC_SLICE_OFFSET + 5 \ + + (part << 4)) ) ) + +#define PC_SLICE_ESEC(mbr_ptr, part) \ + ( *( (unsigned char *) (((int) mbr_ptr) + PC_SLICE_OFFSET + 6 \ + + (part << 4)) ) ) + +#define PC_SLICE_ECYL(mbr_ptr, part) \ + ( *( (unsigned char *) (((int) mbr_ptr) + PC_SLICE_OFFSET + 7 \ + + (part << 4)) ) ) + +#define PC_SLICE_START(mbr_ptr, part) \ + ( *( (unsigned long *) (((int) mbr_ptr) + PC_SLICE_OFFSET + 8 \ + + (part << 4)) ) ) + +#define PC_SLICE_LENGTH(mbr_ptr, part) \ + ( *( (unsigned long *) (((int) mbr_ptr) + PC_SLICE_OFFSET + 12 \ + + (part << 4)) ) ) + + +/* + * PC flag types are defined here. + */ + +#define PC_SLICE_FLAG_NONE 0 +#define PC_SLICE_FLAG_BOOTABLE 0x80 + +/* + * Known PC partition types are defined here. + */ + +/* This is not a flag actually, but used as if it were a flag. */ +#define PC_SLICE_TYPE_HIDDEN_FLAG 0x10 + +#define PC_SLICE_TYPE_NONE 0 +#define PC_SLICE_TYPE_FAT12 1 +#define PC_SLICE_TYPE_FAT16_LT32M 4 +#define PC_SLICE_TYPE_EXTENDED 5 +#define PC_SLICE_TYPE_FAT16_GT32M 6 +#define PC_SLICE_TYPE_FAT32 0xb +#define PC_SLICE_TYPE_FAT32_LBA 0xc +#define PC_SLICE_TYPE_FAT16_LBA 0xe +#define PC_SLICE_TYPE_WIN95_EXTENDED 0xf +#define PC_SLICE_TYPE_EZD 0x55 +#define PC_SLICE_TYPE_MINIX 0x80 +#define PC_SLICE_TYPE_LINUX_MINIX 0x81 +#define PC_SLICE_TYPE_SOLARIS 0x82 /* also Linux swap! */ +#define PC_SLICE_TYPE_EXT2FS 0x83 +#define PC_SLICE_TYPE_LINUX_EXTENDED 0x85 +#define PC_SLICE_TYPE_VSTAFS 0x9e +#define PC_SLICE_TYPE_SOLARIS_BOOT 0xbe /* Solaris boot (fat) */ +#define PC_SLICE_TYPE_SOLARIS2 0xbf /* new Solaris type */ +#define PC_SLICE_TYPE_DELL_UTIL 0xde +#define PC_SLICE_TYPE_LINUX_RAID 0xfd + + +/* For convinience. */ +/* Check if TYPE is a FAT partition type. Clear the hidden flag before + the check, to allow the user to mount a hidden partition in GRUB. */ +#define IS_PC_SLICE_TYPE_FAT(type) \ + ({ int _type = (type) & ~PC_SLICE_TYPE_HIDDEN_FLAG; \ + _type == PC_SLICE_TYPE_FAT12 \ + || _type == PC_SLICE_TYPE_FAT16_LT32M \ + || _type == PC_SLICE_TYPE_FAT16_GT32M \ + || _type == PC_SLICE_TYPE_FAT16_LBA \ + || _type == PC_SLICE_TYPE_FAT32 \ + || _type == PC_SLICE_TYPE_FAT32_LBA \ + || type == PC_SLICE_TYPE_SOLARIS_BOOT \ + || type == PC_SLICE_TYPE_DELL_UTIL; }) + +#define IS_PC_SLICE_TYPE_EXTENDED(type) \ + (((type) == PC_SLICE_TYPE_EXTENDED) \ + || ((type) == PC_SLICE_TYPE_WIN95_EXTENDED) \ + || ((type) == PC_SLICE_TYPE_LINUX_EXTENDED)) + +#define IS_PC_SLICE_TYPE_MINIX(type) \ + (((type) == PC_SLICE_TYPE_MINIX) \ + || ((type) == PC_SLICE_TYPE_LINUX_MINIX)) + +/* these ones are special, as they use their own partitioning scheme + to subdivide the PC partitions from there. */ +#define PC_SLICE_TYPE_FREEBSD 0xa5 +#define PC_SLICE_TYPE_OPENBSD 0xa6 +#define PC_SLICE_TYPE_NETBSD 0xa9 + +/* For convenience. */ +#define IS_PC_SLICE_TYPE_BSD_WITH_FS(type,fs) \ + ((type) == (PC_SLICE_TYPE_FREEBSD | ((fs) << 8)) \ + || (type) == (PC_SLICE_TYPE_OPENBSD | ((fs) << 8)) \ + || (type) == (PC_SLICE_TYPE_NETBSD | (fs) << 8)) + +#define IS_PC_SLICE_TYPE_BSD(type) IS_PC_SLICE_TYPE_BSD_WITH_FS(type,0) + +#define IS_PC_SLICE_TYPE_SOLARIS(type) \ + (((type) == PC_SLICE_TYPE_SOLARIS) || ((type) == PC_SLICE_TYPE_SOLARIS2)) + +/* + * *BSD-style disklabel & partition definitions. + * + * This is a subdivided slice of type 'PC_SLICE_TYPE_BSD', so all of + * these, except where noted, are relative to the slice in question. + */ + +#define BSD_LABEL_SECTOR 1 +#define BSD_LABEL_MAGIC 0x82564557 + +#define BSD_LABEL_MAG_OFFSET 0 +#define BSD_LABEL_MAG2_OFFSET 132 +#define BSD_LABEL_NPARTS_OFFSET 138 +#define BSD_LABEL_NPARTS_MAX 8 + +#define BSD_PART_OFFSET 148 + + +/* + * Defines to guarantee structural alignment. + */ + +#define BSD_LABEL_CHECK_MAG(l_ptr) \ + ( *( (unsigned long *) (((int) l_ptr) + BSD_LABEL_MAG_OFFSET) ) \ + == ( (unsigned long) BSD_LABEL_MAGIC ) ) + +#define BSD_LABEL_MAG(l_ptr) \ + ( *( (unsigned long *) (((int) l_ptr) + BSD_LABEL_MAG_OFFSET) ) ) + +#define BSD_LABEL_DTYPE(l_ptr) \ + ( *( (unsigned short *) (((int) l_ptr) + BSD_LABEL_MAG_OFFSET + 4) ) ) + +#define BSD_LABEL_NPARTS(l_ptr) \ + ( *( (unsigned short *) (((int) l_ptr) + BSD_LABEL_NPARTS_OFFSET) ) ) + +#define BSD_PART_LENGTH(l_ptr, part) \ + ( *( (unsigned long *) (((int) l_ptr) + BSD_PART_OFFSET \ + + (part << 4)) ) ) + +#define BSD_PART_START(l_ptr, part) \ + ( *( (unsigned long *) (((int) l_ptr) + BSD_PART_OFFSET + 4 \ + + (part << 4)) ) ) + +#define BSD_PART_FRAG_SIZE(l_ptr, part) \ + ( *( (unsigned long *) (((int) l_ptr) + BSD_PART_OFFSET + 8 \ + + (part << 4)) ) ) + +#define BSD_PART_TYPE(l_ptr, part) \ + ( *( (unsigned char *) (((int) l_ptr) + BSD_PART_OFFSET + 12 \ + + (part << 4)) ) ) + +#define BSD_PART_FRAGS_PER_BLOCK(l_ptr, part) \ + ( *( (unsigned char *) (((int) l_ptr) + BSD_PART_OFFSET + 13 \ + + (part << 4)) ) ) + +#define BSD_PART_EXTRA(l_ptr, part) \ + ( *( (unsigned short *) (((int) l_ptr) + BSD_PART_OFFSET + 14 \ + + (part << 4)) ) ) + + +/* possible values for the "DISKTYPE"... all essentially irrelevant + except for DTYPE_SCSI */ +#define DTYPE_SMD 1 /* SMD, XSMD; VAX hp/up */ +#define DTYPE_MSCP 2 /* MSCP */ +#define DTYPE_DEC 3 /* other DEC (rk, rl) */ +#define DTYPE_SCSI 4 /* SCSI */ +#define DTYPE_ESDI 5 /* ESDI interface */ +#define DTYPE_ST506 6 /* ST506 etc. */ +#define DTYPE_HPIB 7 /* CS/80 on HP-IB */ +#define DTYPE_HPFL 8 /* HP Fiber-link */ +#define DTYPE_FLOPPY 10 /* floppy */ + + +/* possible values for the *BSD-style partition type */ +#define FS_UNUSED 0 /* unused */ +#define FS_SWAP 1 /* swap */ +#define FS_V6 2 /* Sixth Edition */ +#define FS_V7 3 /* Seventh Edition */ +#define FS_SYSV 4 /* System V */ +#define FS_V71K 5 /* V7 with 1K blocks (4.1, 2.9) */ +#define FS_V8 6 /* Eighth Edition, 4K blocks */ +#define FS_BSDFFS 7 /* 4.2BSD fast file system */ +#define FS_MSDOS 8 /* MSDOS file system */ +#define FS_BSDLFS 9 /* 4.4BSD log-structured file system */ +#define FS_OTHER 10 /* in use, but unknown/unsupported */ +#define FS_HPFS 11 /* OS/2 high-performance file system */ +#define FS_ISO9660 12 /* ISO 9660, normally CD-ROM */ +#define FS_BOOT 13 /* partition contains bootstrap */ +#define FS_ADOS 14 /* AmigaDOS fast file system */ +#define FS_HFS 15 /* Macintosh HFS */ +#define FS_FILECORE 16 /* Acorn Filecore Filing System */ +#define FS_EXT2FS 17 /* Linux Extended 2 file system */ + + +/* + * Solaris LABEL definitions. All definitions are relative to the + * current PC_SLICE. + */ +#define SOL_LABEL_LOC 1 +#define SOL_LABEL_SIZE 512 +#define SOL_LABEL_MAGIC 0xdabe +#define SOL_LABEL_MAGIC_OFFSET 0x1fc +#define SOL_LABEL_NPARTS 0x10 + +#define SOL_PART_OFFSET 0x48 + +#define SOL_LABEL_CHECK_MAG(l_ptr) \ + (*((unsigned short *) (((int) l_ptr) + SOL_LABEL_MAGIC_OFFSET)) \ + == ((unsigned short) SOL_LABEL_MAGIC )) + +#define SOL_PART_START(l_ptr, p) \ + (*((unsigned long *) (((int) l_ptr) + SOL_PART_OFFSET + (p) * 0xc + 4))) + +#define SOL_PART_LENGTH(l_ptr, p) \ + (*((unsigned long *) (((int) l_ptr) + SOL_PART_OFFSET + (p) * 0xc + 8))) + +#define SOL_PART_EXISTS(l_ptr, p) (SOL_PART_LENGTH(l_ptr, p) != 0) + + +#endif /* _PC_SLICE_H */ diff --git a/usr/src/grub/grub-0.97/stage2/pxeloader.S b/usr/src/grub/grub-0.97/stage2/pxeloader.S new file mode 100644 index 0000000000..9270f81273 --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/pxeloader.S @@ -0,0 +1,54 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2000 Free Software Foundation, 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 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. + */ + + .file "pxeloader.S" + .text + + /* Start with the prehistoric environment... */ + .code16 + + /* Let's go */ +.globl _start; _start: + movw %sp, %bp + movw %ss:4(%bp), %ax + pushw %ax + movw %ss:6(%bp), %ax + pushw %ax + call 1f +1: popw %bx + + /* Save !PXE address */ + popw %ax + movw %ax, %cs:(pxeseg-1b)(%bx) + popw %ax + movw %ax, %cs:(pxeoff-1b)(%bx) + movw %ax, %bx + + /* Jump to the real world */ + ljmp $0, $0x8200 + + . = _start + 0x7C80 - 0x7C00 +pxeseg: .word 0 +pxeoff: .word 0 + + /* This region is a junk. Do you say that this is wasteful? + But I like that the memory layout of the body is consistent + among different stage2s rather than scamping just for 1.5KB. */ + . = _start + 0x8200 - 0x7C00 - 1 + .byte 0 diff --git a/usr/src/grub/grub-0.97/stage2/serial.c b/usr/src/grub/grub-0.97/stage2/serial.c new file mode 100644 index 0000000000..16c376fa7d --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/serial.c @@ -0,0 +1,434 @@ +/* serial.c - serial device interface */ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2000,2001,2002 Free Software Foundation, 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 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. + */ + +#ifdef SUPPORT_SERIAL + +#include +#include +#include +#include + +/* An input buffer. */ +static char input_buf[8]; +static int npending = 0; + +static int serial_x; +static int serial_y; + +static int keep_track = 1; + + +/* Hardware-dependent definitions. */ + +#ifndef GRUB_UTIL +/* The structure for speed vs. divisor. */ +struct divisor +{ + int speed; + unsigned short div; +}; + +/* Store the port number of a serial unit. */ +static unsigned short serial_hw_port = 0; + +/* The table which lists common configurations. */ +static struct divisor divisor_tab[] = + { + { 2400, 0x0030 }, + { 4800, 0x0018 }, + { 9600, 0x000C }, + { 19200, 0x0006 }, + { 38400, 0x0003 }, + { 57600, 0x0002 }, + { 115200, 0x0001 } + }; + +/* Read a byte from a port. */ +static inline unsigned char +inb (unsigned short port) +{ + unsigned char value; + + asm volatile ("inb %w1, %0" : "=a" (value) : "Nd" (port)); + asm volatile ("outb %%al, $0x80" : : ); + + return value; +} + +/* Write a byte to a port. */ +static inline void +outb (unsigned short port, unsigned char value) +{ + asm volatile ("outb %b0, %w1" : : "a" (value), "Nd" (port)); + asm volatile ("outb %%al, $0x80" : : ); +} + +/* Fetch a key. */ +int +serial_hw_fetch (void) +{ + if (inb (serial_hw_port + UART_LSR) & UART_DATA_READY) + return inb (serial_hw_port + UART_RX); + + return -1; +} + +/* Put a chararacter. */ +void +serial_hw_put (int c) +{ + int timeout = 100000; + + /* Wait until the transmitter holding register is empty. */ + while ((inb (serial_hw_port + UART_LSR) & UART_EMPTY_TRANSMITTER) == 0) + { + if (--timeout == 0) + /* There is something wrong. But what can I do? */ + return; + } + + outb (serial_hw_port + UART_TX, c); +} + +void +serial_hw_delay (void) +{ + outb (0x80, 0); +} + +/* Return the port number for the UNITth serial device. */ +unsigned short +serial_hw_get_port (int unit) +{ + /* The BIOS data area. */ + const unsigned short *addr = (const unsigned short *) 0x0400; + + return addr[unit]; +} + +/* Initialize a serial device. PORT is the port number for a serial device. + SPEED is a DTE-DTE speed which must be one of these: 2400, 4800, 9600, + 19200, 38400, 57600 and 115200. WORD_LEN is the word length to be used + for the device. Likewise, PARITY is the type of the parity and + STOP_BIT_LEN is the length of the stop bit. The possible values for + WORD_LEN, PARITY and STOP_BIT_LEN are defined in the header file as + macros. */ +int +serial_hw_init (unsigned short port, unsigned int speed, + int word_len, int parity, int stop_bit_len) +{ + int i; + unsigned short div = 0; + unsigned char status = 0; + + /* Turn off the interrupt. */ + outb (port + UART_IER, 0); + + /* Set DLAB. */ + outb (port + UART_LCR, UART_DLAB); + + /* Set the baud rate. */ + for (i = 0; i < sizeof (divisor_tab) / sizeof (divisor_tab[0]); i++) + if (divisor_tab[i].speed == speed) + { + div = divisor_tab[i].div; + break; + } + + if (div == 0) + return 0; + + outb (port + UART_DLL, div & 0xFF); + outb (port + UART_DLH, div >> 8); + + /* Set the line status. */ + status |= parity | word_len | stop_bit_len; + outb (port + UART_LCR, status); + + /* Enable the FIFO. */ + outb (port + UART_FCR, UART_ENABLE_FIFO); + + /* Turn on DTR, RTS, and OUT2. */ + outb (port + UART_MCR, UART_ENABLE_MODEM); + + /* Store the port number. */ + serial_hw_port = port; + + /* Drain the input buffer. */ + while (serial_checkkey () != -1) + (void) serial_getkey (); + + /* Get rid of TERM_NEED_INIT from the serial terminal. */ + for (i = 0; term_table[i].name; i++) + if (grub_strcmp (term_table[i].name, "serial") == 0) + { + term_table[i].flags &= ~TERM_NEED_INIT; + break; + } + + /* FIXME: should check if the serial terminal was found. */ + + return 1; +} +#endif /* ! GRUB_UTIL */ + + +/* Generic definitions. */ + +static void +serial_translate_key_sequence (void) +{ + const struct + { + char key; + char ascii; + } + three_code_table[] = + { + {'A', 16}, + {'B', 14}, + {'C', 6}, + {'D', 2}, + {'F', 5}, + {'H', 1}, + {'4', 4} + }; + + const struct + { + short key; + char ascii; + } + four_code_table[] = + { + {('1' | ('~' << 8)), 1}, + {('3' | ('~' << 8)), 4}, + {('5' | ('~' << 8)), 7}, + {('6' | ('~' << 8)), 3}, + }; + + /* The buffer must start with ``ESC [''. */ + if (*((unsigned short *) input_buf) != ('\e' | ('[' << 8))) + return; + + if (npending >= 3) + { + int i; + + for (i = 0; + i < sizeof (three_code_table) / sizeof (three_code_table[0]); + i++) + if (three_code_table[i].key == input_buf[2]) + { + input_buf[0] = three_code_table[i].ascii; + npending -= 2; + grub_memmove (input_buf + 1, input_buf + 3, npending - 1); + return; + } + } + + if (npending >= 4) + { + int i; + short key = *((short *) (input_buf + 2)); + + for (i = 0; + i < sizeof (four_code_table) / sizeof (four_code_table[0]); + i++) + if (four_code_table[i].key == key) + { + input_buf[0] = four_code_table[i].ascii; + npending -= 3; + grub_memmove (input_buf + 1, input_buf + 4, npending - 1); + return; + } + } +} + +static +int fill_input_buf (int nowait) +{ + int i; + + for (i = 0; i < 10000 && npending < sizeof (input_buf); i++) + { + int c; + + c = serial_hw_fetch (); + if (c >= 0) + { + input_buf[npending++] = c; + + /* Reset the counter to zero, to wait for the same interval. */ + i = 0; + } + + if (nowait) + break; + } + + /* Translate some key sequences. */ + serial_translate_key_sequence (); + + return npending; +} + +/* The serial version of getkey. */ +int +serial_getkey (void) +{ + int c; + + while (! fill_input_buf (0)) + ; + + c = input_buf[0]; + npending--; + grub_memmove (input_buf, input_buf + 1, npending); + + return c; +} + +/* The serial version of checkkey. */ +int +serial_checkkey (void) +{ + if (fill_input_buf (1)) + return input_buf[0]; + + return -1; +} + +/* The serial version of grub_putchar. */ +void +serial_putchar (int c) +{ + /* Keep track of the cursor. */ + if (keep_track) + { + /* The serial terminal doesn't have VGA fonts. */ + switch (c) + { + case DISP_UL: + c = ACS_ULCORNER; + break; + case DISP_UR: + c = ACS_URCORNER; + break; + case DISP_LL: + c = ACS_LLCORNER; + break; + case DISP_LR: + c = ACS_LRCORNER; + break; + case DISP_HORIZ: + c = ACS_HLINE; + break; + case DISP_VERT: + c = ACS_VLINE; + break; + case DISP_LEFT: + c = ACS_LARROW; + break; + case DISP_RIGHT: + c = ACS_RARROW; + break; + case DISP_UP: + c = ACS_UARROW; + break; + case DISP_DOWN: + c = ACS_DARROW; + break; + default: + break; + } + + switch (c) + { + case '\r': + serial_x = 0; + break; + + case '\n': + serial_y++; + break; + + case '\b': + case 127: + if (serial_x > 0) + serial_x--; + break; + + case '\a': + break; + + default: + if (serial_x >= 79) + { + serial_putchar ('\r'); + serial_putchar ('\n'); + } + serial_x++; + break; + } + } + + serial_hw_put (c); +} + +int +serial_getxy (void) +{ + return (serial_x << 8) | serial_y; +} + +void +serial_gotoxy (int x, int y) +{ + keep_track = 0; + ti_cursor_address (x, y); + keep_track = 1; + + serial_x = x; + serial_y = y; +} + +void +serial_cls (void) +{ + keep_track = 0; + ti_clear_screen (); + keep_track = 1; + + serial_x = serial_y = 0; +} + +void +serial_setcolorstate (color_state state) +{ + keep_track = 0; + if (state == COLOR_STATE_HIGHLIGHT) + ti_enter_standout_mode (); + else + ti_exit_standout_mode (); + keep_track = 1; +} + +#endif /* SUPPORT_SERIAL */ diff --git a/usr/src/grub/grub-0.97/stage2/serial.h b/usr/src/grub/grub-0.97/stage2/serial.h new file mode 100644 index 0000000000..76c222720d --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/serial.h @@ -0,0 +1,93 @@ +/* serial.h - serial device interface */ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2000,2001,2002 Free Software Foundation, 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 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 GRUB_SERIAL_HEADER +#define GRUB_SERIAL_HEADER 1 + +/* Macros. */ + +/* The offsets of UART registers. */ +#define UART_TX 0 +#define UART_RX 0 +#define UART_DLL 0 +#define UART_IER 1 +#define UART_DLH 1 +#define UART_IIR 2 +#define UART_FCR 2 +#define UART_LCR 3 +#define UART_MCR 4 +#define UART_LSR 5 +#define UART_MSR 6 +#define UART_SR 7 + +/* For LSR bits. */ +#define UART_DATA_READY 0x01 +#define UART_EMPTY_TRANSMITTER 0x20 + +/* The type of parity. */ +#define UART_NO_PARITY 0x00 +#define UART_ODD_PARITY 0x08 +#define UART_EVEN_PARITY 0x18 + +/* The type of word length. */ +#define UART_5BITS_WORD 0x00 +#define UART_6BITS_WORD 0x01 +#define UART_7BITS_WORD 0x02 +#define UART_8BITS_WORD 0x03 + +/* The type of the length of stop bit. */ +#define UART_1_STOP_BIT 0x00 +#define UART_2_STOP_BITS 0x04 + +/* the switch of DLAB. */ +#define UART_DLAB 0x80 + +/* Enable the FIFO. */ +#define UART_ENABLE_FIFO 0xC7 + +/* Turn on DTR, RTS, and OUT2. */ +#define UART_ENABLE_MODEM 0x0B + + +/* Function prototypes. */ + +/* Fetch a key. */ +int serial_hw_fetch (void); + +/* Put a character. */ +void serial_hw_put (int c); + +/* Insert a delay. */ +void serial_hw_delay (void); + +/* Return the port number for the UNITth serial device. */ +unsigned short serial_hw_get_port (int unit); + +/* Initialize a serial device. */ +int serial_hw_init (unsigned short port, unsigned int speed, + int word_len, int parity, int stop_bit_len); + +#ifdef GRUB_UTIL +/* Set the file name of a serial device (or a pty device). This is a + function specific to the grub shell. */ +void serial_set_device (const char *device); +#endif /* GRUB_UTIL */ + +#endif /* ! GRUB_SERIAL_HEADER */ diff --git a/usr/src/grub/grub-0.97/stage2/setjmp.S b/usr/src/grub/grub-0.97/stage2/setjmp.S new file mode 100644 index 0000000000..59161fef0c --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/setjmp.S @@ -0,0 +1,81 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2000 Free Software Foundation, 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 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. + */ + +/* This is stolen from libc/x86/setjmp.S in the OSKit */ +/* + * Mach Operating System + * Copyright (c) 1991,1990,1989 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. + * + * 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 FROM THE USE OF THIS SOFTWARE. + * + * Carnegie Mellon requests users of this software to return to + * + * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU + * School of Computer Science + * Carnegie Mellon University + * Pittsburgh PA 15213-3890 + * + * any improvements or extensions that they make and grant Carnegie Mellon + * the rights to redistribute these changes. + */ +/* + * C library -- _setjmp, _longjmp + * + * _longjmp(a,v) + * will generate a "return(v)" from + * the last call to + * _setjmp(a) + * by restoring registers from the stack, + * The previous signal state is NOT restored. + * + */ + +ENTRY(grub_setjmp) + movl 4(%esp), %ecx /* fetch buffer */ + movl %ebx, 0(%ecx) + movl %esi, 4(%ecx) + movl %edi, 8(%ecx) + movl %ebp, 12(%ecx) /* save frame pointer of caller */ + popl %edx + movl %esp, 16(%ecx) /* save stack pointer of caller */ + movl %edx, 20(%ecx) /* save pc of caller */ + xorl %eax, %eax + jmp *%edx + +ENTRY(grub_longjmp) + movl 8(%esp), %eax /* return(v) */ + movl 4(%esp), %ecx /* fetch buffer */ + movl 0(%ecx), %ebx + movl 4(%ecx), %esi + movl 8(%ecx), %edi + movl 12(%ecx), %ebp + movl 16(%ecx), %esp + orl %eax, %eax + jnz 0f + incl %eax +0: jmp *20(%ecx) /* done, return.... */ diff --git a/usr/src/grub/grub-0.97/stage2/shared.h b/usr/src/grub/grub-0.97/stage2/shared.h new file mode 100644 index 0000000000..8d2f556e02 --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/shared.h @@ -0,0 +1,1068 @@ +/* shared.h - definitions used in all GRUB-specific code */ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, 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 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. + */ +/* + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* + * Generic defines to use anywhere + */ + +#ifndef GRUB_SHARED_HEADER +#define GRUB_SHARED_HEADER 1 + +#include + +/* Add an underscore to a C symbol in assembler code if needed. */ +#ifdef HAVE_ASM_USCORE +# define EXT_C(sym) _ ## sym +#else +# define EXT_C(sym) sym +#endif + +/* Maybe redirect memory requests through grub_scratch_mem. */ +#ifdef GRUB_UTIL +extern char *grub_scratch_mem; +# define RAW_ADDR(x) ((x) + (int) grub_scratch_mem) +# define RAW_SEG(x) (RAW_ADDR ((x) << 4) >> 4) +#else +# define RAW_ADDR(x) (x) +# define RAW_SEG(x) (x) +#endif + +/* ZFS will use the top 4 Meg of physical memory (below 4Gig) for sratch */ +#define ZFS_SCRATCH_SIZE 0x400000 + +#define MAXNAMELEN 256 +#define MIN(x, y) ((x) < (y) ? (x) : (y)) + +/* Boot signature related defines for the findroot command */ +#define BOOTSIGN_DIR "/boot/grub/bootsign" +#define BOOTSIGN_ARGLEN (MAXNAMELEN + 10) /* (,0,d) */ +#define BOOTSIGN_LEN (sizeof (BOOTSIGN_DIR) + 1 + BOOTSIGN_ARGLEN) +#define BOOTSIGN_BACKUP "/etc/bootsign" + +/* + * Integer sizes + */ + +#define MAXINT 0x7FFFFFFF + +/* Maximum command line size. Before you blindly increase this value, + see the comment in char_io.c (get_cmdline). */ +#define MAX_CMDLINE 1600 +#define NEW_HEAPSIZE 1500 + +/* 512-byte scratch area */ +#define SCRATCHADDR RAW_ADDR (0x77e00) +#define SCRATCHSEG RAW_SEG (0x77e0) + +/* + * This is the location of the raw device buffer. It is 31.5K + * in size. + */ + +#define BUFFERLEN 0x7e00 +#define BUFFERADDR RAW_ADDR (0x70000) +#define BUFFERSEG RAW_SEG (0x7000) + +#define BOOT_PART_TABLE RAW_ADDR (0x07be) + +/* + * BIOS disk defines + */ +#define BIOSDISK_READ 0x0 +#define BIOSDISK_WRITE 0x1 +#define BIOSDISK_ERROR_GEOMETRY 0x100 +#define BIOSDISK_ERROR_SHORT_IO 0x101 +#define BIOSDISK_FLAG_LBA_EXTENSION 0x1 +#define BIOSDISK_FLAG_CDROM 0x2 + +/* + * This is the filesystem (not raw device) buffer. + * It is 32K in size, do not overrun! + */ + +#define FSYS_BUFLEN 0x8000 +#define FSYS_BUF RAW_ADDR (0x68000) + +/* Command-line buffer for Multiboot kernels and modules. This area + includes the area into which Stage 1.5 and Stage 1 are loaded, but + that's no problem. */ +#define MB_CMDLINE_BUF RAW_ADDR (0x2000) +#define MB_CMDLINE_BUFLEN 0x6000 + +/* The buffer for the password. */ +#define PASSWORD_BUF RAW_ADDR (0x78000) +#define PASSWORD_BUFLEN 0x200 + +/* THe buffer for the filename of "/boot/grub/default". */ +#define DEFAULT_FILE_BUF (PASSWORD_BUF + PASSWORD_BUFLEN) +#define DEFAULT_FILE_BUFLEN 0x60 + +/* The buffer for the command-line. */ +#define CMDLINE_BUF (DEFAULT_FILE_BUF + DEFAULT_FILE_BUFLEN) +#define CMDLINE_BUFLEN MAX_CMDLINE + +/* The kill buffer for the command-line. */ +#define KILL_BUF (CMDLINE_BUF + CMDLINE_BUFLEN) +#define KILL_BUFLEN MAX_CMDLINE + +/* The history buffer for the command-line. */ +#define HISTORY_BUF (KILL_BUF + KILL_BUFLEN) +#define HISTORY_SIZE 5 +#define HISTORY_BUFLEN (MAX_CMDLINE * HISTORY_SIZE) + +/* The buffer for the completion. */ +#define COMPLETION_BUF (HISTORY_BUF + HISTORY_BUFLEN) +#define COMPLETION_BUFLEN MAX_CMDLINE + +/* The buffer for the unique string. */ +#define UNIQUE_BUF (COMPLETION_BUF + COMPLETION_BUFLEN) +#define UNIQUE_BUFLEN MAX_CMDLINE + +/* The buffer for the menu entries. */ +#define MENU_BUF (UNIQUE_BUF + UNIQUE_BUFLEN) +#define MENU_BUFLEN (0x8000 + PASSWORD_BUF - MENU_BUF) + +/* The size of the drive map. */ +#define DRIVE_MAP_SIZE 8 + +/* The size of the key map. */ +#define KEY_MAP_SIZE 128 + +/* The size of the io map. */ +#define IO_MAP_SIZE 128 + +/* + * Linux setup parameters + */ + +#define LINUX_MAGIC_SIGNATURE 0x53726448 /* "HdrS" */ +#define LINUX_DEFAULT_SETUP_SECTS 4 +#define LINUX_FLAG_CAN_USE_HEAP 0x80 +#define LINUX_INITRD_MAX_ADDRESS 0x38000000 +#define LINUX_MAX_SETUP_SECTS 64 +#define LINUX_BOOT_LOADER_TYPE 0x71 +#define LINUX_HEAP_END_OFFSET (0x9000 - 0x200) + +#define LINUX_BZIMAGE_ADDR RAW_ADDR (0x100000) +#define LINUX_ZIMAGE_ADDR RAW_ADDR (0x10000) +#define LINUX_OLD_REAL_MODE_ADDR RAW_ADDR (0x90000) +#define LINUX_SETUP_STACK 0x9000 + +#define LINUX_FLAG_BIG_KERNEL 0x1 + +/* Linux's video mode selection support. Actually I hate it! */ +#define LINUX_VID_MODE_NORMAL 0xFFFF +#define LINUX_VID_MODE_EXTENDED 0xFFFE +#define LINUX_VID_MODE_ASK 0xFFFD + +#define LINUX_CL_OFFSET 0x9000 +#define LINUX_CL_END_OFFSET 0x90FF +#define LINUX_SETUP_MOVE_SIZE 0x9100 +#define LINUX_CL_MAGIC 0xA33F + +/* + * General disk stuff + */ + +#define SECTOR_SIZE 0x200 +#define SECTOR_BITS 9 +#define BIOS_FLAG_FIXED_DISK 0x80 + +#define BOOTSEC_LOCATION RAW_ADDR (0x7C00) +#define BOOTSEC_SIGNATURE 0xAA55 +#define BOOTSEC_BPB_OFFSET 0x3 +#define BOOTSEC_BPB_LENGTH 0x3B +#define BOOTSEC_BPB_SYSTEM_ID 0x3 +#define BOOTSEC_BPB_HIDDEN_SECTORS 0x1C +#define BOOTSEC_PART_OFFSET 0x1BE +#define BOOTSEC_PART_LENGTH 0x40 +#define BOOTSEC_SIG_OFFSET 0x1FE +#define BOOTSEC_LISTSIZE 8 + +/* Not bad, perhaps. */ +#define NETWORK_DRIVE 0x20 + +/* + * GRUB specific information + * (in LSB order) + */ + +#include + +#define STAGE2_VER_MAJ_OFFS 0x6 +#define STAGE2_INSTALLPART 0x8 +#define STAGE2_SAVED_ENTRYNO 0xc +#define STAGE2_STAGE2_ID 0x10 +#define STAGE2_FORCE_LBA 0x11 +#define STAGE2_VER_STR_OFFS 0x12 + +/* Stage 2 identifiers */ +#define STAGE2_ID_STAGE2 0 +#define STAGE2_ID_FFS_STAGE1_5 1 +#define STAGE2_ID_E2FS_STAGE1_5 2 +#define STAGE2_ID_FAT_STAGE1_5 3 +#define STAGE2_ID_MINIX_STAGE1_5 4 +#define STAGE2_ID_REISERFS_STAGE1_5 5 +#define STAGE2_ID_VSTAFS_STAGE1_5 6 +#define STAGE2_ID_JFS_STAGE1_5 7 +#define STAGE2_ID_XFS_STAGE1_5 8 +#define STAGE2_ID_ISO9660_STAGE1_5 9 +#define STAGE2_ID_UFS2_STAGE1_5 10 +#define STAGE2_ID_UFS_STAGE1_5 11 +#define STAGE2_ID_ZFS_STAGE1_5 12 + +#ifndef STAGE1_5 +# define STAGE2_ID STAGE2_ID_STAGE2 +#else +# if defined(FSYS_FFS) +# define STAGE2_ID STAGE2_ID_FFS_STAGE1_5 +# elif defined(FSYS_EXT2FS) +# define STAGE2_ID STAGE2_ID_E2FS_STAGE1_5 +# elif defined(FSYS_FAT) +# define STAGE2_ID STAGE2_ID_FAT_STAGE1_5 +# elif defined(FSYS_MINIX) +# define STAGE2_ID STAGE2_ID_MINIX_STAGE1_5 +# elif defined(FSYS_REISERFS) +# define STAGE2_ID STAGE2_ID_REISERFS_STAGE1_5 +# elif defined(FSYS_VSTAFS) +# define STAGE2_ID STAGE2_ID_VSTAFS_STAGE1_5 +# elif defined(FSYS_JFS) +# define STAGE2_ID STAGE2_ID_JFS_STAGE1_5 +# elif defined(FSYS_XFS) +# define STAGE2_ID STAGE2_ID_XFS_STAGE1_5 +# elif defined(FSYS_ISO9660) +# define STAGE2_ID STAGE2_ID_ISO9660_STAGE1_5 +# elif defined(FSYS_UFS2) +# define STAGE2_ID STAGE2_ID_UFS2_STAGE1_5 +# elif defined(FSYS_UFS) +# define STAGE2_ID STAGE2_ID_UFS_STAGE1_5 +# elif defined(FSYS_ZFS) +# define STAGE2_ID STAGE2_ID_ZFS_STAGE1_5 +# else +# error "unknown Stage 2" +# endif +#endif + +/* + * defines for use when switching between real and protected mode + */ + +#define CR0_PE_ON 0x1 +#define CR0_PE_OFF 0xfffffffe +#define PROT_MODE_CSEG 0x8 +#define PROT_MODE_DSEG 0x10 +#define PSEUDO_RM_CSEG 0x18 +#define PSEUDO_RM_DSEG 0x20 +#define STACKOFF (0x2000 - 0x10) +#define PROTSTACKINIT (FSYS_BUF - 0x10) + + +/* + * Assembly code defines + * + * "EXT_C" is assumed to be defined in the Makefile by the configure + * command. + */ + +#define ENTRY(x) .globl EXT_C(x) ; EXT_C(x): +#define VARIABLE(x) ENTRY(x) + + +#define K_RDWR 0x60 /* keyboard data & cmds (read/write) */ +#define K_STATUS 0x64 /* keyboard status */ +#define K_CMD 0x64 /* keybd ctlr command (write-only) */ + +#define K_OBUF_FUL 0x01 /* output buffer full */ +#define K_IBUF_FUL 0x02 /* input buffer full */ + +#define KC_CMD_WIN 0xd0 /* read output port */ +#define KC_CMD_WOUT 0xd1 /* write output port */ +#define KB_OUTPUT_MASK 0xdd /* enable output buffer full interrupt + enable data line + enable clock line */ +#define KB_A20_ENABLE 0x02 + +/* Codes for getchar. */ +#define ASCII_CHAR(x) ((x) & 0xFF) +#if !defined(GRUB_UTIL) || !defined(HAVE_LIBCURSES) +# define KEY_LEFT 0x4B00 +# define KEY_RIGHT 0x4D00 +# define KEY_UP 0x4800 +# define KEY_DOWN 0x5000 +# define KEY_IC 0x5200 /* insert char */ +# define KEY_DC 0x5300 /* delete char */ +# define KEY_BACKSPACE 0x0008 +# define KEY_HOME 0x4700 +# define KEY_END 0x4F00 +# define KEY_NPAGE 0x5100 +# define KEY_PPAGE 0x4900 +# define A_NORMAL 0x7 +# define A_REVERSE 0x70 +#elif defined(HAVE_NCURSES_CURSES_H) +# include +#elif defined(HAVE_NCURSES_H) +# include +#elif defined(HAVE_CURSES_H) +# include +#endif + +/* In old BSD curses, A_NORMAL and A_REVERSE are not defined, so we + define them here if they are undefined. */ +#ifndef A_NORMAL +# define A_NORMAL 0 +#endif /* ! A_NORMAL */ +#ifndef A_REVERSE +# ifdef A_STANDOUT +# define A_REVERSE A_STANDOUT +# else /* ! A_STANDOUT */ +# define A_REVERSE 0 +# endif /* ! A_STANDOUT */ +#endif /* ! A_REVERSE */ + +/* Define ACS_* ourselves, since the definitions are not consistent among + various curses implementations. */ +#undef ACS_ULCORNER +#undef ACS_URCORNER +#undef ACS_LLCORNER +#undef ACS_LRCORNER +#undef ACS_HLINE +#undef ACS_VLINE +#undef ACS_LARROW +#undef ACS_RARROW +#undef ACS_UARROW +#undef ACS_DARROW + +#define ACS_ULCORNER '+' +#define ACS_URCORNER '+' +#define ACS_LLCORNER '+' +#define ACS_LRCORNER '+' +#define ACS_HLINE '-' +#define ACS_VLINE '|' +#define ACS_LARROW '<' +#define ACS_RARROW '>' +#define ACS_UARROW '^' +#define ACS_DARROW 'v' + +/* Special graphics characters for IBM displays. */ +#define DISP_UL 218 +#define DISP_UR 191 +#define DISP_LL 192 +#define DISP_LR 217 +#define DISP_HORIZ 196 +#define DISP_VERT 179 +#define DISP_LEFT 0x1b +#define DISP_RIGHT 0x1a +#define DISP_UP 0x18 +#define DISP_DOWN 0x19 + +/* Remap some libc-API-compatible function names so that we prevent + circularararity. */ +#ifndef WITHOUT_LIBC_STUBS +#define memmove grub_memmove +#define memcpy grub_memmove /* we don't need a separate memcpy */ +#define memset grub_memset +#undef isspace +#define isspace grub_isspace +#define printf grub_printf +#define sprintf grub_sprintf +#undef putchar +#define putchar grub_putchar +#define strncat grub_strncat +#define strstr grub_strstr +#define memcmp grub_memcmp +#define strcmp grub_strcmp +#define tolower grub_tolower +#define strlen grub_strlen +#define strcpy grub_strcpy +#endif /* WITHOUT_LIBC_STUBS */ + +#define UNDI_STACK (512 + 64) << 10 +#define UNDI_STACK_SEG (UNDI_STACK >> 4) /* PXE load GRUB here */ +#define UNDI_STACK_OFF (0x10000 - 0x10) + +#ifndef ASM_FILE +/* + * Below this should be ONLY defines and other constructs for C code. + */ + +/* multiboot stuff */ + +#include "mb_header.h" +#include "mb_info.h" + +/* For the Linux/i386 boot protocol version 2.03. */ +struct linux_kernel_header +{ + char code1[0x0020]; + unsigned short cl_magic; /* Magic number 0xA33F */ + unsigned short cl_offset; /* The offset of command line */ + char code2[0x01F1 - 0x0020 - 2 - 2]; + unsigned char setup_sects; /* The size of the setup in sectors */ + unsigned short root_flags; /* If the root is mounted readonly */ + unsigned short syssize; /* obsolete */ + unsigned short swap_dev; /* obsolete */ + unsigned short ram_size; /* obsolete */ + unsigned short vid_mode; /* Video mode control */ + unsigned short root_dev; /* Default root device number */ + unsigned short boot_flag; /* 0xAA55 magic number */ + unsigned short jump; /* Jump instruction */ + unsigned long header; /* Magic signature "HdrS" */ + unsigned short version; /* Boot protocol version supported */ + unsigned long realmode_swtch; /* Boot loader hook */ + unsigned long start_sys; /* Points to kernel version string */ + unsigned char type_of_loader; /* Boot loader identifier */ + unsigned char loadflags; /* Boot protocol option flags */ + unsigned short setup_move_size; /* Move to high memory size */ + unsigned long code32_start; /* Boot loader hook */ + unsigned long ramdisk_image; /* initrd load address */ + unsigned long ramdisk_size; /* initrd size */ + unsigned long bootsect_kludge; /* obsolete */ + unsigned short heap_end_ptr; /* Free memory after setup end */ + unsigned short pad1; /* Unused */ + char *cmd_line_ptr; /* Points to the kernel command line */ + unsigned long initrd_addr_max; /* The highest address of initrd */ +} __attribute__ ((packed)); + +/* Memory map address range descriptor used by GET_MMAP_ENTRY. */ +struct mmar_desc +{ + unsigned long desc_len; /* Size of this descriptor. */ + unsigned long long addr; /* Base address. */ + unsigned long long length; /* Length in bytes. */ + unsigned long type; /* Type of address range. */ +} __attribute__ ((packed)); + +/* VBE controller information. */ +struct vbe_controller +{ + unsigned char signature[4]; + unsigned short version; + unsigned long oem_string; + unsigned long capabilities; + unsigned long video_mode; + unsigned short total_memory; + unsigned short oem_software_rev; + unsigned long oem_vendor_name; + unsigned long oem_product_name; + unsigned long oem_product_rev; + unsigned char reserved[222]; + unsigned char oem_data[256]; +} __attribute__ ((packed)); + +/* VBE mode information. */ +struct vbe_mode +{ + unsigned short mode_attributes; + unsigned char win_a_attributes; + unsigned char win_b_attributes; + unsigned short win_granularity; + unsigned short win_size; + unsigned short win_a_segment; + unsigned short win_b_segment; + unsigned long win_func; + unsigned short bytes_per_scanline; + + /* >=1.2 */ + unsigned short x_resolution; + unsigned short y_resolution; + unsigned char x_char_size; + unsigned char y_char_size; + unsigned char number_of_planes; + unsigned char bits_per_pixel; + unsigned char number_of_banks; + unsigned char memory_model; + unsigned char bank_size; + unsigned char number_of_image_pages; + unsigned char reserved0; + + /* direct color */ + unsigned char red_mask_size; + unsigned char red_field_position; + unsigned char green_mask_size; + unsigned char green_field_position; + unsigned char blue_mask_size; + unsigned char blue_field_position; + unsigned char reserved_mask_size; + unsigned char reserved_field_position; + unsigned char direct_color_mode_info; + + /* >=2.0 */ + unsigned long phys_base; + unsigned long reserved1; + unsigned short reversed2; + + /* >=3.0 */ + unsigned short linear_bytes_per_scanline; + unsigned char banked_number_of_image_pages; + unsigned char linear_number_of_image_pages; + unsigned char linear_red_mask_size; + unsigned char linear_red_field_position; + unsigned char linear_green_mask_size; + unsigned char linear_green_field_position; + unsigned char linear_blue_mask_size; + unsigned char linear_blue_field_position; + unsigned char linear_reserved_mask_size; + unsigned char linear_reserved_field_position; + unsigned long max_pixel_clock; + + unsigned char reserved3[189]; +} __attribute__ ((packed)); + + +#undef NULL +#define NULL ((void *) 0) + +/* Error codes (descriptions are in common.c) */ +typedef enum +{ + ERR_NONE = 0, + ERR_BAD_FILENAME, + ERR_BAD_FILETYPE, + ERR_BAD_GZIP_DATA, + ERR_BAD_GZIP_HEADER, + ERR_BAD_PART_TABLE, + ERR_BAD_VERSION, + ERR_BELOW_1MB, + ERR_BOOT_COMMAND, + ERR_BOOT_FAILURE, + ERR_BOOT_FEATURES, + ERR_DEV_FORMAT, + ERR_DEV_VALUES, + ERR_EXEC_FORMAT, + ERR_FILELENGTH, + ERR_FILE_NOT_FOUND, + ERR_FSYS_CORRUPT, + ERR_FSYS_MOUNT, + ERR_GEOM, + ERR_NEED_LX_KERNEL, + ERR_NEED_MB_KERNEL, + ERR_NO_DISK, + ERR_NO_PART, + ERR_NUMBER_PARSING, + ERR_OUTSIDE_PART, + ERR_READ, + ERR_SYMLINK_LOOP, + ERR_UNRECOGNIZED, + ERR_WONT_FIT, + ERR_WRITE, + ERR_BAD_ARGUMENT, + ERR_UNALIGNED, + ERR_PRIVILEGED, + ERR_DEV_NEED_INIT, + ERR_NO_DISK_SPACE, + ERR_NUMBER_OVERFLOW, + ERR_BAD_GZIP_CRC, + ERR_FILESYSTEM_NOT_FOUND, + ERR_NO_BOOTPATH, + ERR_NEWER_VERSION, + + MAX_ERR_NUM +} grub_error_t; + +extern unsigned long install_partition; +extern unsigned long boot_drive; +extern unsigned long install_second_sector; +extern struct apm_info apm_bios_info; +extern unsigned long boot_part_addr; +extern int saved_entryno; +extern unsigned char force_lba; +extern char version_string[]; +extern char config_file[]; +extern unsigned long linux_text_len; +extern char *linux_data_tmp_addr; +extern char *linux_data_real_addr; + +#ifdef GRUB_UTIL +/* If not using config file, this variable is set to zero, + otherwise non-zero. */ +extern int use_config_file; +/* If using the preset menu, this variable is set to non-zero, + otherwise zero. */ +extern int use_preset_menu; +/* If not using curses, this variable is set to zero, otherwise non-zero. */ +extern int use_curses; +/* The flag for verbose messages. */ +extern int verbose; +/* The flag for read-only. */ +extern int read_only; +/* The number of floppies to be probed. */ +extern int floppy_disks; +/* The map between BIOS drives and UNIX device file names. */ +extern char **device_map; +/* The filename which stores the information about a device map. */ +extern char *device_map_file; +/* The array of geometries. */ +extern struct geometry *disks; +/* Assign DRIVE to a device name DEVICE. */ +extern void assign_device_name (int drive, const char *device); +#endif + +#ifndef STAGE1_5 +/* GUI interface variables. */ +# define MAX_FALLBACK_ENTRIES 8 +extern int fallback_entries[MAX_FALLBACK_ENTRIES]; +extern int fallback_entryno; +extern int default_entry; +extern int current_entryno; + +/* The constants for password types. */ +typedef enum +{ + PASSWORD_PLAIN, + PASSWORD_MD5, + PASSWORD_UNSUPPORTED +} +password_t; + +extern char *password; +extern password_t password_type; +extern int auth; +extern char commands[]; + +/* For `more'-like feature. */ +extern int max_lines; +extern int count_lines; +extern int use_pager; +#endif + +#ifndef NO_DECOMPRESSION +extern int no_decompression; +extern int compressed_file; +#endif + +/* instrumentation variables */ +extern void (*disk_read_hook) (unsigned int, int, int); +extern void (*disk_read_func) (unsigned int, int, int); + +#ifndef STAGE1_5 +/* The flag for debug mode. */ +extern int debug; +#endif /* STAGE1_5 */ + +extern unsigned long current_drive; +extern unsigned long current_partition; +extern char current_rootpool[MAXNAMELEN]; +extern char current_bootfs[MAXNAMELEN]; +extern char current_bootpath[MAXNAMELEN]; +extern unsigned long long current_bootfs_obj; +extern char current_devid[MAXNAMELEN]; +extern int is_zfs_mount; +extern unsigned long best_drive; +extern unsigned long best_part; +extern int find_best_root; + +extern int fsys_type; + +/* The information for a disk geometry. The CHS information is only for + DOS/Partition table compatibility, and the real number of sectors is + stored in TOTAL_SECTORS. */ +struct geometry +{ + /* The number of cylinders */ + unsigned long cylinders; + /* The number of heads */ + unsigned long heads; + /* The number of sectors */ + unsigned long sectors; + /* The total number of sectors */ + unsigned long total_sectors; + /* Device sector size */ + unsigned long sector_size; + /* Flags */ + unsigned long flags; +}; + +extern unsigned long part_start; +extern unsigned long part_length; + +extern int current_slice; + +extern int buf_drive; +#define BUF_CACHE_INVALID 0xffffffff +extern unsigned int buf_track; +extern struct geometry buf_geom; + +/* these are the current file position and maximum file position */ +extern int filepos; +extern int filemax; + +/* + * Common BIOS/boot data. + */ + +extern struct multiboot_info mbi; +extern unsigned long saved_drive; +extern unsigned long saved_partition; +extern unsigned long cdrom_drive; +#ifndef STAGE1_5 +#ifdef SOLARIS_NETBOOT +extern unsigned long dhcpack_length; +extern unsigned long dhcpack_buf; +#endif +extern unsigned long saved_mem_upper; +extern unsigned long extended_memory; +#endif + +/* + * Error variables. + */ + +extern grub_error_t errnum; +extern char *err_list[]; + +/* don't print geeky noise */ +typedef enum +{ + SILENT, + VERBOSE, + DEFER_SILENT, + DEFER_VERBOSE +} silent_status; + +/* one screen worth of messages 80x24 = 1920 chars -- more with newlines */ +#define SCREENBUF 2000 + +struct silentbuf { + silent_status status; + int looped; + char buffer[SCREENBUF]; + char *buffer_start; +}; + +extern struct silentbuf silent; +extern int reset_term; + +/* Simplify declaration of entry_addr. */ +typedef void (*entry_func) (int, int, int, int, int, int) + __attribute__ ((noreturn)); + +extern entry_func entry_addr; + +/* Enter the stage1.5/stage2 C code after the stack is set up. */ +void cmain (void); + +/* Halt the processor (called after an unrecoverable error). */ +void stop (void) __attribute__ ((noreturn)); + +/* Reboot the system. */ +void grub_reboot (void) __attribute__ ((noreturn)); + +/* Halt the system, using APM if possible. If NO_APM is true, don't use + APM even if it is available. */ +void grub_halt (int no_apm) __attribute__ ((noreturn)); + +/* Copy MAP to the drive map and set up int13_handler. */ +void set_int13_handler (unsigned short *map); + +/* Set up int15_handler. */ +void set_int15_handler (void); + +/* Restore the original int15 handler. */ +void unset_int15_handler (void); + +/* Track the int13 handler to probe I/O address space. */ +void track_int13 (int drive); + +/* The key map. */ +extern unsigned short bios_key_map[]; +extern unsigned short ascii_key_map[]; +extern unsigned short io_map[]; + +/* calls for direct boot-loader chaining */ +void chain_stage1 (unsigned long segment, unsigned long offset, + unsigned long part_table_addr) + __attribute__ ((noreturn)); +void chain_stage2 (unsigned long segment, unsigned long offset, + int second_sector) + __attribute__ ((noreturn)); + +/* do some funky stuff, then boot linux */ +void linux_boot (void) __attribute__ ((noreturn)); + +/* do some funky stuff, then boot bzImage linux */ +void big_linux_boot (void) __attribute__ ((noreturn)); + +/* booting a multiboot executable */ +void multi_boot (int start, int mb_info) __attribute__ ((noreturn)); + +/* If LINEAR is nonzero, then set the Intel processor to linear mode. + Otherwise, bit 20 of all memory accesses is always forced to zero, + causing a wraparound effect for bugwards compatibility with the + 8086 CPU. */ +void gateA20 (int linear); + +/* memory probe routines */ +int get_memsize (int type); +int get_eisamemsize (void); + +/* Fetch the next entry in the memory map and return the continuation + value. DESC is a pointer to the descriptor buffer, and CONT is the + previous continuation value (0 to get the first entry in the + map). */ +int get_mmap_entry (struct mmar_desc *desc, int cont); + +/* Get the linear address of a ROM configuration table. Return zero, + if fails. */ +unsigned long get_rom_config_table (void); + +/* Get APM BIOS information. */ +void get_apm_info (void); + +/* Get VBE controller information. */ +int get_vbe_controller_info (struct vbe_controller *controller); + +/* Get VBE mode information. */ +int get_vbe_mode_info (int mode_number, struct vbe_mode *mode); + +/* Set VBE mode. */ +int set_vbe_mode (int mode_number); + +/* Return the data area immediately following our code. */ +int get_code_end (void); + +/* low-level timing info */ +int getrtsecs (void); +int currticks (void); + +/* Clear the screen. */ +void cls (void); + +/* Turn on/off cursor. */ +int setcursor (int on); + +/* Get the current cursor position (where 0,0 is the top left hand + corner of the screen). Returns packed values, (RET >> 8) is x, + (RET & 0xff) is y. */ +int getxy (void); + +/* Set the cursor position. */ +void gotoxy (int x, int y); + +/* Displays an ASCII character. IBM displays will translate some + characters to special graphical ones (see the DISP_* constants). */ +void grub_putchar (int c); + +/* Wait for a keypress, and return its packed BIOS/ASCII key code. + Use ASCII_CHAR(ret) to extract the ASCII code. */ +int getkey (void); + +/* Like GETKEY, but doesn't block, and returns -1 if no keystroke is + available. */ +int checkkey (void); + +/* Low-level disk I/O */ +int get_diskinfo (int drive, struct geometry *geometry); +int biosdisk (int subfunc, int drive, struct geometry *geometry, + unsigned int sector, int nsec, int segment); +void stop_floppy (void); + +/* Command-line interface functions. */ +#ifndef STAGE1_5 + +/* The flags for the builtins. */ +#define BUILTIN_CMDLINE 0x1 /* Run in the command-line. */ +#define BUILTIN_MENU 0x2 /* Run in the menu. */ +#define BUILTIN_TITLE 0x4 /* Only for the command title. */ +#define BUILTIN_SCRIPT 0x8 /* Run in the script. */ +#define BUILTIN_NO_ECHO 0x10 /* Don't print command on booting. */ +#define BUILTIN_HELP_LIST 0x20 /* Show help in listing. */ + +/* The table for a builtin. */ +struct builtin +{ + /* The command name. */ + char *name; + /* The callback function. */ + int (*func) (char *, int); + /* The combination of the flags defined above. */ + int flags; + /* The short version of the documentation. */ + char *short_doc; + /* The long version of the documentation. */ + char *long_doc; +}; + +/* All the builtins are registered in this. */ +extern struct builtin *builtin_table[]; + +/* The constants for kernel types. */ +typedef enum +{ + KERNEL_TYPE_NONE, /* None is loaded. */ + KERNEL_TYPE_MULTIBOOT, /* Multiboot. */ + KERNEL_TYPE_LINUX, /* Linux. */ + KERNEL_TYPE_BIG_LINUX, /* Big Linux. */ + KERNEL_TYPE_FREEBSD, /* FreeBSD. */ + KERNEL_TYPE_NETBSD, /* NetBSD. */ + KERNEL_TYPE_CHAINLOADER /* Chainloader. */ +} +kernel_t; + +extern kernel_t kernel_type; +extern int show_menu; +extern int grub_timeout; + +void init_builtins (void); +void init_config (void); +char *skip_to (int after_equal, char *cmdline); +struct builtin *find_command (char *command); +void print_cmdline_message (int forever); +void enter_cmdline (char *heap, int forever); +int run_script (char *script, char *heap); +#endif + +/* C library replacement functions with identical semantics. */ +void grub_printf (const char *format,...); +int grub_sprintf (char *buffer, const char *format, ...); +int grub_tolower (int c); +int grub_isspace (int c); +int grub_strncat (char *s1, const char *s2, int n); +void grub_memcpy(void *dest, const void *src, int len); +void *grub_memmove (void *to, const void *from, int len); +void *grub_memset (void *start, int c, int len); +int grub_strncat (char *s1, const char *s2, int n); +char *grub_strstr (const char *s1, const char *s2); +int grub_memcmp (const char *s1, const char *s2, int n); +int grub_strcmp (const char *s1, const char *s2); +int grub_strlen (const char *str); +char *grub_strcpy (char *dest, const char *src); +char *grub_strchr (char *str, char c); + +void noisy_printf (const char *format,...); + +#ifndef GRUB_UTIL +typedef unsigned long grub_jmp_buf[6]; +#else +/* In the grub shell, use the libc jmp_buf instead. */ +# include +# define grub_jmp_buf jmp_buf +#endif + +#ifdef GRUB_UTIL +# define grub_setjmp setjmp +# define grub_longjmp longjmp +#else /* ! GRUB_UTIL */ +int grub_setjmp (grub_jmp_buf env); +void grub_longjmp (grub_jmp_buf env, int val); +#endif /* ! GRUB_UTIL */ + +/* The environment for restarting Stage 2. */ +extern grub_jmp_buf restart_env; +/* The environment for restarting the command-line interface. */ +extern grub_jmp_buf restart_cmdline_env; + +/* misc */ +void init_page (void); +void print_error (void); +char *convert_to_ascii (char *buf, int c, ...); +int get_cmdline (char *prompt, char *cmdline, int maxlen, + int echo_char, int history); +int substring (const char *s1, const char *s2); +int nul_terminate (char *str); +int get_based_digit (int c, int base); +int safe_parse_maxint (char **str_ptr, int *myint_ptr); +int memcheck (unsigned long start, unsigned long len); +void grub_putstr (const char *str); + +#ifndef NO_DECOMPRESSION +/* Compression support. */ +int gunzip_test_header (void); +int gunzip_read (char *buf, int len); +#endif /* NO_DECOMPRESSION */ + +int rawread (int drive, unsigned int sector, int byte_offset, int byte_len, + char *buf); +int devread (unsigned int sector, int byte_offset, int byte_len, char *buf); +int rawwrite (int drive, unsigned int sector, char *buf); +int devwrite (unsigned int sector, int sector_len, char *buf); + +/* Parse a device string and initialize the global parameters. */ +char *set_device (char *device); +int open_device (void); +int real_open_partition (int flags); +int open_partition (void); +int next_partition (unsigned long drive, unsigned long dest, + unsigned long *partition, int *type, + unsigned long *start, unsigned long *len, + unsigned long *offset, int *entry, + unsigned long *ext_offset, char *buf); + +/* Sets device to the one represented by the SAVED_* parameters. */ +int make_saved_active (void); + +/* Set or clear the current root partition's hidden flag. */ +int set_partition_hidden_flag (int hidden); + +/* Open a file or directory on the active device, using GRUB's + internal filesystem support. */ +int grub_open (char *filename); + +/* Read LEN bytes into BUF from the file that was opened with + GRUB_OPEN. If LEN is -1, read all the remaining data in the file. */ +int grub_read (char *buf, int len); + +/* Reposition a file offset. */ +int grub_seek (int offset); + +/* Close a file. */ +void grub_close (void); + +/* List the contents of the directory that was opened with GRUB_OPEN, + printing all completions. */ +int dir (char *dirname); + +int set_bootdev (int hdbias); + +/* Display statistics on the current active device. */ +void print_fsys_type (void); + +/* Display device and filename completions. */ +void print_a_completion (char *filename); +int print_completions (int is_filename, int is_completion); + +/* Copies the current partition data to the desired address. */ +void copy_current_part_entry (char *buf); + +#ifndef STAGE1_5 +void bsd_boot (kernel_t type, int bootdev, char *arg) + __attribute__ ((noreturn)); + +/* Define flags for load_image here. */ +/* Don't pass a Linux's mem option automatically. */ +#define KERNEL_LOAD_NO_MEM_OPTION (1 << 0) + +kernel_t load_image (char *kernel, char *arg, kernel_t suggested_type, + unsigned long load_flags); + +int load_module (char *module, char *arg); +int load_initrd (char *initrd); + +int check_password(char *entered, char* expected, password_t type); +#endif + +void init_bios_info (void); + +#endif /* ASM_FILE */ + +#endif /* ! GRUB_SHARED_HEADER */ diff --git a/usr/src/grub/grub-0.97/stage2/size_test b/usr/src/grub/grub-0.97/stage2/size_test new file mode 100644 index 0000000000..f2b8c945ca --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/size_test @@ -0,0 +1,54 @@ +#!/bin/sh + +# Check the sizes of Stage 2 and Stage 1.5's. +# Copyright (C) 1999,2004 Free Software Foundation, 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, 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 OKUJI Yoshinori + + +# This function checks if the size of the first argument (filename) is +# greater than the second argument (limit). If so, then exit with the +# status 1, otherwise do nothing. +check () +{ + file=$1 + limit=$2 + set dummy `ls -l $file` + size=$6 + if test $size -gt $limit; then + echo "$file is too big ($size > $limit)." + exit 1 + fi +} + +# The bootloader area of a FFS partition is 14 sectors. +check ffs_stage1_5 7168 + +check ufs2_stage1_5 7168 + +# Stage 1.5 can be installed in the sectors immediately after MBR in the +# first cylinder, so the size is (63 - 1) sectors. +check fat_stage1_5 31744 + +# Likewise. +check e2fs_stage1_5 31744 + +# Likewise. +check minix_stage1_5 31744 + +# Success. +exit 0 diff --git a/usr/src/grub/grub-0.97/stage2/smp-imps.c b/usr/src/grub/grub-0.97/stage2/smp-imps.c new file mode 100644 index 0000000000..6b2c1e721e --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/smp-imps.c @@ -0,0 +1,756 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2005,2005 Free Software Foundation, 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 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. + */ + +/* + * + * + * Author: Erich Boleyn http://www.uruk.org/~erich/ + * + * Source file implementing Intel MultiProcessor Specification (MPS) + * version 1.1 and 1.4 SMP hardware control for Intel Architecture CPUs, + * with hooks for running correctly on a standard PC without the hardware. + * + * This file was created from information in the Intel MPS version 1.4 + * document, order number 242016-004, which can be ordered from the + * Intel literature center. + * + * General limitations of this code: + * + * (1) : This code has never been tested on an MPS-compatible system with + * 486 CPUs, but is expected to work. + * (2) : Presumes "int", "long", and "unsigned" are 32 bits in size, and + * that 32-bit pointers and memory addressing is used uniformly. + */ + +#define _SMP_IMPS_C + + +/* + * XXXXX The following absolutely must be defined!!! + * + * The "KERNEL_PRINT" could be made a null macro with no danger, of + * course, but pretty much nothing would work without the other + * ones defined. + */ + +#if 0 +#define KERNEL_PRINT(x) /* some kind of print function */ +#define CMOS_WRITE_BYTE(x,y) /* write unsigned char "y" at CMOS loc "x" */ +#define CMOS_READ_BYTE(x) /* read unsigned char at CMOS loc "x" */ +#define PHYS_TO_VIRTUAL(x) /* convert physical address "x" to virtual */ +#define VIRTUAL_TO_PHYS(x) /* convert virtual address "x" to physical */ +#endif + + +/* + * This is the Intel MultiProcessor Spec debugging/display code. + */ + +#define IMPS_DEBUG +#define KERNEL_PRINT(x) printf x +#define CMOS_WRITE_BYTE(x, y) cmos_write_byte(x, y) +#define CMOS_READ_BYTE(x) cmos_read_byte(x) +#define PHYS_TO_VIRTUAL(x) (x) +#define VIRTUAL_TO_PHYS(x) (x) + +static inline unsigned char +inb (unsigned short port) +{ + unsigned char data; + + __asm __volatile ("inb %1,%0" :"=a" (data):"d" (port)); + return data; +} + +static inline void +outb (unsigned short port, unsigned char val) +{ + __asm __volatile ("outb %0,%1"::"a" (val), "d" (port)); +} + + +static inline void +cmos_write_byte (int loc, int val) +{ + outb (0x70, loc); + outb (0x71, val); +} + +static inline unsigned +cmos_read_byte (int loc) +{ + outb (0x70, loc); + return inb (0x71); +} + + +/* + * Includes here + */ + +#include "shared.h" +#include "apic.h" +#include "smp-imps.h" + + +/* + * Defines that are here so as not to be in the global header file. + */ +#define EBDA_SEG_ADDR 0x40E +#define BIOS_RESET_VECTOR 0x467 +#define LAPIC_ADDR_DEFAULT 0xFEE00000uL +#define IOAPIC_ADDR_DEFAULT 0xFEC00000uL +#define CMOS_RESET_CODE 0xF +#define CMOS_RESET_JUMP 0xa +#define CMOS_BASE_MEMORY 0x15 + + +/* + * Static defines here for SMP use. + */ + +#define DEF_ENTRIES 23 + +static int lapic_dummy = 0; +static struct + { + imps_processor proc[2]; + imps_bus bus[2]; + imps_ioapic ioapic; + imps_interrupt intin[16]; + imps_interrupt lintin[2]; + } +defconfig = +{ + { + { + IMPS_BCT_PROCESSOR, 0, 0, 0, 0, 0 + } + , + { + IMPS_BCT_PROCESSOR, 1, 0, 0, 0, 0 + } + } + , + { + { + IMPS_BCT_BUS, 0, + { + 'E', 'I', 'S', 'A', ' ', ' ' + } + } + , + { + 255, 1, + { + 'P', 'C', 'I', ' ', ' ', ' ' + } + } + } + , + { + IMPS_BCT_IOAPIC, 0, 0, IMPS_FLAG_ENABLED, IOAPIC_ADDR_DEFAULT + } + , + { + { + IMPS_BCT_IO_INTERRUPT, IMPS_INT_EXTINT, 0, 0, 0, 0xFF, 0 + } + , + { + IMPS_BCT_IO_INTERRUPT, IMPS_INT_INT, 0, 0, 1, 0xFF, 1 + } + , + { + IMPS_BCT_IO_INTERRUPT, IMPS_INT_INT, 0, 0, 0, 0xFF, 2 + } + , + { + IMPS_BCT_IO_INTERRUPT, IMPS_INT_INT, 0, 0, 3, 0xFF, 3 + } + , + { + IMPS_BCT_IO_INTERRUPT, IMPS_INT_INT, 0, 0, 4, 0xFF, 4 + } + , + { + IMPS_BCT_IO_INTERRUPT, IMPS_INT_INT, 0, 0, 5, 0xFF, 5 + } + , + { + IMPS_BCT_IO_INTERRUPT, IMPS_INT_INT, 0, 0, 6, 0xFF, 6 + } + , + { + IMPS_BCT_IO_INTERRUPT, IMPS_INT_INT, 0, 0, 7, 0xFF, 7 + } + , + { + IMPS_BCT_IO_INTERRUPT, IMPS_INT_INT, 0, 0, 8, 0xFF, 8 + } + , + { + IMPS_BCT_IO_INTERRUPT, IMPS_INT_INT, 0, 0, 9, 0xFF, 9 + } + , + { + IMPS_BCT_IO_INTERRUPT, IMPS_INT_INT, 0, 0, 10, 0xFF, 10 + } + , + { + IMPS_BCT_IO_INTERRUPT, IMPS_INT_INT, 0, 0, 11, 0xFF, 11 + } + , + { + IMPS_BCT_IO_INTERRUPT, IMPS_INT_INT, 0, 0, 12, 0xFF, 12 + } + , + { + IMPS_BCT_IO_INTERRUPT, IMPS_INT_INT, 0, 0, 13, 0xFF, 13 + } + , + { + IMPS_BCT_IO_INTERRUPT, IMPS_INT_INT, 0, 0, 14, 0xFF, 14 + } + , + { + IMPS_BCT_IO_INTERRUPT, IMPS_INT_INT, 0, 0, 15, 0xFF, 15 + } + } + , + { + { + IMPS_BCT_LOCAL_INTERRUPT, IMPS_INT_EXTINT, 0, 0, 15, 0xFF, 0 + } + , + { + IMPS_BCT_LOCAL_INTERRUPT, IMPS_INT_NMI, 0, 0, 15, 0xFF, 1 + } + } +}; + +/* + * Exported globals here. + */ + +/* + * "imps_any_new_apics" is non-zero if any of the APICS (local or I/O) + * are *not* an 82489DX. This is useful to determine if more than 15 + * CPUs can be supported (true if zero). + */ +static int imps_any_new_apics = 0; +#if 0 +volatile int imps_release_cpus = 0; +#endif +/* + * "imps_enabled" is non-zero if the probe sequence found IMPS + * information and was successful. + */ +static int imps_enabled = 0; +/* + * This represents the number of CPUs found. + */ +static int imps_num_cpus = 1; +/* + * This contains the local APIC hardware address. + */ +static unsigned imps_lapic_addr = ((unsigned) (&lapic_dummy)) - LAPIC_ID; +/* + * These map from virtual cpu numbers to APIC id's and back. + */ +static unsigned char imps_cpu_apic_map[IMPS_MAX_CPUS]; +static unsigned char imps_apic_cpu_map[IMPS_MAX_CPUS]; + + +/* + * MPS checksum function + * + * Function finished. + */ + +static int +get_checksum (unsigned start, int length) +{ + unsigned sum = 0; + + while (length-- > 0) + { + sum += *((unsigned char *) (start++)); + } + + return (sum & 0xFF); +} + + +/* + * Primary function for booting individual CPUs. + * + * This must be modified to perform whatever OS-specific initialization + * that is required. + */ + +static int +boot_cpu (imps_processor * proc) +{ + unsigned bootaddr, accept_status; + unsigned bios_reset_vector = PHYS_TO_VIRTUAL (BIOS_RESET_VECTOR); + + /* %%%%% ESB */ + extern char patch_code[]; + bootaddr = 256 * 1024; + memmove ((char *) bootaddr, patch_code, 32); + + /* + * Generic CPU startup sequence starts here. + */ + + /* set BIOS reset vector */ + CMOS_WRITE_BYTE (CMOS_RESET_CODE, CMOS_RESET_JUMP); + *((volatile unsigned *) bios_reset_vector) = bootaddr << 12; + + /* clear the error register */ + if (proc->apic_ver & 0x10) + { + IMPS_LAPIC_WRITE (LAPIC_ESR, 0); + accept_status = IMPS_LAPIC_READ (LAPIC_ESR); + } + +#if 0 + /* assert INIT IPI */ + cfg = IMPS_LAPIC_READ (LAPIC_ICR + 1); + cfg &= LAPIC_DEST_MASK; + IMPS_LAPIC_WRITE (LAPIC_ICR + 1, cfg); + cfg = IMPS_LAPIC_READ (LAPIC_ACR); + cfg &=; + + /* %%%%% ESB finish adding startup sequence */ +#endif + + /* clean up BIOS reset vector */ + CMOS_WRITE_BYTE (CMOS_RESET_CODE, 0); + *((volatile unsigned *) bios_reset_vector) = 0; + + /* + * Generic CPU startup sequence ends here. + */ + + KERNEL_PRINT (("\n")); + + return 1; + + /* XXXXX add OS-specific initialization here! */ +} + + +/* + * read bios stuff and fill tables + */ + +static void +add_processor (imps_processor * proc) +{ + int apicid = proc->apic_id; + + KERNEL_PRINT ((" Processor [APIC id %d ver %d]: ", + apicid, proc->apic_ver)); + if (!(proc->flags & IMPS_FLAG_ENABLED)) + { + KERNEL_PRINT (("DISABLED\n")); + return; + } + if (proc->apic_ver > 0xF) + { + imps_any_new_apics = 1; + } + if (proc->flags & (IMPS_CPUFLAG_BOOT)) + { + KERNEL_PRINT (("#0 Bootstrap Processor (BSP)\n")); + return; + } + imps_cpu_apic_map[imps_num_cpus] = apicid; + imps_apic_cpu_map[apicid] = imps_num_cpus; + if (boot_cpu (proc)) + { + + /* XXXXX add OS-specific setup for secondary CPUs here */ + + imps_num_cpus++; + } +} + + +static void +add_bus (imps_bus * bus) +{ + char str[8]; + + memmove (str, bus->bus_type, 6); + str[6] = 0; + KERNEL_PRINT ((" Bus id %d is %s\n", bus->id, str)); + + /* XXXXX add OS-specific code here */ +} + + +static void +add_ioapic (imps_ioapic * ioapic) +{ + KERNEL_PRINT ((" I/O APIC id %d ver %d, address: 0x%x ", + ioapic->id, ioapic->ver, ioapic->addr)); + if (!(ioapic->flags & IMPS_FLAG_ENABLED)) + { + KERNEL_PRINT (("DISABLED\n")); + return; + } + KERNEL_PRINT (("\n")); + + /* XXXXX add OS-specific code here */ +} + + +static void +imps_read_config_table (unsigned start, int count) +{ + while (count-- > 0) + { + switch (*((unsigned char *) start)) + { + case IMPS_BCT_PROCESSOR: + add_processor ((imps_processor *) start); + start += 12; /* 20 total */ + break; + case IMPS_BCT_BUS: + add_bus ((imps_bus *) start); + break; + case IMPS_BCT_IOAPIC: + add_ioapic ((imps_ioapic *) start); + break; +#if 0 /* XXXXX uncomment this if "add_io_interrupt" is implemented */ + case IMPS_BCT_IO_INTERRUPT: + add_io_interrupt ((imps_interrupt *) start); + break; +#endif +#if 0 /* XXXXX uncomment this if "add_local_interrupt" is implemented */ + case IMPS_BCT_LOCAL_INTERRUPT: + add_local_interupt ((imps_interrupt *) start); + break; +#endif + default: + break; + } + start += 8; + } +} + + +static int +imps_bad_bios (imps_fps * fps_ptr) +{ + int sum; + imps_cth *local_cth_ptr + = (imps_cth *) PHYS_TO_VIRTUAL (fps_ptr->cth_ptr); + + if (fps_ptr->feature_info[0] > IMPS_FPS_DEFAULT_MAX) + { + KERNEL_PRINT ((" Invalid MP System Configuration type %d\n", + fps_ptr->feature_info[0])); + return 1; + } + + if (fps_ptr->cth_ptr) + { + sum = get_checksum ((unsigned) local_cth_ptr, + local_cth_ptr->base_length); + if (local_cth_ptr->sig != IMPS_CTH_SIGNATURE || sum) + { + KERNEL_PRINT + ((" Bad MP Config Table sig 0x%x and/or checksum 0x%x\n", + (unsigned) (fps_ptr->cth_ptr), sum)); + return 1; + } + if (local_cth_ptr->spec_rev != fps_ptr->spec_rev) + { + KERNEL_PRINT ((" Bad MP Config Table sub-revision # %d\n", local_cth_ptr->spec_rev)); + return 1; + } + if (local_cth_ptr->extended_length) + { + sum = (get_checksum (((unsigned) local_cth_ptr) + + local_cth_ptr->base_length, + local_cth_ptr->extended_length) + + local_cth_ptr->extended_checksum) & 0xFF; + if (sum) + { + KERNEL_PRINT + ((" Bad Extended MP Config Table checksum 0x%x\n", sum)); + return 1; + } + } + } + else if (!fps_ptr->feature_info[0]) + { + KERNEL_PRINT ((" Missing configuration information\n")); + return 1; + } + + return 0; +} + + +static void +imps_read_bios (imps_fps * fps_ptr) +{ + int apicid; + unsigned cth_start, cth_count; + imps_cth *local_cth_ptr + = (imps_cth *) PHYS_TO_VIRTUAL (fps_ptr->cth_ptr); + char *str_ptr; + + KERNEL_PRINT (("Intel MultiProcessor Spec 1.%d BIOS support detected\n", + fps_ptr->spec_rev)); + + /* + * Do all checking of errors which would definitely + * lead to failure of the SMP boot here. + */ + + if (imps_bad_bios (fps_ptr)) + { + KERNEL_PRINT ((" Disabling MPS support\n")); + return; + } + + if (fps_ptr->feature_info[1] & IMPS_FPS_IMCRP_BIT) + { + str_ptr = "IMCR and PIC"; + } + else + { + str_ptr = "Virtual Wire"; + } + if (fps_ptr->cth_ptr) + { + imps_lapic_addr = local_cth_ptr->lapic_addr; + } + else + { + imps_lapic_addr = LAPIC_ADDR_DEFAULT; + } + KERNEL_PRINT + ((" APIC config: \"%s mode\" Local APIC address: 0x%x\n", + str_ptr, imps_lapic_addr)); + imps_lapic_addr = PHYS_TO_VIRTUAL (imps_lapic_addr); + + /* + * Setup primary CPU. + */ + apicid = IMPS_LAPIC_READ (LAPIC_SPIV); + IMPS_LAPIC_WRITE (LAPIC_SPIV, apicid | LAPIC_SPIV_ENABLE_APIC); + imps_any_new_apics = IMPS_LAPIC_READ (LAPIC_VER) & 0xF0; + apicid = IMPS_APIC_ID (IMPS_LAPIC_READ (LAPIC_ID)); + imps_cpu_apic_map[0] = apicid; + imps_apic_cpu_map[apicid] = 0; + + if (fps_ptr->cth_ptr) + { + char str1[16], str2[16]; + memcpy (str1, local_cth_ptr->oem_id, 8); + str1[8] = 0; + memcpy (str2, local_cth_ptr->prod_id, 12); + str2[12] = 0; + KERNEL_PRINT ((" OEM id: %s Product id: %s\n", str1, str2)); + cth_start = ((unsigned) local_cth_ptr) + sizeof (imps_cth); + cth_count = local_cth_ptr->entry_count; + } + else + { + *((volatile unsigned *) IOAPIC_ADDR_DEFAULT) = IOAPIC_ID; + defconfig.ioapic.id + = IMPS_APIC_ID (*((volatile unsigned *) + (IOAPIC_ADDR_DEFAULT + IOAPIC_RW))); + *((volatile unsigned *) IOAPIC_ADDR_DEFAULT) = IOAPIC_VER; + defconfig.ioapic.ver + = APIC_VERSION (*((volatile unsigned *) + (IOAPIC_ADDR_DEFAULT + IOAPIC_RW))); + defconfig.proc[apicid].flags + = IMPS_FLAG_ENABLED | IMPS_CPUFLAG_BOOT; + defconfig.proc[!apicid].flags = IMPS_FLAG_ENABLED; + imps_num_cpus = 2; + if (fps_ptr->feature_info[0] == 1 + || fps_ptr->feature_info[0] == 5) + { + memcpy (defconfig.bus[0].bus_type, "ISA ", 6); + } + if (fps_ptr->feature_info[0] == 4 + || fps_ptr->feature_info[0] == 7) + { + memcpy (defconfig.bus[0].bus_type, "MCA ", 6); + } + if (fps_ptr->feature_info[0] > 4) + { + defconfig.proc[0].apic_ver = 0x10; + defconfig.proc[1].apic_ver = 0x10; + defconfig.bus[1].type = IMPS_BCT_BUS; + } + if (fps_ptr->feature_info[0] == 2) + { + defconfig.intin[2].type = 255; + defconfig.intin[13].type = 255; + } + if (fps_ptr->feature_info[0] == 7) + { + defconfig.intin[0].type = 255; + } + cth_start = (unsigned) &defconfig; + cth_count = DEF_ENTRIES; + } + imps_read_config_table (cth_start, cth_count); + + /* %%%%% ESB read extended entries here */ + + imps_enabled = 1; +} + + +/* + * Given a region to check, this actually looks for the "MP Floating + * Pointer Structure". The return value indicates if the correct + * signature and checksum for a floating pointer structure of the + * appropriate spec revision was found. If so, then do not search + * further. + * + * NOTE: The memory scan will always be in the bottom 1 MB. + * + * This function presumes that "start" will always be aligned to a 16-bit + * boundary. + * + * Function finished. + */ + +static int +imps_scan (unsigned start, unsigned length) +{ + IMPS_DEBUG_PRINT (("Scanning from 0x%x for %d bytes\n", + start, length)); + + while (length > 0) + { + imps_fps *fps_ptr = (imps_fps *) PHYS_TO_VIRTUAL (start); + + if (fps_ptr->sig == IMPS_FPS_SIGNATURE + && fps_ptr->length == 1 + && (fps_ptr->spec_rev == 1 || fps_ptr->spec_rev == 4) + && !get_checksum (start, 16)) + { + IMPS_DEBUG_PRINT (("Found MP Floating Structure Pointer at %x\n", start)); + imps_read_bios (fps_ptr); + return 1; + } + + length -= 16; + start += 16; + } + + return 0; +} + + +/* + * This is the primary function for probing for MPS compatible hardware + * and BIOS information. Call this during the early stages of OS startup, + * before memory can be messed up. + * + * The probe looks for the "MP Floating Pointer Structure" at locations + * listed at the top of page 4-2 of the spec. + * + * Environment requirements from the OS to run: + * + * (1) : A non-linear virtual to physical memory mapping is probably OK, + * as (I think) the structures all fall within page boundaries, + * but a linear mapping is recommended. Currently assumes that + * the mapping will remain identical over time (which should be + * OK since it only accesses memory which shouldn't be munged + * by the OS anyway). + * (2) : The OS only consumes memory which the BIOS says is OK to use, + * and not any of the BIOS standard areas (the areas 0x400 to + * 0x600, the EBDA, 0xE0000 to 0xFFFFF, and unreported physical + * RAM). Sometimes a small amount of physical RAM is not + * reported by the BIOS, to be used to store MPS and other + * information. + * (3) : It must be possible to read the CMOS. + * (4) : There must be between 512K and 640K of lower memory (this is a + * sanity check). + * + * Function finished. + */ + +int +imps_probe (void) +{ + /* + * Determine possible address of the EBDA + */ + unsigned ebda_addr = *((unsigned short *) + PHYS_TO_VIRTUAL (EBDA_SEG_ADDR)) << 4; + + /* + * Determine amount of installed lower memory (not *available* + * lower memory). + * + * NOTE: This should work reliably as long as we verify the + * machine is at least a system that could possibly have + * MPS compatibility to begin with. + */ + unsigned mem_lower = ((CMOS_READ_BYTE (CMOS_BASE_MEMORY + 1) << 8) + | CMOS_READ_BYTE (CMOS_BASE_MEMORY)) << 10; + +#ifdef IMPS_DEBUG + imps_enabled = 0; + imps_num_cpus = 1; +#endif + + /* + * Sanity check : if this isn't reasonable, it is almost impossibly + * unlikely to be an MPS compatible machine, so return failure. + */ + if (mem_lower < 512 * 1024 || mem_lower > 640 * 1024) + { + return 0; + } + + if (ebda_addr > mem_lower - 1024 + || ebda_addr + *((unsigned char *) PHYS_TO_VIRTUAL (ebda_addr)) + * 1024 > mem_lower) + { + ebda_addr = 0; + } + + if (((ebda_addr && imps_scan (ebda_addr, 1024)) + || (!ebda_addr && imps_scan (mem_lower - 1024, 1024)) + || imps_scan (0xF0000, 0x10000)) && imps_enabled) + { + return 1; + } + + /* + * If no BIOS info on MPS hardware is found, then return failure. + */ + + return 0; +} diff --git a/usr/src/grub/grub-0.97/stage2/smp-imps.h b/usr/src/grub/grub-0.97/stage2/smp-imps.h new file mode 100644 index 0000000000..c0fdce3466 --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/smp-imps.h @@ -0,0 +1,208 @@ +/* + * + * + * Author: Erich Boleyn http://www.uruk.org/~erich/ + * + * Header file implementing Intel MultiProcessor Specification (MPS) + * version 1.1 and 1.4 SMP hardware control for Intel Architecture CPUs, + * with hooks for running correctly on a standard PC without the hardware. + * + * This file was created from information in the Intel MPS version 1.4 + * document, order number 242016-004, which can be ordered from the + * Intel literature center. + */ + +#ifndef _SMP_IMPS_H +#define _SMP_IMPS_H + +/* make sure "apic.h" is included */ +#ifndef _APIC_H +#error Must include "apic.h" before "smp-imps.h" +#endif /* !_APIC_H */ + +/* + * Defines used. + */ + +#ifdef IMPS_DEBUG +#define IMPS_DEBUG_PRINT(x) KERNEL_PRINT(x) +#else /* !IMPS_DEBUG */ +#define IMPS_DEBUG_PRINT(x) +#endif /* !IMPS_DEBUG */ + +#define IMPS_MAX_CPUS APIC_BROADCAST_ID + +/* + * Defines representing limitations on values usable in different + * situations. This mostly depends on whether the APICs are old + * (82489DX) or new (SIO or Pentium/Pentium Pro integrated APICs). + * + * NOTE: It appears that the APICs must either be all old or all new, + * or broadcasts won't work right. + * NOTE #2: Given that, the maximum ID which can be sent to predictably + * is 14 for new APICs and 254 for old APICs. So, this all implies that + * a maximum of 15 processors is supported with the new APICs, and a + * maximum of 255 processors with the old APICs. + */ + +#define IMPS_APIC_ID(x) \ + ( imps_any_new_apics ? APIC_NEW_ID(x) : APIC_OLD_ID(x) ) + +/* + * This is the value that must be in the "sig" member of the MP + * Floating Pointer Structure. + */ +#define IMPS_FPS_SIGNATURE ('_' | ('M'<<8) | ('P'<<16) | ('_'<<24)) +#define IMPS_FPS_IMCRP_BIT 0x80 +#define IMPS_FPS_DEFAULT_MAX 7 + +/* + * This is the value that must be in the "sig" member of the MP + * Configuration Table Header. + */ +#define IMPS_CTH_SIGNATURE ('P' | ('C'<<8) | ('M'<<16) | ('P'<<24)) + +/* + * These are the "type" values for Base MP Configuration Table entries. + */ +#define IMPS_FLAG_ENABLED 1 +#define IMPS_BCT_PROCESSOR 0 +#define IMPS_CPUFLAG_BOOT 2 +#define IMPS_BCT_BUS 1 +#define IMPS_BCT_IOAPIC 2 +#define IMPS_BCT_IO_INTERRUPT 3 +#define IMPS_BCT_LOCAL_INTERRUPT 4 +#define IMPS_INT_INT 0 +#define IMPS_INT_NMI 1 +#define IMPS_INT_SMI 2 +#define IMPS_INT_EXTINT 3 + + +/* + * Typedefs and data item definitions done here. + */ + +typedef struct imps_fps imps_fps; /* MP floating pointer structure */ +typedef struct imps_cth imps_cth; /* MP configuration table header */ +typedef struct imps_processor imps_processor; +typedef struct imps_bus imps_bus; +typedef struct imps_ioapic imps_ioapic; +typedef struct imps_interrupt imps_interrupt; + + +/* + * Data structures defined here + */ + +/* + * MP Floating Pointer Structure (fps) + * + * Look at page 4-3 of the MP spec for the starting definitions of + * this structure. + */ +struct imps_fps + { + unsigned sig; + imps_cth *cth_ptr; + unsigned char length; + unsigned char spec_rev; + unsigned char checksum; + unsigned char feature_info[5]; + }; + +/* + * MP Configuration Table Header (cth) + * + * Look at page 4-5 of the MP spec for the starting definitions of + * this structure. + */ +struct imps_cth + { + unsigned sig; + unsigned short base_length; + unsigned char spec_rev; + unsigned char checksum; + char oem_id[8]; + char prod_id[12]; + unsigned oem_table_ptr; + unsigned short oem_table_size; + unsigned short entry_count; + unsigned lapic_addr; + unsigned short extended_length; + unsigned char extended_checksum; + char reserved[1]; + }; + +/* + * Base MP Configuration Table Types. They are sorted according to + * type (i.e. all of type 0 come first, etc.). Look on page 4-6 for + * the start of the descriptions. + */ + +struct imps_processor + { + unsigned char type; /* must be 0 */ + unsigned char apic_id; + unsigned char apic_ver; + unsigned char flags; + unsigned signature; + unsigned features; + char reserved[8]; + }; + +struct imps_bus + { + unsigned char type; /* must be 1 */ + unsigned char id; + char bus_type[6]; + }; + +struct imps_ioapic + { + unsigned char type; /* must be 2 */ + unsigned char id; + unsigned char ver; + unsigned char flags; + unsigned addr; + }; + +struct imps_interrupt + { + unsigned char type; /* must be 3 or 4 */ + unsigned char int_type; + unsigned short flags; + unsigned char source_bus_id; + unsigned char source_bus_irq; + unsigned char dest_apic_id; + unsigned char dest_apic_intin; + }; + + +/* + * Exported globals here. + */ + +/* + * This is the primary function for probing for Intel MPS 1.1/1.4 + * compatible hardware and BIOS information. While probing the CPUs + * information returned from the BIOS, this also starts up each CPU + * and gets it ready for use. + * + * Call this during the early stages of OS startup, before memory can + * be messed up. + * + * Returns 1 if IMPS information was found and is valid, else 0. + */ + +int imps_probe (void); + + +/* + * Defines that use variables + */ + +#define IMPS_LAPIC_READ(x) (*((volatile unsigned *) (imps_lapic_addr+(x)))) +#define IMPS_LAPIC_WRITE(x, y) \ + (*((volatile unsigned *) (imps_lapic_addr+(x))) = (y)) + +#endif /* !_SMP_IMPS_H */ diff --git a/usr/src/grub/grub-0.97/stage2/stage1_5.c b/usr/src/grub/grub-0.97/stage2/stage1_5.c new file mode 100644 index 0000000000..f04a3371d9 --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/stage1_5.c @@ -0,0 +1,69 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2001,2002 Free Software Foundation, 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 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 "shared.h" + +static unsigned int saved_sector = (unsigned int)-1; + +static void +disk_read_savesect_func (unsigned int sector, int offset, int length) +{ + saved_sector = sector; +} + +void +cmain (void) +{ + grub_printf ("\n\nGRUB loading, please wait...\n"); + + /* + * Here load the true second-stage boot-loader. + */ + + if (grub_open (config_file)) + { + int ret; + + disk_read_hook = disk_read_savesect_func; + grub_read ((char *) 0x8000, SECTOR_SIZE * 2); + disk_read_hook = NULL; + + /* Sanity check: catch an internal error. */ + if (saved_sector == (unsigned int)-1) + { + grub_printf ("internal error: the second sector of Stage 2 is unknown."); + stop (); + } + + ret = grub_read ((char *) 0x8000 + SECTOR_SIZE * 2, -1); + + grub_close (); + + if (ret) + chain_stage2 (0, 0x8200, saved_sector); + } + + /* + * If not, then print error message and die. + */ + + print_error (); + + stop (); +} diff --git a/usr/src/grub/grub-0.97/stage2/stage2.c b/usr/src/grub/grub-0.97/stage2/stage2.c new file mode 100644 index 0000000000..3bec95288c --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/stage2.c @@ -0,0 +1,1104 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2000,2001,2002,2004,2005 Free Software Foundation, 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 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 +#include + +grub_jmp_buf restart_env; + +struct silentbuf silent; +int reset_term; + +#if defined(PRESET_MENU_STRING) || defined(SUPPORT_DISKLESS) + +# if defined(PRESET_MENU_STRING) +static const char *preset_menu = PRESET_MENU_STRING; +# elif defined(SUPPORT_DISKLESS) +/* Execute the command "bootp" automatically. */ +static const char *preset_menu = "dhcp\n"; +# endif /* SUPPORT_DISKLESS */ + +static int preset_menu_offset; + +static int +open_preset_menu (void) +{ +#ifdef GRUB_UTIL + /* Unless the user explicitly requests to use the preset menu, + always opening the preset menu fails in the grub shell. */ + if (! use_preset_menu) + return 0; +#endif /* GRUB_UTIL */ + + preset_menu_offset = 0; + return preset_menu != 0; +} + +static int +read_from_preset_menu (char *buf, int maxlen) +{ + int len = grub_strlen (preset_menu + preset_menu_offset); + + if (len > maxlen) + len = maxlen; + + grub_memmove (buf, preset_menu + preset_menu_offset, len); + preset_menu_offset += len; + + return len; +} + +static void +close_preset_menu (void) +{ + /* Disable the preset menu. */ + preset_menu = 0; +} + +#else /* ! PRESET_MENU_STRING && ! SUPPORT_DISKLESS */ + +#define open_preset_menu() 0 +#define read_from_preset_menu(buf, maxlen) 0 +#define close_preset_menu() + +#endif /* ! PRESET_MENU_STRING && ! SUPPORT_DISKLESS */ + +static char * +get_entry (char *list, int num, int nested) +{ + int i; + + for (i = 0; i < num; i++) + { + do + { + while (*(list++)); + } + while (nested && *(list++)); + } + + return list; +} + +/* Print an entry in a line of the menu box. */ +static void +print_entry (int y, int highlight, char *entry) +{ + int x; + + if (current_term->setcolorstate) + current_term->setcolorstate (COLOR_STATE_NORMAL); + + if (highlight && current_term->setcolorstate) + current_term->setcolorstate (COLOR_STATE_HIGHLIGHT); + + gotoxy (2, y); + grub_putchar (' '); + for (x = 3; x < 75; x++) + { + if (*entry && x <= 72) + { + if (x == 72) + grub_putchar (DISP_RIGHT); + else + grub_putchar (*entry++); + } + else + grub_putchar (' '); + } + gotoxy (74, y); + + if (current_term->setcolorstate) + current_term->setcolorstate (COLOR_STATE_STANDARD); +} + +/* Print entries in the menu box. */ +static void +print_entries (int y, int size, int first, int entryno, char *menu_entries) +{ + int i; + + gotoxy (77, y + 1); + + if (first) + grub_putchar (DISP_UP); + else + grub_putchar (' '); + + menu_entries = get_entry (menu_entries, first, 0); + + for (i = 0; i < size; i++) + { + print_entry (y + i + 1, entryno == i, menu_entries); + + while (*menu_entries) + menu_entries++; + + if (*(menu_entries - 1)) + menu_entries++; + } + + gotoxy (77, y + size); + + if (*menu_entries) + grub_putchar (DISP_DOWN); + else + grub_putchar (' '); + + gotoxy (74, y + entryno + 1); +} + +static void +print_entries_raw (int size, int first, char *menu_entries) +{ + int i; + +#define LINE_LENGTH 67 + + for (i = 0; i < LINE_LENGTH; i++) + grub_putchar ('-'); + grub_putchar ('\n'); + + for (i = first; i < size; i++) + { + /* grub's printf can't %02d so ... */ + if (i < 10) + grub_putchar (' '); + grub_printf ("%d: %s\n", i, get_entry (menu_entries, i, 0)); + } + + for (i = 0; i < LINE_LENGTH; i++) + grub_putchar ('-'); + grub_putchar ('\n'); + +#undef LINE_LENGTH +} + + +static void +print_border (int y, int size) +{ + int i; + + if (current_term->setcolorstate) + current_term->setcolorstate (COLOR_STATE_NORMAL); + + gotoxy (1, y); + + grub_putchar (DISP_UL); + for (i = 0; i < 73; i++) + grub_putchar (DISP_HORIZ); + grub_putchar (DISP_UR); + + i = 1; + while (1) + { + gotoxy (1, y + i); + + if (i > size) + break; + + grub_putchar (DISP_VERT); + gotoxy (75, y + i); + grub_putchar (DISP_VERT); + + i++; + } + + grub_putchar (DISP_LL); + for (i = 0; i < 73; i++) + grub_putchar (DISP_HORIZ); + grub_putchar (DISP_LR); + + if (current_term->setcolorstate) + current_term->setcolorstate (COLOR_STATE_STANDARD); +} + +static void +run_menu (char *menu_entries, char *config_entries, int num_entries, + char *heap, int entryno) +{ + int c, time1, time2 = -1, first_entry = 0; + char *cur_entry = 0; + struct term_entry *prev_term = NULL; + + /* + * Main loop for menu UI. + */ + +restart: + /* Dumb terminal always use all entries for display + invariant for TERM_DUMB: first_entry == 0 */ + if (! (current_term->flags & TERM_DUMB)) + { + while (entryno > 11) + { + first_entry++; + entryno--; + } + } + + /* If the timeout was expired or wasn't set, force to show the menu + interface. */ + if (grub_timeout < 0) + show_menu = 1; + + /* If SHOW_MENU is false, don't display the menu until ESC is pressed. */ + if (! show_menu) + { + /* Get current time. */ + while ((time1 = getrtsecs ()) == 0xFF) + ; + + while (1) + { + /* Check if ESC is pressed. */ + if (checkkey () != -1 && ASCII_CHAR (getkey ()) == '\e') + { + grub_timeout = -1; + show_menu = 1; + break; + } + + /* If GRUB_TIMEOUT is expired, boot the default entry. */ + if (grub_timeout >=0 + && (time1 = getrtsecs ()) != time2 + && time1 != 0xFF) + { + if (grub_timeout <= 0) + { + grub_timeout = -1; + goto boot_entry; + } + + time2 = time1; + grub_timeout--; + + /* Print a message. */ + grub_printf ("\rPress `ESC' to enter the menu... %d ", + grub_timeout); + } + } + } + + /* Only display the menu if the user wants to see it. */ + if (show_menu) + { + init_page (); + setcursor (0); + + if (current_term->flags & TERM_DUMB) + print_entries_raw (num_entries, first_entry, menu_entries); + else + print_border (3, 12); + + grub_printf ("\n\ + Use the %c and %c keys to select which entry is highlighted.\n", + DISP_UP, DISP_DOWN); + + if (! auth && password) + { + printf ("\ + Press enter to boot the selected OS or \'p\' to enter a\n\ + password to unlock the next set of features."); + } + else + { + if (config_entries) + printf ("\ + Press enter to boot the selected OS, \'e\' to edit the\n\ + commands before booting, or \'c\' for a command-line."); + else + printf ("\ + Press \'b\' to boot, \'e\' to edit the selected command in the\n\ + boot sequence, \'c\' for a command-line, \'o\' to open a new line\n\ + after (\'O\' for before) the selected line, \'d\' to remove the\n\ + selected line, or escape to go back to the main menu."); + } + + if (current_term->flags & TERM_DUMB) + grub_printf ("\n\nThe selected entry is %d ", entryno); + else + print_entries (3, 12, first_entry, entryno, menu_entries); + } + + /* XX using RT clock now, need to initialize value */ + while ((time1 = getrtsecs()) == 0xFF); + + while (1) + { + /* Initialize to NULL just in case... */ + cur_entry = NULL; + + if (grub_timeout >= 0 && (time1 = getrtsecs()) != time2 && time1 != 0xFF) + { + if (grub_timeout <= 0) + { + grub_timeout = -1; + break; + } + + /* else not booting yet! */ + time2 = time1; + + if (current_term->flags & TERM_DUMB) + grub_printf ("\r Entry %d will be booted automatically in %d seconds. ", + entryno, grub_timeout); + else + { + gotoxy (3, 22); + grub_printf ("The highlighted entry will be booted automatically in %d seconds. ", + grub_timeout); + gotoxy (74, 4 + entryno); + } + + grub_timeout--; + } + + /* Check for a keypress, however if TIMEOUT has been expired + (GRUB_TIMEOUT == -1) relax in GETKEY even if no key has been + pressed. + This avoids polling (relevant in the grub-shell and later on + in grub if interrupt driven I/O is done). */ + if (checkkey () >= 0 || grub_timeout < 0) + { + /* Key was pressed, show which entry is selected before GETKEY, + since we're comming in here also on GRUB_TIMEOUT == -1 and + hang in GETKEY */ + if (current_term->flags & TERM_DUMB) + grub_printf ("\r Highlighted entry is %d: ", entryno); + + c = ASCII_CHAR (getkey ()); + + if (grub_timeout >= 0) + { + if (current_term->flags & TERM_DUMB) + grub_putchar ('\r'); + else + gotoxy (3, 22); + printf (" "); + grub_timeout = -1; + fallback_entryno = -1; + if (! (current_term->flags & TERM_DUMB)) + gotoxy (74, 4 + entryno); + } + + /* We told them above (at least in SUPPORT_SERIAL) to use + '^' or 'v' so accept these keys. */ + if (c == 16 || c == '^') + { + if (current_term->flags & TERM_DUMB) + { + if (entryno > 0) + entryno--; + } + else + { + if (entryno > 0) + { + print_entry (4 + entryno, 0, + get_entry (menu_entries, + first_entry + entryno, + 0)); + entryno--; + print_entry (4 + entryno, 1, + get_entry (menu_entries, + first_entry + entryno, + 0)); + } + else if (first_entry > 0) + { + first_entry--; + print_entries (3, 12, first_entry, entryno, + menu_entries); + } + } + } + else if ((c == 14 || c == 'v') + && first_entry + entryno + 1 < num_entries) + { + if (current_term->flags & TERM_DUMB) + entryno++; + else + { + if (entryno < 11) + { + print_entry (4 + entryno, 0, + get_entry (menu_entries, + first_entry + entryno, + 0)); + entryno++; + print_entry (4 + entryno, 1, + get_entry (menu_entries, + first_entry + entryno, + 0)); + } + else if (num_entries > 12 + first_entry) + { + first_entry++; + print_entries (3, 12, first_entry, entryno, menu_entries); + } + } + } + else if (c == 7) + { + /* Page Up */ + first_entry -= 12; + if (first_entry < 0) + { + entryno += first_entry; + first_entry = 0; + if (entryno < 0) + entryno = 0; + } + print_entries (3, 12, first_entry, entryno, menu_entries); + } + else if (c == 3) + { + /* Page Down */ + first_entry += 12; + if (first_entry + entryno + 1 >= num_entries) + { + first_entry = num_entries - 12; + if (first_entry < 0) + first_entry = 0; + entryno = num_entries - first_entry - 1; + } + print_entries (3, 12, first_entry, entryno, menu_entries); + } + + if (config_entries) + { + if ((c == '\n') || (c == '\r') || (c == 6)) + break; + } + else + { + if ((c == 'd') || (c == 'o') || (c == 'O')) + { + if (! (current_term->flags & TERM_DUMB)) + print_entry (4 + entryno, 0, + get_entry (menu_entries, + first_entry + entryno, + 0)); + + /* insert after is almost exactly like insert before */ + if (c == 'o') + { + /* But `o' differs from `O', since it may causes + the menu screen to scroll up. */ + if (entryno < 11 || (current_term->flags & TERM_DUMB)) + entryno++; + else + first_entry++; + + c = 'O'; + } + + cur_entry = get_entry (menu_entries, + first_entry + entryno, + 0); + + if (c == 'O') + { + grub_memmove (cur_entry + 2, cur_entry, + ((int) heap) - ((int) cur_entry)); + + cur_entry[0] = ' '; + cur_entry[1] = 0; + + heap += 2; + + num_entries++; + } + else if (num_entries > 0) + { + char *ptr = get_entry(menu_entries, + first_entry + entryno + 1, + 0); + + grub_memmove (cur_entry, ptr, + ((int) heap) - ((int) ptr)); + heap -= (((int) ptr) - ((int) cur_entry)); + + num_entries--; + + if (entryno >= num_entries) + entryno--; + if (first_entry && num_entries < 12 + first_entry) + first_entry--; + } + + if (current_term->flags & TERM_DUMB) + { + grub_printf ("\n\n"); + print_entries_raw (num_entries, first_entry, + menu_entries); + grub_printf ("\n"); + } + else + print_entries (3, 12, first_entry, entryno, menu_entries); + } + + cur_entry = menu_entries; + if (c == 27) + return; + if (c == 'b') + break; + } + + if (! auth && password) + { + if (c == 'p') + { + /* Do password check here! */ + char entered[32]; + char *pptr = password; + + if (current_term->flags & TERM_DUMB) + grub_printf ("\r "); + else + gotoxy (1, 21); + + /* Wipe out the previously entered password */ + grub_memset (entered, 0, sizeof (entered)); + get_cmdline (" Password: ", entered, 31, '*', 0); + + while (! isspace (*pptr) && *pptr) + pptr++; + + /* Make sure that PASSWORD is NUL-terminated. */ + *pptr++ = 0; + + if (! check_password (entered, password, password_type)) + { + char *new_file = config_file; + while (isspace (*pptr)) + pptr++; + + /* If *PPTR is NUL, then allow the user to use + privileged instructions, otherwise, load + another configuration file. */ + if (*pptr != 0) + { + while ((*(new_file++) = *(pptr++)) != 0) + ; + + /* Make sure that the user will not have + authority in the next configuration. */ + auth = 0; + return; + } + else + { + /* Now the user is superhuman. */ + auth = 1; + goto restart; + } + } + else + { + grub_printf ("Failed!\n Press any key to continue..."); + getkey (); + goto restart; + } + } + } + else + { + if (c == 'e') + { + int new_num_entries = 0, i = 0; + char *new_heap; + + if (config_entries) + { + new_heap = heap; + cur_entry = get_entry (config_entries, + first_entry + entryno, + 1); + } + else + { + /* safe area! */ + new_heap = heap + NEW_HEAPSIZE + 1; + cur_entry = get_entry (menu_entries, + first_entry + entryno, + 0); + } + + do + { + while ((*(new_heap++) = cur_entry[i++]) != 0); + new_num_entries++; + } + while (config_entries && cur_entry[i]); + + /* this only needs to be done if config_entries is non-NULL, + but it doesn't hurt to do it always */ + *(new_heap++) = 0; + + if (config_entries) + run_menu (heap, NULL, new_num_entries, new_heap, 0); + else + { + cls (); + print_cmdline_message (0); + + new_heap = heap + NEW_HEAPSIZE + 1; + + saved_drive = boot_drive; + saved_partition = install_partition; + current_drive = GRUB_INVALID_DRIVE; + + if (! get_cmdline (PACKAGE " edit> ", new_heap, + NEW_HEAPSIZE + 1, 0, 1)) + { + int j = 0; + + /* get length of new command */ + while (new_heap[j++]) + ; + + if (j < 2) + { + j = 2; + new_heap[0] = ' '; + new_heap[1] = 0; + } + + /* align rest of commands properly */ + grub_memmove (cur_entry + j, cur_entry + i, + (int) heap - ((int) cur_entry + i)); + + /* copy command to correct area */ + grub_memmove (cur_entry, new_heap, j); + + heap += (j - i); + } + } + + goto restart; + } + if (c == 'c') + { + enter_cmdline (heap, 0); + goto restart; + } +#ifdef GRUB_UTIL + if (c == 'q') + { + /* The same as ``quit''. */ + stop (); + } +#endif + } + } + } + + /* Attempt to boot an entry. */ + + boot_entry: + + if (silent.status != DEFER_VERBOSE) + silent.status = SILENT; + + reset_term = 1; + + cls (); + setcursor (1); + + /* if our terminal needed initialization, we should shut it down + * before booting the kernel, but we want to save what it was so + * we can come back if needed */ + prev_term = current_term; + + if (silent.status != SILENT) + if (current_term->shutdown) { + (*current_term->shutdown)(); + current_term = term_table; /* assumption: console is first */ + } + + while (1) + { + if (config_entries) + printf (" Booting \'%s\'\n\n", + get_entry (menu_entries, first_entry + entryno, 0)); + else + printf (" Booting command-list\n\n"); + + if (! cur_entry) + cur_entry = get_entry (config_entries, first_entry + entryno, 1); + + /* Set CURRENT_ENTRYNO for the command "savedefault". */ + current_entryno = first_entry + entryno; + + if (run_script (cur_entry, heap)) + { + if (fallback_entryno >= 0) + { + cur_entry = NULL; + first_entry = 0; + entryno = fallback_entries[fallback_entryno]; + fallback_entryno++; + if (fallback_entryno >= MAX_FALLBACK_ENTRIES + || fallback_entries[fallback_entryno] < 0) + fallback_entryno = -1; + } + else + break; + } + else + break; + } + + if (silent.status != SILENT) { /* don't reset if we never changed terms */ + /* if we get back here, we should go back to what our term was before */ + current_term = prev_term; + if (current_term->startup) + /* if our terminal fails to initialize, fall back to console since + * it should always work */ + if ((*current_term->startup)() == 0) + current_term = term_table; /* we know that console is first */ + } + + show_menu = 1; + goto restart; +} + + +static int +get_line_from_config (char *cmdline, int maxlen, int read_from_file) +{ + int pos = 0, literal = 0, comment = 0; + char c; /* since we're loading it a byte at a time! */ + + while (1) + { + if (read_from_file) + { + if (! grub_read (&c, 1)) + break; + } + else + { + if (! read_from_preset_menu (&c, 1)) + break; + } + + /* Skip all carriage returns. */ + if (c == '\r') + continue; + + /* Replace tabs with spaces. */ + if (c == '\t') + c = ' '; + + /* The previous is a backslash, then... */ + if (literal) + { + /* If it is a newline, replace it with a space and continue. */ + if (c == '\n') + { + c = ' '; + + /* Go back to overwrite a backslash. */ + if (pos > 0) + pos--; + } + + literal = 0; + } + + /* translate characters first! */ + if (c == '\\' && ! literal) + literal = 1; + + if (comment) + { + if (c == '\n') + comment = 0; + } + else if (! pos) + { + if (c == '#') + comment = 1; + else if ((c != ' ') && (c != '\n')) + cmdline[pos++] = c; + } + else + { + if (c == '\n') + break; + + if (pos < maxlen) + cmdline[pos++] = c; + } + } + + cmdline[pos] = 0; + + return pos; +} + + +/* This is the starting function in C. */ +void +cmain (void) +{ + int config_len, menu_len, num_entries; + char *config_entries, *menu_entries; + char *kill_buf = (char *) KILL_BUF; + + silent.status = DEFER_SILENT; + silent.looped = 0; + silent.buffer_start = silent.buffer; + + auto void reset (void); + void reset (void) + { + count_lines = -1; + config_len = 0; + menu_len = 0; + num_entries = 0; + config_entries = (char *) mbi.drives_addr + mbi.drives_length; + menu_entries = (char *) MENU_BUF; + init_config (); + } + + /* Initialize the environment for restarting Stage 2. */ + grub_setjmp (restart_env); + + /* Initialize the kill buffer. */ + *kill_buf = 0; + + /* Never return. */ + for (;;) + { + int is_opened, is_preset; + + reset (); + + /* Here load the configuration file. */ + +#ifdef GRUB_UTIL + if (use_config_file) +#endif /* GRUB_UTIL */ + { + char *default_file = (char *) DEFAULT_FILE_BUF; + int i; + + /* Get a saved default entry if possible. */ + saved_entryno = 0; + grub_strcpy (default_file, config_file); + for (i = grub_strlen(default_file); i >= 0; i--) + if (default_file[i] == '/') + { + i++; + break; + } + default_file[i] = 0; + grub_strncat (default_file + i, "default", DEFAULT_FILE_BUFLEN - i); + if (grub_open (default_file)) + { + char buf[10]; /* This is good enough. */ + char *p = buf; + int len; + + len = grub_read (buf, sizeof (buf)); + if (len > 0) + { + buf[sizeof (buf) - 1] = 0; + safe_parse_maxint (&p, &saved_entryno); + } + + grub_close (); + } + errnum = ERR_NONE; + + do + { + /* STATE 0: Before any title command. + STATE 1: In a title command. + STATE >1: In a entry after a title command. */ + int state = 0, prev_config_len = 0, prev_menu_len = 0; + char *cmdline; + + /* Try the preset menu first. This will succeed at most once, + because close_preset_menu disables the preset menu. */ + is_opened = is_preset = open_preset_menu (); + if (! is_opened) + { + is_opened = grub_open (config_file); + errnum = ERR_NONE; + } + + if (! is_opened) + break; + + /* This is necessary, because the menu must be overrided. */ + reset (); + + cmdline = (char *) CMDLINE_BUF; + while (get_line_from_config (cmdline, NEW_HEAPSIZE, + ! is_preset)) + { + struct builtin *builtin; + + /* Get the pointer to the builtin structure. */ + builtin = find_command (cmdline); + errnum = 0; + if (! builtin) + /* Unknown command. Just skip now. */ + continue; + + if (builtin->flags & BUILTIN_TITLE) + { + char *ptr; + + /* the command "title" is specially treated. */ + if (state > 1) + { + /* The next title is found. */ + num_entries++; + config_entries[config_len++] = 0; + prev_menu_len = menu_len; + prev_config_len = config_len; + } + else + { + /* The first title is found. */ + menu_len = prev_menu_len; + config_len = prev_config_len; + } + + /* Reset the state. */ + state = 1; + + /* Copy title into menu area. */ + ptr = skip_to (1, cmdline); + while ((menu_entries[menu_len++] = *(ptr++)) != 0) + ; + } + else if (! state) + { + /* Run a command found is possible. */ + if (builtin->flags & BUILTIN_MENU) + { + char *arg = skip_to (1, cmdline); + (builtin->func) (arg, BUILTIN_MENU); + errnum = 0; + } + else + /* Ignored. */ + continue; + } + else + { + char *ptr = cmdline; + + state++; + /* Copy config file data to config area. */ + while ((config_entries[config_len++] = *ptr++) != 0) + ; + } + } + + if (state > 1) + { + /* Finish the last entry. */ + num_entries++; + config_entries[config_len++] = 0; + } + else + { + menu_len = prev_menu_len; + config_len = prev_config_len; + } + + menu_entries[menu_len++] = 0; + config_entries[config_len++] = 0; + grub_memmove (config_entries + config_len, menu_entries, + menu_len); + menu_entries = config_entries + config_len; + + /* Make sure that all fallback entries are valid. */ + if (fallback_entryno >= 0) + { + for (i = 0; i < MAX_FALLBACK_ENTRIES; i++) + { + if (fallback_entries[i] < 0) + break; + if (fallback_entries[i] >= num_entries) + { + grub_memmove (fallback_entries + i, + fallback_entries + i + 1, + ((MAX_FALLBACK_ENTRIES - i - 1) + * sizeof (int))); + i--; + } + } + + if (fallback_entries[0] < 0) + fallback_entryno = -1; + } + /* Check if the default entry is present. Otherwise reset + it to fallback if fallback is valid, or to DEFAULT_ENTRY + if not. */ + if (default_entry >= num_entries) + { + if (fallback_entryno >= 0) + { + default_entry = fallback_entries[0]; + fallback_entryno++; + if (fallback_entryno >= MAX_FALLBACK_ENTRIES + || fallback_entries[fallback_entryno] < 0) + fallback_entryno = -1; + } + else + default_entry = 0; + } + + if (is_preset) + close_preset_menu (); + else + grub_close (); + } + while (is_preset); + } + + /* go ahead and make sure the terminal is setup */ + if (current_term->startup) + (*current_term->startup)(); + + if (! num_entries) + { + /* If no acceptable config file, goto command-line, starting + heap from where the config entries would have been stored + if there were any. */ + enter_cmdline (config_entries, 1); + } + else + { + /* Run menu interface. */ + run_menu (menu_entries, config_entries, num_entries, + menu_entries + menu_len, default_entry); + } + } +} diff --git a/usr/src/grub/grub-0.97/stage2/start.S b/usr/src/grub/grub-0.97/stage2/start.S new file mode 100644 index 0000000000..9a7d5048fd --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/start.S @@ -0,0 +1,409 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001 Free Software Foundation, 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 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. + */ + +#define ASM_FILE +#include + +#ifndef STAGE1_5 +#include +#endif + +/* + * defines for the code go here + */ + + /* Absolute addresses + This makes the assembler generate the address without support + from the linker. (ELF can't relocate 16-bit addresses!) */ +#ifdef STAGE1_5 +# define ABS(x) (x-_start+0x2000) +#else +# define ABS(x) (x-_start+0x8000) +#endif /* STAGE1_5 */ + + /* Print message string */ +#define MSG(x) movw $ABS(x), %si; call message + + .file "start.S" + + .text + + /* Tell GAS to generate 16-bit instructions so that this code works + in real mode. */ + .code16 + + .globl start, _start +start: +_start: + /* + * _start is loaded at 0x8000 and is jumped to with + * CS:IP 0:0x8000 in stage2. + */ + + /* + * we continue to use the stack for stage1 and assume that + * some registers are set to correct values. See stage1.S + * for more information. + */ + + /* save drive reference first thing! */ + pushw %dx + + /* print a notification message on the screen */ + pushw %si + MSG(notification_string) + popw %si + + /* this sets up for the first run through "bootloop" */ + movw $ABS(firstlist - BOOTSEC_LISTSIZE), %di + + /* save the sector number of the second sector in %ebp */ + movl (%di), %ebp + + /* this is the loop for reading the secondary boot-loader in */ +bootloop: + + /* check the number of sectors to read */ + cmpw $0, 4(%di) + + /* if zero, go to the start function */ + je bootit + +setup_sectors: + /* check if we use LBA or CHS */ + cmpb $0, -1(%si) + + /* jump to chs_mode if zero */ + je chs_mode + +lba_mode: + /* load logical sector start */ + movl (%di), %ebx + + /* the maximum is limited to 0x7f because of Phoenix EDD */ + xorl %eax, %eax + movb $0x7f, %al + + /* how many do we really want to read? */ + cmpw %ax, 4(%di) /* compare against total number of sectors */ + + /* which is greater? */ + jg 1f + + /* if less than, set to total */ + movw 4(%di), %ax + +1: + /* subtract from total */ + subw %ax, 4(%di) + + /* add into logical sector start */ + addl %eax, (%di) + + /* set up disk address packet */ + + /* the size and the reserved byte */ + movw $0x0010, (%si) + + /* the number of sectors */ + movw %ax, 2(%si) + + /* the absolute address (low 32 bits) */ + movl %ebx, 8(%si) + + /* the segment of buffer address */ + movw $BUFFERSEG, 6(%si) + + /* save %ax from destruction! */ + pushw %ax + + /* zero %eax */ + xorl %eax, %eax + + /* the offset of buffer address */ + movw %ax, 4(%si) + + /* the absolute address (high 32 bits) */ + movl %eax, 12(%si) + + +/* + * BIOS call "INT 0x13 Function 0x42" to read sectors from disk into memory + * Call with %ah = 0x42 + * %dl = drive number + * %ds:%si = segment:offset of disk address packet + * Return: + * %al = 0x0 on success; err code on failure + */ + + movb $0x42, %ah + int $0x13 + + jc read_error + + movw $BUFFERSEG, %bx + jmp copy_buffer + +chs_mode: + /* load logical sector start (bottom half) */ + movl (%di), %eax + + /* zero %edx */ + xorl %edx, %edx + + /* divide by number of sectors */ + divl (%si) + + /* save sector start */ + movb %dl, 10(%si) + + xorl %edx, %edx /* zero %edx */ + divl 4(%si) /* divide by number of heads */ + + /* save head start */ + movb %dl, 11(%si) + + /* save cylinder start */ + movw %ax, 12(%si) + + /* do we need too many cylinders? */ + cmpw 8(%si), %ax + jge geometry_error + + /* determine the maximum sector length of this read */ + movw (%si), %ax /* get number of sectors per track/head */ + + /* subtract sector start */ + subb 10(%si), %al + + /* how many do we really want to read? */ + cmpw %ax, 4(%di) /* compare against total number of sectors */ + + + /* which is greater? */ + jg 2f + + /* if less than, set to total */ + movw 4(%di), %ax + +2: + /* subtract from total */ + subw %ax, 4(%di) + + /* add into logical sector start */ + addl %eax, (%di) + +/* + * This is the loop for taking care of BIOS geometry translation (ugh!) + */ + + /* get high bits of cylinder */ + movb 13(%si), %dl + + shlb $6, %dl /* shift left by 6 bits */ + movb 10(%si), %cl /* get sector */ + + incb %cl /* normalize sector (sectors go + from 1-N, not 0-(N-1) ) */ + orb %dl, %cl /* composite together */ + movb 12(%si), %ch /* sector+hcyl in cl, cylinder in ch */ + + /* restore %dx */ + popw %dx + pushw %dx + + /* head number */ + movb 11(%si), %dh + + pushw %ax /* save %ax from destruction! */ + +/* + * BIOS call "INT 0x13 Function 0x2" to read sectors from disk into memory + * Call with %ah = 0x2 + * %al = number of sectors + * %ch = cylinder + * %cl = sector (bits 6-7 are high bits of "cylinder") + * %dh = head + * %dl = drive (0x80 for hard disk, 0x0 for floppy disk) + * %es:%bx = segment:offset of buffer + * Return: + * %al = 0x0 on success; err code on failure + */ + + movw $BUFFERSEG, %bx + movw %bx, %es /* load %es segment with disk buffer */ + + xorw %bx, %bx /* %bx = 0, put it at 0 in the segment */ + movb $0x2, %ah /* function 2 */ + int $0x13 + + jc read_error + + /* save source segment */ + movw %es, %bx + +copy_buffer: + + /* load addresses for copy from disk buffer to destination */ + movw 6(%di), %es /* load destination segment */ + + /* restore %ax */ + popw %ax + + /* determine the next possible destination address (presuming + 512 byte sectors!) */ + shlw $5, %ax /* shift %ax five bits to the left */ + addw %ax, 6(%di) /* add the corrected value to the destination + address for next time */ + + /* save addressing regs */ + pusha + pushw %ds + + /* get the copy length */ + shlw $4, %ax + movw %ax, %cx + + xorw %di, %di /* zero offset of destination addresses */ + xorw %si, %si /* zero offset of source addresses */ + movw %bx, %ds /* restore the source segment */ + + cld /* sets the copy direction to forward */ + + /* perform copy */ + rep /* sets a repeat */ + movsb /* this runs the actual copy */ + + /* restore addressing regs and print a dot with correct DS + (MSG modifies SI, which is saved, and unused AX and BX) */ + popw %ds + MSG(notification_step) + popa + + /* check if finished with this dataset */ + cmpw $0, 4(%di) + jne setup_sectors + + /* update position to load from */ + subw $BOOTSEC_LISTSIZE, %di + + /* jump to bootloop */ + jmp bootloop + +/* END OF MAIN LOOP */ + +bootit: + /* print a newline */ + MSG(notification_done) + popw %dx /* this makes sure %dl is our "boot" drive */ +#ifdef STAGE1_5 + ljmp $0, $0x2200 +#else /* ! STAGE1_5 */ + ljmp $0, $0x8200 +#endif /* ! STAGE1_5 */ + + +/* + * BIOS Geometry translation error (past the end of the disk geometry!). + */ +geometry_error: + MSG(geometry_error_string) + jmp general_error + +/* + * Read error on the disk. + */ +read_error: + MSG(read_error_string) + +general_error: + MSG(general_error_string) + +/* go here when you need to stop the machine hard after an error condition */ +stop: jmp stop + +#ifdef STAGE1_5 +notification_string: .string "Loading stage1.5" +#else +notification_string: .string "Loading stage2" +#endif + +notification_step: .string "." +notification_done: .string "\r\n" + +geometry_error_string: .string "Geom" +read_error_string: .string "Read" +general_error_string: .string " Error" + +/* + * message: write the string pointed to by %si + * + * WARNING: trashes %si, %ax, and %bx + */ + + /* + * Use BIOS "int 10H Function 0Eh" to write character in teletype mode + * %ah = 0xe %al = character + * %bh = page %bl = foreground color (graphics modes) + */ +1: + movw $0x0001, %bx + movb $0xe, %ah + int $0x10 /* display a byte */ + + incw %si +message: + movb (%si), %al + cmpb $0, %al + jne 1b /* if not end of string, jmp to display */ + ret +lastlist: + +/* + * This area is an empty space between the main body of code below which + * grows up (fixed after compilation, but between releases it may change + * in size easily), and the lists of sectors to read, which grows down + * from a fixed top location. + */ + + .word 0 + .word 0 + + . = _start + 0x200 - BOOTSEC_LISTSIZE + + /* fill the first data listing with the default */ +blocklist_default_start: + .long 2 /* this is the sector start parameter, in logical + sectors from the start of the disk, sector 0 */ +blocklist_default_len: + /* this is the number of sectors to read */ +#ifdef STAGE1_5 + .word 0 /* the command "install" will fill this up */ +#else + .word (STAGE2_SIZE + 511) >> 9 +#endif +blocklist_default_seg: +#ifdef STAGE1_5 + .word 0x220 +#else + .word 0x820 /* this is the segment of the starting address + to load the data into */ +#endif + +firstlist: /* this label has to be after the list data!!! */ diff --git a/usr/src/grub/grub-0.97/stage2/start_eltorito.S b/usr/src/grub/grub-0.97/stage2/start_eltorito.S new file mode 100644 index 0000000000..ed47ef03b3 --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/start_eltorito.S @@ -0,0 +1,326 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1994-2002 H. Peter Anvin + * Copyright (C) 1999,2000,2001,2004 Free Software Foundation, 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 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. + * + */ + +/* + Most of this file was originally "isolinux.asm" from SYSLINUX package. + It has been very heavily modified. +*/ + +#define ASM_FILE +#include "stage1.h" +#include "shared.h" +#include "iso9660.h" + +#ifndef STAGE1_5 +#include "stage2_size.h" +#endif + + + /* Absolute addresses + This makes the assembler generate the address without support + from the linker. (ELF can't relocate 16-bit addresses!) */ +#define ABS(x) (x-_start+BOOTSEC_LOCATION) + +#ifdef STAGE1_5 +# define STAGE_ADDR 0x2000 +#else +# define STAGE_ADDR 0x8000 +#endif /* STAGE1_5 */ + + /* Print message string */ +#define MSG(x) mov $ABS(x), %si; call message; + + .file "start_eltorito.S" + + .text + + /* Tell GAS to generate 16-bit instructions so that this code works + in real mode. */ + .code16 + + .globl start, _start + +/* + * Primary entry point. Because BIOSes are buggy, we only load the first + * CD-ROM sector (2K) of the file, so the number one priority is actually + * loading the rest. + */ +start: +_start: + cli + ljmp $0, $ABS(real_start) + + . = _start + 8 /* Pad to file offset 8 */ + + /* This table gets filled in by mkisofs using the + -boot-info-table option */ +bi_pvd: .long 0xDEADBEEF /* LBA of primary volume descript */ +bi_file: .long 0xDEADBEEF /* LBA of boot file */ +bi_length: .long 0xDEADBEEF /* Length of boot file */ +bi_csum: .long 0xDEADBEEF /* Checksum of boot file */ +bi_reserved: .space (10*4) /* Reserved */ + +real_start: + xor %ax, %ax + mov %ax, %ss + mov %ax, %ds + mov %ax, %es + mov %ax, %fs + mov %ax, %gs + mov $STAGE1_STACKSEG, %sp /* set up the REAL stack */ + sti + cld + + /* save drive reference first thing! */ + mov %dl, ABS(BootDrive) + + /* print a notification message on the screen */ + MSG(notification_string) + +load_image: + /* Set up boot file sector, size, load address */ + mov ABS(bi_length), %eax + add $(ISO_SECTOR_SIZE-1), %eax + shr $ISO_SECTOR_BITS, %eax /* dwords->sectors */ + mov %ax, %bp /* boot file sectors */ + mov $(STAGE_ADDR >> 4), %bx + mov %bx, %es + xor %bx, %bx + mov ABS(bi_file), %eax + call getlinsec + mov %ds, %ax + mov %ax, %es + + MSG(notification_done) +bootit: + /* save the sector number of the second sector in %ebp */ + mov $ABS(firstlist - BOOTSEC_LISTSIZE), %si + mov (%si), %ebp + mov ABS(BootDrive), %dl /* this makes sure %dl is our "boot" drive */ + ljmp $0, $(STAGE_ADDR+SECTOR_SIZE) /* jump to main() in asm.S */ + +/* go here when you need to stop the machine hard after an error condition */ +stop: jmp stop + + +/* + * Get linear sectors - EBIOS LBA addressing, 2048-byte sectors. + * + * Note that we can't always do this as a single request, because at least + * Phoenix BIOSes has a 127-sector limit. To be on the safe side, stick + * to 16 sectors (32K) per request. + * + * Input: + * EAX - Linear sector number + * ES:BX - Target buffer + * BP - Sector count + */ +getlinsec: + mov $ABS(dapa), %si /* Load up the DAPA */ + mov %bx, 4(%si) + mov %es, %bx + mov %bx, 6(%si) + mov %eax, 8(%si) +1: + push %bp + push %si + cmp ABS(MaxTransfer), %bp + jbe 2f + mov ABS(MaxTransfer), %bp +2: + mov %bp, 2(%si) + mov ABS(BootDrive), %dl + mov $0x42, %ah /* Extended Read */ + call xint13 + pop %si + pop %bp + movzwl 2(%si), %eax /* Sectors we read */ + add %eax, 8(%si) /* Advance sector pointer */ + sub %ax, %bp /* Sectors left */ + shl $(ISO_SECTOR_BITS-4), %ax /* 2048-byte sectors -> segment */ + add %ax, 6(%si) /* Advance buffer pointer */ + + pushal + MSG(notification_step) + popal + cmp $0, %bp + ja 1b + mov 8(%si), %eax /* Return next sector */ + ret + +/* + * INT 13h with retry + */ +xint13: + movb $6, ABS(RetryCount) +.try: + pushal + int $0x13 + jc 1f + add $(8*4), %sp /* Clean up stack */ + ret +1: + mov %ah, %dl /* Save error code */ + decb ABS(RetryCount) + jz .real_error + mov ABS(RetryCount), %al + mov ABS(dapa+2), %ah /* Sector transfer count */ + cmp $2, %al /* Only 2 attempts left */ + ja 2f + mov $1, %ah /* Drop transfer size to 1 */ + jmp .setmaxtr +2: + cmp $3, %al + ja 3f /* First time, just try again */ + shr $1, %ah /* Otherwise, try to reduce */ + adc $0, %ah /* the max transfer size, but not */ +.setmaxtr: + mov %ah, ABS(MaxTransfer) + mov %ah, ABS(dapa+2) +3: + popal + jmp .try + +.real_error: + MSG(read_error_string) + mov %dl, %al + call printhex2 + popal + jmp stop + + + +/* + * message: write the string pointed to by %si + * + * WARNING: trashes %si, %ax, and %bx + */ + + /* + * Use BIOS "int 10H Function 0Eh" to write character in teletype mode + * %ah = 0xe %al = character + * %bh = page %bl = foreground color (graphics modes) + */ +1: + mov $0x0001, %bx + mov $0x0E, %ah + int $0x10 /* display a byte */ + +message: + lodsb + or %al, %al + jne 1b /* if not end of string, jmp to display */ + ret + +/* + * printhex[248]: Write a hex number in (AL, AX, EAX) to the console + */ +printhex2: + pushal + rol $24, %eax + mov $2, %cx + jmp 1f +printhex4: + pushal + rol $16, %eax + mov $4, %cx + jmp 1f +printhex8: + pushal + mov $8, %cx +1: + rol $4, %eax + push %eax + and $0x0F, %al + cmp $10, %al + jae .high +.low: add $('0'), %al + jmp 2f +.high: add $('A'-10), %al +2: + mov $0x0001, %bx + mov $0x0E, %ah + int $0x10 /* display a char */ + pop %eax + loop 1b + popal + ret + +/**************************************************************************/ +#ifdef STAGE1_5 +notification_string: .string "Loading stage1.5 " +#else +notification_string: .string "Loading stage2 " +#endif + +notification_step: .string "." +notification_done: .string "\r\n" + +read_error_string: .string "Read error 0x" + +/* + * EBIOS disk address packet + */ + .align 8 +dapa: .byte 16 /* Packet size */ + .byte 0 /* reserved */ + .word 0 /* +2 Block count */ + .word 0 /* +4 Offset of buffer */ + .word 0 /* +6 Segment of buffer */ + .long 0 /* +8 LBA (LSW) */ + .long 0 /* +C LBA (MSW) */ + +VARIABLE(BootDrive) + .byte 0xFF +VARIABLE(MaxTransfer) + .word 16 /* Max sectors per transfer (32Kb) */ +VARIABLE(RetryCount) + .byte 0 + + +/* + * This area is an empty space between the main body of code below which + * grows up (fixed after compilation, but between releases it may change + * in size easily), and the lists of sectors to read, which grows down + * from a fixed top location. + */ + + .word 0 + .word 0 + + . = _start + SECTOR_SIZE - BOOTSEC_LISTSIZE + + /* fill the first data listing with the default */ +blocklist_default_start:/* this is the sector start parameter, in logical + sectors from the start of the disk, sector 0 */ + .long 0 + +blocklist_default_len: /* this is the number of sectors to read */ +#ifdef STAGE1_5 + .word 0 +#else + .word (STAGE2_SIZE + ISO_SECTOR_SIZE - 1) >> ISO_SECTOR_BITS +#endif +blocklist_default_seg: /* this is the segment of the starting address + to load the data into */ + .word (STAGE_ADDR + SECTOR_SIZE) >> 4 + +firstlist: /* this label has to be after the list data!!! */ diff --git a/usr/src/grub/grub-0.97/stage2/term.h b/usr/src/grub/grub-0.97/stage2/term.h new file mode 100644 index 0000000000..8ed8b9dc86 --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/term.h @@ -0,0 +1,153 @@ +/* term.h - definitions for terminal handling */ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2002 Free Software Foundation, 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 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 GRUB_TERM_HEADER +#define GRUB_TERM_HEADER 1 + +/* These are used to represent the various color states we use */ +typedef enum +{ + /* represents the color used to display all text that does not use the user + * defined colors below + */ + COLOR_STATE_STANDARD, + /* represents the user defined colors for normal text */ + COLOR_STATE_NORMAL, + /* represents the user defined colors for highlighted text */ + COLOR_STATE_HIGHLIGHT +} color_state; + +#ifndef STAGE1_5 + +/* Flags for representing the capabilities of a terminal. */ +/* Some notes about the flags: + - These flags are used by higher-level functions but not terminals + themselves. + - If a terminal is dumb, you may assume that only putchar, getkey and + checkkey are called. + - Some fancy features (nocursor, setcolor, and highlight) can be set to + NULL. */ + +/* Set when input characters shouldn't be echoed back. */ +#define TERM_NO_ECHO (1 << 0) +/* Set when the editing feature should be disabled. */ +#define TERM_NO_EDIT (1 << 1) +/* Set when the terminal cannot do fancy things. */ +#define TERM_DUMB (1 << 2) +/* Set when the terminal needs to be initialized. */ +#define TERM_NEED_INIT (1 << 16) + +struct term_entry +{ + /* The name of a terminal. */ + const char *name; + /* The feature flags defined above. */ + unsigned long flags; + /* Default for maximum number of lines if not specified */ + unsigned short max_lines; + /* Put a character. */ + void (*putchar) (int c); + /* Check if any input character is available. */ + int (*checkkey) (void); + /* Get a character. */ + int (*getkey) (void); + /* Get the cursor position. The return value is ((X << 8) | Y). */ + int (*getxy) (void); + /* Go to the position (X, Y). */ + void (*gotoxy) (int x, int y); + /* Clear the screen. */ + void (*cls) (void); + /* Set the current color to be used */ + void (*setcolorstate) (color_state state); + /* Set the normal color and the highlight color. The format of each + color is VGA's. */ + void (*setcolor) (int normal_color, int highlight_color); + /* Turn on/off the cursor. */ + int (*setcursor) (int on); + + /* function to start a terminal */ + int (*startup) (void); + /* function to use to shutdown a terminal */ + void (*shutdown) (void); +}; + +/* This lists up available terminals. */ +extern struct term_entry term_table[]; +/* This points to the current terminal. This is useful, because only + a single terminal is enabled normally. */ +extern struct term_entry *current_term; + +#endif /* ! STAGE1_5 */ + +/* The console stuff. */ +extern int console_current_color; +void console_putchar (int c); + +#ifndef STAGE1_5 +int console_checkkey (void); +int console_getkey (void); +int console_getxy (void); +void console_gotoxy (int x, int y); +void console_cls (void); +void console_setcolorstate (color_state state); +void console_setcolor (int normal_color, int highlight_color); +int console_setcursor (int on); +#endif + +#ifdef SUPPORT_SERIAL +void serial_putchar (int c); +int serial_checkkey (void); +int serial_getkey (void); +int serial_getxy (void); +void serial_gotoxy (int x, int y); +void serial_cls (void); +void serial_setcolorstate (color_state state); +#endif + +#ifdef SUPPORT_HERCULES +void hercules_putchar (int c); +int hercules_getxy (void); +void hercules_gotoxy (int x, int y); +void hercules_cls (void); +void hercules_setcolorstate (color_state state); +void hercules_setcolor (int normal_color, int highlight_color); +int hercules_setcursor (int on); +#endif + +#ifdef SUPPORT_GRAPHICS +extern int foreground, background, border, graphics_inited; + +void graphics_set_splash(char *splashfile); +int set_videomode (int mode); +void graphics_putchar (int c); +int graphics_getxy(void); +void graphics_gotoxy(int x, int y); +void graphics_cls(void); +void graphics_setcolorstate (color_state state); +void graphics_setcolor (int normal_color, int highlight_color); +int graphics_setcursor (int on); +int graphics_init(void); +void graphics_end(void); + +int hex(int v); +void graphics_set_palette(int idx, int red, int green, int blue); +#endif /* SUPPORT_GRAPHICS */ + +#endif /* ! GRUB_TERM_HEADER */ diff --git a/usr/src/grub/grub-0.97/stage2/terminfo.c b/usr/src/grub/grub-0.97/stage2/terminfo.c new file mode 100644 index 0000000000..c1c1575fcb --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/terminfo.c @@ -0,0 +1,258 @@ +/* terminfo.c - read a terminfo entry from the command line */ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2002,2004 Free Software Foundation, 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 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. + * + * ###################################################################### + * + * This file contains various functions dealing with different + * terminal capabilities. It knows the difference between a vt52 and vt100 + * terminal (and much more) and is mainly used the terminal emulation + * in the serial driver. + */ + +#include +#include "terminfo.h" +#include "tparm.h" +#include "serial.h" + +/* Current terminal capabilities. Default is "vt100". */ +struct terminfo term = + { + .name = "vt100", + .cursor_address = "\e[%i%p1%d;%p2%dH", + .clear_screen = "\e[H\e[J", + .enter_standout_mode = "\e[7m", + .exit_standout_mode = "\e[m" + }; + +/* A number of escape sequences are provided in the string valued + capabilities for easy encoding of characters there. Both \E and \e + map to an ESCAPE character, ^x maps to a control-x for any + appropriate x, and the sequences \n \l \r \t \b \f \s give a + newline, line-feed, return, tab, backspace, form-feed, and space. + Other escapes include \^ for ^, \\ for \, \, for comma, \: for :, + and \0 for null. (\0 will produce \200, which does not terminate a + string but behaves as a null character on most terminals, provid­ + ing CS7 is specified. See stty(1).) Finally, characters may be + given as three octal digits after a \. */ + +char * +ti_unescape_memory (const char *in, const char *end) +{ + static char out_buffer[256]; + char c; + char *out; + + out = out_buffer; + do + { + c = *(in++); + switch (c) + { + case '^': + if (*in >= 'A' && *in <= 'Z') + { + *out = (*in) - 'A'; + in++; + } + else + { + *out = '^'; + } + break; + case '\\': + c = *(in++); + if (c >= '0' && c <= '9') + { + // octal number + int n = 0; + do + { + n = (n << 4) | (c - '0'); + c = *(in++); + } + while (c >= '0' && c <= '9'); + + *out++ = (char)(n & 0xff); + + // redo last character + in--; + + break; + } + + switch (c) + { + case 'e': + case 'E': + *out++ = '\e'; + break; + case 'n': + *out++ = '\n'; + break; + case 'r': + *out++ = '\r'; + break; + case 't': + *out++ = '\t'; + break; + case 'b': + *out++ = '\b'; + break; + case 'f': + *out++ = '\f'; + break; + case 's': + *out++ = ' '; + break; + case '\\': + *out++ = '\\'; + break; + case '^': + *out++ = '^'; + break; + case ',': + *out++ = ','; + break; + case ':': + *out++ = ':'; + break; + case '0': + *out++ = '\200'; + break; + } + break; + default: + *out++ = c; + break; + } + } + while (in <= end); + + return out_buffer; +} + +char * +ti_unescape_string (const char *in) +{ + return ti_unescape_memory (in, in + grub_strlen (in)); +} + +/* convert a memory region containing binary character into an external + * ascii representation. The binary characters will be replaced by an + * "ecsape notation". E.g. "033" will become "\e". */ +char * +ti_escape_memory (const char *in, const char *end) +{ + static char out_buffer[256]; + char c; + char *out; + + out = out_buffer; + do + { + c = *(in++); + switch (c) + { + case '\e': + *out++ = '\\'; *out++ = 'e'; break; + case ' ': + *out++ = '\\'; *out++ = 's'; break; + case '\\': + *out++ = '\\'; *out++ = '\\'; break; + case '0' ... '9': + case 'a' ... 'z': + case 'A' ... 'Z': + case '%': + case '+': + case '-': + case '*': + case '/': + case ';': + case ':': + case '{': + case '}': + case '[': + case ']': + *out++ = c; break; + case 0 ... 25: + *out++ = '^'; *out++ = 'A' + c; break; + default: + *out++ = '\\'; + *out++ = ((c >> 8) & 7) + '0'; + *out++ = ((c >> 4) & 7) + '0'; + *out++ = ((c >> 0) & 7) + '0'; + break; + } + } + while (in < end); + + *out++ = 0; + + return out_buffer; +} + +/* convert a string containing binary character into an external ascii + * representation. */ +char * +ti_escape_string (const char *in) +{ + return ti_escape_memory (in, in + grub_strlen (in)); +} + +/* move the cursor to the given position starting with "0". */ +void +ti_cursor_address (int x, int y) +{ + grub_putstr (grub_tparm (term.cursor_address, y, x)); +} + +/* clear the screen. */ +void +ti_clear_screen (void) +{ + grub_putstr (grub_tparm (term.clear_screen)); +} + +/* enter reverse video */ +void +ti_enter_standout_mode (void) +{ + grub_putstr (grub_tparm (term.enter_standout_mode)); +} + +/* exit reverse video */ +void +ti_exit_standout_mode (void) +{ + grub_putstr (grub_tparm (term.exit_standout_mode)); +} + +/* set the current terminal emulation to use */ +void +ti_set_term (const struct terminfo *new) +{ + grub_memmove (&term, new, sizeof (struct terminfo)); +} + +/* get the current terminal emulation */ +void +ti_get_term(struct terminfo *copy) +{ + grub_memmove (copy, &term, sizeof (struct terminfo)); +} diff --git a/usr/src/grub/grub-0.97/stage2/terminfo.h b/usr/src/grub/grub-0.97/stage2/terminfo.h new file mode 100644 index 0000000000..2e59761ea7 --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/terminfo.h @@ -0,0 +1,51 @@ +/* terminfo.h - read a terminfo entry from the command line */ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2002,2003,2004 Free Software Foundation, 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 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 GRUB_TERMCAP_HEADER +#define GRUB_TERMCAP_HEADER 1 + +#define TERMINFO_LEN 40 + +typedef struct terminfo +{ + char name[TERMINFO_LEN]; + char cursor_address[TERMINFO_LEN]; + char clear_screen[TERMINFO_LEN]; + char enter_standout_mode[TERMINFO_LEN]; + char exit_standout_mode[TERMINFO_LEN]; +} +terminfo; + + +/* Function prototypes. */ +char *ti_escape_memory (const char *in, const char *end); +char *ti_escape_string (const char *in); +char *ti_unescape_memory (const char *in, const char *end); +char *ti_unescape_string (const char *in); + +void ti_set_term (const struct terminfo *new); +void ti_get_term (struct terminfo *copy); + +void ti_cursor_address (int x, int y); +void ti_clear_screen (void); +void ti_enter_standout_mode (void); +void ti_exit_standout_mode (void); + +#endif /* ! GRUB_TERMCAP_HEADER */ diff --git a/usr/src/grub/grub-0.97/stage2/tparm.c b/usr/src/grub/grub-0.97/stage2/tparm.c new file mode 100644 index 0000000000..6e35002a42 --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/tparm.c @@ -0,0 +1,727 @@ +/**************************************************************************** + * Copyright (c) 1998,2000,2002 Free Software Foundation, 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, distribute with modifications, 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 ABOVE 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. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/********************************************************************** + * This code is a modification of lib_tparm.c found in ncurses-5.2. The + * modification are for use in grub by replacing all libc function through + * special grub functions. This also meant to delete all dynamic memory + * allocation and replace it by a number of fixed buffers. + * + * Modifications by Tilmann Bubeck 2002 + **********************************************************************/ + +/**************************************************************************** + * Author: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + +/* + * tparm.c + * + */ + +#include "shared.h" + +#include "tparm.h" + +/* + * Common/troublesome character definitions + */ +typedef char grub_bool; +#undef isdigit +#define isdigit(c) ((c) >= '0' && (c) <= '9') +#ifndef FALSE +# define FALSE (0) +#endif +#ifndef TRUE +# define TRUE (!FALSE) +#endif +#define MAX_FORMAT_LEN 256 +#define max(a,b) ((a) > (b) ? (a) : (b)) + +//MODULE_ID("$Id: tparm.c,v 1.1.1.1 2003/11/20 02:04:59 fengshuo Exp $") + +/* + * char * + * tparm(string, ...) + * + * Substitute the given parameters into the given string by the following + * rules (taken from terminfo(5)): + * + * Cursor addressing and other strings requiring parame- + * ters in the terminal are described by a parameterized string + * capability, with like escapes %x in it. For example, to + * address the cursor, the cup capability is given, using two + * parameters: the row and column to address to. (Rows and + * columns are numbered from zero and refer to the physical + * screen visible to the user, not to any unseen memory.) If + * the terminal has memory relative cursor addressing, that can + * be indicated by + * + * The parameter mechanism uses a stack and special % + * codes to manipulate it. Typically a sequence will push one + * of the parameters onto the stack and then print it in some + * format. Often more complex operations are necessary. + * + * The % encodings have the following meanings: + * + * %% outputs `%' + * %c print pop() like %c in printf() + * %s print pop() like %s in printf() + * %[[:]flags][width[.precision]][doxXs] + * as in printf, flags are [-+#] and space + * The ':' is used to avoid making %+ or %- + * patterns (see below). + * + * %p[1-9] push ith parm + * %P[a-z] set dynamic variable [a-z] to pop() + * %g[a-z] get dynamic variable [a-z] and push it + * %P[A-Z] set static variable [A-Z] to pop() + * %g[A-Z] get static variable [A-Z] and push it + * %l push strlen(pop) + * %'c' push char constant c + * %{nn} push integer constant nn + * + * %+ %- %* %/ %m + * arithmetic (%m is mod): push(pop() op pop()) + * %& %| %^ bit operations: push(pop() op pop()) + * %= %> %< logical operations: push(pop() op pop()) + * %A %O logical and & or operations for conditionals + * %! %~ unary operations push(op pop()) + * %i add 1 to first two parms (for ANSI terminals) + * + * %? expr %t thenpart %e elsepart %; + * if-then-else, %e elsepart is optional. + * else-if's are possible ala Algol 68: + * %? c1 %t b1 %e c2 %t b2 %e c3 %t b3 %e c4 %t b4 %e b5 %; + * + * For those of the above operators which are binary and not commutative, + * the stack works in the usual way, with + * %gx %gy %m + * resulting in x mod y, not the reverse. + */ + +#define STACKSIZE 20 + +typedef struct { + union { + unsigned int num; + char *str; + } data; + grub_bool num_type; +} stack_frame; + +static stack_frame stack[STACKSIZE]; +static int stack_ptr; + +static char out_buff[256]; +static int out_size = 256; +static int out_used; + +static inline void +get_space(int need) +{ + need += out_used; + if (need > out_size) { + // FIX ME! buffer full, what now? + ; + } +} + +static inline void +save_text(const char *fmt, const char *s, int len) +{ + int s_len = grub_strlen(s); + if (len > (int) s_len) + s_len = len; + + get_space(s_len + 1); + + (void) grub_sprintf(out_buff + out_used, fmt, s); + out_used += grub_strlen(out_buff + out_used); +} + +static inline void +save_number(const char *fmt, int number, int len) +{ + if (len < 30) + len = 30; /* actually log10(MAX_INT)+1 */ + + get_space(len + 1); + + (void) grub_sprintf(out_buff + out_used, fmt, number); + out_used += grub_strlen(out_buff + out_used); +} + +static inline void +save_char(int c) +{ + if (c == 0) + c = 0200; + get_space(1); + out_buff[out_used++] = c; +} + +static inline void +npush(int x) +{ + if (stack_ptr < STACKSIZE) { + stack[stack_ptr].num_type = TRUE; + stack[stack_ptr].data.num = x; + stack_ptr++; + } +} + +static inline int +npop(void) +{ + int result = 0; + if (stack_ptr > 0) { + stack_ptr--; + if (stack[stack_ptr].num_type) + result = stack[stack_ptr].data.num; + } + return result; +} + +static inline void +spush(char *x) +{ + if (stack_ptr < STACKSIZE) { + stack[stack_ptr].num_type = FALSE; + stack[stack_ptr].data.str = x; + stack_ptr++; + } +} + +static inline char * +spop(void) +{ + static char dummy[] = ""; /* avoid const-cast */ + char *result = dummy; + if (stack_ptr > 0) { + stack_ptr--; + if (!stack[stack_ptr].num_type && stack[stack_ptr].data.str != 0) + result = stack[stack_ptr].data.str; + } + return result; +} + +static inline const char * +parse_format(const char *s, char *format, int *len) +{ + grub_bool done = FALSE; + grub_bool allowminus = FALSE; + grub_bool dot = FALSE; + grub_bool err = FALSE; + char *fmt = format; + int prec = 0; + int width = 0; + int value = 0; + + *len = 0; + *format++ = '%'; + while (*s != '\0' && !done) { + switch (*s) { + case 'c': /* FALLTHRU */ + case 'd': /* FALLTHRU */ + case 'o': /* FALLTHRU */ + case 'x': /* FALLTHRU */ + case 'X': /* FALLTHRU */ + case 's': + *format++ = *s; + done = TRUE; + break; + case '.': + *format++ = *s++; + if (dot) { + err = TRUE; + } else { + dot = TRUE; + prec = value; + } + value = 0; + break; + case '#': + *format++ = *s++; + break; + case ' ': + *format++ = *s++; + break; + case ':': + s++; + allowminus = TRUE; + break; + case '-': + if (allowminus) { + *format++ = *s++; + } else { + done = TRUE; + } + break; + default: + if (isdigit(*s)) { + value = (value * 10) + (*s - '0'); + if (value > 10000) + err = TRUE; + *format++ = *s++; + } else { + done = TRUE; + } + } + } + + /* + * If we found an error, ignore (and remove) the flags. + */ + if (err) { + prec = width = value = 0; + format = fmt; + *format++ = '%'; + *format++ = *s; + } + + if (dot) + width = value; + else + prec = value; + + *format = '\0'; + /* return maximum string length in print */ + *len = (prec > width) ? prec : width; + return s; +} + +#define isUPPER(c) ((c) >= 'A' && (c) <= 'Z') +#define isLOWER(c) ((c) >= 'a' && (c) <= 'z') + +static inline char * +tparam_internal(const char *string, int *dataptr) +{ +#define NUM_VARS 26 + char *p_is_s[9]; + int param[9]; + int lastpop; + int popcount; + int number; + int len; + int level; + int x, y; + int i; + int len2; + register const char *cp; + static int len_fmt = MAX_FORMAT_LEN; + static char dummy[] = ""; + static char format[MAX_FORMAT_LEN]; + static int dynamic_var[NUM_VARS]; + static int static_vars[NUM_VARS]; + + out_used = 0; + if (string == NULL) + return NULL; + + if ((len2 = grub_strlen(string)) > len_fmt) { + return NULL; + } + + /* + * Find the highest parameter-number referred to in the format string. + * Use this value to limit the number of arguments copied from the + * variable-length argument list. + */ + + number = 0; + lastpop = -1; + popcount = 0; + grub_memset(p_is_s, 0, sizeof(p_is_s)); + + /* + * Analyze the string to see how many parameters we need from the varargs + * list, and what their types are. We will only accept string parameters + * if they appear as a %l or %s format following an explicit parameter + * reference (e.g., %p2%s). All other parameters are numbers. + * + * 'number' counts coarsely the number of pop's we see in the string, and + * 'popcount' shows the highest parameter number in the string. We would + * like to simply use the latter count, but if we are reading termcap + * strings, there may be cases that we cannot see the explicit parameter + * numbers. + */ + for (cp = string; (cp - string) < (int) len2;) { + if (*cp == '%') { + cp++; + cp = parse_format(cp, format, &len); + switch (*cp) { + default: + break; + + case 'd': /* FALLTHRU */ + case 'o': /* FALLTHRU */ + case 'x': /* FALLTHRU */ + case 'X': /* FALLTHRU */ + case 'c': /* FALLTHRU */ + number++; + lastpop = -1; + break; + + case 'l': + case 's': + if (lastpop > 0) + p_is_s[lastpop - 1] = dummy; + ++number; + break; + + case 'p': + cp++; + i = (*cp - '0'); + if (i >= 0 && i <= 9) { + lastpop = i; + if (lastpop > popcount) + popcount = lastpop; + } + break; + + case 'P': + case 'g': + cp++; + break; + + case '\'': + cp += 2; + lastpop = -1; + break; + + case '{': + cp++; + while (*cp >= '0' && *cp <= '9') { + cp++; + } + break; + + case '+': + case '-': + case '*': + case '/': + case 'm': + case 'A': + case 'O': + case '&': + case '|': + case '^': + case '=': + case '<': + case '>': + case '!': + case '~': + lastpop = -1; + number += 2; + break; + + case 'i': + lastpop = -1; + if (popcount < 2) + popcount = 2; + break; + } + } + if (*cp != '\0') + cp++; + } + + if (number > 9) + number = 9; + for (i = 0; i < max(popcount, number); i++) { + /* + * A few caps (such as plab_norm) have string-valued parms. + * We'll have to assume that the caller knows the difference, since + * a char* and an int may not be the same size on the stack. + */ + if (p_is_s[i] != 0) { + p_is_s[i] = (char *)(*(dataptr++)); + } else { + param[i] = (int)(*(dataptr++)); + } + } + + /* + * This is a termcap compatibility hack. If there are no explicit pop + * operations in the string, load the stack in such a way that + * successive pops will grab successive parameters. That will make + * the expansion of (for example) \E[%d;%dH work correctly in termcap + * style, which means tparam() will expand termcap strings OK. + */ + stack_ptr = 0; + if (popcount == 0) { + popcount = number; + for (i = number - 1; i >= 0; i--) + npush(param[i]); + } + + while (*string) { + /* skip delay timings */ + if (*string == '$' && *(string + 1) == '<') { + while( *string && *string != '>') + string++; + if ( *string == '>' ) string++; + } else if ( *string == '%') { + string++; + string = parse_format(string, format, &len); + switch (*string) { + default: + break; + case '%': + save_char('%'); + break; + + case 'd': /* FALLTHRU */ + case 'o': /* FALLTHRU */ + case 'x': /* FALLTHRU */ + case 'X': /* FALLTHRU */ + case 'c': /* FALLTHRU */ + save_number(format, npop(), len); + break; + + case 'l': + save_number("%d", strlen(spop()), 0); + break; + + case 's': + save_text(format, spop(), len); + break; + + case 'p': + string++; + i = (*string - '1'); + if (i >= 0 && i < 9) { + if (p_is_s[i]) + spush(p_is_s[i]); + else + npush(param[i]); + } + break; + + case 'P': + string++; + if (isUPPER(*string)) { + i = (*string - 'A'); + static_vars[i] = npop(); + } else if (isLOWER(*string)) { + i = (*string - 'a'); + dynamic_var[i] = npop(); + } + break; + + case 'g': + string++; + if (isUPPER(*string)) { + i = (*string - 'A'); + npush(static_vars[i]); + } else if (isLOWER(*string)) { + i = (*string - 'a'); + npush(dynamic_var[i]); + } + break; + + case '\'': + string++; + npush(*string); + string++; + break; + + case '{': + number = 0; + string++; + while (*string >= '0' && *string <= '9') { + number = number * 10 + *string - '0'; + string++; + } + npush(number); + break; + + case '+': + npush(npop() + npop()); + break; + + case '-': + y = npop(); + x = npop(); + npush(x - y); + break; + + case '*': + npush(npop() * npop()); + break; + + case '/': + y = npop(); + x = npop(); + npush(y ? (x / y) : 0); + break; + + case 'm': + y = npop(); + x = npop(); + npush(y ? (x % y) : 0); + break; + + case 'A': + npush(npop() && npop()); + break; + + case 'O': + npush(npop() || npop()); + break; + + case '&': + npush(npop() & npop()); + break; + + case '|': + npush(npop() | npop()); + break; + + case '^': + npush(npop() ^ npop()); + break; + + case '=': + y = npop(); + x = npop(); + npush(x == y); + break; + + case '<': + y = npop(); + x = npop(); + npush(x < y); + break; + + case '>': + y = npop(); + x = npop(); + npush(x > y); + break; + + case '!': + npush(!npop()); + break; + + case '~': + npush(~npop()); + break; + + case 'i': + if (p_is_s[0] == 0) + param[0]++; + if (p_is_s[1] == 0) + param[1]++; + break; + + case '?': + break; + + case 't': + x = npop(); + if (!x) { + /* scan forward for %e or %; at level zero */ + string++; + level = 0; + while (*string) { + if (*string == '%') { + string++; + if (*string == '?') + level++; + else if (*string == ';') { + if (level > 0) + level--; + else + break; + } else if (*string == 'e' && level == 0) + break; + } + + if (*string) + string++; + } + } + break; + + case 'e': + /* scan forward for a %; at level zero */ + string++; + level = 0; + while (*string) { + if (*string == '%') { + string++; + if (*string == '?') + level++; + else if (*string == ';') { + if (level > 0) + level--; + else + break; + } + } + + if (*string) + string++; + } + break; + + case ';': + break; + + } /* endswitch (*string) */ + } else { /* endelse (*string == '%') */ + save_char(*string); + } + + if (*string == '\0') + break; + + string++; + } /* endwhile (*string) */ + + get_space(1); + out_buff[out_used] = '\0'; + + return (out_buff); +} + +char * +grub_tparm(const char *string,...) +{ + char *result; + int *dataptr = (int *) &string; + + dataptr++; + + result = tparam_internal(string, dataptr); + + return result; +} diff --git a/usr/src/grub/grub-0.97/stage2/tparm.h b/usr/src/grub/grub-0.97/stage2/tparm.h new file mode 100644 index 0000000000..e2c1b68e68 --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/tparm.h @@ -0,0 +1,28 @@ +/* tparm.h - parameter formatting of terminfo */ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2002 Free Software Foundation, 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 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 GRUB_TPARM_HEADER +#define GRUB_TPARM_HEADER 1 + + +/* Function prototypes. */ +char *grub_tparm (const char *string, ...); + +#endif /* ! GRUB_TERMCAP_HEADER */ diff --git a/usr/src/grub/grub-0.97/stage2/ufs.h b/usr/src/grub/grub-0.97/stage2/ufs.h new file mode 100644 index 0000000000..29f2f1485f --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/ufs.h @@ -0,0 +1,231 @@ +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _GRUB_UFS_H +#define _GRUB_UFS_H_ + +#ifdef FSYS_UFS + +/* ufs specific constants */ +#define UFS_SBLOCK 16 +#define UFS_SBSIZE 8192 +#define UFS_MAGIC 0x011954 +#define ROOTINO 2 /* i number of all roots */ +#define UFS_NDADDR 12 /* direct blocks */ +#define UFS_NIADDR 3 /* indirect blocks */ +#define MAXMNTLEN 512 +#define MAXCSBUFS 32 + +/* file types */ +#define IFMT 0xf000 +#define IFREG 0x8000 +#define IFDIR 0x4000 + +typedef unsigned char grub_uchar_t; +typedef unsigned short grub_ushort_t; +typedef unsigned short grub_o_mode_t; +typedef unsigned short grub_o_uid_t; +typedef unsigned short grub_o_gid_t; +typedef long grub_ino_t; +typedef long grub_int32_t; +typedef long grub_uid_t; +typedef long grub_gid_t; +typedef unsigned long grub_uint32_t; +typedef unsigned long grub_daddr32_t; +typedef unsigned long grub_time32_t; +typedef struct { int val[2]; } grub_quad_t; + +struct timeval32 { + grub_time32_t tv_sec; + grub_int32_t tv_usec; +}; + +/* + * Per cylinder group information; summarized in blocks allocated + * from first cylinder group data blocks. These blocks have to be + * read in from fs_csaddr (size fs_cssize) in addition to the + * super block. + * + * N.B. sizeof (struct csum) must be a power of two in order for + * the ``fs_cs'' macro to work (see below). + */ +struct csum { + grub_int32_t cs_ndir; /* number of directories */ + grub_int32_t cs_nbfree; /* number of free blocks */ + grub_int32_t cs_nifree; /* number of free inodes */ + grub_int32_t cs_nffree; /* number of free frags */ +}; + +/* Ufs super block */ +struct fs { + grub_uint32_t fs_link; /* linked list of file systems */ + grub_uint32_t fs_rolled; /* logging only: fs fully rolled */ + grub_daddr32_t fs_sblkno; /* addr of super-block in filesys */ + grub_daddr32_t fs_cblkno; /* offset of cyl-block in filesys */ + grub_daddr32_t fs_iblkno; /* offset of inode-blocks in filesys */ + grub_daddr32_t fs_dblkno; /* offset of first data after cg */ + grub_int32_t fs_cgoffset; /* cylinder group offset in cylinder */ + grub_int32_t fs_cgmask; /* used to calc mod fs_ntrak */ + grub_time32_t fs_time; /* last time written */ + grub_int32_t fs_size; /* number of blocks in fs */ + grub_int32_t fs_dsize; /* number of data blocks in fs */ + grub_int32_t fs_ncg; /* number of cylinder groups */ + grub_int32_t fs_bsize; /* size of basic blocks in fs */ + grub_int32_t fs_fsize; /* size of frag blocks in fs */ + grub_int32_t fs_frag; /* number of frags in a block in fs */ + /* these are configuration parameters */ + grub_int32_t fs_minfree; /* minimum percentage of free blocks */ + grub_int32_t fs_rotdelay; /* num of ms for optimal next block */ + grub_int32_t fs_rps; /* disk revolutions per second */ + /* these fields can be computed from the others */ + grub_int32_t fs_bmask; /* ``blkoff'' calc of blk offsets */ + grub_int32_t fs_fmask; /* ``fragoff'' calc of frag offsets */ + grub_int32_t fs_bshift; /* ``lblkno'' calc of logical blkno */ + grub_int32_t fs_fshift; /* ``numfrags'' calc number of frags */ + /* these are configuration parameters */ + grub_int32_t fs_maxcontig; /* max number of contiguous blks */ + grub_int32_t fs_maxbpg; /* max number of blks per cyl group */ + /* these fields can be computed from the others */ + grub_int32_t fs_fragshift; /* block to frag shift */ + grub_int32_t fs_fsbtodb; /* fsbtodb and dbtofsb shift constant */ + grub_int32_t fs_sbsize; /* actual size of super block */ + grub_int32_t fs_csmask; /* csum block offset */ + grub_int32_t fs_csshift; /* csum block number */ + grub_int32_t fs_nindir; /* value of NINDIR */ + grub_int32_t fs_inopb; /* value of INOPB */ + grub_int32_t fs_nspf; /* value of NSPF */ + /* yet another configuration parameter */ + grub_int32_t fs_optim; /* optimization preference, see below */ + /* these fields are derived from the hardware */ + /* USL SVR4 compatibility */ + /* + * * USL SVR4 compatibility + * + * There was a significant divergence here between Solaris and + * SVR4 for x86. By swapping these two members in the superblock, + * we get read-only compatibility of SVR4 filesystems. Otherwise + * there would be no compatibility. This change was introduced + * during bootstrapping of Solaris on x86. By making this ifdef'ed + * on byte order, we provide ongoing compatibility across all + * platforms with the same byte order, the highest compatibility + * that can be achieved. + */ + grub_int32_t fs_state; /* file system state time stamp */ + grub_int32_t fs_si; /* summary info state - lufs only */ + grub_int32_t fs_trackskew; /* sector 0 skew, per track */ + /* unique id for this filesystem (currently unused and unmaintained) */ + /* In 4.3 Tahoe this space is used by fs_headswitch and fs_trkseek */ + /* Neither of those fields is used in the Tahoe code right now but */ + /* there could be problems if they are. */ + grub_int32_t fs_id[2]; /* file system id */ + /* sizes determined by number of cylinder groups and their sizes */ + grub_daddr32_t fs_csaddr; /* blk addr of cyl grp summary area */ + grub_int32_t fs_cssize; /* size of cyl grp summary area */ + grub_int32_t fs_cgsize; /* cylinder group size */ + /* these fields are derived from the hardware */ + grub_int32_t fs_ntrak; /* tracks per cylinder */ + grub_int32_t fs_nsect; /* sectors per track */ + grub_int32_t fs_spc; /* sectors per cylinder */ + /* this comes from the disk driver partitioning */ + grub_int32_t fs_ncyl; /* cylinders in file system */ + /* these fields can be computed from the others */ + grub_int32_t fs_cpg; /* cylinders per group */ + grub_int32_t fs_ipg; /* inodes per group */ + grub_int32_t fs_fpg; /* blocks per group * fs_frag */ + /* this data must be re-computed after crashes */ + struct csum fs_cstotal; /* cylinder summary information */ + /* these fields are cleared at mount time */ + char fs_fmod; /* super block modified flag */ + char fs_clean; /* file system state flag */ + char fs_ronly; /* mounted read-only flag */ + char fs_flags; /* largefiles flag, etc. */ + char fs_fsmnt[MAXMNTLEN]; /* name mounted on */ + /* these fields retain the current block allocation info */ + grub_int32_t fs_cgrotor; /* last cg searched */ + /* + * The following used to be fs_csp[MAXCSBUFS]. It was not + * used anywhere except in old utilities. We removed this + * in 5.6 and expect fs_u.fs_csp to be used instead. + * We no longer limit fs_cssize based on MAXCSBUFS. + */ + union { /* fs_cs (csum) info */ + grub_uint32_t fs_csp_pad[MAXCSBUFS]; + struct csum *fs_csp; + } fs_u; + grub_int32_t fs_cpc; /* cyl per cycle in postbl */ + short fs_opostbl[16][8]; /* old rotation block list head */ + grub_int32_t fs_sparecon[51]; /* reserved for future constants */ + grub_int32_t fs_version; /* minor version of MTB ufs */ + grub_int32_t fs_logbno; /* block # of embedded log */ + grub_int32_t fs_reclaim; /* reclaim open, deleted files */ + grub_int32_t fs_sparecon2; /* reserved for future constant */ + /* USL SVR4 compatibility */ + grub_int32_t fs_npsect; /* # sectors/track including spares */ + grub_quad_t fs_qbmask; /* ~fs_bmask - for use with quad size */ + grub_quad_t fs_qfmask; /* ~fs_fmask - for use with quad size */ + grub_int32_t fs_postblformat; /* fmt of positional layout tables */ + grub_int32_t fs_nrpos; /* number of rotaional positions */ + grub_int32_t fs_postbloff; /* (short) rotation block list head */ + grub_int32_t fs_rotbloff; /* (grub_uchar_t) blocks for each */ + /* rotation */ + grub_int32_t fs_magic; /* magic number */ + grub_uchar_t fs_space[1]; /* list of blocks for each rotation */ + /* actually longer */ +}; + +struct icommon { + grub_o_mode_t ic_smode; /* 0: mode and type of file */ + short ic_nlink; /* 2: number of links to file */ + grub_o_uid_t ic_suid; /* 4: owner's user id */ + grub_o_gid_t ic_sgid; /* 6: owner's group id */ + grub_uint32_t ic_sizelo; /* 8: number of bytes in file */ + grub_uint32_t ic_sizehi; /* 12: number of bytes in file */ + struct timeval32 ic_atime; /* 16: time last accessed */ + struct timeval32 ic_mtime; /* 24: time last modified */ + struct timeval32 ic_ctime; /* 32: last time inode changed */ + grub_daddr32_t ic_db[UFS_NDADDR]; /* 40: disk block addresses */ + grub_daddr32_t ic_ib[UFS_NIADDR]; /* 88: indirect blocks */ + grub_int32_t ic_flags; /* 100: cflags */ + grub_int32_t ic_blocks; /* 104: 512 byte blocks actually held */ + grub_int32_t ic_gen; /* 108: generation number */ + grub_int32_t ic_shadow; /* 112: shadow inode */ + grub_uid_t ic_uid; /* 116: long EFT version of uid */ + grub_gid_t ic_gid; /* 120: long EFT version of gid */ + grub_uint32_t ic_oeftflag; /* 124: extended attr directory ino, */ + /* 0 = none */ +}; + +struct direct { + grub_ino_t d_ino; + grub_ushort_t d_reclen; + grub_ushort_t d_namelen; + char d_name[MAXNAMELEN + 1]; +}; + +/* inode macros */ +#define INOPB(fs) ((fs)->fs_inopb) +#define itoo(fs, x) ((x) % (grub_uint32_t)INOPB(fs)) +#define itog(fs, x) ((x) / (grub_uint32_t)(fs)->fs_ipg) +#define itod(fs, x) ((grub_daddr32_t)(cgimin(fs, itog(fs, x)) + \ + (blkstofrags((fs), \ + ((x) % (grub_uint32_t)(fs)->fs_ipg / (grub_uint32_t)INOPB(fs)))))) + +/* block conversion macros */ +#define UFS_NINDIR(fs) ((fs)->fs_nindir) /* # of indirects */ +#define blkoff(fs, loc) ((int)((loc & ~(fs)->fs_bmask))) +#define lblkno(fs, loc) ((grub_int32_t)((loc) >> (fs)->fs_bshift)) +/* frag to blk */ +#define fsbtodb(fs, b) (((grub_daddr32_t)(b)) << (fs)->fs_fsbtodb) +#define blkstofrags(fs, b) ((b) << (fs)->fs_fragshift) + +/* cynlinder group macros */ +#define cgbase(fs, c) ((grub_daddr32_t)((fs)->fs_fpg * (c))) +#define cgimin(fs, c) (cgstart(fs, c) + (fs)->fs_iblkno) /* inode block */ +#define cgstart(fs, c) \ + (cgbase(fs, c) + (fs)->fs_cgoffset * ((c) & ~((fs)->fs_cgmask))) + +#endif /* FSYS_UFS */ + +#endif /* !_GRUB_UFS_H */ diff --git a/usr/src/grub/grub-0.97/stage2/ufs2.h b/usr/src/grub/grub-0.97/stage2/ufs2.h new file mode 100644 index 0000000000..ba2ef30a94 --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/ufs2.h @@ -0,0 +1,439 @@ +/* + * Copyright (C) 2004 Free Software Foundation, Inc. + * Copyright (c) 2002 Networks Associates Technology, Inc. + * All rights reserved. + * + * This software was developed for the FreeBSD Project by Marshall + * Kirk McKusick and Network Associates Laboratories, the Security + * Research Division of Network Associates, Inc. under DARPA/SPAWAR + * contract N66001-01-C-8035 ("CBOSS"), as part of the DARPA CHATS + * research program + * + * Copyright (c) 1982, 1989, 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. + * 3. The names of the authors 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 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. + * + * @(#)dinode.h 8.3 (Berkeley) 1/21/94 + * $FreeBSD: src/sys/ufs/ufs/dinode.h,v 1.11 2002/07/16 22:36:00 mckusick Exp $ + */ + +#ifndef _GRUB_UFS2_H_ +#define _GRUB_UFS2_H_ + +typedef signed char grub_int8_t; +typedef signed short grub_int16_t; +typedef signed int grub_int32_t; +typedef signed long long int grub_int64_t; +typedef unsigned char grub_uint8_t; +typedef unsigned short grub_uint16_t; +typedef unsigned int grub_uint32_t; +typedef unsigned long long int grub_uint64_t; + +typedef grub_uint8_t grub_u_char; +typedef grub_uint32_t grub_u_int; + +typedef grub_uint8_t grub_u_int8_t; +typedef grub_uint16_t grub_u_int16_t; +typedef grub_uint32_t grub_u_int32_t; +typedef grub_uint64_t grub_u_int64_t; + +#define i_size di_size + + +#define DEV_BSIZE 512 + +/* + * The root inode is the root of the filesystem. Inode 0 can't be used for + * normal purposes and historically bad blocks were linked to inode 1, thus + * the root inode is 2. (Inode 1 is no longer used for this purpose, however + * numerous dump tapes make this assumption, so we are stuck with it). + */ +#define ROOTINO ((grub_ino_t)2) + +/* + * The size of physical and logical block numbers and time fields in UFS. + */ +typedef grub_int32_t ufs1_daddr_t; +typedef grub_int64_t ufs2_daddr_t; +typedef grub_int64_t ufs_lbn_t; +typedef grub_int64_t ufs_time_t; + +/* inode number */ +typedef grub_uint32_t grub_ino_t; + +/* File permissions. */ +#define IEXEC 0000100 /* Executable. */ +#define IWRITE 0000200 /* Writeable. */ +#define IREAD 0000400 /* Readable. */ +#define ISVTX 0001000 /* Sticky bit. */ +#define ISGID 0002000 /* Set-gid. */ +#define ISUID 0004000 /* Set-uid. */ + +/* File types. */ +#define IFMT 0170000 /* Mask of file type. */ +#define IFIFO 0010000 /* Named pipe (fifo). */ +#define IFCHR 0020000 /* Character device. */ +#define IFDIR 0040000 /* Directory file. */ +#define IFBLK 0060000 /* Block device. */ +#define IFREG 0100000 /* Regular file. */ +#define IFLNK 0120000 /* Symbolic link. */ +#define IFSOCK 0140000 /* UNIX domain socket. */ +#define IFWHT 0160000 /* Whiteout. */ + +/* + * A dinode contains all the meta-data associated with a UFS2 file. + * This structure defines the on-disk format of a dinode. Since + * this structure describes an on-disk structure, all its fields + * are defined by types with precise widths. + */ + +#define NXADDR 2 /* External addresses in inode. */ +#define NDADDR 12 /* Direct addresses in inode. */ +#define NIADDR 3 /* Indirect addresses in inode. */ + +struct ufs1_dinode { + grub_u_int16_t di_mode; /* 0: IFMT, permissions; see below. */ + grub_int16_t di_nlink; /* 2: File link count. */ + union { + grub_u_int16_t oldids[2]; /* 4: Ffs: old user and group ids. */ + } di_u; + grub_u_int64_t di_size; /* 8: File byte count. */ + grub_int32_t di_atime; /* 16: Last access time. */ + grub_int32_t di_atimensec; /* 20: Last access time. */ + grub_int32_t di_mtime; /* 24: Last modified time. */ + grub_int32_t di_mtimensec; /* 28: Last modified time. */ + grub_int32_t di_ctime; /* 32: Last inode change time. */ + grub_int32_t di_ctimensec; /* 36: Last inode change time. */ + ufs1_daddr_t di_db[NDADDR]; /* 40: Direct disk blocks. */ + ufs1_daddr_t di_ib[NIADDR]; /* 88: Indirect disk blocks. */ + grub_u_int32_t di_flags; /* 100: Status flags (chflags). */ + grub_int32_t di_blocks; /* 104: Blocks actually held. */ + grub_int32_t di_gen; /* 108: Generation number. */ + grub_u_int32_t di_uid; /* 112: File owner. */ + grub_u_int32_t di_gid; /* 116: File group. */ + grub_int32_t di_spare[2]; /* 120: Reserved; currently unused */ +}; + +struct ufs2_dinode { + grub_u_int16_t di_mode; /* 0: IFMT, permissions; see below. */ + grub_int16_t di_nlink; /* 2: File link count. */ + grub_u_int32_t di_uid; /* 4: File owner. */ + grub_u_int32_t di_gid; /* 8: File group. */ + grub_u_int32_t di_blksize; /* 12: Inode blocksize. */ + grub_u_int64_t di_size; /* 16: File byte count. */ + grub_u_int64_t di_blocks; /* 24: Bytes actually held. */ + ufs_time_t di_atime; /* 32: Last access time. */ + ufs_time_t di_mtime; /* 40: Last modified time. */ + ufs_time_t di_ctime; /* 48: Last inode change time. */ + ufs_time_t di_birthtime; /* 56: Inode creation time. */ + grub_int32_t di_mtimensec; /* 64: Last modified time. */ + grub_int32_t di_atimensec; /* 68: Last access time. */ + grub_int32_t di_ctimensec; /* 72: Last inode change time. */ + grub_int32_t di_birthnsec; /* 76: Inode creation time. */ + grub_int32_t di_gen; /* 80: Generation number. */ + grub_u_int32_t di_kernflags; /* 84: Kernel flags. */ + grub_u_int32_t di_flags; /* 88: Status flags (chflags). */ + grub_int32_t di_extsize; /* 92: External attributes block. */ + ufs2_daddr_t di_extb[NXADDR];/* 96: External attributes block. */ + ufs2_daddr_t di_db[NDADDR]; /* 112: Direct disk blocks. */ + ufs2_daddr_t di_ib[NIADDR]; /* 208: Indirect disk blocks. */ + grub_int64_t di_spare[3]; /* 232: Reserved; currently unused */ +}; + +#define MAXNAMLEN 255 + +struct direct { + grub_u_int32_t d_ino; /* inode number of entry */ + grub_u_int16_t d_reclen; /* length of this record */ + grub_u_int8_t d_type; /* file type, see below */ + grub_u_int8_t d_namlen; /* length of string in d_name */ + char d_name[MAXNAMLEN + 1];/* name with length <= MAXNAMLEN */ +}; + +/* + * File types + */ +#define DT_UNKNOWN 0 +#define DT_FIFO 1 +#define DT_CHR 2 +#define DT_DIR 4 +#define DT_BLK 6 +#define DT_REG 8 +#define DT_LNK 10 +#define DT_SOCK 12 +#define DT_WHT 14 + +/* + * Superblock offsets + */ +#define SBLOCK_FLOPPY 0 +#define SBLOCK_UFS1 8192 +#define SBLOCK_UFS2 65536 +#define SBLOCK_PIGGY 262144 +#define SBLOCKSIZE 8192 +#define SBLOCKSEARCH \ + { SBLOCK_UFS2, SBLOCK_UFS1, SBLOCK_FLOPPY, SBLOCK_PIGGY, -1 } + +#define MAXMNTLEN 512 + +#define NOCSPTRS ((128 / sizeof(void *)) - 4) + +/* + * The maximum number of snapshot nodes that can be associated + * with each filesystem. This limit affects only the number of + * snapshot files that can be recorded within the superblock so + * that they can be found when the filesystem is mounted. However, + * maintaining too many will slow the filesystem performance, so + * having this limit is a good idea. + */ +#define FSMAXSNAP 20 + +/* + * Per cylinder group information; summarized in blocks allocated + * from first cylinder group data blocks. These blocks have to be + * read in from fs_csaddr (size fs_cssize) in addition to the + * super block. + */ +struct csum { + grub_int32_t cs_ndir; /* number of directories */ + grub_int32_t cs_nbfree; /* number of free blocks */ + grub_int32_t cs_nifree; /* number of free inodes */ + grub_int32_t cs_nffree; /* number of free frags */ +}; + +struct csum_total { + grub_int64_t cs_ndir; /* number of directories */ + grub_int64_t cs_nbfree; /* number of free blocks */ + grub_int64_t cs_nifree; /* number of free inodes */ + grub_int64_t cs_nffree; /* number of free frags */ + grub_int64_t cs_numclusters; /* number of free clusters */ + grub_int64_t cs_spare[3]; /* future expansion */ +}; + +/* + * Super block for an FFS filesystem. + */ +struct fs { + grub_int32_t fs_firstfield; /* historic filesystem linked list, */ + grub_int32_t fs_unused_1; /* used for incore super blocks */ + grub_int32_t fs_sblkno; /* offset of super-block in filesys */ + grub_int32_t fs_cblkno; /* offset of cyl-block in filesys */ + grub_int32_t fs_iblkno; /* offset of inode-blocks in filesys */ + grub_int32_t fs_dblkno; /* offset of first data after cg */ + grub_int32_t fs_old_cgoffset; /* cylinder group offset in cylinder */ + grub_int32_t fs_old_cgmask; /* used to calc mod fs_ntrak */ + grub_int32_t fs_old_time; /* last time written */ + grub_int32_t fs_old_size; /* number of blocks in fs */ + grub_int32_t fs_old_dsize; /* number of data blocks in fs */ + grub_int32_t fs_ncg; /* number of cylinder groups */ + grub_int32_t fs_bsize; /* size of basic blocks in fs */ + grub_int32_t fs_fsize; /* size of frag blocks in fs */ + grub_int32_t fs_frag; /* number of frags in a block in fs */ +/* these are configuration parameters */ + grub_int32_t fs_minfree; /* minimum percentage of free blocks */ + grub_int32_t fs_old_rotdelay; /* num of ms for optimal next block */ + grub_int32_t fs_old_rps; /* disk revolutions per second */ +/* these fields can be computed from the others */ + grub_int32_t fs_bmask; /* ``blkoff'' calc of blk offsets */ + grub_int32_t fs_fmask; /* ``fragoff'' calc of frag offsets */ + grub_int32_t fs_bshift; /* ``lblkno'' calc of logical blkno */ + grub_int32_t fs_fshift; /* ``numfrags'' calc number of frags */ +/* these are configuration parameters */ + grub_int32_t fs_maxcontig; /* max number of contiguous blks */ + grub_int32_t fs_maxbpg; /* max number of blks per cyl group */ +/* these fields can be computed from the others */ + grub_int32_t fs_fragshift; /* block to frag shift */ + grub_int32_t fs_fsbtodb; /* fsbtodb and dbtofsb shift constant */ + grub_int32_t fs_sbsize; /* actual size of super block */ + grub_int32_t fs_spare1[2]; /* old fs_csmask */ + /* old fs_csshift */ + grub_int32_t fs_nindir; /* value of NINDIR */ + grub_int32_t fs_inopb; /* value of INOPB */ + grub_int32_t fs_old_nspf; /* value of NSPF */ +/* yet another configuration parameter */ + grub_int32_t fs_optim; /* optimization preference, see below */ + grub_int32_t fs_old_npsect; /* # sectors/track including spares */ + grub_int32_t fs_old_interleave; /* hardware sector interleave */ + grub_int32_t fs_old_trackskew; /* sector 0 skew, per track */ + grub_int32_t fs_id[2]; /* unique filesystem id */ +/* sizes determined by number of cylinder groups and their sizes */ + grub_int32_t fs_old_csaddr; /* blk addr of cyl grp summary area */ + grub_int32_t fs_cssize; /* size of cyl grp summary area */ + grub_int32_t fs_cgsize; /* cylinder group size */ + grub_int32_t fs_spare2; /* old fs_ntrak */ + grub_int32_t fs_old_nsect; /* sectors per track */ + grub_int32_t fs_old_spc; /* sectors per cylinder */ + grub_int32_t fs_old_ncyl; /* cylinders in filesystem */ + grub_int32_t fs_old_cpg; /* cylinders per group */ + grub_int32_t fs_ipg; /* inodes per group */ + grub_int32_t fs_fpg; /* blocks per group * fs_frag */ +/* this data must be re-computed after crashes */ + struct csum fs_old_cstotal; /* cylinder summary information */ +/* these fields are cleared at mount time */ + grub_int8_t fs_fmod; /* super block modified flag */ + grub_int8_t fs_clean; /* filesystem is clean flag */ + grub_int8_t fs_ronly; /* mounted read-only flag */ + grub_int8_t fs_old_flags; /* old FS_ flags */ + grub_u_char fs_fsmnt[MAXMNTLEN]; /* name mounted on */ +/* these fields retain the current block allocation info */ + grub_int32_t fs_cgrotor; /* last cg searched */ + void *fs_ocsp[NOCSPTRS]; /* padding; was list of fs_cs buffers */ + grub_u_int8_t *fs_contigdirs; /* # of contiguously allocated dirs */ + struct csum *fs_csp; /* cg summary info buffer for fs_cs */ + grub_int32_t *fs_maxcluster; /* max cluster in each cyl group */ + grub_u_int *fs_active; /* used by snapshots to track fs */ + grub_int32_t fs_old_cpc; /* cyl per cycle in postbl */ + grub_int32_t fs_maxbsize; /* maximum blocking factor permitted */ + grub_int64_t fs_sparecon64[17]; /* old rotation block list head */ + grub_int64_t fs_sblockloc; /* byte offset of standard superblock */ + struct csum_total fs_cstotal; /* cylinder summary information */ + ufs_time_t fs_time; /* last time written */ + grub_int64_t fs_size; /* number of blocks in fs */ + grub_int64_t fs_dsize; /* number of data blocks in fs */ + ufs2_daddr_t fs_csaddr; /* blk addr of cyl grp summary area */ + grub_int64_t fs_pendingblocks; /* blocks in process of being freed */ + grub_int32_t fs_pendinginodes; /* inodes in process of being freed */ + grub_int32_t fs_snapinum[FSMAXSNAP];/* list of snapshot inode numbers */ + grub_int32_t fs_avgfilesize; /* expected average file size */ + grub_int32_t fs_avgfpdir; /* expected # of files per directory */ + grub_int32_t fs_save_cgsize; /* save real cg size to use fs_bsize */ + grub_int32_t fs_sparecon32[26]; /* reserved for future constants */ + grub_int32_t fs_flags; /* see FS_ flags below */ + grub_int32_t fs_contigsumsize; /* size of cluster summary array */ + grub_int32_t fs_maxsymlinklen; /* max length of an internal symlink */ + grub_int32_t fs_old_inodefmt; /* format of on-disk inodes */ + grub_u_int64_t fs_maxfilesize; /* maximum representable file size */ + grub_int64_t fs_qbmask; /* ~fs_bmask for use with 64-bit size */ + grub_int64_t fs_qfmask; /* ~fs_fmask for use with 64-bit size */ + grub_int32_t fs_state; /* validate fs_clean field */ + grub_int32_t fs_old_postblformat; /* format of positional layout tables */ + grub_int32_t fs_old_nrpos; /* number of rotational positions */ + grub_int32_t fs_spare5[2]; /* old fs_postbloff */ + /* old fs_rotbloff */ + grub_int32_t fs_magic; /* magic number */ +}; + +/* + * Filesystem identification + */ +#define FS_UFS1_MAGIC 0x011954 /* UFS1 fast filesystem magic number */ +#define FS_UFS2_MAGIC 0x19540119 /* UFS2 fast filesystem magic number */ + +/* + * Turn filesystem block numbers into disk block addresses. + * This maps filesystem blocks to device size blocks. + */ +#define fsbtodb(fs, b) ((b) << (fs)->fs_fsbtodb) +#define dbtofsb(fs, b) ((b) >> (fs)->fs_fsbtodb) + +/* + * Cylinder group macros to locate things in cylinder groups. + * They calc filesystem addresses of cylinder group data structures. + */ +#define cgbase(fs, c) ((ufs2_daddr_t)((fs)->fs_fpg * (c))) +#define cgimin(fs, c) (cgstart(fs, c) + (fs)->fs_iblkno) /* inode blk */ +#define cgstart(fs, c) \ + ((fs)->fs_magic == FS_UFS2_MAGIC ? cgbase(fs, c) : \ + (cgbase(fs, c) + (fs)->fs_old_cgoffset * ((c) & ~((fs)->fs_old_cgmask)))) + +/* + * Macros for handling inode numbers: + * inode number to filesystem block offset. + * inode number to cylinder group number. + * inode number to filesystem block address. + */ +#define ino_to_cg(fs, x) ((x) / (fs)->fs_ipg) +#define ino_to_fsba(fs, x) \ + ((ufs2_daddr_t)(cgimin(fs, ino_to_cg(fs, x)) + \ + (blkstofrags((fs), (((x) % (fs)->fs_ipg) / INOPB(fs)))))) +#define ino_to_fsbo(fs, x) ((x) % INOPB(fs)) + +/* + * The following macros optimize certain frequently calculated + * quantities by using shifts and masks in place of divisions + * modulos and multiplications. + */ +#define blkoff(fs, loc) /* calculates (loc % fs->fs_bsize) */ \ + ((loc) & (fs)->fs_qbmask) + +/* Use this only when `blk' is known to be small, e.g., < NDADDR. */ +#define smalllblktosize(fs, blk) /* calculates (blk * fs->fs_bsize) */ \ + ((blk) << (fs)->fs_bshift) + + +#define lblkno(fs, loc) /* calculates (loc / fs->fs_bsize) */ \ + ((loc) >> (fs)->fs_bshift) + +#define fragroundup(fs, size) /* calculates roundup(size, fs->fs_fsize) */ \ + (((size) + (fs)->fs_qfmask) & (fs)->fs_fmask) + +#define fragstoblks(fs, frags) /* calculates (frags / fs->fs_frag) */ \ + ((frags) >> (fs)->fs_fragshift) +#define blkstofrags(fs, blks) /* calculates (blks * fs->fs_frag) */ \ + ((blks) << (fs)->fs_fragshift) +#define fragnum(fs, fsb) /* calculates (fsb % fs->fs_frag) */ \ + ((fsb) & ((fs)->fs_frag - 1)) +#define blknum(fs, fsb) /* calculates rounddown(fsb, fs->fs_frag) */ \ + ((fsb) &~ ((fs)->fs_frag - 1)) + +/* + * Determining the size of a file block in the filesystem. + */ +#define blksize(fs, ip, lbn) \ + (((lbn) >= NDADDR || (ip)->i_size >= smalllblktosize(fs, (lbn) + 1)) \ + ? (fs)->fs_bsize \ + : (fragroundup(fs, blkoff(fs, (ip)->i_size)))) +#define sblksize(fs, size, lbn) \ + (((lbn) >= NDADDR || (size) >= ((lbn) + 1) << (fs)->fs_bshift) \ + ? (fs)->fs_bsize \ + : (fragroundup(fs, blkoff(fs, (size))))) + + +/* + * Number of inodes in a secondary storage block/fragment. + */ +#define INOPB(fs) ((fs)->fs_inopb) +#define INOPF(fs) ((fs)->fs_inopb >> (fs)->fs_fragshift) + +/* + * Number of indirects in a filesystem block. + */ +#define NINDIR(fs) ((fs)->fs_nindir) + +#define FS_UNCLEAN 0x01 /* filesystem not clean at mount */ +#define FS_DOSOFTDEP 0x02 /* filesystem using soft dependencies */ +#define FS_NEEDSFSCK 0x04 /* filesystem needs sync fsck before mount */ +#define FS_INDEXDIRS 0x08 /* kernel supports indexed directories */ +#define FS_ACLS 0x10 /* file system has ACLs enabled */ +#define FS_MULTILABEL 0x20 /* file system is MAC multi-label */ +#define FS_FLAGS_UPDATED 0x80 /* flags have been moved to new location */ + +#endif /* _GRUB_UFS2_H_ */ diff --git a/usr/src/grub/grub-0.97/stage2/vstafs.h b/usr/src/grub/grub-0.97/stage2/vstafs.h new file mode 100644 index 0000000000..cc7820cbca --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/vstafs.h @@ -0,0 +1,88 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2001 Free Software Foundation, 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 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 VSTAFS_H +#define VSTAFS_H 1 + + +#define LINE 16 +#define BLOCK_SIZE 512 +#define VSTAFS_START_DATA 320 + +struct bootrecord +{ + unsigned char flag; + unsigned char s_sector; + unsigned char s_head; + unsigned char s_cylinder; + unsigned char p_type; + unsigned char e_sector; + unsigned char e_head; + unsigned char e_cylinder; + unsigned long start_lba; + unsigned long nr_sector_lba; +}; + +struct alloc +{ + unsigned long a_start; + unsigned long a_len; +}; + +struct first_sector +{ + unsigned long fs_magic; + unsigned long fs_size; + unsigned long fs_extsize; + unsigned long fs_free; + struct alloc fs_freesecs[0]; +}; + +struct prot +{ + unsigned char len; + unsigned char pdefault; + unsigned char id[7]; + unsigned char bits[7]; +}; + +struct fs_file +{ + unsigned long prev; + unsigned long rev; + unsigned long len; + unsigned short type; + unsigned short nlink; + struct prot pprot; + unsigned int owner; + unsigned int extents; + struct alloc blocks[32]; + long fs_ctime, fs_mtime; /* it is not lon but time_t */ + char pad[16]; + char data[0]; +}; + +struct dir_entry +{ + char name[28]; + unsigned long start; +}; + +#endif /* ! VSTAFS_H */ diff --git a/usr/src/grub/grub-0.97/stage2/xfs.h b/usr/src/grub/grub-0.97/stage2/xfs.h new file mode 100644 index 0000000000..02f8dcd1a2 --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/xfs.h @@ -0,0 +1,544 @@ +/* xfs.h - an extraction from xfsprogs-1.3.5/include/xfs* into one file */ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2000 Silicon Graphics, Inc. All Rights Reserved. + * Copyright (C) 2001,2004 Free Software Foundation, Inc. + * + * 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. + * + * 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. + * + * Further, this software is distributed without any warranty that it is + * free of the rightful claim of any third person regarding infringement + * or the like. Any license provided herein, whether implied or + * otherwise, applies only to this software file. Patent licenses, if + * any, provided herein do not apply to combinations of this program with + * other software, or any other product whatsoever. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write the Free Software Foundation, Inc., 59 + * Temple Place - Suite 330, Boston MA 02111-1307, USA. + * + * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, + * Mountain View, CA 94043, or: + * + * http://www.sgi.com + * + * For further information regarding this notice, see: + * + * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ + */ + +typedef signed char xfs_int8_t; +typedef unsigned char xfs_uint8_t; +typedef short xfs_int16_t; +typedef unsigned short xfs_uint16_t; +typedef int xfs_int32_t; +typedef unsigned int xfs_uint32_t; +typedef long long xfs_int64_t; +typedef unsigned long long xfs_uint64_t; + +typedef xfs_uint64_t xfs_ino_t; +typedef xfs_uint32_t xfs_agino_t; +typedef xfs_int64_t xfs_daddr_t; +typedef xfs_int64_t xfs_off_t; +typedef xfs_uint8_t uuid_t[16]; + + +/* those are from xfs_types.h */ + +typedef xfs_uint32_t xfs_agblock_t; /* blockno in alloc. group */ +typedef xfs_uint32_t xfs_extlen_t; /* extent length in blocks */ +typedef xfs_uint32_t xfs_agnumber_t; /* allocation group number */ +typedef xfs_int32_t xfs_extnum_t; /* # of extents in a file */ +typedef xfs_int16_t xfs_aextnum_t; /* # extents in an attribute fork */ +typedef xfs_int64_t xfs_fsize_t; /* bytes in a file */ + +typedef xfs_uint32_t xfs_dablk_t; /* dir/attr block number (in file) */ +typedef xfs_uint32_t xfs_dahash_t; /* dir/attr hash value */ + +/* + * Disk based types: + */ +typedef xfs_uint64_t xfs_dfsbno_t; /* blockno in filesystem (agno|agbno) */ +typedef xfs_uint64_t xfs_drfsbno_t; /* blockno in filesystem (raw) */ +typedef xfs_uint64_t xfs_drtbno_t; /* extent (block) in realtime area */ +typedef xfs_uint64_t xfs_dfiloff_t; /* block number in a file */ + +typedef xfs_uint64_t xfs_fsblock_t; /* blockno in filesystem (agno|agbno) */ +typedef xfs_uint64_t xfs_fileoff_t; /* block number in a file */ +typedef xfs_uint64_t xfs_filblks_t; /* number of blocks in a file */ + + +/* those are from xfs_sb.h */ + +#define XFS_SB_MAGIC 0x58465342 /* 'XFSB'*/ +#define XFS_SB_VERSION_4 4 /* 6.2+ - bitmask version */ +#define XFS_SB_VERSION_NUMBITS 0x000f + +typedef struct xfs_sb +{ + xfs_uint32_t sb_magicnum; /* magic number == XFS_SB_MAGIC */ + xfs_uint32_t sb_blocksize; /* logical block size, bytes */ + xfs_drfsbno_t sb_dblocks; /* number of data blocks */ + xfs_drfsbno_t sb_rblocks; /* number of realtime blocks */ + xfs_drtbno_t sb_rextents; /* number of realtime extents */ + uuid_t sb_uuid; /* file system unique id */ + xfs_dfsbno_t sb_logstart; /* starting block of log if internal */ + xfs_ino_t sb_rootino; /* root inode number */ + xfs_ino_t sb_rbmino; /* bitmap inode for realtime extents */ + xfs_ino_t sb_rsumino; /* summary inode for rt bitmap */ + xfs_agblock_t sb_rextsize; /* realtime extent size, blocks */ + xfs_agblock_t sb_agblocks; /* size of an allocation group */ + xfs_agnumber_t sb_agcount; /* number of allocation groups */ + xfs_extlen_t sb_rbmblocks; /* number of rt bitmap blocks */ + xfs_extlen_t sb_logblocks; /* number of log blocks */ + xfs_uint16_t sb_versionnum; /* header version == XFS_SB_VERSION */ + xfs_uint16_t sb_sectsize; /* volume sector size, bytes */ + xfs_uint16_t sb_inodesize; /* inode size, bytes */ + xfs_uint16_t sb_inopblock; /* inodes per block */ + char sb_fname[12]; /* file system name */ + xfs_uint8_t sb_blocklog; /* log2 of sb_blocksize */ + xfs_uint8_t sb_sectlog; /* log2 of sb_sectsize */ + xfs_uint8_t sb_inodelog; /* log2 of sb_inodesize */ + xfs_uint8_t sb_inopblog; /* log2 of sb_inopblock */ + xfs_uint8_t sb_agblklog; /* log2 of sb_agblocks (rounded up) */ + xfs_uint8_t sb_rextslog; /* log2 of sb_rextents */ + xfs_uint8_t sb_inprogress; /* mkfs is in progress, don't mount */ + xfs_uint8_t sb_imax_pct; /* max % of fs for inode space */ + /* statistics */ + /* + * These fields must remain contiguous. If you really + * want to change their layout, make sure you fix the + * code in xfs_trans_apply_sb_deltas(). + */ + xfs_uint64_t sb_icount; /* allocated inodes */ + xfs_uint64_t sb_ifree; /* free inodes */ + xfs_uint64_t sb_fdblocks; /* free data blocks */ + xfs_uint64_t sb_frextents; /* free realtime extents */ + /* + * End contiguous fields. + */ + xfs_ino_t sb_uquotino; /* user quota inode */ + xfs_ino_t sb_gquotino; /* group quota inode */ + xfs_uint16_t sb_qflags; /* quota flags */ + xfs_uint8_t sb_flags; /* misc. flags */ + xfs_uint8_t sb_shared_vn; /* shared version number */ + xfs_extlen_t sb_inoalignmt; /* inode chunk alignment, fsblocks */ + xfs_uint32_t sb_unit; /* stripe or raid unit */ + xfs_uint32_t sb_width; /* stripe or raid width */ + xfs_uint8_t sb_dirblklog; /* log2 of dir block size (fsbs) */ + xfs_uint8_t sb_dummy[7]; /* padding */ +} xfs_sb_t; + + +/* those are from xfs_btree.h */ + +/* + * Long form header: bmap btrees. + */ +typedef struct xfs_btree_lblock +{ + xfs_uint32_t bb_magic; /* magic number for block type */ + xfs_uint16_t bb_level; /* 0 is a leaf */ + xfs_uint16_t bb_numrecs; /* current # of data records */ + xfs_dfsbno_t bb_leftsib; /* left sibling block or NULLDFSBNO */ + xfs_dfsbno_t bb_rightsib; /* right sibling block or NULLDFSBNO */ +} xfs_btree_lblock_t; + +/* + * Combined header and structure, used by common code. + */ +typedef struct xfs_btree_hdr +{ + xfs_uint32_t bb_magic; /* magic number for block type */ + xfs_uint16_t bb_level; /* 0 is a leaf */ + xfs_uint16_t bb_numrecs; /* current # of data records */ +} xfs_btree_hdr_t; + +typedef struct xfs_btree_block +{ + xfs_btree_hdr_t bb_h; /* header */ + union { + struct { + xfs_agblock_t bb_leftsib; + xfs_agblock_t bb_rightsib; + } s; /* short form pointers */ + struct { + xfs_dfsbno_t bb_leftsib; + xfs_dfsbno_t bb_rightsib; + } l; /* long form pointers */ + } bb_u; /* rest */ +} xfs_btree_block_t; + +/* those are from xfs_bmap_btree.h */ + +/* + * Bmap root header, on-disk form only. + */ +typedef struct xfs_bmdr_block +{ + xfs_uint16_t bb_level; /* 0 is a leaf */ + xfs_uint16_t bb_numrecs; /* current # of data records */ +} xfs_bmdr_block_t; + +/* + * Bmap btree record and extent descriptor. + * For 32-bit kernels, + * l0:31 is an extent flag (value 1 indicates non-normal). + * l0:0-30 and l1:9-31 are startoff. + * l1:0-8, l2:0-31, and l3:21-31 are startblock. + * l3:0-20 are blockcount. + * For 64-bit kernels, + * l0:63 is an extent flag (value 1 indicates non-normal). + * l0:9-62 are startoff. + * l0:0-8 and l1:21-63 are startblock. + * l1:0-20 are blockcount. + */ + +#define BMBT_USE_64 1 + +typedef struct xfs_bmbt_rec_32 +{ + xfs_uint32_t l0, l1, l2, l3; +} xfs_bmbt_rec_32_t; +typedef struct xfs_bmbt_rec_64 +{ + xfs_uint64_t l0, l1; +} xfs_bmbt_rec_64_t; + +#if BMBT_USE_64 +typedef xfs_uint64_t xfs_bmbt_rec_base_t; /* use this for casts */ +typedef xfs_bmbt_rec_64_t xfs_bmbt_rec_t, xfs_bmdr_rec_t; +#else /* !BMBT_USE_64 */ +typedef xfs_uint32_t xfs_bmbt_rec_base_t; /* use this for casts */ +typedef xfs_bmbt_rec_32_t xfs_bmbt_rec_t, xfs_bmdr_rec_t; +#endif /* BMBT_USE_64 */ + +/* + * Key structure for non-leaf levels of the tree. + */ +typedef struct xfs_bmbt_key +{ + xfs_dfiloff_t br_startoff; /* starting file offset */ +} xfs_bmbt_key_t, xfs_bmdr_key_t; + +typedef xfs_dfsbno_t xfs_bmbt_ptr_t, xfs_bmdr_ptr_t; /* btree pointer type */ + /* btree block header type */ +typedef struct xfs_btree_lblock xfs_bmbt_block_t; + + +/* those are from xfs_dir2.h */ +/* + * Directory version 2. + * There are 4 possible formats: + * shortform + * single block - data with embedded leaf at the end + * multiple data blocks, single leaf+freeindex block + * data blocks, node&leaf blocks (btree), freeindex blocks + * + * The shortform format is in xfs_dir2_sf.h. + * The single block format is in xfs_dir2_block.h. + * The data block format is in xfs_dir2_data.h. + * The leaf and freeindex block formats are in xfs_dir2_leaf.h. + * Node blocks are the same as the other version, in xfs_da_btree.h. + */ + +/* + * Byte offset in data block and shortform entry. + */ +typedef xfs_uint16_t xfs_dir2_data_off_t; + +/* + * Byte offset in a directory. + */ +typedef xfs_off_t xfs_dir2_off_t; + +/* those are from xfs_da_btree.h */ +/*======================================================================== + * Directory Structure when greater than XFS_LBSIZE(mp) bytes. + *========================================================================*/ + +/* + * This structure is common to both leaf nodes and non-leaf nodes in the Btree. + * + * Is is used to manage a doubly linked list of all blocks at the same + * level in the Btree, and to identify which type of block this is. + */ +#define XFS_DIR2_LEAF1_MAGIC 0xd2f1 /* magic number: v2 dirlf single blks */ +#define XFS_DIR2_LEAFN_MAGIC 0xd2ff /* magic number: v2 dirlf multi blks */ + +typedef struct xfs_da_blkinfo { + xfs_dablk_t forw; /* previous block in list */ + xfs_dablk_t back; /* following block in list */ + xfs_uint16_t magic; /* validity check on block */ + xfs_uint16_t pad; /* unused */ +} xfs_da_blkinfo_t; + +/* + * This is the structure of the root and intermediate nodes in the Btree. + * The leaf nodes are defined above. + * + * Entries are not packed. + * + * Since we have duplicate keys, use a binary search but always follow + * all match in the block, not just the first match found. + */ + +typedef struct xfs_da_intnode { + struct xfs_da_node_hdr { /* constant-structure header block */ + xfs_da_blkinfo_t info; /* block type, links, etc. */ + xfs_uint16_t count; /* count of active entries */ + xfs_uint16_t level; /* level above leaves (leaf == 0) */ + } hdr; + struct xfs_da_node_entry { + xfs_dahash_t hashval; /* hash value for this descendant */ + xfs_dablk_t before; /* Btree block before this key */ + } btree[1]; /* variable sized array of keys */ +} xfs_da_intnode_t; + + +/* those are from xfs_dir2_data.h */ +/* + * Directory format 2, data block structures. + */ + +/* + * Constants. + */ +#define XFS_DIR2_DATA_FREE_TAG 0xffff +#define XFS_DIR2_DATA_FD_COUNT 3 + +/* + * Structures. + */ + +/* + * Describe a free area in the data block. + * The freespace will be formatted as a xfs_dir2_data_unused_t. + */ +typedef struct xfs_dir2_data_free { + xfs_dir2_data_off_t offset; /* start of freespace */ + xfs_dir2_data_off_t length; /* length of freespace */ +} xfs_dir2_data_free_t; + +/* + * Header for the data blocks. + * Always at the beginning of a directory-sized block. + * The code knows that XFS_DIR2_DATA_FD_COUNT is 3. + */ +typedef struct xfs_dir2_data_hdr { + xfs_uint32_t magic; /* XFS_DIR2_DATA_MAGIC */ + /* or XFS_DIR2_BLOCK_MAGIC */ + xfs_dir2_data_free_t bestfree[XFS_DIR2_DATA_FD_COUNT]; +} xfs_dir2_data_hdr_t; + +/* + * Active entry in a data block. Aligned to 8 bytes. + * Tag appears as the last 2 bytes. + */ +typedef struct xfs_dir2_data_entry { + xfs_ino_t inumber; /* inode number */ + xfs_uint8_t namelen; /* name length */ + xfs_uint8_t name[1]; /* name bytes, no null */ + /* variable offset */ + xfs_dir2_data_off_t tag; /* starting offset of us */ +} xfs_dir2_data_entry_t; + +/* + * Unused entry in a data block. Aligned to 8 bytes. + * Tag appears as the last 2 bytes. + */ +typedef struct xfs_dir2_data_unused { + xfs_uint16_t freetag; /* XFS_DIR2_DATA_FREE_TAG */ + xfs_dir2_data_off_t length; /* total free length */ + /* variable offset */ + xfs_dir2_data_off_t tag; /* starting offset of us */ +} xfs_dir2_data_unused_t; + +typedef union { + xfs_dir2_data_entry_t entry; + xfs_dir2_data_unused_t unused; +} xfs_dir2_data_union_t; + + +/* those are from xfs_dir2_leaf.h */ +/* + * Directory version 2, leaf block structures. + */ + +/* + * Leaf block header. + */ +typedef struct xfs_dir2_leaf_hdr { + xfs_da_blkinfo_t info; /* header for da routines */ + xfs_uint16_t count; /* count of entries */ + xfs_uint16_t stale; /* count of stale entries */ +} xfs_dir2_leaf_hdr_t; + + +/* those are from xfs_dir2_block.h */ +/* + * xfs_dir2_block.h + * Directory version 2, single block format structures + */ + +/* + * The single block format is as follows: + * xfs_dir2_data_hdr_t structure + * xfs_dir2_data_entry_t and xfs_dir2_data_unused_t structures + * xfs_dir2_leaf_entry_t structures + * xfs_dir2_block_tail_t structure + */ + +#define XFS_DIR2_BLOCK_MAGIC 0x58443242 /* XD2B: for one block dirs */ + +typedef struct xfs_dir2_block_tail { + xfs_uint32_t count; /* count of leaf entries */ + xfs_uint32_t stale; /* count of stale lf entries */ +} xfs_dir2_block_tail_t; + + +/* those are from xfs_dir2_sf.h */ + +/* + * Directory layout when stored internal to an inode. + * + * Small directories are packed as tightly as possible so as to + * fit into the literal area of the inode. + */ + +/* + * Inode number stored as 8 8-bit values. + */ +typedef struct { xfs_uint8_t i[8]; } xfs_dir2_ino8_t; + +/* + * Inode number stored as 4 8-bit values. + * Works a lot of the time, when all the inode numbers in a directory + * fit in 32 bits. + */ +typedef struct { xfs_uint8_t i[4]; } xfs_dir2_ino4_t; + +typedef union { + xfs_dir2_ino8_t i8; + xfs_dir2_ino4_t i4; +} xfs_dir2_inou_t; + +/* + * Normalized offset (in a data block) of the entry, really xfs_dir2_data_off_t. + * Only need 16 bits, this is the byte offset into the single block form. + */ +typedef struct { xfs_uint8_t i[2]; } xfs_dir2_sf_off_t; + +/* + * The parent directory has a dedicated field, and the self-pointer must + * be calculated on the fly. + * + * Entries are packed toward the top as tightly as possible. The header + * and the elements must be bcopy()'d out into a work area to get correct + * alignment for the inode number fields. + */ +typedef struct xfs_dir2_sf_hdr { + xfs_uint8_t count; /* count of entries */ + xfs_uint8_t i8count; /* count of 8-byte inode #s */ + xfs_dir2_inou_t parent; /* parent dir inode number */ +} xfs_dir2_sf_hdr_t; + +typedef struct xfs_dir2_sf_entry { + xfs_uint8_t namelen; /* actual name length */ + xfs_dir2_sf_off_t offset; /* saved offset */ + xfs_uint8_t name[1]; /* name, variable size */ + xfs_dir2_inou_t inumber; /* inode number, var. offset */ +} xfs_dir2_sf_entry_t; + +typedef struct xfs_dir2_sf { + xfs_dir2_sf_hdr_t hdr; /* shortform header */ + xfs_dir2_sf_entry_t list[1]; /* shortform entries */ +} xfs_dir2_sf_t; + +/* those are from xfs_dinode.h */ + +#define XFS_DINODE_VERSION_1 1 +#define XFS_DINODE_VERSION_2 2 +#define XFS_DINODE_MAGIC 0x494e /* 'IN' */ + +/* + * Disk inode structure. + * This is just the header; the inode is expanded to fill a variable size + * with the last field expanding. It is split into the core and "other" + * because we only need the core part in the in-core inode. + */ +typedef struct xfs_timestamp { + xfs_int32_t t_sec; /* timestamp seconds */ + xfs_int32_t t_nsec; /* timestamp nanoseconds */ +} xfs_timestamp_t; + +/* + * Note: Coordinate changes to this structure with the XFS_DI_* #defines + * below and the offsets table in xfs_ialloc_log_di(). + */ +typedef struct xfs_dinode_core +{ + xfs_uint16_t di_magic; /* inode magic # = XFS_DINODE_MAGIC */ + xfs_uint16_t di_mode; /* mode and type of file */ + xfs_int8_t di_version; /* inode version */ + xfs_int8_t di_format; /* format of di_c data */ + xfs_uint16_t di_onlink; /* old number of links to file */ + xfs_uint32_t di_uid; /* owner's user id */ + xfs_uint32_t di_gid; /* owner's group id */ + xfs_uint32_t di_nlink; /* number of links to file */ + xfs_uint16_t di_projid; /* owner's project id */ + xfs_uint8_t di_pad[10]; /* unused, zeroed space */ + xfs_timestamp_t di_atime; /* time last accessed */ + xfs_timestamp_t di_mtime; /* time last modified */ + xfs_timestamp_t di_ctime; /* time created/inode modified */ + xfs_fsize_t di_size; /* number of bytes in file */ + xfs_drfsbno_t di_nblocks; /* # of direct & btree blocks used */ + xfs_extlen_t di_extsize; /* basic/minimum extent size for file */ + xfs_extnum_t di_nextents; /* number of extents in data fork */ + xfs_aextnum_t di_anextents; /* number of extents in attribute fork*/ + xfs_uint8_t di_forkoff; /* attr fork offs, <<3 for 64b align */ + xfs_int8_t di_aformat; /* format of attr fork's data */ + xfs_uint32_t di_dmevmask; /* DMIG event mask */ + xfs_uint16_t di_dmstate; /* DMIG state info */ + xfs_uint16_t di_flags; /* random flags, XFS_DIFLAG_... */ + xfs_uint32_t di_gen; /* generation number */ +} xfs_dinode_core_t; + +typedef struct xfs_dinode +{ + xfs_dinode_core_t di_core; + xfs_agino_t di_next_unlinked;/* agi unlinked list ptr */ + union { + xfs_bmdr_block_t di_bmbt; /* btree root block */ + xfs_bmbt_rec_32_t di_bmx[1]; /* extent list */ + xfs_dir2_sf_t di_dir2sf; /* shortform directory v2 */ + char di_c[1]; /* local contents */ + } di_u; +} xfs_dinode_t; + +/* + * Values for di_format + */ +typedef enum xfs_dinode_fmt +{ + XFS_DINODE_FMT_DEV, /* CHR, BLK: di_dev */ + XFS_DINODE_FMT_LOCAL, /* DIR, REG: di_c */ + /* LNK: di_symlink */ + XFS_DINODE_FMT_EXTENTS, /* DIR, REG, LNK: di_bmx */ + XFS_DINODE_FMT_BTREE, /* DIR, REG, LNK: di_bmbt */ + XFS_DINODE_FMT_UUID /* MNT: di_uuid */ +} xfs_dinode_fmt_t; + +/* + * File types (mode field) + */ +#define IFMT 0170000 /* type of file */ +#define IFDIR 0040000 /* directory */ +#define IFREG 0100000 /* regular */ +#define IFLNK 0120000 /* symbolic link */ diff --git a/usr/src/grub/grub-0.97/stage2/zfs-include/dmu.h b/usr/src/grub/grub-0.97/stage2/zfs-include/dmu.h new file mode 100644 index 0000000000..3b18d8ada5 --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/zfs-include/dmu.h @@ -0,0 +1,107 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, 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 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. + */ +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _SYS_DMU_H +#define _SYS_DMU_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +/* + * This file describes the interface that the DMU provides for its + * consumers. + * + * The DMU also interacts with the SPA. That interface is described in + * dmu_spa.h. + */ +typedef enum dmu_object_type { + DMU_OT_NONE, + /* general: */ + DMU_OT_OBJECT_DIRECTORY, /* ZAP */ + DMU_OT_OBJECT_ARRAY, /* UINT64 */ + DMU_OT_PACKED_NVLIST, /* UINT8 (XDR by nvlist_pack/unpack) */ + DMU_OT_PACKED_NVLIST_SIZE, /* UINT64 */ + DMU_OT_BPLIST, /* UINT64 */ + DMU_OT_BPLIST_HDR, /* UINT64 */ + /* spa: */ + DMU_OT_SPACE_MAP_HEADER, /* UINT64 */ + DMU_OT_SPACE_MAP, /* UINT64 */ + /* zil: */ + DMU_OT_INTENT_LOG, /* UINT64 */ + /* dmu: */ + DMU_OT_DNODE, /* DNODE */ + DMU_OT_OBJSET, /* OBJSET */ + /* dsl: */ + DMU_OT_DSL_DIR, /* UINT64 */ + DMU_OT_DSL_DIR_CHILD_MAP, /* ZAP */ + DMU_OT_DSL_DS_SNAP_MAP, /* ZAP */ + DMU_OT_DSL_PROPS, /* ZAP */ + DMU_OT_DSL_DATASET, /* UINT64 */ + /* zpl: */ + DMU_OT_ZNODE, /* ZNODE */ + DMU_OT_ACL, /* ACL */ + DMU_OT_PLAIN_FILE_CONTENTS, /* UINT8 */ + DMU_OT_DIRECTORY_CONTENTS, /* ZAP */ + DMU_OT_MASTER_NODE, /* ZAP */ + DMU_OT_UNLINKED_SET, /* ZAP */ + /* zvol: */ + DMU_OT_ZVOL, /* UINT8 */ + DMU_OT_ZVOL_PROP, /* ZAP */ + /* other; for testing only! */ + DMU_OT_PLAIN_OTHER, /* UINT8 */ + DMU_OT_UINT64_OTHER, /* UINT64 */ + DMU_OT_ZAP_OTHER, /* ZAP */ + /* new object types: */ + DMU_OT_ERROR_LOG, /* ZAP */ + DMU_OT_SPA_HISTORY, /* UINT8 */ + DMU_OT_SPA_HISTORY_OFFSETS, /* spa_his_phys_t */ + DMU_OT_POOL_PROPS, /* ZAP */ + + DMU_OT_NUMTYPES +} dmu_object_type_t; + +typedef enum dmu_objset_type { + DMU_OST_NONE, + DMU_OST_META, + DMU_OST_ZFS, + DMU_OST_ZVOL, + DMU_OST_OTHER, /* For testing only! */ + DMU_OST_ANY, /* Be careful! */ + DMU_OST_NUMTYPES +} dmu_objset_type_t; + +/* + * The names of zap entries in the DIRECTORY_OBJECT of the MOS. + */ +#define DMU_POOL_DIRECTORY_OBJECT 1 +#define DMU_POOL_CONFIG "config" +#define DMU_POOL_ROOT_DATASET "root_dataset" +#define DMU_POOL_SYNC_BPLIST "sync_bplist" +#define DMU_POOL_ERRLOG_SCRUB "errlog_scrub" +#define DMU_POOL_ERRLOG_LAST "errlog_last" +#define DMU_POOL_SPARES "spares" +#define DMU_POOL_DEFLATE "deflate" +#define DMU_POOL_HISTORY "history" +#define DMU_POOL_PROPS "pool_props" +#define DMU_POOL_L2CACHE "l2cache" + +#endif /* _SYS_DMU_H */ diff --git a/usr/src/grub/grub-0.97/stage2/zfs-include/dmu_objset.h b/usr/src/grub/grub-0.97/stage2/zfs-include/dmu_objset.h new file mode 100644 index 0000000000..6345c13988 --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/zfs-include/dmu_objset.h @@ -0,0 +1,37 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, 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 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. + */ +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _SYS_DMU_OBJSET_H +#define _SYS_DMU_OBJSET_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +typedef struct objset_phys { + dnode_phys_t os_meta_dnode; + zil_header_t os_zil_header; + uint64_t os_type; + char os_pad[1024 - sizeof (dnode_phys_t) - sizeof (zil_header_t) - + sizeof (uint64_t)]; +} objset_phys_t; + +#endif /* _SYS_DMU_OBJSET_H */ diff --git a/usr/src/grub/grub-0.97/stage2/zfs-include/dnode.h b/usr/src/grub/grub-0.97/stage2/zfs-include/dnode.h new file mode 100644 index 0000000000..80f08fa2ca --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/zfs-include/dnode.h @@ -0,0 +1,78 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, 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 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. + */ +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _SYS_DNODE_H +#define _SYS_DNODE_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +/* + * Fixed constants. + */ +#define DNODE_SHIFT 9 /* 512 bytes */ +#define DN_MIN_INDBLKSHIFT 10 /* 1k */ +#define DN_MAX_INDBLKSHIFT 14 /* 16k */ +#define DNODE_BLOCK_SHIFT 14 /* 16k */ +#define DNODE_CORE_SIZE 64 /* 64 bytes for dnode sans blkptrs */ +#define DN_MAX_OBJECT_SHIFT 48 /* 256 trillion (zfs_fid_t limit) */ +#define DN_MAX_OFFSET_SHIFT 64 /* 2^64 bytes in a dnode */ + +/* + * Derived constants. + */ +#define DNODE_SIZE (1 << DNODE_SHIFT) +#define DN_MAX_NBLKPTR ((DNODE_SIZE - DNODE_CORE_SIZE) >> SPA_BLKPTRSHIFT) +#define DN_MAX_BONUSLEN (DNODE_SIZE - DNODE_CORE_SIZE - (1 << SPA_BLKPTRSHIFT)) +#define DN_MAX_OBJECT (1ULL << DN_MAX_OBJECT_SHIFT) + +#define DNODES_PER_BLOCK_SHIFT (DNODE_BLOCK_SHIFT - DNODE_SHIFT) +#define DNODES_PER_BLOCK (1ULL << DNODES_PER_BLOCK_SHIFT) +#define DNODES_PER_LEVEL_SHIFT (DN_MAX_INDBLKSHIFT - SPA_BLKPTRSHIFT) + +#define DN_BONUS(dnp) ((void*)((dnp)->dn_bonus + \ + (((dnp)->dn_nblkptr - 1) * sizeof (blkptr_t)))) + +typedef struct dnode_phys { + uint8_t dn_type; /* dmu_object_type_t */ + uint8_t dn_indblkshift; /* ln2(indirect block size) */ + uint8_t dn_nlevels; /* 1=dn_blkptr->data blocks */ + uint8_t dn_nblkptr; /* length of dn_blkptr */ + uint8_t dn_bonustype; /* type of data in bonus buffer */ + uint8_t dn_checksum; /* ZIO_CHECKSUM type */ + uint8_t dn_compress; /* ZIO_COMPRESS type */ + uint8_t dn_flags; /* DNODE_FLAG_* */ + uint16_t dn_datablkszsec; /* data block size in 512b sectors */ + uint16_t dn_bonuslen; /* length of dn_bonus */ + uint8_t dn_pad2[4]; + + /* accounting is protected by dn_dirty_mtx */ + uint64_t dn_maxblkid; /* largest allocated block ID */ + uint64_t dn_used; /* bytes (or sectors) of disk space */ + + uint64_t dn_pad3[4]; + + blkptr_t dn_blkptr[1]; + uint8_t dn_bonus[DN_MAX_BONUSLEN]; +} dnode_phys_t; + +#endif /* _SYS_DNODE_H */ diff --git a/usr/src/grub/grub-0.97/stage2/zfs-include/dsl_dataset.h b/usr/src/grub/grub-0.97/stage2/zfs-include/dsl_dataset.h new file mode 100644 index 0000000000..a8c60c4fcc --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/zfs-include/dsl_dataset.h @@ -0,0 +1,55 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, 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 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. + */ +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _SYS_DSL_DATASET_H +#define _SYS_DSL_DATASET_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +typedef struct dsl_dataset_phys { + uint64_t ds_dir_obj; + uint64_t ds_prev_snap_obj; + uint64_t ds_prev_snap_txg; + uint64_t ds_next_snap_obj; + uint64_t ds_snapnames_zapobj; /* zap obj of snaps; ==0 for snaps */ + uint64_t ds_num_children; /* clone/snap children; ==0 for head */ + uint64_t ds_creation_time; /* seconds since 1970 */ + uint64_t ds_creation_txg; + uint64_t ds_deadlist_obj; + uint64_t ds_used_bytes; + uint64_t ds_compressed_bytes; + uint64_t ds_uncompressed_bytes; + uint64_t ds_unique_bytes; /* only relevant to snapshots */ + /* + * The ds_fsid_guid is a 56-bit ID that can change to avoid + * collisions. The ds_guid is a 64-bit ID that will never + * change, so there is a small probability that it will collide. + */ + uint64_t ds_fsid_guid; + uint64_t ds_guid; + uint64_t ds_flags; + blkptr_t ds_bp; + uint64_t ds_pad[8]; /* pad out to 320 bytes for good measure */ +} dsl_dataset_phys_t; + +#endif /* _SYS_DSL_DATASET_H */ diff --git a/usr/src/grub/grub-0.97/stage2/zfs-include/dsl_dir.h b/usr/src/grub/grub-0.97/stage2/zfs-include/dsl_dir.h new file mode 100644 index 0000000000..591e1978c9 --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/zfs-include/dsl_dir.h @@ -0,0 +1,51 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, 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 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. + */ +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _SYS_DSL_DIR_H +#define _SYS_DSL_DIR_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +typedef struct dsl_dir_phys { + uint64_t dd_creation_time; /* not actually used */ + uint64_t dd_head_dataset_obj; + uint64_t dd_parent_obj; + uint64_t dd_clone_parent_obj; + uint64_t dd_child_dir_zapobj; + /* + * how much space our children are accounting for; for leaf + * datasets, == physical space used by fs + snaps + */ + uint64_t dd_used_bytes; + uint64_t dd_compressed_bytes; + uint64_t dd_uncompressed_bytes; + /* Administrative quota setting */ + uint64_t dd_quota; + /* Administrative reservation setting */ + uint64_t dd_reserved; + uint64_t dd_props_zapobj; + uint64_t dd_deleg_zapobj; /* dataset permissions */ + uint64_t dd_pad[20]; /* pad out to 256 bytes for good measure */ +} dsl_dir_phys_t; + +#endif /* _SYS_DSL_DIR_H */ diff --git a/usr/src/grub/grub-0.97/stage2/zfs-include/spa.h b/usr/src/grub/grub-0.97/stage2/zfs-include/spa.h new file mode 100644 index 0000000000..a034e01da4 --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/zfs-include/spa.h @@ -0,0 +1,285 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, 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 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. + */ +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _SYS_SPA_H +#define _SYS_SPA_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +/* + * General-purpose 32-bit and 64-bit bitfield encodings. + */ +#define BF32_DECODE(x, low, len) P2PHASE((x) >> (low), 1U << (len)) +#define BF64_DECODE(x, low, len) P2PHASE((x) >> (low), 1ULL << (len)) +#define BF32_ENCODE(x, low, len) (P2PHASE((x), 1U << (len)) << (low)) +#define BF64_ENCODE(x, low, len) (P2PHASE((x), 1ULL << (len)) << (low)) + +#define BF32_GET(x, low, len) BF32_DECODE(x, low, len) +#define BF64_GET(x, low, len) BF64_DECODE(x, low, len) + +#define BF32_SET(x, low, len, val) \ + ((x) ^= BF32_ENCODE((x >> low) ^ (val), low, len)) +#define BF64_SET(x, low, len, val) \ + ((x) ^= BF64_ENCODE((x >> low) ^ (val), low, len)) + +#define BF32_GET_SB(x, low, len, shift, bias) \ + ((BF32_GET(x, low, len) + (bias)) << (shift)) +#define BF64_GET_SB(x, low, len, shift, bias) \ + ((BF64_GET(x, low, len) + (bias)) << (shift)) + +#define BF32_SET_SB(x, low, len, shift, bias, val) \ + BF32_SET(x, low, len, ((val) >> (shift)) - (bias)) +#define BF64_SET_SB(x, low, len, shift, bias, val) \ + BF64_SET(x, low, len, ((val) >> (shift)) - (bias)) + +/* + * We currently support nine block sizes, from 512 bytes to 128K. + * We could go higher, but the benefits are near-zero and the cost + * of COWing a giant block to modify one byte would become excessive. + */ +#define SPA_MINBLOCKSHIFT 9 +#define SPA_MAXBLOCKSHIFT 17 +#define SPA_MINBLOCKSIZE (1ULL << SPA_MINBLOCKSHIFT) +#define SPA_MAXBLOCKSIZE (1ULL << SPA_MAXBLOCKSHIFT) + +#define SPA_BLOCKSIZES (SPA_MAXBLOCKSHIFT - SPA_MINBLOCKSHIFT + 1) + +/* + * The DVA size encodings for LSIZE and PSIZE support blocks up to 32MB. + * The ASIZE encoding should be at least 64 times larger (6 more bits) + * to support up to 4-way RAID-Z mirror mode with worst-case gang block + * overhead, three DVAs per bp, plus one more bit in case we do anything + * else that expands the ASIZE. + */ +#define SPA_LSIZEBITS 16 /* LSIZE up to 32M (2^16 * 512) */ +#define SPA_PSIZEBITS 16 /* PSIZE up to 32M (2^16 * 512) */ +#define SPA_ASIZEBITS 24 /* ASIZE up to 64 times larger */ + +/* + * All SPA data is represented by 128-bit data virtual addresses (DVAs). + * The members of the dva_t should be considered opaque outside the SPA. + */ +typedef struct dva { + uint64_t dva_word[2]; +} dva_t; + +/* + * Each block has a 256-bit checksum -- strong enough for cryptographic hashes. + */ +typedef struct zio_cksum { + uint64_t zc_word[4]; +} zio_cksum_t; + +/* + * Each block is described by its DVAs, time of birth, checksum, etc. + * The word-by-word, bit-by-bit layout of the blkptr is as follows: + * + * 64 56 48 40 32 24 16 8 0 + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * 0 | vdev1 | GRID | ASIZE | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * 1 |G| offset1 | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * 2 | vdev2 | GRID | ASIZE | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * 3 |G| offset2 | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * 4 | vdev3 | GRID | ASIZE | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * 5 |G| offset3 | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * 6 |E| lvl | type | cksum | comp | PSIZE | LSIZE | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * 7 | padding | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * 8 | padding | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * 9 | padding | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * a | birth txg | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * b | fill count | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * c | checksum[0] | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * d | checksum[1] | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * e | checksum[2] | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * f | checksum[3] | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * + * Legend: + * + * vdev virtual device ID + * offset offset into virtual device + * LSIZE logical size + * PSIZE physical size (after compression) + * ASIZE allocated size (including RAID-Z parity and gang block headers) + * GRID RAID-Z layout information (reserved for future use) + * cksum checksum function + * comp compression function + * G gang block indicator + * E endianness + * type DMU object type + * lvl level of indirection + * birth txg transaction group in which the block was born + * fill count number of non-zero blocks under this bp + * checksum[4] 256-bit checksum of the data this bp describes + */ +typedef struct blkptr { + dva_t blk_dva[3]; /* 128-bit Data Virtual Address */ + uint64_t blk_prop; /* size, compression, type, etc */ + uint64_t blk_pad[3]; /* Extra space for the future */ + uint64_t blk_birth; /* transaction group at birth */ + uint64_t blk_fill; /* fill count */ + zio_cksum_t blk_cksum; /* 256-bit checksum */ +} blkptr_t; + +#define SPA_BLKPTRSHIFT 7 /* blkptr_t is 128 bytes */ +#define SPA_DVAS_PER_BP 3 /* Number of DVAs in a bp */ + +/* + * Macros to get and set fields in a bp or DVA. + */ +#define DVA_GET_ASIZE(dva) \ + BF64_GET_SB((dva)->dva_word[0], 0, 24, SPA_MINBLOCKSHIFT, 0) +#define DVA_SET_ASIZE(dva, x) \ + BF64_SET_SB((dva)->dva_word[0], 0, 24, SPA_MINBLOCKSHIFT, 0, x) + +#define DVA_GET_GRID(dva) BF64_GET((dva)->dva_word[0], 24, 8) +#define DVA_SET_GRID(dva, x) BF64_SET((dva)->dva_word[0], 24, 8, x) + +#define DVA_GET_VDEV(dva) BF64_GET((dva)->dva_word[0], 32, 32) +#define DVA_SET_VDEV(dva, x) BF64_SET((dva)->dva_word[0], 32, 32, x) + +#define DVA_GET_OFFSET(dva) \ + BF64_GET_SB((dva)->dva_word[1], 0, 63, SPA_MINBLOCKSHIFT, 0) +#define DVA_SET_OFFSET(dva, x) \ + BF64_SET_SB((dva)->dva_word[1], 0, 63, SPA_MINBLOCKSHIFT, 0, x) + +#define DVA_GET_GANG(dva) BF64_GET((dva)->dva_word[1], 63, 1) +#define DVA_SET_GANG(dva, x) BF64_SET((dva)->dva_word[1], 63, 1, x) + +#define BP_GET_LSIZE(bp) \ + (BP_IS_HOLE(bp) ? 0 : \ + BF64_GET_SB((bp)->blk_prop, 0, 16, SPA_MINBLOCKSHIFT, 1)) +#define BP_SET_LSIZE(bp, x) \ + BF64_SET_SB((bp)->blk_prop, 0, 16, SPA_MINBLOCKSHIFT, 1, x) + +#define BP_GET_PSIZE(bp) \ + BF64_GET_SB((bp)->blk_prop, 16, 16, SPA_MINBLOCKSHIFT, 1) +#define BP_SET_PSIZE(bp, x) \ + BF64_SET_SB((bp)->blk_prop, 16, 16, SPA_MINBLOCKSHIFT, 1, x) + +#define BP_GET_COMPRESS(bp) BF64_GET((bp)->blk_prop, 32, 8) +#define BP_SET_COMPRESS(bp, x) BF64_SET((bp)->blk_prop, 32, 8, x) + +#define BP_GET_CHECKSUM(bp) BF64_GET((bp)->blk_prop, 40, 8) +#define BP_SET_CHECKSUM(bp, x) BF64_SET((bp)->blk_prop, 40, 8, x) + +#define BP_GET_TYPE(bp) BF64_GET((bp)->blk_prop, 48, 8) +#define BP_SET_TYPE(bp, x) BF64_SET((bp)->blk_prop, 48, 8, x) + +#define BP_GET_LEVEL(bp) BF64_GET((bp)->blk_prop, 56, 5) +#define BP_SET_LEVEL(bp, x) BF64_SET((bp)->blk_prop, 56, 5, x) + +#define BP_GET_BYTEORDER(bp) (0 - BF64_GET((bp)->blk_prop, 63, 1)) +#define BP_SET_BYTEORDER(bp, x) BF64_SET((bp)->blk_prop, 63, 1, x) + +#define BP_GET_ASIZE(bp) \ + (DVA_GET_ASIZE(&(bp)->blk_dva[0]) + DVA_GET_ASIZE(&(bp)->blk_dva[1]) + \ + DVA_GET_ASIZE(&(bp)->blk_dva[2])) + +#define BP_GET_UCSIZE(bp) \ + ((BP_GET_LEVEL(bp) > 0 || dmu_ot[BP_GET_TYPE(bp)].ot_metadata) ? \ + BP_GET_PSIZE(bp) : BP_GET_LSIZE(bp)); + +#define BP_GET_NDVAS(bp) \ + (!!DVA_GET_ASIZE(&(bp)->blk_dva[0]) + \ + !!DVA_GET_ASIZE(&(bp)->blk_dva[1]) + \ + !!DVA_GET_ASIZE(&(bp)->blk_dva[2])) + +#define BP_COUNT_GANG(bp) \ + (DVA_GET_GANG(&(bp)->blk_dva[0]) + \ + DVA_GET_GANG(&(bp)->blk_dva[1]) + \ + DVA_GET_GANG(&(bp)->blk_dva[2])) + +#define DVA_EQUAL(dva1, dva2) \ + ((dva1)->dva_word[1] == (dva2)->dva_word[1] && \ + (dva1)->dva_word[0] == (dva2)->dva_word[0]) + +#define ZIO_CHECKSUM_EQUAL(zc1, zc2) \ + (0 == (((zc1).zc_word[0] - (zc2).zc_word[0]) | \ + ((zc1).zc_word[1] - (zc2).zc_word[1]) | \ + ((zc1).zc_word[2] - (zc2).zc_word[2]) | \ + ((zc1).zc_word[3] - (zc2).zc_word[3]))) + + +#define DVA_IS_VALID(dva) (DVA_GET_ASIZE(dva) != 0) + +#define ZIO_SET_CHECKSUM(zcp, w0, w1, w2, w3) \ +{ \ + (zcp)->zc_word[0] = w0; \ + (zcp)->zc_word[1] = w1; \ + (zcp)->zc_word[2] = w2; \ + (zcp)->zc_word[3] = w3; \ +} + +#define BP_IDENTITY(bp) (&(bp)->blk_dva[0]) +#define BP_IS_GANG(bp) DVA_GET_GANG(BP_IDENTITY(bp)) +#define BP_IS_HOLE(bp) ((bp)->blk_birth == 0) +#define BP_IS_OLDER(bp, txg) (!BP_IS_HOLE(bp) && (bp)->blk_birth < (txg)) + +#define BP_ZERO(bp) \ +{ \ + (bp)->blk_dva[0].dva_word[0] = 0; \ + (bp)->blk_dva[0].dva_word[1] = 0; \ + (bp)->blk_dva[1].dva_word[0] = 0; \ + (bp)->blk_dva[1].dva_word[1] = 0; \ + (bp)->blk_dva[2].dva_word[0] = 0; \ + (bp)->blk_dva[2].dva_word[1] = 0; \ + (bp)->blk_prop = 0; \ + (bp)->blk_pad[0] = 0; \ + (bp)->blk_pad[1] = 0; \ + (bp)->blk_pad[2] = 0; \ + (bp)->blk_birth = 0; \ + (bp)->blk_fill = 0; \ + ZIO_SET_CHECKSUM(&(bp)->blk_cksum, 0, 0, 0, 0); \ +} + +/* + * Note: the byteorder is either 0 or -1, both of which are palindromes. + * This simplifies the endianness handling a bit. + */ +#ifdef _BIG_ENDIAN +#define ZFS_HOST_BYTEORDER (0ULL) +#else +#define ZFS_HOST_BYTEORDER (-1ULL) +#endif + +#define BP_SHOULD_BYTESWAP(bp) (BP_GET_BYTEORDER(bp) != ZFS_HOST_BYTEORDER) + +#define BP_SPRINTF_LEN 320 + +#endif /* _SYS_SPA_H */ diff --git a/usr/src/grub/grub-0.97/stage2/zfs-include/uberblock_impl.h b/usr/src/grub/grub-0.97/stage2/zfs-include/uberblock_impl.h new file mode 100644 index 0000000000..9e70ac0a71 --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/zfs-include/uberblock_impl.h @@ -0,0 +1,51 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, 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 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. + */ +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _SYS_UBERBLOCK_IMPL_H +#define _SYS_UBERBLOCK_IMPL_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +/* + * The uberblock version is incremented whenever an incompatible on-disk + * format change is made to the SPA, DMU, or ZAP. + * + * Note: the first two fields should never be moved. When a storage pool + * is opened, the uberblock must be read off the disk before the version + * can be checked. If the ub_version field is moved, we may not detect + * version mismatch. If the ub_magic field is moved, applications that + * expect the magic number in the first word won't work. + */ +#define UBERBLOCK_MAGIC 0x00bab10c /* oo-ba-bloc! */ +#define UBERBLOCK_SHIFT 10 /* up to 1K */ + +struct uberblock { + uint64_t ub_magic; /* UBERBLOCK_MAGIC */ + uint64_t ub_version; /* ZFS_VERSION */ + uint64_t ub_txg; /* txg of last sync */ + uint64_t ub_guid_sum; /* sum of all vdev guids */ + uint64_t ub_timestamp; /* UTC time of last sync */ + blkptr_t ub_rootbp; /* MOS objset_phys_t */ +}; + +#endif /* _SYS_UBERBLOCK_IMPL_H */ diff --git a/usr/src/grub/grub-0.97/stage2/zfs-include/vdev_impl.h b/usr/src/grub/grub-0.97/stage2/zfs-include/vdev_impl.h new file mode 100644 index 0000000000..93c3689acb --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/zfs-include/vdev_impl.h @@ -0,0 +1,72 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, 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 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. + */ +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _SYS_VDEV_IMPL_H +#define _SYS_VDEV_IMPL_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#define VDEV_SKIP_SIZE (8 << 10) +#define VDEV_BOOT_HEADER_SIZE (8 << 10) +#define VDEV_PHYS_SIZE (112 << 10) +#define VDEV_UBERBLOCK_RING (128 << 10) + +/* ZFS boot block */ +#define VDEV_BOOT_MAGIC 0x2f5b007b10cULL +#define VDEV_BOOT_VERSION 1 /* version number */ + +typedef struct vdev_boot_header { + uint64_t vb_magic; /* VDEV_BOOT_MAGIC */ + uint64_t vb_version; /* VDEV_BOOT_VERSION */ + uint64_t vb_offset; /* start offset (bytes) */ + uint64_t vb_size; /* size (bytes) */ + char vb_pad[VDEV_BOOT_HEADER_SIZE - 4 * sizeof (uint64_t)]; +} vdev_boot_header_t; + +typedef struct vdev_phys { + char vp_nvlist[VDEV_PHYS_SIZE - sizeof (zio_block_tail_t)]; + zio_block_tail_t vp_zbt; +} vdev_phys_t; + +typedef struct vdev_label { + char vl_pad[VDEV_SKIP_SIZE]; /* 8K */ + vdev_boot_header_t vl_boot_header; /* 8K */ + vdev_phys_t vl_vdev_phys; /* 112K */ + char vl_uberblock[VDEV_UBERBLOCK_RING]; /* 128K */ +} vdev_label_t; /* 256K total */ + +/* + * Size and offset of embedded boot loader region on each label. + * The total size of the first two labels plus the boot area is 4MB. + */ +#define VDEV_BOOT_OFFSET (2 * sizeof (vdev_label_t)) +#define VDEV_BOOT_SIZE (7ULL << 19) /* 3.5M */ + +/* + * Size of label regions at the start and end of each leaf device. + */ +#define VDEV_LABEL_START_SIZE (2 * sizeof (vdev_label_t) + VDEV_BOOT_SIZE) +#define VDEV_LABEL_END_SIZE (2 * sizeof (vdev_label_t)) +#define VDEV_LABELS 4 + +#endif /* _SYS_VDEV_IMPL_H */ diff --git a/usr/src/grub/grub-0.97/stage2/zfs-include/zap_impl.h b/usr/src/grub/grub-0.97/stage2/zfs-include/zap_impl.h new file mode 100644 index 0000000000..8ffd8c670d --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/zfs-include/zap_impl.h @@ -0,0 +1,112 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, 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 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. + */ +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _SYS_ZAP_IMPL_H +#define _SYS_ZAP_IMPL_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#define ZAP_MAGIC 0x2F52AB2ABULL + +#define ZAP_HASHBITS 28 +#define MZAP_ENT_LEN 64 +#define MZAP_NAME_LEN (MZAP_ENT_LEN - 8 - 4 - 2) +#define MZAP_MAX_BLKSHIFT SPA_MAXBLOCKSHIFT +#define MZAP_MAX_BLKSZ (1 << MZAP_MAX_BLKSHIFT) + +typedef struct mzap_ent_phys { + uint64_t mze_value; + uint32_t mze_cd; + uint16_t mze_pad; /* in case we want to chain them someday */ + char mze_name[MZAP_NAME_LEN]; +} mzap_ent_phys_t; + +typedef struct mzap_phys { + uint64_t mz_block_type; /* ZBT_MICRO */ + uint64_t mz_salt; + uint64_t mz_pad[6]; + mzap_ent_phys_t mz_chunk[1]; + /* actually variable size depending on block size */ +} mzap_phys_t; + +/* + * The (fat) zap is stored in one object. It is an array of + * 1<= 6] [zap_leaf_t] [ptrtbl] ... + * + */ + +#define ZBT_LEAF ((1ULL << 63) + 0) +#define ZBT_HEADER ((1ULL << 63) + 1) +#define ZBT_MICRO ((1ULL << 63) + 3) +/* any other values are ptrtbl blocks */ + +/* + * the embedded pointer table takes up half a block: + * block size / entry size (2^3) / 2 + */ +#define ZAP_EMBEDDED_PTRTBL_SHIFT(zap) (FZAP_BLOCK_SHIFT(zap) - 3 - 1) + +/* + * The embedded pointer table starts half-way through the block. Since + * the pointer table itself is half the block, it starts at (64-bit) + * word number (1<zap_f.zap_phys) \ + [(idx) + (1<| + * |<-- dnode (192) --->|<----------- "bonus" buffer (320) ---------->| + * |<---- znode (264) ---->|<---- data (56) ---->| + * + * At present, we only use this space to store symbolic links. + */ +} znode_phys_t; + +#endif /* _SYS_FS_ZFS_ZNODE_H */ diff --git a/usr/src/grub/grub-0.97/stage2/zfs-include/zil.h b/usr/src/grub/grub-0.97/stage2/zfs-include/zil.h new file mode 100644 index 0000000000..11ab4b5a3a --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/zfs-include/zil.h @@ -0,0 +1,53 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, 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 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. + */ +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _SYS_ZIL_H +#define _SYS_ZIL_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +/* + * Intent log format: + * + * Each objset has its own intent log. The log header (zil_header_t) + * for objset N's intent log is kept in the Nth object of the SPA's + * intent_log objset. The log header points to a chain of log blocks, + * each of which contains log records (i.e., transactions) followed by + * a log block trailer (zil_trailer_t). The format of a log record + * depends on the record (or transaction) type, but all records begin + * with a common structure that defines the type, length, and txg. + */ + +/* + * Intent log header - this on disk structure holds fields to manage + * the log. All fields are 64 bit to easily handle cross architectures. + */ +typedef struct zil_header { + uint64_t zh_claim_txg; /* txg in which log blocks were claimed */ + uint64_t zh_replay_seq; /* highest replayed sequence number */ + blkptr_t zh_log; /* log chain */ + uint64_t zh_claim_seq; /* highest claimed sequence number */ + uint64_t zh_pad[5]; +} zil_header_t; + +#endif /* _SYS_ZIL_H */ diff --git a/usr/src/grub/grub-0.97/stage2/zfs-include/zio.h b/usr/src/grub/grub-0.97/stage2/zfs-include/zio.h new file mode 100644 index 0000000000..feb030b476 --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/zfs-include/zio.h @@ -0,0 +1,83 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, 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 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. + */ +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _ZIO_H +#define _ZIO_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#define ZBT_MAGIC 0x210da7ab10c7a11ULL /* zio data bloc tail */ + +typedef struct zio_block_tail { + uint64_t zbt_magic; /* for validation, endianness */ + zio_cksum_t zbt_cksum; /* 256-bit checksum */ +} zio_block_tail_t; + +/* + * Gang block headers are self-checksumming and contain an array + * of block pointers. + */ +#define SPA_GANGBLOCKSIZE SPA_MINBLOCKSIZE +#define SPA_GBH_NBLKPTRS ((SPA_GANGBLOCKSIZE - \ + sizeof (zio_block_tail_t)) / sizeof (blkptr_t)) +#define SPA_GBH_FILLER ((SPA_GANGBLOCKSIZE - \ + sizeof (zio_block_tail_t) - \ + (SPA_GBH_NBLKPTRS * sizeof (blkptr_t))) /\ + sizeof (uint64_t)) + +#define ZIO_GET_IOSIZE(zio) \ + (BP_IS_GANG((zio)->io_bp) ? \ + SPA_GANGBLOCKSIZE : BP_GET_PSIZE((zio)->io_bp)) + +typedef struct zio_gbh { + blkptr_t zg_blkptr[SPA_GBH_NBLKPTRS]; + uint64_t zg_filler[SPA_GBH_FILLER]; + zio_block_tail_t zg_tail; +} zio_gbh_phys_t; + +enum zio_checksum { + ZIO_CHECKSUM_INHERIT = 0, + ZIO_CHECKSUM_ON, + ZIO_CHECKSUM_OFF, + ZIO_CHECKSUM_LABEL, + ZIO_CHECKSUM_GANG_HEADER, + ZIO_CHECKSUM_ZILOG, + ZIO_CHECKSUM_FLETCHER_2, + ZIO_CHECKSUM_FLETCHER_4, + ZIO_CHECKSUM_SHA256, + ZIO_CHECKSUM_FUNCTIONS +}; + +#define ZIO_CHECKSUM_ON_VALUE ZIO_CHECKSUM_FLETCHER_2 +#define ZIO_CHECKSUM_DEFAULT ZIO_CHECKSUM_ON + +enum zio_compress { + ZIO_COMPRESS_INHERIT = 0, + ZIO_COMPRESS_ON, + ZIO_COMPRESS_OFF, + ZIO_COMPRESS_LZJB, + ZIO_COMPRESS_EMPTY, + ZIO_COMPRESS_FUNCTIONS +}; + +#endif /* _ZIO_H */ diff --git a/usr/src/grub/grub-0.97/stage2/zfs-include/zio_checksum.h b/usr/src/grub/grub-0.97/stage2/zfs-include/zio_checksum.h new file mode 100644 index 0000000000..a8376d58e3 --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/zfs-include/zio_checksum.h @@ -0,0 +1,44 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, 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 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. + */ +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _SYS_ZIO_CHECKSUM_H +#define _SYS_ZIO_CHECKSUM_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +/* + * Signature for checksum functions. + */ +typedef void zio_checksum_t(const void *data, uint64_t size, zio_cksum_t *zcp); + +/* + * Information about each checksum function. + */ +typedef struct zio_checksum_info { + zio_checksum_t *ci_func[2]; /* checksum function for each byteorder */ + int ci_correctable; /* number of correctable bits */ + int ci_zbt; /* uses zio block tail? */ + char *ci_name; /* descriptive name */ +} zio_checksum_info_t; + +#endif /* _SYS_ZIO_CHECKSUM_H */ diff --git a/usr/src/grub/grub-0.97/stage2/zfs_fletcher.c b/usr/src/grub/grub-0.97/stage2/zfs_fletcher.c new file mode 100644 index 0000000000..34a034efad --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/zfs_fletcher.c @@ -0,0 +1,95 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, 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 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. + */ +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include "fsys_zfs.h" + + +void +fletcher_2_native(const void *buf, uint64_t size, zio_cksum_t *zcp) +{ + const uint64_t *ip = buf; + const uint64_t *ipend = ip + (size / sizeof (uint64_t)); + uint64_t a0, b0, a1, b1; + + for (a0 = b0 = a1 = b1 = 0; ip < ipend; ip += 2) { + a0 += ip[0]; + a1 += ip[1]; + b0 += a0; + b1 += a1; + } + + ZIO_SET_CHECKSUM(zcp, a0, a1, b0, b1); +} + +void +fletcher_2_byteswap(const void *buf, uint64_t size, zio_cksum_t *zcp) +{ + const uint64_t *ip = buf; + const uint64_t *ipend = ip + (size / sizeof (uint64_t)); + uint64_t a0, b0, a1, b1; + + for (a0 = b0 = a1 = b1 = 0; ip < ipend; ip += 2) { + a0 += BSWAP_64(ip[0]); + a1 += BSWAP_64(ip[1]); + b0 += a0; + b1 += a1; + } + + ZIO_SET_CHECKSUM(zcp, a0, a1, b0, b1); +} + +void +fletcher_4_native(const void *buf, uint64_t size, zio_cksum_t *zcp) +{ + const uint32_t *ip = buf; + const uint32_t *ipend = ip + (size / sizeof (uint32_t)); + uint64_t a, b, c, d; + + for (a = b = c = d = 0; ip < ipend; ip++) { + a += ip[0]; + b += a; + c += b; + d += c; + } + + ZIO_SET_CHECKSUM(zcp, a, b, c, d); +} + +void +fletcher_4_byteswap(const void *buf, uint64_t size, zio_cksum_t *zcp) +{ + const uint32_t *ip = buf; + const uint32_t *ipend = ip + (size / sizeof (uint32_t)); + uint64_t a, b, c, d; + + for (a = b = c = d = 0; ip < ipend; ip++) { + a += BSWAP_32(ip[0]); + b += a; + c += b; + d += c; + } + + ZIO_SET_CHECKSUM(zcp, a, b, c, d); +} diff --git a/usr/src/grub/grub-0.97/stage2/zfs_lzjb.c b/usr/src/grub/grub-0.97/stage2/zfs_lzjb.c new file mode 100644 index 0000000000..22df6b2e39 --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/zfs_lzjb.c @@ -0,0 +1,61 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, 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 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. + */ +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include "fsys_zfs.h" + +#define MATCH_BITS 6 +#define MATCH_MIN 3 +#define OFFSET_MASK ((1 << (16 - MATCH_BITS)) - 1) + + +/*ARGSUSED*/ +int +lzjb_decompress(void *s_start, void *d_start, size_t s_len, size_t d_len) +{ + uchar_t *src = s_start; + uchar_t *dst = d_start; + uchar_t *d_end = (uchar_t *)d_start + d_len; + uchar_t *cpy, copymap; + int copymask = 1 << (NBBY - 1); + + while (dst < d_end) { + if ((copymask <<= 1) == (1 << NBBY)) { + copymask = 1; + copymap = *src++; + } + if (copymap & copymask) { + int mlen = (src[0] >> (NBBY - MATCH_BITS)) + MATCH_MIN; + int offset = ((src[0] << NBBY) | src[1]) & OFFSET_MASK; + src += 2; + if ((cpy = dst - offset) < (uchar_t *)d_start) + return (-1); + while (--mlen >= 0 && dst < d_end) + *dst++ = *cpy++; + } else { + *dst++ = *src++; + } + } + return (0); +} diff --git a/usr/src/grub/grub-0.97/stage2/zfs_sha256.c b/usr/src/grub/grub-0.97/stage2/zfs_sha256.c new file mode 100644 index 0000000000..393eaee05b --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/zfs_sha256.c @@ -0,0 +1,126 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, 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 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. + */ +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include "fsys_zfs.h" + +/* + * SHA-256 checksum, as specified in FIPS 180-2, available at: + * http://csrc.nist.gov/cryptval + * + * This is a very compact implementation of SHA-256. + * It is designed to be simple and portable, not to be fast. + */ + +/* + * The literal definitions according to FIPS180-2 would be: + * + * Ch(x, y, z) (((x) & (y)) ^ ((~(x)) & (z))) + * Maj(x, y, z) (((x) & (y)) | ((x) & (z)) | ((y) & (z))) + * + * We use logical equivalents which require one less op. + */ +#define Ch(x, y, z) ((z) ^ ((x) & ((y) ^ (z)))) +#define Maj(x, y, z) (((x) & (y)) ^ ((z) & ((x) ^ (y)))) +#define Rot32(x, s) (((x) >> s) | ((x) << (32 - s))) +#define SIGMA0(x) (Rot32(x, 2) ^ Rot32(x, 13) ^ Rot32(x, 22)) +#define SIGMA1(x) (Rot32(x, 6) ^ Rot32(x, 11) ^ Rot32(x, 25)) +#define sigma0(x) (Rot32(x, 7) ^ Rot32(x, 18) ^ ((x) >> 3)) +#define sigma1(x) (Rot32(x, 17) ^ Rot32(x, 19) ^ ((x) >> 10)) + +static const uint32_t SHA256_K[64] = { + 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, + 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, + 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, + 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, + 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, + 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, + 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, + 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, + 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, + 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, + 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, + 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, + 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, + 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, + 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, + 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 +}; + +static void +SHA256Transform(uint32_t *H, const uint8_t *cp) +{ + uint32_t a, b, c, d, e, f, g, h, t, T1, T2, W[64]; + + for (t = 0; t < 16; t++, cp += 4) + W[t] = (cp[0] << 24) | (cp[1] << 16) | (cp[2] << 8) | cp[3]; + + for (t = 16; t < 64; t++) + W[t] = sigma1(W[t - 2]) + W[t - 7] + + sigma0(W[t - 15]) + W[t - 16]; + + a = H[0]; b = H[1]; c = H[2]; d = H[3]; + e = H[4]; f = H[5]; g = H[6]; h = H[7]; + + for (t = 0; t < 64; t++) { + T1 = h + SIGMA1(e) + Ch(e, f, g) + SHA256_K[t] + W[t]; + T2 = SIGMA0(a) + Maj(a, b, c); + h = g; g = f; f = e; e = d + T1; + d = c; c = b; b = a; a = T1 + T2; + } + + H[0] += a; H[1] += b; H[2] += c; H[3] += d; + H[4] += e; H[5] += f; H[6] += g; H[7] += h; +} + +void +zio_checksum_SHA256(const void *buf, uint64_t size, zio_cksum_t *zcp) +{ + uint32_t H[8] = { 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, + 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19 }; + uint8_t pad[128]; + int padsize = size & 63; + int i; + + for (i = 0; i < size - padsize; i += 64) + SHA256Transform(H, (uint8_t *)buf + i); + + for (i = 0; i < padsize; i++) + pad[i] = ((uint8_t *)buf)[i]; + + for (pad[padsize++] = 0x80; (padsize & 63) != 56; padsize++) + pad[padsize] = 0; + + for (i = 0; i < 8; i++) + pad[padsize++] = (size << 3) >> (56 - 8 * i); + + for (i = 0; i < padsize; i += 64) + SHA256Transform(H, pad + i); + + ZIO_SET_CHECKSUM(zcp, + (uint64_t)H[0] << 32 | H[1], + (uint64_t)H[2] << 32 | H[3], + (uint64_t)H[4] << 32 | H[5], + (uint64_t)H[6] << 32 | H[7]); +} diff --git a/usr/src/grub/grub-0.97/stamp-h.in b/usr/src/grub/grub-0.97/stamp-h.in new file mode 100644 index 0000000000..9788f70238 --- /dev/null +++ b/usr/src/grub/grub-0.97/stamp-h.in @@ -0,0 +1 @@ +timestamp diff --git a/usr/src/grub/grub-0.97/util/Makefile.am b/usr/src/grub/grub-0.97/util/Makefile.am new file mode 100644 index 0000000000..2e04711357 --- /dev/null +++ b/usr/src/grub/grub-0.97/util/Makefile.am @@ -0,0 +1,12 @@ +bin_PROGRAMS = mbchk +sbin_SCRIPTS = grub-install grub-md5-crypt grub-terminfo \ + grub-set-default +noinst_SCRIPTS = grub-image mkbimage + +EXTRA_DIST = mkbimage + +# XXX: Need to search for a header file in docs, because of multiboot.h. +AM_CFLAGS = -I$(top_srcdir)/lib -I$(top_srcdir)/docs + +mbchk_SOURCES = mbchk.c +mbchk_LDADD = ../lib/libcommon.a diff --git a/usr/src/grub/grub-0.97/util/Makefile.in b/usr/src/grub/grub-0.97/util/Makefile.in new file mode 100644 index 0000000000..6beedf7759 --- /dev/null +++ b/usr/src/grub/grub-0.97/util/Makefile.in @@ -0,0 +1,478 @@ +# Makefile.in generated by automake 1.8.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +SOURCES = $(mbchk_SOURCES) + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_triplet = @host@ +bin_PROGRAMS = mbchk$(EXEEXT) +subdir = util +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(srcdir)/grub-image.in $(srcdir)/grub-install.in \ + $(srcdir)/grub-md5-crypt.in $(srcdir)/grub-set-default.in \ + $(srcdir)/grub-terminfo.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = grub-image grub-install grub-md5-crypt \ + grub-terminfo grub-set-default +am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(sbindir)" +binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) +PROGRAMS = $(bin_PROGRAMS) +am_mbchk_OBJECTS = mbchk.$(OBJEXT) +mbchk_OBJECTS = $(am_mbchk_OBJECTS) +mbchk_DEPENDENCIES = ../lib/libcommon.a +sbinSCRIPT_INSTALL = $(INSTALL_SCRIPT) +SCRIPTS = $(noinst_SCRIPTS) $(sbin_SCRIPTS) +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/mbchk.Po +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(mbchk_SOURCES) +DIST_SOURCES = $(mbchk_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BUILD_EXAMPLE_KERNEL_FALSE = @BUILD_EXAMPLE_KERNEL_FALSE@ +BUILD_EXAMPLE_KERNEL_TRUE = @BUILD_EXAMPLE_KERNEL_TRUE@ +CC = @CC@ +CCAS = @CCAS@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DISKLESS_SUPPORT_FALSE = @DISKLESS_SUPPORT_FALSE@ +DISKLESS_SUPPORT_TRUE = @DISKLESS_SUPPORT_TRUE@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FSYS_CFLAGS = @FSYS_CFLAGS@ +GRUB_CFLAGS = @GRUB_CFLAGS@ +GRUB_LIBS = @GRUB_LIBS@ +HERCULES_SUPPORT_FALSE = @HERCULES_SUPPORT_FALSE@ +HERCULES_SUPPORT_TRUE = @HERCULES_SUPPORT_TRUE@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +NETBOOT_DRIVERS = @NETBOOT_DRIVERS@ +NETBOOT_SUPPORT_FALSE = @NETBOOT_SUPPORT_FALSE@ +NETBOOT_SUPPORT_TRUE = @NETBOOT_SUPPORT_TRUE@ +NET_CFLAGS = @NET_CFLAGS@ +NET_EXTRAFLAGS = @NET_EXTRAFLAGS@ +OBJCOPY = @OBJCOPY@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PERL = @PERL@ +RANLIB = @RANLIB@ +SERIAL_SPEED_SIMULATION_FALSE = @SERIAL_SPEED_SIMULATION_FALSE@ +SERIAL_SPEED_SIMULATION_TRUE = @SERIAL_SPEED_SIMULATION_TRUE@ +SERIAL_SUPPORT_FALSE = @SERIAL_SUPPORT_FALSE@ +SERIAL_SUPPORT_TRUE = @SERIAL_SUPPORT_TRUE@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STAGE1_CFLAGS = @STAGE1_CFLAGS@ +STAGE2_CFLAGS = @STAGE2_CFLAGS@ +STRIP = @STRIP@ +VERSION = @VERSION@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_OBJCOPY = @ac_ct_OBJCOPY@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +sbin_SCRIPTS = grub-install grub-md5-crypt grub-terminfo \ + grub-set-default + +noinst_SCRIPTS = grub-image mkbimage +EXTRA_DIST = mkbimage + +# XXX: Need to search for a header file in docs, because of multiboot.h. +AM_CFLAGS = -I$(top_srcdir)/lib -I$(top_srcdir)/docs +mbchk_SOURCES = mbchk.c +mbchk_LDADD = ../lib/libcommon.a +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu util/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu util/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +grub-image: $(top_builddir)/config.status $(srcdir)/grub-image.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +grub-install: $(top_builddir)/config.status $(srcdir)/grub-install.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +grub-md5-crypt: $(top_builddir)/config.status $(srcdir)/grub-md5-crypt.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +grub-terminfo: $(top_builddir)/config.status $(srcdir)/grub-terminfo.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +grub-set-default: $(top_builddir)/config.status $(srcdir)/grub-set-default.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + if test -f $$p \ + ; then \ + f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ + $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ + else :; fi; \ + done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ + rm -f "$(DESTDIR)$(bindir)/$$f"; \ + done + +clean-binPROGRAMS: + -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) +mbchk$(EXEEXT): $(mbchk_OBJECTS) $(mbchk_DEPENDENCIES) + @rm -f mbchk$(EXEEXT) + $(LINK) $(mbchk_LDFLAGS) $(mbchk_OBJECTS) $(mbchk_LDADD) $(LIBS) +install-sbinSCRIPTS: $(sbin_SCRIPTS) + @$(NORMAL_INSTALL) + test -z "$(sbindir)" || $(mkdir_p) "$(DESTDIR)$(sbindir)" + @list='$(sbin_SCRIPTS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + if test -f $$d$$p; then \ + f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \ + echo " $(sbinSCRIPT_INSTALL) '$$d$$p' '$(DESTDIR)$(sbindir)/$$f'"; \ + $(sbinSCRIPT_INSTALL) "$$d$$p" "$(DESTDIR)$(sbindir)/$$f"; \ + else :; fi; \ + done + +uninstall-sbinSCRIPTS: + @$(NORMAL_UNINSTALL) + @list='$(sbin_SCRIPTS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \ + echo " rm -f '$(DESTDIR)$(sbindir)/$$f'"; \ + rm -f "$(DESTDIR)$(sbindir)/$$f"; \ + done + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mbchk.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` +uninstall-info-am: + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) $(SCRIPTS) +installdirs: + for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(sbindir)"; do \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-binPROGRAMS clean-generic mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: install-binPROGRAMS install-sbinSCRIPTS + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-binPROGRAMS uninstall-info-am \ + uninstall-sbinSCRIPTS + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ + clean-generic ctags distclean distclean-compile \ + distclean-generic distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-binPROGRAMS \ + install-data install-data-am install-exec install-exec-am \ + install-info install-info-am install-man install-sbinSCRIPTS \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-binPROGRAMS \ + uninstall-info-am uninstall-sbinSCRIPTS + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/usr/src/grub/grub-0.97/util/Makefile.solaris b/usr/src/grub/grub-0.97/util/Makefile.solaris new file mode 100644 index 0000000000..4691dbfc55 --- /dev/null +++ b/usr/src/grub/grub-0.97/util/Makefile.solaris @@ -0,0 +1,81 @@ +# +# Copyright 2005 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# ident "%Z%%M% %I% %E% SMI" +# +include ../../Makefile.grub +include ../Makefile.solaris.defs + + +INCLUDES = -I. -I.. -I../lib -I../docs +LIBCOMMON = ../lib/libcommon.a + +# Build these only if the OPTION_UTILS on is on (blank). +$(OPTION_UTILS)PROGRAMS = mbchk + + +# Build these only if the OPTION_UTILS on is on (blank). +# Will be installed. +$(OPTION_UTILS)INSTALL_SCRIPTS = grub-install \ + grub-md5-crypt \ + grub-set-default \ + grub-terminfo +# Won't be installed. +$(OPTION_UTILS)NOINSTALL_SCRIPTS = grub-image + +SCRIPTS = $(INSTALL_SCRIPTS) $(NOINSTALL_SCRIPTS) + + +INSTALL_BINDIR = $(ROOT_PLAT_GRUB)/bin +INSTALL_SBINDIR = $(ROOT_PLAT_GRUB)/sbin + +INSTALL_TARGETS = $(PROGRAMS:%=$(INSTALL_BINDIR)/%) \ + $(INSTALL_SCRIPTS:%=$(INSTALL_SBINDIR)/%) + +$(INSTALL_BINDIR)/% := FILEMODE = 0555 +$(INSTALL_SBINDIR)/% := FILEMODE = 0555 + +# +# Source files to be installed in $(SRC_DIR). +# +SRC_DIR = $(ROOT_SRC)/util +SRC_FILES = Makefile.am Makefile.in grub-image.in grub-install.in \ + grub-md5-crypt.in grub-set-default.in grub-terminfo.in \ + mbchk.c mkbimage + +INSTALL_TARGETS += $(SRC_FILES:%=$(SRC_DIR)/%) + + +all: $(PROGRAMS) $(SCRIPTS) + +$(PROGRAMS): $$@.o + $(RM) $@ + $(LINK) -o $@ $@.o $(LIBCOMMON) + +$(SCRIPTS): $$@.in ../config.status.solaris + cd .. && ./config.status.solaris util/$@ + + +install: all $(INSTALL_TARGETS) + +$(INSTALL_BINDIR)/%: $(INSTALL_BINDIR) % + $(INS.file) + +$(INSTALL_SBINDIR)/%: $(INSTALL_SBINDIR) % + $(INS.file) + +$(SRC_DIR)/%: $(SRC_DIR) % + $(INS.file) + +$(INSTALL_BINDIR) $(INSTALL_SBINDIR) $(SRC_DIR): + $(INS.dir) + + +clean: _FORCE + $(RM) *.o $(NOINSTALL_SCRIPTS) + +clobber: clean + $(RM) $(PROGRAMS) $(INSTALL_SCRIPTS) + +_FORCE: diff --git a/usr/src/grub/grub-0.97/util/grub-image.in b/usr/src/grub/grub-0.97/util/grub-image.in new file mode 100644 index 0000000000..ea632505fb --- /dev/null +++ b/usr/src/grub/grub-0.97/util/grub-image.in @@ -0,0 +1,138 @@ +#! /bin/sh +# grub-image - Create a GRUB boot filesystem image and tarball +# Gordon Matzigkeit , 2000-07-25 +# +# Copyright (C) 2000, 2002 Free Software Foundation, Inc. +# +# This file 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. + +prefix=@prefix@ +exec_prefix=@exec_prefix@ +sbindir=@sbindir@ +libdir=@libdir@ +PACKAGE=@PACKAGE@ +host_cpu=@host_cpu@ +host_os=@host_os@ +host_vendor=@host_vendor@ +context=${host_cpu}-${host_vendor} +pkglibdir=${libdir}/${PACKAGE}/${context} + +mke2fs=`which mke2fs` + +progname=`echo "$0" | sed 's%^.*/%%'` +thisdir=`echo "$0" | sed 's%/[^/]*$%%'` +test "X$thisdir" = "X$0" && thisdir=. + +# See if we were invoked from within the build directory, and if so, +# use the built files rather than the installed ones. +if test -f $thisdir/../stage2/stage2; then + grub_shell="$thisdir/../grub/grub" + stage1dir="$thisdir/../stage1" + stage2dir="$thisdir/../stage2" +else + grub_shell=${sbindir}/grub + stage1dir="$pkglibdir" + stage2dir="$pkglibdir" +fi + +# Exit on any error. +set -e + +# Get GRUB's version from the Grub shell, since we use the +# installed files. +VERSION=`$grub_shell --version | sed -e 's/^.* \([0-9.]*\).*$/\1/'` +test "X$VERSION" != X + +bootdir=${PACKAGE}-${VERSION}-${context} +image=$bootdir.ext2fs + +# Create the tarball. +if test ! -f $bootdir.tar.gz; then + echo "# Creating \`$bootdir.tar.gz'" + mkdir -p $bootdir/boot/grub + cp -p $stage1dir/stage1 $stage2dir/*_stage1_5 $stage2dir/stage2 \ + $bootdir/boot/grub + test ! -f menu.lst || cp -p menu.lst $bootdir/boot/grub + trap "rm -f $bootdir.tar.gz" 0 + GZIP=-9 tar -zcf $bootdir.tar.gz $bootdir + trap '' 0 + rm -rf $bootdir +fi + +# Create a new filesystem image of the specified size. +if test ! -f $image; then + tarsize=`zcat $bootdir.tar.gz | wc -c` + + # Add about 30% (20% overhead plus 10% breathing room), and convert + # to kilobytes. This factor was determined empirically. + SIZE=`expr $tarsize \* 130 / 100 / 1024`k + echo "# Creating $SIZE disk image \`$image'" + trap "rm -f $image" 0 + dd if=/dev/zero of=$image bs=$SIZE count=1 >/dev/null + $mke2fs -F $image + trap '' 0 +fi + + +# Attempt to mount the image. +echo "# Mounting \`$image'" +test -d $bootdir || mkdir $bootdir +case "$host_os" in +gnu*) + settrans -a $bootdir /hurd/ext2fs $image + umount="settrans -a $bootdir" + ;; + +linux*) + # This requires running as root, and using the loop device. + i=0 + while test -e /dev/loop$i; do + if /sbin/losetup /dev/loop$i $image; then + break + fi + i=`expr $i + 1` + done + + # Silly losetup doesn't report an error! + mount /dev/loop$i $bootdir + umount="umount $bootdir && /sbin/losetup -d /dev/loop$i && trap '' 0" + ;; + +*) + echo "$progname: Mounting \`$image' under \`$host_os' is not supported" 1>&2 + exit 1 + ;; +esac +trap "$umount" 0 + +# Extract our tarball into the image, then unmount it. +echo "# Copying files into \`$image':" +tar -zxvf $bootdir.tar.gz + +echo "# \`$image' usage:" +df $bootdir +eval $umount +rmdir $bootdir || : + +# Use the GRUB shell to properly set up GRUB on the image. +echo "# Installing GRUB in \`$image'" +cat <. +EOF +} + +# Usage: convert os_device +# Convert an OS device to the corresponding GRUB drive. +# This part is OS-specific. +convert () { + # First, check if the device file exists. + if test -e "$1"; then + : + else + echo "$1: Not found or not a block device." 1>&2 + exit 1 + fi + + # Break the device name into the disk part and the partition part. + case "$host_os" in + linux*) + tmp_disk=`echo "$1" | sed -e 's%\([sh]d[a-z]\)[0-9]*$%\1%' \ + -e 's%\(d[0-9]*\)p[0-9]*$%\1%' \ + -e 's%\(fd[0-9]*\)$%\1%' \ + -e 's%/part[0-9]*$%/disc%' \ + -e 's%\(c[0-7]d[0-9]*\).*$%\1%'` + tmp_part=`echo "$1" | sed -e 's%.*/[sh]d[a-z]\([0-9]*\)$%\1%' \ + -e 's%.*d[0-9]*p%%' \ + -e 's%.*/fd[0-9]*$%%' \ + -e 's%.*/floppy/[0-9]*$%%' \ + -e 's%.*/\(disc\|part\([0-9]*\)\)$%\2%' \ + -e 's%.*c[0-7]d[0-9]*p%%'` + ;; + gnu*) + tmp_disk=`echo "$1" | sed 's%\([sh]d[0-9]*\).*%\1%'` + tmp_part=`echo "$1" | sed "s%$tmp_disk%%"` ;; + freebsd* | kfreebsd*-gnu) + tmp_disk=`echo "$1" | sed 's%r\{0,1\}\([saw]d[0-9]*\).*$%r\1%' \ + | sed 's%r\{0,1\}\(da[0-9]*\).*$%r\1%'` + tmp_part=`echo "$1" \ + | sed "s%.*/r\{0,1\}[saw]d[0-9]\(s[0-9]*[a-h]\)%\1%" \ + | sed "s%.*/r\{0,1\}da[0-9]\(s[0-9]*[a-h]\)%\1%"` + ;; + netbsd* | knetbsd*-gnu) + tmp_disk=`echo "$1" | sed 's%r\{0,1\}\([sw]d[0-9]*\).*$%r\1d%' \ + | sed 's%r\{0,1\}\(fd[0-9]*\).*$%r\1a%'` + tmp_part=`echo "$1" \ + | sed "s%.*/r\{0,1\}[sw]d[0-9]\([abe-p]\)%\1%"` + ;; + *) + echo "grub-install does not support your OS yet." 1>&2 + exit 1 ;; + esac + + # Get the drive name. + tmp_drive=`grep -v '^#' $device_map | grep "$tmp_disk *$" \ + | sed 's%.*\(([hf]d[0-9][a-g0-9,]*)\).*%\1%'` + + # If not found, print an error message and exit. + if test "x$tmp_drive" = x; then + echo "$1 does not have any corresponding BIOS drive." 1>&2 + exit 1 + fi + + if test "x$tmp_part" != x; then + # If a partition is specified, we need to translate it into the + # GRUB's syntax. + case "$host_os" in + linux*) + echo "$tmp_drive" | sed "s%)$%,`expr $tmp_part - 1`)%" ;; + gnu*) + if echo $tmp_part | grep "^s" >/dev/null; then + tmp_pc_slice=`echo $tmp_part \ + | sed "s%s\([0-9]*\)[a-g]*$%\1%"` + tmp_drive=`echo "$tmp_drive" \ + | sed "s%)%,\`expr "$tmp_pc_slice" - 1\`)%"` + fi + if echo $tmp_part | grep "[a-g]$" >/dev/null; then + tmp_bsd_partition=`echo "$tmp_part" \ + | sed "s%[^a-g]*\([a-g]\)$%\1%"` + tmp_drive=`echo "$tmp_drive" \ + | sed "s%)%,$tmp_bsd_partition)%"` + fi + echo "$tmp_drive" ;; + freebsd* | kfreebsd*-gnu) + if echo $tmp_part | grep "^s" >/dev/null; then + tmp_pc_slice=`echo $tmp_part \ + | sed "s%s\([0-9]*\)[a-h]*$%\1%"` + tmp_drive=`echo "$tmp_drive" \ + | sed "s%)%,\`expr "$tmp_pc_slice" - 1\`)%"` + fi + if echo $tmp_part | grep "[a-h]$" >/dev/null; then + tmp_bsd_partition=`echo "$tmp_part" \ + | sed "s%s\{0,1\}[0-9]*\([a-h]\)$%\1%"` + tmp_drive=`echo "$tmp_drive" \ + | sed "s%)%,$tmp_bsd_partition)%"` + fi + echo "$tmp_drive" ;; + netbsd* | knetbsd*-gnu) + if echo $tmp_part | grep "^[abe-p]$" >/dev/null; then + tmp_bsd_partition=`echo "$tmp_part" \ + | sed "s%\([a-p]\)$%\1%"` + tmp_drive=`echo "$tmp_drive" \ + | sed "s%)%,$tmp_bsd_partition)%"` + fi + echo "$tmp_drive" ;; + esac + else + # If no partition is specified, just print the drive name. + echo "$tmp_drive" + fi +} + +# Usage: resolve_symlink file +# Find the real file/device that file points at +resolve_symlink () { + tmp_fname=$1 + # Resolve symlinks + while test -L $tmp_fname; do + tmp_new_fname=`ls -al $tmp_fname | sed -n 's%.*-> \(.*\)%\1%p'` + if test -z "$tmp_new_fname"; then + echo "Unrecognized ls output" 2>&1 + exit 1 + fi + + # Convert relative symlinks + case $tmp_new_fname in + /*) tmp_fname="$tmp_new_fname" + ;; + *) tmp_fname="`echo $tmp_fname | sed 's%/[^/]*$%%'`/$tmp_new_fname" + ;; + esac + done + echo "$tmp_fname" +} + +# Usage: find_device file +# Find block device on which the file resides. +find_device () { + # For now, this uses the program `df' to get the device name, but is + # this really portable? + tmp_fname=`df $1/ | sed -n 's%.*\(/dev/[^ ]*\).*%\1%p'` + + if test -z "$tmp_fname"; then + echo "Could not find device for $1" 2>&1 + exit 1 + fi + + tmp_fname=`resolve_symlink $tmp_fname` + + echo "$tmp_fname" +} + +# Check the arguments. +for option in "$@"; do + case "$option" in + -h | --help) + usage + exit 0 ;; + -v | --version) + echo "grub-install (GNU GRUB ${VERSION})" + exit 0 ;; + --root-directory=*) + rootdir=`echo "$option" | sed 's/--root-directory=//'` ;; + --grub-shell=*) + grub_shell=`echo "$option" | sed 's/--grub-shell=//'` ;; + --no-floppy) + no_floppy="--no-floppy" ;; + --force-lba) + force_lba="--force-lba" ;; + --recheck) + recheck=yes ;; + # This is an undocumented feature... + --debug) + debug=yes ;; + -*) + echo "Unrecognized option \`$option'" 1>&2 + usage + exit 1 + ;; + *) + if test "x$install_device" != x; then + echo "More than one install_devices?" 1>&2 + usage + exit 1 + fi + install_device="${option}" ;; + esac +done + +if test "x$install_device" = x; then + echo "install_device not specified." 1>&2 + usage + exit 1 +fi + +# If the debugging feature is enabled, print commands. +if test $debug = yes; then + set -x +fi + +# Initialize these directories here, since ROOTDIR was initialized. +case "$host_os" in +netbsd* | openbsd*) + # Because /boot is used for the boot block in NetBSD and OpenBSD, use /grub + # instead of /boot/grub. + grub_prefix=/grub + bootdir=${rootdir} + ;; +*) + # Use /boot/grub by default. + bootdir=${rootdir}/boot + ;; +esac + +grubdir=${bootdir}/grub +device_map=${grubdir}/device.map + +# Check if GRUB is installed. +# This is necessary, because the user can specify "grub --read-only". +set $grub_shell dummy +if test -f "$1"; then + : +else + echo "$1: Not found." 1>&2 + exit 1 +fi + +if test -f "$pkglibdir/stage1"; then + : +else + echo "${pkglibdir}/stage1: Not found." 1>&2 + exit 1 +fi + +if test -f "$pkglibdir/stage2"; then + : +else + echo "${pkglibdir}/stage2: Not found." 1>&2 + exit 1 +fi + +# Don't check for *stage1_5, because it is not fatal even if any +# Stage 1.5 does not exist. + +# Create the GRUB directory if it is not present. +test -d "$bootdir" || mkdir "$bootdir" || exit 1 +test -d "$grubdir" || mkdir "$grubdir" || exit 1 + +# If --recheck is specified, remove the device map, if present. +if test $recheck = yes; then + rm -f $device_map +fi + +# Create the device map file if it is not present. +if test -f "$device_map"; then + : +else + # Create a safe temporary file. + test -n "$mklog" && log_file=`$mklog` + + $grub_shell --batch $no_floppy --device-map=$device_map <$log_file +quit +EOF + if grep "Error [0-9]*: " $log_file >/dev/null; then + cat $log_file 1>&2 + exit 1 + fi + + rm -f $log_file +fi + +# Make sure that there is no duplicated entry. +tmp=`sed -n '/^([fh]d[0-9]*)/s/\(^(.*)\).*/\1/p' $device_map \ + | sort | uniq -d | sed -n 1p` +if test -n "$tmp"; then + echo "The drive $tmp is defined multiple times in the device map $device_map" 1>&2 + exit 1 +fi + +# Check for INSTALL_DEVICE. +case "$install_device" in +/dev/*) + install_device=`resolve_symlink "$install_device"` + install_drive=`convert "$install_device"` + # I don't know why, but some shells wouldn't die if exit is + # called in a function. + if test "x$install_drive" = x; then + exit 1 + fi ;; +\([hf]d[0-9]*\)) + install_drive="$install_device" ;; +[hf]d[0-9]*) + # The GRUB format with no parenthesis. + install_drive="($install_device)" ;; +*) + echo "Format of install_device not recognized." 1>&2 + usage + exit 1 ;; +esac + +# Get the root drive. +root_device=`find_device ${rootdir}` +bootdir_device=`find_device ${bootdir}` + +# Check if the boot directory is in the same device as the root directory. +if test "x$root_device" != "x$bootdir_device"; then + # Perhaps the user has a separate boot partition. + root_device=$bootdir_device + grub_prefix="/grub" +fi + +# Convert the root device to a GRUB drive. +root_drive=`convert "$root_device"` +if test "x$root_drive" = x; then + exit 1 +fi + +# Check if the root directory exists in the same device as the grub +# directory. +grubdir_device=`find_device ${grubdir}` + +if test "x$grubdir_device" != "x$root_device"; then + # For now, cannot deal with this situation. + cat <&2 +You must set the root directory by the option --root-directory, because +$grubdir does not exist in the root device $root_device. +EOF + exit 1 +fi + +# Copy the GRUB images to the GRUB directory. +for file in ${grubdir}/stage1 ${grubdir}/stage2 ${grubdir}/*stage1_5; do + rm -f $file || exit 1 +done +for file in \ + ${pkglibdir}/stage1 ${pkglibdir}/stage2 ${pkglibdir}/*stage1_5; do + cp -f $file ${grubdir} || exit 1 +done + +# Make a default file. +${grub_set_default} --root-directory=${rootdir} default + +# Make sure that GRUB reads the same images as the host OS. +test -n "$mkimg" && img_file=`$mkimg` +test -n "$mklog" && log_file=`$mklog` + +for file in ${grubdir}/stage1 ${grubdir}/stage2 ${grubdir}/*stage1_5; do + count=5 + tmp=`echo $file | sed "s|^${grubdir}|${grub_prefix}|"` + while test $count -gt 0; do + $grub_shell --batch $no_floppy --device-map=$device_map <$log_file +dump ${root_drive}${tmp} ${img_file} +quit +EOF + if grep "Error [0-9]*: " $log_file >/dev/null; then + : + elif cmp $file $img_file >/dev/null; then + break + fi + sleep 1 + count=`expr $count - 1` + done + if test $count -eq 0; then + echo "The file $file not read correctly." 1>&2 + exit 1 + fi +done + +rm -f $img_file +rm -f $log_file + +# Create a safe temporary file. +test -n "$mklog" && log_file=`$mklog` + +# Now perform the installation. +$grub_shell --batch $no_floppy --device-map=$device_map <$log_file +root $root_drive +setup $force_lba --stage2=$grubdir/stage2 --prefix=$grub_prefix $install_drive +quit +EOF + +if grep "Error [0-9]*: " $log_file >/dev/null || test $debug = yes; then + cat $log_file 1>&2 + exit 1 +fi + +rm -f $log_file + +# Prompt the user to check if the device map is correct. +echo "Installation finished. No error reported." +echo "This is the contents of the device map $device_map." +echo "Check if this is correct or not. If any of the lines is incorrect," +echo "fix it and re-run the script \`grub-install'." +echo + +cat $device_map + +# Bye. +exit 0 diff --git a/usr/src/grub/grub-0.97/util/grub-md5-crypt.in b/usr/src/grub/grub-0.97/util/grub-md5-crypt.in new file mode 100644 index 0000000000..c030c87930 --- /dev/null +++ b/usr/src/grub/grub-0.97/util/grub-md5-crypt.in @@ -0,0 +1,99 @@ +#! /bin/sh + +# Encrypt a password in MD5 format +# Copyright (C) 2000,2002 Free Software Foundation, Inc. +# +# This file 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. + +# Replaced by the configure script. +prefix=@prefix@ +exec_prefix=@exec_prefix@ +sbindir=@sbindir@ + +# Initialize some variables. +grub_shell=${sbindir}/grub +progname="grub-md5-crypt" + +# Check the arguments. +for option in "$@"; do + case "$option" in + -h | --help) + cat <. +EOF + exit 0 + ;; + + -v | --version) + echo "$progname (GNU GRUB ${VERSION})" + exit 0 + ;; + + --grub-shell=*) + grub_shell=`echo "$option" | sed 's/--grub-shell=//'` + ;; + + *) + echo "$progname: unrecognized option \`$option'" + echo "Usage: $progname [OPTION]" + echo "Try \`$progname --help' for more information." + exit 1 + ;; + esac +done + +# Suppress echo backs. I don't know if this is really portable. -okuji +stty -echo + +# Prompt to enter a password. +echo -n "Password: " +read -r password +echo + +# One more time. +echo -n "Retype password: " +read -r password2 +echo + +# Resume echo backs. +stty echo + +if test "x$password" = x; then + echo "Empty password is not permitted." + exit 1 +fi + +if test "x$password" != "x$password2"; then + echo "Sorry, passwords do not match." + exit 1 +fi + +# Run the grub shell. +$grub_shell --batch --device-map=/dev/null <. +EOF +} + +# Check the arguments. +for option in "$@"; do + case "$option" in + -h | --help) + usage + exit 0 ;; + -v | --version) + echo "grub-set-default (GNU GRUB ${VERSION})" + exit 0 ;; + --root-directory=*) + rootdir=`echo "$option" | sed 's/--root-directory=//'` ;; + -*) + echo "Unrecognized option \`$option'" 1>&2 + usage + exit 1 + ;; + *) + if test "x$entry" != x; then + echo "More than one entries?" 1>&2 + usage + exit 1 + fi + # We don't care about what the user specified actually. + entry="${option}" ;; + esac +done + +if test "x$entry" = x; then + echo "entry not specified." 1>&2 + usage + exit 1 +fi + +# Determine the GRUB directory. This is different among OSes. +grubdir=${rootdir}/boot/grub +if test -d ${grubdir}; then + : +else + grubdir=${rootdir}/grub + if test -d ${grubdir}; then + : + else + echo "No GRUB directory found under ${rootdir}/" 1>&2 + exit 1 + fi +fi + +file=${grubdir}/default +if test -f ${file}; then + chmod 0600 ${file} + rm -f ${file} +fi +cat < $file +$entry +# +# +# +# +# +# +# +# +# +# +# WARNING: If you want to edit this file directly, do not remove any line +# from this file, including this warning. Using \`grub-set-default\' is +# strongly recommended. +EOF + +# Bye. +exit 0 diff --git a/usr/src/grub/grub-0.97/util/grub-terminfo.in b/usr/src/grub/grub-0.97/util/grub-terminfo.in new file mode 100644 index 0000000000..e41b41836c --- /dev/null +++ b/usr/src/grub/grub-0.97/util/grub-terminfo.in @@ -0,0 +1,95 @@ +#! /bin/sh +# Generate a terminfo command from a terminfo name. +# +# Copyright (C) 2002 Free Software Foundation, Inc. +# +# This file 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. + +VERSION=@VERSION@ + +usage () { + cat <. +EOF +} + +error () { + echo "grub-terminfo: error: $1" 1>&2 +} + +termname= + +for option in "$@"; do + case "$option" in + -h | --help) + usage + exit 0 ;; + -v | --version) + echo "grub-terminfo (GNU GRUB ${VERSION})" + exit 0 ;; + -*) + error "Unrecognized option \`$option'" + usage + exit 1 ;; + *) + if test "x$termname" != x; then + error "More than one terminfo names?" + usage + exit 1 + fi + termname="$option" ;; + esac +done + +if test "x$termname" = x; then + error "termname not specified" + usage + exit 1 +fi + +get_seq () { + infocmp -L -1 -g $termname | sed -n -e "/$1/s/^[^=]*=\\(.*\\),\$/\\1/p" +} + +cursor_address="`get_seq cursor_address`" +if test "x$cursor_address" = x; then + error "cursor_address not found" + exit 1 +fi +cursor_address="--cursor-address=$cursor_address" + +clear_screen="`get_seq clear_screen`" +if test "x$clear_screen" != x; then + clear_screen="--clear-screen=$clear_screen" +fi + +enter_standout_mode="`get_seq enter_standout_mode`" +if test "x$enter_standout_mode" != x; then + enter_standout_mode="--enter-standout-mode=$enter_standout_mode" +fi + +exit_standout_mode="`get_seq exit_standout_mode`" +if test "x$exit_standout_mode" != x; then + exit_standout_mode="--exit-standout-mode=$exit_standout_mode" +fi + +echo "terminfo --name=$termname" $cursor_address $clear_screen \ + $enter_standout_mode $exit_standout_mode diff --git a/usr/src/grub/grub-0.97/util/mbchk.c b/usr/src/grub/grub-0.97/util/mbchk.c new file mode 100644 index 0000000000..fd71858279 --- /dev/null +++ b/usr/src/grub/grub-0.97/util/mbchk.c @@ -0,0 +1,244 @@ +/* mbchk - a simple checker for the format of a Multiboot kernel */ +/* + * Copyright (C) 1999,2001,2002 Free Software Foundation, 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 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 + +#include +#include +#include +#include + +static int quiet = 0; +static char *optstring = "hvq"; +static struct option longopts[] = +{ + {"help", no_argument, 0, 'h'}, + {"version", no_argument, 0, 'v'}, + {"quiet", no_argument, 0, 'q'}, + {0} +}; + +static void +usage (int status) +{ + if (status) + fprintf (stderr, "Try ``mbchk --help'' for more information.\n"); + else + printf ("Usage: mbchk [OPTION]... [FILE]...\n" + "Check if the format of FILE complies with the Multiboot Specification.\n" + "\n" + "-q, --quiet suppress all normal output\n" + "-h, --help display this help and exit\n" + "-v, --version output version information and exit.\n" + "\n" + "Report bugs to .\n"); + + exit (status); +} + +static int +check_multiboot (const char *filename, FILE *fp) +{ + multiboot_header_t *mbh = 0; + int i; + char buf[8192]; + + if (fread (buf, 1, 8192, fp) < 0) + { + fprintf (stderr, "%s: Read error.\n", filename); + return 0; + } + + for (i = 0; i < 8192 - sizeof (multiboot_header_t); i++) + { + unsigned long magic = *((unsigned long *) (buf + i)); + + if (magic == MULTIBOOT_HEADER_MAGIC) + { + mbh = (multiboot_header_t *) (buf + i); + break; + } + } + + if (! mbh) + { + fprintf (stderr, "%s: No Multiboot header.\n", filename); + return 0; + } + + if (! quiet) + printf ("%s: The Multiboot header is found at the offset %d.\n", + filename, i); + + /* Check for the checksum. */ + if (mbh->magic + mbh->flags + mbh->checksum != 0) + { + fprintf (stderr, + "%s: Bad checksum (0x%lx).\n", + filename, mbh->checksum); + return 0; + } + + /* Reserved flags must be zero. */ + if (mbh->flags & ~0x00010003) + { + fprintf (stderr, + "%s: Non-zero is found in reserved flags (0x%lx).\n", + filename, mbh->flags); + return 0; + } + + if (! quiet) + { + printf ("%s: Page alignment is turned %s.\n", + filename, (mbh->flags & 0x1)? "on" : "off"); + printf ("%s: Memory information is turned %s.\n", + filename, (mbh->flags & 0x2)? "on" : "off"); + printf ("%s: Address fields is turned %s.\n", + filename, (mbh->flags & 0x10000)? "on" : "off"); + } + + /* Check for the address fields. */ + if (mbh->flags & 0x10000) + { + if (mbh->header_addr < mbh->load_addr) + { + fprintf (stderr, + "%s: header_addr is less than " + "load_addr (0x%lx > 0x%lx).\n", + filename, mbh->header_addr, mbh->load_addr); + return 0; + } + + if (mbh->load_end_addr && mbh->load_addr >= mbh->load_end_addr) + { + fprintf (stderr, + "%s: load_addr is not less than load_end_addr" + " (0x%lx >= 0x%lx).\n", + filename, mbh->load_addr, mbh->load_end_addr); + return 0; + } + + if (mbh->bss_end_addr && mbh->load_end_addr > mbh->bss_end_addr) + { + fprintf (stderr, + "%s: load_end_addr is greater than bss_end_addr" + " (0x%lx > 0x%lx).\n", + filename, mbh->load_end_addr, mbh->bss_end_addr); + return 0; + } + + if (mbh->load_addr > mbh->entry_addr) + { + fprintf (stderr, + "%s: load_addr is greater than entry_addr" + " (0x%lx > 0x%lx).\n", + filename, mbh->load_addr, mbh->entry_addr); + return 0; + } + + /* FIXME: It is better to check if the entry address is within the + file, especially when the load end address is zero. */ + if (mbh->load_end_addr && mbh->load_end_addr <= mbh->entry_addr) + { + fprintf (stderr, + "%s: load_end_addr is not greater than entry_addr" + " (0x%lx <= 0x%lx).\n", + filename, mbh->load_end_addr, mbh->entry_addr); + return 0; + } + + /* This is a GRUB-specific limitation. */ + if (mbh->load_addr < 0x100000) + { + fprintf (stderr, + "%s: Cannot be loaded at less than 1MB by GRUB" + " (0x%lx).\n", + filename, mbh->load_addr); + return 0; + } + } + + if (! quiet) + printf ("%s: All checks passed.\n", filename); + + return 1; +} + +int +main (int argc, char *argv[]) +{ + int c; + + do + { + c = getopt_long (argc, argv, optstring, longopts, 0); + switch (c) + { + case EOF: + break; + + case 'h': + usage (0); + break; + + case 'v': + printf ("mbchk (GNU GRUB " VERSION ")\n"); + exit (0); + break; + + case 'q': + quiet = 1; + break; + + default: + usage (1); + break; + } + } + while (c != EOF); + + if (optind < argc) + { + while (optind < argc) + { + FILE *fp; + + fp = fopen (argv[optind], "r"); + if (! fp) + { + fprintf (stderr, "%s: No such file.\n", argv[optind]); + exit (1); + } + + if (! check_multiboot (argv[optind], fp)) + exit (1); + + fclose (fp); + optind++; + } + } + else + { + if (! check_multiboot ("", stdin)) + exit (1); + } + + return 0; +} diff --git a/usr/src/grub/grub-0.97/util/mkbimage b/usr/src/grub/grub-0.97/util/mkbimage new file mode 100644 index 0000000000..689f694abf --- /dev/null +++ b/usr/src/grub/grub-0.97/util/mkbimage @@ -0,0 +1,417 @@ +#!/bin/sh +# MaKe a Bootable IMAGE --- 1.44, 2.88 and El Torito no-emulation mode +# C) 2001,2002,2003 Thierry Laronde +# C) 2001,2002,2003 Robert Millan + + +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, you can either send email to this +# program's maintainer or write to: The Free Software Foundation, +# Inc.; 59 Temple Place, Suite 330; Boston, MA 02111-1307, USA. + +# $Id: mkbimage,v 1.19 2004/07/21 14:43:04 robertmh Exp $ + +# Global variables +tarfile= +dir= +fs= #file system type +decompress= +image_type= +uname=`uname -s` +PATH=/sbin:$PATH + +# You can set GRUB_PATH if you need to use a specially located GRUB. +# This MUST end by a '/'! + + +#----------------------------DON'T CHANGE: INTERNALS + +block_size=512 +cylinders= +heads= +sectors= +cyl_size= +type_option= +geo_option= +image= +bk_120=$((2 * 15 * 80)) +bk_144=$((2 * 18 * 80)) +bk_288=$((2 * 36 * 80)) +bk_160=$((2 * 20 * 80)) +bk_168=$((2 * 21 * 80)) +bk_174=$((2 * 21 * 83)) +lo_options= +device_map= +mkfs_options= +debug= +stage2_os_name= + +# Name by which this script was invoked. +program=`echo "$0" | sed -e 's/[^\/]*\///g'` +version_number='$Revision: 1.19 $' + +usage=" +Usage: $program [-hVF] [-t TYPE] [-d DIRECTORY] [-s FS_TYPE] -f TAR_FILE +Make a Bootable IMAGE using GRUB as a bootloader + +Options: + Actions: + -d DIRECTORY [default CWD] + Directory where the boot.image and the partition subdirectories + are/will be created + -f TAR_FILE + Name of the tar file containing the filesystem to install. Can + be a pure tar file [.tar] or a compressed tar file + [.tar.gz|.tar.bz2] + -s FS_TYPE + Type of the file system to create on the virtual disk. Choices + are: + ext2 on GNU [default is ext2] + ext2, minix or msdos on GNU/Linux [default is ext2] + + -t TYPE + Type of the image to create. Choices are '1.20', '1.44', '1.60', + '1.68', '1.74', '2.88' or 'hd' [default is hd] + -F + Force to set the set_dpt flag (unnecessary 99% of the time! Be + careful! + Informations: + -D + turn Debugging on [xtrace] + -h|--help + display this Help and exit + -V|--version + display Version information and exit + +Copyright (c) 2001,2002,2003 Thierry Laronde . +Copyright (c) 2001,2002 Robert Millan . +GPLed." + +version="mkbimage $version_number + +Written by Thierry Laronde and Robert Millan. + +Copyright (c) 2001,2002,2003 Thierry Laronde . +Copyright (c) 2001,2002,2003 Robert Millan . + +This is free software under the GPL version 2 or later; see the source for +copying conditions. There is NO warranty, not even for MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE." + +# Functions + +error () +{ + case $1 in + bug) echo "This is a bug!"; + echo "$usage";; + option) echo "Unknow option"; echo "$usage";; + missing_argument) echo "You must give an argument to the option!"; + echo "$usage";; + missing_option) echo "You must indicate at least one option!"; + echo "$usage";; + must_be_root) echo "You must be root! (or install e2tools/mtools)";; + unknown_fs) if [ $uname = Linux ]; + then echo "The GNU/Linux supported fs are: ext2, minix or msdos!"; + elif [ $uname = GNU ]; + then echo "The GNU supported fs is ext2!"; + fi;; + unknown_format) echo "The tar file must be .tar|.tar.gz|.tar.bz2!";; + wont_fit) echo "The files won't fit on the selected type of media!";; + wrong_directory) echo "Directory inexistant or not given!"; + echo "$usage";; + wrong_file) echo "File inexistant or empty!"; + echo "$usage";; + wrong_type) echo "The type specified is not a valid one!"; + echo "$usage";; + esac + exit 1 +} + +# create a filesystem of type $fs in $image with offset $offset +mkbimage_mkfs () +{ + case $offset in + 0) lo_options="";; + *) lo_options="-o $offset";; + esac + + if [ "$offset" = "0" ] ; then + mkfs.$fs -F $image + elif [ `id -u` = "0" ] ; then + losetup $lo_options /dev/loop1 $image + mkfs.$fs /dev/loop1 + losetup -d /dev/loop1 + else + error must_be_root + fi +} + +# copy ${image}1/* to ${image}:/, assuming ${image} contains a filesystem +# of type $fs in offset $offset +mkbimage_cp () +{ + case $offset in + 0) lo_options="";; + *) lo_options="-o $offset";; + esac + case $fs in + ext2) + cp="e2cp"; + mkdir="e2mkdir";; + vfat) + cp="mcopy"; + mkdir="mmd";; + *) + cp=""; + mkdir="";; + esac + + if [ "$offset" = 0 ] && which $cp > /dev/null ; then + for dir in $(cd ${image}1 && find -type d) ; do + $mkdir ${image}:$dir + done + for file in $(cd ${image}1 && find -type f) ; do + $cp ${image}1/$file ${image}:$file + done + elif [ "`id -u`" = "0" ] ; then + losetup $lo_options /dev/loop1 $image + mkdir ${image}.mnt + mount -t $fs /dev/loop1 ${image}.mnt + cp -a ${image}1/* ${image}.mnt/ && sync + umount ${image}.mnt + rmdir ${image}.mnt + losetup -d /dev/loop1 + else + error must_be_root + fi +} + +#********************************************************************** +# MAIN PROGRAM * +#********************************************************************** + +#---------------------- Getting the options + +[ $# -eq 0 ] && error missing_option; + +while [ $# -gt 0 ]; do + case "$1" in + -d) shift; + dir="$1"; + [ ! -d "$1" ] && error wrong_directory;; + -f) shift; + tarfile="$1"; + [ -z "$tarfile" ] && error missing_argument;; + -s) shift; + fs="$1";; + -t) shift; + image_type="$1";; + -F) geo_option="-F";; + -D) debug="-v"; + set -x;; + -h|--help) echo "$usage"; exit 0;; + -V|--version) echo "$version"; exit 0;; + *) error option ;; + esac +shift +done +#---------------------- Sanity checks +[ ! "$tarfile" ] && error missing_argument; +[ ! -s "$tarfile" ] && error wrong_file; + +if [ ! "$image_type" ]; then + image_type=hd; +elif [ "$image_type" != "1.20" ] && [ "$image_type" != "1.44" ] \ + && [ "$image_type" != "1.60" ] && [ "$image_type" != "1.68" ] \ + && [ "$image_type" != "2.88" ] && [ "$image_type" != "1.74" ] \ + && [ "$image_type" != "hd" ] && [ "$image_type" != "1.60" ] ; then + error wrong_type ; +fi + +[ ! "$fs" ] && fs=ext2 + +# Carlo Contavalli reported that I [TL] have forgotten to specify the +# partition ID for sfdisk to correctly fill the partition table (ext2 is the +# default on Linux, so this worked in this case...). This is fixed below. +case "$fs" in + ext2) mkfs_options="-m 0"; + part_id="83";; # This is the default +# ufs) if [ $uname = Linux ]; +# then error unknown_fs; +# fi;; + minix) if [ $uname = GNU ]; + then error unknown_fs; + else + mkfs_options="-v"; # Minix version 2 + part_id="81"; + fi;; + msdos) if [ $uname = GNU ]; + then error unknown_fs; + else + mkfs_options="-f 1 -F 12"; # the smallest... + part_id="1"; + fi;; + *) error unknown_fs;; +esac + +# What type of tar file has been given ? + +suffix=`echo "$tarfile" | sed -n 's/^.*\.\([targbz2]\{2,3\}\)$/\1/p'` +case "$suffix" in + tar) decompress="cat";; + gz) decompress="gunzip -c";; + bz2) decompress="bunzip2 -c";; + *) error unknown_format;; +esac +#---------------------- Initializations + +[ ! "$dir" ] && dir=`pwd` + +image=$dir/$image_type.image +device_map=$dir/device.map + +# First, find the size of the tar file in block_size. +file_size=`$decompress $tarfile | wc -c | tr -d ' '` +file_size=$(($file_size / $block_size + 1)) + +# Increase in order to be sure that with a fs there will be enough +# room (trying 110%) +file_size=$(($file_size + $file_size / 10)) + +case "$image_type" in + hd) heads=16; + sectors=63; + cyl_size=$((16 * 63)); + # Create the minimum number of cylinders. At the moment, we leave + # some space by rounding everything up by adding 1 cylinder, plus + # another one for MBR + reserved track. + cylinders=$(($file_size / $cyl_size + 2));; + 1.20) [ $file_size -ge $bk_120 ] && error wont_fit; + heads=2; + sectors=15; + cyl_size=$((2 * 15)); + cylinders=80;; + 1.44) [ $file_size -ge $bk_144 ] && error wont_fit; + heads=2; + sectors=18; + cyl_size=$((2 * 18)); + cylinders=80;; + 1.60) [ $file_size -ge $bk_160 ] && error wont_fit; + heads=2; + sectors=20; + cyl_size=$((2 * 20)); + cylinders=80; + geo_option="-F";; + 1.68) [ $file_size -ge $bk_168 ] && error wont_fit; + heads=2; + sectors=21; + cyl_size=$((2 * 21)); + cylinders=80;; + 1.74) [ $file_size -ge $bk_174 ] && error wont_fit; + heads=2; + sectors=21; + cyl_size=$((2 * 21)); + cylinders=83;; + 2.88) [ $file_size -ge $bk_288 ] && error wont_fit; + heads=2; + sectors=36; + cyl_size=$((2 * 36)); + cylinders=80;; + *) error bug;; +esac + +type_option="-t $image_type" + +# We start by creating a virtual disk which size is the number of +# cylinders of $cyl_size mandatory to put the files stocked in the $tarfile +# Create the empty virtual disk +dd if=/dev/zero of=$image bs=$block_size count=$(($cyl_size * $cylinders)) + +# We then format the virtual disk +# NOTE: the El Torito specification wants only one partition. So we +# create the first, and the remaining 3 entries are empty. + +if [ "$image_type" = "hd" ]; then + sfdisk -C $cylinders -H $heads -S $sectors -D $image<$device_map +$device ${image} +EOT + +${GRUB_PATH}grub --device-map=$device_map --batch<.image of=/dev/fd0[u] bs=512 + +will be more than enough... if you have formated the floppy correctly +using \`superformat' to be found in \`fdutils' package. + +For El Torito floppy emulation : + +mkisofs -b -c boot.catalog -o raw.iso

+ +And for El Torito Hard Disk emulation: + +mkisofs -b -hard-disk-boot -c boot.catalog -o raw.iso + +Enjoy! +EOF + +rm -rf ${image}1 + +exit 0 diff --git a/usr/src/grub/splash.xpm.gz b/usr/src/grub/splash.xpm.gz index a87105faad..860aa06c19 100644 Binary files a/usr/src/grub/splash.xpm.gz and b/usr/src/grub/splash.xpm.gz differ -- cgit v1.2.3